@swiftplot/react 0.1.1 → 0.3.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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  Small, fast charts on Canvas 2D and WebGL2. MIT, TypeScript, ESM only, no dependencies.
11
11
 
12
- **Status: prototype.** It draws lines and areas (straight or stepped), bars, box plots, error bars, heatmaps, tick marks and scatter dots on linear, time and category axes, and pies, donuts, radars, radial bars, funnels, sankey diagrams, treemaps and sunbursts, with a hover tooltip, dim-the-others on hover and optional animation. A chart can be updated and follows its container when no size is given. `swiftplot/charts` builds line, area, bar and scatter charts from the data alone, and `@swiftplot/react` and `@swiftplot/vue` make React and Vue components of them. There is a legend that hides and shows series, zoom and pan, a brush, a click event, the pointer from code for linked charts, light and dark themes, reference lines and zones, log axes, and tick steps and formats. The repository is a pnpm workspace with the core in `packages/core` and the wrappers in `packages/react` and `packages/vue`.
12
+ **Status: prototype.** It draws lines and areas (straight or stepped), bars, box plots, error bars, heatmaps, tick marks and scatter dots on linear, time and category axes, and pies, donuts, radars, radial bars, funnels, sankey diagrams, treemaps and sunbursts, with a hover tooltip, dim-the-others on hover and optional animation. A chart can be updated and follows its container when no size is given. `swiftplot/charts` builds each of these charts from the data alone, and bars and lines together, and `@swiftplot/react` and `@swiftplot/vue` make React and Vue components of them. There is a legend that hides and shows series, zoom and pan, a brush, a click event, the pointer from code for linked charts, light and dark themes, reference lines and zones, log axes, and tick steps and formats. The repository is a pnpm workspace with the core in `packages/core` and the wrappers in `packages/react` and `packages/vue`.
13
13
 
14
14
  **For AI coding assistants:** [`llms-full.txt`](llms-full.txt) is a guide to writing code with swiftplot, and [`llms.txt`](llms.txt) its index.
15
15
 
@@ -25,22 +25,38 @@ chart.update({ data: next }); // only what changed reaches the chart
25
25
  chart.destroy();
