basalt-ui 2.2.0 → 2.4.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 +32 -0
- package/MIGRATING.md +78 -12
- package/agent/rules/basalt-state.md +1 -1
- package/configs/lefthook.yml +4 -1
- package/dist/charts/BandStrip.d.ts +7 -7
- package/dist/charts/BandStrip.d.ts.map +1 -1
- package/dist/charts/Bars.d.ts +4 -4
- package/dist/charts/Bars.d.ts.map +1 -1
- package/dist/charts/CartesianChart.d.ts.map +1 -1
- package/dist/charts/CartesianChart.js +6 -2
- package/dist/charts/ChartCard.d.ts +10 -10
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +2 -1
- package/dist/charts/Donut.d.ts +5 -5
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/DualPanel.d.ts +14 -10
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +32 -14
- package/dist/charts/Heatmap.d.ts +15 -15
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +2 -2
- package/dist/charts/Lines.js +2 -2
- package/dist/charts/MirroredBars.d.ts +9 -9
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +8 -7
- package/dist/charts/Sparkline.d.ts +6 -6
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/StackedArea.d.ts +2 -2
- package/dist/charts/StackedArea.d.ts.map +1 -1
- package/dist/charts/compile.d.ts +25 -2
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +204 -34
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/index.js +3 -1
- package/dist/charts/marks.d.ts +8 -0
- package/dist/charts/marks.d.ts.map +1 -1
- package/dist/charts/marks.js +22 -1
- package/dist/charts/panel.js +2 -2
- package/dist/charts/types.d.ts +101 -61
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/state/fields.d.ts +19 -3
- package/dist/state/fields.d.ts.map +1 -1
- package/dist/state/fields.js +14 -8
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/BandStrip.tsx +12 -10
- package/src/charts/Bars.tsx +4 -4
- package/src/charts/CartesianChart.tsx +7 -2
- package/src/charts/ChartCard.tsx +17 -11
- package/src/charts/Donut.tsx +5 -5
- package/src/charts/DualPanel.tsx +50 -21
- package/src/charts/Heatmap.tsx +14 -14
- package/src/charts/Lines.tsx +2 -2
- package/src/charts/MirroredBars.tsx +16 -15
- package/src/charts/Sparkline.tsx +6 -6
- package/src/charts/StackedArea.tsx +2 -2
- package/src/charts/compile.ts +285 -36
- package/src/charts/index.ts +1 -0
- package/src/charts/marks.ts +35 -1
- package/src/charts/panel.tsx +2 -2
- package/src/charts/types.ts +105 -57
- package/src/state/fields.ts +55 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
# [2.4.0](https://github.com/jkrumm/basalt-ui/compare/v2.3.0...v2.4.0) (2026-10-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* guard band edge rules in one place and share the tooltip row builders ([75a386b](https://github.com/jkrumm/basalt-ui/commit/75a386b677518e24fc7b13ab7c49c3469c1aaa9d))
|
|
7
|
+
* let the managed pre-commit pass when every staged file is lint-ignored ([dbaa6bc](https://github.com/jkrumm/basalt-ui/commit/dbaa6bce1ea0eefbecee0666ea94c656f81d5b18))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* connect a series across null rows ([3c14ed1](https://github.com/jkrumm/basalt-ui/commit/3c14ed18583710c9b742cd5fa0139c75c06beb4d))
|
|
13
|
+
* cursor dots for marks-drawn series and edge rules on bands ([27bb5b2](https://github.com/jkrumm/basalt-ui/commit/27bb5b228e6212f9e86737aa7868ed375fd66cda))
|
|
14
|
+
* dashed tooltip swatches for reference and dashed series ([5938eb8](https://github.com/jkrumm/basalt-ui/commit/5938eb859fb571a527394b157ab47614406b5444))
|
|
15
|
+
* let a store field take a fallback derived at the call site ([3c12371](https://github.com/jkrumm/basalt-ui/commit/3c12371536a73b45418b1f75ff3479fa4012bd23))
|
|
16
|
+
* reference lines name themselves in the legend ([b49ae5b](https://github.com/jkrumm/basalt-ui/commit/b49ae5bb0317aa99f02e33bcb72f5f493351ddd9))
|
|
17
|
+
* tooltipFormat on the DualPanel bar and top specs ([bde88fe](https://github.com/jkrumm/basalt-ui/commit/bde88fe59de3cdc931a94ed52a696cec3987ab86))
|
|
18
|
+
|
|
19
|
+
# [2.3.0](https://github.com/jkrumm/basalt-ui/compare/v2.2.0...v2.3.0) (2026-10-14)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* accept an explicit undefined on every optional chart prop ([e65ca44](https://github.com/jkrumm/basalt-ui/commit/e65ca447c40d9e38c162e35ca2a2fb98ece43ddf))
|
|
25
|
+
* widen the remaining optional chart props and guard every kind ([fbdb293](https://github.com/jkrumm/basalt-ui/commit/fbdb29371ce7c355a732b8e7f03e5dfd78dcf0be))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* export chartCurve so CartesianChart marks can select a curve ([f4ed0b4](https://github.com/jkrumm/basalt-ui/commit/f4ed0b4aaa9e98f55f919ee5547842df7c57d0ae))
|
|
31
|
+
* zone-coloured area fill via ChartSeries.area 'zones' ([14da3a0](https://github.com/jkrumm/basalt-ui/commit/14da3a08628a644e4fa0ef2f75af35f41aabad0e))
|
|
32
|
+
|
|
1
33
|
# [2.2.0](https://github.com/jkrumm/basalt-ui/compare/v2.1.0...v2.2.0) (2026-10-14)
|
|
2
34
|
|
|
3
35
|
|
package/MIGRATING.md
CHANGED
|
@@ -66,18 +66,18 @@ There is one row per SURFACE, not per export, and a surface earns a row once any
|
|
|
66
66
|
shipped lefthook preset both changed in 1.30.0 with no row that owned them — which is how a
|
|
67
67
|
consumer read this index, found nothing, and diffed a KPI row that had silently gone 4-up → 2-up.
|
|
68
68
|
|
|
69
|
-
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | Unreleased |
|
|
70
|
-
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
-
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
72
|
-
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
73
|
-
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
74
|
-
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
-
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
76
|
-
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
-
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
78
|
-
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
-
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — |
|
|
80
|
-
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
69
|
+
| Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | 2.3.0 | 2.4.0 | Unreleased |
|
|
70
|
+
| ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
71
|
+
| **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
72
|
+
| **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
73
|
+
| **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
74
|
+
| **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
75
|
+
| **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
76
|
+
| **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
77
|
+
| **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
78
|
+
| **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
79
|
+
| **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — | — | — |
|
|
80
|
+
| **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
@@ -992,6 +992,72 @@ optional, subpath-required peers.
|
|
|
992
992
|
_Nothing yet. Author the next section under this heading as `## Unreleased — <title>`; the
|
|
993
993
|
release renames it and opens a new one here._
|
|
994
994
|
|
|
995
|
+
## 2.4.0 — chart gaps and legends, local-store fallbacks, the pre-commit hook
|
|
996
|
+
|
|
997
|
+
All additive; no call site changes. Named consumers are argo `apps/dashboard/src/features/…`.
|
|
998
|
+
|
|
999
|
+
- `createLocalStore` fields take `use({ fallback })`: a call-site default (e.g. a prop-derived
|
|
1000
|
+
leader) that applies only while the field is unset and is never persisted, so a reset returns to
|
|
1001
|
+
it. Replace a store rebuilt per prop with it. `createSearchStore` fields do not take it yet.
|
|
1002
|
+
- The managed lefthook oxlint step passes `--no-error-on-unmatched-pattern`, so a commit whose
|
|
1003
|
+
staged files are all in `ignorePatterns` no longer fails; a real lint error still does. Picked up
|
|
1004
|
+
through the extended preset.
|
|
1005
|
+
|
|
1006
|
+
- `ChartTooltipRow` takes `swatch: 'solid' | 'dashed'`. A series with `dash: 'dashed'` now lists a
|
|
1007
|
+
dashed swatch in its own tooltip row on `CartesianChart`, `Lines`, `Bars` and `DualPanel` (it was
|
|
1008
|
+
solid while the legend and the line were dashed), and a `tooltip.rows` entry sets it itself. A
|
|
1009
|
+
`color` per point needs no new option: `tooltip.rows(d)` already receives the datum, so the row's
|
|
1010
|
+
`color` can be a function of it (garmin-health `recovery-trend-chart.tsx`, its `Zone` row). argo:
|
|
1011
|
+
`garmin-health/charts/stress-chart.tsx` (the dashed `Overnight` line).
|
|
1012
|
+
- `RefLine.legend: { label, mark? }` gives a reference line its own legend entry (the line's color,
|
|
1013
|
+
dashed as `dashed`, role `reference`; a toggle hides the line, keyed by its index in `refLines`; series keys starting `__ref-` are reserved and throw in dev), so a threshold needs no always-`null`
|
|
1014
|
+
series. argo `strength-tracker/charts/weekly-volume-chart.tsx`: delete `LANDMARK_LEGEND` and put
|
|
1015
|
+
`legend: { label: 'MEV' }` on the three `refLines`.
|
|
1016
|
+
- `DualPanelBar.tooltipFormat` and `DualPanelProps.top.tooltipFormat` format the tooltip rows while
|
|
1017
|
+
`format` keeps the axis ticks (default: `format`; `formatValue` still wins per row). argo
|
|
1018
|
+
`strength-tracker/charts/momentum-chart.tsx`: drop the separate `formatValue` copy of the axis format.
|
|
1019
|
+
- `ChartSeries.cursorValue: (d) => number | null` gives a series drawn from your own `marks` a cursor
|
|
1020
|
+
dot: the y at each datum, shown while the cursor is on that x, in the series color. Pass a series
|
|
1021
|
+
with `getValue: () => null` (no tooltip row) and the mark stays yours. argo
|
|
1022
|
+
`astro-window/charts/sky-panorama.tsx` (the sun track).
|
|
1023
|
+
- `ZoneSpec.edge` (`side: 'top' | 'bottom' | 'both'`) and `XZoneSpec.edge` (`'start' | 'end' | 'both'`)
|
|
1024
|
+
draw a rule along the band's boundary, with `color`, `dashed` and `width`. A bound at the plot edge
|
|
1025
|
+
(infinite, outside the domain, or an omitted x bound) draws none. argo
|
|
1026
|
+
`astro-window/charts/night-timeline-chart.tsx`: the shooting-window `rect` + two `ruleX` become one
|
|
1027
|
+
`xZones` entry with `edge: { side: 'both', color: VX.accent, width: 2 }`.
|
|
1028
|
+
- `ChartSeries.gaps: 'break' | 'connect'` (`Lines`; default `'break'`, today's behaviour). `'connect'`
|
|
1029
|
+
draws the line, and its `area`, through the series' non-null points only, so a series that is null
|
|
1030
|
+
on most shared x values is one continuous line instead of dots and stubs. Markers stay on real
|
|
1031
|
+
points; the cursor and tooltip read the value at the hovered x (no value, no row). argo
|
|
1032
|
+
`strength-tracker/charts/relative-progression-chart.tsx` and `one-rm-trend-chart.tsx`: set
|
|
1033
|
+
`gaps: 'connect'` on each lift's series.
|
|
1034
|
+
- Not added: a per-datum `fill` for the engine's `rect`. `@tanstack/charts` 1.1.0 types `RectOptions.fill`
|
|
1035
|
+
as a `string`; its `color` channel resolves through the chart's own color scale, which `marks` cannot
|
|
1036
|
+
reach. Keep one `rect` per fill bucket (argo `astro-window/charts/sky-panorama.tsx`, skyglow).
|
|
1037
|
+
- The night-timeline lines can use `chartCurve(s.curve ?? 'monotone')` from 2.3.0 unchanged; nothing
|
|
1038
|
+
is missing there.
|
|
1039
|
+
|
|
1040
|
+
## 2.3.0 — optional-safe chart props, `chartCurve`, zone-coloured area
|
|
1041
|
+
|
|
1042
|
+
- Every optional prop of `ChartState`, `ChartSeries`, `AxisConfig`, the tooltip config and the chart
|
|
1043
|
+
kinds' own props accepts an explicit `undefined` under `exactOptionalPropertyTypes`, so
|
|
1044
|
+
`state={{ empty: rows.length === 0 ? 'No runs' : undefined }}` type-checks where it needed
|
|
1045
|
+
`cond ? msg : false`. Widening only: no call site changes.
|
|
1046
|
+
- `basalt-ui/charts` exports `chartCurve(name)` and the `CurveName` union (`'monotone'`, `'linear'`,
|
|
1047
|
+
`'step'`, `'stepAfter'`, `'stepBefore'`). A `CartesianChart` `marks` function passes it to the
|
|
1048
|
+
engine mark: `lineY(rows, { x: 'x', y: 'y', curve: chartCurve('monotone') })`. `Lines` already took
|
|
1049
|
+
`ChartSeries.curve` (default `'monotone'`); a hand-written `lineY` without `curve` still draws the
|
|
1050
|
+
engine's default, so argo's fitness-trends RHR/HRV lines add the option there.
|
|
1051
|
+
- `ChartSeries.area` takes `'zones'` (`Lines`): the fill is a vertical gradient coloured by the
|
|
1052
|
+
chart's `zones` on the series' axis, with hard stops at the zone boundaries and the usual area
|
|
1053
|
+
fade strength, light and dark through the zone tokens. Offsets are fractions of the area's own box
|
|
1054
|
+
(the engine's gradients use `objectBoundingBox` units, not `userSpaceOnUse`), computed from the
|
|
1055
|
+
series' values (the area closes to 0 even when the y domain excludes it), so the boundaries land at
|
|
1056
|
+
the zone values on a linear axis. A right-axis series takes the zones with `axisSide: 'right'`
|
|
1057
|
+
(and the left ones when the chart has no `y2`, as the zone underlay does). With no zone in reach the
|
|
1058
|
+
series-colour fade is kept. On a log axis it throws in dev and keeps the fade in production. argo's stress chart: `area: 'zones'` plus its four zones replaces
|
|
1059
|
+
the plain series area and the `thresholds` fill above 75.
|
|
1060
|
+
|
|
995
1061
|
## 2.2.0 — `doctor` in a monorepo, sparkline state, heatmap ticks
|
|
996
1062
|
|
|
997
1063
|
- `Sparkline` takes the same `state` as the other chart kinds (pending fills its box, error and
|
|
@@ -24,7 +24,7 @@ State a control reads or writes is a field on a store; the URL wins over localSt
|
|
|
24
24
|
- Option labels come from `.labels()` at definition, never a control prop. [type createSearchStore]
|
|
25
25
|
- Route `validateSearch` is `store.validateSearch`; a wider search shape spreads `...store.validateSearch(raw)`. [type createSearchStore]
|
|
26
26
|
- Read with `store.useValues()` or take the value as a prop; never `useSearch({ from: '<literal>' })`. [basalt/use-search-from-literal]
|
|
27
|
-
- A handle's `use()` returns `[value, setValue]`; the setter owns the navigate and the persist. [type field]
|
|
27
|
+
- A handle's `use()` returns `[value, setValue]`; the setter owns the navigate and the persist; on a `createLocalStore` field a prop-derived default is `use({ fallback })` (unset only, never persisted; search stores lack it), never a store rebuilt per prop. [type field]
|
|
28
28
|
- Count active filters and reset them with the store's `useActiveCount()` and `useReset()`; a reset unsets, it does not write the fallback. [type createSearchStore]
|
|
29
29
|
- A color scheme is `useMantineColorScheme()`, never a store or `localStorage['theme']`. [check-theme localstorage-theme]
|
|
30
30
|
- A preference that must survive navigation but is not URL-worthy uses `createPersistedState`, called once at module scope. [type createPersistedState]
|
package/configs/lefthook.yml
CHANGED
|
@@ -37,9 +37,12 @@
|
|
|
37
37
|
pre-commit:
|
|
38
38
|
parallel: true
|
|
39
39
|
commands:
|
|
40
|
+
# `--no-error-on-unmatched-pattern`: oxlint exits 1 ("No files found to lint") when EVERY staged
|
|
41
|
+
# file is excluded by `ignorePatterns` (a consumer's `scripts/`), failing a commit that touches
|
|
42
|
+
# only ignored files. A real error in a non-ignored staged file still fails.
|
|
40
43
|
oxlint:
|
|
41
44
|
glob: '*.{ts,tsx,js,jsx}'
|
|
42
|
-
run: bunx oxlint {staged_files}
|
|
45
|
+
run: bunx oxlint --no-error-on-unmatched-pattern {staged_files}
|
|
43
46
|
# `css` is load-bearing, not tidiness: oxfmt formats stylesheets, so without it a CSS-only
|
|
44
47
|
# commit passes the hook and then fails the same check in CI. `oxlint` above deliberately
|
|
45
48
|
# stops at JS — it has nothing to say about CSS.
|
|
@@ -6,29 +6,29 @@ export type BandStripSeries<T> = Pick<ChartSeries<T>, 'key' | 'label' | 'color'
|
|
|
6
6
|
* The tooltip row's value for a band in this state. `null` is an ABSENT reading and renders an
|
|
7
7
|
* em dash; omit the function when the state's name is the whole reading ("Not measured").
|
|
8
8
|
*/
|
|
9
|
-
formatValue?: (d: T) => string | null;
|
|
9
|
+
formatValue?: ((d: T) => string | null) | undefined;
|
|
10
10
|
};
|
|
11
11
|
/** One band: its state, and the two ways to qualify it. */
|
|
12
12
|
export type BandSpan = {
|
|
13
13
|
/** A `states` key: the band's legend entry, fill and tooltip row. */
|
|
14
14
|
state: string;
|
|
15
15
|
/** Overrides the state's fill — an intensity ramp WITHIN a state. `alpha(VX.*, …)`, never a hex. */
|
|
16
|
-
fill?: string;
|
|
16
|
+
fill?: string | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* A shorter, inset bar over the band, for a fact that must not be read off the fill ramp (a
|
|
19
19
|
* renegotiation, a restart). Its color is a `states` entry, so the legend names it.
|
|
20
20
|
*/
|
|
21
21
|
marker?: {
|
|
22
22
|
/** Defaults to the band's own `state`. */
|
|
23
|
-
state?: string;
|
|
23
|
+
state?: string | undefined;
|
|
24
24
|
/** Vertical inset from the band's top and bottom, in px. Default 6. */
|
|
25
|
-
inset?: number;
|
|
26
|
-
};
|
|
25
|
+
inset?: number | undefined;
|
|
26
|
+
} | undefined;
|
|
27
27
|
};
|
|
28
28
|
/** Collapse adjacent data where one band per datum would be thinner than `minBandPx`. */
|
|
29
29
|
export type BandFold<T> = {
|
|
30
30
|
/** Floor on a drawn band's px width. Default 3. */
|
|
31
|
-
minBandPx?: number;
|
|
31
|
+
minBandPx?: number | undefined;
|
|
32
32
|
/**
|
|
33
33
|
* The consumer's merge of a group of adjacent data into the datum drawn in its place — whether
|
|
34
34
|
* that is a max, a sum or a recomputed rate is a question about the measurement. Keep the first
|
|
@@ -40,7 +40,7 @@ export type BandStripProps<T, X extends ChartX = ChartX> = Omit<CartesianChartPr
|
|
|
40
40
|
states: readonly BandStripSeries<T>[];
|
|
41
41
|
/** Which state, fill and marker each datum has. Memoize it: a new function recompiles the chart. */
|
|
42
42
|
getBand: (d: T) => BandSpan;
|
|
43
|
-
fold?: BandFold<T
|
|
43
|
+
fold?: BandFold<T> | undefined;
|
|
44
44
|
};
|
|
45
45
|
export declare function BandStrip<T, X extends ChartX = ChartX>(props: BandStripProps<T, X>): ReactElement;
|
|
46
46
|
//# sourceMappingURL=BandStrip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BandStrip.d.ts","sourceRoot":"","sources":["../../src/charts/BandStrip.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAOzC,OAAO,KAAK,EAEV,mBAAmB,EAEnB,WAAW,EACX,MAAM,EAGP,MAAM,SAAS,CAAA;AAEhB,gGAAgG;AAChG,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CACnC,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAC1E,GAAG;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"BandStrip.d.ts","sourceRoot":"","sources":["../../src/charts/BandStrip.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAOzC,OAAO,KAAK,EAEV,mBAA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IACpG,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAA;IAC3B,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CAC/B,CAAA;AAuHD,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CA0EjG"}
|
package/dist/charts/Bars.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ import type { CartesianChartProps, ChartSeries, ChartX } from './types.js';
|
|
|
3
3
|
/** A bar series. Bars always read the left axis. */
|
|
4
4
|
export type BarsBar<T> = Pick<ChartSeries<T>, 'key' | 'label' | 'color' | 'getValue' | 'formatValue' | 'tooltip' | 'legend' | 'role' | 'note'> & {
|
|
5
5
|
/** Default 0.85. */
|
|
6
|
-
fillOpacity?: number;
|
|
6
|
+
fillOpacity?: number | undefined;
|
|
7
7
|
};
|
|
8
8
|
/** A line overlay; `axis: 'right'` reads the chart's `y2`. */
|
|
9
9
|
export type BarsLine<T> = Pick<ChartSeries<T>, 'key' | 'label' | 'color' | 'getValue' | 'formatValue' | 'tooltip' | 'legend' | 'role' | 'note' | 'axis' | 'dash' | 'curve' | 'strokeWidth' | 'strokeOpacity'>;
|
|
10
10
|
export type BarsProps<T, X extends ChartX = ChartX> = Omit<CartesianChartProps<T, X>, 'marks' | 'series'> & {
|
|
11
11
|
bars: readonly BarsBar<T>[];
|
|
12
|
-
lines?: readonly BarsLine<T>[];
|
|
12
|
+
lines?: readonly BarsLine<T>[] | undefined;
|
|
13
13
|
/** Default `'stacked'`. `'normalized'` stacks each x to its share of the total. */
|
|
14
|
-
layout?: 'stacked' | 'grouped' | 'normalized';
|
|
14
|
+
layout?: 'stacked' | 'grouped' | 'normalized' | undefined;
|
|
15
15
|
/** Per-bar opacity (a partial week, an estimate). Overrides the series' `fillOpacity`. */
|
|
16
|
-
barOpacity?: (d: T, key: string) => number;
|
|
16
|
+
barOpacity?: ((d: T, key: string) => number) | undefined;
|
|
17
17
|
};
|
|
18
18
|
export declare function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): ReactElement;
|
|
19
19
|
//# sourceMappingURL=Bars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bars.d.ts","sourceRoot":"","sources":["../../src/charts/Bars.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EACV,mBAAmB,EAEnB,WAAW,EACX,MAAM,EAGP,MAAM,SAAS,CAAA;AAEhB,oDAAoD;AACpD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,IAAI,CAC3B,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChG,GAAG;IACF,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Bars.d.ts","sourceRoot":"","sources":["../../src/charts/Bars.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EACV,mBAAmB,EAEnB,WAAW,EACX,MAAM,EAGP,MAAM,SAAS,CAAA;AAEhB,oDAAoD;AACpD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,IAAI,CAC3B,WAAW,CAAC,CAAC,CAAC,EACd,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChG,GAAG;IACF,oBAAoB;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,CA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uErE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC/C,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,GAC7C,YAAY,CAwBd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAChD,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,YAAY,CAEd"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useId, useMemo, useState } from "react";
|
|
3
3
|
import { useInChartCard } from "./card-context.js";
|
|
4
|
-
import { compileCartesian } from "./compile.js";
|
|
4
|
+
import { compileCartesian, refLegendSeries } from "./compile.js";
|
|
5
5
|
import { ChartEngine, idPrefixOf } from "./host.js";
|
|
6
6
|
import { ChartLegend, legendEntries } from "./legend.js";
|
|
7
7
|
import { INITIAL_WIDTH, useChartSize } from "./sizing.js";
|
|
@@ -97,10 +97,14 @@ function CartesianRung(props) {
|
|
|
97
97
|
(ctx) => compileCartesian({ ...stable, ...ctx }),
|
|
98
98
|
[stable]
|
|
99
99
|
);
|
|
100
|
+
const legendSeries = useMemo(
|
|
101
|
+
() => [...stable.series, ...refLegendSeries(stable.refLines)],
|
|
102
|
+
[stable.series, stable.refLines]
|
|
103
|
+
);
|
|
100
104
|
return /* @__PURE__ */ jsx(
|
|
101
105
|
ChartShell,
|
|
102
106
|
{
|
|
103
|
-
series,
|
|
107
|
+
series: legendSeries,
|
|
104
108
|
compile,
|
|
105
109
|
ariaLabel,
|
|
106
110
|
...legend !== void 0 && { legend },
|
|
@@ -5,27 +5,27 @@ import type { ChartState, ResponsiveChartHeight } from './types.js';
|
|
|
5
5
|
/** The three boxes a `ChartCard` paints. */
|
|
6
6
|
export type ChartCardSlot = 'root' | 'header' | 'body';
|
|
7
7
|
export type ChartCardProps = BasaltProps & SlotStylesProps<ChartCardSlot> & {
|
|
8
|
-
title?: string;
|
|
8
|
+
title?: string | undefined;
|
|
9
9
|
icon?: ReactNode;
|
|
10
10
|
/** A muted line below the title row; does not by itself render the header. */
|
|
11
|
-
subtitle?: string;
|
|
11
|
+
subtitle?: string | undefined;
|
|
12
12
|
/** `WidgetHeader`'s info glyph beside the title. */
|
|
13
|
-
info?: string;
|
|
13
|
+
info?: string | undefined;
|
|
14
14
|
/** A pre-formatted metric value, with `delta` on the hero row. */
|
|
15
|
-
value?: string;
|
|
16
|
-
delta?: number;
|
|
17
|
-
deltaPeriod?: string;
|
|
18
|
-
deltaPolarity?: DeltaPolarity;
|
|
15
|
+
value?: string | undefined;
|
|
16
|
+
delta?: number | undefined;
|
|
17
|
+
deltaPeriod?: string | undefined;
|
|
18
|
+
deltaPolarity?: DeltaPolarity | undefined;
|
|
19
19
|
/** A mono count tag after the title. */
|
|
20
|
-
count?: number;
|
|
20
|
+
count?: number | undefined;
|
|
21
21
|
/** Right-aligned controls. */
|
|
22
22
|
actions?: ReactNode;
|
|
23
23
|
/** A resolved state replaces `children` with its placeholder; the header stays. */
|
|
24
|
-
state?: ChartState;
|
|
24
|
+
state?: ChartState | undefined;
|
|
25
25
|
/** Body height while a placeholder shows. Default: the chart height law, i.e. exactly the box an
|
|
26
26
|
* unsized chart takes — pass the chart's own `height` when it states one, so a `<Suspense
|
|
27
27
|
* fallback={<ChartCard state={{ pending: true }} …/>}>` reserves the final size. */
|
|
28
|
-
placeholderHeight?: number | ResponsiveChartHeight;
|
|
28
|
+
placeholderHeight?: number | ResponsiveChartHeight | undefined;
|
|
29
29
|
/** A retry button or a "clear filters" link under the placeholder. */
|
|
30
30
|
stateAction?: ReactNode;
|
|
31
31
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../src/charts/ChartCard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAi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,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACzC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,mFAAmF;IACnF,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC9B;;wFAEoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;IAC9D,sEAAsE;IACtE,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAWH,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,cAAc,GAAG,YAAY,CA4C/B"}
|
package/dist/charts/ChartCard.js
CHANGED
|
@@ -55,6 +55,7 @@ const bodyClipStyle = {
|
|
|
55
55
|
flexDirection: "column",
|
|
56
56
|
padding: "2px var(--vx-space-card-inset-x, 0.8125rem) var(--vx-space-card-inset-y, 0.6875rem)"
|
|
57
57
|
};
|
|
58
|
+
const definedOnly = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
58
59
|
const HEADER_TRIGGERS = ["title", "info", "value", "icon", "count"];
|
|
59
60
|
function ChartCard({
|
|
60
61
|
actions,
|
|
@@ -84,7 +85,7 @@ function ChartCard({
|
|
|
84
85
|
WidgetHeader,
|
|
85
86
|
{
|
|
86
87
|
tier: "widget",
|
|
87
|
-
...header,
|
|
88
|
+
...definedOnly(header),
|
|
88
89
|
title: header.title ?? "",
|
|
89
90
|
...actions !== void 0 && {
|
|
90
91
|
actions: /* @__PURE__ */ jsx("span", { "data-basalt-tier": "widget", children: actions })
|
package/dist/charts/Donut.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ export type DonutProps<K extends string = string> = BasaltProps & {
|
|
|
13
13
|
colorForKey: (key: K) => string;
|
|
14
14
|
formatValue: (v: number) => string;
|
|
15
15
|
/** Legend and tooltip label for a key. Default: the key. */
|
|
16
|
-
seriesLabel?: (key: K) => string;
|
|
16
|
+
seriesLabel?: ((key: K) => string) | undefined;
|
|
17
17
|
/** The ring's centre text, and the smaller line under it. */
|
|
18
|
-
centerLabel?: string;
|
|
19
|
-
centerSubLabel?: string;
|
|
18
|
+
centerLabel?: string | undefined;
|
|
19
|
+
centerSubLabel?: string | undefined;
|
|
20
20
|
/** Default 240. */
|
|
21
|
-
height?: number | ResponsiveChartHeight;
|
|
22
|
-
state?: ChartState;
|
|
21
|
+
height?: number | ResponsiveChartHeight | undefined;
|
|
22
|
+
state?: ChartState | undefined;
|
|
23
23
|
};
|
|
24
24
|
export declare function Donut<K extends string = string>(props: DonutProps<K>): ReactElement;
|
|
25
25
|
//# sourceMappingURL=Donut.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../src/charts/Donut.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAUlD,OAAO,KAAK,EAAe,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE7E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,GAAG;IAChE,qCAAqC;IACrC,SAAS,EAAE,MAAM,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ACnC,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;IACnD,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CAC/B,CAAA;AAkED,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CAkJnF"}
|
|
@@ -10,15 +10,17 @@ export type DualPanelBar<T> = {
|
|
|
10
10
|
positive: string;
|
|
11
11
|
/** The fill below zero. */
|
|
12
12
|
negative: string;
|
|
13
|
-
/** Tick and tooltip
|
|
13
|
+
/** Tick formatter, and the tooltip's too unless `tooltipFormat` is given. */
|
|
14
14
|
format: (v: number) => string;
|
|
15
|
+
/** The tooltip row's formatter. Default: `format`. */
|
|
16
|
+
tooltipFormat?: ((v: number) => string) | undefined;
|
|
15
17
|
/** The tooltip row's value, for a unit or a decimal `format` cannot carry. */
|
|
16
|
-
formatValue?: (v: number, d: T) => string;
|
|
18
|
+
formatValue?: ((v: number, d: T) => string) | undefined;
|
|
17
19
|
/** Default `'auto'`: a symmetric `[-maxAbs, maxAbs]` from the data, rounded to nice ticks. A tuple
|
|
18
20
|
* is used verbatim. */
|
|
19
|
-
domain?: readonly [number, number] | 'auto';
|
|
21
|
+
domain?: readonly [number, number] | 'auto' | undefined;
|
|
20
22
|
/** When `'auto'`: floors `maxAbs`, so a plateau does not amplify to fill the pane. */
|
|
21
|
-
maxAbsFloor?: number;
|
|
23
|
+
maxAbsFloor?: number | undefined;
|
|
22
24
|
};
|
|
23
25
|
export type DualPanelProps<T, X extends Date | number = Date | number> = Pick<CartesianChartProps<T, X>, 'ariaLabel' | 'data' | 'x' | 'formatX' | 'legend' | 'height' | 'state' | 'cursorGroup' | 'cursorResolution' | 'tooltip' | 'className' | 'style'> & {
|
|
24
26
|
/** The top pane's lines. */
|
|
@@ -26,9 +28,11 @@ export type DualPanelProps<T, X extends Date | number = Date | number> = Pick<Ca
|
|
|
26
28
|
/** Top pane y axis. Default domain `'auto'`: the visible lines' span plus 8%, rounded to nice
|
|
27
29
|
* ticks (not zero-based: the interesting range is often a narrow band far from zero). */
|
|
28
30
|
top?: {
|
|
29
|
-
domain?: readonly [number, number] | 'auto';
|
|
30
|
-
format?: (v: number) => string;
|
|
31
|
-
|
|
31
|
+
domain?: readonly [number, number] | 'auto' | undefined;
|
|
32
|
+
format?: ((v: number) => string) | undefined;
|
|
33
|
+
/** The lines' tooltip formatter. Default: `format`. */
|
|
34
|
+
tooltipFormat?: ((v: number) => string) | undefined;
|
|
35
|
+
} | undefined;
|
|
32
36
|
/**
|
|
33
37
|
* Shades the band between two top lines (by key), where both are visible. `aboveFill` colours the
|
|
34
38
|
* side where `to` runs above `from`; omitted, both sides take `fill`.
|
|
@@ -37,11 +41,11 @@ export type DualPanelProps<T, X extends Date | number = Date | number> = Pick<Ca
|
|
|
37
41
|
from: string;
|
|
38
42
|
to: string;
|
|
39
43
|
fill: string;
|
|
40
|
-
aboveFill?: string;
|
|
41
|
-
};
|
|
44
|
+
aboveFill?: string | undefined;
|
|
45
|
+
} | undefined;
|
|
42
46
|
bar: DualPanelBar<T>;
|
|
43
47
|
/** The top pane's share of the chart height. Default 0.62. */
|
|
44
|
-
topFraction?: number;
|
|
48
|
+
topFraction?: number | undefined;
|
|
45
49
|
};
|
|
46
50
|
export declare function DualPanel<T, X extends Date | number = Date | number>(props: DualPanelProps<T, X>): ReactElement;
|
|
47
51
|
//# sourceMappingURL=DualPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DualPanel.d.ts","sourceRoot":"","sources":["../../src/charts/DualPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAwB,MAAM,SAAS,CAAA;AAcrF,uBAAuB;AACvB,MAAM,MAAM,aAAa,CAAC,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AC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAC1E,SAAS,CAAA;IACb,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,CAAA;AAiBD,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,EAClE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,YAAY,CA8Nd"}
|
package/dist/charts/DualPanel.js
CHANGED
|
@@ -7,7 +7,7 @@ import { scaleUtc } from "d3-scale";
|
|
|
7
7
|
import { useCallback, useMemo } from "react";
|
|
8
8
|
import { VX, alpha } from "../tokens/index.js";
|
|
9
9
|
import { resolveContainerClass } from "../tokens/size-classes.js";
|
|
10
|
-
import { defaultFormatX, defaultNumberFormat, visibleSeries } from "./compile.js";
|
|
10
|
+
import { defaultFormatX, defaultNumberFormat, engineRow, seriesRow, visibleSeries } from "./compile.js";
|
|
11
11
|
import { barMark, emphasis, lineMark, markersOf, thinFill } from "./marks.js";
|
|
12
12
|
import { PanelRung, paneX, paneY, rowsOf } from "./panel.js";
|
|
13
13
|
import { xScaleFor } from "./scales.js";
|
|
@@ -60,6 +60,8 @@ function DualPanel(props) {
|
|
|
60
60
|
);
|
|
61
61
|
const all = useMemo(() => [...lines, barSeries], [lines, barSeries]);
|
|
62
62
|
const topFormat = top?.format ?? defaultNumberFormat;
|
|
63
|
+
const topTooltipFormat = top?.tooltipFormat ?? topFormat;
|
|
64
|
+
const barTooltipFormat = bar.tooltipFormat ?? bar.format;
|
|
63
65
|
const plan = useCallback(
|
|
64
66
|
({ hidden, highlighted }) => {
|
|
65
67
|
const model = xScaleFor(data.map(x), false);
|
|
@@ -186,26 +188,42 @@ function DualPanel(props) {
|
|
|
186
188
|
for (const s of visible) {
|
|
187
189
|
const v2 = s.getValue(d);
|
|
188
190
|
if (s.tooltip === false || v2 === null || !Number.isFinite(v2)) continue;
|
|
189
|
-
out.push(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
out.push(
|
|
192
|
+
seriesRow(
|
|
193
|
+
s,
|
|
194
|
+
s.formatValue ? s.formatValue(v2, d) : topTooltipFormat(v2),
|
|
195
|
+
highlighted === s.key
|
|
196
|
+
)
|
|
197
|
+
);
|
|
195
198
|
}
|
|
196
199
|
const v = barOn ? bar.getValue(d) : null;
|
|
197
200
|
if (v !== null && Number.isFinite(v))
|
|
198
|
-
out.push(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
out.push(
|
|
202
|
+
engineRow({
|
|
203
|
+
label: bar.label,
|
|
204
|
+
value: bar.formatValue ? bar.formatValue(v, d) : barTooltipFormat(v),
|
|
205
|
+
color: v >= 0 ? bar.positive : bar.negative,
|
|
206
|
+
active: highlighted === BAR_KEY
|
|
207
|
+
})
|
|
208
|
+
);
|
|
204
209
|
return out;
|
|
205
210
|
}
|
|
206
211
|
};
|
|
207
212
|
},
|
|
208
|
-
[
|
|
213
|
+
[
|
|
214
|
+
data,
|
|
215
|
+
x,
|
|
216
|
+
lines,
|
|
217
|
+
barSeries,
|
|
218
|
+
top,
|
|
219
|
+
fillBetween,
|
|
220
|
+
bar,
|
|
221
|
+
topFraction,
|
|
222
|
+
topFormat,
|
|
223
|
+
topTooltipFormat,
|
|
224
|
+
barTooltipFormat,
|
|
225
|
+
formatX
|
|
226
|
+
]
|
|
209
227
|
);
|
|
210
228
|
return /* @__PURE__ */ jsx(PanelRung, { ...rung, series: all, plan });
|
|
211
229
|
}
|
package/dist/charts/Heatmap.d.ts
CHANGED
|
@@ -12,32 +12,32 @@ export type HeatmapProps<T> = BasaltProps & {
|
|
|
12
12
|
/** The intensity; `null` is an absent cell (flat neutral), never a zero. */
|
|
13
13
|
getValue: (d: T) => number | null;
|
|
14
14
|
/** Explicit band order. Default: first seen in `data`. */
|
|
15
|
-
rows?: readonly string[];
|
|
16
|
-
cols?: readonly string[];
|
|
15
|
+
rows?: readonly string[] | undefined;
|
|
16
|
+
cols?: readonly string[] | undefined;
|
|
17
17
|
/** The ink at full intensity, a `VX.*` ref or a series token. Default `VX.line`. */
|
|
18
|
-
color?: string;
|
|
18
|
+
color?: string | undefined;
|
|
19
19
|
/** The value range the color scale spans. Default `[0, max]` of the data. */
|
|
20
|
-
domain?: readonly [number, number];
|
|
20
|
+
domain?: readonly [number, number] | undefined;
|
|
21
21
|
/** Tooltip, legend-end and `aria` value format. Default: the number as-is. */
|
|
22
|
-
formatValue?: (v: number) => string;
|
|
22
|
+
formatValue?: ((v: number) => string) | undefined;
|
|
23
23
|
/** Band tick and tooltip header labels. Default: the band key. */
|
|
24
|
-
formatRow?: (row: string) => string;
|
|
25
|
-
formatCol?: (col: string) => string;
|
|
24
|
+
formatRow?: ((row: string) => string) | undefined;
|
|
25
|
+
formatCol?: ((col: string) => string) | undefined;
|
|
26
26
|
/** `false` hides the gradient legend; `label` titles it. */
|
|
27
27
|
legend?: false | {
|
|
28
|
-
label?: string;
|
|
29
|
-
};
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
30
30
|
/** Rows after the value row, per cell (a sample count, a failure reason). Called with the datum. */
|
|
31
|
-
tooltip?: false | {
|
|
32
|
-
rows?: (d: T) => readonly ChartTooltipRow[];
|
|
33
|
-
};
|
|
31
|
+
tooltip?: (false | {
|
|
32
|
+
rows?: ((d: T) => readonly ChartTooltipRow[]) | undefined;
|
|
33
|
+
}) | undefined;
|
|
34
34
|
/** A fixed height, or one per container class. Default: by row count (160–420px). */
|
|
35
|
-
height?: number | ResponsiveChartHeight;
|
|
35
|
+
height?: number | ResponsiveChartHeight | undefined;
|
|
36
36
|
/** Fill the parent's height instead. Overrides `height`. CSS-owned like every other kind's box
|
|
37
37
|
* (`ChartBox`, no measuring, SSR-stable), so the parent needs a definite CSS height — a grid or
|
|
38
38
|
* flex stretch, `h-full`, an explicit height — which no kind can read off an auto-height parent. */
|
|
39
|
-
matchHeight?: boolean;
|
|
40
|
-
state?: ChartState;
|
|
39
|
+
matchHeight?: boolean | undefined;
|
|
40
|
+
state?: ChartState | undefined;
|
|
41
41
|
};
|
|
42
42
|
export declare function Heatmap<T>(props: HeatmapProps<T>): ReactElement;
|
|
43
43
|
//# sourceMappingURL=Heatmap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heatmap.d.ts","sourceRoot":"","sources":["../../src/charts/Heatmap.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAUlD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEjF,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,GAAG;IAC1C,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,SAAS,CAAC,EAAE,CAAA;IAClB,qCAAqC;IACrC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAA;IACxB,wCAAwC;IACxC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAA;IACxB,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAA;IACjC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"Heatmap.d.ts","sourceRoot":"","sources":["../../src/charts/Heatmap.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiB,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