@tabler/charts 0.1.0 → 0.3.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 (445) hide show
  1. package/README.md +92 -4
  2. package/dist/{annotations-Bp7HwtF5.d.ts → annotations-B02GR_KU.d.ts} +3 -8
  3. package/dist/{annotations-BszTTjf9.js → annotations-BQ8l-qHs.js} +6 -7
  4. package/dist/{annotations-BszTTjf9.js.map → annotations-BQ8l-qHs.js.map} +1 -1
  5. package/dist/{annotations-lyt0I3HU.d.cts → annotations-CHafaGd4.d.cts} +3 -8
  6. package/dist/{annotations-DpETO8dE.cjs → annotations-CpCWA29b.cjs} +6 -7
  7. package/dist/{annotations-DpETO8dE.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
  8. package/dist/annotations.cjs +3 -5
  9. package/dist/annotations.cjs.map +1 -1
  10. package/dist/annotations.d.cts +2 -1
  11. package/dist/annotations.d.ts +2 -1
  12. package/dist/annotations.js +3 -4
  13. package/dist/{arc-a1tRTEw7.js → arc-B3V5IR0w.js} +2 -3
  14. package/dist/{arc-a1tRTEw7.js.map → arc-B3V5IR0w.js.map} +1 -1
  15. package/dist/{arc-BXpLrt9b.cjs → arc-CYhI62kO.cjs} +2 -3
  16. package/dist/{arc-BXpLrt9b.cjs.map → arc-CYhI62kO.cjs.map} +1 -1
  17. package/dist/{area-CF__HOwL.d.ts → area-DEFQm_SQ.d.ts} +3 -6
  18. package/dist/{area-sHCE3pg5.cjs → area-DYdQ_sMV.cjs} +5 -6
  19. package/dist/{area-sHCE3pg5.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
  20. package/dist/{area-DQsLERhx.js → area-WdtfqvhX.js} +5 -6
  21. package/dist/{area-DQsLERhx.js.map → area-WdtfqvhX.js.map} +1 -1
  22. package/dist/{area-DIxaAbYZ.d.cts → area-h_FvieFb.d.cts} +3 -6
  23. package/dist/area.cjs +1 -1
  24. package/dist/area.d.cts +2 -1
  25. package/dist/area.d.ts +2 -1
  26. package/dist/area.js +1 -2
  27. package/dist/axis-MMaVoSWB.js +235 -0
  28. package/dist/axis-MMaVoSWB.js.map +1 -0
  29. package/dist/axis-YfAerNBA.cjs +300 -0
  30. package/dist/axis-YfAerNBA.cjs.map +1 -0
  31. package/dist/{band-DTcNDAFO.d.ts → band-CNKvdnTC.d.cts} +1 -4
  32. package/dist/{band-DTcNDAFO.d.cts → band-CNKvdnTC.d.ts} +1 -4
  33. package/dist/{bar-jZEoao74.js → bar-BOcRcArc.js} +80 -62
  34. package/dist/bar-BOcRcArc.js.map +1 -0
  35. package/dist/{bar-C-7zR2qp.cjs → bar-CVkOJ7WA.cjs} +82 -64
  36. package/dist/bar-CVkOJ7WA.cjs.map +1 -0
  37. package/dist/{bar-DM16NUvV.js → bar-CgpC2EpX.js} +3 -4
  38. package/dist/{bar-DM16NUvV.js.map → bar-CgpC2EpX.js.map} +1 -1
  39. package/dist/{bar-BBM8RhoL.d.ts → bar-D9B_arKf.d.ts} +4 -7
  40. package/dist/{bar-CRKLDg98.d.cts → bar-DZCQ-kyf.d.cts} +4 -7
  41. package/dist/{bar-DGuUN3nc.cjs → bar-wVykm1us.cjs} +3 -4
  42. package/dist/{bar-DGuUN3nc.cjs.map → bar-wVykm1us.cjs.map} +1 -1
  43. package/dist/bar.cjs +1 -1
  44. package/dist/bar.d.cts +2 -1
  45. package/dist/bar.d.ts +2 -1
  46. package/dist/bar.js +1 -2
  47. package/dist/calendar-BSvO8nRb.d.cts +106 -0
  48. package/dist/calendar-BXgIX5H1.js +502 -0
  49. package/dist/calendar-BXgIX5H1.js.map +1 -0
  50. package/dist/calendar-Bq3vFzPl.d.ts +106 -0
  51. package/dist/calendar-DAFXjV99.cjs +507 -0
  52. package/dist/calendar-DAFXjV99.cjs.map +1 -0
  53. package/dist/calendar.cjs +3 -0
  54. package/dist/calendar.d.cts +3 -0
  55. package/dist/calendar.d.ts +3 -0
  56. package/dist/calendar.js +1 -0
  57. package/dist/{candlestick-D_vV0_XZ.d.ts → candlestick-B3WcLzph.d.ts} +3 -6
  58. package/dist/{candlestick-__pXl_pV.d.cts → candlestick-BcomxeVG.d.cts} +3 -6
  59. package/dist/{candlestick-DuXwAFID.js → candlestick-BtT9glp9.js} +19 -18
  60. package/dist/{candlestick-DuXwAFID.js.map → candlestick-BtT9glp9.js.map} +1 -1
  61. package/dist/{candlestick-B5r1w3kc.cjs → candlestick-CSmRuZ4v.cjs} +19 -18
  62. package/dist/{candlestick-B5r1w3kc.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
  63. package/dist/candlestick.cjs +4 -5
  64. package/dist/candlestick.d.cts +1 -1
  65. package/dist/candlestick.d.ts +1 -1
  66. package/dist/candlestick.js +4 -6
  67. package/dist/{cartesian-Cr0AF0nG.js → cartesian-BrPqb5Qn.js} +138 -264
  68. package/dist/cartesian-BrPqb5Qn.js.map +1 -0
  69. package/dist/{cartesian-BoDfgBCV.cjs → cartesian-DRSXHxWe.cjs} +162 -324
  70. package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
  71. package/dist/{chart-BF2CK9I_.js → chart-B6TTY4Kr.js} +120 -77
  72. package/dist/chart-B6TTY4Kr.js.map +1 -0
  73. package/dist/{chart-DyN7bcx8.d.ts → chart-CYrrUCi3.d.ts} +222 -102
  74. package/dist/{chart-D7ooEFnk.d.cts → chart-CbPzP5Dp.d.cts} +248 -102
  75. package/dist/{chart-CowF_lWY.cjs → chart-D_lyOy-M.cjs} +132 -83
  76. package/dist/chart-D_lyOy-M.cjs.map +1 -0
  77. package/dist/{circle-BQMuAfls.cjs → circle-Bwxy5j7B.cjs} +2 -3
  78. package/dist/{circle-BQMuAfls.cjs.map → circle-Bwxy5j7B.cjs.map} +1 -1
  79. package/dist/{circle-Z7YfCoCM.js → circle-YRDaOBpk.js} +2 -3
  80. package/dist/{circle-Z7YfCoCM.js.map → circle-YRDaOBpk.js.map} +1 -1
  81. package/dist/{clean-o1vDEhFV.js → clean-CkoQobGv.js} +3 -4
  82. package/dist/{clean-o1vDEhFV.js.map → clean-CkoQobGv.js.map} +1 -1
  83. package/dist/{clean-Byl6kzf0.cjs → clean-Die2iCNc.cjs} +8 -3
  84. package/dist/{clean-Byl6kzf0.cjs.map → clean-Die2iCNc.cjs.map} +1 -1
  85. package/dist/{core-D1vO1LrC.d.cts → core-9BnLEW4K.d.cts} +31 -72
  86. package/dist/{core-DcbemzGf.d.ts → core-C3qEppSm.d.ts} +10 -46
  87. package/dist/{core-CegR_j55.js → core-CQ0FaJ4G.js} +138 -99
  88. package/dist/core-CQ0FaJ4G.js.map +1 -0
  89. package/dist/{core-RzS9IQO5.cjs → core-D2PSked3.cjs} +139 -100
  90. package/dist/core-D2PSked3.cjs.map +1 -0
  91. package/dist/core.cjs +47 -33
  92. package/dist/core.d.cts +26 -21
  93. package/dist/core.d.ts +26 -21
  94. package/dist/core.js +31 -25
  95. package/dist/{dates-CG-FvioW.js → dates-DLe2Ww64.js} +4 -5
  96. package/dist/{dates-CG-FvioW.js.map → dates-DLe2Ww64.js.map} +1 -1
  97. package/dist/{dates-Btm7Zm6W.cjs → dates-DerXTb1J.cjs} +4 -5
  98. package/dist/{dates-Btm7Zm6W.cjs.map → dates-DerXTb1J.cjs.map} +1 -1
  99. package/dist/{decimate-tLhDk1ys.cjs → decimate-BS3x8g-f.cjs} +2 -3
  100. package/dist/{decimate-tLhDk1ys.cjs.map → decimate-BS3x8g-f.cjs.map} +1 -1
  101. package/dist/{decimate-BGg9XgF0.d.ts → decimate-BxxYBJJk.d.cts} +2 -5
  102. package/dist/{decimate-C87cl_Sp.js → decimate-CapfgiDY.js} +2 -3
  103. package/dist/{decimate-C87cl_Sp.js.map → decimate-CapfgiDY.js.map} +1 -1
  104. package/dist/{decimate-CNSpgGa5.d.cts → decimate-Du87fMLG.d.ts} +2 -5
  105. package/dist/decimate.cjs +3 -4
  106. package/dist/decimate.d.cts +1 -1
  107. package/dist/decimate.d.ts +1 -1
  108. package/dist/decimate.js +3 -4
  109. package/dist/{dom-CLF868Qs.cjs → dom-C33zvtPo.cjs} +5 -11
  110. package/dist/dom-C33zvtPo.cjs.map +1 -0
  111. package/dist/{dom-vP3IcMak.js → dom-CTse6Rvd.js} +5 -11
  112. package/dist/dom-CTse6Rvd.js.map +1 -0
  113. package/dist/{export-chart-BhhYgksr.cjs → export-chart-CPtXmZvi.cjs} +18 -14
  114. package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
  115. package/dist/{export-chart-9w8t3rjZ.js → export-chart-DoeiAyR2.js} +18 -14
  116. package/dist/export-chart-DoeiAyR2.js.map +1 -0
  117. package/dist/export.cjs +3 -5
  118. package/dist/export.cjs.map +1 -1
  119. package/dist/export.d.cts +8 -1
  120. package/dist/export.d.ts +8 -1
  121. package/dist/export.js +3 -4
  122. package/dist/{extent-BAMZo0Nq.js → extent-DOV8rs-6.js} +2 -3
  123. package/dist/{extent-BAMZo0Nq.js.map → extent-DOV8rs-6.js.map} +1 -1
  124. package/dist/{extent-DsFWvAHJ.cjs → extent-DuYDcvM9.cjs} +2 -3
  125. package/dist/{extent-DsFWvAHJ.cjs.map → extent-DuYDcvM9.cjs.map} +1 -1
  126. package/dist/{fade-D3NxH5Qg.js → fade-CDrQjnDz.js} +59 -83
  127. package/dist/fade-CDrQjnDz.js.map +1 -0
  128. package/dist/{fade-Cs74puQS.cjs → fade-CRqcKMWY.cjs} +59 -83
  129. package/dist/fade-CRqcKMWY.cjs.map +1 -0
  130. package/dist/{features-wASyHGic.js → features-B55rwpQC.js} +5 -4
  131. package/dist/features-B55rwpQC.js.map +1 -0
  132. package/dist/{features-BclHgg2W.cjs → features-DEDP5CEQ.cjs} +10 -3
  133. package/dist/features-DEDP5CEQ.cjs.map +1 -0
  134. package/dist/fit-BPyPRnsK.js +16 -0
  135. package/dist/fit-BPyPRnsK.js.map +1 -0
  136. package/dist/fit-D4MIIQQz.cjs +21 -0
  137. package/dist/fit-D4MIIQQz.cjs.map +1 -0
  138. package/dist/{format-B0yKXBTH.cjs → format-CAE5ruy6.cjs} +2 -3
  139. package/dist/{format-B0yKXBTH.cjs.map → format-CAE5ruy6.cjs.map} +1 -1
  140. package/dist/{format-lStwuc1L.js → format-it1kepFG.js} +2 -3
  141. package/dist/{format-lStwuc1L.js.map → format-it1kepFG.js.map} +1 -1
  142. package/dist/funnel-BdcfUkb5.d.ts +50 -0
  143. package/dist/funnel-CFEEulw_.cjs +244 -0
  144. package/dist/funnel-CFEEulw_.cjs.map +1 -0
  145. package/dist/funnel-CYCv8cq2.js +239 -0
  146. package/dist/funnel-CYCv8cq2.js.map +1 -0
  147. package/dist/funnel-CarOh8w_.d.cts +50 -0
  148. package/dist/funnel.cjs +3 -0
  149. package/dist/funnel.d.cts +3 -0
  150. package/dist/funnel.d.ts +3 -0
  151. package/dist/funnel.js +1 -0
  152. package/dist/{gauge-D-FYhuds.cjs → gauge-6HfDcLMJ.cjs} +35 -36
  153. package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
  154. package/dist/{gauge-Dh423FHh.js → gauge-DiTk5aWO.js} +35 -36
  155. package/dist/gauge-DiTk5aWO.js.map +1 -0
  156. package/dist/{gauge-zpia05t2.d.ts → gauge-Ds9k1UV2.d.cts} +5 -8
  157. package/dist/{gauge-DP_EB2z3.d.cts → gauge-Zy25jfps.d.ts} +5 -8
  158. package/dist/gauge.cjs +1 -1
  159. package/dist/gauge.d.cts +2 -1
  160. package/dist/gauge.d.ts +2 -1
  161. package/dist/gauge.js +1 -2
  162. package/dist/{heatmap-DSZ2bVIa.js → heatmap-C1v8bwpq.js} +43 -43
  163. package/dist/heatmap-C1v8bwpq.js.map +1 -0
  164. package/dist/{heatmap-BectCEeE.d.ts → heatmap-CJ-0dfhJ.d.cts} +4 -7
  165. package/dist/{heatmap-BK18EBgJ.cjs → heatmap-Dcc_bsoQ.cjs} +47 -47
  166. package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
  167. package/dist/{heatmap-CCso6m61.d.cts → heatmap-Jp5sHRTo.d.ts} +4 -7
  168. package/dist/heatmap.cjs +1 -1
  169. package/dist/heatmap.d.cts +2 -1
  170. package/dist/heatmap.d.ts +2 -1
  171. package/dist/heatmap.js +1 -2
  172. package/dist/{hydrate-DDNIHYv_.js → hydrate-BB3MlR36.js} +3 -4
  173. package/dist/{hydrate-DDNIHYv_.js.map → hydrate-BB3MlR36.js.map} +1 -1
  174. package/dist/{hydrate-CzfxLfTv.d.ts → hydrate-BtAZf_5K.d.cts} +2 -5
  175. package/dist/{hydrate-CTTmQy0x.d.cts → hydrate-OjM1pIUG.d.ts} +2 -5
  176. package/dist/{hydrate-CxwTXDqO.cjs → hydrate-m0I5m6ue.cjs} +3 -4
  177. package/dist/hydrate-m0I5m6ue.cjs.map +1 -0
  178. package/dist/hydrate.cjs +3 -4
  179. package/dist/hydrate.cjs.map +1 -1
  180. package/dist/hydrate.d.cts +1 -1
  181. package/dist/hydrate.d.ts +1 -1
  182. package/dist/hydrate.js +3 -4
  183. package/dist/index.cjs +72 -56
  184. package/dist/index.cjs.map +1 -1
  185. package/dist/index.d.cts +28 -28
  186. package/dist/index.d.ts +28 -28
  187. package/dist/index.js +52 -44
  188. package/dist/index.js.map +1 -1
  189. package/dist/interaction-DXYSjgnP.cjs +32 -0
  190. package/dist/interaction-DXYSjgnP.cjs.map +1 -0
  191. package/dist/interaction-En1KlwFO.js +21 -0
  192. package/dist/interaction-En1KlwFO.js.map +1 -0
  193. package/dist/{layout-CtMBhNd9.cjs → layout-Cfg9x1k2.cjs} +45 -3
  194. package/dist/layout-Cfg9x1k2.cjs.map +1 -0
  195. package/dist/{layout-B3hiqVEw.js → layout-DqAte3H8.js} +34 -4
  196. package/dist/layout-DqAte3H8.js.map +1 -0
  197. package/dist/{line-CN4uZ9ZX.d.ts → line-Bpr5uVLQ.d.ts} +4 -7
  198. package/dist/{line-B3Ed6u7j.js → line-CxR4tg1Q.js} +49 -38
  199. package/dist/line-CxR4tg1Q.js.map +1 -0
  200. package/dist/{line-fQbtP_jL.cjs → line-YiCuhVMI.cjs} +49 -38
  201. package/dist/line-YiCuhVMI.cjs.map +1 -0
  202. package/dist/{line-W7VD_qs1.d.cts → line-vyWO030v.d.cts} +4 -7
  203. package/dist/line.cjs +4 -5
  204. package/dist/line.cjs.map +1 -1
  205. package/dist/line.d.cts +1 -1
  206. package/dist/line.d.ts +1 -1
  207. package/dist/line.js +4 -6
  208. package/dist/{log-CaofN3-n.d.ts → log-CI41TmcU.d.cts} +1 -6
  209. package/dist/{log-CaofN3-n.d.cts → log-CI41TmcU.d.ts} +1 -6
  210. package/dist/{log-axis-83rSpvL5.cjs → log-axis-DdRNyAq8.cjs} +6 -8
  211. package/dist/{log-axis-83rSpvL5.cjs.map → log-axis-DdRNyAq8.cjs.map} +1 -1
  212. package/dist/{log-axis-B_uvvOFc.js → log-axis-DhthtHFk.js} +6 -8
  213. package/dist/{log-axis-B_uvvOFc.js.map → log-axis-DhthtHFk.js.map} +1 -1
  214. package/dist/log.cjs +3 -5
  215. package/dist/log.cjs.map +1 -1
  216. package/dist/log.d.cts +1 -1
  217. package/dist/log.d.ts +1 -1
  218. package/dist/log.js +3 -4
  219. package/dist/map-49FcfdmJ.d.cts +156 -0
  220. package/dist/map-BMC61J-P.d.ts +156 -0
  221. package/dist/map-BqrZ80vT.cjs +818 -0
  222. package/dist/map-BqrZ80vT.cjs.map +1 -0
  223. package/dist/map-C15NC7kW.js +807 -0
  224. package/dist/map-C15NC7kW.js.map +1 -0
  225. package/dist/map.cjs +4 -0
  226. package/dist/map.d.cts +3 -0
  227. package/dist/map.d.ts +3 -0
  228. package/dist/map.js +1 -0
  229. package/dist/maps/world.cjs +875 -0
  230. package/dist/maps/world.cjs.map +1 -0
  231. package/dist/maps/world.d.cts +2 -0
  232. package/dist/maps/world.d.ts +2 -0
  233. package/dist/maps/world.js +874 -0
  234. package/dist/maps/world.js.map +1 -0
  235. package/dist/{morph-CqYDu1bY.cjs → morph-3I1Nf_tR.cjs} +4 -5
  236. package/dist/morph-3I1Nf_tR.cjs.map +1 -0
  237. package/dist/{morph-BMxz3X2b.d.ts → morph-Dh7gJkV4.d.cts} +1 -4
  238. package/dist/{morph-BMxz3X2b.d.cts → morph-Dh7gJkV4.d.ts} +1 -4
  239. package/dist/{morph-Bgg-24l8.js → morph-GfBab-b3.js} +4 -5
  240. package/dist/{morph-Bgg-24l8.js.map → morph-GfBab-b3.js.map} +1 -1
  241. package/dist/morph.cjs +3 -4
  242. package/dist/morph.cjs.map +1 -1
  243. package/dist/morph.d.cts +1 -1
  244. package/dist/morph.d.ts +1 -1
  245. package/dist/morph.js +3 -4
  246. package/dist/{named-BWWb5LQJ.cjs → named-BBASc8dW.cjs} +2 -3
  247. package/dist/{named-BWWb5LQJ.cjs.map → named-BBASc8dW.cjs.map} +1 -1
  248. package/dist/{named-DE15TOgh.js → named-BOiBah6I.js} +2 -3
  249. package/dist/{named-DE15TOgh.js.map → named-BOiBah6I.js.map} +1 -1
  250. package/dist/others-DBIGE6jr.js +57 -0
  251. package/dist/others-DBIGE6jr.js.map +1 -0
  252. package/dist/others-DBO4Kjwl.d.ts +29 -0
  253. package/dist/others-WfjCsjqT.cjs +68 -0
  254. package/dist/others-WfjCsjqT.cjs.map +1 -0
  255. package/dist/others-ls5eKtZ4.d.cts +31 -0
  256. package/dist/{parliament-Dw0sOERi.js → parliament-BKN6ikBJ.js} +36 -36
  257. package/dist/parliament-BKN6ikBJ.js.map +1 -0
  258. package/dist/{parliament-1Zv2Xh0D.d.ts → parliament-C7V8UJj1.d.cts} +5 -8
  259. package/dist/{parliament-DdrLVZwt.d.cts → parliament-Cz9n_DoK.d.ts} +5 -8
  260. package/dist/{parliament-CpWnoEvG.cjs → parliament-DhxAaIZ3.cjs} +36 -36
  261. package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
  262. package/dist/parliament.cjs +1 -1
  263. package/dist/parliament.d.cts +2 -1
  264. package/dist/parliament.d.ts +2 -1
  265. package/dist/parliament.js +1 -2
  266. package/dist/{path-CwB28da0.d.ts → path-YeUiOfG8.d.cts} +1 -4
  267. package/dist/{path-CwB28da0.d.cts → path-YeUiOfG8.d.ts} +1 -4
  268. package/dist/{patterns-DtgcnA8o.js → patterns-BMUINoka.js} +4 -5
  269. package/dist/{patterns-DtgcnA8o.js.map → patterns-BMUINoka.js.map} +1 -1
  270. package/dist/{patterns-LfcQAWCy.cjs → patterns-Dw7OMD_2.cjs} +4 -5
  271. package/dist/{patterns-LfcQAWCy.cjs.map → patterns-Dw7OMD_2.cjs.map} +1 -1
  272. package/dist/patterns.cjs +3 -5
  273. package/dist/patterns.cjs.map +1 -1
  274. package/dist/patterns.d.cts +5 -1
  275. package/dist/patterns.d.ts +5 -1
  276. package/dist/patterns.js +3 -4
  277. package/dist/percentage-bar-BChkTRoz.cjs +164 -0
  278. package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
  279. package/dist/percentage-bar-CaInxrL8.js +159 -0
  280. package/dist/percentage-bar-CaInxrL8.js.map +1 -0
  281. package/dist/percentage-bar-R1--2grK.d.cts +58 -0
  282. package/dist/percentage-bar-cSeiLdwU.d.ts +58 -0
  283. package/dist/percentage-bar.cjs +3 -0
  284. package/dist/percentage-bar.d.cts +3 -0
  285. package/dist/percentage-bar.d.ts +3 -0
  286. package/dist/percentage-bar.js +1 -0
  287. package/dist/{pie-BF9yI5mE.d.cts → pie-BQQkvy1N.d.ts} +11 -11
  288. package/dist/{pie-DzUXDTcn.js → pie-Bd8wyrtY.js} +52 -55
  289. package/dist/pie-Bd8wyrtY.js.map +1 -0
  290. package/dist/{pie-BxTZt6Go.cjs → pie-BseZlCgP.cjs} +52 -55
  291. package/dist/pie-BseZlCgP.cjs.map +1 -0
  292. package/dist/{pie-5z1fDdKO.d.ts → pie-vD5-g8je.d.cts} +11 -11
  293. package/dist/pie.cjs +1 -1
  294. package/dist/pie.d.cts +2 -1
  295. package/dist/pie.d.ts +2 -1
  296. package/dist/pie.js +1 -2
  297. package/dist/{point-shapes-CGl4dugc.cjs → point-shapes-BRawRM78.cjs} +24 -24
  298. package/dist/point-shapes-BRawRM78.cjs.map +1 -0
  299. package/dist/{point-shapes-DI84NNpI.js → point-shapes-DI6GhcI7.js} +19 -25
  300. package/dist/point-shapes-DI6GhcI7.js.map +1 -0
  301. package/dist/point-shapes.cjs +7 -6
  302. package/dist/point-shapes.cjs.map +1 -1
  303. package/dist/point-shapes.d.cts +6 -2
  304. package/dist/point-shapes.d.ts +6 -2
  305. package/dist/point-shapes.js +8 -7
  306. package/dist/point-shapes.js.map +1 -1
  307. package/dist/{radar-1-EryihA.d.ts → radar-7I6hsY_h.d.cts} +4 -7
  308. package/dist/{radar-CYPab_I4.js → radar-D6XqkFWQ.js} +25 -27
  309. package/dist/radar-D6XqkFWQ.js.map +1 -0
  310. package/dist/{radar-CoGUNNSb.cjs → radar-DjISDnSf.cjs} +26 -28
  311. package/dist/radar-DjISDnSf.cjs.map +1 -0
  312. package/dist/{radar-DBW4O0Vt.d.cts → radar-vLxilcr4.d.ts} +4 -7
  313. package/dist/radar.cjs +1 -1
  314. package/dist/radar.d.cts +2 -1
  315. package/dist/radar.d.ts +2 -1
  316. package/dist/radar.js +1 -2
  317. package/dist/rect-CZTNvMlf.js +11 -0
  318. package/dist/rect-CZTNvMlf.js.map +1 -0
  319. package/dist/rect-DPr9QRxl.cjs +16 -0
  320. package/dist/rect-DPr9QRxl.cjs.map +1 -0
  321. package/dist/{sankey-Bacx4fVe.cjs → sankey-0CSp_Er9.cjs} +100 -95
  322. package/dist/sankey-0CSp_Er9.cjs.map +1 -0
  323. package/dist/{sankey-OV_WoPrl.d.ts → sankey-7As41Fo4.d.ts} +4 -7
  324. package/dist/{sankey-B4PNKusJ.js → sankey-Dp4CuLVe.js} +100 -95
  325. package/dist/sankey-Dp4CuLVe.js.map +1 -0
  326. package/dist/{sankey-DuGI3Qc5.d.cts → sankey-DqiuxUx7.d.cts} +4 -7
  327. package/dist/sankey.cjs +1 -1
  328. package/dist/sankey.d.cts +2 -1
  329. package/dist/sankey.d.ts +2 -1
  330. package/dist/sankey.js +1 -2
  331. package/dist/{scatter-DbxLyZX0.d.cts → scatter-BXkXGgM_.d.ts} +14 -9
  332. package/dist/{scatter-DgMN9zRy.cjs → scatter-Bwkblr4L.cjs} +47 -42
  333. package/dist/scatter-Bwkblr4L.cjs.map +1 -0
  334. package/dist/{scatter-kgtgR318.js → scatter-DCMAtt5L.js} +45 -40
  335. package/dist/scatter-DCMAtt5L.js.map +1 -0
  336. package/dist/{scatter-BqzgJqdX.d.ts → scatter-DL0zAV09.d.cts} +14 -9
  337. package/dist/scatter.cjs +1 -1
  338. package/dist/scatter.d.cts +2 -1
  339. package/dist/scatter.d.ts +2 -1
  340. package/dist/scatter.js +1 -2
  341. package/dist/{sparkline-BfyO_oNM.d.ts → sparkline-BElUSd0r.d.ts} +5 -8
  342. package/dist/{sparkline-BS9-hltA.cjs → sparkline-BMSuEPHP.cjs} +22 -23
  343. package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
  344. package/dist/{sparkline-BQzt27Fr.js → sparkline-NDmq90kP.js} +22 -23
  345. package/dist/sparkline-NDmq90kP.js.map +1 -0
  346. package/dist/{sparkline-CWlJDKyh.d.cts → sparkline-RYly7bR0.d.cts} +5 -8
  347. package/dist/sparkline.cjs +1 -1
  348. package/dist/sparkline.d.cts +2 -1
  349. package/dist/sparkline.d.ts +2 -1
  350. package/dist/sparkline.js +1 -2
  351. package/dist/{stack-DVhJWaki.cjs → stack-BO4624CY.cjs} +3 -4
  352. package/dist/{stack-DVhJWaki.cjs.map → stack-BO4624CY.cjs.map} +1 -1
  353. package/dist/{stack-CpR6RGKd.d.ts → stack-BTWYIwLO.d.cts} +2 -4
  354. package/dist/{stack-CpR6RGKd.d.cts → stack-DR0eQTsB.d.ts} +1 -4
  355. package/dist/{stack-DRbwTeF3.js → stack-jVKvg2x_.js} +3 -4
  356. package/dist/{stack-DRbwTeF3.js.map → stack-jVKvg2x_.js.map} +1 -1
  357. package/dist/style.css +1 -1
  358. package/dist/{sweep-CbfR7--d.js → sweep-BpRPlhs6.js} +5 -6
  359. package/dist/{sweep-CbfR7--d.js.map → sweep-BpRPlhs6.js.map} +1 -1
  360. package/dist/{sweep-DaTEDDuC.cjs → sweep-Dnp6LDBz.cjs} +5 -6
  361. package/dist/sweep-Dnp6LDBz.cjs.map +1 -0
  362. package/dist/{time-CNVnt-B2.d.cts → time-B4oxWHQI.d.cts} +2 -7
  363. package/dist/{time-CHjiY9Q4.d.ts → time-DRIDgv2a.d.ts} +2 -7
  364. package/dist/{time-axis-VSX34_Tb.cjs → time-axis-B3VekUfX.cjs} +11 -11
  365. package/dist/{time-axis-VSX34_Tb.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
  366. package/dist/{time-axis-Bc9eHX1r.js → time-axis-CLjqOakA.js} +10 -10
  367. package/dist/{time-axis-Bc9eHX1r.js.map → time-axis-CLjqOakA.js.map} +1 -1
  368. package/dist/time.cjs +4 -6
  369. package/dist/time.cjs.map +1 -1
  370. package/dist/time.d.cts +1 -1
  371. package/dist/time.d.ts +1 -1
  372. package/dist/time.js +4 -5
  373. package/dist/treemap-25vHO_UK.d.cts +65 -0
  374. package/dist/treemap-BCXUbixd.d.ts +65 -0
  375. package/dist/treemap-C4glsx-g.js +293 -0
  376. package/dist/treemap-C4glsx-g.js.map +1 -0
  377. package/dist/treemap-CZk8kKFD.cjs +298 -0
  378. package/dist/treemap-CZk8kKFD.cjs.map +1 -0
  379. package/dist/treemap.cjs +3 -0
  380. package/dist/treemap.d.cts +3 -0
  381. package/dist/treemap.d.ts +3 -0
  382. package/dist/treemap.js +1 -0
  383. package/dist/{tween-BCYd0RTY.js → tween-BdQqUmmv.js} +2 -3
  384. package/dist/{tween-BCYd0RTY.js.map → tween-BdQqUmmv.js.map} +1 -1
  385. package/dist/{tween-CIGBlryn.cjs → tween-c3aOmfKE.cjs} +2 -3
  386. package/dist/{tween-CIGBlryn.cjs.map → tween-c3aOmfKE.cjs.map} +1 -1
  387. package/dist/{value-labels-IZIQPhfk.js → value-labels-C7GrhOXJ.js} +30 -10
  388. package/dist/value-labels-C7GrhOXJ.js.map +1 -0
  389. package/dist/{value-labels-B0WJoJ7x.cjs → value-labels-DzaKIWKp.cjs} +30 -10
  390. package/dist/value-labels-DzaKIWKp.cjs.map +1 -0
  391. package/dist/value-labels.cjs +3 -5
  392. package/dist/value-labels.cjs.map +1 -1
  393. package/dist/value-labels.d.cts +5 -1
  394. package/dist/value-labels.d.ts +5 -1
  395. package/dist/value-labels.js +3 -4
  396. package/dist/{vnode-CkQ27Cxe.cjs → vnode-ClAiw28x.cjs} +2 -3
  397. package/dist/{vnode-CkQ27Cxe.cjs.map → vnode-ClAiw28x.cjs.map} +1 -1
  398. package/dist/{vnode-BUflsBsa.d.ts → vnode-Du2cC8Fm.d.cts} +1 -4
  399. package/dist/{vnode-BUflsBsa.d.cts → vnode-Du2cC8Fm.d.ts} +1 -4
  400. package/dist/{vnode-tCWItoUH.js → vnode-_EMUqysL.js} +2 -3
  401. package/dist/{vnode-tCWItoUH.js.map → vnode-_EMUqysL.js.map} +1 -1
  402. package/package.json +94 -214
  403. package/dist/bar-C-7zR2qp.cjs.map +0 -1
  404. package/dist/bar-jZEoao74.js.map +0 -1
  405. package/dist/cartesian-BoDfgBCV.cjs.map +0 -1
  406. package/dist/cartesian-Cr0AF0nG.js.map +0 -1
  407. package/dist/chart-BF2CK9I_.js.map +0 -1
  408. package/dist/chart-CowF_lWY.cjs.map +0 -1
  409. package/dist/core-CegR_j55.js.map +0 -1
  410. package/dist/core-RzS9IQO5.cjs.map +0 -1
  411. package/dist/dom-CLF868Qs.cjs.map +0 -1
  412. package/dist/dom-vP3IcMak.js.map +0 -1
  413. package/dist/export-chart-9w8t3rjZ.js.map +0 -1
  414. package/dist/export-chart-BhhYgksr.cjs.map +0 -1
  415. package/dist/fade-Cs74puQS.cjs.map +0 -1
  416. package/dist/fade-D3NxH5Qg.js.map +0 -1
  417. package/dist/features-BclHgg2W.cjs.map +0 -1
  418. package/dist/features-wASyHGic.js.map +0 -1
  419. package/dist/gauge-D-FYhuds.cjs.map +0 -1
  420. package/dist/gauge-Dh423FHh.js.map +0 -1
  421. package/dist/heatmap-BK18EBgJ.cjs.map +0 -1
  422. package/dist/heatmap-DSZ2bVIa.js.map +0 -1
  423. package/dist/hydrate-CxwTXDqO.cjs.map +0 -1
  424. package/dist/layout-B3hiqVEw.js.map +0 -1
  425. package/dist/layout-CtMBhNd9.cjs.map +0 -1
  426. package/dist/line-B3Ed6u7j.js.map +0 -1
  427. package/dist/line-fQbtP_jL.cjs.map +0 -1
  428. package/dist/morph-CqYDu1bY.cjs.map +0 -1
  429. package/dist/parliament-CpWnoEvG.cjs.map +0 -1
  430. package/dist/parliament-Dw0sOERi.js.map +0 -1
  431. package/dist/pie-BxTZt6Go.cjs.map +0 -1
  432. package/dist/pie-DzUXDTcn.js.map +0 -1
  433. package/dist/point-shapes-CGl4dugc.cjs.map +0 -1
  434. package/dist/point-shapes-DI84NNpI.js.map +0 -1
  435. package/dist/radar-CYPab_I4.js.map +0 -1
  436. package/dist/radar-CoGUNNSb.cjs.map +0 -1
  437. package/dist/sankey-B4PNKusJ.js.map +0 -1
  438. package/dist/sankey-Bacx4fVe.cjs.map +0 -1
  439. package/dist/scatter-DgMN9zRy.cjs.map +0 -1
  440. package/dist/scatter-kgtgR318.js.map +0 -1
  441. package/dist/sparkline-BQzt27Fr.js.map +0 -1
  442. package/dist/sparkline-BS9-hltA.cjs.map +0 -1
  443. package/dist/sweep-DaTEDDuC.cjs.map +0 -1
  444. package/dist/value-labels-B0WJoJ7x.cjs.map +0 -1
  445. package/dist/value-labels-IZIQPhfk.js.map +0 -1
package/dist/export.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as register } from "./features-wASyHGic.js";
2
- import { n as exportImage, r as exportSVG, t as downloadChart } from "./export-chart-9w8t3rjZ.js";
3
- //#region src/export.ts
1
+ import { n as exportImage, r as exportSVG, t as downloadChart } from "./export-chart-DoeiAyR2.js";
2
+ import { i as register } from "./features-B55rwpQC.js";
3
+ // src/export.ts
4
4
  /**
5
5
  * Standalone entry: `import { exportSVG, exportImage, downloadChart } from '@tabler/charts/export'`
6
6
  * saves a rendered chart as a standalone SVG or an image. Importing it also
@@ -9,7 +9,6 @@ import { n as exportImage, r as exportSVG, t as downloadChart } from "./export-c
9
9
  * plugin installed on the core.
10
10
  */
11
11
  register({ export: downloadChart });
12
- //#endregion
13
12
  export { downloadChart, exportImage, exportSVG };
14
13
 
15
14
  //# sourceMappingURL=export.js.map
@@ -1,4 +1,4 @@
1
- //#region src/scales/extent.ts
1
+ // src/scales/extent.ts
2
2
  /**
3
3
  * Minimum and maximum of `values`, skipping `null`, `undefined` and
4
4
  * non-finite numbers. Returns `undefined` when nothing is left.
@@ -13,7 +13,6 @@ function extent(values) {
13
13
  }
14
14
  return min <= max ? [min, max] : void 0;
15
15
  }
16
- //#endregion
17
16
  export { extent as t };
18
17
 
19
- //# sourceMappingURL=extent-BAMZo0Nq.js.map
18
+ //# sourceMappingURL=extent-DOV8rs-6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extent-BAMZo0Nq.js","names":[],"sources":["../src/scales/extent.ts"],"sourcesContent":["/**\n * Minimum and maximum of `values`, skipping `null`, `undefined` and\n * non-finite numbers. Returns `undefined` when nothing is left.\n */\nexport function extent(values: Iterable<number | null | undefined>): [number, number] | undefined {\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n for (const value of values) {\n if (value == null || !Number.isFinite(value)) continue\n if (value < min) min = value\n if (value > max) max = value\n }\n return min <= max ? [min, max] : undefined\n}\n"],"mappings":";;;;;AAIA,SAAgB,OAAO,QAA2E;CAChG,IAAI,MAAM,OAAO;CACjB,IAAI,MAAM,OAAO;CACjB,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG;EAC9C,IAAI,QAAQ,KAAK,MAAM;EACvB,IAAI,QAAQ,KAAK,MAAM;CACzB;CACA,OAAO,OAAO,MAAM,CAAC,KAAK,GAAG,IAAI,KAAA;AACnC"}
1
+ {"version":3,"file":"extent-DOV8rs-6.js","names":[],"sources":["../src/scales/extent.ts"],"sourcesContent":["/**\n * Minimum and maximum of `values`, skipping `null`, `undefined` and\n * non-finite numbers. Returns `undefined` when nothing is left.\n */\nexport function extent(values: Iterable<number | null | undefined>): [number, number] | undefined {\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n for (const value of values) {\n if (value == null || !Number.isFinite(value)) continue\n if (value < min) min = value\n if (value > max) max = value\n }\n return min <= max ? [min, max] : undefined\n}\n"],"mappings":";;;;;AAIA,SAAgB,OAAO,QAA2E;CAChG,IAAI,MAAM,OAAO;CACjB,IAAI,MAAM,OAAO;CACjB,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG;EAC9C,IAAI,QAAQ,KAAK,MAAM;EACvB,IAAI,QAAQ,KAAK,MAAM;CACzB;CACA,OAAO,OAAO,MAAM,CAAC,KAAK,GAAG,IAAI,KAAA;AACnC"}
@@ -1,4 +1,4 @@
1
- //#region src/scales/extent.ts
1
+ // src/scales/extent.ts
2
2
  /**
3
3
  * Minimum and maximum of `values`, skipping `null`, `undefined` and
4
4
  * non-finite numbers. Returns `undefined` when nothing is left.
@@ -13,7 +13,6 @@ function extent(values) {
13
13
  }
14
14
  return min <= max ? [min, max] : void 0;
15
15
  }
16
- //#endregion
17
16
  Object.defineProperty(exports, "extent", {
18
17
  enumerable: true,
19
18
  get: function() {
@@ -21,4 +20,4 @@ Object.defineProperty(exports, "extent", {
21
20
  }
22
21
  });
23
22
 
24
- //# sourceMappingURL=extent-DsFWvAHJ.cjs.map
23
+ //# sourceMappingURL=extent-DuYDcvM9.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extent-DsFWvAHJ.cjs","names":[],"sources":["../src/scales/extent.ts"],"sourcesContent":["/**\n * Minimum and maximum of `values`, skipping `null`, `undefined` and\n * non-finite numbers. Returns `undefined` when nothing is left.\n */\nexport function extent(values: Iterable<number | null | undefined>): [number, number] | undefined {\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n for (const value of values) {\n if (value == null || !Number.isFinite(value)) continue\n if (value < min) min = value\n if (value > max) max = value\n }\n return min <= max ? [min, max] : undefined\n}\n"],"mappings":";;;;;AAIA,SAAgB,OAAO,QAA2E;CAChG,IAAI,MAAM,OAAO;CACjB,IAAI,MAAM,OAAO;CACjB,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG;EAC9C,IAAI,QAAQ,KAAK,MAAM;EACvB,IAAI,QAAQ,KAAK,MAAM;CACzB;CACA,OAAO,OAAO,MAAM,CAAC,KAAK,GAAG,IAAI,KAAA;AACnC"}
1
+ {"version":3,"file":"extent-DuYDcvM9.cjs","names":[],"sources":["../src/scales/extent.ts"],"sourcesContent":["/**\n * Minimum and maximum of `values`, skipping `null`, `undefined` and\n * non-finite numbers. Returns `undefined` when nothing is left.\n */\nexport function extent(values: Iterable<number | null | undefined>): [number, number] | undefined {\n let min = Number.POSITIVE_INFINITY\n let max = Number.NEGATIVE_INFINITY\n for (const value of values) {\n if (value == null || !Number.isFinite(value)) continue\n if (value < min) min = value\n if (value > max) max = value\n }\n return min <= max ? [min, max] : undefined\n}\n"],"mappings":";;;;;AAIA,SAAgB,OAAO,QAA2E;CAChG,IAAI,MAAM,OAAO;CACjB,IAAI,MAAM,OAAO;CACjB,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,SAAS,QAAQ,CAAC,OAAO,SAAS,KAAK,GAAG;EAC9C,IAAI,QAAQ,KAAK,MAAM;EACvB,IAAI,QAAQ,KAAK,MAAM;CACzB;CACA,OAAO,OAAO,MAAM,CAAC,KAAK,GAAG,IAAI,KAAA;AACnC"}
@@ -1,99 +1,68 @@
1
- import { t as h } from "./vnode-tCWItoUH.js";
2
- //#region 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
- };
1
+ import { t as h } from "./vnode-_EMUqysL.js";
2
+ // src/shapes/path.ts
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,17 +132,18 @@ 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
- //#endregion
169
- //#region src/components/fade.ts
146
+ // src/components/fade.ts
170
147
  /**
171
148
  * A vertical luminance mask shared by all gradient areas of a chart (line, area, sparkline). Areas keep their
172
149
  * series color from CSS; the mask only fades them, with stop opacities read
@@ -194,7 +171,6 @@ function fadeMask(id) {
194
171
  fill: `url(#${id}-gradient)`
195
172
  }));
196
173
  }
197
- //#endregion
198
174
  export { areaPath as n, linePath as r, fadeMask as t };
199
175
 
200
- //# sourceMappingURL=fade-D3NxH5Qg.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,EAAE,IAAI,EAAE,EAAE;CACxB;CACA,OAAO;AACT;;AAGA,MAAM,QAAwC;CAAE,MAAM;CAAK,eAAe;CAAG,cAAc;AAAE;AAE7F,SAAS,O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C,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
- const require_vnode = require("./vnode-CkQ27Cxe.cjs");
2
- //#region 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
- };
1
+ const require_vnode = require("./vnode-ClAiw28x.cjs");
2
+ // src/shapes/path.ts
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,17 +132,18 @@ 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
- //#endregion
169
- //#region src/components/fade.ts
146
+ // src/components/fade.ts
170
147
  /**
171
148
  * A vertical luminance mask shared by all gradient areas of a chart (line, area, sparkline). Areas keep their
172
149
  * series color from CSS; the mask only fades them, with stop opacities read
@@ -194,7 +171,6 @@ function fadeMask(id) {
194
171
  fill: `url(#${id}-gradient)`
195
172
  }));
196
173
  }
197
- //#endregion
198
174
  Object.defineProperty(exports, "areaPath", {
199
175
  enumerable: true,
200
176
  get: function() {
@@ -214,4 +190,4 @@ Object.defineProperty(exports, "linePath", {
214
190
  }
215
191
  });
216
192
 
217
- //# sourceMappingURL=fade-Cs74puQS.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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CAAC,GAAG;EACjE,KAAK,KACH,IACA,QACE,IAAI,KAAK,MAAM,OAAO,EAAQ,GAC9B,KACF,GACA,OACA,IACF;EAEA,MAAM,SAAS,IAAI,KAAK,MAAM,CAAE,OAAO,EAAE,CAAQ,IAAI,OAAO,CAAC,CAAC,CAAU,CAAC,CAAC,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"}
@@ -1,9 +1,11 @@
1
- //#region src/features.ts
1
+ // src/features.ts
2
2
  const features = {};
3
3
  /** Register optional features (idempotent). */
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,7 +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
- //#endregion
23
- 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 };
24
25
 
25
- //# sourceMappingURL=features-wASyHGic.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 { 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 { timeAxis } from './charts/time-axis.ts'\nimport type { downloadChart } from './export-chart.ts'\nimport type { Interaction } from './interaction.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`) 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 /** 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 /** 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":";AA4DA,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"}
@@ -1,9 +1,11 @@
1
- //#region src/features.ts
1
+ // src/features.ts
2
2
  const features = {};
3
3
  /** Register optional features (idempotent). */
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,7 +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
- //#endregion
23
24
  Object.defineProperty(exports, "addPost", {
24
25
  enumerable: true,
25
26
  get: function() {
@@ -44,5 +45,11 @@ Object.defineProperty(exports, "register", {
44
45
  return register;
45
46
  }
46
47
  });
48
+ Object.defineProperty(exports, "swatchShape", {
49
+ enumerable: true,
50
+ get: function() {
51
+ return swatchShape;
52
+ }
53
+ });
47
54
 
48
- //# sourceMappingURL=features-BclHgg2W.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 { 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 { timeAxis } from './charts/time-axis.ts'\nimport type { downloadChart } from './export-chart.ts'\nimport type { Interaction } from './interaction.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`) 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 /** 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 /** 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":";AA4DA,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"}