@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/ads-errors.mjs
CHANGED
|
@@ -677,6 +677,20 @@ export const choiceErrors = {
|
|
|
677
677
|
message: (failure) => `Part "${failure.part}" declares \`resize\` but is rendered as <${failure.element}>.`,
|
|
678
678
|
repair: "Declare `resize` on the part rendered as `<textarea>`, or remove it."
|
|
679
679
|
},
|
|
680
|
+
"drawing-read-unbound": {
|
|
681
|
+
group: "structure-mismatch",
|
|
682
|
+
rule: "A recipe's drawing (`recipe.assets.<part>.source`) is read in the markup of the owner's element that is the part, where ADS inlines the drawing's source. Elsewhere (a helper function that renders markup ADS does not match to the owner) it cannot be inlined, and the emitted owner would read an emptied recipe.",
|
|
683
|
+
guides: [RECIPES],
|
|
684
|
+
message: (failure) => `${failure.name} is read where ADS cannot match it to the element of the part that shows it; the emitted owner would read an emptied recipe.`,
|
|
685
|
+
repair: "Render the element that shows the drawing in the owner's own markup (the function whose markup holds the recipe's root), or give the helper's markup its own recipe root."
|
|
686
|
+
},
|
|
687
|
+
"textarea-element-missing": {
|
|
688
|
+
group: "structure-mismatch",
|
|
689
|
+
rule: 'A control frame centres a single line in its minimum height. A multi-line field declares `element: "textarea"`, so its frame keeps the stated insets around its lines instead.',
|
|
690
|
+
guides: [RECIPES],
|
|
691
|
+
message: (failure) => `Part "${failure.part}" is rendered as <textarea> with a control frame but does not declare element: "textarea"; its first line would be centred in the field.`,
|
|
692
|
+
repair: 'Declare `element: "textarea"` on the part.'
|
|
693
|
+
},
|
|
680
694
|
"decoration-exposed": {
|
|
681
695
|
group: "accessibility-semantics",
|
|
682
696
|
rule: 'A decoration (`kind: "decoration"`) carries no meaning: its element is `aria-hidden="true"` and holds nothing a person can use. ADS writes it behind its parent\'s content and lets the pointer through.',
|
|
@@ -859,6 +873,13 @@ export const choiceErrors = {
|
|
|
859
873
|
message: (failure) => `The ${failure.scheme} image of part "${failure.part}" is not always loading="lazy"; the default theme is ${failure.defaultScheme}, so this file would be downloaded while hidden.`,
|
|
860
874
|
repair: 'Write `loading="lazy"` on that image as a literal and apply any priority (eager loading, `fetchPriority`) to the default scheme\'s image only.'
|
|
861
875
|
},
|
|
876
|
+
"invalid-nesting": {
|
|
877
|
+
group: "accessibility-semantics",
|
|
878
|
+
rule: "An owner's markup follows HTML's content model: an element that takes phrasing content only (a span, a paragraph, a button, a label, a heading) holds no flow content (a div, a list, a paragraph, a heading); a link or a button holds no other link, button or form control; a list item sits in a list, a table row in a table, a cell in a row. A transparent element (a link) takes its parent's model. Browsers repair such markup differently, and assistive technology reads what they repaired.",
|
|
879
|
+
guides: ["ads://guides/accessibility"],
|
|
880
|
+
message: (failure) => failure.rule === "phrasing" ? `<${failure.element}> is flow content inside <${failure.parent}>, which holds phrasing content only.` : failure.rule === "interactive" ? `<${failure.element}> is interactive content inside <${failure.parent}>: one press would reach two targets.` : `<${failure.element}> sits in <${failure.parent}>; it belongs in ${failure.expected.map((name) => `<${name}>`).join(" or ")}.`,
|
|
881
|
+
repair: "Use an element whose content model fits: a <div> (or a list item) for a box that holds blocks, a <span> inside phrasing content; move the second control out of the link or button beside it; put list items in a list and cells in a row."
|
|
882
|
+
},
|
|
862
883
|
"image-alt-missing": {
|
|
863
884
|
group: "accessibility-semantics",
|
|
864
885
|
rule: "Every `<img>` an owner renders states its text alternative (WCAG 2.2 1.1.1): content media and any other image, as artwork images do; decorative images state it as empty.",
|
|
@@ -1104,10 +1125,10 @@ export const constructionErrors = {
|
|
|
1104
1125
|
},
|
|
1105
1126
|
"sequence-not-seamless": {
|
|
1106
1127
|
group: "wrong-value",
|
|
1107
|
-
rule: 'A looping sequence ends where it starts: its step at 100 states the same values as its step at 0, so the loop has no jump. A sequence that should run forward then backward declares `repeat: "alternate"`; one that plays one time declares `repeat: "once"`.',
|
|
1128
|
+
rule: 'A looping sequence ends where it starts: its step at 100 states the same values as its step at 0, so the loop has no jump. A sequence that should run forward then backward declares `repeat: "alternate"`; one that starts over from its first step by design (a pulse that grows and fades out) declares `repeat: "restart"`; one that plays one time declares `repeat: "once"`.',
|
|
1108
1129
|
guides: [RECIPES],
|
|
1109
1130
|
message: (failure) => `Sequence ${failure.profile} loops, but its last step differs from its first in ${failure.field}: the loop would jump.`,
|
|
1110
|
-
repair: 'Make the step at 100 state the values of the step at 0, or declare `repeat: "alternate"` or `repeat: "once"` in the profile.'
|
|
1131
|
+
repair: 'Make the step at 100 state the values of the step at 0, or declare `repeat: "restart"` (a pulse that starts over), `repeat: "alternate"` or `repeat: "once"` in the profile.'
|
|
1111
1132
|
},
|
|
1112
1133
|
"sequence-step-field": {
|
|
1113
1134
|
group: "wrong-value",
|
|
@@ -1134,9 +1155,16 @@ export const constructionErrors = {
|
|
|
1134
1155
|
group: "structure-mismatch",
|
|
1135
1156
|
rule: "A text part placed on a drawing (`anchor: { artwork, x, y }`) names a sibling decoration whose artwork is the drawing: their parent is sized to the drawing (its viewBox ratio), so the drawing fills it and a point of the drawing is a share of the parent's box. One parent places labels on one drawing, and states no block size or ratio of its own.",
|
|
1136
1157
|
guides: [RECIPES],
|
|
1137
|
-
message: (failure) => failure.reason === "artwork" ? `Text part ${failure.part} is anchored to a part that is not a sibling decoration with artwork.` : failure.reason === "several" ? `Text part ${failure.part} is anchored to another drawing than its siblings: one parent is sized to one drawing.` : `Text part ${failure.part} is anchored to a drawing, but its parent already states a block size or ratio.`,
|
|
1158
|
+
message: (failure) => failure.reason === "artwork" ? `Text part ${failure.part} is anchored to a part that is not a sibling decoration with artwork.` : failure.reason === "several" ? `Text part ${failure.part} is anchored to another drawing than its siblings: one parent is sized to one drawing.` : failure.reason === "size" ? `Text part ${failure.part} is sized in its drawing's units, but its text profile states no font size to keep as its smallest.` : `Text part ${failure.part} is anchored to a drawing, but its parent already states a block size or ratio.`,
|
|
1138
1159
|
repair: 'Anchor labels to a `kind: "decoration"` sibling that binds the drawing, all to the same one, and leave the parent\'s height to the drawing.'
|
|
1139
1160
|
},
|
|
1161
|
+
"sequence-order-unmeasured": {
|
|
1162
|
+
group: "structure-mismatch",
|
|
1163
|
+
rule: 'A sequence staggered by a measured index (`play: { sequence, orderBy: "<name>" }`, a title\'s words rising in turn) reads a measured value of the recipe of type `index` (`{ type: "index", property: "sequence-order" }`), which the owner writes on each instance at render: 0, 1, 2\u2026',
|
|
1164
|
+
guides: [RECIPES],
|
|
1165
|
+
message: (failure) => `Part ${failure.part} staggers its sequence by ${failure.name}, which is not a measured index of the recipe.`,
|
|
1166
|
+
repair: 'Declare `measured: { <name>: { type: "index", property: "sequence-order" } }` on the recipe and write each instance\'s index with `measured.props({ <name>: i })`.'
|
|
1167
|
+
},
|
|
1140
1168
|
"slider-fill-unsupported": {
|
|
1141
1169
|
group: "structure-mismatch",
|
|
1142
1170
|
rule: 'A slider\'s fill (`pseudo.sliderFill`) is drawn on its track up to the thumb: the element draws its track (`sliderTrack`), whose size and radius the fill takes, and declares a measured share (`{ type: "share", property: "slider-fill" }`) the owner writes as the value\'s place in its range, 0 to 1. Firefox draws the fill natively; other engines paint the track up to the share.',
|
|
@@ -2168,6 +2196,15 @@ export const runtimeErrors = {
|
|
|
2168
2196
|
emitters: ["src/owner-analysis-check.mts"],
|
|
2169
2197
|
situations: "owner-analysis errors with code source/intrinsic-alt-missing (an artwork image) or source/image-alt-missing (content media and any other image), at the <img>; a spread on owned markup is rejected before."
|
|
2170
2198
|
},
|
|
2199
|
+
"a11y-nesting": {
|
|
2200
|
+
group: "accessibility-semantics",
|
|
2201
|
+
severity: "error",
|
|
2202
|
+
rule: "An owner's markup follows HTML's content model: no flow content inside phrasing-only elements, no press target inside another, and list items, table rows and cells in their list, table and row.",
|
|
2203
|
+
guides: ["ads://guides/accessibility"],
|
|
2204
|
+
repair: "Use an element whose content model fits (a <div> or a list item for a box of blocks), move the inner control beside the outer one, and put items in their list, rows in their table.",
|
|
2205
|
+
emitters: ["src/owner-analysis-check.mts"],
|
|
2206
|
+
situations: "an owner-analysis error with code source/invalid-nesting, at the element that may not sit there."
|
|
2207
|
+
},
|
|
2171
2208
|
"a11y-incomplete": {
|
|
2172
2209
|
group: "rendered-check",
|
|
2173
2210
|
severity: "info",
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isArrayLiteralExpression,
|
|
3
|
+
isArrowFunction,
|
|
4
|
+
isBinaryExpression,
|
|
5
|
+
isBlock,
|
|
6
|
+
isCallExpression,
|
|
7
|
+
isConditionalExpression,
|
|
8
|
+
isFunctionExpression,
|
|
9
|
+
isIfStatement,
|
|
10
|
+
isJsxElement,
|
|
11
|
+
isJsxExpression,
|
|
12
|
+
isJsxFragment,
|
|
13
|
+
isParenthesizedExpression,
|
|
14
|
+
isPropertyAccessExpression,
|
|
15
|
+
isReturnStatement
|
|
16
|
+
} from "typescript/ast";
|
|
17
|
+
const PHRASING_ONLY = new Set(["span", "p", "button", "label", "h1", "h2", "h3", "h4", "h5", "h6", "em", "strong", "small", "b", "i", "u", "s", "code", "kbd", "samp", "var", "abbr", "cite", "q", "sub", "sup", "time", "mark", "dfn", "data", "output", "legend", "summary", "pre"]), TRANSPARENT = new Set(["a", "ins", "del", "map", "object", "canvas", "noscript", "slot"]), PHRASING = new Set([
|
|
18
|
+
"a",
|
|
19
|
+
"abbr",
|
|
20
|
+
"audio",
|
|
21
|
+
"b",
|
|
22
|
+
"bdi",
|
|
23
|
+
"bdo",
|
|
24
|
+
"br",
|
|
25
|
+
"button",
|
|
26
|
+
"canvas",
|
|
27
|
+
"cite",
|
|
28
|
+
"code",
|
|
29
|
+
"data",
|
|
30
|
+
"datalist",
|
|
31
|
+
"del",
|
|
32
|
+
"dfn",
|
|
33
|
+
"em",
|
|
34
|
+
"embed",
|
|
35
|
+
"i",
|
|
36
|
+
"iframe",
|
|
37
|
+
"img",
|
|
38
|
+
"input",
|
|
39
|
+
"ins",
|
|
40
|
+
"kbd",
|
|
41
|
+
"label",
|
|
42
|
+
"map",
|
|
43
|
+
"mark",
|
|
44
|
+
"meter",
|
|
45
|
+
"noscript",
|
|
46
|
+
"object",
|
|
47
|
+
"output",
|
|
48
|
+
"picture",
|
|
49
|
+
"progress",
|
|
50
|
+
"q",
|
|
51
|
+
"ruby",
|
|
52
|
+
"s",
|
|
53
|
+
"samp",
|
|
54
|
+
"select",
|
|
55
|
+
"slot",
|
|
56
|
+
"small",
|
|
57
|
+
"span",
|
|
58
|
+
"strong",
|
|
59
|
+
"sub",
|
|
60
|
+
"sup",
|
|
61
|
+
"svg",
|
|
62
|
+
"template",
|
|
63
|
+
"textarea",
|
|
64
|
+
"time",
|
|
65
|
+
"u",
|
|
66
|
+
"var",
|
|
67
|
+
"video",
|
|
68
|
+
"wbr",
|
|
69
|
+
"math",
|
|
70
|
+
"area",
|
|
71
|
+
"source",
|
|
72
|
+
"track"
|
|
73
|
+
]), INTERACTIVE = new Set(["a", "button", "input", "select", "textarea", "details", "iframe", "embed"]), PLACED_IN = {
|
|
74
|
+
li: ["ul", "ol", "menu"],
|
|
75
|
+
tr: ["table", "thead", "tbody", "tfoot"],
|
|
76
|
+
td: ["tr"],
|
|
77
|
+
th: ["tr"]
|
|
78
|
+
};
|
|
79
|
+
function insideMarkup(fn) {
|
|
80
|
+
let current = fn.parent;
|
|
81
|
+
while (current !== void 0) {
|
|
82
|
+
if (isJsxExpression(current))
|
|
83
|
+
return !0;
|
|
84
|
+
if (isCallExpression(current) || isPropertyAccessExpression(current) || isParenthesizedExpression(current) || isConditionalExpression(current) || isBinaryExpression(current))
|
|
85
|
+
current = current.parent;
|
|
86
|
+
else
|
|
87
|
+
return !1;
|
|
88
|
+
}
|
|
89
|
+
return !1;
|
|
90
|
+
}
|
|
91
|
+
export function enclosingOpening(node) {
|
|
92
|
+
let current = node.parent;
|
|
93
|
+
while (current !== void 0) {
|
|
94
|
+
if (isJsxElement(current))
|
|
95
|
+
return current.openingElement;
|
|
96
|
+
if (isArrowFunction(current) || isFunctionExpression(current)) {
|
|
97
|
+
if (!insideMarkup(current))
|
|
98
|
+
return null;
|
|
99
|
+
current = current.parent;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (!(isJsxFragment(current) || isJsxExpression(current) || isParenthesizedExpression(current) || isConditionalExpression(current) || isBinaryExpression(current) || isCallExpression(current) || isPropertyAccessExpression(current) || isArrayLiteralExpression(current) || isReturnStatement(current) || isBlock(current) || isIfStatement(current)))
|
|
103
|
+
return null;
|
|
104
|
+
if ((isBlock(current) || isReturnStatement(current)) && !inMarkupCallback(current))
|
|
105
|
+
return null;
|
|
106
|
+
current = current.parent;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
function inMarkupCallback(node) {
|
|
111
|
+
let current = node.parent;
|
|
112
|
+
while (current !== void 0) {
|
|
113
|
+
if (isArrowFunction(current) || isFunctionExpression(current))
|
|
114
|
+
return insideMarkup(current);
|
|
115
|
+
if (isBlock(current) || isReturnStatement(current) || isIfStatement(current)) {
|
|
116
|
+
current = current.parent;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
return !1;
|
|
120
|
+
}
|
|
121
|
+
return !1;
|
|
122
|
+
}
|
|
123
|
+
export function nestingProblem(opening, elementOf, tagOf) {
|
|
124
|
+
const tag = tagOf(opening);
|
|
125
|
+
if (!/^[a-z]/.test(tag))
|
|
126
|
+
return null;
|
|
127
|
+
const chain = [];
|
|
128
|
+
let at = enclosingOpening(elementOf(opening));
|
|
129
|
+
while (at !== null) {
|
|
130
|
+
const parent = tagOf(at);
|
|
131
|
+
if (!/^[a-z]/.test(parent))
|
|
132
|
+
break;
|
|
133
|
+
if (parent === "svg" || parent === "math" || parent === "foreignObject")
|
|
134
|
+
return null;
|
|
135
|
+
chain.push(parent);
|
|
136
|
+
at = enclosingOpening(elementOf(at));
|
|
137
|
+
}
|
|
138
|
+
const [direct] = chain;
|
|
139
|
+
if (direct === void 0)
|
|
140
|
+
return null;
|
|
141
|
+
const placedIn = PLACED_IN[tag];
|
|
142
|
+
if (placedIn !== void 0 && !placedIn.includes(direct))
|
|
143
|
+
return { rule: "placement", element: tag, parent: direct, expected: placedIn };
|
|
144
|
+
if (INTERACTIVE.has(tag)) {
|
|
145
|
+
const host = chain.find((parent) => parent === "a" || parent === "button");
|
|
146
|
+
if (host !== void 0)
|
|
147
|
+
return { rule: "interactive", element: tag, parent: host };
|
|
148
|
+
}
|
|
149
|
+
const model = chain.find((parent) => !TRANSPARENT.has(parent));
|
|
150
|
+
if (model !== void 0 && PHRASING_ONLY.has(model) && !PHRASING.has(tag)) {
|
|
151
|
+
if ((model === "summary" || model === "legend") && /^h[1-6]$/.test(tag))
|
|
152
|
+
return null;
|
|
153
|
+
return { rule: "phrasing", element: tag, parent: model };
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
isStringLiteral,
|
|
42
42
|
isVariableDeclaration,
|
|
43
43
|
isVariableDeclarationList,
|
|
44
|
+
isVariableStatement,
|
|
44
45
|
isWhileStatement
|
|
45
46
|
} from "typescript/ast";
|
|
46
47
|
import { JsxEmit, ModuleKind, ModuleResolutionKind } from "typescript/async";
|
|
@@ -114,6 +115,7 @@ import { appIconEmission, withAppIconsModule } from "../emit/app-icon-emission.m
|
|
|
114
115
|
import { withOutputPackage } from "../emit/output-package.mjs";
|
|
115
116
|
import { analyzedOwners, outcomeCounts, rowsRead } from "./owner-outcomes.mjs";
|
|
116
117
|
import { capturedTreeFiles, findNode, walk } from "./helpers.mjs";
|
|
118
|
+
import { nestingProblem } from "./content-model.mjs";
|
|
117
119
|
import { factorClasses } from "./factored-classes.mjs";
|
|
118
120
|
import { programGlobals } from "./owner-analysis-key.mjs";
|
|
119
121
|
import { memoizedConstruction } from "./construction-memo.mjs";
|
|
@@ -1008,6 +1010,8 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1008
1010
|
const normalized = parsed.value.kind === "region" ? parsed.value.normalizeWhen.find(([selector]) => selector === `& > ${part.selector}`) : void 0;
|
|
1009
1011
|
if (part.pointerTransparent || part.within.length === 0 && normalized?.[1].some(([property, value]) => property === "pointer-events" && value === "none"))
|
|
1010
1012
|
await pointerTransparent(match.opening, part.name, context, resolve);
|
|
1013
|
+
if (element === "textarea" && part.controlFrame === !0 && part.element?.kind !== "textarea")
|
|
1014
|
+
return fail(match.opening, { kind: "textarea-element-missing", part: part.name });
|
|
1011
1015
|
if (part.resizes && element !== "textarea")
|
|
1012
1016
|
return fail(authoredAt(classes.calls, `${part.path}.normalize.resize`) ?? match.opening, { kind: "resize-not-textarea", part: part.name, element });
|
|
1013
1017
|
if (part.scrolls)
|
|
@@ -1523,6 +1527,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1523
1527
|
const tag = values.tag(opening);
|
|
1524
1528
|
if (tag === "img" && attr(opening, "alt") === void 0)
|
|
1525
1529
|
return fail(opening, { kind: "image-alt-missing" });
|
|
1530
|
+
const nesting = nestingProblem(opening, elementOf, values.tag);
|
|
1531
|
+
if (nesting !== null)
|
|
1532
|
+
return fail(opening, { kind: "invalid-nesting", ...nesting, expected: nesting.rule === "placement" ? nesting.expected : [] });
|
|
1526
1533
|
if (clickWithoutKeyboard(opening, tag))
|
|
1527
1534
|
review(opening, { kind: "click-without-keyboard", element: tag });
|
|
1528
1535
|
if (!sections && !artworkThemed.has(opening))
|
|
@@ -1567,6 +1574,21 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1567
1574
|
if (leaf.value.kind === "styled")
|
|
1568
1575
|
for (const { target } of leaf.value.assetSources)
|
|
1569
1576
|
assetEdits.set(target, selection);
|
|
1577
|
+
const macroInitializers = new Set(values.macroCalls.keys());
|
|
1578
|
+
for (const access of nodesOfKind(source, SyntaxKind.PropertyAccessExpression, isPropertyAccessExpression)) {
|
|
1579
|
+
if (access.name.text !== "source" || assetEdits.has(access))
|
|
1580
|
+
continue;
|
|
1581
|
+
const part = access.expression;
|
|
1582
|
+
if (!isPropertyAccessExpression(part) || !isPropertyAccessExpression(part.expression) || part.expression.name.text !== "assets")
|
|
1583
|
+
continue;
|
|
1584
|
+
const holder = part.expression.expression;
|
|
1585
|
+
if (!isIdentifier(holder))
|
|
1586
|
+
continue;
|
|
1587
|
+
const initializer = source.statements.flatMap((statement) => isVariableStatement(statement) ? [...statement.declarationList.declarations] : []).find((node) => isIdentifier(node.name) && node.name.text === holder.text)?.initializer;
|
|
1588
|
+
if (initializer === void 0 || !macroInitializers.has(initializer))
|
|
1589
|
+
continue;
|
|
1590
|
+
return fail(access, { kind: "drawing-read-unbound", name: `${holder.text}.assets.${part.name.text}` });
|
|
1591
|
+
}
|
|
1570
1592
|
for (const statement of source.statements)
|
|
1571
1593
|
if (isImportDeclaration(statement) && isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === RECIPE_MODULE)
|
|
1572
1594
|
edits.push({ node: statement, text: "" });
|
|
@@ -1782,7 +1804,7 @@ export async function ownerModuleSource(name, owner, classOf, fail) {
|
|
|
1782
1804
|
}
|
|
1783
1805
|
const runtimeAxes = new Set(selections.flatMap((selection) => selection.result.axes.map((axis) => axis.declaration))), bindings = new Map;
|
|
1784
1806
|
for (const declaration of values.touched)
|
|
1785
|
-
if (declaration.parent.parent
|
|
1807
|
+
if (isVariableStatement(declaration.parent.parent) && isIdentifier(declaration.name))
|
|
1786
1808
|
bindings.set(await values.symbol(declaration.name), declaration);
|
|
1787
1809
|
const references = new Map([...bindings.values()].map((declaration) => [declaration, []]));
|
|
1788
1810
|
for (const identifier of nodesOfKind(source, SyntaxKind.Identifier, isIdentifier)) {
|
package/dist/check.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { checkProgressContrast } from "./placeholder-contrast.mjs";
|
|
|
6
6
|
import { BORDER_STYLE, BORDER_STYLES, INACTIVE_STATE, SURFACE_STATE, TEXT_TRANSFORM, TEXT_TRANSFORMS, sequenceStepTokenRoles } from "./role-vocabulary.mjs";
|
|
7
7
|
import { FORCED_FIELDS, FORCED_ONLY, FORCED_PREFIX } from "./forced-colors.mjs";
|
|
8
8
|
import { controlFrameInsets } from "./lowering-region-layout.mjs";
|
|
9
|
+
import { measuredRead } from "./measured-geometry.mjs";
|
|
9
10
|
import { recipeTree } from "./recipe-model.mjs";
|
|
10
11
|
import { profileReference } from "./profile-model.mjs";
|
|
11
12
|
import { inspectMotion } from "./motion-model.mjs";
|
|
@@ -253,7 +254,7 @@ export function writeStateText(out, profile, element, base, texts, selector, rej
|
|
|
253
254
|
out.rule(selector(condition), Object.fromEntries(changed.map((property) => [property, fields[property] ?? STATE_TEXT_INITIAL[property] ?? "normal"])));
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
export function writePlays(out, profile, foundation, element, plays, selector, taken, reject) {
|
|
257
|
+
export function writePlays(out, profile, foundation, element, plays, selector, taken, reject, measured = null) {
|
|
257
258
|
for (const play of plays) {
|
|
258
259
|
const selected = profile.select(play.sequence);
|
|
259
260
|
if (selected.kind !== "sequence")
|
|
@@ -279,7 +280,14 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
|
|
|
279
280
|
if (roles === void 0 || role === void 0 || !roles.includes(role))
|
|
280
281
|
return reject({ kind: "sequence-step-field", profile: play.sequence, at: step.at, field });
|
|
281
282
|
}
|
|
282
|
-
const
|
|
283
|
+
const orderVar = (spec) => {
|
|
284
|
+
if (spec.orderBy === null)
|
|
285
|
+
return null;
|
|
286
|
+
const value = measured?.values.find((item) => item.name === spec.orderBy && item.type === "index");
|
|
287
|
+
if (measured === null || value === void 0)
|
|
288
|
+
return reject({ kind: "sequence-order-unmeasured", part: element, name: spec.orderBy });
|
|
289
|
+
return measuredRead(measured.scope, value, "0");
|
|
290
|
+
}, lowered = sequenceRules({
|
|
283
291
|
profile: play.sequence,
|
|
284
292
|
selector,
|
|
285
293
|
condition: play.condition,
|
|
@@ -289,6 +297,7 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
|
|
|
289
297
|
stagger: fields.stagger ?? null,
|
|
290
298
|
repeat,
|
|
291
299
|
order: play.order,
|
|
300
|
+
orderVar: orderVar(play),
|
|
292
301
|
paused: play.paused
|
|
293
302
|
});
|
|
294
303
|
if (lowered.kind === "err")
|
|
@@ -180,6 +180,11 @@ export interface PlaySpec {
|
|
|
180
180
|
readonly condition: string | null;
|
|
181
181
|
readonly sequence: string;
|
|
182
182
|
readonly order: number;
|
|
183
|
+
/**
|
|
184
|
+
* `orderBy`: a measured `index` the owner writes on each instance of a repeated part (a title's words): each starts
|
|
185
|
+
* that many staggers late, however many there are. `null`: `order` alone.
|
|
186
|
+
*/
|
|
187
|
+
readonly orderBy: string | null;
|
|
183
188
|
/** `paused: true`: held at its first step (a diagram armed before it scrolls into view), released by another state. */
|
|
184
189
|
readonly paused: boolean;
|
|
185
190
|
readonly path: string;
|
|
@@ -193,7 +198,14 @@ export interface TextAnchor {
|
|
|
193
198
|
readonly x: number;
|
|
194
199
|
readonly y: number;
|
|
195
200
|
readonly inline: "start" | "center" | "end";
|
|
196
|
-
|
|
201
|
+
/** `baseline`: the label's first baseline sits on `y`, as an SVG `<text>`'s does. */
|
|
202
|
+
readonly block: "start" | "center" | "end" | "baseline";
|
|
203
|
+
/**
|
|
204
|
+
* The label's size in the drawing's units, so it scales with the drawing (11 units on a 540-wide drawing are 11px at
|
|
205
|
+
* 540px, 23px at 1134px); never below its text profile's size, so it stays readable and follows the reader's text
|
|
206
|
+
* size. `null`: its text profile's size.
|
|
207
|
+
*/
|
|
208
|
+
readonly size: number | null;
|
|
197
209
|
readonly path: string;
|
|
198
210
|
}
|
|
199
211
|
/** A named group of a part's drawing (`data-group` in the asset's SVG) and the sequences it plays. */
|
|
@@ -574,11 +586,18 @@ export type Overflow = {
|
|
|
574
586
|
};
|
|
575
587
|
export declare const OVERFLOW_VALUES: readonly ["clip", "scroll-block", "scroll-inline", "scroll-both"];
|
|
576
588
|
/** How a part takes space in its parent's stack or inline arrangement: its content's size, or the free main-axis space (and the cross axis with `both`). */
|
|
589
|
+
/**
|
|
590
|
+
* How a part takes its parent's main-axis space: its content's size; the free space from nothing (`fill`, equal
|
|
591
|
+
* shares); or growing from its own size (`grow`: in a wrapping row the items sit at their own widths where they fit,
|
|
592
|
+
* and each fills its line where they wrap).
|
|
593
|
+
*/
|
|
577
594
|
export type Extent = {
|
|
578
595
|
readonly kind: "content";
|
|
579
596
|
} | {
|
|
580
597
|
readonly kind: "fill";
|
|
581
598
|
readonly axis: "main" | "both";
|
|
599
|
+
} | {
|
|
600
|
+
readonly kind: "grow";
|
|
582
601
|
};
|
|
583
602
|
/** A part shown or hidden while a named condition of the nearest recipe's spatial profile holds (viewport width below its token). */
|
|
584
603
|
export interface PartCondition {
|
|
@@ -606,6 +625,10 @@ export type ElementKind = {
|
|
|
606
625
|
} | {
|
|
607
626
|
readonly kind: "input";
|
|
608
627
|
readonly type: "search" | "text";
|
|
628
|
+
}
|
|
629
|
+
/** A multi-line text field: a control frame keeps its stated insets around the lines (it centres no single line). */
|
|
630
|
+
| {
|
|
631
|
+
readonly kind: "textarea";
|
|
609
632
|
} | {
|
|
610
633
|
readonly kind: "table";
|
|
611
634
|
}
|
|
@@ -626,7 +649,7 @@ export type ElementKind = {
|
|
|
626
649
|
readonly kind: "summary";
|
|
627
650
|
readonly marker: "native" | "none";
|
|
628
651
|
};
|
|
629
|
-
export declare const ELEMENT_NAMES: readonly ["iframe", "select", "search-input", "text-input", "table", "header-cell", "cell", "list", "summary", "document"];
|
|
652
|
+
export declare const ELEMENT_NAMES: readonly ["iframe", "select", "search-input", "text-input", "textarea", "table", "header-cell", "cell", "list", "summary", "document"];
|
|
630
653
|
export type ElementName = (typeof ELEMENT_NAMES)[number];
|
|
631
654
|
/**
|
|
632
655
|
* How a text part breaks: anywhere (long words wrap), never, truncated with an
|
|
@@ -675,7 +698,7 @@ export type PartContent = {
|
|
|
675
698
|
export type StateTreatment = readonly [condition: string, surface: string];
|
|
676
699
|
export type RegionPartContent = PartContent["kind"];
|
|
677
700
|
/** The kinds of value a measured declaration carries: a px length, a px translation (x, y) or a px grid track length. */
|
|
678
|
-
export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share"];
|
|
701
|
+
export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share", "index"];
|
|
679
702
|
export type MeasuredType = (typeof MEASURED_TYPES)[number];
|
|
680
703
|
/**
|
|
681
704
|
* A geometry value the owner measures or computes at runtime and writes through
|
|
@@ -738,6 +761,12 @@ export type MeasuredValue =
|
|
|
738
761
|
readonly type: "share";
|
|
739
762
|
readonly name: string;
|
|
740
763
|
readonly property: string;
|
|
764
|
+
}
|
|
765
|
+
/** An instance's place among its siblings (0, 1, 2…): how many staggers its sequence starts late (`play.orderBy`). */
|
|
766
|
+
| {
|
|
767
|
+
readonly type: "index";
|
|
768
|
+
readonly name: string;
|
|
769
|
+
readonly property: string;
|
|
741
770
|
};
|
|
742
771
|
/**
|
|
743
772
|
* A paint the owner selects at runtime from data (a chart series, a status):
|
|
@@ -895,10 +924,14 @@ export interface ModalSheet {
|
|
|
895
924
|
* Inline edge the sheet is attached to (logical, so it mirrors in RTL), or a card's place: `center` in the
|
|
896
925
|
* viewport, or `block-start` (centred inline, the layer profile's margin below the top).
|
|
897
926
|
*/
|
|
898
|
-
readonly edge: "start" | "end" | "center" | "block-start";
|
|
927
|
+
readonly edge: "start" | "end" | "center" | "block-start" | "fill";
|
|
899
928
|
readonly backdrop: Backdrop;
|
|
900
|
-
/**
|
|
901
|
-
|
|
929
|
+
/**
|
|
930
|
+
* A sheet travels its own extent from `edge`; a card or a whole-viewport modal (`fill`) fades, drops in (`drop`: fades
|
|
931
|
+
* while coming down its motion profile's distance from its scale), or keeps still while only its veil fades (`veil`);
|
|
932
|
+
* `null` opens and closes instantly.
|
|
933
|
+
*/
|
|
934
|
+
readonly motion: "slide" | "fade" | "drop" | "veil" | null;
|
|
902
935
|
/** Breakpoint tier of the selected spatial profile from which the owner shows its inline alternative; `null` = modal at every size. */
|
|
903
936
|
readonly modalBelow: string | null;
|
|
904
937
|
}
|
|
@@ -962,6 +995,8 @@ export interface RegionSpec {
|
|
|
962
995
|
readonly text: TextBinding | null;
|
|
963
996
|
readonly textAlign: TextAlign | null;
|
|
964
997
|
readonly overflow: Overflow;
|
|
998
|
+
/** A layer root's own scroll (its layer makes it scroll) kept to itself: `overscroll: "contain"` with no `overflow`. */
|
|
999
|
+
readonly layerOverscroll?: boolean;
|
|
965
1000
|
readonly element: ElementKind | null;
|
|
966
1001
|
readonly normalize: readonly (readonly [property: string, value: string])[];
|
|
967
1002
|
readonly normalizeWhen: readonly (readonly [selector: string, values: readonly (readonly [property: string, value: string])[]])[];
|
|
@@ -1094,6 +1129,8 @@ export interface DeclaredPart {
|
|
|
1094
1129
|
readonly declaresBoundary: boolean;
|
|
1095
1130
|
/** Whether the part declares `normalize.resize`: its element is a `<textarea>`. */
|
|
1096
1131
|
readonly resizes: boolean;
|
|
1132
|
+
/** Whether the part's frame is a control's (`frame: { kind: "control" }`): on a `<textarea>` it needs `element: "textarea"`. */
|
|
1133
|
+
readonly controlFrame?: boolean;
|
|
1097
1134
|
/** The colour scheme a visual part of a light and dark pair is shown under; `null` for every other part. */
|
|
1098
1135
|
readonly scheme: ColorScheme | null;
|
|
1099
1136
|
}
|
|
@@ -1174,7 +1211,7 @@ export interface OutsetSpec {
|
|
|
1174
1211
|
/** Normalization as CSS property → value pairs, in authored order. */
|
|
1175
1212
|
export type Normalized = readonly (readonly [property: string, value: string])[];
|
|
1176
1213
|
/** The pointer cursors an element may show (`normalize.cursor`): a closed set, no image cursors. */
|
|
1177
|
-
export declare const CURSORS: readonly ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed"];
|
|
1214
|
+
export declare const CURSORS: readonly ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed", "zoom-in", "zoom-out"];
|
|
1178
1215
|
/** The touch gestures an element leaves to the browser (`normalize.touchAction`): none, or panning on one axis. */
|
|
1179
1216
|
export declare const TOUCH_ACTIONS: readonly ["none", "pan-x", "pan-y"];
|
|
1180
1217
|
/** How the user may resize a multi-line text field (`normalize.resize`, on a `<textarea>` part): by its block edge only, or not at all. */
|
|
@@ -1197,7 +1234,7 @@ export declare const NORMALIZE_FIELDS: {
|
|
|
1197
1234
|
};
|
|
1198
1235
|
readonly cursor: {
|
|
1199
1236
|
readonly property: "cursor";
|
|
1200
|
-
readonly values: readonly ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed"];
|
|
1237
|
+
readonly values: readonly ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed", "zoom-in", "zoom-out"];
|
|
1201
1238
|
};
|
|
1202
1239
|
readonly textDecoration: {
|
|
1203
1240
|
readonly property: "text-decoration-line";
|
|
@@ -14,12 +14,12 @@ function textAnchor(value, path, read) {
|
|
|
14
14
|
if (value === void 0)
|
|
15
15
|
return null;
|
|
16
16
|
const declared = read.object(value, path);
|
|
17
|
-
read.only(declared, path, ["artwork", "x", "y", "inline", "block"]);
|
|
17
|
+
read.only(declared, path, ["artwork", "x", "y", "inline", "block", "size"]);
|
|
18
18
|
const coordinate = (key) => {
|
|
19
19
|
const item = declared[key];
|
|
20
20
|
return typeof item === "number" && Number.isFinite(item) ? item : read.invalid(`${path}.${key}`, "a number in the drawing's coordinates");
|
|
21
|
-
}, edge = (key) => declared[key] === void 0 ? "start" : read.literal(declared[key], `${path}.${key}`, ["start", "center", "end"]);
|
|
22
|
-
return { artwork: read.string(declared.artwork, `${path}.artwork`), x: coordinate("x"), y: coordinate("y"), inline: edge("inline"), block
|
|
21
|
+
}, edge = (key) => declared[key] === void 0 ? "start" : read.literal(declared[key], `${path}.${key}`, ["start", "center", "end"]), block = declared.block === "baseline" ? "baseline" : edge("block"), size = declared.size === void 0 ? null : typeof declared.size === "number" && Number.isFinite(declared.size) && declared.size > 0 ? declared.size : read.invalid(`${path}.size`, "a positive size in the drawing's units");
|
|
22
|
+
return { artwork: read.string(declared.artwork, `${path}.artwork`), x: coordinate("x"), y: coordinate("y"), inline: edge("inline"), block, size, path };
|
|
23
23
|
}
|
|
24
24
|
export const STICKY_EDGES = ["block-start", "block-end", "inline-start", "inline-end"], ENTER_MOVEMENTS = { translate: "distance", translateInline: "distance", scale: "scale", rotate: "angle" }, PSEUDO_ELEMENTS = ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb", "sliderFill"], REPLACED_ELEMENTS = ["img", "input", "select", "textarea", "video", "iframe", "br", "hr", "svg"], PSEUDO_HOSTS = { placeholder: ["input", "textarea"], progressValue: ["progress"], marker: ["li", "summary"], before: "non-replaced", sliderTrack: ["input"], sliderThumb: ["input"], sliderFill: ["input"] }, pseudoHosted = (pseudo, element) => {
|
|
25
25
|
const hosts = PSEUDO_HOSTS[pseudo];
|
|
@@ -47,12 +47,13 @@ function conditionAlignment(fields, path, read) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
const aligns = (alignment) => alignment.align !== null || alignment.justify !== null || alignment.textAlign !== null;
|
|
50
|
-
export const OVERFLOW_VALUES = ["clip", "scroll-block", "scroll-inline", "scroll-both"], ELEMENT_NAMES = ["iframe", "select", "search-input", "text-input", "table", "header-cell", "cell", "list", "summary", "document"], TEXT_WRAPS = ["anywhere", "never", "truncate", "balance", "pretty", "preserve"], TEXT_ALIGNS = ["start", "center", "end"], MEASURED_TYPES = ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share"], GRID_FIELDS = ["columns", "weights", "gutter", "margin", "bound", "rows", "context", "align", "contentFrom"];
|
|
50
|
+
export const OVERFLOW_VALUES = ["clip", "scroll-block", "scroll-inline", "scroll-both"], ELEMENT_NAMES = ["iframe", "select", "search-input", "text-input", "textarea", "table", "header-cell", "cell", "list", "summary", "document"], TEXT_WRAPS = ["anywhere", "never", "truncate", "balance", "pretty", "preserve"], TEXT_ALIGNS = ["start", "center", "end"], MEASURED_TYPES = ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share", "index"], GRID_FIELDS = ["columns", "weights", "gutter", "margin", "bound", "rows", "context", "align", "contentFrom"];
|
|
51
51
|
export function elementTags(element) {
|
|
52
52
|
switch (element.kind) {
|
|
53
53
|
case "iframe":
|
|
54
54
|
case "select":
|
|
55
55
|
case "input":
|
|
56
|
+
case "textarea":
|
|
56
57
|
case "table":
|
|
57
58
|
case "summary":
|
|
58
59
|
return [element.kind];
|
|
@@ -140,6 +141,7 @@ const regionParts = (parts, within, parent, parentLayout) => parts.flatMap((part
|
|
|
140
141
|
blockText: blockText(part, parentLayout),
|
|
141
142
|
declaresBoundary: part.accessibility !== null,
|
|
142
143
|
resizes: part.normalize.some(([property]) => property === "resize"),
|
|
144
|
+
controlFrame: part.frame?.kind === "control",
|
|
143
145
|
scheme: part.scheme,
|
|
144
146
|
playsAlways: part.plays.flatMap((play) => play.condition === null ? [play.sequence] : [])
|
|
145
147
|
},
|
|
@@ -569,12 +571,15 @@ function paintTransition(value, path, read) {
|
|
|
569
571
|
}
|
|
570
572
|
function playSpec(value, condition, path, read) {
|
|
571
573
|
const declared = read.object(value, path);
|
|
572
|
-
read.only(declared, path, ["sequence", "order", "paused"]);
|
|
574
|
+
read.only(declared, path, ["sequence", "order", "orderBy", "paused"]);
|
|
573
575
|
const order = declared.order === void 0 ? 0 : declared.order;
|
|
574
576
|
if (typeof order !== "number" || !Number.isInteger(order) || order < 0 || order > 32)
|
|
575
577
|
return read.invalid(`${path}.order`, "a whole number from 0 to 32");
|
|
578
|
+
const orderBy = read.optionalString(declared.orderBy, `${path}.orderBy`);
|
|
579
|
+
if (orderBy !== null && declared.order !== void 0)
|
|
580
|
+
return read.invalid(`${path}.orderBy`, "an order by a measured index or a fixed `order`, not both");
|
|
576
581
|
const paused = declared.paused === void 0 ? !1 : read.boolean(declared.paused, `${path}.paused`);
|
|
577
|
-
return { condition, sequence: read.string(declared.sequence, `${path}.sequence`), order, paused, path };
|
|
582
|
+
return { condition, sequence: read.string(declared.sequence, `${path}.sequence`), order, orderBy, paused, path };
|
|
578
583
|
}
|
|
579
584
|
function artworkGroups(value, path, read) {
|
|
580
585
|
if (value === void 0)
|
|
@@ -837,7 +842,7 @@ function frameCondition(value, base, read) {
|
|
|
837
842
|
path: `${path}.frame`
|
|
838
843
|
};
|
|
839
844
|
}
|
|
840
|
-
export const CURSORS = ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed"], TOUCH_ACTIONS = ["none", "pan-x", "pan-y"], RESIZES = ["vertical", "none"], USER_SELECTS = ["none"], NORMALIZE_FIELDS = {
|
|
845
|
+
export const CURSORS = ["pointer", "default", "grab", "grabbing", "col-resize", "row-resize", "move", "text", "not-allowed", "zoom-in", "zoom-out"], TOUCH_ACTIONS = ["none", "pan-x", "pan-y"], RESIZES = ["vertical", "none"], USER_SELECTS = ["none"], NORMALIZE_FIELDS = {
|
|
841
846
|
margin: { property: "margin", values: ["0"] },
|
|
842
847
|
borderStyle: { property: "border-style", values: ["solid", "none"] },
|
|
843
848
|
cursor: { property: "cursor", values: CURSORS },
|
|
@@ -947,6 +952,7 @@ function elementKind(value, marker, path, read, align) {
|
|
|
947
952
|
switch (name) {
|
|
948
953
|
case "iframe":
|
|
949
954
|
case "select":
|
|
955
|
+
case "textarea":
|
|
950
956
|
case "table":
|
|
951
957
|
case "list":
|
|
952
958
|
return { kind: name };
|
|
@@ -1049,7 +1055,9 @@ function partContent(part, path, read) {
|
|
|
1049
1055
|
function extent(value, path, read) {
|
|
1050
1056
|
if (value === void 0)
|
|
1051
1057
|
return { kind: "content" };
|
|
1052
|
-
switch (read.literal(value, path, ["fill", "fill-both"])) {
|
|
1058
|
+
switch (read.literal(value, path, ["fill", "fill-both", "grow"])) {
|
|
1059
|
+
case "grow":
|
|
1060
|
+
return { kind: "grow" };
|
|
1053
1061
|
case "fill":
|
|
1054
1062
|
return { kind: "fill", axis: "main" };
|
|
1055
1063
|
case "fill-both":
|
|
@@ -1099,6 +1107,7 @@ function measuredValues(value, path, read) {
|
|
|
1099
1107
|
case "position":
|
|
1100
1108
|
case "intrinsic-size":
|
|
1101
1109
|
case "share":
|
|
1110
|
+
case "index":
|
|
1102
1111
|
read.only(fields, at, ["type", "property"]);
|
|
1103
1112
|
return { type, name, property };
|
|
1104
1113
|
}
|
|
@@ -1466,7 +1475,8 @@ function region(authored, read) {
|
|
|
1466
1475
|
surface: read.optionalString(spec.surface, "recipe.surface"),
|
|
1467
1476
|
text: textBinding(spec.text, "recipe.text", read),
|
|
1468
1477
|
textAlign: spec.textAlign === void 0 ? null : read.literal(spec.textAlign, "recipe.textAlign", TEXT_ALIGNS),
|
|
1469
|
-
overflow: overflow(spec.overflow, "recipe.overflow", read, spec.overscroll),
|
|
1478
|
+
overflow: overflow(spec.overflow, "recipe.overflow", read, spec.layer !== void 0 && spec.overflow === void 0 ? void 0 : spec.overscroll),
|
|
1479
|
+
layerOverscroll: spec.layer !== void 0 && spec.overflow === void 0 && spec.overscroll !== void 0 && read.literal(spec.overscroll, "recipe.overscroll", ["contain"]) === "contain",
|
|
1470
1480
|
element: elementKind(spec.element, spec.marker, "recipe", read, spec.element === "cell" || spec.element === "header-cell" ? spec.align : void 0),
|
|
1471
1481
|
normalize: normalized.values,
|
|
1472
1482
|
normalizeWhen: normalized.when,
|
|
@@ -1491,7 +1501,7 @@ function region(authored, read) {
|
|
|
1491
1501
|
paints
|
|
1492
1502
|
};
|
|
1493
1503
|
}
|
|
1494
|
-
const EDGES = ["start", "end"], DIALOG_EDGES = ["start", "end", "center", "block-start"];
|
|
1504
|
+
const EDGES = ["start", "end"], DIALOG_EDGES = ["start", "end", "center", "block-start", "fill"];
|
|
1495
1505
|
function layerSpec(value, read) {
|
|
1496
1506
|
if (value === void 0)
|
|
1497
1507
|
return null;
|
|
@@ -1501,7 +1511,7 @@ function layerSpec(value, read) {
|
|
|
1501
1511
|
read.only(layer, path, ["element", "edge", "backdrop", "motion", "modalBelow"]);
|
|
1502
1512
|
const backdrop = read.object(layer.backdrop, `${path}.backdrop`);
|
|
1503
1513
|
read.only(backdrop, `${path}.backdrop`, ["surface", "dismiss"]);
|
|
1504
|
-
const edge = read.literal(layer.edge, `${path}.edge`, DIALOG_EDGES), card = edge === "center" || edge === "block-start";
|
|
1514
|
+
const edge = read.literal(layer.edge, `${path}.edge`, DIALOG_EDGES), card = edge === "center" || edge === "block-start" || edge === "fill";
|
|
1505
1515
|
return {
|
|
1506
1516
|
kind: "modal-sheet",
|
|
1507
1517
|
element,
|
|
@@ -1510,7 +1520,7 @@ function layerSpec(value, read) {
|
|
|
1510
1520
|
surface: read.string(backdrop.surface, `${path}.backdrop.surface`),
|
|
1511
1521
|
dismiss: backdrop.dismiss === void 0 ? "none" : read.literal(backdrop.dismiss, `${path}.backdrop.dismiss`, ["press", "none"])
|
|
1512
1522
|
},
|
|
1513
|
-
motion: layer.motion === void 0 ? null : card ? read.literal(layer.motion, `${path}.motion`, ["fade"]) : read.literal(layer.motion, `${path}.motion`, ["slide"]),
|
|
1523
|
+
motion: layer.motion === void 0 ? null : card ? read.literal(layer.motion, `${path}.motion`, ["fade", "drop", "veil"]) : read.literal(layer.motion, `${path}.motion`, ["slide"]),
|
|
1514
1524
|
modalBelow: read.optionalString(layer.modalBelow, `${path}.modalBelow`)
|
|
1515
1525
|
};
|
|
1516
1526
|
}
|