@reqvire-org/ads 0.4.2 → 0.4.3

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 (62) hide show
  1. package/README.md +10 -1
  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/check-service.mjs +8 -5
  11. package/dist/check.mjs +8 -3
  12. package/dist/component-contrast.mjs +126 -8
  13. package/dist/contrast-composition.mjs +134 -0
  14. package/dist/finding-rules.mjs +2 -0
  15. package/dist/font-rules.mjs +20 -15
  16. package/dist/fonts-generated.mjs +21 -14
  17. package/dist/foundation-views.mjs +6 -2
  18. package/dist/image-attributes.mjs +96 -92
  19. package/dist/mcp/drafts.mjs +6 -4
  20. package/dist/mcp/mutations.mjs +11 -8
  21. package/dist/mcp/preview-widget.bundle.js +43 -43
  22. package/dist/mcp/server.mjs +9 -2
  23. package/dist/pictogram-model.mjs +59 -0
  24. package/dist/pictograms.mjs +52 -0
  25. package/dist/preview-bun.mjs +1 -0
  26. package/dist/render-audit/image-shape.mjs +13 -3
  27. package/dist/render-audit/pictograms.mjs +88 -0
  28. package/dist/render-audit/worker.mjs +12 -0
  29. package/dist/render-audit.mjs +11 -1
  30. package/dist/render-composition.mjs +164 -0
  31. package/dist/scenario-registry.mjs +2 -2
  32. package/dist/scenarios-compiler.mjs +1 -1
  33. package/dist/showcase/client.bundle.js +23 -23
  34. package/dist/showcase/draft-navigation.js +5 -5
  35. package/dist/showcase/foundation-view.css +3 -0
  36. package/dist/showcase/foundation-view.mjs +3 -0
  37. package/dist/showcase/pictogram-view.mjs +53 -0
  38. package/dist/showcase/ui/ui.js +2 -0
  39. package/dist/skills/ads-designer/SKILL.md +13 -1
  40. package/dist/skills/ads-designer/references/accessibility.md +66 -2
  41. package/dist/skills/ads-designer/references/branding.md +5 -16
  42. package/dist/skills/ads-designer/references/performance.md +3 -2
  43. package/dist/skills/ads-designer/references/pictograms.md +131 -0
  44. package/dist/skills/ads-port/SKILL.md +4 -1
  45. package/dist/source-values.mjs +4 -1
  46. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
  47. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
  48. package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
  49. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
  50. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
  51. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
  52. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
  53. package/dist/task-cache.mjs +2 -2
  54. package/dist/units.mjs +4 -4
  55. package/dist/validation-inputs.mjs +7 -3
  56. package/docs/ADS.md +6 -1
  57. package/docs/ARCHITECTURE.md +75 -2
  58. package/docs/CACHING.md +25 -0
  59. package/docs/CHANGELOG.md +75 -52
  60. package/docs/GUIDE.md +30 -5
  61. package/docs/MCP.md +6 -0
  62. package/package.json +2 -1
@@ -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" }) }),
@@ -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
 
