@tabler/charts 0.2.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 (364) hide show
  1. package/README.md +74 -4
  2. package/dist/{annotations-D0YQ0IoA.js → annotations-BQ8l-qHs.js} +3 -3
  3. package/dist/{annotations-D0YQ0IoA.js.map → annotations-BQ8l-qHs.js.map} +1 -1
  4. package/dist/{annotations-DdRdeBUB.cjs → annotations-CpCWA29b.cjs} +3 -3
  5. package/dist/{annotations-DdRdeBUB.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
  6. package/dist/annotations.cjs +2 -2
  7. package/dist/annotations.js +2 -2
  8. package/dist/{area-d11XePuw.d.ts → area-DEFQm_SQ.d.ts} +2 -2
  9. package/dist/{area-4eRs3c0K.cjs → area-DYdQ_sMV.cjs} +3 -3
  10. package/dist/{area-4eRs3c0K.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
  11. package/dist/{area-0-L1bG9B.js → area-WdtfqvhX.js} +3 -3
  12. package/dist/{area-0-L1bG9B.js.map → area-WdtfqvhX.js.map} +1 -1
  13. package/dist/{area-CJX9219z.d.cts → area-h_FvieFb.d.cts} +2 -2
  14. package/dist/area.cjs +1 -1
  15. package/dist/area.d.cts +1 -1
  16. package/dist/area.d.ts +1 -1
  17. package/dist/area.js +1 -1
  18. package/dist/axis-MMaVoSWB.js +235 -0
  19. package/dist/axis-MMaVoSWB.js.map +1 -0
  20. package/dist/axis-YfAerNBA.cjs +300 -0
  21. package/dist/axis-YfAerNBA.cjs.map +1 -0
  22. package/dist/{bar-BNZ3GhIw.js → bar-BOcRcArc.js} +74 -56
  23. package/dist/bar-BOcRcArc.js.map +1 -0
  24. package/dist/{bar-Da6dE_nI.cjs → bar-CVkOJ7WA.cjs} +76 -58
  25. package/dist/bar-CVkOJ7WA.cjs.map +1 -0
  26. package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
  27. package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
  28. package/dist/{bar-XwzM6Pb0.d.ts → bar-D9B_arKf.d.ts} +1 -1
  29. package/dist/{bar-BDLR4p9c.d.cts → bar-DZCQ-kyf.d.cts} +2 -2
  30. package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
  31. package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
  32. package/dist/bar.cjs +1 -1
  33. package/dist/bar.d.cts +1 -1
  34. package/dist/bar.d.ts +1 -1
  35. package/dist/bar.js +1 -1
  36. package/dist/calendar-BSvO8nRb.d.cts +106 -0
  37. package/dist/calendar-BXgIX5H1.js +502 -0
  38. package/dist/calendar-BXgIX5H1.js.map +1 -0
  39. package/dist/calendar-Bq3vFzPl.d.ts +106 -0
  40. package/dist/calendar-DAFXjV99.cjs +507 -0
  41. package/dist/calendar-DAFXjV99.cjs.map +1 -0
  42. package/dist/calendar.cjs +3 -0
  43. package/dist/calendar.d.cts +3 -0
  44. package/dist/calendar.d.ts +3 -0
  45. package/dist/calendar.js +1 -0
  46. package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-B3WcLzph.d.ts} +1 -1
  47. package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-BcomxeVG.d.cts} +1 -1
  48. package/dist/{candlestick-BHQkQfxH.js → candlestick-BtT9glp9.js} +16 -14
  49. package/dist/{candlestick-BHQkQfxH.js.map → candlestick-BtT9glp9.js.map} +1 -1
  50. package/dist/{candlestick-CYCQXgky.cjs → candlestick-CSmRuZ4v.cjs} +16 -14
  51. package/dist/{candlestick-CYCQXgky.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
  52. package/dist/candlestick.cjs +3 -3
  53. package/dist/candlestick.d.cts +1 -1
  54. package/dist/candlestick.d.ts +1 -1
  55. package/dist/candlestick.js +3 -3
  56. package/dist/{cartesian-CI2x6N7N.js → cartesian-BrPqb5Qn.js} +122 -248
  57. package/dist/cartesian-BrPqb5Qn.js.map +1 -0
  58. package/dist/{cartesian-DV02PsBe.cjs → cartesian-DRSXHxWe.cjs} +146 -308
  59. package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
  60. package/dist/{chart-DWn9v6qw.js → chart-B6TTY4Kr.js} +94 -62
  61. package/dist/chart-B6TTY4Kr.js.map +1 -0
  62. package/dist/{chart-QilhWP8Z.d.ts → chart-CYrrUCi3.d.ts} +193 -56
  63. package/dist/{chart-kqFMEwDo.d.cts → chart-CbPzP5Dp.d.cts} +193 -56
  64. package/dist/{chart-e2VqomCI.cjs → chart-D_lyOy-M.cjs} +106 -68
  65. package/dist/chart-D_lyOy-M.cjs.map +1 -0
  66. package/dist/{core-PAX5ogLk.d.cts → core-9BnLEW4K.d.cts} +24 -20
  67. package/dist/{core-DRUCk67j.d.ts → core-C3qEppSm.d.ts} +7 -6
  68. package/dist/{core-BKRQvPAT.js → core-CQ0FaJ4G.js} +112 -65
  69. package/dist/core-CQ0FaJ4G.js.map +1 -0
  70. package/dist/{core-DIOC61up.cjs → core-D2PSked3.cjs} +113 -66
  71. package/dist/core-D2PSked3.cjs.map +1 -0
  72. package/dist/core.cjs +41 -31
  73. package/dist/core.d.cts +20 -17
  74. package/dist/core.d.ts +20 -17
  75. package/dist/core.js +27 -23
  76. package/dist/{dates-C2RzY3rE.js → dates-DLe2Ww64.js} +2 -2
  77. package/dist/{dates-C2RzY3rE.js.map → dates-DLe2Ww64.js.map} +1 -1
  78. package/dist/{dates-DurEr9WT.cjs → dates-DerXTb1J.cjs} +2 -2
  79. package/dist/{dates-DurEr9WT.cjs.map → dates-DerXTb1J.cjs.map} +1 -1
  80. package/dist/decimate.cjs +1 -1
  81. package/dist/decimate.js +1 -1
  82. package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
  83. package/dist/dom-C33zvtPo.cjs.map +1 -0
  84. package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
  85. package/dist/dom-CTse6Rvd.js.map +1 -0
  86. package/dist/{export-chart-mYgEfK-L.cjs → export-chart-CPtXmZvi.cjs} +17 -12
  87. package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
  88. package/dist/{export-chart-83UYH48t.js → export-chart-DoeiAyR2.js} +17 -12
  89. package/dist/export-chart-DoeiAyR2.js.map +1 -0
  90. package/dist/export.cjs +2 -2
  91. package/dist/export.d.cts +1 -1
  92. package/dist/export.d.ts +1 -1
  93. package/dist/export.js +2 -2
  94. package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
  95. package/dist/fade-CDrQjnDz.js.map +1 -0
  96. package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
  97. package/dist/fade-CRqcKMWY.cjs.map +1 -0
  98. package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
  99. package/dist/features-B55rwpQC.js.map +1 -0
  100. package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
  101. package/dist/features-DEDP5CEQ.cjs.map +1 -0
  102. package/dist/fit-BPyPRnsK.js +16 -0
  103. package/dist/fit-BPyPRnsK.js.map +1 -0
  104. package/dist/fit-D4MIIQQz.cjs +21 -0
  105. package/dist/fit-D4MIIQQz.cjs.map +1 -0
  106. package/dist/funnel-BdcfUkb5.d.ts +50 -0
  107. package/dist/funnel-CFEEulw_.cjs +244 -0
  108. package/dist/funnel-CFEEulw_.cjs.map +1 -0
  109. package/dist/funnel-CYCv8cq2.js +239 -0
  110. package/dist/funnel-CYCv8cq2.js.map +1 -0
  111. package/dist/funnel-CarOh8w_.d.cts +50 -0
  112. package/dist/funnel.cjs +3 -0
  113. package/dist/funnel.d.cts +3 -0
  114. package/dist/funnel.d.ts +3 -0
  115. package/dist/funnel.js +1 -0
  116. package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
  117. package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
  118. package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
  119. package/dist/gauge-DiTk5aWO.js.map +1 -0
  120. package/dist/{gauge-BSist7My.d.cts → gauge-Ds9k1UV2.d.cts} +1 -1
  121. package/dist/{gauge-0VJuAHWF.d.ts → gauge-Zy25jfps.d.ts} +1 -1
  122. package/dist/gauge.cjs +1 -1
  123. package/dist/gauge.d.cts +1 -1
  124. package/dist/gauge.d.ts +1 -1
  125. package/dist/gauge.js +1 -1
  126. package/dist/{heatmap-19BGJTKF.js → heatmap-C1v8bwpq.js} +35 -33
  127. package/dist/heatmap-C1v8bwpq.js.map +1 -0
  128. package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-CJ-0dfhJ.d.cts} +1 -1
  129. package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dcc_bsoQ.cjs} +39 -37
  130. package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
  131. package/dist/{heatmap-59lmClj9.d.ts → heatmap-Jp5sHRTo.d.ts} +1 -1
  132. package/dist/heatmap.cjs +1 -1
  133. package/dist/heatmap.d.cts +1 -1
  134. package/dist/heatmap.d.ts +1 -1
  135. package/dist/heatmap.js +1 -1
  136. package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
  137. package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
  138. package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
  139. package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
  140. package/dist/hydrate.cjs +2 -2
  141. package/dist/hydrate.js +2 -2
  142. package/dist/index.cjs +55 -42
  143. package/dist/index.cjs.map +1 -1
  144. package/dist/index.d.cts +21 -18
  145. package/dist/index.d.ts +21 -18
  146. package/dist/index.js +41 -34
  147. package/dist/index.js.map +1 -1
  148. package/dist/interaction-DXYSjgnP.cjs +32 -0
  149. package/dist/interaction-DXYSjgnP.cjs.map +1 -0
  150. package/dist/interaction-En1KlwFO.js +21 -0
  151. package/dist/interaction-En1KlwFO.js.map +1 -0
  152. package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
  153. package/dist/layout-Cfg9x1k2.cjs.map +1 -0
  154. package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
  155. package/dist/layout-DqAte3H8.js.map +1 -0
  156. package/dist/{line-DtSh7HQU.d.ts → line-Bpr5uVLQ.d.ts} +1 -1
  157. package/dist/{line-DO66LtwH.js → line-CxR4tg1Q.js} +46 -34
  158. package/dist/line-CxR4tg1Q.js.map +1 -0
  159. package/dist/{line-Dbt6KFRK.cjs → line-YiCuhVMI.cjs} +46 -34
  160. package/dist/line-YiCuhVMI.cjs.map +1 -0
  161. package/dist/{line-_rNdeKmS.d.cts → line-vyWO030v.d.cts} +2 -3
  162. package/dist/line.cjs +3 -3
  163. package/dist/line.d.cts +1 -1
  164. package/dist/line.d.ts +1 -1
  165. package/dist/line.js +3 -3
  166. package/dist/log.cjs +1 -1
  167. package/dist/log.js +1 -1
  168. package/dist/map-49FcfdmJ.d.cts +156 -0
  169. package/dist/map-BMC61J-P.d.ts +156 -0
  170. package/dist/map-BqrZ80vT.cjs +818 -0
  171. package/dist/map-BqrZ80vT.cjs.map +1 -0
  172. package/dist/map-C15NC7kW.js +807 -0
  173. package/dist/map-C15NC7kW.js.map +1 -0
  174. package/dist/map.cjs +4 -0
  175. package/dist/map.d.cts +3 -0
  176. package/dist/map.d.ts +3 -0
  177. package/dist/map.js +1 -0
  178. package/dist/maps/world.cjs +875 -0
  179. package/dist/maps/world.cjs.map +1 -0
  180. package/dist/maps/world.d.cts +2 -0
  181. package/dist/maps/world.d.ts +2 -0
  182. package/dist/maps/world.js +874 -0
  183. package/dist/maps/world.js.map +1 -0
  184. package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
  185. package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
  186. package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
  187. package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
  188. package/dist/morph.cjs +2 -2
  189. package/dist/morph.js +2 -2
  190. package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
  191. package/dist/others-DBIGE6jr.js.map +1 -0
  192. package/dist/others-DBO4Kjwl.d.ts +29 -0
  193. package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
  194. package/dist/others-WfjCsjqT.cjs.map +1 -0
  195. package/dist/others-ls5eKtZ4.d.cts +31 -0
  196. package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
  197. package/dist/parliament-BKN6ikBJ.js.map +1 -0
  198. package/dist/{parliament-CgsVnWEe.d.cts → parliament-C7V8UJj1.d.cts} +1 -1
  199. package/dist/{parliament-CLCI7tUO.d.ts → parliament-Cz9n_DoK.d.ts} +1 -1
  200. package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
  201. package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
  202. package/dist/parliament.cjs +1 -1
  203. package/dist/parliament.d.cts +1 -1
  204. package/dist/parliament.d.ts +1 -1
  205. package/dist/parliament.js +1 -1
  206. package/dist/{patterns-CufKZYhm.js → patterns-BMUINoka.js} +2 -2
  207. package/dist/{patterns-CufKZYhm.js.map → patterns-BMUINoka.js.map} +1 -1
  208. package/dist/{patterns-D3-wQagb.cjs → patterns-Dw7OMD_2.cjs} +2 -2
  209. package/dist/{patterns-D3-wQagb.cjs.map → patterns-Dw7OMD_2.cjs.map} +1 -1
  210. package/dist/patterns.cjs +2 -2
  211. package/dist/patterns.d.cts +1 -1
  212. package/dist/patterns.d.ts +1 -1
  213. package/dist/patterns.js +2 -2
  214. package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
  215. package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
  216. package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
  217. package/dist/percentage-bar-CaInxrL8.js.map +1 -0
  218. package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-R1--2grK.d.cts} +10 -14
  219. package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-cSeiLdwU.d.ts} +10 -14
  220. package/dist/percentage-bar.cjs +1 -1
  221. package/dist/percentage-bar.d.cts +1 -1
  222. package/dist/percentage-bar.d.ts +1 -1
  223. package/dist/percentage-bar.js +1 -1
  224. package/dist/{pie-CFptILSm.d.ts → pie-BQQkvy1N.d.ts} +7 -13
  225. package/dist/{pie-CVsc-6qD.js → pie-Bd8wyrtY.js} +45 -44
  226. package/dist/pie-Bd8wyrtY.js.map +1 -0
  227. package/dist/{pie-BpjvSPnz.cjs → pie-BseZlCgP.cjs} +45 -44
  228. package/dist/pie-BseZlCgP.cjs.map +1 -0
  229. package/dist/{pie-BXg2gNpb.d.cts → pie-vD5-g8je.d.cts} +7 -13
  230. package/dist/pie.cjs +1 -1
  231. package/dist/pie.d.cts +1 -1
  232. package/dist/pie.d.ts +1 -1
  233. package/dist/pie.js +1 -1
  234. package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
  235. package/dist/point-shapes-BRawRM78.cjs.map +1 -0
  236. package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
  237. package/dist/point-shapes-DI6GhcI7.js.map +1 -0
  238. package/dist/point-shapes.cjs +6 -4
  239. package/dist/point-shapes.cjs.map +1 -1
  240. package/dist/point-shapes.d.cts +2 -2
  241. package/dist/point-shapes.d.ts +2 -2
  242. package/dist/point-shapes.js +7 -5
  243. package/dist/point-shapes.js.map +1 -1
  244. package/dist/{radar-D1-lItDy.d.cts → radar-7I6hsY_h.d.cts} +1 -1
  245. package/dist/{radar-BR-mumDd.js → radar-D6XqkFWQ.js} +21 -22
  246. package/dist/radar-D6XqkFWQ.js.map +1 -0
  247. package/dist/{radar-HPDrIdzc.cjs → radar-DjISDnSf.cjs} +22 -23
  248. package/dist/radar-DjISDnSf.cjs.map +1 -0
  249. package/dist/{radar-BC9Skgpj.d.ts → radar-vLxilcr4.d.ts} +1 -1
  250. package/dist/radar.cjs +1 -1
  251. package/dist/radar.d.cts +1 -1
  252. package/dist/radar.d.ts +1 -1
  253. package/dist/radar.js +1 -1
  254. package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
  255. package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
  256. package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
  257. package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
  258. package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
  259. package/dist/sankey-0CSp_Er9.cjs.map +1 -0
  260. package/dist/{sankey-D_v7KxnJ.d.ts → sankey-7As41Fo4.d.ts} +1 -1
  261. package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
  262. package/dist/sankey-Dp4CuLVe.js.map +1 -0
  263. package/dist/{sankey-Dk7jUt8x.d.cts → sankey-DqiuxUx7.d.cts} +1 -1
  264. package/dist/sankey.cjs +1 -1
  265. package/dist/sankey.d.cts +1 -1
  266. package/dist/sankey.d.ts +1 -1
  267. package/dist/sankey.js +1 -1
  268. package/dist/{scatter-CXEsioOJ.d.ts → scatter-BXkXGgM_.d.ts} +7 -1
  269. package/dist/{scatter-DVqB_fP9.cjs → scatter-Bwkblr4L.cjs} +40 -38
  270. package/dist/scatter-Bwkblr4L.cjs.map +1 -0
  271. package/dist/{scatter-C0TWjFpW.js → scatter-DCMAtt5L.js} +38 -36
  272. package/dist/scatter-DCMAtt5L.js.map +1 -0
  273. package/dist/{scatter-DZeEIfyo.d.cts → scatter-DL0zAV09.d.cts} +7 -1
  274. package/dist/scatter.cjs +1 -1
  275. package/dist/scatter.d.cts +1 -1
  276. package/dist/scatter.d.ts +1 -1
  277. package/dist/scatter.js +1 -1
  278. package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-BElUSd0r.d.ts} +1 -1
  279. package/dist/{sparkline-B39NA0Mi.cjs → sparkline-BMSuEPHP.cjs} +13 -15
  280. package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
  281. package/dist/{sparkline-XO_TqCNP.js → sparkline-NDmq90kP.js} +13 -15
  282. package/dist/sparkline-NDmq90kP.js.map +1 -0
  283. package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-RYly7bR0.d.cts} +1 -1
  284. package/dist/sparkline.cjs +1 -1
  285. package/dist/sparkline.d.cts +1 -1
  286. package/dist/sparkline.d.ts +1 -1
  287. package/dist/sparkline.js +1 -1
  288. package/dist/{stack-BgPzoQmv.cjs → stack-BO4624CY.cjs} +2 -2
  289. package/dist/{stack-BgPzoQmv.cjs.map → stack-BO4624CY.cjs.map} +1 -1
  290. package/dist/{stack-Dagxq7l2.d.cts → stack-BTWYIwLO.d.cts} +1 -1
  291. package/dist/{stack-2H2Gfs1Q.js → stack-jVKvg2x_.js} +2 -2
  292. package/dist/{stack-2H2Gfs1Q.js.map → stack-jVKvg2x_.js.map} +1 -1
  293. package/dist/style.css +1 -1
  294. package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-B3VekUfX.cjs} +4 -3
  295. package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
  296. package/dist/{time-axis-FLONo54E.js → time-axis-CLjqOakA.js} +3 -2
  297. package/dist/{time-axis-FLONo54E.js.map → time-axis-CLjqOakA.js.map} +1 -1
  298. package/dist/time.cjs +3 -3
  299. package/dist/time.js +3 -3
  300. package/dist/{treemap-BAkhmVQc.d.cts → treemap-25vHO_UK.d.cts} +12 -2
  301. package/dist/{treemap-BNpxFBao.d.ts → treemap-BCXUbixd.d.ts} +12 -2
  302. package/dist/{treemap-CQdavQ9u.js → treemap-C4glsx-g.js} +20 -25
  303. package/dist/treemap-C4glsx-g.js.map +1 -0
  304. package/dist/{treemap-BWpEUlDh.cjs → treemap-CZk8kKFD.cjs} +21 -26
  305. package/dist/treemap-CZk8kKFD.cjs.map +1 -0
  306. package/dist/treemap.cjs +1 -1
  307. package/dist/treemap.d.cts +1 -1
  308. package/dist/treemap.d.ts +1 -1
  309. package/dist/treemap.js +1 -1
  310. package/dist/{value-labels-BBuSi4i0.js → value-labels-C7GrhOXJ.js} +25 -5
  311. package/dist/value-labels-C7GrhOXJ.js.map +1 -0
  312. package/dist/{value-labels-BV9keAuL.cjs → value-labels-DzaKIWKp.cjs} +25 -5
  313. package/dist/value-labels-DzaKIWKp.cjs.map +1 -0
  314. package/dist/value-labels.cjs +2 -2
  315. package/dist/value-labels.d.cts +1 -1
  316. package/dist/value-labels.d.ts +1 -1
  317. package/dist/value-labels.js +2 -2
  318. package/package.json +93 -233
  319. package/dist/bar-BNZ3GhIw.js.map +0 -1
  320. package/dist/bar-Da6dE_nI.cjs.map +0 -1
  321. package/dist/cartesian-CI2x6N7N.js.map +0 -1
  322. package/dist/cartesian-DV02PsBe.cjs.map +0 -1
  323. package/dist/chart-DWn9v6qw.js.map +0 -1
  324. package/dist/chart-e2VqomCI.cjs.map +0 -1
  325. package/dist/core-BKRQvPAT.js.map +0 -1
  326. package/dist/core-DIOC61up.cjs.map +0 -1
  327. package/dist/dom-CuceR8gt.js.map +0 -1
  328. package/dist/dom-D_g13XWY.cjs.map +0 -1
  329. package/dist/export-chart-83UYH48t.js.map +0 -1
  330. package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
  331. package/dist/fade-DVTkhrFU.cjs.map +0 -1
  332. package/dist/fade-GGxcBdss.js.map +0 -1
  333. package/dist/features-BMxkqCyS.js.map +0 -1
  334. package/dist/features-DCXEvoya.cjs.map +0 -1
  335. package/dist/gauge-DXkjXNCD.cjs.map +0 -1
  336. package/dist/gauge-ts0kqN1-.js.map +0 -1
  337. package/dist/heatmap-19BGJTKF.js.map +0 -1
  338. package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
  339. package/dist/layout-DmrrLjwN.js.map +0 -1
  340. package/dist/layout-JY2aR-yE.cjs.map +0 -1
  341. package/dist/line-DO66LtwH.js.map +0 -1
  342. package/dist/line-Dbt6KFRK.cjs.map +0 -1
  343. package/dist/others-DWdK7vKp.cjs.map +0 -1
  344. package/dist/others-J7NCAMA0.js.map +0 -1
  345. package/dist/parliament-Cru4IcuM.js.map +0 -1
  346. package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
  347. package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
  348. package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
  349. package/dist/pie-BpjvSPnz.cjs.map +0 -1
  350. package/dist/pie-CVsc-6qD.js.map +0 -1
  351. package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
  352. package/dist/point-shapes-DD2Ektzm.js.map +0 -1
  353. package/dist/radar-BR-mumDd.js.map +0 -1
  354. package/dist/radar-HPDrIdzc.cjs.map +0 -1
  355. package/dist/sankey-D6JeZfK5.js.map +0 -1
  356. package/dist/sankey-fCoo1cpz.cjs.map +0 -1
  357. package/dist/scatter-C0TWjFpW.js.map +0 -1
  358. package/dist/scatter-DVqB_fP9.cjs.map +0 -1
  359. package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
  360. package/dist/sparkline-XO_TqCNP.js.map +0 -1
  361. package/dist/treemap-BWpEUlDh.cjs.map +0 -1
  362. package/dist/treemap-CQdavQ9u.js.map +0 -1
  363. package/dist/value-labels-BBuSi4i0.js.map +0 -1
  364. package/dist/value-labels-BV9keAuL.cjs.map +0 -1
