@tabler/charts 0.1.0 → 0.2.0

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 (378) hide show
  1. package/README.md +19 -1
  2. package/dist/{annotations-Bp7HwtF5.d.ts → annotations-B02GR_KU.d.ts} +3 -8
  3. package/dist/{annotations-lyt0I3HU.d.cts → annotations-CHafaGd4.d.cts} +3 -8
  4. package/dist/{annotations-BszTTjf9.js → annotations-D0YQ0IoA.js} +6 -7
  5. package/dist/{annotations-BszTTjf9.js.map → annotations-D0YQ0IoA.js.map} +1 -1
  6. package/dist/{annotations-DpETO8dE.cjs → annotations-DdRdeBUB.cjs} +6 -7
  7. package/dist/{annotations-DpETO8dE.cjs.map → annotations-DdRdeBUB.cjs.map} +1 -1
  8. package/dist/annotations.cjs +3 -5
  9. package/dist/annotations.cjs.map +1 -1
  10. package/dist/annotations.d.cts +2 -1
  11. package/dist/annotations.d.ts +2 -1
  12. package/dist/annotations.js +3 -4
  13. package/dist/{arc-a1tRTEw7.js → arc-B3V5IR0w.js} +2 -3
  14. package/dist/{arc-a1tRTEw7.js.map → arc-B3V5IR0w.js.map} +1 -1
  15. package/dist/{arc-BXpLrt9b.cjs → arc-CYhI62kO.cjs} +2 -3
  16. package/dist/{arc-BXpLrt9b.cjs.map → arc-CYhI62kO.cjs.map} +1 -1
  17. package/dist/{area-DQsLERhx.js → area-0-L1bG9B.js} +5 -6
  18. package/dist/{area-DQsLERhx.js.map → area-0-L1bG9B.js.map} +1 -1
  19. package/dist/{area-sHCE3pg5.cjs → area-4eRs3c0K.cjs} +5 -6
  20. package/dist/{area-sHCE3pg5.cjs.map → area-4eRs3c0K.cjs.map} +1 -1
  21. package/dist/{area-CF__HOwL.d.ts → area-CJX9219z.d.cts} +3 -6
  22. package/dist/{area-DIxaAbYZ.d.cts → area-d11XePuw.d.ts} +3 -6
  23. package/dist/area.cjs +1 -1
  24. package/dist/area.d.cts +2 -1
  25. package/dist/area.d.ts +2 -1
  26. package/dist/area.js +1 -2
  27. package/dist/{band-DTcNDAFO.d.ts → band-CNKvdnTC.d.cts} +1 -4
  28. package/dist/{band-DTcNDAFO.d.cts → band-CNKvdnTC.d.ts} +1 -4
  29. package/dist/{bar-DM16NUvV.js → bar-B5n2oq9-.js} +3 -4
  30. package/dist/{bar-DM16NUvV.js.map → bar-B5n2oq9-.js.map} +1 -1
  31. package/dist/{bar-BBM8RhoL.d.ts → bar-BDLR4p9c.d.cts} +4 -7
  32. package/dist/{bar-jZEoao74.js → bar-BNZ3GhIw.js} +20 -20
  33. package/dist/bar-BNZ3GhIw.js.map +1 -0
  34. package/dist/{bar-C-7zR2qp.cjs → bar-Da6dE_nI.cjs} +20 -20
  35. package/dist/bar-Da6dE_nI.cjs.map +1 -0
  36. package/dist/{bar-DGuUN3nc.cjs → bar-LYIF8MEz.cjs} +3 -4
  37. package/dist/{bar-DGuUN3nc.cjs.map → bar-LYIF8MEz.cjs.map} +1 -1
  38. package/dist/{bar-CRKLDg98.d.cts → bar-XwzM6Pb0.d.ts} +4 -7
  39. package/dist/bar.cjs +1 -1
  40. package/dist/bar.d.cts +2 -1
  41. package/dist/bar.d.ts +2 -1
  42. package/dist/bar.js +1 -2
  43. package/dist/{candlestick-DuXwAFID.js → candlestick-BHQkQfxH.js} +6 -7
  44. package/dist/{candlestick-DuXwAFID.js.map → candlestick-BHQkQfxH.js.map} +1 -1
  45. package/dist/{candlestick-B5r1w3kc.cjs → candlestick-CYCQXgky.cjs} +6 -7
  46. package/dist/{candlestick-B5r1w3kc.cjs.map → candlestick-CYCQXgky.cjs.map} +1 -1
  47. package/dist/{candlestick-D_vV0_XZ.d.ts → candlestick-D0xKkdqd.d.ts} +3 -6
  48. package/dist/{candlestick-__pXl_pV.d.cts → candlestick-Dq7qp-F0.d.cts} +3 -6
  49. package/dist/candlestick.cjs +4 -5
  50. package/dist/candlestick.d.cts +1 -1
  51. package/dist/candlestick.d.ts +1 -1
  52. package/dist/candlestick.js +4 -6
  53. package/dist/{cartesian-Cr0AF0nG.js → cartesian-CI2x6N7N.js} +27 -27
  54. package/dist/cartesian-CI2x6N7N.js.map +1 -0
  55. package/dist/{cartesian-BoDfgBCV.cjs → cartesian-DV02PsBe.cjs} +27 -27
  56. package/dist/cartesian-DV02PsBe.cjs.map +1 -0
  57. package/dist/{chart-BF2CK9I_.js → chart-DWn9v6qw.js} +35 -24
  58. package/dist/chart-DWn9v6qw.js.map +1 -0
  59. package/dist/{chart-DyN7bcx8.d.ts → chart-QilhWP8Z.d.ts} +32 -49
  60. package/dist/{chart-CowF_lWY.cjs → chart-e2VqomCI.cjs} +35 -24
  61. package/dist/chart-e2VqomCI.cjs.map +1 -0
  62. package/dist/{chart-D7ooEFnk.d.cts → chart-kqFMEwDo.d.cts} +58 -49
  63. package/dist/{circle-BQMuAfls.cjs → circle-Bwxy5j7B.cjs} +2 -3
  64. package/dist/{circle-BQMuAfls.cjs.map → circle-Bwxy5j7B.cjs.map} +1 -1
  65. package/dist/{circle-Z7YfCoCM.js → circle-YRDaOBpk.js} +2 -3
  66. package/dist/{circle-Z7YfCoCM.js.map → circle-YRDaOBpk.js.map} +1 -1
  67. package/dist/{clean-o1vDEhFV.js → clean-CkoQobGv.js} +3 -4
  68. package/dist/{clean-o1vDEhFV.js.map → clean-CkoQobGv.js.map} +1 -1
  69. package/dist/{clean-Byl6kzf0.cjs → clean-Die2iCNc.cjs} +8 -3
  70. package/dist/{clean-Byl6kzf0.cjs.map → clean-Die2iCNc.cjs.map} +1 -1
  71. package/dist/{core-CegR_j55.js → core-BKRQvPAT.js} +33 -41
  72. package/dist/core-BKRQvPAT.js.map +1 -0
  73. package/dist/{core-RzS9IQO5.cjs → core-DIOC61up.cjs} +33 -41
  74. package/dist/core-DIOC61up.cjs.map +1 -0
  75. package/dist/{core-DcbemzGf.d.ts → core-DRUCk67j.d.ts} +4 -41
  76. package/dist/{core-D1vO1LrC.d.cts → core-PAX5ogLk.d.cts} +22 -67
  77. package/dist/core.cjs +28 -24
  78. package/dist/core.d.cts +23 -21
  79. package/dist/core.d.ts +23 -21
  80. package/dist/core.js +27 -25
  81. package/dist/{dates-CG-FvioW.js → dates-C2RzY3rE.js} +4 -5
  82. package/dist/{dates-CG-FvioW.js.map → dates-C2RzY3rE.js.map} +1 -1
  83. package/dist/{dates-Btm7Zm6W.cjs → dates-DurEr9WT.cjs} +4 -5
  84. package/dist/{dates-Btm7Zm6W.cjs.map → dates-DurEr9WT.cjs.map} +1 -1
  85. package/dist/{decimate-tLhDk1ys.cjs → decimate-BS3x8g-f.cjs} +2 -3
  86. package/dist/{decimate-tLhDk1ys.cjs.map → decimate-BS3x8g-f.cjs.map} +1 -1
  87. package/dist/{decimate-BGg9XgF0.d.ts → decimate-BxxYBJJk.d.cts} +2 -5
  88. package/dist/{decimate-C87cl_Sp.js → decimate-CapfgiDY.js} +2 -3
  89. package/dist/{decimate-C87cl_Sp.js.map → decimate-CapfgiDY.js.map} +1 -1
  90. package/dist/{decimate-CNSpgGa5.d.cts → decimate-Du87fMLG.d.ts} +2 -5
  91. package/dist/decimate.cjs +3 -4
  92. package/dist/decimate.d.cts +1 -1
  93. package/dist/decimate.d.ts +1 -1
  94. package/dist/decimate.js +3 -4
  95. package/dist/{dom-vP3IcMak.js → dom-CuceR8gt.js} +4 -6
  96. package/dist/{dom-vP3IcMak.js.map → dom-CuceR8gt.js.map} +1 -1
  97. package/dist/{dom-CLF868Qs.cjs → dom-D_g13XWY.cjs} +4 -6
  98. package/dist/{dom-CLF868Qs.cjs.map → dom-D_g13XWY.cjs.map} +1 -1
  99. package/dist/{export-chart-9w8t3rjZ.js → export-chart-83UYH48t.js} +3 -4
  100. package/dist/{export-chart-9w8t3rjZ.js.map → export-chart-83UYH48t.js.map} +1 -1
  101. package/dist/{export-chart-BhhYgksr.cjs → export-chart-mYgEfK-L.cjs} +3 -4
  102. package/dist/{export-chart-BhhYgksr.cjs.map → export-chart-mYgEfK-L.cjs.map} +1 -1
  103. package/dist/export.cjs +3 -5
  104. package/dist/export.cjs.map +1 -1
  105. package/dist/export.d.cts +8 -1
  106. package/dist/export.d.ts +8 -1
  107. package/dist/export.js +3 -4
  108. package/dist/{extent-BAMZo0Nq.js → extent-DOV8rs-6.js} +2 -3
  109. package/dist/{extent-BAMZo0Nq.js.map → extent-DOV8rs-6.js.map} +1 -1
  110. package/dist/{extent-DsFWvAHJ.cjs → extent-DuYDcvM9.cjs} +2 -3
  111. package/dist/{extent-DsFWvAHJ.cjs.map → extent-DuYDcvM9.cjs.map} +1 -1
  112. package/dist/{fade-Cs74puQS.cjs → fade-DVTkhrFU.cjs} +4 -6
  113. package/dist/{fade-Cs74puQS.cjs.map → fade-DVTkhrFU.cjs.map} +1 -1
  114. package/dist/{fade-D3NxH5Qg.js → fade-GGxcBdss.js} +4 -6
  115. package/dist/{fade-D3NxH5Qg.js.map → fade-GGxcBdss.js.map} +1 -1
  116. package/dist/{features-wASyHGic.js → features-BMxkqCyS.js} +2 -3
  117. package/dist/{features-wASyHGic.js.map → features-BMxkqCyS.js.map} +1 -1
  118. package/dist/{features-BclHgg2W.cjs → features-DCXEvoya.cjs} +2 -3
  119. package/dist/{features-BclHgg2W.cjs.map → features-DCXEvoya.cjs.map} +1 -1
  120. package/dist/{format-B0yKXBTH.cjs → format-CAE5ruy6.cjs} +2 -3
  121. package/dist/{format-B0yKXBTH.cjs.map → format-CAE5ruy6.cjs.map} +1 -1
  122. package/dist/{format-lStwuc1L.js → format-it1kepFG.js} +2 -3
  123. package/dist/{format-lStwuc1L.js.map → format-it1kepFG.js.map} +1 -1
  124. package/dist/{gauge-zpia05t2.d.ts → gauge-0VJuAHWF.d.ts} +5 -8
  125. package/dist/{gauge-DP_EB2z3.d.cts → gauge-BSist7My.d.cts} +5 -8
  126. package/dist/{gauge-D-FYhuds.cjs → gauge-DXkjXNCD.cjs} +10 -11
  127. package/dist/gauge-DXkjXNCD.cjs.map +1 -0
  128. package/dist/{gauge-Dh423FHh.js → gauge-ts0kqN1-.js} +10 -11
  129. package/dist/{gauge-Dh423FHh.js.map → gauge-ts0kqN1-.js.map} +1 -1
  130. package/dist/gauge.cjs +1 -1
  131. package/dist/gauge.d.cts +2 -1
  132. package/dist/gauge.d.ts +2 -1
  133. package/dist/gauge.js +1 -2
  134. package/dist/{heatmap-DSZ2bVIa.js → heatmap-19BGJTKF.js} +20 -22
  135. package/dist/heatmap-19BGJTKF.js.map +1 -0
  136. package/dist/{heatmap-BectCEeE.d.ts → heatmap-59lmClj9.d.ts} +4 -7
  137. package/dist/{heatmap-BK18EBgJ.cjs → heatmap-CXhlrLTl.cjs} +20 -22
  138. package/dist/heatmap-CXhlrLTl.cjs.map +1 -0
  139. package/dist/{heatmap-CCso6m61.d.cts → heatmap-Dp_oyEe0.d.cts} +4 -7
  140. package/dist/heatmap.cjs +1 -1
  141. package/dist/heatmap.d.cts +2 -1
  142. package/dist/heatmap.d.ts +2 -1
  143. package/dist/heatmap.js +1 -2
  144. package/dist/{hydrate-CzfxLfTv.d.ts → hydrate-BtAZf_5K.d.cts} +2 -5
  145. package/dist/{hydrate-CxwTXDqO.cjs → hydrate-CmN1k8Mo.cjs} +3 -4
  146. package/dist/hydrate-CmN1k8Mo.cjs.map +1 -0
  147. package/dist/{hydrate-DDNIHYv_.js → hydrate-OA6R2_Pn.js} +3 -4
  148. package/dist/{hydrate-DDNIHYv_.js.map → hydrate-OA6R2_Pn.js.map} +1 -1
  149. package/dist/{hydrate-CTTmQy0x.d.cts → hydrate-OjM1pIUG.d.ts} +2 -5
  150. package/dist/hydrate.cjs +3 -4
  151. package/dist/hydrate.cjs.map +1 -1
  152. package/dist/hydrate.d.cts +1 -1
  153. package/dist/hydrate.d.ts +1 -1
  154. package/dist/hydrate.js +3 -4
  155. package/dist/index.cjs +49 -46
  156. package/dist/index.cjs.map +1 -1
  157. package/dist/index.d.cts +24 -27
  158. package/dist/index.d.ts +24 -27
  159. package/dist/index.js +44 -43
  160. package/dist/index.js.map +1 -1
  161. package/dist/{layout-B3hiqVEw.js → layout-DmrrLjwN.js} +9 -4
  162. package/dist/layout-DmrrLjwN.js.map +1 -0
  163. package/dist/{layout-CtMBhNd9.cjs → layout-JY2aR-yE.cjs} +14 -3
  164. package/dist/layout-JY2aR-yE.cjs.map +1 -0
  165. package/dist/{line-B3Ed6u7j.js → line-DO66LtwH.js} +9 -10
  166. package/dist/{line-B3Ed6u7j.js.map → line-DO66LtwH.js.map} +1 -1
  167. package/dist/{line-fQbtP_jL.cjs → line-Dbt6KFRK.cjs} +9 -10
  168. package/dist/{line-fQbtP_jL.cjs.map → line-Dbt6KFRK.cjs.map} +1 -1
  169. package/dist/{line-CN4uZ9ZX.d.ts → line-DtSh7HQU.d.ts} +4 -7
  170. package/dist/{line-W7VD_qs1.d.cts → line-_rNdeKmS.d.cts} +5 -7
  171. package/dist/line.cjs +4 -5
  172. package/dist/line.cjs.map +1 -1
  173. package/dist/line.d.cts +1 -1
  174. package/dist/line.d.ts +1 -1
  175. package/dist/line.js +4 -6
  176. package/dist/{log-CaofN3-n.d.ts → log-CI41TmcU.d.cts} +1 -6
  177. package/dist/{log-CaofN3-n.d.cts → log-CI41TmcU.d.ts} +1 -6
  178. package/dist/{log-axis-83rSpvL5.cjs → log-axis-DdRNyAq8.cjs} +6 -8
  179. package/dist/{log-axis-83rSpvL5.cjs.map → log-axis-DdRNyAq8.cjs.map} +1 -1
  180. package/dist/{log-axis-B_uvvOFc.js → log-axis-DhthtHFk.js} +6 -8
  181. package/dist/{log-axis-B_uvvOFc.js.map → log-axis-DhthtHFk.js.map} +1 -1
  182. package/dist/log.cjs +3 -5
  183. package/dist/log.cjs.map +1 -1
  184. package/dist/log.d.cts +1 -1
  185. package/dist/log.d.ts +1 -1
  186. package/dist/log.js +3 -4
  187. package/dist/{morph-CqYDu1bY.cjs → morph-9_LJL0ra.cjs} +4 -5
  188. package/dist/morph-9_LJL0ra.cjs.map +1 -0
  189. package/dist/{morph-BMxz3X2b.d.ts → morph-Dh7gJkV4.d.cts} +1 -4
  190. package/dist/{morph-BMxz3X2b.d.cts → morph-Dh7gJkV4.d.ts} +1 -4
  191. package/dist/{morph-Bgg-24l8.js → morph-DnRxuwR-.js} +4 -5
  192. package/dist/{morph-Bgg-24l8.js.map → morph-DnRxuwR-.js.map} +1 -1
  193. package/dist/morph.cjs +3 -4
  194. package/dist/morph.cjs.map +1 -1
  195. package/dist/morph.d.cts +1 -1
  196. package/dist/morph.d.ts +1 -1
  197. package/dist/morph.js +3 -4
  198. package/dist/{named-BWWb5LQJ.cjs → named-BBASc8dW.cjs} +2 -3
  199. package/dist/{named-BWWb5LQJ.cjs.map → named-BBASc8dW.cjs.map} +1 -1
  200. package/dist/{named-DE15TOgh.js → named-BOiBah6I.js} +2 -3
  201. package/dist/{named-DE15TOgh.js.map → named-BOiBah6I.js.map} +1 -1
  202. package/dist/others-DWdK7vKp.cjs +60 -0
  203. package/dist/others-DWdK7vKp.cjs.map +1 -0
  204. package/dist/others-J7NCAMA0.js +49 -0
  205. package/dist/others-J7NCAMA0.js.map +1 -0
  206. package/dist/{parliament-1Zv2Xh0D.d.ts → parliament-CLCI7tUO.d.ts} +5 -8
  207. package/dist/{parliament-DdrLVZwt.d.cts → parliament-CgsVnWEe.d.cts} +5 -8
  208. package/dist/{parliament-Dw0sOERi.js → parliament-Cru4IcuM.js} +8 -9
  209. package/dist/parliament-Cru4IcuM.js.map +1 -0
  210. package/dist/{parliament-CpWnoEvG.cjs → parliament-x5hcFaQ3.cjs} +8 -9
  211. package/dist/parliament-x5hcFaQ3.cjs.map +1 -0
  212. package/dist/parliament.cjs +1 -1
  213. package/dist/parliament.d.cts +2 -1
  214. package/dist/parliament.d.ts +2 -1
  215. package/dist/parliament.js +1 -2
  216. package/dist/{path-CwB28da0.d.ts → path-YeUiOfG8.d.cts} +1 -4
  217. package/dist/{path-CwB28da0.d.cts → path-YeUiOfG8.d.ts} +1 -4
  218. package/dist/{patterns-DtgcnA8o.js → patterns-CufKZYhm.js} +4 -5
  219. package/dist/{patterns-DtgcnA8o.js.map → patterns-CufKZYhm.js.map} +1 -1
  220. package/dist/{patterns-LfcQAWCy.cjs → patterns-D3-wQagb.cjs} +4 -5
  221. package/dist/{patterns-LfcQAWCy.cjs.map → patterns-D3-wQagb.cjs.map} +1 -1
  222. package/dist/patterns.cjs +3 -5
  223. package/dist/patterns.cjs.map +1 -1
  224. package/dist/patterns.d.cts +5 -1
  225. package/dist/patterns.d.ts +5 -1
  226. package/dist/patterns.js +3 -4
  227. package/dist/percentage-bar-B6tNOqNn.js +157 -0
  228. package/dist/percentage-bar-B6tNOqNn.js.map +1 -0
  229. package/dist/percentage-bar-nhTeakD_.d.ts +62 -0
  230. package/dist/percentage-bar-tepMr7Hd.d.cts +62 -0
  231. package/dist/percentage-bar-ybNS3goo.cjs +162 -0
  232. package/dist/percentage-bar-ybNS3goo.cjs.map +1 -0
  233. package/dist/percentage-bar.cjs +3 -0
  234. package/dist/percentage-bar.d.cts +3 -0
  235. package/dist/percentage-bar.d.ts +3 -0
  236. package/dist/percentage-bar.js +1 -0
  237. package/dist/{pie-5z1fDdKO.d.ts → pie-BXg2gNpb.d.cts} +14 -8
  238. package/dist/{pie-BxTZt6Go.cjs → pie-BpjvSPnz.cjs} +13 -17
  239. package/dist/pie-BpjvSPnz.cjs.map +1 -0
  240. package/dist/{pie-BF9yI5mE.d.cts → pie-CFptILSm.d.ts} +14 -8
  241. package/dist/{pie-DzUXDTcn.js → pie-CVsc-6qD.js} +13 -17
  242. package/dist/pie-CVsc-6qD.js.map +1 -0
  243. package/dist/pie.cjs +1 -1
  244. package/dist/pie.d.cts +2 -1
  245. package/dist/pie.d.ts +2 -1
  246. package/dist/pie.js +1 -2
  247. package/dist/{point-shapes-CGl4dugc.cjs → point-shapes--_gmdTyK.cjs} +3 -4
  248. package/dist/{point-shapes-CGl4dugc.cjs.map → point-shapes--_gmdTyK.cjs.map} +1 -1
  249. package/dist/{point-shapes-DI84NNpI.js → point-shapes-DD2Ektzm.js} +3 -4
  250. package/dist/{point-shapes-DI84NNpI.js.map → point-shapes-DD2Ektzm.js.map} +1 -1
  251. package/dist/point-shapes.cjs +3 -4
  252. package/dist/point-shapes.d.cts +5 -1
  253. package/dist/point-shapes.d.ts +5 -1
  254. package/dist/point-shapes.js +3 -4
  255. package/dist/{radar-1-EryihA.d.ts → radar-BC9Skgpj.d.ts} +4 -7
  256. package/dist/{radar-CYPab_I4.js → radar-BR-mumDd.js} +7 -8
  257. package/dist/{radar-CYPab_I4.js.map → radar-BR-mumDd.js.map} +1 -1
  258. package/dist/{radar-DBW4O0Vt.d.cts → radar-D1-lItDy.d.cts} +4 -7
  259. package/dist/{radar-CoGUNNSb.cjs → radar-HPDrIdzc.cjs} +7 -8
  260. package/dist/{radar-CoGUNNSb.cjs.map → radar-HPDrIdzc.cjs.map} +1 -1
  261. package/dist/radar.cjs +1 -1
  262. package/dist/radar.d.cts +2 -1
  263. package/dist/radar.d.ts +2 -1
  264. package/dist/radar.js +1 -2
  265. package/dist/rect-D6VhynBM.cjs +16 -0
  266. package/dist/rect-D6VhynBM.cjs.map +1 -0
  267. package/dist/rect-DSVmUZrD.js +11 -0
  268. package/dist/rect-DSVmUZrD.js.map +1 -0
  269. package/dist/{sankey-B4PNKusJ.js → sankey-D6JeZfK5.js} +33 -29
  270. package/dist/sankey-D6JeZfK5.js.map +1 -0
  271. package/dist/{sankey-OV_WoPrl.d.ts → sankey-D_v7KxnJ.d.ts} +4 -7
  272. package/dist/{sankey-DuGI3Qc5.d.cts → sankey-Dk7jUt8x.d.cts} +4 -7
  273. package/dist/{sankey-Bacx4fVe.cjs → sankey-fCoo1cpz.cjs} +33 -29
  274. package/dist/sankey-fCoo1cpz.cjs.map +1 -0
  275. package/dist/sankey.cjs +1 -1
  276. package/dist/sankey.d.cts +2 -1
  277. package/dist/sankey.d.ts +2 -1
  278. package/dist/sankey.js +1 -2
  279. package/dist/{scatter-kgtgR318.js → scatter-C0TWjFpW.js} +21 -18
  280. package/dist/scatter-C0TWjFpW.js.map +1 -0
  281. package/dist/{scatter-BqzgJqdX.d.ts → scatter-CXEsioOJ.d.ts} +8 -9
  282. package/dist/{scatter-DgMN9zRy.cjs → scatter-DVqB_fP9.cjs} +21 -18
  283. package/dist/scatter-DVqB_fP9.cjs.map +1 -0
  284. package/dist/{scatter-DbxLyZX0.d.cts → scatter-DZeEIfyo.d.cts} +8 -9
  285. package/dist/scatter.cjs +1 -1
  286. package/dist/scatter.d.cts +2 -1
  287. package/dist/scatter.d.ts +2 -1
  288. package/dist/scatter.js +1 -2
  289. package/dist/{sparkline-BS9-hltA.cjs → sparkline-B39NA0Mi.cjs} +14 -13
  290. package/dist/sparkline-B39NA0Mi.cjs.map +1 -0
  291. package/dist/{sparkline-CWlJDKyh.d.cts → sparkline-DAP6jtzw.d.cts} +5 -8
  292. package/dist/{sparkline-BQzt27Fr.js → sparkline-XO_TqCNP.js} +14 -13
  293. package/dist/sparkline-XO_TqCNP.js.map +1 -0
  294. package/dist/{sparkline-BfyO_oNM.d.ts → sparkline-cbvRkWqS.d.ts} +5 -8
  295. package/dist/sparkline.cjs +1 -1
  296. package/dist/sparkline.d.cts +2 -1
  297. package/dist/sparkline.d.ts +2 -1
  298. package/dist/sparkline.js +1 -2
  299. package/dist/{stack-DRbwTeF3.js → stack-2H2Gfs1Q.js} +3 -4
  300. package/dist/{stack-DRbwTeF3.js.map → stack-2H2Gfs1Q.js.map} +1 -1
  301. package/dist/{stack-DVhJWaki.cjs → stack-BgPzoQmv.cjs} +3 -4
  302. package/dist/{stack-DVhJWaki.cjs.map → stack-BgPzoQmv.cjs.map} +1 -1
  303. package/dist/{stack-CpR6RGKd.d.ts → stack-DR0eQTsB.d.ts} +1 -4
  304. package/dist/{stack-CpR6RGKd.d.cts → stack-Dagxq7l2.d.cts} +2 -4
  305. package/dist/style.css +1 -1
  306. package/dist/{sweep-CbfR7--d.js → sweep-BpRPlhs6.js} +5 -6
  307. package/dist/{sweep-CbfR7--d.js.map → sweep-BpRPlhs6.js.map} +1 -1
  308. package/dist/{sweep-DaTEDDuC.cjs → sweep-Dnp6LDBz.cjs} +5 -6
  309. package/dist/sweep-Dnp6LDBz.cjs.map +1 -0
  310. package/dist/{time-CNVnt-B2.d.cts → time-B4oxWHQI.d.cts} +2 -7
  311. package/dist/{time-CHjiY9Q4.d.ts → time-DRIDgv2a.d.ts} +2 -7
  312. package/dist/{time-axis-VSX34_Tb.cjs → time-axis-BjZ1bYTK.cjs} +9 -10
  313. package/dist/{time-axis-VSX34_Tb.cjs.map → time-axis-BjZ1bYTK.cjs.map} +1 -1
  314. package/dist/{time-axis-Bc9eHX1r.js → time-axis-FLONo54E.js} +9 -10
  315. package/dist/{time-axis-Bc9eHX1r.js.map → time-axis-FLONo54E.js.map} +1 -1
  316. package/dist/time.cjs +4 -6
  317. package/dist/time.cjs.map +1 -1
  318. package/dist/time.d.cts +1 -1
  319. package/dist/time.d.ts +1 -1
  320. package/dist/time.js +4 -5
  321. package/dist/treemap-BAkhmVQc.d.cts +55 -0
  322. package/dist/treemap-BNpxFBao.d.ts +55 -0
  323. package/dist/treemap-BWpEUlDh.cjs +303 -0
  324. package/dist/treemap-BWpEUlDh.cjs.map +1 -0
  325. package/dist/treemap-CQdavQ9u.js +298 -0
  326. package/dist/treemap-CQdavQ9u.js.map +1 -0
  327. package/dist/treemap.cjs +3 -0
  328. package/dist/treemap.d.cts +3 -0
  329. package/dist/treemap.d.ts +3 -0
  330. package/dist/treemap.js +1 -0
  331. package/dist/{tween-BCYd0RTY.js → tween-BdQqUmmv.js} +2 -3
  332. package/dist/{tween-BCYd0RTY.js.map → tween-BdQqUmmv.js.map} +1 -1
  333. package/dist/{tween-CIGBlryn.cjs → tween-c3aOmfKE.cjs} +2 -3
  334. package/dist/{tween-CIGBlryn.cjs.map → tween-c3aOmfKE.cjs.map} +1 -1
  335. package/dist/{value-labels-IZIQPhfk.js → value-labels-BBuSi4i0.js} +7 -7
  336. package/dist/value-labels-BBuSi4i0.js.map +1 -0
  337. package/dist/{value-labels-B0WJoJ7x.cjs → value-labels-BV9keAuL.cjs} +7 -7
  338. package/dist/value-labels-BV9keAuL.cjs.map +1 -0
  339. package/dist/value-labels.cjs +3 -5
  340. package/dist/value-labels.cjs.map +1 -1
  341. package/dist/value-labels.d.cts +5 -1
  342. package/dist/value-labels.d.ts +5 -1
  343. package/dist/value-labels.js +3 -4
  344. package/dist/{vnode-CkQ27Cxe.cjs → vnode-ClAiw28x.cjs} +2 -3
  345. package/dist/{vnode-CkQ27Cxe.cjs.map → vnode-ClAiw28x.cjs.map} +1 -1
  346. package/dist/{vnode-BUflsBsa.d.ts → vnode-Du2cC8Fm.d.cts} +1 -4
  347. package/dist/{vnode-BUflsBsa.d.cts → vnode-Du2cC8Fm.d.ts} +1 -4
  348. package/dist/{vnode-tCWItoUH.js → vnode-_EMUqysL.js} +2 -3
  349. package/dist/{vnode-tCWItoUH.js.map → vnode-_EMUqysL.js.map} +1 -1
  350. package/package.json +21 -1
  351. package/dist/bar-C-7zR2qp.cjs.map +0 -1
  352. package/dist/bar-jZEoao74.js.map +0 -1
  353. package/dist/cartesian-BoDfgBCV.cjs.map +0 -1
  354. package/dist/cartesian-Cr0AF0nG.js.map +0 -1
  355. package/dist/chart-BF2CK9I_.js.map +0 -1
  356. package/dist/chart-CowF_lWY.cjs.map +0 -1
  357. package/dist/core-CegR_j55.js.map +0 -1
  358. package/dist/core-RzS9IQO5.cjs.map +0 -1
  359. package/dist/gauge-D-FYhuds.cjs.map +0 -1
  360. package/dist/heatmap-BK18EBgJ.cjs.map +0 -1
  361. package/dist/heatmap-DSZ2bVIa.js.map +0 -1
  362. package/dist/hydrate-CxwTXDqO.cjs.map +0 -1
  363. package/dist/layout-B3hiqVEw.js.map +0 -1
  364. package/dist/layout-CtMBhNd9.cjs.map +0 -1
  365. package/dist/morph-CqYDu1bY.cjs.map +0 -1
  366. package/dist/parliament-CpWnoEvG.cjs.map +0 -1
  367. package/dist/parliament-Dw0sOERi.js.map +0 -1
  368. package/dist/pie-BxTZt6Go.cjs.map +0 -1
  369. package/dist/pie-DzUXDTcn.js.map +0 -1
  370. package/dist/sankey-B4PNKusJ.js.map +0 -1
  371. package/dist/sankey-Bacx4fVe.cjs.map +0 -1
  372. package/dist/scatter-DgMN9zRy.cjs.map +0 -1
  373. package/dist/scatter-kgtgR318.js.map +0 -1
  374. package/dist/sparkline-BQzt27Fr.js.map +0 -1
  375. package/dist/sparkline-BS9-hltA.cjs.map +0 -1
  376. package/dist/sweep-DaTEDDuC.cjs.map +0 -1
  377. package/dist/value-labels-B0WJoJ7x.cjs.map +0 -1
  378. package/dist/value-labels-IZIQPhfk.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-e2VqomCI.cjs","names":["h","isValidTag","isValidAttr","features","feature","h","render"],"sources":["../src/interaction.ts","../src/legend.ts","../src/render/string.ts","../src/resize.ts","../src/scheduler.ts","../src/chart.ts"],"sourcesContent":["import type { Rect } from './layout.ts'\n\n/** One series' value at a hovered position. */\nexport interface HitItem {\n /** Series name. */\n name: string\n /** Position of the series in `data.series`. */\n seriesIndex: number\n /** Custom series color, if one was set. */\n color?: string\n value: number | null\n /** Value formatted for display (tooltips). */\n text: string\n /** Anchor of the value in chart pixels (point, bar end); `y` is `null` for gaps. */\n x: number\n y: number | null\n /** The mark's rectangle (bar, segment, cell), for value labels inside it. */\n box?: Rect\n}\n\n/** What lies under the pointer. */\nexport interface Hit {\n /** Category index. */\n index: number\n /** Category label. */\n label: string | number\n /** Label formatted for display (tooltips). */\n title: string\n /** Anchor x of the category in chart pixels (for crosshairs and tooltips); the plot center for horizontal bars. */\n x: number\n /** Plot area, in chart pixels. */\n area: Rect\n /** Axis the categories run along; `'y'` for horizontal bars. Defaults to `'x'`. */\n axis?: 'x' | 'y'\n /** Center of the category along y, when categories run along y. */\n y?: number\n /** The category's band in chart pixels, for band scales (bars). */\n band?: { x: number; y: number; width: number; height: number }\n /** Every series' value at this category. */\n items: HitItem[]\n /** Series of the mark directly under the pointer (e.g. a bar), if any. */\n seriesIndex?: number\n /**\n * The crosshair segment, when it is not vertical across the plot (a radar\n * spoke). Tooltips from the keyboard then anchor on the value itself.\n */\n guide?: { x1: number; y1: number; x2: number; y2: number }\n /**\n * A shape to highlight instead of a crosshair or band (e.g. a halo around a\n * pie slice): path data `d`, drawn translated by `x` / `y`.\n */\n mark?: { d: string; x: number; y: number }\n}\n\n/** Maps a point in chart pixels to what lies there. */\nexport type HitTester = (x: number, y: number) => Hit | null\n\n/** How a rendered chart answers pointer and keyboard interaction. */\nexport interface Interaction {\n /** What lies at a point in chart pixels. */\n hitTest: HitTester\n /** The hit for a category by index (keyboard navigation), optionally focused on a series. */\n hitIndex(index: number, seriesIndex?: number): Hit | null\n /** Number of categories. */\n count: number\n /** Categories run from the right: the left arrow key goes to the next one. */\n reversed?: boolean\n}\n\n/** Identity of a hit, used to emit hover changes only when it changes. */\nexport function hitKey(hit: Hit | null): string {\n return hit ? `${hit.index}:${hit.seriesIndex ?? ''}` : ''\n}\n\n/**\n * Convert a pointer position to chart pixels, accounting for the SVG being\n * scaled by CSS (e.g. `max-width: 100%`).\n */\nexport function toChartPoint(\n svg: Element,\n clientX: number,\n clientY: number,\n width: number,\n height: number,\n): { x: number; y: number } {\n const rect = svg.getBoundingClientRect()\n const sx = rect.width > 0 ? width / rect.width : 1\n const sy = rect.height > 0 ? height / rect.height : 1\n return { x: (clientX - rect.left) * sx, y: (clientY - rect.top) * sy }\n}\n","import { h, type VNode } from './vnode.ts'\n\n/** One legend entry: a series (or a slice, for part-to-whole charts). */\nexport interface LegendItem {\n /** Stable identity, used to toggle it. */\n key: string\n name: string\n /** Color slot: the entry wears `.tc-series-{index + 1}`. */\n index: number\n /** Custom color overriding the slot. */\n color?: string\n /** Hidden by default (e.g. `series.hidden`). */\n hidden?: boolean\n}\n\nexport interface LegendOptions {\n /** Place the legend above or below the chart. Defaults to `'top'`. */\n position?: 'top' | 'bottom'\n}\n\n/**\n * Legend content: one toggle button per entry. Buttons are native, so they\n * are focusable and work with Enter/Space; `aria-pressed` reflects visibility.\n */\nexport function legendContent(items: readonly LegendItem[], hidden: ReadonlySet<string>): VNode {\n return h(\n 'div',\n { class: 'tc-legend-items' },\n items.map((item) => {\n const off = hidden.has(item.key)\n return h(\n 'button',\n {\n key: item.key,\n type: 'button',\n class: [\n 'tc-legend-item',\n 'tc-series',\n `tc-series-${item.index + 1}`,\n off && 'tc-legend-item-hidden',\n ],\n style: { '--tc-series-color': item.color },\n 'aria-pressed': off ? 'false' : 'true',\n 'data-key': item.key,\n },\n h('span', { class: 'tc-legend-swatch', 'aria-hidden': 'true' }),\n h('span', { class: 'tc-legend-name' }, item.name),\n )\n }),\n )\n}\n\n/** Keys hidden by default, from the entries' own `hidden` flags. */\nexport function defaultHidden(items: readonly LegendItem[]): Set<string> {\n return new Set(items.filter((item) => item.hidden).map((item) => item.key))\n}\n","import type { Child, VNode } from '../vnode.ts'\nimport { isValidAttr, isValidTag } from './attrs.ts'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\nexport interface RenderToStringOptions {\n /**\n * Add `xmlns` to a root `<svg>` that has none, so the output is a valid\n * standalone `.svg` file. Defaults to `true`.\n */\n xmlns?: boolean\n /**\n * Markup context of the root. By default common HTML elements (`div`,\n * `table`, `button`…) render as HTML and everything else as SVG.\n */\n namespace?: 'svg' | 'html'\n}\n\n/** Root tags treated as HTML when no namespace is given. */\nconst HTML_ROOTS = /* @__PURE__ */ new Set([\n 'a',\n 'b',\n 'button',\n 'caption',\n 'div',\n 'em',\n 'i',\n 'label',\n 'li',\n 'ol',\n 'p',\n 'section',\n 'small',\n 'span',\n 'strong',\n 'table',\n 'tbody',\n 'td',\n 'th',\n 'thead',\n 'tr',\n 'ul',\n])\n\n/** HTML elements that never have content and must not get a closing tag. */\nconst VOID = /* @__PURE__ */ new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'source',\n 'track',\n 'wbr',\n])\n\n/**\n * Serialize a VNode tree to markup (SSR, static export): SVG trees as\n * XML-compatible SVG, HTML trees (legend, table, tooltip) as HTML.\n *\n * Empty elements self-close only inside SVG; in HTML they get an explicit\n * closing tag (`<th></th>`), since `<th/>` would open an element there.\n * Text and attribute values are escaped. Invalid tag or attribute names and\n * inline event handlers (`on*`) are dropped, so data coming from chart\n * options can never inject markup or scripts.\n */\nexport function renderToString(node: Child, options: RenderToStringOptions = {}): string {\n if (typeof node === 'string') return escapeText(node)\n const root =\n options.xmlns !== false && node.tag === 'svg' && node.attrs.xmlns === undefined\n ? { ...node, attrs: { xmlns: SVG_NS, ...node.attrs } }\n : node\n const svg = options.namespace ? options.namespace === 'svg' : !HTML_ROOTS.has(node.tag)\n return renderNode(root, svg)\n}\n\nfunction renderNode(node: VNode, parentInSvg: boolean): string {\n const { tag, attrs, children } = node\n if (!isValidTag(tag)) return ''\n const inSvg = parentInSvg || tag === 'svg'\n\n let out = `<${tag}`\n for (const name in attrs) {\n if (!isValidAttr(name)) continue\n out += ` ${name}=\"${escapeAttr(String(attrs[name]))}\"`\n }\n\n if (children.length === 0) {\n if (inSvg) return `${out}/>`\n if (VOID.has(tag.toLowerCase())) return `${out}>`\n }\n\n out += '>'\n // Content of foreignObject is HTML again.\n const childInSvg = inSvg && tag !== 'foreignObject'\n for (const child of children) {\n out += typeof child === 'string' ? escapeText(child) : renderNode(child, childInSvg)\n }\n return `${out}</${tag}>`\n}\n\nconst TEXT_RE = /[&<>]/\nconst ATTR_RE = /[&\"<>]/\nconst TEXT_RE_G = /[&<>]/g\nconst ATTR_RE_G = /[&\"<>]/g\nconst ENTITIES: Record<string, string> = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' }\nconst replaceEntity = (char: string): string => ENTITIES[char] as string\n\n/** Escape text content. */\nexport function escapeText(value: string): string {\n return TEXT_RE.test(value) ? value.replace(TEXT_RE_G, replaceEntity) : value\n}\n\n/** Escape a double-quoted attribute value. */\nexport function escapeAttr(value: string): string {\n return ATTR_RE.test(value) ? value.replace(ATTR_RE_G, replaceEntity) : value\n}\n","/** One `ResizeObserver` shared by every chart on the page. */\n\ntype Listener = (width: number, height: number) => void\n\nconst listeners = /* @__PURE__ */ new WeakMap<Element, Listener>()\n/** Elements observed while in the document. */\nconst seen = /* @__PURE__ */ new WeakSet<Element>()\nlet observer: ResizeObserver | undefined\n\nfunction getObserver(): ResizeObserver | undefined {\n if (observer || typeof ResizeObserver !== 'function') return observer\n observer = new ResizeObserver((entries) => {\n for (const { target, contentRect } of entries) {\n if (target.isConnected) {\n seen.add(target)\n listeners.get(target)?.(contentRect.width, contentRect.height)\n } else if (seen.has(target)) {\n // Taken out of the page without destroy(): stop observing, or the\n // observer would keep the element and its chart in memory for good.\n // `chart.resize()` observes it again if it comes back.\n seen.delete(target)\n observer?.unobserve(target)\n }\n }\n })\n return observer\n}\n\n/**\n * Call `listener` with the content size of `el` whenever it changes.\n * Returns a function that stops observing. No-op where `ResizeObserver`\n * is unavailable (SSR, old browsers). Observing again is harmless.\n */\nexport function observeResize(el: Element, listener: Listener): () => void {\n const ro = getObserver()\n if (!ro) return () => {}\n listeners.set(el, listener)\n ro.observe(el)\n return () => {\n if (listeners.get(el) !== listener) return\n listeners.delete(el)\n ro.unobserve(el)\n }\n}\n","/**\n * Batches work from all charts into a single animation frame. Scheduling the\n * same key twice before the flush runs its latest task once.\n */\n\nconst queue = /* @__PURE__ */ new Map<object, () => void>()\nlet pending = false\n\nconst requestFrame = (callback: () => void): void => {\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(callback)\n else queueMicrotask(callback)\n}\n\n/**\n * Run a task; an error it throws is reported on its own (as an uncaught\n * error, in the console and to `window.onerror`) instead of stopping the\n * tasks of other charts in the same frame.\n */\nexport function run(task: () => void): void {\n try {\n task()\n } catch (error) {\n setTimeout(() => {\n throw error\n })\n }\n}\n\n/** Run `task` in the next frame, replacing any task already queued for `key`. */\nexport function schedule(key: object, task: () => void): void {\n queue.set(key, task)\n if (!pending) {\n pending = true\n requestFrame(flush)\n }\n}\n\n/** Work `flush()` also runs: the idle queue (`idle.ts`), once something uses it. */\nexport const flushHooks: { idle?: () => number } = {}\n\n/** Drop the task queued for `key`, if any. */\nexport function cancel(key: object): void {\n queue.delete(key)\n}\n\n/**\n * Run queued tasks now, idle ones too; returns how many ran. Tasks queued\n * meanwhile run too, but each key only once: a task queued again after it\n * ran (a chart updated from its own `render` handler) waits for the next\n * frame, instead of looping in this one and freezing the page.\n */\nexport function flush(): number {\n pending = false\n let count = 0\n const ran = new Set<object>()\n const later = new Map<object, () => void>()\n // Idle work can schedule frame work in turn.\n do {\n // (A Map also visits what is added while it is walked: tasks queued meanwhile.)\n for (const [key, task] of queue) {\n queue.delete(key)\n if (ran.has(key)) later.set(key, task)\n else {\n ran.add(key)\n run(task)\n count++\n }\n }\n count += flushHooks.idle?.() ?? 0\n } while (queue.size > 0)\n for (const [key, task] of later) schedule(key, task)\n return count\n}\n","import type { DataTable } from './a11y.ts'\nimport type { ValueLabelOptions } from './charts/value-labels.ts'\nimport { feature, features } from './features.ts'\nimport type { Locale, NumberFormat } from './format.ts'\nimport { type Hit, hitKey, type Interaction } from './interaction.ts'\nimport { defaultHidden, type LegendItem, type LegendOptions } from './legend.ts'\nimport type { ChartPlugin, PluginInstance } from './plugin.ts'\nimport type { DownloadOption } from './plugins/download.ts'\nimport { render } from './render/dom.ts'\nimport { renderToString } from './render/string.ts'\nimport { observeResize } from './resize.ts'\nimport { cancel, schedule } from './scheduler.ts'\nimport type { TooltipOptions } from './tooltip.ts'\nimport { type ChildInput, type ClassValue, h, type Props, type VNode } from './vnode.ts'\n\n/** Size and environment a chart type renders into. */\nexport interface RenderContext {\n width: number\n height: number\n /** Font size used to estimate label sizes. */\n fontSize: number\n locale: Locale\n /** Unique, stable prefix for ids inside this chart. */\n id: string\n /** Register how pointer and keyboard map to data (ignored in SSR). */\n onHitTest(interaction: Interaction): void\n /** Keys of legend entries (series) currently hidden. */\n hidden: ReadonlySet<string>\n /** Lay the chart out right to left (the `rtl` option, resolved). */\n rtl?: boolean\n}\n\n/**\n * A chart type plugin (`line`, `bar`, …). Receives the chart options and\n * returns the content of the root `<svg>`.\n */\nexport interface ChartType<O extends object = object> {\n readonly name: string\n /**\n * Clean options that may come from outside (data, annotations, axis\n * bounds from users, APIs, JSON) into the shape `render()` expects; called\n * as the config comes in, before anything reads it.\n */\n clean?(options: O): unknown\n render(options: O, context: RenderContext): ChildInput\n /** Entries for the legend (series, slices); charts without it get no legend. */\n legend?(options: O): LegendItem[]\n /**\n * The data as a text table, for screen readers and the visible table\n * option. `limit` is the most rows wanted; report the real count in `total`.\n */\n table?(options: O, context: RenderContext, limit: number): DataTable\n /**\n * Whether the chart should be focusable and keyboard-navigable by default\n * (`keyboard` in the config overrides it). Decorative types such as\n * sparklines opt out so a page of stat tiles does not multiply tab stops.\n */\n readonly keyboard?: boolean\n /**\n * How value labels (`valueLabels`) read this chart type, when not as bars\n * or points: `marks: 'slice'` writes each value as its share, inside its\n * slice; `marks: 'cell'` writes it in the middle of its mark. `format`\n * names the number format of the values in the options (by default a label\n * shows the text of the tooltip).\n */\n readonly valueLabels?: {\n marks?: 'slice' | 'cell'\n format?(options: O): NumberFormat | undefined\n }\n}\n\nexport type { DataTable, LegendItem }\n\n/** Options shared by every chart type. */\nexport interface BaseOptions {\n /** Fixed width in pixels. Defaults to the container width. */\n width?: number\n /**\n * Height in pixels, or `'container'` to follow the container's height (the\n * container then needs a height of its own). Defaults to width / aspectRatio.\n */\n height?: number | 'container'\n /** Width to height ratio used when `height` is not set. Defaults to `2`. */\n aspectRatio?: number\n /** Accessible name of the chart. */\n title?: string\n /** Longer accessible description. */\n description?: string\n /** Extra classes on the root `<svg>`. */\n class?: ClassValue\n /** Locale for number and date formatting. Set it explicitly for SSR. */\n locale?: Locale\n /**\n * Mirror the layout for right-to-left pages: the value axis on the right\n * and categories running from the right (`x.reverse` overrides the latter).\n * `'auto'` follows the `direction` of the container (left to right in SSR).\n * The legend, the tooltip and the download menu read right to left with it.\n * Cartesian charts, heatmaps, sparklines and sankey diagrams. Defaults to `false`.\n */\n rtl?: boolean | 'auto'\n /**\n * Font size used to lay out labels. In the browser it is read from the\n * `--tc-font-size` custom property of the container when not set; set it\n * explicitly for SSR so server and client layouts match. Defaults to `12`.\n */\n fontSize?: number\n /** Id prefix; set it explicitly for SSR so server and client ids match. */\n id?: string\n /** Show a tooltip on hover, optionally with custom content. Defaults to `true`. */\n tooltip?: boolean | TooltipOptions\n /** Show a vertical crosshair on hover (point charts). Defaults to `true`. */\n crosshair?: boolean\n /** Show a legend with toggles. Defaults to showing it for two or more entries. */\n legend?: boolean | LegendOptions\n /**\n * Animate entrances and data updates (reduced motion always wins). By\n * default charts animate unless they draw more than 1000 elements (e.g. a\n * scatter of a thousand points), where transitions cost far more frame\n * time than they show; `true` animates those too.\n */\n animate?: boolean\n /**\n * Fill bars, areas, slices, rings and bubbles with patterns (and dash\n * lines), so series do not depend on color alone: `true` always, `'auto'`\n * (the default) only in forced colors (Windows High Contrast), where the\n * colors are gone, `false` never. Needs `@tabler/charts/patterns` on the\n * core (`@tabler/charts` includes it).\n */\n patterns?: boolean | 'auto'\n /**\n * Write the values on the marks: bars at their end, stacked segments,\n * cells and slices inside (slices show their share), lines and points\n * above their last point (`points: 'all'` for every one). Labels that do\n * not fit are left out. Needs `@tabler/charts/value-labels` on the core\n * (`@tabler/charts` includes it).\n */\n valueLabels?: boolean | ValueLabelOptions\n /**\n * Share the hover with the other charts of this group: the category under\n * the pointer is highlighted in all of them (matched by label), with its\n * tooltip. Needs the `sync()` plugin (the `Chart` of `@tabler/charts` has it).\n */\n sync?: string\n /**\n * Give the points of each series a shape of their own (circle, square,\n * triangle, diamond…) in line, radar and scatter charts, so they do not\n * depend on color alone. Defaults to `patterns === true`. Needs\n * `@tabler/charts/point-shapes` on the core (`@tabler/charts` includes it).\n */\n shapes?: boolean\n /**\n * Render the data as an HTML table: visually hidden for screen readers\n * (`true`, the default), shown below the chart (`'visible'`), or not at all.\n * An object sets `visible` and `maxRows` (default 1000; longer data is cut\n * and the caption says so).\n */\n table?: boolean | 'visible' | { visible?: boolean; maxRows?: number }\n /** Make the chart focusable and navigable with arrow keys. Defaults to `true`. */\n keyboard?: boolean\n /**\n * A download menu in the chart's corner: `true` offers PNG and SVG, a list\n * picks the formats (`['png', 'svg', 'jpeg', 'webp']`), an object also\n * sets the file name and the export options. Needs `@tabler/charts/export`\n * imported, and on the core the `download()` plugin (the `Chart` of\n * `@tabler/charts` has it).\n */\n download?: DownloadOption\n /**\n * Extra plugins, installed when the chart is created. The default `Chart`\n * from `@tabler/charts` already includes the built-in ones; the bare `Chart`\n * from `@tabler/charts/core` only runs these.\n */\n plugins?: readonly ChartPlugin[]\n}\n\n/** Full chart configuration: base options, the chart type and its options. */\nexport type ChartConfig<O extends object = object> = BaseOptions & O & { type: ChartType<O> }\n\nexport interface Size {\n width: number\n height: number\n}\n\nconst DEFAULT_WIDTH = 600\nconst DEFAULT_ASPECT_RATIO = 2\nconst DEFAULT_FONT_SIZE = 12\n\nlet uid = 0\nconst nextId = (): string => `tc-${++uid}`\n\n/** Resolve the final pixel size from options and the measured container size. */\nexport function resolveSize(options: BaseOptions, measured?: Partial<Size>): Size {\n const measuredWidth = measured?.width ?? 0\n // (Sizes that are not finite numbers count as not set.)\n const width = Math.max(\n 0,\n Math.round(\n Number.isFinite(options.width)\n ? (options.width as number)\n : measuredWidth > 0\n ? measuredWidth\n : DEFAULT_WIDTH,\n ),\n )\n const ratio =\n options.aspectRatio && options.aspectRatio > 0 ? options.aspectRatio : DEFAULT_ASPECT_RATIO\n const height = Number.isFinite(options.height)\n ? (options.height as number)\n : options.height === 'container' && (measured?.height ?? 0) > 0\n ? (measured?.height as number)\n : width / ratio\n return { width, height: Math.max(0, Math.round(height)) }\n}\n\n/** Run the chart type's `render()` for a config and size. */\nfunction renderContent<O extends object>(\n config: ChartConfig<O>,\n size: Size,\n id: string,\n onHitTest: (interaction: Interaction) => void,\n hidden: ReadonlySet<string>,\n fontSize?: number,\n rtl?: boolean,\n): ChildInput {\n let found: Interaction | undefined\n const ctx = renderContext(\n config,\n size,\n id,\n (interaction) => {\n found = interaction\n onHitTest(interaction)\n },\n hidden,\n fontSize,\n rtl,\n )\n const content = config.type.render(config, ctx)\n // Optional features finish the content (point shapes, value labels).\n return features.post ? features.post(config as ChartConfig<object>, content, found, ctx) : content\n}\n\n/** Render context for a config and size (also used by plugins such as the data table). */\nexport function renderContext<O extends object>(\n config: ChartConfig<O>,\n size: Size,\n id: string,\n onHitTest: (interaction: Interaction) => void,\n hidden: ReadonlySet<string>,\n measuredFontSize?: number,\n rtl: boolean = config.rtl === true,\n): RenderContext {\n return {\n rtl,\n width: size.width,\n height: size.height,\n fontSize: config.fontSize ?? measuredFontSize ?? DEFAULT_FONT_SIZE,\n locale: config.locale,\n id,\n onHitTest,\n hidden,\n }\n}\n\n/**\n * The config as cleaned by its chart type, without the options that are\n * numbers nothing can be drawn with (NaN, ±Infinity, from a division or a\n * parse gone wrong outside): their defaults apply, as if they were left out.\n */\nfunction cleanData<O extends object>(config: ChartConfig<O>): ChartConfig<O> {\n const out = {\n ...(config.type?.clean ? (config.type.clean(config) as object) : config),\n } as Record<string, unknown>\n for (const key in out) {\n if (typeof out[key] === 'number' && !Number.isFinite(out[key])) delete out[key]\n }\n return out as ChartConfig<O>\n}\n\nfunction assertType(config: ChartConfig<object>): void {\n if (!config.type || typeof config.type.render !== 'function') {\n throw new TypeError('@tabler/charts: `type` must be a chart type such as line.')\n }\n}\n\n/** Legend entries of a config, whether a legend is shown and where. */\nexport interface ResolvedLegend {\n items: LegendItem[]\n show: boolean\n position: 'top' | 'bottom'\n}\n\n/** Legend entries of a config, and whether the legend is shown. */\nexport function resolveLegend<O extends object>(config: ChartConfig<O>): ResolvedLegend {\n const items = config.type.legend?.(config) ?? []\n const option = config.legend\n const show = option === undefined ? items.length >= 2 : option !== false && items.length > 0\n const position = typeof option === 'object' && option.position === 'bottom' ? 'bottom' : 'top'\n return { items, show, position }\n}\n\n/**\n * The chart's accessible name: its `title`, or else the chart type and its\n * legend entries (\"line chart: Visitors, Sign-ups\"), since an image without\n * a name is announced as nothing at all. Set `title` for a name in the\n * page's language.\n */\nexport function chartLabel(config: ChartConfig<object>): string {\n if (config.title) return config.title\n const names = (config.type.legend?.(config) ?? []).map((item) => item.name).filter(Boolean)\n const shown = names.slice(0, 6).join(', ')\n // Screen readers do not care for capitals; a long list of names is cut short.\n return `${config.type.name} chart${names.length ? `: ${shown}${names.length > 6 ? ', …' : ''}` : ''}`\n}\n\n/** Elements beyond which charts skip transitions unless `animate: true`. */\nconst ANIMATION_LIMIT = 1000\n\n/** Number of elements in chart content. */\nconst countNodes = (child: ChildInput): number =>\n Array.isArray(child)\n ? child.reduce((n: number, c: ChildInput) => n + countNodes(c), 0)\n : child && typeof child === 'object'\n ? 1 + countNodes((child as VNode).children)\n : 0\n\n/** Whether a chart renders without transitions: asked to, or too big to animate cheaply. */\nconst isStatic = (config: ChartConfig<object>, content: ChildInput): boolean =>\n config.animate === false || (config.animate !== true && countNodes(content) > ANIMATION_LIMIT)\n\n/** Wrap chart content (and hover layers) in the accessible root `<svg>`. */\nfunction composeChart(\n config: ChartConfig<object>,\n size: Size,\n id: string,\n still: boolean,\n content: ChildInput,\n underlay?: ChildInput,\n overlay?: ChildInput,\n extraAttrs?: Props,\n rtl: boolean = config.rtl === true,\n): VNode {\n const { width, height } = size\n const descId = config.description ? `${id}-desc` : undefined\n const { patterns } = config\n // [class, root style, defs] of the pattern fills, when the chart has them.\n const fills =\n patterns === false\n ? undefined\n : (patterns === true ? feature('patterns') : features.patterns)?.(config, id)\n return h(\n 'svg',\n {\n class: [\n 'tc-chart',\n `tc-chart-${config.type.name}`,\n still && 'tc-static',\n rtl && 'tc-rtl',\n fills?.[0],\n config.class,\n ],\n style: fills?.[1],\n viewBox: `0 0 ${width} ${height}`,\n width,\n height,\n role: 'img',\n // An svg <title> would also show as a native tooltip, so the name is an attribute.\n 'aria-label': chartLabel(config),\n 'aria-describedby': descId,\n ...extraAttrs,\n },\n // Keyed, so their coming and going never shifts the (unkeyed) chart\n // content in the DOM patcher: that would recreate it and restart animations.\n descId && h('desc', { key: 'desc', id: descId }, config.description),\n fills?.[2],\n underlay && h('g', { key: 'hover-under', class: 'tc-hover-layer' }, underlay),\n content,\n overlay && h('g', { key: 'hover-over', class: 'tc-hover-layer' }, overlay),\n )\n}\n\n/**\n * Build the VNode tree of a chart: a pure function of the config and size,\n * shared by the DOM chart and server-side rendering.\n */\nexport function buildChart<O extends object>(\n config: ChartConfig<O>,\n size: Size,\n id: string = config.id ?? 'tc',\n onHitTest: (interaction: Interaction) => void = () => {},\n): VNode {\n assertType(config as ChartConfig<object>)\n config = cleanData(config)\n const hidden = defaultHidden(resolveLegend(config).items)\n const content = renderContent(config, size, id, onHitTest, hidden)\n const base = config as ChartConfig<object>\n return composeChart(base, size, id, isStatic(base, content), content)\n}\n\n/**\n * Render a chart to an SVG string, e.g. on the server.\n *\n * ```ts\n * chartToString({ type: line, data, id: 'sales', locale: 'en-US' }, { width: 600, height: 300 })\n * ```\n */\nexport function chartToString<O extends object>(config: ChartConfig<O>, size: Size): string {\n return renderToString(buildChart(config, size))\n}\n\nexport interface ChartEvents {\n /** A legend entry was toggled (by the user or `toggleSeries()`). */\n 'legend-toggle': { key: string; name: string; index: number; hidden: boolean }\n /** After the chart content rendered into the DOM (not on hover-only updates). */\n render: { size: Size }\n /**\n * The highlighted category (or mark) changed, or its data changed while\n * highlighted. `hit` is `null` when the pointer left the plot.\n */\n hover: { hit: Hit | null; event?: PointerEvent }\n /** A click on the plot. */\n click: { hit: Hit; event: MouseEvent }\n}\n\n/** The name of every chart event, for adapters that pass them all on. */\nexport const chartEvents: readonly (keyof ChartEvents)[] = [\n 'hover',\n 'click',\n 'legend-toggle',\n 'render',\n]\n\ntype Handler<T> = (event: T) => void\n\n/** Where the current highlight came from. */\ntype Source =\n | { kind: 'pointer'; x: number; y: number }\n | { kind: 'index'; index: number; seriesIndex?: number }\n\n/** The output of a chart type, with what it was built for. */\ninterface Content<O extends object> {\n cfg: ChartConfig<O>\n width: number\n height: number\n hidden: string\n fontSize: number | undefined\n rtl: boolean\n content: ChildInput\n /** Whether the content renders without transitions. */\n still: boolean\n}\n\n/** The chart on each element. */\nconst mounted = /* @__PURE__ */ new WeakMap<Element, Chart<object>>()\n\n/**\n * A chart bound to a DOM element: measures its container, renders SVG into\n * it and re-renders on `update()` and resize (batched per animation frame).\n * Features such as the tooltip, the legend and pointer input (`hover` /\n * `click` events, from `pointer()`, which the highlight and tooltip plugins\n * turn on themselves) are plugins; the `Chart` exported by `@tabler/charts`\n * installs the built-in ones.\n *\n * ```ts\n * const chart = new Chart('#sales', { type: line, data })\n * chart.update({ data: next })\n * ```\n */\nexport class Chart<O extends object = object> {\n /** Element the chart renders into. */\n readonly element: Element\n /** Id prefix used for elements inside the chart. */\n readonly id: string\n #cfg: ChartConfig<O>\n /** Container size changes, from the shared ResizeObserver. */\n #onResize = (width: number, height: number): void => {\n // Our own SVG sets the container height unless it follows the container.\n const followsHeight = this.#cfg.height === 'container'\n const changed =\n width !== this.#measured.width || (followsHeight && height !== this.#measured.height)\n this.#measured = { width, height }\n // A hidden container (display: none) measures 0×0: nothing to draw until it shows again.\n if (changed && (width || height)) {\n this.#font = undefined\n this.#markResizing()\n this.#schedule()\n }\n }\n #measured: Partial<Size> = {}\n readonly #handlers = new Map<keyof ChartEvents, Set<Handler<never>>>()\n #unobserve: () => void\n readonly #plugins: PluginInstance[] = []\n #destroyed = false\n #current: Interaction | undefined\n #source: Source | undefined\n #hovered = ''\n #hit: Hit | null = null\n /** Chart type output of the last render, reused while only the highlight changes. */\n #cache: Content<O> | undefined\n #resizeTimer: ReturnType<typeof setTimeout> | undefined\n /** Visibility set by the user, overriding each entry's default. */\n readonly #toggled = new Map<string, boolean>()\n /** Server-rendered svg to take over on the first render, if any. */\n #adopt: Element | null\n /**\n * The measured `--tc-font-size` (`undefined` reads it again). Reading it\n * forces the browser to restyle the page, so new data alone reuses it.\n */\n #font: number | undefined\n /** The resolved `rtl` option, read with the font size (`'auto'` asks the container). */\n #rtl = false\n\n constructor(\n target: Element | string,\n config: ChartConfig<O>,\n defaultPlugins: readonly ChartPlugin[] = [],\n ) {\n const element = typeof target === 'string' ? document.querySelector(target) : target\n if (!element) throw new Error(`@tabler/charts: element \"${String(target)}\" not found.`)\n // One chart per element: a new one replaces the chart already there.\n mounted.get(element)?.destroy()\n mounted.set(element, this as unknown as Chart<object>)\n this.element = element\n this.#cfg = cleanData(config)\n this.id = config.id ?? nextId()\n this.#adopt = element.querySelector(':scope > svg.tc-chart')\n this.#measure()\n this.#unobserve = observeResize(element, this.#onResize)\n try {\n for (const plugin of [...defaultPlugins, ...(config.plugins ?? [])]) {\n this.#plugins.push(plugin.install(this as unknown as Chart<object>))\n }\n this.render()\n } catch (error) {\n // Nobody gets this chart to destroy it: leave the element as it was found.\n this.destroy()\n throw error\n }\n }\n\n /** Current configuration. */\n get config(): ChartConfig<O> {\n return this.#cfg\n }\n\n /** Size of the last render. */\n get size(): Size {\n // In 'container' height mode, plugins such as the legend take part of the\n // container. Only then: measuring them forces a layout of the page.\n let measured = this.#measured\n if (this.#cfg.height === 'container' && measured.height) {\n let reserved = 0\n for (const plugin of this.#plugins) reserved += plugin.reservedHeight?.() ?? 0\n if (reserved) measured = { ...measured, height: measured.height - reserved }\n }\n return resolveSize(this.#cfg, measured)\n }\n\n /**\n * Whether the chart is laid out right to left: the `rtl` option, with\n * `'auto'` read from the container (together with the font size).\n */\n get rtl(): boolean {\n const cfg = this.#cfg\n if (this.#font === undefined) {\n this.#rtl =\n cfg.rtl === 'auto'\n ? typeof getComputedStyle === 'function' &&\n getComputedStyle(this.element).direction === 'rtl'\n : cfg.rtl === true\n this.#font = cfg.fontSize ?? this.#measureFontSize()\n }\n return this.#rtl\n }\n\n /** Font size used by the last render (explicit, measured, or the default). */\n get fontSize(): number {\n return this.#cache?.fontSize ?? this.#cfg.fontSize ?? DEFAULT_FONT_SIZE\n }\n\n /** How pointer and keyboard map to data for the current render. */\n get interaction(): Interaction | undefined {\n return this.#current\n }\n\n /** The highlighted category (hover or keyboard), or `null`. */\n get active(): Hit | null {\n return this.#hit\n }\n\n /**\n * The pointer in chart pixels while it drives the highlight (`undefined`\n * for keyboard highlights). `hitAnchor(chart.active, chart.pointer)` gives\n * where a tooltip belongs either way.\n */\n get pointer(): { x: number; y: number } | undefined {\n const source = this.#source\n return this.#hit && source?.kind === 'pointer' ? { x: source.x, y: source.y } : undefined\n }\n\n /** Whether the highlight comes from the pointer or from `highlightIndex()` (keyboard). */\n get highlightSource(): 'pointer' | 'index' | undefined {\n return this.#hit ? this.#source?.kind : undefined\n }\n\n /**\n * Highlight a category by index (and optionally one series in it), as\n * keyboard navigation does. Returns the hit, or `null` for an invalid index.\n */\n highlightIndex(index: number, seriesIndex?: number): Hit | null {\n const hit = this.#current?.hitIndex(index, seriesIndex) ?? null\n if (!hit) return null\n this.#source = { kind: 'index', index, seriesIndex }\n this.#setHover(hit)\n return hit\n }\n\n /**\n * Highlight what lies at a point in chart pixels, as the pointer does (the\n * `pointer()` plugin calls it). Returns the hit, or `null` for none.\n */\n highlightAt(x: number, y: number, event?: PointerEvent): Hit | null {\n const hit = this.hitTest(x, y)\n this.#source = { kind: 'pointer', x, y }\n this.#setHover(hit, event)\n return hit\n }\n\n /** Remove any highlight. */\n clearHighlight(event?: PointerEvent): void {\n this.#source = undefined\n this.#setHover(null, event)\n }\n\n /**\n * Show or hide a legend entry (series) by key, name or index; toggles when\n * `hidden` is omitted. Re-renders in the next frame.\n */\n toggleSeries(target: string | number, hidden?: boolean): this {\n const { items } = resolveLegend(this.#cfg)\n const item =\n typeof target === 'number'\n ? items.find((entry) => entry.index === target)\n : (items.find((entry) => entry.key === target) ??\n items.find((entry) => entry.name === target))\n if (!item) return this\n const next = hidden ?? !this.#hiddenSet(items).has(item.key)\n this.#toggled.set(item.key, next)\n this.emit('legend-toggle', { key: item.key, name: item.name, index: item.index, hidden: next })\n this.#schedule()\n return this\n }\n\n /** Whether a legend entry is hidden. */\n isHidden(key: string): boolean {\n return this.#hiddenSet(resolveLegend(this.#cfg).items).has(key)\n }\n\n /** Merge `options` into the configuration and re-render in the next frame. */\n update(options: Partial<ChartConfig<O>>): this {\n this.#cfg = cleanData({ ...this.#cfg, ...options })\n // Options such as `class` may change the font size; new data does not.\n for (const key in options) if (key !== 'data') this.#font = undefined\n this.#schedule()\n return this\n }\n\n /**\n * Replace the whole configuration and re-render in the next frame: options\n * left out go back to their defaults (`update()` would keep them).\n */\n setConfig(config: ChartConfig<O>): this {\n this.#cfg = cleanData(config)\n this.#font = undefined\n this.#schedule()\n return this\n }\n\n /** Replace the data and re-render in the next frame. */\n setData(data: O extends { data: infer D } ? D : never): this {\n return this.update({ data } as unknown as Partial<ChartConfig<O>>)\n }\n\n /**\n * Re-measure the container and re-render in the next frame. Call it when a\n * container taken out of the page without `destroy()` comes back.\n */\n resize(): this {\n // A container taken out of the page and put back is observed again.\n if (!this.#destroyed) this.#unobserve = observeResize(this.element, this.#onResize)\n this.#measure()\n this.#font = undefined\n this.#schedule()\n return this\n }\n\n /** Render synchronously now. */\n render(): this {\n if (this.#destroyed) return this\n cancel(this)\n const cfg = this.#cfg\n const config = cfg as ChartConfig<object>\n assertType(config)\n const legend = resolveLegend(cfg)\n const hidden = this.#hiddenSet(legend.items)\n for (const plugin of this.#plugins) plugin.beforeRender?.({ config, legend, hidden })\n const size = this.size\n const { content, stale, changed } = this.#content(size, hidden)\n if (stale) this.#refreshHighlight()\n\n const adopted = this.#adopt\n render(this.element, this.#compose(content, size), adopted)\n this.#adopt = null\n // The server markup was hydrated in place: snap it to the real size and\n // data instead of morphing (the server could not measure the container).\n if (adopted) this.#markResizing()\n\n for (const plugin of this.#plugins)\n plugin.afterRender?.({ config, legend, hidden, size, stale, changed })\n if (stale) this.emit('render', { size })\n return this\n }\n\n /**\n * The chart type's output for the current config, size, hidden series and\n * font size: built again when one of them changed (`stale`; `changed` when\n * it is what the chart shows, not only its size), else the one of the last render.\n */\n #content(\n size: Size,\n hidden: ReadonlySet<string>,\n ): { content: Content<O>; stale: boolean; changed: boolean } {\n const cfg = this.#cfg\n const hiddenKey = [...hidden].sort().join('\\u0000')\n const rtl = this.rtl\n const fontSize = cfg.fontSize ?? this.#font\n\n let cache = this.#cache\n const changed = !cache || cache.cfg !== cfg || cache.hidden !== hiddenKey\n const stale =\n changed ||\n cache?.width !== size.width ||\n cache.height !== size.height ||\n cache.fontSize !== fontSize ||\n cache.rtl !== rtl\n if (!cache || stale) {\n this.#current = undefined\n const content = renderContent(\n cfg,\n size,\n this.id,\n (interaction) => {\n this.#current = interaction\n },\n hidden,\n fontSize,\n rtl,\n )\n cache = {\n cfg,\n width: size.width,\n height: size.height,\n hidden: hiddenKey,\n fontSize,\n rtl,\n content,\n still: isStatic(cfg as ChartConfig<object>, content),\n }\n this.#cache = cache\n }\n return { content: cache, stale, changed }\n }\n\n /** Keep the highlight (and its consumers, like tooltips) in sync with new data or layout. */\n #refreshHighlight(): void {\n const source = this.#source\n if (!source) return\n const next =\n source.kind === 'pointer'\n ? this.hitTest(source.x, source.y)\n : (this.#current?.hitIndex(source.index, source.seriesIndex) ?? null)\n this.#setHover(next, undefined, true, false)\n }\n\n /** The root svg: the content, with the plugins' hover layers and attributes. */\n #compose(content: Content<O>, size: Size): VNode {\n const config = this.#cfg as ChartConfig<object>\n const hit = this.#hit\n const under: ChildInput[] = []\n const over: ChildInput[] = []\n let attrs: Props | undefined\n for (const plugin of this.#plugins) {\n if (hit && plugin.layers) {\n const layer = plugin.layers(hit, config)\n under.push(layer.under)\n over.push(layer.over)\n }\n const extra = plugin.svgAttrs?.(config)\n if (extra) attrs = { ...attrs, ...extra }\n }\n // Hover layers only while something is highlighted (an empty list would still render).\n return composeChart(\n config,\n size,\n this.id,\n content.still,\n content.content,\n under.length ? under : undefined,\n over.length ? over : undefined,\n attrs,\n content.rtl,\n )\n }\n\n /** What lies at a point in chart pixels, or `null`. */\n hitTest(x: number, y: number): Hit | null {\n return this.#current?.hitTest(x, y) ?? null\n }\n\n /** Subscribe to an event; returns a function that unsubscribes. */\n on<K extends keyof ChartEvents>(name: K, handler: Handler<ChartEvents[K]>): () => void {\n let set = this.#handlers.get(name)\n if (!set) {\n set = new Set()\n this.#handlers.set(name, set)\n }\n set.add(handler as Handler<never>)\n return () => {\n set.delete(handler as Handler<never>)\n }\n }\n\n /** Remove the chart from the DOM and stop observing its container. */\n destroy(): void {\n if (this.#destroyed) return\n this.#destroyed = true\n if (mounted.get(this.element) === (this as never)) mounted.delete(this.element)\n cancel(this)\n clearTimeout(this.#resizeTimer)\n this.#unobserve()\n for (const plugin of this.#plugins) plugin.destroy?.()\n this.#handlers.clear()\n render(this.element, null)\n }\n\n /**\n * Update the highlighted hit: emit `hover` when it changed (or when\n * `force`d after new data) and re-render the hover layers in the next frame.\n */\n #setHover(hit: Hit | null, event?: PointerEvent, force = false, rerender = true): void {\n const key = hitKey(hit)\n if (!force && key === this.#hovered) return\n // After a re-render, only a highlight that is still active is worth repeating.\n if (force && key === '' && this.#hovered === '') return\n this.#hovered = key\n this.#hit = hit\n this.emit('hover', event ? { hit, event } : { hit })\n if (rerender) this.#schedule()\n }\n\n #hiddenSet(items: readonly LegendItem[]): Set<string> {\n const hidden = new Set<string>()\n for (const item of items) {\n if (this.#toggled.get(item.key) ?? item.hidden) hidden.add(item.key)\n }\n return hidden\n }\n\n /** Suspend transitions while the container keeps resizing (see `[data-resizing]` in CSS). */\n #markResizing(): void {\n const svg = this.element.querySelector(':scope > svg.tc-chart')\n if (!svg) return\n svg.setAttribute('data-resizing', '')\n clearTimeout(this.#resizeTimer)\n this.#resizeTimer = setTimeout(() => svg.removeAttribute('data-resizing'), 200)\n }\n\n #schedule(): void {\n if (!this.#destroyed) schedule(this, () => this.render())\n }\n\n /** The `--tc-font-size` in effect on the container, in pixels (browser only). */\n #measureFontSize(): number | undefined {\n if (typeof getComputedStyle !== 'function') return undefined\n const value = Number.parseFloat(\n getComputedStyle(this.element).getPropertyValue('--tc-font-size'),\n )\n return Number.isFinite(value) && value > 0 ? value : undefined\n }\n\n /** Measure the content box, matching what `ResizeObserver` reports. */\n #measure(): void {\n const el = this.element as HTMLElement\n const style = typeof getComputedStyle === 'function' ? getComputedStyle(el) : undefined\n const px = (value: string | undefined) => Number.parseFloat(value ?? '') || 0\n this.#measured = {\n width: el.clientWidth - px(style?.paddingLeft) - px(style?.paddingRight),\n height: el.clientHeight - px(style?.paddingTop) - px(style?.paddingBottom),\n }\n }\n\n /** Call the handlers of an event (plugins emit `click`, for instance). */\n emit<K extends keyof ChartEvents>(name: K, event: ChartEvents[K]): void {\n const set = this.#handlers.get(name)\n if (set) for (const handler of set) (handler as Handler<ChartEvents[K]>)(event)\n }\n}\n"],"mappings":";;;;;AAsEA,SAAgB,OAAO,KAAyB;CAC9C,OAAO,MAAM,GAAG,IAAI,MAAM,GAAG,IAAI,eAAe,OAAO;AACzD;;;;;AAMA,SAAgB,aACd,KACA,SACA,SACA,OACA,QAC0B;CAC1B,MAAM,OAAO,IAAI,sBAAsB;CACvC,MAAM,KAAK,KAAK,QAAQ,IAAI,QAAQ,KAAK,QAAQ;CACjD,MAAM,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;CACpD,OAAO;EAAE,IAAI,UAAU,KAAK,QAAQ;EAAI,IAAI,UAAU,KAAK,OAAO;CAAG;AACvE;;;;;;ACjEA,SAAgB,cAAc,OAA8B,QAAoC;CAC9F,OAAOA,cAAAA,EACL,OACA,EAAE,OAAO,kBAAkB,GAC3B,MAAM,KAAK,SAAS;EAClB,MAAM,MAAM,OAAO,IAAI,KAAK,GAAG;EAC/B,OAAOA,cAAAA,EACL,UACA;GACE,KAAK,KAAK;GACV,MAAM;GACN,OAAO;IACL;IACA;IACA,aAAa,KAAK,QAAQ;IAC1B,OAAO;GACT;GACA,OAAO,EAAE,qBAAqB,KAAK,MAAM;GACzC,gBAA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AO,CAAC;CAC1D;;CAGA,mBAAuC;EACrC,IAAI,OAAO,qBAAqB,YAAY,OAAO,KAAA;EACnD,MAAM,QAAQ,OAAO,WACnB,iBAAiB,KAAK,OAAO,CAAC,CAAC,iBAAiB,gBAAgB,CAClE;EACA,OAAO,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,QAAQ,KAAA;CACvD;;CAGA,WAAiB;EACf,MAAM,KAAK,KAAK;EAChB,MAAM,QAAQ,OAAO,qBAAqB,aAAa,iBAAiB,EAAE,IAAI,KAAA;EAC9E,MAAM,MAAM,UAA8B,OAAO,WAAW,SAAS,EAAE,KAAK;EAC5E,KAAK,YAAY;GACf,OAAO,GAAG,cAAc,GAAG,OAAO,WAAW,IAAI,GAAG,OAAO,YAAY;GACvE,QAAQ,GAAG,eAAe,GAAG,OAAO,UAAU,IAAI,GAAG,OAAO,aAAa;EAC3E;CACF;;CAGA,KAAkC,MAAS,OAA6B;EACtE,MAAM,MAAM,KAAK,UAAU,IAAI,IAAI;EACnC,IAAI,KAAK,KAAK,MAAM,WAAW,KAAM,QAAoC,KAAK;CAChF;AACF"}
@@ -1,12 +1,11 @@
1
- import { a as InsetsInput, n as annotationLayers, r as annotationValues, s as Rect, t as Annotation } from "./annotations-lyt0I3HU.cjs";
2
- import { n as BandScale, t as BandKey } from "./band-DTcNDAFO.cjs";
3
- import { a as ClassValue, i as ChildInput, l as VNode, n as Attrs, s as Props } from "./vnode-BUflsBsa.cjs";
4
- import { a as timePointScale, c as NumberFormat, i as time, s as Locale } from "./time-CNVnt-B2.cjs";
5
- import { n as log, r as LinearScale } from "./log-CaofN3-n.cjs";
6
- import { t as hydrate } from "./hydrate-CTTmQy0x.cjs";
7
- import { t as morph } from "./morph-BMxz3X2b.cjs";
8
- import { a as linePath, i as areaPath, r as Point } from "./path-CwB28da0.cjs";
9
- //#region src/interaction.d.ts
1
+ import { a as InsetsInput, n as annotationLayers, r as annotationValues, s as Rect, t as Annotation } from "./annotations-CHafaGd4.cjs";
2
+ import { a as ClassValue, i as ChildInput, l as VNode, n as Attrs, s as Props } from "./vnode-Du2cC8Fm.cjs";
3
+ import { a as timePointScale, c as NumberFormat, i as time, s as Locale } from "./time-B4oxWHQI.cjs";
4
+ import { n as BandScale, t as BandKey } from "./band-CNKvdnTC.cjs";
5
+ import { n as log, r as LinearScale } from "./log-CI41TmcU.cjs";
6
+ import { t as hydrate } from "./hydrate-BtAZf_5K.cjs";
7
+ import { t as morph } from "./morph-Dh7gJkV4.cjs";
8
+ import { a as linePath, i as areaPath, r as Point } from "./path-YeUiOfG8.cjs";
10
9
  /** One series' value at a hovered position. */
11
10
  interface HitItem {
12
11
  /** Series name. */
@@ -81,9 +80,9 @@ interface Interaction {
81
80
  hitIndex(index: number, seriesIndex?: number): Hit | null;
82
81
  /** Number of categories. */
83
82
  count: number;
83
+ /** Categories run from the right: the left arrow key goes to the next one. */
84
+ reversed?: boolean;
84
85
  }
85
- //#endregion
86
- //#region src/a11y.d.ts
87
86
  /** The data behind a chart as text: header cells and one row per category. */
88
87
  interface DataTable {
89
88
  /** Column headers; the first one labels the row headers (may be empty). */
@@ -100,8 +99,6 @@ interface DataTable {
100
99
  declare function tableContent(table: DataTable, caption?: string): VNode;
101
100
  /** Short sentence describing a hit, announced during keyboard navigation. */
102
101
  declare function describeHit(hit: Hit): string;
103
- //#endregion
104
- //#region src/components/axis.d.ts
105
102
  type AxisPosition = "top" | "right" | "bottom" | "left";
106
103
  /** A single axis tick: its data value, pixel position along the axis and label. */
107
104
  interface Tick {
@@ -148,8 +145,6 @@ declare function axisSize(position: AxisPosition, ticks: readonly Tick[], fontSi
148
145
  * transition when the scale changes.
149
146
  */
150
147
  declare function axis(options: AxisOptions): VNode;
151
- //#endregion
152
- //#region src/charts/cartesian.d.ts
153
148
  /** Category label on the x axis. */
154
149
  type Label = string | number | Date;
155
150
  /** One data series. `null` values are gaps. */
@@ -228,6 +223,8 @@ interface CategoryAxisOptions {
228
223
  type?: "category" | "time";
229
224
  /** Align time ticks to UTC instead of local time (use it for SSR). */
230
225
  utc?: boolean;
226
+ /** Run the categories from the right. Defaults to the chart's `rtl`. */
227
+ reverse?: boolean;
231
228
  }
232
229
  interface CartesianOptions {
233
230
  data: CartesianData;
@@ -290,21 +287,15 @@ declare function categoryInteraction(layout: CartesianLayout, options: Cartesian
290
287
  }, markAt?: (x: number, y: number, index: number) => number | undefined): Interaction;
291
288
  /** Accessible table of series values: one row per category, one column per visible series. */
292
289
  declare function seriesTable(options: CartesianOptions, ctx: RenderContext, limit?: number): DataTable;
293
- //#endregion
294
- //#region src/charts/dates.d.ts
295
290
  /**
296
291
  * Formatter for date labels on a time axis (tooltips, tables, band axes):
297
292
  * the date, with the time of day when the labels span less than a few days.
298
293
  */
299
294
  declare function dateLabels(labels: readonly Label[], utc: boolean | undefined, locale: Locale): (label: Label) => string;
300
- //#endregion
301
- //#region src/charts/log-axis.d.ts
302
295
  /** Domain of a log axis: positive values only, niced to whole powers of ten. */
303
296
  declare function logDomain(values: readonly (number | null | undefined)[], options: ValueAxisOptions): [number, number];
304
297
  /** Ticks of a log axis, each power formatted as is. */
305
298
  declare function logTicks(scale: LinearScale, count: number, format: NumberFormat | undefined, locale: Locale): Tick[];
306
- //#endregion
307
- //#region src/legend.d.ts
308
299
  /** One legend entry: a series (or a slice, for part-to-whole charts). */
309
300
  interface LegendItem {
310
301
  /** Stable identity, used to toggle it. */
@@ -328,8 +319,6 @@ interface LegendOptions {
328
319
  declare function legendContent(items: readonly LegendItem[], hidden: ReadonlySet<string>): VNode;
329
320
  /** Keys hidden by default, from the entries' own `hidden` flags. */
330
321
  declare function defaultHidden(items: readonly LegendItem[]): Set<string>;
331
- //#endregion
332
- //#region src/charts/patterns.d.ts
333
322
  /** `<pattern>` elements for the legend entries of a chart. */
334
323
  declare function patternDefs(items: readonly LegendItem[], id: string): VNode[];
335
324
  /** The `--tc-pattern-{n}` references for the chart root. */
@@ -341,21 +330,15 @@ declare function patternVars(items: readonly LegendItem[], id: string): Record<s
341
330
  * `undefined` for a chart without legend entries.
342
331
  */
343
332
  declare function patternFills(config: ChartConfig<object>, id: string): [string, Record<string, string>, VNode] | undefined;
344
- //#endregion
345
- //#region src/charts/point-shapes.d.ts
346
333
  /** The path of slot `slot`'s marker of radius `r` around (`x`, `y`). */
347
334
  declare function markerPath(slot: number, x: number, y: number, r: number): string;
348
335
  /** The step that gives the points of charts with `shapes` (or `patterns: true`) their shapes. */
349
336
  declare const shapesStep: PostStep;
350
- //#endregion
351
- //#region src/charts/time-axis.d.ts
352
337
  /**
353
338
  * A time category axis: points at their real distance in time, ticks on
354
339
  * calendar boundaries labelled for the span (or with `x.format`).
355
340
  */
356
341
  declare function timeAxis(labels: readonly Label[], keys: readonly BandKey[], options: CategoryAxisOptions, count: number, locale: Locale): CategoryAxis;
357
- //#endregion
358
- //#region src/export-chart.d.ts
359
342
  interface ExportOptions {
360
343
  /**
361
344
  * Background color, `'auto'` for the chart's surface (`--tc-surface`), or
@@ -407,8 +390,32 @@ declare function exportImage(target: ExportTarget, options?: ImageOptions): Prom
407
390
  * ```
408
391
  */
409
392
  declare function downloadChart(target: ExportTarget, options?: DownloadOptions): Promise<void>;
410
- //#endregion
411
- //#region src/render/sweep.d.ts
393
+ interface ArcOptions {
394
+ innerRadius: number;
395
+ outerRadius: number;
396
+ startAngle: number;
397
+ endAngle: number;
398
+ /** Angle removed between adjacent arcs, split between both ends. Defaults to `0`. */
399
+ padAngle?: number;
400
+ /** Radius the pad angle is measured at. Defaults to `sqrt(inner² + outer²)` like d3. */
401
+ padRadius?: number;
402
+ /** Radius of the rounded corners, clamped to half the ring thickness. Defaults to `0`. */
403
+ cornerRadius?: number;
404
+ /** Decimal places kept in the path data. Defaults to `2`. */
405
+ precision?: number;
406
+ }
407
+ /** Midpoint of an arc, e.g. to anchor a tooltip or label (like d3's `arc.centroid`). */
408
+ declare function arcCentroid(options: ArcOptions): [number, number];
409
+ /** Pad angle giving a constant `gap` (in pixels) between arcs of a ring. */
410
+ declare function padAngleForGap(gap: number, innerRadius: number, outerRadius: number): number;
411
+ /**
412
+ * The same sector as {@link arcPath}, drawn with a fixed command structure:
413
+ * every corner is always present (zero length when there is none) and each
414
+ * ring is split into two half arcs, so the large-arc flag never flips.
415
+ * Paths of different angles therefore keep their commands while an arc is
416
+ * redrawn frame by frame, turning to its new angles (see `sweep`).
417
+ */
418
+ declare function arcPathStable(options: ArcOptions): string;
412
419
  /**
413
420
  * Take `el` from the arc of its last render, `prev`, to the arc of `next`.
414
421
  * Returns the attributes left for the caller to patch (all but `d`, set
@@ -416,8 +423,6 @@ declare function downloadChart(target: ExportTarget, options?: DownloadOptions):
416
423
  * same path, no arc to come from, or a chart without transitions.
417
424
  */
418
425
  declare function sweep(el: Element, prev: VNode, next: VNode): Attrs | undefined;
419
- //#endregion
420
- //#region src/features.d.ts
421
426
  /**
422
427
  * Optional features that chart types look up at render time. Each lives in
423
428
  * its own module (`@tabler/charts/time`, `/log`, `/decimate`, `/line`, `/annotations`) and registers
@@ -479,8 +484,6 @@ declare function register(added: Features): void;
479
484
  type PostStep = (config: ChartConfig<object>, content: ChildInput, interaction: Interaction | undefined, ctx: RenderContext) => ChildInput;
480
485
  /** The registered feature, or a helpful error naming the import that provides it. */
481
486
  declare function feature<K extends keyof Features>(name: K): NonNullable<Features[K]>;
482
- //#endregion
483
- //#region src/charts/value-labels.d.ts
484
487
  interface ValueLabelOptions {
485
488
  /** Format of the values. Defaults to the value axis format (slices: their share in percent). */
486
489
  format?: NumberFormat;
@@ -491,8 +494,6 @@ interface ValueLabelOptions {
491
494
  declare function valueLabels(config: ChartConfig<object>, interaction: Interaction, ctx: RenderContext): VNode | null;
492
495
  /** The step that adds the labels over the content of charts with `valueLabels`. */
493
496
  declare const labelsStep: PostStep;
494
- //#endregion
495
- //#region src/plugin.d.ts
496
497
  /** What a plugin sees before the chart measures itself and renders. */
497
498
  interface BeforeRenderState {
498
499
  config: ChartConfig<object>;
@@ -538,8 +539,6 @@ interface ChartPlugin {
538
539
  readonly name: string;
539
540
  install(chart: Chart<object>): PluginInstance;
540
541
  }
541
- //#endregion
542
- //#region src/plugins/download.d.ts
543
542
  /** A file format of the download menu. */
544
543
  type DownloadFormat = "png" | "svg" | "jpeg" | "webp";
545
544
  /** The `download` option as an object. */
@@ -570,8 +569,6 @@ type DownloadOption = boolean | readonly DownloadFormat[] | DownloadMenuOptions;
570
569
  * carry the export code.
571
570
  */
572
571
  declare function download(): ChartPlugin;
573
- //#endregion
574
- //#region src/tooltip.d.ts
575
572
  /**
576
573
  * Where a tooltip for `hit` belongs, in chart pixels: the pointer when it
577
574
  * drives the highlight, otherwise the focused value (keyboard).
@@ -608,7 +605,8 @@ interface TooltipPlacement {
608
605
  /**
609
606
  * Place a `width × height` tooltip next to an anchor within `bounds` (from
610
607
  * `bounds.x`, `bounds.y`, 0 by default): right of the anchor, or left when it
611
- * would overflow, vertically centered on the pointer and clamped.
608
+ * would overflow (the other way round with `rtl`), vertically centered on the
609
+ * pointer and clamped.
612
610
  */
613
611
  declare function placeTooltip(anchor: {
614
612
  x: number;
@@ -621,9 +619,7 @@ declare function placeTooltip(anchor: {
621
619
  y?: number;
622
620
  width: number;
623
621
  height: number;
624
- }, offset?: number): TooltipPlacement;
625
- //#endregion
626
- //#region src/chart.d.ts
622
+ }, offset?: number, rtl?: boolean): TooltipPlacement;
627
623
  /** Size and environment a chart type renders into. */
628
624
  interface RenderContext {
629
625
  width: number;
@@ -637,6 +633,8 @@ interface RenderContext {
637
633
  onHitTest(interaction: Interaction): void;
638
634
  /** Keys of legend entries (series) currently hidden. */
639
635
  hidden: ReadonlySet<string>;
636
+ /** Lay the chart out right to left (the `rtl` option, resolved). */
637
+ rtl?: boolean;
640
638
  }
641
639
  /**
642
640
  * A chart type plugin (`line`, `bar`, …). Receives the chart options and
@@ -695,6 +693,14 @@ interface BaseOptions {
695
693
  class?: ClassValue;
696
694
  /** Locale for number and date formatting. Set it explicitly for SSR. */
697
695
  locale?: Locale;
696
+ /**
697
+ * Mirror the layout for right-to-left pages: the value axis on the right
698
+ * and categories running from the right (`x.reverse` overrides the latter).
699
+ * `'auto'` follows the `direction` of the container (left to right in SSR).
700
+ * The legend, the tooltip and the download menu read right to left with it.
701
+ * Cartesian charts, heatmaps, sparklines and sankey diagrams. Defaults to `false`.
702
+ */
703
+ rtl?: boolean | "auto";
698
704
  /**
699
705
  * Font size used to lay out labels. In the browser it is read from the
700
706
  * `--tc-font-size` custom property of the container when not set; set it
@@ -783,7 +789,7 @@ interface Size {
783
789
  /** Resolve the final pixel size from options and the measured container size. */
784
790
  declare function resolveSize(options: BaseOptions, measured?: Partial<Size>): Size;
785
791
  /** Render context for a config and size (also used by plugins such as the data table). */
786
- declare function renderContext<O extends object>(config: ChartConfig<O>, size: Size, id: string, onHitTest: (interaction: Interaction) => void, hidden: ReadonlySet<string>, measuredFontSize?: number): RenderContext;
792
+ declare function renderContext<O extends object>(config: ChartConfig<O>, size: Size, id: string, onHitTest: (interaction: Interaction) => void, hidden: ReadonlySet<string>, measuredFontSize?: number, rtl?: boolean): RenderContext;
787
793
  /** Legend entries of a config, whether a legend is shown and where. */
788
794
  interface ResolvedLegend {
789
795
  items: LegendItem[];
@@ -865,6 +871,11 @@ declare class Chart<O extends object = object> {
865
871
  get config(): ChartConfig<O>;
866
872
  /** Size of the last render. */
867
873
  get size(): Size;
874
+ /**
875
+ * Whether the chart is laid out right to left: the `rtl` option, with
876
+ * `'auto'` read from the container (together with the font size).
877
+ */
878
+ get rtl(): boolean;
868
879
  /** Font size used by the last render (explicit, measured, or the default). */
869
880
  get fontSize(): number;
870
881
  /** How pointer and keyboard map to data for the current render. */
@@ -928,6 +939,4 @@ declare class Chart<O extends object = object> {
928
939
  /** Call the handlers of an event (plugins emit `click`, for instance). */
929
940
  emit<K extends keyof ChartEvents>(name: K, event: ChartEvents[K]): void;
930
941
  }
931
- //#endregion
932
- export { CartesianOptions as $, labelsStep as A, downloadChart as B, DownloadOption as C, HitTester as Ct, ChartPlugin as D, BeforeRenderState as E, register as F, patternDefs as G, exportSVG as H, DownloadOptions as I, LegendItem as J, patternFills as K, ExportOptions as L, Features as M, feature as N, PluginInstance as O, features as P, CartesianData as Q, ExportTarget as R, DownloadMenuOptions as S, HitItem as St, AfterRenderState as T, markerPath as U, exportImage as V, shapesStep as W, defaultHidden as X, LegendOptions as Y, legendContent as Z, TooltipPlacement as _, thinTicks as _t, ChartType as a, domainOf as at, tooltipContent as b, tableContent as bt, Size as c, seriesTable as ct, chartLabel as d, LinearTicksOptions as dt, CategoryAxisOptions as et, chartToString as f, Tick as ft, TooltipOptions as g, linearTicks as gt, resolveSize as h, bandTicks as ht, ChartEvents as i, categoryInteraction as it, valueLabels as j, ValueLabelOptions as k, buildChart as l, AxisOptions as lt, resolveLegend as m, axisSize as mt, Chart as n, Series as nt, RenderContext as o, seriesKey as ot, renderContext as p, axis as pt, patternVars as q, ChartConfig as r, ValueAxisOptions as rt, ResolvedLegend as s, seriesLegend as st, BaseOptions as t, Label as tt, chartEvents as u, AxisPosition as ut, hitAnchor as v, DataTable as vt, download as w, Interaction as wt, DownloadFormat as x, Hit as xt, placeTooltip as y, describeHit as yt, ImageOptions as z };
933
- //# sourceMappingURL=chart-D7ooEFnk.d.cts.map
942
+ export { LegendOptions as $, labelsStep as A, DownloadOptions as B, DownloadOption as C, describeHit as Ct, ChartPlugin as D, HitTester as Dt, BeforeRenderState as E, HitItem as Et, register as F, exportImage as G, ExportTarget as H, ArcOptions as I, shapesStep as J, exportSVG as K, arcCentroid as L, Features as M, feature as N, PluginInstance as O, Interaction as Ot, features as P, LegendItem as Q, arcPathStable as R, DownloadMenuOptions as S, DataTable as St, AfterRenderState as T, Hit as Tt, ImageOptions as U, ExportOptions as V, downloadChart as W, patternFills as X, patternDefs as Y, patternVars as Z, TooltipPlacement as _, axis as _t, ChartType as a, Label as at, tooltipContent as b, linearTicks as bt, Size as c, categoryInteraction as ct, chartLabel as d, seriesLegend as dt, defaultHidden as et, chartToString as f, seriesTable as ft, TooltipOptions as g, Tick as gt, resolveSize as h, LinearTicksOptions as ht, ChartEvents as i, CategoryAxisOptions as it, valueLabels as j, ValueLabelOptions as k, buildChart as l, domainOf as lt, resolveLegend as m, AxisPosition as mt, Chart as n, CartesianData as nt, RenderContext as o, Series as ot, renderContext as p, AxisOptions as pt, markerPath as q, ChartConfig as r, CartesianOptions as rt, ResolvedLegend as s, ValueAxisOptions as st, BaseOptions as t, legendContent as tt, chartEvents as u, seriesKey as ut, hitAnchor as v, axisSize as vt, download as w, tableContent as wt, DownloadFormat as x, thinTicks as xt, placeTooltip as y, bandTicks as yt, padAngleForGap as z };
@@ -1,7 +1,6 @@
1
- //#region src/shapes/circle.ts
1
+ // src/shapes/circle.ts
2
2
  /** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */
3
3
  const circlePath = (r) => `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`;
4
- //#endregion
5
4
  Object.defineProperty(exports, "circlePath", {
6
5
  enumerable: true,
7
6
  get: function() {
@@ -9,4 +8,4 @@ Object.defineProperty(exports, "circlePath", {
9
8
  }
10
9
  });
11
10
 
12
- //# sourceMappingURL=circle-BQMuAfls.cjs.map
11
+ //# sourceMappingURL=circle-Bwxy5j7B.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"circle-BQMuAfls.cjs","names":[],"sources":["../src/shapes/circle.ts"],"sourcesContent":["/** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */\nexport const circlePath = (r: number): string =>\n `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`\n"],"mappings":";;AACA,MAAa,cAAc,MACzB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE"}
1
+ {"version":3,"file":"circle-Bwxy5j7B.cjs","names":[],"sources":["../src/shapes/circle.ts"],"sourcesContent":["/** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */\nexport const circlePath = (r: number): string =>\n `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`\n"],"mappings":";;AACA,MAAa,cAAc,MACzB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE"}
@@ -1,7 +1,6 @@
1
- //#region src/shapes/circle.ts
1
+ // src/shapes/circle.ts
2
2
  /** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */
3
3
  const circlePath = (r) => `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`;
4
- //#endregion
5
4
  export { circlePath as t };
6
5
 
7
- //# sourceMappingURL=circle-Z7YfCoCM.js.map
6
+ //# sourceMappingURL=circle-YRDaOBpk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"circle-Z7YfCoCM.js","names":[],"sources":["../src/shapes/circle.ts"],"sourcesContent":["/** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */\nexport const circlePath = (r: number): string =>\n `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`\n"],"mappings":";;AACA,MAAa,cAAc,MACzB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE"}
1
+ {"version":3,"file":"circle-YRDaOBpk.js","names":[],"sources":["../src/shapes/circle.ts"],"sourcesContent":["/** SVG path of a circle of radius `r` around the origin (a path, so it can be a hover mark). */\nexport const circlePath = (r: number): string =>\n `M${r},0A${r},${r},0,1,1,${-r},0A${r},${r},0,1,1,${r},0Z`\n"],"mappings":";;AACA,MAAa,cAAc,MACzB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE"}
@@ -1,4 +1,4 @@
1
- //#region src/charts/clean.ts
1
+ // src/charts/clean.ts
2
2
  /**
3
3
  * A number the chart can draw, or `null`: finite and at most 1e300 in size, so
4
4
  * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.
@@ -50,7 +50,6 @@ const cleanItems = (data) => records(data, (r) => ({
50
50
  value: finite(r.value) ?? 0,
51
51
  max: optional(r.max)
52
52
  }));
53
- //#endregion
54
- export { isRecord as a, numbers as c, finite as i, records as l, cleanItems as n, label as o, cleanSeries as r, named as s, cleanData as t, text as u };
53
+ export { isRecord as a, named as c, text as d, finite as i, numbers as l, cleanItems as n, label as o, cleanSeries as r, list as s, cleanData as t, records as u };
55
54
 
56
- //# sourceMappingURL=clean-o1vDEhFV.js.map
55
+ //# sourceMappingURL=clean-CkoQobGv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean-o1vDEhFV.js","names":[],"sources":["../src/charts/clean.ts"],"sourcesContent":["/**\n * Data from users, APIs and JSON is often not what the types say. Each chart\n * type cleans its data as it comes in, annotations as they render, axis bounds where read\n * (`ChartType.clean`): numbers\n * that are not finite become gaps, names become text, colors that are not\n * strings are dropped, and lists or records of the wrong kind are left out.\n * What is already clean keeps its identity, so large arrays are not copied.\n */\nimport type { Label } from './cartesian.ts'\n\ntype Rec = Record<string, unknown>\n\n/**\n * A number the chart can draw, or `null`: finite and at most 1e300 in size, so\n * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.\n */\nexport const finite = (v: unknown): number | null =>\n typeof v === 'number' && Math.abs(v) <= 1e300 ? (Math.abs(v) < 1e-300 ? 0 : v) : null\n\n/** A finite number, or `undefined` (an option left out). */\nconst optional = (v: unknown): number | undefined => finite(v) ?? undefined\n\nexport const isRecord = (v: unknown): v is Rec => !!v && typeof v === 'object' && !Array.isArray(v)\n\n/** The array, or an empty one. */\nexport const list = (v: unknown): readonly unknown[] => (Array.isArray(v) ? v : [])\n\n/** Strings as they are, finite numbers as digits, anything else as ''. */\nexport const text = (v: unknown): string =>\n typeof v === 'string' ? v : finite(v) === null ? '' : String(v)\n\n/** A category label: a string, a finite number or a valid date; else ''. */\nexport const label = (v: unknown): Label =>\n typeof v === 'string' || finite(v instanceof Date ? +v : v) !== null ? (v as Label) : ''\n\n/** Values with gaps for anything that is not a finite number (the same array when clean). */\nexport const numbers = (v: unknown): readonly (number | null)[] => {\n const values = list(v)\n return (\n values.every((x) => x == null || finite(x) === x) ? values : values.map(finite)\n ) as readonly (number | null)[]\n}\n\n/** The records of a list, each fixed by `fix`; other items are left out. */\nexport const records = <T>(v: unknown, fix: (r: Rec) => T): T[] => list(v).filter(isRecord).map(fix)\n\n/** What every named item has: text for its name, a string id and color. */\nexport const named = (r: Rec): Rec => ({\n ...r,\n name: text(r.name),\n id: typeof r.id === 'string' ? r.id : undefined,\n color: typeof r.color === 'string' ? r.color : undefined,\n})\n\n/** Labels and series of the cartesian types (line, area, bar, heatmap, radar). */\nexport const cleanSeries = (data: unknown): unknown => {\n const d = isRecord(data) ? data : {}\n return {\n ...d,\n labels: Array.isArray(d.labels) ? d.labels.map(label) : undefined,\n series: records(d.series, (s) => ({\n ...named(s),\n values: numbers(s.values),\n })),\n }\n}\n\n/** Options with their data cleaned by `data` (axis bounds are checked where they are read). */\nexport const cleanData =\n (data: (v: unknown) => unknown) =>\n <O>(options: O): O => ({ ...options, data: data((options as Rec).data) })\n\n/** Slices or rings: records with a finite value (0 when it is not). */\nexport const cleanItems = (data: unknown): unknown =>\n records(data, (r) => ({ ...named(r), value: finite(r.value) ?? 0, max: optional(r.max) }))\n"],"mappings":";;;;;AAgBA,MAAa,UAAU,MACrB,OAAO,MAAM,YAAY,KAAK,IAAI,CAAC,KAAK,QAAS,KAAK,IAAI,CAAC,IAAI,SAAS,IAAI,IAAK;;AAGnF,MAAM,YAAY,MAAmC,OAAO,CAAC,KAAK,KAAA;AAElE,MAAa,YAAY,MAAyB,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;;AAGlG,MAAa,QAAQ,MAAoC,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC;;AAGjF,MAAa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ON is often not what the types say. Each chart\n * type cleans its data as it comes in, annotations as they render, axis bounds where read\n * (`ChartType.clean`): numbers\n * that are not finite become gaps, names become text, colors that are not\n * strings are dropped, and lists or records of the wrong kind are left out.\n * What is already clean keeps its identity, so large arrays are not copied.\n */\nimport type { Label } from './cartesian.ts'\n\ntype Rec = Record<string, unknown>\n\n/**\n * A number the chart can draw, or `null`: finite and at most 1e300 in size, so\n * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.\n */\nexport const finite = (v: unknown): number | null =>\n typeof v === 'number' && Math.abs(v) <= 1e300 ? (Math.abs(v) < 1e-300 ? 0 : v) : null\n\n/** A finite number, or `undefined` (an option left out). */\nconst optional = (v: unknown): number | undefined => finite(v) ?? undefined\n\nexport const isRecord = (v: unknown): v is Rec => !!v && typeof v === 'object' && !Array.isArray(v)\n\n/** The array, or an empty one. */\nexport const list = (v: unknown): readonly unknown[] => (Array.isArray(v) ? v : [])\n\n/** Strings as they are, finite numbers as digits, anything else as ''. */\nexport const text = (v: unknown): string =>\n typeof v === 'string' ? v : finite(v) === null ? '' : String(v)\n\n/** A category label: a string, a finite number or a valid date; else ''. */\nexport const label = (v: unknown): Label =>\n typeof v === 'string' || finite(v instanceof Date ? +v : v) !== null ? (v as Label) : ''\n\n/** Values with gaps for anything that is not a finite number (the same array when clean). */\nexport const numbers = (v: unknown): readonly (number | null)[] => {\n const values = list(v)\n return (\n values.every((x) => x == null || finite(x) === x) ? values : values.map(finite)\n ) as readonly (number | null)[]\n}\n\n/** The records of a list, each fixed by `fix`; other items are left out. */\nexport const records = <T>(v: unknown, fix: (r: Rec) => T): T[] => list(v).filter(isRecord).map(fix)\n\n/** What every named item has: text for its name, a string id and color. */\nexport const named = (r: Rec): Rec => ({\n ...r,\n name: text(r.name),\n id: typeof r.id === 'string' ? r.id : undefined,\n color: typeof r.color === 'string' ? r.color : undefined,\n})\n\n/** Labels and series of the cartesian types (line, area, bar, heatmap, radar). */\nexport const cleanSeries = (data: unknown): unknown => {\n const d = isRecord(data) ? data : {}\n return {\n ...d,\n labels: Array.isArray(d.labels) ? d.labels.map(label) : undefined,\n series: records(d.series, (s) => ({\n ...named(s),\n values: numbers(s.values),\n })),\n }\n}\n\n/** Options with their data cleaned by `data` (axis bounds are checked where they are read). */\nexport const cleanData =\n (data: (v: unknown) => unknown) =>\n <O>(options: O): O => ({ ...options, data: data((options as Rec).data) })\n\n/** Slices or rings: records with a finite value (0 when it is not). */\nexport const cleanItems = (data: unknown): unknown =>\n records(data, (r) => ({ ...named(r), value: finite(r.value) ?? 0, max: optional(r.max) }))\n"],"mappings":";;;;;AAgBA,MAAa,UAAU,MACrB,OAAO,MAAM,YAAY,KAAK,IAAI,CAAC,KAAK,QAAS,KAAK,IAAI,CAAC,IAAI,SAAS,IAAI,IAAK;;AAGnF,MAAM,YAAY,MAAmC,OAAO,CAAC,KAAK,KAAA;AAElE,MAAa,YAAY,MAAyB,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;;AAGlG,MAAa,QAAQ,MAAoC,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC;;AAGjF,MAAa,QAAQ,MACnB,OAAO,MAAM,WAAW,IAAI,OAAO,CAAC,MAAM,OAAO,KAAK,OAAO,CAAC;;AAGhE,MAAa,SAAS,MACpB,OAAO,MAAM,YAAY,OAAO,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,OAAQ,IAAc;;AAGxF,MAAa,WAAW,MAA2C;CACjE,MAAM,SAAS,KAAK,CAAC;CACrB,OACE,OAAO,OAAO,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,OAAO,IAAI,MAAM;AAElF;;AAGA,MAAa,WAAc,GAAY,QAA4B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,GAAG;;AAGnG,MAAa,SAAS,OAAiB;CACrC,GAAG;CACH,MAAM,KAAK,EAAE,IAAI;CACjB,IAAI,OAAO,EAAE,OAAO,WAAW,EAAE,KAAK,KAAA;CACtC,OAAO,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ,KAAA;AACjD;;AAGA,MAAa,eAAe,SAA2B;CACrD,MAAM,IAAI,SAAS,IAAI,IAAI,OAAO,CAAC;CACnC,OAAO;EACL,GAAG;EACH,QAAQ,MAAM,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,KAAK,IAAI,KAAA;EACxD,QAAQ,QAAQ,EAAE,SAAS,OAAO;GAChC,GAAG,MAAM,CAAC;GACV,QAAQ,QAAQ,EAAE,MAAM;EAC1B,EAAE;CACJ;AACF;;AAGA,MAAa,aACV,UACG,aAAmB;CAAE,GAAG;CAAS,MAAM,KAAM,QAAgB,IAAI;AAAE;;AAGzE,MAAa,cAAc,SACzB,QAAQ,OAAO,OAAO;CAAE,GAAG,MAAM,CAAC;CAAG,OAAO,OAAO,EAAE,KAAK,KAAK;CAAG,KAAK,SAAS,EAAE,GAAG;AAAE,EAAE"}
@@ -1,4 +1,4 @@
1
- //#region src/charts/clean.ts
1
+ // src/charts/clean.ts
2
2
  /**
3
3
  * A number the chart can draw, or `null`: finite and at most 1e300 in size, so
4
4
  * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.
@@ -50,7 +50,6 @@ const cleanItems = (data) => records(data, (r) => ({
50
50
  value: finite(r.value) ?? 0,
51
51
  max: optional(r.max)
52
52
  }));
53
- //#endregion
54
53
  Object.defineProperty(exports, "cleanData", {
55
54
  enumerable: true,
56
55
  get: function() {
@@ -87,6 +86,12 @@ Object.defineProperty(exports, "label", {
87
86
  return label;
88
87
  }
89
88
  });
89
+ Object.defineProperty(exports, "list", {
90
+ enumerable: true,
91
+ get: function() {
92
+ return list;
93
+ }
94
+ });
90
95
  Object.defineProperty(exports, "named", {
91
96
  enumerable: true,
92
97
  get: function() {
@@ -112,4 +117,4 @@ Object.defineProperty(exports, "text", {
112
117
  }
113
118
  });
114
119
 
115
- //# sourceMappingURL=clean-Byl6kzf0.cjs.map
120
+ //# sourceMappingURL=clean-Die2iCNc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean-Byl6kzf0.cjs","names":[],"sources":["../src/charts/clean.ts"],"sourcesContent":["/**\n * Data from users, APIs and JSON is often not what the types say. Each chart\n * type cleans its data as it comes in, annotations as they render, axis bounds where read\n * (`ChartType.clean`): numbers\n * that are not finite become gaps, names become text, colors that are not\n * strings are dropped, and lists or records of the wrong kind are left out.\n * What is already clean keeps its identity, so large arrays are not copied.\n */\nimport type { Label } from './cartesian.ts'\n\ntype Rec = Record<string, unknown>\n\n/**\n * A number the chart can draw, or `null`: finite and at most 1e300 in size, so\n * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.\n */\nexport const finite = (v: unknown): number | null =>\n typeof v === 'number' && Math.abs(v) <= 1e300 ? (Math.abs(v) < 1e-300 ? 0 : v) : null\n\n/** A finite number, or `undefined` (an option left out). */\nconst optional = (v: unknown): number | undefined => finite(v) ?? undefined\n\nexport const isRecord = (v: unknown): v is Rec => !!v && typeof v === 'object' && !Array.isArray(v)\n\n/** The array, or an empty one. */\nexport const list = (v: unknown): readonly unknown[] => (Array.isArray(v) ? v : [])\n\n/** Strings as they are, finite numbers as digits, anything else as ''. */\nexport const text = (v: unknown): string =>\n typeof v === 'string' ? v : finite(v) === null ? '' : String(v)\n\n/** A category label: a string, a finite number or a valid date; else ''. */\nexport const label = (v: unknown): Label =>\n typeof v === 'string' || finite(v instanceof Date ? +v : v) !== null ? (v as Label) : ''\n\n/** Values with gaps for anything that is not a finite number (the same array when clean). */\nexport const numbers = (v: unknown): readonly (number | null)[] => {\n const values = list(v)\n return (\n values.every((x) => x == null || finite(x) === x) ? values : values.map(finite)\n ) as readonly (number | null)[]\n}\n\n/** The records of a list, each fixed by `fix`; other items are left out. */\nexport const records = <T>(v: unknown, fix: (r: Rec) => T): T[] => list(v).filter(isRecord).map(fix)\n\n/** What every named item has: text for its name, a string id and color. */\nexport const named = (r: Rec): Rec => ({\n ...r,\n name: text(r.name),\n id: typeof r.id === 'string' ? r.id : undefined,\n color: typeof r.color === 'string' ? r.color : undefined,\n})\n\n/** Labels and series of the cartesian types (line, area, bar, heatmap, radar). */\nexport const cleanSeries = (data: unknown): unknown => {\n const d = isRecord(data) ? data : {}\n return {\n ...d,\n labels: Array.isArray(d.labels) ? d.labels.map(label) : undefined,\n series: records(d.series, (s) => ({\n ...named(s),\n values: numbers(s.values),\n })),\n }\n}\n\n/** Options with their data cleaned by `data` (axis bounds are checked where they are read). */\nexport const cleanData =\n (data: (v: unknown) => unknown) =>\n <O>(options: O): O => ({ ...options, data: data((options as Rec).data) })\n\n/** Slices or rings: records with a finite value (0 when it is not). */\nexport const cleanItems = (data: unknown): unknown =>\n records(data, (r) => ({ ...named(r), value: finite(r.value) ?? 0, max: optional(r.max) }))\n"],"mappings":";;;;;AAgBA,MAAa,UAAU,MACrB,OAAO,MAAM,YAAY,KAAK,IAAI,CAAC,KAAK,QAAS,KAAK,IAAI,CAAC,IAAI,SAAS,IAAI,IAAK;;AAGnF,MAAM,YAAY,MAAmC,OAAO,CAAC,KAAK,KAAA;AAElE,MAAa,YAAY,MAAyB,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,CAAC;;AAGlG,MAAa,QAAQ,MAAoC,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC;;AAGjF,MAAa,QAAQ,MACnB,OAAO,MAAM,WAAW,IAAI,OAAO,CAAC,MAAM,OAAO,KAAK,OAAO,CAAC;;AAGhE,MAAa,SAAS,MACpB,OAAO,MAAM,YAAY,OAAO,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,OAAQ,IAAc;;AAGxF,MAAa,WAAW,MAA2C;CACjE,MAAM,SAAS,KAAK,CAAC;CACrB,OACE,OAAO,OAAO,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,CAAC,IAAI,SAAS,OAAO,IAAI,MAAM;AAElF;;AAGA,MAAa,WAAc,GAAY,QAA4B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,GAAG;;AAGnG,MAAa,SAAS,OAAiB;CACrC,GAAG;CACH,MAAM,KAAK,EAAE,IAAI;CACjB,IAAI,OAAO,EAAE,OAAO,WAAW,EAAE,KAAK,KAAA;CACtC,OAAO,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ,KAAA;AACjD;;AAGA,MAAa,eAAe,SAA2B;CACrD,MAAM,IAAI,SAAS,IAAI,IAAI,OAAO,CAAC;CACnC,OAAO;EACL,GAAG;EACH,QAAQ,MAAM,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,IAAI,KAAK,IAAI,KAAA;EACxD,QAAQ,QAAQ,EAAE,SAAS,OAAO;GAChC,GAAG,MAAM,CAAC;GACV,QAAQ,QAAQ,EAAE,MAAM;EAC1B,EAAE;CACJ;AACF;;AAGA,MAAa,aACV,UACG,aAAmB;CAAE,GAAG;CAAS,MAAM,KAAM,QAAgB,IAAI;AAAE;;AAGzE,MAAa,cAAc,SACzB,QAAQ,OAAO,OAAO;CAAE,GAAG,MAAM,CAAC;CAAG,OAAO,OAAO,EAAE,KAAK,KAAK;CAAG,KAAK,SAAS,EAAE,GAAG;AAAE,EAAE"}
1
+ {"version":3,"file":"clean-Die2iCNc.cjs","names":[],"sources":["../src/charts/clean.ts"],"sourcesContent":["/**\n * Data from users, APIs and JSON is often not what the types say. Each chart\n * type cleans its data as it comes in, annotations as they render, axis bounds where read\n * (`ChartType.clean`): numbers\n * that are not finite become gaps, names become text, colors that are not\n * strings are dropped, and lists or records of the wrong kind are left out.\n * What is already clean keeps its identity, so large arrays are not copied.\n */\nimport type { Label } from './cartesian.ts'\n\ntype Rec = Record<string, unknown>\n\n/**\n * A number the chart can draw, or `null`: finite and at most 1e300 in size, so\n * spans stay finite; below 1e-300 it is 0, so tick steps do not underflow.\n */\nexport const finite = (v: unknown): number | null =>\n typeof v === 'number' && Math.abs(v) <= 1e300 ? (Math.abs(v) < 1e-300 ? 0 : v) : null\n\n/** A finite number, or `undefined` (an option left out). */\nconst optional = (v: unknown): number | undefined => finite(v) ?? undefined\n\nexport const isRecord = (v: unknown): v is Rec => !!v && typeof v === 'object' && !Array.isArray(v)\n\n/** The array, or an empty one. */\nexport const list = (v: unknown): readonly unknown[] => (Array.isArray(v) ? v : [])\n\n/** Strings as they are, finite numbers as digits, anything else as ''. */\nexport const text = (v: unknown): string =>\n typeof v === 'string' ? v : finite(v) === null ? '' : String(v)\n\n/** A category label: a string, a finite number or a valid date; else ''. */\nexport const label = (v: unknown): Label =>\n typeof v === 'string' || finite(v instanceof Date ? +v : v) !== null ? (v as Label) : ''\n\n/** Values with gaps for anything that is not a finite number (the same array when clean). */\nexport const numbers = (v: unknown): readonly (number | null)[] => {\n const values = list(v)\n return (\n values.every((x) => x == null || finite(x) === x) ? values : values.map(finite)\n ) as readonly (number | null)[]\n}\n\n/** The records of a list, each fixed by `fix`; other items are left out. */\nexport const records = <T>(v: unknown, fix: (r: Rec) => T): T[] => list(v).filter(isRecord).map(fix)\n\n/** What every named item has: text for its name, a string id and color. */\nexport const named = (r: Rec): Rec => ({\n ...r,\n name: text(r.name),\n id: typeof r.id === 'string' ? r.id : undefined,\n color: typeof r.color === 'string' ? r.color : undefined,\n})\n\n/** Labels and series of the cartesian types (line, area, bar, heatmap, radar). */\nexport const cleanSeries = (data: unknown): unknown => {\n const d = isRecord(data) ? data : {}\n return {\n ...d,\n labels: Array.isArray(d.labels) ? d.labels.map(label) : undefined,\n series: records(d.series, (s) => ({\n ...named(s),\n values: numbers(s.values),\n })),\n }\n}\n\n/** Options with their data cleaned by `data` (axis bounds are checked where they are read). */\nexport const cleanData =\n (data: (v: unknown) => unknown) =>\n <O>(options: O): O => ({ ...options, data: data((options as Rec).data) })\n\n/** Slices or rings: records with a finite value (0 when it is not). */\nexport const cleanItems = (data: unknown): unknown =>\n records(data, (r) => ({ ...named(r), value: finite(r.value) ?? 0, max: optional(r.max) }))\n"],"mappings":";;;;;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