@reqvire-org/ads 0.5.11 → 0.5.13

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 (37) hide show
  1. package/dist/ads-errors.mjs +29 -8
  2. package/dist/analysis/owner-source.mjs +21 -3
  3. package/dist/construction-output.mjs +16 -2
  4. package/dist/construction-spec.d.mts +43 -6
  5. package/dist/construction-spec.mjs +22 -12
  6. package/dist/end-alignment.mjs +4 -4
  7. package/dist/lowering-layer.mjs +50 -15
  8. package/dist/lowering-paint.mjs +1 -1
  9. package/dist/lowering-region-layout.mjs +8 -1
  10. package/dist/lowering-sequence.mjs +4 -3
  11. package/dist/measured-geometry.mjs +8 -2
  12. package/dist/owner-errors.mjs +1 -0
  13. package/dist/ownership-model.mjs +5 -5
  14. package/dist/recipe-macro.d.mts +12 -5
  15. package/dist/recipe-model.mjs +2 -2
  16. package/dist/region-lowering.mjs +47 -20
  17. package/dist/render-audit/render-states.page.mjs +1 -1
  18. package/dist/showcase/client.bundle.js +2 -2
  19. package/dist/showcase/http-client.bundle.js +2 -2
  20. package/dist/showcase/ui/ui.css +1 -1
  21. package/dist/showcase/ui/ui.js +2 -2
  22. package/dist/skills/ads-designer/references/recipes.md +41 -5
  23. package/dist/skills/ads-import/references/recipes.md +41 -5
  24. package/dist/skills/ads-port/SKILL.md +5 -0
  25. package/dist/skills/ads-port/references/recipes.md +41 -5
  26. package/dist/skills/ads-port/references/testing.md +5 -1
  27. package/dist/state-conditions.d.mts +3 -3
  28. package/dist/state-conditions.mjs +1 -1
  29. package/dist/token-shapes.mjs +42 -1
  30. package/docs/ADS.md +3 -2
  31. package/docs/CHANGELOG.md +75 -18
  32. package/docs/LANGUAGE.md +41 -13
  33. package/docs/MOTION.md +5 -0
  34. package/docs/PROFILE-KINDS.md +8 -5
  35. package/docs/RULES.md +8 -5
  36. package/docs/TOKEN-ROLES.md +1 -1
  37. package/package.json +1 -1
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
133
133
  A `when` entry selects a `surface`, and may select a `text` profile that
134
134
  differs from the element's own in weight and tracking only (the chosen option
135
135
  is heavier).
136
- A state of a direct part of the recipe is written `:has(> .part:state)` with
137
- `:checked`, `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a
138
- checkbox's box under its native input's `:checked`, a field control's own
139
- hover. Never mirror those states into attributes by script.
136
+ `&` is always the owner's root, in a part's `when` too. A state of one of the
137
+ recipe's own parts is written `:has(> .part:state)` with `:checked`,
138
+ `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
139
+ under its native input's `:checked`, a field control's own hover. A nested part
140
+ is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
141
+ Never mirror those states into attributes by script, and never split a box
142
+ into its own recipe only to reach its child's state.
140
143
  Lowering appends the part's path to the condition, so a pseudo-element, a
141
144
  combinator or class, a type, a nested `&`, another attribute operator or a
142
145
  functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
@@ -300,7 +303,8 @@ fragment or a native frame-only element.
300
303
  - a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
301
304
  with `brightness` on the image's surface;
302
305
  - an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
303
- groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
306
+ groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }` (`size` in the
307
+ drawing's units scales them with it, never below their text profile's size; `block: "baseline"` takes SVG text's `y`). Never draw it
304
308
  as markup in the owner.
305
309
  - **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
306
310
  `between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
@@ -464,6 +468,38 @@ are declared under `assets/`: see `ads://guides/branding` and
464
468
  visual profile caps its width (logo strips) instead of its height.
465
469
  - **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
466
470
 
471
+ <a id="matching"></a>
472
+ ## Matching a reference without nudges
473
+
474
+ A reference implementation (an upstream library, an earlier version of the site)
475
+ often places things by layout mechanics rather than by design: a glyph that sits
476
+ 0.8 px low because `vertical-align: middle` aligns it to the parent font's
477
+ x-height on a 24 px line, a gap that comes from half-leading, a negative margin
478
+ that cancels a border. Port the **intent**, not the mechanics. A number that only
479
+ reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
480
+ it has no design meaning, it is wrong at the next font, size or theme, and ADS
481
+ rejects owner nudges. Find the construct that states the intent:
482
+
483
+ | What the measurement shows | Construct that states it |
484
+ | --- | --- |
485
+ | A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
486
+ | A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
487
+ | An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
488
+ | Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
489
+ | Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
490
+ | A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
491
+ | A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
492
+ | Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
493
+ | Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
494
+ | A scale grows from an edge, not the centre | `origin` |
495
+ | A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
496
+ | A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
497
+
498
+ When no construct states the intent, keep ADS's geometry, record the difference
499
+ from the reference with its cause, and report the missing concept as an ADS
500
+ request. Do not reproduce the reference with an inset, margin, translation or
501
+ custom property chosen to match it.
502
+
467
503
  <a id="rejected"></a>
468
504
  ## What is rejected, and why
469
505
 
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
133
133
  A `when` entry selects a `surface`, and may select a `text` profile that
134
134
  differs from the element's own in weight and tracking only (the chosen option
135
135
  is heavier).
