semiotic 3.0.0-beta.2 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +93 -753
- package/README.md +92 -7
- package/ai/dist/componentRegistry.js +26 -0
- package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
- package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +30 -42
- package/ai/dist/ai/componentRegistry.js +0 -45
- package/ai/dist/src/components/Annotation.js +0 -358
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
- package/ai/dist/src/components/Axis/Axis.js +0 -374
- package/ai/dist/src/components/Axis/axisTitle.js +0 -14
- package/ai/dist/src/components/Axis/index.js +0 -7
- package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
- package/ai/dist/src/components/Brush.js +0 -84
- package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
- package/ai/dist/src/components/DividedLine.js +0 -65
- package/ai/dist/src/components/Legend.js +0 -140
- package/ai/dist/src/components/LinkedCharts.js +0 -95
- package/ai/dist/src/components/ThemeProvider.js +0 -79
- package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
- package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
- package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
- package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
- package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
- package/ai/dist/src/components/batchWork.js +0 -35
- package/ai/dist/src/components/charts/index.js +0 -109
- package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
- package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
- package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
- package/ai/dist/src/components/charts/network/Treemap.js +0 -106
- package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
- package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
- package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
- package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
- package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
- package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
- package/ai/dist/src/components/charts/shared/hooks.js +0 -49
- package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
- package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
- package/ai/dist/src/components/charts/shared/types.js +0 -2
- package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
- package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
- package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
- package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
- package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
- package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
- package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
- package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
- package/ai/dist/src/components/constants/coordinateNames.js +0 -11
- package/ai/dist/src/components/constants/frame_props.js +0 -251
- package/ai/dist/src/components/data/dataFunctions.js +0 -487
- package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
- package/ai/dist/src/components/data/transforms.js +0 -143
- package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
- package/ai/dist/src/components/export/exportChart.js +0 -121
- package/ai/dist/src/components/generic_utilities/functions.js +0 -5
- package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
- package/ai/dist/src/components/geometry/contourLayout.js +0 -73
- package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
- package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
- package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
- package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
- package/ai/dist/src/components/index.js +0 -18
- package/ai/dist/src/components/processing/InteractionItems.js +0 -223
- package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
- package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
- package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
- package/ai/dist/src/components/processing/layouts/index.js +0 -32
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
- package/ai/dist/src/components/processing/layouts/types.js +0 -2
- package/ai/dist/src/components/processing/networkDefaults.js +0 -39
- package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
- package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
- package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
- package/ai/dist/src/components/realtime/renderers/types.js +0 -2
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
- package/ai/dist/src/components/realtime/types.js +0 -2
- package/ai/dist/src/components/semiotic-ai.js +0 -89
- package/ai/dist/src/components/semiotic-data.js +0 -12
- package/ai/dist/src/components/semiotic-network.js +0 -38
- package/ai/dist/src/components/semiotic-ordinal.js +0 -28
- package/ai/dist/src/components/semiotic-realtime.js +0 -30
- package/ai/dist/src/components/semiotic-server.js +0 -8
- package/ai/dist/src/components/semiotic-xy.js +0 -35
- package/ai/dist/src/components/semiotic.js +0 -109
- package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
- package/ai/dist/src/components/store/SelectionStore.js +0 -91
- package/ai/dist/src/components/store/ThemeStore.js +0 -78
- package/ai/dist/src/components/store/TooltipStore.js +0 -13
- package/ai/dist/src/components/store/createStore.js +0 -81
- package/ai/dist/src/components/store/useSelection.js +0 -133
- package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
- package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
- package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
- package/ai/dist/src/components/stream/ParticlePool.js +0 -174
- package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
- package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
- package/ai/dist/src/components/stream/SceneGraph.js +0 -132
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
- package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
- package/ai/dist/src/components/stream/accessorUtils.js +0 -20
- package/ai/dist/src/components/stream/index.js +0 -32
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
- package/ai/dist/src/components/stream/layouts/index.js +0 -28
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
- package/ai/dist/src/components/stream/networkTypes.js +0 -17
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
- package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
- package/ai/dist/src/components/stream/renderers/types.js +0 -2
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
- package/ai/dist/src/components/stream/types.js +0 -2
- package/ai/dist/src/components/types/annotationTypes.js +0 -2
- package/ai/dist/src/components/types/canvasTypes.js +0 -2
- package/ai/dist/src/components/types/generalTypes.js +0 -2
- package/ai/dist/src/components/types/interactionTypes.js +0 -2
- package/ai/dist/src/components/types/legendTypes.js +0 -2
- package/ai/dist/src/components/types/networkTypes.js +0 -2
- package/ai/dist/src/components/types/ordinalTypes.js +0 -2
- package/ai/dist/src/components/types/xyTypes.js +0 -2
- package/ai/dist/src/components/useBoundingRect.js +0 -24
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
- package/ai/dist/src/setupTests.js +0 -4
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/network.js +0 -7495
- package/dist/network.js.map +0 -1
- package/dist/network.module.js +0 -7458
- package/dist/network.module.js.map +0 -1
- package/dist/ordinal.js +0 -6497
- package/dist/ordinal.js.map +0 -1
- package/dist/ordinal.module.js +0 -6465
- package/dist/ordinal.module.js.map +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/realtime.js +0 -7072
- package/dist/realtime.js.map +0 -1
- package/dist/realtime.module.js +0 -7043
- package/dist/realtime.module.js.map +0 -1
- package/dist/semiotic-ai.js +0 -13323
- package/dist/semiotic-ai.js.map +0 -1
- package/dist/semiotic-ai.module.js +0 -13264
- package/dist/semiotic-ai.module.js.map +0 -1
- package/dist/semiotic-data.js +0 -141
- package/dist/semiotic-data.js.map +0 -1
- package/dist/semiotic-data.module.js +0 -136
- package/dist/semiotic-data.module.js.map +0 -1
- package/dist/semiotic.js +0 -16351
- package/dist/semiotic.js.map +0 -1
- package/dist/semiotic.module.js +0 -16265
- package/dist/semiotic.module.js.map +0 -1
- package/dist/server.js +0 -5191
- package/dist/server.js.map +0 -1
- package/dist/server.module.js +0 -5166
- package/dist/server.module.js.map +0 -1
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
- package/dist/xy.js +0 -6993
- package/dist/xy.js.map +0 -1
- package/dist/xy.module.js +0 -6957
- package/dist/xy.module.js.map +0 -1
|
@@ -1,561 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
const React = __importStar(require("react"));
|
|
38
|
-
const react_1 = require("react");
|
|
39
|
-
const networkTypes_1 = require("./networkTypes");
|
|
40
|
-
const NetworkPipelineStore_1 = require("./NetworkPipelineStore");
|
|
41
|
-
const NetworkCanvasHitTester_1 = require("./NetworkCanvasHitTester");
|
|
42
|
-
const NetworkSVGOverlay_1 = require("./NetworkSVGOverlay");
|
|
43
|
-
// Canvas renderers
|
|
44
|
-
const networkRectRenderer_1 = require("./renderers/networkRectRenderer");
|
|
45
|
-
const networkCircleRenderer_1 = require("./renderers/networkCircleRenderer");
|
|
46
|
-
const networkArcRenderer_1 = require("./renderers/networkArcRenderer");
|
|
47
|
-
const networkEdgeRenderer_1 = require("./renderers/networkEdgeRenderer");
|
|
48
|
-
const networkParticleRenderer_1 = require("./renderers/networkParticleRenderer");
|
|
49
|
-
const colorUtils_1 = require("../charts/shared/colorUtils");
|
|
50
|
-
// ── Defaults ───────────────────────────────────────────────────────────
|
|
51
|
-
const DEFAULT_MARGIN = { top: 20, right: 80, bottom: 20, left: 80 };
|
|
52
|
-
const CENTERED_MARGIN = { top: 40, right: 40, bottom: 40, left: 40 };
|
|
53
|
-
const CENTERED_TYPES = new Set(["chord", "force", "circlepack"]);
|
|
54
|
-
const DEFAULT_SIZE = [800, 600];
|
|
55
|
-
// ── Tooltip ────────────────────────────────────────────────────────────
|
|
56
|
-
const defaultTooltipStyle = {
|
|
57
|
-
background: "rgba(0, 0, 0, 0.85)",
|
|
58
|
-
color: "white",
|
|
59
|
-
padding: "6px 10px",
|
|
60
|
-
borderRadius: 4,
|
|
61
|
-
fontSize: 12,
|
|
62
|
-
lineHeight: 1.5,
|
|
63
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
64
|
-
pointerEvents: "none",
|
|
65
|
-
whiteSpace: "nowrap"
|
|
66
|
-
};
|
|
67
|
-
function DefaultNetworkTooltip({ data }) {
|
|
68
|
-
if (data.type === "edge") {
|
|
69
|
-
const edge = data.data;
|
|
70
|
-
const sourceId = typeof edge.source === "object" ? edge.source.id : edge.source;
|
|
71
|
-
const targetId = typeof edge.target === "object" ? edge.target.id : edge.target;
|
|
72
|
-
return (React.createElement("div", { className: "semiotic-tooltip", style: defaultTooltipStyle },
|
|
73
|
-
React.createElement("div", { style: { fontWeight: 600 } },
|
|
74
|
-
sourceId,
|
|
75
|
-
" \u2192 ",
|
|
76
|
-
targetId),
|
|
77
|
-
edge.value != null && (React.createElement("div", { style: { marginTop: 4, opacity: 0.8 } },
|
|
78
|
-
"Value:",
|
|
79
|
-
" ",
|
|
80
|
-
typeof edge.value === "number"
|
|
81
|
-
? edge.value.toLocaleString()
|
|
82
|
-
: String(edge.value)))));
|
|
83
|
-
}
|
|
84
|
-
const node = data.data;
|
|
85
|
-
// Hierarchy nodes have a __hierarchyNode with a .parent chain.
|
|
86
|
-
// Show ancestor breadcrumb: grandparent → parent → **node**
|
|
87
|
-
const hNode = node?.__hierarchyNode;
|
|
88
|
-
if (hNode) {
|
|
89
|
-
const ancestors = [];
|
|
90
|
-
let cur = hNode;
|
|
91
|
-
while (cur) {
|
|
92
|
-
const name = cur.data?.name ?? cur.data?.id ?? node.id;
|
|
93
|
-
if (name != null)
|
|
94
|
-
ancestors.unshift(String(name));
|
|
95
|
-
cur = cur.parent;
|
|
96
|
-
}
|
|
97
|
-
// Drop root (first entry) from the breadcrumb — it's usually unnamed
|
|
98
|
-
if (ancestors.length > 1)
|
|
99
|
-
ancestors.shift();
|
|
100
|
-
const last = ancestors.length - 1;
|
|
101
|
-
return (React.createElement("div", { className: "semiotic-tooltip", style: defaultTooltipStyle },
|
|
102
|
-
React.createElement("div", null, ancestors.map((name, i) => (React.createElement("span", { key: i },
|
|
103
|
-
i > 0 && (React.createElement("span", { style: { margin: "0 3px", opacity: 0.5 } }, " → ")),
|
|
104
|
-
i === last ? (React.createElement("strong", null, name)) : (React.createElement("span", { style: { opacity: 0.7 } }, name)))))),
|
|
105
|
-
node.value != null && node.value > 0 && (React.createElement("div", { style: { marginTop: 4, opacity: 0.8 } }, typeof node.value === "number"
|
|
106
|
-
? node.value.toLocaleString()
|
|
107
|
-
: String(node.value)))));
|
|
108
|
-
}
|
|
109
|
-
// Compute degree centrality from source/target links
|
|
110
|
-
const degree = (node.sourceLinks?.length || 0) + (node.targetLinks?.length || 0);
|
|
111
|
-
const weightedDegree = (node.sourceLinks || []).reduce((s, e) => s + (e.value || 0), 0)
|
|
112
|
-
+ (node.targetLinks || []).reduce((s, e) => s + (e.value || 0), 0);
|
|
113
|
-
return (React.createElement("div", { className: "semiotic-tooltip", style: defaultTooltipStyle },
|
|
114
|
-
React.createElement("div", { style: { fontWeight: 600 } }, node.id),
|
|
115
|
-
node.value != null && node.value > 0 && (React.createElement("div", { style: { marginTop: 4, opacity: 0.8 } },
|
|
116
|
-
"Total:",
|
|
117
|
-
" ",
|
|
118
|
-
typeof node.value === "number"
|
|
119
|
-
? node.value.toLocaleString()
|
|
120
|
-
: String(node.value))),
|
|
121
|
-
degree > 0 && (React.createElement("div", { style: { marginTop: 4, opacity: 0.8 } },
|
|
122
|
-
"Connections: ",
|
|
123
|
-
degree,
|
|
124
|
-
weightedDegree !== degree && ` (weighted: ${weightedDegree.toLocaleString()})`))));
|
|
125
|
-
}
|
|
126
|
-
// ── StreamNetworkFrame ─────────────────────────────────────────────────
|
|
127
|
-
const StreamNetworkFrame = (0, react_1.forwardRef)(function StreamNetworkFrame(props, ref) {
|
|
128
|
-
const { chartType, nodes: nodesProp, edges: edgesProp, data: dataProp, initialEdges, nodeIDAccessor = "id", sourceAccessor = "source", targetAccessor = "target", valueAccessor = "value", childrenAccessor, hierarchySum, orientation = "horizontal", nodeAlign = "justify", nodePaddingRatio = 0.05, nodeWidth = 15, iterations = 300, forceStrength = 0.1, padAngle = 0.01, groupWidth = 20, sortGroups, edgeSort, treeOrientation = "vertical", edgeType = "curve", padding, paddingTop, tensionConfig: tensionConfigProp, showParticles = false, particleStyle: particleStyleProp, nodeStyle, edgeStyle, colorBy, colorScheme = "category10", edgeColorBy = "source", edgeOpacity = 0.5, colorByDepth = false, nodeSize = 8, nodeSizeRange = [5, 20], nodeLabel, showLabels = true, size = DEFAULT_SIZE, margin: marginProp, className, background, enableHover = true, tooltipContent, onTopologyChange, annotations, svgAnnotationRules, legend, title, foregroundGraphics, backgroundGraphics } = props;
|
|
129
|
-
const baseMargin = CENTERED_TYPES.has(chartType) ? CENTERED_MARGIN : DEFAULT_MARGIN;
|
|
130
|
-
const margin = { ...baseMargin, ...marginProp };
|
|
131
|
-
const adjustedWidth = size[0] - margin.left - margin.right;
|
|
132
|
-
const adjustedHeight = size[1] - margin.top - margin.bottom;
|
|
133
|
-
const tensionConfig = (0, react_1.useMemo)(() => ({ ...networkTypes_1.DEFAULT_TENSION_CONFIG, ...tensionConfigProp }), [tensionConfigProp]);
|
|
134
|
-
const particleStyle = (0, react_1.useMemo)(() => ({ ...networkTypes_1.DEFAULT_PARTICLE_STYLE, ...particleStyleProp }), [particleStyleProp]);
|
|
135
|
-
// ── Pipeline config ──────────────────────────────────────────────────
|
|
136
|
-
const pipelineConfig = (0, react_1.useMemo)(() => ({
|
|
137
|
-
chartType,
|
|
138
|
-
nodeIDAccessor,
|
|
139
|
-
sourceAccessor,
|
|
140
|
-
targetAccessor,
|
|
141
|
-
valueAccessor,
|
|
142
|
-
childrenAccessor,
|
|
143
|
-
hierarchySum,
|
|
144
|
-
orientation,
|
|
145
|
-
nodeAlign,
|
|
146
|
-
nodePaddingRatio,
|
|
147
|
-
nodeWidth,
|
|
148
|
-
iterations,
|
|
149
|
-
forceStrength,
|
|
150
|
-
padAngle,
|
|
151
|
-
groupWidth,
|
|
152
|
-
sortGroups,
|
|
153
|
-
edgeSort,
|
|
154
|
-
treeOrientation,
|
|
155
|
-
edgeType,
|
|
156
|
-
padding,
|
|
157
|
-
paddingTop,
|
|
158
|
-
tensionConfig,
|
|
159
|
-
showParticles,
|
|
160
|
-
particleStyle,
|
|
161
|
-
nodeStyle,
|
|
162
|
-
edgeStyle,
|
|
163
|
-
nodeLabel,
|
|
164
|
-
showLabels,
|
|
165
|
-
colorBy,
|
|
166
|
-
colorScheme,
|
|
167
|
-
edgeColorBy,
|
|
168
|
-
edgeOpacity,
|
|
169
|
-
colorByDepth,
|
|
170
|
-
nodeSize,
|
|
171
|
-
nodeSizeRange
|
|
172
|
-
}), [
|
|
173
|
-
chartType,
|
|
174
|
-
nodeIDAccessor,
|
|
175
|
-
sourceAccessor,
|
|
176
|
-
targetAccessor,
|
|
177
|
-
valueAccessor,
|
|
178
|
-
childrenAccessor,
|
|
179
|
-
hierarchySum,
|
|
180
|
-
orientation,
|
|
181
|
-
nodeAlign,
|
|
182
|
-
nodePaddingRatio,
|
|
183
|
-
nodeWidth,
|
|
184
|
-
iterations,
|
|
185
|
-
forceStrength,
|
|
186
|
-
padAngle,
|
|
187
|
-
groupWidth,
|
|
188
|
-
sortGroups,
|
|
189
|
-
edgeSort,
|
|
190
|
-
treeOrientation,
|
|
191
|
-
edgeType,
|
|
192
|
-
padding,
|
|
193
|
-
paddingTop,
|
|
194
|
-
tensionConfig,
|
|
195
|
-
showParticles,
|
|
196
|
-
particleStyle,
|
|
197
|
-
nodeStyle,
|
|
198
|
-
edgeStyle,
|
|
199
|
-
nodeLabel,
|
|
200
|
-
showLabels,
|
|
201
|
-
colorBy,
|
|
202
|
-
colorScheme,
|
|
203
|
-
edgeColorBy,
|
|
204
|
-
edgeOpacity,
|
|
205
|
-
colorByDepth,
|
|
206
|
-
nodeSize,
|
|
207
|
-
nodeSizeRange
|
|
208
|
-
]);
|
|
209
|
-
// ── Refs ─────────────────────────────────────────────────────────────
|
|
210
|
-
const canvasRef = (0, react_1.useRef)(null);
|
|
211
|
-
const rafRef = (0, react_1.useRef)(0);
|
|
212
|
-
const lastFrameTimeRef = (0, react_1.useRef)(0);
|
|
213
|
-
const dirtyRef = (0, react_1.useRef)(true);
|
|
214
|
-
const renderFnRef = (0, react_1.useRef)(() => { });
|
|
215
|
-
// ── Store ────────────────────────────────────────────────────────────
|
|
216
|
-
const storeRef = (0, react_1.useRef)(null);
|
|
217
|
-
if (!storeRef.current) {
|
|
218
|
-
storeRef.current = new NetworkPipelineStore_1.NetworkPipelineStore(pipelineConfig);
|
|
219
|
-
}
|
|
220
|
-
// ── State ────────────────────────────────────────────────────────────
|
|
221
|
-
const [hoverData, setHoverData] = (0, react_1.useState)(null);
|
|
222
|
-
const [layoutVersion, setLayoutVersion] = (0, react_1.useState)(0);
|
|
223
|
-
const [annotationFrame, setAnnotationFrame] = (0, react_1.useState)(0);
|
|
224
|
-
const hoverRef = (0, react_1.useRef)(null);
|
|
225
|
-
// ── Color functions ──────────────────────────────────────────────────
|
|
226
|
-
const nodeColorMap = (0, react_1.useRef)(new Map());
|
|
227
|
-
const colorIndexRef = (0, react_1.useRef)(0);
|
|
228
|
-
const getNodeColor = (0, react_1.useCallback)((node) => {
|
|
229
|
-
if (typeof colorBy === "function")
|
|
230
|
-
return colorBy(node);
|
|
231
|
-
if (typeof colorBy === "string" && node.data) {
|
|
232
|
-
const val = node.data[colorBy];
|
|
233
|
-
if (val !== undefined) {
|
|
234
|
-
if (!nodeColorMap.current.has(String(val))) {
|
|
235
|
-
const colors = Array.isArray(colorScheme)
|
|
236
|
-
? colorScheme
|
|
237
|
-
: colorUtils_1.DEFAULT_COLORS;
|
|
238
|
-
nodeColorMap.current.set(String(val), colors[colorIndexRef.current++ % colors.length]);
|
|
239
|
-
}
|
|
240
|
-
return nodeColorMap.current.get(String(val));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (!nodeColorMap.current.has(node.id)) {
|
|
244
|
-
const colors = Array.isArray(colorScheme)
|
|
245
|
-
? colorScheme
|
|
246
|
-
: colorUtils_1.DEFAULT_COLORS;
|
|
247
|
-
nodeColorMap.current.set(node.id, colors[colorIndexRef.current++ % colors.length]);
|
|
248
|
-
}
|
|
249
|
-
return nodeColorMap.current.get(node.id);
|
|
250
|
-
}, [colorBy, colorScheme]);
|
|
251
|
-
const getEdgeColor = (0, react_1.useCallback)((edge) => {
|
|
252
|
-
if (typeof edgeColorBy === "function")
|
|
253
|
-
return edgeColorBy(edge);
|
|
254
|
-
const sourceNode = typeof edge.source === "object" ? edge.source : null;
|
|
255
|
-
const targetNode = typeof edge.target === "object" ? edge.target : null;
|
|
256
|
-
if (edgeColorBy === "target" && targetNode) {
|
|
257
|
-
return getNodeColor(targetNode);
|
|
258
|
-
}
|
|
259
|
-
if (sourceNode) {
|
|
260
|
-
return getNodeColor(sourceNode);
|
|
261
|
-
}
|
|
262
|
-
return "#999";
|
|
263
|
-
}, [edgeColorBy, getNodeColor]);
|
|
264
|
-
const getParticleColor = (0, react_1.useCallback)((edge) => {
|
|
265
|
-
const colorByMode = particleStyle.colorBy || "source";
|
|
266
|
-
const sourceNode = typeof edge.source === "object" ? edge.source : null;
|
|
267
|
-
const targetNode = typeof edge.target === "object" ? edge.target : null;
|
|
268
|
-
if (colorByMode === "target" && targetNode) {
|
|
269
|
-
return getNodeColor(targetNode);
|
|
270
|
-
}
|
|
271
|
-
if (sourceNode) {
|
|
272
|
-
return getNodeColor(sourceNode);
|
|
273
|
-
}
|
|
274
|
-
return "#999";
|
|
275
|
-
}, [particleStyle.colorBy, getNodeColor]);
|
|
276
|
-
// ── Stable scheduleRender ────────────────────────────────────────────
|
|
277
|
-
const isContinuous = chartType === "sankey" && showParticles;
|
|
278
|
-
const scheduleRender = (0, react_1.useCallback)(() => {
|
|
279
|
-
if (rafRef.current && !isContinuous)
|
|
280
|
-
return;
|
|
281
|
-
if (!rafRef.current) {
|
|
282
|
-
rafRef.current = requestAnimationFrame(() => renderFnRef.current());
|
|
283
|
-
}
|
|
284
|
-
}, [isContinuous]);
|
|
285
|
-
// Update config when props change
|
|
286
|
-
(0, react_1.useEffect)(() => {
|
|
287
|
-
storeRef.current?.updateConfig(pipelineConfig);
|
|
288
|
-
dirtyRef.current = true;
|
|
289
|
-
scheduleRender();
|
|
290
|
-
}, [pipelineConfig, scheduleRender]);
|
|
291
|
-
// ── Layout execution ─────────────────────────────────────────────────
|
|
292
|
-
const runLayout = (0, react_1.useCallback)(() => {
|
|
293
|
-
const store = storeRef.current;
|
|
294
|
-
if (!store)
|
|
295
|
-
return;
|
|
296
|
-
store.runLayout([adjustedWidth, adjustedHeight]);
|
|
297
|
-
store.buildScene([adjustedWidth, adjustedHeight]);
|
|
298
|
-
dirtyRef.current = true;
|
|
299
|
-
setLayoutVersion(store.layoutVersion);
|
|
300
|
-
if (onTopologyChange) {
|
|
301
|
-
const { nodes, edges } = store.getLayoutData();
|
|
302
|
-
onTopologyChange(nodes, edges);
|
|
303
|
-
}
|
|
304
|
-
}, [adjustedWidth, adjustedHeight, onTopologyChange]);
|
|
305
|
-
// ── Push API ─────────────────────────────────────────────────────────
|
|
306
|
-
const pushEdge = (0, react_1.useCallback)((edge) => {
|
|
307
|
-
const store = storeRef.current;
|
|
308
|
-
if (!store)
|
|
309
|
-
return;
|
|
310
|
-
const needsRelayout = store.ingestEdge(edge);
|
|
311
|
-
if (needsRelayout) {
|
|
312
|
-
runLayout();
|
|
313
|
-
}
|
|
314
|
-
scheduleRender();
|
|
315
|
-
}, [runLayout, scheduleRender]);
|
|
316
|
-
const pushManyEdges = (0, react_1.useCallback)((edges) => {
|
|
317
|
-
const store = storeRef.current;
|
|
318
|
-
if (!store)
|
|
319
|
-
return;
|
|
320
|
-
let needsRelayout = false;
|
|
321
|
-
for (const edge of edges) {
|
|
322
|
-
if (store.ingestEdge(edge)) {
|
|
323
|
-
needsRelayout = true;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (needsRelayout) {
|
|
327
|
-
runLayout();
|
|
328
|
-
}
|
|
329
|
-
scheduleRender();
|
|
330
|
-
}, [runLayout, scheduleRender]);
|
|
331
|
-
const clearAll = (0, react_1.useCallback)(() => {
|
|
332
|
-
storeRef.current?.clear();
|
|
333
|
-
nodeColorMap.current.clear();
|
|
334
|
-
colorIndexRef.current = 0;
|
|
335
|
-
setLayoutVersion(0);
|
|
336
|
-
setHoverData(null);
|
|
337
|
-
hoverRef.current = null;
|
|
338
|
-
dirtyRef.current = true;
|
|
339
|
-
scheduleRender();
|
|
340
|
-
}, [scheduleRender]);
|
|
341
|
-
const forceRelayout = (0, react_1.useCallback)(() => {
|
|
342
|
-
const store = storeRef.current;
|
|
343
|
-
if (!store)
|
|
344
|
-
return;
|
|
345
|
-
store.tension += 999;
|
|
346
|
-
runLayout();
|
|
347
|
-
scheduleRender();
|
|
348
|
-
}, [runLayout, scheduleRender]);
|
|
349
|
-
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
350
|
-
push: pushEdge,
|
|
351
|
-
pushMany: pushManyEdges,
|
|
352
|
-
clear: clearAll,
|
|
353
|
-
getTopology: () => storeRef.current?.getLayoutData() ?? { nodes: [], edges: [] },
|
|
354
|
-
relayout: forceRelayout,
|
|
355
|
-
getTension: () => storeRef.current?.tension ?? 0
|
|
356
|
-
}), [pushEdge, pushManyEdges, clearAll, forceRelayout]);
|
|
357
|
-
// ── Bounded data ingestion ───────────────────────────────────────────
|
|
358
|
-
// Determine if this is a hierarchical chart type
|
|
359
|
-
const isHierarchical = ["tree", "cluster", "treemap", "circlepack", "partition"].includes(chartType);
|
|
360
|
-
// Resolve hierarchy root: `data` prop or single-object `edges` prop
|
|
361
|
-
const hierarchyRoot = isHierarchical ? (dataProp || (!Array.isArray(edgesProp) ? edgesProp : undefined)) : undefined;
|
|
362
|
-
(0, react_1.useEffect)(() => {
|
|
363
|
-
const store = storeRef.current;
|
|
364
|
-
if (!store)
|
|
365
|
-
return;
|
|
366
|
-
if (isHierarchical && hierarchyRoot) {
|
|
367
|
-
// Hierarchy data: single root object
|
|
368
|
-
store.ingestHierarchy(hierarchyRoot, [adjustedWidth, adjustedHeight]);
|
|
369
|
-
store.buildScene([adjustedWidth, adjustedHeight]);
|
|
370
|
-
dirtyRef.current = true;
|
|
371
|
-
scheduleRender();
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
// Graph data: nodes + edges arrays
|
|
375
|
-
const rawNodes = nodesProp || [];
|
|
376
|
-
const rawEdges = Array.isArray(edgesProp) ? edgesProp : [];
|
|
377
|
-
if (rawNodes.length === 0 && rawEdges.length === 0)
|
|
378
|
-
return;
|
|
379
|
-
store.ingestBounded(rawNodes, rawEdges, [adjustedWidth, adjustedHeight]);
|
|
380
|
-
store.buildScene([adjustedWidth, adjustedHeight]);
|
|
381
|
-
dirtyRef.current = true;
|
|
382
|
-
scheduleRender();
|
|
383
|
-
}
|
|
384
|
-
}, [nodesProp, edgesProp, dataProp, hierarchyRoot, isHierarchical, adjustedWidth, adjustedHeight, pipelineConfig, scheduleRender]);
|
|
385
|
-
// ── Initial streaming data ───────────────────────────────────────────
|
|
386
|
-
(0, react_1.useEffect)(() => {
|
|
387
|
-
if (initialEdges && initialEdges.length > 0) {
|
|
388
|
-
pushManyEdges(initialEdges);
|
|
389
|
-
}
|
|
390
|
-
// Only run on mount
|
|
391
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
|
-
}, []);
|
|
393
|
-
// ── Hover handlers ───────────────────────────────────────────────────
|
|
394
|
-
const hoverHandlerRef = (0, react_1.useRef)(() => { });
|
|
395
|
-
const hoverLeaveRef = (0, react_1.useRef)(() => { });
|
|
396
|
-
hoverHandlerRef.current = (e) => {
|
|
397
|
-
if (!enableHover)
|
|
398
|
-
return;
|
|
399
|
-
const canvas = canvasRef.current;
|
|
400
|
-
if (!canvas)
|
|
401
|
-
return;
|
|
402
|
-
const rect = canvas.getBoundingClientRect();
|
|
403
|
-
const chartX = e.clientX - rect.left - margin.left;
|
|
404
|
-
const chartY = e.clientY - rect.top - margin.top;
|
|
405
|
-
if (chartX < 0 ||
|
|
406
|
-
chartX > adjustedWidth ||
|
|
407
|
-
chartY < 0 ||
|
|
408
|
-
chartY > adjustedHeight) {
|
|
409
|
-
if (hoverRef.current) {
|
|
410
|
-
hoverRef.current = null;
|
|
411
|
-
setHoverData(null);
|
|
412
|
-
scheduleRender();
|
|
413
|
-
}
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const store = storeRef.current;
|
|
417
|
-
if (!store)
|
|
418
|
-
return;
|
|
419
|
-
const hit = (0, NetworkCanvasHitTester_1.findNearestNetworkNode)(store.sceneNodes, store.sceneEdges, chartX, chartY);
|
|
420
|
-
if (!hit) {
|
|
421
|
-
if (hoverRef.current) {
|
|
422
|
-
hoverRef.current = null;
|
|
423
|
-
setHoverData(null);
|
|
424
|
-
scheduleRender();
|
|
425
|
-
}
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
const hover = {
|
|
429
|
-
type: hit.type,
|
|
430
|
-
data: hit.datum,
|
|
431
|
-
x: hit.x,
|
|
432
|
-
y: hit.y
|
|
433
|
-
};
|
|
434
|
-
hoverRef.current = hover;
|
|
435
|
-
setHoverData(hover);
|
|
436
|
-
scheduleRender();
|
|
437
|
-
};
|
|
438
|
-
hoverLeaveRef.current = () => {
|
|
439
|
-
if (hoverRef.current) {
|
|
440
|
-
hoverRef.current = null;
|
|
441
|
-
setHoverData(null);
|
|
442
|
-
scheduleRender();
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
const onMouseMove = (0, react_1.useCallback)((e) => hoverHandlerRef.current(e), []);
|
|
446
|
-
const onMouseLeave = (0, react_1.useCallback)(() => hoverLeaveRef.current(), []);
|
|
447
|
-
// ── Render function ──────────────────────────────────────────────────
|
|
448
|
-
renderFnRef.current = () => {
|
|
449
|
-
rafRef.current = 0;
|
|
450
|
-
const canvas = canvasRef.current;
|
|
451
|
-
if (!canvas)
|
|
452
|
-
return;
|
|
453
|
-
const ctx = canvas.getContext("2d");
|
|
454
|
-
if (!ctx)
|
|
455
|
-
return;
|
|
456
|
-
const store = storeRef.current;
|
|
457
|
-
if (!store)
|
|
458
|
-
return;
|
|
459
|
-
const now = performance.now();
|
|
460
|
-
const deltaTime = lastFrameTimeRef.current
|
|
461
|
-
? Math.min((now - lastFrameTimeRef.current) / 1000, 0.1)
|
|
462
|
-
: 0.016;
|
|
463
|
-
lastFrameTimeRef.current = now;
|
|
464
|
-
// Advance transition animation
|
|
465
|
-
const isTransitioning = store.advanceTransition(now);
|
|
466
|
-
if (isTransitioning || dirtyRef.current) {
|
|
467
|
-
// Rebuild scene for current positions
|
|
468
|
-
store.buildScene([adjustedWidth, adjustedHeight]);
|
|
469
|
-
}
|
|
470
|
-
// DPR setup
|
|
471
|
-
const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
472
|
-
canvas.width = size[0] * dpr;
|
|
473
|
-
canvas.height = size[1] * dpr;
|
|
474
|
-
canvas.style.width = `${size[0]}px`;
|
|
475
|
-
canvas.style.height = `${size[1]}px`;
|
|
476
|
-
ctx.scale(dpr, dpr);
|
|
477
|
-
ctx.translate(margin.left, margin.top);
|
|
478
|
-
ctx.clearRect(-margin.left, -margin.top, size[0], size[1]);
|
|
479
|
-
// Background
|
|
480
|
-
if (background) {
|
|
481
|
-
ctx.fillStyle = background;
|
|
482
|
-
ctx.fillRect(0, 0, adjustedWidth, adjustedHeight);
|
|
483
|
-
}
|
|
484
|
-
// Render edges first (they go behind nodes)
|
|
485
|
-
(0, networkEdgeRenderer_1.networkEdgeRenderer)(ctx, store.sceneEdges);
|
|
486
|
-
// Render nodes
|
|
487
|
-
(0, networkRectRenderer_1.networkRectRenderer)(ctx, store.sceneNodes);
|
|
488
|
-
(0, networkCircleRenderer_1.networkCircleRenderer)(ctx, store.sceneNodes);
|
|
489
|
-
(0, networkArcRenderer_1.networkArcRenderer)(ctx, store.sceneNodes);
|
|
490
|
-
// Render particles (sankey only)
|
|
491
|
-
if (showParticles && store.particlePool) {
|
|
492
|
-
const edges = Array.from(store.edges.values());
|
|
493
|
-
if (edges.length > 0) {
|
|
494
|
-
(0, networkParticleRenderer_1.spawnNetworkParticles)(store.particlePool, edges, deltaTime, particleStyle);
|
|
495
|
-
const speed = (particleStyle.speedMultiplier ?? 1) * 0.5;
|
|
496
|
-
store.particlePool.step(deltaTime, speed, edges);
|
|
497
|
-
(0, networkParticleRenderer_1.renderNetworkParticles)(ctx, store.particlePool, edges, particleStyle, getParticleColor);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
const wasDirty = dirtyRef.current;
|
|
501
|
-
dirtyRef.current = false;
|
|
502
|
-
// Update SVG overlay when layout changes
|
|
503
|
-
if (wasDirty || isTransitioning) {
|
|
504
|
-
setAnnotationFrame((f) => f + 1);
|
|
505
|
-
}
|
|
506
|
-
// Schedule next frame for continuous rendering (particles/transitions)
|
|
507
|
-
if (isContinuous || isTransitioning) {
|
|
508
|
-
rafRef.current = requestAnimationFrame(() => renderFnRef.current());
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
// ── Lifecycle ────────────────────────────────────────────────────────
|
|
512
|
-
(0, react_1.useEffect)(() => {
|
|
513
|
-
scheduleRender();
|
|
514
|
-
return () => {
|
|
515
|
-
if (rafRef.current)
|
|
516
|
-
cancelAnimationFrame(rafRef.current);
|
|
517
|
-
};
|
|
518
|
-
}, [scheduleRender]);
|
|
519
|
-
(0, react_1.useEffect)(() => {
|
|
520
|
-
dirtyRef.current = true;
|
|
521
|
-
scheduleRender();
|
|
522
|
-
}, [chartType, adjustedWidth, adjustedHeight, background, scheduleRender]);
|
|
523
|
-
// ── Tooltip ──────────────────────────────────────────────────────────
|
|
524
|
-
const tooltipElement = enableHover && hoverData ? (React.createElement("div", { className: "stream-network-tooltip", style: {
|
|
525
|
-
position: "absolute",
|
|
526
|
-
left: margin.left + hoverData.x,
|
|
527
|
-
top: margin.top + hoverData.y,
|
|
528
|
-
transform: `translate(${hoverData.x > adjustedWidth * 0.6
|
|
529
|
-
? "calc(-100% - 12px)"
|
|
530
|
-
: "12px"}, ${hoverData.y < adjustedHeight * 0.3
|
|
531
|
-
? "4px"
|
|
532
|
-
: "calc(-100% - 4px)"})`,
|
|
533
|
-
pointerEvents: "none",
|
|
534
|
-
zIndex: 2
|
|
535
|
-
} }, tooltipContent ? (tooltipContent(hoverData)) : (React.createElement(DefaultNetworkTooltip, { data: hoverData })))) : null;
|
|
536
|
-
// ── Render ───────────────────────────────────────────────────────────
|
|
537
|
-
const store = storeRef.current;
|
|
538
|
-
return (React.createElement("div", { className: `stream-network-frame${className ? ` ${className}` : ""}`, style: {
|
|
539
|
-
position: "relative",
|
|
540
|
-
width: size[0],
|
|
541
|
-
height: size[1]
|
|
542
|
-
}, onMouseMove: enableHover ? onMouseMove : undefined, onMouseLeave: enableHover ? onMouseLeave : undefined },
|
|
543
|
-
backgroundGraphics && (React.createElement("svg", { style: {
|
|
544
|
-
position: "absolute",
|
|
545
|
-
top: 0,
|
|
546
|
-
left: 0,
|
|
547
|
-
width: size[0],
|
|
548
|
-
height: size[1],
|
|
549
|
-
pointerEvents: "none"
|
|
550
|
-
} },
|
|
551
|
-
React.createElement("g", { transform: `translate(${margin.left},${margin.top})` }, backgroundGraphics))),
|
|
552
|
-
React.createElement("canvas", { ref: canvasRef, style: {
|
|
553
|
-
position: "absolute",
|
|
554
|
-
top: 0,
|
|
555
|
-
left: 0
|
|
556
|
-
} }),
|
|
557
|
-
React.createElement(NetworkSVGOverlay_1.NetworkSVGOverlay, { width: adjustedWidth, height: adjustedHeight, totalWidth: size[0], totalHeight: size[1], margin: margin, labels: store?.labels || [], title: title, legend: legend, foregroundGraphics: foregroundGraphics, annotations: annotations, svgAnnotationRules: svgAnnotationRules, annotationFrame: annotationFrame }),
|
|
558
|
-
tooltipElement));
|
|
559
|
-
});
|
|
560
|
-
StreamNetworkFrame.displayName = "StreamNetworkFrame";
|
|
561
|
-
exports.default = StreamNetworkFrame;
|