solid-recharts 0.1.0 → 0.2.1

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 (279) hide show
  1. package/LICENSE +24 -0
  2. package/package.json +10 -7
  3. package/src/cartesian/Area.tsx +40 -55
  4. package/src/cartesian/Bar.tsx +66 -58
  5. package/src/cartesian/BarStack.tsx +5 -2
  6. package/src/cartesian/Brush.tsx +1 -1
  7. package/src/cartesian/Funnel.tsx +15 -19
  8. package/src/cartesian/Line.tsx +34 -51
  9. package/src/cartesian/LineDrawShape.tsx +8 -6
  10. package/src/cartesian/ReferenceArea.tsx +25 -35
  11. package/src/cartesian/ReferenceDot.tsx +24 -34
  12. package/src/cartesian/ReferenceLine.tsx +25 -34
  13. package/src/cartesian/Scatter.tsx +25 -37
  14. package/src/cartesian/XAxis.tsx +54 -67
  15. package/src/cartesian/YAxis.tsx +53 -66
  16. package/src/cartesian/ZAxis.tsx +27 -40
  17. package/src/chart/SunburstChart.tsx +1 -1
  18. package/src/component/ActivePoints.tsx +0 -9
  19. package/src/component/Customized.tsx +1 -1
  20. package/src/component/Dots.tsx +7 -3
  21. package/src/context/ErrorBarContext.tsx +15 -24
  22. package/src/polar/Pie.tsx +36 -48
  23. package/src/polar/PolarAngleAxis.tsx +41 -50
  24. package/src/polar/PolarRadiusAxis.tsx +40 -48
  25. package/src/polar/Radar.tsx +22 -34
  26. package/src/polar/RadialBar.tsx +21 -39
  27. package/src/shape/Curve.tsx +1 -1
  28. package/src/shape/Symbols.tsx +1 -1
  29. package/src/state/RechartsReduxContext.tsx +1 -1
  30. package/src/state/SetLegendPayload.ts +19 -27
  31. package/src/state/SetTooltipEntrySettings.tsx +9 -26
  32. package/src/state/cartesianAxisSlice.ts +40 -60
  33. package/src/state/createCollectionActions.ts +51 -0
  34. package/src/state/createSelector.ts +97 -0
  35. package/src/state/externalEventsMiddleware.ts +2 -11
  36. package/src/state/graphicalItemsSlice.ts +27 -40
  37. package/src/state/isEventThrottled.ts +12 -0
  38. package/src/state/keyboardEventsMiddleware.ts +2 -8
  39. package/src/state/layoutSlice.ts +8 -4
  40. package/src/state/legendSlice.ts +24 -26
  41. package/src/state/mouseEventsMiddleware.ts +2 -13
  42. package/src/state/patched.ts +19 -0
  43. package/src/state/referenceElementsSlice.ts +40 -31
  44. package/src/state/registerInStore.ts +68 -0
  45. package/src/state/selectors/areaSelectors.ts +13 -36
  46. package/src/state/selectors/arrayEqualityCheck.ts +32 -7
  47. package/src/state/selectors/axisSelectors.ts +215 -169
  48. package/src/state/selectors/barSelectors.ts +8 -36
  49. package/src/state/selectors/combiners/combineConfiguredScale.ts +1 -1
  50. package/src/state/selectors/combiners/combineRealScaleType.ts +1 -1
  51. package/src/state/selectors/dataSelectors.ts +35 -16
  52. package/src/state/selectors/numberDomainEqualityCheck.ts +16 -8
  53. package/src/state/selectors/selectAxisForGraphicalItem.ts +52 -0
  54. package/src/state/store.ts +0 -1
  55. package/src/state/tooltipSlice.ts +93 -64
  56. package/src/util/ActiveShapeUtils.tsx +0 -7
  57. package/src/util/BarUtils.tsx +27 -22
  58. package/src/util/ChartUtils.ts +69 -25
  59. package/src/util/propsAreEqual.ts +3 -33
  60. package/src/util/stacks/stackTypes.ts +1 -1
  61. package/src/util/types.ts +2 -2
  62. package/test/animation/CSSTransitionAnimate.timing.spec.tsx +1 -1
  63. package/test/animation/JavascriptAnimate.spec.tsx +1 -1
  64. package/test/animation/legacyAnimationLengthChange.spec.tsx +1 -1
  65. package/test/cartesian/Area.animation.spec.tsx +1 -1
  66. package/test/cartesian/Area.range.spec.tsx +1 -1
  67. package/test/cartesian/Area.spec.tsx +1 -1
  68. package/test/cartesian/Area.stacked.render.spec.tsx +1 -1
  69. package/test/cartesian/Area.typed.spec.tsx +1 -1
  70. package/test/cartesian/Axis.integration.spec.tsx +1 -1
  71. package/test/cartesian/Bar/Bar.csstransition.spec.tsx +1 -1
  72. package/test/cartesian/Bar/Bar.spec.tsx +1 -1
  73. package/test/cartesian/Bar/Bar.typed.spec.tsx +1 -1
  74. package/test/cartesian/Bar.animation.spec.tsx +1 -1
  75. package/test/cartesian/Bar.stackDomain.spec.tsx +1 -1
  76. package/test/cartesian/Bar.stacked.render.spec.tsx +1 -1
  77. package/test/cartesian/Bar.zeroDimensionFiltering.spec.tsx +1 -1
  78. package/test/cartesian/Brush.keyboard.spec.tsx +1 -1
  79. package/test/cartesian/Brush.panorama.spec.tsx +1 -1
  80. package/test/cartesian/Brush.props.spec.tsx +1 -1
  81. package/test/cartesian/Brush.render.spec.tsx +1 -1
  82. package/test/cartesian/Brush.spec.tsx +1 -1
  83. package/test/cartesian/Brush.stacked.spec.tsx +1 -1
  84. package/test/cartesian/CartesianAxis.render.spec.tsx +1 -1
  85. package/test/cartesian/CartesianAxis.spec.tsx +2 -2
  86. package/test/cartesian/CartesianGrid.render.spec.tsx +1 -1
  87. package/test/cartesian/CartesianGrid.spec.tsx +1 -1
  88. package/test/cartesian/ErrorBar.render.spec.tsx +1 -1
  89. package/test/cartesian/ErrorBar.spec.tsx +1 -1
  90. package/test/cartesian/Funnel.animation.spec.tsx +1 -1
  91. package/test/cartesian/Funnel.spec.tsx +1 -1
  92. package/test/cartesian/Funnel.typed.spec.tsx +1 -1
  93. package/test/cartesian/GraphicalItemClipPath.scale-behavior.spec.tsx +2 -2
  94. package/test/cartesian/Line.animation.spec.tsx +1 -1
  95. package/test/cartesian/Line.sparseAnimationPath.spec.tsx +1 -1
  96. package/test/cartesian/Line.spec.tsx +1 -1
  97. package/test/cartesian/Line.typed.spec.tsx +1 -1
  98. package/test/cartesian/ReferenceArea.render.spec.tsx +1 -1
  99. package/test/cartesian/ReferenceArea.spec.tsx +1 -1
  100. package/test/cartesian/ReferenceArea.typed.spec.tsx +1 -1
  101. package/test/cartesian/ReferenceDot.render.spec.tsx +1 -1
  102. package/test/cartesian/ReferenceDot.spec.tsx +1 -1
  103. package/test/cartesian/ReferenceDot.typed.spec.tsx +1 -1
  104. package/test/cartesian/ReferenceLine/ReferenceLine.panorama.spec.tsx +1 -1
  105. package/test/cartesian/ReferenceLine/ReferenceLine.spec.tsx +1 -1
  106. package/test/cartesian/ReferenceLine/ReferenceLine.typed.spec.tsx +1 -1
  107. package/test/cartesian/ReferenceLine/getEndPoints.spec.ts +1 -1
  108. package/test/cartesian/ReferenceLine.render.spec.tsx +1 -1
  109. package/test/cartesian/Scatter.animation.spec.tsx +1 -1
  110. package/test/cartesian/Scatter.render.spec.tsx +1 -1
  111. package/test/cartesian/Scatter.spec.tsx +1 -1
  112. package/test/cartesian/Scatter.typed.spec.tsx +1 -1
  113. package/test/cartesian/XAxis/XAxis.barSize.spec.tsx +1 -1
  114. package/test/cartesian/XAxis/XAxis.brush.spec.tsx +1 -1
  115. package/test/cartesian/XAxis/XAxis.categorydomain.spec.tsx +1 -1
  116. package/test/cartesian/XAxis/XAxis.datatypes.spec.tsx +1 -1
  117. package/test/cartesian/XAxis/XAxis.hide.spec.tsx +1 -1
  118. package/test/cartesian/XAxis/XAxis.multiaxis.spec.tsx +1 -1
  119. package/test/cartesian/XAxis/XAxis.numberdomain.spec.tsx +1 -1
  120. package/test/cartesian/XAxis/XAxis.padding.spec.tsx +1 -1
  121. package/test/cartesian/XAxis/XAxis.padding_clip.spec.tsx +1 -1
  122. package/test/cartesian/XAxis/XAxis.state.spec.tsx +1 -1
  123. package/test/cartesian/XAxis/XAxis.tick.spec.tsx +1 -1
  124. package/test/cartesian/XAxis/XAxis.timescale.spec.tsx +2 -2
  125. package/test/cartesian/XAxis/XAxis.typed.spec.tsx +1 -1
  126. package/test/cartesian/XAxis/XAxis.vertical.spec.tsx +1 -1
  127. package/test/cartesian/XAxis.tickFormatter.spec.tsx +1 -1
  128. package/test/cartesian/YAxis/YAxis.7362.derivedDomain.spec.tsx +1 -1
  129. package/test/cartesian/YAxis/YAxis.interval-zero.spec.tsx +1 -1
  130. package/test/cartesian/YAxis/YAxis.label.spec.tsx +1 -1
  131. package/test/cartesian/YAxis/YAxis.spec.tsx +1 -1
  132. package/test/cartesian/YAxis/YAxis.tick.spec.tsx +1 -1
  133. package/test/cartesian/YAxis/YAxis.tickFormatter.spec.tsx +1 -1
  134. package/test/cartesian/YAxis/YAxis.typed.spec.tsx +1 -1
  135. package/test/cartesian/ZAxis.spec.tsx +1 -1
  136. package/test/cartesian/ZAxis.typed.spec.tsx +1 -1
  137. package/test/cartesian/axisLineAndStroke.spec.tsx +1 -1
  138. package/test/cartesian/miscFeatureGaps.spec.tsx +1 -1
  139. package/test/chart/AccessibilityLayer.spec.tsx +1 -1
  140. package/test/chart/AccessibilityScans.spec.tsx +2 -2
  141. package/test/chart/AreaChart.spec.tsx +1 -1
  142. package/test/chart/AreaChart.typed.spec.tsx +1 -1
  143. package/test/chart/BarChart.spec.tsx +1 -1
  144. package/test/chart/BarChart.typed.spec.tsx +1 -1
  145. package/test/chart/CategoricalChart.spec.tsx +1 -1
  146. package/test/chart/ComposedChart.spec.tsx +1 -1
  147. package/test/chart/ComposedChart.typed.spec.tsx +1 -1
  148. package/test/chart/FunnelChart.spec.tsx +1 -1
  149. package/test/chart/FunnelChart.typed.spec.tsx +1 -1
  150. package/test/chart/LineChart.smoke.spec.tsx +1 -1
  151. package/test/chart/LineChart.spec.tsx +1 -1
  152. package/test/chart/LineChart.typed.spec.tsx +1 -1
  153. package/test/chart/NicheChartTooltip.spec.tsx +1 -1
  154. package/test/chart/PieChart.spec.tsx +1 -1
  155. package/test/chart/PieChart.typed.spec.tsx +1 -1
  156. package/test/chart/RadarChart.spec.tsx +1 -1
  157. package/test/chart/RadarChart.typed.spec.tsx +1 -1
  158. package/test/chart/RadialBarChart.spec.tsx +1 -1
  159. package/test/chart/RadialBarChart.typed.spec.tsx +1 -1
  160. package/test/chart/RechartsWrapper.spec.tsx +1 -1
  161. package/test/chart/Sankey.content.spec.tsx +1 -1
  162. package/test/chart/Sankey.spec.tsx +1 -1
  163. package/test/chart/ScatterChart.spec.tsx +1 -1
  164. package/test/chart/ScatterChart.typed.spec.tsx +1 -1
  165. package/test/chart/SunburstChart.spec.tsx +1 -1
  166. package/test/chart/Treemap.animation.spec.tsx +1 -1
  167. package/test/chart/Treemap.spec.tsx +1 -1
  168. package/test/chart/chartEvents.spec.tsx +1 -1
  169. package/test/chart/responsive.spec.tsx +1 -1
  170. package/test/component/Cell.render.spec.tsx +1 -1
  171. package/test/component/Cell.spec.tsx +1 -1
  172. package/test/component/Cursor.spec.tsx +1 -1
  173. package/test/component/DefaultTooltipContent.spec.tsx +1 -1
  174. package/test/component/Label.render.spec.tsx +1 -1
  175. package/test/component/Label.spec.tsx +1 -1
  176. package/test/component/LabelList.spec.tsx +1 -1
  177. package/test/component/Legend.itemSorter.spec.tsx +1 -1
  178. package/test/component/Legend.render.spec.tsx +1 -1
  179. package/test/component/Legend.spec.tsx +1 -1
  180. package/test/component/ResponsiveContainer.spec.tsx +1 -1
  181. package/test/component/ResponsiveContainerDataTest.spec.tsx +1 -1
  182. package/test/component/Text.spec.tsx +1 -1
  183. package/test/component/Tooltip/ActiveDot.spec.tsx +1 -1
  184. package/test/component/Tooltip/tooltipEventType.spec.tsx +1 -1
  185. package/test/component/Tooltip/tooltipTestHelpers.tsx +1 -1
  186. package/test/component/Tooltip.defaultIndex.spec.tsx +1 -1
  187. package/test/component/Tooltip.hover.spec.tsx +1 -1
  188. package/test/component/Tooltip.item.spec.tsx +1 -1
  189. package/test/component/Tooltip.keyboard.spec.tsx +1 -1
  190. package/test/component/Tooltip.payload.spec.tsx +1 -1
  191. package/test/component/Tooltip.touch.spec.tsx +1 -1
  192. package/test/component/Tooltip.visibility.spec.tsx +1 -1
  193. package/test/component/TooltipBoundingBox.spec.tsx +2 -2
  194. package/test/container/ClipPath.spec.tsx +1 -1
  195. package/test/context/chartLayoutContext.spec.tsx +1 -1
  196. package/test/helper/createSelectorTestCase.tsx +1 -1
  197. package/test/helper/mockAxes.ts +1 -1
  198. package/test/helper/selectorTestHelpers.tsx +1 -1
  199. package/test/hooks/useActiveTooltipDataPoints.spec.tsx +1 -1
  200. package/test/hooks/useOffset.spec.tsx +1 -1
  201. package/test/hooks/useTooltipStateHooks.spec.tsx +1 -1
  202. package/test/polar/Pie/Pie-TwoLevelPieChart.spec.tsx +1 -1
  203. package/test/polar/Pie/Pie.spec.tsx +1 -1
  204. package/test/polar/Pie/Pie.typed.spec.tsx +1 -1
  205. package/test/polar/Pie.animation.spec.tsx +1 -1
  206. package/test/polar/PieWithLegend.animation.spec.tsx +1 -1
  207. package/test/polar/PolarAngleAxis/PolarAngleAxis.events.spec.tsx +1 -1
  208. package/test/polar/PolarAngleAxis/PolarAngleAxis.spec.tsx +1 -1
  209. package/test/polar/PolarAngleAxis/PolarAngleAxis.typed.spec.tsx +1 -1
  210. package/test/polar/PolarAngleAxis.render.spec.tsx +1 -1
  211. package/test/polar/PolarGrid.render.spec.tsx +1 -1
  212. package/test/polar/PolarGrid.spec.tsx +1 -1
  213. package/test/polar/PolarLegendPerRow.render.spec.tsx +1 -1
  214. package/test/polar/PolarRadiusAxis.events.spec.tsx +1 -1
  215. package/test/polar/PolarRadiusAxis.render.spec.tsx +1 -1
  216. package/test/polar/PolarRadiusAxis.spec.tsx +1 -1
  217. package/test/polar/PolarRadiusAxis.typed.spec.tsx +1 -1
  218. package/test/polar/PolarTooltipLegend.render.spec.tsx +1 -1
  219. package/test/polar/Radar.animation.spec.tsx +1 -1
  220. package/test/polar/Radar.render.spec.tsx +1 -1
  221. package/test/polar/Radar.spec.tsx +1 -1
  222. package/test/polar/Radar.typed.spec.tsx +1 -1
  223. package/test/polar/RadialBar/RadialBar.spec.tsx +1 -1
  224. package/test/polar/RadialBar/RadialBar.typed.spec.tsx +1 -1
  225. package/test/polar/RadialBar.animation.spec.tsx +1 -1
  226. package/test/polar/RadialBar.render.spec.tsx +1 -1
  227. package/test/polar/RadialBar.stacked.spec.tsx +1 -1
  228. package/test/setup.ts +1 -1
  229. package/test/shape/ActiveShape.spec.tsx +1 -1
  230. package/test/shape/Cross.spec.tsx +1 -1
  231. package/test/shape/Curve.spec.tsx +2 -2
  232. package/test/shape/Curve.typed.spec.tsx +1 -1
  233. package/test/shape/Dot.spec.tsx +1 -1
  234. package/test/shape/Polygon.spec.tsx +1 -1
  235. package/test/shape/Rectangle.animation.spec.tsx +1 -1
  236. package/test/shape/Rectangle.spec.tsx +1 -1
  237. package/test/shape/Sector.spec.tsx +1 -1
  238. package/test/shape/Symbols.spec.tsx +1 -1
  239. package/test/shape/Trapezoid.spec.tsx +1 -1
  240. package/test/state/createCollectionActions.spec.ts +87 -0
  241. package/test/state/createSelector.spec.ts +158 -0
  242. package/test/state/hooks.spec.tsx +1 -1
  243. package/test/state/registerInStore.spec.tsx +101 -0
  244. package/test/state/selectors/axisSelectors.spec.tsx +1 -1
  245. package/test/state/selectors/combiners/combineConfiguredScale.spec.ts +1 -1
  246. package/test/state/selectors/combiners/combineRealScaleType.spec.ts +1 -1
  247. package/test/state/selectors/dataSelectors.spec.tsx +1 -1
  248. package/test/state/selectors/legendSelectors.spec.tsx +1 -1
  249. package/test/state/selectors/radarSelectors.spec.tsx +1 -1
  250. package/test/state/selectors/selectActiveTooltipIndex.spec.tsx +1 -1
  251. package/test/state/selectors/selectDisplayedData.spec.tsx +1 -1
  252. package/test/state/selectors/selectStackGroups.spec.tsx +1 -1
  253. package/test/state/selectors/selectorMemoization.spec.tsx +136 -0
  254. package/test/state/selectors/selectors.spec.tsx +1 -1
  255. package/test/util/CartesianUtils/CartesianUtils.spec.ts +1 -1
  256. package/test/util/ChartUtils/ChartUtils.spec.ts +1 -1
  257. package/test/util/ChartUtils/getCateCoordinateOfLine.spec.ts +14 -0
  258. package/test/util/ChartUtils/getStackedData.spec.ts +1 -1
  259. package/test/util/ChartUtils/truncateByDomain.spec.ts +1 -1
  260. package/test/util/DomUtils.spec.tsx +1 -1
  261. package/test/util/FunnelUtils.spec.tsx +1 -1
  262. package/test/util/scale/createCategoricalInverse.spec.ts +1 -1
  263. package/test/util/useElementOffset.spec.tsx +1 -1
  264. package/test/util/usePrefersReducedMotion.spec.ts +1 -1
  265. package/test/util/useUniqueId.spec.ts +1 -1
  266. package/test/zIndex/AllZIndexPortals.spec.tsx +1 -1
  267. package/test/zIndex/DynamicZIndex.spec.tsx +1 -1
  268. package/test/zIndex/ZIndexLayer.portalOwner.spec.tsx +1 -1
  269. package/test/zIndex/componentZIndex.spec.tsx +1 -1
  270. package/test/zIndex/multiChartZIndexIsolation.spec.tsx +1 -1
  271. package/test-results/.last-run.json +4 -0
  272. package/NEXT_SESSION_PROMPT.md +0 -114
  273. package/src/state/reduxDevtoolsJsonStringifyReplacer.ts +0 -15
  274. package/src/util/axisPropsAreEqual.ts +0 -42
  275. package/src/util/resolveDefaultProps.tsx +0 -8
  276. package/src/util/typedDataKey.ts +0 -8
  277. package/test/helper/render.ts +0 -7
  278. package/test/state/reduxDevtoolsJsonStringifyReplacer.spec.ts +0 -25
  279. package/test/util/axisPropsAreEqual.spec.ts +0 -93
