@reqvire-org/ads 0.5.12 → 0.5.14
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 +40 -3
- package/dist/analysis/content-model.mjs +156 -0
- package/dist/analysis/owner-source.mjs +23 -1
- package/dist/check.mjs +1 -0
- package/dist/construction-output.mjs +11 -2
- package/dist/construction-spec.d.mts +45 -8
- package/dist/construction-spec.mjs +22 -12
- package/dist/end-alignment.mjs +9 -4
- package/dist/lowering-layer.mjs +50 -15
- package/dist/lowering-paint.mjs +1 -1
- package/dist/lowering-region-layout.mjs +5 -0
- package/dist/lowering-sequence.mjs +4 -3
- package/dist/measured-geometry.mjs +8 -2
- package/dist/owner-analysis-check.mjs +1 -0
- package/dist/owner-errors.mjs +1 -0
- package/dist/ownership-model.mjs +5 -5
- package/dist/recipe-macro.d.mts +13 -6
- package/dist/recipe-model.mjs +2 -2
- package/dist/region-lowering.mjs +42 -17
- package/dist/showcase/client.bundle.js +46 -46
- package/dist/showcase/http-client.bundle.js +13 -13
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +3 -3
- package/dist/skills/ads-designer/references/behaviors.md +31 -0
- package/dist/skills/ads-designer/references/recipes.md +7 -5
- package/dist/skills/ads-import/references/behaviors.md +31 -0
- package/dist/skills/ads-import/references/recipes.md +7 -5
- package/dist/skills/ads-port/references/behaviors.md +31 -0
- package/dist/skills/ads-port/references/recipes.md +7 -5
- package/dist/token-shapes.mjs +42 -1
- package/docs/ADS.md +3 -2
- package/docs/CHANGELOG.md +130 -18
- package/docs/GUIDE.md +8 -0
- package/docs/LANGUAGE.md +28 -10
- package/docs/MOTION.md +5 -0
- package/docs/PROFILE-KINDS.md +8 -5
- package/docs/RULES.md +9 -4
- package/docs/TOKEN-ROLES.md +1 -1
- package/package.json +1 -1
package/dist/end-alignment.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function endsRagged(arrangement, parts) {
|
|
|
12
12
|
return !1;
|
|
13
13
|
if (arrangement.justify !== null && /end|space-/.test(arrangement.justify))
|
|
14
14
|
return !1;
|
|
15
|
-
return !parts.some((part) => part.extent.kind
|
|
15
|
+
return !parts.some((part) => part.extent.kind !== "content");
|
|
16
16
|
}
|
|
17
17
|
export function endInsetOf(foundation, spec) {
|
|
18
18
|
switch (spec.kind) {
|
|
@@ -29,7 +29,7 @@ export function endInsetOf(foundation, spec) {
|
|
|
29
29
|
if (frame.kind === "err" || frame.value.kind !== "frame")
|
|
30
30
|
return null;
|
|
31
31
|
const surfaceName = spec.surface ?? (selected.value.kind === "composite" ? selected.value.fields.get("surface-profile") : void 0), surface = surfaceName === void 0 ? null : selectedProfile(foundation, surfaceName);
|
|
32
|
-
if (surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && surface.value.fields.has("background") || borderedAtEnd(frame.value.fields, spec.frame?.border ?? null))
|
|
32
|
+
if (surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && (surface.value.fields.has("background") || surface.value.fields.has("background-image")) || borderedAtEnd(frame.value.fields, spec.frame?.border ?? null))
|
|
33
33
|
return [];
|
|
34
34
|
if (endsRagged(spec.arrangement, spec.parts))
|
|
35
35
|
return null;
|
|
@@ -71,11 +71,14 @@ function paintsFlushBox(foundation, spec) {
|
|
|
71
71
|
if (selected.kind === "err")
|
|
72
72
|
return !1;
|
|
73
73
|
const frameName = selected.value.kind === "frame" ? spec.profile : selected.value.kind === "composite" ? selected.value.fields.get("frame-profile") : void 0, frame = frameName === void 0 ? null : frameName === spec.profile ? selected : selectedProfile(foundation, frameName), fields = frame !== null && frame.kind === "ok" && frame.value.kind === "frame" ? frame.value.fields : new Map, surfaceName = spec.surface ?? (selected.value.kind === "composite" ? selected.value.fields.get("surface-profile") : void 0), surface = surfaceName === void 0 ? null : selectedProfile(foundation, surfaceName);
|
|
74
|
-
if (!(surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && surface.value.fields.has("background")) && !borderedAtEnd(fields, spec.frame?.border ?? null))
|
|
74
|
+
if (!(surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && (surface.value.fields.has("background") || surface.value.fields.has("background-image"))) && !borderedAtEnd(fields, spec.frame?.border ?? null))
|
|
75
75
|
return !1;
|
|
76
76
|
const end = frameInlineInsets(Object.fromEntries(fields)).end;
|
|
77
77
|
return end === void 0 || /^0(px)?$/.test(end.trim());
|
|
78
78
|
}
|
|
79
|
+
function holdsText(part) {
|
|
80
|
+
return part.content.kind === "text" || part.parts.some(holdsText);
|
|
81
|
+
}
|
|
79
82
|
export function stackPartsOf(foundation, spec) {
|
|
80
83
|
if (spec.kind !== "region" || spec.arrangement.layout !== "stack")
|
|
81
84
|
return [];
|
|
@@ -88,9 +91,11 @@ export function stackPartsOf(foundation, spec) {
|
|
|
88
91
|
const frame = selectedProfile(foundation, part.box);
|
|
89
92
|
if (frame.kind === "err" || frame.value.kind !== "frame")
|
|
90
93
|
return [];
|
|
91
|
-
const surface = part.surface === null ? null : selectedProfile(foundation, part.surface), painted = surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && surface.value.fields.has("background") || borderedAtEnd(frame.value.fields, null);
|
|
94
|
+
const surface = part.surface === null ? null : selectedProfile(foundation, part.surface), painted = surface !== null && surface.kind === "ok" && surface.value.kind === "surface" && (surface.value.fields.has("background") || surface.value.fields.has("background-image")) || borderedAtEnd(frame.value.fields, null) || part.overflow.kind === "clip";
|
|
92
95
|
if (painted && banded)
|
|
93
96
|
return [];
|
|
97
|
+
if (painted && !holdsText(part))
|
|
98
|
+
return [];
|
|
94
99
|
if (painted)
|
|
95
100
|
return [{ part: part.name, kind: "box", inset: [] }];
|
|
96
101
|
if (endsRagged(part.arrangement, part.parts))
|
package/dist/lowering-layer.mjs
CHANGED
|
@@ -24,13 +24,13 @@ const transition = (property, timing) => ({
|
|
|
24
24
|
"transition-timing-function": timing.easing,
|
|
25
25
|
...timing.delay === null ? {} : { "transition-delay": timing.delay }
|
|
26
26
|
}), REDUCED = { "transition-duration": "0s", "transition-delay": "0s" };
|
|
27
|
-
function sheetRules(sheet, backdrop, own, motion, margin) {
|
|
27
|
+
function sheetRules(sheet, backdrop, own, motion, margin, drop = null) {
|
|
28
28
|
const field = Object.keys(backdrop.fields).find((name) => name !== "background" && name !== "backdrop-blur"), background = backdrop.fields.background;
|
|
29
29
|
if (field !== void 0 || background === void 0)
|
|
30
30
|
return err({ kind: "backdrop-surface-unsupported", surface: backdrop.name, field: field ?? null });
|
|
31
31
|
const blur = backdrop.fields["backdrop-blur"], veil = { background, ...blur === void 0 ? {} : { "-webkit-backdrop-filter": `blur(${blur})`, "backdrop-filter": `blur(${blur})` } };
|
|
32
|
-
if (sheet.edge === "center" || sheet.edge === "block-start")
|
|
33
|
-
return ok(cardRules(sheet, veil, own, motion, margin ?? { inline: "0px", block: "0px" }));
|
|
32
|
+
if (sheet.edge === "center" || sheet.edge === "block-start" || sheet.edge === "fill")
|
|
33
|
+
return ok(cardRules(sheet, veil, own, motion, margin ?? { inline: "0px", block: "0px" }, drop));
|
|
34
34
|
const placement = {
|
|
35
35
|
position: "fixed",
|
|
36
36
|
"inset-block-start": "0",
|
|
@@ -60,8 +60,23 @@ function sheetRules(sheet, backdrop, own, motion, margin) {
|
|
|
60
60
|
]
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function cardRules(sheet, veil, own, motion, margin) {
|
|
64
|
-
const placement = {
|
|
63
|
+
function cardRules(sheet, veil, own, motion, margin, drop = null) {
|
|
64
|
+
const placement = sheet.edge === "fill" ? {
|
|
65
|
+
position: "fixed",
|
|
66
|
+
"inset-block-start": "0",
|
|
67
|
+
"inset-block-end": "0",
|
|
68
|
+
"inset-inline-start": "0",
|
|
69
|
+
"inset-inline-end": "0",
|
|
70
|
+
"margin-block-start": "0",
|
|
71
|
+
"margin-block-end": "0",
|
|
72
|
+
"margin-inline-start": "0",
|
|
73
|
+
"margin-inline-end": "0",
|
|
74
|
+
"inline-size": "100%",
|
|
75
|
+
"block-size": "100%",
|
|
76
|
+
"max-block-size": "none",
|
|
77
|
+
"max-inline-size": "none",
|
|
78
|
+
"min-inline-size": "0"
|
|
79
|
+
} : {
|
|
65
80
|
position: "fixed",
|
|
66
81
|
"inset-block-start": "0",
|
|
67
82
|
"inset-block-end": "0",
|
|
@@ -73,16 +88,30 @@ function cardRules(sheet, veil, own, motion, margin) {
|
|
|
73
88
|
"margin-inline-end": "auto",
|
|
74
89
|
"block-size": "fit-content",
|
|
75
90
|
"max-block-size": `calc(100dvh - ${margin.block} * 2)`,
|
|
76
|
-
"max-inline-size": inlineCap(margin.inline, own)
|
|
91
|
+
"max-inline-size": inlineCap(margin.inline, own),
|
|
92
|
+
"min-inline-size": "0"
|
|
77
93
|
}, paint = { selector: "&::backdrop", values: veil, condition: null };
|
|
78
94
|
if (motion === null || sheet.motion === null)
|
|
79
95
|
return { root: placement, rules: [paint] };
|
|
96
|
+
if (sheet.motion === "veil")
|
|
97
|
+
return {
|
|
98
|
+
root: { ...placement, "transition-property": DISCRETE, "transition-behavior": "allow-discrete", "transition-duration": motion.duration, ...motion.delay === null ? {} : { "transition-delay": motion.delay } },
|
|
99
|
+
rules: [
|
|
100
|
+
paint,
|
|
101
|
+
{ selector: "&::backdrop", values: transition("opacity", motion), condition: null },
|
|
102
|
+
{ selector: "&:not([open])::backdrop", values: { opacity: "0" }, condition: null },
|
|
103
|
+
{ selector: "&[open]::backdrop", values: { opacity: "0" }, condition: STARTING },
|
|
104
|
+
{ selector: "&", values: REDUCED, condition: REDUCED_MOTION },
|
|
105
|
+
{ selector: "&::backdrop", values: REDUCED, condition: REDUCED_MOTION }
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
const away = sheet.motion === "drop" && drop !== null ? { opacity: "0", translate: `0 calc(-1 * ${drop.distance})`, scale: drop.scale } : { opacity: "0" };
|
|
80
109
|
return {
|
|
81
|
-
root: { ...placement, ...transition("opacity", motion) },
|
|
110
|
+
root: { ...placement, ...sheet.motion === "drop" ? { "transform-origin": "top center" } : {}, ...transition(sheet.motion === "drop" ? "opacity, translate, scale" : "opacity", motion) },
|
|
82
111
|
rules: [
|
|
83
112
|
paint,
|
|
84
|
-
{ selector: "&:not([open])", values:
|
|
85
|
-
{ selector: "&[open]", values:
|
|
113
|
+
{ selector: "&:not([open])", values: away, condition: null },
|
|
114
|
+
{ selector: "&[open]", values: away, condition: STARTING },
|
|
86
115
|
{ selector: "&::backdrop", values: transition("opacity", motion), condition: null },
|
|
87
116
|
{ selector: "&:not([open])::backdrop", values: { opacity: "0" }, condition: null },
|
|
88
117
|
{ selector: "&[open]::backdrop", values: { opacity: "0" }, condition: STARTING },
|
|
@@ -91,8 +120,12 @@ function cardRules(sheet, veil, own, motion, margin) {
|
|
|
91
120
|
]
|
|
92
121
|
};
|
|
93
122
|
}
|
|
123
|
+
function blockCap(room, own) {
|
|
124
|
+
const frameCap = own["max-block-size"];
|
|
125
|
+
return frameCap === void 0 ? room : `min(${frameCap}, ${room})`;
|
|
126
|
+
}
|
|
94
127
|
function inlineCap(margin, own) {
|
|
95
|
-
const cap = `calc(
|
|
128
|
+
const cap = `calc(100% - ${margin} * 2)`, frameCap = own["max-inline-size"];
|
|
96
129
|
return frameCap === void 0 ? cap : `min(${frameCap}, ${cap})`;
|
|
97
130
|
}
|
|
98
131
|
function fade(kind, placement, motion, enabled, drop = null) {
|
|
@@ -115,8 +148,9 @@ function measuredPopoverRules(popover, margin, own, motion, drop) {
|
|
|
115
148
|
"inset-block-end": "auto",
|
|
116
149
|
"inset-inline-start": "auto",
|
|
117
150
|
"inset-inline-end": "auto",
|
|
118
|
-
"max-block-size": `calc(100dvh - ${margin} * 2)`,
|
|
119
|
-
"max-inline-size": inlineCap(margin, own)
|
|
151
|
+
"max-block-size": blockCap(`calc(100dvh - ${margin} * 2)`, own),
|
|
152
|
+
"max-inline-size": inlineCap(margin, own),
|
|
153
|
+
"min-inline-size": "0"
|
|
120
154
|
};
|
|
121
155
|
return fade("measured-popover", placement, motion, popover.motion !== null, drop);
|
|
122
156
|
}
|
|
@@ -127,15 +161,16 @@ function popoverRules(popover, layout, own, motion, drop) {
|
|
|
127
161
|
"inset-block-end": popover.corner.block === "end" ? gap : "auto",
|
|
128
162
|
"inset-inline-start": popover.corner.inline === "start" ? margin : "auto",
|
|
129
163
|
"inset-inline-end": popover.corner.inline === "end" ? margin : "auto",
|
|
130
|
-
"max-block-size": clear === null ? `calc(100dvh - ${gap} * 2)` : `calc(100dvh - ${clear} - ${gap} * 2)`,
|
|
131
|
-
"max-inline-size": inlineCap(margin, own)
|
|
164
|
+
"max-block-size": blockCap(clear === null ? `calc(100dvh - ${gap} * 2)` : `calc(100dvh - ${clear} - ${gap} * 2)`, own),
|
|
165
|
+
"max-inline-size": inlineCap(margin, own),
|
|
166
|
+
"min-inline-size": "0"
|
|
132
167
|
};
|
|
133
168
|
return fade("anchored-popover", placement, motion, popover.motion !== null, drop);
|
|
134
169
|
}
|
|
135
170
|
function variantRules(input, own) {
|
|
136
171
|
switch (input.kind) {
|
|
137
172
|
case "modal-sheet":
|
|
138
|
-
return sheetRules(input.sheet, input.backdrop, own, input.motion, input.margin);
|
|
173
|
+
return sheetRules(input.sheet, input.backdrop, own, input.motion, input.margin, input.drop ?? null);
|
|
139
174
|
case "anchored-popover":
|
|
140
175
|
return ok(popoverRules(input.popover, input.placement, own, input.motion, input.drop ?? null));
|
|
141
176
|
case "measured-popover":
|
package/dist/lowering-paint.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { err, ok } from "./result.mjs";
|
|
2
|
-
const SLOT = /^[a-z][a-z0-9-]*$/, TOKEN = /^--[a-z][a-z0-9-]*$/, PART = /^\.[a-z][\w-]*$/i;
|
|
2
|
+
const SLOT = /^[a-z][a-z0-9-]*$/, TOKEN = /^--[a-z][a-z0-9-]*$/, PART = /^\.[a-z][\w-]*(?: > \.[a-z][\w-]*)*$/i;
|
|
3
3
|
export const channelProperty = (slot) => `--asset-${slot}`;
|
|
4
4
|
export function paintChannels(part, slots) {
|
|
5
5
|
if (!PART.test(part))
|
|
@@ -152,6 +152,10 @@ export function extentValues(extent, parent, part, parentGrows = !1, parentWraps
|
|
|
152
152
|
switch (extent.kind) {
|
|
153
153
|
case "content":
|
|
154
154
|
return ok({});
|
|
155
|
+
case "grow":
|
|
156
|
+
if (parent !== "stack" && parent !== "inline")
|
|
157
|
+
return err({ kind: "extent-parent-unsupported", part, layout: parent });
|
|
158
|
+
return ok({ "flex-grow": "1", "flex-shrink": "1", "flex-basis": "auto" });
|
|
155
159
|
case "fill": {
|
|
156
160
|
if (parent === "native" && arranged && extent.axis !== "both")
|
|
157
161
|
return ok({});
|
|
@@ -207,6 +211,7 @@ export function elementNormalization(element, values) {
|
|
|
207
211
|
}
|
|
208
212
|
case "select":
|
|
209
213
|
case "input":
|
|
214
|
+
case "textarea":
|
|
210
215
|
return plain({ margin: "0" });
|
|
211
216
|
case "table":
|
|
212
217
|
return plain({ "border-collapse": "collapse" });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keyframesName } from "./lowering-motion.mjs";
|
|
2
2
|
import { err, ok } from "./result.mjs";
|
|
3
|
-
export const SEQUENCE_REPEATS = ["loop", "alternate", "once"], STEP_FIELDS = {
|
|
3
|
+
export const SEQUENCE_REPEATS = ["loop", "restart", "alternate", "once"], STEP_FIELDS = {
|
|
4
4
|
opacity: "opacity",
|
|
5
5
|
"translate-inline": "translate",
|
|
6
6
|
"translate-block": "translate",
|
|
@@ -52,7 +52,8 @@ export function sequenceRules(input) {
|
|
|
52
52
|
if (field !== void 0)
|
|
53
53
|
return err({ kind: "sequence-not-seamless", profile, field });
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
const orderVar = input.orderVar ?? null;
|
|
56
|
+
if ((order > 0 || orderVar !== null) && input.stagger === null)
|
|
56
57
|
return err({ kind: "sequence-stagger-missing", profile });
|
|
57
58
|
const framesOf = (mirrored) => {
|
|
58
59
|
const frames = [];
|
|
@@ -75,7 +76,7 @@ export function sequenceRules(input) {
|
|
|
75
76
|
"animation-iteration-count": repeat === "once" ? "1" : "infinite",
|
|
76
77
|
...repeat === "alternate" ? { "animation-direction": "alternate" } : {},
|
|
77
78
|
"animation-fill-mode": repeat === "once" ? "both" : "backwards",
|
|
78
|
-
...order > 0 && input.stagger !== null ? { "animation-delay": order === 1 ? input.stagger : `calc(${input.stagger} * ${order})` } : {},
|
|
79
|
+
...orderVar !== null && input.stagger !== null ? { "animation-delay": `calc(${input.stagger} * ${orderVar})` } : order > 0 && input.stagger !== null ? { "animation-delay": order === 1 ? input.stagger : `calc(${input.stagger} * ${order})` } : {},
|
|
79
80
|
...input.paused === !0 ? { "animation-play-state": "paused" } : {}
|
|
80
81
|
}, rules = [{ selector: under(condition, selector), values: animation, condition: null }];
|
|
81
82
|
if (steps.some((step) => step.values["translate-inline"] !== void 0)) {
|
|
@@ -18,9 +18,10 @@ export const MEASURED_PROPERTIES = {
|
|
|
18
18
|
"size-track": ["grid-template-columns", "grid-template-rows"],
|
|
19
19
|
position: ["object-position"],
|
|
20
20
|
"intrinsic-size": ["inline-size"],
|
|
21
|
-
share: ["slider-fill", "slider-step"]
|
|
21
|
+
share: ["slider-fill", "slider-step"],
|
|
22
|
+
index: ["sequence-order"]
|
|
22
23
|
};
|
|
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"];
|
|
24
|
+
const HOSTS = { length: "region", transform: "region", scale: "region", "size-track": "grid", position: "region", "intrinsic-size": "region", share: "region", index: "region" }, POSITIONS = ["inset-block-start", "inset-block-end", "inset-inline-start", "inset-inline-end", "translate"];
|
|
24
25
|
export const positions = (property) => POSITIONS.includes(property), measuredProperty = (scope, name) => privateProperty(scope, "measured", name);
|
|
25
26
|
function initialValue(property) {
|
|
26
27
|
if (property === "translate" || property === "scale")
|
|
@@ -44,6 +45,7 @@ export function measuredFallback(value, own) {
|
|
|
44
45
|
case "intrinsic-size":
|
|
45
46
|
return own ?? "auto";
|
|
46
47
|
case "share":
|
|
48
|
+
case "index":
|
|
47
49
|
return "0";
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -64,6 +66,8 @@ export function measuredWrites(scope, values, element, own, supplied, media = nu
|
|
|
64
66
|
return checked;
|
|
65
67
|
if (value.type === "position" && media !== "cover")
|
|
66
68
|
return err({ kind: "measured-property-unsupported", element, name: value.name, property: value.property, type: value.type, reason: "cover-missing" });
|
|
69
|
+
if (value.type === "index")
|
|
70
|
+
continue;
|
|
67
71
|
if (value.type === "share") {
|
|
68
72
|
const reason = value.property === "slider-fill" ? slider.fill ? null : "fill-missing" : slider.steps ? null : "steps-missing";
|
|
69
73
|
if (reason !== null)
|
|
@@ -143,6 +147,7 @@ function valueType(value) {
|
|
|
143
147
|
case "length":
|
|
144
148
|
case "size-track":
|
|
145
149
|
case "share":
|
|
150
|
+
case "index":
|
|
146
151
|
return "number";
|
|
147
152
|
}
|
|
148
153
|
}
|
|
@@ -161,6 +166,7 @@ function written(value) {
|
|
|
161
166
|
case "size-track":
|
|
162
167
|
return `\`\${${read}}px\``;
|
|
163
168
|
case "share":
|
|
169
|
+
case "index":
|
|
164
170
|
return `\`\${${read}}\``;
|
|
165
171
|
}
|
|
166
172
|
}
|
|
@@ -43,6 +43,7 @@ export const OWNER_REVIEW_RULE = "owner-analysis-review";
|
|
|
43
43
|
const ACCESSIBILITY_RULES = new Map([
|
|
44
44
|
["source/intrinsic-alt-missing", "a11y-image-alt"],
|
|
45
45
|
["source/image-alt-missing", "a11y-image-alt"],
|
|
46
|
+
["source/invalid-nesting", "a11y-nesting"],
|
|
46
47
|
["source/control-name-missing", "a11y-icon-label"],
|
|
47
48
|
["construction/target-size-below-minimum", "a11y-target-size"],
|
|
48
49
|
["construction/target-area-overlap", "a11y-target-size"],
|
package/dist/owner-errors.mjs
CHANGED
|
@@ -122,6 +122,7 @@ export function constructionError(failure) {
|
|
|
122
122
|
case "artwork-group-unknown":
|
|
123
123
|
case "text-anchor-unsupported":
|
|
124
124
|
case "artwork-group-draw-length":
|
|
125
|
+
case "sequence-order-unmeasured":
|
|
125
126
|
case "slider-fill-unsupported":
|
|
126
127
|
case "slider-steps-unsupported":
|
|
127
128
|
case "scheme-unsupported":
|
package/dist/ownership-model.mjs
CHANGED
|
@@ -70,7 +70,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
70
70
|
along: (value) => /^[a-z][\w-]*$/i.test(value),
|
|
71
71
|
lines: oneOf("2", "3"),
|
|
72
72
|
overflow: OVERFLOW,
|
|
73
|
-
extent: oneOf("fill", "fill-both"),
|
|
73
|
+
extent: oneOf("fill", "fill-both", "grow"),
|
|
74
74
|
element: ELEMENT,
|
|
75
75
|
marker: oneOf("native", "none"),
|
|
76
76
|
media: oneOf("inspected-svg"),
|
|
@@ -131,19 +131,19 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
131
131
|
"ads-content": { counter: () => !0, counters: () => !0, style: () => !0, separator: () => !0, prefix: () => !0, suffix: () => !0 },
|
|
132
132
|
"ads-accessibility": { boundary: () => !0, reason: () => !0 },
|
|
133
133
|
"ads-focus": { of: () => !0, "shown-by": oneOf("container"), within: (value) => /^\.[A-Za-z_][\w-]*$/.test(value) },
|
|
134
|
-
"ads-play": { sequence: binding, order: (value) => /^(?:[0-9]|[12][0-9]|3[0-2])$/.test(value), paused: oneOf("true", "false") },
|
|
134
|
+
"ads-play": { sequence: binding, order: (value) => /^(?:[0-9]|[12][0-9]|3[0-2])$/.test(value), "order-by": (value) => /^[a-z][A-Za-z0-9]*$/.test(value), paused: oneOf("true", "false") },
|
|
135
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") },
|
|
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", "baseline"), size: (value) => /^\d+(\.\d+)?$/.test(value) },
|
|
137
137
|
"ads-outset": { block: outsetSpacing, inline: outsetSpacing },
|
|
138
138
|
"ads-sticky": { edge: oneOf("block-start", "block-end", "inline-start", "inline-end"), clear: oneOf("none", "block-start") },
|
|
139
139
|
"ads-flow": { edges: oneOf("trim") },
|
|
140
140
|
"ads-snap": { type: oneOf(...SNAP_TYPES), align: oneOf(...SNAP_ALIGNS) },
|
|
141
141
|
"ads-layer": {
|
|
142
142
|
element: oneOf("dialog", "popover"),
|
|
143
|
-
edge: oneOf("start", "end", "center", "block-start"),
|
|
143
|
+
edge: oneOf("start", "end", "center", "block-start", "fill"),
|
|
144
144
|
"backdrop-surface": binding,
|
|
145
145
|
"backdrop-dismiss": oneOf("press", "none"),
|
|
146
|
-
motion: oneOf("slide", "fade", "drop"),
|
|
146
|
+
motion: oneOf("slide", "fade", "drop", "veil"),
|
|
147
147
|
"modal-below": (value) => identifier.test(value),
|
|
148
148
|
popover: oneOf("auto", "manual"),
|
|
149
149
|
"corner-block": oneOf("start", "end"),
|
package/dist/recipe-macro.d.mts
CHANGED
|
@@ -68,7 +68,7 @@ export type Frame = "control" | "container" | {
|
|
|
68
68
|
/** A side of a frame by its logical name. */
|
|
69
69
|
export type SafeAreaSide = "block-start" | "block-end" | "inline-start" | "inline-end";
|
|
70
70
|
/** The pointer cursors an element may show: a closed set, no image cursors. */
|
|
71
|
-
export type Cursor = "pointer" | "default" | "grab" | "grabbing" | "col-resize" | "row-resize" | "move" | "text" | "not-allowed";
|
|
71
|
+
export type Cursor = "pointer" | "default" | "grab" | "grabbing" | "col-resize" | "row-resize" | "move" | "text" | "not-allowed" | "zoom-in" | "zoom-out";
|
|
72
72
|
/** The touch gestures an element leaves to the browser: none (the owner handles them all), or panning on one axis. */
|
|
73
73
|
export type TouchAction = "none" | "pan-x" | "pan-y";
|
|
74
74
|
interface NativeNormalization {
|
|
@@ -99,7 +99,7 @@ export interface SnapDeclaration {
|
|
|
99
99
|
/** Content beyond the element's box: clipped, or scrolled on the block axis, the inline axis or both. */
|
|
100
100
|
export type Overflow = "clip" | "scroll-block" | "scroll-inline" | "scroll-both";
|
|
101
101
|
/** A native element the region or part renders, for its closed normalization. */
|
|
102
|
-
export type NativeElement = "iframe" | "select" | "search-input" | "text-input" | "table" | "header-cell" | "cell" | "list" | "summary" | "document";
|
|
102
|
+
export type NativeElement = "iframe" | "select" | "search-input" | "text-input" | "textarea" | "table" | "header-cell" | "cell" | "list" | "summary" | "document";
|
|
103
103
|
/** A paint a surface treatment can transition. */
|
|
104
104
|
export type PaintChannel = "background-color" | "border-color" | "color" | "text-decoration-color" | "box-shadow" | "filter" | "backdrop-filter" | "opacity";
|
|
105
105
|
/** Paint channels of one element that change between its state surfaces, timed by a motion profile. */
|
|
@@ -191,14 +191,14 @@ export type LayerDeclaration = {
|
|
|
191
191
|
* A sheet attached to an inline edge (`start`, `end`), or a card: `center` in the viewport, or `block-start`
|
|
192
192
|
* (centred inline, below the top). A card keeps the layer profile's `viewportMargin` from the viewport edges.
|
|
193
193
|
*/
|
|
194
|
-
readonly edge: "start" | "end" | "center" | "block-start";
|
|
194
|
+
readonly edge: "start" | "end" | "center" | "block-start" | "fill";
|
|
195
195
|
/** The backdrop's surface: its `background`, and optionally its `backdropBlur` (the page behind, blurred). */
|
|
196
196
|
readonly backdrop: {
|
|
197
197
|
readonly surface: string;
|
|
198
198
|
readonly dismiss?: "press" | "none";
|
|
199
199
|
};
|
|
200
200
|
/** A sheet slides in from its edge; a card fades in. */
|
|
201
|
-
readonly motion?: "slide" | "fade";
|
|
201
|
+
readonly motion?: "slide" | "fade" | "drop" | "veil";
|
|
202
202
|
/** A breakpoint tier of the recipe's spatial profile; the recipe's `modalQuery` is the range below it. */
|
|
203
203
|
readonly modalBelow?: string;
|
|
204
204
|
} | {
|
|
@@ -272,6 +272,11 @@ export type MeasuredDeclaration = {
|
|
|
272
272
|
| {
|
|
273
273
|
readonly type: "share";
|
|
274
274
|
readonly property: "slider-fill" | "slider-step";
|
|
275
|
+
}
|
|
276
|
+
/** An instance's place among its siblings (0, 1, 2…), which a sequence's stagger multiplies (`play.orderBy`). */
|
|
277
|
+
| {
|
|
278
|
+
readonly type: "index";
|
|
279
|
+
readonly property: "sequence-order";
|
|
275
280
|
};
|
|
276
281
|
/** Measured values by name: a camelCase name per value, unique within the recipe. */
|
|
277
282
|
export type MeasuredDeclarations = Readonly<Record<string, MeasuredDeclaration>>;
|
|
@@ -327,7 +332,7 @@ export interface RecipeSpec {
|
|
|
327
332
|
* part: `"fill"` takes the room an inline control's other content leaves, so a visual after it stands at the far end.
|
|
328
333
|
* Root of an `inline` row: `"container"` takes the container's width, `"content"` (the default) is as wide as its content.
|
|
329
334
|
*/
|
|
330
|
-
readonly extent?: "fill" | "fill-both" | "content" | "container";
|
|
335
|
+
readonly extent?: "fill" | "fill-both" | "grow" | "content" | "container";
|
|
331
336
|
readonly element?: NativeElement;
|
|
332
337
|
/** A summary's disclosure marker. */
|
|
333
338
|
readonly marker?: "native" | "none";
|
|
@@ -489,7 +494,9 @@ export interface RecipeSpec {
|
|
|
489
494
|
*/
|
|
490
495
|
readonly play?: {
|
|
491
496
|
readonly sequence: string;
|
|
492
|
-
readonly order?: number;
|
|
497
|
+
readonly order?: number; /** A measured `index` the owner writes on each instance: it starts that many staggers late. */
|
|
498
|
+
readonly orderBy?: string;
|
|
499
|
+
readonly paused?: boolean;
|
|
493
500
|
};
|
|
494
501
|
/**
|
|
495
502
|
* The root or part stays at an edge of its scrolling container while the rest scrolls. `clear:
|
package/dist/recipe-model.mjs
CHANGED
|
@@ -128,13 +128,13 @@ function body(node, spec) {
|
|
|
128
128
|
if (spec.sticky !== void 0)
|
|
129
129
|
clause(node, "ads-sticky", "", only(spec.sticky, ["edge", "clear"]));
|
|
130
130
|
if (spec.anchor !== void 0)
|
|
131
|
-
clause(node, "ads-anchor", "", only(spec.anchor, ["artwork", "x", "y", "inline", "block"]));
|
|
131
|
+
clause(node, "ads-anchor", "", only(spec.anchor, ["artwork", "x", "y", "inline", "block", "size"]));
|
|
132
132
|
if (spec.outset !== void 0)
|
|
133
133
|
clause(node, "ads-outset", "", only(spec.outset, ["block", "inline"]));
|
|
134
134
|
if (spec.focus !== void 0)
|
|
135
135
|
clause(node, "ads-focus", "", only(spec.focus, ["of", "shownBy", "within"]));
|
|
136
136
|
if (spec.play !== void 0)
|
|
137
|
-
clause(node, "ads-play", "", only(spec.play, ["sequence", "order", "paused"]));
|
|
137
|
+
clause(node, "ads-play", "", only(spec.play, ["sequence", "order", "orderBy", "paused"]));
|
|
138
138
|
if (spec.flow !== void 0)
|
|
139
139
|
clause(node, "ads-flow", "", only(spec.flow, ["edges"]));
|
|
140
140
|
if (spec.counter !== void 0)
|
package/dist/region-lowering.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BORDER_STYLE, compositeSlot } from "./role-vocabulary.mjs";
|
|
2
|
-
import { PART_EFFECTS, normalizedDeclarations, scaleValue } from "./construction-spec.mjs";
|
|
2
|
+
import { PART_EFFECTS, declaredMeasured, normalizedDeclarations, scaleValue } from "./construction-spec.mjs";
|
|
3
3
|
import {
|
|
4
4
|
coverArtwork,
|
|
5
5
|
decorationArtwork,
|
|
@@ -322,7 +322,7 @@ const REDUCED_MOTION_QUERY = ["media", "(prefers-reduced-motion: reduce)"];
|
|
|
322
322
|
function measuredMotion(measured, profile, reject) {
|
|
323
323
|
const groups = new Map;
|
|
324
324
|
for (const value of measured) {
|
|
325
|
-
if (value.type === "position" || value.type === "intrinsic-size" || value.type === "share" || value.motion === null)
|
|
325
|
+
if (value.type === "position" || value.type === "intrinsic-size" || value.type === "share" || value.type === "index" || value.motion === null)
|
|
326
326
|
continue;
|
|
327
327
|
groups.set(value.motion, [...groups.get(value.motion) ?? [], value.property]);
|
|
328
328
|
}
|
|
@@ -726,17 +726,26 @@ function writePartSpace(parts, parent, layout, gap, context, carry = !1) {
|
|
|
726
726
|
return context.reject({ kind: "space-parent-unsupported", part: first.part.name, layout });
|
|
727
727
|
if (layout === "native")
|
|
728
728
|
return;
|
|
729
|
-
const between = gap ?? "0px", margin = (space) => ({ "margin-block-start": `calc(${space} - ${between})` })
|
|
729
|
+
const between = gap ?? "0px", margin = (space) => ({ "margin-block-start": `calc(${space} - ${between})` }), shownIn = (part) => {
|
|
730
|
+
const [condition] = part.at, spatial = context.slots["spatial-profile"];
|
|
731
|
+
if (condition === void 0 || condition.visible === null || spatial === void 0)
|
|
732
|
+
return;
|
|
733
|
+
const bound = conditionBound(context.foundation, spatial, condition.condition, context.profile, context.reject);
|
|
734
|
+
if (bound === null)
|
|
735
|
+
return;
|
|
736
|
+
const queries = conditionQueries(bound);
|
|
737
|
+
return ["media", condition.visible ? queries.inside : queries.outside];
|
|
738
|
+
};
|
|
730
739
|
for (const { part, before, after } of spaced) {
|
|
731
740
|
if (before !== null)
|
|
732
741
|
out.rule(`${parent} > * + ${part.selector}:not(:first-child)`, margin(before));
|
|
733
742
|
if (after !== null)
|
|
734
|
-
out.rule(`${parent} > ${part.selector} + :not(:first-child):not(:first-child)`, margin(after));
|
|
743
|
+
out.rule(`${parent} > ${part.selector} + :not(:first-child):not(:first-child)`, margin(after), shownIn(part));
|
|
735
744
|
}
|
|
736
745
|
for (const previous of spaced)
|
|
737
746
|
for (const next of spaced)
|
|
738
747
|
if (previous.after !== null && next.before !== null)
|
|
739
|
-
out.rule(`${parent} > ${previous.part.selector} + ${next.part.selector}:not(:first-child):not(:first-child)`, margin(`max(${previous.after}, ${next.before})`));
|
|
748
|
+
out.rule(`${parent} > ${previous.part.selector} + ${next.part.selector}:not(:first-child):not(:first-child)`, margin(`max(${previous.after}, ${next.before})`), shownIn(previous.part));
|
|
740
749
|
if (carry && parent === "&") {
|
|
741
750
|
out.own(FLOW_GAP);
|
|
742
751
|
for (const { part, after } of spaced)
|
|
@@ -817,16 +826,20 @@ function stageValues(parts, values, context) {
|
|
|
817
826
|
return {};
|
|
818
827
|
if (values["aspect-ratio"] !== void 0 || values["block-size"] !== void 0)
|
|
819
828
|
return context.reject({ kind: "text-anchor-unsupported", part: parts.find((part) => part.anchor !== null)?.name ?? "", reason: "sized" });
|
|
820
|
-
|
|
829
|
+
const sized = parts.some((part) => part.anchor !== null && part.anchor.size !== null);
|
|
830
|
+
return { "aspect-ratio": `${box[2]} / ${box[3]}`, ...sized ? { "container-type": "inline-size" } : {} };
|
|
821
831
|
}
|
|
832
|
+
const anchoredSizes = new WeakMap;
|
|
822
833
|
function writeAnchoredLabels(parts, parent, context) {
|
|
823
834
|
const box = stageOf(parts, context);
|
|
824
835
|
if (box === null)
|
|
825
836
|
return;
|
|
826
|
-
const [bx, by, bw, bh] = box, shift = { start: "0%", center: "-50%", end: "-100%" };
|
|
837
|
+
const [bx, by, bw, bh] = box, shift = { start: "0%", center: "-50%", end: "-100%", baseline: "-100%" };
|
|
827
838
|
for (const part of parts) {
|
|
828
839
|
if (part.anchor === null)
|
|
829
840
|
continue;
|
|
841
|
+
if (part.anchor.size !== null)
|
|
842
|
+
anchoredSizes.set(part, `calc(100cqi * ${Number((part.anchor.size / bw).toFixed(6))})`);
|
|
830
843
|
context.out.rule(`${parent} > ${part.selector}`, {
|
|
831
844
|
position: "absolute",
|
|
832
845
|
left: `${((part.anchor.x - bx) / bw * 100).toFixed(4)}%`,
|
|
@@ -915,7 +928,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
915
928
|
if (collapsible) {
|
|
916
929
|
if (axis === null)
|
|
917
930
|
return reject({ kind: "state-geometry-unsupported", element: part.name, reason: "collapsed-parent", detail: parentLayout });
|
|
918
|
-
const own = part.box !== null || part.frame !== null ? "a frame" : part.arrangement !== null ? "an arrangement" : part.overflow.kind !== "visible" ? "an overflow" : part.extent.kind
|
|
931
|
+
const own = part.box !== null || part.frame !== null ? "a frame" : part.arrangement !== null ? "an arrangement" : part.overflow.kind !== "visible" ? "an overflow" : part.extent.kind !== "content" ? "a filling extent" : null;
|
|
919
932
|
if (own !== null)
|
|
920
933
|
return reject({ kind: "state-geometry-unsupported", element: part.name, reason: "collapsed-box", detail: own });
|
|
921
934
|
}
|
|
@@ -945,7 +958,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
945
958
|
...overlapping === null || overlapping.group === null || partGeometry.group?.properties.includes(overlapping.property) === !0 ? [] : [overlapping.group]
|
|
946
959
|
], moved = part.effects === null ? [] : [...new Set(part.effects.when.flatMap(([, names]) => names.map((name) => PART_EFFECTS[name].channel)))], entering = writeEnter(out, profile, path, part.enter, partSurface, stateSurfaces(path, part.when, profile), slots, [...transitioned(part.paintTransition, partGroups), ...moved], reject);
|
|
947
960
|
transitionRules(path, part.paintTransition, part.surface === null ? null : { name: part.surface, fields: partSurface }, part.when, context, entering === null ? partGroups : [...partGroups, entering.group]);
|
|
948
|
-
writePlays(out, profile, context.foundation, part.name, part.plays, path, [...transitioned(part.paintTransition, entering === null ? [] : [entering.group]), ...moved], reject);
|
|
961
|
+
writePlays(out, profile, context.foundation, part.name, part.plays, path, [...transitioned(part.paintTransition, entering === null ? [] : [entering.group]), ...moved], reject, { scope: context.input.scope, values: context.measured ?? [] });
|
|
949
962
|
const values = part.arrangement === null ? {} : { "box-sizing": "border-box", "min-inline-size": "0", ...arrangementValues(part.arrangement, slots, profile, part.overflow) };
|
|
950
963
|
if (parentLayout === "native" && part.arrangement?.layout === "inline" && (Object.keys(flowSpace(part, context)).length > 0 || part.extent.kind === "fill")) {
|
|
951
964
|
values.display = "flex";
|
|
@@ -958,9 +971,18 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
958
971
|
checked(checkLayers(part.name, part.parts.length), reject);
|
|
959
972
|
const text = part.text !== null ? textOf(part.text, slots, profile) : part.content.kind === "text" && slots["text-profile"] !== void 0 ? profile.of(slots["text-profile"], "text") : {};
|
|
960
973
|
Object.assign(values, text);
|
|
974
|
+
const scaled = anchoredSizes.get(part);
|
|
975
|
+
if (scaled !== void 0) {
|
|
976
|
+
const floor = text["font-size"];
|
|
977
|
+
if (floor === void 0)
|
|
978
|
+
return reject({ kind: "text-anchor-unsupported", part: part.name, reason: "size" });
|
|
979
|
+
values["font-size"] = `max(${floor}, ${scaled})`;
|
|
980
|
+
}
|
|
961
981
|
writeStateText(out, profile, part.name, text, part.textWhen, (condition) => under(condition, path), reject);
|
|
962
982
|
if (part.textEdge.length > 0)
|
|
963
983
|
Object.assign(values, { "text-box-trim": "trim-both", "text-box-edge": part.textEdge.join(" ") });
|
|
984
|
+
if (part.anchor?.block === "baseline")
|
|
985
|
+
Object.assign(values, { "text-box-trim": "trim-end", "text-box-edge": "auto alphabetic" });
|
|
964
986
|
checkSurfaceEffects(context.foundation, profile, [part.surface, ...part.when.map(([, name]) => name)], part.content.kind === "visual" ? "visual" : part.overflow.kind === "scroll" ? "scroller" : "container", reject);
|
|
965
987
|
if (part.surface !== null)
|
|
966
988
|
Object.assign(values, settled(partSurface, entering?.blurred ?? !1));
|
|
@@ -981,7 +1003,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
981
1003
|
let target = null, frameFields = {};
|
|
982
1004
|
if (part.frame !== null) {
|
|
983
1005
|
const lineText = text["line-height"] === void 0 && slots["text-profile"] !== void 0 ? profile.of(slots["text-profile"], "text") : text, lineHeight = profile.field(lineText, "text", "line-height"), frame = profile.of(slots["frame-profile"], "frame", "control"), box = controlBox(frame, LINE_BOX, profile.field, reject);
|
|
984
|
-
frameFields = controlBoxValues(box);
|
|
1006
|
+
frameFields = part.element?.kind === "textarea" ? { ...controlBoxValues(box), "min-block-size": frame["min-block-size"] ?? box.minBlockSize, "padding-block-start": box.insets.blockStart, "padding-block-end": box.insets.blockEnd } : controlBoxValues(box);
|
|
985
1007
|
if (part.frame.border.kind === "rules") {
|
|
986
1008
|
const paint = part.surface === null ? void 0 : profile.of(part.surface, "surface")["border-color"], rules = checked(frameRules(part.frame.border, frame["border-width"], { surface: part.surface, color: paint }, slots["frame-profile"] ?? null, frame[BORDER_STYLE]), reject);
|
|
987
1009
|
for (const side of ["top", "right", "bottom", "left"]) {
|
|
@@ -1186,7 +1208,7 @@ function layerInput(layer, spec, root, slots, profile, foundation, reject) {
|
|
|
1186
1208
|
if (placing !== void 0)
|
|
1187
1209
|
return reject({ kind: "layer-frame-position", property: placing });
|
|
1188
1210
|
const motion = layer.motion === null ? null : transitionTiming(profile.of(slots["motion-profile"], "motion", "layer"), profile, reject), drop = () => {
|
|
1189
|
-
if (layer.
|
|
1211
|
+
if (layer.motion !== "drop")
|
|
1190
1212
|
return null;
|
|
1191
1213
|
const fields = profile.of(slots["motion-profile"], "motion", "layer");
|
|
1192
1214
|
return { distance: profile.field(fields, "motion", "distance"), scale: profile.field(fields, "motion", "scale") };
|
|
@@ -1194,8 +1216,11 @@ function layerInput(layer, spec, root, slots, profile, foundation, reject) {
|
|
|
1194
1216
|
switch (layer.kind) {
|
|
1195
1217
|
case "modal-sheet":
|
|
1196
1218
|
sheetQuery(layer, slots, profile, foundation, reject);
|
|
1197
|
-
const layerFields = layer.edge === "center" || layer.edge === "block-start" ? profile.of(slots["layer-profile"], "layer", "layer") : null
|
|
1198
|
-
|
|
1219
|
+
const layerFields = layer.edge === "center" || layer.edge === "block-start" ? profile.of(slots["layer-profile"], "layer", "layer") : null;
|
|
1220
|
+
if (layer.edge === "fill")
|
|
1221
|
+
return { kind: "modal-sheet", sheet: layer, backdrop: { name: layer.backdrop.surface, fields: profile.of(layer.backdrop.surface, "surface") }, root, motion, margin: { inline: "0px", block: "0px" }, drop: drop() };
|
|
1222
|
+
const inline = layerFields === null ? null : profile.field(layerFields, "layer", "viewport-margin"), margin = inline === null || layerFields === null ? null : { inline, block: layer.edge === "block-start" ? layerFields["edge-gap"] ?? inline : inline };
|
|
1223
|
+
return { kind: "modal-sheet", sheet: layer, backdrop: { name: layer.backdrop.surface, fields: profile.of(layer.backdrop.surface, "surface") }, root, motion, margin, drop: drop() };
|
|
1199
1224
|
case "measured-popover": {
|
|
1200
1225
|
const fields = profile.of(slots["layer-profile"], "layer", "layer");
|
|
1201
1226
|
profile.only(fields, "layer", ["clear-block-start", "edge-gap", "viewport-margin", "anchor-gap", "anchor-overlap", "anchor-outdent", "anchor-indent"]);
|
|
@@ -1254,7 +1279,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1254
1279
|
out.own(paintProperty(input.scope, paint.name));
|
|
1255
1280
|
for (const token of paintTokens(paints))
|
|
1256
1281
|
out.use(`var(${token})`);
|
|
1257
|
-
const placedArtwork = [], placedByPart = new Map, targets = [], neighbours = [], rootNormalized = new Map(spec.normalizeWhen.map(([selector, normalized]) => [selector, normalized.map(([property]) => property)])), coverBox = spec.frame !== null && (spec.frame.kind === "fields" && spec.frame.ratio !== null || slots["frame-profile"] !== void 0 && profile.of(slots["frame-profile"], "frame")["block-size"] !== void 0), placed = [], context = { out, profile, slots, input, reject, placedArtwork, placedByPart, foundation, targets, neighbours, placed, carry: spec.carry, rootNormalized, coverBox }, surface = slots["surface-profile"] ?? spec.surface;
|
|
1282
|
+
const placedArtwork = [], placedByPart = new Map, targets = [], neighbours = [], rootNormalized = new Map(spec.normalizeWhen.map(([selector, normalized]) => [selector, normalized.map(([property]) => property)])), coverBox = spec.frame !== null && (spec.frame.kind === "fields" && spec.frame.ratio !== null || slots["frame-profile"] !== void 0 && profile.of(slots["frame-profile"], "frame")["block-size"] !== void 0), placed = [], context = { out, profile, slots, input, reject, placedArtwork, placedByPart, foundation, targets, neighbours, placed, carry: spec.carry, rootNormalized, coverBox, measured: declaredMeasured(spec) }, surface = slots["surface-profile"] ?? spec.surface;
|
|
1258
1283
|
checkSurfaceEffects(foundation, profile, [slots["surface-profile"], spec.surface, ...spec.when.map(([, name]) => name)], spec.overflow.kind === "scroll" ? "scroller" : "container", reject);
|
|
1259
1284
|
const press = spec.press.when.length === 0 ? null : writeRootPress(out, spec.press, profile.of(slots["motion-profile"], "motion", spec.profile ?? "recipe"), profile, reject), rootSurface = surface === null ? {} : profile.of(surface, "surface"), restFramed = spec.frame === null || spec.frameAt === null || spec.frameAt.corners === null ? spec.frame : { ...spec.frame, corners: spec.frame.corners ?? FRAME_CORNERS }, rootGeometry = writeStateGeometry("&", "&", {
|
|
1260
1285
|
frame: restFramed === null ? null : regionFrameValues(restFramed, slots, surface, profile, reject).values,
|
|
@@ -1274,7 +1299,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1274
1299
|
out.rule(`& ${OVERLAPPED}`, { [rootGeometry.overlap.property]: rootGeometry.overlap.base });
|
|
1275
1300
|
const rootGroups = [...press === null ? [] : [press], ...measuredMotion(spec.measured, profile, reject), ...rootGeometry.group === null ? [] : [rootGeometry.group]], entering = writeEnter(out, profile, "&", spec.enter, rootSurface, stateSurfaces("&", spec.when, profile), slots, transitioned(spec.paintTransition, rootGroups), reject);
|
|
1276
1301
|
transitionRules("&", spec.paintTransition, surface === null ? null : { name: surface, fields: rootSurface }, spec.when, context, entering === null ? rootGroups : [...rootGroups, entering.group]);
|
|
1277
|
-
writePlays(out, profile, foundation, "&", spec.plays, "&", transitioned(spec.paintTransition, entering === null ? rootGroups : [...rootGroups, entering.group]), reject);
|
|
1302
|
+
writePlays(out, profile, foundation, "&", spec.plays, "&", transitioned(spec.paintTransition, entering === null ? rootGroups : [...rootGroups, entering.group]), reject, { scope: input.scope, values: declaredMeasured(spec) });
|
|
1278
1303
|
const rootFill = (name) => name === null ? null : profile.of(name, "surface").background ?? null;
|
|
1279
1304
|
pseudoRules("&", spec.pseudo, "&", [{ condition: null, value: rootFill(surface) }, ...spec.when.map(([condition, name]) => ({ condition, value: rootFill(name) }))], context, spec.frame !== null, spec.measured);
|
|
1280
1305
|
const rootCounters = counterValues(spec.counter);
|
|
@@ -1338,7 +1363,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1338
1363
|
} else {
|
|
1339
1364
|
const cap = values["max-inline-size"];
|
|
1340
1365
|
values["max-inline-size"] = cap === void 0 ? "100%" : `min(100%, ${cap})`;
|
|
1341
|
-
const filling = spec.parts.find((part) => part.extent.kind
|
|
1366
|
+
const filling = spec.parts.find((part) => part.extent.kind !== "content");
|
|
1342
1367
|
if (filling !== void 0 && !fixed)
|
|
1343
1368
|
return reject({ kind: "extent-row-hugs", part: filling.name });
|
|
1344
1369
|
}
|
|
@@ -1370,7 +1395,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1370
1395
|
if (placing !== void 0)
|
|
1371
1396
|
return reject({ kind: "measured-property-unsupported", element: "&", name: placing.name, property: placing.property, type: placing.type, reason: "layer-placement" });
|
|
1372
1397
|
const measured = anchorOffsets(layer.kind === "measured-popover" ? slots["layer-profile"] : void 0, checked(measuredWrites(input.scope, spec.measured, "&", layered.value.root, frameSupplied), reject), profile, reject);
|
|
1373
|
-
out.rule("&", { ...layered.value.root, ...measured, ...rootPaints });
|
|
1398
|
+
out.rule("&", { ...layered.value.root, ...measured, ...rootPaints, ...spec.layerOverscroll === !0 ? { "overscroll-behavior": "contain" } : {} });
|
|
1374
1399
|
for (const rule of layered.value.rules)
|
|
1375
1400
|
out.rule(rule.selector, { ...rule.values }, rule.condition ?? void 0);
|
|
1376
1401
|
for (const rule of layered.value.documents)
|