@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,190 @@
1
+ import { renderCandlestickSvg } from './chunk-CINXJIRR.mjs';
2
+ import { renderCandlestickCanvas } from './chunk-FHTC2YDB.mjs';
3
+ import { DEFAULT_CANDLESTICK_WICK_WIDTH } from './chunk-NKUYIWAP.mjs';
4
+ import { FIELD_DEFAULTS, batchResolveAccessor, resolveAccessor, makeItemContext, resolveDash } from './chunk-O2X6FF45.mjs';
5
+
6
+ // src/series/candlestick/geometry.ts
7
+ var DEFAULT_BAR_WIDTH_RATIO = 0.7;
8
+ function calculateCandlestickLayout(props, chartArea, config, theme) {
9
+ const {
10
+ data,
11
+ timeField: time,
12
+ openField: openAcc = FIELD_DEFAULTS.openField,
13
+ highField: highAcc = FIELD_DEFAULTS.highField,
14
+ lowField: lowAcc = FIELD_DEFAULTS.lowField,
15
+ closeField: closeAcc = FIELD_DEFAULTS.closeField,
16
+ color: colorAcc,
17
+ variant = "candlestick",
18
+ // Direction colors stay undefined when user didn't pass them — SVG falls through
19
+ // to `.p-chart-candle-up/down/neutral` classes; canvas resolves to themed hex below.
20
+ upColor: userUpColor,
21
+ downColor: userDownColor,
22
+ neutralColor: userNeutralColor,
23
+ barWidthRatio = DEFAULT_BAR_WIDTH_RATIO,
24
+ wickStrokeWidth: wickStrokeWidthProp,
25
+ // Border props
26
+ borderUpColor,
27
+ borderDownColor,
28
+ borderNeutralColor,
29
+ borderDash: borderDashProp,
30
+ borderDashOffset: borderDashOffsetProp,
31
+ borderJoinStyle = "miter",
32
+ borderAlign = "center"
33
+ } = props;
34
+ const upColor = userUpColor ?? theme.positive;
35
+ const downColor = userDownColor ?? theme.negative;
36
+ const neutralColor = userNeutralColor ?? theme.candleNeutral;
37
+ const borderColor = typeof props.borderColor === "string" ? props.borderColor : void 0;
38
+ const borderWidth = typeof props.borderStrokeWidth === "number" ? props.borderStrokeWidth : 1;
39
+ const borderRadiusProp = typeof props.borderRadius === "number" ? props.borderRadius : typeof props.borderRadius === "object" && props.borderRadius !== null && !Array.isArray(props.borderRadius) ? props.borderRadius : void 0;
40
+ const { categoryScale, valueScale } = config;
41
+ const seriesExtras = { seriesIndex: props.order ?? 0, seriesId: props.id ?? "" };
42
+ const labels = batchResolveAccessor(time, data);
43
+ const opens = batchResolveAccessor(openAcc, data);
44
+ const highs = batchResolveAccessor(highAcc, data);
45
+ const lows = batchResolveAccessor(lowAcc, data);
46
+ const closes = batchResolveAccessor(closeAcc, data);
47
+ const bandwidth = categoryScale.bandwidth();
48
+ const bodyWidth = Math.max(1, bandwidth * barWidthRatio);
49
+ const candles = [];
50
+ for (let i = 0; i < data.length; i++) {
51
+ const label = String(labels[i] ?? i);
52
+ const o = Number(opens[i] ?? 0);
53
+ const h = Number(highs[i] ?? 0);
54
+ const l = Number(lows[i] ?? 0);
55
+ const c = Number(closes[i] ?? 0);
56
+ const catLeft = categoryScale(label);
57
+ if (catLeft === void 0 || !Number.isFinite(catLeft)) continue;
58
+ const cx = catLeft + bandwidth / 2;
59
+ const openY = valueScale(o);
60
+ const highY = valueScale(h);
61
+ const lowY = valueScale(l);
62
+ const closeY = valueScale(c);
63
+ if (isNaN(openY) || isNaN(highY) || isNaN(lowY) || isNaN(closeY)) continue;
64
+ const bodyTop = Math.min(openY, closeY);
65
+ const bodyBottom = Math.max(openY, closeY);
66
+ const direction = c > o ? "up" : c < o ? "down" : "neutral";
67
+ const prevClose = i > 0 ? Number(closes[i - 1] ?? c) : null;
68
+ const proDirection = prevClose === null ? direction : c > prevClose ? "up" : c < prevClose ? "down" : "neutral";
69
+ const isHollow = variant === "hollow";
70
+ const effectiveDirection = isHollow ? proDirection : direction;
71
+ const solidColor = effectiveDirection === "up" ? upColor : effectiveDirection === "down" ? downColor : neutralColor;
72
+ const perCandleColor = colorAcc ? resolveAccessor(colorAcc, makeItemContext(data[i], i, { value: c, category: label, ...seriesExtras })) : void 0;
73
+ const effectiveColor = typeof perCandleColor === "string" && perCandleColor ? perCandleColor : solidColor;
74
+ const bodyFill = isHollow && direction !== "down" ? null : effectiveColor;
75
+ const dirBorderColor = effectiveDirection === "up" ? borderUpColor ?? borderColor ?? effectiveColor : effectiveDirection === "down" ? borderDownColor ?? borderColor ?? effectiveColor : borderNeutralColor ?? borderColor ?? effectiveColor;
76
+ const bodyStroke = typeof perCandleColor === "string" && perCandleColor ? effectiveColor : dirBorderColor;
77
+ const wickColor = effectiveColor;
78
+ const directionUserBorder = effectiveDirection === "up" ? borderUpColor : effectiveDirection === "down" ? borderDownColor : borderNeutralColor;
79
+ const directionUserColor = effectiveDirection === "up" ? userUpColor : effectiveDirection === "down" ? userDownColor : userNeutralColor;
80
+ const useClass = perCandleColor === void 0 && directionUserColor === void 0 && directionUserBorder === void 0 && borderColor === void 0 ? effectiveDirection : null;
81
+ const left = cx - bodyWidth / 2;
82
+ const right = cx + bodyWidth / 2;
83
+ const visible = right >= chartArea.x && left <= chartArea.x + chartArea.width && highY <= chartArea.y + chartArea.height && lowY >= chartArea.y;
84
+ const candleCtx = makeItemContext(data[i], i, { value: c, category: label, ...seriesExtras });
85
+ const wickStrokeWidth = resolveAccessor(wickStrokeWidthProp, candleCtx, { arrayMode: "clip", fallback: DEFAULT_CANDLESTICK_WICK_WIDTH }) ?? DEFAULT_CANDLESTICK_WICK_WIDTH;
86
+ const candleBorderDash = resolveDash(borderDashProp, candleCtx);
87
+ const candleBorderDashOffset = resolveAccessor(borderDashOffsetProp, candleCtx, { arrayMode: "clip" });
88
+ candles.push({
89
+ dataIndex: i,
90
+ x: cx,
91
+ bodyTop,
92
+ bodyBottom,
93
+ openY,
94
+ closeY,
95
+ wickTop: highY,
96
+ wickBottom: lowY,
97
+ bodyWidth,
98
+ open: o,
99
+ high: h,
100
+ low: l,
101
+ close: c,
102
+ label,
103
+ direction,
104
+ proDirection,
105
+ bodyFill,
106
+ bodyStroke,
107
+ wickColor,
108
+ wickStrokeWidth,
109
+ borderDash: candleBorderDash,
110
+ borderDashOffset: candleBorderDashOffset,
111
+ useClass,
112
+ visible
113
+ });
114
+ }
115
+ const visibleCandles = candles.filter((c) => c.visible);
116
+ let domMin = Infinity;
117
+ let domMax = -Infinity;
118
+ for (let i = 0; i < lows.length; i++) {
119
+ const lv = Number(lows[i]);
120
+ const hv = Number(highs[i]);
121
+ if (!isNaN(lv) && lv < domMin) domMin = lv;
122
+ if (!isNaN(hv) && hv > domMax) domMax = hv;
123
+ }
124
+ const valueDomain = [isFinite(domMin) ? domMin : 0, isFinite(domMax) ? domMax : 100];
125
+ const borderStyle = {
126
+ borderStrokeWidth: borderWidth,
127
+ borderDash: candles[0]?.borderDash ?? [],
128
+ borderDashOffset: candles[0]?.borderDashOffset ?? 0,
129
+ borderJoinStyle,
130
+ borderAlign,
131
+ borderRadius: borderRadiusProp ?? 0
132
+ };
133
+ const layoutWickStrokeWidth = candles.length > 0 ? candles[0].wickStrokeWidth : DEFAULT_CANDLESTICK_WICK_WIDTH;
134
+ return {
135
+ candles,
136
+ visibleCandles,
137
+ categoryScale,
138
+ valueScale,
139
+ chartArea,
140
+ valueDomain,
141
+ variant,
142
+ wickStrokeWidth: layoutWickStrokeWidth,
143
+ borderStyle
144
+ };
145
+ }
146
+ function hitTestCandlestick(x, y, layout) {
147
+ for (const candle of layout.visibleCandles) {
148
+ const halfBody = candle.bodyWidth / 2;
149
+ if (Math.abs(x - candle.x) <= halfBody && y >= candle.wickTop && y <= candle.wickBottom) {
150
+ return candle.dataIndex;
151
+ }
152
+ }
153
+ return null;
154
+ }
155
+ function findNearestCandleIndex(x, layout) {
156
+ if (layout.visibleCandles.length === 0) return null;
157
+ let nearest = null;
158
+ let minDist = Infinity;
159
+ for (const candle of layout.visibleCandles) {
160
+ const dist = Math.abs(x - candle.x);
161
+ if (dist < minDist) {
162
+ minDist = dist;
163
+ nearest = candle;
164
+ }
165
+ }
166
+ return nearest ? nearest.dataIndex : null;
167
+ }
168
+
169
+ // src/series/candlestick/index.ts
170
+ var candlestickRenderer = {
171
+ calculateLayout() {
172
+ throw new Error("Use calculateCandlestickLayout with shared scale config from useCartesianLayout");
173
+ },
174
+ renderSvg: renderCandlestickSvg,
175
+ renderCanvas: renderCandlestickCanvas,
176
+ hitTest(x, y, _props, layout) {
177
+ return hitTestCandlestick(x, y, layout);
178
+ },
179
+ getAxisHints(props, data) {
180
+ const categoryLabels = batchResolveAccessor(props.timeField, data);
181
+ const highVals = batchResolveAccessor(props.highField ?? FIELD_DEFAULTS.highField, data);
182
+ const lowVals = batchResolveAccessor(props.lowField ?? FIELD_DEFAULTS.lowField, data);
183
+ return {
184
+ categoryLabels: categoryLabels.map(String),
185
+ domainValues: [...highVals.map(Number), ...lowVals.map(Number)]
186
+ };
187
+ }
188
+ };
189
+
190
+ export { calculateCandlestickLayout, candlestickRenderer, findNearestCandleIndex, hitTestCandlestick };
@@ -0,0 +1,198 @@
1
+ import { cancelRaf, raf } from './chunk-EDAKJLNA.mjs';
2
+
3
+ // src/animations/easing.ts
4
+ var linear = (t) => t;
5
+ var easeOutQuad = (t) => 1 - (1 - t) * (1 - t);
6
+ var easeOutCubic = (t) => 1 - Math.pow(1 - t, 3);
7
+ var easeOutQuart = (t) => 1 - Math.pow(1 - t, 4);
8
+ var easeOutQuint = (t) => 1 - Math.pow(1 - t, 5);
9
+ var easeOutExpo = (t) => t === 1 ? 1 : 1 - Math.pow(2, -10 * t);
10
+ var easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
11
+ var easeInOutQuart = (t) => t < 0.5 ? 8 * t * t * t * t : 1 - Math.pow(-2 * t + 2, 4) / 2;
12
+ var easeOutBack = (t) => {
13
+ const s = 1.70158;
14
+ const c3 = s + 1;
15
+ return 1 + c3 * Math.pow(t - 1, 3) + s * Math.pow(t - 1, 2);
16
+ };
17
+ var easeOutElastic = (t) => {
18
+ if (t === 0 || t === 1) return t;
19
+ const amplitude = 1;
20
+ const period = 0.3;
21
+ const s = period / (2 * Math.PI) * Math.asin(1 / amplitude);
22
+ return amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / period) + 1;
23
+ };
24
+ var easeOutBounce = (t) => {
25
+ const n1 = 7.5625;
26
+ const d1 = 2.75;
27
+ if (t < 1 / d1) {
28
+ return n1 * t * t;
29
+ } else if (t < 2 / d1) {
30
+ return n1 * (t -= 1.5 / d1) * t + 0.75;
31
+ } else if (t < 2.5 / d1) {
32
+ return n1 * (t -= 2.25 / d1) * t + 0.9375;
33
+ } else {
34
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
35
+ }
36
+ };
37
+ var easeInBounce = (t) => 1 - easeOutBounce(1 - t);
38
+ var easeInOutBounce = (t) => t < 0.5 ? (1 - easeOutBounce(1 - 2 * t)) / 2 : (1 + easeOutBounce(2 * t - 1)) / 2;
39
+ var easingRegistry = /* @__PURE__ */ new Map([
40
+ ["linear", linear],
41
+ ["easeOutQuad", easeOutQuad],
42
+ ["easeOutCubic", easeOutCubic],
43
+ ["easeOutQuart", easeOutQuart],
44
+ ["easeOutQuint", easeOutQuint],
45
+ ["easeOutExpo", easeOutExpo],
46
+ ["easeInOutCubic", easeInOutCubic],
47
+ ["easeInOutQuart", easeInOutQuart],
48
+ ["easeOutBack", easeOutBack],
49
+ ["easeOutElastic", easeOutElastic],
50
+ ["easeOutBounce", easeOutBounce],
51
+ ["easeInBounce", easeInBounce],
52
+ ["easeInOutBounce", easeInOutBounce]
53
+ ]);
54
+ function registerEasing(name, fn) {
55
+ easingRegistry.set(name, fn);
56
+ }
57
+ function getEasing(name) {
58
+ return easingRegistry.get(name) ?? easeOutQuart;
59
+ }
60
+ function hasEasing(name) {
61
+ return easingRegistry.has(name);
62
+ }
63
+ function getEasingNames() {
64
+ return Array.from(easingRegistry.keys());
65
+ }
66
+ var easings = {
67
+ linear,
68
+ easeOutQuad,
69
+ easeOutCubic,
70
+ easeOutQuart,
71
+ easeOutQuint,
72
+ easeOutExpo,
73
+ easeInOutCubic,
74
+ easeInOutQuart,
75
+ easeOutBack,
76
+ easeOutElastic,
77
+ easeOutBounce,
78
+ easeInBounce,
79
+ easeInOutBounce
80
+ };
81
+
82
+ // src/animations/controller.ts
83
+ function parseAnimationConfig(animConfig) {
84
+ const enabled = animConfig?.enabled !== false;
85
+ const duration = animConfig?.duration ?? 1e3;
86
+ const easing = animConfig?.easing ?? easeOutQuart;
87
+ return { enabled, duration, easing };
88
+ }
89
+ var AnimationController = class {
90
+ constructor() {
91
+ this.frameId = null;
92
+ this.generation = 0;
93
+ }
94
+ /**
95
+ * Cancel any ongoing animation
96
+ */
97
+ cancel() {
98
+ if (this.frameId !== null) {
99
+ cancelRaf(this.frameId);
100
+ this.frameId = null;
101
+ }
102
+ }
103
+ /**
104
+ * Schedule a new animation frame, canceling any existing
105
+ * Returns the generation number for this animation
106
+ */
107
+ schedule(callback) {
108
+ this.cancel();
109
+ this.generation++;
110
+ this.frameId = raf(callback);
111
+ return this.generation;
112
+ }
113
+ /**
114
+ * Continue animation loop (called from within animation)
115
+ */
116
+ continue(callback) {
117
+ this.frameId = raf(callback);
118
+ }
119
+ /**
120
+ * Mark animation as complete
121
+ */
122
+ complete() {
123
+ this.frameId = null;
124
+ }
125
+ /**
126
+ * Check if animation is running
127
+ */
128
+ isRunning() {
129
+ return this.frameId !== null;
130
+ }
131
+ /**
132
+ * Get current generation (for checking if animation was interrupted)
133
+ */
134
+ getGeneration() {
135
+ return this.generation;
136
+ }
137
+ /**
138
+ * Check if the given generation is still current
139
+ */
140
+ isCurrentGeneration(gen) {
141
+ return gen === this.generation;
142
+ }
143
+ /**
144
+ * Full cleanup
145
+ */
146
+ destroy() {
147
+ this.cancel();
148
+ this.generation = 0;
149
+ }
150
+ };
151
+ function animate(options) {
152
+ const { duration, easing = easeOutQuart, onFrame, onComplete, onCancel } = options;
153
+ const easingFn = typeof easing === "string" ? getEasing(easing) : easing;
154
+ const controller = new AnimationController();
155
+ const startTime = performance.now();
156
+ let lastRawProgress = 0;
157
+ let resolvePromise;
158
+ let rejectPromise;
159
+ const finished = new Promise((resolve, reject) => {
160
+ resolvePromise = resolve;
161
+ rejectPromise = reject;
162
+ });
163
+ finished.catch(() => {
164
+ });
165
+ const tick = (currentTime) => {
166
+ const elapsed = currentTime - startTime;
167
+ const rawProgress = Math.min(elapsed / duration, 1);
168
+ lastRawProgress = rawProgress;
169
+ const easedProgress = easingFn(rawProgress);
170
+ onFrame(easedProgress);
171
+ if (rawProgress < 1) {
172
+ controller.continue(tick);
173
+ } else {
174
+ controller.complete();
175
+ onComplete?.();
176
+ resolvePromise();
177
+ }
178
+ };
179
+ controller.schedule(tick);
180
+ return {
181
+ cancel() {
182
+ if (controller.isRunning()) {
183
+ controller.cancel();
184
+ onCancel?.();
185
+ rejectPromise();
186
+ }
187
+ },
188
+ isRunning() {
189
+ return controller.isRunning();
190
+ },
191
+ getRawProgress() {
192
+ return lastRawProgress;
193
+ },
194
+ finished
195
+ };
196
+ }
197
+
198
+ export { AnimationController, animate, easeInBounce, easeInOutBounce, easeInOutCubic, easeInOutQuart, easeOutBack, easeOutBounce, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easings, getEasing, getEasingNames, hasEasing, linear, parseAnimationConfig, registerEasing };
@@ -0,0 +1,138 @@
1
+ import { CHAR_WIDTH_RATIO, formatCompactValue, measureFontMetrics } from './chunk-XTVE4P3L.mjs';
2
+ import { resolveColorScaleRange, interpolateColor } from './chunk-QS76E3TD.mjs';
3
+ import { FIELD_DEFAULTS, batchResolveAccessor } from './chunk-O2X6FF45.mjs';
4
+ import { hexToRgbString } from './chunk-SSLTFJ3U.mjs';
5
+
6
+ // src/series/heatmap/geometry.ts
7
+ var DEFAULT_HEATMAP_NULL_COLOR = "#f3f4f6";
8
+ var DEFAULT_HEATMAP_CELL_PADDING = 1;
9
+ var HEATMAP_LABEL_TIERS = [
10
+ { minArea: 8e3, minWidth: 60, minHeight: 40, fontSize: 14 },
11
+ { minArea: 4e3, minWidth: 45, minHeight: 30, fontSize: 12 },
12
+ { minArea: 2e3, minWidth: 35, minHeight: 24, fontSize: 11 },
13
+ { minArea: 1e3, minWidth: 28, minHeight: 20, fontSize: 10 },
14
+ { minArea: 500, minWidth: 22, minHeight: 16, fontSize: 9 },
15
+ { minArea: 250, minWidth: 18, minHeight: 14, fontSize: 8 }
16
+ ];
17
+ function getHeatmapLabelInfo(cell) {
18
+ if (!cell.label) return { fontSize: 0, show: false };
19
+ const area = cell.width * cell.height;
20
+ for (const tier of HEATMAP_LABEL_TIERS) {
21
+ if (area >= tier.minArea && cell.width >= tier.minWidth && cell.height >= tier.minHeight) {
22
+ const textWidth = cell.label.length * CHAR_WIDTH_RATIO * tier.fontSize;
23
+ if (textWidth > cell.width - 6) continue;
24
+ return { fontSize: tier.fontSize, show: true };
25
+ }
26
+ }
27
+ return { fontSize: 0, show: false };
28
+ }
29
+ function calculateHeatmapLayout(props, chartArea, scales, theme) {
30
+ const { data, columnField: xField = FIELD_DEFAULTS.columnField, rowField: yField = FIELD_DEFAULTS.rowField, valueField = FIELD_DEFAULTS.valueField } = props;
31
+ const { xScale, yScale } = scales;
32
+ const cellPadding = props.spacing ?? DEFAULT_HEATMAP_CELL_PADDING;
33
+ const showEmptyCells = props.showEmptyCells !== false;
34
+ const showLabels = props.showLabels === true;
35
+ const labelFormat = props.labelFormat;
36
+ const xValues = batchResolveAccessor(xField, data);
37
+ const yValues = batchResolveAccessor(yField, data);
38
+ const rawValues = batchResolveAccessor(valueField, data);
39
+ const keyValues = props.keyField ? batchResolveAccessor(props.keyField, data) : null;
40
+ const xCategories = xScale.domain();
41
+ const yCategories = yScale.domain();
42
+ let minVal = Infinity;
43
+ let maxVal = -Infinity;
44
+ for (const v of rawValues) {
45
+ if (v != null && isFinite(v)) {
46
+ if (v < minVal) minVal = v;
47
+ if (v > maxVal) maxVal = v;
48
+ }
49
+ }
50
+ if (!isFinite(minVal)) {
51
+ minVal = 0;
52
+ maxVal = 1;
53
+ }
54
+ if (props.min != null) minVal = props.min;
55
+ if (props.max != null) maxVal = props.max;
56
+ const valueRange = [minVal, maxVal];
57
+ const range = maxVal - minVal;
58
+ const heatDefaults = theme ? [theme.heatColorMin, theme.heatColorMax] : void 0;
59
+ const colorResult = resolveColorScaleRange({ colorScale: props.colorScale, colorRange: props.colorRange, color: props.color, defaultColors: heatDefaults }, minVal, maxVal);
60
+ const isOpacityMode = colorResult === null;
61
+ const resolvedColorScale = colorResult?.colorScale ?? [];
62
+ const resolvedColorRange = colorResult?.colorRange ?? [];
63
+ const cellMap = /* @__PURE__ */ new Map();
64
+ for (let i = 0; i < data.length; i++) {
65
+ const key = `${String(xValues[i])}|${String(yValues[i])}`;
66
+ cellMap.set(key, i);
67
+ }
68
+ const cells = [];
69
+ const bandwidth = xScale.bandwidth();
70
+ const yBandwidth = yScale.bandwidth();
71
+ const nullColor = props.nullColor ?? theme?.heatNull ?? DEFAULT_HEATMAP_NULL_COLOR;
72
+ for (let rowIdx = 0; rowIdx < yCategories.length; rowIdx++) {
73
+ const yCat = yCategories[rowIdx];
74
+ for (let colIdx = 0; colIdx < xCategories.length; colIdx++) {
75
+ const xCat = xCategories[colIdx];
76
+ const key = `${xCat}|${yCat}`;
77
+ const dataIdx = cellMap.get(key);
78
+ const px = xScale(xCat);
79
+ const py = yScale(yCat);
80
+ if (px === void 0 || py === void 0) continue;
81
+ const rawVal = dataIdx !== void 0 ? rawValues[dataIdx] : null;
82
+ const isEmpty = rawVal == null;
83
+ if (isEmpty && !showEmptyCells) continue;
84
+ let color;
85
+ if (isEmpty) {
86
+ color = nullColor;
87
+ } else if (isOpacityMode) {
88
+ const opacity = range > 0 ? 0.15 + 0.85 * (rawVal - minVal) / range : 1;
89
+ color = `rgba(${hexToRgbString(props.color)},${opacity.toFixed(3)})`;
90
+ } else {
91
+ color = interpolateColor(resolvedColorScale, resolvedColorRange, rawVal);
92
+ }
93
+ let label = null;
94
+ if (showLabels && !isEmpty) {
95
+ label = labelFormat ? labelFormat(rawVal) : formatCompactValue(rawVal);
96
+ }
97
+ cells.push({
98
+ x: px + cellPadding,
99
+ y: py + cellPadding,
100
+ width: Math.max(0, bandwidth - cellPadding * 2),
101
+ height: Math.max(0, yBandwidth - cellPadding * 2),
102
+ color,
103
+ opacity: 1,
104
+ value: rawVal,
105
+ label,
106
+ xLabel: xCat,
107
+ yLabel: yCat,
108
+ index: dataIdx ?? -1,
109
+ dataKey: dataIdx !== void 0 && keyValues ? keyValues[dataIdx] : void 0,
110
+ row: rowIdx,
111
+ col: colIdx,
112
+ isEmpty
113
+ });
114
+ }
115
+ }
116
+ return { cells, chartArea, xCategories, yCategories, valueRange, resolvedColorScale, resolvedColorRange };
117
+ }
118
+ function hitTestHeatmap(layout, x, y) {
119
+ for (const cell of layout.cells) {
120
+ if (cell.isEmpty) continue;
121
+ if (x >= cell.x && x <= cell.x + cell.width && y >= cell.y && y <= cell.y + cell.height) {
122
+ return cell;
123
+ }
124
+ }
125
+ return null;
126
+ }
127
+
128
+ // src/series/heatmap/shared.ts
129
+ function resolveLabelMidToAlpha(cache, fontSize, fontFamily) {
130
+ let midToAlpha = cache.get(fontSize);
131
+ if (midToAlpha === void 0) {
132
+ midToAlpha = measureFontMetrics(fontSize, fontFamily, "600").midToAlpha;
133
+ cache.set(fontSize, midToAlpha);
134
+ }
135
+ return midToAlpha;
136
+ }
137
+
138
+ export { calculateHeatmapLayout, getHeatmapLabelInfo, hitTestHeatmap, resolveLabelMidToAlpha };