@@ -30,11 +30,15 @@
30
30
  // (final frame), element-form shape, per-sector item-hover dispatch (sectors lack
31
31
  // tooltipPosition).
32
32
  // Cells ARE wired: a <Cell> child overrides the per-sector fill/stroke/class.
33
- import { createEffect, createMemo, createSignal, For, merge, Show, untrack } from "solid-js";
33
+ import { createMemo, For, merge, Show, untrack } from "solid-js";
34
34
  import type { JSX } from "@solidjs/web";
35
35
  import { useAppSelector, useAppStore } from "../state/hooks";
36
36
  import { useUniqueId } from "../util/useUniqueId";
37
- import { AnimatedItems, type AnimationInterpolateFn } from "../animation/AnimatedItems";
37
+ import {
38
+ AnimatedItems,
39
+ useAnimationCallbacks,
40
+ type AnimationInterpolateFn,
41
+ } from "../animation/AnimatedItems";
38
42
  import { matchAppend, type AnimationMatchByProp } from "../animation/matchBy";
39
43
  import type { MutableRef } from "../animation/useAnimationStartSnapshot";
40
44
  import { usePolarChartLayout } from "../context/chartLayoutContext";
@@ -96,7 +100,7 @@ import {
96
100
  } from "../util/ChartUtils";
