semiotic 3.0.0 → 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 (219) hide show
  1. package/CLAUDE.md +242 -29
  2. package/README.md +101 -66
  3. package/ai/cli.js +34 -21
  4. package/ai/dist/componentRegistry.js +2 -0
  5. package/ai/dist/mcp-server.js +54 -0
  6. package/ai/examples.md +433 -18
  7. package/ai/schema.json +134 -1
  8. package/ai/system-prompt.md +51 -10
  9. package/dist/{ChartGrid.d.ts → components/ChartGrid.d.ts} +9 -7
  10. package/dist/components/Legend.d.ts +9 -0
  11. package/dist/{LinkedCharts.d.ts → components/LinkedCharts.d.ts} +34 -1
  12. package/dist/{Tooltip → components/Tooltip}/Tooltip.d.ts +9 -2
  13. package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
  14. package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
  15. package/dist/components/charts/geo/FlowMap.d.ts +83 -0
  16. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
  17. package/dist/components/charts/geo/index.d.ts +8 -0
  18. package/dist/{charts → components/charts}/index.d.ts +4 -0
  19. package/dist/{charts → components/charts}/network/ChordDiagram.d.ts +8 -5
  20. package/dist/{charts → components/charts}/network/CirclePack.d.ts +4 -2
  21. package/dist/{charts → components/charts}/network/ForceDirectedGraph.d.ts +10 -6
  22. package/dist/components/charts/network/OrbitDiagram.d.ts +79 -0
  23. package/dist/{charts → components/charts}/network/SankeyDiagram.d.ts +8 -5
  24. package/dist/{charts → components/charts}/network/TreeDiagram.d.ts +4 -2
  25. package/dist/{charts → components/charts}/network/Treemap.d.ts +4 -2
  26. package/dist/{charts → components/charts}/ordinal/BarChart.d.ts +9 -5
  27. package/dist/{charts → components/charts}/ordinal/BoxPlot.d.ts +9 -5
  28. package/dist/{charts → components/charts}/ordinal/DonutChart.d.ts +9 -5
  29. package/dist/{charts → components/charts}/ordinal/DotPlot.d.ts +9 -5
  30. package/dist/{charts → components/charts}/ordinal/GroupedBarChart.d.ts +9 -5
  31. package/dist/{charts → components/charts}/ordinal/Histogram.d.ts +8 -5
  32. package/dist/{charts → components/charts}/ordinal/PieChart.d.ts +9 -5
  33. package/dist/{charts → components/charts}/ordinal/RidgelinePlot.d.ts +2 -0
  34. package/dist/{charts → components/charts}/ordinal/StackedBarChart.d.ts +9 -5
  35. package/dist/{charts → components/charts}/ordinal/SwarmPlot.d.ts +9 -5
  36. package/dist/{charts → components/charts}/ordinal/ViolinPlot.d.ts +8 -5
  37. package/dist/{charts → components/charts}/realtime/RealtimeHeatmap.d.ts +24 -6
  38. package/dist/{charts → components/charts}/realtime/RealtimeHistogram.d.ts +28 -7
  39. package/dist/{charts → components/charts}/realtime/RealtimeLineChart.d.ts +23 -5
  40. package/dist/{charts → components/charts}/realtime/RealtimeSwarmChart.d.ts +24 -6
  41. package/dist/{charts → components/charts}/realtime/RealtimeWaterfallChart.d.ts +23 -5
  42. package/dist/{charts → components/charts}/shared/colorUtils.d.ts +5 -0
  43. package/dist/components/charts/shared/diagnoseConfig.d.ts +23 -0
  44. package/dist/{charts → components/charts}/shared/hooks.d.ts +36 -2
  45. package/dist/{charts → components/charts}/shared/legendUtils.d.ts +2 -3
  46. package/dist/{charts → components/charts}/shared/statisticalOverlays.d.ts +1 -2
  47. package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
  48. package/dist/components/charts/shared/stringDistance.d.ts +11 -0
  49. package/dist/{charts → components/charts}/shared/tooltipUtils.d.ts +2 -2
  50. package/dist/{charts → components/charts}/shared/types.d.ts +16 -4
  51. package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
  52. package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
  53. package/dist/{charts → components/charts}/shared/withChartWrapper.d.ts +10 -0
  54. package/dist/{charts → components/charts}/xy/AreaChart.d.ts +18 -5
  55. package/dist/{charts → components/charts}/xy/BubbleChart.d.ts +18 -5
  56. package/dist/{charts → components/charts}/xy/ConnectedScatterplot.d.ts +10 -6
  57. package/dist/{charts → components/charts}/xy/Heatmap.d.ts +24 -5
  58. package/dist/{charts → components/charts}/xy/LineChart.d.ts +47 -5
  59. package/dist/{charts → components/charts}/xy/MinimapChart.d.ts +3 -0
  60. package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
  61. package/dist/{charts → components/charts}/xy/Scatterplot.d.ts +11 -5
  62. package/dist/{charts → components/charts}/xy/StackedAreaChart.d.ts +18 -5
  63. package/dist/{export → components/export}/exportChart.d.ts +6 -1
  64. package/dist/components/geo/mergeData.d.ts +18 -0
  65. package/dist/components/geo/referenceGeography.d.ts +10 -0
  66. package/dist/components/geo/useReferenceAreas.d.ts +13 -0
  67. package/dist/{realtime → components/realtime}/RingBuffer.d.ts +1 -0
  68. package/dist/{realtime → components/realtime}/types.d.ts +17 -0
  69. package/dist/components/semiotic-ai.d.ts +61 -0
  70. package/dist/components/semiotic-data.d.ts +8 -0
  71. package/dist/components/semiotic-geo.d.ts +16 -0
  72. package/dist/components/semiotic-network.d.ts +14 -0
  73. package/dist/components/semiotic-ordinal.d.ts +18 -0
  74. package/dist/components/semiotic-realtime.d.ts +22 -0
  75. package/dist/components/semiotic-server.d.ts +1 -0
  76. package/dist/components/semiotic-xy.d.ts +17 -0
  77. package/dist/components/semiotic.d.ts +57 -0
  78. package/dist/{server → components/server}/renderToStaticSVG.d.ts +11 -2
  79. package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
  80. package/dist/{stream → components/stream}/CanvasHitTester.d.ts +8 -2
  81. package/dist/components/stream/DataSourceAdapter.d.ts +64 -0
  82. package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
  83. package/dist/components/stream/GeoParticlePool.d.ts +46 -0
  84. package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
  85. package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
  86. package/dist/{stream → components/stream}/NetworkPipelineStore.d.ts +16 -4
  87. package/dist/{stream → components/stream}/NetworkSVGOverlay.d.ts +24 -1
  88. package/dist/{stream → components/stream}/OrdinalPipelineStore.d.ts +8 -4
  89. package/dist/{stream → components/stream}/OrdinalSVGOverlay.d.ts +31 -1
  90. package/dist/{stream → components/stream}/PipelineStore.d.ts +64 -5
  91. package/dist/components/stream/SVGOverlay.d.ts +98 -0
  92. package/dist/{stream → components/stream}/SceneGraph.d.ts +7 -3
  93. package/dist/components/stream/SceneToSVG.d.ts +22 -0
  94. package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
  95. package/dist/{stream → components/stream}/accessorUtils.d.ts +1 -0
  96. package/dist/components/stream/canvasSetup.d.ts +26 -0
  97. package/dist/components/stream/geoTypes.d.ts +186 -0
  98. package/dist/components/stream/hitTestUtils.d.ts +23 -0
  99. package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -0
  100. package/dist/{stream → components/stream}/layouts/index.d.ts +2 -1
  101. package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
  102. package/dist/components/stream/legendRenderer.d.ts +33 -0
  103. package/dist/{stream → components/stream}/networkTypes.d.ts +59 -3
  104. package/dist/{stream → components/stream}/ordinalTypes.d.ts +26 -10
  105. package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
  106. package/dist/components/stream/renderers/areaCanvasRenderer.d.ts +2 -0
  107. package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
  108. package/dist/{stream → components/stream}/renderers/heatmapCanvasRenderer.d.ts +2 -1
  109. package/dist/{stream → components/stream}/renderers/lineCanvasRenderer.d.ts +1 -0
  110. package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
  111. package/dist/{stream → components/stream}/types.d.ts +89 -3
  112. package/dist/components/stream/useStalenessCheck.d.ts +16 -0
  113. package/dist/components/types/legendTypes.d.ts +49 -0
  114. package/dist/geo.min.js +1 -0
  115. package/dist/geo.module.min.js +1 -0
  116. package/dist/network.min.js +1 -1
  117. package/dist/network.module.min.js +1 -1
  118. package/dist/ordinal.min.js +1 -1
  119. package/dist/ordinal.module.min.js +1 -1
  120. package/dist/realtime.min.js +1 -1
  121. package/dist/realtime.module.min.js +1 -1
  122. package/dist/semiotic-ai.d.ts +3 -0
  123. package/dist/semiotic-ai.min.js +1 -1
  124. package/dist/semiotic-ai.module.min.js +1 -1
  125. package/dist/semiotic-data.d.ts +1 -0
  126. package/dist/semiotic-data.min.js +1 -1
  127. package/dist/semiotic-data.module.min.js +1 -1
  128. package/dist/semiotic-geo.d.ts +16 -0
  129. package/dist/semiotic-network.d.ts +1 -0
  130. package/dist/semiotic-ordinal.d.ts +1 -0
  131. package/dist/semiotic-server.d.ts +1 -1
  132. package/dist/semiotic-xy.d.ts +1 -0
  133. package/dist/semiotic.d.ts +4 -4
  134. package/dist/semiotic.min.js +1 -1
  135. package/dist/semiotic.module.min.js +1 -1
  136. package/dist/server.min.js +1 -1
  137. package/dist/server.module.min.js +1 -1
  138. package/dist/test-utils/canvasMock.d.ts +23 -0
  139. package/dist/test-utils/frameMock.d.ts +78 -0
  140. package/dist/xy.min.js +1 -1
  141. package/dist/xy.module.min.js +1 -1
  142. package/package.json +34 -20
  143. package/dist/Legend.d.ts +0 -3
  144. package/dist/stream/DataSourceAdapter.d.ts +0 -35
  145. package/dist/stream/SVGOverlay.d.ts +0 -56
  146. package/dist/stream/layouts/forceLayoutPlugin.d.ts +0 -9
  147. package/dist/stream/renderers/areaCanvasRenderer.d.ts +0 -7
  148. package/dist/types/legendTypes.d.ts +0 -20
  149. /package/dist/{Annotation.d.ts → components/Annotation.d.ts} +0 -0
  150. /package/dist/{CategoryColors.d.ts → components/CategoryColors.d.ts} +0 -0
  151. /package/dist/{ChartContainer.d.ts → components/ChartContainer.d.ts} +0 -0
  152. /package/dist/{ChartErrorBoundary.d.ts → components/ChartErrorBoundary.d.ts} +0 -0
  153. /package/dist/{ContextLayout.d.ts → components/ContextLayout.d.ts} +0 -0
  154. /package/dist/{DetailsPanel.d.ts → components/DetailsPanel.d.ts} +0 -0
  155. /package/dist/{ThemeProvider.d.ts → components/ThemeProvider.d.ts} +0 -0
  156. /package/dist/{charts → components/charts}/shared/ChartError.d.ts +0 -0
  157. /package/dist/{charts → components/charts}/shared/annotationRules.d.ts +0 -0
  158. /package/dist/{charts → components/charts}/shared/formatUtils.d.ts +0 -0
  159. /package/dist/{charts → components/charts}/shared/loess.d.ts +0 -0
  160. /package/dist/{charts → components/charts}/shared/networkUtils.d.ts +0 -0
  161. /package/dist/{charts → components/charts}/shared/selectionUtils.d.ts +0 -0
  162. /package/dist/{charts → components/charts}/shared/validateChartData.d.ts +0 -0
  163. /package/dist/{charts → components/charts}/shared/validateProps.d.ts +0 -0
  164. /package/dist/{charts → components/charts}/xy/ScatterplotMatrix.d.ts +0 -0
  165. /package/dist/{data → components/data}/fromVegaLite.d.ts +0 -0
  166. /package/dist/{data → components/data}/transforms.d.ts +0 -0
  167. /package/dist/{export → components/export}/chartConfig.d.ts +0 -0
  168. /package/dist/{export → components/export}/selectionSerializer.d.ts +0 -0
  169. /package/dist/{geometry → components/geometry}/sankeyLinks.d.ts +0 -0
  170. /package/dist/{realtime → components/realtime}/BinAccumulator.d.ts +0 -0
  171. /package/dist/{realtime → components/realtime}/IncrementalExtent.d.ts +0 -0
  172. /package/dist/{realtime → components/realtime}/renderers/types.d.ts +0 -0
  173. /package/dist/{realtime → components/realtime}/renderers/waterfallRenderer.d.ts +0 -0
  174. /package/dist/{store → components/store}/ObservationStore.d.ts +0 -0
  175. /package/dist/{store → components/store}/SelectionStore.d.ts +0 -0
  176. /package/dist/{store → components/store}/ThemeStore.d.ts +0 -0
  177. /package/dist/{store → components/store}/TooltipStore.d.ts +0 -0
  178. /package/dist/{store → components/store}/createStore.d.ts +0 -0
  179. /package/dist/{store → components/store}/useObservation.d.ts +0 -0
  180. /package/dist/{store → components/store}/useSelection.d.ts +0 -0
  181. /package/dist/{stream → components/stream}/MarginalGraphics.d.ts +0 -0
  182. /package/dist/{stream → components/stream}/NetworkCanvasHitTester.d.ts +0 -0
  183. /package/dist/{stream → components/stream}/OrdinalCanvasHitTester.d.ts +0 -0
  184. /package/dist/{stream → components/stream}/ParticlePool.d.ts +0 -0
  185. /package/dist/{stream → components/stream}/StreamNetworkFrame.d.ts +0 -0
  186. /package/dist/{stream → components/stream}/StreamOrdinalFrame.d.ts +0 -0
  187. /package/dist/{stream → components/stream}/StreamXYFrame.d.ts +0 -0
  188. /package/dist/{stream → components/stream}/keyboardNav.d.ts +0 -0
  189. /package/dist/{stream → components/stream}/layouts/chordLayoutPlugin.d.ts +0 -0
  190. /package/dist/{stream → components/stream}/layouts/hierarchyLayoutPlugin.d.ts +0 -0
  191. /package/dist/{stream → components/stream}/layouts/sankeyLayoutPlugin.d.ts +0 -0
  192. /package/dist/{stream → components/stream}/ordinalSceneBuilders/barScene.d.ts +0 -0
  193. /package/dist/{stream → components/stream}/ordinalSceneBuilders/connectorScene.d.ts +0 -0
  194. /package/dist/{stream → components/stream}/ordinalSceneBuilders/pieScene.d.ts +0 -0
  195. /package/dist/{stream → components/stream}/ordinalSceneBuilders/pointScene.d.ts +0 -0
  196. /package/dist/{stream → components/stream}/ordinalSceneBuilders/statisticalScene.d.ts +0 -0
  197. /package/dist/{stream → components/stream}/ordinalSceneBuilders/timelineScene.d.ts +0 -0
  198. /package/dist/{stream → components/stream}/ordinalSceneBuilders/types.d.ts +0 -0
  199. /package/dist/{stream → components/stream}/renderers/barCanvasRenderer.d.ts +0 -0
  200. /package/dist/{stream → components/stream}/renderers/boxplotCanvasRenderer.d.ts +0 -0
  201. /package/dist/{stream → components/stream}/renderers/candlestickCanvasRenderer.d.ts +0 -0
  202. /package/dist/{stream → components/stream}/renderers/connectorCanvasRenderer.d.ts +0 -0
  203. /package/dist/{stream → components/stream}/renderers/networkArcRenderer.d.ts +0 -0
  204. /package/dist/{stream → components/stream}/renderers/networkCircleRenderer.d.ts +0 -0
  205. /package/dist/{stream → components/stream}/renderers/networkEdgeRenderer.d.ts +0 -0
  206. /package/dist/{stream → components/stream}/renderers/networkParticleRenderer.d.ts +0 -0
  207. /package/dist/{stream → components/stream}/renderers/networkRectRenderer.d.ts +0 -0
  208. /package/dist/{stream → components/stream}/renderers/pointCanvasRenderer.d.ts +0 -0
  209. /package/dist/{stream → components/stream}/renderers/swarmCanvasRenderer.d.ts +0 -0
  210. /package/dist/{stream → components/stream}/renderers/types.d.ts +0 -0
  211. /package/dist/{stream → components/stream}/renderers/violinCanvasRenderer.d.ts +0 -0
  212. /package/dist/{stream → components/stream}/renderers/waterfallCanvasRenderer.d.ts +0 -0
  213. /package/dist/{stream → components/stream}/renderers/wedgeCanvasRenderer.d.ts +0 -0
  214. /package/dist/{stream → components/stream}/useResponsiveSize.d.ts +0 -0
  215. /package/dist/{types → components/types}/annotationTypes.d.ts +0 -0
  216. /package/dist/{types → components/types}/generalTypes.d.ts +0 -0
  217. /package/dist/{types → components/types}/interactionTypes.d.ts +0 -0
  218. /package/dist/{types → components/types}/networkTypes.d.ts +0 -0
  219. /package/dist/{types → components/types}/ordinalTypes.d.ts +0 -0
