@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
|
@@ -14,14 +14,15 @@ export const MEASURED_PROPERTIES = {
|
|
|
14
14
|
"max-block-size"
|
|
15
15
|
],
|
|
16
16
|
transform: ["translate"],
|
|
17
|
+
scale: ["scale"],
|
|
17
18
|
"size-track": ["grid-template-columns", "grid-template-rows"],
|
|
18
19
|
position: ["object-position"],
|
|
19
20
|
"intrinsic-size": ["inline-size"]
|
|
20
21
|
};
|
|
21
|
-
const HOSTS = { length: "region", transform: "region", "size-track": "grid", position: "region", "intrinsic-size": "region" }, POSITIONS = ["inset-block-start", "inset-block-end", "inset-inline-start", "inset-inline-end", "translate"];
|
|
22
|
+
const HOSTS = { length: "region", transform: "region", scale: "region", "size-track": "grid", position: "region", "intrinsic-size": "region" }, POSITIONS = ["inset-block-start", "inset-block-end", "inset-inline-start", "inset-inline-end", "translate"];
|
|
22
23
|
export const positions = (property) => POSITIONS.includes(property), measuredProperty = (scope, name) => privateProperty(scope, "measured", name);
|
|
23
24
|
function initialValue(property) {
|
|
24
|
-
if (property === "translate")
|
|
25
|
+
if (property === "translate" || property === "scale")
|
|
25
26
|
return "none";
|
|
26
27
|
if (property.startsWith("max-"))
|
|
27
28
|
return "none";
|
|
@@ -35,6 +36,8 @@ export function measuredFallback(value, own) {
|
|
|
35
36
|
return value.fallback === null ? own ?? initialValue(value.property) : px(value.fallback);
|
|
36
37
|
case "transform":
|
|
37
38
|
return value.fallback === null ? own ?? initialValue(value.property) : `${px(value.fallback.x)} ${px(value.fallback.y)}`;
|
|
39
|
+
case "scale":
|
|
40
|
+
return value.fallback === null ? own ?? initialValue(value.property) : `${value.fallback.x} ${value.fallback.y}`;
|
|
38
41
|
case "position":
|
|
39
42
|
return own ?? CENTRE;
|
|
40
43
|
case "intrinsic-size":
|
|
@@ -122,6 +125,7 @@ export function measuredTrack(list, track, read) {
|
|
|
122
125
|
function valueType(value) {
|
|
123
126
|
switch (value.type) {
|
|
124
127
|
case "transform":
|
|
128
|
+
case "scale":
|
|
125
129
|
return "{ readonly x: number; readonly y: number }";
|
|
126
130
|
case "position":
|
|
127
131
|
return "readonly [x: number, y: number]";
|
|
@@ -137,6 +141,8 @@ function written(value) {
|
|
|
137
141
|
switch (value.type) {
|
|
138
142
|
case "transform":
|
|
139
143
|
return `\`\${${read}.x}px \${${read}.y}px\``;
|
|
144
|
+
case "scale":
|
|
145
|
+
return `\`\${${read}.x} \${${read}.y}\``;
|
|
140
146
|
case "position":
|
|
141
147
|
return `\`\${(0.5 + ${read}[0]) * 100}% \${(0.5 + ${read}[1]) * 100}%\``;
|
|
142
148
|
case "intrinsic-size":
|
|
@@ -14,7 +14,7 @@ import { jsonObject } from "./json.mjs";
|
|
|
14
14
|
import { unusedArtwork } from "./asset-usage.mjs";
|
|
15
15
|
import { catalogError, contextError, fontCatalogError } from "./owner-errors.mjs";
|
|
16
16
|
import { FOUNDATION_DECLARATION, listProblemSite, sitePosition } from "./design-contexts.mjs";
|
|
17
|
-
import { tokenCss } from "./design-foundation.mjs";
|
|
17
|
+
import { tokenCss, tokenValueContexts } from "./design-foundation.mjs";
|
|
18
18
|
import { capturedDesignFiles, createDesignInputCache, designInputKey, designTexts } from "./design-inputs.mjs";
|
|
19
19
|
import { createProjectExtractionCache } from "./linaria/persisted-extraction-cache.mjs";
|
|
20
20
|
import { findingSeverity } from "./finding-rules.mjs";
|
|
@@ -27,7 +27,8 @@ import { describeTokenType } from "./token-type-check.mjs";
|
|
|
27
27
|
import { describeTokenSheet } from "./token-sheet-check.mjs";
|
|
28
28
|
import { describeSurfaceContrast, describeUnresolved, sufficientForUses } from "./surface-contrast.mjs";
|
|
29
29
|
import { describeFocus, focusChecks } from "./focus-checks.mjs";
|
|
30
|
-
import {
|
|
30
|
+
import { lengthPx } from "./css-length.mjs";
|
|
31
|
+
import { NO_TARGETS, placedSpaced, targetSizeFindings } from "./target-size.mjs";
|
|
31
32
|
import { describeTokenOverlap } from "./token-overlap.mjs";
|
|
32
33
|
import { describeGridCheck, gridChecks } from "./grid-checks.mjs";
|
|
33
34
|
import { describeFont, fontChecks } from "./font-checks.mjs";
|
|
@@ -46,12 +47,14 @@ const ACCESSIBILITY_RULES = new Map([
|
|
|
46
47
|
["construction/target-size-below-minimum", "a11y-target-size"],
|
|
47
48
|
["construction/target-area-overlap", "a11y-target-size"],
|
|
48
49
|
["construction/non-text-contrast-insufficient", "a11y-non-text-contrast"],
|
|
49
|
-
["construction/accessibility-declaration-unmet", "a11y-non-text-contrast"]
|
|
50
|
+
["construction/accessibility-declaration-unmet", "a11y-non-text-contrast"],
|
|
51
|
+
["construction/forced-boundary-missing", "a11y-forced-colors"]
|
|
50
52
|
]), ACCESSIBILITY_REVIEWS = new Map([
|
|
51
53
|
["review/click-without-keyboard", "a11y-keyboard"],
|
|
52
54
|
["review/motion-endless", "a11y-motion-endless"],
|
|
53
55
|
["review/target-size-unresolved", "a11y-target-size-unresolved"],
|
|
54
|
-
["review/target-area-overlap-unresolved", "a11y-target-size-unresolved"]
|
|
56
|
+
["review/target-area-overlap-unresolved", "a11y-target-size-unresolved"],
|
|
57
|
+
["review/forced-state-fill-only", "a11y-forced-colors-review"]
|
|
55
58
|
]), ownerRule = (code) => ACCESSIBILITY_RULES.get(code) ?? OWNER_ANALYSIS_RULE, reviewRule = (code) => ACCESSIBILITY_REVIEWS.get(code) ?? OWNER_REVIEW_RULE, TOKEN_CHECK_GUIDES = {
|
|
56
59
|
"token-provenance": "ads://guides/tokens",
|
|
57
60
|
"token-role-duplicate": "ads://guides/tokens",
|
|
@@ -161,7 +164,7 @@ async function analyzeRevision(inputs, captured, settings) {
|
|
|
161
164
|
const iconAssets = design.value.appIcon === null ? [] : appIconAssets(design.value.appIcon, assets), composed = [
|
|
162
165
|
...await timing.timeStage("composed-contrast", () => composedFindings(inputs, texts, analyzed.value, foundation, design.value.document)),
|
|
163
166
|
...timing.timeStage("composed-keyline", () => keylineFindings(inputs, analyzed.value, foundation))
|
|
164
|
-
], checkedFindings = checkFindings(inputs, analyzed.value), released = releasedSurfaces(foundation, analyzed.value, design.value.document), usedTokens = released.size === 0 ? tokens : tokenFindings(inputs, texts, foundation, design.value.document, released);
|
|
167
|
+
], checkedFindings = checkFindings(inputs, analyzed.value, await publicComponents(inputs)), released = releasedSurfaces(foundation, analyzed.value, design.value.document), usedTokens = released.size === 0 ? tokens : tokenFindings(inputs, texts, foundation, design.value.document, released);
|
|
165
168
|
return {
|
|
166
169
|
report: { ...checkedFindings, diagnostics: distinct([...missing, ...checkedFindings.diagnostics]), contexts: contextFindings, palette, tokens: usedTokens, fonts, appIcon, assets: [...assetFindings(inputs, texts, assets, analyzed.value, iconAssets), ...unreachedFindings(inputs, analyzed.value)], composed, packages: packageFindings(inputs, analyzed.value) },
|
|
167
170
|
checked: { check: analyzed.value, contexts, foundation, document: design.value.document, assets, fonts: design.value.fonts, appIcon: icon.plan, keys: new Map(reuse.keys()), options, tally }
|
|
@@ -302,8 +305,14 @@ function tokenFindings(inputs, captured, foundation, document, released = new Se
|
|
|
302
305
|
...gridChecks(foundation).map((finding) => located(finding.kind, atProfile(finding.file, finding.profile), describeGridCheck(finding)))
|
|
303
306
|
];
|
|
304
307
|
}
|
|
308
|
+
async function publicComponents(inputs) {
|
|
309
|
+
const declarations = await barrelDeclarations(inputs.dsRoot, inputs.publicAlias, inputs.framework ?? null);
|
|
310
|
+
if (declarations === null)
|
|
311
|
+
return null;
|
|
312
|
+
return new Set([...declarations.values()].flatMap((item) => item === null ? [] : [`${item.file}#${item.declaration}`]));
|
|
313
|
+
}
|
|
305
314
|
async function composedFindings(inputs, captured, check, foundation, document) {
|
|
306
|
-
const
|
|
315
|
+
const publics = await publicComponents(inputs) ?? new Set, owners = new Map;
|
|
307
316
|
for (const [name, owner] of analyzedOwners(check.outcomes))
|
|
308
317
|
owners.set(name, owner.composition);
|
|
309
318
|
for (const [name, facts] of check.plainComposition)
|
|
@@ -434,7 +443,7 @@ function sitePositionIn(inputs, text, site) {
|
|
|
434
443
|
const { line, column } = sitePosition(site, text(site.file));
|
|
435
444
|
return { file: projectFile(inputs, path.join(inputs.dsRoot, site.file)), line, column };
|
|
436
445
|
}
|
|
437
|
-
export function checkFindings(inputs, check) {
|
|
446
|
+
export function checkFindings(inputs, check, publics = null) {
|
|
438
447
|
const diagnostics = [], advisories = [];
|
|
439
448
|
for (const [name, outcome] of check.outcomes)
|
|
440
449
|
switch (outcome.kind) {
|
|
@@ -451,12 +460,15 @@ export function checkFindings(inputs, check) {
|
|
|
451
460
|
for (const failure of check.program)
|
|
452
461
|
diagnostics.push(...findingsOf(inputs, { kind: "owner", failure }));
|
|
453
462
|
diagnostics.push(...tokenCssFindings(inputs, analyzedOwners(check.outcomes), check.foundation));
|
|
454
|
-
const targets = timing.timeStage("target-size", () => targetFindings(inputs, analyzedOwners(check.outcomes), check.foundation));
|
|
463
|
+
const targets = timing.timeStage("target-size", () => targetFindings(inputs, analyzedOwners(check.outcomes), check.foundation, placedSpacing(analyzedOwners(check.outcomes), check.plainPlacements ?? [], publics)));
|
|
455
464
|
diagnostics.push(...targets.diagnostics);
|
|
456
465
|
advisories.push(...targets.advisories);
|
|
466
|
+
advisories.push(...counterFindings(inputs, analyzedOwners(check.outcomes)));
|
|
467
|
+
diagnostics.push(...documentFindings(inputs, analyzedOwners(check.outcomes)));
|
|
468
|
+
diagnostics.push(...endAlignmentFindings(inputs, analyzedOwners(check.outcomes), check.foundation));
|
|
457
469
|
return { diagnostics: distinct(diagnostics), advisories };
|
|
458
470
|
}
|
|
459
|
-
function targetFindings(inputs, owners, foundation) {
|
|
471
|
+
function targetFindings(inputs, owners, foundation, spacing) {
|
|
460
472
|
const diagnostics = [], advisories = new Map;
|
|
461
473
|
for (const facts of owners.values())
|
|
462
474
|
for (const style of facts.styles.values()) {
|
|
@@ -464,7 +476,9 @@ function targetFindings(inputs, owners, foundation) {
|
|
|
464
476
|
if (first?.kind !== "point")
|
|
465
477
|
continue;
|
|
466
478
|
const origin = { ...first, file: path.join(inputs.dsRoot, first.file) };
|
|
467
|
-
for (const finding of targetSizeFindings(foundation, constructionTargets(style.facts)))
|
|
479
|
+
for (const finding of targetSizeFindings(foundation, constructionTargets(style.facts))) {
|
|
480
|
+
if (finding.kind === "target-size-below-minimum" && finding.element === "&" && spacedWhereverPlaced(foundation, style, spacing))
|
|
481
|
+
continue;
|
|
468
482
|
switch (finding.kind) {
|
|
469
483
|
case "target-size-below-minimum":
|
|
470
484
|
case "target-area-overlap":
|
|
@@ -477,9 +491,172 @@ function targetFindings(inputs, owners, foundation) {
|
|
|
477
491
|
break;
|
|
478
492
|
}
|
|
479
493
|
}
|
|
494
|
+
}
|
|
480
495
|
}
|
|
481
496
|
return { diagnostics, advisories: [...advisories.values()] };
|
|
482
497
|
}
|
|
498
|
+
function endAlignmentFindings(inputs, owners, foundation) {
|
|
499
|
+
const insets = new Map;
|
|
500
|
+
for (const facts of owners.values())
|
|
501
|
+
for (const style of facts.styles.values())
|
|
502
|
+
if (style.endInset !== void 0 && style.endInset !== null)
|
|
503
|
+
for (const root of style.roots ?? [])
|
|
504
|
+
insets.set(root, style.endInset);
|
|
505
|
+
const findings = [];
|
|
506
|
+
for (const facts of owners.values())
|
|
507
|
+
for (const style of facts.styles.values()) {
|
|
508
|
+
const parts = style.stackParts ?? [];
|
|
509
|
+
if (parts.length < 2)
|
|
510
|
+
continue;
|
|
511
|
+
const [first] = style.origins;
|
|
512
|
+
if (first?.kind !== "point")
|
|
513
|
+
continue;
|
|
514
|
+
const resolved = parts.flatMap((stacked) => {
|
|
515
|
+
if (stacked.kind === "box")
|
|
516
|
+
return [{ part: stacked.part, inset: stacked.inset }];
|
|
517
|
+
const placement = (style.placements ?? []).find((item) => item.part === stacked.part && item.target !== null), inset = placement?.target === void 0 || placement.target === null ? void 0 : insets.get(`${placement.target.file}#${placement.target.name}`);
|
|
518
|
+
return inset === void 0 ? [] : [{ part: stacked.part, inset }];
|
|
519
|
+
});
|
|
520
|
+
if (resolved.length < 2)
|
|
521
|
+
continue;
|
|
522
|
+
for (const context of tokenValueContexts(foundation)) {
|
|
523
|
+
const ends = resolved.flatMap(({ part, inset }) => {
|
|
524
|
+
let px = 0;
|
|
525
|
+
for (const value of inset) {
|
|
526
|
+
const read = lengthPx(value, context);
|
|
527
|
+
if (read.kind !== "px")
|
|
528
|
+
return [];
|
|
529
|
+
px += read.px;
|
|
530
|
+
}
|
|
531
|
+
return [{ part, px }];
|
|
532
|
+
}), counts = new Map;
|
|
533
|
+
for (const { px } of ends)
|
|
534
|
+
counts.set(Math.round(px), (counts.get(Math.round(px)) ?? 0) + 1);
|
|
535
|
+
const line = [...counts].sort((a, b) => b[1] - a[1])[0]?.[0];
|
|
536
|
+
if (line === void 0)
|
|
537
|
+
continue;
|
|
538
|
+
const off = ends.find(({ px }) => Math.abs(px - line) > 1 && Math.abs(px - line) <= 64);
|
|
539
|
+
if (off === void 0)
|
|
540
|
+
continue;
|
|
541
|
+
const other = ends.find(({ px }) => Math.round(px) === line);
|
|
542
|
+
findings.push(...findingsOf(inputs, {
|
|
543
|
+
kind: "owner",
|
|
544
|
+
failure: { kind: "source", origin: { ...first, file: path.join(inputs.dsRoot, first.file) }, problem: { kind: "end-misaligned", part: off.part, other: other?.part ?? "", distancePx: Math.round((line - off.px) * 100) / 100, context: context.label } }
|
|
545
|
+
}));
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return findings;
|
|
550
|
+
}
|
|
551
|
+
function documentFindings(inputs, owners) {
|
|
552
|
+
let first = null;
|
|
553
|
+
const findings = [];
|
|
554
|
+
for (const [name, facts] of owners)
|
|
555
|
+
for (const style of facts.styles.values()) {
|
|
556
|
+
if (style.document !== !0)
|
|
557
|
+
continue;
|
|
558
|
+
const [origin] = style.origins;
|
|
559
|
+
if (first === null || first === name) {
|
|
560
|
+
first = name;
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (origin?.kind !== "point")
|
|
564
|
+
continue;
|
|
565
|
+
findings.push(...findingsOf(inputs, { kind: "owner", failure: { kind: "source", origin: { ...origin, file: path.join(inputs.dsRoot, origin.file) }, problem: { kind: "document-duplicate", first } } }));
|
|
566
|
+
}
|
|
567
|
+
return findings;
|
|
568
|
+
}
|
|
569
|
+
function counterFindings(inputs, owners) {
|
|
570
|
+
const reset = new Set, used = new Map;
|
|
571
|
+
for (const facts of owners.values())
|
|
572
|
+
for (const style of facts.styles.values()) {
|
|
573
|
+
for (const match of style.css.matchAll(/counter-reset:\s*([a-z][a-z0-9-]*)/g))
|
|
574
|
+
reset.add(match[1] ?? "");
|
|
575
|
+
const [first] = style.origins;
|
|
576
|
+
if (first?.kind !== "point")
|
|
577
|
+
continue;
|
|
578
|
+
for (const match of style.css.matchAll(/counter-increment:\s*([a-z][a-z0-9-]*)|counters?\(\s*([a-z][a-z0-9-]*)/g)) {
|
|
579
|
+
const name = match[1] ?? match[2] ?? "";
|
|
580
|
+
if (name !== "list-item" && !used.has(name))
|
|
581
|
+
used.set(name, { ...first, file: path.join(inputs.dsRoot, first.file) });
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return [...used].flatMap(([counter, origin]) => reset.has(counter) ? [] : [reviewFinding(inputs, { origin, review: { kind: "counter-unreset", counter } })]);
|
|
585
|
+
}
|
|
586
|
+
function placedSpacing(owners, plain, publics) {
|
|
587
|
+
if (publics === null)
|
|
588
|
+
return new Map;
|
|
589
|
+
const roots = new Map;
|
|
590
|
+
for (const facts of owners.values())
|
|
591
|
+
for (const style of facts.styles.values()) {
|
|
592
|
+
const root = constructionTargets(style.facts).elements.find((element) => element.element === "&");
|
|
593
|
+
if (root !== void 0)
|
|
594
|
+
for (const component of style.roots ?? [])
|
|
595
|
+
roots.set(component, root);
|
|
596
|
+
}
|
|
597
|
+
const keyOf = (target) => target === null ? null : `${target.file}#${target.name}`, spacing = new Map, unknown = (key) => void spacing.set(key, null), add = (key, neighbour) => {
|
|
598
|
+
const known = spacing.get(key);
|
|
599
|
+
if (known === null)
|
|
600
|
+
return;
|
|
601
|
+
if (known === void 0)
|
|
602
|
+
spacing.set(key, [neighbour]);
|
|
603
|
+
else
|
|
604
|
+
known.push(neighbour);
|
|
605
|
+
}, accounted = new Set;
|
|
606
|
+
for (const [file, facts] of owners)
|
|
607
|
+
for (const style of facts.styles.values()) {
|
|
608
|
+
const placements = style.placements ?? [];
|
|
609
|
+
for (const placement of placements) {
|
|
610
|
+
const key = keyOf(placement.target);
|
|
611
|
+
if (key !== null)
|
|
612
|
+
accounted.add(`${key}@${file}:${placement.at.line}:${placement.at.column}`);
|
|
613
|
+
}
|
|
614
|
+
for (const pair of constructionTargets(style.facts).placed ?? []) {
|
|
615
|
+
const keys = (side) => side.kind === "own" ? [] : placements.filter((item) => item.part === side.part).map((item) => keyOf(item.target)), geometry = (side) => {
|
|
616
|
+
if (side.kind === "own")
|
|
617
|
+
return side.geometry;
|
|
618
|
+
const found = keys(side).map((key) => key === null ? void 0 : roots.get(key));
|
|
619
|
+
return found.length === 1 ? found[0] ?? null : null;
|
|
620
|
+
};
|
|
621
|
+
for (const [own, other] of [[pair.first, pair.second], [pair.second, pair.first]]) {
|
|
622
|
+
const neighbour = geometry(other);
|
|
623
|
+
for (const key of keys(own)) {
|
|
624
|
+
if (key === null)
|
|
625
|
+
continue;
|
|
626
|
+
if (neighbour === null)
|
|
627
|
+
unknown(key);
|
|
628
|
+
else
|
|
629
|
+
add(key, { axis: pair.axis, gap: pair.gap, other: neighbour });
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
for (const [file, facts] of owners)
|
|
635
|
+
for (const position of facts.composition.positions) {
|
|
636
|
+
if (position.content.kind !== "placement")
|
|
637
|
+
continue;
|
|
638
|
+
const key = keyOf(position.content.target);
|
|
639
|
+
if (key !== null && !accounted.has(`${key}@${file}:${position.at.line}:${position.at.column}`))
|
|
640
|
+
unknown(key);
|
|
641
|
+
}
|
|
642
|
+
for (const placement of plain) {
|
|
643
|
+
const key = keyOf(placement.target);
|
|
644
|
+
if (key !== null)
|
|
645
|
+
unknown(key);
|
|
646
|
+
}
|
|
647
|
+
for (const key of publics)
|
|
648
|
+
unknown(key);
|
|
649
|
+
return spacing;
|
|
650
|
+
}
|
|
651
|
+
function spacedWhereverPlaced(foundation, style, spacing) {
|
|
652
|
+
const root = constructionTargets(style.facts).elements.find((element) => element.element === "&"), components = style.roots ?? [];
|
|
653
|
+
if (root === void 0 || components.length === 0)
|
|
654
|
+
return !1;
|
|
655
|
+
return components.every((component) => {
|
|
656
|
+
const neighbours = spacing.get(component);
|
|
657
|
+
return neighbours !== null && neighbours !== void 0 && placedSpaced(foundation, root, neighbours);
|
|
658
|
+
});
|
|
659
|
+
}
|
|
483
660
|
function constructionTargets(facts) {
|
|
484
661
|
switch (facts.kind) {
|
|
485
662
|
case "control":
|
|
@@ -533,7 +710,7 @@ function revisionEnvironment() {
|
|
|
533
710
|
function tokenCssFindings(inputs, owners, foundation) {
|
|
534
711
|
const findings = [];
|
|
535
712
|
for (const [owner, facts] of owners) {
|
|
536
|
-
const used = new Set([...facts.styles.values()].flatMap((style) => [...style.used])), css = tokenCss(foundation, used);
|
|
713
|
+
const used = new Set([...facts.styles.values()].flatMap((style) => [...style.used, ...style.scriptTokens ?? []])), css = tokenCss(foundation, used);
|
|
537
714
|
if (css.kind === "err")
|
|
538
715
|
findings.push(...findingsOf(inputs, { kind: "owner", failure: { kind: "token-css", owner, failure: css.error } }));
|
|
539
716
|
}
|
|
@@ -625,7 +802,9 @@ function designInputPosition(inputs, failure) {
|
|
|
625
802
|
case "profile-rejected":
|
|
626
803
|
case "token-role":
|
|
627
804
|
case "provided-role-self":
|
|
805
|
+
case "forced-color-invalid":
|
|
628
806
|
return foundationPosition(inputs);
|
|
807
|
+
case "document-text-incomplete":
|
|
629
808
|
case "document-profile-kind":
|
|
630
809
|
return designFile(inputs, FOUNDATION_DECLARATION);
|
|
631
810
|
}
|
package/dist/owner-errors.mjs
CHANGED
|
@@ -65,6 +65,8 @@ export function foundationError(failure) {
|
|
|
65
65
|
case "profile-field-unknown":
|
|
66
66
|
case "token-role":
|
|
67
67
|
case "provided-role-self":
|
|
68
|
+
case "forced-color-invalid":
|
|
69
|
+
case "document-text-incomplete":
|
|
68
70
|
case "document-profile-kind":
|
|
69
71
|
return { code: `foundation/${failure.kind}`, ...entry(foundationErrors, failure.kind, failure) };
|
|
70
72
|
}
|
|
@@ -131,6 +133,7 @@ export function constructionError(failure) {
|
|
|
131
133
|
case "target-area-overlap":
|
|
132
134
|
case "non-text-contrast-insufficient":
|
|
133
135
|
case "corner-overpaint":
|
|
136
|
+
case "forced-boundary-missing":
|
|
134
137
|
case "accessibility-declaration-unmet":
|
|
135
138
|
case "layer-root-padding":
|
|
136
139
|
case "layer-frame-position":
|
package/dist/owner-lowering.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
REFERENCE_ROOT_PX,
|
|
14
14
|
controlBox,
|
|
15
15
|
controlBoxValues,
|
|
16
|
+
controlInlineExtent,
|
|
16
17
|
LINE_BOX,
|
|
17
18
|
frameTarget,
|
|
18
19
|
hitAreaOf,
|
|
@@ -71,7 +72,7 @@ export function lowerControl(spec, foundation, input) {
|
|
|
71
72
|
const line = frame[BORDER_STYLE];
|
|
72
73
|
if (line !== void 0 && spec.normalize.some(([property]) => property === "border-style"))
|
|
73
74
|
return reject({ kind: "extent-conflict", element: "&", property: "border-style", providers: ["frame profile", "normalize"] });
|
|
74
|
-
const
|
|
75
|
+
const { asset, hasText } = input;
|
|
75
76
|
if (!hasText && asset === null && spec.decor.length === 0)
|
|
76
77
|
return reject({ kind: "content-missing" });
|
|
77
78
|
if (asset !== null && asset.paint === "slots")
|
|
@@ -81,7 +82,7 @@ export function lowerControl(spec, foundation, input) {
|
|
|
81
82
|
...controlArrangement(spec),
|
|
82
83
|
...spec.extent === "container" && spec.layout !== "native" ? { display: "flex", "inline-size": "100%" } : {},
|
|
83
84
|
"box-sizing": "border-box",
|
|
84
|
-
...
|
|
85
|
+
...controlInlineExtent(frame, keepsWidth ? null : "0"),
|
|
85
86
|
...text,
|
|
86
87
|
...controlBoxValues(box),
|
|
87
88
|
...line === void 0 ? {} : { "border-style": line },
|
package/dist/ownership-model.mjs
CHANGED
|
@@ -16,14 +16,16 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
16
16
|
text: binding,
|
|
17
17
|
surface: binding,
|
|
18
18
|
align: oneOf("start", "center", "end", "baseline", "stretch"),
|
|
19
|
-
justify: oneOf("start", "center", "end"),
|
|
19
|
+
justify: oneOf("start", "center", "end", "space-between", "space-around", "space-evenly"),
|
|
20
20
|
wrap: oneOf("true", "false"),
|
|
21
|
+
carry: oneOf("true", "false"),
|
|
21
22
|
extent: oneOf("content", "container"),
|
|
22
23
|
gap: spacing,
|
|
23
24
|
"row-gap": spacing,
|
|
24
25
|
overlap: overlapSpacing,
|
|
25
26
|
"anchor-clear": anchorClear,
|
|
26
27
|
columns: positive,
|
|
28
|
+
"content-from": (value) => /^[a-z][\w-]*$/.test(value),
|
|
27
29
|
weights: (value) => value.split(/\s+/).length <= 64 && value.split(/\s+/).every((weight) => /^\d+(\.\d+)?$/.test(weight) && Number(weight) > 0),
|
|
28
30
|
rows: (value) => value.split(/\s+/).length <= 12 && value.split(/\s+/).every((row) => ["auto", "fill"].includes(row)),
|
|
29
31
|
gutter: (value) => identifier.test(value),
|
|
@@ -39,6 +41,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
39
41
|
},
|
|
40
42
|
"ads-part": {
|
|
41
43
|
kind: oneOf("text", "visual", "vector", "component"),
|
|
44
|
+
align: oneOf("start", "center", "end"),
|
|
42
45
|
"space-before": spacing,
|
|
43
46
|
"space-after": spacing,
|
|
44
47
|
spacing: binding,
|
|
@@ -99,7 +102,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
99
102
|
motion: binding
|
|
100
103
|
},
|
|
101
104
|
"ads-enter": { surface: binding, motion: binding, translate: metric("motion", ["distance"]), "translate-inline": metric("motion", ["distance"]), scale: metric("motion", ["scale"]), rotate: metric("motion", ["angle"]) },
|
|
102
|
-
"ads-pseudo": { surface: binding, text: binding },
|
|
105
|
+
"ads-pseudo": { surface: binding, text: binding, frame: binding },
|
|
103
106
|
"ads-counter": { reset: () => !0, increment: () => !0 },
|
|
104
107
|
"ads-between": { surface: binding, frame: binding },
|
|
105
108
|
"ads-content": { counter: () => !0, counters: () => !0, style: () => !0, separator: () => !0, prefix: () => !0, suffix: () => !0 },
|
|
@@ -111,7 +114,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
111
114
|
"ads-snap": { type: oneOf(...SNAP_TYPES), align: oneOf(...SNAP_ALIGNS) },
|
|
112
115
|
"ads-layer": {
|
|
113
116
|
element: oneOf("dialog", "popover"),
|
|
114
|
-
edge: oneOf("start", "end"),
|
|
117
|
+
edge: oneOf("start", "end", "center", "block-start"),
|
|
115
118
|
"backdrop-surface": binding,
|
|
116
119
|
"backdrop-dismiss": oneOf("press", "none"),
|
|
117
120
|
motion: oneOf("slide", "fade"),
|
package/dist/preview-bun.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CLIENT_DIRECTIVE } from "./analysis/client-directive.mjs";
|
|
2
|
+
import { EXTERNAL_MARKER } from "./analysis/externals.mjs";
|
|
1
3
|
import { eachChild, mapAsync } from "./analysis/queries.mjs";
|
|
2
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
5
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -23,7 +25,7 @@ import { isRecord } from "./unknown.mjs";
|
|
|
23
25
|
import { adsViewDefinition } from "./ads-views.mjs";
|
|
24
26
|
import { PREVIEW_CONTROLS_FILE, PREVIEW_FACTS_FILE, PREVIEW_TOKENS_SHEET } from "./emit/preview-tree.mjs";
|
|
25
27
|
import { parsePreviewControls } from "./preview-controls.mjs";
|
|
26
|
-
const distributedFrame = existsSync(new URL("./showcase/preview-frame.mjs", import.meta.url)), builtFrame = !distributedFrame && existsSync(new URL("../dist/showcase/ui/ui.js", import.meta.url)), compiledFrame = distributedFrame || builtFrame, previewFrameDirectory = distributedFrame ? "./showcase/" : builtFrame ? "../dist/showcase/" : "../showcase-client/", previewFrameFile = (file) => fileURLToPath(new URL(`${previewFrameDirectory}${file}`, import.meta.url)), previewFrameModule = (name) => previewFrameFile(`${name}${compiledFrame ? ".mjs" : ".mts"}`);
|
|
28
|
+
const JSX_DOCUMENT_TAGS = /(?:(?<=(?:^|[(>{}?:,=]|\breturn|&&|\|\|)\s*)<()(html|head|body)|<(\/)(html|head|body))(?=[\s>])/gm, JSX_DOCUMENT_TAG = /(?<=(?:^|[(>{?:,=]|\breturn|&&|\|\|)\s*)<html(?=[\s>])/m, distributedFrame = existsSync(new URL("./showcase/preview-frame.mjs", import.meta.url)), builtFrame = !distributedFrame && existsSync(new URL("../dist/showcase/ui/ui.js", import.meta.url)), compiledFrame = distributedFrame || builtFrame, previewFrameDirectory = distributedFrame ? "./showcase/" : builtFrame ? "../dist/showcase/" : "../showcase-client/", previewFrameFile = (file) => fileURLToPath(new URL(`${previewFrameDirectory}${file}`, import.meta.url)), previewFrameModule = (name) => previewFrameFile(`${name}${compiledFrame ? ".mjs" : ".mts"}`);
|
|
27
29
|
export const SCENARIO_KIT = "@reqvire-org/ads/showcase", previewFrameFiles = [
|
|
28
30
|
previewFrameModule("preview-frame"),
|
|
29
31
|
previewFrameFile("preview-frame.css"),
|
|
@@ -222,7 +224,8 @@ export function createBunPreviewBuilder() {
|
|
|
222
224
|
return pending;
|
|
223
225
|
}
|
|
224
226
|
async function source(file, ancestors, defer) {
|
|
225
|
-
const
|
|
227
|
+
const read = readFileSync(file, "utf8"), clientFree = read.startsWith(`${CLIENT_DIRECTIVE}
|
|
228
|
+
`) ? read.slice(CLIENT_DIRECTIVE.length + 1) : read, standIn = externalStandIn(clientFree, options.config.framework), original = standIn !== null ? standIn : /\.[jt]sx$/.test(file) && JSX_DOCUMENT_TAG.test(clientFree) ? clientFree.replace(JSX_DOCUMENT_TAGS, (_, __, opened) => opened !== void 0 ? `<div data-ads-${opened}=""${opened === "head" ? " hidden" : ""}` : "</div") : clientFree;
|
|
226
229
|
inputs.add(file);
|
|
227
230
|
let code = await optimizeImports(original, file);
|
|
228
231
|
if (/\bnew\s+(?:Worker|SharedWorker|URL)\s*\(/.test(code)) {
|
|
@@ -521,3 +524,13 @@ function workerArguments(node) {
|
|
|
521
524
|
return node.arguments ?? [];
|
|
522
525
|
return;
|
|
523
526
|
}
|
|
527
|
+
export function externalStandIn(source, framework) {
|
|
528
|
+
const marks = [...source.matchAll(/\/\* ads-external (\{[^*]*\}) \*\//g)].map((match) => JSON.parse(match[1] ?? "{}"));
|
|
529
|
+
if (!source.includes(EXTERNAL_MARKER) || marks.length === 0)
|
|
530
|
+
return null;
|
|
531
|
+
const create = framework === "preact" ? 'import { h as createElement } from "preact";' : 'import { createElement } from "react";', pass = 'Object.fromEntries(Object.entries(props).filter(([key, value]) => key === "children" || key === "className" || typeof value === "string" || typeof value === "number" || key.startsWith("on") || key.startsWith("aria-") || key.startsWith("data-")))';
|
|
532
|
+
return `${create}
|
|
533
|
+
${marks.map((mark) => `export function ${mark.name}(props) { const { children, ...rest } = ${pass}; return createElement(${JSON.stringify(mark.renders)}, rest, children); }`).join(`
|
|
534
|
+
`)}
|
|
535
|
+
`;
|
|
536
|
+
}
|
package/dist/profile-macro.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Token } from "./authoring-macro.mjs";
|
|
2
2
|
import type { TokenProfileKind } from "./role-vocabulary.mjs";
|
|
3
|
+
import type { SystemColor } from "./system-colors.mjs";
|
|
3
4
|
/** Derived from the role vocabulary, so a kind the model accepts is always a kind authors can type; `composite` holds slots, not token fields. */
|
|
4
5
|
export type ProfileKind = TokenProfileKind | "composite";
|
|
5
6
|
export type ProfileReference = string | {
|
|
@@ -24,9 +25,15 @@ export interface ProfileSpec {
|
|
|
24
25
|
readonly fixedStart?: Token;
|
|
25
26
|
readonly fixedEnd?: Token;
|
|
26
27
|
}>>;
|
|
28
|
+
/**
|
|
29
|
+
* Gutter modes: an edge gutter insets each cell by `start` and `end`; a gap gutter (`{ gap }`) separates the
|
|
30
|
+
* tracks by `column-gap`, with the outer cells flush to the region's edges (card grids).
|
|
31
|
+
*/
|
|
27
32
|
readonly gutters?: Readonly<Record<string, {
|
|
28
33
|
readonly start?: Token;
|
|
29
34
|
readonly end?: Token;
|
|
35
|
+
} | {
|
|
36
|
+
readonly gap: Token;
|
|
30
37
|
}>>;
|
|
31
38
|
readonly conditions?: Readonly<Record<string, {
|
|
32
39
|
readonly maxWidth?: Token;
|
|
@@ -41,6 +48,17 @@ export interface ProfileSpec {
|
|
|
41
48
|
* applies: what can sit inside is proven with the provided values on that element's background.
|
|
42
49
|
*/
|
|
43
50
|
readonly provides?: Readonly<Record<`--${string}`, Token>>;
|
|
51
|
+
/**
|
|
52
|
+
* A `surface` profile's colours in forced colours (Windows contrast themes), from the CSS system colours:
|
|
53
|
+
* a selected item's `{ background: "Highlight", color: "HighlightText" }`, a disabled control's
|
|
54
|
+
* `{ color: "GrayText", border: "GrayText" }`. Written under `@media (forced-colors: active)` wherever the
|
|
55
|
+
* surface applies, its states included. Undeclared surfaces keep the browser's own mapping.
|
|
56
|
+
*/
|
|
57
|
+
readonly forcedColors?: {
|
|
58
|
+
readonly background?: SystemColor;
|
|
59
|
+
readonly color?: SystemColor;
|
|
60
|
+
readonly border?: SystemColor;
|
|
61
|
+
};
|
|
44
62
|
/**
|
|
45
63
|
* A `sequence` profile's steps, each at a whole percentage of the run from 0 to 100. A step states
|
|
46
64
|
* what the part looks like there: `opacity`, travel (`translateInline`, `translateBlock`), one scale
|
package/dist/recipe-macro.d.mts
CHANGED
|
@@ -94,7 +94,7 @@ export interface SnapDeclaration {
|
|
|
94
94
|
/** Content beyond the element's box: clipped, or scrolled on the block axis, the inline axis or both. */
|
|
95
95
|
export type Overflow = "clip" | "scroll-block" | "scroll-inline" | "scroll-both";
|
|
96
96
|
/** A native element the region or part renders, for its closed normalization. */
|
|
97
|
-
export type NativeElement = "iframe" | "select" | "search-input" | "text-input" | "table" | "header-cell" | "cell" | "list" | "summary";
|
|
97
|
+
export type NativeElement = "iframe" | "select" | "search-input" | "text-input" | "table" | "header-cell" | "cell" | "list" | "summary" | "document";
|
|
98
98
|
/** A paint a surface treatment can transition. */
|
|
99
99
|
export type PaintChannel = "background-color" | "border-color" | "color" | "text-decoration-color" | "box-shadow" | "filter" | "backdrop-filter" | "opacity";
|
|
100
100
|
/** Paint channels of one element that change between its state surfaces, timed by a motion profile. */
|
|
@@ -156,6 +156,12 @@ export type GeneratedContent = {
|
|
|
156
156
|
readonly suffix?: string;
|
|
157
157
|
};
|
|
158
158
|
/** A marker's or generated content's treatment: a colour-only surface, a text profile of weight and numerals, content. */
|
|
159
|
+
/** A range slider's track or thumb: a surface and a frame profile, with surfaces per owner state. */
|
|
160
|
+
export interface SliderTreatment {
|
|
161
|
+
readonly surface: string;
|
|
162
|
+
readonly frame: string;
|
|
163
|
+
readonly when?: Readonly<Record<string, string>>;
|
|
164
|
+
}
|
|
159
165
|
export interface GeneratedTreatment {
|
|
160
166
|
readonly surface?: string;
|
|
161
167
|
readonly text?: string;
|
|
@@ -174,12 +180,18 @@ export interface PseudoTreatment {
|
|
|
174
180
|
/** A root in the browser's top layer: a modal `<dialog>` sheet, a `popover` panel pinned to a viewport corner, or one the owner anchors through measured values. */
|
|
175
181
|
export type LayerDeclaration = {
|
|
176
182
|
readonly element: "dialog";
|
|
177
|
-
|
|
183
|
+
/**
|
|
184
|
+
* A sheet attached to an inline edge (`start`, `end`), or a card: `center` in the viewport, or `block-start`
|
|
185
|
+
* (centred inline, below the top). A card keeps the layer profile's `viewportMargin` from the viewport edges.
|
|
186
|
+
*/
|
|
187
|
+
readonly edge: "start" | "end" | "center" | "block-start";
|
|
188
|
+
/** The backdrop's surface: its `background`, and optionally its `backdropBlur` (the page behind, blurred). */
|
|
178
189
|
readonly backdrop: {
|
|
179
190
|
readonly surface: string;
|
|
180
191
|
readonly dismiss?: "press" | "none";
|
|
181
192
|
};
|
|
182
|
-
|
|
193
|
+
/** A sheet slides in from its edge; a card fades in. */
|
|
194
|
+
readonly motion?: "slide" | "fade";
|
|
183
195
|
/** A breakpoint tier of the recipe's spatial profile; the recipe's `modalQuery` is the range below it. */
|
|
184
196
|
readonly modalBelow?: string;
|
|
185
197
|
} | {
|
|
@@ -221,6 +233,16 @@ export type MeasuredDeclaration = {
|
|
|
221
233
|
};
|
|
222
234
|
readonly motion?: string;
|
|
223
235
|
}
|
|
236
|
+
/** A scale factor per axis: with a measured translation, an image grows from its place into a zoom view (FLIP). */
|
|
237
|
+
| {
|
|
238
|
+
readonly type: "scale";
|
|
239
|
+
readonly property: "scale";
|
|
240
|
+
readonly fallback?: {
|
|
241
|
+
readonly x: number;
|
|
242
|
+
readonly y: number;
|
|
243
|
+
};
|
|
244
|
+
readonly motion?: string;
|
|
245
|
+
}
|
|
224
246
|
/** One track (1-based) of a grid's own track list. */
|
|
225
247
|
| {
|
|
226
248
|
readonly type: "size-track";
|
|
@@ -270,13 +292,18 @@ export interface RecipeSpec {
|
|
|
270
292
|
readonly surface?: ProfileReference | SlotField;
|
|
271
293
|
readonly motion?: ProfileReference | SlotField;
|
|
272
294
|
readonly align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
273
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Main-axis placement. `space-between` (and `space-around`, `space-evenly`) puts the free space between a row's
|
|
297
|
+
* or stack's items: a logo at the start and actions at the end. A wrapping row keeps it on every line.
|
|
298
|
+
*/
|
|
299
|
+
readonly justify?: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
274
300
|
/**
|
|
275
301
|
* Root: flex wrapping. Text part: `true`/`"anywhere"` breaks long words, `"never"` keeps one line, `"truncate"` ends it
|
|
276
302
|
* with an ellipsis (after `lines` lines when set), `"balance"` evens out line lengths (headings, short titles) and
|
|
277
303
|
* `"pretty"` avoids a lone short word on the last line (body text).
|
|
278
304
|
*/
|
|
279
|
-
|
|
305
|
+
/** `"preserve"`: spaces and line breaks kept, long lines wrapped (code that stays visible at the column's width). */
|
|
306
|
+
readonly wrap?: boolean | "anywhere" | "never" | "truncate" | "balance" | "pretty" | "preserve";
|
|
280
307
|
readonly textAlign?: "start" | "center" | "end";
|
|
281
308
|
/** Lines of the part's text profile it always reserves. */
|
|
282
309
|
readonly reserveLines?: 1 | 2 | 3;
|
|
@@ -301,6 +328,12 @@ export interface RecipeSpec {
|
|
|
301
328
|
readonly columns?: number;
|
|
302
329
|
/** A fluid grid with local `columns`: the share of the width each column takes (`[0.85, 1.15]`); every column weighs 1 without it. */
|
|
303
330
|
readonly weights?: readonly number[];
|
|
331
|
+
/**
|
|
332
|
+
* A fluid grid: from this breakpoint tier up its columns are as wide as their content and the free space lies
|
|
333
|
+
* between them (a footer's link columns); below it the columns share the width as usual, which is where the grid
|
|
334
|
+
* goes when its columns do not fit side by side. Cells there fit their columns by construction.
|
|
335
|
+
*/
|
|
336
|
+
readonly contentFrom?: string;
|
|
304
337
|
readonly rows?: readonly ("auto" | "fill")[];
|
|
305
338
|
readonly gutter?: string;
|
|
306
339
|
readonly margin?: "none";
|
|
@@ -448,6 +481,10 @@ export interface RecipeSpec {
|
|
|
448
481
|
readonly before?: GeneratedTreatment & {
|
|
449
482
|
readonly content: GeneratedContent;
|
|
450
483
|
};
|
|
484
|
+
/** A range slider's track (`<input type="range">`): its surface (background, border) and frame (block size, radius). */
|
|
485
|
+
readonly sliderTrack?: SliderTreatment;
|
|
486
|
+
/** A range slider's thumb: its surface and frame (inline and block size, radius, border); centred on the track. */
|
|
487
|
+
readonly sliderThumb?: SliderTreatment;
|
|
451
488
|
};
|
|
452
489
|
/** CSS counters: where a count starts (`reset`) and what this element counts (`increment`). `list-item` is the browser's own list counter. */
|
|
453
490
|
readonly counter?: {
|
|
@@ -462,6 +499,12 @@ export interface RecipeSpec {
|
|
|
462
499
|
readonly surface: string;
|
|
463
500
|
readonly frame: string;
|
|
464
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Loose flow, on the root: a stack gives its gap to its children, and its last part's own `spaceAfter` carries out
|
|
504
|
+
* of it. On a list and on its item (an item that holds paragraphs and code), the next item starts at the larger of
|
|
505
|
+
* the list's gap and the item's last block's space after.
|
|
506
|
+
*/
|
|
507
|
+
readonly carry?: boolean;
|
|
465
508
|
/** On a part: `"assistive"` hides it on screen while assistive technology still reads it (a table caption). */
|
|
466
509
|
readonly presence?: "visible" | "assistive";
|
|
467
510
|
/** A list's marker style at each nesting depth, outermost first; deeper lists keep the last. */
|
|
@@ -478,7 +521,7 @@ export type MeasuredValues<M> = [keyof M] extends [never] ? {
|
|
|
478
521
|
readonly [name: string]: never;
|
|
479
522
|
} : {
|
|
480
523
|
readonly [K in keyof M]?: M[K] extends {
|
|
481
|
-
readonly type: "transform";
|
|
524
|
+
readonly type: "transform" | "scale";
|
|
482
525
|
} ? {
|
|
483
526
|
readonly x: number;
|
|
484
527
|
readonly y: number;
|