@reqvire-org/ads 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +11 -2
  2. package/dist/a11y.mjs +71 -65
  3. package/dist/analysis/helpers.mjs +5 -3
  4. package/dist/analysis/inputs.mjs +13 -6
  5. package/dist/analysis/module-resolvers.mjs +46 -0
  6. package/dist/analysis/service.mjs +7 -0
  7. package/dist/analysis/syntax.mjs +20 -5
  8. package/dist/assets.mjs +1 -1
  9. package/dist/boundaries.mjs +6 -4
  10. package/dist/bun-compiler.mjs +6 -5
  11. package/dist/check-service.mjs +8 -5
  12. package/dist/check.mjs +11 -46
  13. package/dist/component-contrast.mjs +126 -8
  14. package/dist/contrast-composition.mjs +80 -0
  15. package/dist/contrast-styles.mjs +88 -0
  16. package/dist/finding-rules.mjs +2 -0
  17. package/dist/font-rules.mjs +20 -15
  18. package/dist/fonts-generated.mjs +21 -14
  19. package/dist/foundation-views.mjs +6 -2
  20. package/dist/image-attributes.mjs +96 -92
  21. package/dist/mcp/build-status.mjs +8 -3
  22. package/dist/mcp/drafts.mjs +12 -5
  23. package/dist/mcp/mutations.mjs +11 -8
  24. package/dist/mcp/preview-widget.bundle.js +45 -45
  25. package/dist/mcp/resource-loader.js +1 -201
  26. package/dist/mcp/server.mjs +19 -5
  27. package/dist/pictogram-model.mjs +59 -0
  28. package/dist/pictograms.mjs +52 -0
  29. package/dist/preview-bun.mjs +76 -60
  30. package/dist/preview-incremental.mjs +358 -0
  31. package/dist/preview-manifest-update.mjs +70 -0
  32. package/dist/preview-resources.mjs +33 -1
  33. package/dist/render-audit/image-shape.mjs +13 -3
  34. package/dist/render-audit/pictograms.mjs +88 -0
  35. package/dist/render-audit/worker.mjs +12 -0
  36. package/dist/render-audit.mjs +11 -1
  37. package/dist/render-composition.mjs +186 -0
  38. package/dist/scenario-registry.mjs +2 -2
  39. package/dist/scenarios-compiler.mjs +1 -1
  40. package/dist/showcase/client.bundle.js +23 -23
  41. package/dist/showcase/draft-navigation.js +5 -5
  42. package/dist/showcase/foundation-view.css +3 -0
  43. package/dist/showcase/foundation-view.mjs +3 -0
  44. package/dist/showcase/pictogram-view.mjs +53 -0
  45. package/dist/showcase/ui/ui.js +2 -0
  46. package/dist/skills/README.md +1 -1
  47. package/dist/skills/ads-designer/SKILL.md +18 -2
  48. package/dist/skills/ads-designer/references/accessibility.md +70 -2
  49. package/dist/skills/ads-designer/references/branding.md +5 -16
  50. package/dist/skills/ads-designer/references/performance.md +3 -2
  51. package/dist/skills/ads-designer/references/pictograms.md +131 -0
  52. package/dist/skills/ads-designer/references/runtimes.md +15 -0
  53. package/dist/skills/ads-import/references/runtimes.md +15 -0
  54. package/dist/skills/ads-migrate/SKILL.md +2 -1
  55. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +2 -3
  56. package/dist/skills/ads-migrate/references/0.4.3-to-0.4.4.md +80 -0
  57. package/dist/skills/ads-port/SKILL.md +4 -1
  58. package/dist/skills/ads-port/references/runtimes.md +15 -0
  59. package/dist/source-values.mjs +4 -1
  60. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
  61. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
  62. package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
  63. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
  64. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
  65. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
  66. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
  67. package/dist/style-token-rules.mjs +51 -0
  68. package/dist/task-cache.mjs +2 -2
  69. package/dist/units.mjs +4 -4
  70. package/dist/validation-inputs.mjs +7 -3
  71. package/docs/ADS.md +6 -1
  72. package/docs/ARCHITECTURE.md +144 -16
  73. package/docs/CACHING.md +65 -1
  74. package/docs/CHANGELOG.md +86 -50
  75. package/docs/GUIDE.md +52 -7
  76. package/docs/MCP.md +47 -16
  77. package/docs/benchmarks/README.md +1 -1
  78. package/package.json +7 -4
@@ -10,7 +10,7 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
10
10
  const existing = entries.get(item.id);
11
11
  entries.set(item.id, { ...existing, ...item, kind: "tokens", drafts: existing?.drafts ?? [] });
12
12
  }
13
- const owns = (unit, item) => unit === "tokens" && item.kind === "tokens" || (item.unit ? item.unit === unit : ownsScenario(unit, item.id));
13
+ const owns = (unit, item) => unit === "assets/pictograms" && item.kind === "pictograms" || unit === "tokens" && item.kind === "tokens" || (item.unit ? item.unit === unit : ownsScenario(unit, item.id));
14
14
  const attach = (entry, draft) => {
15
15
  if (!entry.drafts.some(item => item.id === draft.id)) entry.drafts.push(references.get(draft.id));
16
16
  };
@@ -30,8 +30,8 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
30
30
  }
