@reqvire-org/ads 0.5.2 → 0.5.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 (68) hide show
  1. package/dist/ads-errors.mjs +33 -26
  2. package/dist/analysis/design-usage.mjs +4 -20
  3. package/dist/analysis/mock-check.mjs +4 -5
  4. package/dist/analysis/owner-accessibility.mjs +4 -4
  5. package/dist/analysis/owner-analysis-key.mjs +1 -1
  6. package/dist/analysis/owner-choices.mjs +33 -3
  7. package/dist/analysis/owner-composition.mjs +61 -12
  8. package/dist/analysis/owner-source.mjs +52 -35
  9. package/dist/composed-contrast.mjs +143 -62
  10. package/dist/construction-output.mjs +6 -1
  11. package/dist/construction-spec.d.mts +53 -44
  12. package/dist/construction-spec.mjs +64 -76
  13. package/dist/corner-overpaint.mjs +5 -4
  14. package/dist/design-foundation.mjs +16 -0
  15. package/dist/design-usage.mjs +2 -8
  16. package/dist/emit/emission.mjs +0 -5
  17. package/dist/grid-lowering.mjs +3 -1
  18. package/dist/lowering-enter.mjs +6 -6
  19. package/dist/lowering-session.mjs +10 -0
  20. package/dist/mcp/server-observation.mjs +6 -4
  21. package/dist/mcp/server-project.mjs +4 -1
  22. package/dist/owner-analysis-check.mjs +4 -1
  23. package/dist/owner-errors.mjs +2 -1
  24. package/dist/owner-lowering.mjs +10 -4
  25. package/dist/owner-scenarios.mjs +2 -22
  26. package/dist/ownership-model.mjs +7 -5
  27. package/dist/paint-contrast.mjs +6 -0
  28. package/dist/profile-macro.d.mts +7 -0
  29. package/dist/recipe-macro.d.mts +46 -42
  30. package/dist/recipe-model.mjs +12 -11
  31. package/dist/region-lowering.mjs +54 -109
  32. package/dist/role-vocabulary.d.mts +4 -0
  33. package/dist/role-vocabulary.mjs +4 -0
  34. package/dist/runtime-paint-contrast.mjs +5 -2
  35. package/dist/showcase/client.bundle.js +48 -48
  36. package/dist/showcase/http-client.bundle.js +13 -13
  37. package/dist/showcase/ui/ui.css +1 -1
  38. package/dist/showcase/ui/ui.js +5 -5
  39. package/dist/skills/ads-designer/references/accessibility.md +3 -4
  40. package/dist/skills/ads-designer/references/design-data.md +12 -6
  41. package/dist/skills/ads-designer/references/layout.md +7 -3
  42. package/dist/skills/ads-designer/references/motion.md +2 -1
  43. package/dist/skills/ads-designer/references/recipes.md +28 -18
  44. package/dist/skills/ads-import/references/design-data.md +12 -6
  45. package/dist/skills/ads-import/references/layout.md +7 -3
  46. package/dist/skills/ads-import/references/recipes.md +28 -18
  47. package/dist/skills/ads-migrate/SKILL.md +1 -0
  48. package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
  49. package/dist/skills/ads-port/references/design-data.md +12 -6
  50. package/dist/skills/ads-port/references/layout.md +7 -3
  51. package/dist/skills/ads-port/references/recipes.md +28 -18
  52. package/dist/spatial-model.mjs +2 -2
  53. package/dist/surface-contrast.mjs +6 -2
  54. package/dist/target-size.mjs +21 -3
  55. package/docs/ADS.md +9 -3
  56. package/docs/ARCHITECTURE.md +33 -23
  57. package/docs/CACHING.md +1 -1
  58. package/docs/CHANGELOG.md +128 -21
  59. package/docs/GUIDE.md +64 -19
  60. package/docs/LANGUAGE.md +141 -134
  61. package/docs/MCP.md +5 -1
  62. package/docs/MOTION.md +5 -2
  63. package/docs/PROFILE-KINDS.md +46 -4
  64. package/docs/RULES.md +16 -15
  65. package/package.json +1 -1
  66. package/dist/analysis/prose-owners.mjs +0 -57
  67. package/dist/prose-model.d.mts +0 -81
  68. package/dist/prose-model.mjs +0 -101
@@ -32,9 +32,9 @@ The `a11y-*` rules check tokens, profiles and constructions (WCAG 2.2 AA):
32
32
 
33
33
  | Rule | What it requires | WCAG |
34
34
  |---|---|---|
35
- | `a11y-target-size` | Every control and `frame: "control"` part is at least 24 × 24px, computed from its lowered box in every theme, brand and condition, a frame's `min-target-inline-size`/`min-target-block-size` hit area included; neighbouring hit areas never overlap | 2.5.8 |
35
+ | `a11y-target-size` | Every control and `frame: "control"` part is at least 24 × 24px, computed from its lowered box in every theme, brand and condition, a frame's `min-target-inline-size`/`min-target-block-size` hit area included; a smaller part of a stack or inline arrangement passes by the spacing exception when 24px circles centred on it and its neighbouring targets keep clear; neighbouring hit areas never overlap | 2.5.8 |
36
36
  | `a11y-focus` | Every focus profile's width is at least 2px; the default indicator `foundation({ focus })` has 3:1 on the document surface | 2.4.7, 1.4.11 |
