@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.
- package/dist/ads-errors.mjs +68 -1
- package/dist/analysis/owner-source.mjs +16 -2
- package/dist/asset-declaration.d.mts +5 -0
- package/dist/asset-declaration.mjs +8 -2
- package/dist/asset-model.mjs +3 -0
- package/dist/construction-output.mjs +28 -6
- package/dist/construction-spec.d.mts +115 -10
- package/dist/construction-spec.mjs +183 -45
- package/dist/end-alignment.mjs +17 -2
- package/dist/form-states.mjs +2 -2
- package/dist/grid-lowering.mjs +24 -1
- package/dist/lowering-layer.mjs +11 -10
- package/dist/lowering-overlaps.mjs +5 -3
- package/dist/lowering-properties.mjs +11 -1
- package/dist/lowering-region-layout.mjs +4 -4
- package/dist/lowering-sequence.mjs +6 -2
- package/dist/mcp/preview-http.bundle.js +3 -3
- package/dist/mcp/preview-widget.bundle.js +40 -40
- package/dist/measured-geometry.mjs +15 -3
- package/dist/owner-analysis-check.mjs +36 -0
- package/dist/owner-errors.mjs +6 -0
- package/dist/ownership-model.mjs +35 -9
- package/dist/platform-features.mjs +11 -0
- package/dist/press-scale.mjs +3 -1
- package/dist/profile-macro.d.mts +5 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +61 -6
- package/dist/recipe-model.mjs +11 -6
- package/dist/region-lowering.mjs +417 -36
- package/dist/role-vocabulary.d.mts +7 -0
- package/dist/role-vocabulary.mjs +13 -1
- package/dist/showcase/client.bundle.js +39 -39
- package/dist/showcase/http-client.bundle.js +17 -17
- package/dist/showcase/scenario-page.mjs +37 -12
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +2 -2
- package/dist/skills/ads-designer/references/motion.md +4 -1
- package/dist/skills/ads-designer/references/recipes.md +35 -1
- package/dist/skills/ads-import/references/recipes.md +35 -1
- package/dist/skills/ads-port/references/recipes.md +35 -1
- package/dist/spatial-model.mjs +11 -2
- package/dist/surface-effects.mjs +11 -6
- package/docs/ARCHITECTURE.md +16 -0
- package/docs/ASSETS.md +7 -1
- package/docs/CHANGELOG.md +160 -18
- package/docs/GUIDE.md +20 -1
- package/docs/LANGUAGE.md +137 -16
- package/docs/MOTION.md +45 -0
- package/docs/PROFILE-KINDS.md +15 -4
- package/docs/RULES.md +12 -3
- package/docs/TOKEN-ROLES.md +8 -2
- package/package.json +1 -1
|
@@ -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}%`;
|
|
@@ -464,6 +464,7 @@ export function checkFindings(inputs, check, publics = null) {
|
|
|
464
464
|
diagnostics.push(...targets.diagnostics);
|
|
465
465
|
advisories.push(...targets.advisories);
|
|
466
466
|
advisories.push(...counterFindings(inputs, analyzedOwners(check.outcomes)));
|
|
467
|
+
advisories.push(...disabledShownFindings(inputs, analyzedOwners(check.outcomes)));
|
|
467
468
|
diagnostics.push(...documentFindings(inputs, analyzedOwners(check.outcomes)));
|
|
468
469
|
diagnostics.push(...endAlignmentFindings(inputs, analyzedOwners(check.outcomes), check.foundation));
|
|
469
470
|
diagnostics.push(...focusShownFindings(inputs, analyzedOwners(check.outcomes)));
|
|
@@ -503,6 +504,9 @@ function focusShownFindings(inputs, owners) {
|
|
|
503
504
|
for (const style of facts.styles.values())
|
|
504
505
|
for (const match of style.css.matchAll(/:has\((\.[\w-]+):focus-visible\)/g))
|
|
505
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] ?? "");
|
|
506
510
|
for (const style of facts.styles.values()) {
|
|
507
511
|
const [first] = style.origins;
|
|
508
512
|
if (first?.kind !== "point")
|
|
@@ -605,6 +609,38 @@ function counterFindings(inputs, owners) {
|
|
|
605
609
|
}
|
|
606
610
|
return [...used].flatMap(([counter, origin]) => reset.has(counter) ? [] : [reviewFinding(inputs, { origin, review: { kind: "counter-unreset", counter } })]);
|
|
607
611
|
}
|
|
612
|
+
const UNSEEN_DISABLED = /^(cursor|pointer-events|user-select|-webkit-user-select|touch-action|transition(-[a-z]+)?|animation(-[a-z]+)?)$/, INACTIVE_STATE = /:disabled|\[aria-disabled=["']?true["']?\]/, EXCLUDED_INACTIVE = /:not\((?::disabled|\[aria-disabled=["']?true["']?\])\)/g;
|
|
613
|
+
function disabledShownFindings(inputs, owners) {
|
|
614
|
+
const findings = [];
|
|
615
|
+
for (const facts of owners.values()) {
|
|
616
|
+
let origin;
|
|
617
|
+
const changes = new Set;
|
|
618
|
+
let shown = !1;
|
|
619
|
+
for (const style of facts.styles.values()) {
|
|
620
|
+
if (!INACTIVE_STATE.test(style.css))
|
|
621
|
+
continue;
|
|
622
|
+
const [first] = style.origins;
|
|
623
|
+
for (const match of style.css.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
|
|
624
|
+
if (!INACTIVE_STATE.test((match[1] ?? "").replace(EXCLUDED_INACTIVE, "")))
|
|
625
|
+
continue;
|
|
626
|
+
if (origin === void 0 && first?.kind === "point")
|
|
627
|
+
origin = { ...first, file: path.join(inputs.dsRoot, first.file) };
|
|
628
|
+
for (const declaration of (match[2] ?? "").split(";")) {
|
|
629
|
+
const property = declaration.split(":")[0]?.trim() ?? "";
|
|
630
|
+
if (property === "")
|
|
631
|
+
continue;
|
|
632
|
+
if (UNSEEN_DISABLED.test(property))
|
|
633
|
+
changes.add(property);
|
|
634
|
+
else
|
|
635
|
+
shown = !0;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (origin !== void 0 && !shown)
|
|
640
|
+
findings.push(reviewFinding(inputs, { origin, review: { kind: "disabled-unshown", changes: [...changes].sort() } }));
|
|
641
|
+
}
|
|
642
|
+
return findings;
|
|
643
|
+
}
|
|
608
644
|
function placedSpacing(owners, plain, publics) {
|
|
609
645
|
if (publics === null)
|
|
610
646
|
return new Map;
|
package/dist/owner-errors.mjs
CHANGED
|
@@ -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":
|
package/dist/ownership-model.mjs
CHANGED
|
@@ -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:
|
|
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,22 +118,32 @@ 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": {
|
|
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") },
|
|
139
|
+
"ads-flow": { edges: oneOf("trim") },
|
|
114
140
|
"ads-snap": { type: oneOf(...SNAP_TYPES), align: oneOf(...SNAP_ALIGNS) },
|
|
115
141
|
"ads-layer": {
|
|
116
142
|
element: oneOf("dialog", "popover"),
|
|
117
143
|
edge: oneOf("start", "end", "center", "block-start"),
|
|
118
144
|
"backdrop-surface": binding,
|
|
119
145
|
"backdrop-dismiss": oneOf("press", "none"),
|
|
120
|
-
motion: oneOf("slide", "fade"),
|
|
146
|
+
motion: oneOf("slide", "fade", "drop"),
|
|
121
147
|
"modal-below": (value) => identifier.test(value),
|
|
122
148
|
popover: oneOf("auto", "manual"),
|
|
123
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
|
{
|
|
@@ -113,6 +115,14 @@ export const PLATFORM_FEATURES = [
|
|
|
113
115
|
"background",
|
|
114
116
|
"background-color",
|
|
115
117
|
"background-image",
|
|
118
|
+
"background-size",
|
|
119
|
+
"background-repeat",
|
|
120
|
+
"isolation",
|
|
121
|
+
"transform-origin",
|
|
122
|
+
"stroke-dasharray",
|
|
123
|
+
"stroke-dashoffset",
|
|
124
|
+
"transform-box",
|
|
125
|
+
"animation-play-state",
|
|
116
126
|
"border-collapse",
|
|
117
127
|
"border-radius",
|
|
118
128
|
"box-shadow",
|
|
@@ -143,6 +153,7 @@ export const PLATFORM_FEATURES = [
|
|
|
143
153
|
"grid-template-rows",
|
|
144
154
|
"justify-content",
|
|
145
155
|
"justify-items",
|
|
156
|
+
"justify-self",
|
|
146
157
|
"line-height",
|
|
147
158
|
"list-style-type",
|
|
148
159
|
"object-fit",
|
package/dist/press-scale.mjs
CHANGED
|
@@ -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 [];
|
package/dist/profile-macro.d.mts
CHANGED
|
@@ -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 = [...
|
|
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)
|
package/dist/recipe-macro.d.mts
CHANGED
|
@@ -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,
|
|
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
|
|
@@ -514,6 +561,14 @@ export interface RecipeSpec {
|
|
|
514
561
|
* the list's gap and the item's last block's space after.
|
|
515
562
|
*/
|
|
516
563
|
readonly carry?: boolean;
|
|
564
|
+
/**
|
|
565
|
+
* A root in block flow (no `layout`): `edges: "trim"` makes its first child's space before and its last child's space
|
|
566
|
+
* after nothing, so a page that opens with a heading starts flush. A block flow inside its own padding or border
|
|
567
|
+
* does this by itself; a frameless one otherwise passes those spaces out, as CSS margins do.
|
|
568
|
+
*/
|
|
569
|
+
readonly flow?: {
|
|
570
|
+
readonly edges: "trim";
|
|
571
|
+
};
|
|
517
572
|
/** On a part: `"assistive"` hides it on screen while assistive technology still reads it (a table caption). */
|
|
518
573
|
readonly presence?: "visible" | "assistive";
|
|
519
574
|
/** A list's marker style at each nesting depth, outermost first; deeper lists keep the last. */
|
package/dist/recipe-model.mjs
CHANGED
|
@@ -95,15 +95,16 @@ 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"]), 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"],
|
|
103
104
|
"ads-pseudo": ["when", "content"]
|
|
104
105
|
};
|
|
105
106
|
function body(node, spec) {
|
|
106
|
-
const allowed = node.name === "ads-recipe" ? ["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "paintTransition", "geometryTransition", "snap", ...node.parent?.type === "root" ? ["normalize", "theme", "layer", "measured", "paints", "enter", "sticky", "play", "pseudo", "counter", "between", "focus"] : []] : NESTED_IN[node.name] ?? [], nestedKey = (key) => NESTED.has(key) && !(node.name === "ads-pseudo" && key === "frame");
|
|
107
|
+
const allowed = node.name === "ads-recipe" ? ["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "paintTransition", "geometryTransition", "snap", ...node.parent?.type === "root" ? ["normalize", "theme", "layer", "measured", "paints", "enter", "sticky", "play", "pseudo", "counter", "between", "focus", "flow"] : []] : NESTED_IN[node.name] ?? [], nestedKey = (key) => NESTED.has(key) && !(node.name === "ads-pseudo" && key === "frame");
|
|
107
108
|
for (const field of Object.keys(spec))
|
|
108
109
|
if (nestedKey(field))
|
|
109
110
|
check(allowed.includes(field), `Unsupported ${field} in ${node.name}`);
|
|
@@ -126,16 +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"]));
|
|
138
|
+
if (spec.flow !== void 0)
|
|
139
|
+
clause(node, "ads-flow", "", only(spec.flow, ["edges"]));
|
|
135
140
|
if (spec.counter !== void 0)
|
|
136
141
|
clause(node, "ads-counter", "", only(spec.counter, ["reset", "increment"]));
|
|
137
142
|
if (spec.between !== void 0)
|
|
138
|
-
clause(node, "ads-between", "", only(spec.between, ["surface", "frame"]));
|
|
143
|
+
clause(node, "ads-between", "", only(spec.between, ["surface", "frame", "axes"]));
|
|
139
144
|
if (spec.content !== void 0)
|
|
140
145
|
clause(node, "ads-content", "", only(spec.content, ["counter", "counters", "style", "separator", "prefix", "suffix"]));
|
|
141
146
|
const entrance = spec.enter;
|
|
@@ -148,7 +153,7 @@ function body(node, spec) {
|
|
|
148
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]);
|
|
149
154
|
clause(node, "ads-layer", "", { ...fields, ...Object.fromEntries([...nested("backdrop", backdrop, ["surface", "dismiss"]), ...nested("corner", corner, ["block", "inline"])]) });
|
|
150
155
|
}
|
|
151
|
-
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"]])
|
|
152
157
|
for (const [name, child] of Object.entries(spec[field] === void 0 ? {} : object(spec[field], `Invalid ${field} declaration`)))
|
|
153
158
|
body(clause(node, `ads-${kind}`, name), object(child, `Invalid ${field} declaration`));
|
|
154
159
|
for (const [name, rows] of Object.entries(spec.alignRows === void 0 ? {} : object(spec.alignRows, "Expected row alignment")))
|