vccs 0.1.0 → 0.3.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 (273) hide show
  1. package/README.md +151 -0
  2. package/dist/animation/Animate.d.ts +1 -1
  3. package/dist/cartesian/area/type.d.ts +3 -3
  4. package/dist/cartesian/bar/type.d.ts +1 -13
  5. package/dist/cartesian/brush/components/Slide.d.ts +1 -1
  6. package/dist/cartesian/brush/components/TravellerLayer.d.ts +1 -1
  7. package/dist/cartesian/brush/type.d.ts +2 -1
  8. package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +2 -1
  9. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  10. package/dist/cartesian/funnel/index.d.ts +2 -0
  11. package/dist/cartesian/funnel/type.d.ts +74 -6
  12. package/dist/cartesian/index.d.ts +2 -0
  13. package/dist/cartesian/line/Line.d.ts +7 -13
  14. package/dist/cartesian/line/type.d.ts +4 -17
  15. package/dist/cartesian/reference-area/ReferenceArea.d.ts +16 -16
  16. package/dist/cartesian/reference-dot/ReferenceDot.d.ts +143 -0
  17. package/dist/cartesian/reference-dot/index.d.ts +2 -0
  18. package/dist/cartesian/reference-line/ReferenceLine.d.ts +8 -8
  19. package/dist/cartesian/scatter/Scatter.d.ts +1 -1
  20. package/dist/chart/FunnelChart.d.ts +1 -0
  21. package/dist/chart/RechartsWrapper.d.ts +7 -3
  22. package/dist/chart/Surface.d.ts +2 -1
  23. package/dist/chart/Treemap.d.ts +237 -0
  24. package/dist/chart/generateCategoricalChart.d.ts +2 -1
  25. package/dist/chart/index.d.ts +2 -0
  26. package/dist/chart/treemapUtils.d.ts +22 -0
  27. package/dist/components/Customized.d.ts +23 -0
  28. package/dist/components/Text.d.ts +4 -4
  29. package/dist/components/Tooltip.d.ts +1 -1
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/components/label/Label.d.ts +3 -3
  32. package/dist/components/label/types.d.ts +1 -1
  33. package/dist/container/Surface.d.ts +3 -2
  34. package/dist/es/animation/Animate.mjs +48 -22
  35. package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
  36. package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
  37. package/dist/es/cartesian/area/Area.mjs +42 -31
  38. package/dist/es/cartesian/area/ClipRect.mjs +79 -58
  39. package/dist/es/cartesian/area/RenderArea.mjs +142 -108
  40. package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
  41. package/dist/es/cartesian/area/type.mjs +13 -15
  42. package/dist/es/cartesian/area/utils.mjs +69 -49
  43. package/dist/es/cartesian/axis/XAxis.mjs +87 -73
  44. package/dist/es/cartesian/axis/YAxis.mjs +67 -56
  45. package/dist/es/cartesian/bar/Bar.mjs +78 -71
  46. package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
  47. package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
  48. package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
  49. package/dist/es/cartesian/bar/type.mjs +11 -25
  50. package/dist/es/cartesian/bar/utils.mjs +97 -70
  51. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
  52. package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
  53. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
  54. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
  55. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
  56. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
  57. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
  58. package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
  59. package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
  60. package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
  61. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
  62. package/dist/es/cartesian/funnel/Funnel.mjs +162 -0
  63. package/dist/es/cartesian/funnel/type.mjs +78 -0
  64. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  65. package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
  66. package/dist/es/cartesian/line/Line.mjs +41 -37
  67. package/dist/es/cartesian/line/StaticLine.mjs +191 -122
  68. package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
  69. package/dist/es/cartesian/line/type.mjs +13 -18
  70. package/dist/es/cartesian/line/utils.mjs +27 -26
  71. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +79 -78
  72. package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +134 -0
  73. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +93 -84
  74. package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
  75. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
  76. package/dist/es/cartesian/useNeedsClip.mjs +18 -9
  77. package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
  78. package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
  79. package/dist/es/chart/AreaChart.mjs +5 -5
  80. package/dist/es/chart/BarChart.mjs +5 -5
  81. package/dist/es/chart/ComposedChart.mjs +5 -5
  82. package/dist/es/chart/FunnelChart.mjs +11 -0
  83. package/dist/es/chart/LegendPortalContext.mjs +3 -3
  84. package/dist/es/chart/LineChart.mjs +5 -5
  85. package/dist/es/chart/PieChart.mjs +5 -5
  86. package/dist/es/chart/RadarChart.mjs +5 -5
  87. package/dist/es/chart/RadialBarChart.mjs +5 -5
  88. package/dist/es/chart/RechartsWrapper.mjs +113 -89
  89. package/dist/es/chart/ScatterChart.mjs +5 -5
  90. package/dist/es/chart/Surface.mjs +3 -3
  91. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
  92. package/dist/es/chart/TooltipPortalContext.mjs +3 -3
  93. package/dist/es/chart/Treemap.mjs +379 -0
  94. package/dist/es/chart/const.mjs +2 -2
  95. package/dist/es/chart/generateCategoricalChart.mjs +99 -89
  96. package/dist/es/chart/provideClipPathId.mjs +12 -7
  97. package/dist/es/chart/treemapUtils.mjs +32 -0
  98. package/dist/es/components/Cell.mjs +16 -4
  99. package/dist/es/components/Customized.mjs +43 -0
  100. package/dist/es/components/Text.mjs +3 -3
  101. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
  102. package/dist/es/components/Tooltip.mjs +274 -199
  103. package/dist/es/components/label/Label.mjs +30 -26
  104. package/dist/es/components/label/LabelList.mjs +45 -39
  105. package/dist/es/components/label/types.mjs +10 -6
  106. package/dist/es/components/label/utils.mjs +194 -162
  107. package/dist/es/components/legend/Legend.mjs +82 -71
  108. package/dist/es/components/legend/LegendSymbol.mjs +40 -38
  109. package/dist/es/components/legend/hooks/useLegend.mjs +71 -46
  110. package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
  111. package/dist/es/components/legend/type.mjs +2 -2
  112. package/dist/es/components/legend/utils.mjs +19 -11
  113. package/dist/es/components/utils.mjs +35 -22
  114. package/dist/es/container/ClipPath.mjs +14 -14
  115. package/dist/es/container/Layer.mjs +9 -7
  116. package/dist/es/container/ResponsiveContainer.mjs +3 -3
  117. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
  118. package/dist/es/container/Surface.mjs +25 -23
  119. package/dist/es/container/useSizeContext.mjs +3 -3
  120. package/dist/es/context/ChartDataContextProvider.mjs +19 -13
  121. package/dist/es/context/PanoramaContextProvider.mjs +15 -10
  122. package/dist/es/context/accessibilityContext.mjs +3 -3
  123. package/dist/es/context/cartesianLabelListContext.mjs +3 -3
  124. package/dist/es/context/chartLayoutContext.mjs +33 -30
  125. package/dist/es/context/cursorLayerContext.mjs +3 -3
  126. package/dist/es/context/graphicalLayerContext.mjs +3 -3
  127. package/dist/es/context/labelLayerContext.mjs +3 -3
  128. package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
  129. package/dist/es/context/useTooltipAxis.mjs +14 -12
  130. package/dist/es/events/useChartSynchronisation.mjs +91 -66
  131. package/dist/es/hooks/publicHooks.mjs +207 -0
  132. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  133. package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
  134. package/dist/es/index.mjs +54 -42
  135. package/dist/es/polar/pie/Pie.mjs +131 -115
  136. package/dist/es/polar/pie/type.mjs +8 -10
  137. package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
  138. package/dist/es/polar/radar/PolarGrid.mjs +72 -59
  139. package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
  140. package/dist/es/polar/radar/Radar.mjs +181 -145
  141. package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
  142. package/dist/es/polar/radial-bar/type.mjs +9 -9
  143. package/dist/es/shape/Cross.mjs +11 -10
  144. package/dist/es/shape/Curve.mjs +71 -44
  145. package/dist/es/shape/Dot.mjs +12 -11
  146. package/dist/es/shape/Polygon.mjs +19 -0
  147. package/dist/es/shape/Rectangle.mjs +41 -30
  148. package/dist/es/shape/Sector.mjs +105 -79
  149. package/dist/es/shape/Symbols.mjs +45 -34
  150. package/dist/es/shape/Trapezoid.mjs +50 -0
  151. package/dist/es/state/ReportChartProps.mjs +23 -24
  152. package/dist/es/state/ReportMainChartProps.mjs +26 -21
  153. package/dist/es/state/ReportPolarOptions.mjs +23 -22
  154. package/dist/es/state/SetGraphicalItem.mjs +42 -27
  155. package/dist/es/state/SetLegendPayload.mjs +17 -13
  156. package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
  157. package/dist/es/state/brushSlice.mjs +12 -8
  158. package/dist/es/state/cartesianAxisSlice.mjs +23 -17
  159. package/dist/es/state/chartDataSlice.mjs +18 -13
  160. package/dist/es/state/externalEventsMiddleware.mjs +25 -15
  161. package/dist/es/state/graphicalItemsSlice.mjs +29 -25
  162. package/dist/es/state/hooks.mjs +24 -3
  163. package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
  164. package/dist/es/state/layoutSlice.mjs +18 -12
  165. package/dist/es/state/legendSlice.mjs +19 -14
  166. package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
  167. package/dist/es/state/optionsSlice.mjs +14 -11
  168. package/dist/es/state/polarAxisSlice.mjs +15 -13
  169. package/dist/es/state/polarOptionsSlice.mjs +8 -6
  170. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
  171. package/dist/es/state/referenceElementsSlice.mjs +21 -19
  172. package/dist/es/state/rootPropsSlice.mjs +20 -9
  173. package/dist/es/state/selectors/areaSelectors.mjs +65 -55
  174. package/dist/es/state/selectors/axisSelectors.mjs +784 -569
  175. package/dist/es/state/selectors/barSelectors.mjs +225 -162
  176. package/dist/es/state/selectors/brushSelectors.mjs +15 -14
  177. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
  178. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
  179. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
  180. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
  181. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
  182. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
  183. package/dist/es/state/selectors/common.mjs +2 -2
  184. package/dist/es/state/selectors/containerSelectors.mjs +5 -2
  185. package/dist/es/state/selectors/dataSelectors.mjs +28 -9
  186. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  187. package/dist/es/state/selectors/legendSelectors.mjs +7 -6
  188. package/dist/es/state/selectors/lineSelectors.mjs +54 -47
  189. package/dist/es/state/selectors/pickAxisId.mjs +2 -2
  190. package/dist/es/state/selectors/pickAxisType.mjs +2 -2
  191. package/dist/es/state/selectors/pieSelectors.mjs +116 -81
  192. package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
  193. package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
  194. package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
  195. package/dist/es/state/selectors/polarSelectors.mjs +79 -62
  196. package/dist/es/state/selectors/radarSelectors.mjs +111 -91
  197. package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
  198. package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
  199. package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
  200. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
  201. package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
  202. package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
  203. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
  204. package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
  205. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
  206. package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
  207. package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
  208. package/dist/es/state/selectors/selectors.mjs +94 -75
  209. package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
  210. package/dist/es/state/selectors/touchSelectors.mjs +17 -14
  211. package/dist/es/state/store.mjs +46 -46
  212. package/dist/es/state/tooltipSlice.mjs +64 -37
  213. package/dist/es/state/touchEventsMiddleware.mjs +35 -29
  214. package/dist/es/state/utils/useReportScale.mjs +16 -13
  215. package/dist/es/synchronisation/syncSelectors.mjs +3 -3
  216. package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
  217. package/dist/es/types/common.mjs +12 -0
  218. package/dist/es/types/event.mjs +164 -2
  219. package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
  220. package/dist/es/utils/VueUtils.mjs +35 -14
  221. package/dist/es/utils/attrs.mjs +43 -26
  222. package/dist/es/utils/cartesian.mjs +47 -15
  223. package/dist/es/utils/cell.mjs +28 -0
  224. package/dist/es/utils/chart.mjs +298 -197
  225. package/dist/es/utils/const.mjs +30 -2
  226. package/dist/es/utils/createCategoricalInverse.mjs +46 -0
  227. package/dist/es/utils/createContext.mjs +28 -9
  228. package/dist/es/utils/data-utils.mjs +9 -8
  229. package/dist/es/utils/data.mjs +35 -21
  230. package/dist/es/utils/events.mjs +5 -3
  231. package/dist/es/utils/getLinearRegression.mjs +28 -11
  232. package/dist/es/utils/grid.mjs +20 -5
  233. package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
  234. package/dist/es/utils/legend.mjs +13 -12
  235. package/dist/es/utils/log.mjs +10 -7
  236. package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
  237. package/dist/es/utils/polar.mjs +37 -30
  238. package/dist/es/utils/props.mjs +16 -10
  239. package/dist/es/utils/resolveDefaultProps.mjs +23 -4
  240. package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
  241. package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
  242. package/dist/es/utils/scale/utils/utils.mjs +43 -24
  243. package/dist/es/utils/scale.mjs +46 -0
  244. package/dist/es/utils/style.mjs +24 -13
  245. package/dist/es/utils/tick.mjs +34 -23
  246. package/dist/es/utils/tooltip/translate.mjs +63 -49
  247. package/dist/es/utils/validate.mjs +40 -29
  248. package/dist/hooks/publicHooks.d.ts +143 -0
  249. package/dist/hooks/useIsAnimating.d.ts +14 -0
  250. package/dist/index.d.ts +1 -0
  251. package/dist/polar/pie/type.d.ts +2 -2
  252. package/dist/polar/radar/Radar.d.ts +4 -4
  253. package/dist/shape/Curve.d.ts +2 -1
  254. package/dist/shape/Polygon.d.ts +9 -0
  255. package/dist/shape/Rectangle.d.ts +0 -4
  256. package/dist/shape/Sector.d.ts +2 -2
  257. package/dist/shape/Symbols.d.ts +2 -1
  258. package/dist/shape/Trapezoid.d.ts +30 -0
  259. package/dist/shape/index.d.ts +2 -0
  260. package/dist/shape/types.d.ts +4 -5
  261. package/dist/state/ReportChartProps.d.ts +3 -3
  262. package/dist/state/graphicalItemsSlice.d.ts +1 -1
  263. package/dist/state/rootPropsSlice.d.ts +2 -2
  264. package/dist/state/selectors/axisSelectors.d.ts +5 -0
  265. package/dist/types/axis.d.ts +2 -2
  266. package/dist/types/bar.d.ts +2 -6
  267. package/dist/types/categorical.d.ts +2 -2
  268. package/dist/types/common.d.ts +7 -1
  269. package/dist/types/tooltip.d.ts +2 -2
  270. package/dist/utils/cell.d.ts +11 -0
  271. package/dist/utils/createCategoricalInverse.d.ts +16 -0
  272. package/dist/utils/scale.d.ts +23 -0
  273. package/package.json +2 -1
