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.
Files changed (470) hide show
  1. package/LICENSE +21 -0
  2. package/dist/animation/Animate.d.ts +72 -0
  3. package/dist/cartesian/GraphicalItemClipPath.d.ts +31 -0
  4. package/dist/cartesian/area/ActivePoints.d.ts +77 -0
  5. package/dist/cartesian/area/Area.d.ts +17 -0
  6. package/dist/cartesian/area/ClipRect.d.ts +1 -0
  7. package/dist/cartesian/area/RenderArea.d.ts +16 -0
  8. package/dist/cartesian/area/__stories__/config.d.ts +31 -0
  9. package/dist/cartesian/area/hooks/useArea.d.ts +27 -0
  10. package/dist/cartesian/area/index.d.ts +2 -0
  11. package/dist/cartesian/area/type.d.ts +173 -0
  12. package/dist/cartesian/area/utils.d.ts +19 -0
  13. package/dist/cartesian/axis/XAxis.d.ts +189 -0
  14. package/dist/cartesian/axis/YAxis.d.ts +192 -0
  15. package/dist/cartesian/axis/index.d.ts +2 -0
  16. package/dist/cartesian/axis/type.d.ts +57 -0
  17. package/dist/cartesian/bar/Bar.d.ts +2 -0
  18. package/dist/cartesian/bar/components/BarBackground.d.ts +1 -0
  19. package/dist/cartesian/bar/components/BarRectangles.d.ts +1 -0
  20. package/dist/cartesian/bar/hooks/useBar.d.ts +23 -0
  21. package/dist/cartesian/bar/index.d.ts +1 -0
  22. package/dist/cartesian/bar/type.d.ts +166 -0
  23. package/dist/cartesian/bar/utils.d.ts +31 -0
  24. package/dist/cartesian/brush/Brush.d.ts +2 -0
  25. package/dist/cartesian/brush/components/Background.d.ts +15 -0
  26. package/dist/cartesian/brush/components/BrushText.d.ts +27 -0
  27. package/dist/cartesian/brush/components/Panorama.d.ts +65 -0
  28. package/dist/cartesian/brush/components/Slide.d.ts +20 -0
  29. package/dist/cartesian/brush/components/Traveller.d.ts +13 -0
  30. package/dist/cartesian/brush/components/TravellerLayer.d.ts +22 -0
  31. package/dist/cartesian/brush/hooks/useBrushHandlers.d.ts +25 -0
  32. package/dist/cartesian/brush/hooks/useBrushSetting.d.ts +6 -0
  33. package/dist/cartesian/brush/hooks/useBrushState.d.ts +29 -0
  34. package/dist/cartesian/brush/index.d.ts +2 -0
  35. package/dist/cartesian/brush/type.d.ts +103 -0
  36. package/dist/cartesian/brush/utils.d.ts +15 -0
  37. package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +209 -0
  38. package/dist/cartesian/cartesian-axis/const.d.ts +24 -0
  39. package/dist/cartesian/cartesian-axis/index.d.ts +1 -0
  40. package/dist/cartesian/cartesian-axis/use-axis-line.d.ts +7 -0
  41. package/dist/cartesian/cartesian-grid/Background.d.ts +18 -0
  42. package/dist/cartesian/cartesian-grid/CartesianGrid.d.ts +75 -0
  43. package/dist/cartesian/cartesian-grid/HorizontalGridLines.d.ts +37 -0
  44. package/dist/cartesian/cartesian-grid/HorizontalStripes.d.ts +20 -0
  45. package/dist/cartesian/cartesian-grid/VerticalGridLines.d.ts +26 -0
  46. package/dist/cartesian/cartesian-grid/VerticalStripes.d.ts +20 -0
  47. package/dist/cartesian/cartesian-grid/const.d.ts +6 -0
  48. package/dist/cartesian/cartesian-grid/index.d.ts +1 -0
  49. package/dist/cartesian/cartesian-grid/type.d.ts +145 -0
  50. package/dist/cartesian/cartesian-grid/utils.d.ts +5 -0
  51. package/dist/cartesian/error-bar/ErrorBar.d.ts +68 -0
  52. package/dist/cartesian/error-bar/ErrorBarContext.d.ts +27 -0
  53. package/dist/cartesian/error-bar/index.d.ts +2 -0
  54. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  55. package/dist/cartesian/funnel/index.d.ts +2 -0
  56. package/dist/cartesian/funnel/type.d.ts +106 -0
  57. package/dist/cartesian/funnel/utils.d.ts +12 -0
  58. package/dist/cartesian/index.d.ts +12 -0
  59. package/dist/cartesian/line/ActivePoints.d.ts +77 -0
  60. package/dist/cartesian/line/Line.d.ts +87 -0
  61. package/dist/cartesian/line/StaticLine.d.ts +16 -0
  62. package/dist/cartesian/line/hooks/useLine.d.ts +28 -0
  63. package/dist/cartesian/line/index.d.ts +3 -0
  64. package/dist/cartesian/line/type.d.ts +180 -0
  65. package/dist/cartesian/line/utils.d.ts +13 -0
  66. package/dist/cartesian/reference-area/ReferenceArea.d.ts +191 -0
  67. package/dist/cartesian/reference-area/index.d.ts +1 -0
  68. package/dist/cartesian/reference-line/ReferenceLine.d.ts +139 -0
  69. package/dist/cartesian/reference-line/index.d.ts +1 -0
  70. package/dist/cartesian/scatter/Scatter.d.ts +165 -0
  71. package/dist/cartesian/scatter/hooks/useScatter.d.ts +18 -0
  72. package/dist/cartesian/scatter/index.d.ts +1 -0
  73. package/dist/cartesian/type.d.ts +21 -0
  74. package/dist/cartesian/useNeedsClip.d.ts +6 -0
  75. package/dist/cartesian/utils/get-ticks.d.ts +16 -0
  76. package/dist/cartesian/z-axis/ZAxis.d.ts +81 -0
  77. package/dist/cartesian/z-axis/index.d.ts +1 -0
  78. package/dist/chart/AreaChart.d.ts +1 -0
  79. package/dist/chart/BarChart.d.ts +1 -0
  80. package/dist/chart/ComposedChart.d.ts +1 -0
  81. package/dist/chart/FunnelChart.d.ts +1 -0
  82. package/dist/chart/LegendPortalContext.d.ts +3 -0
  83. package/dist/chart/LineChart.d.ts +1 -0
  84. package/dist/chart/PieChart.d.ts +1 -0
  85. package/dist/chart/RadarChart.d.ts +1 -0
  86. package/dist/chart/RadialBarChart.d.ts +1 -0
  87. package/dist/chart/RechartsWrapper.d.ts +99 -0
  88. package/dist/chart/ScatterChart.d.ts +1 -0
  89. package/dist/chart/Surface.d.ts +40 -0
  90. package/dist/chart/TooltipPortalContext.d.ts +2 -0
  91. package/dist/chart/const.d.ts +6 -0
  92. package/dist/chart/generateCategoricalChart.d.ts +118 -0
  93. package/dist/chart/index.d.ts +9 -0
  94. package/dist/chart/provideClipPathId.d.ts +12 -0
  95. package/dist/components/Cell.d.ts +18 -0
  96. package/dist/components/DefaultLegendContent.d.ts +18 -0
  97. package/dist/components/Text.d.ts +149 -0
  98. package/dist/components/Tooltip.d.ts +250 -0
  99. package/dist/components/index.d.ts +4 -0
  100. package/dist/components/label/Label.d.ts +81 -0
  101. package/dist/components/label/LabelList.d.ts +63 -0
  102. package/dist/components/label/index.d.ts +2 -0
  103. package/dist/components/label/types.d.ts +88 -0
  104. package/dist/components/label/utils.d.ts +24 -0
  105. package/dist/components/legend/Legend.d.ts +4 -0
  106. package/dist/components/legend/LegendSymbol.d.ts +27 -0
  107. package/dist/components/legend/hooks/useLegend.d.ts +19 -0
  108. package/dist/components/legend/hooks/useLegendContent.d.ts +36 -0
  109. package/dist/components/legend/index.d.ts +2 -0
  110. package/dist/components/legend/type.d.ts +54 -0
  111. package/dist/components/legend/utils.d.ts +18 -0
  112. package/dist/components/types.d.ts +9 -0
  113. package/dist/components/utils.d.ts +4 -0
  114. package/dist/container/ClipPath.d.ts +12 -0
  115. package/dist/container/Layer.d.ts +2 -0
  116. package/dist/container/ResponsiveContainer.d.ts +50 -0
  117. package/dist/container/RootSurface.d.ts +17 -0
  118. package/dist/container/Surface.d.ts +25 -0
  119. package/dist/container/index.d.ts +1 -0
  120. package/dist/container/useSizeContext.d.ts +11 -0
  121. package/dist/context/ChartDataContextProvider.d.ts +17 -0
  122. package/dist/context/PanoramaContextProvider.d.ts +22 -0
  123. package/dist/context/accessibilityContext.d.ts +1 -0
  124. package/dist/context/cartesianLabelListContext.d.ts +3 -0
  125. package/dist/context/chartLayoutContext.d.ts +8 -0
  126. package/dist/context/cursorLayerContext.d.ts +2 -0
  127. package/dist/context/graphicalLayerContext.d.ts +2 -0
  128. package/dist/context/labelLayerContext.d.ts +2 -0
  129. package/dist/context/polarLabelViewBoxContext.d.ts +4 -0
  130. package/dist/context/useTooltipAxis.d.ts +2 -0
  131. package/dist/es/animation/Animate.mjs +89 -0
  132. package/dist/es/cartesian/GraphicalItemClipPath.mjs +37 -0
  133. package/dist/es/cartesian/area/ActivePoints.mjs +78 -0
  134. package/dist/es/cartesian/area/Area.mjs +52 -0
  135. package/dist/es/cartesian/area/ClipRect.mjs +125 -0
  136. package/dist/es/cartesian/area/RenderArea.mjs +185 -0
  137. package/dist/es/cartesian/area/hooks/useArea.mjs +81 -0
  138. package/dist/es/cartesian/area/type.mjs +136 -0
  139. package/dist/es/cartesian/area/utils.mjs +79 -0
  140. package/dist/es/cartesian/axis/XAxis.mjs +203 -0
  141. package/dist/es/cartesian/axis/YAxis.mjs +192 -0
  142. package/dist/es/cartesian/bar/Bar.mjs +111 -0
  143. package/dist/es/cartesian/bar/components/BarBackground.mjs +32 -0
  144. package/dist/es/cartesian/bar/components/BarRectangles.mjs +143 -0
  145. package/dist/es/cartesian/bar/hooks/useBar.mjs +53 -0
  146. package/dist/es/cartesian/bar/type.mjs +131 -0
  147. package/dist/es/cartesian/bar/utils.mjs +111 -0
  148. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +296 -0
  149. package/dist/es/cartesian/cartesian-grid/Background.mjs +33 -0
  150. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +174 -0
  151. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +50 -0
  152. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +43 -0
  153. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +45 -0
  154. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +43 -0
  155. package/dist/es/cartesian/cartesian-grid/const.mjs +336 -0
  156. package/dist/es/cartesian/cartesian-grid/utils.mjs +22 -0
  157. package/dist/es/cartesian/error-bar/ErrorBar.mjs +143 -0
  158. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +20 -0
  159. package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
  160. package/dist/es/cartesian/funnel/type.mjs +80 -0
  161. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  162. package/dist/es/cartesian/line/ActivePoints.mjs +79 -0
  163. package/dist/es/cartesian/line/Line.mjs +50 -0
  164. package/dist/es/cartesian/line/StaticLine.mjs +217 -0
  165. package/dist/es/cartesian/line/hooks/useLine.mjs +69 -0
  166. package/dist/es/cartesian/line/type.mjs +112 -0
  167. package/dist/es/cartesian/line/utils.mjs +34 -0
  168. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +163 -0
  169. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +165 -0
  170. package/dist/es/cartesian/scatter/Scatter.mjs +280 -0
  171. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +23 -0
  172. package/dist/es/cartesian/useNeedsClip.mjs +23 -0
  173. package/dist/es/cartesian/utils/get-ticks.mjs +118 -0
  174. package/dist/es/cartesian/z-axis/ZAxis.mjs +72 -0
  175. package/dist/es/chart/AreaChart.mjs +9 -0
  176. package/dist/es/chart/BarChart.mjs +10 -0
  177. package/dist/es/chart/ComposedChart.mjs +10 -0
  178. package/dist/es/chart/FunnelChart.mjs +11 -0
  179. package/dist/es/chart/LegendPortalContext.mjs +5 -0
  180. package/dist/es/chart/LineChart.mjs +10 -0
  181. package/dist/es/chart/PieChart.mjs +16 -0
  182. package/dist/es/chart/RadarChart.mjs +16 -0
  183. package/dist/es/chart/RadialBarChart.mjs +16 -0
  184. package/dist/es/chart/RechartsWrapper.mjs +160 -0
  185. package/dist/es/chart/ScatterChart.mjs +10 -0
  186. package/dist/es/chart/Surface.mjs +5 -0
  187. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +72 -0
  188. package/dist/es/chart/TooltipPortalContext.mjs +5 -0
  189. package/dist/es/chart/const.mjs +7 -0
  190. package/dist/es/chart/generateCategoricalChart.mjs +175 -0
  191. package/dist/es/chart/provideClipPathId.mjs +15 -0
  192. package/dist/es/components/Cell.mjs +23 -0
  193. package/dist/es/components/Text.mjs +5 -0
  194. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +191 -0
  195. package/dist/es/components/Tooltip.mjs +463 -0
  196. package/dist/es/components/label/Label.mjs +40 -0
  197. package/dist/es/components/label/LabelList.mjs +55 -0
  198. package/dist/es/components/label/types.mjs +38 -0
  199. package/dist/es/components/label/utils.mjs +265 -0
  200. package/dist/es/components/legend/Legend.mjs +93 -0
  201. package/dist/es/components/legend/LegendSymbol.mjs +62 -0
  202. package/dist/es/components/legend/hooks/useLegend.mjs +72 -0
  203. package/dist/es/components/legend/hooks/useLegendContent.mjs +68 -0
  204. package/dist/es/components/legend/type.mjs +41 -0
  205. package/dist/es/components/legend/utils.mjs +25 -0
  206. package/dist/es/components/utils.mjs +44 -0
  207. package/dist/es/container/ClipPath.mjs +25 -0
  208. package/dist/es/container/Layer.mjs +14 -0
  209. package/dist/es/container/ResponsiveContainer.mjs +5 -0
  210. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +144 -0
  211. package/dist/es/container/Surface.mjs +62 -0
  212. package/dist/es/container/useSizeContext.mjs +5 -0
  213. package/dist/es/context/ChartDataContextProvider.mjs +27 -0
  214. package/dist/es/context/PanoramaContextProvider.mjs +24 -0
  215. package/dist/es/context/accessibilityContext.mjs +5 -0
  216. package/dist/es/context/cartesianLabelListContext.mjs +5 -0
  217. package/dist/es/context/chartLayoutContext.mjs +49 -0
  218. package/dist/es/context/cursorLayerContext.mjs +5 -0
  219. package/dist/es/context/graphicalLayerContext.mjs +5 -0
  220. package/dist/es/context/labelLayerContext.mjs +5 -0
  221. package/dist/es/context/polarLabelViewBoxContext.mjs +8 -0
  222. package/dist/es/context/useTooltipAxis.mjs +17 -0
  223. package/dist/es/events/useChartSynchronisation.mjs +113 -0
  224. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  225. package/dist/es/hooks/useSetupGraphicalItem.mjs +66 -0
  226. package/dist/es/index.mjs +46 -0
  227. package/dist/es/polar/pie/Pie.mjs +161 -0
  228. package/dist/es/polar/pie/type.mjs +97 -0
  229. package/dist/es/polar/radar/PolarAngleAxis.mjs +180 -0
  230. package/dist/es/polar/radar/PolarGrid.mjs +115 -0
  231. package/dist/es/polar/radar/PolarRadiusAxis.mjs +162 -0
  232. package/dist/es/polar/radar/Radar.mjs +284 -0
  233. package/dist/es/polar/radial-bar/RadialBar.mjs +197 -0
  234. package/dist/es/polar/radial-bar/type.mjs +97 -0
  235. package/dist/es/shape/Cross.mjs +16 -0
  236. package/dist/es/shape/Curve.mjs +86 -0
  237. package/dist/es/shape/Dot.mjs +24 -0
  238. package/dist/es/shape/Rectangle.mjs +83 -0
  239. package/dist/es/shape/Sector.mjs +156 -0
  240. package/dist/es/shape/Symbols.mjs +52 -0
  241. package/dist/es/shape/Trapezoid.mjs +52 -0
  242. package/dist/es/state/ReportChartProps.mjs +64 -0
  243. package/dist/es/state/ReportMainChartProps.mjs +46 -0
  244. package/dist/es/state/ReportPolarOptions.mjs +56 -0
  245. package/dist/es/state/SetGraphicalItem.mjs +49 -0
  246. package/dist/es/state/SetLegendPayload.mjs +20 -0
  247. package/dist/es/state/SetTooltipEntrySettings.mjs +19 -0
  248. package/dist/es/state/brushSlice.mjs +26 -0
  249. package/dist/es/state/cartesianAxisSlice.mjs +39 -0
  250. package/dist/es/state/chartDataSlice.mjs +33 -0
  251. package/dist/es/state/externalEventsMiddleware.mjs +30 -0
  252. package/dist/es/state/graphicalItemsSlice.mjs +47 -0
  253. package/dist/es/state/hooks.mjs +6 -0
  254. package/dist/es/state/keyboardEventsMiddleware.mjs +63 -0
  255. package/dist/es/state/layoutSlice.mjs +39 -0
  256. package/dist/es/state/legendSlice.mjs +40 -0
  257. package/dist/es/state/mouseEventsMiddleware.mjs +41 -0
  258. package/dist/es/state/optionsSlice.mjs +25 -0
  259. package/dist/es/state/polarAxisSlice.mjs +28 -0
  260. package/dist/es/state/polarOptionsSlice.mjs +13 -0
  261. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +8 -0
  262. package/dist/es/state/referenceElementsSlice.mjs +36 -0
  263. package/dist/es/state/rootPropsSlice.mjs +32 -0
  264. package/dist/es/state/selectors/areaSelectors.mjs +77 -0
  265. package/dist/es/state/selectors/axisSelectors.mjs +879 -0
  266. package/dist/es/state/selectors/barSelectors.mjs +241 -0
  267. package/dist/es/state/selectors/brushSelectors.mjs +18 -0
  268. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +9 -0
  269. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +43 -0
  270. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +8 -0
  271. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +21 -0
  272. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +37 -0
  273. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +13 -0
  274. package/dist/es/state/selectors/common.mjs +4 -0
  275. package/dist/es/state/selectors/containerSelectors.mjs +7 -0
  276. package/dist/es/state/selectors/dataSelectors.mjs +35 -0
  277. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  278. package/dist/es/state/selectors/legendSelectors.mjs +10 -0
  279. package/dist/es/state/selectors/lineSelectors.mjs +64 -0
  280. package/dist/es/state/selectors/pickAxisId.mjs +4 -0
  281. package/dist/es/state/selectors/pickAxisType.mjs +4 -0
  282. package/dist/es/state/selectors/pieSelectors.mjs +132 -0
  283. package/dist/es/state/selectors/polarAxisSelectors.mjs +167 -0
  284. package/dist/es/state/selectors/polarGridSelectors.mjs +19 -0
  285. package/dist/es/state/selectors/polarScaleSelectors.mjs +55 -0
  286. package/dist/es/state/selectors/polarSelectors.mjs +81 -0
  287. package/dist/es/state/selectors/radarSelectors.mjs +133 -0
  288. package/dist/es/state/selectors/radialBarSelectors.mjs +259 -0
  289. package/dist/es/state/selectors/rootPropsSelectors.mjs +14 -0
  290. package/dist/es/state/selectors/scatterSelectors.mjs +134 -0
  291. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +20 -0
  292. package/dist/es/state/selectors/selectAllAxes.mjs +10 -0
  293. package/dist/es/state/selectors/selectChartOffset.mjs +69 -0
  294. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +66 -0
  295. package/dist/es/state/selectors/selectTooltipEventType.mjs +22 -0
  296. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +6 -0
  297. package/dist/es/state/selectors/selectTooltipSettings.mjs +4 -0
  298. package/dist/es/state/selectors/selectTooltipState.mjs +4 -0
  299. package/dist/es/state/selectors/selectors.mjs +104 -0
  300. package/dist/es/state/selectors/tooltipSelectors.mjs +269 -0
  301. package/dist/es/state/selectors/touchSelectors.mjs +19 -0
  302. package/dist/es/state/store.mjs +55 -0
  303. package/dist/es/state/tooltipSlice.mjs +102 -0
  304. package/dist/es/state/touchEventsMiddleware.mjs +44 -0
  305. package/dist/es/state/utils/useReportScale.mjs +19 -0
  306. package/dist/es/synchronisation/syncSelectors.mjs +6 -0
  307. package/dist/es/synchronisation/useChartSynchronisation.mjs +38 -0
  308. package/dist/es/types/event.mjs +166 -0
  309. package/dist/es/utils/ReduceCSSCalc.mjs +114 -0
  310. package/dist/es/utils/VueUtils.mjs +39 -0
  311. package/dist/es/utils/attrs.mjs +69 -0
  312. package/dist/es/utils/cartesian.mjs +54 -0
  313. package/dist/es/utils/chart.mjs +366 -0
  314. package/dist/es/utils/const.mjs +32 -0
  315. package/dist/es/utils/createContext.mjs +31 -0
  316. package/dist/es/utils/data-utils.mjs +13 -0
  317. package/dist/es/utils/data.mjs +41 -0
  318. package/dist/es/utils/events.mjs +7 -0
  319. package/dist/es/utils/getLinearRegression.mjs +34 -0
  320. package/dist/es/utils/grid.mjs +23 -0
  321. package/dist/es/utils/isDomainSpecifiedByUser.mjs +116 -0
  322. package/dist/es/utils/legend.mjs +19 -0
  323. package/dist/es/utils/log.mjs +14 -0
  324. package/dist/es/utils/payload/getUniqPayload.mjs +9 -0
  325. package/dist/es/utils/polar.mjs +59 -0
  326. package/dist/es/utils/props.mjs +20 -0
  327. package/dist/es/utils/resolveDefaultProps.mjs +26 -0
  328. package/dist/es/utils/scale/getNiceTickValues.mjs +137 -0
  329. package/dist/es/utils/scale/utils/arithmetic.mjs +54 -0
  330. package/dist/es/utils/scale/utils/utils.mjs +53 -0
  331. package/dist/es/utils/style.mjs +30 -0
  332. package/dist/es/utils/tick.mjs +42 -0
  333. package/dist/es/utils/tooltip/translate.mjs +73 -0
  334. package/dist/es/utils/validate.mjs +42 -0
  335. package/dist/events/useChartSynchronisation.d.ts +8 -0
  336. package/dist/hooks/useIsAnimating.d.ts +14 -0
  337. package/dist/hooks/useSetupGraphicalItem.d.ts +7 -0
  338. package/dist/index.d.ts +6 -0
  339. package/dist/polar/index.d.ts +3 -0
  340. package/dist/polar/pie/Pie.d.ts +2 -0
  341. package/dist/polar/pie/index.d.ts +2 -0
  342. package/dist/polar/pie/type.d.ts +88 -0
  343. package/dist/polar/radar/PolarAngleAxis.d.ts +145 -0
  344. package/dist/polar/radar/PolarGrid.d.ts +77 -0
  345. package/dist/polar/radar/PolarRadiusAxis.d.ts +125 -0
  346. package/dist/polar/radar/Radar.d.ts +160 -0
  347. package/dist/polar/radar/index.d.ts +4 -0
  348. package/dist/polar/radial-bar/RadialBar.d.ts +2 -0
  349. package/dist/polar/radial-bar/index.d.ts +2 -0
  350. package/dist/polar/radial-bar/type.d.ts +96 -0
  351. package/dist/shape/Cross.d.ts +10 -0
  352. package/dist/shape/Curve.d.ts +42 -0
  353. package/dist/shape/Dot.d.ts +18 -0
  354. package/dist/shape/Rectangle.d.ts +33 -0
  355. package/dist/shape/Sector.d.ts +48 -0
  356. package/dist/shape/Symbols.d.ts +15 -0
  357. package/dist/shape/Trapezoid.d.ts +31 -0
  358. package/dist/shape/index.d.ts +9 -0
  359. package/dist/shape/types.d.ts +20 -0
  360. package/dist/state/ReportBar.d.ts +1 -0
  361. package/dist/state/ReportChartProps.d.ts +88 -0
  362. package/dist/state/ReportMainChartProps.d.ts +37 -0
  363. package/dist/state/ReportPolarOptions.d.ts +59 -0
  364. package/dist/state/SetGraphicalItem.d.ts +9 -0
  365. package/dist/state/SetLegendPayload.d.ts +3 -0
  366. package/dist/state/SetTooltipEntrySettings.d.ts +8 -0
  367. package/dist/state/brushSlice.d.ts +18 -0
  368. package/dist/state/cartesianAxisSlice.d.ts +88 -0
  369. package/dist/state/chartDataSlice.d.ts +44 -0
  370. package/dist/state/externalEventsMiddleware.d.ts +17 -0
  371. package/dist/state/graphicalItemsSlice.d.ts +108 -0
  372. package/dist/state/hooks.d.ts +54 -0
  373. package/dist/state/keyboardEventsMiddleware.d.ts +3 -0
  374. package/dist/state/layoutSlice.d.ts +15 -0
  375. package/dist/state/legendSlice.d.ts +26 -0
  376. package/dist/state/mouseEventsMiddleware.d.ts +5 -0
  377. package/dist/state/optionsSlice.d.ts +27 -0
  378. package/dist/state/polarAxisSlice.d.ts +10 -0
  379. package/dist/state/polarOptionsSlice.d.ts +10 -0
  380. package/dist/state/reduxDevtoolsJsonStringifyReplacer.d.ts +1 -0
  381. package/dist/state/referenceElementsSlice.d.ts +40 -0
  382. package/dist/state/rootPropsSlice.d.ts +26 -0
  383. package/dist/state/selectors/areaSelectors.d.ts +24 -0
  384. package/dist/state/selectors/axisSelectors.d.ts +1828 -0
  385. package/dist/state/selectors/barSelectors.d.ts +944 -0
  386. package/dist/state/selectors/brushSelectors.d.ts +10 -0
  387. package/dist/state/selectors/combiners/combineActiveLabel.d.ts +3 -0
  388. package/dist/state/selectors/combiners/combineActiveTooltipIndex.d.ts +5 -0
  389. package/dist/state/selectors/combiners/combineAxisRangeWithReverse.d.ts +3 -0
  390. package/dist/state/selectors/combiners/combineCoordinateForDefaultIndex.d.ts +3 -0
  391. package/dist/state/selectors/combiners/combineTooltipInteractionState.d.ts +3 -0
  392. package/dist/state/selectors/combiners/combineTooltipPayloadConfigurations.d.ts +3 -0
  393. package/dist/state/selectors/common.d.ts +2 -0
  394. package/dist/state/selectors/containerSelectors.d.ts +6 -0
  395. package/dist/state/selectors/dataSelectors.d.ts +23 -0
  396. package/dist/state/selectors/funnelSelectors.d.ts +69 -0
  397. package/dist/state/selectors/legendSelectors.d.ts +7 -0
  398. package/dist/state/selectors/lineSelectors.d.ts +123 -0
  399. package/dist/state/selectors/pickAxisId.d.ts +3 -0
  400. package/dist/state/selectors/pickAxisType.d.ts +2 -0
  401. package/dist/state/selectors/pieSelectors.d.ts +55 -0
  402. package/dist/state/selectors/polarAxisSelectors.d.ts +49 -0
  403. package/dist/state/selectors/polarGridSelectors.d.ts +118 -0
  404. package/dist/state/selectors/polarScaleSelectors.d.ts +9 -0
  405. package/dist/state/selectors/polarSelectors.d.ts +70 -0
  406. package/dist/state/selectors/radarSelectors.d.ts +76 -0
  407. package/dist/state/selectors/radialBarSelectors.d.ts +61 -0
  408. package/dist/state/selectors/rootPropsSelectors.d.ts +11 -0
  409. package/dist/state/selectors/scatterSelectors.d.ts +21 -0
  410. package/dist/state/selectors/selectActivePropsFromChartPointer.d.ts +382 -0
  411. package/dist/state/selectors/selectAllAxes.d.ts +4 -0
  412. package/dist/state/selectors/selectChartOffset.d.ts +116 -0
  413. package/dist/state/selectors/selectChartOffsetInternal.d.ts +9 -0
  414. package/dist/state/selectors/selectTooltipEventType.d.ts +8 -0
  415. package/dist/state/selectors/selectTooltipPayloadSearcher.d.ts +3 -0
  416. package/dist/state/selectors/selectTooltipSettings.d.ts +3 -0
  417. package/dist/state/selectors/selectTooltipState.d.ts +3 -0
  418. package/dist/state/selectors/selectors.d.ts +184 -0
  419. package/dist/state/selectors/tooltipSelectors.d.ts +581 -0
  420. package/dist/state/selectors/touchSelectors.d.ts +4 -0
  421. package/dist/state/store.d.ts +74 -0
  422. package/dist/state/tooltipSlice.d.ts +204 -0
  423. package/dist/state/touchEventsMiddleware.d.ts +2 -0
  424. package/dist/state/utils/useReportScale.d.ts +1 -0
  425. package/dist/synchronisation/syncSelectors.d.ts +3 -0
  426. package/dist/synchronisation/useChartSynchronisation.d.ts +11 -0
  427. package/dist/types/area.d.ts +8 -0
  428. package/dist/types/axis.d.ts +127 -0
  429. package/dist/types/bar.d.ts +51 -0
  430. package/dist/types/categorical.d.ts +36 -0
  431. package/dist/types/common.d.ts +129 -0
  432. package/dist/types/event.d.ts +16 -0
  433. package/dist/types/index.d.ts +4 -0
  434. package/dist/types/legend.d.ts +1 -0
  435. package/dist/types/offset.d.ts +8 -0
  436. package/dist/types/radar.d.ts +28 -0
  437. package/dist/types/scale.d.ts +11 -0
  438. package/dist/types/tick.d.ts +55 -0
  439. package/dist/types/tooltip.d.ts +33 -0
  440. package/dist/utils/ReduceCSSCalc.d.ts +2 -0
  441. package/dist/utils/VueUtils.d.ts +11 -0
  442. package/dist/utils/attrs.d.ts +46 -0
  443. package/dist/utils/cartesian.d.ts +20 -0
  444. package/dist/utils/chart.d.ts +99 -0
  445. package/dist/utils/const.d.ts +30 -0
  446. package/dist/utils/context.d.ts +8 -0
  447. package/dist/utils/createContext.d.ts +8 -0
  448. package/dist/utils/data-utils.d.ts +4 -0
  449. package/dist/utils/data.d.ts +13 -0
  450. package/dist/utils/events.d.ts +12 -0
  451. package/dist/utils/getLinearRegression.d.ts +15 -0
  452. package/dist/utils/getRelativeCoordinate.d.ts +11 -0
  453. package/dist/utils/grid.d.ts +37 -0
  454. package/dist/utils/index.d.ts +4 -0
  455. package/dist/utils/isDomainSpecifiedByUser.d.ts +47 -0
  456. package/dist/utils/legend.d.ts +3 -0
  457. package/dist/utils/log.d.ts +1 -0
  458. package/dist/utils/payload/getUniqPayload.d.ts +4 -0
  459. package/dist/utils/polar.d.ts +21 -0
  460. package/dist/utils/props.d.ts +15 -0
  461. package/dist/utils/resolveDefaultProps.d.ts +52 -0
  462. package/dist/utils/scale/getNiceTickValues.d.ts +61 -0
  463. package/dist/utils/scale/utils/arithmetic.d.ts +50 -0
  464. package/dist/utils/scale/utils/utils.d.ts +9 -0
  465. package/dist/utils/style.d.ts +12 -0
  466. package/dist/utils/tick.d.ts +19 -0
  467. package/dist/utils/tooltip/translate.d.ts +47 -0
  468. package/dist/utils/types.d.ts +14 -0
  469. package/dist/utils/validate.d.ts +25 -0
  470. package/package.json +27 -10
