basalt-ui 2.21.0 → 2.23.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 +60 -0
- package/MIGRATING.md +452 -12
- package/agent/agents/basalt-design-reviewer.md +1 -1
- package/agent/rules/basalt-tokens.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/anti-defaults.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +1 -0
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/BandStrip.js +73 -3
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/Bars.js +6 -0
- package/dist/charts/CartesianChart.d.ts +10 -0
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +8 -5
- package/dist/charts/ChartCard.d.ts +12 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +39 -8
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +5 -8
- package/dist/charts/Heatmap.d.ts +12 -1
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +34 -5
- package/dist/charts/Lines.d.ts +3 -0
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +29 -6
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +4 -6
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +101 -22
- package/dist/charts/StackedArea.d.ts +4 -1
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/StackedArea.js +9 -3
- package/dist/charts/band-fold.d.ts +38 -1
- package/dist/charts/band-fold.d.ts.map +1 -1
- package/dist/charts/band-fold.js +18 -1
- package/dist/charts/chart-box.module.css +19 -0
- package/dist/charts/chart-card.module.css +25 -0
- package/dist/charts/chart-dates.d.ts +12 -0
- package/dist/charts/chart-dates.d.ts.map +1 -0
- package/dist/charts/chart-dates.js +16 -0
- package/dist/charts/chart-legend.module.css +7 -0
- package/dist/charts/compile.d.ts +25 -6
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +152 -72
- package/dist/charts/date-tick-format.d.ts +5 -5
- package/dist/charts/date-tick-format.d.ts.map +1 -1
- package/dist/charts/date-tick-format.js +3 -7
- package/dist/charts/labels.d.ts +21 -6
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +52 -17
- package/dist/charts/legend.d.ts +2 -0
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +7 -21
- package/dist/charts/marks.js +1 -1
- package/dist/charts/panel.d.ts +0 -6
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -10
- package/dist/charts/ref-label.d.ts +43 -0
- package/dist/charts/ref-label.d.ts.map +1 -0
- package/dist/charts/ref-label.js +75 -0
- package/dist/charts/scales.d.ts +4 -1
- package/dist/charts/scales.d.ts.map +1 -1
- package/dist/charts/scales.js +14 -3
- package/dist/charts/sparkline.module.css +13 -17
- package/dist/charts/sparkline.module.css.d.ts +1 -2
- package/dist/charts/state.d.ts +2 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +5 -2
- package/dist/charts/types.d.ts +18 -8
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.d.ts +1 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +1 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +68 -4
- package/dist/cli/shot/capture.d.ts +21 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +202 -36
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +17 -1
- package/dist/cli/shot/playwright.d.ts +13 -2
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/cli/shot/playwright.js +5 -1
- package/dist/cli/shot/types.d.ts +4 -0
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +2 -0
- package/dist/cli/tokens-css.d.ts +5 -7
- package/dist/cli/tokens-css.d.ts.map +1 -1
- package/dist/cli/tokens-css.js +11 -12
- package/dist/controls/controls.module.css +11 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +1 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +22 -3
- package/dist/controls/sync-button.module.css +34 -2
- package/dist/controls/sync-button.module.css.d.ts +1 -0
- package/dist/dashboard/bar-list.d.ts +6 -1
- 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 +83 -0
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +2 -2
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +2 -0
- package/dist/dashboard/meter-model.d.ts +84 -5
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +100 -15
- package/dist/dashboard/meter-parts.d.ts +9 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +276 -74
- package/dist/dashboard/meter.d.ts +54 -65
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +21 -4
- package/dist/dashboard/meter.module.css +76 -0
- package/dist/dashboard/meter.module.css.d.ts +6 -0
- package/dist/dashboard/page-summary.d.ts +20 -0
- package/dist/dashboard/page-summary.d.ts.map +1 -0
- package/dist/dashboard/page-summary.js +28 -0
- package/dist/dashboard/page-summary.module.css +89 -0
- package/dist/dashboard/page-summary.module.css.d.ts +15 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +1 -1
- package/dist/dashboard/section.d.ts +25 -2
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +10 -5
- package/dist/dashboard/section.module.css +23 -0
- package/dist/dashboard/section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +4 -2
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +7 -5
- package/dist/dashboard/stat-card.module.css +36 -0
- package/dist/dashboard/stat-group.module.css +7 -0
- package/dist/dashboard/stat-strip.d.ts +22 -6
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +104 -60
- package/dist/dashboard/stat-strip.module.css +122 -53
- package/dist/dashboard/stat-strip.module.css.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts +7 -1
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +3 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +0 -5
- package/dist/guard/vx-names.d.ts.map +1 -1
- package/dist/guard/vx-names.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +43 -4
- package/dist/theme/chrome-vars.d.ts +20 -5
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +46 -3
- package/dist/theme/controls.module.css +37 -0
- package/dist/theme/controls.module.css.d.ts +2 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +18 -27
- package/dist/theme/status-verdict.d.ts.map +1 -1
- package/dist/theme/status-verdict.js +9 -1
- package/dist/tokens/core.d.ts +2 -1
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +6 -1
- package/dist/tokens/derive.d.ts +3 -1
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +16 -1
- package/dist/tokens/palette.d.ts +11 -10
- package/dist/tokens/palette.d.ts.map +1 -1
- package/dist/tokens/palette.js +11 -10
- package/dist/tokens/status-text.d.ts.map +1 -1
- package/dist/tokens/status-text.js +3 -1
- package/llms.txt +42 -22
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +83 -3
- package/src/charts/Bars.tsx +7 -0
- package/src/charts/CartesianChart.tsx +18 -3
- package/src/charts/ChartCard.tsx +54 -13
- package/src/charts/DualPanel.tsx +3 -6
- package/src/charts/Heatmap.tsx +54 -5
- package/src/charts/Lines.tsx +56 -10
- package/src/charts/MirroredBars.tsx +3 -5
- package/src/charts/Sparkline.tsx +135 -25
- package/src/charts/StackedArea.tsx +14 -4
- package/src/charts/band-fold.ts +50 -1
- package/src/charts/chart-box.module.css +19 -0
- package/src/charts/chart-card.module.css +25 -0
- package/src/charts/chart-dates.ts +30 -0
- package/src/charts/chart-legend.module.css +7 -0
- package/src/charts/compile.ts +253 -87
- package/src/charts/date-tick-format.ts +10 -13
- package/src/charts/labels.ts +81 -26
- package/src/charts/legend.tsx +10 -20
- package/src/charts/marks.ts +1 -1
- package/src/charts/panel.tsx +1 -16
- package/src/charts/ref-label.ts +131 -0
- package/src/charts/scales.ts +22 -2
- package/src/charts/sparkline.module.css +13 -17
- package/src/charts/sparkline.module.css.d.ts +1 -2
- package/src/charts/state.tsx +9 -4
- package/src/charts/types.ts +18 -8
- package/src/cli/doctor-upgrade.ts +1 -1
- package/src/cli/init.ts +100 -3
- package/src/cli/shot/capture.ts +266 -35
- package/src/cli/shot/detect.ts +18 -1
- package/src/cli/shot/playwright.ts +20 -4
- package/src/cli/shot/types.ts +5 -0
- package/src/cli/tokens-css.ts +18 -20
- package/src/controls/controls.module.css +11 -1
- package/src/controls/filter-pill.tsx +2 -0
- package/src/controls/sync-button.module.css +34 -2
- package/src/controls/sync-button.module.css.d.ts +1 -0
- package/src/controls/sync-button.tsx +40 -4
- package/src/dashboard/bar-list.module.css +83 -0
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +107 -69
- package/src/dashboard/delta-badge.tsx +6 -2
- package/src/dashboard/index.ts +1 -0
- package/src/dashboard/meter-model.ts +207 -24
- package/src/dashboard/meter-parts.tsx +349 -67
- package/src/dashboard/meter.module.css +76 -0
- package/src/dashboard/meter.module.css.d.ts +6 -0
- package/src/dashboard/meter.tsx +72 -18
- package/src/dashboard/page-summary.module.css +89 -0
- package/src/dashboard/page-summary.module.css.d.ts +15 -0
- package/src/dashboard/page-summary.tsx +95 -0
- package/src/dashboard/query-state.tsx +1 -1
- package/src/dashboard/section.module.css +23 -0
- package/src/dashboard/section.module.css.d.ts +1 -0
- package/src/dashboard/section.tsx +59 -11
- package/src/dashboard/stat-card-parts.tsx +5 -1
- package/src/dashboard/stat-card.module.css +36 -0
- package/src/dashboard/stat-card.tsx +12 -6
- package/src/dashboard/stat-group.module.css +7 -0
- package/src/dashboard/stat-strip.module.css +122 -53
- package/src/dashboard/stat-strip.module.css.d.ts +4 -0
- package/src/dashboard/stat-strip.tsx +176 -91
- package/src/dashboard/visual-slot.ts +12 -3
- package/src/guard/index.ts +0 -5
- package/src/guard/vx-names.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles.css +43 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +200 -68
- package/src/theme/chrome-vars.ts +77 -8
- package/src/theme/controls.module.css +37 -0
- package/src/theme/controls.module.css.d.ts +2 -0
- package/src/theme/index.ts +22 -32
- package/src/theme/status-verdict.tsx +5 -1
- package/src/tokens/core.ts +4 -1
- package/src/tokens/derive.ts +32 -3
- package/src/tokens/palette.ts +11 -10
- package/src/tokens/status-text.ts +2 -0
|
@@ -10,14 +10,26 @@
|
|
|
10
10
|
*
|
|
11
11
|
* `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
|
|
12
12
|
* the cell's size. Empty: `—` in the value position and the reason, muted. Error: the shared error
|
|
13
|
-
* anatomy compact — status dot, the
|
|
13
|
+
* anatomy compact — status dot, the words `Could not load`, the message, the shared Retry. The caption stays.
|
|
14
14
|
* A `visual` is a hero host: a zoned `Meter` in it does not repeat the value at its marker.
|
|
15
15
|
*
|
|
16
|
-
* Alignment:
|
|
17
|
-
*
|
|
16
|
+
* Alignment: a cell is a plain column that ends at its content (the slot around it runs the whole
|
|
17
|
+
* row, so the dividers do too). Cells of one row share a caption top and a value baseline BY
|
|
18
|
+
* CONSTRUCTION: the caption line is one line (it truncates with a `title`), and when any cell has a
|
|
19
|
+
* qualifier a narrow cell reserves the qualifier's own line, so the parts above the value have equal
|
|
20
|
+
* height. Below the value nothing is shared: a visual starts right under it, rows follow, and a
|
|
21
|
+
* footer rides with the last part it captions, so a short cell never holds a taller sibling's void.
|
|
22
|
+
* `action` sits at the end of the caption line (the caption truncates first); a row with `hideValue`
|
|
23
|
+
* prints its label alone.
|
|
18
24
|
*
|
|
19
25
|
* Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
|
|
20
|
-
* `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
|
|
26
|
+
* `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name). A footer entry
|
|
27
|
+
* with `under: '<cell key>'` qualifies that one cell: from 800px it sits in the cell's column (an
|
|
28
|
+
* entry without `under` then takes the full row); below, every entry is full width under the grid.
|
|
29
|
+
*
|
|
30
|
+
* Absence: a page that hides the strip in a declared shot state sets `shotAbsent` on the group
|
|
31
|
+
* (`['empty']`): every derived anchor, cells and footer cells, then carries `data-shot-absent`. A
|
|
32
|
+
* cell's own `shotAbsent` replaces the group's for that cell (the exception).
|
|
21
33
|
*
|
|
22
34
|
* Mapping from a prototype: warden's JSX `qualifier` line UNDER the value is `footer`; the cell
|
|
23
35
|
* `qualifier` is the short `· text` on the caption line. Cells are equal-weight: unequal column
|
|
@@ -34,7 +46,13 @@ import { StatusDot } from '../theme/status-dot'
|
|
|
34
46
|
import { VX } from '../tokens'
|
|
35
47
|
import { InfoGlyph } from './widget-header'
|
|
36
48
|
import classes from './stat-strip.module.css'
|
|
37
|
-
import { VisualSlotContext } from './visual-slot'
|
|
49
|
+
import { HOSTED, VisualSlotContext } from './visual-slot'
|
|
50
|
+
|
|
51
|
+
/** The URL shot states an anchor can declare itself absent in (`data-shot-absent`). */
|
|
52
|
+
type StatStripShotState = 'empty' | 'loading' | 'error'
|
|
53
|
+
|
|
54
|
+
const absentAttr = (states: readonly StatStripShotState[] | undefined) =>
|
|
55
|
+
states === undefined || states.length === 0 ? {} : { 'data-shot-absent': states.join(' ') }
|
|
38
56
|
|
|
39
57
|
export type StatStripRow = {
|
|
40
58
|
key: string
|
|
@@ -44,6 +62,8 @@ export type StatStripRow = {
|
|
|
44
62
|
visual?: ReactNode
|
|
45
63
|
/** A `DeltaBadge`. */
|
|
46
64
|
delta?: ReactNode
|
|
65
|
+
/** The reading is already shown (the hero): print the label alone. `value` is ignored. */
|
|
66
|
+
hideValue?: boolean
|
|
47
67
|
}
|
|
48
68
|
|
|
49
69
|
/** What a cell shows instead of its readings. Mirrors `StatCard`'s `query` branches. */
|
|
@@ -66,8 +86,12 @@ type StatStripCellState =
|
|
|
66
86
|
export type StatStripCell = {
|
|
67
87
|
key: string
|
|
68
88
|
caption: string
|
|
69
|
-
/** Muted, on the caption line: `CAPTION · qualifier`.
|
|
89
|
+
/** Muted, on the caption line: `CAPTION · qualifier`. It wraps whole under the caption when it
|
|
90
|
+
* does not fit (by design: no truncation, so no `title`). */
|
|
70
91
|
qualifier?: string
|
|
92
|
+
/** A control at the end of the caption line (a popover trigger). Never wraps the line: the
|
|
93
|
+
* caption truncates first. */
|
|
94
|
+
action?: ReactNode
|
|
71
95
|
/** The definition behind the caption, in the info-glyph tooltip. */
|
|
72
96
|
info?: string
|
|
73
97
|
/** `null` = no reading, printed as `—`. Omit only when `rows` carries the cell. */
|
|
@@ -89,6 +113,16 @@ export type StatStripCell = {
|
|
|
89
113
|
stale?: boolean
|
|
90
114
|
/** Empty or failed: replaces the readings; `loading` wins while pending. */
|
|
91
115
|
state?: StatStripCellState
|
|
116
|
+
/** The shot states this cell's anchor is absent in; replaces the group's `shotAbsent`. */
|
|
117
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type StatStripFooterEntry = {
|
|
121
|
+
key: string
|
|
122
|
+
content: ReactNode
|
|
123
|
+
/** The `key` of the cell this entry qualifies. From the full desktop width (800px) it sits in that
|
|
124
|
+
* cell's column; below it, and for a key that names no cell, it takes the full width under the grid. */
|
|
125
|
+
under?: string
|
|
92
126
|
}
|
|
93
127
|
|
|
94
128
|
export type StatStripProps = BasaltProps & {
|
|
@@ -96,9 +130,11 @@ export type StatStripProps = BasaltProps & {
|
|
|
96
130
|
label: string
|
|
97
131
|
cells: readonly StatStripCell[]
|
|
98
132
|
/** Wider cells under the cells. */
|
|
99
|
-
footer?: readonly
|
|
133
|
+
footer?: readonly StatStripFooterEntry[]
|
|
100
134
|
/** The DESKTOP column count. Default: the cell count, capped at 6. */
|
|
101
135
|
cols?: 2 | 3 | 4 | 5 | 6
|
|
136
|
+
/** The shot states the page hides the whole strip in (`data-shot-absent` on every derived anchor). */
|
|
137
|
+
shotAbsent?: readonly StatStripShotState[]
|
|
102
138
|
}
|
|
103
139
|
|
|
104
140
|
const EMPTY = '—'
|
|
@@ -121,7 +157,7 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
121
157
|
<div className={classes.error} role="alert" data-strip-state="error">
|
|
122
158
|
<span className={classes.errorHead}>
|
|
123
159
|
<StatusDot color={VX.status.bad} />
|
|
124
|
-
|
|
160
|
+
Could not load
|
|
125
161
|
</span>
|
|
126
162
|
<p className={classes.reason}>{message}</p>
|
|
127
163
|
{state.onRetry !== undefined && (
|
|
@@ -131,98 +167,137 @@ function CellState({ state }: { state: StatStripCellState }) {
|
|
|
131
167
|
)
|
|
132
168
|
}
|
|
133
169
|
|
|
134
|
-
function StripCell({
|
|
170
|
+
function StripCell({
|
|
171
|
+
cell,
|
|
172
|
+
shotAbsent,
|
|
173
|
+
}: {
|
|
174
|
+
cell: StatStripCell
|
|
175
|
+
shotAbsent: readonly StatStripShotState[] | undefined
|
|
176
|
+
}) {
|
|
135
177
|
const captionId = useId()
|
|
136
178
|
const { rows, loading } = cell
|
|
137
179
|
const state = loading ? undefined : cell.state
|
|
138
180
|
const hasHero = cell.value !== undefined || rows === undefined
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
181
|
+
// The cell's verdict colours a plain Meter in its visual too (a hero host only).
|
|
182
|
+
const hostSlot = !hasHero ? null : cell.tone === undefined ? HOSTED : { tone: cell.tone }
|
|
183
|
+
// A footer rides with what it captions: it follows the cell's last part, whatever a sibling holds.
|
|
142
184
|
const footerEl = cell.footer !== undefined && (
|
|
143
185
|
<div className={classes.footer} data-strip-footer>
|
|
144
186
|
{cell.footer}
|
|
145
187
|
</div>
|
|
146
188
|
)
|
|
189
|
+
const heroEl = loading ? (
|
|
190
|
+
<Skeleton className={classes.skeletonValue} radius="sm" />
|
|
191
|
+
) : (
|
|
192
|
+
<div className={classes.valueRow}>
|
|
193
|
+
<span
|
|
194
|
+
className={classes.value}
|
|
195
|
+
data-strip-value
|
|
196
|
+
style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
|
|
197
|
+
>
|
|
198
|
+
{cell.value ?? EMPTY}
|
|
199
|
+
</span>
|
|
200
|
+
{cell.value !== undefined && cell.value !== null && cell.unit !== undefined && (
|
|
201
|
+
<span className={classes.unit}>{cell.unit}</span>
|
|
202
|
+
)}
|
|
203
|
+
{cell.delta}
|
|
204
|
+
</div>
|
|
205
|
+
)
|
|
147
206
|
return (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
) : (
|
|
175
|
-
<div className={classes.valueRow}>
|
|
176
|
-
<span
|
|
177
|
-
className={classes.value}
|
|
178
|
-
data-strip-value
|
|
179
|
-
style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
|
|
180
|
-
>
|
|
181
|
-
{cell.value ?? EMPTY}
|
|
207
|
+
// The slot owns the dividers and runs the row; the article inside ends at its content.
|
|
208
|
+
<div className={classes.cell} data-strip-slot>
|
|
209
|
+
<article
|
|
210
|
+
className={classes.content}
|
|
211
|
+
data-strip-cell={cell.key}
|
|
212
|
+
data-shot={`strip-${cell.key}`}
|
|
213
|
+
aria-labelledby={captionId}
|
|
214
|
+
{...absentAttr(cell.shotAbsent ?? shotAbsent)}
|
|
215
|
+
{...(state !== undefined && { 'data-strip-has-state': '' })}
|
|
216
|
+
{...(state === undefined && cell.visual !== undefined && { 'data-strip-has-visual': '' })}
|
|
217
|
+
{...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
|
|
218
|
+
{...(cell.stale && { 'data-stale': 'true' })}
|
|
219
|
+
>
|
|
220
|
+
<div className={classes.captionLine}>
|
|
221
|
+
<div className={classes.captionMain}>
|
|
222
|
+
{/* The caption and its info glyph are one unit: the qualifier wraps whole, never between them. */}
|
|
223
|
+
<span className={classes.lead}>
|
|
224
|
+
<span
|
|
225
|
+
className={classes.caption}
|
|
226
|
+
id={captionId}
|
|
227
|
+
title={cell.caption}
|
|
228
|
+
data-strip-caption
|
|
229
|
+
>
|
|
230
|
+
{cell.caption}
|
|
231
|
+
</span>
|
|
232
|
+
{cell.info !== undefined && <InfoGlyph text={cell.info} />}
|
|
182
233
|
</span>
|
|
183
|
-
{cell.
|
|
184
|
-
<span className={classes.
|
|
234
|
+
{cell.qualifier !== undefined && (
|
|
235
|
+
<span className={classes.qualifier} title={cell.qualifier}>
|
|
236
|
+
{cell.qualifier}
|
|
237
|
+
</span>
|
|
185
238
|
)}
|
|
186
|
-
{cell.delta}
|
|
187
|
-
</div>
|
|
188
|
-
))}
|
|
189
|
-
{state === undefined && cell.visual !== undefined && (
|
|
190
|
-
<div className={classes.visualStack}>
|
|
191
|
-
<div className={classes.visual} data-strip-visual>
|
|
192
|
-
<VisualSlotContext.Provider value={hasHero}>{cell.visual}</VisualSlotContext.Provider>
|
|
193
239
|
</div>
|
|
194
|
-
{
|
|
240
|
+
{cell.action !== undefined && (
|
|
241
|
+
<span className={classes.action} data-strip-action>
|
|
242
|
+
{cell.action}
|
|
243
|
+
</span>
|
|
244
|
+
)}
|
|
195
245
|
</div>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
{rows.map((row) => (
|
|
202
|
-
<Skeleton key={row.key} className={classes.skeletonRow} radius="sm" />
|
|
203
|
-
))}
|
|
246
|
+
{state !== undefined && <CellState state={state} />}
|
|
247
|
+
{state === undefined && hasHero && heroEl}
|
|
248
|
+
{state === undefined && cell.visual !== undefined && (
|
|
249
|
+
<div className={classes.visual} data-strip-visual>
|
|
250
|
+
<VisualSlotContext.Provider value={hostSlot}>{cell.visual}</VisualSlotContext.Provider>
|
|
204
251
|
</div>
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
252
|
+
)}
|
|
253
|
+
{state === undefined &&
|
|
254
|
+
rows !== undefined &&
|
|
255
|
+
(loading ? (
|
|
256
|
+
<div className={classes.rows} aria-hidden="true">
|
|
257
|
+
{rows.map((row) => (
|
|
258
|
+
<Skeleton key={row.key} className={classes.skeletonRow} radius="sm" />
|
|
259
|
+
))}
|
|
260
|
+
</div>
|
|
261
|
+
) : (
|
|
262
|
+
<ul className={classes.rows} data-strip-rows>
|
|
263
|
+
{rows.map((row) => (
|
|
264
|
+
<li key={row.key} className={classes.row} data-strip-row={row.key}>
|
|
265
|
+
<span className={classes.rowLabel}>{row.label}</span>
|
|
266
|
+
<span className={classes.visual}>{row.visual}</span>
|
|
267
|
+
<span className={classes.rowValue}>
|
|
268
|
+
{row.hideValue ? null : (row.value ?? EMPTY)}
|
|
269
|
+
</span>
|
|
270
|
+
<span>{row.delta}</span>
|
|
271
|
+
</li>
|
|
272
|
+
))}
|
|
273
|
+
</ul>
|
|
274
|
+
))}
|
|
275
|
+
{state === undefined && footerEl}
|
|
276
|
+
</article>
|
|
277
|
+
</div>
|
|
219
278
|
)
|
|
220
279
|
}
|
|
221
280
|
|
|
222
|
-
export function StatStrip({
|
|
281
|
+
export function StatStrip({
|
|
282
|
+
label,
|
|
283
|
+
cells,
|
|
284
|
+
footer,
|
|
285
|
+
cols,
|
|
286
|
+
shotAbsent,
|
|
287
|
+
className,
|
|
288
|
+
style,
|
|
289
|
+
}: StatStripProps) {
|
|
223
290
|
const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
|
|
224
291
|
// `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
|
|
225
292
|
const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
|
|
293
|
+
// A cell's column at the full count; `undefined` for a key that names no cell.
|
|
294
|
+
const columnOf = (key: string | undefined) => {
|
|
295
|
+
const at = cells.findIndex((cell) => cell.key === key)
|
|
296
|
+
return at < 0 ? undefined : (at % desktop) + 1
|
|
297
|
+
}
|
|
298
|
+
const hasQualifier = cells.some((cell) => cell.qualifier !== undefined)
|
|
299
|
+
const hasAction = cells.some((cell) => cell.action !== undefined)
|
|
300
|
+
const placed = footer?.some((entry) => columnOf(entry.under) !== undefined) ?? false
|
|
226
301
|
return (
|
|
227
302
|
<div className={cx(classes.container, className)} style={style}>
|
|
228
303
|
<Card>
|
|
@@ -230,6 +305,8 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
|
|
|
230
305
|
component="section"
|
|
231
306
|
aria-label={label}
|
|
232
307
|
className={classes.clip}
|
|
308
|
+
{...(hasQualifier && { 'data-strip-qualifier': '' })}
|
|
309
|
+
{...(hasAction && { 'data-strip-action-row': '' })}
|
|
233
310
|
style={
|
|
234
311
|
{
|
|
235
312
|
'--basalt-strip-cols': desktop,
|
|
@@ -239,21 +316,29 @@ export function StatStrip({ label, cells, footer, cols, className, style }: Stat
|
|
|
239
316
|
>
|
|
240
317
|
<div className={classes.cells}>
|
|
241
318
|
{cells.map((cell) => (
|
|
242
|
-
<StripCell key={cell.key} cell={cell} />
|
|
319
|
+
<StripCell key={cell.key} cell={cell} shotAbsent={shotAbsent} />
|
|
243
320
|
))}
|
|
244
321
|
</div>
|
|
245
322
|
{footer !== undefined && footer.length > 0 && (
|
|
246
|
-
<div className={classes.footerRow}>
|
|
247
|
-
{footer.map((entry) =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
323
|
+
<div className={classes.footerRow} {...(placed && { 'data-placed': '' })}>
|
|
324
|
+
{footer.map((entry) => {
|
|
325
|
+
const column = columnOf(entry.under)
|
|
326
|
+
return (
|
|
327
|
+
<div
|
|
328
|
+
key={entry.key}
|
|
329
|
+
className={classes.footerCell}
|
|
330
|
+
data-strip-footer-cell={entry.key}
|
|
331
|
+
data-shot={`strip-footer-${entry.key}`}
|
|
332
|
+
{...absentAttr(shotAbsent)}
|
|
333
|
+
{...(column !== undefined && {
|
|
334
|
+
'data-under': entry.under,
|
|
335
|
+
style: { '--basalt-strip-footer-col': column } as CSSProperties,
|
|
336
|
+
})}
|
|
337
|
+
>
|
|
338
|
+
{entry.content}
|
|
339
|
+
</div>
|
|
340
|
+
)
|
|
341
|
+
})}
|
|
257
342
|
</div>
|
|
258
343
|
)}
|
|
259
344
|
</Card.Section>
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Set by a host that already shows the reading as its hero (a `StatCard` sparkline slot, a strip
|
|
3
|
-
* cell's `visual`). A `Meter`
|
|
4
|
-
*
|
|
3
|
+
* cell's `visual`). A `Meter` reads it: a zoned track drops the reading it would draw at the marker
|
|
4
|
+
* (the headline is not printed twice; `reading` overrides), and a plain bar or ring with no `tone` or
|
|
5
|
+
* `color` of its own takes the host's `tone` as its verdict colour. Internal: never exported.
|
|
5
6
|
*/
|
|
6
7
|
import { createContext } from 'react'
|
|
8
|
+
import type { Tone } from '../common/props'
|
|
7
9
|
|
|
8
|
-
export
|
|
10
|
+
export interface VisualSlot {
|
|
11
|
+
readonly tone?: Tone
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A host with no verdict of its own: one shared object, so a provider never re-renders its readers. */
|
|
15
|
+
export const HOSTED: VisualSlot = {}
|
|
16
|
+
|
|
17
|
+
export const VisualSlotContext = createContext<VisualSlot | null>(null)
|
package/src/guard/index.ts
CHANGED
|
@@ -911,11 +911,6 @@ export const GRACE_PERIOD_KINDS: Partial<Record<GuardKind, GraceEntry>> = {
|
|
|
911
911
|
promote: '2.24.0',
|
|
912
912
|
why: 'The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 → 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding.',
|
|
913
913
|
},
|
|
914
|
-
'series-palette': {
|
|
915
|
-
since: '2.21.0',
|
|
916
|
-
promote: '2.23.0',
|
|
917
|
-
why: 'New in 2.21.0: the series file is judged by computed lightness, chroma, colour-blind separation and contrast; a palette that was tuned by eye is newly a finding.',
|
|
918
|
-
},
|
|
919
914
|
}
|
|
920
915
|
|
|
921
916
|
/** A kind's effective severity: consumer override first, then the grace table, then `error`. */
|
package/src/guard/vx-names.ts
CHANGED
|
@@ -203,6 +203,8 @@ export const BASALT_VX_NAMES: readonly string[] = [
|
|
|
203
203
|
'--vx-surface-overlay',
|
|
204
204
|
'--vx-surface-panel',
|
|
205
205
|
'--vx-surface-panel-hover',
|
|
206
|
+
'--vx-surface-row-hover',
|
|
207
|
+
'--vx-surface-row-selected',
|
|
206
208
|
'--vx-surface-subtle',
|
|
207
209
|
'--vx-text-display',
|
|
208
210
|
'--vx-text-h1',
|
package/src/index.ts
CHANGED
package/src/styles.css
CHANGED
|
@@ -31,6 +31,21 @@
|
|
|
31
31
|
@import '@fontsource-variable/hubot-sans';
|
|
32
32
|
@import '@fontsource-variable/jetbrains-mono';
|
|
33
33
|
|
|
34
|
+
/* Hubot Sans has no `zero` OpenType feature and its default zero is slashed, so a head-face "2026" or
|
|
35
|
+
* "90 days" cannot be fixed with `font-feature-settings`. Digits come from the sans instead: this
|
|
36
|
+
* face covers U+0030-0039 only, cut from the Nunito Sans variable file, and leads
|
|
37
|
+
* `--basalt-font-head`, so Hubot draws every letter and Nunito every digit. */
|
|
38
|
+
@font-face {
|
|
39
|
+
/* theme-allow raw-font-family — declares the face, uses nothing */
|
|
40
|
+
font-family: 'Basalt Head Digits';
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-display: swap;
|
|
43
|
+
font-weight: 200 1000;
|
|
44
|
+
src: url('@fontsource-variable/nunito-sans/files/nunito-sans-latin-wght-normal.woff2')
|
|
45
|
+
format('woff2-variations');
|
|
46
|
+
unicode-range: U+0030-0039;
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
/* Font stack — overridable via the --basalt-font-* custom properties. */
|
|
35
50
|
@layer base {
|
|
36
51
|
:root {
|
|
@@ -42,9 +57,10 @@
|
|
|
42
57
|
--basalt-font-sans:
|
|
43
58
|
'Nunito Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
|
|
44
59
|
Helvetica, Arial, sans-serif;
|
|
60
|
+
/* A consumer that sets its own head family replaces this stack, digit face included, by design. */
|
|
45
61
|
--basalt-font-head:
|
|
46
|
-
'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system,
|
|
47
|
-
Arial, sans-serif;
|
|
62
|
+
'Basalt Head Digits', 'Hubot Sans Variable', ui-sans-serif, system-ui, -apple-system,
|
|
63
|
+
'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
48
64
|
--basalt-font-mono: 'JetBrains Mono Variable', ui-monospace, 'SF Mono', Menlo, monospace;
|
|
49
65
|
/* Hero values, unit/count/delta text, bar-list and meter figures: proportional sans, lining
|
|
50
66
|
figures. Set to `var(--basalt-font-mono)` to restore the pre-Wave-35 mono numerals. */
|
|
@@ -67,6 +83,23 @@
|
|
|
67
83
|
text-size-adjust: 100%;
|
|
68
84
|
}
|
|
69
85
|
|
|
86
|
+
/* Mono data text drops its ligatures: `<>` in a facts line is two characters, not a diamond. Reaches
|
|
87
|
+
the mono stack by element (code, kbd, samp, pre), by contract (`data-numeric`, `data-monospace`),
|
|
88
|
+
by Mantine's `ff="monospace"` inline style, and by the stack's own var in an inline style. Body
|
|
89
|
+
sans keeps its ligatures. A CSS-module class that only sets the mono family is out of reach. */
|
|
90
|
+
code,
|
|
91
|
+
kbd,
|
|
92
|
+
samp,
|
|
93
|
+
pre,
|
|
94
|
+
[data-numeric],
|
|
95
|
+
[data-monospace],
|
|
96
|
+
[style*='font-family-monospace'],
|
|
97
|
+
[style*='basalt-font-mono'],
|
|
98
|
+
.mantine-Code-root,
|
|
99
|
+
.mantine-Kbd-root {
|
|
100
|
+
font-variant-ligatures: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
70
103
|
/* Removes the grey tap-highlight flash on iOS/Android for anything actually tappable. Scoped to
|
|
71
104
|
the interactive roles/tags rather than `*` (argo's own rule): a highlight on non-interactive
|
|
72
105
|
content is not the flash this exists to remove, and `*` would also numb a consumer's own
|
|
@@ -144,6 +177,14 @@
|
|
|
144
177
|
outline-color: var(--vx-accent);
|
|
145
178
|
}
|
|
146
179
|
|
|
180
|
+
/* The chart host is a focusable element Mantine does not own, so no `mantine-focus-*` class reaches
|
|
181
|
+
it and the UA ring paints instead: a white double ring in dark (argo strength strip and
|
|
182
|
+
diagnostics at dark 390). There is no media or pointer branch behind it. */
|
|
183
|
+
.basalt-chart:focus-visible {
|
|
184
|
+
outline: 2px solid var(--vx-accent);
|
|
185
|
+
outline-offset: calc(0.125rem * var(--mantine-scale));
|
|
186
|
+
}
|
|
187
|
+
|
|
147
188
|
/* Hubot Sans is a condensed display face — the spec pins it at 88% font-stretch everywhere it
|
|
148
189
|
lands (headings + the Mantine Title component). Read from the knob declared above rather than
|
|
149
190
|
hardcoded here, so a consumer retunes it in one declaration instead of fighting these bare
|
|
@@ -156,8 +197,6 @@
|
|
|
156
197
|
h6,
|
|
157
198
|
.mantine-Title-root {
|
|
158
199
|
font-stretch: var(--basalt-font-head-stretch, 88%);
|
|
159
|
-
/* Hubot Sans draws a slashed zero by default; a heading numeral is a figure, not code. */
|
|
160
|
-
font-feature-settings: 'zero' 0;
|
|
161
200
|
font-variant-numeric: lining-nums;
|
|
162
201
|
}
|
|
163
202
|
|