26
26
  ```
27
27
 
28
- - **Charts:** `lineChart`, `areaChart`, `barChart` and `scatterChart`. Each returns `{ update(props), destroy(), chart }`; `update` takes only the props that change, and `chart` is the underlying chart.
29
- - **Data** is row objects, an object of columns (arrays or typed arrays, all of one length), a plain number array (`y` against its index, as the series `value`), or `[x, y]` pairs (the series `y`; a row of any other length throws). Long rows, `{ date, service, value }`, take `series: 'service'` and give one series per distinct value. `data` missing, `null` or empty draws an empty frame and never throws, so a chart can be created before its data arrives.
28
+ - **Charts:** `lineChart`, `areaChart`, `barChart`, `scatterChart`, `comboChart`, `pieChart`, `funnelChart`, `radialBarChart`, `radarChart`, `heatmapChart`, `histogramChart`, `boxPlotChart`, `candlestickChart`, `sankeyChart`, `treemapChart` and `sunburstChart`. Each returns `{ update(props), destroy(), chart }`; `update` takes only the props that change, and `chart` is the underlying chart.
29
+ - **Data** is row objects, an object of columns (arrays or typed arrays, all of one length), a plain number array (`y` against its index, as the series `value`), or `[x, y]` pairs (the series `y`; a row of any other length throws), and for `treemapChart` and `sunburstChart` a nested `{ name, value, children }` or a list of them. Pairs are `[label, value]` on a pie, a funnel and radial bars, `[name, value]` on a radar and `[group, value]` on a box plot; a histogram takes no pairs, and a heatmap, candlesticks, a combo and a sankey take neither pairs nor numbers. On the line, area, bar and scatter charts long rows, `{ date, service, value }`, take `series: 'service'` and give one series per distinct value. `data` missing, `null` or empty draws an empty frame and never throws, so a chart can be created before its data arrives.
30
30
  - **Values:** a number, a `Date`, an ISO 8601 string (`2026-11-22`, `2026-11-22T10:00` or with a space, optional seconds and fraction, and `Z` or `+02:00` after a time) or other text. A field's first value that is not missing (`null`, `undefined`, `''`, `NaN`, an infinite number) decides its kind; later values of another kind, an invalid `Date` and an impossible date (`2026-13-40`, `T24:00`) are missing. Numbers held as text (`"12.5"`) are text and are not converted. A field of booleans or objects cannot be plotted.
31
31
  - **Dates** without a zone are read as UTC, so the same data draws the same chart on every machine; `xAxis: { utc: false }` reads them, and shows the axis, in local time.
32
- - **Fields** are named by `x`, `y` (one field or a list) and `series`, by name or, on row objects only, by an accessor `(row, index) => value`. A named field is never second-guessed. What is not named is guessed, in field order (the keys of the first 100 rows, or of the columns object): `x` is the first date field, else the first text field, else the first number field when a `y` is named or another number field is left, else the row index; `y` is every number field left, one series each. A scatter chart takes the first date field, else the first number field, as `x` and the next number field as its one `y`.
33
- - **Errors** name the chart; an error about fields also names the fields with their kinds and the prop to pass. Guessing throws when no number field is left for `y` (naming any field of numbers held as text), when a text field is left over without `series` (the rows look like long data, even with `x` and `y` named), for a named field that does not exist or is not numbers where numbers are needed, and for a scatter chart without two usable fields or with more than one `y`. An update that throws leaves the chart as it was.
34
- - **Rows:** line and area charts sort rows by x (stably); bar and scatter charts keep the given order. A row with a missing x (or, on a scatter, a missing `r`) is dropped; a missing y is a gap.
32
+ - **Fields** of the line, area, bar and scatter charts are named by `x`, `y` (one field or a list) and `series`, by name or, on row objects only, by an accessor `(row, index) => value`. A named field is never second-guessed. What is not named is guessed, in field order (the keys of the first 100 rows, or of the columns object): `x` is the first date field, else the first text field, else the first number field when a `y` is named or another number field is left, else the row index; `y` is every number field left, one series each. A scatter chart takes the first date field, else the first number field, as `x` and the next number field as its one `y`; a named `y` may be text, for a band per category. `y2` names number fields drawn against an axis on the right, set by `y2Axis`; it is never guessed, and goes with neither `series` nor `errorBars`.
33
+ - **The other charts** name their fields by what they have, by name or, on row objects, by an accessor. A single field of numbers is guessed only when one is left, and otherwise the error says what to pass:
34
+
35
+ | Chart | Fields | Guessed | Other props |
36
+ | ------------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------- |
37
+ | `comboChart` | `x`, and `lines`, `bars`, `y2Lines`, `y2Bars`: a field or a list each | `x` as on a line chart; the rest never, and one is needed | `y2Axis`, `stack` |
38
+ | `pieChart` | `label`, `value` | the first text field; the only number field | `inner` (above 0, a donut), `text`, `sweep` |
39
+ | `funnelChart` | `label`, `value` | as a pie | `text`, `fill` |
40
+ | `radialBarChart` | `label`, `value` | as a pie | `max`, `sweep`, `inner` |
41
+ | `radarChart` | `x` (spokes), `y` (a shape each) | the first text field; every number field left | `max`, `fill` |
42
+ | `heatmapChart` | `x`, `y`, `value` | the first two text or date fields; the only number field left | `color` |
43
+ | `histogramChart` | `x` | the only number field | `bins` |
44
+ | `boxPlotChart` | `x` (groups, or `null` for one box), `y` | the only text field, when its values repeat; the only number field | `fill` |
45
+ | `candlestickChart` | `x`, `open`, `high`, `low`, `close` | the first date field, else text; the fields of those names, in any case | `up`, `down` |
46
+ | `sankeyChart` | `source`, `target`, `value` | the first two text fields; the only number field left | `blend`, `text` |
47
+ | `treemapChart`, `sunburstChart` | none | | `shade`, `text` |
48
+
49
+ - **Errors** name the chart; an error about fields also names the fields with their kinds and the prop to pass. On the line, area, bar and scatter charts guessing throws when no number field is left for `y` (naming any field of numbers held as text), on all but the scatter when a text field is left over without `series` or `y2` (the rows look like long data, even with `x` and `y` named), for a named field that does not exist or is not numbers where numbers are needed, and for a scatter chart without two usable fields or with more than one `y`. An update that throws leaves the chart as it was.
50
+ - **Rows:** line and area charts, and combos on dates or numbers, sort rows by x (stably); bar and scatter charts, and combos on text, keep the given order. On these a row with a missing x (or, on a scatter, a missing `r`) is dropped; a missing y is a gap. Pies, funnels, radial bars and radars keep a row with no name, unnamed; heatmaps, box plots and sankeys drop a row with no cell, group or node. A heatmap puts text in order of first appearance and dates and numbers ascending.
35
51
  - **Axes:** settings go under `xAxis` and `yAxis`. Which x settings apply depends on the x field:
36
52
 
37
- | x | axis | settings |
38
- | ------------------- | -------- | -------------------------------------------------------------------------------------------------- |
39
- | numbers, row index | linear | `label`, `domain` (`'nice'` by default), `step`, `format`, `fit` |
40
- | dates | time | `label`, `utc`, `unit` and `every`, `format`, `fit`, `domain` as `[from, to]` in milliseconds only |
41
- | text, and every bar | category | `label` only |
53
+ | x | axis | settings |
54
+ | ----------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
55
+ | numbers, row index | linear | `label`, `domain` (`'nice'` by default), `step`, `format`, `fit` |
56
+ | dates | time | `label`, `utc`, `unit` and `every`, `format`, `fit`, `domain` as `[from, to]` in milliseconds only |
57
+ | text, and every bar chart, box plot and heatmap | category | `label` only |
42
58
 
43
- `yAxis` takes `label`, `domain`, `step`, `format` and `fit`. Bars put each row (or, with `series`, each distinct x in order of first appearance) in a category of its own, dates included, labelled in UTC whatever `utc` says.
59
+ `yAxis` takes `label`, `domain`, `step`, `format` and `fit` (a heatmap's `label` only), `y2Axis` the same, and on line, scatter and combo charts `scale: 'log'`, where a value at or below zero is a gap, `step` does not apply and bars cannot share the axis. A combo or a candlestick chart puts text in categories; on dates and numbers a bar or a candle takes 0.6 of the smallest gap between x values. Pies, donuts, radars, radial bars, funnels, sankeys, treemaps and sunbursts have no axes, and only the charts that have them zoom, box plots and heatmaps excepted. The bars of `barChart` put each row (or, with `series`, each distinct x in order of first appearance) in a category of its own, dates included, labelled in UTC whatever `utc` says.
44
60
 
45
61
  - **Defaults:**
46
62
 
@@ -49,7 +65,7 @@ chart.destroy();
49
65
  | Axis labels | the field's name; none for the row index, an accessor or several y fields | `xAxis.label`, `yAxis.label` |
50
66
  | Colours | `palette` in order, `paletteDark` on the dark theme | `colors` |
51
67
  | Tooltip | on; text in the y axis format, else two decimals at most | `tooltip: false` |
52
- | Legend | on with two or more series | `legend: false` or `legend()` options |
68
+ | Legend | on with two or more series or named parts; a heatmap's strip of colours | `legend: false` or `legend()` options |
53
69
  | Zoom | off | `zoom: true` or `zoom()` options |
54
70
  | Animation | off | `animate: true` or `animate()` options |
55
71
  | Theme | follows the page | `theme: 'light' \| 'dark' \| Theme` |
@@ -59,8 +75,9 @@ chart.destroy();
59
75
  | Line and area shape | straight, with gaps | `curve`, `join` |
60
76
  | Scatter radius | 4 px | `r`: a number or a field |
61
77
 
78
+ - **Marks added to a chart:** line, area, bar, scatter and combo charts take `rules` (`{ x }` or `{ y }`, with `text`, `dashed` and `color`), `zones` (`{ x: [from, to] }` or `{ y: [from, to] }`, with `text` and `color`) and `brush` (`true` or `{ axes }`; with `zoom` its release shows the range), whose range goes to `onBrush`. `errorBars: { low, high, cap, width }` on line, bar and scatter charts names two fields that are values on the y axis, not distances from y, for a chart of one unstacked `y`. A line takes `fill` (`true` or a gradient) and a scatter `alpha`, `ring` and `shape: 'tick'`.
62
79
  - **Stacking** counts a missing value as zero, so a stacked area has no gap where an unstacked one would. Long series are stacked over the union of their x values.
63
- - **Interaction state** (`view`, `hidden`, `selected`, `pointer`) is kept by the chart unless the prop is given; `onViewChange`, `onHiddenChange`, `onClick` and `onPointerChange` report it as in the explicit API. Changing `tooltip`, `legend`, `zoom` or `animate` creates the chart again and keeps a zoomed window and hidden series.
80
+ - **Interaction state** (`view`, `hidden`, `selected`, `pointer`) is kept by the chart unless the prop is given; `onViewChange`, `onHiddenChange`, `onClick` and `onPointerChange` report it as in the explicit API. Changing `tooltip`, `legend`, `zoom`, `animate` or `brush` creates the chart again and keeps a zoomed window and hidden series.
64
81
  - **`dataVersion`:** conversion is cached on the data's identity and length (each column's, for an object of columns). Pass new data, or after changing values in place, bump `dataVersion`: `chart.update({ dataVersion: ++version })`.
65
82
  - **Theme:** `theme` defaults to `'auto'`, which follows the computed CSS `color-scheme` of the chart's element: `dark` gives the dark theme, `light dark` follows the system setting and switches with it, anything else gives light. It is read when the chart is created, when the system setting changes and when the `theme` prop changes.
66
83
  - **`.spec()`** is the way out to the explicit API: `lineChart.spec({ data: rows, x: 'date', y: ['api', 'web'] })` returns the `plot()` options the chart would use. It needs no element and runs in Node; with the `'auto'` theme it gives no theme and the light palette.
@@ -68,7 +85,7 @@ chart.destroy();
68
85
 
69
86
  ## React and Vue
70
87
 
71
- `@swiftplot/react` (React 18.3 or 19) and `@swiftplot/vue` (Vue 3.4 or later) make components of the charts above: `LineChart`, `AreaChart`, `BarChart`, `ScatterChart`, and `Plot` for the explicit API. Each takes the props of its function, renders one `div`, creates the chart after mount, sends it only what changed on each render and destroys it on unmount. Install `swiftplot` beside the wrapper, which has it as a peer dependency:
88
+ `@swiftplot/react` (React 18.3 or 19) and `@swiftplot/vue` (Vue 3.4 or later) make a component of each chart above, named as its function with a capital: `LineChart`, `AreaChart`, `BarChart`, `ScatterChart`, `ComboChart`, `PieChart`, `FunnelChart`, `RadialBarChart`, `RadarChart`, `HeatmapChart`, `HistogramChart`, `BoxPlotChart`, `CandlestickChart`, `SankeyChart`, `TreemapChart` and `SunburstChart`, and `Plot` for the explicit API. Each takes the props of its function, renders one `div`, creates the chart after mount, sends it only what changed on each render and destroys it on unmount. Install `swiftplot` beside the wrapper, which has it as a peer dependency:
72
89
 
73
90
  ```sh
