@reqvire-org/ads 0.5.4 → 0.5.5
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 +105 -8
- package/dist/analysis/client-directive.mjs +26 -0
- package/dist/analysis/externals.mjs +47 -0
- package/dist/analysis/module-graph.mjs +6 -0
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +12 -2
- package/dist/analysis/owner-composition.mjs +19 -4
- package/dist/analysis/owner-source.mjs +112 -15
- package/dist/border-paint.mjs +34 -0
- package/dist/check.mjs +2 -0
- package/dist/composed-contrast.mjs +10 -7
- package/dist/construction-output.mjs +52 -27
- package/dist/construction-spec.d.mts +40 -10
- package/dist/construction-spec.mjs +41 -17
- package/dist/corner-overpaint.mjs +3 -1
- package/dist/design-foundation.mjs +14 -0
- package/dist/emit/owner-emission-cache.mjs +1 -1
- package/dist/end-alignment.mjs +69 -0
- package/dist/external-macro.d.mts +20 -0
- package/dist/external-macro.mjs +12 -0
- package/dist/finding-rules.mjs +3 -0
- package/dist/forced-colors.mjs +81 -0
- package/dist/frame-regions.mjs +2 -2
- package/dist/guard/externals.mjs +64 -0
- package/dist/guard/run.mjs +9 -5
- package/dist/inventories.mjs +1 -1
- package/dist/lowering-layer.mjs +38 -4
- package/dist/lowering-overlaps.mjs +7 -0
- package/dist/lowering-properties.mjs +1 -0
- package/dist/lowering-region-layout.mjs +22 -3
- package/dist/lowering-session.mjs +1 -1
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-widget.bundle.js +12 -12
- package/dist/measured-geometry.mjs +8 -2
- package/dist/owner-analysis-check.mjs +190 -11
- package/dist/owner-errors.mjs +3 -0
- package/dist/owner-lowering.mjs +3 -2
- package/dist/ownership-model.mjs +6 -3
- package/dist/platform-features.mjs +1 -0
- package/dist/preview-bun.mjs +15 -2
- package/dist/profile-macro.d.mts +18 -0
- package/dist/recipe-macro.d.mts +49 -6
- package/dist/recipe-model.mjs +13 -5
- package/dist/region-lowering.mjs +115 -22
- package/dist/render-audit/axe-run.page.mjs +40 -1
- package/dist/render-audit/forced-states.page.mjs +37 -0
- package/dist/render-audit/layout-overflow.page.mjs +52 -2
- package/dist/render-audit/non-text-contrast.page.mjs +14 -10
- package/dist/render-audit/worker.mjs +38 -0
- package/dist/render-audit.mjs +42 -5
- package/dist/role-vocabulary.d.mts +2 -2
- package/dist/role-vocabulary.mjs +3 -3
- package/dist/scenario-kit.d.mts +2 -2
- package/dist/showcase/assets-view.mjs +12 -47
- package/dist/showcase/client.bundle.js +54 -54
- package/dist/showcase/http-client.bundle.js +18 -18
- package/dist/showcase/token-sample.mjs +2 -2
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +13 -13
- package/dist/skills/ads-designer/references/accessibility.md +21 -1
- package/dist/skills/ads-designer/references/branding.md +4 -0
- package/dist/skills/ads-designer/references/design-data.md +6 -0
- package/dist/skills/ads-designer/references/layers.md +5 -0
- package/dist/skills/ads-designer/references/layout.md +8 -1
- package/dist/skills/ads-designer/references/recipes.md +36 -0
- package/dist/skills/ads-designer/references/runtimes.md +4 -0
- package/dist/skills/ads-designer/references/scenarios.md +2 -0
- package/dist/skills/ads-import/references/design-data.md +6 -0
- package/dist/skills/ads-import/references/layers.md +5 -0
- package/dist/skills/ads-import/references/layout.md +8 -1
- package/dist/skills/ads-import/references/recipes.md +36 -0
- package/dist/skills/ads-import/references/runtimes.md +4 -0
- package/dist/skills/ads-import/references/scenarios.md +2 -0
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.5.4-to-0.5.5.md +61 -0
- package/dist/skills/ads-port/references/design-data.md +6 -0
- package/dist/skills/ads-port/references/layers.md +5 -0
- package/dist/skills/ads-port/references/layout.md +8 -1
- package/dist/skills/ads-port/references/recipes.md +36 -0
- package/dist/skills/ads-port/references/runtimes.md +4 -0
- package/dist/skills/ads-port/references/scenarios.md +2 -0
- package/dist/spatial-model.mjs +37 -10
- package/dist/system-colors.d.mts +9 -0
- package/dist/system-colors.mjs +1 -0
- package/dist/target-size.mjs +14 -1
- package/dist/tsconfig.declarations.json +1 -0
- package/docs/ADS.md +23 -1
- package/docs/ASSETS.md +21 -0
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +167 -21
- package/docs/GUIDE.md +31 -20
- package/docs/LANGUAGE.md +118 -6
- package/docs/PROFILE-KINDS.md +50 -4
- package/docs/RULES.md +21 -8
- package/package.json +5 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { endInsetOf, stackPartsOf } from "../end-alignment.mjs";
|
|
2
|
+
import { borderPaintMissing } from "../border-paint.mjs";
|
|
3
|
+
import { CLIENT_DIRECTIVE, clientNeed, writtenDirective } from "./client-directive.mjs";
|
|
4
|
+
import { forcedBoundaryMissing, forcedStateFillOnly } from "../forced-colors.mjs";
|
|
1
5
|
import path from "node:path";
|
|
2
6
|
import {
|
|
3
7
|
ScriptTarget,
|
|
@@ -33,6 +37,7 @@ import {
|
|
|
33
37
|
isPropertyAssignment,
|
|
34
38
|
isReturnStatement,
|
|
35
39
|
isShorthandPropertyAssignment,
|
|
40
|
+
isNoSubstitutionTemplateLiteral,
|
|
36
41
|
isStringLiteral,
|
|
37
42
|
isVariableDeclaration,
|
|
38
43
|
isVariableDeclarationList,
|
|
@@ -94,7 +99,8 @@ import { digest } from "../digest.mjs";
|
|
|
94
99
|
import { FOUNDATION_DECLARATION } from "../design-contexts.mjs";
|
|
95
100
|
import { cornerOverpaint } from "../corner-overpaint.mjs";
|
|
96
101
|
import { inactiveSurfaceActive, stateContrast, surfacedElements, surfaceUses } from "../surface-contrast.mjs";
|
|
97
|
-
import { compositionFacts, plainPlacements } from "./owner-composition.mjs";
|
|
102
|
+
import { componentTarget, compositionFacts, plainPlacements } from "./owner-composition.mjs";
|
|
103
|
+
import { EXTERNAL_MARKER, externalDeclarations } from "./externals.mjs";
|
|
98
104
|
import { ownerControls } from "./owner-controls.mjs";
|
|
99
105
|
import { pressScaleReviews } from "../press-scale.mjs";
|
|
100
106
|
import { nonTextContrast } from "../non-text-contrast.mjs";
|
|
@@ -118,6 +124,35 @@ import { frameworkMismatches } from "./framework-imports.mjs";
|
|
|
118
124
|
import { CONTROLLER_FOLDER, controllerGateFailures } from "./controller-gates.mjs";
|
|
119
125
|
import { isDevelopmentModule } from "../development-modules.mjs";
|
|
120
126
|
import { cssInJsImports, scriptAnimations, ownerStyleWrites, ownerStylesheetImports, plainModuleStyling, scenarioStyling, stylingFailure, unemittedStyling } from "./styling-ownership.mjs";
|
|
127
|
+
function componentRootOf(file, opening) {
|
|
128
|
+
let node = elementOf(opening), fn;
|
|
129
|
+
for (;; ) {
|
|
130
|
+
const parent = node.parent;
|
|
131
|
+
if (parent === void 0)
|
|
132
|
+
return null;
|
|
133
|
+
if (isParenthesizedExpression(parent) || isConditionalExpression(parent) && parent.condition !== node || isBinaryExpression(parent) && parent.right === node && parent.operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) {
|
|
134
|
+
node = parent;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (isReturnStatement(parent)) {
|
|
138
|
+
fn = parent.parent;
|
|
139
|
+
while (fn !== void 0 && fn.kind !== SyntaxKind.FunctionDeclaration && fn.kind !== SyntaxKind.ArrowFunction && fn.kind !== SyntaxKind.FunctionExpression)
|
|
140
|
+
fn = fn.parent;
|
|
141
|
+
} else if (parent.kind === SyntaxKind.ArrowFunction)
|
|
142
|
+
fn = parent;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
if (fn === void 0)
|
|
146
|
+
return null;
|
|
147
|
+
if (fn.kind === SyntaxKind.FunctionDeclaration && fn.parent?.kind === SyntaxKind.SourceFile) {
|
|
148
|
+
const declared = fn.name;
|
|
149
|
+
return declared !== void 0 && isIdentifier(declared) ? `${file}#${declared.text}` : null;
|
|
150
|
+
}
|
|
151
|
+
const holder = fn.parent;
|
|
152
|
+
if (holder !== void 0 && isVariableDeclaration(holder) && holder.parent?.parent?.parent?.kind === SyntaxKind.SourceFile && isIdentifier(holder.name))
|
|
153
|
+
return `${file}#${holder.name.text}`;
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
121
156
|
export const PUBLIC_BARREL = "index.ts", AMBIENT_DECLARATIONS = "env.d.ts", ownerCompilerOptions = (root, publicAlias, framework) => ({
|
|
122
157
|
target: ScriptTarget.ESNext,
|
|
123
158
|
module: ModuleKind.ESNext,
|
|
@@ -626,6 +661,13 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
626
661
|
review(opening, { kind: "marker-none-unlabelled", part: partName });
|
|
627
662
|
return;
|
|
628
663
|
}
|
|
664
|
+
case "document": {
|
|
665
|
+
if (attr(opening, "lang") === void 0)
|
|
666
|
+
return fail(opening, { kind: "document-lang-missing" });
|
|
667
|
+
if (!descendants(opening).some((other) => lowercaseTag(other) && values.tag(other) === "body"))
|
|
668
|
+
return fail(opening, { kind: "part-element-mismatch", part: partName, expected: ["<html> with <body> inside"], actual: "<html> without <body>" });
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
629
671
|
case "iframe":
|
|
630
672
|
case "select":
|
|
631
673
|
case "table":
|
|
@@ -887,9 +929,12 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
887
929
|
const hidden = attr(opening, "hidden") === void 0 ? [] : [{ kind: "root" }], guardChild = (fact, selector, within = []) => {
|
|
888
930
|
if (attr(fact.opening, "hidden") !== void 0 && fact.classes.fragments.length === 0)
|
|
889
931
|
hidden.push(within.length === 0 ? { kind: "part", selector } : { kind: "part", selector, within });
|
|
890
|
-
}, parts = declaredParts(parsed.value), declaredMarkers = new Set([...parts.map((part) => part.selector.slice(1)), ...declaredCells(parsed.value).map((cell) => cell.slice(1))]);
|
|
932
|
+
}, native = new Set, parts = declaredParts(parsed.value), declaredMarkers = new Set([...parts.map((part) => part.selector.slice(1)), ...declaredCells(parsed.value).map((cell) => cell.slice(1))]);
|
|
891
933
|
if (parsed.value.kind === "region") {
|
|
892
|
-
const region = parsed.value, rootTag = values.tag(opening)
|
|
934
|
+
const region = parsed.value, rootTag = values.tag(opening);
|
|
935
|
+
if (UA_CONTROL_TAGS.includes(rootTag))
|
|
936
|
+
native.add("&");
|
|
937
|
+
const rootless = region.pseudo.find((treatment) => !pseudoHosted(treatment.pseudo, rootTag));
|
|
893
938
|
if (rootless !== void 0)
|
|
894
939
|
return fail(opening, { kind: "pseudo-host-unsupported", part: "&", pseudo: rootless.pseudo, element: rootTag });
|
|
895
940
|
await nativeElement(opening, region.element, "&", null, context, resolve);
|
|
@@ -900,6 +945,7 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
900
945
|
}
|
|
901
946
|
const matched = new Map([["", opening]]), tinted = new Set(parsed.value.kind === "region" ? surfacedElements(foundation, parsed.value).flatMap((element) => element.visual && (element.surface !== null || element.when.length > 0) ? [element.element] : []) : []), decorative = new Set, margined = new Set;
|
|
902
947
|
let schemed = !1;
|
|
948
|
+
const schemedBindings = new Map, placedParts = [];
|
|
903
949
|
for (const part of parts) {
|
|
904
950
|
if (!/^\.[\w-]+$/.test(part.selector))
|
|
905
951
|
return fail(node, { kind: "part-selector-unresolved", part: part.name });
|
|
@@ -927,8 +973,13 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
927
973
|
return fail(node, { kind: "part-missing-or-repeated", part: part.name });
|
|
928
974
|
if (match === void 0)
|
|
929
975
|
continue;
|
|
930
|
-
if (part.kind === "component")
|
|
976
|
+
if (part.kind === "component") {
|
|
977
|
+
for (const each of matches) {
|
|
978
|
+
const site = location(each.opening);
|
|
979
|
+
placedParts.push({ part: part.name, target: await componentTarget(root, each.opening, values.symbol), at: { line: site.line, column: site.column } });
|
|
980
|
+
}
|
|
931
981
|
continue;
|
|
982
|
+
}
|
|
932
983
|
matched.set([...part.within, part.selector].join(" "), match.opening);
|
|
933
984
|
const ariaHidden = attr(match.opening, "aria-hidden");
|
|
934
985
|
if (tinted.has(part.name) && ariaHidden !== void 0 && (ariaHidden.initializer === void 0 || [!0, "true"].includes(await resolve(expression(ariaHidden), context))))
|
|
@@ -936,6 +987,8 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
936
987
|
const element = values.tag(match.opening);
|
|
937
988
|
if (UA_MARGIN_TAGS.includes(element))
|
|
938
989
|
margined.add([...part.within, part.selector].join(" "));
|
|
990
|
+
if (UA_CONTROL_TAGS.includes(element))
|
|
991
|
+
native.add([...part.within, part.selector].join(" "));
|
|
939
992
|
const hostless = part.pseudo.find((pseudo) => !pseudoHosted(pseudo, element));
|
|
940
993
|
if (hostless !== void 0)
|
|
941
994
|
return fail(match.opening, { kind: "pseudo-host-unsupported", part: part.name, pseudo: hostless, element });
|
|
@@ -968,7 +1021,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
968
1021
|
await pointerTransparent(match.opening, part.name, context, resolve);
|
|
969
1022
|
if (part.kind !== "visual")
|
|
970
1023
|
continue;
|
|
971
|
-
if (part.scheme !== null)
|
|
1024
|
+
if (part.scheme !== null && match.classes.bindings.length > 0)
|
|
1025
|
+
schemedBindings.set(part.name, part.scheme);
|
|
1026
|
+
else if (part.scheme !== null) {
|
|
972
1027
|
if (element !== "img" || match.classes.bindings.length > 0)
|
|
973
1028
|
return fail(match.opening, { kind: "scheme-image-element", part: part.name, element });
|
|
974
1029
|
for (const attribute of ["width", "height"])
|
|
@@ -1002,7 +1057,7 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1002
1057
|
visuals.set(part.name, { fact: { kind: "inspected-svg" }, drawings: void 0 });
|
|
1003
1058
|
continue;
|
|
1004
1059
|
}
|
|
1005
|
-
if (match.classes.bindings.length === 0 && parsed.value.kind === "region" && values.tag(match.opening)
|
|
1060
|
+
if (match.classes.bindings.length === 0 && parsed.value.kind === "region" && ["img", "video"].includes(values.tag(match.opening))) {
|
|
1006
1061
|
visual ??= { kind: "content-media" };
|
|
1007
1062
|
visuals.set(part.name, { fact: { kind: "content-media" }, drawings: void 0 });
|
|
1008
1063
|
continue;
|
|
@@ -1016,6 +1071,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1016
1071
|
const themeName = binding.handle.descriptor.spec.theme ?? "light", theme = themes.find((item) => item.name === themeName);
|
|
1017
1072
|
if (theme === void 0)
|
|
1018
1073
|
return fail(match.opening, { kind: "theme-unknown", theme: String(themeName) });
|
|
1074
|
+
const pairScheme = schemedBindings.get(part.name);
|
|
1075
|
+
if (pairScheme !== void 0 && theme.scheme !== pairScheme)
|
|
1076
|
+
return fail(match.opening, { kind: "scheme-image-element", part: part.name, element: `artwork bound for theme ${theme.name}` });
|
|
1019
1077
|
const bindingSource = async (target) => {
|
|
1020
1078
|
const selected = await resolve(target, context);
|
|
1021
1079
|
if (typeof selected !== "object" || selected === null || selected.kind !== "asset-source" || selected.handle.node !== binding.handle.node || selected.name !== binding.name)
|
|
@@ -1121,13 +1179,14 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1121
1179
|
...writesInline ? [scope] : [],
|
|
1122
1180
|
...decorative.size > 0 ? [["decorative", ...decorative]] : [],
|
|
1123
1181
|
...margined.size > 0 ? [["margined", ...[...margined].sort()]] : [],
|
|
1182
|
+
...native.size > 0 ? [["native", ...[...native].sort()]] : [],
|
|
1124
1183
|
...visuals.size > 1 ? [[...visuals].map(([name, { fact, drawings: drawn }]) => fact.kind === "asset" ? [name, drawn, fact.state, fact.visualProfile, fact.theme.name] : [name, fact.kind])] : []
|
|
1125
1184
|
], paintedBy = (element) => parsed.value.kind === "control" ? hasText ? "text" : "graphic" : element.visual ? decorative.has(element.element) ? "decorative" : "graphic" : "text", key = constructionId(digest(hidden.length > 0 ? [...identity, hidden] : identity));
|
|
1126
1185
|
let owned = styles.get(key);
|
|
1127
1186
|
if (owned === void 0) {
|
|
1128
1187
|
if (styles.size >= choiceLimits.alternatives)
|
|
1129
1188
|
return fail(node, { kind: "choice", problem: { kind: "construction-limit" } });
|
|
1130
|
-
const rootName = `owner_${key.slice(0, 16)}`, input = { visual: visual ?? null, visuals: new Map([...visuals].map(([name, { fact }]) => [name, fact])), hasText, hidden, inherited, aligned, scope, margined: [...margined].sort() }, spec = parsed.value, built = await memoizedConstruction(options.constructions, foundation, [key, scope, drawnRecords(input, root)], (read) => {
|
|
1189
|
+
const rootName = `owner_${key.slice(0, 16)}`, input = { visual: visual ?? null, visuals: new Map([...visuals].map(([name, { fact }]) => [name, fact])), hasText, hidden, inherited, aligned, scope, margined: [...margined].sort(), native: [...native].sort() }, spec = parsed.value, built = await memoizedConstruction(options.constructions, foundation, [key, scope, drawnRecords(input, root)], (read) => {
|
|
1131
1190
|
const reviews = [], failed = (failure, at = null) => ({ kind: "failed", failure: { path: at, item: failure }, reviews }), lowered = lower(spec, read, rootName, input);
|
|
1132
1191
|
if (lowered.kind === "err")
|
|
1133
1192
|
return failed(lowered.error);
|
|
@@ -1147,6 +1206,13 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1147
1206
|
const overpaint = cornerOverpaint(read, spec);
|
|
1148
1207
|
if (overpaint !== null)
|
|
1149
1208
|
return failed(overpaint, `recipe.parts.${overpaint.part}`);
|
|
1209
|
+
const edgeless = forcedBoundaryMissing(read, spec);
|
|
1210
|
+
if (edgeless !== null)
|
|
1211
|
+
return failed(edgeless, edgeless.element === "&" ? null : `recipe.parts.${edgeless.element}`);
|
|
1212
|
+
for (const filled of forcedStateFillOnly(read, spec))
|
|
1213
|
+
reviews.push({ path: null, item: filled });
|
|
1214
|
+
for (const unpainted of borderPaintMissing(read, spec))
|
|
1215
|
+
reviews.push({ path: unpainted.element === "&" ? null : `recipe.parts.${unpainted.element}`, item: unpainted });
|
|
1150
1216
|
const painted = runtimePaintContrast(read, spec);
|
|
1151
1217
|
if (painted.kind === "err")
|
|
1152
1218
|
return failed(painted.error);
|
|
@@ -1160,14 +1226,19 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1160
1226
|
surfaceUses: surfaceUses(read, spec, lowered.value.profiles, paintedBy),
|
|
1161
1227
|
paints: declaredPaints(spec).map((paint) => ({ name: paint.name, property: paintProperty(scope, paint.name), values: paint.values })),
|
|
1162
1228
|
glyphs: [],
|
|
1163
|
-
content: []
|
|
1229
|
+
content: [],
|
|
1230
|
+
placements: [],
|
|
1231
|
+
roots: [],
|
|
1232
|
+
...spec.kind === "region" && spec.element?.kind === "document" ? { document: !0 } : {},
|
|
1233
|
+
endInset: endInsetOf(read, spec),
|
|
1234
|
+
stackParts: stackPartsOf(read, spec)
|
|
1164
1235
|
}, reviews };
|
|
1165
1236
|
}), at = (path) => path === null ? node : authoredAt(classes.calls, path) ?? node;
|
|
1166
1237
|
for (const noted of built.reviews)
|
|
1167
1238
|
review(at(noted.path), noted.item);
|
|
1168
1239
|
if (built.kind === "failed")
|
|
1169
1240
|
return fail(at(built.failure.path), { kind: "construction", failure: built.failure.item });
|
|
1170
|
-
owned = { ...built.owned, origins: [], glyphs: [], content: [] };
|
|
1241
|
+
owned = { ...built.owned, origins: [], glyphs: [], content: [], placements: [], roots: [] };
|
|
1171
1242
|
styles.set(key, owned);
|
|
1172
1243
|
}
|
|
1173
1244
|
if (owned.facts.kind === "region" && owned.facts.exposed !== null)
|
|
@@ -1237,6 +1308,12 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1237
1308
|
if (!owned.origins.some((origin) => origin.kind === "point" && origin.position.line === at.line && origin.position.column === at.column))
|
|
1238
1309
|
owned.origins.push({ kind: "point", file: name, position: { line: at.line, column: at.column } });
|
|
1239
1310
|
const lowered = owned;
|
|
1311
|
+
for (const placement of placedParts)
|
|
1312
|
+
if (!(owned.placements ?? []).some((known) => known.at.line === placement.at.line && known.at.column === placement.at.column))
|
|
1313
|
+
owned.placements?.push(placement);
|
|
1314
|
+
const rootOf = componentRootOf(name, opening);
|
|
1315
|
+
if (rootOf !== null && !(owned.roots ?? []).includes(rootOf))
|
|
1316
|
+
owned.roots?.push(rootOf);
|
|
1240
1317
|
for (const attribute of await contentAttributes(opening))
|
|
1241
1318
|
if (!(owned.content ?? []).includes(attribute))
|
|
1242
1319
|
owned.content?.push(attribute);
|
|
@@ -1456,7 +1533,7 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1456
1533
|
if (references.has(identifier) || !glyphReads.has(await values.symbol(identifier)))
|
|
1457
1534
|
continue;
|
|
1458
1535
|
const declaration = identifier.parent;
|
|
1459
|
-
if (declaration !== void 0 && (isBindingElement(declaration) || isParameterDeclaration(declaration)) && declaration.name === identifier)
|
|
1536
|
+
if (declaration !== void 0 && (isBindingElement(declaration) || isParameterDeclaration(declaration) || isVariableDeclaration(declaration)) && declaration.name === identifier)
|
|
1460
1537
|
continue;
|
|
1461
1538
|
const passed = identifier.parent?.parent, tag = passed !== void 0 && isJsxAttribute(passed) ? passed.parent.parent : void 0, host = tag !== void 0 && (isJsxOpeningElement(tag) || isJsxSelfClosingElement(tag)) ? tag : null;
|
|
1462
1539
|
if (!(identifier.parent !== void 0 && isJsxExpression(identifier.parent) && host !== null && !lowercaseTag(host)) && !presenceTest(identifier))
|
|
@@ -1472,6 +1549,12 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1472
1549
|
if (isImportDeclaration(statement) && isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === RECIPE_MODULE)
|
|
1473
1550
|
edits.push({ node: statement, text: "" });
|
|
1474
1551
|
edits.push(...macros.edits);
|
|
1552
|
+
const directive = writtenDirective(source);
|
|
1553
|
+
if (directive !== null) {
|
|
1554
|
+
edits.push({ node: directive, text: "" });
|
|
1555
|
+
if (clientNeed(source) === null && !values.externals.some((external) => external.client))
|
|
1556
|
+
review(directive, { kind: "client-directive-unneeded" });
|
|
1557
|
+
}
|
|
1475
1558
|
for (const call of values.macroCalls.keys()) {
|
|
1476
1559
|
if ([...values.macroCalls.keys()].some((other) => other !== call && inside(call, other)))
|
|
1477
1560
|
continue;
|
|
@@ -1484,10 +1567,17 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1484
1567
|
const coveredLeaves = selections.reduce((sum, { result }) => sum + result.leaves.filter((leaf) => leaf.value.kind === "styled").length, 0), [rows] = exposedRows.values(), publicRows = exposedRows.size === 1 && rows !== void 0 ? rows : null, uses = [...artworkUses].sort().map((key) => {
|
|
1485
1568
|
const [asset = "", size = ""] = key.split("\x00");
|
|
1486
1569
|
return { asset, size: size === "" ? null : size };
|
|
1487
|
-
}), artwork = { assets: [...boundAssets].sort(), sets: [...boundSets].sort(), glyphs: macros.glyphs, support: macros.support, uses };
|
|
1570
|
+
}), artwork = { assets: [...boundAssets].sort(), sets: [...boundSets].sort(), glyphs: macros.glyphs, support: macros.support, uses }, scriptTokens = new Set;
|
|
1571
|
+
for (const literal of [...nodesOfKind(source, SyntaxKind.StringLiteral, isStringLiteral), ...nodesOfKind(source, SyntaxKind.NoSubstitutionTemplateLiteral, isNoSubstitutionTemplateLiteral)])
|
|
1572
|
+
for (const match of literal.text.matchAll(/(?:^|var\()(--[a-z][\w-]*)/g))
|
|
1573
|
+
if (match[1] !== void 0 && foundation.tokens.has(match[1]))
|
|
1574
|
+
scriptTokens.add(match[1]);
|
|
1575
|
+
const [firstStyle] = styles;
|
|
1576
|
+
if (firstStyle !== void 0 && scriptTokens.size > 0)
|
|
1577
|
+
styles.set(firstStyle[0], { ...firstStyle[1], scriptTokens: [...scriptTokens].sort() });
|
|
1488
1578
|
return { source, values, selections, styles, edits, assetEdits, imports, coverage: { constructions: styles.size, coveredLeaves }, publicRows, controls: ownerControls(selections.flatMap((selection) => selection.result.axes)), reviews, artwork, design: ownerDesign([...styles.values()].flatMap((construction) => construction.profiles)) };
|
|
1489
1579
|
}
|
|
1490
|
-
const UA_MARGIN_TAGS = ["p", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "dl", "dd", "blockquote", "figure", "pre", "hr", "menu"];
|
|
1580
|
+
const UA_MARGIN_TAGS = ["p", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "dl", "dd", "blockquote", "figure", "pre", "hr", "menu"], UA_CONTROL_TAGS = ["button", "input", "textarea", "select"];
|
|
1491
1581
|
function drawnRecords(input, root) {
|
|
1492
1582
|
return [input.visual, ...input.visuals.values()].map((fact) => fact !== null && fact.kind === "asset" ? designValueDigest(fact.asset, root) : null);
|
|
1493
1583
|
}
|
|
@@ -1506,7 +1596,7 @@ function lower(spec, foundation, root, input) {
|
|
|
1506
1596
|
hidden: input.hidden
|
|
1507
1597
|
});
|
|
1508
1598
|
case "region":
|
|
1509
|
-
return lowerRegion(spec, foundation, { root, visual: input.visual, visuals: input.visuals, hidden: input.hidden, scope: input.scope, ...input.margined.length === 0 ? {} : { margined: input.margined } });
|
|
1599
|
+
return lowerRegion(spec, foundation, { root, visual: input.visual, visuals: input.visuals, hidden: input.hidden, scope: input.scope, ...input.margined.length === 0 ? {} : { margined: input.margined }, ...input.native.length === 0 ? {} : { native: input.native } });
|
|
1510
1600
|
case "grid":
|
|
1511
1601
|
return lowerGrid(spec, foundation, { root, hidden: input.hidden, inherited: input.inherited, aligned: input.aligned, scope: input.scope });
|
|
1512
1602
|
}
|
|
@@ -1589,7 +1679,7 @@ function checkedAppIcon(analysis) {
|
|
|
1589
1679
|
}
|
|
1590
1680
|
export const ownerSheetName = (owner) => owner.replace(/\.tsx?$/, ".css");
|
|
1591
1681
|
export function ownerSheet(owner, styles, css, foundation, sections = !0) {
|
|
1592
|
-
const used = new Set([...styles.values()].flatMap((value) => [...value.used])), tokens = tokenCss(foundation, used);
|
|
1682
|
+
const used = new Set([...styles.values()].flatMap((value) => [...value.used, ...value.scriptTokens ?? []])), tokens = tokenCss(foundation, used);
|
|
1593
1683
|
if (tokens.kind === "err")
|
|
1594
1684
|
return err({ kind: "token-css", owner, failure: tokens.error });
|
|
1595
1685
|
const nested = sections ? tokenSectionCss(foundation, tokens.value) : "";
|
|
@@ -1598,6 +1688,12 @@ export function ownerSheet(owner, styles, css, foundation, sections = !0) {
|
|
|
1598
1688
|
}
|
|
1599
1689
|
export const ownerDocuments = (owners) => [...owners].flatMap((owner) => [...owner.styles.values()].flatMap((value) => value.documents));
|
|
1600
1690
|
export function plainModuleSource(name, module) {
|
|
1691
|
+
const externals = externalDeclarations(module.source);
|
|
1692
|
+
if (externals.length > 0)
|
|
1693
|
+
return `${externals.map((item) => `${item.exportName === "default" ? `export { default as ${item.name} }` : item.exportName === item.name ? `export { ${item.name} }` : `export { ${item.exportName} as ${item.name} }`} from ${JSON.stringify(item.from)};
|
|
1694
|
+
${EXTERNAL_MARKER}${JSON.stringify({ name: item.name, renders: item.renders })} */`).join(`
|
|
1695
|
+
`)}
|
|
1696
|
+
`;
|
|
1601
1697
|
let text = module.source.text;
|
|
1602
1698
|
const replacements = [...module.statements.map((node) => ({ node, text: "" })), ...module.edits];
|
|
1603
1699
|
for (const edit of replacements.sort((a, b) => b.node.getStart(module.source) - a.node.getStart(module.source)))
|
|
@@ -1700,7 +1796,8 @@ export async function ownerModuleSource(name, owner, classOf, fail) {
|
|
|
1700
1796
|
let emitted = source.text;
|
|
1701
1797
|
for (const edit of replacements.sort((a, b) => b.start - a.start))
|
|
1702
1798
|
emitted = emitted.slice(0, edit.start) + edit.text + emitted.slice(edit.end);
|
|
1703
|
-
emitted =
|
|
1799
|
+
emitted = `${clientNeed(source) === null && !values.externals.some((external) => external.client) ? "" : `${CLIENT_DIRECTIVE}
|
|
1800
|
+
`}import ${JSON.stringify(`./${path.basename(ownerSheetName(name))}`)};
|
|
1704
1801
|
${owner.imports.join(`
|
|
1705
1802
|
`)}
|
|
1706
1803
|
${emitted}`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { selectedProfile } from "./design-foundation.mjs";
|
|
2
|
+
const fieldsOf = (foundation, name, kind, select = {}) => {
|
|
3
|
+
if (name === null || name === void 0)
|
|
4
|
+
return null;
|
|
5
|
+
const selected = selectedProfile(foundation, name, select);
|
|
6
|
+
return selected.kind === "ok" && selected.value.kind === kind ? selected.value.fields : null;
|
|
7
|
+
}, PAINTS = ["border-color", "border-inline-start-color", "border-inline-end-color", "border-block-start-color", "border-block-end-color"];
|
|
8
|
+
export function borderPaintMissing(foundation, spec) {
|
|
9
|
+
if (spec.kind !== "region" && spec.kind !== "control")
|
|
10
|
+
return [];
|
|
11
|
+
const composite = spec.profile === null ? null : selectedProfile(foundation, spec.profile, spec.select), slots = composite === null || composite.kind === "err" ? new Map : composite.value.kind === "composite" ? composite.value.fields : new Map([[`${composite.value.kind}-profile`, spec.profile ?? ""]]), found = [], check = (element, frameName, surfaces) => {
|
|
12
|
+
const frame = fieldsOf(foundation, frameName, "frame");
|
|
13
|
+
if (frame === null || frame.get("border-width") === void 0 || frame.get("border-style") === "forced-only")
|
|
14
|
+
return;
|
|
15
|
+
if (!surfaces.some((surface) => {
|
|
16
|
+
const fields = fieldsOf(foundation, surface, "surface");
|
|
17
|
+
return fields !== null && PAINTS.some((paint) => fields.has(paint));
|
|
18
|
+
}))
|
|
19
|
+
found.push({ kind: "border-paint-missing", element, frame: frameName ?? "" });
|
|
20
|
+
};
|
|
21
|
+
if (spec.kind === "control") {
|
|
22
|
+
check("&", slots.get("frame-profile"), [spec.surface, slots.get("surface-profile"), ...spec.when.map(([, surface]) => surface)]);
|
|
23
|
+
return found;
|
|
24
|
+
}
|
|
25
|
+
if (spec.frame !== null)
|
|
26
|
+
check("&", slots.get("frame-profile"), [spec.surface, slots.get("surface-profile"), ...spec.when.map(([, surface]) => surface)]);
|
|
27
|
+
for (const part of spec.parts) {
|
|
28
|
+
const frame = part.box ?? (part.frame !== null ? slots.get("frame-profile") : void 0);
|
|
29
|
+
if (frame === void 0 || frame === null)
|
|
30
|
+
continue;
|
|
31
|
+
check(part.name, frame, [part.surface, ...part.when.map(([, surface]) => surface)]);
|
|
32
|
+
}
|
|
33
|
+
return found;
|
|
34
|
+
}
|
package/dist/check.mjs
CHANGED
|
@@ -123,6 +123,8 @@ export const checkRules = [
|
|
|
123
123
|
"a11y-keyboard",
|
|
124
124
|
"a11y-target-size",
|
|
125
125
|
"a11y-target-size-unresolved",
|
|
126
|
+
"a11y-forced-colors",
|
|
127
|
+
"a11y-forced-colors-review",
|
|
126
128
|
"a11y-non-text-contrast",
|
|
127
129
|
"surface-contrast",
|
|
128
130
|
"surface-contrast-unresolved",
|
|
@@ -89,14 +89,17 @@ export function composedContrastFindings(inputs) {
|
|
|
89
89
|
return [];
|
|
90
90
|
return [[placed.owner, fact.scope ?? `${fact.at.file}:${fact.at.line}:${fact.at.column}`, fact.tag, fact.surfaces?.map((state) => [state.condition, state.surface]) ?? null, text, fact.flow, fact.context, fact.exempt, placed.boundary?.reason ?? null]];
|
|
91
91
|
});
|
|
92
|
-
}, chainRelated = new Map, chains = [], emit = (walk, certain, top) => {
|
|
92
|
+
}, chainRelated = new Map, chains = [], emit = (walk, certain, top, graphic = !1) => {
|
|
93
93
|
if (walk.elements.some((placed) => placed.fact.exempt !== null))
|
|
94
94
|
return null;
|
|
95
|
-
const
|
|
95
|
+
const [own] = walk.elements;
|
|
96
|
+
if (graphic && (own === void 0 || own.fact.visual !== !0 || (own.fact.surfaces ?? []).length === 0))
|
|
97
|
+
return null;
|
|
98
|
+
const elements = [...walk.elements, top], key = JSON.stringify([certain, graphic, evaluationKey(elements)]);
|
|
96
99
|
let related = chainRelated.get(key);
|
|
97
100
|
if (related === void 0) {
|
|
98
101
|
chainRelated.set(key, related = new Map);
|
|
99
|
-
chains.push({ key, chain: { elements, certain } });
|
|
102
|
+
chains.push({ key, chain: { elements, certain, ...graphic ? { graphic } : {} } });
|
|
100
103
|
}
|
|
101
104
|
for (const item of walk.related)
|
|
102
105
|
related.set(siteKey(item.site), item);
|
|
@@ -156,7 +159,7 @@ export function composedContrastFindings(inputs) {
|
|
|
156
159
|
distinct.set(key, leaf);
|
|
157
160
|
}
|
|
158
161
|
return [...distinct.values()];
|
|
159
|
-
}, argsOf = (placement) => placement.content.kind === "placement" && placement.content.spread === null ? placement.content.args : null, origin = (start, certain, run) => {
|
|
162
|
+
}, argsOf = (placement) => placement.content.kind === "placement" && placement.content.spread === null ? placement.content.args : null, origin = (start, certain, run, graphic = !1) => {
|
|
160
163
|
const seen = new Set, reached = new Set;
|
|
161
164
|
let walks = 0, limited = !1;
|
|
162
165
|
run({
|
|
@@ -166,7 +169,7 @@ export function composedContrastFindings(inputs) {
|
|
|
166
169
|
if (++walks > compositionLimits.chains * 8)
|
|
167
170
|
limited = !0;
|
|
168
171
|
else {
|
|
169
|
-
const key = emit(walk, certain, top);
|
|
172
|
+
const key = emit(walk, certain, top, graphic);
|
|
170
173
|
if (key !== null)
|
|
171
174
|
seen.add(key);
|
|
172
175
|
if (seen.size > compositionLimits.chains)
|
|
@@ -315,11 +318,11 @@ export function composedContrastFindings(inputs) {
|
|
|
315
318
|
const leaves = leavesOf(position);
|
|
316
319
|
if (leaves === null)
|
|
317
320
|
break;
|
|
318
|
-
const start = { ...empty, related: [relatedOf(position.at, "the text")] };
|
|
321
|
+
const start = { ...empty, related: [relatedOf(position.at, content.graphic === !0 ? "the artwork" : "the text")] };
|
|
319
322
|
origin(position.at, content.certain, (steps) => {
|
|
320
323
|
for (const leaf of leaves)
|
|
321
324
|
walkFrame({ owner, component: position.component, segments: leaf.segments, index: 0, props: leaf.props }, start, "data", steps);
|
|
322
|
-
});
|
|
325
|
+
}, content.graphic === !0);
|
|
323
326
|
break;
|
|
324
327
|
}
|
|
325
328
|
case "forward": {
|
|
@@ -3,6 +3,7 @@ import { selectAsset } from "./asset-model.mjs";
|
|
|
3
3
|
import { REDUCED_MOTION, paintTransitionRules, transitionSetRules } from "./lowering-transitions.mjs";
|
|
4
4
|
import { reducedMotionPolicy } from "./lowering-motion.mjs";
|
|
5
5
|
import { BORDER_STYLE, BORDER_STYLES, INACTIVE_STATE, SURFACE_STATE, TEXT_TRANSFORM, TEXT_TRANSFORMS, sequenceStepTokenRoles } from "./role-vocabulary.mjs";
|
|
6
|
+
import { FORCED_FIELDS, FORCED_ONLY, FORCED_PREFIX } from "./forced-colors.mjs";
|
|
6
7
|
import { controlFrameInsets } from "./lowering-region-layout.mjs";
|
|
7
8
|
import { recipeTree } from "./recipe-model.mjs";
|
|
8
9
|
import { profileReference } from "./profile-model.mjs";
|
|
@@ -24,36 +25,55 @@ export function output(root, operation, reject, profile) {
|
|
|
24
25
|
for (const token of references(value))
|
|
25
26
|
if (!owned.has(token))
|
|
26
27
|
used.add(token);
|
|
28
|
+
}, outRule = (selector, values, condition) => {
|
|
29
|
+
const sided = LOGICAL_SIDE_COLORS.some((property) => values[property] !== void 0), shared = values["border-color"], declarations = effectDeclarations(values).flatMap(([property, value]) => {
|
|
30
|
+
use(value);
|
|
31
|
+
if (sided) {
|
|
32
|
+
if (LOGICAL_SIDE_COLORS.includes(property))
|
|
33
|
+
return [];
|
|
34
|
+
if (property === "border-color")
|
|
35
|
+
return LOGICAL_SIDE_COLORS.map((name) => [name, values[name] ?? value]);
|
|
36
|
+
return [[property, value]];
|
|
37
|
+
}
|
|
38
|
+
return (property === "border-color" ? SIDES.map((side) => `border-${side}-color`) : [property]).map((name) => [name, value]);
|
|
39
|
+
});
|
|
40
|
+
if (sided && shared === void 0)
|
|
41
|
+
for (const name of LOGICAL_SIDE_COLORS) {
|
|
42
|
+
const own = values[name];
|
|
43
|
+
if (own === void 0)
|
|
44
|
+
continue;
|
|
45
|
+
use(own);
|
|
46
|
+
declarations.push([name, own]);
|
|
47
|
+
}
|
|
48
|
+
const conditions = condition === void 0 ? [] : [{ name: condition[0], params: condition[1] }], roles = declarations.filter(([property]) => property.startsWith("--"));
|
|
49
|
+
if (roles.length > 0)
|
|
50
|
+
checked(session.writeProvidedRoles({ selector, conditions, values: roles, important: !1 }));
|
|
51
|
+
const rest = declarations.filter(([property]) => !property.startsWith("--"));
|
|
52
|
+
if (rest.length > 0 || roles.length === 0)
|
|
53
|
+
checked(session.write({ selector, conditions, values: rest, important: !1 }));
|
|
27
54
|
};
|
|
28
55
|
return {
|
|
29
56
|
use,
|
|
30
57
|
own: (property) => void owned.add(property),
|
|
31
|
-
rule: (selector,
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const conditions = condition === void 0 ? [] : [{ name: condition[0], params: condition[1] }], roles = declarations.filter(([property]) => property.startsWith("--"));
|
|
52
|
-
if (roles.length > 0)
|
|
53
|
-
checked(session.writeProvidedRoles({ selector, conditions, values: roles, important: !1 }));
|
|
54
|
-
const rest = declarations.filter(([property]) => !property.startsWith("--"));
|
|
55
|
-
if (rest.length > 0 || roles.length === 0)
|
|
56
|
-
checked(session.write({ selector, conditions, values: rest, important: !1 }));
|
|
58
|
+
rule: (selector, given, condition) => {
|
|
59
|
+
const forced = Object.entries(given).filter(([property]) => property.startsWith(FORCED_PREFIX)), values = forced.length === 0 ? given : Object.fromEntries(Object.entries(given).filter(([property]) => !property.startsWith(FORCED_PREFIX)));
|
|
60
|
+
if (forced.length > 0) {
|
|
61
|
+
const media = [...condition === void 0 ? [] : [{ name: condition[0], params: condition[1] }], { name: "media", params: "(forced-colors: active)" }], system = forced.flatMap(([field, value]) => {
|
|
62
|
+
const property = FORCED_FIELDS[field];
|
|
63
|
+
return property === "border-color" ? SIDES.map((side) => [`border-${side}-color`, value]) : [[property, value]];
|
|
64
|
+
});
|
|
65
|
+
checked(session.write({ selector, conditions: media, values: [...system, ["forced-color-adjust", "none"]], important: !1 }));
|
|
66
|
+
}
|
|
67
|
+
if (Object.entries(values).some(([property, value]) => /^border(-[a-z]+)?-style$/.test(property) && value === FORCED_ONLY)) {
|
|
68
|
+
const own = {};
|
|
69
|
+
for (const [property, value] of Object.entries(values))
|
|
70
|
+
own[property] = /^border(-[a-z]+)?-style$/.test(property) && value === FORCED_ONLY ? "solid" : value;
|
|
71
|
+
if (!Object.keys(own).some((property) => /^border(-[a-z]+)*-color$/.test(property)))
|
|
72
|
+
for (const side of SIDES)
|
|
73
|
+
own[`border-${side}-color`] = "transparent";
|
|
74
|
+
return outRule(selector, own, condition);
|
|
75
|
+
}
|
|
76
|
+
return outRule(selector, values, condition);
|
|
57
77
|
},
|
|
58
78
|
tree: (node) => checked(session.writeTree(node, root)),
|
|
59
79
|
document: (rule) => session.writeDocument(rule),
|
|
@@ -342,7 +362,12 @@ export const frameTarget = (frame, box, field) => ({
|
|
|
342
362
|
...box.insets.blockEnd === box.insets.blockStart ? {} : { insetEnd: box.insets.blockEnd },
|
|
343
363
|
...box.insets.inlineEnd === box.insets.inlineStart ? {} : { paddingInlineEnd: box.insets.inlineEnd },
|
|
344
364
|
...frame["min-inline-size"] === void 0 ? {} : { minInline: frame["min-inline-size"] }
|
|
345
|
-
})
|
|
365
|
+
});
|
|
366
|
+
export function controlInlineExtent(frame, fallback) {
|
|
367
|
+
const size = frame["inline-size"], max = frame["max-inline-size"], minimum = frame["min-inline-size"] ?? (size !== void 0 && max === void 0 ? size : fallback);
|
|
368
|
+
return { ...size === void 0 ? {} : { "inline-size": size }, ...max === void 0 ? {} : { "max-inline-size": max }, ...minimum === null ? {} : { "min-inline-size": minimum } };
|
|
369
|
+
}
|
|
370
|
+
export const controlBoxValues = (box) => ({
|
|
346
371
|
"min-block-size": box.minBlockSize,
|
|
347
372
|
"padding-inline-start": box.padding.inlineStart,
|
|
348
373
|
"padding-inline-end": box.padding.inlineEnd,
|
|
@@ -226,7 +226,7 @@ export interface PaintTransition {
|
|
|
226
226
|
* textarea (a colour). `progressValue` is the filled part of a `<progress>` (a background): the part's own
|
|
227
227
|
* surface is its track.
|
|
228
228
|
*/
|
|
229
|
-
export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before"];
|
|
229
|
+
export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb"];
|
|
230
230
|
export type PseudoElement = (typeof PSEUDO_ELEMENTS)[number];
|
|
231
231
|
/** Elements that never render generated content or a marker: a `before` treatment there would never show. */
|
|
232
232
|
export declare const REPLACED_ELEMENTS: readonly string[];
|
|
@@ -278,6 +278,8 @@ export interface CounterSpec {
|
|
|
278
278
|
export interface PseudoTreatment {
|
|
279
279
|
readonly pseudo: PseudoElement;
|
|
280
280
|
readonly surface: string | null;
|
|
281
|
+
/** A range slider's track or thumb: its frame profile (size, radius, border). */
|
|
282
|
+
readonly frame?: string | null;
|
|
281
283
|
readonly text: string | null;
|
|
282
284
|
readonly content: GeneratedContent | null;
|
|
283
285
|
readonly when: readonly StateTreatment[];
|
|
@@ -425,6 +427,8 @@ export interface Arrangement {
|
|
|
425
427
|
readonly justify: string | null;
|
|
426
428
|
readonly wrap: boolean;
|
|
427
429
|
readonly gap: SlotBinding | null;
|
|
430
|
+
/** A wrapping row's gap between its lines, where it differs from `gap` between its items; `null`: the same. */
|
|
431
|
+
readonly rowGap?: SlotBinding | null;
|
|
428
432
|
/**
|
|
429
433
|
* `overlap`: neighbours overlap by a spacing value instead of being separated by one (a pile of faces, a
|
|
430
434
|
* stack of cards). Real layout: the row is as wide as what it shows. Never beside `gap`.
|
|
@@ -545,18 +549,25 @@ export type ElementKind = {
|
|
|
545
549
|
readonly type: "search" | "text";
|
|
546
550
|
} | {
|
|
547
551
|
readonly kind: "table";
|
|
548
|
-
}
|
|
552
|
+
}
|
|
553
|
+
/** `align`: where the cell's content sits on the block axis (`vertical-align`); centred unless stated. */
|
|
554
|
+
| {
|
|
549
555
|
readonly kind: "cell";
|
|
550
556
|
readonly header: boolean;
|
|
557
|
+
readonly align: "start" | "center" | "end";
|
|
551
558
|
} | {
|
|
552
559
|
readonly kind: "list";
|
|
553
560
|
}
|
|
561
|
+
/** The page's document: `<html>` with `<body>` inside, on a pattern's root only (one per design system). */
|
|
562
|
+
| {
|
|
563
|
+
readonly kind: "document";
|
|
564
|
+
}
|
|
554
565
|
/** `marker: "none"` removes the disclosure triangle (the compiler issues the vendor pseudo-element rule). */
|
|
555
566
|
| {
|
|
556
567
|
readonly kind: "summary";
|
|
557
568
|
readonly marker: "native" | "none";
|
|
558
569
|
};
|
|
559
|
-
export declare const ELEMENT_NAMES: readonly ["iframe", "select", "search-input", "text-input", "table", "header-cell", "cell", "list", "summary"];
|
|
570
|
+
export declare const ELEMENT_NAMES: readonly ["iframe", "select", "search-input", "text-input", "table", "header-cell", "cell", "list", "summary", "document"];
|
|
560
571
|
export type ElementName = (typeof ELEMENT_NAMES)[number];
|
|
561
572
|
/**
|
|
562
573
|
* How a text part breaks: anywhere (long words wrap), never, truncated with an
|
|
@@ -565,7 +576,7 @@ export type ElementName = (typeof ELEMENT_NAMES)[number];
|
|
|
565
576
|
* prettifying text that is cut off is meaningless, so neither combines with
|
|
566
577
|
* truncation. Browsers without `text-wrap` support wrap normally.
|
|
567
578
|
*/
|
|
568
|
-
export type TextWrap = "anywhere" | "never" | "truncate" | "balance" | "pretty";
|
|
579
|
+
export type TextWrap = "anywhere" | "never" | "truncate" | "balance" | "pretty" | "preserve";
|
|
569
580
|
export declare const TEXT_WRAPS: readonly TextWrap[];
|
|
570
581
|
export type TextAlign = "start" | "center" | "end";
|
|
571
582
|
export declare const TEXT_ALIGNS: readonly TextAlign[];
|
|
@@ -605,7 +616,7 @@ export type PartContent = {
|
|
|
605
616
|
export type StateTreatment = readonly [condition: string, surface: string];
|
|
606
617
|
export type RegionPartContent = PartContent["kind"];
|
|
607
618
|
/** The kinds of value a measured declaration carries: a px length, a px translation (x, y) or a px grid track length. */
|
|
608
|
-
export declare const MEASURED_TYPES: readonly ["length", "transform", "size-track", "position", "intrinsic-size"];
|
|
619
|
+
export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size"];
|
|
609
620
|
export type MeasuredType = (typeof MEASURED_TYPES)[number];
|
|
610
621
|
/**
|
|
611
622
|
* A geometry value the owner measures or computes at runtime and writes through
|
|
@@ -632,6 +643,17 @@ export type MeasuredValue =
|
|
|
632
643
|
readonly y: number;
|
|
633
644
|
} | null;
|
|
634
645
|
readonly motion: string | null;
|
|
646
|
+
}
|
|
647
|
+
/** A scale per axis (unitless factors): an image that grows from its place into a zoom view, with a measured translation. */
|
|
648
|
+
| {
|
|
649
|
+
readonly type: "scale";
|
|
650
|
+
readonly name: string;
|
|
651
|
+
readonly property: string;
|
|
652
|
+
readonly fallback: {
|
|
653
|
+
readonly x: number;
|
|
654
|
+
readonly y: number;
|
|
655
|
+
} | null;
|
|
656
|
+
readonly motion: string | null;
|
|
635
657
|
} | {
|
|
636
658
|
readonly type: "size-track";
|
|
637
659
|
readonly name: string;
|
|
@@ -779,11 +801,14 @@ export type LayerSpec = ModalSheet | AnchoredPopover | MeasuredPopover;
|
|
|
779
801
|
export interface ModalSheet {
|
|
780
802
|
readonly kind: "modal-sheet";
|
|
781
803
|
readonly element: "dialog";
|
|
782
|
-
/**
|
|
783
|
-
|
|
804
|
+
/**
|
|
805
|
+
* Inline edge the sheet is attached to (logical, so it mirrors in RTL), or a card's place: `center` in the
|
|
806
|
+
* viewport, or `block-start` (centred inline, the layer profile's margin below the top).
|
|
807
|
+
*/
|
|
808
|
+
readonly edge: "start" | "end" | "center" | "block-start";
|
|
784
809
|
readonly backdrop: Backdrop;
|
|
785
|
-
/**
|
|
786
|
-
readonly motion: "slide" | null;
|
|
810
|
+
/** A sheet travels its own extent from `edge`, a card fades; `null` opens and closes instantly. */
|
|
811
|
+
readonly motion: "slide" | "fade" | null;
|
|
787
812
|
/** Breakpoint tier of the selected spatial profile from which the owner shows its inline alternative; `null` = modal at every size. */
|
|
788
813
|
readonly modalBelow: string | null;
|
|
789
814
|
}
|
|
@@ -828,6 +853,11 @@ export interface RegionSpec {
|
|
|
828
853
|
readonly markers: readonly MarkerStyle[];
|
|
829
854
|
/** A rule between the root's consecutive children. */
|
|
830
855
|
readonly between: BetweenRule | null;
|
|
856
|
+
/**
|
|
857
|
+
* Loose flow (a list whose items hold paragraphs and code): the root's stack gap is given to its children, and its
|
|
858
|
+
* last part's own space after carries out of it, so what follows starts at the larger of the two.
|
|
859
|
+
*/
|
|
860
|
+
readonly carry: boolean;
|
|
831
861
|
/** `null` for a treatment fragment without a profile. */
|
|
832
862
|
readonly profile: string | null;
|
|
833
863
|
readonly select: Readonly<Record<string, string>>;
|
|
@@ -892,7 +922,7 @@ export interface GridCell {
|
|
|
892
922
|
}
|
|
893
923
|
/** A grid's track system: owned tracks (`hybrid`, `fluid`), auto-filled tiles (`fixed`) or the parent cell's tracks (`inherited`). */
|
|
894
924
|
export type GridMode = "hybrid" | "fluid" | "fixed" | "inherited";
|
|
895
|
-
export declare const GRID_FIELDS: readonly ["columns", "weights", "gutter", "margin", "bound", "rows", "context", "align"];
|
|
925
|
+
export declare const GRID_FIELDS: readonly ["columns", "weights", "gutter", "margin", "bound", "rows", "context", "align", "contentFrom"];
|
|
896
926
|
export type GridField = (typeof GRID_FIELDS)[number];
|
|
897
927
|
/** Cell placements under a named condition of the spatial profile (`narrow-content`), replacing tier placement while it holds. */
|
|
898
928
|
export interface NamedPlacement {
|