vccs 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +151 -0
  2. package/dist/animation/Animate.d.ts +1 -1
  3. package/dist/cartesian/area/type.d.ts +3 -3
  4. package/dist/cartesian/bar/type.d.ts +1 -13
  5. package/dist/cartesian/brush/components/Slide.d.ts +1 -1
  6. package/dist/cartesian/brush/components/TravellerLayer.d.ts +1 -1
  7. package/dist/cartesian/brush/type.d.ts +2 -1
  8. package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +2 -1
  9. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  10. package/dist/cartesian/funnel/index.d.ts +2 -0
  11. package/dist/cartesian/funnel/type.d.ts +74 -6
  12. package/dist/cartesian/index.d.ts +2 -0
  13. package/dist/cartesian/line/Line.d.ts +7 -13
  14. package/dist/cartesian/line/type.d.ts +4 -17
  15. package/dist/cartesian/reference-area/ReferenceArea.d.ts +16 -16
  16. package/dist/cartesian/reference-dot/ReferenceDot.d.ts +143 -0
  17. package/dist/cartesian/reference-dot/index.d.ts +2 -0
  18. package/dist/cartesian/reference-line/ReferenceLine.d.ts +8 -8
  19. package/dist/cartesian/scatter/Scatter.d.ts +1 -1
  20. package/dist/chart/FunnelChart.d.ts +1 -0
  21. package/dist/chart/RechartsWrapper.d.ts +7 -3
  22. package/dist/chart/Surface.d.ts +2 -1
  23. package/dist/chart/Treemap.d.ts +237 -0
  24. package/dist/chart/generateCategoricalChart.d.ts +2 -1
  25. package/dist/chart/index.d.ts +2 -0
  26. package/dist/chart/treemapUtils.d.ts +22 -0
  27. package/dist/components/Customized.d.ts +23 -0
  28. package/dist/components/Text.d.ts +4 -4
  29. package/dist/components/Tooltip.d.ts +1 -1
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/components/label/Label.d.ts +3 -3
  32. package/dist/components/label/types.d.ts +1 -1
  33. package/dist/container/Surface.d.ts +3 -2
  34. package/dist/es/animation/Animate.mjs +48 -22
  35. package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
  36. package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
  37. package/dist/es/cartesian/area/Area.mjs +42 -31
  38. package/dist/es/cartesian/area/ClipRect.mjs +79 -58
  39. package/dist/es/cartesian/area/RenderArea.mjs +142 -108
  40. package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
  41. package/dist/es/cartesian/area/type.mjs +13 -15
  42. package/dist/es/cartesian/area/utils.mjs +69 -49
  43. package/dist/es/cartesian/axis/XAxis.mjs +87 -73
  44. package/dist/es/cartesian/axis/YAxis.mjs +67 -56
  45. package/dist/es/cartesian/bar/Bar.mjs +78 -71
  46. package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
  47. package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
  48. package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
  49. package/dist/es/cartesian/bar/type.mjs +11 -25
  50. package/dist/es/cartesian/bar/utils.mjs +97 -70
  51. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
  52. package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
  53. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
  54. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
  55. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
  56. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
  57. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
  58. package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
  59. package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
  60. package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
  61. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
  62. package/dist/es/cartesian/funnel/Funnel.mjs +162 -0
  63. package/dist/es/cartesian/funnel/type.mjs +78 -0
  64. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  65. package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
  66. package/dist/es/cartesian/line/Line.mjs +41 -37
  67. package/dist/es/cartesian/line/StaticLine.mjs +191 -122
  68. package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
  69. package/dist/es/cartesian/line/type.mjs +13 -18
  70. package/dist/es/cartesian/line/utils.mjs +27 -26
  71. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +79 -78
  72. package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +134 -0
  73. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +93 -84
  74. package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
  75. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
  76. package/dist/es/cartesian/useNeedsClip.mjs +18 -9
  77. package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
  78. package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
  79. package/dist/es/chart/AreaChart.mjs +5 -5
  80. package/dist/es/chart/BarChart.mjs +5 -5
  81. package/dist/es/chart/ComposedChart.mjs +5 -5
  82. package/dist/es/chart/FunnelChart.mjs +11 -0
  83. package/dist/es/chart/LegendPortalContext.mjs +3 -3
  84. package/dist/es/chart/LineChart.mjs +5 -5
  85. package/dist/es/chart/PieChart.mjs +5 -5
  86. package/dist/es/chart/RadarChart.mjs +5 -5
  87. package/dist/es/chart/RadialBarChart.mjs +5 -5
  88. package/dist/es/chart/RechartsWrapper.mjs +113 -89
  89. package/dist/es/chart/ScatterChart.mjs +5 -5
  90. package/dist/es/chart/Surface.mjs +3 -3
  91. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
  92. package/dist/es/chart/TooltipPortalContext.mjs +3 -3
  93. package/dist/es/chart/Treemap.mjs +379 -0
  94. package/dist/es/chart/const.mjs +2 -2
  95. package/dist/es/chart/generateCategoricalChart.mjs +99 -89
  96. package/dist/es/chart/provideClipPathId.mjs +12 -7
  97. package/dist/es/chart/treemapUtils.mjs +32 -0
  98. package/dist/es/components/Cell.mjs +16 -4
  99. package/dist/es/components/Customized.mjs +43 -0
  100. package/dist/es/components/Text.mjs +3 -3
  101. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
  102. package/dist/es/components/Tooltip.mjs +274 -199
  103. package/dist/es/components/label/Label.mjs +30 -26
  104. package/dist/es/components/label/LabelList.mjs +45 -39
  105. package/dist/es/components/label/types.mjs +10 -6
  106. package/dist/es/components/label/utils.mjs +194 -162
  107. package/dist/es/components/legend/Legend.mjs +82 -71
  108. package/dist/es/components/legend/LegendSymbol.mjs +40 -38
  109. package/dist/es/components/legend/hooks/useLegend.mjs +71 -46
  110. package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
  111. package/dist/es/components/legend/type.mjs +2 -2
  112. package/dist/es/components/legend/utils.mjs +19 -11
  113. package/dist/es/components/utils.mjs +35 -22
  114. package/dist/es/container/ClipPath.mjs +14 -14
  115. package/dist/es/container/Layer.mjs +9 -7
  116. package/dist/es/container/ResponsiveContainer.mjs +3 -3
  117. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
  118. package/dist/es/container/Surface.mjs +25 -23
  119. package/dist/es/container/useSizeContext.mjs +3 -3
  120. package/dist/es/context/ChartDataContextProvider.mjs +19 -13
  121. package/dist/es/context/PanoramaContextProvider.mjs +15 -10
  122. package/dist/es/context/accessibilityContext.mjs +3 -3
  123. package/dist/es/context/cartesianLabelListContext.mjs +3 -3
  124. package/dist/es/context/chartLayoutContext.mjs +33 -30
  125. package/dist/es/context/cursorLayerContext.mjs +3 -3
  126. package/dist/es/context/graphicalLayerContext.mjs +3 -3
  127. package/dist/es/context/labelLayerContext.mjs +3 -3
  128. package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
  129. package/dist/es/context/useTooltipAxis.mjs +14 -12
  130. package/dist/es/events/useChartSynchronisation.mjs +91 -66
  131. package/dist/es/hooks/publicHooks.mjs +207 -0
  132. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  133. package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
  134. package/dist/es/index.mjs +54 -42
  135. package/dist/es/polar/pie/Pie.mjs +131 -115
  136. package/dist/es/polar/pie/type.mjs +8 -10
  137. package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
  138. package/dist/es/polar/radar/PolarGrid.mjs +72 -59
  139. package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
  140. package/dist/es/polar/radar/Radar.mjs +181 -145
  141. package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
  142. package/dist/es/polar/radial-bar/type.mjs +9 -9
  143. package/dist/es/shape/Cross.mjs +11 -10
  144. package/dist/es/shape/Curve.mjs +71 -44
  145. package/dist/es/shape/Dot.mjs +12 -11
  146. package/dist/es/shape/Polygon.mjs +19 -0
  147. package/dist/es/shape/Rectangle.mjs +41 -30
  148. package/dist/es/shape/Sector.mjs +105 -79
  149. package/dist/es/shape/Symbols.mjs +45 -34
  150. package/dist/es/shape/Trapezoid.mjs +50 -0
  151. package/dist/es/state/ReportChartProps.mjs +23 -24
  152. package/dist/es/state/ReportMainChartProps.mjs +26 -21
  153. package/dist/es/state/ReportPolarOptions.mjs +23 -22
  154. package/dist/es/state/SetGraphicalItem.mjs +42 -27
  155. package/dist/es/state/SetLegendPayload.mjs +17 -13
  156. package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
  157. package/dist/es/state/brushSlice.mjs +12 -8
  158. package/dist/es/state/cartesianAxisSlice.mjs +23 -17
  159. package/dist/es/state/chartDataSlice.mjs +18 -13
  160. package/dist/es/state/externalEventsMiddleware.mjs +25 -15
  161. package/dist/es/state/graphicalItemsSlice.mjs +29 -25
  162. package/dist/es/state/hooks.mjs +24 -3
  163. package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
  164. package/dist/es/state/layoutSlice.mjs +18 -12
  165. package/dist/es/state/legendSlice.mjs +19 -14
  166. package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
  167. package/dist/es/state/optionsSlice.mjs +14 -11
  168. package/dist/es/state/polarAxisSlice.mjs +15 -13
  169. package/dist/es/state/polarOptionsSlice.mjs +8 -6
  170. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
  171. package/dist/es/state/referenceElementsSlice.mjs +21 -19
  172. package/dist/es/state/rootPropsSlice.mjs +20 -9
  173. package/dist/es/state/selectors/areaSelectors.mjs +65 -55
  174. package/dist/es/state/selectors/axisSelectors.mjs +784 -569
  175. package/dist/es/state/selectors/barSelectors.mjs +225 -162
  176. package/dist/es/state/selectors/brushSelectors.mjs +15 -14
  177. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
  178. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
  179. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
  180. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
  181. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
  182. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
  183. package/dist/es/state/selectors/common.mjs +2 -2
  184. package/dist/es/state/selectors/containerSelectors.mjs +5 -2
  185. package/dist/es/state/selectors/dataSelectors.mjs +28 -9
  186. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  187. package/dist/es/state/selectors/legendSelectors.mjs +7 -6
  188. package/dist/es/state/selectors/lineSelectors.mjs +54 -47
  189. package/dist/es/state/selectors/pickAxisId.mjs +2 -2
  190. package/dist/es/state/selectors/pickAxisType.mjs +2 -2
  191. package/dist/es/state/selectors/pieSelectors.mjs +116 -81
  192. package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
  193. package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
  194. package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
  195. package/dist/es/state/selectors/polarSelectors.mjs +79 -62
  196. package/dist/es/state/selectors/radarSelectors.mjs +111 -91
  197. package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
  198. package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
  199. package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
  200. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
  201. package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
  202. package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
  203. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
  204. package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
  205. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
  206. package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
  207. package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
  208. package/dist/es/state/selectors/selectors.mjs +94 -75
  209. package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
  210. package/dist/es/state/selectors/touchSelectors.mjs +17 -14
  211. package/dist/es/state/store.mjs +46 -46
  212. package/dist/es/state/tooltipSlice.mjs +64 -37
  213. package/dist/es/state/touchEventsMiddleware.mjs +35 -29
  214. package/dist/es/state/utils/useReportScale.mjs +16 -13
  215. package/dist/es/synchronisation/syncSelectors.mjs +3 -3
  216. package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
  217. package/dist/es/types/common.mjs +12 -0
  218. package/dist/es/types/event.mjs +164 -2
  219. package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
  220. package/dist/es/utils/VueUtils.mjs +35 -14
  221. package/dist/es/utils/attrs.mjs +43 -26
  222. package/dist/es/utils/cartesian.mjs +47 -15
  223. package/dist/es/utils/cell.mjs +28 -0
  224. package/dist/es/utils/chart.mjs +298 -197
  225. package/dist/es/utils/const.mjs +30 -2
  226. package/dist/es/utils/createCategoricalInverse.mjs +46 -0
  227. package/dist/es/utils/createContext.mjs +28 -9
  228. package/dist/es/utils/data-utils.mjs +9 -8
  229. package/dist/es/utils/data.mjs +35 -21
  230. package/dist/es/utils/events.mjs +5 -3
  231. package/dist/es/utils/getLinearRegression.mjs +28 -11
  232. package/dist/es/utils/grid.mjs +20 -5
  233. package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
  234. package/dist/es/utils/legend.mjs +13 -12
  235. package/dist/es/utils/log.mjs +10 -7
  236. package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
  237. package/dist/es/utils/polar.mjs +37 -30
  238. package/dist/es/utils/props.mjs +16 -10
  239. package/dist/es/utils/resolveDefaultProps.mjs +23 -4
  240. package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
  241. package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
  242. package/dist/es/utils/scale/utils/utils.mjs +43 -24
  243. package/dist/es/utils/scale.mjs +46 -0
  244. package/dist/es/utils/style.mjs +24 -13
  245. package/dist/es/utils/tick.mjs +34 -23
  246. package/dist/es/utils/tooltip/translate.mjs +63 -49
  247. package/dist/es/utils/validate.mjs +40 -29
  248. package/dist/hooks/publicHooks.d.ts +143 -0
  249. package/dist/hooks/useIsAnimating.d.ts +14 -0
  250. package/dist/index.d.ts +1 -0
  251. package/dist/polar/pie/type.d.ts +2 -2
  252. package/dist/polar/radar/Radar.d.ts +4 -4
  253. package/dist/shape/Curve.d.ts +2 -1
  254. package/dist/shape/Polygon.d.ts +9 -0
  255. package/dist/shape/Rectangle.d.ts +0 -4
  256. package/dist/shape/Sector.d.ts +2 -2
  257. package/dist/shape/Symbols.d.ts +2 -1
  258. package/dist/shape/Trapezoid.d.ts +30 -0
  259. package/dist/shape/index.d.ts +2 -0
  260. package/dist/shape/types.d.ts +4 -5
  261. package/dist/state/ReportChartProps.d.ts +3 -3
  262. package/dist/state/graphicalItemsSlice.d.ts +1 -1
  263. package/dist/state/rootPropsSlice.d.ts +2 -2
  264. package/dist/state/selectors/axisSelectors.d.ts +5 -0
  265. package/dist/types/axis.d.ts +2 -2
  266. package/dist/types/bar.d.ts +2 -6
  267. package/dist/types/categorical.d.ts +2 -2
  268. package/dist/types/common.d.ts +7 -1
  269. package/dist/types/tooltip.d.ts +2 -2
  270. package/dist/utils/cell.d.ts +11 -0
  271. package/dist/utils/createCategoricalInverse.d.ts +16 -0
  272. package/dist/utils/scale.d.ts +23 -0
  273. package/package.json +2 -1
