@reqvire-org/ads 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) 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 +35 -3
  7. package/dist/analysis/owner-composition.mjs +75 -13
  8. package/dist/analysis/owner-source.mjs +64 -40
  9. package/dist/composed-contrast.mjs +165 -65
  10. package/dist/construction-output.mjs +12 -5
  11. package/dist/construction-spec.d.mts +125 -50
  12. package/dist/construction-spec.mjs +154 -81
  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-overlaps.mjs +6 -1
  20. package/dist/lowering-properties.mjs +3 -0
  21. package/dist/lowering-session.mjs +10 -0
  22. package/dist/lowering-transitions.mjs +1 -0
  23. package/dist/mcp/server-observation.mjs +6 -4
  24. package/dist/mcp/server-project.mjs +4 -1
  25. package/dist/owner-analysis-check.mjs +4 -1
  26. package/dist/owner-errors.mjs +2 -1
  27. package/dist/owner-lowering.mjs +10 -4
  28. package/dist/owner-scenarios.mjs +2 -22
  29. package/dist/ownership-model.mjs +15 -7
  30. package/dist/paint-contrast.mjs +6 -0
  31. package/dist/platform-features.mjs +6 -0
  32. package/dist/profile-macro.d.mts +7 -0
  33. package/dist/recipe-macro.d.mts +104 -45
  34. package/dist/recipe-model.mjs +19 -12
  35. package/dist/region-lowering.mjs +128 -121
  36. package/dist/role-vocabulary.d.mts +7 -0
  37. package/dist/role-vocabulary.mjs +7 -0
  38. package/dist/runtime-paint-contrast.mjs +5 -2
  39. package/dist/showcase/client.bundle.js +51 -51
  40. package/dist/showcase/http-client.bundle.js +13 -13
  41. package/dist/showcase/ui/ui.css +1 -1
  42. package/dist/showcase/ui/ui.js +6 -6
  43. package/dist/skills/ads-designer/references/accessibility.md +3 -4
  44. package/dist/skills/ads-designer/references/design-data.md +12 -6
  45. package/dist/skills/ads-designer/references/layout.md +7 -3
  46. package/dist/skills/ads-designer/references/motion.md +2 -1
  47. package/dist/skills/ads-designer/references/recipes.md +43 -19
  48. package/dist/skills/ads-import/references/design-data.md +12 -6
  49. package/dist/skills/ads-import/references/layout.md +7 -3
  50. package/dist/skills/ads-import/references/recipes.md +43 -19
  51. package/dist/skills/ads-migrate/SKILL.md +2 -0
  52. package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
  53. package/dist/skills/ads-migrate/references/0.5.3-to-0.5.4.md +42 -0
  54. package/dist/skills/ads-port/references/design-data.md +12 -6
  55. package/dist/skills/ads-port/references/layout.md +7 -3
  56. package/dist/skills/ads-port/references/recipes.md +43 -19
  57. package/dist/spatial-model.mjs +2 -2
  58. package/dist/surface-contrast.mjs +6 -2
  59. package/dist/target-size.mjs +21 -3
  60. package/docs/ADS.md +9 -3
  61. package/docs/ARCHITECTURE.md +33 -23
  62. package/docs/CACHING.md +1 -1
  63. package/docs/CHANGELOG.md +181 -21
  64. package/docs/GUIDE.md +64 -19
  65. package/docs/LANGUAGE.md +169 -139
  66. package/docs/MCP.md +5 -1
  67. package/docs/MOTION.md +16 -3
  68. package/docs/PROFILE-KINDS.md +52 -5
  69. package/docs/RULES.md +16 -15
  70. package/package.json +1 -1
  71. package/dist/analysis/prose-owners.mjs +0 -57
  72. package/dist/prose-model.d.mts +0 -81
  73. package/dist/prose-model.mjs +0 -101
package/docs/LANGUAGE.md CHANGED
@@ -8,7 +8,7 @@ from `/profile`, `recipe()` and `combineRecipes()` from `/recipe`, `asset()`,
8
8
  `ads check` reads the declarations and `ads emit` compiles them to plain
9
9
  TypeScript and CSS; ADS does not run in the application. The examples come
10
10
  from the example design system, the one ADS is tested with (in its repository,
11
- under `tests/fixtures/starter-project/`); `ads init` installs no design system.
11
+ under `tests/fixtures/example-project/`); `ads init` installs no design system.
12
12
  [RULES.md](RULES.md) lists every rule.
13
13
 
14
14
  ## The authoring invariant
@@ -236,11 +236,25 @@ them all.
236
236
  | frame profile `paddingInlineStart` / `paddingInlineEnd` / `paddingBlockStart` / `paddingBlockEnd` | container frame, control frame | one side's inset, where the two sides of an axis differ (a tag padded more before its remove button). On a control frame a block side's inset is its least inset, and `minimumBlockInset` is the block axis's field | the profile also sets that side's axis or `padding`; on a control frame, a block inset beside `minimumBlockInset` (`construction/frame-field-conflict`) |
