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,27 +1,29 @@
1
- import { validateWidthHeight as e } from "../utils/validate.mjs";
2
- import { provideClipPathId as t } from "./provideClipPathId.mjs";
3
- import { createRechartsStore as n } from "../state/store.mjs";
4
- import r from "./Surface.mjs";
5
- import { ChartDataContextProvider as i } from "../context/ChartDataContextProvider.mjs";
6
- import a from "../container/ClipPath.mjs";
7
- import { RechartsWrapper as o } from "./RechartsWrapper.mjs";
8
- import { FULL_WIDTH_AND_HEIGHT as s } from "./const.mjs";
9
- import { ReportMainChartProps as c } from "../state/ReportMainChartProps.mjs";
10
- import l from "../state/ReportChartProps.mjs";
11
- import { applyDefaultProps as u } from "../utils/props.mjs";
12
- import { ReportPolarOptions as d } from "../state/ReportPolarOptions.mjs";
13
- import { Fragment as f, createVNode as p, defineComponent as m, mergeProps as h } from "vue";
14
- import { provideStore as g } from "@reduxjs/vue-redux";
1
+ import { validateWidthHeight } from "../utils/validate.mjs";
2
+ import { provideClipPathId } from "./provideClipPathId.mjs";
3
+ import { createRechartsStore } from "../state/store.mjs";
4
+ import Surface_default from "./Surface.mjs";
5
+ import { ChartDataContextProvider } from "../context/ChartDataContextProvider.mjs";
6
+ import ClipPath_default from "../container/ClipPath.mjs";
7
+ import { RechartsWrapper } from "./RechartsWrapper.mjs";
8
+ import { FULL_WIDTH_AND_HEIGHT } from "./const.mjs";
9
+ import { ReportMainChartProps } from "../state/ReportMainChartProps.mjs";
10
+ import ReportChartProps_default from "../state/ReportChartProps.mjs";
11
+ import { applyDefaultProps } from "../utils/props.mjs";
12
+ import { ReportPolarOptions } from "../state/ReportPolarOptions.mjs";
13
+ import { Fragment, createVNode, defineComponent, mergeProps } from "vue";
14
+ import { provideStore } from "@reduxjs/vue-redux";
15
15
  //#region src/chart/generateCategoricalChart.tsx
