@mui/x-charts-premium 9.0.2 → 9.0.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 (214) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/CandlestickChart/CandlestickPlot.js +27 -31
  3. package/CandlestickChart/CandlestickPlot.mjs +27 -31
  4. package/CandlestickChart/CandlestickWebGLProgram.js +0 -3
  5. package/CandlestickChart/CandlestickWebGLProgram.mjs +0 -3
  6. package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
  7. package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
  8. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.mts +35 -0
  9. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.ts +35 -0
  10. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +126 -0
  11. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +120 -0
  12. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.plugins.d.mts +5 -0
  13. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.plugins.d.ts +5 -0
  14. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.plugins.js +9 -0
  15. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.plugins.mjs +3 -0
  16. package/ChartsRadialDataProviderPremium/index.d.mts +3 -0
  17. package/ChartsRadialDataProviderPremium/index.d.ts +3 -0
  18. package/ChartsRadialDataProviderPremium/index.js +20 -0
  19. package/ChartsRadialDataProviderPremium/index.mjs +3 -0
  20. package/ChartsRadialDataProviderPremium/useChartsRadialDataProviderPremiumProps.d.mts +10 -0
  21. package/ChartsRadialDataProviderPremium/useChartsRadialDataProviderPremiumProps.d.ts +10 -0
  22. package/ChartsRadialDataProviderPremium/useChartsRadialDataProviderPremiumProps.js +25 -0
  23. package/ChartsRadialDataProviderPremium/useChartsRadialDataProviderPremiumProps.mjs +19 -0
  24. package/ChartsRadiusAxis/index.d.mts +1 -0
  25. package/ChartsRadiusAxis/index.d.ts +1 -0
  26. package/ChartsRadiusAxis/index.js +16 -0
  27. package/ChartsRadiusAxis/index.mjs +2 -0
  28. package/ChartsRotationAxis/index.d.mts +1 -0
  29. package/ChartsRotationAxis/index.d.ts +1 -0
  30. package/ChartsRotationAxis/index.js +16 -0
  31. package/ChartsRotationAxis/index.mjs +2 -0
  32. package/ChartsWebGLLayer/ChartsWebGLContext.d.mts +5 -0
  33. package/ChartsWebGLLayer/ChartsWebGLContext.d.ts +5 -0
  34. package/ChartsWebGLLayer/ChartsWebGLContext.js +31 -0
  35. package/ChartsWebGLLayer/ChartsWebGLContext.mjs +23 -0
  36. package/ChartsWebGLLayer/ChartsWebGLLayer.d.mts +0 -1
  37. package/ChartsWebGLLayer/ChartsWebGLLayer.d.ts +0 -1
  38. package/ChartsWebGLLayer/ChartsWebGLLayer.js +63 -12
  39. package/ChartsWebGLLayer/ChartsWebGLLayer.mjs +62 -10
  40. package/ChartsWebGLLayer/ChartsWebGLLayer.types.d.mts +26 -0
  41. package/ChartsWebGLLayer/ChartsWebGLLayer.types.d.ts +26 -0
  42. package/ChartsWebGLLayer/ChartsWebGLLayer.types.js +5 -0
  43. package/ChartsWebGLLayer/ChartsWebGLLayer.types.mjs +1 -0
  44. package/ChartsWebGLLayer/ChartsWebGLOrderContext.d.mts +6 -0
  45. package/ChartsWebGLLayer/ChartsWebGLOrderContext.d.ts +6 -0
  46. package/ChartsWebGLLayer/ChartsWebGLOrderContext.js +15 -0
  47. package/ChartsWebGLLayer/ChartsWebGLOrderContext.mjs +10 -0
  48. package/HeatmapPremium/HeatmapPlotPremium.js +2 -2
  49. package/HeatmapPremium/HeatmapPlotPremium.mjs +2 -2
  50. package/HeatmapPremium/webgl/HeatmapWebGLPlot.js +26 -33
  51. package/HeatmapPremium/webgl/HeatmapWebGLPlot.mjs +26 -33
  52. package/RadialBarChart/seriesConfig/axisTooltipGetter.d.mts +2 -0
  53. package/RadialBarChart/seriesConfig/axisTooltipGetter.d.ts +2 -0
  54. package/RadialBarChart/seriesConfig/axisTooltipGetter.js +13 -0
  55. package/RadialBarChart/seriesConfig/axisTooltipGetter.mjs +6 -0
  56. package/RadialBarChart/seriesConfig/descriptionGetter.d.mts +3 -0
  57. package/RadialBarChart/seriesConfig/descriptionGetter.d.ts +3 -0
  58. package/RadialBarChart/seriesConfig/descriptionGetter.js +34 -0
  59. package/RadialBarChart/seriesConfig/descriptionGetter.mjs +28 -0
  60. package/RadialBarChart/seriesConfig/extremums.d.mts +3 -0
  61. package/RadialBarChart/seriesConfig/extremums.d.ts +3 -0
  62. package/RadialBarChart/seriesConfig/extremums.js +44 -0
  63. package/RadialBarChart/seriesConfig/extremums.mjs +36 -0
  64. package/RadialBarChart/seriesConfig/getColor.d.mts +3 -0
  65. package/RadialBarChart/seriesConfig/getColor.d.ts +3 -0
  66. package/RadialBarChart/seriesConfig/getColor.js +61 -0
  67. package/RadialBarChart/seriesConfig/getColor.mjs +55 -0
  68. package/RadialBarChart/seriesConfig/getSeriesWithDefaultValues.d.mts +3 -0
  69. package/RadialBarChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  70. package/RadialBarChart/seriesConfig/getSeriesWithDefaultValues.js +16 -0
  71. package/RadialBarChart/seriesConfig/getSeriesWithDefaultValues.mjs +9 -0
  72. package/RadialBarChart/seriesConfig/index.d.mts +2 -0
  73. package/RadialBarChart/seriesConfig/index.d.ts +2 -0
  74. package/RadialBarChart/seriesConfig/index.js +37 -0
  75. package/RadialBarChart/seriesConfig/index.mjs +30 -0
  76. package/RadialBarChart/seriesConfig/keyboardFocusHandler.d.mts +3 -0
  77. package/RadialBarChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  78. package/RadialBarChart/seriesConfig/keyboardFocusHandler.js +9 -0
  79. package/RadialBarChart/seriesConfig/keyboardFocusHandler.mjs +3 -0
  80. package/RadialBarChart/seriesConfig/legend.d.mts +3 -0
  81. package/RadialBarChart/seriesConfig/legend.d.ts +3 -0
  82. package/RadialBarChart/seriesConfig/legend.js +9 -0
  83. package/RadialBarChart/seriesConfig/legend.mjs +3 -0
  84. package/RadialBarChart/seriesConfig/seriesProcessor.d.mts +3 -0
  85. package/RadialBarChart/seriesConfig/seriesProcessor.d.ts +3 -0
  86. package/RadialBarChart/seriesConfig/seriesProcessor.js +137 -0
  87. package/RadialBarChart/seriesConfig/seriesProcessor.mjs +130 -0
  88. package/RadialBarChart/seriesConfig/tooltip.d.mts +3 -0
  89. package/RadialBarChart/seriesConfig/tooltip.d.ts +3 -0
  90. package/RadialBarChart/seriesConfig/tooltip.js +34 -0
  91. package/RadialBarChart/seriesConfig/tooltip.mjs +28 -0
  92. package/RadialBarChart/seriesConfig/tooltipPosition.d.mts +3 -0
  93. package/RadialBarChart/seriesConfig/tooltipPosition.d.ts +3 -0
  94. package/RadialBarChart/seriesConfig/tooltipPosition.js +11 -0
  95. package/RadialBarChart/seriesConfig/tooltipPosition.mjs +5 -0
  96. package/RadialLineChart/RadialArea.d.mts +12 -0
  97. package/RadialLineChart/RadialArea.d.ts +12 -0
  98. package/RadialLineChart/RadialArea.js +33 -0
  99. package/RadialLineChart/RadialArea.mjs +26 -0
  100. package/RadialLineChart/RadialAreaPlot.d.mts +5 -0
  101. package/RadialLineChart/RadialAreaPlot.d.ts +5 -0
  102. package/RadialLineChart/RadialAreaPlot.js +51 -0
  103. package/RadialLineChart/RadialAreaPlot.mjs +45 -0
  104. package/RadialLineChart/RadialLine.d.mts +12 -0
  105. package/RadialLineChart/RadialLine.d.ts +12 -0
  106. package/RadialLineChart/RadialLine.js +33 -0
  107. package/RadialLineChart/RadialLine.mjs +26 -0
  108. package/RadialLineChart/RadialLineChart.d.mts +62 -0
  109. package/RadialLineChart/RadialLineChart.d.ts +62 -0
  110. package/RadialLineChart/RadialLineChart.js +967 -0
  111. package/RadialLineChart/RadialLineChart.mjs +960 -0
  112. package/RadialLineChart/RadialLineChart.plugins.d.mts +4 -0
  113. package/RadialLineChart/RadialLineChart.plugins.d.ts +4 -0
  114. package/RadialLineChart/RadialLineChart.plugins.js +9 -0
  115. package/RadialLineChart/RadialLineChart.plugins.mjs +3 -0
  116. package/RadialLineChart/RadialLinePlot.d.mts +5 -0
  117. package/RadialLineChart/RadialLinePlot.d.ts +5 -0
  118. package/RadialLineChart/RadialLinePlot.js +50 -0
  119. package/RadialLineChart/RadialLinePlot.mjs +44 -0
  120. package/RadialLineChart/RadialMarkPlot.d.mts +5 -0
  121. package/RadialLineChart/RadialMarkPlot.d.ts +5 -0
  122. package/RadialLineChart/RadialMarkPlot.js +48 -0
  123. package/RadialLineChart/RadialMarkPlot.mjs +42 -0
  124. package/RadialLineChart/index.d.mts +4 -0
  125. package/RadialLineChart/index.d.ts +4 -0
  126. package/RadialLineChart/index.js +49 -0
  127. package/RadialLineChart/index.mjs +4 -0
  128. package/RadialLineChart/radialLineClasses.d.mts +25 -0
  129. package/RadialLineChart/radialLineClasses.d.ts +25 -0
  130. package/RadialLineChart/radialLineClasses.js +30 -0
  131. package/RadialLineChart/radialLineClasses.mjs +21 -0
  132. package/RadialLineChart/seriesConfig/axisTooltipGetter.d.mts +2 -0
  133. package/RadialLineChart/seriesConfig/axisTooltipGetter.d.ts +2 -0
  134. package/RadialLineChart/seriesConfig/axisTooltipGetter.js +13 -0
  135. package/RadialLineChart/seriesConfig/axisTooltipGetter.mjs +6 -0
  136. package/RadialLineChart/seriesConfig/descriptionGetter.d.mts +3 -0
  137. package/RadialLineChart/seriesConfig/descriptionGetter.d.ts +3 -0
  138. package/RadialLineChart/seriesConfig/descriptionGetter.js +39 -0
  139. package/RadialLineChart/seriesConfig/descriptionGetter.mjs +33 -0
  140. package/RadialLineChart/seriesConfig/extremums.d.mts +3 -0
  141. package/RadialLineChart/seriesConfig/extremums.d.ts +3 -0
  142. package/RadialLineChart/seriesConfig/extremums.js +48 -0
  143. package/RadialLineChart/seriesConfig/extremums.mjs +40 -0
  144. package/RadialLineChart/seriesConfig/getColor.d.mts +3 -0
  145. package/RadialLineChart/seriesConfig/getColor.d.ts +3 -0
  146. package/RadialLineChart/seriesConfig/getColor.js +61 -0
  147. package/RadialLineChart/seriesConfig/getColor.mjs +55 -0
  148. package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.d.mts +3 -0
  149. package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  150. package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.js +13 -0
  151. package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.mjs +6 -0
  152. package/RadialLineChart/seriesConfig/index.d.mts +2 -0
  153. package/RadialLineChart/seriesConfig/index.d.ts +2 -0
  154. package/RadialLineChart/seriesConfig/index.js +37 -0
  155. package/RadialLineChart/seriesConfig/index.mjs +30 -0
  156. package/RadialLineChart/seriesConfig/keyboardFocusHandler.d.mts +3 -0
  157. package/RadialLineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  158. package/RadialLineChart/seriesConfig/keyboardFocusHandler.js +9 -0
  159. package/RadialLineChart/seriesConfig/keyboardFocusHandler.mjs +3 -0
  160. package/RadialLineChart/seriesConfig/legend.d.mts +3 -0
  161. package/RadialLineChart/seriesConfig/legend.d.ts +3 -0
  162. package/RadialLineChart/seriesConfig/legend.js +29 -0
  163. package/RadialLineChart/seriesConfig/legend.mjs +23 -0
  164. package/RadialLineChart/seriesConfig/seriesProcessor.d.mts +3 -0
  165. package/RadialLineChart/seriesConfig/seriesProcessor.d.ts +3 -0
  166. package/RadialLineChart/seriesConfig/seriesProcessor.js +142 -0
  167. package/RadialLineChart/seriesConfig/seriesProcessor.mjs +135 -0
  168. package/RadialLineChart/seriesConfig/tooltip.d.mts +3 -0
  169. package/RadialLineChart/seriesConfig/tooltip.d.ts +3 -0
  170. package/RadialLineChart/seriesConfig/tooltip.js +32 -0
  171. package/RadialLineChart/seriesConfig/tooltip.mjs +26 -0
  172. package/RadialLineChart/seriesConfig/tooltipPosition.d.mts +3 -0
  173. package/RadialLineChart/seriesConfig/tooltipPosition.d.ts +3 -0
  174. package/RadialLineChart/seriesConfig/tooltipPosition.js +11 -0
  175. package/RadialLineChart/seriesConfig/tooltipPosition.mjs +5 -0
  176. package/RadialLineChart/useRadialLineChartProps.d.mts +28 -0
  177. package/RadialLineChart/useRadialLineChartProps.d.ts +28 -0
  178. package/RadialLineChart/useRadialLineChartProps.js +99 -0
  179. package/RadialLineChart/useRadialLineChartProps.mjs +92 -0
  180. package/RadialLineChart/useRadialLinePlotData.d.mts +19 -0
  181. package/RadialLineChart/useRadialLinePlotData.d.ts +19 -0
  182. package/RadialLineChart/useRadialLinePlotData.js +79 -0
  183. package/RadialLineChart/useRadialLinePlotData.mjs +72 -0
  184. package/hooks/useRadialLineSeries.d.mts +34 -0
  185. package/hooks/useRadialLineSeries.d.ts +34 -0
  186. package/hooks/useRadialLineSeries.js +45 -0
  187. package/hooks/useRadialLineSeries.mjs +40 -0
  188. package/index.d.mts +7 -1
  189. package/index.d.ts +7 -1
  190. package/index.js +69 -1
  191. package/index.mjs +8 -2
  192. package/models/seriesType/index.d.mts +3 -1
  193. package/models/seriesType/index.d.ts +3 -1
  194. package/models/seriesType/index.js +22 -0
  195. package/models/seriesType/index.mjs +3 -1
  196. package/models/seriesType/radialBar.d.mts +23 -0
  197. package/models/seriesType/radialBar.d.ts +23 -0
  198. package/models/seriesType/radialBar.js +5 -0
  199. package/models/seriesType/radialBar.mjs +1 -0
  200. package/models/seriesType/radialLine.d.mts +26 -0
  201. package/models/seriesType/radialLine.d.ts +26 -0
  202. package/models/seriesType/radialLine.js +5 -0
  203. package/models/seriesType/radialLine.mjs +1 -0
  204. package/package.json +62 -6
  205. package/typeOverloads/modules.d.mts +48 -2
  206. package/typeOverloads/modules.d.ts +48 -2
  207. package/utils/webgl/useWebGLResizeObserver.d.mts +3 -2
  208. package/utils/webgl/useWebGLResizeObserver.d.ts +3 -2
  209. package/utils/webgl/useWebGLResizeObserver.js +3 -4
  210. package/utils/webgl/useWebGLResizeObserver.mjs +3 -4
  211. package/HeatmapPremium/webgl/HeatmapWebGLRenderer.d.mts +0 -4
  212. package/HeatmapPremium/webgl/HeatmapWebGLRenderer.d.ts +0 -4
  213. package/HeatmapPremium/webgl/HeatmapWebGLRenderer.js +0 -21
  214. package/HeatmapPremium/webgl/HeatmapWebGLRenderer.mjs +0 -15
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { ChartsProvider, ChartsSlotsProvider } from '@mui/x-charts/internals';
7
+ import { ChartsLocalizationProvider } from '@mui/x-charts/ChartsLocalizationProvider';
8
+ import { ChartsWatermark, defaultSlotsMaterial } from '@mui/x-charts-pro/internals';
9
+ import { useLicenseVerifier } from '@mui/x-license/internals';
10
+ import { useChartsRadialDataProviderPremiumProps } from "./useChartsRadialDataProviderPremiumProps.mjs";
11
+ import { RADIAL_PREMIUM_PLUGINS } from "./ChartsRadialDataProviderPremium.plugins.mjs";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ const packageInfo = {
14
+ releaseDate: "MTc3NzI0ODAwMDAwMA==",
15
+ version: "9.0.3",
16
+ name: 'x-charts-premium'
17
+ };
18
+ /**
19
+ * Orchestrates the data providers for radial chart components and hooks.
20
+ *
21
+ * Similar to `ChartsDataProviderPremium`, but uses the radial axis plugin instead of the cartesian one,
22
+ * and only supports polar series types.
23
+ *
24
+ * Demos:
25
+ *
26
+ * - [Composition](https://mui.com/x/react-charts/composition/)
27
+ *
28
+ * API:
29
+ *
30
+ * - [ChartsRadialDataProviderPremium API](https://mui.com/x/api/charts/charts-radial-data-provider-premium/)
31
+ */
32
+ function ChartsRadialDataProviderPremium(props) {
33
+ const {
34
+ children,
35
+ localeText,
36
+ chartProviderProps,
37
+ slots,
38
+ slotProps
39
+ } = useChartsRadialDataProviderPremiumProps(_extends({}, props, {
40
+ plugins: props.plugins ?? RADIAL_PREMIUM_PLUGINS
41
+ }));
42
+ useLicenseVerifier(packageInfo);
43
+ return /*#__PURE__*/_jsxs(ChartsProvider, _extends({}, chartProviderProps, {
44
+ children: [/*#__PURE__*/_jsx(ChartsLocalizationProvider, {
45
+ localeText: localeText,
46
+ children: /*#__PURE__*/_jsx(ChartsSlotsProvider, {
47
+ slots: slots,
48
+ slotProps: slotProps,
49
+ defaultSlots: defaultSlotsMaterial,
50
+ children: children
51
+ })
52
+ }), /*#__PURE__*/_jsx(ChartsWatermark, {
53
+ packageInfo: packageInfo
54
+ })]
55
+ }));
56
+ }
57
+ process.env.NODE_ENV !== "production" ? ChartsRadialDataProviderPremium.propTypes = {
58
+ // ----------------------------- Warning --------------------------------
59
+ // | These PropTypes are generated from the TypeScript type definitions |
60
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
61
+ // ----------------------------------------------------------------------
62
+ apiRef: PropTypes.shape({
63
+ current: PropTypes.any
64
+ }),
65
+ /**
66
+ * Color palette used to colorize multiple series.
67
+ * @default rainbowSurgePalette
68
+ */
69
+ colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
70
+ /**
71
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
72
+ */
73
+ height: PropTypes.number,
74
+ /**
75
+ * This prop is used to help implement the accessibility logic.
76
+ * If you don't provide this prop. It falls back to a randomly generated id.
77
+ */
78
+ id: PropTypes.string,
79
+ /**
80
+ * Localized text for chart components.
81
+ */
82
+ localeText: PropTypes.object,
83
+ /**
84
+ * The margin between the SVG and the drawing area.
85
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
86
+ *
87
+ * Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
88
+ */
89
+ margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
90
+ bottom: PropTypes.number,
91
+ left: PropTypes.number,
92
+ right: PropTypes.number,
93
+ top: PropTypes.number
94
+ })]),
95
+ /**
96
+ * The array of series to display.
97
+ * Each type of series has its own specificity.
98
+ * Please refer to the appropriate docs page to learn more about it.
99
+ */
100
+ series: PropTypes.arrayOf(PropTypes.object),
101
+ /**
102
+ * If `true`, animations are skipped.
103
+ * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
104
+ */
105
+ skipAnimation: PropTypes.bool,
106
+ /**
107
+ * The props for the slots.
108
+ */
109
+ slotProps: PropTypes.object,
110
+ /**
111
+ * Slots to customize charts' components.
112
+ */
113
+ slots: PropTypes.object,
114
+ theme: PropTypes.oneOf(['dark', 'light']),
115
+ /**
116
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
117
+ */
118
+ width: PropTypes.number
119
+ } : void 0;
120
+ export { ChartsRadialDataProviderPremium };
@@ -0,0 +1,5 @@
1
+ import { type RadialPluginSignatures } from '@mui/x-charts/ChartsRadialDataProvider';
2
+ import { type PolarChartSeriesType } from '@mui/x-charts/internals';
3
+ import { type UseChartProExportSignature } from '@mui/x-charts-pro/plugins';
4
+ export declare const RADIAL_PREMIUM_PLUGINS: readonly [import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartTooltipSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartInteractionSignature>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartPolarAxisSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartHighlightSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts/internals").UseChartKeyboardNavigationSignature>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartVisibilityManagerSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature>];
5
+ export type RadialPremiumPluginSignatures<SeriesType extends PolarChartSeriesType = PolarChartSeriesType> = [...RadialPluginSignatures<SeriesType>, UseChartProExportSignature];
@@ -0,0 +1,5 @@
1
+ import { type RadialPluginSignatures } from '@mui/x-charts/ChartsRadialDataProvider';
2
+ import { type PolarChartSeriesType } from '@mui/x-charts/internals';
3
+ import { type UseChartProExportSignature } from '@mui/x-charts-pro/plugins';
4
+ export declare const RADIAL_PREMIUM_PLUGINS: readonly [import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartTooltipSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartInteractionSignature>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartPolarAxisSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartHighlightSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts/internals").UseChartKeyboardNavigationSignature>, import("@mui/x-charts/internals").ChartPlugin<import("@mui/x-charts").UseChartVisibilityManagerSignature<any>>, import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature>];
5
+ export type RadialPremiumPluginSignatures<SeriesType extends PolarChartSeriesType = PolarChartSeriesType> = [...RadialPluginSignatures<SeriesType>, UseChartProExportSignature];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RADIAL_PREMIUM_PLUGINS = void 0;
7
+ var _ChartsRadialDataProvider = require("@mui/x-charts/ChartsRadialDataProvider");
8
+ var _plugins = require("@mui/x-charts-pro/plugins");
9
+ const RADIAL_PREMIUM_PLUGINS = exports.RADIAL_PREMIUM_PLUGINS = [..._ChartsRadialDataProvider.RADIAL_PLUGINS, _plugins.useChartProExport];
@@ -0,0 +1,3 @@
1
+ import { RADIAL_PLUGINS } from '@mui/x-charts/ChartsRadialDataProvider';
2
+ import { useChartProExport } from '@mui/x-charts-pro/plugins';
3
+ export const RADIAL_PREMIUM_PLUGINS = [...RADIAL_PLUGINS, useChartProExport];
@@ -0,0 +1,3 @@
1
+ import "../typeOverloads/index.mjs";
2
+ export { ChartsRadialDataProviderPremium, type ChartsRadialDataProviderPremiumProps, type ChartsRadialDataProviderPremiumSlots, type ChartsRadialDataProviderPremiumSlotProps } from "./ChartsRadialDataProviderPremium.mjs";
3
+ export { RADIAL_PREMIUM_PLUGINS, type RadialPremiumPluginSignatures } from "./ChartsRadialDataProviderPremium.plugins.mjs";
@@ -0,0 +1,3 @@
1
+ import "../typeOverloads/index.js";
2
+ export { ChartsRadialDataProviderPremium, type ChartsRadialDataProviderPremiumProps, type ChartsRadialDataProviderPremiumSlots, type ChartsRadialDataProviderPremiumSlotProps } from "./ChartsRadialDataProviderPremium.js";
3
+ export { RADIAL_PREMIUM_PLUGINS, type RadialPremiumPluginSignatures } from "./ChartsRadialDataProviderPremium.plugins.js";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChartsRadialDataProviderPremium", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ChartsRadialDataProviderPremium.ChartsRadialDataProviderPremium;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "RADIAL_PREMIUM_PLUGINS", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _ChartsRadialDataProviderPremium2.RADIAL_PREMIUM_PLUGINS;
16
+ }
17
+ });
18
+ require("../typeOverloads");
19
+ var _ChartsRadialDataProviderPremium = require("./ChartsRadialDataProviderPremium");
20
+ var _ChartsRadialDataProviderPremium2 = require("./ChartsRadialDataProviderPremium.plugins");
@@ -0,0 +1,3 @@
1
+ import "../typeOverloads/index.mjs";
2
+ export { ChartsRadialDataProviderPremium } from "./ChartsRadialDataProviderPremium.mjs";
3
+ export { RADIAL_PREMIUM_PLUGINS } from "./ChartsRadialDataProviderPremium.plugins.mjs";
@@ -0,0 +1,10 @@
1
+ import { type ChartAnyPluginSignature, type PolarChartSeriesType } from '@mui/x-charts/internals';
2
+ import type { ChartsRadialDataProviderPremiumProps } from "./ChartsRadialDataProviderPremium.mjs";
3
+ import type { RadialPremiumPluginSignatures } from "./ChartsRadialDataProviderPremium.plugins.mjs";
4
+ export declare const useChartsRadialDataProviderPremiumProps: <SeriesType extends PolarChartSeriesType = PolarChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = RadialPremiumPluginSignatures<SeriesType>>(props: ChartsRadialDataProviderPremiumProps<SeriesType, TSignatures>) => {
5
+ children: import("react").ReactNode;
6
+ localeText: Partial<import("@mui/x-charts/locales").ChartsLocaleText> | undefined;
7
+ chartProviderProps: import("@mui/x-charts/internals").ChartsProviderProps<"radar" | "radialLine" | "radialBar", TSignatures>;
8
+ slots: Partial<import("@mui/x-charts").ChartsRadialDataProviderSlots> | undefined;
9
+ slotProps: Partial<import("@mui/x-charts").ChartsRadialDataProviderSlotProps> | undefined;
10
+ };
@@ -0,0 +1,10 @@
1
+ import { type ChartAnyPluginSignature, type PolarChartSeriesType } from '@mui/x-charts/internals';
2
+ import type { ChartsRadialDataProviderPremiumProps } from "./ChartsRadialDataProviderPremium.js";
3
+ import type { RadialPremiumPluginSignatures } from "./ChartsRadialDataProviderPremium.plugins.js";
4
+ export declare const useChartsRadialDataProviderPremiumProps: <SeriesType extends PolarChartSeriesType = PolarChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = RadialPremiumPluginSignatures<SeriesType>>(props: ChartsRadialDataProviderPremiumProps<SeriesType, TSignatures>) => {
5
+ children: import("react").ReactNode;
6
+ localeText: Partial<import("@mui/x-charts/locales").ChartsLocaleText> | undefined;
7
+ chartProviderProps: import("@mui/x-charts/internals").ChartsProviderProps<"radar" | "radialLine" | "radialBar", TSignatures>;
8
+ slots: Partial<import("@mui/x-charts").ChartsRadialDataProviderSlots> | undefined;
9
+ slotProps: Partial<import("@mui/x-charts").ChartsRadialDataProviderSlotProps> | undefined;
10
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useChartsRadialDataProviderPremiumProps = void 0;
8
+ var _internals = require("@mui/x-charts/internals");
9
+ const useChartsRadialDataProviderPremiumProps = props => {
10
+ const {
11
+ chartProviderProps,
12
+ localeText,
13
+ slots,
14
+ slotProps,
15
+ children
16
+ } = (0, _internals.useChartsRadialDataProviderProps)(props);
17
+ return {
18
+ children,
19
+ localeText,
20
+ chartProviderProps,
21
+ slots,
22
+ slotProps
23
+ };
24
+ };
25
+ exports.useChartsRadialDataProviderPremiumProps = useChartsRadialDataProviderPremiumProps;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import { useChartsRadialDataProviderProps } from '@mui/x-charts/internals';
4
+ export const useChartsRadialDataProviderPremiumProps = props => {
5
+ const {
6
+ chartProviderProps,
7
+ localeText,
8
+ slots,
9
+ slotProps,
10
+ children
11
+ } = useChartsRadialDataProviderProps(props);
12
+ return {
13
+ children,
14
+ localeText,
15
+ chartProviderProps,
16
+ slots,
17
+ slotProps
18
+ };
19
+ };
@@ -0,0 +1 @@
1
+ export * from '@mui/x-charts/ChartsRadiusAxis';
@@ -0,0 +1 @@
1
+ export * from '@mui/x-charts/ChartsRadiusAxis';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ChartsRadiusAxis = require("@mui/x-charts/ChartsRadiusAxis");
7
+ Object.keys(_ChartsRadiusAxis).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ChartsRadiusAxis[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ChartsRadiusAxis[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,2 @@
1
+ // Re-export automatically generated, to customize, simply remove this line.
2
+ export * from '@mui/x-charts/ChartsRadiusAxis';
@@ -0,0 +1 @@
1
+ export * from '@mui/x-charts/ChartsRotationAxis';
@@ -0,0 +1 @@
1
+ export * from '@mui/x-charts/ChartsRotationAxis';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ChartsRotationAxis = require("@mui/x-charts/ChartsRotationAxis");
7
+ Object.keys(_ChartsRotationAxis).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ChartsRotationAxis[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ChartsRotationAxis[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,2 @@
1
+ // Re-export automatically generated, to customize, simply remove this line.
2
+ export * from '@mui/x-charts/ChartsRotationAxis';
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import type { ChartsWebGLContextValue, UseWebGLLayerValue } from "./ChartsWebGLLayer.types.mjs";
3
+ export declare const ChartsWebGLContext: React.Context<ChartsWebGLContextValue | null>;
4
+ export declare function useWebGLContext(): WebGL2RenderingContext | null;
5
+ export declare function useWebGLLayer(): UseWebGLLayerValue | null;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import type { ChartsWebGLContextValue, UseWebGLLayerValue } from "./ChartsWebGLLayer.types.js";
3
+ export declare const ChartsWebGLContext: React.Context<ChartsWebGLContextValue | null>;
4
+ export declare function useWebGLContext(): WebGL2RenderingContext | null;
5
+ export declare function useWebGLLayer(): UseWebGLLayerValue | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ChartsWebGLContext = void 0;
9
+ exports.useWebGLContext = useWebGLContext;
10
+ exports.useWebGLLayer = useWebGLLayer;
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _ChartsWebGLOrderContext = require("./ChartsWebGLOrderContext");
13
+ const ChartsWebGLContext = exports.ChartsWebGLContext = /*#__PURE__*/React.createContext(null);
14
+ if (process.env.NODE_ENV !== "production") ChartsWebGLContext.displayName = "ChartsWebGLContext";
15
+ function useWebGLContext() {
16
+ return React.useContext(ChartsWebGLContext)?.gl ?? null;
17
+ }
18
+ function useWebGLLayer() {
19
+ const layer = React.useContext(ChartsWebGLContext);
20
+ const order = React.useContext(_ChartsWebGLOrderContext.ChartsWebGLOrderContext);
21
+ return React.useMemo(() => {
22
+ if (!layer) {
23
+ return null;
24
+ }
25
+ return {
26
+ gl: layer.gl,
27
+ registerDraw: drawRef => layer.registerDraw(drawRef, order),
28
+ requestRender: layer.requestRender
29
+ };
30
+ }, [layer, order]);
31
+ }
@@ -0,0 +1,23 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { ChartsWebGLOrderContext } from "./ChartsWebGLOrderContext.mjs";
5
+ export const ChartsWebGLContext = /*#__PURE__*/React.createContext(null);
6
+ if (process.env.NODE_ENV !== "production") ChartsWebGLContext.displayName = "ChartsWebGLContext";
7
+ export function useWebGLContext() {
8
+ return React.useContext(ChartsWebGLContext)?.gl ?? null;
9
+ }
10
+ export function useWebGLLayer() {
11
+ const layer = React.useContext(ChartsWebGLContext);
12
+ const order = React.useContext(ChartsWebGLOrderContext);
13
+ return React.useMemo(() => {
14
+ if (!layer) {
15
+ return null;
16
+ }
17
+ return {
18
+ gl: layer.gl,
19
+ registerDraw: drawRef => layer.registerDraw(drawRef, order),
20
+ requestRender: layer.requestRender
21
+ };
22
+ }, [layer, order]);
23
+ }
@@ -1,3 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function useWebGLContext(): WebGL2RenderingContext | null;
3
2
  export declare const ChartsWebGLLayer: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>>, "ref"> & React.RefAttributes<HTMLCanvasElement>>;
@@ -1,3 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function useWebGLContext(): WebGL2RenderingContext | null;
3
2
  export declare const ChartsWebGLLayer: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>>, "ref"> & React.RefAttributes<HTMLCanvasElement>>;
@@ -7,32 +7,75 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.ChartsWebGLLayer = void 0;
10
- exports.useWebGLContext = useWebGLContext;
11
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
12
  var React = _interopRequireWildcard(require("react"));
14
13
  var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
15
14
  var _internals = require("@mui/x-charts/internals");
16
15
  var _hooks = require("@mui/x-charts/hooks");
16
+ var _useWebGLResizeObserver = require("../utils/webgl/useWebGLResizeObserver");
17
+ var _ChartsWebGLContext = require("./ChartsWebGLContext");
18
+ var _ChartsWebGLOrderContext = require("./ChartsWebGLOrderContext");
17
19
  var _jsxRuntime = require("react/jsx-runtime");
18
20
  const _excluded = ["children"],
19
21
  _excluded2 = ["children"];
20
- const ChartsWebGLContext = /*#__PURE__*/React.createContext(null);
21
- if (process.env.NODE_ENV !== "production") ChartsWebGLContext.displayName = "ChartsWebGLContext";
22
- function useWebGLContext() {
23
- return React.useContext(ChartsWebGLContext);
24
- }
25
22
  const ChartsWebGLLayer = exports.ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProvider(_ref, ref) {
26
23
  let {
27
24
  children
28
25
  } = _ref,
29
26
  props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
30
27
  const canvasRef = React.useRef(null);
31
- const [context, setContext] = React.useState(null);
28
+ const [glContext, setGlContext] = React.useState(null);
32
29
  const handleRef = (0, _useForkRef.default)(canvasRef, ref);
33
30
  const chartRoot = (0, _hooks.useChartRootRef)().current;
34
31
  const drawingArea = (0, _hooks.useDrawingArea)();
35
32
  const [, rerender] = React.useReducer(s => s + 1, 0);
33
+ const drawEntriesRef = React.useRef([]);
34
+ const renderScheduledRef = React.useRef(false);
35
+ const renderAll = React.useCallback(() => {
36
+ if (!glContext) {
37
+ return;
38
+ }
39
+ renderScheduledRef.current = false;
40
+ glContext.clearColor(0, 0, 0, 0.0);
41
+ glContext.clear(glContext.COLOR_BUFFER_BIT);
42
+ // Sort by order so z-order matches children's position in ChartsWebGLLayer,
43
+ // stable across remount.
44
+ const sorted = [...drawEntriesRef.current].sort((a, b) => a.order - b.order);
45
+ for (const {
46
+ drawRef
47
+ } of sorted) {
48
+ drawRef.current?.();
49
+ }
50
+ }, [glContext]);
51
+ const registerDraw = React.useCallback((drawRef, order) => {
52
+ const entry = {
53
+ drawRef,
54
+ order
55
+ };
56
+ drawEntriesRef.current.push(entry);
57
+ return () => {
58
+ const idx = drawEntriesRef.current.indexOf(entry);
59
+ if (idx >= 0) {
60
+ drawEntriesRef.current.splice(idx, 1);
61
+ }
62
+ };
63
+ }, []);
64
+ const requestRender = React.useCallback(() => {
65
+ renderScheduledRef.current = true;
66
+ // Trigger a re-render so the flush effect runs, even if only a child's state changed
67
+ rerender();
68
+ }, []);
69
+
70
+ // Centralized resize handling — render all plots on canvas resize
71
+ (0, _useWebGLResizeObserver.useWebGLResizeObserver)(glContext, renderAll);
72
+
73
+ // Flush scheduled renders after all children's effects have run
74
+ React.useEffect(() => {
75
+ if (renderScheduledRef.current) {
76
+ renderAll();
77
+ }
78
+ });
36
79
  React.useEffect(() => {
37
80
  /* The chart root isn't available on first render because the ref is only set after mounting the root component. */
38
81
  if (!chartRoot) {
@@ -48,7 +91,7 @@ const ChartsWebGLLayer = exports.ChartsWebGLLayer = /*#__PURE__*/React.forwardRe
48
91
  // Must prevent default otherwise the context won't be marked as restorable
49
92
  // https://registry.khronos.org/webgl/extensions/WEBGL_lose_context/
50
93
  event.preventDefault();
51
- setContext(null);
94
+ setGlContext(null);
52
95
  };
53
96
  const initializeContext = () => {
54
97
  const ctx = canvas.getContext('webgl2', {
@@ -60,7 +103,7 @@ const ChartsWebGLLayer = exports.ChartsWebGLLayer = /*#__PURE__*/React.forwardRe
60
103
  if (!ctx) {
61
104
  return;
62
105
  }
63
- setContext(ctx);
106
+ setGlContext(ctx);
64
107
  };
65
108
  canvas.addEventListener('webglcontextlost', handleContextLost);
66
109
  canvas.addEventListener('webglcontextrestored', initializeContext);
@@ -70,11 +113,16 @@ const ChartsWebGLLayer = exports.ChartsWebGLLayer = /*#__PURE__*/React.forwardRe
70
113
  canvas.removeEventListener('webglcontextrestored', initializeContext);
71
114
  };
72
115
  }, [chartRoot]);
116
+ const contextValue = React.useMemo(() => glContext ? {
117
+ gl: glContext,
118
+ registerDraw,
119
+ requestRender
120
+ } : null, [glContext, registerDraw, requestRender]);
73
121
  if (!chartRoot) {
74
122
  return null;
75
123
  }
76
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ChartsWebGLContext.Provider, {
77
- value: context,
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWebGLContext.ChartsWebGLContext.Provider, {
125
+ value: contextValue,
78
126
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CanvasPositioner, {
79
127
  "aria-hidden": "true",
80
128
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("canvas", (0, _extends2.default)({
@@ -88,7 +136,10 @@ const ChartsWebGLLayer = exports.ChartsWebGLLayer = /*#__PURE__*/React.forwardRe
88
136
  height: drawingArea.height
89
137
  }
90
138
  }))
91
- }), children]
139
+ }), React.Children.map(children, (child, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsWebGLOrderContext.ChartsWebGLOrderContext.Provider, {
140
+ value: index,
141
+ children: child
142
+ }))]
92
143
  });
93
144
  });
