basalt-ui 2.14.0 → 2.15.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 +40 -0
- package/MIGRATING.md +19 -13
- package/agent/agents/basalt-design-reviewer.md +83 -0
- package/agent/rules/basalt-batteries.md +1 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-controls.md +3 -3
- package/agent/rules/basalt-mantine.md +1 -2
- package/agent/rules/basalt-state.md +1 -2
- package/agent/rules/basalt-tokens.md +1 -3
- package/agent/skills/basalt-design/SKILL.md +26 -8
- package/agent/templates/AGENTS-block.md.tpl +7 -0
- package/configs/oxlint-plugin.js +39 -2
- package/configs/oxlint-plugin.test.ts +48 -0
- package/dist/charts/legend.d.ts +4 -4
- package/dist/cli/board-freshness.d.ts +25 -0
- package/dist/cli/board-freshness.d.ts.map +1 -0
- package/dist/cli/board-freshness.js +88 -0
- package/dist/cli/doctor.d.ts +2 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -3
- package/dist/cli/index.d.ts +15 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +57 -7
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +6 -1
- package/dist/cli/shot/board.d.ts +5 -0
- package/dist/cli/shot/board.d.ts.map +1 -0
- package/dist/cli/shot/board.js +96 -0
- package/dist/cli/shot/capture.d.ts +59 -0
- package/dist/cli/shot/capture.d.ts.map +1 -0
- package/dist/cli/shot/capture.js +473 -0
- package/dist/cli/shot/index.d.ts +45 -0
- package/dist/cli/shot/index.d.ts.map +1 -0
- package/dist/cli/shot/index.js +289 -0
- package/dist/cli/shot/measure.d.ts +28 -0
- package/dist/cli/shot/measure.d.ts.map +1 -0
- package/dist/cli/shot/measure.js +176 -0
- package/dist/cli/shot/playwright.d.ts +101 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -0
- package/dist/cli/shot/playwright.js +60 -0
- package/dist/cli/shot/serve.d.ts +6 -0
- package/dist/cli/shot/serve.d.ts.map +1 -0
- package/dist/cli/shot/serve.js +33 -0
- package/dist/cli/shot/types.d.ts +97 -0
- package/dist/cli/shot/types.d.ts.map +1 -0
- package/dist/cli/shot/types.js +17 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -1
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/legend.tsx +4 -4
- package/src/cli/board-freshness.ts +132 -0
- package/src/cli/doctor.ts +10 -1
- package/src/cli/help.ts +14 -2
- package/src/cli/index.ts +80 -10
- package/src/cli/init.ts +8 -1
- package/src/cli/shot/board.ts +154 -0
- package/src/cli/shot/capture.ts +650 -0
- package/src/cli/shot/index.ts +362 -0
- package/src/cli/shot/measure.ts +225 -0
- package/src/cli/shot/playwright.ts +152 -0
- package/src/cli/shot/serve.ts +35 -0
- package/src/cli/shot/types.ts +91 -0
- package/src/cli/sync.ts +2 -1
- package/src/surfaces.ts +5 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
const LAST_SHOT = join(".basalt", "shots", "last.json");
|
|
5
|
+
const SKIPPED_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", ".git", ".basalt"]);
|
|
6
|
+
const UI_FILE = /\.(tsx|css)$/;
|
|
7
|
+
const WALK_CAP = 5e3;
|
|
8
|
+
const BOARD_NOTICE = "UI changed since the last board \u2014 run basalt-ui shot <routes> and the basalt-design-reviewer (/basalt-design)";
|
|
9
|
+
const PLAYWRIGHT_INSTALL = "bun add -d playwright && bunx playwright install chromium";
|
|
10
|
+
function mtimeOf(path) {
|
|
11
|
+
try {
|
|
12
|
+
return statSync(path, { throwIfNoEntry: false })?.mtimeMs ?? null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function walkUi(cwd, roots, cap) {
|
|
18
|
+
const walk = { newest: null, truncated: false };
|
|
19
|
+
const stack = roots.map((root) => resolve(cwd, root));
|
|
20
|
+
let visited = 0;
|
|
21
|
+
for (let dir = stack.pop(); dir !== void 0; dir = stack.pop()) {
|
|
22
|
+
if (++visited > cap) return { ...walk, truncated: true };
|
|
23
|
+
let entries;
|
|
24
|
+
try {
|
|
25
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (error.code !== "ENOENT") walk.truncated = true;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
const path = join(dir, entry.name);
|
|
32
|
+
if (entry.isDirectory()) {
|
|
33
|
+
if (!SKIPPED_DIRS.has(entry.name)) stack.push(path);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (!UI_FILE.test(entry.name)) continue;
|
|
37
|
+
if (++visited > cap) return { ...walk, truncated: true };
|
|
38
|
+
const mtime = mtimeOf(path);
|
|
39
|
+
if (mtime !== null && (walk.newest === null || mtime > walk.newest)) walk.newest = mtime;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return walk;
|
|
43
|
+
}
|
|
44
|
+
function lastBoardAt(cwd) {
|
|
45
|
+
try {
|
|
46
|
+
const last = JSON.parse(readFileSync(resolve(cwd, LAST_SHOT), "utf8"));
|
|
47
|
+
if (typeof last !== "object" || last === null) return null;
|
|
48
|
+
const at = last.at;
|
|
49
|
+
if (typeof at !== "string") return null;
|
|
50
|
+
const ms = Date.parse(at);
|
|
51
|
+
return Number.isNaN(ms) ? null : ms;
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function staleBoardNotice(cwd, roots, walkCap = WALK_CAP) {
|
|
57
|
+
const { newest, truncated } = walkUi(cwd, roots, walkCap);
|
|
58
|
+
if (truncated) return BOARD_NOTICE;
|
|
59
|
+
if (newest === null) return null;
|
|
60
|
+
const at = lastBoardAt(cwd);
|
|
61
|
+
return at === null || newest > at ? BOARD_NOTICE : null;
|
|
62
|
+
}
|
|
63
|
+
function playwrightVersion(cwd, load = createRequire(resolve(cwd, "package.json"))) {
|
|
64
|
+
for (const name of ["playwright", "playwright-core"]) {
|
|
65
|
+
try {
|
|
66
|
+
return load(`${name}/package.json`).version ?? "unknown";
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function designLoopLines(cwd, roots, probes = {}) {
|
|
73
|
+
const lines = [];
|
|
74
|
+
const notice = (probes.notice ?? staleBoardNotice)(cwd, roots);
|
|
75
|
+
if (notice !== null) lines.push(` \u2192 ${notice}`);
|
|
76
|
+
const playwright = (probes.playwright ?? playwrightVersion)(cwd);
|
|
77
|
+
lines.push(
|
|
78
|
+
playwright === null ? ` \u2192 playwright is not installed (optional, needed by basalt-ui shot): ${PLAYWRIGHT_INSTALL}` : ` \u2713 playwright resolves (${playwright === "unknown" ? "version unknown" : playwright}; optional: basalt-ui shot)`
|
|
79
|
+
);
|
|
80
|
+
return lines;
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
BOARD_NOTICE,
|
|
84
|
+
PLAYWRIGHT_INSTALL,
|
|
85
|
+
designLoopLines,
|
|
86
|
+
playwrightVersion,
|
|
87
|
+
staleBoardNotice
|
|
88
|
+
};
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DesignLoopProbes } from './board-freshness.js';
|
|
1
2
|
export type DoctorResult = {
|
|
2
3
|
/** Number of hard failures (exit non-zero). */
|
|
3
4
|
hardFailures: number;
|
|
@@ -33,5 +34,5 @@ export type DoctorResult = {
|
|
|
33
34
|
*
|
|
34
35
|
* Returns the exit code: 0 = all good, 1 = one or more hard failures or skipped checks.
|
|
35
36
|
*/
|
|
36
|
-
export declare function doctor(invocationCwd?: string, flags?: string[]): number;
|
|
37
|
+
export declare function doctor(invocationCwd?: string, flags?: string[], designLoop?: DesignLoopProbes): number;
|
|
37
38
|
//# sourceMappingURL=doctor.d.ts.map
|
package/dist/cli/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA4BzD,MAAM,MAAM,YAAY,GAAG;IACzB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,MAAM,EAAO,EACpB,UAAU,GAAE,gBAAqB,GAChC,MAAM,CAkUR"}
|
package/dist/cli/doctor.js
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
scannableFiles,
|
|
28
28
|
shippedAssetPath
|
|
29
29
|
} from "./index.js";
|
|
30
|
+
import { designLoopLines } from "./board-freshness.js";
|
|
30
31
|
import { parseJsonc } from "./source-text.js";
|
|
31
32
|
import { resolveRoots } from "./config.js";
|
|
32
33
|
import {
|
|
@@ -65,7 +66,7 @@ function aiMajorsAt(dir) {
|
|
|
65
66
|
}
|
|
66
67
|
return out;
|
|
67
68
|
}
|
|
68
|
-
function doctor(invocationCwd = process.cwd(), flags = []) {
|
|
69
|
+
function doctor(invocationCwd = process.cwd(), flags = [], designLoop = {}) {
|
|
69
70
|
if (conflictingProfileFlags("doctor", flags)) return 1;
|
|
70
71
|
const project = resolveProjectDir(invocationCwd);
|
|
71
72
|
const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null;
|
|
@@ -294,6 +295,7 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
294
295
|
if (shell.fail !== null) fail(shell.fail);
|
|
295
296
|
for (const line of shell.warnings) warn(line);
|
|
296
297
|
}
|
|
298
|
+
if (profile !== "tokens-only") lines.push(...designLoopLines(cwd, resolveRoots(cfg), designLoop));
|
|
297
299
|
lines.push("");
|
|
298
300
|
if (result.hardFailures === 0 && result.warnings === 0 && result.skipped === 0) {
|
|
299
301
|
lines.push("All checks passed.");
|
package/dist/cli/help.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CAqC1F,CAAA;AAED;yCACyC;AACzC,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED,0GAA0G;AAC1G,eAAO,MAAM,KAAK,QAwC0E,CAAA"}
|
package/dist/cli/help.js
CHANGED
|
@@ -29,13 +29,19 @@ const COMMAND_OPTIONS = {
|
|
|
29
29
|
"media-fallback": { type: "boolean" },
|
|
30
30
|
only: { type: "string" }
|
|
31
31
|
},
|
|
32
|
-
"fonts:css": { out: { type: "string" }, check: { type: "boolean" } }
|
|
32
|
+
"fonts:css": { out: { type: "string" }, check: { type: "boolean" } },
|
|
33
|
+
shot: {
|
|
34
|
+
base: { type: "string" },
|
|
35
|
+
dist: { type: "string" },
|
|
36
|
+
out: { type: "string" },
|
|
37
|
+
states: { type: "string" }
|
|
38
|
+
}
|
|
33
39
|
};
|
|
34
40
|
function unknownFlag(cmd, flags) {
|
|
35
41
|
const options = COMMAND_OPTIONS[cmd];
|
|
36
42
|
if (options === void 0) return null;
|
|
37
43
|
try {
|
|
38
|
-
parseArgs({ args: [...flags], options, strict: true, allowPositionals:
|
|
44
|
+
parseArgs({ args: [...flags], options, strict: true, allowPositionals: cmd === "shot" });
|
|
39
45
|
return null;
|
|
40
46
|
} catch (err) {
|
|
41
47
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -43,7 +49,7 @@ function unknownFlag(cmd, flags) {
|
|
|
43
49
|
return match?.[1] ?? flags.find((f) => f.startsWith("-")) ?? flags[0] ?? null;
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
|
-
const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n Emit the --vx-* stylesheet (stdout unless --out). Defaults emit the stock identity; commit the output as your tokens file.\n --selector-class emits `:root.dark` instead of an attribute selector (the Tailwind convention).\n --check writes nothing and exits 1 when --out differs from what would be emitted (a CI gate).\n\nfonts:css [--out <path>] [--check]\n Emit the shipped --basalt-font-* stacks as plain CSS \u2014 the typeface half of the token layer,\n otherwise reachable only by importing styles.css.\n\ndoctor [--tokens-only|--framework]\n Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n this package.json. Profile is DECLARED, same as check-theme \u2014 never inferred.\n\nsync [--force] [--check] [--verbose] [--tokens-only|--framework]\n Refreshes an EXISTING install; it never creates one (that is init). A tokens-only consumer\n has no scaffold to reconcile, so sync reports n/a and exits 0 there \u2014 as doctor does.\n --check prints the permanent placement skips as a COUNT; --verbose spells them out again.\n\ncheck-theme / doctor / sync all resolve their project the same way: BASALT_CWD, else the\ninvocation cwd \u2014 nothing inferred, nothing ascended or descended into.\n--tokens-only and --framework are alternatives; passing both is an error.\n\nEvery subcommand accepts --help / -h to print this message and exit without running.\n--version / -v prints the resolved package version and exits 0 \u2014 the one command that proves\nWHICH basalt-ui ran, which a `bunx` cache can otherwise make a lie. An unknown command or an\nunrecognized flag exits 1 and names what it did not understand; neither is ever ignored.";
|
|
52
|
+
const USAGE = "Usage: basalt-ui <--version | init [--no-merge-lint] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css |\n shot <route\u2026> | help>\n\ncheck-theme [--tokens-only|--framework] [--audit-allows]\n --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n `basalt.exemptRules` entry, with what each one still suppresses \u2014 proved by re-running the\n guard with that one waiver neutralized, not by reading its text. Exits 1 on a waiver that\n suppresses nothing (dead), which is what makes it usable as a CI gate.\n\ntokens:css [--out <path>] [--check] [--selector-attribute <attr> | --selector-class <class>]\n [--light-class <class>] [--dark-value <v>] [--light-value <v>]\n [--default-scheme <dark|light|none>] [--media-fallback] [--only <core|all>]\n Emit the --vx-* stylesheet (stdout unless --out). Defaults emit the stock identity; commit the output as your tokens file.\n --selector-class emits `:root.dark` instead of an attribute selector (the Tailwind convention).\n --check writes nothing and exits 1 when --out differs from what would be emitted (a CI gate).\n\nfonts:css [--out <path>] [--check]\n Emit the shipped --basalt-font-* stacks as plain CSS \u2014 the typeface half of the token layer,\n otherwise reachable only by importing styles.css.\n\nshot <route\u2026> (--base <url> | --dist <dir>) [--out <dir>] [--states <list>]\n Render routes in Chromium (Playwright from YOUR project: bun add -d playwright) and write\n board.html, metrics.json and png/* \u2014 every data-shot anchor \xD7 light/dark \xD7 desktop/mobile \xD7\n rest, hover, focus, tooltip, empty, loading, error. --dist serves a built SPA dir itself.\n Default --out .basalt/shots (emptied each run); .basalt/shots/last.json names the last out dir.\n\ndoctor [--tokens-only|--framework]\n Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n this package.json. Profile is DECLARED, same as check-theme \u2014 never inferred.\n\nsync [--force] [--check] [--verbose] [--tokens-only|--framework]\n Refreshes an EXISTING install; it never creates one (that is init). A tokens-only consumer\n has no scaffold to reconcile, so sync reports n/a and exits 0 there \u2014 as doctor does.\n --check prints the permanent placement skips as a COUNT; --verbose spells them out again.\n\ncheck-theme / doctor / sync all resolve their project the same way: BASALT_CWD, else the\ninvocation cwd \u2014 nothing inferred, nothing ascended or descended into.\n--tokens-only and --framework are alternatives; passing both is an error.\n\nEvery subcommand accepts --help / -h to print this message and exit without running.\n--version / -v prints the resolved package version and exits 0 \u2014 the one command that proves\nWHICH basalt-ui ran, which a `bunx` cache can otherwise make a lie. An unknown command or an\nunrecognized flag exits 1 and names what it did not understand; neither is ever ignored.";
|
|
47
53
|
export {
|
|
48
54
|
COMMAND_OPTIONS,
|
|
49
55
|
USAGE,
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -132,6 +132,8 @@ type TemplateVars = {
|
|
|
132
132
|
SERIES_MODULE_PATH: string;
|
|
133
133
|
/** The consumer's configured roots as space-separated quoted oxfmt globs, e.g. `'apps/web/src/**'`. */
|
|
134
134
|
ROOTS_GLOBS: string;
|
|
135
|
+
/** The roots a rule's `paths:` renders from: `basalt.roots` (init/sync write the inferred ones first), else {@link LEGACY_RULE_ROOTS}. */
|
|
136
|
+
RULE_ROOTS: string[];
|
|
135
137
|
/** Path to the shipped oxlint preset from the consumer dir — RESOLVED, never assumed at the root. */
|
|
136
138
|
OXLINT_PRESET_PATH: string;
|
|
137
139
|
/** Path to the shipped lefthook preset from the consumer dir — same resolution. */
|
|
@@ -167,6 +169,13 @@ export declare function basaltBinCommand(install: BasaltInstall, cwd: string): s
|
|
|
167
169
|
* lint/theme/format steps. Without one, the built-in steps run. Rendered at `{{GATE_STEPS}}`.
|
|
168
170
|
*/
|
|
169
171
|
export declare function ciGateSteps(cwd: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* A rule's front-matter `paths:` block rendered from `roots`: one `'<root>/**'` item per root,
|
|
174
|
+
* normalised (no `./`, no trailing slash) and single-quoted for YAML. Only the leading `---…---`
|
|
175
|
+
* block is touched. Front matter without `paths:` is returned unchanged; a `paths:` that is not the
|
|
176
|
+
* expected list shape, or a root that would match everywhere (`''`, `/`, absolute), throws.
|
|
177
|
+
*/
|
|
178
|
+
export declare function renderRulePaths(text: string, roots: readonly string[]): string;
|
|
170
179
|
/** True when both paths resolve to one file (a symlinked pair). A missing path is simply "no". */
|
|
171
180
|
export declare function sameFile(a: string, b: string): boolean;
|
|
172
181
|
/** True when the host text carries a managed block (begin marker present). */
|
|
@@ -342,7 +351,12 @@ export declare function writeUnit(file: ManagedFile, cwd: string, desired: strin
|
|
|
342
351
|
export declare function classify(state: UnitState, manifestHash: string | undefined): Classification;
|
|
343
352
|
export declare function diffSummary(file: ManagedFile, state: UnitState): string;
|
|
344
353
|
/** Build the render context for a run from the package root + consumer cwd/config. */
|
|
345
|
-
export declare function renderContext(cwd: string): RenderContext;
|
|
354
|
+
export declare function renderContext(cwd: string, ruleRoots?: readonly string[]): RenderContext;
|
|
355
|
+
/**
|
|
356
|
+
* The rule roots a run renders with: what `reconcileRoots` wrote, or — on `--check`, which writes
|
|
357
|
+
* nothing — what a real sync would have written, so check and write never disagree.
|
|
358
|
+
*/
|
|
359
|
+
export declare function ruleRootsFor(state: RootsState): readonly string[] | undefined;
|
|
346
360
|
/**
|
|
347
361
|
* Read → mutate → write the consumer's package.json, preserving its own indentation and trailing
|
|
348
362
|
* newline. `mutate` returns false to abort the write (nothing to change). Returns whether a write
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,UAAU,CAAA;AACrE,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAEL,iBAAiB,EAEjB,mBAAmB,EACnB,cAAc,EACd,eAAe,EAEhB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAA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AAW,EAAE,CAAA;AAClC,YAAY,EAAE,WAAW,EAAE,CAAA;AAI3B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,uBAAuB,EAAE,SAAS,EAAE,CAAA;AAClG,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
import { DEFAULT_GUARD_CONFIG, guardWaiverHint } from "../guard/index.js";
|
|
16
|
-
import { RULE_NAMES, SKILL_NAMES } from "../surfaces.js";
|
|
16
|
+
import { AGENT_NAMES, RULE_NAMES, SKILL_NAMES } from "../surfaces.js";
|
|
17
17
|
import { checkTheme } from "./check-theme.js";
|
|
18
18
|
import { doctor } from "./doctor.js";
|
|
19
19
|
import { guardHook } from "./guard-hook.js";
|
|
20
20
|
import { COMMAND_OPTIONS, USAGE, unknownFlag } from "./help.js";
|
|
21
21
|
import { init } from "./init.js";
|
|
22
|
+
import { shot } from "./shot/index.js";
|
|
22
23
|
import { sync } from "./sync.js";
|
|
23
24
|
import {
|
|
24
25
|
CODE_ROUTED_NOTE,
|
|
@@ -269,16 +270,36 @@ function buildTemplateVars(pkgRoot, cwd, cfg) {
|
|
|
269
270
|
ACCENT_HUE: cfg.accentHue ?? "blue",
|
|
270
271
|
SERIES_MODULE_PATH: resolveSeriesModulePath(cfg),
|
|
271
272
|
ROOTS_GLOBS: resolveRoots(cfg).map(toRootGlob).join(" "),
|
|
273
|
+
RULE_ROOTS: cfg.roots ?? [],
|
|
272
274
|
OXLINT_PRESET_PATH: shippedAssetPath(install, cwd, OXLINT_FILES.preset),
|
|
273
275
|
LEFTHOOK_PRESET_PATH: shippedAssetPath(install, cwd, "configs/lefthook.yml"),
|
|
274
276
|
BASALT_BIN: basaltBinCommand(install, cwd),
|
|
275
277
|
GATE_STEPS: ciGateSteps(cwd)
|
|
276
278
|
};
|
|
277
279
|
}
|
|
280
|
+
const LEGACY_RULE_ROOTS = ["src", "apps/**/src", "packages/**/src"];
|
|
281
|
+
const FRONT_MATTER = /^---\n[\s\S]*?\n---\n/;
|
|
282
|
+
const RULE_PATHS_BLOCK = /^paths:\n(?: {2}- .*\n)+/m;
|
|
283
|
+
function renderRulePaths(text, roots) {
|
|
284
|
+
const front = FRONT_MATTER.exec(text)?.[0];
|
|
285
|
+
if (front === void 0 || !/^paths:/m.test(front)) return text;
|
|
286
|
+
if (!RULE_PATHS_BLOCK.test(front)) throw new Error("rule `paths:` is not a list of ` - \u2026` items");
|
|
287
|
+
const items = (roots.length > 0 ? roots : LEGACY_RULE_ROOTS).map((raw) => {
|
|
288
|
+
const root = raw.replace(/^(?:\.\/)+/, "").replace(/\/+$/, "");
|
|
289
|
+
if (/[\n\r]/.test(root)) throw new Error(`basalt.roots entry has a line break: ${raw}`);
|
|
290
|
+
if (raw.startsWith("/") || root === "") {
|
|
291
|
+
throw new Error(`basalt.roots entry must be a relative directory, got ${JSON.stringify(raw)}`);
|
|
292
|
+
}
|
|
293
|
+
return ` - '${(root === "." ? "**" : `${root}/**`).replace(/'/g, "''")}'`;
|
|
294
|
+
});
|
|
295
|
+
return front.replace(RULE_PATHS_BLOCK, () => `paths:
|
|
296
|
+
${items.join("\n")}
|
|
297
|
+
`) + text.slice(front.length);
|
|
298
|
+
}
|
|
278
299
|
function fillTemplate(tpl, vars) {
|
|
279
300
|
const fill = (text) => text.replace(/\{\{(\w+)\}\}/g, (m, key) => {
|
|
280
301
|
const v = vars[key];
|
|
281
|
-
return v
|
|
302
|
+
return typeof v === "string" ? v : m;
|
|
282
303
|
});
|
|
283
304
|
return fill(tpl.replace("# {{GATE_STEPS}}", vars.GATE_STEPS));
|
|
284
305
|
}
|
|
@@ -418,7 +439,10 @@ function managedFiles(placement = ROOT_PLACEMENT) {
|
|
|
418
439
|
dest: `.claude/rules/basalt-${name}.md`,
|
|
419
440
|
mode: "managed",
|
|
420
441
|
source: `agent/rules/basalt-${name}.md`,
|
|
421
|
-
render: (ctx) =>
|
|
442
|
+
render: (ctx) => {
|
|
443
|
+
const text = readSource(ctx.pkgRoot, `agent/rules/basalt-${name}.md`);
|
|
444
|
+
return text === null ? null : renderRulePaths(text, ctx.vars.RULE_ROOTS);
|
|
445
|
+
}
|
|
422
446
|
}));
|
|
423
447
|
const skills = SKILL_NAMES.map((name) => ({
|
|
424
448
|
dest: `.claude/skills/${name}/SKILL.md`,
|
|
@@ -426,6 +450,12 @@ function managedFiles(placement = ROOT_PLACEMENT) {
|
|
|
426
450
|
source: `agent/skills/${name}/SKILL.md`,
|
|
427
451
|
render: (ctx) => readSource(ctx.pkgRoot, `agent/skills/${name}/SKILL.md`)
|
|
428
452
|
}));
|
|
453
|
+
const agents = AGENT_NAMES.map((name) => ({
|
|
454
|
+
dest: `.claude/agents/${name}.md`,
|
|
455
|
+
mode: "managed",
|
|
456
|
+
source: `agent/agents/${name}.md`,
|
|
457
|
+
render: (ctx) => readSource(ctx.pkgRoot, `agent/agents/${name}.md`)
|
|
458
|
+
}));
|
|
429
459
|
const agentsBlock = {
|
|
430
460
|
dest: AGENTS_MD,
|
|
431
461
|
mode: "managed",
|
|
@@ -527,7 +557,17 @@ pre-commit:
|
|
|
527
557
|
};
|
|
528
558
|
const scaffolds = [navModule, rootRoute, mainEntry];
|
|
529
559
|
const rootTooling = placement.isPackageRepoRoot ? [lefthook, ci] : [];
|
|
530
|
-
return [
|
|
560
|
+
return [
|
|
561
|
+
...rules,
|
|
562
|
+
...skills,
|
|
563
|
+
...agents,
|
|
564
|
+
agentsBlock,
|
|
565
|
+
design,
|
|
566
|
+
oxfmt,
|
|
567
|
+
...rootTooling,
|
|
568
|
+
oxlintrc,
|
|
569
|
+
...scaffolds
|
|
570
|
+
];
|
|
531
571
|
}
|
|
532
572
|
function placementNotices(cwd, placement) {
|
|
533
573
|
const out = [];
|
|
@@ -561,7 +601,8 @@ function readManifest(cwd) {
|
|
|
561
601
|
}
|
|
562
602
|
const RETIREABLE_DEST_PATTERNS = [
|
|
563
603
|
/^\.claude\/rules\/basalt-[a-z0-9-]+\.md$/,
|
|
564
|
-
/^\.claude\/skills\/basalt-[a-z0-9-]+\/SKILL\.md
|
|
604
|
+
/^\.claude\/skills\/basalt-[a-z0-9-]+\/SKILL\.md$/,
|
|
605
|
+
/^\.claude\/agents\/basalt-[a-z0-9-]+\.md$/
|
|
565
606
|
];
|
|
566
607
|
function retiredManagedDests(manifest, files) {
|
|
567
608
|
const shipped = new Set(files.map((f) => f.dest));
|
|
@@ -661,9 +702,14 @@ function diffSummary(file, state) {
|
|
|
661
702
|
const desLines = des.split("\n").length;
|
|
662
703
|
return ` ~ ${file.dest} (local: ${curLines} lines, shipped: ${desLines} lines) \u2014 locally edited, skipped (use --force to overwrite)`;
|
|
663
704
|
}
|
|
664
|
-
function renderContext(cwd) {
|
|
705
|
+
function renderContext(cwd, ruleRoots) {
|
|
665
706
|
const pkgRoot = packageRoot();
|
|
666
|
-
|
|
707
|
+
const vars = buildTemplateVars(pkgRoot, cwd, readBasaltConfig(cwd));
|
|
708
|
+
return { pkgRoot, vars: ruleRoots === void 0 ? vars : { ...vars, RULE_ROOTS: [...ruleRoots] } };
|
|
709
|
+
}
|
|
710
|
+
function ruleRootsFor(state) {
|
|
711
|
+
if (state.kind === "wrote") return state.roots;
|
|
712
|
+
return state.kind === "declared" && state.declared.length === 0 && state.unscanned.length > 0 ? state.unscanned : void 0;
|
|
667
713
|
}
|
|
668
714
|
function patchPackageJson(cwd, mutate) {
|
|
669
715
|
const abs = resolve(cwd, "package.json");
|
|
@@ -920,6 +966,8 @@ function run(argv, cwd = process.cwd()) {
|
|
|
920
966
|
return tokensCss(flags, cwd);
|
|
921
967
|
case "fonts:css":
|
|
922
968
|
return fontsCss(flags, cwd);
|
|
969
|
+
case "shot":
|
|
970
|
+
return shot(flags, cwd);
|
|
923
971
|
default:
|
|
924
972
|
console.error(
|
|
925
973
|
cmd === void 0 ? "basalt-ui: no command given.\n" : `basalt-ui: unknown command '${cmd}'.
|
|
@@ -987,6 +1035,7 @@ export {
|
|
|
987
1035
|
reconcileRoots,
|
|
988
1036
|
relativePosix,
|
|
989
1037
|
renderContext,
|
|
1038
|
+
renderRulePaths,
|
|
990
1039
|
reportPrune,
|
|
991
1040
|
resolveAppDir,
|
|
992
1041
|
resolveGuardConfig,
|
|
@@ -997,6 +1046,7 @@ export {
|
|
|
997
1046
|
routerSeedDest,
|
|
998
1047
|
routerSeedDests,
|
|
999
1048
|
routerSeedPlan,
|
|
1049
|
+
ruleRootsFor,
|
|
1000
1050
|
run,
|
|
1001
1051
|
sameFile,
|
|
1002
1052
|
scanBlock,
|
package/dist/cli/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAA;AA8D7D,yGAAyG;AACzG,wBAAgB,IAAI,CAAC,GAAG,GAAE,MAAsB,EAAE,aAAa,GAAE,aAAkB,GAAG,MAAM,CA0M3F"}
|
package/dist/cli/init.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
pruneRetiredManagedFiles,
|
|
18
18
|
readManifest,
|
|
19
19
|
reconcileRoots,
|
|
20
|
+
ruleRootsFor,
|
|
20
21
|
renderContext,
|
|
21
22
|
reportPrune,
|
|
22
23
|
resolvePlacement,
|
|
@@ -60,7 +61,11 @@ function init(cwd = process.cwd(), scaffoldFlags = {}) {
|
|
|
60
61
|
return 1;
|
|
61
62
|
}
|
|
62
63
|
const rootsState = reconcileRoots(cwd, { write: true });
|
|
63
|
-
const
|
|
64
|
+
const appSrc = resolvePlacement(cwd).appRel;
|
|
65
|
+
const ctx = renderContext(
|
|
66
|
+
cwd,
|
|
67
|
+
ruleRootsFor(rootsState) ?? (rootsState.kind === "undetectable" ? [`${appSrc ? `${appSrc}/` : ""}src`] : void 0)
|
|
68
|
+
);
|
|
64
69
|
const lintScript = `oxlint . && ${ctx.vars.BASALT_BIN} check-theme`;
|
|
65
70
|
const seededLintScript = patchPackageJson(cwd, (pkg) => {
|
|
66
71
|
const scripts = pkg["scripts"] ?? {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ShotMetrics, ShotRecord, ShotState } from './types.js';
|
|
2
|
+
/** An anchor's contact sheet: every state × scheme × viewport, labelled, on one standalone page. */
|
|
3
|
+
export declare function buildSheet(route: string, name: string, states: readonly ShotState[], shots: ShotRecord[]): string;
|
|
4
|
+
export declare function buildBoard(m: ShotMetrics): string;
|
|
5
|
+
//# sourceMappingURL=board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/board.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAwB,WAAW,EAAE,UAAU,EAAE,SAAS,EAAS,MAAM,SAAS,CAAA;AAsH9F,oGAAoG;AACpG,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,KAAK,EAAE,UAAU,EAAE,GAClB,MAAM,CAOR;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAgBjD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { PAGE_ANCHOR, SCHEMES, VIEWPORTS } from "./types.js";
|
|
2
|
+
const esc = (s) => s.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
3
|
+
const CSS = `
|
|
4
|
+
:root{color-scheme:light dark;--bg:#fff;--fg:#18181b;--mut:#71717a;--line:#d4d4d8;--bad:#b91c1c}
|
|
5
|
+
@media(prefers-color-scheme:dark){:root{--bg:#09090b;--fg:#fafafa;--mut:#a1a1aa;--line:#3f3f46;--bad:#f87171}}
|
|
6
|
+
body{margin:0;padding:24px;background:var(--bg);color:var(--fg);font:13px/1.45 system-ui,sans-serif}
|
|
7
|
+
h1,h2,h3,h4{margin:0 0 8px}h2{margin-top:40px;border-bottom:1px solid var(--line);padding-bottom:4px}
|
|
8
|
+
section{margin:24px 0}.row{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:24px;align-items:start}
|
|
9
|
+
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:16px}
|
|
10
|
+
figure{margin:0;border:1px solid var(--line);padding:6px;min-width:0}
|
|
11
|
+
figcaption,.mut{color:var(--mut);font-size:11px}img{max-width:100%;height:auto;display:block}
|
|
12
|
+
.empty{display:flex;align-items:center;justify-content:center;min-height:60px;color:var(--mut);border:1px dashed var(--line);text-align:center;padding:6px}
|
|
13
|
+
.empty.error{color:var(--bad);border-color:var(--bad)}
|
|
14
|
+
table{border-collapse:collapse;width:100%;font-size:12px}th,td{border:1px solid var(--line);padding:3px 6px;text-align:left;vertical-align:top}
|
|
15
|
+
.bad{color:var(--bad)}aside{position:sticky;top:12px}
|
|
16
|
+
`;
|
|
17
|
+
const sides = (s) => `${s.top} ${s.right} ${s.bottom} ${s.left}`;
|
|
18
|
+
const cell = (shot, label) => {
|
|
19
|
+
const caption = `<figcaption>${esc(label)}</figcaption>`;
|
|
20
|
+
if (!shot) return `<figure><div class="empty">not captured</div>${caption}</figure>`;
|
|
21
|
+
if (shot.status === "ok" && shot.file) {
|
|
22
|
+
const note2 = shot.note ? ` \xB7 ${esc(shot.note)}` : "";
|
|
23
|
+
return `<figure><img src="${esc(shot.file)}" loading="lazy" alt="${esc(`${shot.name} ${label}`)}"><figcaption>${esc(label)}${note2}</figcaption></figure>`;
|
|
24
|
+
}
|
|
25
|
+
const note = shot.note ? `: ${esc(shot.note)}` : "";
|
|
26
|
+
return `<figure><div class="empty ${shot.status}">${shot.status}${note}</div>${caption}</figure>`;
|
|
27
|
+
};
|
|
28
|
+
const metricsRow = (a) => {
|
|
29
|
+
const fails = a.contrast.failures.length;
|
|
30
|
+
return `<tr><td>${a.scheme}/${a.viewport}</td><td>${a.box.width}\xD7${a.box.height}</td><td>${sides(a.padding)}</td><td>${a.gap.row}/${a.gap.column}</td><td>${a.radius}</td><td>${a.borderWidth}</td><td>${a.fontSizes.join(", ")}</td><td>${a.emptyRatio}</td><td class="${fails ? "bad" : ""}">${a.contrast.min ?? "\u2013"} (${fails} fail)</td></tr>`;
|
|
31
|
+
};
|
|
32
|
+
const metricsTable = (rows) => {
|
|
33
|
+
if (rows.length === 0) return '<p class="mut">no metrics (the anchor never rendered)</p>';
|
|
34
|
+
const failures = rows.flatMap(
|
|
35
|
+
(a) => a.contrast.failures.map(
|
|
36
|
+
(f) => `<li>${a.scheme}/${a.viewport} \u201C${esc(f.text)}\u201D ${f.ratio} (${esc(f.fg)} on ${esc(f.bg)}, ${f.fontSize}px)</li>`
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
const assumed = rows.filter((a) => a.contrast.backdrop === "assumed-white").map((a) => `${a.scheme}/${a.viewport}`);
|
|
40
|
+
const nested = rows.filter((a) => a.nested.length > 0).map(
|
|
41
|
+
(a) => `<li>${a.scheme}/${a.viewport}<ul>${a.nested.map((n) => `<li>${esc(n.path)} r${n.radius} p ${sides(n.padding)}</li>`).join("")}</ul></li>`
|
|
42
|
+
);
|
|
43
|
+
return `<table><tr><th></th><th>box</th><th>padding</th><th>gap r/c</th><th>radius</th><th>border</th><th>font px</th><th>empty</th><th>contrast min</th></tr>${rows.map(metricsRow).join("")}</table>` + (assumed.length ? `<p class="bad">backdrop assumed white (no opaque ancestor background): ${assumed.join(", ")}</p>` : "") + (failures.length ? `<h4>Contrast failures</h4><ul class="bad">${failures.join("")}</ul>` : "") + (nested.length ? `<h4>Nested surfaces</h4><ul>${nested.join("")}</ul>` : "");
|
|
44
|
+
};
|
|
45
|
+
const grid = (shots, route, name, state) => {
|
|
46
|
+
const cells = VIEWPORTS.flatMap(
|
|
47
|
+
(viewport) => SCHEMES.map(
|
|
48
|
+
(scheme) => cell(
|
|
49
|
+
shots.find(
|
|
50
|
+
(s) => s.route === route && s.name === name && s.state === state && s.scheme === scheme && s.viewport === viewport
|
|
51
|
+
),
|
|
52
|
+
`${scheme} \xB7 ${viewport}`
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
return `<h4>${state}</h4><div class="grid">${cells.join("")}</div>`;
|
|
57
|
+
};
|
|
58
|
+
const anchorSection = (m, route, name) => `<section><h3>${esc(name)}</h3><div class="row"><div>${m.states.map((state) => grid(m.shots, route, name, state)).join("")}</div><aside>${metricsTable(
|
|
59
|
+
m.anchors.filter((a) => a.route === route && a.name === name)
|
|
60
|
+
)}</aside></div></section>`;
|
|
61
|
+
const stepList = (steps) => Object.entries(steps).map(([k, v]) => `${esc(k)} ${v}`).join(" \xB7 ") || "\u2013";
|
|
62
|
+
const scaleBlock = (scale) => {
|
|
63
|
+
if (scale.length === 0) return "";
|
|
64
|
+
const groups = /* @__PURE__ */ new Map();
|
|
65
|
+
for (const s of scale) {
|
|
66
|
+
const key = JSON.stringify([s.spacing, s.radius, s.fontSizes]);
|
|
67
|
+
const group = groups.get(key) ?? { scale: s, where: [] };
|
|
68
|
+
group.where.push(`${s.scheme}/${s.viewport}`);
|
|
69
|
+
groups.set(key, group);
|
|
70
|
+
}
|
|
71
|
+
const rows = [...groups.values()].map(
|
|
72
|
+
({ scale: s, where }) => `<tr><td>${where.join(", ")}</td><td>${stepList(s.spacing)}</td><td>${stepList(s.radius)}</td><td>${stepList(s.fontSizes)}</td></tr>`
|
|
73
|
+
);
|
|
74
|
+
return `<details open><summary>Theme scale (px)</summary><table><tr><th></th><th>spacing</th><th>radius</th><th>font size</th></tr>${rows.join("")}</table></details>`;
|
|
75
|
+
};
|
|
76
|
+
function buildSheet(route, name, states, shots) {
|
|
77
|
+
const body = states.map((state) => grid(shots, route, name, state)).join("");
|
|
78
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><style>${CSS}</style></head><body><h3>${esc(name)} <span class="mut">${esc(route)}</span></h3>${body}</body></html>`.replaceAll(' loading="lazy"', "");
|
|
79
|
+
}
|
|
80
|
+
function buildBoard(m) {
|
|
81
|
+
const sections = m.routes.map((route) => {
|
|
82
|
+
const names = [
|
|
83
|
+
...new Set(
|
|
84
|
+
m.shots.filter((s) => s.route === route && s.name !== PAGE_ANCHOR).map((s) => s.name)
|
|
85
|
+
)
|
|
86
|
+
];
|
|
87
|
+
const anchors = names.length ? names.map((name) => anchorSection(m, route, name)).join("") : '<p class="mut">no data-shot anchors on this route</p>';
|
|
88
|
+
return `<h2>${esc(route)}</h2><h3>full page</h3>${grid(m.shots, route, PAGE_ANCHOR, "rest")}${anchors}`;
|
|
89
|
+
});
|
|
90
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>basalt-ui shot</title><style>${CSS}</style></head><body><h1>basalt-ui shot</h1><p class="mut">${esc(m.base)} \xB7 ${esc(m.generatedAt)} \xB7 states: ${m.states.join(", ")}</p>${m.scaleError ? `<p class="bad">scale unavailable: ${esc(m.scaleError)}</p>` : ""}${scaleBlock(m.scale)}${sections.join("")}</body></html>
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
buildBoard,
|
|
95
|
+
buildSheet
|
|
96
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Box, PwBrowser, PwContext, PwLocator } from './playwright.js';
|
|
2
|
+
import type { AnchorMetrics, Measurement, Scale, Scheme, ShotRecord, ShotState, Viewport } from './types.js';
|
|
3
|
+
export type CaptureInput = {
|
|
4
|
+
browser: PwBrowser;
|
|
5
|
+
base: string;
|
|
6
|
+
routes: readonly string[];
|
|
7
|
+
states: readonly ShotState[];
|
|
8
|
+
pngDir: string;
|
|
9
|
+
/** Replaces the in-page measurer (tests). */
|
|
10
|
+
measure?: (anchor: PwLocator) => Promise<Measurement>;
|
|
11
|
+
log: (line: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/** `<route>-<hash>__<name>-<hash>__…`: the hash of the RAW text keeps `/a/b` and `/a-b` apart. */
|
|
14
|
+
export declare const fileName: (route: string, name: string, scheme: Scheme, viewport: Viewport, state: ShotState) => string;
|
|
15
|
+
/** The state URL: the query goes before any `#fragment`. */
|
|
16
|
+
export declare function withParam(route: string, state: ShotState): string;
|
|
17
|
+
/** The rect union of `boxes`, grown by `margin` and clamped to the viewport. */
|
|
18
|
+
export declare function unionClip(boxes: readonly Box[], margin: number, viewport: Viewport): Box;
|
|
19
|
+
/**
|
|
20
|
+
* Runs in the page: forgets the previous marks, then marks every tooltip that is visible now, so
|
|
21
|
+
* a tooltip another component already holds open is never taken for the one a trigger opens.
|
|
22
|
+
*/
|
|
23
|
+
export declare function markVisibleTooltips(): void;
|
|
24
|
+
/** Runs in the page: the first id a trigger names in `aria-describedby`, looking at it and its descendants. */
|
|
25
|
+
export declare function describedByOf(el: Element | null): string;
|
|
26
|
+
/** The tooltip the trigger names, else any that was not already visible at the snapshot. */
|
|
27
|
+
export declare const tooltipSelector: (describedBy: string) => string;
|
|
28
|
+
/**
|
|
29
|
+
* True when Tab can reach the anchor or something in it: a link, an enabled control, a `tabindex`
|
|
30
|
+
* ≥ 0 or editable host, outside any `hidden`/`inert` subtree, and actually rendered. Runs in the page, so it is
|
|
31
|
+
* self-contained.
|
|
32
|
+
*/
|
|
33
|
+
export declare function hasFocusTarget(root: Element): boolean;
|
|
34
|
+
type Steps = Pick<Scale, 'spacing' | 'radius' | 'fontSizes'>;
|
|
35
|
+
type ScaleRead = {
|
|
36
|
+
mantine: Steps;
|
|
37
|
+
vx: Record<string, number>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Runs in the page: Mantine's steps plus every `--vx-space-*`, `--vx-text-*` and `--vx-radius-*`
|
|
41
|
+
* custom property declared by ANY style rule (the root's and each component's own), resolved to px
|
|
42
|
+
* through a probe's `width` so `calc()`/`rem` read as the page sees them. Self-contained: it is
|
|
43
|
+
* serialised into the page.
|
|
44
|
+
*/
|
|
45
|
+
export declare function readScaleInPage(steps: string[]): ScaleRead;
|
|
46
|
+
/** Sorts the page's `--vx-*` readings into the three kinds; a step of 0 px (or an unresolvable one) is not a step. */
|
|
47
|
+
export declare function groupScale({ mantine, vx }: ScaleRead): Steps;
|
|
48
|
+
/** A fresh context for one scheme × viewport: the colour scheme is set on the context AND in storage before load. */
|
|
49
|
+
export declare function openContext<C extends PwContext>(browser: PwBrowser<C>, scheme: Scheme, viewport: Viewport): Promise<C>;
|
|
50
|
+
/** `<route>-<hash>__<name>-<hash>__sheet.png`: one contact sheet per anchor, beside its crops. */
|
|
51
|
+
export declare const sheetName: (route: string, name: string) => string;
|
|
52
|
+
export declare function capture(input: CaptureInput): Promise<{
|
|
53
|
+
anchors: AnchorMetrics[];
|
|
54
|
+
shots: ShotRecord[];
|
|
55
|
+
scale: Scale[];
|
|
56
|
+
scaleError?: string;
|
|
57
|
+
}>;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/capture.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAA;AAE7F,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,QAAQ,EACT,MAAM,SAAS,CAAA;AAWhB,M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