16
- var _ = "horizontal", v = {
16
+ var defaultLayout = "horizontal";
17
+ var defaultMargin = {
17
18
  top: 5,
18
19
  right: 5,
19
20
  bottom: 5,
20
21
  left: 5
21
- }, y = {
22
+ };
23
+ var CategoricalProps = {
22
24
  accessibilityLayer: {
23
25
  type: Boolean,
24
- default: !0
26
+ default: true
25
27
  },
26
28
  barCategoryGap: {
27
29
  type: [Number, String],
@@ -52,17 +54,17 @@ var _ = "horizontal", v = {
52
54
  innerRadius: { type: [Number, String] },
53
55
  layout: {
54
56
  type: String,
55
- default: _
57
+ default: defaultLayout
56
58
  },
57
59
  margin: {
58
60
  type: Object,
59
- default: () => v
61
+ default: () => defaultMargin
60
62
  },
61
63
  maxBarSize: { type: Number },
62
64
  outerRadius: { type: [Number, String] },
63
65
  reverseStackOrder: {
64
66
  type: Boolean,
65
- default: !1
67
+ default: false
66
68
  },
67
69
  role: { type: String },
68
70
  stackOffset: {
@@ -82,85 +84,92 @@ var _ = "horizontal", v = {
82
84
  width: { type: Number },
83
85
  to: { type: [String, Object] }
84
86
  };
85
- function b({ chartName: b, defaultProps: x = {}, defaultTooltipEventType: S = "axis", validateTooltipEventTypes: C = ["axis"], tooltipPayloadSearcher: w }) {
86
- return /* @__PURE__ */ m({
87
- name: b,
88
- props: u(y, x),
89
- setup(u, { attrs: m, slots: y }) {
90
- g({ store: n({ options: {
91
- chartName: b,
92
- defaultTooltipEventType: S,
93
- validateTooltipEventTypes: C,
94
- tooltipPayloadSearcher: w,
87
+ function generateCategoricalChart({ chartName, defaultProps = {}, defaultTooltipEventType = "axis", validateTooltipEventTypes = ["axis"], tooltipPayloadSearcher }) {
88
+ return /* @__PURE__ */ defineComponent({
89
+ name: chartName,
90
+ props: applyDefaultProps(CategoricalProps, defaultProps),
91
+ setup(props, { attrs, slots }) {
92
+ provideStore({ store: createRechartsStore({ options: {
93
+ chartName,
94
+ defaultTooltipEventType,
95
+ validateTooltipEventTypes,
96
+ tooltipPayloadSearcher,
95
97
  eventEmitter: void 0
96
- } }, u.id ?? b) });
97
- let T = t(u);
98
+ } }, props.id ?? chartName) });
99
+ const clipPathId = provideClipPathId(props);
98
100
  return () => {
99
- let { compact: t, width: n, height: g, title: b, desc: S, ...C } = u, w = { ...m };
100
- if (!e({
101
- width: n,
102
- height: g
101
+ const { compact, width, height, title, desc, ...rest } = props;
102
+ const attributes = { ...attrs };
103
+ if (!validateWidthHeight({
104
+ width,
105
+ height
103
106
  })) return null;
104
- let E = u.layout ?? x.layout ?? _, D = E === "centric" || E === "radial";
105
- if (t) return p(f, null, [
106
- p(i, { chartData: u.data }, null),
107
- p(c, {
108
- width: n,
109
- height: g,
110
- layout: E,
111
- margin: u.margin ?? v
107
+ const layout = props.layout ?? defaultProps.layout ?? defaultLayout;
108
+ const isPolarChart = layout === "centric" || layout === "radial";
109
+ if (compact) return createVNode(Fragment, null, [
110
+ createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
111
+ createVNode(ReportMainChartProps, {
112
+ "width": width,
113
+ "height": height,
114
+ "layout": layout,
115
+ "margin": props.margin ?? defaultMargin
112
116
  }, null),
113
- D && p(d, {
114
- cx: u.cx ?? "50%",
115
- cy: u.cy ?? "50%",
116
- startAngle: u.startAngle ?? x.startAngle ?? 90,
117
- endAngle: u.endAngle ?? x.endAngle ?? -270,
118
- innerRadius: u.innerRadius ?? 0,
119
- outerRadius: u.outerRadius ?? "80%"
117
+ isPolarChart && createVNode(ReportPolarOptions, {
118
+ "cx": props.cx ?? "50%",
119
+ "cy": props.cy ?? "50%",
120
+ "startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
121
+ "endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
122
+ "innerRadius": props.innerRadius ?? 0,
123
+ "outerRadius": props.outerRadius ?? "80%"
120
124
  }, null),
121
- p(r, h(m, C, {
122
- width: n,
123
- height: g,
124
- title: b,
125
- desc: S
126
- }), { default: () => [p(a, { clipPathId: T }, null), y.default?.()] })
125
+ createVNode(Surface_default, mergeProps(attrs, rest, {
126
+ "width": width,
127
+ "height": height,
128
+ "title": title,
129
+ "desc": desc
130
+ }), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] })
127
131
  ]);
128
- u.accessibilityLayer && (w.tabIndex = u.tabIndex ?? 0, w.role = u.role ?? "application");
129
- let O = {}, k = {};
130
- for (let [e, t] of Object.entries(w)) e.startsWith("on") && typeof t == "function" ? O[e] = t : k[e] = t;
131
- return p(f, null, [
132
- p(i, { chartData: u.data }, null),
133
- p(c, {
134
- width: n,
135
- height: g,
136
- layout: E,
137
- margin: u.margin ?? v
132
+ if (props.accessibilityLayer) {
133
+ attributes.tabIndex = props.tabIndex ?? 0;
134
+ attributes.role = props.role ?? "application";
135
+ }
136
+ const eventHandlerAttrs = {};
137
+ const svgAttributes = {};
138
+ for (const [key, value] of Object.entries(attributes)) if (key.startsWith("on") && typeof value === "function") eventHandlerAttrs[key] = value;
139
+ else svgAttributes[key] = value;
140
+ return createVNode(Fragment, null, [
141
+ createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
142
+ createVNode(ReportMainChartProps, {
143
+ "width": width,
144
+ "height": height,
145
+ "layout": layout,
146
+ "margin": props.margin ?? defaultMargin
138
147
  }, null),
139
- D && p(d, {
140
- cx: u.cx ?? "50%",
141
- cy: u.cy ?? "50%",
142
- startAngle: u.startAngle ?? x.startAngle ?? 90,
143
- endAngle: u.endAngle ?? x.endAngle ?? -270,
144
- innerRadius: u.innerRadius ?? 0,
145
- outerRadius: u.outerRadius ?? "80%"
148
+ isPolarChart && createVNode(ReportPolarOptions, {
149
+ "cx": props.cx ?? "50%",
150
+ "cy": props.cy ?? "50%",
151
+ "startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
152
+ "endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
153
+ "innerRadius": props.innerRadius ?? 0,
154
+ "outerRadius": props.outerRadius ?? "80%"
146
155
  }, null),
147
- p(o, h({
148
- style: u.style,
149
- class: u.class,
150
- width: n,
151
- height: g
152
- }, O), { default: () => [p(r, h(k, {
153
- width: n,
154
- height: g,
155
- title: b,
156
- desc: S,
157
- style: s
158
- }), { default: () => [p(a, { clipPathId: T }, null), y.default?.()] }), y.tooltip?.()] }),
159
- p(l, u, null)
156
+ createVNode(RechartsWrapper, mergeProps({
157
+ "style": props.style,
158
+ "class": props.class,
159
+ "width": width,
160
+ "height": height
161
+ }, eventHandlerAttrs), { default: () => [createVNode(Surface_default, mergeProps(svgAttributes, {
162
+ "width": width,
163
+ "height": height,
164
+ "title": title,
165
+ "desc": desc,
166
+ "style": FULL_WIDTH_AND_HEIGHT
167
+ }), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] }), slots.tooltip?.()] }),
168
+ createVNode(ReportChartProps_default, props, null)
160
169
  ]);
161
170
  };
162
171
  }
163
172
  });
164
173
  }
165
174
  //#endregion
166
- export { b as generateCategoricalChart };
175
+ export { generateCategoricalChart };
@@ -1,10 +1,15 @@
1
- import { uniqueId as e } from "../utils/data-utils.mjs";
2
- import { createContext as t } from "../utils/createContext.mjs";
1
+ import { uniqueId } from "../utils/data-utils.mjs";
2
+ import { createContext } from "../utils/createContext.mjs";
3
3
  //#region src/chart/provideClipPathId.ts
4
- var [n, r] = t("clipPathId");
5
- function i(t) {
6
- let n = `${t.id ?? e("v-charts")}-clip`;
7
- return r(n), n;
4
+ var [useClipPathId, provideClipPathIdRaw] = createContext("clipPathId");
5
+ /**
6
+ * Provide the clipPathId to child components.
7
+ * @param props - The props object from the chart component
8
+ */
9
+ function provideClipPathId(props) {
10
+ const clipPathId = `${props.id ?? uniqueId("v-charts")}-clip`;
11
+ provideClipPathIdRaw(clipPathId);
12
+ return clipPathId;
8
13
  }
9
14
  //#endregion
10
- export { i as provideClipPathId, n as useClipPathId };
15
+ export { provideClipPathId, useClipPathId };
@@ -1,11 +1,23 @@
1
- import { defineComponent as e } from "vue";
1
+ import { defineComponent } from "vue";
2
2
  //#region src/components/Cell.tsx
3
- var t = /* @__PURE__ */ e({
3
+ /**
4
+ * Cell is a marker component used to define per-item colors and styles.
5
+ * It renders nothing — parent components (Bar, Pie, etc.) read Cell
6
+ * children from the default slot and apply their props by index.
7
+ *
8
+ * Usage:
9
+ * ```vue
10
+ * <Bar data-key="value">
11
+ * <Cell v-for="(entry, index) in data" :key="index" :fill="COLORS[index]" />
12
+ * </Bar>
13
+ * ```
14
+ */
15
+ var Cell = /* @__PURE__ */ defineComponent({
4
16
  name: "Cell",
5
- inheritAttrs: !1,
17
+ inheritAttrs: false,
6
18
  setup() {
7
19
  return () => null;
8
20
  }
9
21
  });
10
22
  //#endregion
11
- export { t as Cell };
23
+ export { Cell };
@@ -1,5 +1,5 @@
1
- import e from "./Text.vue_vue_type_script_setup_true_lang.mjs";
1
+ import Text_vue_vue_type_script_setup_true_lang_default from "./Text.vue_vue_type_script_setup_true_lang.mjs";
2
2
  //#region src/components/Text.vue
3
- var t = e;
3
+ var Text_default = Text_vue_vue_type_script_setup_true_lang_default;
4
4
  //#endregion
5
- export { t as default };
5
+ export { Text_default as default };
@@ -1,14 +1,16 @@
1
- import { getStringSize as e } from "../utils/attrs.mjs";
2
- import { reduceCSSCalc as t } from "../utils/ReduceCSSCalc.mjs";
3
- import { Fragment as n, computed as r, createElementBlock as i, defineComponent as a, normalizeStyle as o, openBlock as s, renderList as c, toDisplayString as l } from "vue";
1
+ import { getStringSize } from "../utils/attrs.mjs";
2
+ import { reduceCSSCalc } from "../utils/ReduceCSSCalc.mjs";
3
+ import { Fragment, computed, createElementBlock, defineComponent, normalizeStyle, openBlock, renderList, toDisplayString } from "vue";
4
4
  //#region src/components/Text.vue?vue&type=script&setup=true&lang.ts
5
- var u = [
5
+ var _hoisted_1 = [
6
6
  "x",
7
7
  "y",
8
8
  "transform",
9
9
  "text-anchor",
10
10
  "fill"
11
- ], d = ["x", "dy"], f = /* @__PURE__ */ a({
11
+ ];
12
+ var _hoisted_2 = ["x", "dy"];
13
+ var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
12
14
  __name: "Text",
13
15
  props: {
14
16
  x: {
@@ -37,7 +39,7 @@ var u = [
37
39
  },
38
40
  scaleToFit: {
39
41
  type: Boolean,
40
- default: !1
42
+ default: false
41
43
  },
42
44
  textAnchor: {
43
45
  type: String,
@@ -61,7 +63,7 @@ var u = [
61
63
  },
62
64
  breakAll: {
63
65
  type: Boolean,
64
- default: !1
66
+ default: false
65
67
  },
66
68
  maxLines: {
67
69
  type: Number,
@@ -76,79 +78,114 @@ var u = [
76
78
  default: ""
77
79
  }
78
80
  },
79
- setup(a) {
80
- let f = a, p = /[ \f\n\r\t\v\u2028\u2029]+/;
81
- function m(t, n, r) {
82
- let i = [];
83
- return t != null && (i = n ? t.toString().split("") : t.toString().split(p)), {
84
- wordsWithComputedWidth: i.map((t) => ({
85
- word: t,
86
- width: e(t, r).width
81
+ setup(__props) {
82
+ const props = __props;
83
+ const BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
84
+ function calculateWordWidths(children, breakAll, style) {
85
+ let words = [];
86
+ if (children !== void 0 && children !== null) words = breakAll ? children.toString().split("") : children.toString().split(BREAKING_SPACES);
87
+ return {
88
+ wordsWithComputedWidth: words.map((word) => ({
89
+ word,
90
+ width: getStringSize(word, style).width
87
91
  })),
88
- spaceWidth: n ? 0 : e("\xA0", r).width
92
+ spaceWidth: breakAll ? 0 : getStringSize("\xA0", style).width
89
93
  };
90
94
  }
91
- function h(e, t, n, r, i, a, o, s) {
92
- let c = typeof e == "number", l = t, u = (e = []) => e.reduce((e, { word: t, width: n }) => {
93
- let r = e[e.length - 1];
94
- return r && (o == null || s || r.width + n + a < Number(o)) ? (r.words.push(t), r.width += n + a) : e.push({
95
- words: [t],
96
- width: n
97
- }), e;
98
- }, []), d = u(i), f = (e) => e.reduce((e, t) => e.width > t.width ? e : t);
99
- if (!c || s || !(d.length > e || f(d).width > Number(o))) return d;
100
- let p = (t) => {
101
- let { wordsWithComputedWidth: i } = m(l.slice(0, t) + "…", r, n), a = u(i);
102
- return [a.length > e || f(a).width > Number(o), a];
103
- }, h = 0, g = l.length - 1, _ = 0, v;
104
- for (; h <= g && _ <= l.length - 1;) {
105
- let e = Math.floor((h + g) / 2), [t, n] = p(e - 1), [r] = p(e);
106
- if (!t && !r && (h = e + 1), t && r && (g = e - 1), !t && r) {
107
- v = n;
95
+ function calculateWordsByLines(maxLines, value, style, breakAll, initialWordsWithComputedWidth, spaceWidth, lineWidth, scaleToFit) {
96
+ const shouldLimitLines = typeof maxLines === "number";
97
+ const text = value;
98
+ const calculate = (words = []) => {
99
+ return words.reduce((result, { word, width }) => {
100
+ const currentLine = result[result.length - 1];
101
+ if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {
102
+ currentLine.words.push(word);
103
+ currentLine.width += width + spaceWidth;
104
+ } else result.push({
105
+ words: [word],
106
+ width
107
+ });
108
+ return result;
109
+ }, []);
110
+ };
111
+ const originalResult = calculate(initialWordsWithComputedWidth);
112
+ const findLongestLine = (words) => words.reduce((a, b) => a.width > b.width ? a : b);
113
+ if (!shouldLimitLines || scaleToFit) return originalResult;
114
+ if (!(originalResult.length > maxLines || findLongestLine(originalResult).width > Number(lineWidth))) return originalResult;
115
+ const suffix = "…";
116
+ const checkOverflow = (index) => {
117
+ const { wordsWithComputedWidth } = calculateWordWidths(text.slice(0, index) + suffix, breakAll, style);
118
+ const result = calculate(wordsWithComputedWidth);
119
+ return [result.length > maxLines || findLongestLine(result).width > Number(lineWidth), result];
120
+ };
121
+ let start = 0;
122
+ let end = text.length - 1;
123
+ let iterations = 0;
124
+ let trimmedResult;
125
+ while (start <= end && iterations <= text.length - 1) {
126
+ const middle = Math.floor((start + end) / 2);
127
+ const [doesPrevOverflow, result] = checkOverflow(middle - 1);
128
+ const [doesMiddleOverflow] = checkOverflow(middle);
129
+ if (!doesPrevOverflow && !doesMiddleOverflow) start = middle + 1;
130
+ if (doesPrevOverflow && doesMiddleOverflow) end = middle - 1;
131
+ if (!doesPrevOverflow && doesMiddleOverflow) {
132
+ trimmedResult = result;
108
133
  break;
109
134
  }
110
- _++;
135
+ iterations++;
111
136
  }
112
- return v || d;
137
+ return trimmedResult || originalResult;
113
138
  }
114
- function g({ width: e, scaleToFit: t, value: n, style: r, breakAll: i, maxLines: a }) {
115
- if (e || t) {
116
- let o = m(n, i, r), s = o.wordsWithComputedWidth, c = o.spaceWidth;
117
- return h(a, n, r, i, s, c, e, t);
139
+ function getWordsByLines({ width, scaleToFit, value, style, breakAll, maxLines }) {
140
+ if (width || scaleToFit) {
141
+ const wordWidths = calculateWordWidths(value, breakAll, style);
142
+ const wordsWithComputedWidth = wordWidths.wordsWithComputedWidth;
143
+ const spaceWidth = wordWidths.spaceWidth;
144
+ return calculateWordsByLines(maxLines, value, style, breakAll, wordsWithComputedWidth, spaceWidth, width, scaleToFit);
118
145
  }
119
- return [{ words: n == null ? [] : n.toString().split(p) }];
146
+ return [{ words: value !== void 0 && value !== null ? value.toString().split(BREAKING_SPACES) : [] }];
120
147
  }
121
- let _ = r(() => g({
122
- width: f.width,
123
- scaleToFit: f.scaleToFit,
124
- value: f.value,
125
- style: f.style,
126
- breakAll: f.breakAll,
127
- maxLines: f.maxLines
128
- })), v = r(() => Number(f.x) + (typeof f.dx == "number" ? f.dx : 0)), y = r(() => Number(f.y) + (typeof f.dy == "number" ? f.dy : 0)), b = r(() => {
129
- switch (f.verticalAnchor) {
130
- case "start": return t(`calc(${f.capHeight})`);
131
- case "middle": return t(`calc(${(_.value.length - 1) / 2} * -${f.lineHeight} + (${f.capHeight} / 2))`);
132
- default: return t(`calc(${_.value.length - 1} * -${f.lineHeight})`);
148
+ const wordsByLines = computed(() => getWordsByLines({
149
+ width: props.width,
150
+ scaleToFit: props.scaleToFit,
151
+ value: props.value,
152
+ style: props.style,
153
+ breakAll: props.breakAll,
154
+ maxLines: props.maxLines
155
+ }));
156
+ const x = computed(() => Number(props.x) + (typeof props.dx === "number" ? props.dx : 0));
157
+ const y = computed(() => Number(props.y) + (typeof props.dy === "number" ? props.dy : 0));
158
+ const startDy = computed(() => {
159
+ switch (props.verticalAnchor) {
160
+ case "start": return reduceCSSCalc(`calc(${props.capHeight})`);
161
+ case "middle": return reduceCSSCalc(`calc(${(wordsByLines.value.length - 1) / 2} * -${props.lineHeight} + (${props.capHeight} / 2))`);
162
+ default: return reduceCSSCalc(`calc(${wordsByLines.value.length - 1} * -${props.lineHeight})`);
133
163
  }
134
- }), x = r(() => {
135
- let e = [];
136
- return f.scaleToFit && _.value[0]?.width && f.width && e.push(`scale(${Number(f.width) / _.value[0].width})`), f.angle && e.push(`rotate(${f.angle}, ${v.value}, ${y.value})`), e.join(" ");
137
164
  });
138
- return (e, t) => (s(), i("text", {
139
- x: v.value,
140
- y: y.value,
141
- transform: x.value || void 0,
142
- "text-anchor": f.textAnchor,
143
- fill: f.fill && f.fill.includes("url") ? "#808080" : f.fill,
144
- class: "v-charts-text",
145
- style: o(f.style)
146
- }, [(s(!0), i(n, null, c(_.value, (e, t) => (s(), i("tspan", {
147
- key: t,
148
- x: v.value,
149
- dy: t === 0 ? b.value : f.lineHeight
150
- }, l(e.words.join(f.breakAll ? "" : " ")), 9, d))), 128))], 12, u));
165
+ const transforms = computed(() => {
166
+ const arr = [];
167
+ if (props.scaleToFit && wordsByLines.value[0]?.width && props.width) arr.push(`scale(${Number(props.width) / wordsByLines.value[0].width})`);
168
+ if (props.angle) arr.push(`rotate(${props.angle}, ${x.value}, ${y.value})`);
169
+ return arr.join(" ");
170
+ });
171
+ return (_ctx, _cache) => {
172
+ return openBlock(), createElementBlock("text", {
173
+ x: x.value,
174
+ y: y.value,
175
+ transform: transforms.value || void 0,
176
+ "text-anchor": props.textAnchor,
177
+ fill: props.fill && props.fill.includes("url") ? "#808080" : props.fill,
178
+ class: "v-charts-text",
179
+ style: normalizeStyle(props.style)
180
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(wordsByLines.value, (line, index) => {
181
+ return openBlock(), createElementBlock("tspan", {
182
+ key: index,
183
+ x: x.value,
184
+ dy: index === 0 ? startDy.value : props.lineHeight
185
+ }, toDisplayString(line.words.join(props.breakAll ? "" : " ")), 9, _hoisted_2);
186
+ }), 128))], 12, _hoisted_1);
187
+ };
151
188
  }
152
189
  });
153
190
  //#endregion
154
- export { f as default };
191
+ export { Text_vue_vue_type_script_setup_true_lang_default as default };