@syncedco/flow 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -491,6 +491,10 @@ ${includeDefaults ? '@import "@syncedco/flow/defaults.css";\n' : ''}@import "./$
491
491
  )
492
492
  }
493
493
 
494
+ if (preset === 'wordpress') {
495
+ writeProjectFile(resolve(targetCwd, 'theme.json'), buildWordPressThemeJson(), force)
496
+ }
497
+
494
498
  if (!noScripts) addPackageScripts(targetCwd)
495
499
  if (agentsTarget !== undefined || args.includes('--agents')) {
496
500
  await installAgentGuidance({
@@ -2426,6 +2430,45 @@ function formatStringArray(values) {
2426
2430
  return `[${values.map((value) => `'${value}'`).join(', ')}]`
2427
2431
  }
2428
2432
 
2433
+ function buildWordPressThemeJson() {
2434
+ return `${JSON.stringify({
2435
+ $schema: 'https://schemas.wp.org/trunk/theme.json',
2436
+ version: 3,
2437
+ settings: {
2438
+ appearanceTools: true,
2439
+ color: {
2440
+ palette: [
2441
+ { slug: 'base', name: 'Base', color: 'var(--sf-colour-background)' },
2442
+ { slug: 'foreground', name: 'Foreground', color: 'var(--sf-colour-foreground)' },
2443
+ { slug: 'muted', name: 'Muted', color: 'var(--sf-colour-muted)' },
2444
+ { slug: 'surface', name: 'Surface', color: 'var(--sf-colour-surface)' },
2445
+ { slug: 'surface-alt', name: 'Surface Alt', color: 'var(--sf-colour-surface-alt)' },
2446
+ { slug: 'surface-elevated', name: 'Surface Elevated', color: 'var(--sf-colour-surface-elevated, var(--sf-colour-surface-raised))' },
2447
+ { slug: 'border', name: 'Border', color: 'var(--sf-colour-border)' },
2448
+ { slug: 'primary', name: 'Primary', color: 'var(--sf-colour-primary)' },
2449
+ { slug: 'primary-foreground', name: 'Primary Foreground', color: 'var(--sf-colour-primary-foreground)' },
2450
+ ],
2451
+ },
2452
+ layout: {
2453
+ contentSize: '72rem',
2454
+ wideSize: '90rem',
2455
+ },
2456
+ },
2457
+ styles: {
2458
+ color: {
2459
+ background: 'var(--sf-colour-background)',
2460
+ text: 'var(--sf-colour-foreground)',
2461
+ },
2462
+ spacing: {
2463
+ blockGap: 'var(--space-s-l)',
2464
+ },
2465
+ typography: {
2466
+ fontFamily: 'var(--sf-font-sans)',
2467
+ },
2468
+ },
2469
+ }, null, 2)}\n`
2470
+ }
2471
+
2429
2472
  function projectContains(targetCwd, needle) {
2430
2473
  return allProjectFiles(targetCwd).some((file) => readFileSync(file, 'utf8').includes(needle))
2431
2474
  }
@@ -28,6 +28,11 @@ Options:
28
28
  | `--no-scripts` | Do not update `package.json`. |
29
29
  | `--force` | Overwrite init-managed files. |
30
30
 
31
+ The WordPress preset also writes a `theme.json` colour palette that maps
32
+ WordPress editor presets such as `base`, `surface`, `surface-elevated`, and
33
+ `primary` to Synced Flow semantic tokens. Use those presets on blocks instead of
34
+ overriding WordPress `.has-*` preset classes in CSS.
35
+
31
36
  ## agents
32
37
 
33
38
  Install or inspect project-level AI guidance.
package/docs/wordpress.md CHANGED
@@ -18,6 +18,8 @@ The WordPress preset:
18
18
  - scans PHP, HTML, JS, TS, JSX, TSX, Twig, Vue, Svelte, Astro, and MDX files
19
19
  - enables `includeCore`
20
20
  - writes `assets/css/synced-flow.css`
21
+ - writes a `theme.json` palette that maps WordPress colour presets to Synced
22
+ Flow semantic tokens
21
23
 
22
24
  See [`examples/wordpress`](../examples/wordpress) for a lean block theme style
23
25
  template with `theme.json`, template parts, PHP patterns, enqueue code, and an
@@ -54,6 +56,37 @@ wp_enqueue_style(
54
56
  For plugins, use `plugins_url()` or `plugin_dir_url()` instead of
55
57
  `get_theme_file_uri()`.
56
58
 
59
+ ## WordPress Presets
60
+
61
+ WordPress emits editor preset classes such as `.has-base-background-color`,
62
+ `.has-primary-color`, and `.has-large-font-size` with `!important`. Treat those
63
+ classes as the editor's chosen design value.
64
+
65
+ Do not override `.has-*` preset classes in project CSS. Add or choose a better
66
+ semantic preset instead, then use that preset on the block.
67
+
68
+ The generated `theme.json` maps common WordPress colour presets to Synced Flow
69
+ tokens:
70
+
71
+ ```json
72
+ {
73
+ "slug": "surface-elevated",
74
+ "name": "Surface Elevated",
75
+ "color": "var(--sf-colour-surface-elevated, var(--sf-colour-surface-raised))"
76
+ }
77
+ ```
78
+
79
+ Use those presets for any block that needs an editor-visible design role:
80
+
81
+ - `base` for page backgrounds
82
+ - `surface` and `surface-alt` for standard panels
83
+ - `surface-elevated` for chrome, mastheads, footers, sticky bars, and raised
84
+ regions
85
+ - `primary` and `primary-foreground` for branded actions
86
+
87
+ If a new visual role appears repeatedly, add it to `synced-flow.config.mjs` and
88
+ expose it in `theme.json`; avoid adding `!important` overrides.
89
+
57
90
  ## Dynamic Classes
58
91
 
59
92
  Synced Flow generates utility CSS from complete class tokens. Keep class names
@@ -168,6 +168,8 @@
168
168
  --color-surface: var(--sf-colour-surface);
169
169
  --sf-colour-surface-alt: oklch(96.4% 0.011 80);
170
170
  --color-surface-alt: var(--sf-colour-surface-alt);
171
+ --sf-colour-surface-elevated: var(--sf-colour-surface-raised);
172
+ --color-surface-elevated: var(--sf-colour-surface-elevated);
171
173
  --sf-colour-border: oklch(18% 0.026 250 / 0.12);
172
174
  --color-border: var(--sf-colour-border);
173
175
  --sf-colour-primary: oklch(68% 0.18 44);
@@ -1,5 +1,5 @@
1
- <!-- wp:group {"tagName":"footer","className":"sf-footer"} -->
2
- <footer class="wp-block-group sf-footer">
1
+ <!-- wp:group {"tagName":"footer","backgroundColor":"surface-elevated","className":"sf-footer"} -->
2
+ <footer class="wp-block-group sf-footer has-surface-elevated-background-color has-background">
3
3
  <!-- wp:group {"className":"sf-container sf-repel"} -->
4
4
  <div class="wp-block-group sf-container sf-repel">
5
5
  <!-- wp:paragraph {"className":"sf-text-muted"} -->
@@ -1,5 +1,5 @@
1
- <!-- wp:group {"tagName":"header","className":"sf-section sf-section--compact sf-sticky-top sf-bg-background"} -->
2
- <header class="wp-block-group sf-section sf-section--compact sf-sticky-top sf-bg-background">
1
+ <!-- wp:group {"tagName":"header","backgroundColor":"surface-elevated","className":"sf-section sf-section--compact sf-sticky-top"} -->
2
+ <header class="wp-block-group sf-section sf-section--compact sf-sticky-top has-surface-elevated-background-color has-background">
3
3
  <!-- wp:group {"className":"sf-container sf-nav","layout":{"type":"flex","justifyContent":"space-between"}} -->
4
4
  <div class="wp-block-group sf-container sf-nav">
5
5
  <!-- wp:site-title {"className":"sf-nav__link"} /-->
@@ -3,12 +3,65 @@
3
3
  "version": 3,
4
4
  "settings": {
5
5
  "appearanceTools": true,
6
+ "color": {
7
+ "palette": [
8
+ {
9
+ "slug": "base",
10
+ "name": "Base",
11
+ "color": "var(--sf-colour-background)"
12
+ },
13
+ {
14
+ "slug": "foreground",
15
+ "name": "Foreground",
16
+ "color": "var(--sf-colour-foreground)"
17
+ },
18
+ {
19
+ "slug": "muted",
20
+ "name": "Muted",
21
+ "color": "var(--sf-colour-muted)"
22
+ },
23
+ {
24
+ "slug": "surface",
25
+ "name": "Surface",
26
+ "color": "var(--sf-colour-surface)"
27
+ },
28
+ {
29
+ "slug": "surface-alt",
30
+ "name": "Surface Alt",
31
+ "color": "var(--sf-colour-surface-alt)"
32
+ },
33
+ {
34
+ "slug": "surface-elevated",
35
+ "name": "Surface Elevated",
36
+ "color": "var(--sf-colour-surface-elevated, var(--sf-colour-surface-raised))"
37
+ },
38
+ {
39
+ "slug": "border",
40
+ "name": "Border",
41
+ "color": "var(--sf-colour-border)"
42
+ },
43
+ {
44
+ "slug": "primary",
45
+ "name": "Primary",
46
+ "color": "var(--sf-colour-primary)"
47
+ },
48
+ {
49
+ "slug": "primary-foreground",
50
+ "name": "Primary Foreground",
51
+ "color": "var(--sf-colour-primary-foreground)"
52
+ }
53
+ ]
54
+ },
6
55
  "layout": {
7
56
  "contentSize": "72rem",
8
57
  "wideSize": "90rem"
9
58
  }
10
59
  },
11
60
  "styles": {
61
+ "color": {
62
+ "background": "var(--sf-colour-background)",
63
+ "text": "var(--sf-colour-foreground)"
64
+ },
12
65
  "spacing": {
13
66
  "blockGap": "var(--space-s-l)"
14
67
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncedco/flow",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "AI-native fluid CSS design system for brand-consistent websites and agency builds.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.2.2",
package/src/presets.mjs CHANGED
@@ -10,6 +10,7 @@ export const themePresets = {
10
10
  muted: 'oklch(45% 0.018 236)',
11
11
  surface: 'oklch(100% 0 0)',
12
12
  surfaceAlt: 'oklch(96.4% 0.011 80)',
13
+ surfaceElevated: 'var(--sf-colour-surface-raised)',
13
14
  border: 'oklch(18% 0.026 250 / 0.12)',
14
15
  primary: 'oklch(68% 0.18 44)',
15
16
  primaryHover: 'oklch(60% 0.17 42)',
@@ -46,6 +47,7 @@ export const themePresets = {
46
47
  muted: 'oklch(44.6% 0.043 257)',
47
48
  surface: 'oklch(100% 0 0)',
48
49
  surfaceAlt: 'oklch(96.8% 0.007 247)',
50
+ surfaceElevated: 'var(--sf-colour-surface-raised)',
49
51
  border: 'oklch(20.8% 0.042 265 / 0.12)',
50
52
  primary: 'oklch(52% 0.14 250)',
51
53
  primaryHover: 'oklch(44% 0.13 250)',
@@ -84,6 +86,7 @@ export const themePresets = {
84
86
  muted: 'oklch(43% 0.02 65)',
85
87
  surface: 'oklch(100% 0 0)',
86
88
  surfaceAlt: 'oklch(94% 0.02 80)',
89
+ surfaceElevated: 'var(--sf-colour-surface-raised)',
87
90
  border: 'oklch(18% 0.022 55 / 0.14)',
88
91
  primary: 'oklch(58% 0.17 42)',
89
92
  primaryHover: 'oklch(50% 0.16 40)',
@@ -122,6 +125,7 @@ export const themePresets = {
122
125
  muted: 'oklch(78% 0.012 86)',
123
126
  surface: 'oklch(18% 0.026 250)',
124
127
  surfaceAlt: 'oklch(22% 0.024 248)',
128
+ surfaceElevated: 'var(--sf-colour-surface-raised)',
125
129
  border: 'oklch(100% 0 0 / 0.14)',
126
130
  primary: 'oklch(70% 0.12 205)',
127
131
  primaryHover: 'oklch(76% 0.12 205)',