97
101
  import { interpolate, isNumber, mathSign } from "../util/DataUtils";
98
102
  import type { StackSeries } from "../util/stacks/stackTypes";
99
- import { unregisterOnCleanup } from "../state/unregisterOnCleanup";
103
+ import { registerInStore } from "../state/registerInStore";
100
104
 
101
105
  export type RadialBarDataItem = SectorProps &
102
106
  PolarViewBoxRequired &
@@ -494,29 +498,14 @@ export function RadialBar<DataPointType = Record<string, unknown>, DataValueType
494
498
  maxBarSize: merged.maxBarSize,
495
499
  });
496
500
 
497
- let prev: RadialBarSettings | null = null;
498
-
499
- createEffect(
500
- (): RadialBarSettings => settings(),
501
- (s) => {
502
- if (store == null) {
503
- return;
504
- }
505
- if (prev === null) {
506
- store.actions.graphicalItems.addPolarGraphicalItem(s);
507
- } else if (prev !== s) {
508
- store.actions.graphicalItems.replacePolarGraphicalItem({ prev, next: s });
509
- }
510
- prev = s;
511
- },
512
- );
513
-
514
- unregisterOnCleanup(() => {
515
- if (prev && store != null) {
516
- store.actions.graphicalItems.removePolarGraphicalItem(prev);
517
- prev = null;
518
- }
519
- });
501
+ if (store != null) {
502
+ registerInStore<RadialBarSettings>(() => settings(), {
503
+ add: (next) => store.actions.graphicalItems.addPolarGraphicalItem(next),
504
+ replace: (prev, next) =>
505
+ store.actions.graphicalItems.replacePolarGraphicalItem({ prev, next }),
506
+ remove: (prev) => store.actions.graphicalItems.removePolarGraphicalItem(prev),
507
+ });
508
+ }
520
509
 
