@reqvire-org/ads 0.5.1 → 0.5.3
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 +143 -51
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/design-usage.mjs +4 -20
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/mock-check.mjs +4 -5
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-accessibility.mjs +4 -4
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +56 -7
- package/dist/analysis/owner-composition.mjs +179 -45
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +304 -110
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +13 -6
- package/dist/cli.mjs +1 -1
- package/dist/composed-contrast.mjs +143 -62
- package/dist/composed-keyline.mjs +2 -2
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +9 -3
- package/dist/construction-spec.d.mts +145 -31
- package/dist/construction-spec.mjs +204 -74
- package/dist/corner-overpaint.mjs +20 -7
- package/dist/derived-states.mjs +182 -0
- package/dist/design-foundation.mjs +16 -0
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/design-usage.mjs +2 -8
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +6 -9
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +3 -0
- package/dist/form-states.mjs +8 -0
- package/dist/frame-regions.mjs +29 -9
- package/dist/grid-lowering.mjs +3 -1
- package/dist/hover-geometry.mjs +15 -0
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-enter.mjs +6 -6
- package/dist/lowering-properties.mjs +5 -0
- package/dist/lowering-region-layout.mjs +7 -2
- package/dist/lowering-session.mjs +10 -0
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +1 -1
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/mcp/server-observation.mjs +6 -4
- package/dist/mcp/server-project.mjs +4 -1
- package/dist/motion-model.mjs +1 -1
- package/dist/owner-analysis-check.mjs +23 -6
- package/dist/owner-errors.mjs +6 -3
- package/dist/owner-lowering.mjs +78 -13
- package/dist/owner-scenarios.mjs +6 -23
- package/dist/ownership-model.mjs +24 -8
- package/dist/paint-contrast.mjs +6 -0
- package/dist/placeholder-contrast.mjs +17 -1
- package/dist/platform-features.mjs +10 -1
- package/dist/profile-macro.d.mts +7 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +103 -40
- package/dist/recipe-model.mjs +18 -13
- package/dist/region-lowering.mjs +266 -123
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +18 -3
- package/dist/render-audit.mjs +114 -1
- package/dist/role-vocabulary.d.mts +9 -0
- package/dist/role-vocabulary.mjs +16 -1
- package/dist/runtime-paint-contrast.mjs +5 -2
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/showcase/assets-view.mjs +29 -13
- package/dist/showcase/client.bundle.js +50 -50
- package/dist/showcase/http-client.bundle.js +15 -15
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/ads-designer/references/accessibility.md +10 -4
- package/dist/skills/ads-designer/references/branding.md +13 -3
- package/dist/skills/ads-designer/references/contracts.md +5 -2
- package/dist/skills/ads-designer/references/design-data.md +13 -7
- package/dist/skills/ads-designer/references/layout.md +12 -4
- package/dist/skills/ads-designer/references/motion.md +11 -2
- package/dist/skills/ads-designer/references/recipes.md +49 -15
- package/dist/skills/ads-import/references/contracts.md +5 -2
- package/dist/skills/ads-import/references/design-data.md +13 -7
- package/dist/skills/ads-import/references/layout.md +12 -4
- package/dist/skills/ads-import/references/recipes.md +49 -15
- package/dist/skills/ads-migrate/SKILL.md +2 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
- package/dist/skills/ads-port/references/contracts.md +5 -2
- package/dist/skills/ads-port/references/design-data.md +13 -7
- package/dist/skills/ads-port/references/layout.md +12 -4
- package/dist/skills/ads-port/references/recipes.md +49 -15
- package/dist/spatial-model.mjs +2 -2
- package/dist/surface-contrast.mjs +7 -2
- package/dist/surface-effects.mjs +5 -3
- package/dist/target-size.mjs +21 -3
- package/dist/task-cache.mjs +8 -18
- package/dist/validation-checks.mjs +1 -1
- package/docs/ADS.md +9 -3
- package/docs/ARCHITECTURE.md +96 -30
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +307 -23
- package/docs/GUIDE.md +109 -20
- package/docs/LANGUAGE.md +262 -117
- package/docs/MCP.md +5 -1
- package/docs/MOTION.md +15 -4
- package/docs/PROFILE-KINDS.md +54 -4
- package/docs/RULES.md +34 -25
- package/docs/TOKEN-ROLES.md +7 -1
- package/package.json +1 -1
- package/dist/analysis/prose-owners.mjs +0 -57
- package/dist/prose-model.d.mts +0 -81
- package/dist/prose-model.mjs +0 -101
package/dist/emit/service.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { lstatSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { parseCheckedArchitectureReport } from "../architecture-report.mjs";
|
|
4
|
+
import { rememberCheckedReport, warmChecksFor } from "../check-service.mjs";
|
|
5
|
+
import { digest } from "../digest.mjs";
|
|
3
6
|
import { analyzeCaptured } from "../analysis/service.mjs";
|
|
4
7
|
import { createAnalysisInputCapture, inputRevision } from "../analysis/inputs.mjs";
|
|
5
8
|
import { loadConfig } from "../config.mjs";
|
|
@@ -83,7 +86,7 @@ async function revisionTree({ root, trackingRoot, analysisRoot, signal, analysis
|
|
|
83
86
|
const operation = analyzed.value;
|
|
84
87
|
if (operation.inputs !== expected)
|
|
85
88
|
return err({ kind: "source-changed" });
|
|
86
|
-
if (
|
|
89
|
+
if (digest(await architectureTaskInputs(root, trackingRoot)) !== digest(captured))
|
|
87
90
|
return err({ kind: "source-changed" });
|
|
88
91
|
const blockers = emissionBlockers(operation.check), { emission } = operation;
|
|
89
92
|
if (blockers.length > 0 || emission === null)
|
|
@@ -94,11 +97,14 @@ async function revisionTree({ root, trackingRoot, analysisRoot, signal, analysis
|
|
|
94
97
|
case "emitted":
|
|
95
98
|
break;
|
|
96
99
|
}
|
|
97
|
-
const files = new Map([...emission.files, ...emission.binaries.map(([name, bytes]) => [name, decodeEmittedBytes(bytes)])]), contract = buildContract(revision, files);
|
|
100
|
+
const files = new Map([...emission.files, ...emission.binaries.map(([name, bytes]) => [name, decodeEmittedBytes(bytes)])]), contract = buildContract(revision, files), checked = parseCheckedArchitectureReport({ key: digest(captured), revision, report: operation.check });
|
|
101
|
+
if (checked !== void 0 && root === trackingRoot && warmChecksFor(root))
|
|
102
|
+
rememberCheckedReport(checked);
|
|
98
103
|
return ok({
|
|
99
104
|
revision,
|
|
100
105
|
inputs: captured.files,
|
|
101
106
|
capturedAt,
|
|
107
|
+
...checked === void 0 ? {} : { checked },
|
|
102
108
|
files: new Map([...files, [CONTRACT_FILE, serializeContract(contract)]]),
|
|
103
109
|
previewFiles: new Map(emission.previewFiles),
|
|
104
110
|
contract,
|
package/dist/finding-rules.mjs
CHANGED
|
@@ -26,6 +26,9 @@ export const findingRules = Object.freeze({
|
|
|
26
26
|
"corner-overpainted": "error",
|
|
27
27
|
"render-audit-skipped": "info",
|
|
28
28
|
"render-audit-nothing-measured": "review",
|
|
29
|
+
"render-audit-construction-unrendered": "review",
|
|
30
|
+
"render-audit-state-forced": "review",
|
|
31
|
+
"render-audit-state-derivable": "info",
|
|
29
32
|
"layout-shift": "error",
|
|
30
33
|
"asset-unused": "error",
|
|
31
34
|
"theme-undefined": "error",
|
package/dist/form-states.mjs
CHANGED
|
@@ -60,6 +60,14 @@ function nonColour(foundation, treatment) {
|
|
|
60
60
|
}
|
|
61
61
|
export function formStateFailures(foundation, spec) {
|
|
62
62
|
const found = [], byState = new Map;
|
|
63
|
+
if (spec.kind === "region") {
|
|
64
|
+
const shaped = [...spec.geometryWhen.map((state) => ["&", state]), ...spec.parts.flatMap(function each(part) {
|
|
65
|
+
return [...part.geometryWhen.map((state) => [`& > ${part.selector}`, state]), ...part.parts.flatMap(each)];
|
|
66
|
+
})];
|
|
67
|
+
for (const [element, state] of shaped)
|
|
68
|
+
if (formStateOf(state.condition) === "autofill")
|
|
69
|
+
found.push({ path: state.path, failure: { kind: "autofill-layout-shift", condition: state.condition, element, property: state.frame !== null ? "frame" : state.spacing !== null ? "spacing" : "collapsed" } });
|
|
70
|
+
}
|
|
63
71
|
for (const treatment of treatments(spec)) {
|
|
64
72
|
const state = formStateOf(treatment.condition);
|
|
65
73
|
if (state === null)
|
package/dist/frame-regions.mjs
CHANGED
|
@@ -27,7 +27,11 @@ function needed(fields, context) {
|
|
|
27
27
|
return { kind: "px", px: minimum.px, field: "min-inline-size" };
|
|
28
28
|
return sized.kind === "px" && sized.px > 0 ? sized : { kind: "none" };
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
export const rootFrames = (spec) => [
|
|
31
|
+
void 0,
|
|
32
|
+
...spec?.kind === "region" ? [...new Set(spec.geometryWhen.flatMap((state) => state.frame === null ? [] : [state.frame]))] : []
|
|
33
|
+
];
|
|
34
|
+
function frameOf(foundation, spec, under) {
|
|
31
35
|
if (spec === null || spec.kind !== "region" && spec.kind !== "control")
|
|
32
36
|
return null;
|
|
33
37
|
if (spec.kind === "region" && (spec.frame === null || spec.profile === null))
|
|
@@ -37,10 +41,10 @@ function frameOf(foundation, spec) {
|
|
|
37
41
|
const selected = selectedProfile(foundation, spec.profile, spec.select);
|
|
38
42
|
if (selected.kind === "err")
|
|
39
43
|
return null;
|
|
40
|
-
const profile = selected.value,
|
|
41
|
-
if (
|
|
44
|
+
const profile = selected.value, own = profile.kind === "frame" ? spec.profile : profile.kind === "composite" ? profile.fields.get("frame-profile") : void 0;
|
|
45
|
+
if (own === void 0)
|
|
42
46
|
return null;
|
|
43
|
-
const frame = name === spec.profile ? selected : selectedProfile(foundation, name);
|
|
47
|
+
const name = under ?? own, frame = name === spec.profile ? selected : selectedProfile(foundation, name);
|
|
44
48
|
return frame.kind === "ok" && frame.value.kind === "frame" ? { name, fields: Object.fromEntries(frame.value.fields) } : null;
|
|
45
49
|
}
|
|
46
50
|
const UA_INSET = new Set(["ul", "ol", "menu", "dd", "figure", "blockquote", "fieldset"]);
|
|
@@ -89,10 +93,10 @@ export function gridKeylineOf(foundation, spec) {
|
|
|
89
93
|
const start = tokenName(spatial.value.clauses.get(`ads-gutter ${mode}`)?.get("start")), line = tokenName(spatial.value.clauses.get(`ads-gutter ${KEYLINE_GUTTER}`)?.get("start")), fine = tokenName(spatial.value.fields.get("fine-unit"));
|
|
90
94
|
return start === void 0 || line === void 0 || fine === void 0 ? null : { gutter: mode, start, line, fine };
|
|
91
95
|
}
|
|
92
|
-
export function frameInlinePadding(foundation, spec) {
|
|
96
|
+
export function frameInlinePadding(foundation, spec, under) {
|
|
93
97
|
if (spec === null || spec.kind !== "region")
|
|
94
98
|
return null;
|
|
95
|
-
const frame = frameOf(foundation, spec);
|
|
99
|
+
const frame = frameOf(foundation, spec, under);
|
|
96
100
|
return frame === null ? null : { frame: frame.name, padding: frameInlineInsets(frame.fields).start ?? null };
|
|
97
101
|
}
|
|
98
102
|
export function paddingPx(value, context) {
|
|
@@ -111,7 +115,15 @@ export function keylineOffset(keyline, padding, context) {
|
|
|
111
115
|
return { insetPx, keylinePx: line.px, tolerancePx: fine.px, missed: Math.abs(insetPx - line.px) > fine.px + 0.01 };
|
|
112
116
|
}
|
|
113
117
|
export function keylineFinding(foundation, place, spec, keyline) {
|
|
114
|
-
const
|
|
118
|
+
for (const under of rootFrames(spec)) {
|
|
119
|
+
const found = keylineOf(foundation, place, spec, keyline, under);
|
|
120
|
+
if (found !== null)
|
|
121
|
+
return found;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
function keylineOf(foundation, place, spec, keyline, under) {
|
|
126
|
+
const framed = frameInlinePadding(foundation, spec, under);
|
|
115
127
|
if (framed === null)
|
|
116
128
|
return null;
|
|
117
129
|
const frame = { name: framed.frame }, padding = framed.padding;
|
|
@@ -134,7 +146,12 @@ export function keylineFinding(foundation, place, spec, keyline) {
|
|
|
134
146
|
}
|
|
135
147
|
const regionsIn = (regions, context) => regions.contexts.find((item) => item.contexts.includes(context)) ?? regions;
|
|
136
148
|
export function frameRegionFinding(foundation, place, spec, regions, moved) {
|
|
137
|
-
const
|
|
149
|
+
const found = rootFrames(spec).map((under) => frameRegionOf(foundation, place, spec, regions, moved, under));
|
|
150
|
+
return firstFinding(found);
|
|
151
|
+
}
|
|
152
|
+
const firstFinding = (found) => found.find((finding) => finding !== null && finding.kind !== "frame-region-unresolved") ?? found.find((finding) => finding !== null) ?? null;
|
|
153
|
+
function frameRegionOf(foundation, place, spec, regions, moved, under) {
|
|
154
|
+
const frame = frameOf(foundation, spec, under);
|
|
138
155
|
if (frame === null)
|
|
139
156
|
return null;
|
|
140
157
|
const { cell, element } = place;
|
|
@@ -214,6 +231,9 @@ export function componentCellFinding(foundation, cell, component, regions) {
|
|
|
214
231
|
};
|
|
215
232
|
}
|
|
216
233
|
export function tileFrameFinding(foundation, place, spec, component, regions) {
|
|
234
|
+
return firstFinding(rootFrames(spec).map((under) => tileFrameOf(foundation, place, spec, component, regions, under)));
|
|
235
|
+
}
|
|
236
|
+
function tileFrameOf(foundation, place, spec, component, regions, under) {
|
|
217
237
|
const { cell, element } = place;
|
|
218
238
|
if (component !== null)
|
|
219
239
|
return {
|
|
@@ -224,7 +244,7 @@ export function tileFrameFinding(foundation, place, spec, component, regions) {
|
|
|
224
244
|
reason: `that frame is ${component}'s own owner's, which this owner does not see; a tile is at most ${regions.tilePx === null ? "its tile size" : px(regions.tilePx)} and shrinks to a narrower region`,
|
|
225
245
|
context: tokenValueContexts(foundation)[0]?.label ?? ":root"
|
|
226
246
|
};
|
|
227
|
-
const frame = frameOf(foundation, spec);
|
|
247
|
+
const frame = frameOf(foundation, spec, under);
|
|
228
248
|
if (frame === null)
|
|
229
249
|
return null;
|
|
230
250
|
let unresolved = null;
|
package/dist/grid-lowering.mjs
CHANGED
|
@@ -83,7 +83,9 @@ export function lowerGrid(spec, foundation, input) {
|
|
|
83
83
|
return reject({ kind: "spatial-clause-unsupported", clause: `condition ${placement.condition} cell ${selector}` });
|
|
84
84
|
const cells = spec.cells.map((cell) => {
|
|
85
85
|
const override = placement.cells.find(([selector]) => selector === cell.selector)?.[1];
|
|
86
|
-
|
|
86
|
+
if (override === void 0)
|
|
87
|
+
return cell;
|
|
88
|
+
return { ...cell, values: cell.repeat && !override.some(([field]) => field === "start") ? [...override, ["start", "auto"]] : override, at: [] };
|
|
87
89
|
});
|
|
88
90
|
return { placement, tree: layoutTree(cells) };
|
|
89
91
|
}), geometry = geometryOf(foundation, geometryTokens, reject), algebra = model(spatialModel(definition, geometry), reject), pristine = { source: source.clone(), alternates: alternates.map(({ placement, tree }) => ({ placement, tree: tree.clone() })) }, tile = spec.mode === "fixed" ? token(field("tile-size")) : null, regionsOf = (base, placed, length) => ({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const pointer = (state) => state.condition.includes(":hover") && (state.frame !== null || state.spacing !== null || state.collapsed !== null);
|
|
2
|
+
export function hoverGeometry(spec) {
|
|
3
|
+
if (spec.kind !== "region" || spec.layer !== null)
|
|
4
|
+
return [];
|
|
5
|
+
const found = spec.geometryWhen.filter(pointer).map((state) => ({ element: "&", condition: state.condition, path: state.path })), visit = (parts, layered) => {
|
|
6
|
+
for (const part of parts) {
|
|
7
|
+
if (!layered)
|
|
8
|
+
for (const state of part.geometryWhen.filter(pointer))
|
|
9
|
+
found.push({ element: part.name, condition: state.condition, path: state.path });
|
|
10
|
+
visit(part.parts, part.arrangement?.layout === "layered");
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
visit(spec.parts, spec.arrangement.layout === "layered");
|
|
14
|
+
return found;
|
|
15
|
+
}
|
package/dist/input-digests.mjs
CHANGED
|
@@ -53,16 +53,20 @@ export function createInputDigests(root, inputSet, { watchFiles = !0, fallbackMs
|
|
|
53
53
|
if (!watchFiles || closed || options === void 0)
|
|
54
54
|
return;
|
|
55
55
|
const wanted = new Set(inputSet.directories(options, digests));
|
|
56
|
-
for (const [directory, watcher] of watchers)
|
|
56
|
+
for (const [directory, { watcher }] of watchers)
|
|
57
57
|
if (!wanted.has(directory)) {
|
|
58
58
|
watcher.close();
|
|
59
59
|
watchers.delete(directory);
|
|
60
60
|
}
|
|
61
61
|
for (const directory of wanted) {
|
|
62
|
-
|
|
63
|
-
continue;
|
|
62
|
+
const previous = watchers.get(directory);
|
|
64
63
|
try {
|
|
65
|
-
const
|
|
64
|
+
const stat = statSync(directory, { bigint: !0 });
|
|
65
|
+
if (previous?.dev === stat.dev && previous.ino === stat.ino)
|
|
66
|
+
continue;
|
|
67
|
+
previous?.watcher.close();
|
|
68
|
+
watchers.delete(directory);
|
|
69
|
+
const relative = path.relative(root, directory), single = stat.isFile(), watcher = watch(directory, (event, file) => {
|
|
66
70
|
if (!single) {
|
|
67
71
|
notify(file ? path.join(relative, file.toString()) : null, event);
|
|
68
72
|
return;
|
|
@@ -70,20 +74,23 @@ export function createInputDigests(root, inputSet, { watchFiles = !0, fallbackMs
|
|
|
70
74
|
notify(relative, event);
|
|
71
75
|
if (event === "rename") {
|
|
72
76
|
watcher.close();
|
|
73
|
-
if (watchers.get(directory) === watcher)
|
|
77
|
+
if (watchers.get(directory)?.watcher === watcher)
|
|
74
78
|
watchers.delete(directory);
|
|
75
79
|
}
|
|
76
80
|
});
|
|
77
81
|
watcher.on("error", (error) => {
|
|
78
82
|
watcher.close();
|
|
79
|
-
if (watchers.get(directory) === watcher)
|
|
83
|
+
if (watchers.get(directory)?.watcher === watcher)
|
|
80
84
|
watchers.delete(directory);
|
|
81
|
-
|
|
85
|
+
restructure();
|
|
82
86
|
onError?.(error);
|
|
83
87
|
});
|
|
84
|
-
watchers.set(directory, watcher);
|
|
88
|
+
watchers.set(directory, { watcher, dev: stat.dev, ino: stat.ino });
|
|
85
89
|
} catch (error) {
|
|
86
|
-
|
|
90
|
+
previous?.watcher.close();
|
|
91
|
+
if (watchers.get(directory) === previous)
|
|
92
|
+
watchers.delete(directory);
|
|
93
|
+
restructure();
|
|
87
94
|
onError?.(error);
|
|
88
95
|
}
|
|
89
96
|
}
|
|
@@ -208,7 +215,7 @@ export function createInputDigests(root, inputSet, { watchFiles = !0, fallbackMs
|
|
|
208
215
|
closed = !0;
|
|
209
216
|
if (timer)
|
|
210
217
|
clearInterval(timer);
|
|
211
|
-
for (const watcher of watchers.values())
|
|
218
|
+
for (const { watcher } of watchers.values())
|
|
212
219
|
watcher.close();
|
|
213
220
|
watchers.clear();
|
|
214
221
|
}
|
|
@@ -4,6 +4,7 @@ import { constructionId } from "./extraction-model.mjs";
|
|
|
4
4
|
import { loadProcessorRuntime } from "./processor-runtime.mjs";
|
|
5
5
|
import { err, ok } from "../result.mjs";
|
|
6
6
|
import * as timing from "../stage-timing.mjs";
|
|
7
|
+
import { throwIfCancelled } from "../analysis/context.mjs";
|
|
7
8
|
export function compileDelivery(owners, options = {}) {
|
|
8
9
|
const tally = { constructions: 0, extracted: 0 };
|
|
9
10
|
return timing.timeStage("linaria-extraction", () => compileOwners(owners, options, tally), void 0, () => ({ ...tally }));
|
|
@@ -22,6 +23,7 @@ function compileOwners(owners, options, tally) {
|
|
|
22
23
|
const css = lowered.css.replaceAll(`.${lowered.root}`, "&");
|
|
23
24
|
let entry = shared.get(id);
|
|
24
25
|
if (entry === void 0) {
|
|
26
|
+
throwIfCancelled();
|
|
25
27
|
const compiled = compileOne(runtime.value, options.cache, id, owner, lowered.origins, css, tally);
|
|
26
28
|
if (compiled.kind === "err")
|
|
27
29
|
return compiled;
|
package/dist/lowering-enter.mjs
CHANGED
|
@@ -15,17 +15,17 @@ export function enterRules(input) {
|
|
|
15
15
|
const blurred = fields.blur !== void 0, shadowOf = (surface) => {
|
|
16
16
|
const field = [SHAPE_SHADOW, GROUP_SHADOW].find((name) => surface[name] !== void 0);
|
|
17
17
|
return field === void 0 ? {} : { [field]: surface[field] ?? "" };
|
|
18
|
-
}, effects = (surface) => fields.blur === void 0 ? {} : { blur: fields.blur, ...shadowOf(surface) }, values = { ...fields.opacity === void 0 ? {} : { opacity: fields.opacity }, ...effects(base) };
|
|
19
|
-
if (movement !== null)
|
|
20
|
-
values[
|
|
21
|
-
const repeated = states.flatMap((state) => {
|
|
18
|
+
}, effects = (surface) => fields.blur === void 0 ? {} : { blur: fields.blur, ...shadowOf(surface) }, values = { ...fields.opacity === void 0 ? {} : { opacity: fields.opacity }, ...effects(base) }, property = movement === null ? null : movement.kind === "translateInline" ? "translate" : movement.kind;
|
|
19
|
+
if (movement !== null && property !== null)
|
|
20
|
+
values[property] = movement.kind === "translate" ? `0 ${movement.value}` : movement.kind === "translateInline" ? `${movement.value} 0` : movement.value;
|
|
21
|
+
const mirrored = movement?.kind === "translateInline" ? [{ selector: `${selector}:dir(rtl)`, values: { translate: `calc(${movement.value} * -1) 0` }, condition: STARTING }] : [], repeated = states.flatMap((state) => {
|
|
22
22
|
const own = {
|
|
23
23
|
...fields.opacity !== void 0 && state.fields.opacity !== void 0 ? { opacity: fields.opacity } : {},
|
|
24
24
|
...blurred && ["blur", SHAPE_SHADOW, GROUP_SHADOW].some((field) => state.fields[field] !== void 0) ? effects({ ...shadowOf(base), ...shadowOf(state.fields) }) : {}
|
|
25
25
|
};
|
|
26
26
|
return Object.keys(own).length === 0 ? [] : [{ selector: state.selector, values: own, condition: STARTING }];
|
|
27
|
-
}), properties = [...fields.opacity === void 0 ? [] : ["opacity"], ...blurred ? ["filter"] : [], ...
|
|
27
|
+
}), properties = [...fields.opacity === void 0 ? [] : ["opacity"], ...blurred ? ["filter"] : [], ...property === null ? [] : [property]], conflict = properties.find((property) => taken.includes(property));
|
|
28
28
|
if (conflict !== void 0)
|
|
29
29
|
return err({ kind: "enter-property-conflict", element: selector, property: conflict });
|
|
30
|
-
return ok({ group: { properties, timing }, start: [{ selector, values, condition: STARTING }, ...repeated], blurred });
|
|
30
|
+
return ok({ group: { properties, timing }, start: [{ selector, values, condition: STARTING }, ...mirrored, ...repeated], blurred });
|
|
31
31
|
}
|
|
@@ -63,6 +63,11 @@ export const FAMILIES = [
|
|
|
63
63
|
"resize",
|
|
64
64
|
"scroll-snap-type",
|
|
65
65
|
"scroll-snap-align",
|
|
66
|
+
"scroll-margin-block-start",
|
|
67
|
+
"appearance",
|
|
68
|
+
"-webkit-appearance",
|
|
69
|
+
"visibility",
|
|
70
|
+
"interpolate-size",
|
|
66
71
|
"-webkit-user-select",
|
|
67
72
|
"content",
|
|
68
73
|
"align-items",
|
|
@@ -142,14 +142,19 @@ export function textLayoutValues(layout, part, hasText) {
|
|
|
142
142
|
}
|
|
143
143
|
return ok(values);
|
|
144
144
|
}
|
|
145
|
-
export function
|
|
145
|
+
export function growsWithContent(values) {
|
|
146
|
+
return values["min-block-size"] !== void 0 && values["min-block-size"] !== "0" && values["block-size"] === void 0 && values["max-block-size"] === void 0 && values["aspect-ratio"] === void 0 && values.overflow === void 0;
|
|
147
|
+
}
|
|
148
|
+
export function extentValues(extent, parent, part, parentGrows = !1) {
|
|
146
149
|
switch (extent.kind) {
|
|
147
150
|
case "content":
|
|
148
151
|
return ok({});
|
|
149
152
|
case "fill": {
|
|
150
153
|
if (parent !== "stack" && parent !== "inline")
|
|
151
154
|
return err({ kind: "extent-parent-unsupported", part, layout: parent });
|
|
152
|
-
const values = { "flex-grow": "1", "flex-shrink": "1", "flex-basis": "0"
|
|
155
|
+
const main = parent === "stack" ? "block" : "inline", values = { "flex-grow": "1", "flex-shrink": "1", "flex-basis": "0" };
|
|
156
|
+
if (!(parent === "stack" && parentGrows))
|
|
157
|
+
values[`min-${main}-size`] = "0";
|
|
153
158
|
if (extent.axis === "both")
|
|
154
159
|
values["align-self"] = "stretch";
|
|
155
160
|
return ok(values);
|
|
@@ -67,6 +67,15 @@ export function createLoweringSession(context, operation) {
|
|
|
67
67
|
return err({ kind: "paint", error: channels.error });
|
|
68
68
|
registry = withChannels(registry, slots);
|
|
69
69
|
return write(channels.value);
|
|
70
|
+
}, writeProvidedRoles = (request) => {
|
|
71
|
+
const roles = request.values.map(([property]) => property), reserved = roles.find((property) => !/^--[a-z][\w-]*$/.test(property) || property.startsWith("--ads-") || property.startsWith("--asset-"));
|
|
72
|
+
if (reserved !== void 0)
|
|
73
|
+
return err({ kind: "emission", error: { kind: "unregistered-property", property: reserved, origin } });
|
|
74
|
+
const extended = new Map(registry);
|
|
75
|
+
for (const property of roles)
|
|
76
|
+
extended.set(property, { kind: "independent" });
|
|
77
|
+
registry = extended;
|
|
78
|
+
return write(request);
|
|
70
79
|
}, documents = new Map;
|
|
71
80
|
return {
|
|
72
81
|
write,
|
|
@@ -75,6 +84,7 @@ export function createLoweringSession(context, operation) {
|
|
|
75
84
|
writeContinuousRotation,
|
|
76
85
|
writeKeyframes,
|
|
77
86
|
writePaintChannels,
|
|
87
|
+
writeProvidedRoles,
|
|
78
88
|
writeDocument: (rule) => void documents.set(rule.kind, rule),
|
|
79
89
|
blocks: () => written,
|
|
80
90
|
keyframes: () => [...keyframes.values()],
|
|
@@ -220,7 +220,15 @@ export function createBuildReporter(directory, { apps, session = process.env.ADS
|
|
|
220
220
|
const app = current.find((app) => app.id === id);
|
|
221
221
|
if (!app)
|
|
222
222
|
throw Error(`Unknown preview ID: ${id}`);
|
|
223
|
-
|
|
223
|
+
let digest;
|
|
224
|
+
try {
|
|
225
|
+
digest = artifactDigest(projectPath(root, app.file, "preview artifact"));
|
|
226
|
+
} catch (failure) {
|
|
227
|
+
if (isRecord(failure) && failure.code === "ENOENT")
|
|
228
|
+
return !1;
|
|
229
|
+
throw failure;
|
|
230
|
+
}
|
|
231
|
+
value.artifactDigest = digest;
|
|
224
232
|
value.state = "ready";
|
|
225
233
|
value.lastSuccessfulRevision = revision;
|
|
226
234
|
value.diagnostics = [];
|
|
@@ -4,7 +4,8 @@ import net from "node:net";
|
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { isRecord } from "../unknown.mjs";
|
|
7
|
-
|
|
7
|
+
import { parseCheckedArchitectureReport } from "../architecture-report.mjs";
|
|
8
|
+
export const emittedMessage = (session, update, sources, capturedAt, checked) => ({
|
|
8
9
|
type: "emitted",
|
|
9
10
|
session,
|
|
10
11
|
revision: update.revision,
|
|
@@ -12,7 +13,8 @@ export const emittedMessage = (session, update, sources, capturedAt) => ({
|
|
|
12
13
|
written: update.written,
|
|
13
14
|
removed: update.removed,
|
|
14
15
|
sources,
|
|
15
|
-
capturedAt
|
|
16
|
+
capturedAt,
|
|
17
|
+
...checked === void 0 ? {} : { checked }
|
|
16
18
|
});
|
|
17
19
|
const text = (value) => typeof value === "string", texts = (value) => Array.isArray(value) && value.every(text);
|
|
18
20
|
function previewRequest(value) {
|
|
@@ -89,8 +91,10 @@ export function parseToCompiler(value) {
|
|
|
89
91
|
return text(session) && files ? { type: "draft-changes", session, files } : null;
|
|
90
92
|
}
|
|
91
93
|
case "emitted": {
|
|
92
|
-
const { revision, tree, written, removed } = { revision: value.revision, tree: value.tree, written: value.written, removed: value.removed }, sources = inputDigests(value.sources), capturedAt = value.capturedAt;
|
|
93
|
-
|
|
94
|
+
const { revision, tree, written, removed } = { revision: value.revision, tree: value.tree, written: value.written, removed: value.removed }, sources = inputDigests(value.sources), capturedAt = value.capturedAt, checked = parseCheckedArchitectureReport(value.checked);
|
|
95
|
+
if (value.checked !== void 0 && (checked === void 0 || checked.revision !== revision))
|
|
96
|
+
return null;
|
|
97
|
+
return text(session) && text(revision) && text(tree) && texts(written) && texts(removed) && sources && typeof capturedAt === "number" && Number.isFinite(capturedAt) ? { type: "emitted", session, revision, tree, written, removed, sources, capturedAt, ...checked === void 0 ? {} : { checked } } : null;
|
|
94
98
|
}
|
|
95
99
|
case "emit-failed": {
|
|
96
100
|
const message = value.message, diagnostics = all(value.diagnostics, emitFailureDiagnostic), capturedAt = value.capturedAt;
|
|
@@ -198,6 +202,8 @@ export function createCompilerChannel({ onMessage, onConnect } = {}) {
|
|
|
198
202
|
return {
|
|
199
203
|
env: { ADS_MCP_CHANNEL: address, ADS_MCP_CHANNEL_TOKEN: token },
|
|
200
204
|
state(key, message, replay = message) {
|
|
205
|
+
if (closed)
|
|
206
|
+
return;
|
|
201
207
|
latest.set(key, replay);
|
|
202
208
|
write(message);
|
|
203
209
|
},
|
|
@@ -210,6 +216,7 @@ export function createCompilerChannel({ onMessage, onConnect } = {}) {
|
|
|
210
216
|
if (closed)
|
|
211
217
|
return;
|
|
212
218
|
closed = !0;
|
|
219
|
+
latest.clear();
|
|
213
220
|
peer?.destroy();
|
|
214
221
|
server.close();
|
|
215
222
|
if (directory)
|
package/dist/mcp/mutations.mjs
CHANGED
|
@@ -546,6 +546,7 @@ export function createMutationController(directory, { captures = createCaptureCo
|
|
|
546
546
|
if (candidateOptions.config.framework)
|
|
547
547
|
await emitPreviewTreeOnce(candidate, {
|
|
548
548
|
signal,
|
|
549
|
+
trackingRoot: root,
|
|
549
550
|
onTree: (tree) => {
|
|
550
551
|
candidateTree = tree;
|
|
551
552
|
}
|