74
91
  pnpm add swiftplot @swiftplot/react # or @swiftplot/vue
@@ -98,24 +115,24 @@ import { LineChart } from '@swiftplot/vue';
98
115
  <LineChart data={rows} x="date" y={['api', 'web']} zoom view={view} onViewChange={setView} />;
99
116
  ```
100
117
 
101
- In Vue the changes are events: `v-model:view`, `v-model:hidden` and `v-model:pointer`, `@click` and `@error` (`<LineChart :data="rows" zoom v-model:view="view" />`). `selected` is a plain prop: the app sets it, from a click for example.
118
+ In Vue the changes are events: `v-model:view`, `v-model:hidden` and `v-model:pointer`, `@click`, `@brush` and `@error` (`<LineChart :data="rows" zoom v-model:view="view" />`). `selected` is a plain prop: the app sets it, from a click for example.
102
119
 
103
- - **`Plot`** takes every `plot()` option as a prop, for a chart type with no easy version yet, for mixing marks and for large typed-array data. `use` is read when it mounts, as in `plot()`: change the component's `key` to change features. Its theme is `light` unless given; it does not follow the page as the easy charts do.
120
+ - **`Plot`** takes every `plot()` option as a prop, to mix marks in a way no easy chart does, for a mark of your own, or to pass large typed arrays straight in. `use` is read when it mounts, as in `plot()`: change the component's `key` to change features. Its theme is `light` unless given; it does not follow the page as the easy charts do.
104
121
 
105
122
  ```tsx
106
- import { arcs, legend } from 'swiftplot';
123
+ import { band, bands, bar } from 'swiftplot';
107
124
  import { Plot } from '@swiftplot/react';
108
125
 
109
- const marks = [
110
- arcs({ values: [5, 3, 2], labels: ['A', 'B', 'C'], colors: ['#2563eb', '#16a34a', '#f59e0b'] }),
111
- ];
112
- <Plot frame="polar" marks={marks} use={[legend()]} />;
126
+ const days = ['Mon', 'Tue', 'Wed'];
127
+ const [y1, y2] = bands(days.length);
128
+ const marks = [bar({ y1, y2, x: [12, 19, 7], color: '#2563eb', label: 'Orders' })];
129
+ <Plot x={{ domain: 'nice', label: 'Orders' }} y={band({ label: 'Day', categories: days })} marks={marks} />;
113
130
  ```
114
131
 
115
132
  - **Size:** `width` and `height` (px) size the `div`, and `style` wins over them; the chart measures the `div` and follows whatever resizes it (a class, a parent, a media query). With no height from `height`, `style` or CSS, the `div` fills a parent that has a height, else is 300 px tall, so `<LineChart data={rows} />` shows a chart on an ordinary page and a class added later wins, in a cascade layer (Tailwind) or not. The fallback is a `<style>` kept first in the document head (or the shadow root), inserted only for a chart with no height: under a Content Security Policy that blocks inline styles, give every chart a height (`height`, `style` or CSS). A chart mounted in a detached element falls back once the element is attached.
116
133
  - **Errors** (a missing field, an accessor or formatter that throws) go to `onError` in React or `@error` in Vue, and the last good chart stays; without a handler they are thrown to the nearest error boundary, or to Vue's error handling (`onErrorCaptured`, `app.config.errorHandler`). A failed render is tried again when a chart prop other than a callback changes; a changed callback still reaches the last good chart. A failure is reported once until its error message, the data's length (each column's, for an object of columns) or another prop that is not a function changes, so inline props, data rebuilt during render and a handler that sets state cannot loop, unless the message itself changes on every attempt. Rows are never read, so new data of the same length that fails with the same message is not reported again.
117
134
  - **Server rendering:** the server renders the `div` alone, the client hydrates the same markup and creates the chart after hydration. The React entry is marked `'use client'`. The 300 px fallback is applied in the browser, so give a server-rendered chart a `height` (or a CSS height) to reserve its space before hydration.
118
- - **Performance:** each render compares props by identity and the chart then by value, so inline objects such as `xAxis={{ label: 'Day' }}` cost little. `data` built during render and inline accessors are converted again on every render, and an inline `xAxis.format` redraws the axis: build them outside render, or with `useMemo` and `useCallback`. In Vue keep the data in a `shallowRef` and replace the array: a deep `ref` makes the app wrap every row for nothing the chart uses. Data changed in place with every prop unchanged is not noticed: pass a new array or bump `dataVersion`.
135
+ - **Performance:** each render compares props by identity and the chart then by value, so inline objects such as `xAxis={{ label: 'Day' }}` cost little. `data` built during render and inline accessors are converted again on every render, and an inline `xAxis.format` repaints the data: build them outside render, or with `useMemo` and `useCallback`. In Vue keep the data in a `shallowRef` and replace the array: a deep `ref` makes the app wrap every row for nothing the chart uses. Data changed in place with every prop unchanged is not noticed: pass a new array or bump `dataVersion`.
119
136
 
120
137
  ## Use
121
138
 
@@ -136,9 +153,9 @@ chart.update({ marks: [dots({ x, y: y2, r, color: '#2563eb', label: 'Group 1' })
136
153
  chart.destroy();
137
154
  ```
