nuxt-charts 2.2.1 → 3.0.0-beta.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 (92) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +80 -79
  3. package/dist/module.d.mts +4 -4
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +64 -95
  6. package/dist/runtime/assets/components.css +1 -0
  7. package/dist/runtime/assets/theme.css +1 -0
  8. package/dist/runtime/components/AreaChart.d.vue.ts +19 -0
  9. package/dist/runtime/components/AreaChart.vue +149 -0
  10. package/dist/runtime/components/AreaChart.vue.d.ts +19 -0
  11. package/dist/runtime/components/BarChart.d.vue.ts +19 -0
  12. package/dist/runtime/components/BarChart.vue +175 -0
  13. package/dist/runtime/components/BarChart.vue.d.ts +19 -0
  14. package/dist/runtime/components/BubbleChart.d.vue.ts +19 -0
  15. package/dist/runtime/components/BubbleChart.vue +213 -0
  16. package/dist/runtime/components/BubbleChart.vue.d.ts +19 -0
  17. package/dist/runtime/components/CandlestickChart.d.vue.ts +19 -0
  18. package/dist/runtime/components/CandlestickChart.vue +329 -0
  19. package/dist/runtime/components/CandlestickChart.vue.d.ts +19 -0
  20. package/dist/runtime/components/DonutChart.d.vue.ts +21 -0
  21. package/dist/runtime/components/DonutChart.vue +116 -0
  22. package/dist/runtime/components/DonutChart.vue.d.ts +21 -0
  23. package/dist/runtime/components/FunnelChart.d.vue.ts +19 -0
  24. package/dist/runtime/components/FunnelChart.vue +152 -0
  25. package/dist/runtime/components/FunnelChart.vue.d.ts +19 -0
  26. package/dist/runtime/components/LineChart.d.vue.ts +19 -0
  27. package/dist/runtime/components/LineChart.vue +84 -0
  28. package/dist/runtime/components/LineChart.vue.d.ts +19 -0
  29. package/dist/runtime/components/RadarChart.d.vue.ts +19 -0
  30. package/dist/runtime/components/RadarChart.vue +90 -0
  31. package/dist/runtime/components/RadarChart.vue.d.ts +19 -0
  32. package/dist/runtime/components/RadialBarChart.d.vue.ts +19 -0
  33. package/dist/runtime/components/RadialBarChart.vue +81 -0
  34. package/dist/runtime/components/RadialBarChart.vue.d.ts +19 -0
  35. package/dist/runtime/components/StatusTrackerChart.d.vue.ts +19 -0
  36. package/dist/runtime/components/StatusTrackerChart.vue +147 -0
  37. package/dist/runtime/components/StatusTrackerChart.vue.d.ts +19 -0
  38. package/dist/runtime/components/internal/CandlestickTooltip.d.vue.ts +17 -0
  39. package/dist/runtime/components/internal/CandlestickTooltip.vue +38 -0
  40. package/dist/runtime/components/internal/CandlestickTooltip.vue.d.ts +17 -0
  41. package/dist/runtime/components/internal/CartesianFrame.d.vue.ts +40 -0
  42. package/dist/runtime/components/internal/CartesianFrame.vue +321 -0
  43. package/dist/runtime/components/internal/CartesianFrame.vue.d.ts +40 -0
  44. package/dist/runtime/components/internal/ChartLegend.d.vue.ts +11 -0
  45. package/dist/runtime/components/internal/ChartLegend.vue +22 -0
  46. package/dist/runtime/components/internal/ChartLegend.vue.d.ts +11 -0
  47. package/dist/runtime/components/internal/ChartTooltip.d.vue.ts +3 -0
  48. package/dist/runtime/components/internal/ChartTooltip.vue +39 -0
  49. package/dist/runtime/components/internal/ChartTooltip.vue.d.ts +3 -0
  50. package/dist/runtime/components/internal/CubeBarShape.d.vue.ts +28 -0
  51. package/dist/runtime/components/internal/CubeBarShape.vue +69 -0
  52. package/dist/runtime/components/internal/CubeBarShape.vue.d.ts +28 -0
  53. package/dist/runtime/components/internal/DitherDefs.d.ts +98 -0
  54. package/dist/runtime/components/internal/DitherDefs.js +158 -0
  55. package/dist/runtime/components/internal/FunnelLayeredShape.d.vue.ts +42 -0
  56. package/dist/runtime/components/internal/FunnelLayeredShape.vue +124 -0
  57. package/dist/runtime/components/internal/FunnelLayeredShape.vue.d.ts +42 -0
  58. package/dist/runtime/components/internal/GradientDefs.d.ts +46 -0
  59. package/dist/runtime/components/internal/GradientDefs.js +38 -0
  60. package/dist/runtime/enums.d.ts +65 -0
  61. package/dist/runtime/enums.js +40 -0
  62. package/dist/runtime/types/charts.d.ts +642 -0
  63. package/dist/runtime/types/charts.js +0 -0
  64. package/dist/runtime/types/shared.d.ts +202 -0
  65. package/dist/runtime/types/shared.js +0 -0
  66. package/dist/runtime/types.d.ts +8 -0
  67. package/dist/runtime/types.js +0 -0
  68. package/dist/runtime/utils/axis.d.ts +132 -0
  69. package/dist/runtime/utils/axis.js +93 -0
  70. package/dist/runtime/utils/categories.d.ts +36 -0
  71. package/dist/runtime/utils/categories.js +18 -0
  72. package/dist/runtime/utils/cubes.d.ts +100 -0
  73. package/dist/runtime/utils/cubes.js +73 -0
  74. package/dist/runtime/utils/curve.d.ts +12 -0
  75. package/dist/runtime/utils/curve.js +26 -0
  76. package/dist/runtime/utils/dither.d.ts +55 -0
  77. package/dist/runtime/utils/dither.js +45 -0
  78. package/dist/runtime/utils/gradient.d.ts +12 -0
  79. package/dist/runtime/utils/gradient.js +8 -0
  80. package/dist/runtime/utils/index.d.ts +6 -0
  81. package/dist/runtime/utils/index.js +6 -0
  82. package/dist/runtime/utils/legend.d.ts +27 -0
  83. package/dist/runtime/utils/legend.js +19 -0
  84. package/dist/runtime/utils/marker.d.ts +20 -0
  85. package/dist/runtime/utils/marker.js +21 -0
  86. package/dist/runtime/utils/style.d.ts +14 -0
  87. package/dist/runtime/utils/style.js +10 -0
  88. package/dist/runtime/utils/theme.d.ts +36 -0
  89. package/dist/runtime/utils/theme.js +45 -0
  90. package/package.json +56 -12
  91. package/dist/runtime/vue-chrts.d.ts +0 -1
  92. package/dist/runtime/vue-chrts.js +0 -13
