@reqvire-org/ads 0.5.8 → 0.5.10

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 (52) hide show
  1. package/dist/ads-errors.mjs +68 -1
  2. package/dist/analysis/owner-source.mjs +16 -2
  3. package/dist/asset-declaration.d.mts +5 -0
  4. package/dist/asset-declaration.mjs +8 -2
  5. package/dist/asset-model.mjs +3 -0
  6. package/dist/construction-output.mjs +28 -6
  7. package/dist/construction-spec.d.mts +115 -10
  8. package/dist/construction-spec.mjs +183 -45
  9. package/dist/end-alignment.mjs +17 -2
  10. package/dist/form-states.mjs +2 -2
  11. package/dist/grid-lowering.mjs +24 -1
  12. package/dist/lowering-layer.mjs +11 -10
  13. package/dist/lowering-overlaps.mjs +5 -3
  14. package/dist/lowering-properties.mjs +11 -1
  15. package/dist/lowering-region-layout.mjs +4 -4
  16. package/dist/lowering-sequence.mjs +6 -2
  17. package/dist/mcp/preview-http.bundle.js +3 -3
  18. package/dist/mcp/preview-widget.bundle.js +40 -40
  19. package/dist/measured-geometry.mjs +15 -3
  20. package/dist/owner-analysis-check.mjs +36 -0
  21. package/dist/owner-errors.mjs +6 -0
  22. package/dist/ownership-model.mjs +35 -9
  23. package/dist/platform-features.mjs +11 -0
  24. package/dist/press-scale.mjs +3 -1
  25. package/dist/profile-macro.d.mts +5 -0
  26. package/dist/profile-view-facts.mjs +1 -1
  27. package/dist/recipe-macro.d.mts +61 -6
  28. package/dist/recipe-model.mjs +11 -6
  29. package/dist/region-lowering.mjs +417 -36
  30. package/dist/role-vocabulary.d.mts +7 -0
  31. package/dist/role-vocabulary.mjs +13 -1
  32. package/dist/showcase/client.bundle.js +39 -39
  33. package/dist/showcase/http-client.bundle.js +17 -17
  34. package/dist/showcase/scenario-page.mjs +37 -12
  35. package/dist/showcase/ui/ui.css +1 -1
  36. package/dist/showcase/ui/ui.js +2 -2
  37. package/dist/skills/ads-designer/references/motion.md +4 -1
  38. package/dist/skills/ads-designer/references/recipes.md +35 -1
  39. package/dist/skills/ads-import/references/recipes.md +35 -1
  40. package/dist/skills/ads-port/references/recipes.md +35 -1
  41. package/dist/spatial-model.mjs +11 -2
  42. package/dist/surface-effects.mjs +11 -6
  43. package/docs/ARCHITECTURE.md +16 -0
  44. package/docs/ASSETS.md +7 -1
  45. package/docs/CHANGELOG.md +160 -18
  46. package/docs/GUIDE.md +20 -1
  47. package/docs/LANGUAGE.md +137 -16
  48. package/docs/MOTION.md +45 -0
  49. package/docs/PROFILE-KINDS.md +15 -4
  50. package/docs/RULES.md +12 -3
  51. package/docs/TOKEN-ROLES.md +8 -2
  52. package/package.json +1 -1
@@ -677,6 +677,13 @@ export const choiceErrors = {
677
677
  message: (failure) => `Part "${failure.part}" declares \`resize\` but is rendered as <${failure.element}>.`,
678
678
  repair: "Declare `resize` on the part rendered as `<textarea>`, or remove it."
679
679
  },
680
+ "decoration-exposed": {
681
+ group: "accessibility-semantics",
682
+ rule: 'A decoration (`kind: "decoration"`) carries no meaning: its element is `aria-hidden="true"` and holds nothing a person can use. ADS writes it behind its parent\'s content and lets the pointer through.',
683
+ guides: [RECIPES, "ads://guides/accessibility"],
684
+ message: (failure) => `Decoration "${failure.part}" is not hidden from assistive technology.`,
685
+ repair: 'Add `aria-hidden="true"` to the decoration\'s element; content that means something is a visual or text part, not a decoration.'
686
+ },
680
687
  "pointer-transparent-interactive": {
681
688
  group: "accessibility-semantics",
682
689
  rule: '`pointerEvents: "none"` is for decorative overlays: never on a focusable element, and only on markup hidden from assistive technology (`aria-hidden`) or free of interactive content.',
@@ -1047,7 +1054,7 @@ export const constructionErrors = {
1047
1054
  case "mask-on-container":
1048
1055
  return `Surface ${failure.surface} declares mask, but it is applied to a container that does not scroll: its content, text included, would fade where it stands.`;
1049
1056
  case "brightness-off-visual":
1050
- return `Surface ${failure.surface} declares brightness, but it is not applied to a visual part: the text it covers would change colour without a contrast check.`;
1057
+ return `Surface ${failure.surface} declares ${failure.field}, but it is not applied to a visual part: the text it covers would change colour without a contrast check.`;
1051
1058
  }
1052
1059
  },
1053
1060
  repair: "On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ."
@@ -1119,6 +1126,48 @@ export const constructionErrors = {
1119
1126
  message: (failure) => `${failure.element === "&" ? "The root" : `Part ${failure.element}`} takes text profile ${failure.profile} under a state, which changes ${failure.property}.`,
1120
1127
  repair: "Derive the state's text profile from the element's own (`extends`) and change only `weight` or `letterSpacing`; a different size or family is a different element or a recipe choice, not a state."
1121
1128
  },
