basalt-ui 2.28.0 → 2.29.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 +461 -401
- package/MIGRATING.md +202 -12
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +11 -5
- package/agent/skills/basalt-design/references/catalogue.md +3 -1
- package/agent/skills/basalt-design/references/recipes.md +1 -1
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-plugin.js +2 -1
- package/configs/oxlint.json +1 -0
- package/dist/charts/ChartCard.d.ts +9 -5
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +68 -12
- package/dist/charts/Sparkline.d.ts +5 -0
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +53 -5
- package/dist/charts/chart-box.module.css +9 -2
- package/dist/charts/chart-card.module.css +16 -13
- package/dist/charts/chart-card.module.css.d.ts +2 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +18 -9
- package/dist/charts/ref-label.d.ts +6 -0
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +19 -5
- package/dist/charts/sparkline.module.css +44 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +1 -1
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +3 -3
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +28 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +77 -7
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/dashboard/bar-list.d.ts +4 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +10 -7
- package/dist/dashboard/bar-list.module.css +21 -3
- package/dist/dashboard/board.d.ts +2 -2
- package/dist/dashboard/board.d.ts.map +1 -1
- package/dist/dashboard/board.js +31 -12
- package/dist/dashboard/board.module.css +19 -0
- package/dist/dashboard/board.module.css.d.ts +2 -0
- package/dist/dashboard/empty-state.d.ts +3 -3
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +4 -2
- package/dist/dashboard/event-list-model.d.ts +3 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -1
- package/dist/dashboard/event-list-model.js +5 -1
- package/dist/dashboard/event-list-rows.d.ts.map +1 -1
- package/dist/dashboard/event-list-rows.js +2 -6
- package/dist/dashboard/event-list-scroll.d.ts +32 -4
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -1
- package/dist/dashboard/event-list-scroll.js +117 -4
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -1
- package/dist/dashboard/event-list-skeleton.js +2 -4
- package/dist/dashboard/event-list.d.ts +4 -4
- package/dist/dashboard/event-list.d.ts.map +1 -1
- package/dist/dashboard/event-list.js +53 -23
- package/dist/dashboard/event-list.module.css +90 -37
- package/dist/dashboard/event-list.module.css.d.ts +1 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +32 -4
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +18 -11
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +28 -10
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +4 -4
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +11 -7
- package/dist/dashboard/settings-section.module.css +6 -0
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +24 -8
- package/dist/dashboard/stat-card.module.css +11 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +4 -5
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +6 -25
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -1
- package/dist/styles.css +23 -0
- package/dist/table/cell-kinds.d.ts +10 -7
- package/dist/table/cell-kinds.d.ts.map +1 -1
- package/dist/table/cell-kinds.js +18 -7
- package/dist/table/data-table-fold.d.ts +13 -5
- package/dist/table/data-table-fold.d.ts.map +1 -1
- package/dist/table/data-table-fold.js +48 -16
- package/dist/table/data-table.d.ts +2 -2
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +16 -9
- package/dist/table/data-table.module.css +74 -2
- package/dist/table/data-table.module.css.d.ts +4 -0
- package/dist/theme/controls.module.css +23 -2
- package/llms.txt +263 -2
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +98 -16
- package/src/charts/Sparkline.tsx +84 -5
- package/src/charts/chart-box.module.css +9 -2
- package/src/charts/chart-card.module.css +16 -13
- package/src/charts/chart-card.module.css.d.ts +2 -0
- package/src/charts/compile.ts +37 -15
- package/src/charts/ref-label.ts +36 -9
- package/src/charts/sparkline.module.css +44 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +4 -3
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +109 -10
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/dashboard/bar-list.module.css +21 -3
- package/src/dashboard/bar-list.tsx +46 -41
- package/src/dashboard/board.module.css +19 -0
- package/src/dashboard/board.module.css.d.ts +2 -0
- package/src/dashboard/board.tsx +69 -48
- package/src/dashboard/empty-state.tsx +5 -2
- package/src/dashboard/event-list-model.ts +13 -1
- package/src/dashboard/event-list-rows.tsx +3 -6
- package/src/dashboard/event-list-scroll.ts +154 -8
- package/src/dashboard/event-list-skeleton.tsx +5 -1
- package/src/dashboard/event-list.module.css +90 -37
- package/src/dashboard/event-list.module.css.d.ts +1 -0
- package/src/dashboard/event-list.tsx +92 -65
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +45 -13
- package/src/dashboard/meter.module.css +18 -11
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +54 -29
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +6 -0
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +11 -6
- package/src/dashboard/stat-card.module.css +11 -0
- package/src/dashboard/stat-card.tsx +31 -8
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +4 -5
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +6 -25
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +5 -1
- package/src/styles.css +23 -0
- package/src/table/cell-kinds.tsx +42 -13
- package/src/table/data-table-fold.tsx +65 -12
- package/src/table/data-table.module.css +74 -2
- package/src/table/data-table.module.css.d.ts +4 -0
- package/src/table/data-table.tsx +34 -13
- package/src/theme/controls.module.css +23 -2
package/dist/cli/shot/detect.js
CHANGED
|
@@ -2,7 +2,8 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
|
-
import {
|
|
5
|
+
import { contrastThreshold } from "./measure.js";
|
|
6
|
+
import { PAGE_ANCHOR, SHOT_HOME } from "./types.js";
|
|
6
7
|
const LAYERS = ["content", "layout", "style"];
|
|
7
8
|
const SEVERITIES = ["P0", "P1", "P2", "P3"];
|
|
8
9
|
const WEIGHT = { P0: 25, P1: 10, P2: 3, P3: 1 };
|
|
@@ -121,7 +122,7 @@ function anchorFindings(a, scale) {
|
|
|
121
122
|
severity: "P0",
|
|
122
123
|
layer: "content",
|
|
123
124
|
cite: cite("contrast.failures"),
|
|
124
|
-
defect: `${failures.length} text run${failures.length === 1 ? "" : "s"} below the AA contrast threshold; lowest ${worst.ratio}:1 on "${worst.text}" (${worst.fontSize}px).`
|
|
125
|
+
defect: `${failures.length} text run${failures.length === 1 ? "" : "s"} below the AA contrast threshold; lowest ${worst.ratio}:1 on "${worst.text}" (needs ${worst.needs ?? contrastThreshold(worst.fontSize, worst.bold ?? false)}:1 at ${worst.fontSize}px${worst.bold === void 0 ? "" : worst.bold ? " bold" : " regular"}).`
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
if (a.contrast.backdrop === "assumed-white") {
|
|
@@ -183,18 +184,18 @@ function detectFindings(m, lint) {
|
|
|
183
184
|
}
|
|
184
185
|
const stateful = /* @__PURE__ */ new Map();
|
|
185
186
|
for (const s of m.shots) {
|
|
186
|
-
if (s.
|
|
187
|
-
stateful.set(s.route
|
|
187
|
+
if (!s.stateful || s.status === "absent") continue;
|
|
188
|
+
stateful.set(`${s.route}\0${s.name}`, { route: s.route, name: s.name });
|
|
188
189
|
}
|
|
189
|
-
for (const
|
|
190
|
+
for (const { route, name } of stateful.values()) {
|
|
190
191
|
drafts.push({
|
|
191
192
|
...scan,
|
|
192
193
|
rule: "craft-7/no-declared-states",
|
|
193
194
|
severity: "P2",
|
|
194
|
-
anchor:
|
|
195
|
+
anchor: name,
|
|
195
196
|
route,
|
|
196
|
-
cite: `metrics.json shots[${route}
|
|
197
|
-
defect: `${
|
|
197
|
+
cite: `metrics.json shots[${route} ${name} stateful]`,
|
|
198
|
+
defect: `${name} renders a state surface but declares no data-shot-states of its own, so empty, loading and error were never scored: add data-shot-states="empty loading error" to it, or data-shot-absent for a state it never shows.`
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
if (m.scaleError || m.scale.length === 0) {
|
|
@@ -329,7 +330,7 @@ function persist(files, log) {
|
|
|
329
330
|
writeFileSync(`${detectPath}.tmp`, json(report));
|
|
330
331
|
renameSync(`${historyPath}.tmp`, historyPath);
|
|
331
332
|
renameSync(`${detectPath}.tmp`, detectPath);
|
|
332
|
-
return runs.
|
|
333
|
+
return runs.filter((r) => r.out === entry.out).slice(-TREND_RUNS);
|
|
333
334
|
});
|
|
334
335
|
}
|
|
335
336
|
const compactWhere = (w) => w.length >= 4 ? "all" : w.join(",");
|
|
@@ -351,12 +352,20 @@ async function detect(flags, cwd, deps = {}) {
|
|
|
351
352
|
try {
|
|
352
353
|
let values;
|
|
353
354
|
try {
|
|
354
|
-
|
|
355
|
+
const parsed = parseArgs({
|
|
355
356
|
args: [...flags],
|
|
356
357
|
options: { out: { type: "string" }, lint: { type: "string" } },
|
|
357
|
-
|
|
358
|
-
})
|
|
358
|
+
allowPositionals: true
|
|
359
|
+
});
|
|
360
|
+
const [positional] = parsed.positionals;
|
|
361
|
+
if (positional !== void 0)
|
|
362
|
+
throw new DetectError(
|
|
363
|
+
`detect takes --out <dir>, not a positional ('${positional}'): basalt-ui shot detect --out ${positional}`
|
|
364
|
+
);
|
|
365
|
+
values = parsed.values;
|
|
359
366
|
} catch (error) {
|
|
367
|
+
if (error instanceof DetectError) throw new DetectError(`${error.message}
|
|
368
|
+
${USAGE_LINE}`);
|
|
360
369
|
throw new DetectError(
|
|
361
370
|
`${error instanceof Error ? error.message : String(error)}
|
|
362
371
|
${USAGE_LINE}`
|
|
@@ -367,7 +376,7 @@ ${USAGE_LINE}`
|
|
|
367
376
|
const lint = values.lint ? readLint(resolve(cwd, values.lint)) : void 0;
|
|
368
377
|
const findings = detectFindings(metrics, lint);
|
|
369
378
|
const counts = countsOf(findings);
|
|
370
|
-
const score = scoreOf(findings);
|
|
379
|
+
const score = metrics.anchors.length === 0 ? null : scoreOf(findings);
|
|
371
380
|
const at = (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
372
381
|
const rel = relative(cwd, outDir);
|
|
373
382
|
const out = rel === "" || rel.startsWith("..") || isAbsolute(rel) ? outDir : rel;
|
|
@@ -377,16 +386,29 @@ ${USAGE_LINE}`
|
|
|
377
386
|
detectPath: join(outDir, "detect.json"),
|
|
378
387
|
report: { version: 1, at, out, ...commit && { commit }, counts, score, findings },
|
|
379
388
|
home: join(cwd, SHOT_HOME),
|
|
380
|
-
entry: {
|
|
389
|
+
entry: {
|
|
390
|
+
at,
|
|
391
|
+
out,
|
|
392
|
+
...commit && { commit },
|
|
393
|
+
counts,
|
|
394
|
+
score,
|
|
395
|
+
findings: findings.length
|
|
396
|
+
}
|
|
381
397
|
},
|
|
382
398
|
log
|
|
383
399
|
);
|
|
384
400
|
const summary = SEVERITIES.filter((s) => counts[s] > 0).map((s) => `${s} ${counts[s]}`).join(", ");
|
|
385
401
|
log(
|
|
386
|
-
`[detect] ${findings.length === 0 ? "no findings" : `${findings.length} findings (${summary})`} \xB7 score ${score}`
|
|
402
|
+
`[detect] ${findings.length === 0 ? "no findings" : `${findings.length} findings (${summary})`} \xB7 ${score === null ? "nothing measured (no anchor resolved: not a score)" : `score ${score}`}`
|
|
387
403
|
);
|
|
388
404
|
for (const line of table(findings)) log(line);
|
|
389
|
-
|
|
405
|
+
const point = (r) => {
|
|
406
|
+
const n = r.findings === void 0 ? "" : ` (${r.findings} findings)`;
|
|
407
|
+
return `${r.score ?? "nothing measured"}${n}`;
|
|
408
|
+
};
|
|
409
|
+
log(
|
|
410
|
+
`[detect] trend ${trend.map(point).join(" \u2192 ")} \xB7 ${relative(cwd, join(outDir, "detect.json"))}`
|
|
411
|
+
);
|
|
390
412
|
return counts.P0 + counts.P1 > 0 ? 2 : 0;
|
|
391
413
|
} catch (error) {
|
|
392
414
|
if (!(error instanceof DetectError)) throw error;
|
|
@@ -1 +1 @@
|
|
|
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,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M,EAAE,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,MAAM,CAAC,CAqFjB;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/cli/shot/index.js
CHANGED
|
@@ -52,6 +52,12 @@ ${USAGE_LINE}`);
|
|
|
52
52
|
const bad = positionals.find((r) => !r.startsWith("/"));
|
|
53
53
|
if (bad) throw new ShotError(`route '${bad}' must start with '/'.
|
|
54
54
|
${USAGE_LINE}`);
|
|
55
|
+
const spaced = positionals.find((r) => /\s/.test(r));
|
|
56
|
+
if (spaced)
|
|
57
|
+
throw new ShotError(
|
|
58
|
+
`route '${spaced}' contains whitespace: pass each route as its own argument (zsh does not word-split $ROUTES; use \${=ROUTES} or an array).
|
|
59
|
+
${USAGE_LINE}`
|
|
60
|
+
);
|
|
55
61
|
if (Boolean(values.base) === Boolean(values.dist)) {
|
|
56
62
|
throw new ShotError(`pass exactly one of --base <url> or --dist <dir>.
|
|
57
63
|
${USAGE_LINE}`);
|
|
@@ -116,7 +122,8 @@ function planOut(cwd, out) {
|
|
|
116
122
|
const refuse = (why) => {
|
|
117
123
|
throw new ShotError(`--out ${out} ${why}`);
|
|
118
124
|
};
|
|
119
|
-
|
|
125
|
+
const inProject = `a directory inside the project (${cwd}; in a monorepo, the app dir)`;
|
|
126
|
+
if (rel === "" || outside(rel)) refuse(`must be ${inProject}`);
|
|
120
127
|
if (relative(join(cwd, HOME), dir) === "")
|
|
121
128
|
refuse("is the shot home (holds last.json); use a subdirectory");
|
|
122
129
|
if (rel === ".basalt" || rel.split(sep).some((part) => PROTECTED_SEGMENTS.has(part))) {
|
|
@@ -132,7 +139,7 @@ function planOut(cwd, out) {
|
|
|
132
139
|
} catch {
|
|
133
140
|
refuse("sits behind a dangling symlink");
|
|
134
141
|
}
|
|
135
|
-
if (outside(relative(realpathSync(cwd), real))) refuse(
|
|
142
|
+
if (outside(relative(realpathSync(cwd), real))) refuse(`resolves outside the project (${cwd})`);
|
|
136
143
|
if (probe === dir) {
|
|
137
144
|
if (!statSync(dir).isDirectory()) refuse("exists and is not a directory");
|
|
138
145
|
if (readdirSync(dir).length > 0 && !isPreviousShot(dir)) {
|
|
@@ -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,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAGhF;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAEzE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,EAAE,CAAA;IACZ,EAAE,EAAE,MAAM,EAAE,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,OAAO,CAAA;IACb,4EAA4E;IAC5E,YAAY,EAAE,OAAO,CAAA;IACrB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AACD,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AACxE,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAA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AAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,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,CA4B1F;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAiKpD"}
|
package/dist/cli/shot/measure.js
CHANGED
|
@@ -28,8 +28,17 @@ function finishMeasurement({ texts, radius, nested, ...rest }) {
|
|
|
28
28
|
const exact = contrastRatio(t.fg, t.bg);
|
|
29
29
|
const ratio = Math.round(exact * 100) / 100;
|
|
30
30
|
min = min === null ? ratio : Math.min(min, ratio);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const needs = contrastThreshold(t.fontSize, t.bold);
|
|
32
|
+
if (exact < needs) {
|
|
33
|
+
failures.push({
|
|
34
|
+
text: t.text,
|
|
35
|
+
ratio,
|
|
36
|
+
fg: hex(t.fg),
|
|
37
|
+
bg: hex(t.bg),
|
|
38
|
+
fontSize: t.fontSize,
|
|
39
|
+
needs,
|
|
40
|
+
bold: t.bold
|
|
41
|
+
});
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
const backdrop = texts.some((t) => t.assumedWhite) ? { backdrop: "assumed-white" } : {};
|
package/dist/cli/shot/types.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ export type ContrastFailure = {
|
|
|
29
29
|
fg: string;
|
|
30
30
|
bg: string;
|
|
31
31
|
fontSize: number;
|
|
32
|
+
/** The WCAG threshold applied (3 for large text, else 4.5); absent in older metrics.json. */
|
|
33
|
+
needs?: number;
|
|
34
|
+
bold?: boolean;
|
|
32
35
|
};
|
|
33
36
|
/** What the in-page measurer returns for one anchor. */
|
|
34
37
|
export type Measurement = {
|
|
@@ -77,7 +80,7 @@ export type ShotRecord = {
|
|
|
77
80
|
/** `absent`: the anchor declared itself missing in this state (`data-shot-absent`): not a defect. */
|
|
78
81
|
status: 'ok' | 'not-declared' | 'absent' | 'skipped' | 'error';
|
|
79
82
|
note?: string;
|
|
80
|
-
/** The anchor renders a basalt state surface (a ChartCard, StatCard or chart state)
|
|
83
|
+
/** The anchor renders a basalt state surface (a ChartCard, StatCard or chart state) but declares no `data-shot-states` of its own (and no `data-shot-absent` for this state). */
|
|
81
84
|
stateful?: true;
|
|
82
85
|
};
|
|
83
86
|
/** 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,4EAA4E;AAC5E,eAAO,MAAM,SAAS,kBAAkB,CAAA;AAExC,6HAA6H;AAC7H,eAAO,MAAM,cAAc,sCAAsC,CAAA;AAEjE,6EAA6E;AAC7E,eAAO,MAAM,W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MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,CAAC,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,KAAK,EAAE,KAAK,EAAE,CAAA;IACd,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA"}
|
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":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAiDA,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,CA0P1F"}
|
package/dist/cli/sync.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
resolveProjectDir,
|
|
33
33
|
routerSeedPlan,
|
|
34
34
|
rootsNotices,
|
|
35
|
+
rootToolingStates,
|
|
35
36
|
sha256,
|
|
36
37
|
shippedAssetPath,
|
|
37
38
|
START_APP_NOTE,
|
|
@@ -168,9 +169,16 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
168
169
|
}
|
|
169
170
|
if (seedSkip === "start" && (!opts.check || syncFlags.includes("--verbose")))
|
|
170
171
|
console.log(`basalt-ui sync: ${START_APP_NOTE}`);
|
|
171
|
-
const
|
|
172
|
+
const states = rootToolingStates(cwd, placement, ctx);
|
|
173
|
+
const notices = placementNotices(cwd, placement);
|
|
174
|
+
const placementSkips = notices.filter((_, i) => states[i] !== "in sync");
|
|
172
175
|
if (opts.check !== true || syncFlags.includes("--verbose")) {
|
|
173
|
-
|
|
176
|
+
states.forEach((st, i) => {
|
|
177
|
+
const file = i === 0 ? "lefthook.yml" : "check.yml";
|
|
178
|
+
console.log(
|
|
179
|
+
`basalt-ui sync: ${file} at the repo root: ${st}${st === "in sync" ? "" : ` \u2014 ${notices[i]}`}`
|
|
180
|
+
);
|
|
181
|
+
});
|
|
174
182
|
}
|
|
175
183
|
const rootsMessages = rootsNotices(rootsState);
|
|
176
184
|
for (const line of rootsMessages.log) console.log(`basalt-ui sync: ${line}`);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The title of the host region a `QueryState` sits in (`Section` sets it), so the error default
|
|
3
|
+
* names it — "Could not load practice record" — instead of the bare "Could not load". An explicit
|
|
4
|
+
* `errorTitle` still wins; outside any host it is `undefined` and nothing changes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HostTitleContext: import("react").Context<string | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* The error title a component names itself in: "Revenue" → "Could not load revenue". A leading
|
|
9
|
+
* capital followed by another capital or a non-letter ("KPI", "MRR", "2024 sales") keeps its case;
|
|
10
|
+
* a missing or blank label stays the bare "Could not load". Mantine-free: `charts/**` imports it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function couldNotLoad(label?: string): string;
|
|
13
|
+
//# sourceMappingURL=could-not-load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"could-not-load.d.ts","sourceRoot":"","sources":["../../src/common/could-not-load.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6CAA+C,CAAA;AAE5E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const HostTitleContext = createContext(void 0);
|
|
3
|
+
function couldNotLoad(label) {
|
|
4
|
+
const noun = label?.trim();
|
|
5
|
+
if (!noun) return "Could not load";
|
|
6
|
+
const lead = noun.charAt(0);
|
|
7
|
+
const second = noun.charAt(1);
|
|
8
|
+
const lowers = second !== "" && second === second.toLowerCase() && second !== second.toUpperCase();
|
|
9
|
+
return `Could not load ${lowers ? lead.toLowerCase() : lead}${noun.slice(1)}`;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
HostTitleContext,
|
|
13
|
+
couldNotLoad
|
|
14
|
+
};
|
package/dist/common/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* may reach it too.
|
|
8
8
|
*/
|
|
9
9
|
export { type BasaltProps, type SlotClassNames, type SlotStylesProps } from './props.js';
|
|
10
|
+
export { type DataAttributes, pickDataAttributes, splitDataAttributes } from './props.js';
|
|
10
11
|
export { type Tone, type ToneWithNeutral, type Tier, cx } from './props.js';
|
|
11
12
|
export { assignRef, mergeRefs } from './refs.js';
|
|
12
13
|
export { BASALT_PREFIX, requiredProp, oneOf, duplicateMount, missingLayer } from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACvF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,KAAK,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AACtF,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACvF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/common/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {} from "./props.js";
|
|
2
|
+
import { pickDataAttributes, splitDataAttributes } from "./props.js";
|
|
2
3
|
import { cx } from "./props.js";
|
|
3
4
|
import { assignRef, mergeRefs } from "./refs.js";
|
|
4
5
|
import { BASALT_PREFIX, requiredProp, oneOf, duplicateMount, missingLayer } from "./errors.js";
|
|
@@ -19,9 +20,11 @@ export {
|
|
|
19
20
|
mergeRefs,
|
|
20
21
|
missingLayer,
|
|
21
22
|
oneOf,
|
|
23
|
+
pickDataAttributes,
|
|
22
24
|
requiredProp,
|
|
23
25
|
resetValidatedProps,
|
|
24
26
|
scrollParentOf,
|
|
27
|
+
splitDataAttributes,
|
|
25
28
|
useCoarsePointer,
|
|
26
29
|
useValidateProps
|
|
27
30
|
};
|
package/dist/common/props.d.ts
CHANGED
|
@@ -29,6 +29,26 @@ export interface BasaltProps {
|
|
|
29
29
|
/** Merged onto the root element's own inline style, if it has one. */
|
|
30
30
|
readonly style?: CSSProperties | undefined;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Free-form `data-*` attributes. A composite takes them on top of `BasaltProps` and forwards them to
|
|
34
|
+
* its ROOT element through `pickDataAttributes` — the seam `basalt-ui shot` (`data-shot`,
|
|
35
|
+
* `data-shot-states`) and consumer test hooks read. Only `data-*` crosses: basalt still does not
|
|
36
|
+
* spread `...rest`.
|
|
37
|
+
*/
|
|
38
|
+
export type DataAttributes = {
|
|
39
|
+
readonly [K in `data-${string}`]?: string | number | boolean | undefined;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Splits `props` into its `data-*` entries (spread them onto the root: `{...data}`) and everything
|
|
43
|
+
* else. A composite that already forwards its remainder to a child (`...header`) splits first, or
|
|
44
|
+
* the anchor lands on the child instead of the root.
|
|
45
|
+
*/
|
|
46
|
+
export declare function splitDataAttributes<P extends object>(props: P): {
|
|
47
|
+
data: DataAttributes;
|
|
48
|
+
rest: Omit<P, `data-${string}`>;
|
|
49
|
+
};
|
|
50
|
+
/** The `data-*` entries of `props` alone, for a component that destructures the rest itself. */
|
|
51
|
+
export declare const pickDataAttributes: (props: object) => DataAttributes;
|
|
32
52
|
/** One class per named slot. The slot union is the component's documented contract. */
|
|
33
53
|
export type SlotClassNames<S extends string> = Partial<Record<S, string>>;
|
|
34
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/common/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CAC3C;AAED,uFAAuF;AACvF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,C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C,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;AAE1C,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9C;;;;GAIG;AACH,YAAY,EAAE,gBAAgB,IAAI,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAE1E;;;GAGG;AACH,wBAAgB,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,CAE7E"}
|
package/dist/common/props.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
function splitDataAttributes(props) {
|
|
2
|
+
const data = {};
|
|
3
|
+
const rest = {};
|
|
4
|
+
for (const [key, value] of Object.entries(props)) {
|
|
5
|
+
if (key.startsWith("data-")) data[key] = value;
|
|
6
|
+
else rest[key] = value;
|
|
7
|
+
}
|
|
8
|
+
return { data, rest };
|
|
9
|
+
}
|
|
10
|
+
const pickDataAttributes = (props) => splitDataAttributes(props).data;
|
|
1
11
|
function cx(...parts) {
|
|
2
12
|
return parts.filter((part) => typeof part === "string" && part !== "").join(" ");
|
|
3
13
|
}
|
|
4
14
|
export {
|
|
5
|
-
cx
|
|
15
|
+
cx,
|
|
16
|
+
pickDataAttributes,
|
|
17
|
+
splitDataAttributes
|
|
6
18
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The one Retry. ErrorState (Mantine, StatCard / pages), ChartCard's placeholder and a strip cell's
|
|
3
3
|
* error all render this, so the three read as one button. It is a plain element because `./charts`
|
|
4
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),
|
|
6
|
-
*
|
|
5
|
+
* reading the same `--vx-*` tokens the theme binds that button to: panel fill (elevated on hover),
|
|
6
|
+
* `shadow-raised`, the control radius, the xs type size, the theme's inline padding step and
|
|
7
7
|
* Mantine's 30px xs height. `--mantine-scale` carries the app's scale knob, 1 where Mantine is absent.
|
|
8
8
|
*/
|
|
9
9
|
.retry {
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
height: calc(1.875rem * var(--mantine-scale, 1));
|
|
16
16
|
padding-block: 0;
|
|
17
17
|
padding-inline: calc(var(--vx-space-stack-md, 0.75rem) * var(--mantine-scale, 1));
|
|
18
|
-
|
|
18
|
+
/* A visible edge: the panel fill and `shadow-raised` alone read as a pale chip on the page or a card,
|
|
19
|
+
so the border is ink mixed into the panel (>= 3:1 against it in both schemes), not the hairline. */
|
|
20
|
+
border: calc(0.0625rem * var(--mantine-scale, 1)) solid var(--vx-muted);
|
|
21
|
+
border-color: color-mix(in srgb, var(--vx-ink) 55%, var(--vx-surface-panel));
|
|
19
22
|
border-radius: var(--vx-radius-ctrl);
|
|
20
23
|
background: var(--vx-surface-panel);
|
|
21
24
|
box-shadow: var(--vx-shadow-raised);
|
|
@@ -46,6 +49,7 @@
|
|
|
46
49
|
/* Busy is Mantine's disabled paint: its own disabled colour and background, flat, no border. */
|
|
47
50
|
.retry:disabled {
|
|
48
51
|
background: var(--mantine-color-disabled, var(--vx-surface-subtle));
|
|
52
|
+
border-color: transparent;
|
|
49
53
|
color: var(--mantine-color-disabled-color, var(--vx-muted));
|
|
50
54
|
box-shadow: none;
|
|
51
55
|
cursor: not-allowed;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BasaltProps } from '../common/props.js';
|
|
2
|
+
import type { BasaltProps, DataAttributes } from '../common/props.js';
|
|
3
3
|
type BarListItem = {
|
|
4
4
|
label: string;
|
|
5
5
|
value: number;
|
|
@@ -12,7 +12,7 @@ type BarListItem = {
|
|
|
12
12
|
/** Names the tick for assistive tech (visually hidden text in the track). Default "Threshold". */
|
|
13
13
|
tickLabel?: string;
|
|
14
14
|
};
|
|
15
|
-
export type BarListProps = BasaltProps & {
|
|
15
|
+
export type BarListProps = BasaltProps & DataAttributes & {
|
|
16
16
|
/** Accessible name of the list. Required. */
|
|
17
17
|
label: string;
|
|
18
18
|
/** Rows in display order (sort them yourself; the list does not reorder). */
|
|
@@ -38,11 +38,11 @@ export type BarListProps = BasaltProps & {
|
|
|
38
38
|
secondaryAlign?: 'start' | 'end';
|
|
39
39
|
/** Renders row-shaped skeletons. */
|
|
40
40
|
loading?: boolean;
|
|
41
|
-
/** Skeleton rows while loading. Default 5. */
|
|
41
|
+
/** Skeleton rows while loading. Default: the rows `items` holds now (a refetch, capped at 30), else 5. */
|
|
42
42
|
loadingRows?: number;
|
|
43
43
|
/** Title of the `EmptyState` tile shown when `items` is empty. Default "No items to compare yet"; pass the cause for your list. */
|
|
44
44
|
emptyText?: string;
|
|
45
45
|
};
|
|
46
|
-
export declare function BarList({ label, items, format, max, variant, accentLeader, secondaryAlign, loading, loadingRows, emptyText, className, style, }: BarListProps): import("react").JSX.Element;
|
|
46
|
+
export declare function BarList({ label, items, format, max, variant, accentLeader, secondaryAlign, loading, loadingRows, emptyText, className, style, ...rest }: BarListProps): import("react").JSX.Element;
|
|
47
47
|
export {};
|
|
48
48
|
//# sourceMappingURL=bar-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-list.d.ts","sourceRoot":"","sources":["../../src/dashboard/bar-list.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bar-list.d.ts","sourceRoot":"","sources":["../../src/dashboard/bar-list.tsx"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EA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2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Skeleton, VisuallyHidden } from "@mantine/core";
|
|
3
3
|
import { EmptyState } from "./empty-state.js";
|
|
4
4
|
import { isValidElement } from "react";
|
|
5
|
-
import { cx } from "../common/props.js";
|
|
5
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
6
6
|
import classes from "./bar-list.module.css";
|
|
7
7
|
import { StatusDot } from "../theme/status-dot.js";
|
|
8
8
|
import { StatusVerdict } from "../theme/status-verdict.js";
|
|
9
|
+
import { skeletonRowCount } from "./event-list-model.js";
|
|
9
10
|
import { asText, barPercent } from "./scale.js";
|
|
10
11
|
const hasContent = (node) => node !== void 0 && node !== null && typeof node !== "boolean";
|
|
11
12
|
const isFigure = (node) => typeof node === "number" || typeof node === "string" && /^[\s+\-−±▲▼]*[€$£¥]?\d/.test(node);
|
|
@@ -19,15 +20,17 @@ function BarList({
|
|
|
19
20
|
accentLeader = false,
|
|
20
21
|
secondaryAlign,
|
|
21
22
|
loading = false,
|
|
22
|
-
loadingRows
|
|
23
|
+
loadingRows,
|
|
23
24
|
emptyText = "No items to compare yet",
|
|
24
25
|
className,
|
|
25
|
-
style
|
|
26
|
+
style,
|
|
27
|
+
...rest
|
|
26
28
|
}) {
|
|
29
|
+
const data = pickDataAttributes(rest);
|
|
27
30
|
if (loading) {
|
|
28
|
-
return /* @__PURE__ */ jsx("div", { className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsxs("div", { className: classes.root, "aria-busy": "true", "data-variant": variant, children: [
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { ...data, className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsxs("div", { className: classes.root, "aria-busy": "true", "data-variant": variant, children: [
|
|
29
32
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: `Loading ${label}` }),
|
|
30
|
-
Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsxs(
|
|
33
|
+
Array.from({ length: skeletonRowCount(loadingRows, items.length) }, (_, i) => /* @__PURE__ */ jsxs(
|
|
31
34
|
"div",
|
|
32
35
|
{
|
|
33
36
|
className: cx(classes.row, classes.skeletonRow),
|
|
@@ -45,7 +48,7 @@ function BarList({
|
|
|
45
48
|
] }) });
|
|
46
49
|
}
|
|
47
50
|
if (items.length === 0) {
|
|
48
|
-
return /* @__PURE__ */ jsx("div", { className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsxs("div", { className: classes.root, role: "status", children: [
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { ...data, className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsxs("div", { className: classes.root, role: "status", children: [
|
|
49
52
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
50
53
|
/* @__PURE__ */ jsx(EmptyState, { tier: "section", title: emptyText, className: classes.empty })
|
|
51
54
|
] }) });
|
|
@@ -59,7 +62,7 @@ function BarList({
|
|
|
59
62
|
const align = secondaryAlign ?? (items.some((i) => isText(i.secondary)) ? "start" : "end");
|
|
60
63
|
return (
|
|
61
64
|
// The frame is the width container the wide layout keys on (a container cannot restyle its own grid).
|
|
62
|
-
/* @__PURE__ */ jsx("div", { className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsx(
|
|
65
|
+
/* @__PURE__ */ jsx("div", { ...data, className: cx(classes.frame, className), style, children: /* @__PURE__ */ jsx(
|
|
63
66
|
"ul",
|
|
64
67
|
{
|
|
65
68
|
className: classes.root,
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
.label {
|
|
70
70
|
position: relative;
|
|
71
71
|
min-width: 0;
|
|
72
|
+
/* A name truncates before it touches the value, whatever the column gap. */
|
|
73
|
+
padding-inline-end: var(--vx-space-stack-md, 0.75rem);
|
|
72
74
|
overflow: hidden;
|
|
73
75
|
text-overflow: ellipsis;
|
|
74
76
|
white-space: nowrap;
|
|
@@ -231,10 +233,26 @@
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
235
|
/*
|
|
234
|
-
* A column of DeltaBadges
|
|
235
|
-
*
|
|
236
|
-
*
|
|
236
|
+
* A column of DeltaBadges is a start-aligned two-track grid: the glyph track, then the figure. Every
|
|
237
|
+
* glyph shares one x and sits one fixed gap from its own figure ("▲ 9%" and "▲ 13%" alike); the
|
|
238
|
+
* figures are ragged on the right. End-aligning them in a fixed-width track kept the right edge but
|
|
239
|
+
* left a digit-wide hole between a short figure and its glyph (about 8px, Wave 50 S4).
|
|
237
240
|
*/
|
|
238
241
|
.secondary [data-delta] {
|
|
242
|
+
/* A block that hugs its content and sits on the cell's start, whatever the cell's `text-align`, so
|
|
243
|
+
* every glyph shares one x. */
|
|
244
|
+
display: grid;
|
|
245
|
+
width: max-content;
|
|
246
|
+
margin-inline-end: auto;
|
|
247
|
+
grid-auto-flow: column;
|
|
248
|
+
grid-template-columns: auto auto;
|
|
249
|
+
justify-items: start;
|
|
239
250
|
font-variant-numeric: tabular-nums;
|
|
251
|
+
/* The row's line box, not the badge's own `line-height: 1`: its baseline then sits on the value's. */
|
|
252
|
+
line-height: inherit;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* A zero delta has no glyph: its figure is the only track. */
|
|
256
|
+
.secondary [data-delta]:not(:has([data-delta-glyph])) {
|
|
257
|
+
grid-template-columns: auto;
|
|
240
258
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { BasaltProps } from '../common/props.js';
|
|
2
|
+
import type { BasaltProps, DataAttributes } from '../common/props.js';
|
|
3
3
|
import type { EnumField, FieldHandle } from '../state.js';
|
|
4
|
-
export type BoardProps<T extends string = string> = BasaltProps & {
|
|
4
|
+
export type BoardProps<T extends string = string> = BasaltProps & DataAttributes & {
|
|
5
5
|
/** Accessible name of the board. Default "Board". */
|
|
6
6
|
label?: string;
|
|
7
7
|
/** Columns in display order. Column and card `id`s must be unique within their parent. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/dashboard/board.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/dashboard/board.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAElE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAStD,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,GAC7D,cAAc,GAAG;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,OAAO,EAAE,SAAS;QAChB,EAAE,EAAE,CAAC,CAAA;QACL,KAAK,EAAE,MAAM,CAAA;QACb,gFAAgF;QAChF,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,0EAA0E;QAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,6GAA6G;QAC7G,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,SAAS;YACd,EAAE,EAAE,MAAM,CAAA;YACV,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,IAAI,CAAC,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,uEAAuE;YACvE,MAAM,CAAC,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;YACzC,0DAA0D;YAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,4DAA4D;YAC5D,KAAK,CAAC,EAAE,SAAS,CAAA;SAClB,EAAE,CAAA;KACJ,EAAE,CAAA;IACH,sEAAsE;IACt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