@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,99 +1,68 @@
1
1
  import { t as h } from "./vnode-_EMUqysL.js";
2
2
  // src/shapes/path.ts
3
- /** Accumulates SVG path commands with rounded coordinates. */
4
- var PathBuilder = class {
5
- d = "";
6
- #k;
7
- constructor(precision) {
8
- this.#k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)));
9
- }
10
- #n(value) {
11
- const rounded = Math.round(value * this.#k) / this.#k;
12
- return String(rounded === 0 ? 0 : rounded);
13
- }
14
- #xy(x, y) {
15
- return `${this.#n(x)},${this.#n(y)}`;
16
- }
17
- moveTo(x, y) {
18
- this.d += `M${this.#xy(x, y)}`;
19
- }
20
- lineTo(x, y) {
21
- this.d += `L${this.#xy(x, y)}`;
22
- }
23
- curveTo(x1, y1, x2, y2, x, y) {
24
- this.d += `C${this.#xy(x1, y1)},${this.#xy(x2, y2)},${this.#xy(x, y)}`;
25
- }
26
- close() {
27
- this.d += "Z";
28
- }
29
- };
3
+ function pair(precision) {
4
+ const k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)));
5
+ const n = (value) => Math.round(value * k) / k || 0;
6
+ return (x, y) => `${n(x)},${n(y)}`;
7
+ }
8
+ /** Monotone tangents break on zero-length segments, so coincident points are dropped. */
9
+ const prepare = (input, curve) => curve === "monotone" ? dedupe(input) : input;
30
10
  /**
31
- * Emit `points` with a curve. The first point is a `moveTo` when `move` is
32
- * true, otherwise a `lineTo` (continuing an existing subpath). Returns the
33
- * number of points drawn.
11
+ * Path commands through `points` with a curve. The first point is a move
12
+ * when `move` is true, otherwise a line (continuing an existing subpath).
34
13
  */