37
- | `surface-contrast` | A surface profile setting `color` and `background` reaches 4.5:1 in every context, or 3:1 where every use of it is large text or artwork (a visual part, a text-less control), and has no minimum where every use is an `aria-hidden` visual part; a surface for disabled controls declares `state: "inactive"` (no minimum) and is selected only under `:disabled` or `[aria-disabled="true"]` (`construction/inactive-surface-active`) | 1.4.3 |
37
+ | `surface-contrast` | A surface profile setting `color` and `background` reaches 4.5:1 in every context, or 3:1 where every use of it is large text or artwork (a visual part, a text-less control), and has no minimum where every use is an `aria-hidden` visual part, or where its `color` is fully transparent (a glyph shown only on hover: it draws nothing at rest, and the states that show it keep their minimum); a surface for disabled controls declares `state: "inactive"` (no minimum) and is selected only under `:disabled` or `[aria-disabled="true"]` (`construction/inactive-surface-active`) | 1.4.3 |
38
38
  | `a11y-text-resize` | `font-size` and length `line-height` tokens in `rem` or `em` | 1.4.4 |
39
39
  | `a11y-icon-label` | Every control choice without a text part has `aria-label`, `aria-labelledby` or `title` | 4.1.2 |
40
40
  | `owner-analysis` (`pressed-state-mismatch`) | A choice pairing `aria-pressed` with artwork that declares a `selected` state draws `selected` exactly when pressed; a value analysis cannot pair is `review/pressed-state-unresolved` | 4.1.2 |
@@ -45,8 +45,7 @@ The `a11y-*` rules check tokens, profiles and constructions (WCAG 2.2 AA):
45
45
 
46
46
  Values ADS cannot evaluate are review items (`a11y-target-size-unresolved`,
47
47
  `a11y-focus-unresolved`, `component-contrast-unresolved`: a wrapper ADS does not
48
- analyze, a same-file component that does not render its children, an owner placed in a
49
- plain module's markup, a link or control without its own surface, an out-of-flow element
48
+ analyze, a same-file component that does not render its children, a link or control without its own surface, an out-of-flow element
50
49
  without a background, opacity, an unknown image). A helper component in an owner's file is
51
50
  followed only when it passes `children` through; for any other, give the text it renders
52
51
  an opaque surface of its own, or make the helper a children wrapper or an owner. A native
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
240
240
 
241
241
  ## Colours that depend on their surroundings
242
242
 