521
510
  // Per-sector <Cell> overrides (collected from children, in data order).
522
511
  const cells = collectCells(() => props.children);
@@ -574,17 +563,10 @@ export function RadialBar<DataPointType = Record<string, unknown>, DataValueType
574
563
  current: null,
575
564
  };
576
565
  // Labels are hidden while the sectors animate (recharts' showLabels={!isAnimating}).
577
- // ownedWrite: handleAnimationEnd also fires from the animation effect cleanup when a
578
- // mid-animation chart is disposed (route/soft navigation) a legal teardown write.
579
- const [showLabels, setShowLabels] = createSignal(true, { ownedWrite: true });
580
- const handleAnimationStart = (): void => {
581
- props.onAnimationStart?.();
582
- setShowLabels(false);
583
- };
584
- const handleAnimationEnd = (): void => {
585
- props.onAnimationEnd?.();
586
- setShowLabels(true);
587
- };
566
+ const { isAnimating, handleAnimationStart, handleAnimationEnd } = useAnimationCallbacks(
567
+ () => props.onAnimationStart?.(),
568
+ () => props.onAnimationEnd?.(),
569
+ );
588
570
 
589
571
  // User pointer handlers are forwarded to each sector's wrapping <Layer>: the
590
572
  // mouse handlers wrap into the tooltip-item dispatch (called props-first), and
