basalt-ui 2.27.2 → 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 +466 -307
- package/MIGRATING.md +358 -12
- package/agent/rules/basalt-batteries.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 +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- 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 +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- 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/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -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/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +34 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -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 +36 -6
- 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 +20 -12
- 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 +29 -11
- 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 +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- 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 +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -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 +8 -6
- 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 +12 -15
- 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 +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +69 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +55 -2
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +295 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- 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 +138 -16
- 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/empty-copy.ts +17 -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/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- 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 +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +55 -2
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -9,6 +9,24 @@ export type RefLabelPoint = {
|
|
|
9
9
|
fx: number;
|
|
10
10
|
y: number;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* A box another label has claimed in the same plot: a share of the plot width and a span of values
|
|
14
|
+
* on the left axis. A caption never takes a spot that overlaps one.
|
|
15
|
+
*/
|
|
16
|
+
export type LabelBox = {
|
|
17
|
+
fx0: number;
|
|
18
|
+
fx1: number;
|
|
19
|
+
y0: number;
|
|
20
|
+
y1: number;
|
|
21
|
+
};
|
|
22
|
+
/** The y range of the polyline `points` (sorted by `fx`) between `fx0` and `fx1`, or `null`. */
|
|
23
|
+
export declare function yRangeWithin(points: readonly RefLabelPoint[], fx0: number, fx1: number): [number, number] | null;
|
|
24
|
+
/**
|
|
25
|
+
* The `dy` that puts a caption's box clear of its line. The engine centres the text on its y and
|
|
26
|
+
* its line box is a little taller than the glyphs, so a full font size off the line leaves the
|
|
27
|
+
* box half a font size plus its leading clear (the old −5 put the centre ON the dashes).
|
|
28
|
+
*/
|
|
29
|
+
export declare function refLabelDy(position: RefLabelPosition, fontSize: number): number;
|
|
12
30
|
export declare function refLabelPosition(opts: {
|
|
13
31
|
/** `RefLine.labelPosition`: wins over everything. */
|
|
14
32
|
pinned: RefLabelPosition | undefined;
|
|
@@ -22,22 +40,33 @@ export declare function refLabelPosition(opts: {
|
|
|
22
40
|
fontSize: number;
|
|
23
41
|
/** One polyline per visible series on the line's axis. */
|
|
24
42
|
series: readonly (readonly RefLabelPoint[])[];
|
|
43
|
+
/** Labels already placed on this axis (end labels): a caption keeps clear of them too. */
|
|
44
|
+
claimed?: readonly LabelBox[] | undefined;
|
|
25
45
|
}): RefLabelPosition;
|
|
46
|
+
export type SparkLabelPlacement = {
|
|
47
|
+
side: 'above' | 'below';
|
|
48
|
+
end: 'start' | 'end';
|
|
49
|
+
/** The engine centres the text on its y: the offset that puts the box on `side` of the line. */
|
|
50
|
+
dy: number;
|
|
51
|
+
};
|
|
26
52
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
53
|
+
* Where a sparkline's reference label sits: of start-above, start-below, end-above, end-below, the
|
|
54
|
+
* one whose box stays inside the plot (`height` in full) and moves least off the reference to clear
|
|
55
|
+
* the data line by {@link SPARK_LINE_AIR} (the first of the four on a tie). The box clears the
|
|
56
|
+
* reference by at least {@link SPARK_LABEL_GAP}, so the dashed rule never strikes the text.
|
|
57
|
+
* `line` is the plotted polyline as `{ fx, y }` (a share of the plot width, a value on `domain`);
|
|
58
|
+
* without it (a bar sparkline, or no `width`/`label`) only the plot bounds decide.
|
|
31
59
|
*/
|
|
32
60
|
export declare function referenceLabelPlacement(opts: {
|
|
33
61
|
value: number;
|
|
34
62
|
domain: readonly [number, number];
|
|
35
63
|
height: number;
|
|
64
|
+
/** Plot width, px. */
|
|
65
|
+
width?: number | undefined;
|
|
36
66
|
/** The plot's margin inside the svg box, px. */
|
|
37
67
|
inset: number;
|
|
38
68
|
fontSize: number;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
69
|
+
label?: string | undefined;
|
|
70
|
+
line?: readonly RefLabelPoint[] | undefined;
|
|
71
|
+
}): SparkLabelPlacement;
|
|
43
72
|
//# sourceMappingURL=ref-label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-label.d.ts","sourceRoot":"","sources":["../../src/charts/ref-label.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,aAAa,CAAA;AAExF,sFAAsF;AACtF,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"ref-label.d.ts","sourceRoot":"","sources":["../../src/charts/ref-label.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,aAAa,CAAA;AAExF,sFAAsF;AACtF,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAQrD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAe3E,gGAAgG;AAChG,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAsBzB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,qDAAqD;IACrD,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACpC,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,MAAM,EAAE,SAAS,CAAC,SAAS,aAAa,EAAE,CAAC,EAAE,CAAA;IAC7C,0FAA0F;IAC1F,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,CAAA;CAC1C,GAAG,gBAAgB,CAkCnB;AAOD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAA;IACvB,GAAG,EAAE,OAAO,GAAG,KAAK,CAAA;IACpB,gGAAgG;IAChG,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,CAAA;CAC5C,GAAG,mBAAmB,CAsEtB"}
|
package/dist/charts/ref-label.js
CHANGED
|
@@ -34,8 +34,12 @@ function yRangeWithin(points, fx0, fx1) {
|
|
|
34
34
|
}
|
|
35
35
|
return lo <= hi ? [lo, hi] : null;
|
|
36
36
|
}
|
|
37
|
+
function refLabelDy(position, fontSize) {
|
|
38
|
+
return position.endsWith("above") ? -fontSize : fontSize;
|
|
39
|
+
}
|
|
37
40
|
function refLabelPosition(opts) {
|
|
38
41
|
const { pinned, startFirst, value, plotWidth, plotHeight, label, fontSize, series } = opts;
|
|
42
|
+
const { claimed = [] } = opts;
|
|
39
43
|
const order = startFirst ? ORDER_START : ORDER_END;
|
|
40
44
|
if (pinned !== void 0) return pinned;
|
|
41
45
|
const [lo, hi] = [Math.min(...opts.domain), Math.max(...opts.domain)];
|
|
@@ -54,22 +58,63 @@ function refLabelPosition(opts) {
|
|
|
54
58
|
return series.every((points) => {
|
|
55
59
|
const range = yRangeWithin(points, fx0, fx1);
|
|
56
60
|
return range === null || range[1] < from || range[0] > to;
|
|
57
|
-
});
|
|
61
|
+
}) && claimed.every((b) => b.fx1 < fx0 || b.fx0 > fx1 || b.y1 < from || b.y0 > to);
|
|
58
62
|
};
|
|
59
63
|
return order.find((p) => inPlot(p) && clear(p)) ?? order.find(inPlot) ?? order[0];
|
|
60
64
|
}
|
|
61
|
-
const SPARK_LABEL_GAP =
|
|
65
|
+
const SPARK_LABEL_GAP = 4;
|
|
66
|
+
const SPARK_LINE_AIR = 5;
|
|
62
67
|
function referenceLabelPlacement(opts) {
|
|
63
|
-
const { value, domain, height, inset, fontSize } = opts;
|
|
68
|
+
const { value, domain, height, inset, fontSize, line } = opts;
|
|
69
|
+
const { width = 0, label = "" } = opts;
|
|
64
70
|
const [lo, hi] = [Math.min(...domain), Math.max(...domain)];
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
+
const plotH = height - 2 * inset;
|
|
72
|
+
const plotW = width - 2 * inset;
|
|
73
|
+
const px = (y) => inset + plotH * (1 - (hi === lo ? 0 : (y - lo) / (hi - lo)));
|
|
74
|
+
const at = px(value);
|
|
75
|
+
const boxH = fontSize;
|
|
76
|
+
const boxW = label.length * fontSize * GLYPH_EM + EDGE_INSET;
|
|
77
|
+
const pxLine = line?.map((p) => ({ fx: p.fx, y: px(p.y) }));
|
|
78
|
+
const candidates = ["start", "end"].flatMap(
|
|
79
|
+
(end2) => ["above", "below"].map((side2) => {
|
|
80
|
+
const nominal = side2 === "above" ? at - SPARK_LABEL_GAP - boxH : at + SPARK_LABEL_GAP;
|
|
81
|
+
const [fx0, fx1] = end2 === "start" ? [0, boxW / plotW] : [1 - boxW / plotW, 1];
|
|
82
|
+
const lead = pxLine?.find((p) => p.fx >= fx1)?.fx ?? fx1;
|
|
83
|
+
const trail = pxLine?.findLast((p) => p.fx <= fx0)?.fx ?? fx0;
|
|
84
|
+
const range = pxLine === void 0 || plotW <= 0 ? null : yRangeWithin(pxLine, Math.min(trail, fx0), Math.max(lead, fx1));
|
|
85
|
+
const near = range !== null && range[1] + SPARK_LINE_AIR > nominal && range[0] - SPARK_LINE_AIR < nominal + boxH;
|
|
86
|
+
const top2 = !near ? nominal : side2 === "above" ? range[0] - SPARK_LINE_AIR - boxH : range[1] + SPARK_LINE_AIR;
|
|
87
|
+
return {
|
|
88
|
+
side: side2,
|
|
89
|
+
end: end2,
|
|
90
|
+
top: top2,
|
|
91
|
+
range,
|
|
92
|
+
shift: Math.abs(top2 - nominal),
|
|
93
|
+
fits: top2 >= 0 && top2 + boxH <= height
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
const scored = candidates.map((c) => {
|
|
98
|
+
const top2 = Math.max(0, Math.min(c.top, height - boxH));
|
|
99
|
+
const covered = c.range === null ? 0 : Math.max(0, Math.min(top2 + boxH, c.range[1]) - Math.max(top2, c.range[0]));
|
|
100
|
+
return { ...c, top: top2, strikesRule: top2 < at && top2 + boxH > at, covered };
|
|
101
|
+
});
|
|
102
|
+
const nearer = (c, best) => c.shift < best.shift;
|
|
103
|
+
const better = (c, best) => c.strikesRule === best.strikesRule ? c.covered < best.covered : best.strikesRule;
|
|
104
|
+
const pick = (spots, beats) => spots.reduce(
|
|
105
|
+
(best, c) => best === void 0 || beats(c, best) ? c : best,
|
|
106
|
+
void 0
|
|
107
|
+
);
|
|
108
|
+
const { side, end, top } = pick(
|
|
109
|
+
scored.filter((c) => c.fits),
|
|
110
|
+
nearer
|
|
111
|
+
) ?? pick(scored, better);
|
|
112
|
+
const dy = top + boxH / 2 - at;
|
|
113
|
+
return { side, end, dy };
|
|
71
114
|
}
|
|
72
115
|
export {
|
|
116
|
+
refLabelDy,
|
|
73
117
|
refLabelPosition,
|
|
74
|
-
referenceLabelPlacement
|
|
118
|
+
referenceLabelPlacement,
|
|
119
|
+
yRangeWithin
|
|
75
120
|
};
|
|
@@ -114,3 +114,53 @@
|
|
|
114
114
|
border-radius: 50%;
|
|
115
115
|
transform: translate(-50%, -50%);
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
/* The reference caption steps aside while a readout shows: the chip can land on it (a long caption
|
|
119
|
+
* reaches the chip's line), and the readout is what the pointer asked for. */
|
|
120
|
+
.root[data-basalt-readout] [data-ts-key='reference-label'] {
|
|
121
|
+
visibility: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* The window caption under a hosted plot: the span on the start edge, the reference's key on the end. */
|
|
125
|
+
.frame {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* The plot keeps its stated height whatever box the frame sits in. */
|
|
132
|
+
.frame > :first-child {
|
|
133
|
+
flex: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.caption {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: baseline;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
/* The key keeps a word's air from the span and drops to its own line when the two cannot share one
|
|
141
|
+
* (a ~160px cell at 390), rather than touching it. */
|
|
142
|
+
flex-wrap: wrap;
|
|
143
|
+
column-gap: var(--vx-space-stack-lg, 1rem);
|
|
144
|
+
margin-block-start: var(--vx-space-stack-xs, 0.25rem);
|
|
145
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
146
|
+
font-variant-numeric: lining-nums;
|
|
147
|
+
font-size: var(--vx-text-micro);
|
|
148
|
+
line-height: 1.25;
|
|
149
|
+
color: var(--vx-muted);
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* The reference's key follows the drawn line: a short dash, then its name. */
|
|
154
|
+
.key {
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
column-gap: var(--vx-space-stack-xs, 0.25rem);
|
|
158
|
+
margin-inline-start: auto;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.key::before {
|
|
162
|
+
content: '';
|
|
163
|
+
inline-size: 0.75rem;
|
|
164
|
+
block-size: 1px;
|
|
165
|
+
background: repeating-linear-gradient(to right, var(--vx-line) 0 3px, transparent 3px 5px);
|
|
166
|
+
}
|
package/dist/charts/state.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ import type { ChartState } from './types.js';
|
|
|
8
8
|
export type ResolvedChartState = 'pending' | 'error' | 'empty' | null;
|
|
9
9
|
export declare function resolveChartState(state: ChartState | undefined): ResolvedChartState;
|
|
10
10
|
/**
|
|
11
|
-
* The shape a pending plot draws: `'bars'` (default), `'line'` for a line or area chart,
|
|
12
|
-
* count when the loaded chart's data length is known (a 6-month chart loads 6 bars).
|
|
11
|
+
* The shape a pending plot draws: `'bars'` (default), `'line'` for a line or area chart, `'band'`
|
|
12
|
+
* for a `BandStrip` (one row), or a bar count when the loaded chart's data length is known (a 6-month chart loads 6 bars).
|
|
13
13
|
*/
|
|
14
|
-
export type PlotGhostShape = 'bars' | 'line' | number;
|
|
14
|
+
export type PlotGhostShape = 'bars' | 'line' | 'band' | number;
|
|
15
15
|
/** Fills the same {@link ChartBox} the chart will, so a pending, failed or empty chart (and a
|
|
16
16
|
* `<Suspense>` fallback built from one) occupies the final chart's height. */
|
|
17
17
|
export declare function ChartPlaceholder(props: {
|
|
@@ -28,7 +28,7 @@ export declare function ChartPlaceholder(props: {
|
|
|
28
28
|
/** For a box too small to hold a sentence (a sparkline): error and empty show a `—` and carry the
|
|
29
29
|
* label as the accessible name and the hover title. */
|
|
30
30
|
compact?: boolean;
|
|
31
|
-
/** Error only: what failed to load, "Could not load {noun}". Default:
|
|
31
|
+
/** Error only: what failed to load, "Could not load {noun}" (see `couldNotLoad`). Default: bare. */
|
|
32
32
|
noun?: string;
|
|
33
33
|
/** Pending only: the ghost's shape. Default `'bars'`. */
|
|
34
34
|
ghost?: PlotGhostShape;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/charts/state.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/charts/state.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAA;AAErE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,kBAAkB,CAMnF;AAsBD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AA4E9D;8EAC8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;IAC7B;0GACsG;IACtG,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACnC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;2DACuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB,GAAG,YAAY,GAAG,IAAI,CAiFtB"}
|
package/dist/charts/state.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { splitEmptyCopy } from "../common/empty-copy.js";
|
|
3
|
+
import { couldNotLoad } from "../common/could-not-load.js";
|
|
2
4
|
import { toErrorMessage } from "../common/errors.js";
|
|
3
5
|
import { RetryButton } from "../common/retry-button.js";
|
|
4
6
|
import { VX } from "../tokens/index.js";
|
|
@@ -31,6 +33,8 @@ const GHOST_LINE = "0,30 12,26 25,28 38,18 50,22 62,12 75,16 88,8 100,12";
|
|
|
31
33
|
function PlotGhost({ shape = "bars" }) {
|
|
32
34
|
if (shape === "line")
|
|
33
35
|
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-basalt-plot-ghost": "line", className: boxClasses.ghost, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 100 40", preserveAspectRatio: "none", className: boxClasses.ghostLine, children: /* @__PURE__ */ jsx("polyline", { points: GHOST_LINE, vectorEffect: "non-scaling-stroke" }) }) });
|
|
36
|
+
if (shape === "band")
|
|
37
|
+
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-basalt-plot-ghost": "band", className: boxClasses.ghost, children: /* @__PURE__ */ jsx("span", { className: boxClasses.ghostBand }) });
|
|
34
38
|
const count = typeof shape === "number" ? Math.max(1, Math.min(Math.floor(shape), 60)) : GHOST_BARS.length;
|
|
35
39
|
return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-basalt-plot-ghost": "bars", className: boxClasses.ghost, children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx(
|
|
36
40
|
"span",
|
|
@@ -59,6 +63,10 @@ const errorStyle = {
|
|
|
59
63
|
fontSize: VX.text.sm,
|
|
60
64
|
gap: VX.space.controlGap
|
|
61
65
|
};
|
|
66
|
+
const tileStyle = {
|
|
67
|
+
// theme-allow surface-shadow-override — an inset ring on a tile inside a surface, not a card's depth
|
|
68
|
+
boxShadow: `var(--basalt-state-ring, inset 0 0 0 1px ${VX.surface.hairline})`
|
|
69
|
+
};
|
|
62
70
|
const errorHeadStyle = {
|
|
63
71
|
display: "inline-flex",
|
|
64
72
|
alignItems: "center",
|
|
@@ -67,7 +75,7 @@ const errorHeadStyle = {
|
|
|
67
75
|
fontWeight: 500
|
|
68
76
|
};
|
|
69
77
|
const errorMessageStyle = { color: VX.muted };
|
|
70
|
-
const emptyLabel = (state) => typeof state?.empty === "string" ? state.empty : "Nothing
|
|
78
|
+
const emptyLabel = (state) => typeof state?.empty === "string" ? state.empty : "Nothing plotted in this range.";
|
|
71
79
|
function ChartPlaceholder(props) {
|
|
72
80
|
const kind = resolveChartState(props.state);
|
|
73
81
|
if (kind === null) return null;
|
|
@@ -83,14 +91,13 @@ function ChartPlaceholder(props) {
|
|
|
83
91
|
);
|
|
84
92
|
if (kind === "pending")
|
|
85
93
|
return fit(
|
|
86
|
-
/* @__PURE__ */ jsx("output", { "aria-label": "Loading chart", "aria-busy": "true", className: stateClass, style, children:
|
|
94
|
+
/* @__PURE__ */ jsx("output", { "aria-label": "Loading chart", "aria-busy": "true", className: stateClass, style, children: /* @__PURE__ */ jsx(PlotGhost, { shape: props.ghost ?? (props.compact ? "line" : "bars") }) })
|
|
87
95
|
);
|
|
88
96
|
const label = kind === "error" ? toErrorMessage(props.state?.error, "The request failed.") : emptyLabel(props.state);
|
|
89
97
|
const body = props.compact ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2014" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
90
98
|
kind === "error" && /* @__PURE__ */ jsxs("span", { style: errorHeadStyle, children: [
|
|
91
99
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", "data-basalt-status-dot": "", style: dotStyle }),
|
|
92
|
-
|
|
93
|
-
props.noun === void 0 ? "" : ` ${props.noun}`
|
|
100
|
+
couldNotLoad(props.noun)
|
|
94
101
|
] }),
|
|
95
102
|
/* @__PURE__ */ jsx("span", { style: errorMessageStyle, children: label }),
|
|
96
103
|
kind === "error" && props.onRetry !== void 0 && /* @__PURE__ */ jsx(RetryButton, { onClick: props.onRetry, retrying: props.retrying ?? false }),
|
|
@@ -111,8 +118,19 @@ function ChartPlaceholder(props) {
|
|
|
111
118
|
}
|
|
112
119
|
)
|
|
113
120
|
);
|
|
121
|
+
if (props.compact)
|
|
122
|
+
return fit(
|
|
123
|
+
/* @__PURE__ */ jsx("output", { "data-basalt-chart-state": kind, className: stateClass, style, ...name, children: body })
|
|
124
|
+
);
|
|
125
|
+
const { title, description } = splitEmptyCopy(label);
|
|
114
126
|
return fit(
|
|
115
|
-
/* @__PURE__ */ jsx("
|
|
127
|
+
/* @__PURE__ */ jsx("div", { "data-basalt-chart-state": kind, className: stateClass, style: boxStyle, children: /* @__PURE__ */ jsxs("div", { "data-basalt-empty-tile": "", className: boxClasses.emptyTile, style: tileStyle, children: [
|
|
128
|
+
/* @__PURE__ */ jsxs("output", { className: boxClasses.emptyCopy, children: [
|
|
129
|
+
/* @__PURE__ */ jsx("span", { className: boxClasses.emptyTitle, children: title }),
|
|
130
|
+
description !== void 0 && /* @__PURE__ */ jsx("span", { className: boxClasses.emptyText, children: description })
|
|
131
|
+
] }),
|
|
132
|
+
props.action !== void 0 && /* @__PURE__ */ jsx("div", { children: props.action })
|
|
133
|
+
] }) })
|
|
116
134
|
);
|
|
117
135
|
}
|
|
118
136
|
export {
|
|
@@ -72,4 +72,15 @@ export declare const SUBPATH_REQUIRED_PEERS: Readonly<Record<string, readonly st
|
|
|
72
72
|
* missing one still builds, then throws "Could not resolve" when the chunk loads.
|
|
73
73
|
*/
|
|
74
74
|
export declare function subpathPeersCheck(cwd: string, scanned: string[], install: BasaltInstall): Check;
|
|
75
|
+
/** Emitted `tokens:css` / `fonts:css` sheets from another version; the header names the re-emit command. */
|
|
76
|
+
export declare function staleEmittedSheets(cwd: string, files: readonly string[], installedVersion: string | null): string[];
|
|
77
|
+
/** `a` versus `b` as dotted numbers: negative when `a` is older. */
|
|
78
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
79
|
+
/**
|
|
80
|
+
* The consumer-visible lines of every MIGRATING.md section with `from < version <= to` (`to`
|
|
81
|
+
* null: no upper bound), newest first as the file is ordered: lines naming a `basalt/*` rule id, a
|
|
82
|
+
* `--vx-*` token, `error` or `promoted`, plus the whole `Visible without code change` subsection.
|
|
83
|
+
* Fenced code and table separators are skipped; only long table rows are cut, never a bullet.
|
|
84
|
+
*/
|
|
85
|
+
export declare function migratingSince(markdown: string, from: string, to: string | null): string[];
|
|
75
86
|
//# sourceMappingURL=doctor-upgrade.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-upgrade.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAkBrD,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AA6B9D,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,MACc,CAAA;AA+CvD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAqBpD;AA+CD,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsBhF;AA2DD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,aAAa,GACrB,KAAK,CAyBP;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAUnD;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC9D;AAGD,eAAO,MAAM,iBAAiB,QAG+I,CAAA;AA4G7K;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAUzD;AAID;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,GAChB;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAS7C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CA8BjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAczD;AAkBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAgB1E;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAQ9E,CAAA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsB/F"}
|
|
1
|
+
{"version":3,"file":"doctor-upgrade.d.ts","sourceRoot":"","sources":["../../src/cli/doctor-upgrade.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAkBrD,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AA6B9D,wEAAwE;AACxE,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,MACc,CAAA;AA+CvD,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAqBpD;AA+CD,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsBhF;AA2DD,mGAAmG;AACnG,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,aAAa,GACrB,KAAK,CAyBP;AAiBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAUnD;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkC9D;AAGD,eAAO,MAAM,iBAAiB,QAG+I,CAAA;AA4G7K;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAUzD;AAID;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,YAAY,GAChB;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAS7C;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CA8BjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAczD;AAkBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAgB1E;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAQ9E,CAAA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAsB/F;AAED,4GAA4G;AAC5G,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,MAAM,EAAE,CAgBV;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAKD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CA8B1F"}
|
|
@@ -437,16 +437,70 @@ function subpathPeersCheck(cwd, scanned, install) {
|
|
|
437
437
|
};
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
+
function staleEmittedSheets(cwd, files, installedVersion2) {
|
|
441
|
+
if (installedVersion2 === null) return [];
|
|
442
|
+
const out = [];
|
|
443
|
+
for (const rel of files) {
|
|
444
|
+
if (!rel.endsWith(".css")) continue;
|
|
445
|
+
const provenance = (readIfExists(resolve(cwd, rel)) ?? "").split("\n")[1]?.trim() ?? "";
|
|
446
|
+
const m = /^\/\* basalt-ui (\S+) — `(basalt-ui (?:tokens|fonts):css[^`]*)` \*\/$/.exec(
|
|
447
|
+
provenance
|
|
448
|
+
);
|
|
449
|
+
if (m === null || m[1] === installedVersion2) continue;
|
|
450
|
+
out.push(
|
|
451
|
+
`emitted-sheets: ${rel} was emitted by ${m[1]}, installed is ${installedVersion2} \u2014 \`--check\` fails until it is re-emitted. Fix: \`${m[2]}\``
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
return out;
|
|
455
|
+
}
|
|
456
|
+
function compareVersions(a, b) {
|
|
457
|
+
const y = b.split(".").map(Number);
|
|
458
|
+
return a.split(".").map((n, i) => Number(n) - (y[i] ?? 0)).find((d) => d !== 0) ?? 0;
|
|
459
|
+
}
|
|
460
|
+
const VISIBLE_HEADING = /^#{2,4}\s+Visible without code change/i;
|
|
461
|
+
const CONSUMER_VISIBLE = /basalt\/[a-z][\w-]*|--vx-[\w-]+|\berror\b|\bpromoted?\b/i;
|
|
462
|
+
function migratingSince(markdown, from, to) {
|
|
463
|
+
const out = [];
|
|
464
|
+
let version = null;
|
|
465
|
+
let visible = false;
|
|
466
|
+
let fenced = false;
|
|
467
|
+
for (const line of markdown.split("\n")) {
|
|
468
|
+
const h2 = /^## (\d+\.\d+\.\d+)\b(.*)$/.exec(line);
|
|
469
|
+
if (h2 !== null || line.startsWith("## ")) {
|
|
470
|
+
const v = h2?.[1] ?? null;
|
|
471
|
+
version = v !== null && compareVersions(v, from) > 0 && (to === null || compareVersions(v, to) <= 0) ? v : null;
|
|
472
|
+
visible = false;
|
|
473
|
+
fenced = false;
|
|
474
|
+
if (version !== null) out.push(`
|
|
475
|
+
## ${version}${h2?.[2] ?? ""}`);
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
if (version === null) continue;
|
|
479
|
+
if (line.startsWith("```")) fenced = !fenced;
|
|
480
|
+
if (fenced || line.startsWith("```")) continue;
|
|
481
|
+
if (/^#{3,4}\s/.test(line)) visible = VISIBLE_HEADING.test(line);
|
|
482
|
+
const trimmed = line.trim();
|
|
483
|
+
if (trimmed === "" || /^\|[-\s|:]+\|$/.test(trimmed)) continue;
|
|
484
|
+
if (!visible && !CONSUMER_VISIBLE.test(line)) continue;
|
|
485
|
+
out.push(
|
|
486
|
+
trimmed.startsWith("|") && trimmed.length > 240 ? `${trimmed.slice(0, 240)}\u2026` : trimmed
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
return out;
|
|
490
|
+
}
|
|
440
491
|
export {
|
|
441
492
|
ROUTER_PLUGIN_FIX,
|
|
442
493
|
SUBPATH_REQUIRED_PEERS,
|
|
443
494
|
appWiringCheck,
|
|
495
|
+
compareVersions,
|
|
444
496
|
droppedSubpathsCheck,
|
|
445
497
|
exactPeersCheck,
|
|
498
|
+
migratingSince,
|
|
446
499
|
oxlintFloorCheck,
|
|
447
500
|
retiredLintRulesCheck,
|
|
448
501
|
seedTsconfigExtends,
|
|
449
502
|
shellDeclarationFindings,
|
|
503
|
+
staleEmittedSheets,
|
|
450
504
|
startWiringWarnings,
|
|
451
505
|
subpathPeersCheck,
|
|
452
506
|
tsconfigBaseCheck,
|
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":"AAoCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AA+BzD,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;AAqDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,aAAa,GAAE,MAAsB,EACrC,KAAK,GAAE,MAAM,EAAO,EACpB,UAAU,GAAE,gBAAqB,GAChC,MAAM,CAyUR"}
|
package/dist/cli/doctor.js
CHANGED
|
@@ -34,8 +34,11 @@ import {
|
|
|
34
34
|
appWiringCheck,
|
|
35
35
|
shellDeclarationFindings,
|
|
36
36
|
startWiringWarnings,
|
|
37
|
+
compareVersions,
|
|
37
38
|
droppedSubpathsCheck,
|
|
38
39
|
exactPeersCheck,
|
|
40
|
+
migratingSince,
|
|
41
|
+
staleEmittedSheets,
|
|
39
42
|
oxlintFloorCheck,
|
|
40
43
|
retiredLintRulesCheck,
|
|
41
44
|
subpathPeersCheck,
|
|
@@ -66,8 +69,36 @@ function aiMajorsAt(dir) {
|
|
|
66
69
|
}
|
|
67
70
|
return out;
|
|
68
71
|
}
|
|
72
|
+
function doctorFrom(invocationCwd, from) {
|
|
73
|
+
if (from === void 0 || !/^\d+\.\d+\.\d+$/.test(from)) {
|
|
74
|
+
console.error("basalt-ui doctor --from <x.y.z>: the version you are upgrading from.");
|
|
75
|
+
return 1;
|
|
76
|
+
}
|
|
77
|
+
const install = findBasaltInstall(resolveProjectDir(invocationCwd).dir);
|
|
78
|
+
const markdown = install.dir === null ? null : readIfExists(resolve(install.dir, "MIGRATING.md"));
|
|
79
|
+
if (markdown === null) {
|
|
80
|
+
console.error("basalt-ui doctor --from: no installed basalt-ui. Fix: `bun add basalt-ui`.");
|
|
81
|
+
return 1;
|
|
82
|
+
}
|
|
83
|
+
if (install.version !== null && compareVersions(from, install.version) > 0) {
|
|
84
|
+
console.error(`basalt-ui doctor --from ${from}: newer than the installed ${install.version}.`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
const lines = migratingSince(markdown, from, install.version);
|
|
88
|
+
const span = `after ${from} up to ${install.version ?? "the install"}`;
|
|
89
|
+
console.log(
|
|
90
|
+
lines.length === 0 ? `No consumer-visible changes recorded ${span}.` : `Consumer-visible changes ${span} (full text: MIGRATING.md):
|
|
91
|
+
${lines.join("\n")}`
|
|
92
|
+
);
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
69
95
|
function doctor(invocationCwd = process.cwd(), flags = [], designLoop = {}) {
|
|
70
96
|
if (conflictingProfileFlags("doctor", flags)) return 1;
|
|
97
|
+
const fromAt = flags.findIndex((f) => f === "--from" || f.startsWith("--from="));
|
|
98
|
+
if (fromAt !== -1) {
|
|
99
|
+
const flag = flags[fromAt];
|
|
100
|
+
return doctorFrom(invocationCwd, flag.startsWith("--from=") ? flag.slice(7) : flags[fromAt + 1]);
|
|
101
|
+
}
|
|
71
102
|
const project = resolveProjectDir(invocationCwd);
|
|
72
103
|
const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null;
|
|
73
104
|
const insideApp = aboveRoot !== null;
|
|
@@ -295,6 +326,7 @@ basalt-ui doctor \u2014 ${cwd}
|
|
|
295
326
|
if (shell.fail !== null) fail(shell.fail);
|
|
296
327
|
for (const line of shell.warnings) warn(line);
|
|
297
328
|
}
|
|
329
|
+
for (const line of staleEmittedSheets(cwd, scannableFiles(cwd, cfg), install.version)) warn(line);
|
|
298
330
|
if (profile !== "tokens-only") lines.push(...designLoopLines(cwd, resolveRoots(cfg), designLoop));
|
|
299
331
|
lines.push("");
|
|
300
332
|
if (result.hardFailures === 0 && result.warnings === 0 && result.skipped === 0) {
|
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,CAClC,MAAM,EACN,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,MAAM,EACN,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAkDnE,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,QAwE0E,CAAA"}
|
package/dist/cli/help.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
const COMMAND_OPTIONS = {
|
|
3
3
|
init: {
|
|
4
|
-
"no-merge-lint": { type: "boolean" }
|
|
4
|
+
"no-merge-lint": { type: "boolean" },
|
|
5
|
+
"no-install": { type: "boolean" }
|
|
5
6
|
},
|
|
6
7
|
sync: {
|
|
7
8
|
force: { type: "boolean" },
|
|
@@ -15,7 +16,11 @@ const COMMAND_OPTIONS = {
|
|
|
15
16
|
"tokens-only": { type: "boolean" },
|
|
16
17
|
framework: { type: "boolean" }
|
|
17
18
|
},
|
|
18
|
-
doctor: {
|
|
19
|
+
doctor: {
|
|
20
|
+
"tokens-only": { type: "boolean" },
|
|
21
|
+
framework: { type: "boolean" },
|
|
22
|
+
from: { type: "string" }
|
|
23
|
+
},
|
|
19
24
|
"guard-hook": {},
|
|
20
25
|
"tokens:css": {
|
|
21
26
|
out: { type: "string" },
|
|
@@ -56,7 +61,7 @@ function unknownFlag(cmd, flags) {
|
|
|
56
61
|
return match?.[1] ?? flags.find((f) => f.startsWith("-")) ?? flags[0] ?? null;
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
|
-
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> | shot detect | 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 A real, signed-in app: [--local-storage <key>=<@env:NAME|@file:path>]\u2026 seeds localStorage (app origin\n only) before any page script; [--api <prefix>=<origin>]\u2026 (with --dist) proxies GET/HEAD under that\n prefix to the origin (other methods get 405 unless --api-allow-writes); [--header <name>=@env:NAME]\u2026 is\n added to every proxied request, to EVERY --api origin (never on a navigation; https required);\n [--wait <ms|networkidle>] adds ms of settle AFTER networkidle (default none); [--auto-anchors] crops\n each Card, Paper and table over 120\xD760 px on a page with no data-shot. Values are never printed or\n written; a redirect, 401/403/404, 5xx or dead API fails every shot of that page. Shots of real data go to the\n reviewer subagent and so to its model provider: point --api at staging or synthetic data when the\n app holds other people\'s data. Example:\n basalt-ui shot /overview --dist dist --api /api=https://app.example.com \\\n --local-storage auth-token=@env:APP_TOKEN --header authorization=@env:APP_BEARER --auto-anchors\n\nshot detect [--out <dir>] [--lint <oxlint-json-file>]\n The deterministic second review pass, no browser and no model: reads <out>/metrics.json (default: the\n out dir in .basalt/shots/last.json) and, with --lint, the basalt/* diagnostics of `oxlint --format json`\n output saved to a file. Writes <out>/detect.json and a findings table, content, then layout, then style:\n off-scale inset/gap/radius, nested radius step under 3 px, more than 3 font sizes, an empty region of\n 40 % or more, contrast failures, error shots, a missing scale or no anchors.\n Exit codes: 0 clean (P2/P3 findings are listed, not failing), 2 a P0 or P1 finding, 1 scan failure (missing\n or unreadable metrics.json or lint file, or detect.json/history.json cannot be written).\n P0 fails: broken, unreadable or a contrast failure; an error shot; no anchors\n P1 fails: a rubric item fails (off-scale value, font sizes, empty region, nested radius, lint error)\n P2 noted, not failing: degraded: a lint warning, a contrast measured on an assumed white backdrop\n P3 noted, not failing: polish: an off-scale value within 1 px of a step\n score = 100 - (25 per P0 + 10 per P1 + 3 per P2 + 1 per P3), floored at 0. Each run appends\n {at, out, commit, counts, score} to .basalt/shots/history.json and prints the last 5 scores as a trend.\n A component can declare a rest anchor absent in a URL state with data-shot-absent="empty error": that\n cell is recorded `absent`, not `error`.\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.';
|
|
64
|
+
const USAGE = 'Usage: basalt-ui <--version | init [--no-merge-lint] [--no-install] |\n sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n check-theme [--audit-allows] |\n doctor [--tokens-only|--framework|--from <x.y.z>] | guard-hook | tokens:css | fonts:css |\n shot <route\u2026> | shot detect | 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 --out must resolve inside the project (the app dir in a monorepo, not the repo root); routes are\n separate arguments (zsh does not word-split $ROUTES).\n Default --out .basalt/shots (emptied each run); .basalt/shots/last.json names the last out dir.\n A real, signed-in app: [--local-storage <key>=<@env:NAME|@file:path>]\u2026 seeds localStorage (app origin\n only) before any page script; [--api <prefix>=<origin>]\u2026 (with --dist) proxies GET/HEAD under that\n prefix to the origin (other methods get 405 unless --api-allow-writes); [--header <name>=@env:NAME]\u2026 is\n added to every proxied request, to EVERY --api origin (never on a navigation; https required);\n [--wait <ms|networkidle>] adds ms of settle AFTER networkidle (default none); [--auto-anchors] crops\n each Card, Paper and table over 120\xD760 px (else main, section, header, form) on a page with no data-shot. Values are never printed or\n written; a redirect, 401/403/404, 5xx or dead API fails every shot of that page. Shots of real data go to the\n reviewer subagent and so to its model provider: point --api at staging or synthetic data when the\n app holds other people\'s data. Example:\n basalt-ui shot /overview --dist dist --api /api=https://app.example.com \\\n --local-storage auth-token=@env:APP_TOKEN --header authorization=@env:APP_BEARER --auto-anchors\n\nshot detect [--out <dir>] [--lint <oxlint-json-file>]\n The deterministic second review pass, no browser and no model: reads <out>/metrics.json (default: the\n out dir in .basalt/shots/last.json) and, with --lint, the basalt/* diagnostics of `oxlint --format json`\n output saved to a file. Writes <out>/detect.json and a findings table, content, then layout, then style:\n off-scale inset/gap/radius, nested radius step under 3 px, more than 3 font sizes, an empty region of\n 40 % or more, contrast failures, error shots, a missing scale or no anchors.\n Exit codes: 0 clean (P2/P3 findings are listed, not failing), 2 a P0 or P1 finding, 1 scan failure (missing\n or unreadable metrics.json or lint file, or detect.json/history.json cannot be written).\n P0 fails: broken, unreadable or a contrast failure; an error shot; no anchors\n P1 fails: a rubric item fails (off-scale value, font sizes, empty region, nested radius, lint error)\n P2 noted, not failing: degraded: a lint warning, a contrast measured on an assumed white backdrop\n P3 noted, not failing: polish: an off-scale value within 1 px of a step\n score = 100 - (25 per P0 + 10 per P1 + 3 per P2 + 1 per P3), floored at 0. Each run appends\n {at, out, commit, counts, score} to .basalt/shots/history.json and prints the last 5 scores of THAT --out dir as a trend\n with the finding count beside each (the score floors at 0). No anchor measured: "nothing measured", no score.\n detect takes --out <dir>, never a positional.\n A component can declare a rest anchor absent in a URL state with data-shot-absent="empty error": that\n cell is recorded `absent`, not `error`.\n\ndoctor [--tokens-only|--framework] [--from <x.y.z>]\n doctor --from <x.y.z> print the consumer-visible MIGRATING changes since that version\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.';
|
|
60
65
|
export {
|
|
61
66
|
COMMAND_OPTIONS,
|
|
62
67
|
USAGE,
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -163,6 +163,8 @@ export declare function readFrameworkVersion(pkgRoot: string): string;
|
|
|
163
163
|
* cached package, so it lets a consumer pin one version and be gated by another).
|
|
164
164
|
*/
|
|
165
165
|
export declare function basaltBinCommand(install: BasaltInstall, cwd: string): string;
|
|
166
|
+
/** Every basalt-written `oxlint .` carries it: config ignores don't stop oxlint loading a worktree's nested config (1.87). */
|
|
167
|
+
export declare const OXLINT_IGNORE_FLAG = "--ignore-pattern '.claude/worktrees/**'";
|
|
166
168
|
/**
|
|
167
169
|
* The consumer owns the CI gate when its Makefile has a `check:` target: `doctor` and `sync --check`
|
|
168
170
|
* stay as steps of their own (drift is never skippable), then `make check` replaces the built-in
|
|
@@ -200,6 +202,8 @@ export type ScaffoldFlags = {
|
|
|
200
202
|
noMergeLint?: boolean;
|
|
201
203
|
/** Shipped-source root; defaults to this package. Tests point it at a scratch package. */
|
|
202
204
|
pkgRoot?: string;
|
|
205
|
+
/** Runs a command in the app dir for `init` (install, first vite build); true on exit 0. Absent: `init` runs nothing and prints the command. */
|
|
206
|
+
run?: (argv: string[], cwd: string) => boolean;
|
|
203
207
|
};
|
|
204
208
|
export { ROUTER_SEED_DESTS, START_PROVIDER_HINT, routerSeedDest, routerSeedDests };
|
|
205
209
|
export declare const START_APP_NOTE = "TanStack Start app \u2014 no main.tsx/nav.tsx/__root.tsx seeded (Start owns the router); render <BasaltProvider><Outlet /></BasaltProvider> in the root route component or a pathless layout.";
|
|
@@ -265,14 +269,13 @@ export declare function resolvePlacement(cwd: string): PlacementFlags;
|
|
|
265
269
|
/** The full managed-file manifest. Stable, declarative — the single source of truth for init/sync. */
|
|
266
270
|
export declare function managedFiles(placement?: PlacementFlags, pkgRoot?: string): ManagedFile[];
|
|
267
271
|
/**
|
|
268
|
-
* The
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* that shipped a broken one: lefthook merges the preset's commands but runs every one at the REPO
|
|
272
|
-
* ROOT, with no oxlint config, no local binary and no basalt config. `root:` moves the invocation
|
|
273
|
-
* cwd per command and merges (the preset does not define it) — see the preset's MONOREPO RECIPE.
|
|
272
|
+
* The placement skips as sentences — one text for `init` and `sync`. `extends` alone is NOT the
|
|
273
|
+
* recipe for the hook: lefthook runs every merged command at the REPO ROOT, where there is no oxlint
|
|
274
|
+
* config, binary or basalt config. `root:` moves the cwd per command (the preset's MONOREPO RECIPE).
|
|
274
275
|
*/
|
|
275
276
|
export declare function placementNotices(cwd: string, placement: PlacementFlags): string[];
|
|
277
|
+
/** The two repo-root templates vs the repo root's own files, read-only: 'in sync' | 'drifted' | 'absent'. */
|
|
278
|
+
export declare function rootToolingStates(cwd: string, p: PlacementFlags, ctx: RenderContext): string[];
|
|
276
279
|
export type Manifest = {
|
|
277
280
|
version: 1;
|
|
278
281
|
/** The basalt-ui version that last wrote this manifest — `doctor`'s one reconciliation axis. */
|
|
@@ -442,13 +445,10 @@ export declare function inspectLefthookGate(repoRoot: string): LefthookGate;
|
|
|
442
445
|
*/
|
|
443
446
|
export declare function mergeOxlintExtends(cwd: string, presetPath: string): MergeLintResult;
|
|
444
447
|
/**
|
|
445
|
-
* Which shape of consumer a
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* the second to "run `basalt-ui init`" is the wrong instruction: init scaffolds Mantine rules,
|
|
450
|
-
* skills and a DESIGN.md it will never read. DECLARED only (`--framework` / `--tokens-only`, or
|
|
451
|
-
* `"basalt": { "profile": "tokens-only" }`) — never inferred; see {@link declaredProfile}.
|
|
448
|
+
* Which shape of consumer a command is looking at: `framework` (the Mantine app the scaffold is
|
|
449
|
+
* for) or `tokens-only` (took the `--vx-*` layer and nothing else, so `init` is the wrong advice).
|
|
450
|
+
* DECLARED only (`--framework` / `--tokens-only` / `basalt.profile`), never inferred; see
|
|
451
|
+
* {@link declaredProfile}.
|
|
452
452
|
*/
|
|
453
453
|
export type DoctorProfile = 'framework' | 'tokens-only';
|
|
454
454
|
/** Narrows to a string array — shared by `collectWorkspacePackages`'s two `workspaces` shapes. */
|