@@ -1,7 +1,8 @@
1
- import { a as ChartType } from "./chart-kqFMEwDo.cjs";
1
+ import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
2
2
  import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
3
3
  import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
5
+ import { n as WithSlices, t as SliceGrouping } from "./others-ls5eKtZ4.cjs";
5
6
  /** One segment of a percentage bar. */
6
7
  interface PercentageBarSegment {
7
8
  name: string;
@@ -19,24 +20,14 @@ interface PercentageBarSegment {
19
20
  /** Start hidden (toggle it back from the legend). */
20
21
  hidden?: boolean;
21
22
  }
22
- interface PercentageBarOptions {
23
+ interface PercentageBarOptions extends SliceGrouping {
23
24
  data: readonly PercentageBarSegment[];
24
25
  /**
25
26
  * Order of the segments along the bar: as in the data (`'data'`, the
26
27
  * default) or the largest first (`'size'`). Colors follow the data either
27
- * way, and the segment of the rest always comes last.
28
+ * way, and Others always comes last.
28
29
  */
29
30
  order?: "data" | "size";
30
- /**
31
- * The most segments drawn, the one for the rest included: with more entries
32
- * than that, the largest `maxSlices - 1` keep a segment of their own and
33
- * the others share one, named by `othersLabel`, at the end of the bar.
34
- * Defaults to `9` (the eight palette colors and the rest); `0` never
35
- * groups.
36
- */
37
- maxSlices?: number;
38
- /** Name of the segment that groups the rest. Defaults to `'Others'`. */
39
- othersLabel?: string;
40
31
  /** Space between segments in pixels, drawn as surface. Defaults to `2`. */
41
32
  gap?: number;
42
33
  /** Corner radius of the segments. Defaults to `4`. */
@@ -46,6 +37,11 @@ interface PercentageBarOptions {
46
37
  /** Extra space around the bar, in pixels. */
47
38
  padding?: InsetsInput;
48
39
  }
40
+ /**
41
+ * The chart model of a percentage bar: its options, with the segments of the
42
+ * data (nine at most by default, the one for the rest included).
43
+ */
44
+ type PercentageBarModel = WithSlices<PercentageBarOptions>;
49
45
  /**
50
46
  * Percentage bar: parts of a whole as segments of one horizontal bar, each as
51
47
  * wide as its share (a donut's ring unrolled, for a strip under a number).
@@ -58,5 +54,5 @@ interface PercentageBarOptions {
58
54
  * })
59
55
  * ```
60
56
  */
61
- declare const percentageBar: ChartType<PercentageBarOptions>;
57
+ declare const percentageBar: ChartType<PercentageBarOptions, PercentageBarModel>;
62
58
  export { PercentageBarSegment as n, percentageBar as r, PercentageBarOptions as t };
@@ -1,7 +1,8 @@
1
- import { a as ChartType } from "./chart-QilhWP8Z.js";
1
+ import { o as ChartType } from "./chart-CYrrUCi3.js";
2
2
  import { c as NumberFormat } from "./time-DRIDgv2a.js";
3
3
  import { a as InsetsInput } from "./annotations-B02GR_KU.js";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
5
+ import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
5
6
  /** One segment of a percentage bar. */
6
7
  interface PercentageBarSegment {
7
8
  name: string;
@@ -19,24 +20,14 @@ interface PercentageBarSegment {
19
20
  /** Start hidden (toggle it back from the legend). */
20
21
  hidden?: boolean;
21
22
  }
22
- interface PercentageBarOptions {
23
+ interface PercentageBarOptions extends SliceGrouping {
23
24
  data: readonly PercentageBarSegment[];
24
25
  /**
25
26
  * Order of the segments along the bar: as in the data (`'data'`, the
26
27
  * default) or the largest first (`'size'`). Colors follow the data either
27
- * way, and the segment of the rest always comes last.
28
+ * way, and Others always comes last.
28
29
  */
29
30
  order?: "data" | "size";
30
- /**
31
- * The most segments drawn, the one for the rest included: with more entries
32
- * than that, the largest `maxSlices - 1` keep a segment of their own and
33
- * the others share one, named by `othersLabel`, at the end of the bar.
34
- * Defaults to `9` (the eight palette colors and the rest); `0` never
35
- * groups.
36
- */
37
- maxSlices?: number;
38
- /** Name of the segment that groups the rest. Defaults to `'Others'`. */
39
- othersLabel?: string;
40
31
  /** Space between segments in pixels, drawn as surface. Defaults to `2`. */
41
32
  gap?: number;
42
33
  /** Corner radius of the segments. Defaults to `4`. */
@@ -46,6 +37,11 @@ interface PercentageBarOptions {
46
37
  /** Extra space around the bar, in pixels. */
47
38
  padding?: InsetsInput;
48
39
  }
40
+ /**
41
+ * The chart model of a percentage bar: its options, with the segments of the
42
+ * data (nine at most by default, the one for the rest included).
43
+ */
44
+ type PercentageBarModel = WithSlices<PercentageBarOptions>;
49
45
  /**
50
46
  * Percentage bar: parts of a whole as segments of one horizontal bar, each as
51
47
  * wide as its share (a donut's ring unrolled, for a strip under a number).
@@ -58,5 +54,5 @@ interface PercentageBarOptions {
58
54
  * })
59
55
  * ```
60
56
  */
61
- declare const percentageBar: ChartType<PercentageBarOptions>;
57
+ declare const percentageBar: ChartType<PercentageBarOptions, PercentageBarModel>;
62
58
  export { PercentageBarSegment as n, percentageBar as r, PercentageBarOptions as t };
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_percentage_bar = require("./percentage-bar-ybNS3goo.cjs");
2
+ const require_percentage_bar = require("./percentage-bar-BChkTRoz.cjs");
3
3
  exports.percentageBar = require_percentage_bar.percentageBar;
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { percentageBar } from '@tabler/charts/percentage-bar'`. */
2
- import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-tepMr7Hd.cjs";
2
+ import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-R1--2grK.cjs";
3
3
  export { type PercentageBarOptions, type PercentageBarSegment, percentageBar };
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { percentageBar } from '@tabler/charts/percentage-bar'`. */
2
- import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-nhTeakD_.js";
2
+ import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-cSeiLdwU.js";
3
3
  export { type PercentageBarOptions, type PercentageBarSegment, percentageBar };
@@ -1 +1 @@
1
- export { t as percentageBar } from "./percentage-bar-B6tNOqNn.js";
1
+ export { t as percentageBar } from "./percentage-bar-CaInxrL8.js";
@@ -1,7 +1,8 @@
1
- import { a as ChartType } from "./chart-QilhWP8Z.js";
1
+ import { o as ChartType } from "./chart-CYrrUCi3.js";
2
2
  import { c as NumberFormat } from "./time-DRIDgv2a.js";
3
3
  import { a as InsetsInput } from "./annotations-B02GR_KU.js";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
5
+ import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
5
6
  /** One slice of a pie or donut. */
6
7
  interface PieSlice {
7
8
  name: string;
@@ -19,17 +20,8 @@ interface PieSlice {
19
20
  /** Start hidden (toggle it back from the legend). */
20
21
  hidden?: boolean;
21
22
  }
22
- interface PieOptions {
23
+ interface PieOptions extends SliceGrouping {
23
24
  data: readonly PieSlice[];
24
- /**
25
- * The most slices drawn, the one for the rest included: with more entries
26
- * than that, the largest `maxSlices - 1` keep a slice of their own and the
27
- * others share one, named by `othersLabel`, after them. Defaults to `9`
28
- * (the eight palette colors and the rest); `0` never groups.
29
- */
30
- maxSlices?: number;
31
- /** Name of the slice that groups the rest. Defaults to `'Others'`. */
32
- othersLabel?: string;
33
25
  /** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
34
26
  innerRadius?: number;
35
27
  /** Gap between slices in pixels, drawn as surface. Defaults to `2`. */
@@ -51,6 +43,8 @@ interface PieOptions {
51
43
  /** Extra space around the pie, in pixels. */
52
44
  padding?: InsetsInput;
53
45
  }
46
+ /** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
47
+ type PieModel = WithSlices<PieOptions>;
54
48
  /**
55
49
  * Pie chart: parts of a whole as slices, in data order, clockwise from the top.
56
50
  *
@@ -58,7 +52,7 @@ interface PieOptions {
58
52
  * new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
59
53
  * ```
60
54
  */
61
- declare const pie: ChartType<PieOptions>;
55
+ declare const pie: ChartType<PieOptions, PieModel>;
62
56
  /** Donut chart: a pie with a hole showing the total (or your own `center`). */
63
- declare const donut: ChartType<PieOptions>;
57
+ declare const donut: ChartType<PieOptions, PieModel>;
64
58
  export { pie as i, PieSlice as n, donut as r, PieOptions as t };
@@ -1,18 +1,17 @@
1
- import { r as features } from "./features-BMxkqCyS.js";
2
1
  import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
3
- import { i as insets, r as innerRect } from "./layout-DmrrLjwN.js";
2
+ import { i as insets, r as innerRect } from "./layout-DqAte3H8.js";
4
3
  import { n as sweep, t as arcNode } from "./sweep-BpRPlhs6.js";
5
4
  import { i as padAngleForGap, n as arcCentroid, r as arcPathStable, t as DEG } from "./arc-B3V5IR0w.js";
6
5
  import { t as h } from "./vnode-_EMUqysL.js";
7
6
  import { n as cleanItems, t as cleanData } from "./clean-CkoQobGv.js";
8
7
  import { n as keyOf, t as groupAttrs } from "./named-BOiBah6I.js";
9
- import { n as groupSlices, t as groupLegend } from "./others-J7NCAMA0.js";
8
+ import { n as withSlices, t as slicesLegend } from "./others-DBIGE6jr.js";
10
9
  // src/charts/pie.ts
11
10
  /** Angles of the visible slices, clockwise from `startAngle`. */
12
- function layoutSlices(options, hidden) {
13
- const visible = groupSlices(options.data, options.maxSlices, options.othersLabel).filter((slice) => !hidden.has(keyOf(slice.data)));
11
+ function layoutSlices(model, hidden) {
12
+ const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)));
14
13
  const total = visible.reduce((sum, slice) => sum + slice.value, 0);
15
- let angle = (options.startAngle ?? 0) * DEG;
14
+ let angle = (model.startAngle ?? 0) * DEG;
16
15
  return {
17
16
  slices: visible.map((slice) => {
18
17
  const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
@@ -77,7 +76,8 @@ function renderPie(options, ctx, defaults) {
77
76
  },
78
77
  items: [item],
79
78
  seriesIndex: slice.index,
80
- mark: {
79
+ highlight: {
80
+ kind: "halo",
81
81
  d: arcPathStable({
82
82
  ...geometry(slice, outer + 2, outer + 6),
83
83
  cornerRadius: 2
@@ -106,42 +106,44 @@ function renderPie(options, ctx, defaults) {
106
106
  return position === -1 ? null : hitFor(drawn[position], position);
107
107
  }
108
108
  };
109
- ctx.onHitTest(interaction);
110
109
  const groups = slices.map((slice) => h("g", groupAttrs(slice.data, slice.index), arcNode("tc-slice", geometry(slice))));
111
110
  const center = options.center;
112
111
  const showCenter = inner > 0 && center !== false;
113
112
  const centerValue = showCenter ? center?.value ?? value(total) : "";
114
113
  const centerLabel = showCenter ? center?.label : void 0;
115
- return [h("g", {
116
- class: "tc-pie",
117
- style: `transform:translate(${cx}px,${cy}px)`
118
- }, total === 0 && h("path", {
119
- class: "tc-pie-track",
120
- d: arcPathStable({
121
- innerRadius: inner,
122
- outerRadius: outer,
123
- startAngle: 0,
124
- endAngle: Math.PI * 2
125
- })
126
- }), h("g", {
127
- class: "tc-pie-slices",
128
- style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
129
- }, groups)), showCenter && h("g", {
130
- class: "tc-pie-center",
131
- "aria-hidden": "true"
132
- }, h("text", {
133
- class: "tc-pie-value",
134
- x: cx,
135
- y: cy,
136
- dy: centerLabel ? "0" : "0.35em",
137
- "text-anchor": "middle"
138
- }, centerValue), centerLabel && h("text", {
139
- class: "tc-pie-label",
140
- x: cx,
141
- y: cy,
142
- dy: "1.6em",
143
- "text-anchor": "middle"
144
- }, centerLabel))];
114
+ return {
115
+ content: [h("g", {
116
+ class: "tc-pie",
117
+ style: `transform:translate(${cx}px,${cy}px)`
118
+ }, total === 0 && h("path", {
119
+ class: "tc-pie-track",
120
+ d: arcPathStable({
121
+ innerRadius: inner,
122
+ outerRadius: outer,
123
+ startAngle: 0,
124
+ endAngle: Math.PI * 2
125
+ })
126
+ }), h("g", {
127
+ class: "tc-pie-slices",
128
+ style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
129
+ }, groups)), showCenter && h("g", {
130
+ class: "tc-pie-center",
131
+ "aria-hidden": "true"
132
+ }, h("text", {
133
+ class: "tc-pie-value",
134
+ x: cx,
135
+ y: cy,
136
+ dy: centerLabel ? "0" : "0.35em",
137
+ "text-anchor": "middle"
138
+ }, centerValue), centerLabel && h("text", {
139
+ class: "tc-pie-label",
140
+ x: cx,
141
+ y: cy,
142
+ dy: "1.6em",
143
+ "text-anchor": "middle"
144
+ }, centerLabel))],
145
+ interaction
146
+ };
145
147
  }
146
148
  function pieTable(options, ctx) {
147
149
  const { slices, total } = layoutSlices(options, ctx.hidden);
@@ -167,11 +169,10 @@ function pieType(name, defaults) {
167
169
  return {
168
170
  name,
169
171
  clean: cleanData(cleanItems),
170
- render: (options, ctx) => {
171
- features.sweep = sweep;
172
- return renderPie(options, ctx, defaults);
173
- },
174
- legend: (options) => groupLegend(groupSlices(options.data, options.maxSlices, options.othersLabel)),
172
+ prepare: withSlices,
173
+ render: (options, ctx) => renderPie(options, ctx, defaults),
174
+ sweep,
175
+ legend: slicesLegend,
175
176
  table: pieTable,
176
177
  valueLabels: { marks: "slice" }
177
178
  };
@@ -194,4 +195,4 @@ const donut = pieType("donut", {
194
195
  });
195
196
  export { pie as n, donut as t };
196
197
 
197
- //# sourceMappingURL=pie-CVsc-6qD.js.map
198
+ //# sourceMappingURL=pie-Bd8wyrtY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pie-Bd8wyrtY.js","names":[],"sources":["../src/charts/pie.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO, padAngleForGap } from '../shapes/arc.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems } from './clean.ts'\nimport { groupAttrs, keyOf } from './named.ts'\nimport { type SliceGrouping, slicesLegend, type WithSlices, withSlices } from './others.ts'\n\n/** One slice of a pie or donut. */\nexport interface PieSlice {\n name: string\n /** Non-negative value; negative values count as zero. */\n value: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the slice group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface PieOptions extends SliceGrouping {\n data: readonly PieSlice[]\n /** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */\n innerRadius?: number\n /** Gap between slices in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the slices. Defaults to `0` (`4` for `donut`). */\n cornerRadius?: number\n /** Where the first slice starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Format of the values (tooltip, table, donut total). */\n format?: NumberFormat\n /**\n * Text in the donut hole: the total by default; `false` hides it, or give\n * your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the pie, in pixels. */\n padding?: InsetsInput\n}\n\n/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */\nexport type PieModel = WithSlices<PieOptions>\n\ninterface Slice {\n data: PieSlice\n index: number\n value: number\n startAngle: number\n endAngle: number\n}\n\n/** Angles of the visible slices, clockwise from `startAngle`. */\nfunction layoutSlices(\n model: PieModel,\n hidden: ReadonlySet<string>,\n): { slices: Slice[]; total: number } {\n const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)))\n const total = visible.reduce((sum, slice) => sum + slice.value, 0)\n let angle = (model.startAngle ?? 0) * DEG\n const slices = visible.map((slice) => {\n const sweep = total > 0 ? (slice.value / total) * Math.PI * 2 : 0\n const out: Slice = { ...slice, startAngle: angle, endAngle: angle + sweep }\n angle += sweep\n return out\n })\n return { slices, total }\n}\n\nfunction renderPie(\n options: PieModel,\n ctx: RenderContext,\n defaults: { inner: number; corner: number },\n) {\n const { width, height, locale } = ctx\n const gap = options.gap ?? 2\n const area = innerRect(width, height, insets(options.padding, 0))\n const outer = Math.max(0, Math.min(area.width, area.height) / 2 - HALO)\n const ratio = Math.min(0.95, Math.max(0, options.innerRadius ?? defaults.inner))\n const inner = outer * ratio\n const cornerRadius = options.cornerRadius ?? defaults.corner\n const cx = area.x + area.width / 2\n const cy = area.y + area.height / 2\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const drawn = slices.filter((slice) => slice.value > 0)\n // A single slice is a full ring: no gap to cut.\n // Rings get a pad angle, which keeps a constant gap width along the whole\n // edge. In a full pie every slice meets at the center, so a pad angle would\n // widen into a wedge: the gap is a surface-colored stroke instead.\n const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0\n const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const geometry = (slice: Slice, r0 = inner, r1 = outer) => ({\n innerRadius: r0,\n outerRadius: r1,\n startAngle: slice.startAngle,\n endAngle: slice.endAngle,\n padAngle,\n cornerRadius,\n })\n\n const hitFor = (slice: Slice, position: number): Hit => {\n const [x, y] = arcCentroid(geometry(slice))\n const item: HitItem = {\n name: slice.data.name,\n seriesIndex: slice.index,\n value: slice.value,\n text: `${value(slice.value)} (${share.format(total > 0 ? slice.value / total : 0)})`,\n x: cx + x,\n y: cy + y,\n }\n if (slice.data.color) item.color = slice.data.color\n return {\n index: position,\n label: slice.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: slice.index,\n // A thin halo just outside the slice.\n highlight: {\n kind: 'halo',\n d: arcPathStable({ ...geometry(slice, outer + 2, outer + 6), cornerRadius: 2 }),\n x: cx,\n y: cy,\n },\n }\n }\n\n const interaction: Interaction = {\n count: drawn.length,\n hitIndex: (position) => {\n const slice = drawn[position]\n return slice ? hitFor(slice, position) : null\n },\n hitTest(px, py) {\n const dx = px - cx\n const dy = py - cy\n const r = Math.hypot(dx, dy)\n if (r < inner - 2 || r > outer + HALO) return null\n const start = (options.startAngle ?? 0) * DEG\n const turn = Math.PI * 2\n // Clockwise angle from 12 o'clock, normalized into [start, start + turn).\n let angle = Math.atan2(dx, -dy)\n angle = start + ((((angle - start) % turn) + turn) % turn)\n const position = drawn.findIndex((s) => angle >= s.startAngle && angle < s.endAngle)\n return position === -1 ? null : hitFor(drawn[position] as Slice, position)\n },\n }\n\n const groups = slices.map((slice) =>\n h(\n 'g',\n groupAttrs(slice.data, slice.index),\n // The path keeps its arc, so new data sweeps slices around the center\n // (see `sweep`). An empty slice keeps its path, a line with no area in\n // the gap between its neighbors, to grow from there.\n arcNode('tc-slice', geometry(slice)),\n ),\n )\n\n const center = options.center\n const showCenter = inner > 0 && center !== false\n const centerValue = showCenter ? (center?.value ?? value(total)) : ''\n const centerLabel = showCenter ? center?.label : undefined\n\n const content = [\n h(\n 'g',\n { class: 'tc-pie', style: `transform:translate(${cx}px,${cy}px)` },\n total === 0 &&\n h('path', {\n class: 'tc-pie-track',\n d: arcPathStable({\n innerRadius: inner,\n outerRadius: outer,\n startAngle: 0,\n endAngle: Math.PI * 2,\n }),\n }),\n h(\n 'g',\n {\n class: 'tc-pie-slices',\n style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : undefined,\n },\n groups,\n ),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-pie-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-pie-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-pie-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n return { content, interaction }\n}\n\nfunction pieTable(options: PieModel, ctx: TableContext): DataTable {\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: slices.map((slice) => [\n slice.data.name,\n value(slice.value),\n share.format(total > 0 ? slice.value / total : 0),\n ]),\n }\n}\n\nfunction pieType(\n name: string,\n defaults: { inner: number; corner: number },\n): ChartType<PieOptions, PieModel> {\n return {\n name,\n clean: cleanData(cleanItems),\n prepare: withSlices,\n render: (options, ctx): RenderResult => renderPie(options, ctx, defaults),\n sweep,\n legend: slicesLegend,\n table: pieTable,\n valueLabels: { marks: 'slice' },\n }\n}\n\n/**\n * Pie chart: parts of a whole as slices, in data order, clockwise from the top.\n *\n * ```ts\n * new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })\n * ```\n */\nexport const pie: ChartType<PieOptions, PieModel> = pieType('pie', { inner: 0, corner: 0 })\n\n/** Donut chart: a pie with a hole showing the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;AA+DA,SAAS,aACP,OACA,QACoC;CACpC,MAAM,UAAU,MAAM,OAAO,QAAQ,UAAU,CAAC,OAAO,IAAI,MAAM,MAAM,IAAI,CAAC,CAAC;CAC7E,MAAM,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;CACjE,IAAI,SAAS,MAAM,cAAc,KAAK;CAOtC,OAAO;EAAE,QANM,QAAQ,KAAK,UAAU;GACpC,MAAM,QAAQ,QAAQ,IAAK,MAAM,QAAQ,QAAS,KAAK,KAAK,IAAI;GAChE,MAAM,MAAa;IAAE,GAAG;IAAO,YAAY;IAAO,UAAU,QAAQ;GAAM;GAC1E,SAAS;GACT,OAAO;EACT,CACc;EAAG;CAAM;AACzB;AAEA,SAAS,UACP,SACA,KACA,UACA;CACA,MAAM,EAAE,OAAO,QAAQ,WAAW;CAClC,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,OAAO,UAAU,OAAO,QAAQ,OAAO,QAAQ,SAAS,CA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MAAuC,QAAQ,OAAO;CAAE,OAAO;CAAG,QAAQ;AAAE,CAAC;;AAG1F,MAAa,QAAyC,QAAQ,SAAS;CAAE,OAAO;CAAM,QAAQ;AAAE,CAAC"}
@@ -1,18 +1,17 @@
1
- const require_features = require("./features-DCXEvoya.cjs");
2
1
  const require_format = require("./format-CAE5ruy6.cjs");
3
- const require_layout = require("./layout-JY2aR-yE.cjs");
2
+ const require_layout = require("./layout-Cfg9x1k2.cjs");
4
3
  const require_sweep = require("./sweep-Dnp6LDBz.cjs");
5
4
  const require_arc = require("./arc-CYhI62kO.cjs");
6
5
  const require_vnode = require("./vnode-ClAiw28x.cjs");
7
6
  const require_clean = require("./clean-Die2iCNc.cjs");
8
7
  const require_named = require("./named-BBASc8dW.cjs");
9
- const require_others = require("./others-DWdK7vKp.cjs");
8
+ const require_others = require("./others-WfjCsjqT.cjs");
10
9
  // src/charts/pie.ts
11
10
  /** Angles of the visible slices, clockwise from `startAngle`. */
12
- function layoutSlices(options, hidden) {
13
- const visible = require_others.groupSlices(options.data, options.maxSlices, options.othersLabel).filter((slice) => !hidden.has(require_named.keyOf(slice.data)));
11
+ function layoutSlices(model, hidden) {
12
+ const visible = model.slices.filter((slice) => !hidden.has(require_named.keyOf(slice.data)));
14
13
  const total = visible.reduce((sum, slice) => sum + slice.value, 0);
15
- let angle = (options.startAngle ?? 0) * require_arc.DEG;
14
+ let angle = (model.startAngle ?? 0) * require_arc.DEG;
16
15
  return {
17
16
  slices: visible.map((slice) => {
18
17
  const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
@@ -77,7 +76,8 @@ function renderPie(options, ctx, defaults) {
77
76
  },
78
77
  items: [item],
79
78
  seriesIndex: slice.index,
80
- mark: {
79
+ highlight: {
80
+ kind: "halo",
81
81
  d: require_arc.arcPathStable({
82
82
  ...geometry(slice, outer + 2, outer + 6),
83
83
  cornerRadius: 2
@@ -106,42 +106,44 @@ function renderPie(options, ctx, defaults) {
106
106
  return position === -1 ? null : hitFor(drawn[position], position);
107
107
  }
108
108
  };
109
- ctx.onHitTest(interaction);
110
109
  const groups = slices.map((slice) => require_vnode.h("g", require_named.groupAttrs(slice.data, slice.index), require_sweep.arcNode("tc-slice", geometry(slice))));
111
110
  const center = options.center;
112
111
  const showCenter = inner > 0 && center !== false;
113
112
  const centerValue = showCenter ? center?.value ?? value(total) : "";
114
113
  const centerLabel = showCenter ? center?.label : void 0;
115
- return [require_vnode.h("g", {
116
- class: "tc-pie",
117
- style: `transform:translate(${cx}px,${cy}px)`
118
- }, total === 0 && require_vnode.h("path", {
119
- class: "tc-pie-track",
120
- d: require_arc.arcPathStable({
121
- innerRadius: inner,
122
- outerRadius: outer,
123
- startAngle: 0,
124
- endAngle: Math.PI * 2
125
- })
126
- }), require_vnode.h("g", {
127
- class: "tc-pie-slices",
128
- style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
129
- }, groups)), showCenter && require_vnode.h("g", {
130
- class: "tc-pie-center",
131
- "aria-hidden": "true"
132
- }, require_vnode.h("text", {
133
- class: "tc-pie-value",
134
- x: cx,
135
- y: cy,
136
- dy: centerLabel ? "0" : "0.35em",
137
- "text-anchor": "middle"
138
- }, centerValue), centerLabel && require_vnode.h("text", {
139
- class: "tc-pie-label",
140
- x: cx,
141
- y: cy,
142
- dy: "1.6em",
143
- "text-anchor": "middle"
144
- }, centerLabel))];
114
+ return {
115
+ content: [require_vnode.h("g", {
116
+ class: "tc-pie",
117
+ style: `transform:translate(${cx}px,${cy}px)`
118
+ }, total === 0 && require_vnode.h("path", {
119
+ class: "tc-pie-track",
120
+ d: require_arc.arcPathStable({
121
+ innerRadius: inner,
122
+ outerRadius: outer,
123
+ startAngle: 0,
124
+ endAngle: Math.PI * 2
125
+ })
126
+ }), require_vnode.h("g", {
127
+ class: "tc-pie-slices",
128
+ style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
129
+ }, groups)), showCenter && require_vnode.h("g", {
130
+ class: "tc-pie-center",
131
+ "aria-hidden": "true"
132
+ }, require_vnode.h("text", {
133
+ class: "tc-pie-value",
134
+ x: cx,
135
+ y: cy,
136
+ dy: centerLabel ? "0" : "0.35em",
137
+ "text-anchor": "middle"
138
+ }, centerValue), centerLabel && require_vnode.h("text", {
139
+ class: "tc-pie-label",
140
+ x: cx,
141
+ y: cy,
142
+ dy: "1.6em",
143
+ "text-anchor": "middle"
144
+ }, centerLabel))],
145
+ interaction
146
+ };
145
147
  }
146
148
  function pieTable(options, ctx) {
147
149
  const { slices, total } = layoutSlices(options, ctx.hidden);
@@ -167,11 +169,10 @@ function pieType(name, defaults) {
167
169
  return {
168
170
  name,
169
171
  clean: require_clean.cleanData(require_clean.cleanItems),
170
- render: (options, ctx) => {
171
- require_features.features.sweep = require_sweep.sweep;
172
- return renderPie(options, ctx, defaults);
173
- },
174
- legend: (options) => require_others.groupLegend(require_others.groupSlices(options.data, options.maxSlices, options.othersLabel)),
172
+ prepare: require_others.withSlices,
173
+ render: (options, ctx) => renderPie(options, ctx, defaults),
174
+ sweep: require_sweep.sweep,
175
+ legend: require_others.slicesLegend,
175
176
  table: pieTable,
176
177
  valueLabels: { marks: "slice" }
177
178
  };
@@ -205,4 +206,4 @@ Object.defineProperty(exports, "pie", {
205
206
  }
206
207
  });
207
208
 
208
- //# sourceMappingURL=pie-BpjvSPnz.cjs.map
209
+ //# sourceMappingURL=pie-BseZlCgP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pie-BseZlCgP.cjs","names":["keyOf","DEG","innerRect","insets","padAngleForGap","formatNumber","getNumberFormat","arcCentroid","arcPathStable","h","groupAttrs","arcNode","cleanData","cleanItems","withSlices","sweep","slicesLegend"],"sources":["../src/charts/pie.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO, padAngleForGap } from '../shapes/arc.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems } from './clean.ts'\nimport { groupAttrs, keyOf } from './named.ts'\nimport { type SliceGrouping, slicesLegend, type WithSlices, withSlices } from './others.ts'\n\n/** One slice of a pie or donut. */\nexport interface PieSlice {\n name: string\n /** Non-negative value; negative values count as zero. */\n value: number\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Extra classes on the slice group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface PieOptions extends SliceGrouping {\n data: readonly PieSlice[]\n /** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */\n innerRadius?: number\n /** Gap between slices in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the slices. Defaults to `0` (`4` for `donut`). */\n cornerRadius?: number\n /** Where the first slice starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Format of the values (tooltip, table, donut total). */\n format?: NumberFormat\n /**\n * Text in the donut hole: the total by default; `false` hides it, or give\n * your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the pie, in pixels. */\n padding?: InsetsInput\n}\n\n/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */\nexport type PieModel = WithSlices<PieOptions>\n\ninterface Slice {\n data: PieSlice\n index: number\n value: number\n startAngle: number\n endAngle: number\n}\n\n/** Angles of the visible slices, clockwise from `startAngle`. */\nfunction layoutSlices(\n model: PieModel,\n hidden: ReadonlySet<string>,\n): { slices: Slice[]; total: number } {\n const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)))\n const total = visible.reduce((sum, slice) => sum + slice.value, 0)\n let angle = (model.startAngle ?? 0) * DEG\n const slices = visible.map((slice) => {\n const sweep = total > 0 ? (slice.value / total) * Math.PI * 2 : 0\n const out: Slice = { ...slice, startAngle: angle, endAngle: angle + sweep }\n angle += sweep\n return out\n })\n return { slices, total }\n}\n\nfunction renderPie(\n options: PieModel,\n ctx: RenderContext,\n defaults: { inner: number; corner: number },\n) {\n const { width, height, locale } = ctx\n const gap = options.gap ?? 2\n const area = innerRect(width, height, insets(options.padding, 0))\n const outer = Math.max(0, Math.min(area.width, area.height) / 2 - HALO)\n const ratio = Math.min(0.95, Math.max(0, options.innerRadius ?? defaults.inner))\n const inner = outer * ratio\n const cornerRadius = options.cornerRadius ?? defaults.corner\n const cx = area.x + area.width / 2\n const cy = area.y + area.height / 2\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const drawn = slices.filter((slice) => slice.value > 0)\n // A single slice is a full ring: no gap to cut.\n // Rings get a pad angle, which keeps a constant gap width along the whole\n // edge. In a full pie every slice meets at the center, so a pad angle would\n // widen into a wedge: the gap is a surface-colored stroke instead.\n const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0\n const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n\n const geometry = (slice: Slice, r0 = inner, r1 = outer) => ({\n innerRadius: r0,\n outerRadius: r1,\n startAngle: slice.startAngle,\n endAngle: slice.endAngle,\n padAngle,\n cornerRadius,\n })\n\n const hitFor = (slice: Slice, position: number): Hit => {\n const [x, y] = arcCentroid(geometry(slice))\n const item: HitItem = {\n name: slice.data.name,\n seriesIndex: slice.index,\n value: slice.value,\n text: `${value(slice.value)} (${share.format(total > 0 ? slice.value / total : 0)})`,\n x: cx + x,\n y: cy + y,\n }\n if (slice.data.color) item.color = slice.data.color\n return {\n index: position,\n label: slice.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: slice.index,\n // A thin halo just outside the slice.\n highlight: {\n kind: 'halo',\n d: arcPathStable({ ...geometry(slice, outer + 2, outer + 6), cornerRadius: 2 }),\n x: cx,\n y: cy,\n },\n }\n }\n\n const interaction: Interaction = {\n count: drawn.length,\n hitIndex: (position) => {\n const slice = drawn[position]\n return slice ? hitFor(slice, position) : null\n },\n hitTest(px, py) {\n const dx = px - cx\n const dy = py - cy\n const r = Math.hypot(dx, dy)\n if (r < inner - 2 || r > outer + HALO) return null\n const start = (options.startAngle ?? 0) * DEG\n const turn = Math.PI * 2\n // Clockwise angle from 12 o'clock, normalized into [start, start + turn).\n let angle = Math.atan2(dx, -dy)\n angle = start + ((((angle - start) % turn) + turn) % turn)\n const position = drawn.findIndex((s) => angle >= s.startAngle && angle < s.endAngle)\n return position === -1 ? null : hitFor(drawn[position] as Slice, position)\n },\n }\n\n const groups = slices.map((slice) =>\n h(\n 'g',\n groupAttrs(slice.data, slice.index),\n // The path keeps its arc, so new data sweeps slices around the center\n // (see `sweep`). An empty slice keeps its path, a line with no area in\n // the gap between its neighbors, to grow from there.\n arcNode('tc-slice', geometry(slice)),\n ),\n )\n\n const center = options.center\n const showCenter = inner > 0 && center !== false\n const centerValue = showCenter ? (center?.value ?? value(total)) : ''\n const centerLabel = showCenter ? center?.label : undefined\n\n const content = [\n h(\n 'g',\n { class: 'tc-pie', style: `transform:translate(${cx}px,${cy}px)` },\n total === 0 &&\n h('path', {\n class: 'tc-pie-track',\n d: arcPathStable({\n innerRadius: inner,\n outerRadius: outer,\n startAngle: 0,\n endAngle: Math.PI * 2,\n }),\n }),\n h(\n 'g',\n {\n class: 'tc-pie-slices',\n style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : undefined,\n },\n groups,\n ),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-pie-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-pie-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-pie-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n return { content, interaction }\n}\n\nfunction pieTable(options: PieModel, ctx: TableContext): DataTable {\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: slices.map((slice) => [\n slice.data.name,\n value(slice.value),\n share.format(total > 0 ? slice.value / total : 0),\n ]),\n }\n}\n\nfunction pieType(\n name: string,\n defaults: { inner: number; corner: number },\n): ChartType<PieOptions, PieModel> {\n return {\n name,\n clean: cleanData(cleanItems),\n prepare: withSlices,\n render: (options, ctx): RenderResult => renderPie(options, ctx, defaults),\n sweep,\n legend: slicesLegend,\n table: pieTable,\n valueLabels: { marks: 'slice' },\n }\n}\n\n/**\n * Pie chart: parts of a whole as slices, in data order, clockwise from the top.\n *\n * ```ts\n * new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })\n * ```\n */\nexport const pie: ChartType<PieOptions, PieModel> = pieType('pie', { inner: 0, corner: 0 })\n\n/** Donut chart: a pie with a hole showing the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;AA+DA,SAAS,aACP,OACA,QACoC;CACpC,MAAM,UAAU,MAAM,OAAO,QAAQ,UAAU,CAAC,OAAO,IAAIA,cAAAA,MAAM,MAAM,IAAI,CAAC,CAAC;CAC7E,MAAM,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;CACjE,IAAI,SAAS,MAAM,cAAc,KAAKC,YAAAA;CAOtC,OAAO;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AAA,aAAa,QAAQ,QAAQ,IAAI,MAAM;CACrD,MAAM,QAAQC,eAAAA,gBAAgB,IAAI,QAAQ;EAAE,OAAO;EAAW,uBAAuB;CAAE,CAAC;CACxF,OAAO;EACL,SAAS;GAAC;GAAI;GAAS;EAAO;EAC9B,MAAM,OAAO,KAAK,UAAU;GAC1B,MAAM,KAAK;GACX,MAAM,MAAM,KAAK;GACjB,MAAM,OAAO,QAAQ,IAAI,MAAM,QAAQ,QAAQ,CAAC;EAClD,CAAC;CACH;AACF;AAEA,SAAS,QACP,MACA,UACiC;CACjC,OAAO;EACL;EACA,OAAOM,cAAAA,UAAUC,cAAAA,UAAU;EAC3B,SAASC,eAAAA;EACT,SAAS,SAAS,QAAsB,UAAU,SAAS,KAAK,QAAQ;EACxEC,OAAAA,cAAAA;EACA,QAAQC,eAAAA;EACR,OAAO;EACP,aAAa,EAAE,OAAO,QAAQ;CAChC;AACF;;;;;;;;AASA,MAAa,MAAuC,QAAQ,OAAO;CAAE,OAAO;CAAG,QAAQ;AAAE,CAAC;;AAG1F,MAAa,QAAyC,QAAQ,SAAS;CAAE,OAAO;CAAM,QAAQ;AAAE,CAAC"}
@@ -1,7 +1,8 @@
1
- import { a as ChartType } from "./chart-kqFMEwDo.cjs";
1
+ import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
2
2
  import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
3
3
  import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
5
+ import { n as WithSlices, t as SliceGrouping } from "./others-ls5eKtZ4.cjs";
5
6
  /** One slice of a pie or donut. */
6
7
  interface PieSlice {
7
8
  name: string;
@@ -19,17 +20,8 @@ interface PieSlice {
19
20
  /** Start hidden (toggle it back from the legend). */
20
21
  hidden?: boolean;
21
22
  }
22
- interface PieOptions {
23
+ interface PieOptions extends SliceGrouping {
23
24
  data: readonly PieSlice[];
24
- /**
25
- * The most slices drawn, the one for the rest included: with more entries
26
- * than that, the largest `maxSlices - 1` keep a slice of their own and the
27
- * others share one, named by `othersLabel`, after them. Defaults to `9`
28
- * (the eight palette colors and the rest); `0` never groups.
29
- */
30
- maxSlices?: number;
31
- /** Name of the slice that groups the rest. Defaults to `'Others'`. */
32
- othersLabel?: string;
33
25
  /** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
34
26
  innerRadius?: number;
35
27
  /** Gap between slices in pixels, drawn as surface. Defaults to `2`. */
@@ -51,6 +43,8 @@ interface PieOptions {
51
43
  /** Extra space around the pie, in pixels. */
52
44
  padding?: InsetsInput;
53
45
  }
46
+ /** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
47
+ type PieModel = WithSlices<PieOptions>;
54
48
  /**
55
49
  * Pie chart: parts of a whole as slices, in data order, clockwise from the top.
56
50
  *
@@ -58,7 +52,7 @@ interface PieOptions {
58
52
  * new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
59
53
  * ```
60
54
  */
61
- declare const pie: ChartType<PieOptions>;
55
+ declare const pie: ChartType<PieOptions, PieModel>;
62
56
  /** Donut chart: a pie with a hole showing the total (or your own `center`). */
63
- declare const donut: ChartType<PieOptions>;
57
+ declare const donut: ChartType<PieOptions, PieModel>;
64
58
  export { pie as i, PieSlice as n, donut as r, PieOptions as t };
package/dist/pie.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_pie = require("./pie-BpjvSPnz.cjs");
2
+ const require_pie = require("./pie-BseZlCgP.cjs");
3
3
  exports.donut = require_pie.donut;
4
4
  exports.pie = require_pie.pie;
package/dist/pie.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { pie, donut } from '@tabler/charts/pie'`. */
2
- import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-BXg2gNpb.cjs";
2
+ import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-vD5-g8je.cjs";
3
3
  export { type PieOptions, type PieSlice, donut, pie };
package/dist/pie.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { pie, donut } from '@tabler/charts/pie'`. */
2
- import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-CFptILSm.js";
2
+ import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-BQQkvy1N.js";
3
3
  export { type PieOptions, type PieSlice, donut, pie };
package/dist/pie.js CHANGED
@@ -1 +1 @@
1
- export { t as donut, n as pie } from "./pie-CVsc-6qD.js";
1
+ export { t as donut, n as pie } from "./pie-Bd8wyrtY.js";