243
+ - **The container decides** (links and icons in a tinted banner, a heading's
244
+ links, a selected row's cells, icons and checkbox, actions on a dark card):
245
+ the container's surface profile provides the roles its children read,
246
+ `provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
247
+ on a selected row, the state's surface provides them while the state holds.
248
+ The children keep one design and need no prop. Key and value are paint
249
+ tokens; never provide a token the surface itself reads. Composed contrast
250
+ proves the children's text with the provided values on the container.
243
251
  - **Inverted regions** (a dark footer or card on a light page): declare
244
252
  `sections: true` in `foundation()` and put `data-theme="dark"` on the region.
245
253
  Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
249
257
  section's values. Contrast is already proven in every context, so a section
250
258
  needs no extra check. A section switches whole themes/brands only; a recipe's
251
259
  own token declaration on the section element wins.
252
- - **On-image or on-fill controls** (a button over a photo or brand banner): give
253
- the child a closed choice the caller sets, such as `tone?: "default" |
260
+ - **On-image controls** (a button over a photo, a background the design system
261
+ cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
254
262
  "on-dark"` mapping to a precompiled recipe with its own surface profile
255
263
  (Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
256
264
  the pair is proven and does not change with the page's theme.
257
- - **Not covered yet**: state cascading to children (a selected row's cells and
258
- icons) and tinted containers (links inside a warning banner) need a prop
259
- threaded through each child, or the surface-context construct that is planned.
260
- Do not invent a theme per state. Details and limits: the ADS tool guide,
265
+ - Do not invent a theme per state, or a `tone` prop for a container the design
266
+ system owns. Details and limits: the ADS tool guide,
261
267
  *Colours that depend on their surroundings*.
262
268
 
263
269
  ## Colors in Canvas, WebGL and SVG renderers
@@ -170,9 +170,13 @@ until that owner is fixed.
170
170
  so a visible tier keeps the element's own display); `visible: true` shows it
171
171
  again from a later tier. Hiding a part while a named condition holds is the
172
172
  part's own `at: { "<condition>": { visible } }`, below.
173
- - Each declared cell renders exactly once (`cell-missing-or-repeated`). A cell names
174
- one owned element or public component; several or mapped instances may share a
175
- cell only when it auto-places (`start: "auto"`) at every tier.
173
+ - Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
174
+ says otherwise. A cell names one owned element or public component.
175
+ `required: false` lets it be absent (keep it in auto rows, or its pinned row
176
+ stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
177
+ list item: its instances flow (`start: "auto"` implied) over a numeric span or
178
+ `"full"`, with no start line, `end` or `row`. Several instances may also share
179
+ a cell that auto-places (`start: "auto"`) at every tier.
176
180
  - An element has at most one placement (`placement-repeated`), applied in the
177
181
  returned JSX (`placement-statement`), and a placed element carries its own recipe
178
182
  styling (`placement-without-root`). One element carries one part or cell marker.
@@ -110,7 +110,8 @@ can stop it. A size the owner measures animates with `motion` on its
110
110
  An entrance on first render is `enter` on a recipe root or a region part:
111
111
  `enter: { from: { surface: "entering", translate: { slot: "motion", field: "distance" } }, motion: "enter-motion" }`.
112
112
  `from.surface` is a surface profile with only `opacity` and/or `blur`; at most
113
- one movement (`translate` on the block axis, `scale` or `rotate`) is read from
113
+ one movement (`translate` on the block axis, `translateInline` on the inline
114
+ axis and mirrored right to left, `scale` or `rotate`) is read from
114
115
  the entrance's motion profile, which needs a duration, an easing and
115
116
  `reduced: "static"`. Stagger parts with motion profiles that differ in `delay`.
116
117
  ADS emits `@starting-style` and a transition, no script; reduced motion shows
@@ -150,23 +150,28 @@ a recipe never creates a state machine.
150
150
  surface and its state surfaces, timed by a motion profile with a `static`
151
151
  reduced-motion policy. A channel that does not change, an effect that changes
152
152
  without its channel, or a gradient on the element, is rejected.
153
- - Long-form content (articles, docs, legal text, Markdown or CMS output) is a
154
- component whose recipe has `layout: "prose"`: `rhythm` for the space between
155
- blocks and `elements` naming a text, surface and frame profile per plain
156
- element (`paragraph`, `heading2`, `link`, `list`, `item`, `quote`, `rule`,
157
- `pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
158
- (`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
159
- never descendant CSS of your own. Declare every element the content uses.
160
- A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
161
- heading closer to its text); `list` takes `markers` (a shape per depth of
162
- nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
163
- `component` gives every component placed among the blocks its space before
164
- and after.
165
- Only classless elements are styled, so do not put classes on content. For
166
- content that arrives as an HTML string, add a second component on the same
167
- recipe that injects it (`ProseHtml({ html })`); the application passes the
168
- string as a prop and sanitises it first.
169
- - `enter: { from: { surface, translate | scale | rotate }, motion }` on a root
153
+ - Long-form content (articles, docs, legal text, Markdown or CMS output) is
154
+ built from the design system's own components: `Heading`, `Paragraph`,
155
+ `Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
156
+ normal owner. A pattern places them: a `stack` whose parts are placed
157
+ components (`kind: "component"`, `repeat: true`, `required: false`), in any
158
+ order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
159
+ heading one `sectionGap` from what precedes it). The content arrives as a
160
+ typed tree (a union of node types) that the pattern renders with a ternary
161
+ chain over `node.type` in its `.map` callback; an inline renderer may render
162
+ itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
163
+ sanitised) or CMS rich text to that tree; never style plain markup by tag and
164
+ never inject an HTML string. A colour that follows the container (a link in a
165
+ heading) is the container surface's `provides`, not a prop on the link. A list
166
+ item keeps its marker: give it no arrangement, and space a nested list with a
167
+ part's `spaceBefore` in its block flow.
168
+ - A colour that depends on where an element sits (links and icons in a tinted
169
+ banner, the cells of a selected row, actions on a dark card) is a contextual
170
+ role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
171
+ The children read their own roles and need no prop; composed contrast proves
172
+ their text there. Do not add a `tone` prop for a container's colour; keep
173
+ `tone` for a background the design system cannot know (a photo).
174
+ - `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
170
175
  or a region part is an entrance on first render: the element starts from a
171
176
  surface that states only `opacity` and `blur`, and at most one movement read
172
177
  from the entrance's motion profile, then settles. See the motion reference.
@@ -175,7 +180,12 @@ a recipe never creates a state machine.
175
180
  separate owner only to give an element padding, a border or a size. The
176
181
  drawn box of a checkbox, radio or switch whose native `<input>` is hidden
177
182
  takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
178
- drawn on the box while the input has keyboard focus. A visual part may sit
183
+ drawn on the box while the input has keyboard focus. The input's part,
184
+ declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
185
+ no room and lies, invisible, over the box at the box's frame size, so pointer
186
+ and keyboard still reach the real input. A part rendered once per list item
187
+ (`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
188
+ construction, and `extent: "fill"` shares the row among them. A visual part may sit
179
189
  inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
180
190
  `recipe.assets.<name>.source`), which one nested part of the recipe has. On a
181
191
  visual part the frame's size is the box and the drawing keeps its visual
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
240
240
 
241
241
  ## Colours that depend on their surroundings
242
242
 
