@pond-ts/charts 0.57.0 → 0.58.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +1070 -1
  2. package/dist/AreaChart.d.ts +12 -1
  3. package/dist/AreaChart.js +131 -13
  4. package/dist/BarChart.js +184 -30
  5. package/dist/BarList.d.ts +85 -5
  6. package/dist/BarList.js +25 -4
  7. package/dist/BoxList.d.ts +70 -3
  8. package/dist/BoxList.js +21 -7
  9. package/dist/BoxPlot.d.ts +2 -1
  10. package/dist/BoxPlot.js +101 -9
  11. package/dist/Candlestick.d.ts +13 -1
  12. package/dist/Candlestick.js +89 -3
  13. package/dist/ChartContainer.d.ts +36 -48
  14. package/dist/ChartContainer.js +465 -59
  15. package/dist/ChartRow.d.ts +9 -2
  16. package/dist/ChartRow.js +86 -12
  17. package/dist/HeatMap.d.ts +176 -0
  18. package/dist/HeatMap.js +344 -0
  19. package/dist/Layers.d.ts +5 -1
  20. package/dist/Layers.js +1014 -253
  21. package/dist/Legend.js +8 -4
  22. package/dist/LineChart.d.ts +18 -1
  23. package/dist/LineChart.js +165 -4
  24. package/dist/ListTable.d.ts +30 -3
  25. package/dist/ListTable.js +381 -23
  26. package/dist/ScatterChart.d.ts +3 -2
  27. package/dist/ScatterChart.js +68 -4
  28. package/dist/XAxis.js +40 -22
  29. package/dist/area.d.ts +34 -1
  30. package/dist/area.js +88 -1
  31. package/dist/bars.d.ts +57 -3
  32. package/dist/bars.js +237 -26
  33. package/dist/box.d.ts +2 -2
  34. package/dist/box.js +158 -40
  35. package/dist/brush.d.ts +142 -0
  36. package/dist/brush.js +179 -0
  37. package/dist/child-index.d.ts +27 -0
  38. package/dist/child-index.js +57 -0
  39. package/dist/context.d.ts +859 -33
  40. package/dist/cursors.d.ts +161 -0
  41. package/dist/cursors.js +503 -0
  42. package/dist/decimate.d.ts +78 -1
  43. package/dist/decimate.js +157 -0
  44. package/dist/heat.d.ts +163 -0
  45. package/dist/heat.js +659 -0
  46. package/dist/index.d.ts +11 -2
  47. package/dist/index.js +22 -0
  48. package/dist/line.d.ts +137 -0
  49. package/dist/line.js +328 -0
  50. package/dist/ohlc.d.ts +16 -1
  51. package/dist/ohlc.js +93 -4
  52. package/dist/scatter.d.ts +17 -9
  53. package/dist/scatter.js +221 -33
  54. package/dist/select.d.ts +13 -5
  55. package/dist/select.js +14 -6
  56. package/dist/selection-fixtures.d.ts +174 -0
  57. package/dist/selection-fixtures.js +569 -0
  58. package/dist/selection-stories.d.ts +73 -0
  59. package/dist/selection-stories.js +301 -0
  60. package/dist/selectors.d.ts +316 -0
  61. package/dist/selectors.js +391 -0
  62. package/dist/span.d.ts +122 -0
  63. package/dist/span.js +203 -0
  64. package/dist/sweep.d.ts +154 -0
  65. package/dist/sweep.js +282 -0
  66. package/dist/theme.d.ts +456 -5
  67. package/dist/theme.js +217 -41
  68. package/dist/tracker.d.ts +6 -0
  69. package/dist/tracker.js +6 -0
  70. package/dist/tradingAxis.fixture.d.ts +78 -0
  71. package/dist/tradingAxis.fixture.js +215 -0
  72. package/dist/useChartLegend.js +18 -3
  73. package/package.json +3 -3
@@ -2,7 +2,7 @@ import { type ReactNode } from 'react';
2
2
  import { type DiscontinuityProvider, type TradingCalendarLike } from './tradingTimeScale.js';
3
3
  import { Sequence, BoundedSequence } from 'pond-ts';
4
4
  import type { TimeRange } from 'pond-ts';
5
- import { type AnnotationKind, type CreateSpec, type CursorMode, type SelectInfo, type TrackerInfo, type DrawStatsFrame } from './context.js';
5
+ import { type AnnotationKind, type CreateSpec, type CursorMode, type TrackerInfo, type DrawStatsFrame } from './context.js';
6
6
  import { type AxisFormat, type CursorFormat } from './format.js';
7
7
  import { type ChartTheme } from './theme.js';
