@reqvire-org/ads 0.5.9 → 0.5.11

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 (46) hide show
  1. package/dist/ads-errors.mjs +68 -4
  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 +36 -7
  7. package/dist/construction-spec.d.mts +109 -10
  8. package/dist/construction-spec.mjs +173 -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 +13 -1
  15. package/dist/lowering-region-layout.mjs +4 -4
  16. package/dist/lowering-sequence.mjs +6 -2
  17. package/dist/measured-geometry.mjs +15 -3
  18. package/dist/owner-analysis-check.mjs +3 -0
  19. package/dist/owner-errors.mjs +6 -0
  20. package/dist/ownership-model.mjs +34 -9
  21. package/dist/platform-features.mjs +12 -0
  22. package/dist/press-scale.mjs +3 -1
  23. package/dist/profile-macro.d.mts +5 -0
  24. package/dist/profile-view-facts.mjs +1 -1
  25. package/dist/recipe-macro.d.mts +53 -6
  26. package/dist/recipe-model.mjs +8 -5
  27. package/dist/region-lowering.mjs +398 -30
  28. package/dist/role-vocabulary.d.mts +12 -1
  29. package/dist/role-vocabulary.mjs +21 -3
  30. package/dist/skills/ads-designer/references/motion.md +4 -1
  31. package/dist/skills/ads-designer/references/recipes.md +36 -3
  32. package/dist/skills/ads-import/references/recipes.md +36 -3
  33. package/dist/skills/ads-port/references/recipes.md +36 -3
  34. package/dist/spatial-model.mjs +11 -2
  35. package/dist/surface-effects.mjs +25 -6
  36. package/dist/token-dtcg.mjs +2 -1
  37. package/docs/ARCHITECTURE.md +8 -0
  38. package/docs/ASSETS.md +7 -1
  39. package/docs/CHANGELOG.md +143 -18
  40. package/docs/GUIDE.md +9 -0
  41. package/docs/LANGUAGE.md +137 -17
  42. package/docs/MOTION.md +45 -0
  43. package/docs/PROFILE-KINDS.md +32 -5
  44. package/docs/RULES.md +13 -5
  45. package/docs/TOKEN-ROLES.md +9 -2
  46. package/package.json +1 -1
@@ -101,7 +101,7 @@ function parseShape(selector) {
101
101
  }).processSync(selector);
102
102
  return shape;
103
103
  }
104
- const childChain = (shape) => shape.combinators.every((combinator) => combinator === ">"), fixedChain = (shape) => shape.combinators.every((combinator) => combinator === ">" || combinator === "+"), typeOf = (compound) => /^[a-z][\w-]*/i.exec(compound.structure)?.[0].toLowerCase() ?? null, markersOf = (compound) => [...compound.structure.matchAll(/\.([\w-]+)/g)].map((match) => match[1] ?? ""), pseudoElementOf = (compound) => /::([\w-]+)/.exec(compound.structure)?.[1]?.toLowerCase() ?? null;
104
+ const childChain = (shape) => shape.combinators.every((combinator) => combinator === ">"), fixedChain = (shape) => shape.combinators.every((combinator) => combinator === ">" || combinator === "+"), rooted = (shape) => shape.compounds[0]?.structure.startsWith("&") === !0, depthOf = (shape) => shape.combinators.filter((combinator) => combinator === ">").length, typeOf = (compound) => /^[a-z][\w-]*/i.exec(compound.structure)?.[0].toLowerCase() ?? null, markersOf = (compound) => [...compound.structure.matchAll(/\.([\w-]+)/g)].map((match) => match[1] ?? ""), pseudoElementOf = (compound) => /::([\w-]+)/.exec(compound.structure)?.[1]?.toLowerCase() ?? null;
105
105
  function compoundsDiffer(a, b) {
106
106
  if (pseudoElementOf(a) !== pseudoElementOf(b))
107
107
  return !0;
@@ -125,6 +125,8 @@ function mayCoincide(a, b) {
125
125
  return other !== void 0 && compoundsDiffer(compound, other);
126
126
  });
127
127
  }
128
+ if (fixedChain(a) && fixedChain(b) && rooted(a) && rooted(b) && depthOf(a) !== depthOf(b))
129
+ return !1;
128
130
  if (fixedChain(a) && a.combinators.length === b.combinators.length && a.combinators.every((combinator, index) => combinator === b.combinators[index]))
