@reqvire-org/ads 0.5.2 → 0.5.4
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 +33 -26
- package/dist/analysis/design-usage.mjs +4 -20
- package/dist/analysis/mock-check.mjs +4 -5
- package/dist/analysis/owner-accessibility.mjs +4 -4
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +35 -3
- package/dist/analysis/owner-composition.mjs +75 -13
- package/dist/analysis/owner-source.mjs +64 -40
- package/dist/composed-contrast.mjs +165 -65
- package/dist/construction-output.mjs +12 -5
- package/dist/construction-spec.d.mts +125 -50
- package/dist/construction-spec.mjs +154 -81
- package/dist/corner-overpaint.mjs +5 -4
- package/dist/design-foundation.mjs +16 -0
- package/dist/design-usage.mjs +2 -8
- package/dist/emit/emission.mjs +0 -5
- package/dist/grid-lowering.mjs +3 -1
- package/dist/lowering-enter.mjs +6 -6
- package/dist/lowering-overlaps.mjs +6 -1
- package/dist/lowering-properties.mjs +3 -0
- package/dist/lowering-session.mjs +10 -0
- package/dist/lowering-transitions.mjs +1 -0
- package/dist/mcp/server-observation.mjs +6 -4
- package/dist/mcp/server-project.mjs +4 -1
- package/dist/owner-analysis-check.mjs +4 -1
- package/dist/owner-errors.mjs +2 -1
- package/dist/owner-lowering.mjs +10 -4
- package/dist/owner-scenarios.mjs +2 -22
- package/dist/ownership-model.mjs +15 -7
- package/dist/paint-contrast.mjs +6 -0
- package/dist/platform-features.mjs +6 -0
- package/dist/profile-macro.d.mts +7 -0
- package/dist/recipe-macro.d.mts +104 -45
- package/dist/recipe-model.mjs +19 -12
- package/dist/region-lowering.mjs +128 -121
- package/dist/role-vocabulary.d.mts +7 -0
- package/dist/role-vocabulary.mjs +7 -0
- package/dist/runtime-paint-contrast.mjs +5 -2
- package/dist/showcase/client.bundle.js +51 -51
- package/dist/showcase/http-client.bundle.js +13 -13
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +6 -6
- package/dist/skills/ads-designer/references/accessibility.md +3 -4
- package/dist/skills/ads-designer/references/design-data.md +12 -6
- package/dist/skills/ads-designer/references/layout.md +7 -3
- package/dist/skills/ads-designer/references/motion.md +2 -1
- package/dist/skills/ads-designer/references/recipes.md +43 -19
- package/dist/skills/ads-import/references/design-data.md +12 -6
- package/dist/skills/ads-import/references/layout.md +7 -3
- package/dist/skills/ads-import/references/recipes.md +43 -19
- package/dist/skills/ads-migrate/SKILL.md +2 -0
- package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
- package/dist/skills/ads-migrate/references/0.5.3-to-0.5.4.md +42 -0
- package/dist/skills/ads-port/references/design-data.md +12 -6
- package/dist/skills/ads-port/references/layout.md +7 -3
- package/dist/skills/ads-port/references/recipes.md +43 -19
- package/dist/spatial-model.mjs +2 -2
- package/dist/surface-contrast.mjs +6 -2
- package/dist/target-size.mjs +21 -3
- package/docs/ADS.md +9 -3
- package/docs/ARCHITECTURE.md +33 -23
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +181 -21
- package/docs/GUIDE.md +64 -19
- package/docs/LANGUAGE.md +169 -139
- package/docs/MCP.md +5 -1
- package/docs/MOTION.md +16 -3
- package/docs/PROFILE-KINDS.md +52 -5
- package/docs/RULES.md +16 -15
- package/package.json +1 -1
- package/dist/analysis/prose-owners.mjs +0 -57
- package/dist/prose-model.d.mts +0 -81
- package/dist/prose-model.mjs +0 -101
package/dist/recipe-model.mjs
CHANGED
|
@@ -48,7 +48,7 @@ function clause(parent, name, params, values) {
|
|
|
48
48
|
}
|
|
49
49
|
const strings = (value) => Array.isArray(value) && value.every((item) => typeof item === "string") ? value : null;
|
|
50
50
|
function buildProfileTree(spec) {
|
|
51
|
-
only(spec, ["name", "kind", "with", "fields", "choices", "breakpoints", "gutters", "conditions", "steps"]);
|
|
51
|
+
only(spec, ["name", "kind", "with", "fields", "choices", "breakpoints", "gutters", "conditions", "steps", "provides"]);
|
|
52
52
|
const { name, kind } = spec;
|
|
53
53
|
check(typeof name === "string" && typeof kind === "string", "Profiles need a string name and kind");
|
|
54
54
|
const inputs = spec.with === void 0 ? [] : strings(spec.with);
|
|
@@ -61,6 +61,13 @@ function buildProfileTree(spec) {
|
|
|
61
61
|
const ratios = fields.ratios;
|
|
62
62
|
if (Array.isArray(ratios))
|
|
63
63
|
fields.ratios = ratios.map((ratio) => Array.isArray(ratio) ? ratio.join(" / ") : modelValue(ratio)).join(", ");
|
|
64
|
+
const provides = spec.provides === void 0 ? {} : object(spec.provides, "Expected provided roles");
|
|
65
|
+
check(Object.keys(provides).length === 0 || kind === "surface", "Only a surface profile provides contextual roles");
|
|
66
|
+
for (const [token, value] of Object.entries(provides)) {
|
|
67
|
+
check(/^--[a-z][\w-]*$/.test(token) && typeof value === "string" && /^--[a-z][\w-]*$/.test(value), `A provided role names a token and the token it reads: ${token}`);
|
|
68
|
+
check(!Object.hasOwn(fields, token), `Duplicate provided role: ${token}`);
|
|
69
|
+
fields[token] = value;
|
|
70
|
+
}
|
|
64
71
|
declarations(node, fields);
|
|
65
72
|
for (const [choiceName, choice] of Object.entries(spec.choices === void 0 ? {} : object(spec.choices, "Expected choices"))) {
|
|
66
73
|
const declared = only(choice, ["default", "options"]), child = clause(node, "ads-choice", choiceName, declared.default ? { default: declared.default } : {});
|
|
@@ -80,16 +87,15 @@ function buildProfileTree(spec) {
|
|
|
80
87
|
required(profileDefinition(node));
|
|
81
88
|
return root;
|
|
82
89
|
}
|
|
83
|
-
const NESTED = new Set(["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "recipe", "normalize", "theme", "paintTransition", "pseudo", "layer", "measured", "paints", "snap", "accessibility", "enter", "sticky", "outset", "
|
|
84
|
-
"ads-part": ["recipe", "when", "frame", "parts", "paintTransition", "pseudo", "at", "measured", "paints", "normalize", "accessibility", "enter", "sticky", "play", "outset", "focus", "geometryTransition"],
|
|
90
|
+
const NESTED = new Set(["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "recipe", "normalize", "theme", "paintTransition", "pseudo", "layer", "measured", "paints", "snap", "accessibility", "enter", "sticky", "outset", "play", "focus", "geometryTransition", "counter", "content", "between"]), NESTED_IN = {
|
|
91
|
+
"ads-part": ["recipe", "when", "frame", "parts", "paintTransition", "pseudo", "at", "measured", "paints", "normalize", "accessibility", "enter", "sticky", "play", "outset", "focus", "geometryTransition", "counter", "between"],
|
|
85
92
|
"ads-cell": ["at"],
|
|
86
93
|
"ads-at": ["cells", "frame"],
|
|
87
94
|
"ads-when": ["play", "frame"],
|
|
88
|
-
"ads-pseudo": ["when"]
|
|
89
|
-
"ads-element": ["when"]
|
|
95
|
+
"ads-pseudo": ["when", "content"]
|
|
90
96
|
};
|
|
91
97
|
function body(node, spec) {
|
|
92
|
-
const allowed = node.name === "ads-recipe" ? ["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "paintTransition", "geometryTransition", "snap", ...node.parent?.type === "root" ? ["normalize", "theme", "layer", "measured", "paints", "enter", "sticky", "
|
|
98
|
+
const allowed = node.name === "ads-recipe" ? ["layout", "parts", "cells", "at", "when", "frame", "select", "alignRows", "paintTransition", "geometryTransition", "snap", ...node.parent?.type === "root" ? ["normalize", "theme", "layer", "measured", "paints", "enter", "sticky", "play", "pseudo", "counter", "between"] : []] : NESTED_IN[node.name] ?? [];
|
|
93
99
|
for (const field of Object.keys(spec))
|
|
94
100
|
if (NESTED.has(field))
|
|
95
101
|
check(allowed.includes(field), `Unsupported ${field} in ${node.name}`);
|
|
@@ -118,21 +124,22 @@ function body(node, spec) {
|
|
|
118
124
|
clause(node, "ads-focus", "", only(spec.focus, ["of"]));
|
|
119
125
|
if (spec.play !== void 0)
|
|
120
126
|
clause(node, "ads-play", "", only(spec.play, ["sequence", "order"]));
|
|
127
|
+
if (spec.counter !== void 0)
|
|
128
|
+
clause(node, "ads-counter", "", only(spec.counter, ["reset", "increment"]));
|
|
129
|
+
if (spec.between !== void 0)
|
|
130
|
+
clause(node, "ads-between", "", only(spec.between, ["surface", "frame"]));
|
|
131
|
+
if (spec.content !== void 0)
|
|
132
|
+
clause(node, "ads-content", "", only(spec.content, ["counter", "counters", "style", "separator", "prefix", "suffix"]));
|
|
121
133
|
const entrance = spec.enter;
|
|
122
134
|
if (entrance !== void 0) {
|
|
123
135
|
const { from, motion } = only(entrance, ["from", "motion"]);
|
|
124
|
-
clause(node, "ads-enter", "", { ...only(from, ["surface", "translate", "scale", "rotate"]), ...motion === void 0 ? {} : { motion } });
|
|
136
|
+
clause(node, "ads-enter", "", { ...only(from, ["surface", "translate", "translateInline", "scale", "rotate"]), ...motion === void 0 ? {} : { motion } });
|
|
125
137
|
}
|
|
126
138
|
const layer = spec.layer;
|
|
127
139
|
if (layer !== void 0) {
|
|
128
140
|
const { backdrop, corner, ...fields } = only(layer, ["element", "edge", "backdrop", "motion", "modalBelow", "popover", "corner", "clear", "placement"]), nested = (name, value, keys) => value === void 0 ? [] : Object.entries(only(value, keys)).map(([key, item]) => [`${name}${key[0]?.toUpperCase() ?? ""}${key.slice(1)}`, item]);
|
|
129
141
|
clause(node, "ads-layer", "", { ...fields, ...Object.fromEntries([...nested("backdrop", backdrop, ["surface", "dismiss"]), ...nested("corner", corner, ["block", "inline"])]) });
|
|
130
142
|
}
|
|
131
|
-
for (const [name, child] of Object.entries(spec.elements === void 0 ? {} : object(spec.elements, "Invalid elements declaration"))) {
|
|
132
|
-
const { when, ...fields } = only(child, name === "component" ? ["spaceBefore", "spaceAfter"] : ["text", "surface", "frame", "marker", "markerText", "markers", "spaceBefore", "spaceAfter", "indent", "anchorClear", "when"]), element = clause(node, "ads-element", name, fields);
|
|
133
|
-
for (const [condition, state] of Object.entries(when === void 0 ? {} : object(when, "Invalid when declaration")))
|
|
134
|
-
body(clause(element, "ads-when", condition), object(state, "Invalid when declaration"));
|
|
135
|
-
}
|
|
136
143
|
for (const [field, kind] of [["parts", "part"], ["cells", "cell"], ["at", "at"], ["when", "when"], ["pseudo", "pseudo"]])
|
|
137
144
|
for (const [name, child] of Object.entries(spec[field] === void 0 ? {} : object(spec[field], `Invalid ${field} declaration`)))
|
|
138
145
|
body(clause(node, `ads-${kind}`, name), object(child, `Invalid ${field} declaration`));
|
package/dist/region-lowering.mjs
CHANGED
|
@@ -26,16 +26,12 @@ import {
|
|
|
26
26
|
writeStateText
|
|
27
27
|
} from "./construction-output.mjs";
|
|
28
28
|
import { settled } from "./lowering-enter.mjs";
|
|
29
|
-
import { paintContrast } from "./paint-contrast.mjs";
|
|
30
|
-
import { PROSE_BLOCKS, PROSE_COMPONENT, PROSE_ELEMENTS, PROSE_ELEMENT_NAMES, PROSE_FIRST, proseContents, proseDefaults, proseSelector, proseState } from "./prose-model.mjs";
|
|
31
|
-
import { textMinimum } from "./surface-contrast.mjs";
|
|
32
|
-
import { tokenValueContexts } from "./design-foundation.mjs";
|
|
33
29
|
import { checkPlaceholderContrast, checkProgressContrast } from "./placeholder-contrast.mjs";
|
|
34
30
|
import { fixedLength, lowerLayer, openState, ownsPlacement } from "./lowering-layer.mjs";
|
|
35
31
|
import { RATIO_SUFFIX, focalPosition, intrinsicInlineSize, measuredFallback, measuredProperty, measuredWrites, positions } from "./measured-geometry.mjs";
|
|
36
32
|
import { paintProperty, paintTokens, paintWrites } from "./runtime-paint.mjs";
|
|
37
33
|
import { conditionBound, conditionQueries, geometryOf, tierBelowQuery } from "./spatial-reading.mjs";
|
|
38
|
-
import { FRAME_CORNERS } from "./construction-spec.mjs";
|
|
34
|
+
import { CORNER_RADIUS_FIELDS, cornerRadius, FRAME_CORNERS } from "./construction-spec.mjs";
|
|
39
35
|
import {
|
|
40
36
|
LAYER,
|
|
41
37
|
MARKER_HIDDEN,
|
|
@@ -71,8 +67,6 @@ function arrangementValues(arrangement, slots, profile, overflow = { kind: "visi
|
|
|
71
67
|
const values = {}, scrolls = (axis) => overflow.kind === "scroll" && (overflow.axis === axis || overflow.axis === "both"), { layout } = arrangement;
|
|
72
68
|
if (layout === "native")
|
|
73
69
|
return values;
|
|
74
|
-
if (layout === "prose")
|
|
75
|
-
return { display: "flow-root" };
|
|
76
70
|
if (layout === "layered")
|
|
77
71
|
return { ...layeredValues(arrangement.align, arrangement.justify) };
|
|
78
72
|
if (layout === "inline" || layout === "stack") {
|
|
@@ -175,7 +169,7 @@ function writeStateGeometry(path, element, rest, states, transition, frameOf, co
|
|
|
175
169
|
gaps
|
|
176
170
|
};
|
|
177
171
|
}
|
|
178
|
-
const FRAME_FIELDS = [...FRAME_INSET_FIELDS, ...FRAME_SIDE_WIDTH_FIELDS, BORDER_STYLE, "border-width", "radius", "min-block-size", "block-size", "max-block-size", "inline-size", "min-inline-size", "max-inline-size", ...HIT_AREA_FIELDS], isHitAreaField = (field) => HIT_AREA_FIELDS.some((name) => name === field);
|
|
172
|
+
const CORNER_FIELDS = Object.values(CORNER_RADIUS_FIELDS), FRAME_FIELDS = [...FRAME_INSET_FIELDS, ...FRAME_SIDE_WIDTH_FIELDS, BORDER_STYLE, "border-width", "radius", ...CORNER_FIELDS, "min-block-size", "block-size", "max-block-size", "inline-size", "min-inline-size", "max-inline-size", ...HIT_AREA_FIELDS], isHitAreaField = (field) => HIT_AREA_FIELDS.some((name) => name === field);
|
|
179
173
|
export function frameValues(frame, profile, reject, sides = { kind: "profile" }) {
|
|
180
174
|
profile.only(frame, "frame", FRAME_FIELDS);
|
|
181
175
|
const insets = frameInsets(frame);
|
|
@@ -191,13 +185,23 @@ export function frameValues(frame, profile, reject, sides = { kind: "profile" })
|
|
|
191
185
|
Object.assign(values, border(value));
|
|
192
186
|
for (const side of ["top", "right", "bottom", "left"])
|
|
193
187
|
values[`border-${side}-style`] = frame[BORDER_STYLE] ?? "solid";
|
|
194
|
-
} else if (property === BORDER_STYLE)
|
|
188
|
+
} else if (property === BORDER_STYLE || CORNER_FIELDS.includes(property))
|
|
195
189
|
continue;
|
|
196
190
|
else if (property === "radius")
|
|
197
191
|
values["border-radius"] = value;
|
|
198
192
|
else
|
|
199
193
|
values[property] = value;
|
|
200
194
|
}
|
|
195
|
+
if (CORNER_FIELDS.some((field) => frame[field] !== void 0)) {
|
|
196
|
+
delete values["border-radius"];
|
|
197
|
+
for (const corner of FRAME_CORNERS)
|
|
198
|
+
values[`border-${corner}-radius`] = cornerRadius((field) => frame[field], corner) ?? "0";
|
|
199
|
+
}
|
|
200
|
+
for (const axis of ["inline", "block"]) {
|
|
201
|
+
const size = values[`${axis}-size`];
|
|
202
|
+
if (size !== void 0 && values[`min-${axis}-size`] === void 0 && values[`max-${axis}-size`] === void 0)
|
|
203
|
+
values[`min-${axis}-size`] = size;
|
|
204
|
+
}
|
|
201
205
|
return values;
|
|
202
206
|
}
|
|
203
207
|
function permittedRatio(ratio, slots, profile, reject) {
|
|
@@ -228,10 +232,10 @@ function regionFrameValues(frame, slots, surface, profile, reject) {
|
|
|
228
232
|
Object.assign(values, rules.value);
|
|
229
233
|
}
|
|
230
234
|
if (frame.corners !== null) {
|
|
231
|
-
const radius =
|
|
235
|
+
const named = frame.corners, radius = (corner) => cornerRadius((field) => fields[field], corner) ?? reject({ kind: "profile-field-missing", profile: frameReference ?? "frame", field: "radius" });
|
|
232
236
|
delete values["border-radius"];
|
|
233
237
|
for (const corner of FRAME_CORNERS)
|
|
234
|
-
values[`border-${corner}-radius`] =
|
|
238
|
+
values[`border-${corner}-radius`] = named.includes(corner) ? radius(corner) : "0";
|
|
235
239
|
}
|
|
236
240
|
if (frame.container) {
|
|
237
241
|
values["container-type"] = "inline-size";
|
|
@@ -282,97 +286,6 @@ function anchorClearValues(binding, { profile, slots }) {
|
|
|
282
286
|
return {};
|
|
283
287
|
return { "scroll-margin-block-start": binding.slot === "layer" ? profile.field(profile.of(slots["layer-profile"], "layer", "anchorClear"), "layer", "clear-block-start") : profile.field(profile.of(slots["spacing-profile"], "spacing", "anchorClear"), "spacing", "anchor-gap") };
|
|
284
288
|
}
|
|
285
|
-
function lowerProse(prose, root, context) {
|
|
286
|
-
const { out, profile, slots, foundation, reject } = context, spacing = (binding) => profile.field(profile.of(slots["spacing-profile"], "spacing", "prose"), "spacing", kebab(binding.field)), rhythm = prose.rhythm === null ? null : spacing(prose.rhythm), declared = new Map(prose.elements.map((element) => [element.name, element])), componentBefore = prose.component?.spaceBefore == null ? null : spacing(prose.component.spaceBefore), componentAfter = prose.component?.spaceAfter == null ? null : spacing(prose.component.spaceAfter), following = (level) => ":not(:first-child)".repeat(level), paints = new Map;
|
|
287
|
-
for (const name of PROSE_ELEMENT_NAMES) {
|
|
288
|
-
const element = declared.get(name), block = PROSE_BLOCKS.includes(name);
|
|
289
|
-
if (element === void 0 && (!block || rhythm === null) && Object.keys(proseDefaults(name)).length === 0)
|
|
290
|
-
continue;
|
|
291
|
-
const text = element?.text == null ? {} : profile.of(element.text, "text"), surface = element?.surface == null ? {} : profile.of(element.surface, "surface"), states = (element?.when ?? []).map(([condition, state]) => [condition, profile.of(state, "surface")]);
|
|
292
|
-
if (element !== void 0)
|
|
293
|
-
checkSurfaceEffects(foundation, profile, [element.surface, ...element.when.map(([, state]) => state)], name === "media" ? "visual" : name === "pre" ? "scroller" : "container", reject);
|
|
294
|
-
const frame = element?.frame == null ? {} : frameValues(profile.of(element.frame, "frame"), profile, reject), before = element?.spaceBefore == null ? rhythm : spacing(element.spaceBefore), values = {
|
|
295
|
-
...proseDefaults(name),
|
|
296
|
-
...block && (before !== null || element !== void 0) ? { "margin-block-start": before ?? "0", "margin-block-end": "0" } : {},
|
|
297
|
-
...element?.indent == null ? {} : { "padding-inline-start": spacing(element.indent) },
|
|
298
|
-
...anchorClearValues(element?.anchorClear ?? null, context),
|
|
299
|
-
...text,
|
|
300
|
-
...frame,
|
|
301
|
-
...surface
|
|
302
|
-
};
|
|
303
|
-
for (const tag of PROSE_ELEMENTS[name]) {
|
|
304
|
-
const selector = proseSelector(tag);
|
|
305
|
-
if (Object.keys(values).length > 0)
|
|
306
|
-
out.rule(selector, { ...values });
|
|
307
|
-
for (const [condition, fields] of states)
|
|
308
|
-
out.rule(proseState(selector, condition), { ...fields });
|
|
309
|
-
if (element?.marker != null) {
|
|
310
|
-
const fields = profile.of(element.marker, "surface"), other = Object.keys(fields).find((field) => field !== "color");
|
|
311
|
-
if (other !== void 0 || fields.color === void 0)
|
|
312
|
-
return reject({ kind: "profile-field-unsupported", profile: element.marker, field: other ?? "color", value: other === void 0 ? "" : fields[other] ?? "" });
|
|
313
|
-
out.rule(`${selector}::marker`, { color: fields.color });
|
|
314
|
-
}
|
|
315
|
-
if (element?.markerText != null)
|
|
316
|
-
out.rule(`${selector}::marker`, { "font-weight": profile.field(profile.of(element.markerText, "text"), "text", "font-weight") });
|
|
317
|
-
if (element?.spaceAfter != null) {
|
|
318
|
-
const after = spacing(element.spaceAfter);
|
|
319
|
-
out.rule(`${selector} + :not([class])`, { "margin-block-start": after });
|
|
320
|
-
out.rule(`${selector} + [class]${following(1)}`, { "margin-block-start": componentBefore === null ? after : `max(${after}, ${componentBefore})` });
|
|
321
|
-
for (const next of prose.elements)
|
|
322
|
-
if (next.spaceBefore !== null)
|
|
323
|
-
for (const nextTag of PROSE_ELEMENTS[next.name])
|
|
324
|
-
out.rule(`${selector} + ${nextTag}:not([class])`, { "margin-block-start": `max(${after}, ${spacing(next.spaceBefore)})` });
|
|
325
|
-
}
|
|
326
|
-
if (tag === "ul")
|
|
327
|
-
(element?.markers ?? []).forEach((shape, depth) => out.rule(`& ${"ul:not([class]) ".repeat(depth)}ul:not([class])`, { "list-style-type": shape }));
|
|
328
|
-
}
|
|
329
|
-
if (element !== void 0)
|
|
330
|
-
paints.set(name, { paints: [surface, ...states.map(([, fields]) => fields)].map((fields) => ({ color: fields.color ?? null, background: fields.background ?? null })), text });
|
|
331
|
-
}
|
|
332
|
-
if (rhythm !== null || prose.elements.some((element) => element.spaceBefore !== null))
|
|
333
|
-
for (const selector of PROSE_FIRST)
|
|
334
|
-
out.rule(selector, { "margin-block-start": "0" });
|
|
335
|
-
if (componentBefore !== null || rhythm !== null)
|
|
336
|
-
out.rule(PROSE_COMPONENT, { "margin-block-start": componentBefore ?? rhythm ?? "0" });
|
|
337
|
-
if (componentAfter !== null) {
|
|
338
|
-
out.rule(`& > [class] + :not([class])${following(2)}`, { "margin-block-start": componentAfter });
|
|
339
|
-
out.rule(`& > [class] + [class]${following(3)}`, { "margin-block-start": componentBefore === null ? componentAfter : `max(${componentAfter}, ${componentBefore})` });
|
|
340
|
-
for (const next of prose.elements)
|
|
341
|
-
if (next.spaceBefore !== null)
|
|
342
|
-
for (const tag of PROSE_ELEMENTS[next.name])
|
|
343
|
-
out.rule(`& > [class] + ${tag}:not([class])${following(2)}`, { "margin-block-start": `max(${componentAfter}, ${spacing(next.spaceBefore)})` });
|
|
344
|
-
}
|
|
345
|
-
const base = { color: root.color ?? null, background: root.background ?? null }, colored = [...paints].filter(([, entry]) => entry.paints.some((paint) => paint.color !== null || paint.background !== null));
|
|
346
|
-
if (colored.length === 0)
|
|
347
|
-
return;
|
|
348
|
-
const contexts = tokenValueContexts(foundation), prove = (name, text, foreground, background, on) => {
|
|
349
|
-
if (foreground === null || background === null)
|
|
350
|
-
return;
|
|
351
|
-
for (const tokens of contexts) {
|
|
352
|
-
const minimum = textMinimum({ fontSize: text["font-size"] ?? null, fontWeight: text["font-weight"] ?? null }, tokens), outcome = paintContrast(tokens, { foreground, background }, minimum);
|
|
353
|
-
if (outcome.kind === "insufficient")
|
|
354
|
-
return reject({ kind: "prose-contrast-insufficient", element: name, on, foreground, background, ratio: outcome.ratio, minimum: outcome.minimum, context: tokens.label });
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
for (const [name, entry] of colored) {
|
|
358
|
-
if (name === "rule" || name === "media")
|
|
359
|
-
continue;
|
|
360
|
-
for (const paint of entry.paints)
|
|
361
|
-
prove(name, entry.text, paint.color ?? base.color, paint.background ?? base.background, "the prose root");
|
|
362
|
-
}
|
|
363
|
-
for (const [container, outer] of colored) {
|
|
364
|
-
const [around] = outer.paints;
|
|
365
|
-
if (around === void 0)
|
|
366
|
-
continue;
|
|
367
|
-
for (const inner of proseContents(container)) {
|
|
368
|
-
const entry = paints.get(inner);
|
|
369
|
-
if (entry === void 0 || inner === "rule" || inner === "media")
|
|
370
|
-
continue;
|
|
371
|
-
for (const paint of entry.paints)
|
|
372
|
-
prove(inner, entry.text, paint.color ?? around.color ?? base.color, paint.background ?? around.background ?? base.background, `inside ${container}`);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
289
|
function partMotion(path, effects, { out, profile, slots, reject }) {
|
|
377
290
|
if (effects === null)
|
|
378
291
|
return null;
|
|
@@ -422,34 +335,68 @@ function pseudoColor(treatment, surface, profile, reject) {
|
|
|
422
335
|
return reject({ kind: "pseudo-surface-unsupported", pseudo: treatment.pseudo, surface, field: other });
|
|
423
336
|
return fields.color ?? reject({ kind: "pseudo-surface-unsupported", pseudo: treatment.pseudo, surface, field: null });
|
|
424
337
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
338
|
+
const PSEUDO_TEXT_FIELDS = ["font-weight", "font-feature-settings"];
|
|
339
|
+
function pseudoText(treatment, text, profile, reject) {
|
|
340
|
+
const fields = profile.of(text, "text"), other = Object.keys(fields).find((field) => !PSEUDO_TEXT_FIELDS.includes(field));
|
|
341
|
+
if (other !== void 0)
|
|
342
|
+
return reject({ kind: "pseudo-surface-unsupported", pseudo: treatment.pseudo, surface: text, field: other });
|
|
343
|
+
return { ...fields };
|
|
344
|
+
}
|
|
345
|
+
const cssString = (text) => `"${text.replace(/[\\"]/g, (character) => `\\${character}`)}"`;
|
|
346
|
+
export function contentValue(content) {
|
|
347
|
+
const value = content.kind === "counter" ? `counter(${content.name}, ${content.style})` : `counters(${content.name}, ${cssString(content.separator)}, ${content.style})`;
|
|
348
|
+
return [...content.prefix === "" ? [] : [cssString(content.prefix)], value, ...content.suffix === "" ? [] : [cssString(content.suffix)]].join(" ");
|
|
349
|
+
}
|
|
350
|
+
function writeBetween(out, path, between, axis, profile, reject) {
|
|
351
|
+
if (between === null)
|
|
352
|
+
return;
|
|
353
|
+
const frame = profile.of(between.frame, "frame"), width = frame["border-width"] ?? reject({ kind: "profile-field-missing", profile: between.frame, field: "borderWidth" }), color = profile.of(between.surface, "surface")["border-color"] ?? reject({ kind: "profile-field-missing", profile: between.surface, field: "borderColor" }), side = `border-${axis}-start`;
|
|
354
|
+
out.rule(`${path} > * + *`, { [`${side}-width`]: width, [`${side}-style`]: frame[BORDER_STYLE] ?? "solid", [`${side}-color`]: color });
|
|
355
|
+
}
|
|
356
|
+
const ASSISTIVE_ONLY = { position: "absolute", "inline-size": "1px", "block-size": "1px", overflow: "hidden", "clip-path": "inset(50%)", "white-space": "nowrap" }, counterValues = (counter) => counter === null ? {} : { ...counter.reset === null ? {} : { "counter-reset": counter.reset }, ...counter.increment === null ? {} : { "counter-increment": counter.increment } };
|
|
357
|
+
function writeMarkerStyles(out, styles) {
|
|
358
|
+
styles.forEach((style, depth) => out.rule(`&${" li &".repeat(depth)}`, { "list-style-type": style }));
|
|
359
|
+
}
|
|
360
|
+
function pseudoRules(name, treatments, path, fills, context, hasBox) {
|
|
361
|
+
const { out, profile, reject, foundation } = context;
|
|
362
|
+
for (const treatment of treatments)
|
|
428
363
|
switch (treatment.pseudo) {
|
|
429
364
|
case "placeholder": {
|
|
430
|
-
const suffix = "::placeholder", base = pseudoColor(treatment,
|
|
365
|
+
const suffix = "::placeholder", surface = treatment.surface ?? "", base = pseudoColor(treatment, surface, profile, reject), states = treatment.when.map(([condition, state]) => ({ condition, value: pseudoColor(treatment, state, profile, reject) }));
|
|
431
366
|
out.rule(`${path}${suffix}`, { color: base, opacity: "1" });
|
|
432
367
|
for (const { condition, value } of states)
|
|
433
368
|
out.rule(`${under(condition, path)}${suffix}`, { color: value });
|
|
434
|
-
const checked = checkPlaceholderContrast(foundation,
|
|
369
|
+
const checked = checkPlaceholderContrast(foundation, name, [{ condition: null, value: base }, ...states], fills);
|
|
435
370
|
if (checked.kind === "err")
|
|
436
371
|
return reject(checked.error);
|
|
437
372
|
break;
|
|
438
373
|
}
|
|
439
374
|
case "progressValue": {
|
|
440
|
-
const base = pseudoFill(treatment,
|
|
441
|
-
out.rule(path, { appearance: "none", "-webkit-appearance": "none", ...
|
|
375
|
+
const surface = treatment.surface ?? "", base = pseudoFill(treatment, surface, profile, reject), states = treatment.when.map(([condition, state]) => ({ condition, value: pseudoFill(treatment, state, profile, reject) }));
|
|
376
|
+
out.rule(path, { appearance: "none", "-webkit-appearance": "none", ...hasBox ? {} : { "border-style": "none" } });
|
|
442
377
|
out.rule(`${path}::-webkit-progress-bar`, { background: "transparent" });
|
|
443
378
|
for (const suffix of PROGRESS_FILLS) {
|
|
444
379
|
out.rule(`${path}${suffix}`, { background: base, "border-radius": "inherit" });
|
|
445
380
|
for (const { condition, value } of states)
|
|
446
381
|
out.rule(`${under(condition, path)}${suffix}`, { background: value });
|
|
447
382
|
}
|
|
448
|
-
const checked = checkProgressContrast(foundation,
|
|
383
|
+
const checked = checkProgressContrast(foundation, name, [{ condition: null, value: base }, ...states], fills);
|
|
449
384
|
if (checked.kind === "err")
|
|
450
385
|
return reject(checked.error);
|
|
451
386
|
break;
|
|
452
387
|
}
|
|
388
|
+
case "marker":
|
|
389
|
+
case "before": {
|
|
390
|
+
const suffix = `::${treatment.pseudo}`, values = {
|
|
391
|
+
...treatment.content === null ? {} : { content: contentValue(treatment.content) },
|
|
392
|
+
...treatment.surface === null ? {} : { color: pseudoColor(treatment, treatment.surface, profile, reject) },
|
|
393
|
+
...treatment.text === null ? {} : pseudoText(treatment, treatment.text, profile, reject)
|
|
394
|
+
};
|
|
395
|
+
out.rule(`${path}${suffix}`, values);
|
|
396
|
+
for (const [condition, state] of treatment.when)
|
|
397
|
+
out.rule(`${under(condition, path)}${suffix}`, { color: pseudoColor(treatment, state, profile, reject) });
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
453
400
|
}
|
|
454
401
|
}
|
|
455
402
|
const PROGRESS_FILLS = ["::-webkit-progress-value", "::-moz-progress-bar"];
|
|
@@ -509,14 +456,24 @@ function lowerParts(parts, parent, layout, gap, context, parentGrows = !1, overl
|
|
|
509
456
|
"outline-style": "solid"
|
|
510
457
|
});
|
|
511
458
|
}
|
|
459
|
+
for (const part of parts) {
|
|
460
|
+
const drawing = part.drawnBy === null ? void 0 : parts.find((other) => other.name === part.drawnBy);
|
|
461
|
+
if (drawing === void 0)
|
|
462
|
+
continue;
|
|
463
|
+
const size = drawing.box === null ? {} : frameValues(context.profile.of(drawing.box, "frame"), context.profile, context.reject), inline = size["inline-size"], block = size["block-size"];
|
|
464
|
+
if (inline === void 0 || block === void 0)
|
|
465
|
+
return context.reject({ kind: "profile-field-missing", profile: drawing.box ?? drawing.name, field: inline === void 0 ? "inlineSize" : "blockSize" });
|
|
466
|
+
context.out.rule(`${parent} > ${part.selector}`, { position: "absolute", "inline-size": inline, "block-size": block, "margin-block": "0", "margin-inline": "0", opacity: "0", "z-index": "1" });
|
|
467
|
+
}
|
|
468
|
+
writePartSpace(parts, parent, layout, gap, context);
|
|
512
469
|
const lowered = parts.map((part) => lowerPart(part, parent, layout, context, parentGrows, overlapping));
|
|
513
470
|
if (layout !== "inline" && layout !== "stack")
|
|
514
471
|
return;
|
|
515
472
|
const axes = layout === "inline" ? ["inline"] : ["block"];
|
|
516
|
-
lowered.
|
|
517
|
-
const second = lowered[index + 1];
|
|
518
|
-
|
|
519
|
-
|
|
473
|
+
lowered.flatMap((first, index) => {
|
|
474
|
+
const own = first !== null && parts[index]?.repeat === !0 ? [[first, first]] : [], second = lowered[index + 1];
|
|
475
|
+
return first === null || second === null || second === void 0 ? own : [...own, [first, second]];
|
|
476
|
+
}).forEach(([first, second]) => {
|
|
520
477
|
if (overlapping !== null)
|
|
521
478
|
return context.reject({ kind: "state-geometry-unsupported", element: parent === "&" ? "&" : parent, reason: "targets-overlap", detail: `${first.element} and ${second.element}` });
|
|
522
479
|
for (const axis of axes)
|
|
@@ -524,12 +481,44 @@ function lowerParts(parts, parent, layout, gap, context, parentGrows = !1, overl
|
|
|
524
481
|
context.neighbours.push({ axis, gap: between, first, second });
|
|
525
482
|
});
|
|
526
483
|
}
|
|
484
|
+
function writePartSpace(parts, parent, layout, gap, context) {
|
|
485
|
+
const { out, profile, slots } = context, own = (part, side) => {
|
|
486
|
+
const binding = side === "before" ? part.spaceBefore : part.spaceAfter;
|
|
487
|
+
if (binding !== null)
|
|
488
|
+
return profile.field(profile.of(slots["spacing-profile"], "spacing", "space"), "spacing", kebab(binding.field));
|
|
489
|
+
return part.spacing === null ? null : profile.of(part.spacing, "spacing", part.name)[`space-${side}`] ?? null;
|
|
490
|
+
}, spaced = parts.flatMap((part) => {
|
|
491
|
+
const before = own(part, "before"), after = own(part, "after");
|
|
492
|
+
if (part.spacing !== null && before === null && after === null)
|
|
493
|
+
return context.reject({ kind: "profile-field-missing", profile: part.spacing, field: "spaceBefore" });
|
|
494
|
+
return before === null && after === null ? [] : [{ part, before, after }];
|
|
495
|
+
}), [first] = spaced;
|
|
496
|
+
if (first === void 0)
|
|
497
|
+
return;
|
|
498
|
+
if (layout !== "stack" && layout !== "native")
|
|
499
|
+
return context.reject({ kind: "space-parent-unsupported", part: first.part.name, layout });
|
|
500
|
+
const between = gap ?? "0px", margin = (space) => ({ "margin-block-start": `calc(${space} - ${between})` });
|
|
501
|
+
for (const { part, before, after } of spaced) {
|
|
502
|
+
if (before !== null)
|
|
503
|
+
out.rule(`${parent} > * + ${part.selector}:not(:first-child)`, margin(before));
|
|
504
|
+
if (after !== null)
|
|
505
|
+
out.rule(`${parent} > ${part.selector} + :not(:first-child):not(:first-child)`, margin(after));
|
|
506
|
+
}
|
|
507
|
+
for (const previous of spaced)
|
|
508
|
+
for (const next of spaced)
|
|
509
|
+
if (previous.after !== null && next.before !== null)
|
|
510
|
+
out.rule(`${parent} > ${previous.part.selector} + ${next.part.selector}:not(:first-child):not(:first-child)`, margin(`max(${previous.after}, ${next.before})`));
|
|
511
|
+
}
|
|
527
512
|
function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping = null) {
|
|
528
513
|
const { out, profile, slots, reject } = context, path = `${parent} > ${part.selector}`;
|
|
529
514
|
if (part.content.kind === "vector") {
|
|
530
515
|
lowerVector(part, part.content.stroke, path, context);
|
|
531
516
|
return null;
|
|
532
517
|
}
|
|
518
|
+
if (part.content.kind === "component") {
|
|
519
|
+
writeConditioned(part, path, checked(extentValues(part.extent, parentLayout, part.name, parentGrows), reject), context);
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
533
522
|
const partSurface = part.surface === null ? {} : profile.of(part.surface, "surface"), moving = partMotion(path, part.effects, context), collapsible = part.collapsed || part.geometryWhen.some((state) => state.collapsed !== null), axis = parentLayout === "inline" ? "inline" : parentLayout === "stack" ? "block" : null;
|
|
534
523
|
if (collapsible) {
|
|
535
524
|
if (axis === null)
|
|
@@ -584,7 +573,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
584
573
|
Object.assign(values, { "box-sizing": "border-box" }, boxFields);
|
|
585
574
|
let target = null, frameFields = {};
|
|
586
575
|
if (part.frame !== null) {
|
|
587
|
-
const lineHeight = profile.field(
|
|
576
|
+
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);
|
|
588
577
|
frameFields = controlBoxValues(box);
|
|
589
578
|
if (part.frame.border.kind === "rules") {
|
|
590
579
|
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);
|
|
@@ -602,7 +591,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
602
591
|
element: part.name,
|
|
603
592
|
frame: frameTarget(frame, box, profile.field),
|
|
604
593
|
hitArea,
|
|
605
|
-
content: { kind: "field", line: { lineHeight, fontSize:
|
|
594
|
+
content: { kind: "field", line: { lineHeight, fontSize: lineText["font-size"] ?? null } },
|
|
606
595
|
measured: measuredBounds(part.measured, values)
|
|
607
596
|
};
|
|
608
597
|
context.targets.push(target);
|
|
@@ -634,6 +623,9 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
634
623
|
if (twice !== void 0)
|
|
635
624
|
return reject({ kind: "extent-conflict", element: part.name, property: twice[0], providers: ["recipe.normalize.when", "normalize"] });
|
|
636
625
|
add(normalizedDeclarations(part.normalize), "normalize");
|
|
626
|
+
const pathKey = path.split(" > ").slice(1).join(" "), ownMargin = Object.keys(values).some((property) => property.startsWith("margin")) || (context.rootNormalized.get(path) ?? []).some((property) => property.startsWith("margin"));
|
|
627
|
+
if (context.input.margined?.includes(pathKey) === !0 && !ownMargin)
|
|
628
|
+
out.rule(path, { margin: "0" });
|
|
637
629
|
const media = part.measured.some((value) => value.type === "position" || value.type === "intrinsic-size") && part.content.kind === "visual" && visualOf(context.input, part.name)?.kind === "content-media" ? covers(profile.of(slots["visual-profile"], "visual", "visual")) ? "cover" : "contain" : null;
|
|
638
630
|
Object.assign(values, checked(measuredWrites(context.input.scope, part.measured, part.name, values, part.frame !== null ? supplied(slots, frameFields) : null, media), reject));
|
|
639
631
|
Object.assign(values, paintValues(part.name, part.paints, "box", [part.surface], part.when, context));
|
|
@@ -641,15 +633,25 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
641
633
|
const conditioned = conditionedVisual(part, context);
|
|
642
634
|
if (part.scheme !== null && visualOf(context.input, part.name)?.kind !== "content-media")
|
|
643
635
|
return reject({ kind: "scheme-unsupported", part: part.name });
|
|
644
|
-
|
|
636
|
+
const unrendered = part.content.kind === "visual" && (!part.required || context.withinOptional === !0) && visualOf(context.input, part.name) === null;
|
|
637
|
+
if (part.content.kind === "visual" && !unrendered)
|
|
645
638
|
lowerVisual(path, context, part.measured.find((value) => value.type === "intrinsic-size") ?? null, conditioned, part.scheme, boxFields, part.name);
|
|
646
639
|
if (snapped !== null)
|
|
647
640
|
out.rule(`${path} > *`, { ...snapped.children });
|
|
648
641
|
stateRules(out, path, part.when, profile, entering?.blurred ?? !1);
|
|
649
642
|
for (const [condition, normalized] of part.normalizeWhen)
|
|
650
643
|
out.rule(under(condition, path), normalizedDeclarations(normalized));
|
|
651
|
-
|
|
652
|
-
|
|
644
|
+
{
|
|
645
|
+
const background = (surface) => surface === null ? null : profile.of(surface, "surface").background ?? null, fills = [{ condition: null, value: background(part.surface) }, ...part.when.map(([condition, surface]) => ({ condition, value: background(surface) }))];
|
|
646
|
+
pseudoRules(part.name, part.pseudo, path, fills, context, part.box !== null);
|
|
647
|
+
const counted = counterValues(part.counter);
|
|
648
|
+
if (Object.keys(counted).length > 0)
|
|
649
|
+
out.rule(path, counted);
|
|
650
|
+
writeBetween(out, path, part.between, part.arrangement?.layout === "inline" ? "inline" : "block", profile, reject);
|
|
651
|
+
if (part.presence === "assistive")
|
|
652
|
+
out.rule(path, { ...ASSISTIVE_ONLY });
|
|
653
|
+
}
|
|
654
|
+
lowerParts(part.parts, path, part.arrangement?.layout ?? "native", values.gap, part.required && context.withinOptional !== !0 ? context : { ...context, withinOptional: !0 }, growsWithContent(values), partGeometry.overlap, partGeometry.gaps);
|
|
653
655
|
return target;
|
|
654
656
|
}
|
|
655
657
|
const visualOf = (input, part) => input.visuals?.get(part) ?? input.visual;
|
|
@@ -823,6 +825,13 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
823
825
|
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);
|
|
824
826
|
transitionRules("&", spec.paintTransition, surface === null ? null : { name: surface, fields: rootSurface }, spec.when, context, entering === null ? rootGroups : [...rootGroups, entering.group]);
|
|
825
827
|
writePlays(out, profile, foundation, "&", spec.plays, "&", transitioned(spec.paintTransition, entering === null ? rootGroups : [...rootGroups, entering.group]), reject);
|
|
828
|
+
const rootFill = (name) => name === null ? null : profile.of(name, "surface").background ?? null;
|
|
829
|
+
pseudoRules("&", spec.pseudo, "&", [{ condition: null, value: rootFill(surface) }, ...spec.when.map(([condition, name]) => ({ condition, value: rootFill(name) }))], context, spec.frame !== null);
|
|
830
|
+
const rootCounters = counterValues(spec.counter);
|
|
831
|
+
if (Object.keys(rootCounters).length > 0)
|
|
832
|
+
out.rule("&", rootCounters);
|
|
833
|
+
writeMarkerStyles(out, spec.markers);
|
|
834
|
+
writeBetween(out, "&", spec.between, spec.arrangement.layout === "inline" ? "inline" : "block", profile, reject);
|
|
826
835
|
const { arrangement } = spec, values = arrangement.layout !== "native" || spec.frame !== null ? { "box-sizing": "border-box", "min-inline-size": "0" } : {};
|
|
827
836
|
let exposed = null;
|
|
828
837
|
if (spec.exposeRows.length > 0) {
|
|
@@ -912,8 +921,6 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
912
921
|
for (const [selector, normalized] of spec.normalizeWhen)
|
|
913
922
|
out.rule(selector, normalizedDeclarations(normalized));
|
|
914
923
|
stateRules(out, "&", spec.when, profile, entering?.blurred ?? !1);
|
|
915
|
-
if (spec.prose !== null)
|
|
916
|
-
lowerProse(spec.prose, rootSurface, context);
|
|
917
924
|
const partLayout = spec.exposeRows.length > 0 ? "grid" : arrangement.layout;
|
|
918
925
|
lowerParts(spec.parts, "&", partLayout, values.gap, context, growsWithContent(values), rootGeometry.overlap, rootGeometry.gaps);
|
|
919
926
|
return out.finish({ kind: "region", artwork: placedArtwork[0] ?? null, artworks: placedByPart, exposed, targets: { elements: targets, neighbours } }, input.hidden);
|
|
@@ -112,6 +112,10 @@ declare const tokenRolesByKind: {
|
|
|
112
112
|
frame: {
|
|
113
113
|
"border-width": string[];
|
|
114
114
|
radius: string[];
|
|
115
|
+
"start-start-radius": string[];
|
|
116
|
+
"start-end-radius": string[];
|
|
117
|
+
"end-start-radius": string[];
|
|
118
|
+
"end-end-radius": string[];
|
|
115
119
|
padding: string[];
|
|
116
120
|
"padding-inline": string[];
|
|
117
121
|
"padding-block": string[];
|
|
@@ -137,6 +141,7 @@ declare const tokenRolesByKind: {
|
|
|
137
141
|
background: string[];
|
|
138
142
|
color: string[];
|
|
139
143
|
"border-color": string[];
|
|
144
|
+
"text-decoration-color": string[];
|
|
140
145
|
"box-shadow": string[];
|
|
141
146
|
"background-image": string[];
|
|
142
147
|
opacity: string[];
|
|
@@ -159,6 +164,8 @@ declare const tokenRolesByKind: {
|
|
|
159
164
|
"meta-gap": string[];
|
|
160
165
|
"section-gap": string[];
|
|
161
166
|
indent: string[];
|
|
167
|
+
"space-before": string[];
|
|
168
|
+
"space-after": string[];
|
|
162
169
|
overlap: string[];
|
|
163
170
|
"anchor-gap": string[];
|
|
164
171
|
"outset-block": string[];
|
package/dist/role-vocabulary.mjs
CHANGED
|
@@ -135,6 +135,10 @@ const tokenRolesByKind = {
|
|
|
135
135
|
frame: {
|
|
136
136
|
"border-width": ["border-width"],
|
|
137
137
|
radius: ["radius"],
|
|
138
|
+
"start-start-radius": ["radius"],
|
|
139
|
+
"start-end-radius": ["radius"],
|
|
140
|
+
"end-start-radius": ["radius"],
|
|
141
|
+
"end-end-radius": ["radius"],
|
|
138
142
|
padding: ["frame-inset"],
|
|
139
143
|
"padding-inline": ["frame-inset"],
|
|
140
144
|
"padding-block": ["frame-inset"],
|
|
@@ -160,6 +164,7 @@ const tokenRolesByKind = {
|
|
|
160
164
|
background: ["paint"],
|
|
161
165
|
color: ["paint"],
|
|
162
166
|
"border-color": ["paint"],
|
|
167
|
+
"text-decoration-color": ["paint"],
|
|
163
168
|
"box-shadow": ["shadow"],
|
|
164
169
|
"background-image": ["gradient"],
|
|
165
170
|
opacity: ["opacity"],
|
|
@@ -182,6 +187,8 @@ const tokenRolesByKind = {
|
|
|
182
187
|
"meta-gap": ["content-gap", "spacing"],
|
|
183
188
|
"section-gap": ["content-gap", "spacing"],
|
|
184
189
|
indent: ["content-gap", "spacing"],
|
|
190
|
+
"space-before": ["content-gap", "spacing"],
|
|
191
|
+
"space-after": ["content-gap", "spacing"],
|
|
185
192
|
overlap: ["overlap", "content-gap", "spacing"],
|
|
186
193
|
"anchor-gap": ["layout-size", "content-gap", "spacing"],
|
|
187
194
|
"outset-block": ["content-gap", "spacing", "box-share"],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { selectedProfile, tokenValueContexts } from "./design-foundation.mjs";
|
|
2
|
-
import { inactiveCondition, NON_TEXT_MINIMUM, paintContrast } from "./paint-contrast.mjs";
|
|
2
|
+
import { inactiveCondition, NON_TEXT_MINIMUM, paintContrast, unshown } from "./paint-contrast.mjs";
|
|
3
3
|
import { describeUnresolved, surfacedElements, textMinimum } from "./surface-contrast.mjs";
|
|
4
4
|
import { err, ok } from "./result.mjs";
|
|
5
5
|
import { isPaintProperty } from "./runtime-paint.mjs";
|
|
@@ -68,7 +68,10 @@ export function runtimePaintContrast(foundation, spec) {
|
|
|
68
68
|
}
|
|
69
69
|
for (const pair of checked)
|
|
70
70
|
for (const context of contexts) {
|
|
71
|
-
const minimum = pair.minimum(context)
|
|
71
|
+
const minimum = pair.minimum(context);
|
|
72
|
+
if (unshown(pair.paints.foreground, context))
|
|
73
|
+
continue;
|
|
74
|
+
const outcome = paintContrast(context, pair.paints, minimum);
|
|
72
75
|
switch (outcome.kind) {
|
|
73
76
|
case "sufficient":
|
|
74
77
|
break;
|