PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / AutoLaunch / functions / vibes.js

vibes.js in Extendify trunk, at src/AutoLaunch/functions/vibes.js

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { replaceVibeBlocks } from '@shared/lib/vibe-blocks';
2 import { applyVibeGlobals, applyVibeStyles } from '@shared/lib/vibe-globals';
3 import { getVibes, vibesBySlug } from '@shared/lib/vibes';
4
5 // natural-1 is what the theme already ships, so it contributes nothing.
6 const isValidVibe = (selectedVibe) =>
7 !!selectedVibe &&
8 typeof selectedVibe === 'string' &&
9 selectedVibe.trim() !== '' &&
10 selectedVibe !== 'natural-1';
11
12 // Layout rides along because WordPress derives fluid type from wideSize.
13 export const computeVibeAdjustments = async (selectedVibe, variation) => {
14 if (!isValidVibe(selectedVibe)) return null;
15
16 const vibes = vibesBySlug(await getVibes(selectedVibe));
17 const vibe = vibes[selectedVibe];
18 if (!vibe) return null;
19
20 const styles = applyVibeStyles({
21 currentStyles: variation?.styles ?? {},
22 vibeStyles: vibe.styles,
23 vibes,
24 });
25
26 return {
27 settings: applyVibeGlobals({
28 currentSettings: variation?.settings ?? {},
29 vibeSettings: vibe.settings,
30 vibes,
31 }),
32 styles: {
33 ...styles,
34 blocks: replaceVibeBlocks({
35 currentBlocks: styles?.blocks,
36 vibeBlocks: vibe.blocks,
37 selectedVibe,
38 }),
39 },
40 };
41 };
42