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,6 +1,9 @@
1
- import { createVNode as e, defineComponent as t, mergeProps as n } from "vue";
1
+ import { createVNode, defineComponent, mergeProps } from "vue";
2
2
  //#region src/shape/Rectangle.tsx
3
- var r = {
3
+ /**
4
+ * @fileOverview Rectangle
5
+ */
6
+ var RectangleVueProps = {
4
7
  className: {
5
8
  type: String,
6
9
  default: void 0
@@ -26,43 +29,55 @@ var r = {
26
29
  default: void 0
27
30
  }
28
31
  };
29
- function i(e, t, n, r, i) {
30
- let a = Math.min(Math.abs(n) / 2, Math.abs(r) / 2), o = r >= 0 ? 1 : -1, s = n >= 0 ? 1 : -1, c = r >= 0 && n >= 0 || r < 0 && n < 0 ? 1 : 0;
31
- if (a > 0 && Array.isArray(i)) {
32
- let l = [
32
+ function getRectanglePath(x, y, width, height, radius) {
33
+ const maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2);
34
+ const ySign = height >= 0 ? 1 : -1;
35
+ const xSign = width >= 0 ? 1 : -1;
36
+ const clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0;
37
+ if (maxRadius > 0 && Array.isArray(radius)) {
38
+ const newRadius = [
33
39
  0,
34
40
  0,
35
41
  0,
36
42
  0
37
43
  ];
38
- for (let e = 0; e < 4; e++) {
39
- let t = i[e] ?? 0;
40
- l[e] = t > a ? a : t;
44
+ for (let i = 0; i < 4; i++) {
45
+ const r = radius[i] ?? 0;
46
+ newRadius[i] = r > maxRadius ? maxRadius : r;
41
47
  }
42
- let u = `M${e},${t + o * l[0]}`;
43
- return l[0] > 0 && (u += `A ${l[0]},${l[0]},0,0,${c},${e + s * l[0]},${t}`), u += `L ${e + n - s * l[1]},${t}`, l[1] > 0 && (u += `A ${l[1]},${l[1]},0,0,${c},${e + n},${t + o * l[1]}`), u += `L ${e + n},${t + r - o * l[2]}`, l[2] > 0 && (u += `A ${l[2]},${l[2]},0,0,${c},${e + n - s * l[2]},${t + r}`), u += `L ${e + s * l[3]},${t + r}`, l[3] > 0 && (u += `A ${l[3]},${l[3]},0,0,${c},${e},${t + r - o * l[3]}`), u += "Z", u;
48
+ let path = `M${x},${y + ySign * newRadius[0]}`;
49
+ if (newRadius[0] > 0) path += `A ${newRadius[0]},${newRadius[0]},0,0,${clockWise},${x + xSign * newRadius[0]},${y}`;
50
+ path += `L ${x + width - xSign * newRadius[1]},${y}`;
51
+ if (newRadius[1] > 0) path += `A ${newRadius[1]},${newRadius[1]},0,0,${clockWise},${x + width},${y + ySign * newRadius[1]}`;
52
+ path += `L ${x + width},${y + height - ySign * newRadius[2]}`;
53
+ if (newRadius[2] > 0) path += `A ${newRadius[2]},${newRadius[2]},0,0,${clockWise},${x + width - xSign * newRadius[2]},${y + height}`;
54
+ path += `L ${x + xSign * newRadius[3]},${y + height}`;
55
+ if (newRadius[3] > 0) path += `A ${newRadius[3]},${newRadius[3]},0,0,${clockWise},${x},${y + height - ySign * newRadius[3]}`;
56
+ path += "Z";
57
+ return path;
44
58
  }
45
- if (a > 0 && typeof i == "number" && i > 0) {
46
- let l = Math.min(a, i);
47
- return `M ${e},${t + o * l}A ${l},${l},0,0,${c},${e + s * l},${t}L ${e + n - s * l},${t}A ${l},${l},0,0,${c},${e + n},${t + o * l}L ${e + n},${t + r - o * l}A ${l},${l},0,0,${c},${e + n - s * l},${t + r}L ${e + s * l},${t + r}A ${l},${l},0,0,${c},${e},${t + r - o * l} Z`;
59
+ if (maxRadius > 0 && typeof radius === "number" && radius > 0) {
60
+ const r = Math.min(maxRadius, radius);
61
+ return `M ${x},${y + ySign * r}A ${r},${r},0,0,${clockWise},${x + xSign * r},${y}L ${x + width - xSign * r},${y}A ${r},${r},0,0,${clockWise},${x + width},${y + ySign * r}L ${x + width},${y + height - ySign * r}A ${r},${r},0,0,${clockWise},${x + width - xSign * r},${y + height}L ${x + xSign * r},${y + height}A ${r},${r},0,0,${clockWise},${x},${y + height - ySign * r} Z`;
48
62
  }
49
- return `M ${e},${t} h ${n} v ${r} h ${-n} Z`;
63
+ return `M ${x},${y} h ${width} v ${height} h ${-width} Z`;
50
64
  }
51
- var a = /* @__PURE__ */ t({
65
+ var Rectangle = /* @__PURE__ */ defineComponent({
52
66
  name: "Rectangle",
53
- props: r,
54
- setup(t, { attrs: r }) {
67
+ props: RectangleVueProps,
68
+ setup(props, { attrs }) {
55
69
  return () => {
56
- let { x: a, y: o, width: s, height: c, radius: l } = t;
57
- return a !== +a || o !== +o || s !== +s || c !== +c || s === 0 || c === 0 ? null : e("path", n(r, {
58
- x: a,
59
- y: o,
60
- width: s,
61
- height: c,
62
- d: i(a, o, s, c, l)
70
+ const { x, y, width, height, radius } = props;
71
+ if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) return null;
72
+ return createVNode("path", mergeProps(attrs, {
73
+ "x": x,
74
+ "y": y,
75
+ "width": width,
76
+ "height": height,
77
+ "d": getRectanglePath(x, y, width, height, radius)
63
78
  }), null);
64
79
  };
65
80
  }
66
81
  });
67
82
  //#endregion
68
- export { a as Rectangle };
83
+ export { Rectangle };
@@ -1,8 +1,11 @@
1
- import { RADIAN as e, polarToCartesian as t } from "../utils/polar.mjs";
2
- import { getPercentValue as n, mathSign as r } from "../utils/data.mjs";
3
- import { createVNode as i, defineComponent as a, mergeProps as o } from "vue";
1
+ import { RADIAN, polarToCartesian } from "../utils/polar.mjs";
2
+ import { getPercentValue, mathSign } from "../utils/data.mjs";
3
+ import { createVNode, defineComponent, mergeProps } from "vue";
4
4
  //#region src/shape/Sector.tsx
5
- var s = {
5
+ /**
6
+ * @fileOverview Sector - SVG arc path shape for pie/donut chart segments
7
+ */
8
+ var SectorVueProps = {
6
9
  cx: {
7
10
  type: Number,
8
11
  default: 0
@@ -33,96 +36,121 @@ var s = {
33
36
  },
34
37
  forceCornerRadius: {
35
38
  type: Boolean,
36
- default: !1
39
+ default: false
37
40
  },
38
41
  cornerIsExternal: {
39
42
  type: Boolean,
40
- default: !1
43
+ default: false
41
44
  },
42
45
  className: {
43
46
  type: String,
44
47
  default: void 0
45
48
  }
46
49
  };
47
- function c(e, t) {
48
- return r(t - e) * Math.min(Math.abs(t - e), 359.999);
50
+ function getDeltaAngle(startAngle, endAngle) {
51
+ return mathSign(endAngle - startAngle) * Math.min(Math.abs(endAngle - startAngle), 359.999);
49
52
  }
50
- function l({ cx: n, cy: r, radius: i, angle: a, sign: o, isExternal: s, cornerRadius: c, cornerIsExternal: l }) {
51
- let u = c * (s ? 1 : -1) + i, d = Math.asin(c / u) / e, f = l ? a : a + o * d, p = t(n, r, u, f), m = t(n, r, i, f), h = l ? a - o * d : a;
53
+ function getTangentCircle({ cx, cy, radius, angle, sign, isExternal, cornerRadius, cornerIsExternal }) {
54
+ const centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;
55
+ const theta = Math.asin(cornerRadius / centerRadius) / RADIAN;
56
+ const centerAngle = cornerIsExternal ? angle : angle + sign * theta;
57
+ const center = polarToCartesian(cx, cy, centerRadius, centerAngle);
58
+ const circleTangency = polarToCartesian(cx, cy, radius, centerAngle);
59
+ const lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;
52
60
  return {
53
- center: p,
54
- circleTangency: m,
55
- lineTangency: t(n, r, u * Math.cos(d * e), h),
56
- theta: d
61
+ center,
62
+ circleTangency,
63
+ lineTangency: polarToCartesian(cx, cy, centerRadius * Math.cos(theta * RADIAN), lineTangencyAngle),
64
+ theta
57
65
  };
58
66
  }
59
- function u(e, n, r, i, a, o) {
60
- let s = c(a, o), l = a + s, u = t(e, n, i, a), d = t(e, n, i, l), f = +(Math.abs(s) > 180), p = +(a > l), m = `M ${u.x},${u.y} A ${i},${i},0,${f},${p},${d.x},${d.y}`;
61
- if (r > 0) {
62
- let i = t(e, n, r, a), o = t(e, n, r, l), s = +(a <= l);
63
- m += ` L ${o.x},${o.y} A ${r},${r},0,${f},${s},${i.x},${i.y} Z`;
64
- } else m += ` L ${e},${n} Z`;
65
- return m;
67
+ function getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle) {
68
+ const angle = getDeltaAngle(startAngle, endAngle);
69
+ const tempEndAngle = startAngle + angle;
70
+ const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle);
71
+ const outerEnd = polarToCartesian(cx, cy, outerRadius, tempEndAngle);
72
+ const largeArcFlag = +(Math.abs(angle) > 180);
73
+ const sweepOuter = +(startAngle > tempEndAngle);
74
+ let path = `M ${outerStart.x},${outerStart.y} A ${outerRadius},${outerRadius},0,${largeArcFlag},${sweepOuter},${outerEnd.x},${outerEnd.y}`;
75
+ if (innerRadius > 0) {
76
+ const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle);
77
+ const innerEnd = polarToCartesian(cx, cy, innerRadius, tempEndAngle);
78
+ const sweepInner = +(startAngle <= tempEndAngle);
79
+ path += ` L ${innerEnd.x},${innerEnd.y} A ${innerRadius},${innerRadius},0,${largeArcFlag},${sweepInner},${innerStart.x},${innerStart.y} Z`;
80
+ } else path += ` L ${cx},${cy} Z`;
81
+ return path;
66
82
  }
67
- function d(e, t, n, i, a, o, s, c, d) {
68
- let f = r(d - c), { circleTangency: p, lineTangency: m, theta: h } = l({
69
- cx: e,
70
- cy: t,
71
- radius: i,
72
- angle: c,
73
- sign: f,
74
- cornerRadius: a,
75
- cornerIsExternal: s
76
- }), { circleTangency: g, lineTangency: _, theta: v } = l({
77
- cx: e,
78
- cy: t,
79
- radius: i,
80
- angle: d,
81
- sign: -f,
82
- cornerRadius: a,
83
- cornerIsExternal: s
84
- }), y = s ? Math.abs(c - d) : Math.abs(c - d) - h - v;
85
- if (y < 0) return o ? `M ${m.x},${m.y} a${a},${a},0,0,1,${a * 2},0 a${a},${a},0,0,1,${-a * 2},0` : u(e, t, n, i, c, d);
86
- let b = `M ${m.x},${m.y} A${a},${a},0,0,${+(f < 0)},${p.x},${p.y} A${i},${i},0,${+(y > 180)},${+(f < 0)},${g.x},${g.y} A${a},${a},0,0,${+(f < 0)},${_.x},${_.y}`;
87
- if (n > 0) {
88
- let { circleTangency: r, lineTangency: i, theta: o } = l({
89
- cx: e,
90
- cy: t,
91
- radius: n,
92
- angle: c,
93
- sign: f,
94
- isExternal: !0,
95
- cornerRadius: a,
96
- cornerIsExternal: s
97
- }), { circleTangency: u, lineTangency: p, theta: m } = l({
98
- cx: e,
99
- cy: t,
100
- radius: n,
101
- angle: d,
102
- sign: -f,
103
- isExternal: !0,
104
- cornerRadius: a,
105
- cornerIsExternal: s
106
- }), h = s ? Math.abs(c - d) : Math.abs(c - d) - o - m;
107
- if (h < 0 && a === 0) return `${b}L${e},${t}Z`;
108
- b += `L${p.x},${p.y} A${a},${a},0,0,${+(f < 0)},${u.x},${u.y} A${n},${n},0,${+(h > 180)},${+(f > 0)},${r.x},${r.y} A${a},${a},0,0,${+(f < 0)},${i.x},${i.y}Z`;
109
- } else b += `L${e},${t}Z`;
110
- return b;
83
+ function getSectorWithCorner(cx, cy, innerRadius, outerRadius, cornerRadius, forceCornerRadius, cornerIsExternal, startAngle, endAngle) {
84
+ const sign = mathSign(endAngle - startAngle);
85
+ const { circleTangency: soct, lineTangency: solt, theta: sot } = getTangentCircle({
86
+ cx,
87
+ cy,
88
+ radius: outerRadius,
89
+ angle: startAngle,
90
+ sign,
91
+ cornerRadius,
92
+ cornerIsExternal
93
+ });
94
+ const { circleTangency: eoct, lineTangency: eolt, theta: eot } = getTangentCircle({
95
+ cx,
96
+ cy,
97
+ radius: outerRadius,
98
+ angle: endAngle,
99
+ sign: -sign,
100
+ cornerRadius,
101
+ cornerIsExternal
102
+ });
103
+ const outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot;
104
+ if (outerArcAngle < 0) {
105
+ if (forceCornerRadius) return `M ${solt.x},${solt.y} a${cornerRadius},${cornerRadius},0,0,1,${cornerRadius * 2},0 a${cornerRadius},${cornerRadius},0,0,1,${-cornerRadius * 2},0`;
106
+ return getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle);
107
+ }
108
+ let path = `M ${solt.x},${solt.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${soct.x},${soct.y} A${outerRadius},${outerRadius},0,${+(outerArcAngle > 180)},${+(sign < 0)},${eoct.x},${eoct.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${eolt.x},${eolt.y}`;
109
+ if (innerRadius > 0) {
110
+ const { circleTangency: sict, lineTangency: silt, theta: sit } = getTangentCircle({
111
+ cx,
112
+ cy,
113
+ radius: innerRadius,
114
+ angle: startAngle,
115
+ sign,
116
+ isExternal: true,
117
+ cornerRadius,
118
+ cornerIsExternal
119
+ });
120
+ const { circleTangency: eict, lineTangency: eilt, theta: eit } = getTangentCircle({
121
+ cx,
122
+ cy,
123
+ radius: innerRadius,
124
+ angle: endAngle,
125
+ sign: -sign,
126
+ isExternal: true,
127
+ cornerRadius,
128
+ cornerIsExternal
129
+ });
130
+ const innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit;
131
+ if (innerArcAngle < 0 && cornerRadius === 0) return `${path}L${cx},${cy}Z`;
132
+ path += `L${eilt.x},${eilt.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${eict.x},${eict.y} A${innerRadius},${innerRadius},0,${+(innerArcAngle > 180)},${+(sign > 0)},${sict.x},${sict.y} A${cornerRadius},${cornerRadius},0,0,${+(sign < 0)},${silt.x},${silt.y}Z`;
133
+ } else path += `L${cx},${cy}Z`;
134
+ return path;
111
135
  }
112
- var f = /* @__PURE__ */ a({
136
+ var Sector = /* @__PURE__ */ defineComponent({
113
137
  name: "Sector",
114
- props: s,
115
- setup(e, { attrs: t }) {
138
+ props: SectorVueProps,
139
+ setup(props, { attrs }) {
116
140
  return () => {
117
- let { cx: r, cy: a, innerRadius: s, outerRadius: c, startAngle: l, endAngle: f, cornerRadius: p, forceCornerRadius: m, cornerIsExternal: h, className: g } = e;
118
- if (c <= 0 || c < s || l === f) return null;
119
- let _ = c - s, v = n(p, _, 0, !0), y;
120
- return y = v > 0 && Math.abs(l - f) < 360 ? d(r, a, s, c, Math.min(v, _ / 2), m, h, l, f) : u(r, a, s, c, l, f), i("path", o(t, {
121
- class: ["v-charts-sector", g],
122
- d: y
141
+ const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, cornerRadius, forceCornerRadius, cornerIsExternal, className } = props;
142
+ if (outerRadius <= 0 || outerRadius < innerRadius || startAngle === endAngle) return null;
143
+ const deltaRadius = outerRadius - innerRadius;
144
+ const cr = getPercentValue(cornerRadius, deltaRadius, 0, true);
145
+ let path;
146
+ if (cr > 0 && Math.abs(startAngle - endAngle) < 360) path = getSectorWithCorner(cx, cy, innerRadius, outerRadius, Math.min(cr, deltaRadius / 2), forceCornerRadius, cornerIsExternal, startAngle, endAngle);
147
+ else path = getSectorPath(cx, cy, innerRadius, outerRadius, startAngle, endAngle);
148
+ return createVNode("path", mergeProps(attrs, {
149
+ "class": ["v-charts-sector", className],
150
+ "d": path
123
151
  }), null);
124
152
  };
125
153
  }
126
154
  });
127
155
  //#endregion
128
- export { f as Sector };
156
+ export { Sector };
@@ -1,41 +1,52 @@
1
- import { isNumber as e } from "../utils/validate.mjs";
2
- import { createVNode as t, mergeProps as n } from "vue";
3
- import { symbol as r, symbolCircle as i, symbolCross as a, symbolDiamond as o, symbolSquare as s, symbolStar as c, symbolTriangle as l, symbolWye as u } from "victory-vendor/d3-shape";
4
- import { upperFirst as d } from "es-toolkit/compat";
1
+ import { isNumber } from "../utils/validate.mjs";
2
+ import { createVNode, mergeProps } from "vue";
3
+ import { symbol, symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye } from "victory-vendor/d3-shape";
4
+ import { upperFirst } from "es-toolkit/compat";
5
5
  //#region src/shape/Symbols.tsx
6
- var f = {
7
- symbolCircle: i,
8
- symbolCross: a,
9
- symbolDiamond: o,
10
- symbolSquare: s,
11
- symbolStar: c,
12
- symbolTriangle: l,
13
- symbolWye: u
14
- }, p = Math.PI / 180, m = (e) => f[`symbol${d(e)}`] || i, h = (e, t, n) => {
15
- if (t === "area") return e;
16
- switch (n) {
17
- case "cross": return 5 * e * e / 9;
18
- case "diamond": return .5 * e * e / Math.sqrt(3);
19
- case "square": return e * e;
6
+ var symbolFactories = {
7
+ symbolCircle,
8
+ symbolCross,
9
+ symbolDiamond,
10
+ symbolSquare,
11
+ symbolStar,
12
+ symbolTriangle,
13
+ symbolWye
14
+ };
15
+ var RADIAN = Math.PI / 180;
16
+ var getSymbolFactory = (type) => {
17
+ return symbolFactories[`symbol${upperFirst(type)}`] || symbolCircle;
18
+ };
19
+ var calculateAreaSize = (size, sizeType, type) => {
20
+ if (sizeType === "area") return size;
21
+ switch (type) {
22
+ case "cross": return 5 * size * size / 9;
23
+ case "diamond": return .5 * size * size / Math.sqrt(3);
24
+ case "square": return size * size;
20
25
  case "star": {
21
- let t = 18 * p;
22
- return 1.25 * e * e * (Math.tan(t) - Math.tan(t * 2) * Math.tan(t) ** 2);
26
+ const angle = 18 * RADIAN;
27
+ return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.tan(angle) ** 2);
23
28
  }
24
- case "triangle": return Math.sqrt(3) * e * e / 4;
25
- case "wye": return (21 - 10 * Math.sqrt(3)) * e * e / 8;
26
- default: return Math.PI * e * e / 4;
29
+ case "triangle": return Math.sqrt(3) * size * size / 4;
30
+ case "wye": return (21 - 10 * Math.sqrt(3)) * size * size / 8;
31
+ default: return Math.PI * size * size / 4;
27
32
  }
28
33
  };
29
- function g(i) {
30
- let { type: a = "circle", size: o = 64, sizeType: s = "area", cx: c, cy: l, className: u, ...d } = i, f = "circle";
31
- return typeof a == "string" && (f = a), e(c) && e(l) && e(o) ? t("path", n(d, {
32
- class: ["v-charts-symbols", u].filter(Boolean).join(" "),
33
- transform: `translate(${c}, ${l})`,
34
- d: (() => {
35
- let e = m(f), t = r().type(e).size(h(o, s, f))();
36
- if (t !== null) return t;
37
- })()
38
- }), null) : null;
34
+ function Symbols(props) {
35
+ const { type = "circle", size = 64, sizeType = "area", cx, cy, className, ...rest } = props;
36
+ let realType = "circle";
37
+ if (typeof type === "string") realType = type;
38
+ const getPath = () => {
39
+ const symbolFactory = getSymbolFactory(realType);
40
+ const s = symbol().type(symbolFactory).size(calculateAreaSize(size, sizeType, realType))();
41
+ if (s === null) return;
42
+ return s;
43
+ };
44
+ if (isNumber(cx) && isNumber(cy) && isNumber(size)) return createVNode("path", mergeProps(rest, {
45
+ "class": ["v-charts-symbols", className].filter(Boolean).join(" "),
46
+ "transform": `translate(${cx}, ${cy})`,
47
+ "d": getPath()
48
+ }), null);
49
+ return null;
39
50
  }
40
51
  //#endregion
41
- export { g as Symbols };
52
+ export { Symbols };
@@ -0,0 +1,52 @@
1
+ import { createVNode, defineComponent, mergeProps } from "vue";
2
+ //#region src/shape/Trapezoid.tsx
3
+ var TrapezoidVueProps = {
4
+ className: {
5
+ type: String,
6
+ default: void 0
7
+ },
8
+ x: {
9
+ type: Number,
10
+ default: 0
11
+ },
12
+ y: {
13
+ type: Number,
14
+ default: 0
15
+ },
16
+ upperWidth: {
17
+ type: Number,
18
+ default: 0
19
+ },
20
+ lowerWidth: {
21
+ type: Number,
22
+ default: 0
23
+ },
24
+ height: {
25
+ type: Number,
26
+ default: 0
27
+ }
28
+ };
29
+ function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) {
30
+ const upperLeft = x;
31
+ const upperRight = x + upperWidth;
32
+ const lowerLeft = x + (upperWidth - lowerWidth) / 2;
33
+ const lowerRight = x + (upperWidth + lowerWidth) / 2;
34
+ const bottom = y + height;
35
+ return `M ${upperLeft},${y} L ${upperRight},${y} L ${lowerRight},${bottom} L ${lowerLeft},${bottom} Z`;
36
+ }
37
+ var Trapezoid = /* @__PURE__ */ defineComponent({
38
+ name: "Trapezoid",
39
+ props: TrapezoidVueProps,
40
+ setup(props, { attrs }) {
41
+ return () => {
42
+ const { x, y, upperWidth, lowerWidth, height, className } = props;
43
+ if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || height === 0) return null;
44
+ return createVNode("path", mergeProps(attrs, {
45
+ "class": ["v-charts-trapezoid", className],
46
+ "d": getTrapezoidPath(x, y, upperWidth, lowerWidth, height)
47
+ }), null);
48
+ };
49
+ }
50
+ });
51
+ //#endregion
52
+ export { Trapezoid };
@@ -1,13 +1,13 @@
1
- import { useAppDispatch as e } from "./hooks.mjs";
2
- import { updateOptions as t } from "./rootPropsSlice.mjs";
3
- import { defineComponent as n, watchEffect as r } from "vue";
1
+ import { useAppDispatch } from "./hooks.mjs";
2
+ import { updateOptions } from "./rootPropsSlice.mjs";
3
+ import { defineComponent, watchEffect } from "vue";
4
4
  //#region src/state/ReportChartProps.tsx
5
- var i = /* @__PURE__ */ n({
5
+ var ReportChartProps_default = /* @__PURE__ */ defineComponent({
6
6
  name: "ReportChartProps",
7
7
  props: {
8
8
  accessibilityLayer: {
9
9
  type: Boolean,
10
- default: !0
10
+ default: true
11
11
  },
12
12
  barCategoryGap: {
13
13
  type: [Number, String],
@@ -42,22 +42,23 @@ var i = /* @__PURE__ */ n({
42
42
  default: "index"
43
43
  }
44
44
  },
45
- setup(n) {
46
- let i = e();
47
- return r(() => {
48
- i(t({
49
- accessibilityLayer: n.accessibilityLayer,
50
- barCategoryGap: n.barCategoryGap,
51
- barGap: n.barGap,
52
- barSize: n.barSize,
53
- class: n.class,
54
- maxBarSize: n.maxBarSize,
55
- stackOffset: n.stackOffset,
56
- syncId: n.syncId,
57
- syncMethod: n.syncMethod
45
+ setup(props) {
46
+ const dispatch = useAppDispatch();
47
+ watchEffect(() => {
48
+ dispatch(updateOptions({
49
+ accessibilityLayer: props.accessibilityLayer,
50
+ barCategoryGap: props.barCategoryGap,
51
+ barGap: props.barGap,
52
+ barSize: props.barSize,
53
+ class: props.class,
54
+ maxBarSize: props.maxBarSize,
55
+ stackOffset: props.stackOffset,
56
+ syncId: props.syncId,
57
+ syncMethod: props.syncMethod
58
58
  }));
59
- }), () => null;
59
+ });
60
+ return () => null;
60
61
  }
61
62
  });
62
63
  //#endregion
63
- export { i as default };
64
+ export { ReportChartProps_default as default };
@@ -1,41 +1,46 @@
1
- import { useAppDispatch as e } from "./hooks.mjs";
2
- import { setChartSize as t, setLayout as n, setMargin as r } from "./layoutSlice.mjs";
3
- import { defineComponent as i, watch as a } from "vue";
1
+ import { useAppDispatch } from "./hooks.mjs";
2
+ import { setChartSize, setLayout, setMargin } from "./layoutSlice.mjs";
3
+ import { defineComponent, watch } from "vue";
4
4
  //#region src/state/ReportMainChartProps.ts
5
- var o = i({
5
+ var ReportMainChartProps = defineComponent({
6
6
  name: "ReportMainChartProps",
7
7
  props: {
8
8
  width: {
9
9
  type: Number,
10
- required: !0
10
+ required: true
11
11
  },
12
12
  height: {
13
13
  type: Number,
14
- required: !0
14
+ required: true
15
15
  },
16
16
  layout: {
17
17
  type: String,
18
- required: !0
18
+ required: true
19
19
  },
20
20
  margin: {
21
21
  type: Object,
22
- required: !0
22
+ required: true
23
23
  }
24
24
  },
25
- setup(i) {
26
- let o = e();
27
- return a([
28
- () => i.width,
29
- () => i.height,
30
- () => i.layout,
31
- () => i.margin
25
+ setup(props) {
26
+ const dispatch = useAppDispatch();
27
+ watch([
28
+ () => props.width,
29
+ () => props.height,
30
+ () => props.layout,
31
+ () => props.margin
32
32
  ], () => {
33
- o(n(i.layout)), o(t({
34
- width: i.width,
35
- height: i.height
36
- })), o(r(i.margin));
37
- }, { immediate: !0 }), () => null;
33
+ dispatch(setLayout(props.layout));
34
+ dispatch(setChartSize({
35
+ width: props.width,
36
+ height: props.height
37
+ }));
38
+ dispatch(setMargin(props.margin));
39
+ }, { immediate: true });
40
+ return () => {
41
+ return null;
42
+ };
38
43
  }
39
44
  });
40
45
  //#endregion
41
- export { o as ReportMainChartProps };
46
+ export { ReportMainChartProps };
@@ -1,8 +1,8 @@
1
- import { useAppDispatch as e } from "./hooks.mjs";
2
- import { updatePolarOptions as t } from "./polarOptionsSlice.mjs";
3
- import { defineComponent as n, watch as r } from "vue";
1
+ import { useAppDispatch } from "./hooks.mjs";
2
+ import { updatePolarOptions } from "./polarOptionsSlice.mjs";
3
+ import { defineComponent, watch } from "vue";
4
4
  //#region src/state/ReportPolarOptions.tsx
5
- var i = /* @__PURE__ */ n({
5
+ var ReportPolarOptions = /* @__PURE__ */ defineComponent({
6
6
  name: "ReportPolarOptions",
7
7
  props: {
8
8
  cx: {
@@ -30,26 +30,27 @@ var i = /* @__PURE__ */ n({
30
30
  default: "80%"
31
31
  }
32
32
  },
33
- setup(n) {
34
- let i = e();
35
- return r([
36
- () => n.cx,
37
- () => n.cy,
38
- () => n.startAngle,
39
- () => n.endAngle,
40
- () => n.innerRadius,
41
- () => n.outerRadius
33
+ setup(props) {
34
+ const dispatch = useAppDispatch();
35
+ watch([
36
+ () => props.cx,
37
+ () => props.cy,
38
+ () => props.startAngle,
39
+ () => props.endAngle,
40
+ () => props.innerRadius,
41
+ () => props.outerRadius
42
42
  ], () => {
43
- i(t({
44
- cx: n.cx,
45
- cy: n.cy,
46
- startAngle: n.startAngle,
47
- endAngle: n.endAngle,
48
- innerRadius: n.innerRadius,
49
- outerRadius: n.outerRadius
43
+ dispatch(updatePolarOptions({
44
+ cx: props.cx,
45
+ cy: props.cy,
46
+ startAngle: props.startAngle,
47
+ endAngle: props.endAngle,
48
+ innerRadius: props.innerRadius,
49
+ outerRadius: props.outerRadius
50
50
  }));
51
- }, { immediate: !0 }), () => null;
51
+ }, { immediate: true });
52
+ return () => null;
52
53
  }
53
54
  });
54
55
  //#endregion
55
- export { i as ReportPolarOptions };
56
+ export { ReportPolarOptions };