@@ -0,0 +1,642 @@
1
+ /**
2
+ * Per-chart prop interfaces.
3
+ *
4
+ * These deliberately mirror the `nuxt-charts` v2 (`vue-chrts`) API so existing
5
+ * templates keep working after the engine swap to `vccs`. Props that were
6
+ * Unovis-only and have no `vccs` analog are kept and marked `@deprecated`
7
+ * (inert), so old templates type-check without surfacing errors.
8
+ *
9
+ * Generics (`T`, `N`, `L`) flow the user's row type through, giving `keyof T`
10
+ * autocomplete on axis keys and typed formatters.
11
+ */
12
+ import type { CurveType, DonutType, LegendPosition, Orientation } from "../enums.js";
13
+ import type { DitherVariant } from "../utils/dither.js";
14
+ import type { AxisConfig, AxisId, BulletLegendItemInterface, ChartPadding, ChartTheme, CrosshairConfig, MarkerConfig, TooltipConfig, YAxisConfig, axisFormatter } from "./shared.js";
15
+ /**
16
+ * Props common to the cartesian charts (area, bar, line, bubble). Centralises
17
+ * axis / legend / tooltip / grid options so each chart interface only adds its
18
+ * own specifics.
19
+ */
20
+ export interface CartesianChartBaseProps<T> {
21
+ /** The data to render. Each element is one data point. */
22
+ data: T[];
23
+ /** Chart height in pixels. */
24
+ height: number;
25
+ /** Optional x-axis label. */
26
+ xLabel?: string;
27
+ /** Optional y-axis label. */
28
+ yLabel?: string;
29
+ /** Optional per-side chart padding. */
30
+ padding?: ChartPadding;
31
+ /**
32
+ * Maps each category key to its legend representation (label, colour).
33
+ * The keys are the data properties plotted as series.
34
+ */
35
+ categories: Record<string, BulletLegendItemInterface>;
36
+ /** Formats x-axis ticks. */
37
+ xFormatter?: axisFormatter;
38
+ /** Formats y-axis ticks. */
39
+ yFormatter?: axisFormatter;
40
+ /** Custom formatter for tooltip titles. */
41
+ tooltipTitleFormatter?: (data: T) => string | number;
42
+ /** Desired number of x-axis ticks. */
43
+ xNumTicks?: number;
44
+ /** Desired number of y-axis ticks. */
45
+ yNumTicks?: number;
46
+ /** Hide the legend. */
47
+ hideLegend?: boolean;
48
+ /** Hide the tooltip. */
49
+ hideTooltip?: boolean;
50
+ /** Legend position. */
51
+ legendPosition?: LegendPosition;
52
+ /** Inline style for the legend container. */
53
+ legendStyle?: string | Record<string, string>;
54
+ /** Show the x-axis domain (axis) line. */
55
+ xDomainLine?: boolean;
56
+ /** Show the y-axis domain (axis) line. */
57
+ yDomainLine?: boolean;
58
+ /** Show x-axis tick lines. */
59
+ xTickLine?: boolean;
60
+ /** Show y-axis tick lines. */
61
+ yTickLine?: boolean;
62
+ /** Show vertical grid lines. */
63
+ xGridLine?: boolean;
64
+ /** Show horizontal grid lines. */
65
+ yGridLine?: boolean;
66
+ /** Hide the x-axis entirely. */
67
+ hideXAxis?: boolean;
68
+ /** Hide the y-axis entirely. */
69
+ hideYAxis?: boolean;
70
+ /** Fixed x-axis domain as `[min, max]`. */
71
+ xDomain?: [number | undefined, number | undefined];
72
+ /** Fixed y-axis domain as `[min, max]`. */
73
+ yDomain?: [number | undefined, number | undefined];
74
+ /** Animation duration in milliseconds. */
75
+ duration?: number;
76
+ /** Axis appearance config for the x-axis. */
77
+ xAxisConfig?: AxisConfig;
78
+ /** Axis appearance config for the y-axis. */
79
+ yAxisConfig?: AxisConfig;
80
+ /**
81
+ * Additional y-axes keyed by id, for plotting series with different units on
82
+ * independent scales. Reference an id from a category's `yAxis` field:
83
+ *
84
+ * ```ts
85
+ * const categories = {
86
+ * temperature: { name: "Temp", yAxis: "temp" },
87
+ * humidity: { name: "Humidity", yAxis: "pct" },
88
+ * };
89
+ * const yAxes = {
90
+ * temp: { orientation: "left", label: "°C" },
91
+ * pct: { orientation: "right", label: "%" },
92
+ * };
93
+ * ```
94
+ *
95
+ * Series without a `yAxis` fall back to the primary axis configured by the
96
+ * top-level `yLabel` / `yDomain` / `yAxisConfig` props.
97
+ */
98
+ yAxes?: Record<AxisId, YAxisConfig>;
99
+ /** Tooltip behaviour config. */
100
+ tooltip?: TooltipConfig;
101
+ /** Reference lines drawn across the plot area. New in v3. */
102
+ referenceLines?: ReferenceLineConfig[];
103
+ /**
104
+ * Synchronise tooltip / hover across charts sharing the same `syncId`.
105
+ * New in v3 (forwarded to the `vccs` container).
106
+ */
107
+ syncId?: string;
108
+ /** Force only the first and last ticks (maps to `vccs` `interval="preserveStartEnd"`). */
109
+ minMaxTicksOnly?: boolean;
110
+ /** Explicit x-axis tick values (maps to `vccs` axis `ticks`). */
111
+ xExplicitTicks?: (number | string | Date)[];
112
+ /** Explicit y-axis tick values (maps to `vccs` axis `ticks`). */
113
+ yExplicitTicks?: (number | string | Date)[];
114
+ /** @deprecated Unovis-only; no effect. */
115
+ crosshairConfig?: CrosshairConfig<T>;
116
+ /**
117
+ * Per-chart appearance overrides (grid, axis, legend, hover, tooltip). Layers
118
+ * over the global `--vc-*` token defaults; omit to use the shipped theme.
119
+ */
120
+ theme?: ChartTheme;
121
+ }
122
+ export interface AreaChartProps<T> extends CartesianChartBaseProps<T> {
123
+ /** The data key used for the category (x) axis. */
124
+ xAxis?: keyof T;
125
+ /** Curve interpolation for the area outline. */
126
+ curveType?: CurveType;
127
+ /** Render only the line, hiding the area fill. */
128
+ hideArea?: boolean;
129
+ /**
130
+ * Vertical fade-out for the area fill. Default `true`. Set `false` for a flat
131
+ * fill. When `dither` is also set, the fade is applied as a mask over the
132
+ * dither pattern instead of replacing it.
133
+ */
134
+ gradient?: boolean;
135
+ /** Gradient stops for the area fade. Overrides the default opacity ramp. */
136
+ gradientStops?: Array<{
137
+ offset: string;
138
+ stopOpacity: number;
139
+ }>;
140
+ /**
141
+ * Fill the area with a tiling halftone dot pattern. `true` uses the `bayer`
142
+ * variant. Composes with `gradient` (the vertical fade) unless `gradient` is
143
+ * `false`.
144
+ */
145
+ dither?: boolean | DitherVariant;
146
+ /** Tile edge length in px for the dither pattern. Default 8. */
147
+ ditherTile?: number;
148
+ /**
149
+ * Opacity of the solid colour wash painted under the dither dots, which is
150
+ * what makes a dithered area fade from colour at the top to transparent at
151
+ * the domain line like a normal gradient fill, instead of showing bare dots.
152
+ * Defaults to the top `gradientStops` opacity; set `0` for dots only.
153
+ */
154
+ ditherWash?: number;
155
+ /** Line width in pixels. Default 2. */
156
+ lineWidth?: number;
157
+ /** Stack the areas instead of overlaying them. */
158
+ stacked?: boolean;
159
+ /**
160
+ * SVG `stroke-dasharray` for dashed lines. Accepts the v2 `number[][]` form
161
+ * (flattened to a dash pattern) or a ready CSS string like `"6 4"`.
162
+ */
163
+ lineDashArray?: number[][] | string;
164
+ /** Per-series marker (dot) configuration. Renders dots on the area outline. */
165
+ markerConfig?: MarkerConfig;
166
+ }
167
+ export type LineChartProps<T> = Omit<AreaChartProps<T>, "hideArea" | "gradient" | "gradientStops" | "dither" | "ditherTile" | "ditherWash">;
168
+ /**
169
+ * A reference line drawn across a cartesian chart. New in v3 — maps onto the
170
+ * `vccs` `<ReferenceLine>`. Provide `x` for a vertical line or `y` for a
171
+ * horizontal one (matching the respective axis value).
172
+ */
173
+ export interface ReferenceLineConfig {
174
+ /** X-axis value for a vertical line. */
175
+ x?: number | string;
176
+ /** Y-axis value for a horizontal line. */
177
+ y?: number | string;
178
+ /** Line colour. Default `#888`. */
179
+ color?: string;
180
+ /** Line width in pixels. Default 1. */
181
+ strokeWidth?: number;
182
+ /** Optional label drawn alongside the line. */
183
+ label?: string | number;
184
+ /** SVG dash pattern, e.g. `"3 3"`. */
185
+ strokeDasharray?: string;
186
+ }
187
+ /** Value-label config for bar charts. */
188
+ export interface ValueLabel {
189
+ label: (d: unknown, index: number) => string | number;
190
+ labelSpacing?: number;
191
+ backgroundColor?: string;
192
+ color?: string;
193
+ labelFontSize?: number;
194
+ }
195
+ export interface BarChartProps<T> extends CartesianChartBaseProps<T> {
196
+ /** The data keys (series) plotted on the value axis. */
197
+ yAxis: (keyof T)[];
198
+ /** The data key used for the category axis. */
199
+ xAxis?: keyof T;
200
+ /** Stack the bars instead of grouping them. */
201
+ stacked?: boolean;
202
+ /** Bar orientation (vertical = column, horizontal = bar). */
203
+ orientation?: Orientation;
204
+ /** Rounded corner radius for bars in pixels. Default 2. */
205
+ radius?: number;
206
+ /**
207
+ * Gap between bars within a group. Number = px, string = percent (e.g. `"2%"`).
208
+ * Lower values pull grouped bars closer. Default `4` (vccs).
209
+ */
210
+ barGap?: number | string;
211
+ /**
212
+ * Gap between category groups. Number = px, string = percent (e.g. `"10%"`).
213
+ * Default `"10%"` (vccs).
214
+ */
215
+ barCategoryGap?: number | string;
216
+ /**
217
+ * @deprecated Prefer `barGap`. Still forwarded as `barGap` when `barGap` is omitted.
218
+ */
219
+ barPadding?: number;
220
+ /**
221
+ * @deprecated Prefer `barCategoryGap`. Still forwarded as `barCategoryGap` when
222
+ * `barCategoryGap` is omitted.
223
+ */
224
+ groupPadding?: number;
225
+ /** Value-label config. */
226
+ valueLabel?: ValueLabel;
227
+ /**
228
+ * Bar render variant. `"solid"` is the default rectangle bar.
229
+ * `"cubes"` draws a vertical stack of rounded squares. Works with single,
230
+ * grouped, and stacked (`stacked`) series — for stacks, only the first
231
+ * series draws the ghost column; each series fills its own cube range.
232
+ */
233
+ variant?: "solid" | "cubes";
234
+ /** Gap between cubes in px when `variant="cubes"`. Default 2. */
235
+ cubeGap?: number;
236
+ /** Corner radius per cube when `variant="cubes"`. Default 2. */
237
+ cubeRadius?: number;
238
+ /**
239
+ * Preferred cube edge length in px when `variant="cubes"`. Default 10.
240
+ * Clamped to the bar band width so columns stay straight and centered.
241
+ */
242
+ cubeSize?: number;
243
+ /**
244
+ * When set below `cubeSize`, cubes taper from `cubeSize` at the top of the
245
+ * plot to this size at the baseline. Size follows absolute chart Y so every
246
+ * horizontal line shares one cube size. Opacity also fades top → bottom
247
+ * (see `cubeMinOpacity`). Omit for uniform cubes.
248
+ */
249
+ cubeMinSize?: number;
250
+ /**
251
+ * Floor fill-opacity when size-tapering (top stays 1). Default `0.05`.
252
+ * Only applies when `cubeMinSize` is set.
253
+ */
254
+ cubeMinOpacity?: number;
255
+ /** Fill for empty/ghost cubes when `variant="cubes"`. */
256
+ cubeEmptyColor?: string;
257
+ /** @deprecated Unovis-only; no effect. Use `stacked`. */
258
+ stackAndGrouped?: boolean;
259
+ /** @deprecated Unovis-only; no effect. */
260
+ stackedGroupedSpacing?: number;
261
+ }
262
+ /** Options controlling bubble (scatter) point sizes. */
263
+ export interface SizeOptions {
264
+ minRadius?: number;
265
+ maxRadius?: number;
266
+ }
267
+ /** v2 accepted Unovis-style function accessors; v3 also accepts row field keys. */
268
+ export type BubbleAccessor<T> = keyof T | ((datum: T) => number | string | Date | null | undefined);
269
+ export interface BubbleChartProps<T> extends CartesianChartBaseProps<T> {
270
+ /** Data key or accessor for the bubble's x value. */
271
+ xAccessor: BubbleAccessor<T>;
272
+ /** Data key or accessor for the bubble's y value. */
273
+ yAccessor: BubbleAccessor<T>;
274
+ /** Data key or accessor for the bubble's size value. */
275
+ sizeAccessor?: BubbleAccessor<T>;
276
+ /** Data key used to split points into colour-coded series. */
277
+ categoryKey: keyof T;
278
+ /**
279
+ * Bubble size range mapped through `ZAxis` as `[min, max]` area.
280
+ * Default `[60, 400]` (matches typical Recharts scatter sizing).
281
+ */
282
+ sizeRange?: [number, number];
283
+ /** Bubble fill opacity. */
284
+ opacity?: number;
285
+ /** Options controlling bubble sizes. */
286
+ sizeOptions?: SizeOptions;
287
+ }
288
+ /**
289
+ * Candlestick (OHLC) chart props. New in v3 — no `vccs` primitive exists, so the
290
+ * adapter composes a `vccs` `<ComposedChart>` (for the real axes, grid, scales
291
+ * and tooltip) with a custom candle layer drawn from the axis scales exposed by
292
+ * `vccs`'s public hooks.
293
+ *
294
+ * Each row in `data` is one candle. Accessors name the OHLC fields; the default
295
+ * accessors read `label`/`open`/`high`/`low`/`close`/`volume`, so a row shaped
296
+ * like `{ label, open, high, low, close, volume? }` works with no config.
297
+ */
298
+ export interface CandlestickChartProps<T> {
299
+ /** The data to render. Each element is one candle. */
300
+ data: T[];
301
+ /** Chart height in pixels. */
302
+ height: number;
303
+ /** Row field used for the x (category) axis label. Default `"label"`. */
304
+ xAccessor?: keyof T;
305
+ /** Row field for the open price. Default `"open"`. */
306
+ openAccessor?: keyof T;
307
+ /** Row field for the high price. Default `"high"`. */
308
+ highAccessor?: keyof T;
309
+ /** Row field for the low price. Default `"low"`. */
310
+ lowAccessor?: keyof T;
311
+ /** Row field for the close price. Default `"close"`. */
312
+ closeAccessor?: keyof T;
313
+ /** Optional row field for the traded volume. Default `"volume"`. */
314
+ volumeAccessor?: keyof T;
315
+ /** Colour for rising candles (close ≥ open). Default `#10b981`. */
316
+ upColor?: string;
317
+ /** Colour for falling candles (close < open). Default `#ef4444`. */
318
+ downColor?: string;
319
+ /** Max candle body width in pixels. Default 18. */
320
+ candleWidth?: number;
321
+ /** Wick (high-low line) width in pixels. Default 1.5. */
322
+ wickWidth?: number;
323
+ /** Draw a volume histogram beneath the candles. Default false. */
324
+ showVolume?: boolean;
325
+ /** Optional x-axis label. */
326
+ xLabel?: string;
327
+ /** Optional y-axis label. */
328
+ yLabel?: string;
329
+ /** Formats y-axis ticks and tooltip prices. */
330
+ yFormatter?: (value: number) => string;
331
+ /** Formats x-axis (category) ticks. Receives the row index. */
332
+ xFormatter?: (index: number) => string;
333
+ /** Custom formatter for tooltip titles. */
334
+ tooltipTitleFormatter?: (data: T) => string | number;
335
+ /** Desired number of y-axis ticks. */
336
+ yNumTicks?: number;
337
+ /** Fixed y-axis domain as `[min, max]`. Defaults to the data's low/high range. */
338
+ yDomain?: [number | undefined, number | undefined];
339
+ /** Show vertical grid lines. Default false. */
340
+ xGridLine?: boolean;
341
+ /** Show horizontal grid lines. Default true. */
342
+ yGridLine?: boolean;
343
+ /** Hide the x-axis entirely. */
344
+ hideXAxis?: boolean;
345
+ /** Hide the y-axis entirely. */
346
+ hideYAxis?: boolean;
347
+ /** Hide the tooltip. */
348
+ hideTooltip?: boolean;
349
+ /** Tooltip behaviour config. */
350
+ tooltip?: TooltipConfig;
351
+ }
352
+ export interface DonutChartProps<T = unknown> {
353
+ /** Segment values, in the same order as `categories`. */
354
+ data: number[];
355
+ /** Maps each segment to its legend representation (label, colour). */
356
+ categories: Record<string, BulletLegendItemInterface>;
357
+ /** Full ring or half-circle gauge. */
358
+ type?: DonutType;
359
+ /** Chart height in pixels. */
360
+ height?: number;
361
+ /**
362
+ * Outer radius in pixels. When omitted or `0`, the ring auto-fits the
363
+ * container (recommended). Pass a number to pin an explicit outer radius.
364
+ */
365
+ radius?: number;
366
+ /** Ring thickness in pixels (outer radius minus inner radius). Default 40. */
367
+ arcWidth?: number;
368
+ /** Angular padding between segments, in degrees. */
369
+ padAngle?: number;
370
+ /**
371
+ * Outline colour drawn around each segment. Defaults to `'none'`; pass a
372
+ * colour to separate segments with a border (e.g. the card background).
373
+ */
374
+ stroke?: string;
375
+ /** Hide the legend. */
376
+ hideLegend?: boolean;
377
+ /** Legend position. */
378
+ legendPosition?: LegendPosition;
379
+ /** Inline style for the legend container. */
380
+ legendStyle?: string | Record<string, string>;
381
+ /** Hide the tooltip. */
382
+ hideTooltip?: boolean;
383
+ /** Custom formatter for tooltip titles. */
384
+ tooltipTitleFormatter?: (data: T) => string | number;
385
+ /** Tooltip behaviour config. */
386
+ tooltip?: TooltipConfig;
387
+ /**
388
+ * Per-chart appearance overrides (legend, hover, tooltip). Layers over the
389
+ * global `--vc-*` token defaults; omit to use the shipped theme.
390
+ */
391
+ theme?: ChartTheme;
392
+ /** Animation duration in milliseconds. */
393
+ duration?: number;
394
+ }
395
+ /**
396
+ * Radar chart props. New in v3 (no v2 equivalent) — maps onto the `vccs`
397
+ * `RadarChart` + one `<Radar>` per series.
398
+ *
399
+ * Each row in `data` is one spoke (axis) of the radar; `dataKey` names the row
400
+ * field used as the angle-axis label, and each key in `categories` is a numeric
401
+ * series plotted as one overlaid polygon.
402
+ */
403
+ export interface RadarChartProps<T> {
404
+ /** The data to render. Each element is one spoke / angle-axis entry. */
405
+ data: T[];
406
+ /** Chart height in pixels. */
407
+ height: number;
408
+ /** Row field used for the angle-axis (spoke) labels. */
409
+ dataKey: keyof T;
410
+ /** Maps each numeric series key to its legend representation (label, colour). */
411
+ categories: Record<string, BulletLegendItemInterface>;
412
+ /** Fill opacity of each radar polygon. Default 0.6. */
413
+ fillOpacity?: number;
414
+ /** Formats the angle-axis (spoke) labels. */
415
+ angleFormatter?: (value: unknown, index: number) => string;
416
+ /** Custom formatter for tooltip titles. */
417
+ tooltipTitleFormatter?: (data: T) => string | number;
418
+ /** Hide the legend. */
419
+ hideLegend?: boolean;
420
+ /** Hide the tooltip. */
421
+ hideTooltip?: boolean;
422
+ /** Legend position. */
423
+ legendPosition?: LegendPosition;
424
+ /** Inline style for the legend container. */
425
+ legendStyle?: string | Record<string, string>;
426
+ /** Hide the radius (value) axis. */
427
+ hideRadiusAxis?: boolean;
428
+ /**
429
+ * Angle (in degrees, counter-clockwise from 3 o'clock) along which the radius
430
+ * axis is drawn. Default 90, i.e. straight up from the centre.
431
+ */
432
+ radiusAxisAngle?: number;
433
+ /** Tooltip behaviour config. */
434
+ tooltip?: TooltipConfig;
435
+ /**
436
+ * Per-chart appearance overrides (legend, hover, tooltip). Layers over the
437
+ * global `--vc-*` token defaults; omit to use the shipped theme.
438
+ */
439
+ theme?: ChartTheme;
440
+ /** Animation duration in milliseconds. */
441
+ duration?: number;
442
+ }
443
+ /**
444
+ * Radial bar chart props. New in v3 — maps onto the `vccs` `RadialBarChart` +
445
+ * `<RadialBar>`. Like {@link DonutChartProps} it takes a positional value list
446
+ * aligned with `categories`.
447
+ */
448
+ export interface RadialBarChartProps<T = unknown> {
449
+ /** Segment values, in the same order as `categories`. */
450
+ data: number[];
451
+ /** Maps each segment to its legend representation (label, colour). */
452
+ categories: Record<string, BulletLegendItemInterface>;
453
+ /** Chart height in pixels. */
454
+ height: number;
455
+ /** Inner radius in pixels or percent string. Default `'30%'`. */
456
+ innerRadius?: number | string;
457
+ /** Outer radius in pixels or percent string. Default `'100%'`. */
458
+ outerRadius?: number | string;
459
+ /** Start angle in degrees. Default 90. */
460
+ startAngle?: number;
461
+ /** End angle in degrees. Default -270 (full turn). */
462
+ endAngle?: number;
463
+ /** Corner radius of each bar in pixels. */
464
+ cornerRadius?: number;
465
+ /** Draw the faint background track behind each bar. Default true. */
466
+ background?: boolean;
467
+ /** Hide the legend. */
468
+ hideLegend?: boolean;
469
+ /** Legend position. */
470
+ legendPosition?: LegendPosition;
471
+ /** Inline style for the legend container. */
472
+ legendStyle?: string | Record<string, string>;
473
+ /** Hide the tooltip. */
474
+ hideTooltip?: boolean;
475
+ /** Custom formatter for tooltip titles. */
476
+ tooltipTitleFormatter?: (data: T) => string | number;
477
+ /** Tooltip behaviour config. */
478
+ tooltip?: TooltipConfig;
479
+ /**
480
+ * Per-chart appearance overrides (legend, hover, tooltip). Layers over the
481
+ * global `--vc-*` token defaults; omit to use the shipped theme.
482
+ */
483
+ theme?: ChartTheme;
484
+ /** Animation duration in milliseconds. */
485
+ duration?: number;
486
+ }
487
+ /**
488
+ * Funnel chart props. New in v3 — maps onto the `vccs` `FunnelChart` +
489
+ * `<Funnel>`. Takes a positional value list aligned with `categories`, like
490
+ * {@link DonutChartProps}.
491
+ */
492
+ export interface FunnelChartProps<T = unknown> {
493
+ /** Stage values, in the same order as `categories`. Largest first reads top-down. */
494
+ data: number[];
495
+ /** Maps each stage to its legend representation (label, colour). */
496
+ categories: Record<string, BulletLegendItemInterface>;
497
+ /** Chart height in pixels. */
498
+ height: number;
499
+ /**
500
+ * Visual variant. `'default'` (the classic trapezoid funnel) or `'layered'`
501
+ * (curved, nested layers with on-shape value / percentage / stage labels and a
502
+ * positioned tooltip). Default `'default'`.
503
+ */
504
+ variant?: "default" | "layered";
505
+ /** Shape of the final (smallest) stage. Default `'triangle'`. */
506
+ lastShapeType?: "triangle" | "rectangle";
507
+ /** Show the value label on each stage. Default true. */
508
+ showValueLabel?: boolean;
509
+ /** Hide the legend. */
510
+ hideLegend?: boolean;
511
+ /** Legend position. */
512
+ legendPosition?: LegendPosition;
513
+ /** Inline style for the legend container. */
514
+ legendStyle?: string | Record<string, string>;
515
+ /** Hide the tooltip. */
516
+ hideTooltip?: boolean;
517
+ /** Custom formatter for tooltip titles. */
518
+ tooltipTitleFormatter?: (data: T) => string | number;
519
+ /** Tooltip behaviour config. */
520
+ tooltip?: TooltipConfig;
521
+ /**
522
+ * Per-chart appearance overrides (legend, hover, tooltip). Layers over the
523
+ * global `--vc-*` token defaults; omit to use the shipped theme.
524
+ */
525
+ theme?: ChartTheme;
526
+ /** Animation duration in milliseconds. */
527
+ duration?: number;
528
+ }
529
+ export interface StatusTrackerDatum {
530
+ status: string;
531
+ label?: string;
532
+ value?: number;
533
+ [key: string]: unknown;
534
+ }
535
+ /**
536
+ * Status tracker chart props. New in v3 — renders a compact, responsive
537
+ * timeline of categorical status bars, inspired by uptime/status pages.
538
+ *
539
+ * `data` is expected oldest-to-newest. When the container cannot fit every bar,
540
+ * older records are dropped and the newest records stay visible on the right.
541
+ */
542
+ export interface StatusTrackerChartProps<T extends StatusTrackerDatum = StatusTrackerDatum> {
543
+ /** Status samples ordered oldest-to-newest. */
544
+ data: T[];
545
+ /** Maps each status key to its display label and colour. */
546
+ categories: Record<string, BulletLegendItemInterface>;
547
+ /** Optional chart title shown in the header. */
548
+ title?: string;
549
+ /** Optional summary shown in the header, e.g. `"99.99% uptime"`. */
550
+ summary?: string | number;
551
+ /** Fixed chart height in pixels. Default 28. */
552
+ height?: number;
553
+ /** Width of each status bar in pixels. Default 8. */
554
+ barWidth?: number;
555
+ /** Gap between status bars in pixels. Default 3. */
556
+ barGap?: number;
557
+ /** Explicit number of bars to render. Overrides responsive fitting. */
558
+ visibleBars?: number;
559
+ /** Label shown under the left edge of the tracker. */
560
+ startLabel?: string;
561
+ /** Label shown under the right edge of the tracker. */
562
+ endLabel?: string;
563
+ /** Status key used for generated empty bars. Default `"empty"`. */
564
+ emptyStatus?: string;
565
+ /** Fallback colour for generated empty bars. Default `"var(--chart-empty-color, #e5e7eb)"`. */
566
+ emptyColor?: string;
567
+ /** Resolve a status key from a datum. Default reads `datum.status`. */
568
+ statusAccessor?: (datum: T, index: number) => string;
569
+ /** Resolve a tooltip/ARIA label from a datum. Default uses `datum.label` or the category name. */
570
+ labelAccessor?: (datum: T, index: number) => string;
571
+ /** Resolve a numeric value shown in tooltips, if provided. Default reads `datum.value`. */
572
+ valueAccessor?: (datum: T, index: number) => number | undefined;
573
+ /** Format numeric values for tooltips. */
574
+ valueFormatter?: (value: number, datum: T, index: number) => string;
575
+ /** Hide the header region. */
576
+ hideHeader?: boolean;
577
+ /** Hide the status legend. */
578
+ hideLegend?: boolean;
579
+ /** Hide native browser tooltips. */
580
+ hideTooltip?: boolean;
581
+ /** Round only the first and last visible bars. Default true. */
582
+ rounded?: boolean;
583
+ }
584
+ /** A Sankey node. Extend with your own fields. */
585
+ export interface SankeyInputNode {
586
+ id?: string | number;
587
+ [key: string]: unknown;
588
+ }
589
+ /** A Sankey link between two nodes. */
590
+ export interface SankeyInputLink {
591
+ source: string | number;
592
+ target: string | number;
593
+ value?: number;
594
+ [key: string]: unknown;
595
+ }
596
+ export type SankeyNodeAlign = "justify" | "left" | "right" | "center";
597
+ export interface SankeyChartProps<N extends SankeyInputNode = SankeyInputNode, L extends SankeyInputLink = SankeyInputLink> {
598
+ /** Nodes and links describing the flow. */
599
+ data: {
600
+ nodes: N[];
601
+ links: L[];
602
+ };
603
+ /** Chart height in pixels. */
604
+ height: number;
605
+ /** Optional per-side chart padding. */
606
+ padding?: ChartPadding;
607
+ /** Maps category keys to legend representation. */
608
+ categories?: Record<string, BulletLegendItemInterface>;
609
+ /** Hide the legend. */
610
+ hideLegend?: boolean;
611
+ /** Legend position. */
612
+ legendPosition?: LegendPosition;
613
+ /** Inline style for the legend container. */
614
+ legendStyle?: string | Record<string, string>;
615
+ /** Node label accessor. */
616
+ label?: (node: N) => string;
617
+ /** Node colour accessor. */
618
+ nodeColor?: (node: N) => string;
619
+ /** Link colour accessor. */
620
+ linkColor?: (link: L) => string;
621
+ /** Link value accessor. */
622
+ linkValue?: (link: L) => number;
623
+ /** Node width in pixels. Default 10. */
624
+ nodeWidth?: number;
625
+ /** Node alignment method. Default `justify`. */
626
+ nodeAlign?: SankeyNodeAlign;
627
+ /** Vertical separation between nodes in pixels. Default 10. */
628
+ nodePadding?: number;
629
+ /** Layout iterations. Default 32. */
630
+ iterations?: number;
631
+ /** Hide the tooltip. */
632
+ hideTooltip?: boolean;
633
+ /** Tooltip behaviour config. */
634
+ tooltip?: TooltipConfig;
635
+ /**
636
+ * Per-chart appearance overrides (legend, hover, tooltip). Layers over the
637
+ * global `--vc-*` token defaults; omit to use the shipped theme.
638
+ */
639
+ theme?: ChartTheme;
640
+ /** Animation duration in milliseconds. */
641
+ duration?: number;
642
+ }
File without changes