@pond-ts/fit 0.70.0 → 0.71.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/AGENTS.md +3 -1
- package/API.md +30 -31
- package/CHANGELOG.md +111 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -159,6 +159,7 @@ import {
|
|
|
159
159
|
Layers,
|
|
160
160
|
LineChart,
|
|
161
161
|
YAxis,
|
|
162
|
+
CrosshairCursor,
|
|
162
163
|
} from '@pond-ts/charts';
|
|
163
164
|
|
|
164
165
|
const [live, snap] = useLiveSeries({
|
|
@@ -167,7 +168,8 @@ const [live, snap] = useLiveSeries({
|
|
|
167
168
|
retention: { maxAge: '10m' },
|
|
168
169
|
});
|
|
169
170
|
|
|
170
|
-
<ChartContainer width={800}
|
|
171
|
+
<ChartContainer width={800} panZoom>
|
|
172
|
+
<CrosshairCursor />
|
|
171
173
|
<ChartRow height={240}>
|
|
172
174
|
<YAxis id="ms" />
|
|
173
175
|
<Layers>
|
package/API.md
CHANGED
|
@@ -251,17 +251,17 @@ Types: `UseSnapshotOptions`, `SnapshotSource` (structural — covers
|
|
|
251
251
|
|
|
252
252
|
### Components — layout & axes
|
|
253
253
|
|
|
254
|
-
| Component | Key props
|
|
255
|
-
| --------------------------- |
|
|
256
|
-
| `ChartContainer` | `width`, `range?`, `theme?`, `
|
|
257
|
-
| `ChartRow` | `height
|
|
258
|
-
| `Layers` | children
|
|
259
|
-
| `YAxis` | `id` (req), `side?`, `scale?` (`'linear'` \| `'log'` \| `'symlog'`), `linearWindow?`, `min?`/`max?`, `format?`, `width?`, `hide?`
|
|
260
|
-
| `XAxis` | `side?`, `label?`, `format?`, `ticks?`, `transform?`, `dateStyle?`, `timeZone?` (this strip in another IANA zone)
|
|
261
|
-
| `TimeAxis` / `CategoryAxis` | (XAxis props)
|
|
262
|
-
| `Canvas` | `width`, `height`, `draw`
|
|
263
|
-
| `Selector` | `enabled?` (default `true`), `selected?` (mark \| set), `hovered?`, `onSelect?`, `onHover?`, `children?`
|
|
264
|
-
| `MultiSelector` | `enabled?`, `selected?`, `hovered?`, `sequence?`, `onSelect?`, `onHover?`, `children?`
|
|
254
|
+
| Component | Key props | Purpose | Source |
|
|
255
|
+
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
256
|
+
| `ChartContainer` | `width`, `range?`, `theme?`, `panZoom?`, `xScale?`, `bounds?`, `showAxis?`, `calendar?`, `timeZone?`, `origin?`, `maxBandWidth?`/`bandAlign?`, `onTrackerChanged?`, `onDrawStats?` | Root: shared x-scale, interactions, annotations; `timeZone` renders the time axis in an IANA zone (default: viewer-local; a `calendar.timeZone` supplies the default) | `packages/charts/src/ChartContainer.tsx` |
|
|
257
|
+
| `ChartRow` | `height` | One stacked plot band; owns its y-axes | `packages/charts/src/ChartRow.tsx` |
|
|
258
|
+
| `Layers` | children | Mandatory z-stack inside a row (back-to-front) | `packages/charts/src/Layers.tsx` |
|
|
259
|
+
| `YAxis` | `id` (req), `side?`, `scale?` (`'linear'` \| `'log'` \| `'symlog'`), `linearWindow?`, `min?`/`max?`, `format?`, `width?`, `hide?` | Y-axis gutter; layers bind via their `axis` prop | `packages/charts/src/YAxis.tsx` |
|
|
260
|
+
| `XAxis` | `side?`, `label?`, `format?`, `ticks?`, `transform?`, `dateStyle?`, `timeZone?` (this strip in another IANA zone) | Placeable x-axis strip; kind inferred from data | `packages/charts/src/XAxis.tsx` |
|
|
261
|
+
| `TimeAxis` / `CategoryAxis` | (XAxis props) | Thin `XAxis` presets | `packages/charts/src/TimeAxis.tsx`, `CategoryAxis.tsx` |
|
|
262
|
+
| `Canvas` | `width`, `height`, `draw` | Low-level DPR-aware canvas primitive | `packages/charts/src/Canvas.tsx` |
|
|
263
|
+
| `Selector` | `enabled?` (default `true`), `selected?` (mark \| set), `hovered?`, `onSelect?`, `onHover?`, `children?` | Wraps its scope; mounting enables click-select and owns the state it drives (RFC A10) | `packages/charts/src/selectors.tsx` |
|
|
264
|
+
| `MultiSelector` | `enabled?`, `selected?`, `hovered?`, `sequence?`, `onSelect?`, `onHover?`, `children?` | Sweep-select superset of `Selector`: drag sweeps marks, release reports `(hits, modifiers, spans)` — plural, one per swept layer (RFC A5.2) | `packages/charts/src/selectors.tsx` |
|
|
265
265
|
|
|
266
266
|
### Components — draw layers
|
|
267
267
|
|
|
@@ -303,25 +303,24 @@ schema columns). Because the union splits per series _kind_, a value typed as
|
|
|
303
303
|
|
|
304
304
|
### Components — cursors (mounted presets)
|
|
305
305
|
|
|
306
|
-
|
|
307
|
-
as a child of `<ChartContainer>` (the default for
|
|
308
|
-
`<ChartRow>` (the per-row override). Render-only
|
|
309
|
-
gesture-owning cursor (`Crosshair`/`Range`) per scope. The
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
| `
|
|
320
|
-
| `
|
|
321
|
-
| `
|
|
322
|
-
| `
|
|
323
|
-
| `
|
|
324
|
-
| `RangeCursor` | `sequence?`, `onDragRelease?`, `enableDrag?`, `dragModifier?` | The hover-time band + the drag: release fires once with a `RangeSpan`, then reverts (`"region"` + `onRegionSelect` successor) | `packages/charts/src/cursors.tsx` |
|
|
306
|
+
Cursor presets (interaction RFC §4/A4.1). **A chart shows a cursor only when
|
|
307
|
+
one is mounted** — mount one as a child of `<ChartContainer>` (the default for
|
|
308
|
+
every row) or inside a `<ChartRow>` (the per-row override). Render-only
|
|
309
|
+
presets stack; one gesture-owning cursor (`Crosshair`/`Range`) per scope. The
|
|
310
|
+
first mounted cursor that sets `format` shapes the chart's readout channel.
|
|
311
|
+
The underlying `CursorSpec` contract stays unpublished (Q3); every drag claim
|
|
312
|
+
on the plot (annotation-create, the range drag, pan) is arbitrated by one
|
|
313
|
+
brush recognizer with a documented precedence (`src/brush.tsx`, RFC
|
|
314
|
+
A1.5/A2.7).
|
|
315
|
+
|
|
316
|
+
| Component | Key props | Purpose | Source |
|
|
317
|
+
| ----------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- |
|
|
318
|
+
| `LineCursor` | `showTime?`, `format?` | The synced vertical line | `packages/charts/src/cursors.tsx` |
|
|
319
|
+
| `PointCursor` | `showTime?`, `format?` | A dot on each series at the cursor | `packages/charts/src/cursors.tsx` |
|
|
320
|
+
| `InlineCursor` | `showTime?`, `format?` | Dots + a value chip beside each | `packages/charts/src/cursors.tsx` |
|
|
321
|
+
| `FlagCursor` | `showTime?`, `format?` | Dots + staffed value flags stacked at the top | `packages/charts/src/cursors.tsx` |
|
|
322
|
+
| `CrosshairCursor` | `snap?`, `showTime?`, `format?`, `onSnap?` | The inspection reticle: dashed cross, centre dot in the snapped series' colour, y value pill, x time pill; `onSnap` reports the snapped series + point | `packages/charts/src/cursors.tsx` |
|
|
323
|
+
| `RangeCursor` | `sequence?`, `onDragRelease?`, `enableDrag?`, `dragModifier?` | The hover-time band + the drag: release fires once with a `RangeSpan`, then reverts; on a category axis the band shades the slot and the drag is off | `packages/charts/src/cursors.tsx` |
|
|
325
324
|
|
|
326
325
|
### Components — standalone row lists (DOM tables, no `<ChartContainer>`)
|
|
327
326
|
|
|
@@ -398,8 +397,8 @@ Series shapes (same file): `ChartSeries`, `BandSeries`, `BoxSeries`,
|
|
|
398
397
|
| `scaleBand` / `ScaleBand` | Ordinal slot scale for the category axis | `packages/charts/src/bandScale.ts` |
|
|
399
398
|
| `GapMode` | `'none' \| 'empty' \| 'dashed' \| 'step' \| 'fade'` (Line/Area `gaps` prop) | `packages/charts/src/gaps.ts` |
|
|
400
399
|
| `DecimateOption` | `<LineChart decimate>` — M4 viewport decimation (`bool \| { threshold }`) | `packages/charts/src/decimate.ts` |
|
|
401
|
-
| `CursorMode` | `'none' \| 'line' \| 'point' \| 'inline' \| 'flag' \| 'crosshair' \| 'region'` | `packages/charts/src/context.ts` |
|
|
402
400
|
| `TrackerInfo` / `TrackerSample` | Hover readout payload (`onTrackerChanged`) | `packages/charts/src/context.ts` |
|
|
401
|
+
| `CursorSnap` | The point a `<CrosshairCursor>` snapped to (`onSnap`): a `TrackerSample` + `axisId` + `formatted` | `packages/charts/src/context.ts` |
|
|
403
402
|
| `AnnotationKind` / `CreateSpec` | Annotation identity + draw-gesture payload (`onCreate`) | `packages/charts/src/context.ts` |
|
|
404
403
|
| `SelectInfo` | Selection/hover payload (`Selector`/`MultiSelector` `onSelect`/`onHover`) | `packages/charts/src/context.ts` |
|
|
405
404
|
| `SelectModifiers` | Keyboard modifiers on a click, 2nd arg to `onSelect` | `packages/charts/src/context.ts` |
|
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,8 @@ The `@pond-ts` packages — `pond-ts`, `@pond-ts/react`, `@pond-ts/charts`,
|
|
|
8
8
|
under a single `v*` tag, so this file covers them all. Pre-1.0: minor bumps may
|
|
9
9
|
include new features and type-level changes; patch bumps are strictly additive.
|
|
10
10
|
|
|
11
|
-
[Unreleased]: https://github.com/pond-ts/pond/compare/v0.
|
|
11
|
+
[Unreleased]: https://github.com/pond-ts/pond/compare/v0.71.0...HEAD
|
|
12
|
+
[0.71.0]: https://github.com/pond-ts/pond/compare/v0.70.0...v0.71.0
|
|
12
13
|
[0.70.0]: https://github.com/pond-ts/pond/compare/v0.69.0...v0.70.0
|
|
13
14
|
[0.69.0]: https://github.com/pond-ts/pond/compare/v0.68.0...v0.69.0
|
|
14
15
|
[0.68.0]: https://github.com/pond-ts/pond/compare/v0.67.0...v0.68.0
|
|
@@ -73,6 +74,115 @@ include new features and type-level changes; patch bumps are strictly additive.
|
|
|
73
74
|
|
|
74
75
|
## [Unreleased]
|
|
75
76
|
|
|
77
|
+
## [0.71.0] — 2026-09-24
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
|
|
81
|
+
- `@pond-ts/charts`: **`format` on `<LineCursor>`, `<PointCursor>`,
|
|
82
|
+
`<InlineCursor>` and `<FlagCursor>`** — the readout format that used to be
|
|
83
|
+
the container's `cursorFormat`, now on whichever cursor you mount (it was
|
|
84
|
+
already on `<CrosshairCursor>`). The chart still has one readout channel:
|
|
85
|
+
the first mounted cursor that sets `format` shapes it.
|
|
86
|
+
|
|
87
|
+
- `@pond-ts/charts`: **`<CrosshairCursor onSnap>`** — tells you what the
|
|
88
|
+
crosshair is snapped to: the series (`label`, `color`, `axisId`) and the
|
|
89
|
+
point (`x`, `value`, `formatted`, plus `readout` when the layer has one), as
|
|
90
|
+
a new exported **`CursorSnap`** type. Fires only when the snapped point
|
|
91
|
+
changes, and with `null` when the pointer leaves. With `snap={false}` the
|
|
92
|
+
reticle follows the pointer rather than a series, so it stays `null`; a
|
|
93
|
+
reticle drawn by a controlled `trackerPosition` with no pointer on the chart
|
|
94
|
+
also reports `null`. Story `Cursors/Crosshair / SnapReadout`.
|
|
95
|
+
|
|
96
|
+
- `@pond-ts/charts`: **`<CrosshairCursor>` snaps to box plots.** Its vertical
|
|
97
|
+
line lands on the centre of the box under the pointer and its horizontal
|
|
98
|
+
line on the quantile nearest the pointer (`upper` / `q3` / `median` / `q1` /
|
|
99
|
+
`lower`), with that value on the y-axis pill and reported by `onSnap`. A box
|
|
100
|
+
used to be skipped by the crosshair entirely: the line sat wherever the
|
|
101
|
+
pointer was and there was no value to read. The flag cursor still shows the
|
|
102
|
+
box's one consolidated flag, and the point / inline / flag cursors still draw
|
|
103
|
+
no per-quantile dots on a box. In a row with a box and a line, the vertical
|
|
104
|
+
line snaps to whichever of the two is drawn on top, the same rule as for two
|
|
105
|
+
lines. Story `Cursors/Crosshair / BoxPlot`.
|
|
106
|
+
|
|
107
|
+
### Changed
|
|
108
|
+
|
|
109
|
+
- `@pond-ts/charts`: the **crosshair's centre dot is drawn in the snapped
|
|
110
|
+
series' colour** rather than the cursor ink, so the reticle shows which line
|
|
111
|
+
it is reading. The free reticle (`snap={false}`) has no series under it and
|
|
112
|
+
keeps the cursor ink.
|
|
113
|
+
|
|
114
|
+
- **charts:** **`<AreaChart>` fills to zero by default.** An omitted `baseline`
|
|
115
|
+
used to rest the fill on the bottom of the plot, which on auto-fit data sits
|
|
116
|
+
just under the lowest value — so a series running 50–90 drew 60 as a sliver
|
|
117
|
+
and 90 as a slab several times its size, and the fill's height said nothing
|
|
118
|
+
about the value. The default is now `0`: zero is pulled into the auto-fit
|
|
119
|
+
domain and each fill is as tall as its value, the usual reading of an area.
|
|
120
|
+
A number still sets another reference level. The old look is one prop away:
|
|
121
|
+
**`baseline="floor"`** rests the fill on the bottom of the plot and adds
|
|
122
|
+
nothing to the domain — for a price or an elevation profile, where starting
|
|
123
|
+
at zero would flatten the shape. **Migration:** an `<AreaChart>` with no
|
|
124
|
+
`baseline` whose data sits far from zero will now show zero on its axis; add
|
|
125
|
+
`baseline="floor"` to keep the previous rendering. Charts that already wrote
|
|
126
|
+
`baseline={0}`, or whose axis already started at zero, are unchanged. On a
|
|
127
|
+
log axis nothing changes: zero has no position there, so it rests on the
|
|
128
|
+
floor and is not pulled into the domain. On an axis pinned above zero
|
|
129
|
+
(`<YAxis min={40}>`) the baseline is clamped to the axis floor, as a bar's is,
|
|
130
|
+
so the fill's fade stays on the plot.
|
|
131
|
+
|
|
132
|
+
### Removed
|
|
133
|
+
|
|
134
|
+
- `@pond-ts/charts` (**breaking**): **the old cursor props are gone — a chart
|
|
135
|
+
shows a cursor only when you mount one.** Removed: `<ChartContainer>`'s
|
|
136
|
+
`cursor`, `cursorTime`, `crosshairSnap`, `cursorFormat`, `cursorSequence`,
|
|
137
|
+
`onRegionSelect` and `regionSelectModifier`, `<ChartRow cursor>`, and the
|
|
138
|
+
`CursorMode` type. They were deprecated in 0.58.0. The behaviour change that
|
|
139
|
+
matters most: a chart with no cursor component used to get a vertical line
|
|
140
|
+
cursor anyway; it now gets **no cursor** (hover still reports through
|
|
141
|
+
`onTrackerChanged`). Closes
|
|
142
|
+
[#647](https://github.com/pond-ts/pond/issues/647). **Migration:**
|
|
143
|
+
|
|
144
|
+
| Before | After |
|
|
145
|
+
| ------------------------------------------------ | ---------------------------------------------------------------------------- |
|
|
146
|
+
| no `cursor` prop (the implicit line) | `<LineCursor />` (not on a `<MultiSelector>` row — see below) |
|
|
147
|
+
| `cursor="line" \| "point" \| "inline" \| "flag"` | `<LineCursor />` / `<PointCursor />` / `<InlineCursor />` / `<FlagCursor />` |
|
|
148
|
+
| `cursor="crosshair"` + `crosshairSnap={false}` | `<CrosshairCursor snap={false} />` |
|
|
149
|
+
| `cursorTime` | `showTime` on the cursor |
|
|
150
|
+
| `cursorFormat="…"` | `format="…"` on the cursor |
|
|
151
|
+
| `cursor="region"` + `cursorSequence={seq}` | `<RangeCursor sequence={seq} />` |
|
|
152
|
+
| `onRegionSelect={([a, b]) => …}` | `<RangeCursor onDragRelease={({ x: [a, b] }) => …} />` |
|
|
153
|
+
| `regionSelectModifier="shift"` | `<RangeCursor dragModifier="shift" />` |
|
|
154
|
+
| `cursor="none"` | mount nothing |
|
|
155
|
+
| `<ChartRow cursor="…">` | mount the cursor inside that `<ChartRow>` |
|
|
156
|
+
|
|
157
|
+
Mount the cursor as a child of `<ChartContainer>` for every row, or inside
|
|
158
|
+
one `<ChartRow>` for that row only. A row that should have no cursor while
|
|
159
|
+
its siblings have one: mount the cursors per row instead of at the
|
|
160
|
+
container. **Don't add `<LineCursor />` to a row with a `<MultiSelector>`**:
|
|
161
|
+
there the selector's resting band is the cursor (as it already was under the
|
|
162
|
+
implicit line), and any mounted cursor replaces the band.
|
|
163
|
+
|
|
164
|
+
### Fixed
|
|
165
|
+
|
|
166
|
+
- `@pond-ts/charts`: **`<RangeCursor>` on a category axis now shades the bar
|
|
167
|
+
under the pointer.** It used to draw nothing there, so mounting one left the
|
|
168
|
+
row with no cursor at all. The band covers the whole slot, the way a
|
|
169
|
+
bucketed band covers a bucket on a time axis. The drag stays off on a
|
|
170
|
+
category axis (`onDragRelease` never fires there, and the chart now warns
|
|
171
|
+
in development when it is wired); dragging across bars to get them back is
|
|
172
|
+
what `<MultiSelector>` does. Story `Cursors/Range / CategoryAxis`.
|
|
173
|
+
|
|
174
|
+
- **charts:** **A selectable `<AreaChart>` on a log axis with `baseline={0}`
|
|
175
|
+
counted every point over its x span as a hit.** Zero maps to `NaN` on a log
|
|
176
|
+
scale; the draw already fell back to the axis floor, but the hit test used
|
|
177
|
+
the `NaN` pixel, and a `NaN` bound fails neither range check. It now resolves
|
|
178
|
+
the baseline the same way the draw does.
|
|
179
|
+
- **charts:** **`<AreaChart baseline={0}>` on an auto-fit log axis clipped
|
|
180
|
+
most of its series.** The zero baseline was pulled into the extent, which
|
|
181
|
+
left the log fit with no positive low end, so the domain collapsed around the
|
|
182
|
+
largest value (data from 10 to 1e5 fitted `[1e4, 1e6]`). A baseline at or
|
|
183
|
+
below zero is now left out of a log axis's fit. A layer's `yExtent` receives
|
|
184
|
+
the axis's scale kind for this.
|
|
185
|
+
|
|
76
186
|
## [0.70.0] — 2026-09-18
|
|
77
187
|
|
|
78
188
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pond-ts/fit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Fitness & activity domain library on pond-ts: typed quantities, canonical activity series, and analytics (geo distance/elevation, power NP/IF/TSS, zones, splits)",
|
|
6
6
|
"keywords": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"verify": "npm run format:check && npm run build && npm test"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"pond-ts": "^0.
|
|
62
|
+
"pond-ts": "^0.71.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"typescript": "^5.6.3",
|