@reqvire-org/ads 0.3.45 → 0.3.46

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.
Files changed (98) hide show
  1. package/README.md +3 -1
  2. package/dist/a11y.mjs +100 -0
  3. package/dist/assets.mjs +25 -1
  4. package/dist/capture/worker.mjs +1 -1
  5. package/dist/capture-store.mjs +2 -1
  6. package/dist/capture.mjs +5 -2
  7. package/dist/check.mjs +2 -1
  8. package/dist/cli.mjs +12 -0
  9. package/dist/config.mjs +3 -0
  10. package/dist/contracts/tokens.json +1 -1
  11. package/dist/design-values.mjs +8 -2
  12. package/dist/foundation.mjs +3 -0
  13. package/dist/mcp/apps.mjs +1 -1
  14. package/dist/mcp/preview-widget.bundle.js +19 -13
  15. package/dist/mcp/project-widget.bundle.js +25 -25
  16. package/dist/mcp/server.mjs +3 -1
  17. package/dist/mcp/widget.bundle.js +15 -15
  18. package/dist/preview-resources.mjs +1 -1
  19. package/dist/showcase/client.bundle.js +25 -25
  20. package/dist/showcase/index.html +1 -1
  21. package/dist/skills/ads-break-ui/references/captures.md +3 -2
  22. package/dist/skills/ads-break-ui/references/design-data.md +89 -0
  23. package/dist/skills/ads-designer/SKILL.md +13 -3
  24. package/dist/skills/ads-designer/references/accessibility.md +43 -0
  25. package/dist/skills/ads-designer/references/branding.md +28 -0
  26. package/dist/skills/ads-designer/references/captures.md +3 -2
  27. package/dist/skills/ads-designer/references/design-data.md +89 -0
  28. package/dist/skills/ads-import/references/captures.md +3 -2
  29. package/dist/skills/ads-import/references/design-data.md +89 -0
  30. package/dist/skills/ads-motion/references/build.md +33 -0
  31. package/dist/skills/ads-motion/references/captures.md +3 -2
  32. package/dist/skills/ads-motion/references/design-data.md +89 -0
  33. package/dist/skills/ads-motion/references/motion-review.md +2 -2
  34. package/dist/skills/ads-port/references/captures.md +3 -2
  35. package/dist/skills/ads-port/references/design-data.md +89 -0
  36. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
  37. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +10 -1
  38. package/dist/starters/preact/ds.config.json +13 -1
  39. package/dist/starters/react/README.md +54 -7
  40. package/dist/starters/react/design-system/assets/glyphs/README.md +12 -0
  41. package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
  42. package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
  43. package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
  44. package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
  45. package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
  46. package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
  47. package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
  48. package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
  49. package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
  50. package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
  51. package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
  52. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +11 -4
  53. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
  54. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
  55. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
  56. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
  57. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +1 -0
  58. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +15 -0
  59. package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
  60. package/dist/starters/react/design-system/components/Content/Icon/README.md +16 -0
  61. package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
  62. package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +9 -5
  63. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
  64. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
  65. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
  66. package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
  67. package/dist/starters/react/design-system/index.ts +3 -0
  68. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
  69. package/dist/starters/react/design-system/review/index.ts +1 -0
  70. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +10 -1
  71. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +114 -8
  72. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
  73. package/dist/starters/react/design-system/tokens/{SpaceTypeMotion.ads.scenario.tsx → Layout.ads.scenario.tsx} +1 -1
  74. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
  75. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +4 -0
  76. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
  77. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +4 -0
  78. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
  79. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
  80. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
  81. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
  82. package/dist/starters/react/design-system/tokens/base.css +6 -3
  83. package/dist/starters/react/design-system/tokens/colors.css +220 -26
  84. package/dist/starters/react/design-system/tokens/elevation.css +51 -6
  85. package/dist/starters/react/design-system/tokens/spacing.css +67 -3
  86. package/dist/starters/react/design-system/tokens/typography.css +25 -7
  87. package/dist/starters/react/ds.config.json +13 -1
  88. package/dist/themes.mjs +106 -0
  89. package/dist/token-export.mjs +58 -0
  90. package/dist/token-quality.mjs +109 -0
  91. package/dist/tokens.mjs +9 -2
  92. package/docs/ADS.md +34 -5
  93. package/docs/ARCHITECTURE.md +49 -4
  94. package/docs/CHANGELOG.md +64 -12
  95. package/docs/GUIDE.md +31 -3
  96. package/docs/MCP.md +13 -4
  97. package/package.json +1 -1
  98. package/dist/starters/react/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