237
237
  | `frame: { profile: "<frame profile>" }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (`box-sizing: border-box`); on a visual part bound to artwork the profile's `inlineSize`/`blockSize` are the box (a disc behind a mark) and the drawing keeps its visual profile's size, centred in it | another field beside `profile`; a frame field the profile misuses, as on a root |
238
238
  | `frame: { rules: ["block-end", …] }` (root), `frame: { kind: "control", rules: [...] }` (control part) | region root, control part | the profile's `border-width`, solid, on the named logical sides only, painted by the element's surface `border-color` (mirrors in RTL); on a control part an unruled side keeps the border's space as inset, so the box and its text do not move (a soft field's underline) | empty or repeated sides; no profile width (`rule-width-missing`); no surface border colour (`rule-paint-missing`); on a grid |
239
- | `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a frame profile without `radius` (`profile-field-missing`) |
239
+ | `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` (or the corner's own, below) on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a named corner with no radius in the frame profile (`profile-field-missing`) |
240
+ | frame profile `startStartRadius` / `startEndRadius` / `endStartRadius` / `endEndRadius` | region root, part box | that corner's radius in place of the profile's `radius` (a chat bubble's small tail corner), all four as `border-<corner>-radius`; a corner with neither is square | a control frame (`profile-field-unsupported`) |
240
241
  | `at: { <condition>: { frame: { rules?, corners? } } }` | region root with a `frame` | under the named condition of the root's spatial profile (`@media (width < bound)`), only the border and corner writes that differ: a divider that is the block-end edge when wide and the inline-start edge when narrow | a condition the spatial profile does not name (`construction/condition-unknown`); `rules` under the condition without `rules` on the frame; more than one condition |
241
242
  | `accessibility: { boundary: "visible-label" \| "boundary-on-interaction", reason }` | control part (`frame: "control"`, a text-like input, textarea or select) | nothing: its border contrast error becomes the review item `boundary-identified-otherwise`; acceptance enforces human approval | another kind, a reason outside 20–300 characters (`accessibility-declaration-invalid`); another part (`accessibility-declaration-unsupported`); an approver, date or other field (`field-unsupported`) |
242
243
  | `focus: { of: "<sibling part>" }` | region part | the nearest focus profile's outline on this part while the named part of the same parent has keyboard focus (`<parent>:has(> <control>:focus-visible) > <part>`): the drawn box of a checkbox, radio or switch whose native `<input>` is visually hidden. The owner keeps the native control focusable and in the same parent | `of` names the part itself or no part of the same parent (`spec/value-invalid`) |
243
- | `anchorClear: { slot: "layer", field: "clearBlockStart" }` or `{ slot: "spacing", field: "anchorGap" }` | root (not a top-layer root), part, prose block element | `scroll-margin-block-start`: where a jump to the element (a fragment link, `scrollIntoView`) lands below the top of its scroll container. The layer profile's `clearBlockStart` puts it right under the region sticky elements clear; the spacing profile's `anchorGap` is the element's own distance, for a target that lines up with something beside it (a heading level with a sticky side column). Layout is unchanged. ADS does not check that the distance clears what is stuck on the page the owner ends up in | another slot or field (`spec/value-invalid`); on a top-layer root or an inline prose element (`spec/field-unsupported`) |
244
+ | `drawnBy: "<sibling part>"` | region part holding a native control | the native control (a checkbox's `<input>`) is drawn by the named part: `position: absolute`, the drawing part's frame `inlineSize` and `blockSize`, no margin, `opacity: 0`, laid over that part, so it takes no room in the row and pointer and keyboard still reach the real control. Its states still reach the drawing part (`:has(> .input:checked)`) | the named part is not declared right after it, does not show its focus (`focus: { of }`) (`spec/value-invalid`), or its frame states no `inlineSize` or `blockSize` (`profile-field-missing`) |
245
+ | `repeat: true` | region part (not a vector) | nothing of its own: the part's element renders once per item of a list (`tabs.map(…)`), any number of times (at least once when `required`), each instance taking the part's construction (`extent: "fill"` shares the row among them); a repeated `frame: "control"` part neighbours its own next instance, so their hit areas and spacing are checked across the gap | with `drawnBy` or `focus`, or named by another part's (`spec/value-invalid`); without it, a mapped part (`part-missing-or-repeated`) |
246
+ | `kind: "component"` | region part | a public component placed with the part's marker (`<Heading className="ds-content-heading" …/>`), as a grid cell is: its interior is its owner's, so the part states placement only (`required`, `repeat`, `extent`, `at`, `spaceBefore`, `spaceAfter`) | any other field (`spec/field-unsupported`); a forwarded `className` that carries a recipe (`source/foreign-interior`) |
247
+ | `spaceBefore` / `spaceAfter: { slot: "spacing", field }` | part of a `stack`, or of a parent without an arrangement (block flow: a list item that keeps its marker) | the part's own space before it and after it, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it); where one part's space after meets the next part's space before, the larger applies; the first part starts flush | another parent layout (`space-parent-unsupported`) |
248
+ | `spacing: "<spacing profile>"` | part of a `stack` or block flow | the part's space before and after it from that profile's `spaceBefore` and `spaceAfter` fields, where a flow needs more distances than one spacing profile holds (a heading 44 px above and 14 px below, 24 px after a quote); the same "larger of the two" rule | a profile that states neither field (`profile-field-missing`) |
249
+ | a part rendered as `p`, `h1`–`h6`, `ul`, `ol`, `dl`, `dd`, `blockquote`, `figure`, `pre`, `hr`, `menu` | region part | `margin: 0`: the arrangement owns the space around a part, so the browser's margin is reset; a part that states its own margin (`normalize: { margin: 0 }`, now allowed on parts too) keeps it | n/a |
250
+ | `between: { surface, frame }` | root, part | a rule between consecutive children: the frame profile's `borderWidth` and `borderStyle`, painted by the surface's `borderColor`, on `& > * + *` (`border-block-start`, or `border-inline-start` in a row): a hairline between table rows or settings rows, none after the last | a frame without `borderWidth` or a surface without `borderColor` (`profile-field-missing`) |
251
+ | `presence: "assistive"` | part | hidden on screen and still read by assistive technology (a table caption, a skip link's text): a one-pixel clipped box out of the flow | n/a |
252
+ | `pseudo: { marker: { surface?, text?, content?, when? } }` | root or part rendered as `li` or `summary` | `::marker`: a colour-only surface (and its states), a text profile of weight and numerals (`fontWeight`, `fontFeatureSettings`), generated content; its contrast is proven where the item is placed (3:1 for a bullet, the text minimum for a number) | another host (`pseudo-host-unsupported`); a surface or text profile that states more (`pseudo-surface-unsupported`) |
253
+ | `pseudo: { before: { content, surface?, text?, when? } }` | root or part that is not a replaced element | `::before` with generated content (a section number), in its colour and weight; proven as text | an `img`, `input`, `select`, `textarea`, `video`, `iframe`, `br`, `hr` or `svg` host (`pseudo-host-unsupported`) |
254
+ | `content: { counter \| counters: "<name>", style?, separator?, prefix?, suffix? }` | a `marker` or `before` treatment | `content: counter(name, style)` or `counters(name, "sep", style)` (1.1.2) between quoted literals; `style` is a number system (`decimal`, `decimal-leading-zero`, `lower-alpha`, `upper-alpha`, `lower-roman`, `upper-roman`) | a literal longer than four characters or with letters, `separator` with `counter`, a CSS keyword as a name (`spec/value-invalid`) |
255
+ | `counter: { reset?, increment? }` | root, part | `counter-reset` where a count starts, `counter-increment` on what it counts; names are shared across components (a `List` resets, a `ListItem` increments); `list-item` is the browser's own list counter | a CSS keyword as a name (`spec/value-invalid`) |
256
+ | `markers: [<style per depth>]` | a list root | `list-style-type` on the list and on the same list nested at each depth (`& li &`), outermost first; deeper lists keep the last: bullets (`disc`, `circle`, `square`, `none`) or a number system | more than three, or an unknown style (`spec/value-invalid`) |
257
+ | `anchorClear: { slot: "layer", field: "clearBlockStart" }` or `{ slot: "spacing", field: "anchorGap" }` | root (not a top-layer root), part | `scroll-margin-block-start`: where a jump to the element (a fragment link, `scrollIntoView`) lands below the top of its scroll container. The layer profile's `clearBlockStart` puts it right under the region sticky elements clear; the spacing profile's `anchorGap` is the element's own distance, for a target that lines up with something beside it (a heading level with a sticky side column). Layout is unchanged. ADS does not check that the distance clears what is stuck on the page the owner ends up in | another slot or field (`spec/value-invalid`); on a top-layer root (`spec/field-unsupported`) |
244
258
  | `overflow: "clip" \| "scroll-block" \| "scroll-inline" \| "scroll-both"` | root, part | `overflow` (physical x/y pair of the horizontal writing mode) and a released axis minimum | on a top-layer root (`profile-provider-conflict`); with truncation |
245
259
  | `align` / `justify` on an element that scrolls | root, part | `safe center` / `safe end` on the axis the element itself scrolls: content stays aligned while it fits and starts at the scroll origin when it overflows, so its start is never unreachable | n/a (automatic) |
246
260
  | a rounded frame (`radius`) with visible overflow | region root | n/a | a first or last part of a stack, or a layer, that paints a background over a corner with no inset there (`construction/corner-overpaint`): clip the root, inset it, or round the part |
@@ -261,6 +275,7 @@ them all.
261
275
  | `wrap: "truncate", lines: 2 \| 3` | text part | a clamp: at most N lines, the last ending in "…" (`line-clamp` beside `display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp`, `overflow: hidden`) | `lines: 1` or another value (one line is plain `truncate`); `reserveLines` above `lines` (`spec/value-invalid` at `reserveLines`, naming both); `lines` with another `wrap`; on a declared `element`; an arrangement's display (`extent-conflict`); on, or inside, a control or form label (`source/clamp-on-control`) |
262
276
  | control label `wrap`: absent, `true`/`"anywhere"`, `"never"` | control text part | breaks between words when one word alone would overflow (`overflow-wrap: break-word`, the default), anywhere, or never: one line, and the control does not shrink below the label's width | `"truncate"` or another value |
263
277
  | control label `textAlign: "start" \| "center" \| "end"` | control text part | `text-align` on the label: how its lines sit once it wraps or the control is wider than it | another value |
278
+ | control label `extent: "fill"` | control text part of an `inline` control | the label takes the room the control's other content leaves (`flex: 1 1 0%`), so a visual after it stands at the far end: a full-width disclosure trigger with its sign at the edge | a control whose layout is not `inline` |
264
279
  | `kind: "vector", surface, stroke: { slot: "visual", field }` | part | `stroke` from a colour-only surface, `stroke-width` from the visual profile, `fill: none`, non-scaling stroke; any number of data-driven shapes | a surface with other fields (`vector-surface-unsupported`); not an SVG shape under an owned `<svg>` |
265
280
  | `kind: "visual", media: "inspected-svg"` | part | contains the inserted drawing within the visual profile's size; its intrinsic size is data | markup, children or `dangerouslySetInnerHTML` in the part (`source/inspected-svg-inline`); the owner parses markup (`source/inspected-svg-parsed`) |
266
281
 
@@ -315,9 +330,14 @@ disabled, `&[aria-busy="true"]`, `&[data-user-invalid]`, `&[data-autofill]` and
315
330
  A `when` entry may also select the element's text: `when: {
316
331
  '&[aria-pressed="true"]': { text: "label-strong" } }` on a text part, a root
317
332
  or a control. The state's text profile may differ from the element's own in
318
- `fontWeight` and `letterSpacing` only (`construction/state-text-field`
319
- otherwise), so the line and the box's height stay where they are. A heavier
320
- weight is wider: whether the box may grow with it is the designer's choice.
333
+ `fontWeight`, `letterSpacing` and the underline (`textDecorationColor`,
334
+ `textDecorationThickness`, `textUnderlineOffset`: a link whose underline a hover
335
+ thickens) only (`construction/state-text-field` otherwise), so the line and the
336
+ box's height stay where they are. A heavier weight is wider: whether the box may
337
+ grow with it is the designer's choice. A weight or tracking change needs the
338
+ element's own text profile; an underline change does not. An underline colour
339
+ that also fades is a paint: `textDecorationColor` on the surfaces, with the
340
+ `text-decoration-color` channel of `paintTransition`.
321
341
 
322
342
  A state of one of the recipe's own direct parts is also a state of the root,
323
343
  written `:has(> .part:state)` with `:checked`, `:indeterminate`,
@@ -325,9 +345,10 @@ written `:has(> .part:state)` with `:checked`, `:indeterminate`,
325
345
 
326
346
  ```ts
327
347
  parts: {
328
- input: { selector: ".ds-checkbox-input" }, // the native <input type="checkbox">
348
+ input: { selector: ".ds-checkbox-input", drawnBy: "box" }, // the native <input type="checkbox">, laid over the box
329
349
  box: {
330
350
  selector: ".ds-checkbox-box", surface: "control-surface",
351
+ frame: { profile: "checkbox-box" }, // the box's size: also the input's
331
352
  focus: { of: "input" }, // the focus profile's outline, drawn on the box
332
353
  when: {
333
354
  "&:has(> .ds-checkbox-input:checked)": { surface: "action-surface" },
@@ -337,7 +358,11 @@ parts: {
337
358
  }
338
359
  ```
339
360
 
340
- A checkbox's drawn box follows its native input without script, and a field's
361
+ A checkbox's drawn box follows its native input without script. The input is
362
+ declared right before its box with `drawnBy`: it takes no room in the row and
363
+ lies, invisible, over the box at the box's size, so a press on the box is a
364
+ press on the input and the label (a `<label>` root) starts one gap after the
365
+ box. A field's
341
366
  control reacts to its own hover (`&:has(> .ds-field-control:hover)`), not to
342
367
  the label's. The class must be a direct part of the recipe, and nothing else
343
368
  goes inside `:has()`.
@@ -508,151 +533,95 @@ given, unless a code is named.
508
533
  interpolates to a content size (`interpolate-size`); elsewhere it opens at
509
534
  once, with the same result.
510
535
  - **What a state cannot change:** the layout kind, a grid's tracks, a text
511
- profile's size (a state text profile still changes weight and tracking
512
- only). A hover state that resizes an element in flow moves what follows it:
536
+ profile's size (a state text profile still changes weight, tracking and
537
+ the underline only). A hover state that resizes an element in flow moves what follows it:
513
538
  that is the designer's choice, and ADS does not refuse it; it is listed for
514
539
  review (`review/hover-geometry-shift`). A layer of a layered parent draws over
515
540
  its neighbours and is not listed.
516
541
 
517
- ## Prose: long-form content
542
+ ## Long-form content: components in a flow
518
543
 
519
544
  Articles, documentation, legal text and anything a content system or Markdown
520
- produces is markup the owner does not write. A recipe with `layout: "prose"`
521
- styles it: a closed set of plain flow elements inside its root, wherever they
522
- nest.
545
+ produces are assembled from the design system's own components, checked as any
546
+ component is. There is no styling by tag: a paragraph, a heading, a link and a
547
+ list are components (`Paragraph`, `Heading`, `Link`, `List`), the same ones the
548
+ rest of the interface uses, and a pattern places them.
549
+
550
+ Three general capabilities assemble them:
551
+
552
+ 1. **A flow of parts.** A stack whose parts are placed public components
553
+ (`kind: "component"`, matched by the marker the placement passes in
554
+ `className`, as a grid cell is), each `repeat`ed and optional, in any order.
555
+ A part's `spaceBefore` and `spaceAfter` replace the stack's gap on that side:
556
+ a heading stands further from what precedes it, and where one part's space
557
+ after meets the next part's space before the larger applies. The first part
558
+ starts flush.
559
+ 2. **A finite choice over node types.** The design system defines its content
560
+ tree as a TypeScript union (block nodes, inline nodes) and renders it with a
561
+ ternary chain over `node.type` inside the `.map` callback, so every node type
562
+ is a finite choice ADS checks. A renderer may place itself (a quote holds
563
+ blocks, strong text holds inline nodes): ADS follows each recursive placement.
564
+ 3. **Contextual roles.** A container's surface profile `provides` the paint
565
+ roles its subtree reads differently ([PROFILE-KINDS](PROFILE-KINDS.md#surface)):
566
+ a heading's surface provides the link ink, so a link inside it takes the
567
+ heading's ink with no prop on the link and no rule written into it.
523
568
 
524
569
  ```ts
525
- const article = recipe({
526
- layout: "prose",
527
- profile: "article", // spacing and surface slots, as any recipe
528
- rhythm: { slot: "spacing", field: "contentGap" }, // the space between blocks
529
- elements: {
530
- paragraph: { text: "body" },
531
- heading2: { text: "heading-2", spaceBefore: { slot: "spacing", field: "sectionGap" } },
532
- link: { surface: "link", when: { "&:hover": { surface: "link-hover" } } },
533
- strong: { text: "body-strong" },
534
- list: { indent: { slot: "spacing", field: "indent" } },
535
- item: { marker: "list-marker" },
536
- quote: { surface: "quote", frame: "quote-frame" },
537
- rule: { surface: "divider", frame: "divider-frame" },
538
- pre: { surface: "code-block", text: "code" },
570
+ // The flow: blocks in any order and number, a heading one section gap from what precedes it.
571
+ const flow = recipe({
572
+ layout: "stack",
573
+ profile: "article", // a composite: { spacingProfile, frameProfile }
574
+ frame: {},
575
+ parts: {
576
+ heading: { selector: ".ds-content-heading", kind: "component", repeat: true, required: false, spaceBefore: { slot: "spacing", field: "sectionGap" } },
577
+ paragraph: { selector: ".ds-content-paragraph", kind: "component", repeat: true, required: false },
578
+ list: { selector: ".ds-content-list", kind: "component", repeat: true, required: false },
539
579
  },
540
580
  }).root;
541
581
 
542
- export function Prose({ children }: { children: ReactNode }) {
543
- return <div className={article}>{children}</div>;
582
+ export function Content({ blocks }: { blocks: readonly BlockNode[] }) {
583
+ return (
584
+ <div className={flow}>
585
+ {blocks.map((node, index) =>
586
+ node.type === "heading" ? <Heading key={index} className="ds-content-heading" level={node.level}><ContentText inline={node.children} /></Heading>
587
+ : node.type === "paragraph" ? <Paragraph key={index} className="ds-content-paragraph"><ContentText inline={node.children} /></Paragraph>
588
+ : <List key={index} className="ds-content-list" ordered={node.ordered}>…</List>,
589
+ )}
590
+ </div>
591
+ );
544
592
  }
545
593
  ```
546
594
 
547
- ```tsx
548
- <Prose>
549
- <h2>Title</h2>
550
- <p>Text with a <a href="/docs">link</a>.</p>
551
- <Callout tone="info">A component among the content.</Callout>
552
- </Prose>
553
- ```
554
-
555
- **The elements.** The set is what Markdown produces (CommonMark with tables and
556
- strikethrough) and the common HTML beside it:
557
-
558
- | Element | Tags | Element | Tags |
559
- | --- | --- | --- | --- |
560
- | `paragraph` | `p` | `link` | `a` |
561
- | `heading1` … `heading6` | `h1` … `h6` | `strong` | `strong`, `b` |
562
- | `list` | `ul`, `ol` | `emphasis` | `em`, `i` |
563
- | `item` | `li` | `deleted` | `del`, `s` |
564
- | `quote` | `blockquote` | `code` | `code` |
565
- | `rule` | `hr` | `sub`, `sup` | `sub`, `sup` |
566
- | `pre` | `pre` | `kbd` | `kbd` |
567
- | `table`, `headerCell`, `cell` | `table`, `th`, `td` | `mark` | `mark` |
568
- | `figure`, `caption` | `figure`, `figcaption` | `descriptions`, `term`, `definition` | `dl`, `dt`, `dd` |
569
- | `media` | `img`, `video`, `iframe` | | |
570
-
571
- **An element is a part selected by tag.** Each entry names profiles: `text`
572
- (a text profile), `surface` (a surface profile, with `when` for its states) and
573
- `frame` (a frame profile: padding, borders, radius, sizes). The extras belong
574
- to one element each:
575
-
576
- - `spaceBefore` on a block replaces the rhythm before it.
577
- - `spaceAfter` on a block is the space between it and whatever follows, plain
578
- markup or a component, in place of the rhythm (a heading that sits closer to
579
- its text than paragraphs sit to each other). Where the next block states its
580
- own `spaceBefore`, the larger of the two applies, as collapsing margins would
581
- give: a list with 22 px after it, followed by a heading with 44 px before
582
- it, is 44 px from that heading.
583
- - `indent` on `list` is its start inset; `markers` on `list` is an unordered
584
- list's marker shape at each depth of nesting, outermost first (one to three
585
- of `"disc"`, `"circle"`, `"square"`; a deeper list keeps the last). Ordered
586
- lists keep their numbers.
587
- - `anchorClear` on a block (a heading with an id) is where a jump to it lands.
588
- - `component` is not a tag: it is any component placed directly among the
589
- blocks (a callout, a code block with its own owner). It takes `spaceBefore`
590
- and `spaceAfter` only, in place of the rhythm and with the same "larger of the
591
- two" rule against a neighbour's own space. A component's design stays its
592
- owner's, and every component among the blocks takes the same space.
593
- - `marker` on `item` is a colour-only surface; `markerText` on `item` is a text
594
- profile whose weight the marker takes (bold bullets and numbers). The
595
- marker's size and line stay the item's.
596
-
597
- **What ADS guarantees.**
598
-
599
- - **Only elements without a class are styled** (`p:not([class])`). Every
600
- element an ADS owner renders has a class, so a component placed in the
601
- content keeps its own design, and a paragraph inside that component is the
602
- component's.
603
- - **Nesting follows HTML.** A list in a list, a paragraph in a quote, a link in
604
- a table cell: each is styled where it stands.
605
- - **The rhythm is even.** Every block takes the rhythm (or its own
606
- `spaceBefore`) before it, declared or not, and the first plain element of
607
- the root and of each plain container starts flush. Browser margins, a
608
- quote's and a figure's indent, a rule's inset border, a table's doubled
609
- borders and media wider than its column are replaced.
610
- - **A component among the blocks is spaced like them.** A component placed
611
- directly in the prose root takes the rhythm before it (unless it comes
612
- first); nothing else of it changes. A component inside a paragraph is inline
613
- content and is left alone.
614
- - **A table's structure and line breaks are content.** `thead`, `tbody`,
615
- `tfoot` and `tr` come with a declared `table`, and `br` with any prose; no
616
- rule is written for them.
617
- - **Contrast is proven.** Each declared colour (base and state surfaces) is
618
- checked on the root's background and on the background of every declared
619
- element that can contain it, in every theme and brand:
620
- `construction/prose-contrast-insufficient`. A code block holds code, so a
621
- link's colour is not held to it.
622
- - **The source of the markup does not matter.** JSX children, rendered
623
- Markdown and HTML from a content system are styled alike.
624
-
625
- **Content as an HTML string.** A content system or a Markdown renderer hands
626
- the application a string. Application source cannot inject it
627
- (`dangerouslySetInnerHTML` is a design prop to `ads-guard`), and it should not:
628
- the injection belongs in one place. Give the same recipe a second component
629
- that takes the string:
630
-
631
- ```tsx
632
- export function ProseHtml({ html }: { html: string }) {
633
- return <div className={article} dangerouslySetInnerHTML={{ __html: html }} />;
634
- }
595
+ ```ts
596
+ // The heading's surface: links inside it read the heading's ink.
597
+ profile({ name: "article-heading", kind: "surface", fields: { color: "--text-primary" }, provides: { "--link-ink": "--text-primary" } });
635
598
  ```
636
599
 
637
- The application passes `html` as a plain prop. The string is injected as
638
- written, so **the application sanitises it first**: ADS checks source, not
639
- strings, and unsanitised HTML from outside is a security hole. Classes inside
640
- the string are not styled by prose (only classless elements are), and elements
641
- the recipe does not declare are drawn in the root's text without any report,
642
- because no check reads the string. The example design system's Prose pattern exports both
643
- forms.
644
-
645
- **What a prose recipe does not have.** No `parts`, `gap`, `align` or `layer`:
646
- prose flows. An element the recipe does not declare is drawn in the root's
647
- text; the markup checks report it where content uses it
648
- (`prose-element-undeclared`), so the gap shows up where it matters.
649
-
650
- **The markup checks.** In scenarios, mocks and application source, plain flow
651
- markup is accepted as the content of a prose owner: inside its element, through
652
- plain prose elements only. A component between the owner and the element owns
653
- what is inside it. An element outside the set (`div`, `span`, `section`) is
654
- still markup of the file's own. `ads emit` records the prose owners in
655
- `ads-prose.json` beside the entry, which is how `ads-guard` knows them.
600
+ **Where content comes from.** The design system renders its own content tree;
601
+ a project adapts its source to it in behaviour code with the libraries it
602
+ declares: Markdown (an mdast tree from a Markdown parser), HTML (parsed and
603
+ sanitised, never injected) or a content system's rich text (Portable Text, a
604
+ rich-text JSON). The example design system's `Content` pattern
605
+ (`tests/fixtures/example-project/design-system/patterns/Content/Content`) shows
606
+ the whole set: the node types, the block flow (`Content`), the inline renderer
607
+ (`ContentText`), nested lists (`ContentList`, a list item whose nested list
608
+ starts one `detailsGap` below its text) and the components in
609
+ `components/Content/Text` and `components/Content/Blocks`.
610
+
611
+ **Markers and counters.** A list item's marker is its own treatment:
612
+ `pseudo: { marker: { surface: "article-marker", text: "article-marker-text" } }`
613
+ gives bullets and numbers their colour and weight, and `markers` on the list sets
614
+ the number system at each depth. Clause numbering (1, 1.1, 1.1.2) is a counter:
615
+ the list `counter: { reset: "clause" }`, each item `counter: { increment: "clause" }`
616
+ and its marker `content: { counters: "clause", separator: ".", suffix: ". " }`. A
617
+ check-mark list is a visual part in each item (an icon beside its text), not a
618
+ marker.
619
+
620
+ **What ADS checks.** Every component as usual (states, contrast, targets, text);
621
+ the flow's spacing tokens; composed contrast of every text through every
622
+ placement and recursive renderer, with the provided roles of the containers it
623
+ sits in; a surface that provides a token it reads itself
624
+ (`foundation/provided-role-self`).
656
625
 
657
626
  ## Sticky elements
658
627
 
@@ -1081,8 +1050,19 @@ the declared parent; independent layouts belong to child regions. Unsupported
1081
1050
  combinations and missing parent relationships fail.
1082
1051
 
1083
1052
  **Cells.** A cell names one owned element or public component (placed through
1084
- its className marker). Several or mapped instances can share a cell only when
1085
- it auto-places (`start: "auto"`) at every tier.
1053
+ its className marker), rendered exactly once by default:
1054
+
1055
+ - `required: false`: the cell may be absent (a page's optional notice). Placed
1056
+ in auto rows, the cells after it move up when it is absent; pinned to a `row`,
1057
+ the row stays, empty, with its gaps (`review/optional-cell-row`).
1058
+ - `repeat: true`: the cell renders once per item of a list (`items.map(…)`),
1059
+ any number of times, at least once unless `required: false`. Its instances
1060
+ flow one after another: it auto-places at every tier (`start: "auto"` is
1061
+ implied) over its `span`, a number or `"full"` (the tier's whole row), and
1062
+ states no start line, `end`, `row` or `rowSpan` (`spec/value-invalid`).
1063
+ - Several or mapped instances may also share a cell that auto-places
1064
+ (`start: "auto"`) at every tier. An auto-placed cell spans a number of tracks
1065
+ or `"full"`; `end` needs a start line.
1086
1066
 
1087
1067
  - A cell's frame with a fixed inline size, and any owned frame deeper inside it
1088
1068
  (less the insets between), fits the region the algebra bounds for the cell at
@@ -1163,6 +1143,49 @@ variants, non-empty, empty and absent. Comparing or indexing designs by its
1163
1143
  content is an error, as is an unbounded choice. Spreads can pass props to
1164
1144
  public components but not to owned elements.
1165
1145
 
1146
+ ### Design state derived from data
1147
+
1148
+ ADS proves design, not data logic. A component that decides its design from
1149
+ data (how many items there are, whether a lookup found one) names that decision
1150
+ as design state, a `const` with an explicit finite type, and branches on it:
1151
+
1152
+ ```tsx
1153
+ const overflow: "fits" | "overflows" = members.length > 3 ? "overflows" : "fits";
1154
+ const fourth: Member | undefined = members[3];
1155
+ const open: Space | undefined = spaces.find((space) => space.id === active);
1156
+ ```
1157
+
1158
+ The annotation is a finite type (a literal union, a boolean) or an optional
1159
+ object, function or node. When the initializer reads data the analysis does not
1160
+ evaluate, ADS checks every value of the declared type, and given and absent for
1161
+ an optional value; it never evaluates the derivation, which stays the
1162
+ component's own logic. An initializer that does evaluate keeps its exact value.
1163
+ Without the annotation, or with an open type (`string`, `number`), the
1164
+ derivation is not a finite choice (`choice/domain-not-finite`), and neither is
1165
+ content selecting design (`label === "Delete"`). Name one state per decision:
1166
+ two declared states read from the same data are checked as independent, so every
1167
+ combination of them is, including ones the data cannot produce.
1168
+
1169
+ ### An element chosen by the caller
1170
+
1171
+ A lowercase JSX tag is an element and a capitalised one a component. A
1172
+ capitalised tag that names a variable holding an element name is that element:
1173
+ a constant (`const Heading = "h3"`), or a prop typed as a union of heading
1174
+ levels, so a component can take the heading level its place in the page needs:
1175
+
1176
+ ```tsx
1177
+ export function Questions({ title, level = "h3" }: { title: string; level?: "h2" | "h3" | "h4" }) {
1178
+ const Heading = level;
1179
+ return <section className={questions}><Heading className="ds-questions-heading">{title}</Heading></section>;
1180
+ }
1181
+ ```
1182
+
1183
+ Owner analysis treats every heading level alike, so the levels are checked as
1184
+ one heading. A union of unlike elements (`"h3" | "p"`) is not one element: the
1185
+ tag stays a component, and a part it was meant to be is reported missing.
1186
+ Prefer the element's name as the prop's values (`"h2" | "h3"`) to a number
1187
+ that builds it (`` `h${level}` ``), which is not an element name.
1188
+
1166
1189
  ### Optional callbacks, objects and slots
1167
1190
 
1168
1191
  An optional prop (or mapped item field) whose type is an object, a function or
@@ -1226,6 +1249,13 @@ profile and owner variant, never per glyph. An owner that takes an icon takes a
1226
1249
  glyph reference (`closeGlyph`), never a name string. See
1227
1250
  [icons and glyph sets](ASSETS.md#icons-and-glyph-sets).
1228
1251
 
1252
+ The binding is a fragment the owner applies to the part
1253
+ (`recipe({ parts: { visual: { kind: "visual", asset: "mark", visual: "brand-visual" } } })`),
1254
+ or the part's own declaration: a region's visual part, and standalone
1255
+ artwork's one visual part, may state `asset`, `set`, `glyph`, `state` and
1256
+ `visual` themselves, and the owner then reads `recipe.parts.<name>` and
1257
+ `recipe.assets.<name>.source` from that recipe.
1258
+
1229
1259
  Button pairs optional glyphs with text. Identity pairs an avatar with a
1230
1260
  complete text stack, or brand artwork with baseline-aligned text. The asset's
1231
1261
  optical center defaults to [0,0] and is shared across sizes and uses. The slot
package/docs/MCP.md CHANGED
@@ -116,7 +116,11 @@ With no registered scenarios the showcase has nothing to open, and
116
116
  The browser starts from `ads://project/explorer`: a compact snapshot of
117
117
  navigation, preview-tool capabilities, draft references and build state. It
118
118
  subscribes to index and build changes instead of repeated fetches of full
119
- semantic catalogues.
119
+ semantic catalogues. The snapshot also lists what each ADS view offers the
120
+ sidebar (token role sheets, profile and asset folders), read from the
121
+ previewed revision's facts; the server announces `ads://project/explorer` when
122
+ an emitted revision changes them, so a sidebar opened before the first preview
123
+ fills in without a reload.
120
124
 
121
125
  - The shell never imports project UI. Every scenario section comes from the
122
126
  `ads_scenarios` registry, and the selected scenario opens in a persistent
package/docs/MOTION.md CHANGED
@@ -227,7 +227,8 @@ recipe({
227
227
  ```
228
228
 
229
229
  `channels` are `background-color` (the surface's `background`), `border-color`,
230
- `color`, `box-shadow`, `opacity` (the surface's `opacity`: a toast that fades
230
+ `color`, `text-decoration-color` (the surface's `textDecorationColor`: a link's
231
+ underline), `box-shadow`, `opacity` (the surface's `opacity`: a toast that fades
231
232
  out, a stack that fades in), `filter` (the surface's `blur`, `shapeShadow` and
232
233
  `groupShadow`) and `backdrop-filter` (its `backdropBlur` and
233
234
  `backdropSaturate`). An opacity or a surface effect that changes between the
@@ -238,6 +239,15 @@ recipe's motion slot) or a motion profile name. Each Button skin of the example
238
239
  transitions what its hover surface changes: the primary its background, the
239
240
  secondary its outline.
240
241
 
242
+ A link whose pale underline turns to its full ink on hover states the underline
243
+ as a paint of its surfaces and transitions it:
244
+
245
+ ```ts
246
+ profile({ name: "link", kind: "surface", fields: { color: "--link-ink", textDecorationColor: "--link-underline" } });
247
+ profile({ name: "link-hover", kind: "surface", fields: { color: "--link-ink", textDecorationColor: "--link-ink" } });
248
+ recipe({ layout: "inline", surface: "link", when: { "&:hover": { surface: "link-hover" } }, paintTransition: { channels: ["text-decoration-color"], motion: "link-motion" } });
249
+ ```
250
+
241
251
  The compiler rejects:
242
252
 
243
253
  - an empty, unknown or repeated channel;
@@ -347,8 +357,11 @@ recipe({
347
357
  state (`when`), not an entrance (`construction/enter-surface-unsupported`).
348
358
  - `from` may also name one movement, read from the entrance's motion profile:
349
359
  `translate` (its `distance`, on the block axis: a positive distance starts
350
- below and rises), `scale` (its `scale`) or `rotate` (its `angle`). `from`
351
- needs a surface, a movement or both.
360
+ below and rises), `translateInline` (its `distance`, on the inline axis: a
361
+ positive distance starts toward the inline end and slides to the start, so a
362
+ pushed screen comes in from the side; mirrored under `:dir(rtl)`), `scale`
363
+ (its `scale`) or `rotate` (its `angle`). `from` needs a surface, a movement
364
+ or both.
352
365
  - `motion` is a motion profile name or `{ slot: "motion" }` (the nearest
353
366
  recipe's motion slot). It needs a duration, an easing and `reduced: "static"`.
354
367
  - A staggered entrance is each part with its own motion profile carrying a
@@ -71,6 +71,7 @@ The example design system's detailed text specimen is `profiles/Typography/detai
71
71
  | Field | Token role |
72
72
  | --- | --- |
73
73
  | `borderWidth`, `radius` | `border-width`, `radius` |
74
+ | `startStartRadius`, `startEndRadius`, `endStartRadius`, `endEndRadius` (region frames: one corner's radius in place of `radius`, such as a chat bubble's tail corner; a corner with neither is square) | `radius` |
74
75
  | `padding`, `paddingInline`, `paddingBlock`, `minimumBlockInset` | `frame-inset` |
75
76
  | `paddingInlineStart`, `paddingInlineEnd`, `paddingBlockStart`, `paddingBlockEnd` (container and control frames: one side's inset where the two sides of an axis differ; a side has one source, and on a control frame `minimumBlockInset` is the block axis's) | `frame-inset` |
76
77
  | `inlineSize`, `blockSize`, `maxInlineSize`, `maxBlockSize` | `frame-size` |
@@ -85,6 +86,11 @@ The example design system's detailed text specimen is `profiles/Typography/detai
85
86
  validated construction choices.
86
87
  - Structural zero and relative sizing are valid. Shared design lengths come from
87
88
  the appropriate roles.
89
+ - A stated `inlineSize` or `blockSize` is also the box's minimum on that axis,
90
+ so a fixed box keeps its size in a row or column beside content that could
91
+ push it (a disc beside long wrapping text). A stated `minInlineSize` or
92
+ `minBlockSize` replaces that minimum, and a stated `maxInlineSize` or
93
+ `maxBlockSize` leaves the box free to narrow on its axis.
88
94
  - Frame geometry supplies target sizes; the interaction contract verifies the
89
95
  actual hit region, which must not overlap another action or escape its
90
96
  target's supported bounds.
@@ -95,7 +101,9 @@ The example design system's detailed text specimen is `profiles/Typography/detai
95
101
 
96
102
  ## Surface
97
103
 
98
- Fields: `background`, `color` and `borderColor` (`paint`), `boxShadow`
104
+ Fields: `background`, `color`, `borderColor` and `textDecorationColor` (an
105
+ underline's paint, which a state and a paint transition change like any paint)
106
+ (`paint`), `boxShadow`
99
107
  (`shadow`), `backgroundImage` (`gradient`), `opacity` (`opacity`), the effects
100
108
  `blur` and `backdropBlur` (`blur`), `backdropSaturate` (`saturation`),
101
109
  `shapeShadow` and `groupShadow` (`shadow`), `mask` (`gradient`), a paint per
@@ -107,6 +115,44 @@ the example design system (`tokens/Surfaces/shadow.ads.css`,
107
115
  `profiles/Surfaces/surfaces.ads.ts`), `quiet-surface` binds the no-shadow token
108
116
  and `emphasized-surface` a shared shadow.
109
117
 
118
+ ### Contextual roles: `provides`
119
+
120
+ A surface may re-bind paint tokens for the subtree of every element that takes
121
+ it, its base or a state: `provides: { "<paint token>": "<paint token>" }`. A
122
+ child reads its own role as always and gets the container's value there; the
123
+ container never styles the child's elements. Use it for a colour that depends on
124
+ where an element sits:
125
+
126
+ | Container | Provides | So that |
127
+ | --- | --- | --- |
128
+ | A heading | `--link-ink` → its own ink | a link in a heading reads as the heading |
129
+ | A warning banner | `--link-ink`, `--icon-ink` → its on-warning ink | links and icons are readable on the tint |
130
+ | A selected row (its `when` state's surface) | text, icon and checkbox inks → its on-selected inks | the cells follow the selection with no prop |
131
+ | A dark card | `--action-fill`, `--focus-ring` → its on-dark values | its actions and their focus ring stay visible |
132
+
133
+ ```ts
134
+ profile({ name: "banner-warning", kind: "surface", fields: { background: "--warning-fill", color: "--on-warning" }, provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" } });
135
+ ```
136
+
137
+ - Key and value are tokens of one role: `paint`, or `border-width` for an
138
+ underline's thickness (links in a table cell that thicken on hover there)
139
+ (`foundation/token-role`). Sizes and spacing are not provided: density is a
140
+ theme, brand or condition.
141
+ - Lowering writes them as custom properties on the element
142
+ (`.banner { --link-ink: var(--on-warning) }`), so CSS inheritance carries them.
143
+ - A provider under a state holds only with that state: the selected row's
144
+ on-selected ink is paired with its selected background, never the rest one.
145
+ - Composed contrast proves the text of everything placed inside with the
146
+ provided values on the provider's background, in every theme and brand; the
147
+ nearest provider wins.
148
+ - A surface that provides a token its own fields read would repaint itself:
149
+ `foundation/provided-role-self`.
150
+
151
+ Pick the pattern by where the difference comes from: a whole theme or brand
152
+ for a section of the page (`data-theme`/`data-brand` sections), a look the
153
+ caller chooses (a `tone` prop), a colour that follows the container
154
+ (`provides`).
155
+
110
156
  ### The border's line
111
157
 
112
158
  `borderStyle` is a fixed choice, not a token: `"solid"` (the default),
@@ -293,10 +339,11 @@ its optical center.
293
339
 
294
340
  ## Spacing
295
341
 
296
- Fields: `contentGap`, `labelGap`, `detailsGap`, `metaGap`, and for
297
- [prose](LANGUAGE.md#prose-long-form-content) `sectionGap` (the space before a
298
- section's heading) and `indent` (a list's start inset), each `content-gap`
299
- or `spacing`. `anchorGap` (`layout-size`, `content-gap` or `spacing`) is where a
342
+ Fields: `contentGap`, `labelGap`, `detailsGap`, `metaGap`, `sectionGap` (the
343
+ space before a section's heading, a part's `spaceBefore` in a
344
+ [content flow](LANGUAGE.md#long-form-content-components-in-a-flow)), `indent`,
345
+ and `spaceBefore` / `spaceAfter` (a part's own space in a flow, when the part
346
+ names the profile with `spacing`), each `content-gap` or `spacing`. `anchorGap` (`layout-size`, `content-gap` or `spacing`) is where a
300
347
  jump to an element lands below the top of its scroll container
301
348
  ([`anchorClear`](LANGUAGE.md)). `overlap` (`overlap`, `content-gap` or
302
349
  `spacing`) is how far the neighbours of an arrangement overlap in place of a