31
31
  for (const draft of drafts) {
32
32
  for (const unit of draft.units) {
33
- const kind = unit.split("/")[0];
34
- if (!["brand", "tokens", "components", "patterns", "composition"].includes(kind)) continue;
33
+ const kind = unit === "assets/pictograms" ? "pictograms" : unit.split("/")[0];
34
+ if (!["brand", "pictograms", "tokens", "components", "patterns", "composition"].includes(kind)) continue;
35
35
  const owned = [...entries.values()].filter(item => owns(unit, item));
36
36
  if (owned.length) for (const item of owned) attach(item, draft);
37
37
  else entries.set(unit, { id: unit, unit, title: unit.split("/").at(-1), kind, draftOnly: true, pendingDraftScenario: true, drafts: [references.get(draft.id)] });
@@ -40,8 +40,8 @@ export function withDraftEntries(scenarios, categories, drafts, previews = new M
40
40
  return { scenarios: [...entries.values()], categories: [...entries.values()].filter(item => item.kind === "tokens") };
41
41
  }
42
42
 
43
- const draftCategory = unit => unit === "assets/glyphs" || unit === "assets/logos" ? "icons" : unit === "assets/brand" ? "brand" : unit === "foundation" ? "tokens" : ["brand","tokens","icons","components","patterns","composition"].includes(unit.split("/")[0]) ? unit.split("/")[0] : "other";
44
- export const draftCategoryLabels = {brand:"Brand",icons:"Icons",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};
43
+ const draftCategory = unit => unit === "assets/pictograms" ? "pictograms" : unit === "assets/glyphs" || unit === "assets/logos" ? "icons" : unit === "assets/brand" ? "brand" : unit === "foundation" ? "tokens" : ["brand","tokens","icons","components","patterns","composition"].includes(unit.split("/")[0]) ? unit.split("/")[0] : "other";
44
+ export const draftCategoryLabels = {brand:"Brand",icons:"Icons",pictograms:"Pictograms",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};
45
45
  /** Every active proposal remains visible, even before it has a previewable scenario. */
46
46
  export function draftNavigationEntries(scenarios, drafts) {
47
47
  const result=[];
@@ -9,6 +9,9 @@
9
9
  @keyframes ads-token-travel{to{left:calc(100% - 16px)}}
10
10
  @media(prefers-reduced-motion:reduce){.ads-token-motion{animation:none!important;transition:none!important}}
11
11
  .ads-brand-clean{display:flex;max-width:100%}.ads-brand-master{display:block;height:96px;width:auto;max-width:100%;object-fit:contain}
12
+ .ads-pictogram-image{display:block;width:auto;max-width:none;object-fit:contain}
13
+ .ads-pictogram-stage{display:table;position:relative}
14
+ [data-pictogram] [data-slot="artwork"],[data-pictogram] [data-slot="construction"],[data-pictogram] [data-slot="sizes"]{overflow:auto}
12
15
  .ads-brand-inspection{margin:0;min-width:0;max-width:100%;text-align:start}
13
16
  .ads-brand-stage{position:relative;max-width:100%;width:128px;margin:0}
14
17
  .ads-brand-art{display:block;width:100%;height:auto;max-height:none}
@@ -2,6 +2,7 @@ import { createPreviewRoot } from "./preview-frame.ads.review.mjs";
2
2
  import { specimenPage, specimenSection, specimenList, tokenRecord, brandSpecimen, artworkGrid } from "./ui/ui.js";
3
3
  import "./ui/ui.css";
4
4
  import "./foundation-view.css";
5
+ import { mountPictogram } from "./pictogram-view.mjs";
5
6
 
6
7
  /** Framework-independent, tool-owned foundation presentation. */
7
8
  export function mountFoundation(container, data) {
@@ -17,6 +18,7 @@ export function mountFoundation(container, data) {
17
18
  const page=specimenPage({title:data.title,onSearch:data.tokens?query=>{const normalized=query.trim().toLowerCase();for(const record of root.querySelectorAll(".ux-token-record"))record.hidden=!record.textContent.toLowerCase().includes(normalized);}:undefined,description:data.tokens?.some(token=>/^(animation|transition)-/.test(token.property??""))?"Duration previews play at ⅛ speed. Easing previews use a one-second travel. Reduced-motion preferences are respected.":undefined});
18
19
  const content=page.querySelector('[data-slot="content"]');
19
20
  root.append(page);
21
+ const updatePictogram = data.pictogram ? mountPictogram(content, data.pictogram) : null;
20
22
  const addSection=(title,children)=>{const section=specimenSection({title});section.querySelector('[data-slot="content"]').append(...children);content.append(section);};
21
23
  const readouts = [], measurements = [];
22
24
  const unitBars=[], roleValues=[];
@@ -217,6 +219,7 @@ export function mountFoundation(container, data) {
217
219
  cancelAnimationFrame(pending);
218
220
  pending = requestAnimationFrame(() => {
219
221
  const style = doc.defaultView.getComputedStyle(root);
222
+ updatePictogram?.(root.closest("[data-theme]")?.getAttribute("data-theme"));
220
223
  for (const [node, name] of readouts) node.textContent = style.getPropertyValue(name).trim() || "Not defined in this context";
221
224
  for(const {measure,sample,scale} of measurements){
222
225
  const pixels=parseFloat(doc.defaultView.getComputedStyle(measure).width)||0;
@@ -0,0 +1,53 @@
1
+ import { specimenList, brandSpecimen, artworkGrid } from "./ui/ui.js";
2
+
3
+ /** A separate gallery category reusing the showcase's artwork-card components. */
4
+ export function mountPictogram(content, item) {
5
+ const doc = content.ownerDocument;
6
+ const node = (tag, className, text) => {
7
+ const result = doc.createElement(tag);
8
+ result.className = className;
9
+ if (text !== undefined) result.textContent = text;
10
+ return result;
11
+ };
12
+ const list = specimenList({ kind: "brand" }), card = brandSpecimen({ name: item.title });
13
+ card.dataset.pictogram = item.id;
14
+ const images = [], notes = node("p", "ads-foundation-note", `${item.description} · ${item.license}`);
15
+ const image = height => {
16
+ const img = node("img", "ads-pictogram-image");
17
+ img.alt = "";
18
+ img.height = height;
19
+ img.dataset.adsPictogram = item.id;
20
+ images.push(img);
21
+ return img;
22
+ };
23
+ const master = image(Math.max(96, item.minHeight));
24
+ master.alt = item.title;
25
+ const artwork = card.querySelector('[data-slot="artwork"]');
26
+ artwork.append(master, notes);
27
+ const stage = node("div", "ads-pictogram-stage"), construction = image(Math.max(128, item.minHeight));
28
+ stage.append(construction);
29
+ const caption = node("p", "ads-foundation-note");
30
+ card.querySelector('[data-slot="construction"]').append(stage, caption);
31
+ const sizes = node("div", "ads-brand-sizes");
32
+ for (const height of new Set([item.minHeight, Math.max(64, item.minHeight), Math.max(96, item.minHeight)])) {
33
+ const figure = node("figure", "");
34
+ figure.append(image(height), node("figcaption", "", `${height}px high`));
35
+ sizes.append(figure);
36
+ }
37
+ card.querySelector('[data-slot="sizes"]').append(node("p", "ads-foundation-note", `Actual sizes · minimum ${item.minHeight}px high`), sizes);
38
+ list.append(card);
39
+ content.append(list);
40
+ let previous;
41
+ return theme => {
42
+ const name = item.variants[theme] ?? Object.values(item.variants)[0], asset = item.assets[name];
43
+ if (!asset || previous === asset) return;
44
+ previous = asset;
45
+ for (const img of images) {
46
+ img.src = asset.src;
47
+ img.width = img.height * asset.geometry.width / asset.geometry.height;
48
+ }
49
+ stage.querySelector(".ds-artwork-grid")?.remove();
50
+ stage.append(artworkGrid({ box: asset.geometry, preserveAspectRatio: asset.geometry.preserveAspectRatio, unit: "source units", axes: false, overlay: true }));
51
+ caption.textContent = `${name} · ${asset.geometry.width} × ${asset.geometry.height} source units`;
52
+ };
53
+ }
@@ -376,6 +376,7 @@ const glyphs = {
376
376
  "moon": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg>',
377
377
  "patterns": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>',
378
378
  "phone": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg>',
379
+ "pictograms": '<svg fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="1.5" y="2.5" width="13" height="11" rx="1"/><circle cx="5" cy="6" r="1"/><path d="m2 12 4-3 3 2 3-4 2 2"/></svg>',
379
380
  "source": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 4-4 4 4 4m6-8 4 4-4 4M9 2 7 14"/></svg>',
380
381
  "split": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>',
381
382
  "sun": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/></svg>',
@@ -977,6 +978,7 @@ function Workspace({ title = "Design system", loading = false, section: section2
977
978
  sections: u$1(M, { children: [
978
979
  /* @__PURE__ */ u$1(ToolbarButton, { label: "Brand", section: "brand", current: section2 === "brand", children: /* @__PURE__ */ u$1(Icon, { name: "brand" }) }),
979
980
  /* @__PURE__ */ u$1(ToolbarButton, { label: "Icons", section: "icons", current: section2 === "icons", children: /* @__PURE__ */ u$1(Icon, { name: "icons" }) }),
981
+ /* @__PURE__ */ u$1(ToolbarButton, { label: "Pictograms", section: "pictograms", current: section2 === "pictograms", children: /* @__PURE__ */ u$1(Icon, { name: "pictograms" }) }),
980
982
  /* @__PURE__ */ u$1(ToolbarButton, { label: "Tokens", section: "tokens", current: section2 === "tokens", children: /* @__PURE__ */ u$1(Icon, { name: "tokens" }) }),
981
983
  /* @__PURE__ */ u$1(ToolbarButton, { label: "Components", section: "components", current: section2 === "components", children: /* @__PURE__ */ u$1(Icon, { name: "components" }) }),
982
984
  /* @__PURE__ */ u$1(ToolbarButton, { label: "Patterns", section: "patterns", current: section2 === "patterns", children: /* @__PURE__ */ u$1(Icon, { name: "patterns" }) }),
@@ -48,7 +48,7 @@ the browser, and provides a running URL or exact command for review. See the
48
48
  | [ads-designer](ads-designer/SKILL.md) | Bootstrap or build UI using the local ADS, with layout, motion, stress-testing and craft/mobile guidance | `$ads-designer build a settings page using this project's ADS`, `$ads-designer stress-test AppShell +fix`, `$ads-designer review Toast motion` |
49
49
  | [ads-import](ads-import/SKILL.md) | Check destination compatibility, then integrate selected ADS source, artwork or theme values | `$ads-import /path/to/source-repo component Toast` |
50
50
  | [ads-port](ads-port/SKILL.md) | Port library capabilities into a coherent ADS using shared tokens and primitives | `$ads-port https://github.com/emilkowalski/sonner` |
51
- | [ads-migrate](ads-migrate/SKILL.md) | Upgrade an existing design system between ADS versions using version-specific migration guides | `$ads-migrate upgrade this project from ADS 0.4.1 to 0.4.2` |
51
+ | [ads-migrate](ads-migrate/SKILL.md) | Upgrade an existing design system between ADS versions using version-specific migration guides | `$ads-migrate upgrade this project from ADS 0.4.3 to 0.4.4` |
52
52
 
53
53
  For token values, use `$ads-import /path/to/source-repo tokens`; for original
54
54
  artwork and its guidance, use `$ads-import /path/to/source-repo brand`. ADS token
@@ -330,6 +330,14 @@ prove visual alignment. Use its opt-in `@ads-lockup` construction to guard an ow
330
330
  artwork/text pairing: declare the size token and direct artwork/text hooks, keep
331
331
  text runs in spans, and fix `lockup-construction` errors at that declaration.
332
332
 
333
+ ## Pictograms
334
+
335
+ Keep illustrative pictograms separate from brand identity and small UI icons.
336
+ Read [pictograms.md](references/pictograms.md) (`ads://guides/pictograms`) before
337
+ adding them. It covers `assets/pictograms/catalog.ads.json`, fixed-color/gradient
338
+ artwork, theme variants, the dedicated gallery and source/render guards. Preserve
339
+ artistic freedom; do not apply glyph recoloring or brand-lockup sizing to them.
340
+
333
341
  ## Layout
334
342
 
335
343
  Write layout geometry (columns, placement, gutters, margins, rows, regions and panels) with
@@ -368,7 +376,11 @@ Target WCAG 2.2 AA. `ads check` fails on contrast in every theme and brand, targ
368
376
  focus, text resize, reduced motion, text spacing, image alternatives and icon-only controls
369
377
  (`a11y-*`, `token-contrast` and `component-contrast`), and lists keyboard reach for review
370
378
  (`a11y-keyboard`); `ads audit` adds axe-core and non-text contrast in the browser. Read [accessibility.md](references/accessibility.md)
371
- (`ads://guides/accessibility`) for the rules and the practice no tool can check.
379
+ (`ads://guides/accessibility`) for the rules and the practice no tool can check. When a
380
+ required color (a brand or reference color) cannot reach contrast with its text, follow its
381
+ "When a required color cannot reach contrast" options: other text color, WCAG's 3:1
382
+ large-text minimum (size declared in the block that pairs the colors), or the nearest passing
383
+ color, presented with ratios when the color is a stakeholder's decision.
372
384
 
373
385
  ## Design craft and mobile behavior
374
386
 
@@ -422,7 +434,11 @@ installed `ads showcase` or the project's `dev:showcase` script. Do not launch a
422
434
  second runtime/compiler for the same connected project. ADS's managed Bun
423
435
  preview compiler publishes a shared graph on first demand and after source
424
436
  changes. The built-in client refreshes discovery and the active scenario in the
425
- same App after a successful build. Shared runtime, foundation CSS, fonts and
437
+ same App; compatible watched edits preserve state and focus. Incompatible edits
438
+ or rollback can reset the frame. Compiled feedback can appear before checks pass:
439
+ use current verified output for captures and acceptance. See
440
+ [runtime guidance](references/runtimes.md) for updates and upgrade behavior.
441
+ Shared runtime, foundation CSS, fonts and
426
442
  selected scenario modules load through MCP
427
443
  resources inside the sandboxed App. Never inject project styles/runtime into
428
444
  the outer host. Keep the declared framework and its native mount/unmount adapter
@@ -11,7 +11,7 @@ Each message names its WCAG criterion.
11
11
  | Rule | What it reviews | WCAG |
12
12
  |---|---|---|
13
13
  | `token-contrast` | Text, link, accent and status text on their backgrounds (4.5:1); focus and control borders on canvas and surface (3:1); in every theme and brand, for any CSS color syntax, with translucent colors composited over their background and the canvas. A pair color that cannot be resolved statically (`currentColor`, relative color syntax) is a `token-contrast-unresolved` info item | 1.4.3, 1.4.11 |
14
- | `component-contrast` | A component or pattern style block (top level, a nested state such as `&:hover` or `&[aria-selected="true"]`, or an at-rule) that sets both `color: var(--a)` and `background`/`background-color: var(--b)` needs 4.5:1 in every theme and brand, resolved like `token-contrast`. Local custom properties in the block resolve one level, and an undeclared one reads its `var()` fallback. Disabled states are exempt; `currentColor`, `transparent`, transparent backgrounds, one token on both sides and native progress, meter and range parts are skipped; a side that names no color token, or text matching the canvas over a translucent background, is a `component-contrast-unresolved` info item | 1.4.3 |
14
+ | `component-contrast` | A component or pattern style block (top level, a nested state such as `&:hover` or `&[aria-selected="true"]`, or an at-rule) that sets both `color: var(--a)` and `background`/`background-color: var(--b)` needs 4.5:1 in every theme and brand, resolved like `token-contrast`; large text needs 3:1 where the block or an enclosing block declares `font-size` of at least 24px, or 18.66px at `font-weight` 700+ (`px`, `pt` or `rem`, literal or token; `em`, `%` and `calc()` keep 4.5:1). Local custom properties in the block resolve one level, and an undeclared one reads its `var()` fallback. Disabled states are exempt; `currentColor`, `transparent`, transparent backgrounds, one token on both sides and native progress, meter and range parts are skipped; a side that names no color token, or text matching the canvas over a translucent background, is a `component-contrast-unresolved` info item | 1.4.3 |
15
15
  | `a11y-target-size` | `--control-height-*` of at least 24 px (44 px where touch is common) | 2.5.8 |
16
16
  | `a11y-focus` | `--focus-w` of at least 2 px, and a `:focus-visible` indicator in `base.css` | 2.4.7, 2.4.13 |
17
17
  | `a11y-text-resize` | Font-size tokens in `rem`, so text follows the reader's browser font size | 1.4.4 |
@@ -26,6 +26,73 @@ attribute, or move the interaction to a native control. Do not silence it with a
26
26
  value. Fix `component-contrast` with the role contract: `--x-text` on `--x-bg`, `--x-fg` on
27
27
  `--x`; never a status color (`--success`) as text on its own tint (`--success-bg`).
28
28
 
29
+ The declaration-only exemptions above do not exempt a source-proven text node; the
30
+ composition check below can establish that matching foreground/background tokens hide text.
31
+
32
+ ### Text on a background owned elsewhere
33
+
34
+ Use semantic text and surface tokens where they are owned; do not add a background to a
35
+ link merely to make it visible to the checker. ADS follows source-resolvable owned JSX,
36
+ component calls and forwarded children, so this pairing is checked without registration:
37
+
38
+ ```tsx
39
+ // Menu surface, owned by its panel component:
40
+ const surface = css`background: var(--bg-menu);`;
41
+ // Text, owned by a separate link component:
42
+ const link = css`color: var(--text-product);`;
43
+ // The composition supplies the relationship:
44
+ <MenuPanel><ProductLink>All new features</ProductLink></MenuPanel>
45
+ ```
46
+
47
+ A proved failing pair is a `component-contrast` error and blocks acceptance. Diagnostics
48
+ name the text token and the background source. Transparent wrappers do not hide an
49
+ ancestor background; a text node using the same token as its backdrop is still a failure.
50
+ No explicit pair contract is required. Keep decorative brand colors separate from text
51
+ roles when their contrast is insufficient.
52
+ String/number text props are covered, as are literal hooks with no captured paint selector
53
+ targeting them and optional classes whose alternatives have identical paint/visibility.
54
+ For example, an optional card class that only changes padding does not hide the card's
55
+ background from the contrast check.
56
+
57
+ The composition check deliberately leaves unknown prop spreads, differing paint branches,
58
+ competing/conditional/descendant paint styles, unresolved class values, gradients, opacity, filters,
59
+ transforms, text shadows, dynamic visibility and missing backdrops
60
+ unverified (`component-contrast-unresolved`). Keep legitimate component APIs; do not
61
+ flatten them or add paint to satisfy the checker. Audit the actual composed scenario,
62
+ including hover/focus and every theme/brand. A static success with an unresolved finding
63
+ is not proof that rendered contrast passes.
64
+
65
+ ### When a required color cannot reach contrast
66
+
67
+ A brand or reference color (a live site's button blue, a product color) can fail with the
68
+ text it must carry: white on a light, saturated blue is often near 2.4:1. Do not ship it
69
+ failing, and do not hide it: no one-off value, `text-shadow`, opacity, gradient under the
70
+ text or disabled check. Work through these options, measure each candidate's ratio, and
71
+ when the color is a stakeholder's decision (a port that must match a reference), present
72
+ the candidates with their ratios and let them choose.
73
+
74
+ 1. **Change the text, not the color.** Dark text may pass on the original color where
75
+ white cannot. Add a `--x-fg`/`--text-on-x` role for it.
76
+ 2. **Large text.** WCAG and `component-contrast` need only 3:1 for large text: `font-size`
77
+ of at least 24px, or at least 18.66px at `font-weight` 700+, in `px`, `pt` or `rem`
78
+ (literal or token). Declare the size **in the same style block that pairs the colors**
79
+ (or an enclosing block) for a declaration-only pair. The composition check can also
80
+ resolve sizes inherited through owned DOM and nonconflicting classes. `em`, `%`
81
+ or `calc()` sizes keep 4.5:1. This fits prominent calls to action and headings, and
82
+ keeps a much brighter color (white on about `#0095dd` instead of `#0079d0`). Everything
83
+ with smaller text on that color still needs 4.5:1, so keep a separate passing token for it.
84
+ 3. **Derive the nearest passing color**, as a token with the source color in a comment.
85
+ Lower lightness in small steps, keeping hue and saturation, until the pair passes. For
86
+ white text the background's relative luminance is capped near 0.18, so light
87
+ colors lose most of their brightness. If the result turns dull (cyan, teal, green, orange
88
+ and yellow go muddy when darkened), turn the hue a few degrees toward blue or purple,
89
+ which reach the same luminance at higher brightness and saturation, and stop at the
90
+ smallest shift that still looks like the original. Use the one token wherever that
91
+ color carries normal-size text, so the system has one passing variant, not several.
92
+
93
+ `token-contrast` role pairs (`--text-body` on `--bg-canvas`, `--x-text` on `--x-bg`) carry
94
+ no font size and always need 4.5:1; option 2 applies to component pairs only.
95
+
29
96
  ## Render audit (axe-core and non-text contrast)
30
97
 
31
98
  Run `ads audit` after changing a component, pattern or composition scenario. It renders
@@ -48,7 +115,8 @@ design-system/components/Broken.ads.scenario.tsx:1:1 [error:a11y-axe] axe button
48
115
  - Fix the finding in the component that renders the failing element, not in the scenario.
49
116
  - A `color-contrast` finding that `token-contrast` or `component-contrast` also reports is a
50
117
  token pair: change the ramp step or use the role pair. One only the audit reports comes
51
- from inherited colors: set `color` beside the `background` it sits on, using a role pair.
118
+ from a cascade or rendered state source analysis could not prove. Fix the text/surface
119
+ token in its real owner and verify the composed scenario; do not duplicate backgrounds.
52
120
  - `a11y-non-text-contrast` errors cover enabled, visible buttons, inputs, selects,
53
121
  textareas, links and `switch`/`checkbox`/`radio`/`slider`/`tab` roles. A control whose
54
122
  background has less than 3:1 against its surroundings and that has a visible border needs
@@ -137,21 +137,10 @@ is what the brand provides.
137
137
 
138
138
  ## Pictograms and illustrations
139
139
 
140
- Pictograms are illustrations for empty states, onboarding and marketing surfaces, not UI
141
- icons: never use one as an icon, a logo or a header lockup, and never use a UI glyph as an
142
- illustration. Keep them as brand artwork in `assets/brand/pictograms/`, so the brand
143
- checks (README, license, use) cover them and the Brand view shows them under their relative
144
- names (`pictograms/<name>.svg`).
145
-
146
- - Show them at 48 px or larger, at their original proportions; never crop or stretch them.
147
- - Keep clear space of at least a quarter of their size on every side, with or without a
148
- container. Containers are a circle or a square only, with the pictogram optically
149
- centered.
150
- - Pair light and dark versions as `<name>.svg` and `<name>.dark.svg`, and show the one that
151
- matches the background: light artwork on light surfaces, dark on dark. Avoid mid-tone
152
- backgrounds and gradients behind them.
153
- - A pictogram that carries meaning needs a text alternative; one that repeats nearby text is
154
- decorative (`alt=""`).
140
+ Illustrative pictograms belong in `assets/pictograms/` with `catalog.ads.json` and
141
+ have their own **Pictograms** gallery. Read [pictograms.md](pictograms.md) for theme
142
+ variants, artistic freedom and the source/render guards. They are separate from
143
+ brand identity and small UI glyphs. Existing artwork is not moved automatically.
155
144
 
156
145
  ## Web icons
157
146
 
@@ -249,4 +238,4 @@ ADS generates nothing from `assets/logos/` and does not treat its files as brand
249
238
  artwork or glyphs: the brand checks (`brand-readme`, `brand-license`,
250
239
  `brand-unused`), `assets.iconSource` and `assets.targets` cover only
251
240
  `assets/brand/`, and the glyph checks cover only `assets.glyphs.source`. Keep the
252
- project's own colored artwork, including its pictograms, in `assets/brand/`.
241
+ project's own identity artwork in `assets/brand/`, and catalogued illustrative pictograms in `assets/pictograms/`.
@@ -40,8 +40,9 @@ Suggestions for large content images:
40
40
  network panel. The file should be the smallest candidate at least as wide as the image at that
41
41
  device's pixel ratio.
42
42
 
43
- `img-shape` (`ads audit`) fails a visible image whose box differs from its CSS `aspect-ratio`, or,
44
- with none and `object-fit: fill`, from its `width` and `height`. `aspect-ratio` with both attributes
43
+ `img-shape` (`ads audit`) compares the untransformed CSS sizing box with an explicit `aspect-ratio`
44
+ (respecting `box-sizing`), or, with none and `object-fit: fill`, the content box with the declared
45
+ `width` and `height`. Borders and padding are excluded from the attribute comparison. `aspect-ratio` with both attributes
45
46
  needs `height: auto`, or the height attribute wins and the image crops: it still reserves its space
46
47
  and passes `layout-shift`. A deliberate crop sets `object-fit` in a box of its own, with no
47
48
  `aspect-ratio`.
@@ -0,0 +1,131 @@
1
+ # Pictograms
2
+
3
+ Pictograms are illustrative artwork for empty states, onboarding, explanations and
4
+ other expressive surfaces. They have a separate **Pictograms** showcase section.
5
+ UI glyphs belong in `assets/glyphs/`; product identity belongs in `assets/brand/`;
6
+ third-party logos belong in `assets/logos/`. A pictogram is not a substitute for a
7
+ small control icon. Photos and other raster images retain the ordinary image workflow.
8
+
9
+ ## Register artwork
10
+
11
+ Put SVG artwork and `catalog.ads.json` under `assets/pictograms/`:
12
+
13
+ ```json
14
+ {
15
+ "schemaVersion": 1,
16
+ "pictograms": [{
17
+ "id": "journey",
18
+ "title": "Journey",
19
+ "description": "A route connecting destinations; onboarding and empty journeys.",
20
+ "license": "Original project artwork, MIT",
21
+ "schemes": { "light": "journey.svg", "dark": "journey.dark.svg" },
22
+ "minHeight": 48
23
+ }]
24
+ }
25
+ ```
26
+
27
+ Names are stable ids (letters, numbers, underscores and hyphens). Source paths are
28
+ relative to `assets/pictograms/`; subfolders are allowed, parent traversal is not.
29
+ Each entry requires `title`, `description` (intended use/backgrounds) and `license`
30
+ (ownership or license/credit). This metadata describes artwork; it contains no code.
31
+
32
+ Use `source: "journey.svg"` when one artwork deliberately works in every theme.
33
+ Use `schemes` for light/dark variants and `themes` for exact configured theme names,
34
+ for example `"themes": { "high-contrast": "journey.contrast.svg" }`. Resolution is
35
+ **exact theme → theme's scheme → shared source**. Every configured theme must resolve.
36
+ Theme names are independent of brand names. There is no filename-based theme inference.
37
+ The gallery follows the selected theme, including a third theme with its own name.
38
+
39
+ `minHeight` is the project's smallest supported **drawn height in CSS pixels**;
40
+ it defaults to 48. Declare a different positive value when the artwork needs it.
41
+ Non-square viewBoxes are supported. Variants can have different proportions.
42
+ The gallery shows clean artwork, a separate construction-grid card and actual sizes.
43
+
44
+ ## Artistic freedom and theme support
45
+
46
+ Fixed colors, multiple colors, gradients, transparency, asymmetric drawings and
47
+ optical adjustments are allowed inside SVG assets. Artwork does not have to use
48
+ `currentColor` or UI color tokens. There is no mandatory square, padding, symmetry,
49
+ color count or container shape. The usual token rules still apply to component CSS.
50
+
51
+ Provide well-formed SVG with the SVG namespace and a finite, positive `viewBox`.
52
+ Keep `preserveAspectRatio` at its default or another `meet` alignment. Use
53
+ self-contained image assets: CSS custom properties from the containing page do
54
+ not propagate into an SVG displayed through `<img>`. Prefer explicit variants
55
+ for colored artwork that needs to change with the theme. Keep SVGs within the
56
+ project's image budget; catalogue processing also has a 1 MiB per-file ceiling.
57
+
58
+ Choose backgrounds and clear space by the artwork's intended use. Inspect contrast
59
+ and optical balance in the real composition and in each theme. ADS does not infer
60
+ the meaning of every colored region or certify illustration contrast pixel by pixel.
61
+ IBM's [pictogram usage guidance](https://www.ibm.com/design/language/iconography/pictograms/usage/)
62
+ and [design guidance](https://www.ibm.com/design/language/iconography/pictograms/design/)
63
+ are useful references; their brand-specific palette and spacing choices are not
64
+ universal ADS restrictions. The starter Journey artwork is original, not IBM artwork.
65
+
66
+ ## Use in product components
67
+
68
+ Own the renderer in a component and import the SVG files normally. The catalogue
69
+ is development metadata; do not import `catalog.ads.json` into the product bundle.
70
+ The starter's `Content/Pictogram` demonstrates light/dark variants with the generated
71
+ `--display-light` and `--display-dark` switches. These follow the **nearest theme**,
72
+ including nested previews, without runtime ADS code. For a custom theme, use its
73
+ own `--display-<theme-name>` switch and the source selected by the catalogue.
74
+
75
+ For a single shared source, an owned component can render:
76
+
77
+ ```tsx
78
+ import { css } from "@linaria/atomic";
79
+ import artwork from "../../assets/pictograms/journey.svg";
80
+
81
+ const image = css`
82
+ height: var(--space-32);
83
+ width: auto;
84
+ object-fit: contain;
85
+ `;
86
+
87
+ export function Journey({ alt }: { alt: string }) {
88
+ return <img data-ads-pictogram="journey" className={image}
89
+ src={artwork} width={96} height={64} loading="eager" alt={alt} />;
90
+ }
91
+ ```
92
+
93
+ The dimensions reserve space and describe this artwork's proportions; use the
94
+ actual dimensions of your asset. Choose loading behavior for its placement.
95
+ Use meaningful `alt` when the image conveys information, or `alt=""` when adjacent
96
+ text already conveys it. A wrapper with `role="img"` and an accessible label can
97
+ name a pair of theme-switched decorative images, as in the starter.
98
+
99
+ `data-ads-pictogram` selects a catalogue contract explicitly. The render audit also
100
+ recognizes unmarked `<img>` imports by exact SVG contents. Use the marker when
101
+ several ids share identical bytes or to catch a mistakenly substituted source.
102
+ Do not use CSS backgrounds or inline SVG to represent a checked pictogram: this
103
+ render guard measures `<img>` elements. Deliberate artwork transformations and
104
+ other presentation forms need their own project evidence and visual review.
105
+
106
+ ## Checks and workflow
107
+
108
+ `ads check`, validation and draft acceptance share these source checks:
109
+
110
+ - `pictogram-catalog`: metadata shape, unique ids, safe relative SVG paths, declared
111
+ theme coverage and minimum height.
112
+ - `pictogram-source`: all referenced files exist in the checked revision, parse as
113
+ SVG and preserve valid geometry. Missing/deleted or malformed variants fail.
114
+ - Existing image budgets apply; glyph palette rules do not apply to pictograms.
115
+
116
+ `ads audit`, and validation/acceptance **when their render audit runs**, additionally
117
+ report `pictogram-render` for wrong theme/source, missing `alt`, broken images,
118
+ cropping/stretching or rendering below the declared minimum. A `contain` box may
119
+ have different proportions; the guard measures the artwork fitted inside it.
120
+ Ambiguous unmarked shared artwork is `pictogram-unresolved` review, not an error.
121
+ The checks observe visible images at the audit's viewport samples. They do not
122
+ prove every application state or animation frame, or approve creative quality.
123
+
124
+ Discover views with `ads_scenarios({"kind":"pictograms"})`; ids are
125
+ `pictograms/<id>`. Edit the `assets/pictograms` owner for guarded asset proposals.
126
+ Review the draft gallery and the consuming component's scenario in every theme.
127
+ Gallery discovery does not replace coverage of the production component.
128
+
129
+ Existing `assets/brand/pictograms/` artwork is not moved automatically. To adopt
130
+ this category, move it to `assets/pictograms/`, update imports and add the catalogue.
131
+ Keep actual identity artwork in Brand. No generated SVG recoloring is performed.
@@ -152,6 +152,21 @@ ADS resolves the public alias, extracts Linaria using the shared atomic tag
152
152
  resolver, and registers compiled modules, CSS, fonts, images and workers as
153
153
  immutable MCP resources. The selected ADS framework controls JSX compilation.
154
154
 
155
+ In ADS 0.4.4, watched previews use a private incremental module graph; complete
156
+ Bun builds remain the path for `ads compile` and production-mode verification.
157
+ This is internal tooling. Do not add a project Vite server, preview plugin or
158
+ new compiler process to enable it. Compatible React/Preact edits update the
159
+ existing isolated iframe and can preserve state, focus and selection. Incompatible
160
+ updates, changed hook signatures or rejected-revision recovery can reset state.
161
+ Preview-local state is not a persistence contract or verification evidence.
162
+
163
+ The preview UI reuses bounded, scope-specific manifest revisions and asks for
164
+ changed records internally. Tool results remain graph references. Full-resource
165
+ reads and older-server fallback remain supported. Restart the project's ADS
166
+ runtime and reconnect after upgrading; changing an installed package does not
167
+ replace the running compiler. HTTP asset delivery is a separate, unreleased
168
+ experiment and is not required for these improvements.
169
+
155
170
  `ads compile .` builds all production previews for project builds or CI.
156
171
  `ads compile . --watch` runs the same source scheduler continuously.
157
172
  Programmatic project setup can call `compilePreviews` from
@@ -152,6 +152,21 @@ ADS resolves the public alias, extracts Linaria using the shared atomic tag
152
152
  resolver, and registers compiled modules, CSS, fonts, images and workers as
153
153
  immutable MCP resources. The selected ADS framework controls JSX compilation.
154
154
 
155
+ In ADS 0.4.4, watched previews use a private incremental module graph; complete
156
+ Bun builds remain the path for `ads compile` and production-mode verification.
157
+ This is internal tooling. Do not add a project Vite server, preview plugin or
158
+ new compiler process to enable it. Compatible React/Preact edits update the
159
+ existing isolated iframe and can preserve state, focus and selection. Incompatible
160
+ updates, changed hook signatures or rejected-revision recovery can reset state.
161
+ Preview-local state is not a persistence contract or verification evidence.
162
+
163
+ The preview UI reuses bounded, scope-specific manifest revisions and asks for
164
+ changed records internally. Tool results remain graph references. Full-resource
165
+ reads and older-server fallback remain supported. Restart the project's ADS
166
+ runtime and reconnect after upgrading; changing an installed package does not
167
+ replace the running compiler. HTTP asset delivery is a separate, unreleased
168
+ experiment and is not required for these improvements.
169
+
155
170
  `ads compile .` builds all production previews for project builds or CI.
156
171
  `ads compile . --watch` runs the same source scheduler continuously.
157
172
  Programmatic project setup can call `compilePreviews` from
@@ -53,4 +53,5 @@ Load only the guide(s) for the requested transition.
53
53
 
54
54
  | From | To | Guide |
55
55
  |------|----|-------|
56
- | 0.4.1 | 0.4.2 (planned) | [Showcase, review boundaries and preview migration](references/0.4.1-to-0.4.2.md) |
56
+ | 0.4.1 | 0.4.2 | [Showcase, review boundaries and preview migration](references/0.4.1-to-0.4.2.md) |
57
+ | 0.4.3 | 0.4.4 | [Incremental previews and manifest reuse](references/0.4.3-to-0.4.4.md) |
@@ -1,8 +1,7 @@
1
1
  # ADS 0.4.1 → 0.4.2
2
2
 
3
- Status: planned next patch release. This guide describes changes from the committed
4
- 0.4.1 source to the current development tree. Confirm the target package or local
5
- build contains them before applying it; the guide does not publish 0.4.2.
3
+ This guide describes the 0.4.1-to-0.4.2 transition. Confirm the installed target
4
+ version before applying it; later transitions have their own guides.
6
5
 
7
6
  This upgrade includes source/configuration incompatibilities despite the patch
8
7
  number. Apply the relevant sections to an existing design system; a fresh starter
@@ -0,0 +1,80 @@
1
+ # ADS 0.4.3 → 0.4.4
2
+
3
+ Use the target package's changelog and installed version to confirm availability;
4
+ this guide also accompanies a local 0.4.4 release candidate.
5
+
6
+ This transition changes ADS's managed preview engine. It requires no project
7
+ source rename, token migration, configuration field or replacement mount adapter.
8
+ Keep the application's framework, build tools, TypeScript and runtime. ADS still
9
+ runs on Bun ≥1.4.1. Its internal Vite graph is private; do not add an application
10
+ Vite server or install preview plugins into the consuming project.
11
+
12
+ ## Upgrade and reconnect
13
+
14
+ 1. Record the installed ADS version and existing dependency/lockfile changes.
15
+ Upgrade with the project's package manager and retain its dependency placement,
16
+ for example `npm install --save-dev @reqvire-org/ads@0.4.4` when ADS is already
17
+ a dev dependency. Use the supplied tarball instead when testing a release candidate.
18
+ 2. Stop and restart only this project's ADS runtime using the upgraded installation;
19
+ reconnect the MCP client and reopen the showcase URL it reports. A running old
20
+ server does not acquire the new compiler by updating the package on disk.
21
+ 3. Keep drafts and project source. Compiler fingerprints invalidate incompatible
22
+ preview artifacts automatically. Do not delete `.ds/` to force a rebuild: it
23
+ can contain active drafts and evidence. Never edit generated preview files.
24
+
25
+ ## Expected preview behavior
26
+
27
+ Watched React/Preact previews now update changed modules inside the existing
28
+ isolated iframe. Compatible edits preserve ordinary component state, input text,
29
+ focus and selection. Hook-signature changes follow framework reset semantics;
30
+ incompatible exports, configuration changes, interrupted updates and rollback to
31
+ an already evaluated old revision can reopen the frame. State preservation is
32
+ conditional, not a durable application-state guarantee.
33
+
34
+ The preview can display compiled feedback before checks finish. For evidence,
35
+ wait for current verified output (`ads_show_scenario` defaults to
36
+ `waitFor:"verified"`). Visible changes, retained state and a running server do not
37
+ establish acceptance. Captures, audits, registered behaviors and exact-revision
38
+ draft acceptance retain their existing gates.
39
+
40
+ The UI reuses known manifests and requests internal resource deltas. Agent-facing
41
+ tool results still provide graph references. Clients reading the existing full
42
+ manifest resource need no change; older servers receive the full-resource fallback.
43
+ Do not persist graph metadata across projects or draft scopes in a custom host.
44
+
45
+ HTTP asset delivery, iframe removal, source-emission/V3 and experimental capture
46
+ repaint changes are outside 0.4.4. Remove proof-only flags from a production launcher
47
+ if an experiment added them; they are not required to enable incremental previews.
48
+
49
+ ## Verify the receiving project
50
+
51
+ Run the upgraded local CLI from the project root:
52
+
53
+ ```sh
54
+ bun node_modules/@reqvire-org/ads/dist/cli.mjs check .
55
+ bun node_modules/@reqvire-org/ads/dist/cli.mjs compile .
56
+ bun node_modules/@reqvire-org/ads/dist/cli.mjs validate .
57
+ ```
58
+
59
+ Run the project's typecheck, production build and relevant tests, reusing those
60
+ already registered with validation. In the real showcase, inspect a stateful
61
+ scenario before and after a compatible edit, a style/token edit, lazy content,
62
+ and scenario navigation. Review an existing draft when the project has one;
63
+ do not create or accept unrelated drafts just for migration. Check relevant
64
+ themes, viewport sizes and console/build diagnostics. Full Bun compilation and
65
+ production imports must remain valid alongside watched previews.
66
+
67
+ Ancestor-background contrast checks now cover string/number text props and
68
+ source-resolvable inert/optional layout classes. Investigate actual contrast or
69
+ unresolved-paint findings rather than suppressing them to complete the upgrade.
70
+
71
+ If preview loading fails, confirm the connected project/version, read its build
72
+ diagnostics, repair the named source and retry. For a migration regression,
73
+ preserve the failing fixture and diagnostics; restore only this upgrade's package
74
+ and lockfile changes if rollback is needed, then restart that runtime. Do not
75
+ revert unrelated edits, weaken validation or erase drafts.
76
+
77
+ Report the from/to installed versions, commands and rendered states actually
78
+ verified, unresolved findings, and the running showcase URL. Editing performance
79
+ depends on the project: the integration benchmark showed faster compatible edits
80
+ and lower transfer volume, but slower cold verification and no memory improvement.