@@ -669,7 +651,7 @@ export function RadialBar<DataPointType = Record<string, unknown>, DataValueType
669
651
  <Layer class={layerClass()}>
670
652
  <PolarLabelListContextProvider
671
653
  value={() =>
672
- showLabels()
654
+ !isAnimating()
673
655
  ? secs().map(
674
656
  (sector): PolarLabelListEntry => ({
675
657
  value: sector.value,
@@ -730,7 +712,7 @@ export function RadialBar<DataPointType = Record<string, unknown>, DataValueType
730
712
  isActive={isSectorActiveShape(i())}
731
713
  option={sectorOption(i())}
732
714
  animationElapsedTime={animationElapsedTime}
733
- isAnimating={!showLabels() || animationElapsedTime < 1}
715
+ isAnimating={isAnimating() || animationElapsedTime < 1}
734
716
  isEntrance={isEntrance}
735
717
  class={`recharts-radial-bar-sector ${entry.class ?? ""}`}
736
718
  fill={entry.fill ?? merged.fill}
@@ -38,7 +38,7 @@ import {
38
38
  curveStepBefore,
39
39
  line as shapeLine,
40
40
  type Line as D3LineCurve,
41
- } from "victory-vendor/d3-shape";
41
+ } from "d3-shape";
42
42
  import { isNumber, upperFirst } from "../util/DataUtils";
43
43
  import { isWellBehavedNumber } from "../util/isWellBehavedNumber";
44
44
  import { svgPropertiesNoEvents } from "../util/svgPropertiesNoEvents";
@@ -20,7 +20,7 @@ import {
20
20
  symbolTriangle,
21
21
  symbolWye,
22
22
  type SymbolType as D3SymbolType,
23
- } from "victory-vendor/d3-shape";
23
+ } from "d3-shape";
24
24
  import { SymbolType } from "../util/types";
25
25
  import { isNumber, upperFirst } from "../util/DataUtils";
26
26
  import { svgPropertiesAndEvents } from "../util/svgPropertiesAndEvents";
@@ -4,5 +4,5 @@
4
4
  //
5
5
  // TODO: do not port this file as-is. The Solid-native port replaces it (see the
6
6
  // reason above). If a consumer needs this path, wire it to the Solid equivalent
7
- // instead. Tracked in scripts/porting-queue.mjs SKIP list and project memory.
7
+ // instead.
8
8
  export {};
@@ -5,12 +5,16 @@
5
5
  // explicit `id` prop (the graphical item's id) keys the entry so replace/remove are
6
6
  // proxy-safe (recharts matches the array by reference, which Solid stores break).
7
7
  // `SetPolarLegendPayload` lands with the polar vertical. Returns nothing.
8
- import { createEffect } from "solid-js";
9
8
  import type { JSX } from "@solidjs/web";
10
9
  import { useAppStore } from "./hooks";
11
10
  import { useIsPanorama } from "../context/PanoramaContext";
12
11
  import { LegendPayload } from "../component/DefaultLegendContent";
13
- import { unregisterOnCleanup } from "./unregisterOnCleanup";
12
+ import { registerInStore } from "./registerInStore";
13
+
14
+ interface LegendPayloadEntry {
15
+ id: string;
16
+ items: ReadonlyArray<LegendPayload>;
17
+ }
14
18
 
15
19
  export function SetLegendPayload(props: {
16
20
  id: string;
@@ -19,32 +23,20 @@ export function SetLegendPayload(props: {
19
23
  const store = useAppStore();
20
24
  const isPanorama = useIsPanorama();
21
25
 
22
- let prevId: string | null = null;
23
-
24
- createEffect(
25
- () => ({ id: props.id, items: props.legendPayload }),
26
- (entry) => {
27
- if (store == null || isPanorama) {
28
- return;
29
- }
30
- if (prevId === null) {
31
- store.actions.legend.addLegendPayload(entry);
32
- } else {
26
+ // Panorama mirrors never contribute to the legend. The entry is keyed by id
27
+ // (recharts matches the array by reference, which Solid stores break), so
28
+ // replace/remove rebuild the `{ id, items: [] }` lookup key from prev.
29
+ if (store != null && !isPanorama) {
30
+ registerInStore<LegendPayloadEntry>(() => ({ id: props.id, items: props.legendPayload }), {
31
+ add: (next) => store.actions.legend.addLegendPayload(next),
32
+ replace: (prev, next) =>
33
33
  store.actions.legend.replaceLegendPayload({
34
- prev: { id: prevId, items: [] },
35
- next: entry,
36
- });
37
- }
38
- prevId = entry.id;
39
- },
40
- );
41
-
42
- unregisterOnCleanup(() => {
43
- if (prevId != null && store != null) {
44
- store.actions.legend.removeLegendPayload({ id: prevId, items: [] });
45
- prevId = null;
46
- }
47
- });
34
+ prev: { id: prev.id, items: [] },
35
+ next,
36
+ }),
37
+ remove: (prev) => store.actions.legend.removeLegendPayload({ id: prev.id, items: [] }),
38
+ });
39
+ }
48
40
 
49
41
  return null;
50
42
  }
@@ -4,12 +4,11 @@
4
4
  // on change) + onCleanup (remove), the same effect-dispatch idiom Line/Bar/Area
5
5
  // use for their graphical-item registration. Returns null (renders nothing) — it
6
6
  // exists purely to register the item's tooltip payload entry in the store.
7
- import { createEffect } from "solid-js";
8
7
  import type { JSX } from "@solidjs/web";
9
8
  import { useAppStore } from "./hooks";
10
9
  import { TooltipPayloadConfiguration } from "./tooltipSlice";
11
10
  import { useIsPanorama } from "../context/PanoramaContext";
12
- import { unregisterOnCleanup } from "./unregisterOnCleanup";
11
+ import { registerInStore } from "./registerInStore";
13
12
 
14
13
  export function SetTooltipEntrySettings(props: {
15
14
  tooltipEntrySettings: TooltipPayloadConfiguration;
@@ -17,30 +16,14 @@ export function SetTooltipEntrySettings(props: {
17
16
  const store = useAppStore();
18
17
  const isPanorama = useIsPanorama();
19
18
 
20
- let prev: TooltipPayloadConfiguration | null = null;
21
-
22
- createEffect(
23
- () => props.tooltipEntrySettings,
24
- (settings) => {
25
- if (store == null || isPanorama) {
26
- // Panorama graphical items never contribute to the Tooltip payload.
27
- return;
28
- }
29
- if (prev === null) {
30
- store.actions.tooltip.addTooltipEntrySettings(settings);
31
- } else if (prev !== settings) {
32
- store.actions.tooltip.replaceTooltipEntrySettings({ prev, next: settings });
33
- }
34
- prev = settings;
35
- },
36
- );
37
-
38
- unregisterOnCleanup(() => {
39
- if (prev && store != null) {
40
- store.actions.tooltip.removeTooltipEntrySettings(prev);
41
- prev = null;
42
- }
43
- });
19
+ // Panorama graphical items never contribute to the Tooltip payload.
20
+ if (store != null && !isPanorama) {
21
+ registerInStore<TooltipPayloadConfiguration>(() => props.tooltipEntrySettings, {
22
+ add: (next) => store.actions.tooltip.addTooltipEntrySettings(next),
23
+ replace: (prev, next) => store.actions.tooltip.replaceTooltipEntrySettings({ prev, next }),
24
+ remove: (prev) => store.actions.tooltip.removeTooltipEntrySettings(prev),
25
+ });
26
+ }
44
27
 
45
28
  return null;
46
29
  }
@@ -195,67 +195,47 @@ export function createCartesianAxisSlice(
195
195
  zAxis: { ...initialState.zAxis },
196
196
  });
197
197
 
198
- const actions: CartesianAxisActions = {
199
- addXAxis(axis) {
200
- setState((s) => {
201
- s.xAxis[axis.id] = axis;
202
- });
203
- },
204
- replaceXAxis({ prev, next }) {
205
- setState((s) => {
206
- if (s.xAxis[prev.id] !== undefined) {
207
- if (prev.id !== next.id) {
208
- delete s.xAxis[prev.id];
209
- }
210
- s.xAxis[next.id] = next;
211
- }
212
- });
213
- },
214
- removeXAxis(axis) {
215
- setState((s) => {
216
- delete s.xAxis[axis.id];
217
- });
218
- },
219
- addYAxis(axis) {
220
- setState((s) => {
221
- s.yAxis[axis.id] = axis;
222
- });
223
- },
224
- replaceYAxis({ prev, next }) {
225
- setState((s) => {
226
- if (s.yAxis[prev.id] !== undefined) {
227
- if (prev.id !== next.id) {
228
- delete s.yAxis[prev.id];
198
+ // The x/y/z axis maps are Record<AxisId, …> (not arrays), and their
199
+ // add/replace/remove mutate the draft IN PLACE — preserving each map's reference
200
+ // identity, which downstream reads rely on. So this is a local record helper, not
201
+ // the shared array `createCollectionActions`; `pick` selects the map to touch.
202
+ // Concentrates the replace body that was written verbatim three times (x/y/z).
203
+ function axisCollection<A extends { id: AxisId }>(pick: (s: AxisMapState) => Record<AxisId, A>) {
204
+ return {
205
+ add: (axis: A) =>
206
+ setState((s) => {
207
+ pick(s)[axis.id] = axis;
208
+ }),
209
+ replace: ({ prev, next }: { prev: A; next: A }) =>
210
+ setState((s) => {
211
+ const map = pick(s);
212
+ if (map[prev.id] !== undefined) {
213
+ if (prev.id !== next.id) {
214
+ delete map[prev.id];
215
+ }
216
+ map[next.id] = next;
229
217
  }
230
- s.yAxis[next.id] = next;
231
- }
232
- });
233
- },
234
- removeYAxis(axis) {
235
- setState((s) => {
236
- delete s.yAxis[axis.id];
237
- });
238
- },
239
- addZAxis(axis) {
240
- setState((s) => {
241
- s.zAxis[axis.id] = axis;
242
- });
243
- },
244
- replaceZAxis({ prev, next }) {
245
- setState((s) => {
246
- if (s.zAxis[prev.id] !== undefined) {
247
- if (prev.id !== next.id) {
248
- delete s.zAxis[prev.id];
249
- }
250
- s.zAxis[next.id] = next;
251
- }
252
- });
253
- },
254
- removeZAxis(axis) {
255
- setState((s) => {
256
- delete s.zAxis[axis.id];
257
- });
258
- },
218
+ }),
219
+ remove: (axis: A) =>
220
+ setState((s) => {
221
+ delete pick(s)[axis.id];
222
+ }),
223
+ };
224
+ }
225
+ const x = axisCollection<XAxisSettings>((s) => s.xAxis);
226
+ const y = axisCollection<YAxisSettings>((s) => s.yAxis);
227
+ const z = axisCollection<ZAxisSettings>((s) => s.zAxis);
228
+
229
+ const actions: CartesianAxisActions = {
230
+ addXAxis: x.add,
231
+ replaceXAxis: x.replace,
232
+ removeXAxis: x.remove,
233
+ addYAxis: y.add,
234
+ replaceYAxis: y.replace,
235
+ removeYAxis: y.remove,
236
+ addZAxis: z.add,
237
+ replaceZAxis: z.replace,
238
+ removeZAxis: z.remove,
259
239
  updateYAxisWidth({ id, width }) {
260
240
  setState((s) => {
261
241
  const axis = s.yAxis[id];
@@ -0,0 +1,51 @@
1
+ // The add / replace / remove algebra for a store-held array collection.
2
+ //
3
+ // Several slices keep a keyed collection as an array and expose the same three
4
+ // writes: append on add, swap-by-key on replace, filter-by-key on remove. Each
5
+ // used to hand-write that algebra (once per collection: cartesian + polar
6
+ // graphical items, reference dots/areas/lines, legend payload, tooltip entries).
7
+ // This concentrates it so the slice immutability contract (ADR-0002) lives in one
8
+ // place: every change produces a NEW array reference, so reference-equality
9
+ // selector caches invalidate; a future in-place slip can only regress here.
10
+ //
11
+ // The slice supplies `update`, which MUST read the current array and assign the
12
+ // result inside its own `setState` draft — the current-array read has to happen
13
+ // in the write batch, not in the caller's scope. Actions register from inside
14
+ // registerInStore's effect apply phase; a store read there (outside setState)
15
+ // would trip STRICT_READ_UNTRACKED. `update` returning the same reference from its
16
+ // updater is a no-op (matches the hand-written `index > -1` guard on replace).
17
+ //
18
+ // `keyOf` extracts the match key (an id field for most collections, a nested
19
+ // `settings.graphicalItemId` for tooltip entries). Slices without a replace action
20
+ // (reference elements) simply wire `add` and `remove`.
21
+
22
+ export interface CollectionActions<T> {
23
+ // Arrow-property signatures (not `add(item): void`) so consumers can reference
24
+ // these without the unbound-method lint firing — they carry no `this`.
25
+ add: (item: T) => void;
26
+ replace: (payload: { prev: T; next: T }) => void;
27
+ remove: (item: T) => void;
28
+ }
29
+
30
+ export function createCollectionActions<T>(
31
+ update: (updater: (arr: ReadonlyArray<T>) => ReadonlyArray<T>) => void,
32
+ // Match key — compared only with `===`, so any value type is fine (an id
33
+ // field for most collections, a nested `settings.graphicalItemId` for tooltip).
34
+ keyOf: (item: T) => unknown,
35
+ ): CollectionActions<T> {
36
+ return {
37
+ add: (item) => update((arr) => [...arr, item]),
38
+ replace: ({ prev, next }) =>
39
+ update((arr) => {
40
+ const index = arr.findIndex((it) => keyOf(it) === keyOf(prev));
41
+ // Absent key → return the same reference so `update` writes nothing.
42
+ if (index < 0) {
43
+ return arr;
44
+ }
45
+ const nextItems = arr.slice();
46
+ nextItems[index] = next;
47
+ return nextItems;
48
+ }),
49
+ remove: (item) => update((arr) => arr.filter((it) => keyOf(it) !== keyOf(item))),
50
+ };
51
+ }
@@ -0,0 +1,97 @@
1
+ // Hand-rolled replacement for reselect v5 `createSelector` (ADR-0002).
2
+ //
3
+ // The port initially replaced reselect with plain functions memoized only by
4
+ // each consumer's `createMemo` (ADR-0001), which lost *shared* memoization:
5
+ // every consumer re-ran the full selector chain. This module restores
6
+ // upstream's caching contract without the dependency:
7
+ //
8
+ // - Cache nodes live per store (WeakMap keyed on the root state object, so
9
+ // they are GC'd with the chart) and per primitive args (nested Maps, i.e.
10
+ // SameValueZero keying — `0` and `"0"` are distinct axis ids), mirroring
11
+ // reselect v5's `weakMapMemoize`.
12
+ // - A node recomputes its combiner only when one of its extracted input
13
+ // values changes by reference (`===`, reselect's default equality). This
14
+ // is sound because every slice follows the slice immutability contract:
15
+ // writes replace the objects along the written path.
16
+ // - Input selectors run tracked on EVERY evaluation — they are the sole
17
+ // reactive surface, so a consumer's `createMemo` subscribes identically on
18
+ // cache hits and misses. The combiner runs `untrack`ed and must be pure
19
+ // over its inputs (reselect's own contract; combiners never read state).
20
+ // - `resultEqualityCheck` (upstream's `memoizeOptions.resultEqualityCheck`)
21
+ // keeps the previous reference when a recompute produces a value-equal
22
+ // result, so downstream reference comparisons — and `useAppSelector`'s
23
+ // `createMemo` equality — stop propagation.
24
+ import { untrack } from "solid-js";
25
+
26
+ export type CreateSelectorOptions<Result> = {
27
+ /** When a recompute yields a value-equal result, return the previous reference. */
28
+ resultEqualityCheck?: (previous: Result, next: Result) => boolean;
29
+ };
30
+
31
+ type InputSelector<State> = (state: State, ...args: never[]) => unknown;
32
+
33
+ type CacheNode = {
34
+ entry?: { inputs: readonly unknown[]; result: unknown };
35
+ children?: Map<unknown, CacheNode>;
36
+ };
37
+
38
+ /**
39
+ * Memoizing selector factory — the Solid-native stand-in for reselect's
40
+ * `createSelector([inputs], combiner)`. The returned selector stays a plain
41
+ * function callable with or without a reactive owner; all callers of the same
42
+ * store share one cache node per argument combination.
43
+ *
44
+ * Input selectors must read every state path segment leading to the value they
45
+ * extract; the combiner must be pure over the extracted values. The returned
46
+ * function takes `...args: unknown[]` — callers annotate the exported const's
47
+ * type (e.g. `(state, axisType, axisId) => X`), which narrows this signature.
48
+ *
49
+ * Typed via a precise public overload + a loose implementation signature (the
50
+ * reselect approach): the body operates entirely on `unknown`, so it needs no
51
+ * type assertions while callers still get full input/combiner type checking.
52
+ */
53
+ export function createSelector<
54
+ State extends object,
55
+ Inputs extends readonly InputSelector<State>[],
56
+ Result,
57
+ >(
58
+ inputs: readonly [...Inputs],
59
+ combiner: (...values: { [K in keyof Inputs]: ReturnType<Inputs[K]> }) => Result,
60
+ options?: CreateSelectorOptions<Result>,
61
+ ): (state: State, ...args: unknown[]) => Result;
62
+ export function createSelector(
63
+ inputs: ReadonlyArray<(state: object, ...args: unknown[]) => unknown>,
64
+ combiner: (...values: unknown[]) => unknown,
65
+ options?: CreateSelectorOptions<unknown>,
66
+ ): (state: object, ...args: unknown[]) => unknown {
67
+ const cache = new WeakMap<object, CacheNode>();
68
+ const resultEqualityCheck = options?.resultEqualityCheck;
69
+
70
+ return (state: object, ...args: unknown[]): unknown => {
71
+ let node: CacheNode = cache.get(state) ?? {};
72
+ cache.set(state, node);
73
+ for (const arg of args) {
74
+ const children: Map<unknown, CacheNode> = node.children ?? new Map<unknown, CacheNode>();
75
+ node.children = children;
76
+ const child: CacheNode = children.get(arg) ?? {};
77
+ children.set(arg, child);
78
+ node = child;
79
+ }
80
+
81
+ // Tracked: the input reads are the selector's whole reactive surface.
82
+ const values: readonly unknown[] = inputs.map((input) => input(state, ...args));
83
+
84
+ const entry = node.entry;
85
+ if (entry != null && values.every((value, i) => value === entry.inputs[i])) {
86
+ return entry.result;
87
+ }
88
+
89
+ const result = untrack(() => combiner(...values));
90
+ if (entry != null && resultEqualityCheck != null && resultEqualityCheck(entry.result, result)) {
91
+ entry.inputs = values;
92
+ return entry.result;
93
+ }
94
+ node.entry = { inputs: values, result };
95
+ return result;
96
+ };
97
+ }
@@ -13,21 +13,13 @@ import {
13
13
  } from "./selectors/tooltipSelectors";
14
14
  import { selectTooltipEventType } from "./selectors/selectTooltipEventType";
15
15
  import type { RechartsStore } from "./store";
16
+ import { isEventThrottled } from "./isEventThrottled";
16
17
 
17
18
  export type ExternalEventActionPayload<E = Event> = {
18
19
  reactEvent: E;
19
20
  handler: CategoricalChartFunc<E> | undefined;
20
21
  };
21
22
 
22
- export type ExternalEventAction = {
23
- type: "externalEvent";
24
- payload: ExternalEventActionPayload;
25
- };
26
-
27
- export function externalEventAction(payload: ExternalEventActionPayload): ExternalEventAction {
28
- return { type: "externalEvent", payload };
29
- }
30
-
31
23
  const rafIdMap = new Map<string, number>();
32
24
  const timeoutIdMap = new Map<string, ReturnType<typeof setTimeout>>();
33
25
  const latestEventMap = new Map<
@@ -65,8 +57,7 @@ export function dispatchExternalEvent<E extends Event & { currentTarget: unknown
65
57
 
66
58
  const state = store.state;
67
59
  const { throttleDelay, throttledEvents } = state.eventSettings;
68
- const eventListAsString: "all" | ReadonlyArray<string> | undefined = throttledEvents;
69
- const isThrottled = eventListAsString === "all" || eventListAsString?.includes(eventType);
60
+ const isThrottled = isEventThrottled(throttledEvents, eventType);
70
61
 
71
62
  const existingTimeoutId = timeoutIdMap.get(eventType);
72
63
  if (existingTimeoutId !== undefined && (typeof throttleDelay !== "number" || !isThrottled)) {
@@ -11,6 +11,7 @@
11
11
  // unique `id` instead, which is the items' real identity and gives identical
12
12
  // ordering/replacement semantics.
13
13
  import { createStore } from "solid-js";
14
+ import { createCollectionActions } from "./createCollectionActions";
14
15
  import { ChartData } from "./chartDataSlice";
15
16
  import { AxisId } from "./cartesianAxisSlice";
16
17
  import { DataKey } from "../util/types";
@@ -112,50 +113,36 @@ export function createGraphicalItemsSlice(
112
113
  polarItems: [...initialState.polarItems],
113
114
  });
114
115
 
115
- const actions: GraphicalItemsActions = {
116
- // State arrays are typed ReadonlyArray (immutable external API), so actions
117
- // REASSIGN the whole array rather than mutate in place — Solid's fine-grained
118
- // store still tracks the change, and the readonly type stays honest.
119
- addCartesianGraphicalItem(item) {
120
- setState((s) => {
121
- s.cartesianItems = [...s.cartesianItems, item];
122
- });
123
- },
124
- replaceCartesianGraphicalItem({ prev, next }) {
116
+ // State arrays are typed ReadonlyArray (immutable external API); the collection
117
+ // actions reassign the whole array rather than mutate in place (see ADR-0002).
118
+ const cartesian = createCollectionActions<CartesianGraphicalItemSettings>(
119
+ (updater) =>
125
120
  setState((s) => {
126
- const index = s.cartesianItems.findIndex((it) => it.id === prev.id);
127
- if (index > -1) {
128
- const nextItems = s.cartesianItems.slice();
129
- nextItems[index] = next;
130
- s.cartesianItems = nextItems;
121
+ const next = updater(s.cartesianItems);
122
+ if (next !== s.cartesianItems) {
123
+ s.cartesianItems = next;
131
124
  }
132
- });
133
- },
134
- removeCartesianGraphicalItem(item) {
135
- setState((s) => {
136
- s.cartesianItems = s.cartesianItems.filter((it) => it.id !== item.id);
137
- });
138
- },
139
- addPolarGraphicalItem(item) {
140
- setState((s) => {
141
- s.polarItems = [...s.polarItems, item];
142
- });
143
- },
144
- replacePolarGraphicalItem({ prev, next }) {
125
+ }),
126
+ (it) => it.id,
127
+ );
128
+ const polar = createCollectionActions<PolarGraphicalItemSettings>(
129
+ (updater) =>
145
130
  setState((s) => {
146
- const index = s.polarItems.findIndex((it) => it.id === prev.id);
147
- if (index > -1) {
148
- const nextItems = s.polarItems.slice();
149
- nextItems[index] = next;
150
- s.polarItems = nextItems;
131
+ const next = updater(s.polarItems);
132
+ if (next !== s.polarItems) {
133
+ s.polarItems = next;
151
134
  }
152
- });
153
- },
154
- removePolarGraphicalItem(item) {
155
- setState((s) => {
156
- s.polarItems = s.polarItems.filter((it) => it.id !== item.id);
157
- });
158
- },
135
+ }),
136
+ (it) => it.id,
137
+ );
138
+
139
+ const actions: GraphicalItemsActions = {
140
+ addCartesianGraphicalItem: cartesian.add,
141
+ replaceCartesianGraphicalItem: cartesian.replace,
142
+ removeCartesianGraphicalItem: cartesian.remove,
143
+ addPolarGraphicalItem: polar.add,
144
+ replacePolarGraphicalItem: polar.replace,
145
+ removePolarGraphicalItem: polar.remove,
159
146
  };
160
147
 
161
148
  return { state, actions };
@@ -0,0 +1,12 @@
1
+ // The "is this event in the throttle allowlist" decision, shared verbatim by the
2
+ // mouse, keyboard, and external event middleware. Only the DECISION is shared:
3
+ // the timer-lifecycle downstream genuinely differs per middleware (mouse is
4
+ // trailing-only; keyboard and external are leading+trailing; external keys its
5
+ // timers per event type), so unifying the scheduling would change behavior and is
6
+ // deliberately left alone.
7
+ export function isEventThrottled(
8
+ throttledEvents: ReadonlyArray<string> | "all" | undefined,
9
+ eventName: string,
10
+ ): boolean {
11
+ return throttledEvents === "all" || (throttledEvents?.includes(eventName) ?? false);
12
+ }