vccs 0.0.1 → 0.2.0
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 +21 -0
- package/dist/animation/Animate.d.ts +72 -0
- package/dist/cartesian/GraphicalItemClipPath.d.ts +31 -0
- package/dist/cartesian/area/ActivePoints.d.ts +77 -0
- package/dist/cartesian/area/Area.d.ts +17 -0
- package/dist/cartesian/area/ClipRect.d.ts +1 -0
- package/dist/cartesian/area/RenderArea.d.ts +16 -0
- package/dist/cartesian/area/__stories__/config.d.ts +31 -0
- package/dist/cartesian/area/hooks/useArea.d.ts +27 -0
- package/dist/cartesian/area/index.d.ts +2 -0
- package/dist/cartesian/area/type.d.ts +173 -0
- package/dist/cartesian/area/utils.d.ts +19 -0
- package/dist/cartesian/axis/XAxis.d.ts +189 -0
- package/dist/cartesian/axis/YAxis.d.ts +192 -0
- package/dist/cartesian/axis/index.d.ts +2 -0
- package/dist/cartesian/axis/type.d.ts +57 -0
- package/dist/cartesian/bar/Bar.d.ts +2 -0
- package/dist/cartesian/bar/components/BarBackground.d.ts +1 -0
- package/dist/cartesian/bar/components/BarRectangles.d.ts +1 -0
- package/dist/cartesian/bar/hooks/useBar.d.ts +23 -0
- package/dist/cartesian/bar/index.d.ts +1 -0
- package/dist/cartesian/bar/type.d.ts +166 -0
- package/dist/cartesian/bar/utils.d.ts +31 -0
- package/dist/cartesian/brush/Brush.d.ts +2 -0
- package/dist/cartesian/brush/components/Background.d.ts +15 -0
- package/dist/cartesian/brush/components/BrushText.d.ts +27 -0
- package/dist/cartesian/brush/components/Panorama.d.ts +65 -0
- package/dist/cartesian/brush/components/Slide.d.ts +20 -0
- package/dist/cartesian/brush/components/Traveller.d.ts +13 -0
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +22 -0
- package/dist/cartesian/brush/hooks/useBrushHandlers.d.ts +25 -0
- package/dist/cartesian/brush/hooks/useBrushSetting.d.ts +6 -0
- package/dist/cartesian/brush/hooks/useBrushState.d.ts +29 -0
- package/dist/cartesian/brush/index.d.ts +2 -0
- package/dist/cartesian/brush/type.d.ts +103 -0
- package/dist/cartesian/brush/utils.d.ts +15 -0
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +209 -0
- package/dist/cartesian/cartesian-axis/const.d.ts +24 -0
- package/dist/cartesian/cartesian-axis/index.d.ts +1 -0
- package/dist/cartesian/cartesian-axis/use-axis-line.d.ts +7 -0
- package/dist/cartesian/cartesian-grid/Background.d.ts +18 -0
- package/dist/cartesian/cartesian-grid/CartesianGrid.d.ts +75 -0
- package/dist/cartesian/cartesian-grid/HorizontalGridLines.d.ts +37 -0
- package/dist/cartesian/cartesian-grid/HorizontalStripes.d.ts +20 -0
- package/dist/cartesian/cartesian-grid/VerticalGridLines.d.ts +26 -0
- package/dist/cartesian/cartesian-grid/VerticalStripes.d.ts +20 -0
- package/dist/cartesian/cartesian-grid/const.d.ts +6 -0
- package/dist/cartesian/cartesian-grid/index.d.ts +1 -0
- package/dist/cartesian/cartesian-grid/type.d.ts +145 -0
- package/dist/cartesian/cartesian-grid/utils.d.ts +5 -0
- package/dist/cartesian/error-bar/ErrorBar.d.ts +68 -0
- package/dist/cartesian/error-bar/ErrorBarContext.d.ts +27 -0
- package/dist/cartesian/error-bar/index.d.ts +2 -0
- package/dist/cartesian/funnel/Funnel.d.ts +2 -0
- package/dist/cartesian/funnel/index.d.ts +2 -0
- package/dist/cartesian/funnel/type.d.ts +106 -0
- package/dist/cartesian/funnel/utils.d.ts +12 -0
- package/dist/cartesian/index.d.ts +12 -0
- package/dist/cartesian/line/ActivePoints.d.ts +77 -0
- package/dist/cartesian/line/Line.d.ts +87 -0
- package/dist/cartesian/line/StaticLine.d.ts +16 -0
- package/dist/cartesian/line/hooks/useLine.d.ts +28 -0
- package/dist/cartesian/line/index.d.ts +3 -0
- package/dist/cartesian/line/type.d.ts +180 -0
- package/dist/cartesian/line/utils.d.ts +13 -0
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +191 -0
- package/dist/cartesian/reference-area/index.d.ts +1 -0
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +139 -0
- package/dist/cartesian/reference-line/index.d.ts +1 -0
- package/dist/cartesian/scatter/Scatter.d.ts +165 -0
- package/dist/cartesian/scatter/hooks/useScatter.d.ts +18 -0
- package/dist/cartesian/scatter/index.d.ts +1 -0
- package/dist/cartesian/type.d.ts +21 -0
- package/dist/cartesian/useNeedsClip.d.ts +6 -0
- package/dist/cartesian/utils/get-ticks.d.ts +16 -0
- package/dist/cartesian/z-axis/ZAxis.d.ts +81 -0
- package/dist/cartesian/z-axis/index.d.ts +1 -0
- package/dist/chart/AreaChart.d.ts +1 -0
- package/dist/chart/BarChart.d.ts +1 -0
- package/dist/chart/ComposedChart.d.ts +1 -0
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/LegendPortalContext.d.ts +3 -0
- package/dist/chart/LineChart.d.ts +1 -0
- package/dist/chart/PieChart.d.ts +1 -0
- package/dist/chart/RadarChart.d.ts +1 -0
- package/dist/chart/RadialBarChart.d.ts +1 -0
- package/dist/chart/RechartsWrapper.d.ts +99 -0
- package/dist/chart/ScatterChart.d.ts +1 -0
- package/dist/chart/Surface.d.ts +40 -0
- package/dist/chart/TooltipPortalContext.d.ts +2 -0
- package/dist/chart/const.d.ts +6 -0
- package/dist/chart/generateCategoricalChart.d.ts +118 -0
- package/dist/chart/index.d.ts +9 -0
- package/dist/chart/provideClipPathId.d.ts +12 -0
- package/dist/components/Cell.d.ts +18 -0
- package/dist/components/DefaultLegendContent.d.ts +18 -0
- package/dist/components/Text.d.ts +149 -0
- package/dist/components/Tooltip.d.ts +250 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/label/Label.d.ts +81 -0
- package/dist/components/label/LabelList.d.ts +63 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/types.d.ts +88 -0
- package/dist/components/label/utils.d.ts +24 -0
- package/dist/components/legend/Legend.d.ts +4 -0
- package/dist/components/legend/LegendSymbol.d.ts +27 -0
- package/dist/components/legend/hooks/useLegend.d.ts +19 -0
- package/dist/components/legend/hooks/useLegendContent.d.ts +36 -0
- package/dist/components/legend/index.d.ts +2 -0
- package/dist/components/legend/type.d.ts +54 -0
- package/dist/components/legend/utils.d.ts +18 -0
- package/dist/components/types.d.ts +9 -0
- package/dist/components/utils.d.ts +4 -0
- package/dist/container/ClipPath.d.ts +12 -0
- package/dist/container/Layer.d.ts +2 -0
- package/dist/container/ResponsiveContainer.d.ts +50 -0
- package/dist/container/RootSurface.d.ts +17 -0
- package/dist/container/Surface.d.ts +25 -0
- package/dist/container/index.d.ts +1 -0
- package/dist/container/useSizeContext.d.ts +11 -0
- package/dist/context/ChartDataContextProvider.d.ts +17 -0
- package/dist/context/PanoramaContextProvider.d.ts +22 -0
- package/dist/context/accessibilityContext.d.ts +1 -0
- package/dist/context/cartesianLabelListContext.d.ts +3 -0
- package/dist/context/chartLayoutContext.d.ts +8 -0
- package/dist/context/cursorLayerContext.d.ts +2 -0
- package/dist/context/graphicalLayerContext.d.ts +2 -0
- package/dist/context/labelLayerContext.d.ts +2 -0
- package/dist/context/polarLabelViewBoxContext.d.ts +4 -0
- package/dist/context/useTooltipAxis.d.ts +2 -0
- package/dist/es/animation/Animate.mjs +89 -0
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +37 -0
- package/dist/es/cartesian/area/ActivePoints.mjs +78 -0
- package/dist/es/cartesian/area/Area.mjs +52 -0
- package/dist/es/cartesian/area/ClipRect.mjs +125 -0
- package/dist/es/cartesian/area/RenderArea.mjs +185 -0
- package/dist/es/cartesian/area/hooks/useArea.mjs +81 -0
- package/dist/es/cartesian/area/type.mjs +136 -0
- package/dist/es/cartesian/area/utils.mjs +79 -0
- package/dist/es/cartesian/axis/XAxis.mjs +203 -0
- package/dist/es/cartesian/axis/YAxis.mjs +192 -0
- package/dist/es/cartesian/bar/Bar.mjs +111 -0
- package/dist/es/cartesian/bar/components/BarBackground.mjs +32 -0
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +143 -0
- package/dist/es/cartesian/bar/hooks/useBar.mjs +53 -0
- package/dist/es/cartesian/bar/type.mjs +131 -0
- package/dist/es/cartesian/bar/utils.mjs +111 -0
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +296 -0
- package/dist/es/cartesian/cartesian-grid/Background.mjs +33 -0
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +174 -0
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +50 -0
- package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +43 -0
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +45 -0
- package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +43 -0
- package/dist/es/cartesian/cartesian-grid/const.mjs +336 -0
- package/dist/es/cartesian/cartesian-grid/utils.mjs +22 -0
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +143 -0
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +20 -0
- package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
- package/dist/es/cartesian/funnel/type.mjs +80 -0
- package/dist/es/cartesian/funnel/utils.mjs +102 -0
- package/dist/es/cartesian/line/ActivePoints.mjs +79 -0
- package/dist/es/cartesian/line/Line.mjs +50 -0
- package/dist/es/cartesian/line/StaticLine.mjs +217 -0
- package/dist/es/cartesian/line/hooks/useLine.mjs +69 -0
- package/dist/es/cartesian/line/type.mjs +112 -0
- package/dist/es/cartesian/line/utils.mjs +34 -0
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +163 -0
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +165 -0
- package/dist/es/cartesian/scatter/Scatter.mjs +280 -0
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +23 -0
- package/dist/es/cartesian/useNeedsClip.mjs +23 -0
- package/dist/es/cartesian/utils/get-ticks.mjs +118 -0
- package/dist/es/cartesian/z-axis/ZAxis.mjs +72 -0
- package/dist/es/chart/AreaChart.mjs +9 -0
- package/dist/es/chart/BarChart.mjs +10 -0
- package/dist/es/chart/ComposedChart.mjs +10 -0
- package/dist/es/chart/FunnelChart.mjs +11 -0
- package/dist/es/chart/LegendPortalContext.mjs +5 -0
- package/dist/es/chart/LineChart.mjs +10 -0
- package/dist/es/chart/PieChart.mjs +16 -0
- package/dist/es/chart/RadarChart.mjs +16 -0
- package/dist/es/chart/RadialBarChart.mjs +16 -0
- package/dist/es/chart/RechartsWrapper.mjs +160 -0
- package/dist/es/chart/ScatterChart.mjs +10 -0
- package/dist/es/chart/Surface.mjs +5 -0
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +72 -0
- package/dist/es/chart/TooltipPortalContext.mjs +5 -0
- package/dist/es/chart/const.mjs +7 -0
- package/dist/es/chart/generateCategoricalChart.mjs +175 -0
- package/dist/es/chart/provideClipPathId.mjs +15 -0
- package/dist/es/components/Cell.mjs +23 -0
- package/dist/es/components/Text.mjs +5 -0
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +191 -0
- package/dist/es/components/Tooltip.mjs +463 -0
- package/dist/es/components/label/Label.mjs +40 -0
- package/dist/es/components/label/LabelList.mjs +55 -0
- package/dist/es/components/label/types.mjs +38 -0
- package/dist/es/components/label/utils.mjs +265 -0
- package/dist/es/components/legend/Legend.mjs +93 -0
- package/dist/es/components/legend/LegendSymbol.mjs +62 -0
- package/dist/es/components/legend/hooks/useLegend.mjs +72 -0
- package/dist/es/components/legend/hooks/useLegendContent.mjs +68 -0
- package/dist/es/components/legend/type.mjs +41 -0
- package/dist/es/components/legend/utils.mjs +25 -0
- package/dist/es/components/utils.mjs +44 -0
- package/dist/es/container/ClipPath.mjs +25 -0
- package/dist/es/container/Layer.mjs +14 -0
- package/dist/es/container/ResponsiveContainer.mjs +5 -0
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +144 -0
- package/dist/es/container/Surface.mjs +62 -0
- package/dist/es/container/useSizeContext.mjs +5 -0
- package/dist/es/context/ChartDataContextProvider.mjs +27 -0
- package/dist/es/context/PanoramaContextProvider.mjs +24 -0
- package/dist/es/context/accessibilityContext.mjs +5 -0
- package/dist/es/context/cartesianLabelListContext.mjs +5 -0
- package/dist/es/context/chartLayoutContext.mjs +49 -0
- package/dist/es/context/cursorLayerContext.mjs +5 -0
- package/dist/es/context/graphicalLayerContext.mjs +5 -0
- package/dist/es/context/labelLayerContext.mjs +5 -0
- package/dist/es/context/polarLabelViewBoxContext.mjs +8 -0
- package/dist/es/context/useTooltipAxis.mjs +17 -0
- package/dist/es/events/useChartSynchronisation.mjs +113 -0
- package/dist/es/hooks/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +66 -0
- package/dist/es/index.mjs +46 -0
- package/dist/es/polar/pie/Pie.mjs +161 -0
- package/dist/es/polar/pie/type.mjs +97 -0
- package/dist/es/polar/radar/PolarAngleAxis.mjs +180 -0
- package/dist/es/polar/radar/PolarGrid.mjs +115 -0
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +162 -0
- package/dist/es/polar/radar/Radar.mjs +284 -0
- package/dist/es/polar/radial-bar/RadialBar.mjs +197 -0
- package/dist/es/polar/radial-bar/type.mjs +97 -0
- package/dist/es/shape/Cross.mjs +16 -0
- package/dist/es/shape/Curve.mjs +86 -0
- package/dist/es/shape/Dot.mjs +24 -0
- package/dist/es/shape/Rectangle.mjs +83 -0
- package/dist/es/shape/Sector.mjs +156 -0
- package/dist/es/shape/Symbols.mjs +52 -0
- package/dist/es/shape/Trapezoid.mjs +52 -0
- package/dist/es/state/ReportChartProps.mjs +64 -0
- package/dist/es/state/ReportMainChartProps.mjs +46 -0
- package/dist/es/state/ReportPolarOptions.mjs +56 -0
- package/dist/es/state/SetGraphicalItem.mjs +49 -0
- package/dist/es/state/SetLegendPayload.mjs +20 -0
- package/dist/es/state/SetTooltipEntrySettings.mjs +19 -0
- package/dist/es/state/brushSlice.mjs +26 -0
- package/dist/es/state/cartesianAxisSlice.mjs +39 -0
- package/dist/es/state/chartDataSlice.mjs +33 -0
- package/dist/es/state/externalEventsMiddleware.mjs +30 -0
- package/dist/es/state/graphicalItemsSlice.mjs +47 -0
- package/dist/es/state/hooks.mjs +6 -0
- package/dist/es/state/keyboardEventsMiddleware.mjs +63 -0
- package/dist/es/state/layoutSlice.mjs +39 -0
- package/dist/es/state/legendSlice.mjs +40 -0
- package/dist/es/state/mouseEventsMiddleware.mjs +41 -0
- package/dist/es/state/optionsSlice.mjs +25 -0
- package/dist/es/state/polarAxisSlice.mjs +28 -0
- package/dist/es/state/polarOptionsSlice.mjs +13 -0
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +8 -0
- package/dist/es/state/referenceElementsSlice.mjs +36 -0
- package/dist/es/state/rootPropsSlice.mjs +32 -0
- package/dist/es/state/selectors/areaSelectors.mjs +77 -0
- package/dist/es/state/selectors/axisSelectors.mjs +879 -0
- package/dist/es/state/selectors/barSelectors.mjs +241 -0
- package/dist/es/state/selectors/brushSelectors.mjs +18 -0
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +9 -0
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +43 -0
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +8 -0
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +21 -0
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +37 -0
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +13 -0
- package/dist/es/state/selectors/common.mjs +4 -0
- package/dist/es/state/selectors/containerSelectors.mjs +7 -0
- package/dist/es/state/selectors/dataSelectors.mjs +35 -0
- package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
- package/dist/es/state/selectors/legendSelectors.mjs +10 -0
- package/dist/es/state/selectors/lineSelectors.mjs +64 -0
- package/dist/es/state/selectors/pickAxisId.mjs +4 -0
- package/dist/es/state/selectors/pickAxisType.mjs +4 -0
- package/dist/es/state/selectors/pieSelectors.mjs +132 -0
- package/dist/es/state/selectors/polarAxisSelectors.mjs +167 -0
- package/dist/es/state/selectors/polarGridSelectors.mjs +19 -0
- package/dist/es/state/selectors/polarScaleSelectors.mjs +55 -0
- package/dist/es/state/selectors/polarSelectors.mjs +81 -0
- package/dist/es/state/selectors/radarSelectors.mjs +133 -0
- package/dist/es/state/selectors/radialBarSelectors.mjs +259 -0
- package/dist/es/state/selectors/rootPropsSelectors.mjs +14 -0
- package/dist/es/state/selectors/scatterSelectors.mjs +134 -0
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +20 -0
- package/dist/es/state/selectors/selectAllAxes.mjs +10 -0
- package/dist/es/state/selectors/selectChartOffset.mjs +69 -0
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +66 -0
- package/dist/es/state/selectors/selectTooltipEventType.mjs +22 -0
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +6 -0
- package/dist/es/state/selectors/selectTooltipSettings.mjs +4 -0
- package/dist/es/state/selectors/selectTooltipState.mjs +4 -0
- package/dist/es/state/selectors/selectors.mjs +104 -0
- package/dist/es/state/selectors/tooltipSelectors.mjs +269 -0
- package/dist/es/state/selectors/touchSelectors.mjs +19 -0
- package/dist/es/state/store.mjs +55 -0
- package/dist/es/state/tooltipSlice.mjs +102 -0
- package/dist/es/state/touchEventsMiddleware.mjs +44 -0
- package/dist/es/state/utils/useReportScale.mjs +19 -0
- package/dist/es/synchronisation/syncSelectors.mjs +6 -0
- package/dist/es/synchronisation/useChartSynchronisation.mjs +38 -0
- package/dist/es/types/event.mjs +166 -0
- package/dist/es/utils/ReduceCSSCalc.mjs +114 -0
- package/dist/es/utils/VueUtils.mjs +39 -0
- package/dist/es/utils/attrs.mjs +69 -0
- package/dist/es/utils/cartesian.mjs +54 -0
- package/dist/es/utils/chart.mjs +366 -0
- package/dist/es/utils/const.mjs +32 -0
- package/dist/es/utils/createContext.mjs +31 -0
- package/dist/es/utils/data-utils.mjs +13 -0
- package/dist/es/utils/data.mjs +41 -0
- package/dist/es/utils/events.mjs +7 -0
- package/dist/es/utils/getLinearRegression.mjs +34 -0
- package/dist/es/utils/grid.mjs +23 -0
- package/dist/es/utils/isDomainSpecifiedByUser.mjs +116 -0
- package/dist/es/utils/legend.mjs +19 -0
- package/dist/es/utils/log.mjs +14 -0
- package/dist/es/utils/payload/getUniqPayload.mjs +9 -0
- package/dist/es/utils/polar.mjs +59 -0
- package/dist/es/utils/props.mjs +20 -0
- package/dist/es/utils/resolveDefaultProps.mjs +26 -0
- package/dist/es/utils/scale/getNiceTickValues.mjs +137 -0
- package/dist/es/utils/scale/utils/arithmetic.mjs +54 -0
- package/dist/es/utils/scale/utils/utils.mjs +53 -0
- package/dist/es/utils/style.mjs +30 -0
- package/dist/es/utils/tick.mjs +42 -0
- package/dist/es/utils/tooltip/translate.mjs +73 -0
- package/dist/es/utils/validate.mjs +42 -0
- package/dist/events/useChartSynchronisation.d.ts +8 -0
- package/dist/hooks/useIsAnimating.d.ts +14 -0
- package/dist/hooks/useSetupGraphicalItem.d.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/polar/index.d.ts +3 -0
- package/dist/polar/pie/Pie.d.ts +2 -0
- package/dist/polar/pie/index.d.ts +2 -0
- package/dist/polar/pie/type.d.ts +88 -0
- package/dist/polar/radar/PolarAngleAxis.d.ts +145 -0
- package/dist/polar/radar/PolarGrid.d.ts +77 -0
- package/dist/polar/radar/PolarRadiusAxis.d.ts +125 -0
- package/dist/polar/radar/Radar.d.ts +160 -0
- package/dist/polar/radar/index.d.ts +4 -0
- package/dist/polar/radial-bar/RadialBar.d.ts +2 -0
- package/dist/polar/radial-bar/index.d.ts +2 -0
- package/dist/polar/radial-bar/type.d.ts +96 -0
- package/dist/shape/Cross.d.ts +10 -0
- package/dist/shape/Curve.d.ts +42 -0
- package/dist/shape/Dot.d.ts +18 -0
- package/dist/shape/Rectangle.d.ts +33 -0
- package/dist/shape/Sector.d.ts +48 -0
- package/dist/shape/Symbols.d.ts +15 -0
- package/dist/shape/Trapezoid.d.ts +31 -0
- package/dist/shape/index.d.ts +9 -0
- package/dist/shape/types.d.ts +20 -0
- package/dist/state/ReportBar.d.ts +1 -0
- package/dist/state/ReportChartProps.d.ts +88 -0
- package/dist/state/ReportMainChartProps.d.ts +37 -0
- package/dist/state/ReportPolarOptions.d.ts +59 -0
- package/dist/state/SetGraphicalItem.d.ts +9 -0
- package/dist/state/SetLegendPayload.d.ts +3 -0
- package/dist/state/SetTooltipEntrySettings.d.ts +8 -0
- package/dist/state/brushSlice.d.ts +18 -0
- package/dist/state/cartesianAxisSlice.d.ts +88 -0
- package/dist/state/chartDataSlice.d.ts +44 -0
- package/dist/state/externalEventsMiddleware.d.ts +17 -0
- package/dist/state/graphicalItemsSlice.d.ts +108 -0
- package/dist/state/hooks.d.ts +54 -0
- package/dist/state/keyboardEventsMiddleware.d.ts +3 -0
- package/dist/state/layoutSlice.d.ts +15 -0
- package/dist/state/legendSlice.d.ts +26 -0
- package/dist/state/mouseEventsMiddleware.d.ts +5 -0
- package/dist/state/optionsSlice.d.ts +27 -0
- package/dist/state/polarAxisSlice.d.ts +10 -0
- package/dist/state/polarOptionsSlice.d.ts +10 -0
- package/dist/state/reduxDevtoolsJsonStringifyReplacer.d.ts +1 -0
- package/dist/state/referenceElementsSlice.d.ts +40 -0
- package/dist/state/rootPropsSlice.d.ts +26 -0
- package/dist/state/selectors/areaSelectors.d.ts +24 -0
- package/dist/state/selectors/axisSelectors.d.ts +1828 -0
- package/dist/state/selectors/barSelectors.d.ts +944 -0
- package/dist/state/selectors/brushSelectors.d.ts +10 -0
- package/dist/state/selectors/combiners/combineActiveLabel.d.ts +3 -0
- package/dist/state/selectors/combiners/combineActiveTooltipIndex.d.ts +5 -0
- package/dist/state/selectors/combiners/combineAxisRangeWithReverse.d.ts +3 -0
- package/dist/state/selectors/combiners/combineCoordinateForDefaultIndex.d.ts +3 -0
- package/dist/state/selectors/combiners/combineTooltipInteractionState.d.ts +3 -0
- package/dist/state/selectors/combiners/combineTooltipPayloadConfigurations.d.ts +3 -0
- package/dist/state/selectors/common.d.ts +2 -0
- package/dist/state/selectors/containerSelectors.d.ts +6 -0
- package/dist/state/selectors/dataSelectors.d.ts +23 -0
- package/dist/state/selectors/funnelSelectors.d.ts +69 -0
- package/dist/state/selectors/legendSelectors.d.ts +7 -0
- package/dist/state/selectors/lineSelectors.d.ts +123 -0
- package/dist/state/selectors/pickAxisId.d.ts +3 -0
- package/dist/state/selectors/pickAxisType.d.ts +2 -0
- package/dist/state/selectors/pieSelectors.d.ts +55 -0
- package/dist/state/selectors/polarAxisSelectors.d.ts +49 -0
- package/dist/state/selectors/polarGridSelectors.d.ts +118 -0
- package/dist/state/selectors/polarScaleSelectors.d.ts +9 -0
- package/dist/state/selectors/polarSelectors.d.ts +70 -0
- package/dist/state/selectors/radarSelectors.d.ts +76 -0
- package/dist/state/selectors/radialBarSelectors.d.ts +61 -0
- package/dist/state/selectors/rootPropsSelectors.d.ts +11 -0
- package/dist/state/selectors/scatterSelectors.d.ts +21 -0
- package/dist/state/selectors/selectActivePropsFromChartPointer.d.ts +382 -0
- package/dist/state/selectors/selectAllAxes.d.ts +4 -0
- package/dist/state/selectors/selectChartOffset.d.ts +116 -0
- package/dist/state/selectors/selectChartOffsetInternal.d.ts +9 -0
- package/dist/state/selectors/selectTooltipEventType.d.ts +8 -0
- package/dist/state/selectors/selectTooltipPayloadSearcher.d.ts +3 -0
- package/dist/state/selectors/selectTooltipSettings.d.ts +3 -0
- package/dist/state/selectors/selectTooltipState.d.ts +3 -0
- package/dist/state/selectors/selectors.d.ts +184 -0
- package/dist/state/selectors/tooltipSelectors.d.ts +581 -0
- package/dist/state/selectors/touchSelectors.d.ts +4 -0
- package/dist/state/store.d.ts +74 -0
- package/dist/state/tooltipSlice.d.ts +204 -0
- package/dist/state/touchEventsMiddleware.d.ts +2 -0
- package/dist/state/utils/useReportScale.d.ts +1 -0
- package/dist/synchronisation/syncSelectors.d.ts +3 -0
- package/dist/synchronisation/useChartSynchronisation.d.ts +11 -0
- package/dist/types/area.d.ts +8 -0
- package/dist/types/axis.d.ts +127 -0
- package/dist/types/bar.d.ts +51 -0
- package/dist/types/categorical.d.ts +36 -0
- package/dist/types/common.d.ts +129 -0
- package/dist/types/event.d.ts +16 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/legend.d.ts +1 -0
- package/dist/types/offset.d.ts +8 -0
- package/dist/types/radar.d.ts +28 -0
- package/dist/types/scale.d.ts +11 -0
- package/dist/types/tick.d.ts +55 -0
- package/dist/types/tooltip.d.ts +33 -0
- package/dist/utils/ReduceCSSCalc.d.ts +2 -0
- package/dist/utils/VueUtils.d.ts +11 -0
- package/dist/utils/attrs.d.ts +46 -0
- package/dist/utils/cartesian.d.ts +20 -0
- package/dist/utils/chart.d.ts +99 -0
- package/dist/utils/const.d.ts +30 -0
- package/dist/utils/context.d.ts +8 -0
- package/dist/utils/createContext.d.ts +8 -0
- package/dist/utils/data-utils.d.ts +4 -0
- package/dist/utils/data.d.ts +13 -0
- package/dist/utils/events.d.ts +12 -0
- package/dist/utils/getLinearRegression.d.ts +15 -0
- package/dist/utils/getRelativeCoordinate.d.ts +11 -0
- package/dist/utils/grid.d.ts +37 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/isDomainSpecifiedByUser.d.ts +47 -0
- package/dist/utils/legend.d.ts +3 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/payload/getUniqPayload.d.ts +4 -0
- package/dist/utils/polar.d.ts +21 -0
- package/dist/utils/props.d.ts +15 -0
- package/dist/utils/resolveDefaultProps.d.ts +52 -0
- package/dist/utils/scale/getNiceTickValues.d.ts +61 -0
- package/dist/utils/scale/utils/arithmetic.d.ts +50 -0
- package/dist/utils/scale/utils/utils.d.ts +9 -0
- package/dist/utils/style.d.ts +12 -0
- package/dist/utils/tick.d.ts +19 -0
- package/dist/utils/tooltip/translate.d.ts +47 -0
- package/dist/utils/types.d.ts +14 -0
- package/dist/utils/validate.d.ts +25 -0
- package/package.json +27 -10
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { getStringSize } from "../utils/attrs.mjs";
|
|
2
|
+
import { reduceCSSCalc } from "../utils/ReduceCSSCalc.mjs";
|
|
3
|
+
import { Fragment, computed, createElementBlock, defineComponent, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
|
|
4
|
+
//#region src/components/Text.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _hoisted_1 = [
|
|
6
|
+
"x",
|
|
7
|
+
"y",
|
|
8
|
+
"transform",
|
|
9
|
+
"text-anchor",
|
|
10
|
+
"fill"
|
|
11
|
+
];
|
|
12
|
+
var _hoisted_2 = ["x", "dy"];
|
|
13
|
+
var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "Text",
|
|
15
|
+
props: {
|
|
16
|
+
x: {
|
|
17
|
+
type: [Number, String],
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
y: {
|
|
21
|
+
type: [Number, String],
|
|
22
|
+
default: 0
|
|
23
|
+
},
|
|
24
|
+
dx: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
dy: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
lineHeight: {
|
|
33
|
+
type: [Number, String],
|
|
34
|
+
default: "1em"
|
|
35
|
+
},
|
|
36
|
+
capHeight: {
|
|
37
|
+
type: [Number, String],
|
|
38
|
+
default: "0.71em"
|
|
39
|
+
},
|
|
40
|
+
scaleToFit: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
textAnchor: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "start"
|
|
47
|
+
},
|
|
48
|
+
verticalAnchor: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "end"
|
|
51
|
+
},
|
|
52
|
+
fill: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: "#808080"
|
|
55
|
+
},
|
|
56
|
+
angle: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 0
|
|
59
|
+
},
|
|
60
|
+
style: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: () => ({})
|
|
63
|
+
},
|
|
64
|
+
breakAll: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
maxLines: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: void 0
|
|
71
|
+
},
|
|
72
|
+
width: {
|
|
73
|
+
type: [Number, String],
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
value: {
|
|
77
|
+
type: [String, Number],
|
|
78
|
+
default: ""
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
setup(__props) {
|
|
82
|
+
const props = __props;
|
|
83
|
+
const BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
|
|
84
|
+
function calculateWordWidths(children, breakAll, style) {
|
|
85
|
+
let words = [];
|
|
86
|
+
if (children !== void 0 && children !== null) words = breakAll ? children.toString().split("") : children.toString().split(BREAKING_SPACES);
|
|
87
|
+
return {
|
|
88
|
+
wordsWithComputedWidth: words.map((word) => ({
|
|
89
|
+
word,
|
|
90
|
+
width: getStringSize(word, style).width
|
|
91
|
+
})),
|
|
92
|
+
spaceWidth: breakAll ? 0 : getStringSize("\xA0", style).width
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function calculateWordsByLines(maxLines, value, style, breakAll, initialWordsWithComputedWidth, spaceWidth, lineWidth, scaleToFit) {
|
|
96
|
+
const shouldLimitLines = typeof maxLines === "number";
|
|
97
|
+
const text = value;
|
|
98
|
+
const calculate = (words = []) => {
|
|
99
|
+
return words.reduce((result, { word, width }) => {
|
|
100
|
+
const currentLine = result[result.length - 1];
|
|
101
|
+
if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {
|
|
102
|
+
currentLine.words.push(word);
|
|
103
|
+
currentLine.width += width + spaceWidth;
|
|
104
|
+
} else result.push({
|
|
105
|
+
words: [word],
|
|
106
|
+
width
|
|
107
|
+
});
|
|
108
|
+
return result;
|
|
109
|
+
}, []);
|
|
110
|
+
};
|
|
111
|
+
const originalResult = calculate(initialWordsWithComputedWidth);
|
|
112
|
+
const findLongestLine = (words) => words.reduce((a, b) => a.width > b.width ? a : b);
|
|
113
|
+
if (!shouldLimitLines || scaleToFit) return originalResult;
|
|
114
|
+
if (!(originalResult.length > maxLines || findLongestLine(originalResult).width > Number(lineWidth))) return originalResult;
|
|
115
|
+
const suffix = "…";
|
|
116
|
+
const checkOverflow = (index) => {
|
|
117
|
+
const { wordsWithComputedWidth } = calculateWordWidths(text.slice(0, index) + suffix, breakAll, style);
|
|
118
|
+
const result = calculate(wordsWithComputedWidth);
|
|
119
|
+
return [result.length > maxLines || findLongestLine(result).width > Number(lineWidth), result];
|
|
120
|
+
};
|
|
121
|
+
let start = 0;
|
|
122
|
+
let end = text.length - 1;
|
|
123
|
+
let iterations = 0;
|
|
124
|
+
let trimmedResult;
|
|
125
|
+
while (start <= end && iterations <= text.length - 1) {
|
|
126
|
+
const middle = Math.floor((start + end) / 2);
|
|
127
|
+
const [doesPrevOverflow, result] = checkOverflow(middle - 1);
|
|
128
|
+
const [doesMiddleOverflow] = checkOverflow(middle);
|
|
129
|
+
if (!doesPrevOverflow && !doesMiddleOverflow) start = middle + 1;
|
|
130
|
+
if (doesPrevOverflow && doesMiddleOverflow) end = middle - 1;
|
|
131
|
+
if (!doesPrevOverflow && doesMiddleOverflow) {
|
|
132
|
+
trimmedResult = result;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
iterations++;
|
|
136
|
+
}
|
|
137
|
+
return trimmedResult || originalResult;
|
|
138
|
+
}
|
|
139
|
+
function getWordsByLines({ width, scaleToFit, value, style, breakAll, maxLines }) {
|
|
140
|
+
if (width || scaleToFit) {
|
|
141
|
+
const wordWidths = calculateWordWidths(value, breakAll, style);
|
|
142
|
+
const wordsWithComputedWidth = wordWidths.wordsWithComputedWidth;
|
|
143
|
+
const spaceWidth = wordWidths.spaceWidth;
|
|
144
|
+
return calculateWordsByLines(maxLines, value, style, breakAll, wordsWithComputedWidth, spaceWidth, width, scaleToFit);
|
|
145
|
+
}
|
|
146
|
+
return [{ words: value !== void 0 && value !== null ? value.toString().split(BREAKING_SPACES) : [] }];
|
|
147
|
+
}
|
|
148
|
+
const wordsByLines = computed(() => getWordsByLines({
|
|
149
|
+
width: props.width,
|
|
150
|
+
scaleToFit: props.scaleToFit,
|
|
151
|
+
value: props.value,
|
|
152
|
+
style: props.style,
|
|
153
|
+
breakAll: props.breakAll,
|
|
154
|
+
maxLines: props.maxLines
|
|
155
|
+
}));
|
|
156
|
+
const x = computed(() => Number(props.x) + (typeof props.dx === "number" ? props.dx : 0));
|
|
157
|
+
const y = computed(() => Number(props.y) + (typeof props.dy === "number" ? props.dy : 0));
|
|
158
|
+
const startDy = computed(() => {
|
|
159
|
+
switch (props.verticalAnchor) {
|
|
160
|
+
case "start": return reduceCSSCalc(`calc(${props.capHeight})`);
|
|
161
|
+
case "middle": return reduceCSSCalc(`calc(${(wordsByLines.value.length - 1) / 2} * -${props.lineHeight} + (${props.capHeight} / 2))`);
|
|
162
|
+
default: return reduceCSSCalc(`calc(${wordsByLines.value.length - 1} * -${props.lineHeight})`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const transforms = computed(() => {
|
|
166
|
+
const arr = [];
|
|
167
|
+
if (props.scaleToFit && wordsByLines.value[0]?.width && props.width) arr.push(`scale(${Number(props.width) / wordsByLines.value[0].width})`);
|
|
168
|
+
if (props.angle) arr.push(`rotate(${props.angle}, ${x.value}, ${y.value})`);
|
|
169
|
+
return arr.join(" ");
|
|
170
|
+
});
|
|
171
|
+
return (_ctx, _cache) => {
|
|
172
|
+
return openBlock(), createElementBlock("text", {
|
|
173
|
+
x: x.value,
|
|
174
|
+
y: y.value,
|
|
175
|
+
transform: transforms.value || void 0,
|
|
176
|
+
"text-anchor": props.textAnchor,
|
|
177
|
+
fill: props.fill && props.fill.includes("url") ? "#808080" : props.fill,
|
|
178
|
+
class: "v-charts-text",
|
|
179
|
+
style: normalizeStyle(props.style)
|
|
180
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(wordsByLines.value, (line, index) => {
|
|
181
|
+
return openBlock(), createElementBlock("tspan", {
|
|
182
|
+
key: index,
|
|
183
|
+
x: x.value,
|
|
184
|
+
dy: index === 0 ? startDy.value : props.lineHeight
|
|
185
|
+
}, toDisplayString(line.words.join(props.breakAll ? "" : " ")), 9, _hoisted_2);
|
|
186
|
+
}), 128))], 12, _hoisted_1);
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
//#endregion
|
|
191
|
+
export { Text_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { isNumOrStr } from "../utils/validate.mjs";
|
|
2
|
+
import { Curve } from "../shape/Curve.mjs";
|
|
3
|
+
import { useTooltipEventType } from "../state/selectors/selectTooltipEventType.mjs";
|
|
4
|
+
import { setTooltipSettingsState } from "../state/tooltipSlice.mjs";
|
|
5
|
+
import { useAppDispatch, useAppSelector } from "../state/hooks.mjs";
|
|
6
|
+
import { useChartLayout, useOffsetInternal, useViewBox } from "../context/chartLayoutContext.mjs";
|
|
7
|
+
import { selectActiveCoordinate, selectActiveLabel, selectIsTooltipActive, selectTooltipPayload, useChartName } from "../state/selectors/selectors.mjs";
|
|
8
|
+
import { Rectangle } from "../shape/Rectangle.mjs";
|
|
9
|
+
import { useCursorLayerRef } from "../context/cursorLayerContext.mjs";
|
|
10
|
+
import { usePortal } from "../chart/TooltipPortalContext.mjs";
|
|
11
|
+
import { useAccessibilityLayer } from "../context/accessibilityContext.mjs";
|
|
12
|
+
import { getTooltipTranslate } from "../utils/tooltip/translate.mjs";
|
|
13
|
+
import { Cross } from "../shape/Cross.mjs";
|
|
14
|
+
import { Sector } from "../shape/Sector.mjs";
|
|
15
|
+
import { getCursorPoints } from "./utils.mjs";
|
|
16
|
+
import { useTooltipAxisBandSize } from "../context/useTooltipAxis.mjs";
|
|
17
|
+
import { useTooltipChartSynchronisation } from "../synchronisation/useChartSynchronisation.mjs";
|
|
18
|
+
import { Fragment, Teleport, computed, createVNode, defineComponent, isVNode, reactive, ref, watch, watchEffect, watchPostEffect } from "vue";
|
|
19
|
+
import { sortBy, uniqBy } from "es-toolkit/compat";
|
|
20
|
+
import { animate } from "motion-v";
|
|
21
|
+
import { useElementBounding, useMagicKeys, usePreferredReducedMotion } from "@vueuse/core";
|
|
22
|
+
//#region src/components/Tooltip.tsx
|
|
23
|
+
function _isSlot(s) {
|
|
24
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
25
|
+
}
|
|
26
|
+
function defaultUniqBy(entry) {
|
|
27
|
+
return entry.dataKey;
|
|
28
|
+
}
|
|
29
|
+
function getUniqPayload(payload, option, defaultUniqBy) {
|
|
30
|
+
if (option === true) return uniqBy(payload, defaultUniqBy);
|
|
31
|
+
if (typeof option === "function") return uniqBy(payload, option);
|
|
32
|
+
return payload;
|
|
33
|
+
}
|
|
34
|
+
function defaultFormatter(value) {
|
|
35
|
+
return Array.isArray(value) && isNumOrStr(value[0]) && isNumOrStr(value[1]) ? value.join(" ~ ") : value;
|
|
36
|
+
}
|
|
37
|
+
var DefaultTooltipContent = /* @__PURE__ */ defineComponent({
|
|
38
|
+
name: "DefaultTooltipContent",
|
|
39
|
+
props: {
|
|
40
|
+
label: [String, Number],
|
|
41
|
+
payload: Array,
|
|
42
|
+
active: Boolean,
|
|
43
|
+
separator: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: " : "
|
|
46
|
+
},
|
|
47
|
+
contentStyle: Object,
|
|
48
|
+
labelStyle: Object,
|
|
49
|
+
itemStyle: Object,
|
|
50
|
+
itemSorter: [Function, String],
|
|
51
|
+
formatter: Function
|
|
52
|
+
},
|
|
53
|
+
setup(props) {
|
|
54
|
+
return () => {
|
|
55
|
+
if (!props.active || !props.payload?.length) return null;
|
|
56
|
+
const { contentStyle, labelStyle, itemStyle } = props;
|
|
57
|
+
const finalStyle = {
|
|
58
|
+
margin: 0,
|
|
59
|
+
padding: "10px",
|
|
60
|
+
backgroundColor: "#fff",
|
|
61
|
+
border: "1px solid #ccc",
|
|
62
|
+
whiteSpace: "nowrap",
|
|
63
|
+
...contentStyle
|
|
64
|
+
};
|
|
65
|
+
const finalLabelStyle = {
|
|
66
|
+
margin: 0,
|
|
67
|
+
...labelStyle
|
|
68
|
+
};
|
|
69
|
+
const { itemSorter, payload, formatter } = props;
|
|
70
|
+
const sortedPayload = itemSorter ? sortBy(payload, itemSorter) : payload;
|
|
71
|
+
return createVNode("div", {
|
|
72
|
+
"class": "v-charts-tooltip-content",
|
|
73
|
+
"style": finalStyle
|
|
74
|
+
}, [props.label && createVNode("div", {
|
|
75
|
+
"class": "v-charts-tooltip-label",
|
|
76
|
+
"style": finalLabelStyle
|
|
77
|
+
}, [props.label]), createVNode("div", { "class": "v-charts-tooltip-list" }, [sortedPayload.map((entry, index) => {
|
|
78
|
+
const finalItemStyle = {
|
|
79
|
+
display: "block",
|
|
80
|
+
paddingTop: 4,
|
|
81
|
+
paddingBottom: 4,
|
|
82
|
+
color: entry.color || "#000",
|
|
83
|
+
...itemStyle
|
|
84
|
+
};
|
|
85
|
+
const finalFormatter = entry.formatter || formatter || defaultFormatter;
|
|
86
|
+
const { value, name } = entry;
|
|
87
|
+
let finalValue = value;
|
|
88
|
+
let finalName = name;
|
|
89
|
+
if (finalFormatter) {
|
|
90
|
+
const formatted = finalFormatter(value, name, entry, index, payload);
|
|
91
|
+
if (Array.isArray(formatted)) [finalValue, finalName] = formatted;
|
|
92
|
+
else if (formatted != null) finalValue = formatted;
|
|
93
|
+
else return null;
|
|
94
|
+
}
|
|
95
|
+
return createVNode("div", {
|
|
96
|
+
"key": index,
|
|
97
|
+
"class": "v-charts-tooltip-item",
|
|
98
|
+
"style": finalItemStyle
|
|
99
|
+
}, [
|
|
100
|
+
createVNode("span", {
|
|
101
|
+
"class": "v-charts-tooltip-item-name",
|
|
102
|
+
"style": { color: entry.color }
|
|
103
|
+
}, [entry.name]),
|
|
104
|
+
createVNode("span", { "class": "v-charts-tooltip-separator" }, [props.separator]),
|
|
105
|
+
createVNode("span", { "class": "v-charts-tooltip-item-value" }, [finalValue]),
|
|
106
|
+
createVNode("span", { "class": "v-charts-tooltip-item-unit" }, [entry.unit || ""])
|
|
107
|
+
]);
|
|
108
|
+
})])]);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
var TooltipBoundingBox = /* @__PURE__ */ defineComponent({
|
|
113
|
+
name: "TooltipBoundingBox",
|
|
114
|
+
props: {
|
|
115
|
+
allowEscapeViewBox: Object,
|
|
116
|
+
isAnimationActive: Boolean,
|
|
117
|
+
transition: {
|
|
118
|
+
type: Object,
|
|
119
|
+
default: () => ({
|
|
120
|
+
duration: .4,
|
|
121
|
+
ease: "easeOut"
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
active: Boolean,
|
|
125
|
+
coordinate: Object,
|
|
126
|
+
hasPayload: Boolean,
|
|
127
|
+
offset: Number,
|
|
128
|
+
position: Object,
|
|
129
|
+
reverseDirection: Object,
|
|
130
|
+
viewBox: Object,
|
|
131
|
+
style: Object
|
|
132
|
+
},
|
|
133
|
+
setup(props, { slots }) {
|
|
134
|
+
const dismissed = ref(false);
|
|
135
|
+
const dismissedAtCoordinate = reactive({
|
|
136
|
+
x: 0,
|
|
137
|
+
y: 0
|
|
138
|
+
});
|
|
139
|
+
watchEffect(() => {
|
|
140
|
+
if (props.coordinate?.x !== dismissedAtCoordinate.x || props.coordinate?.y !== dismissedAtCoordinate.y) dismissed.value = false;
|
|
141
|
+
}, { flush: "post" });
|
|
142
|
+
const { escape } = useMagicKeys();
|
|
143
|
+
watch(escape, (v) => {
|
|
144
|
+
if (v) {
|
|
145
|
+
dismissed.value = true;
|
|
146
|
+
dismissedAtCoordinate.x = props.coordinate?.x ?? 0;
|
|
147
|
+
dismissedAtCoordinate.y = props.coordinate?.y ?? 0;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const el = ref();
|
|
151
|
+
const lastBoundingBox = useElementBounding(el, {});
|
|
152
|
+
let preTransform;
|
|
153
|
+
let animationControls;
|
|
154
|
+
const reducedMotion = usePreferredReducedMotion();
|
|
155
|
+
const currentTransform = computed(() => {
|
|
156
|
+
const { allowEscapeViewBox, coordinate, position, reverseDirection, viewBox } = props;
|
|
157
|
+
let { cssClasses, cssProperties, transform } = getTooltipTranslate({
|
|
158
|
+
allowEscapeViewBox,
|
|
159
|
+
coordinate,
|
|
160
|
+
offsetTopLeft: props.offset,
|
|
161
|
+
position,
|
|
162
|
+
reverseDirection,
|
|
163
|
+
tooltipBox: {
|
|
164
|
+
height: lastBoundingBox.height.value,
|
|
165
|
+
width: lastBoundingBox.width.value
|
|
166
|
+
},
|
|
167
|
+
useTranslate3d: false,
|
|
168
|
+
viewBox
|
|
169
|
+
});
|
|
170
|
+
transform = !lastBoundingBox.height.value && preTransform ? preTransform : transform;
|
|
171
|
+
preTransform = transform || preTransform;
|
|
172
|
+
return {
|
|
173
|
+
cssClasses,
|
|
174
|
+
cssProperties,
|
|
175
|
+
transform
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
watchPostEffect((onCleanup) => {
|
|
179
|
+
const element = el.value;
|
|
180
|
+
const transform = currentTransform.value.transform;
|
|
181
|
+
if (!element || !transform?.transform) return;
|
|
182
|
+
if (props.isAnimationActive && reducedMotion.value !== "reduce") animationControls = animate(element, { transform: transform.transform }, props.transition);
|
|
183
|
+
else element.style.transform = transform.transform;
|
|
184
|
+
onCleanup(() => {
|
|
185
|
+
animationControls?.stop();
|
|
186
|
+
animationControls = void 0;
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
return () => {
|
|
190
|
+
const { active, hasPayload, style } = props;
|
|
191
|
+
const { cssClasses, cssProperties } = currentTransform.value;
|
|
192
|
+
const boundingBoxStyle = {
|
|
193
|
+
...cssProperties,
|
|
194
|
+
pointerEvents: "none",
|
|
195
|
+
visibility: !dismissed.value && active && hasPayload ? "visible" : "hidden",
|
|
196
|
+
position: "absolute",
|
|
197
|
+
top: 0,
|
|
198
|
+
left: 0,
|
|
199
|
+
...style
|
|
200
|
+
};
|
|
201
|
+
return createVNode("div", {
|
|
202
|
+
"role": "tooltip",
|
|
203
|
+
"aria-live": "polite",
|
|
204
|
+
"tabindex": -1,
|
|
205
|
+
"class": cssClasses,
|
|
206
|
+
"style": boundingBoxStyle,
|
|
207
|
+
"ref": el
|
|
208
|
+
}, [slots.default?.()]);
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
var Cursor = /* @__PURE__ */ defineComponent({
|
|
213
|
+
name: "Cursor",
|
|
214
|
+
props: {
|
|
215
|
+
cursor: [Boolean, Object],
|
|
216
|
+
cursorSlot: Function,
|
|
217
|
+
tooltipEventType: String,
|
|
218
|
+
coordinate: Object,
|
|
219
|
+
payload: Array,
|
|
220
|
+
index: String
|
|
221
|
+
},
|
|
222
|
+
setup(props) {
|
|
223
|
+
const offset = useOffsetInternal();
|
|
224
|
+
const layout = useChartLayout();
|
|
225
|
+
const chartName = useChartName();
|
|
226
|
+
const tooltipAxisBandSize = useTooltipAxisBandSize();
|
|
227
|
+
const cursorLayerRef = useCursorLayerRef(null);
|
|
228
|
+
const points = computed(() => getCursorPoints(layout.value, props.coordinate, offset.value));
|
|
229
|
+
return () => {
|
|
230
|
+
if (!props.cursor || !props.coordinate) return null;
|
|
231
|
+
const isScatterChart = chartName.value === "ScatterChart";
|
|
232
|
+
if (!isScatterChart && props.tooltipEventType !== "axis") return null;
|
|
233
|
+
const cursor = props.cursor;
|
|
234
|
+
const cursorSvgProps = typeof cursor === "object" ? cursor : {};
|
|
235
|
+
let cursorElement;
|
|
236
|
+
if (isScatterChart) {
|
|
237
|
+
const { offset: _offset, ...coord } = props.coordinate;
|
|
238
|
+
const { top, left, width, height } = offset.value;
|
|
239
|
+
const crossProps = {
|
|
240
|
+
stroke: "#ccc",
|
|
241
|
+
fill: "none",
|
|
242
|
+
...coord,
|
|
243
|
+
top,
|
|
244
|
+
left,
|
|
245
|
+
width,
|
|
246
|
+
height,
|
|
247
|
+
class: "v-charts-tooltip-cursor",
|
|
248
|
+
style: { pointerEvents: "none" },
|
|
249
|
+
...cursorSvgProps
|
|
250
|
+
};
|
|
251
|
+
cursorElement = props.cursorSlot ? props.cursorSlot(crossProps) : createVNode(Cross, crossProps, null);
|
|
252
|
+
} else if (chartName.value === "BarChart") {
|
|
253
|
+
const bandSize = tooltipAxisBandSize.value ?? 0;
|
|
254
|
+
const halfSize = bandSize / 2;
|
|
255
|
+
const coord = props.coordinate;
|
|
256
|
+
const off = offset.value;
|
|
257
|
+
const rectProps = {
|
|
258
|
+
stroke: "none",
|
|
259
|
+
fill: "#ccc",
|
|
260
|
+
x: layout.value === "horizontal" ? coord.x - halfSize : off.left + .5,
|
|
261
|
+
y: layout.value === "horizontal" ? off.top + .5 : coord.y - halfSize,
|
|
262
|
+
width: layout.value === "horizontal" ? bandSize : off.width - 1,
|
|
263
|
+
height: layout.value === "horizontal" ? off.height - 1 : bandSize,
|
|
264
|
+
class: "v-charts-tooltip-cursor",
|
|
265
|
+
style: { pointerEvents: "none" },
|
|
266
|
+
...cursorSvgProps
|
|
267
|
+
};
|
|
268
|
+
cursorElement = props.cursorSlot ? props.cursorSlot(rectProps) : createVNode(Rectangle, rectProps, null);
|
|
269
|
+
} else if (layout.value === "radial" && props.coordinate?.cx != null) {
|
|
270
|
+
const radialPoints = points.value;
|
|
271
|
+
const sectorProps = {
|
|
272
|
+
cx: radialPoints.cx,
|
|
273
|
+
cy: radialPoints.cy,
|
|
274
|
+
startAngle: radialPoints.startAngle,
|
|
275
|
+
endAngle: radialPoints.endAngle,
|
|
276
|
+
innerRadius: radialPoints.radius,
|
|
277
|
+
outerRadius: radialPoints.radius,
|
|
278
|
+
stroke: "#ccc",
|
|
279
|
+
fill: "none",
|
|
280
|
+
class: "v-charts-tooltip-cursor",
|
|
281
|
+
style: { pointerEvents: "none" },
|
|
282
|
+
...cursorSvgProps
|
|
283
|
+
};
|
|
284
|
+
cursorElement = props.cursorSlot ? props.cursorSlot(sectorProps) : createVNode(Sector, sectorProps, null);
|
|
285
|
+
} else {
|
|
286
|
+
const cursorProps = {
|
|
287
|
+
stroke: "#ccc",
|
|
288
|
+
class: ["v-charts-tooltip-cursor"],
|
|
289
|
+
layout: layout.value,
|
|
290
|
+
points: points.value,
|
|
291
|
+
style: { pointerEvents: "none" },
|
|
292
|
+
...cursorSvgProps
|
|
293
|
+
};
|
|
294
|
+
cursorElement = props.cursorSlot ? props.cursorSlot(cursorProps) : createVNode(Curve, cursorProps, null);
|
|
295
|
+
}
|
|
296
|
+
if (cursorLayerRef?.value) return createVNode(Teleport, { "to": cursorLayerRef.value }, _isSlot(cursorElement) ? cursorElement : { default: () => [cursorElement] });
|
|
297
|
+
return cursorElement;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
var Tooltip = /* @__PURE__ */ defineComponent({
|
|
302
|
+
name: "Tooltip",
|
|
303
|
+
props: {
|
|
304
|
+
active: {
|
|
305
|
+
type: Boolean,
|
|
306
|
+
default: void 0
|
|
307
|
+
},
|
|
308
|
+
includeHidden: Boolean,
|
|
309
|
+
allowEscapeViewBox: {
|
|
310
|
+
type: Object,
|
|
311
|
+
default: () => ({
|
|
312
|
+
x: false,
|
|
313
|
+
y: false
|
|
314
|
+
})
|
|
315
|
+
},
|
|
316
|
+
content: [Object, Function],
|
|
317
|
+
cursor: {
|
|
318
|
+
type: [Boolean, Object],
|
|
319
|
+
default: true
|
|
320
|
+
},
|
|
321
|
+
filterNull: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
default: true
|
|
324
|
+
},
|
|
325
|
+
defaultIndex: [Number, String],
|
|
326
|
+
isAnimationActive: {
|
|
327
|
+
type: Boolean,
|
|
328
|
+
default: true
|
|
329
|
+
},
|
|
330
|
+
offset: {
|
|
331
|
+
type: Number,
|
|
332
|
+
default: 10
|
|
333
|
+
},
|
|
334
|
+
payloadUniqBy: [Boolean, Function],
|
|
335
|
+
portal: {
|
|
336
|
+
type: Object,
|
|
337
|
+
default: void 0
|
|
338
|
+
},
|
|
339
|
+
position: Object,
|
|
340
|
+
reverseDirection: {
|
|
341
|
+
type: Object,
|
|
342
|
+
default: () => ({
|
|
343
|
+
x: false,
|
|
344
|
+
y: false
|
|
345
|
+
})
|
|
346
|
+
},
|
|
347
|
+
shared: {
|
|
348
|
+
type: [Boolean, void 0],
|
|
349
|
+
default: void 0
|
|
350
|
+
},
|
|
351
|
+
trigger: {
|
|
352
|
+
type: String,
|
|
353
|
+
default: "hover"
|
|
354
|
+
},
|
|
355
|
+
style: {
|
|
356
|
+
type: Object,
|
|
357
|
+
default: () => ({})
|
|
358
|
+
},
|
|
359
|
+
axisId: {
|
|
360
|
+
type: [String, Number],
|
|
361
|
+
default: 0
|
|
362
|
+
},
|
|
363
|
+
contentStyle: {
|
|
364
|
+
type: Object,
|
|
365
|
+
default: () => ({})
|
|
366
|
+
},
|
|
367
|
+
itemStyle: {
|
|
368
|
+
type: Object,
|
|
369
|
+
default: () => ({})
|
|
370
|
+
},
|
|
371
|
+
labelStyle: {
|
|
372
|
+
type: Object,
|
|
373
|
+
default: () => ({})
|
|
374
|
+
},
|
|
375
|
+
itemSorter: {
|
|
376
|
+
type: String,
|
|
377
|
+
default: "name"
|
|
378
|
+
},
|
|
379
|
+
separator: {
|
|
380
|
+
type: String,
|
|
381
|
+
default: " : "
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
slots: Object,
|
|
385
|
+
setup(props, { slots }) {
|
|
386
|
+
const dispatch = useAppDispatch();
|
|
387
|
+
const defaultIndexAsString = computed(() => typeof props.defaultIndex === "number" ? String(props.defaultIndex) : props.defaultIndex);
|
|
388
|
+
watchEffect(() => {
|
|
389
|
+
dispatch(setTooltipSettingsState({
|
|
390
|
+
shared: props.shared,
|
|
391
|
+
trigger: props.trigger,
|
|
392
|
+
axisId: props.axisId,
|
|
393
|
+
active: props.active,
|
|
394
|
+
defaultIndex: defaultIndexAsString.value
|
|
395
|
+
}));
|
|
396
|
+
});
|
|
397
|
+
const viewBox = useViewBox();
|
|
398
|
+
const accessibilityLayer = useAccessibilityLayer();
|
|
399
|
+
const tooltipEventType = useTooltipEventType(props.shared);
|
|
400
|
+
const tooltipState = useAppSelector((state) => selectIsTooltipActive(state, tooltipEventType.value, props.trigger, defaultIndexAsString.value));
|
|
401
|
+
const payloadFromRedux = useAppSelector((state) => selectTooltipPayload(state, tooltipEventType.value, props.trigger, defaultIndexAsString.value));
|
|
402
|
+
const labelFromRedux = useAppSelector((state) => selectActiveLabel(state, tooltipEventType.value, props.trigger, defaultIndexAsString.value));
|
|
403
|
+
const coordinate = useAppSelector((state) => selectActiveCoordinate(state, tooltipEventType.value, props.trigger, defaultIndexAsString.value));
|
|
404
|
+
const payload = computed(() => payloadFromRedux.value ?? []);
|
|
405
|
+
const tooltipPortalFromContext = usePortal();
|
|
406
|
+
const tooltipPortal = computed(() => props.portal ?? tooltipPortalFromContext?.value);
|
|
407
|
+
const finalIsActive = computed(() => props.active ?? tooltipState.value?.isActive);
|
|
408
|
+
const finalLabel = computed(() => tooltipEventType.value === "axis" ? labelFromRedux.value : void 0);
|
|
409
|
+
const emptyPayload = [];
|
|
410
|
+
const finalPayload = computed(() => {
|
|
411
|
+
if (!finalIsActive.value) return emptyPayload;
|
|
412
|
+
let result = payload.value ?? emptyPayload;
|
|
413
|
+
if (props.filterNull && result.length > 0) result = getUniqPayload(result.filter((entry) => entry.value != null && (entry.hide !== true || props.includeHidden)), props.payloadUniqBy, defaultUniqBy);
|
|
414
|
+
return result;
|
|
415
|
+
});
|
|
416
|
+
const hasPayload = computed(() => finalPayload.value.length > 0);
|
|
417
|
+
const contentComponent = computed(() => {
|
|
418
|
+
if (props.content) return props.content;
|
|
419
|
+
return DefaultTooltipContent;
|
|
420
|
+
});
|
|
421
|
+
const contentProps = computed(() => ({
|
|
422
|
+
...props,
|
|
423
|
+
payload: finalPayload.value,
|
|
424
|
+
label: finalLabel.value,
|
|
425
|
+
active: finalIsActive.value,
|
|
426
|
+
coordinate: coordinate.value,
|
|
427
|
+
accessibilityLayer: accessibilityLayer.value
|
|
428
|
+
}));
|
|
429
|
+
const hasContentSlot = computed(() => !!slots.content);
|
|
430
|
+
useTooltipChartSynchronisation({
|
|
431
|
+
tooltipEventType,
|
|
432
|
+
trigger: props.trigger,
|
|
433
|
+
activeCoordinate: coordinate,
|
|
434
|
+
activeLabel: finalLabel,
|
|
435
|
+
activeIndex: computed(() => tooltipState.value?.activeIndex),
|
|
436
|
+
isTooltipActive: finalIsActive
|
|
437
|
+
});
|
|
438
|
+
return () => {
|
|
439
|
+
if (!tooltipPortal.value) return null;
|
|
440
|
+
return createVNode(Fragment, null, [createVNode("foreignObject", null, [createVNode(Teleport, { "to": tooltipPortal.value }, { default: () => [createVNode(TooltipBoundingBox, {
|
|
441
|
+
"allowEscapeViewBox": props.allowEscapeViewBox,
|
|
442
|
+
"isAnimationActive": props.isAnimationActive,
|
|
443
|
+
"active": finalIsActive.value,
|
|
444
|
+
"coordinate": coordinate.value,
|
|
445
|
+
"hasPayload": hasPayload.value,
|
|
446
|
+
"offset": props.offset,
|
|
447
|
+
"position": props.position,
|
|
448
|
+
"reverseDirection": props.reverseDirection,
|
|
449
|
+
"viewBox": viewBox.value,
|
|
450
|
+
"style": props.style
|
|
451
|
+
}, { default: () => [hasContentSlot.value ? slots.content(contentProps.value) : createVNode(contentComponent.value, contentProps.value, null)] })] })]), finalIsActive.value && createVNode(Cursor, {
|
|
452
|
+
"cursor": props.cursor,
|
|
453
|
+
"cursorSlot": slots.cursor,
|
|
454
|
+
"tooltipEventType": tooltipEventType.value,
|
|
455
|
+
"coordinate": coordinate.value,
|
|
456
|
+
"payload": payload.value,
|
|
457
|
+
"index": tooltipState.value?.activeIndex
|
|
458
|
+
}, null)]);
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
//#endregion
|
|
463
|
+
export { Tooltip as default, getUniqPayload };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { useViewBox } from "../../context/chartLayoutContext.mjs";
|
|
3
|
+
import { LabelVueProps } from "./types.mjs";
|
|
4
|
+
import { usePolarLabelViewBox } from "../../context/polarLabelViewBoxContext.mjs";
|
|
5
|
+
import { getAttrsOfCartesianLabel, getAttrsOfPolarLabel, isPolar, renderRadialLabel } from "./utils.mjs";
|
|
6
|
+
import Text_default from "../Text.mjs";
|
|
7
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
8
|
+
//#region src/components/label/Label.tsx
|
|
9
|
+
var Label = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "Label",
|
|
11
|
+
props: LabelVueProps,
|
|
12
|
+
slots: Object,
|
|
13
|
+
setup(props, { slots, attrs }) {
|
|
14
|
+
const viewBoxFromContext = useViewBox();
|
|
15
|
+
const polarLabelViewBox = usePolarLabelViewBox();
|
|
16
|
+
return () => {
|
|
17
|
+
const { viewBox: viewBoxFromProps, value, position, textBreakAll, formatter } = props;
|
|
18
|
+
const viewBox = viewBoxFromProps || polarLabelViewBox.value || viewBoxFromContext.value;
|
|
19
|
+
if (!viewBox || isNullish(value) && !slots.content) return null;
|
|
20
|
+
const isPolarLabel = isPolar(viewBox);
|
|
21
|
+
if (slots.content) return slots.content({
|
|
22
|
+
...props,
|
|
23
|
+
viewBox
|
|
24
|
+
});
|
|
25
|
+
let label = value;
|
|
26
|
+
if (typeof formatter === "function") label = formatter(label);
|
|
27
|
+
if (isPolarLabel && (position === "insideStart" || position === "insideEnd" || position === "end")) return renderRadialLabel(props, position, label, attrs, viewBox);
|
|
28
|
+
const positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props, viewBox) : getAttrsOfCartesianLabel(props, viewBox);
|
|
29
|
+
const textAnchor = attrs.textAnchor != null && (attrs.textAnchor === "start" || attrs.textAnchor === "middle" || attrs.textAnchor === "end") ? attrs.textAnchor : positionAttrs.textAnchor;
|
|
30
|
+
return createVNode(Text_default, mergeProps({ "class": ["v-charts-label", props.class] }, attrs, positionAttrs, {
|
|
31
|
+
"textAnchor": textAnchor,
|
|
32
|
+
"angle": props.angle,
|
|
33
|
+
"breakAll": textBreakAll,
|
|
34
|
+
"value": label
|
|
35
|
+
}), null);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Label };
|