@@ -0,0 +1,81 @@
1
+ import type { ZoomTransform } from "d3-zoom";
2
+ import type { GeoPipelineConfig, GeoScales, GeoSceneNode } from "./geoTypes";
3
+ import type { StreamLayout } from "./types";
4
+ import type { ActiveTransition } from "./pipelineTransitionUtils";
5
+ export declare class GeoPipelineStore {
6
+ config: GeoPipelineConfig;
7
+ scene: GeoSceneNode[];
8
+ scales: GeoScales | null;
9
+ version: number;
10
+ private projection;
11
+ private geoPath;
12
+ private baseScale;
13
+ private baseTranslate;
14
+ private baseRotation;
15
+ currentZoom: number;
16
+ cartogramLayout: {
17
+ cx: number;
18
+ cy: number;
19
+ maxCost: number;
20
+ availableRadius: number;
21
+ } | null;
22
+ private areas;
23
+ private pointData;
24
+ private lineData;
25
+ private pointBuffer;
26
+ private streaming;
27
+ lastIngestTime: number;
28
+ private timestampBuffer;
29
+ activeTransition: ActiveTransition | null;
30
+ private prevPositions;
31
+ constructor(config: GeoPipelineConfig);
32
+ updateConfig(config: Partial<GeoPipelineConfig>): void;
33
+ setAreas(features: GeoJSON.Feature[]): void;
34
+ setPoints(data: Record<string, any>[]): void;
35
+ setLines(data: Record<string, any>[]): void;
36
+ /** Initialize streaming mode with a ring buffer */
37
+ initStreaming(windowSize?: number): void;
38
+ /** Push a single streaming point */
39
+ pushPoint(datum: Record<string, any>): void;
40
+ /** Push multiple streaming points */
41
+ pushMany(data: Record<string, any>[]): void;
42
+ clear(): void;
43
+ computeScene(layout: StreamLayout): void;
44
+ private fitProjection;
45
+ /**
46
+ * Apply a d3-zoom transform to the projection.
47
+ * Called on zoom end — updates projection scale/translate and rebuilds scene.
48
+ */
49
+ applyZoomTransform(transform: ZoomTransform, layout: StreamLayout): void;
50
+ /**
51
+ * Apply zoom as scale-only (no translate shift).
52
+ * Used in drag-rotate mode to prevent globe drift on zoom.
53
+ */
54
+ applyZoomScale(k: number, layout: StreamLayout): void;
55
+ /**
56
+ * Apply a rotation to the projection and rebuild the scene.
57
+ * Called during drag-rotate gestures (orthographic globe spinning).
58
+ */
59
+ applyRotation(rotation: [number, number, number], layout: StreamLayout): void;
60
+ /**
61
+ * Set the projection rotation without rebuilding the scene.
62
+ * Use when rotation will be followed by another operation that rebuilds
63
+ * (e.g., applyZoomScale), to avoid redundant scene builds.
64
+ */
65
+ setRotation(rotation: [number, number, number]): void;
66
+ /** Get current rotation (for external tracking) */
67
+ getRotation(): [number, number, number];
68
+ /** Get the current base projection state (for zoom reset) */
69
+ getBaseProjectionState(): {
70
+ scale: number;
71
+ translate: [number, number];
72
+ };
73
+ private getPoints;
74
+ private buildSceneNodes;
75
+ private applyCartogramTransform;
76
+ private applyDecay;
77
+ private applyPulse;
78
+ get hasActivePulses(): boolean;
79
+ private startTransition;
80
+ advanceTransition(now: number): boolean;
81
+ }
@@ -0,0 +1,31 @@
1
+ import type { GeoProjection } from "d3-geo";
2
+ export type TileURLTemplate = string | ((z: number, x: number, y: number, dpr: number) => string);
3
+ interface CachedTile {
4
+ img: HTMLImageElement;
5
+ loaded: boolean;
6
+ key: string;
7
+ lastUsed: number;
8
+ }
9
+ export declare class TileCache {
10
+ private cache;
11
+ private limit;
12
+ constructor(limit?: number);
13
+ get(key: string): CachedTile | undefined;
14
+ set(key: string, entry: CachedTile): void;
15
+ private evict;
16
+ clear(): void;
17
+ }
18
+ export interface TileRenderOptions {
19
+ tileURL: TileURLTemplate;
20
+ projection: GeoProjection;
21
+ width: number;
22
+ height: number;
23
+ tileCache: TileCache;
24
+ onTileLoad?: () => void;
25
+ }
26
+ /**
27
+ * Render visible tiles onto a canvas context.
28
+ * Returns true if all visible tiles are loaded (no pending fetches).
29
+ */
30
+ export declare function renderTiles(ctx: CanvasRenderingContext2D, options: TileRenderOptions): boolean;
31
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { ParticlePool } from "./ParticlePool";
2
+ import type { ActiveTransition } from "./pipelineTransitionUtils";
2
3
  import type { NetworkPipelineConfig, NetworkSceneNode, NetworkSceneEdge, NetworkLabel, RealtimeNode, RealtimeEdge, EdgePush } from "./networkTypes";
