@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.
- package/dist/ads-errors.mjs +33 -26
- package/dist/analysis/design-usage.mjs +4 -20
- package/dist/analysis/mock-check.mjs +4 -5
- package/dist/analysis/owner-accessibility.mjs +4 -4
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +33 -3
- package/dist/analysis/owner-composition.mjs +61 -12
- package/dist/analysis/owner-source.mjs +52 -35
- package/dist/composed-contrast.mjs +143 -62
- package/dist/construction-output.mjs +6 -1
- package/dist/construction-spec.d.mts +53 -44
- package/dist/construction-spec.mjs +64 -76
- package/dist/corner-overpaint.mjs +5 -4
- package/dist/design-foundation.mjs +16 -0
- package/dist/design-usage.mjs +2 -8
- package/dist/emit/emission.mjs +0 -5
- package/dist/grid-lowering.mjs +3 -1
- package/dist/lowering-enter.mjs +6 -6
- package/dist/lowering-session.mjs +10 -0
- package/dist/mcp/server-observation.mjs +6 -4
- package/dist/mcp/server-project.mjs +4 -1
- package/dist/owner-analysis-check.mjs +4 -1
- package/dist/owner-errors.mjs +2 -1
- package/dist/owner-lowering.mjs +10 -4
- package/dist/owner-scenarios.mjs +2 -22
- package/dist/ownership-model.mjs +7 -5
- package/dist/paint-contrast.mjs +6 -0
- package/dist/profile-macro.d.mts +7 -0
- package/dist/recipe-macro.d.mts +46 -42
- package/dist/recipe-model.mjs +12 -11
- package/dist/region-lowering.mjs +54 -109
- package/dist/role-vocabulary.d.mts +4 -0
- package/dist/role-vocabulary.mjs +4 -0
- package/dist/runtime-paint-contrast.mjs +5 -2
- package/dist/showcase/client.bundle.js +48 -48
- package/dist/showcase/http-client.bundle.js +13 -13
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/ads-designer/references/accessibility.md +3 -4
- package/dist/skills/ads-designer/references/design-data.md +12 -6
- package/dist/skills/ads-designer/references/layout.md +7 -3
- package/dist/skills/ads-designer/references/motion.md +2 -1
- package/dist/skills/ads-designer/references/recipes.md +28 -18
- package/dist/skills/ads-import/references/design-data.md +12 -6
- package/dist/skills/ads-import/references/layout.md +7 -3
- package/dist/skills/ads-import/references/recipes.md +28 -18
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
- package/dist/skills/ads-port/references/design-data.md +12 -6
- package/dist/skills/ads-port/references/layout.md +7 -3
- package/dist/skills/ads-port/references/recipes.md +28 -18
- package/dist/spatial-model.mjs +2 -2
- package/dist/surface-contrast.mjs +6 -2
- package/dist/target-size.mjs +21 -3
- package/docs/ADS.md +9 -3
- package/docs/ARCHITECTURE.md +33 -23
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +128 -21
- package/docs/GUIDE.md +64 -19
- package/docs/LANGUAGE.md +141 -134
- package/docs/MCP.md +5 -1
- package/docs/MOTION.md +5 -2
- package/docs/PROFILE-KINDS.md +46 -4
- package/docs/RULES.md +16 -15
- package/package.json +1 -1
- package/dist/analysis/prose-owners.mjs +0 -57
- package/dist/prose-model.d.mts +0 -81
- 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/
|
|
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,16 @@ 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
|
|
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
|
-
| `
|
|
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
|
+
| `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
249
|
| `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
250
|
| `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
251
|
| 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 +266,7 @@ them all.
|
|
|
261
266
|
| `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
267
|
| 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
268
|
| 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 |
|
|
269
|
+
| 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
270
|
| `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
271
|
| `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
272
|
|
|
@@ -325,9 +331,10 @@ written `:has(> .part:state)` with `:checked`, `:indeterminate`,
|
|
|
325
331
|
|
|
326
332
|
```ts
|
|
327
333
|
parts: {
|
|
328
|
-
input: { selector: ".ds-checkbox-input" },
|
|
334
|
+
input: { selector: ".ds-checkbox-input", drawnBy: "box" }, // the native <input type="checkbox">, laid over the box
|
|
329
335
|
box: {
|
|
330
336
|
selector: ".ds-checkbox-box", surface: "control-surface",
|
|
337
|
+
frame: { profile: "checkbox-box" }, // the box's size: also the input's
|
|
331
338
|
focus: { of: "input" }, // the focus profile's outline, drawn on the box
|
|
332
339
|
when: {
|
|
333
340
|
"&:has(> .ds-checkbox-input:checked)": { surface: "action-surface" },
|
|
@@ -337,7 +344,11 @@ parts: {
|
|
|
337
344
|
}
|
|
338
345
|
```
|
|
339
346
|
|
|
340
|
-
A checkbox's drawn box follows its native input without script
|
|
347
|
+
A checkbox's drawn box follows its native input without script. The input is
|
|
348
|
+
declared right before its box with `drawnBy`: it takes no room in the row and
|
|
349
|
+
lies, invisible, over the box at the box's size, so a press on the box is a
|
|
350
|
+
press on the input and the label (a `<label>` root) starts one gap after the
|
|
351
|
+
box. A field's
|
|
341
352
|
control reacts to its own hover (`&:has(> .ds-field-control:hover)`), not to
|
|
342
353
|
the label's. The class must be a direct part of the recipe, and nothing else
|
|
343
354
|
goes inside `:has()`.
|
|
@@ -514,145 +525,80 @@ given, unless a code is named.
|
|
|
514
525
|
review (`review/hover-geometry-shift`). A layer of a layered parent draws over
|
|
515
526
|
its neighbours and is not listed.
|
|
516
527
|
|
|
517
|
-
##
|
|
528
|
+
## Long-form content: components in a flow
|
|
518
529
|
|
|
519
530
|
Articles, documentation, legal text and anything a content system or Markdown
|
|
520
|
-
produces
|
|
521
|
-
|
|
522
|
-
|
|
531
|
+
produces are assembled from the design system's own components, checked as any
|
|
532
|
+
component is. There is no styling by tag: a paragraph, a heading, a link and a
|
|
533
|
+
list are components (`Paragraph`, `Heading`, `Link`, `List`), the same ones the
|
|
534
|
+
rest of the interface uses, and a pattern places them.
|
|
535
|
+
|
|
536
|
+
Three general capabilities assemble them:
|
|
537
|
+
|
|
538
|
+
1. **A flow of parts.** A stack whose parts are placed public components
|
|
539
|
+
(`kind: "component"`, matched by the marker the placement passes in
|
|
540
|
+
`className`, as a grid cell is), each `repeat`ed and optional, in any order.
|
|
541
|
+
A part's `spaceBefore` and `spaceAfter` replace the stack's gap on that side:
|
|
542
|
+
a heading stands further from what precedes it, and where one part's space
|
|
543
|
+
after meets the next part's space before the larger applies. The first part
|
|
544
|
+
starts flush.
|
|
545
|
+
2. **A finite choice over node types.** The design system defines its content
|
|
546
|
+
tree as a TypeScript union (block nodes, inline nodes) and renders it with a
|
|
547
|
+
ternary chain over `node.type` inside the `.map` callback, so every node type
|
|
548
|
+
is a finite choice ADS checks. A renderer may place itself (a quote holds
|
|
549
|
+
blocks, strong text holds inline nodes): ADS follows each recursive placement.
|
|
550
|
+
3. **Contextual roles.** A container's surface profile `provides` the paint
|
|
551
|
+
roles its subtree reads differently ([PROFILE-KINDS](PROFILE-KINDS.md#surface)):
|
|
552
|
+
a heading's surface provides the link ink, so a link inside it takes the
|
|
553
|
+
heading's ink with no prop on the link and no rule written into it.
|
|
523
554
|
|
|
524
555
|
```ts
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
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" },
|
|
556
|
+
// The flow: blocks in any order and number, a heading one section gap from what precedes it.
|
|
557
|
+
const flow = recipe({
|
|
558
|
+
layout: "stack",
|
|
559
|
+
profile: "article", // a composite: { spacingProfile, frameProfile }
|
|
560
|
+
frame: {},
|
|
561
|
+
parts: {
|
|
562
|
+
heading: { selector: ".ds-content-heading", kind: "component", repeat: true, required: false, spaceBefore: { slot: "spacing", field: "sectionGap" } },
|
|
563
|
+
paragraph: { selector: ".ds-content-paragraph", kind: "component", repeat: true, required: false },
|
|
564
|
+
list: { selector: ".ds-content-list", kind: "component", repeat: true, required: false },
|
|
539
565
|
},
|
|
540
566
|
}).root;
|
|
541
567
|
|
|
542
|
-
export function
|
|
543
|
-
return
|
|
568
|
+
export function Content({ blocks }: { blocks: readonly BlockNode[] }) {
|
|
569
|
+
return (
|
|
570
|
+
<div className={flow}>
|
|
571
|
+
{blocks.map((node, index) =>
|
|
572
|
+
node.type === "heading" ? <Heading key={index} className="ds-content-heading" level={node.level}><ContentText inline={node.children} /></Heading>
|
|
573
|
+
: node.type === "paragraph" ? <Paragraph key={index} className="ds-content-paragraph"><ContentText inline={node.children} /></Paragraph>
|
|
574
|
+
: <List key={index} className="ds-content-list" ordered={node.ordered}>…</List>,
|
|
575
|
+
)}
|
|
576
|
+
</div>
|
|
577
|
+
);
|
|
544
578
|
}
|
|
545
579
|
```
|
|
546
580
|
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
|
|
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
|
-
}
|
|
581
|
+
```ts
|
|
582
|
+
// The heading's surface: links inside it read the heading's ink.
|
|
583
|
+
profile({ name: "article-heading", kind: "surface", fields: { color: "--text-primary" }, provides: { "--link-ink": "--text-primary" } });
|
|
635
584
|
```
|
|
636
585
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
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.
|
|
586
|
+
**Where content comes from.** The design system renders its own content tree;
|
|
587
|
+
a project adapts its source to it in behaviour code with the libraries it
|
|
588
|
+
declares: Markdown (an mdast tree from a Markdown parser), HTML (parsed and
|
|
589
|
+
sanitised, never injected) or a content system's rich text (Portable Text, a
|
|
590
|
+
rich-text JSON). The example design system's `Content` pattern
|
|
591
|
+
(`tests/fixtures/example-project/design-system/patterns/Content/Content`) shows
|
|
592
|
+
the whole set: the node types, the block flow (`Content`), the inline renderer
|
|
593
|
+
(`ContentText`), nested lists (`ContentList`, a list item whose nested list
|
|
594
|
+
starts one `detailsGap` below its text) and the components in
|
|
595
|
+
`components/Content/Text` and `components/Content/Blocks`.
|
|
596
|
+
|
|
597
|
+
**What ADS checks.** Every component as usual (states, contrast, targets, text);
|
|
598
|
+
the flow's spacing tokens; composed contrast of every text through every
|
|
599
|
+
placement and recursive renderer, with the provided roles of the containers it
|
|
600
|
+
sits in; a surface that provides a token it reads itself
|
|
601
|
+
(`foundation/provided-role-self`).
|
|
656
602
|
|
|
657
603
|
## Sticky elements
|
|
658
604
|
|
|
@@ -1081,8 +1027,19 @@ the declared parent; independent layouts belong to child regions. Unsupported
|
|
|
1081
1027
|
combinations and missing parent relationships fail.
|
|
1082
1028
|
|
|
1083
1029
|
**Cells.** A cell names one owned element or public component (placed through
|
|
1084
|
-
its className marker)
|
|
1085
|
-
|
|
1030
|
+
its className marker), rendered exactly once by default:
|
|
1031
|
+
|
|
1032
|
+
- `required: false`: the cell may be absent (a page's optional notice). Placed
|
|
1033
|
+
in auto rows, the cells after it move up when it is absent; pinned to a `row`,
|
|
1034
|
+
the row stays, empty, with its gaps (`review/optional-cell-row`).
|
|
1035
|
+
- `repeat: true`: the cell renders once per item of a list (`items.map(…)`),
|
|
1036
|
+
any number of times, at least once unless `required: false`. Its instances
|
|
1037
|
+
flow one after another: it auto-places at every tier (`start: "auto"` is
|
|
1038
|
+
implied) over its `span`, a number or `"full"` (the tier's whole row), and
|
|
1039
|
+
states no start line, `end`, `row` or `rowSpan` (`spec/value-invalid`).
|
|
1040
|
+
- Several or mapped instances may also share a cell that auto-places
|
|
1041
|
+
(`start: "auto"`) at every tier. An auto-placed cell spans a number of tracks
|
|
1042
|
+
or `"full"`; `end` needs a start line.
|
|
1086
1043
|
|
|
1087
1044
|
- A cell's frame with a fixed inline size, and any owned frame deeper inside it
|
|
1088
1045
|
(less the insets between), fits the region the algebra bounds for the cell at
|
|
@@ -1163,6 +1120,49 @@ variants, non-empty, empty and absent. Comparing or indexing designs by its
|
|
|
1163
1120
|
content is an error, as is an unbounded choice. Spreads can pass props to
|
|
1164
1121
|
public components but not to owned elements.
|
|
1165
1122
|
|
|
1123
|
+
### Design state derived from data
|
|
1124
|
+
|
|
1125
|
+
ADS proves design, not data logic. A component that decides its design from
|
|
1126
|
+
data (how many items there are, whether a lookup found one) names that decision
|
|
1127
|
+
as design state, a `const` with an explicit finite type, and branches on it:
|
|
1128
|
+
|
|
1129
|
+
```tsx
|
|
1130
|
+
const overflow: "fits" | "overflows" = members.length > 3 ? "overflows" : "fits";
|
|
1131
|
+
const fourth: Member | undefined = members[3];
|
|
1132
|
+
const open: Space | undefined = spaces.find((space) => space.id === active);
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
The annotation is a finite type (a literal union, a boolean) or an optional
|
|
1136
|
+
object, function or node. When the initializer reads data the analysis does not
|
|
1137
|
+
evaluate, ADS checks every value of the declared type, and given and absent for
|
|
1138
|
+
an optional value; it never evaluates the derivation, which stays the
|
|
1139
|
+
component's own logic. An initializer that does evaluate keeps its exact value.
|
|
1140
|
+
Without the annotation, or with an open type (`string`, `number`), the
|
|
1141
|
+
derivation is not a finite choice (`choice/domain-not-finite`), and neither is
|
|
1142
|
+
content selecting design (`label === "Delete"`). Name one state per decision:
|
|
1143
|
+
two declared states read from the same data are checked as independent, so every
|
|
1144
|
+
combination of them is, including ones the data cannot produce.
|
|
1145
|
+
|
|
1146
|
+
### An element chosen by the caller
|
|
1147
|
+
|
|
1148
|
+
A lowercase JSX tag is an element and a capitalised one a component. A
|
|
1149
|
+
capitalised tag that names a variable holding an element name is that element:
|
|
1150
|
+
a constant (`const Heading = "h3"`), or a prop typed as a union of heading
|
|
1151
|
+
levels, so a component can take the heading level its place in the page needs:
|
|
1152
|
+
|
|
1153
|
+
```tsx
|
|
1154
|
+
export function Questions({ title, level = "h3" }: { title: string; level?: "h2" | "h3" | "h4" }) {
|
|
1155
|
+
const Heading = level;
|
|
1156
|
+
return <section className={questions}><Heading className="ds-questions-heading">{title}</Heading></section>;
|
|
1157
|
+
}
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
Owner analysis treats every heading level alike, so the levels are checked as
|
|
1161
|
+
one heading. A union of unlike elements (`"h3" | "p"`) is not one element: the
|
|
1162
|
+
tag stays a component, and a part it was meant to be is reported missing.
|
|
1163
|
+
Prefer the element's name as the prop's values (`"h2" | "h3"`) to a number
|
|
1164
|
+
that builds it (`` `h${level}` ``), which is not an element name.
|
|
1165
|
+
|
|
1166
1166
|
### Optional callbacks, objects and slots
|
|
1167
1167
|
|
|
1168
1168
|
An optional prop (or mapped item field) whose type is an object, a function or
|
|
@@ -1226,6 +1226,13 @@ profile and owner variant, never per glyph. An owner that takes an icon takes a
|
|
|
1226
1226
|
glyph reference (`closeGlyph`), never a name string. See
|
|
1227
1227
|
[icons and glyph sets](ASSETS.md#icons-and-glyph-sets).
|
|
1228
1228
|
|
|
1229
|
+
The binding is a fragment the owner applies to the part
|
|
1230
|
+
(`recipe({ parts: { visual: { kind: "visual", asset: "mark", visual: "brand-visual" } } })`),
|
|
1231
|
+
or the part's own declaration: a region's visual part, and standalone
|
|
1232
|
+
artwork's one visual part, may state `asset`, `set`, `glyph`, `state` and
|
|
1233
|
+
`visual` themselves, and the owner then reads `recipe.parts.<name>` and
|
|
1234
|
+
`recipe.assets.<name>.source` from that recipe.
|
|
1235
|
+
|
|
1229
1236
|
Button pairs optional glyphs with text. Identity pairs an avatar with a
|
|
1230
1237
|
complete text stack, or brand artwork with baseline-aligned text. The asset's
|
|
1231
1238
|
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
|
@@ -347,8 +347,11 @@ recipe({
|
|
|
347
347
|
state (`when`), not an entrance (`construction/enter-surface-unsupported`).
|
|
348
348
|
- `from` may also name one movement, read from the entrance's motion profile:
|
|
349
349
|
`translate` (its `distance`, on the block axis: a positive distance starts
|
|
350
|
-
below and rises), `
|
|
351
|
-
|
|
350
|
+
below and rises), `translateInline` (its `distance`, on the inline axis: a
|
|
351
|
+
positive distance starts toward the inline end and slides to the start, so a
|
|
352
|
+
pushed screen comes in from the side; mirrored under `:dir(rtl)`), `scale`
|
|
353
|
+
(its `scale`) or `rotate` (its `angle`). `from` needs a surface, a movement
|
|
354
|
+
or both.
|
|
352
355
|
- `motion` is a motion profile name or `{ slot: "motion" }` (the nearest
|
|
353
356
|
recipe's motion slot). It needs a duration, an easing and `reduced: "static"`.
|
|
354
357
|
- A staggered entrance is each part with its own motion profile carrying a
|
package/docs/PROFILE-KINDS.md
CHANGED
|
@@ -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.
|
|
@@ -107,6 +113,42 @@ the example design system (`tokens/Surfaces/shadow.ads.css`,
|
|
|
107
113
|
`profiles/Surfaces/surfaces.ads.ts`), `quiet-surface` binds the no-shadow token
|
|
108
114
|
and `emphasized-surface` a shared shadow.
|
|
109
115
|
|
|
116
|
+
### Contextual roles: `provides`
|
|
117
|
+
|
|
118
|
+
A surface may re-bind paint tokens for the subtree of every element that takes
|
|
119
|
+
it, its base or a state: `provides: { "<paint token>": "<paint token>" }`. A
|
|
120
|
+
child reads its own role as always and gets the container's value there; the
|
|
121
|
+
container never styles the child's elements. Use it for a colour that depends on
|
|
122
|
+
where an element sits:
|
|
123
|
+
|
|
124
|
+
| Container | Provides | So that |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| A heading | `--link-ink` → its own ink | a link in a heading reads as the heading |
|
|
127
|
+
| A warning banner | `--link-ink`, `--icon-ink` → its on-warning ink | links and icons are readable on the tint |
|
|
128
|
+
| 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 |
|
|
129
|
+
| A dark card | `--action-fill`, `--focus-ring` → its on-dark values | its actions and their focus ring stay visible |
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
profile({ name: "banner-warning", kind: "surface", fields: { background: "--warning-fill", color: "--on-warning" }, provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" } });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- Key and value are tokens of the `paint` role (`foundation/token-role`).
|
|
136
|
+
Sizes and spacing are not provided: density is a theme, brand or condition.
|
|
137
|
+
- Lowering writes them as custom properties on the element
|
|
138
|
+
(`.banner { --link-ink: var(--on-warning) }`), so CSS inheritance carries them.
|
|
139
|
+
- A provider under a state holds only with that state: the selected row's
|
|
140
|
+
on-selected ink is paired with its selected background, never the rest one.
|
|
141
|
+
- Composed contrast proves the text of everything placed inside with the
|
|
142
|
+
provided values on the provider's background, in every theme and brand; the
|
|
143
|
+
nearest provider wins.
|
|
144
|
+
- A surface that provides a token its own fields read would repaint itself:
|
|
145
|
+
`foundation/provided-role-self`.
|
|
146
|
+
|
|
147
|
+
Pick the pattern by where the difference comes from: a whole theme or brand
|
|
148
|
+
for a section of the page (`data-theme`/`data-brand` sections), a look the
|
|
149
|
+
caller chooses (a `tone` prop), a colour that follows the container
|
|
150
|
+
(`provides`).
|
|
151
|
+
|
|
110
152
|
### The border's line
|
|
111
153
|
|
|
112
154
|
`borderStyle` is a fixed choice, not a token: `"solid"` (the default),
|
|
@@ -293,10 +335,10 @@ its optical center.
|
|
|
293
335
|
|
|
294
336
|
## Spacing
|
|
295
337
|
|
|
296
|
-
Fields: `contentGap`, `labelGap`, `detailsGap`, `metaGap`,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
or `spacing`. `anchorGap` (`layout-size`, `content-gap` or `spacing`) is where a
|
|
338
|
+
Fields: `contentGap`, `labelGap`, `detailsGap`, `metaGap`, `sectionGap` (the
|
|
339
|
+
space before a section's heading, a part's `spaceBefore` in a
|
|
340
|
+
[content flow](LANGUAGE.md#long-form-content-components-in-a-flow)) and `indent`,
|
|
341
|
+
each `content-gap` or `spacing`. `anchorGap` (`layout-size`, `content-gap` or `spacing`) is where a
|
|
300
342
|
jump to an element lands below the top of its scroll container
|
|
301
343
|
([`anchorClear`](LANGUAGE.md)). `overlap` (`overlap`, `content-gap` or
|
|
302
344
|
`spacing`) is how far the neighbours of an arrangement overlap in place of a
|