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
package/src/charts/ref-label.ts
CHANGED
|
@@ -15,6 +15,12 @@ const GLYPH_EM = 0.62
|
|
|
15
15
|
const EDGE_INSET = 6
|
|
16
16
|
const LINE_GAP = 3
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* A box another label has claimed in the same plot: a share of the plot width and a span of values
|
|
20
|
+
* on the left axis. A caption never takes a spot that overlaps one.
|
|
21
|
+
*/
|
|
22
|
+
export type LabelBox = { fx0: number; fx1: number; y0: number; y1: number }
|
|
23
|
+
|
|
18
24
|
const ORDER_END: readonly RefLabelPosition[] = [
|
|
19
25
|
'end-above',
|
|
20
26
|
'end-below',
|
|
@@ -29,7 +35,7 @@ const ORDER_START: readonly RefLabelPosition[] = [
|
|
|
29
35
|
]
|
|
30
36
|
|
|
31
37
|
/** The y range of the polyline `points` (sorted by `fx`) between `fx0` and `fx1`, or `null`. */
|
|
32
|
-
function yRangeWithin(
|
|
38
|
+
export function yRangeWithin(
|
|
33
39
|
points: readonly RefLabelPoint[],
|
|
34
40
|
fx0: number,
|
|
35
41
|
fx1: number,
|
|
@@ -57,6 +63,15 @@ function yRangeWithin(
|
|
|
57
63
|
return lo <= hi ? [lo, hi] : null
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
/**
|
|
67
|
+
* The `dy` that puts a caption's box clear of its line. The engine centres the text on its y and
|
|
68
|
+
* its line box is a little taller than the glyphs, so a full font size off the line leaves the
|
|
69
|
+
* box half a font size plus its leading clear (the old −5 put the centre ON the dashes).
|
|
70
|
+
*/
|
|
71
|
+
export function refLabelDy(position: RefLabelPosition, fontSize: number): number {
|
|
72
|
+
return position.endsWith('above') ? -fontSize : fontSize
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
export function refLabelPosition(opts: {
|
|
61
76
|
/** `RefLine.labelPosition`: wins over everything. */
|
|
62
77
|
pinned: RefLabelPosition | undefined
|
|
@@ -70,8 +85,11 @@ export function refLabelPosition(opts: {
|
|
|
70
85
|
fontSize: number
|
|
71
86
|
/** One polyline per visible series on the line's axis. */
|
|
72
87
|
series: readonly (readonly RefLabelPoint[])[]
|
|
88
|
+
/** Labels already placed on this axis (end labels): a caption keeps clear of them too. */
|
|
89
|
+
claimed?: readonly LabelBox[] | undefined
|
|
73
90
|
}): RefLabelPosition {
|
|
74
91
|
const { pinned, startFirst, value, plotWidth, plotHeight, label, fontSize, series } = opts
|
|
92
|
+
const { claimed = [] } = opts
|
|
75
93
|
const order = startFirst ? ORDER_START : ORDER_END
|
|
76
94
|
if (pinned !== undefined) return pinned
|
|
77
95
|
const [lo, hi] = [Math.min(...opts.domain), Math.max(...opts.domain)]
|
|
@@ -92,10 +110,12 @@ export function refLabelPosition(opts: {
|
|
|
92
110
|
const [fx0, fx1] = position.startsWith('end')
|
|
93
111
|
? [1 - widthFx, 1 - EDGE_INSET / plotWidth]
|
|
94
112
|
: [EDGE_INSET / plotWidth, widthFx]
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
return (
|
|
114
|
+
series.every((points) => {
|
|
115
|
+
const range = yRangeWithin(points, fx0, fx1)
|
|
116
|
+
return range === null || range[1] < from || range[0] > to
|
|
117
|
+
}) && claimed.every((b) => b.fx1 < fx0 || b.fx0 > fx1 || b.y1 < from || b.y0 > to)
|
|
118
|
+
)
|
|
99
119
|
}
|
|
100
120
|
// A caption that cannot avoid the data still stays inside the plot.
|
|
101
121
|
return (
|
|
@@ -104,28 +124,104 @@ export function refLabelPosition(opts: {
|
|
|
104
124
|
}
|
|
105
125
|
|
|
106
126
|
/** The gap between a sparkline reference label's box and its line, px. */
|
|
107
|
-
const SPARK_LABEL_GAP =
|
|
127
|
+
const SPARK_LABEL_GAP = 4
|
|
128
|
+
/** Air between a sparkline label's box and the data line (stroke and end dot included), px. */
|
|
129
|
+
const SPARK_LINE_AIR = 5
|
|
130
|
+
|
|
131
|
+
export type SparkLabelPlacement = {
|
|
132
|
+
side: 'above' | 'below'
|
|
133
|
+
end: 'start' | 'end'
|
|
134
|
+
/** The engine centres the text on its y: the offset that puts the box on `side` of the line. */
|
|
135
|
+
dy: number
|
|
136
|
+
}
|
|
108
137
|
|
|
109
138
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
139
|
+
* Where a sparkline's reference label sits: of start-above, start-below, end-above, end-below, the
|
|
140
|
+
* one whose box stays inside the plot (`height` in full) and moves least off the reference to clear
|
|
141
|
+
* the data line by {@link SPARK_LINE_AIR} (the first of the four on a tie). The box clears the
|
|
142
|
+
* reference by at least {@link SPARK_LABEL_GAP}, so the dashed rule never strikes the text.
|
|
143
|
+
* `line` is the plotted polyline as `{ fx, y }` (a share of the plot width, a value on `domain`);
|
|
144
|
+
* without it (a bar sparkline, or no `width`/`label`) only the plot bounds decide.
|
|
114
145
|
*/
|
|
115
146
|
export function referenceLabelPlacement(opts: {
|
|
116
147
|
value: number
|
|
117
148
|
domain: readonly [number, number]
|
|
118
149
|
height: number
|
|
150
|
+
/** Plot width, px. */
|
|
151
|
+
width?: number | undefined
|
|
119
152
|
/** The plot's margin inside the svg box, px. */
|
|
120
153
|
inset: number
|
|
121
154
|
fontSize: number
|
|
122
|
-
|
|
123
|
-
|
|
155
|
+
label?: string | undefined
|
|
156
|
+
line?: readonly RefLabelPoint[] | undefined
|
|
157
|
+
}): SparkLabelPlacement {
|
|
158
|
+
const { value, domain, height, inset, fontSize, line } = opts
|
|
159
|
+
const { width = 0, label = '' } = opts
|
|
124
160
|
const [lo, hi] = [Math.min(...domain), Math.max(...domain)]
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
161
|
+
const plotH = height - 2 * inset
|
|
162
|
+
const plotW = width - 2 * inset
|
|
163
|
+
const px = (y: number): number => inset + plotH * (1 - (hi === lo ? 0 : (y - lo) / (hi - lo)))
|
|
164
|
+
const at = px(value)
|
|
165
|
+
const boxH = fontSize
|
|
166
|
+
const boxW = label.length * fontSize * GLYPH_EM + EDGE_INSET
|
|
167
|
+
const pxLine = line?.map((p) => ({ fx: p.fx, y: px(p.y) }))
|
|
168
|
+
const candidates = (['start', 'end'] as const).flatMap((end) =>
|
|
169
|
+
(['above', 'below'] as const).map((side) => {
|
|
170
|
+
const nominal = side === 'above' ? at - SPARK_LABEL_GAP - boxH : at + SPARK_LABEL_GAP
|
|
171
|
+
const [fx0, fx1] = end === 'start' ? [0, boxW / plotW] : [1 - boxW / plotW, 1]
|
|
172
|
+
// The curve between two points stays between their values but not on the chord, so the
|
|
173
|
+
// window reaches out to the vertices that bound it.
|
|
174
|
+
const lead = pxLine?.find((p) => p.fx >= fx1)?.fx ?? fx1
|
|
175
|
+
const trail = pxLine?.findLast((p) => p.fx <= fx0)?.fx ?? fx0
|
|
176
|
+
const range =
|
|
177
|
+
pxLine === undefined || plotW <= 0
|
|
178
|
+
? null
|
|
179
|
+
: yRangeWithin(pxLine, Math.min(trail, fx0), Math.max(lead, fx1))
|
|
180
|
+
// A box the line comes within the air of slides away from the reference, along its side, until it has air.
|
|
181
|
+
const near =
|
|
182
|
+
range !== null &&
|
|
183
|
+
range[1] + SPARK_LINE_AIR > nominal &&
|
|
184
|
+
range[0] - SPARK_LINE_AIR < nominal + boxH
|
|
185
|
+
const top = !near
|
|
186
|
+
? nominal
|
|
187
|
+
: side === 'above'
|
|
188
|
+
? range[0] - SPARK_LINE_AIR - boxH
|
|
189
|
+
: range[1] + SPARK_LINE_AIR
|
|
190
|
+
return {
|
|
191
|
+
side,
|
|
192
|
+
end,
|
|
193
|
+
top,
|
|
194
|
+
range,
|
|
195
|
+
shift: Math.abs(top - nominal),
|
|
196
|
+
fits: top >= 0 && top + boxH <= height,
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
199
|
+
)
|
|
200
|
+
// The box stays inside the plot (the top edge last, so a box taller than the plot starts at 0).
|
|
201
|
+
const scored = candidates.map((c) => {
|
|
202
|
+
const top = Math.max(0, Math.min(c.top, height - boxH))
|
|
203
|
+
const covered =
|
|
204
|
+
c.range === null
|
|
205
|
+
? 0
|
|
206
|
+
: Math.max(0, Math.min(top + boxH, c.range[1]) - Math.max(top, c.range[0]))
|
|
207
|
+
return { ...c, top, strikesRule: top < at && top + boxH > at, covered }
|
|
208
|
+
})
|
|
209
|
+
type Spot = (typeof scored)[number]
|
|
210
|
+
// The fitting spot that stays nearest the reference (the first of the four on a tie).
|
|
211
|
+
const nearer = (c: Spot, best: Spot): boolean => c.shift < best.shift
|
|
212
|
+
// Nothing fits (the line peaks on the reference in a short box): the spot that clears the
|
|
213
|
+
// reference rule first, then covers the least of the data line.
|
|
214
|
+
const better = (c: Spot, best: Spot): boolean =>
|
|
215
|
+
c.strikesRule === best.strikesRule ? c.covered < best.covered : best.strikesRule
|
|
216
|
+
const pick = (spots: Spot[], beats: (c: Spot, best: Spot) => boolean): Spot | undefined =>
|
|
217
|
+
spots.reduce<Spot | undefined>(
|
|
218
|
+
(best, c) => (best === undefined || beats(c, best) ? c : best),
|
|
219
|
+
undefined,
|
|
220
|
+
)
|
|
221
|
+
const { side, end, top } = (pick(
|
|
222
|
+
scored.filter((c) => c.fits),
|
|
223
|
+
nearer,
|
|
224
|
+
) ?? pick(scored, better)) as Spot
|
|
225
|
+
const dy = top + boxH / 2 - at
|
|
226
|
+
return { side, end, dy }
|
|
131
227
|
}
|
|
@@ -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/src/charts/state.tsx
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* the chart chrome and `ChartCard`, so a pending card and a pending chart read the same.
|
|
4
4
|
*/
|
|
5
5
|
import type { CSSProperties, ReactElement, ReactNode } from 'react'
|
|
6
|
+
import { splitEmptyCopy } from '../common/empty-copy'
|
|
7
|
+
import { couldNotLoad } from '../common/could-not-load'
|
|
6
8
|
import { toErrorMessage } from '../common/errors'
|
|
7
9
|
import { RetryButton } from '../common/retry-button'
|
|
8
10
|
import { VX } from '../tokens'
|
|
@@ -42,10 +44,10 @@ const pendingStyle: CSSProperties = {
|
|
|
42
44
|
const GHOST_BARS = [38, 52, 44, 66, 58, 74, 62, 48] as const
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
|
-
* The shape a pending plot draws: `'bars'` (default), `'line'` for a line or area chart,
|
|
46
|
-
* count when the loaded chart's data length is known (a 6-month chart loads 6 bars).
|
|
47
|
+
* The shape a pending plot draws: `'bars'` (default), `'line'` for a line or area chart, `'band'`
|
|
48
|
+
* 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).
|
|
47
49
|
*/
|
|
48
|
-
export type PlotGhostShape = 'bars' | 'line' | number
|
|
50
|
+
export type PlotGhostShape = 'bars' | 'line' | 'band' | number
|
|
49
51
|
|
|
50
52
|
/** A mild rise across the width, in a 100 x 40 box stretched to the plot. */
|
|
51
53
|
const GHOST_LINE = '0,30 12,26 25,28 38,18 50,22 62,12 75,16 88,8 100,12'
|
|
@@ -60,6 +62,12 @@ function PlotGhost({ shape = 'bars' }: { shape?: PlotGhostShape }): ReactElement
|
|
|
60
62
|
</svg>
|
|
61
63
|
</div>
|
|
62
64
|
)
|
|
65
|
+
if (shape === 'band')
|
|
66
|
+
return (
|
|
67
|
+
<div aria-hidden="true" data-basalt-plot-ghost="band" className={boxClasses.ghost}>
|
|
68
|
+
<span className={boxClasses.ghostBand} />
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
63
71
|
const count =
|
|
64
72
|
typeof shape === 'number' ? Math.max(1, Math.min(Math.floor(shape), 60)) : GHOST_BARS.length
|
|
65
73
|
return (
|
|
@@ -97,6 +105,11 @@ const errorStyle: CSSProperties = {
|
|
|
97
105
|
fontSize: VX.text.sm,
|
|
98
106
|
gap: VX.space.controlGap,
|
|
99
107
|
}
|
|
108
|
+
// The empty tile's one ring: an inset shadow, never a border, as `EmptyState`'s section tier draws it.
|
|
109
|
+
const tileStyle: CSSProperties = {
|
|
110
|
+
// theme-allow surface-shadow-override — an inset ring on a tile inside a surface, not a card's depth
|
|
111
|
+
boxShadow: `var(--basalt-state-ring, inset 0 0 0 1px ${VX.surface.hairline})`,
|
|
112
|
+
}
|
|
100
113
|
const errorHeadStyle: CSSProperties = {
|
|
101
114
|
display: 'inline-flex',
|
|
102
115
|
alignItems: 'center',
|
|
@@ -108,7 +121,7 @@ const errorHeadStyle: CSSProperties = {
|
|
|
108
121
|
const errorMessageStyle: CSSProperties = { color: VX.muted }
|
|
109
122
|
|
|
110
123
|
const emptyLabel = (state: ChartState | undefined): string =>
|
|
111
|
-
typeof state?.empty === 'string' ? state.empty : 'Nothing
|
|
124
|
+
typeof state?.empty === 'string' ? state.empty : 'Nothing plotted in this range.'
|
|
112
125
|
|
|
113
126
|
/** Fills the same {@link ChartBox} the chart will, so a pending, failed or empty chart (and a
|
|
114
127
|
* `<Suspense>` fallback built from one) occupies the final chart's height. */
|
|
@@ -126,7 +139,7 @@ export function ChartPlaceholder(props: {
|
|
|
126
139
|
/** For a box too small to hold a sentence (a sparkline): error and empty show a `—` and carry the
|
|
127
140
|
* label as the accessible name and the hover title. */
|
|
128
141
|
compact?: boolean
|
|
129
|
-
/** Error only: what failed to load, "Could not load {noun}". Default:
|
|
142
|
+
/** Error only: what failed to load, "Could not load {noun}" (see `couldNotLoad`). Default: bare. */
|
|
130
143
|
noun?: string
|
|
131
144
|
/** Pending only: the ghost's shape. Default `'bars'`. */
|
|
132
145
|
ghost?: PlotGhostShape
|
|
@@ -152,7 +165,8 @@ export function ChartPlaceholder(props: {
|
|
|
152
165
|
if (kind === 'pending')
|
|
153
166
|
return fit(
|
|
154
167
|
<output aria-label="Loading chart" aria-busy="true" className={stateClass} style={style}>
|
|
155
|
-
{
|
|
168
|
+
{/* A sparkline's box is too small for bars: it ghosts a line, in the same tone as every ghost. */}
|
|
169
|
+
<PlotGhost shape={props.ghost ?? (props.compact ? 'line' : 'bars')} />
|
|
156
170
|
</output>,
|
|
157
171
|
)
|
|
158
172
|
const label =
|
|
@@ -166,7 +180,7 @@ export function ChartPlaceholder(props: {
|
|
|
166
180
|
{kind === 'error' && (
|
|
167
181
|
<span style={errorHeadStyle}>
|
|
168
182
|
<span aria-hidden="true" data-basalt-status-dot="" style={dotStyle} />
|
|
169
|
-
|
|
183
|
+
{couldNotLoad(props.noun)}
|
|
170
184
|
</span>
|
|
171
185
|
)}
|
|
172
186
|
<span style={errorMessageStyle}>{label}</span>
|
|
@@ -189,9 +203,25 @@ export function ChartPlaceholder(props: {
|
|
|
189
203
|
{body}
|
|
190
204
|
</div>,
|
|
191
205
|
)
|
|
206
|
+
if (props.compact)
|
|
207
|
+
return fit(
|
|
208
|
+
<output data-basalt-chart-state={kind} className={stateClass} style={style} {...name}>
|
|
209
|
+
{body}
|
|
210
|
+
</output>,
|
|
211
|
+
)
|
|
212
|
+
// The § 6.11 empty tile inside the chart's own box: one ring, card radius, the title at `sm` 500
|
|
213
|
+
// and a muted line, centred. `EmptyState` is Mantine-coupled, so the anatomy is plain HTML here.
|
|
214
|
+
// The live region holds the copy only; the action is its sibling, so a button is not announced.
|
|
215
|
+
const { title, description } = splitEmptyCopy(label)
|
|
192
216
|
return fit(
|
|
193
|
-
<
|
|
194
|
-
{
|
|
195
|
-
|
|
217
|
+
<div data-basalt-chart-state={kind} className={stateClass} style={boxStyle}>
|
|
218
|
+
<div data-basalt-empty-tile="" className={boxClasses.emptyTile} style={tileStyle}>
|
|
219
|
+
<output className={boxClasses.emptyCopy}>
|
|
220
|
+
<span className={boxClasses.emptyTitle}>{title}</span>
|
|
221
|
+
{description !== undefined && <span className={boxClasses.emptyText}>{description}</span>}
|
|
222
|
+
</output>
|
|
223
|
+
{props.action !== undefined && <div>{props.action}</div>}
|
|
224
|
+
</div>
|
|
225
|
+
</div>,
|
|
196
226
|
)
|
|
197
227
|
}
|
|
@@ -660,3 +660,78 @@ export function subpathPeersCheck(cwd: string, scanned: string[], install: Basal
|
|
|
660
660
|
}
|
|
661
661
|
})
|
|
662
662
|
}
|
|
663
|
+
|
|
664
|
+
/** Emitted `tokens:css` / `fonts:css` sheets from another version; the header names the re-emit command. */
|
|
665
|
+
export function staleEmittedSheets(
|
|
666
|
+
cwd: string,
|
|
667
|
+
files: readonly string[],
|
|
668
|
+
installedVersion: string | null,
|
|
669
|
+
): string[] {
|
|
670
|
+
if (installedVersion === null) return []
|
|
671
|
+
const out: string[] = []
|
|
672
|
+
for (const rel of files) {
|
|
673
|
+
if (!rel.endsWith('.css')) continue
|
|
674
|
+
const provenance = (readIfExists(resolve(cwd, rel)) ?? '').split('\n')[1]?.trim() ?? ''
|
|
675
|
+
const m = /^\/\* basalt-ui (\S+) — `(basalt-ui (?:tokens|fonts):css[^`]*)` \*\/$/.exec(
|
|
676
|
+
provenance,
|
|
677
|
+
)
|
|
678
|
+
if (m === null || m[1] === installedVersion) continue
|
|
679
|
+
out.push(
|
|
680
|
+
`emitted-sheets: ${rel} was emitted by ${m[1]}, installed is ${installedVersion} — ` +
|
|
681
|
+
`\`--check\` fails until it is re-emitted. Fix: \`${m[2]}\``,
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
return out
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** `a` versus `b` as dotted numbers: negative when `a` is older. */
|
|
688
|
+
export function compareVersions(a: string, b: string): number {
|
|
689
|
+
const y = b.split('.').map(Number)
|
|
690
|
+
return (
|
|
691
|
+
a
|
|
692
|
+
.split('.')
|
|
693
|
+
.map((n, i) => Number(n) - (y[i] ?? 0))
|
|
694
|
+
.find((d) => d !== 0) ?? 0
|
|
695
|
+
)
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const VISIBLE_HEADING = /^#{2,4}\s+Visible without code change/i
|
|
699
|
+
const CONSUMER_VISIBLE = /basalt\/[a-z][\w-]*|--vx-[\w-]+|\berror\b|\bpromoted?\b/i
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* The consumer-visible lines of every MIGRATING.md section with `from < version <= to` (`to`
|
|
703
|
+
* null: no upper bound), newest first as the file is ordered: lines naming a `basalt/*` rule id, a
|
|
704
|
+
* `--vx-*` token, `error` or `promoted`, plus the whole `Visible without code change` subsection.
|
|
705
|
+
* Fenced code and table separators are skipped; only long table rows are cut, never a bullet.
|
|
706
|
+
*/
|
|
707
|
+
export function migratingSince(markdown: string, from: string, to: string | null): string[] {
|
|
708
|
+
const out: string[] = []
|
|
709
|
+
let version: string | null = null
|
|
710
|
+
let visible = false
|
|
711
|
+
let fenced = false
|
|
712
|
+
for (const line of markdown.split('\n')) {
|
|
713
|
+
const h2 = /^## (\d+\.\d+\.\d+)\b(.*)$/.exec(line)
|
|
714
|
+
if (h2 !== null || line.startsWith('## ')) {
|
|
715
|
+
const v = h2?.[1] ?? null
|
|
716
|
+
version =
|
|
717
|
+
v !== null && compareVersions(v, from) > 0 && (to === null || compareVersions(v, to) <= 0)
|
|
718
|
+
? v
|
|
719
|
+
: null
|
|
720
|
+
visible = false
|
|
721
|
+
fenced = false
|
|
722
|
+
if (version !== null) out.push(`\n## ${version}${h2?.[2] ?? ''}`)
|
|
723
|
+
continue
|
|
724
|
+
}
|
|
725
|
+
if (version === null) continue
|
|
726
|
+
if (line.startsWith('```')) fenced = !fenced
|
|
727
|
+
if (fenced || line.startsWith('```')) continue
|
|
728
|
+
if (/^#{3,4}\s/.test(line)) visible = VISIBLE_HEADING.test(line)
|
|
729
|
+
const trimmed = line.trim()
|
|
730
|
+
if (trimmed === '' || /^\|[-\s|:]+\|$/.test(trimmed)) continue
|
|
731
|
+
if (!visible && !CONSUMER_VISIBLE.test(line)) continue
|
|
732
|
+
out.push(
|
|
733
|
+
trimmed.startsWith('|') && trimmed.length > 240 ? `${trimmed.slice(0, 240)}…` : trimmed,
|
|
734
|
+
)
|
|
735
|
+
}
|
|
736
|
+
return out
|
|
737
|
+
}
|
package/src/cli/doctor.ts
CHANGED
|
@@ -41,8 +41,11 @@ import {
|
|
|
41
41
|
appWiringCheck,
|
|
42
42
|
shellDeclarationFindings,
|
|
43
43
|
startWiringWarnings,
|
|
44
|
+
compareVersions,
|
|
44
45
|
droppedSubpathsCheck,
|
|
45
46
|
exactPeersCheck,
|
|
47
|
+
migratingSince,
|
|
48
|
+
staleEmittedSheets,
|
|
46
49
|
oxlintFloorCheck,
|
|
47
50
|
retiredLintRulesCheck,
|
|
48
51
|
subpathPeersCheck,
|
|
@@ -101,6 +104,32 @@ function aiMajorsAt(dir: string): Partial<Record<AiMajorField, number>> {
|
|
|
101
104
|
return out
|
|
102
105
|
}
|
|
103
106
|
|
|
107
|
+
/** `doctor --from <version>`: the consumer-visible MIGRATING.md changes since `from`, up to the install. */
|
|
108
|
+
function doctorFrom(invocationCwd: string, from: string | undefined): number {
|
|
109
|
+
if (from === undefined || !/^\d+\.\d+\.\d+$/.test(from)) {
|
|
110
|
+
console.error('basalt-ui doctor --from <x.y.z>: the version you are upgrading from.')
|
|
111
|
+
return 1
|
|
112
|
+
}
|
|
113
|
+
const install = findBasaltInstall(resolveProjectDir(invocationCwd).dir)
|
|
114
|
+
const markdown = install.dir === null ? null : readIfExists(resolve(install.dir, 'MIGRATING.md'))
|
|
115
|
+
if (markdown === null) {
|
|
116
|
+
console.error('basalt-ui doctor --from: no installed basalt-ui. Fix: `bun add basalt-ui`.')
|
|
117
|
+
return 1
|
|
118
|
+
}
|
|
119
|
+
if (install.version !== null && compareVersions(from, install.version) > 0) {
|
|
120
|
+
console.error(`basalt-ui doctor --from ${from}: newer than the installed ${install.version}.`)
|
|
121
|
+
return 1
|
|
122
|
+
}
|
|
123
|
+
const lines = migratingSince(markdown, from, install.version)
|
|
124
|
+
const span = `after ${from} up to ${install.version ?? 'the install'}`
|
|
125
|
+
console.log(
|
|
126
|
+
lines.length === 0
|
|
127
|
+
? `No consumer-visible changes recorded ${span}.`
|
|
128
|
+
: `Consumer-visible changes ${span} (full text: MIGRATING.md):\n${lines.join('\n')}`,
|
|
129
|
+
)
|
|
130
|
+
return 0
|
|
131
|
+
}
|
|
132
|
+
|
|
104
133
|
/**
|
|
105
134
|
* Check a consumer repo's basalt integration and print a pass/warn report. One directory, no
|
|
106
135
|
* workspace walking (see {@link resolveProjectDir}). Checks, in print order:
|
|
@@ -129,6 +158,11 @@ export function doctor(
|
|
|
129
158
|
designLoop: DesignLoopProbes = {},
|
|
130
159
|
): number {
|
|
131
160
|
if (conflictingProfileFlags('doctor', flags)) return 1
|
|
161
|
+
const fromAt = flags.findIndex((f) => f === '--from' || f.startsWith('--from='))
|
|
162
|
+
if (fromAt !== -1) {
|
|
163
|
+
const flag = flags[fromAt] as string
|
|
164
|
+
return doctorFrom(invocationCwd, flag.startsWith('--from=') ? flag.slice(7) : flags[fromAt + 1])
|
|
165
|
+
}
|
|
132
166
|
const project = resolveProjectDir(invocationCwd)
|
|
133
167
|
// Inside the app package of a monorepo the manifest is above: read the install root instead.
|
|
134
168
|
const aboveRoot = project.relocatedFrom === null ? installRootAbove(project.dir) : null
|
|
@@ -426,6 +460,8 @@ export function doctor(
|
|
|
426
460
|
for (const line of shell.warnings) warn(line)
|
|
427
461
|
}
|
|
428
462
|
|
|
463
|
+
for (const line of staleEmittedSheets(cwd, scannableFiles(cwd, cfg), install.version)) warn(line)
|
|
464
|
+
|
|
429
465
|
// ── Design loop: advisory info lines (no warning count — they never change the verdict) ─────
|
|
430
466
|
if (profile !== 'tokens-only') lines.push(...designLoopLines(cwd, resolveRoots(cfg), designLoop))
|
|
431
467
|
|
package/src/cli/help.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const COMMAND_OPTIONS: Record<
|
|
|
18
18
|
> = {
|
|
19
19
|
init: {
|
|
20
20
|
'no-merge-lint': { type: 'boolean' },
|
|
21
|
+
'no-install': { type: 'boolean' },
|
|
21
22
|
},
|
|
22
23
|
sync: {
|
|
23
24
|
force: { type: 'boolean' },
|
|
@@ -31,7 +32,11 @@ export const COMMAND_OPTIONS: Record<
|
|
|
31
32
|
'tokens-only': { type: 'boolean' },
|
|
32
33
|
framework: { type: 'boolean' },
|
|
33
34
|
},
|
|
34
|
-
doctor: {
|
|
35
|
+
doctor: {
|
|
36
|
+
'tokens-only': { type: 'boolean' },
|
|
37
|
+
framework: { type: 'boolean' },
|
|
38
|
+
from: { type: 'string' },
|
|
39
|
+
},
|
|
35
40
|
'guard-hook': {},
|
|
36
41
|
'tokens:css': {
|
|
37
42
|
out: { type: 'string' },
|
|
@@ -78,10 +83,10 @@ export function unknownFlag(cmd: string, flags: readonly string[]): string | nul
|
|
|
78
83
|
|
|
79
84
|
/** The one usage string — printed by `basalt help` / `--help` / `-h` AND the unknown-command fallback. */
|
|
80
85
|
export const USAGE =
|
|
81
|
-
'Usage: basalt-ui <--version | init [--no-merge-lint] |\n' +
|
|
86
|
+
'Usage: basalt-ui <--version | init [--no-merge-lint] [--no-install] |\n' +
|
|
82
87
|
' sync [--force] [--check] [--verbose] [--tokens-only|--framework] |\n' +
|
|
83
88
|
' check-theme [--audit-allows] |\n' +
|
|
84
|
-
' doctor [--tokens-only|--framework] | guard-hook | tokens:css | fonts:css |\n' +
|
|
89
|
+
' doctor [--tokens-only|--framework|--from <x.y.z>] | guard-hook | tokens:css | fonts:css |\n' +
|
|
85
90
|
' shot <route…> | shot detect | help>\n\n' +
|
|
86
91
|
'check-theme [--tokens-only|--framework] [--audit-allows]\n' +
|
|
87
92
|
' --audit-allows reports instead of scanning: every `theme-allow` annotation and every\n' +
|
|
@@ -102,13 +107,15 @@ export const USAGE =
|
|
|
102
107
|
' Render routes in Chromium (Playwright from YOUR project: bun add -d playwright) and write\n' +
|
|
103
108
|
' board.html, metrics.json and png/* — every data-shot anchor × light/dark × desktop/mobile ×\n' +
|
|
104
109
|
' rest, hover, focus, tooltip, empty, loading, error. --dist serves a built SPA dir itself.\n' +
|
|
110
|
+
' --out must resolve inside the project (the app dir in a monorepo, not the repo root); routes are\n' +
|
|
111
|
+
' separate arguments (zsh does not word-split $ROUTES).\n' +
|
|
105
112
|
' Default --out .basalt/shots (emptied each run); .basalt/shots/last.json names the last out dir.\n' +
|
|
106
113
|
' A real, signed-in app: [--local-storage <key>=<@env:NAME|@file:path>]… seeds localStorage (app origin\n' +
|
|
107
114
|
' only) before any page script; [--api <prefix>=<origin>]… (with --dist) proxies GET/HEAD under that\n' +
|
|
108
115
|
' prefix to the origin (other methods get 405 unless --api-allow-writes); [--header <name>=@env:NAME]… is\n' +
|
|
109
116
|
' added to every proxied request, to EVERY --api origin (never on a navigation; https required);\n' +
|
|
110
117
|
' [--wait <ms|networkidle>] adds ms of settle AFTER networkidle (default none); [--auto-anchors] crops\n' +
|
|
111
|
-
' each Card, Paper and table over 120×60 px on a page with no data-shot. Values are never printed or\n' +
|
|
118
|
+
' each Card, Paper and table over 120×60 px (else main, section, header, form) on a page with no data-shot. Values are never printed or\n' +
|
|
112
119
|
' written; a redirect, 401/403/404, 5xx or dead API fails every shot of that page. Shots of real data go to the\n' +
|
|
113
120
|
' reviewer subagent and so to its model provider: point --api at staging or synthetic data when the\n' +
|
|
114
121
|
" app holds other people's data. Example:\n" +
|
|
@@ -127,10 +134,13 @@ export const USAGE =
|
|
|
127
134
|
' P2 noted, not failing: degraded: a lint warning, a contrast measured on an assumed white backdrop\n' +
|
|
128
135
|
' P3 noted, not failing: polish: an off-scale value within 1 px of a step\n' +
|
|
129
136
|
' score = 100 - (25 per P0 + 10 per P1 + 3 per P2 + 1 per P3), floored at 0. Each run appends\n' +
|
|
130
|
-
' {at, out, commit, counts, score} to .basalt/shots/history.json and prints the last 5 scores as a trend
|
|
137
|
+
' {at, out, commit, counts, score} to .basalt/shots/history.json and prints the last 5 scores of THAT --out dir as a trend\n' +
|
|
138
|
+
' with the finding count beside each (the score floors at 0). No anchor measured: "nothing measured", no score.\n' +
|
|
139
|
+
' detect takes --out <dir>, never a positional.\n' +
|
|
131
140
|
' A component can declare a rest anchor absent in a URL state with data-shot-absent="empty error": that\n' +
|
|
132
141
|
' cell is recorded `absent`, not `error`.\n\n' +
|
|
133
|
-
'doctor [--tokens-only|--framework]\n' +
|
|
142
|
+
'doctor [--tokens-only|--framework] [--from <x.y.z>]\n' +
|
|
143
|
+
' doctor --from <x.y.z> print the consumer-visible MIGRATING changes since that version\n' +
|
|
134
144
|
' Checks THIS project only: the manifest exists, the oxlint preset is wired, the pre-commit\n' +
|
|
135
145
|
' hook runs check-theme (via `lefthook dump`), and the ai package major is consistent within\n' +
|
|
136
146
|
' this package.json. Profile is DECLARED, same as check-theme — never inferred.\n\n' +
|