semiotic 3.0.1 → 3.1.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 (122) hide show
  1. package/CLAUDE.md +227 -27
  2. package/README.md +43 -11
  3. package/ai/examples.md +358 -18
  4. package/ai/schema.json +64 -2
  5. package/ai/system-prompt.md +50 -12
  6. package/dist/components/Legend.d.ts +7 -1
  7. package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
  8. package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
  9. package/dist/components/charts/geo/FlowMap.d.ts +83 -0
  10. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
  11. package/dist/components/charts/geo/index.d.ts +8 -0
  12. package/dist/components/charts/index.d.ts +2 -0
  13. package/dist/components/charts/network/ChordDiagram.d.ts +6 -5
  14. package/dist/components/charts/network/CirclePack.d.ts +2 -2
  15. package/dist/components/charts/network/ForceDirectedGraph.d.ts +9 -7
  16. package/dist/components/charts/network/OrbitDiagram.d.ts +21 -20
  17. package/dist/components/charts/network/SankeyDiagram.d.ts +6 -5
  18. package/dist/components/charts/network/TreeDiagram.d.ts +2 -2
  19. package/dist/components/charts/network/Treemap.d.ts +2 -2
  20. package/dist/components/charts/ordinal/BarChart.d.ts +7 -5
  21. package/dist/components/charts/ordinal/BoxPlot.d.ts +8 -6
  22. package/dist/components/charts/ordinal/DonutChart.d.ts +8 -6
  23. package/dist/components/charts/ordinal/DotPlot.d.ts +8 -6
  24. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +7 -5
  25. package/dist/components/charts/ordinal/Histogram.d.ts +8 -5
  26. package/dist/components/charts/ordinal/PieChart.d.ts +8 -6
  27. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
  28. package/dist/components/charts/ordinal/StackedBarChart.d.ts +7 -5
  29. package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -6
  30. package/dist/components/charts/ordinal/ViolinPlot.d.ts +8 -5
  31. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +24 -6
  32. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +28 -7
  33. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +23 -5
  34. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +24 -6
  35. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +23 -5
  36. package/dist/components/charts/shared/colorUtils.d.ts +5 -0
  37. package/dist/components/charts/shared/hooks.d.ts +13 -1
  38. package/dist/components/charts/shared/legendUtils.d.ts +2 -3
  39. package/dist/components/charts/shared/statisticalOverlays.d.ts +1 -2
  40. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
  41. package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
  42. package/dist/components/charts/shared/types.d.ts +10 -4
  43. package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
  44. package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
  45. package/dist/components/charts/xy/AreaChart.d.ts +11 -6
  46. package/dist/components/charts/xy/BubbleChart.d.ts +11 -6
  47. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -6
  48. package/dist/components/charts/xy/Heatmap.d.ts +16 -5
  49. package/dist/components/charts/xy/LineChart.d.ts +21 -5
  50. package/dist/components/charts/xy/MinimapChart.d.ts +3 -0
  51. package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
  52. package/dist/components/charts/xy/Scatterplot.d.ts +9 -6
  53. package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -6
  54. package/dist/components/geo/mergeData.d.ts +18 -0
  55. package/dist/components/geo/referenceGeography.d.ts +10 -0
  56. package/dist/components/geo/useReferenceAreas.d.ts +13 -0
  57. package/dist/components/realtime/RingBuffer.d.ts +1 -0
  58. package/dist/components/realtime/types.d.ts +17 -0
  59. package/dist/components/semiotic-data.d.ts +1 -0
  60. package/dist/components/semiotic-geo.d.ts +16 -0
  61. package/dist/components/semiotic-server.d.ts +1 -1
  62. package/dist/components/semiotic-xy.d.ts +1 -0
  63. package/dist/components/semiotic.d.ts +4 -4
  64. package/dist/components/server/renderToStaticSVG.d.ts +4 -2
  65. package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
  66. package/dist/components/stream/CanvasHitTester.d.ts +8 -2
  67. package/dist/components/stream/DataSourceAdapter.d.ts +33 -4
  68. package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
  69. package/dist/components/stream/GeoParticlePool.d.ts +46 -0
  70. package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
  71. package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
  72. package/dist/components/stream/NetworkPipelineStore.d.ts +16 -4
  73. package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
  74. package/dist/components/stream/OrdinalPipelineStore.d.ts +8 -4
  75. package/dist/components/stream/OrdinalSVGOverlay.d.ts +23 -1
  76. package/dist/components/stream/PipelineStore.d.ts +57 -5
  77. package/dist/components/stream/SVGOverlay.d.ts +28 -1
  78. package/dist/components/stream/SceneGraph.d.ts +7 -3
  79. package/dist/components/stream/SceneToSVG.d.ts +2 -0
  80. package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
  81. package/dist/components/stream/accessorUtils.d.ts +1 -0
  82. package/dist/components/stream/canvasSetup.d.ts +26 -0
  83. package/dist/components/stream/geoTypes.d.ts +186 -0
  84. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +0 -7
  85. package/dist/components/stream/layouts/index.d.ts +2 -1
  86. package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
  87. package/dist/components/stream/legendRenderer.d.ts +33 -0
  88. package/dist/components/stream/networkTypes.d.ts +49 -1
  89. package/dist/components/stream/ordinalTypes.d.ts +10 -0
  90. package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
  91. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
  92. package/dist/components/stream/renderers/heatmapCanvasRenderer.d.ts +2 -1
  93. package/dist/components/stream/renderers/lineCanvasRenderer.d.ts +1 -0
  94. package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
  95. package/dist/components/stream/types.d.ts +77 -3
  96. package/dist/components/types/legendTypes.d.ts +27 -3
  97. package/dist/geo.min.js +1 -0
  98. package/dist/geo.module.min.js +1 -0
  99. package/dist/network.min.js +1 -1
  100. package/dist/network.module.min.js +1 -1
  101. package/dist/ordinal.min.js +1 -1
  102. package/dist/ordinal.module.min.js +1 -1
  103. package/dist/realtime.min.js +1 -1
  104. package/dist/realtime.module.min.js +1 -1
  105. package/dist/semiotic-ai.min.js +1 -1
  106. package/dist/semiotic-ai.module.min.js +1 -1
  107. package/dist/semiotic-data.d.ts +1 -0
  108. package/dist/semiotic-data.min.js +1 -1
  109. package/dist/semiotic-data.module.min.js +1 -1
  110. package/dist/semiotic-geo.d.ts +16 -0
  111. package/dist/semiotic-server.d.ts +1 -1
  112. package/dist/semiotic-xy.d.ts +1 -0
  113. package/dist/semiotic.d.ts +4 -4
  114. package/dist/semiotic.min.js +1 -1
  115. package/dist/semiotic.module.min.js +1 -1
  116. package/dist/server.min.js +1 -1
  117. package/dist/server.module.min.js +1 -1
  118. package/dist/test-utils/canvasMock.d.ts +3 -0
  119. package/dist/xy.min.js +1 -1
  120. package/dist/xy.module.min.js +1 -1
  121. package/package.json +29 -7
  122. package/dist/test/canvasMock.d.ts +0 -2
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared transition utilities for PipelineStores.
3
+ *
4
+ * Extracts common easing logic and types used by PipelineStore,
5
+ * OrdinalPipelineStore, NetworkPipelineStore, and GeoPipelineStore.
6
+ */
7
+ /** Active transition state tracked by each PipelineStore */
8
+ export interface ActiveTransition {
9
+ startTime: number;
10
+ duration: number;
11
+ }
12
+ /** Easing mode — determines interpolation curve */
13
+ export type EasingMode = "linear" | "ease-out-cubic";
14
+ /**
15
+ * Compute the eased interpolation parameter from raw progress.
16
+ *
17
+ * @param rawT - Raw linear progress in [0, 1]
18
+ * @param easing - Easing mode. "linear" returns rawT unchanged;
19
+ * "ease-out-cubic" (default) applies 1 - (1 - t)^3.
20
+ * @returns Eased progress in [0, 1]
21
+ */
22
+ export declare function computeEasing(rawT: number, easing?: EasingMode): number;
23
+ /**
24
+ * Compute the raw linear progress of a transition.
25
+ *
26
+ * @param now - Current timestamp (e.g. performance.now())
27
+ * @param transition - The active transition state
28
+ * @returns Raw progress clamped to [0, 1]
29
+ */
30
+ export declare function computeRawProgress(now: number, transition: ActiveTransition): number;
31
+ /**
32
+ * Linearly interpolate between two values.
33
+ *
34
+ * @param from - Start value
35
+ * @param to - End value
36
+ * @param t - Eased progress in [0, 1]
37
+ */
38
+ export declare function lerp(from: number, to: number, t: number): number;
39
+ /**
40
+ * Get the current timestamp in a way that works both in browser and Node.
41
+ */
42
+ export declare function now(): number;
@@ -0,0 +1,9 @@
1
+ import type { GeoSceneNode } from "../geoTypes";
2
+ /**
3
+ * Canvas renderer for GeoAreaSceneNode — projected geographic polygons.
4
+ * Uses Path2D for GPU-accelerated rendering of complex geo paths.
5
+ *
6
+ * Points and lines in a geo frame are rendered by the existing
7
+ * pointCanvasRenderer and lineCanvasRenderer respectively.
8
+ */
9
+ export declare function geoCanvasRenderer(ctx: CanvasRenderingContext2D, nodes: GeoSceneNode[], _scales: any, _layout: any): void;
@@ -1,6 +1,7 @@
1
1
  import type { StreamRendererFn } from "./types";
