@mui/x-charts 8.0.0-alpha.1 → 8.0.0-alpha.3

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 (278) hide show
  1. package/BarChart/BarChart.js +0 -4
  2. package/BarChart/BarLabel/BarLabel.d.ts +298 -298
  3. package/CHANGELOG.md +330 -7
  4. package/ChartContainer/ChartContainer.d.ts +24 -0
  5. package/ChartContainer/ChartContainer.js +26 -10
  6. package/ChartContainer/useChartContainerProps.d.ts +0 -1
  7. package/ChartContainer/useChartContainerProps.js +3 -4
  8. package/ChartsAxis/axisClasses.js +2 -1
  9. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +3 -3
  10. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +3 -3
  11. package/ChartsLegend/chartsLegendClasses.js +2 -1
  12. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  13. package/ChartsSurface/ChartsSurface.d.ts +14 -0
  14. package/ChartsSurface/ChartsSurface.js +38 -6
  15. package/ChartsTooltip/ChartsTooltip.js +2 -20
  16. package/ChartsTooltip/ChartsTooltipContainer.js +5 -23
  17. package/ChartsTooltip/ChartsTooltipTable.js +2 -2
  18. package/ChartsTooltip/useAxisTooltip.js +3 -3
  19. package/ChartsTooltip/useItemTooltip.d.ts +2 -3
  20. package/ChartsTooltip/useItemTooltip.js +3 -3
  21. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
  22. package/ChartsXAxis/ChartsXAxis.js +3 -17
  23. package/ChartsYAxis/ChartsYAxis.js +2 -17
  24. package/Gauge/Gauge.d.ts +1 -1
  25. package/Gauge/GaugeContainer.d.ts +2 -2
  26. package/Gauge/GaugeContainer.js +14 -47
  27. package/LineChart/CircleMarkElement.js +3 -3
  28. package/LineChart/LineChart.js +0 -4
  29. package/LineChart/LineHighlightPlot.js +3 -3
  30. package/LineChart/MarkElement.js +3 -3
  31. package/PieChart/PieArc.js +11 -5
  32. package/PieChart/PieArcPlot.js +9 -13
  33. package/PieChart/PieChart.js +0 -4
  34. package/ScatterChart/Scatter.js +3 -3
  35. package/ScatterChart/ScatterChart.js +0 -4
  36. package/SparkLineChart/SparkLineChart.js +0 -4
  37. package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
  38. package/context/ChartDataProvider/ChartDataProvider.d.ts +27 -0
  39. package/context/ChartDataProvider/ChartDataProvider.js +38 -18
  40. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +18 -22
  41. package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
  42. package/context/ChartProvider/ChartContext.d.ts +6 -0
  43. package/context/ChartProvider/ChartContext.js +8 -0
  44. package/context/ChartProvider/ChartProvider.d.ts +4 -0
  45. package/context/ChartProvider/ChartProvider.js +19 -0
  46. package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
  47. package/context/ChartProvider/index.d.ts +3 -0
  48. package/context/ChartProvider/index.js +3 -0
  49. package/context/ChartProvider/useChartContext.d.ts +3 -0
  50. package/context/ChartProvider/useChartContext.js +11 -0
  51. package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +1 -6
  52. package/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
  53. package/context/InteractionSelectors.d.ts +72 -49
  54. package/context/SizeProvider/Size.types.d.ts +2 -2
  55. package/context/SizeProvider/SizeContext.js +3 -1
  56. package/context/SizeProvider/useChartContainerDimensions.d.ts +1 -1
  57. package/context/SizeProvider/useChartContainerDimensions.js +5 -1
  58. package/hooks/useAxisEvents.js +1 -1
  59. package/hooks/useChartId.js +5 -6
  60. package/hooks/useInteractionItemProps.js +4 -2
  61. package/hooks/useSvgRef.d.ts +1 -1
  62. package/hooks/useSvgRef.js +4 -8
  63. package/index.js +1 -1
  64. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -5
  65. package/internals/defaultizeColor.d.ts +1 -1
  66. package/internals/index.d.ts +1 -3
  67. package/internals/index.js +1 -3
  68. package/internals/plugins/allPlugins.d.ts +1 -0
  69. package/internals/plugins/allPlugins.js +3 -0
  70. package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
  71. package/internals/plugins/corePlugins/corePlugins.js +7 -0
  72. package/internals/plugins/corePlugins/index.d.ts +2 -0
  73. package/internals/plugins/corePlugins/index.js +1 -0
  74. package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
  75. package/internals/plugins/corePlugins/useChartId/index.js +1 -0
  76. package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
  77. package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
  78. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
  79. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
  80. package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
  81. package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
  82. package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
  83. package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
  84. package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
  85. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
  86. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
  87. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
  88. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
  89. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
  90. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
  91. package/internals/plugins/models/chart.d.ts +14 -0
  92. package/internals/plugins/models/chart.js +1 -0
  93. package/internals/plugins/models/helpers.d.ts +7 -0
  94. package/internals/plugins/models/helpers.js +1 -0
  95. package/internals/plugins/models/index.d.ts +3 -35
  96. package/internals/plugins/models/index.js +3 -1
  97. package/internals/plugins/models/plugin.d.ts +75 -0
  98. package/internals/plugins/models/plugin.js +1 -0
  99. package/internals/plugins/utils/ChartStore.d.ts +9 -8
  100. package/internals/plugins/utils/ChartStore.js +0 -2
  101. package/internals/plugins/utils/selectors.d.ts +2 -2
  102. package/internals/store/useCharts.d.ts +14 -0
  103. package/internals/store/useCharts.js +72 -0
  104. package/internals/store/useCharts.types.d.ts +5 -0
  105. package/internals/store/useCharts.types.js +1 -0
  106. package/internals/store/useSelector.d.ts +4 -0
  107. package/internals/store/useStore.d.ts +3 -0
  108. package/{modern/internals → internals/store}/useStore.js +6 -6
  109. package/models/axis.d.ts +1 -13
  110. package/modern/BarChart/BarChart.js +0 -4
  111. package/modern/ChartContainer/ChartContainer.js +26 -10
  112. package/modern/ChartContainer/useChartContainerProps.js +3 -4
  113. package/modern/ChartsAxis/axisClasses.js +2 -1
  114. package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +3 -3
  115. package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +3 -3
  116. package/modern/ChartsLegend/chartsLegendClasses.js +2 -1
  117. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  118. package/modern/ChartsSurface/ChartsSurface.js +38 -6
  119. package/modern/ChartsTooltip/ChartsTooltip.js +2 -20
  120. package/modern/ChartsTooltip/ChartsTooltipContainer.js +5 -23
  121. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -2
  122. package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
  123. package/modern/ChartsTooltip/useItemTooltip.js +3 -3
  124. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
  125. package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
  126. package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
  127. package/modern/Gauge/GaugeContainer.js +14 -47
  128. package/modern/LineChart/CircleMarkElement.js +3 -3
  129. package/modern/LineChart/LineChart.js +0 -4
  130. package/modern/LineChart/LineHighlightPlot.js +3 -3
  131. package/modern/LineChart/MarkElement.js +3 -3
  132. package/modern/PieChart/PieArc.js +11 -5
  133. package/modern/PieChart/PieArcPlot.js +9 -13
  134. package/modern/PieChart/PieChart.js +0 -4
  135. package/modern/ScatterChart/Scatter.js +3 -3
  136. package/modern/ScatterChart/ScatterChart.js +0 -4
  137. package/modern/SparkLineChart/SparkLineChart.js +0 -4
  138. package/modern/context/ChartDataProvider/ChartDataProvider.js +38 -18
  139. package/modern/context/ChartProvider/ChartContext.js +8 -0
  140. package/modern/context/ChartProvider/ChartProvider.js +19 -0
  141. package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
  142. package/modern/context/ChartProvider/index.js +3 -0
  143. package/modern/context/ChartProvider/useChartContext.js +11 -0
  144. package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
  145. package/modern/context/SizeProvider/SizeContext.js +3 -1
  146. package/modern/context/SizeProvider/useChartContainerDimensions.js +5 -1
  147. package/modern/hooks/useAxisEvents.js +1 -1
  148. package/modern/hooks/useChartId.js +5 -6
  149. package/modern/hooks/useInteractionItemProps.js +4 -2
  150. package/modern/hooks/useSvgRef.js +4 -8
  151. package/modern/index.js +1 -1
  152. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -5
  153. package/modern/internals/index.js +1 -3
  154. package/modern/internals/plugins/allPlugins.js +3 -0
  155. package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
  156. package/modern/internals/plugins/corePlugins/index.js +1 -0
  157. package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
  158. package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
  159. package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
  160. package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
  161. package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
  162. package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
  163. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
  164. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
  165. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
  166. package/modern/internals/plugins/models/chart.js +1 -0
  167. package/modern/internals/plugins/models/helpers.js +1 -0
  168. package/modern/internals/plugins/models/index.js +3 -1
  169. package/modern/internals/plugins/models/plugin.js +1 -0
  170. package/modern/internals/plugins/utils/ChartStore.js +0 -2
  171. package/modern/internals/store/useCharts.js +72 -0
  172. package/modern/internals/store/useCharts.types.js +1 -0
  173. package/{internals → modern/internals/store}/useStore.js +6 -6
  174. package/node/BarChart/BarChart.js +0 -4
  175. package/node/ChartContainer/ChartContainer.js +26 -10
  176. package/node/ChartContainer/useChartContainerProps.js +3 -4
  177. package/node/ChartsAxis/axisClasses.js +5 -3
  178. package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
  179. package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
  180. package/node/ChartsLegend/chartsLegendClasses.js +5 -3
  181. package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  182. package/node/ChartsSurface/ChartsSurface.js +37 -5
  183. package/node/ChartsTooltip/ChartsTooltip.js +2 -20
  184. package/node/ChartsTooltip/ChartsTooltipContainer.js +6 -24
  185. package/node/ChartsTooltip/ChartsTooltipTable.js +3 -3
  186. package/node/ChartsTooltip/useAxisTooltip.js +4 -4
  187. package/node/ChartsTooltip/useItemTooltip.js +4 -4
  188. package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
  189. package/node/ChartsXAxis/ChartsXAxis.js +3 -17
  190. package/node/ChartsYAxis/ChartsYAxis.js +2 -17
  191. package/node/Gauge/GaugeContainer.js +13 -46
  192. package/node/LineChart/CircleMarkElement.js +4 -4
  193. package/node/LineChart/LineChart.js +0 -4
  194. package/node/LineChart/LineHighlightPlot.js +4 -4
  195. package/node/LineChart/MarkElement.js +4 -4
  196. package/node/PieChart/PieArc.js +11 -5
  197. package/node/PieChart/PieArcPlot.js +9 -13
  198. package/node/PieChart/PieChart.js +0 -4
  199. package/node/ScatterChart/Scatter.js +4 -4
  200. package/node/ScatterChart/ScatterChart.js +0 -4
  201. package/node/SparkLineChart/SparkLineChart.js +0 -4
  202. package/node/context/ChartDataProvider/ChartDataProvider.js +38 -18
  203. package/node/context/ChartProvider/ChartContext.js +15 -0
  204. package/node/context/ChartProvider/ChartProvider.js +24 -0
  205. package/node/context/ChartProvider/index.js +38 -0
  206. package/node/context/ChartProvider/useChartContext.js +18 -0
  207. package/node/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
  208. package/node/context/SizeProvider/SizeContext.js +3 -1
  209. package/node/context/SizeProvider/useChartContainerDimensions.js +5 -1
  210. package/node/hooks/useAxisEvents.js +1 -1
  211. package/node/hooks/useChartId.js +5 -7
  212. package/node/hooks/useInteractionItemProps.js +4 -2
  213. package/node/hooks/useSvgRef.js +4 -9
  214. package/node/index.js +1 -1
  215. package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -4
  216. package/node/internals/index.js +4 -28
  217. package/node/internals/plugins/allPlugins.js +10 -0
  218. package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
  219. package/node/internals/plugins/corePlugins/index.js +12 -0
  220. package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
  221. package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
  222. package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
  223. package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
  224. package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
  225. package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
  226. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
  227. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
  228. package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
  229. package/node/internals/plugins/models/chart.js +5 -0
  230. package/node/internals/plugins/models/helpers.js +5 -0
  231. package/node/internals/plugins/models/index.js +33 -0
  232. package/node/internals/plugins/models/plugin.js +5 -0
  233. package/node/internals/plugins/utils/ChartStore.js +0 -2
  234. package/node/internals/store/useCharts.js +80 -0
  235. package/node/internals/store/useCharts.types.js +5 -0
  236. package/node/internals/{useStore.js → store/useStore.js} +6 -7
  237. package/package.json +4 -4
  238. package/ChartContainer/ResizableContainer.d.ts +0 -22
  239. package/ChartContainer/ResizableContainer.js +0 -60
  240. package/context/InteractionProvider.d.ts +0 -7
  241. package/context/InteractionProvider.js +0 -22
  242. package/context/SvgRefProvider/SvgRef.types.d.ts +0 -8
  243. package/context/SvgRefProvider/SvgRefContext.d.ts +0 -4
  244. package/context/SvgRefProvider/SvgRefContext.js +0 -17
  245. package/context/SvgRefProvider/SvgRefProvider.d.ts +0 -3
  246. package/context/SvgRefProvider/SvgRefProvider.js +0 -24
  247. package/context/SvgRefProvider/index.d.ts +0 -4
  248. package/context/SvgRefProvider/index.js +0 -4
  249. package/context/SvgRefProvider/useSurfaceRef.d.ts +0 -2
  250. package/context/SvgRefProvider/useSurfaceRef.js +0 -14
  251. package/internals/plugins/utils/ChartsStore.d.ts +0 -12
  252. package/internals/plugins/utils/ChartsStore.js +0 -26
  253. package/internals/useCharts.d.ts +0 -6
  254. package/internals/useCharts.js +0 -29
  255. package/internals/useSelector.d.ts +0 -4
  256. package/internals/useStore.d.ts +0 -2
  257. package/modern/ChartContainer/ResizableContainer.js +0 -60
  258. package/modern/context/InteractionProvider.js +0 -22
  259. package/modern/context/SvgRefProvider/SvgRefContext.js +0 -17
  260. package/modern/context/SvgRefProvider/SvgRefProvider.js +0 -24
  261. package/modern/context/SvgRefProvider/index.js +0 -4
  262. package/modern/context/SvgRefProvider/useSurfaceRef.js +0 -14
  263. package/modern/internals/plugins/utils/ChartsStore.js +0 -26
  264. package/modern/internals/useCharts.js +0 -29
  265. package/node/ChartContainer/ResizableContainer.js +0 -68
  266. package/node/context/InteractionProvider.js +0 -28
  267. package/node/context/SvgRefProvider/SvgRefContext.js +0 -23
  268. package/node/context/SvgRefProvider/SvgRefProvider.js +0 -31
  269. package/node/context/SvgRefProvider/index.js +0 -49
  270. package/node/context/SvgRefProvider/useSurfaceRef.js +0 -20
  271. package/node/internals/plugins/utils/ChartsStore.js +0 -33
  272. package/node/internals/useCharts.js +0 -36
  273. /package/context/{SvgRefProvider/SvgRef.types.js → ChartProvider/ChartProvider.types.js} +0 -0
  274. /package/{modern/context/SvgRefProvider/SvgRef.types.js → internals/plugins/corePlugins/useChartId/useChartId.types.js} +0 -0
  275. /package/internals/{useSelector.js → store/useSelector.js} +0 -0
  276. /package/modern/internals/{useSelector.js → store/useSelector.js} +0 -0
  277. /package/node/context/{SvgRefProvider/SvgRef.types.js → ChartProvider/ChartProvider.types.js} +0 -0
  278. /package/node/internals/{useSelector.js → store/useSelector.js} +0 -0