138
155
 
139
- - **Marks** are imported functions: `line`, `area`, `bar`, `box`, `errorBars`, `heatmap`, `ticks`, `dots`, `arcs`, `radar`, `radialBars`, `funnel`, `sankey`, `treemap`, `sunburst`. Only the ones you import are bundled.
156
+ - **Marks** are imported functions: `line`, `area`, `bar`, `box`, `candlestick`, `errorBars`, `heatmap`, `ticks`, `dots`, `arcs`, `radar`, `radialBars`, `funnel`, `sankey`, `treemap`, `sunburst`. Only the ones you import are bundled.
140
157
  - **Lines and areas** are straight between points unless `curve: 'step'` or `curve: 'smooth'`, which curves through the points without overshooting them. `area({ x, y })` fills from zero; `area({ x, y1, y2 })` is a band. A `y` that is `NaN` or infinite leaves a gap: nothing is joined across it, and a lone point between two gaps draws nothing; `join: true` draws a line or fills an area straight across instead. `x` must be finite and ascending.
141
- - **Bars** have explicit bounds, `bar({ x1, x2, y1, y2 })`, so vertical, horizontal, grouped and stacked bars are the same mark. A single `y` (or `x`) starts at zero. On a category axis `const [x1, x2] = bands(7)` gives the bounds. Grouped bars are `bar({ x, y, dodge: 'years' })` for each series, `x` being the category's place: the chart gives the shown series of that id a slot each, in the order listed, so hiding one widens the others. `bands(7, { slot: 0, of: 2 })` gives one series' bounds for a chart that never hides it.
158
+ - **Bars** have explicit bounds, `bar({ x1, x2, y1, y2 })`, so vertical, horizontal, grouped and stacked bars are the same mark. A single `y` (or `x`) starts at zero. On a category axis `const [x1, x2] = bands(7)` gives the bounds. Grouped bars are `bar({ x, y, dodge: 'years' })` for each series, `x` being the category's place: the chart gives the shown series of that id a slot each, in the order listed, so hiding one widens the others. With `dodge` or `stack`, `width` is how much of x the bars of one place take together, 0.8 by default. `bands(7, { slot: 0, of: 2 })` gives one series' bounds for a chart that never hides it.
142
159
  - **Box plots** take the five numbers as columns: `box({ x, ...fiveNumbers(groups), color })`. The whiskers go to the minimum and maximum; leave outliers out and draw them with `dots`.
143
160
  - **Heatmaps** are `heatmap({ values, columns, color: sequential({ stops }) })`, with cell (c, r) centred on x = c, y = r so it sits on band axes; `x` and `y` give the grid's outer edges instead. Create the colour scale once, outside the update, or every update repaints the grid.
144
161
  - **Pies and donuts** are `plot(el, { frame: 'polar', marks: [arcs({ values, colors, labels, inner: 0.6, text: true })] })`. A polar frame has no axes; slices start at twelve o'clock and run clockwise. `labels` give the legend one entry per slice, and `text` writes each slice's share on it where there is room. With `animate()` a pie is revealed by a sweep round the clock.
@@ -150,6 +167,7 @@ chart.destroy();
150
167
  - **Labels on shapes** (slices, stages, nodes) are drawn where they fit and left out where they would overlap or run off the chart.
151
168
  - **A colour legend** for a heatmap comes with `legend()`: a strip of its colours between the ends of its domain.
152
169
  - **Error bars** are `errorBars({ x, y1, y2 })`, or `{ y, x1, x2 }` lying down.
170
+ - **Candlesticks** are `candlestick({ x, open, high, low, close, color, up, down })`: a wick from low to high and a body from open to close, in `up` where the close is not below the open and in `down` where it is. `width` is the body's width in x units, 0.6 by default. A pointer anywhere on a candle hits it; a `nearest` tooltip gets the row, to read the four values from your own columns.
153
171
  - **Colours:** `palette` is eight series colours to give out in order, and `brand` the cyan-to-violet blend. `gradient(from, to, 'down' | 'up' | 'right' | 'left')` makes a blend of two colours; a number stands for the mark's own colour at that opacity. `line({ fill: true })` puts a faint fade of the line's colour under it. A blend goes in `area({ fill })`, `bar({ fill })`, `line({ stroke })` and `line({ fill })`, so `area({ x, y, color, fill: gradient(0.4, 0) })` fades an area out towards its baseline. `color` stays the one colour a legend and a tooltip show.
154
172
  - **Blends on other charts:** `sankey({ blend: true })` runs each ribbon from its source's colour into its target's; `funnel({ fill: gradient(a, b) })` puts one blend down the whole funnel; `arcs({ sweep: 0.8 })` and `radialBars({ sweep: 0.35 })` start each slice or bar at that opacity and bring it to full colour at its end; `treemap({ shade: 0.7 })` starts each branch at that opacity at its top, and `sunburst({ shade: 0.7 })` ends each at that opacity at the rim.
155
173
  - **Box plots** take `radius`, `medianWidth`, `whiskers` (their opacity) and `fill`: `box({ ..., radius: 4, medianWidth: 2.5, whiskers: 0.5, fill: gradient(0.4, 0.1) })`.
