basalt-ui 2.4.0 → 2.5.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 +16 -0
- package/MIGRATING.md +34 -12
- package/agent/rules/basalt-state.md +1 -1
- package/dist/agent/ai-sdk-transport.d.ts.map +1 -1
- package/dist/agent/ai-sdk-transport.js +4 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/run-records.d.ts +12 -3
- package/dist/agent/run-records.d.ts.map +1 -1
- package/dist/agent/run-records.js +16 -3
- package/dist/agent/transport.d.ts +10 -3
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/use-agent-thread-runs.d.ts.map +1 -1
- package/dist/agent/use-agent-thread-runs.js +23 -7
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +14 -5
- package/dist/charts/MirroredBars.d.ts.map +1 -1
- package/dist/charts/MirroredBars.js +6 -4
- package/dist/charts/compile.d.ts +4 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +40 -11
- package/dist/charts/panel.d.ts +6 -0
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +10 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +8 -2
- package/dist/state/fields.d.ts +10 -15
- package/dist/state/fields.d.ts.map +1 -1
- package/dist/state/fields.js +27 -1
- package/dist/telemetry.d.ts +58 -4
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +13 -5
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/agent/ai-sdk-transport.ts +5 -2
- package/src/agent/index.ts +1 -1
- package/src/agent/run-records.ts +27 -3
- package/src/agent/transport.ts +11 -5
- package/src/agent/use-agent-thread-runs.ts +35 -8
- package/src/charts/DualPanel.tsx +13 -4
- package/src/charts/MirroredBars.tsx +5 -3
- package/src/charts/compile.ts +59 -12
- package/src/charts/panel.tsx +16 -1
- package/src/index.ts +1 -1
- package/src/provider/index.tsx +8 -2
- package/src/state/fields.ts +41 -19
- package/src/telemetry.ts +70 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
# [2.5.0](https://github.com/jkrumm/basalt-ui/compare/v2.4.0...v2.5.0) (2026-10-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* keep short-chart y labels inside only and lift ref swatch contrast ([480ca90](https://github.com/jkrumm/basalt-ui/commit/480ca90ae9ed3d7c4b9d057051bbf5308e7a871b))
|
|
7
|
+
* thread the short-chart label rule through composed panes ([7d56a17](https://github.com/jkrumm/basalt-ui/commit/7d56a17e6de2942a4ad7ceb385d59e40d6a4b1ff))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* carry a call-site fallback from a store field into its control ([cb8819b](https://github.com/jkrumm/basalt-ui/commit/cb8819bd36a832258616915778ab84786291fcb7))
|
|
13
|
+
* make withFallback the only call-site fallback ([f946e67](https://github.com/jkrumm/basalt-ui/commit/f946e6750b52543389aea55bbf44fc11b6f2368d))
|
|
14
|
+
* propagate the chat turn's trace context to the chat endpoint ([c321b55](https://github.com/jkrumm/basalt-ui/commit/c321b555f4f443046ec00c1eec10d2cd124c8390))
|
|
15
|
+
* settle a superseded turn's trace and export the trace-context types ([7aa3781](https://github.com/jkrumm/basalt-ui/commit/7aa3781e807b0c89fc0e5dd6853240596ab000ff))
|
|
16
|
+
|
|
1
17
|
# [2.4.0](https://github.com/jkrumm/basalt-ui/compare/v2.3.0...v2.4.0) (2026-10-14)
|
|
2
18
|
|
|
3
19
|
|
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 | 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) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
|
|
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 | 2.5.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,28 @@ 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.5.0 — call-site fallbacks for controls, chat trace headers, axis labels
|
|
996
|
+
|
|
997
|
+
- `createLocalStore` fields take `withFallback(value)`: the same field (key, setter, `clear()`)
|
|
998
|
+
with a call-site unset value, for `use()` and any filter control as `field=`
|
|
999
|
+
(`<SelectFilter field={store.field.exercise.withFallback(leader)} />`). Never persisted; a reset
|
|
1000
|
+
returns to it; `fallback` and `isDefault` on the derived handle report it. Rule: `basalt-state`.
|
|
1001
|
+
`createSearchStore` fields do not take it: the URL lane drops a value equal to the definition's
|
|
1002
|
+
fallback, so a second default would make one URL mean two things.
|
|
1003
|
+
- `use({ fallback })` is removed — replaced by `field.withFallback(value).use()`. It existed in
|
|
1004
|
+
2.4.0 only and has no known consumers. argo `strength-composite-chart.tsx`: bind
|
|
1005
|
+
`store.field.exercise.withFallback(leader)` instead of rebuilding the store per leader.
|
|
1006
|
+
- A `telemetry` sink may define `startChatTurn(turn)` returning `{ headers?: { traceparent,
|
|
1007
|
+
tracestate? }, settle?(end) }`: `aiSdkTransport` sends those headers with that turn's chat
|
|
1008
|
+
request (so the API span joins the dashboard trace) and `settle` runs once when the turn ends
|
|
1009
|
+
(also on a superseded or failed turn). `Telemetry`, `ChatTurnTrace`, `ChatTurnEnd`,
|
|
1010
|
+
`TraceHeaders` are exported. Optional: without the hook nothing changes. A cross-origin chat API
|
|
1011
|
+
must allow `traceparent` in CORS.
|
|
1012
|
+
- Y-axis tick labels sit inside the plot only for a compact chart under the box's short height
|
|
1013
|
+
(180 px), across every kind including `DualPanel` and `MirroredBars`; a regular-height chart
|
|
1014
|
+
keeps them in the left gutter. Reference-line legend swatches meet the series-swatch contrast in
|
|
1015
|
+
light and dark.
|
|
1016
|
+
|
|
995
1017
|
## 2.4.0 — chart gaps and legends, local-store fallbacks, the pre-commit hook
|
|
996
1018
|
|
|
997
1019
|
All additive; no call site changes. Named consumers are argo `apps/dashboard/src/features/…`.
|
|
@@ -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; on a `createLocalStore` field a prop-derived default is `
|
|
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 `store.field.x.withFallback(value)`, passed to `use()` and to any control as `field=` (unset only, never persisted, a reset returns to it, `isDefault` follows it; search stores lack it, a derived handle does not derive again), 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]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-sdk-transport.d.ts","sourceRoot":"","sources":["../../src/agent/ai-sdk-transport.ts"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ai-sdk-transport.d.ts","sourceRoot":"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C7B,cAAc,CAAC,KAAK,CAAC,CA+DvB"}
|
|
@@ -177,7 +177,10 @@ function aiSdkTransport(options) {
|
|
|
177
177
|
messages: [userMessage],
|
|
178
178
|
trigger: "submit-message",
|
|
179
179
|
messageId: void 0,
|
|
180
|
-
abortSignal: signal
|
|
180
|
+
abortSignal: signal,
|
|
181
|
+
// Per-turn trace context goes to the chat endpoint only (merged over the static headers by
|
|
182
|
+
// AI SDK's HTTP transport); absent, the request is exactly what it was.
|
|
183
|
+
...ctx?.headers !== void 0 ? { headers: ctx.headers } : {}
|
|
181
184
|
});
|
|
182
185
|
yield* diffChunkStream(chatId, chunkStream, readStream, signal);
|
|
183
186
|
},
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { toAgentError } from './error.js';
|
|
|
18
18
|
export type { ChatMessage } from './history.js';
|
|
19
19
|
export type { AgentThread, ThreadStatus, ThreadsStore } from './thread.js';
|
|
20
20
|
export type { AgentOutcome, OutcomeResolver } from './outcome.js';
|
|
21
|
-
export type { AgentTransport, ResumableAgentTransport } from './transport.js';
|
|
21
|
+
export type { AgentStreamContext, AgentTransport, ResumableAgentTransport } from './transport.js';
|
|
22
22
|
export { ThreadFeed } from './chat/thread-feed.js';
|
|
23
23
|
export { ThreadFeedRow } from './chat/thread-feed-row.js';
|
|
24
24
|
export type { MessageAffordances } from './chat/message-affordances.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGzF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,E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Aa,CAAA;AAG9F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
* being driven, long before the `setRuns` it queues renders. That window is what the record
|
|
12
12
|
* covers: it outlives the run only until a render shows the outcome (`sweepFlushed`).
|
|
13
13
|
*/
|
|
14
|
+
import type { ChatTurnEnd, ChatTurnTrace } from '../telemetry.js';
|
|
14
15
|
/** The part of a rendered `runs` entry this module reads. */
|
|
15
16
|
type RenderedRun<TPart> = {
|
|
16
17
|
readonly status: string;
|
|
17
18
|
readonly parts: TPart[];
|
|
18
19
|
};
|
|
19
|
-
export type RunEnd =
|
|
20
|
+
export type RunEnd = ChatTurnEnd;
|
|
20
21
|
export type RunRecord<TPart> = {
|
|
21
22
|
readonly controller: AbortController;
|
|
22
23
|
/** The unthrottled accumulator; `runs` may lag it by one throttle window. Emptied when the run ends. */
|
|
@@ -28,10 +29,18 @@ export type RunRecord<TPart> = {
|
|
|
28
29
|
ended: RunEnd | undefined;
|
|
29
30
|
/** A newer run began on the same thread (set by `beginRun` on the record it replaces). */
|
|
30
31
|
superseded: boolean;
|
|
32
|
+
/** The turn's telemetry `settle`, run once by `settleTrace`. */
|
|
33
|
+
settle: ChatTurnTrace['settle'];
|
|
31
34
|
};
|
|
32
35
|
export type RunRecords<TPart> = Map<string, RunRecord<TPart>>;
|
|
33
|
-
/**
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Registers a live run for `threadId`, replacing whatever record the previous run left. A previous
|
|
38
|
+
* run still being driven is cut short: its trace settles as `stopped`. `settle` is the new turn's
|
|
39
|
+
* telemetry hook (absent for a resume).
|
|
40
|
+
*/
|
|
41
|
+
export declare function beginRun<TPart>(records: RunRecords<TPart>, threadId: string, controller: AbortController, settle?: ChatTurnTrace['settle']): RunRecord<TPart>;
|
|
42
|
+
/** Runs the turn's telemetry `settle` once; a throwing consumer hook never breaks the run. */
|
|
43
|
+
export declare function settleTrace<TPart>(record: RunRecord<TPart>, end: RunEnd): void;
|
|
35
44
|
/** Marks a run as no longer driven and drops the content it held. */
|
|
36
45
|
export declare function endRun<TPart>(record: RunRecord<TPart>, reason: RunEnd): void;
|
|
37
46
|
/** True while `controller`'s run is still the thread's live one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-records.d.ts","sourceRoot":"","sources":["../../src/agent/run-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,6DAA6D;AAC7D,KAAK,WAAW,CAAC,KAAK,IAAI;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAA;CAAE,CAAA;AAE9E,MAAM,MAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"run-records.d.ts","sourceRoot":"","sources":["../../src/agent/run-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE9D,6DAA6D;AAC7D,KAAK,WAAW,CAAC,KAAK,IAAI;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAA;CAAE,CAAA;AAE9E,MAAM,MAAM,MAAM,GAAG,WAAW,CAAA;AAEhC,MAAM,MAAM,SAAS,CAAC,KAAK,IAAI;IAC7B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,wGAAwG;IACxG,KA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
const record = {
|
|
3
3
|
controller,
|
|
4
4
|
parts: [],
|
|
5
5
|
appended: false,
|
|
6
6
|
resolving: false,
|
|
7
7
|
ended: void 0,
|
|
8
|
-
superseded: false
|
|
8
|
+
superseded: false,
|
|
9
|
+
settle
|
|
9
10
|
};
|
|
10
11
|
const previous = records.get(threadId);
|
|
11
|
-
if (previous !== void 0)
|
|
12
|
+
if (previous !== void 0) {
|
|
13
|
+
previous.superseded = true;
|
|
14
|
+
settleTrace(previous, "stopped");
|
|
15
|
+
}
|
|
12
16
|
records.set(threadId, record);
|
|
13
17
|
return record;
|
|
14
18
|
}
|
|
19
|
+
function settleTrace(record, end) {
|
|
20
|
+
const { settle } = record;
|
|
21
|
+
record.settle = void 0;
|
|
22
|
+
try {
|
|
23
|
+
settle?.(end);
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
15
27
|
function endRun(record, reason) {
|
|
16
28
|
record.ended = reason;
|
|
17
29
|
record.parts = [];
|
|
@@ -65,5 +77,6 @@ export {
|
|
|
65
77
|
isLatestRun,
|
|
66
78
|
isLive,
|
|
67
79
|
planStopWithTombstone,
|
|
80
|
+
settleTrace,
|
|
68
81
|
sweepFlushed
|
|
69
82
|
};
|
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
import type { AgentPartDraft } from './parts.js';
|
|
16
|
+
/**
|
|
17
|
+
* The third `stream` argument. `headers` are extra request headers for THIS turn's request to the
|
|
18
|
+
* transport's own endpoint — today the W3C trace context a telemetry sink's `startChatTurn`
|
|
19
|
+
* returned. Absent unless a sink contributed; a transport that ignores them keeps working.
|
|
20
|
+
*/
|
|
21
|
+
export type AgentStreamContext = {
|
|
22
|
+
readonly messageId: string;
|
|
23
|
+
readonly headers?: Readonly<Record<string, string>> | undefined;
|
|
24
|
+
};
|
|
16
25
|
/**
|
|
17
26
|
* The injected transport seam. `stream(input, signal, ctx)` returns an async generator of parts.
|
|
18
27
|
* Implement this interface for any backend — fetch-based SSE, AI SDK, or a mock.
|
|
@@ -40,9 +49,7 @@ import type { AgentPartDraft } from './parts.js';
|
|
|
40
49
|
* }
|
|
41
50
|
*/
|
|
42
51
|
export type AgentTransport<TPart = AgentPartDraft, TInput = string> = {
|
|
43
|
-
stream: (input: TInput, signal?: AbortSignal, ctx?:
|
|
44
|
-
readonly messageId: string;
|
|
45
|
-
}) => AsyncGenerator<TPart>;
|
|
52
|
+
stream: (input: TInput, signal?: AbortSignal, ctx?: AgentStreamContext) => AsyncGenerator<TPart>;
|
|
46
53
|
/** Optional: resume a previously-started run from its resumeToken (see StartPart). Transports that don't support resumption simply omit this. */
|
|
47
54
|
resume?: ((resumeToken: string, signal?: AbortSignal) => AsyncGenerator<TPart>) | undefined;
|
|
48
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,cAAc,EAAE,MAAM,GAAG,MAAM,IAAI;IACpE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAA;CAChE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,M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AS,EACT,KAAK,EACL,cAAc,EACd,WAAW,EACX,OAAO,EACP,QAAc,EACd,SAAS,GACV,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,wBAAwB,CAAC,KAAK,CAAC,CA8UjE"}
|
|
@@ -7,6 +7,7 @@ import { createRunCommitter, isContentPart } from "./run-committer.js";
|
|
|
7
7
|
import {
|
|
8
8
|
beginRun,
|
|
9
9
|
endRun,
|
|
10
|
+
settleTrace,
|
|
10
11
|
failedThreadIds,
|
|
11
12
|
dismissRun,
|
|
12
13
|
hasLiveRun,
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
sweepFlushed
|
|
17
18
|
} from "./run-records.js";
|
|
18
19
|
import { isResumable } from "./transport.js";
|
|
19
|
-
import { TelemetryContext,
|
|
20
|
+
import { TelemetryContext, createLiveEmitter, errorName, now } from "../telemetry.js";
|
|
20
21
|
function defaultToUserParts(input) {
|
|
21
22
|
return [{ id: mintThreadId(), type: "text", text: input }];
|
|
22
23
|
}
|
|
@@ -129,6 +130,7 @@ async function consumeAndFinalize(args) {
|
|
|
129
130
|
status: outcome.status
|
|
130
131
|
})
|
|
131
132
|
);
|
|
133
|
+
settleTrace(record, "settled");
|
|
132
134
|
} catch (err) {
|
|
133
135
|
if (!live()) {
|
|
134
136
|
if (record.ended === "stopped" && record.appended) onError?.({ threadId, error: err });
|
|
@@ -154,6 +156,7 @@ async function consumeAndFinalize(args) {
|
|
|
154
156
|
failure: { error: err, agentError }
|
|
155
157
|
})
|
|
156
158
|
);
|
|
159
|
+
settleTrace(record, "failed");
|
|
157
160
|
onError?.({ threadId, error: err });
|
|
158
161
|
} finally {
|
|
159
162
|
committer.cancel();
|
|
@@ -220,6 +223,15 @@ async function finalizeStop(args) {
|
|
|
220
223
|
record.resolving = false;
|
|
221
224
|
}
|
|
222
225
|
}
|
|
226
|
+
const TRACEPARENT = /^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/;
|
|
227
|
+
const TRACESTATE_MEMBER = /^[\da-z][\w*/@-]{0,255}=[^\s,=]([^,=]{0,254}[^\s,=])?$/;
|
|
228
|
+
function traceRequestHeaders(headers) {
|
|
229
|
+
const { traceparent, tracestate } = headers;
|
|
230
|
+
if (typeof traceparent !== "string" || !TRACEPARENT.test(traceparent)) return void 0;
|
|
231
|
+
const members = typeof tracestate === "string" ? tracestate.split(",") : [];
|
|
232
|
+
const valid = members.length > 0 && members.length <= 32 && members.every((member) => TRACESTATE_MEMBER.test(member.trim()));
|
|
233
|
+
return valid ? { traceparent, tracestate } : { traceparent };
|
|
234
|
+
}
|
|
223
235
|
function buildTurnEvent(args) {
|
|
224
236
|
const { threadId, startedAt, firstContentAt, partCount, status, failure } = args;
|
|
225
237
|
const endedAt = now();
|
|
@@ -274,10 +286,7 @@ function useAgentThreadRuns({
|
|
|
274
286
|
const resolvedToUserParts = toUserParts ?? defaultToUserParts;
|
|
275
287
|
const toUserPartsRef = useRef(resolvedToUserParts);
|
|
276
288
|
toUserPartsRef.current = resolvedToUserParts;
|
|
277
|
-
const emitTelemetry = useMemo(
|
|
278
|
-
() => createEmitter((event) => telemetryRef.current?.(event)),
|
|
279
|
-
[]
|
|
280
|
-
);
|
|
289
|
+
const emitTelemetry = useMemo(() => createLiveEmitter(() => telemetryRef.current), []);
|
|
281
290
|
const resolveTransport = (threadId) => {
|
|
282
291
|
const currentTransport = transportRef.current;
|
|
283
292
|
if (typeof currentTransport !== "function") return currentTransport;
|
|
@@ -294,6 +303,7 @@ function useAgentThreadRuns({
|
|
|
294
303
|
if (record.ended !== void 0) continue;
|
|
295
304
|
abortedThreadIds.push(threadId);
|
|
296
305
|
record.controller.abort();
|
|
306
|
+
settleTrace(record, "stopped");
|
|
297
307
|
}
|
|
298
308
|
recordsRef.current.clear();
|
|
299
309
|
if (abortedThreadIds.length === 0) return;
|
|
@@ -374,8 +384,10 @@ function useAgentThreadRuns({
|
|
|
374
384
|
return next;
|
|
375
385
|
});
|
|
376
386
|
const controller = new AbortController();
|
|
377
|
-
const
|
|
387
|
+
const trace = emitTelemetry.startChatTurn?.({ threadId, messageId: userMessage.id });
|
|
388
|
+
const record = beginRun(recordsRef.current, threadId, controller, trace?.settle);
|
|
378
389
|
const resolvedTransport = resolveTransport(threadId);
|
|
390
|
+
const headers = trace?.headers === void 0 ? void 0 : traceRequestHeaders(trace.headers);
|
|
379
391
|
void consumeAndFinalize({
|
|
380
392
|
threadId,
|
|
381
393
|
record,
|
|
@@ -385,7 +397,10 @@ function useAgentThreadRuns({
|
|
|
385
397
|
// id instead of a second, unrelated one (R1 — see AgentTransport.stream's doc).
|
|
386
398
|
generator: withPartIds(
|
|
387
399
|
threadId,
|
|
388
|
-
resolvedTransport.stream(input, controller.signal, {
|
|
400
|
+
resolvedTransport.stream(input, controller.signal, {
|
|
401
|
+
messageId: userMessage.id,
|
|
402
|
+
...headers !== void 0 ? { headers } : {}
|
|
403
|
+
})
|
|
389
404
|
),
|
|
390
405
|
userMessage,
|
|
391
406
|
recordsRef,
|
|
@@ -433,6 +448,7 @@ function useAgentThreadRuns({
|
|
|
433
448
|
const { appended, resolving } = record;
|
|
434
449
|
endRun(record, "stopped");
|
|
435
450
|
record.controller.abort();
|
|
451
|
+
settleTrace(record, "stopped");
|
|
436
452
|
void finalizeStop({
|
|
437
453
|
threadId,
|
|
438
454
|
parts,
|
|
@@ -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,CAAC,IAAI,IAAI,CACjC,WAAW,CAAC,CAAC,CAAC,EACZ,KAAK,GACL,OAAO,GACP,OAAO,GACP,UAAU,GACV,aAAa,GACb,SAAS,GACT,QAAQ,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AAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;QACvD,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;QAC5C,uDAAuD;QACvD,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;KACpD,GACD,SAAS,CAAA;IACb;;;OAGG;IACH,WAAW,CAAC,EACR;QAAE,IAAI,EAAE,MAAM,CAAC;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,CAuOd"}
|
package/dist/charts/DualPanel.js
CHANGED
|
@@ -9,7 +9,7 @@ import { VX, alpha } from "../tokens/index.js";
|
|
|
9
9
|
import { resolveContainerClass } from "../tokens/size-classes.js";
|
|
10
10
|
import { defaultFormatX, defaultNumberFormat, engineRow, seriesRow, visibleSeries } from "./compile.js";
|
|
11
11
|
import { barMark, emphasis, lineMark, markersOf, thinFill } from "./marks.js";
|
|
12
|
-
import { PanelRung, paneX, paneY, rowsOf } from "./panel.js";
|
|
12
|
+
import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
|
|
13
13
|
import { xScaleFor } from "./scales.js";
|
|
14
14
|
import { rowX } from "./types.js";
|
|
15
15
|
const BAR_KEY = "__bar";
|
|
@@ -147,12 +147,20 @@ function DualPanel(props) {
|
|
|
147
147
|
],
|
|
148
148
|
scales: {
|
|
149
149
|
x: { scale: xScale(), axis: false },
|
|
150
|
-
y: paneY({
|
|
150
|
+
y: paneY({
|
|
151
|
+
scale: topY,
|
|
152
|
+
domain: topDomain,
|
|
153
|
+
format: topFormat,
|
|
154
|
+
ticks: TOP_TICKS,
|
|
155
|
+
cls,
|
|
156
|
+
height: chartHeightOf(h, topFraction, PANE_GAP)
|
|
157
|
+
})
|
|
151
158
|
}
|
|
152
159
|
};
|
|
153
160
|
};
|
|
154
|
-
const barPane = ({ width }) => {
|
|
161
|
+
const barPane = ({ width, height: h }) => {
|
|
155
162
|
const cls = resolveContainerClass(width);
|
|
163
|
+
const whole = chartHeightOf(h, 1 - topFraction, PANE_GAP);
|
|
156
164
|
const barRows = barOn ? rowsOf(data, x, barSeries) : [];
|
|
157
165
|
const dim = emphasis(highlighted, { key: BAR_KEY });
|
|
158
166
|
return {
|
|
@@ -166,13 +174,14 @@ function DualPanel(props) {
|
|
|
166
174
|
})
|
|
167
175
|
],
|
|
168
176
|
scales: {
|
|
169
|
-
x: paneX({ scale: xScale(), model, format, cls }),
|
|
177
|
+
x: paneX({ scale: xScale(), model, format, cls, height: whole }),
|
|
170
178
|
y: paneY({
|
|
171
179
|
scale: barScale,
|
|
172
180
|
domain: barDomain,
|
|
173
181
|
format: bar.format,
|
|
174
182
|
ticks: BAR_TICKS,
|
|
175
|
-
cls
|
|
183
|
+
cls,
|
|
184
|
+
height: whole
|
|
176
185
|
})
|
|
177
186
|
}
|
|
178
187
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MirroredBars.d.ts","sourceRoot":"","sources":["../../src/charts/MirroredBars.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAW,MAAM,SAAS,CAAA;AAEhF,4BAA4B;AAC5B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C,GAC7B,YAAY,CA0Kd"}
|
|
@@ -8,7 +8,7 @@ import { VX, alpha } from "../tokens/index.js";
|
|
|
8
8
|
import { resolveContainerClass } from "../tokens/size-classes.js";
|
|
9
9
|
import { defaultFormatX, defaultNumberFormat, seriesRow, visibleSeries } from "./compile.js";
|
|
10
10
|
import { barMark, emphasis } from "./marks.js";
|
|
11
|
-
import { PanelRung, paneX, paneY, rowsOf } from "./panel.js";
|
|
11
|
+
import { PanelRung, chartHeightOf, paneX, paneY, rowsOf } from "./panel.js";
|
|
12
12
|
import { xScaleFor } from "./scales.js";
|
|
13
13
|
import { rowX } from "./types.js";
|
|
14
14
|
const DEFAULT_UP_FRACTION = 0.35;
|
|
@@ -69,8 +69,9 @@ function MirroredBars(props) {
|
|
|
69
69
|
const downMax = paneMax(down, downSeries, drawn, downOn);
|
|
70
70
|
const bandWidth = 2 * model.halfStep * BAND_FILL;
|
|
71
71
|
const bandScale = () => xScaleFor(drawn.map(x), true).scale;
|
|
72
|
-
const pane = (side, cfg, s, on, max) => ({ width: w }) => {
|
|
72
|
+
const pane = (side, cfg, s, on, max) => ({ width: w, height: h }) => {
|
|
73
73
|
const cls = resolveContainerClass(w);
|
|
74
|
+
const whole = chartHeightOf(h, side === "up" ? upFraction : 1 - upFraction, 0);
|
|
74
75
|
const domain = side === "up" ? [0, max] : [max, 0];
|
|
75
76
|
const rows = on ? rowsOf(drawn, x, s) : [];
|
|
76
77
|
const opacity = (d) => (getBarOpacity?.(d) ?? BAR_OPACITY) * emphasis(highlighted, s);
|
|
@@ -137,13 +138,14 @@ function MirroredBars(props) {
|
|
|
137
138
|
)
|
|
138
139
|
],
|
|
139
140
|
scales: {
|
|
140
|
-
x: side === "down" ? paneX({ scale: bandScale(), model, format, cls }) : { scale: bandScale(), axis: false },
|
|
141
|
+
x: side === "down" ? paneX({ scale: bandScale(), model, format, cls, height: whole }) : { scale: bandScale(), axis: false },
|
|
141
142
|
y: paneY({
|
|
142
143
|
scale: scaleLinear().domain(domain),
|
|
143
144
|
domain,
|
|
144
145
|
format: cfg.format,
|
|
145
146
|
ticks: cfg.ticks ?? DEFAULT_PANE_TICKS,
|
|
146
|
-
cls
|
|
147
|
+
cls,
|
|
148
|
+
height: whole
|
|
147
149
|
}),
|
|
148
150
|
zx: { channel: "x", scale: scaleLinear().domain([0, 1]), axis: false }
|
|
149
151
|
}
|
package/dist/charts/compile.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export declare function yGuide<T>(opts: {
|
|
|
60
60
|
cls: ContainerClass;
|
|
61
61
|
side: 'left' | 'right';
|
|
62
62
|
grid: boolean;
|
|
63
|
+
/** The whole chart's height: decides inside or gutter labels. */
|
|
64
|
+
height: number;
|
|
63
65
|
}): Omit<ChartPositionScaleOptions<number>, 'scale'>;
|
|
64
66
|
/**
|
|
65
67
|
* Every n-th value, n the smallest stride that leaves at most the class's x tick count (the same
|
|
@@ -72,6 +74,8 @@ export declare function xGuide<X extends ChartX>(opts: {
|
|
|
72
74
|
xTicks: number | readonly X[] | undefined;
|
|
73
75
|
format: (v: ChartValue) => string;
|
|
74
76
|
cls: ContainerClass;
|
|
77
|
+
/** The whole chart's height: decides whether the left margin is locked to zero. */
|
|
78
|
+
height: number;
|
|
75
79
|
}): Omit<ChartPositionScaleOptions<ChartValue>, 'scale'>;
|
|
76
80
|
/** Gradient resource id for a series' area fill; the host's `idPrefix` scopes it per chart. */
|
|
77
81
|
export declare const areaGradientId: (index: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,aAAa,EAEb,yBAAyB,EACzB,eAAe,IAAI,gBAAgB,EACnC,UAAU,EACV,yBAAyB,EAE1B,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,aAA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