semiotic 2.0.3 → 3.0.0-beta.2
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 +828 -0
- package/README.md +215 -37
- package/ai/cli.js +48 -0
- package/ai/dist/ai/componentRegistry.js +45 -0
- package/ai/dist/ai/mcp-server.js +99 -0
- package/ai/dist/ai/renderHOCToSVG.js +77 -0
- package/ai/dist/src/components/Annotation.js +358 -0
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
- package/ai/dist/src/components/Axis/Axis.js +374 -0
- package/ai/dist/src/components/Axis/axisTitle.js +14 -0
- package/ai/dist/src/components/Axis/index.js +7 -0
- package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
- package/ai/dist/src/components/Brush.js +84 -0
- package/ai/dist/src/components/ChartErrorBoundary.js +91 -0
- package/ai/dist/src/components/DividedLine.js +65 -0
- package/ai/dist/src/components/Legend.js +140 -0
- package/ai/dist/src/components/LinkedCharts.js +95 -0
- package/ai/dist/src/components/ThemeProvider.js +79 -0
- package/ai/dist/src/components/Tooltip/Tooltip.js +309 -0
- package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
- package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
- package/ai/dist/src/components/annotationRules/networkframeRules.js +196 -0
- package/ai/dist/src/components/annotationRules/xyframeRules.js +297 -0
- package/ai/dist/src/components/batchWork.js +35 -0
- package/ai/dist/src/components/charts/index.js +109 -0
- package/ai/dist/src/components/charts/network/ChordDiagram.js +142 -0
- package/ai/dist/src/components/charts/network/CirclePack.js +108 -0
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +121 -0
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +155 -0
- package/ai/dist/src/components/charts/network/TreeDiagram.js +110 -0
- package/ai/dist/src/components/charts/network/Treemap.js +106 -0
- package/ai/dist/src/components/charts/ordinal/BarChart.js +156 -0
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +139 -0
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +126 -0
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +129 -0
- package/ai/dist/src/components/charts/ordinal/Histogram.js +132 -0
- package/ai/dist/src/components/charts/ordinal/PieChart.js +128 -0
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +130 -0
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +147 -0
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +138 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +79 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +114 -0
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +93 -0
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +105 -0
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +106 -0
- package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
- package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
- package/ai/dist/src/components/charts/shared/formatUtils.js +213 -0
- package/ai/dist/src/components/charts/shared/hooks.js +49 -0
- package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
- package/ai/dist/src/components/charts/shared/selectionUtils.js +67 -0
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +79 -0
- package/ai/dist/src/components/charts/shared/types.js +2 -0
- package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
- package/ai/dist/src/components/charts/shared/validateProps.js +736 -0
- package/ai/dist/src/components/charts/xy/AreaChart.js +230 -0
- package/ai/dist/src/components/charts/xy/BubbleChart.js +251 -0
- package/ai/dist/src/components/charts/xy/Heatmap.js +235 -0
- package/ai/dist/src/components/charts/xy/LineChart.js +307 -0
- package/ai/dist/src/components/charts/xy/MinimapChart.js +298 -0
- package/ai/dist/src/components/charts/xy/Scatterplot.js +172 -0
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +426 -0
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +231 -0
- package/ai/dist/src/components/constants/coordinateNames.js +11 -0
- package/ai/dist/src/components/constants/frame_props.js +251 -0
- package/ai/dist/src/components/data/dataFunctions.js +487 -0
- package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
- package/ai/dist/src/components/data/transforms.js +143 -0
- package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
- package/ai/dist/src/components/export/exportChart.js +121 -0
- package/ai/dist/src/components/generic_utilities/functions.js +5 -0
- package/ai/dist/src/components/geometry/areaDrawing.js +312 -0
- package/ai/dist/src/components/geometry/contourLayout.js +73 -0
- package/ai/dist/src/components/geometry/hexbinLayout.js +163 -0
- package/ai/dist/src/components/geometry/lineDrawing.js +356 -0
- package/ai/dist/src/components/geometry/sankeyLinks.js +331 -0
- package/ai/dist/src/components/geometry/summaryLayouts.js +136 -0
- package/ai/dist/src/components/index.js +18 -0
- package/ai/dist/src/components/processing/InteractionItems.js +223 -0
- package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
- package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
- package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
- package/ai/dist/src/components/processing/layouts/index.js +32 -0
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
- package/ai/dist/src/components/processing/layouts/types.js +2 -0
- package/ai/dist/src/components/processing/networkDefaults.js +39 -0
- package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
- package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
- package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
- package/ai/dist/src/components/realtime/renderers/types.js +2 -0
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
- package/ai/dist/src/components/realtime/types.js +2 -0
- package/ai/dist/src/components/semiotic-ai.js +89 -0
- package/ai/dist/src/components/semiotic-data.js +12 -0
- package/ai/dist/src/components/semiotic-network.js +38 -0
- package/ai/dist/src/components/semiotic-ordinal.js +28 -0
- package/ai/dist/src/components/semiotic-realtime.js +30 -0
- package/ai/dist/src/components/semiotic-server.js +8 -0
- package/ai/dist/src/components/semiotic-xy.js +35 -0
- package/ai/dist/src/components/semiotic.js +109 -0
- package/ai/dist/src/components/server/renderToStaticSVG.js +594 -0
- package/ai/dist/src/components/store/SelectionStore.js +91 -0
- package/ai/dist/src/components/store/ThemeStore.js +78 -0
- package/ai/dist/src/components/store/TooltipStore.js +13 -0
- package/ai/dist/src/components/store/createStore.js +81 -0
- package/ai/dist/src/components/store/useSelection.js +133 -0
- package/ai/dist/src/components/stream/CanvasHitTester.js +164 -0
- package/ai/dist/src/components/stream/DataSourceAdapter.js +99 -0
- package/ai/dist/src/components/stream/MarginalGraphics.js +266 -0
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +228 -0
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +498 -0
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +70 -0
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +38 -0
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +146 -0
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +786 -0
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +130 -0
- package/ai/dist/src/components/stream/ParticlePool.js +174 -0
- package/ai/dist/src/components/stream/PipelineStore.js +1243 -0
- package/ai/dist/src/components/stream/SVGOverlay.js +129 -0
- package/ai/dist/src/components/stream/SceneGraph.js +132 -0
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +561 -0
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +492 -0
- package/ai/dist/src/components/stream/StreamXYFrame.js +590 -0
- package/ai/dist/src/components/stream/accessorUtils.js +20 -0
- package/ai/dist/src/components/stream/index.js +32 -0
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +352 -0
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +230 -0
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +568 -0
- package/ai/dist/src/components/stream/layouts/index.js +28 -0
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +245 -0
- package/ai/dist/src/components/stream/networkTypes.js +17 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +126 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +62 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +33 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +63 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +278 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +30 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +2 -0
- package/ai/dist/src/components/stream/ordinalTypes.js +2 -0
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +48 -0
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +70 -0
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +75 -0
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +28 -0
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +31 -0
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +140 -0
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +37 -0
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +102 -0
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +63 -0
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +35 -0
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +10 -0
- package/ai/dist/src/components/stream/renderers/types.js +2 -0
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +33 -0
- package/ai/dist/src/components/stream/types.js +2 -0
- package/ai/dist/src/components/types/annotationTypes.js +2 -0
- package/ai/dist/src/components/types/canvasTypes.js +2 -0
- package/ai/dist/src/components/types/generalTypes.js +2 -0
- package/ai/dist/src/components/types/interactionTypes.js +2 -0
- package/ai/dist/src/components/types/legendTypes.js +2 -0
- package/ai/dist/src/components/types/networkTypes.js +2 -0
- package/ai/dist/src/components/types/ordinalTypes.js +2 -0
- package/ai/dist/src/components/types/xyTypes.js +2 -0
- package/ai/dist/src/components/useBoundingRect.js +24 -0
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +301 -0
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
- package/ai/dist/src/setupTests.js +4 -0
- package/ai/examples.md +489 -0
- package/ai/schema.json +1338 -0
- package/ai/system-prompt.md +41 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -1
- package/dist/Axis/axisTitle.d.ts +3 -3
- package/dist/Axis/summaryGraphic.d.ts +1 -1
- package/dist/ChartErrorBoundary.d.ts +39 -0
- package/dist/LinkedCharts.d.ts +42 -0
- package/dist/ThemeProvider.d.ts +12 -0
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +1 -1
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +2 -2
- package/dist/annotationRules/networkframeRules.d.ts +2 -2
- package/dist/annotationRules/xyframeRules.d.ts +2 -2
- package/dist/batchWork.d.ts +1 -1
- package/dist/charts/index.d.ts +74 -0
- package/dist/charts/network/ChordDiagram.d.ts +36 -0
- package/dist/charts/network/CirclePack.d.ts +32 -0
- package/dist/charts/network/ForceDirectedGraph.d.ts +38 -0
- package/dist/charts/network/SankeyDiagram.d.ts +38 -0
- package/dist/charts/network/TreeDiagram.d.ts +34 -0
- package/dist/charts/network/Treemap.d.ts +33 -0
- package/dist/charts/ordinal/BarChart.d.ts +32 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +27 -0
- package/dist/charts/ordinal/DonutChart.d.ts +23 -0
- package/dist/charts/ordinal/DotPlot.d.ts +27 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +26 -0
- package/dist/charts/ordinal/Histogram.d.ts +26 -0
- package/dist/charts/ordinal/PieChart.d.ts +21 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +34 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +27 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +29 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +28 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +95 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +119 -0
- package/dist/charts/realtime/RealtimeLineChart.d.ts +98 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +100 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +97 -0
- package/dist/charts/shared/ChartError.d.ts +19 -0
- package/dist/charts/shared/colorUtils.d.ts +62 -0
- package/dist/charts/shared/formatUtils.d.ts +94 -0
- package/dist/charts/shared/hooks.d.ts +20 -0
- package/dist/charts/shared/legendUtils.d.ts +32 -0
- package/dist/charts/shared/selectionUtils.d.ts +51 -0
- package/dist/charts/shared/tooltipUtils.d.ts +18 -0
- package/dist/charts/shared/types.d.ts +97 -0
- package/dist/charts/shared/validateChartData.d.ts +41 -0
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +130 -0
- package/dist/charts/xy/BubbleChart.d.ts +164 -0
- package/dist/charts/xy/Heatmap.d.ts +156 -0
- package/dist/charts/xy/LineChart.d.ts +196 -0
- package/dist/charts/xy/MinimapChart.d.ts +73 -0
- package/dist/charts/xy/Scatterplot.d.ts +55 -0
- package/dist/charts/xy/ScatterplotMatrix.d.ts +71 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +134 -0
- package/dist/constants/frame_props.d.ts +9 -0
- package/dist/data/dataFunctions.d.ts +10 -11
- package/dist/data/transforms.d.ts +45 -0
- package/dist/export/exportChart.d.ts +16 -0
- package/dist/{svg → geometry}/areaDrawing.d.ts +3 -13
- package/dist/geometry/contourLayout.d.ts +6 -0
- package/dist/geometry/hexbinLayout.d.ts +7 -0
- package/dist/{svg → geometry}/lineDrawing.d.ts +7 -35
- package/dist/geometry/sankeyLinks.d.ts +2 -0
- package/dist/geometry/summaryLayouts.d.ts +45 -0
- package/dist/index.d.ts +1 -125
- package/dist/network.js +7495 -0
- package/dist/network.js.map +1 -0
- package/dist/network.min.js +1 -0
- package/dist/network.module.js +7458 -0
- package/dist/network.module.js.map +1 -0
- package/dist/network.module.min.js +1 -0
- package/dist/ordinal.js +6497 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/ordinal.min.js +1 -0
- package/dist/ordinal.module.js +6465 -0
- package/dist/ordinal.module.js.map +1 -0
- package/dist/ordinal.module.min.js +1 -0
- package/dist/processing/InteractionItems.d.ts +5 -4
- package/dist/processing/hierarchyUtils.d.ts +16 -0
- package/dist/processing/layouts/chordLayout.d.ts +2 -0
- package/dist/processing/layouts/forceLayout.d.ts +3 -0
- package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
- package/dist/processing/layouts/index.d.ts +8 -0
- package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
- package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
- package/dist/processing/layouts/types.d.ts +17 -0
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/realtime/BinAccumulator.d.ts +8 -0
- package/dist/realtime/IncrementalExtent.d.ts +13 -0
- package/dist/realtime/RingBuffer.d.ts +19 -0
- package/dist/realtime/renderers/barRenderer.d.ts +2 -0
- package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
- package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
- package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
- package/dist/realtime/renderers/types.d.ts +9 -0
- package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
- package/dist/realtime/types.d.ts +113 -0
- package/dist/realtime.js +7072 -0
- package/dist/realtime.js.map +1 -0
- package/dist/realtime.min.js +1 -0
- package/dist/realtime.module.js +7043 -0
- package/dist/realtime.module.js.map +1 -0
- package/dist/realtime.module.min.js +1 -0
- package/dist/semiotic-ai.d.ts +36 -0
- package/dist/semiotic-ai.js +13323 -0
- package/dist/semiotic-ai.js.map +1 -0
- package/dist/semiotic-ai.min.js +1 -0
- package/dist/semiotic-ai.module.js +13264 -0
- package/dist/semiotic-ai.module.js.map +1 -0
- package/dist/semiotic-ai.module.min.js +1 -0
- package/dist/semiotic-data.d.ts +5 -0
- package/dist/semiotic-data.js +141 -0
- package/dist/semiotic-data.js.map +1 -0
- package/dist/semiotic-data.min.js +1 -0
- package/dist/semiotic-data.module.js +136 -0
- package/dist/semiotic-data.module.js.map +1 -0
- package/dist/semiotic-data.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +23 -0
- package/dist/semiotic-ordinal.d.ts +19 -0
- package/dist/semiotic-realtime.d.ts +22 -0
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-xy.d.ts +21 -0
- package/dist/semiotic.d.ts +41 -28
- package/dist/semiotic.js +16257 -13130
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +16198 -13100
- package/dist/semiotic.module.js.map +1 -0
- package/dist/semiotic.module.min.js +1 -0
- package/dist/server/renderToStaticSVG.d.ts +9 -0
- package/dist/server.js +5191 -0
- package/dist/server.js.map +1 -0
- package/dist/server.min.js +1 -0
- package/dist/server.module.js +5166 -0
- package/dist/server.module.js.map +1 -0
- package/dist/server.module.min.js +1 -0
- package/dist/store/SelectionStore.d.ts +29 -0
- package/dist/store/ThemeStore.d.ts +26 -0
- package/dist/store/useSelection.d.ts +66 -0
- package/dist/stream/CanvasHitTester.d.ts +18 -0
- package/dist/stream/DataSourceAdapter.d.ts +32 -0
- package/dist/stream/MarginalGraphics.d.ts +19 -0
- package/dist/stream/NetworkCanvasHitTester.d.ts +14 -0
- package/dist/stream/NetworkPipelineStore.d.ts +74 -0
- package/dist/stream/NetworkSVGOverlay.d.ts +40 -0
- package/dist/stream/NetworkSceneGraph.d.ts +14 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +9 -0
- package/dist/stream/OrdinalPipelineStore.d.ts +65 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +34 -0
- package/dist/stream/ParticlePool.d.ts +28 -0
- package/dist/stream/PipelineStore.d.ts +161 -0
- package/dist/stream/SVGOverlay.d.ts +37 -0
- package/dist/stream/SceneGraph.d.ts +16 -0
- package/dist/stream/StreamNetworkFrame.d.ts +4 -0
- package/dist/stream/StreamOrdinalFrame.d.ts +4 -0
- package/dist/stream/StreamXYFrame.d.ts +4 -0
- package/dist/stream/accessorUtils.d.ts +2 -0
- package/dist/stream/index.d.ts +16 -0
- package/dist/stream/layouts/chordLayoutPlugin.d.ts +8 -0
- package/dist/stream/layouts/forceLayoutPlugin.d.ts +9 -0
- package/dist/stream/layouts/hierarchyLayoutPlugin.d.ts +17 -0
- package/dist/stream/layouts/index.d.ts +11 -0
- package/dist/stream/layouts/sankeyLayoutPlugin.d.ts +8 -0
- package/dist/stream/networkTypes.d.ts +346 -0
- package/dist/stream/ordinalSceneBuilders/barScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/connectorScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pieScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pointScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/statisticalScene.d.ts +6 -0
- package/dist/stream/ordinalSceneBuilders/timelineScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/types.d.ts +21 -0
- package/dist/stream/ordinalTypes.d.ts +225 -0
- package/dist/stream/renderers/areaCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/barCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/boxplotCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/candlestickCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/connectorCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/heatmapCanvasRenderer.d.ts +6 -0
- package/dist/stream/renderers/lineCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/networkArcRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkCircleRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkEdgeRenderer.d.ts +10 -0
- package/dist/stream/renderers/networkParticleRenderer.d.ts +11 -0
- package/dist/stream/renderers/networkRectRenderer.d.ts +5 -0
- package/dist/stream/renderers/pointCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/swarmCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/types.d.ts +7 -0
- package/dist/stream/renderers/violinCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/waterfallCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/wedgeCanvasRenderer.d.ts +2 -0
- package/dist/stream/types.d.ts +307 -0
- package/dist/types/annotationTypes.d.ts +13 -18
- package/dist/types/canvasTypes.d.ts +1 -1
- package/dist/types/generalTypes.d.ts +41 -36
- package/dist/types/interactionTypes.d.ts +7 -9
- package/dist/types/legendTypes.d.ts +2 -2
- package/dist/types/networkTypes.d.ts +40 -30
- package/dist/types/ordinalTypes.d.ts +27 -18
- package/dist/types/xyTypes.d.ts +1 -95
- package/dist/visualizationLayerBehavior/axis.d.ts +3 -5
- package/dist/visualizationLayerBehavior/general.d.ts +8 -12
- package/dist/xy.js +6993 -0
- package/dist/xy.js.map +1 -0
- package/dist/xy.min.js +1 -0
- package/dist/xy.module.js +6957 -0
- package/dist/xy.module.js.map +1 -0
- package/dist/xy.module.min.js +1 -0
- package/package.json +123 -67
- package/dist/AnnotationLayer/helpers.d.ts +0 -6
- package/dist/AnnotationLayer/index.d.ts +0 -2
- package/dist/FacetController.d.ts +0 -12
- package/dist/Frame.d.ts +0 -2
- package/dist/InteractionLayer.d.ts +0 -3
- package/dist/Mark/Mark.d.ts +0 -3
- package/dist/Mark/Mark.types.d.ts +0 -10
- package/dist/Mark/constants/markTransition.d.ts +0 -10
- package/dist/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/MiniMap.d.ts +0 -14
- package/dist/MinimapXYFrame.d.ts +0 -10
- package/dist/NetworkFrame.d.ts +0 -4
- package/dist/OrdinalFrame.d.ts +0 -4
- package/dist/ResponsiveFrame.d.ts +0 -22
- package/dist/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/ResponsiveXYFrame.d.ts +0 -6
- package/dist/SpanOrDiv.d.ts +0 -10
- package/dist/SparkFrame.d.ts +0 -14
- package/dist/SparkNetworkFrame.d.ts +0 -5
- package/dist/SparkOrdinalFrame.d.ts +0 -5
- package/dist/SparkXYFrame.d.ts +0 -5
- package/dist/VisualizationLayer.d.ts +0 -33
- package/dist/XYFrame.d.ts +0 -4
- package/dist/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/Annotation.d.ts +0 -3
- package/dist/components/AnnotationLayer/AnnotationLayer.d.ts +0 -26
- package/dist/components/Axis/Axis.d.ts +0 -7
- package/dist/components/Axis/axisTitle.d.ts +0 -10
- package/dist/components/Axis/index.d.ts +0 -2
- package/dist/components/Axis/summaryGraphic.d.ts +0 -17
- package/dist/components/Brush.d.ts +0 -12
- package/dist/components/DividedLine.d.ts +0 -16
- package/dist/components/FacetController.d.ts +0 -12
- package/dist/components/Frame.d.ts +0 -2
- package/dist/components/InteractionLayer.d.ts +0 -3
- package/dist/components/Legend.d.ts +0 -3
- package/dist/components/Mark/Mark.d.ts +0 -3
- package/dist/components/Mark/Mark.types.d.ts +0 -10
- package/dist/components/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/components/MiniMap.d.ts +0 -14
- package/dist/components/MinimapXYFrame.d.ts +0 -10
- package/dist/components/NetworkFrame.d.ts +0 -4
- package/dist/components/OrdinalFrame.d.ts +0 -4
- package/dist/components/ResponsiveFrame.d.ts +0 -22
- package/dist/components/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/components/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/components/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/components/ResponsiveXYFrame.d.ts +0 -6
- package/dist/components/SpanOrDiv.d.ts +0 -10
- package/dist/components/SparkFrame.d.ts +0 -14
- package/dist/components/SparkNetworkFrame.d.ts +0 -5
- package/dist/components/SparkOrdinalFrame.d.ts +0 -5
- package/dist/components/SparkXYFrame.d.ts +0 -5
- package/dist/components/TooltipPositioner/index.d.ts +0 -7
- package/dist/components/VisualizationLayer.d.ts +0 -33
- package/dist/components/XYFrame.d.ts +0 -4
- package/dist/components/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/components/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/components/annotationRules/baseRules.d.ts +0 -25
- package/dist/components/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/components/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/components/batchWork.d.ts +0 -6
- package/dist/components/constants/coordinateNames.d.ts +0 -8
- package/dist/components/constants/frame_props.d.ts +0 -4
- package/dist/components/constants/jsx.d.ts +0 -19
- package/dist/components/data/dataFunctions.d.ts +0 -46
- package/dist/components/data/multiAccessorUtils.d.ts +0 -1
- package/dist/components/data/unflowedFunctions.d.ts +0 -1
- package/dist/components/generic_utilities/functions.d.ts +0 -1
- package/dist/components/index.d.ts +0 -125
- package/dist/components/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/components/processing/InteractionItems.d.ts +0 -12
- package/dist/components/processing/network.d.ts +0 -114
- package/dist/components/processing/ordinal.d.ts +0 -102
- package/dist/components/processing/xyDrawing.d.ts +0 -135
- package/dist/components/semiotic.d.ts +0 -35
- package/dist/components/store/TooltipStore.d.ts +0 -2
- package/dist/components/store/createStore.d.ts +0 -1
- package/dist/components/svg/SvgHelper.d.ts +0 -37
- package/dist/components/svg/areaDrawing.d.ts +0 -31
- package/dist/components/svg/ckmeans.d.ts +0 -69
- package/dist/components/svg/frameFunctions.d.ts +0 -119
- package/dist/components/svg/lineDrawing.d.ts +0 -99
- package/dist/components/svg/networkDrawing.d.ts +0 -134
- package/dist/components/svg/pieceDrawing.d.ts +0 -13
- package/dist/components/svg/pieceLayouts.d.ts +0 -71
- package/dist/components/svg/summaryLayouts.d.ts +0 -74
- package/dist/components/types/annotationTypes.d.ts +0 -140
- package/dist/components/types/canvasTypes.d.ts +0 -9
- package/dist/components/types/generalTypes.d.ts +0 -236
- package/dist/components/types/interactionTypes.d.ts +0 -74
- package/dist/components/types/legendTypes.d.ts +0 -20
- package/dist/components/types/networkTypes.d.ts +0 -165
- package/dist/components/types/ordinalTypes.d.ts +0 -103
- package/dist/components/types/xyTypes.d.ts +0 -118
- package/dist/components/useBoundingRect.d.ts +0 -2
- package/dist/components/useDerivedStateFromProps.d.ts +0 -1
- package/dist/components/useLegacyUnmountCallback.d.ts +0 -1
- package/dist/components/visualizationLayerBehavior/axis.d.ts +0 -38
- package/dist/components/visualizationLayerBehavior/general.d.ts +0 -84
- package/dist/constants/jsx.d.ts +0 -19
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/processing/network.d.ts +0 -114
- package/dist/processing/ordinal.d.ts +0 -102
- package/dist/processing/xyDrawing.d.ts +0 -135
- package/dist/setupTests.d.ts +0 -1
- package/dist/svg/SvgHelper.d.ts +0 -37
- package/dist/svg/ckmeans.d.ts +0 -69
- package/dist/svg/frameFunctions.d.ts +0 -119
- package/dist/svg/networkDrawing.d.ts +0 -134
- package/dist/svg/pieceDrawing.d.ts +0 -13
- package/dist/svg/pieceLayouts.d.ts +0 -71
- package/dist/svg/summaryLayouts.d.ts +0 -74
- package/dist/useDerivedStateFromProps.d.ts +0 -1
- package/dist/useLegacyUnmountCallback.d.ts +0 -1
|
@@ -0,0 +1,266 @@
|
|
|
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.normalizeMarginalConfig = normalizeMarginalConfig;
|
|
38
|
+
exports.MarginalGraphics = MarginalGraphics;
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const react_1 = require("react");
|
|
41
|
+
const d3_array_1 = require("d3-array");
|
|
42
|
+
/** Resolve a string shorthand or full config into a MarginalConfig */
|
|
43
|
+
function normalizeMarginalConfig(input) {
|
|
44
|
+
if (typeof input === "string") {
|
|
45
|
+
return { type: input };
|
|
46
|
+
}
|
|
47
|
+
return input;
|
|
48
|
+
}
|
|
49
|
+
const DEFAULTS = {
|
|
50
|
+
bins: 20,
|
|
51
|
+
fill: "#4e79a7",
|
|
52
|
+
fillOpacity: 0.5,
|
|
53
|
+
stroke: "none",
|
|
54
|
+
strokeWidth: 1
|
|
55
|
+
};
|
|
56
|
+
function resolveConfig(config) {
|
|
57
|
+
return {
|
|
58
|
+
type: config.type,
|
|
59
|
+
bins: config.bins ?? DEFAULTS.bins,
|
|
60
|
+
fill: config.fill ?? DEFAULTS.fill,
|
|
61
|
+
fillOpacity: config.fillOpacity ?? DEFAULTS.fillOpacity,
|
|
62
|
+
stroke: config.stroke ?? DEFAULTS.stroke,
|
|
63
|
+
strokeWidth: config.strokeWidth ?? DEFAULTS.strokeWidth
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Compute quartiles and whiskers for boxplot */
|
|
67
|
+
function boxplotStats(values) {
|
|
68
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
69
|
+
const n = sorted.length;
|
|
70
|
+
if (n === 0)
|
|
71
|
+
return null;
|
|
72
|
+
const q1 = sorted[Math.floor(n * 0.25)];
|
|
73
|
+
const median = sorted[Math.floor(n * 0.5)];
|
|
74
|
+
const q3 = sorted[Math.floor(n * 0.75)];
|
|
75
|
+
const iqr = q3 - q1;
|
|
76
|
+
const whiskerLow = Math.max(sorted[0], q1 - 1.5 * iqr);
|
|
77
|
+
const whiskerHigh = Math.min(sorted[n - 1], q3 + 1.5 * iqr);
|
|
78
|
+
return { q1, median, q3, whiskerLow, whiskerHigh };
|
|
79
|
+
}
|
|
80
|
+
function MarginalGraphics({ orient, config: rawConfig, values, scale, size, length }) {
|
|
81
|
+
const config = resolveConfig(rawConfig);
|
|
82
|
+
const padding = 4;
|
|
83
|
+
const isHorizontal = orient === "top" || orient === "bottom";
|
|
84
|
+
const content = (0, react_1.useMemo)(() => {
|
|
85
|
+
if (values.length === 0)
|
|
86
|
+
return null;
|
|
87
|
+
const domain = scale.domain();
|
|
88
|
+
const availableSize = size - padding * 2;
|
|
89
|
+
if (config.type === "boxplot") {
|
|
90
|
+
const stats = boxplotStats(values);
|
|
91
|
+
if (!stats)
|
|
92
|
+
return null;
|
|
93
|
+
const { q1, median, q3, whiskerLow, whiskerHigh } = stats;
|
|
94
|
+
const boxThickness = Math.min(availableSize * 0.5, 20);
|
|
95
|
+
const offset = (availableSize - boxThickness) / 2 + padding;
|
|
96
|
+
if (isHorizontal) {
|
|
97
|
+
const x1 = scale(q1);
|
|
98
|
+
const x2 = scale(q3);
|
|
99
|
+
const xMed = scale(median);
|
|
100
|
+
const xWLow = scale(whiskerLow);
|
|
101
|
+
const xWHigh = scale(whiskerHigh);
|
|
102
|
+
const growDir = orient === "top" ? -1 : 1;
|
|
103
|
+
const baseY = orient === "top" ? 0 : 0;
|
|
104
|
+
return (React.createElement("g", { "data-testid": `marginal-boxplot-${orient}` },
|
|
105
|
+
React.createElement("line", { x1: xWLow, y1: baseY + growDir * (offset + boxThickness / 2), x2: xWHigh, y2: baseY + growDir * (offset + boxThickness / 2), stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
106
|
+
React.createElement("line", { x1: xWLow, y1: baseY + growDir * offset, x2: xWLow, y2: baseY + growDir * (offset + boxThickness), stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
107
|
+
React.createElement("line", { x1: xWHigh, y1: baseY + growDir * offset, x2: xWHigh, y2: baseY + growDir * (offset + boxThickness), stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
108
|
+
React.createElement("rect", { x: Math.min(x1, x2), y: orient === "top" ? baseY - offset - boxThickness : baseY + offset, width: Math.abs(x2 - x1), height: boxThickness, fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke === "none" ? config.fill : config.stroke, strokeWidth: config.strokeWidth }),
|
|
109
|
+
React.createElement("line", { x1: xMed, y1: orient === "top" ? baseY - offset - boxThickness : baseY + offset, x2: xMed, y2: orient === "top" ? baseY - offset : baseY + offset + boxThickness, stroke: config.fill, strokeWidth: 2 })));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// Vertical: left/right
|
|
113
|
+
const y1 = scale(q1);
|
|
114
|
+
const y2 = scale(q3);
|
|
115
|
+
const yMed = scale(median);
|
|
116
|
+
const yWLow = scale(whiskerLow);
|
|
117
|
+
const yWHigh = scale(whiskerHigh);
|
|
118
|
+
const growDir = orient === "left" ? -1 : 1;
|
|
119
|
+
const baseX = 0;
|
|
120
|
+
return (React.createElement("g", { "data-testid": `marginal-boxplot-${orient}` },
|
|
121
|
+
React.createElement("line", { x1: baseX + growDir * (offset + boxThickness / 2), y1: yWLow, x2: baseX + growDir * (offset + boxThickness / 2), y2: yWHigh, stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
122
|
+
React.createElement("line", { x1: baseX + growDir * offset, y1: yWLow, x2: baseX + growDir * (offset + boxThickness), y2: yWLow, stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
123
|
+
React.createElement("line", { x1: baseX + growDir * offset, y1: yWHigh, x2: baseX + growDir * (offset + boxThickness), y2: yWHigh, stroke: config.fill, strokeWidth: config.strokeWidth }),
|
|
124
|
+
React.createElement("rect", { x: orient === "left" ? baseX - offset - boxThickness : baseX + offset, y: Math.min(y1, y2), width: boxThickness, height: Math.abs(y2 - y1), fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke === "none" ? config.fill : config.stroke, strokeWidth: config.strokeWidth }),
|
|
125
|
+
React.createElement("line", { x1: orient === "left" ? baseX - offset - boxThickness : baseX + offset, y1: yMed, x2: orient === "left" ? baseX - offset : baseX + offset + boxThickness, y2: yMed, stroke: config.fill, strokeWidth: 2 })));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Binned types: histogram, violin, ridgeline
|
|
129
|
+
const binner = (0, d3_array_1.bin)()
|
|
130
|
+
.domain(domain)
|
|
131
|
+
.thresholds(config.bins);
|
|
132
|
+
const bins = binner(values);
|
|
133
|
+
if (bins.length === 0)
|
|
134
|
+
return null;
|
|
135
|
+
const maxCount = Math.max(...bins.map(b => b.length));
|
|
136
|
+
if (maxCount === 0)
|
|
137
|
+
return null;
|
|
138
|
+
if (config.type === "histogram") {
|
|
139
|
+
return (React.createElement("g", { "data-testid": `marginal-histogram-${orient}` }, bins.map((bin, i) => {
|
|
140
|
+
if (bin.x0 == null || bin.x1 == null)
|
|
141
|
+
return null;
|
|
142
|
+
const count = bin.length;
|
|
143
|
+
const barSize = (count / maxCount) * availableSize;
|
|
144
|
+
if (isHorizontal) {
|
|
145
|
+
const x = scale(bin.x0);
|
|
146
|
+
const w = scale(bin.x1) - scale(bin.x0);
|
|
147
|
+
const y = orient === "top" ? -padding - barSize : padding;
|
|
148
|
+
return (React.createElement("rect", { key: i, x: x, y: y, width: Math.max(w, 0.5), height: barSize, fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke, strokeWidth: config.strokeWidth }));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const y = scale(bin.x0);
|
|
152
|
+
const h = scale(bin.x1) - scale(bin.x0);
|
|
153
|
+
const x = orient === "left" ? -padding - barSize : padding;
|
|
154
|
+
return (React.createElement("rect", { key: i, x: x, y: Math.min(y, y + h), width: barSize, height: Math.abs(h), fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke, strokeWidth: config.strokeWidth }));
|
|
155
|
+
}
|
|
156
|
+
})));
|
|
157
|
+
}
|
|
158
|
+
if (config.type === "violin") {
|
|
159
|
+
// Symmetric density path around the midline
|
|
160
|
+
const midline = availableSize / 2 + padding;
|
|
161
|
+
const points = [];
|
|
162
|
+
// Forward pass (one side)
|
|
163
|
+
for (const bin of bins) {
|
|
164
|
+
if (bin.x0 == null || bin.x1 == null)
|
|
165
|
+
continue;
|
|
166
|
+
const mid = (bin.x0 + bin.x1) / 2;
|
|
167
|
+
const w = (bin.length / maxCount) * (availableSize / 2);
|
|
168
|
+
const pos = scale(mid);
|
|
169
|
+
if (isHorizontal) {
|
|
170
|
+
const y = orient === "top" ? -(midline - w) : midline - w;
|
|
171
|
+
points.push(`${pos},${y}`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const x = orient === "left" ? -(midline - w) : midline - w;
|
|
175
|
+
points.push(`${x},${pos}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Reverse pass (other side)
|
|
179
|
+
for (let i = bins.length - 1; i >= 0; i--) {
|
|
180
|
+
const bin = bins[i];
|
|
181
|
+
if (bin.x0 == null || bin.x1 == null)
|
|
182
|
+
continue;
|
|
183
|
+
const mid = (bin.x0 + bin.x1) / 2;
|
|
184
|
+
const w = (bin.length / maxCount) * (availableSize / 2);
|
|
185
|
+
const pos = scale(mid);
|
|
186
|
+
if (isHorizontal) {
|
|
187
|
+
const y = orient === "top" ? -(midline + w) : midline + w;
|
|
188
|
+
points.push(`${pos},${y}`);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const x = orient === "left" ? -(midline + w) : midline + w;
|
|
192
|
+
points.push(`${x},${pos}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return (React.createElement("g", { "data-testid": `marginal-violin-${orient}` },
|
|
196
|
+
React.createElement("polygon", { points: points.join(" "), fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke === "none" ? config.fill : config.stroke, strokeWidth: config.strokeWidth })));
|
|
197
|
+
}
|
|
198
|
+
if (config.type === "ridgeline") {
|
|
199
|
+
// One-sided area fill from baseline into the margin
|
|
200
|
+
const pathParts = [];
|
|
201
|
+
if (isHorizontal) {
|
|
202
|
+
const baseY = orient === "top" ? 0 : 0;
|
|
203
|
+
// Start at baseline
|
|
204
|
+
const startX = bins[0].x0 != null ? scale(bins[0].x0) : 0;
|
|
205
|
+
pathParts.push(`M${startX},${baseY}`);
|
|
206
|
+
for (const bin of bins) {
|
|
207
|
+
if (bin.x0 == null || bin.x1 == null)
|
|
208
|
+
continue;
|
|
209
|
+
const mid = (bin.x0 + bin.x1) / 2;
|
|
210
|
+
const h = (bin.length / maxCount) * availableSize;
|
|
211
|
+
const x = scale(mid);
|
|
212
|
+
const y = orient === "top" ? -h - padding : h + padding;
|
|
213
|
+
pathParts.push(`L${x},${y}`);
|
|
214
|
+
}
|
|
215
|
+
// Close back to baseline
|
|
216
|
+
const endX = bins[bins.length - 1].x1 != null ? scale(bins[bins.length - 1].x1) : length;
|
|
217
|
+
pathParts.push(`L${endX},${baseY}`);
|
|
218
|
+
pathParts.push("Z");
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const baseX = 0;
|
|
222
|
+
const startY = bins[0].x0 != null ? scale(bins[0].x0) : 0;
|
|
223
|
+
pathParts.push(`M${baseX},${startY}`);
|
|
224
|
+
for (const bin of bins) {
|
|
225
|
+
if (bin.x0 == null || bin.x1 == null)
|
|
226
|
+
continue;
|
|
227
|
+
const mid = (bin.x0 + bin.x1) / 2;
|
|
228
|
+
const w = (bin.length / maxCount) * availableSize;
|
|
229
|
+
const y = scale(mid);
|
|
230
|
+
const x = orient === "left" ? -w - padding : w + padding;
|
|
231
|
+
pathParts.push(`L${x},${y}`);
|
|
232
|
+
}
|
|
233
|
+
const endY = bins[bins.length - 1].x1 != null ? scale(bins[bins.length - 1].x1) : length;
|
|
234
|
+
pathParts.push(`L${baseX},${endY}`);
|
|
235
|
+
pathParts.push("Z");
|
|
236
|
+
}
|
|
237
|
+
return (React.createElement("g", { "data-testid": `marginal-ridgeline-${orient}` },
|
|
238
|
+
React.createElement("path", { d: pathParts.join(" "), fill: config.fill, fillOpacity: config.fillOpacity, stroke: config.stroke === "none" ? config.fill : config.stroke, strokeWidth: config.strokeWidth })));
|
|
239
|
+
}
|
|
240
|
+
return null;
|
|
241
|
+
}, [values, scale, config, size, length, orient, isHorizontal, padding]);
|
|
242
|
+
if (!content)
|
|
243
|
+
return null;
|
|
244
|
+
// Position the <g> at the margin edge
|
|
245
|
+
let transform;
|
|
246
|
+
switch (orient) {
|
|
247
|
+
case "top":
|
|
248
|
+
transform = `translate(0, 0)`; // top edge of chart area
|
|
249
|
+
break;
|
|
250
|
+
case "bottom":
|
|
251
|
+
transform = `translate(0, ${length})`; // wait — length is chart width for top/bottom
|
|
252
|
+
break;
|
|
253
|
+
case "left":
|
|
254
|
+
transform = `translate(0, 0)`; // left edge of chart area
|
|
255
|
+
break;
|
|
256
|
+
case "right":
|
|
257
|
+
transform = `translate(${length}, 0)`; // length is chart width for left/right? No.
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
// For top/bottom: length = chart width. The g is already inside the margin-translated group.
|
|
261
|
+
// For left/right: length = chart height.
|
|
262
|
+
// orient=bottom means we're at y=chartHeight (bottom of chart area)
|
|
263
|
+
// orient=right means we're at x=chartWidth (right of chart area)
|
|
264
|
+
// Actually, let the parent handle positioning. This component just draws relative to origin.
|
|
265
|
+
return (React.createElement("g", { className: `marginal-${orient}`, "data-testid": `marginal-${orient}` }, content));
|
|
266
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findNearestNetworkNode = findNearestNetworkNode;
|
|
4
|
+
/**
|
|
5
|
+
* Hit test against network scene nodes and edges.
|
|
6
|
+
*
|
|
7
|
+
* Checks nodes first (they're on top), then edges.
|
|
8
|
+
*/
|
|
9
|
+
function findNearestNetworkNode(sceneNodes, sceneEdges, px, py, maxDistance = 30) {
|
|
10
|
+
// Check nodes — for nested rects (treemap) we want the smallest
|
|
11
|
+
// containing rect, so we track rect hits by area separately.
|
|
12
|
+
let bestNode = null;
|
|
13
|
+
let bestDist = maxDistance;
|
|
14
|
+
let bestRectArea = Infinity;
|
|
15
|
+
for (const node of sceneNodes) {
|
|
16
|
+
const result = hitTestNode(node, px, py);
|
|
17
|
+
if (!result)
|
|
18
|
+
continue;
|
|
19
|
+
if (node.type === "rect") {
|
|
20
|
+
// For rects: prefer the smallest area (deepest cell)
|
|
21
|
+
const area = node.w * node.h;
|
|
22
|
+
if (area < bestRectArea) {
|
|
23
|
+
bestNode = result;
|
|
24
|
+
bestRectArea = area;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (result.distance < bestDist) {
|
|
28
|
+
bestNode = result;
|
|
29
|
+
bestDist = result.distance;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (bestNode)
|
|
33
|
+
return bestNode;
|
|
34
|
+
// Check edges if no node hit
|
|
35
|
+
for (const edge of sceneEdges) {
|
|
36
|
+
const result = hitTestEdge(edge, px, py);
|
|
37
|
+
if (result && result.distance < bestDist) {
|
|
38
|
+
bestNode = result;
|
|
39
|
+
bestDist = result.distance;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return bestNode;
|
|
43
|
+
}
|
|
44
|
+
// ── Node hit testing ────────────────────────────────────────────────────
|
|
45
|
+
function hitTestNode(node, px, py) {
|
|
46
|
+
switch (node.type) {
|
|
47
|
+
case "circle":
|
|
48
|
+
return hitTestCircle(node, px, py);
|
|
49
|
+
case "rect":
|
|
50
|
+
return hitTestRect(node, px, py);
|
|
51
|
+
case "arc":
|
|
52
|
+
return hitTestArc(node, px, py);
|
|
53
|
+
default:
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function hitTestCircle(node, px, py) {
|
|
58
|
+
const dx = px - node.cx;
|
|
59
|
+
const dy = py - node.cy;
|
|
60
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
61
|
+
const tolerance = Math.max(node.r, 5) + 5;
|
|
62
|
+
if (dist <= tolerance) {
|
|
63
|
+
return {
|
|
64
|
+
type: "node",
|
|
65
|
+
datum: node.datum,
|
|
66
|
+
x: node.cx,
|
|
67
|
+
y: node.cy,
|
|
68
|
+
distance: dist
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function hitTestRect(node, px, py) {
|
|
74
|
+
if (px >= node.x &&
|
|
75
|
+
px <= node.x + node.w &&
|
|
76
|
+
py >= node.y &&
|
|
77
|
+
py <= node.y + node.h) {
|
|
78
|
+
return {
|
|
79
|
+
type: "node",
|
|
80
|
+
datum: node.datum,
|
|
81
|
+
x: node.x + node.w / 2,
|
|
82
|
+
y: node.y + node.h / 2,
|
|
83
|
+
distance: 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
function hitTestArc(node, px, py) {
|
|
89
|
+
// Convert to polar coordinates relative to arc center
|
|
90
|
+
const dx = px - node.cx;
|
|
91
|
+
const dy = py - node.cy;
|
|
92
|
+
const radius = Math.sqrt(dx * dx + dy * dy);
|
|
93
|
+
// Check radius bounds
|
|
94
|
+
if (radius < node.innerR - 2 || radius > node.outerR + 2)
|
|
95
|
+
return null;
|
|
96
|
+
// Check angle bounds
|
|
97
|
+
let angle = Math.atan2(dy, dx);
|
|
98
|
+
// Normalize angle to be positive
|
|
99
|
+
if (angle < 0)
|
|
100
|
+
angle += Math.PI * 2;
|
|
101
|
+
let start = node.startAngle;
|
|
102
|
+
let end = node.endAngle;
|
|
103
|
+
// Normalize start/end angles
|
|
104
|
+
if (start < 0)
|
|
105
|
+
start += Math.PI * 2;
|
|
106
|
+
if (end < 0)
|
|
107
|
+
end += Math.PI * 2;
|
|
108
|
+
let inArc;
|
|
109
|
+
if (start <= end) {
|
|
110
|
+
inArc = angle >= start && angle <= end;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Wraps around 0
|
|
114
|
+
inArc = angle >= start || angle <= end;
|
|
115
|
+
}
|
|
116
|
+
if (inArc) {
|
|
117
|
+
const midAngle = (node.startAngle + node.endAngle) / 2;
|
|
118
|
+
const midR = (node.innerR + node.outerR) / 2;
|
|
119
|
+
return {
|
|
120
|
+
type: "node",
|
|
121
|
+
datum: node.datum,
|
|
122
|
+
x: node.cx + midR * Math.cos(midAngle),
|
|
123
|
+
y: node.cy + midR * Math.sin(midAngle),
|
|
124
|
+
distance: 0
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
// ── Edge hit testing ────────────────────────────────────────────────────
|
|
130
|
+
function hitTestEdge(edge, px, py) {
|
|
131
|
+
switch (edge.type) {
|
|
132
|
+
case "bezier":
|
|
133
|
+
return hitTestBezierEdge(edge, px, py);
|
|
134
|
+
case "line":
|
|
135
|
+
return hitTestLineEdge(edge, px, py);
|
|
136
|
+
case "ribbon":
|
|
137
|
+
return hitTestPathEdge(edge, px, py);
|
|
138
|
+
case "curved":
|
|
139
|
+
return hitTestPathEdge(edge, px, py);
|
|
140
|
+
default:
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function hitTestBezierEdge(edge, px, py) {
|
|
145
|
+
// Use Path2D for approximate point-in-path testing
|
|
146
|
+
if (!edge.pathD)
|
|
147
|
+
return null;
|
|
148
|
+
try {
|
|
149
|
+
const path = new Path2D(edge.pathD);
|
|
150
|
+
// Create an offscreen canvas context for isPointInPath
|
|
151
|
+
// For performance, use a simple bounding-box approximation
|
|
152
|
+
// and rely on the filled path test
|
|
153
|
+
const canvas = document.createElement("canvas");
|
|
154
|
+
const ctx = canvas.getContext("2d");
|
|
155
|
+
if (!ctx)
|
|
156
|
+
return null;
|
|
157
|
+
if (ctx.isPointInPath(path, px, py)) {
|
|
158
|
+
// Return midpoint of the band as hover position
|
|
159
|
+
const sourceNode = typeof edge.datum?.source === "object" ? edge.datum.source : null;
|
|
160
|
+
const targetNode = typeof edge.datum?.target === "object" ? edge.datum.target : null;
|
|
161
|
+
const midX = sourceNode && targetNode
|
|
162
|
+
? (sourceNode.x1 + targetNode.x0) / 2
|
|
163
|
+
: px;
|
|
164
|
+
const midY = edge.datum
|
|
165
|
+
? (edge.datum.y0 + edge.datum.y1) / 2
|
|
166
|
+
: py;
|
|
167
|
+
return {
|
|
168
|
+
type: "edge",
|
|
169
|
+
datum: edge.datum,
|
|
170
|
+
x: midX,
|
|
171
|
+
y: midY,
|
|
172
|
+
distance: 0
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Path2D may not be supported in all environments
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function hitTestLineEdge(edge, px, py) {
|
|
182
|
+
// Point-to-line-segment distance
|
|
183
|
+
const dx = edge.x2 - edge.x1;
|
|
184
|
+
const dy = edge.y2 - edge.y1;
|
|
185
|
+
const len2 = dx * dx + dy * dy;
|
|
186
|
+
if (len2 === 0)
|
|
187
|
+
return null;
|
|
188
|
+
let t = ((px - edge.x1) * dx + (py - edge.y1) * dy) / len2;
|
|
189
|
+
t = Math.max(0, Math.min(1, t));
|
|
190
|
+
const nearX = edge.x1 + t * dx;
|
|
191
|
+
const nearY = edge.y1 + t * dy;
|
|
192
|
+
const dist = Math.sqrt((px - nearX) ** 2 + (py - nearY) ** 2);
|
|
193
|
+
const tolerance = 5;
|
|
194
|
+
if (dist <= tolerance) {
|
|
195
|
+
return {
|
|
196
|
+
type: "edge",
|
|
197
|
+
datum: edge.datum,
|
|
198
|
+
x: nearX,
|
|
199
|
+
y: nearY,
|
|
200
|
+
distance: dist
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
function hitTestPathEdge(edge, px, py) {
|
|
206
|
+
if (!edge.pathD)
|
|
207
|
+
return null;
|
|
208
|
+
try {
|
|
209
|
+
const path = new Path2D(edge.pathD);
|
|
210
|
+
const canvas = document.createElement("canvas");
|
|
211
|
+
const ctx = canvas.getContext("2d");
|
|
212
|
+
if (!ctx)
|
|
213
|
+
return null;
|
|
214
|
+
if (ctx.isPointInPath(path, px, py)) {
|
|
215
|
+
return {
|
|
216
|
+
type: "edge",
|
|
217
|
+
datum: edge.datum,
|
|
218
|
+
x: px,
|
|
219
|
+
y: py,
|
|
220
|
+
distance: 0
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// Fallback — no hit
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|