@pond-ts/charts 0.57.0 → 0.59.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 (85) hide show
  1. package/API.md +576 -0
  2. package/CHANGELOG.md +1213 -1
  3. package/dist/AreaChart.d.ts +12 -1
  4. package/dist/AreaChart.js +131 -13
  5. package/dist/BarChart.d.ts +56 -7
  6. package/dist/BarChart.js +263 -39
  7. package/dist/BarList.d.ts +85 -5
  8. package/dist/BarList.js +25 -4
  9. package/dist/BoxList.d.ts +70 -3
  10. package/dist/BoxList.js +21 -7
  11. package/dist/BoxPlot.d.ts +2 -1
  12. package/dist/BoxPlot.js +101 -9
  13. package/dist/Candlestick.d.ts +13 -1
  14. package/dist/Candlestick.js +89 -3
  15. package/dist/ChartContainer.d.ts +36 -48
  16. package/dist/ChartContainer.js +465 -59
  17. package/dist/ChartRow.d.ts +9 -2
  18. package/dist/ChartRow.js +176 -14
  19. package/dist/HeatMap.d.ts +176 -0
  20. package/dist/HeatMap.js +344 -0
  21. package/dist/Layers.d.ts +5 -1
  22. package/dist/Layers.js +1014 -253
  23. package/dist/Legend.js +8 -4
  24. package/dist/LineChart.d.ts +18 -1
  25. package/dist/LineChart.js +165 -4
  26. package/dist/ListTable.d.ts +30 -3
  27. package/dist/ListTable.js +381 -23
  28. package/dist/ScatterChart.d.ts +3 -2
  29. package/dist/ScatterChart.js +68 -4
  30. package/dist/XAxis.js +40 -22
  31. package/dist/YAxis.d.ts +58 -2
  32. package/dist/YAxis.js +3 -1
  33. package/dist/area.d.ts +34 -1
  34. package/dist/area.js +88 -1
  35. package/dist/bars.d.ts +67 -6
  36. package/dist/bars.js +250 -35
  37. package/dist/box.d.ts +2 -2
  38. package/dist/box.js +158 -40
  39. package/dist/brush.d.ts +142 -0
  40. package/dist/brush.js +179 -0
  41. package/dist/child-index.d.ts +27 -0
  42. package/dist/child-index.js +57 -0
  43. package/dist/context.d.ts +870 -39
  44. package/dist/cursors.d.ts +161 -0
  45. package/dist/cursors.js +503 -0
  46. package/dist/data.d.ts +38 -0
  47. package/dist/data.js +43 -0
  48. package/dist/decimate.d.ts +78 -1
  49. package/dist/decimate.js +157 -0
  50. package/dist/format.d.ts +15 -0
  51. package/dist/format.js +16 -1
  52. package/dist/heat.d.ts +163 -0
  53. package/dist/heat.js +659 -0
  54. package/dist/index.d.ts +13 -4
  55. package/dist/index.js +27 -0
  56. package/dist/line.d.ts +137 -0
  57. package/dist/line.js +328 -0
  58. package/dist/ohlc.d.ts +16 -1
  59. package/dist/ohlc.js +93 -4
  60. package/dist/range.d.ts +14 -1
  61. package/dist/range.js +24 -3
  62. package/dist/scatter.d.ts +17 -9
  63. package/dist/scatter.js +221 -33
  64. package/dist/select.d.ts +13 -5
  65. package/dist/select.js +14 -6
  66. package/dist/selection-fixtures.d.ts +174 -0
  67. package/dist/selection-fixtures.js +569 -0
  68. package/dist/selection-stories.d.ts +73 -0
  69. package/dist/selection-stories.js +301 -0
  70. package/dist/selectors.d.ts +316 -0
  71. package/dist/selectors.js +391 -0
  72. package/dist/span.d.ts +122 -0
  73. package/dist/span.js +203 -0
  74. package/dist/sweep.d.ts +154 -0
  75. package/dist/sweep.js +282 -0
  76. package/dist/theme.d.ts +510 -5
  77. package/dist/theme.js +217 -41
  78. package/dist/tracker.d.ts +6 -0
  79. package/dist/tracker.js +6 -0
  80. package/dist/tradingAxis.fixture.d.ts +78 -0
  81. package/dist/tradingAxis.fixture.js +215 -0
  82. package/dist/useChartLegend.js +18 -3
  83. package/dist/yticks.d.ts +3 -0
  84. package/dist/yticks.js +104 -0
  85. package/package.json +6 -5
