@syncedco/flow 0.1.0
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.
- package/CODE_OF_CONDUCT.md +26 -0
- package/CONTRIBUTING.md +54 -0
- package/LICENSE +21 -0
- package/README.md +334 -0
- package/SECURITY.md +30 -0
- package/SUPPORT.md +32 -0
- package/TRADEMARKS.md +14 -0
- package/base.css +100 -0
- package/bin/synced-flow.mjs +4639 -0
- package/components.css +1392 -0
- package/defaults.css +26 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.js +3 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +67 -0
- package/docs/accessibility-css.md +133 -0
- package/docs/ai-usage.md +112 -0
- package/docs/api-contract.md +81 -0
- package/docs/base-styling.md +113 -0
- package/docs/build-a-site-walkthrough.md +122 -0
- package/docs/cli-reference.md +230 -0
- package/docs/config-reference.md +81 -0
- package/docs/css-optimisation.md +117 -0
- package/docs/migration-from-tailwind.md +60 -0
- package/docs/native-components.md +156 -0
- package/docs/patterns.md +32 -0
- package/docs/presets.md +60 -0
- package/docs/quick-start.md +252 -0
- package/docs/recipes.md +285 -0
- package/docs/release-readiness.md +63 -0
- package/docs/system-primitives.md +150 -0
- package/docs/tailwind-comparison.md +66 -0
- package/docs/tokens.md +79 -0
- package/docs/website-patterns.md +114 -0
- package/docs/why-synced-flow.md +99 -0
- package/docs/wordpress.md +66 -0
- package/examples/README.md +16 -0
- package/examples/astro/package.json +19 -0
- package/examples/astro/src/pages/index.astro +85 -0
- package/examples/astro/src/styles/synced-flow.css +2 -0
- package/examples/astro/src/styles/synced-flow.generated.css +206 -0
- package/examples/astro/synced-flow.config.mjs +9 -0
- package/examples/next/app/layout.tsx +14 -0
- package/examples/next/app/page.tsx +92 -0
- package/examples/next/app/synced-flow.css +2 -0
- package/examples/next/app/synced-flow.generated.css +205 -0
- package/examples/next/package.json +19 -0
- package/examples/next/synced-flow.config.mjs +9 -0
- package/examples/plain-html/index.html +384 -0
- package/examples/plain-html/package.json +15 -0
- package/examples/plain-html/synced-flow.config.mjs +9 -0
- package/examples/plain-html/synced-flow.css +2 -0
- package/examples/plain-html/synced-flow.generated.css +205 -0
- package/examples/templates/README.md +22 -0
- package/examples/templates/blog-index.html +41 -0
- package/examples/templates/coming-soon.html +27 -0
- package/examples/templates/portfolio-scroll.html +45 -0
- package/examples/templates/saas-dashboard.html +171 -0
- package/examples/templates/saas-landing.html +104 -0
- package/examples/vite/index.html +2 -0
- package/examples/vite/package.json +20 -0
- package/examples/vite/src/main.jsx +27 -0
- package/examples/vite/src/synced-flow.css +2 -0
- package/examples/vite/src/synced-flow.generated.css +205 -0
- package/examples/vite/synced-flow.config.mjs +9 -0
- package/examples/wordpress/assets/css/synced-flow.css +641 -0
- package/examples/wordpress/functions.php +13 -0
- package/examples/wordpress/package.json +15 -0
- package/examples/wordpress/parts/footer.html +12 -0
- package/examples/wordpress/parts/header.html +10 -0
- package/examples/wordpress/patterns/contact-cta.php +28 -0
- package/examples/wordpress/patterns/feature-grid.php +38 -0
- package/examples/wordpress/patterns/landing-hero.php +45 -0
- package/examples/wordpress/synced-flow.config.mjs +11 -0
- package/examples/wordpress/templates/front-page.html +11 -0
- package/examples/wordpress/templates/index.html +27 -0
- package/examples/wordpress/theme.json +19 -0
- package/layout.css +365 -0
- package/package.json +93 -0
- package/reset.css +13 -0
- package/skills/synced-flow/SKILL.md +151 -0
- package/src/config.ts +98 -0
- package/src/index.ts +75 -0
- package/src/presets.d.mts +21 -0
- package/src/presets.mjs +171 -0
- package/src/tokens.mjs +138 -0
- package/src/utility-tokens.mjs +47 -0
- package/styles.css +2313 -0
- package/tokens.css +198 -0
- package/utilities.css +255 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Build A Site Walkthrough
|
|
2
|
+
|
|
3
|
+
This walkthrough shows the intended real-world flow for a new website: theme
|
|
4
|
+
decisions first, then recipes, then verification.
|
|
5
|
+
|
|
6
|
+
## 1. Install And Initialise
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @syncedco/flow
|
|
10
|
+
pnpm exec synced-flow init --preset next --theme synced --agents
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use the closest preset: `next`, `astro`, `vite`, `wordpress`, or `plain`.
|
|
14
|
+
For WordPress, see [WordPress](wordpress.md) and the
|
|
15
|
+
[`examples/wordpress`](../examples/wordpress) template.
|
|
16
|
+
|
|
17
|
+
`--agents` adds a project-level `AGENTS.md` Synced Flow section so AI coding
|
|
18
|
+
agents can find the packaged skill and the right CLI checks. Existing projects
|
|
19
|
+
can run `pnpm exec synced-flow agents install`.
|
|
20
|
+
|
|
21
|
+
## 2. Write A Theme Brief
|
|
22
|
+
|
|
23
|
+
Create `brief.md`:
|
|
24
|
+
|
|
25
|
+
```md
|
|
26
|
+
Modern B2B SaaS site.
|
|
27
|
+
Radius: slightly rounded, not pill shaped.
|
|
28
|
+
Fonts: Inter/system UI with clean display headings.
|
|
29
|
+
Primary colour: blue.
|
|
30
|
+
Accent colour: green.
|
|
31
|
+
Surface style: raised cards.
|
|
32
|
+
Density: spacious sections.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Generate a validated theme block:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm exec synced-flow theme init --from brief.md --preset-base neutral-saas
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If the brief misses decisions such as radius, fonts, primary colour, accent
|
|
42
|
+
colour, surface style, or density, the command prints warnings and fills
|
|
43
|
+
sensible defaults. Paste the generated `theme` block into
|
|
44
|
+
`synced-flow.config.mjs`.
|
|
45
|
+
|
|
46
|
+
## 3. Pick A Recipe
|
|
47
|
+
|
|
48
|
+
Ask Synced Flow for matching recipes:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm exec synced-flow suggest "SaaS landing page with pricing and FAQ"
|
|
52
|
+
pnpm exec synced-flow suggest "scroll portfolio with contact" --scaffold --framework next --dry-run
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Print copy-ready markup:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm exec synced-flow recipe saas-landing --framework next --markup
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For a single section:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm exec synced-flow recipe --section form --framework next --markup
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For interaction patterns such as mobile drawers or scroll panels:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pnpm exec synced-flow pattern --list
|
|
71
|
+
pnpm exec synced-flow pattern mobile-nav-drawer --framework next --markup
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Available page recipes include `saas-landing`, `portfolio-scroll`,
|
|
75
|
+
`saas-dashboard`, `agency-home`, `blog-index`, `article-page`,
|
|
76
|
+
`about-timeline`, `team-grid`, `contact-page`, `not-found`, and
|
|
77
|
+
`coming-soon`.
|
|
78
|
+
|
|
79
|
+
Choose `saas-landing` for public SaaS marketing pages. Choose
|
|
80
|
+
`saas-dashboard` for authenticated app screens with login/account state,
|
|
81
|
+
workspace navigation, metrics, tables, and activity panels.
|
|
82
|
+
|
|
83
|
+
## 4. Edit Content, Not CSS
|
|
84
|
+
|
|
85
|
+
Replace headings, links, images, prices, and form fields in the recipe markup.
|
|
86
|
+
Keep the `sf-*` structure where possible:
|
|
87
|
+
|
|
88
|
+
- layout: `sf-container`, `sf-section`, `sf-stack`, `sf-split`, `sf-auto-grid`
|
|
89
|
+
- components: `sf-button`, `sf-card`, `sf-form`, `sf-nav`, `sf-disclosure`
|
|
90
|
+
- content: `sf-prose`, `sf-meta`, `sf-figure`, `sf-table-wrap`
|
|
91
|
+
|
|
92
|
+
Use `synced-flow catalog --json` when an AI agent needs the full public API.
|
|
93
|
+
Use `synced-flow pattern <id> --json` when it needs accessibility notes,
|
|
94
|
+
gotchas, and framework-specific markup for native interactions.
|
|
95
|
+
|
|
96
|
+
## 5. Build And Verify
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pnpm flow:build
|
|
100
|
+
pnpm flow:check
|
|
101
|
+
pnpm exec synced-flow lint --json
|
|
102
|
+
pnpm flow:doctor
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`lint` catches unsupported class tokens, suggests nearest alternatives, and
|
|
106
|
+
warns about incomplete native interaction composition such as drawers without
|
|
107
|
+
close paths or dynamic class fragments.
|
|
108
|
+
`doctor` checks setup, generated CSS freshness, theme shape, duplicate imports,
|
|
109
|
+
ad hoc token overrides, AI guidance, and release-facing guardrails.
|
|
110
|
+
|
|
111
|
+
## 6. Keep It Lean
|
|
112
|
+
|
|
113
|
+
Use the full core import while building:
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
@import "@syncedco/flow/styles.css";
|
|
117
|
+
@import "./synced-flow.generated.css";
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
For tighter loading, switch to modular imports only if the project has a clear
|
|
121
|
+
reason to omit a layer. Do not import `styles.css` and modular core files
|
|
122
|
+
together.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# CLI Reference
|
|
2
|
+
|
|
3
|
+
## init
|
|
4
|
+
|
|
5
|
+
Scaffold Synced Flow into a project.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm exec synced-flow init --preset next
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
|
|
13
|
+
| Option | Purpose |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `--preset next` | Next.js app or pages project. |
|
|
16
|
+
| `--preset vite` | Vite React project. |
|
|
17
|
+
| `--preset astro` | Astro project. |
|
|
18
|
+
| `--preset wordpress` | WordPress theme or plugin with enqueue-ready CSS output. |
|
|
19
|
+
| `--preset plain` | Plain HTML/CSS project. |
|
|
20
|
+
| `--agents <target>` | Install project-level AI guidance after init. Omit the value for `universal`. |
|
|
21
|
+
| `--theme <name>` | Use `synced`, `neutral-saas`, `editorial`, or `dark-app`. |
|
|
22
|
+
| `--scan <dir>` | Add source directories. |
|
|
23
|
+
| `--out <file>` | Choose generated CSS output path. |
|
|
24
|
+
| `--safelist <classes>` | Add always-generated classes. |
|
|
25
|
+
| `--include-core` | Write a single CSS output that includes tokens, reset, base, layout, and components. |
|
|
26
|
+
| `--defaults` / `--no-defaults` | Include or exclude optional site/UI defaults during init. |
|
|
27
|
+
| `--responsive-variants` | Enable migration support for `sm:`/`lg:` classes. |
|
|
28
|
+
| `--no-scripts` | Do not update `package.json`. |
|
|
29
|
+
| `--force` | Overwrite init-managed files. |
|
|
30
|
+
|
|
31
|
+
## agents
|
|
32
|
+
|
|
33
|
+
Install or inspect project-level AI guidance.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pnpm exec synced-flow agents install
|
|
37
|
+
pnpm exec synced-flow agents install --target all
|
|
38
|
+
pnpm exec synced-flow agents install --target cursor --dry-run
|
|
39
|
+
pnpm exec synced-flow agents status
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Targets are `universal`, `cursor`, `codex`, `claude`, `copilot`, `windsurf`,
|
|
43
|
+
`gemini`, `aider`, and `all`. The default target is `universal`, which writes a
|
|
44
|
+
managed Synced Flow section to `AGENTS.md`. Tool-specific targets add
|
|
45
|
+
project-local instruction or skill files where the tool supports them.
|
|
46
|
+
|
|
47
|
+
Use `--force` to refresh managed guidance and `--dry-run` to preview writes.
|
|
48
|
+
|
|
49
|
+
## skill
|
|
50
|
+
|
|
51
|
+
Print the packaged Synced Flow skill location and the project setup commands.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm exec synced-flow skill
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## add defaults
|
|
58
|
+
|
|
59
|
+
Add the optional site/UI defaults import to an existing CSS entry.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pnpm exec synced-flow add defaults --file src/synced-flow.css
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If `--file` is omitted, the CLI looks for the CSS entry created by `init`.
|
|
66
|
+
|
|
67
|
+
## build
|
|
68
|
+
|
|
69
|
+
Generate project utility CSS.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm exec synced-flow build
|
|
73
|
+
pnpm exec synced-flow build --check
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use `--check` in CI to fail when the generated file is stale.
|
|
77
|
+
|
|
78
|
+
Generated CSS only includes source-scanned utility classes, configured theme
|
|
79
|
+
overrides, and keyframes needed by scanned animation classes.
|
|
80
|
+
|
|
81
|
+
## watch
|
|
82
|
+
|
|
83
|
+
Run `build`, then rebuild when configured scan files change.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm exec synced-flow watch
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`watch` uses the same config and options as `build`. It is a small development
|
|
90
|
+
loop helper and does not add a bundler or runtime dependency.
|
|
91
|
+
|
|
92
|
+
## lint
|
|
93
|
+
|
|
94
|
+
Scan configured source files and report unsupported class tokens with nearest
|
|
95
|
+
public Synced Flow alternatives. It also reports composition warnings for
|
|
96
|
+
common AI-generated structural mistakes.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pnpm exec synced-flow lint
|
|
100
|
+
pnpm exec synced-flow lint --json
|
|
101
|
+
pnpm exec synced-flow lint --json src components
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use this before handoff when an AI agent or template generator has composed
|
|
105
|
+
markup. It catches misspelled generated utilities such as `text-prmary` and
|
|
106
|
+
unknown `sf-*` classes such as `sf-buton`.
|
|
107
|
+
|
|
108
|
+
Composition rules include `popover-missing-close`, `mobile-nav-incomplete`,
|
|
109
|
+
`dynamic-class-fragment`, `invalid-popover-on-anchor`,
|
|
110
|
+
`theme-override-in-css`, and `unknown-generated-utility`. JSON output returns
|
|
111
|
+
`ok` and an `issues[]` array with `rule`, `severity`, `file`, `line`,
|
|
112
|
+
`message`, and `fix`. `--fix` is accepted for forward compatibility; current
|
|
113
|
+
composition rules provide guided fixes rather than rewriting source.
|
|
114
|
+
|
|
115
|
+
## doctor
|
|
116
|
+
|
|
117
|
+
Inspect project setup.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pnpm exec synced-flow doctor
|
|
121
|
+
pnpm exec synced-flow validate
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Checks include package installation, package scripts, config, generated CSS,
|
|
125
|
+
core stylesheet import, lint status, theme shape, duplicate core imports,
|
|
126
|
+
ad hoc token overrides, Tailwind residue, AI agent guidance, and whether strict
|
|
127
|
+
fluid mode is on.
|
|
128
|
+
|
|
129
|
+
`validate` is an alias for `doctor`.
|
|
130
|
+
|
|
131
|
+
## tokens
|
|
132
|
+
|
|
133
|
+
Print supported tokens, presets, and starter classes.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pnpm exec synced-flow tokens
|
|
137
|
+
pnpm exec synced-flow tokens --json
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Use `--json` when an AI agent or generator needs a machine-readable map.
|
|
141
|
+
|
|
142
|
+
## catalog
|
|
143
|
+
|
|
144
|
+
Print the public API catalog: CSS files, commands, tokens, classes, native
|
|
145
|
+
component patterns, recipes, and guardrails.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pnpm exec synced-flow catalog
|
|
149
|
+
pnpm exec synced-flow catalog --json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use `catalog --json` when an AI agent needs to choose the right recipe or class
|
|
153
|
+
surface before writing markup.
|
|
154
|
+
|
|
155
|
+
## suggest
|
|
156
|
+
|
|
157
|
+
Return matching recipes and classes for a short site or section brief.
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pnpm exec synced-flow suggest "full page scroll portfolio"
|
|
161
|
+
pnpm exec synced-flow suggest "native drawer menu and contact form" --json
|
|
162
|
+
pnpm exec synced-flow suggest "scroll portfolio" --scaffold --framework next --dry-run
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
JSON output includes matching section patterns and full-page recipes. Use the
|
|
166
|
+
recipe id with `recipe` when an agent needs copy-ready markup.
|
|
167
|
+
|
|
168
|
+
With `--scaffold`, Synced Flow prints or writes a minimal starter for
|
|
169
|
+
`next`, `vite`, `astro`, or `plain`. Use `--out <dir>` to choose the project
|
|
170
|
+
directory, `--dry-run` to print the file tree and contents, and `--force` to
|
|
171
|
+
overwrite scaffold-managed files.
|
|
172
|
+
|
|
173
|
+
## pattern
|
|
174
|
+
|
|
175
|
+
List or print copy-ready interaction patterns.
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pnpm exec synced-flow pattern --list
|
|
179
|
+
pnpm exec synced-flow pattern mobile-nav-drawer --framework next --markup
|
|
180
|
+
pnpm exec synced-flow pattern scroll-viewport-sections --json
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Current interaction patterns include `mobile-nav-drawer`,
|
|
184
|
+
`scroll-viewport-sections`, `scroll-viewport-with-spy`,
|
|
185
|
+
`native-dialog-react`, and `popover-drawer-layout`. Pattern JSON includes
|
|
186
|
+
classes, framework markup, JS requirement notes, accessibility notes, and
|
|
187
|
+
implementation gotchas.
|
|
188
|
+
|
|
189
|
+
## recipe
|
|
190
|
+
|
|
191
|
+
List or print page-level recipes.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
pnpm exec synced-flow recipe
|
|
195
|
+
pnpm exec synced-flow recipe saas-landing
|
|
196
|
+
pnpm exec synced-flow recipe portfolio-scroll --markup
|
|
197
|
+
pnpm exec synced-flow recipe portfolio-scroll --framework next --markup
|
|
198
|
+
pnpm exec synced-flow recipe --section hero --framework astro --markup
|
|
199
|
+
pnpm exec synced-flow recipe coming-soon --json
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Current recipes include SaaS landing, scroll portfolio, agency homepage, blog
|
|
203
|
+
index, article page, about timeline, team grid, contact page, 404, coming soon,
|
|
204
|
+
and SaaS dashboard. Use `saas-landing` for public product marketing and
|
|
205
|
+
`saas-dashboard` for authenticated app UI with account state, metrics, tables,
|
|
206
|
+
and workspace navigation. Recipes are composed from public `sf-*` classes and
|
|
207
|
+
are intended as copy-paste starting points rather than new utility APIs.
|
|
208
|
+
|
|
209
|
+
Use `--framework html`, `--framework next`, `--framework react`, or
|
|
210
|
+
`--framework astro` to adapt markup. Use `--section <id-or-keyword>` to print a
|
|
211
|
+
single section pattern such as `hero`, `scroll`, `tabs`, or `form`.
|
|
212
|
+
|
|
213
|
+
## theme
|
|
214
|
+
|
|
215
|
+
Create or validate theme tokens without scattering brand decisions through page
|
|
216
|
+
CSS.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pnpm exec synced-flow theme init --from brief.md
|
|
220
|
+
pnpm exec synced-flow theme init --from brief.md --preset-base neutral-saas
|
|
221
|
+
pnpm exec synced-flow theme init --from brief.md --json
|
|
222
|
+
pnpm exec synced-flow theme validate
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`theme init --from` reads a simple brief for radius, fonts, colours, card style,
|
|
226
|
+
and density, then prints a validated `theme` block for
|
|
227
|
+
`synced-flow.config.mjs`. `theme validate` checks the configured theme shape.
|
|
228
|
+
Use `--preset-base synced`, `--preset-base neutral-saas`,
|
|
229
|
+
`--preset-base editorial`, or `--preset-base dark-app` to inherit a starting
|
|
230
|
+
preset before applying brief-derived overrides.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Config Reference
|
|
2
|
+
|
|
3
|
+
Create `synced-flow.config.mjs` in the project root.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import { defineConfig } from '@syncedco/flow/config'
|
|
7
|
+
import { themePresets } from '@syncedco/flow/presets'
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
scan: ['src', 'components'],
|
|
11
|
+
out: 'src/synced-flow.generated.css',
|
|
12
|
+
responsiveVariants: false,
|
|
13
|
+
includeDefaults: true,
|
|
14
|
+
safelist: [],
|
|
15
|
+
theme: themePresets.synced,
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Options
|
|
20
|
+
|
|
21
|
+
| Option | Type | Purpose |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `cwd` | `string` | Resolve scan and output paths from a specific directory. |
|
|
24
|
+
| `scan` | `string[]` | Source directories scanned for complete class tokens. |
|
|
25
|
+
| `safelist` | `string[]` | Class tokens to always generate for dynamic class cases. |
|
|
26
|
+
| `out` | `string` | Generated CSS output path. |
|
|
27
|
+
| `includeCore` | `boolean` | Include reset/base/layout/component CSS in generated output. |
|
|
28
|
+
| `includeDefaults` | `boolean` | Include optional site/UI defaults when `includeCore` is true. |
|
|
29
|
+
| `responsiveVariants` | `boolean` | Enable `sm:`, `md:`, `lg:`, `xl:` compatibility variants. |
|
|
30
|
+
| `failOnUnsupported` | `boolean` | Fail when unsupported class tokens are detected. |
|
|
31
|
+
| `quiet` | `boolean` | Suppress non-critical warnings. |
|
|
32
|
+
| `theme` | `object` | Project token overrides emitted into generated CSS. |
|
|
33
|
+
|
|
34
|
+
Set `includeCore: true` for environments that enqueue a plain CSS file and do
|
|
35
|
+
not process npm CSS imports, such as many WordPress themes and plugins.
|
|
36
|
+
Set `includeDefaults: true` with `includeCore` when that single generated file should
|
|
37
|
+
also remove raw link underlines and list markers for site/UI surfaces.
|
|
38
|
+
|
|
39
|
+
## Theme
|
|
40
|
+
|
|
41
|
+
Theme values become CSS custom properties in the generated file. Synced Flow
|
|
42
|
+
emits both the public `--sf-*` token and the utility-compatible alias where
|
|
43
|
+
needed.
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
theme: {
|
|
47
|
+
fonts: {
|
|
48
|
+
sans: 'Inter, ui-sans-serif, system-ui, sans-serif',
|
|
49
|
+
display: 'Fraunces, Georgia, serif',
|
|
50
|
+
mono: '"SF Mono", ui-monospace, monospace',
|
|
51
|
+
},
|
|
52
|
+
colours: {
|
|
53
|
+
background: 'oklch(98.6% 0.006 80)',
|
|
54
|
+
foreground: 'oklch(18% 0.026 250)',
|
|
55
|
+
primary: 'oklch(68% 0.18 44)',
|
|
56
|
+
primaryHover: 'oklch(60% 0.18 44)',
|
|
57
|
+
primaryForeground: 'oklch(100% 0 0)',
|
|
58
|
+
border: 'oklch(18% 0.026 250 / 0.12)',
|
|
59
|
+
},
|
|
60
|
+
darkColours: {
|
|
61
|
+
background: 'oklch(13.5% 0.03 252)',
|
|
62
|
+
foreground: 'oklch(96% 0.008 86)',
|
|
63
|
+
},
|
|
64
|
+
radii: {
|
|
65
|
+
md: '0.5rem',
|
|
66
|
+
lg: '0.75rem',
|
|
67
|
+
},
|
|
68
|
+
layout: {
|
|
69
|
+
containerMax: '72rem',
|
|
70
|
+
gutter: 'var(--space-s-l)',
|
|
71
|
+
columns: 12,
|
|
72
|
+
},
|
|
73
|
+
components: {
|
|
74
|
+
button: {
|
|
75
|
+
radius: 'var(--radius-md)',
|
|
76
|
+
blockSize: '2.75rem',
|
|
77
|
+
paddingInline: 'var(--space-s)',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# CSS Optimisation Notes
|
|
2
|
+
|
|
3
|
+
Current measurements from `pnpm build` on 2026-05-24.
|
|
4
|
+
|
|
5
|
+
## Developer Notes
|
|
6
|
+
|
|
7
|
+
Synced Flow keeps CSS loading small through three mechanisms:
|
|
8
|
+
|
|
9
|
+
- modular CSS layer exports for projects that do not need the full core file
|
|
10
|
+
- source-scanned utility generation, so project utility CSS is generated from
|
|
11
|
+
discovered class tokens instead of shipping every possible utility
|
|
12
|
+
- conditional generated helpers, so animation keyframes are emitted only when
|
|
13
|
+
scanned classes such as `animate-pulse` or `animate-spin` need them
|
|
14
|
+
|
|
15
|
+
The core stylesheet is intentionally built with modern CSS best practices:
|
|
16
|
+
cascade layers for predictable ordering, CSS custom properties for theming,
|
|
17
|
+
fluid `clamp()` scales, logical properties for writing-mode-friendly layout,
|
|
18
|
+
OKLCH colour tokens, container-aware layout primitives, and
|
|
19
|
+
`prefers-reduced-motion` safeguards.
|
|
20
|
+
|
|
21
|
+
CSS is not tree-shaken like JavaScript by default. The practical optimisation
|
|
22
|
+
model is to import only the layers a project needs, then let
|
|
23
|
+
`synced-flow build` generate project-specific utility CSS.
|
|
24
|
+
|
|
25
|
+
Choose either the bundled core stylesheet or modular layer imports. Do not
|
|
26
|
+
import `styles.css` alongside `tokens.css`, `reset.css`, `base.css`,
|
|
27
|
+
`layout.css`, `components.css`, or `utilities.css`, because `styles.css`
|
|
28
|
+
already contains those layers.
|
|
29
|
+
|
|
30
|
+
## Current CSS Sizes
|
|
31
|
+
|
|
32
|
+
Sizes are raw bytes and gzip bytes from `gzip -c`.
|
|
33
|
+
|
|
34
|
+
| File | Raw | Gzip | Use |
|
|
35
|
+
| --- | ---: | ---: | --- |
|
|
36
|
+
| `tokens.css` | 9,505 B | 2,232 B | Design tokens only. |
|
|
37
|
+
| `reset.css` | 713 B | 430 B | Reset layer only. |
|
|
38
|
+
| `base.css` | 3,455 B | 1,152 B | Base element styles. |
|
|
39
|
+
| `defaults.css` | 505 B | 296 B | Optional site/UI defaults for raw links, lists, and controls. |
|
|
40
|
+
| `layout.css` | 7,510 B | 1,866 B | Layout primitives such as container, stack, grid, app shell, sidebar, scroll snap, sticky, media object, and split. |
|
|
41
|
+
| `components.css` | 31,195 B | 5,001 B | Component primitives such as button, icon, avatar, chart, card, surface, nav, form, alert, native overlays, disclosure, tabs, website patterns, accessibility states, and input. |
|
|
42
|
+
| `utilities.css` | 7,498 B | 1,886 B | Static type, prose, content, positioning, motion, accessibility, link, list, colour, border, and shadow helpers. |
|
|
43
|
+
| `styles.css` | 59,051 B | 10,457 B | Full core stylesheet with tokens, reset, base, layout, components, and utilities. |
|
|
44
|
+
|
|
45
|
+
Example generated project CSS with tokens plus one scanned `text-primary`
|
|
46
|
+
utility measured 7,031 B raw and 1,943 B gzip.
|
|
47
|
+
|
|
48
|
+
## Import Choices
|
|
49
|
+
|
|
50
|
+
Use the full stylesheet when simplicity matters:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
@import "@syncedco/flow/styles.css";
|
|
54
|
+
@import "./synced-flow.generated.css";
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use layer imports instead when a project wants a smaller core surface:
|
|
58
|
+
|
|
59
|
+
```css
|
|
60
|
+
@import "@syncedco/flow/tokens.css";
|
|
61
|
+
@import "@syncedco/flow/reset.css";
|
|
62
|
+
@import "@syncedco/flow/base.css";
|
|
63
|
+
@import "@syncedco/flow/defaults.css";
|
|
64
|
+
@import "@syncedco/flow/layout.css";
|
|
65
|
+
@import "@syncedco/flow/components.css";
|
|
66
|
+
@import "@syncedco/flow/utilities.css";
|
|
67
|
+
@import "./synced-flow.generated.css";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Leave out `components.css` if the project only uses tokens and layout
|
|
71
|
+
primitives. Leave out `defaults.css` when content-style browser affordances should
|
|
72
|
+
stay intact. Leave out `utilities.css` unless the project uses static type,
|
|
73
|
+
prose, accessibility, link, list, or full-bleed helpers.
|
|
74
|
+
|
|
75
|
+
## WordPress
|
|
76
|
+
|
|
77
|
+
Many WordPress themes and plugins enqueue plain CSS rather than resolving npm CSS
|
|
78
|
+
imports through a bundler. Use the WordPress preset for that environment:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm exec synced-flow init --preset wordpress
|
|
82
|
+
pnpm flow:build
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
That preset scans PHP and template files, enables `includeCore`, and writes a
|
|
86
|
+
single enqueue-ready file at `assets/css/synced-flow.css`.
|
|
87
|
+
|
|
88
|
+
## Marketing Notes
|
|
89
|
+
|
|
90
|
+
Safe claims:
|
|
91
|
+
|
|
92
|
+
- Modern CSS-first: Synced Flow uses cascade layers, custom properties,
|
|
93
|
+
`clamp()`, logical properties, OKLCH colour, and container-aware primitives.
|
|
94
|
+
- Compact by default: the full core stylesheet is currently about 10.5 KB gzip.
|
|
95
|
+
- Flexible loading: developers can import only the CSS layers their project
|
|
96
|
+
uses.
|
|
97
|
+
- Source-scanned utilities: project utility CSS is generated from actual class
|
|
98
|
+
usage rather than shipping a large universal utility file.
|
|
99
|
+
- WordPress-ready: themes and plugins can build one enqueue-ready CSS file.
|
|
100
|
+
- Dependency-free runtime: the JavaScript entry currently ships without runtime
|
|
101
|
+
package dependencies.
|
|
102
|
+
|
|
103
|
+
The package guardrail script enforces current gzip budgets:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm guardrails
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Budgets are intentionally tight enough to catch accidental bloat while leaving
|
|
110
|
+
room for small improvements to the core primitives.
|
|
111
|
+
|
|
112
|
+
Avoid claiming:
|
|
113
|
+
|
|
114
|
+
- automatic CSS tree-shaking in every bundler
|
|
115
|
+
- a full Tailwind feature replacement
|
|
116
|
+
- fixed size guarantees, because CSS size changes as tokens and primitives
|
|
117
|
+
evolve
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Migration From Tailwind
|
|
2
|
+
|
|
3
|
+
Synced Flow is not a one-for-one Tailwind replacement. The useful migration
|
|
4
|
+
path is to keep class names complete, move project identity into tokens, and
|
|
5
|
+
replace breakpoint-heavy layout with fluid primitives over time.
|
|
6
|
+
|
|
7
|
+
## Package Setup
|
|
8
|
+
|
|
9
|
+
Remove Tailwind packages when the project no longer needs them:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm remove tailwindcss @tailwindcss/postcss @tailwindcss/vite tailwind-merge
|
|
13
|
+
pnpm add @syncedco/flow
|
|
14
|
+
pnpm exec synced-flow init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Class Migration
|
|
18
|
+
|
|
19
|
+
Start with compatibility utilities generated by `synced-flow build`, then move
|
|
20
|
+
repeated layout patterns to Synced Flow primitives.
|
|
21
|
+
|
|
22
|
+
| Tailwind-style pattern | Synced Flow direction |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `container mx-auto px-6` | `sf-container` |
|
|
25
|
+
| `py-16 sm:py-24` | `sf-section` or fluid space tokens |
|
|
26
|
+
| `flex flex-col gap-4` | `sf-stack` |
|
|
27
|
+
| `flex flex-wrap gap-3` | `sf-cluster` |
|
|
28
|
+
| `grid gap-6 md:grid-cols-3` | `sf-auto-grid` or project CSS with `minmax()` |
|
|
29
|
+
| `bg-primary text-primary-foreground` | Keep semantic utility classes |
|
|
30
|
+
|
|
31
|
+
## Responsive Variants
|
|
32
|
+
|
|
33
|
+
Use `responsiveVariants: true` only while migrating old code:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
scan: ['app', 'components', 'lib'],
|
|
38
|
+
out: 'app/synced-flow.generated.css',
|
|
39
|
+
responsiveVariants: true,
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Turn it off for new projects and once layout has moved to fluid primitives.
|
|
44
|
+
|
|
45
|
+
## Dynamic Classes
|
|
46
|
+
|
|
47
|
+
Avoid building class names from fragments.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
// Good
|
|
51
|
+
const states = {
|
|
52
|
+
open: 'block opacity-100',
|
|
53
|
+
closed: 'hidden opacity-0',
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Avoid
|
|
57
|
+
const className = `${isOpen ? 'block' : 'hidden'} opacity-${amount}`
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use `safelist` when a dynamic class is unavoidable.
|