243
+ - **The container decides** (links and icons in a tinted banner, a heading's
244
+ links, a selected row's cells, icons and checkbox, actions on a dark card):
245
+ the container's surface profile provides the roles its children read,
246
+ `provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
247
+ on a selected row, the state's surface provides them while the state holds.
248
+ The children keep one design and need no prop. Key and value are paint
249
+ tokens; never provide a token the surface itself reads. Composed contrast
250
+ proves the children's text with the provided values on the container.
243
251
  - **Inverted regions** (a dark footer or card on a light page): declare
244
252
  `sections: true` in `foundation()` and put `data-theme="dark"` on the region.
245
253
  Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
249
257
  section's values. Contrast is already proven in every context, so a section
250
258
  needs no extra check. A section switches whole themes/brands only; a recipe's
251
259
  own token declaration on the section element wins.
252
- - **On-image or on-fill controls** (a button over a photo or brand banner): give
253
- the child a closed choice the caller sets, such as `tone?: "default" |
260
+ - **On-image controls** (a button over a photo, a background the design system
261
+ cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
254
262
  "on-dark"` mapping to a precompiled recipe with its own surface profile
255
263
  (Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
256
264
  the pair is proven and does not change with the page's theme.
257
- - **Not covered yet**: state cascading to children (a selected row's cells and
258
- icons) and tinted containers (links inside a warning banner) need a prop
259
- threaded through each child, or the surface-context construct that is planned.
260
- Do not invent a theme per state. Details and limits: the ADS tool guide,
265
+ - Do not invent a theme per state, or a `tone` prop for a container the design
266
+ system owns. Details and limits: the ADS tool guide,
261
267
  *Colours that depend on their surroundings*.
262
268
 
263
269
  ## Colors in Canvas, WebGL and SVG renderers
@@ -170,9 +170,13 @@ until that owner is fixed.
170
170
  so a visible tier keeps the element's own display); `visible: true` shows it
171
171
  again from a later tier. Hiding a part while a named condition holds is the
172
172
  part's own `at: { "<condition>": { visible } }`, below.
173
- - Each declared cell renders exactly once (`cell-missing-or-repeated`). A cell names
174
- one owned element or public component; several or mapped instances may share a
175
- cell only when it auto-places (`start: "auto"`) at every tier.
173
+ - Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
174
+ says otherwise. A cell names one owned element or public component.
175
+ `required: false` lets it be absent (keep it in auto rows, or its pinned row
176
+ stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
177
+ list item: its instances flow (`start: "auto"` implied) over a numeric span or
178
+ `"full"`, with no start line, `end` or `row`. Several instances may also share
179
+ a cell that auto-places (`start: "auto"`) at every tier.
176
180
  - An element has at most one placement (`placement-repeated`), applied in the
177
181
  returned JSX (`placement-statement`), and a placed element carries its own recipe
178
182
  styling (`placement-without-root`). One element carries one part or cell marker.
@@ -150,23 +150,28 @@ a recipe never creates a state machine.
150
150
  surface and its state surfaces, timed by a motion profile with a `static`
151
151
  reduced-motion policy. A channel that does not change, an effect that changes
152
152
  without its channel, or a gradient on the element, is rejected.
153
- - Long-form content (articles, docs, legal text, Markdown or CMS output) is a
154
- component whose recipe has `layout: "prose"`: `rhythm` for the space between
155
- blocks and `elements` naming a text, surface and frame profile per plain
156
- element (`paragraph`, `heading2`, `link`, `list`, `item`, `quote`, `rule`,
157
- `pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
158
- (`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
159
- never descendant CSS of your own. Declare every element the content uses.
160
- A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
161
- heading closer to its text); `list` takes `markers` (a shape per depth of
162
- nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
163
- `component` gives every component placed among the blocks its space before
164
- and after.
165
- Only classless elements are styled, so do not put classes on content. For
166
- content that arrives as an HTML string, add a second component on the same
167
- recipe that injects it (`ProseHtml({ html })`); the application passes the
168
- string as a prop and sanitises it first.
169
- - `enter: { from: { surface, translate | scale | rotate }, motion }` on a root
153
+ - Long-form content (articles, docs, legal text, Markdown or CMS output) is
154
+ built from the design system's own components: `Heading`, `Paragraph`,
155
+ `Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
156
+ normal owner. A pattern places them: a `stack` whose parts are placed
157
+ components (`kind: "component"`, `repeat: true`, `required: false`), in any
158
+ order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
159
+ heading one `sectionGap` from what precedes it). The content arrives as a
160
+ typed tree (a union of node types) that the pattern renders with a ternary
161
+ chain over `node.type` in its `.map` callback; an inline renderer may render
162
+ itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
163
+ sanitised) or CMS rich text to that tree; never style plain markup by tag and
164
+ never inject an HTML string. A colour that follows the container (a link in a
165
+ heading) is the container surface's `provides`, not a prop on the link. A list
166
+ item keeps its marker: give it no arrangement, and space a nested list with a
167
+ part's `spaceBefore` in its block flow.
168
+ - A colour that depends on where an element sits (links and icons in a tinted
169
+ banner, the cells of a selected row, actions on a dark card) is a contextual
170
+ role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
171
+ The children read their own roles and need no prop; composed contrast proves
172
+ their text there. Do not add a `tone` prop for a container's colour; keep
173
+ `tone` for a background the design system cannot know (a photo).
174
+ - `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
170
175
  or a region part is an entrance on first render: the element starts from a
171
176
  surface that states only `opacity` and `blur`, and at most one movement read
172
177
  from the entrance's motion profile, then settles. See the motion reference.
@@ -175,7 +180,12 @@ a recipe never creates a state machine.
175
180
  separate owner only to give an element padding, a border or a size. The
176
181
  drawn box of a checkbox, radio or switch whose native `<input>` is hidden
177
182
  takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
178
- drawn on the box while the input has keyboard focus. A visual part may sit
183
+ drawn on the box while the input has keyboard focus. The input's part,
184
+ declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
185
+ no room and lies, invisible, over the box at the box's frame size, so pointer
186
+ and keyboard still reach the real input. A part rendered once per list item
187
+ (`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
188
+ construction, and `extent: "fill"` shares the row among them. A visual part may sit
179
189
  inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
180
190
  `recipe.assets.<name>.source`), which one nested part of the recipe has. On a