@@ -1,45 +1,49 @@
1
- import { isNumber as e } from "../../utils/validate.mjs";
2
- import { warn as t } from "../../utils/log.mjs";
3
- import { useIsPanorama as n } from "../../context/PanoramaContextProvider.mjs";
4
- import { getTicksOfAxis as r } from "../../utils/chart.mjs";
5
- import { selectAxisPropsNeededForCartesianGridTicksGenerator as i } from "../../state/selectors/axisSelectors.mjs";
6
- import { useAppSelector as a } from "../../state/hooks.mjs";
7
- import { useChartHeight as o, useChartWidth as s, useOffset as c } from "../../context/chartLayoutContext.mjs";
8
- import { CartesianAxisDefaultProps as l } from "./const.mjs";
9
- import { getTicks as u } from "../utils/get-ticks.mjs";
10
- import { CartesianAxis as d } from "../cartesian-axis/CartesianAxis.mjs";
11
- import { resolveDefaultProps as f } from "../../utils/resolveDefaultProps.mjs";
12
- import { getCoordinatesOfGrid as p } from "../../utils/grid.mjs";
13
- import m from "./Background.mjs";
14
- import h from "./HorizontalStripes.mjs";
15
- import g from "./VerticalStripes.mjs";
16
- import _ from "./HorizontalGridLines.mjs";
17
- import v from "./VerticalGridLines.mjs";
18
- import { createVNode as y, defineComponent as b, mergeProps as x } from "vue";
1
+ import { isNumber } from "../../utils/validate.mjs";
2
+ import { warn } from "../../utils/log.mjs";
3
+ import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
4
+ import { getTicksOfAxis } from "../../utils/chart.mjs";
5
+ import { selectAxisPropsNeededForCartesianGridTicksGenerator } from "../../state/selectors/axisSelectors.mjs";
6
+ import { useAppSelector } from "../../state/hooks.mjs";
7
+ import { useChartHeight, useChartWidth, useOffset } from "../../context/chartLayoutContext.mjs";
8
+ import { CartesianAxisDefaultProps } from "./const.mjs";
9
+ import { getTicks } from "../utils/get-ticks.mjs";
10
+ import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
11
+ import { resolveDefaultProps } from "../../utils/resolveDefaultProps.mjs";
12
+ import { getCoordinatesOfGrid } from "../../utils/grid.mjs";
13
+ import Background from "./Background.mjs";
14
+ import HorizontalStripes from "./HorizontalStripes.mjs";
15
+ import VerticalStripes from "./VerticalStripes.mjs";
16
+ import HorizontalGridLines from "./HorizontalGridLines.mjs";
17
+ import VerticalGridLines from "./VerticalGridLines.mjs";
18
+ import { createVNode, defineComponent, mergeProps } from "vue";
19
19
  //#region src/cartesian/cartesian-grid/CartesianGrid.tsx