136
- A state of a direct part of the recipe is written `:has(> .part:state)` with
137
- `:checked`, `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a
138
- checkbox's box under its native input's `:checked`, a field control's own
139
- hover. Never mirror those states into attributes by script.
136
+ `&` is always the owner's root, in a part's `when` too. A state of one of the
137
+ recipe's own parts is written `:has(> .part:state)` with `:checked`,
138
+ `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
139
+ under its native input's `:checked`, a field control's own hover. A nested part
140
+ is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
141
+ Never mirror those states into attributes by script, and never split a box
142
+ into its own recipe only to reach its child's state.
140
143
  Lowering appends the part's path to the condition, so a pseudo-element, a
141
144
  combinator or class, a type, a nested `&`, another attribute operator or a
142
145
  functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
@@ -300,7 +303,8 @@ fragment or a native frame-only element.
300
303
  - a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
301
304
  with `brightness` on the image's surface;
302
305
  - an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
303
- groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
306
+ groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }` (`size` in the
307
+ drawing's units scales them with it, never below their text profile's size; `block: "baseline"` takes SVG text's `y`). Never draw it
304
308
  as markup in the owner.
305
309
  - **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
306
310
  `between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
@@ -464,6 +468,38 @@ are declared under `assets/`: see `ads://guides/branding` and
464
468
  visual profile caps its width (logo strips) instead of its height.
465
469
  - **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
466
470
 
471
+ <a id="matching"></a>
472
+ ## Matching a reference without nudges
473
+
474
+ A reference implementation (an upstream library, an earlier version of the site)
475
+ often places things by layout mechanics rather than by design: a glyph that sits
476
+ 0.8 px low because `vertical-align: middle` aligns it to the parent font's
477
+ x-height on a 24 px line, a gap that comes from half-leading, a negative margin
478
+ that cancels a border. Port the **intent**, not the mechanics. A number that only
479
+ reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
480
+ it has no design meaning, it is wrong at the next font, size or theme, and ADS
481
+ rejects owner nudges. Find the construct that states the intent:
482
+
483
+ | What the measurement shows | Construct that states it |
484
+ | --- | --- |
485
+ | A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
486
+ | A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
487
+ | An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
488
+ | Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
489
+ | Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
490
+ | A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
491
+ | A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
492
+ | Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
493
+ | Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
494
+ | A scale grows from an edge, not the centre | `origin` |
495
+ | A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
496
+ | A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
497
+
498
+ When no construct states the intent, keep ADS's geometry, record the difference
499
+ from the reference with its cause, and report the missing concept as an ADS
500
+ request. Do not reproduce the reference with an inset, margin, translation or
501
+ custom property chosen to match it.
502
+
467
503
  <a id="rejected"></a>
468
504
  ## What is rejected, and why
469
505
 
@@ -157,6 +157,11 @@ inspect screenshots. Verify project token mappings and consistency with existing
157
157
  controls as well as required upstream behavior. Intentional project styling is
158
158
  not a failed parity check; retain the unmodified reference and record the
159
159
  difference. A screenshot alone does not establish behavior or motion parity.
160
+ When a measured difference comes from the reference's layout mechanics (a
161
+ glyph aligned on a text line, half-leading, a cancelling margin), port the
162
+ intent with the construct [recipes.md](references/recipes.md#matching) names
163
+ for it (`opticalCenter`, `overlap`, `outset`, anchor offsets) and never with a
164
+ pixel value chosen to match the measurement.
160
165
 
161
166
  Keep browser automation in isolated pages/contexts. Rebuild static playgrounds
162
167
  after source changes. Test the public consumer path as well as component internals;
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
133
133
  A `when` entry selects a `surface`, and may select a `text` profile that
134
134
  differs from the element's own in weight and tracking only (the chosen option
135
135
  is heavier).
136
- A state of a direct part of the recipe is written `:has(> .part:state)` with
137
- `:checked`, `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a
138
- checkbox's box under its native input's `:checked`, a field control's own
139
- hover. Never mirror those states into attributes by script.
136
+ `&` is always the owner's root, in a part's `when` too. A state of one of the
137
+ recipe's own parts is written `:has(> .part:state)` with `:checked`,
138
+ `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
139
+ under its native input's `:checked`, a field control's own hover. A nested part
140
+ is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
141
+ Never mirror those states into attributes by script, and never split a box
142
+ into its own recipe only to reach its child's state.
140
143
  Lowering appends the part's path to the condition, so a pseudo-element, a
141
144
  combinator or class, a type, a nested `&`, another attribute operator or a
142
145
  functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
@@ -300,7 +303,8 @@ fragment or a native frame-only element.
300
303
  - a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
301
304
  with `brightness` on the image's surface;
302
305
  - an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
303
- groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
306
+ groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }` (`size` in the
307
+ drawing's units scales them with it, never below their text profile's size; `block: "baseline"` takes SVG text's `y`). Never draw it
304
308
  as markup in the owner.
305
309
  - **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
306
310
  `between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
@@ -464,6 +468,38 @@ are declared under `assets/`: see `ads://guides/branding` and
464
468
  visual profile caps its width (logo strips) instead of its height.
465
469
  - **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
466
470
 
471
+ <a id="matching"></a>
472
+ ## Matching a reference without nudges
473
+
474
+ A reference implementation (an upstream library, an earlier version of the site)
475
+ often places things by layout mechanics rather than by design: a glyph that sits
476
+ 0.8 px low because `vertical-align: middle` aligns it to the parent font's
477
+ x-height on a 24 px line, a gap that comes from half-leading, a negative margin
478
+ that cancels a border. Port the **intent**, not the mechanics. A number that only
479
+ reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
480
+ it has no design meaning, it is wrong at the next font, size or theme, and ADS
481
+ rejects owner nudges. Find the construct that states the intent:
482
+
483
+ | What the measurement shows | Construct that states it |
484
+ | --- | --- |
485
+ | A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
486
+ | A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
487
+ | An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
488
+ | Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
489
+ | Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
490
+ | A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
491
+ | A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
492
+ | Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
493
+ | Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
494
+ | A scale grows from an edge, not the centre | `origin` |
495
+ | A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
496
+ | A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
497
+
498
+ When no construct states the intent, keep ADS's geometry, record the difference
499
+ from the reference with its cause, and report the missing concept as an ADS
500
+ request. Do not reproduce the reference with an inset, margin, translation or
501
+ custom property chosen to match it.
502
+
467
503
  <a id="rejected"></a>