1129
+ "text-anchor-unsupported": {
1130
+ group: "structure-mismatch",
1131
+ rule: "A text part placed on a drawing (`anchor: { artwork, x, y }`) names a sibling decoration whose artwork is the drawing: their parent is sized to the drawing (its viewBox ratio), so the drawing fills it and a point of the drawing is a share of the parent's box. One parent places labels on one drawing, and states no block size or ratio of its own.",
1132
+ guides: [RECIPES],
1133
+ message: (failure) => failure.reason === "artwork" ? `Text part ${failure.part} is anchored to a part that is not a sibling decoration with artwork.` : failure.reason === "several" ? `Text part ${failure.part} is anchored to another drawing than its siblings: one parent is sized to one drawing.` : `Text part ${failure.part} is anchored to a drawing, but its parent already states a block size or ratio.`,
1134
+ repair: 'Anchor labels to a `kind: "decoration"` sibling that binds the drawing, all to the same one, and leave the parent\'s height to the drawing.'
1135
+ },
1136
+ "slider-fill-unsupported": {
1137
+ group: "structure-mismatch",
1138
+ rule: 'A slider\'s fill (`pseudo.sliderFill`) is drawn on its track up to the thumb: the element draws its track (`sliderTrack`), whose size and radius the fill takes, and declares a measured share (`{ type: "share", property: "slider-fill" }`) the owner writes as the value\'s place in its range, 0 to 1. Firefox draws the fill natively; other engines paint the track up to the share.',
1139
+ guides: [RECIPES],
1140
+ message: (failure) => failure.reason === "track-missing" ? `${failure.part} declares a slider fill but no sliderTrack.` : `${failure.part} declares a slider fill but no measured share (property "slider-fill") that places it.`,
1141
+ repair: 'Give the slider a `sliderTrack` treatment and declare `measured: { fill: { type: "share", property: "slider-fill" } }` on it; the owner writes `(value - min) / (max - min)`, at render with `measured.props`.'
1142
+ },
1143
+ "slider-steps-unsupported": {
1144
+ group: "structure-mismatch",
1145
+ rule: 'A row of step labels (`along: "<slider part>"`) lies under a sibling slider: it is inset by half the thumb\'s width, so the thumb\'s centre at each end is a label\'s centre, and each label is centred at its own measured share (`{ type: "share", property: "slider-step" }`). The row arranges its labels itself: it declares no layout.',
1146
+ guides: [RECIPES],
1147
+ message: (failure) => failure.reason === "slider-missing" ? `Step row ${failure.part} names no sibling slider part with a sliderThumb.` : failure.reason === "thumb-size" ? `Step row ${failure.part} follows a slider whose thumb frame states no inline size.` : failure.reason === "share-missing" ? `Step row ${failure.part} declares no measured share (property "slider-step") that places its labels.` : `Step row ${failure.part} declares a layout of its own; its labels are placed along the slider.`,
1148
+ repair: 'Name a sibling part whose `sliderThumb` frame states `inlineSize`, declare `measured: { step: { type: "share", property: "slider-step" } }` on the row and write each label\'s share with `measured.props`; drop the row\'s layout.'
1149
+ },
1150
+ "artwork-group-unknown": {
1151
+ group: "structure-mismatch",
1152
+ rule: "A part animates the named groups its drawing declares (`groups` in the asset, `data-group` in its SVG): a wordmark's letters, a diagram's edges. The drawing is shown as inline SVG (paint slots or foreground); an image document (intrinsic paint) is drawn as an <img>, where nothing inside can be reached.",
1153
+ guides: [RECIPES, "ads://guides/branding"],
1154
+ message: (failure) => failure.groups.length === 0 ? `Part ${failure.part} animates group ${failure.group}, but its drawing declares no groups or is not inline SVG.` : `Part ${failure.part} animates group ${failure.group}, which its drawing does not declare (it declares ${failure.groups.join(", ")}).`,
1155
+ repair: 'Name a group the asset declares, or declare it: `groups: ["<name>"]` in the asset and `data-group="<name>"` on its element in the SVG.'
1156
+ },
1157
+ "artwork-group-draw-length": {
1158
+ group: "structure-mismatch",
1159
+ rule: 'A line drawn along its length (a sequence\'s `draw` step) is measured on a length of 1: each shape of the group states `pathLength="1"` in the SVG, so the dash covers the whole line whatever its real length.',
1160
+ guides: [RECIPES],
1161
+ message: (failure) => `Group ${failure.group} of part ${failure.part} is drawn along its length, but its shapes do not all state pathLength="1".`,
1162
+ repair: 'Add `pathLength="1"` to each path, line, polyline, polygon, circle, ellipse or rect of the group in the SVG.'
1163
+ },
1164
+ "between-axes-unsupported": {
1165
+ group: "structure-mismatch",
1166
+ rule: "`between: { axes }` draws rules between arranged items on the axes it names: a stack's (or a block flow's) on the block axis, a single-line row's on the inline axis, a wrapping row's or a grid's on either or both. Layers overlap and have nothing between them, and each item's `::before` draws its rules, so no item may already use it.",
1167
+ guides: [RECIPES],
1168
+ message: (failure) => failure.layout === "::before taken" ? `${failure.element} already uses ::before, which the rules between items draw in.` : `${failure.element} cannot separate its items on the named axes (${failure.layout}).`,
1169
+ repair: "Name the axis the arrangement separates its items on (block for a stack, inline for a row), wrap the row or use a grid for both, or move the item's own ::before treatment to another element."
1170
+ },
1122
1171
  "outset-unsupported": {
1123
1172
  group: "structure-mismatch",
1124
1173
  rule: "`outset` draws a decorative backdrop past its parent's box (a glow behind a card): it belongs on a part of a `layered` parent that holds no parts and no text. The parent's box and the layout around it do not change.",
@@ -1544,6 +1593,10 @@ export const constructionErrors = {
1544
1593
  return `Measured value "${failure.name}" is an image's intrinsic size, but ${element} is not a contained application image (a visual part whose visual profile declares fit: "contain").`;
1545
1594
  case "cover-missing":
1546
1595
  return `Measured value "${failure.name}" is a focal position (${failure.property}), but ${element} is not a cropped application image (a visual part whose visual profile declares fit: "cover").`;
1596
+ case "fill-missing":
1597
+ return `Measured value "${failure.name}" is a slider's fill share, but ${element} has no sliderFill treatment that draws it.`;
1598
+ case "steps-missing":
1599
+ return `Measured value "${failure.name}" places step labels, but ${element} is not a row of step labels (\`along: "<slider part>"\`).`;
1547
1600
  }
1548
1601
  },