3
4
  /**
4
5
  * NetworkPipelineStore — stateful store for the StreamNetworkFrame.
@@ -20,13 +21,12 @@ export declare class NetworkPipelineStore {
20
21
  particlePool: ParticlePool | null;
21
22
  private config;
22
23
  private tensionConfig;
23
- transition: {
24
- startTime: number;
25
- duration: number;
26
- } | null;
24
+ transition: ActiveTransition | null;
27
25
  lastIngestTime: number;
28
26
  private nodeTimestamps;
29
27
  private edgeTimestamps;
28
+ /** Cached sorted node-timestamp entries for applyDecay(); null = needs rebuild */
29
+ private _decaySortedNodes;
30
30
  /** Node IDs added in the most recent layout */
31
31
  addedNodes: Set<string>;
32
32
  /** Node IDs removed in the most recent layout */
@@ -39,6 +39,11 @@ export declare class NetworkPipelineStore {
39
39
  lastTopologyChangeTime: number;
40
40
  private previousNodeIds;
41
41
  private previousEdgeKeys;
42
+ /** Snapshot of node positions from the last layout — used for force warm-start */
43
+ _lastPositionSnapshot: Map<string, {
44
+ x: number;
45
+ y: number;
46
+ }> | null;
42
47
  constructor(config: NetworkPipelineConfig);
43
48
  updateConfig(config: NetworkPipelineConfig): void;
44
49
  /**
@@ -68,6 +73,13 @@ export declare class NetworkPipelineStore {
68
73
  * Build the scene graph from current layout positions.
69
74
  */
70
75
  buildScene(size: [number, number]): void;
76
+ /** Whether the current layout plugin drives continuous animation (respects orbitAnimated config) */
77
+ get isAnimating(): boolean;
78
+ /**
79
+ * Advance the layout animation by one frame (e.g. orbit rotation).
80
+ * Returns true if the scene should be rebuilt.
81
+ */
82
+ tickAnimation(size: [number, number], deltaTime: number): boolean;
71
83
  /**
72
84
  * Advance the transition animation. Returns true if still animating.
73
85
  */
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { ReactNode } from "react";
3
3
  import type { NetworkLabel } from "./networkTypes";
4
- import type { LegendGroup } from "../types/legendTypes";
4
+ import type { LegendGroup, GradientLegendConfig } from "../types/legendTypes";
5
5
  export interface NetworkSVGOverlayProps {
6
6
  width: number;
7
7
  height: number;
@@ -20,9 +20,32 @@ export interface NetworkSVGOverlayProps {
20
20
  /** Legend configuration */
21
21
  legend?: ReactNode | {
22
22
  legendGroups: LegendGroup[];
23
+ } | {
24
+ gradient: GradientLegendConfig;
23
25
  };
26
+ legendHoverBehavior?: (item: {
27
+ label: string;
28
+ } | null) => void;
29
+ legendClickBehavior?: (item: {
30
+ label: string;
31
+ }) => void;
32
+ legendHighlightedCategory?: string | null;
33
+ legendIsolatedCategories?: Set<string>;
34
+ legendPosition?: "right" | "left" | "top" | "bottom";
24
35
  /** User-provided SVG elements on top */
25
36
  foregroundGraphics?: ReactNode;
37
+ /** Scene nodes for annotation positioning */
38
+ sceneNodes?: Array<{
39
+ type: string;
40
+ datum: any;
41
+ id?: string;
42
+ x?: number;
43
+ y?: number;
44
+ cx?: number;
45
+ cy?: number;
46
+ w?: number;
47
+ h?: number;
48
+ }>;
26
49
  /** Annotations */
27
50
  annotations?: Record<string, any>[];
28
51
  svgAnnotationRules?: (annotation: Record<string, any>, index: number, context: any) => ReactNode;
@@ -1,6 +1,7 @@
1
1
  import { type ScaleLinear } from "d3-scale";
2
2
  import type { OrdinalPipelineConfig, OrdinalScales, OrdinalSceneNode, OrdinalColumn, OrdinalLayout } from "./ordinalTypes";
3
3
  import type { Changeset } from "./types";
4
+ import type { ActiveTransition } from "./pipelineTransitionUtils";
4
5
  export declare class OrdinalPipelineStore {
5
6
  private buffer;
6
7
  private rExtent;
@@ -17,15 +18,16 @@ export declare class OrdinalPipelineStore {
17
18
  private getConnector;
18
19
  /** Discovered categories in insertion order */
19
20
  private categories;
21
+ /** True once a non-bounded (push) changeset has been ingested */
22
+ private _hasStreamingData;
20
23
  /** Lazy color map built from colorScheme for resolvePieceStyle */
21
24
  private _colorSchemeMap;
22
25
  private _colorSchemeIndex;
23
26
  private timestampBuffer;
24
- activeTransition: {
25
- startTime: number;
26
- duration: number;
27
- } | null;
27
+ activeTransition: ActiveTransition | null;
28
28
  private prevPositionMap;
29
+ /** Exit nodes awaiting fade-out removal */
30
+ exitNodes: import("./ordinalTypes").OrdinalSceneNode[];
29
31
  lastIngestTime: number;
30
32
  scales: OrdinalScales | null;
31
33
  /** Per-accessor scales for multiAxis */
@@ -53,6 +55,8 @@ export declare class OrdinalPipelineStore {
53
55
  private applyDecay;
54
56
  private applyPulse;
55
57
  get hasActivePulses(): boolean;
58
+ /** Build a stable identity key for a scene node based on its content, not array index */
59
+ private getNodeKey;
56
60
  private snapshotPositions;
57
61
  private startTransition;
58
62
  advanceTransition(now: number): boolean;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import type { OrdinalScales } from "./ordinalTypes";
3
3
  import type { AnnotationContext } from "../realtime/types";
4
4
  import type { ReactNode } from "react";
5
- import type { LegendGroup } from "../types/legendTypes";
5
+ import type { LegendGroup, GradientLegendConfig } from "../types/legendTypes";
6
6
  interface OrdinalSVGOverlayProps {
7
7
  width: number;
8
8
  height: number;
@@ -24,7 +24,18 @@ interface OrdinalSVGOverlayProps {
24
24
  title?: string | ReactNode;
25
25
  legend?: ReactNode | {
26
26
  legendGroups: LegendGroup[];
27
+ } | {
28
+ gradient: GradientLegendConfig;
27
29
  };
30
+ legendHoverBehavior?: (item: {
31
+ label: string;
32
+ } | null) => void;
33
+ legendClickBehavior?: (item: {
34
+ label: string;
35
+ }) => void;
36
+ legendHighlightedCategory?: string | null;
37
+ legendIsolatedCategories?: Set<string>;
38
+ legendPosition?: "right" | "left" | "top" | "bottom";
28
39
  foregroundGraphics?: ReactNode;
29
40
  annotations?: Record<string, any>[];
30
41
  svgAnnotationRules?: (annotation: Record<string, any>, index: number, context: AnnotationContext) => ReactNode;
@@ -32,7 +43,26 @@ interface OrdinalSVGOverlayProps {
32
43
  xAccessor?: string;
33
44
  yAccessor?: string;
34
45
  annotationData?: Record<string, any>[];
46
+ /** When true, grid lines and axis baselines are skipped (rendered by OrdinalSVGUnderlay instead) */
47
+ underlayRendered?: boolean;
35
48
  children?: ReactNode;
36
49
  }
50
+ interface OrdinalSVGUnderlayProps {
51
+ width: number;
52
+ height: number;
53
+ totalWidth: number;
54
+ totalHeight: number;
55
+ margin: {
56
+ top: number;
57
+ right: number;
58
+ bottom: number;
59
+ left: number;
60
+ };
61
+ scales: OrdinalScales | null;
62
+ showAxes?: boolean;
63
+ showGrid?: boolean;
64
+ rFormat?: (d: number) => string;
65
+ }
66
+ export declare function OrdinalSVGUnderlay(props: OrdinalSVGUnderlayProps): React.JSX.Element | null;
37
67
  export declare function OrdinalSVGOverlay(props: OrdinalSVGOverlayProps): React.JSX.Element | null;
38
68
  export {};
@@ -1,5 +1,7 @@
1
+ import { type Quadtree } from "d3-quadtree";
1
2
  import { RingBuffer } from "../realtime/RingBuffer";
2
- import type { Changeset, StreamChartType, StreamScales, StreamLayout, SceneNode, CandlestickStyle, Style, ArrowOfTime, WindowMode, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig } from "./types";
3
+ import type { Changeset, StreamChartType, StreamScales, StreamLayout, SceneNode, PointSceneNode, CandlestickStyle, Style, ArrowOfTime, WindowMode, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig, CurveType } from "./types";
4
+ import type { ActiveTransition } from "./pipelineTransitionUtils";
3
5
  export interface PipelineConfig {
4
6
  chartType: StreamChartType;
5
7
  runtimeMode?: "streaming" | "bounded";
@@ -7,6 +9,7 @@ export interface PipelineConfig {
7
9
  windowMode: WindowMode;
8
10
  arrowOfTime: ArrowOfTime;
9
11
  extentPadding: number;
12
+ maxCapacity?: number;
10
13
  xAccessor?: string | ((d: any) => number);
11
14
  yAccessor?: string | ((d: any) => number);
12
15
  timeAccessor?: string | ((d: any) => number);
@@ -16,6 +19,8 @@ export interface PipelineConfig {
16
19
  groupAccessor?: string | ((d: any) => string);
17
20
  categoryAccessor?: string | ((d: any) => string);
18
21
  lineDataAccessor?: string;
22
+ xScaleType?: "linear" | "log";
23
+ yScaleType?: "linear" | "log";
19
24
  xExtent?: [number | undefined, number | undefined] | [number];
20
25
  yExtent?: [number | undefined, number | undefined] | [number];
21
26
  sizeRange?: [number, number];
@@ -64,7 +69,10 @@ export interface PipelineConfig {
64
69
  heatmapAggregation?: "count" | "sum" | "mean";
65
70
  heatmapXBins?: number;
66
71
  heatmapYBins?: number;
72
+ showValues?: boolean;
73
+ heatmapValueFormat?: (v: number) => string;
67
74
  pointIdAccessor?: string | ((d: any) => string);
75
+ curve?: CurveType;
68
76
  }
69
77
  export declare class PipelineStore {
70
78
  private buffer;
@@ -86,15 +94,33 @@ export declare class PipelineStore {
86
94
  private getClose;
87
95
  private getPointId;
88
96
  private timestampBuffer;
89
- activeTransition: {
90
- startTime: number;
91
- duration: number;
92
- } | null;
97
+ activeTransition: ActiveTransition | null;
93
98
  private prevPositionMap;
99
+ /** Previous line/area path arrays for path interpolation */
100
+ private prevPathMap;
101
+ /** Exit nodes awaiting fade-out removal */
102
+ exitNodes: SceneNode[];
94
103
  lastIngestTime: number;
104
+ /** Unified color map cache keyed by sorted category set — shared across point, swarm, etc. */
105
+ private _colorMapCache;
106
+ /** Separate group→color map for resolveGroupColor (insertion-order based, never invalidates _colorMapCache) */
107
+ private _groupColorMap;
108
+ private _barCategoryCache;
109
+ /** Cache stacked area cumulative sums to skip recalculation when buffer hasn't changed */
110
+ private _stackExtentCache;
111
+ /** Monotonic counter incremented on each ingest — used as part of cache keys */
112
+ private _ingestVersion;
113
+ /** Cached materialized array from buffer.toArray() — only rebuilt when buffer changes */
114
+ private _bufferArrayCache;
115
+ /** True when the buffer has been mutated since last toArray() call */
116
+ private _bufferDirty;
117
+ private needsFullRebuild;
118
+ private lastLayout;
95
119
  scales: StreamScales | null;
96
120
  scene: SceneNode[];
97
121
  version: number;
122
+ private _quadtree;
123
+ private static readonly QUADTREE_THRESHOLD;
98
124
  constructor(config: PipelineConfig);
99
125
  /**
100
126
  * Process a changeset from DataSourceAdapter.
@@ -105,6 +131,21 @@ export declare class PipelineStore {
105
131
  * Recompute scales and scene graph for the current buffer contents.
106
132
  */
107
133
  computeScene(layout: StreamLayout): void;
134
+ /**
135
+ * Build or clear the quadtree spatial index for point scene nodes.
136
+ * Only built for scatter/bubble charts with >QUADTREE_THRESHOLD points.
137
+ */
138
+ private rebuildQuadtree;
139
+ /**
140
+ * Get the quadtree spatial index, if available.
141
+ * Returns null when chart type is not scatter/bubble or point count is below threshold.
142
+ */
143
+ get quadtree(): Quadtree<PointSceneNode> | null;
144
+ /**
145
+ * Remap existing scene node coordinates for a new layout size.
146
+ * Proportionally scales all pixel coordinates without rebuilding from data.
147
+ */
148
+ private remapScene;
108
149
  private buildSceneNodes;
109
150
  private buildLineScene;
110
151
  private buildAreaScene;
@@ -154,6 +195,7 @@ export declare class PipelineStore {
154
195
  private getNodeIdentity;
155
196
  /**
156
197
  * After scene rebuild, set up transition from old to new positions.
198
+ * Detects entering nodes (new, no prev match) and exiting nodes (prev, no new match).
157
199
  */
158
200
  private startTransition;
159
201
  /**
@@ -161,8 +203,25 @@ export declare class PipelineStore {
161
203
  */
162
204
  advanceTransition(now: number): boolean;
163
205
  private groupData;
206
+ /**
207
+ * Resolve a category→color map from data using the colorAccessor.
208
+ * Caches the result in _colorMapCache keyed by sorted category set —
209
+ * only rebuilds when the set of categories changes.
210
+ */
211
+ private resolveColorMap;
164
212
  private resolveLineStyle;
165
213
  private resolveAreaStyle;
214
+ /** Resolve a group name to a color from the cached color map or a dedicated group palette.
215
+ * First checks _colorMapCache (populated by resolveColorMap when colorAccessor is set).
216
+ * Falls back to _groupColorMap (insertion-order, never mutates _colorMapCache). */
217
+ private resolveGroupColor;
218
+ /**
219
+ * Return a cached materialized array of the buffer contents.
220
+ * Only calls buffer.toArray() when the buffer has actually changed
221
+ * (new push, resize, or clear), avoiding per-frame allocation on
222
+ * transition ticks, hover redraws, and other non-data-changing renders.
223
+ */
224
+ private getBufferArray;
166
225
  getData(): Record<string, any>[];
167
226
  getExtents(): {
168
227
  x: [number, number];
@@ -0,0 +1,98 @@
1
+ import * as React from "react";
2
+ import type { StreamScales, MarginalGraphicsConfig } from "./types";
3
+ import type { AnnotationContext } from "../realtime/types";
4
+ import type { ReactNode } from "react";
5
+ import type { LegendGroup, GradientLegendConfig } from "../types/legendTypes";
6
+ export interface AxisConfig {
7
+ orient: "left" | "right" | "top" | "bottom";
8
+ label?: string;
9
+ ticks?: number;
10
+ tickFormat?: (d: any) => string;
11
+ baseline?: boolean | "under";
12
+ jaggedBase?: boolean;
13
+ /** Highlight ticks at time boundaries (new month, year, etc.) with semibold text.
14
+ * `true` auto-detects Date boundaries. A function receives (value, index) and returns true for landmark ticks. */
15
+ landmarkTicks?: boolean | ((value: any, index: number) => boolean);
16
+ }
17
+ interface SVGOverlayProps {
18
+ width: number;
19
+ height: number;
20
+ totalWidth: number;
21
+ totalHeight: number;
22
+ margin: {
23
+ top: number;
24
+ right: number;
25
+ bottom: number;
26
+ left: number;
27
+ };
28
+ scales: StreamScales | null;
29
+ showAxes?: boolean;
30
+ axes?: AxisConfig[];
31
+ xLabel?: string;
32
+ yLabel?: string;
33
+ xFormat?: (d: any) => string;
34
+ yFormat?: (d: any) => string;
35
+ showGrid?: boolean;
36
+ title?: string | ReactNode;
37
+ legend?: ReactNode | {
38
+ legendGroups: LegendGroup[];
39
+ } | {
40
+ gradient: GradientLegendConfig;
41
+ };
42
+ /** Callback when hovering a legend item */
43
+ legendHoverBehavior?: (item: {
44
+ label: string;
45
+ } | null) => void;
46
+ /** Callback when clicking a legend item */
47
+ legendClickBehavior?: (item: {
48
+ label: string;
49
+ }) => void;
50
+ /** Currently highlighted category label (for hover dimming) */
51
+ legendHighlightedCategory?: string | null;
52
+ /** Set of isolated category labels (for click isolation) */
53
+ legendIsolatedCategories?: Set<string>;
54
+ /** Legend position relative to chart area */
55
+ legendPosition?: "right" | "left" | "top" | "bottom";
56
+ foregroundGraphics?: ReactNode;
57
+ marginalGraphics?: MarginalGraphicsConfig;
58
+ xValues?: number[];
59
+ yValues?: number[];
60
+ annotations?: Record<string, any>[];
61
+ svgAnnotationRules?: (annotation: Record<string, any>, index: number, context: AnnotationContext) => ReactNode;
62
+ annotationFrame?: number;
63
+ xAccessor?: string;
64
+ yAccessor?: string;
65
+ annotationData?: Record<string, any>[];
66
+ pointNodes?: {
67
+ pointId?: string;
68
+ x: number;
69
+ y: number;
70
+ r: number;
71
+ }[];
72
+ /** Curve interpolation type for envelope annotations */
73
+ curve?: string;
74
+ /** When true, grid lines and axis baselines are skipped (rendered by SVGUnderlay instead) */
75
+ underlayRendered?: boolean;
76
+ children?: ReactNode;
77
+ }
78
+ interface SVGUnderlayProps {
79
+ width: number;
80
+ height: number;
81
+ totalWidth: number;
82
+ totalHeight: number;
83
+ margin: {
84
+ top: number;
85
+ right: number;
86
+ bottom: number;
87
+ left: number;
88
+ };
89
+ scales: StreamScales | null;
90
+ showAxes?: boolean;
91
+ axes?: AxisConfig[];
92
+ showGrid?: boolean;
93
+ xFormat?: (d: any) => string;
94
+ yFormat?: (d: any) => string;
95
+ }
96
+ export declare function SVGUnderlay(props: SVGUnderlayProps): React.JSX.Element | null;
97
+ export declare function SVGOverlay(props: SVGOverlayProps): React.JSX.Element | null;
98
+ export {};
@@ -1,13 +1,17 @@
1
- import type { SceneNode, LineSceneNode, AreaSceneNode, PointSceneNode, RectSceneNode, HeatcellSceneNode, Style, StreamScales } from "./types";
1
+ import type { SceneNode, LineSceneNode, AreaSceneNode, PointSceneNode, RectSceneNode, HeatcellSceneNode, Style, StreamScales, CurveType } from "./types";
2
2
  export declare function buildLineNode(data: Record<string, any>[], scales: StreamScales, xGet: (d: Record<string, any>) => number, yGet: (d: Record<string, any>) => number, style: Style, group?: string): LineSceneNode;
3
3
  export declare function buildAreaNode(data: Record<string, any>[], scales: StreamScales, xGet: (d: Record<string, any>) => number, yGet: (d: Record<string, any>) => number, baselineY: number, style: Style, group?: string, y0Get?: (d: Record<string, any>) => number): AreaSceneNode;
4
4
  export declare function buildStackedAreaNodes(groups: {
5
5
  key: string;
6
6
  data: Record<string, any>[];
7
- }[], scales: StreamScales, xGet: (d: Record<string, any>) => number, yGet: (d: Record<string, any>) => number, styleFn: (group: string, sampleDatum?: Record<string, any>) => Style, normalize?: boolean): AreaSceneNode[];
7
+ }[], scales: StreamScales, xGet: (d: Record<string, any>) => number, yGet: (d: Record<string, any>) => number, styleFn: (group: string, sampleDatum?: Record<string, any>) => Style, normalize?: boolean, curve?: CurveType): AreaSceneNode[];
8
8
  export declare function buildPointNode(datum: Record<string, any>, scales: StreamScales, xGet: (d: Record<string, any>) => number, yGet: (d: Record<string, any>) => number, r: number, style: Style, pointId?: string): PointSceneNode | null;
9
9
  export declare function buildRectNode(x: number, y: number, w: number, h: number, style: Style, datum: any, group?: string): RectSceneNode;
10
- export declare function buildHeatcellNode(x: number, y: number, w: number, h: number, fill: string, datum: any): HeatcellSceneNode;
10
+ export declare function buildHeatcellNode(x: number, y: number, w: number, h: number, fill: string, datum: any, options?: {
11
+ value?: number;
12
+ showValues?: boolean;
13
+ valueFormat?: (v: number) => string;
14
+ }): HeatcellSceneNode;
11
15
  export interface SceneGraphData {
12
16
  nodes: SceneNode[];
13
17
  version: number;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Scene graph → SVG element converters.
3
+ *
4
+ * Shared module used by Stream Frames for SSR rendering and
5
+ * by semiotic/server for static SVG export.
6
+ */
7
+ import * as React from "react";
8
+ import type { SceneNode } from "./types";
9
+ import type { NetworkSceneNode, NetworkSceneEdge, NetworkLabel } from "./networkTypes";
10
+ import type { OrdinalSceneNode } from "./ordinalTypes";
11
+ import type { GeoSceneNode } from "./geoTypes";
12
+ export declare function xySceneNodeToSVG(node: SceneNode, i: number): React.ReactNode;
13
+ export declare function networkSceneNodeToSVG(node: NetworkSceneNode, i: number): React.ReactNode;
14
+ export declare function networkSceneEdgeToSVG(edge: NetworkSceneEdge, i: number): React.ReactNode;
15
+ export declare function networkLabelToSVG(label: NetworkLabel, i: number): React.ReactNode;
16
+ export declare function ordinalSceneNodeToSVG(node: OrdinalSceneNode, i: number): React.ReactNode;
17
+ export declare function geoSceneNodeToSVG(node: GeoSceneNode, i: number): React.ReactNode;
18
+ /**
19
+ * Returns true when running in a true server/Node.js context where
20
+ * window and document are not available.
21
+ */
22
+ export declare const isServerEnvironment: boolean;
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import type { StreamGeoFrameProps, StreamGeoFrameHandle } from "./geoTypes";
3
+ declare const StreamGeoFrame: React.ForwardRefExoticComponent<StreamGeoFrameProps<Record<string, any>> & React.RefAttributes<StreamGeoFrameHandle>>;
4
+ export default StreamGeoFrame;
@@ -1,2 +1,3 @@
1
1
  export declare function resolveAccessor<T>(accessor: string | ((d: T) => number) | undefined, fallback: string): (d: T) => number;
2
+ export declare function resolveRawAccessor<T>(accessor: string | ((d: T) => any) | undefined, fallback: string): (d: T) => any;
2
3
  export declare function resolveStringAccessor<T>(accessor: string | ((d: T) => string) | undefined, fallback?: string): ((d: T) => string) | undefined;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared canvas setup utilities used by all Stream Frames.
3
+ *
4
+ * Eliminates duplicated DPR / sizing / transform logic across
5
+ * StreamXYFrame, StreamGeoFrame, StreamNetworkFrame, and StreamOrdinalFrame.
6
+ */
7
+ export interface CanvasMargin {
8
+ top: number;
9
+ right: number;
10
+ bottom: number;
11
+ left: number;
12
+ }
13
+ /**
14
+ * Set a canvas element's physical (pixel) and CSS (logical) dimensions,
15
+ * accounting for devicePixelRatio. Returns the 2D context ready for drawing
16
+ * with the DPR transform and margin translation already applied.
17
+ *
18
+ * After this call the context's coordinate space is:
19
+ * (0, 0) = top-left of the chart area (inside margins)
20
+ * (-margin.left, -margin.top) = top-left of the full canvas
21
+ */
22
+ export declare function prepareCanvas(canvas: HTMLCanvasElement, size: [number, number], margin: CanvasMargin, dpr: number): CanvasRenderingContext2D | null;
23
+ /**
24
+ * Get the current devicePixelRatio, defaulting to 1 in non-browser environments.
25
+ */
26
+ export declare function getDevicePixelRatio(): number;