@primeui/chart-core 0.0.1-alpha.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 (299) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1 -0
  3. package/dist/animations/index.d.mts +136 -0
  4. package/dist/animations/index.mjs +18 -0
  5. package/dist/annotation.utils-Bm0lOO1o.d.mts +290 -0
  6. package/dist/borderRadius.utils-Cz73LLR_.d.mts +54 -0
  7. package/dist/canvas-D4vigq47.d.mts +34 -0
  8. package/dist/canvas.utils-D2WHi2gL.d.mts +167 -0
  9. package/dist/cartesian/index.d.mts +94 -0
  10. package/dist/cartesian/index.mjs +93 -0
  11. package/dist/chunk-22ST6YPP.mjs +304 -0
  12. package/dist/chunk-2QK2KOBN.mjs +10 -0
  13. package/dist/chunk-2QRS4YQ5.mjs +18 -0
  14. package/dist/chunk-3FFJEX4A.mjs +261 -0
  15. package/dist/chunk-3IYSJ2U7.mjs +567 -0
  16. package/dist/chunk-3OZLP4I4.mjs +190 -0
  17. package/dist/chunk-3WEMHXZI.mjs +198 -0
  18. package/dist/chunk-3Z62EUJN.mjs +138 -0
  19. package/dist/chunk-4C6EVJ54.mjs +362 -0
  20. package/dist/chunk-53HW45JB.mjs +102 -0
  21. package/dist/chunk-55Y3WI6S.mjs +186 -0
  22. package/dist/chunk-5JCI2DEB.mjs +97 -0
  23. package/dist/chunk-66T4MRC5.mjs +113 -0
  24. package/dist/chunk-6HSEJLSR.mjs +376 -0
  25. package/dist/chunk-6STOLMCA.mjs +187 -0
  26. package/dist/chunk-7CMVDIOU.mjs +54 -0
  27. package/dist/chunk-7QQ6ETB4.mjs +228 -0
  28. package/dist/chunk-A6ZQZFL2.mjs +272 -0
  29. package/dist/chunk-ADKLH73T.mjs +1 -0
  30. package/dist/chunk-AGU3NG6D.mjs +22 -0
  31. package/dist/chunk-AHYIS6EB.mjs +230 -0
  32. package/dist/chunk-AP3UYWYT.mjs +4 -0
  33. package/dist/chunk-ARB5T6MP.mjs +326 -0
  34. package/dist/chunk-ARRGOEFX.mjs +585 -0
  35. package/dist/chunk-AUF4CHDP.mjs +422 -0
  36. package/dist/chunk-B4FTADAZ.mjs +561 -0
  37. package/dist/chunk-BABQKA6K.mjs +339 -0
  38. package/dist/chunk-BETFQBM2.mjs +197 -0
  39. package/dist/chunk-BKP26M4K.mjs +413 -0
  40. package/dist/chunk-BZN2QHGP.mjs +200 -0
  41. package/dist/chunk-C36VWQ7A.mjs +86 -0
  42. package/dist/chunk-CHW4RKY3.mjs +16 -0
  43. package/dist/chunk-CINXJIRR.mjs +120 -0
  44. package/dist/chunk-DN6AXQYZ.mjs +667 -0
  45. package/dist/chunk-DP2IZNN3.mjs +92 -0
  46. package/dist/chunk-DTWTCFRG.mjs +119 -0
  47. package/dist/chunk-EAMUNLRU.mjs +172 -0
  48. package/dist/chunk-EDAKJLNA.mjs +17 -0
  49. package/dist/chunk-ERVQB2VZ.mjs +59 -0
  50. package/dist/chunk-FFMT6OCO.mjs +92 -0
  51. package/dist/chunk-FHTC2YDB.mjs +102 -0
  52. package/dist/chunk-FRST55HY.mjs +16 -0
  53. package/dist/chunk-HDFGCN2F.mjs +132 -0
  54. package/dist/chunk-IEGLX7VL.mjs +42 -0
  55. package/dist/chunk-ILUWFYGY.mjs +220 -0
  56. package/dist/chunk-IXOWSEHO.mjs +114 -0
  57. package/dist/chunk-J4RI2C2G.mjs +172 -0
  58. package/dist/chunk-J65DBT4R.mjs +13 -0
  59. package/dist/chunk-JGOVWSKH.mjs +179 -0
  60. package/dist/chunk-JO7VACY2.mjs +25 -0
  61. package/dist/chunk-JWFBOPM6.mjs +122 -0
  62. package/dist/chunk-KNDZP446.mjs +895 -0
  63. package/dist/chunk-KP2TWD4Z.mjs +90 -0
  64. package/dist/chunk-KQIFO5I3.mjs +225 -0
  65. package/dist/chunk-KVDEROP6.mjs +59 -0
  66. package/dist/chunk-LKC7MZKK.mjs +87 -0
  67. package/dist/chunk-LVMDQ4OJ.mjs +305 -0
  68. package/dist/chunk-M7B3JF43.mjs +90 -0
  69. package/dist/chunk-MTGMXRNF.mjs +136 -0
  70. package/dist/chunk-N3TIT3OH.mjs +1040 -0
  71. package/dist/chunk-NHRK5KU2.mjs +890 -0
  72. package/dist/chunk-NKUYIWAP.mjs +243 -0
  73. package/dist/chunk-NPDZLYIF.mjs +238 -0
  74. package/dist/chunk-O2X6FF45.mjs +499 -0
  75. package/dist/chunk-OGJ6IIBW.mjs +176 -0
  76. package/dist/chunk-OHGCZZPZ.mjs +403 -0
  77. package/dist/chunk-OWW3K55O.mjs +351 -0
  78. package/dist/chunk-OXTFAWSK.mjs +60 -0
  79. package/dist/chunk-PLSDU3C2.mjs +890 -0
  80. package/dist/chunk-PRDVPOZX.mjs +223 -0
  81. package/dist/chunk-Q6PPVIHU.mjs +21 -0
  82. package/dist/chunk-QQBXUDM4.mjs +885 -0
  83. package/dist/chunk-QS76E3TD.mjs +111 -0
  84. package/dist/chunk-QWQ6HY4I.mjs +209 -0
  85. package/dist/chunk-R6Y3R7EW.mjs +135 -0
  86. package/dist/chunk-RBLZRT5K.mjs +190 -0
  87. package/dist/chunk-RO4N6YFS.mjs +167 -0
  88. package/dist/chunk-RQ3CKQOX.mjs +984 -0
  89. package/dist/chunk-SALTGZFR.mjs +208 -0
  90. package/dist/chunk-SANZPAJ4.mjs +14 -0
  91. package/dist/chunk-SDBPQ5CF.mjs +624 -0
  92. package/dist/chunk-SSLTFJ3U.mjs +364 -0
  93. package/dist/chunk-SXHVDJGF.mjs +77 -0
  94. package/dist/chunk-TA4MVAEX.mjs +243 -0
  95. package/dist/chunk-TAHCOZHF.mjs +1772 -0
  96. package/dist/chunk-TQ6S34QZ.mjs +152 -0
  97. package/dist/chunk-UPRXABX5.mjs +90 -0
  98. package/dist/chunk-VGLSBZDN.mjs +71 -0
  99. package/dist/chunk-VN7CKCSE.mjs +364 -0
  100. package/dist/chunk-VVI3OBPJ.mjs +524 -0
  101. package/dist/chunk-VWF57TS3.mjs +62 -0
  102. package/dist/chunk-WA3OVISZ.mjs +179 -0
  103. package/dist/chunk-WCG35U6M.mjs +964 -0
  104. package/dist/chunk-WFTX4AQJ.mjs +194 -0
  105. package/dist/chunk-WFVOQ2QZ.mjs +18 -0
  106. package/dist/chunk-WH3C3Y7P.mjs +149 -0
  107. package/dist/chunk-WPFUV7K3.mjs +488 -0
  108. package/dist/chunk-WRULPWHD.mjs +492 -0
  109. package/dist/chunk-WS64BZXT.mjs +1 -0
  110. package/dist/chunk-WY4AURRE.mjs +2419 -0
  111. package/dist/chunk-WYLILAOO.mjs +167 -0
  112. package/dist/chunk-X4D7FKUS.mjs +62 -0
  113. package/dist/chunk-X7T34OLW.mjs +139 -0
  114. package/dist/chunk-XIHBK5D3.mjs +68 -0
  115. package/dist/chunk-XQQCGFYB.mjs +50 -0
  116. package/dist/chunk-XTVE4P3L.mjs +214 -0
  117. package/dist/chunk-XUAASRXW.mjs +579 -0
  118. package/dist/chunk-Y3L3D4GQ.mjs +685 -0
  119. package/dist/chunk-YBJ56XJS.mjs +132 -0
  120. package/dist/chunk-ZQFK6CAE.mjs +1 -0
  121. package/dist/chunk-ZT2Z7ERM.mjs +874 -0
  122. package/dist/chunk-ZTL2FQEW.mjs +714 -0
  123. package/dist/circular/arc/index.d.mts +8 -0
  124. package/dist/circular/arc/index.mjs +3 -0
  125. package/dist/circular/index.d.mts +44 -0
  126. package/dist/circular/index.mjs +13 -0
  127. package/dist/collect.utils-DiKB4ciO.d.mts +12 -0
  128. package/dist/computeChartState-BTVIqwyO.d.mts +304 -0
  129. package/dist/controller-BJE1AZ3q.d.mts +82 -0
  130. package/dist/controller-BoNigQJr.d.mts +63 -0
  131. package/dist/controllers/index.d.mts +16 -0
  132. package/dist/controllers/index.mjs +110 -0
  133. package/dist/datalabel.utils-CkjGeB8S.d.mts +122 -0
  134. package/dist/decimation.utils-CcvJVhI4.d.mts +244 -0
  135. package/dist/geometry-DUUQJXVM.d.mts +60 -0
  136. package/dist/index-DseIZa1j.d.mts +167 -0
  137. package/dist/index.d.mts +88 -0
  138. package/dist/index.mjs +110 -0
  139. package/dist/orchestrator/index.d.mts +264 -0
  140. package/dist/orchestrator/index.mjs +33 -0
  141. package/dist/plugins/index.d.mts +18 -0
  142. package/dist/plugins/index.mjs +1 -0
  143. package/dist/property-animations-D433wXzz.d.mts +580 -0
  144. package/dist/property-store-NORUWFND.d.mts +17 -0
  145. package/dist/radial/index.d.mts +14 -0
  146. package/dist/radial/index.mjs +37 -0
  147. package/dist/renderers/axis/index.d.mts +39 -0
  148. package/dist/renderers/axis/index.mjs +8 -0
  149. package/dist/renderers/circular/index.d.mts +13 -0
  150. package/dist/renderers/circular/index.mjs +13 -0
  151. package/dist/renderers/index.d.mts +83 -0
  152. package/dist/renderers/index.mjs +75 -0
  153. package/dist/renderers/navigator/index.d.mts +103 -0
  154. package/dist/renderers/navigator/index.mjs +8 -0
  155. package/dist/resize.utils-D_2qm6rv.d.mts +142 -0
  156. package/dist/ring.utils-DXvrxMkU.d.mts +138 -0
  157. package/dist/scale-KFv30jqZ.d.mts +307 -0
  158. package/dist/scales-Drf8AIhL.d.mts +75 -0
  159. package/dist/series/bar/canvas/index.d.mts +8 -0
  160. package/dist/series/bar/canvas/index.mjs +10 -0
  161. package/dist/series/bar/controller/index.d.mts +105 -0
  162. package/dist/series/bar/controller/index.mjs +44 -0
  163. package/dist/series/bar/controller-canvas/index.d.mts +7 -0
  164. package/dist/series/bar/controller-canvas/index.mjs +49 -0
  165. package/dist/series/bar/controller-svg/index.d.mts +7 -0
  166. package/dist/series/bar/controller-svg/index.mjs +49 -0
  167. package/dist/series/bar/index.d.mts +60 -0
  168. package/dist/series/bar/index.mjs +13 -0
  169. package/dist/series/bar/svg/index.d.mts +8 -0
  170. package/dist/series/bar/svg/index.mjs +11 -0
  171. package/dist/series/candlestick/canvas/index.d.mts +8 -0
  172. package/dist/series/candlestick/canvas/index.mjs +8 -0
  173. package/dist/series/candlestick/controller/index.d.mts +123 -0
  174. package/dist/series/candlestick/controller/index.mjs +40 -0
  175. package/dist/series/candlestick/controller-canvas/index.d.mts +7 -0
  176. package/dist/series/candlestick/controller-canvas/index.mjs +45 -0
  177. package/dist/series/candlestick/controller-svg/index.d.mts +7 -0
  178. package/dist/series/candlestick/controller-svg/index.mjs +45 -0
  179. package/dist/series/candlestick/index.d.mts +11 -0
  180. package/dist/series/candlestick/index.mjs +10 -0
  181. package/dist/series/candlestick/svg/index.d.mts +8 -0
  182. package/dist/series/candlestick/svg/index.mjs +8 -0
  183. package/dist/series/heatmap/canvas/index.d.mts +16 -0
  184. package/dist/series/heatmap/canvas/index.mjs +9 -0
  185. package/dist/series/heatmap/controller/index.d.mts +110 -0
  186. package/dist/series/heatmap/controller/index.mjs +23 -0
  187. package/dist/series/heatmap/controller-canvas/index.d.mts +7 -0
  188. package/dist/series/heatmap/controller-canvas/index.mjs +28 -0
  189. package/dist/series/heatmap/controller-svg/index.d.mts +7 -0
  190. package/dist/series/heatmap/controller-svg/index.mjs +28 -0
  191. package/dist/series/heatmap/index.d.mts +34 -0
  192. package/dist/series/heatmap/index.mjs +13 -0
  193. package/dist/series/heatmap/svg/index.d.mts +15 -0
  194. package/dist/series/heatmap/svg/index.mjs +10 -0
  195. package/dist/series/line/canvas/index.d.mts +6 -0
  196. package/dist/series/line/canvas/index.mjs +9 -0
  197. package/dist/series/line/controller/index.d.mts +111 -0
  198. package/dist/series/line/controller/index.mjs +47 -0
  199. package/dist/series/line/controller-canvas/index.d.mts +7 -0
  200. package/dist/series/line/controller-canvas/index.mjs +54 -0
  201. package/dist/series/line/controller-svg/index.d.mts +7 -0
  202. package/dist/series/line/controller-svg/index.mjs +54 -0
  203. package/dist/series/line/index.d.mts +49 -0
  204. package/dist/series/line/index.mjs +13 -0
  205. package/dist/series/line/svg/index.d.mts +6 -0
  206. package/dist/series/line/svg/index.mjs +9 -0
  207. package/dist/series/pie/canvas/index.d.mts +8 -0
  208. package/dist/series/pie/canvas/index.mjs +10 -0
  209. package/dist/series/pie/controller/index.d.mts +174 -0
  210. package/dist/series/pie/controller/index.mjs +110 -0
  211. package/dist/series/pie/controller-canvas/index.d.mts +8 -0
  212. package/dist/series/pie/controller-canvas/index.mjs +119 -0
  213. package/dist/series/pie/controller-svg/index.d.mts +8 -0
  214. package/dist/series/pie/controller-svg/index.mjs +118 -0
  215. package/dist/series/pie/index.d.mts +59 -0
  216. package/dist/series/pie/index.mjs +15 -0
  217. package/dist/series/pie/svg/index.d.mts +6 -0
  218. package/dist/series/pie/svg/index.mjs +11 -0
  219. package/dist/series/polar/canvas/index.d.mts +6 -0
  220. package/dist/series/polar/canvas/index.mjs +7 -0
  221. package/dist/series/polar/controller/index.d.mts +102 -0
  222. package/dist/series/polar/controller/index.mjs +46 -0
  223. package/dist/series/polar/controller-canvas/index.d.mts +8 -0
  224. package/dist/series/polar/controller-canvas/index.mjs +52 -0
  225. package/dist/series/polar/controller-svg/index.d.mts +8 -0
  226. package/dist/series/polar/controller-svg/index.mjs +52 -0
  227. package/dist/series/polar/index.d.mts +25 -0
  228. package/dist/series/polar/index.mjs +16 -0
  229. package/dist/series/polar/svg/index.d.mts +10 -0
  230. package/dist/series/polar/svg/index.mjs +8 -0
  231. package/dist/series/radar/canvas/index.d.mts +6 -0
  232. package/dist/series/radar/canvas/index.mjs +8 -0
  233. package/dist/series/radar/controller/index.d.mts +121 -0
  234. package/dist/series/radar/controller/index.mjs +43 -0
  235. package/dist/series/radar/controller-canvas/index.d.mts +8 -0
  236. package/dist/series/radar/controller-canvas/index.mjs +51 -0
  237. package/dist/series/radar/controller-svg/index.d.mts +8 -0
  238. package/dist/series/radar/controller-svg/index.mjs +51 -0
  239. package/dist/series/radar/index.d.mts +40 -0
  240. package/dist/series/radar/index.mjs +13 -0
  241. package/dist/series/radar/svg/index.d.mts +12 -0
  242. package/dist/series/radar/svg/index.mjs +9 -0
  243. package/dist/series/scatter/canvas/index.d.mts +8 -0
  244. package/dist/series/scatter/canvas/index.mjs +11 -0
  245. package/dist/series/scatter/controller/index.d.mts +124 -0
  246. package/dist/series/scatter/controller/index.mjs +44 -0
  247. package/dist/series/scatter/controller-canvas/index.d.mts +7 -0
  248. package/dist/series/scatter/controller-canvas/index.mjs +51 -0
  249. package/dist/series/scatter/controller-svg/index.d.mts +7 -0
  250. package/dist/series/scatter/controller-svg/index.mjs +51 -0
  251. package/dist/series/scatter/index.d.mts +25 -0
  252. package/dist/series/scatter/index.mjs +14 -0
  253. package/dist/series/scatter/svg/index.d.mts +8 -0
  254. package/dist/series/scatter/svg/index.mjs +12 -0
  255. package/dist/series/treemap/canvas/index.d.mts +50 -0
  256. package/dist/series/treemap/canvas/index.mjs +10 -0
  257. package/dist/series/treemap/controller/index.d.mts +130 -0
  258. package/dist/series/treemap/controller/index.mjs +20 -0
  259. package/dist/series/treemap/controller-canvas/index.d.mts +7 -0
  260. package/dist/series/treemap/controller-canvas/index.mjs +25 -0
  261. package/dist/series/treemap/controller-svg/index.d.mts +7 -0
  262. package/dist/series/treemap/controller-svg/index.mjs +25 -0
  263. package/dist/series/treemap/index.d.mts +15 -0
  264. package/dist/series/treemap/index.mjs +12 -0
  265. package/dist/series/treemap/svg/index.d.mts +15 -0
  266. package/dist/series/treemap/svg/index.mjs +9 -0
  267. package/dist/slices-DtewiwJx.d.mts +72 -0
  268. package/dist/spatialIndex.utils-B_GJkotZ.d.mts +5 -0
  269. package/dist/squarify.utils-B9CQBpa1.d.mts +50 -0
  270. package/dist/stacking-CChuAcLN.d.mts +319 -0
  271. package/dist/streaming.utils-DH-g1gNP.d.mts +49 -0
  272. package/dist/sync/index.d.mts +130 -0
  273. package/dist/sync/index.mjs +5 -0
  274. package/dist/tooltip.renderer-D5wpSlBa.d.mts +210 -0
  275. package/dist/utils/color/index.d.mts +58 -0
  276. package/dist/utils/color/index.mjs +4 -0
  277. package/dist/utils/data/index.d.mts +180 -0
  278. package/dist/utils/data/index.mjs +7 -0
  279. package/dist/utils/export/index.d.mts +14 -0
  280. package/dist/utils/export/index.mjs +6 -0
  281. package/dist/utils/index.d.mts +49 -0
  282. package/dist/utils/index.mjs +29 -0
  283. package/dist/utils/interaction/index.d.mts +255 -0
  284. package/dist/utils/interaction/index.mjs +9 -0
  285. package/dist/utils/layout/index.d.mts +3 -0
  286. package/dist/utils/layout/index.mjs +10 -0
  287. package/dist/utils/math/index.d.mts +162 -0
  288. package/dist/utils/math/index.mjs +1 -0
  289. package/dist/utils/render/index.d.mts +19 -0
  290. package/dist/utils/render/index.mjs +3 -0
  291. package/dist/utils/specialized/index.d.mts +37 -0
  292. package/dist/utils/specialized/index.mjs +66 -0
  293. package/dist/utils/text/index.d.mts +39 -0
  294. package/dist/utils/text/index.mjs +8 -0
  295. package/dist/utils/theme/index.d.mts +295 -0
  296. package/dist/utils/theme/index.mjs +5 -0
  297. package/dist/utils/zoom/index.d.mts +90 -0
  298. package/dist/utils/zoom/index.mjs +3 -0
  299. package/package.json +56 -0