@@ -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,69 @@ 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
+
53
+ The composition check deliberately leaves unknown prop spreads, differing class branches,
54
+ competing/conditional/descendant styles, unbound class names, gradients, opacity, filters,
55
+ transforms, text shadows, dynamic visibility and missing backdrops
56
+ unverified (`component-contrast-unresolved`). Keep legitimate component APIs; do not
57
+ flatten them or add paint to satisfy the checker. Audit the actual composed scenario,
58
+ including hover/focus and every theme/brand. A static success with an unresolved finding
59
+ is not proof that rendered contrast passes.
60
+
61
+ ### When a required color cannot reach contrast
62
+
63
+ A brand or reference color (a live site's button blue, a product color) can fail with the
64
+ text it must carry: white on a light, saturated blue is often near 2.4:1. Do not ship it
65
+ failing, and do not hide it: no one-off value, `text-shadow`, opacity, gradient under the
66
+ text or disabled check. Work through these options, measure each candidate's ratio, and
67
+ when the color is a stakeholder's decision (a port that must match a reference), present
68
+ the candidates with their ratios and let them choose.
69
+
70
+ 1. **Change the text, not the color.** Dark text may pass on the original color where
71
+ white cannot. Add a `--x-fg`/`--text-on-x` role for it.
72
+ 2. **Large text.** WCAG and `component-contrast` need only 3:1 for large text: `font-size`
73
+ of at least 24px, or at least 18.66px at `font-weight` 700+, in `px`, `pt` or `rem`
74
+ (literal or token). Declare the size **in the same style block that pairs the colors**
75
+ (or an enclosing block) for a declaration-only pair. The composition check can also
76
+ resolve sizes inherited through owned DOM and nonconflicting classes. `em`, `%`
77
+ or `calc()` sizes keep 4.5:1. This fits prominent calls to action and headings, and
78
+ keeps a much brighter color (white on about `#0095dd` instead of `#0079d0`). Everything
79
+ with smaller text on that color still needs 4.5:1, so keep a separate passing token for it.
80
+ 3. **Derive the nearest passing color**, as a token with the source color in a comment.
81
+ Lower lightness in small steps, keeping hue and saturation, until the pair passes. For
82
+ white text the background's relative luminance is capped near 0.18, so light
83
+ colors lose most of their brightness. If the result turns dull (cyan, teal, green, orange
84
+ and yellow go muddy when darkened), turn the hue a few degrees toward blue or purple,
85
+ which reach the same luminance at higher brightness and saturation, and stop at the
86
+ smallest shift that still looks like the original. Use the one token wherever that
87
+ color carries normal-size text, so the system has one passing variant, not several.
88
+
89
+ `token-contrast` role pairs (`--text-body` on `--bg-canvas`, `--x-text` on `--x-bg`) carry
90
+ no font size and always need 4.5:1; option 2 applies to component pairs only.
91
+
29
92
  ## Render audit (axe-core and non-text contrast)
30
93
 
31
94
  Run `ads audit` after changing a component, pattern or composition scenario. It renders
@@ -48,7 +111,8 @@ design-system/components/Broken.ads.scenario.tsx:1:1 [error:a11y-axe] axe button
48
111
  - Fix the finding in the component that renders the failing element, not in the scenario.
49
112
  - A `color-contrast` finding that `token-contrast` or `component-contrast` also reports is a
50
113
  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.
114
+ from a cascade or rendered state source analysis could not prove. Fix the text/surface
115
+ token in its real owner and verify the composed scenario; do not duplicate backgrounds.
52
116
  - `a11y-non-text-contrast` errors cover enabled, visible buttons, inputs, selects,
53
117
  textareas, links and `switch`/`checkbox`/`radio`/`slider`/`tab` roles. A control whose
54
118
  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.
@@ -111,7 +111,10 @@ part of the port; do not ask permission for each token substitution. Preserve
111
111
  promised interaction contracts and document changes that affect behavior. If
112
112
  exact upstream fidelity is explicitly required and conflicts with project policy,
113
113
  explain the conflict and resolve that requirement before adding duplicate roles
114
- or changing policy. Do not silently copy upstream defects or change a promised
114
+ or changing policy. A reference color that fails ADS contrast is such a conflict:
115
+ offer the options in `ads://guides/accessibility` ("When a required color cannot reach
116
+ contrast": other text color, large text at 3:1, nearest passing color) with measured
117
+ ratios. Do not silently copy upstream defects or change a promised
115
118
  timer, focus, gesture or placement contract merely to simplify implementation.
116
119
 
117
120
  ## Implement and integrate
@@ -307,7 +307,10 @@ export function createSourceValues(program, options, { preserveCall = () => fals
307
307
  if (key.kind === "literal") {
308
308
  const selected = await get(object, String(key.value), next(context));
309
309
  const owner = await declaration(node);
310
- if (selected.kind === "unknown" && owner && owned(owner)) {
310
+ // A property symbol identifies its original declaration, not the value
311
+ // after mutation, an accessor or an opaque override. Preserve that lack
312
+ // of proof instead of recovering the declaration's stale initializer.
313
+ if (selected.kind === "unknown" && !(strict && selected.reason) && owner && owned(owner)) {
311
314
  if (isFunction(owner)) return reference(owner, env, via);
312
315
  if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const)
313
316
  return resolve(reference(owner.initializer, env, via), next(context));
@@ -0,0 +1,13 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "pictograms": [
4
+ {
5
+ "id": "journey",
6
+ "title": "Journey",
7
+ "description": "A route connecting three destinations. Use for onboarding or an empty journey list; decorative beside equivalent text.",
8
+ "license": "Original ADS starter artwork, MIT",
9
+ "schemes": { "light": "journey.svg", "dark": "journey.dark.svg" },
10
+ "minHeight": 48
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 64">
2
+ <defs><linearGradient id="route" x1="12" y1="48" x2="84" y2="16" gradientUnits="userSpaceOnUse"><stop stop-color="#83beff"/><stop offset="1" stop-color="#e0a6fa"/></linearGradient></defs>
3
+ <path d="M12 48h20c9 0 8-32 20-32h32" fill="none" stroke="url(#route)" stroke-width="5" stroke-linecap="round"/>
4
+ <circle cx="12" cy="48" r="7" fill="#83beff"/>
5
+ <circle cx="48" cy="28" r="7" fill="#f9bd58" stroke="#ffe5b6" stroke-width="2"/>
6
+ <path d="m84 7 9 9-9 9-9-9z" fill="#e0a6fa"/>
7
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 64">
2
+ <defs><linearGradient id="route" x1="12" y1="48" x2="84" y2="16" gradientUnits="userSpaceOnUse"><stop stop-color="#216ac4"/><stop offset="1" stop-color="#9954b8"/></linearGradient></defs>
3
+ <path d="M12 48h20c9 0 8-32 20-32h32" fill="none" stroke="url(#route)" stroke-width="5" stroke-linecap="round"/>
4
+ <circle cx="12" cy="48" r="7" fill="#216ac4"/>
5
+ <circle cx="48" cy="28" r="7" fill="#f9bd58" stroke="#553b19" stroke-width="2"/>
6
+ <path d="m84 7 9 9-9 9-9-9z" fill="#9954b8"/>
7
+ </svg>
@@ -0,0 +1 @@
1
+ export { Pictogram, type PictogramProps } from "./Pictogram";
@@ -0,0 +1 @@
1
+ export const fixture = { title: "Pictogram", label: "A journey connecting three destinations" } as const;
@@ -0,0 +1,7 @@
1
+ import { Pictogram } from "@ds";
2
+ import { DemoFrame } from "@ds/review";
3
+ import { fixture } from "./Pictogram.ads.fixture";
4
+ export const scenario = { title: fixture.title, covers: ["Pictogram"] };
5
+ export default function Scenario() {
6
+ return <DemoFrame><Pictogram label={fixture.label} size="small" /><Pictogram label={fixture.label} /><Pictogram label={fixture.label} size="large" /></DemoFrame>;
7
+ }
@@ -0,0 +1,26 @@
1
+ import { css, cx } from "@linaria/atomic";
2
+ import journey from "../../../assets/pictograms/journey.svg";
3
+ import journeyDark from "../../../assets/pictograms/journey.dark.svg";
4
+
5
+ export interface PictogramProps {
6
+ /** Omit when adjacent text already conveys the same meaning. */
7
+ label?: string;
8
+ size?: "small" | "medium" | "large";
9
+ }
10
+ const base = css`display: inline-flex;`;
11
+ const sizes = {
12
+ small: css`height: var(--space-24);`,
13
+ medium: css`height: var(--space-32);`,
14
+ large: css`height: var(--space-48);`,
15
+ };
16
+ const image = css`height: 100%; width: auto; object-fit: contain;`;
17
+ const light = css`display: var(--display-light, block);`;
18
+ const dark = css`display: var(--display-dark, block);`;
19
+
20
+ /** Project-owned illustration; theme switches work without an ADS runtime. */
21
+ export function Pictogram({ label, size = "medium" }: PictogramProps) {
22
+ return <span className={cx("ds-pictogram", base, sizes[size])} role={label ? "img" : undefined} aria-label={label} aria-hidden={label ? undefined : true}>
23
+ <img data-ads-pictogram="journey" className={cx(image, light)} src={journey} width={96} height={64} loading="eager" alt="" />
24
+ <img data-ads-pictogram="journey" className={cx(image, dark)} src={journeyDark} width={96} height={64} loading="eager" alt="" />
25
+ </span>;
26
+ }
@@ -73,13 +73,13 @@ export function architectureExternalInputs(root, trackingRoot = root) {
73
73
  };
74
74
  return { dependencies, git, environment: Object.fromEntries(semanticEnv.map((name) => [name, process.env[name] ?? null])) };
75
75
  }
76
- export async function architectureTaskInputs(root, trackingRoot = root) {
76
+ export async function architectureTaskInputs(root, trackingRoot = root, { onFile } = {}) {
77
77
  return {
78
78
  schemaVersion: 1,
79
79
  kind: "architecture",
80
80
  runtime: previewRuntimeFingerprint(),
81
81
  tool: toolInputs(),
82
- files: await validationInputFiles(loadConfig(root)),
82
+ files: await validationInputFiles(loadConfig(root), [], { onFile }),
83
83
  ...architectureExternalInputs(root, trackingRoot),
84
84
  };
85
85
  }
package/dist/units.mjs CHANGED
@@ -15,7 +15,7 @@ function fail(message, file) {
15
15
  }
16
16
 
17
17
  /** Project setup and explicitly registered ADS extension/build entrypoints. */
18
- export async function configurationFiles(options) {
18
+ export async function configurationFiles(options, resolve) {
19
19
  const { root, config, sourceRoot, dsRoot } = options;
20
20
  const files = new Set(["ds.config.json", "package.json"]);
21
21
  for (const entry of readdirSync(root, { withFileTypes: true })) {
@@ -27,8 +27,8 @@ export async function configurationFiles(options) {
27
27
  )
28
28
  files.add(entry.name);
29
29
  }
30
- const resolve = await importResolver(options),
31
- visited = new Set();
30
+ resolve ??= await importResolver(options);
31
+ const visited = new Set();
32
32
  async function visit(file, entrypoint = false, typeConfig = false) {
33
33
  if (!isInside(root, file) || file === root || /(?:^|[\\/])(?:node_modules|\.git|\.ds|dist)(?:[\\/]|$)/.test(path.relative(root, file)) || visited.has(file))
34
34
  return;
@@ -258,7 +258,7 @@ async function discoverUnits(options) {
258
258
  }
259
259
  const units = new Map();
260
260
  units.set("configuration", { id: "configuration", kind: "configuration", files: [...setup].filter((file) => existsSync(path.join(root, file))).sort() });
261
- for (const id of ["foundation", "documentation", "tokens", "assets/brand", "assets/fonts"]) units.set(id, { id, kind: id.split("/")[0], files: [] });
261
+ for (const id of ["foundation", "documentation", "tokens", "assets/brand", "assets/fonts", "assets/pictograms"]) units.set(id, { id, kind: id.split("/")[0], files: [] });
262
262
  units.get("documentation").files = projectDocumentFiles(root).filter(
263
263
  (file) => owner(slash(path.relative(dsRoot, path.resolve(root, file)))) === "documentation",
264
264
  );