181
191
  visual part the frame's size is the box and the drawing keeps its visual
@@ -73,3 +73,4 @@ Load only the guide(s) for the requested transition.
73
73
  | 0.4.7 | 0.5.0, grids | [Grids and layout: spatial profiles, grid recipes, named conditions, subgrid rows](references/0.4.7-to-0.5.0-grid.md) (supersedes section 10 of the 0.4.1 → 0.4.2 guide; the rest of the 0.5.0 migration is the guide above) |
74
74
  | 0.5.0 | 0.5.1 | [The text keyline check, surface effects, entrances and font fallback metrics](references/0.5.0-to-0.5.1.md) |
75
75
  | 0.5.1 | 0.5.2 | [Two emitted-CSS fixes, checks that now accept what they refused, a TypeScript configuration error that is now reported, the render audit measuring owner states by itself (and which audit-only scenario states can go), and new state, geometry, surface, outset, focus, control and prose language](references/0.5.1-to-0.5.2.md) |
76
+ | 0.5.2 | 0.5.3 | [Prose becomes content components, contextual roles (`provides`), fixed-size frames keep their size, workarounds that can go (design state, heading levels, drawn inputs, repeated parts and cells, optional cells, corner radii, inline entrances, the target spacing exception, hidden glyphs), and composed contrast through plain modules](references/0.5.2-to-0.5.3.md) |
@@ -0,0 +1,71 @@
1
+ # ADS 0.5.2 → 0.5.3
2
+
3
+ One required change: Prose (`layout: "prose"`) is retired, so a design system
4
+ that has a prose recipe converts it to content components (below). Otherwise no
5
+ source change is required. One fix changes emitted CSS for frames that
6
+ state a size. Several checks now accept what they refused, so workarounds can
7
+ go. The rest is new language a project adopts when it needs it. Owner analysis
8
+ moves to schema `ads-owner-analysis/12`, so the first check after the upgrade
9
+ analyses every owner again.
10
+
11
+ ## Prose becomes content components
12
+
13
+ A recipe with `layout: "prose"` now fails as an unknown layout. Long-form
14
+ content is the design system's own components placed by a content pattern; the
15
+ example design system's `patterns/Content/Content` is a complete reference.
16
+
17
+ | Prose | Now |
18
+ | --- | --- |
19
+ | `elements.paragraph`, `heading2`/`heading3`, `link`, `strong`, `emphasis`, `code` | `Paragraph`, `Heading` (`level`), `Link`, `Strong`, `Emphasis`, `InlineCode`: components, each with the text and surface profiles the element named |
20
+ | `list`, `item` (`indent`, `marker`) | `List` (`ordered`; its frame's `paddingInlineStart` is the indent) and `ListItem` (no arrangement, so the marker stays); a nested list is a part with `spaceBefore` |
21
+ | `quote`, `pre`, `rule`, `table`, `headerCell`, `cell` | `Quote`, `CodeBlock` (focusable, scrolls), `Divider`, `Table`, `TableRow`, `TableCell` (`header`) |
22
+ | `rhythm`, `spaceBefore`, `spaceAfter` on a block | the content pattern's `stack` gap, and `spaceBefore` / `spaceAfter` on its component parts (`kind: "component"`, `repeat: true`, `required: false`) |
23
+ | `elements.component` | another component part of the flow, or a component placed beside the content |
24
+ | A link coloured inside a heading | the heading's surface `provides: { "--link-ink": "<heading ink>" }` |
25
+ | Plain markup as children (`<Prose><h2>…</h2></Prose>`) | a content tree (a union of node types) the pattern renders; adapt Markdown (mdast), HTML (parsed and sanitised) or CMS rich text to it in behaviour code |
26
+ | `ProseHtml({ html })`, `dangerouslySetInnerHTML` | parse the HTML into the tree; nothing injects a string |
27
+
28
+ Application code that wrote plain markup inside a prose owner now passes the
29
+ tree, or renders the content components; `ads-guard` reports plain markup as
30
+ `design-usage/local-markup`.
31
+
32
+ ## Emitted CSS that changes
33
+
34
+ - **A frame that states a size.** A frame profile with `inlineSize` or
35
+ `blockSize` now also writes that size as the minimum on its axis
36
+ (`min-inline-size`, `min-block-size`), unless the frame states its own
37
+ minimum or a maximum there. A fixed box in a row no longer shrinks beside
38
+ long wrapping text. If a design relied on the box shrinking, give the frame
39
+ a `minInlineSize` (or `minBlockSize`) of its own, or a maximum.
40
+
41
+ Run `ads emit` and review the rendered owners whose frames state a size.
42
+
43
+ ## Checks that now accept what they refused
44
+
45
+ | Before | Now |
46
+ | --- | --- |
47
+ | A count, an element or a lookup that selects markup (`members.length > 3`, `members[3]`, `find(…)`) was "not from a finite set"; an inner owner took the result as a prop | Declare it as design state: `const overflow: "fits" \| "overflows" = …`, `const fourth: Member \| undefined = members[3]`. The inner owner can go |
48
+ | A field of an object prop choosing a look (`marks[channel.color]`) | `const color: Color = channel.color`, then `marks[color]` |
49
+ | A heading level from a prop was read as an unknown component | `const Heading = level` with `level?: "h2" \| "h3" \| "h4"` (or a constant `const Heading = "h3"`) is that heading |
50
+ | A drawn checkbox's input took its native size and the row's gap; it was hidden by hand or nested | `drawnBy: "<box part>"` on the input's part, `focus: { of: "<input part>" }` on the box |
51
+ | A full-width trigger could not put its sign at the end | `extent: "fill"` on the control's text part |
52
+ | `tabs.map(…)` could not be a part (`part-missing-or-repeated`); tabs became separate parts | `repeat: true` on the part |
53
+ | An optional element could not be a grid cell; it moved inside another cell | `required: false` on the cell (keep it in auto rows; a pinned `row` is listed for review) |
54
+ | A mapped cell needed `{ span: <column count>, start: "auto" }` per tier | `repeat: true` with `span: "full"` (or a number); `span: "full"` is also accepted with `start: "auto"` |
55
+ | A chat bubble's tail corner was squared or the radius was one value | `startStartRadius` … `endEndRadius` on the frame profile |
56
+ | An entrance could only rise; a pushed screen faded in instead | `enter: { from: { translateInline: { slot: "motion", field: "distance" } }, … }` |
57
+ | Window controls under 24 px were refused although WCAG 2.5.8's spacing exception held; they were enlarged to 24 px | Parts of one stack or inline arrangement pass when 24 px circles centred on them keep clear of each other at every gap. A control placed by another owner has no known neighbours and keeps the minimum |
58
+ | A glyph transparent at rest, shown on hover, was checked at 1:1; the fill was dropped | A fully transparent text or glyph colour has no minimum where it is transparent; its visible states keep theirs |
59
+ | A container whose links or icons need other colours (a tinted banner, a selected row) needed a `tone` prop on every child | `provides` on the container's surface (base or state): the children read their own roles |
60
+ | A plain module that places components ended composed contrast with `component-contrast-unresolved` | Its placements are followed as an owner's are; the review items go, and real failures are reported |
61
+ | A placement that leaves a prop out was paired with every value of that prop | It selects the prop's default or absence |
62
+
63
+ Revert the workarounds where the original design was wanted, run `ads check`,
64
+ and review the rendered owners.
65
+
66
+ ## Checks that can newly fail
67
+
68
+ - **Composed contrast through plain modules and left-out props.** Pairs that
69
+ were unresolved review items are now proven, so a pair that really is below
70
+ the minimum is now an error. Fix the colours, or pass the prop that selects
71
+ the intended look.
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
240
240
 
241
241
  ## Colours that depend on their surroundings
242
242
 
243
+ - **The container decides** (links and icons in a tinted banner, a heading's
244
+ links, a selected row's cells, icons and checkbox, actions on a dark card):
245
+ the container's surface profile provides the roles its children read,
246
+ `provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
247
+ on a selected row, the state's surface provides them while the state holds.
248
+ The children keep one design and need no prop. Key and value are paint
249
+ tokens; never provide a token the surface itself reads. Composed contrast
250
+ proves the children's text with the provided values on the container.
243
251
  - **Inverted regions** (a dark footer or card on a light page): declare
244
252
  `sections: true` in `foundation()` and put `data-theme="dark"` on the region.
245
253
  Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
249
257
  section's values. Contrast is already proven in every context, so a section
250
258
  needs no extra check. A section switches whole themes/brands only; a recipe's
251
259
  own token declaration on the section element wins.
252
- - **On-image or on-fill controls** (a button over a photo or brand banner): give
253
- the child a closed choice the caller sets, such as `tone?: "default" |
260
+ - **On-image controls** (a button over a photo, a background the design system
261
+ cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
254
262
  "on-dark"` mapping to a precompiled recipe with its own surface profile
255
263
  (Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
256
264
  the pair is proven and does not change with the page's theme.
257
- - **Not covered yet**: state cascading to children (a selected row's cells and
258
- icons) and tinted containers (links inside a warning banner) need a prop
259
- threaded through each child, or the surface-context construct that is planned.
260
- Do not invent a theme per state. Details and limits: the ADS tool guide,
265
+ - Do not invent a theme per state, or a `tone` prop for a container the design
266
+ system owns. Details and limits: the ADS tool guide,
261
267
  *Colours that depend on their surroundings*.
262
268
 
263
269
  ## Colors in Canvas, WebGL and SVG renderers
@@ -170,9 +170,13 @@ until that owner is fixed.
170
170
  so a visible tier keeps the element's own display); `visible: true` shows it
171
171
  again from a later tier. Hiding a part while a named condition holds is the
172
172
  part's own `at: { "<condition>": { visible } }`, below.
173
- - Each declared cell renders exactly once (`cell-missing-or-repeated`). A cell names
174
- one owned element or public component; several or mapped instances may share a
175
- cell only when it auto-places (`start: "auto"`) at every tier.
173
+ - Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
174
+ says otherwise. A cell names one owned element or public component.
175
+ `required: false` lets it be absent (keep it in auto rows, or its pinned row
176
+ stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
177
+ list item: its instances flow (`start: "auto"` implied) over a numeric span or
178
+ `"full"`, with no start line, `end` or `row`. Several instances may also share
179
+ a cell that auto-places (`start: "auto"`) at every tier.
176
180
  - An element has at most one placement (`placement-repeated`), applied in the
177
181
  returned JSX (`placement-statement`), and a placed element carries its own recipe
178
182
  styling (`placement-without-root`). One element carries one part or cell marker.
@@ -150,23 +150,28 @@ a recipe never creates a state machine.
150
150
  surface and its state surfaces, timed by a motion profile with a `static`
151
151
  reduced-motion policy. A channel that does not change, an effect that changes
152
152
  without its channel, or a gradient on the element, is rejected.
153
- - Long-form content (articles, docs, legal text, Markdown or CMS output) is a
154
- component whose recipe has `layout: "prose"`: `rhythm` for the space between
155
- blocks and `elements` naming a text, surface and frame profile per plain
156
- element (`paragraph`, `heading2`, `link`, `list`, `item`, `quote`, `rule`,
157
- `pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
158
- (`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
159
- never descendant CSS of your own. Declare every element the content uses.
160
- A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
161
- heading closer to its text); `list` takes `markers` (a shape per depth of
162
- nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
163
- `component` gives every component placed among the blocks its space before
164
- and after.
165
- Only classless elements are styled, so do not put classes on content. For
166
- content that arrives as an HTML string, add a second component on the same
167
- recipe that injects it (`ProseHtml({ html })`); the application passes the
168
- string as a prop and sanitises it first.
169
- - `enter: { from: { surface, translate | scale | rotate }, motion }` on a root
153
+ - Long-form content (articles, docs, legal text, Markdown or CMS output) is
154
+ built from the design system's own components: `Heading`, `Paragraph`,
155
+ `Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
156
+ normal owner. A pattern places them: a `stack` whose parts are placed
157
+ components (`kind: "component"`, `repeat: true`, `required: false`), in any
158
+ order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
159
+ heading one `sectionGap` from what precedes it). The content arrives as a
160
+ typed tree (a union of node types) that the pattern renders with a ternary
161
+ chain over `node.type` in its `.map` callback; an inline renderer may render
162
+ itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
163
+ sanitised) or CMS rich text to that tree; never style plain markup by tag and
164
+ never inject an HTML string. A colour that follows the container (a link in a
165
+ heading) is the container surface's `provides`, not a prop on the link. A list
166
+ item keeps its marker: give it no arrangement, and space a nested list with a
167
+ part's `spaceBefore` in its block flow.
168
+ - A colour that depends on where an element sits (links and icons in a tinted
169
+ banner, the cells of a selected row, actions on a dark card) is a contextual
170
+ role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
171
+ The children read their own roles and need no prop; composed contrast proves
172
+ their text there. Do not add a `tone` prop for a container's colour; keep
173
+ `tone` for a background the design system cannot know (a photo).
174
+ - `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
170
175
  or a region part is an entrance on first render: the element starts from a
171
176
  surface that states only `opacity` and `blur`, and at most one movement read
172
177
  from the entrance's motion profile, then settles. See the motion reference.
@@ -175,7 +180,12 @@ a recipe never creates a state machine.
175
180
  separate owner only to give an element padding, a border or a size. The
176
181
  drawn box of a checkbox, radio or switch whose native `<input>` is hidden
177
182
  takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
178
- drawn on the box while the input has keyboard focus. A visual part may sit
183
+ drawn on the box while the input has keyboard focus. The input's part,
184
+ declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
185
+ no room and lies, invisible, over the box at the box's frame size, so pointer
186
+ and keyboard still reach the real input. A part rendered once per list item
187
+ (`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
188
+ construction, and `extent: "fill"` shares the row among them. A visual part may sit
179
189
  inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
180
190
  `recipe.assets.<name>.source`), which one nested part of the recipe has. On a
181
191
  visual part the frame's size is the box and the drawing keeps its visual
@@ -268,8 +268,8 @@ function expand(css, model) {
268
268
  delete next.span;
269
269
  state = next;
270
270
  const count = inherited?.[index] ?? Number(props.columns ?? point.count), auto = state.start === "auto", start = auto ? 1 : integer(state.start);
271
- if (auto && (state.end !== void 0 || state.span === "full"))
272
- fail(`${cell.params} auto placement needs a numeric span; end and full need a start line.`);
271
+ if (auto && state.end !== void 0)
272
+ fail(`${cell.params} auto placement takes a span; end needs a start line.`);
273
273
  const span = state.end !== void 0 ? integer(state.end) - start : state.span === "full" ? count - start + 1 : integer(state.span);
274
274
  if (!Number.isInteger(start) || !Number.isInteger(span) || span < 1 || start + span - 1 > count)
275
275
  fail(`${cell.params} placement ${state.start}/${state.end !== void 0 ? `end ${state.end}` : String(state.span)} exceeds ${count} columns at ${point.name}.`);
@@ -2,7 +2,7 @@ import { INACTIVE_STATE, SURFACE_STATE } from "./role-vocabulary.mjs";
2
2
  import { selectedProfile, tokenValueContexts } from "./design-foundation.mjs";
3
3
  import { lengthPx } from "./css-length.mjs";
4
4
  import { resolveTokenValue } from "./token-resolution.mjs";
5
- import { BOLD_WEIGHT, inactiveCondition, LARGE_BOLD_TEXT_PX, LARGE_TEXT_MINIMUM, LARGE_TEXT_PX, NON_TEXT_MINIMUM, paintContrast, reachablePairs, TEXT_MINIMUM } from "./paint-contrast.mjs";
5
+ import { BOLD_WEIGHT, inactiveCondition, LARGE_BOLD_TEXT_PX, LARGE_TEXT_MINIMUM, LARGE_TEXT_PX, NON_TEXT_MINIMUM, paintContrast, reachablePairs, TEXT_MINIMUM, unshown } from "./paint-contrast.mjs";
6
6
  import { err, ok } from "./result.mjs";
7
7
  const PAINT_FIELDS = ["color", "background", "background-image", "opacity"], paintsOf = (fields) => ({
8
8
  foreground: fields.color ?? null,
@@ -31,6 +31,8 @@ export function surfaceContrastFindings(foundation) {
31
31
  const [profile = "", ...shared] = profiles, composed = foundation.model.compose(profile), file = composed.kind === "ok" ? composed.value.file ?? null : null, failing = [], unprovable = [], placed = [];
32
32
  let first = null, reason = null;
33
33
  for (const context of contexts) {
34
+ if (unshown(paints.foreground, context))
35
+ continue;
34
36
  const outcome = paintContrast(context, paints, TEXT_MINIMUM);
35
37
  switch (outcome.kind) {
36
38
  case "sufficient":
@@ -127,7 +129,7 @@ export function sufficientForUses(foundation, paints, uses) {
127
129
  return !1;
128
130
  return tokenValueContexts(foundation).every((context) => {
129
131
  const minimum = Math.max(...uses.map((use) => useMinimum(use, context)));
130
- return minimum === 0 || paintContrast(context, paints, minimum).kind !== "insufficient";
132
+ return minimum === 0 || unshown(paints.foreground, context) || paintContrast(context, paints, minimum).kind !== "insufficient";
131
133
  });
132
134
  }
133
135
  function textProfile(foundation, reference) {
@@ -234,6 +236,8 @@ export function stateContrast(foundation, spec, content = () => "text") {
234
236
  let noted = !1;
235
237
  contexts ??= tokenValueContexts(foundation);
236
238
  for (const context of contexts) {
239
+ if (unshown(paints.foreground, context))
240
+ continue;
237
241
  const outcome = paintContrast(context, paints, painted === "graphic" ? NON_TEXT_MINIMUM : textMinimum(text, context));
238
242
  switch (outcome.kind) {
239
243
  case "sufficient":
@@ -94,7 +94,7 @@ export function targetSizeFindings(foundation, targets) {
94
94
  const key = JSON.stringify(targets), cached = byFacts.get(key);
95
95
  if (cached !== void 0)
96
96
  return cached;
97
- const contexts = tokenValueContexts(foundation), findings = [...targets.elements.flatMap((element) => elementFindings(element, contexts)), ...targets.neighbours.flatMap((pair) => overlapFindings(pair, contexts))];
97
+ const contexts = tokenValueContexts(foundation), findings = [...targets.elements.flatMap((element) => elementFindings(element, contexts, targets.neighbours.filter((pair) => pair.first.element === element.element || pair.second.element === element.element))), ...targets.neighbours.flatMap((pair) => overlapFindings(pair, contexts))];
98
98
  byFacts.set(key, findings);
99
99
  return findings;
100
100
  }
@@ -115,7 +115,22 @@ function contentWidth(content) {
115
115
  return "the width of the native element's own content";
116
116
  }
117
117
  }
118
- function elementFindings(geometry, contexts) {
118
+ const undersized = (box) => box.block < TARGET_MIN_PX || box.inline.px < TARGET_MIN_PX;
119
+ function spaced(geometry, pairs, context) {
120
+ if (pairs.length === 0)
121
+ return !1;
122
+ const radius = TARGET_MIN_PX / 2;
123
+ return pairs.every((pair) => {
124
+ const own = measure(geometry, context), other = measure(pair.first.element === geometry.element ? pair.second : pair.first, context), gap = lengthPx(pair.gap, context);
125
+ if (own.kind !== "measured" || other.kind !== "measured" || gap.kind !== "px")
126
+ return !1;
127
+ const along = (box) => pair.axis === "inline" ? box.inline.px : box.block, half = along(own.size.target) / 2, otherHalf = along(other.size.target) / 2;
128
+ if (half + gap.px < radius)
129
+ return !1;
130
+ return !undersized(other.size.target) || half + gap.px + otherHalf >= TARGET_MIN_PX;
131
+ });
132
+ }
133
+ function elementFindings(geometry, contexts, pairs) {
119
134
  const failing = new Tally, unproven = new Tally;
120
135
  for (const context of contexts) {
121
136
  const read = measure(geometry, context);
@@ -125,7 +140,10 @@ function elementFindings(geometry, contexts) {
125
140
  break;
126
141
  case "measured": {
127
142
  const { block, inline } = read.size.target;
128
- if (block < TARGET_MIN_PX || inline.exact && inline.px < TARGET_MIN_PX)
143
+ if (undersized(read.size.target) && spaced(geometry, pairs, context)) {
144
+ if (geometry.measured.length > 0)
145
+ unproven.add(context.label, `its ${geometry.measured.map((bound) => `${bound.property} is measured at runtime ("${bound.name}", ${bound.fallback} before it is set)`).join(" and ")}`);
146
+ } else if (block < TARGET_MIN_PX || inline.exact && inline.px < TARGET_MIN_PX)
129
147
  failing.add(context.label, { blockPx: block, inlinePx: inline.px, inlineExact: inline.exact });
130
148
  else if (inline.px < TARGET_MIN_PX)
131
149
  unproven.add(context.label, `its inline extent is ${px(inline.px)} plus ${contentWidth(geometry.content)}`);