@@ -0,0 +1,685 @@
1
+ import { barHitTest, barFindNearest, barFindAllNearest } from './chunk-JGOVWSKH.mjs';
2
+ import { animatableBarToComputedBar } from './chunk-FRST55HY.mjs';
3
+ import { registerDatasetLayers, triggerCompositorRepaint } from './chunk-Q6PPVIHU.mjs';
4
+ import { resolveBarLabels } from './chunk-66T4MRC5.mjs';
5
+ import { renderResolvedLabels } from './chunk-QQBXUDM4.mjs';
6
+ import { computeBarVisualLayout } from './chunk-7QQ6ETB4.mjs';
7
+ import { AnimatedScene, resolveAnimatedProps, BAR_ANIMATABLE_PROPS } from './chunk-VN7CKCSE.mjs';
8
+ import { reconcileSvgChildren } from './chunk-KP2TWD4Z.mjs';
9
+ import { parseAnimationConfig } from './chunk-3WEMHXZI.mjs';
10
+ import { cancelRaf, raf } from './chunk-EDAKJLNA.mjs';
11
+ import { hoverConfigToFullEffect } from './chunk-BZN2QHGP.mjs';
12
+ import { generateSeriesDescription } from './chunk-OGJ6IIBW.mjs';
13
+ import { collectItems } from './chunk-FFMT6OCO.mjs';
14
+ import { defaultLightTheme } from './chunk-O2X6FF45.mjs';
15
+ import { setAttr, createSvgGroup, svgNode, appendChild, createSvgRect, materializeSvgNode } from './chunk-SSLTFJ3U.mjs';
16
+
17
+ // src/series/bar/controller/types.ts
18
+ var BAR_SCENE_REGISTRY = {
19
+ number: ["x", "y", "width", "height"],
20
+ color: []
21
+ };
22
+
23
+ // src/series/bar/controller/paint.ts
24
+ function groupAnimatedBarsByDataset(animatedBars) {
25
+ const grouped = /* @__PURE__ */ new Map();
26
+ for (const b of animatedBars) {
27
+ let arr = grouped.get(b.datasetId);
28
+ if (!arr) {
29
+ arr = [];
30
+ grouped.set(b.datasetId, arr);
31
+ }
32
+ arr.push(animatableBarToComputedBar(b));
33
+ }
34
+ return grouped;
35
+ }
36
+ function barHoverInteraction(base, dsId, hover, flags) {
37
+ const isAnyHover = hover.datasetId !== null;
38
+ const isAxisHover = hover.axisIndex != null;
39
+ const isThisSeriesHovered = hover.datasetId === dsId;
40
+ const { isWaterfall, isStacked, isGrouped } = flags;
41
+ return {
42
+ ...base,
43
+ hoveredIndex: isAxisHover ? hover.axisIndex ?? null : isThisSeriesHovered ? hover.index : null,
44
+ isSeriesHovered: isAxisHover || isWaterfall ? false : (isStacked || isGrouped) && isAnyHover && isThisSeriesHovered,
45
+ isSeriesDimmed: isAxisHover || isWaterfall ? false : isAnyHover && !isThisSeriesHovered
46
+ };
47
+ }
48
+ function buildBarSvgChildren(params) {
49
+ const { paint, layouts, renderProps, propertyOverrides, context, orientation, hover, labelConfig, onImageLoad, isZoomed, chartArea, chartId, isPercentStacked, isWaterfall, isStacked, isGrouped, datasetTotals, datasetVisibility } = params;
50
+ const flags = { isWaterfall, isStacked, isGrouped };
51
+ const datasetNodes = [];
52
+ for (const [dsId, layout] of layouts) {
53
+ const props = renderProps.get(dsId);
54
+ if (!props) continue;
55
+ const propsWithHover = {
56
+ ...props,
57
+ interaction: barHoverInteraction(props.interaction, dsId, hover, flags)
58
+ };
59
+ const barNode = paint.renderSvg(propsWithHover, layout, context);
60
+ setAttr(barNode, "data-dataset", dsId);
61
+ if (context.accessibility?.enabled && context.accessibility.landmarkVerbosity === "all") {
62
+ setAttr(barNode, "role", "region");
63
+ setAttr(barNode, "aria-label", generateSeriesDescription(props.name ?? dsId, "bar", layout.visibleBars.length));
64
+ }
65
+ const ov = propertyOverrides.get(dsId);
66
+ if (ov && ov.opacity != null) setAttr(barNode, "opacity", String(ov.opacity));
67
+ datasetNodes.push(barNode);
68
+ }
69
+ let labelsNode = null;
70
+ if (labelConfig && !labelConfig.render) {
71
+ const labelGroup = createSvgGroup();
72
+ setAttr(labelGroup, "data-layer", "labels");
73
+ for (const [dsId, layout] of layouts) {
74
+ if (datasetVisibility?.get(dsId) === false) continue;
75
+ const dsTotal = datasetTotals.get(dsId) ?? 0;
76
+ renderResolvedLabels(resolveBarLabels(layout.visibleBars, layout.colors, dsTotal, orientation, labelConfig, isPercentStacked, renderProps.get(dsId)?.name, renderProps.get(dsId)?.data), labelConfig, {
77
+ renderer: "svg",
78
+ svgGroup: labelGroup,
79
+ onImageLoad,
80
+ theme: context.theme
81
+ });
82
+ }
83
+ labelsNode = labelGroup;
84
+ }
85
+ if (isZoomed && chartArea) {
86
+ const clipId = `bar-zoom-clip-${chartId}`;
87
+ const clipPath = svgNode("clipPath", { id: clipId });
88
+ appendChild(clipPath, createSvgRect(chartArea.x, chartArea.y, chartArea.width, chartArea.height));
89
+ const dataTarget = createSvgGroup();
90
+ setAttr(dataTarget, "data-layer", "clipwrap");
91
+ setAttr(dataTarget, "clip-path", `url(#${clipId})`);
92
+ for (const n of datasetNodes) appendChild(dataTarget, n);
93
+ if (labelsNode) appendChild(dataTarget, labelsNode);
94
+ return [clipPath, dataTarget];
95
+ }
96
+ return labelsNode ? [...datasetNodes, labelsNode] : datasetNodes;
97
+ }
98
+ function renderBarsFrame(params) {
99
+ const {
100
+ paint,
101
+ renderer,
102
+ group,
103
+ canvas,
104
+ layouts,
105
+ renderProps,
106
+ propertyOverrides,
107
+ context,
108
+ orientation,
109
+ hover,
110
+ labelConfig,
111
+ onImageLoad,
112
+ isZoomed,
113
+ chartArea,
114
+ chartId,
115
+ isPercentStacked,
116
+ isWaterfall,
117
+ isStacked,
118
+ isGrouped,
119
+ datasetTotals,
120
+ datasetVisibility
121
+ } = params;
122
+ if (renderer === "svg" && group) {
123
+ const children = buildBarSvgChildren({
124
+ paint,
125
+ layouts,
126
+ renderProps,
127
+ propertyOverrides,
128
+ context,
129
+ orientation,
130
+ hover,
131
+ labelConfig,
132
+ onImageLoad,
133
+ isZoomed,
134
+ chartArea,
135
+ chartId,
136
+ isPercentStacked,
137
+ isWaterfall,
138
+ isStacked,
139
+ isGrouped,
140
+ datasetTotals,
141
+ datasetVisibility
142
+ });
143
+ group.replaceChildren(...children.map(materializeSvgNode));
144
+ }
145
+ if (renderer === "canvas") {
146
+ const ctx = canvas?.getContext("2d");
147
+ if (!ctx) return;
148
+ if (isZoomed && chartArea) {
149
+ ctx.save();
150
+ ctx.beginPath();
151
+ ctx.rect(chartArea.x, chartArea.y, chartArea.width, chartArea.height);
152
+ ctx.clip();
153
+ }
154
+ for (const [dsId, layout] of layouts) {
155
+ const props = renderProps.get(dsId);
156
+ if (!props) continue;
157
+ const propsWithHover = {
158
+ ...props,
159
+ interaction: barHoverInteraction(props.interaction, dsId, hover, { isWaterfall, isStacked, isGrouped })
160
+ };
161
+ paint.renderCanvas(propsWithHover, layout, ctx, context);
162
+ }
163
+ if (labelConfig) {
164
+ for (const [dsId, layout] of layouts) {
165
+ if (datasetVisibility?.get(dsId) === false) continue;
166
+ const dsTotal = datasetTotals.get(dsId) ?? 0;
167
+ renderResolvedLabels(resolveBarLabels(layout.visibleBars, layout.colors, dsTotal, orientation, labelConfig, isPercentStacked, renderProps.get(dsId)?.name, renderProps.get(dsId)?.data), labelConfig, {
168
+ renderer: "canvas",
169
+ ctx,
170
+ onImageLoad,
171
+ theme: context.theme
172
+ });
173
+ }
174
+ }
175
+ if (isZoomed && chartArea) {
176
+ ctx.restore();
177
+ }
178
+ }
179
+ }
180
+ function applyHover(ctx, hover) {
181
+ ctx.hover = hover;
182
+ if (!ctx.lastRenderedLayouts || !ctx.lastInput?.layoutData) return;
183
+ const input = ctx.lastInput;
184
+ const layoutData = input.layoutData;
185
+ if (triggerCompositorRepaint(input.renderer, ctx.canvasEl, input.compositor)) {
186
+ return;
187
+ }
188
+ if (ctx._animRafId !== null) {
189
+ ctx.hover = hover;
190
+ return;
191
+ }
192
+ if (input.renderer === "svg" && ctx.svgGroup) {
193
+ const children = buildBarSvgChildren({
194
+ paint: ctx._paint,
195
+ layouts: ctx.lastRenderedLayouts,
196
+ renderProps: ctx.renderPropsCache,
197
+ propertyOverrides: ctx._propertyOverrides,
198
+ context: layoutData.context,
199
+ orientation: layoutData.orientation,
200
+ hover,
201
+ labelConfig: ctx.labelConfig,
202
+ onImageLoad: ctx.onImageLoad,
203
+ isZoomed: input.isZoomed,
204
+ chartArea: layoutData.cartesianArea,
205
+ chartId: input.chartId,
206
+ isPercentStacked: layoutData.isPercentStacked,
207
+ isWaterfall: layoutData.isWaterfall,
208
+ isStacked: layoutData.isStacked,
209
+ isGrouped: layoutData.isGrouped,
210
+ datasetTotals: layoutData.datasetTotals,
211
+ datasetVisibility: input.datasetVisibility
212
+ });
213
+ reconcileSvgChildren(ctx.svgGroup, children);
214
+ return;
215
+ }
216
+ renderBarsFrame({
217
+ paint: ctx._paint,
218
+ renderer: input.renderer,
219
+ group: ctx.svgGroup,
220
+ canvas: ctx.canvasEl,
221
+ layouts: ctx.lastRenderedLayouts,
222
+ renderProps: ctx.renderPropsCache,
223
+ propertyOverrides: ctx._propertyOverrides,
224
+ context: layoutData.context,
225
+ orientation: layoutData.orientation,
226
+ hover,
227
+ labelConfig: ctx.labelConfig,
228
+ onImageLoad: ctx.onImageLoad,
229
+ isZoomed: input.isZoomed,
230
+ chartArea: layoutData.cartesianArea,
231
+ chartId: input.chartId,
232
+ isPercentStacked: layoutData.isPercentStacked,
233
+ isWaterfall: layoutData.isWaterfall,
234
+ isStacked: layoutData.isStacked,
235
+ isGrouped: layoutData.isGrouped,
236
+ datasetTotals: layoutData.datasetTotals,
237
+ dir: ctx.dir,
238
+ datasetVisibility: input.datasetVisibility
239
+ });
240
+ }
241
+
242
+ // src/series/bar/controller/scene.ts
243
+ function buildBarsFromScene(ctx) {
244
+ const result = [];
245
+ for (const el of ctx._scene.getElements()) {
246
+ const s = el.current;
247
+ result.push({
248
+ dataIndex: s.dataIndex,
249
+ datasetId: s.datasetId,
250
+ x: s.x,
251
+ y: s.y,
252
+ width: s.width,
253
+ height: s.height,
254
+ value: s.value,
255
+ category: s.category,
256
+ isNegative: s.isNegative,
257
+ baseX: s.baseX,
258
+ baseY: s.baseY,
259
+ orientation: s.orientation,
260
+ barKey: el.id
261
+ });
262
+ }
263
+ return result;
264
+ }
265
+ function buildLayoutsFromScene(ctx, animBars) {
266
+ const barsByDataset = groupAnimatedBarsByDataset(animBars);
267
+ const animated = /* @__PURE__ */ new Map();
268
+ for (const [dsId, computedBars] of barsByDataset) {
269
+ const template = ctx.layoutCache.get(dsId) ?? ctx.exitingBarLayouts.get(dsId);
270
+ if (!template) continue;
271
+ animated.set(dsId, { ...template, bars: computedBars, visibleBars: computedBars });
272
+ }
273
+ return animated;
274
+ }
275
+ function renderSceneFrame(ctx, layoutData, isFinalFrame = false) {
276
+ const animBars = buildBarsFromScene(ctx);
277
+ const frameLayouts = buildLayoutsFromScene(ctx, animBars);
278
+ ctx.lastRenderedLayouts = frameLayouts;
279
+ if (isFinalFrame) {
280
+ const liveDatasetIds = /* @__PURE__ */ new Set();
281
+ for (const b of animBars) liveDatasetIds.add(b.datasetId);
282
+ for (const dsId of [...ctx.exitingBarLayouts.keys()]) {
283
+ if (!liveDatasetIds.has(dsId)) {
284
+ ctx.exitingBarLayouts.delete(dsId);
285
+ ctx.exitingBarRenderProps.delete(dsId);
286
+ ctx.renderPropsCache.delete(dsId);
287
+ }
288
+ }
289
+ }
290
+ const input = ctx.lastInput;
291
+ if (triggerCompositorRepaint(input?.renderer ?? "svg", ctx.canvasEl, input?.compositor)) {
292
+ return;
293
+ }
294
+ renderBarsFrame({
295
+ paint: ctx._paint,
296
+ renderer: input?.renderer ?? "svg",
297
+ group: ctx.svgGroup,
298
+ canvas: ctx.canvasEl,
299
+ layouts: frameLayouts,
300
+ renderProps: ctx.renderPropsCache,
301
+ propertyOverrides: ctx._propertyOverrides,
302
+ context: layoutData.context,
303
+ orientation: layoutData.orientation,
304
+ hover: ctx.hover,
305
+ labelConfig: ctx.labelConfig,
306
+ onImageLoad: ctx.onImageLoad,
307
+ isZoomed: input?.isZoomed,
308
+ chartArea: layoutData.cartesianArea,
309
+ chartId: input?.chartId ?? "",
310
+ isPercentStacked: layoutData.isPercentStacked,
311
+ isWaterfall: layoutData.isWaterfall,
312
+ isStacked: layoutData.isStacked,
313
+ isGrouped: layoutData.isGrouped,
314
+ datasetTotals: layoutData.datasetTotals,
315
+ dir: ctx.dir,
316
+ datasetVisibility: input?.datasetVisibility
317
+ });
318
+ }
319
+ function startAnimLoop(ctx, layoutData) {
320
+ if (ctx._animRafId !== null) {
321
+ cancelRaf(ctx._animRafId);
322
+ }
323
+ const tick = (now) => {
324
+ ctx._animRafId = null;
325
+ const { allIdle } = ctx._scene.tick(now);
326
+ renderSceneFrame(ctx, layoutData, allIdle);
327
+ ctx.onFrame?.();
328
+ if (!allIdle) {
329
+ ctx._animRafId = raf(tick);
330
+ }
331
+ };
332
+ ctx._animRafId = raf(tick);
333
+ }
334
+
335
+ // src/series/bar/controller/index.ts
336
+ var BarRendererController = class {
337
+ constructor(paint) {
338
+ this._animRafId = null;
339
+ this._lastFingerprint = "";
340
+ this.lastRenderedLayouts = null;
341
+ // Toggle animation — layouts/props for datasets being hidden so they can shrink out
342
+ this.exitingBarLayouts = /* @__PURE__ */ new Map();
343
+ this.exitingBarRenderProps = /* @__PURE__ */ new Map();
344
+ // Layout caches (exposed for external consumers via getters)
345
+ this.layoutCache = /* @__PURE__ */ new Map();
346
+ this.renderPropsCache = /* @__PURE__ */ new Map();
347
+ this.barDatasets = [];
348
+ /**
349
+ * Per-dataset property-animation overrides. Layered onto layout-derived renderProps
350
+ * each `update()` and each `applyPropertyAnimations()` call. Property animations write
351
+ * here; layout/scene never touches it. Cleared in destroy().
352
+ */
353
+ this._propertyOverrides = /* @__PURE__ */ new Map();
354
+ // Current state.
355
+ // Single source of truth for the current hover. Written ONLY by applyHover (never
356
+ // re-seeded from input.hover), read by update()'s layout pass, the compositor paint
357
+ // callback, and _renderSceneFrame. Hover is event-driven and always arrives via
358
+ // applyHover, so re-seeding from the swappable input would let a stale input.hover
359
+ // clobber the live hover. Mirrors candlestick/heatmap/radar/polar.
360
+ this.hover = { datasetId: null, index: null };
361
+ this.labelConfig = null;
362
+ this.dir = "ltr";
363
+ this.lastInput = null;
364
+ // DOM targets (provided by framework wrapper)
365
+ this.svgGroup = null;
366
+ this.canvasEl = null;
367
+ /** Animation frame notification — framework registers this to trigger re-render/repaint */
368
+ this.onFrame = null;
369
+ this._paint = paint;
370
+ this._scene = new AnimatedScene({
371
+ // ENTER: bar grows from baseline (height/width = 0, position at base axis).
372
+ emptyState: (target) => {
373
+ if (target.orientation === "horizontal") {
374
+ return { ...target, x: target.baseX, width: 0 };
375
+ }
376
+ return { ...target, y: target.baseY, height: 0 };
377
+ },
378
+ // EXIT: bar shrinks back to baseline at its own position. Same shape as enter.
379
+ exitEmptyState: (target) => {
380
+ if (target.orientation === "horizontal") {
381
+ return { ...target, x: target.baseX, width: 0 };
382
+ }
383
+ return { ...target, y: target.baseY, height: 0 };
384
+ },
385
+ registry: BAR_SCENE_REGISTRY
386
+ });
387
+ }
388
+ // ================================================================
389
+ // PUBLIC API
390
+ // ================================================================
391
+ /**
392
+ * Full update — layout + animation start.
393
+ * Called by framework wrapper when data/config/layout changes.
394
+ */
395
+ update(input) {
396
+ this.lastInput = input;
397
+ this.labelConfig = input.labelConfig;
398
+ this.onImageLoad = input.onImageLoad;
399
+ this.svgGroup = input.svgGroup ?? null;
400
+ this.canvasEl = input.canvasEl ?? null;
401
+ const { datasets, datasetVisibility, layoutData, features, compositor, isZoomed } = input;
402
+ const sortedDatasets = Array.from(datasets.entries()).sort(([, a], [, b]) => a.order - b.order);
403
+ this.barDatasets = collectItems(sortedDatasets, datasetVisibility).bar;
404
+ const barVisual = layoutData?.barIntermediate ? computeBarVisualLayout({
405
+ intermediate: layoutData.barIntermediate,
406
+ sharedCategoryScale: layoutData.sharedCategoryScale,
407
+ valueScales: layoutData.valueScales,
408
+ valueDomains: layoutData.valueDomains,
409
+ cartesianArea: layoutData.cartesianArea,
410
+ orientation: layoutData.orientation,
411
+ axisLayouts: layoutData.axisLayouts,
412
+ hover: this.hover,
413
+ hoverConfig: input.hoverConfig ? hoverConfigToFullEffect(input.hoverConfig) : void 0,
414
+ theme: input.theme
415
+ }) : null;
416
+ const prevLayoutCache = this.layoutCache;
417
+ const prevRenderPropsCache = this.renderPropsCache;
418
+ if (barVisual) {
419
+ this.layoutCache = barVisual.layouts;
420
+ this.renderPropsCache = barVisual.renderProps;
421
+ } else {
422
+ this.layoutCache = /* @__PURE__ */ new Map();
423
+ this.renderPropsCache = /* @__PURE__ */ new Map();
424
+ }
425
+ if (!layoutData || !barVisual || barVisual.layouts.size === 0) {
426
+ this.lastRenderedLayouts = null;
427
+ if (this._animRafId !== null) {
428
+ cancelRaf(this._animRafId);
429
+ this._animRafId = null;
430
+ }
431
+ this._scene.reset();
432
+ this._lastFingerprint = "";
433
+ if (input.renderer === "svg" && this.svgGroup) {
434
+ while (this.svgGroup.firstChild) this.svgGroup.removeChild(this.svgGroup.firstChild);
435
+ }
436
+ return;
437
+ }
438
+ if (input.renderer === "svg" && !this.svgGroup) return;
439
+ const { layouts, allTargets } = barVisual;
440
+ const { context, orientation } = layoutData;
441
+ if (input.renderer === "canvas" && compositor) {
442
+ registerDatasetLayers(
443
+ compositor,
444
+ "bar",
445
+ layouts.keys(),
446
+ (dsId) => datasets.get(dsId)?.order ?? 0,
447
+ (dsId) => (ctx) => {
448
+ const layout = this.lastRenderedLayouts?.get(dsId);
449
+ if (!layout) return;
450
+ const props = this.renderPropsCache.get(dsId);
451
+ if (!props) return;
452
+ if (isZoomed && layoutData.cartesianArea) {
453
+ ctx.save();
454
+ ctx.beginPath();
455
+ ctx.rect(layoutData.cartesianArea.x, layoutData.cartesianArea.y, layoutData.cartesianArea.width, layoutData.cartesianArea.height);
456
+ ctx.clip();
457
+ }
458
+ const isAnyHoverCompositor = this.hover.datasetId !== null;
459
+ const isAxisHoverCompositor = this.hover.axisIndex != null;
460
+ const isThisSeriesHoveredCompositor = this.hover.datasetId === dsId;
461
+ const propsWithHover = {
462
+ ...props,
463
+ interaction: {
464
+ ...props.interaction,
465
+ hoveredIndex: isAxisHoverCompositor ? this.hover.axisIndex ?? null : isThisSeriesHoveredCompositor ? this.hover.index : null,
466
+ isSeriesHovered: isAxisHoverCompositor ? false : (layoutData.isStacked || layoutData.isGrouped) && isAnyHoverCompositor && isThisSeriesHoveredCompositor,
467
+ isSeriesDimmed: isAxisHoverCompositor ? false : isAnyHoverCompositor && !isThisSeriesHoveredCompositor
468
+ }
469
+ };
470
+ this._paint.renderCanvas(propsWithHover, layout, ctx, context);
471
+ if (this.labelConfig && this.lastInput?.datasetVisibility?.get(dsId) !== false) {
472
+ const dsTotal = layoutData.datasetTotals.get(dsId) ?? 0;
473
+ renderResolvedLabels(resolveBarLabels(layout.visibleBars, layout.colors, dsTotal, orientation, this.labelConfig, layoutData.isPercentStacked, props.name, props.data), this.labelConfig, {
474
+ renderer: "canvas",
475
+ ctx,
476
+ onImageLoad: this.onImageLoad,
477
+ theme: this.lastInput?.theme ?? defaultLightTheme
478
+ });
479
+ }
480
+ if (isZoomed && layoutData.cartesianArea) {
481
+ ctx.restore();
482
+ }
483
+ }
484
+ );
485
+ }
486
+ this.exitingBarLayouts.clear();
487
+ this.exitingBarRenderProps.clear();
488
+ for (const [dsId, prevLayout] of prevLayoutCache) {
489
+ if (!layouts.has(dsId)) {
490
+ this.exitingBarLayouts.set(dsId, prevLayout);
491
+ const pp = prevRenderPropsCache.get(dsId);
492
+ if (pp) this.exitingBarRenderProps.set(dsId, pp);
493
+ }
494
+ }
495
+ if (this.exitingBarRenderProps.size > 0) {
496
+ const merged = new Map(this.renderPropsCache);
497
+ for (const [dsId, pp] of this.exitingBarRenderProps) merged.set(dsId, pp);
498
+ this.renderPropsCache = merged;
499
+ }
500
+ if (this._propertyOverrides.size > 0) {
501
+ for (const [dsId, overrides] of this._propertyOverrides) {
502
+ const base = this.renderPropsCache.get(dsId);
503
+ if (base) this.renderPropsCache.set(dsId, { ...base, ...overrides });
504
+ }
505
+ }
506
+ const animConfig = features.get("animation")?.props;
507
+ const { enabled: animEnabled, duration, easing } = parseAnimationConfig(animConfig);
508
+ const limit = animConfig?.limit ?? 5e3;
509
+ const fingerprint = `${allTargets.map((t) => `${t.datasetId}:${t.dataIndex}:${t.value}:${Math.round(t.x)}`).join(";")}|${orientation}`;
510
+ const dataChanged = fingerprint !== this._lastFingerprint;
511
+ const shouldAnimate = animEnabled && duration > 0 && allTargets.length <= limit && allTargets.length > 0 && dataChanged;
512
+ const sceneTargets = /* @__PURE__ */ new Map();
513
+ for (const t of allTargets) {
514
+ sceneTargets.set(`${t.datasetId}-${t.dataIndex}`, {
515
+ x: t.x,
516
+ y: t.y,
517
+ width: t.width,
518
+ height: t.height,
519
+ value: t.value,
520
+ baseX: t.baseX,
521
+ baseY: t.baseY,
522
+ dataIndex: t.dataIndex,
523
+ datasetId: t.datasetId,
524
+ category: t.category,
525
+ isNegative: t.isNegative,
526
+ orientation: t.orientation
527
+ });
528
+ }
529
+ if (dataChanged && this._animRafId !== null) {
530
+ cancelRaf(this._animRafId);
531
+ this._animRafId = null;
532
+ }
533
+ const opts = { numbers: { duration: shouldAnimate ? duration : 0, easing } };
534
+ this._scene.diff(sceneTargets, opts);
535
+ if (dataChanged) {
536
+ this._lastFingerprint = fingerprint;
537
+ }
538
+ if (shouldAnimate) {
539
+ this._renderSceneFrame(layoutData);
540
+ this._startAnimLoop(layoutData);
541
+ } else {
542
+ this._scene.tick(performance.now());
543
+ this._renderSceneFrame(layoutData, true);
544
+ }
545
+ }
546
+ /**
547
+ * Lightweight hover repaint — re-renders current frame with updated hover state.
548
+ * Never cancels or restarts animations.
549
+ */
550
+ applyHover(hover) {
551
+ applyHover(this, hover);
552
+ }
553
+ /**
554
+ * Hit test at pixel coordinates.
555
+ */
556
+ hitTest(x, y) {
557
+ if (!this.lastInput?.layoutData) return null;
558
+ return barHitTest(x, y, { layouts: this.layoutCache, renderPropsCache: this.renderPropsCache, datasets: this.lastInput.datasets, layoutData: this.lastInput.layoutData, theme: this.lastInput.theme });
559
+ }
560
+ /**
561
+ * Find the nearest data point by category axis proximity (for crosshair mode).
562
+ */
563
+ findNearest(x, y) {
564
+ if (!this.lastInput?.layoutData) return null;
565
+ return barFindNearest(x, y, { layouts: this.layoutCache, renderPropsCache: this.renderPropsCache, datasets: this.lastInput.datasets, layoutData: this.lastInput.layoutData, theme: this.lastInput.theme });
566
+ }
567
+ /**
568
+ * Find ALL dataset hits at the nearest category (for multi-series crosshair badges).
569
+ */
570
+ findAllNearest(x, y) {
571
+ if (!this.lastInput?.layoutData) return null;
572
+ return barFindAllNearest(x, y, { layouts: this.layoutCache, renderPropsCache: this.renderPropsCache, datasets: this.lastInput.datasets, layoutData: this.lastInput.layoutData, theme: this.lastInput.theme });
573
+ }
574
+ /**
575
+ * Not used for bar (renders directly to DOM). Provided for interface compliance.
576
+ */
577
+ getSvgOutput() {
578
+ return null;
579
+ }
580
+ /** Whether any bar datasets exist */
581
+ get hasData() {
582
+ return this.barDatasets.length > 0;
583
+ }
584
+ /** Current bar layouts (for external consumers like CartesianRenderer) */
585
+ get layouts() {
586
+ return this.layoutCache;
587
+ }
588
+ /** Current bar render props (for external consumers) */
589
+ get renderProps() {
590
+ return this.renderPropsCache;
591
+ }
592
+ /**
593
+ * Cleanup — cancel animation loop, clear scene, remove compositor layers.
594
+ */
595
+ destroy() {
596
+ if (this._animRafId !== null) {
597
+ cancelRaf(this._animRafId);
598
+ this._animRafId = null;
599
+ }
600
+ this._scene.reset();
601
+ this._propertyOverrides.clear();
602
+ this.lastInput?.compositor?.removeLayersByPrefix("bar:");
603
+ }
604
+ /**
605
+ * Apply animated property values without triggering a full layout+render cycle.
606
+ * Called directly from the animation registry's repaint callback each frame.
607
+ *
608
+ * SVG: `opacity` animates via a cheap in-place attribute patch on the dataset group;
609
+ * any other prop (`borderStrokeWidth` → stroke-width, `borderRadius` → rx) needs a
610
+ * geometry rebuild — rx isn't an inheritable attr, so it can't be patched on the group.
611
+ * Those merge into the cache and trigger a full frame render, keeping SVG at parity with
612
+ * canvas (and consistent with the other renderers) for every BAR_ANIMATABLE_PROPS.
613
+ * Canvas: updates renderPropsCache then triggers a compositor repaint.
614
+ */
615
+ applyPropertyAnimations(store) {
616
+ const input = this.lastInput;
617
+ if (!input) return;
618
+ if (input.renderer === "svg" && this.svgGroup) {
619
+ const resolved = /* @__PURE__ */ new Map();
620
+ let needsFullRender = false;
621
+ for (const [dsId] of this.renderPropsCache) {
622
+ const overrides = resolveAnimatedProps(store, "bar", dsId, BAR_ANIMATABLE_PROPS);
623
+ if (Object.keys(overrides).length === 0) {
624
+ this._propertyOverrides.delete(dsId);
625
+ continue;
626
+ }
627
+ this._propertyOverrides.set(dsId, overrides);
628
+ resolved.set(dsId, overrides);
629
+ if (Object.keys(overrides).some((k) => k !== "opacity")) needsFullRender = true;
630
+ }
631
+ if (needsFullRender) {
632
+ for (const [dsId, overrides] of resolved) {
633
+ const base = this.renderPropsCache.get(dsId);
634
+ if (base) this.renderPropsCache.set(dsId, { ...base, ...overrides });
635
+ }
636
+ this.renderFrameCycle();
637
+ } else {
638
+ for (const [dsId, overrides] of resolved) {
639
+ if ("opacity" in overrides) {
640
+ this.svgGroup.querySelector(`[data-dataset="${dsId}"]`)?.setAttribute("opacity", String(overrides.opacity));
641
+ }
642
+ }
643
+ }
644
+ return;
645
+ }
646
+ if (input.renderer === "canvas") {
647
+ for (const [dsId, rp] of this.renderPropsCache) {
648
+ const overrides = resolveAnimatedProps(store, "bar", dsId, BAR_ANIMATABLE_PROPS);
649
+ if (Object.keys(overrides).length === 0) {
650
+ this._propertyOverrides.delete(dsId);
651
+ continue;
652
+ }
653
+ this._propertyOverrides.set(dsId, overrides);
654
+ this.renderPropsCache.set(dsId, { ...rp, ...overrides });
655
+ }
656
+ triggerCompositorRepaint(input.renderer, this.canvasEl, input.compositor);
657
+ }
658
+ }
659
+ /**
660
+ * Full re-render of the current scene state.
661
+ *
662
+ * Used by the property-animation framework wrapper: when a property
663
+ * animation completes and its override is released from the store, in-place
664
+ * SVG attribute patches (set during `applyPropertyAnimations`) leave
665
+ * attributes pointing at the last animated value. This method rebuilds the
666
+ * frame from `_propertyOverrides`-cleared base props so SVG attributes
667
+ * snap back to their base values.
668
+ */
669
+ renderFrameCycle() {
670
+ const layoutData = this.lastInput?.layoutData;
671
+ if (!layoutData) return;
672
+ this._renderSceneFrame(layoutData);
673
+ }
674
+ // ================================================================
675
+ // PRIVATE HELPERS
676
+ // ================================================================
677
+ _renderSceneFrame(layoutData, isFinalFrame = false) {
678
+ renderSceneFrame(this, layoutData, isFinalFrame);
679
+ }
680
+ _startAnimLoop(layoutData) {
681
+ startAnimLoop(this, layoutData);
682
+ }
683
+ };
684
+
685
+ export { BarRendererController };