@@ -0,0 +1,9 @@
1
+ import { createSelector } from "../../utils/selectors.js";
2
+ const selectorChartIdState = state => state.id;
3
+
4
+ /**
5
+ * Get the id attribute of the chart.
6
+ * @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
7
+ * @returns {string} The id attribute of the chart.
8
+ */
9
+ export const selectorChartId = createSelector(selectorChartIdState, idState => idState.chartId);
@@ -0,0 +1,20 @@
1
+ import { ChartPluginSignature } from '../../models';
2
+ export interface UseChartIdParameters {
3
+ /**
4
+ * This prop is used to help implement the accessibility logic.
5
+ * If you don't provide this prop. It falls back to a randomly generated id.
6
+ */
7
+ id?: string;
8
+ }
9
+ export type UseChartIdDefaultizedParameters = UseChartIdParameters;
10
+ export interface UseChartIdState {
11
+ id: {
12
+ chartId: string;
13
+ providedChartId: string | undefined;
14
+ };
15
+ }
16
+ export type UseChartIdSignature = ChartPluginSignature<{
17
+ params: UseChartIdParameters;
18
+ defaultizedParams: UseChartIdDefaultizedParameters;
19
+ state: UseChartIdState;
20
+ }>;
@@ -0,0 +1 @@
1
+ export declare const createChartDefaultId: () => string;
@@ -0,0 +1,5 @@
1
+ let globalChartDefaultId = 0;
2
+ export const createChartDefaultId = () => {
3
+ globalChartDefaultId += 1;
4
+ return `mui-chart-${globalChartDefaultId}`;
5
+ };
@@ -0,0 +1,3 @@
1
+ export { useChartInteraction } from './useChartInteraction';
2
+ export * from './useChartInteraction.selectors';
3
+ export type { UseChartInteractionSignature } from './useChartInteraction.types';
@@ -0,0 +1,2 @@
1
+ export { useChartInteraction } from "./useChartInteraction.js";
2
+ export * from "./useChartInteraction.selectors.js";
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from '../../models';
2
+ import { UseChartInteractionSignature } from './useChartInteraction.types';
3
+ export declare const useChartInteraction: ChartPlugin<UseChartInteractionSignature>;
@@ -0,0 +1,73 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import useEventCallback from '@mui/utils/useEventCallback';
3
+ export const useChartInteraction = ({
4
+ store
5
+ }) => {
6
+ const cleanInteraction = useEventCallback(() => {
7
+ store.update(prev => _extends({}, prev, {
8
+ interaction: _extends({}, prev.interaction, {
9
+ axis: {
10
+ x: null,
11
+ y: null
12
+ },
13
+ item: null
14
+ })
15
+ }));
16
+ });
17
+ const setItemInteraction = useEventCallback(newItem => {
18
+ store.update(prev => _extends({}, prev, {
19
+ interaction: _extends({}, prev.interaction, {
20
+ item: newItem
21
+ })
22
+ }));
23
+ });
24
+ const setAxisInteraction = useEventCallback(({
25
+ x: newStateX,
26
+ y: newStateY
27
+ }) => {
28
+ store.update(prev => _extends({}, prev, {
29
+ interaction: _extends({}, prev.interaction, {
30
+ axis: _extends({}, prev.interaction.axis, prev.interaction.axis.x?.index !== newStateX?.index || prev.interaction.axis.x?.value !== newStateX?.value ? {
31
+ x: newStateX
32
+ } : {}, prev.interaction.axis.y?.index !== newStateY?.index || prev.interaction.axis.y?.value !== newStateY?.value ? {
33
+ y: newStateY
34
+ } : {})
35
+ })
36
+ }));
37
+ });
38
+ const enableVoronoid = useEventCallback(() => {
39
+ store.update(prev => _extends({}, prev, {
40
+ interaction: _extends({}, prev.interaction, {
41
+ isVoronoiEnabled: true
42
+ })
43
+ }));
44
+ });
45
+ const disableVoronoid = useEventCallback(() => {
46
+ store.update(prev => _extends({}, prev, {
47
+ interaction: _extends({}, prev.interaction, {
48
+ isVoronoiEnabled: false
49
+ })
50
+ }));
51
+ });
52
+ return {
53
+ params: {},
54
+ instance: {
55
+ cleanInteraction,
56
+ setItemInteraction,
57
+ setAxisInteraction,
58
+ enableVoronoid,
59
+ disableVoronoid
60
+ }
61
+ };
62
+ };
63
+ useChartInteraction.getInitialState = () => ({
64
+ interaction: {
65
+ item: null,
66
+ axis: {
67
+ x: null,
68
+ y: null
69
+ },
70
+ isVoronoiEnabled: false
71
+ }
72
+ });
73
+ useChartInteraction.params = {};
@@ -0,0 +1,376 @@
1
+ import { ChartRootSelector } from '../../utils/selectors';
2
+ import { UseChartInteractionSignature } from './useChartInteraction.types';
3
+ export declare const selectorChartsInteractionItem: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
4
+ cacheKey: import("../../models").ChartStateCacheKey;
5
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
6
+ clearCache: () => void;
7
+ resultsCount: () => number;
8
+ resetResultsCount: () => void;
9
+ } & {
10
+ resultFunc: (resultFuncArgs_0: {
11
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
12
+ axis: import("./useChartInteraction.types").AxisInteractionData;
13
+ isVoronoiEnabled?: boolean;
14
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null;
15
+ memoizedResultFunc: ((resultFuncArgs_0: {
16
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
17
+ axis: import("./useChartInteraction.types").AxisInteractionData;
18
+ isVoronoiEnabled?: boolean;
19
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
20
+ clearCache: () => void;
21
+ resultsCount: () => number;
22
+ resetResultsCount: () => void;
23
+ };
24
+ lastResult: () => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null;
25
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
26
+ recomputations: () => number;
27
+ resetRecomputations: () => void;
28
+ dependencyRecomputations: () => number;
29
+ resetDependencyRecomputations: () => void;
30
+ } & {
31
+ argsMemoize: typeof import("reselect").weakMapMemoize;
32
+ memoize: typeof import("reselect").weakMapMemoize;
33
+ };
34
+ export declare const selectorChartsInteractionAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
35
+ cacheKey: import("../../models").ChartStateCacheKey;
36
+ }) => import("./useChartInteraction.types").AxisInteractionData) & {
37
+ clearCache: () => void;
38
+ resultsCount: () => number;
39
+ resetResultsCount: () => void;
40
+ } & {
41
+ resultFunc: (resultFuncArgs_0: {
42
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
43
+ axis: import("./useChartInteraction.types").AxisInteractionData;
44
+ isVoronoiEnabled?: boolean;
45
+ }) => import("./useChartInteraction.types").AxisInteractionData;
46
+ memoizedResultFunc: ((resultFuncArgs_0: {
47
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
48
+ axis: import("./useChartInteraction.types").AxisInteractionData;
49
+ isVoronoiEnabled?: boolean;
50
+ }) => import("./useChartInteraction.types").AxisInteractionData) & {
51
+ clearCache: () => void;
52
+ resultsCount: () => number;
53
+ resetResultsCount: () => void;
54
+ };
55
+ lastResult: () => import("./useChartInteraction.types").AxisInteractionData;
56
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
57
+ recomputations: () => number;
58
+ resetRecomputations: () => void;
59
+ dependencyRecomputations: () => number;
60
+ resetDependencyRecomputations: () => void;
61
+ } & {
62
+ argsMemoize: typeof import("reselect").weakMapMemoize;
63
+ memoize: typeof import("reselect").weakMapMemoize;
64
+ };
65
+ export declare const selectorChartsInteractionXAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
66
+ cacheKey: import("../../models").ChartStateCacheKey;
67
+ }) => {
68
+ value: number | Date | string;
69
+ index: number;
70
+ } | null) & {
71
+ clearCache: () => void;
72
+ resultsCount: () => number;
73
+ resetResultsCount: () => void;
74
+ } & {
75
+ resultFunc: (resultFuncArgs_0: {
76
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
77
+ axis: import("./useChartInteraction.types").AxisInteractionData;
78
+ isVoronoiEnabled?: boolean;
79
+ }) => {
80
+ value: number | Date | string;
81
+ index: number;
82
+ } | null;
83
+ memoizedResultFunc: ((resultFuncArgs_0: {
84
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
85
+ axis: import("./useChartInteraction.types").AxisInteractionData;
86
+ isVoronoiEnabled?: boolean;
87
+ }) => {
88
+ value: number | Date | string;
89
+ index: number;
90
+ } | null) & {
91
+ clearCache: () => void;
92
+ resultsCount: () => number;
93
+ resetResultsCount: () => void;
94
+ };
95
+ lastResult: () => {
96
+ value: number | Date | string;
97
+ index: number;
98
+ } | null;
99
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
100
+ recomputations: () => number;
101
+ resetRecomputations: () => void;
102
+ dependencyRecomputations: () => number;
103
+ resetDependencyRecomputations: () => void;
104
+ } & {
105
+ argsMemoize: typeof import("reselect").weakMapMemoize;
106
+ memoize: typeof import("reselect").weakMapMemoize;
107
+ };
108
+ export declare const selectorChartsInteractionYAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
109
+ cacheKey: import("../../models").ChartStateCacheKey;
110
+ }) => {
111
+ value: number | Date | string;
112
+ index: number;
113
+ } | null) & {
114
+ clearCache: () => void;
115
+ resultsCount: () => number;
116
+ resetResultsCount: () => void;
117
+ } & {
118
+ resultFunc: (resultFuncArgs_0: {
119
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
120
+ axis: import("./useChartInteraction.types").AxisInteractionData;
121
+ isVoronoiEnabled?: boolean;
122
+ }) => {
123
+ value: number | Date | string;
124
+ index: number;
125
+ } | null;
126
+ memoizedResultFunc: ((resultFuncArgs_0: {
127
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
128
+ axis: import("./useChartInteraction.types").AxisInteractionData;
129
+ isVoronoiEnabled?: boolean;
130
+ }) => {
131
+ value: number | Date | string;
132
+ index: number;
133
+ } | null) & {
134
+ clearCache: () => void;
135
+ resultsCount: () => number;
136
+ resetResultsCount: () => void;
137
+ };
138
+ lastResult: () => {
139
+ value: number | Date | string;
140
+ index: number;
141
+ } | null;
142
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
143
+ recomputations: () => number;
144
+ resetRecomputations: () => void;
145
+ dependencyRecomputations: () => number;
146
+ resetDependencyRecomputations: () => void;
147
+ } & {
148
+ argsMemoize: typeof import("reselect").weakMapMemoize;
149
+ memoize: typeof import("reselect").weakMapMemoize;
150
+ };
151
+ export declare const selectorChartsInteractionItemIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
152
+ cacheKey: import("../../models").ChartStateCacheKey;
153
+ }) => boolean) & {
154
+ clearCache: () => void;
155
+ resultsCount: () => number;
156
+ resetResultsCount: () => void;
157
+ } & {
158
+ resultFunc: (resultFuncArgs_0: import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) => boolean;
159
+ memoizedResultFunc: ((resultFuncArgs_0: import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) => boolean) & {
160
+ clearCache: () => void;
161
+ resultsCount: () => number;
162
+ resetResultsCount: () => void;
163
+ };
164
+ lastResult: () => boolean;
165
+ dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
166
+ cacheKey: import("../../models").ChartStateCacheKey;
167
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
168
+ clearCache: () => void;
169
+ resultsCount: () => number;
170
+ resetResultsCount: () => void;
171
+ } & {
172
+ resultFunc: (resultFuncArgs_0: {
173
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
174
+ axis: import("./useChartInteraction.types").AxisInteractionData;
175
+ isVoronoiEnabled?: boolean;
176
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null;
177
+ memoizedResultFunc: ((resultFuncArgs_0: {
178
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
179
+ axis: import("./useChartInteraction.types").AxisInteractionData;
180
+ isVoronoiEnabled?: boolean;
181
+ }) => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null) & {
182
+ clearCache: () => void;
183
+ resultsCount: () => number;
184
+ resetResultsCount: () => void;
185
+ };
186
+ lastResult: () => import("../../../..").BarItemIdentifier | import("../../../..").ScatterItemIdentifier | import("../../../..").LineItemIdentifier | import("../../../..").PieItemIdentifier | null;
187
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
188
+ recomputations: () => number;
189
+ resetRecomputations: () => void;
190
+ dependencyRecomputations: () => number;
191
+ resetDependencyRecomputations: () => void;
192
+ } & {
193
+ argsMemoize: typeof import("reselect").weakMapMemoize;
194
+ memoize: typeof import("reselect").weakMapMemoize;
195
+ }];
196
+ recomputations: () => number;
197
+ resetRecomputations: () => void;
198
+ dependencyRecomputations: () => number;
199
+ resetDependencyRecomputations: () => void;
200
+ } & {
201
+ argsMemoize: typeof import("reselect").weakMapMemoize;
202
+ memoize: typeof import("reselect").weakMapMemoize;
203
+ };
204
+ export declare const selectorChartsInteractionXAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
205
+ cacheKey: import("../../models").ChartStateCacheKey;
206
+ }) => boolean) & {
207
+ clearCache: () => void;
208
+ resultsCount: () => number;
209
+ resetResultsCount: () => void;
210
+ } & {
211
+ resultFunc: (resultFuncArgs_0: {
212
+ value: number | Date | string;
213
+ index: number;
214
+ } | null) => boolean;
215
+ memoizedResultFunc: ((resultFuncArgs_0: {
216
+ value: number | Date | string;
217
+ index: number;
218
+ } | null) => boolean) & {
219
+ clearCache: () => void;
220
+ resultsCount: () => number;
221
+ resetResultsCount: () => void;
222
+ };
223
+ lastResult: () => boolean;
224
+ dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
225
+ cacheKey: import("../../models").ChartStateCacheKey;
226
+ }) => {
227
+ value: number | Date | string;
228
+ index: number;
229
+ } | null) & {
230
+ clearCache: () => void;
231
+ resultsCount: () => number;
232
+ resetResultsCount: () => void;
233
+ } & {
234
+ resultFunc: (resultFuncArgs_0: {
235
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
236
+ axis: import("./useChartInteraction.types").AxisInteractionData;
237
+ isVoronoiEnabled?: boolean;
238
+ }) => {
239
+ value: number | Date | string;
240
+ index: number;
241
+ } | null;
242
+ memoizedResultFunc: ((resultFuncArgs_0: {
243
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
244
+ axis: import("./useChartInteraction.types").AxisInteractionData;
245
+ isVoronoiEnabled?: boolean;
246
+ }) => {
247
+ value: number | Date | string;
248
+ index: number;
249
+ } | null) & {
250
+ clearCache: () => void;
251
+ resultsCount: () => number;
252
+ resetResultsCount: () => void;
253
+ };
254
+ lastResult: () => {
255
+ value: number | Date | string;
256
+ index: number;
257
+ } | null;
258
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
259
+ recomputations: () => number;
260
+ resetRecomputations: () => void;
261
+ dependencyRecomputations: () => number;
262
+ resetDependencyRecomputations: () => void;
263
+ } & {
264
+ argsMemoize: typeof import("reselect").weakMapMemoize;
265
+ memoize: typeof import("reselect").weakMapMemoize;
266
+ }];
267
+ recomputations: () => number;
268
+ resetRecomputations: () => void;
269
+ dependencyRecomputations: () => number;
270
+ resetDependencyRecomputations: () => void;
271
+ } & {
272
+ argsMemoize: typeof import("reselect").weakMapMemoize;
273
+ memoize: typeof import("reselect").weakMapMemoize;
274
+ };
275
+ export declare const selectorChartsInteractionYAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
276
+ cacheKey: import("../../models").ChartStateCacheKey;
277
+ }) => boolean) & {
278
+ clearCache: () => void;
279
+ resultsCount: () => number;
280
+ resetResultsCount: () => void;
281
+ } & {
282
+ resultFunc: (resultFuncArgs_0: {
283
+ value: number | Date | string;
284
+ index: number;
285
+ } | null) => boolean;
286
+ memoizedResultFunc: ((resultFuncArgs_0: {
287
+ value: number | Date | string;
288
+ index: number;
289
+ } | null) => boolean) & {
290
+ clearCache: () => void;
291
+ resultsCount: () => number;
292
+ resetResultsCount: () => void;
293
+ };
294
+ lastResult: () => boolean;
295
+ dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
296
+ cacheKey: import("../../models").ChartStateCacheKey;
297
+ }) => {
298
+ value: number | Date | string;
299
+ index: number;
300
+ } | null) & {
301
+ clearCache: () => void;
302
+ resultsCount: () => number;
303
+ resetResultsCount: () => void;
304
+ } & {
305
+ resultFunc: (resultFuncArgs_0: {
306
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
307
+ axis: import("./useChartInteraction.types").AxisInteractionData;
308
+ isVoronoiEnabled?: boolean;
309
+ }) => {
310
+ value: number | Date | string;
311
+ index: number;
312
+ } | null;
313
+ memoizedResultFunc: ((resultFuncArgs_0: {
314
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
315
+ axis: import("./useChartInteraction.types").AxisInteractionData;
316
+ isVoronoiEnabled?: boolean;
317
+ }) => {
318
+ value: number | Date | string;
319
+ index: number;
320
+ } | null) & {
321
+ clearCache: () => void;
322
+ resultsCount: () => number;
323
+ resetResultsCount: () => void;
324
+ };
325
+ lastResult: () => {
326
+ value: number | Date | string;
327
+ index: number;
328
+ } | null;
329
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
330
+ recomputations: () => number;
331
+ resetRecomputations: () => void;
332
+ dependencyRecomputations: () => number;
333
+ resetDependencyRecomputations: () => void;
334
+ } & {
335
+ argsMemoize: typeof import("reselect").weakMapMemoize;
336
+ memoize: typeof import("reselect").weakMapMemoize;
337
+ }];
338
+ recomputations: () => number;
339
+ resetRecomputations: () => void;
340
+ dependencyRecomputations: () => number;
341
+ resetDependencyRecomputations: () => void;
342
+ } & {
343
+ argsMemoize: typeof import("reselect").weakMapMemoize;
344
+ memoize: typeof import("reselect").weakMapMemoize;
345
+ };
346
+ export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
347
+ cacheKey: import("../../models").ChartStateCacheKey;
348
+ }) => boolean | undefined) & {
349
+ clearCache: () => void;
350
+ resultsCount: () => number;
351
+ resetResultsCount: () => void;
352
+ } & {
353
+ resultFunc: (resultFuncArgs_0: {
354
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
355
+ axis: import("./useChartInteraction.types").AxisInteractionData;
356
+ isVoronoiEnabled?: boolean;
357
+ }) => boolean | undefined;
358
+ memoizedResultFunc: ((resultFuncArgs_0: {
359
+ item: null | import("../../..").ChartItemIdentifier<import("../../..").ChartSeriesType>;
360
+ axis: import("./useChartInteraction.types").AxisInteractionData;
361
+ isVoronoiEnabled?: boolean;
362
+ }) => boolean | undefined) & {
363
+ clearCache: () => void;
364
+ resultsCount: () => number;
365
+ resetResultsCount: () => void;
366
+ };
367
+ lastResult: () => boolean | undefined;
368
+ dependencies: [ChartRootSelector<UseChartInteractionSignature>];
369
+ recomputations: () => number;
370
+ resetRecomputations: () => void;
371
+ dependencyRecomputations: () => number;
372
+ resetDependencyRecomputations: () => void;
373
+ } & {
374
+ argsMemoize: typeof import("reselect").weakMapMemoize;
375
+ memoize: typeof import("reselect").weakMapMemoize;
376
+ };
@@ -0,0 +1,10 @@
1
+ import { createSelector } from "../../utils/selectors.js";
2
+ const selectInteraction = state => state.interaction;
3
+ export const selectorChartsInteractionItem = createSelector(selectInteraction, interaction => interaction.item);
4
+ export const selectorChartsInteractionAxis = createSelector(selectInteraction, interaction => interaction.axis);
5
+ export const selectorChartsInteractionXAxis = createSelector(selectInteraction, interaction => interaction.axis.x);
6
+ export const selectorChartsInteractionYAxis = createSelector(selectInteraction, interaction => interaction.axis.y);
7
+ export const selectorChartsInteractionItemIsDefined = createSelector(selectorChartsInteractionItem, item => item !== null);
8
+ export const selectorChartsInteractionXAxisIsDefined = createSelector(selectorChartsInteractionXAxis, x => x !== null);
9
+ export const selectorChartsInteractionYAxisIsDefined = createSelector(selectorChartsInteractionYAxis, y => y !== null);
10
+ export const selectorChartsInteractionIsVoronoiEnabled = createSelector(selectInteraction, interaction => interaction.isVoronoiEnabled);
@@ -0,0 +1,57 @@
1
+ import { ChartPluginSignature } from '../../models';
2
+ import { ChartItemIdentifier, ChartSeriesType } from '../../../../models/seriesType/config';
3
+ export interface UseChartInteractionInstance {
4
+ /**
5
+ * Remove all interaction.
6
+ */
7
+ cleanInteraction: () => void;
8
+ /**
9
+ * Setter for the item the user is interacting with.
10
+ * @param {ChartItemIdentifier} newItem The identifier of the item.
11
+ */
12
+ setItemInteraction: (newItem: ChartItemIdentifier<ChartSeriesType>) => void;
13
+ /**
14
+ * Set the new axis the user is interacting with.
15
+ * @param {Partial<AxisInteractionData>} newAxis The new axis identifier.
16
+ */
17
+ setAxisInteraction: (newAxis: Partial<AxisInteractionData>) => void;
18
+ /**
19
+ * Enable the voronoi computation.
20
+ */
21
+ enableVoronoid: () => void;
22
+ /**
23
+ * Disable the voronoi computation.
24
+ */
25
+ disableVoronoid: () => void;
26
+ }
27
+ export type AxisInteractionData = {
28
+ x: null | {
29
+ value: number | Date | string;
30
+ index: number;
31
+ };
32
+ y: null | {
33
+ value: number | Date | string;
34
+ index: number;
35
+ };
36
+ };
37
+ export interface UseChartInteractionState {
38
+ interaction: {
39
+ /**
40
+ * The item currently interacting.
41
+ */
42
+ item: null | ChartItemIdentifier<ChartSeriesType>;
43
+ /**
44
+ * The x- and y-axes currently interacting.
45
+ */
46
+ axis: AxisInteractionData;
47
+ /**
48
+ * Set to `true` when `VoronoiHandler` is active.
49
+ * Used to prevent collision with mouseEnter events.
50
+ */
51
+ isVoronoiEnabled?: boolean;
52
+ };
53
+ }
54
+ export type UseChartInteractionSignature = ChartPluginSignature<{
55
+ instance: UseChartInteractionInstance;
56
+ state: UseChartInteractionState;
57
+ }>;
@@ -0,0 +1,14 @@
1
+ import type { ChartAnyPluginSignature } from './plugin';
2
+ import type { MergeSignaturesProperty } from './helpers';
3
+ import type { ChartCorePluginSignatures } from '../corePlugins';
4
+ export type ChartInstance<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = MergeSignaturesProperty<[...ChartCorePluginSignatures, ...TSignatures], 'instance'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
5
+ export type ChartPublicAPI<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = MergeSignaturesProperty<[...ChartCorePluginSignatures, ...TSignatures], 'publicAPI'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
6
+ export type ChartStateCacheKey = {
7
+ id: number;
8
+ };
9
+ export type ChartState<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = MergeSignaturesProperty<[...ChartCorePluginSignatures, ...TSignatures], 'state'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'state'>> & {
10
+ /**
11
+ * The key used to identify the chart in the global cache object.
12
+ */
13
+ cacheKey: ChartStateCacheKey;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ChartAnyPluginSignature, ChartPlugin } from './plugin';
2
+ type IsAny<T> = 0 extends 1 & T ? true : false;
3
+ export type OptionalIfEmpty<A extends string, B> = keyof B extends never ? Partial<Record<A, B>> : IsAny<B> extends true ? Partial<Record<A, B>> : Record<A, B>;
4
+ export type MergeSignaturesProperty<TSignatures extends readonly any[], TProperty extends keyof ChartAnyPluginSignature> = TSignatures extends readonly [plugin: infer P, ...otherPlugin: infer R] ? P extends ChartAnyPluginSignature ? P[TProperty] & MergeSignaturesProperty<R, TProperty> : {} : {};
5
+ export type ConvertPluginsIntoSignatures<TPlugins extends readonly ChartPlugin<ChartAnyPluginSignature>[]> = TPlugins extends readonly [plugin: infer TPlugin, ...otherPlugin: infer R] ? R extends readonly ChartPlugin<any>[] ? TPlugin extends ChartPlugin<infer TSignature> ? readonly [TSignature, ...ConvertPluginsIntoSignatures<R>] : never : never : [];
6
+ export type ConvertSignaturesIntoPlugins<TSignatures extends readonly ChartAnyPluginSignature[]> = TSignatures extends readonly [signature: infer TSignature, ...otherSignatures: infer R] ? R extends readonly ChartAnyPluginSignature[] ? TSignature extends ChartAnyPluginSignature ? readonly [ChartPlugin<TSignature>, ...ConvertSignaturesIntoPlugins<R>] : never : never : [];
7
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,35 +1,3 @@
1
- import { ChartItemIdentifier, ChartSeriesType } from '../../../models/seriesType/config';
2
- export type ItemInteractionData<T extends ChartSeriesType> = ChartItemIdentifier<T>;
3
- export type AxisInteractionData = {
4
- x: null | {
5
- value: number | Date | string;
6
- index: number;
7
- };
8
- y: null | {
9
- value: number | Date | string;
10
- index: number;
11
- };
12
- };
13
- type InteractionState = {
14
- /**
15
- * The item currently interacting.
16
- */
17
- item: null | ItemInteractionData<ChartSeriesType>;
18
- /**
19
- * The x- and y-axes currently interacting.
20
- */
21
- axis: AxisInteractionData;
22
- /**
23
- * Set to `true` when `VoronoiHandler` is active.
24
- * Used to prevent collision with mouseEnter events.
25
- */
26
- isVoronoiEnabled?: boolean;
27
- };
28
- export type ChartStateCacheKey = {
29
- id: number;
30
- };
31
- export type ChartState = {
32
- interaction: InteractionState;
33
- cacheKey: ChartStateCacheKey;
34
- };
35
- export {};
1
+ export * from './helpers';
2
+ export * from './plugin';
3
+ export * from './chart';
@@ -1 +1,3 @@
1
- export {};
1
+ export * from "./helpers.js";
2
+ export * from "./plugin.js";
3
+ export * from "./chart.js";