468
504
  ## What is rejected, and why
469
505
 
@@ -94,7 +94,11 @@ measure exit-state and removal timestamps. Timing assertions should allow normal
94
94
  browser scheduling tolerance.
95
95
 
96
96
  Inspect screenshots of settled states and intermediate/problem states. Pixel
97
- equality is not expected when the native skin intentionally differs. A computed
97
+ equality is not expected when the native skin intentionally differs. A
98
+ difference that the reference's layout mechanics produce (an inline glyph's
99
+ `vertical-align`, half-leading, font metrics) is explained, not copied: see
100
+ [recipes.md](recipes.md#matching) for the construct that states the intent, or
101
+ record the difference and its cause. A computed
98
102
  duration of 400 ms does not prove a 400 ms visible exit if the DOM disappears at
99
103
  200 ms. Reduced motion can set animation names to `none` while a reset still
100
104
  reports a tiny nonzero duration; assert effective motion behavior.
@@ -10,7 +10,7 @@ export type StateToken = {
10
10
  readonly name: StatePseudoClass;
11
11
  readonly negated: boolean;
12
12
  }
13
- /** A direct part (by its class selector) is in a state: `:has(> .part:state)`. */
13
+ /** A part (by its class path from the root) is in a state: `:has(> .part:state)`, `:has(> .box > .part:state)`. */
14
14
  | {
15
15
  readonly kind: "part";
16
16
  readonly part: string;
@@ -57,12 +57,12 @@ export type ConditionProblem =
57
57
  readonly kind: "state-repeated";
58
58
  readonly state: string;
59
59
  }
60
- /** `:has(…)` in another shape than a direct part's class and one part state. */
60
+ /** `:has(…)` in another shape than a part's class path and one part state. */
61
61
  | {
62
62
  readonly kind: "part-state-unsupported";
63
63
  readonly text: string;
64
64
  }
65
- /** `:has(> .class:state)` whose class is no direct part of the recipe. */
65
+ /** `:has(> .class:state)` whose class path is no declared part's path from the root. */
66
66
  | {
67
67
  readonly kind: "part-unknown";
68
68
  readonly part: string;
@@ -16,7 +16,7 @@ function simple(source, at) {
16
16
  if (rest.startsWith("::"))
17
17
  return err({ kind: "pseudo-element", name: IDENTIFIER.exec(rest.slice(2))?.[0] ?? rest.slice(2) });
18
18
  if (rest.startsWith(":has(")) {
19
- const match = /^:has\(> (\.-?[a-z_][\w-]*):([a-z-]+)\)/i.exec(rest), state = match?.[2]?.toLowerCase();
19
+ const match = /^:has\(> (\.-?[a-z_][\w-]*(?: > \.-?[a-z_][\w-]*)*):([a-z-]+)\)/i.exec(rest), state = match?.[2]?.toLowerCase();
20
20
  if (match?.[1] === void 0 || state === void 0 || !PART_STATES.includes(state))
21
21
  return err({ kind: "part-state-unsupported", text: rest.slice(0, rest.indexOf(")") + 1 || rest.length) });
22
22
  return ok({ token: { kind: "part", part: match[1], state }, end: at + match[0].length });
@@ -7,7 +7,48 @@ export function readShape(shape, value, scheme) {
7
7
  const trimmed = value.trim();
8
8
  if (CSS_WIDE.has(trimmed.toLowerCase()))
9
9
  return { kind: "invalid", reason: `${trimmed} is a CSS-wide keyword, not a value` };
10
- return readGrammar(tokenShapeGrammars[shape], trimmed, scheme);
10
+ const grammar = tokenShapeGrammars[shape];
11
+ if (grammar.kind === "quantity" && grammar.textScaled) {
12
+ const fluid = fluidText(trimmed);
13
+ if (fluid !== null)
14
+ return fluid;
15
+ }
16
+ return readGrammar(grammar, trimmed, scheme);
17
+ }
18
+ const FLUID_UNITS = new Set(["rem", "em", "vw", "vi", "svw", "lvw", "dvw", "cqi", "cqw"]), TEXT_BOUND = /^(\d*\.?\d+)(rem|em)$/;
19
+ function fluidText(value) {
20
+ const match = /^clamp\((.*)\)$/i.exec(value);
21
+ if (match === null)
22
+ return null;
23
+ const parts = [];
24
+ let depth = 0, start = 0;
25
+ const body = match[1] ?? "";
26
+ for (let index = 0;index < body.length; index++) {
27
+ const char = body[index];
28
+ if (char === "(")
29
+ depth++;
30
+ else if (char === ")")
31
+ depth--;
32
+ else if (char === "," && depth === 0) {
33
+ parts.push(body.slice(start, index).trim());
34
+ start = index + 1;
35
+ }
36
+ }
37
+ parts.push(body.slice(start).trim());
38
+ if (parts.length !== 3)
39
+ return null;
40
+ const [low = "", preferred = "", high = ""] = parts, units = [...preferred.matchAll(/\d(?:\.\d+)?([a-z%]+)/gi)].map((unit) => (unit[1] ?? "").toLowerCase());
41
+ if (!units.some((unit) => unit !== "rem" && unit !== "em"))
42
+ return null;
43
+ const min = TEXT_BOUND.exec(low), max = TEXT_BOUND.exec(high);
44
+ if (min === null || max === null || min[2] !== max[2] || !units.every((unit) => FLUID_UNITS.has(unit)))
45
+ return { kind: "unscaled", reason: "is a fluid size not of the form clamp(<rem>, <rem> + <vw>, <rem>), whose bounds keep it scaling with the reader's text size" };
46
+ const smallest = Number(min[1]), largest = Number(max[1]);
47
+ if (!(smallest > 0) || largest < smallest)
48
+ return { kind: "invalid", reason: "its smallest size is not positive and at most its largest" };
49
+ if (largest > smallest * 2.5)
50
+ return { kind: "unscaled", reason: `grows from ${low} to ${high}, more than 2.5 times: enlarged text would not reach 200% across that range` };
51
+ return { kind: "valid" };
11
52
  }
12
53
  function readGrammar(grammar, value, scheme) {
13
54
  switch (grammar.kind) {
package/docs/ADS.md CHANGED
@@ -290,8 +290,9 @@ See [LANGUAGE.md](LANGUAGE.md#spatial-construction-and-public-alignment).
290
290
  placed in such a cell is held to the same by its root frame, across owners
291
291
  (`component-keyline`; a root ADS cannot read is `component-keyline-unresolved`).
292
292
  Controls, frames without inline padding and `gutter: "none"` grids are exempt.
293
- - Blocks a stack holds end on one line: a block that paints a box by its outer
294
- edge, one that does not where its content ends (its frame's inline end
293
+ - Blocks a stack holds end on one line: a block that paints a box (a colour or
294
+ gradient fill, a border at its end, or a crop of what it holds at its edge)
295
+ by its outer edge, one that does not where its content ends (its frame's inline end
295
296
  padding, a grid's gutter end); a block more than 1px and at most 64px off its
296
297
  siblings fails at the stack (`source/end-misaligned`). Text is not compared.
297
298
  - A part with a background or a border of its own does not reach a rounded
package/docs/CHANGELOG.md CHANGED
@@ -1,53 +1,110 @@
1
1
  # Changelog
2
2
 
3
- ## 0.5.11
3
+ ## 0.5.13
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
6
  Hot patch: the unit and integration groups; the browser group was not run.
7
- Local verification: **1891/1891 passed** with `bun run test:hotpatch`.
8
- Tested commit: `648d91c76fb65290d62f65e2176c88aee9c0e2ef`; Bun 1.4.4.
9
- Completed 2026-11-25T19:51:24.944Z (1495 seconds).
7
+ Local verification: **1903/1903 passed** with `bun run test:hotpatch`.
8
+ Tested commit: `20668647cf0f7d58fe7f1ae2449ea8ee6a2872c9`; Bun 1.4.4.
9
+ Completed 2026-11-26T08:19:36.167Z (1452 seconds).
10
10
 
11
11
  <!-- ads-local-test-proof
12
12
  {
13
13
  "schema": 3,
14
- "version": "0.5.11",
15
- "commit": "648d91c76fb65290d62f65e2176c88aee9c0e2ef",
16
- "sourceSha256": "6af1e0c2748d4d6e23a40ab159cb246d045c9967dffd42aae97be75c59369e76",
14
+ "version": "0.5.13",
15
+ "commit": "20668647cf0f7d58fe7f1ae2449ea8ee6a2872c9",
16
+ "sourceSha256": "efe08eecc94ea7c9502692707f0e4788ed865ffe378fb6797959292a9738efc0",
17
17
  "command": "bun run test:hotpatch",
18
18
  "scope": "hotpatch",
19
19
  "result": "pass",
20
- "tests": 1891,
21
- "pass": 1891,
20
+ "tests": 1903,
21
+ "pass": 1903,
22
22
  "fail": 0,
23
23
  "skipped": 0,
24
24
  "groups": [
25
25
  {
26
26
  "name": "unit",
27
- "tests": 846,
28
- "pass": 846,
27
+ "tests": 851,
28
+ "pass": 851,
29
29
  "fail": 0,
30
30
  "skipped": 0,
31
- "reportSha256": "6345564f7e950a85afc5eb2836448966e6f8091e9f91c0085bf8cdca8a06c44b"
31
+ "reportSha256": "0dfbbea8f12a5b7fb692755cad174bdd03a18ccb8a3e6d1e3668dee2282f8681"
32
32
  },
33
33
  {
34
34
  "name": "integration",
35
- "tests": 1045,
36
- "pass": 1045,
35
+ "tests": 1052,
36
+ "pass": 1052,
37
37
  "fail": 0,
38
38
  "skipped": 0,
39
- "reportSha256": "2d7516ff31fc5441401354209e1eea1097f5a0755ab8ab545c2f88ea6b553a59"
39
+ "reportSha256": "f5604c0b8e13cd293c9d122cce8237b8564ac595facd77eccb1d0828c105aab7"
40
40
  }
41
41
  ],
42
42
  "testOverrides": {},
43
43
  "bun": "1.4.4",
44
- "completedAt": "2026-11-25T19:51:24.944Z",
45
- "durationMs": 1495008,
46
- "logSha256": "19d24c850349946e6edc2c724e14de7feeabdfa426b6c9e2f64c40ffba87d743"
44
+ "completedAt": "2026-11-26T08:19:36.167Z",
45
+ "durationMs": 1452001,
46
+ "logSha256": "aec0afad38322c2bd2ed23a6d791cbb484ac4576c9e0eda7818de26662d8a3d7"
47
47
  }
48
48
  -->
49
49
  <!-- ads-local-tests:end -->
50
50
 
51
+ - *Fixed: a modal card with a fixed width overflowed a phone* (#52). A card's
52
+ frame `inlineSize` is the size it prefers; on a narrower screen the viewport's
53
+ room wins. Cards and popovers measure that room from their containing block
54
+ (`100%`), the viewport without its scrollbar's room, not `100vw`.
55
+ - *A modal card keeps its scroll to itself* (#51): `overscroll: "contain"` on a
56
+ layer root the layer makes scroll, with no `overflow`.
57
+ - *Fixed: a popover dropped its frame's maximum height* (#56): the smaller of the
58
+ frame's `maxBlockSize` and the viewport's room applies.
59
+ - *A multi-line field* (#53): `element: "textarea"` keeps a control frame's
60
+ stated insets around the lines; a `<textarea>` with a control frame declares
61
+ it (`source/textarea-element-missing`).
62
+ - *Fixed: a drawing read in a helper function was emitted as a read of `{}`*
63
+ (#57): a recipe drawing read outside the markup of the part that shows it is
64
+ refused at check time (`source/drawing-read-unbound`).
65
+ - *Fixed: a themed decoration two parts deep failed to lower* (#59).
66
+ - *Fixed: a part hidden under a condition kept its space after* (#62): it gives
67
+ that space only where it shows.
68
+ - *Fixed: a stage whose screenshot runs off its end set the end-alignment line*
69
+ (#54, #64): a gradient fill and a part that crops what it holds show their
70
+ box's edge, as a colour fill does.
71
+ - *Items that grow from their own width* (#55): `extent: "grow"` (`flex: 1 1
72
+ auto`); in a wrapping row items sit at their own widths where they fit and
73
+ fill their line where they wrap.
74
+ - *A whole-viewport modal that drops in* (#58): a dialog's `edge: "fill"`
75
+ covers the viewport; `motion: "drop"` now also applies to dialogs.
76
+ - *A zoom view* (#61): `motion: "veil"` fades only a dialog's backdrop, while
77
+ what it holds animates on its own (an image growing from its place).
78
+ - *Labels that scale with their drawing* (#60): an anchored label's `size`, in
79
+ the drawing's units, grows with the drawing and never goes below its text
80
+ profile's size; `anchor.block: "baseline"` sits it on its baseline.
81
+ - *A fluid text size* (#65): a font-size token may be `clamp(<rem>, <rem> +
82
+ <vw>, <rem>)`, its largest bound at most 2.5 times its smallest, so enlarged
83
+ text still reaches 200%.
84
+ - *In turn, however many* (#65): `play: { sequence, orderBy }` staggers each
85
+ instance of a repeated part by a measured `index` the owner writes at render.
86
+ New code: `construction/sequence-order-unmeasured`.
87
+ - *A pulse that starts over* (#63): a sequence's `repeat: "restart"` repeats from
88
+ its first step without requiring its end to match its start.
89
+
90
+ ## 0.5.12
91
+
92
+ - *Fixed: a row in block flow could not span its column* (#47). `extent: "fill"`
93
+ on a part with its own `recipe` in block flow makes it a block as wide as its
94
+ container; a heading row's `space-between` puts its switch at the column's end.
95
+ - *Fixed: a control frame left a native field its inset border* (#48). A
96
+ `frame: "control"` writes the frame's border style (solid unless it states
97
+ one) beside its widths, so an `<input>` no longer shows the browser's bevelled
98
+ edge. `element: "text-input"` takes every one-line text entry: `text`,
99
+ `email`, `tel`, `url`, `password`, `number` or no type.
100
+ - *A nested part's own state* (#49). A `when` condition names any declared part
101
+ by its path from the root, `&:has(> .box > .control:focus-visible)`, checked
102
+ step by step, so a text field's input inside its box reacts to its own focus
103
+ and hover. `&` stays the owner's root in every `when`; existing conditions
104
+ keep their meaning.
105
+
106
+ ## 0.5.11
107
+
51
108
  - *A scrolling element's scrollbar colours and width.* A surface's
52
109
  `scrollbarThumb` and `scrollbarTrack` (paints, set together) are written as
53
110
  `scrollbar-color`, and `scrollbarWidth`, a token of the new
package/docs/LANGUAGE.md CHANGED
@@ -248,11 +248,11 @@ them all.
248
248
  | `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`) |
249
249
  | `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 a stack, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it), the larger where two meet, the first part flush. In block flow, the part's own `margin-block-start` and `margin-block-end`, which the browser collapses: the larger where two meet, and a last block's space passes out through containers without padding or border (a list item, a component's root) to what follows them, so loose list items whose content is another component keep their space. A placed component (`kind: "component"`) takes its space the same way. A part laid out as an `inline` row that states its own space (`spaceBefore`, `spaceAfter`, `spacing`) is a block in block flow (`display: flex; inline-size: fit-content`, or its full width with `extent: "fill"`), so its space collapses with the blocks around it; a row without space of its own stays inline-level (`inline-flex`) and keeps its line beside inline text. Inside its own block padding or border, a block flow starts and ends flush (`> :first-child` loses its space before, `> :last-child` its space after): there the space could not pass out and would only add to the padding | another parent layout (`space-parent-unsupported`) |
250
250
  | `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`) |
251
- | (a `stack` of blocks) | root, part recipe | the blocks a stack holds end on one line: a painted block by its outer edge, an unpainted one where its content ends (frame end padding, a grid's gutter end); one off by more than 1px and at most 64px fails (`source/end-misaligned`); text is not compared | n/a |
251
+ | (a `stack` of blocks) | root, part recipe | the blocks a stack holds end on one line: a painted block (a colour or gradient fill, a border at its end, or a part that crops what it holds at its edge, such as a stage whose screenshot runs off) by its outer edge, an unpainted one where its content ends (frame end padding, a grid's gutter end); one off by more than 1px and at most 64px fails (`source/end-misaligned`); text is not compared | n/a |
252
252
  | `flow: { edges: "trim" }` | block-flow root (no `layout`) | its first child's space before and its last child's space after become nothing, as a stack starts and ends flush: a page that opens with a heading starts at its top. Without it, a frameless block-flow root passes those spaces out, as CSS margins do (the loose list's item content). The automatic flush applies only to padding or a border on the flow's own element: a flow that is a component's root placed inside another component's padding (Content inside a Callout) is frameless, so it declares this to end flush | `recipe.flow` on a root with a `layout` (`spec/value-invalid`) |
253
253
  | `frame: { …, safeArea: ["block-end", …] }` (a root's frame; a part's `frame: { profile, safeArea }`) | root, part | each named side's padding plus `env(safe-area-inset-<side>, 0px)`: a phone's bottom bar above the home indicator; an inline side is written for left-to-right and mirrored under `:dir(rtl)` | a side outside `block-start`, `block-end`, `inline-start`, `inline-end` (`spec/value-invalid`) |
254
254
  | `groups: { "<name>": { play?, when?: { "<owner state>": { play } } } }` | visual or decoration part | sequences played by named groups of the part's drawing (`<part> > svg [data-group]`), each around its own box; `play.paused` holds one at its first step under a state ([MOTION.md](MOTION.md#groups-inside-a-drawing)) | a group the drawing does not declare, or a drawing not shown as inline SVG (`artwork-group-unknown`); a drawn group without `pathLength="1"` (`artwork-group-draw-length`) |
255
- | `anchor: { artwork, x, y, inline?, block? }` | text part | the text placed on a sibling decoration's drawing at `x`, `y` in the drawing's coordinates (its viewBox), aligned by its start, centre or end on each axis (`position: absolute`, a share of the parent's box): real, checked text over a diagram. The parent is sized to the drawing (`aspect-ratio` of its viewBox), so the drawing fills it exactly | an artwork that is not a sibling decoration with a drawing, labels on two drawings in one parent, or a parent that states its own block size or ratio (`text-anchor-unsupported`) |
255
+ | `anchor: { artwork, x, y, inline?, block?, size? }` | text part | the text placed on a sibling decoration's drawing at `x`, `y` in the drawing's coordinates (its viewBox), aligned by its start, centre or end (and on the block axis by its `baseline`, as SVG text sits: the label is trimmed to end at its first baseline, which falls back to its line box where `text-box-trim` is not supported). `size` (drawing units) sizes the label with the drawing (`max(<text size>, 100cqi × size / viewBox width)`, the parent its inline-size container), never below its text profile's size, which it needs (`text-anchor-unsupported`) on each axis (`position: absolute`, a share of the parent's box): real, checked text over a diagram. The parent is sized to the drawing (`aspect-ratio` of its viewBox), so the drawing fills it exactly | an artwork that is not a sibling decoration with a drawing, labels on two drawings in one parent, or a parent that states its own block size or ratio (`text-anchor-unsupported`) |
256
256
  | `origin: "center" \| "inline-start" \| "inline-end" \| "block-start" \| "block-end"` | root, part | where its scales and `rotate` grow from, in states, entrances and sequences alike (`transform-origin`; an inline edge also writes its mirror under `:dir(rtl)`); `"center"`, the default, writes nothing | another value (`spec/value-invalid`) |
257
257
  | `carry: true` | `stack` root | loose flow (a list whose items hold paragraphs, code, figures): the stack gives its gap to its children (`--ads-flow-gap`), and its last part's own space after carries out of it between items (`margin-block-end: max(0px, space - gap)`), so on a list and its item the next item starts at the larger of the list's gap and the item's last block's space after; after the last item the list's own space after applies | a root that is not a stack (`space-parent-unsupported`) |
258
258
  | 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 |
@@ -270,7 +270,7 @@ them all.
270
270
  | `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) |
271
271
  | 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 |
272
272
  | `sticky: { edge: "block-start" \| "block-end", clear?: "block-start" }` | root (not a top-layer root), part | `position: sticky` at that edge of the nearest scrolling container (`inset-block-start: 0`); with `clear`, below the region the layer profile's `clearBlockStart` names; `z-index` from the layer profile's `stickyLayer` when it has one | `clear` with the end edge; `clear` without a layer profile that states `clearBlockStart` |
273
- | `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released, so the part's content is confined to it; in a `stack` whose frame states only a minimum height (`minBlockSize`, with no `blockSize`, `maxBlockSize`, ratio or `overflow`) the part keeps its content's height and the stack grows with it; `align-self: stretch` with `fill-both` | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
273
+ | `extent: "fill" \| "fill-both" \| "grow"` | part | `grow`: `flex: 1 1 auto`, the part grows from its own size, so in a wrapping row items sit side by side at their own widths where they fit and each fills its line where they wrap (a pricing hero's two buttons). `fill`: `flex: 1 1 0`, the main-axis minimum released, so the part's content is confined to it; in a `stack` whose frame states only a minimum height (`minBlockSize`, with no `blockSize`, `maxBlockSize`, ratio or `overflow`) the part keeps its content's height and the stack grows with it; `align-self: stretch` with `fill-both`. In block flow (a parent without an arrangement), `fill` on a part with its own `recipe` makes it a block as wide as its container: a heading row whose switch sits at the column's end (a row is `display: flex` there, without `fit-content`) | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
274
274
  | `extent: "content" \| "container"` | root of an `inline` row, or of a control | `"content"` (the default): as wide as its content, never wider than its container (`display: inline-flex; max-inline-size: 100%`, or `min(100%, <cap>)` under its frame's own cap); `"container"`: the width available in any parent, a block one, a column that aligns its children, or a row beside siblings (`display: flex; inline-size: 100%`), so a filling part has the rest of the row | on a `stack`, `flow`, `layered` or top-layer root, which never hug (`spec/field-unsupported`); `"container"` with a frame that fixes the row's width (`construction/extent-conflict`); a part with `extent: "fill"` in a `"content"` row whose frame does not fix its width (`construction/extent-row-hugs`) |
275
275
  | `layout: "layered"` | root, part recipe | one `minmax(0,1fr)` grid area; every declared child part at `1 / 1`; paint order is DOM order, no `z-index` | fewer than two parts (`layered-parts-missing`); `gap` or `wrap` |
276
276
  | `outset: { block?, inline? }` (spacing fields) | a childless, non-text part of a `layered` parent | `margin-block` / `margin-inline: calc(-1 * <spacing>)`: the backdrop is drawn past its parent's box (a glow behind a card); the grid area and the layout around it are unchanged. A field bound to a `box-share` token (the spacing profile's `outsetBlock` / `outsetInline`) is a share of the box on that axis and grows with it: the same margin on the inline axis, and on the block axis `block-size: calc(100% + 2 * <share>)` centred over the area (`align-self: center`) | any other part (`construction/outset-unsupported`) |
@@ -281,7 +281,7 @@ them all.
281
281
  | `frame: { profile, rules?, corners? }`; `at: { "<condition>": { frame: { rules?, corners? } } }` | part with its own box | the box's one-sided rules and rounded corners as a root frame's, and under the condition only what the condition changes: a tinted side with a hairline on top and rounded bottom corners while stacked, on its start side and end corners beside | a frame change on a part without its own box; condition `rules` on a box without `rules` (`spec/value-invalid`) |
282
282
  | `at: { "<condition>": { align?, justify?, textAlign? } }` | region root, part | the element's arrangement alignment (`align-items`, `justify-content`) and `text-align` inside the condition's range, its own outside it: a banner centred on phones and start-aligned from a width; a root's alignment needs no `frame` | unknown condition (`condition-unknown`); an entry that changes nothing (`spec/value-invalid`) |
283
283
  | `recipe.conditionQuery["<condition>"]` | owner code | the literal media range the CSS writes (`(width < 47.5rem)`), for `matchMedia` | the recipe's spatial profile lacks it (`choice/recipe-access-unsupported`) |
284
- | `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary" \| "document"`, `marker: "none"` | root, part (`document`: a pattern's root only) | the element's closed UA normalization (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
284
+ | `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "textarea" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary" \| "document"`, `marker: "none"` | root, part (`document`: a pattern's root only) | the element's closed UA normalization (`text-input`: an `<input>` of type `text`, `email`, `tel`, `url`, `password` or `number`, or without a type; `search-input`: `type="search"`; `textarea`: a `<textarea>`, whose control frame keeps its stated insets around its lines instead of centring one; a `<textarea>` with a control frame declares it, `source/textarea-element-missing`) (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
285
285
  | `align: "start" \| "center" \| "end"` on a cell (`element: "cell" \| "header-cell"`); `extent: "container"` on a table root | cell; table root | `vertical-align: top \| middle \| bottom` (rows whose cells wrap to different line counts start together at the top); `inline-size: 100%` (a table as wide as its container instead of its content) | `align` on any other part (`field-unsupported`); a table frame that fixes its width as well (`extent-conflict`) |
286
286
  | `normalize: { textDecoration: "none", pointerEvents: "none", borderStyle: "none" }` | root, `normalize.when`; `textDecoration` and `pointerEvents` also on a part (a link card's link, a decorative layer at any depth) | `text-decoration-line`, `pointer-events`, `border-style` | pointer transparency on focusable or interactive, non-`aria-hidden` markup (`source/pointer-transparent-interactive`) |
287
287
  | `normalize: { cursor, touchAction, userSelect }`, `snap` | root, part, `normalize.when`; scrolling arrangement | see [interaction properties](#interaction-properties) | a value outside its set (`spec/value-invalid`); snap without scrolling (`snap-without-scroll`) |
@@ -353,9 +353,15 @@ element's own text profile; an underline change does not. An underline colour
353
353
  that also fades is a paint: `textDecorationColor` on the surfaces, with the
354
354
  `text-decoration-color` channel of `paintTransition`.
355
355
 
356
- A state of one of the recipe's own direct parts is also a state of the root,
357
- written `:has(> .part:state)` with `:checked`, `:indeterminate`,
358
- `:focus-visible`, `:hover` or `:disabled`:
356
+ `&` is always the owner's root, in a part's `when` too: a glyph that shrinks
357
+ under `&:active` shrinks while the button is pressed. A state of one of the
358
+ recipe's own parts is also a state of the root, written `:has(> .part:state)`
359
+ with `:checked`, `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`.
360
+ A nested part is named by its path from the root, each step a declared part at
361
+ its depth: a text field's input inside its box is
362
+ `&:has(> .field-box > .field-control:focus-visible)`, and the rule it writes
363
+ selects exactly that path (`construction/condition-unsupported` names a path no
364
+ declared part has):
359
365
 
360
366
  ```ts
361
367
  parts: {
@@ -815,17 +821,33 @@ recipe({
815
821
  to an owned child with its own frame. Every modal sheet also emits the
816
822
  document scroll lock `html:has(:modal) { overflow: hidden }` once in its
817
823
  owner's sheet. It keeps no room for the hidden scrollbar: a sheet at the
818
- inline end would stop short of the viewport's edge.
824
+ inline end would stop short of the viewport's edge, and keeping it only while
825
+ a modal is open shifts a page that had no scrollbar. A design system whose
826
+ page must not move behind a modal keeps the room at all times with the
827
+ foundation's `scrollbarGutter: "stable"`; where scrollbars overlay the page it
828
+ reserves nothing.
829
+ - **Whole-viewport modal** (`element: "dialog"`; `edge: "fill"`): a `<dialog>`
830
+ over the entire viewport, no margin and no layer profile (a phone menu, a
831
+ zoom view); its content is placed inside it (a close control is a layer in
832
+ its corner, the viewport's corner). It takes a card's motions.
819
833
  - **Modal card** (`element: "dialog"`; `edge: "center" | "block-start"`): the
820
834
  same `<dialog>`, a card centred in the viewport, or centred inline below the
821
835
  top. A centred card keeps the layer profile's `viewport-margin` from every
822
836
  viewport edge; a block-start card keeps its `edge-gap` from the top and the
823
837
  bottom (the margin when it declares none) and the margin at the sides
824
- (`max-inline-size`, `max-block-size: calc(100dvh - 2 × gap)`), with its
825
- frame's size within it. The scroll lock hides the page's scrollbar; a page
838
+ (`max-inline-size: calc(100% - 2 × margin)`, `max-block-size: calc(100dvh -
839
+ 2 × gap)`), with its frame's size within it: the frame's `inlineSize` is the
840
+ size it prefers, and on a narrower screen the room wins (a 540px card on a
841
+ phone). The room is measured from the card's containing block, the viewport
842
+ without its scrollbar's room. A card taller than the screen scrolls inside;
843
+ `overscroll: "contain"` on its root (with no `overflow`, the layer makes it
844
+ scroll) keeps that scroll from reaching the page. The scroll lock hides the page's scrollbar; a page
826
845
  that should not shift then keeps the scrollbar's room at all times with the
827
846
  foundation's `scrollbarGutter: "stable"`. `motion: "fade"`
828
- fades the card and its backdrop in. A close control in its corner is a layer of a layered part.
847
+ fades the card and its backdrop in; `"drop"` fades it while it comes down
848
+ its motion profile's `distance` from its `scale`; `"veil"` fades only the
849
+ backdrop and keeps the dialog shown until it has (a zoom view, whose image
850
+ grows from its place by its own measured motion). A close control in its corner is a layer of a layered part.
829
851
  A zoom view that grows an image from its place sets a measured `translate`
830
852
  and a measured `scale` (`{ type: "scale", property: "scale" }`, unitless
831
853
  factors per axis) on the image and animates them with their `motion`.
@@ -833,12 +855,14 @@ recipe({
833
855
  non-modal panel pinned to a viewport `corner` by logical insets, with light
834
856
  dismiss and Escape from `popover="auto"`. A `layer` profile (`edge-gap`,
835
857
  `viewport-margin` and, for `clear: "block-start"`, `clear-block-start`)
836
- places it; `100dvh` bounds its height. The clearance must resolve to a fixed
858
+ places it; `100dvh` bounds its height, and the frame's own `maxBlockSize`
859
+ when it is smaller (a list that scrolls past 320px). The clearance must resolve to a fixed
837
860
  length (`construction/layer-clearance-unbounded`).
838
861
  - **Measured popover** (`placement: "measured"`): the same panel, anchored by
839
862
  the owner to an element (its trigger, a pointer, a text selection). The
840
863
  compiler fixes it in the top layer with every inset released and its size
841
- within the viewport less the layer profile's `viewport-margin`. The owner
864
+ within the viewport less the layer profile's `viewport-margin`, and within
865
+ the frame's own caps when they are smaller. The owner
842
866
  writes the position through the recipe's
843
867
  [measured values](#measured-runtime-geometry), which the panel reads only
844
868
  while open. Its root declares at least one measured inset or `translate`
@@ -941,6 +965,10 @@ Each `type` (setter value; place) has a closed property list:
941
965
  `slider-fill`, the fill of a range slider with a `sliderFill` treatment, or
942
966
  `slider-step`, the place of each step label in a row `along` a slider
943
967
  ([range sliders](#range-sliders)). Written with `measured.props` at render.
968
+ - `index` (0, 1, 2…, an instance's place among its siblings):
969
+ `sequence-order`, read by a sequence staggered by it
970
+ (`play: { sequence, orderBy: "<name>" }`, [MOTION.md](MOTION.md#sequences)).
971
+ Written on each instance with `measured.props` at render.
944
972
 
945
973
  Rules:
946
974
 
package/docs/MOTION.md CHANGED
@@ -468,6 +468,11 @@ recipe({
468
468
  it. An indicator rendered only while work is in progress needs nothing more.
469
469
  - The older continuous rotation (`repeat: "continuous"` with `rotate` on a
470
470
  standalone artwork part) is unchanged.
471
+ - **In turn, however many.** `play: { sequence, orderBy: "word" }` on a
472
+ repeated part starts each instance as many staggers late as its measured
473
+ `index` (`measured: { word: { type: "index", property: "sequence-order" } }`,
474
+ written on each instance with `measured.props({ word: i })`): a title from
475
+ props whose words rise one after another.
471
476
  - **Held, then played.** `play: { sequence, paused: true }` under one owner
472
477
  state holds the element at its first step (`animation-play-state: paused`),
473
478
  and the same sequence under another state plays it: a diagram armed before it