@@ -160,7 +178,7 @@ chart.destroy();
160
178
  - **Accessibility:** the chart is exposed as an image with a label built from the axis labels and series names; set `description` to say what it shows. The data itself is not exposed yet.
161
179
  - **Margins** are sized from the tick labels; pass `margin: { left: 80 }` to set a side yourself.
162
180
  - **Legend** is a feature you import: `use: [legend()]` lists each labelled series above the plot, highlights it on hover, and hides or shows it on a click, a tap, Enter or Space (`legend({ toggle: false })` turns that off). A label wider than the plot ends in an ellipsis. Rows are capped at what fits in a third of the chart's height, or at `legend({ rows: 2 })`, and the entries left over go behind "+N more".
163
- - **Zoom and pan** is a feature you import: `use: [zoom()]`. Ctrl or cmd and the wheel (a trackpad pinch) zoom about the pointer, a drag pans, and a double click or double tap shows the whole domain again; on a touch screen two fingers pinch and pan and one scrolls the page. `zoom({ axes: 'xy', wheel: 'plain', drag: 'shift' })` zooms both axes, zooms on a plain wheel and pans only with shift held. Over the plot a ctrl or cmd wheel never reaches the page unless `wheel: false`, and with `wheel: 'plain'` a plain one reaches it only when the view cannot move further. The window is the `view` option, `{ x?: [lo, hi], y?: [lo, hi] }` in axis values, shown clamped to the domain; `onViewChange` reports it after a gesture, never for `update()`. `y: { domain: 'nice', label, fit: 'window' }` fits y to what the x window shows.
181
+ - **Zoom and pan** is a feature you import: `use: [zoom()]`. Ctrl or cmd and the wheel (a trackpad pinch) zoom about the pointer, a drag pans, and a double click or double tap shows the whole domain again; on a touch screen two fingers pinch and pan and one scrolls the page. `zoom({ axes: 'xy', wheel: 'plain', drag: 'shift' })` zooms both axes, zooms on a plain wheel and pans only with shift held. A mouse drag along both axes pans x alone until it has moved 8 px up or down, so panning level keeps an axis with `fit: 'window'` fitting; panning up or down, or zooming y, gives both y axes a window of their own, which stops the fitting. Two fingers on a touch screen have no such threshold. Over the plot a ctrl or cmd wheel never reaches the page unless `wheel: false`, and with `wheel: 'plain'` a plain one reaches it only when the view cannot move further. The window is the `view` option, `{ x?: [lo, hi], y?: [lo, hi] }` in axis values, shown clamped to the domain; `onViewChange` reports it after a gesture, never for `update()`. `y: { domain: 'nice', label, fit: 'window' }` fits y to what the x window shows.
164
182
  - **A brush** reports a range: `use: [brush({ onSelect: range => ... })]`. A drag draws a rectangle and `onSelect` gets `{ x, y }` in axis values on release, then `null` once it is cleared; `brush({ zoom: true })` shows the range brushed. With a brush beside `zoom()`, a plain drag brushes and shift and a drag pans. Mouse and pen only.
