@tabler/charts 0.2.0 → 0.4.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 (420) hide show
  1. package/README.md +165 -17
  2. package/dist/{annotations-DdRdeBUB.cjs → annotations--m-HzMBM.cjs} +87 -11
  3. package/dist/annotations--m-HzMBM.cjs.map +1 -0
  4. package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
  5. package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
  6. package/dist/{annotations-D0YQ0IoA.js → annotations-DGITy6th.js} +87 -11
  7. package/dist/annotations-DGITy6th.js.map +1 -0
  8. package/dist/annotations.cjs +2 -2
  9. package/dist/annotations.d.cts +1 -1
  10. package/dist/annotations.d.ts +1 -1
  11. package/dist/annotations.js +2 -2
  12. package/dist/{area-0-L1bG9B.js → area-BN0uE9R0.js} +4 -3
  13. package/dist/area-BN0uE9R0.js.map +1 -0
  14. package/dist/{area-CJX9219z.d.cts → area-D6LNLk3r.d.cts} +2 -2
  15. package/dist/{area-d11XePuw.d.ts → area-DEFL-Yun.d.ts} +2 -2
  16. package/dist/{area-4eRs3c0K.cjs → area-D_N8b4Ng.cjs} +4 -3
  17. package/dist/area-D_N8b4Ng.cjs.map +1 -0
  18. package/dist/area.cjs +1 -1
  19. package/dist/area.d.cts +1 -1
  20. package/dist/area.d.ts +1 -1
  21. package/dist/area.js +1 -1
  22. package/dist/axis-BzBkkC5X.cjs +305 -0
  23. package/dist/axis-BzBkkC5X.cjs.map +1 -0
  24. package/dist/axis-C5obgdJt.js +240 -0
  25. package/dist/axis-C5obgdJt.js.map +1 -0
  26. package/dist/{bar-Da6dE_nI.cjs → bar-BrmfXugT.cjs} +77 -58
  27. package/dist/bar-BrmfXugT.cjs.map +1 -0
  28. package/dist/{bar-XwzM6Pb0.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
  29. package/dist/{bar-BDLR4p9c.d.cts → bar-CEt8YRxf.d.cts} +2 -2
  30. package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
  31. package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
  32. package/dist/{bar-BNZ3GhIw.js → bar-D_KKd2fL.js} +75 -56
  33. package/dist/bar-D_KKd2fL.js.map +1 -0
  34. package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
  35. package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
  36. package/dist/bar.cjs +1 -1
  37. package/dist/bar.d.cts +1 -1
  38. package/dist/bar.d.ts +1 -1
  39. package/dist/bar.js +1 -1
  40. package/dist/calendar-B7843sQu.d.cts +106 -0
  41. package/dist/calendar-BG_q_NC_.cjs +507 -0
  42. package/dist/calendar-BG_q_NC_.cjs.map +1 -0
  43. package/dist/calendar-CF3gfDQk.js +502 -0
  44. package/dist/calendar-CF3gfDQk.js.map +1 -0
  45. package/dist/calendar-D10_ki1S.d.ts +106 -0
  46. package/dist/calendar.cjs +3 -0
  47. package/dist/calendar.d.cts +3 -0
  48. package/dist/calendar.d.ts +3 -0
  49. package/dist/calendar.js +1 -0
  50. package/dist/{candlestick-BHQkQfxH.js → candlestick-B1onjo1o.js} +17 -14
  51. package/dist/candlestick-B1onjo1o.js.map +1 -0
  52. package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
  53. package/dist/{candlestick-CYCQXgky.cjs → candlestick-BwrFKak_.cjs} +17 -14
  54. package/dist/candlestick-BwrFKak_.cjs.map +1 -0
  55. package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
  56. package/dist/candlestick.cjs +3 -3
  57. package/dist/candlestick.d.cts +1 -1
  58. package/dist/candlestick.d.ts +1 -1
  59. package/dist/candlestick.js +3 -3
  60. package/dist/{cartesian-DV02PsBe.cjs → cartesian-B9CrasFJ.cjs} +190 -310
  61. package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
  62. package/dist/{cartesian-CI2x6N7N.js → cartesian-COglz544.js} +161 -251
  63. package/dist/cartesian-COglz544.js.map +1 -0
  64. package/dist/{chart-DWn9v6qw.js → chart-B97FBRCd.js} +114 -72
  65. package/dist/chart-B97FBRCd.js.map +1 -0
  66. package/dist/{chart-QilhWP8Z.d.ts → chart-CE9EVbfV.d.ts} +427 -112
  67. package/dist/{chart-kqFMEwDo.d.cts → chart-Dz4geQZy.d.cts} +427 -112
  68. package/dist/{chart-e2VqomCI.cjs → chart-GUmmjJ7S.cjs} +132 -78
  69. package/dist/chart-GUmmjJ7S.cjs.map +1 -0
  70. package/dist/{core-BKRQvPAT.js → core-7fgM3su0.js} +188 -73
  71. package/dist/core-7fgM3su0.js.map +1 -0
  72. package/dist/{core-DRUCk67j.d.ts → core-BUQzLsRJ.d.ts} +26 -10
  73. package/dist/{core-DIOC61up.cjs → core-BZTrsPxc.cjs} +200 -73
  74. package/dist/core-BZTrsPxc.cjs.map +1 -0
  75. package/dist/{core-PAX5ogLk.d.cts → core-Ck5uHcW8.d.cts} +45 -24
  76. package/dist/core.cjs +45 -31
  77. package/dist/core.d.cts +23 -18
  78. package/dist/core.d.ts +23 -18
  79. package/dist/core.js +28 -23
  80. package/dist/{dates-DurEr9WT.cjs → dates-0YNY49KQ.cjs} +2 -2
  81. package/dist/{dates-DurEr9WT.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
  82. package/dist/{dates-C2RzY3rE.js → dates-CKDRgpin.js} +2 -2
  83. package/dist/{dates-C2RzY3rE.js.map → dates-CKDRgpin.js.map} +1 -1
  84. package/dist/decimate.cjs +1 -1
  85. package/dist/decimate.js +1 -1
  86. package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
  87. package/dist/dom-C33zvtPo.cjs.map +1 -0
  88. package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
  89. package/dist/dom-CTse6Rvd.js.map +1 -0
  90. package/dist/end-labels-B3oRvjxw.js +114 -0
  91. package/dist/end-labels-B3oRvjxw.js.map +1 -0
  92. package/dist/end-labels-CS-fnpp-.cjs +119 -0
  93. package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
  94. package/dist/end-labels.cjs +11 -0
  95. package/dist/end-labels.cjs.map +1 -0
  96. package/dist/end-labels.d.cts +6 -0
  97. package/dist/end-labels.d.ts +6 -0
  98. package/dist/end-labels.js +11 -0
  99. package/dist/end-labels.js.map +1 -0
  100. package/dist/{export-chart-83UYH48t.js → export-chart-BOH_nfcH.js} +92 -15
  101. package/dist/export-chart-BOH_nfcH.js.map +1 -0
  102. package/dist/{export-chart-mYgEfK-L.cjs → export-chart-Be4T9J3m.cjs} +97 -14
  103. package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
  104. package/dist/export.cjs +5 -3
  105. package/dist/export.cjs.map +1 -1
  106. package/dist/export.d.cts +4 -3
  107. package/dist/export.d.ts +4 -3
  108. package/dist/export.js +5 -4
  109. package/dist/export.js.map +1 -1
  110. package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
  111. package/dist/fade-CDrQjnDz.js.map +1 -0
  112. package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
  113. package/dist/fade-CRqcKMWY.cjs.map +1 -0
  114. package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
  115. package/dist/features-B55rwpQC.js.map +1 -0
  116. package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
  117. package/dist/features-DEDP5CEQ.cjs.map +1 -0
  118. package/dist/fit-BPyPRnsK.js +16 -0
  119. package/dist/fit-BPyPRnsK.js.map +1 -0
  120. package/dist/fit-D4MIIQQz.cjs +21 -0
  121. package/dist/fit-D4MIIQQz.cjs.map +1 -0
  122. package/dist/funnel-B9ridzNx.d.cts +50 -0
  123. package/dist/funnel-CFEEulw_.cjs +244 -0
  124. package/dist/funnel-CFEEulw_.cjs.map +1 -0
  125. package/dist/funnel-CYCv8cq2.js +239 -0
  126. package/dist/funnel-CYCv8cq2.js.map +1 -0
  127. package/dist/funnel-FogM8flk.d.ts +50 -0
  128. package/dist/funnel.cjs +3 -0
  129. package/dist/funnel.d.cts +3 -0
  130. package/dist/funnel.d.ts +3 -0
  131. package/dist/funnel.js +1 -0
  132. package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
  133. package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
  134. package/dist/{gauge-BSist7My.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
  135. package/dist/{gauge-0VJuAHWF.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
  136. package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
  137. package/dist/gauge-DiTk5aWO.js.map +1 -0
  138. package/dist/gauge.cjs +1 -1
  139. package/dist/gauge.d.cts +1 -1
  140. package/dist/gauge.d.ts +1 -1
  141. package/dist/gauge.js +1 -1
  142. package/dist/heat-Bsqq4zw9.js +38 -0
  143. package/dist/heat-Bsqq4zw9.js.map +1 -0
  144. package/dist/heat-DYsivvDq.cjs +49 -0
  145. package/dist/heat-DYsivvDq.cjs.map +1 -0
  146. package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dyzrd4Fd.cjs} +39 -37
  147. package/dist/heatmap-Dyzrd4Fd.cjs.map +1 -0
  148. package/dist/{heatmap-19BGJTKF.js → heatmap-J7fxG7MM.js} +35 -33
  149. package/dist/heatmap-J7fxG7MM.js.map +1 -0
  150. package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
  151. package/dist/{heatmap-59lmClj9.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
  152. package/dist/heatmap.cjs +1 -1
  153. package/dist/heatmap.d.cts +1 -1
  154. package/dist/heatmap.d.ts +1 -1
  155. package/dist/heatmap.js +1 -1
  156. package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
  157. package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
  158. package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
  159. package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
  160. package/dist/hydrate.cjs +2 -2
  161. package/dist/hydrate.js +2 -2
  162. package/dist/index.cjs +69 -45
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.d.cts +24 -19
  165. package/dist/index.d.ts +24 -19
  166. package/dist/index.js +51 -37
  167. package/dist/index.js.map +1 -1
  168. package/dist/interaction-DXYSjgnP.cjs +32 -0
  169. package/dist/interaction-DXYSjgnP.cjs.map +1 -0
  170. package/dist/interaction-En1KlwFO.js +21 -0
  171. package/dist/interaction-En1KlwFO.js.map +1 -0
  172. package/dist/layout-CYerDebD.d.cts +29 -0
  173. package/dist/layout-CYerDebD.d.ts +29 -0
  174. package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
  175. package/dist/layout-Cfg9x1k2.cjs.map +1 -0
  176. package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
  177. package/dist/layout-DqAte3H8.js.map +1 -0
  178. package/dist/{line-DO66LtwH.js → line-CXH0L10d.js} +84 -37
  179. package/dist/line-CXH0L10d.js.map +1 -0
  180. package/dist/{line-_rNdeKmS.d.cts → line-Cu9ctpbv.d.cts} +9 -3
  181. package/dist/{line-Dbt6KFRK.cjs → line-DHbYCQy4.cjs} +84 -37
  182. package/dist/line-DHbYCQy4.cjs.map +1 -0
  183. package/dist/{line-DtSh7HQU.d.ts → line-TkzA7wMK.d.ts} +8 -1
  184. package/dist/line.cjs +3 -3
  185. package/dist/line.d.cts +1 -1
  186. package/dist/line.d.ts +1 -1
  187. package/dist/line.js +3 -3
  188. package/dist/log.cjs +1 -1
  189. package/dist/log.js +1 -1
  190. package/dist/map-BirylCmT.d.cts +156 -0
  191. package/dist/map-CYp6x-uS.js +784 -0
  192. package/dist/map-CYp6x-uS.js.map +1 -0
  193. package/dist/map-ChwSgooH.cjs +795 -0
  194. package/dist/map-ChwSgooH.cjs.map +1 -0
  195. package/dist/map-DNqog2Xs.d.ts +156 -0
  196. package/dist/map.cjs +4 -0
  197. package/dist/map.d.cts +3 -0
  198. package/dist/map.d.ts +3 -0
  199. package/dist/map.js +1 -0
  200. package/dist/maps/world.cjs +875 -0
  201. package/dist/maps/world.cjs.map +1 -0
  202. package/dist/maps/world.d.cts +2 -0
  203. package/dist/maps/world.d.ts +2 -0
  204. package/dist/maps/world.js +874 -0
  205. package/dist/maps/world.js.map +1 -0
  206. package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
  207. package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
  208. package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
  209. package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
  210. package/dist/morph.cjs +2 -2
  211. package/dist/morph.js +2 -2
  212. package/dist/others-CuNdpvjd.d.cts +31 -0
  213. package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
  214. package/dist/others-DBIGE6jr.js.map +1 -0
  215. package/dist/others-DBO4Kjwl.d.ts +29 -0
  216. package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
  217. package/dist/others-WfjCsjqT.cjs.map +1 -0
  218. package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
  219. package/dist/parliament-BKN6ikBJ.js.map +1 -0
  220. package/dist/{parliament-CLCI7tUO.d.ts → parliament-CHdf13XU.d.ts} +2 -2
  221. package/dist/{parliament-CgsVnWEe.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
  222. package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
  223. package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
  224. package/dist/parliament.cjs +1 -1
  225. package/dist/parliament.d.cts +1 -1
  226. package/dist/parliament.d.ts +1 -1
  227. package/dist/parliament.js +1 -1
  228. package/dist/{patterns-D3-wQagb.cjs → patterns-BPN1c9qe.cjs} +2 -2
  229. package/dist/{patterns-D3-wQagb.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
  230. package/dist/{patterns-CufKZYhm.js → patterns-CVrLrJXg.js} +2 -2
  231. package/dist/{patterns-CufKZYhm.js.map → patterns-CVrLrJXg.js.map} +1 -1
  232. package/dist/patterns.cjs +2 -2
  233. package/dist/patterns.d.cts +1 -1
  234. package/dist/patterns.d.ts +1 -1
  235. package/dist/patterns.js +2 -2
  236. package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
  237. package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
  238. package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-CSAbzDOn.d.ts} +11 -15
  239. package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
  240. package/dist/percentage-bar-CaInxrL8.js.map +1 -0
  241. package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-UZHCRvlK.d.cts} +11 -15
  242. package/dist/percentage-bar.cjs +1 -1
  243. package/dist/percentage-bar.d.cts +1 -1
  244. package/dist/percentage-bar.d.ts +1 -1
  245. package/dist/percentage-bar.js +1 -1
  246. package/dist/{pie-BXg2gNpb.d.cts → pie-AFedsDcF.d.cts} +17 -14
  247. package/dist/{pie-CVsc-6qD.js → pie-Ch6Bx0ih.js} +68 -52
  248. package/dist/pie-Ch6Bx0ih.js.map +1 -0
  249. package/dist/{pie-BpjvSPnz.cjs → pie-Cll1OrVZ.cjs} +68 -52
  250. package/dist/pie-Cll1OrVZ.cjs.map +1 -0
  251. package/dist/{pie-CFptILSm.d.ts → pie-Cn2H3pz8.d.ts} +17 -14
  252. package/dist/pie.cjs +1 -1
  253. package/dist/pie.d.cts +1 -1
  254. package/dist/pie.d.ts +1 -1
  255. package/dist/pie.js +1 -1
  256. package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
  257. package/dist/point-shapes-BRawRM78.cjs.map +1 -0
  258. package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
  259. package/dist/point-shapes-DI6GhcI7.js.map +1 -0
  260. package/dist/point-shapes.cjs +6 -4
  261. package/dist/point-shapes.cjs.map +1 -1
  262. package/dist/point-shapes.d.cts +2 -2
  263. package/dist/point-shapes.d.ts +2 -2
  264. package/dist/point-shapes.js +7 -5
  265. package/dist/point-shapes.js.map +1 -1
  266. package/dist/{radar-BR-mumDd.js → radar-Bg-IiIWB.js} +21 -22
  267. package/dist/radar-Bg-IiIWB.js.map +1 -0
  268. package/dist/{radar-BC9Skgpj.d.ts → radar-DEer2jjd.d.ts} +2 -2
  269. package/dist/{radar-D1-lItDy.d.cts → radar-DxmjXhMc.d.cts} +2 -2
  270. package/dist/{radar-HPDrIdzc.cjs → radar-wDyX17S3.cjs} +22 -23
  271. package/dist/radar-wDyX17S3.cjs.map +1 -0
  272. package/dist/radar.cjs +1 -1
  273. package/dist/radar.d.cts +1 -1
  274. package/dist/radar.d.ts +1 -1
  275. package/dist/radar.js +1 -1
  276. package/dist/range-bar-BnKjJP89.cjs +348 -0
  277. package/dist/range-bar-BnKjJP89.cjs.map +1 -0
  278. package/dist/range-bar-C4cRaaQE.d.ts +123 -0
  279. package/dist/range-bar-D32dIQOY.d.cts +123 -0
  280. package/dist/range-bar-Dx6ce0J1.js +343 -0
  281. package/dist/range-bar-Dx6ce0J1.js.map +1 -0
  282. package/dist/range-bar.cjs +3 -0
  283. package/dist/range-bar.d.cts +3 -0
  284. package/dist/range-bar.d.ts +3 -0
  285. package/dist/range-bar.js +1 -0
  286. package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
  287. package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
  288. package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
  289. package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
  290. package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
  291. package/dist/sankey-0CSp_Er9.cjs.map +1 -0
  292. package/dist/{sankey-Dk7jUt8x.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
  293. package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
  294. package/dist/sankey-Dp4CuLVe.js.map +1 -0
  295. package/dist/{sankey-D_v7KxnJ.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
  296. package/dist/sankey.cjs +1 -1
  297. package/dist/sankey.d.cts +1 -1
  298. package/dist/sankey.d.ts +1 -1
  299. package/dist/sankey.js +1 -1
  300. package/dist/{scatter-C0TWjFpW.js → scatter-0Z7K_YUz.js} +94 -46
  301. package/dist/scatter-0Z7K_YUz.js.map +1 -0
  302. package/dist/{scatter-CXEsioOJ.d.ts → scatter-BAL5K9_4.d.ts} +28 -9
  303. package/dist/{scatter-DZeEIfyo.d.cts → scatter-BUGbnRzM.d.cts} +28 -9
  304. package/dist/{scatter-DVqB_fP9.cjs → scatter-CZ8do3Up.cjs} +95 -47
  305. package/dist/scatter-CZ8do3Up.cjs.map +1 -0
  306. package/dist/scatter.cjs +1 -1
  307. package/dist/scatter.d.cts +2 -2
  308. package/dist/scatter.d.ts +2 -2
  309. package/dist/scatter.js +1 -1
  310. package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
  311. package/dist/slice-labels-C9ucsBVW.js +88 -0
  312. package/dist/slice-labels-C9ucsBVW.js.map +1 -0
  313. package/dist/slice-labels-CbFiy46l.cjs +93 -0
  314. package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
  315. package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
  316. package/dist/slice-labels.cjs +11 -0
  317. package/dist/slice-labels.cjs.map +1 -0
  318. package/dist/slice-labels.d.cts +6 -0
  319. package/dist/slice-labels.d.ts +6 -0
  320. package/dist/slice-labels.js +11 -0
  321. package/dist/slice-labels.js.map +1 -0
  322. package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
  323. package/dist/{sparkline-B39NA0Mi.cjs → sparkline-DjR-V6BI.cjs} +13 -15
  324. package/dist/sparkline-DjR-V6BI.cjs.map +1 -0
  325. package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
  326. package/dist/{sparkline-XO_TqCNP.js → sparkline-_dxwtdli.js} +13 -15
  327. package/dist/sparkline-_dxwtdli.js.map +1 -0
  328. package/dist/sparkline.cjs +1 -1
  329. package/dist/sparkline.d.cts +1 -1
  330. package/dist/sparkline.d.ts +1 -1
  331. package/dist/sparkline.js +1 -1
  332. package/dist/{stack-Dagxq7l2.d.cts → stack-CcmyALx0.d.cts} +1 -1
  333. package/dist/{stack-2H2Gfs1Q.js → stack-CyVlS7Fr.js} +2 -2
  334. package/dist/{stack-2H2Gfs1Q.js.map → stack-CyVlS7Fr.js.map} +1 -1
  335. package/dist/{stack-BgPzoQmv.cjs → stack-DBhmYNat.cjs} +2 -2
  336. package/dist/{stack-BgPzoQmv.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
  337. package/dist/style.css +1 -1
  338. package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-CVKjQKSS.cjs} +4 -3
  339. package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
  340. package/dist/{time-axis-FLONo54E.js → time-axis-CkmbAw4Z.js} +3 -2
  341. package/dist/{time-axis-FLONo54E.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
  342. package/dist/time.cjs +3 -3
  343. package/dist/time.js +3 -3
  344. package/dist/{treemap-BAkhmVQc.d.cts → treemap-C2maqerU.d.cts} +37 -5
  345. package/dist/{treemap-BNpxFBao.d.ts → treemap-D_zbubo3.d.ts} +37 -5
  346. package/dist/{treemap-BWpEUlDh.cjs → treemap-PulGXZv0.cjs} +58 -33
  347. package/dist/treemap-PulGXZv0.cjs.map +1 -0
  348. package/dist/{treemap-CQdavQ9u.js → treemap-lbYxb-7h.js} +57 -32
  349. package/dist/treemap-lbYxb-7h.js.map +1 -0
  350. package/dist/treemap.cjs +1 -1
  351. package/dist/treemap.d.cts +1 -1
  352. package/dist/treemap.d.ts +1 -1
  353. package/dist/treemap.js +1 -1
  354. package/dist/{value-labels-BBuSi4i0.js → value-labels-B0VeheyE.js} +29 -8
  355. package/dist/value-labels-B0VeheyE.js.map +1 -0
  356. package/dist/{value-labels-BV9keAuL.cjs → value-labels-Dcyk3GIY.cjs} +29 -8
  357. package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
  358. package/dist/value-labels.cjs +2 -2
  359. package/dist/value-labels.d.cts +1 -1
  360. package/dist/value-labels.d.ts +1 -1
  361. package/dist/value-labels.js +2 -2
  362. package/dist/zoom.cjs +810 -0
  363. package/dist/zoom.cjs.map +1 -0
  364. package/dist/zoom.d.cts +34 -0
  365. package/dist/zoom.d.ts +34 -0
  366. package/dist/zoom.js +806 -0
  367. package/dist/zoom.js.map +1 -0
  368. package/package.json +120 -235
  369. package/dist/annotations-D0YQ0IoA.js.map +0 -1
  370. package/dist/annotations-DdRdeBUB.cjs.map +0 -1
  371. package/dist/area-0-L1bG9B.js.map +0 -1
  372. package/dist/area-4eRs3c0K.cjs.map +0 -1
  373. package/dist/bar-BNZ3GhIw.js.map +0 -1
  374. package/dist/bar-Da6dE_nI.cjs.map +0 -1
  375. package/dist/candlestick-BHQkQfxH.js.map +0 -1
  376. package/dist/candlestick-CYCQXgky.cjs.map +0 -1
  377. package/dist/cartesian-CI2x6N7N.js.map +0 -1
  378. package/dist/cartesian-DV02PsBe.cjs.map +0 -1
  379. package/dist/chart-DWn9v6qw.js.map +0 -1
  380. package/dist/chart-e2VqomCI.cjs.map +0 -1
  381. package/dist/core-BKRQvPAT.js.map +0 -1
  382. package/dist/core-DIOC61up.cjs.map +0 -1
  383. package/dist/dom-CuceR8gt.js.map +0 -1
  384. package/dist/dom-D_g13XWY.cjs.map +0 -1
  385. package/dist/export-chart-83UYH48t.js.map +0 -1
  386. package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
  387. package/dist/fade-DVTkhrFU.cjs.map +0 -1
  388. package/dist/fade-GGxcBdss.js.map +0 -1
  389. package/dist/features-BMxkqCyS.js.map +0 -1
  390. package/dist/features-DCXEvoya.cjs.map +0 -1
  391. package/dist/gauge-DXkjXNCD.cjs.map +0 -1
  392. package/dist/gauge-ts0kqN1-.js.map +0 -1
  393. package/dist/heatmap-19BGJTKF.js.map +0 -1
  394. package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
  395. package/dist/layout-DmrrLjwN.js.map +0 -1
  396. package/dist/layout-JY2aR-yE.cjs.map +0 -1
  397. package/dist/line-DO66LtwH.js.map +0 -1
  398. package/dist/line-Dbt6KFRK.cjs.map +0 -1
  399. package/dist/others-DWdK7vKp.cjs.map +0 -1
  400. package/dist/others-J7NCAMA0.js.map +0 -1
  401. package/dist/parliament-Cru4IcuM.js.map +0 -1
  402. package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
  403. package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
  404. package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
  405. package/dist/pie-BpjvSPnz.cjs.map +0 -1
  406. package/dist/pie-CVsc-6qD.js.map +0 -1
  407. package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
  408. package/dist/point-shapes-DD2Ektzm.js.map +0 -1
  409. package/dist/radar-BR-mumDd.js.map +0 -1
  410. package/dist/radar-HPDrIdzc.cjs.map +0 -1
  411. package/dist/sankey-D6JeZfK5.js.map +0 -1
  412. package/dist/sankey-fCoo1cpz.cjs.map +0 -1
  413. package/dist/scatter-C0TWjFpW.js.map +0 -1
  414. package/dist/scatter-DVqB_fP9.cjs.map +0 -1
  415. package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
  416. package/dist/sparkline-XO_TqCNP.js.map +0 -1
  417. package/dist/treemap-BWpEUlDh.cjs.map +0 -1
  418. package/dist/treemap-CQdavQ9u.js.map +0 -1
  419. package/dist/value-labels-BBuSi4i0.js.map +0 -1
  420. package/dist/value-labels-BV9keAuL.cjs.map +0 -1
@@ -1,5 +1,19 @@
1
- import { o as round } from "./layout-DmrrLjwN.js";
1
+ import { a as chartModel } from "./chart-B97FBRCd.js";
2
+ import { s as round } from "./layout-DqAte3H8.js";
2
3
  // src/export-chart.ts
4
+ /**
5
+ * Export a rendered chart as a standalone SVG or an image, or its data as CSV
6
+ * (`exportSVG()`, `exportImage()`, `exportCSV()`, `downloadChart()` of
7
+ * `@tabler/charts/export`).
8
+ *
9
+ * Charts are styled by CSS, so the export copies the computed styles of
10
+ * every mark into the SVG: the file looks the same anywhere, without the
11
+ * stylesheet or the page's custom properties. Browser only.
12
+ *
13
+ * Kept free of side effects, so `@tabler/charts` can re-export the functions
14
+ * without carrying them into every bundle: the `/export` entry registers the
15
+ * `download` menu's saver on top.
16
+ */
3
17
  const SVG_NS = "http://www.w3.org/2000/svg";
4
18
  /** Properties copied from the computed style, with the values they can be left out at. */
5
19
  const SHAPE = {
@@ -115,13 +129,9 @@ function legendLayer(container) {
115
129
  label.textContent = name.textContent;
116
130
  g.append(dot, label);
117
131
  }
118
- const bottom = legend.getAttribute("data-position") === "bottom";
119
- const margin = Number.parseFloat(getComputedStyle(legend)[bottom ? "marginTop" : "marginBottom"]) || 0;
120
132
  return {
121
133
  svg: g,
122
- height: round(box.height + margin),
123
- margin,
124
- bottom
134
+ box
125
135
  };
126
136
  }
127
137
  /**
@@ -149,18 +159,27 @@ function exportSVG(target, options = {}) {
149
159
  const chartStyle = getComputedStyle(svg);
150
160
  const container = svg.parentElement;
151
161
  const legend = options.legend !== false && container ? legendLayer(container) : void 0;
162
+ let totalWidth = width;
152
163
  let total = height;
153
164
  if (legend) {
165
+ const { box } = legend;
166
+ const at = svg.getBoundingClientRect();
167
+ const left = Math.min(at.left, box.left);
168
+ const top = Math.min(at.top, box.top);
154
169
  const wrap = doc.createElementNS(SVG_NS, "g");
155
170
  wrap.append(...Array.from(copy.childNodes));
156
- if (legend.bottom) legend.svg.setAttribute("transform", `translate(0 ${height + legend.margin})`);
157
- else wrap.setAttribute("transform", `translate(0 ${legend.height})`);
171
+ const move = (el, x, y) => {
172
+ if (x || y) el.setAttribute("transform", `translate(${round(x)} ${round(y)})`);
173
+ };
174
+ move(wrap, at.left - left, at.top - top);
175
+ move(legend.svg, box.left - left, box.top - top);
158
176
  copy.append(wrap, legend.svg);
159
- total = height + legend.height;
177
+ totalWidth = round(Math.max(at.left + width, box.right) - left);
178
+ total = round(Math.max(at.top + height, box.bottom) - top);
160
179
  }
161
- copy.setAttribute("width", String(width));
180
+ copy.setAttribute("width", String(totalWidth));
162
181
  copy.setAttribute("height", String(total));
163
- copy.setAttribute("viewBox", `0 0 ${width} ${total}`);
182
+ copy.setAttribute("viewBox", `0 0 ${totalWidth} ${total}`);
164
183
  const name = svg.getAttribute("aria-label");
165
184
  if (name) {
166
185
  const title = doc.createElementNS(SVG_NS, "title");
@@ -205,8 +224,66 @@ async function exportImage(target, options = {}) {
205
224
  canvas.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("@tabler/charts: could not encode.")), type, quality);
206
225
  });
207
226
  }
227
+ /** The rows of a chart with `{ labels, series }` data, values as they are. */
228
+ function seriesRows(chart) {
229
+ const { config, interaction } = chart;
230
+ const { data, x } = config;
231
+ const series = data?.series;
232
+ if (!interaction || !Array.isArray(series) || !series.every((s) => Array.isArray(s?.values))) return;
233
+ const hits = Array.from({ length: interaction.count }, (_, i) => interaction.hitIndex(i));
234
+ const names = /* @__PURE__ */ new Map();
235
+ for (const hit of hits) for (const item of hit?.items ?? []) names.set(item.seriesIndex, item.name);
236
+ const order = [...names.keys()].sort((a, b) => a - b);
237
+ const rows = [["", ...order.map((index) => names.get(index))]];
238
+ for (const hit of hits) {
239
+ if (!hit) continue;
240
+ const label = data?.labels?.[hit.index];
241
+ const date = label instanceof Date ? label : x?.type === "time" && typeof hit.label === "number" && new Date(hit.label);
242
+ rows.push([date && Number.isFinite(date.getTime()) ? date.toISOString() : String(hit.label), ...order.map((index) => {
243
+ const value = hit.items.find((item) => item.seriesIndex === index)?.value;
244
+ return value == null ? "" : String(value);
245
+ })]);
246
+ }
247
+ return rows;
248
+ }
249
+ /** The rows of any other chart: the text of its data table, every row of it. */
250
+ function tableRows(chart) {
251
+ const { config } = chart;
252
+ const model = chartModel(config);
253
+ const hidden = new Set((config.type.legend?.(model) ?? []).map((item) => item.key).filter((key) => chart.isHidden(key)));
254
+ const table = config.type.table?.(model, {
255
+ locale: config.locale,
256
+ hidden,
257
+ rtl: chart.rtl
258
+ }, Number.POSITIVE_INFINITY);
259
+ if (!table) throw new Error("@tabler/charts: this chart type has no data for a CSV.");
260
+ return [table.columns, ...table.rows];
261
+ }
262
+ /**
263
+ * The chart's data as CSV (RFC 4180): one row per category with a column per
264
+ * visible series, as in the chart's data table but with every row. Line,
265
+ * area, bar, heatmap and radar charts give plain values (numbers without
266
+ * their format, dates in ISO 8601, gaps empty); the other types give the
267
+ * text of their table. Text that a spreadsheet would run as a formula (`=`,
268
+ * `+`, `-` or `@` first) is prefixed with `'`. Takes the rendered chart
269
+ * itself, not its element.
270
+ *
271
+ * ```ts
272
+ * const csv = exportCSV(chart)
273
+ * ```
274
+ */
275
+ function exportCSV(chart, options = {}) {
276
+ if (!chart?.config?.type) throw new Error("@tabler/charts: exportCSV() takes the chart, not its element.");
277
+ const delimiter = options.delimiter ?? ",";
278
+ const cell = (text) => {
279
+ const safe = /^[=+\-@\t\r]/.test(text) && !Number.isFinite(Number(text)) ? `'${text}` : text;
280
+ return safe.includes(delimiter) || /["\r\n]/.test(safe) ? `"${safe.replace(/"/g, "\"\"")}"` : safe;
281
+ };
282
+ return (seriesRows(chart) ?? tableRows(chart)).map((row) => row.map(cell).join(delimiter)).join("\r\n");
283
+ }
208
284
  /**
209
- * Save the chart as a file: PNG by default, or SVG, JPEG or WebP.
285
+ * Save the chart as a file: PNG by default, SVG, JPEG or WebP, or its data
286
+ * as CSV (which needs the chart itself, not its element).
210
287
  *
211
288
  * ```ts
212
289
  * button.onclick = () => downloadChart(chart, { format: 'svg', filename: 'sales' })
@@ -215,7 +292,7 @@ async function exportImage(target, options = {}) {
215
292
  async function downloadChart(target, options = {}) {
216
293
  const { format = "png" } = options;
217
294
  const svg = rootOf(target);
218
- const blob = format === "svg" ? new Blob([exportSVG(target, options)], { type: "image/svg+xml" }) : await exportImage(target, {
295
+ const blob = format === "csv" ? new Blob([`${exportCSV(target, options)}`], { type: "text/csv;charset=utf-8" }) : format === "svg" ? new Blob([exportSVG(target, options)], { type: "image/svg+xml" }) : await exportImage(target, {
219
296
  ...options,
220
297
  type: `image/${format}`
221
298
  });
@@ -226,6 +303,6 @@ async function downloadChart(target, options = {}) {
226
303
  link.click();
227
304
  setTimeout(() => URL.revokeObjectURL(link.href), 1e3);
228
305
  }
229
- export { exportImage as n, exportSVG as r, downloadChart as t };
306
+ export { exportSVG as i, exportCSV as n, exportImage as r, downloadChart as t };
230
307
 
231
- //# sourceMappingURL=export-chart-83UYH48t.js.map
308
+ //# sourceMappingURL=export-chart-BOH_nfcH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-chart-BOH_nfcH.js","names":[],"sources":["../src/export-chart.ts"],"sourcesContent":["/**\n * Export a rendered chart as a standalone SVG or an image, or its data as CSV\n * (`exportSVG()`, `exportImage()`, `exportCSV()`, `downloadChart()` of\n * `@tabler/charts/export`).\n *\n * Charts are styled by CSS, so the export copies the computed styles of\n * every mark into the SVG: the file looks the same anywhere, without the\n * stylesheet or the page's custom properties. Browser only.\n *\n * Kept free of side effects, so `@tabler/charts` can re-export the functions\n * without carrying them into every bundle: the `/export` entry registers the\n * `download` menu's saver on top.\n */\nimport { type Chart, chartModel } from './chart.ts'\nimport { round } from './layout.ts'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\nexport interface ExportOptions {\n /**\n * Background color, `'auto'` for the chart's surface (`--tc-surface`), or\n * `false` for none (transparent). Defaults to `'auto'`.\n */\n background?: string | false\n /** Draw the legend into the image, as the page shows it. Defaults to `true`. */\n legend?: boolean\n}\n\nexport interface ImageOptions extends ExportOptions {\n /** Image type. Defaults to `'image/png'`. */\n type?: 'image/png' | 'image/jpeg' | 'image/webp'\n /** Pixels per chart pixel. Defaults to `2`. */\n scale?: number\n /** Quality of lossy types, `0…1`. */\n quality?: number\n}\n\nexport interface CSVOptions {\n /** Separator of the values. Defaults to `','`. */\n delimiter?: string\n}\n\nexport interface DownloadOptions extends ImageOptions, CSVOptions {\n /** File name without the extension. Defaults to the chart's title, or `chart`. */\n filename?: string\n /** File format. Defaults to `'png'`. */\n format?: 'svg' | 'png' | 'jpeg' | 'webp' | 'csv'\n}\n\n/** A chart, its container, or its root `<svg>`. */\nexport type ExportTarget = Chart<object> | Element\n\n/** Properties copied from the computed style, with the values they can be left out at. */\nconst SHAPE: Record<string, string> = {\n fill: 'rgb(0, 0, 0)',\n 'fill-opacity': '1',\n stroke: 'none',\n 'stroke-width': '1px',\n 'stroke-opacity': '1',\n 'stroke-dasharray': 'none',\n 'stroke-dashoffset': '0px',\n 'stroke-linecap': 'butt',\n 'stroke-linejoin': 'miter',\n 'paint-order': 'normal',\n 'shape-rendering': 'auto',\n 'vector-effect': 'none',\n opacity: '1',\n visibility: 'visible',\n}\nconst TEXT: Record<string, string> = {\n ...SHAPE,\n 'font-family': '',\n 'font-size': '',\n 'font-weight': '400',\n 'font-style': 'normal',\n 'font-variant-numeric': 'normal',\n 'letter-spacing': 'normal',\n}\nconst STOP: Record<string, string> = { 'stop-color': '', 'stop-opacity': '1' }\nconst GROUP: Record<string, string> = { opacity: '1' }\nconst SHAPES = new Set(['path', 'line', 'rect', 'circle', 'ellipse', 'polygon', 'polyline'])\n\nfunction rootOf(target: ExportTarget): SVGSVGElement {\n const el = 'element' in target && !(target instanceof Element) ? target.element : target\n const svg = el.localName === 'svg' ? el : el.querySelector(':scope > svg.tc-chart')\n if (!svg) throw new Error('@tabler/charts: no rendered chart to export.')\n return svg as SVGSVGElement\n}\n\n/** A computed transform as an SVG `transform` attribute, around its origin. */\nfunction transformOf(style: CSSStyleDeclaration): string | undefined {\n const value = style.transform\n if (!value || value === 'none') return undefined\n // Browsers report a matrix; SVG takes the same functions without units.\n const svg = value.replace(/px/g, '')\n if (svg.startsWith('translate')) return svg\n const [ox = 0, oy = 0] = (style.transformOrigin || '0 0').split(' ').map(Number.parseFloat)\n return ox || oy ? `translate(${ox} ${oy}) ${svg} translate(${-ox} ${-oy})` : svg\n}\n\n/** Copy the computed look of `live` onto its clone, recursively. */\nfunction inline(live: Element, copy: Element): boolean {\n const style = getComputedStyle(live)\n if (style.display === 'none') return false\n const tag = live.localName\n const props = tag === 'text' ? TEXT : tag === 'stop' ? STOP : SHAPES.has(tag) ? SHAPE : GROUP\n const declarations: string[] = []\n for (const name in props) {\n const value = style.getPropertyValue(name)\n if (value && value !== props[name]) declarations.push(`${name}:${value}`)\n }\n copy.removeAttribute('style')\n if (declarations.length) copy.setAttribute('style', declarations.join(';'))\n const transform = transformOf(style)\n if (transform) copy.setAttribute('transform', transform)\n\n const liveChildren = Array.from(live.children)\n const copies = Array.from(copy.children)\n liveChildren.forEach((child, i) => {\n const twin = copies[i] as Element\n if (child.classList.contains('tc-hover-layer') || !inline(child, twin)) twin.remove()\n })\n return true\n}\n\n/**\n * The legend as the page lays it out: every entry at its place relative to\n * the legend box, with a swatch (hollow when hidden) and its name.\n */\nfunction legendLayer(container: Element): { svg: Element; box: DOMRect } | undefined {\n const legend = container.querySelector(':scope > .tc-legend')\n const items = legend ? Array.from(legend.querySelectorAll('.tc-legend-item')) : []\n if (!legend || !items.length) return undefined\n const doc = container.ownerDocument\n const patterned = container.querySelector(':scope > svg.tc-patterned')\n const box = legend.getBoundingClientRect()\n const g = doc.createElementNS(SVG_NS, 'g')\n for (const item of items) {\n const swatch = item.querySelector('.tc-legend-swatch')\n const name = item.querySelector('.tc-legend-name')\n if (!swatch || !name) continue\n const s = swatch.getBoundingClientRect()\n const n = name.getBoundingClientRect()\n const color = getComputedStyle(swatch).getPropertyValue('--tc-series-color').trim()\n // A chart that wears its patterns has them in the copied svg: the swatch takes its slot's.\n const slot = /\\btc-series-([1-8])\\b/.exec(item.getAttribute('class') ?? '')?.[1] ?? 'other'\n const fill = patterned\n ? getComputedStyle(patterned).getPropertyValue(`--tc-pattern-${slot}`).trim()\n : ''\n const hidden = item.classList.contains('tc-legend-item-hidden')\n const dot = doc.createElementNS(SVG_NS, 'circle')\n dot.setAttribute('cx', String(round(s.left - box.left + s.width / 2)))\n dot.setAttribute('cy', String(round(s.top - box.top + s.height / 2)))\n dot.setAttribute('r', String(round(s.width / 2 - (hidden ? 0.75 : 0))))\n dot.setAttribute(\n 'style',\n hidden\n ? `fill:none;stroke:${color};stroke-width:1.5px`\n : `fill:${fill.startsWith('url(') ? fill : color}`,\n )\n const text = getComputedStyle(name)\n const label = doc.createElementNS(SVG_NS, 'text')\n label.setAttribute('x', String(round(n.left - box.left)))\n label.setAttribute('y', String(round(n.top - box.top + n.height / 2)))\n label.setAttribute('dy', '0.35em')\n label.setAttribute(\n 'style',\n `fill:${text.color};font-family:${text.fontFamily};font-size:${text.fontSize};font-weight:${text.fontWeight}`,\n )\n label.textContent = name.textContent\n g.append(dot, label)\n }\n return { svg: g, box }\n}\n\n/**\n * The chart as a standalone SVG document: the computed styles are inlined,\n * hover marks left out and running animations finished first.\n *\n * ```ts\n * const svg = exportSVG(chart)\n * ```\n */\nexport function exportSVG(target: ExportTarget, options: ExportOptions = {}): string {\n const svg = rootOf(target)\n // Read the resting state, not a frame in the middle of an entrance or update.\n for (const animation of svg.getAnimations?.({ subtree: true }) ?? []) animation.finish()\n const copy = svg.cloneNode(true) as SVGSVGElement\n inline(svg, copy)\n const doc = svg.ownerDocument\n const width = Number(svg.getAttribute('width'))\n const height = Number(svg.getAttribute('height'))\n copy.setAttribute('xmlns', SVG_NS)\n copy.removeAttribute('class')\n copy.removeAttribute('tabindex')\n copy.removeAttribute('data-resizing')\n copy.removeAttribute('aria-describedby')\n copy.removeAttribute('aria-activedescendant')\n\n const chartStyle = getComputedStyle(svg)\n const container = svg.parentElement\n const legend = options.legend !== false && container ? legendLayer(container) : undefined\n let totalWidth = width\n let total = height\n if (legend) {\n // Chart and legend where the page shows them (above, below or beside),\n // with the gap between them, in one image as large as both.\n const { box } = legend\n const at = svg.getBoundingClientRect()\n const left = Math.min(at.left, box.left)\n const top = Math.min(at.top, box.top)\n const wrap = doc.createElementNS(SVG_NS, 'g')\n wrap.append(...Array.from(copy.childNodes))\n const move = (el: Element, x: number, y: number) => {\n if (x || y) el.setAttribute('transform', `translate(${round(x)} ${round(y)})`)\n }\n move(wrap, at.left - left, at.top - top)\n move(legend.svg, box.left - left, box.top - top)\n copy.append(wrap, legend.svg)\n totalWidth = round(Math.max(at.left + width, box.right) - left)\n total = round(Math.max(at.top + height, box.bottom) - top)\n }\n copy.setAttribute('width', String(totalWidth))\n copy.setAttribute('height', String(total))\n copy.setAttribute('viewBox', `0 0 ${totalWidth} ${total}`)\n\n // A name for the file itself, besides the aria-label.\n const name = svg.getAttribute('aria-label')\n if (name) {\n const title = doc.createElementNS(SVG_NS, 'title')\n title.textContent = name\n copy.prepend(title)\n }\n\n const background =\n options.background === undefined || options.background === 'auto'\n ? chartStyle.getPropertyValue('--tc-surface').trim() || undefined\n : options.background || undefined\n if (background) {\n const rect = doc.createElementNS(SVG_NS, 'rect')\n rect.setAttribute('width', '100%')\n rect.setAttribute('height', '100%')\n rect.setAttribute('fill', background)\n copy.insertBefore(rect, copy.querySelector(':scope > title')?.nextSibling ?? copy.firstChild)\n }\n return new XMLSerializer().serializeToString(copy)\n}\n\n/**\n * The chart as an image (PNG by default), drawn from `exportSVG()` at\n * `scale` pixels per chart pixel.\n *\n * ```ts\n * const blob = await exportImage(chart, { scale: 3 })\n * ```\n */\nexport async function exportImage(target: ExportTarget, options: ImageOptions = {}): Promise<Blob> {\n const { type = 'image/png', scale = 2, quality } = options\n const markup = exportSVG(target, {\n ...options,\n // JPEG has no transparency: without a background it would turn black.\n ...(type === 'image/jpeg' && options.background === false ? { background: '#fff' } : {}),\n })\n const doc = rootOf(target).ownerDocument\n const image = new Image()\n image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`\n await image.decode()\n const canvas = doc.createElement('canvas')\n canvas.width = Math.round(image.width * scale)\n canvas.height = Math.round(image.height * scale)\n const context = canvas.getContext('2d')\n if (!context) throw new Error('@tabler/charts: no 2d canvas to draw the image.')\n context.drawImage(image, 0, 0, canvas.width, canvas.height)\n return new Promise((resolve, reject) => {\n canvas.toBlob(\n (blob) => (blob ? resolve(blob) : reject(new Error('@tabler/charts: could not encode.'))),\n type,\n quality,\n )\n })\n}\n\n/** The rows of a chart with `{ labels, series }` data, values as they are. */\nfunction seriesRows(chart: Chart<object>): string[][] | undefined {\n const { config, interaction } = chart\n const { data, x } = config as {\n data?: { labels?: readonly unknown[]; series?: unknown }\n x?: { type?: string }\n }\n const series = data?.series\n if (!interaction || !Array.isArray(series) || !series.every((s) => Array.isArray(s?.values))) {\n return undefined\n }\n // From the hits, as the tooltip has them: the hidden series are left out.\n const hits = Array.from({ length: interaction.count }, (_, i) => interaction.hitIndex(i))\n const names = new Map<number, string>()\n for (const hit of hits)\n for (const item of hit?.items ?? []) names.set(item.seriesIndex, item.name)\n const order = [...names.keys()].sort((a, b) => a - b)\n const rows = [['', ...order.map((index) => names.get(index) as string)]]\n for (const hit of hits) {\n if (!hit) continue\n const label = data?.labels?.[hit.index]\n const date =\n label instanceof Date\n ? label\n : x?.type === 'time' && typeof hit.label === 'number' && new Date(hit.label)\n rows.push([\n date && Number.isFinite(date.getTime()) ? date.toISOString() : String(hit.label),\n ...order.map((index) => {\n const value = hit.items.find((item) => item.seriesIndex === index)?.value\n return value == null ? '' : String(value)\n }),\n ])\n }\n return rows\n}\n\n/** The rows of any other chart: the text of its data table, every row of it. */\nfunction tableRows(chart: Chart<object>): string[][] {\n const { config } = chart\n const model = chartModel(config)\n const hidden = new Set(\n (config.type.legend?.(model) ?? [])\n .map((item) => item.key)\n .filter((key) => chart.isHidden(key)),\n )\n const table = config.type.table?.(\n model,\n { locale: config.locale, hidden, rtl: chart.rtl },\n Number.POSITIVE_INFINITY,\n )\n if (!table) throw new Error('@tabler/charts: this chart type has no data for a CSV.')\n return [table.columns, ...table.rows]\n}\n\n/**\n * The chart's data as CSV (RFC 4180): one row per category with a column per\n * visible series, as in the chart's data table but with every row. Line,\n * area, bar, heatmap and radar charts give plain values (numbers without\n * their format, dates in ISO 8601, gaps empty); the other types give the\n * text of their table. Text that a spreadsheet would run as a formula (`=`,\n * `+`, `-` or `@` first) is prefixed with `'`. Takes the rendered chart\n * itself, not its element.\n *\n * ```ts\n * const csv = exportCSV(chart)\n * ```\n */\nexport function exportCSV(chart: Chart<object>, options: CSVOptions = {}): string {\n if (!chart?.config?.type) {\n throw new Error('@tabler/charts: exportCSV() takes the chart, not its element.')\n }\n const delimiter = options.delimiter ?? ','\n const cell = (text: string): string => {\n // No formulas from the data: only numbers may start with a sign.\n const safe = /^[=+\\-@\\t\\r]/.test(text) && !Number.isFinite(Number(text)) ? `'${text}` : text\n return safe.includes(delimiter) || /[\"\\r\\n]/.test(safe) ? `\"${safe.replace(/\"/g, '\"\"')}\"` : safe\n }\n return (seriesRows(chart) ?? tableRows(chart))\n .map((row) => row.map(cell).join(delimiter))\n .join('\\r\\n')\n}\n\n/**\n * Save the chart as a file: PNG by default, SVG, JPEG or WebP, or its data\n * as CSV (which needs the chart itself, not its element).\n *\n * ```ts\n * button.onclick = () => downloadChart(chart, { format: 'svg', filename: 'sales' })\n * ```\n */\nexport async function downloadChart(\n target: ExportTarget,\n options: DownloadOptions = {},\n): Promise<void> {\n const { format = 'png' } = options\n const svg = rootOf(target)\n const blob =\n format === 'csv'\n ? // With a byte order mark, so spreadsheets read it as UTF-8.\n new Blob([`${exportCSV(target as Chart<object>, options)}`], {\n type: 'text/csv;charset=utf-8',\n })\n : format === 'svg'\n ? new Blob([exportSVG(target, options)], { type: 'image/svg+xml' })\n : await exportImage(target, { ...options, type: `image/${format}` })\n const name = (options.filename ?? svg.getAttribute('aria-label') ?? 'chart')\n .replace(/[\\\\/:*?\"<>|]+/g, '')\n .trim()\n const link = svg.ownerDocument.createElement('a')\n link.href = URL.createObjectURL(blob)\n link.download = `${name || 'chart'}.${format === 'jpeg' ? 'jpg' : format}`\n link.click()\n // Give the browser a moment to start the download before the URL goes.\n setTimeout(() => URL.revokeObjectURL(link.href), 1000)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,SAAS;;AAqCf,MAAM,QAAgC;CACpC,MAAM;CACN,gBAAgB;CAChB,QAAQ;CACR,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,qBAAqB;CACrB,kBAAkB;CAClB,mBAAmB;CACnB,eAAe;CACf,mBAAmB;CACnB,iBAAiB;CACjB,SAAS;CACT,YAAY;AACd;AACA,MAAM,OAA+B;CACnC,GAAG;CACH,eAAe;CACf,aAAa;CACb,eAAe;CACf,cAAc;CACd,wBAAwB;CACxB,kBAAkB;AACpB;AACA,MAAM,OAA+B;CAAE,cAAc;CAAI,gBAAgB;AAAI;AAC7E,MAAM,QAAgC,EAAE,SAAS,IAAI;AACrD,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAU;CAAW;CAAW;AAAU,CAAC;AAE3F,SAAS,OAAO,QAAqC;CACnD,MAAM,KAAK,aAAa,UAAU,EAAE,kBAAkB,WAAW,OAAO,UAAU;CAClF,MAAM,MAAM,GAAG,cAAc,QAAQ,KAAK,GAAG,cAAc,uBAAuB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,KAAK;CACR,MAAM,OAAO,IAAI,cAAc,cAAc,GAAG;CAChD,KAAK,OAAO,IAAI,gBAAgB,IAAI;CACpC,KAAK,WAAW,GAAG,QAAQ,QAAQ,GAAG,WAAW,SAAS,QAAQ;CAClE,KAAK,MAAM;CAEX,iBAAiB,IAAI,gBAAgB,KAAK,IAAI,GAAG,GAAI;AACvD"}
@@ -1,5 +1,19 @@
1
- const require_layout = require("./layout-JY2aR-yE.cjs");
1
+ const require_chart = require("./chart-GUmmjJ7S.cjs");
2
+ const require_layout = require("./layout-Cfg9x1k2.cjs");
2
3
  // src/export-chart.ts
4
+ /**
5
+ * Export a rendered chart as a standalone SVG or an image, or its data as CSV
6
+ * (`exportSVG()`, `exportImage()`, `exportCSV()`, `downloadChart()` of
7
+ * `@tabler/charts/export`).
8
+ *
9
+ * Charts are styled by CSS, so the export copies the computed styles of
10
+ * every mark into the SVG: the file looks the same anywhere, without the
11
+ * stylesheet or the page's custom properties. Browser only.
12
+ *
13
+ * Kept free of side effects, so `@tabler/charts` can re-export the functions
14
+ * without carrying them into every bundle: the `/export` entry registers the
15
+ * `download` menu's saver on top.
16
+ */
3
17
  const SVG_NS = "http://www.w3.org/2000/svg";
4
18
  /** Properties copied from the computed style, with the values they can be left out at. */
5
19
  const SHAPE = {
@@ -115,13 +129,9 @@ function legendLayer(container) {
115
129
  label.textContent = name.textContent;
116
130
  g.append(dot, label);
117
131
  }
118
- const bottom = legend.getAttribute("data-position") === "bottom";
119
- const margin = Number.parseFloat(getComputedStyle(legend)[bottom ? "marginTop" : "marginBottom"]) || 0;
120
132
  return {
121
133
  svg: g,
122
- height: require_layout.round(box.height + margin),
123
- margin,
124
- bottom
134
+ box
125
135
  };
126
136
  }
127
137
  /**
@@ -149,18 +159,27 @@ function exportSVG(target, options = {}) {
149
159
  const chartStyle = getComputedStyle(svg);
150
160
  const container = svg.parentElement;
151
161
  const legend = options.legend !== false && container ? legendLayer(container) : void 0;
162
+ let totalWidth = width;
152
163
  let total = height;
153
164
  if (legend) {
165
+ const { box } = legend;
166
+ const at = svg.getBoundingClientRect();
167
+ const left = Math.min(at.left, box.left);
168
+ const top = Math.min(at.top, box.top);
154
169
  const wrap = doc.createElementNS(SVG_NS, "g");
155
170
  wrap.append(...Array.from(copy.childNodes));
156
- if (legend.bottom) legend.svg.setAttribute("transform", `translate(0 ${height + legend.margin})`);
157
- else wrap.setAttribute("transform", `translate(0 ${legend.height})`);
171
+ const move = (el, x, y) => {
172
+ if (x || y) el.setAttribute("transform", `translate(${require_layout.round(x)} ${require_layout.round(y)})`);
173
+ };
174
+ move(wrap, at.left - left, at.top - top);
175
+ move(legend.svg, box.left - left, box.top - top);
158
176
  copy.append(wrap, legend.svg);
159
- total = height + legend.height;
177
+ totalWidth = require_layout.round(Math.max(at.left + width, box.right) - left);
178
+ total = require_layout.round(Math.max(at.top + height, box.bottom) - top);
160
179
  }
161
- copy.setAttribute("width", String(width));
180
+ copy.setAttribute("width", String(totalWidth));
162
181
  copy.setAttribute("height", String(total));
163
- copy.setAttribute("viewBox", `0 0 ${width} ${total}`);
182
+ copy.setAttribute("viewBox", `0 0 ${totalWidth} ${total}`);
164
183
  const name = svg.getAttribute("aria-label");
165
184
  if (name) {
166
185
  const title = doc.createElementNS(SVG_NS, "title");
@@ -205,8 +224,66 @@ async function exportImage(target, options = {}) {
205
224
  canvas.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("@tabler/charts: could not encode.")), type, quality);
206
225
  });
207
226
  }
227
+ /** The rows of a chart with `{ labels, series }` data, values as they are. */
228
+ function seriesRows(chart) {
229
+ const { config, interaction } = chart;
230
+ const { data, x } = config;
231
+ const series = data?.series;
232
+ if (!interaction || !Array.isArray(series) || !series.every((s) => Array.isArray(s?.values))) return;
233
+ const hits = Array.from({ length: interaction.count }, (_, i) => interaction.hitIndex(i));
234
+ const names = /* @__PURE__ */ new Map();
235
+ for (const hit of hits) for (const item of hit?.items ?? []) names.set(item.seriesIndex, item.name);
236
+ const order = [...names.keys()].sort((a, b) => a - b);
237
+ const rows = [["", ...order.map((index) => names.get(index))]];
238
+ for (const hit of hits) {
239
+ if (!hit) continue;
240
+ const label = data?.labels?.[hit.index];
241
+ const date = label instanceof Date ? label : x?.type === "time" && typeof hit.label === "number" && new Date(hit.label);
242
+ rows.push([date && Number.isFinite(date.getTime()) ? date.toISOString() : String(hit.label), ...order.map((index) => {
243
+ const value = hit.items.find((item) => item.seriesIndex === index)?.value;
244
+ return value == null ? "" : String(value);
245
+ })]);
246
+ }
247
+ return rows;
248
+ }
249
+ /** The rows of any other chart: the text of its data table, every row of it. */
250
+ function tableRows(chart) {
251
+ const { config } = chart;
252
+ const model = require_chart.chartModel(config);
253
+ const hidden = new Set((config.type.legend?.(model) ?? []).map((item) => item.key).filter((key) => chart.isHidden(key)));
254
+ const table = config.type.table?.(model, {
255
+ locale: config.locale,
256
+ hidden,
257
+ rtl: chart.rtl
258
+ }, Number.POSITIVE_INFINITY);
259
+ if (!table) throw new Error("@tabler/charts: this chart type has no data for a CSV.");
260
+ return [table.columns, ...table.rows];
261
+ }
262
+ /**
263
+ * The chart's data as CSV (RFC 4180): one row per category with a column per
264
+ * visible series, as in the chart's data table but with every row. Line,
265
+ * area, bar, heatmap and radar charts give plain values (numbers without
266
+ * their format, dates in ISO 8601, gaps empty); the other types give the
267
+ * text of their table. Text that a spreadsheet would run as a formula (`=`,
268
+ * `+`, `-` or `@` first) is prefixed with `'`. Takes the rendered chart
269
+ * itself, not its element.
270
+ *
271
+ * ```ts
272
+ * const csv = exportCSV(chart)
273
+ * ```
274
+ */
275
+ function exportCSV(chart, options = {}) {
276
+ if (!chart?.config?.type) throw new Error("@tabler/charts: exportCSV() takes the chart, not its element.");
277
+ const delimiter = options.delimiter ?? ",";
278
+ const cell = (text) => {
279
+ const safe = /^[=+\-@\t\r]/.test(text) && !Number.isFinite(Number(text)) ? `'${text}` : text;
280
+ return safe.includes(delimiter) || /["\r\n]/.test(safe) ? `"${safe.replace(/"/g, "\"\"")}"` : safe;
281
+ };
282
+ return (seriesRows(chart) ?? tableRows(chart)).map((row) => row.map(cell).join(delimiter)).join("\r\n");
283
+ }
208
284
  /**
209
- * Save the chart as a file: PNG by default, or SVG, JPEG or WebP.
285
+ * Save the chart as a file: PNG by default, SVG, JPEG or WebP, or its data
286
+ * as CSV (which needs the chart itself, not its element).
210
287
  *
211
288
  * ```ts
212
289
  * button.onclick = () => downloadChart(chart, { format: 'svg', filename: 'sales' })
@@ -215,7 +292,7 @@ async function exportImage(target, options = {}) {
215
292
  async function downloadChart(target, options = {}) {
216
293
  const { format = "png" } = options;
217
294
  const svg = rootOf(target);
218
- const blob = format === "svg" ? new Blob([exportSVG(target, options)], { type: "image/svg+xml" }) : await exportImage(target, {
295
+ const blob = format === "csv" ? new Blob([`${exportCSV(target, options)}`], { type: "text/csv;charset=utf-8" }) : format === "svg" ? new Blob([exportSVG(target, options)], { type: "image/svg+xml" }) : await exportImage(target, {
219
296
  ...options,
220
297
  type: `image/${format}`
221
298
  });
@@ -232,6 +309,12 @@ Object.defineProperty(exports, "downloadChart", {
232
309
  return downloadChart;
233
310
  }
234
311
  });
312
+ Object.defineProperty(exports, "exportCSV", {
313
+ enumerable: true,
314
+ get: function() {
315
+ return exportCSV;
316
+ }
317
+ });
235
318
  Object.defineProperty(exports, "exportImage", {
236
319
  enumerable: true,
237
320
  get: function() {
@@ -245,4 +328,4 @@ Object.defineProperty(exports, "exportSVG", {
245
328
  }
246
329
  });
247
330
 
248
- //# sourceMappingURL=export-chart-mYgEfK-L.cjs.map
331
+ //# sourceMappingURL=export-chart-Be4T9J3m.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-chart-Be4T9J3m.cjs","names":["round","chartModel"],"sources":["../src/export-chart.ts"],"sourcesContent":["/**\n * Export a rendered chart as a standalone SVG or an image, or its data as CSV\n * (`exportSVG()`, `exportImage()`, `exportCSV()`, `downloadChart()` of\n * `@tabler/charts/export`).\n *\n * Charts are styled by CSS, so the export copies the computed styles of\n * every mark into the SVG: the file looks the same anywhere, without the\n * stylesheet or the page's custom properties. Browser only.\n *\n * Kept free of side effects, so `@tabler/charts` can re-export the functions\n * without carrying them into every bundle: the `/export` entry registers the\n * `download` menu's saver on top.\n */\nimport { type Chart, chartModel } from './chart.ts'\nimport { round } from './layout.ts'\n\nconst SVG_NS = 'http://www.w3.org/2000/svg'\n\nexport interface ExportOptions {\n /**\n * Background color, `'auto'` for the chart's surface (`--tc-surface`), or\n * `false` for none (transparent). Defaults to `'auto'`.\n */\n background?: string | false\n /** Draw the legend into the image, as the page shows it. Defaults to `true`. */\n legend?: boolean\n}\n\nexport interface ImageOptions extends ExportOptions {\n /** Image type. Defaults to `'image/png'`. */\n type?: 'image/png' | 'image/jpeg' | 'image/webp'\n /** Pixels per chart pixel. Defaults to `2`. */\n scale?: number\n /** Quality of lossy types, `0…1`. */\n quality?: number\n}\n\nexport interface CSVOptions {\n /** Separator of the values. Defaults to `','`. */\n delimiter?: string\n}\n\nexport interface DownloadOptions extends ImageOptions, CSVOptions {\n /** File name without the extension. Defaults to the chart's title, or `chart`. */\n filename?: string\n /** File format. Defaults to `'png'`. */\n format?: 'svg' | 'png' | 'jpeg' | 'webp' | 'csv'\n}\n\n/** A chart, its container, or its root `<svg>`. */\nexport type ExportTarget = Chart<object> | Element\n\n/** Properties copied from the computed style, with the values they can be left out at. */\nconst SHAPE: Record<string, string> = {\n fill: 'rgb(0, 0, 0)',\n 'fill-opacity': '1',\n stroke: 'none',\n 'stroke-width': '1px',\n 'stroke-opacity': '1',\n 'stroke-dasharray': 'none',\n 'stroke-dashoffset': '0px',\n 'stroke-linecap': 'butt',\n 'stroke-linejoin': 'miter',\n 'paint-order': 'normal',\n 'shape-rendering': 'auto',\n 'vector-effect': 'none',\n opacity: '1',\n visibility: 'visible',\n}\nconst TEXT: Record<string, string> = {\n ...SHAPE,\n 'font-family': '',\n 'font-size': '',\n 'font-weight': '400',\n 'font-style': 'normal',\n 'font-variant-numeric': 'normal',\n 'letter-spacing': 'normal',\n}\nconst STOP: Record<string, string> = { 'stop-color': '', 'stop-opacity': '1' }\nconst GROUP: Record<string, string> = { opacity: '1' }\nconst SHAPES = new Set(['path', 'line', 'rect', 'circle', 'ellipse', 'polygon', 'polyline'])\n\nfunction rootOf(target: ExportTarget): SVGSVGElement {\n const el = 'element' in target && !(target instanceof Element) ? target.element : target\n const svg = el.localName === 'svg' ? el : el.querySelector(':scope > svg.tc-chart')\n if (!svg) throw new Error('@tabler/charts: no rendered chart to export.')\n return svg as SVGSVGElement\n}\n\n/** A computed transform as an SVG `transform` attribute, around its origin. */\nfunction transformOf(style: CSSStyleDeclaration): string | undefined {\n const value = style.transform\n if (!value || value === 'none') return undefined\n // Browsers report a matrix; SVG takes the same functions without units.\n const svg = value.replace(/px/g, '')\n if (svg.startsWith('translate')) return svg\n const [ox = 0, oy = 0] = (style.transformOrigin || '0 0').split(' ').map(Number.parseFloat)\n return ox || oy ? `translate(${ox} ${oy}) ${svg} translate(${-ox} ${-oy})` : svg\n}\n\n/** Copy the computed look of `live` onto its clone, recursively. */\nfunction inline(live: Element, copy: Element): boolean {\n const style = getComputedStyle(live)\n if (style.display === 'none') return false\n const tag = live.localName\n const props = tag === 'text' ? TEXT : tag === 'stop' ? STOP : SHAPES.has(tag) ? SHAPE : GROUP\n const declarations: string[] = []\n for (const name in props) {\n const value = style.getPropertyValue(name)\n if (value && value !== props[name]) declarations.push(`${name}:${value}`)\n }\n copy.removeAttribute('style')\n if (declarations.length) copy.setAttribute('style', declarations.join(';'))\n const transform = transformOf(style)\n if (transform) copy.setAttribute('transform', transform)\n\n const liveChildren = Array.from(live.children)\n const copies = Array.from(copy.children)\n liveChildren.forEach((child, i) => {\n const twin = copies[i] as Element\n if (child.classList.contains('tc-hover-layer') || !inline(child, twin)) twin.remove()\n })\n return true\n}\n\n/**\n * The legend as the page lays it out: every entry at its place relative to\n * the legend box, with a swatch (hollow when hidden) and its name.\n */\nfunction legendLayer(container: Element): { svg: Element; box: DOMRect } | undefined {\n const legend = container.querySelector(':scope > .tc-legend')\n const items = legend ? Array.from(legend.querySelectorAll('.tc-legend-item')) : []\n if (!legend || !items.length) return undefined\n const doc = container.ownerDocument\n const patterned = container.querySelector(':scope > svg.tc-patterned')\n const box = legend.getBoundingClientRect()\n const g = doc.createElementNS(SVG_NS, 'g')\n for (const item of items) {\n const swatch = item.querySelector('.tc-legend-swatch')\n const name = item.querySelector('.tc-legend-name')\n if (!swatch || !name) continue\n const s = swatch.getBoundingClientRect()\n const n = name.getBoundingClientRect()\n const color = getComputedStyle(swatch).getPropertyValue('--tc-series-color').trim()\n // A chart that wears its patterns has them in the copied svg: the swatch takes its slot's.\n const slot = /\\btc-series-([1-8])\\b/.exec(item.getAttribute('class') ?? '')?.[1] ?? 'other'\n const fill = patterned\n ? getComputedStyle(patterned).getPropertyValue(`--tc-pattern-${slot}`).trim()\n : ''\n const hidden = item.classList.contains('tc-legend-item-hidden')\n const dot = doc.createElementNS(SVG_NS, 'circle')\n dot.setAttribute('cx', String(round(s.left - box.left + s.width / 2)))\n dot.setAttribute('cy', String(round(s.top - box.top + s.height / 2)))\n dot.setAttribute('r', String(round(s.width / 2 - (hidden ? 0.75 : 0))))\n dot.setAttribute(\n 'style',\n hidden\n ? `fill:none;stroke:${color};stroke-width:1.5px`\n : `fill:${fill.startsWith('url(') ? fill : color}`,\n )\n const text = getComputedStyle(name)\n const label = doc.createElementNS(SVG_NS, 'text')\n label.setAttribute('x', String(round(n.left - box.left)))\n label.setAttribute('y', String(round(n.top - box.top + n.height / 2)))\n label.setAttribute('dy', '0.35em')\n label.setAttribute(\n 'style',\n `fill:${text.color};font-family:${text.fontFamily};font-size:${text.fontSize};font-weight:${text.fontWeight}`,\n )\n label.textContent = name.textContent\n g.append(dot, label)\n }\n return { svg: g, box }\n}\n\n/**\n * The chart as a standalone SVG document: the computed styles are inlined,\n * hover marks left out and running animations finished first.\n *\n * ```ts\n * const svg = exportSVG(chart)\n * ```\n */\nexport function exportSVG(target: ExportTarget, options: ExportOptions = {}): string {\n const svg = rootOf(target)\n // Read the resting state, not a frame in the middle of an entrance or update.\n for (const animation of svg.getAnimations?.({ subtree: true }) ?? []) animation.finish()\n const copy = svg.cloneNode(true) as SVGSVGElement\n inline(svg, copy)\n const doc = svg.ownerDocument\n const width = Number(svg.getAttribute('width'))\n const height = Number(svg.getAttribute('height'))\n copy.setAttribute('xmlns', SVG_NS)\n copy.removeAttribute('class')\n copy.removeAttribute('tabindex')\n copy.removeAttribute('data-resizing')\n copy.removeAttribute('aria-describedby')\n copy.removeAttribute('aria-activedescendant')\n\n const chartStyle = getComputedStyle(svg)\n const container = svg.parentElement\n const legend = options.legend !== false && container ? legendLayer(container) : undefined\n let totalWidth = width\n let total = height\n if (legend) {\n // Chart and legend where the page shows them (above, below or beside),\n // with the gap between them, in one image as large as both.\n const { box } = legend\n const at = svg.getBoundingClientRect()\n const left = Math.min(at.left, box.left)\n const top = Math.min(at.top, box.top)\n const wrap = doc.createElementNS(SVG_NS, 'g')\n wrap.append(...Array.from(copy.childNodes))\n const move = (el: Element, x: number, y: number) => {\n if (x || y) el.setAttribute('transform', `translate(${round(x)} ${round(y)})`)\n }\n move(wrap, at.left - left, at.top - top)\n move(legend.svg, box.left - left, box.top - top)\n copy.append(wrap, legend.svg)\n totalWidth = round(Math.max(at.left + width, box.right) - left)\n total = round(Math.max(at.top + height, box.bottom) - top)\n }\n copy.setAttribute('width', String(totalWidth))\n copy.setAttribute('height', String(total))\n copy.setAttribute('viewBox', `0 0 ${totalWidth} ${total}`)\n\n // A name for the file itself, besides the aria-label.\n const name = svg.getAttribute('aria-label')\n if (name) {\n const title = doc.createElementNS(SVG_NS, 'title')\n title.textContent = name\n copy.prepend(title)\n }\n\n const background =\n options.background === undefined || options.background === 'auto'\n ? chartStyle.getPropertyValue('--tc-surface').trim() || undefined\n : options.background || undefined\n if (background) {\n const rect = doc.createElementNS(SVG_NS, 'rect')\n rect.setAttribute('width', '100%')\n rect.setAttribute('height', '100%')\n rect.setAttribute('fill', background)\n copy.insertBefore(rect, copy.querySelector(':scope > title')?.nextSibling ?? copy.firstChild)\n }\n return new XMLSerializer().serializeToString(copy)\n}\n\n/**\n * The chart as an image (PNG by default), drawn from `exportSVG()` at\n * `scale` pixels per chart pixel.\n *\n * ```ts\n * const blob = await exportImage(chart, { scale: 3 })\n * ```\n */\nexport async function exportImage(target: ExportTarget, options: ImageOptions = {}): Promise<Blob> {\n const { type = 'image/png', scale = 2, quality } = options\n const markup = exportSVG(target, {\n ...options,\n // JPEG has no transparency: without a background it would turn black.\n ...(type === 'image/jpeg' && options.background === false ? { background: '#fff' } : {}),\n })\n const doc = rootOf(target).ownerDocument\n const image = new Image()\n image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`\n await image.decode()\n const canvas = doc.createElement('canvas')\n canvas.width = Math.round(image.width * scale)\n canvas.height = Math.round(image.height * scale)\n const context = canvas.getContext('2d')\n if (!context) throw new Error('@tabler/charts: no 2d canvas to draw the image.')\n context.drawImage(image, 0, 0, canvas.width, canvas.height)\n return new Promise((resolve, reject) => {\n canvas.toBlob(\n (blob) => (blob ? resolve(blob) : reject(new Error('@tabler/charts: could not encode.'))),\n type,\n quality,\n )\n })\n}\n\n/** The rows of a chart with `{ labels, series }` data, values as they are. */\nfunction seriesRows(chart: Chart<object>): string[][] | undefined {\n const { config, interaction } = chart\n const { data, x } = config as {\n data?: { labels?: readonly unknown[]; series?: unknown }\n x?: { type?: string }\n }\n const series = data?.series\n if (!interaction || !Array.isArray(series) || !series.every((s) => Array.isArray(s?.values))) {\n return undefined\n }\n // From the hits, as the tooltip has them: the hidden series are left out.\n const hits = Array.from({ length: interaction.count }, (_, i) => interaction.hitIndex(i))\n const names = new Map<number, string>()\n for (const hit of hits)\n for (const item of hit?.items ?? []) names.set(item.seriesIndex, item.name)\n const order = [...names.keys()].sort((a, b) => a - b)\n const rows = [['', ...order.map((index) => names.get(index) as string)]]\n for (const hit of hits) {\n if (!hit) continue\n const label = data?.labels?.[hit.index]\n const date =\n label instanceof Date\n ? label\n : x?.type === 'time' && typeof hit.label === 'number' && new Date(hit.label)\n rows.push([\n date && Number.isFinite(date.getTime()) ? date.toISOString() : String(hit.label),\n ...order.map((index) => {\n const value = hit.items.find((item) => item.seriesIndex === index)?.value\n return value == null ? '' : String(value)\n }),\n ])\n }\n return rows\n}\n\n/** The rows of any other chart: the text of its data table, every row of it. */\nfunction tableRows(chart: Chart<object>): string[][] {\n const { config } = chart\n const model = chartModel(config)\n const hidden = new Set(\n (config.type.legend?.(model) ?? [])\n .map((item) => item.key)\n .filter((key) => chart.isHidden(key)),\n )\n const table = config.type.table?.(\n model,\n { locale: config.locale, hidden, rtl: chart.rtl },\n Number.POSITIVE_INFINITY,\n )\n if (!table) throw new Error('@tabler/charts: this chart type has no data for a CSV.')\n return [table.columns, ...table.rows]\n}\n\n/**\n * The chart's data as CSV (RFC 4180): one row per category with a column per\n * visible series, as in the chart's data table but with every row. Line,\n * area, bar, heatmap and radar charts give plain values (numbers without\n * their format, dates in ISO 8601, gaps empty); the other types give the\n * text of their table. Text that a spreadsheet would run as a formula (`=`,\n * `+`, `-` or `@` first) is prefixed with `'`. Takes the rendered chart\n * itself, not its element.\n *\n * ```ts\n * const csv = exportCSV(chart)\n * ```\n */\nexport function exportCSV(chart: Chart<object>, options: CSVOptions = {}): string {\n if (!chart?.config?.type) {\n throw new Error('@tabler/charts: exportCSV() takes the chart, not its element.')\n }\n const delimiter = options.delimiter ?? ','\n const cell = (text: string): string => {\n // No formulas from the data: only numbers may start with a sign.\n const safe = /^[=+\\-@\\t\\r]/.test(text) && !Number.isFinite(Number(text)) ? `'${text}` : text\n return safe.includes(delimiter) || /[\"\\r\\n]/.test(safe) ? `\"${safe.replace(/\"/g, '\"\"')}\"` : safe\n }\n return (seriesRows(chart) ?? tableRows(chart))\n .map((row) => row.map(cell).join(delimiter))\n .join('\\r\\n')\n}\n\n/**\n * Save the chart as a file: PNG by default, SVG, JPEG or WebP, or its data\n * as CSV (which needs the chart itself, not its element).\n *\n * ```ts\n * button.onclick = () => downloadChart(chart, { format: 'svg', filename: 'sales' })\n * ```\n */\nexport async function downloadChart(\n target: ExportTarget,\n options: DownloadOptions = {},\n): Promise<void> {\n const { format = 'png' } = options\n const svg = rootOf(target)\n const blob =\n format === 'csv'\n ? // With a byte order mark, so spreadsheets read it as UTF-8.\n new Blob([`${exportCSV(target as Chart<object>, options)}`], {\n type: 'text/csv;charset=utf-8',\n })\n : format === 'svg'\n ? new Blob([exportSVG(target, options)], { type: 'image/svg+xml' })\n : await exportImage(target, { ...options, type: `image/${format}` })\n const name = (options.filename ?? svg.getAttribute('aria-label') ?? 'chart')\n .replace(/[\\\\/:*?\"<>|]+/g, '')\n .trim()\n const link = svg.ownerDocument.createElement('a')\n link.href = URL.createObjectURL(blob)\n link.download = `${name || 'chart'}.${format === 'jpeg' ? 'jpg' : format}`\n link.click()\n // Give the browser a moment to start the download before the URL goes.\n setTimeout(() => URL.revokeObjectURL(link.href), 1000)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,SAAS;;AAqCf,MAAM,QAAgC;CACpC,MAAM;CACN,gBAAgB;CAChB,QAAQ;CACR,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,qBAAqB;CACrB,kBAAkB;CAClB,mBAAmB;CACnB,eAAe;CACf,mBAAmB;CACnB,iBAAiB;CACjB,SAAS;CACT,YAAY;AACd;AACA,MAAM,OAA+B;CACnC,GAAG;CACH,eAAe;CACf,aAAa;CACb,eAAe;CACf,cAAc;CACd,wBAAwB;CACxB,kBAAkB;AACpB;AACA,MAAM,OAA+B;CAAE,cAAc;CAAI,gBAAgB;AAAI;AAC7E,MAAM,QAAgC,EAAE,SAAS,IAAI;AACrD,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAU;CAAW;CAAW;AAAU,CAAC;AAE3F,SAAS,OAAO,QAAqC;CACnD,MAAM,KAAK,aAAa,U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AAgB,CAAC,IAChE,MAAM,YAAY,QAAQ;EAAE,GAAG;EAAS,MAAM,SAAS;CAAS,CAAC;CACzE,MAAM,QAAQ,QAAQ,YAAY,IAAI,aAAa,YAAY,KAAK,QAAA,CACjE,QAAQ,kBAAkB,EAAE,CAAC,CAC7B,KAAK;CACR,MAAM,OAAO,IAAI,cAAc,cAAc,GAAG;CAChD,KAAK,OAAO,IAAI,gBAAgB,IAAI;CACpC,KAAK,WAAW,GAAG,QAAQ,QAAQ,GAAG,WAAW,SAAS,QAAQ;CAClE,KAAK,MAAM;CAEX,iBAAiB,IAAI,gBAAgB,KAAK,IAAI,GAAG,GAAI;AACvD"}
package/dist/export.cjs CHANGED
@@ -1,15 +1,17 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_export_chart = require("./export-chart-mYgEfK-L.cjs");
2
+ const require_export_chart = require("./export-chart-Be4T9J3m.cjs");
3
3
  // src/export.ts
4
4
  /**
5
5
  * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`
6
- * saves a rendered chart as a standalone SVG or an image. Importing it also
6
+ * saves a rendered chart as a standalone SVG or an image, and `exportCSV`
7
+ * gives its data as CSV. Importing it also
7
8
  * enables the `download` option (a menu on the chart that saves it): with the
8
9
  * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the
9
10
  * plugin installed on the core.
10
11
  */
11
- require("./features-DCXEvoya.cjs").register({ export: require_export_chart.downloadChart });
12
+ require("./features-DEDP5CEQ.cjs").register({ export: require_export_chart.downloadChart });
12
13
  exports.downloadChart = require_export_chart.downloadChart;
14
+ exports.exportCSV = require_export_chart.exportCSV;
13
15
  exports.exportImage = require_export_chart.exportImage;
14
16
  exports.exportSVG = require_export_chart.exportSVG;
15
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"export.cjs","names":["register","downloadChart"],"sources":["../src/export.ts"],"sourcesContent":["/**\n * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`\n * saves a rendered chart as a standalone SVG or an image. Importing it also\n * enables the `download` option (a menu on the chart that saves it): with the\n * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the\n * plugin installed on the core.\n */\nimport { downloadChart, exportImage, exportSVG } from './export-chart.ts'\nimport { register } from './features.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({ export: downloadChart })\n\nexport type {\n DownloadOptions,\n ExportOptions,\n ExportTarget,\n ImageOptions,\n} from './export-chart.ts'\nexport { downloadChart, exportImage, exportSVG }\n"],"mappings":";;;;;;;;;;A,iCAWAA,CAAAA,CAAAA,SAAS,EAAE,QAAQC,qBAAAA,cAAc,CAAC"}
1
+ {"version":3,"file":"export.cjs","names":["register","downloadChart"],"sources":["../src/export.ts"],"sourcesContent":["/**\n * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`\n * saves a rendered chart as a standalone SVG or an image, and `exportCSV`\n * gives its data as CSV. Importing it also\n * enables the `download` option (a menu on the chart that saves it): with the\n * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the\n * plugin installed on the core.\n */\nimport { downloadChart, exportCSV, exportImage, exportSVG } from './export-chart.ts'\nimport { register } from './features.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({ export: downloadChart })\n\nexport type {\n CSVOptions,\n DownloadOptions,\n ExportOptions,\n ExportTarget,\n ImageOptions,\n} from './export-chart.ts'\nexport { downloadChart, exportCSV, exportImage, exportSVG }\n"],"mappings":";;;;;;;;;;;A,iCAYAA,CAAAA,CAAAA,SAAS,EAAE,QAAQC,qBAAAA,cAAc,CAAC"}
package/dist/export.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`
3
- * saves a rendered chart as a standalone SVG or an image. Importing it also
3
+ * saves a rendered chart as a standalone SVG or an image, and `exportCSV`
4
+ * gives its data as CSV. Importing it also
4
5
  * enables the `download` option (a menu on the chart that saves it): with the
5
6
  * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the
6
7
  * plugin installed on the core.
7
8
  */
8
- import { B as DownloadOptions, G as exportImage, H as ExportTarget, K as exportSVG, U as ImageOptions, V as ExportOptions, W as downloadChart } from "./chart-kqFMEwDo.cjs";
9
- export { type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportImage, exportSVG };
9
+ import { $ as exportCSV, J as DownloadOptions, Q as downloadChart, X as ExportTarget, Y as ExportOptions, Z as ImageOptions, et as exportImage, q as CSVOptions, tt as exportSVG } from "./chart-Dz4geQZy.cjs";
10
+ export { type CSVOptions, type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportCSV, exportImage, exportSVG };
package/dist/export.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`
3
- * saves a rendered chart as a standalone SVG or an image. Importing it also
3
+ * saves a rendered chart as a standalone SVG or an image, and `exportCSV`
4
+ * gives its data as CSV. Importing it also
4
5
  * enables the `download` option (a menu on the chart that saves it): with the
5
6
  * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the
6
7
  * plugin installed on the core.
7
8
  */
8
- import { B as downloadChart, H as exportSVG, I as DownloadOptions, L as ExportOptions, R as ExportTarget, V as exportImage, z as ImageOptions } from "./chart-QilhWP8Z.js";
9
- export { type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportImage, exportSVG };
9
+ import { G as ExportOptions, J as downloadChart, K as ExportTarget, U as CSVOptions, W as DownloadOptions, X as exportImage, Y as exportCSV, Z as exportSVG, q as ImageOptions } from "./chart-CE9EVbfV.js";
10
+ export { type CSVOptions, type DownloadOptions, type ExportOptions, type ExportTarget, type ImageOptions, downloadChart, exportCSV, exportImage, exportSVG };
package/dist/export.js CHANGED
@@ -1,14 +1,15 @@
1
- import { n as exportImage, r as exportSVG, t as downloadChart } from "./export-chart-83UYH48t.js";
2
- import { i as register } from "./features-BMxkqCyS.js";
1
+ import { i as exportSVG, n as exportCSV, r as exportImage, t as downloadChart } from "./export-chart-BOH_nfcH.js";
2
+ import { i as register } from "./features-B55rwpQC.js";
3
3
  // src/export.ts
4
4
  /**
5
5
  * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`
6
- * saves a rendered chart as a standalone SVG or an image. Importing it also
6
+ * saves a rendered chart as a standalone SVG or an image, and `exportCSV`
7
+ * gives its data as CSV. Importing it also
7
8
  * enables the `download` option (a menu on the chart that saves it): with the
8
9
  * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the
9
10
  * plugin installed on the core.
10
11
  */
11
12
  register({ export: downloadChart });
12
- export { downloadChart, exportImage, exportSVG };
13
+ export { downloadChart, exportCSV, exportImage, exportSVG };
13
14
 
14
15
  //# sourceMappingURL=export.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","names":[],"sources":["../src/export.ts"],"sourcesContent":["/**\n * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`\n * saves a rendered chart as a standalone SVG or an image. Importing it also\n * enables the `download` option (a menu on the chart that saves it): with the\n * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the\n * plugin installed on the core.\n */\nimport { downloadChart, exportImage, exportSVG } from './export-chart.ts'\nimport { register } from './features.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({ export: downloadChart })\n\nexport type {\n DownloadOptions,\n ExportOptions,\n ExportTarget,\n ImageOptions,\n} from './export-chart.ts'\nexport { downloadChart, exportImage, exportSVG }\n"],"mappings":";;;;;;;;;;AAWA,SAAS,EAAE,QAAQ,cAAc,CAAC"}
1
+ {"version":3,"file":"export.js","names":[],"sources":["../src/export.ts"],"sourcesContent":["/**\n * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`\n * saves a rendered chart as a standalone SVG or an image, and `exportCSV`\n * gives its data as CSV. Importing it also\n * enables the `download` option (a menu on the chart that saves it): with the\n * `Chart` of `@tabler/charts`, which has the `download()` plugin, or with the\n * plugin installed on the core.\n */\nimport { downloadChart, exportCSV, exportImage, exportSVG } from './export-chart.ts'\nimport { register } from './features.ts'\n\n// Registered here, in the entry itself, so no bundler can shake it away.\nregister({ export: downloadChart })\n\nexport type {\n CSVOptions,\n DownloadOptions,\n ExportOptions,\n ExportTarget,\n ImageOptions,\n} from './export-chart.ts'\nexport { downloadChart, exportCSV, exportImage, exportSVG }\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,EAAE,QAAQ,cAAc,CAAC"}