129
131
  return !a.compounds.some((compound, index) => {
130
132
  const other = b.compounds[index];
@@ -270,8 +272,8 @@ function conditionsExclude(a, b) {
270
272
  return !1;
271
273
  }
272
274
  function exclusive(a, conditionsA, b, conditionsB) {
273
- const aligned = samePath(a, b) && childChain(a) ? a.compounds.length : 1;
274
- return a.compounds.slice(0, aligned).some((compound, index) => compound.states.some((x) => (b.compounds[index]?.states ?? []).some((y) => tokensExclude(x, y)))) || conditionsExclude(conditionsA, conditionsB);
275
+ const aligned = samePath(a, b) && childChain(a) ? a.compounds.length : 1, statesExclude = a.compounds.slice(0, aligned).some((compound, index) => compound.states.some((x) => (b.compounds[index]?.states ?? []).some((y) => tokensExclude(x, y)))), targetA = a.compounds.at(-1), targetB = b.compounds.at(-1), targetsExclude = targetA !== void 0 && targetB !== void 0 && targetA.states.some((x) => targetB.states.some((y) => tokensExclude(x, y)));
276
+ return statesExclude || targetsExclude || conditionsExclude(conditionsA, conditionsB);
275
277
  }
276
278
  const rankOf = (entry, atomRank) => {
277
279
  const [ids, classes, types] = entry.shape.specificity;
@@ -28,6 +28,7 @@ export const FAMILIES = [
28
28
  ], INDEPENDENT_PROPERTIES = [
29
29
  "align-self",
30
30
  "justify-items",
31
+ "justify-self",
31
32
  "white-space",
32
33
  "text-overflow",
33
34
  "text-align",
@@ -85,6 +86,8 @@ export const FAMILIES = [
85
86
  "aspect-ratio",
86
87
  "background",
87
88
  "background-image",
89
+ "background-size",
90
+ "background-repeat",
88
91
  "block-size",
89
92
  "border-radius",
90
93
  "border-start-start-radius",
@@ -102,6 +105,11 @@ export const FAMILIES = [
102
105
  "flex-direction",
103
106
  "flex-grow",
104
107
  "flex-shrink",
108
+ "isolation",
109
+ "animation-play-state",
110
+ "stroke-dasharray",
111
+ "stroke-dashoffset",
112
+ "transform-box",
105
113
  "flex-wrap",
106
114
  "font-family",
107
115
  "font-size",
@@ -125,15 +133,19 @@ export const FAMILIES = [
125
133
  "opacity",
126
134
  "outline-width",
127
135
  "overflow",
136
+ "overscroll-behavior",
128
137
  "overflow-wrap",
129
138
  "overlay",
130
139
  "position",
131
140
  "scrollbar-gutter",
141
+ "scrollbar-color",
142
+ "scrollbar-width",
132
143
  "rotate",
133
144
  "scale",
134
145
  "text-box-edge",
135
146
  "text-box-trim",
136
147
  "transform",
148
+ "transform-origin",
137
149
  "transition-behavior",
138
150
  "transition-delay",
139
151
  "transition-duration",
@@ -141,7 +153,7 @@ export const FAMILIES = [
141
153
  "transition-timing-function",
142
154
  "translate",
143
155
  "z-index"
144
- ], KEYFRAME_PROPERTIES = new Set(["rotate", "scale", "translate", "opacity"]);
156
+ ], KEYFRAME_PROPERTIES = new Set(["rotate", "scale", "translate", "opacity", "stroke-dashoffset"]);
145
157
  export function createRegistry(families = FAMILIES, independent = INDEPENDENT_PROPERTIES) {
146
158
  const registry = new Map, add = (property, shape) => {
147
159
  if (registry.has(property))
@@ -92,14 +92,14 @@ export function overflowValues(overflow, values) {
92
92
  case "clip":
93
93
  return { overflow: "clip" };
94
94
  case "scroll": {
95
- const shrink = (axis) => values[`min-${axis}-size`] === void 0 ? { [`min-${axis}-size`]: "0" } : {};
95
+ const shrink = (axis) => values[`min-${axis}-size`] === void 0 ? { [`min-${axis}-size`]: "0" } : {}, contained = overflow.contain ? { "overscroll-behavior": "contain" } : {};
96
96
  switch (overflow.axis) {
97
97
  case "block":
98
- return { overflow: "hidden auto", ...shrink("block") };
98
+ return { overflow: "hidden auto", ...contained, ...shrink("block") };
99
99
  case "inline":
100
- return { overflow: "auto hidden", ...shrink("inline") };
100
+ return { overflow: "auto hidden", ...contained, ...shrink("inline") };
101
101
  case "both":
102
- return { overflow: "auto", ...shrink("block"), ...shrink("inline") };
102
+ return { overflow: "auto", ...contained, ...shrink("block"), ...shrink("inline") };
103
103
  }
104
104
  }
105
105
  }
@@ -7,7 +7,8 @@ export const SEQUENCE_REPEATS = ["loop", "alternate", "once"], STEP_FIELDS = {
7
7
  scale: "scale",
8
8
  "scale-inline": "scale",
9
9
  "scale-block": "scale",
10
- rotate: "rotate"
10
+ rotate: "rotate",
11
+ draw: "stroke-dashoffset"
11
12
  };
12
13
  const REDUCED = ["media", "(prefers-reduced-motion: reduce)"], under = (condition, selector, suffix = "") => condition === null ? `&${suffix}${selector.slice(1)}` : `${condition}${suffix}${selector.slice(1)}`;
13
14
  function declarations(values, mirrored) {
@@ -31,6 +32,8 @@ function declarations(values, mirrored) {
31
32
  }
32
33
  if (values.rotate !== void 0)
33
34
  out.push(["rotate", values.rotate]);
35
+ if (values.draw !== void 0)
36
+ out.push(["stroke-dashoffset", values.draw === "hidden" ? "1" : "0"]);
34
37
  return out;
35
38
  }
36
39
  export function sequenceRules(input) {
@@ -72,7 +75,8 @@ export function sequenceRules(input) {
72
75
  "animation-iteration-count": repeat === "once" ? "1" : "infinite",
73
76
  ...repeat === "alternate" ? { "animation-direction": "alternate" } : {},
74
77
  "animation-fill-mode": repeat === "once" ? "both" : "backwards",
75
- ...order > 0 && input.stagger !== null ? { "animation-delay": order === 1 ? input.stagger : `calc(${input.stagger} * ${order})` } : {}
78
+ ...order > 0 && input.stagger !== null ? { "animation-delay": order === 1 ? input.stagger : `calc(${input.stagger} * ${order})` } : {},
79
+ ...input.paused === !0 ? { "animation-play-state": "paused" } : {}
76
80
  }, rules = [{ selector: under(condition, selector), values: animation, condition: null }];
77
81
  if (steps.some((step) => step.values["translate-inline"] !== void 0)) {
78
82
  const mirrored = framesOf(!0);
@@ -17,9 +17,10 @@ export const MEASURED_PROPERTIES = {
17
17
  scale: ["scale"],
18
18
  "size-track": ["grid-template-columns", "grid-template-rows"],
19
19
  position: ["object-position"],
20
- "intrinsic-size": ["inline-size"]
20
+ "intrinsic-size": ["inline-size"],
21
+ share: ["slider-fill", "slider-step"]
21
22
  };
22
- const HOSTS = { length: "region", transform: "region", scale: "region", "size-track": "grid", position: "region", "intrinsic-size": "region" }, POSITIONS = ["inset-block-start", "inset-block-end", "inset-inline-start", "inset-inline-end", "translate"];
23
+ const HOSTS = { length: "region", transform: "region", scale: "region", "size-track": "grid", position: "region", "intrinsic-size": "region", share: "region" }, POSITIONS = ["inset-block-start", "inset-block-end", "inset-inline-start", "inset-inline-end", "translate"];
23
24
  export const positions = (property) => POSITIONS.includes(property), measuredProperty = (scope, name) => privateProperty(scope, "measured", name);
24
25
  function initialValue(property) {
25
26
  if (property === "translate" || property === "scale")
@@ -42,6 +43,8 @@ export function measuredFallback(value, own) {
42
43
  return own ?? CENTRE;
43
44
  case "intrinsic-size":
44
45
  return own ?? "auto";
46
+ case "share":
47
+ return "0";
45
48
  }
46
49
  }
47
50
  export const measuredRead = (scope, value, fallback) => `var(${measuredProperty(scope, value.name)}, ${fallback})`;
@@ -53,7 +56,7 @@ export function checkMeasured(value, host, element) {
53
56
  return failure("host");
54
57
  return ok(null);
55
58
  }
56
- export function measuredWrites(scope, values, element, own, supplied, media = null) {
59
+ export function measuredWrites(scope, values, element, own, supplied, media = null, slider = { fill: !1, steps: !1 }) {
57
60
  const writes = {};
58
61
  for (const value of values) {
59
62
  const checked = checkMeasured(value, "region", element);
@@ -61,6 +64,12 @@ export function measuredWrites(scope, values, element, own, supplied, media = nu
61
64
  return checked;
62
65
  if (value.type === "position" && media !== "cover")
63
66
  return err({ kind: "measured-property-unsupported", element, name: value.name, property: value.property, type: value.type, reason: "cover-missing" });
67
+ if (value.type === "share") {
68
+ const reason = value.property === "slider-fill" ? slider.fill ? null : "fill-missing" : slider.steps ? null : "steps-missing";
69
+ if (reason !== null)
70
+ return err({ kind: "measured-property-unsupported", element, name: value.name, property: value.property, type: value.type, reason });
71
+ continue;
72
+ }
64
73
  if (value.type === "intrinsic-size") {
65
74
  if (media !== "contain")
66
75
  return err({ kind: "measured-property-unsupported", element, name: value.name, property: value.property, type: value.type, reason: "contain-missing" });
@@ -133,6 +142,7 @@ function valueType(value) {
133
142
  return "readonly [width: number, height: number]";
134
143
  case "length":
135
144
  case "size-track":
145
+ case "share":
136
146
  return "number";
137
147
  }
138
148
  }
@@ -150,6 +160,8 @@ function written(value) {
150
160
  case "length":
151
161
  case "size-track":
152
162
  return `\`\${${read}}px\``;
163
+ case "share":
164
+ return `\`\${${read}}\``;
153
165
  }
154
166
  }
155
167
  export const RATIO_SUFFIX = "Ratio", intrinsicInlineSize = (scope, value, cap) => `min(var(${measuredProperty(scope, value.name)}), calc(${cap} * var(${measuredProperty(scope, `${value.name}${RATIO_SUFFIX}`)})))`, CENTRE = "50% 50%", focalPosition = ([x, y]) => `${(0.5 + x) * 100}% ${(0.5 + y) * 100}%`;
@@ -504,6 +504,9 @@ function focusShownFindings(inputs, owners) {
504
504
  for (const style of facts.styles.values())
505
505
  for (const match of style.css.matchAll(/:has\((\.[\w-]+):focus-visible\)/g))
506
506
  shown.add(match[1] ?? "");
507
+ for (const style of facts.styles.values())
508
+ for (const match of style.css.matchAll(/(\.[\w-]+):focus-visible::-(?:webkit-slider|moz-range)-thumb\s*\{[^}]*outline-style:\s*solid/g))
509
+ shown.add(match[1] ?? "");
507
510
  for (const style of facts.styles.values()) {
508
511
  const [first] = style.origins;
509
512
  if (first?.kind !== "point")
@@ -118,6 +118,12 @@ export function constructionError(failure) {
118
118
  case "state-text-field":
119
119
  case "state-text-unbound":
120
120
  case "outset-unsupported":
121
+ case "between-axes-unsupported":
122
+ case "artwork-group-unknown":
123
+ case "text-anchor-unsupported":
124
+ case "artwork-group-draw-length":
125
+ case "slider-fill-unsupported":
126
+ case "slider-steps-unsupported":
121
127
  case "scheme-unsupported":
122
128
  case "enter-surface-unsupported":
123
129
  case "enter-property-conflict":
@@ -1,5 +1,5 @@
1
1
  import { fail, rejecting } from "./design-rejection.mjs";
2
- import { CURSORS, ELEMENT_NAMES, FRAME_CORNERS, FRAME_SIDES, GEOMETRY_CHANNELS, OVERFLOW_VALUES, PAINT_CHANNELS, RESIZES, SNAP_ALIGNS, SNAP_TYPES, TEXT_ALIGNS, TEXT_WRAPS, TOUCH_ACTIONS, USER_SELECTS } from "./construction-spec.mjs";
2
+ import { CURSORS, ELEMENT_NAMES, FRAME_CORNERS, FRAME_SIDES, GEOMETRY_CHANNELS, OVERFLOW_VALUES, PAINT_CHANNELS, RESIZES, SNAP_ALIGNS, TRANSFORM_ORIGINS, SNAP_TYPES, TEXT_ALIGNS, TEXT_WRAPS, TOUCH_ACTIONS, USER_SELECTS } from "./construction-spec.mjs";
3
3
  const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[a-z][\w-]*(?:,\s*[a-z][\w-]*:\s*[a-z][\w-]*)*\))?$/, binding = (value) => profile.test(value) || /^profile\([\w-]+-profile\)$/.test(value), wordList = (value) => value.split(/\s+/).every((word) => identifier.test(word)), positive = (value) => /^[1-9]\d*$/.test(value) && Number(value) <= 64, oneOf = (...values) => (value) => values.includes(value), metric = (slot, fields) => (value) => fields.some((field) => value === `profile(${slot}-profile.${field})`), spacing = metric("spacing", ["content-gap", "label-gap", "details-gap", "meta-gap", "section-gap", "indent", "space-before", "space-after"]), outsetSpacing = metric("spacing", ["content-gap", "label-gap", "details-gap", "meta-gap", "section-gap", "indent", "outset-block", "outset-inline"]), anchorClear = (value) => value === "profile(layer-profile.clear-block-start)" || value === "profile(spacing-profile.anchor-gap)", overlapSpacing = metric("spacing", ["overlap"]), placement = {
4
4
  start: (value) => value === "auto" || positive(value),
5
5
  end: positive,
@@ -8,7 +8,10 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
8
8
  "row-span": positive,
9
9
  overlay: oneOf("none", "start", "end"),
10
10
  visible: oneOf("true", "false"),
11
- visual: binding
11
+ visual: binding,
12
+ align: oneOf("start", "center", "end", "baseline", "stretch"),
13
+ justify: oneOf("start", "center", "end", "space-between", "space-around", "space-evenly"),
14
+ "text-align": oneOf("start", "center", "end")
12
15
  }, TEXT_ALIGN = oneOf(...TEXT_ALIGNS), OVERFLOW = oneOf(...OVERFLOW_VALUES), ELEMENT = oneOf(...ELEMENT_NAMES), FIELDS = {
13
16
  "ads-recipe": {
14
17
  profile: (value) => profile.test(value),
@@ -37,15 +40,23 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
37
40
  overflow: OVERFLOW,
38
41
  element: ELEMENT,
39
42
  marker: oneOf("native", "none"),
40
- transition: oneOf("scale")
43
+ transition: (value) => {
44
+ const channels = value.split(/[\s,]+/).filter(Boolean);
45
+ return channels.length > 0 && new Set(channels).size === channels.length && channels.every((channel) => channel === "scale" || channel === "translate");
46
+ },
47
+ origin: oneOf(...TRANSFORM_ORIGINS),
48
+ overscroll: oneOf("contain")
41
49
  },
42
50
  "ads-part": {
43
- kind: oneOf("text", "visual", "vector", "component"),
51
+ kind: oneOf("text", "visual", "vector", "component", "decoration"),
52
+ attachment: oneOf("scroll", "fixed"),
44
53
  align: oneOf("start", "center", "end"),
45
54
  "space-before": spacing,
46
55
  "space-after": spacing,
47
56
  spacing: binding,
48
57
  presence: oneOf("visible", "assistive"),
58
+ origin: oneOf(...TRANSFORM_ORIGINS),
59
+ overscroll: oneOf("contain"),
49
60
  scheme: oneOf("light", "dark"),
50
61
  selector: (value) => /^\.[a-z][\w-]*$/.test(value),
51
62
  required: oneOf("true", "false"),
@@ -56,6 +67,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
56
67
  repeat: oneOf("true", "false"),
57
68
  "drawn-by": (value) => /^[a-z][\w-]*$/i.test(value),
58
69
  "anchor-clear": anchorClear,
70
+ along: (value) => /^[a-z][\w-]*$/i.test(value),
59
71
  lines: oneOf("2", "3"),
60
72
  overflow: OVERFLOW,
61
73
  extent: oneOf("fill", "fill-both"),
@@ -85,6 +97,10 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
85
97
  corners: (value) => {
86
98
  const corners = value.split(/\s+/).filter((corner) => corner !== "");
87
99
  return new Set(corners).size === corners.length && corners.every((corner) => FRAME_CORNERS.includes(corner));
100
+ },
101
+ "safe-area": (value) => {
102
+ const sides = value.split(/\s+/).filter((side) => side !== "");
103
+ return sides.length > 0 && new Set(sides).size === sides.length && sides.every((side) => ["block-start", "block-end", "inline-start", "inline-end"].includes(side));
88
104
  }
89
105
  },
90
106
  "ads-paint-transition": {
@@ -102,15 +118,24 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
102
118
  motion: binding
103
119
  },
104
120
  "ads-enter": { surface: binding, motion: binding, translate: metric("motion", ["distance"]), "translate-inline": metric("motion", ["distance"]), scale: metric("motion", ["scale"]), rotate: metric("motion", ["angle"]) },
105
- "ads-pseudo": { surface: binding, text: binding, frame: binding },
121
+ "ads-pseudo": { surface: binding, text: binding, frame: binding, grow: (value) => /^profile\(motion-profile\.[a-z][\w-]*\)$/.test(value) },
106
122
  "ads-counter": { reset: () => !0, increment: () => !0 },
107
- "ads-between": { surface: binding, frame: binding },
123
+ "ads-between": {
124
+ surface: binding,
125
+ frame: binding,
126
+ axes: (value) => {
127
+ const axes = value.split(/[\s,]+/).filter(Boolean);
128
+ return axes.length > 0 && new Set(axes).size === axes.length && axes.every((axis) => axis === "inline" || axis === "block");
129
+ }
130
+ },
108
131
  "ads-content": { counter: () => !0, counters: () => !0, style: () => !0, separator: () => !0, prefix: () => !0, suffix: () => !0 },
109
132
  "ads-accessibility": { boundary: () => !0, reason: () => !0 },
110
133
  "ads-focus": { of: () => !0, "shown-by": oneOf("container"), within: (value) => /^\.[A-Za-z_][\w-]*$/.test(value) },
111
- "ads-play": { sequence: binding, order: (value) => /^(?:[0-9]|[12][0-9]|3[0-2])$/.test(value) },
134
+ "ads-play": { sequence: binding, order: (value) => /^(?:[0-9]|[12][0-9]|3[0-2])$/.test(value), paused: oneOf("true", "false") },
135
+ "ads-group": {},
136
+ "ads-anchor": { artwork: (value) => /^[a-z][\w-]*$/i.test(value), x: (value) => /^-?\d+(\.\d+)?$/.test(value), y: (value) => /^-?\d+(\.\d+)?$/.test(value), inline: oneOf("start", "center", "end"), block: oneOf("start", "center", "end") },
112
137
  "ads-outset": { block: outsetSpacing, inline: outsetSpacing },
113
- "ads-sticky": { edge: oneOf("block-start", "block-end"), clear: oneOf("none", "block-start") },
138
+ "ads-sticky": { edge: oneOf("block-start", "block-end", "inline-start", "inline-end"), clear: oneOf("none", "block-start") },
114
139
  "ads-flow": { edges: oneOf("trim") },
115
140
  "ads-snap": { type: oneOf(...SNAP_TYPES), align: oneOf(...SNAP_ALIGNS) },
116
141
  "ads-layer": {
@@ -118,7 +143,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
118
143
  edge: oneOf("start", "end", "center", "block-start"),
119
144
  "backdrop-surface": binding,
120
145
  "backdrop-dismiss": oneOf("press", "none"),
121
- motion: oneOf("slide", "fade"),
146
+ motion: oneOf("slide", "fade", "drop"),
122
147
  "modal-below": (value) => identifier.test(value),
123
148
  popover: oneOf("auto", "manual"),
124
149
  "corner-block": oneOf("start", "end"),
@@ -22,8 +22,10 @@ export const PLATFORM_FEATURES = [
22
22
  prefixed: ["-webkit-backdrop-filter"],
23
23
  degrades: "A surface's backdrop blur and saturation do not apply: a translucent surface shows what is behind it sharp, so its background must stay readable without them. The prefixed form covers engines that implement only it."
24
24
  },
25
+ { id: "env-safe-area", css: ["env()"], degrades: "A frame's safe-area padding keeps only its own padding: on a phone with a home indicator or a notch the content may sit under it." },
25
26
  { id: "color-mix", css: ["color-mix()"], degrades: "Colours mixed with color-mix() are dropped; the property falls back to its inherited or initial value." },
26
27
  { id: "color-scheme", css: ["color-scheme"], degrades: "Native controls and scrollbars keep the browser's default scheme under a dark theme." },
28
+ { id: "overscroll-behavior", css: ["overscroll-behavior"], degrades: "A contained scroller's scroll chains on to the page or dialog behind it when it reaches its end." },
27
29
  { id: "container-queries", css: ["@container", "container-name", "container-type"], degrades: "Container-dependent rules do not apply: a region keeps its base arrangement at every container size." },
28
30
  { id: "container-query-units", css: ["cqi", "cqb", "cqw", "cqh", "cqmin", "cqmax"], degrades: "Declarations measured in container units are dropped." },
29
31
  {
@@ -68,6 +70,7 @@ export const PLATFORM_FEATURES = [
68
70
  css: ["overlay", "transition-property: overlay"],
69
71
  degrades: "The top-layer exit animation is cut: where overlay cannot be transitioned, the element leaves the top layer at once and closes instantly."
70
72
  },
73
+ { id: "scrollbar-color", css: ["scrollbar-color", "scrollbar-width"], degrades: "A scrolling element keeps the browser's own scrollbar colours and width." },
71
74
  { id: "scrollbar-gutter", css: ["scrollbar-gutter"], degrades: "The page behind an open modal card shifts sideways by the scrollbar's width when the scroll lock hides it." },
72
75
  { id: "popover", css: [":popover-open"], degrades: "Required by popovers and menus: without the Popover API the overlay never enters the top layer, is not hidden while closed and is not light-dismissed." },
73
76
  { id: "prefers-color-scheme", css: ["@media (prefers-color-scheme)"], degrades: "The operating system's colour scheme is not followed: the default theme applies." },
@@ -113,6 +116,14 @@ export const PLATFORM_FEATURES = [
113
116
  "background",
114
117
  "background-color",
115
118
  "background-image",
119
+ "background-size",
120
+ "background-repeat",
121
+ "isolation",
122
+ "transform-origin",
123
+ "stroke-dasharray",
124
+ "stroke-dashoffset",
125
+ "transform-box",
126
+ "animation-play-state",
116
127
  "border-collapse",
117
128
  "border-radius",
118
129
  "box-shadow",
@@ -143,6 +154,7 @@ export const PLATFORM_FEATURES = [
143
154
  "grid-template-rows",
144
155
  "justify-content",
145
156
  "justify-items",
157
+ "justify-self",
146
158
  "line-height",
147
159
  "list-style-type",
148
160
  "object-fit",
@@ -11,7 +11,9 @@ export function pressScaleReviews(foundation, spec) {
11
11
  if (selected.kind === "err" || selected.value.kind !== "motion")
12
12
  return [];
13
13
  let contexts = null;
14
- return spec.press.when.flatMap(({ condition, field, path }) => {
14
+ return spec.press.when.flatMap(({ condition, effect, field, path }) => {
15
+ if (effect !== "scale")
16
+ return [];
15
17
  const value = selected.value.fields.get(field);
16
18
  if (value === void 0)
17
19
  return [];
@@ -73,6 +73,11 @@ export interface ProfileSpec {
73
73
  readonly scaleInline?: Token;
74
74
  readonly scaleBlock?: Token;
75
75
  readonly rotate?: Token;
76
+ /**
77
+ * A line drawn or not (`"hidden"` | `"drawn"`): its stroke revealed along its length, as a path drawing itself. The
78
+ * shape states `pathLength="1"` in its SVG; at rest it is drawn, so reduced motion shows the finished line.
79
+ */
80
+ readonly draw?: "hidden" | "drawn";
76
81
  }[];
77
82
  }
78
83
  export interface Profile {
@@ -29,7 +29,7 @@ export function profileApplied(profile, selected, tokenValue) {
29
29
  const sources = profile.kind === "composite" ? profile.fields.flatMap((field) => Object.hasOwn(SLOT_KINDS, field.field) && field.profile !== null ? [selected(field.profile)].flatMap((item) => item === void 0 ? [] : [item]) : []) : [profile], of = (kind) => sources.find((source) => source.kind === kind), stated = (kind, field) => of(kind)?.fields.find((item) => item.field === field)?.value, declarations = (kind) => {
30
30
  const properties = APPLIED_PROPERTIES[kind] ?? {};
31
31
  return (of(kind)?.fields ?? []).flatMap((field) => Object.hasOwn(properties, field.field) ? [[properties[field.field] ?? "", field.value]] : []);
32
- }, css = (value) => /^--[\w-]+$/.test(value) ? `var(${value})` : value, frame = declarations("frame"), surface = declarations("surface"), shadow = stated("surface", "shapeShadow") ?? stated("surface", "groupShadow"), filter = [...stated("surface", "brightness") === void 0 ? [] : [`brightness(${css(stated("surface", "brightness") ?? "")})`], ...stated("surface", "blur") === void 0 ? [] : [`blur(${css(stated("surface", "blur") ?? "")})`], ...shadow === void 0 ? [] : [`drop-shadow(${css(shadow)})`]], backdrop = [...stated("surface", "backdropBlur") === void 0 ? [] : [`blur(${css(stated("surface", "backdropBlur") ?? "")})`], ...stated("surface", "backdropSaturate") === void 0 ? [] : [`saturate(${css(stated("surface", "backdropSaturate") ?? "")})`]];
32
+ }, css = (value) => /^--[\w-]+$/.test(value) ? `var(${value})` : value, frame = declarations("frame"), surface = declarations("surface"), shadow = stated("surface", "shapeShadow") ?? stated("surface", "groupShadow"), filter = [...["grayscale", "invert", "brightness"].flatMap((field) => stated("surface", field) === void 0 ? [] : [`${field}(${css(stated("surface", field) ?? "")})`]), ...stated("surface", "blur") === void 0 ? [] : [`blur(${css(stated("surface", "blur") ?? "")})`], ...shadow === void 0 ? [] : [`drop-shadow(${css(shadow)})`]], backdrop = [...stated("surface", "backdropBlur") === void 0 ? [] : [`blur(${css(stated("surface", "backdropBlur") ?? "")})`], ...stated("surface", "backdropSaturate") === void 0 ? [] : [`saturate(${css(stated("surface", "backdropSaturate") ?? "")})`]];
33
33
  if (filter.length > 0)
34
34
  surface.push(["filter", filter.join(" ")]);
35
35
  if (backdrop.length > 0)
@@ -57,11 +57,16 @@ export type Frame = "control" | "container" | {
57
57
  readonly rules?: readonly Side[];
58
58
  /** A region root's frame: the corners it rounds by the frame profile's `radius` (block then inline edge); the others are square. Every corner without it. */
59
59
  readonly corners?: readonly ("start-start" | "start-end" | "end-start" | "end-end")[];
60
+ /** The sides whose padding also clears the device's safe area (a phone's home indicator under a bottom bar). */
61
+ readonly safeArea?: readonly SafeAreaSide[];
60
62
  }
61
63
  /** On a part: its own box (padding, border, radius, sizes) from a named frame profile. */
62
64
  | {
63
65
  readonly profile: string;
66
+ readonly safeArea?: readonly SafeAreaSide[];
64
67
  };
68
+ /** A side of a frame by its logical name. */
69
+ export type SafeAreaSide = "block-start" | "block-end" | "inline-start" | "inline-end";
65
70
  /** The pointer cursors an element may show: a closed set, no image cursors. */
66
71
  export type Cursor = "pointer" | "default" | "grab" | "grabbing" | "col-resize" | "row-resize" | "move" | "text" | "not-allowed";
67
72
  /** The touch gestures an element leaves to the browser: none (the owner handles them all), or panning on one axis. */
@@ -160,7 +165,9 @@ export type GeneratedContent = {
160
165
  export interface SliderTreatment {
161
166
  readonly surface: string;
162
167
  readonly frame: string;
163
- readonly when?: Readonly<Record<string, string>>;
168
+ readonly when?: Readonly<Record<string, {
169
+ readonly surface: ProfileReference;
170
+ }>>;
164
171
  }
165
172
  export interface GeneratedTreatment {
166
173
  readonly surface?: string;
@@ -202,13 +209,13 @@ export type LayerDeclaration = {
202
209
  readonly inline: "start" | "end";
203
210
  };
204
211
  readonly clear?: "none" | "block-start";
205
- readonly motion?: "fade";
212
+ readonly motion?: "fade" | "drop";
206
213
  } | {
207
214
  readonly element: "popover";
208
215
  readonly popover?: "auto" | "manual";
209
216
  /** Anchored to an element by the owner: the recipe's measured insets or translation place it while it is open. */
210
217
  readonly placement: "measured";
211
- readonly motion?: "fade";
218
+ readonly motion?: "fade" | "drop";
212
219
  };
213
220
  /** A logical inset or box size a measured length sets. */
214
221
  export type MeasuredLengthProperty = "inset-block-start" | "inset-block-end" | "inset-inline-start" | "inset-inline-end" | "inline-size" | "block-size" | "min-inline-size" | "max-inline-size" | "min-block-size" | "max-block-size";
@@ -260,6 +267,11 @@ export type MeasuredDeclaration = {
260
267
  | {
261
268
  readonly type: "intrinsic-size";
262
269
  readonly property: "inline-size";
270
+ }
271
+ /** How far along its range a slider's value is, 0 to 1: its fill (`slider-fill`), or a step label's place (`slider-step`). */
272
+ | {
273
+ readonly type: "share";
274
+ readonly property: "slider-fill" | "slider-step";
263
275
  };
264
276
  /** Measured values by name: a camelCase name per value, unique within the recipe. */
265
277
  export type MeasuredDeclarations = Readonly<Record<string, MeasuredDeclaration>>;
@@ -344,7 +356,12 @@ export interface RecipeSpec {
344
356
  * A part's content. `"component"`: a public component placed with the part's marker (`className`), as a grid
345
357
  * cell is; the part states its placement only (`required`, `repeat`, `extent`, `at`, `spaceBefore`, `spaceAfter`).
346
358
  */
347
- readonly kind?: "text" | "visual" | "vector" | "component";
359
+ readonly kind?: "text" | "visual" | "vector" | "component" | "decoration";
360
+ /**
361
+ * A decoration (`kind: "decoration"`): the layer scrolls with its parent's box (`"scroll"`, the default) or stays
362
+ * fixed to the viewport (`"fixed"`: a page backdrop that stays put while the page scrolls).
363
+ */
364
+ readonly attachment?: "scroll" | "fixed";
348
365
  /**
349
366
  * In a `stack`: the part's own space before it and after it, in place of the stack's gap (a heading further
350
367
  * from what precedes it). Where one part's space after meets the next part's space before, the larger applies.
@@ -406,6 +423,11 @@ export interface RecipeSpec {
406
423
  * right after it and shows its focus (`focus: { of }`).
407
424
  */
408
425
  readonly drawnBy?: string;
426
+ /**
427
+ * A row of step labels under the named sibling slider part (no layout of its own): inset by half the thumb's width,
428
+ * each label centred at its measured share (`{ type: "share", property: "slider-step" }`).
429
+ */
430
+ readonly along?: string;
409
431
  /**
410
432
  * Neighbours of an `inline` or `stack` arrangement overlap by the spacing profile's `overlap`, in place of a
411
433
  * gap (a pile of faces, a stack of cards). Later neighbours paint over earlier ones.
@@ -474,9 +496,20 @@ export interface RecipeSpec {
474
496
  * "block-start"` holds it below a region at the top by the layer profile's `clearBlockStart`.
475
497
  */
476
498
  readonly sticky?: {
477
- readonly edge: "block-start" | "block-end";
499
+ readonly edge: "block-start" | "block-end" | "inline-start" | "inline-end";
478
500
  readonly clear?: "none" | "block-start";
479
501
  };
502
+ /**
503
+ * The point the root's or part's scale and rotation grow from: its centre (the default) or one edge. An underline
504
+ * that stretches from its start is `origin: "inline-start"` with a `scaleInline`; inline edges mirror under
505
+ * right-to-left.
506
+ */
507
+ readonly origin?: "center" | "inline-start" | "inline-end" | "block-start" | "block-end";
508
+ /**
509
+ * With a scrolling `overflow`: reaching the end of this scroller does not scroll the page or dialog behind it
510
+ * (`overscroll-behavior: contain`): a search dialog's results list.
511
+ */
512
+ readonly overscroll?: "contain";
480
513
  /** An entrance on first render: the root or part starts from `from` and settles into its own look. */
481
514
  readonly enter?: Enter;
482
515
  /** Pseudo-element treatments of an `<input>` or `<textarea>` part. */
@@ -493,7 +526,15 @@ export interface RecipeSpec {
493
526
  /** A range slider's track (`<input type="range">`): its surface (background, border) and frame (block size, radius). */
494
527
  readonly sliderTrack?: SliderTreatment;
495
528
  /** A range slider's thumb: its surface and frame (inline and block size, radius, border); centred on the track. */
496
- readonly sliderThumb?: SliderTreatment;
529
+ readonly sliderThumb?: SliderTreatment & {
530
+ /** The motion field (a scale) the thumb grows by while pointed at or dragged, enabled. */
531
+ readonly grow?: {
532
+ readonly slot: "motion";
533
+ readonly field: string;
534
+ };
535
+ };
536
+ /** A range slider's fill, on its track up to the thumb: a surface's background, with `when` states. */
537
+ readonly sliderFill?: PseudoTreatment;
497
538
  };
498
539
  /** CSS counters: where a count starts (`reset`) and what this element counts (`increment`). `list-item` is the browser's own list counter. */
499
540
  readonly counter?: {
@@ -504,9 +545,15 @@ export interface RecipeSpec {
504
545
  * A rule between the element's consecutive children: the frame profile's border width and style, painted by the
505
546
  * surface's `borderColor` (a hairline between table rows, none after the last).
506
547
  */
548
+ /**
549
+ * Rules between the element's children: their colour from `surface`'s border colour, their width and style from
550
+ * `frame`. With `axes`, between the arranged items on those axes wherever the arrangement puts them (rows, items in a
551
+ * row, a grid's columns and rows at every width), centred in the gap; without it, between consecutive children.
552
+ */
507
553
  readonly between?: {
508
554
  readonly surface: string;
509
555
  readonly frame: string;
556
+ readonly axes?: readonly ("inline" | "block")[];
510
557
  };
511
558
  /**
512
559
  * Loose flow, on the root: a stack gives its gap to its children, and its last part's own `spaceAfter` carries out
@@ -95,8 +95,9 @@ function buildProfileTree(spec) {
95
95
  required(profileDefinition(node));
96
96
  return root;
97
97
  }
98
- const NESTED = new Set(["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "recipe", "normalize", "theme", "paintTransition", "pseudo", "layer", "measured", "paints", "snap", "accessibility", "enter", "sticky", "outset", "play", "focus", "geometryTransition", "counter", "content", "between", "flow"]), NESTED_IN = {
99
- "ads-part": ["recipe", "when", "frame", "parts", "paintTransition", "pseudo", "at", "measured", "paints", "normalize", "accessibility", "enter", "sticky", "play", "outset", "focus", "geometryTransition", "counter", "between"],
98
+ const NESTED = new Set(["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "recipe", "normalize", "theme", "paintTransition", "pseudo", "layer", "measured", "paints", "snap", "accessibility", "enter", "sticky", "outset", "play", "focus", "geometryTransition", "counter", "content", "between", "flow", "groups", "anchor"]), NESTED_IN = {
99
+ "ads-part": ["recipe", "when", "frame", "parts", "paintTransition", "pseudo", "at", "measured", "paints", "normalize", "accessibility", "enter", "sticky", "play", "outset", "focus", "geometryTransition", "counter", "between", "groups", "anchor"],
100
+ "ads-group": ["play", "when"],
100
101
  "ads-cell": ["at"],
101
102
  "ads-at": ["cells", "frame"],
102
103
  "ads-when": ["play", "frame"],
@@ -126,18 +127,20 @@ function body(node, spec) {
126
127
  clause(node, "ads-geometry-transition", "", only(spec.geometryTransition, ["channels", "motion"]));
127
128
  if (spec.sticky !== void 0)
128
129
  clause(node, "ads-sticky", "", only(spec.sticky, ["edge", "clear"]));
130
+ if (spec.anchor !== void 0)
131
+ clause(node, "ads-anchor", "", only(spec.anchor, ["artwork", "x", "y", "inline", "block"]));
129
132
  if (spec.outset !== void 0)
130
133
  clause(node, "ads-outset", "", only(spec.outset, ["block", "inline"]));
131
134
  if (spec.focus !== void 0)
132
135
  clause(node, "ads-focus", "", only(spec.focus, ["of", "shownBy", "within"]));
133
136
  if (spec.play !== void 0)
134
- clause(node, "ads-play", "", only(spec.play, ["sequence", "order"]));
137
+ clause(node, "ads-play", "", only(spec.play, ["sequence", "order", "paused"]));
135
138
  if (spec.flow !== void 0)
136
139
  clause(node, "ads-flow", "", only(spec.flow, ["edges"]));
137
140
  if (spec.counter !== void 0)
138
141
  clause(node, "ads-counter", "", only(spec.counter, ["reset", "increment"]));
139
142
  if (spec.between !== void 0)
140
- clause(node, "ads-between", "", only(spec.between, ["surface", "frame"]));
143
+ clause(node, "ads-between", "", only(spec.between, ["surface", "frame", "axes"]));
141
144
  if (spec.content !== void 0)
142
145
  clause(node, "ads-content", "", only(spec.content, ["counter", "counters", "style", "separator", "prefix", "suffix"]));
143
146
  const entrance = spec.enter;
@@ -150,7 +153,7 @@ function body(node, spec) {
150
153
  const { backdrop, corner, ...fields } = only(layer, ["element", "edge", "backdrop", "motion", "modalBelow", "popover", "corner", "clear", "placement"]), nested = (name, value, keys) => value === void 0 ? [] : Object.entries(only(value, keys)).map(([key, item]) => [`${name}${key[0]?.toUpperCase() ?? ""}${key.slice(1)}`, item]);
151
154
  clause(node, "ads-layer", "", { ...fields, ...Object.fromEntries([...nested("backdrop", backdrop, ["surface", "dismiss"]), ...nested("corner", corner, ["block", "inline"])]) });
152
155
  }
153
- for (const [field, kind] of [["parts", "part"], ["cells", "cell"], ["at", "at"], ["when", "when"], ["pseudo", "pseudo"]])
156
+ for (const [field, kind] of [["parts", "part"], ["cells", "cell"], ["at", "at"], ["when", "when"], ["pseudo", "pseudo"], ["groups", "group"]])
154
157
  for (const [name, child] of Object.entries(spec[field] === void 0 ? {} : object(spec[field], `Invalid ${field} declaration`)))
155
158
  body(clause(node, `ads-${kind}`, name), object(child, `Invalid ${field} declaration`));
156
159
  for (const [name, rows] of Object.entries(spec.alignRows === void 0 ? {} : object(spec.alignRows, "Expected row alignment")))