vccs 0.1.0 → 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 (215) hide show
  1. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  2. package/dist/cartesian/funnel/index.d.ts +2 -0
  3. package/dist/cartesian/funnel/type.d.ts +74 -5
  4. package/dist/cartesian/index.d.ts +1 -0
  5. package/dist/chart/FunnelChart.d.ts +1 -0
  6. package/dist/chart/index.d.ts +1 -0
  7. package/dist/es/animation/Animate.mjs +48 -22
  8. package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
  9. package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
  10. package/dist/es/cartesian/area/Area.mjs +42 -31
  11. package/dist/es/cartesian/area/ClipRect.mjs +79 -58
  12. package/dist/es/cartesian/area/RenderArea.mjs +142 -108
  13. package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
  14. package/dist/es/cartesian/area/type.mjs +11 -11
  15. package/dist/es/cartesian/area/utils.mjs +69 -49
  16. package/dist/es/cartesian/axis/XAxis.mjs +87 -73
  17. package/dist/es/cartesian/axis/YAxis.mjs +67 -56
  18. package/dist/es/cartesian/bar/Bar.mjs +93 -71
  19. package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
  20. package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
  21. package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
  22. package/dist/es/cartesian/bar/type.mjs +9 -9
  23. package/dist/es/cartesian/bar/utils.mjs +97 -70
  24. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
  25. package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
  26. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
  27. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
  28. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
  29. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
  30. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
  31. package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
  32. package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
  33. package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
  34. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
  35. package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
  36. package/dist/es/cartesian/funnel/type.mjs +80 -0
  37. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  38. package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
  39. package/dist/es/cartesian/line/Line.mjs +41 -37
  40. package/dist/es/cartesian/line/StaticLine.mjs +191 -122
  41. package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
  42. package/dist/es/cartesian/line/type.mjs +11 -11
  43. package/dist/es/cartesian/line/utils.mjs +27 -26
  44. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +86 -69
  45. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -77
  46. package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
  47. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
  48. package/dist/es/cartesian/useNeedsClip.mjs +18 -9
  49. package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
  50. package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
  51. package/dist/es/chart/AreaChart.mjs +5 -5
  52. package/dist/es/chart/BarChart.mjs +5 -5
  53. package/dist/es/chart/ComposedChart.mjs +5 -5
  54. package/dist/es/chart/FunnelChart.mjs +11 -0
  55. package/dist/es/chart/LegendPortalContext.mjs +3 -3
  56. package/dist/es/chart/LineChart.mjs +5 -5
  57. package/dist/es/chart/PieChart.mjs +5 -5
  58. package/dist/es/chart/RadarChart.mjs +5 -5
  59. package/dist/es/chart/RadialBarChart.mjs +5 -5
  60. package/dist/es/chart/RechartsWrapper.mjs +111 -88
  61. package/dist/es/chart/ScatterChart.mjs +5 -5
  62. package/dist/es/chart/Surface.mjs +3 -3
  63. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
  64. package/dist/es/chart/TooltipPortalContext.mjs +3 -3
  65. package/dist/es/chart/const.mjs +2 -2
  66. package/dist/es/chart/generateCategoricalChart.mjs +97 -88
  67. package/dist/es/chart/provideClipPathId.mjs +12 -7
  68. package/dist/es/components/Cell.mjs +16 -4
  69. package/dist/es/components/Text.mjs +3 -3
  70. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
  71. package/dist/es/components/Tooltip.mjs +274 -199
  72. package/dist/es/components/label/Label.mjs +30 -26
  73. package/dist/es/components/label/LabelList.mjs +45 -39
  74. package/dist/es/components/label/types.mjs +8 -5
  75. package/dist/es/components/label/utils.mjs +194 -162
  76. package/dist/es/components/legend/Legend.mjs +82 -71
  77. package/dist/es/components/legend/LegendSymbol.mjs +40 -38
  78. package/dist/es/components/legend/hooks/useLegend.mjs +66 -46
  79. package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
  80. package/dist/es/components/legend/type.mjs +2 -2
  81. package/dist/es/components/legend/utils.mjs +19 -11
  82. package/dist/es/components/utils.mjs +35 -22
  83. package/dist/es/container/ClipPath.mjs +14 -14
  84. package/dist/es/container/Layer.mjs +9 -7
  85. package/dist/es/container/ResponsiveContainer.mjs +3 -3
  86. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
  87. package/dist/es/container/Surface.mjs +23 -19
  88. package/dist/es/container/useSizeContext.mjs +3 -3
  89. package/dist/es/context/ChartDataContextProvider.mjs +19 -13
  90. package/dist/es/context/PanoramaContextProvider.mjs +15 -10
  91. package/dist/es/context/accessibilityContext.mjs +3 -3
  92. package/dist/es/context/cartesianLabelListContext.mjs +3 -3
  93. package/dist/es/context/chartLayoutContext.mjs +33 -30
  94. package/dist/es/context/cursorLayerContext.mjs +3 -3
  95. package/dist/es/context/graphicalLayerContext.mjs +3 -3
  96. package/dist/es/context/labelLayerContext.mjs +3 -3
  97. package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
  98. package/dist/es/context/useTooltipAxis.mjs +14 -12
  99. package/dist/es/events/useChartSynchronisation.mjs +91 -66
  100. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  101. package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
  102. package/dist/es/index.mjs +46 -42
  103. package/dist/es/polar/pie/Pie.mjs +131 -115
  104. package/dist/es/polar/pie/type.mjs +6 -6
  105. package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
  106. package/dist/es/polar/radar/PolarGrid.mjs +72 -59
  107. package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
  108. package/dist/es/polar/radar/Radar.mjs +181 -145
  109. package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
  110. package/dist/es/polar/radial-bar/type.mjs +9 -9
  111. package/dist/es/shape/Cross.mjs +11 -10
  112. package/dist/es/shape/Curve.mjs +69 -43
  113. package/dist/es/shape/Dot.mjs +12 -11
  114. package/dist/es/shape/Rectangle.mjs +41 -26
  115. package/dist/es/shape/Sector.mjs +103 -75
  116. package/dist/es/shape/Symbols.mjs +45 -34
  117. package/dist/es/shape/Trapezoid.mjs +52 -0
  118. package/dist/es/state/ReportChartProps.mjs +21 -20
  119. package/dist/es/state/ReportMainChartProps.mjs +26 -21
  120. package/dist/es/state/ReportPolarOptions.mjs +23 -22
  121. package/dist/es/state/SetGraphicalItem.mjs +42 -27
  122. package/dist/es/state/SetLegendPayload.mjs +17 -13
  123. package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
  124. package/dist/es/state/brushSlice.mjs +12 -8
  125. package/dist/es/state/cartesianAxisSlice.mjs +23 -17
  126. package/dist/es/state/chartDataSlice.mjs +18 -13
  127. package/dist/es/state/externalEventsMiddleware.mjs +25 -15
  128. package/dist/es/state/graphicalItemsSlice.mjs +29 -25
  129. package/dist/es/state/hooks.mjs +4 -3
  130. package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
  131. package/dist/es/state/layoutSlice.mjs +18 -12
  132. package/dist/es/state/legendSlice.mjs +19 -14
  133. package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
  134. package/dist/es/state/optionsSlice.mjs +14 -11
  135. package/dist/es/state/polarAxisSlice.mjs +15 -13
  136. package/dist/es/state/polarOptionsSlice.mjs +8 -6
  137. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
  138. package/dist/es/state/referenceElementsSlice.mjs +21 -19
  139. package/dist/es/state/rootPropsSlice.mjs +20 -9
  140. package/dist/es/state/selectors/areaSelectors.mjs +65 -55
  141. package/dist/es/state/selectors/axisSelectors.mjs +755 -569
  142. package/dist/es/state/selectors/barSelectors.mjs +225 -162
  143. package/dist/es/state/selectors/brushSelectors.mjs +15 -14
  144. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
  145. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
  146. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
  147. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
  148. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
  149. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
  150. package/dist/es/state/selectors/common.mjs +2 -2
  151. package/dist/es/state/selectors/containerSelectors.mjs +5 -2
  152. package/dist/es/state/selectors/dataSelectors.mjs +28 -9
  153. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  154. package/dist/es/state/selectors/legendSelectors.mjs +7 -6
  155. package/dist/es/state/selectors/lineSelectors.mjs +54 -47
  156. package/dist/es/state/selectors/pickAxisId.mjs +2 -2
  157. package/dist/es/state/selectors/pickAxisType.mjs +2 -2
  158. package/dist/es/state/selectors/pieSelectors.mjs +116 -81
  159. package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
  160. package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
  161. package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
  162. package/dist/es/state/selectors/polarSelectors.mjs +79 -62
  163. package/dist/es/state/selectors/radarSelectors.mjs +111 -91
  164. package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
  165. package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
  166. package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
  167. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
  168. package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
  169. package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
  170. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
  171. package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
  172. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
  173. package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
  174. package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
  175. package/dist/es/state/selectors/selectors.mjs +94 -75
  176. package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
  177. package/dist/es/state/selectors/touchSelectors.mjs +17 -14
  178. package/dist/es/state/store.mjs +46 -46
  179. package/dist/es/state/tooltipSlice.mjs +64 -37
  180. package/dist/es/state/touchEventsMiddleware.mjs +35 -29
  181. package/dist/es/state/utils/useReportScale.mjs +16 -13
  182. package/dist/es/synchronisation/syncSelectors.mjs +3 -3
  183. package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
  184. package/dist/es/types/event.mjs +164 -2
  185. package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
  186. package/dist/es/utils/VueUtils.mjs +35 -14
  187. package/dist/es/utils/attrs.mjs +43 -26
  188. package/dist/es/utils/cartesian.mjs +47 -15
  189. package/dist/es/utils/chart.mjs +298 -197
  190. package/dist/es/utils/const.mjs +30 -2
  191. package/dist/es/utils/createContext.mjs +28 -9
  192. package/dist/es/utils/data-utils.mjs +9 -8
  193. package/dist/es/utils/data.mjs +35 -21
  194. package/dist/es/utils/events.mjs +5 -3
  195. package/dist/es/utils/getLinearRegression.mjs +28 -11
  196. package/dist/es/utils/grid.mjs +20 -5
  197. package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
  198. package/dist/es/utils/legend.mjs +13 -12
  199. package/dist/es/utils/log.mjs +10 -7
  200. package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
  201. package/dist/es/utils/polar.mjs +37 -30
  202. package/dist/es/utils/props.mjs +16 -10
  203. package/dist/es/utils/resolveDefaultProps.mjs +23 -4
  204. package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
  205. package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
  206. package/dist/es/utils/scale/utils/utils.mjs +43 -24
  207. package/dist/es/utils/style.mjs +24 -13
  208. package/dist/es/utils/tick.mjs +34 -23
  209. package/dist/es/utils/tooltip/translate.mjs +63 -49
  210. package/dist/es/utils/validate.mjs +40 -29
  211. package/dist/hooks/useIsAnimating.d.ts +14 -0
  212. package/dist/shape/Trapezoid.d.ts +31 -0
  213. package/dist/shape/index.d.ts +1 -0
  214. package/dist/state/graphicalItemsSlice.d.ts +1 -1
  215. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { CurveVueProps as e } from "../../shape/Curve.mjs";
