@tabler/charts 0.1.0 → 0.2.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.
- package/README.md +19 -1
- package/dist/{annotations-Bp7HwtF5.d.ts → annotations-B02GR_KU.d.ts} +3 -8
- package/dist/{annotations-lyt0I3HU.d.cts → annotations-CHafaGd4.d.cts} +3 -8
- package/dist/{annotations-BszTTjf9.js → annotations-D0YQ0IoA.js} +6 -7
- package/dist/{annotations-BszTTjf9.js.map → annotations-D0YQ0IoA.js.map} +1 -1
- package/dist/{annotations-DpETO8dE.cjs → annotations-DdRdeBUB.cjs} +6 -7
- package/dist/{annotations-DpETO8dE.cjs.map → annotations-DdRdeBUB.cjs.map} +1 -1
- package/dist/annotations.cjs +3 -5
- package/dist/annotations.cjs.map +1 -1
- package/dist/annotations.d.cts +2 -1
- package/dist/annotations.d.ts +2 -1
- package/dist/annotations.js +3 -4
- package/dist/{arc-a1tRTEw7.js → arc-B3V5IR0w.js} +2 -3
- package/dist/{arc-a1tRTEw7.js.map → arc-B3V5IR0w.js.map} +1 -1
- package/dist/{arc-BXpLrt9b.cjs → arc-CYhI62kO.cjs} +2 -3
- package/dist/{arc-BXpLrt9b.cjs.map → arc-CYhI62kO.cjs.map} +1 -1
- package/dist/{area-DQsLERhx.js → area-0-L1bG9B.js} +5 -6
- package/dist/{area-DQsLERhx.js.map → area-0-L1bG9B.js.map} +1 -1
- package/dist/{area-sHCE3pg5.cjs → area-4eRs3c0K.cjs} +5 -6
- package/dist/{area-sHCE3pg5.cjs.map → area-4eRs3c0K.cjs.map} +1 -1
- package/dist/{area-CF__HOwL.d.ts → area-CJX9219z.d.cts} +3 -6
- package/dist/{area-DIxaAbYZ.d.cts → area-d11XePuw.d.ts} +3 -6
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +2 -1
- package/dist/area.d.ts +2 -1
- package/dist/area.js +1 -2
- package/dist/{band-DTcNDAFO.d.ts → band-CNKvdnTC.d.cts} +1 -4
- package/dist/{band-DTcNDAFO.d.cts → band-CNKvdnTC.d.ts} +1 -4
- package/dist/{bar-DM16NUvV.js → bar-B5n2oq9-.js} +3 -4
- package/dist/{bar-DM16NUvV.js.map → bar-B5n2oq9-.js.map} +1 -1
- package/dist/{bar-BBM8RhoL.d.ts → bar-BDLR4p9c.d.cts} +4 -7
- package/dist/{bar-jZEoao74.js → bar-BNZ3GhIw.js} +20 -20
- package/dist/bar-BNZ3GhIw.js.map +1 -0
- package/dist/{bar-C-7zR2qp.cjs → bar-Da6dE_nI.cjs} +20 -20
- package/dist/bar-Da6dE_nI.cjs.map +1 -0
- package/dist/{bar-DGuUN3nc.cjs → bar-LYIF8MEz.cjs} +3 -4
- package/dist/{bar-DGuUN3nc.cjs.map → bar-LYIF8MEz.cjs.map} +1 -1
- package/dist/{bar-CRKLDg98.d.cts → bar-XwzM6Pb0.d.ts} +4 -7
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +2 -1
- package/dist/bar.d.ts +2 -1
- package/dist/bar.js +1 -2
- package/dist/{candlestick-DuXwAFID.js → candlestick-BHQkQfxH.js} +6 -7
- package/dist/{candlestick-DuXwAFID.js.map → candlestick-BHQkQfxH.js.map} +1 -1
- package/dist/{candlestick-B5r1w3kc.cjs → candlestick-CYCQXgky.cjs} +6 -7
- package/dist/{candlestick-B5r1w3kc.cjs.map → candlestick-CYCQXgky.cjs.map} +1 -1
- package/dist/{candlestick-D_vV0_XZ.d.ts → candlestick-D0xKkdqd.d.ts} +3 -6
- package/dist/{candlestick-__pXl_pV.d.cts → candlestick-Dq7qp-F0.d.cts} +3 -6
- package/dist/candlestick.cjs +4 -5
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +4 -6
- package/dist/{cartesian-Cr0AF0nG.js → cartesian-CI2x6N7N.js} +27 -27
- package/dist/cartesian-CI2x6N7N.js.map +1 -0
- package/dist/{cartesian-BoDfgBCV.cjs → cartesian-DV02PsBe.cjs} +27 -27
- package/dist/cartesian-DV02PsBe.cjs.map +1 -0
- package/dist/{chart-BF2CK9I_.js → chart-DWn9v6qw.js} +35 -24
- package/dist/chart-DWn9v6qw.js.map +1 -0
- package/dist/{chart-DyN7bcx8.d.ts → chart-QilhWP8Z.d.ts} +32 -49
- package/dist/{chart-CowF_lWY.cjs → chart-e2VqomCI.cjs} +35 -24
- package/dist/chart-e2VqomCI.cjs.map +1 -0
- package/dist/{chart-D7ooEFnk.d.cts → chart-kqFMEwDo.d.cts} +58 -49
- package/dist/{circle-BQMuAfls.cjs → circle-Bwxy5j7B.cjs} +2 -3
- package/dist/{circle-BQMuAfls.cjs.map → circle-Bwxy5j7B.cjs.map} +1 -1
- package/dist/{circle-Z7YfCoCM.js → circle-YRDaOBpk.js} +2 -3
- package/dist/{circle-Z7YfCoCM.js.map → circle-YRDaOBpk.js.map} +1 -1
- package/dist/{clean-o1vDEhFV.js → clean-CkoQobGv.js} +3 -4
- package/dist/{clean-o1vDEhFV.js.map → clean-CkoQobGv.js.map} +1 -1
- package/dist/{clean-Byl6kzf0.cjs → clean-Die2iCNc.cjs} +8 -3
- package/dist/{clean-Byl6kzf0.cjs.map → clean-Die2iCNc.cjs.map} +1 -1
- package/dist/{core-CegR_j55.js → core-BKRQvPAT.js} +33 -41
- package/dist/core-BKRQvPAT.js.map +1 -0
- package/dist/{core-RzS9IQO5.cjs → core-DIOC61up.cjs} +33 -41
- package/dist/core-DIOC61up.cjs.map +1 -0
- package/dist/{core-DcbemzGf.d.ts → core-DRUCk67j.d.ts} +4 -41
- package/dist/{core-D1vO1LrC.d.cts → core-PAX5ogLk.d.cts} +22 -67
- package/dist/core.cjs +28 -24
- package/dist/core.d.cts +23 -21
- package/dist/core.d.ts +23 -21
- package/dist/core.js +27 -25
- package/dist/{dates-CG-FvioW.js → dates-C2RzY3rE.js} +4 -5
- package/dist/{dates-CG-FvioW.js.map → dates-C2RzY3rE.js.map} +1 -1
- package/dist/{dates-Btm7Zm6W.cjs → dates-DurEr9WT.cjs} +4 -5
- package/dist/{dates-Btm7Zm6W.cjs.map → dates-DurEr9WT.cjs.map} +1 -1
- package/dist/{decimate-tLhDk1ys.cjs → decimate-BS3x8g-f.cjs} +2 -3
- package/dist/{decimate-tLhDk1ys.cjs.map → decimate-BS3x8g-f.cjs.map} +1 -1
- package/dist/{decimate-BGg9XgF0.d.ts → decimate-BxxYBJJk.d.cts} +2 -5
- package/dist/{decimate-C87cl_Sp.js → decimate-CapfgiDY.js} +2 -3
- package/dist/{decimate-C87cl_Sp.js.map → decimate-CapfgiDY.js.map} +1 -1
- package/dist/{decimate-CNSpgGa5.d.cts → decimate-Du87fMLG.d.ts} +2 -5
- package/dist/decimate.cjs +3 -4
- package/dist/decimate.d.cts +1 -1
- package/dist/decimate.d.ts +1 -1
- package/dist/decimate.js +3 -4
- package/dist/{dom-vP3IcMak.js → dom-CuceR8gt.js} +4 -6
- package/dist/{dom-vP3IcMak.js.map → dom-CuceR8gt.js.map} +1 -1
- package/dist/{dom-CLF868Qs.cjs → dom-D_g13XWY.cjs} +4 -6
- package/dist/{dom-CLF868Qs.cjs.map → dom-D_g13XWY.cjs.map} +1 -1
- package/dist/{export-chart-9w8t3rjZ.js → export-chart-83UYH48t.js} +3 -4
- package/dist/{export-chart-9w8t3rjZ.js.map → export-chart-83UYH48t.js.map} +1 -1
- package/dist/{export-chart-BhhYgksr.cjs → export-chart-mYgEfK-L.cjs} +3 -4
- package/dist/{export-chart-BhhYgksr.cjs.map → export-chart-mYgEfK-L.cjs.map} +1 -1
- package/dist/export.cjs +3 -5
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +8 -1
- package/dist/export.d.ts +8 -1
- package/dist/export.js +3 -4
- package/dist/{extent-BAMZo0Nq.js → extent-DOV8rs-6.js} +2 -3
- package/dist/{extent-BAMZo0Nq.js.map → extent-DOV8rs-6.js.map} +1 -1
- package/dist/{extent-DsFWvAHJ.cjs → extent-DuYDcvM9.cjs} +2 -3
- package/dist/{extent-DsFWvAHJ.cjs.map → extent-DuYDcvM9.cjs.map} +1 -1
- package/dist/{fade-Cs74puQS.cjs → fade-DVTkhrFU.cjs} +4 -6
- package/dist/{fade-Cs74puQS.cjs.map → fade-DVTkhrFU.cjs.map} +1 -1
- package/dist/{fade-D3NxH5Qg.js → fade-GGxcBdss.js} +4 -6
- package/dist/{fade-D3NxH5Qg.js.map → fade-GGxcBdss.js.map} +1 -1
- package/dist/{features-wASyHGic.js → features-BMxkqCyS.js} +2 -3
- package/dist/{features-wASyHGic.js.map → features-BMxkqCyS.js.map} +1 -1
- package/dist/{features-BclHgg2W.cjs → features-DCXEvoya.cjs} +2 -3
- package/dist/{features-BclHgg2W.cjs.map → features-DCXEvoya.cjs.map} +1 -1
- package/dist/{format-B0yKXBTH.cjs → format-CAE5ruy6.cjs} +2 -3
- package/dist/{format-B0yKXBTH.cjs.map → format-CAE5ruy6.cjs.map} +1 -1
- package/dist/{format-lStwuc1L.js → format-it1kepFG.js} +2 -3
- package/dist/{format-lStwuc1L.js.map → format-it1kepFG.js.map} +1 -1
- package/dist/{gauge-zpia05t2.d.ts → gauge-0VJuAHWF.d.ts} +5 -8
- package/dist/{gauge-DP_EB2z3.d.cts → gauge-BSist7My.d.cts} +5 -8
- package/dist/{gauge-D-FYhuds.cjs → gauge-DXkjXNCD.cjs} +10 -11
- package/dist/gauge-DXkjXNCD.cjs.map +1 -0
- package/dist/{gauge-Dh423FHh.js → gauge-ts0kqN1-.js} +10 -11
- package/dist/{gauge-Dh423FHh.js.map → gauge-ts0kqN1-.js.map} +1 -1
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +2 -1
- package/dist/gauge.d.ts +2 -1
- package/dist/gauge.js +1 -2
- package/dist/{heatmap-DSZ2bVIa.js → heatmap-19BGJTKF.js} +20 -22
- package/dist/heatmap-19BGJTKF.js.map +1 -0
- package/dist/{heatmap-BectCEeE.d.ts → heatmap-59lmClj9.d.ts} +4 -7
- package/dist/{heatmap-BK18EBgJ.cjs → heatmap-CXhlrLTl.cjs} +20 -22
- package/dist/heatmap-CXhlrLTl.cjs.map +1 -0
- package/dist/{heatmap-CCso6m61.d.cts → heatmap-Dp_oyEe0.d.cts} +4 -7
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +2 -1
- package/dist/heatmap.d.ts +2 -1
- package/dist/heatmap.js +1 -2
- package/dist/{hydrate-CzfxLfTv.d.ts → hydrate-BtAZf_5K.d.cts} +2 -5
- package/dist/{hydrate-CxwTXDqO.cjs → hydrate-CmN1k8Mo.cjs} +3 -4
- package/dist/hydrate-CmN1k8Mo.cjs.map +1 -0
- package/dist/{hydrate-DDNIHYv_.js → hydrate-OA6R2_Pn.js} +3 -4
- package/dist/{hydrate-DDNIHYv_.js.map → hydrate-OA6R2_Pn.js.map} +1 -1
- package/dist/{hydrate-CTTmQy0x.d.cts → hydrate-OjM1pIUG.d.ts} +2 -5
- package/dist/hydrate.cjs +3 -4
- package/dist/hydrate.cjs.map +1 -1
- package/dist/hydrate.d.cts +1 -1
- package/dist/hydrate.d.ts +1 -1
- package/dist/hydrate.js +3 -4
- package/dist/index.cjs +49 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -27
- package/dist/index.d.ts +24 -27
- package/dist/index.js +44 -43
- package/dist/index.js.map +1 -1
- package/dist/{layout-B3hiqVEw.js → layout-DmrrLjwN.js} +9 -4
- package/dist/layout-DmrrLjwN.js.map +1 -0
- package/dist/{layout-CtMBhNd9.cjs → layout-JY2aR-yE.cjs} +14 -3
- package/dist/layout-JY2aR-yE.cjs.map +1 -0
- package/dist/{line-B3Ed6u7j.js → line-DO66LtwH.js} +9 -10
- package/dist/{line-B3Ed6u7j.js.map → line-DO66LtwH.js.map} +1 -1
- package/dist/{line-fQbtP_jL.cjs → line-Dbt6KFRK.cjs} +9 -10
- package/dist/{line-fQbtP_jL.cjs.map → line-Dbt6KFRK.cjs.map} +1 -1
- package/dist/{line-CN4uZ9ZX.d.ts → line-DtSh7HQU.d.ts} +4 -7
- package/dist/{line-W7VD_qs1.d.cts → line-_rNdeKmS.d.cts} +5 -7
- package/dist/line.cjs +4 -5
- package/dist/line.cjs.map +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +4 -6
- package/dist/{log-CaofN3-n.d.ts → log-CI41TmcU.d.cts} +1 -6
- package/dist/{log-CaofN3-n.d.cts → log-CI41TmcU.d.ts} +1 -6
- package/dist/{log-axis-83rSpvL5.cjs → log-axis-DdRNyAq8.cjs} +6 -8
- package/dist/{log-axis-83rSpvL5.cjs.map → log-axis-DdRNyAq8.cjs.map} +1 -1
- package/dist/{log-axis-B_uvvOFc.js → log-axis-DhthtHFk.js} +6 -8
- package/dist/{log-axis-B_uvvOFc.js.map → log-axis-DhthtHFk.js.map} +1 -1
- package/dist/log.cjs +3 -5
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.cts +1 -1
- package/dist/log.d.ts +1 -1
- package/dist/log.js +3 -4
- package/dist/{morph-CqYDu1bY.cjs → morph-9_LJL0ra.cjs} +4 -5
- package/dist/morph-9_LJL0ra.cjs.map +1 -0
- package/dist/{morph-BMxz3X2b.d.ts → morph-Dh7gJkV4.d.cts} +1 -4
- package/dist/{morph-BMxz3X2b.d.cts → morph-Dh7gJkV4.d.ts} +1 -4
- package/dist/{morph-Bgg-24l8.js → morph-DnRxuwR-.js} +4 -5
- package/dist/{morph-Bgg-24l8.js.map → morph-DnRxuwR-.js.map} +1 -1
- package/dist/morph.cjs +3 -4
- package/dist/morph.cjs.map +1 -1
- package/dist/morph.d.cts +1 -1
- package/dist/morph.d.ts +1 -1
- package/dist/morph.js +3 -4
- package/dist/{named-BWWb5LQJ.cjs → named-BBASc8dW.cjs} +2 -3
- package/dist/{named-BWWb5LQJ.cjs.map → named-BBASc8dW.cjs.map} +1 -1
- package/dist/{named-DE15TOgh.js → named-BOiBah6I.js} +2 -3
- package/dist/{named-DE15TOgh.js.map → named-BOiBah6I.js.map} +1 -1
- package/dist/others-DWdK7vKp.cjs +60 -0
- package/dist/others-DWdK7vKp.cjs.map +1 -0
- package/dist/others-J7NCAMA0.js +49 -0
- package/dist/others-J7NCAMA0.js.map +1 -0
- package/dist/{parliament-1Zv2Xh0D.d.ts → parliament-CLCI7tUO.d.ts} +5 -8
- package/dist/{parliament-DdrLVZwt.d.cts → parliament-CgsVnWEe.d.cts} +5 -8
- package/dist/{parliament-Dw0sOERi.js → parliament-Cru4IcuM.js} +8 -9
- package/dist/parliament-Cru4IcuM.js.map +1 -0
- package/dist/{parliament-CpWnoEvG.cjs → parliament-x5hcFaQ3.cjs} +8 -9
- package/dist/parliament-x5hcFaQ3.cjs.map +1 -0
- package/dist/parliament.cjs +1 -1
- package/dist/parliament.d.cts +2 -1
- package/dist/parliament.d.ts +2 -1
- package/dist/parliament.js +1 -2
- package/dist/{path-CwB28da0.d.ts → path-YeUiOfG8.d.cts} +1 -4
- package/dist/{path-CwB28da0.d.cts → path-YeUiOfG8.d.ts} +1 -4
- package/dist/{patterns-DtgcnA8o.js → patterns-CufKZYhm.js} +4 -5
- package/dist/{patterns-DtgcnA8o.js.map → patterns-CufKZYhm.js.map} +1 -1
- package/dist/{patterns-LfcQAWCy.cjs → patterns-D3-wQagb.cjs} +4 -5
- package/dist/{patterns-LfcQAWCy.cjs.map → patterns-D3-wQagb.cjs.map} +1 -1
- package/dist/patterns.cjs +3 -5
- package/dist/patterns.cjs.map +1 -1
- package/dist/patterns.d.cts +5 -1
- package/dist/patterns.d.ts +5 -1
- package/dist/patterns.js +3 -4
- package/dist/percentage-bar-B6tNOqNn.js +157 -0
- package/dist/percentage-bar-B6tNOqNn.js.map +1 -0
- package/dist/percentage-bar-nhTeakD_.d.ts +62 -0
- package/dist/percentage-bar-tepMr7Hd.d.cts +62 -0
- package/dist/percentage-bar-ybNS3goo.cjs +162 -0
- package/dist/percentage-bar-ybNS3goo.cjs.map +1 -0
- package/dist/percentage-bar.cjs +3 -0
- package/dist/percentage-bar.d.cts +3 -0
- package/dist/percentage-bar.d.ts +3 -0
- package/dist/percentage-bar.js +1 -0
- package/dist/{pie-5z1fDdKO.d.ts → pie-BXg2gNpb.d.cts} +14 -8
- package/dist/{pie-BxTZt6Go.cjs → pie-BpjvSPnz.cjs} +13 -17
- package/dist/pie-BpjvSPnz.cjs.map +1 -0
- package/dist/{pie-BF9yI5mE.d.cts → pie-CFptILSm.d.ts} +14 -8
- package/dist/{pie-DzUXDTcn.js → pie-CVsc-6qD.js} +13 -17
- package/dist/pie-CVsc-6qD.js.map +1 -0
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +2 -1
- package/dist/pie.d.ts +2 -1
- package/dist/pie.js +1 -2
- package/dist/{point-shapes-CGl4dugc.cjs → point-shapes--_gmdTyK.cjs} +3 -4
- package/dist/{point-shapes-CGl4dugc.cjs.map → point-shapes--_gmdTyK.cjs.map} +1 -1
- package/dist/{point-shapes-DI84NNpI.js → point-shapes-DD2Ektzm.js} +3 -4
- package/dist/{point-shapes-DI84NNpI.js.map → point-shapes-DD2Ektzm.js.map} +1 -1
- package/dist/point-shapes.cjs +3 -4
- package/dist/point-shapes.d.cts +5 -1
- package/dist/point-shapes.d.ts +5 -1
- package/dist/point-shapes.js +3 -4
- package/dist/{radar-1-EryihA.d.ts → radar-BC9Skgpj.d.ts} +4 -7
- package/dist/{radar-CYPab_I4.js → radar-BR-mumDd.js} +7 -8
- package/dist/{radar-CYPab_I4.js.map → radar-BR-mumDd.js.map} +1 -1
- package/dist/{radar-DBW4O0Vt.d.cts → radar-D1-lItDy.d.cts} +4 -7
- package/dist/{radar-CoGUNNSb.cjs → radar-HPDrIdzc.cjs} +7 -8
- package/dist/{radar-CoGUNNSb.cjs.map → radar-HPDrIdzc.cjs.map} +1 -1
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +2 -1
- package/dist/radar.d.ts +2 -1
- package/dist/radar.js +1 -2
- package/dist/rect-D6VhynBM.cjs +16 -0
- package/dist/rect-D6VhynBM.cjs.map +1 -0
- package/dist/rect-DSVmUZrD.js +11 -0
- package/dist/rect-DSVmUZrD.js.map +1 -0
- package/dist/{sankey-B4PNKusJ.js → sankey-D6JeZfK5.js} +33 -29
- package/dist/sankey-D6JeZfK5.js.map +1 -0
- package/dist/{sankey-OV_WoPrl.d.ts → sankey-D_v7KxnJ.d.ts} +4 -7
- package/dist/{sankey-DuGI3Qc5.d.cts → sankey-Dk7jUt8x.d.cts} +4 -7
- package/dist/{sankey-Bacx4fVe.cjs → sankey-fCoo1cpz.cjs} +33 -29
- package/dist/sankey-fCoo1cpz.cjs.map +1 -0
- package/dist/sankey.cjs +1 -1
- package/dist/sankey.d.cts +2 -1
- package/dist/sankey.d.ts +2 -1
- package/dist/sankey.js +1 -2
- package/dist/{scatter-kgtgR318.js → scatter-C0TWjFpW.js} +21 -18
- package/dist/scatter-C0TWjFpW.js.map +1 -0
- package/dist/{scatter-BqzgJqdX.d.ts → scatter-CXEsioOJ.d.ts} +8 -9
- package/dist/{scatter-DgMN9zRy.cjs → scatter-DVqB_fP9.cjs} +21 -18
- package/dist/scatter-DVqB_fP9.cjs.map +1 -0
- package/dist/{scatter-DbxLyZX0.d.cts → scatter-DZeEIfyo.d.cts} +8 -9
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -1
- package/dist/scatter.d.ts +2 -1
- package/dist/scatter.js +1 -2
- package/dist/{sparkline-BS9-hltA.cjs → sparkline-B39NA0Mi.cjs} +14 -13
- package/dist/sparkline-B39NA0Mi.cjs.map +1 -0
- package/dist/{sparkline-CWlJDKyh.d.cts → sparkline-DAP6jtzw.d.cts} +5 -8
- package/dist/{sparkline-BQzt27Fr.js → sparkline-XO_TqCNP.js} +14 -13
- package/dist/sparkline-XO_TqCNP.js.map +1 -0
- package/dist/{sparkline-BfyO_oNM.d.ts → sparkline-cbvRkWqS.d.ts} +5 -8
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +2 -1
- package/dist/sparkline.d.ts +2 -1
- package/dist/sparkline.js +1 -2
- package/dist/{stack-DRbwTeF3.js → stack-2H2Gfs1Q.js} +3 -4
- package/dist/{stack-DRbwTeF3.js.map → stack-2H2Gfs1Q.js.map} +1 -1
- package/dist/{stack-DVhJWaki.cjs → stack-BgPzoQmv.cjs} +3 -4
- package/dist/{stack-DVhJWaki.cjs.map → stack-BgPzoQmv.cjs.map} +1 -1
- package/dist/{stack-CpR6RGKd.d.ts → stack-DR0eQTsB.d.ts} +1 -4
- package/dist/{stack-CpR6RGKd.d.cts → stack-Dagxq7l2.d.cts} +2 -4
- package/dist/style.css +1 -1
- package/dist/{sweep-CbfR7--d.js → sweep-BpRPlhs6.js} +5 -6
- package/dist/{sweep-CbfR7--d.js.map → sweep-BpRPlhs6.js.map} +1 -1
- package/dist/{sweep-DaTEDDuC.cjs → sweep-Dnp6LDBz.cjs} +5 -6
- package/dist/sweep-Dnp6LDBz.cjs.map +1 -0
- package/dist/{time-CNVnt-B2.d.cts → time-B4oxWHQI.d.cts} +2 -7
- package/dist/{time-CHjiY9Q4.d.ts → time-DRIDgv2a.d.ts} +2 -7
- package/dist/{time-axis-VSX34_Tb.cjs → time-axis-BjZ1bYTK.cjs} +9 -10
- package/dist/{time-axis-VSX34_Tb.cjs.map → time-axis-BjZ1bYTK.cjs.map} +1 -1
- package/dist/{time-axis-Bc9eHX1r.js → time-axis-FLONo54E.js} +9 -10
- package/dist/{time-axis-Bc9eHX1r.js.map → time-axis-FLONo54E.js.map} +1 -1
- package/dist/time.cjs +4 -6
- package/dist/time.cjs.map +1 -1
- package/dist/time.d.cts +1 -1
- package/dist/time.d.ts +1 -1
- package/dist/time.js +4 -5
- package/dist/treemap-BAkhmVQc.d.cts +55 -0
- package/dist/treemap-BNpxFBao.d.ts +55 -0
- package/dist/treemap-BWpEUlDh.cjs +303 -0
- package/dist/treemap-BWpEUlDh.cjs.map +1 -0
- package/dist/treemap-CQdavQ9u.js +298 -0
- package/dist/treemap-CQdavQ9u.js.map +1 -0
- package/dist/treemap.cjs +3 -0
- package/dist/treemap.d.cts +3 -0
- package/dist/treemap.d.ts +3 -0
- package/dist/treemap.js +1 -0
- package/dist/{tween-BCYd0RTY.js → tween-BdQqUmmv.js} +2 -3
- package/dist/{tween-BCYd0RTY.js.map → tween-BdQqUmmv.js.map} +1 -1
- package/dist/{tween-CIGBlryn.cjs → tween-c3aOmfKE.cjs} +2 -3
- package/dist/{tween-CIGBlryn.cjs.map → tween-c3aOmfKE.cjs.map} +1 -1
- package/dist/{value-labels-IZIQPhfk.js → value-labels-BBuSi4i0.js} +7 -7
- package/dist/value-labels-BBuSi4i0.js.map +1 -0
- package/dist/{value-labels-B0WJoJ7x.cjs → value-labels-BV9keAuL.cjs} +7 -7
- package/dist/value-labels-BV9keAuL.cjs.map +1 -0
- package/dist/value-labels.cjs +3 -5
- package/dist/value-labels.cjs.map +1 -1
- package/dist/value-labels.d.cts +5 -1
- package/dist/value-labels.d.ts +5 -1
- package/dist/value-labels.js +3 -4
- package/dist/{vnode-CkQ27Cxe.cjs → vnode-ClAiw28x.cjs} +2 -3
- package/dist/{vnode-CkQ27Cxe.cjs.map → vnode-ClAiw28x.cjs.map} +1 -1
- package/dist/{vnode-BUflsBsa.d.ts → vnode-Du2cC8Fm.d.cts} +1 -4
- package/dist/{vnode-BUflsBsa.d.cts → vnode-Du2cC8Fm.d.ts} +1 -4
- package/dist/{vnode-tCWItoUH.js → vnode-_EMUqysL.js} +2 -3
- package/dist/{vnode-tCWItoUH.js.map → vnode-_EMUqysL.js.map} +1 -1
- package/package.json +21 -1
- package/dist/bar-C-7zR2qp.cjs.map +0 -1
- package/dist/bar-jZEoao74.js.map +0 -1
- package/dist/cartesian-BoDfgBCV.cjs.map +0 -1
- package/dist/cartesian-Cr0AF0nG.js.map +0 -1
- package/dist/chart-BF2CK9I_.js.map +0 -1
- package/dist/chart-CowF_lWY.cjs.map +0 -1
- package/dist/core-CegR_j55.js.map +0 -1
- package/dist/core-RzS9IQO5.cjs.map +0 -1
- package/dist/gauge-D-FYhuds.cjs.map +0 -1
- package/dist/heatmap-BK18EBgJ.cjs.map +0 -1
- package/dist/heatmap-DSZ2bVIa.js.map +0 -1
- package/dist/hydrate-CxwTXDqO.cjs.map +0 -1
- package/dist/layout-B3hiqVEw.js.map +0 -1
- package/dist/layout-CtMBhNd9.cjs.map +0 -1
- package/dist/morph-CqYDu1bY.cjs.map +0 -1
- package/dist/parliament-CpWnoEvG.cjs.map +0 -1
- package/dist/parliament-Dw0sOERi.js.map +0 -1
- package/dist/pie-BxTZt6Go.cjs.map +0 -1
- package/dist/pie-DzUXDTcn.js.map +0 -1
- package/dist/sankey-B4PNKusJ.js.map +0 -1
- package/dist/sankey-Bacx4fVe.cjs.map +0 -1
- package/dist/scatter-DgMN9zRy.cjs.map +0 -1
- package/dist/scatter-kgtgR318.js.map +0 -1
- package/dist/sparkline-BQzt27Fr.js.map +0 -1
- package/dist/sparkline-BS9-hltA.cjs.map +0 -1
- package/dist/sweep-DaTEDDuC.cjs.map +0 -1
- package/dist/value-labels-B0WJoJ7x.cjs.map +0 -1
- package/dist/value-labels-IZIQPhfk.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/charts/named.ts
|
|
2
2
|
/** Stable key of a series, slice or ring: its `id`, or its name. */
|
|
3
3
|
const keyOf = (item) => item.id ?? item.name;
|
|
4
4
|
/** Legend entries for series, slices or rings, in their order (which is their color slot). */
|
|
@@ -27,7 +27,6 @@ function groupAttrs(item, index) {
|
|
|
27
27
|
style: { "--tc-series-color": item.color }
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
export { keyOf as n, legendItems as r, groupAttrs as t };
|
|
32
31
|
|
|
33
|
-
//# sourceMappingURL=named-
|
|
32
|
+
//# sourceMappingURL=named-BOiBah6I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"named-
|
|
1
|
+
{"version":3,"file":"named-BOiBah6I.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,60 @@
|
|
|
1
|
+
const require_named = require("./named-BBASc8dW.cjs");
|
|
2
|
+
// src/charts/others.ts
|
|
3
|
+
/** Legend key of the slice that groups the rest. */
|
|
4
|
+
const OTHERS = "__others__";
|
|
5
|
+
/**
|
|
6
|
+
* The slices of the data in its order: every entry, or with more of them
|
|
7
|
+
* than `maxSlices`, the largest ones and one slice for the rest (in the
|
|
8
|
+
* color of the slots past the palette), named by `label`. `maxSlices` is nine
|
|
9
|
+
* by default (the eight palette colors and the rest) and zero never groups.
|
|
10
|
+
* Hidden entries count here, so hiding one does not pull another out of the
|
|
11
|
+
* rest.
|
|
12
|
+
*/
|
|
13
|
+
function groupSlices(data, maxSlices, label = "Others") {
|
|
14
|
+
const all = data.map((entry, index) => ({
|
|
15
|
+
data: entry,
|
|
16
|
+
index,
|
|
17
|
+
value: Math.max(0, entry.value || 0)
|
|
18
|
+
}));
|
|
19
|
+
const max = Number.isFinite(maxSlices) && maxSlices >= 0 ? maxSlices : 9;
|
|
20
|
+
const limit = max ? Math.max(1, Math.round(max)) : Number.POSITIVE_INFINITY;
|
|
21
|
+
if (all.length <= limit) return all;
|
|
22
|
+
const kept = new Set([...all].sort((a, b) => b.value - a.value || a.index - b.index).slice(0, limit - 1));
|
|
23
|
+
const value = all.reduce((sum, slice) => kept.has(slice) ? sum : sum + slice.value, 0);
|
|
24
|
+
return [...all.filter((slice) => kept.has(slice)), {
|
|
25
|
+
data: {
|
|
26
|
+
name: label,
|
|
27
|
+
id: OTHERS,
|
|
28
|
+
value
|
|
29
|
+
},
|
|
30
|
+
index: Math.max(8, all.length),
|
|
31
|
+
value
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
/** Legend entries of the slices as drawn, the rest included. */
|
|
35
|
+
function groupLegend(slices) {
|
|
36
|
+
return slices.map(({ data, index }) => {
|
|
37
|
+
const item = {
|
|
38
|
+
key: require_named.keyOf(data),
|
|
39
|
+
name: data.name,
|
|
40
|
+
index
|
|
41
|
+
};
|
|
42
|
+
if (data.color) item.color = data.color;
|
|
43
|
+
if (data.hidden) item.hidden = true;
|
|
44
|
+
return item;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
Object.defineProperty(exports, "groupLegend", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function() {
|
|
50
|
+
return groupLegend;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "groupSlices", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function() {
|
|
56
|
+
return groupSlices;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=others-DWdK7vKp.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"others-DWdK7vKp.cjs","names":["keyOf"],"sources":["../src/charts/others.ts"],"sourcesContent":["import type { LegendItem } from '../legend.ts'\nimport { keyOf, type Named } from './named.ts'\n\n/** Legend key of the slice that groups the rest. */\nconst OTHERS = '__others__'\n\n/** A slice or segment with its size, in color slot `index` (past the data for the rest). */\nexport interface Grouped<T> {\n data: T\n index: number\n value: number\n}\n\n/**\n * The slices of the data in its order: every entry, or with more of them\n * than `maxSlices`, the largest ones and one slice for the rest (in the\n * color of the slots past the palette), named by `label`. `maxSlices` is nine\n * by default (the eight palette colors and the rest) and zero never groups.\n * Hidden entries count here, so hiding one does not pull another out of the\n * rest.\n */\nexport function groupSlices<T extends Named & { value: number }>(\n data: readonly T[],\n maxSlices: number | undefined,\n label = 'Others',\n): Grouped<T>[] {\n const all = data.map((entry, index) => ({\n data: entry,\n index,\n value: Math.max(0, entry.value || 0),\n }))\n const max = Number.isFinite(maxSlices) && (maxSlices as number) >= 0 ? maxSlices : 9\n const limit = max ? Math.max(1, Math.round(max)) : Number.POSITIVE_INFINITY\n if (all.length <= limit) return all\n const kept = new Set(\n [...all].sort((a, b) => b.value - a.value || a.index - b.index).slice(0, limit - 1),\n )\n const value = all.reduce((sum, slice) => (kept.has(slice) ? sum : sum + slice.value), 0)\n return [\n ...all.filter((slice) => kept.has(slice)),\n { data: { name: label, id: OTHERS, value } as T, index: Math.max(8, all.length), value },\n ]\n}\n\n/** Legend entries of the slices as drawn, the rest included. */\nexport function groupLegend<T extends Named>(slices: readonly Grouped<T>[]): LegendItem[] {\n return slices.map(({ data, index }) => {\n const item: LegendItem = { key: keyOf(data), name: data.name, index }\n if (data.color) item.color = data.color\n if (data.hidden) item.hidden = true\n return item\n })\n}\n"],"mappings":";;;AAIA,MAAM,SAAS;;;;;;;;;AAiBf,SAAgB,YACd,MACA,WACA,QAAQ,UACM;CACd,MAAM,MAAM,KAAK,KAAK,OAAO,WAAW;EACtC,MAAM;EACN;EACA,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,CAAC;CACrC,EAAE;CACF,MAAM,MAAM,OAAO,SAAS,SAAS,KAAM,aAAwB,IAAI,YAAY;CACnF,MAAM,QAAQ,MAAM,KAAK,IAAI,GAAG,KAAK,MAAM,GAAG,CAAC,IAAI,OAAO;CAC1D,IAAI,IAAI,UAAU,OAAO,OAAO;CAChC,MAAM,OAAO,IAAI,IACf,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CACpF;CACA,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAW,KAAK,IAAI,KAAK,IAAI,MAAM,MAAM,MAAM,OAAQ,CAAC;CACvF,OAAO,CACL,GAAG,IAAI,QAAQ,UAAU,KAAK,IAAI,KAAK,CAAC,GACxC;EAAE,MAAM;GAAE,MAAM;GAAO,IAAI;GAAQ;EAAM;EAAQ,OAAO,KAAK,IAAI,GAAG,IAAI,MAAM;EAAG;CAAM,CACzF;AACF;;AAGA,SAAgB,YAA6B,QAA6C;CACxF,OAAO,OAAO,KAAK,EAAE,MAAM,YAAY;EACrC,MAAM,OAAmB;GAAE,KAAKA,cAAAA,MAAM,IAAI;GAAG,MAAM,KAAK;GAAM;EAAM;EACpE,IAAI,KAAK,OAAO,KAAK,QAAQ,KAAK;EAClC,IAAI,KAAK,QAAQ,KAAK,SAAS;EAC/B,OAAO;CACT,CAAC;AACH"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { n as keyOf } from "./named-BOiBah6I.js";
|
|
2
|
+
// src/charts/others.ts
|
|
3
|
+
/** Legend key of the slice that groups the rest. */
|
|
4
|
+
const OTHERS = "__others__";
|
|
5
|
+
/**
|
|
6
|
+
* The slices of the data in its order: every entry, or with more of them
|
|
7
|
+
* than `maxSlices`, the largest ones and one slice for the rest (in the
|
|
8
|
+
* color of the slots past the palette), named by `label`. `maxSlices` is nine
|
|
9
|
+
* by default (the eight palette colors and the rest) and zero never groups.
|
|
10
|
+
* Hidden entries count here, so hiding one does not pull another out of the
|
|
11
|
+
* rest.
|
|
12
|
+
*/
|
|
13
|
+
function groupSlices(data, maxSlices, label = "Others") {
|
|
14
|
+
const all = data.map((entry, index) => ({
|
|
15
|
+
data: entry,
|
|
16
|
+
index,
|
|
17
|
+
value: Math.max(0, entry.value || 0)
|
|
18
|
+
}));
|
|
19
|
+
const max = Number.isFinite(maxSlices) && maxSlices >= 0 ? maxSlices : 9;
|
|
20
|
+
const limit = max ? Math.max(1, Math.round(max)) : Number.POSITIVE_INFINITY;
|
|
21
|
+
if (all.length <= limit) return all;
|
|
22
|
+
const kept = new Set([...all].sort((a, b) => b.value - a.value || a.index - b.index).slice(0, limit - 1));
|
|
23
|
+
const value = all.reduce((sum, slice) => kept.has(slice) ? sum : sum + slice.value, 0);
|
|
24
|
+
return [...all.filter((slice) => kept.has(slice)), {
|
|
25
|
+
data: {
|
|
26
|
+
name: label,
|
|
27
|
+
id: OTHERS,
|
|
28
|
+
value
|
|
29
|
+
},
|
|
30
|
+
index: Math.max(8, all.length),
|
|
31
|
+
value
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
/** Legend entries of the slices as drawn, the rest included. */
|
|
35
|
+
function groupLegend(slices) {
|
|
36
|
+
return slices.map(({ data, index }) => {
|
|
37
|
+
const item = {
|
|
38
|
+
key: keyOf(data),
|
|
39
|
+
name: data.name,
|
|
40
|
+
index
|
|
41
|
+
};
|
|
42
|
+
if (data.color) item.color = data.color;
|
|
43
|
+
if (data.hidden) item.hidden = true;
|
|
44
|
+
return item;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { groupSlices as n, groupLegend as t };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=others-J7NCAMA0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"others-J7NCAMA0.js","names":[],"sources":["../src/charts/others.ts"],"sourcesContent":["import type { LegendItem } from '../legend.ts'\nimport { keyOf, type Named } from './named.ts'\n\n/** Legend key of the slice that groups the rest. */\nconst OTHERS = '__others__'\n\n/** A slice or segment with its size, in color slot `index` (past the data for the rest). */\nexport interface Grouped<T> {\n data: T\n index: number\n value: number\n}\n\n/**\n * The slices of the data in its order: every entry, or with more of them\n * than `maxSlices`, the largest ones and one slice for the rest (in the\n * color of the slots past the palette), named by `label`. `maxSlices` is nine\n * by default (the eight palette colors and the rest) and zero never groups.\n * Hidden entries count here, so hiding one does not pull another out of the\n * rest.\n */\nexport function groupSlices<T extends Named & { value: number }>(\n data: readonly T[],\n maxSlices: number | undefined,\n label = 'Others',\n): Grouped<T>[] {\n const all = data.map((entry, index) => ({\n data: entry,\n index,\n value: Math.max(0, entry.value || 0),\n }))\n const max = Number.isFinite(maxSlices) && (maxSlices as number) >= 0 ? maxSlices : 9\n const limit = max ? Math.max(1, Math.round(max)) : Number.POSITIVE_INFINITY\n if (all.length <= limit) return all\n const kept = new Set(\n [...all].sort((a, b) => b.value - a.value || a.index - b.index).slice(0, limit - 1),\n )\n const value = all.reduce((sum, slice) => (kept.has(slice) ? sum : sum + slice.value), 0)\n return [\n ...all.filter((slice) => kept.has(slice)),\n { data: { name: label, id: OTHERS, value } as T, index: Math.max(8, all.length), value },\n ]\n}\n\n/** Legend entries of the slices as drawn, the rest included. */\nexport function groupLegend<T extends Named>(slices: readonly Grouped<T>[]): LegendItem[] {\n return slices.map(({ data, index }) => {\n const item: LegendItem = { key: keyOf(data), name: data.name, index }\n if (data.color) item.color = data.color\n if (data.hidden) item.hidden = true\n return item\n })\n}\n"],"mappings":";;;AAIA,MAAM,SAAS;;;;;;;;;AAiBf,SAAgB,YACd,MACA,WACA,QAAQ,UACM;CACd,MAAM,MAAM,KAAK,KAAK,OAAO,WAAW;EACtC,MAAM;EACN;EACA,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,CAAC;CACrC,EAAE;CACF,MAAM,MAAM,OAAO,SAAS,SAAS,KAAM,aAAwB,IAAI,YAAY;CACnF,MAAM,QAAQ,MAAM,KAAK,IAAI,GAAG,KAAK,MAAM,GAAG,CAAC,IAAI,OAAO;CAC1D,IAAI,IAAI,UAAU,OAAO,OAAO;CAChC,MAAM,OAAO,IAAI,IACf,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CACpF;CACA,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAW,KAAK,IAAI,KAAK,IAAI,MAAM,MAAM,MAAM,OAAQ,CAAC;CACvF,OAAO,CACL,GAAG,IAAI,QAAQ,UAAU,KAAK,IAAI,KAAK,CAAC,GACxC;EAAE,MAAM;GAAE,MAAM;GAAO,IAAI;GAAQ;EAAM;EAAQ,OAAO,KAAK,IAAI,GAAG,IAAI,MAAM;EAAG;CAAM,CACzF;AACF;;AAGA,SAAgB,YAA6B,QAA6C;CACxF,OAAO,OAAO,KAAK,EAAE,MAAM,YAAY;EACrC,MAAM,OAAmB;GAAE,KAAK,MAAM,IAAI;GAAG,MAAM,KAAK;GAAM;EAAM;EACpE,IAAI,KAAK,OAAO,KAAK,QAAQ,KAAK;EAClC,IAAI,KAAK,QAAQ,KAAK,SAAS;EAC/B,OAAO;CACT,CAAC;AACH"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
//#region src/charts/parliament.d.ts
|
|
1
|
+
import { a as ChartType } from "./chart-QilhWP8Z.js";
|
|
2
|
+
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
+
import { a as InsetsInput } from "./annotations-B02GR_KU.js";
|
|
4
|
+
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
6
5
|
/** One party (or group) of a parliament. */
|
|
7
6
|
interface ParliamentParty {
|
|
8
7
|
name: string;
|
|
@@ -64,6 +63,4 @@ interface ParliamentOptions {
|
|
|
64
63
|
* ```
|
|
65
64
|
*/
|
|
66
65
|
declare const parliament: ChartType<ParliamentOptions>;
|
|
67
|
-
|
|
68
|
-
export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
|
|
69
|
-
//# sourceMappingURL=parliament-1Zv2Xh0D.d.ts.map
|
|
66
|
+
export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
//#region src/charts/parliament.d.ts
|
|
1
|
+
import { a as ChartType } from "./chart-kqFMEwDo.cjs";
|
|
2
|
+
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
+
import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
|
|
4
|
+
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
6
5
|
/** One party (or group) of a parliament. */
|
|
7
6
|
interface ParliamentParty {
|
|
8
7
|
name: string;
|
|
@@ -64,6 +63,4 @@ interface ParliamentOptions {
|
|
|
64
63
|
* ```
|
|
65
64
|
*/
|
|
66
65
|
declare const parliament: ChartType<ParliamentOptions>;
|
|
67
|
-
|
|
68
|
-
export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
|
|
69
|
-
//# sourceMappingURL=parliament-DdrLVZwt.d.cts.map
|
|
66
|
+
export { ParliamentParty as n, parliament as r, ParliamentOptions as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
|
|
1
|
+
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
2
|
+
import { i as insets, o as round, r as innerRect } from "./layout-DmrrLjwN.js";
|
|
3
|
+
import { t as DEG } from "./arc-B3V5IR0w.js";
|
|
4
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
5
|
+
import { c as named, i as finite, t as cleanData, u as records } from "./clean-CkoQobGv.js";
|
|
6
|
+
import { n as keyOf, r as legendItems, t as groupAttrs } from "./named-BOiBah6I.js";
|
|
7
|
+
// src/charts/parliament.ts
|
|
8
8
|
/** The most seats a house can have: enough for any parliament, few enough to draw. */
|
|
9
9
|
const MAX_SEATS = 5e3;
|
|
10
10
|
function partiesOf(options, hidden) {
|
|
@@ -297,7 +297,6 @@ const parliament = {
|
|
|
297
297
|
legend: (options) => legendItems(options.data),
|
|
298
298
|
table: parliamentTable
|
|
299
299
|
};
|
|
300
|
-
//#endregion
|
|
301
300
|
export { parliament as t };
|
|
302
301
|
|
|
303
|
-
//# sourceMappingURL=parliament-
|
|
302
|
+
//# sourceMappingURL=parliament-Cru4IcuM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parliament-Cru4IcuM.js","names":[],"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 // biome-ignore lint/complexity/useMathMinMax: the ternary also turns a NaN `total` into 0, Math.max would not\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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|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
1
|
+
const require_format = require("./format-CAE5ruy6.cjs");
|
|
2
|
+
const require_layout = require("./layout-JY2aR-yE.cjs");
|
|
3
|
+
const require_arc = require("./arc-CYhI62kO.cjs");
|
|
4
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
5
|
+
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
6
|
+
const require_named = require("./named-BBASc8dW.cjs");
|
|
7
|
+
// src/charts/parliament.ts
|
|
8
8
|
/** The most seats a house can have: enough for any parliament, few enough to draw. */
|
|
9
9
|
const MAX_SEATS = 5e3;
|
|
10
10
|
function partiesOf(options, hidden) {
|
|
@@ -297,7 +297,6 @@ const parliament = {
|
|
|
297
297
|
legend: (options) => require_named.legendItems(options.data),
|
|
298
298
|
table: parliamentTable
|
|
299
299
|
};
|
|
300
|
-
//#endregion
|
|
301
300
|
Object.defineProperty(exports, "parliament", {
|
|
302
301
|
enumerable: true,
|
|
303
302
|
get: function() {
|
|
@@ -305,4 +304,4 @@ Object.defineProperty(exports, "parliament", {
|
|
|
305
304
|
}
|
|
306
305
|
});
|
|
307
306
|
|
|
308
|
-
//# sourceMappingURL=parliament-
|
|
307
|
+
//# sourceMappingURL=parliament-x5hcFaQ3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parliament-x5hcFaQ3.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 // biome-ignore lint/complexity/useMathMinMax: the ternary also turns a NaN `total` into 0, Math.max would not\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,KAA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;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"}
|
package/dist/parliament.cjs
CHANGED
package/dist/parliament.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/** Standalone entry: `import { parliament } from '@tabler/charts/parliament'`. */
|
|
2
|
+
import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-CgsVnWEe.cjs";
|
|
2
3
|
export { type ParliamentOptions, type ParliamentParty, parliament };
|
package/dist/parliament.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/** Standalone entry: `import { parliament } from '@tabler/charts/parliament'`. */
|
|
2
|
+
import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-CLCI7tUO.js";
|
|
2
3
|
export { type ParliamentOptions, type ParliamentParty, parliament };
|
package/dist/parliament.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { parliament };
|
|
1
|
+
export { t as parliament } from "./parliament-Cru4IcuM.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/shapes/path.d.ts
|
|
2
1
|
/** A point in pixels; `null` (or a non-finite coordinate) marks a gap. */
|
|
3
2
|
type Point = readonly [x: number, y: number] | null | undefined;
|
|
4
3
|
/** Curve used to connect consecutive points. */
|
|
@@ -24,6 +23,4 @@ declare function linePath(points: readonly Point[], options?: PathOptions): stri
|
|
|
24
23
|
* Each run of valid points becomes a closed subpath.
|
|
25
24
|
*/
|
|
26
25
|
declare function areaPath(points: readonly Point[], baseline: number | readonly (number | null | undefined)[], options?: PathOptions): string;
|
|
27
|
-
|
|
28
|
-
export { linePath as a, areaPath as i, PathOptions as n, Point as r, Curve as t };
|
|
29
|
-
//# sourceMappingURL=path-CwB28da0.d.ts.map
|
|
26
|
+
export { linePath as a, areaPath as i, PathOptions as n, Point as r, Curve as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/shapes/path.d.ts
|
|
2
1
|
/** A point in pixels; `null` (or a non-finite coordinate) marks a gap. */
|
|
3
2
|
type Point = readonly [x: number, y: number] | null | undefined;
|
|
4
3
|
/** Curve used to connect consecutive points. */
|
|
@@ -24,6 +23,4 @@ declare function linePath(points: readonly Point[], options?: PathOptions): stri
|
|
|
24
23
|
* Each run of valid points becomes a closed subpath.
|
|
25
24
|
*/
|
|
26
25
|
declare function areaPath(points: readonly Point[], baseline: number | readonly (number | null | undefined)[], options?: PathOptions): string;
|
|
27
|
-
|
|
28
|
-
export { linePath as a, areaPath as i, PathOptions as n, Point as r, Curve as t };
|
|
29
|
-
//# sourceMappingURL=path-CwB28da0.d.cts.map
|
|
26
|
+
export { linePath as a, areaPath as i, PathOptions as n, Point as r, Curve as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { s as resolveLegend } from "./chart-DWn9v6qw.js";
|
|
2
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
3
|
+
// src/charts/patterns.ts
|
|
4
4
|
/**
|
|
5
5
|
* Pattern fills, so series do not depend on color alone (color vision
|
|
6
6
|
* deficiency, grayscale print, forced colors). Every legend entry gets an
|
|
@@ -79,7 +79,6 @@ function patternFills(config, id) {
|
|
|
79
79
|
h("defs", { key: "patterns" }, patternDefs(items, id))
|
|
80
80
|
];
|
|
81
81
|
}
|
|
82
|
-
//#endregion
|
|
83
82
|
export { patternFills as n, patternVars as r, patternDefs as t };
|
|
84
83
|
|
|
85
|
-
//# sourceMappingURL=patterns-
|
|
84
|
+
//# sourceMappingURL=patterns-CufKZYhm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns-
|
|
1
|
+
{"version":3,"file":"patterns-CufKZYhm.js","names":[],"sources":["../src/charts/patterns.ts"],"sourcesContent":["/**\n * Pattern fills, so series do not depend on color alone (color vision\n * deficiency, grayscale print, forced colors). Every legend entry gets an\n * 8×8 tile: its series color with lines or dots in `--tc-pattern-color` (the\n * surface by default) over it, one shape per color slot. The chart root\n * carries `--tc-pattern-{n}: url(#…)` and the slot classes map it to\n * `--tc-series-pattern`, which the stylesheet uses as the fill of bars,\n * areas, slices, rings and bubbles (lines get dashes instead) when\n * `patterns` is `true`, or with `'auto'` (the default) in forced colors.\n */\nimport { type ChartConfig, resolveLegend } from '../chart.ts'\nimport type { LegendItem } from '../legend.ts'\nimport { h, type VNode } from '../vnode.ts'\n\n/** Tile shapes by color slot: lines as strokes, dots as round-capped stubs. */\nconst TILES = [\n // Diagonal /, with the corners filled in so tiles join up.\n 'M-2,2L2,-2M0,8L8,0M6,10L10,6',\n // Dots.\n 'M2,2h.01M6,6h.01',\n // Diagonal \.\n 'M-2,6L2,10M0,0L8,8M6,-2L10,2',\n // Horizontal.\n 'M0,4H8',\n // Cross-hatch.\n 'M0,8L8,0M0,0L8,8',\n // Vertical.\n 'M4,0V8',\n // Grid.\n 'M0,4H8M4,0V8',\n // Dashes.\n 'M1,2H4M5,6H8',\n]\n\n/** Slots with a pattern of their own; series 9+ share the one of the \"other\" color. */\nconst SLOTS = TILES.length\n\n/** The pattern of a slot (0-based): its id suffix and slot class. */\nconst slot = (index: number): [string, string] =>\n index < SLOTS ? [`${index + 1}`, `tc-series-${index + 1}`] : ['other', '']\n\n/** `<pattern>` elements for the legend entries of a chart. */\nexport function patternDefs(items: readonly LegendItem[], id: string): VNode[] {\n const out = new Map<string, VNode>()\n for (const item of items) {\n const [n, cls] = slot(item.index)\n if (out.has(n)) continue\n out.set(\n n,\n h(\n 'pattern',\n {\n key: n,\n id: `${id}-pattern-${n}`,\n class: ['tc-pattern', 'tc-series', cls],\n width: 8,\n height: 8,\n patternUnits: 'userSpaceOnUse',\n // A map, so a color from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n },\n h('rect', { class: 'tc-pattern-bg', width: 8, height: 8 }),\n h('path', { class: 'tc-pattern-ink', d: TILES[item.index % SLOTS] as string }),\n ),\n )\n }\n return [...out.values()]\n}\n\n/** The `--tc-pattern-{n}` references for the chart root. */\nexport function patternVars(items: readonly LegendItem[], id: string): Record<string, string> {\n const vars: Record<string, string> = {}\n for (const item of items) {\n const [n] = slot(item.index)\n vars[`--tc-pattern-${n}`] = `url(#${id}-pattern-${n})`\n }\n return vars\n}\n\n/**\n * The pattern fills of a chart: its root class (`tc-patterned` with\n * `patterns: true`, `tc-patterns-auto` for forced colors), the root's\n * `--tc-pattern-{n}` references and the `<defs>` with the patterns;\n * `undefined` for a chart without legend entries.\n */\nexport function patternFills(\n config: ChartConfig<object>,\n id: string,\n): [string, Record<string, string>, VNode] | undefined {\n const { items } = resolveLegend(config)\n if (!items.length) return undefined\n return [\n config.patterns === true ? 'tc-patterned' : 'tc-patterns-auto',\n patternVars(items, id),\n h('defs', { key: 'patterns' }, patternDefs(items, id)),\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,QAAQ;CAEZ;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;AACF;;AAGA,MAAM,QAAQ,MAAM;;AAGpB,MAAM,QAAQ,UACZ,QAAQ,QAAQ,CAAC,GAAG,QAAQ,KAAK,aAAa,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE;;AAG3E,SAAgB,YAAY,OAA8B,IAAqB;CAC7E,MAAM,sBAAM,IAAI,IAAmB;CACnC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,GAAG,OAAO,KAAK,KAAK,KAAK;EAChC,IAAI,IAAI,IAAI,CAAC,GAAG;EAChB,IAAI,IACF,GACA,EACE,WACA;GACE,KAAK;GACL,IAAI,GAAG,GAAG,WAAW;GACrB,OAAO;IAAC;IAAc;IAAa;GAAG;GACtC,OAAO;GACP,QAAQ;GACR,cAAc;GAEd,OAAO,EAAE,qBAAqB,KAAK,MAAM;EAC3C,GACA,EAAE,QAAQ;GAAE,OAAO;GAAiB,OAAO;GAAG,QAAQ;EAAE,CAAC,GACzD,EAAE,QAAQ;GAAE,OAAO;GAAkB,GAAG,MAAM,KAAK,QAAQ;EAAiB,CAAC,CAC/E,CACF;CACF;CACA,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;;AAGA,SAAgB,YAAY,OAA8B,IAAoC;CAC5F,MAAM,OAA+B,CAAC;CACtC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK;EAC3B,KAAK,gBAAgB,OAAO,QAAQ,GAAG,WAAW,EAAE;CACtD;CACA,OAAO;AACT;;;;;;;AAQA,SAAgB,aACd,QACA,IACqD;CACrD,MAAM,EAAE,UAAU,cAAc,MAAM;CACtC,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAA;CAC1B,OAAO;EACL,OAAO,aAAa,OAAO,iBAAiB;EAC5C,YAAY,OAAO,EAAE;EACrB,EAAE,QAAQ,EAAE,KAAK,WAAW,GAAG,YAAY,OAAO,EAAE,CAAC;CACvD;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
const require_chart = require("./chart-e2VqomCI.cjs");
|
|
2
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
3
|
+
// src/charts/patterns.ts
|
|
4
4
|
/**
|
|
5
5
|
* Pattern fills, so series do not depend on color alone (color vision
|
|
6
6
|
* deficiency, grayscale print, forced colors). Every legend entry gets an
|
|
@@ -79,7 +79,6 @@ function patternFills(config, id) {
|
|
|
79
79
|
require_vnode.h("defs", { key: "patterns" }, patternDefs(items, id))
|
|
80
80
|
];
|
|
81
81
|
}
|
|
82
|
-
//#endregion
|
|
83
82
|
Object.defineProperty(exports, "patternDefs", {
|
|
84
83
|
enumerable: true,
|
|
85
84
|
get: function() {
|
|
@@ -99,4 +98,4 @@ Object.defineProperty(exports, "patternVars", {
|
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
|
|
102
|
-
//# sourceMappingURL=patterns-
|
|
101
|
+
//# sourceMappingURL=patterns-D3-wQagb.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns-
|
|
1
|
+
{"version":3,"file":"patterns-D3-wQagb.cjs","names":["h","resolveLegend"],"sources":["../src/charts/patterns.ts"],"sourcesContent":["/**\n * Pattern fills, so series do not depend on color alone (color vision\n * deficiency, grayscale print, forced colors). Every legend entry gets an\n * 8×8 tile: its series color with lines or dots in `--tc-pattern-color` (the\n * surface by default) over it, one shape per color slot. The chart root\n * carries `--tc-pattern-{n}: url(#…)` and the slot classes map it to\n * `--tc-series-pattern`, which the stylesheet uses as the fill of bars,\n * areas, slices, rings and bubbles (lines get dashes instead) when\n * `patterns` is `true`, or with `'auto'` (the default) in forced colors.\n */\nimport { type ChartConfig, resolveLegend } from '../chart.ts'\nimport type { LegendItem } from '../legend.ts'\nimport { h, type VNode } from '../vnode.ts'\n\n/** Tile shapes by color slot: lines as strokes, dots as round-capped stubs. */\nconst TILES = [\n // Diagonal /, with the corners filled in so tiles join up.\n 'M-2,2L2,-2M0,8L8,0M6,10L10,6',\n // Dots.\n 'M2,2h.01M6,6h.01',\n // Diagonal \.\n 'M-2,6L2,10M0,0L8,8M6,-2L10,2',\n // Horizontal.\n 'M0,4H8',\n // Cross-hatch.\n 'M0,8L8,0M0,0L8,8',\n // Vertical.\n 'M4,0V8',\n // Grid.\n 'M0,4H8M4,0V8',\n // Dashes.\n 'M1,2H4M5,6H8',\n]\n\n/** Slots with a pattern of their own; series 9+ share the one of the \"other\" color. */\nconst SLOTS = TILES.length\n\n/** The pattern of a slot (0-based): its id suffix and slot class. */\nconst slot = (index: number): [string, string] =>\n index < SLOTS ? [`${index + 1}`, `tc-series-${index + 1}`] : ['other', '']\n\n/** `<pattern>` elements for the legend entries of a chart. */\nexport function patternDefs(items: readonly LegendItem[], id: string): VNode[] {\n const out = new Map<string, VNode>()\n for (const item of items) {\n const [n, cls] = slot(item.index)\n if (out.has(n)) continue\n out.set(\n n,\n h(\n 'pattern',\n {\n key: n,\n id: `${id}-pattern-${n}`,\n class: ['tc-pattern', 'tc-series', cls],\n width: 8,\n height: 8,\n patternUnits: 'userSpaceOnUse',\n // A map, so a color from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n },\n h('rect', { class: 'tc-pattern-bg', width: 8, height: 8 }),\n h('path', { class: 'tc-pattern-ink', d: TILES[item.index % SLOTS] as string }),\n ),\n )\n }\n return [...out.values()]\n}\n\n/** The `--tc-pattern-{n}` references for the chart root. */\nexport function patternVars(items: readonly LegendItem[], id: string): Record<string, string> {\n const vars: Record<string, string> = {}\n for (const item of items) {\n const [n] = slot(item.index)\n vars[`--tc-pattern-${n}`] = `url(#${id}-pattern-${n})`\n }\n return vars\n}\n\n/**\n * The pattern fills of a chart: its root class (`tc-patterned` with\n * `patterns: true`, `tc-patterns-auto` for forced colors), the root's\n * `--tc-pattern-{n}` references and the `<defs>` with the patterns;\n * `undefined` for a chart without legend entries.\n */\nexport function patternFills(\n config: ChartConfig<object>,\n id: string,\n): [string, Record<string, string>, VNode] | undefined {\n const { items } = resolveLegend(config)\n if (!items.length) return undefined\n return [\n config.patterns === true ? 'tc-patterned' : 'tc-patterns-auto',\n patternVars(items, id),\n h('defs', { key: 'patterns' }, patternDefs(items, id)),\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,QAAQ;CAEZ;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;AACF;;AAGA,MAAM,QAAQ,MAAM;;AAGpB,MAAM,QAAQ,UACZ,QAAQ,QA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|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
//#region src/patterns.ts
|
|
2
|
+
const require_patterns = require("./patterns-D3-wQagb.cjs");
|
|
3
|
+
// src/patterns.ts
|
|
5
4
|
/**
|
|
6
5
|
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
7
6
|
* (`patterns: true`, and in forced colors by default) on the core.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
8
|
+
require("./features-DCXEvoya.cjs").register({ patterns: require_patterns.patternFills });
|
|
11
9
|
exports.patternDefs = require_patterns.patternDefs;
|
|
12
10
|
exports.patternFills = require_patterns.patternFills;
|
|
13
11
|
exports.patternVars = require_patterns.patternVars;
|
package/dist/patterns.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.cjs","names":["register","patternFills"],"sources":["../src/patterns.ts"],"sourcesContent":["/**\n * Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills\n * (`patterns: true`, and in forced colors by default) on the core.\n */\nimport { patternDefs, patternFills, patternVars } from './charts/patterns.ts'\nimport { register } from './features.ts'\n\nregister({ patterns: patternFills })\n\nexport { patternDefs, patternFills, patternVars }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"patterns.cjs","names":["register","patternFills"],"sources":["../src/patterns.ts"],"sourcesContent":["/**\n * Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills\n * (`patterns: true`, and in forced colors by default) on the core.\n */\nimport { patternDefs, patternFills, patternVars } from './charts/patterns.ts'\nimport { register } from './features.ts'\n\nregister({ patterns: patternFills })\n\nexport { patternDefs, patternFills, patternVars }\n"],"mappings":";;;;;;;A,iCAOAA,CAAAA,CAAAA,SAAS,EAAE,UAAUC,iBAAAA,aAAa,CAAC"}
|
package/dist/patterns.d.cts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
3
|
+
* (`patterns: true`, and in forced colors by default) on the core.
|
|
4
|
+
*/
|
|
5
|
+
import { X as patternFills, Y as patternDefs, Z as patternVars } from "./chart-kqFMEwDo.cjs";
|
|
2
6
|
export { patternDefs, patternFills, patternVars };
|
package/dist/patterns.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
3
|
+
* (`patterns: true`, and in forced colors by default) on the core.
|
|
4
|
+
*/
|
|
5
|
+
import { G as patternDefs, K as patternFills, q as patternVars } from "./chart-QilhWP8Z.js";
|
|
2
6
|
export { patternDefs, patternFills, patternVars };
|
package/dist/patterns.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as patternFills, r as patternVars, t as patternDefs } from "./patterns-CufKZYhm.js";
|
|
2
|
+
import { i as register } from "./features-BMxkqCyS.js";
|
|
3
|
+
// src/patterns.ts
|
|
4
4
|
/**
|
|
5
5
|
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
6
6
|
* (`patterns: true`, and in forced colors by default) on the core.
|
|
7
7
|
*/
|
|
8
8
|
register({ patterns: patternFills });
|
|
9
|
-
//#endregion
|
|
10
9
|
export { patternDefs, patternFills, patternVars };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=patterns.js.map
|