94
145
  if (process.env.NODE_ENV !== "production") ChartsWebGLLayer.displayName = "ChartsWebGLLayer";
@@ -8,23 +8,67 @@ import * as React from 'react';
8
8
  import useForkRef from '@mui/utils/useForkRef';
9
9
  import { selectorChartSvgHeight, selectorChartSvgWidth, useStore } from '@mui/x-charts/internals';
10
10
  import { useDrawingArea, useChartRootRef } from '@mui/x-charts/hooks';
11
+ import { useWebGLResizeObserver } from "../utils/webgl/useWebGLResizeObserver.mjs";
12
+ import { ChartsWebGLContext } from "./ChartsWebGLContext.mjs";
13
+ import { ChartsWebGLOrderContext } from "./ChartsWebGLOrderContext.mjs";
11
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const ChartsWebGLContext = /*#__PURE__*/React.createContext(null);
13
- if (process.env.NODE_ENV !== "production") ChartsWebGLContext.displayName = "ChartsWebGLContext";
14
- export function useWebGLContext() {
15
- return React.useContext(ChartsWebGLContext);
16
- }
17
15
  export const ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProvider(_ref, ref) {
18
16
  let {
19
17
  children
20
18
  } = _ref,
21
19
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
22
20
  const canvasRef = React.useRef(null);
23
- const [context, setContext] = React.useState(null);
21
+ const [glContext, setGlContext] = React.useState(null);
24
22
  const handleRef = useForkRef(canvasRef, ref);
25
23
  const chartRoot = useChartRootRef().current;
26
24
  const drawingArea = useDrawingArea();
27
25
  const [, rerender] = React.useReducer(s => s + 1, 0);
26
+ const drawEntriesRef = React.useRef([]);
27
+ const renderScheduledRef = React.useRef(false);
28
+ const renderAll = React.useCallback(() => {
29
+ if (!glContext) {
30
+ return;
31
+ }
32
+ renderScheduledRef.current = false;
33
+ glContext.clearColor(0, 0, 0, 0.0);
34
+ glContext.clear(glContext.COLOR_BUFFER_BIT);
35
+ // Sort by order so z-order matches children's position in ChartsWebGLLayer,
36
+ // stable across remount.
37
+ const sorted = [...drawEntriesRef.current].sort((a, b) => a.order - b.order);
38
+ for (const {
39
+ drawRef
40
+ } of sorted) {
41
+ drawRef.current?.();
42
+ }
43
+ }, [glContext]);
44
+ const registerDraw = React.useCallback((drawRef, order) => {
45
+ const entry = {
46
+ drawRef,
47
+ order
48
+ };
49
+ drawEntriesRef.current.push(entry);
50
+ return () => {
51
+ const idx = drawEntriesRef.current.indexOf(entry);
52
+ if (idx >= 0) {
53
+ drawEntriesRef.current.splice(idx, 1);
54
+ }
55
+ };
56
+ }, []);
57
+ const requestRender = React.useCallback(() => {
58
+ renderScheduledRef.current = true;
59
+ // Trigger a re-render so the flush effect runs, even if only a child's state changed
60
+ rerender();
61
+ }, []);
62
+
63
+ // Centralized resize handling — render all plots on canvas resize
64
+ useWebGLResizeObserver(glContext, renderAll);
65
+
66
+ // Flush scheduled renders after all children's effects have run
67
+ React.useEffect(() => {
68
+ if (renderScheduledRef.current) {
69
+ renderAll();
70
+ }
71
+ });
28
72
  React.useEffect(() => {
29
73
  /* The chart root isn't available on first render because the ref is only set after mounting the root component. */
30
74
  if (!chartRoot) {
@@ -40,7 +84,7 @@ export const ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProv
40
84
  // Must prevent default otherwise the context won't be marked as restorable
41
85
  // https://registry.khronos.org/webgl/extensions/WEBGL_lose_context/
42
86
  event.preventDefault();
43
- setContext(null);
87
+ setGlContext(null);
44
88
  };
45
89
  const initializeContext = () => {
46
90
  const ctx = canvas.getContext('webgl2', {
@@ -52,7 +96,7 @@ export const ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProv
52
96
  if (!ctx) {
53
97
  return;
54
98
  }
55
- setContext(ctx);
99
+ setGlContext(ctx);
56
100
  };
57
101
  canvas.addEventListener('webglcontextlost', handleContextLost);
58
102
  canvas.addEventListener('webglcontextrestored', initializeContext);
@@ -62,11 +106,16 @@ export const ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProv
62
106
  canvas.removeEventListener('webglcontextrestored', initializeContext);
63
107
  };
64
108
  }, [chartRoot]);
109
+ const contextValue = React.useMemo(() => glContext ? {
110
+ gl: glContext,
111
+ registerDraw,
112
+ requestRender
113
+ } : null, [glContext, registerDraw, requestRender]);
65
114
  if (!chartRoot) {
66
115
  return null;
67
116
  }
68
117
  return /*#__PURE__*/_jsxs(ChartsWebGLContext.Provider, {
69
- value: context,
118
+ value: contextValue,
70
119
  children: [/*#__PURE__*/_jsx(CanvasPositioner, {
71
120
  "aria-hidden": "true",
72
121
  children: /*#__PURE__*/_jsx("canvas", _extends({
@@ -80,7 +129,10 @@ export const ChartsWebGLLayer = /*#__PURE__*/React.forwardRef(function WebGLProv
80
129
  height: drawingArea.height
81
130
  }
82
131
  }))
83
- }), children]
132
+ }), React.Children.map(children, (child, index) => /*#__PURE__*/_jsx(ChartsWebGLOrderContext.Provider, {
133
+ value: index,
134
+ children: child
135
+ }))]
84
136
  });
85
137
  });
86
138
  if (process.env.NODE_ENV !== "production") ChartsWebGLLayer.displayName = "ChartsWebGLLayer";