basalt-ui 2.19.0 → 2.21.0
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/CHANGELOG.md +89 -0
- package/MIGRATING.md +291 -12
- package/agent/agents/basalt-design-reviewer.md +22 -5
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-app/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +10 -23
- package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
- package/agent/skills/basalt-design/references/catalogue.md +48 -0
- package/agent/skills/basalt-design/references/concept.md +36 -0
- package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
- package/agent/skills/basalt-design/references/stat-tile.md +24 -0
- package/agent/templates/AGENTS-block.md.tpl +3 -3
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/configs/oxlint-plugin.js +34 -19
- package/configs/oxlint-plugin.test.ts +32 -2
- package/dist/charts/ChartCard.d.ts +33 -4
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +37 -11
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +13 -1
- package/dist/charts/Heatmap.js +1 -1
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +137 -18
- package/dist/charts/box.d.ts +2 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +2 -0
- package/dist/charts/chart-box.module.css +30 -0
- package/dist/charts/chart-box.module.css.d.ts +1 -0
- package/dist/charts/chart-card.module.css +47 -0
- package/dist/charts/chart-card.module.css.d.ts +7 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +35 -8
- package/dist/charts/host.d.ts.map +1 -1
- package/dist/charts/host.js +2 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/sparkline.module.css +59 -0
- package/dist/charts/sparkline.module.css.d.ts +13 -0
- package/dist/charts/state.d.ts +5 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +34 -4
- package/dist/charts/types.d.ts +6 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/check-theme.d.ts.map +1 -1
- package/dist/cli/check-theme.js +3 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +3 -2
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -15
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +3 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +6 -1
- package/dist/cli/shot/detect.d.ts +51 -0
- package/dist/cli/shot/detect.d.ts.map +1 -0
- package/dist/cli/shot/detect.js +396 -0
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +7 -4
- package/dist/cli/shot/measure.d.ts +2 -0
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +2 -0
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +2 -0
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -2
- package/dist/common/retry-button.d.ts +12 -0
- package/dist/common/retry-button.d.ts.map +1 -0
- package/dist/common/retry-button.js +22 -0
- package/dist/common/retry-button.module.css +58 -0
- package/dist/common/retry-button.module.css.d.ts +8 -0
- package/dist/controls/sync-button.d.ts +3 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/dashboard/bar-list.d.ts +18 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +39 -15
- package/dist/dashboard/bar-list.module.css +77 -2
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/delta-badge.d.ts +8 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +9 -2
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +53 -6
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +62 -14
- package/dist/dashboard/meter-parts.d.ts +5 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +140 -68
- package/dist/dashboard/meter.d.ts +29 -4
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +8 -1
- package/dist/dashboard/meter.module.css +74 -43
- package/dist/dashboard/meter.module.css.d.ts +4 -4
- package/dist/dashboard/query-state.d.ts +1 -1
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +16 -10
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +14 -25
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +1 -1
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +5 -7
- package/dist/dashboard/stat-card.module.css +15 -7
- package/dist/dashboard/stat-group.d.ts +11 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +9 -7
- package/dist/dashboard/stat-strip.d.ts +67 -0
- package/dist/dashboard/stat-strip.d.ts.map +1 -0
- package/dist/dashboard/stat-strip.js +115 -0
- package/dist/dashboard/stat-strip.module.css +291 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +32 -0
- package/dist/dashboard/visual-slot.d.ts +2 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -0
- package/dist/dashboard/visual-slot.js +5 -0
- package/dist/dashboard/widget-header.d.ts +3 -3
- package/dist/dashboard/widget-header.module.css +10 -6
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +4 -3
- package/dist/format/shared.d.ts +6 -0
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +6 -2
- package/dist/guard/index.d.ts +16 -3
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +15 -1
- package/dist/guard/palette.d.ts +51 -0
- package/dist/guard/palette.d.ts.map +1 -0
- package/dist/guard/palette.js +190 -0
- package/dist/guard/series-file.d.ts +15 -0
- package/dist/guard/series-file.d.ts.map +1 -0
- package/dist/guard/series-file.js +29 -0
- package/dist/guard/types.d.ts +3 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +6 -0
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/dist/theme/card-inset.module.css +76 -0
- package/dist/theme/card-inset.module.css.d.ts +9 -0
- package/dist/theme/controls.module.css +13 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +41 -0
- package/dist/theme/nav-link.module.css +8 -10
- package/dist/theme/status-dot.d.ts +3 -2
- package/dist/theme/status-dot.d.ts.map +1 -1
- package/dist/theme/status-dot.js +12 -3
- package/dist/theme/status-verdict.d.ts +3 -2
- package/dist/theme/status-verdict.d.ts.map +1 -1
- package/dist/theme/status-verdict.js +3 -2
- package/dist/theme/status-verdict.module.css +4 -2
- package/dist/tokens/oklab.d.ts +28 -0
- package/dist/tokens/oklab.d.ts.map +1 -0
- package/dist/tokens/oklab.js +73 -0
- package/llms.txt +33 -7
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +79 -5
- package/src/charts/Donut.tsx +9 -1
- package/src/charts/Heatmap.tsx +1 -1
- package/src/charts/Sparkline.tsx +180 -18
- package/src/charts/box.tsx +2 -0
- package/src/charts/chart-box.module.css +30 -0
- package/src/charts/chart-box.module.css.d.ts +1 -0
- package/src/charts/chart-card.module.css +47 -0
- package/src/charts/chart-card.module.css.d.ts +7 -0
- package/src/charts/compile.ts +42 -9
- package/src/charts/host.tsx +6 -3
- package/src/charts/index.ts +1 -1
- package/src/charts/sparkline.module.css +59 -0
- package/src/charts/sparkline.module.css.d.ts +13 -0
- package/src/charts/state.tsx +53 -4
- package/src/charts/types.ts +6 -0
- package/src/cli/check-theme.ts +3 -0
- package/src/cli/help.ts +18 -1
- package/src/cli/index.ts +48 -17
- package/src/cli/init.ts +2 -1
- package/src/cli/shot/capture.ts +15 -2
- package/src/cli/shot/detect.ts +533 -0
- package/src/cli/shot/index.ts +8 -4
- package/src/cli/shot/measure.ts +4 -0
- package/src/cli/shot/types.ts +5 -1
- package/src/cli/sync.ts +4 -2
- package/src/common/retry-button.module.css +58 -0
- package/src/common/retry-button.module.css.d.ts +8 -0
- package/src/common/retry-button.tsx +29 -0
- package/src/controls/sync-button.tsx +3 -0
- package/src/dashboard/bar-list.module.css +77 -2
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +89 -18
- package/src/dashboard/delta-badge.tsx +21 -5
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +126 -20
- package/src/dashboard/meter-parts.tsx +224 -88
- package/src/dashboard/meter.module.css +74 -43
- package/src/dashboard/meter.module.css.d.ts +4 -4
- package/src/dashboard/meter.tsx +39 -5
- package/src/dashboard/query-state.tsx +26 -20
- package/src/dashboard/settings-section.tsx +1 -8
- package/src/dashboard/stat-card-parts.tsx +1 -1
- package/src/dashboard/stat-card.module.css +15 -7
- package/src/dashboard/stat-card.tsx +9 -9
- package/src/dashboard/stat-group.tsx +19 -8
- package/src/dashboard/stat-strip.module.css +291 -0
- package/src/dashboard/stat-strip.module.css.d.ts +32 -0
- package/src/dashboard/stat-strip.tsx +263 -0
- package/src/dashboard/visual-slot.ts +8 -0
- package/src/dashboard/widget-header.module.css +10 -6
- package/src/dashboard/widget-header.tsx +3 -3
- package/src/format/date.ts +6 -3
- package/src/format/shared.ts +11 -2
- package/src/guard/index.ts +17 -5
- package/src/guard/palette.ts +261 -0
- package/src/guard/series-file.ts +51 -0
- package/src/guard/types.ts +3 -2
- package/src/index.ts +7 -0
- package/src/styles.css +6 -0
- package/src/surfaces.ts +2 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +202 -24
- package/src/theme/card-inset.module.css +76 -0
- package/src/theme/card-inset.module.css.d.ts +9 -0
- package/src/theme/controls.module.css +13 -0
- package/src/theme/index.ts +56 -0
- package/src/theme/nav-link.module.css +8 -10
- package/src/theme/status-dot.tsx +17 -5
- package/src/theme/status-verdict.module.css +4 -2
- package/src/theme/status-verdict.tsx +9 -4
- package/src/tokens/oklab.ts +97 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import { PAGE_ANCHOR, SHOT_HOME } from "./types.js";
|
|
6
|
+
const LAYERS = ["content", "layout", "style"];
|
|
7
|
+
const SEVERITIES = ["P0", "P1", "P2", "P3"];
|
|
8
|
+
const WEIGHT = { P0: 25, P1: 10, P2: 3, P3: 1 };
|
|
9
|
+
const FONT_SIZE_LIMIT = 3;
|
|
10
|
+
const EMPTY_LIMIT = 0.4;
|
|
11
|
+
const NESTED_MIN_STEP_PX = 3;
|
|
12
|
+
const POLISH_PX = 1;
|
|
13
|
+
const TREND_RUNS = 5;
|
|
14
|
+
const USAGE_LINE = "usage: basalt-ui shot detect [--out <dir>] [--lint <oxlint-json-file>]";
|
|
15
|
+
class DetectError extends Error {
|
|
16
|
+
}
|
|
17
|
+
const scoreOf = (findings) => Math.max(0, 100 - findings.reduce((sum, f) => sum + WEIGHT[f.severity], 0));
|
|
18
|
+
const countsOf = (findings) => ({
|
|
19
|
+
P0: findings.filter((f) => f.severity === "P0").length,
|
|
20
|
+
P1: findings.filter((f) => f.severity === "P1").length,
|
|
21
|
+
P2: findings.filter((f) => f.severity === "P2").length,
|
|
22
|
+
P3: findings.filter((f) => f.severity === "P3").length
|
|
23
|
+
});
|
|
24
|
+
const where = (a) => `${a.scheme}/${a.viewport}`;
|
|
25
|
+
const SIDE_NAMES = ["top", "right", "bottom", "left"];
|
|
26
|
+
function offScale(value, steps) {
|
|
27
|
+
if (value === "full" || value === 0 || steps.length === 0) return null;
|
|
28
|
+
const nearest = Math.min(...steps.map((s) => Math.abs(s - value)));
|
|
29
|
+
return nearest < 0.011 ? null : nearest;
|
|
30
|
+
}
|
|
31
|
+
const stepsText = (steps) => [...new Set(Object.values(steps))].sort((a, b) => a - b).join(", ");
|
|
32
|
+
const sizing = (distances) => distances.every((d) => d <= POLISH_PX) ? "P3" : "P1";
|
|
33
|
+
function craftOne(a, scale) {
|
|
34
|
+
if (!scale) return [];
|
|
35
|
+
const base = { anchor: a.name, route: a.route, where: where(a) };
|
|
36
|
+
const out = [];
|
|
37
|
+
const spacing = Object.values(scale.spacing);
|
|
38
|
+
const radii = Object.values(scale.radius);
|
|
39
|
+
const inset = SIDE_NAMES.map((side) => ({ side, v: a.padding[side] })).flatMap(({ side, v }) => {
|
|
40
|
+
const d = offScale(v, spacing);
|
|
41
|
+
return d === null ? [] : [{ side, v, d }];
|
|
42
|
+
});
|
|
43
|
+
if (inset.length > 0) {
|
|
44
|
+
out.push({
|
|
45
|
+
...base,
|
|
46
|
+
rule: "craft-1/off-scale-inset",
|
|
47
|
+
severity: sizing(inset.map((i) => i.d)),
|
|
48
|
+
layer: "layout",
|
|
49
|
+
cite: `metrics.json anchors[${a.name} ${where(a)}].padding`,
|
|
50
|
+
defect: `Padding ${inset.map((i) => `${i.side} ${i.v}px`).join(", ")} is not a spacing step (${stepsText(scale.spacing)}).`
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const gap = ["row", "column"].flatMap((axis) => {
|
|
54
|
+
const d = offScale(a.gap[axis], spacing);
|
|
55
|
+
return d === null ? [] : [{ axis, v: a.gap[axis], d }];
|
|
56
|
+
});
|
|
57
|
+
if (gap.length > 0) {
|
|
58
|
+
out.push({
|
|
59
|
+
...base,
|
|
60
|
+
rule: "craft-1/off-scale-gap",
|
|
61
|
+
severity: sizing(gap.map((g) => g.d)),
|
|
62
|
+
layer: "layout",
|
|
63
|
+
cite: `metrics.json anchors[${a.name} ${where(a)}].gap`,
|
|
64
|
+
defect: `Gap ${gap.map((g) => `${g.axis} ${g.v}px`).join(", ")} is not a spacing step (${stepsText(scale.spacing)}).`
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const radius = offScale(a.radius, radii);
|
|
68
|
+
if (radius !== null) {
|
|
69
|
+
out.push({
|
|
70
|
+
...base,
|
|
71
|
+
rule: "craft-1/off-scale-radius",
|
|
72
|
+
severity: sizing([radius]),
|
|
73
|
+
layer: "style",
|
|
74
|
+
cite: `metrics.json anchors[${a.name} ${where(a)}].radius`,
|
|
75
|
+
defect: `Radius ${String(a.radius)}px is not a radius step (${stepsText(scale.radius)}).`
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function nestedRadius(a) {
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const child of a.nested) {
|
|
83
|
+
const parent = a.nested.filter((n) => n !== child && child.path.startsWith(`${n.path} > `)).sort((x, y) => y.path.length - x.path.length)[0];
|
|
84
|
+
const parentRadius = parent ? parent.radius : a.radius;
|
|
85
|
+
if (typeof parentRadius !== "number" || typeof child.radius !== "number") continue;
|
|
86
|
+
if (parentRadius === 0 || child.radius === 0) continue;
|
|
87
|
+
if (Math.abs(parentRadius - child.radius) >= NESTED_MIN_STEP_PX) continue;
|
|
88
|
+
out.push({
|
|
89
|
+
rule: "craft-1/nested-radius-step",
|
|
90
|
+
severity: "P1",
|
|
91
|
+
layer: "style",
|
|
92
|
+
anchor: a.name,
|
|
93
|
+
route: a.route,
|
|
94
|
+
where: where(a),
|
|
95
|
+
cite: `metrics.json anchors[${a.name} ${where(a)}].nested[${child.path}]`,
|
|
96
|
+
defect: `Nested surface radius ${child.radius}px is within ${NESTED_MIN_STEP_PX}px of its parent's ${parentRadius}px.`
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
function anchorFindings(a, scale) {
|
|
102
|
+
const base = { anchor: a.name, route: a.route, where: where(a) };
|
|
103
|
+
const cite = (field) => `metrics.json anchors[${a.name} ${where(a)}].${field}`;
|
|
104
|
+
const out = [...craftOne(a, scale), ...nestedRadius(a)];
|
|
105
|
+
const sizes = new Set(a.fontSizes);
|
|
106
|
+
if (sizes.size > FONT_SIZE_LIMIT) {
|
|
107
|
+
out.push({
|
|
108
|
+
...base,
|
|
109
|
+
rule: "craft-2/font-sizes",
|
|
110
|
+
severity: "P1",
|
|
111
|
+
layer: "style",
|
|
112
|
+
cite: cite("fontSizes"),
|
|
113
|
+
defect: `${sizes.size} distinct font sizes (${[...sizes].sort((x, y) => x - y).join(", ")}px); the limit is ${FONT_SIZE_LIMIT}.`
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (a.emptyRatio >= EMPTY_LIMIT) {
|
|
117
|
+
out.push({
|
|
118
|
+
...base,
|
|
119
|
+
rule: "craft-3/empty-region",
|
|
120
|
+
severity: "P1",
|
|
121
|
+
layer: "layout",
|
|
122
|
+
cite: cite("emptyRatio"),
|
|
123
|
+
defect: `${Math.round(a.emptyRatio * 100)}% of the component's height is an empty region; the limit is ${EMPTY_LIMIT * 100}%.`
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const failures = a.contrast.failures;
|
|
127
|
+
if (failures.length > 0) {
|
|
128
|
+
const worst = failures.reduce((lo, f) => f.ratio < lo.ratio ? f : lo);
|
|
129
|
+
out.push({
|
|
130
|
+
...base,
|
|
131
|
+
rule: "craft-5/contrast",
|
|
132
|
+
severity: "P0",
|
|
133
|
+
layer: "content",
|
|
134
|
+
cite: cite("contrast.failures"),
|
|
135
|
+
defect: `${failures.length} text run${failures.length === 1 ? "" : "s"} below the AA contrast threshold; lowest ${worst.ratio}:1 on "${worst.text}" (${worst.fontSize}px).`
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (a.contrast.backdrop === "assumed-white") {
|
|
139
|
+
out.push({
|
|
140
|
+
...base,
|
|
141
|
+
rule: "craft-5/assumed-backdrop",
|
|
142
|
+
severity: "P2",
|
|
143
|
+
layer: "content",
|
|
144
|
+
cite: cite("contrast.backdrop"),
|
|
145
|
+
defect: "Some text sat on no opaque background and white was assumed, so its contrast is unproven."
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
function lintFindings(report) {
|
|
151
|
+
return report.diagnostics.flatMap((d) => {
|
|
152
|
+
const id = /^basalt\((.+)\)$/.exec(d.code ?? "")?.[1];
|
|
153
|
+
if (!id) return [];
|
|
154
|
+
const span = d.labels?.[0]?.span;
|
|
155
|
+
const file = d.filename ?? "?";
|
|
156
|
+
return [
|
|
157
|
+
{
|
|
158
|
+
rule: `lint/basalt/${id}`,
|
|
159
|
+
severity: d.severity === "error" ? "P1" : "P2",
|
|
160
|
+
layer: "style",
|
|
161
|
+
anchor: file,
|
|
162
|
+
where: "",
|
|
163
|
+
cite: `${file}:${span?.line ?? 0}:${span?.column ?? 0}`,
|
|
164
|
+
defect: d.message ?? `basalt/${id}`
|
|
165
|
+
}
|
|
166
|
+
];
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function detectFindings(m, lint) {
|
|
170
|
+
const drafts = [];
|
|
171
|
+
const scan = { layer: "content", where: "" };
|
|
172
|
+
if (m.anchors.length === 0) {
|
|
173
|
+
drafts.push({
|
|
174
|
+
...scan,
|
|
175
|
+
rule: "scan/no-anchors",
|
|
176
|
+
severity: "P0",
|
|
177
|
+
anchor: "\u2014",
|
|
178
|
+
cite: "metrics.json anchors",
|
|
179
|
+
defect: "The round measured no component: no data-shot anchor rendered."
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
for (const s of m.shots) {
|
|
183
|
+
if (s.status !== "error") continue;
|
|
184
|
+
drafts.push({
|
|
185
|
+
...scan,
|
|
186
|
+
rule: "scan/shot-error",
|
|
187
|
+
severity: "P0",
|
|
188
|
+
anchor: s.name === PAGE_ANCHOR ? `${PAGE_ANCHOR} (full page)` : s.name,
|
|
189
|
+
route: s.route,
|
|
190
|
+
where: `${s.scheme}/${s.viewport}/${s.state}`,
|
|
191
|
+
cite: `metrics.json shots[${s.name} ${s.scheme}/${s.viewport}/${s.state}]`,
|
|
192
|
+
defect: `The shot failed${s.note ? `: ${s.note}` : ""}.`
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (m.scaleError || m.scale.length === 0) {
|
|
196
|
+
drafts.push({
|
|
197
|
+
...scan,
|
|
198
|
+
layer: "layout",
|
|
199
|
+
rule: "craft-1/scale-error",
|
|
200
|
+
severity: "P1",
|
|
201
|
+
anchor: "\u2014",
|
|
202
|
+
cite: "metrics.json scale",
|
|
203
|
+
defect: `The theme scale was not read${m.scaleError ? ` (${m.scaleError})` : ""}, so Craft 1 is unverified.`
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
for (const a of m.anchors) {
|
|
207
|
+
const scale = m.scale.find((s) => s.scheme === a.scheme && s.viewport === a.viewport);
|
|
208
|
+
if (!scale && m.scale.length > 0) {
|
|
209
|
+
drafts.push({
|
|
210
|
+
rule: "craft-1/scale-missing",
|
|
211
|
+
severity: "P1",
|
|
212
|
+
layer: "layout",
|
|
213
|
+
anchor: a.name,
|
|
214
|
+
route: a.route,
|
|
215
|
+
where: where(a),
|
|
216
|
+
cite: `metrics.json scale[${where(a)}]`,
|
|
217
|
+
defect: `No theme scale was read for ${where(a)}, so Craft 1 is unverified there.`
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
drafts.push(...anchorFindings(a, scale));
|
|
221
|
+
}
|
|
222
|
+
if (lint) drafts.push(...lintFindings(lint));
|
|
223
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const d of drafts) {
|
|
225
|
+
const key = [
|
|
226
|
+
d.rule,
|
|
227
|
+
d.route ?? "",
|
|
228
|
+
d.anchor,
|
|
229
|
+
d.cite.replace(/ (light|dark)\/(desktop|mobile)/, ""),
|
|
230
|
+
d.defect
|
|
231
|
+
].join("|");
|
|
232
|
+
const hit = grouped.get(key);
|
|
233
|
+
if (hit) {
|
|
234
|
+
if (d.where && !hit.where.includes(d.where)) hit.where.push(d.where);
|
|
235
|
+
} else {
|
|
236
|
+
grouped.set(key, { ...d, where: d.where ? [d.where] : [] });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return [...grouped.values()].sort(
|
|
240
|
+
(x, y) => LAYERS.indexOf(x.layer) - LAYERS.indexOf(y.layer) || SEVERITIES.indexOf(x.severity) - SEVERITIES.indexOf(y.severity)
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function readJson(path, what) {
|
|
244
|
+
let text;
|
|
245
|
+
try {
|
|
246
|
+
text = readFileSync(path, "utf8");
|
|
247
|
+
} catch (error) {
|
|
248
|
+
throw new DetectError(`${what} ${path} is unreadable: ${error.message}`);
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
return JSON.parse(text);
|
|
252
|
+
} catch {
|
|
253
|
+
throw new DetectError(`${what} ${path} is not valid JSON`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function readMetrics(path) {
|
|
257
|
+
const m = readJson(path, "metrics.json");
|
|
258
|
+
if (!m || m.version !== 1 || !Array.isArray(m.anchors) || !Array.isArray(m.shots)) {
|
|
259
|
+
throw new DetectError(
|
|
260
|
+
`metrics.json ${path} is not a shot output (version 1 with anchors and shots)`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
return { ...m, scale: Array.isArray(m.scale) ? m.scale : [] };
|
|
264
|
+
}
|
|
265
|
+
function readLint(path) {
|
|
266
|
+
const report = readJson(path, "--lint file");
|
|
267
|
+
if (!report || !Array.isArray(report.diagnostics)) {
|
|
268
|
+
throw new DetectError(
|
|
269
|
+
`--lint file ${path} is not an oxlint JSON report (no "diagnostics" array)`
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
return report;
|
|
273
|
+
}
|
|
274
|
+
function outDirOf(cwd, out) {
|
|
275
|
+
if (out) return resolve(cwd, out);
|
|
276
|
+
const last = join(cwd, SHOT_HOME, "last.json");
|
|
277
|
+
try {
|
|
278
|
+
const named = JSON.parse(readFileSync(last, "utf8")).out;
|
|
279
|
+
if (typeof named === "string" && named) return resolve(cwd, named);
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
return join(cwd, SHOT_HOME, "latest");
|
|
283
|
+
}
|
|
284
|
+
const gitHead = (cwd) => {
|
|
285
|
+
try {
|
|
286
|
+
return execFileSync("git", ["rev-parse", "--short", "HEAD"], {
|
|
287
|
+
cwd,
|
|
288
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
289
|
+
}).toString().trim();
|
|
290
|
+
} catch {
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function io(what, step) {
|
|
295
|
+
try {
|
|
296
|
+
return step();
|
|
297
|
+
} catch (error) {
|
|
298
|
+
throw new DetectError(
|
|
299
|
+
`cannot ${what}: ${error instanceof Error ? error.message : String(error)}`
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function nextHistory(path, entry, log) {
|
|
304
|
+
if (!existsSync(path)) return [entry];
|
|
305
|
+
try {
|
|
306
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
307
|
+
if (!Array.isArray(parsed)) throw new TypeError("not an array");
|
|
308
|
+
return [...parsed, entry];
|
|
309
|
+
} catch {
|
|
310
|
+
io(`move the unreadable ${path} aside`, () => renameSync(path, `${path}.bak`));
|
|
311
|
+
log(`[detect] ${path} was unreadable; kept as history.json.bak, starting a new history`);
|
|
312
|
+
return [entry];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function persist(files, log) {
|
|
316
|
+
const { detectPath, report, home, entry } = files;
|
|
317
|
+
const historyPath = join(home, "history.json");
|
|
318
|
+
return io("write detect.json or history.json", () => {
|
|
319
|
+
mkdirSync(home, { recursive: true });
|
|
320
|
+
if (!existsSync(join(home, ".gitignore"))) writeFileSync(join(home, ".gitignore"), "*\n");
|
|
321
|
+
const runs = nextHistory(historyPath, entry, log);
|
|
322
|
+
const json = (value) => JSON.stringify(value, null, 2) + "\n";
|
|
323
|
+
writeFileSync(`${historyPath}.tmp`, json(runs));
|
|
324
|
+
writeFileSync(`${detectPath}.tmp`, json(report));
|
|
325
|
+
renameSync(`${historyPath}.tmp`, historyPath);
|
|
326
|
+
renameSync(`${detectPath}.tmp`, detectPath);
|
|
327
|
+
return runs.slice(-TREND_RUNS).map((r) => r.score);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const compactWhere = (w) => w.length >= 4 ? "all" : w.join(",");
|
|
331
|
+
function table(findings) {
|
|
332
|
+
const rows = findings.map((f) => [
|
|
333
|
+
f.severity,
|
|
334
|
+
f.rule,
|
|
335
|
+
f.route ? `${f.route} ${f.anchor}` : f.anchor,
|
|
336
|
+
compactWhere(f.where),
|
|
337
|
+
f.defect
|
|
338
|
+
]);
|
|
339
|
+
const widths = [0, 1, 2, 3].map((i) => Math.max(...rows.map((r) => (r[i] ?? "").length)));
|
|
340
|
+
return rows.map(
|
|
341
|
+
(r) => r.map((cell, i) => i < 4 ? cell.padEnd(widths[i] ?? 0) : cell).join(" ").trimEnd()
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
async function detect(flags, cwd, deps = {}) {
|
|
345
|
+
const log = deps.log ?? ((line) => console.log(line));
|
|
346
|
+
try {
|
|
347
|
+
let values;
|
|
348
|
+
try {
|
|
349
|
+
values = parseArgs({
|
|
350
|
+
args: [...flags],
|
|
351
|
+
options: { out: { type: "string" }, lint: { type: "string" } },
|
|
352
|
+
strict: true
|
|
353
|
+
}).values;
|
|
354
|
+
} catch (error) {
|
|
355
|
+
throw new DetectError(
|
|
356
|
+
`${error instanceof Error ? error.message : String(error)}
|
|
357
|
+
${USAGE_LINE}`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
const outDir = outDirOf(cwd, values.out);
|
|
361
|
+
const metrics = readMetrics(join(outDir, "metrics.json"));
|
|
362
|
+
const lint = values.lint ? readLint(resolve(cwd, values.lint)) : void 0;
|
|
363
|
+
const findings = detectFindings(metrics, lint);
|
|
364
|
+
const counts = countsOf(findings);
|
|
365
|
+
const score = scoreOf(findings);
|
|
366
|
+
const at = (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
367
|
+
const rel = relative(cwd, outDir);
|
|
368
|
+
const out = rel === "" || rel.startsWith("..") || isAbsolute(rel) ? outDir : rel;
|
|
369
|
+
const commit = (deps.commit ?? gitHead)(cwd);
|
|
370
|
+
const trend = persist(
|
|
371
|
+
{
|
|
372
|
+
detectPath: join(outDir, "detect.json"),
|
|
373
|
+
report: { version: 1, at, out, ...commit && { commit }, counts, score, findings },
|
|
374
|
+
home: join(cwd, SHOT_HOME),
|
|
375
|
+
entry: { at, out, ...commit && { commit }, counts, score }
|
|
376
|
+
},
|
|
377
|
+
log
|
|
378
|
+
);
|
|
379
|
+
const summary = SEVERITIES.filter((s) => counts[s] > 0).map((s) => `${s} ${counts[s]}`).join(", ");
|
|
380
|
+
log(
|
|
381
|
+
`[detect] ${findings.length === 0 ? "no findings" : `${findings.length} findings (${summary})`} \xB7 score ${score}`
|
|
382
|
+
);
|
|
383
|
+
for (const line of table(findings)) log(line);
|
|
384
|
+
log(`[detect] trend ${trend.join(" \u2192 ")} \xB7 ${relative(cwd, join(outDir, "detect.json"))}`);
|
|
385
|
+
return counts.P0 + counts.P1 > 0 ? 2 : 0;
|
|
386
|
+
} catch (error) {
|
|
387
|
+
if (!(error instanceof DetectError)) throw error;
|
|
388
|
+
console.error(`basalt-ui shot detect: ${error.message}`);
|
|
389
|
+
return 1;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
export {
|
|
393
|
+
detect,
|
|
394
|
+
detectFindings,
|
|
395
|
+
scoreOf
|
|
396
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,SAAS,CAAA;AAQrD,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,OAAO,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;IAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,2EAA2E;IAC3E,YAAY,EAAE,IAAI,EAAE,CAAA;IACpB,GAAG,EAAE,QAAQ,EAAE,CAAA;IACf,OAAO,EAAE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js
CHANGED
|
@@ -14,11 +14,12 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
|
14
14
|
import { parseArgs } from "node:util";
|
|
15
15
|
import { buildBoard } from "./board.js";
|
|
16
16
|
import { capture } from "./capture.js";
|
|
17
|
+
import { detect } from "./detect.js";
|
|
17
18
|
import { INSTALL_LINE, ShotError, resolvePlaywright, withBrowser } from "./playwright.js";
|
|
18
19
|
import { apiProxy, parseApi, parseHeaders, parseStorage } from "./real-data.js";
|
|
19
20
|
import { serveDist } from "./serve.js";
|
|
20
|
-
import { SCHEMES, STATES, VIEWPORTS } from "./types.js";
|
|
21
|
-
const HOME =
|
|
21
|
+
import { SCHEMES, SHOT_HOME, STATES, VIEWPORTS } from "./types.js";
|
|
22
|
+
const HOME = SHOT_HOME;
|
|
22
23
|
const DEFAULT_OUT = `${HOME}/latest`;
|
|
23
24
|
const USAGE_LINE = "usage: basalt-ui shot <route\u2026> (--base <url> | --dist <dir>) [--out <dir>] [--states <list>] [--local-storage k=@env:X] [--api /p=origin] [--header n=@env:X] [--api-allow-writes] [--wait ms] [--auto-anchors]";
|
|
24
25
|
function parseShotArgs(flags, src = { env: process.env, cwd: process.cwd() }) {
|
|
@@ -90,7 +91,7 @@ ${USAGE_LINE}`);
|
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
93
|
const PROTECTED_SEGMENTS = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
93
|
-
const SHOT_OWNED = /* @__PURE__ */ new Set(["png", "board.html", "metrics.json", ".gitignore"]);
|
|
94
|
+
const SHOT_OWNED = /* @__PURE__ */ new Set(["png", "board.html", "metrics.json", "detect.json", ".gitignore"]);
|
|
94
95
|
const outside = (rel) => rel === ".." || rel.startsWith(".." + sep) || isAbsolute(rel);
|
|
95
96
|
const lexists = (path) => {
|
|
96
97
|
try {
|
|
@@ -224,6 +225,7 @@ function exitOnSignal(stops) {
|
|
|
224
225
|
};
|
|
225
226
|
}
|
|
226
227
|
async function shot(flags, cwd, deps = {}) {
|
|
228
|
+
if (flags[0] === "detect") return detect(flags.slice(1), cwd, deps);
|
|
227
229
|
const log = deps.log ?? ((line) => console.log(line));
|
|
228
230
|
const stops = [];
|
|
229
231
|
const uninstall = exitOnSignal(stops);
|
|
@@ -283,8 +285,9 @@ async function shot(flags, cwd, deps = {}) {
|
|
|
283
285
|
writeFileSync(join(tmp, "board.html"), buildBoard(metrics));
|
|
284
286
|
commitOut(cwd, args.out, tmp, args.routes, now);
|
|
285
287
|
const count = (status) => shots.filter((s) => s.status === status).length;
|
|
288
|
+
const absent = count("absent") ? `${count("absent")} absent, ` : "";
|
|
286
289
|
log(
|
|
287
|
-
`[shot] ${count("ok")} shots, ${count("not-declared")} not declared, ${count("skipped")} skipped, ${count("error")} failed \u2192 ${relative(cwd, outDir)}/board.html`
|
|
290
|
+
`[shot] ${count("ok")} shots, ${count("not-declared")} not declared, ${absent}${count("skipped")} skipped, ${count("error")} failed \u2192 ${relative(cwd, outDir)}/board.html`
|
|
288
291
|
);
|
|
289
292
|
if (count("error") > 0) {
|
|
290
293
|
console.error(`basalt-ui shot: ${count("error")} shot(s) failed; see board.html`);
|
|
@@ -15,6 +15,8 @@ export type TextReading = {
|
|
|
15
15
|
bold: boolean;
|
|
16
16
|
/** No opaque ancestor background was found: `bg` is white by assumption. */
|
|
17
17
|
assumedWhite: boolean;
|
|
18
|
+
/** Inside a disabled control: WCAG 1.4.3 exempts inactive components, so it is not measured. */
|
|
19
|
+
disabled?: boolean;
|
|
18
20
|
};
|
|
19
21
|
/** A computed `border-top-left-radius` as the page read it, with the box it rounds. */
|
|
20
22
|
export type RawRadius = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/measure.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAS3D,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,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EAAE,MAAM,CAAA;CAAE,CAAA;AACxE,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAAG;IAC1E,MAAM,EAAE,SAAS,CAAA;IACjB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;KAAE,EAAE,CAAA;IAC9E,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAQlF;AASD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,GAAG,WAAW,CAmB1F;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAiKpD"}
|
package/dist/cli/shot/measure.js
CHANGED
|
@@ -24,6 +24,7 @@ function finishMeasurement({ texts, radius, nested, ...rest }) {
|
|
|
24
24
|
const failures = [];
|
|
25
25
|
let min = null;
|
|
26
26
|
for (const t of texts) {
|
|
27
|
+
if (t.disabled) continue;
|
|
27
28
|
const exact = contrastRatio(t.fg, t.bg);
|
|
28
29
|
const ratio = Math.round(exact * 100) / 100;
|
|
29
30
|
min = min === null ? ratio : Math.min(min, ratio);
|
|
@@ -156,6 +157,7 @@ function measureAnchor(root) {
|
|
|
156
157
|
fg: over(rgba(s.color), back.color),
|
|
157
158
|
bg: back.color,
|
|
158
159
|
assumedWhite: back.assumedWhite,
|
|
160
|
+
disabled: el.closest(':disabled, [aria-disabled="true"], [data-disabled]') !== null,
|
|
159
161
|
fontSize: size,
|
|
160
162
|
bold: parseInt(s.fontWeight, 10) >= 700
|
|
161
163
|
});
|
package/dist/cli/shot/types.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare const VIEWPORTS: readonly ["desktop", "mobile"];
|
|
|
3
3
|
export declare const STATES: readonly ["rest", "hover", "focus", "tooltip", "empty", "loading", "error"];
|
|
4
4
|
/** The states a page opts into with `data-shot-states`; reached through the `shot-state` URL param. */
|
|
5
5
|
export declare const URL_STATES: readonly ["empty", "loading", "error"];
|
|
6
|
+
/** Where shot keeps `last.json`, `history.json` and the default out dir. */
|
|
7
|
+
export declare const SHOT_HOME = ".basalt/shots";
|
|
6
8
|
/** The `name` of a route's full-page shot: not a valid `data-shot` value. */
|
|
7
9
|
export declare const PAGE_ANCHOR = "_page";
|
|
8
10
|
export type Scheme = (typeof SCHEMES)[number];
|
|
@@ -70,7 +72,8 @@ export type ShotRecord = {
|
|
|
70
72
|
viewport: Viewport;
|
|
71
73
|
state: ShotState;
|
|
72
74
|
file: string | null;
|
|
73
|
-
|
|
75
|
+
/** `absent`: the anchor declared itself missing in this state (`data-shot-absent`): not a defect. */
|
|
76
|
+
status: 'ok' | 'not-declared' | 'absent' | 'skipped' | 'error';
|
|
74
77
|
note?: string;
|
|
75
78
|
};
|
|
76
79
|
/** The theme's resolved steps (px) for one scheme × viewport; a missing custom property is omitted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,4BAA6B,CAAA;AACjD,eAAO,MAAM,SAAS,gCAAiC,CAAA;AACvD,eAAO,MAAM,MAAM,6EAA8E,CAAA;AACjG,uGAAuG;AACvG,eAAO,MAAM,UAAU,wCAAyC,CAAA;AAEhE,6EAA6E;AAC7E,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAA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E;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA"}
|
package/dist/cli/shot/types.js
CHANGED
|
@@ -2,6 +2,7 @@ const SCHEMES = ["light", "dark"];
|
|
|
2
2
|
const VIEWPORTS = ["desktop", "mobile"];
|
|
3
3
|
const STATES = ["rest", "hover", "focus", "tooltip", "empty", "loading", "error"];
|
|
4
4
|
const URL_STATES = ["empty", "loading", "error"];
|
|
5
|
+
const SHOT_HOME = ".basalt/shots";
|
|
5
6
|
const PAGE_ANCHOR = "_page";
|
|
6
7
|
const VIEWPORT_SPECS = {
|
|
7
8
|
desktop: { width: 1440, height: 900, mobile: false },
|
|
@@ -10,6 +11,7 @@ const VIEWPORT_SPECS = {
|
|
|
10
11
|
export {
|
|
11
12
|
PAGE_ANCHOR,
|
|
12
13
|
SCHEMES,
|
|
14
|
+
SHOT_HOME,
|
|
13
15
|
STATES,
|
|
14
16
|
URL_STATES,
|
|
15
17
|
VIEWPORTS,
|
package/dist/cli/sync.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type SyncOptions = {
|
|
|
5
5
|
check?: boolean;
|
|
6
6
|
/** The raw flag list, read for `--tokens-only` / `--framework` exactly as check-theme reads it. */
|
|
7
7
|
flags?: readonly string[];
|
|
8
|
+
/** Shipped-source root; defaults to this package. Tests point it at a scratch package. */
|
|
9
|
+
pkgRoot?: string;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* The sentence `sync` and `doctor` both print when the cwd carries no install but an ancestor does
|
package/dist/cli/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAgDA,gGAAgG;AAChG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mGAAmG;IACnG,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAgDA,gGAAgG;AAChG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mGAAmG;IACnG,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrF;AAQD;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,WAAgB,EAAE,aAAa,GAAE,MAAsB,GAAG,MAAM,CAiP1F"}
|
package/dist/cli/sync.js
CHANGED
|
@@ -93,11 +93,11 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
93
93
|
return 1;
|
|
94
94
|
}
|
|
95
95
|
const rootsState = reconcileRoots(cwd, { write: opts.check !== true });
|
|
96
|
-
const ctx = renderContext(cwd, ruleRootsFor(rootsState));
|
|
96
|
+
const ctx = renderContext(cwd, ruleRootsFor(rootsState), opts.pkgRoot);
|
|
97
97
|
const manifest = readManifest(cwd);
|
|
98
98
|
const placement = resolvePlacement(cwd);
|
|
99
99
|
const { skip: seedSkip, skipped } = routerSeedPlan(cwd, placement.appRel);
|
|
100
|
-
const files = managedFiles(placement).filter((f) => !skipped.has(f.dest));
|
|
100
|
+
const files = managedFiles(placement, ctx.pkgRoot).filter((f) => !skipped.has(f.dest));
|
|
101
101
|
let updated = 0;
|
|
102
102
|
let created = 0;
|
|
103
103
|
let recreated = 0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one Retry button of the shared error anatomy (status dot + word + message + Retry). Internal:
|
|
3
|
+
* `ErrorState`, `ChartCard`'s placeholder and a strip cell's error all render it, so they cannot
|
|
4
|
+
* drift. Mantine-free — `./charts` uses it with no `@mantine/*` installed.
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactElement } from 'react';
|
|
7
|
+
export declare function RetryButton({ onClick, retrying, }: {
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
/** A refetch is in flight: inert and marked busy. */
|
|
10
|
+
retrying?: boolean;
|
|
11
|
+
}): ReactElement;
|
|
12
|
+
//# sourceMappingURL=retry-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-button.d.ts","sourceRoot":"","sources":["../../src/common/retry-button.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGzC,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAgB,GACjB,EAAE;IACD,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,YAAY,CAaf"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classes from "./retry-button.module.css";
|
|
3
|
+
function RetryButton({
|
|
4
|
+
onClick,
|
|
5
|
+
retrying = false
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"button",
|
|
9
|
+
{
|
|
10
|
+
type: "button",
|
|
11
|
+
className: classes.retry,
|
|
12
|
+
"data-basalt-retry": "",
|
|
13
|
+
disabled: retrying,
|
|
14
|
+
...retrying && { "aria-busy": true },
|
|
15
|
+
onClick,
|
|
16
|
+
children: "Retry"
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
RetryButton
|
|
22
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The one Retry. ErrorState (Mantine, StatCard / pages), ChartCard's placeholder and a strip cell's
|
|
3
|
+
* error all render this, so the three read as one button. It is a plain element because `./charts`
|
|
4
|
+
* resolves with no Mantine, and it is styled to be a Mantine `size="xs" variant="default"` Button
|
|
5
|
+
* reading the same `--vx-*` tokens the theme binds that button to: panel fill (elevated on hover), no
|
|
6
|
+
* border, `shadow-raised`, the control radius, the xs type size, the theme's inline padding step and
|
|
7
|
+
* Mantine's 30px xs height. `--mantine-scale` carries the app's scale knob, 1 where Mantine is absent.
|
|
8
|
+
*/
|
|
9
|
+
.retry {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
flex: none;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
height: calc(1.875rem * var(--mantine-scale, 1));
|
|
16
|
+
padding-block: 0;
|
|
17
|
+
padding-inline: calc(var(--vx-space-stack-md, 0.75rem) * var(--mantine-scale, 1));
|
|
18
|
+
border: calc(0.0625rem * var(--mantine-scale, 1)) solid transparent;
|
|
19
|
+
border-radius: var(--vx-radius-ctrl);
|
|
20
|
+
background: var(--vx-surface-panel);
|
|
21
|
+
box-shadow: var(--vx-shadow-raised);
|
|
22
|
+
color: var(--mantine-color-default-color, var(--vx-ink));
|
|
23
|
+
font: inherit;
|
|
24
|
+
font-size: var(--vx-text-xs);
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
user-select: none;
|
|
30
|
+
transition: box-shadow 120ms ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.retry:focus-visible {
|
|
34
|
+
outline: calc(0.125rem * var(--mantine-scale, 1)) solid
|
|
35
|
+
var(--mantine-primary-color-filled, var(--vx-accent-fill));
|
|
36
|
+
outline-offset: calc(0.125rem * var(--mantine-scale, 1));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Hover is a pointer affordance: a touch tap would leave it stuck on. */
|
|
40
|
+
@media (hover: hover) {
|
|
41
|
+
.retry:hover:not(:disabled) {
|
|
42
|
+
background: var(--vx-surface-elevated);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Busy is Mantine's disabled paint: its own disabled colour and background, flat, no border. */
|
|
47
|
+
.retry:disabled {
|
|
48
|
+
background: var(--mantine-color-disabled, var(--vx-surface-subtle));
|
|
49
|
+
color: var(--mantine-color-disabled-color, var(--vx-muted));
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
cursor: not-allowed;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-reduced-motion: reduce) {
|
|
55
|
+
.retry {
|
|
56
|
+
transition: none;
|
|
57
|
+
}
|
|
58
|
+
}
|