@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,624 @@
1
+ import { buildHeatmapFingerprint } from './chunk-SANZPAJ4.mjs';
2
+ import { renderCanvasHeatmapContent } from './chunk-TQ6S34QZ.mjs';
3
+ import { calculateHeatmapLayout, hitTestHeatmap } from './chunk-3Z62EUJN.mjs';
4
+ import { triggerCompositorRepaint } from './chunk-Q6PPVIHU.mjs';
5
+ import { renderAxisCanvas, calculateAxisLayout, calculateAxisSpace } from './chunk-ZTL2FQEW.mjs';
6
+ import { AnimatedScene, resolveAnimatedProps, HEATMAP_ANIMATABLE_PROPS } from './chunk-VN7CKCSE.mjs';
7
+ import { reconcileSvgChildren } from './chunk-KP2TWD4Z.mjs';
8
+ import { parseAnimationConfig } from './chunk-3WEMHXZI.mjs';
9
+ import { getResponsiveTier, getAdaptiveDefaults, getAdaptiveTickCount } from './chunk-YBJ56XJS.mjs';
10
+ import { raf, cancelRaf } from './chunk-EDAKJLNA.mjs';
11
+ import { buildAccessibilityRenderContext, generateSeriesDescription } from './chunk-OGJ6IIBW.mjs';
12
+ import { collectItems } from './chunk-FFMT6OCO.mjs';
13
+ import { DEFAULT_HOVER_BRIGHTNESS } from './chunk-NKUYIWAP.mjs';
14
+ import { FIELD_DEFAULTS, batchResolveRequired } from './chunk-O2X6FF45.mjs';
15
+ import { materializeSvgNode, setAttr } from './chunk-SSLTFJ3U.mjs';
16
+ import { createBandScale } from './chunk-RQ3CKQOX.mjs';
17
+
18
+ // src/series/heatmap/controller/index.ts
19
+ function uniqueValues(values) {
20
+ const seen = /* @__PURE__ */ new Set();
21
+ const result = [];
22
+ for (const v of values) {
23
+ const s = String(v);
24
+ if (!seen.has(s)) {
25
+ seen.add(s);
26
+ result.push(s);
27
+ }
28
+ }
29
+ return result;
30
+ }
31
+ function buildHeatmapSvgChildren(params) {
32
+ const children = [];
33
+ for (const [dsId, hmLayout] of params.frameLayouts) {
34
+ const hmProps = params.frameRenderProps.get(dsId);
35
+ if (!hmProps) continue;
36
+ const node = params.paint.renderSvg(hmProps, hmLayout, params.context);
37
+ setAttr(node, "data-dataset", dsId);
38
+ if (params.context.accessibility?.enabled && params.context.accessibility.landmarkVerbosity === "all") {
39
+ setAttr(node, "role", "region");
40
+ setAttr(node, "aria-label", generateSeriesDescription(hmProps.name ?? dsId, "heatmap", hmLayout.cells.length));
41
+ }
42
+ children.push(node);
43
+ }
44
+ return children;
45
+ }
46
+ var HEATMAP_CELL_REGISTRY = {
47
+ number: ["x", "y", "width", "height", "opacity"],
48
+ color: ["color"]
49
+ };
50
+ var HeatmapRendererController = class {
51
+ constructor(paint) {
52
+ // Animation lifecycle — local raf clock + fingerprint for phase detection.
53
+ this._animRafId = null;
54
+ // Single source of truth for the current hover. Written ONLY by applyHover, read by
55
+ // renderFrame (the scene-loop + full-render path). Must NOT live on the `input` object:
56
+ // the scene-loop tick captures a stale `input` while update() swaps `this.lastInput`, so
57
+ // an input-mutated hover is invisible to the running loop (caused "hover twice to show").
58
+ // Mirrors radar/polar's `this.hoverState`.
59
+ this._hover = { datasetId: null, index: null };
60
+ this._lastFingerprint = "";
61
+ this.layoutCache = /* @__PURE__ */ new Map();
62
+ this.lastRenderedLayout = null;
63
+ this.heatmapDatasets = [];
64
+ this.lastInput = null;
65
+ this.svgGroup = null;
66
+ this.canvasEl = null;
67
+ // Per-dataset property-animation overrides resolved from AnimatedPropertyStore.
68
+ // Set by `applyPropertyAnimations()` each property-animation tick and merged
69
+ // into render props uniformly across all cells of the dataset at every
70
+ // cache-write site (renderFrame + applyHover). Cleared by `destroy()`.
71
+ //
72
+ // Step 10 keeps this per-dataset only. Per-cell granularity is Step 14;
73
+ // the scene elements are already keyed per-cell from the Step 1 migration,
74
+ // but the override map is intentionally coarse for this phase.
75
+ this._propertyOverrides = /* @__PURE__ */ new Map();
76
+ // Computed results exposed via getters
77
+ this._scaleResult = null;
78
+ this._axisLayouts = /* @__PURE__ */ new Map();
79
+ this._adjustedArea = null;
80
+ this._layoutResult = null;
81
+ this.onFrame = null;
82
+ this._paint = paint;
83
+ this._scene = new AnimatedScene({
84
+ // ENTER: cell fades in from transparent at its final position.
85
+ emptyState: (target) => ({ ...target, opacity: 0 }),
86
+ // EXIT: cell fades to transparent at its current position.
87
+ exitEmptyState: (target) => ({ ...target, opacity: 0 }),
88
+ registry: HEATMAP_CELL_REGISTRY
89
+ });
90
+ }
91
+ // ================================================================
92
+ // PUBLIC API
93
+ // ================================================================
94
+ update(input) {
95
+ this.lastInput = input;
96
+ this.svgGroup = input.svgGroup ?? null;
97
+ this.canvasEl = input.canvasEl ?? null;
98
+ const { datasets, datasetVisibility, chartArea, width, height, axes, features, compositor, globalFont, locale } = input;
99
+ const sortedDatasets = Array.from(datasets.entries()).sort(([, a], [, b]) => a.order - b.order);
100
+ this.heatmapDatasets = collectItems(sortedDatasets, datasetVisibility).heatmap;
101
+ if (this.heatmapDatasets.length === 0) {
102
+ this._cancelRaf();
103
+ this._scene.reset();
104
+ this._lastFingerprint = "";
105
+ this._scaleResult = null;
106
+ this._axisLayouts = /* @__PURE__ */ new Map();
107
+ this._layoutResult = null;
108
+ this.layoutCache.clear();
109
+ return;
110
+ }
111
+ const hd0 = this.heatmapDatasets[0];
112
+ const xField = hd0.props.columnField ?? FIELD_DEFAULTS.columnField;
113
+ const yField = hd0.props.rowField ?? FIELD_DEFAULTS.rowField;
114
+ const xCategories = uniqueValues(batchResolveRequired(xField, hd0.props.data, "columnField"));
115
+ const yCategories = uniqueValues(batchResolveRequired(yField, hd0.props.data, "rowField"));
116
+ const { xScale, yScale, layouts: axLayouts, adjustedArea } = this.computeAxes(axes, xCategories, yCategories, chartArea, width, globalFont, locale);
117
+ this._scaleResult = { xScale, yScale, xCategories, yCategories };
118
+ this._axisLayouts = axLayouts;
119
+ this._adjustedArea = adjustedArea;
120
+ const visibleDatasets = this.heatmapDatasets.filter((d) => d.visible);
121
+ if (visibleDatasets.length === 0) {
122
+ this._layoutResult = null;
123
+ this.layoutCache.clear();
124
+ return;
125
+ }
126
+ const cellLayouts = /* @__PURE__ */ new Map();
127
+ const renderPropsMap = /* @__PURE__ */ new Map();
128
+ for (const hd of visibleDatasets) {
129
+ cellLayouts.set(hd.id, calculateHeatmapLayout(hd.props, adjustedArea, { xScale, yScale }, input.theme));
130
+ renderPropsMap.set(hd.id, hd.props);
131
+ }
132
+ this._layoutResult = { layouts: cellLayouts, renderPropsMap };
133
+ this.layoutCache = cellLayouts;
134
+ const context = { chartId: input.chartId, width, height, renderer: input.renderer, chartArea, font: globalFont, locale, theme: input.theme, accessibility: buildAccessibilityRenderContext(input.features) };
135
+ if (input.renderer === "canvas" && compositor) {
136
+ compositor.setBackground((ctx) => {
137
+ for (const [, axisInfo] of axLayouts) {
138
+ if (axisInfo.layout.gridLines.length > 0) {
139
+ renderAxisCanvas(ctx, axisInfo.layout, { gridOnly: true }, input.theme);
140
+ }
141
+ }
142
+ });
143
+ compositor.setForeground((ctx) => {
144
+ for (const [, axisInfo] of axLayouts) {
145
+ const axisProps = axisInfo.props;
146
+ renderAxisCanvas(ctx, axisInfo.layout, { skipGrid: true, skipAxisLine: axisProps.showLine === false, skipTicks: axisProps.showTicks === false }, input.theme);
147
+ }
148
+ });
149
+ for (const [dsId] of cellLayouts) {
150
+ const dsOrder = datasets.get(dsId)?.order ?? 0;
151
+ compositor.registerLayer({
152
+ id: `heatmap:${dsId}`,
153
+ order: dsOrder,
154
+ paint: (ctx) => {
155
+ const cached = this.lastRenderedLayout;
156
+ const hmLayout = cached?.layouts.get(dsId);
157
+ const hmProps = cached?.renderPropsMap.get(dsId);
158
+ if (!hmLayout || !hmProps) return;
159
+ this._paint.renderCanvas(hmProps, hmLayout, ctx, context);
160
+ if (input.resolveDatasetProps) {
161
+ renderCanvasHeatmapContent(ctx, /* @__PURE__ */ new Map([[dsId, hmLayout]]), input.resolveDatasetProps, () => {
162
+ const c = this.canvasEl?.getContext("2d");
163
+ if (c && compositor) compositor.repaint(c);
164
+ });
165
+ }
166
+ }
167
+ });
168
+ }
169
+ }
170
+ const animConfig = features.get("animation")?.props;
171
+ const { enabled: animEnabled, duration, easing } = parseAnimationConfig(animConfig);
172
+ const limit = animConfig?.limit ?? 5e3;
173
+ const fingerprint = buildHeatmapFingerprint(cellLayouts);
174
+ const phase = this._lastFingerprint === "" ? "entrance" : fingerprint !== "" && fingerprint !== this._lastFingerprint ? "update" : "static";
175
+ let totalCells = 0;
176
+ for (const layout of cellLayouts.values()) {
177
+ totalCells += layout.cells.filter((c) => !c.isEmpty).length;
178
+ }
179
+ const shouldAnimate = animEnabled && duration > 0 && totalCells <= limit && totalCells > 0 && phase !== "static";
180
+ if (phase === "static" && this._animRafId !== null) {
181
+ this._commit(fingerprint);
182
+ return;
183
+ }
184
+ this._cancelRaf();
185
+ const opts = {
186
+ numbers: { duration: shouldAnimate ? duration : 0, easing },
187
+ colors: { duration: shouldAnimate ? duration : 0, easing }
188
+ };
189
+ const sceneTargets = this._buildSceneTargets(cellLayouts);
190
+ this._scene.diff(sceneTargets, opts);
191
+ if (shouldAnimate) {
192
+ this._renderSceneFrame(cellLayouts, renderPropsMap, context, input);
193
+ const tick = (now) => {
194
+ this._animRafId = null;
195
+ const { allIdle } = this._scene.tick(now);
196
+ this._renderSceneFrame(cellLayouts, renderPropsMap, context, input);
197
+ if (!allIdle) {
198
+ this._animRafId = raf(tick);
199
+ }
200
+ };
201
+ this._animRafId = raf(tick);
202
+ } else {
203
+ this._scene.tick(performance.now());
204
+ this._renderSceneFrame(cellLayouts, renderPropsMap, context, input);
205
+ }
206
+ this._commit(fingerprint);
207
+ }
208
+ applyHover(hover) {
209
+ if (!this.lastRenderedLayout || !this.lastInput) return;
210
+ this._hover = hover;
211
+ const input = this.lastInput;
212
+ const context = {
213
+ chartId: input.chartId,
214
+ width: input.width,
215
+ height: input.height,
216
+ renderer: input.renderer,
217
+ chartArea: input.chartArea,
218
+ font: input.globalFont,
219
+ locale: input.locale,
220
+ theme: input.theme,
221
+ accessibility: buildAccessibilityRenderContext(input.features)
222
+ };
223
+ if (input.renderer === "canvas" && input.compositor) {
224
+ const cached = this.lastRenderedLayout;
225
+ const updatedProps = this.buildFrameRenderProps(cached.renderPropsMap, this._hover, input.hoverConfig);
226
+ this.lastRenderedLayout = { ...cached, renderPropsMap: updatedProps };
227
+ const ctx = this.canvasEl?.getContext("2d");
228
+ if (ctx) input.compositor.repaint(ctx);
229
+ } else if (input.renderer === "svg" && this.svgGroup && this._layoutResult) {
230
+ if (this._animRafId !== null) return;
231
+ const frameLayouts = this.lastRenderedLayout.layouts;
232
+ const frameRenderProps = this.buildFrameRenderProps(this._layoutResult.renderPropsMap, this._hover, input.hoverConfig);
233
+ const children = buildHeatmapSvgChildren({ paint: this._paint, frameLayouts, frameRenderProps, context });
234
+ reconcileSvgChildren(this.svgGroup, children);
235
+ }
236
+ }
237
+ hitTest(x, y) {
238
+ for (const [datasetId, heatmapLayout] of this.layoutCache) {
239
+ const cell = hitTestHeatmap(heatmapLayout, x, y);
240
+ if (cell) {
241
+ return { datasetId, index: cell.index, col: cell.col, value: cell.value, xLabel: cell.xLabel, yLabel: cell.yLabel, x: cell.x, y: cell.y, width: cell.width, height: cell.height, color: cell.color };
242
+ }
243
+ }
244
+ return null;
245
+ }
246
+ getColorScaleInfo() {
247
+ if (!this._layoutResult) return null;
248
+ const firstLayout = this._layoutResult.layouts.values().next().value;
249
+ if (!firstLayout || firstLayout.resolvedColorScale.length === 0) return null;
250
+ return { colorScale: firstLayout.resolvedColorScale, colorRange: firstLayout.resolvedColorRange, min: firstLayout.valueRange[0], max: firstLayout.valueRange[1] };
251
+ }
252
+ get hasData() {
253
+ return this.heatmapDatasets.length > 0;
254
+ }
255
+ get scaleResult() {
256
+ return this._scaleResult;
257
+ }
258
+ get axisLayouts() {
259
+ return this._axisLayouts;
260
+ }
261
+ get adjustedArea() {
262
+ return this._adjustedArea;
263
+ }
264
+ get layoutResult() {
265
+ return this._layoutResult;
266
+ }
267
+ get layouts() {
268
+ return this.layoutCache;
269
+ }
270
+ destroy() {
271
+ this._cancelRaf();
272
+ this._scene.reset();
273
+ this._lastFingerprint = "";
274
+ this._propertyOverrides.clear();
275
+ this.lastInput?.compositor?.removeLayersByPrefix("heatmap:");
276
+ }
277
+ /**
278
+ * Apply animated property values without triggering a full layout cycle.
279
+ * Called from the property-animation framework wrapper each animation tick.
280
+ *
281
+ * Per-dataset: writes overrides into `_propertyOverrides` (or deletes the
282
+ * entry when the store has no live values for it), then patches the active
283
+ * `lastRenderedLayout.renderPropsMap` and triggers a repaint. The overrides
284
+ * apply uniformly to all cells of the dataset — per-cell granularity is
285
+ * Step 14.
286
+ *
287
+ * SVG: heatmap renders cells imperatively each frame from
288
+ * `lastRenderedLayout.renderPropsMap`, so a `renderFrameCycle()` call replays
289
+ * the merged props onto the DOM. Canvas: refreshes the cache then triggers
290
+ * compositor repaint so the layer paint callback reads the merged props.
291
+ */
292
+ applyPropertyAnimations(store) {
293
+ const input = this.lastInput;
294
+ const cached = this.lastRenderedLayout;
295
+ if (!input || !cached) return;
296
+ let appliedAny = false;
297
+ for (const [dsId, baseProps] of cached.renderPropsMap) {
298
+ const overrides = resolveAnimatedProps(store, "heatmap", dsId, HEATMAP_ANIMATABLE_PROPS);
299
+ if (Object.keys(overrides).length === 0) {
300
+ if (this._propertyOverrides.delete(dsId)) appliedAny = true;
301
+ continue;
302
+ }
303
+ appliedAny = true;
304
+ this._propertyOverrides.set(dsId, overrides);
305
+ cached.renderPropsMap.set(dsId, { ...baseProps, ...overrides });
306
+ }
307
+ if (!appliedAny) return;
308
+ if (triggerCompositorRepaint(input.renderer, this.canvasEl, input.compositor)) return;
309
+ if (input.renderer === "svg" && this._layoutResult) {
310
+ const context = {
311
+ chartId: input.chartId,
312
+ width: input.width,
313
+ height: input.height,
314
+ renderer: input.renderer,
315
+ chartArea: input.chartArea,
316
+ font: input.globalFont,
317
+ locale: input.locale,
318
+ theme: input.theme,
319
+ accessibility: buildAccessibilityRenderContext(input.features)
320
+ };
321
+ this.renderFrame(cached.layouts, this._layoutResult.renderPropsMap, context, input);
322
+ }
323
+ }
324
+ /**
325
+ * Full re-render of the current scene state.
326
+ *
327
+ * Used by the property-animation framework wrapper: when a property
328
+ * animation completes and its override is released from the store, the
329
+ * next call to `_renderSceneFrame()` (via `renderFrame` here) rebuilds
330
+ * `lastRenderedLayout.renderPropsMap` from the now-empty overrides map,
331
+ * so SVG attributes / canvas paints snap back to base values.
332
+ */
333
+ renderFrameCycle() {
334
+ const input = this.lastInput;
335
+ const layoutResult = this._layoutResult;
336
+ const cached = this.lastRenderedLayout;
337
+ if (!input || !layoutResult || !cached) return;
338
+ const context = {
339
+ chartId: input.chartId,
340
+ width: input.width,
341
+ height: input.height,
342
+ renderer: input.renderer,
343
+ chartArea: input.chartArea,
344
+ font: input.globalFont,
345
+ locale: input.locale,
346
+ theme: input.theme,
347
+ accessibility: buildAccessibilityRenderContext(input.features)
348
+ };
349
+ this.renderFrame(cached.layouts, layoutResult.renderPropsMap, context, input);
350
+ }
351
+ // ================================================================
352
+ // PRIVATE
353
+ // ================================================================
354
+ /**
355
+ * Build the per-cell scene-target map from the computed cell layouts.
356
+ * Element id format: `${datasetId}::${dataKey ?? xLabel|yLabel}`. The
357
+ * `${datasetId}::` prefix scopes the id across datasets; within a dataset
358
+ * the suffix matches the legacy cellKey identity from animations/heatmap.ts.
359
+ */
360
+ _buildSceneTargets(cellLayouts) {
361
+ const targets = /* @__PURE__ */ new Map();
362
+ for (const [datasetId, layout] of cellLayouts) {
363
+ for (const cell of layout.cells) {
364
+ if (cell.isEmpty) continue;
365
+ const cellKey = cell.dataKey != null ? String(cell.dataKey) : `${cell.xLabel}|${cell.yLabel}`;
366
+ const id = `${datasetId}::${cellKey}`;
367
+ targets.set(id, {
368
+ x: cell.x,
369
+ y: cell.y,
370
+ width: cell.width,
371
+ height: cell.height,
372
+ opacity: 1,
373
+ color: cell.color,
374
+ value: cell.value,
375
+ row: cell.row,
376
+ col: cell.col,
377
+ xLabel: cell.xLabel,
378
+ yLabel: cell.yLabel,
379
+ datasetId,
380
+ dataKey: cell.dataKey,
381
+ isEmpty: false
382
+ });
383
+ }
384
+ }
385
+ return targets;
386
+ }
387
+ /**
388
+ * Walk the scene and rebuild per-dataset HeatmapRenderData reflecting the
389
+ * current visual state. Used by the raf tick loop to feed the existing
390
+ * render path without modifying the renderer.
391
+ *
392
+ * Layout structure (xCategories, yCategories, color scale, etc.) comes from
393
+ * the target layout in `cellLayouts`; per-cell visual state (x, y, width,
394
+ * height, opacity, color) comes from the scene's current frame.
395
+ */
396
+ _renderSceneFrame(cellLayouts, renderPropsMap, context, input) {
397
+ const cellIndexByDataset = /* @__PURE__ */ new Map();
398
+ for (const [datasetId, layout] of cellLayouts) {
399
+ const idx = /* @__PURE__ */ new Map();
400
+ for (const c of layout.cells) {
401
+ idx.set(`${c.row}|${c.col}`, c);
402
+ }
403
+ cellIndexByDataset.set(datasetId, idx);
404
+ }
405
+ const cellsByDataset = /* @__PURE__ */ new Map();
406
+ for (const el of this._scene.getElements()) {
407
+ const s = el.current;
408
+ const targetCell = cellIndexByDataset.get(s.datasetId)?.get(`${s.row}|${s.col}`);
409
+ if (!targetCell) continue;
410
+ const cell = {
411
+ ...targetCell,
412
+ x: s.x,
413
+ y: s.y,
414
+ width: s.width,
415
+ height: s.height,
416
+ opacity: s.opacity,
417
+ color: s.color,
418
+ value: s.value,
419
+ row: s.row,
420
+ col: s.col,
421
+ xLabel: s.xLabel,
422
+ yLabel: s.yLabel,
423
+ dataKey: s.dataKey,
424
+ isEmpty: false
425
+ };
426
+ let arr = cellsByDataset.get(s.datasetId);
427
+ if (!arr) {
428
+ arr = [];
429
+ cellsByDataset.set(s.datasetId, arr);
430
+ }
431
+ arr.push(cell);
432
+ }
433
+ const frameLayouts = /* @__PURE__ */ new Map();
434
+ for (const [datasetId, targetLayout] of cellLayouts) {
435
+ const liveCells = cellsByDataset.get(datasetId) ?? [];
436
+ const emptyCells = targetLayout.cells.filter((c) => c.isEmpty);
437
+ frameLayouts.set(datasetId, { ...targetLayout, cells: [...liveCells, ...emptyCells] });
438
+ }
439
+ this.renderFrame(frameLayouts, renderPropsMap, context, input);
440
+ }
441
+ /** Cancel any in-flight raf. */
442
+ _cancelRaf() {
443
+ if (this._animRafId !== null) {
444
+ cancelRaf(this._animRafId);
445
+ this._animRafId = null;
446
+ }
447
+ }
448
+ /** Commit fingerprint for next-frame phase detection. */
449
+ _commit(fingerprint) {
450
+ this._lastFingerprint = fingerprint;
451
+ }
452
+ /**
453
+ * Merge each base prop set with its property-animation override + the current
454
+ * hover/effects state into the per-dataset render props consumed by both the
455
+ * full render (renderFrame) and the in-place hover reconcile (applyHover).
456
+ * Single source of truth — the three call sites differ only in which base map
457
+ * and hover snapshot they feed in.
458
+ */
459
+ buildFrameRenderProps(baseMap, hover, hoverConfig) {
460
+ const result = /* @__PURE__ */ new Map();
461
+ for (const [dsId, baseProps] of baseMap) {
462
+ const overrides = this._propertyOverrides.get(dsId);
463
+ result.set(dsId, {
464
+ ...baseProps,
465
+ ...overrides ?? {},
466
+ interaction: { hoveredIndex: hover.datasetId === dsId ? hover.index : null },
467
+ // Heatmap hover diverges from other chart types: it does NOT dim the other cells by
468
+ // default. Dimming creates a visible flicker when the pointer crosses the gap between
469
+ // cells (the whole grid un-dims, then re-dims on the next cell). Instead heatmap
470
+ // brightens just the hovered cell. Callers can still opt back into dimming by passing
471
+ // an explicit `dimOpacity` on <Chart.Hover>.
472
+ effects: hoverConfig ? { dimOpacity: hoverConfig.dimOpacity ?? 1, hoverBrightness: hoverConfig.brightness ?? DEFAULT_HOVER_BRIGHTNESS } : void 0
473
+ });
474
+ }
475
+ return result;
476
+ }
477
+ renderFrame(frameLayouts, renderPropsMap, context, input) {
478
+ const frameRenderProps = this.buildFrameRenderProps(renderPropsMap, this._hover, input.hoverConfig);
479
+ this.lastRenderedLayout = { layouts: frameLayouts, renderPropsMap: frameRenderProps };
480
+ if (input.renderer === "svg" && this.svgGroup) {
481
+ const children = buildHeatmapSvgChildren({ paint: this._paint, frameLayouts, frameRenderProps, context });
482
+ this.svgGroup.replaceChildren(...children.map(materializeSvgNode));
483
+ }
484
+ if (input.renderer === "canvas" && input.compositor) {
485
+ const ctx = this.canvasEl?.getContext("2d");
486
+ if (ctx) input.compositor.repaint(ctx);
487
+ } else if (input.renderer === "canvas") {
488
+ const ctx = this.canvasEl?.getContext("2d");
489
+ if (!ctx) return;
490
+ for (const [dsId, hmLayout] of frameLayouts) {
491
+ const hmProps = frameRenderProps.get(dsId);
492
+ if (!hmProps) continue;
493
+ this._paint.renderCanvas(hmProps, hmLayout, ctx, context);
494
+ }
495
+ if (input.resolveDatasetProps) {
496
+ renderCanvasHeatmapContent(ctx, frameLayouts, input.resolveDatasetProps, () => {
497
+ const c = this.canvasEl?.getContext("2d");
498
+ if (c && input.compositor) input.compositor.repaint(c);
499
+ });
500
+ }
501
+ }
502
+ this.onFrame?.();
503
+ }
504
+ computeAxes(axes, xCategories, yCategories, chartArea, width, globalFont, locale) {
505
+ const tier = getResponsiveTier(width);
506
+ const adaptive = getAdaptiveDefaults(tier, globalFont);
507
+ const tempXScale = createBandScale(xCategories, [chartArea.x, chartArea.x + chartArea.width]);
508
+ const tempYScale = createBandScale(yCategories, [chartArea.y, chartArea.y + chartArea.height]);
509
+ let leftSpace = 0, rightSpace = 0, topSpace = 0, bottomSpace = 0;
510
+ const sidePrimarySet = /* @__PURE__ */ new Set();
511
+ const yAxesPrepped = [];
512
+ const xAxesPrepped = [];
513
+ for (const [yAxisId, yAxisConfig] of axes.y) {
514
+ const yPos = yAxisConfig.props.position ?? "left";
515
+ const isPrimary = !sidePrimarySet.has(yPos);
516
+ if (isPrimary) sidePrimarySet.add(yPos);
517
+ let yProps = yAxisConfig.props;
518
+ if (yProps.gridLines === void 0) yProps = { ...yProps, gridLines: isPrimary };
519
+ if (yProps.tickCount === void 0) yProps = { ...yProps, tickCount: getAdaptiveTickCount(chartArea.height) };
520
+ const existingTickStyle = yProps?.tickStyle;
521
+ if (typeof existingTickStyle !== "function" && !existingTickStyle?.fontSize) {
522
+ yProps = { ...yProps, tickStyle: { ...existingTickStyle, fontSize: adaptive.tickFontSize } };
523
+ }
524
+ const tempLayout = calculateAxisLayout(tempYScale, yPos, chartArea, yProps, void 0, globalFont, locale);
525
+ const space = calculateAxisSpace(
526
+ yPos,
527
+ !!yProps?.label,
528
+ {
529
+ tickLabels: tempLayout.ticks.map((t) => t.label ?? ""),
530
+ tickRotation: 0,
531
+ titleGap: yProps?.titleGap,
532
+ showTicks: yProps?.showTicks,
533
+ tickStyle: typeof existingTickStyle === "function" ? void 0 : existingTickStyle
534
+ },
535
+ void 0,
536
+ globalFont
537
+ );
538
+ if (yPos === "left") leftSpace += space;
539
+ else rightSpace += space;
540
+ yAxesPrepped.push({ id: yAxisId, pos: yPos, isPrimary, props: yProps });
541
+ }
542
+ for (const [xAxisId, xAxisConfig] of axes.x) {
543
+ const xPos = xAxisConfig.props.position ?? "bottom";
544
+ const isPrimary = !sidePrimarySet.has(xPos);
545
+ if (isPrimary) sidePrimarySet.add(xPos);
546
+ let xProps = xAxisConfig.props;
547
+ if (xProps.tickCount === void 0) xProps = { ...xProps, tickCount: getAdaptiveTickCount(chartArea.width) };
548
+ const existingTickStyle = xProps?.tickStyle;
549
+ if (typeof existingTickStyle !== "function" && !existingTickStyle?.fontSize) {
550
+ xProps = { ...xProps, tickStyle: { ...existingTickStyle, fontSize: adaptive.tickFontSize } };
551
+ }
552
+ const tempLayout = calculateAxisLayout(tempXScale, xPos, chartArea, xProps, void 0, globalFont, locale);
553
+ const space = calculateAxisSpace(
554
+ xPos,
555
+ !!xProps?.label,
556
+ {
557
+ tickLabels: tempLayout.ticks.map((t) => t.label ?? ""),
558
+ tickRotation: tempLayout.ticks.find((t) => t.label)?.rotation ?? 0,
559
+ titleGap: xProps?.titleGap,
560
+ showTicks: xProps?.showTicks,
561
+ tickStyle: typeof existingTickStyle === "function" ? void 0 : existingTickStyle
562
+ },
563
+ void 0,
564
+ globalFont
565
+ );
566
+ if (xPos === "top") topSpace += space;
567
+ else bottomSpace += space;
568
+ xAxesPrepped.push({ id: xAxisId, pos: xPos, isPrimary, props: xProps });
569
+ }
570
+ const adjusted = {
571
+ x: chartArea.x + leftSpace,
572
+ y: chartArea.y + topSpace,
573
+ width: Math.max(0, chartArea.width - leftSpace - rightSpace),
574
+ height: Math.max(0, chartArea.height - topSpace - bottomSpace)
575
+ };
576
+ const xScale = createBandScale(xCategories, [adjusted.x, adjusted.x + adjusted.width]);
577
+ const yScale = createBandScale(yCategories, [adjusted.y, adjusted.y + adjusted.height]);
578
+ const layouts = /* @__PURE__ */ new Map();
579
+ const sideOffsets = { left: 0, right: 0, top: 0, bottom: 0 };
580
+ for (const { id, pos, isPrimary, props } of yAxesPrepped) {
581
+ const offset = sideOffsets[pos];
582
+ const layout = calculateAxisLayout(yScale, pos, adjusted, props, void 0, globalFont, locale);
583
+ const existingTickStyle = props?.tickStyle;
584
+ const space = calculateAxisSpace(
585
+ pos,
586
+ !!props?.label,
587
+ {
588
+ tickLabels: layout.ticks.map((t) => t.label ?? ""),
589
+ tickRotation: 0,
590
+ titleGap: props?.titleGap,
591
+ showTicks: props?.showTicks,
592
+ tickStyle: typeof existingTickStyle === "function" ? void 0 : existingTickStyle
593
+ },
594
+ void 0,
595
+ globalFont
596
+ );
597
+ sideOffsets[pos] += space;
598
+ layouts.set(`y:${id}`, { id, axis: "y", position: pos, layout, visibleLayout: layout, scale: yScale, props, isPrimary, offset, space, isHidden: false });
599
+ }
600
+ for (const { id, pos, isPrimary, props } of xAxesPrepped) {
601
+ const offset = sideOffsets[pos];
602
+ const layout = calculateAxisLayout(xScale, pos, adjusted, props, void 0, globalFont, locale);
603
+ const existingTickStyle = props?.tickStyle;
604
+ const space = calculateAxisSpace(
605
+ pos,
606
+ !!props?.label,
607
+ {
608
+ tickLabels: layout.ticks.map((t) => t.label ?? ""),
609
+ tickRotation: layout.ticks.find((t) => t.label)?.rotation ?? 0,
610
+ titleGap: props?.titleGap,
611
+ showTicks: props?.showTicks,
612
+ tickStyle: typeof existingTickStyle === "function" ? void 0 : existingTickStyle
613
+ },
614
+ void 0,
615
+ globalFont
616
+ );
617
+ sideOffsets[pos] += space;
618
+ layouts.set(`x:${id}`, { id, axis: "x", position: pos, layout, visibleLayout: layout, scale: xScale, props, isPrimary, offset, space, isHidden: false });
619
+ }
620
+ return { xScale, yScale, layouts, adjustedArea: adjusted };
621
+ }
622
+ };
623
+
624
+ export { HeatmapRendererController };