20
- var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
21
- ...l,
22
- ...e,
23
- ticks: r(e, !0),
20
+ var defaultHorizontalCoordinatesGenerator = ({ yAxis, width, height, offset }, syncWithTicks) => getCoordinatesOfGrid(getTicks({
21
+ ...CartesianAxisDefaultProps,
22
+ ...yAxis,
23
+ ticks: getTicksOfAxis(yAxis, true),
24
24
  viewBox: {
25
25
  x: 0,
26
26
  y: 0,
27
- width: t,
28
- height: n
27
+ width,
28
+ height
29
29
  }
30
- }), i.top, i.top + i.height, a), C = ({ xAxis: e, width: t, height: n, offset: i }, a) => p(u({
31
- ...d.defaultProps,
32
- ...e,
33
- ticks: r(e, !0),
34
- viewBox: {
35
- x: 0,
36
- y: 0,
37
- width: t,
38
- height: n
39
- }
40
- }), i.left, i.left + i.width, a), w = {
41
- horizontal: !0,
42
- vertical: !0,
30
+ }), offset.top, offset.top + offset.height, syncWithTicks);
31
+ var defaultVerticalCoordinatesGenerator = ({ xAxis, width, height, offset }, syncWithTicks) => {
32
+ return getCoordinatesOfGrid(getTicks({
33
+ ...CartesianAxis.defaultProps,
34
+ ...xAxis,
35
+ ticks: getTicksOfAxis(xAxis, true),
36
+ viewBox: {
37
+ x: 0,
38
+ y: 0,
39
+ width,
40
+ height
41
+ }
42
+ }), offset.left, offset.left + offset.width, syncWithTicks);
43
+ };
44
+ var defaultProps = {
45
+ horizontal: true,
46
+ vertical: true,
43
47
  horizontalPoints: [],
44
48
  verticalPoints: [],
45
49
  stroke: "#ccc",
@@ -48,9 +52,10 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
48
52
  horizontalFill: [],
49
53
  xAxisId: 0,
50
54
  yAxisId: 0
51
- }, T = /* @__PURE__ */ b({
55
+ };
56
+ var CartesianGrid = /* @__PURE__ */ defineComponent({
52
57
  name: "CartesianGrid",
53
- inheritAttrs: !1,
58
+ inheritAttrs: false,
54
59
  props: {
55
60
  xAxisId: {
56
61
  type: [String, Number],
@@ -70,11 +75,11 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
70
75
  },
71
76
  horizontal: {
72
77
  type: [Boolean, Object],
73
- default: !0
78
+ default: true
74
79
  },
75
80
  vertical: {
76
81
  type: [Boolean, Object],
77
- default: !0
82
+ default: true
78
83
  },
79
84
  horizontalPoints: Array,
80
85
  verticalPoints: Array,
@@ -86,70 +91,84 @@ var S = ({ yAxis: e, width: t, height: n, offset: i }, a) => p(u({
86
91
  verticalCoordinatesGenerator: Function,
87
92
  horizontalCoordinatesGenerator: Function
88
93
  },
89
- setup(r, { attrs: l, slots: u }) {
90
- let d = s(), p = o(), b = c(), T = n(), E = a((e) => i(e, "xAxis", r.xAxisId, T)), D = a((e) => i(e, "yAxis", r.yAxisId, T));
94
+ setup(props, { attrs, slots }) {
95
+ const chartWidth = useChartWidth();
96
+ const chartHeight = useChartHeight();
97
+ const offset = useOffset();
98
+ const isPanorama = useIsPanorama();
99
+ const xAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "xAxis", props.xAxisId, isPanorama));
100
+ const yAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "yAxis", props.yAxisId, isPanorama));
91
101
  return () => {
92
- let n = {
93
- ...f({
94
- ...r,
95
- ...l
96
- }, w),
97
- x: e(r.x) ? r.x : b.value.left,
98
- y: e(r.y) ? r.y : b.value.top,
99
- width: e(r.width) ? r.width : b.value.width,
100
- height: e(r.height) ? r.height : b.value.height
101
- }, { x: i, y: a, width: o, height: s, syncWithTicks: c, horizontalValues: T, verticalValues: O } = n, k = n.verticalCoordinatesGenerator || C, A = n.horizontalCoordinatesGenerator || S, { horizontalPoints: j, verticalPoints: M } = n;
102
- if ((!j || !j.length) && typeof A == "function") {
103
- let e = T && T.length, n = A({
104
- yAxis: D.value ? {
105
- ...D.value,
106
- ticks: e ? T : D.value?.ticks
102
+ const propsIncludingDefaults = {
103
+ ...resolveDefaultProps({
104
+ ...props,
105
+ ...attrs
106
+ }, defaultProps),
107
+ x: isNumber(props.x) ? props.x : offset.value.left,
108
+ y: isNumber(props.y) ? props.y : offset.value.top,
109
+ width: isNumber(props.width) ? props.width : offset.value.width,
110
+ height: isNumber(props.height) ? props.height : offset.value.height
111
+ };
112
+ const { x, y, width, height, syncWithTicks, horizontalValues, verticalValues } = propsIncludingDefaults;
113
+ const verticalCoordinatesGenerator = propsIncludingDefaults.verticalCoordinatesGenerator || defaultVerticalCoordinatesGenerator;
114
+ const horizontalCoordinatesGenerator = propsIncludingDefaults.horizontalCoordinatesGenerator || defaultHorizontalCoordinatesGenerator;
115
+ let { horizontalPoints, verticalPoints } = propsIncludingDefaults;
116
+ if ((!horizontalPoints || !horizontalPoints.length) && typeof horizontalCoordinatesGenerator === "function") {
117
+ const isHorizontalValues = horizontalValues && horizontalValues.length;
118
+ const generatorResult = horizontalCoordinatesGenerator({
119
+ yAxis: yAxis.value ? {
120
+ ...yAxis.value,
121
+ ticks: isHorizontalValues ? horizontalValues : yAxis.value?.ticks
107
122
  } : void 0,
108
- width: d.value,
109
- height: p.value,
110
- offset: b.value
111
- }, e ? !0 : c);
112
- t(Array.isArray(n), `horizontalCoordinatesGenerator should return Array but instead it returned [${typeof n}]`), Array.isArray(n) && (j = n);
123
+ width: chartWidth.value,
124
+ height: chartHeight.value,
125
+ offset: offset.value
126
+ }, isHorizontalValues ? true : syncWithTicks);
127
+ warn(Array.isArray(generatorResult), `horizontalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
128
+ if (Array.isArray(generatorResult)) horizontalPoints = generatorResult;
113
129
  }
114
- if ((!M || !M.length) && typeof k == "function") {
115
- let e = O && O.length, n = k({
116
- xAxis: E.value ? {
117
- ...E.value,
118
- ticks: e ? O : E.value?.ticks
130
+ if ((!verticalPoints || !verticalPoints.length) && typeof verticalCoordinatesGenerator === "function") {
131
+ const isVerticalValues = verticalValues && verticalValues.length;
132
+ const generatorResult = verticalCoordinatesGenerator({
133
+ xAxis: xAxis.value ? {
134
+ ...xAxis.value,
135
+ ticks: isVerticalValues ? verticalValues : xAxis.value?.ticks
119
136
  } : void 0,
120
- width: d.value,
121
- height: p.value,
122
- offset: b.value
123
- }, e ? !0 : c);
124
- t(Array.isArray(n), `verticalCoordinatesGenerator should return Array but instead it returned [${typeof n}]`), Array.isArray(n) && (M = n);
137
+ width: chartWidth.value,
138
+ height: chartHeight.value,
139
+ offset: offset.value
140
+ }, isVerticalValues ? true : syncWithTicks);
141
+ warn(Array.isArray(generatorResult), `verticalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
142
+ if (Array.isArray(generatorResult)) verticalPoints = generatorResult;
125
143
  }
126
- return !e(o) || o <= 0 || !e(s) || s <= 0 || !e(i) || i !== +i || !e(a) || a !== +a ? null : y("g", { class: "v-charts-cartesian-grid" }, [
127
- y(m, {
128
- fill: n.fill,
129
- fillOpacity: n.fillOpacity,
130
- x: n.x,
131
- y: n.y,
132
- width: n.width,
133
- height: n.height,
134
- ry: n.ry
144
+ if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0 || !isNumber(x) || x !== +x || !isNumber(y) || y !== +y) return null;
145
+ return createVNode("g", { "class": "v-charts-cartesian-grid" }, [
146
+ createVNode(Background, {
147
+ "fill": propsIncludingDefaults.fill,
148
+ "fillOpacity": propsIncludingDefaults.fillOpacity,
149
+ "x": propsIncludingDefaults.x,
150
+ "y": propsIncludingDefaults.y,
151
+ "width": propsIncludingDefaults.width,
152
+ "height": propsIncludingDefaults.height,
153
+ "ry": propsIncludingDefaults.ry
135
154
  }, null),
136
- y(h, x(n, { horizontalPoints: j }), null),
137
- y(g, x(n, { verticalPoints: M }), null),
138
- y(_, x(n, {
139
- offset: b.value,
140
- horizontalPoints: j,
141
- xAxis: E.value,
142
- yAxis: D.value
143
- }), { default: () => [u.horizontal ? { horizontal: u.horizontal } : void 0] }),
144
- y(v, x(n, {
145
- offset: b,
146
- verticalPoints: M,
147
- xAxis: E,
148
- yAxis: D
149
- }), { default: () => [u.vertical ? { vertical: u.vertical } : void 0] })
155
+ createVNode(HorizontalStripes, mergeProps(propsIncludingDefaults, { "horizontalPoints": horizontalPoints }), null),
156
+ createVNode(VerticalStripes, mergeProps(propsIncludingDefaults, { "verticalPoints": verticalPoints }), null),
157
+ createVNode(HorizontalGridLines, mergeProps(propsIncludingDefaults, {
158
+ "offset": offset.value,
159
+ "horizontalPoints": horizontalPoints,
160
+ "xAxis": xAxis.value,
161
+ "yAxis": yAxis.value
162
+ }), { default: () => [slots.horizontal ? { horizontal: slots.horizontal } : void 0] }),
163
+ createVNode(VerticalGridLines, mergeProps(propsIncludingDefaults, {
164
+ "offset": offset,
165
+ "verticalPoints": verticalPoints,
166
+ "xAxis": xAxis,
167
+ "yAxis": yAxis
168
+ }), { default: () => [slots.vertical ? { vertical: slots.vertical } : void 0] })
150
169
  ]);
151
170
  };
152
171
  }
153
172
  });
154
173
  //#endregion
155
- export { T as CartesianGrid };
174
+ export { CartesianGrid };
@@ -1,9 +1,9 @@
1
- import { renderLineItem as e } from "./utils.mjs";
2
- import { createVNode as t, defineComponent as n } from "vue";
1
+ import { renderLineItem } from "./utils.mjs";
2
+ import { createVNode, defineComponent } from "vue";
3
3
  //#region src/cartesian/cartesian-grid/HorizontalGridLines.tsx
4
- var r = /* @__PURE__ */ n({
4
+ var HorizontalGridLines = /* @__PURE__ */ defineComponent({
5
5
  name: "HorizontalGridLines",
6
- inheritAttrs: !1,
6
+ inheritAttrs: false,
7
7
  props: {
8
8
  x: Number,
9
9
  width: Number,
@@ -21,29 +21,30 @@ var r = /* @__PURE__ */ n({
21
21
  xAxis: Object,
22
22
  yAxis: Object
23
23
  },
24
- setup(n, { attrs: r, slots: i }) {
24
+ setup(props, { attrs, slots }) {
25
25
  return () => {
26
- let { x: a, width: o, horizontal: s = !0, horizontalPoints: c } = n;
27
- if (!s || !c || !c.length) return null;
28
- let { xAxisId: l, yAxisId: u, ...d } = {
29
- ...n,
30
- ...r
26
+ const { x, width, horizontal = true, horizontalPoints } = props;
27
+ if (!horizontal || !horizontalPoints || !horizontalPoints.length) return null;
28
+ const { xAxisId, yAxisId, ...otherLineItemProps } = {
29
+ ...props,
30
+ ...attrs
31
31
  };
32
- return t("g", { class: "v-charts-cartesian-grid-horizontal" }, [c.map((t, n) => {
33
- let c = {
34
- ...d,
35
- ...r,
36
- x1: a,
37
- y1: t,
38
- x2: a + o,
39
- y2: t,
40
- key: `line-${n}`,
41
- index: n
32
+ const items = horizontalPoints.map((entry, i) => {
33
+ const lineItemProps = {
34
+ ...otherLineItemProps,
35
+ ...attrs,
36
+ x1: x,
37
+ y1: entry,
38
+ x2: x + width,
39
+ y2: entry,
40
+ key: `line-${i}`,
41
+ index: i
42
42
  };
43
- return e(i.horizontal, s, c);
44
- })]);
43
+ return renderLineItem(slots.horizontal, horizontal, lineItemProps);
44
+ });
45
+ return createVNode("g", { "class": "v-charts-cartesian-grid-horizontal" }, [items]);
45
46
  };
46
47
  }
47
48
  });
48
49
  //#endregion
49
- export { r as default };
50
+ export { HorizontalGridLines as default };
@@ -1,8 +1,8 @@
1
- import { createVNode as e, defineComponent as t } from "vue";
1
+ import { createVNode, defineComponent } from "vue";
2
2
  //#region src/cartesian/cartesian-grid/HorizontalStripes.tsx
3
- var n = /* @__PURE__ */ t({
3
+ var HorizontalStripes = /* @__PURE__ */ defineComponent({
4
4
  name: "HorizontalStripes",
5
- inheritAttrs: !1,
5
+ inheritAttrs: false,
6
6
  props: {
7
7
  horizontalFill: Array,
8
8
  fillOpacity: Number,
@@ -13,31 +13,31 @@ var n = /* @__PURE__ */ t({
13
13
  horizontalPoints: Array,
14
14
  horizontal: [Boolean, Object]
15
15
  },
16
- setup(t) {
16
+ setup(props) {
17
17
  return () => {
18
- let { horizontalFill: n, fillOpacity: r, x: i, y: a, width: o, height: s, horizontalPoints: c, horizontal: l = !0 } = t;
19
- if (!l || !n || !n.length) return null;
20
- let u = c?.map((e) => Math.round(e + a - a)).sort((e, t) => e - t);
21
- a !== u?.[0] && u?.unshift(0);
22
- let d = u?.map((t, c) => {
23
- let l = u[c + 1] ? u[c + 1] - t : a + s - t;
24
- if (l <= 0) return null;
25
- let d = c % n.length;
26
- return e("rect", {
27
- key: `react-${c}`,
28
- y: t,
29
- x: i,
30
- height: l,
31
- width: o,
32
- stroke: "none",
33
- fill: n[d],
34
- "fill-opacity": r,
35
- class: "v-charts-cartesian-grid-bg"
18
+ const { horizontalFill, fillOpacity, x, y, width, height, horizontalPoints, horizontal = true } = props;
19
+ if (!horizontal || !horizontalFill || !horizontalFill.length) return null;
20
+ const roundedSortedHorizontalPoints = horizontalPoints?.map((e) => Math.round(e + y - y)).sort((a, b) => a - b);
21
+ if (y !== roundedSortedHorizontalPoints?.[0]) roundedSortedHorizontalPoints?.unshift(0);
22
+ const items = roundedSortedHorizontalPoints?.map((entry, i) => {
23
+ const lineHeight = !roundedSortedHorizontalPoints[i + 1] ? y + height - entry : roundedSortedHorizontalPoints[i + 1] - entry;
24
+ if (lineHeight <= 0) return null;
25
+ const colorIndex = i % horizontalFill.length;
26
+ return createVNode("rect", {
27
+ "key": `react-${i}`,
28
+ "y": entry,
29
+ "x": x,
30
+ "height": lineHeight,
31
+ "width": width,
32
+ "stroke": "none",
33
+ "fill": horizontalFill[colorIndex],
34
+ "fill-opacity": fillOpacity,
35
+ "class": "v-charts-cartesian-grid-bg"
36
36
  }, null);
37
37
  });
38
- return e("g", { class: "v-charts-cartesian-gridstripes-horizontal" }, [d]);
38
+ return createVNode("g", { "class": "v-charts-cartesian-gridstripes-horizontal" }, [items]);
39
39
  };
40
40
  }
41
41
  });
42
42
  //#endregion
43
- export { n as default };
43
+ export { HorizontalStripes as default };
@@ -1,9 +1,9 @@
1
- import { renderLineItem as e } from "./utils.mjs";
2
- import { createVNode as t, defineComponent as n } from "vue";
1
+ import { renderLineItem } from "./utils.mjs";
2
+ import { createVNode, defineComponent } from "vue";
3
3
  //#region src/cartesian/cartesian-grid/VerticalGridLines.tsx
4
- var r = /* @__PURE__ */ n({
4
+ var VerticalGridLines = /* @__PURE__ */ defineComponent({
5
5
  name: "VerticalGridLines",
6
- inheritAttrs: !1,
6
+ inheritAttrs: false,
7
7
  props: {
8
8
  x: Number,
9
9
  y: Number,
@@ -17,28 +17,29 @@ var r = /* @__PURE__ */ n({
17
17
  yAxis: Object,
18
18
  vertical: [Boolean, Object]
19
19
  },
20
- setup(n, { attrs: r, slots: i }) {
20
+ setup(props, { attrs, slots }) {
21
21
  return () => {
22
- let { y: a, height: o, vertical: s = !0, verticalPoints: c } = n;
23
- if (!s || !c || !c.length) return null;
24
- let { xAxisId: l, yAxisId: u, ...d } = {
25
- ...n,
26
- ...r
22
+ const { y, height, vertical = true, verticalPoints } = props;
23
+ if (!vertical || !verticalPoints || !verticalPoints.length) return null;
24
+ const { xAxisId, yAxisId, ...otherLineItemProps } = {
25
+ ...props,
26
+ ...attrs
27
27
  };
28
- return t("g", { class: "v-charts-cartesian-grid-vertical" }, [c.map((t, n) => {
29
- let r = {
30
- ...d,
31
- x1: t,
32
- y1: a,
33
- x2: t,
34
- y2: a + o,
35
- key: `line-${n}`,
36
- index: n
28
+ const items = verticalPoints.map((entry, i) => {
29
+ const lineItemProps = {
30
+ ...otherLineItemProps,
31
+ x1: entry,
32
+ y1: y,
33
+ x2: entry,
34
+ y2: y + height,
35
+ key: `line-${i}`,
36
+ index: i
37
37
  };
38
- return e(i.vertical, s, r);
39
- })]);
38
+ return renderLineItem(slots.vertical, vertical, lineItemProps);
39
+ });
40
+ return createVNode("g", { "class": "v-charts-cartesian-grid-vertical" }, [items]);
40
41
  };
41
42
  }
42
43
  });
43
44
  //#endregion
44
- export { r as default };
45
+ export { VerticalGridLines as default };
@@ -1,8 +1,8 @@
1
- import { createVNode as e, defineComponent as t } from "vue";
1
+ import { createVNode, defineComponent } from "vue";
2
2
  //#region src/cartesian/cartesian-grid/VerticalStripes.tsx
3
- var n = /* @__PURE__ */ t({
3
+ var VerticalStripes = /* @__PURE__ */ defineComponent({
4
4
  name: "VerticalStripes",
5
- inheritAttrs: !1,
5
+ inheritAttrs: false,
6
6
  props: {
7
7
  verticalFill: Array,
8
8
  fillOpacity: Number,
@@ -13,31 +13,31 @@ var n = /* @__PURE__ */ t({
13
13
  verticalPoints: Array,
14
14
  vertical: [Boolean, Object]
15
15
  },
16
- setup(t) {
16
+ setup(props) {
17
17
  return () => {
18
- let { verticalFill: n, fillOpacity: r, x: i, y: a, width: o, height: s, verticalPoints: c, vertical: l = !0 } = t;
19
- if (!l || !n || !n.length) return null;
20
- let u = c?.map((e) => Math.round(e + i - i)).sort((e, t) => e - t);
21
- i !== u?.[0] && u?.unshift(0);
22
- let d = u?.map((t, c) => {
23
- let l = u[c + 1] ? u[c + 1] - t : i + o - t;
24
- if (l <= 0) return null;
25
- let d = c % n.length;
26
- return e("rect", {
27
- key: `react-${c}`,
28
- x: t,
29
- y: a,
30
- width: l,
31
- height: s,
32
- stroke: "none",
33
- fill: n[d],
34
- "fill-opacity": r,
35
- class: "v-charts-cartesian-grid-bg"
18
+ const { verticalFill, fillOpacity, x, y, width, height, verticalPoints, vertical = true } = props;
19
+ if (!vertical || !verticalFill || !verticalFill.length) return null;
20
+ const roundedSortedVerticalPoints = verticalPoints?.map((e) => Math.round(e + x - x)).sort((a, b) => a - b);
21
+ if (x !== roundedSortedVerticalPoints?.[0]) roundedSortedVerticalPoints?.unshift(0);
22
+ const items = roundedSortedVerticalPoints?.map((entry, i) => {
23
+ const lineWidth = !roundedSortedVerticalPoints[i + 1] ? x + width - entry : roundedSortedVerticalPoints[i + 1] - entry;
24
+ if (lineWidth <= 0) return null;
25
+ const colorIndex = i % verticalFill.length;
26
+ return createVNode("rect", {
27
+ "key": `react-${i}`,
28
+ "x": entry,
29
+ "y": y,
30
+ "width": lineWidth,
31
+ "height": height,
32
+ "stroke": "none",
33
+ "fill": verticalFill[colorIndex],
34
+ "fill-opacity": fillOpacity,
35
+ "class": "v-charts-cartesian-grid-bg"
36
36
  }, null);
37
37
  });
38
- return e("g", { class: "v-charts-cartesian-gridstripes-vertical" }, [d]);
38
+ return createVNode("g", { "class": "v-charts-cartesian-gridstripes-vertical" }, [items]);
39
39
  };
40
40
  }
41
41
  });
42
42
  //#endregion
43
- export { n as default };
43
+ export { VerticalStripes as default };