@@ -0,0 +1,174 @@
1
+ import type { ReactNode } from 'react';
2
+ import { BoundedSequence, Sequence } from 'pond-ts';
3
+ import type { SelectInfo } from './context.js';
4
+ /**
5
+ * **Chart fixtures for the selection matrix** (`Interactions/Selector/*`,
6
+ * `Interactions/MultiSelector/*`).
7
+ *
8
+ * The selection stories are a **matrix**: one feature set × one fixture per
9
+ * chart type, generated by `selection-stories.tsx`. This file supplies the
10
+ * columns; that file supplies the rows.
11
+ *
12
+ * **Why generated rather than hand-written per column.** A matrix is only a
13
+ * review instrument if a difference between two columns is a difference in the
14
+ * *library* — if each cell were written by hand, a divergence could equally be
15
+ * someone having wired the story differently, and you'd have to read both to
16
+ * know which. Generating every cell from one definition makes any visible
17
+ * difference a real one. (It also makes a new chart type ~10 lines instead of a
18
+ * dozen near-copies, which is what makes widening the matrix survivable.)
19
+ *
20
+ * That is not hypothetical: half a built matrix already surfaced two defects —
21
+ * categorical hover being ink-only where the time axis claims the whole slot,
22
+ * and `<RangeCursor>` on an ordinal axis suppressing the row's cursor entirely.
23
+ *
24
+ * **Capabilities are declared, not assumed.** `sequence` and `rangeCursor` are
25
+ * absent on fixtures that cannot support them, so the factory omits those
26
+ * stories rather than generating one that silently does nothing. A gap in the
27
+ * matrix is information; a story that renders nothing is a trap.
28
+ */
29
+ export interface ChartFixture {
30
+ /** Sub-folder name in the Storybook tree (`Interactions/Selector/<name>`). */
31
+ readonly name: string;
32
+ /** Container props this chart needs — a `range` for a time axis. */
33
+ readonly container: Record<string, unknown>;
34
+ /** The primary y-axis. */
35
+ readonly axis: {
36
+ id: string;
37
+ min: number;
38
+ max: number;
39
+ label: string;
40
+ };
41
+ /** The layer under test, tagged with `id` (identity — see RFC Q8). */
42
+ renderLayer(id: string): ReactNode;
43
+ /** A second row's axis + layer, for the row-scoping story. */
44
+ readonly secondary: {
45
+ axis: {
46
+ id: string;
47
+ min: number;
48
+ max: number;
49
+ label: string;
50
+ };
51
+ renderLayer(id: string): ReactNode;
52
+ };
53
+ /** Marks an *external* control can pick — drives the controlled-selection
54
+ * story, the case `<Selector enabled={false}>` exists to protect. */
55
+ readonly picks: readonly {
56
+ label: string;
57
+ info: SelectInfo;
58
+ }[];
59
+ /** How a hit reads in a caption. */
60
+ describe(hit: SelectInfo): string;
61
+ /**
62
+ * Whether the layer publishes `beginSweep` — i.e. whether it can be
63
+ * **swept at all**. Without one a mounted `<MultiSelector>` has neither a
64
+ * drag nor a resting block preview, so every cell of that column would
65
+ * render a chart that quietly ignores the component under test.
66
+ *
67
+ * `false` on the **2-D family** — scatter and heat map — whose marks do not
68
+ * reduce to a run of columns, so the gesture they need is
69
+ * [PND-INTERACT2D]'s rect rather than this one on a new layer. The list
70
+ * family still owes the sweep too ([PND-INTERACTCONF]).
71
+ */
72
+ readonly sweep: boolean;
73
+ /** A snapping sequence, where the axis has one. Ordinal axes do not. */
74
+ readonly sequence?: () => Sequence | BoundedSequence;
75
+ /** Whether `<RangeCursor>` draws here — it gates on a continuous x
76
+ * (`brush.tsx`), so mounting one on a category axis is not just inert, it
77
+ * takes the row's cursor with it. */
78
+ readonly rangeCursor: boolean;
79
+ /**
80
+ * Present only where the x axis **collapses closed-market time**, which is
81
+ * what makes a snap block's relationship to the session grid a question at
82
+ * all. Supplies the two bucketings that answer it — see the pair of stories
83
+ * `makeSessionStories` generates.
84
+ */
85
+ readonly sessions?: {
86
+ /** A bucketing that **agrees** with the session grid: one block per
87
+ * session, so a block's edges land exactly on the dividers. */
88
+ conforming: () => BoundedSequence;
89
+ /** A bucketing that **doesn't**: a wall-clock period whose boundaries fall
90
+ * mid-session, so a block starts inside one session, crosses the collapsed
91
+ * gap, and ends inside the next. */
92
+ crossing: () => Sequence;
93
+ };
94
+ }
95
+ declare const DAY = 86400000;
96
+ declare const D0: number;
97
+ export declare const categoricalBars: ChartFixture;
98
+ export declare const timeBars: ChartFixture;
99
+ /**
100
+ * **A stacked bar chart** — the column where a bin holds *many* marks.
101
+ *
102
+ * Every other column is one mark per x position, so "the mark under the
103
+ * pointer" and "the bin under the pointer" are the same thing and nothing
104
+ * distinguishes them. Here they come apart: a wide series carries no stable
105
+ * per-bin `mark`, so a segment's identity is the pair **`(key = bin begin,
106
+ * label = group)`** and one bin's three segments share a key. That is the
107
+ * axis this column exercises — click resolves to a segment, while a sweep
108
+ * materialises *every* drawn segment of every covered bin.
109
+ */
110
+ export declare const stackedBars: ChartFixture;
111
+ /** The default shape: a q1→q3 body with thin stems and end caps. The stems are
112
+ * the interesting part for selection — they are drawn ink far from the body. */
113
+ export declare const boxWhisker: ChartFixture;
114
+ /** The candlestick look: a light outer bar over the full range, a darker inner
115
+ * body, no stems. The mark is one solid rect, so the hittable area is the
116
+ * whole p5→p95 span rather than a body plus two thin stems. */
117
+ export declare const boxSolid: ChartFixture;
118
+ /**
119
+ * **A candlestick column** — the mark whose *hue is its meaning*.
120
+ *
121
+ * Every other column is free to recolour on selection: a bar swaps its fill, a
122
+ * box rotates its whole tint ladder. A candle cannot. Rising vs falling is the
123
+ * first thing anyone reads off it, and that read lives in exactly the channel
124
+ * the other marks use to announce state — so this column exists to check that
125
+ * a selected candle still says which way the price went.
126
+ *
127
+ * It sweeps like the rest: a candle owns one `[x, xEnd)` column, same as a box.
128
+ */
129
+ export declare const candles: ChartFixture;
130
+ /**
131
+ * **A scatter column** — the first mark that does *not* own a column.
132
+ *
133
+ * Every fixture before this one is an interval on the key axis: a bar, a
134
+ * stacked bin, a box, a candle. A scatter point is a position, `(x, y)`, with
135
+ * no span either side of it — so "the marks between here and there" is a
136
+ * question about a **region**, not about a run of columns, and `sweep1D`'s
137
+ * two binary searches have nothing to cut.
138
+ *
139
+ * Hence `sweep: false`, and hence [PND-INTERACT2D] rather than a quick wiring
140
+ * job: the 2-D rect is a different gesture, not the same one on a new layer.
141
+ */
142
+ export declare const scatterPoints: ChartFixture;
143
+ /**
144
+ * **A heat-map column** — a *grid* of cells, `(bin × row)`.
145
+ *
146
+ * A heat map's bins do own columns, so an x-only sweep would be well defined —
147
+ * and it would also be the wrong gesture. Selecting every row of a covered bin
148
+ * ignores the y dimension the mark exists to show, and the rect that reads it
149
+ * is [PND-INTERACT2D]'s, so this declares `sweep: false` rather than shipping
150
+ * the half of the gesture that happens to be easy.
151
+ */
152
+ export declare const heatGrid: ChartFixture;
153
+ /**
154
+ * **A trading-time axis** — closed-market time collapsed, session dividers
155
+ * drawn. Selection on a *continuous* axis never has to ask where a block's
156
+ * edges fall relative to the data's own structure; here it does, because the
157
+ * axis has seams and a wall-clock bucketing knows nothing about them.
158
+ *
159
+ * `sessionDividers: 'all'` is part of the fixture rather than of one story:
160
+ * every cell in this column is about the session grid, so the grid should be
161
+ * visible in all of them.
162
+ */
163
+ export declare const tradingSessions: ChartFixture;
164
+ /** Every column of the matrix, in tree order. */
165
+ export declare const FIXTURES: readonly [ChartFixture, ChartFixture, ChartFixture, ChartFixture, ChartFixture, ChartFixture, ChartFixture, ChartFixture, ChartFixture];
166
+ /** Shared caption styling, so every cell reads identically. */
167
+ export declare const caption: {
168
+ readonly font: "13px system-ui";
169
+ readonly color: "#667";
170
+ readonly marginTop: 4;
171
+ readonly maxWidth: 640;
172
+ };
173
+ export { DAY, D0 };
174
+ //# sourceMappingURL=selection-fixtures.d.ts.map