1549
1602
  repair: 'Measure a property of the closed list (`inset-*`, `inline-size`, `block-size` and their min/max, `translate`, a grid track that exists in every tier); declare `placement: "measured"` for an element-anchored popover; move design values to profiles.'
@@ -3542,6 +3595,20 @@ export const runtimeErrors = {
3542
3595
  message: (review) => `Part "${review.part}" truncates its text without a title.`,
3543
3596
  repair: "Set `title` on the truncated element to its full text; when an expand control or the full content elsewhere shows it, the note can be dismissed after review."
3544
3597
  },
3598
+ "disabled-unshown": {
3599
+ group: "accessibility-semantics",
3600
+ rule: 'A control that can be disabled looks disabled: an owner that declares a disabled state (`&:disabled` or `&[aria-disabled="true"]` in a `when`) paints it differently, through its surface (an `inactive` surface profile), its opacity or its artwork. A cursor or pointer change alone shows only under a pointer, after the person reached for the control. WCAG 2.2 exempts inactive controls from contrast minimums, not from being told apart.',
3601
+ guides: [RECIPES, "ads://guides/accessibility"],
3602
+ message: (review) => `This control has a disabled state that ${review.changes.length === 0 ? "changes nothing" : `changes only ${review.changes.join(", ")}`}: disabled, it looks the same as enabled.`,
3603
+ repair: "Under `&:disabled`, select an `inactive` surface profile (or lower the opacity) so the disabled control is seen as unavailable."
3604
+ },
3605
+ "decoration-under-text": {
3606
+ group: "accessibility-semantics",
3607
+ rule: "Text over a decoration is readable in every theme: the decoration lies under the construction's text, so its contrast depends on the artwork or pattern, which the static check cannot see through. A scenario that renders the owner lets the render audit measure it.",
3608
+ guides: [RECIPES, "ads://guides/accessibility"],
3609
+ message: (review) => `Text in this owner is drawn over decoration "${review.part}": its contrast is measured by the render audit, not proven statically.`,
3610
+ repair: "Cover the owner with a scenario so the render audit measures the text over the decoration in every theme; fade the decoration (a surface `mask`) where text lies."
3611
+ },
3545
3612
  "counter-unreset": {
3546
3613
  group: "conflict",
3547
3614
  rule: "A CSS counter a construction shows (`content: { counter | counters }`) or counts (`counter: { increment }`) is reset by some recipe of the design system (`counter: { reset }`), or is the browser's own `list-item`. Without a reset the browser starts an implicit counter at each element that counts, so every item shows 1. Listed for review, since a page may reset it outside the design system.",
@@ -923,7 +923,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
923
923
  childFacts.set(parent, found);
924
924
  return found;
925
925
  }, allFacts = await factsOf(opening);
926
- let hasText = !1, visual;
926
+ let hasText = !1;
927
+ const decorations = [];
928
+ let visual;
927
929
  const visuals = new Map, several = parsed.value.kind === "region", assetSources = [];
928
930
  let drawings;
