@tabler/charts 0.0.0-stage → 0.1.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 (338) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +258 -2
  3. package/dist/annotations-Bp7HwtF5.d.ts +86 -0
  4. package/dist/annotations-BszTTjf9.js +202 -0
  5. package/dist/annotations-BszTTjf9.js.map +1 -0
  6. package/dist/annotations-DpETO8dE.cjs +213 -0
  7. package/dist/annotations-DpETO8dE.cjs.map +1 -0
  8. package/dist/annotations-lyt0I3HU.d.cts +86 -0
  9. package/dist/annotations.cjs +14 -0
  10. package/dist/annotations.cjs.map +1 -0
  11. package/dist/annotations.d.cts +2 -0
  12. package/dist/annotations.d.ts +2 -0
  13. package/dist/annotations.js +12 -0
  14. package/dist/annotations.js.map +1 -0
  15. package/dist/arc-BXpLrt9b.cjs +301 -0
  16. package/dist/arc-BXpLrt9b.cjs.map +1 -0
  17. package/dist/arc-a1tRTEw7.js +278 -0
  18. package/dist/arc-a1tRTEw7.js.map +1 -0
  19. package/dist/area-CF__HOwL.d.ts +20 -0
  20. package/dist/area-DIxaAbYZ.d.cts +20 -0
  21. package/dist/area-DQsLERhx.js +26 -0
  22. package/dist/area-DQsLERhx.js.map +1 -0
  23. package/dist/area-sHCE3pg5.cjs +31 -0
  24. package/dist/area-sHCE3pg5.cjs.map +1 -0
  25. package/dist/area.cjs +3 -0
  26. package/dist/area.d.cts +2 -0
  27. package/dist/area.d.ts +2 -0
  28. package/dist/area.js +2 -0
  29. package/dist/band-DTcNDAFO.d.cts +50 -0
  30. package/dist/band-DTcNDAFO.d.ts +50 -0
  31. package/dist/bar-BBM8RhoL.d.ts +43 -0
  32. package/dist/bar-C-7zR2qp.cjs +243 -0
  33. package/dist/bar-C-7zR2qp.cjs.map +1 -0
  34. package/dist/bar-CRKLDg98.d.cts +43 -0
  35. package/dist/bar-DGuUN3nc.cjs +67 -0
  36. package/dist/bar-DGuUN3nc.cjs.map +1 -0
  37. package/dist/bar-DM16NUvV.js +56 -0
  38. package/dist/bar-DM16NUvV.js.map +1 -0
  39. package/dist/bar-jZEoao74.js +238 -0
  40. package/dist/bar-jZEoao74.js.map +1 -0
  41. package/dist/bar.cjs +3 -0
  42. package/dist/bar.d.cts +2 -0
  43. package/dist/bar.d.ts +2 -0
  44. package/dist/bar.js +2 -0
  45. package/dist/candlestick-B5r1w3kc.cjs +150 -0
  46. package/dist/candlestick-B5r1w3kc.cjs.map +1 -0
  47. package/dist/candlestick-D_vV0_XZ.d.ts +44 -0
  48. package/dist/candlestick-DuXwAFID.js +145 -0
  49. package/dist/candlestick-DuXwAFID.js.map +1 -0
  50. package/dist/candlestick-__pXl_pV.d.cts +44 -0
  51. package/dist/candlestick.cjs +11 -0
  52. package/dist/candlestick.cjs.map +1 -0
  53. package/dist/candlestick.d.cts +2 -0
  54. package/dist/candlestick.d.ts +2 -0
  55. package/dist/candlestick.js +10 -0
  56. package/dist/candlestick.js.map +1 -0
  57. package/dist/cartesian-BoDfgBCV.cjs +900 -0
  58. package/dist/cartesian-BoDfgBCV.cjs.map +1 -0
  59. package/dist/cartesian-Cr0AF0nG.js +709 -0
  60. package/dist/cartesian-Cr0AF0nG.js.map +1 -0
  61. package/dist/chart-BF2CK9I_.js +790 -0
  62. package/dist/chart-BF2CK9I_.js.map +1 -0
  63. package/dist/chart-CowF_lWY.cjs +903 -0
  64. package/dist/chart-CowF_lWY.cjs.map +1 -0
  65. package/dist/chart-D7ooEFnk.d.cts +933 -0
  66. package/dist/chart-DyN7bcx8.d.ts +933 -0
  67. package/dist/circle-BQMuAfls.cjs +12 -0
  68. package/dist/circle-BQMuAfls.cjs.map +1 -0
  69. package/dist/circle-Z7YfCoCM.js +7 -0
  70. package/dist/circle-Z7YfCoCM.js.map +1 -0
  71. package/dist/clean-Byl6kzf0.cjs +115 -0
  72. package/dist/clean-Byl6kzf0.cjs.map +1 -0
  73. package/dist/clean-o1vDEhFV.js +56 -0
  74. package/dist/clean-o1vDEhFV.js.map +1 -0
  75. package/dist/core-CegR_j55.js +884 -0
  76. package/dist/core-CegR_j55.js.map +1 -0
  77. package/dist/core-D1vO1LrC.d.cts +220 -0
  78. package/dist/core-DcbemzGf.d.ts +220 -0
  79. package/dist/core-RzS9IQO5.cjs +985 -0
  80. package/dist/core-RzS9IQO5.cjs.map +1 -0
  81. package/dist/core.cjs +115 -0
  82. package/dist/core.d.cts +21 -0
  83. package/dist/core.d.ts +21 -0
  84. package/dist/core.js +25 -0
  85. package/dist/dates-Btm7Zm6W.cjs +32 -0
  86. package/dist/dates-Btm7Zm6W.cjs.map +1 -0
  87. package/dist/dates-CG-FvioW.js +27 -0
  88. package/dist/dates-CG-FvioW.js.map +1 -0
  89. package/dist/decimate-BGg9XgF0.d.ts +17 -0
  90. package/dist/decimate-C87cl_Sp.js +84 -0
  91. package/dist/decimate-C87cl_Sp.js.map +1 -0
  92. package/dist/decimate-CNSpgGa5.d.cts +17 -0
  93. package/dist/decimate-tLhDk1ys.cjs +95 -0
  94. package/dist/decimate-tLhDk1ys.cjs.map +1 -0
  95. package/dist/decimate.cjs +14 -0
  96. package/dist/decimate.cjs.map +1 -0
  97. package/dist/decimate.d.cts +2 -0
  98. package/dist/decimate.d.ts +2 -0
  99. package/dist/decimate.js +12 -0
  100. package/dist/decimate.js.map +1 -0
  101. package/dist/dom-CLF868Qs.cjs +222 -0
  102. package/dist/dom-CLF868Qs.cjs.map +1 -0
  103. package/dist/dom-vP3IcMak.js +175 -0
  104. package/dist/dom-vP3IcMak.js.map +1 -0
  105. package/dist/export-chart-9w8t3rjZ.js +232 -0
  106. package/dist/export-chart-9w8t3rjZ.js.map +1 -0
  107. package/dist/export-chart-BhhYgksr.cjs +249 -0
  108. package/dist/export-chart-BhhYgksr.cjs.map +1 -0
  109. package/dist/export.cjs +18 -0
  110. package/dist/export.cjs.map +1 -0
  111. package/dist/export.d.cts +2 -0
  112. package/dist/export.d.ts +2 -0
  113. package/dist/export.js +15 -0
  114. package/dist/export.js.map +1 -0
  115. package/dist/extent-BAMZo0Nq.js +19 -0
  116. package/dist/extent-BAMZo0Nq.js.map +1 -0
  117. package/dist/extent-DsFWvAHJ.cjs +24 -0
  118. package/dist/extent-DsFWvAHJ.cjs.map +1 -0
  119. package/dist/fade-Cs74puQS.cjs +217 -0
  120. package/dist/fade-Cs74puQS.cjs.map +1 -0
  121. package/dist/fade-D3NxH5Qg.js +200 -0
  122. package/dist/fade-D3NxH5Qg.js.map +1 -0
  123. package/dist/features-BclHgg2W.cjs +48 -0
  124. package/dist/features-BclHgg2W.cjs.map +1 -0
  125. package/dist/features-wASyHGic.js +25 -0
  126. package/dist/features-wASyHGic.js.map +1 -0
  127. package/dist/format-B0yKXBTH.cjs +183 -0
  128. package/dist/format-B0yKXBTH.cjs.map +1 -0
  129. package/dist/format-lStwuc1L.js +142 -0
  130. package/dist/format-lStwuc1L.js.map +1 -0
  131. package/dist/gauge-D-FYhuds.cjs +236 -0
  132. package/dist/gauge-D-FYhuds.cjs.map +1 -0
  133. package/dist/gauge-DP_EB2z3.d.cts +65 -0
  134. package/dist/gauge-Dh423FHh.js +231 -0
  135. package/dist/gauge-Dh423FHh.js.map +1 -0
  136. package/dist/gauge-zpia05t2.d.ts +65 -0
  137. package/dist/gauge.cjs +3 -0
  138. package/dist/gauge.d.cts +2 -0
  139. package/dist/gauge.d.ts +2 -0
  140. package/dist/gauge.js +2 -0
  141. package/dist/heatmap-BK18EBgJ.cjs +247 -0
  142. package/dist/heatmap-BK18EBgJ.cjs.map +1 -0
  143. package/dist/heatmap-BectCEeE.d.ts +81 -0
  144. package/dist/heatmap-CCso6m61.d.cts +81 -0
  145. package/dist/heatmap-DSZ2bVIa.js +242 -0
  146. package/dist/heatmap-DSZ2bVIa.js.map +1 -0
  147. package/dist/heatmap.cjs +3 -0
  148. package/dist/heatmap.d.cts +2 -0
  149. package/dist/heatmap.d.ts +2 -0
  150. package/dist/heatmap.js +2 -0
  151. package/dist/hydrate-CTTmQy0x.d.cts +10 -0
  152. package/dist/hydrate-CxwTXDqO.cjs +60 -0
  153. package/dist/hydrate-CxwTXDqO.cjs.map +1 -0
  154. package/dist/hydrate-CzfxLfTv.d.ts +10 -0
  155. package/dist/hydrate-DDNIHYv_.js +55 -0
  156. package/dist/hydrate-DDNIHYv_.js.map +1 -0
  157. package/dist/hydrate.cjs +13 -0
  158. package/dist/hydrate.cjs.map +1 -0
  159. package/dist/hydrate.d.cts +2 -0
  160. package/dist/hydrate.d.ts +2 -0
  161. package/dist/hydrate.js +12 -0
  162. package/dist/hydrate.js.map +1 -0
  163. package/dist/index.cjs +214 -0
  164. package/dist/index.cjs.map +1 -0
  165. package/dist/index.d.cts +46 -0
  166. package/dist/index.d.ts +46 -0
  167. package/dist/index.js +115 -0
  168. package/dist/index.js.map +1 -0
  169. package/dist/layout-B3hiqVEw.js +69 -0
  170. package/dist/layout-B3hiqVEw.js.map +1 -0
  171. package/dist/layout-CtMBhNd9.cjs +98 -0
  172. package/dist/layout-CtMBhNd9.cjs.map +1 -0
  173. package/dist/line-B3Ed6u7j.js +120 -0
  174. package/dist/line-B3Ed6u7j.js.map +1 -0
  175. package/dist/line-CN4uZ9ZX.d.ts +47 -0
  176. package/dist/line-W7VD_qs1.d.cts +47 -0
  177. package/dist/line-fQbtP_jL.cjs +131 -0
  178. package/dist/line-fQbtP_jL.cjs.map +1 -0
  179. package/dist/line.cjs +14 -0
  180. package/dist/line.cjs.map +1 -0
  181. package/dist/line.d.cts +2 -0
  182. package/dist/line.d.ts +2 -0
  183. package/dist/line.js +13 -0
  184. package/dist/line.js.map +1 -0
  185. package/dist/log-CaofN3-n.d.cts +48 -0
  186. package/dist/log-CaofN3-n.d.ts +48 -0
  187. package/dist/log-axis-83rSpvL5.cjs +130 -0
  188. package/dist/log-axis-83rSpvL5.cjs.map +1 -0
  189. package/dist/log-axis-B_uvvOFc.js +113 -0
  190. package/dist/log-axis-B_uvvOFc.js.map +1 -0
  191. package/dist/log.cjs +17 -0
  192. package/dist/log.cjs.map +1 -0
  193. package/dist/log.d.cts +2 -0
  194. package/dist/log.d.ts +2 -0
  195. package/dist/log.js +16 -0
  196. package/dist/log.js.map +1 -0
  197. package/dist/morph-BMxz3X2b.d.cts +10 -0
  198. package/dist/morph-BMxz3X2b.d.ts +10 -0
  199. package/dist/morph-Bgg-24l8.js +36 -0
  200. package/dist/morph-Bgg-24l8.js.map +1 -0
  201. package/dist/morph-CqYDu1bY.cjs +41 -0
  202. package/dist/morph-CqYDu1bY.cjs.map +1 -0
  203. package/dist/morph.cjs +14 -0
  204. package/dist/morph.cjs.map +1 -0
  205. package/dist/morph.d.cts +2 -0
  206. package/dist/morph.d.ts +2 -0
  207. package/dist/morph.js +13 -0
  208. package/dist/morph.js.map +1 -0
  209. package/dist/named-BWWb5LQJ.cjs +50 -0
  210. package/dist/named-BWWb5LQJ.cjs.map +1 -0
  211. package/dist/named-DE15TOgh.js +33 -0
  212. package/dist/named-DE15TOgh.js.map +1 -0
  213. package/dist/parliament-1Zv2Xh0D.d.ts +69 -0
  214. package/dist/parliament-CpWnoEvG.cjs +308 -0
  215. package/dist/parliament-CpWnoEvG.cjs.map +1 -0
  216. package/dist/parliament-DdrLVZwt.d.cts +69 -0
  217. package/dist/parliament-Dw0sOERi.js +303 -0
  218. package/dist/parliament-Dw0sOERi.js.map +1 -0
  219. package/dist/parliament.cjs +3 -0
  220. package/dist/parliament.d.cts +2 -0
  221. package/dist/parliament.d.ts +2 -0
  222. package/dist/parliament.js +2 -0
  223. package/dist/path-CwB28da0.d.cts +29 -0
  224. package/dist/path-CwB28da0.d.ts +29 -0
  225. package/dist/patterns-DtgcnA8o.js +85 -0
  226. package/dist/patterns-DtgcnA8o.js.map +1 -0
  227. package/dist/patterns-LfcQAWCy.cjs +102 -0
  228. package/dist/patterns-LfcQAWCy.cjs.map +1 -0
  229. package/dist/patterns.cjs +15 -0
  230. package/dist/patterns.cjs.map +1 -0
  231. package/dist/patterns.d.cts +2 -0
  232. package/dist/patterns.d.ts +2 -0
  233. package/dist/patterns.js +12 -0
  234. package/dist/patterns.js.map +1 -0
  235. package/dist/pie-5z1fDdKO.d.ts +58 -0
  236. package/dist/pie-BF9yI5mE.d.cts +58 -0
  237. package/dist/pie-BxTZt6Go.cjs +212 -0
  238. package/dist/pie-BxTZt6Go.cjs.map +1 -0
  239. package/dist/pie-DzUXDTcn.js +201 -0
  240. package/dist/pie-DzUXDTcn.js.map +1 -0
  241. package/dist/pie.cjs +4 -0
  242. package/dist/pie.d.cts +2 -0
  243. package/dist/pie.d.ts +2 -0
  244. package/dist/pie.js +2 -0
  245. package/dist/point-shapes-CGl4dugc.cjs +166 -0
  246. package/dist/point-shapes-CGl4dugc.cjs.map +1 -0
  247. package/dist/point-shapes-DI84NNpI.js +155 -0
  248. package/dist/point-shapes-DI84NNpI.js.map +1 -0
  249. package/dist/point-shapes.cjs +15 -0
  250. package/dist/point-shapes.cjs.map +1 -0
  251. package/dist/point-shapes.d.cts +2 -0
  252. package/dist/point-shapes.d.ts +2 -0
  253. package/dist/point-shapes.js +13 -0
  254. package/dist/point-shapes.js.map +1 -0
  255. package/dist/radar-1-EryihA.d.ts +60 -0
  256. package/dist/radar-CYPab_I4.js +285 -0
  257. package/dist/radar-CYPab_I4.js.map +1 -0
  258. package/dist/radar-CoGUNNSb.cjs +290 -0
  259. package/dist/radar-CoGUNNSb.cjs.map +1 -0
  260. package/dist/radar-DBW4O0Vt.d.cts +60 -0
  261. package/dist/radar.cjs +3 -0
  262. package/dist/radar.d.cts +2 -0
  263. package/dist/radar.d.ts +2 -0
  264. package/dist/radar.js +2 -0
  265. package/dist/sankey-B4PNKusJ.js +420 -0
  266. package/dist/sankey-B4PNKusJ.js.map +1 -0
  267. package/dist/sankey-Bacx4fVe.cjs +425 -0
  268. package/dist/sankey-Bacx4fVe.cjs.map +1 -0
  269. package/dist/sankey-DuGI3Qc5.d.cts +67 -0
  270. package/dist/sankey-OV_WoPrl.d.ts +67 -0
  271. package/dist/sankey.cjs +3 -0
  272. package/dist/sankey.d.cts +2 -0
  273. package/dist/sankey.d.ts +2 -0
  274. package/dist/sankey.js +2 -0
  275. package/dist/scatter-BqzgJqdX.d.ts +61 -0
  276. package/dist/scatter-DbxLyZX0.d.cts +61 -0
  277. package/dist/scatter-DgMN9zRy.cjs +250 -0
  278. package/dist/scatter-DgMN9zRy.cjs.map +1 -0
  279. package/dist/scatter-kgtgR318.js +245 -0
  280. package/dist/scatter-kgtgR318.js.map +1 -0
  281. package/dist/scatter.cjs +3 -0
  282. package/dist/scatter.d.cts +2 -0
  283. package/dist/scatter.d.ts +2 -0
  284. package/dist/scatter.js +2 -0
  285. package/dist/sparkline-BQzt27Fr.js +171 -0
  286. package/dist/sparkline-BQzt27Fr.js.map +1 -0
  287. package/dist/sparkline-BS9-hltA.cjs +176 -0
  288. package/dist/sparkline-BS9-hltA.cjs.map +1 -0
  289. package/dist/sparkline-BfyO_oNM.d.ts +43 -0
  290. package/dist/sparkline-CWlJDKyh.d.cts +43 -0
  291. package/dist/sparkline.cjs +3 -0
  292. package/dist/sparkline.d.cts +2 -0
  293. package/dist/sparkline.d.ts +2 -0
  294. package/dist/sparkline.js +2 -0
  295. package/dist/stack-CpR6RGKd.d.cts +6 -0
  296. package/dist/stack-CpR6RGKd.d.ts +6 -0
  297. package/dist/stack-DRbwTeF3.js +66 -0
  298. package/dist/stack-DRbwTeF3.js.map +1 -0
  299. package/dist/stack-DVhJWaki.cjs +77 -0
  300. package/dist/stack-DVhJWaki.cjs.map +1 -0
  301. package/dist/style.css +2 -0
  302. package/dist/sweep-CbfR7--d.js +60 -0
  303. package/dist/sweep-CbfR7--d.js.map +1 -0
  304. package/dist/sweep-DaTEDDuC.cjs +71 -0
  305. package/dist/sweep-DaTEDDuC.cjs.map +1 -0
  306. package/dist/time-CHjiY9Q4.d.ts +112 -0
  307. package/dist/time-CNVnt-B2.d.cts +112 -0
  308. package/dist/time-axis-Bc9eHX1r.js +365 -0
  309. package/dist/time-axis-Bc9eHX1r.js.map +1 -0
  310. package/dist/time-axis-VSX34_Tb.cjs +382 -0
  311. package/dist/time-axis-VSX34_Tb.cjs.map +1 -0
  312. package/dist/time.cjs +22 -0
  313. package/dist/time.cjs.map +1 -0
  314. package/dist/time.d.cts +2 -0
  315. package/dist/time.d.ts +2 -0
  316. package/dist/time.js +20 -0
  317. package/dist/time.js.map +1 -0
  318. package/dist/tween-BCYd0RTY.js +40 -0
  319. package/dist/tween-BCYd0RTY.js.map +1 -0
  320. package/dist/tween-CIGBlryn.cjs +51 -0
  321. package/dist/tween-CIGBlryn.cjs.map +1 -0
  322. package/dist/value-labels-B0WJoJ7x.cjs +134 -0
  323. package/dist/value-labels-B0WJoJ7x.cjs.map +1 -0
  324. package/dist/value-labels-IZIQPhfk.js +123 -0
  325. package/dist/value-labels-IZIQPhfk.js.map +1 -0
  326. package/dist/value-labels.cjs +14 -0
  327. package/dist/value-labels.cjs.map +1 -0
  328. package/dist/value-labels.d.cts +2 -0
  329. package/dist/value-labels.d.ts +2 -0
  330. package/dist/value-labels.js +12 -0
  331. package/dist/value-labels.js.map +1 -0
  332. package/dist/vnode-BUflsBsa.d.cts +66 -0
  333. package/dist/vnode-BUflsBsa.d.ts +66 -0
  334. package/dist/vnode-CkQ27Cxe.cjs +110 -0
  335. package/dist/vnode-CkQ27Cxe.cjs.map +1 -0
  336. package/dist/vnode-tCWItoUH.js +93 -0
  337. package/dist/vnode-tCWItoUH.js.map +1 -0
  338. package/package.json +320 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named-BWWb5LQJ.cjs","names":[],"sources":["../src/charts/named.ts"],"sourcesContent":["import type { LegendItem } from '../legend.ts'\nimport type { ClassValue, Props } from '../vnode.ts'\n\n/** What series, slices and rings have in common: a name, and how they look in a legend. */\nexport interface Named {\n name: string\n id?: string\n color?: string\n class?: ClassValue\n hidden?: boolean\n}\n\n/** Stable key of a series, slice or ring: its `id`, or its name. */\nexport const keyOf = (item: Named): string => item.id ?? item.name\n\n/** Legend entries for series, slices or rings, in their order (which is their color slot). */\nexport function legendItems(list: readonly Named[]): LegendItem[] {\n return list.map((entry, index) => {\n const item: LegendItem = { key: keyOf(entry), name: entry.name, index }\n if (entry.color) item.color = entry.color\n if (entry.hidden) item.hidden = true\n return item\n })\n}\n\n/** Attributes of the group of a series, slice or ring in color slot `index`. */\nexport function groupAttrs(item: Named, index: number): Props {\n return {\n key: keyOf(item),\n class: ['tc-series', `tc-series-${index + 1}`, item.class],\n 'data-series': item.name,\n // A map, so values from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n }\n}\n"],"mappings":";;AAaA,MAAa,SAAS,SAAwB,KAAK,MAAM,KAAK;;AAG9D,SAAgB,YAAY,MAAsC;CAChE,OAAO,KAAK,KAAK,OAAO,UAAU;EAChC,MAAM,OAAmB;GAAE,KAAK,MAAM,KAAK;GAAG,MAAM,MAAM;GAAM;EAAM;EACtE,IAAI,MAAM,OAAO,KAAK,QAAQ,MAAM;EACpC,IAAI,MAAM,QAAQ,KAAK,SAAS;EAChC,OAAO;CACT,CAAC;AACH;;AAGA,SAAgB,WAAW,MAAa,OAAsB;CAC5D,OAAO;EACL,KAAK,MAAM,IAAI;EACf,OAAO;GAAC;GAAa,aAAa,QAAQ;GAAK,KAAK;EAAK;EACzD,eAAe,KAAK;EAEpB,OAAO,EAAE,qBAAqB,KAAK,MAAM;CAC3C;AACF"}
@@ -0,0 +1,33 @@
1
+ //#region src/charts/named.ts
2
+ /** Stable key of a series, slice or ring: its `id`, or its name. */
3
+ const keyOf = (item) => item.id ?? item.name;
4
+ /** Legend entries for series, slices or rings, in their order (which is their color slot). */
5
+ function legendItems(list) {
6
+ return list.map((entry, index) => {
7
+ const item = {
8
+ key: keyOf(entry),
9
+ name: entry.name,
10
+ index
11
+ };
12
+ if (entry.color) item.color = entry.color;
13
+ if (entry.hidden) item.hidden = true;
14
+ return item;
15
+ });
16
+ }
17
+ /** Attributes of the group of a series, slice or ring in color slot `index`. */
18
+ function groupAttrs(item, index) {
19
+ return {
20
+ key: keyOf(item),
21
+ class: [
22
+ "tc-series",
23
+ `tc-series-${index + 1}`,
24
+ item.class
25
+ ],
26
+ "data-series": item.name,
27
+ style: { "--tc-series-color": item.color }
28
+ };
29
+ }
30
+ //#endregion
31
+ export { keyOf as n, legendItems as r, groupAttrs as t };
32
+
33
+ //# sourceMappingURL=named-DE15TOgh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"named-DE15TOgh.js","names":[],"sources":["../src/charts/named.ts"],"sourcesContent":["import type { LegendItem } from '../legend.ts'\nimport type { ClassValue, Props } from '../vnode.ts'\n\n/** What series, slices and rings have in common: a name, and how they look in a legend. */\nexport interface Named {\n name: string\n id?: string\n color?: string\n class?: ClassValue\n hidden?: boolean\n}\n\n/** Stable key of a series, slice or ring: its `id`, or its name. */\nexport const keyOf = (item: Named): string => item.id ?? item.name\n\n/** Legend entries for series, slices or rings, in their order (which is their color slot). */\nexport function legendItems(list: readonly Named[]): LegendItem[] {\n return list.map((entry, index) => {\n const item: LegendItem = { key: keyOf(entry), name: entry.name, index }\n if (entry.color) item.color = entry.color\n if (entry.hidden) item.hidden = true\n return item\n })\n}\n\n/** Attributes of the group of a series, slice or ring in color slot `index`. */\nexport function groupAttrs(item: Named, index: number): Props {\n return {\n key: keyOf(item),\n class: ['tc-series', `tc-series-${index + 1}`, item.class],\n 'data-series': item.name,\n // A map, so values from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n }\n}\n"],"mappings":";;AAaA,MAAa,SAAS,SAAwB,KAAK,MAAM,KAAK;;AAG9D,SAAgB,YAAY,MAAsC;CAChE,OAAO,KAAK,KAAK,OAAO,UAAU;EAChC,MAAM,OAAmB;GAAE,KAAK,MAAM,KAAK;GAAG,MAAM,MAAM;GAAM;EAAM;EACtE,IAAI,MAAM,OAAO,KAAK,QAAQ,MAAM;EACpC,IAAI,MAAM,QAAQ,KAAK,SAAS;EAChC,OAAO;CACT,CAAC;AACH;;AAGA,SAAgB,WAAW,MAAa,OAAsB;CAC5D,OAAO;EACL,KAAK,MAAM,IAAI;EACf,OAAO;GAAC;GAAa,aAAa,QAAQ;GAAK,KAAK;EAAK;EACzD,eAAe,KAAK;EAEpB,OAAO,EAAE,qBAAqB,KAAK,MAAM;CAC3C;AACF"}
@@ -0,0 +1,69 @@
1
+ import { a as InsetsInput } from "./annotations-Bp7HwtF5.js";
2
+ import { a as ClassValue } from "./vnode-BUflsBsa.js";
3
+ import { a as ChartType } from "./chart-DyN7bcx8.js";
4
+ import { c as NumberFormat } from "./time-CHjiY9Q4.js";
5
+ //#region src/charts/parliament.d.ts
6
+ /** One party (or group) of a parliament. */
7
+ interface ParliamentParty {
8
+ name: string;
9
+ /** Seats won; a fraction is rounded, a negative count is zero. */
10
+ seats: number;
11
+ /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */
12
+ id?: string;
13
+ /**
14
+ * Custom color; overrides the palette slot via `--tc-series-color`.
15
+ * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
16
+ */
17
+ color?: string;
18
+ /** Extra classes on the party group. */
19
+ class?: ClassValue;
20
+ /** Start hidden (toggle it back from the legend). */
21
+ hidden?: boolean;
22
+ }
23
+ interface ParliamentOptions {
24
+ /** Parties in their order along the benches, from the left. */
25
+ data: readonly ParliamentParty[];
26
+ /**
27
+ * Seats in the house. Defaults to the parties' sum; more than that leaves
28
+ * vacant seats, drawn empty after the last party.
29
+ */
30
+ total?: number;
31
+ /** Rows of seats. Defaults to the fewest rows that seat everyone comfortably. */
32
+ rows?: number;
33
+ /** Where the benches start, in degrees clockwise from 12 o'clock. Defaults to `-angle / 2`. */
34
+ startAngle?: number;
35
+ /** Degrees the benches span, `0…360`. Defaults to `180` (a hemicycle). */
36
+ angle?: number;
37
+ /** Radius of the innermost row relative to the outermost, `0…0.95`. Defaults to `0.45`. */
38
+ innerRadius?: number;
39
+ /** Space between seats as a share of their pitch, `0…0.9`. Defaults to `0.35`. */
40
+ gap?: number;
41
+ /** Format of the seat counts (tooltip, table, center). */
42
+ format?: NumberFormat;
43
+ /**
44
+ * Text in the middle: the number of seats by default; `false` hides it, or
45
+ * give your own `value` / `label` (the label sits above the value).
46
+ */
47
+ center?: false | {
48
+ value?: string;
49
+ label?: string;
50
+ };
51
+ /** Extra space around the chart, in pixels. */
52
+ padding?: InsetsInput;
53
+ }
54
+ /**
55
+ * Parliament chart: the seats of a house as dots on concentric benches, a
56
+ * hemicycle by default, each party a wedge of them in data order from the
57
+ * left, with the number of seats in the middle.
58
+ *
59
+ * ```ts
60
+ * new Chart('#el', {
61
+ * type: parliament,
62
+ * data: [{ name: 'Left', seats: 135 }, { name: 'Right', seats: 57 }, { name: 'Other', seats: 7 }],
63
+ * })
64
+ * ```
65
+ */
66
+ declare const parliament: ChartType<ParliamentOptions>;
67
+ //#endregion
68
+ export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
69
+ //# sourceMappingURL=parliament-1Zv2Xh0D.d.ts.map
@@ -0,0 +1,308 @@
1
+ const require_layout = require("./layout-CtMBhNd9.cjs");
2
+ const require_vnode = require("./vnode-CkQ27Cxe.cjs");
3
+ const require_format = require("./format-B0yKXBTH.cjs");
4
+ const require_clean = require("./clean-Byl6kzf0.cjs");
5
+ const require_named = require("./named-BWWb5LQJ.cjs");
6
+ const require_arc = require("./arc-BXpLrt9b.cjs");
7
+ //#region src/charts/parliament.ts
8
+ /** The most seats a house can have: enough for any parliament, few enough to draw. */
9
+ const MAX_SEATS = 5e3;
10
+ function partiesOf(options, hidden) {
11
+ return options.data.map((data, index) => ({
12
+ data,
13
+ index,
14
+ seats: Math.min(MAX_SEATS, Math.max(0, Math.round(data.seats || 0)))
15
+ })).filter((party) => !hidden.has(require_named.keyOf(party.data))).map((party, position) => ({
16
+ ...party,
17
+ position
18
+ }));
19
+ }
20
+ /** Seats of the house: the visible parties', and the vacant ones up to `total`. */
21
+ function seatCounts(options, parties) {
22
+ const taken = Math.min(MAX_SEATS, parties.reduce((sum, party) => sum + party.seats, 0));
23
+ const wanted = Math.min(MAX_SEATS, Math.round(options.total ?? 0));
24
+ return {
25
+ taken,
26
+ total: Math.max(taken, wanted > 0 ? wanted : 0)
27
+ };
28
+ }
29
+ /** Seats per row, proportional to each row's length so the angular pitch is the same everywhere. */
30
+ function distribute(total, radii) {
31
+ const sum = radii.reduce((a, r) => a + r, 0);
32
+ const counts = radii.map((r) => Math.floor(total * r / sum));
33
+ let left = total - counts.reduce((a, n) => a + n, 0);
34
+ const order = radii.map((r, i) => ({
35
+ i,
36
+ lost: total * r / sum - counts[i]
37
+ })).sort((a, b) => b.lost - a.lost || b.i - a.i);
38
+ for (const { i } of order) {
39
+ if (left <= 0) break;
40
+ counts[i] = counts[i] + 1;
41
+ left--;
42
+ }
43
+ return counts;
44
+ }
45
+ /**
46
+ * The seats of `total` places on `rows` concentric arcs (the fewest rows
47
+ * that fit when not given), sorted by angle so parties take contiguous
48
+ * wedges, in units of the outer radius.
49
+ */
50
+ function layoutSeats(total, rows, start, span, inner, gap) {
51
+ const box = {
52
+ x0: 0,
53
+ y0: 0,
54
+ x1: 0,
55
+ y1: 0
56
+ };
57
+ if (total <= 0) return {
58
+ seats: [],
59
+ dot: 0,
60
+ box
61
+ };
62
+ const depth = 1 - inner;
63
+ const closed = span >= Math.PI * 2 - 1e-9;
64
+ const radiiOf = (n) => Array.from({ length: n }, (_, i) => n > 1 ? inner + i * depth / (n - 1) : 1);
65
+ const pitchOf = (n) => n > 1 ? depth / (n - 1) : depth;
66
+ const capacity = (n) => {
67
+ const pitch = pitchOf(n);
68
+ return radiiOf(n).reduce((sum, r) => sum + Math.floor(r * span / pitch) + (closed ? 0 : 1), 0);
69
+ };
70
+ let n = rows && rows > 0 ? Math.min(Math.round(rows), total) : 1;
71
+ if (!rows) while (n < total && capacity(n) < total) n++;
72
+ const radii = radiiOf(n);
73
+ const pitch = pitchOf(n);
74
+ const counts = distribute(total, radii);
75
+ const seats = [];
76
+ let spacing = n > 1 ? pitch : Number.POSITIVE_INFINITY;
77
+ radii.forEach((r, row) => {
78
+ const count = counts[row];
79
+ const step = count > 1 ? span / (closed ? count : count - 1) : 0;
80
+ if (count > 1) spacing = Math.min(spacing, r * step);
81
+ for (let k = 0; k < count; k++) {
82
+ const angle = count > 1 ? start + k * step : start + span / 2;
83
+ seats.push({
84
+ x: r * Math.sin(angle),
85
+ y: -r * Math.cos(angle),
86
+ angle,
87
+ row
88
+ });
89
+ }
90
+ });
91
+ seats.sort((a, b) => a.angle - b.angle || a.row - b.row);
92
+ const dot = (Number.isFinite(spacing) ? spacing : depth) * (1 - gap) * .5;
93
+ for (const seat of seats) {
94
+ box.x0 = Math.min(box.x0, seat.x - dot);
95
+ box.x1 = Math.max(box.x1, seat.x + dot);
96
+ box.y0 = Math.min(box.y0, seat.y - dot);
97
+ box.y1 = Math.max(box.y1, seat.y + dot);
98
+ }
99
+ return {
100
+ seats,
101
+ dot,
102
+ box
103
+ };
104
+ }
105
+ function renderParliament(options, ctx) {
106
+ const { width, height, locale } = ctx;
107
+ const area = require_layout.innerRect(width, height, require_layout.insets(options.padding, 0));
108
+ const span = Math.min(360, Math.max(0, options.angle ?? 180)) * require_arc.DEG;
109
+ const start = (options.startAngle ?? -(span / require_arc.DEG) / 2) * require_arc.DEG;
110
+ const inner = Math.min(.95, Math.max(0, options.innerRadius ?? .45));
111
+ const gap = Math.min(.9, Math.max(0, options.gap ?? .35));
112
+ const parties = partiesOf(options, ctx.hidden);
113
+ const { taken, total } = seatCounts(options, parties);
114
+ const layout = layoutSeats(total, options.rows, start, span, inner, gap);
115
+ const center = options.center;
116
+ const showCenter = center !== false;
117
+ const centerLabel = showCenter ? center?.label : void 0;
118
+ const open = span <= Math.PI + 1e-9 && Math.abs(start + span / 2) < 1e-9;
119
+ const em = ctx.fontSize;
120
+ const textTop = showCenter ? open ? -(centerLabel ? 3.4 : 2.1) * em : -1.4 * em : 0;
121
+ const textBottom = showCenter ? open ? 0 : (centerLabel ? 2 : .7) * em : 0;
122
+ let outer = Math.min(area.width, area.height) / 2;
123
+ let box = {
124
+ x0: 0,
125
+ y0: 0,
126
+ x1: 0,
127
+ y1: 0
128
+ };
129
+ for (let i = 0; i < 4 && outer > 0; i++) {
130
+ box = {
131
+ x0: Math.min(layout.box.x0 * outer, 0),
132
+ y0: Math.min(layout.box.y0 * outer, textTop),
133
+ x1: Math.max(layout.box.x1 * outer, 0),
134
+ y1: Math.max(layout.box.y1 * outer, textBottom)
135
+ };
136
+ const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0));
137
+ if (Math.abs(scale - 1) < .001) break;
138
+ outer = Math.max(0, outer * scale);
139
+ }
140
+ const cx = area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0;
141
+ const cy = area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0;
142
+ const dot = require_layout.round(layout.dot * outer);
143
+ const at = (seat) => [cx + seat.x * outer, cy + seat.y * outer];
144
+ let next = 0;
145
+ const seatsOf = parties.map((party) => {
146
+ const from = next;
147
+ next += party.seats;
148
+ return layout.seats.slice(from, next);
149
+ });
150
+ const vacant = layout.seats.slice(taken, total);
151
+ const drawn = parties.filter((party) => party.seats > 0);
152
+ const value = require_format.formatNumber(options.format, locale);
153
+ const share = require_format.getNumberFormat(locale, {
154
+ style: "percent",
155
+ maximumFractionDigits: 1
156
+ });
157
+ const hitFor = (party, seat) => {
158
+ const seats = seatsOf[party.position];
159
+ let x = 0;
160
+ let y = 0;
161
+ if (seat) [x, y] = at(seat);
162
+ else for (const s of seats) {
163
+ const [sx, sy] = at(s);
164
+ x += sx / seats.length;
165
+ y += sy / seats.length;
166
+ }
167
+ const item = {
168
+ name: party.data.name,
169
+ seriesIndex: party.index,
170
+ value: party.seats,
171
+ text: `${value(party.seats)} (${share.format(total > 0 ? party.seats / total : 0)})`,
172
+ x,
173
+ y
174
+ };
175
+ if (party.data.color) item.color = party.data.color;
176
+ const r = dot + 3;
177
+ const d = seats.map((s) => {
178
+ const [sx, sy] = at(s);
179
+ return `M${require_layout.round(sx + r)},${require_layout.round(sy)}A${r},${r},0,1,1,${require_layout.round(sx - r)},${require_layout.round(sy)}A${r},${r},0,1,1,${require_layout.round(sx + r)},${require_layout.round(sy)}Z`;
180
+ }).join("");
181
+ return {
182
+ index: drawn.indexOf(party),
183
+ label: party.data.name,
184
+ title: "",
185
+ x,
186
+ area: {
187
+ x: cx - outer,
188
+ y: cy - outer,
189
+ width: outer * 2,
190
+ height: outer * 2
191
+ },
192
+ items: [item],
193
+ seriesIndex: party.index,
194
+ mark: {
195
+ d,
196
+ x: 0,
197
+ y: 0
198
+ }
199
+ };
200
+ };
201
+ const interaction = {
202
+ count: drawn.length,
203
+ hitIndex: (position) => {
204
+ const party = drawn[position];
205
+ return party ? hitFor(party) : null;
206
+ },
207
+ hitTest(px, py) {
208
+ const reach = dot + 2;
209
+ let best;
210
+ for (const party of drawn) for (const seat of seatsOf[party.position]) {
211
+ const [x, y] = at(seat);
212
+ const d = Math.hypot(px - x, py - y);
213
+ if (d <= reach && (!best || d < best.d)) best = {
214
+ party,
215
+ seat,
216
+ d
217
+ };
218
+ }
219
+ return best ? hitFor(best.party, best.seat) : null;
220
+ }
221
+ };
222
+ ctx.onHitTest(interaction);
223
+ const circle = (seat, key, cls) => {
224
+ const [x, y] = at(seat);
225
+ return require_vnode.h("circle", {
226
+ key,
227
+ class: cls,
228
+ r: dot,
229
+ style: `transform:translate(${require_layout.round(x - cx)}px,${require_layout.round(y - cy)}px)`
230
+ });
231
+ };
232
+ const groups = parties.map((party) => require_vnode.h("g", require_named.groupAttrs(party.data, party.index), seatsOf[party.position].map((seat, i) => circle(seat, i, "tc-seat"))));
233
+ const centerValue = showCenter ? center?.value ?? value(total) : "";
234
+ return [require_vnode.h("g", {
235
+ class: "tc-parliament",
236
+ style: `transform:translate(${require_layout.round(cx)}px,${require_layout.round(cy)}px)`
237
+ }, require_vnode.h("g", { class: "tc-parliament-seats" }, groups, vacant.length > 0 && require_vnode.h("g", {
238
+ key: "vacant",
239
+ class: "tc-parliament-vacant"
240
+ }, vacant.map((seat, i) => circle(seat, i, "tc-seat tc-seat-vacant"))))), showCenter && require_vnode.h("g", {
241
+ class: "tc-parliament-center",
242
+ "aria-hidden": "true"
243
+ }, centerLabel && require_vnode.h("text", {
244
+ class: "tc-parliament-label",
245
+ x: require_layout.round(cx),
246
+ y: require_layout.round(cy),
247
+ dy: open ? "-2.5em" : "1.6em",
248
+ "text-anchor": "middle"
249
+ }, centerLabel), require_vnode.h("text", {
250
+ class: "tc-parliament-value",
251
+ x: require_layout.round(cx),
252
+ y: require_layout.round(cy),
253
+ dy: open ? "-0.4em" : centerLabel ? "0" : "0.35em",
254
+ "text-anchor": "middle"
255
+ }, centerValue))];
256
+ }
257
+ function parliamentTable(options, ctx) {
258
+ const parties = partiesOf(options, ctx.hidden);
259
+ const { total } = seatCounts(options, parties);
260
+ const value = require_format.formatNumber(options.format, ctx.locale);
261
+ const share = require_format.getNumberFormat(ctx.locale, {
262
+ style: "percent",
263
+ maximumFractionDigits: 1
264
+ });
265
+ return {
266
+ columns: [
267
+ "",
268
+ "Seats",
269
+ "Share"
270
+ ],
271
+ rows: parties.map((party) => [
272
+ party.data.name,
273
+ value(party.seats),
274
+ share.format(total > 0 ? party.seats / total : 0)
275
+ ])
276
+ };
277
+ }
278
+ /**
279
+ * Parliament chart: the seats of a house as dots on concentric benches, a
280
+ * hemicycle by default, each party a wedge of them in data order from the
281
+ * left, with the number of seats in the middle.
282
+ *
283
+ * ```ts
284
+ * new Chart('#el', {
285
+ * type: parliament,
286
+ * data: [{ name: 'Left', seats: 135 }, { name: 'Right', seats: 57 }, { name: 'Other', seats: 7 }],
287
+ * })
288
+ * ```
289
+ */
290
+ const parliament = {
291
+ name: "parliament",
292
+ clean: require_clean.cleanData((data) => require_clean.records(data, (r) => ({
293
+ ...require_clean.named(r),
294
+ seats: require_clean.finite(r.seats) ?? 0
295
+ }))),
296
+ render: renderParliament,
297
+ legend: (options) => require_named.legendItems(options.data),
298
+ table: parliamentTable
299
+ };
300
+ //#endregion
301
+ Object.defineProperty(exports, "parliament", {
302
+ enumerable: true,
303
+ get: function() {
304
+ return parliament;
305
+ }
306
+ });
307
+
308
+ //# sourceMappingURL=parliament-CpWnoEvG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parliament-CpWnoEvG.cjs","names":["keyOf","innerRect","insets","DEG","round","formatNumber","getNumberFormat","h","groupAttrs","cleanData","records","named","finite","legendItems"],"sources":["../src/charts/parliament.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { DEG } from '../shapes/arc.ts'\nimport { type ChildInput, type ClassValue, h } from '../vnode.ts'\nimport { cleanData, finite, named, records } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** One party (or group) of a parliament. */\nexport interface ParliamentParty {\n name: string\n /** Seats won; a fraction is rounded, a negative count is zero. */\n seats: 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 party group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface ParliamentOptions {\n /** Parties in their order along the benches, from the left. */\n data: readonly ParliamentParty[]\n /**\n * Seats in the house. Defaults to the parties' sum; more than that leaves\n * vacant seats, drawn empty after the last party.\n */\n total?: number\n /** Rows of seats. Defaults to the fewest rows that seat everyone comfortably. */\n rows?: number\n /** Where the benches start, in degrees clockwise from 12 o'clock. Defaults to `-angle / 2`. */\n startAngle?: number\n /** Degrees the benches span, `0…360`. Defaults to `180` (a hemicycle). */\n angle?: number\n /** Radius of the innermost row relative to the outermost, `0…0.95`. Defaults to `0.45`. */\n innerRadius?: number\n /** Space between seats as a share of their pitch, `0…0.9`. Defaults to `0.35`. */\n gap?: number\n /** Format of the seat counts (tooltip, table, center). */\n format?: NumberFormat\n /**\n * Text in the middle: the number of seats by default; `false` hides it, or\n * give your own `value` / `label` (the label sits above the value).\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the chart, in pixels. */\n padding?: InsetsInput\n}\n\n/** The most seats a house can have: enough for any parliament, few enough to draw. */\nconst MAX_SEATS = 5000\n\ninterface Party {\n data: ParliamentParty\n index: number\n seats: number\n /** Slot among the visible parties, from the left. */\n position: number\n}\n\n/** A seat in units of the outer radius, before the chart is placed. */\ninterface Seat {\n x: number\n y: number\n angle: number\n row: number\n}\n\ninterface Layout {\n seats: Seat[]\n /** Radius of a seat, in units of the outer radius. */\n dot: number\n /** Outline of the benches, in units of the outer radius. */\n box: { x0: number; y0: number; x1: number; y1: number }\n}\n\nfunction partiesOf(options: ParliamentOptions, hidden: ReadonlySet<string>): Party[] {\n return options.data\n .map((data, index) => ({\n data,\n index,\n seats: Math.min(MAX_SEATS, Math.max(0, Math.round(data.seats || 0))),\n }))\n .filter((party) => !hidden.has(keyOf(party.data)))\n .map((party, position) => ({ ...party, position }))\n}\n\n/** Seats of the house: the visible parties', and the vacant ones up to `total`. */\nfunction seatCounts(\n options: ParliamentOptions,\n parties: readonly Party[],\n): { taken: number; total: number } {\n const taken = Math.min(\n MAX_SEATS,\n parties.reduce((sum, party) => sum + party.seats, 0),\n )\n const wanted = Math.min(MAX_SEATS, Math.round(options.total ?? 0))\n return { taken, total: Math.max(taken, wanted > 0 ? wanted : 0) }\n}\n\n/** Seats per row, proportional to each row's length so the angular pitch is the same everywhere. */\nfunction distribute(total: number, radii: readonly number[]): number[] {\n const sum = radii.reduce((a, r) => a + r, 0)\n const counts = radii.map((r) => Math.floor((total * r) / sum))\n let left = total - counts.reduce((a, n) => a + n, 0)\n // The remainder goes to the rows that lost most in rounding, outer rows first.\n const order = radii\n .map((r, i) => ({ i, lost: (total * r) / sum - (counts[i] as number) }))\n .sort((a, b) => b.lost - a.lost || b.i - a.i)\n for (const { i } of order) {\n if (left <= 0) break\n counts[i] = (counts[i] as number) + 1\n left--\n }\n return counts\n}\n\n/**\n * The seats of `total` places on `rows` concentric arcs (the fewest rows\n * that fit when not given), sorted by angle so parties take contiguous\n * wedges, in units of the outer radius.\n */\nfunction layoutSeats(\n total: number,\n rows: number | undefined,\n start: number,\n span: number,\n inner: number,\n gap: number,\n): Layout {\n const box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n if (total <= 0) return { seats: [], dot: 0, box }\n const depth = 1 - inner\n // On a closed ring the last seat would land on the first: one step less.\n const closed = span >= Math.PI * 2 - 1e-9\n const radiiOf = (n: number) =>\n Array.from({ length: n }, (_, i) => (n > 1 ? inner + (i * depth) / (n - 1) : 1))\n // Pitch between rows; a single row is as deep as the ring is.\n const pitchOf = (n: number) => (n > 1 ? depth / (n - 1) : depth)\n // How many seats `n` rows hold at the row pitch along each arc.\n const capacity = (n: number) => {\n const pitch = pitchOf(n)\n return radiiOf(n).reduce((sum, r) => sum + Math.floor((r * span) / pitch) + (closed ? 0 : 1), 0)\n }\n let n = rows && rows > 0 ? Math.min(Math.round(rows), total) : 1\n if (!rows) while (n < total && capacity(n) < total) n++\n const radii = radiiOf(n)\n const pitch = pitchOf(n)\n const counts = distribute(total, radii)\n const seats: Seat[] = []\n // Seats are as far apart as the tightest row's neighbors, or the rows.\n let spacing = n > 1 ? pitch : Number.POSITIVE_INFINITY\n radii.forEach((r, row) => {\n const count = counts[row] as number\n const step = count > 1 ? span / (closed ? count : count - 1) : 0\n if (count > 1) spacing = Math.min(spacing, r * step)\n for (let k = 0; k < count; k++) {\n const angle = count > 1 ? start + k * step : start + span / 2\n seats.push({ x: r * Math.sin(angle), y: -r * Math.cos(angle), angle, row })\n }\n })\n seats.sort((a, b) => a.angle - b.angle || a.row - b.row)\n const dot = (Number.isFinite(spacing) ? spacing : depth) * (1 - gap) * 0.5\n for (const seat of seats) {\n box.x0 = Math.min(box.x0, seat.x - dot)\n box.x1 = Math.max(box.x1, seat.x + dot)\n box.y0 = Math.min(box.y0, seat.y - dot)\n box.y1 = Math.max(box.y1, seat.y + dot)\n }\n return { seats, dot, box }\n}\n\nfunction renderParliament(options: ParliamentOptions, ctx: RenderContext): ChildInput {\n const { width, height, locale } = ctx\n const area = innerRect(width, height, insets(options.padding, 0))\n const span = Math.min(360, Math.max(0, options.angle ?? 180)) * DEG\n const start = (options.startAngle ?? -(span / DEG) / 2) * DEG\n const inner = Math.min(0.95, Math.max(0, options.innerRadius ?? 0.45))\n const gap = Math.min(0.9, Math.max(0, options.gap ?? 0.35))\n const parties = partiesOf(options, ctx.hidden)\n const { taken, total } = seatCounts(options, parties)\n const layout = layoutSeats(total, options.rows, start, span, inner, gap)\n\n // The text in the middle: inside the open side of a hemicycle, else around the center.\n const center = options.center\n const showCenter = center !== false\n const centerLabel = showCenter ? center?.label : undefined\n const open = span <= Math.PI + 1e-9 && Math.abs(start + span / 2) < 1e-9\n const em = ctx.fontSize\n // (The value is 1.75em tall; on the open side its label sits above it.)\n const textTop = showCenter ? (open ? -(centerLabel ? 3.4 : 2.1) * em : -1.4 * em) : 0\n const textBottom = showCenter ? (open ? 0 : (centerLabel ? 2 : 0.7) * em) : 0\n\n // Radius that fits the benches and the text: the text does not scale, so converge.\n let outer = Math.min(area.width, area.height) / 2\n let box = { x0: 0, y0: 0, x1: 0, y1: 0 }\n for (let i = 0; i < 4 && outer > 0; i++) {\n box = {\n x0: Math.min(layout.box.x0 * outer, 0),\n y0: Math.min(layout.box.y0 * outer, textTop),\n x1: Math.max(layout.box.x1 * outer, 0),\n y1: Math.max(layout.box.y1 * outer, textBottom),\n }\n const scale = Math.min(area.width / (box.x1 - box.x0), area.height / (box.y1 - box.y0))\n if (Math.abs(scale - 1) < 1e-3) break\n outer = Math.max(0, outer * scale)\n }\n const cx = area.x + (area.width - (box.x1 - box.x0)) / 2 - box.x0\n const cy = area.y + (area.height - (box.y1 - box.y0)) / 2 - box.y0\n const dot = round(layout.dot * outer)\n const at = (seat: Seat) => [cx + seat.x * outer, cy + seat.y * outer] as const\n\n // Parties take the seats in order from the left; the vacant ones come last.\n let next = 0\n const seatsOf = parties.map((party) => {\n const from = next\n next += party.seats\n return layout.seats.slice(from, next)\n })\n const vacant = layout.seats.slice(taken, total)\n const drawn = parties.filter((party) => party.seats > 0)\n\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n const hitFor = (party: Party, seat?: Seat): Hit => {\n const seats = seatsOf[party.position] as Seat[]\n let x = 0\n let y = 0\n if (seat) [x, y] = at(seat)\n else {\n for (const s of seats) {\n const [sx, sy] = at(s)\n x += sx / seats.length\n y += sy / seats.length\n }\n }\n const item: HitItem = {\n name: party.data.name,\n seriesIndex: party.index,\n value: party.seats,\n text: `${value(party.seats)} (${share.format(total > 0 ? party.seats / total : 0)})`,\n x,\n y,\n }\n if (party.data.color) item.color = party.data.color\n // A halo around every seat of the party.\n const r = dot + 3\n const d = seats\n .map((s) => {\n const [sx, sy] = at(s)\n return `M${round(sx + r)},${round(sy)}A${r},${r},0,1,1,${round(sx - r)},${round(sy)}A${r},${r},0,1,1,${round(sx + r)},${round(sy)}Z`\n })\n .join('')\n return {\n index: drawn.indexOf(party),\n label: party.data.name,\n title: '',\n x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: party.index,\n mark: { d, x: 0, y: 0 },\n }\n }\n\n const interaction: Interaction = {\n count: drawn.length,\n hitIndex: (position) => {\n const party = drawn[position]\n return party ? hitFor(party) : null\n },\n hitTest(px, py) {\n const reach = dot + 2\n let best: { party: Party; seat: Seat; d: number } | undefined\n for (const party of drawn) {\n for (const seat of seatsOf[party.position] as Seat[]) {\n const [x, y] = at(seat)\n const d = Math.hypot(px - x, py - y)\n if (d <= reach && (!best || d < best.d)) best = { party, seat, d }\n }\n }\n return best ? hitFor(best.party, best.seat) : null\n },\n }\n ctx.onHitTest(interaction)\n\n const circle = (seat: Seat, key: number, cls: string) => {\n const [x, y] = at(seat)\n return h('circle', {\n key,\n class: cls,\n r: dot,\n style: `transform:translate(${round(x - cx)}px,${round(y - cy)}px)`,\n })\n }\n const groups = parties.map((party) =>\n h(\n 'g',\n groupAttrs(party.data, party.index),\n (seatsOf[party.position] as Seat[]).map((seat, i) => circle(seat, i, 'tc-seat')),\n ),\n )\n\n const centerValue = showCenter ? (center?.value ?? value(total)) : ''\n\n return [\n // Seats sit in their own group: the entrance animation transforms it, not the translated parent.\n h(\n 'g',\n { class: 'tc-parliament', style: `transform:translate(${round(cx)}px,${round(cy)}px)` },\n h(\n 'g',\n { class: 'tc-parliament-seats' },\n groups,\n vacant.length > 0 &&\n h(\n 'g',\n { key: 'vacant', class: 'tc-parliament-vacant' },\n vacant.map((seat, i) => circle(seat, i, 'tc-seat tc-seat-vacant')),\n ),\n ),\n ),\n showCenter &&\n h(\n 'g',\n { class: 'tc-parliament-center', 'aria-hidden': 'true' },\n centerLabel &&\n h(\n 'text',\n {\n class: 'tc-parliament-label',\n x: round(cx),\n y: round(cy),\n dy: open ? '-2.5em' : '1.6em',\n 'text-anchor': 'middle',\n },\n centerLabel,\n ),\n h(\n 'text',\n {\n class: 'tc-parliament-value',\n x: round(cx),\n y: round(cy),\n dy: open ? '-0.4em' : centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n ),\n ]\n}\n\nfunction parliamentTable(options: ParliamentOptions, ctx: RenderContext): DataTable {\n const parties = partiesOf(options, ctx.hidden)\n const { total } = seatCounts(options, parties)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Seats', 'Share'],\n rows: parties.map((party) => [\n party.data.name,\n value(party.seats),\n share.format(total > 0 ? party.seats / total : 0),\n ]),\n }\n}\n\n/**\n * Parliament chart: the seats of a house as dots on concentric benches, a\n * hemicycle by default, each party a wedge of them in data order from the\n * left, with the number of seats in the middle.\n *\n * ```ts\n * new Chart('#el', {\n * type: parliament,\n * data: [{ name: 'Left', seats: 135 }, { name: 'Right', seats: 57 }, { name: 'Other', seats: 7 }],\n * })\n * ```\n */\nexport const parliament: ChartType<ParliamentOptions> = {\n name: 'parliament',\n clean: cleanData((data) => records(data, (r) => ({ ...named(r), seats: finite(r.seats) ?? 0 }))),\n render: renderParliament,\n legend: (options) => legendItems(options.data),\n table: parliamentTable,\n}\n"],"mappings":";;;;;;;;AA0DA,MAAM,YAAY;AA0BlB,SAAS,UAAU,SAA4B,QAAsC;CACnF,OAAO,QAAQ,KACZ,KAAK,MAAM,WAAW;EACrB;EACA;EACA,OAAO,KAAK,IAAI,WAAW,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC;CACrE,EAAE,CAAC,CACF,QAAQ,UAAU,CAAC,OAAO,IAAIA,cAAAA,MAAM,MAAM,IAAI,CAAC,CAAC,CAAC,CACjD,KAAK,OAAO,cAAc;EAAE,GAAG;EAAO;CAAS,EAAE;AACtD;;AAGA,SAAS,WACP,SACA,SACkC;CAClC,MAAM,QAAQ,KAAK,IACjB,WACA,QAAQ,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC,CACrD;CACA,MAAM,SAAS,KAAK,IAAI,WAAW,KAAK,MAAM,QAAQ,SAAS,CAAC,CAAC;CACjE,OAAO;EAAE;EAAO,OAAO,KAAK,IAAI,OAAO,SAAS,IAAI,SAAS,CAAC;CAAE;AAClE;;AAGA,SAAS,WAAW,OAAe,OAAoC;CACrE,MAAM,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC;CAC3C,MAAM,SAAS,MAAM,KAAK,MAAM,KAAK,MAAO,QAAQ,IAAK,GAAG,CAAC;CAC7D,IAAI,OAAO,QAAQ,OAAO,QAA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ACjB,GACA,WACF,CACF,CACJ;AACF;AAEA,SAAS,gBAAgB,SAA4B,KAA+B;CAClF,MAAM,UAAU,UAAU,SAAS,IAAI,MAAM;CAC7C,MAAM,EAAE,UAAU,WAAW,SAAS,OAAO;CAC7C,MAAM,QAAQC,eAAAA,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,QAAQ,KAAK,UAAU;GAC3B,MAAM,KAAK;GACX,MAAM,MAAM,KAAK;GACjB,MAAM,OAAO,QAAQ,IAAI,MAAM,QAAQ,QAAQ,CAAC;EAClD,CAAC;CACH;AACF;;;;;;;;;;;;;AAcA,MAAa,aAA2C;CACtD,MAAM;CACN,OAAOG,cAAAA,WAAW,SAASC,cAAAA,QAAQ,OAAO,OAAO;EAAE,GAAGC,cAAAA,MAAM,CAAC;EAAG,OAAOC,cAAAA,OAAO,EAAE,KAAK,KAAK;CAAE,EAAE,CAAC;CAC/F,QAAQ;CACR,SAAS,YAAYC,cAAAA,YAAY,QAAQ,IAAI;CAC7C,OAAO;AACT"}
@@ -0,0 +1,69 @@
1
+ import { a as InsetsInput } from "./annotations-lyt0I3HU.cjs";
2
+ import { a as ClassValue } from "./vnode-BUflsBsa.cjs";
3
+ import { a as ChartType } from "./chart-D7ooEFnk.cjs";
4
+ import { c as NumberFormat } from "./time-CNVnt-B2.cjs";
5
+ //#region src/charts/parliament.d.ts
6
+ /** One party (or group) of a parliament. */
7
+ interface ParliamentParty {
8
+ name: string;
9
+ /** Seats won; a fraction is rounded, a negative count is zero. */
10
+ seats: number;
11
+ /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */
12
+ id?: string;
13
+ /**
14
+ * Custom color; overrides the palette slot via `--tc-series-color`.
15
+ * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
16
+ */
17
+ color?: string;
18
+ /** Extra classes on the party group. */
19
+ class?: ClassValue;
20
+ /** Start hidden (toggle it back from the legend). */
21
+ hidden?: boolean;
22
+ }
23
+ interface ParliamentOptions {
24
+ /** Parties in their order along the benches, from the left. */
25
+ data: readonly ParliamentParty[];
26
+ /**
27
+ * Seats in the house. Defaults to the parties' sum; more than that leaves
28
+ * vacant seats, drawn empty after the last party.
29
+ */
30
+ total?: number;
31
+ /** Rows of seats. Defaults to the fewest rows that seat everyone comfortably. */
32
+ rows?: number;
33
+ /** Where the benches start, in degrees clockwise from 12 o'clock. Defaults to `-angle / 2`. */
34
+ startAngle?: number;
35
+ /** Degrees the benches span, `0…360`. Defaults to `180` (a hemicycle). */
36
+ angle?: number;
37
+ /** Radius of the innermost row relative to the outermost, `0…0.95`. Defaults to `0.45`. */
38
+ innerRadius?: number;
39
+ /** Space between seats as a share of their pitch, `0…0.9`. Defaults to `0.35`. */
40
+ gap?: number;
41
+ /** Format of the seat counts (tooltip, table, center). */
42
+ format?: NumberFormat;
43
+ /**
44
+ * Text in the middle: the number of seats by default; `false` hides it, or
45
+ * give your own `value` / `label` (the label sits above the value).
46
+ */
47
+ center?: false | {
48
+ value?: string;
49
+ label?: string;
50
+ };
51
+ /** Extra space around the chart, in pixels. */
52
+ padding?: InsetsInput;
53
+ }
54
+ /**
55
+ * Parliament chart: the seats of a house as dots on concentric benches, a
56
+ * hemicycle by default, each party a wedge of them in data order from the
57
+ * left, with the number of seats in the middle.
58
+ *
59
+ * ```ts
60
+ * new Chart('#el', {
61
+ * type: parliament,
62
+ * data: [{ name: 'Left', seats: 135 }, { name: 'Right', seats: 57 }, { name: 'Other', seats: 7 }],
63
+ * })
64
+ * ```
65
+ */
66
+ declare const parliament: ChartType<ParliamentOptions>;
67
+ //#endregion
68
+ export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
69
+ //# sourceMappingURL=parliament-DdrLVZwt.d.cts.map