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,142 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.ChordDiagram = ChordDiagram;
|
|
41
|
-
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
const StreamNetworkFrame_1 = __importDefault(require("../../stream/StreamNetworkFrame"));
|
|
44
|
-
const colorUtils_1 = require("../shared/colorUtils");
|
|
45
|
-
const Tooltip_1 = require("../../Tooltip/Tooltip");
|
|
46
|
-
const hooks_1 = require("../shared/hooks");
|
|
47
|
-
const ChartError_1 = __importDefault(require("../shared/ChartError"));
|
|
48
|
-
const validateChartData_1 = require("../shared/validateChartData");
|
|
49
|
-
/**
|
|
50
|
-
* ChordDiagram - Visualize directed relationships with circular chord layout
|
|
51
|
-
*
|
|
52
|
-
* Wraps StreamNetworkFrame (canvas-first) for chord relationship visualization.
|
|
53
|
-
*/
|
|
54
|
-
function ChordDiagram(props) {
|
|
55
|
-
const { nodes, edges, width = 600, height = 600, margin = { top: 50, bottom: 50, left: 50, right: 50 }, className, title, sourceAccessor = "source", targetAccessor = "target", valueAccessor = "value", nodeIdAccessor = "id", colorBy, colorScheme = "category10", edgeColorBy = "source", padAngle = 0.01, groupWidth = 20, sortGroups, nodeLabel, showLabels = true, enableHover = true, edgeOpacity = 0.5, tooltip, frameProps = {} } = props;
|
|
56
|
-
const safeEdges = edges || [];
|
|
57
|
-
// Infer nodes from edges if not provided
|
|
58
|
-
const inferredNodes = (0, react_1.useMemo)(() => {
|
|
59
|
-
if (nodes && nodes.length > 0)
|
|
60
|
-
return nodes;
|
|
61
|
-
const nodeSet = new Set();
|
|
62
|
-
safeEdges.forEach((edge) => {
|
|
63
|
-
const sourceId = typeof sourceAccessor === "function" ? sourceAccessor(edge) : edge[sourceAccessor];
|
|
64
|
-
const targetId = typeof targetAccessor === "function" ? targetAccessor(edge) : edge[targetAccessor];
|
|
65
|
-
nodeSet.add(sourceId);
|
|
66
|
-
nodeSet.add(targetId);
|
|
67
|
-
});
|
|
68
|
-
return Array.from(nodeSet).map((id) => ({ id }));
|
|
69
|
-
}, [nodes, safeEdges, sourceAccessor, targetAccessor]);
|
|
70
|
-
const colorScale = (0, hooks_1.useColorScale)(inferredNodes, colorBy, colorScheme);
|
|
71
|
-
// Node style function — d is a RealtimeNode, user data on d.data
|
|
72
|
-
const nodeStyle = (0, react_1.useMemo)(() => {
|
|
73
|
-
return (d, i) => {
|
|
74
|
-
const baseStyle = {
|
|
75
|
-
stroke: "black",
|
|
76
|
-
strokeWidth: 1
|
|
77
|
-
};
|
|
78
|
-
if (colorBy) {
|
|
79
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(d.data || d, colorBy, colorScale);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const palette = Array.isArray(colorScheme) ? colorScheme : (colorUtils_1.COLOR_SCHEMES[colorScheme] || colorUtils_1.DEFAULT_COLORS);
|
|
83
|
-
const colors = Array.isArray(palette) ? palette : colorUtils_1.DEFAULT_COLORS;
|
|
84
|
-
const index = d.index ?? i ?? 0;
|
|
85
|
-
baseStyle.fill = colors[index % colors.length];
|
|
86
|
-
}
|
|
87
|
-
return baseStyle;
|
|
88
|
-
};
|
|
89
|
-
}, [colorBy, colorScale, colorScheme]);
|
|
90
|
-
// Edge style function — d is a RealtimeEdge
|
|
91
|
-
const edgeStyle = (0, react_1.useMemo)(() => {
|
|
92
|
-
return (d) => {
|
|
93
|
-
const baseStyle = {
|
|
94
|
-
stroke: "black",
|
|
95
|
-
strokeWidth: 0.5,
|
|
96
|
-
fillOpacity: edgeOpacity,
|
|
97
|
-
strokeOpacity: edgeOpacity
|
|
98
|
-
};
|
|
99
|
-
if (typeof edgeColorBy === "function") {
|
|
100
|
-
baseStyle.fill = edgeColorBy(d);
|
|
101
|
-
}
|
|
102
|
-
else if (edgeColorBy === "source") {
|
|
103
|
-
const src = typeof d.source === "object" ? d.source : null;
|
|
104
|
-
if (colorBy && src) {
|
|
105
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(src.data || src, colorBy, colorScale);
|
|
106
|
-
}
|
|
107
|
-
else if (src) {
|
|
108
|
-
baseStyle.fill = nodeStyle(src, src.index).fill;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (edgeColorBy === "target") {
|
|
112
|
-
const tgt = typeof d.target === "object" ? d.target : null;
|
|
113
|
-
if (colorBy && tgt) {
|
|
114
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(tgt.data || tgt, colorBy, colorScale);
|
|
115
|
-
}
|
|
116
|
-
else if (tgt) {
|
|
117
|
-
baseStyle.fill = nodeStyle(tgt, tgt.index).fill;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return baseStyle;
|
|
121
|
-
};
|
|
122
|
-
}, [edgeColorBy, colorBy, colorScale, nodeStyle, edgeOpacity]);
|
|
123
|
-
// Node label accessor
|
|
124
|
-
const nodeLabelFn = (0, react_1.useMemo)(() => {
|
|
125
|
-
if (!showLabels)
|
|
126
|
-
return undefined;
|
|
127
|
-
const accessor = nodeLabel || nodeIdAccessor;
|
|
128
|
-
if (typeof accessor === "function")
|
|
129
|
-
return accessor;
|
|
130
|
-
return (d) => d[accessor];
|
|
131
|
-
}, [showLabels, nodeLabel, nodeIdAccessor]);
|
|
132
|
-
// Validate
|
|
133
|
-
const error = (0, validateChartData_1.validateNetworkData)({
|
|
134
|
-
componentName: "ChordDiagram",
|
|
135
|
-
edges,
|
|
136
|
-
edgesRequired: true,
|
|
137
|
-
});
|
|
138
|
-
if (error)
|
|
139
|
-
return React.createElement(ChartError_1.default, { componentName: "ChordDiagram", message: error, width: width, height: height });
|
|
140
|
-
return (React.createElement(StreamNetworkFrame_1.default, { chartType: "chord", nodes: inferredNodes, edges: safeEdges, size: [width, height], margin: margin, nodeIDAccessor: nodeIdAccessor, sourceAccessor: sourceAccessor, targetAccessor: targetAccessor, valueAccessor: valueAccessor, padAngle: padAngle, groupWidth: groupWidth, sortGroups: sortGroups, nodeStyle: nodeStyle, edgeStyle: edgeStyle, colorBy: colorBy, colorScheme: colorScheme, edgeColorBy: edgeColorBy, edgeOpacity: edgeOpacity, nodeLabel: nodeLabelFn, showLabels: showLabels, enableHover: enableHover, tooltipContent: tooltip ? (d) => (0, Tooltip_1.normalizeTooltip)(tooltip)(d.data) : undefined, className: className, title: title, ...frameProps }));
|
|
141
|
-
}
|
|
142
|
-
ChordDiagram.displayName = "ChordDiagram";
|
|
@@ -1,108 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.CirclePack = CirclePack;
|
|
41
|
-
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
const StreamNetworkFrame_1 = __importDefault(require("../../stream/StreamNetworkFrame"));
|
|
44
|
-
const colorUtils_1 = require("../shared/colorUtils");
|
|
45
|
-
const Tooltip_1 = require("../../Tooltip/Tooltip");
|
|
46
|
-
const hooks_1 = require("../shared/hooks");
|
|
47
|
-
const ChartError_1 = __importDefault(require("../shared/ChartError"));
|
|
48
|
-
const validateChartData_1 = require("../shared/validateChartData");
|
|
49
|
-
/**
|
|
50
|
-
* CirclePack - Visualize hierarchical data as nested circles.
|
|
51
|
-
*
|
|
52
|
-
* Wraps StreamNetworkFrame (canvas-first) for circle-pack visualization.
|
|
53
|
-
*/
|
|
54
|
-
function CirclePack(props) {
|
|
55
|
-
const { data, width = 600, height = 600, margin = { top: 10, bottom: 10, left: 10, right: 10 }, className, title, childrenAccessor = "children", valueAccessor = "value", nodeIdAccessor = "name", colorBy, colorScheme = "category10", colorByDepth = false, showLabels = true, nodeLabel, circleOpacity = 0.7, padding: paddingProp = 4, enableHover = true, tooltip, frameProps = {} } = props;
|
|
56
|
-
const allNodes = (0, react_1.useMemo)(() => {
|
|
57
|
-
if (!data)
|
|
58
|
-
return [];
|
|
59
|
-
const nodes = [];
|
|
60
|
-
const traverse = (node) => {
|
|
61
|
-
nodes.push(node);
|
|
62
|
-
const children = typeof childrenAccessor === "function" ? childrenAccessor(node) : node[childrenAccessor];
|
|
63
|
-
if (children && Array.isArray(children))
|
|
64
|
-
children.forEach(traverse);
|
|
65
|
-
};
|
|
66
|
-
traverse(data);
|
|
67
|
-
return nodes;
|
|
68
|
-
}, [data, childrenAccessor]);
|
|
69
|
-
const colorScale = (0, react_1.useMemo)(() => {
|
|
70
|
-
if (colorByDepth)
|
|
71
|
-
return undefined;
|
|
72
|
-
if (!colorBy || typeof colorBy === "function")
|
|
73
|
-
return undefined;
|
|
74
|
-
return (0, colorUtils_1.createColorScale)(allNodes, colorBy, colorScheme);
|
|
75
|
-
}, [allNodes, colorBy, colorByDepth, colorScheme]);
|
|
76
|
-
const nodeStyleFn = (0, react_1.useMemo)(() => {
|
|
77
|
-
const DEPTH_PASTELS = ["#f0f0f0", "#b5d4ea", "#f4c2a1", "#b8dab2", "#d4b5e0", "#f9e0a2", "#a8d8d8"];
|
|
78
|
-
return (d) => {
|
|
79
|
-
const baseStyle = {
|
|
80
|
-
stroke: "currentColor",
|
|
81
|
-
strokeWidth: 1,
|
|
82
|
-
strokeOpacity: 0.3,
|
|
83
|
-
fillOpacity: circleOpacity
|
|
84
|
-
};
|
|
85
|
-
if (colorByDepth) {
|
|
86
|
-
baseStyle.fill = DEPTH_PASTELS[(d.depth || 0) % DEPTH_PASTELS.length];
|
|
87
|
-
}
|
|
88
|
-
else if (colorBy) {
|
|
89
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(d.data || d, colorBy, colorScale);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
baseStyle.fill = hooks_1.DEFAULT_COLOR;
|
|
93
|
-
}
|
|
94
|
-
return baseStyle;
|
|
95
|
-
};
|
|
96
|
-
}, [colorBy, colorByDepth, colorScale, circleOpacity]);
|
|
97
|
-
const hierarchySumFn = (0, react_1.useMemo)(() => {
|
|
98
|
-
if (typeof valueAccessor === "function")
|
|
99
|
-
return valueAccessor;
|
|
100
|
-
return (d) => d[valueAccessor] || 1;
|
|
101
|
-
}, [valueAccessor]);
|
|
102
|
-
// Validate
|
|
103
|
-
const error = (0, validateChartData_1.validateObjectData)({ componentName: "CirclePack", data });
|
|
104
|
-
if (error)
|
|
105
|
-
return React.createElement(ChartError_1.default, { componentName: "CirclePack", message: error, width: width, height: height });
|
|
106
|
-
return (React.createElement(StreamNetworkFrame_1.default, { chartType: "circlepack", data: data, size: [width, height], margin: margin, nodeIDAccessor: nodeIdAccessor, childrenAccessor: childrenAccessor, hierarchySum: hierarchySumFn, padding: paddingProp, nodeStyle: nodeStyleFn, colorBy: colorBy, colorScheme: colorScheme, colorByDepth: colorByDepth, nodeLabel: showLabels ? (nodeLabel || nodeIdAccessor) : undefined, showLabels: showLabels, enableHover: enableHover, tooltipContent: tooltip ? (d) => (0, Tooltip_1.normalizeTooltip)(tooltip)(d.data) : undefined, className: className, title: title, ...frameProps }));
|
|
107
|
-
}
|
|
108
|
-
CirclePack.displayName = "CirclePack";
|
|
@@ -1,121 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.ForceDirectedGraph = ForceDirectedGraph;
|
|
41
|
-
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
const StreamNetworkFrame_1 = __importDefault(require("../../stream/StreamNetworkFrame"));
|
|
44
|
-
const colorUtils_1 = require("../shared/colorUtils");
|
|
45
|
-
const legendUtils_1 = require("../shared/legendUtils");
|
|
46
|
-
const Tooltip_1 = require("../../Tooltip/Tooltip");
|
|
47
|
-
const hooks_1 = require("../shared/hooks");
|
|
48
|
-
const ChartError_1 = __importDefault(require("../shared/ChartError"));
|
|
49
|
-
const validateChartData_1 = require("../shared/validateChartData");
|
|
50
|
-
/**
|
|
51
|
-
* ForceDirectedGraph - Visualize network relationships with force-directed layout
|
|
52
|
-
*
|
|
53
|
-
* Wraps StreamNetworkFrame (canvas-first) for force-directed network visualization.
|
|
54
|
-
*/
|
|
55
|
-
function ForceDirectedGraph(props) {
|
|
56
|
-
const { nodes, edges, width = 600, height = 600, margin: userMargin, className, title, nodeIDAccessor = "id", sourceAccessor = "source", targetAccessor = "target", nodeLabel, colorBy, colorScheme = "category10", nodeSize = 8, nodeSizeRange = [5, 20], edgeWidth = 1, edgeColor = "#999", edgeOpacity = 0.6, iterations = 300, forceStrength = 0.1, showLabels = false, enableHover = true, showLegend, tooltip, frameProps = {} } = props;
|
|
57
|
-
const safeNodes = nodes || [];
|
|
58
|
-
const safeEdges = edges || [];
|
|
59
|
-
const colorScale = (0, hooks_1.useColorScale)(safeNodes, colorBy, colorScheme);
|
|
60
|
-
// Node style function — d is a RealtimeNode, user data on d.data
|
|
61
|
-
const nodeStyle = (0, react_1.useMemo)(() => {
|
|
62
|
-
return (d) => {
|
|
63
|
-
const baseStyle = {};
|
|
64
|
-
if (colorBy) {
|
|
65
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(d.data || d, colorBy, colorScale);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
baseStyle.fill = hooks_1.DEFAULT_COLOR;
|
|
69
|
-
}
|
|
70
|
-
if (typeof nodeSize === "number") {
|
|
71
|
-
baseStyle.r = nodeSize;
|
|
72
|
-
}
|
|
73
|
-
return baseStyle;
|
|
74
|
-
};
|
|
75
|
-
}, [colorBy, colorScale, nodeSize]);
|
|
76
|
-
// Edge style function
|
|
77
|
-
const edgeStyle = (0, react_1.useMemo)(() => {
|
|
78
|
-
return (d) => ({
|
|
79
|
-
stroke: edgeColor,
|
|
80
|
-
strokeWidth: typeof edgeWidth === "number" ? edgeWidth : typeof edgeWidth === "function" ? edgeWidth(d) : d[edgeWidth] || 1,
|
|
81
|
-
opacity: edgeOpacity
|
|
82
|
-
});
|
|
83
|
-
}, [edgeWidth, edgeColor, edgeOpacity]);
|
|
84
|
-
// Node label function
|
|
85
|
-
const nodeLabelFn = (0, react_1.useMemo)(() => {
|
|
86
|
-
if (!showLabels || !nodeLabel)
|
|
87
|
-
return undefined;
|
|
88
|
-
if (typeof nodeLabel === "function")
|
|
89
|
-
return nodeLabel;
|
|
90
|
-
return (d) => d[nodeLabel];
|
|
91
|
-
}, [showLabels, nodeLabel]);
|
|
92
|
-
// Legend
|
|
93
|
-
const shouldShowLegend = showLegend !== undefined ? showLegend : !!colorBy;
|
|
94
|
-
const legend = (0, react_1.useMemo)(() => {
|
|
95
|
-
if (!shouldShowLegend || !colorBy)
|
|
96
|
-
return undefined;
|
|
97
|
-
return (0, legendUtils_1.createLegend)({ data: safeNodes, colorBy, colorScale, getColor: colorUtils_1.getColor });
|
|
98
|
-
}, [shouldShowLegend, colorBy, safeNodes, colorScale]);
|
|
99
|
-
// Adjust margin for legend
|
|
100
|
-
const margin = (0, react_1.useMemo)(() => {
|
|
101
|
-
const defaultMargin = { top: 20, bottom: 20, left: 20, right: 20 };
|
|
102
|
-
const finalMargin = { ...defaultMargin, ...userMargin };
|
|
103
|
-
if (legend && finalMargin.right < 120) {
|
|
104
|
-
finalMargin.right = 120;
|
|
105
|
-
}
|
|
106
|
-
return finalMargin;
|
|
107
|
-
}, [userMargin, legend]);
|
|
108
|
-
// Validate
|
|
109
|
-
const error = (0, validateChartData_1.validateNetworkData)({
|
|
110
|
-
componentName: "ForceDirectedGraph",
|
|
111
|
-
nodes,
|
|
112
|
-
edges,
|
|
113
|
-
nodesRequired: true,
|
|
114
|
-
edgesRequired: true,
|
|
115
|
-
accessors: { nodeIDAccessor },
|
|
116
|
-
});
|
|
117
|
-
if (error)
|
|
118
|
-
return React.createElement(ChartError_1.default, { componentName: "ForceDirectedGraph", message: error, width: width, height: height });
|
|
119
|
-
return (React.createElement(StreamNetworkFrame_1.default, { chartType: "force", nodes: safeNodes, edges: safeEdges, size: [width, height], margin: margin, nodeIDAccessor: nodeIDAccessor, sourceAccessor: sourceAccessor, targetAccessor: targetAccessor, iterations: iterations, forceStrength: forceStrength, nodeStyle: nodeStyle, edgeStyle: edgeStyle, colorBy: colorBy, colorScheme: colorScheme, nodeSize: nodeSize, nodeSizeRange: nodeSizeRange, nodeLabel: nodeLabelFn, showLabels: showLabels, enableHover: enableHover, tooltipContent: tooltip ? (d) => (0, Tooltip_1.normalizeTooltip)(tooltip)(d.data) : undefined, legend: legend, className: className, title: title, ...frameProps }));
|
|
120
|
-
}
|
|
121
|
-
ForceDirectedGraph.displayName = "ForceDirectedGraph";
|
|
@@ -1,155 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.SankeyDiagram = SankeyDiagram;
|
|
41
|
-
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
const StreamNetworkFrame_1 = __importDefault(require("../../stream/StreamNetworkFrame"));
|
|
44
|
-
const colorUtils_1 = require("../shared/colorUtils");
|
|
45
|
-
const hooks_1 = require("../shared/hooks");
|
|
46
|
-
const ChartError_1 = __importDefault(require("../shared/ChartError"));
|
|
47
|
-
const validateChartData_1 = require("../shared/validateChartData");
|
|
48
|
-
/**
|
|
49
|
-
* SankeyDiagram - Visualize flow and magnitude of movement between nodes
|
|
50
|
-
*
|
|
51
|
-
* Wraps StreamNetworkFrame (canvas-first) for Sankey flow visualization.
|
|
52
|
-
*/
|
|
53
|
-
function SankeyDiagram(props) {
|
|
54
|
-
const { nodes, edges, width = 800, height = 600, margin = { top: 50, bottom: 50, left: 50, right: 50 }, className, title, sourceAccessor = "source", targetAccessor = "target", valueAccessor = "value", nodeIdAccessor = "id", colorBy, colorScheme = "category10", edgeColorBy = "source", orientation = "horizontal", nodeAlign = "justify", nodePaddingRatio = 0.05, nodeWidth = 15, nodeLabel, showLabels = true, enableHover = true, edgeOpacity = 0.5, edgeSort, tooltip, frameProps = {} } = props;
|
|
55
|
-
// Safe data defaults (hooks must always run)
|
|
56
|
-
const safeEdges = edges || [];
|
|
57
|
-
// Infer nodes from edges if not provided
|
|
58
|
-
const inferredNodes = (0, react_1.useMemo)(() => {
|
|
59
|
-
if (nodes && nodes.length > 0)
|
|
60
|
-
return nodes;
|
|
61
|
-
const nodeSet = new Set();
|
|
62
|
-
safeEdges.forEach((edge) => {
|
|
63
|
-
const sourceId = typeof sourceAccessor === "function"
|
|
64
|
-
? sourceAccessor(edge)
|
|
65
|
-
: edge[sourceAccessor];
|
|
66
|
-
const targetId = typeof targetAccessor === "function"
|
|
67
|
-
? targetAccessor(edge)
|
|
68
|
-
: edge[targetAccessor];
|
|
69
|
-
nodeSet.add(sourceId);
|
|
70
|
-
nodeSet.add(targetId);
|
|
71
|
-
});
|
|
72
|
-
return Array.from(nodeSet).map((id) => ({ id }));
|
|
73
|
-
}, [nodes, safeEdges, sourceAccessor, targetAccessor]);
|
|
74
|
-
// Create color scale if colorBy is specified
|
|
75
|
-
const colorScale = (0, hooks_1.useColorScale)(inferredNodes, colorBy, colorScheme);
|
|
76
|
-
// Node style function
|
|
77
|
-
// d is a RealtimeNode — user data lives on d.data
|
|
78
|
-
const nodeStyle = (0, react_1.useMemo)(() => {
|
|
79
|
-
return (d) => {
|
|
80
|
-
const baseStyle = {
|
|
81
|
-
stroke: "black",
|
|
82
|
-
strokeWidth: 1
|
|
83
|
-
};
|
|
84
|
-
if (colorBy) {
|
|
85
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(d.data || d, colorBy, colorScale);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
baseStyle.fill = "#4d430c";
|
|
89
|
-
}
|
|
90
|
-
return baseStyle;
|
|
91
|
-
};
|
|
92
|
-
}, [colorBy, colorScale]);
|
|
93
|
-
// Edge style function
|
|
94
|
-
// d is a RealtimeEdge — d.source/d.target are RealtimeNode objects
|
|
95
|
-
const edgeStyle = (0, react_1.useMemo)(() => {
|
|
96
|
-
return (d) => {
|
|
97
|
-
const baseStyle = {
|
|
98
|
-
stroke: "none",
|
|
99
|
-
strokeWidth: 0,
|
|
100
|
-
fillOpacity: edgeOpacity
|
|
101
|
-
};
|
|
102
|
-
if (typeof edgeColorBy === "function") {
|
|
103
|
-
baseStyle.fill = edgeColorBy(d);
|
|
104
|
-
}
|
|
105
|
-
else if (edgeColorBy === "source") {
|
|
106
|
-
const src = typeof d.source === "object" ? d.source : null;
|
|
107
|
-
if (colorBy && src) {
|
|
108
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(src.data || src, colorBy, colorScale);
|
|
109
|
-
}
|
|
110
|
-
else if (src) {
|
|
111
|
-
baseStyle.fill = nodeStyle(src).fill;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (edgeColorBy === "target") {
|
|
115
|
-
const tgt = typeof d.target === "object" ? d.target : null;
|
|
116
|
-
if (colorBy && tgt) {
|
|
117
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(tgt.data || tgt, colorBy, colorScale);
|
|
118
|
-
}
|
|
119
|
-
else if (tgt) {
|
|
120
|
-
baseStyle.fill = nodeStyle(tgt).fill;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else if (edgeColorBy === "gradient") {
|
|
124
|
-
baseStyle.fill = "#999";
|
|
125
|
-
baseStyle.fillOpacity = edgeOpacity * 0.7;
|
|
126
|
-
}
|
|
127
|
-
return baseStyle;
|
|
128
|
-
};
|
|
129
|
-
}, [edgeColorBy, colorBy, colorScale, nodeStyle, edgeOpacity]);
|
|
130
|
-
// Node label accessor
|
|
131
|
-
const nodeLabelFn = (0, react_1.useMemo)(() => {
|
|
132
|
-
if (!showLabels)
|
|
133
|
-
return undefined;
|
|
134
|
-
const accessor = nodeLabel || nodeIdAccessor;
|
|
135
|
-
if (typeof accessor === "function")
|
|
136
|
-
return accessor;
|
|
137
|
-
return (d) => d[accessor];
|
|
138
|
-
}, [showLabels, nodeLabel, nodeIdAccessor]);
|
|
139
|
-
// Tooltip
|
|
140
|
-
const tooltipFn = (0, react_1.useMemo)(() => {
|
|
141
|
-
if (typeof tooltip === "function")
|
|
142
|
-
return tooltip;
|
|
143
|
-
return undefined;
|
|
144
|
-
}, [tooltip]);
|
|
145
|
-
// Validate data (after all hooks)
|
|
146
|
-
const error = (0, validateChartData_1.validateNetworkData)({
|
|
147
|
-
componentName: "SankeyDiagram",
|
|
148
|
-
edges,
|
|
149
|
-
edgesRequired: true,
|
|
150
|
-
});
|
|
151
|
-
if (error)
|
|
152
|
-
return React.createElement(ChartError_1.default, { componentName: "SankeyDiagram", message: error, width: width, height: height });
|
|
153
|
-
return (React.createElement(StreamNetworkFrame_1.default, { chartType: "sankey", nodes: inferredNodes, edges: safeEdges, size: [width, height], margin: margin, nodeIDAccessor: nodeIdAccessor, sourceAccessor: sourceAccessor, targetAccessor: targetAccessor, valueAccessor: valueAccessor, orientation: orientation, nodeAlign: nodeAlign, nodePaddingRatio: nodePaddingRatio, nodeWidth: nodeWidth, nodeStyle: nodeStyle, edgeStyle: edgeStyle, colorBy: colorBy, colorScheme: colorScheme, edgeColorBy: edgeColorBy, edgeOpacity: edgeOpacity, edgeSort: edgeSort, nodeLabel: nodeLabelFn, showLabels: showLabels, enableHover: enableHover, tooltipContent: tooltipFn ? (d) => tooltipFn(d.data) : undefined, className: className, title: title, ...frameProps }));
|
|
154
|
-
}
|
|
155
|
-
SankeyDiagram.displayName = "SankeyDiagram";
|
|
@@ -1,110 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.TreeDiagram = TreeDiagram;
|
|
41
|
-
const React = __importStar(require("react"));
|
|
42
|
-
const react_1 = require("react");
|
|
43
|
-
const StreamNetworkFrame_1 = __importDefault(require("../../stream/StreamNetworkFrame"));
|
|
44
|
-
const colorUtils_1 = require("../shared/colorUtils");
|
|
45
|
-
const Tooltip_1 = require("../../Tooltip/Tooltip");
|
|
46
|
-
const hooks_1 = require("../shared/hooks");
|
|
47
|
-
const ChartError_1 = __importDefault(require("../shared/ChartError"));
|
|
48
|
-
const validateChartData_1 = require("../shared/validateChartData");
|
|
49
|
-
/**
|
|
50
|
-
* TreeDiagram - Visualize hierarchical data structures
|
|
51
|
-
*
|
|
52
|
-
* Wraps StreamNetworkFrame (canvas-first) for hierarchical tree visualization.
|
|
53
|
-
*/
|
|
54
|
-
function TreeDiagram(props) {
|
|
55
|
-
const { data, width = 600, height = 600, margin = { top: 50, bottom: 50, left: 50, right: 50 }, className, title, layout = "tree", orientation = "vertical", childrenAccessor = "children", valueAccessor = "value", nodeIdAccessor = "name", colorBy, colorScheme = "category10", colorByDepth = false, edgeStyle = "curve", nodeLabel, showLabels = true, nodeSize = 5, enableHover = true, tooltip, frameProps = {} } = props;
|
|
56
|
-
// Node style function
|
|
57
|
-
const allNodes = (0, react_1.useMemo)(() => {
|
|
58
|
-
if (!data)
|
|
59
|
-
return [];
|
|
60
|
-
const nodes = [];
|
|
61
|
-
const traverse = (node) => {
|
|
62
|
-
nodes.push(node);
|
|
63
|
-
const children = typeof childrenAccessor === "function" ? childrenAccessor(node) : node[childrenAccessor];
|
|
64
|
-
if (children && Array.isArray(children))
|
|
65
|
-
children.forEach(traverse);
|
|
66
|
-
};
|
|
67
|
-
traverse(data);
|
|
68
|
-
return nodes;
|
|
69
|
-
}, [data, childrenAccessor]);
|
|
70
|
-
const colorScale = (0, react_1.useMemo)(() => {
|
|
71
|
-
if (colorByDepth)
|
|
72
|
-
return (0, colorUtils_1.createColorScale)(allNodes.map((_, idx) => ({ depth: idx % 5 })), "depth", colorScheme);
|
|
73
|
-
if (!colorBy || typeof colorBy === "function")
|
|
74
|
-
return undefined;
|
|
75
|
-
return (0, colorUtils_1.createColorScale)(allNodes, colorBy, colorScheme);
|
|
76
|
-
}, [allNodes, colorBy, colorByDepth, colorScheme]);
|
|
77
|
-
// d is a RealtimeNode — user data on d.data, depth on d.depth
|
|
78
|
-
const nodeStyleFn = (0, react_1.useMemo)(() => {
|
|
79
|
-
return (d) => {
|
|
80
|
-
const baseStyle = { stroke: "black", strokeWidth: 1 };
|
|
81
|
-
if (colorByDepth) {
|
|
82
|
-
baseStyle.fill = (0, colorUtils_1.getColor)({ depth: d.depth || 0 }, "depth", colorScale);
|
|
83
|
-
}
|
|
84
|
-
else if (colorBy) {
|
|
85
|
-
baseStyle.fill = (0, colorUtils_1.getColor)(d.data || d, colorBy, colorScale);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
baseStyle.fill = hooks_1.DEFAULT_COLOR;
|
|
89
|
-
}
|
|
90
|
-
return baseStyle;
|
|
91
|
-
};
|
|
92
|
-
}, [colorBy, colorByDepth, colorScale]);
|
|
93
|
-
const edgeStyleFn = (0, react_1.useMemo)(() => {
|
|
94
|
-
return () => ({ stroke: "#999", strokeWidth: 1, fill: "none" });
|
|
95
|
-
}, []);
|
|
96
|
-
const hierarchySumFn = (0, react_1.useMemo)(() => {
|
|
97
|
-
if (layout === "treemap" || layout === "circlepack" || layout === "partition") {
|
|
98
|
-
if (typeof valueAccessor === "function")
|
|
99
|
-
return valueAccessor;
|
|
100
|
-
return (d) => d[valueAccessor] || 1;
|
|
101
|
-
}
|
|
102
|
-
return undefined;
|
|
103
|
-
}, [layout, valueAccessor]);
|
|
104
|
-
// Validate
|
|
105
|
-
const error = (0, validateChartData_1.validateObjectData)({ componentName: "TreeDiagram", data });
|
|
106
|
-
if (error)
|
|
107
|
-
return React.createElement(ChartError_1.default, { componentName: "TreeDiagram", message: error, width: width, height: height });
|
|
108
|
-
return (React.createElement(StreamNetworkFrame_1.default, { chartType: layout, data: data, size: [width, height], margin: margin, nodeIDAccessor: nodeIdAccessor, childrenAccessor: childrenAccessor, hierarchySum: hierarchySumFn, treeOrientation: orientation, edgeType: edgeStyle, nodeStyle: nodeStyleFn, edgeStyle: edgeStyleFn, colorBy: colorBy, colorScheme: colorScheme, colorByDepth: colorByDepth, nodeSize: nodeSize, nodeLabel: showLabels ? (nodeLabel || nodeIdAccessor) : undefined, showLabels: showLabels, enableHover: enableHover, tooltipContent: tooltip ? (d) => (0, Tooltip_1.normalizeTooltip)(tooltip)(d.data) : undefined, className: className, title: title, ...frameProps }));
|
|
109
|
-
}
|
|
110
|
-
TreeDiagram.displayName = "TreeDiagram";
|