@@ -1,12 +1,14 @@
1
- import { filterProps as e } from "../utils/VueUtils.mjs";
2
- import { createVNode as t, defineComponent as n, mergeProps as r } from "vue";
1
+ import { filterProps } from "../utils/VueUtils.mjs";
2
+ import { createVNode, defineComponent, mergeProps } from "vue";
3
3
  //#region src/container/Layer.tsx
4
- var i = /* @__PURE__ */ n({
4
+ var Layer = /* @__PURE__ */ defineComponent({
5
5
  name: "VChartsLayer",
6
- inheritAttrs: !1,
7
- setup(n, { attrs: i, slots: a }) {
8
- return () => t("g", r(i, e(i, !0), { class: "v-charts-layer" }), [a.default?.()]);
6
+ inheritAttrs: false,
7
+ setup(_, { attrs, slots }) {
8
+ return () => {
9
+ return createVNode("g", mergeProps(attrs, filterProps(attrs, true), { "class": "v-charts-layer" }), [slots.default?.()]);
10
+ };
9
11
  }
10
12
  });
11
13
  //#endregion
12
- export { i as Layer };
14
+ export { Layer };
@@ -1,5 +1,5 @@
1
- import e from "./ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs";
1
+ import ResponsiveContainer_vue_vue_type_script_setup_true_lang_default from "./ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs";
2
2
  //#region src/container/ResponsiveContainer.vue
3
- var t = e;
3
+ var ResponsiveContainer_default = ResponsiveContainer_vue_vue_type_script_setup_true_lang_default;
4
4
  //#endregion
5
- export { t as default };
5
+ export { ResponsiveContainer_default as default };
@@ -1,12 +1,13 @@
1
- import { isPercent as e } from "../utils/validate.mjs";
2
- import { normalizeStyle as t } from "../utils/style.mjs";
3
- import { provideSizeContext as n } from "./useSizeContext.mjs";
4
- import { Fragment as r, cloneVNode as i, computed as a, createBlock as o, createElementBlock as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, onMounted as d, onUnmounted as f, openBlock as p, ref as m, resolveDynamicComponent as h, toRef as g, useSlots as _ } from "vue";
5
- import { useThrottleFn as v } from "@vueuse/core";
1
+ import { isPercent } from "../utils/validate.mjs";
2
+ import { normalizeStyle as normalizeStyle$1 } from "../utils/style.mjs";
3
+ import { provideSizeContext } from "./useSizeContext.mjs";
4
+ import { Fragment, cloneVNode, computed, createBlock, createElementBlock, defineComponent, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, resolveDynamicComponent, toRef, useSlots } from "vue";
5
+ import { useThrottleFn } from "@vueuse/core";
6
6
  //#region src/container/ResponsiveContainer.vue?vue&type=script&setup=true&lang.ts
7
- var y = ["id"], b = /* @__PURE__ */ c({
7
+ var _hoisted_1 = ["id"];
8
+ var ResponsiveContainer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
8
9
  name: "ResponsiveContainer",
9
- inheritAttrs: !1,
10
+ inheritAttrs: false,
10
11
  __name: "ResponsiveContainer",
11
12
  props: {
12
13
  aspect: {},
@@ -25,88 +26,119 @@ var y = ["id"], b = /* @__PURE__ */ c({
25
26
  style: {},
26
27
  onResize: {}
27
28
  },
28
- setup(c) {
29
- let b = c, x = _(), S = g(b, "debounce"), C = m({
30
- width: b.initialDimension.width,
31
- height: b.initialDimension.height
32
- }), w = a(() => e(b.width) ? C.value.width : b.width), T = a(() => {
33
- let t = e(b.height) ? C.value.height : b.height;
34
- return b.aspect && b.aspect > 0 && (b.width && (b.height == null || b.height === "auto") ? t = w.value / b.aspect : b.height && (b.width == null || b.width)), t;
35
- }), E = a(() => {
36
- let e = w.value;
37
- return b.aspect && b.aspect > 0 && b.height && (b.width == null || b.width === "auto") && (e = T.value * b.aspect), e;
29
+ setup(__props) {
30
+ const props = __props;
31
+ const slots = useSlots();
32
+ const debounce = toRef(props, "debounce");
33
+ const sizes = ref({
34
+ width: props.initialDimension.width,
35
+ height: props.initialDimension.height
38
36
  });
39
- n({
40
- sizes: C,
41
- calculatedWidth: E,
42
- calculatedHeight: T
37
+ const calculatedWidth = computed(() => {
38
+ return isPercent(props.width) ? sizes.value.width : props.width;
43
39
  });
44
- function D(e, t) {
45
- let n = Math.round(e), r = Math.round(t), { width: i, height: a } = C.value;
46
- i === n && a === r || (C.value = {
47
- width: n,
48
- height: r
49
- });
40
+ const calculatedHeight = computed(() => {
41
+ let height = isPercent(props.height) ? sizes.value.height : props.height;
42
+ if (props.aspect && props.aspect > 0) {
43
+ if (props.width && (props.height == null || props.height === "auto")) height = calculatedWidth.value / props.aspect;
44
+ else if (props.height && (props.width == null || props.width === "auto")) {}
45
+ }
46
+ return height;
47
+ });
48
+ const finalCalculatedWidth = computed(() => {
49
+ let width = calculatedWidth.value;
50
+ if (props.aspect && props.aspect > 0) {
51
+ if (props.height && (props.width == null || props.width === "auto")) width = calculatedHeight.value * props.aspect;
52
+ }
53
+ return width;
54
+ });
55
+ provideSizeContext({
56
+ sizes,
57
+ calculatedWidth: finalCalculatedWidth,
58
+ calculatedHeight
59
+ });
60
+ function setContainerSize(width, height) {
61
+ const roundedWidth = Math.round(width);
62
+ const roundedHeight = Math.round(height);
63
+ const { width: containerWidth, height: containerHeight } = sizes.value;
64
+ if (containerWidth === roundedWidth && containerHeight === roundedHeight) return;
65
+ sizes.value = {
66
+ width: roundedWidth,
67
+ height: roundedHeight
68
+ };
50
69
  }
51
- let O = v((e) => {
52
- let { width: t, height: n } = e[0].contentRect;
53
- D(t, n), b.onResize?.(t, n);
54
- }, S, !0, !1), k = m(), A = null;
55
- d(() => {
56
- A = new ResizeObserver(O);
57
- let { width: e, height: t } = k.value.getBoundingClientRect() ?? {
70
+ const handleResize = useThrottleFn((entries) => {
71
+ const { width: containerWidth, height: containerHeight } = entries[0].contentRect;
72
+ setContainerSize(containerWidth, containerHeight);
73
+ props.onResize?.(containerWidth, containerHeight);
74
+ }, debounce, true, false);
75
+ const containerRef = ref();
76
+ let observer = null;
77
+ onMounted(() => {
78
+ observer = new ResizeObserver(handleResize);
79
+ const { width: containerWidth, height: containerHeight } = containerRef.value.getBoundingClientRect() ?? {
58
80
  width: 0,
59
81
  height: 0
60
82
  };
61
- D(e, t), A.observe(k.value);
62
- }), f(() => {
63
- A?.disconnect();
83
+ setContainerSize(containerWidth, containerHeight);
84
+ observer.observe(containerRef.value);
85
+ });
86
+ onUnmounted(() => {
87
+ observer?.disconnect();
64
88
  });
65
- let j = a(() => {
66
- let { width: e, height: t } = C.value;
67
- return e >= 0 && t >= 0;
89
+ const isReady = computed(() => {
90
+ const { width: containerWidth, height: containerHeight } = sizes.value;
91
+ return containerWidth >= 0 && containerHeight >= 0;
68
92
  });
69
- function M(e) {
70
- let t = [];
71
- for (let n of e) n.type === r && Array.isArray(n.children) ? t.push(...M(n.children)) : t.push(n);
72
- return t;
93
+ function flattenSlotChildren(vnodes) {
94
+ const result = [];
95
+ for (const vnode of vnodes) if (vnode.type === Fragment && Array.isArray(vnode.children)) result.push(...flattenSlotChildren(vnode.children));
96
+ else result.push(vnode);
97
+ return result;
73
98
  }
74
- function N() {
75
- if (!j.value) return;
76
- let e = E.value, n = T.value, r = x.default?.();
77
- if (r) return M(r).map((r, a) => i(r, {
78
- width: e,
79
- height: n,
80
- key: r.key || `responsive-child-${a}`,
81
- style: {
82
- ...t({
83
- maxHeight: C.value.height,
84
- maxWidth: C.value.width
85
- }),
86
- height: "100%",
87
- width: "100%",
88
- ...r.props?.style
89
- }
90
- }));
99
+ function renderChildren() {
100
+ if (!isReady.value) return;
101
+ const calculatedWidthValue = finalCalculatedWidth.value;
102
+ const calculatedHeightValue = calculatedHeight.value;
103
+ const rawChildren = slots.default?.();
104
+ if (!rawChildren) return void 0;
105
+ return flattenSlotChildren(rawChildren).map((child, index) => {
106
+ return cloneVNode(child, {
107
+ width: calculatedWidthValue,
108
+ height: calculatedHeightValue,
109
+ key: child.key || `responsive-child-${index}`,
110
+ style: {
111
+ ...normalizeStyle$1({
112
+ maxHeight: sizes.value.height,
113
+ maxWidth: sizes.value.width
114
+ }),
115
+ height: "100%",
116
+ width: "100%",
117
+ ...child.props?.style
118
+ }
119
+ });
120
+ });
91
121
  }
92
- let P = a(() => ({
93
- ...b.style,
94
- ...t({
95
- width: b.width,
96
- height: b.height,
97
- minWidth: b.minWidth,
98
- minHeight: b.minHeight,
99
- maxHeight: b.maxHeight
122
+ const containerStyle = computed(() => ({
123
+ ...props.style,
124
+ ...normalizeStyle$1({
125
+ width: props.width,
126
+ height: props.height,
127
+ minWidth: props.minWidth,
128
+ minHeight: props.minHeight,
129
+ maxHeight: props.maxHeight
100
130
  })
101
131
  }));
102
- return (e, t) => (p(), s("div", {
103
- id: e.id ? `${e.id}` : void 0,
104
- ref_key: "containerRef",
105
- ref: k,
106
- class: l(["vcharts-responsive-container", [b.class]]),
107
- style: u(P.value)
108
- }, [(p(), o(h(() => N())))], 14, y));
132
+ return (_ctx, _cache) => {
133
+ return openBlock(), createElementBlock("div", {
134
+ id: _ctx.id ? `${_ctx.id}` : void 0,
135
+ ref_key: "containerRef",
136
+ ref: containerRef,
137
+ class: normalizeClass(["vcharts-responsive-container", [props.class]]),
138
+ style: normalizeStyle(containerStyle.value)
139
+ }, [(openBlock(), createBlock(resolveDynamicComponent(() => renderChildren())))], 14, _hoisted_1);
140
+ };
109
141
  }
110
142
  });
111
143
  //#endregion
112
- export { b as default };
144
+ export { ResponsiveContainer_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,24 +1,25 @@
1
- import { createVNode as e, defineComponent as t, mergeProps as n } from "vue";
1
+ import { classProp } from "../types/common.mjs";
2
+ import { createVNode, defineComponent, mergeProps } from "vue";
2
3
  //#region src/container/Surface.tsx
3
- var r = /* @__PURE__ */ t({
4
+ /**
5
+ * @fileOverview Surface component for SVG rendering
6
+ */
7
+ var Surface = /* @__PURE__ */ defineComponent({
4
8
  name: "Surface",
5
9
  props: {
6
10
  width: {
7
11
  type: Number,
8
- required: !0
12
+ required: true
9
13
  },
10
14
  height: {
11
15
  type: Number,
12
- required: !0
16
+ required: true
13
17
  },
14
18
  viewBox: {
15
19
  type: Object,
16
20
  default: void 0
17
21
  },
18
- class: {
19
- type: String,
20
- default: void 0
21
- },
22
+ class: classProp,
22
23
  style: {
23
24
  type: Object,
24
25
  default: void 0
@@ -32,27 +33,28 @@ var r = /* @__PURE__ */ t({
32
33
  default: void 0
33
34
  }
34
35
  },
35
- setup(t, { slots: r, attrs: i }) {
36
+ setup(props, { slots, attrs }) {
36
37
  return () => {
37
- let { width: a, height: o, viewBox: s, class: c, style: l, title: u, desc: d, ...f } = t, p = s || {
38
- width: a,
39
- height: o,
38
+ const { width, height, viewBox, class: className, style, title, desc, ...rest } = props;
39
+ const svgView = viewBox || {
40
+ width,
41
+ height,
40
42
  x: 0,
41
43
  y: 0
42
44
  };
43
- return e("svg", n({
44
- class: ["vcharts-surface", c],
45
- width: a,
46
- height: o,
47
- style: l,
48
- viewBox: `${p.x} ${p.y} ${p.width} ${p.height}`
49
- }, f, i), [
50
- u && e("title", null, [u]),
51
- d && e("desc", null, [d]),
52
- r.default?.()
45
+ return createVNode("svg", mergeProps({
46
+ "class": ["vcharts-surface", className],
47
+ "width": width,
48
+ "height": height,
49
+ "style": style,
50
+ "viewBox": `${svgView.x} ${svgView.y} ${svgView.width} ${svgView.height}`
51
+ }, rest, attrs), [
52
+ title && createVNode("title", null, [title]),
53
+ desc && createVNode("desc", null, [desc]),
54
+ slots.default?.()
53
55
  ]);
54
56
  };
55
57
  }
56
58
  });
57
59
  //#endregion
58
- export { r as default };
60
+ export { Surface as default };
@@ -1,5 +1,5 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
1
+ import { createContext } from "../utils/createContext.mjs";
2
2
  //#region src/container/useSizeContext.ts
3
- var [t, n] = e("SizeContext");
3
+ var [useSizeContext, provideSizeContext] = createContext("SizeContext");
4
4
  //#endregion
5
- export { n as provideSizeContext };
5
+ export { provideSizeContext };
@@ -1,21 +1,27 @@
1
- import { useAppDispatch as e } from "../state/hooks.mjs";
2
- import { setChartData as t } from "../state/chartDataSlice.mjs";
3
- import { defineComponent as n, onUnmounted as r, watch as i } from "vue";
1
+ import { useAppDispatch } from "../state/hooks.mjs";
2
+ import { setChartData } from "../state/chartDataSlice.mjs";
3
+ import { defineComponent, onUnmounted, watch } from "vue";
4
4
  //#region src/context/ChartDataContextProvider.ts
5
- var a = n({
5
+ /**
6
+ * ChartDataContextProvider for Vue
7
+ * Sets chartData in store on mount/update, clears on unmount. Renders nothing.
8
+ */
9
+ var ChartDataContextProvider = defineComponent({
6
10
  name: "ChartDataContextProvider",
7
11
  props: { chartData: {
8
12
  type: Array,
9
- required: !0
13
+ required: true
10
14
  } },
11
- setup(n) {
12
- let a = e();
13
- return i(() => n.chartData, (e) => {
14
- a(t(Array.from(e)));
15
- }, { immediate: !0 }), r(() => {
16
- a(t(void 0));
17
- }), () => null;
15
+ setup(props) {
16
+ const dispatch = useAppDispatch();
17
+ watch(() => props.chartData, (val) => {
18
+ dispatch(setChartData(Array.from(val)));
19
+ }, { immediate: true });
20
+ onUnmounted(() => {
21
+ dispatch(setChartData(void 0));
22
+ });
23
+ return () => null;
18
24
  }
19
25
  });
20
26
  //#endregion
21
- export { a as ChartDataContextProvider };
27
+ export { ChartDataContextProvider };
@@ -1,19 +1,24 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
2
- import { defineComponent as t } from "vue";
1
+ import { createContext } from "../utils/createContext.mjs";
2
+ import { defineComponent } from "vue";
3
3
  //#region src/context/PanoramaContextProvider.ts
4
- var [n, r] = e("PanoramaContext");
5
- function i() {
6
- return n(!1);
4
+ var [injectPanorama, providePanoramaContext] = createContext("PanoramaContext");
5
+ /**
6
+ * useIsPanorama composable
7
+ * Returns the injected isPanorama value (default: false)
8
+ */
9
+ function useIsPanorama() {
10
+ return injectPanorama(false);
7
11
  }
8
- t({
12
+ defineComponent({
9
13
  name: "PanoramaContextProvider",
10
14
  props: { isPanorama: {
11
15
  type: Boolean,
12
- required: !0
16
+ required: true
13
17
  } },
14
- setup(e, { slots: t }) {
15
- return r(!0), () => t.default?.();
18
+ setup(props, { slots }) {
19
+ providePanoramaContext(true);
20
+ return () => slots.default?.();
16
21
  }
17
22
  });
18
23
  //#endregion
19
- export { i as useIsPanorama };
24
+ export { useIsPanorama };
@@ -1,5 +1,5 @@
1
- import { useAppSelector as e } from "../state/hooks.mjs";
1
+ import { useAppSelector } from "../state/hooks.mjs";
2
2
  //#region src/context/accessibilityContext.tsx
3
- var t = () => e((e) => e.rootProps.accessibilityLayer);
3
+ var useAccessibilityLayer = () => useAppSelector((state) => state.rootProps.accessibilityLayer);
4
4
  //#endregion
5
- export { t as useAccessibilityLayer };
5
+ export { useAccessibilityLayer };
@@ -1,5 +1,5 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
1
+ import { createContext } from "../utils/createContext.mjs";
2
2
  //#region src/context/cartesianLabelListContext.ts
3
- var [t, n] = e("CartesianLabelListContext");
3
+ var [useCartesianLabelListData, provideCartesianLabelListData] = createContext("CartesianLabelListContext");
4
4
  //#endregion
5
- export { n as provideCartesianLabelListData, t as useCartesianLabelListData };
5
+ export { provideCartesianLabelListData, useCartesianLabelListData };
@@ -1,46 +1,49 @@
1
- import { useIsPanorama as e } from "./PanoramaContextProvider.mjs";
2
- import { selectChartHeight as t, selectChartWidth as n } from "../state/selectors/containerSelectors.mjs";
3
- import { selectChartOffset as r, selectChartViewBox as i } from "../state/selectors/selectChartOffset.mjs";
4
- import { selectBrushDimensions as a, selectBrushSettings as o } from "../state/selectors/brushSelectors.mjs";
5
- import { selectChartLayout as s } from "../state/selectors/common.mjs";
6
- import { useAppSelector as c } from "../state/hooks.mjs";
7
- import { selectChartOffsetInternal as l } from "../state/selectors/selectChartOffsetInternal.mjs";
8
- import { computed as u } from "vue";
1
+ import { useIsPanorama } from "./PanoramaContextProvider.mjs";
2
+ import { selectChartHeight, selectChartWidth } from "../state/selectors/containerSelectors.mjs";
3
+ import { selectChartOffset, selectChartViewBox } from "../state/selectors/selectChartOffset.mjs";
4
+ import { selectBrushDimensions, selectBrushSettings } from "../state/selectors/brushSelectors.mjs";
5
+ import { selectChartLayout } from "../state/selectors/common.mjs";
6
+ import { useAppSelector } from "../state/hooks.mjs";
7
+ import { selectChartOffsetInternal } from "../state/selectors/selectChartOffsetInternal.mjs";
8
+ import { computed } from "vue";
9
9
  //#region src/context/chartLayoutContext.tsx
10
- function d() {
11
- return c(r);
10
+ function useOffset() {
11
+ return useAppSelector(selectChartOffset);
12
12
  }
13
- var f = () => c(s);
14
- function p() {
15
- let t = e(), n = c(i), r = c(a), s = c(o);
16
- return u(() => {
17
- if (!t || !r.value || !s.value) return n.value;
18
- let e = s.value.padding;
13
+ var useChartLayout = () => useAppSelector(selectChartLayout);
14
+ function useViewBox() {
15
+ const panorama = useIsPanorama();
16
+ const rootViewBox = useAppSelector(selectChartViewBox);
17
+ const brushDimensions = useAppSelector(selectBrushDimensions);
18
+ const brushPadding = useAppSelector(selectBrushSettings);
19
+ return computed(() => {
20
+ if (!panorama || !brushDimensions.value || !brushPadding.value) return rootViewBox.value;
21
+ const padding = brushPadding.value.padding;
19
22
  return {
20
- width: r.value.width - e.left - e.right,
21
- height: r.value.height - e.top - e.bottom,
22
- x: e.left,
23
- y: e.top
23
+ width: brushDimensions.value.width - padding.left - padding.right,
24
+ height: brushDimensions.value.height - padding.top - padding.bottom,
25
+ x: padding.left,
26
+ y: padding.top
24
27
  };
25
28
  });
26
29
  }
27
- function m() {
28
- return c(n);
30
+ function useChartWidth() {
31
+ return useAppSelector(selectChartWidth);
29
32
  }
30
- function h() {
31
- return c(t);
33
+ function useChartHeight() {
34
+ return useAppSelector(selectChartHeight);
32
35
  }
33
- function g() {
34
- return c(l);
36
+ function useOffsetInternal() {
37
+ return useAppSelector(selectChartOffsetInternal);
35
38
  }
36
- var _ = {
39
+ var manyComponentsThrowErrorsIfMarginIsUndefined = {
37
40
  top: 0,
38
41
  right: 0,
39
42
  bottom: 0,
40
43
  left: 0
41
44
  };
42
- function v() {
43
- return c((e) => e.layout.margin ?? _);
45
+ function useMargin() {
46
+ return useAppSelector((state) => state.layout.margin ?? manyComponentsThrowErrorsIfMarginIsUndefined);
44
47
  }
45
48
  //#endregion
46
- export { h as useChartHeight, f as useChartLayout, m as useChartWidth, v as useMargin, d as useOffset, g as useOffsetInternal, p as useViewBox };
49
+ export { useChartHeight, useChartLayout, useChartWidth, useMargin, useOffset, useOffsetInternal, useViewBox };
@@ -1,5 +1,5 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
1
+ import { createContext } from "../utils/createContext.mjs";
2
2
  //#region src/context/cursorLayerContext.ts
3
- var [t, n] = e("CursorLayerContext");
3
+ var [useCursorLayerRef, provideCursorLayerRef] = createContext("CursorLayerContext");
4
4
  //#endregion
5
- export { n as provideCursorLayerRef, t as useCursorLayerRef };
5
+ export { provideCursorLayerRef, useCursorLayerRef };
@@ -1,5 +1,5 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
1
+ import { createContext } from "../utils/createContext.mjs";
2
2
  //#region src/context/graphicalLayerContext.ts
3
- var [t, n] = e("GraphicalLayerContext");
3
+ var [useGraphicalLayerRef, provideGraphicalLayerRef] = createContext("GraphicalLayerContext");
4
4
  //#endregion
5
- export { n as provideGraphicalLayerRef, t as useGraphicalLayerRef };
5
+ export { provideGraphicalLayerRef, useGraphicalLayerRef };
@@ -1,5 +1,5 @@
1
- import { createContext as e } from "../utils/createContext.mjs";
1
+ import { createContext } from "../utils/createContext.mjs";
2
2
  //#region src/context/labelLayerContext.ts
3
- var [t, n] = e("LabelLayerContext");
3
+ var [useLabelLayerRef, provideLabelLayerRef] = createContext("LabelLayerContext");
4
4
  //#endregion
5
- export { n as provideLabelLayerRef, t as useLabelLayerRef };
5
+ export { provideLabelLayerRef, useLabelLayerRef };
@@ -1,8 +1,8 @@
1
- import { computed as e, inject as t } from "vue";
1
+ import { computed, inject } from "vue";
2
2
  //#region src/context/polarLabelViewBoxContext.ts
3
- var n = Symbol("polar-label-view-box");
4
- function r() {
5
- return t(n, e(() => void 0));
3
+ var POLAR_LABEL_VIEW_BOX_KEY = Symbol("polar-label-view-box");
4
+ function usePolarLabelViewBox() {
5
+ return inject(POLAR_LABEL_VIEW_BOX_KEY, computed(() => void 0));
6
6
  }
7
7
  //#endregion
8
- export { n as POLAR_LABEL_VIEW_BOX_KEY, r as usePolarLabelViewBox };
8
+ export { POLAR_LABEL_VIEW_BOX_KEY, usePolarLabelViewBox };
@@ -1,15 +1,17 @@
1
- import { getBandSizeOfAxis as e } from "../utils/chart.mjs";
2
- import { selectTooltipAxis as t, selectTooltipAxisScale as n, selectTooltipAxisTicks as r } from "../state/selectors/tooltipSelectors.mjs";
3
- import { useAppSelector as i } from "../state/hooks.mjs";
4
- import { computed as a } from "vue";
1
+ import { getBandSizeOfAxis } from "../utils/chart.mjs";
2
+ import { selectTooltipAxis, selectTooltipAxisScale, selectTooltipAxisTicks } from "../state/selectors/tooltipSelectors.mjs";
3
+ import { useAppSelector } from "../state/hooks.mjs";
4
+ import { computed } from "vue";
5
5
  //#region src/context/useTooltipAxis.ts
6
- var o = () => i(t);
7
- function s() {
8
- let t = o(), s = i(r), c = i(n);
9
- return a(() => e({
10
- ...t.value,
11
- scale: c.value
12
- }, s.value));
6
+ var useTooltipAxis = () => useAppSelector(selectTooltipAxis);
7
+ function useTooltipAxisBandSize() {
8
+ const tooltipAxis = useTooltipAxis();
9
+ const tooltipTicks = useAppSelector(selectTooltipAxisTicks);
10
+ const tooltipAxisScale = useAppSelector(selectTooltipAxisScale);
11
+ return computed(() => getBandSizeOfAxis({
12
+ ...tooltipAxis.value,
13
+ scale: tooltipAxisScale.value
14
+ }, tooltipTicks.value));
13
15
  }
14
16
  //#endregion
15
- export { s as useTooltipAxisBandSize };
17
+ export { useTooltipAxisBandSize };