35
- function emit(path, input, curve, move) {
36
- const points = curve === "monotone" ? dedupe(input) : input;
14
+ function emit(xy, points, curve, move) {
37
15
  const first = points[0];
38
- if (!first) return 0;
39
- if (move) path.moveTo(first[0], first[1]);
40
- else path.lineTo(first[0], first[1]);
41
- switch (curve) {
42
- case "monotone":
43
- monotone(path, points);
44
- break;
45
- case "step":
46
- step(path, points, .5);
47
- break;
48
- case "step-before":
49
- step(path, points, 0);
50
- break;
51
- case "step-after":
52
- step(path, points, 1);
53
- break;
54
- default: for (let i = 1; i < points.length; i++) {
55
- const p = points[i];
56
- path.lineTo(p[0], p[1]);
57
- }
16
+ if (!first) return "";
17
+ const start = (move ? "M" : "L") + xy(first[0], first[1]);
18
+ if (curve === "monotone") return start + monotone(xy, points);
19
+ const t = STEPS[curve];
20
+ if (t !== void 0) return start + step(xy, points, t);
21
+ let d = start;
22
+ for (let i = 1; i < points.length; i++) {
23
+ const p = points[i];
24
+ d += `L${xy(p[0], p[1])}`;
58
25
  }
59
- return points.length;
26
+ return d;
60
27
  }
28
+ /** Where a step curve turns between two points, as a share of the way. */
29
+ const STEPS = {
30
+ step: .5,
31
+ "step-before": 0,
32
+ "step-after": 1
33
+ };
61
34
  function dedupe(points) {
62
35
  return points.filter((p, i) => {
63
36
  const prev = points[i - 1];
64
37
  return !prev || p[0] !== prev[0] || p[1] !== prev[1];
65
38
  });
66
39
  }
67
- function step(path, points, t) {
40
+ function step(xy, points, t) {
41
+ let d = "";
68
42
  for (let i = 1; i < points.length; i++) {
69
43
  const [x0, y0] = points[i - 1];
70
44
  const [x1, y1] = points[i];
71
- if (t <= 0) {
72
- path.lineTo(x0, y1);
73
- path.lineTo(x1, y1);
74
- } else if (t >= 1) {
75
- path.lineTo(x1, y0);
76
- path.lineTo(x1, y1);
77
- } else {
45
+ if (t <= 0) d += `L${xy(x0, y1)}L${xy(x1, y1)}`;
46
+ else if (t >= 1) d += `L${xy(x1, y0)}L${xy(x1, y1)}`;
47
+ else {
78
48
  const xm = x0 * (1 - t) + x1 * t;
79
- path.lineTo(xm, y0);
80
- path.lineTo(xm, y1);
81
- if (i === points.length - 1) path.lineTo(x1, y1);
49
+ d += `L${xy(xm, y0)}L${xy(xm, y1)}`;
50
+ if (i === points.length - 1) d += `L${xy(x1, y1)}`;
82
51
  }
83
52
  }
53
+ return d;
84
54
  }
85
55
  const sign = (x) => x < 0 ? -1 : 1;
86
56
  /**
87
57
  * Monotone cubic interpolation in x (Steffen, 1990), as in d3's
88
58
  * `curveMonotoneX`: smooth, but never overshoots the data.
89
59
  */
90
- function monotone(path, points) {
60
+ function monotone(xy, points) {
91
61
  const n = points.length;
92
- if (n < 2) return;
62
+ if (n < 2) return "";
93
63
  if (n === 2) {
94
64
  const p = points[1];
95
- path.lineTo(p[0], p[1]);
96
- return;
65
+ return `L${xy(p[0], p[1])}`;
97
66
  }
98
67
  const tangents = new Array(n);
99
68
  for (let i = 1; i < n - 1; i++) {
@@ -109,12 +78,14 @@ function monotone(path, points) {
109
78
  }
110
79
  tangents[0] = endTangent(points[0], points[1], tangents[1]);
111
80
  tangents[n - 1] = endTangent(points[n - 2], points[n - 1], tangents[n - 2]);
81
+ let d = "";
112
82
  for (let i = 1; i < n; i++) {
113
83
  const [x0, y0] = points[i - 1];
114
84
  const [x1, y1] = points[i];
115
85
  const dx = (x1 - x0) / 3;
116
- path.curveTo(x0 + dx, y0 + dx * tangents[i - 1], x1 - dx, y1 - dx * tangents[i], x1, y1);
86
+ d += `C${xy(x0 + dx, y0 + dx * tangents[i - 1])},${xy(x1 - dx, y1 - dx * tangents[i])},${xy(x1, y1)}`;
117
87
  }
88
+ return d;
118
89
  }
119
90
  /** One-sided tangent for the first/last point from the neighbour's tangent. */
120
91
  function endTangent(a, b, t) {
@@ -145,9 +116,14 @@ function runs(points, valid = () => true) {
145
116
  */
146
117
  function linePath(points, options = {}) {
147
118
  const { curve = "linear", precision = 2 } = options;
148
- const path = new PathBuilder(precision);
149
- for (const run of runs(points)) if (emit(path, run.map((i) => points[i]), curve, true) === 1) path.close();
150
- return path.d;
119
+ const xy = pair(precision);
120
+ let d = "";
121
+ for (const run of runs(points)) {
122
+ const drawn = prepare(run.map((i) => points[i]), curve);
123
+ d += emit(xy, drawn, curve, true);
124
+ if (drawn.length === 1) d += "Z";
125
+ }
126
+ return d;
151
127
  }
152
128
  /**
153
129
  * Build the `d` attribute of an area between `points` and a `baseline`:
@@ -156,14 +132,16 @@ function linePath(points, options = {}) {
156
132
  */
157
133
  function areaPath(points, baseline, options = {}) {
158
134
  const { curve = "linear", precision = 2 } = options;
159
- const path = new PathBuilder(precision);
135
+ const xy = pair(precision);
136
+ let d = "";
160
137
  const baseAt = (i) => typeof baseline === "number" ? baseline : baseline[i] ?? NaN;
161
138
  for (const run of runs(points, (i) => Number.isFinite(baseAt(i)))) {
162
- emit(path, run.map((i) => points[i]), curve, true);
163
- emit(path, run.map((i) => [points[i][0], baseAt(i)]).reverse(), curve === "step-before" ? "step-after" : curve === "step-after" ? "step-before" : curve, false);
164
- path.close();
139
+ d += emit(xy, prepare(run.map((i) => points[i]), curve), curve, true);
140
+ const bottom = run.map((i) => [points[i][0], baseAt(i)]).reverse();
141
+ const back = curve === "step-before" ? "step-after" : curve === "step-after" ? "step-before" : curve;
142
+ d += `${emit(xy, prepare(bottom, back), back, false)}Z`;
165
143
  }
166
- return path.d;
144
+ return d;
167
145
  }
168
146
  // src/components/fade.ts
169
147
  /**
@@ -195,4 +173,4 @@ function fadeMask(id) {
195
173
  }
196
174
  export { areaPath as n, linePath as r, fadeMask as t };
197
175
 
198
- //# sourceMappingURL=fade-GGxcBdss.js.map
176
+ //# sourceMappingURL=fade-CDrQjnDz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fade-CDrQjnDz.js","names":[],"sources":["../src/shapes/path.ts","../src/components/fade.ts"],"sourcesContent":["/** A point in pixels; `null` (or a non-finite coordinate) marks a gap. */\nexport type Point = readonly [x: number, y: number] | null | undefined\n\n/** Curve used to connect consecutive points. */\nexport type Curve = 'linear' | 'monotone' | 'step' | 'step-before' | 'step-after'\n\nexport interface PathOptions {\n /** Interpolation between points. Defaults to `'linear'`. */\n curve?: Curve\n /** Decimal places kept in the path data. Defaults to `2`. */\n precision?: number\n}\n\ntype Pt = readonly [number, number]\n\n/** Writes a coordinate pair, rounded to `precision` decimals. */\ntype XY = (x: number, y: number) => string\n\nfunction pair(precision: number): XY {\n const k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)))\n const n = (value: number): number => Math.round(value * k) / k || 0\n return (x, y) => `${n(x)},${n(y)}`\n}\n\n/** Monotone tangents break on zero-length segments, so coincident points are dropped. */\nconst prepare = (input: readonly Pt[], curve: Curve): readonly Pt[] =>\n curve === 'monotone' ? dedupe(input) : input\n\n/**\n * Path commands through `points` with a curve. The first point is a move\n * when `move` is true, otherwise a line (continuing an existing subpath).\n */\nfunction emit(xy: XY, points: readonly Pt[], curve: Curve, move: boolean): string {\n const first = points[0]\n if (!first) return ''\n const start = (move ? 'M' : 'L') + xy(first[0], first[1])\n if (curve === 'monotone') return start + monotone(xy, points)\n const t = STEPS[curve]\n if (t !== undefined) return start + step(xy, points, t)\n let d = start\n for (let i = 1; i < points.length; i++) {\n const p = points[i] as Pt\n d += `L${xy(p[0], p[1])}`\n }\n return d\n}\n\n/** Where a step curve turns between two points, as a share of the way. */\nconst STEPS: Partial<Record<Curve, number>> = { step: 0.5, 'step-before': 0, 'step-after': 1 }\n\nfunction dedupe(points: readonly Pt[]): readonly Pt[] {\n return points.filter((p, i) => {\n const prev = points[i - 1]\n return !prev || p[0] !== prev[0] || p[1] !== prev[1]\n })\n}\n\nfunction step(xy: XY, points: readonly Pt[], t: number): string {\n let d = ''\n for (let i = 1; i < points.length; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n if (t <= 0) d += `L${xy(x0, y1)}L${xy(x1, y1)}`\n else if (t >= 1) d += `L${xy(x1, y0)}L${xy(x1, y1)}`\n else {\n const xm = x0 * (1 - t) + x1 * t\n d += `L${xy(xm, y0)}L${xy(xm, y1)}`\n // The next horizontal run continues from here, so only the last point is needed.\n if (i === points.length - 1) d += `L${xy(x1, y1)}`\n }\n }\n return d\n}\n\nconst sign = (x: number): number => (x < 0 ? -1 : 1)\n\n/**\n * Monotone cubic interpolation in x (Steffen, 1990), as in d3's\n * `curveMonotoneX`: smooth, but never overshoots the data.\n */\nfunction monotone(xy: XY, points: readonly Pt[]): string {\n const n = points.length\n if (n < 2) return ''\n if (n === 2) {\n const p = points[1] as Pt\n return `L${xy(p[0], p[1])}`\n }\n\n const tangents = new Array<number>(n)\n for (let i = 1; i < n - 1; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n const [x2, y2] = points[i + 1] as Pt\n const h0 = x1 - x0\n const h1 = x2 - x1\n const s0 = (y1 - y0) / (h0 || (h1 < 0 ? -0 : 0))\n const s1 = (y2 - y1) / (h1 || (h0 < 0 ? -0 : 0))\n const p = (s0 * h1 + s1 * h0) / (h0 + h1)\n tangents[i] =\n (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n tangents[0] = endTangent(points[0] as Pt, points[1] as Pt, tangents[1] as number)\n tangents[n - 1] = endTangent(points[n - 2] as Pt, points[n - 1] as Pt, tangents[n - 2] as number)\n\n let d = ''\n for (let i = 1; i < n; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n const dx = (x1 - x0) / 3\n d += `C${xy(x0 + dx, y0 + dx * (tangents[i - 1] as number))},${xy(\n x1 - dx,\n y1 - dx * (tangents[i] as number),\n )},${xy(x1, y1)}`\n }\n return d\n}\n\n/** One-sided tangent for the first/last point from the neighbour's tangent. */\nfunction endTangent(a: Pt, b: Pt, t: number): number {\n const h = b[0] - a[0]\n return h ? (3 * (b[1] - a[1])) / h / 2 - t / 2 : t\n}\n\nconst isValid = (p: Point): p is Pt => p != null && Number.isFinite(p[0]) && Number.isFinite(p[1])\n\n/** Split points into runs of consecutive valid points, keeping their indices. */\nfunction runs(points: readonly Point[], valid: (i: number) => boolean = () => true): number[][] {\n const out: number[][] = []\n let current: number[] | undefined\n for (let i = 0; i < points.length; i++) {\n if (isValid(points[i]) && valid(i)) {\n if (!current) {\n current = []\n out.push(current)\n }\n current.push(i)\n } else {\n current = undefined\n }\n }\n return out\n}\n\n/**\n * Build the `d` attribute of a line through `points`. Gaps (`null`/`NaN`)\n * start a new subpath; a lone point renders as `M x,y Z`.\n *\n * ```ts\n * linePath([[0, 10], [50, 40], null, [100, 20]], { curve: 'monotone' })\n * ```\n */\nexport function linePath(points: readonly Point[], options: PathOptions = {}): string {\n const { curve = 'linear', precision = 2 } = options\n const xy = pair(precision)\n let d = ''\n for (const run of runs(points)) {\n const drawn = prepare(\n run.map((i) => points[i] as Pt),\n curve,\n )\n d += emit(xy, drawn, curve, true)\n if (drawn.length === 1) d += 'Z'\n }\n return d\n}\n\n/**\n * Build the `d` attribute of an area between `points` and a `baseline`:\n * a constant y (e.g. the zero line) or one y per point (stacked areas).\n * Each run of valid points becomes a closed subpath.\n */\nexport function areaPath(\n points: readonly Point[],\n baseline: number | readonly (number | null | undefined)[],\n options: PathOptions = {},\n): string {\n const { curve = 'linear', precision = 2 } = options\n const xy = pair(precision)\n let d = ''\n const baseAt = (i: number): number =>\n typeof baseline === 'number' ? baseline : (baseline[i] ?? Number.NaN)\n\n for (const run of runs(points, (i) => Number.isFinite(baseAt(i)))) {\n d += emit(\n xy,\n prepare(\n run.map((i) => points[i] as Pt),\n curve,\n ),\n curve,\n true,\n )\n\n const bottom = run.map((i) => [(points[i] as Pt)[0], baseAt(i)] as const).reverse()\n // Walking backwards mirrors step curves, so stacked steps line up. A flat\n // baseline takes the same curve (it stays straight) so that the path keeps\n // its commands between flat and stacked, and CSS can morph one into the other.\n const back =\n curve === 'step-before' ? 'step-after' : curve === 'step-after' ? 'step-before' : curve\n d += `${emit(xy, prepare(bottom, back), back, false)}Z`\n }\n return d\n}\n","import { h, type VNode } from '../vnode.ts'\n\n/**\n * A vertical luminance mask shared by all gradient areas of a chart (line, area, sparkline). Areas keep their\n * series color from CSS; the mask only fades them, with stop opacities read\n * from `--tc-area-gradient-start` / `--tc-area-gradient-end`.\n */\nexport function fadeMask(id: string): VNode {\n return h(\n 'mask',\n { id, maskContentUnits: 'objectBoundingBox' },\n h(\n 'linearGradient',\n { id: `${id}-gradient`, x1: 0, y1: 0, x2: 0, y2: 1 },\n h('stop', { class: 'tc-fade-start', offset: 0 }),\n h('stop', { class: 'tc-fade-end', offset: 1 }),\n ),\n h('rect', { width: 1, height: 1, fill: `url(#${id}-gradient)` }),\n )\n}\n"],"mappings":";;AAkBA,SAAS,KAAK,WAAuB;CACnC,MAAM,IAAI,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,MAAM,SAAS,CAAC,CAAC;CAC/D,MAAM,KAAK,UAA0B,KAAK,MAAM,QAAQ,CAAC,IAAI,KAAK;CAClE,QAAQ,GAAG,MAAM,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AACjC;;AAGA,MAAM,WAAW,OAAsB,UACrC,UAAU,aAAa,OAAO,KAAK,IAAI;;;;;AAMzC,SAAS,KAAK,IAAQ,QAAuB,OAAc,MAAuB;CAChF,MAAM,QAAQ,OAAO;CACrB,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,SAAS,OAAO,MAAM,OAAO,GAAG,MAAM,IAAI,MAAM,EAAE;CACxD,IAAI,UAAU,YAAY,OAAO,QAAQ,SAAS,IAAI,MAAM;CAC5D,MAAM,IAAI,MAAM;CAChB,IAAI,MAAM,KAAA,GAAW,OAAO,QAAQ,KAAK,IAAI,QAAQ,CAAC;CACtD,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;EACtC,MAAM,IAAI,OAAO;EACjB,KAAK,IAAI,GAAG,EA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K,EAAE;CACvD;CACA,OAAO;AACT;;;;;;;ACnMA,SAAgB,SAAS,IAAmB;CAC1C,OAAO,EACL,QACA;EAAE;EAAI,kBAAkB;CAAoB,GAC5C,EACE,kBACA;EAAE,IAAI,GAAG,GAAG;EAAY,IAAI;EAAG,IAAI;EAAG,IAAI;EAAG,IAAI;CAAE,GACnD,EAAE,QAAQ;EAAE,OAAO;EAAiB,QAAQ;CAAE,CAAC,GAC/C,EAAE,QAAQ;EAAE,OAAO;EAAe,QAAQ;CAAE,CAAC,CAC/C,GACA,EAAE,QAAQ;EAAE,OAAO;EAAG,QAAQ;EAAG,MAAM,QAAQ,GAAG;CAAY,CAAC,CACjE;AACF"}
@@ -1,99 +1,68 @@
1
1
  const require_vnode = require("./vnode-ClAiw28x.cjs");
2
2
  // src/shapes/path.ts
3
- /** Accumulates SVG path commands with rounded coordinates. */
4
- var PathBuilder = class {
5
- d = "";
6
- #k;
7
- constructor(precision) {
8
- this.#k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)));
9
- }
10
- #n(value) {
11
- const rounded = Math.round(value * this.#k) / this.#k;
12
- return String(rounded === 0 ? 0 : rounded);
13
- }
14
- #xy(x, y) {
15
- return `${this.#n(x)},${this.#n(y)}`;
16
- }
17
- moveTo(x, y) {
18
- this.d += `M${this.#xy(x, y)}`;
19
- }
20
- lineTo(x, y) {
21
- this.d += `L${this.#xy(x, y)}`;
22
- }
23
- curveTo(x1, y1, x2, y2, x, y) {
24
- this.d += `C${this.#xy(x1, y1)},${this.#xy(x2, y2)},${this.#xy(x, y)}`;
25
- }
26
- close() {
27
- this.d += "Z";
28
- }
29
- };
3
+ function pair(precision) {
4
+ const k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)));
5
+ const n = (value) => Math.round(value * k) / k || 0;
6
+ return (x, y) => `${n(x)},${n(y)}`;
7
+ }
8
+ /** Monotone tangents break on zero-length segments, so coincident points are dropped. */
9
+ const prepare = (input, curve) => curve === "monotone" ? dedupe(input) : input;
30
10
  /**
31
- * Emit `points` with a curve. The first point is a `moveTo` when `move` is
32
- * true, otherwise a `lineTo` (continuing an existing subpath). Returns the
33
- * number of points drawn.
11
+ * Path commands through `points` with a curve. The first point is a move
12
+ * when `move` is true, otherwise a line (continuing an existing subpath).
34
13
  */
35
- function emit(path, input, curve, move) {
36
- const points = curve === "monotone" ? dedupe(input) : input;
14
+ function emit(xy, points, curve, move) {
37
15
  const first = points[0];
38
- if (!first) return 0;
39
- if (move) path.moveTo(first[0], first[1]);
40
- else path.lineTo(first[0], first[1]);
41
- switch (curve) {
42
- case "monotone":
43
- monotone(path, points);
44
- break;
45
- case "step":
46
- step(path, points, .5);
47
- break;
48
- case "step-before":
49
- step(path, points, 0);
50
- break;
51
- case "step-after":
52
- step(path, points, 1);
53
- break;
54
- default: for (let i = 1; i < points.length; i++) {
55
- const p = points[i];
56
- path.lineTo(p[0], p[1]);
57
- }
16
+ if (!first) return "";
17
+ const start = (move ? "M" : "L") + xy(first[0], first[1]);
18
+ if (curve === "monotone") return start + monotone(xy, points);
19
+ const t = STEPS[curve];
20
+ if (t !== void 0) return start + step(xy, points, t);
21
+ let d = start;
22
+ for (let i = 1; i < points.length; i++) {
23
+ const p = points[i];
24
+ d += `L${xy(p[0], p[1])}`;
58
25
  }
59
- return points.length;
26
+ return d;
60
27
  }
28
+ /** Where a step curve turns between two points, as a share of the way. */
29
+ const STEPS = {
30
+ step: .5,
31
+ "step-before": 0,
32
+ "step-after": 1
33
+ };
61
34
  function dedupe(points) {
62
35
  return points.filter((p, i) => {
63
36
  const prev = points[i - 1];
64
37
  return !prev || p[0] !== prev[0] || p[1] !== prev[1];
65
38
  });
66
39
  }
67
- function step(path, points, t) {
40
+ function step(xy, points, t) {
41
+ let d = "";
68
42
  for (let i = 1; i < points.length; i++) {
69
43
  const [x0, y0] = points[i - 1];
70
44
  const [x1, y1] = points[i];
71
- if (t <= 0) {
72
- path.lineTo(x0, y1);
73
- path.lineTo(x1, y1);
74
- } else if (t >= 1) {
75
- path.lineTo(x1, y0);
76
- path.lineTo(x1, y1);
77
- } else {
45
+ if (t <= 0) d += `L${xy(x0, y1)}L${xy(x1, y1)}`;
46
+ else if (t >= 1) d += `L${xy(x1, y0)}L${xy(x1, y1)}`;
47
+ else {
78
48
  const xm = x0 * (1 - t) + x1 * t;
79
- path.lineTo(xm, y0);
80
- path.lineTo(xm, y1);
81
- if (i === points.length - 1) path.lineTo(x1, y1);
49
+ d += `L${xy(xm, y0)}L${xy(xm, y1)}`;
50
+ if (i === points.length - 1) d += `L${xy(x1, y1)}`;
82
51
  }
83
52
  }
53
+ return d;
84
54
  }
85
55
  const sign = (x) => x < 0 ? -1 : 1;
86
56
  /**
87
57
  * Monotone cubic interpolation in x (Steffen, 1990), as in d3's
88
58
  * `curveMonotoneX`: smooth, but never overshoots the data.
89
59
  */
90
- function monotone(path, points) {
60
+ function monotone(xy, points) {
91
61
  const n = points.length;
92
- if (n < 2) return;
62
+ if (n < 2) return "";
93
63
  if (n === 2) {
94
64
  const p = points[1];
95
- path.lineTo(p[0], p[1]);
96
- return;
65
+ return `L${xy(p[0], p[1])}`;
97
66
  }
98
67
  const tangents = new Array(n);
99
68
  for (let i = 1; i < n - 1; i++) {
@@ -109,12 +78,14 @@ function monotone(path, points) {
109
78
  }
110
79
  tangents[0] = endTangent(points[0], points[1], tangents[1]);
111
80
  tangents[n - 1] = endTangent(points[n - 2], points[n - 1], tangents[n - 2]);
81
+ let d = "";
112
82
  for (let i = 1; i < n; i++) {
113
83
  const [x0, y0] = points[i - 1];
114
84
  const [x1, y1] = points[i];
115
85
  const dx = (x1 - x0) / 3;
116
- path.curveTo(x0 + dx, y0 + dx * tangents[i - 1], x1 - dx, y1 - dx * tangents[i], x1, y1);
86
+ d += `C${xy(x0 + dx, y0 + dx * tangents[i - 1])},${xy(x1 - dx, y1 - dx * tangents[i])},${xy(x1, y1)}`;
117
87
  }
88
+ return d;
118
89
  }
119
90
  /** One-sided tangent for the first/last point from the neighbour's tangent. */
120
91
  function endTangent(a, b, t) {
@@ -145,9 +116,14 @@ function runs(points, valid = () => true) {
145
116
  */
146
117
  function linePath(points, options = {}) {
147
118
  const { curve = "linear", precision = 2 } = options;
148
- const path = new PathBuilder(precision);
149
- for (const run of runs(points)) if (emit(path, run.map((i) => points[i]), curve, true) === 1) path.close();
150
- return path.d;
119
+ const xy = pair(precision);
120
+ let d = "";
121
+ for (const run of runs(points)) {
122
+ const drawn = prepare(run.map((i) => points[i]), curve);
123
+ d += emit(xy, drawn, curve, true);
124
+ if (drawn.length === 1) d += "Z";
125
+ }
126
+ return d;
151
127
  }
152
128
  /**
153
129
  * Build the `d` attribute of an area between `points` and a `baseline`:
@@ -156,14 +132,16 @@ function linePath(points, options = {}) {
156
132
  */
157
133
  function areaPath(points, baseline, options = {}) {
158
134
  const { curve = "linear", precision = 2 } = options;
159
- const path = new PathBuilder(precision);
135
+ const xy = pair(precision);
136
+ let d = "";
160
137
  const baseAt = (i) => typeof baseline === "number" ? baseline : baseline[i] ?? NaN;
161
138
  for (const run of runs(points, (i) => Number.isFinite(baseAt(i)))) {
162
- emit(path, run.map((i) => points[i]), curve, true);
163
- emit(path, run.map((i) => [points[i][0], baseAt(i)]).reverse(), curve === "step-before" ? "step-after" : curve === "step-after" ? "step-before" : curve, false);
164
- path.close();
139
+ d += emit(xy, prepare(run.map((i) => points[i]), curve), curve, true);
140
+ const bottom = run.map((i) => [points[i][0], baseAt(i)]).reverse();
141
+ const back = curve === "step-before" ? "step-after" : curve === "step-after" ? "step-before" : curve;
142
+ d += `${emit(xy, prepare(bottom, back), back, false)}Z`;
165
143
  }
166
- return path.d;
144
+ return d;
167
145
  }
168
146
  // src/components/fade.ts
169
147
  /**
@@ -212,4 +190,4 @@ Object.defineProperty(exports, "linePath", {
212
190
  }
213
191
  });
214
192
 
215
- //# sourceMappingURL=fade-DVTkhrFU.cjs.map
193
+ //# sourceMappingURL=fade-CRqcKMWY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fade-CRqcKMWY.cjs","names":["h"],"sources":["../src/shapes/path.ts","../src/components/fade.ts"],"sourcesContent":["/** A point in pixels; `null` (or a non-finite coordinate) marks a gap. */\nexport type Point = readonly [x: number, y: number] | null | undefined\n\n/** Curve used to connect consecutive points. */\nexport type Curve = 'linear' | 'monotone' | 'step' | 'step-before' | 'step-after'\n\nexport interface PathOptions {\n /** Interpolation between points. Defaults to `'linear'`. */\n curve?: Curve\n /** Decimal places kept in the path data. Defaults to `2`. */\n precision?: number\n}\n\ntype Pt = readonly [number, number]\n\n/** Writes a coordinate pair, rounded to `precision` decimals. */\ntype XY = (x: number, y: number) => string\n\nfunction pair(precision: number): XY {\n const k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)))\n const n = (value: number): number => Math.round(value * k) / k || 0\n return (x, y) => `${n(x)},${n(y)}`\n}\n\n/** Monotone tangents break on zero-length segments, so coincident points are dropped. */\nconst prepare = (input: readonly Pt[], curve: Curve): readonly Pt[] =>\n curve === 'monotone' ? dedupe(input) : input\n\n/**\n * Path commands through `points` with a curve. The first point is a move\n * when `move` is true, otherwise a line (continuing an existing subpath).\n */\nfunction emit(xy: XY, points: readonly Pt[], curve: Curve, move: boolean): string {\n const first = points[0]\n if (!first) return ''\n const start = (move ? 'M' : 'L') + xy(first[0], first[1])\n if (curve === 'monotone') return start + monotone(xy, points)\n const t = STEPS[curve]\n if (t !== undefined) return start + step(xy, points, t)\n let d = start\n for (let i = 1; i < points.length; i++) {\n const p = points[i] as Pt\n d += `L${xy(p[0], p[1])}`\n }\n return d\n}\n\n/** Where a step curve turns between two points, as a share of the way. */\nconst STEPS: Partial<Record<Curve, number>> = { step: 0.5, 'step-before': 0, 'step-after': 1 }\n\nfunction dedupe(points: readonly Pt[]): readonly Pt[] {\n return points.filter((p, i) => {\n const prev = points[i - 1]\n return !prev || p[0] !== prev[0] || p[1] !== prev[1]\n })\n}\n\nfunction step(xy: XY, points: readonly Pt[], t: number): string {\n let d = ''\n for (let i = 1; i < points.length; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n if (t <= 0) d += `L${xy(x0, y1)}L${xy(x1, y1)}`\n else if (t >= 1) d += `L${xy(x1, y0)}L${xy(x1, y1)}`\n else {\n const xm = x0 * (1 - t) + x1 * t\n d += `L${xy(xm, y0)}L${xy(xm, y1)}`\n // The next horizontal run continues from here, so only the last point is needed.\n if (i === points.length - 1) d += `L${xy(x1, y1)}`\n }\n }\n return d\n}\n\nconst sign = (x: number): number => (x < 0 ? -1 : 1)\n\n/**\n * Monotone cubic interpolation in x (Steffen, 1990), as in d3's\n * `curveMonotoneX`: smooth, but never overshoots the data.\n */\nfunction monotone(xy: XY, points: readonly Pt[]): string {\n const n = points.length\n if (n < 2) return ''\n if (n === 2) {\n const p = points[1] as Pt\n return `L${xy(p[0], p[1])}`\n }\n\n const tangents = new Array<number>(n)\n for (let i = 1; i < n - 1; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n const [x2, y2] = points[i + 1] as Pt\n const h0 = x1 - x0\n const h1 = x2 - x1\n const s0 = (y1 - y0) / (h0 || (h1 < 0 ? -0 : 0))\n const s1 = (y2 - y1) / (h1 || (h0 < 0 ? -0 : 0))\n const p = (s0 * h1 + s1 * h0) / (h0 + h1)\n tangents[i] =\n (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0\n }\n tangents[0] = endTangent(points[0] as Pt, points[1] as Pt, tangents[1] as number)\n tangents[n - 1] = endTangent(points[n - 2] as Pt, points[n - 1] as Pt, tangents[n - 2] as number)\n\n let d = ''\n for (let i = 1; i < n; i++) {\n const [x0, y0] = points[i - 1] as Pt\n const [x1, y1] = points[i] as Pt\n const dx = (x1 - x0) / 3\n d += `C${xy(x0 + dx, y0 + dx * (tangents[i - 1] as number))},${xy(\n x1 - dx,\n y1 - dx * (tangents[i] as number),\n )},${xy(x1, y1)}`\n }\n return d\n}\n\n/** One-sided tangent for the first/last point from the neighbour's tangent. */\nfunction endTangent(a: Pt, b: Pt, t: number): number {\n const h = b[0] - a[0]\n return h ? (3 * (b[1] - a[1])) / h / 2 - t / 2 : t\n}\n\nconst isValid = (p: Point): p is Pt => p != null && Number.isFinite(p[0]) && Number.isFinite(p[1])\n\n/** Split points into runs of consecutive valid points, keeping their indices. */\nfunction runs(points: readonly Point[], valid: (i: number) => boolean = () => true): number[][] {\n const out: number[][] = []\n let current: number[] | undefined\n for (let i = 0; i < points.length; i++) {\n if (isValid(points[i]) && valid(i)) {\n if (!current) {\n current = []\n out.push(current)\n }\n current.push(i)\n } else {\n current = undefined\n }\n }\n return out\n}\n\n/**\n * Build the `d` attribute of a line through `points`. Gaps (`null`/`NaN`)\n * start a new subpath; a lone point renders as `M x,y Z`.\n *\n * ```ts\n * linePath([[0, 10], [50, 40], null, [100, 20]], { curve: 'monotone' })\n * ```\n */\nexport function linePath(points: readonly Point[], options: PathOptions = {}): string {\n const { curve = 'linear', precision = 2 } = options\n const xy = pair(precision)\n let d = ''\n for (const run of runs(points)) {\n const drawn = prepare(\n run.map((i) => points[i] as Pt),\n curve,\n )\n d += emit(xy, drawn, curve, true)\n if (drawn.length === 1) d += 'Z'\n }\n return d\n}\n\n/**\n * Build the `d` attribute of an area between `points` and a `baseline`:\n * a constant y (e.g. the zero line) or one y per point (stacked areas).\n * Each run of valid points becomes a closed subpath.\n */\nexport function areaPath(\n points: readonly Point[],\n baseline: number | readonly (number | null | undefined)[],\n options: PathOptions = {},\n): string {\n const { curve = 'linear', precision = 2 } = options\n const xy = pair(precision)\n let d = ''\n const baseAt = (i: number): number =>\n typeof baseline === 'number' ? baseline : (baseline[i] ?? Number.NaN)\n\n for (const run of runs(points, (i) => Number.isFinite(baseAt(i)))) {\n d += emit(\n xy,\n prepare(\n run.map((i) => points[i] as Pt),\n curve,\n ),\n curve,\n true,\n )\n\n const bottom = run.map((i) => [(points[i] as Pt)[0], baseAt(i)] as const).reverse()\n // Walking backwards mirrors step curves, so stacked steps line up. A flat\n // baseline takes the same curve (it stays straight) so that the path keeps\n // its commands between flat and stacked, and CSS can morph one into the other.\n const back =\n curve === 'step-before' ? 'step-after' : curve === 'step-after' ? 'step-before' : curve\n d += `${emit(xy, prepare(bottom, back), back, false)}Z`\n }\n return d\n}\n","import { h, type VNode } from '../vnode.ts'\n\n/**\n * A vertical luminance mask shared by all gradient areas of a chart (line, area, sparkline). Areas keep their\n * series color from CSS; the mask only fades them, with stop opacities read\n * from `--tc-area-gradient-start` / `--tc-area-gradient-end`.\n */\nexport function fadeMask(id: string): VNode {\n return h(\n 'mask',\n { id, maskContentUnits: 'objectBoundingBox' },\n h(\n 'linearGradient',\n { id: `${id}-gradient`, x1: 0, y1: 0, x2: 0, y2: 1 },\n h('stop', { class: 'tc-fade-start', offset: 0 }),\n h('stop', { class: 'tc-fade-end', offset: 1 }),\n ),\n h('rect', { width: 1, height: 1, fill: `url(#${id}-gradient)` }),\n )\n}\n"],"mappings":";;AAkBA,SAAS,KAAK,WAAuB;CACnC,MAAM,IAAI,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,MAAM,SAAS,CAAC,CAAC;CAC/D,MAAM,KAAK,UAA0B,KAAK,MAAM,QAAQ,CAAC,IAAI,KAAK;CAClE,QAAQ,GAAG,MAAM,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AACjC;;AAGA,MAAM,WAAW,OAAsB,UACrC,UAAU,aAAa,OAAO,KAAK,IAAI;;;;;AAMzC,SAAS,KAAK,IAAQ,QAAuB,OAAc,MAAuB;CAChF,MAAM,QAAQ,OAAO;CACrB,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,SAAS,OAAO,MAAM,OAAO,GAAG,MAAM,IAAI,MAAM,EAAE;CACxD,IAAI,UAAU,YAAY,OAAO,QAAQ,SAAS,IAAI,MAAM;CAC5D,MAAM,IAAI,MAAM;CAChB,IAAI,MAAM,KAAA,GAAW,OAAO,QAAQ,KAAK,IAAI,QA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QAAQ;EAIlF,MAAM,OACJ,UAAU,gBAAgB,eAAe,UAAU,eAAe,gBAAgB;EACpF,KAAK,GAAG,KAAK,IAAI,QAAQ,QAAQ,IAAI,GAAG,MAAM,KAAK,EAAE;CACvD;CACA,OAAO;AACT;;;;;;;ACnMA,SAAgB,SAAS,IAAmB;CAC1C,OAAOA,cAAAA,EACL,QACA;EAAE;EAAI,kBAAkB;CAAoB,GAC5CA,cAAAA,EACE,kBACA;EAAE,IAAI,GAAG,GAAG;EAAY,IAAI;EAAG,IAAI;EAAG,IAAI;EAAG,IAAI;CAAE,GACnDA,cAAAA,EAAE,QAAQ;EAAE,OAAO;EAAiB,QAAQ;CAAE,CAAC,GAC/CA,cAAAA,EAAE,QAAQ;EAAE,OAAO;EAAe,QAAQ;CAAE,CAAC,CAC/C,GACAA,cAAAA,EAAE,QAAQ;EAAE,OAAO;EAAG,QAAQ;EAAG,MAAM,QAAQ,GAAG;CAAY,CAAC,CACjE;AACF"}
@@ -4,6 +4,8 @@ const features = {};
4
4
  function register(added) {
5
5
  Object.assign(features, added);
6
6
  }
7
+ /** The swatch shapes of a chart, if it has point shapes (`shapes`, or `patterns: true`). */
8
+ const swatchShape = (config) => config.shapes ?? config.patterns === true ? features.swatch : void 0;
7
9
  const steps = /* @__PURE__ */ new Set();
8
10
  /** Add a step that finishes rendered content, once, in the order added. */
9
11
  function addPost(step) {
@@ -19,6 +21,6 @@ function feature(name) {
19
21
  if (!found) throw new Error(`@tabler/charts: Import "@tabler/charts/${name === "dates" ? "time" : name}" for ${name}.`);
20
22
  return found;
21
23
  }
22
- export { register as i, feature as n, features as r, addPost as t };
24
+ export { swatchShape as a, register as i, feature as n, features as r, addPost as t };
23
25
 
24
- //# sourceMappingURL=features-BMxkqCyS.js.map
26
+ //# sourceMappingURL=features-B55rwpQC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features-B55rwpQC.js","names":[],"sources":["../src/features.ts"],"sourcesContent":["import type { ChartConfig, RenderContext } from './chart.ts'\nimport type { annotationLayers, annotationValues } from './charts/annotations.ts'\nimport type { dateLabels } from './charts/dates.ts'\nimport type { endLabels } from './charts/end-labels.ts'\nimport type { logDomain, logTicks } from './charts/log-axis.ts'\nimport type { patternFills } from './charts/patterns.ts'\nimport type { markerClip, markerPath } from './charts/point-shapes.ts'\nimport type { sliceLabels } from './charts/slice-labels.ts'\nimport type { timeAxis } from './charts/time-axis.ts'\nimport type { viewWindow } from './charts/view.ts'\nimport type { downloadChart } from './export-chart.ts'\nimport type { Interaction } from './interaction.ts'\nimport type { ChartPlugin } from './plugin.ts'\nimport type { hydrate } from './render/hydrate.ts'\nimport type { morph } from './render/morph.ts'\nimport type { sweep } from './render/sweep.ts'\nimport type { log } from './scales/log.ts'\nimport type { time, timePointScale } from './scales/time.ts'\nimport type { areaPath, linePath, Point } from './shapes/path.ts'\nimport type { ChildInput } from './vnode.ts'\n\n/**\n * Optional features that chart types look up at render time. Each lives in\n * its own module (`@tabler/charts/time`, `/log`, `/decimate`, `/line`, `/annotations`, `/end-labels`, `/slice-labels`, `/zoom`) and registers\n * itself when imported; `@tabler/charts` registers all of them, while\n * `@tabler/charts/core` starts empty so unused code never ships.\n */\nexport interface Features {\n /** Time scale (and the point scale over it) behind `x: { type: 'time' }`. */\n time?: { scale: typeof time; points: typeof timePointScale; axis: typeof timeAxis }\n /** Date labels behind `x: { type: 'time' }` (also registered by `@tabler/charts/candlestick`). */\n dates?: typeof dateLabels\n /** Log scale and axis behind `scale: 'log'`. */\n log?: { scale: typeof log; domain: typeof logDomain; ticks: typeof logTicks }\n /** Downsampling behind `decimate: N`: indices of the points to keep. */\n decimate?: (points: readonly Point[], threshold: number) => number[]\n /**\n * Taking over server-rendered markup node by node (without it, the server\n * svg is replaced on the first render).\n */\n hydrate?: typeof hydrate\n /** Path morphing on data updates where CSS cannot transition `d` (Safari). */\n morph?: typeof morph\n /** Arcs turning to their new angles on data updates (installed by a chart whose type has `sweep`). */\n sweep?: typeof sweep\n /** Line and area paths behind `series.type: 'line' | 'area'` in bar charts. */\n line?: { linePath: typeof linePath; areaPath: typeof areaPath }\n /** Reference lines and bands behind `annotations` in cartesian charts. */\n annotations?: { layers: typeof annotationLayers; values: typeof annotationValues }\n /** Names and last values at the end of lines, behind `endLabels`. */\n 'end-labels'?: typeof endLabels\n /** Names beside the slices of a pie, behind its `labels`. */\n 'slice-labels'?: typeof sliceLabels\n /** Pattern fills behind `patterns` (and forced colors, with `'auto'`). */\n patterns?: typeof patternFills\n /**\n * Steps that finish a chart's rendered content (see `addPost`): point\n * shapes, value labels.\n */\n post?: PostStep\n /** Point shapes by color slot, behind `shapes`. */\n 'point-shapes'?: typeof markerPath\n /** The same shapes for legend and tooltip swatches, as CSS shapes. */\n swatch?: typeof markerClip\n /**\n * Behind `view` and `zoom` in cartesian charts: the window of categories a\n * chart type draws, and what the `zoom()` plugin installs on a chart.\n */\n zoom?: { window: typeof viewWindow; install: ChartPlugin['install'] }\n /** Saving a chart as a file, behind the `download` menu. */\n export?: typeof downloadChart\n}\n\nexport const features: Features = {}\n\n/** Register optional features (idempotent). */\nexport function register(added: Features): void {\n Object.assign(features, added)\n}\n\n/**\n * Inline style that gives the swatch of a legend or tooltip entry the point\n * shape of its color slot (the stylesheet applies it when points are drawn).\n */\nexport type SwatchShape = (slot: number) => Record<string, string | number> | undefined\n\n/** The swatch shapes of a chart, if it has point shapes (`shapes`, or `patterns: true`). */\nexport const swatchShape = (config: ChartConfig<object>): SwatchShape | undefined =>\n (config.shapes ?? config.patterns === true) ? features.swatch : undefined\n\n/** A step that finishes rendered chart content, e.g. by adding value labels. */\nexport type PostStep = (\n config: ChartConfig<object>,\n content: ChildInput,\n interaction: Interaction | undefined,\n ctx: RenderContext,\n) => ChildInput\n\nconst steps = /* @__PURE__ */ new Set<PostStep>()\n\n/** Add a step that finishes rendered content, once, in the order added. */\nexport function addPost(step: PostStep): void {\n steps.add(step)\n features.post = (config, content, interaction, ctx) => {\n for (const each of steps) content = each(config, content, interaction, ctx)\n return content\n }\n}\n\n/** The registered feature, or a helpful error naming the import that provides it. */\nexport function feature<K extends keyof Features>(name: K): NonNullable<Features[K]> {\n const found = features[name]\n if (!found) {\n throw new Error(\n `@tabler/charts: Import \"@tabler/charts/${name === 'dates' ? 'time' : name}\" for ${name}.`,\n )\n }\n return found\n}\n"],"mappings":";AAyEA,MAAa,WAAqB,CAAC;;AAGnC,SAAgB,SAAS,OAAuB;CAC9C,OAAO,OAAO,UAAU,KAAK;AAC/B;;AASA,MAAa,eAAe,WACzB,OAAO,UAAU,OAAO,aAAa,OAAQ,SAAS,SAAS,KAAA;AAUlE,MAAM,wBAAwB,IAAI,IAAc;;AAGhD,SAAgB,QAAQ,MAAsB;CAC5C,MAAM,IAAI,IAAI;CACd,SAAS,QAAQ,QAAQ,SAAS,aAAa,QAAQ;EACrD,KAAK,MAAM,QAAQ,OAAO,UAAU,KAAK,QAAQ,SAAS,aAAa,GAAG;EAC1E,OAAO;CACT;AACF;;AAGA,SAAgB,QAAkC,MAAmC;CACnF,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,OACH,MAAM,IAAI,MACR,0CAA0C,SAAS,UAAU,SAAS,KAAK,QAAQ,KAAK,EAC1F;CAEF,OAAO;AACT"}
@@ -4,6 +4,8 @@ const features = {};
4
4
  function register(added) {
5
5
  Object.assign(features, added);
6
6
  }
7
+ /** The swatch shapes of a chart, if it has point shapes (`shapes`, or `patterns: true`). */
8
+ const swatchShape = (config) => config.shapes ?? config.patterns === true ? features.swatch : void 0;
7
9
  const steps = /* @__PURE__ */ new Set();
8
10
  /** Add a step that finishes rendered content, once, in the order added. */
9
11
  function addPost(step) {
@@ -43,5 +45,11 @@ Object.defineProperty(exports, "register", {
43
45
  return register;
44
46
  }
45
47
  });
48
+ Object.defineProperty(exports, "swatchShape", {
49
+ enumerable: true,
50
+ get: function() {
51
+ return swatchShape;
52
+ }
53
+ });
46
54
 
47
- //# sourceMappingURL=features-DCXEvoya.cjs.map
55
+ //# sourceMappingURL=features-DEDP5CEQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features-DEDP5CEQ.cjs","names":[],"sources":["../src/features.ts"],"sourcesContent":["import type { ChartConfig, RenderContext } from './chart.ts'\nimport type { annotationLayers, annotationValues } from './charts/annotations.ts'\nimport type { dateLabels } from './charts/dates.ts'\nimport type { endLabels } from './charts/end-labels.ts'\nimport type { logDomain, logTicks } from './charts/log-axis.ts'\nimport type { patternFills } from './charts/patterns.ts'\nimport type { markerClip, markerPath } from './charts/point-shapes.ts'\nimport type { sliceLabels } from './charts/slice-labels.ts'\nimport type { timeAxis } from './charts/time-axis.ts'\nimport type { viewWindow } from './charts/view.ts'\nimport type { downloadChart } from './export-chart.ts'\nimport type { Interaction } from './interaction.ts'\nimport type { ChartPlugin } from './plugin.ts'\nimport type { hydrate } from './render/hydrate.ts'\nimport type { morph } from './render/morph.ts'\nimport type { sweep } from './render/sweep.ts'\nimport type { log } from './scales/log.ts'\nimport type { time, timePointScale } from './scales/time.ts'\nimport type { areaPath, linePath, Point } from './shapes/path.ts'\nimport type { ChildInput } from './vnode.ts'\n\n/**\n * Optional features that chart types look up at render time. Each lives in\n * its own module (`@tabler/charts/time`, `/log`, `/decimate`, `/line`, `/annotations`, `/end-labels`, `/slice-labels`, `/zoom`) and registers\n * itself when imported; `@tabler/charts` registers all of them, while\n * `@tabler/charts/core` starts empty so unused code never ships.\n */\nexport interface Features {\n /** Time scale (and the point scale over it) behind `x: { type: 'time' }`. */\n time?: { scale: typeof time; points: typeof timePointScale; axis: typeof timeAxis }\n /** Date labels behind `x: { type: 'time' }` (also registered by `@tabler/charts/candlestick`). */\n dates?: typeof dateLabels\n /** Log scale and axis behind `scale: 'log'`. */\n log?: { scale: typeof log; domain: typeof logDomain; ticks: typeof logTicks }\n /** Downsampling behind `decimate: N`: indices of the points to keep. */\n decimate?: (points: readonly Point[], threshold: number) => number[]\n /**\n * Taking over server-rendered markup node by node (without it, the server\n * svg is replaced on the first render).\n */\n hydrate?: typeof hydrate\n /** Path morphing on data updates where CSS cannot transition `d` (Safari). */\n morph?: typeof morph\n /** Arcs turning to their new angles on data updates (installed by a chart whose type has `sweep`). */\n sweep?: typeof sweep\n /** Line and area paths behind `series.type: 'line' | 'area'` in bar charts. */\n line?: { linePath: typeof linePath; areaPath: typeof areaPath }\n /** Reference lines and bands behind `annotations` in cartesian charts. */\n annotations?: { layers: typeof annotationLayers; values: typeof annotationValues }\n /** Names and last values at the end of lines, behind `endLabels`. */\n 'end-labels'?: typeof endLabels\n /** Names beside the slices of a pie, behind its `labels`. */\n 'slice-labels'?: typeof sliceLabels\n /** Pattern fills behind `patterns` (and forced colors, with `'auto'`). */\n patterns?: typeof patternFills\n /**\n * Steps that finish a chart's rendered content (see `addPost`): point\n * shapes, value labels.\n */\n post?: PostStep\n /** Point shapes by color slot, behind `shapes`. */\n 'point-shapes'?: typeof markerPath\n /** The same shapes for legend and tooltip swatches, as CSS shapes. */\n swatch?: typeof markerClip\n /**\n * Behind `view` and `zoom` in cartesian charts: the window of categories a\n * chart type draws, and what the `zoom()` plugin installs on a chart.\n */\n zoom?: { window: typeof viewWindow; install: ChartPlugin['install'] }\n /** Saving a chart as a file, behind the `download` menu. */\n export?: typeof downloadChart\n}\n\nexport const features: Features = {}\n\n/** Register optional features (idempotent). */\nexport function register(added: Features): void {\n Object.assign(features, added)\n}\n\n/**\n * Inline style that gives the swatch of a legend or tooltip entry the point\n * shape of its color slot (the stylesheet applies it when points are drawn).\n */\nexport type SwatchShape = (slot: number) => Record<string, string | number> | undefined\n\n/** The swatch shapes of a chart, if it has point shapes (`shapes`, or `patterns: true`). */\nexport const swatchShape = (config: ChartConfig<object>): SwatchShape | undefined =>\n (config.shapes ?? config.patterns === true) ? features.swatch : undefined\n\n/** A step that finishes rendered chart content, e.g. by adding value labels. */\nexport type PostStep = (\n config: ChartConfig<object>,\n content: ChildInput,\n interaction: Interaction | undefined,\n ctx: RenderContext,\n) => ChildInput\n\nconst steps = /* @__PURE__ */ new Set<PostStep>()\n\n/** Add a step that finishes rendered content, once, in the order added. */\nexport function addPost(step: PostStep): void {\n steps.add(step)\n features.post = (config, content, interaction, ctx) => {\n for (const each of steps) content = each(config, content, interaction, ctx)\n return content\n }\n}\n\n/** The registered feature, or a helpful error naming the import that provides it. */\nexport function feature<K extends keyof Features>(name: K): NonNullable<Features[K]> {\n const found = features[name]\n if (!found) {\n throw new Error(\n `@tabler/charts: Import \"@tabler/charts/${name === 'dates' ? 'time' : name}\" for ${name}.`,\n )\n }\n return found\n}\n"],"mappings":";AAyEA,MAAa,WAAqB,CAAC;;AAGnC,SAAgB,SAAS,OAAuB;CAC9C,OAAO,OAAO,UAAU,KAAK;AAC/B;;AASA,MAAa,eAAe,WACzB,OAAO,UAAU,OAAO,aAAa,OAAQ,SAAS,SAAS,KAAA;AAUlE,MAAM,wBAAwB,IAAI,IAAc;;AAGhD,SAAgB,QAAQ,MAAsB;CAC5C,MAAM,IAAI,IAAI;CACd,SAAS,QAAQ,QAAQ,SAAS,aAAa,QAAQ;EACrD,KAAK,MAAM,QAAQ,OAAO,UAAU,KAAK,QAAQ,SAAS,aAAa,GAAG;EAC1E,OAAO;CACT;AACF;;AAGA,SAAgB,QAAkC,MAAmC;CACnF,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,OACH,MAAM,IAAI,MACR,0CAA0C,SAAS,UAAU,SAAS,KAAK,QAAQ,KAAK,EAC1F;CAEF,OAAO;AACT"}
@@ -0,0 +1,16 @@
1
+ import { n as estimateTextWidth } from "./layout-DqAte3H8.js";
2
+ // src/charts/fit.ts
3
+ /** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */
4
+ function fit(text, width, fontSize) {
5
+ if (estimateTextWidth(text, fontSize) <= width) return text;
6
+ const chars = [...text];
7
+ while (chars.length > 2) {
8
+ chars.pop();
9
+ const cut = `${chars.join("").trimEnd()}…`;
10
+ if (estimateTextWidth(cut, fontSize) <= width) return cut;
11
+ }
12
+ return "";
13
+ }
14
+ export { fit as t };
15
+
16
+ //# sourceMappingURL=fit-BPyPRnsK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit-BPyPRnsK.js","names":[],"sources":["../src/charts/fit.ts"],"sourcesContent":["import { estimateTextWidth } from '../layout.ts'\n\n/** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */\nexport function fit(text: string, width: number, fontSize: number): string {\n if (estimateTextWidth(text, fontSize) <= width) return text\n const chars = [...text]\n while (chars.length > 2) {\n chars.pop()\n const cut = `${chars.join('').trimEnd()}…`\n if (estimateTextWidth(cut, fontSize) <= width) return cut\n }\n return ''\n}\n"],"mappings":";;;AAGA,SAAgB,IAAI,MAAc,OAAe,UAA0B;CACzE,IAAI,kBAAkB,MAAM,QAAQ,KAAK,OAAO,OAAO;CACvD,MAAM,QAAQ,CAAC,GAAG,IAAI;CACtB,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,IAAI;EACV,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE;EACxC,IAAI,kBAAkB,KAAK,QAAQ,KAAK,OAAO,OAAO;CACxD;CACA,OAAO;AACT"}
@@ -0,0 +1,21 @@
1
+ const require_layout = require("./layout-Cfg9x1k2.cjs");
2
+ // src/charts/fit.ts
3
+ /** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */
4
+ function fit(text, width, fontSize) {
5
+ if (require_layout.estimateTextWidth(text, fontSize) <= width) return text;
6
+ const chars = [...text];
7
+ while (chars.length > 2) {
8
+ chars.pop();
9
+ const cut = `${chars.join("").trimEnd()}…`;
10
+ if (require_layout.estimateTextWidth(cut, fontSize) <= width) return cut;
11
+ }
12
+ return "";
13
+ }
14
+ Object.defineProperty(exports, "fit", {
15
+ enumerable: true,
16
+ get: function() {
17
+ return fit;
18
+ }
19
+ });
20
+
21
+ //# sourceMappingURL=fit-D4MIIQQz.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit-D4MIIQQz.cjs","names":["estimateTextWidth"],"sources":["../src/charts/fit.ts"],"sourcesContent":["import { estimateTextWidth } from '../layout.ts'\n\n/** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */\nexport function fit(text: string, width: number, fontSize: number): string {\n if (estimateTextWidth(text, fontSize) <= width) return text\n const chars = [...text]\n while (chars.length > 2) {\n chars.pop()\n const cut = `${chars.join('').trimEnd()}…`\n if (estimateTextWidth(cut, fontSize) <= width) return cut\n }\n return ''\n}\n"],"mappings":";;;AAGA,SAAgB,IAAI,MAAc,OAAe,UAA0B;CACzE,IAAIA,eAAAA,kBAAkB,MAAM,QAAQ,KAAK,OAAO,OAAO;CACvD,MAAM,QAAQ,CAAC,GAAG,IAAI;CACtB,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,IAAI;EACV,MAAM,MAAM,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE;EACxC,IAAIA,eAAAA,kBAAkB,KAAK,QAAQ,KAAK,OAAO,OAAO;CACxD;CACA,OAAO;AACT"}
@@ -0,0 +1,50 @@
1
+ import { o as ChartType } from "./chart-Dz4geQZy.cjs";
2
+ import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
3
+ import { n as InsetsInput } from "./layout-CYerDebD.cjs";
4
+ import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
5
+ /** One stage of a funnel. */
6
+ interface FunnelStage {
7
+ name: string;
8
+ /** How many reached the stage. Stages without a number, or with a negative one, are left out. */
9
+ value: number;
10
+ /** Stable identity for keyed updates. Defaults to `name`. */
11
+ id?: string;
12
+ /**
13
+ * Custom color, drawn as it is instead of the stage's shade of `--tc-funnel-color`.
14
+ * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
15
+ */
16
+ color?: string;
17
+ /** Extra classes on the stage's shape. */
18
+ class?: ClassValue;
19
+ }
20
+ interface FunnelOptions {
21
+ /** Stages in the order of the process; they are drawn as they come, not sorted. */
22
+ data: readonly FunnelStage[];
23
+ /** Name, value and share of the first stage written above every stage. Defaults to `true`. */
24
+ labels?: boolean;
25
+ /** Radius of the top corners of the stages. Defaults to `4`. */
26
+ radius?: number;
27
+ /** Format of the values (labels, tooltip, table). */
28
+ format?: NumberFormat;
29
+ /** Extra space around the chart, in pixels. */
30
+ padding?: InsetsInput;
31
+ }
32
+ /**
33
+ * Funnel: how many get from one stage of a process to the next. Every stage
34
+ * is a column with its name, its value and its share of the first stage on
35
+ * top; the shapes below step down from each stage's height to the next, in
36
+ * one color that deepens as the funnel narrows (`--tc-funnel-color`).
37
+ *
38
+ * ```ts
39
+ * new Chart('#el', {
40
+ * type: funnel,
41
+ * data: [
42
+ * { name: 'Visits', value: 12400 },
43
+ * { name: 'Signups', value: 3100 },
44
+ * { name: 'Purchases', value: 620 },
45
+ * ],
46
+ * })
47
+ * ```
48
+ */
49
+ declare const funnel: ChartType<FunnelOptions>;
50
+ export { FunnelStage as n, funnel as r, FunnelOptions as t };