basalt-ui 2.19.0 → 2.21.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 +89 -0
- package/MIGRATING.md +291 -12
- package/agent/agents/basalt-design-reviewer.md +22 -5
- package/agent/rules/basalt-charts.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 +1 -1
- package/agent/skills/basalt-design/SKILL.md +10 -23
- package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
- package/agent/skills/basalt-design/references/catalogue.md +48 -0
- package/agent/skills/basalt-design/references/concept.md +36 -0
- package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
- package/agent/skills/basalt-design/references/stat-tile.md +24 -0
- package/agent/templates/AGENTS-block.md.tpl +3 -3
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/configs/oxlint-plugin.js +34 -19
- package/configs/oxlint-plugin.test.ts +32 -2
- package/dist/charts/ChartCard.d.ts +33 -4
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +37 -11
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +13 -1
- package/dist/charts/Heatmap.js +1 -1
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +137 -18
- package/dist/charts/box.d.ts +2 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +2 -0
- package/dist/charts/chart-box.module.css +30 -0
- package/dist/charts/chart-box.module.css.d.ts +1 -0
- package/dist/charts/chart-card.module.css +47 -0
- package/dist/charts/chart-card.module.css.d.ts +7 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +35 -8
- package/dist/charts/host.d.ts.map +1 -1
- package/dist/charts/host.js +2 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/sparkline.module.css +59 -0
- package/dist/charts/sparkline.module.css.d.ts +13 -0
- package/dist/charts/state.d.ts +5 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +34 -4
- package/dist/charts/types.d.ts +6 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/check-theme.d.ts.map +1 -1
- package/dist/cli/check-theme.js +3 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +3 -2
- package/dist/cli/index.d.ts +4 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +27 -15
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +3 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +6 -1
- package/dist/cli/shot/detect.d.ts +51 -0
- package/dist/cli/shot/detect.d.ts.map +1 -0
- package/dist/cli/shot/detect.js +396 -0
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +7 -4
- package/dist/cli/shot/measure.d.ts +2 -0
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +2 -0
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/shot/types.js +2 -0
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -2
- package/dist/common/retry-button.d.ts +12 -0
- package/dist/common/retry-button.d.ts.map +1 -0
- package/dist/common/retry-button.js +22 -0
- package/dist/common/retry-button.module.css +58 -0
- package/dist/common/retry-button.module.css.d.ts +8 -0
- package/dist/controls/sync-button.d.ts +3 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/dashboard/bar-list.d.ts +18 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +39 -15
- package/dist/dashboard/bar-list.module.css +77 -2
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/delta-badge.d.ts +8 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +9 -2
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +53 -6
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +62 -14
- package/dist/dashboard/meter-parts.d.ts +5 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +140 -68
- package/dist/dashboard/meter.d.ts +29 -4
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +8 -1
- package/dist/dashboard/meter.module.css +74 -43
- package/dist/dashboard/meter.module.css.d.ts +4 -4
- package/dist/dashboard/query-state.d.ts +1 -1
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +16 -10
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +14 -25
- package/dist/dashboard/stat-card-parts.js +1 -1
- package/dist/dashboard/stat-card.d.ts +1 -1
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +5 -7
- package/dist/dashboard/stat-card.module.css +15 -7
- package/dist/dashboard/stat-group.d.ts +11 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +9 -7
- package/dist/dashboard/stat-strip.d.ts +67 -0
- package/dist/dashboard/stat-strip.d.ts.map +1 -0
- package/dist/dashboard/stat-strip.js +115 -0
- package/dist/dashboard/stat-strip.module.css +291 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +32 -0
- package/dist/dashboard/visual-slot.d.ts +2 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -0
- package/dist/dashboard/visual-slot.js +5 -0
- package/dist/dashboard/widget-header.d.ts +3 -3
- package/dist/dashboard/widget-header.module.css +10 -6
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +4 -3
- package/dist/format/shared.d.ts +6 -0
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +6 -2
- package/dist/guard/index.d.ts +16 -3
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +15 -1
- package/dist/guard/palette.d.ts +51 -0
- package/dist/guard/palette.d.ts.map +1 -0
- package/dist/guard/palette.js +190 -0
- package/dist/guard/series-file.d.ts +15 -0
- package/dist/guard/series-file.d.ts.map +1 -0
- package/dist/guard/series-file.js +29 -0
- package/dist/guard/types.d.ts +3 -3
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +6 -0
- package/dist/surfaces.d.ts +1 -1
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/dist/theme/card-inset.module.css +76 -0
- package/dist/theme/card-inset.module.css.d.ts +9 -0
- package/dist/theme/controls.module.css +13 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +41 -0
- package/dist/theme/nav-link.module.css +8 -10
- package/dist/theme/status-dot.d.ts +3 -2
- package/dist/theme/status-dot.d.ts.map +1 -1
- package/dist/theme/status-dot.js +12 -3
- package/dist/theme/status-verdict.d.ts +3 -2
- package/dist/theme/status-verdict.d.ts.map +1 -1
- package/dist/theme/status-verdict.js +3 -2
- package/dist/theme/status-verdict.module.css +4 -2
- package/dist/tokens/oklab.d.ts +28 -0
- package/dist/tokens/oklab.d.ts.map +1 -0
- package/dist/tokens/oklab.js +73 -0
- package/llms.txt +33 -7
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +79 -5
- package/src/charts/Donut.tsx +9 -1
- package/src/charts/Heatmap.tsx +1 -1
- package/src/charts/Sparkline.tsx +180 -18
- package/src/charts/box.tsx +2 -0
- package/src/charts/chart-box.module.css +30 -0
- package/src/charts/chart-box.module.css.d.ts +1 -0
- package/src/charts/chart-card.module.css +47 -0
- package/src/charts/chart-card.module.css.d.ts +7 -0
- package/src/charts/compile.ts +42 -9
- package/src/charts/host.tsx +6 -3
- package/src/charts/index.ts +1 -1
- package/src/charts/sparkline.module.css +59 -0
- package/src/charts/sparkline.module.css.d.ts +13 -0
- package/src/charts/state.tsx +53 -4
- package/src/charts/types.ts +6 -0
- package/src/cli/check-theme.ts +3 -0
- package/src/cli/help.ts +18 -1
- package/src/cli/index.ts +48 -17
- package/src/cli/init.ts +2 -1
- package/src/cli/shot/capture.ts +15 -2
- package/src/cli/shot/detect.ts +533 -0
- package/src/cli/shot/index.ts +8 -4
- package/src/cli/shot/measure.ts +4 -0
- package/src/cli/shot/types.ts +5 -1
- package/src/cli/sync.ts +4 -2
- package/src/common/retry-button.module.css +58 -0
- package/src/common/retry-button.module.css.d.ts +8 -0
- package/src/common/retry-button.tsx +29 -0
- package/src/controls/sync-button.tsx +3 -0
- package/src/dashboard/bar-list.module.css +77 -2
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +89 -18
- package/src/dashboard/delta-badge.tsx +21 -5
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +126 -20
- package/src/dashboard/meter-parts.tsx +224 -88
- package/src/dashboard/meter.module.css +74 -43
- package/src/dashboard/meter.module.css.d.ts +4 -4
- package/src/dashboard/meter.tsx +39 -5
- package/src/dashboard/query-state.tsx +26 -20
- package/src/dashboard/settings-section.tsx +1 -8
- package/src/dashboard/stat-card-parts.tsx +1 -1
- package/src/dashboard/stat-card.module.css +15 -7
- package/src/dashboard/stat-card.tsx +9 -9
- package/src/dashboard/stat-group.tsx +19 -8
- package/src/dashboard/stat-strip.module.css +291 -0
- package/src/dashboard/stat-strip.module.css.d.ts +32 -0
- package/src/dashboard/stat-strip.tsx +263 -0
- package/src/dashboard/visual-slot.ts +8 -0
- package/src/dashboard/widget-header.module.css +10 -6
- package/src/dashboard/widget-header.tsx +3 -3
- package/src/format/date.ts +6 -3
- package/src/format/shared.ts +11 -2
- package/src/guard/index.ts +17 -5
- package/src/guard/palette.ts +261 -0
- package/src/guard/series-file.ts +51 -0
- package/src/guard/types.ts +3 -2
- package/src/index.ts +7 -0
- package/src/styles.css +6 -0
- package/src/surfaces.ts +2 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +202 -24
- package/src/theme/card-inset.module.css +76 -0
- package/src/theme/card-inset.module.css.d.ts +9 -0
- package/src/theme/controls.module.css +13 -0
- package/src/theme/index.ts +56 -0
- package/src/theme/nav-link.module.css +8 -10
- package/src/theme/status-dot.tsx +17 -5
- package/src/theme/status-verdict.module.css +4 -2
- package/src/theme/status-verdict.tsx +9 -4
- package/src/tokens/oklab.ts +97 -0
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `StatusVerdict` — a `StatusDot` plus its word in muted ink. With `phrase`, the visible word is
|
|
3
3
|
* hidden from assistive tech and the full phrase is read instead, so a screen reader never hears a
|
|
4
|
-
* bare "Over".
|
|
4
|
+
* bare "Over". Exported from the root; `StatCard` and the notification centre compose it.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <StatusVerdict color={VX.status.error} word="Over" phrase="Over budget" />
|
|
5
8
|
*/
|
|
9
|
+
import { cx } from '../common/props'
|
|
10
|
+
import type { BasaltProps } from '../common/props'
|
|
6
11
|
import { StatusDot } from './status-dot'
|
|
7
12
|
import classes from './status-verdict.module.css'
|
|
8
13
|
|
|
9
|
-
export type StatusVerdictProps = {
|
|
14
|
+
export type StatusVerdictProps = BasaltProps & {
|
|
10
15
|
color: string
|
|
11
16
|
/** The short visible word ("Over", "Error"). */
|
|
12
17
|
word: string
|
|
@@ -14,9 +19,9 @@ export type StatusVerdictProps = {
|
|
|
14
19
|
phrase?: string
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
export function StatusVerdict({ color, word, phrase }: StatusVerdictProps) {
|
|
22
|
+
export function StatusVerdict({ color, word, phrase, className, style }: StatusVerdictProps) {
|
|
18
23
|
return (
|
|
19
|
-
<span className={classes.verdict}>
|
|
24
|
+
<span className={cx(classes.verdict, className)} {...(style !== undefined && { style })}>
|
|
20
25
|
<StatusDot color={color} />
|
|
21
26
|
<span data-verdict-word="" {...(phrase !== undefined && { 'aria-hidden': true })}>
|
|
22
27
|
{word}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OKLab / OKLCH and colour-vision-deficiency simulation — Mantine-free, dependency-free.
|
|
3
|
+
*
|
|
4
|
+
* OKLab is Ottosson's definition (https://bottosson.github.io/posts/oklab/); the CVD matrices are
|
|
5
|
+
* Machado, Oliveira & Fernandes (2009), "A Physiologically-based Model for Simulation of Color
|
|
6
|
+
* Vision Deficiency", severity 1.0, applied to LINEAR sRGB. `deltaEOk` is the Euclidean OKLab
|
|
7
|
+
* distance ×100, the unit the series-palette guard's thresholds are written in.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type Oklab = { L: number; a: number; b: number }
|
|
11
|
+
export type Oklch = { L: number; C: number; h: number }
|
|
12
|
+
export type CvdKind = 'protan' | 'deutan'
|
|
13
|
+
|
|
14
|
+
type Rgb = readonly [number, number, number]
|
|
15
|
+
type Matrix = readonly [Rgb, Rgb, Rgb]
|
|
16
|
+
|
|
17
|
+
const MACHADO: Record<CvdKind, Matrix> = {
|
|
18
|
+
protan: [
|
|
19
|
+
[0.152286, 1.052583, -0.204868],
|
|
20
|
+
[0.114503, 0.786281, 0.099216],
|
|
21
|
+
[-0.003882, -0.048116, 1.051998],
|
|
22
|
+
],
|
|
23
|
+
deutan: [
|
|
24
|
+
[0.367322, 0.860646, -0.227968],
|
|
25
|
+
[0.280085, 0.672501, 0.047413],
|
|
26
|
+
[-0.01182, 0.04294, 0.968881],
|
|
27
|
+
],
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function hexToLinear(hex: string): Rgb {
|
|
31
|
+
const raw = hex.replace('#', '')
|
|
32
|
+
const full = raw.length === 3 ? [...raw].map((c) => c + c).join('') : raw.slice(0, 6)
|
|
33
|
+
const channel = (i: number) => {
|
|
34
|
+
const c = Number.parseInt(full.slice(i, i + 2), 16) / 255
|
|
35
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
|
36
|
+
}
|
|
37
|
+
return [channel(0), channel(2), channel(4)]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function linearToHex([r, g, b]: Rgb): string {
|
|
41
|
+
const encode = (c: number) => {
|
|
42
|
+
const v = Math.min(1, Math.max(0, c))
|
|
43
|
+
const s = v <= 0.0031308 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055
|
|
44
|
+
return Math.round(s * 255)
|
|
45
|
+
.toString(16)
|
|
46
|
+
.padStart(2, '0')
|
|
47
|
+
}
|
|
48
|
+
return `#${encode(r)}${encode(g)}${encode(b)}`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function linearToOklab([r, g, b]: Rgb): Oklab {
|
|
52
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
|
|
53
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
|
|
54
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
|
|
55
|
+
return {
|
|
56
|
+
L: 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
57
|
+
a: 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
58
|
+
b: 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function hexToOklab(hex: string): Oklab {
|
|
63
|
+
return linearToOklab(hexToLinear(hex))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function hexToOklch(hex: string): Oklch {
|
|
67
|
+
const { L, a, b } = hexToOklab(hex)
|
|
68
|
+
const h = (Math.atan2(b, a) * 180) / Math.PI
|
|
69
|
+
return { L, C: Math.hypot(a, b), h: h < 0 ? h + 360 : h }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Euclidean OKLab distance ×100 between two hex colours. */
|
|
73
|
+
export function deltaEOk(hexA: string, hexB: string): number {
|
|
74
|
+
const x = hexToOklab(hexA)
|
|
75
|
+
const y = hexToOklab(hexB)
|
|
76
|
+
return 100 * Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** What a dichromat sees for `hex`, still in clamped linear RGB (Machado 2009, severity 1.0). */
|
|
80
|
+
function simulateCvdLinear(hex: string, kind: CvdKind): Rgb {
|
|
81
|
+
const [r, g, b] = hexToLinear(hex)
|
|
82
|
+
const [row0, row1, row2] = MACHADO[kind]
|
|
83
|
+
const mix = (row: Rgb) => Math.min(1, Math.max(0, row[0] * r + row[1] * g + row[2] * b))
|
|
84
|
+
return [mix(row0), mix(row1), mix(row2)]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The hex a dichromat sees for `hex` — for display and tests; the checks stay in linear RGB. */
|
|
88
|
+
export function simulateCvd(hex: string, kind: CvdKind): string {
|
|
89
|
+
return linearToHex(simulateCvdLinear(hex, kind))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** OKLab ΔE×100 between two colours as a dichromat sees them — no 8-bit round trip. */
|
|
93
|
+
export function deltaEOkCvd(hexA: string, hexB: string, kind: CvdKind): number {
|
|
94
|
+
const x = linearToOklab(simulateCvdLinear(hexA, kind))
|
|
95
|
+
const y = linearToOklab(simulateCvdLinear(hexB, kind))
|
|
96
|
+
return 100 * Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b)
|
|
97
|
+
}
|