929
931
  const hidden = attr(opening, "hidden") === void 0 ? [] : [{ kind: "root" }], guardChild = (fact, selector, within = []) => {
@@ -1004,7 +1006,7 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
1004
1006
  if (part.declaresBoundary)
1005
1007
  await textEntryElement(match.opening, part.name, context, resolve);
1006
1008
  const normalized = parsed.value.kind === "region" ? parsed.value.normalizeWhen.find(([selector]) => selector === `& > ${part.selector}`) : void 0;
1007
- if (part.within.length === 0 && normalized?.[1].some(([property, value]) => property === "pointer-events" && value === "none"))
1009
+ if (part.pointerTransparent || part.within.length === 0 && normalized?.[1].some(([property, value]) => property === "pointer-events" && value === "none"))
1008
1010
  await pointerTransparent(match.opening, part.name, context, resolve);
1009
1011
  if (part.resizes && element !== "textarea")
1010
1012
  return fail(authoredAt(classes.calls, `${part.path}.normalize.resize`) ?? match.opening, { kind: "resize-not-textarea", part: part.name, element });
@@ -1027,6 +1029,15 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
1027
1029
  hasText = !0;
1028
1030
  if (parsed.value.kind === "control" && part.kind === "element")
1029
1031
  await pointerTransparent(match.opening, part.name, context, resolve);
1032
+ if (part.decoration) {
1033
+ const hidden = attr(match.opening, "aria-hidden");
1034
+ if (!(hidden !== void 0 && (hidden.initializer === void 0 || [!0, "true"].includes(await resolve(expression(hidden), context)))))
1035
+ return fail(match.opening, { kind: "decoration-exposed", part: part.name });
1036
+ await pointerTransparent(match.opening, part.name, context, resolve);
1037
+ decorations.push({ part: part.name, at: match.opening });
1038
+ if (match.classes.bindings.length === 0 && !["img", "video"].includes(element))
1039
+ continue;
1040
+ }
1030
1041
  if (part.kind !== "visual")
1031
1042
  continue;
1032
1043
  if (part.scheme !== null && match.classes.bindings.length > 0)
@@ -1135,6 +1146,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
1135
1146
  if (shared.length > 1)
1136
1147
  return fail(fact.opening, { kind: "markers-shared", markers: shared });
1137
1148
  }
1149
+ const [decoration] = decorations;
1150
+ if (decoration !== void 0 && hasText)
1151
+ review(decoration.at, { kind: "decoration-under-text", part: decoration.part });
1138
1152
  if (parsed.value.kind === "control" && !hasText && (visual !== void 0 || parsed.value.decor.length > 0) && !await namedByAttribute(opening, async (condition) => values.truthy(await resolve(condition, context), condition, context)))
1139
1153
  return fail(opening, { kind: "control-name-missing", element: values.tag(opening) });
1140
1154
  const theme = visual?.kind === "asset" ? visual.theme : void 0, rootTheme = attr(opening, "data-theme"), boundThemes = [...new Set([...theme === void 0 ? [] : [theme.name], ...[...visuals.values()].flatMap(({ fact }) => fact.kind === "asset" ? [fact.theme.name] : [])])];
@@ -30,6 +30,11 @@ export interface AssetSpec {
30
30
  readonly variants?: readonly AssetVariant[];
31
31
  /** Paint slot → `currentColor` or a paint token. */
32
32
  readonly paints?: Readonly<Record<string, string>>;
33
+ /**
34
+ * Named groups of the drawing a recipe may animate (`data-group="<name>"` in the SVG): a wordmark's letters, a
35
+ * diagram's edges. Only a drawing shown as inline SVG (paint slots or a foreground drawing) exposes them.
36
+ */
37
+ readonly groups?: readonly string[];
33
38
  }
34
39
  /** The macro's output: the authored declaration, serialized unchanged. */
35
40
  export interface AssetDeclaration {
@@ -48,7 +48,7 @@ function variant(value, states, sizing) {
48
48
  };
49
49
  }