8
8
  export interface ChartContainerProps {
@@ -165,6 +165,13 @@ export interface ChartContainerProps {
165
165
  * `'point'` / `'inline'` / `'flag'` add per-series marks; `'none'` hides it.
166
166
  * `'region'` shades the bucket under the pointer (needs {@link cursorSequence}).
167
167
  * See {@link CursorMode}.
168
+ *
169
+ * @deprecated Mount a **cursor component** instead — `<LineCursor>` /
170
+ * `<PointCursor>` / `<InlineCursor>` / `<FlagCursor>` / `<CrosshairCursor>` /
171
+ * `<RangeCursor>` as a child of the container (or inside a `<ChartRow>` for
172
+ * the per-row override); mount nothing for `'none'`. This prop keeps working
173
+ * for one more minor by synthesizing the equivalent preset internally; a
174
+ * mounted cursor component overrides it. See `docs/rfcs/interaction.md` §9.
168
175
  */
169
176
  cursor?: CursorMode;
170
177
  /**
@@ -187,6 +194,10 @@ export interface ChartContainerProps {
187
194
  * re-realizes the buckets on each pointer move (harmless for a coarse
188
195
  * day/session sequence, wasteful for a fine one over a wide view) — hoist it or
189
196
  * `useMemo` it.
197
+ *
198
+ * @deprecated Use `<RangeCursor sequence={…}>` — the prop moved onto the
199
+ * component that uses it, where it is no longer mode-conditional. Works for
200
+ * one more minor; a mounted `<RangeCursor>`'s sequence wins over this.
190
201
  */
191
202
  cursorSequence?: Sequence | BoundedSequence;
192
203
  /**
@@ -209,6 +220,12 @@ export interface ChartContainerProps {
209
220
  * domain is meaningless), so a **value** axis is always freeform. No-op unless
210
221
  * `cursor="region"` on a **time** or **value** x-axis (a **category** axis is
211
222
  * excluded — an ordinal-slot select is a different gesture).
223
+ *
224
+ * @deprecated Use `<RangeCursor onDragRelease>` — the drag moved onto the
225
+ * component, and the payload becomes `{ x: [lo, hi] }` (a {@link RangeSpan},
226
+ * forward-compatible with the 2-D drag's optional `y`) instead of the bare
227
+ * pair. Works for one more minor; a mounted `<RangeCursor onDragRelease>`
228
+ * takes over the gesture.
212
229
  */
213
230
  onRegionSelect?: (range: readonly [number, number]) => void;
214
231
  /**
@@ -219,6 +236,9 @@ export interface ChartContainerProps {
219
236
  * selects). **Omitted** ⇒ a region-drag
220
237
  * **preempts** pan (drag always selects; document that precedence for users).
221
238
  * Wheel-zoom is unaffected in every case.
239
+ *
240
+ * @deprecated Use `<RangeCursor dragModifier>` — the prop moved onto the
241
+ * component alongside `onDragRelease`. Works for one more minor.
222
242
  */
223
243
  regionSelectModifier?: 'shift';
224
244
  /**
@@ -237,51 +257,6 @@ export interface ChartContainerProps {
237
257
  * frame); route it to a ref/store rather than doing React state work per frame.
238
258
  */
239
259
  onDrawStats?: (frame: DrawStatsFrame) => void;
240
- /**
241
- * Controlled selection — the selected mark (echo the `onSelect` arg back), or
242
- * `null`. **Omitted ⇒ uncontrolled** (a click on a selectable layer manages it
243
- * internally; pass `null` to force nothing selected). A layer is **selectable
244
- * only when it carries an `id`** (the stable series identity) — `BarChart` /
245
- * `ScatterChart` highlight the mark matching the selection's `id` (the series)
246
- * and its `key` (the sample), so two series sharing a timestamp don't both
247
- * light up, and the selection survives a data update (it keys on the stable
248
- * `id`, not the sample `key`). A layer with no `id` renders + reads out but
249
- * can't be selected.
250
- */
251
- selected?: SelectInfo | null;
252
- /**
253
- * Fires when a selectable layer's mark is clicked, with the hit mark, or `null`
254
- * when a click misses every mark (or hits a layer with no `id` — display-only,
255
- * so it reads as empty space). Notification only — works in both controlled and
256
- * uncontrolled mode. If this or `selected` is set but no layer has an `id`, a
257
- * dev-warning notes that nothing is selectable.
258
- */
259
- onSelect?: (hit: SelectInfo | null) => void;
260
- /**
261
- * Controlled hover-highlight — the transiently lit mark (echo the `onHover` arg
262
- * back), or `null`. **Omitted ⇒ uncontrolled** (the pointer over a selectable
263
- * layer manages it internally). The hover analog of {@link selected}: pass it to
264
- * **pin** a lit mark from outside the chart (e.g. hovering a legend / list row
265
- * lights the matching {@link BarChart} bar). Only layers with a hover-highlight
266
- * (currently `BarChart`) render it; keyed by the same {@link SelectInfo} identity
267
- * as selection.
268
- */
269
- hovered?: SelectInfo | null;
270
- /**
271
- * Fires when the pointer enters a selectable layer's mark (the hit mark) or
272
- * leaves every mark (`null`) — the hover analog of {@link onSelect}. Notification
273
- * only (works controlled or uncontrolled), and **deduped**: it fires on a mark
274
- * transition, not on every pointer move. Wire it to mirror hover out-of-band
275
- * (e.g. a list row ↔ the bar), pairing with {@link hovered} to sync both ways.
276
- * (The annotation counterpart is {@link onHoverAnnotation}.)
277
- *
278
- * **Dedup key:** by the mark's `key` + `label` only (not `value`/`color`). So on
279
- * a live chart where a bar's value changes while the cursor stays on it, this
280
- * won't re-fire — read the current value from your series, not the last
281
- * `onHover` payload. (Matches the internal hover-highlight, which repaints on
282
- * key transitions.)
283
- */
284
- onHover?: (hit: SelectInfo | null) => void;
285
260
  /**
286
261
  * Which pan/zoom gestures the plot captures:
287
262
  *
@@ -296,7 +271,7 @@ export interface ChartContainerProps {
296
271
  * `false` ⇒ `'none'`). Bound the reachable range with {@link bounds}
297
272
  * (zoom-out / pan extent) and {@link minDuration} (zoom-in floor).
298
273
  */
299
- panZoom?: boolean | 'none' | 'pan' | 'panZoom';
274
+ panZoom?: boolean | 'none' | 'pan' | 'panZoom' | 'panZoomX' | 'panZoomY' | 'panZoomXY';
300
275
  /**
301
276
  * **Outer pan/zoom extent** — `[min, max]` (same units as {@link range}) the
302
277
  * view can never move outside. Panning into an edge stops there (the window
@@ -327,6 +302,10 @@ export interface ChartContainerProps {
327
302
  * Show the cursor's time atop the in-chart readout (when a row's `cursor` draws
328
303
  * one). **Default `false`.** Formatted by {@link timeFormat} to match the time
329
304
  * axis.
305
+ *
306
+ * @deprecated Use `showTime` on the mounted cursor component
307
+ * (`<LineCursor showTime>` / `<FlagCursor showTime>` / …). Works for one
308
+ * more minor via the shim.
330
309
  */
331
310
  cursorTime?: boolean;
332
311
  /**
@@ -337,6 +316,10 @@ export interface ChartContainerProps {
337
316
  * the vertical line snaps its **x** to the data grid (so the time readout is
338
317
  * clean), and both draw a full-height dashed vertical + full-width dashed
339
318
  * horizontal line.
319
+ *
320
+ * @deprecated Use `<CrosshairCursor snap={…}>` — the prop moved onto the
321
+ * component, where it is no longer mode-conditional. Works for one more
322
+ * minor via the shim.
340
323
  */
341
324
  crosshairSnap?: boolean;
342
325
  /**
@@ -418,6 +401,11 @@ export interface ChartContainerProps {
418
401
  * {@link timeFormat} owns the labels. (A category axis reads names, and a
419
402
  * `transform`ed axis's pill speaks its derived unit — neither consults
420
403
  * `cursorFormat`.)
404
+ *
405
+ * @deprecated Use `format` on the mounted cursor (`<CrosshairCursor
406
+ * format={…}>`) — it feeds the same shared readout channel (marker
407
+ * indicators and annotation auto-labels included). Works for one more
408
+ * minor; a mounted cursor's `format` wins over this.
421
409
  */
422
410
  cursorFormat?: CursorFormat;
423
411
  /**
@@ -462,5 +450,5 @@ export interface ChartContainerProps {
462
450
  * {@link TimeAxis} at the bottom, aligned under the plots. Y axes are per-row
463
451
  * (`<YAxis>`).
464
452
  */
465
- export declare function ChartContainer({ range, maxBandWidth, bandAlign, width, rowGap, showAxis, trackerPosition, onTrackerChanged, onDrawStats, selected, onSelect, hovered, onHover, panZoom, bounds, onTimeRangeChange, minDuration, cursor, cursorSequence, onRegionSelect, regionSelectModifier, cursorTime, crosshairSnap, editAnnotations, creating, onCreate, onSelectAnnotation, onHoverAnnotation, onEditAnnotation, snap, timeFormat, cursorFormat, origin, theme, discontinuities, calendar, spacing, grid, sessionDividers, children, }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
453
+ export declare function ChartContainer({ range, maxBandWidth, bandAlign, width, rowGap, showAxis, trackerPosition, onTrackerChanged, onDrawStats, panZoom, bounds, onTimeRangeChange, minDuration, cursor: cursorProp, cursorSequence: cursorSequenceProp, onRegionSelect, regionSelectModifier, cursorTime: cursorTimeProp, crosshairSnap: crosshairSnapProp, editAnnotations, creating, onCreate, onSelectAnnotation, onHoverAnnotation, onEditAnnotation, snap, timeFormat, cursorFormat: cursorFormatProp, origin, theme, discontinuities, calendar, spacing, grid, sessionDividers, children, }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
466
454
  //# sourceMappingURL=ChartContainer.d.ts.map