@@ -0,0 +1,109 @@
1
+ import { defaultThemes, themeDefinition } from "./themes.mjs";
2
+
3
+ /** Accessibility and rhythm reviews of token values: WCAG contrast between the roles that
4
+ * meet on screen, in every theme, and spacing steps on the 2 px grid. Both are advisories. */
5
+
6
+ const named = { white: [255, 255, 255, 1], black: [0, 0, 0, 1] };
7
+
8
+ /** sRGB channels and alpha of a hex, rgb()/rgba() or hsl()/hsla() color; null otherwise. */
9
+ export function parseColor(value) {
10
+ const text = value.trim().toLowerCase();
11
+ if (named[text]) return named[text];
12
+ let match = text.match(/^#([0-9a-f]{3,8})$/);
13
+ if (match) {
14
+ let hex = match[1];
15
+ if (hex.length === 3 || hex.length === 4) hex = [...hex].map(digit => digit + digit).join("");
16
+ if (hex.length !== 6 && hex.length !== 8) return null;
17
+ const channels = [0, 2, 4].map(index => parseInt(hex.slice(index, index + 2), 16));
18
+ return [...channels, hex.length === 8 ? parseInt(hex.slice(6), 16) / 255 : 1];
19
+ }
20
+ match = text.match(/^(rgba?|hsla?)\((.*)\)$/);
21
+ if (!match) return null;
22
+ const parts = match[2].split(/[\s,/]+/).filter(Boolean);
23
+ if (parts.length < 3) return null;
24
+ const alpha = parts[3] === undefined ? 1 : parts[3].endsWith("%") ? parseFloat(parts[3]) / 100 : parseFloat(parts[3]);
25
+ if (match[1].startsWith("rgb")) {
26
+ const channels = parts.slice(0, 3).map(part => part.endsWith("%") ? parseFloat(part) * 2.55 : parseFloat(part));
27
+ return channels.some(Number.isNaN) ? null : [...channels, alpha];
28
+ }
29
+ const [h, s, l] = [parseFloat(parts[0]), parseFloat(parts[1]) / 100, parseFloat(parts[2]) / 100];
30
+ if ([h, s, l].some(Number.isNaN)) return null;
31
+ const k = n => (n + h / 30) % 12, a = s * Math.min(l, 1 - l);
32
+ const f = n => 255 * (l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)));
33
+ return [f(0), f(8), f(4), alpha];
34
+ }
35
+
36
+ const luminance = ([r, g, b]) => {
37
+ const channel = value => { value /= 255; return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4; };
38
+ return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
39
+ };
40
+ const over = (top, bottom) => [0, 1, 2].map(index => top[index] * top[3] + bottom[index] * (1 - top[3])).concat(1);
41
+ /** WCAG 2 contrast ratio of a foreground over an opaque background. */
42
+ export function contrastRatio(foreground, background) {
43
+ const [a, b] = [luminance(over(foreground, background)), luminance(background)];
44
+ return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
45
+ }
46
+
47
+ const textBackgrounds = ["--bg-canvas", "--bg-surface", "--bg-raised", "--bg-field", "--bg-hover"];
48
+ /** The roles that meet on screen. Text needs 4.5:1 (WCAG 1.4.3); focus indicators and the
49
+ * borders that identify controls need 3:1 (1.4.11). */
50
+ function contrastPairs(names) {
51
+ const pairs = [];
52
+ for (const text of ["--text-strong", "--text-body", "--text-muted", "--text-link", "--accent-text"]) for (const background of textBackgrounds) pairs.push([text, background, 4.5]);
53
+ pairs.push(["--accent-fg", "--accent", 4.5], ["--accent-fg", "--accent-hover", 4.5]);
54
+ for (const status of ["success", "warning", "danger", "info"]) pairs.push([`--${status}-fg`, `--${status}`, 4.5], [`--${status}-text`, `--${status}-bg`, 4.5]);
55
+ for (const ui of ["--border-focus", "--border-strong"]) for (const background of ["--bg-canvas", "--bg-surface"]) pairs.push([ui, background, 3]);
56
+ return pairs.filter(([foreground, background]) => names.has(foreground) && names.has(background));
57
+ }
58
+
59
+ export function tokenContrastAdvisories(tokens, themes = defaultThemes) {
60
+ const byName = new Map(tokens.map(token => [token.name, token]));
61
+ const definition = (name, theme) => byName.has(name) ? themeDefinition(byName.get(name), theme) : undefined;
62
+ // A theme value follows var() references, each resolved in the same theme.
63
+ const resolve = (name, theme, seen = new Set()) => {
64
+ if (seen.has(name)) return null;
65
+ const value = definition(name, theme)?.value?.trim();
66
+ const reference = value?.match(/^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/);
67
+ return reference ? resolve(reference[1], theme, new Set([...seen, name])) : value ?? null;
68
+ };
69
+ const advisories = [];
70
+ for (const { name: scope } of themes) {
71
+ for (const [foreground, background, minimum] of contrastPairs(new Set(byName.keys()))) {
72
+ const front = parseColor(resolve(foreground, scope) ?? ""), back = parseColor(resolve(background, scope) ?? "");
73
+ if (!front || !back) continue;
74
+ const ratio = contrastRatio(front, back[3] < 1 ? over(back, [255, 255, 255, 1]) : back);
75
+ if (ratio + 1e-9 >= minimum) continue;
76
+ const at = definition(foreground, scope);
77
+ if (!at) continue;
78
+ const { file, line, column } = at;
79
+ advisories.push({ rule: "token-contrast", severity: "warning", file, line, column, tokens: [foreground, background], guidanceUri: "ads://guides/tokens",
80
+ message: `${foreground} on ${background} is ${ratio.toFixed(2)}:1 in the ${scope} theme; ${minimum === 4.5 ? "text needs 4.5:1 (WCAG 1.4.3)" : "focus indicators and control borders need 3:1 (WCAG 1.4.11)"}.` });
81
+ }
82
+ }
83
+ return advisories;
84
+ }
85
+
86
+ /** Pixels of a px/rem/0 length, or null. */
87
+ const pixels = value => {
88
+ const match = value.trim().match(/^(-?\d*\.?\d+)(px|rem)?$/);
89
+ if (!match || (!match[2] && Number(match[1]) !== 0)) return null;
90
+ return Number(match[1]) * (match[2] === "rem" ? 16 : 1);
91
+ };
92
+
93
+ /** Numbered spacing steps sit on the 2 px grid, --space-N at N × 2 px. */
94
+ export function tokenRhythmAdvisories(tokens) {
95
+ const advisories = [];
96
+ for (const token of tokens) {
97
+ const step = token.name.match(/^--space-(\d+)$/)?.[1];
98
+ if (step === undefined) continue;
99
+ for (const { file, line, column, value, scope } of token.definitions) {
100
+ const size = pixels(value);
101
+ if (size === null) continue;
102
+ const expected = Number(step) * 2;
103
+ if (size % 2 === 0 && size === expected) continue;
104
+ advisories.push({ rule: "token-rhythm", severity: "warning", file, line, column, tokens: [token.name], guidanceUri: "ads://guides/tokens",
105
+ message: `${token.name} is ${size}px${scope === ":root" ? "" : ` in ${scope}`}; the spacing scale is --space-N = N × 2 px (${expected}px), on a 2 px grid.` });
106
+ }
107
+ }
108
+ return advisories;
109
+ }
package/dist/tokens.mjs CHANGED
@@ -1,4 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
+ import { tokenContrastAdvisories, tokenRhythmAdvisories } from "./token-quality.mjs";
3
+ import { a11yTokenAdvisories } from "./a11y.mjs";
4
+ import { scopeTheme, themeFindings } from "./themes.mjs";
2
5
  import path from "node:path";