2
2
  /**
3
3
  * Canvas heatmap renderer.
4
- * Renders HeatcellSceneNode as filled rectangles with color encoding.
4
+ * Renders HeatcellSceneNode as filled rectangles with color encoding,
5
+ * and optionally draws cell value text when showValues is enabled.
5
6
  */
6
7
  export declare const heatmapCanvasRenderer: StreamRendererFn;
@@ -4,5 +4,6 @@ import type { StreamRendererFn } from "./types";
4
4
  * Renders LineSceneNode paths using moveTo/lineTo.
5
5
  * Supports threshold-based segment coloring when colorThresholds + rawValues
6
6
  * are present on the node.
7
+ * Supports d3-shape curve interpolation when node.curve is set.
7
8
  */
8
9
  export declare const lineCanvasRenderer: StreamRendererFn;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Shared pulse overlay rendering utilities.
3
+ *
4
+ * Pulse is a brief visual flash (glow/overlay) applied to scene nodes when
5
+ * their aggregated value changes. Each node carries `_pulseIntensity` (0–1),
6
+ * `_pulseColor`, and optionally `_pulseGlowRadius`.
7
+ *
8
+ * Three visual variants:
9
+ * - **Rect overlay**: semi-transparent fillRect on top of the bar/cell
10
+ * - **Circle glow ring**: expanding stroke ring around a point
11
+ * - **Path fill overlay**: re-traces an arbitrary path and fills with glow
12
+ */
13
+ interface PulseFields {
14
+ _pulseIntensity?: number;
15
+ _pulseColor?: string;
16
+ _pulseGlowRadius?: number;
17
+ }
18
+ /**
19
+ * Returns true if the node has an active pulse effect.
20
+ */
21
+ export declare function hasPulse(node: PulseFields): boolean;
22
+ /**
23
+ * Render a rectangular pulse overlay (used by bar, heatmap, and network rect renderers).
24
+ * Call this after drawing the main fill/stroke for the rectangle.
25
+ */
26
+ export declare function renderRectPulse(ctx: CanvasRenderingContext2D, node: PulseFields & {
27
+ x: number;
28
+ y: number;
29
+ w: number;
30
+ h: number;
31
+ }, alphaMultiplier?: number): void;
32
+ /**
33
+ * Render a circular glow ring pulse (used by point and network circle renderers).
34
+ * Call this after drawing the main circle fill/stroke.
35
+ */
36
+ export declare function renderCirclePulse(ctx: CanvasRenderingContext2D, node: PulseFields & {
37
+ x?: number;
38
+ y?: number;
39
+ cx?: number;
40
+ cy?: number;
41
+ r: number;
42
+ }, alphaMultiplier?: number): void;
43
+ /**
44
+ * Render a path-based fill pulse (used by area, wedge, and geo renderers).
45
+ * The caller must trace the path onto ctx BEFORE calling this function,
46
+ * or pass a Path2D object as the third argument (for geo renderers).
47
+ * This function sets alpha/fillStyle and calls ctx.fill().
48
+ */
49
+ export declare function renderPathPulse(ctx: CanvasRenderingContext2D, node: PulseFields, path?: Path2D, alphaMultiplier?: number): void;
50
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ScaleLinear } from "d3-scale";
3
- import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext } from "../realtime/types";
3
+ import type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode } from "../realtime/types";
4
4
  export interface DecayConfig {
5
5
  type: "linear" | "exponential" | "step";
6
6
  /** Exponential: half-life in buffer positions (default: bufferSize/2) */
@@ -60,6 +60,7 @@ export interface Style {
60
60
  stroke?: string;
61
61
  strokeWidth?: number;
62
62
  strokeDasharray?: string;
63
+ strokeLinecap?: "butt" | "round" | "square";
63
64
  fill?: string;
64
65
  fillOpacity?: number;
65
66
  opacity?: number;
@@ -84,6 +85,18 @@ export interface LineSceneNode {
84
85
  style: Style;
85
86
  datum: any;
86
87
  group?: string;
88
+ /** Curve interpolation type (default: linear / straight segments) */
89
+ curve?: CurveType;
90
+ /** Per-vertex decay opacities (oldest→newest = minOpacity→1.0). Set by PipelineStore.applyDecay. */
91
+ _decayOpacities?: number[];
92
+ /** Animation target opacity (set during enter/exit transitions) */
93
+ _targetOpacity?: number;
94
+ /** Stable identity key for transition tracking */
95
+ _transitionKey?: string;
96
+ /** Previous path coordinates for interpolation during transitions */
97
+ _prevPath?: [number, number][];
98
+ /** Target path coordinates for interpolation during transitions */
99
+ _targetPath?: [number, number][];
87
100
  }
88
101
  export interface AreaSceneNode {
89
102
  type: "area";
@@ -103,6 +116,22 @@ export interface AreaSceneNode {
103
116
  _pulseIntensity?: number;
104
117
  /** Pulse color */
105
118
  _pulseColor?: string;
119
+ /** Curve interpolation type (default: linear / straight segments) */
120
+ curve?: CurveType;
121
+ /** Per-vertex decay opacities (oldest→newest = minOpacity→1.0). Set by PipelineStore.applyDecay. */
122
+ _decayOpacities?: number[];
123
+ /** Animation target opacity (set during enter/exit transitions) */
124
+ _targetOpacity?: number;
125
+ /** Stable identity key for transition tracking */
126
+ _transitionKey?: string;
127
+ /** Previous top path coordinates for interpolation during transitions */
128
+ _prevTopPath?: [number, number][];
129
+ /** Target top path coordinates for interpolation during transitions */
130
+ _targetTopPath?: [number, number][];
131
+ /** Previous bottom path coordinates for interpolation during transitions */
132
+ _prevBottomPath?: [number, number][];
133
+ /** Target bottom path coordinates for interpolation during transitions */
134
+ _targetBottomPath?: [number, number][];
106
135
  }
107
136
  export interface PointSceneNode {
108
137
  type: "point";
@@ -123,7 +152,10 @@ export interface PointSceneNode {
123
152
  _targetX?: number;
124
153
  _targetY?: number;
125
154
  _targetR?: number;
155
+ _targetOpacity?: number;
126
156
  _decayOpacity?: number;
157
+ /** Stable identity key for transition tracking */
158
+ _transitionKey?: string;
127
159
  }
128
160
  export interface RectSceneNode {
129
161
  type: "rect";
@@ -136,12 +168,16 @@ export interface RectSceneNode {
136
168
  group?: string;
137
169
  _pulseIntensity?: number;
138
170
  _pulseColor?: string;
171
+ _pulseGlowRadius?: number;
139
172
  /** Animation target fields (set during transitions) */
140
173
  _targetX?: number;
141
174
  _targetY?: number;
142
175
  _targetW?: number;
143
176
  _targetH?: number;
177
+ _targetOpacity?: number;
144
178
  _decayOpacity?: number;
179
+ /** Stable identity key for transition tracking */
180
+ _transitionKey?: string;
145
181
  }
146
182
  export interface HeatcellSceneNode {
147
183
  type: "heatcell";
@@ -151,14 +187,26 @@ export interface HeatcellSceneNode {
151
187
  h: number;
152
188
  fill: string;
153
189
  datum: any;
190
+ /** Optional style object (used for decay/transition opacity on heatmap cells) */
191
+ style?: Style;
192
+ /** Numeric cell value (for canvas text rendering when showValues is enabled) */
193
+ value?: number;
194
+ /** Whether to render the value as text inside the cell */
195
+ showValues?: boolean;
196
+ /** Format function for the displayed value */
197
+ valueFormat?: (v: number) => string;
154
198
  _pulseIntensity?: number;
155
199
  _pulseColor?: string;
200
+ _pulseGlowRadius?: number;
156
201
  /** Animation target fields (set during transitions) */
157
202
  _targetX?: number;
158
203
  _targetY?: number;
159
204
  _targetW?: number;
160
205
  _targetH?: number;
206
+ _targetOpacity?: number;
161
207
  _decayOpacity?: number;
208
+ /** Stable identity key for transition tracking */
209
+ _transitionKey?: string;
162
210
  }
163
211
  export interface CandlestickSceneNode {
164
212
  type: "candlestick";
@@ -174,8 +222,17 @@ export interface CandlestickSceneNode {
174
222
  wickWidth: number;
175
223
  isUp: boolean;
176
224
  datum: any;
225
+ /** Optional style object (used during transition opacity animations) */
226
+ style?: Style;
177
227
  _pulseIntensity?: number;
178
228
  _pulseColor?: string;
229
+ _pulseGlowRadius?: number;
230
+ /** Animation target opacity (set during enter/exit transitions) */
231
+ _targetOpacity?: number;
232
+ /** Decay opacity for candlestick nodes (no style object, stored separately) */
233
+ _decayOpacity?: number;
234
+ /** Stable identity key for transition tracking */
235
+ _transitionKey?: string;
179
236
  }
180
237
  export interface CandlestickStyle {
181
238
  upColor?: string;
@@ -198,11 +255,15 @@ export interface StreamLayout {
198
255
  width: number;
199
256
  height: number;
200
257
  }
201
- export type CurveType = "linear" | "monotoneX" | "monotoneY" | "step" | "stepAfter" | "stepBefore" | "basis" | "cardinal" | "catmullRom";
258
+ export type CurveType = "linear" | "monotoneX" | "monotoneY" | "step" | "stepAfter" | "stepBefore" | "basis" | "cardinal" | "catmullRom" | "natural";
202
259
  export interface StreamXYFrameProps<T = Record<string, any>> {
203
260
  chartType: StreamChartType;
204
261
  runtimeMode?: RuntimeMode;
205
262
  data?: T[];
263
+ /** Datasets larger than this are chunked for progressive rendering (default 5000) */
264
+ chunkThreshold?: number;
265
+ /** Number of items per progressive chunk (default 5000) */
266
+ chunkSize?: number;
206
267
  xAccessor?: string | ((d: T) => number);
207
268
  yAccessor?: string | ((d: T) => number);
208
269
  colorAccessor?: string | ((d: T) => string);
@@ -247,6 +308,8 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
247
308
  windowMode?: WindowMode;
248
309
  windowSize?: number;
249
310
  timeAccessor?: string | ((d: T) => number);
311
+ xScaleType?: "linear" | "log";
312
+ yScaleType?: "linear" | "log";
250
313
  xExtent?: [number | undefined, number | undefined] | [number];
251
314
  yExtent?: [number | undefined, number | undefined] | [number];
252
315
  extentPadding?: number;
@@ -310,6 +373,8 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
310
373
  showGrid?: boolean;
311
374
  legend?: ReactNode | {
312
375
  legendGroups: any[];
376
+ } | {
377
+ gradient: import("../types/legendTypes").GradientLegendConfig;
313
378
  };
314
379
  legendHoverBehavior?: (item: {
315
380
  label: string;
@@ -319,10 +384,13 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
319
384
  }) => void;
320
385
  legendHighlightedCategory?: string | null;
321
386
  legendIsolatedCategories?: Set<string>;
387
+ legendPosition?: "right" | "left" | "top" | "bottom";
322
388
  /** SVG elements rendered behind the canvas (in pixel space) */
323
389
  backgroundGraphics?: ReactNode;
324
390
  /** SVG elements rendered on top of everything (in SVG overlay) */
325
391
  foregroundGraphics?: ReactNode;
392
+ /** Canvas renderers executed before the chart-type renderers (e.g. connecting lines under points) */
393
+ canvasPreRenderers?: CanvasRendererFn[];
326
394
  title?: string | ReactNode;
327
395
  categoryAccessor?: string | ((d: T) => string);
328
396
  /** Configurable opacity decay for older data points */
@@ -341,6 +409,12 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
341
409
  heatmapXBins?: number;
342
410
  /** Number of y-axis bins for streaming heatmap (default: 20) */
343
411
  heatmapYBins?: number;
412
+ /** Show numeric values inside heatmap cells (rendered natively on canvas) */
413
+ showValues?: boolean;
414
+ /** Format function for heatmap cell value labels */
415
+ heatmapValueFormat?: (v: number) => string;
416
+ /** Render a visually-hidden data table from the scene graph for screen readers (first 50 rows) */
417
+ accessibleTable?: boolean;
344
418
  }
345
419
  export interface StreamXYFrameHandle<T = Record<string, any>> {
346
420
  push(datum: T): void;
@@ -354,4 +428,4 @@ export interface StreamXYFrameHandle<T = Record<string, any>> {
354
428
  } | null;
355
429
  }
356
430
  export type CanvasRendererFn = (ctx: CanvasRenderingContext2D, nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => void;
357
- export type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext };
431
+ export type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode };
@@ -1,22 +1,46 @@
1
+ import type { CSSProperties, ReactElement } from "react";
1
2
  export type SupportedLegendGlyphs = "fill" | "line";
2
- export type ItemType = SupportedLegendGlyphs | Function;
3
+ export type ItemType = SupportedLegendGlyphs | ((item: LegendItem) => ReactElement);
3
4
  export interface LegendItem {
4
5
  label: string;
6
+ color?: string;
7
+ [key: string]: unknown;
5
8
  }
6
9
  export interface LegendGroup {
7
10
  type?: ItemType;
8
- styleFn: Function;
11
+ styleFn: (item: LegendItem, index: number) => CSSProperties;
9
12
  items: LegendItem[];
10
13
  label: string;
11
14
  }
15
+ /** Configuration for a gradient (continuous) legend */
16
+ export interface GradientLegendConfig {
17
+ /** Color function: receives a value in `domain` range and returns a color string */
18
+ colorFn: (value: number) => string;
19
+ /** Data domain [min, max] */
20
+ domain: [number, number];
21
+ /** Optional label for the gradient */
22
+ label?: string;
23
+ /** Optional format function for tick labels */
24
+ format?: (v: number) => string;
25
+ }
26
+ /** Type guard: categorical legend config */
27
+ export declare function isLegendConfig(value: unknown): value is {
28
+ legendGroups: LegendGroup[];
29
+ };
30
+ /** Type guard: gradient legend config */
31
+ export declare function isGradientLegendConfig(value: unknown): value is {
32
+ gradient: GradientLegendConfig;
33
+ };
12
34
  export interface LegendProps {
13
35
  legendGroups?: LegendGroup[];
14
- customClickBehavior?: Function;
36
+ customClickBehavior?: (item: LegendItem) => void;
15
37
  customHoverBehavior?: (item: LegendItem | null) => void;
16
38
  /** Set of currently isolated category labels (shown with checkmarks) */
17
39
  isolatedCategories?: Set<string>;
18
40
  /** Whether hover-highlighting is active (dims non-hovered items) */
19
41
  highlightedCategory?: string | null;
42
+ /** Legend interaction mode — used to set aria-multiselectable on the listbox */
43
+ legendInteraction?: string;
20
44
  title?: string;
21
45
  width?: number;
22
46
  height?: number;