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,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.default = Legend;
|
|
37
|
-
const React = __importStar(require("react"));
|
|
38
|
-
const typeHash = {
|
|
39
|
-
fill: (style) => React.createElement("rect", { style: style, width: 20, height: 20 }),
|
|
40
|
-
line: (style) => React.createElement("line", { style: style, x1: 0, y1: 0, x2: 20, y2: 20 })
|
|
41
|
-
};
|
|
42
|
-
function renderType(item, i, type, styleFn) {
|
|
43
|
-
let renderedType;
|
|
44
|
-
if (typeof type === "function") {
|
|
45
|
-
renderedType = type(item);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const Type = typeHash[type];
|
|
49
|
-
const style = styleFn(item, i);
|
|
50
|
-
renderedType = Type(style);
|
|
51
|
-
}
|
|
52
|
-
return renderedType;
|
|
53
|
-
}
|
|
54
|
-
const renderLegendGroupVertical = (legendGroup, customClickBehavior) => {
|
|
55
|
-
const { type = "fill", styleFn, items } = legendGroup;
|
|
56
|
-
const renderedItems = [];
|
|
57
|
-
let itemOffset = 0;
|
|
58
|
-
items.forEach((item, i) => {
|
|
59
|
-
const renderedType = renderType(item, i, type, styleFn);
|
|
60
|
-
renderedItems.push(React.createElement("g", { key: `legend-item-${i}`, transform: `translate(0,${itemOffset})`, onClick: customClickBehavior ? () => customClickBehavior(item) : undefined, style: {
|
|
61
|
-
cursor: customClickBehavior ? "pointer" : "default"
|
|
62
|
-
} },
|
|
63
|
-
renderedType,
|
|
64
|
-
React.createElement("text", { y: 15, x: 30 }, item.label)));
|
|
65
|
-
itemOffset += 25;
|
|
66
|
-
});
|
|
67
|
-
return renderedItems;
|
|
68
|
-
};
|
|
69
|
-
const renderLegendGroupHorizontal = (legendGroup, customClickBehavior) => {
|
|
70
|
-
const { type = "fill", styleFn, items } = legendGroup;
|
|
71
|
-
const renderedItems = [];
|
|
72
|
-
let itemOffset = 0;
|
|
73
|
-
items.forEach((item, i) => {
|
|
74
|
-
const renderedType = renderType(item, i, type, styleFn);
|
|
75
|
-
renderedItems.push(React.createElement("g", { key: `legend-item-${i}`, transform: `translate(${itemOffset},0)`, onClick: customClickBehavior ? () => customClickBehavior(item) : undefined, style: {
|
|
76
|
-
cursor: customClickBehavior ? "pointer" : "default"
|
|
77
|
-
} },
|
|
78
|
-
renderedType,
|
|
79
|
-
React.createElement("text", { y: 15, x: 25 }, item.label)));
|
|
80
|
-
itemOffset += 35;
|
|
81
|
-
itemOffset += item.label.length * 8;
|
|
82
|
-
});
|
|
83
|
-
return { items: renderedItems, offset: itemOffset };
|
|
84
|
-
};
|
|
85
|
-
const renderVerticalGroup = ({ legendGroups, width, customClickBehavior }) => {
|
|
86
|
-
let offset = 30;
|
|
87
|
-
const renderedGroups = [];
|
|
88
|
-
legendGroups.forEach((l, i) => {
|
|
89
|
-
offset += 5;
|
|
90
|
-
renderedGroups.push(React.createElement("line", { key: `legend-top-line legend-symbol-${i}`, stroke: "gray", x1: 0, y1: offset, x2: width, y2: offset }));
|
|
91
|
-
offset += 10;
|
|
92
|
-
if (l.label) {
|
|
93
|
-
offset += 20;
|
|
94
|
-
renderedGroups.push(React.createElement("text", { key: `legend-text-${i}`, y: offset, className: "legend-group-label" }, l.label));
|
|
95
|
-
offset += 10;
|
|
96
|
-
}
|
|
97
|
-
renderedGroups.push(React.createElement("g", { key: `legend-group-${i}`, className: "legend-item", transform: `translate(0,${offset})` }, renderLegendGroupVertical(l, customClickBehavior)));
|
|
98
|
-
offset += l.items.length * 25 + 10;
|
|
99
|
-
});
|
|
100
|
-
return renderedGroups;
|
|
101
|
-
};
|
|
102
|
-
const renderHorizontalGroup = ({ legendGroups, title, height, customClickBehavior }) => {
|
|
103
|
-
let offset = 0;
|
|
104
|
-
const renderedGroups = [];
|
|
105
|
-
const verticalOffset = title === false ? 10 : 40;
|
|
106
|
-
legendGroups.forEach((l, i) => {
|
|
107
|
-
if (l.label) {
|
|
108
|
-
renderedGroups.push(React.createElement("text", { key: `legend-text-${i}`, transform: `translate(${offset},${verticalOffset}) rotate(90)`, textAnchor: "start", className: "legend-group-label" }, l.label));
|
|
109
|
-
offset += 20;
|
|
110
|
-
}
|
|
111
|
-
const renderedItems = renderLegendGroupHorizontal(l, customClickBehavior);
|
|
112
|
-
renderedGroups.push(React.createElement("g", { key: `legend-group-${i}`, className: "legend-item", transform: `translate(${offset},${verticalOffset})` }, renderedItems.items));
|
|
113
|
-
offset += renderedItems.offset + 5;
|
|
114
|
-
if (legendGroups[i + 1]) {
|
|
115
|
-
renderedGroups.push(React.createElement("line", { key: `legend-top-line legend-symbol-${i}`, stroke: "gray", x1: offset, y1: verticalOffset - 10, x2: offset, y2: height + verticalOffset + 10 }));
|
|
116
|
-
}
|
|
117
|
-
offset += 15;
|
|
118
|
-
});
|
|
119
|
-
return (React.createElement("g", null,
|
|
120
|
-
title !== false && (React.createElement("line", { x1: 0, x2: offset + 10, y1: verticalOffset - 10, y2: verticalOffset - 10, stroke: "gray", className: "title-neatline" })),
|
|
121
|
-
renderedGroups));
|
|
122
|
-
};
|
|
123
|
-
function Legend(props) {
|
|
124
|
-
const { legendGroups, customClickBehavior, title = "Legend", width = 100, height = 20, orientation = "vertical" } = props;
|
|
125
|
-
const renderedGroups = orientation === "vertical"
|
|
126
|
-
? renderVerticalGroup({
|
|
127
|
-
legendGroups,
|
|
128
|
-
width,
|
|
129
|
-
customClickBehavior
|
|
130
|
-
})
|
|
131
|
-
: renderHorizontalGroup({
|
|
132
|
-
legendGroups,
|
|
133
|
-
title,
|
|
134
|
-
height,
|
|
135
|
-
customClickBehavior
|
|
136
|
-
});
|
|
137
|
-
return (React.createElement("g", null,
|
|
138
|
-
title !== undefined && (React.createElement("text", { className: "legend-title", y: 20, x: orientation === "horizontal" ? 0 : width / 2, textAnchor: orientation === "horizontal" ? "start" : "middle" }, title)),
|
|
139
|
-
renderedGroups));
|
|
140
|
-
}
|
|
@@ -1,95 +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
|
-
exports.useFilteredData = exports.useBrushSelection = exports.useLinkedHover = exports.useSelection = void 0;
|
|
38
|
-
exports.LinkedCharts = LinkedCharts;
|
|
39
|
-
const React = __importStar(require("react"));
|
|
40
|
-
const react_1 = require("react");
|
|
41
|
-
const SelectionStore_1 = require("./store/SelectionStore");
|
|
42
|
-
// Re-export hooks for convenience
|
|
43
|
-
var useSelection_1 = require("./store/useSelection");
|
|
44
|
-
Object.defineProperty(exports, "useSelection", { enumerable: true, get: function () { return useSelection_1.useSelection; } });
|
|
45
|
-
Object.defineProperty(exports, "useLinkedHover", { enumerable: true, get: function () { return useSelection_1.useLinkedHover; } });
|
|
46
|
-
Object.defineProperty(exports, "useBrushSelection", { enumerable: true, get: function () { return useSelection_1.useBrushSelection; } });
|
|
47
|
-
Object.defineProperty(exports, "useFilteredData", { enumerable: true, get: function () { return useSelection_1.useFilteredData; } });
|
|
48
|
-
// ── Resolution initializer ─────────────────────────────────────────────────
|
|
49
|
-
function ResolutionInit({ selections }) {
|
|
50
|
-
const setResolution = (0, SelectionStore_1.useSelectionSelector)((state) => state.setResolution);
|
|
51
|
-
(0, react_1.useEffect)(() => {
|
|
52
|
-
for (const [name, config] of Object.entries(selections)) {
|
|
53
|
-
if (config.resolution) {
|
|
54
|
-
setResolution(name, config.resolution);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}, []); // Run once on mount
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
// ── LinkedCharts component ─────────────────────────────────────────────────
|
|
61
|
-
/**
|
|
62
|
-
* LinkedCharts — context provider for coordinated chart views.
|
|
63
|
-
*
|
|
64
|
-
* Wraps any number of chart components (at any depth) and enables
|
|
65
|
-
* cross-highlighting, brushing-and-linking, and cross-filtering via
|
|
66
|
-
* the `selection`, `linkedHover`, and `linkedBrush` props on each chart.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* <LinkedCharts>
|
|
71
|
-
* <Scatterplot data={d} xAccessor="x" yAccessor="y" colorBy="cat"
|
|
72
|
-
* linkedHover={{ name: "hl", fields: ["cat"] }}
|
|
73
|
-
* selection={{ name: "hl" }} />
|
|
74
|
-
* <BarChart data={agg} categoryAccessor="cat" valueAccessor="total"
|
|
75
|
-
* selection={{ name: "hl" }} />
|
|
76
|
-
* </LinkedCharts>
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```tsx
|
|
81
|
-
* // Cross-filtering (each chart's own brush is excluded from its filter)
|
|
82
|
-
* <LinkedCharts selections={{ dash: { resolution: "crossfilter" } }}>
|
|
83
|
-
* <Scatterplot data={d} xAccessor="age" yAccessor="income"
|
|
84
|
-
* linkedBrush={{ name: "dash", xField: "age", yField: "income" }}
|
|
85
|
-
* selection={{ name: "dash" }} />
|
|
86
|
-
* <BarChart data={d} categoryAccessor="region" valueAccessor="count"
|
|
87
|
-
* selection={{ name: "dash" }} />
|
|
88
|
-
* </LinkedCharts>
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
function LinkedCharts({ children, selections }) {
|
|
92
|
-
return (React.createElement(SelectionStore_1.SelectionProvider, null,
|
|
93
|
-
selections && React.createElement(ResolutionInit, { selections: selections }),
|
|
94
|
-
children));
|
|
95
|
-
}
|
|
@@ -1,79 +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
|
-
exports.DARK_THEME = exports.LIGHT_THEME = void 0;
|
|
38
|
-
exports.ThemeProvider = ThemeProviderWrapper;
|
|
39
|
-
exports.useTheme = useTheme;
|
|
40
|
-
const React = __importStar(require("react"));
|
|
41
|
-
const ThemeStore_1 = require("./store/ThemeStore");
|
|
42
|
-
Object.defineProperty(exports, "LIGHT_THEME", { enumerable: true, get: function () { return ThemeStore_1.LIGHT_THEME; } });
|
|
43
|
-
Object.defineProperty(exports, "DARK_THEME", { enumerable: true, get: function () { return ThemeStore_1.DARK_THEME; } });
|
|
44
|
-
// ── ThemeInitializer ────────────────────────────────────────────────────────
|
|
45
|
-
// Calls setTheme on mount to sync the store with the prop value.
|
|
46
|
-
function ThemeInitializer({ theme }) {
|
|
47
|
-
const setTheme = (0, ThemeStore_1.useThemeSelector)((state) => state.setTheme);
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
if (theme !== undefined) {
|
|
50
|
-
setTheme(theme);
|
|
51
|
-
}
|
|
52
|
-
}, [theme, setTheme]);
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
// ── CSS Custom Properties wrapper ───────────────────────────────────────────
|
|
56
|
-
function ThemeCSSWrapper({ children }) {
|
|
57
|
-
const theme = (0, ThemeStore_1.useThemeSelector)((state) => state.theme);
|
|
58
|
-
const style = {
|
|
59
|
-
position: "relative",
|
|
60
|
-
"--semiotic-bg": theme.colors.background,
|
|
61
|
-
"--semiotic-text": theme.colors.text,
|
|
62
|
-
"--semiotic-text-secondary": theme.colors.textSecondary,
|
|
63
|
-
"--semiotic-grid": theme.colors.grid,
|
|
64
|
-
"--semiotic-border": theme.colors.border,
|
|
65
|
-
"--semiotic-primary": theme.colors.primary,
|
|
66
|
-
"--semiotic-font-family": theme.typography.fontFamily
|
|
67
|
-
};
|
|
68
|
-
return React.createElement("div", { style: style }, children);
|
|
69
|
-
}
|
|
70
|
-
// ── ThemeProvider (public) ──────────────────────────────────────────────────
|
|
71
|
-
function ThemeProviderWrapper({ theme, children }) {
|
|
72
|
-
return (React.createElement(ThemeStore_1.ThemeProvider, null,
|
|
73
|
-
React.createElement(ThemeInitializer, { theme: theme }),
|
|
74
|
-
React.createElement(ThemeCSSWrapper, null, children)));
|
|
75
|
-
}
|
|
76
|
-
// ── useTheme hook ───────────────────────────────────────────────────────────
|
|
77
|
-
function useTheme() {
|
|
78
|
-
return (0, ThemeStore_1.useThemeSelector)((state) => state.theme);
|
|
79
|
-
}
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.defaultTooltipStyle = void 0;
|
|
37
|
-
exports.Tooltip = Tooltip;
|
|
38
|
-
exports.MultiLineTooltip = MultiLineTooltip;
|
|
39
|
-
exports.normalizeTooltip = normalizeTooltip;
|
|
40
|
-
const React = __importStar(require("react"));
|
|
41
|
-
/**
|
|
42
|
-
* Default tooltip styles following best practices
|
|
43
|
-
*/
|
|
44
|
-
exports.defaultTooltipStyle = {
|
|
45
|
-
background: "rgba(0, 0, 0, 0.85)",
|
|
46
|
-
color: "white",
|
|
47
|
-
padding: "8px 12px",
|
|
48
|
-
borderRadius: "4px",
|
|
49
|
-
fontSize: "14px",
|
|
50
|
-
lineHeight: "1.5",
|
|
51
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
52
|
-
pointerEvents: "none",
|
|
53
|
-
maxWidth: "300px",
|
|
54
|
-
wordWrap: "break-word"
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Extract value from data using accessor
|
|
58
|
-
*/
|
|
59
|
-
function getValue(data, accessor) {
|
|
60
|
-
if (typeof accessor === "function") {
|
|
61
|
-
return accessor(data);
|
|
62
|
-
}
|
|
63
|
-
return data[accessor];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Format a value for display
|
|
67
|
-
*/
|
|
68
|
-
function formatValue(value, format) {
|
|
69
|
-
if (format) {
|
|
70
|
-
return format(value);
|
|
71
|
-
}
|
|
72
|
-
if (value === null || value === undefined) {
|
|
73
|
-
return "";
|
|
74
|
-
}
|
|
75
|
-
// Format numbers with commas
|
|
76
|
-
if (typeof value === "number") {
|
|
77
|
-
return value.toLocaleString();
|
|
78
|
-
}
|
|
79
|
-
// Format dates
|
|
80
|
-
if (value instanceof Date) {
|
|
81
|
-
return value.toLocaleDateString();
|
|
82
|
-
}
|
|
83
|
-
// Handle objects (e.g. resolved network nodes with an id property)
|
|
84
|
-
if (typeof value === "object" && value !== null) {
|
|
85
|
-
const obj = value;
|
|
86
|
-
if (obj.id !== undefined)
|
|
87
|
-
return String(obj.id);
|
|
88
|
-
if (obj.name !== undefined)
|
|
89
|
-
return String(obj.name);
|
|
90
|
-
return JSON.stringify(value);
|
|
91
|
-
}
|
|
92
|
-
return String(value);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Create a simple tooltip that displays a single value or title
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```tsx
|
|
99
|
-
* <Scatterplot
|
|
100
|
-
* data={data}
|
|
101
|
-
* tooltip={Tooltip({ title: "name" })}
|
|
102
|
-
* />
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* <BarChart
|
|
108
|
-
* data={data}
|
|
109
|
-
* tooltip={Tooltip({
|
|
110
|
-
* title: d => `${d.category}: ${d.value}`,
|
|
111
|
-
* style: { background: "#333" }
|
|
112
|
-
* })}
|
|
113
|
-
* />
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
function Tooltip(config = {}) {
|
|
117
|
-
const { fields, title, format, style = {}, className = "" } = config;
|
|
118
|
-
// Return a tooltipContent function that Semiotic expects
|
|
119
|
-
return (data) => {
|
|
120
|
-
// Guard against undefined/null data
|
|
121
|
-
if (!data || typeof data !== "object") {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
let titleContent;
|
|
125
|
-
const fieldLines = [];
|
|
126
|
-
if (title) {
|
|
127
|
-
const titleValue = getValue(data, title);
|
|
128
|
-
titleContent = formatValue(titleValue, format);
|
|
129
|
-
}
|
|
130
|
-
if (fields && fields.length > 0) {
|
|
131
|
-
fields.forEach((field) => {
|
|
132
|
-
let label;
|
|
133
|
-
let accessor;
|
|
134
|
-
let fieldFormat;
|
|
135
|
-
if (typeof field === "string") {
|
|
136
|
-
label = field;
|
|
137
|
-
accessor = field;
|
|
138
|
-
fieldFormat = format;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
label = field.label;
|
|
142
|
-
accessor = field.accessor || field.key || "";
|
|
143
|
-
fieldFormat = field.format || format;
|
|
144
|
-
}
|
|
145
|
-
const value = getValue(data, accessor);
|
|
146
|
-
fieldLines.push({
|
|
147
|
-
label,
|
|
148
|
-
value: formatValue(value, fieldFormat)
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
else if (!title) {
|
|
153
|
-
// Default: try common field names (only when no title or fields specified)
|
|
154
|
-
const commonFields = ["value", "y", "name", "id", "label"];
|
|
155
|
-
for (const field of commonFields) {
|
|
156
|
-
if (data[field] !== undefined) {
|
|
157
|
-
titleContent = formatValue(data[field], format);
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
// If still nothing, show first non-internal property
|
|
162
|
-
if (!titleContent) {
|
|
163
|
-
const keys = Object.keys(data).filter(k => !k.startsWith("_"));
|
|
164
|
-
if (keys.length > 0) {
|
|
165
|
-
titleContent = formatValue(data[keys[0]], format);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const mergedStyle = { ...exports.defaultTooltipStyle, ...style };
|
|
170
|
-
return (React.createElement("div", { className: `semiotic-tooltip ${className}`.trim(), style: mergedStyle },
|
|
171
|
-
titleContent && React.createElement("div", { style: { fontWeight: fieldLines.length > 0 ? "bold" : "normal" } }, titleContent),
|
|
172
|
-
fieldLines.map((line, index) => (React.createElement("div", { key: index, style: { marginTop: index === 0 && titleContent ? "4px" : 0 } },
|
|
173
|
-
line.label && React.createElement("span", null,
|
|
174
|
-
line.label,
|
|
175
|
-
": "),
|
|
176
|
-
line.value)))));
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Create a multi-line tooltip that displays multiple fields
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```tsx
|
|
184
|
-
* <Scatterplot
|
|
185
|
-
* data={data}
|
|
186
|
-
* tooltip={MultiLineTooltip({
|
|
187
|
-
* fields: ["name", "value", "category"]
|
|
188
|
-
* })}
|
|
189
|
-
* />
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* ```tsx
|
|
194
|
-
* <LineChart
|
|
195
|
-
* data={data}
|
|
196
|
-
* tooltip={MultiLineTooltip({
|
|
197
|
-
* title: "series",
|
|
198
|
-
* fields: [
|
|
199
|
-
* { label: "X", accessor: "x", format: v => v.toFixed(2) },
|
|
200
|
-
* { label: "Y", accessor: "y", format: v => v.toFixed(2) },
|
|
201
|
-
* { label: "Category", accessor: "category" }
|
|
202
|
-
* ]
|
|
203
|
-
* })}
|
|
204
|
-
* />
|
|
205
|
-
* ```
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* ```tsx
|
|
209
|
-
* <BarChart
|
|
210
|
-
* data={data}
|
|
211
|
-
* tooltip={MultiLineTooltip({
|
|
212
|
-
* fields: [
|
|
213
|
-
* { label: "Category", accessor: "category" },
|
|
214
|
-
* { label: "Sales", accessor: "value", format: v => `$${v.toLocaleString()}` }
|
|
215
|
-
* ],
|
|
216
|
-
* showLabels: true
|
|
217
|
-
* })}
|
|
218
|
-
* />
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
function MultiLineTooltip(config = {}) {
|
|
222
|
-
const { fields = [], title, format, style = {}, className = "", showLabels = true, separator = ": " } = config;
|
|
223
|
-
// Return a tooltipContent function that Semiotic expects
|
|
224
|
-
return (data) => {
|
|
225
|
-
// Guard against undefined/null data
|
|
226
|
-
if (!data || typeof data !== "object") {
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
const lines = [];
|
|
230
|
-
// Add title line if specified
|
|
231
|
-
if (title) {
|
|
232
|
-
const titleValue = getValue(data, title);
|
|
233
|
-
lines.push({
|
|
234
|
-
value: formatValue(titleValue, format)
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
// Add field lines
|
|
238
|
-
if (fields && Array.isArray(fields) && fields.length > 0) {
|
|
239
|
-
fields.forEach((field) => {
|
|
240
|
-
let label;
|
|
241
|
-
let accessor;
|
|
242
|
-
let fieldFormat;
|
|
243
|
-
if (typeof field === "string") {
|
|
244
|
-
// Simple string field name
|
|
245
|
-
label = field;
|
|
246
|
-
accessor = field;
|
|
247
|
-
fieldFormat = format;
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
// Full TooltipField object
|
|
251
|
-
// Support both 'key' and 'accessor' for backward compatibility
|
|
252
|
-
label = field.label;
|
|
253
|
-
accessor = field.accessor || field.key || "";
|
|
254
|
-
fieldFormat = field.format || format;
|
|
255
|
-
}
|
|
256
|
-
const value = getValue(data, accessor);
|
|
257
|
-
const formattedValue = formatValue(value, fieldFormat);
|
|
258
|
-
lines.push({
|
|
259
|
-
label: showLabels ? label : undefined,
|
|
260
|
-
value: formattedValue
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
// Default: show all non-internal properties
|
|
266
|
-
const keys = Object.keys(data).filter((k) => !k.startsWith("_") && k !== "data");
|
|
267
|
-
keys.forEach((key) => {
|
|
268
|
-
lines.push({
|
|
269
|
-
label: showLabels ? key : undefined,
|
|
270
|
-
value: formatValue(data[key], format)
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
const mergedStyle = { ...exports.defaultTooltipStyle, ...style };
|
|
275
|
-
// Safety check: ensure lines is an array
|
|
276
|
-
if (!Array.isArray(lines) || lines.length === 0) {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
return (React.createElement("div", { className: `semiotic-tooltip semiotic-tooltip-multiline ${className}`.trim(), style: mergedStyle }, lines.map((line, index) => (React.createElement("div", { key: index, style: { marginBottom: index < lines.length - 1 ? "4px" : 0 } },
|
|
280
|
-
line.label && (React.createElement("strong", null,
|
|
281
|
-
line.label,
|
|
282
|
-
separator)),
|
|
283
|
-
line.value)))));
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Convert a tooltip prop to the format Semiotic expects
|
|
288
|
-
*/
|
|
289
|
-
function normalizeTooltip(tooltip) {
|
|
290
|
-
if (tooltip === true) {
|
|
291
|
-
// Enable default tooltip
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
if (typeof tooltip === "function") {
|
|
295
|
-
// Already a tooltip function, use it as tooltipContent
|
|
296
|
-
return tooltip;
|
|
297
|
-
}
|
|
298
|
-
if (tooltip === false || tooltip === undefined) {
|
|
299
|
-
// No tooltip
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
// Config object with fields/title — convert to a tooltip function
|
|
303
|
-
if (typeof tooltip === "object" && tooltip !== null && ("fields" in tooltip || "title" in tooltip)) {
|
|
304
|
-
const config = tooltip;
|
|
305
|
-
return Tooltip(config);
|
|
306
|
-
}
|
|
307
|
-
// Should not reach here but return true to enable default tooltip
|
|
308
|
-
return true;
|
|
309
|
-
}
|