@@ -0,0 +1,19 @@
1
+ import { isNumber } from "./validate.mjs";
2
+ //#region src/utils/legend.ts
3
+ function appendOffsetOfLegend(offset, legendSettings, legendSize) {
4
+ if (legendSettings && legendSize) {
5
+ const { width: boxWidth, height: boxHeight } = legendSize;
6
+ const { align, verticalAlign, layout } = legendSettings;
7
+ if ((layout === "vertical" || layout === "horizontal" && verticalAlign === "middle") && align !== "center" && isNumber(offset[align])) return {
8
+ ...offset,
9
+ [align]: offset[align] + (boxWidth || 0)
10
+ };
11
+ if ((layout === "horizontal" || layout === "vertical" && align === "center") && verticalAlign !== "middle" && isNumber(offset[verticalAlign])) return {
12
+ ...offset,
13
+ [verticalAlign]: offset[verticalAlign] + (boxHeight || 0)
14
+ };
15
+ }
16
+ return offset;
17
+ }
18
+ //#endregion
19
+ export { appendOffsetOfLegend };
@@ -0,0 +1,14 @@
1
+ //#region src/utils/log.ts
2
+ var isDev = process.env.NODE_ENV !== "production";
3
+ function warn(condition, format, ...args) {
4
+ if (isDev && typeof console !== "undefined" && console.warn) {
5
+ if (format === void 0) console.warn("LogUtils requires an error message argument");
6
+ if (!condition) if (format === void 0) console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
7
+ else {
8
+ let argIndex = 0;
9
+ console.warn(format.replace(/%s/g, () => args[argIndex++]));
10
+ }
11
+ }
12
+ }
13
+ //#endregion
14
+ export { warn };
@@ -0,0 +1,9 @@
1
+ import { uniqBy } from "es-toolkit/compat";
2
+ //#region src/utils/payload/getUniqPayload.ts
3
+ function getUniqPayload(payload, option, defaultUniqBy) {
4
+ if (option === true) return uniqBy(payload, defaultUniqBy);
5
+ if (typeof option === "function") return uniqBy(payload, option);
6
+ return payload;
7
+ }
8
+ //#endregion
9
+ export { getUniqPayload };
@@ -0,0 +1,59 @@
1
+ //#region src/utils/polar.ts
2
+ var RADIAN = Math.PI / 180;
3
+ var radianToDegree = (angleInRadian) => angleInRadian * 180 / Math.PI;
4
+ function distanceBetweenPoints(point, anotherPoint) {
5
+ const { x: x1, y: y1 } = point;
6
+ const { x: x2, y: y2 } = anotherPoint;
7
+ return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
8
+ }
9
+ function formatAngleOfSector({ startAngle, endAngle }) {
10
+ const startCnt = Math.floor(startAngle / 360);
11
+ const endCnt = Math.floor(endAngle / 360);
12
+ const min = Math.min(startCnt, endCnt);
13
+ return {
14
+ startAngle: startAngle - min * 360,
15
+ endAngle: endAngle - min * 360
16
+ };
17
+ }
18
+ function getAngleOfPoint({ x, y }, { cx, cy }) {
19
+ const radius = distanceBetweenPoints({
20
+ x,
21
+ y
22
+ }, {
23
+ x: cx,
24
+ y: cy
25
+ });
26
+ if (radius <= 0) return {
27
+ radius,
28
+ angle: 0
29
+ };
30
+ const cos = (x - cx) / radius;
31
+ let angleInRadian = Math.acos(cos);
32
+ if (y > cy) angleInRadian = 2 * Math.PI - angleInRadian;
33
+ return {
34
+ radius,
35
+ angle: radianToDegree(angleInRadian),
36
+ angleInRadian
37
+ };
38
+ }
39
+ function reverseFormatAngleOfSector(angle, { startAngle, endAngle }) {
40
+ const startCnt = Math.floor(startAngle / 360);
41
+ const endCnt = Math.floor(endAngle / 360);
42
+ return angle + Math.min(startCnt, endCnt) * 360;
43
+ }
44
+ function polarToCartesian(cx, cy, radius, angle) {
45
+ return {
46
+ x: cx + Math.cos(-RADIAN * angle) * radius,
47
+ y: cy + Math.sin(-RADIAN * angle) * radius
48
+ };
49
+ }
50
+ function getMaxRadius(width, height, offset = {
51
+ top: 0,
52
+ right: 0,
53
+ bottom: 0,
54
+ left: 0
55
+ }) {
56
+ return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;
57
+ }
58
+ //#endregion
59
+ export { RADIAN, formatAngleOfSector, getAngleOfPoint, getMaxRadius, polarToCartesian, reverseFormatAngleOfSector };
@@ -0,0 +1,20 @@
1
+ //#region src/utils/props.ts
2
+ /**
3
+ * 将 defaultProps 的属性值作为 props 的 default 属性
4
+ * @param props - Vue 组件的 props 定义对象
5
+ * @param defaultProps - 默认值对象
6
+ * @returns 新的 Vue 组件 props 对象
7
+ */
8
+ function applyDefaultProps(props, defaultProps) {
9
+ const newProps = { ...props };
10
+ for (const [key, defaultValue] of Object.entries(defaultProps)) if (key in newProps) {
11
+ const propDef = newProps[key];
12
+ if (typeof propDef === "object" && propDef !== null && "type" in propDef) newProps[key] = {
13
+ ...propDef,
14
+ default: defaultValue
15
+ };
16
+ }
17
+ return newProps;
18
+ }
19
+ //#endregion
20
+ export { applyDefaultProps };
@@ -0,0 +1,26 @@
1
+ //#region src/utils/resolveDefaultProps.ts
2
+ /**
3
+ * This function mimics the behavior of the `defaultProps` static property in React.
4
+ * Functional components do not have a defaultProps property, so this function is useful to resolve default props.
5
+ *
6
+ * The common recommendation is to use ES6 destructuring with default values in the function signature,
7
+ * but you need to be careful there and make sure you destructure all the individual properties
8
+ * and not the whole object. See the test file for example.
9
+ *
10
+ * And because destructuring all properties one by one is a faff, and it's easy to miss one property,
11
+ * this function exists.
12
+ *
13
+ * @param realProps - the props object passed to the component by the user
14
+ * @param defaultProps - the default props object defined in the component by Recharts
15
+ * @returns - the props object with all the default props resolved. All `undefined` values are replaced with the default value.
16
+ */
17
+ function resolveDefaultProps(realProps, defaultProps) {
18
+ const resolvedProps = { ...realProps };
19
+ const dp = defaultProps;
20
+ return Object.keys(defaultProps).reduce((acc, key) => {
21
+ if (acc[key] === void 0 && dp[key] !== void 0) acc[key] = dp[key];
22
+ return acc;
23
+ }, resolvedProps);
24
+ }
25
+ //#endregion
26
+ export { resolveDefaultProps };
@@ -0,0 +1,137 @@
1
+ import { compose, map, memoize, range, reverse } from "./utils/utils.mjs";
2
+ import { getDigitCount, rangeStep } from "./utils/arithmetic.mjs";
3
+ import Decimal from "decimal.js-light";
4
+ //#region src/utils/scale/getNiceTickValues.ts
5
+ /**
6
+ * Calculate a interval of a minimum value and a maximum value
7
+ *
8
+ * @param {number} min The minimum value
9
+ * @param {number} max The maximum value
10
+ * @return {Array} An interval
11
+ */
12
+ function getValidInterval([min, max]) {
13
+ let [validMin, validMax] = [min, max];
14
+ if (min > max) [validMin, validMax] = [max, min];
15
+ return [validMin, validMax];
16
+ }
17
+ /**
18
+ * Calculate the step which is easy to understand between ticks, like 10, 20, 25
19
+ *
20
+ * @param {Decimal} roughStep The rough step calculated by dividing the
21
+ * difference by the tickCount
22
+ * @param {boolean} allowDecimals Allow the ticks to be decimals or not
23
+ * @param {Integer} correctionFactor A correction factor
24
+ * @return {Decimal} The step which is easy to understand between two ticks
25
+ */
26
+ function getFormatStep(roughStep, allowDecimals, correctionFactor) {
27
+ if (roughStep.lte(0)) return new Decimal(0);
28
+ const digitCount = getDigitCount(roughStep.toNumber());
29
+ const digitCountValue = new Decimal(10).pow(digitCount);
30
+ const stepRatio = roughStep.div(digitCountValue);
31
+ const stepRatioScale = digitCount !== 1 ? .05 : .1;
32
+ const formatStep = new Decimal(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale).mul(digitCountValue);
33
+ return allowDecimals ? new Decimal(formatStep.toNumber()) : new Decimal(Math.ceil(formatStep.toNumber()));
34
+ }
35
+ /**
36
+ * calculate the ticks when the minimum value equals to the maximum value
37
+ *
38
+ * @param value The minimum value which is also the maximum value
39
+ * @param tickCount The count of ticks
40
+ * @param allowDecimals Allow the ticks to be decimals or not
41
+ * @return array of ticks
42
+ */
43
+ function getTickOfSingleValue(value, tickCount, allowDecimals) {
44
+ let step = new Decimal(1);
45
+ let middle = new Decimal(value);
46
+ if (!middle.isint() && allowDecimals) {
47
+ const absVal = Math.abs(value);
48
+ if (absVal < 1) {
49
+ step = new Decimal(10).pow(getDigitCount(value) - 1);
50
+ middle = new Decimal(Math.floor(middle.div(step).toNumber())).mul(step);
51
+ } else if (absVal > 1) middle = new Decimal(Math.floor(value));
52
+ } else if (value === 0) middle = new Decimal(Math.floor((tickCount - 1) / 2));
53
+ else if (!allowDecimals) middle = new Decimal(Math.floor(value));
54
+ const middleIndex = Math.floor((tickCount - 1) / 2);
55
+ return compose(map((n) => middle.add(new Decimal(n - middleIndex).mul(step)).toNumber()), range)(0, tickCount);
56
+ }
57
+ /**
58
+ * Calculate the step
59
+ *
60
+ * @param {number} min The minimum value of an interval
61
+ * @param {number} max The maximum value of an interval
62
+ * @param {Integer} tickCount The count of ticks
63
+ * @param {boolean} allowDecimals Allow the ticks to be decimals or not
64
+ * @param {number} correctionFactor A correction factor
65
+ * @return {object} The step, minimum value of ticks, maximum value of ticks
66
+ */
67
+ function calculateStep(min, max, tickCount, allowDecimals, correctionFactor = 0) {
68
+ if (!Number.isFinite((max - min) / (tickCount - 1))) return {
69
+ step: new Decimal(0),
70
+ tickMin: new Decimal(0),
71
+ tickMax: new Decimal(0)
72
+ };
73
+ const step = getFormatStep(new Decimal(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor);
74
+ let middle;
75
+ if (min <= 0 && max >= 0) middle = new Decimal(0);
76
+ else {
77
+ middle = new Decimal(min).add(max).div(2);
78
+ middle = middle.sub(new Decimal(middle).mod(step));
79
+ }
80
+ let belowCount = Math.ceil(middle.sub(min).div(step).toNumber());
81
+ let upCount = Math.ceil(new Decimal(max).sub(middle).div(step).toNumber());
82
+ const scaleCount = belowCount + upCount + 1;
83
+ if (scaleCount > tickCount) return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1);
84
+ if (scaleCount < tickCount) {
85
+ upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;
86
+ belowCount = max > 0 ? belowCount : belowCount + (tickCount - scaleCount);
87
+ }
88
+ return {
89
+ step,
90
+ tickMin: middle.sub(new Decimal(belowCount).mul(step)),
91
+ tickMax: middle.add(new Decimal(upCount).mul(step))
92
+ };
93
+ }
94
+ /**
95
+ * Calculate the ticks of an interval, the count of ticks will be guaranteed
96
+ *
97
+ * @param {number} min, max min: The minimum value, max: The maximum value
98
+ * @param {Integer} tickCount The count of ticks
99
+ * @param {boolean} allowDecimals Allow the ticks to be decimals or not
100
+ * @return {Array} ticks
101
+ */
102
+ function getNiceTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {
103
+ if (!Number.isFinite(min) || !Number.isFinite(max)) return [];
104
+ const count = Math.max(tickCount, 2);
105
+ const [cormin, cormax] = getValidInterval([min, max]);
106
+ if (cormin === -Infinity || cormax === Infinity) {
107
+ const values = cormax === Infinity ? [cormin, ...range(0, tickCount - 1).map(() => Infinity)] : [...range(0, tickCount - 1).map(() => -Infinity), cormax];
108
+ return min > max ? reverse(values) : values;
109
+ }
110
+ if (cormin === cormax) return getTickOfSingleValue(cormin, tickCount, allowDecimals);
111
+ const { step, tickMin, tickMax } = calculateStep(cormin, cormax, count, allowDecimals, 0);
112
+ const values = rangeStep(tickMin, tickMax.add(new Decimal(.1).mul(step)), step);
113
+ return min > max ? reverse(values) : values;
114
+ }
115
+ /**
116
+ * Calculate the ticks of an interval, the count of ticks won't be guraranteed,
117
+ * but the domain will be guaranteed
118
+ *
119
+ * @param {number} min, max min: The minimum value, max: The maximum value
120
+ * @param {Integer} tickCount The count of ticks
121
+ * @param {boolean} allowDecimals Allow the ticks to be decimals or not
122
+ * @return {Array} ticks
123
+ */
124
+ function getTickValuesFixedDomainFn([min, max], tickCount, allowDecimals = true) {
125
+ if (!Number.isFinite(min) || !Number.isFinite(max)) return [];
126
+ const [cormin, cormax] = getValidInterval([min, max]);
127
+ if (cormin === -Infinity || cormax === Infinity) return [min, max];
128
+ if (cormin === cormax) return [cormin];
129
+ const count = Math.max(tickCount, 2);
130
+ const step = getFormatStep(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
131
+ const values = [...rangeStep(new Decimal(cormin), new Decimal(cormax).sub(new Decimal(.99).mul(step)), step), cormax];
132
+ return min > max ? reverse(values) : values;
133
+ }
134
+ var getNiceTickValues = memoize(getNiceTickValuesFn);
135
+ var getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn);
136
+ //#endregion
137
+ export { getNiceTickValues, getTickValuesFixedDomain };
@@ -0,0 +1,54 @@
1
+ import { curry } from "./utils.mjs";
2
+ import Decimal from "decimal.js-light";
3
+ //#region src/utils/scale/utils/arithmetic.ts
4
+ /**
5
+ * 获取数值的位数
6
+ * 其中绝对值属于区间[0.1, 1), 得到的值为0
7
+ * 绝对值属于区间[0.01, 0.1),得到的位数为 -1
8
+ * 绝对值属于区间[0.001, 0.01),得到的位数为 -2
9
+ *
10
+ * @param {number} value 数值
11
+ * @return {Integer} 位数
12
+ */
13
+ function getDigitCount(value) {
14
+ let result;
15
+ if (value === 0) result = 1;
16
+ else result = Math.floor(new Decimal(value).abs().log(10).toNumber()) + 1;
17
+ return result;
18
+ }
19
+ /**
20
+ * 按照固定的步长获取[start, end)这个区间的数据
21
+ * 并且需要处理js计算精度的问题
22
+ *
23
+ * @param {Decimal} start 起点
24
+ * @param {Decimal} end 终点,不包含该值
25
+ * @param {Decimal} step 步长
26
+ * @return {Array} 若干数值
27
+ */
28
+ function rangeStep(start, end, step) {
29
+ let num = new Decimal(start);
30
+ let i = 0;
31
+ const result = [];
32
+ while (num.lt(end) && i < 1e5) {
33
+ result.push(num.toNumber());
34
+ num = num.add(step);
35
+ i++;
36
+ }
37
+ return result;
38
+ }
39
+ curry((a, b, t) => {
40
+ const newA = +a;
41
+ return newA + t * (+b - newA);
42
+ });
43
+ curry((a, b, x) => {
44
+ let diff = b - +a;
45
+ diff = diff || Infinity;
46
+ return (x - a) / diff;
47
+ });
48
+ curry((a, b, x) => {
49
+ let diff = b - +a;
50
+ diff = diff || Infinity;
51
+ return Math.max(0, Math.min(1, (x - a) / diff));
52
+ });
53
+ //#endregion
54
+ export { getDigitCount, rangeStep };
@@ -0,0 +1,53 @@
1
+ //#region src/utils/scale/utils/utils.ts
2
+ var identity = (i) => i;
3
+ var PLACE_HOLDER = { "@@functional/placeholder": true };
4
+ var isPlaceHolder = (val) => val === PLACE_HOLDER;
5
+ function curry0(fn) {
6
+ return function _curried(...args) {
7
+ if (args.length === 0 || args.length === 1 && isPlaceHolder(args[0])) return _curried;
8
+ return fn(...args);
9
+ };
10
+ }
11
+ function curryN(n, fn) {
12
+ if (n === 1) return fn;
13
+ return curry0((...args) => {
14
+ const argsLength = args.filter((arg) => arg !== PLACE_HOLDER).length;
15
+ if (argsLength >= n) return fn(...args);
16
+ return curryN(n - argsLength, curry0((...restArgs) => {
17
+ return fn(...args.map((arg) => isPlaceHolder(arg) ? restArgs.shift() : arg), ...restArgs);
18
+ }));
19
+ });
20
+ }
21
+ var curry = (fn) => curryN(fn.length, fn);
22
+ function range(begin, end) {
23
+ const arr = [];
24
+ for (let i = begin; i < end; ++i) arr[i - begin] = i;
25
+ return arr;
26
+ }
27
+ var map = curry((fn, arr) => {
28
+ if (Array.isArray(arr)) return arr.map(fn);
29
+ return Object.keys(arr).map((key) => arr[key]).map(fn);
30
+ });
31
+ function compose(...args) {
32
+ if (!args.length) return identity;
33
+ const fns = args.reverse();
34
+ const firstFn = fns[0];
35
+ const tailsFn = fns.slice(1);
36
+ return (...composeArgs) => tailsFn.reduce((res, fn) => fn(res), firstFn(...composeArgs));
37
+ }
38
+ function reverse(arr) {
39
+ if (Array.isArray(arr)) return arr.reverse();
40
+ return arr.split("").reverse().join("");
41
+ }
42
+ function memoize(fn) {
43
+ let lastArgs = null;
44
+ let lastResult = null;
45
+ return ((...args) => {
46
+ if (lastArgs && args.every((val, i) => val === lastArgs?.[i])) return lastResult;
47
+ lastArgs = args;
48
+ lastResult = fn(...args);
49
+ return lastResult;
50
+ });
51
+ }
52
+ //#endregion
53
+ export { compose, curry, map, memoize, range, reverse };
@@ -0,0 +1,30 @@
1
+ import { isNumber } from "./validate.mjs";
2
+ //#region src/utils/style.ts
3
+ /**
4
+ * Converts a style value to a string with 'px' if it's a number
5
+ * @param value The style value to convert
6
+ * @returns The converted style value
7
+ */
8
+ function toPx(value) {
9
+ if (value === void 0) return void 0;
10
+ return isNumber(value) ? `${value}px` : value;
11
+ }
12
+ /**
13
+ * Converts style object values to use 'px' for numeric height/width values
14
+ * @param style The style object to convert
15
+ * @returns A new style object with converted values
16
+ */
17
+ function normalizeStyle(style = {}) {
18
+ const { height, width, minHeight, maxHeight, minWidth, maxWidth, ...rest } = style;
19
+ return {
20
+ height: toPx(height),
21
+ width: toPx(width),
22
+ minHeight: toPx(minHeight),
23
+ maxHeight: toPx(maxHeight),
24
+ minWidth: toPx(minWidth),
25
+ maxWidth: toPx(maxWidth),
26
+ ...rest
27
+ };
28
+ }
29
+ //#endregion
30
+ export { normalizeStyle };
@@ -0,0 +1,42 @@
1
+ import { getAngledRectangleWidth } from "./cartesian.mjs";
2
+ //#region src/utils/tick.ts
3
+ function getNumberIntervalTicks(ticks, interval) {
4
+ return getEveryNthWithCondition(ticks, interval + 1);
5
+ }
6
+ /**
7
+ * Given an array and a number N, return a new array which contains every nTh
8
+ * element of the input array. For n below 1, an empty array is returned.
9
+ * If isValid is provided, all candidates must suffice the condition, else undefined is returned.
10
+ * @param {T[]} array An input array.
11
+ * @param {integer} n A number
12
+ * @param {Function} isValid A function to evaluate a candidate form the array
13
+ * @returns {T[]} The result array of the same type as the input array.
14
+ */
15
+ function getEveryNthWithCondition(array, n, isValid) {
16
+ if (n < 1) return [];
17
+ if (n === 1 && isValid === void 0) return array;
18
+ const result = [];
19
+ for (let i = 0; i < array.length; i += n) if (isValid === void 0 || isValid(array[i]) === true) result.push(array[i]);
20
+ else return;
21
+ return result;
22
+ }
23
+ function getAngledTickWidth(contentSize, unitSize, angle) {
24
+ return getAngledRectangleWidth({
25
+ width: contentSize.width + unitSize.width,
26
+ height: contentSize.height + unitSize.height
27
+ }, angle);
28
+ }
29
+ function getTickBoundaries(viewBox, sign, sizeKey) {
30
+ const isWidth = sizeKey === "width";
31
+ const { x, y, width, height } = viewBox;
32
+ if (sign === 1) return {
33
+ start: isWidth ? x : y,
34
+ end: isWidth ? x + width : y + height
35
+ };
36
+ return {
37
+ start: isWidth ? x + width : y + height,
38
+ end: isWidth ? x : y
39
+ };
40
+ }
41
+ //#endregion
42
+ export { getAngledTickWidth, getEveryNthWithCondition, getNumberIntervalTicks, getTickBoundaries };
@@ -0,0 +1,73 @@
1
+ import { isNumber } from "../validate.mjs";
2
+ //#region src/utils/tooltip/translate.ts
3
+ var CSS_CLASS_PREFIX = "v-charts-tooltip-wrapper";
4
+ var TOOLTIP_HIDDEN = { visibility: "hidden" };
5
+ function getTooltipCSSClassName({ coordinate, translateX, translateY }) {
6
+ return [CSS_CLASS_PREFIX, {
7
+ [`${CSS_CLASS_PREFIX}-right`]: isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX >= coordinate.x,
8
+ [`${CSS_CLASS_PREFIX}-left`]: isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX < coordinate.x,
9
+ [`${CSS_CLASS_PREFIX}-bottom`]: isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY >= coordinate.y,
10
+ [`${CSS_CLASS_PREFIX}-top`]: isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY < coordinate.y
11
+ }];
12
+ }
13
+ function getTooltipTranslateXY({ allowEscapeViewBox, coordinate, key, offsetTopLeft, position, reverseDirection, tooltipDimension, viewBox, viewBoxDimension }) {
14
+ if (position && isNumber(position[key])) return position[key];
15
+ const negative = coordinate[key] - tooltipDimension - (offsetTopLeft > 0 ? offsetTopLeft : 0);
16
+ const positive = coordinate[key] + offsetTopLeft;
17
+ if (allowEscapeViewBox[key]) return reverseDirection[key] ? negative : positive;
18
+ const viewBoxKey = viewBox[key];
19
+ if (viewBoxKey == null) return 0;
20
+ if (reverseDirection[key]) {
21
+ if (negative < viewBoxKey) return Math.max(positive, viewBoxKey);
22
+ return Math.max(negative, viewBoxKey);
23
+ }
24
+ if (viewBoxDimension == null) return 0;
25
+ if (positive + tooltipDimension > viewBoxKey + viewBoxDimension) return Math.max(negative, viewBoxKey);
26
+ return Math.max(positive, viewBoxKey);
27
+ }
28
+ function getTransformStyle({ translateX, translateY, useTranslate3d }) {
29
+ return { transform: useTranslate3d ? `translate3d(${translateX}px, ${translateY}px, 0)` : `translate(${translateX}px, ${translateY}px)` };
30
+ }
31
+ function getTooltipTranslate({ allowEscapeViewBox, coordinate, offsetTopLeft, position, reverseDirection, tooltipBox, useTranslate3d, viewBox }) {
32
+ let cssProperties, translateX, translateY;
33
+ if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) {
34
+ translateX = getTooltipTranslateXY({
35
+ allowEscapeViewBox,
36
+ coordinate,
37
+ key: "x",
38
+ offsetTopLeft,
39
+ position,
40
+ reverseDirection,
41
+ tooltipDimension: tooltipBox.width,
42
+ viewBox,
43
+ viewBoxDimension: viewBox.width
44
+ });
45
+ translateY = getTooltipTranslateXY({
46
+ allowEscapeViewBox,
47
+ coordinate,
48
+ key: "y",
49
+ offsetTopLeft,
50
+ position,
51
+ reverseDirection,
52
+ tooltipDimension: tooltipBox.height,
53
+ viewBox,
54
+ viewBoxDimension: viewBox.height
55
+ });
56
+ cssProperties = {};
57
+ } else cssProperties = TOOLTIP_HIDDEN;
58
+ return {
59
+ cssProperties,
60
+ cssClasses: getTooltipCSSClassName({
61
+ translateX,
62
+ translateY,
63
+ coordinate
64
+ }),
65
+ transform: getTransformStyle({
66
+ translateX: translateX ?? 0,
67
+ translateY: translateY ?? 0,
68
+ useTranslate3d
69
+ })
70
+ };
71
+ }
72
+ //#endregion
73
+ export { getTooltipTranslate };
@@ -0,0 +1,42 @@
1
+ //#region src/utils/validate.ts
2
+ function isNan(value) {
3
+ return typeof value == "number" && value != +value;
4
+ }
5
+ function isNumber(value) {
6
+ return (typeof value === "number" || value instanceof Number) && !isNan(value);
7
+ }
8
+ /**
9
+ * validate the width and height props of a chart element
10
+ * @param {object} el A chart element
11
+ * @return {boolean} true If the props width and height are number, and greater than 0
12
+ */
13
+ function validateWidthHeight({ width, height }) {
14
+ if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0) return false;
15
+ return true;
16
+ }
17
+ function isWellBehavedNumber(n) {
18
+ return Number.isFinite(n);
19
+ }
20
+ function isPercent(value) {
21
+ return typeof value === "string" && value.indexOf("%") === value.length - 1;
22
+ }
23
+ function isCategoricalAxis(layout, axisType) {
24
+ return layout === "horizontal" && axisType === "xAxis" || layout === "vertical" && axisType === "yAxis" || layout === "centric" && axisType === "angleAxis" || layout === "radial" && axisType === "radiusAxis";
25
+ }
26
+ function isVisible(sign, tickPosition, getSize, start, end) {
27
+ if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) return false;
28
+ const size = getSize();
29
+ return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
30
+ }
31
+ var isSsr = typeof window === "undefined";
32
+ /**
33
+ * Checks if the value is null or undefined
34
+ * @param {any} value The value to check
35
+ * @returns {boolean} true if the value is null or undefined
36
+ */
37
+ function isNullish(value) {
38
+ return value === null || typeof value === "undefined";
39
+ }
40
+ var isNumOrStr = (value) => isNumber(value) || typeof value === "string";
41
+ //#endregion
42
+ export { isCategoricalAxis, isNan, isNullish, isNumOrStr, isNumber, isPercent, isSsr, isVisible, isWellBehavedNumber, validateWidthHeight };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Will receive synchronisation events from other charts.
3
+ *
4
+ * Reads syncMethod from state and decides how to synchronise the tooltip based on that.
5
+ *
6
+ * @returns void
7
+ */
8
+ export declare function useSynchronisedEventsFromOtherCharts(): void;
@@ -0,0 +1,14 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * Tracks whether a component is currently animating.
4
+ *
5
+ * When `isAnimationActive` is `false`, always returns `false` regardless of
6
+ * internal state — this ensures `isAnimationActive={false}` immediately
7
+ * disables all animation-gated rendering (e.g. deferred LabelList).
8
+ *
9
+ * When `isAnimationActive` is `true`, starts as `true` and can be set to
10
+ * `false` via the returned ref (typically on animation end).
11
+ *
12
+ * Re-entering `isAnimationActive=true` resets internal state to `true`.
13
+ */
14
+ export declare function useIsAnimating(isAnimationActive: () => boolean): Ref<boolean>;
@@ -0,0 +1,7 @@
1
+ import { AreaProps } from '../cartesian/area/type';
2
+ import { CartesianGraphicalItemType, ErrorBarsSettings } from '../state/graphicalItemsSlice';
3
+ import { ShallowRef } from 'vue';
4
+ export declare function useSetupGraphicalItem(props: AreaProps | any, type: CartesianGraphicalItemType, options?: {
5
+ skipTooltip?: boolean;
6
+ errorBars?: ShallowRef<ReadonlyArray<ErrorBarsSettings>>;
7
+ }): void;
@@ -0,0 +1,6 @@
1
+ export * from './cartesian';
2
+ export * from './chart';
3
+ export * from './container';
4
+ export * from './components';
5
+ export * from './polar';
6
+ export * from './shape';
@@ -0,0 +1,3 @@
1
+ export * from './pie';
2
+ export * from './radar';
3
+ export * from './radial-bar';
@@ -0,0 +1,2 @@
1
+ import { PiePropsWithSVG } from './type';
2
+ export declare const Pie: import('vue').DefineComponent<PiePropsWithSVG, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PiePropsWithSVG> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,2 @@
1
+ export * from './Pie';
2
+ export * from './type';