vccs 0.6.0 → 1.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/LICENSE +25 -0
- package/README.md +133 -112
- package/dist/animation/ActiveDot.d.ts +14 -0
- package/dist/animation/MovingLabels.d.ts +57 -0
- package/dist/animation/SweepClip.d.ts +56 -0
- package/dist/animation/gridTransition.d.ts +38 -0
- package/dist/animation/motion.d.ts +78 -0
- package/dist/animation/ridingLabels.d.ts +29 -0
- package/dist/animation/useAnimationCallbacks.d.ts +5 -0
- package/dist/animation/useKeyedTransition.d.ts +86 -0
- package/dist/animation/usePointTransition.d.ts +40 -0
- package/dist/animation/useReducedMotion.d.ts +2 -0
- package/dist/animation/useTickMotion.d.ts +22 -0
- package/dist/cartesian/ActivePoints.d.ts +71 -0
- package/dist/cartesian/GraphicalItemClipPath.d.ts +27 -2
- package/dist/cartesian/area/Area.d.ts +229 -14
- package/dist/cartesian/area/RenderArea.d.ts +1 -16
- package/dist/cartesian/area/hooks/useArea.d.ts +13 -18
- package/dist/cartesian/area/type.d.ts +32 -81
- package/dist/cartesian/axis/AxisProps.d.ts +101 -0
- package/dist/cartesian/axis/XAxis.d.ts +144 -83
- package/dist/cartesian/axis/YAxis.d.ts +152 -94
- package/dist/cartesian/bar/Bar.d.ts +229 -2
- package/dist/cartesian/bar/components/BarBackground.d.ts +1 -1
- package/dist/cartesian/bar/hooks/useBar.d.ts +31 -15
- package/dist/cartesian/bar/type.d.ts +46 -77
- package/dist/cartesian/brush/Brush.d.ts +150 -2
- package/dist/cartesian/brush/components/BrushText.d.ts +7 -7
- package/dist/cartesian/brush/components/Panorama.d.ts +7 -5
- package/dist/cartesian/brush/components/Slide.d.ts +4 -4
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +21 -13
- package/dist/cartesian/brush/hooks/useBrushHandlers.d.ts +3 -4
- package/dist/cartesian/brush/hooks/useBrushState.d.ts +16 -16
- package/dist/cartesian/brush/type.d.ts +14 -33
- package/dist/cartesian/brush/utils.d.ts +5 -6
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +37 -63
- package/dist/cartesian/cartesian-grid/Background.d.ts +1 -1
- package/dist/cartesian/cartesian-grid/CartesianGrid.d.ts +68 -16
- package/dist/cartesian/cartesian-grid/HorizontalGridLines.d.ts +18 -11
- package/dist/cartesian/cartesian-grid/HorizontalStripes.d.ts +6 -5
- package/dist/cartesian/cartesian-grid/VerticalGridLines.d.ts +17 -10
- package/dist/cartesian/cartesian-grid/VerticalStripes.d.ts +6 -5
- package/dist/cartesian/cartesian-grid/const.d.ts +2 -6
- package/dist/cartesian/cartesian-grid/type.d.ts +21 -30
- package/dist/cartesian/cartesian-grid/utils.d.ts +3 -1
- package/dist/cartesian/cartesianPositionToCSSTranslate.d.ts +1 -1
- package/dist/cartesian/error-bar/ErrorBar.d.ts +11 -30
- package/dist/cartesian/error-bar/ErrorBarContext.d.ts +12 -15
- package/dist/cartesian/funnel/Funnel.d.ts +161 -2
- package/dist/cartesian/funnel/type.d.ts +20 -57
- package/dist/cartesian/getCartesianPosition.d.ts +1 -3
- package/dist/cartesian/line/Line.d.ts +177 -77
- package/dist/cartesian/line/StaticLine.d.ts +0 -15
- package/dist/cartesian/line/hooks/useLine.d.ts +14 -15
- package/dist/cartesian/line/type.d.ts +52 -104
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +42 -90
- package/dist/cartesian/reference-dot/ReferenceDot.d.ts +21 -63
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +35 -67
- package/dist/cartesian/scatter/Scatter.d.ts +72 -53
- package/dist/cartesian/scatter/hooks/useScatter.d.ts +6 -5
- package/dist/cartesian/scatter/type.d.ts +89 -0
- package/dist/cartesian/useNeedsClip.d.ts +3 -2
- package/dist/cartesian/utils/get-ticks.d.ts +5 -6
- package/dist/cartesian/z-axis/ZAxis.d.ts +20 -21
- package/dist/chart/AreaChart.d.ts +231 -1
- package/dist/chart/BarChart.d.ts +231 -1
- package/dist/chart/BarList.d.ts +172 -0
- package/dist/chart/CalendarHeatmap.d.ts +308 -0
- package/dist/chart/CellGridLayer.d.ts +136 -0
- package/dist/chart/ChartShell.d.ts +85 -0
- package/dist/chart/ChartWrapper.d.ts +167 -0
- package/dist/chart/ChartsWrapper.d.ts +75 -87
- package/dist/chart/CohortChart.d.ts +254 -0
- package/dist/chart/ComposedChart.d.ts +231 -1
- package/dist/chart/FunnelChart.d.ts +201 -1
- package/dist/chart/Heatmap.d.ts +687 -0
- package/dist/chart/JourneySankey.d.ts +261 -0
- package/dist/chart/LineChart.d.ts +231 -1
- package/dist/chart/PieChart.d.ts +243 -1
- package/dist/chart/RadarChart.d.ts +243 -1
- package/dist/chart/RadialBarChart.d.ts +273 -1
- package/dist/chart/Sankey.d.ts +85 -157
- package/dist/chart/ScatterChart.d.ts +231 -1
- package/dist/chart/Sparkline.d.ts +257 -0
- package/dist/chart/SunburstChart.d.ts +101 -132
- package/dist/chart/Tracker.d.ts +211 -0
- package/dist/chart/Treemap.d.ts +101 -147
- package/dist/chart/cellGridProps.d.ts +40 -0
- package/dist/chart/cellGridUtils.d.ts +53 -0
- package/dist/chart/chartProps.d.ts +402 -0
- package/dist/chart/chartRoot.d.ts +144 -0
- package/dist/chart/const.d.ts +0 -2
- package/dist/chart/directChartTypes.d.ts +13 -0
- package/dist/chart/journeyTypes.d.ts +99 -0
- package/dist/chart/journeyUtils.d.ts +102 -0
- package/dist/chart/sankeyUtils.d.ts +2 -2
- package/dist/chart/shell.d.ts +14 -0
- package/dist/chart/sunburstUtils.d.ts +7 -3
- package/dist/chart/treemapUtils.d.ts +8 -6
- package/dist/componentNames.d.ts +2 -0
- package/dist/components/Cell.d.ts +1 -1
- package/dist/components/Customized.d.ts +12 -7
- package/dist/components/Text.d.ts +31 -31
- package/dist/components/label/Label.d.ts +14 -26
- package/dist/components/label/LabelList.d.ts +24 -14
- package/dist/components/label/LabelListView.d.ts +23 -0
- package/dist/components/label/LabelView.d.ts +79 -0
- package/dist/components/label/types.d.ts +70 -15
- package/dist/components/label/utils.d.ts +24 -12
- package/dist/components/legend/Legend.d.ts +109 -4
- package/dist/components/legend/LegendSymbol.d.ts +2 -3
- package/dist/components/legend/hooks/useLegend.d.ts +8 -10
- package/dist/components/legend/hooks/useLegendContent.d.ts +7 -14
- package/dist/components/legend/type.d.ts +17 -25
- package/dist/components/legend/utils.d.ts +4 -4
- package/dist/components/tooltip/Cursor.d.ts +19 -0
- package/dist/components/tooltip/DefaultTooltipContent.d.ts +35 -0
- package/dist/components/{Tooltip.d.ts → tooltip/Tooltip.d.ts} +72 -100
- package/dist/components/tooltip/TooltipBoundingBox.d.ts +40 -0
- package/dist/components/tooltip/types.d.ts +59 -0
- package/dist/components/types.d.ts +6 -6
- package/dist/components/utils.d.ts +3 -3
- package/dist/container/ClipPath.d.ts +1 -1
- package/dist/container/Layer.d.ts +1 -1
- package/dist/container/ResponsiveContainer.d.ts +10 -13
- package/dist/container/Surface.d.ts +9 -1
- package/dist/container/useSizeContext.d.ts +4 -10
- package/dist/context/cartesianLabelListContext.d.ts +6 -2
- package/dist/context/polarLabelViewBoxContext.d.ts +1 -1
- package/dist/core/area.d.ts +32 -0
- package/dist/core/axis/data.d.ts +28 -0
- package/dist/core/axis/domain.d.ts +11 -0
- package/dist/core/axis/key.d.ts +7 -0
- package/dist/core/axis/polar.d.ts +11 -0
- package/dist/core/axis/polarSettings.d.ts +5 -0
- package/dist/core/axis/position.d.ts +76 -0
- package/dist/core/axis/range.d.ts +8 -0
- package/dist/core/axis/references.d.ts +6 -0
- package/dist/core/axis/scale.d.ts +21 -0
- package/dist/core/axis/settings.d.ts +4 -0
- package/dist/core/axis/stacks.d.ts +14 -0
- package/dist/core/axis/ticks.d.ts +19 -0
- package/dist/core/axis/userDomain.d.ts +48 -0
- package/dist/core/bar.d.ts +22 -0
- package/dist/core/barSizing.d.ts +43 -0
- package/dist/core/color.d.ts +21 -0
- package/dist/core/coordinates.d.ts +34 -0
- package/dist/core/data.d.ts +2 -0
- package/dist/core/errorBar.d.ts +15 -0
- package/dist/core/funnel.d.ts +17 -0
- package/dist/core/interaction.d.ts +18 -0
- package/dist/core/layout.d.ts +43 -0
- package/dist/core/line.d.ts +14 -0
- package/dist/{state/selectors/pieSelectors.d.ts → core/pie.d.ts} +14 -16
- package/dist/core/polygon.d.ts +5 -0
- package/dist/core/radar.d.ts +20 -0
- package/dist/core/radialBar.d.ts +36 -0
- package/dist/core/rectangle.d.ts +10 -0
- package/dist/core/scatter.d.ts +18 -0
- package/dist/core/tooltip.d.ts +16 -0
- package/dist/es/animation/ActiveDot.mjs +39 -0
- package/dist/es/animation/MovingLabels.mjs +61 -0
- package/dist/es/animation/SweepClip.mjs +40 -0
- package/dist/es/animation/gridTransition.mjs +112 -0
- package/dist/es/animation/motion.mjs +100 -0
- package/dist/es/animation/ridingLabels.mjs +70 -0
- package/dist/es/animation/useAnimationCallbacks.mjs +23 -0
- package/dist/es/animation/useKeyedTransition.mjs +355 -0
- package/dist/es/animation/usePointTransition.mjs +119 -0
- package/dist/es/animation/useReducedMotion.mjs +12 -0
- package/dist/es/animation/useTickMotion.mjs +62 -0
- package/dist/es/cartesian/ActivePoints.mjs +65 -0
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +50 -9
- package/dist/es/cartesian/area/Area.mjs +72 -35
- package/dist/es/cartesian/area/RenderArea.mjs +112 -105
- package/dist/es/cartesian/area/hooks/useArea.mjs +44 -42
- package/dist/es/cartesian/area/type.mjs +14 -46
- package/dist/es/cartesian/axis/AxisProps.mjs +94 -0
- package/dist/es/cartesian/axis/XAxis.mjs +37 -159
- package/dist/es/cartesian/axis/YAxis.mjs +63 -167
- package/dist/es/cartesian/bar/Bar.mjs +122 -53
- package/dist/es/cartesian/bar/components/BarBackground.mjs +1 -1
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +188 -126
- package/dist/es/cartesian/bar/hooks/useBar.mjs +67 -31
- package/dist/es/cartesian/bar/type.mjs +4 -22
- package/dist/es/cartesian/brush/Brush.mjs +294 -0
- package/dist/es/cartesian/brush/components/Background.mjs +25 -0
- package/dist/es/cartesian/brush/components/BrushText.mjs +55 -0
- package/dist/es/cartesian/brush/components/Panorama.mjs +54 -0
- package/dist/es/cartesian/brush/components/Slide.mjs +40 -0
- package/dist/es/cartesian/brush/components/Traveller.mjs +46 -0
- package/dist/es/cartesian/brush/components/TravellerLayer.mjs +68 -0
- package/dist/es/cartesian/brush/hooks/useBrushHandlers.mjs +158 -0
- package/dist/es/cartesian/brush/hooks/useBrushState.mjs +67 -0
- package/dist/es/cartesian/brush/type.mjs +54 -0
- package/dist/es/cartesian/brush/utils.mjs +30 -0
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +27 -20
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +157 -72
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +5 -1
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +5 -1
- package/dist/es/cartesian/cartesian-grid/const.mjs +3 -320
- package/dist/es/cartesian/cartesian-grid/utils.mjs +1 -1
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +65 -102
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +21 -5
- package/dist/es/cartesian/funnel/Funnel.mjs +247 -127
- package/dist/es/cartesian/funnel/type.mjs +8 -14
- package/dist/es/cartesian/line/Line.mjs +72 -25
- package/dist/es/cartesian/line/StaticLine.mjs +129 -166
- package/dist/es/cartesian/line/hooks/useLine.mjs +38 -35
- package/dist/es/cartesian/line/type.mjs +5 -43
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +108 -88
- package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +87 -67
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -74
- package/dist/es/cartesian/scatter/Scatter.mjs +188 -190
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +25 -6
- package/dist/es/cartesian/scatter/type.mjs +79 -0
- package/dist/es/cartesian/useNeedsClip.mjs +6 -14
- package/dist/es/cartesian/utils/get-ticks.mjs +6 -6
- package/dist/es/cartesian/z-axis/ZAxis.mjs +7 -11
- package/dist/es/chart/AreaChart.mjs +12 -4
- package/dist/es/chart/BarChart.mjs +12 -4
- package/dist/es/chart/BarList.mjs +265 -0
- package/dist/es/chart/CalendarHeatmap.mjs +299 -0
- package/dist/es/chart/CellGridLayer.mjs +380 -0
- package/dist/es/chart/ChartShell.mjs +139 -0
- package/dist/es/chart/ChartWrapper.mjs +215 -0
- package/dist/es/chart/ChartsWrapper.mjs +21 -176
- package/dist/es/chart/CohortChart.mjs +169 -0
- package/dist/es/chart/ComposedChart.mjs +14 -4
- package/dist/es/chart/FunnelChart.mjs +11 -5
- package/dist/es/chart/Heatmap.mjs +319 -0
- package/dist/es/chart/JourneySankey.mjs +682 -0
- package/dist/es/chart/LineChart.mjs +13 -4
- package/dist/es/chart/PieChart.mjs +13 -9
- package/dist/es/chart/RadarChart.mjs +13 -9
- package/dist/es/chart/RadialBarChart.mjs +18 -10
- package/dist/es/chart/Sankey.mjs +355 -244
- package/dist/es/chart/ScatterChart.mjs +12 -4
- package/dist/es/chart/Sparkline.mjs +458 -0
- package/dist/es/chart/SunburstChart.mjs +215 -158
- package/dist/es/chart/Tracker.mjs +175 -0
- package/dist/es/chart/Treemap.mjs +357 -300
- package/dist/es/chart/cellGridProps.mjs +42 -0
- package/dist/es/chart/cellGridUtils.mjs +80 -0
- package/dist/es/chart/chartProps.mjs +88 -0
- package/dist/es/chart/chartRoot.mjs +153 -0
- package/dist/es/chart/journeyTypes.mjs +90 -0
- package/dist/es/chart/journeyUtils.mjs +223 -0
- package/dist/es/chart/sankeyUtils.mjs +52 -1
- package/dist/es/chart/shell.mjs +30 -0
- package/dist/es/chart/sunburstUtils.mjs +14 -9
- package/dist/es/chart/treemapUtils.mjs +10 -8
- package/dist/es/componentNames.mjs +84 -0
- package/dist/es/components/Cell.mjs +3 -2
- package/dist/es/components/Customized.mjs +14 -9
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +16 -10
- package/dist/es/components/label/Label.mjs +12 -30
- package/dist/es/components/label/LabelList.mjs +13 -48
- package/dist/es/components/label/LabelListView.mjs +73 -0
- package/dist/es/components/label/LabelView.mjs +45 -0
- package/dist/es/components/label/types.mjs +10 -5
- package/dist/es/components/label/utils.mjs +39 -19
- package/dist/es/components/legend/Legend.mjs +101 -36
- package/dist/es/components/legend/LegendSymbol.mjs +2 -2
- package/dist/es/components/legend/hooks/useLegend.mjs +39 -60
- package/dist/es/components/legend/hooks/useLegendContent.mjs +1 -13
- package/dist/es/components/legend/type.mjs +11 -9
- package/dist/es/components/legend/utils.mjs +8 -4
- package/dist/es/components/tooltip/Cursor.mjs +118 -0
- package/dist/es/components/tooltip/DefaultTooltipContent.mjs +107 -0
- package/dist/es/components/tooltip/Tooltip.mjs +229 -0
- package/dist/es/components/tooltip/TooltipBoundingBox.mjs +187 -0
- package/dist/es/components/utils.mjs +26 -27
- package/dist/es/container/ClipPath.mjs +2 -2
- package/dist/es/container/Layer.mjs +2 -2
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +20 -106
- package/dist/es/container/Surface.mjs +46 -7
- package/dist/es/container/useSizeContext.mjs +12 -3
- package/dist/es/context/cartesianLabelListContext.mjs +11 -2
- package/dist/es/{cartesian/area/utils.mjs → core/area.mjs} +5 -4
- package/dist/es/core/axis/data.mjs +75 -0
- package/dist/es/core/axis/domain.mjs +63 -0
- package/dist/es/core/axis/key.mjs +13 -0
- package/dist/es/core/axis/polar.mjs +16 -0
- package/dist/es/core/axis/polarSettings.mjs +100 -0
- package/dist/es/core/axis/position.mjs +51 -0
- package/dist/es/core/axis/range.mjs +46 -0
- package/dist/es/core/axis/references.mjs +26 -0
- package/dist/es/core/axis/scale.mjs +148 -0
- package/dist/es/core/axis/settings.mjs +76 -0
- package/dist/es/core/axis/stacks.mjs +97 -0
- package/dist/es/core/axis/ticks.mjs +82 -0
- package/dist/es/{utils/isDomainSpecifiedByUser.mjs → core/axis/userDomain.mjs} +5 -4
- package/dist/es/{cartesian/bar/utils.mjs → core/bar.mjs} +19 -16
- package/dist/es/core/barSizing.mjs +108 -0
- package/dist/es/core/color.mjs +23 -0
- package/dist/es/core/coordinates.mjs +57 -0
- package/dist/es/core/data.mjs +20 -0
- package/dist/es/core/errorBar.mjs +56 -0
- package/dist/es/{cartesian/funnel/utils.mjs → core/funnel.mjs} +31 -11
- package/dist/es/core/interaction.mjs +152 -0
- package/dist/es/core/layout.mjs +91 -0
- package/dist/es/{cartesian/line/utils.mjs → core/line.mjs} +7 -6
- package/dist/es/{state/selectors/pieSelectors.mjs → core/pie.mjs} +37 -65
- package/dist/es/core/polygon.mjs +7 -0
- package/dist/es/core/radar.mjs +58 -0
- package/dist/es/core/radialBar.mjs +92 -0
- package/dist/es/core/rectangle.mjs +25 -0
- package/dist/es/core/scatter.mjs +86 -0
- package/dist/es/core/tooltip.mjs +96 -0
- package/dist/es/events/componentEvents.mjs +58 -0
- package/dist/es/events/delegateItemEvents.mjs +24 -0
- package/dist/es/events/itemEvents.mjs +34 -0
- package/dist/es/events/sync.mjs +140 -0
- package/dist/es/events/useChartCallbacks.mjs +24 -0
- package/dist/es/events/useChartInteractions.mjs +143 -0
- package/dist/es/events/useItemInteractions.mjs +58 -0
- package/dist/es/events/useItemKeyboard.mjs +45 -0
- package/dist/es/events/usePointEvents.mjs +55 -0
- package/dist/es/hooks/deferredView.mjs +19 -0
- package/dist/es/hooks/publicHooks.mjs +36 -35
- package/dist/es/hooks/useActiveTooltipDataPoints.mjs +10 -0
- package/dist/es/hooks/useChartId.mjs +8 -0
- package/dist/es/hooks/useLayerTeleport.mjs +10 -0
- package/dist/es/hooks/useResponsiveSize.mjs +72 -15
- package/dist/es/hooks/useRoundedSize.mjs +0 -3
- package/dist/es/hooks/useSeriesProps.mjs +32 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +74 -44
- package/dist/es/hooks/useTrackedData.mjs +17 -0
- package/dist/es/index.mjs +37 -23
- package/dist/es/model/animation.mjs +11 -0
- package/dist/es/model/axis.mjs +85 -0
- package/dist/es/model/axisLayout.mjs +27 -0
- package/dist/es/model/axisScale.mjs +52 -0
- package/dist/es/model/brush.mjs +27 -0
- package/dist/es/model/chart.mjs +122 -0
- package/dist/es/model/dataRange.mjs +54 -0
- package/dist/es/model/defaults.mjs +28 -0
- package/dist/es/model/layout.mjs +33 -0
- package/dist/es/model/legend.mjs +30 -0
- package/dist/es/model/options.mjs +8 -0
- package/dist/es/model/polar.mjs +29 -0
- package/dist/es/model/polarAxis.mjs +48 -0
- package/dist/es/model/presentation.mjs +13 -0
- package/dist/es/model/registries.mjs +38 -0
- package/dist/es/model/registry.mjs +20 -0
- package/dist/es/model/runtime.mjs +156 -0
- package/dist/es/model/tooltip.mjs +383 -0
- package/dist/es/nuxt.mjs +28 -0
- package/dist/es/polar/pie/Pie.mjs +260 -112
- package/dist/es/polar/pie/type.mjs +19 -8
- package/dist/es/polar/radar/PolarAngleAxis.mjs +117 -99
- package/dist/es/polar/radar/PolarGrid.mjs +73 -50
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +124 -100
- package/dist/es/polar/radar/Radar.mjs +272 -219
- package/dist/es/polar/radial-bar/RadialBar.mjs +248 -130
- package/dist/es/polar/radial-bar/type.mjs +6 -7
- package/dist/es/resolver.mjs +19 -0
- package/dist/es/shape/Cross.mjs +2 -1
- package/dist/es/shape/Curve.mjs +7 -5
- package/dist/es/shape/Dot.mjs +9 -5
- package/dist/es/shape/Polygon.mjs +4 -7
- package/dist/es/shape/Rectangle.mjs +17 -10
- package/dist/es/shape/Sector.mjs +7 -4
- package/dist/es/shape/Symbols.mjs +13 -8
- package/dist/es/shape/Trapezoid.mjs +3 -1
- package/dist/es/typed.mjs +9 -0
- package/dist/es/types/base.mjs +6 -0
- package/dist/es/utils/ReduceCSSCalc.mjs +2 -2
- package/dist/es/utils/VueUtils.mjs +89 -3
- package/dist/es/utils/attributes.mjs +18 -0
- package/dist/es/utils/attrs.mjs +38 -26
- package/dist/es/utils/cartesian.mjs +1 -21
- package/dist/es/utils/cell.mjs +13 -1
- package/dist/es/utils/chart.mjs +3 -361
- package/dist/es/utils/const.mjs +2 -25
- package/dist/es/utils/createCategoricalInverse.mjs +2 -2
- package/dist/es/utils/data-utils.mjs +2 -6
- package/dist/es/utils/data.mjs +1 -1
- package/dist/es/utils/env.mjs +10 -0
- package/dist/es/utils/events.mjs +29 -2
- package/dist/es/utils/labelColor.mjs +16 -0
- package/dist/es/utils/log.mjs +23 -5
- package/dist/es/utils/pointer.mjs +13 -0
- package/dist/es/utils/polar.mjs +7 -2
- package/dist/es/utils/scale/getNiceTickValues.mjs +8 -8
- package/dist/es/utils/scale/utils/arithmetic.mjs +0 -15
- package/dist/es/utils/scale/utils/utils.mjs +9 -44
- package/dist/es/utils/style.mjs +1 -1
- package/dist/es/utils/svg.mjs +320 -0
- package/dist/es/utils/theme.mjs +50 -0
- package/dist/es/utils/tick.mjs +4 -3
- package/dist/es/utils/validate.mjs +21 -3
- package/dist/events/componentEvents.d.ts +60 -0
- package/dist/events/delegateItemEvents.d.ts +12 -0
- package/dist/events/itemEvents.d.ts +100 -0
- package/dist/events/sync.d.ts +6 -0
- package/dist/events/useChartCallbacks.d.ts +2 -0
- package/dist/events/useChartInteractions.d.ts +8 -0
- package/dist/events/useItemInteractions.d.ts +7 -0
- package/dist/events/useItemKeyboard.d.ts +24 -0
- package/dist/events/usePointEvents.d.ts +23 -0
- package/dist/hooks/deferredView.d.ts +12 -0
- package/dist/hooks/publicHooks.d.ts +27 -29
- package/dist/hooks/useActiveTooltipDataPoints.d.ts +2 -0
- package/dist/hooks/useChartId.d.ts +2 -0
- package/dist/hooks/useLayerTeleport.d.ts +5 -0
- package/dist/hooks/useResponsiveSize.d.ts +33 -18
- package/dist/hooks/useRoundedSize.d.ts +0 -3
- package/dist/hooks/useSeriesProps.d.ts +7 -0
- package/dist/hooks/useSetupGraphicalItem.d.ts +35 -4
- package/dist/hooks/useTrackedData.d.ts +3 -0
- package/dist/index.d.ts +130 -9
- package/dist/model/animation.d.ts +7 -0
- package/dist/model/axis.d.ts +29 -0
- package/dist/model/axisLayout.d.ts +85 -0
- package/dist/model/axisScale.d.ts +41 -0
- package/dist/model/brush.d.ts +17 -0
- package/dist/model/chart.d.ts +44 -0
- package/dist/model/dataRange.d.ts +19 -0
- package/dist/model/defaults.d.ts +7 -0
- package/dist/model/layout.d.ts +38 -0
- package/dist/model/legend.d.ts +28 -0
- package/dist/model/options.d.ts +30 -0
- package/dist/model/polar.d.ts +24 -0
- package/dist/model/polarAxis.d.ts +39 -0
- package/dist/model/presentation.d.ts +19 -0
- package/dist/model/registries.d.ts +27 -0
- package/dist/model/registry.d.ts +7 -0
- package/dist/model/runtime.d.ts +76 -0
- package/dist/model/tooltip.d.ts +437 -0
- package/dist/nuxt.d.ts +7 -0
- package/dist/polar/pie/Pie.d.ts +252 -2
- package/dist/polar/pie/type.d.ts +37 -25
- package/dist/polar/radar/PolarAngleAxis.d.ts +36 -39
- package/dist/polar/radar/PolarGrid.d.ts +10 -8
- package/dist/polar/radar/PolarRadiusAxis.d.ts +30 -28
- package/dist/polar/radar/Radar.d.ts +82 -53
- package/dist/polar/radial-bar/RadialBar.d.ts +251 -2
- package/dist/polar/radial-bar/type.d.ts +26 -26
- package/dist/publicProps.d.ts +96 -0
- package/dist/resolver.d.ts +9 -0
- package/dist/shape/Cross.d.ts +2 -1
- package/dist/shape/Curve.d.ts +8 -19
- package/dist/shape/Dot.d.ts +10 -6
- package/dist/shape/Polygon.d.ts +2 -1
- package/dist/shape/Rectangle.d.ts +9 -8
- package/dist/shape/Sector.d.ts +7 -6
- package/dist/shape/Symbols.d.ts +3 -3
- package/dist/shape/Trapezoid.d.ts +5 -5
- package/dist/typed.d.ts +92 -0
- package/dist/types/area.d.ts +5 -6
- package/dist/types/axis.d.ts +9 -36
- package/dist/types/axisSettings.d.ts +20 -0
- package/dist/types/bar.d.ts +17 -7
- package/dist/types/base.d.ts +46 -0
- package/dist/types/categorical.d.ts +5 -7
- package/dist/types/chartData.d.ts +21 -0
- package/dist/types/chartLayout.d.ts +7 -0
- package/dist/{state/rootPropsSlice.d.ts → types/chartOptions.d.ts} +4 -5
- package/dist/types/common.d.ts +16 -55
- package/dist/types/event.d.ts +2 -15
- package/dist/types/funnel.d.ts +23 -0
- package/dist/types/graphical.d.ts +77 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/legend.d.ts +17 -0
- package/dist/types/line.d.ts +6 -0
- package/dist/types/polarOptions.d.ts +8 -0
- package/dist/types/radar.d.ts +4 -4
- package/dist/types/radialBar.d.ts +15 -0
- package/dist/types/reference.d.ts +22 -0
- package/dist/types/scale.d.ts +13 -2
- package/dist/{shape/types.d.ts → types/shape.d.ts} +6 -4
- package/dist/types/tick.d.ts +18 -7
- package/dist/types/tooltip.d.ts +181 -14
- package/dist/types/typed.d.ts +16 -0
- package/dist/{cartesian/type.d.ts → types/viewBox.d.ts} +0 -2
- package/dist/utils/ReduceCSSCalc.d.ts +0 -1
- package/dist/utils/VueUtils.d.ts +6 -9
- package/dist/utils/attributes.d.ts +56 -0
- package/dist/utils/attrs.d.ts +4 -45
- package/dist/utils/cartesian.d.ts +2 -16
- package/dist/utils/cell.d.ts +7 -2
- package/dist/utils/chart.d.ts +2 -99
- package/dist/utils/const.d.ts +1 -24
- package/dist/utils/createCategoricalInverse.d.ts +2 -6
- package/dist/utils/data-utils.d.ts +0 -1
- package/dist/utils/data.d.ts +1 -2
- package/dist/utils/env.d.ts +5 -0
- package/dist/utils/events.d.ts +14 -7
- package/dist/utils/grid.d.ts +1 -28
- package/dist/utils/index.d.ts +4 -5
- package/dist/utils/isDomainSpecifiedByUser.d.ts +1 -47
- package/dist/utils/labelColor.d.ts +2 -0
- package/dist/utils/log.d.ts +2 -1
- package/dist/utils/pointer.d.ts +2 -0
- package/dist/utils/polar.d.ts +2 -4
- package/dist/utils/scale/getNiceTickValues.d.ts +2 -61
- package/dist/utils/scale/utils/arithmetic.d.ts +3 -31
- package/dist/utils/scale/utils/utils.d.ts +2 -9
- package/dist/utils/scale.d.ts +1 -1
- package/dist/utils/style.d.ts +2 -1
- package/dist/utils/svg.d.ts +4 -0
- package/dist/utils/theme.d.ts +4 -0
- package/dist/utils/tick.d.ts +3 -3
- package/dist/utils/tooltip/translate.d.ts +9 -25
- package/dist/utils/validate.d.ts +12 -4
- package/package.json +46 -29
- package/dist/animation/Animate.d.ts +0 -72
- package/dist/cartesian/area/ActivePoints.d.ts +0 -77
- package/dist/cartesian/area/ClipRect.d.ts +0 -1
- package/dist/cartesian/area/__stories__/config.d.ts +0 -31
- package/dist/cartesian/area/index.d.ts +0 -2
- package/dist/cartesian/area/utils.d.ts +0 -19
- package/dist/cartesian/axis/index.d.ts +0 -2
- package/dist/cartesian/axis/type.d.ts +0 -57
- package/dist/cartesian/bar/index.d.ts +0 -1
- package/dist/cartesian/bar/utils.d.ts +0 -31
- package/dist/cartesian/brush/hooks/useBrushSetting.d.ts +0 -6
- package/dist/cartesian/brush/index.d.ts +0 -2
- package/dist/cartesian/cartesian-axis/const.d.ts +0 -24
- package/dist/cartesian/cartesian-axis/index.d.ts +0 -1
- package/dist/cartesian/cartesian-axis/use-axis-line.d.ts +0 -7
- package/dist/cartesian/cartesian-grid/index.d.ts +0 -1
- package/dist/cartesian/error-bar/index.d.ts +0 -2
- package/dist/cartesian/funnel/index.d.ts +0 -2
- package/dist/cartesian/funnel/utils.d.ts +0 -12
- package/dist/cartesian/index.d.ts +0 -14
- package/dist/cartesian/line/ActivePoints.d.ts +0 -77
- package/dist/cartesian/line/index.d.ts +0 -3
- package/dist/cartesian/line/utils.d.ts +0 -13
- package/dist/cartesian/reference-area/index.d.ts +0 -1
- package/dist/cartesian/reference-dot/index.d.ts +0 -2
- package/dist/cartesian/reference-line/index.d.ts +0 -1
- package/dist/cartesian/scatter/index.d.ts +0 -1
- package/dist/cartesian/z-axis/index.d.ts +0 -1
- package/dist/chart/LegendPortalContext.d.ts +0 -3
- package/dist/chart/Surface.d.ts +0 -41
- package/dist/chart/TooltipPortalContext.d.ts +0 -2
- package/dist/chart/generateCategoricalChart.d.ts +0 -123
- package/dist/chart/index.d.ts +0 -12
- package/dist/chart/provideClipPathId.d.ts +0 -12
- package/dist/components/DefaultLegendContent.d.ts +0 -18
- package/dist/components/index.d.ts +0 -6
- package/dist/components/label/index.d.ts +0 -2
- package/dist/components/legend/index.d.ts +0 -2
- package/dist/container/RootSurface.d.ts +0 -17
- package/dist/container/index.d.ts +0 -1
- package/dist/context/ChartDataContextProvider.d.ts +0 -17
- package/dist/context/PanoramaContextProvider.d.ts +0 -22
- package/dist/context/accessibilityContext.d.ts +0 -1
- package/dist/context/chartLayoutContext.d.ts +0 -8
- package/dist/context/cursorLayerContext.d.ts +0 -2
- package/dist/context/graphicalLayerContext.d.ts +0 -2
- package/dist/context/labelLayerContext.d.ts +0 -2
- package/dist/context/useTooltipAxis.d.ts +0 -2
- package/dist/es/animation/Animate.mjs +0 -89
- package/dist/es/cartesian/area/ActivePoints.mjs +0 -78
- package/dist/es/cartesian/area/ClipRect.mjs +0 -125
- package/dist/es/cartesian/line/ActivePoints.mjs +0 -79
- package/dist/es/chart/LegendPortalContext.mjs +0 -5
- package/dist/es/chart/Surface.mjs +0 -5
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +0 -78
- package/dist/es/chart/TooltipPortalContext.mjs +0 -5
- package/dist/es/chart/generateCategoricalChart.mjs +0 -184
- package/dist/es/chart/provideClipPathId.mjs +0 -15
- package/dist/es/components/Tooltip.mjs +0 -479
- package/dist/es/context/ChartDataContextProvider.mjs +0 -27
- package/dist/es/context/PanoramaContextProvider.mjs +0 -24
- package/dist/es/context/accessibilityContext.mjs +0 -5
- package/dist/es/context/chartLayoutContext.mjs +0 -49
- package/dist/es/context/cursorLayerContext.mjs +0 -5
- package/dist/es/context/graphicalLayerContext.mjs +0 -5
- package/dist/es/context/labelLayerContext.mjs +0 -5
- package/dist/es/context/useTooltipAxis.mjs +0 -17
- package/dist/es/events/useChartSynchronisation.mjs +0 -113
- package/dist/es/hooks/useIsAnimating.mjs +0 -28
- package/dist/es/state/ReportChartProps.mjs +0 -62
- package/dist/es/state/ReportMainChartProps.mjs +0 -46
- package/dist/es/state/ReportPolarOptions.mjs +0 -56
- package/dist/es/state/SetGraphicalItem.mjs +0 -49
- package/dist/es/state/SetLegendPayload.mjs +0 -20
- package/dist/es/state/SetTooltipEntrySettings.mjs +0 -19
- package/dist/es/state/brushSlice.mjs +0 -26
- package/dist/es/state/cartesianAxisSlice.mjs +0 -50
- package/dist/es/state/chartDataSlice.mjs +0 -33
- package/dist/es/state/externalEventsMiddleware.mjs +0 -30
- package/dist/es/state/graphicalItemsSlice.mjs +0 -47
- package/dist/es/state/hooks.mjs +0 -26
- package/dist/es/state/keyboardEventsMiddleware.mjs +0 -63
- package/dist/es/state/layoutSlice.mjs +0 -39
- package/dist/es/state/legendSlice.mjs +0 -42
- package/dist/es/state/mouseEventsMiddleware.mjs +0 -41
- package/dist/es/state/optionsSlice.mjs +0 -25
- package/dist/es/state/polarAxisSlice.mjs +0 -28
- package/dist/es/state/polarOptionsSlice.mjs +0 -13
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +0 -8
- package/dist/es/state/referenceElementsSlice.mjs +0 -36
- package/dist/es/state/rootPropsSlice.mjs +0 -32
- package/dist/es/state/selectors/areaSelectors.mjs +0 -77
- package/dist/es/state/selectors/axisSelectors.mjs +0 -908
- package/dist/es/state/selectors/barSelectors.mjs +0 -241
- package/dist/es/state/selectors/brushSelectors.mjs +0 -18
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +0 -9
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +0 -43
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +0 -8
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +0 -21
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +0 -37
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +0 -13
- package/dist/es/state/selectors/common.mjs +0 -4
- package/dist/es/state/selectors/containerSelectors.mjs +0 -7
- package/dist/es/state/selectors/dataSelectors.mjs +0 -35
- package/dist/es/state/selectors/funnelSelectors.mjs +0 -38
- package/dist/es/state/selectors/legendSelectors.mjs +0 -10
- package/dist/es/state/selectors/lineSelectors.mjs +0 -64
- package/dist/es/state/selectors/pickAxisId.mjs +0 -4
- package/dist/es/state/selectors/pickAxisType.mjs +0 -4
- package/dist/es/state/selectors/polarAxisSelectors.mjs +0 -167
- package/dist/es/state/selectors/polarGridSelectors.mjs +0 -19
- package/dist/es/state/selectors/polarScaleSelectors.mjs +0 -55
- package/dist/es/state/selectors/polarSelectors.mjs +0 -81
- package/dist/es/state/selectors/radarSelectors.mjs +0 -133
- package/dist/es/state/selectors/radialBarSelectors.mjs +0 -259
- package/dist/es/state/selectors/rootPropsSelectors.mjs +0 -14
- package/dist/es/state/selectors/scatterSelectors.mjs +0 -134
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +0 -20
- package/dist/es/state/selectors/selectAllAxes.mjs +0 -10
- package/dist/es/state/selectors/selectChartOffset.mjs +0 -72
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +0 -66
- package/dist/es/state/selectors/selectLegendArea.mjs +0 -19
- package/dist/es/state/selectors/selectTooltipEventType.mjs +0 -22
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +0 -6
- package/dist/es/state/selectors/selectTooltipSettings.mjs +0 -4
- package/dist/es/state/selectors/selectTooltipState.mjs +0 -4
- package/dist/es/state/selectors/selectors.mjs +0 -104
- package/dist/es/state/selectors/tooltipSelectors.mjs +0 -269
- package/dist/es/state/selectors/touchSelectors.mjs +0 -19
- package/dist/es/state/store.mjs +0 -55
- package/dist/es/state/tooltipSlice.mjs +0 -102
- package/dist/es/state/touchEventsMiddleware.mjs +0 -44
- package/dist/es/state/utils/useReportScale.mjs +0 -19
- package/dist/es/synchronisation/syncSelectors.mjs +0 -6
- package/dist/es/synchronisation/useChartSynchronisation.mjs +0 -38
- package/dist/es/utils/Global.mjs +0 -18
- package/dist/es/utils/createContext.mjs +0 -31
- package/dist/es/utils/legend.mjs +0 -41
- package/dist/es/utils/props.mjs +0 -20
- package/dist/es/utils/resolveDefaultProps.mjs +0 -26
- package/dist/events/useChartSynchronisation.d.ts +0 -8
- package/dist/hooks/useIsAnimating.d.ts +0 -14
- package/dist/polar/index.d.ts +0 -3
- package/dist/polar/pie/index.d.ts +0 -2
- package/dist/polar/radar/index.d.ts +0 -4
- package/dist/polar/radial-bar/index.d.ts +0 -2
- package/dist/shape/index.d.ts +0 -10
- package/dist/state/ReportBar.d.ts +0 -1
- package/dist/state/ReportChartProps.d.ts +0 -88
- package/dist/state/ReportMainChartProps.d.ts +0 -37
- package/dist/state/ReportPolarOptions.d.ts +0 -59
- package/dist/state/SetGraphicalItem.d.ts +0 -9
- package/dist/state/SetLegendPayload.d.ts +0 -3
- package/dist/state/SetTooltipEntrySettings.d.ts +0 -8
- package/dist/state/brushSlice.d.ts +0 -18
- package/dist/state/cartesianAxisSlice.d.ts +0 -96
- package/dist/state/chartDataSlice.d.ts +0 -44
- package/dist/state/externalEventsMiddleware.d.ts +0 -17
- package/dist/state/graphicalItemsSlice.d.ts +0 -108
- package/dist/state/hooks.d.ts +0 -54
- package/dist/state/keyboardEventsMiddleware.d.ts +0 -3
- package/dist/state/layoutSlice.d.ts +0 -15
- package/dist/state/legendSlice.d.ts +0 -29
- package/dist/state/mouseEventsMiddleware.d.ts +0 -5
- package/dist/state/optionsSlice.d.ts +0 -27
- package/dist/state/polarAxisSlice.d.ts +0 -10
- package/dist/state/polarOptionsSlice.d.ts +0 -10
- package/dist/state/reduxDevtoolsJsonStringifyReplacer.d.ts +0 -1
- package/dist/state/referenceElementsSlice.d.ts +0 -40
- package/dist/state/selectors/areaSelectors.d.ts +0 -24
- package/dist/state/selectors/axisSelectors.d.ts +0 -1833
- package/dist/state/selectors/barSelectors.d.ts +0 -944
- package/dist/state/selectors/brushSelectors.d.ts +0 -10
- package/dist/state/selectors/combiners/combineActiveLabel.d.ts +0 -3
- package/dist/state/selectors/combiners/combineActiveTooltipIndex.d.ts +0 -5
- package/dist/state/selectors/combiners/combineAxisRangeWithReverse.d.ts +0 -3
- package/dist/state/selectors/combiners/combineCoordinateForDefaultIndex.d.ts +0 -3
- package/dist/state/selectors/combiners/combineTooltipInteractionState.d.ts +0 -3
- package/dist/state/selectors/combiners/combineTooltipPayloadConfigurations.d.ts +0 -3
- package/dist/state/selectors/common.d.ts +0 -2
- package/dist/state/selectors/containerSelectors.d.ts +0 -6
- package/dist/state/selectors/dataSelectors.d.ts +0 -23
- package/dist/state/selectors/funnelSelectors.d.ts +0 -69
- package/dist/state/selectors/legendSelectors.d.ts +0 -7
- package/dist/state/selectors/lineSelectors.d.ts +0 -123
- package/dist/state/selectors/pickAxisId.d.ts +0 -3
- package/dist/state/selectors/pickAxisType.d.ts +0 -2
- package/dist/state/selectors/polarAxisSelectors.d.ts +0 -49
- package/dist/state/selectors/polarGridSelectors.d.ts +0 -118
- package/dist/state/selectors/polarScaleSelectors.d.ts +0 -9
- package/dist/state/selectors/polarSelectors.d.ts +0 -70
- package/dist/state/selectors/radarSelectors.d.ts +0 -76
- package/dist/state/selectors/radialBarSelectors.d.ts +0 -61
- package/dist/state/selectors/rootPropsSelectors.d.ts +0 -11
- package/dist/state/selectors/scatterSelectors.d.ts +0 -21
- package/dist/state/selectors/selectActivePropsFromChartPointer.d.ts +0 -382
- package/dist/state/selectors/selectAllAxes.d.ts +0 -4
- package/dist/state/selectors/selectChartOffset.d.ts +0 -116
- package/dist/state/selectors/selectChartOffsetInternal.d.ts +0 -9
- package/dist/state/selectors/selectLegendArea.d.ts +0 -7
- package/dist/state/selectors/selectTooltipEventType.d.ts +0 -8
- package/dist/state/selectors/selectTooltipPayloadSearcher.d.ts +0 -3
- package/dist/state/selectors/selectTooltipSettings.d.ts +0 -3
- package/dist/state/selectors/selectTooltipState.d.ts +0 -3
- package/dist/state/selectors/selectors.d.ts +0 -184
- package/dist/state/selectors/tooltipSelectors.d.ts +0 -581
- package/dist/state/selectors/touchSelectors.d.ts +0 -4
- package/dist/state/store.d.ts +0 -74
- package/dist/state/tooltipSlice.d.ts +0 -204
- package/dist/state/touchEventsMiddleware.d.ts +0 -2
- package/dist/state/utils/useReportScale.d.ts +0 -1
- package/dist/synchronisation/syncSelectors.d.ts +0 -3
- package/dist/synchronisation/useChartSynchronisation.d.ts +0 -11
- package/dist/types/offset.d.ts +0 -8
- package/dist/utils/Global.d.ts +0 -9
- package/dist/utils/context.d.ts +0 -8
- package/dist/utils/createContext.d.ts +0 -8
- package/dist/utils/legend.d.ts +0 -3
- package/dist/utils/props.d.ts +0 -15
- package/dist/utils/resolveDefaultProps.d.ts +0 -52
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
import { toFiniteNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { useTooltipController } from "../model/tooltip.mjs";
|
|
3
|
+
import { useTrackedData } from "../hooks/useTrackedData.mjs";
|
|
4
|
+
import { getValueByDataKey } from "../utils/chart.mjs";
|
|
5
|
+
import { useAnimationCallbacks } from "../animation/useAnimationCallbacks.mjs";
|
|
6
|
+
import { useReducedMotion } from "../animation/useReducedMotion.mjs";
|
|
7
|
+
import { motionTokens } from "../animation/motion.mjs";
|
|
8
|
+
import { useKeyedTransition } from "../animation/useKeyedTransition.mjs";
|
|
9
|
+
import { chartEmits, chartListeners } from "../events/componentEvents.mjs";
|
|
10
|
+
import { chartSizeProps } from "../hooks/useResponsiveSize.mjs";
|
|
11
|
+
import { standaloneChartOptions } from "./shell.mjs";
|
|
12
|
+
import { ChartShell, useChartShell } from "./ChartShell.mjs";
|
|
13
|
+
import { useItemKeyboard } from "../events/useItemKeyboard.mjs";
|
|
14
|
+
import { computeJourneyLayout, connectedLinks, journeyLinksOf, journeyNodeId, largestJourneyThrough, reorderedNodes, truncateMiddle } from "./journeyUtils.mjs";
|
|
15
|
+
import { JourneySankeyVueProps } from "./journeyTypes.mjs";
|
|
16
|
+
import { computed, createVNode, defineComponent, mergeProps, reactive, ref, toRaw, toRefs, watch } from "vue";
|
|
17
|
+
//#region src/chart/JourneySankey.tsx
|
|
18
|
+
var HEADER_BAND = 28;
|
|
19
|
+
var LABEL_HEIGHT = 34;
|
|
20
|
+
var CHAR_WIDTH = 6.6;
|
|
21
|
+
var CURVATURE = .42;
|
|
22
|
+
var journeyEmits = {
|
|
23
|
+
"update:pinned": (_path) => true,
|
|
24
|
+
"node-click": (_node, _index, _event) => true,
|
|
25
|
+
"node-mouseenter": (_node, _index, _event) => true,
|
|
26
|
+
"node-mouseleave": (_node, _index, _event) => true,
|
|
27
|
+
"link-click": (_link, _index, _event) => true,
|
|
28
|
+
"link-mouseenter": (_link, _index, _event) => true,
|
|
29
|
+
"link-mouseleave": (_link, _index, _event) => true,
|
|
30
|
+
"animation-start": () => true,
|
|
31
|
+
"animation-end": () => true
|
|
32
|
+
};
|
|
33
|
+
/** `fade` is the entrance's own opacity; absent outside the first appearance. */
|
|
34
|
+
/** The drawing, set up inside the measured surface so its scope follows the surface's. */
|
|
35
|
+
function useJourneySankey(props, slots, emit) {
|
|
36
|
+
const tooltip = useTooltipController();
|
|
37
|
+
const reducedMotion = useReducedMotion();
|
|
38
|
+
const rows = useTrackedData(() => props.data);
|
|
39
|
+
const numbers = computed(() => new Intl.NumberFormat(props.locale));
|
|
40
|
+
const percent = computed(() => new Intl.NumberFormat(props.locale, { maximumFractionDigits: 1 }));
|
|
41
|
+
const wholePercent = computed(() => new Intl.NumberFormat(props.locale, { maximumFractionDigits: 0 }));
|
|
42
|
+
const journeys = computed(() => (rows.value ?? []).flatMap((row) => {
|
|
43
|
+
const path = getValueByDataKey(row, props.pathKey);
|
|
44
|
+
const count = toFiniteNumber(getValueByDataKey(row, props.dataKey));
|
|
45
|
+
return Array.isArray(path) && count !== void 0 && count > 0 ? [{
|
|
46
|
+
path: path.map(String),
|
|
47
|
+
count,
|
|
48
|
+
rows: [row]
|
|
49
|
+
}] : [];
|
|
50
|
+
}));
|
|
51
|
+
const stepCount = computed(() => props.steps ?? Math.max(1, ...journeys.value.map((journey) => journey.path.length)));
|
|
52
|
+
const labelWidth = computed(() => Math.min(200, Math.max(120, props.width * .2)));
|
|
53
|
+
const layout = computed(() => computeJourneyLayout(journeys.value, {
|
|
54
|
+
width: props.width,
|
|
55
|
+
height: props.height,
|
|
56
|
+
steps: stepCount.value,
|
|
57
|
+
exitsKnown: props.exitsKnown,
|
|
58
|
+
nodeWidth: props.nodeWidth,
|
|
59
|
+
nodePadding: props.nodePadding,
|
|
60
|
+
labelHeight: LABEL_HEIGHT,
|
|
61
|
+
labelWidth: labelWidth.value,
|
|
62
|
+
top: props.headers ? HEADER_BAND : 0
|
|
63
|
+
}));
|
|
64
|
+
let reordered = /* @__PURE__ */ new Set();
|
|
65
|
+
let previousNodes = [];
|
|
66
|
+
let foldTargets = /* @__PURE__ */ new Map();
|
|
67
|
+
let unfoldStarts = /* @__PURE__ */ new Map();
|
|
68
|
+
watch(layout, ({ nodes }) => {
|
|
69
|
+
reordered = reorderedNodes(previousNodes, nodes);
|
|
70
|
+
foldTargets = foldAnchors(previousNodes, nodes);
|
|
71
|
+
unfoldStarts = foldAnchors(nodes, previousNodes);
|
|
72
|
+
previousNodes = nodes;
|
|
73
|
+
}, {
|
|
74
|
+
immediate: true,
|
|
75
|
+
flush: "sync"
|
|
76
|
+
});
|
|
77
|
+
function foldAnchors(from, to) {
|
|
78
|
+
if (!reordered.size) return /* @__PURE__ */ new Map();
|
|
79
|
+
const target = new Map(to.map((node) => [node.id, node]));
|
|
80
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
81
|
+
for (const node of from) {
|
|
82
|
+
const neighbours = from.filter((other) => other.step === node.step && other.id !== node.id && target.has(other.id) && !reordered.has(other.id));
|
|
83
|
+
const previous = neighbours.filter((other) => other.y < node.y).at(-1);
|
|
84
|
+
const next = neighbours.find((other) => other.y > node.y);
|
|
85
|
+
const above = previous && target.get(previous.id);
|
|
86
|
+
const below = next && target.get(next.id);
|
|
87
|
+
const top = above ? above.y + above.continueHeight + above.exitHeight : 0;
|
|
88
|
+
const bottom = below?.y ?? Infinity;
|
|
89
|
+
anchors.set(node.id, Math.max(top, Math.min(bottom, node.y)));
|
|
90
|
+
}
|
|
91
|
+
return anchors;
|
|
92
|
+
}
|
|
93
|
+
const fold = (node, size) => ({
|
|
94
|
+
...node,
|
|
95
|
+
continueHeight: node.continueHeight * size,
|
|
96
|
+
exitHeight: node.exitHeight * size
|
|
97
|
+
});
|
|
98
|
+
const callbacks = useAnimationCallbacks(() => emit("animation-start"), () => emit("animation-end"));
|
|
99
|
+
const mix = (a, b, t) => a + (b - a) * t;
|
|
100
|
+
const { items } = useKeyedTransition(() => [...layout.value.nodes.map((node) => ({
|
|
101
|
+
kind: "node",
|
|
102
|
+
node
|
|
103
|
+
})), ...layout.value.links.map((link) => ({
|
|
104
|
+
kind: "link",
|
|
105
|
+
link
|
|
106
|
+
}))], {
|
|
107
|
+
key: (shape) => shape.kind === "node" ? `n:${shape.node.id}` : `l:${shape.link.id}`,
|
|
108
|
+
interpolate: (from, to, t) => {
|
|
109
|
+
const shape = interpolateShape(from, to, t);
|
|
110
|
+
return from.fade === void 0 ? shape : {
|
|
111
|
+
...shape,
|
|
112
|
+
fade: Math.min(1, Math.max(0, mix(from.fade, to.fade ?? 1, t)))
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
enterFrom: (shape) => shape.kind === "node" ? {
|
|
116
|
+
kind: "node",
|
|
117
|
+
node: {
|
|
118
|
+
...shape.node,
|
|
119
|
+
y: unfoldStarts.get(shape.node.id) ?? shape.node.y,
|
|
120
|
+
continueHeight: 0,
|
|
121
|
+
exitHeight: 0
|
|
122
|
+
}
|
|
123
|
+
} : {
|
|
124
|
+
kind: "link",
|
|
125
|
+
link: {
|
|
126
|
+
...shape.link,
|
|
127
|
+
width: 0
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
exitTo: (shape) => shape.kind === "node" ? {
|
|
131
|
+
kind: "node",
|
|
132
|
+
node: {
|
|
133
|
+
...shape.node,
|
|
134
|
+
y: foldTargets.get(shape.node.id) ?? shape.node.y,
|
|
135
|
+
continueHeight: 0,
|
|
136
|
+
exitHeight: 0
|
|
137
|
+
}
|
|
138
|
+
} : {
|
|
139
|
+
kind: "link",
|
|
140
|
+
link: {
|
|
141
|
+
...shape.link,
|
|
142
|
+
width: 0
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
reveal,
|
|
146
|
+
connected: true,
|
|
147
|
+
isActive: () => props.isAnimationActive,
|
|
148
|
+
transition: () => props.transition,
|
|
149
|
+
onStart: callbacks.onStart,
|
|
150
|
+
onEnd: callbacks.onEnd
|
|
151
|
+
});
|
|
152
|
+
function interpolateShape(from, to, t) {
|
|
153
|
+
if (from.kind === "node" && to.kind === "node") {
|
|
154
|
+
if (reordered.has(to.node.id)) return {
|
|
155
|
+
kind: "node",
|
|
156
|
+
node: t < .5 ? {
|
|
157
|
+
...fold(from.node, 1 - t * 2),
|
|
158
|
+
y: mix(from.node.y, foldTargets.get(from.node.id) ?? from.node.y, t)
|
|
159
|
+
} : {
|
|
160
|
+
...fold(to.node, t * 2 - 1),
|
|
161
|
+
y: mix(unfoldStarts.get(to.node.id) ?? to.node.y, to.node.y, t)
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
kind: "node",
|
|
166
|
+
node: {
|
|
167
|
+
...to.node,
|
|
168
|
+
x: mix(from.node.x, to.node.x, t),
|
|
169
|
+
y: mix(from.node.y, to.node.y, t),
|
|
170
|
+
continueHeight: mix(from.node.continueHeight, to.node.continueHeight, t),
|
|
171
|
+
exitHeight: mix(from.node.exitHeight, to.node.exitHeight, t)
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (from.kind === "link" && to.kind === "link") return {
|
|
176
|
+
kind: "link",
|
|
177
|
+
link: {
|
|
178
|
+
...to.link,
|
|
179
|
+
x0: mix(from.link.x0, to.link.x0, t),
|
|
180
|
+
x1: mix(from.link.x1, to.link.x1, t),
|
|
181
|
+
y0: mix(from.link.y0, to.link.y0, t),
|
|
182
|
+
y1: mix(from.link.y1, to.link.y1, t),
|
|
183
|
+
width: mix(from.link.width, to.link.width, t)
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return to;
|
|
187
|
+
}
|
|
188
|
+
function reveal() {
|
|
189
|
+
const { nodes } = layout.value;
|
|
190
|
+
if (!nodes.length) return void 0;
|
|
191
|
+
const bottom = Math.max(...nodes.map((node) => node.y + node.continueHeight + node.exitHeight));
|
|
192
|
+
const span = props.width + bottom || 1;
|
|
193
|
+
return {
|
|
194
|
+
from: (shape) => shape.kind === "node" ? {
|
|
195
|
+
...shape,
|
|
196
|
+
node: {
|
|
197
|
+
...shape.node,
|
|
198
|
+
y: shape.node.y - 6
|
|
199
|
+
},
|
|
200
|
+
fade: 0
|
|
201
|
+
} : {
|
|
202
|
+
...shape,
|
|
203
|
+
link: {
|
|
204
|
+
...shape.link,
|
|
205
|
+
y0: shape.link.y0 - 6,
|
|
206
|
+
y1: shape.link.y1 - 6
|
|
207
|
+
},
|
|
208
|
+
fade: 0
|
|
209
|
+
},
|
|
210
|
+
order: (shape) => shape.kind === "node" ? (shape.node.x + shape.node.y) / span : (shape.link.x0 + shape.link.y0) / span
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const hover = ref();
|
|
214
|
+
const localPinned = ref(null);
|
|
215
|
+
const pinnedPath = computed(() => props.pinned !== void 0 ? props.pinned : localPinned.value);
|
|
216
|
+
function setPinned(path) {
|
|
217
|
+
localPinned.value = path;
|
|
218
|
+
emit("update:pinned", path);
|
|
219
|
+
}
|
|
220
|
+
const highlighted = computed(() => {
|
|
221
|
+
const { links } = layout.value;
|
|
222
|
+
if (hover.value) {
|
|
223
|
+
const start = hover.value.kind === "link" ? links.filter((link) => link.id === hover.value.id) : links.filter((link) => link.source === hover.value.id || link.target === hover.value.id);
|
|
224
|
+
const ids = connectedLinks(links, start);
|
|
225
|
+
const nodes = new Set(hover.value.kind === "node" ? [hover.value.id] : []);
|
|
226
|
+
for (const link of links) if (ids.has(link.id)) {
|
|
227
|
+
nodes.add(link.source);
|
|
228
|
+
nodes.add(link.target);
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
links: ids,
|
|
232
|
+
nodes,
|
|
233
|
+
pinned: false
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (pinnedPath.value?.length) return {
|
|
237
|
+
links: journeyLinksOf(pinnedPath.value, stepCount.value),
|
|
238
|
+
nodes: new Set(pinnedPath.value.slice(0, stepCount.value).map((name, step) => journeyNodeId(step, name))),
|
|
239
|
+
pinned: true
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
const linkOpacity = (link) => {
|
|
243
|
+
const h = highlighted.value;
|
|
244
|
+
if (!h) return .2;
|
|
245
|
+
return h.links.has(link.id) ? .45 : h.pinned ? .14 : .07;
|
|
246
|
+
};
|
|
247
|
+
const nodeOpacity = (node) => {
|
|
248
|
+
const h = highlighted.value;
|
|
249
|
+
return !h || h.nodes.has(node.id) ? 1 : .25;
|
|
250
|
+
};
|
|
251
|
+
const subtitleOf = (node) => {
|
|
252
|
+
if (props.subtitleFormatter) return props.subtitleFormatter(node);
|
|
253
|
+
const count = numbers.value.format(node.count);
|
|
254
|
+
if (node.step === 0) return `${count} sessions`;
|
|
255
|
+
if (node.exits === null) return count;
|
|
256
|
+
if (node.exits === 0) return `${count} · all continue`;
|
|
257
|
+
return `${count} · ${wholePercent.value.format(node.exits / node.count * 100)}% end here`;
|
|
258
|
+
};
|
|
259
|
+
const nodeById = computed(() => new Map(layout.value.nodes.map((node) => [node.id, node])));
|
|
260
|
+
const linkDescription = (link) => {
|
|
261
|
+
const source = nodeById.value.get(link.source);
|
|
262
|
+
const target = nodeById.value.get(link.target);
|
|
263
|
+
return {
|
|
264
|
+
name: `${source.name} → ${target.name}`,
|
|
265
|
+
value: `${numbers.value.format(link.count)} sessions · ${percent.value.format(link.count / source.count * 100)}% of those on ${source.name} at step ${source.step + 1}`
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
const tooltipItems = computed(() => {
|
|
269
|
+
const { nodes, links } = layout.value;
|
|
270
|
+
const values = {};
|
|
271
|
+
const names = {};
|
|
272
|
+
const texts = /* @__PURE__ */ new Map();
|
|
273
|
+
nodes.forEach((node, i) => {
|
|
274
|
+
values[`nodes[${i}]`] = node.count;
|
|
275
|
+
names[`nodes[${i}]`] = node.name;
|
|
276
|
+
texts.set(node, subtitleOf(node));
|
|
277
|
+
});
|
|
278
|
+
links.forEach((link, i) => {
|
|
279
|
+
const description = linkDescription(link);
|
|
280
|
+
values[`links[${i}]`] = link.count;
|
|
281
|
+
names[`links[${i}]`] = description.name;
|
|
282
|
+
texts.set(link, description.value);
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
data: {
|
|
286
|
+
nodes,
|
|
287
|
+
links
|
|
288
|
+
},
|
|
289
|
+
values,
|
|
290
|
+
names,
|
|
291
|
+
texts
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
const tooltipConfiguration = computed(() => {
|
|
295
|
+
const { data, values, names, texts } = tooltipItems.value;
|
|
296
|
+
return {
|
|
297
|
+
dataDefinedOnItem: data,
|
|
298
|
+
values,
|
|
299
|
+
names,
|
|
300
|
+
positions: void 0,
|
|
301
|
+
pointerItems: [...layout.value.nodes.map((node, index) => ({
|
|
302
|
+
index,
|
|
303
|
+
payloadKey: `nodes[${index}]`,
|
|
304
|
+
identity: node.id,
|
|
305
|
+
coordinate: {
|
|
306
|
+
x: node.x + props.nodeWidth,
|
|
307
|
+
y: node.y
|
|
308
|
+
}
|
|
309
|
+
})), ...layout.value.links.map((link, index) => ({
|
|
310
|
+
index: layout.value.nodes.length + index,
|
|
311
|
+
payloadKey: `links[${index}]`,
|
|
312
|
+
identity: `${link.source}→${link.target}`,
|
|
313
|
+
coordinate: {
|
|
314
|
+
x: (link.x0 + link.x1) / 2,
|
|
315
|
+
y: (link.y0 + link.y1) / 2
|
|
316
|
+
}
|
|
317
|
+
}))],
|
|
318
|
+
settings: {
|
|
319
|
+
stroke: void 0,
|
|
320
|
+
strokeWidth: void 0,
|
|
321
|
+
fill: void 0,
|
|
322
|
+
dataKey: "value",
|
|
323
|
+
nameKey: "name",
|
|
324
|
+
name: void 0,
|
|
325
|
+
hide: false,
|
|
326
|
+
type: void 0,
|
|
327
|
+
color: void 0,
|
|
328
|
+
unit: "",
|
|
329
|
+
formatter: (value, _name, entry) => texts.get(toRaw(entry.payload)) ?? value
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
});
|
|
333
|
+
tooltip.entries.register(tooltipConfiguration);
|
|
334
|
+
const nodeIndex = (node) => layout.value.nodes.findIndex((item) => item.id === node.id);
|
|
335
|
+
const linkIndex = (link) => layout.value.links.findIndex((item) => item.id === link.id);
|
|
336
|
+
function enterNode(node, event) {
|
|
337
|
+
hover.value = {
|
|
338
|
+
kind: "node",
|
|
339
|
+
id: node.id
|
|
340
|
+
};
|
|
341
|
+
const index = nodeIndex(node);
|
|
342
|
+
if (event) emit("node-mouseenter", node, index, event);
|
|
343
|
+
tooltip.activate("hover", {
|
|
344
|
+
type: "item",
|
|
345
|
+
configuration: tooltipConfiguration.value,
|
|
346
|
+
index,
|
|
347
|
+
coordinate: {
|
|
348
|
+
x: node.x + props.nodeWidth,
|
|
349
|
+
y: node.y
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function enterLink(link, event) {
|
|
354
|
+
hover.value = {
|
|
355
|
+
kind: "link",
|
|
356
|
+
id: link.id
|
|
357
|
+
};
|
|
358
|
+
const index = linkIndex(link);
|
|
359
|
+
emit("link-mouseenter", link, index, event);
|
|
360
|
+
tooltip.activate("hover", {
|
|
361
|
+
type: "item",
|
|
362
|
+
configuration: tooltipConfiguration.value,
|
|
363
|
+
index: layout.value.nodes.length + index,
|
|
364
|
+
coordinate: {
|
|
365
|
+
x: (link.x0 + link.x1) / 2,
|
|
366
|
+
y: (link.y0 + link.y1) / 2
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function leave() {
|
|
371
|
+
hover.value = void 0;
|
|
372
|
+
tooltip.clear("hover", "item");
|
|
373
|
+
}
|
|
374
|
+
function leaveNode(node, event) {
|
|
375
|
+
leave();
|
|
376
|
+
emit("node-mouseleave", node, nodeIndex(node), event);
|
|
377
|
+
}
|
|
378
|
+
function leaveLink(link, event) {
|
|
379
|
+
leave();
|
|
380
|
+
emit("link-mouseleave", link, linkIndex(link), event);
|
|
381
|
+
}
|
|
382
|
+
function pinThrough(step, names) {
|
|
383
|
+
const path = largestJourneyThrough(journeys.value, stepCount.value, {
|
|
384
|
+
step,
|
|
385
|
+
names
|
|
386
|
+
});
|
|
387
|
+
setPinned(path && pinnedPath.value && path.length === pinnedPath.value.length && path.every((name, i) => name === pinnedPath.value[i]) || !path ? null : path);
|
|
388
|
+
}
|
|
389
|
+
function clickNode(node, event) {
|
|
390
|
+
pinThrough(node.step, [node.name]);
|
|
391
|
+
emit("node-click", node, nodeIndex(node), event);
|
|
392
|
+
}
|
|
393
|
+
function clickLink(link, event) {
|
|
394
|
+
const source = nodeById.value.get(link.source);
|
|
395
|
+
const target = nodeById.value.get(link.target);
|
|
396
|
+
pinThrough(source.step, [source.name, target.name]);
|
|
397
|
+
emit("link-click", link, linkIndex(link), event);
|
|
398
|
+
}
|
|
399
|
+
const focused = ref();
|
|
400
|
+
const focusedNode = () => layout.value.nodes.find((node) => node.id === focused.value);
|
|
401
|
+
const { onFocus, onKeydown } = useItemKeyboard({
|
|
402
|
+
empty: () => layout.value.nodes.length === 0,
|
|
403
|
+
start: () => focused.value === void 0 ? layout.value.nodes[0] : void 0,
|
|
404
|
+
neighbour: (key) => {
|
|
405
|
+
const nodes = layout.value.nodes;
|
|
406
|
+
const current = focusedNode();
|
|
407
|
+
if (!current) return key.startsWith("Arrow") ? nodes[0] : void 0;
|
|
408
|
+
if (key === "ArrowDown" || key === "ArrowUp") {
|
|
409
|
+
const column = nodes.filter((node) => node.step === current.step);
|
|
410
|
+
return column[column.indexOf(current) + (key === "ArrowDown" ? 1 : -1)];
|
|
411
|
+
}
|
|
412
|
+
if (key === "ArrowRight" || key === "ArrowLeft") {
|
|
413
|
+
const forward = key === "ArrowRight";
|
|
414
|
+
const candidates = layout.value.links.filter((link) => forward ? link.source === current.id : link.target === current.id).sort((a, b) => b.count - a.count);
|
|
415
|
+
const nextId = candidates[0] && (forward ? candidates[0].target : candidates[0].source);
|
|
416
|
+
return nodes.find((node) => node.id === nextId);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
activate: (node) => {
|
|
420
|
+
focused.value = node.id;
|
|
421
|
+
enterNode(node);
|
|
422
|
+
},
|
|
423
|
+
clear: () => {
|
|
424
|
+
if (!focusedNode()) return;
|
|
425
|
+
setPinned(null);
|
|
426
|
+
focused.value = void 0;
|
|
427
|
+
leave();
|
|
428
|
+
},
|
|
429
|
+
keydown: (event) => {
|
|
430
|
+
const current = focusedNode();
|
|
431
|
+
if (!current || event.key !== "Enter" && event.key !== " ") return false;
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
clickNode(current, event);
|
|
434
|
+
return true;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
const linkPath = (link) => {
|
|
438
|
+
const mid = (link.x1 - link.x0) * CURVATURE;
|
|
439
|
+
return `M${link.x0},${link.y0}C${link.x0 + mid},${link.y0} ${link.x1 - mid},${link.y1} ${link.x1},${link.y1}`;
|
|
440
|
+
};
|
|
441
|
+
const columnWidth = computed(() => {
|
|
442
|
+
const steps = layout.value.steps;
|
|
443
|
+
return steps.length > 1 ? steps[1].x - steps[0].x : props.width;
|
|
444
|
+
});
|
|
445
|
+
const summary = computed(() => {
|
|
446
|
+
const sessions = layout.value.steps[0]?.total ?? 0;
|
|
447
|
+
const steps = layout.value.steps.length;
|
|
448
|
+
return props.title ?? `Journeys of ${numbers.value.format(sessions)} ${sessions === 1 ? "session" : "sessions"} over ${steps} ${steps === 1 ? "step" : "steps"}`;
|
|
449
|
+
});
|
|
450
|
+
const focusedLabel = computed(() => {
|
|
451
|
+
const node = focused.value ? nodeById.value.get(focused.value) : void 0;
|
|
452
|
+
return node ? `${node.name}, step ${node.step + 1}: ${subtitleOf(node)}` : summary.value;
|
|
453
|
+
});
|
|
454
|
+
const fade = computed(() => reducedMotion.value === "reduce" ? void 0 : `opacity ${motionTokens.feedback.duration}s ${motionTokens.feedback.cssEase}`);
|
|
455
|
+
const halo = {
|
|
456
|
+
paintOrder: "stroke",
|
|
457
|
+
stroke: "var(--v-charts-background, #fff)",
|
|
458
|
+
strokeWidth: "4px",
|
|
459
|
+
strokeLinejoin: "round"
|
|
460
|
+
};
|
|
461
|
+
return () => {
|
|
462
|
+
const shapes = items.value;
|
|
463
|
+
const presence = (phase, progress) => phase === "exit" ? Math.max(0, 1 - (progress ?? 1) * 2) : phase === "enter" ? Math.max(0, (progress ?? 1) * 2 - 1) : 1;
|
|
464
|
+
const folding = (progress) => progress === void 0 ? 1 : Math.abs(1 - progress * 2);
|
|
465
|
+
const links = shapes.flatMap(({ key, value, phase, progress }) => value.kind === "link" ? [{
|
|
466
|
+
key,
|
|
467
|
+
link: value.link,
|
|
468
|
+
phase,
|
|
469
|
+
shown: (value.fade ?? presence(phase, progress)) * (reordered.has(value.link.source) || reordered.has(value.link.target) ? folding(progress) : 1),
|
|
470
|
+
moving: progress !== void 0
|
|
471
|
+
}] : []);
|
|
472
|
+
const nodes = shapes.flatMap(({ key, value, phase, progress }) => value.kind === "node" ? [{
|
|
473
|
+
key,
|
|
474
|
+
node: value.node,
|
|
475
|
+
phase,
|
|
476
|
+
shown: (value.fade ?? presence(phase, progress)) * (phase === "update" && reordered.has(value.node.id) ? folding(progress) : 1),
|
|
477
|
+
moving: progress !== void 0
|
|
478
|
+
}] : []);
|
|
479
|
+
const labelChars = Math.floor((columnWidth.value - props.nodeWidth - 16) / CHAR_WIDTH);
|
|
480
|
+
return createVNode("g", {
|
|
481
|
+
"data-slot": "series",
|
|
482
|
+
"class": "v-charts-journey",
|
|
483
|
+
"role": "group",
|
|
484
|
+
"tabindex": 0,
|
|
485
|
+
"aria-label": focusedLabel.value,
|
|
486
|
+
"style": { outline: "none" },
|
|
487
|
+
"onKeydown": onKeydown,
|
|
488
|
+
"onFocus": onFocus,
|
|
489
|
+
"onBlur": () => {
|
|
490
|
+
focused.value = void 0;
|
|
491
|
+
leave();
|
|
492
|
+
}
|
|
493
|
+
}, [
|
|
494
|
+
props.headers && createVNode("g", { "class": "v-charts-journey-headers" }, [layout.value.steps.map((step) => createVNode("g", {
|
|
495
|
+
"key": step.step,
|
|
496
|
+
"transform": `translate(${step.x},0)`
|
|
497
|
+
}, [slots.header ? slots.header({
|
|
498
|
+
...step,
|
|
499
|
+
width: columnWidth.value
|
|
500
|
+
}) : createVNode("text", {
|
|
501
|
+
"y": 14,
|
|
502
|
+
"style": {
|
|
503
|
+
fontSize: "12px",
|
|
504
|
+
fill: "var(--v-charts-text, #666)"
|
|
505
|
+
}
|
|
506
|
+
}, [createVNode("tspan", { "style": { fontWeight: 500 } }, [`Step ${step.step + 1}`]), createVNode("tspan", { "style": { fill: "var(--v-charts-text, #666)" } }, [step.previousTotal == null ? ` · ${numbers.value.format(step.total)}` : ` · ${numbers.value.format(step.total)} · ${percent.value.format(step.total / (step.previousTotal || 1) * 100)}% of step ${step.step}`])])]))]),
|
|
507
|
+
createVNode("g", {
|
|
508
|
+
"class": "v-charts-journey-links",
|
|
509
|
+
"fill": "none"
|
|
510
|
+
}, [links.map(({ key, link, shown, moving }) => createVNode("path", {
|
|
511
|
+
"key": `v${String(key)}`,
|
|
512
|
+
"class": "v-charts-journey-link",
|
|
513
|
+
"d": linkPath(link),
|
|
514
|
+
"stroke-width": Math.max(link.width, .5),
|
|
515
|
+
"style": {
|
|
516
|
+
stroke: props.color,
|
|
517
|
+
opacity: linkOpacity(link) * shown,
|
|
518
|
+
transition: moving ? void 0 : fade.value,
|
|
519
|
+
pointerEvents: "none"
|
|
520
|
+
}
|
|
521
|
+
}, null)), links.map(({ key, link, phase }) => phase === "exit" ? null : createVNode("path", {
|
|
522
|
+
"key": `h${String(key)}`,
|
|
523
|
+
"class": "v-charts-journey-link-hit",
|
|
524
|
+
"d": linkPath(link),
|
|
525
|
+
"stroke": "transparent",
|
|
526
|
+
"stroke-width": Math.max(link.width, 10),
|
|
527
|
+
"style": { cursor: "pointer" },
|
|
528
|
+
"onMouseenter": (event) => enterLink(link, event),
|
|
529
|
+
"onMouseleave": (event) => leaveLink(link, event),
|
|
530
|
+
"onClick": (event) => clickLink(link, event)
|
|
531
|
+
}, null))]),
|
|
532
|
+
createVNode("g", { "class": "v-charts-journey-nodes" }, [nodes.map(({ key, node, phase, shown, moving }) => {
|
|
533
|
+
const height = node.continueHeight + node.exitHeight;
|
|
534
|
+
const href = props.nodeHref?.(node.name, node);
|
|
535
|
+
const name = truncateMiddle(node.name, node.step === layout.value.steps.length - 1 ? Math.floor(labelWidth.value / CHAR_WIDTH) : labelChars);
|
|
536
|
+
const subtitle = subtitleOf(node);
|
|
537
|
+
const isFocused = focused.value === node.id;
|
|
538
|
+
return createVNode("g", {
|
|
539
|
+
"key": String(key),
|
|
540
|
+
"class": "v-charts-journey-node",
|
|
541
|
+
"style": {
|
|
542
|
+
opacity: nodeOpacity(node) * shown,
|
|
543
|
+
transition: moving ? void 0 : fade.value,
|
|
544
|
+
pointerEvents: phase === "exit" ? "none" : void 0
|
|
545
|
+
}
|
|
546
|
+
}, [createVNode("g", {
|
|
547
|
+
"style": { cursor: "pointer" },
|
|
548
|
+
"onMouseenter": (event) => enterNode(node, event),
|
|
549
|
+
"onMouseleave": (event) => leaveNode(node, event),
|
|
550
|
+
"onClick": (event) => clickNode(node, event)
|
|
551
|
+
}, [
|
|
552
|
+
createVNode("rect", {
|
|
553
|
+
"x": node.x - 4,
|
|
554
|
+
"y": node.y,
|
|
555
|
+
"width": props.nodeWidth + 8,
|
|
556
|
+
"height": Math.max(height, 4),
|
|
557
|
+
"fill": "transparent"
|
|
558
|
+
}, null),
|
|
559
|
+
node.continueHeight > 0 && createVNode("rect", {
|
|
560
|
+
"class": "v-charts-journey-node-continue",
|
|
561
|
+
"x": node.x,
|
|
562
|
+
"y": node.y,
|
|
563
|
+
"width": props.nodeWidth,
|
|
564
|
+
"height": node.continueHeight,
|
|
565
|
+
"rx": 2,
|
|
566
|
+
"style": { fill: props.color }
|
|
567
|
+
}, null),
|
|
568
|
+
node.exitHeight > 0 && createVNode("rect", {
|
|
569
|
+
"class": "v-charts-journey-node-exit",
|
|
570
|
+
"x": node.x,
|
|
571
|
+
"y": node.y + node.continueHeight,
|
|
572
|
+
"width": props.nodeWidth,
|
|
573
|
+
"height": node.exitHeight,
|
|
574
|
+
"rx": 2,
|
|
575
|
+
"style": { fill: props.exitColor }
|
|
576
|
+
}, null),
|
|
577
|
+
isFocused && createVNode("rect", {
|
|
578
|
+
"x": node.x - 2,
|
|
579
|
+
"y": node.y - 2,
|
|
580
|
+
"width": props.nodeWidth + 4,
|
|
581
|
+
"height": height + 4,
|
|
582
|
+
"rx": 3,
|
|
583
|
+
"fill": "none",
|
|
584
|
+
"stroke-width": 1.5,
|
|
585
|
+
"style": { stroke: "var(--v-charts-focus, Highlight)" }
|
|
586
|
+
}, null)
|
|
587
|
+
]), slots.label ? createVNode("g", { "transform": `translate(${node.x + props.nodeWidth + 8},${node.y})` }, [slots.label({
|
|
588
|
+
node,
|
|
589
|
+
subtitle
|
|
590
|
+
})]) : createVNode("g", { "class": "v-charts-journey-label" }, [
|
|
591
|
+
href ? createVNode("a", { "href": href }, [createVNode("text", {
|
|
592
|
+
"x": node.x + props.nodeWidth + 8,
|
|
593
|
+
"y": node.y + 11,
|
|
594
|
+
"style": {
|
|
595
|
+
fontSize: "12px",
|
|
596
|
+
fontWeight: 500,
|
|
597
|
+
fill: "var(--v-charts-text, #666)",
|
|
598
|
+
...halo
|
|
599
|
+
}
|
|
600
|
+
}, [name])]) : createVNode("text", {
|
|
601
|
+
"x": node.x + props.nodeWidth + 8,
|
|
602
|
+
"y": node.y + 11,
|
|
603
|
+
"style": {
|
|
604
|
+
fontSize: "12px",
|
|
605
|
+
fontWeight: 500,
|
|
606
|
+
fill: "var(--v-charts-text, #666)",
|
|
607
|
+
...halo
|
|
608
|
+
}
|
|
609
|
+
}, [name]),
|
|
610
|
+
createVNode("text", {
|
|
611
|
+
"x": node.x + props.nodeWidth + 8,
|
|
612
|
+
"y": node.y + 26,
|
|
613
|
+
"style": {
|
|
614
|
+
fontSize: "11px",
|
|
615
|
+
fill: "var(--v-charts-text, #666)",
|
|
616
|
+
...halo
|
|
617
|
+
}
|
|
618
|
+
}, [subtitle]),
|
|
619
|
+
name !== node.name && createVNode("title", null, [node.name])
|
|
620
|
+
])]);
|
|
621
|
+
})])
|
|
622
|
+
]);
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* User journeys as a Sankey: columns are steps, bands are sessions moving from one page to the
|
|
627
|
+
* next. Hovering a band or node highlights every connected path, the grey part of a node shows
|
|
628
|
+
* sessions that ended there, and clicking pins the largest journey through it.
|
|
629
|
+
*
|
|
630
|
+
* ```vue
|
|
631
|
+
* <JourneySankey :data="[{ path: ['/', '/pricing'], count: 11 }]" v-model:pinned="pinned"><Tooltip /></JourneySankey>
|
|
632
|
+
* ```
|
|
633
|
+
*/
|
|
634
|
+
var JourneySankey = /* @__PURE__ */ defineComponent({
|
|
635
|
+
name: "JourneySankey",
|
|
636
|
+
props: {
|
|
637
|
+
...JourneySankeyVueProps,
|
|
638
|
+
...chartSizeProps
|
|
639
|
+
},
|
|
640
|
+
inheritAttrs: false,
|
|
641
|
+
emits: {
|
|
642
|
+
...chartEmits,
|
|
643
|
+
...journeyEmits
|
|
644
|
+
},
|
|
645
|
+
slots: Object,
|
|
646
|
+
setup(props, { emit, slots, attrs }) {
|
|
647
|
+
const naturalHeight = computed(() => {
|
|
648
|
+
const steps = props.steps ?? Infinity;
|
|
649
|
+
const perStep = /* @__PURE__ */ new Map();
|
|
650
|
+
for (const row of props.data ?? []) {
|
|
651
|
+
const path = getValueByDataKey(row, props.pathKey);
|
|
652
|
+
if (!Array.isArray(path)) continue;
|
|
653
|
+
path.slice(0, steps).forEach((name, step) => {
|
|
654
|
+
const names = perStep.get(step) ?? /* @__PURE__ */ new Set();
|
|
655
|
+
names.add(String(name));
|
|
656
|
+
perStep.set(step, names);
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
const busiest = Math.max(1, ...[...perStep.values()].map((names) => names.size));
|
|
660
|
+
return Math.round((props.headers ? HEADER_BAND : 0) + busiest * (LABEL_HEIGHT + props.nodePadding) * 1.33);
|
|
661
|
+
});
|
|
662
|
+
const size = useChartShell(reactive({
|
|
663
|
+
width: computed(() => props.width),
|
|
664
|
+
height: computed(() => props.height ?? (props.aspect ? void 0 : Math.max(200, naturalHeight.value))),
|
|
665
|
+
aspect: computed(() => props.aspect),
|
|
666
|
+
initialDimension: computed(() => props.initialDimension)
|
|
667
|
+
}), standaloneChartOptions("JourneySankey"));
|
|
668
|
+
const setupContent = () => ({ svg: useJourneySankey(reactive({
|
|
669
|
+
...toRefs(props),
|
|
670
|
+
width: size.effectiveWidth,
|
|
671
|
+
height: size.effectiveHeight
|
|
672
|
+
}), slots, emit) });
|
|
673
|
+
return () => createVNode(ChartShell, mergeProps(attrs, chartListeners(emit), {
|
|
674
|
+
"size": size,
|
|
675
|
+
"desc": props.desc,
|
|
676
|
+
"overflow": "visible",
|
|
677
|
+
"setupContent": setupContent
|
|
678
|
+
}), { default: slots.default });
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
//#endregion
|
|
682
|
+
export { JourneySankey };
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { forwardsSvgAttributes } from "../utils/attributes.mjs";
|
|
2
|
+
import { cartesianChartProps } from "./chartProps.mjs";
|
|
3
|
+
import { chartRoot } from "./chartRoot.mjs";
|
|
4
|
+
import { defineComponent } from "vue";
|
|
5
|
+
//#region src/chart/LineChart.ts
|
|
6
|
+
var root = chartRoot({
|
|
4
7
|
chartName: "LineChart",
|
|
8
|
+
categoryScale: "point",
|
|
9
|
+
series: ["line"],
|
|
5
10
|
defaultTooltipEventType: "axis",
|
|
6
|
-
tooltipPayloadSearcher: arrayTooltipSearcher,
|
|
7
11
|
validateTooltipEventTypes: ["axis", "item"]
|
|
8
12
|
});
|
|
13
|
+
var LineChart = /* @__PURE__ */ forwardsSvgAttributes(defineComponent({
|
|
14
|
+
...root,
|
|
15
|
+
props: cartesianChartProps,
|
|
16
|
+
setup: (props, context) => root.setup(props, context)
|
|
17
|
+
}));
|
|
9
18
|
//#endregion
|
|
10
19
|
export { LineChart };
|