50
50
  export const parseAsset = (input) => rejecting(() => {
51
- const spec = fields(input, ["name", "title", "description", "license", "source", "paint", "sizing", "states", "aliases", "opticalCenter", "minDrawnHeight", "variants", "paints"], "asset"), name = spec.name;
51
+ const spec = fields(input, ["name", "title", "description", "license", "source", "paint", "sizing", "states", "aliases", "opticalCenter", "minDrawnHeight", "variants", "paints", "groups"], "asset"), name = spec.name;
52
52
  if (!isName(name))
53
53
  return fail("Invalid asset name");
54
54
  const text = (field) => {
@@ -90,6 +90,11 @@ export const parseAsset = (input) => rejecting(() => {
90
90
  paints = declared;
91
91
  } else
92
92
  ensure(spec.paints === void 0, "Paint slots require the slots policy");
93
+ const groups = spec.groups;
94
+ if (groups !== void 0) {
95
+ ensure(Array.isArray(groups) && groups.length > 0 && groups.every((group) => typeof group === "string" && isName(group)) && new Set(groups).size === groups.length, "Groups are distinct names");
96
+ ensure(paint !== "intrinsic", "Named groups need a drawing shown as inline SVG: paint slots or foreground, not intrinsic");
97
+ }
93
98
  return {
94
99
  name,
95
100
  title,
@@ -103,6 +108,7 @@ export const parseAsset = (input) => rejecting(() => {
103
108
  ...typeof minDrawnHeight === "number" ? { minDrawnHeight } : {},
104
109
  ...rootSource === void 0 ? {} : { source: rootSource },
105
110
  ...variants === void 0 ? {} : { variants },
106
- ...paints === void 0 ? {} : { paints }
111
+ ...paints === void 0 ? {} : { paints },
112
+ ...groups === void 0 ? {} : { groups }
107
113
  };
108
114
  }), asset = (input) => map(parseAsset(input), () => ({ __adsAsset: 1, spec: isJsonObject(input) ? structuredClone(input) : {} }));
@@ -28,6 +28,9 @@ function readAsset(input, file, { sources, assetRoot, themes, tokens }) {
28
28
  check(paints.every((paint) => paint === "none" || paint === "currentColor"), "Foreground example has fixed paint");
29
29
  if (spec.paint === "intrinsic")
30
30
  check(!/currentColor|var\(/.test(text), "Intrinsic image must be self-contained");
31
+ const marked = [...text.matchAll(/\bdata-group="([^"]+)"/g)].flatMap((match) => match[1] === void 0 ? [] : [match[1]]);
32
+ check(new Set(marked).size === marked.length, `${variant.source}: a group is marked twice`);
33
+ check(JSON.stringify([...marked].sort()) === JSON.stringify([...spec.groups ?? []].sort()), `${variant.source}: the drawing's data-group marks differ from the asset's groups`);
31
34
  if (spec.paint === "slots") {
32
35
  check(paints.every((paint) => paint === "none" || /^var\(--asset-[\w-]+\)$/.test(paint)), "Slot artwork has undeclared paint");
33
36
  check(JSON.stringify([...channels].sort()) === JSON.stringify([...slots.keys()].sort()), "Missing or unused asset paint slot");
@@ -184,11 +184,21 @@ export function writePaintTransition(out, profile, selector, transition, motion,
184
184
  export function writeRootPress(out, press, motion, profile, reject) {
185
185
  if (press.when.length === 0)
186
186
  return null;
187
- const timing = transitionTiming(motion, profile, reject);
188
- out.rule("&", { scale: "1" });
189
- for (const { condition, field } of press.when) {
190
- out.rule(condition, { scale: profile.field(motion, "motion", field) });
191
- out.rule(condition, { scale: "1" }, REDUCED_MOTION);
187
+ const timing = transitionTiming(motion, profile, reject), scales = press.when.some((state) => state.effect === "scale"), travels = press.when.some((state) => state.effect !== "scale");
188
+ out.rule("&", { ...scales ? { scale: "1" } : {}, ...travels ? { translate: "0px" } : {} });
189
+ for (const { condition, effect, field } of press.when) {
190
+ const value = profile.field(motion, "motion", field);
191
+ if (effect === "scale") {
192
+ out.rule(condition, { scale: value });
193
+ out.rule(condition, { scale: "1" }, REDUCED_MOTION);
194
+ continue;
195
+ }
196
+ out.rule(condition, { translate: effect === "translate-block" ? `0px ${value}` : value });
197
+ out.rule(condition, { translate: "0px" }, REDUCED_MOTION);
198
+ if (effect === "translate-inline") {
199
+ out.rule(`${condition}:dir(rtl)`, { translate: `calc(${value} * -1)` });
200
+ out.rule(`${condition}:dir(rtl)`, { translate: "0px" }, REDUCED_MOTION);
201
+ }
192
202
  }
193
203
  return press.transition.length > 0 ? { properties: press.transition, timing } : null;
194
204
  }
@@ -253,6 +263,11 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
253
263
  });
254
264
  for (const step of steps)
255
265
  for (const [field, value] of Object.entries(step.values)) {
266
+ if (field === "draw") {
267
+ if (value !== "hidden" && value !== "drawn")
268
+ return reject({ kind: "sequence-step-field", profile: play.sequence, at: step.at, field });
269
+ continue;
270
+ }
256
271
  const roles = sequenceStepTokenRoles[field], role = foundation.tokens.get(/^var\(\s*(--[\w-]+)\s*\)$/.exec(value)?.[1] ?? "")?.role;
257
272
  if (roles === void 0 || role === void 0 || !roles.includes(role))
258
273
  return reject({ kind: "sequence-step-field", profile: play.sequence, at: step.at, field });
@@ -266,7 +281,8 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
266
281
  easing: field(fields, play.sequence, "easing", reject),
267
282
  stagger: fields.stagger ?? null,
268
283
  repeat,
269
- order: play.order
284
+ order: play.order,
285
+ paused: play.paused
270
286
  });
271
287
  if (lowered.kind === "err")
272
288
  return reject(lowered.error);
@@ -275,6 +291,8 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
275
291
  return reject({ kind: "sequence-property-conflict", part: element, profile: play.sequence, property: conflict });
276
292
  for (const { name, frames } of lowered.value.keyframes)
277
293
  out.keyframes(name, frames);
294
+ if (steps.some((step) => step.values.draw !== void 0))
295
+ out.rule(selector, { "stroke-dasharray": "1" });
278
296
  for (const rule of lowered.value.rules)
279
297
  out.rule(rule.selector, { ...rule.values }, rule.condition ?? void 0);
280
298
  }
@@ -323,6 +341,10 @@ export function coverArtwork(asset, visual, state, theme, reject) {
323
341
  const drawing = model(selectAsset(asset, theme, visual.size ?? "", state), reject);
324
342
  return { drawing, size: null, element: "img", source: `data:image/svg+xml,${encodeURIComponent(drawing.text)}` };
325
343
  }
344
+ export function decorationArtwork(asset, visual, state, theme, reject) {
345
+ const drawing = model(selectAsset(asset, theme, visual.size ?? "", state), reject);
346
+ return asset.paint === "intrinsic" ? { drawing, size: null, element: "img", source: `data:image/svg+xml,${encodeURIComponent(drawing.text)}` } : { drawing, size: null, element: "svg", source: drawing.text };
347
+ }
326
348
  export const placed = (geometry) => ({ drawing: geometry.drawing, size: geometry.size, element: geometry.element, source: geometry.source }), LINE_BOX = "1lh";
327
349
  export function controlBox(frame, envelope, field, reject) {
328
350
  const insets = controlFrameInsets(frame);
@@ -101,18 +101,25 @@ export interface GlyphPart {
101
101
  * when `transition` lists `scale`. Empty `when` and `transition` declare none.
102
102
  */
103
103
  export interface RootPress {
104
- readonly transition: readonly "scale"[];
104
+ readonly transition: readonly ("scale" | "translate")[];
105
105
  /** The owner condition, the motion field the root's `scale` reads and its authored path; at most one. */
106
106
  readonly when: readonly RootPressState[];
107
107
  }
108
- /** One press state of a root: its `scale` endpoint under an owner condition. */
108
+ /**
109
+ * One motion state of a root: its `scale` endpoint (a press) or its travel (`translateBlock`, `translateInline`: a card
110
+ * that lifts on hover) under an owner condition.
111
+ */
109
112
  export interface RootPressState {
110
113
  readonly condition: string;
111
- readonly field: "scale";
112
- /** The endpoint's authored path (`recipe.when.<condition>.scale`). */
114
+ readonly effect: "scale" | "translate-block" | "translate-inline";
115
+ readonly field: "scale" | "distance";
116
+ /** The endpoint's authored path (`recipe.when.<condition>.scale`, `….translateBlock`). */
113
117
  readonly path: string;
114
118
  }
115
119
  /** The paints a surface treatment can transition, as CSS transition properties. */
120
+ /** Where an element's scale and rotation grow from: its centre, or one edge (inline edges mirror under right-to-left). */
121
+ export declare const TRANSFORM_ORIGINS: readonly ["center", "inline-start", "inline-end", "block-start", "block-end"];
122
+ export type TransformOrigin = (typeof TRANSFORM_ORIGINS)[number];
116
123
  export declare const PAINT_CHANNELS: readonly ["background-color", "border-color", "color", "text-decoration-color", "box-shadow", "filter", "backdrop-filter", "opacity"];
117
124
  export type PaintChannel = (typeof PAINT_CHANNELS)[number];
118
125
  /** The motion profile that times a transition: the nearest recipe's motion slot, or a named motion profile. */
@@ -173,10 +180,31 @@ export interface PlaySpec {
173
180
  readonly condition: string | null;
174
181
  readonly sequence: string;
175
182
  readonly order: number;
183
+ /** `paused: true`: held at its first step (a diagram armed before it scrolls into view), released by another state. */
184
+ readonly paused: boolean;
185
+ readonly path: string;
186
+ }
187
+ /**
188
+ * A text part placed on a drawing (`anchor`): at `x`, `y` in the drawing's own coordinates (its viewBox), aligned by its
189
+ * `inline` and `block` edge or centre. The drawing is a sibling decoration; their parent is sized to the drawing.
190
+ */
191
+ export interface TextAnchor {
192
+ readonly artwork: string;
193
+ readonly x: number;
194
+ readonly y: number;
195
+ readonly inline: "start" | "center" | "end";
196
+ readonly block: "start" | "center" | "end";
197
+ readonly path: string;
198
+ }
199
+ /** A named group of a part's drawing (`data-group` in the asset's SVG) and the sequences it plays. */
200
+ export interface ArtworkGroup {
201
+ readonly name: string;
202
+ readonly plays: readonly PlaySpec[];
176
203
  readonly path: string;
177
204
  }
178
205
  /** The block edges an element can stick to while its container scrolls. */
179
- export declare const STICKY_EDGES: readonly ["block-start", "block-end"];
206
+ /** The edges an element sticks to; inline edges (a table's row names in a sideways-scrolling frame) follow the writing direction. */
207
+ export declare const STICKY_EDGES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
180
208
  /**
181
209
  * `sticky: { edge, clear? }`: the element stays at an edge of its scrolling container while the rest
182
210
  * scrolls. `clear: "block-start"` holds it below a region at the top (a sticky bar), by the layer
@@ -226,7 +254,7 @@ export interface PaintTransition {
226
254
  * textarea (a colour). `progressValue` is the filled part of a `<progress>` (a background): the part's own
227
255
  * surface is its track.
228
256
  */
229
- export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb"];
257
+ export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb", "sliderFill"];
230
258
  export type PseudoElement = (typeof PSEUDO_ELEMENTS)[number];
231
259
  /** Elements that never render generated content or a marker: a `before` treatment there would never show. */
232
260
  export declare const REPLACED_ELEMENTS: readonly string[];
@@ -265,6 +293,12 @@ export interface GeneratedContent {
265
293
  export interface BetweenRule {
266
294
  readonly surface: string;
267
295
  readonly frame: string;
296
+ /**
297
+ * `axes`: rules between the arranged items on these axes, wherever the arrangement puts them (between rows, between
298
+ * items in a row, or both, at every width), centred in the gap. Without it, a rule between consecutive children on
299
+ * the arrangement's own axis, drawn in the following child's edge.
300
+ */
301
+ readonly axes: readonly ("inline" | "block")[] | null;
268
302
  }
269
303
  /** An element's counters (`counter-reset`, `counter-increment`): where a count starts and what it counts. */
270
304
  export interface CounterSpec {
@@ -280,6 +314,8 @@ export interface PseudoTreatment {
280
314
  readonly surface: string | null;
281
315
  /** A range slider's track or thumb: its frame profile (size, radius, border). */
282
316
  readonly frame?: string | null;
317
+ /** A slider's thumb: the motion field (a scale) it grows by while pointed at or dragged, enabled. */
318
+ readonly grow?: string | null;
283
319
  readonly text: string | null;
284
320
  readonly content: GeneratedContent | null;
285
321
  readonly when: readonly StateTreatment[];
@@ -477,6 +513,7 @@ export type RegionFrame =
477
513
  readonly ratio: string | null;
478
514
  readonly border: FrameBorder;
479
515
  readonly corners: readonly FrameCorner[] | null;
516
+ readonly safeArea: readonly SafeAreaSide[];
480
517
  }
481
518
  /** `frame: "container"` requires complete frame and surface contracts. */
482
519
  | {
@@ -484,7 +521,11 @@ export type RegionFrame =
484
521
  readonly container: boolean;
485
522
  readonly border: FrameBorder;
486
523
  readonly corners: readonly FrameCorner[] | null;
524
+ readonly safeArea: readonly SafeAreaSide[];
487
525
  };
526
+ /** The sides whose padding also clears the device's safe area (`env(safe-area-inset-*)`): a phone's home indicator. */
527
+ export declare const SAFE_AREA_SIDES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
528
+ export type SafeAreaSide = (typeof SAFE_AREA_SIDES)[number];
488
529
  /**
489
530
  * The corners a frame rounds, by block then inline edge (`start-end`: the block-start, inline-end
490
531
  * corner). `corners` on a frame rounds the named ones by the frame profile's `radius` and squares the
@@ -509,16 +550,27 @@ export interface FrameCondition {
509
550
  readonly condition: string;
510
551
  readonly border: FrameBorder | null;
511
552
  readonly corners: readonly FrameCorner[] | null;
553
+ /** The root's alignment while the condition holds (a banner centred on phones, start-aligned from a width). */
554
+ readonly alignment: ConditionAlignment;
512
555
  readonly path: string;
513
556
  }
557
+ /** An element's arrangement alignment and text alignment while a named condition holds; `null` keeps its own. */
558
+ export interface ConditionAlignment {
559
+ readonly align: string | null;
560
+ readonly justify: string | null;
561
+ readonly textAlign: TextAlign | null;
562
+ }
514
563
  /** Content beyond an element's box: shown (the default), clipped, or scrolled on one axis or both. */
515
564
  export type Overflow = {
516
565
  readonly kind: "visible";
517
566
  } | {
518
567
  readonly kind: "clip";
519
- } | {
568
+ }
569
+ /** `contain` (`overscroll: "contain"`): reaching its end does not scroll what is behind it (a dialog's results list). */
570
+ | {
520
571
  readonly kind: "scroll";
521
572
  readonly axis: "block" | "inline" | "both";
573
+ readonly contain: boolean;
522
574
  };
523
575
  export declare const OVERFLOW_VALUES: readonly ["clip", "scroll-block", "scroll-inline", "scroll-both"];
524
576
  /** How a part takes space in its parent's stack or inline arrangement: its content's size, or the free main-axis space (and the cross axis with `both`). */
@@ -535,6 +587,13 @@ export interface PartCondition {
535
587
  readonly visible: boolean | null;
536
588
  /** The visual profile a visual part takes in the condition (its size there); `null` when it keeps its own. */
537
589
  readonly visual: string | null;
590
+ /** The part's alignment in the condition. */
591
+ readonly alignment: ConditionAlignment;
592
+ /** The part's box rules and corners in the condition (a divider that moves from the top to the start side). */
593
+ readonly frame: {
594
+ readonly border: FrameBorder | null;
595
+ readonly corners: readonly FrameCorner[] | null;
596
+ } | null;
538
597
  }
539
598
  /**
540
599
  * The native element a region or part declares, for the closed UA
@@ -616,7 +675,7 @@ export type PartContent = {
616
675
  export type StateTreatment = readonly [condition: string, surface: string];
617
676
  export type RegionPartContent = PartContent["kind"];
618
677
  /** The kinds of value a measured declaration carries: a px length, a px translation (x, y) or a px grid track length. */
619
- export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size"];
678
+ export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share"];
620
679
  export type MeasuredType = (typeof MEASURED_TYPES)[number];
621
680
  /**
622
681
  * A geometry value the owner measures or computes at runtime and writes through
@@ -673,6 +732,12 @@ export type MeasuredValue =
673
732
  readonly type: "intrinsic-size";
674
733
  readonly name: string;
675
734
  readonly property: string;
735
+ }
736
+ /** How far along a range a value is, 0 to 1: a slider's fill up to its thumb, or one step label's place under it. */
737
+ | {
738
+ readonly type: "share";
739
+ readonly name: string;
740
+ readonly property: string;
676
741
  };
677
742
  /**
678
743
  * A paint the owner selects at runtime from data (a chart series, a status):
@@ -754,6 +819,24 @@ export interface RegionPart {
754
819
  * sizes for a part that is not a control (a disc behind a mark, a badge's box). `null` otherwise.
755
820
  */
756
821
  readonly box: string | null;
822
+ /** `anchor`: a text part placed on a sibling decoration's drawing, in the drawing's coordinates. */
823
+ readonly anchor: TextAnchor | null;
824
+ /** A row of step labels under the named sibling slider part: each label centred at its measured share of the track. */
825
+ readonly along: string | null;
826
+ /** `groups`: named groups of the part's drawing and the sequences they play (a wordmark's letters, a diagram's edges). */
827
+ readonly groups: readonly ArtworkGroup[];
828
+ /** `frame: { profile, safeArea }`: the sides whose padding also clears the device's safe area. */
829
+ readonly safeArea: readonly SafeAreaSide[];
830
+ /**
831
+ * `kind: "decoration"`: a layer behind its parent's content (a graph behind a panel, a dot grid behind a banner, a
832
+ * page's backdrop), painted by its surface, its artwork or both. It fills its parent's box (`attachment: "scroll"`) or
833
+ * the viewport (`"fixed"`), is hidden from assistive technology and takes no pointer. Its content is `visual`: an
834
+ * artwork binding, or none for a surface-only layer.
835
+ */
836
+ readonly decoration: DecorationSpec | null;
837
+ /** `frame: { profile, rules, corners }`: the box's one-sided rules and rounded corners, as a root frame's. */
838
+ readonly boxBorder: FrameBorder;
839
+ readonly boxCorners: readonly FrameCorner[] | null;
757
840
  /** A declared, human-approved boundary of this text-entry control (`frame` is a control frame). */
758
841
  readonly accessibility: AccessibilityDeclaration | null;
759
842
  readonly when: readonly StateTreatment[];
@@ -787,6 +870,8 @@ export interface RegionPart {
787
870
  * skip link's text, an icon-only control's label); `"visible"` otherwise.
788
871
  */
789
872
  readonly presence: "visible" | "assistive";
873
+ /** `origin`: the point the part's scale and rotation grow from; `"center"` when not stated. */
874
+ readonly origin: TransformOrigin;
790
875
  /** A nested recipe arranging this part's children. */
791
876
  readonly arrangement: Arrangement | null;
792
877
  readonly parts: readonly RegionPart[];
@@ -828,7 +913,8 @@ export interface AnchoredPopover {
828
913
  };
829
914
  /** What the panel keeps clear of at the block start: nothing, or a fixed-size region (the layer profile's `clear-block-start`). */
830
915
  readonly clear: "none" | "block-start";
831
- readonly motion: "fade" | null;
916
+ /** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
917
+ readonly motion: "fade" | "drop" | null;
832
918
  }
833
919
  /**
834
920
  * A `popover` root anchored to an element (its trigger, a pointer, a text
@@ -839,7 +925,8 @@ export interface MeasuredPopover {
839
925
  readonly kind: "measured-popover";
840
926
  readonly element: "popover";
841
927
  readonly popover: "auto" | "manual";
842
- readonly motion: "fade" | null;
928
+ /** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
929
+ readonly motion: "fade" | "drop" | null;
843
930
  }
844
931
  /** The modal sheet's `::backdrop`: a surface profile, and whether the owner closes on a press there. */
845
932
  export interface Backdrop {
@@ -901,6 +988,14 @@ export interface RegionSpec {
901
988
  * has keyboard focus (`&:has(.field:focus-visible)`): a composer's box around its text field.
902
989
  */
903
990
  readonly focusWithin: string | null;
991
+ /**
992
+ * `flow: { edges: "trim" }` on a block-flow root: its first child's space before and its last child's space after
993
+ * stay inside it as nothing (a page that opens with a heading starts flush). Without it, a frameless block-flow
994
+ * root passes those spaces out to its neighbours, as CSS margins do.
995
+ */
996
+ readonly flowEdges: "trim" | null;
997
+ /** `origin`: the point the root's scale and rotation grow from; `"center"` when not stated. */
998
+ readonly origin: TransformOrigin;
904
999
  readonly sticky: StickySpec | null;
905
1000
  readonly parts: readonly RegionPart[];
906
1001
  /** Parts exposed as public rows, in row order, for a parent's `alignRows`. */
@@ -948,6 +1043,8 @@ export interface GridSpec {
948
1043
  readonly layout: readonly (readonly [field: GridField, value: SpatialValue])[];
949
1044
  readonly rowGap: SlotBinding | null;
950
1045
  readonly frame: RegionFrame | null;
1046
+ /** `between: { surface, frame, axes }`: rules between the grid's cells, between columns and rows at every tier. */
1047
+ readonly between: BetweenRule | null;
951
1048
  readonly cells: readonly GridCell[];
952
1049
  readonly conditions: readonly NamedPlacement[];
953
1050
  /** A cell that is a public component spanning its exposed rows as subgrid rows, with those rows' names. */
@@ -984,6 +1081,10 @@ export interface DeclaredPart {
984
1081
  readonly playsAlways: readonly string[];
985
1082
  /** A scroll container: it should be reachable by keyboard. */
986
1083
  readonly scrolls: boolean;
1084
+ /** `normalize: { pointerEvents: "none" }` on the part itself: owner analysis checks it is decorative. */
1085
+ readonly pointerTransparent: boolean;
1086
+ /** A decoration (`kind: "decoration"`): owner analysis checks it is hidden from assistive technology and inert. */
1087
+ readonly decoration: boolean;
987
1088
  /**
988
1089
  * A text part's setting that needs a block of text (`textAlign: "end"`, `wrap: "truncate"`), where the part has no
989
1090
  * arrangement, box or frame of its own: on an inline element it changes nothing. `null` otherwise.
@@ -1061,6 +1162,10 @@ export interface StateText {
1061
1162
  export declare const ROOT_EXTENTS: readonly ["content", "container"];
1062
1163
  export type RootExtent = (typeof ROOT_EXTENTS)[number];
1063
1164
  /** `outset: { block?, inline? }`: how far a layered backdrop is drawn past its parent's box on each axis, from the spacing slot. */
1165
+ /** A decoration layer's attachment: it scrolls with its parent's box, or stays fixed to the viewport (a page backdrop). */
1166
+ export interface DecorationSpec {
1167
+ readonly attachment: "scroll" | "fixed";
1168
+ }
1064
1169
  export interface OutsetSpec {
1065
1170
  readonly block: SlotBinding | null;
1066
1171
  readonly inline: SlotBinding | null;