3
6
  import postcss from "postcss";
4
7
  import valueParser from "postcss-value-parser";
@@ -79,7 +82,7 @@ export function inspectTokens(directory, suppliedOptions) {
79
82
  const scopes = new Map();
80
83
  for (const [name, entries] of definitions) {
81
84
  for (const entry of entries) {
82
- if (entry.scope === ":root") base.set(name, entry);
85
+ if (scopeTheme(entry.scope)?.base) base.set(name, entry);
83
86
  else {
84
87
  if (!scopes.has(entry.scope)) scopes.set(entry.scope, new Map());
85
88
  scopes.get(entry.scope).set(name, entry);
@@ -138,10 +141,14 @@ export function inspectTokens(directory, suppliedOptions) {
138
141
  }
139
142
  }
140
143
  const tokens = [...definitions].sort(([a], [b]) => a.localeCompare(b)).map(([name, entries]) => ({ name, ...tokenContract.tokens[name], owner:"tokens", definitions: entries }));
144
+ const themes = themeFindings(tokens, config.themes, { dsDir: config.dsDir });
145
+ diagnostics.push(...themes.diagnostics);
141
146
  return options.tokenInventory = {
142
147
  contractVersion: tokenContract.version,
148
+ themes: config.themes,
143
149
  tokens,
144
- advisories: tokenOverlapAdvisories(tokens),
150
+ advisories: [...tokenOverlapAdvisories(tokens), ...tokenContrastAdvisories(tokens, config.themes), ...tokenRhythmAdvisories(tokens), ...themes.advisories,
151
+ ...a11yTokenAdvisories(tokens, { root, foundationFile: path.join(dsRoot, config.tokenDir, "base.css") })],
145
152
  diagnostics,
146
153
  };
147
154
  }
package/docs/ADS.md CHANGED
@@ -61,7 +61,7 @@ for checked formats and gaps.
61
61
  ## Showcase contract
62
62
 
63
63
  The showcase is a minimal shell plus an MCP client and Apps host, shipped with
64
- ADS tooling. It discovers token/component/pattern/composition
64
+ ADS tooling. It discovers brand/token/component/pattern/composition
65
65
  scenarios from MCP tool results, invokes preview tools and responds to resource
66
66
  notifications. The project does not author a second catalogue or browser app.
67
67
 
@@ -69,14 +69,18 @@ notifications. The project does not author a second catalogue or browser app.
69
69
  `ads_status`. Without an agent connection, `ads showcase` starts the same runtime
70
70
  for browser use. Both transports share one configured preview compiler.
71
71
 
72
- The shell owns section tabs, collapsible navigation, theme controls and the App
73
- slot. The browser host uses a separate-origin sandbox proxy; project runtimes,
72
+ The shell owns section tabs, collapsible navigation, theme and grid-overlay controls
73
+ and the App slot. The grid overlay draws the project's `--grid-*` columns over the
74
+ selected preview at the starter Grid's container widths; without grid tokens it draws
75
+ nothing. The browser host uses a separate-origin sandbox proxy; project runtimes,
74
76
  styles, fonts and UI execute/apply only in the App iframe. Components, patterns,
75
77
  token values, scenarios, fixtures and their Linaria styles remain project-owned.
76
78
  App presentation comes from the selected compiled scenario; reusable review layouts live in development-only `review/` through its separate public entry. Do not recreate
77
79
  production widgets inside the client or scenario.
78
80
 
79
- There are four sections: Tokens, Components, Patterns and Composition. There are
81
+ There are five sections: Brand (first, shown only when the project has scenarios in
82
+ `brand/`), Tokens, Components, Patterns and Composition. Brand previews are grouped by
83
+ folder like components and have no token samples. There are
80
84
  no required `TokensPage`/`ComponentsPage`/`PatternsPage`/`CompositionPage` files.
81
85
  Legacy custom browsing pages remain checked when present, but new projects use
82
86
  the built-in client. Its tooling CSS is separate from the project style contract.
@@ -243,12 +247,34 @@ statically resolved helper/import interpolation. Typography/layering checks foll
243
247
  aliases to their actual CSS consumers. Measured geometry and typed instance paint
244
248
  bindings retain their narrow runtime contracts; they are not static design scales.
245
249
 
250
+ ### Themes
251
+
252
+ A theme is a named set of values for the same tokens. `themes` in `ds.config.json` lists
253
+ them with the color scheme each uses (`light` or `dark`); the first is the default and holds
254
+ its values on `:root`. Other themes override values under `[data-theme="<name>"]`, which
255
+ applies to the page on `<html>` or to one section on any element; the foundation guard
256
+ accepts these selectors as it does the root. Because a custom property resolves `var()`
257
+ where it is declared, roles that alias ramp steps are declared on `:root, [data-theme]` so a
258
+ themed section resolves them against its own values. Contrast reviews, captures, the
259
+ showcase theme button and `ads tokens --format dtcg --theme` work per declared theme;
260
+ `theme-undeclared`, `theme-new-token`, `theme-coverage` and `theme-empty` keep theme
261
+ definitions consistent. Switching themes at runtime (user choice, `prefers-color-scheme`,
262
+ remembering the choice) belongs to the application.
263
+
246
264
  Shared token previews and sample coverage live under the configured token directory.
247
265
  The project mount adapter imports its foundation for both runtime and independent
248
266
  token previews. No owner stylesheet dependencies are injected into preview entries.
249
267
  `ads_prepare_token_samples` reconciles real shared bindings from project-selected
250
268
  properties/probes; it does not invent missing semantics.
251
269
 
270
+ `ads check` reviews token values as advisories: `token-contrast` (WCAG AA for the roles
271
+ that meet on screen, in every theme, through aliases), `token-rhythm` (`--space-N` =
272
+ N × 2 px) and `token-overlap-review` (equal values within one token family). The
273
+ accessibility guards (`a11y-*`) read tokens and runtime component source. `ads tokens
274
+ --format dtcg` exports the tokens as W3C Design Tokens JSON. See the
275
+ [token guide](../skills/ads-designer/references/design-data.md) and the
276
+ [accessibility guide](../skills/ads-designer/references/accessibility.md).
277
+
252
278
  `token-overlap-review` warns about identical normalized shared definitions across
253
279
  their declared theme scopes. It never merges semantic roles or blocks a build merely
254
280
  because values coincide. Shared Data boundary violations are errors. See the
@@ -405,7 +431,10 @@ ads check → ads assets → existing prebuild → existing build
405
431
  `ads check` validates architecture and declared native usage policies directly
406
432
  before asset generation. Additional project linters run only through explicit scripts.
407
433
  `lint-config` is an optional adapter for projects that choose Oxlint. `ads assets`
408
- generates configured browser icons from the source SVG into ignored `.ds/assets/`.
434
+ generates configured browser icons from `assets.iconSource` into ignored `.ds/assets/`,
435
+ renders committed `assets.targets` (recorded in `assets/generated.json`) and writes the
436
+ `assets.glyphs` module; `ads check` fails when a committed output or the glyph module is
437
+ stale.
409
438
  A failed check or generation stops the build. Keep the project's CSS lint,
410
439
  type checks, behavior tests, and framework compilation in its build/test flow.
411
440
  `ads init` preserves existing lint tools and build commands.
@@ -39,6 +39,15 @@ The project declares React or native Preact in `ds.config.json` and uses the
39
39
  matching compiler and mount adapter. Both integrate with the required styling
40
40
  and validation pipeline; additional frameworks need explicit tooling support.
41
41
 
42
+ New projects start from the starter that ships inside the same ADS package:
43
+ `ads create <folder> --framework react|preact` copies `starters/react` (and, for
44
+ Preact, the `starters/preact` files that replace React's), names the package and
45
+ runs init, so a project always matches the tool version that checks it. Skills carry
46
+ no starter copy; they point agents to `ads create`. The starter is a working base: a
47
+ token foundation in six groups (color ramps with AA-checked roles, type,
48
+ space and sizing, shape and elevation, motion, layout with a column grid), brand artwork
49
+ with Brand previews, an icon set, and one example of each layer.
50
+
42
51
  ADS checks run during development and builds. The tool adds no production UI
43
52
  runtime. Its ownership boundaries preserve a project's optimization strategy:
44
53
  lazy loading, code splitting, memoized data, caching, worker execution, and
@@ -308,8 +317,11 @@ completion requirements, build integration and recovery.
308
317
 
309
318
  Humans and coding agents inspect the same project through MCP. The showcase is
310
319
  **a minimal shell plus an MCP client and Apps host**, shipped as development
311
- tooling. Its header, section tabs, collapsible left menu, theme switch and preview
312
- area stay neutral. The client discovers entries, invokes tools, forwards App
320
+ tooling. Its header, section tabs (Brand, shown first when the project previews its
321
+ artwork, then Tokens, Components, Patterns and Composition), collapsible left menu,
322
+ grid overlay and theme switches and preview area stay neutral. The grid overlay draws
323
+ the project's `--grid-*` columns over every preview through the App's host context, so
324
+ alignment is checked on real previews without a second renderer. The client discovers entries, invokes tools, forwards App
313
325
  resource requests and subscribes to changes. It contains no project UI catalogue
314
326
  or implementation imports.
315
327
 
@@ -463,8 +475,8 @@ whose non-hidden children are all real directories, supplies its exact folder
463
475
  name. An owner directory and layer root never become groups; a direct file or
464
476
  symlink disqualifies a container. Nested qualifying containers form a path label
465
477
  such as `Forms / Selection`. Flat owners stay ungrouped with no Default heading.
466
- This applies to components, patterns and compositions; token categories remain
467
- unchanged. Move owners to reorganize groups, updating imports and path-derived
478
+ This applies to components, patterns, compositions and brand previews (`brand/`);
479
+ token categories remain unchanged. Move owners to reorganize groups, updating imports and path-derived
468
480
  identities where needed. No scenario/owner metadata can override the folder rule.
469
481
 
470
482
  Discovery adds an optional derived `group` to scenario results. One registry feeds
@@ -713,6 +725,24 @@ is published as one atomic generated record under `.ds/captures/` and stays outs
713
725
  source ownership and product bundles. Detailed usage lives in each portable skill's
714
726
  [capture reference](../skills/ads-designer/references/captures.md).
715
727
 
728
+ ## Brand assets and icons
729
+
730
+ Brand artwork lives in `assets/brand/`: SVG masters, finished PNG/JPEG/WebP images and
731
+ delivered `.ico`/`.icns` files, each described with its use and license in the folder's
732
+ README. Brand previews are scenarios in `brand/`, the showcase's first section; they show
733
+ artwork in the current theme and the app icon at its sizes and have no token samples.
734
+
735
+ `ads assets` makes three kinds of output. Web icons from `assets.iconSource` are rebuilt
736
+ into ignored `.ds/assets/` on every build, for the application's bundler. Committed targets
737
+ (`assets.targets`) are native and upload outputs that must exist without running ADS (a
738
+ Tauri bundle, a tray icon compiled into a binary, a file uploaded by hand): each copies or
739
+ renders one master to a project path, and the committed `assets/generated.json` records
740
+ its master hash, settings and output hash. A glyph set (`assets.glyphs`) turns a folder of
741
+ icon SVGs into one typed module. Freshness is checked by comparing recorded hashes, never by
742
+ rendering, so the result is the same on every machine; a finished image is never enlarged.
743
+ The starter's `Icon` and `IconButton` read that module: icons take `currentColor`, pair
744
+ their size with text, and an icon-only button always has a label.
745
+
716
746
  ## Build checks keep the architecture in place
717
747
 
718
748
  The project build runs ADS checks before producing application or showcase
@@ -720,6 +750,21 @@ output. These checks enforce token use, source ownership, public imports,
720
750
  showcase coverage, component state boundaries, and separation of runtime code from development
721
751
  fixtures. Component-specific usage rules extend the shared checks when needed.
722
752
 
753
+ Themes are declared in `ds.config.json` and are only value sets: every theme shares the
754
+ same token names, and a theme applies to the page or to one section through
755
+ `[data-theme]`. The declaration is the one theme list the showcase, captures, preview
756
+ host context, contrast review and token export read, so a project can add a high-contrast
757
+ or brand theme without tool changes.
758
+
759
+ Token, brand and accessibility reviews run in the same check as advisories: they warn
760
+ with a location and a reference (WCAG criteria for accessibility) but never fail a
761
+ project's build. They cover contrast between the roles that meet on screen in every theme,
762
+ the 2 px spacing rhythm, duplicate values within a token family, brand artwork that is
763
+ undescribed, unlicensed, unpreviewed or unused, glyphs off the shared viewBox or with fixed
764
+ colors, and accessibility rules readable from tokens and source (target size, focus, text
765
+ resize, reduced motion, text spacing, image alternatives, keyboard reach, icon-only
766
+ controls). Stale or hand-edited committed brand outputs are errors, since they ship.
767
+
723
768
  Static checks establish the policies and source formats they cover. Behavior
724
769
  tests and browser review verify the resulting accessibility, layout, themes,
725
770
  states, and motion. Both forms of verification support agent-driven iteration.
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,86 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.45
3
+ ## 0.3.46
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **635/635 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `b398b326316893474e4196d87d360f8bf16d6711`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-10-29T21:08:14.889Z (1016 seconds).
6
+ Local verification: **650/650 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `afec4852fe4b50a8fb543dfaa6b22fdd520179e6`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-10-29T23:52:19.077Z (1010 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.45",
14
- "commit": "b398b326316893474e4196d87d360f8bf16d6711",
15
- "sourceSha256": "4e75c6664215068b6fdcb8713ed6b80692b37352a7da1725d609837324f08cf0",
13
+ "version": "0.3.46",
14
+ "commit": "afec4852fe4b50a8fb543dfaa6b22fdd520179e6",
15
+ "sourceSha256": "91033481a35eb5f4ea30f29653b2c160f9cb66e4ccde14ca1c37f2e664d042ad",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 635,
19
- "pass": 635,
18
+ "tests": 650,
19
+ "pass": 650,
20
20
  "fail": 0,
21
21
  "cancelled": 0,
22
22
  "skipped": 0,
23
23
  "node": "v24.13.0",
24
24
  "bun": "1.4.1",
25
- "completedAt": "2026-10-29T21:08:14.889Z",
26
- "durationMs": 1015884,
27
- "logSha256": "eb24fad299567e04233509af761e839939d850d4fc2b2323491dd662f2754945"
25
+ "completedAt": "2026-10-29T23:52:19.077Z",
26
+ "durationMs": 1010063,
27
+ "logSha256": "b212a0e52451a1d9389dc4687aaec08dd6d566df4f6b4ce4f8da63514ab09cae"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - The starter has a token foundation in six groups meeting WCAG 2.2 AA:
33
+ Color (six 12-step ramps redefined for dark, semantic roles aliasing ramp steps,
34
+ success/warning/danger/info sets), Type (16 px body, modular ladder fluid from 3xl,
35
+ leading and tracking per size), Space & sizing (`--space-N` = N × 2 px to 160 px,
36
+ stack and flow gaps, 32/40/48 px controls, icons), Shape & elevation (radius, borders,
37
+ focus, layered shadows, z-layers), Motion (70/110/150/240/400/700 ms, standard/enter/exit
38
+ easing in everyday and strong variants, zero under reduced motion) and Layout (content and container widths, header,
39
+ side pane, rail). The starter's components use the control tokens.
40
+ - `token-contrast` warns when text, accent, status, focus or control-border pairs fall
41
+ below WCAG AA (4.5:1 text, 3:1 UI) in any theme, resolving aliases per theme.
42
+ - `token-rhythm` warns when a numbered spacing step leaves `--space-N` = N × 2 px.
43
+ - `token-overlap-review` compares values within a token family only, so scales meeting
44
+ by design (a radius equal to a spacing step) are no longer reported.
45
+ - `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON with typed
46
+ values, alias references, and other themes and CSS-only values in `$extensions`.
47
+ - Accessibility guards (warnings, with WCAG references; guide `ads://guides/accessibility`):
48
+ `a11y-target-size` (controls under 24 px), `a11y-focus` (`--focus-w` under 2 px, no
49
+ `:focus-visible` in `base.css`), `a11y-text-resize` (px font sizes), `a11y-reduced-motion`
50
+ (durations without a reduced-motion value, infinite component animations without a
51
+ guard), `a11y-text-spacing` (body line height under 1.5, lines over 80ch),
52
+ `a11y-image-alt` (`<img>` without `alt`) and `a11y-keyboard` (clickable non-interactive
53
+ elements, except managed widget children and backdrops).
54
+ - Motion: six durations (`--dur-instant` 70 ms, `--dur-fast`, `--dur-moderate` 150 ms,
55
+ `--dur-normal`, `--dur-slow`, `--dur-slower` 700 ms), all 0 under reduced motion, and `--ease-strong`,
56
+ `--ease-enter-strong` and `--ease-exit-strong` for rare important moments. The ads-motion
57
+ build and review guides map each token to its use and give the easing rules.
58
+ - Themes: `themes` in `ds.config.json` declares named themes with their color scheme (the
59
+ starter: light and dark). A theme applies to the page or one section through
60
+ `[data-theme]`; the starter's roles re-resolve inside themed sections. The showcase theme
61
+ button steps through declared themes; captures take a theme name; previews receive it as
62
+ `adsTheme` in host context; contrast is reviewed per declared theme; `ads tokens --format
63
+ dtcg --theme <name>` exports one theme. New checks: `theme-undeclared` (error),
64
+ `theme-new-token`, `theme-coverage` and `theme-empty` (warnings).
65
+ - Branding guidance for pictograms and illustrations: brand artwork under
66
+ `assets/brand/pictograms/`, 48 px minimum, quarter-size clear space, circle or square
67
+ containers, light/dark pairs, never as UI icons or logos.
68
+ - Icons: the starter has a 24 px glyph set (`assets.glyphs`), `Icon` (sizes `--icon-sm/md/lg/xl`,
69
+ `currentColor`, decorative unless labelled) and `IconButton` (required label, square
70
+ control-height target). New warnings: `a11y-icon-label` (icon-only buttons and links
71
+ without a name), `glyph-viewbox` and `glyph-color`.
72
+ - Color roles for layers, fields and states: `--bg-raised`, `--bg-field`, `--bg-overlay`,
73
+ `--bg-skeleton` and neutral disabled roles; `token-contrast` also checks text on fields and
74
+ raised layers. The starter's Button and TextField use the field and disabled roles.
75
+ - The token contract allows `--container-*` widths and `--grid-*` tokens.
76
+ - Grid: the starter's Layout tokens include a column grid (4/8/16 columns,
77
+ wide/narrow/condensed gutters, margins), and its `components/Layout/Grid` (`Grid`,
78
+ `GridItem` with spans per size) follows its container's width through container queries.
79
+ The showcase header's grid button overlays the project's `--grid-*` columns on every
80
+ preview to check alignment.
81
+
82
+ ## 0.3.45
83
+
32
84
  - `ads create <folder> --framework react|preact` creates a new design-system project
33
85
  from the starter shipped in the same ADS version, so the project always matches
34
86
  the tool that checks it. It names the package (`--name`, default the folder name),
package/docs/GUIDE.md CHANGED
@@ -573,9 +573,9 @@ are collapsible and sorted alphabetically within each layer. Existing flat
573
573
  projects continue to work without moving files. Tokens retain their categories.
574
574
 
575
575
  Token scenarios live beside foundation CSS under the configured token directory.
576
- The starter groups its tokens in `tokens/Color.ads.scenario.tsx` and
577
- `tokens/SpaceTypeMotion.ads.scenario.tsx`, each with its local fixture, for a
578
- project-owned token review renderer. Keep its presentation in development-only `review/`:
576
+ The starter groups its tokens in six scenarios (`tokens/Color`, `Type`, `Space`, `Shape`,
577
+ `Motion`, `Layout`), each with its local fixture, for a project-owned token review
578
+ renderer. Keep its presentation in development-only `review/`:
579
579
 
580
580
  ```tsx
581
581
  import { TokenSamples } from "@ds/review";
@@ -720,6 +720,33 @@ nothing. Commit outputs and the manifest together.
720
720
  `glyphs[name]` with missing root attributes added; `aliases.json` beside them
721
721
  becomes `glyphAliases`. `ads assets` writes it and `ads check` fails when it is stale.
722
722
 
723
+ ### Tokens, grid, icons and accessibility
724
+
725
+ `ads create` starts from a token foundation in six groups (Color, Type, Space &
726
+ sizing, Shape & elevation, Motion, Layout) whose roles meet WCAG 2.2 AA in both themes,
727
+ a container-query `Grid` on the grid tokens, and an icon set with `Icon` and
728
+ `IconButton`. Keep the token names and change values to brand a project.
729
+
730
+ `ads check` reviews, as warnings with locations: contrast per theme (`token-contrast`),
731
+ the 2 px spacing rhythm (`token-rhythm`), duplicates within a token family
732
+ (`token-overlap-review`), accessibility from tokens and source (`a11y-target-size`,
733
+ `a11y-focus`, `a11y-text-resize`, `a11y-reduced-motion`, `a11y-text-spacing`,
734
+ `a11y-image-alt`, `a11y-keyboard`, `a11y-icon-label`) and glyph sets (`glyph-viewbox`,
735
+ `glyph-color`). The showcase's grid button overlays the project's grid on every preview.
736
+ `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools
737
+ (`--theme <name>` for one theme's values).
738
+
739
+ `themes` in `ds.config.json` declares the project's themes: a name and the color scheme
740
+ browsers use for native controls; the first is the default. A theme keeps every token name
741
+ and changes values under `[data-theme="<name>"]`, on `<html>` for the page or on any element
742
+ for one section. The showcase's theme button steps through the declared themes, and
743
+ captures, contrast reviews and the token export take a theme name. `ads check` fails on an
744
+ undeclared theme name (`theme-undeclared`) and warns about a token that exists only in a
745
+ theme (`theme-new-token`), a partly overridden color ramp (`theme-coverage`) and a declared
746
+ theme without values (`theme-empty`).
747
+ See the [token guide](../skills/ads-designer/references/design-data.md) and the
748
+ [accessibility guide](../skills/ads-designer/references/accessibility.md).
749
+
723
750
  Initialized builds run:
724
751
 
725
752
  ```text
@@ -886,6 +913,7 @@ inspection errors fail the check. These guards read files and never delete them.
886
913
  "reviewEntry": "review/index.ts",
887
914
  "stylesEntry": "styles.css",
888
915
  "tokenDir": "tokens",
916
+ "themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
889
917
  "inlineStyleFiles": [],
890
918
  "oxlint": { "plugins": [], "rules": {} }
891
919
  }
package/docs/MCP.md CHANGED
@@ -182,7 +182,8 @@ The website binds to 127.0.0.1 and accepts its own origin only. It serves packag
182
182
  client assets and MCP, with no arbitrary file reader or command launcher.
183
183
  Shutdown closes both transports, subscriptions and the managed compiler.
184
184
 
185
- The shell is minimal: header, section tabs, collapsible left menu, theme switch,
185
+ The shell is minimal: header, section tabs, collapsible left menu, a theme button that
186
+ steps through the project's declared themes (`ads_status.themes`),
186
187
  status/diagnostics when needed, and the App slot. Its MCP client does discovery,
187
188
  tool calls, resource forwarding and notification handling. Token categories come
188
189
  from `ads_tokens.categories` (discovered token scenarios); all four sections also
@@ -330,7 +331,9 @@ open one of its returned preview IDs with `ads_show_scenario`. Results link to
330
331
  the owning source and guides; `ads_scenarios` lists available previews.
331
332
 
332
333
  `ads_tokens` inspects definitions and values. `ads_show_tokens` renders the
333
- project's token scenarios. If the client cannot render Apps, use the returned
334
+ project's token scenarios. `ads_scenarios` also lists brand previews (`kind: "brand"`,
335
+ scenarios in `brand/`), which open with `ads_show_scenario` and lead the showcase. For
336
+ design tools, the CLI's `ads tokens --format dtcg` exports W3C Design Tokens JSON. If the client cannot render Apps, use the returned
334
337
  showcase URL. Build reports identify current, stale and failed output; browser
335
338
  review and project checks still verify behavior.
336
339
 
@@ -411,7 +414,10 @@ ownership, valid initial values, browser checks and examples.
411
414
  ### Screenshots and candidate comparison
412
415
 
413
416
  `ads_capture({scenario:"<discovered ID>",target?,theme?,viewport?})` renders current
414
- source in the real sandboxed App using project-local Playwright/browser. It returns
417
+ source in the real sandboxed App using project-local Playwright/browser. `theme` is a declared
418
+ theme name (default: the first). Previews receive the theme in host context: `theme` carries
419
+ the MCP Apps light/dark scheme and `adsTheme` the project theme name; hosts that send only
420
+ `theme` get the first declared theme with that scheme. It returns
415
421
  PNG resource URIs and revision/settings metadata. The default is the full widget
416
422
  viewport; optional `captureTargets` metadata names an element within the scenario.
417
423
  Token/component/pattern/composition scenarios share this path. The tool adds no
@@ -551,7 +557,10 @@ themes and token scenarios/fixtures, whose coverage spans shared source files.
551
557
  Preview IDs remain separate: several token previews belong to `tokens`.
552
558
  Design tokens and token previews belong to the shared Data foundation. Component
553
559
  contracts do not register token namespaces or independent value sheets. Read
554
- `ads://guides/tokens` for state mappings, source checks and overlap advisories.
560
+ `ads://guides/tokens` for state mappings, color roles, the grid, contrast/rhythm/overlap
561
+ reviews and the token export; `ads://guides/branding` for brand artwork, web icons,
562
+ committed targets and glyph sets; `ads://guides/accessibility` for the WCAG 2.2 AA
563
+ guards (`token-contrast`, `a11y-*`) and the practice no tool can check.
555
564
 
556
565
  The `tokens` manifest also returns `companionFiles` with the configured foundation
557
566
  entry path. When creating or deleting a canonical token foundation file, include
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.45",
3
+ "version": "0.3.46",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {
@@ -1,36 +0,0 @@
1
- export const fixture = {
2
- "title": "Space, type & motion",
3
- "text": "Aa",
4
- samples: [
5
- {"token": "--border-w", "property": "width", "probe": "13.375px"},
6
- {"token": "--dur-fast", "property": "animation-duration", "probe": "0.375s"},
7
- {"token": "--dur-normal", "property": "animation-duration", "probe": "0.375s"},
8
- {"token": "--ease-standard", "property": "animation-timing-function", "probe": "cubic-bezier(.13,.27,.61,.83)"},
9
- {"token": "--focus-offset", "property": "width", "probe": "13.375px"},
10
- {"token": "--focus-w", "property": "width", "probe": "13.375px"},
11
- {"token": "--font-mono", "property": "font-family", "probe": "monospace, serif"},
12
- {"token": "--font-sans", "property": "font-family", "probe": "monospace, serif"},
13
- {"token": "--leading-normal", "property": "line-height", "probe": "2.375"},
14
- {"token": "--leading-tight", "property": "line-height", "probe": "2.375"},
15
- {"token": "--radius-lg", "property": "border-radius", "probe": "13.375px"},
16
- {"token": "--radius-md", "property": "border-radius", "probe": "13.375px"},
17
- {"token": "--radius-sm", "property": "border-radius", "probe": "13.375px"},
18
- {"token": "--shadow-raised", "property": "box-shadow", "probe": "1px 3px 5px rgb(31, 97, 163)"},
19
- {"token": "--shadow-xs", "property": "box-shadow", "probe": "1px 3px 5px rgb(31, 97, 163)"},
20
- {"token": "--space-0", "property": "width", "probe": "13.375px"},
21
- {"token": "--space-12", "property": "width", "probe": "13.375px"},
22
- {"token": "--space-16", "property": "width", "probe": "13.375px"},
23
- {"token": "--space-2", "property": "width", "probe": "13.375px"},
24
- {"token": "--space-4", "property": "width", "probe": "13.375px"},
25
- {"token": "--space-6", "property": "width", "probe": "13.375px"},
26
- {"token": "--space-8", "property": "width", "probe": "13.375px"},
27
- {"token": "--text-base", "property": "font-size", "probe": "41.375px"},
28
- {"token": "--text-lg", "property": "font-size", "probe": "41.375px"},
29
- {"token": "--text-sm", "property": "font-size", "probe": "41.375px"},
30
- {"token": "--text-xl", "property": "font-size", "probe": "41.375px"},
31
- {"token": "--weight-medium", "property": "font-weight", "probe": "327"},
32
- {"token": "--weight-normal", "property": "font-weight", "probe": "327"},
33
- {"token": "--weight-semibold", "property": "font-weight", "probe": "327"},
34
- {"token": "--z-overlay", "property": "z-index", "probe": "367"},
35
- ]
36
- } as const;