@reqvire-org/ads 0.3.45 → 0.3.47
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/README.md +23 -11
- package/dist/a11y.mjs +102 -0
- package/dist/assets.mjs +37 -8
- package/dist/atomic-composition.mjs +3 -2
- package/dist/brand-assets.mjs +48 -11
- package/dist/brands.mjs +82 -0
- package/dist/browser-audit/worker.mjs +45 -0
- package/dist/browser-audit.mjs +117 -0
- package/dist/capture/worker.mjs +2 -1
- package/dist/capture-store.mjs +4 -1
- package/dist/capture.mjs +10 -4
- package/dist/check.mjs +40 -9
- package/dist/cli.mjs +55 -8
- package/dist/color-values.mjs +325 -0
- package/dist/config.mjs +19 -2
- package/dist/contracts/tokens.json +1 -1
- package/dist/control-padding.mjs +93 -0
- package/dist/design-values.mjs +11 -4
- package/dist/finding-rules.mjs +61 -0
- package/dist/foundation.mjs +17 -1
- package/dist/icons.mjs +107 -0
- package/dist/init.mjs +3 -0
- package/dist/mcp/apps.mjs +9 -6
- package/dist/mcp/drafts.mjs +3 -0
- package/dist/mcp/mutations.mjs +17 -1
- package/dist/mcp/preview-widget.bundle.js +45 -39
- package/dist/mcp/project-widget.bundle.js +26 -26
- package/dist/mcp/server.mjs +23 -9
- package/dist/mcp/widget.bundle.js +17 -17
- package/dist/palette-generated.mjs +180 -0
- package/dist/preview-resources.mjs +12 -3
- package/dist/render-color-probe.mjs +148 -0
- package/dist/runtime-contracts.mjs +14 -4
- package/dist/scenarios.mjs +1 -1
- package/dist/showcase/client.bundle.js +28 -28
- package/dist/showcase/icons.js +146 -0
- package/dist/showcase/index.html +2 -1
- package/dist/showcase/style.css +19 -2
- package/dist/skills/README.md +2 -1
- package/dist/skills/ads-break-ui/SKILL.md +6 -5
- package/dist/skills/ads-break-ui/references/atomic-styles.md +12 -12
- package/dist/skills/ads-break-ui/references/captures.md +3 -2
- package/dist/skills/ads-break-ui/references/contracts.md +13 -10
- package/dist/skills/ads-break-ui/references/design-data.md +199 -2
- package/dist/skills/ads-break-ui/references/validation.md +8 -4
- package/dist/skills/ads-designer/SKILL.md +32 -15
- package/dist/skills/ads-designer/references/accessibility.md +77 -0
- package/dist/skills/ads-designer/references/atomic-styles.md +12 -12
- package/dist/skills/ads-designer/references/branding.md +61 -6
- package/dist/skills/ads-designer/references/captures.md +3 -2
- package/dist/skills/ads-designer/references/cli.md +8 -2
- package/dist/skills/ads-designer/references/contracts.md +13 -10
- package/dist/skills/ads-designer/references/design-data.md +199 -2
- package/dist/skills/ads-designer/references/validation.md +8 -4
- package/dist/skills/ads-import/SKILL.md +9 -8
- package/dist/skills/ads-import/references/atomic-styles.md +12 -12
- package/dist/skills/ads-import/references/captures.md +3 -2
- package/dist/skills/ads-import/references/cli.md +8 -2
- package/dist/skills/ads-import/references/contracts.md +13 -10
- package/dist/skills/ads-import/references/design-data.md +199 -2
- package/dist/skills/ads-import/references/tokens.md +7 -3
- package/dist/skills/ads-import/references/validation.md +8 -4
- package/dist/skills/ads-motion/SKILL.md +6 -5
- package/dist/skills/ads-motion/references/atomic-styles.md +12 -12
- package/dist/skills/ads-motion/references/build.md +33 -0
- package/dist/skills/ads-motion/references/captures.md +3 -2
- package/dist/skills/ads-motion/references/contracts.md +13 -10
- package/dist/skills/ads-motion/references/design-data.md +199 -2
- package/dist/skills/ads-motion/references/motion-review.md +2 -2
- package/dist/skills/ads-motion/references/validation.md +8 -4
- package/dist/skills/ads-port/SKILL.md +6 -5
- package/dist/skills/ads-port/references/atomic-styles.md +12 -12
- package/dist/skills/ads-port/references/captures.md +3 -2
- package/dist/skills/ads-port/references/cli.md +8 -2
- package/dist/skills/ads-port/references/contracts.md +13 -10
- package/dist/skills/ads-port/references/design-data.md +199 -2
- package/dist/skills/ads-port/references/validation.md +8 -4
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +19 -1
- package/dist/starters/preact/ds.config.json +13 -1
- package/dist/starters/react/ADS.md +43 -10
- package/dist/starters/react/README.md +61 -9
- package/dist/starters/react/design-system/assets/brand/README.md +8 -3
- package/dist/starters/react/design-system/assets/glyphs/README.md +15 -0
- package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
- package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +11 -4
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +6 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +16 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
- package/dist/starters/react/design-system/components/Content/Icon/README.md +17 -0
- package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +3 -9
- package/dist/starters/react/design-system/components/Content/Logo/README.md +4 -2
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +9 -5
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +164 -0
- package/dist/starters/react/design-system/index.ts +6 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +2 -5
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
- package/dist/starters/react/design-system/review/index.ts +1 -0
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +19 -1
- package/dist/starters/react/design-system/styles.css +1 -0
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +114 -8
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
- package/dist/starters/react/design-system/tokens/{SpaceTypeMotion.ads.scenario.tsx → Layout.ads.scenario.tsx} +1 -1
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/base.css +9 -3
- package/dist/starters/react/design-system/tokens/colors.css +210 -24
- package/dist/starters/react/design-system/tokens/elevation.css +44 -6
- package/dist/starters/react/design-system/tokens/spacing.css +67 -3
- package/dist/starters/react/design-system/tokens/themes.generated.css +142 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +402 -0
- package/dist/starters/react/design-system/tokens/typography.css +25 -7
- package/dist/starters/react/ds.config.json +13 -1
- package/dist/style-boundaries.mjs +2 -1
- package/dist/themes-generated.mjs +150 -0
- package/dist/themes-watch.mjs +42 -0
- package/dist/themes.mjs +257 -0
- package/dist/token-export.mjs +69 -0
- package/dist/token-policy.mjs +2 -1
- package/dist/token-quality.mjs +112 -0
- package/dist/tokens.mjs +32 -30
- package/dist/validation.mjs +18 -1
- package/dist/verification/browser.mjs +14 -3
- package/docs/ADS.md +56 -13
- package/docs/ARCHITECTURE.md +82 -10
- package/docs/CACHING.md +2 -3
- package/docs/CHANGELOG.md +149 -13
- package/docs/CONTRACTS.md +13 -10
- package/docs/GUIDE.md +104 -8
- package/docs/MCP.md +46 -27
- package/docs/benchmarks/bun-previews.md +5 -5
- package/docs/benchmarks/{gidi-preview-memory.md → preview-memory.md} +14 -12
- package/docs/benchmarks/turbo-poc.md +24 -6
- package/package.json +2 -1
- package/dist/starters/react/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
|
@@ -74,7 +74,7 @@ Review that intent and do not disguise a new design decision as arithmetic.
|
|
|
74
74
|
|
|
75
75
|
## Review overlap without deleting legitimate roles
|
|
76
76
|
|
|
77
|
-
`token-overlap-review` is a nonblocking
|
|
77
|
+
`token-overlap-review` is a nonblocking review item for shared tokens with identical
|
|
78
78
|
normalized definitions across their declared theme/condition scopes. It identifies
|
|
79
79
|
the tokens and source. Inspect their consumers and roles. If one decision is being
|
|
80
80
|
copied, reuse one shared token or make its relationship explicit with an alias.
|
|
@@ -82,10 +82,207 @@ Equal values alone do not prove equal purpose: body text and strong text, spacin
|
|
|
82
82
|
and control sizes, or two motion roles may intentionally differ later. A light-only
|
|
83
83
|
match does not justify merging tokens whose dark/reduced-motion values differ.
|
|
84
84
|
|
|
85
|
-
For
|
|
85
|
+
For existing workspaces, convert independent component constants explicitly:
|
|
86
86
|
select an existing shared role when it means the same thing; centralize genuinely
|
|
87
87
|
missing decisions; remove private sheets/imports and contract fields; update token
|
|
88
88
|
sample coverage in the shared directory. Preserve themes, units, public APIs and
|
|
89
89
|
behavior unless changing the visual policy was explicitly intended. Review a Git
|
|
90
90
|
diff and run core, project and browser checks. There is no compatibility mode that
|
|
91
91
|
keeps independent component token definitions valid.
|
|
92
|
+
|
|
93
|
+
## Accessibility and rhythm checks
|
|
94
|
+
|
|
95
|
+
`ads check` checks token values in every theme and brand. Each finding below is an error:
|
|
96
|
+
|
|
97
|
+
- `token-contrast`: the roles that meet on screen fall below WCAG 2.2 AA: `--text-strong`,
|
|
98
|
+
`--text-body`, `--text-muted`, `--text-link` and `--accent-text` on `--bg-canvas`,
|
|
99
|
+
`--bg-surface` and `--bg-hover`; `--accent-fg` on `--accent` and `--accent-hover`; each
|
|
100
|
+
status's `-fg` on its solid and `-text` on its `-bg` (4.5:1); `--border-focus` and
|
|
101
|
+
`--border-strong` on the canvas and surface (3:1). Fix it by choosing a different ramp
|
|
102
|
+
step for the role, in the theme the message names, never with a one-off color.
|
|
103
|
+
- `token-rhythm`: a numbered spacing step leaves the scale `--space-N` = N × 2 px.
|
|
104
|
+
- `control-padding`: pad a control with the token for its size. A block sized with
|
|
105
|
+
`--control-height-<size>` pads its sides with `--control-padding-<size>`; the small gap
|
|
106
|
+
inside a track (segmented control, switch) uses `--control-inset` (add it to the spacing
|
|
107
|
+
tokens if the project has none). Anything that is not a control does not use
|
|
108
|
+
`--control-height-*`.
|
|
109
|
+
|
|
110
|
+
`token-overlap-review` (review) compares values only within a token family (`--radius-*`
|
|
111
|
+
with `--radius-*`): a radius equal to a spacing step is two scales meeting, not a duplicate.
|
|
112
|
+
|
|
113
|
+
## Exchange format
|
|
114
|
+
|
|
115
|
+
`ads tokens --format dtcg` prints the tokens as W3C Design Tokens (Community Group draft)
|
|
116
|
+
JSON: groups by family, typed `$value`s, `{group.token}` references for `var()` aliases.
|
|
117
|
+
Values the format cannot express (fluid `clamp()` sizes, layered shadows) keep their CSS in
|
|
118
|
+
`$extensions["org.reqvire.ads"].css`; other themes' values are in
|
|
119
|
+
`$extensions["org.reqvire.ads"].scopes`.
|
|
120
|
+
|
|
121
|
+
## Grid
|
|
122
|
+
|
|
123
|
+
The `--grid-*` tokens describe a column grid: `--grid-columns-sm/md/lg` (the starter's 4, 8
|
|
124
|
+
and 16), `--grid-gutter`, `--grid-gutter-narrow`, `--grid-gutter-condensed` and
|
|
125
|
+
`--grid-margin-sm/md/lg`, aliasing spacing steps. The starter's `Grid` switches columns by
|
|
126
|
+
container width (768 and 1024 px) with container queries, since CSS variables cannot be
|
|
127
|
+
breakpoints. The showcase's grid overlay draws these tokens over every preview at the same
|
|
128
|
+
widths; a project without them shows no overlay. Align text to a cell's edge, not its gutter.
|
|
129
|
+
|
|
130
|
+
## Color roles and states
|
|
131
|
+
|
|
132
|
+
Name roles by element and purpose, the same in every theme; only their values change. Point roles at ramp steps rather than raw colors, so a theme is a ramp swap:
|
|
133
|
+
|
|
134
|
+
- Layers: `--bg-canvas` → `--bg-surface` → `--bg-raised` (menus, popovers), with `--bg-field`
|
|
135
|
+
for inputs. In dark themes each layer up is one step lighter; in light themes surfaces stay
|
|
136
|
+
near white.
|
|
137
|
+
- States move along the ramp: hover one step, pressed or active two, selected a subtle accent
|
|
138
|
+
step (`--bg-selected`). Solid fills hover one step darker (`--accent-hover`).
|
|
139
|
+
- Disabled is always neutral (`--bg-disabled`, `--text-disabled`, `--border-disabled`) with no
|
|
140
|
+
hover or focus response; WCAG exempts it from contrast, so `token-contrast` skips it.
|
|
141
|
+
- `--bg-overlay` is the translucent scrim behind modals; `--bg-skeleton` fills loading
|
|
142
|
+
placeholders.
|
|
143
|
+
- Never signal state or status by color alone: pair it with text, an icon or a shape.
|
|
144
|
+
|
|
145
|
+
## Themes
|
|
146
|
+
|
|
147
|
+
Declare themes in `ds.config.json` (`themes: [{ name, scheme }]`, the first is the default;
|
|
148
|
+
`scheme` sets `color-scheme` for native controls and scrollbars).
|
|
149
|
+
|
|
150
|
+
Write a token that differs per theme as one half per theme, named with the theme as suffix,
|
|
151
|
+
on `:root`:
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
:root {
|
|
155
|
+
--color-accent-9-light: oklch(55% .2 280);
|
|
156
|
+
--color-accent-9-dark: oklch(70% .16 280);
|
|
157
|
+
--bg-canvas-light: var(--slate-1-light);
|
|
158
|
+
--bg-canvas-dark: var(--slate-2-dark);
|
|
159
|
+
--accent: var(--color-accent-9);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- A half is a plain value or refers to halves: `--text-muted-dark: var(--slate-11-dark)`,
|
|
164
|
+
never `var(--slate-11)` (`theme-half-reference`).
|
|
165
|
+
- Give every themed token a half for every declared theme (`theme-coverage`). Tokens that do
|
|
166
|
+
not change per theme stay single values; a role that aliases a ramp step
|
|
167
|
+
(`--accent: var(--color-accent-9)`) needs no halves.
|
|
168
|
+
- Never set token values under `[data-theme]` or `prefers-color-scheme` (`theme-old-form`),
|
|
169
|
+
and never set a token both as one value and as halves (`theme-half-conflict`).
|
|
170
|
+
- ADS writes `tokens/themes.generated.css` from the halves and the declared themes and
|
|
171
|
+
brands: `ads assets` writes it, and the showcase and MCP server rewrite it whenever tokens
|
|
172
|
+
or `ds.config.json` change. Commit it, never edit it; it is the last foundation import.
|
|
173
|
+
After editing tokens without a running showcase, run `ads assets` (`themes-generated`
|
|
174
|
+
fails when it is stale).
|
|
175
|
+
- `data-theme="<name>"` on `<html>` themes the page; on any element it themes that section
|
|
176
|
+
and everything inside it, down to the next `data-theme`. A themed section paints its own
|
|
177
|
+
canvas and text (`base.css`).
|
|
178
|
+
- Add a theme for a real need: high contrast, a dimmed reading mode. Add a half for it to
|
|
179
|
+
every themed token. Check a theme in the showcase (the theme button steps through declared
|
|
180
|
+
themes) and capture it by name.
|
|
181
|
+
- Show content that belongs to one theme (a dark logo variant) with the generated display
|
|
182
|
+
switch: `display: var(--display-dark, block)`. It is `none` outside the nearest dark
|
|
183
|
+
theme. Never style by theme or brand with a selector (`[data-theme="dark"] &`,
|
|
184
|
+
`:root[data-brand] &`): it ignores the nearest section (`theme-selector`). Give per-theme
|
|
185
|
+
values as token halves instead.
|
|
186
|
+
- A per-theme value that comes from data at runtime (a chart series color, a highlighter
|
|
187
|
+
color) uses the generated helpers, never `light-dark()` (`theme-light-dark`):
|
|
188
|
+
`style={{ "--series": themed({ light: a, dark: b }) }}` with every declared theme as a key,
|
|
189
|
+
or `themedByScheme({ light: a, dark: b })` when the data has only light and dark (each
|
|
190
|
+
theme takes the value for its scheme). Values are complete colors.
|
|
191
|
+
- To follow the OS setting, set `"followSystemTheme": true` in `ds.config.json`: a page
|
|
192
|
+
without `data-theme` takes the first declared theme whose scheme matches
|
|
193
|
+
`prefers-color-scheme`. An explicit `data-theme` always wins. Letting the user choose and
|
|
194
|
+
remembering it is application code: it sets `data-theme`.
|
|
195
|
+
|
|
196
|
+
## Brands
|
|
197
|
+
|
|
198
|
+
A brand is a second axis beside the theme: the theme sets the color mode, the brand sets
|
|
199
|
+
identity (an accent ramp, a font). Use brands for white label (one product, each customer's
|
|
200
|
+
accent, font and logo, each in light and dark), a product family, or a co-branded partner
|
|
201
|
+
section; without them every combination becomes a theme (`acme-light`, `acme-dark`, …).
|
|
202
|
+
|
|
203
|
+
Declare brands in `ds.config.json` (`brands: [{ name }]`, the first is the default; leave
|
|
204
|
+
`brands` out for one brand). The default brand's values are the ones on `:root`. Another
|
|
205
|
+
brand re-sets existing tokens on its own selector only, with every half of a themed token it
|
|
206
|
+
changes:
|
|
207
|
+
|
|
208
|
+
```css
|
|
209
|
+
[data-brand="acme"] {
|
|
210
|
+
--color-accent-9-light: oklch(55% .2 25);
|
|
211
|
+
--color-accent-9-dark: oklch(70% .16 25);
|
|
212
|
+
--font-sans: Georgia, serif;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
- `data-brand="<name>"` on `<html>` brands the page; on any element that section. Brand and
|
|
217
|
+
theme are independent: each element takes its nearest brand and its nearest theme, at any
|
|
218
|
+
nesting depth, including the default brand inside another brand's section.
|
|
219
|
+
- Errors: a brand that gives a themed token one value (`brand-theme-value`) or only some of
|
|
220
|
+
its halves or ramp steps (`brand-coverage`), a token only a brand defines
|
|
221
|
+
(`brand-new-token`), a declared brand without values (`brand-empty`), a `data-brand` name
|
|
222
|
+
the config does not declare (`brand-undeclared`). `token-contrast` runs for every brand
|
|
223
|
+
in every theme.
|
|
224
|
+
- A brand's logo is brand artwork (`ads://guides/branding`). Render every brand's logo and
|
|
225
|
+
show each with `display: var(--display-brand-<brand>, block)`, so a section shows its
|
|
226
|
+
nearest brand's logo.
|
|
227
|
+
- The showcase shows a brand selector next to the theme button; captures take `brand`;
|
|
228
|
+
`ads tokens --format dtcg --brand <name>` exports a brand (with `--theme`, one brand in
|
|
229
|
+
one theme).
|
|
230
|
+
|
|
231
|
+
## Colors in Canvas, WebGL and SVG renderers
|
|
232
|
+
|
|
233
|
+
A renderer that needs colors as values (a graph, a chart, a canvas) reads them from the
|
|
234
|
+
generated palette, never from the page per item. `tokens/themes.generated.ts` holds every
|
|
235
|
+
color token resolved for every context (`<theme>`, and `<brand>/<theme>` for other brands)
|
|
236
|
+
as `{ css, rgba }`: `css` is `#rrggbb`, or `rgba(…)` when translucent; `rgba` is sRGB
|
|
237
|
+
0–255 with alpha 0–1. Aliases, halves and `color-mix()` are resolved; out-of-gamut colors
|
|
238
|
+
are clipped per channel, as a canvas does. ADS writes it with `themes.generated.css`.
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { paletteFor, observePalette } from "@ds";
|
|
242
|
+
|
|
243
|
+
let colors = paletteFor(container); // once per render pass
|
|
244
|
+
const fill = colors["--accent"].rgba; // inside the per-node loop
|
|
245
|
+
const stop = observePalette(container, next => { colors = next; redraw(); });
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
- `paletteFor(element)` returns the palette of the element's nearest theme and brand (and
|
|
249
|
+
the OS setting under `followSystemTheme`). Call it once per render or context change; look
|
|
250
|
+
colors up inside loops.
|
|
251
|
+
- `observePalette(element, callback)` calls back once when the element's theme or brand
|
|
252
|
+
changes; redraw from it instead of rebuilding the renderer. It returns the unsubscribe.
|
|
253
|
+
- `paletteContext(element)` returns the context key (`<theme>` or `<brand>/<theme>`) for
|
|
254
|
+
`palette[key]` or for caching per context.
|
|
255
|
+
- `resolveColor(element, value)` resolves a color that is not a palette token (currentColor,
|
|
256
|
+
a value from data) once, without inserting elements, and caches it.
|
|
257
|
+
- A token whose value cannot be resolved ahead of time (currentColor, relative color syntax,
|
|
258
|
+
system colors) is not in the palette in any context; `unresolved` lists it. Use
|
|
259
|
+
`resolveColor` for those.
|
|
260
|
+
- The palette reflects token sheets, not inline token overrides at runtime or `@media`
|
|
261
|
+
variants.
|
|
262
|
+
|
|
263
|
+
`render-color-probe` (review) flags a computed-style color read or `getImageData` inside a
|
|
264
|
+
per-item path (an array callback, a loop body, `nodeReducer`/`edgeReducer`, d3 `.attr`/
|
|
265
|
+
`.style` callbacks). Move the read out with `paletteFor`.
|
|
266
|
+
|
|
267
|
+
## Spacing
|
|
268
|
+
|
|
269
|
+
`--space-N` is N × 2 px, from 2 to 160 px; the same values hold at every screen size, and a
|
|
270
|
+
layout steps down one or two sizes at narrow widths instead of scaling. Use the scale for
|
|
271
|
+
padding inside components and for gaps between them; a value off the scale needs a reason.
|
|
272
|
+
|
|
273
|
+
- Distance says how related things are: closer means more related. Group with space before
|
|
274
|
+
reaching for dividers, borders or cards.
|
|
275
|
+
- More space around an element gives it more importance. Sections can be dense, but leave the
|
|
276
|
+
page as a whole room to breathe.
|
|
277
|
+
- Parents own the space between their children (`gap`, stack tokens); a component carries no
|
|
278
|
+
outer margin, so it fits wherever it is placed.
|
|
279
|
+
- Horizontal layout follows the column grid; percentages are fine for splitting a region and
|
|
280
|
+
for minimum and maximum widths.
|
|
281
|
+
|
|
282
|
+
## Motion tokens
|
|
283
|
+
|
|
284
|
+
Six durations (`--dur-instant` 70 ms, `--dur-fast` 110, `--dur-moderate` 150, `--dur-normal`
|
|
285
|
+
240, `--dur-slow` 400, `--dur-slower` 700) and three curve pairs (standard, enter and exit, each everyday and
|
|
286
|
+
`-strong`). Every duration is 0 under `prefers-reduced-motion`. Pick by purpose, not by
|
|
287
|
+
number: the ads-motion skill's build guide maps each token to its use and gives the easing
|
|
288
|
+
rules.
|
|
@@ -41,6 +41,10 @@ implicitly requiring them at acceptance.
|
|
|
41
41
|
all registered behavior checks. Use before a release, after ownership/test/config
|
|
42
42
|
migrations and for an explicit complete audit. Changed scope narrows registered
|
|
43
43
|
owners while project scripts and core gates retain full scope.
|
|
44
|
+
- `browserAudit: true` in either policy adds the axe-core audit of every rendered
|
|
45
|
+
UI scenario in every brand and theme (`browser-accessibility-audit`). Its `a11y-axe`
|
|
46
|
+
findings are errors that fail the policy; draft and patch acceptance do not run it. See
|
|
47
|
+
ads://guides/accessibility.
|
|
44
48
|
- Draft create, edit and show are preview-only; they trigger neither policy.
|
|
45
49
|
`ads_verify` explicitly runs selected checks independently of either policy.
|
|
46
50
|
- Builds, hooks and CI trigger a policy only when their scripts invoke it. Use
|
|
@@ -49,11 +53,11 @@ implicitly requiring them at acceptance.
|
|
|
49
53
|
disable tests or weaken configuration to make a failing change pass.
|
|
50
54
|
|
|
51
55
|
Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
|
|
52
|
-
validation `behaviorChecks:true`. No lint/test/build script names are inferred.
|
|
56
|
+
validation `behaviorChecks:true`, both `browserAudit:false`. No lint/test/build script names are inferred.
|
|
53
57
|
Every listed script must exist; commands are trusted project configuration, not
|
|
54
|
-
MCP arguments.
|
|
55
|
-
and
|
|
56
|
-
|
|
58
|
+
MCP arguments. `mcp.mutationChecks` is a configuration error: list those scripts in
|
|
59
|
+
`acceptance.checks` and set `acceptance.behaviorChecks`. `mcp.mutationCheckTimeoutMs`
|
|
60
|
+
bounds each project script; behavior profiles have separate budgets.
|
|
57
61
|
|
|
58
62
|
Report the chosen policy, scope and revision. Skipped tests are not passed tests;
|
|
59
63
|
acceptance evidence is not complete-validation evidence. The two policies keep
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef } from "preact/hooks";
|
|
2
|
+
import type { ComponentChildren } from "preact";
|
|
3
|
+
import { css, cx } from "@linaria/atomic";
|
|
4
|
+
|
|
5
|
+
export interface GridProps {
|
|
6
|
+
/** `wide` 32 px gutters (default), `narrow` 16 px, `condensed` 1 px for tightly related content. */
|
|
7
|
+
gutter?: "wide" | "narrow" | "condensed";
|
|
8
|
+
children?: ComponentChildren;
|
|
9
|
+
}
|
|
10
|
+
export interface GridItemProps {
|
|
11
|
+
/** Columns to span at each container size (of 4, 8 and 16). A size left out spans the full row. */
|
|
12
|
+
span?: { sm?: number; md?: number; lg?: number };
|
|
13
|
+
children?: ComponentChildren;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// The grid follows its container, not the window: it sits in any pane at the right columns.
|
|
17
|
+
const container = css`
|
|
18
|
+
container-type: inline-size;
|
|
19
|
+
width: 100%;
|
|
20
|
+
`;
|
|
21
|
+
const grid = css`
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns: repeat(var(--grid-columns-sm), minmax(0, 1fr));
|
|
24
|
+
padding-inline: var(--grid-margin-sm);
|
|
25
|
+
@container (min-width: 768px) {
|
|
26
|
+
grid-template-columns: repeat(var(--grid-columns-md), minmax(0, 1fr));
|
|
27
|
+
padding-inline: var(--grid-margin-md);
|
|
28
|
+
}
|
|
29
|
+
@container (min-width: 1024px) {
|
|
30
|
+
grid-template-columns: repeat(var(--grid-columns-lg), minmax(0, 1fr));
|
|
31
|
+
}
|
|
32
|
+
@container (min-width: 1280px) {
|
|
33
|
+
padding-inline: var(--grid-margin-lg);
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const gutters = {
|
|
37
|
+
wide: css`gap: var(--grid-gutter);`,
|
|
38
|
+
narrow: css`gap: var(--grid-gutter-narrow);`,
|
|
39
|
+
condensed: css`gap: var(--grid-gutter-condensed);`,
|
|
40
|
+
};
|
|
41
|
+
const item = css`
|
|
42
|
+
min-width: 0;
|
|
43
|
+
grid-column: span var(--ds-grid-span-sm, var(--grid-columns-sm));
|
|
44
|
+
@container (min-width: 768px) {
|
|
45
|
+
grid-column: span var(--ds-grid-span-md, var(--grid-columns-md));
|
|
46
|
+
}
|
|
47
|
+
@container (min-width: 1024px) {
|
|
48
|
+
grid-column: span var(--ds-grid-span-lg, var(--grid-columns-lg));
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
/** A column grid: 4, 8 or 16 columns by its container's width, with spacing-scale gutters. */
|
|
53
|
+
export function Grid({ gutter = "wide", children }: GridProps) {
|
|
54
|
+
return (
|
|
55
|
+
<div className={cx("ds-grid", container)}>
|
|
56
|
+
<div className={cx(grid, gutters[gutter])}>{children}</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** One cell of a `Grid`, spanning some of its columns at each size. */
|
|
62
|
+
export function GridItem({ span, children }: GridItemProps) {
|
|
63
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
const element = ref.current;
|
|
66
|
+
if (!element) return;
|
|
67
|
+
// Each size names its own variable: ADS allows only declared, literal style writes.
|
|
68
|
+
if (span?.sm) element.style.setProperty("--ds-grid-span-sm", String(span.sm));
|
|
69
|
+
else element.style.removeProperty("--ds-grid-span-sm");
|
|
70
|
+
if (span?.md) element.style.setProperty("--ds-grid-span-md", String(span.md));
|
|
71
|
+
else element.style.removeProperty("--ds-grid-span-md");
|
|
72
|
+
if (span?.lg) element.style.setProperty("--ds-grid-span-lg", String(span.lg));
|
|
73
|
+
else element.style.removeProperty("--ds-grid-span-lg");
|
|
74
|
+
}, [span?.sm, span?.md, span?.lg]);
|
|
75
|
+
return <div ref={ref} className={cx("ds-grid__item", item)}>{children}</div>;
|
|
76
|
+
}
|
|
@@ -47,6 +47,7 @@ const sampleStyle = css`
|
|
|
47
47
|
&[data-ads-property="color"] { color: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
|
|
48
48
|
&[data-ads-property="width"] {
|
|
49
49
|
width: var(--ux-token-preview-value);
|
|
50
|
+
max-width: 100%;
|
|
50
51
|
min-height: var(--space-8);
|
|
51
52
|
background: var(--accent);
|
|
52
53
|
}
|
|
@@ -59,6 +60,23 @@ const sampleStyle = css`
|
|
|
59
60
|
&[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
|
|
60
61
|
&[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
|
|
61
62
|
&[data-ads-property="line-height"] { line-height: var(--ux-token-preview-value); }
|
|
63
|
+
/* Column counts draw that many columns: stripes with a gap, filling the tile. */
|
|
64
|
+
&[data-ads-property="column-count"] {
|
|
65
|
+
column-count: var(--ux-token-preview-value);
|
|
66
|
+
height: calc(var(--space-8) * 3);
|
|
67
|
+
background: repeating-linear-gradient(
|
|
68
|
+
to right,
|
|
69
|
+
var(--accent) 0 calc((100% + var(--space-2)) / var(--ux-token-preview-value) - var(--space-2)),
|
|
70
|
+
transparent 0 calc((100% + var(--space-2)) / var(--ux-token-preview-value))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
&[data-ads-property="letter-spacing"] { letter-spacing: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 1.5); }
|
|
74
|
+
&[data-ads-property="height"] {
|
|
75
|
+
height: var(--ux-token-preview-value);
|
|
76
|
+
width: calc(var(--space-16) * 2);
|
|
77
|
+
border-radius: var(--radius-md);
|
|
78
|
+
background: var(--accent);
|
|
79
|
+
}
|
|
62
80
|
&[data-ads-property="box-shadow"] {
|
|
63
81
|
border-radius: var(--radius-md);
|
|
64
82
|
background: var(--bg-surface);
|
|
@@ -100,7 +118,7 @@ function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
|
|
|
100
118
|
return (
|
|
101
119
|
<article className={cx("ux-token-preview__item", tile)}>
|
|
102
120
|
<span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
|
|
103
|
-
{["background-color", "width", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
|
|
121
|
+
{["background-color", "width", "height", "border-radius", "box-shadow", "column-count", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
|
|
104
122
|
</span>
|
|
105
123
|
<code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
|
|
106
124
|
<small className={label}>{value}</small>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "preact",
|
|
3
|
+
"themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
|
|
3
4
|
"behaviorLibraries": [],
|
|
4
5
|
"acceptance": { "checks": [], "behaviorChecks": false },
|
|
5
6
|
"validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
|
|
@@ -8,6 +9,10 @@
|
|
|
8
9
|
},
|
|
9
10
|
"boundaries": {
|
|
10
11
|
"styleWrites": [
|
|
12
|
+
{
|
|
13
|
+
"file": "design-system/components/Layout/Grid/Grid.tsx",
|
|
14
|
+
"properties": ["--ds-grid-span-sm", "--ds-grid-span-md", "--ds-grid-span-lg"]
|
|
15
|
+
},
|
|
11
16
|
{
|
|
12
17
|
"file": "design-system/review/token-preview/TokenPreview.tsx",
|
|
13
18
|
"properties": [
|
|
@@ -16,5 +21,12 @@
|
|
|
16
21
|
}
|
|
17
22
|
]
|
|
18
23
|
},
|
|
19
|
-
"assets": {
|
|
24
|
+
"assets": {
|
|
25
|
+
"iconSource": "assets/brand/app-icon.svg",
|
|
26
|
+
"glyphs": {
|
|
27
|
+
"source": "assets/glyphs",
|
|
28
|
+
"output": "components/Content/Icon/glyphs.ts",
|
|
29
|
+
"attributes": { "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
}
|
|
@@ -24,8 +24,9 @@ The starter declares React in `ds.config.json`. Keep that choice, JSX, runtime
|
|
|
24
24
|
dependencies and the preview mount adapter consistent. Init records a choice for
|
|
25
25
|
an unconfigured project; it does not convert copied React source to Preact.
|
|
26
26
|
|
|
27
|
-
The starter has
|
|
28
|
-
|
|
27
|
+
The starter has examples of each layer (Button, IconButton, Icon, Logo, TextField and
|
|
28
|
+
Grid; the SearchBar pattern; the SearchPage composition), a shared `controllers/Palette`
|
|
29
|
+
and placeholder brand artwork. Rename, restyle or replace them; add only what the product needs.
|
|
29
30
|
Keep the ADS in root `design-system/`, beside application `src/`.
|
|
30
31
|
Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
|
|
31
32
|
`styles.css` is the foundation CSS entry and contains token imports only.
|
|
@@ -34,7 +35,7 @@ Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
|
|
|
34
35
|
|
|
35
36
|
Use semantic CSS tokens for visual values. Raw values belong in the token files.
|
|
36
37
|
Projects sharing this ADS use the same token names, meanings, and value types;
|
|
37
|
-
their concrete values and theme
|
|
38
|
+
their concrete values and per-theme halves can differ. Reuse existing local values
|
|
38
39
|
when importing components/patterns. Existing font, text, spacing and other roles
|
|
39
40
|
take precedence over divergent upstream constants. Add genuinely missing shared
|
|
40
41
|
decisions, and import source token values only when adopting that theme is requested.
|
|
@@ -48,7 +49,8 @@ variables. Every shared token needs a real sample in a shared token scenario.
|
|
|
48
49
|
|
|
49
50
|
Foundation roles are enforced by `foundation-role`, `foundation-selector` and
|
|
50
51
|
`foundation-import`, alongside the regular token checks. Shared definitions
|
|
51
|
-
belong on the document root
|
|
52
|
+
belong on the document root (per-theme values as halves, such as `--x-light` and
|
|
53
|
+
`--x-dark`) or a brand's `[data-brand]`; ordinary declarations belong
|
|
52
54
|
in `base.css`, and font-face descriptors in optional `fonts.css`. The entry imports
|
|
53
55
|
canonical sheets; those sheets cannot import another styling layer. Component
|
|
54
56
|
classes, IDs, data/ARIA hooks, contextual selectors, keyframes and scoped UI rules
|
|
@@ -59,7 +61,9 @@ font-face metadata keeps its separate asset role.
|
|
|
59
61
|
`base.css` has three closed roles:
|
|
60
62
|
|
|
61
63
|
- Document defaults: root/body typography, canvas colors and theme behavior,
|
|
62
|
-
global text selection and document scrollbars
|
|
64
|
+
global text selection and document scrollbars (the starter keeps the scrollbar's space
|
|
65
|
+
with `scrollbar-gutter: stable` and locks page scrolling while a modal `<dialog>` is
|
|
66
|
+
open with `html:has(:modal)`).
|
|
63
67
|
- Native resets: permitted normalization properties and values, such as zero
|
|
64
68
|
spacing, inherited control typography, list resets and responsive replaced media.
|
|
65
69
|
- Global accessibility: universal `:focus-visible` outline rules, and reduced-motion
|
|
@@ -88,8 +92,29 @@ geometry exceptions if a component needs them.
|
|
|
88
92
|
|
|
89
93
|
Use semantic HTML and test relevant keyboard/focus behavior. Motion should
|
|
90
94
|
consume duration/easing tokens and respect reduced motion. Brand changes belong
|
|
91
|
-
in tokens or documented component hooks. The starter uses system fonts
|
|
92
|
-
|
|
95
|
+
in tokens or documented component hooks. The starter uses system fonts; icons go
|
|
96
|
+
through `Icon` (its glyph set in `assets/glyphs/`) and icon-only actions through
|
|
97
|
+
`IconButton`.
|
|
98
|
+
|
|
99
|
+
Themes: a token that differs per theme has one half per declared theme on `:root`
|
|
100
|
+
(`--color-accent-9-light`, `--color-accent-9-dark`); a half refers to halves
|
|
101
|
+
(`var(--slate-11-dark)`), never to a token that follows the theme. Never set token values
|
|
102
|
+
under `[data-theme]` or `prefers-color-scheme`. ADS writes `tokens/themes.generated.css`
|
|
103
|
+
and `tokens/themes.generated.ts` (`ads assets`, the showcase or the MCP server); commit
|
|
104
|
+
them and do not edit them. Set `data-theme="<name>"` on `<html>` or
|
|
105
|
+
on a section, or set `"followSystemTheme": true` to follow the OS. Show theme-specific
|
|
106
|
+
content with `display: var(--display-dark, block)`; never style by a `[data-theme]` or
|
|
107
|
+
`[data-brand]` selector. A Canvas, WebGL or SVG renderer takes its colors from
|
|
108
|
+
`paletteFor(element)` (`controllers/Palette`, generated `tokens/themes.generated.ts`) once
|
|
109
|
+
per render and redraws from `observePalette`. A per-theme value from data at runtime
|
|
110
|
+
uses `themed()` or `themedByScheme()` from `tokens/themes.generated.ts`, never
|
|
111
|
+
`light-dark()`.
|
|
112
|
+
|
|
113
|
+
The starter has one brand. For several (white label, a product family, a partner
|
|
114
|
+
section), declare `brands` in `ds.config.json`; the first is the default. A brand sets
|
|
115
|
+
only its own values on `[data-brand="<name>"]`, with every half of a themed token it
|
|
116
|
+
changes. `ads check` fails on old theme selectors, missing halves and `brand-*` errors; the
|
|
117
|
+
token guide (`ads://guides/tokens`) has the details.
|
|
93
118
|
|
|
94
119
|
## Showcase
|
|
95
120
|
|
|
@@ -109,7 +134,9 @@ runtime, CSS and fonts, through MCP resources. App presentation comes from the
|
|
|
109
134
|
selected compiled scenario; reusable review layouts live in development-only `review/` through its separate public entry. Do not recreate
|
|
110
135
|
production widgets inside the client or scenario.
|
|
111
136
|
|
|
112
|
-
There are
|
|
137
|
+
There are five sections: Brand (first, shown only when the project has scenarios in
|
|
138
|
+
`brand/`), Tokens, Components, Patterns and Composition, plus an Icons tab after Tokens
|
|
139
|
+
for the glyph set. There are
|
|
113
140
|
no required `TokensPage`/`ComponentsPage`/`PatternsPage`/`CompositionPage` files.
|
|
114
141
|
Legacy custom browsing pages remain checked when present, but new projects use
|
|
115
142
|
the built-in client. Its tooling CSS is separate from the project style contract.
|
|
@@ -214,10 +241,16 @@ preview builds; review meaningful states in both themes and sizes.
|
|
|
214
241
|
## Branding
|
|
215
242
|
|
|
216
243
|
Keep original artwork, variants, usage, credits, and licenses in
|
|
217
|
-
`design-system/assets/brand/`. This starter has
|
|
244
|
+
`design-system/assets/brand/`. This starter has placeholder artwork there (`logo.svg`,
|
|
245
|
+
`logo.dark.svg`, `app-icon.svg`) with its README; replace it with the product's own.
|
|
246
|
+
Other products' logos are not brand artwork or glyphs: keep them, in their own
|
|
247
|
+
colors and under their owners' trademark and usage terms, in `assets/logos/` and
|
|
248
|
+
show them as images (a CSS mask over `currentColor` for a muted use); ADS generates
|
|
249
|
+
and checks nothing there.
|
|
218
250
|
Font assets belong in `assets/fonts/`; add optional `tokens/fonts.css` first in
|
|
219
251
|
the import-only foundation entry. The fixed import order is fonts (when
|
|
220
|
-
present), colors, typography, spacing, elevation, base
|
|
252
|
+
present), colors, typography, spacing, elevation, base, then the generated
|
|
253
|
+
`themes.generated.css`.
|
|
221
254
|
|
|
222
255
|
Select an SVG with `assets.iconSource` in `ds.config.json`, relative to the ADS
|
|
223
256
|
folder. Initialized builds run checks and Oxlint, then `ads assets`, then existing
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This private React or Preact TypeScript workspace contains semantic CSS tokens, a project-owned
|
|
4
4
|
token review renderer, a public barrel, Linaria extraction and a preview compiler
|
|
5
|
-
adapter, plus one example of each layer to build on:
|
|
6
|
-
|
|
7
|
-
components
|
|
8
|
-
`components/
|
|
5
|
+
adapter, plus one example of each layer to build on: a token foundation in six groups (Color, Type, Space & sizing, Shape & elevation, Motion, Layout), Brand previews in two groups (`brand/Identity/Logo`, `brand/Icons/AppIcon`),
|
|
6
|
+
components in four groups (`components/Actions/Button`, `components/Actions/IconButton`,
|
|
7
|
+
`components/Content/Icon`, `components/Content/Logo`, `components/Forms/TextField`,
|
|
8
|
+
`components/Layout/Grid`), a 24 px icon set in `assets/glyphs/` generated into
|
|
9
|
+
`components/Content/Icon/glyphs.ts`, one pattern
|
|
9
10
|
(`patterns/Search/SearchBar`) and one composition (`composition/Search/SearchPage`),
|
|
10
11
|
plus placeholder brand artwork in `assets/brand/` (a logo with its dark-theme
|
|
11
|
-
variant, and the app icon that `assets.iconSource` names)
|
|
12
|
+
variant, and the app icon that `assets.iconSource` names), and a shared
|
|
13
|
+
`controllers/Palette` that gives Canvas, WebGL and SVG renderers their colors. Rename,
|
|
14
|
+
restyle or
|
|
12
15
|
replace them as the product's own; it has no fonts. The minimal showcase shell and MCP client
|
|
13
16
|
come from ADS tooling.
|
|
14
17
|
|
|
@@ -33,7 +36,7 @@ npm run dev:showcase
|
|
|
33
36
|
For unreleased tooling, create from the real local package:
|
|
34
37
|
|
|
35
38
|
```sh
|
|
36
|
-
ads_tool_package="/absolute/path/to/reqvire-org-ads-0.3.
|
|
39
|
+
ads_tool_package="/absolute/path/to/reqvire-org-ads-0.3.47.tgz"
|
|
37
40
|
npx --yes --package "$ads_tool_package" ads create my-design-system --framework react --tool-package "$ads_tool_package"
|
|
38
41
|
```
|
|
39
42
|
|
|
@@ -61,9 +64,58 @@ Its MCP client discovers entries, invokes preview tools and follows notification
|
|
|
61
64
|
There are no required TokensPage/ComponentsPage/PatternsPage/CompositionPage
|
|
62
65
|
files, and no separate project browser app to implement or rebuild.
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
## Tokens
|
|
68
|
+
|
|
69
|
+
The foundation meets WCAG 2.2 AA:
|
|
70
|
+
|
|
71
|
+
- **Color** (`colors.css`): six 12-step ramps (`--slate-*`, `--color-accent-*`,
|
|
72
|
+
`--color-green|amber|red|blue-*`); each step has one job: 1–2 backgrounds, 3–5 component
|
|
73
|
+
rest/hover/pressed, 6–8 borders, 9–10 solid fills, 11–12 text. Each step has a light and a
|
|
74
|
+
dark half (`--slate-9-light`, `--slate-9-dark`). Semantic roles (`--bg-*`, `--text-*`, `--border-*`,
|
|
75
|
+
`--accent*`, `--success|warning|danger|info*`) alias ramp steps; text pairs reach 4.5:1
|
|
76
|
+
and focus and strong borders 3:1 in both themes. Layers go canvas → surface → raised,
|
|
77
|
+
each a step lighter in dark; inputs use `--bg-field`; `--bg-overlay` is the modal scrim and
|
|
78
|
+
`--bg-skeleton` the loading fill. Disabled roles (`--bg-|--text-|--border-disabled`) are
|
|
79
|
+
neutral for every variant and exempt from contrast. States move along a ramp: hover one
|
|
80
|
+
step, pressed two, selected the accent's step 3.
|
|
81
|
+
- **Type** (`typography.css`): a 16 px body on a modular ladder `--text-xs`…`--text-5xl`,
|
|
82
|
+
fluid from `3xl`; line height tightens as size grows (`--leading-*`), letter spacing turns
|
|
83
|
+
negative for display (`--tracking-*`); weights 400–700.
|
|
84
|
+
- **Space & sizing** (`spacing.css`): one rhythm, `--space-N` = N × 2 px from 0 to 160 px.
|
|
85
|
+
Use 0–8 px inside components, 12–24 px between related elements, 32–80 px between
|
|
86
|
+
sections and 96–160 px around hero and page sections; values do not change by screen
|
|
87
|
+
size, step down at narrow widths. Stack and prose-flow gaps, control heights 32/40/48 px
|
|
88
|
+
with padding, icons 16/20/24/32 px.
|
|
89
|
+
- **Shape & elevation**: radius `--radius-xs`…`--radius-2xl` and `--radius-full`, border
|
|
90
|
+
and focus widths, layered shadows `--shadow-xs`…`--shadow-xl` (stronger in dark), and
|
|
91
|
+
fixed stacking layers `--z-*`.
|
|
92
|
+
- **Themes**: light (default) and dark, declared in `ds.config.json`. Every themed token is
|
|
93
|
+
written as halves on `:root`; ADS generates `tokens/themes.generated.css` (switches and
|
|
94
|
+
resolvers) and `tokens/themes.generated.ts` (the renderer palette and `themed()`), so
|
|
95
|
+
`data-theme` themes the page on `<html>` or one section on any element, following the
|
|
96
|
+
nearest one. `--display-light`/`--display-dark` show theme-specific content. Runtime
|
|
97
|
+
per-theme values use `themed()` or `themedByScheme()` from `themes.generated.ts`; a
|
|
98
|
+
renderer reads its colors with `paletteFor(element)` from `controllers/Palette`.
|
|
99
|
+
- **Motion** (`elevation.css`): durations 70/110/150/240/400/700 ms, easing for moving between
|
|
100
|
+
places (standard), entering and leaving, each with a `-strong` variant for rare important
|
|
101
|
+
moments; all durations are 0 under reduced motion.
|
|
102
|
+
- **Layout**: a column grid (`--grid-columns-sm/md/lg` = 4/8/16 columns from 0,
|
|
103
|
+
768 and 1024 px of container width; gutters 32/16/1 px for wide, narrow and condensed;
|
|
104
|
+
margins 0/16/24 px), `--content-max` (72ch), container widths `--container-*`, header,
|
|
105
|
+
side pane and rail. Breakpoints cannot be CSS variables: use 640, 768, 1024 and 1280 px
|
|
106
|
+
in media queries, or container queries as `components/Layout/Grid` does.
|
|
107
|
+
|
|
108
|
+
`components/Layout/Grid` (`Grid`, `GridItem`) lays content on that grid by container width,
|
|
109
|
+
so it fits any pane. The showcase's grid button draws the project's grid over every
|
|
110
|
+
preview to check alignment.
|
|
111
|
+
|
|
112
|
+
`ads check` fails when a text or control pair falls below WCAG AA in any theme or brand
|
|
113
|
+
(`token-contrast`) and when a spacing step leaves the 2 px rhythm (`token-rhythm`).
|
|
114
|
+
`ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools.
|
|
115
|
+
|
|
116
|
+
The six token scenarios (`tokens/Color`, `Type`, `Space`, `Shape`, `Motion`, `Layout`)
|
|
117
|
+
and their colocated fixtures visually demonstrate every token value, one tile per token
|
|
118
|
+
with its current value. The fixture owns `{ token, property, probe }` bindings;
|
|
67
119
|
the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
|
|
68
120
|
variables. Add/remove samples alongside token definitions. `ads check` rejects
|
|
69
121
|
missing coverage and invented names; the App verifies the declared CSS bindings
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Project branding
|
|
2
2
|
|
|
3
3
|
The starter's placeholder artwork. Replace each file with the product's own and keep this
|
|
4
|
-
table current: `ads check`
|
|
5
|
-
|
|
4
|
+
table current: `ads check` fails on artwork that is undescribed, unlicensed or missing from
|
|
5
|
+
the Brand previews (`brand/Identity/Logo`, `brand/Icons/AppIcon`), and lists unused
|
|
6
|
+
artwork for review.
|
|
6
7
|
|
|
7
8
|
| File | Use | Backgrounds |
|
|
8
9
|
|---|---|---|
|
|
@@ -21,8 +22,12 @@ patterns and development review helpers own `--ux-*`; the showcase owns
|
|
|
21
22
|
`--showcase-*`. Do not introduce a brand-prefixed token vocabulary or override
|
|
22
23
|
component state variables.
|
|
23
24
|
|
|
25
|
+
This folder holds the product's own artwork only. Other products' logos belong in
|
|
26
|
+
`assets/logos/`, shown as images under their owners' trademark and usage terms.
|
|
27
|
+
|
|
24
28
|
Name a dark-theme variant `<name>.dark.svg`; the component showing the artwork renders
|
|
25
|
-
both and
|
|
29
|
+
both and shows each with its display switch (`display: var(--display-dark, block)`), so a
|
|
30
|
+
section shows the variant of its nearest theme. Fixed colors belong inside the artwork only.
|
|
26
31
|
|
|
27
32
|
Put licensed font files in `assets/fonts/` and their declarations in
|
|
28
33
|
`tokens/fonts.css`. Keep that optional import first in `styles.css`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Glyphs
|
|
2
|
+
|
|
3
|
+
The UI icon set: one 24 × 24 stroke drawing per file, colored by `currentColor` so an icon
|
|
4
|
+
takes the color of the text beside it. `ads assets` turns them into
|
|
5
|
+
`components/Content/Icon/glyphs.ts` (`assets.glyphs` in `ds.config.json`), adding
|
|
6
|
+
`fill="none"`, a 2 px stroke and round caps where a file does not set them. `aliases.json`
|
|
7
|
+
gives extra names to existing glyphs.
|
|
8
|
+
|
|
9
|
+
Keep every glyph on the same 24 × 24 `viewBox` and never set a fill or stroke color in the
|
|
10
|
+
file: `ads check` fails on both (`glyph-viewbox`, `glyph-color`). Review the set in the
|
|
11
|
+
showcase's Icons tab. Another product's logo
|
|
12
|
+
that keeps its own colors is not a glyph: it belongs in `assets/logos/`, shown as an image,
|
|
13
|
+
under its owner's trademark and usage terms.
|
|
14
|
+
|
|
15
|
+
License: drawn for the ADS starter, free to use, change or remove (MIT, like ADS).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "x": "close", "add": "plus" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>
|