1
+ import { CurveVueProps } from "../../shape/Curve.mjs";
2
2
  //#region src/cartesian/area/type.ts
3
- var t = {
4
- ...e,
3
+ var AreaVueProps = {
4
+ ...CurveVueProps,
5
5
  activeDot: {
6
6
  type: Boolean,
7
- default: !0
7
+ default: true
8
8
  },
9
9
  baseValue: {
10
10
  type: [Number, String],
@@ -12,7 +12,7 @@ var t = {
12
12
  },
13
13
  connectNulls: {
14
14
  type: Boolean,
15
- default: !1
15
+ default: false
16
16
  },
17
17
  data: {
18
18
  type: Array,
@@ -24,11 +24,11 @@ var t = {
24
24
  Number,
25
25
  Function
26
26
  ],
27
- required: !0
27
+ required: true
28
28
  },
29
29
  dot: {
30
30
  type: Boolean,
31
- default: !1
31
+ default: false
32
32
  },
33
33
  fill: {
34
34
  type: String,
@@ -45,11 +45,11 @@ var t = {
45
45
  },
46
46
  hide: {
47
47
  type: Boolean,
48
- default: !1
48
+ default: false
49
49
  },
50
50
  isAnimationActive: {
51
51
  type: Boolean,
52
- default: !0
52
+ default: true
53
53
  },
54
54
  label: {
55
55
  type: [Boolean, Object],
@@ -76,7 +76,7 @@ var t = {
76
76
  },
77
77
  needClip: {
78
78
  type: Boolean,
79
- default: !1
79
+ default: false
80
80
  },
81
81
  stackId: {
82
82
  type: [String, Number],
@@ -133,4 +133,4 @@ var t = {
133
133
  }
134
134
  };
135
135
  //#endregion
136
- export { t as AreaVueProps };
136
+ export { AreaVueProps };
@@ -1,59 +1,79 @@
1
- import { isNumber as e } from "../../utils/validate.mjs";
2
- import { getCateCoordinateOfLine as t, getValueByDataKey as n } from "../../utils/chart.mjs";
1
+ import { isNumber } from "../../utils/validate.mjs";
2
+ import { getCateCoordinateOfLine, getValueByDataKey } from "../../utils/chart.mjs";
3
3
  //#region src/cartesian/area/utils.ts
4
- function r(t, n, r, i, a) {
5
- let o = r ?? n;
6
- if (e(o)) return o;
7
- let s = t === "horizontal" ? a : i, c = s.scale.domain();
8
- if (s.type === "number") {
9
- let e = Math.max(c[0], c[1]), t = Math.min(c[0], c[1]);
10
- return o === "dataMin" ? t : o === "dataMax" || e < 0 ? e : Math.max(Math.min(c[0], c[1]), 0);
4
+ function getBaseValue(layout, chartBaseValue, itemBaseValue, xAxis, yAxis) {
5
+ const baseValue = itemBaseValue ?? chartBaseValue;
6
+ if (isNumber(baseValue)) return baseValue;
7
+ const numericAxis = layout === "horizontal" ? yAxis : xAxis;
8
+ const domain = numericAxis.scale.domain();
9
+ if (numericAxis.type === "number") {
10
+ const domainMax = Math.max(domain[0], domain[1]);
11
+ const domainMin = Math.min(domain[0], domain[1]);
12
+ if (baseValue === "dataMin") return domainMin;
13
+ if (baseValue === "dataMax") return domainMax;
14
+ return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);
11
15
  }
12
- return o === "dataMin" ? c[0] : o === "dataMax" ? c[1] : c[0];
16
+ if (baseValue === "dataMin") return domain[0];
17
+ if (baseValue === "dataMax") return domain[1];
18
+ return domain[0];
13
19
  }
14
- function i({ areaSettings: { connectNulls: e, baseValue: i, dataKey: a }, stackedData: o, layout: s, chartBaseValue: c, xAxis: l, yAxis: u, displayedData: d, dataStartIndex: f, xAxisTicks: p, yAxisTicks: m, bandSize: h }) {
15
- let g = o && o.length, _ = r(s, c, i, l, u), v = s === "horizontal", y = !1, b = d.map((r, i) => {
16
- let s;
17
- g ? s = o[f + i] : (s = n(r, a), Array.isArray(s) ? y = !0 : s = [_, s]);
18
- let c = s[1] == null || g && !e && n(r, a) == null;
19
- return v ? {
20
- x: t({
21
- axis: l,
22
- ticks: p,
23
- bandSize: h,
24
- entry: r,
25
- index: i
20
+ function computeArea({ areaSettings: { connectNulls, baseValue: itemBaseValue, dataKey }, stackedData, layout, chartBaseValue, xAxis, yAxis, displayedData, dataStartIndex, xAxisTicks, yAxisTicks, bandSize }) {
21
+ const hasStack = stackedData && stackedData.length;
22
+ const baseValue = getBaseValue(layout, chartBaseValue, itemBaseValue, xAxis, yAxis);
23
+ const isHorizontalLayout = layout === "horizontal";
24
+ let isRange = false;
25
+ const points = displayedData.map((entry, index) => {
26
+ let value;
27
+ if (hasStack) value = stackedData[dataStartIndex + index];
28
+ else {
29
+ value = getValueByDataKey(entry, dataKey);
30
+ if (!Array.isArray(value)) value = [baseValue, value];
31
+ else isRange = true;
32
+ }
33
+ const isBreakPoint = value[1] == null || hasStack && !connectNulls && getValueByDataKey(entry, dataKey) == null;
34
+ if (isHorizontalLayout) return {
35
+ x: getCateCoordinateOfLine({
36
+ axis: xAxis,
37
+ ticks: xAxisTicks,
38
+ bandSize,
39
+ entry,
40
+ index
26
41
  }),
27
- y: c ? null : u.scale(s[1]),
28
- value: s,
29
- payload: r
30
- } : {
31
- x: c ? null : l.scale(s[1]),
32
- y: t({
33
- axis: u,
34
- ticks: m,
35
- bandSize: h,
36
- entry: r,
37
- index: i
42
+ y: isBreakPoint ? null : yAxis.scale(value[1]),
43
+ value,
44
+ payload: entry
45
+ };
46
+ return {
47
+ x: isBreakPoint ? null : xAxis.scale(value[1]),
48
+ y: getCateCoordinateOfLine({
49
+ axis: yAxis,
50
+ ticks: yAxisTicks,
51
+ bandSize,
52
+ entry,
53
+ index
38
54
  }),
39
- value: s,
40
- payload: r
55
+ value,
56
+ payload: entry
57
+ };
58
+ });
59
+ let baseLine;
60
+ if (hasStack || isRange) baseLine = points.map((entry) => {
61
+ const x = Array.isArray(entry.value) ? entry.value[0] : null;
62
+ if (isHorizontalLayout) return {
63
+ x: entry.x,
64
+ y: x != null && entry.y != null ? yAxis.scale(x) : null
41
65
  };
42
- }), x;
43
- return x = g || y ? b.map((e) => {
44
- let t = Array.isArray(e.value) ? e.value[0] : null;
45
- return v ? {
46
- x: e.x,
47
- y: t != null && e.y != null ? u.scale(t) : null
48
- } : {
49
- x: t == null ? null : l.scale(t),
50
- y: e.y
66
+ return {
67
+ x: x != null ? xAxis.scale(x) : null,
68
+ y: entry.y
51
69
  };
52
- }) : v ? u.scale(_) : l.scale(_), {
53
- points: b,
54
- baseLine: x,
55
- isRange: y
70
+ });
71
+ else baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);
72
+ return {
73
+ points,
74
+ baseLine,
75
+ isRange
56
76
  };
57
77
  }
58
78
  //#endregion
59
- export { i as computeArea };
79
+ export { computeArea };
@@ -1,12 +1,15 @@
1
- import { useIsPanorama as e } from "../../context/PanoramaContextProvider.mjs";
2
- import { selectAxisViewBox as t } from "../../state/selectors/selectChartOffset.mjs";
3
- import { implicitXAxis as n, selectAxisScale as r, selectTicksOfAxis as i, selectXAxisPosition as a, selectXAxisSize as o } from "../../state/selectors/axisSelectors.mjs";
4
- import { useAppDispatch as s, useAppSelector as c } from "../../state/hooks.mjs";
5
- import { addXAxis as l, removeXAxis as u } from "../../state/cartesianAxisSlice.mjs";
6
- import { CartesianAxis as d } from "../cartesian-axis/CartesianAxis.mjs";
7
- import { createVNode as f, defineComponent as p, mergeProps as m, watchEffect as h } from "vue";
1
+ import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
2
+ import { selectAxisViewBox } from "../../state/selectors/selectChartOffset.mjs";
3
+ import { implicitXAxis, selectAxisScale, selectTicksOfAxis, selectXAxisPosition, selectXAxisSize } from "../../state/selectors/axisSelectors.mjs";
4
+ import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
5
+ import { addXAxis, removeXAxis } from "../../state/cartesianAxisSlice.mjs";
6
+ import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
7
+ import { createVNode, defineComponent, mergeProps, watchEffect } from "vue";
8
8
  //#region src/cartesian/axis/XAxis.tsx
9
- var g = /* @__PURE__ */ p({
9
+ /**
10
+ * @fileOverview X Axis
11
+ */
12
+ var XAxisImpl = /* @__PURE__ */ defineComponent({
10
13
  props: {
11
14
  xAxisId: {
12
15
  type: [String, Number],
@@ -14,24 +17,32 @@ var g = /* @__PURE__ */ p({
14
17
  },
15
18
  ticks: Array
16
19
  },
17
- inheritAttrs: !1,
18
- setup(n, { attrs: s, slots: l }) {
19
- let u = e(), p = "xAxis", h = c((e) => r(e, p, n.xAxisId, u)), g = c((e) => o(e, n.xAxisId)), _ = c((e) => a(e, n.xAxisId)), v = c((e) => i(e, p, n.xAxisId, u)), y = c(t);
20
+ inheritAttrs: false,
21
+ setup(props, { attrs, slots }) {
22
+ const isPanorama = useIsPanorama();
23
+ const axisType = "xAxis";
24
+ const scale = useAppSelector((state) => selectAxisScale(state, axisType, props.xAxisId, isPanorama));
25
+ const axisSize = useAppSelector((state) => selectXAxisSize(state, props.xAxisId));
26
+ const position = useAppSelector((state) => selectXAxisPosition(state, props.xAxisId));
27
+ const cartesianTickItems = useAppSelector((state) => selectTicksOfAxis(state, axisType, props.xAxisId, isPanorama));
28
+ const viewBox = useAppSelector(selectAxisViewBox);
20
29
  return () => {
21
- let { ticks: e, ...t } = n;
22
- return g.value == null || _.value == null ? null : f(d, m(t, s, {
23
- viewBox: y.value,
24
- scale: h.value,
25
- x: _.value?.x,
26
- y: _.value?.y,
27
- width: g.value?.width,
28
- height: g.value?.height,
29
- ticks: v.value,
30
- class: ["v-charts-xAxis xAxis", s.class]
31
- }), { default: () => [l.tick ? { tick: l.tick } : void 0] });
30
+ const { ticks, ...allOtherProps } = props;
31
+ if (axisSize.value == null || position.value == null) return null;
32
+ return createVNode(CartesianAxis, mergeProps(allOtherProps, attrs, {
33
+ "viewBox": viewBox.value,
34
+ "scale": scale.value,
35
+ "x": position.value?.x,
36
+ "y": position.value?.y,
37
+ "width": axisSize.value?.width,
38
+ "height": axisSize.value?.height,
39
+ "ticks": cartesianTickItems.value,
40
+ "class": ["v-charts-xAxis xAxis", attrs.class]
41
+ }), { default: () => [slots.tick ? { tick: slots.tick } : void 0] });
32
42
  };
33
43
  }
34
- }), _ = /* @__PURE__ */ p({
44
+ });
45
+ var XAxisSettingsDispatcher = /* @__PURE__ */ defineComponent({
35
46
  props: {
36
47
  interval: [String, Number],
37
48
  xAxisId: [String, Number],
@@ -61,94 +72,97 @@ var g = /* @__PURE__ */ p({
61
72
  minTickGap: Number,
62
73
  tick: {
63
74
  type: [Boolean, Object],
64
- default: !0
75
+ default: true
65
76
  },
66
77
  tickFormatter: Function
67
78
  },
68
- setup(e, { slots: t }) {
69
- let n = s();
70
- return h((t) => {
71
- let r = {
72
- interval: e.interval ?? "preserveEnd",
73
- id: e.xAxisId,
74
- scale: e.scale,
75
- type: e.type,
76
- padding: e.padding,
77
- allowDataOverflow: e.allowDataOverflow,
78
- domain: e.domain,
79
- dataKey: e.dataKey,
80
- allowDuplicatedCategory: e.allowDuplicatedCategory,
81
- allowDecimals: e.allowDecimals,
82
- tickCount: e.tickCount,
83
- includeHidden: e.includeHidden ?? !1,
84
- reversed: e.reversed,
85
- ticks: e.ticks,
86
- height: e.height,
87
- orientation: e.orientation,
88
- mirror: e.mirror,
89
- hide: e.hide,
90
- unit: e.unit,
91
- name: e.name,
92
- angle: e.angle ?? 0,
93
- minTickGap: e.minTickGap ?? 5,
94
- tick: e.tick ?? !0,
95
- tickFormatter: e.tickFormatter
79
+ setup(props, { slots: dispatcherSlots }) {
80
+ const dispatch = useAppDispatch();
81
+ watchEffect((onCleanup) => {
82
+ const settings = {
83
+ interval: props.interval ?? "preserveEnd",
84
+ id: props.xAxisId,
85
+ scale: props.scale,
86
+ type: props.type,
87
+ padding: props.padding,
88
+ allowDataOverflow: props.allowDataOverflow,
89
+ domain: props.domain,
90
+ dataKey: props.dataKey,
91
+ allowDuplicatedCategory: props.allowDuplicatedCategory,
92
+ allowDecimals: props.allowDecimals,
93
+ tickCount: props.tickCount,
94
+ includeHidden: props.includeHidden ?? false,
95
+ reversed: props.reversed,
96
+ ticks: props.ticks,
97
+ height: props.height,
98
+ orientation: props.orientation,
99
+ mirror: props.mirror,
100
+ hide: props.hide,
101
+ unit: props.unit,
102
+ name: props.name,
103
+ angle: props.angle ?? 0,
104
+ minTickGap: props.minTickGap ?? 5,
105
+ tick: props.tick ?? true,
106
+ tickFormatter: props.tickFormatter
96
107
  };
97
- n(l(r)), t(() => {
98
- n(u(r));
108
+ dispatch(addXAxis(settings));
109
+ onCleanup(() => {
110
+ dispatch(removeXAxis(settings));
99
111
  });
100
- }), () => f(g, e, { default: () => [t.tick ? { tick: t.tick } : void 0] });
112
+ });
113
+ return () => createVNode(XAxisImpl, props, { default: () => [dispatcherSlots.tick ? { tick: dispatcherSlots.tick } : void 0] });
101
114
  }
102
- }), v = /* @__PURE__ */ p({
115
+ });
116
+ var XAxis = /* @__PURE__ */ defineComponent({
103
117
  name: "XAxis",
104
118
  props: {
105
119
  allowDataOverflow: {
106
120
  type: Boolean,
107
- default: n.allowDataOverflow
121
+ default: implicitXAxis.allowDataOverflow
108
122
  },
109
123
  allowDecimals: {
110
124
  type: Boolean,
111
- default: n.allowDecimals
125
+ default: implicitXAxis.allowDecimals
112
126
  },
113
127
  allowDuplicatedCategory: {
114
128
  type: Boolean,
115
- default: n.allowDuplicatedCategory
129
+ default: implicitXAxis.allowDuplicatedCategory
116
130
  },
117
131
  height: {
118
132
  type: Number,
119
- default: n.height
133
+ default: implicitXAxis.height
120
134
  },
121
135
  hide: {
122
136
  type: Boolean,
123
- default: !1
137
+ default: false
124
138
  },
125
139
  mirror: {
126
140
  type: Boolean,
127
- default: n.mirror
141
+ default: implicitXAxis.mirror
128
142
  },
129
143
  orientation: {
130
144
  type: String,
131
- default: n.orientation
145
+ default: implicitXAxis.orientation
132
146
  },
133
147
  padding: {
134
148
  type: Object,
135
- default: n.padding
149
+ default: implicitXAxis.padding
136
150
  },
137
151
  reversed: {
138
152
  type: Boolean,
139
- default: n.reversed
153
+ default: implicitXAxis.reversed
140
154
  },
141
155
  scale: {
142
156
  type: [String, Function],
143
- default: n.scale
157
+ default: implicitXAxis.scale
144
158
  },
145
159
  tickCount: {
146
160
  type: Number,
147
- default: n.tickCount
161
+ default: implicitXAxis.tickCount
148
162
  },
149
163
  type: {
150
164
  type: String,
151
- default: n.type
165
+ default: implicitXAxis.type
152
166
  },
153
167
  xAxisId: {
154
168
  type: [String, Number],
@@ -165,14 +179,14 @@ var g = /* @__PURE__ */ p({
165
179
  domain: { type: Array },
166
180
  axisLine: {
167
181
  type: Boolean,
168
- default: !0
182
+ default: true
169
183
  },
170
184
  ticks: { type: Array },
171
185
  interval: { type: [String, Number] },
172
186
  unit: { type: String },
173
187
  tickLine: {
174
188
  type: [Boolean, Object],
175
- default: !0
189
+ default: true
176
190
  },
177
191
  tickMargin: Number,
178
192
  minTickGap: {
@@ -181,9 +195,9 @@ var g = /* @__PURE__ */ p({
181
195
  },
182
196
  tickFormatter: Function
183
197
  },
184
- setup(e, { attrs: t, slots: n }) {
185
- return () => f(_, m(e, t), { default: () => [n.tick ? { tick: n.tick } : void 0] });
198
+ setup(props, { attrs, slots }) {
199
+ return () => createVNode(XAxisSettingsDispatcher, mergeProps(props, attrs), { default: () => [slots.tick ? { tick: slots.tick } : void 0] });
186
200
  }
187
201
  });
188
202
  //#endregion
189
- export { v as XAxis };
203
+ export { XAxis };
@@ -1,34 +1,42 @@
1
- import { useIsPanorama as e } from "../../context/PanoramaContextProvider.mjs";
2
- import { selectAxisViewBox as t } from "../../state/selectors/selectChartOffset.mjs";
3
- import { implicitYAxis as n, selectAxisScale as r, selectTicksOfAxis as i, selectYAxisPosition as a, selectYAxisSize as o } from "../../state/selectors/axisSelectors.mjs";
4
- import { useAppDispatch as s, useAppSelector as c } from "../../state/hooks.mjs";
5
- import { addYAxis as l, removeYAxis as u } from "../../state/cartesianAxisSlice.mjs";
6
- import { CartesianAxis as d } from "../cartesian-axis/CartesianAxis.mjs";
7
- import { createVNode as f, defineComponent as p, mergeProps as m, watchEffect as h } from "vue";
1
+ import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
2
+ import { selectAxisViewBox } from "../../state/selectors/selectChartOffset.mjs";
3
+ import { implicitYAxis, selectAxisScale, selectTicksOfAxis, selectYAxisPosition, selectYAxisSize } from "../../state/selectors/axisSelectors.mjs";
4
+ import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
5
+ import { addYAxis, removeYAxis } from "../../state/cartesianAxisSlice.mjs";
6
+ import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
7
+ import { createVNode, defineComponent, mergeProps, watchEffect } from "vue";
8
8
  //#region src/cartesian/axis/YAxis.tsx
9
- var g = /* @__PURE__ */ p({
9
+ var YAxisImpl = /* @__PURE__ */ defineComponent({
10
10
  props: { yAxisId: {
11
11
  type: [String, Number],
12
12
  default: 0
13
13
  } },
14
- inheritAttrs: !1,
15
- setup(n, { attrs: s }) {
16
- let l = e(), u = "yAxis", p = c((e) => r(e, u, n.yAxisId, l)), h = c((e) => o(e, n.yAxisId)), g = c((e) => a(e, n.yAxisId)), _ = c((e) => i(e, u, n.yAxisId, l)), v = c(t);
14
+ inheritAttrs: false,
15
+ setup(props, { attrs }) {
16
+ const isPanorama = useIsPanorama();
17
+ const axisType = "yAxis";
18
+ const scale = useAppSelector((state) => selectAxisScale(state, axisType, props.yAxisId, isPanorama));
19
+ const axisSize = useAppSelector((state) => selectYAxisSize(state, props.yAxisId));
20
+ const position = useAppSelector((state) => selectYAxisPosition(state, props.yAxisId));
21
+ const cartesianTickItems = useAppSelector((state) => selectTicksOfAxis(state, axisType, props.yAxisId, isPanorama));
22
+ const viewBox = useAppSelector(selectAxisViewBox);
17
23
  return () => {
18
- let { ...e } = n;
19
- return h.value == null || g.value == null ? null : f(d, m(e, s, {
20
- viewBox: v.value,
21
- scale: p.value,
22
- x: g.value?.x,
23
- y: g.value?.y,
24
- width: h.value?.width,
25
- height: h.value?.height,
26
- ticks: _.value,
27
- class: ["v-charts-yAxis yAxis", s.class]
24
+ const { ...allOtherProps } = props;
25
+ if (axisSize.value == null || position.value == null) return null;
26
+ return createVNode(CartesianAxis, mergeProps(allOtherProps, attrs, {
27
+ "viewBox": viewBox.value,
28
+ "scale": scale.value,
29
+ "x": position.value?.x,
30
+ "y": position.value?.y,
31
+ "width": axisSize.value?.width,
32
+ "height": axisSize.value?.height,
33
+ "ticks": cartesianTickItems.value,
34
+ "class": ["v-charts-yAxis yAxis", attrs.class]
28
35
  }), null);
29
36
  };
30
37
  }
31
- }), _ = /* @__PURE__ */ p({
38
+ });
39
+ var YAxisSettingsDispatcher = /* @__PURE__ */ defineComponent({
32
40
  props: {
33
41
  interval: [String, Number],
34
42
  yAxisId: {
@@ -55,7 +63,7 @@ var g = /* @__PURE__ */ p({
55
63
  minTickGap: Number,
56
64
  tick: {
57
65
  type: [Boolean, Object],
58
- default: !0
66
+ default: true
59
67
  },
60
68
  tickFormatter: Function,
61
69
  domain: Array,
@@ -68,74 +76,77 @@ var g = /* @__PURE__ */ p({
68
76
  default: void 0
69
77
  }
70
78
  },
71
- setup(e) {
72
- let t = s();
73
- return h((n) => {
74
- let r = {
75
- ...e,
76
- interval: e.interval ?? "preserveEnd",
77
- id: e.yAxisId,
78
- dataKey: e.dataKey,
79
- includeHidden: e.includeHidden ?? !1,
80
- angle: e.angle ?? 0,
81
- minTickGap: e.minTickGap ?? 5,
82
- tick: e.tick ?? !0
79
+ setup(props) {
80
+ const dispatch = useAppDispatch();
81
+ watchEffect((onCleanup) => {
82
+ const settings = {
83
+ ...props,
84
+ interval: props.interval ?? "preserveEnd",
85
+ id: props.yAxisId,
86
+ dataKey: props.dataKey,
87
+ includeHidden: props.includeHidden ?? false,
88
+ angle: props.angle ?? 0,
89
+ minTickGap: props.minTickGap ?? 5,
90
+ tick: props.tick ?? true
83
91
  };
84
- t(l(r)), n(() => {
85
- t(u(r));
92
+ dispatch(addYAxis(settings));
93
+ onCleanup(() => {
94
+ dispatch(removeYAxis(settings));
86
95
  });
87
- }), () => f(g, e, null);
96
+ });
97
+ return () => createVNode(YAxisImpl, props, null);
88
98
  }
89
- }), v = /* @__PURE__ */ p({
99
+ });
100
+ var YAxis = /* @__PURE__ */ defineComponent({
90
101
  name: "YAxis",
91
102
  props: {
92
103
  allowDataOverflow: {
93
104
  type: Boolean,
94
- default: n.allowDataOverflow
105
+ default: implicitYAxis.allowDataOverflow
95
106
  },
96
107
  allowDecimals: {
97
108
  type: Boolean,
98
- default: n.allowDecimals
109
+ default: implicitYAxis.allowDecimals
99
110
  },
100
111
  allowDuplicatedCategory: {
101
112
  type: Boolean,
102
- default: n.allowDuplicatedCategory
113
+ default: implicitYAxis.allowDuplicatedCategory
103
114
  },
104
115
  width: {
105
116
  type: Number,
106
- default: n.width
117
+ default: implicitYAxis.width
107
118
  },
108
119
  hide: {
109
120
  type: Boolean,
110
- default: !1
121
+ default: false
111
122
  },
112
123
  mirror: {
113
124
  type: Boolean,
114
- default: n.mirror
125
+ default: implicitYAxis.mirror
115
126
  },
116
127
  orientation: {
117
128
  type: String,
118
- default: n.orientation
129
+ default: implicitYAxis.orientation
119
130
  },
120
131
  padding: {
121
132
  type: Object,
122
- default: n.padding
133
+ default: implicitYAxis.padding
123
134
  },
124
135
  reversed: {
125
136
  type: Boolean,
126
- default: n.reversed
137
+ default: implicitYAxis.reversed
127
138
  },
128
139
  scale: {
129
140
  type: [String, Function],
130
- default: n.scale
141
+ default: implicitYAxis.scale
131
142
  },
132
143
  tickCount: {
133
144
  type: Number,
134
- default: n.tickCount
145
+ default: implicitYAxis.tickCount
135
146
  },
136
147
  type: {
137
148
  type: String,
138
- default: n.type
149
+ default: implicitYAxis.type
139
150
  },
140
151
  yAxisId: { type: [String, Number] },
141
152
  dataKey: {
@@ -161,11 +172,11 @@ var g = /* @__PURE__ */ p({
161
172
  },
162
173
  axisLine: {
163
174
  type: [Boolean, Object],
164
- default: !0
175
+ default: true
165
176
  },
166
177
  tickLine: {
167
178
  type: [Boolean, Object],
168
- default: !0
179
+ default: true
169
180
  },
170
181
  tickMargin: Number,
171
182
  minTickGap: {
@@ -173,9 +184,9 @@ var g = /* @__PURE__ */ p({
173
184
  default: 5
174
185
  }
175
186
  },
176
- setup(e, { attrs: t }) {
177
- return () => f(_, m(e, t), null);
187
+ setup(props, { attrs }) {
188
+ return () => createVNode(YAxisSettingsDispatcher, mergeProps(props, attrs), null);
178
189
  }
179
190
  });
180
191
  //#endregion
181
- export { v as YAxis };
192
+ export { YAxis };