@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,156 @@
|
|
|
1
|
+
# Native Components
|
|
2
|
+
|
|
3
|
+
Synced Flow styles modern browser primitives instead of shipping JavaScript
|
|
4
|
+
components. These patterns are progressive enhancements: use the native markup
|
|
5
|
+
first, then add tiny project or example JavaScript only where state sync is
|
|
6
|
+
needed.
|
|
7
|
+
|
|
8
|
+
## Theme Control
|
|
9
|
+
|
|
10
|
+
Use explicit theme selectors when a project owns theme state.
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<html data-sf-theme="light">
|
|
14
|
+
<html data-sf-theme="dark">
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The matching class selectors are also supported:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<body class="sf-theme-light">
|
|
21
|
+
<body class="sf-theme-dark">
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Synced Flow sets `color-scheme` for native controls, forms, dialogs, and
|
|
25
|
+
popover-backed UI. Projects can toggle the attribute however they like; the
|
|
26
|
+
package does not ship a JavaScript theme switcher.
|
|
27
|
+
|
|
28
|
+
## Dialog
|
|
29
|
+
|
|
30
|
+
Use `<dialog>` for modal UI. Style the dialog with `sf-dialog` and structure it
|
|
31
|
+
with the header/body/footer classes.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<button class="sf-button" commandfor="settings-dialog" command="show-modal">
|
|
35
|
+
Open settings
|
|
36
|
+
</button>
|
|
37
|
+
|
|
38
|
+
<dialog class="sf-dialog" id="settings-dialog" aria-labelledby="settings-title">
|
|
39
|
+
<header class="sf-dialog__header">
|
|
40
|
+
<h2 id="settings-title">Settings</h2>
|
|
41
|
+
<button class="sf-button sf-button--ghost" commandfor="settings-dialog" command="close">Close</button>
|
|
42
|
+
</header>
|
|
43
|
+
<div class="sf-dialog__body">
|
|
44
|
+
<p class="sf-prose">Use native dialog behavior for focus and Escape handling where supported.</p>
|
|
45
|
+
</div>
|
|
46
|
+
<footer class="sf-dialog__footer">
|
|
47
|
+
<button class="sf-button" commandfor="settings-dialog" command="close">Done</button>
|
|
48
|
+
</footer>
|
|
49
|
+
</dialog>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If the target browser does not support invoker commands yet, use a small project
|
|
53
|
+
script to call `showModal()` and `close()`.
|
|
54
|
+
|
|
55
|
+
## Popover, Tooltip, Drawer, Toast, And Banner
|
|
56
|
+
|
|
57
|
+
Use the Popover API for non-modal overlays.
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<button class="sf-button" popovertarget="site-menu">Menu</button>
|
|
61
|
+
|
|
62
|
+
<nav class="sf-drawer sf-drawer--right" id="site-menu" popover aria-label="Mobile">
|
|
63
|
+
<a class="sf-nav__link" href="/work">Work</a>
|
|
64
|
+
<a class="sf-nav__link" href="/contact">Contact</a>
|
|
65
|
+
</nav>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Tooltips should keep the accessible description in markup. Native
|
|
69
|
+
`interestfor` support is progressive, so pair the trigger with visible or
|
|
70
|
+
described text when the content is important.
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<button class="sf-tooltip-trigger" interestfor="save-tip" aria-describedby="save-tip">
|
|
74
|
+
Save
|
|
75
|
+
</button>
|
|
76
|
+
<p class="sf-tooltip" id="save-tip" popover="hint">Saves your current draft.</p>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Use `sf-toast` and `sf-banner` for popover-backed announcements or feedback.
|
|
80
|
+
|
|
81
|
+
## Disclosure And Accordions
|
|
82
|
+
|
|
83
|
+
Use native `details` and `summary`. Give related details the same `name` value
|
|
84
|
+
for an exclusive accordion in supporting browsers.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<div class="sf-accordion">
|
|
88
|
+
<details name="pricing">
|
|
89
|
+
<summary>Can I customize the theme?</summary>
|
|
90
|
+
<p>Yes. Override Synced Flow tokens before adding custom CSS.</p>
|
|
91
|
+
</details>
|
|
92
|
+
<details name="pricing">
|
|
93
|
+
<summary>Does this need JavaScript?</summary>
|
|
94
|
+
<p>No for basic disclosure. The browser owns the open state.</p>
|
|
95
|
+
</details>
|
|
96
|
+
</div>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Tabs
|
|
100
|
+
|
|
101
|
+
Tabs can be styled with `sf-tabs`, `sf-tab-list`, `sf-tab`, and `sf-tab-panel`.
|
|
102
|
+
For fully accessible keyboard behavior and ARIA state sync, use a tiny
|
|
103
|
+
project-level script. For simple CSS-only panels, radio inputs can control
|
|
104
|
+
panels without package JavaScript.
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<section class="sf-tabs">
|
|
108
|
+
<div class="sf-tab-list" role="tablist" aria-label="Plans">
|
|
109
|
+
<button class="sf-tab" role="tab" aria-selected="true">Starter</button>
|
|
110
|
+
<button class="sf-tab" role="tab" aria-selected="false">Team</button>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="sf-tab-panel" role="tabpanel">Starter plan content.</div>
|
|
113
|
+
</section>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Navigation
|
|
117
|
+
|
|
118
|
+
Use `sf-nav--mobile` with a popover drawer for mobile navigation. Use
|
|
119
|
+
`sf-breadcrumb` and `sf-pagination` for common content navigation.
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<nav class="sf-breadcrumb" aria-label="Breadcrumb">
|
|
123
|
+
<ol class="sf-breadcrumb">
|
|
124
|
+
<li><a href="/">Home</a></li>
|
|
125
|
+
<li><a href="/docs">Docs</a></li>
|
|
126
|
+
<li aria-current="page">Native components</li>
|
|
127
|
+
</ol>
|
|
128
|
+
</nav>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Scroll And Sticky
|
|
132
|
+
|
|
133
|
+
Use CSS scroll snap and sticky positioning for full-page sections and sticky
|
|
134
|
+
headers.
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<main class="sf-scroll-viewport" data-snap="mandatory">
|
|
138
|
+
<section class="sf-scroll-panel">
|
|
139
|
+
<div class="sf-container sf-stack">
|
|
140
|
+
<h1>First panel</h1>
|
|
141
|
+
<p class="sf-prose">Each panel snaps to the viewport.</p>
|
|
142
|
+
</div>
|
|
143
|
+
</section>
|
|
144
|
+
<section class="sf-scroll-panel">...</section>
|
|
145
|
+
</main>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Progressive Enhancement Notes
|
|
149
|
+
|
|
150
|
+
- Popover API, invoker commands, interest invokers, and anchor positioning are
|
|
151
|
+
modern browser features. Use fallback-safe markup when content is critical.
|
|
152
|
+
- Synced Flow provides styling and state hooks; it does not polyfill browser
|
|
153
|
+
APIs.
|
|
154
|
+
- Prefer `dialog`, `popover`, `details`, scroll snap, `:popover-open`,
|
|
155
|
+
`::backdrop`, `:has()`, `color-scheme`, and anchor positioning before custom
|
|
156
|
+
JavaScript.
|
package/docs/patterns.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Interaction Patterns
|
|
2
|
+
|
|
3
|
+
Synced Flow patterns are copy-ready HTML/CSS-native building blocks for common
|
|
4
|
+
website interactions. They are not JavaScript components.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pnpm exec synced-flow pattern --list
|
|
8
|
+
pnpm exec synced-flow pattern mobile-nav-drawer --framework next --markup
|
|
9
|
+
pnpm exec synced-flow pattern scroll-viewport-sections --json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Pattern IDs
|
|
13
|
+
|
|
14
|
+
| ID | Use |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `mobile-nav-drawer` | Mobile burger, popover drawer, close button, and vertical nav list. |
|
|
17
|
+
| `scroll-viewport-sections` | Sticky section nav plus full-height scroll snap panels. |
|
|
18
|
+
| `scroll-viewport-with-spy` | Scroll snap panels with optional IntersectionObserver active-state notes. |
|
|
19
|
+
| `native-dialog-react` | Native `<dialog>` markup plus React/Next fallback shape. |
|
|
20
|
+
| `popover-drawer-layout` | Popover-backed drawer or filter panel with `sf-drawer--stack`. |
|
|
21
|
+
|
|
22
|
+
Pattern JSON includes:
|
|
23
|
+
|
|
24
|
+
- `classes`: public Synced Flow classes used by the pattern
|
|
25
|
+
- `requiresJs` and `requiresJsNotes`: whether CSS/HTML alone is enough
|
|
26
|
+
- `a11y`: accessibility requirements to preserve when editing
|
|
27
|
+
- `gotchas`: browser or markup details that agents commonly miss
|
|
28
|
+
- `markup`: framework-specific starter markup where useful
|
|
29
|
+
|
|
30
|
+
Use patterns before hand-rolling interaction markup. Use recipes for full-page
|
|
31
|
+
composition and patterns for the tricky native interaction details inside those
|
|
32
|
+
pages.
|
package/docs/presets.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Presets
|
|
2
|
+
|
|
3
|
+
Synced Flow ships a small set of theme presets. They are intentionally small:
|
|
4
|
+
fonts, semantic colours, layout defaults, and component token adjustments. The
|
|
5
|
+
same public primitives should work across every preset.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { defineConfig } from '@syncedco/flow/config'
|
|
9
|
+
import { themePresets } from '@syncedco/flow/presets'
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
scan: ['src'],
|
|
13
|
+
out: 'src/synced-flow.generated.css',
|
|
14
|
+
theme: themePresets.neutralSaas,
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Available Presets
|
|
19
|
+
|
|
20
|
+
| Preset | Use for |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `synced` | Synced brand and warm marketing pages. Warm primary action, serif display, balanced component radius. |
|
|
23
|
+
| `neutralSaas` | Calm SaaS, admin, and B2B apps. Neutral surfaces, blue action colour, slightly tighter controls. |
|
|
24
|
+
| `editorial` | Content-heavy marketing and article-led sites. Narrower measure, round action buttons, more generous cards. |
|
|
25
|
+
| `darkApp` | Dark dashboards, tools, and app surfaces. Dark semantic colours, stronger borders, compact controls. |
|
|
26
|
+
|
|
27
|
+
CLI aliases use kebab case:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
synced-flow init --theme synced
|
|
31
|
+
synced-flow init --theme neutral-saas
|
|
32
|
+
synced-flow init --theme editorial
|
|
33
|
+
synced-flow init --theme dark-app
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## What Presets Override
|
|
37
|
+
|
|
38
|
+
Presets use the same config surface available to consuming projects:
|
|
39
|
+
|
|
40
|
+
- `fonts` for `--sf-font-*`.
|
|
41
|
+
- `colours` and `darkColours` for semantic `--sf-colour-*` roles.
|
|
42
|
+
- `layout` for container width, gutter, and grid defaults.
|
|
43
|
+
- `components` for button, card, and input sizing/radius.
|
|
44
|
+
|
|
45
|
+
Keep project-specific brand details in the consuming app config. Presets should
|
|
46
|
+
stay broad enough to start a category of project without becoming full themes.
|
|
47
|
+
|
|
48
|
+
## Preset Confidence Rule
|
|
49
|
+
|
|
50
|
+
Every preset should support the same recipe snippets:
|
|
51
|
+
|
|
52
|
+
- marketing homepage
|
|
53
|
+
- SaaS product page
|
|
54
|
+
- documentation page
|
|
55
|
+
- contact form
|
|
56
|
+
- app shell
|
|
57
|
+
- pricing and FAQ
|
|
58
|
+
|
|
59
|
+
If a preset needs page-specific CSS to make those recipes usable, improve the
|
|
60
|
+
preset tokens before adding new classes.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Quick Start
|
|
2
|
+
|
|
3
|
+
Synced Flow is a small fluid CSS system for projects that want strong design
|
|
4
|
+
tokens, generated utility CSS, and no default dependency on viewport breakpoints.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @syncedco/flow
|
|
10
|
+
pnpm exec synced-flow init --theme synced
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For the GitHub repo before registry publishing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add git+https://github.com/SyncedCo/synced-flow.git
|
|
17
|
+
pnpm exec synced-flow init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Shape The Theme First
|
|
21
|
+
|
|
22
|
+
Before building pages, answer a small theme brief. This keeps brand decisions in
|
|
23
|
+
tokens instead of scattered page CSS.
|
|
24
|
+
|
|
25
|
+
- Radius: sharp, slightly rounded, or soft/curved?
|
|
26
|
+
- Font family: system, geometric sans, editorial serif, or brand font?
|
|
27
|
+
- Primary colour: main action and focus colour.
|
|
28
|
+
- Secondary/accent colour: supporting highlights.
|
|
29
|
+
- Surface style: flat, raised cards, or subtle panels?
|
|
30
|
+
- Density: compact app UI or more spacious marketing pages?
|
|
31
|
+
|
|
32
|
+
With an AI assistant, ask it to use the Synced Flow skill and turn those
|
|
33
|
+
answers into `synced-flow.config.mjs` theme tokens.
|
|
34
|
+
|
|
35
|
+
Example prompt:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
Use the Synced Flow skill. Create a website theme with slightly rounded
|
|
39
|
+
controls, Inter for UI, Fraunces for display headings, orange as the primary
|
|
40
|
+
colour, cyan as the accent, light raised cards, and spacious marketing sections.
|
|
41
|
+
Return the Synced Flow theme config only.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then place the result in `synced-flow.config.mjs`:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
theme: {
|
|
48
|
+
fonts: {
|
|
49
|
+
sans: 'Inter, ui-sans-serif, system-ui, sans-serif',
|
|
50
|
+
display: 'Fraunces, Georgia, serif',
|
|
51
|
+
},
|
|
52
|
+
colours: {
|
|
53
|
+
primary: 'oklch(68% 0.18 44)',
|
|
54
|
+
primaryForeground: 'oklch(100% 0 0)',
|
|
55
|
+
accent: 'oklch(70% 0.12 205)',
|
|
56
|
+
ring: 'oklch(68% 0.18 44)',
|
|
57
|
+
},
|
|
58
|
+
components: {
|
|
59
|
+
button: { radius: '0.5rem' },
|
|
60
|
+
card: { radius: '0.75rem' },
|
|
61
|
+
input: { radius: '0.5rem' },
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Import
|
|
67
|
+
|
|
68
|
+
`init` creates a CSS entry file such as `src/synced-flow.css` or
|
|
69
|
+
`app/synced-flow.css`.
|
|
70
|
+
|
|
71
|
+
Import that file once from your app entry, root layout, or main CSS file.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import './synced-flow.css'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Choose one core import strategy. Most projects use the full package stylesheet:
|
|
78
|
+
|
|
79
|
+
```css
|
|
80
|
+
@import "@syncedco/flow/styles.css";
|
|
81
|
+
@import "@syncedco/flow/defaults.css";
|
|
82
|
+
@import "./synced-flow.generated.css";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`styles.css` already includes tokens, reset, base, layout, components, and
|
|
86
|
+
static utilities. Do not also import those modular files alongside `styles.css`.
|
|
87
|
+
|
|
88
|
+
For tighter loading, skip `styles.css` and import only the layers the project
|
|
89
|
+
uses:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
@import "@syncedco/flow/tokens.css";
|
|
93
|
+
@import "@syncedco/flow/reset.css";
|
|
94
|
+
@import "@syncedco/flow/base.css";
|
|
95
|
+
@import "@syncedco/flow/defaults.css";
|
|
96
|
+
@import "@syncedco/flow/layout.css";
|
|
97
|
+
@import "@syncedco/flow/components.css";
|
|
98
|
+
@import "@syncedco/flow/utilities.css";
|
|
99
|
+
@import "./synced-flow.generated.css";
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`defaults.css` is optional. It removes raw link underlines and list markers for
|
|
103
|
+
common site/UI surfaces. Leave it out, or run `synced-flow init --no-defaults`, when a
|
|
104
|
+
project should keep content-style browser defaults.
|
|
105
|
+
|
|
106
|
+
Keep `utilities.css` out unless the project uses static helpers such as
|
|
107
|
+
`sf-text-*`, `sf-prose`, `sr-only`, `not-sr-only`, `sf-skip-link`,
|
|
108
|
+
`sf-focus-ring`, `sf-touch-target`, `sf-list-reset`, `sf-link`, or
|
|
109
|
+
`sf-full-bleed`. The generated CSS file already emits source-scanned utility
|
|
110
|
+
classes.
|
|
111
|
+
|
|
112
|
+
For the supported starter surface, see [System primitives](system-primitives.md).
|
|
113
|
+
It lists the tokens, layout classes, component classes, and utility helpers that
|
|
114
|
+
can build a basic website before project-specific CSS is needed.
|
|
115
|
+
For copy-ready website sections, see [Website patterns](website-patterns.md).
|
|
116
|
+
For native dialog, popover, disclosure, drawer, tooltip, tabs, and scroll
|
|
117
|
+
patterns, see [Native Components](native-components.md).
|
|
118
|
+
For accessible state styling and markup hooks, see
|
|
119
|
+
[Accessibility CSS](accessibility-css.md).
|
|
120
|
+
For the stable public surface, see [CSS API Contract](api-contract.md).
|
|
121
|
+
For a full project flow, see [Build a site walkthrough](build-a-site-walkthrough.md).
|
|
122
|
+
|
|
123
|
+
## Base Defaults
|
|
124
|
+
|
|
125
|
+
Synced Flow uses a conservative base: links remain visibly underlined, lists
|
|
126
|
+
keep their markers, focus styles are visible, and motion preferences are
|
|
127
|
+
respected. Add `@syncedco/flow/defaults.css` or run `synced-flow add defaults` when a
|
|
128
|
+
site should use app-style defaults globally.
|
|
129
|
+
|
|
130
|
+
## Build
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pnpm flow:build
|
|
134
|
+
pnpm flow:check
|
|
135
|
+
pnpm flow:lint
|
|
136
|
+
pnpm flow:doctor
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
In this repository, `pnpm check` also runs package guardrails for dependency
|
|
140
|
+
count, gzip budgets, generated CSS shape, and raw-pixel usage.
|
|
141
|
+
|
|
142
|
+
## Theme Tokens
|
|
143
|
+
|
|
144
|
+
Override reusable project tokens in `synced-flow.config.mjs`.
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
export default defineConfig({
|
|
148
|
+
scan: ['src', 'components'],
|
|
149
|
+
out: 'src/synced-flow.generated.css',
|
|
150
|
+
theme: {
|
|
151
|
+
fonts: {
|
|
152
|
+
sans: 'Inter, ui-sans-serif, system-ui, sans-serif',
|
|
153
|
+
display: 'Fraunces, Georgia, serif',
|
|
154
|
+
},
|
|
155
|
+
colours: {
|
|
156
|
+
primary: 'oklch(68% 0.18 44)',
|
|
157
|
+
primaryForeground: 'oklch(100% 0 0)',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Use the CSS entry file for one-off local overrides.
|
|
164
|
+
|
|
165
|
+
```css
|
|
166
|
+
@import "@syncedco/flow/styles.css";
|
|
167
|
+
@import "./synced-flow.generated.css";
|
|
168
|
+
|
|
169
|
+
:root {
|
|
170
|
+
--sf-font-sans: Inter, ui-sans-serif, system-ui, sans-serif;
|
|
171
|
+
--sf-colour-primary: oklch(68% 0.18 44);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Config
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
import { defineConfig } from '@syncedco/flow/config'
|
|
179
|
+
|
|
180
|
+
export default defineConfig({
|
|
181
|
+
scan: ['src', 'components'],
|
|
182
|
+
out: 'src/synced-flow.generated.css',
|
|
183
|
+
responsiveVariants: false,
|
|
184
|
+
safelist: [],
|
|
185
|
+
})
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Presets
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pnpm exec synced-flow init --preset next
|
|
192
|
+
pnpm exec synced-flow init --preset vite
|
|
193
|
+
pnpm exec synced-flow init --preset astro
|
|
194
|
+
pnpm exec synced-flow init --preset wordpress
|
|
195
|
+
pnpm exec synced-flow init --preset plain
|
|
196
|
+
pnpm exec synced-flow init --theme neutral-saas
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Use `--responsive-variants` only for migration projects that still contain
|
|
200
|
+
classes like `sm:` or `lg:`.
|
|
201
|
+
|
|
202
|
+
## Scanner Limits
|
|
203
|
+
|
|
204
|
+
Synced Flow scans source files as text and generates CSS for complete class
|
|
205
|
+
tokens. Keep class names complete in source files.
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
// Good
|
|
209
|
+
const variants = {
|
|
210
|
+
primary: 'bg-primary text-primary-foreground',
|
|
211
|
+
quiet: 'bg-surface text-heading',
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Avoid
|
|
215
|
+
const colour = 'primary'
|
|
216
|
+
const className = `bg-${colour}`
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
For dynamic cases that cannot be avoided, use `safelist`.
|
|
220
|
+
|
|
221
|
+
## WordPress
|
|
222
|
+
|
|
223
|
+
The WordPress preset is designed for themes and plugins that enqueue plain CSS.
|
|
224
|
+
It scans PHP and template files, enables `includeCore`, and writes one CSS file:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
pnpm exec synced-flow init --preset wordpress
|
|
228
|
+
pnpm flow:build
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Enqueue the generated file from the theme or plugin:
|
|
232
|
+
|
|
233
|
+
```php
|
|
234
|
+
wp_enqueue_style(
|
|
235
|
+
'synced-flow',
|
|
236
|
+
get_theme_file_uri('assets/css/synced-flow.css'),
|
|
237
|
+
[],
|
|
238
|
+
wp_get_theme()->get('Version')
|
|
239
|
+
);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## AI-Friendly Discovery
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pnpm exec synced-flow tokens
|
|
246
|
+
pnpm exec synced-flow tokens --json
|
|
247
|
+
pnpm exec synced-flow catalog --json
|
|
248
|
+
pnpm exec synced-flow suggest "service site with pricing and faq"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Use this before generating UI so class names, token names, and presets stay
|
|
252
|
+
inside the supported surface area.
|