165
183
  - **Hidden series:** `hidden: ['Group 1']` leaves out the series a legend lists under that id (a mark's `group`, or its `label`), from the start or from code, and `onHiddenChange(hidden)` reports a change the legend made. An automatic domain fits what is shown; `fit: 'all'` on an axis holds it still. The chart restacks layers given a `stack` id and re-dodges bars given a `dodge` id; the layers `stack()` returns are computed by the app, so it restacks in `onHiddenChange`.
166
184
  - **Clicks and the pointer:** `onClick(hit, at)` gets what is within 20 px of a click on the plot, or `null`, and the axis values at the click; a click that ends a drag is not one. `selected: [{ id: 'Group 1', rows: [3] }]` picks rows out. `pointer: { x, y }` shows a tooltip as if the user's pointer were there, and `onPointerChange` reports the user's, with `null` as it leaves, so two charts can follow each other:
@@ -184,7 +202,7 @@ chart.destroy();
184
202
  ```
185
203
 
186
204
  - **Reference lines and zones:** `rule({ y: 50, color: '#dc2626', dashed: true, text: 'Target' })` draws a line across the plot at each value, and `zone({ x1, x2, color, text })` a band between two values. A rule is always above the data and a zone under it, wherever they are in `marks`; neither widens a domain or counts as a series.
187
- - **Tick step and format:** an axis's `step` puts ticks on multiples of it, thinned when their labels do not fit, and `format` labels them; `time({ label, every: 3, unit: 'month', format })` does the same on a time axis. Define `format` once, outside the update: a new function each time counts as a new axis and prepares every mark again.
205
+ - **Tick step and format:** an axis's `step` puts ticks on multiples of it, thinned when their labels do not fit, and `format` labels them; `time({ label, every: 3, unit: 'month', format })` does the same on a time axis. Define `format` once, outside the update: a new function each time counts as a changed axis, so its ticks are worked out again and the data is repainted, which `animate()` shows as a cross-fade.
188
206
 
189
207
  ```ts
190
208
  const percent = (v: number) => `${v * 100}%`;
@@ -194,8 +212,10 @@ chart.destroy();
194
212
  - **Log axes:** `const y = log({ label: 'Count' })` (`base` defaults to 10, `domain` takes real values above zero). Marks take their columns through it, `line({ x, y: y.col(counts), color })`, and a value at or below zero becomes a gap. Everything the app is given or gives (`view`, `pointer`, callbacks, tooltip text) is a real value; a rule or zone takes `y.to(v, y)`. Bars need both ends given, `bar({ x1, x2, y1: y.col(lows), y2: y.col(highs), color })` with `[x1, x2]` from `bands()`, since zero has no place on a log axis, and nothing is stacked on one.
195
213
  - **Histograms and stacks** are plain functions feeding the marks: `bar({ ...bin(values, 20), color })`, and `area({ x, y, stack: 'traffic' })` or `bar({ x, y, stack: 'traffic' })` for each series stacks the shown series of that id in the order listed, negative values downwards, so hiding one closes the gap; a tooltip and `onClick` report a layer's own value. `stack([a, b, c])` gives each series the `y1` and `y2` of its layer once, for a chart that never hides one. A `NaN` in a layer counts as zero: that layer has no thickness there.
196
214
  - **Hover** highlights the series under the pointer and dims the others (`dim`). Where a chart has only one series, the hovered bar is picked out from the other bars instead.
215
+ - **Tooltips** are `tooltip({ mode: 'nearest', text })`, for what is nearest the pointer, or `tooltip({ mode: 'x', title, value })`, for every labelled line and area at its x; there `snap: x => other` reads them at another x, such as the nearest row's.
197
216
  - **Touch:** a tap shows the tooltip, and it stays after the finger lifts until a tap elsewhere or the next update or resize of the chart, which lets it go. A pen behaves as a mouse. Without `zoom()` the chart adds no listener that blocks the page from scrolling; with it the chart takes `touch-action: pan-x pan-y`, so one finger still scrolls the page.
198
217
  - **Animation** is a feature you import: `use: [animate({ duration: 300 })]`. Marks are revealed from the left on the first paint (`enter: 'fade'` fades them in instead). When the data changes, bars move to their new values, row for row, and everything else cross-fades. It is skipped for a resize, with reduced motion, and while updates arrive faster than the duration.
218
+ - **A second y axis:** `y2: { domain, label }` draws an axis on the right, and a mark given `yAxis: 'y2'` is drawn against it: `marks: [bar({ x, y: revenue, color }), line({ x, y: margin, color, yAxis: 'y2' })]`. Each axis takes its extent from its own marks, grid lines come from `y` only, and there are exactly two. A zoom or a pan on y moves `y2` through the same pixels; `view`, `onViewChange`, the click's `at`, `pointer`, `onPointerChange` and a brush's range carry `y2`, and an `x` tooltip's `value(v, axis)` is told which axis a value is on. A y `rule` or `zone` takes `yAxis` too. Bars or areas stacked under one name on the two axes are two stacks; dodged bars share their slots whichever axis they are on.
199
219
  - **Axes** are linear by default: `{ domain: 'nice' | 'data' | [lo, hi], label }`. `time({ label })` takes millisecond timestamps and puts ticks on calendar boundaries, in UTC unless `utc: false`. `log({ label })` is a log axis. `step` and `format` set the ticks, and `fit` which marks an automatic domain is fitted to. `band({ label, categories })` puts category `i` at `x = i`, owning `i - 0.5` to `i + 0.5`.
200
220
  - **Columns** (`x`, `y`, `r`) are typed arrays or plain number arrays, one set per mark.
201
221
  - **Size**: leave out `width` or `height` and the chart follows its container, which must then have a size of its own (a container with no height gives an empty chart, which draws once the container gets a height).
@@ -205,43 +225,44 @@ chart.destroy();
205
225
 
206
226
  ## Why it is fast
207
227
 
208
- Each point comes from profiling uPlot, the fastest of thirteen libraries in [chart-bench](https://github.com/gusevp/chart-bench), and timing the alternative in `experiments/`.
228
+ Each point comes from profiling uPlot, the fastest of thirteen libraries in [chart-bench](https://github.com/gusevp/chart-bench), and timing the alternative.
209
229
 
210
230
  - **Axis text is DOM, not canvas text.** uPlot's axis drawing cost 17–21 ms at 4× CPU slowdown at every data size.
211
231
  - **Each mark has its own x column.** No aligned table, so no join step.
212
232
  - **Step lines and bands are reduced to one min/max per pixel column** before the path is built.
213
233
  - **Typed-array columns in, scale maths inlined** in the draw loops.
214
- - **Scatter, bars, error bars and box plots switch to WebGL2 at 10,000 points, and a sankey at 1,000 nodes and links together.** Raw WebGL2 set-up cost about 5 ms; Canvas 2D wins or ties below roughly 10k points. When the browser takes a WebGL context away, as it does with many WebGL charts on one page, that chart falls back to Canvas 2D.
234
+ - **Scatter switches to WebGL2 at 20,000 points, bars, error bars, box plots and candlesticks at 10,000, and a sankey at 1,000 nodes and links together.** WebGL2 set-up costs about 4 ms, so a scatter on Canvas 2D mounts sooner below roughly 20,000 points. When the browser takes a WebGL context away, as it does with many WebGL charts on one page, that chart falls back to Canvas 2D.
215
235
  - **Paths and GPU buffers are kept,** so a hover repaint never touches the data again.
216
236
 
217
237
  ## Measured
218
238
 
219
- Mount time in chart-bench, median ms, 2026-11-20, Apple M3 Pro that was not idle. Each cell is the mean of two runs of nine loads, with the two libraries taking turns to go first. 4× is Chrome's CPU slowdown. At native speed every case but uPlot's largest sits at the empty-page floor (about 27 ms), so only the other columns separate them.
239
+ Mount time in chart-bench, median ms, 2026-11-24, Apple M3 Pro that was not idle. Each cell is the mean of two runs of nine loads, each load a new page, with the two libraries taking turns to go first. 4× is Chrome's CPU slowdown. At native speed the two smaller sizes sit at the empty-page floor (about 27 ms), so only the other rows and columns separate the libraries.
220
240
 
221
241
  | case | swiftplot | uPlot | swiftplot, 4× | uPlot, 4× |
222
242
  | ------------------------ | --------: | ----: | ------------: | --------: |
223
- | survival, 3 × 200 points | 29.3 | 25.9 | 33.5 | 53.3 |
224
- | survival, 6 × 1,000 | 28.3 | 24.7 | 37.9 | 68.8 |
225
- | survival, 10 × 10,000 | 31.6 | 55.2 | 67.1 | 196.9 |
226
- | scatter, 500 | 27.8 | 25.2 | 33.7 | 46.0 |
227
- | scatter, 10,000 | 25.1 | 26.6 | 38.9 | 55.7 |
228
- | scatter, 100,000 | 30.6 | 34.3 | 56.8 | 129.0 |
243
+ | survival, 3 × 200 points | 26.8 | 28.8 | 47.9 | 58.3 |
244
+ | survival, 6 × 1,000 | 29.4 | 22.1 | 49.6 | 71.1 |
245
+ | survival, 10 × 10,000 | 33.1 | 55.2 | 86.0 | 218.2 |
246
+ | scatter, 500 | 26.2 | 26.1 | 37.7 | 60.0 |
247
+ | scatter, 10,000 | 25.3 | 25.8 | 52.0 | 66.5 |
248
+ | scatter, 100,000 | 32.2 | 34.9 | 68.0 | 137.5 |
229
249
 
230
250
  Time until the chart's own code has finished, which leaves out the wait for the next frame:
231
251
 
232
252
  | case | swiftplot | uPlot | swiftplot, 4× | uPlot, 4× |
233
253
  | ------------------------ | --------: | ----: | ------------: | --------: |
234
- | survival, 3 × 200 points | 4.0 | 10.7 | 14.4 | 41.7 |
235
- | survival, 6 × 1,000 | 5.7 | 14.2 | 20.6 | 55.8 |
236
- | survival, 10 × 10,000 | 14.3 | 50.6 | 48.2 | 181.6 |
237
- | scatter, 500 | 3.1 | 9.3 | 12.2 | 35.4 |
238
- | scatter, 10,000 | 5.9 | 12.9 | 21.3 | 44.6 |
239
- | scatter, 100,000 | 14.5 | 28.6 | 39.6 | 111.2 |
240
-
254
+ | survival, 3 × 200 points | 5.1 | 9.4 | 25.5 | 45.1 |
255
+ | survival, 6 × 1,000 | 8.0 | 13.2 | 30.9 | 58.7 |
256
+ | survival, 10 × 10,000 | 19.6 | 51.3 | 66.9 | 200.9 |
257
+ | scatter, 500 | 4.3 | 8.3 | 19.2 | 45.9 |
258
+ | scatter, 10,000 | 6.8 | 11.8 | 31.4 | 51.9 |
259
+ | scatter, 100,000 | 14.2 | 29.3 | 48.8 | 119.1 |
260
+
261
+ - Every load is the first chart on a new page, so each cell includes the browser parsing the library's code for the first time. A second chart on the same page does not pay that.
241
262
  - The 100k scatter runs on WebGL, where the draw call returns before the GPU finishes, so its numbers flatter swiftplot.
242
263
  - uPlot has no built-in scatter, so its scatter numbers include circle-drawing code written for the benchmark.
243
264
  - Only these two chart types are in the benchmark. Bars, areas, the time axis, the legend and animation are not measured against uPlot.
244
- - uPlot ships far more features in its 23.6 KB gzip (plus a stylesheet); the swiftplot code these two charts pull in is 7.2 KB gzip.
265
+ - uPlot ships far more features in the 23.9 KB gzip it adds to the benchmark page (plus a stylesheet); swiftplot adds 15.8 KB, with its tooltip and animation.
245
266
 
246
267
  Script time of one pan step, `propose()` of a window moved by a hundredth of its width (at the whole domain, one narrowed by a thousandth), median ms of 50, on an 800 × 400 chart, 2026-11-22, Apple M3 Pro, Chrome on Metal. Before → after is the remedy of the same date: a line or an area reads only the rows its window shows, and points on the canvas skip those that cannot reach the plot.
247
268
 
@@ -266,7 +287,7 @@ Script time of one pan step, `propose()` of a window moved by a hundredth of its
266
287
  | points, 10× | 0.0 | 0.0 |
267
288
  | points, 5000× | 13.3 → 0.2 | 156.9 → 1.9 |
268
289
 
269
- - Bars and points of 10,000 rows or more are drawn by WebGL, whose draw call returns before the GPU finishes, so their whole and 10× cells leave the drawing out. Magnified past 4096 times every mark is drawn on the canvas.
290
+ - Bars of 10,000 rows or more and points of 20,000 or more are drawn by WebGL, whose draw call returns before the GPU finishes, so their whole and 10× cells leave the drawing out. Magnified past 4096 times every mark is drawn on the canvas.
270
291
  - A million bars at 5000× is over the 16 ms budget: the canvas still walks every bar.
271
292
 
272
293
  The same step at 1,000,000 points with `fit: 'window'` on the y axis, 2026-11-22, beside the step without it in the same run (mean of two runs each). At the whole domain two windows narrowed by a thousandth and by two take turns, since one window repeated would be fitted once and kept.
@@ -290,20 +311,23 @@ The same step at 1,000,000 points with `fit: 'window'` on the y axis, 2026-11-22
290
311
 
291
312
  ## Develop
292
313
 
293
- From the repository root. `build`, `test:import`, `test` and `typecheck` run in every package under `packages/`. GitHub runs these checks, then packs the packages and checks the tarballs, on every push to `main` and every pull request (`.github/workflows/ci.yml`, read-only):
314
+ From the repository root. `build`, `test` and `typecheck` run in every package under `packages/` and in the site (`site/`), `test:import` in the packages only. GitHub runs these checks, then packs the packages and checks the tarballs, on every push to `main` and every pull request (`.github/workflows/ci.yml`, read-only):
294
315
 
295
316
  ```sh
296
317
  pnpm install
297
318
  pnpm --filter swiftplot exec playwright install chromium # once, for the tests
298
319
  pnpm build
299
320
  pnpm test:import # imports each package's dist/ in Node, after pnpm build
300
- pnpm test # Vitest in a real browser, one package at a time, then node --test on scripts/
321
+ pnpm test:smoke # Playwright on the built site, after pnpm build
322
+ pnpm test # Vitest (in a real browser for the packages), one package at a time, then node --test on scripts/
301
323
  pnpm typecheck
302
324
  pnpm --filter swiftplot run test # one package
303
325
  pnpm lint # oxlint, type-aware
304
326
  pnpm format # oxfmt
305
327
  ```
306
328
 
329
+ The site is the Astro project in `site/`. `pnpm --filter swiftplot-site dev` serves it while you edit; `pnpm --filter swiftplot-site build`, then `pnpm --filter swiftplot-site exec astro preview`, serves the build, with search. `pnpm test:smoke` needs that build in `site/dist` and the Chromium installed above, and starts the preview itself. The site's other commands and its Cloudflare Pages settings are in [site/README.md](site/README.md).
330
+
307
331
  ## Releasing
308
332
 
309
333
  Every package has the same version, and one release is one tag `vX.Y.Z` and one GitHub Release with the three tarballs and `SHA256SUMS`. The changelog is `CHANGELOG.md`: work adds its entries under `## Unreleased`, written by hand. Two commands, run on your machine with your own `git`, `gh` and `npm` logins:
package/dist/index.d.ts CHANGED
@@ -1,15 +1,39 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { Options } from 'swiftplot';
3
- import { type AreaChartProps as AreaProps, type BarChartProps as BarProps, type LineChartProps as LineProps, type ScatterChartProps as ScatterProps } from 'swiftplot/charts';
3
+ import { type AreaChartProps as AreaProps, type BarChartProps as BarProps, type BoxPlotChartProps as BoxPlotProps, type CandlestickChartProps as CandlestickProps, type ComboChartProps as ComboProps, type FunnelChartProps as FunnelProps, type HeatmapChartProps as HeatmapProps, type HistogramChartProps as HistogramProps, type LineChartProps as LineProps, type PieChartProps as PieProps, type RadarChartProps as RadarProps, type RadialBarChartProps as RadialBarProps, type SankeyChartProps as SankeyProps, type ScatterChartProps as ScatterProps, type SunburstChartProps as SunburstProps, type TreemapChartProps as TreemapProps } from 'swiftplot/charts';
4
4
  import { type HostProps } from './bind.js';
5
5
  export type { HostProps };
6
6
  export type LineChartProps<D = undefined> = LineProps<D> & HostProps;
7
7
  export type AreaChartProps<D = undefined> = AreaProps<D> & HostProps;
8
8
  export type BarChartProps<D = undefined> = BarProps<D> & HostProps;
9
9
  export type ScatterChartProps<D = undefined> = ScatterProps<D> & HostProps;
10
+ export type PieChartProps<D = undefined> = PieProps<D> & HostProps;
11
+ export type FunnelChartProps<D = undefined> = FunnelProps<D> & HostProps;
12
+ export type RadialBarChartProps<D = undefined> = RadialBarProps<D> & HostProps;
13
+ export type RadarChartProps<D = undefined> = RadarProps<D> & HostProps;
14
+ export type HeatmapChartProps<D = undefined> = HeatmapProps<D> & HostProps;
15
+ export type HistogramChartProps<D = undefined> = HistogramProps<D> & HostProps;
16
+ export type BoxPlotChartProps<D = undefined> = BoxPlotProps<D> & HostProps;
17
+ export type CandlestickChartProps<D = undefined> = CandlestickProps<D> & HostProps;
18
+ export type ComboChartProps<D = undefined> = ComboProps<D> & HostProps;
19
+ export type SankeyChartProps<D = undefined> = SankeyProps<D> & HostProps;
20
+ export type TreemapChartProps = TreemapProps & HostProps;
21
+ export type SunburstChartProps = SunburstProps & HostProps;
10
22
  export type PlotProps = Options & HostProps;
11
23
  export declare const LineChart: <D = undefined>(props: LineChartProps<D>) => ReactElement;
12
24
  export declare const AreaChart: <D = undefined>(props: AreaChartProps<D>) => ReactElement;
13
25
  export declare const BarChart: <D = undefined>(props: BarChartProps<D>) => ReactElement;
14
26
  export declare const ScatterChart: <D = undefined>(props: ScatterChartProps<D>) => ReactElement;
27
+ export declare const PieChart: <D = undefined>(props: PieChartProps<D>) => ReactElement;
28
+ export declare const FunnelChart: <D = undefined>(props: FunnelChartProps<D>) => ReactElement;
29
+ export declare const RadialBarChart: <D = undefined>(props: RadialBarChartProps<D>) => ReactElement;
30
+ export declare const RadarChart: <D = undefined>(props: RadarChartProps<D>) => ReactElement;
31
+ export declare const HeatmapChart: <D = undefined>(props: HeatmapChartProps<D>) => ReactElement;
32
+ export declare const HistogramChart: <D = undefined>(props: HistogramChartProps<D>) => ReactElement;
33
+ export declare const BoxPlotChart: <D = undefined>(props: BoxPlotChartProps<D>) => ReactElement;
34
+ export declare const CandlestickChart: <D = undefined>(props: CandlestickChartProps<D>) => ReactElement;
35
+ export declare const ComboChart: <D = undefined>(props: ComboChartProps<D>) => ReactElement;
36
+ export declare const SankeyChart: <D = undefined>(props: SankeyChartProps<D>) => ReactElement;
37
+ export declare const TreemapChart: (props: TreemapChartProps) => ReactElement;
38
+ export declare const SunburstChart: (props: SunburstChartProps) => ReactElement;
15
39
  export declare const Plot: (props: PlotProps) => ReactElement;
package/dist/index.js CHANGED
@@ -1,8 +1,20 @@
1
1
  'use client';
2
- import { areaChart, barChart, lineChart, mount, scatterChart, } from 'swiftplot/charts';
2
+ import { areaChart, barChart, boxPlotChart, candlestickChart, comboChart, funnelChart, heatmapChart, histogramChart, lineChart, mount, pieChart, radarChart, radialBarChart, sankeyChart, scatterChart, sunburstChart, treemapChart, } from 'swiftplot/charts';
3
3
  import { bind } from './bind.js';
4
4
  export const LineChart = bind(lineChart);
5
5
  export const AreaChart = bind(areaChart);
6
6
  export const BarChart = bind(barChart);
7
7
  export const ScatterChart = bind(scatterChart);
8
+ export const PieChart = bind(pieChart);
9
+ export const FunnelChart = bind(funnelChart);
10
+ export const RadialBarChart = bind(radialBarChart);
11
+ export const RadarChart = bind(radarChart);
12
+ export const HeatmapChart = bind(heatmapChart);
13
+ export const HistogramChart = bind(histogramChart);
14
+ export const BoxPlotChart = bind(boxPlotChart);
15
+ export const CandlestickChart = bind(candlestickChart);
16
+ export const ComboChart = bind(comboChart);
17
+ export const SankeyChart = bind(sankeyChart);
18
+ export const TreemapChart = bind(treemapChart);
19
+ export const SunburstChart = bind(sunburstChart);
8
20
  export const Plot = bind(mount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftplot/react",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "React components for swiftplot charts",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,9 +21,10 @@
21
21
  ],
22
22
  "peerDependencies": {
23
23
  "react": "^18.3 || ^19",
24
- "swiftplot": "^0.1.1"
24
+ "swiftplot": "^0.3.0"
25
25
  },
26
26
  "devDependencies": {
27
+ "@types/node": "^24.19.2",
27
28
  "@types/react": "^19.3.0",
28
29
  "@types/react-dom": "^19.3.0",
29
30
  "@vitest/browser-playwright": "^5.1.1",
@@ -32,11 +33,11 @@
32
33
  "react-dom": "^19.3.1",
33
34
  "typescript": "^7.0.2",
34
35
  "vitest": "^5.1.1",
35
- "swiftplot": "0.1.1"
36
+ "swiftplot": "0.3.0"
36
37
  },
37
38
  "scripts": {
38
39
  "build": "tsc -p tsconfig.build.json",
39
- "typecheck": "tsc --noEmit",
40
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json",
40
41
  "test": "vitest run",
41
42
  "test:import": "node test/import.mjs"
42
43
  }