@diagrammo/dgmo 0.54.0 → 0.56.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/dist/advanced.d.ts +138 -11
- package/dist/advanced.js +140 -115
- package/dist/{analyzer-TDN5KJFP.js → analyzer-HQUXKZ5J.js} +3 -3
- package/dist/auto.js +129 -126
- package/dist/auto.mjs +2731 -882
- package/dist/block.js +58 -56
- package/dist/{calculator-VBIT6GQF.js → calculator-BBKAAQGD.js} +3 -3
- package/dist/chart-meta.js +49 -49
- package/dist/charts-d3-D67V6KHE.js +29 -0
- package/dist/{chunk-5VXU6MND.js → chunk-23THM67F.js} +2 -2
- package/dist/{chunk-N7BSBAVP.js → chunk-2JMNOEAU.js} +117 -98
- package/dist/{chunk-6OYDOQ2Q.js → chunk-2UZVMWSQ.js} +4 -4
- package/dist/{chunk-3FRO35WW.js → chunk-3KOPPSUQ.js} +19 -5
- package/dist/{chunk-IYNKLCAZ.js → chunk-3R67RRPC.js} +126 -57
- package/dist/{chunk-JYDMBWRP.js → chunk-42IT4BG2.js} +2 -2
- package/dist/{chunk-O576GYAP.js → chunk-4MB4UOT5.js} +3 -3
- package/dist/{chunk-3KHJJP3J.js → chunk-4MJOBVY7.js} +3 -3
- package/dist/{chunk-3SEEP2JM.js → chunk-5J2RQGFG.js} +9 -5
- package/dist/{chunk-EAI6XJ7D.js → chunk-5VLUAAAE.js} +4 -4
- package/dist/{chunk-FVMKCZHF.js → chunk-5XMDSXZT.js} +3 -3
- package/dist/{chunk-LPJ6H5X4.js → chunk-5ZDHXS5N.js} +60 -15
- package/dist/{chunk-MEQYZZFR.js → chunk-6IVXRTXH.js} +96 -23
- package/dist/chunk-6VJCURWU.js +87 -0
- package/dist/{chunk-QZAW5SFH.js → chunk-7NK42OIB.js} +2 -2
- package/dist/{chunk-EQOMY4PY.js → chunk-7SXTD7L6.js} +3 -3
- package/dist/{chunk-APKUAJ2L.js → chunk-A2RUBBVT.js} +14 -1
- package/dist/{chunk-S7FOIURR.js → chunk-A4DAZO3U.js} +12 -9
- package/dist/{chunk-AJFHNS67.js → chunk-AIH6M5J6.js} +7 -7
- package/dist/{chunk-KS5ZSM5T.js → chunk-AMC2OGXF.js} +64 -16
- package/dist/{chunk-SSHS42QG.js → chunk-AN465MXC.js} +2 -2
- package/dist/{chunk-BZJIITYM.js → chunk-AOJJSGXE.js} +5 -5
- package/dist/{chunk-T7Y554OK.js → chunk-APD52YJV.js} +8 -8
- package/dist/{chunk-FFVFZLRT.js → chunk-BR2VSKHI.js} +377 -60
- package/dist/{chunk-7K6NDSXH.js → chunk-C3BWDEYN.js} +5 -5
- package/dist/{chunk-HO3RCNF6.js → chunk-CGLBK5Q4.js} +2 -2
- package/dist/{chunk-ADYKAKE3.js → chunk-CQ7Y3O67.js} +7 -4
- package/dist/{chunk-WKNAJ4BR.js → chunk-CQOC2MD6.js} +66 -13
- package/dist/{chunk-TLNVYWPA.js → chunk-CXI6X54X.js} +3 -3
- package/dist/{chunk-AQEYUVGJ.js → chunk-CY5KE2P5.js} +67 -10
- package/dist/{chunk-COVYNAKJ.js → chunk-D3WTEBGT.js} +2 -2
- package/dist/{chunk-AHTTKERF.js → chunk-D5FANMSG.js} +3 -3
- package/dist/{chunk-CCGWX6AO.js → chunk-D64FRGKU.js} +3 -3
- package/dist/{chunk-RRGKMJYL.js → chunk-DIKIHU52.js} +9 -4
- package/dist/{chunk-BULHGPHK.js → chunk-DNSEG6P2.js} +3 -3
- package/dist/{chunk-UJRTPOHH.js → chunk-DUI5SMFX.js} +2 -2
- package/dist/{chunk-VQFDBNYF.js → chunk-EEKGMS63.js} +4 -4
- package/dist/{chunk-MTZOXISJ.js → chunk-ES3MUYRX.js} +5 -5
- package/dist/{chunk-J7HQPVYH.js → chunk-ES66QH6J.js} +24 -3
- package/dist/{chunk-ZKPPI6BF.js → chunk-EXNKNJ65.js} +2 -2
- package/dist/{chunk-2NYXI35Z.js → chunk-FCA2UGJT.js} +7 -6
- package/dist/{chunk-M3H7ZE6C.js → chunk-FERE46TP.js} +7 -6
- package/dist/{chunk-B4XS2AF2.js → chunk-FWVKPEG3.js} +3 -3
- package/dist/{chunk-S7YFT3PO.js → chunk-FXVPSTDT.js} +6 -6
- package/dist/{chunk-BM7MG6HT.js → chunk-FZECLCCU.js} +4 -4
- package/dist/{chunk-SBOAZ7YK.js → chunk-GDGOVO2I.js} +60 -41
- package/dist/{chunk-QBYP2FBZ.js → chunk-GG7TK3IA.js} +5 -5
- package/dist/{chunk-GQ5ECRP4.js → chunk-GUVVQW3Y.js} +5 -5
- package/dist/{chunk-R5BGGBFF.js → chunk-HE57UQHL.js} +3 -3
- package/dist/{chunk-4ZIKWVSQ.js → chunk-HIMDUQT7.js} +7 -7
- package/dist/{chunk-CSHFU6LT.js → chunk-HKKPUUNK.js} +10 -10
- package/dist/{chunk-KINOX74I.js → chunk-HODUM6LY.js} +50 -12
- package/dist/{chunk-47JNEKJA.js → chunk-HOPTF3ZP.js} +47 -12
- package/dist/{chunk-WW4BQ744.js → chunk-HPJITTF7.js} +11 -8
- package/dist/{chunk-BEOAKGNA.js → chunk-I55PVEIX.js} +2 -2
- package/dist/{chunk-7JDTNFAK.js → chunk-IMXG673Y.js} +78 -34
- package/dist/{chunk-4T6OCSJ2.js → chunk-JE3SMHRZ.js} +6 -6
- package/dist/{chunk-KQYQECWQ.js → chunk-JXFB3APA.js} +52 -16
- package/dist/{chunk-OJ435DQZ.js → chunk-KF575IXC.js} +4 -4
- package/dist/{chunk-IOIMQHQ6.js → chunk-KIGV66SP.js} +3 -3
- package/dist/{chunk-ICKXIMBA.js → chunk-KSPCR75O.js} +7 -7
- package/dist/{chunk-JTSMEYIZ.js → chunk-L43KTQTW.js} +5 -2
- package/dist/{chunk-DLU643TF.js → chunk-LV5BFA24.js} +6 -6
- package/dist/{chunk-RJ5LBZ5U.js → chunk-MD2KWAXJ.js} +16 -16
- package/dist/{chunk-KDK5EKUR.js → chunk-MGLJA5TK.js} +3 -3
- package/dist/{chunk-FR6UFVSV.js → chunk-N2KO445N.js} +99 -46
- package/dist/{chunk-C2UORMIA.js → chunk-NFAHDPCG.js} +8 -4
- package/dist/{chunk-7UPFTBOW.js → chunk-NHZAYL2X.js} +7 -7
- package/dist/{chunk-PIXZTCKH.js → chunk-NVQXIDLE.js} +3 -3
- package/dist/chunk-NZ5QVASG.js +20 -0
- package/dist/{chunk-F7XM366V.js → chunk-OHBIN74X.js} +4 -4
- package/dist/{chunk-4W2PE66Q.js → chunk-OLMWTJVU.js} +11 -1
- package/dist/{chunk-HAA25PLC.js → chunk-OWLGERJL.js} +46 -11
- package/dist/{chunk-NUTWTV6G.js → chunk-P6XFQVYY.js} +103 -57
- package/dist/{chunk-GKYHWJXI.js → chunk-PECYPUJJ.js} +5 -5
- package/dist/{chunk-T3FAJAJT.js → chunk-PFG3EVRD.js} +4 -4
- package/dist/{chunk-2NZOHEP4.js → chunk-QDOYT6UW.js} +5 -5
- package/dist/{chunk-EPRF3ZRV.js → chunk-QWUYFUNO.js} +3 -3
- package/dist/{chunk-I47VHSPS.js → chunk-R7ECJQTB.js} +10 -8
- package/dist/{chunk-BWYFIVZF.js → chunk-RBIX3HQQ.js} +4 -4
- package/dist/{chunk-COJW2NEY.js → chunk-RK3Y4WMV.js} +57 -15
- package/dist/{chunk-KQ3FNRGR.js → chunk-RQGNELB3.js} +7 -6
- package/dist/{chunk-WF64MW5G.js → chunk-RRX4Z4TH.js} +2 -2
- package/dist/{chunk-W6PCFRPL.js → chunk-RV2N7COG.js} +4 -4
- package/dist/{chunk-UEU6IYKY.js → chunk-S6QDCFEU.js} +2 -2
- package/dist/{chunk-Q5IHQ4NW.js → chunk-SCJ7CAJF.js} +2 -2
- package/dist/{chunk-3B2GXZCX.js → chunk-SK7PCW4F.js} +2 -2
- package/dist/{chunk-6KL7TFLS.js → chunk-SOBGK35Z.js} +4 -4
- package/dist/{chunk-WWHECSYZ.js → chunk-ST3ZNEUQ.js} +3 -3
- package/dist/{chunk-3IUHKMJI.js → chunk-U2BKSEKU.js} +2 -2
- package/dist/{chunk-KBVOVDYP.js → chunk-U7ZQTUZT.js} +6 -6
- package/dist/{chunk-3SBHODJ4.js → chunk-ULONXAOD.js} +50 -11
- package/dist/{chunk-B7N5KYXQ.js → chunk-ULR3BVNH.js} +8 -8
- package/dist/{chunk-YENNFS5F.js → chunk-USFZQPJ2.js} +10 -5
- package/dist/{chunk-OR3R27CU.js → chunk-UZ6L5VQJ.js} +4 -4
- package/dist/{chunk-ADCHLNWT.js → chunk-VKN7YW4Q.js} +10 -7
- package/dist/{chunk-XWODFBHJ.js → chunk-VSFAJUEF.js} +8 -4
- package/dist/{chunk-HFEOOQ46.js → chunk-VU3DOZ6C.js} +3 -3
- package/dist/{chunk-M24VXUFG.js → chunk-VYEQPPS6.js} +7 -7
- package/dist/{chunk-5XSNLXU5.js → chunk-W2I2EXSC.js} +58 -16
- package/dist/{chunk-7U4OR7CD.js → chunk-W4EKQ2P6.js} +2 -2
- package/dist/{chunk-UIT7E6UF.js → chunk-WFX6AUQO.js} +52 -5
- package/dist/{chunk-RIEAN4D5.js → chunk-WK3UFCZC.js} +51 -11
- package/dist/{chunk-7SP4C6EV.js → chunk-WOMXS5R7.js} +24 -5
- package/dist/chunk-WTTIODDV.js +10 -0
- package/dist/{chunk-GK32ZFZY.js → chunk-X32RDWT5.js} +5 -5
- package/dist/{chunk-LRSW4JLE.js → chunk-XN4ZSACM.js} +4 -4
- package/dist/{chunk-NR5HCAUD.js → chunk-XSVWUOUZ.js} +1 -1
- package/dist/{chunk-OSXQKC3S.js → chunk-Y2L2LET6.js} +8 -5
- package/dist/{chunk-TJN2OIVG.js → chunk-YG5KQ55U.js} +182 -14
- package/dist/{chunk-DPGQ5UMO.js → chunk-YH62K5D4.js} +15 -12
- package/dist/{chunk-A3BDLDYG.js → chunk-YJUF2N3C.js} +62 -23
- package/dist/{chunk-VMSBMIHW.js → chunk-YM2ZQIVG.js} +4 -4
- package/dist/{chunk-KV4HLIJE.js → chunk-YNAHUNMA.js} +7 -4
- package/dist/{chunk-62Y27T4C.js → chunk-YWPWRR7W.js} +2 -2
- package/dist/{chunk-U4IN6AHE.js → chunk-ZMMYCERO.js} +2 -2
- package/dist/cli.cjs +155 -149
- package/dist/clock.js +34 -1
- package/dist/completion-registry.js +15 -7
- package/dist/dgmo-router-GSWUPLP2.js +88 -0
- package/dist/dimensions-PLECMFTR.js +22 -0
- package/dist/editor.js +10 -1
- package/dist/element.js +131 -128
- package/dist/element.mjs +2731 -882
- package/dist/flowchart-parser-DA3V2SLH.js +21 -0
- package/dist/{flowchart-renderer-DCFKUDDR.js → flowchart-renderer-UQVXOUW4.js} +13 -12
- package/dist/highlight.js +10 -1
- package/dist/index.js +72 -57
- package/dist/{layout-A6OIGZN2.js → layout-2BJDECLZ.js} +5 -8
- package/dist/{layout-NF4EWFLT.js → layout-3XFPPFXI.js} +4 -4
- package/dist/layout-A5UVXINF.js +15 -0
- package/dist/layout-HIK4ZJFQ.js +15 -0
- package/dist/{layout-CB3XWCOI.js → layout-NX37NSRY.js} +3 -3
- package/dist/layout-OHAIIXBC.js +10 -0
- package/dist/{layout-QBNAMEOA.js → layout-QRVYYYZ3.js} +6 -6
- package/dist/{layout-ITLPDG6M.js → layout-SNIEAZ2I.js} +8 -8
- package/dist/{layout-SP7HJWKA.js → layout-UFZQI6SX.js} +4 -4
- package/dist/{layout-G2ABQJQZ.js → layout-UXMNKETK.js} +7 -7
- package/dist/layout-WDXNSQQF.js +15 -0
- package/dist/{layout-search-LUI475P3.js → layout-search-I4VNIRGT.js} +320 -36
- package/dist/{legend-constants-B77VKB3R.js → legend-constants-QQU3QYBF.js} +5 -5
- package/dist/{palettes-FGTNFARW.js → palettes-WO3VA6NU.js} +4 -4
- package/dist/parser-4TX6U4ZU.js +11 -0
- package/dist/{parser-X5XLFY4Z.js → parser-4ZIJDGPG.js} +6 -6
- package/dist/parser-5UZWYSIV.js +16 -0
- package/dist/parser-6CM27UPA.js +14 -0
- package/dist/parser-73YUU35J.js +11 -0
- package/dist/parser-A6M25MLK.js +11 -0
- package/dist/parser-AYZTKZC3.js +11 -0
- package/dist/parser-CCAUZLYI.js +15 -0
- package/dist/parser-D7YZX3CH.js +12 -0
- package/dist/parser-DQ2DGDYO.js +11 -0
- package/dist/parser-GGCDY65M.js +14 -0
- package/dist/parser-HMQZPPOK.js +19 -0
- package/dist/parser-IPBEW2DG.js +13 -0
- package/dist/{parser-66RYGJRB.js → parser-JWAGGYLL.js} +7 -7
- package/dist/parser-KTVDCWHG.js +13 -0
- package/dist/{parser-OPIXXUY4.js → parser-LNEAHGXF.js} +7 -7
- package/dist/parser-LQDEU22S.js +15 -0
- package/dist/{parser-VVE4THG3.js → parser-MH62NYKM.js} +6 -6
- package/dist/parser-O5XCVGZG.js +11 -0
- package/dist/parser-OPOGIKFR.js +17 -0
- package/dist/parser-PEBXIOPX.js +12 -0
- package/dist/parser-PQXN6SBB.js +18 -0
- package/dist/parser-Q3KNFXQR.js +12 -0
- package/dist/parser-Q62VR2UJ.js +20 -0
- package/dist/parser-QEWSTNEJ.js +15 -0
- package/dist/{parser-7UI6UQ7B.js → parser-QL2LBPFE.js} +7 -7
- package/dist/{parser-LTA2BOZO.js → parser-QN3GJJ3J.js} +5 -5
- package/dist/parser-RBNOWHGM.js +15 -0
- package/dist/parser-SJ7ECFAP.js +13 -0
- package/dist/parser-VVTCMQWY.js +16 -0
- package/dist/parser-WT3DSNPQ.js +13 -0
- package/dist/parser-XWNSCDY6.js +13 -0
- package/dist/pert.d.ts +2 -0
- package/dist/{renderer-WVD6G2TS.js → renderer-2NU7M5PN.js} +14 -12
- package/dist/renderer-3IETIUZB.js +30 -0
- package/dist/renderer-4VLQKKTV.js +39 -0
- package/dist/{renderer-HQ4JFZOV.js → renderer-52S6JM5R.js} +12 -11
- package/dist/renderer-53FU55KK.js +19 -0
- package/dist/renderer-5CU6GYF2.js +27 -0
- package/dist/{renderer-LHVCKEWF.js → renderer-5G3PORFD.js} +13 -12
- package/dist/renderer-CB2DOQ2O.js +25 -0
- package/dist/{renderer-B7Y6I7JX.js → renderer-CL4SAUA5.js} +8 -8
- package/dist/{renderer-FXMGCSRP.js → renderer-CRAIC4ER.js} +12 -10
- package/dist/renderer-DZ5N6BHW.js +26 -0
- package/dist/renderer-FRBPMKPP.js +25 -0
- package/dist/renderer-HGWKAXS6.js +16 -0
- package/dist/renderer-I5MAFUKX.js +26 -0
- package/dist/{renderer-K7XLVPH5.js → renderer-IWNHBIZ6.js} +5 -5
- package/dist/renderer-J5MMVCGN.js +29 -0
- package/dist/renderer-J5TL5ZX4.js +39 -0
- package/dist/renderer-JNC6VJMN.js +24 -0
- package/dist/{renderer-X2LYSMLU.js → renderer-KUIZNLAQ.js} +6 -6
- package/dist/renderer-M6AFKVLS.js +21 -0
- package/dist/renderer-MLDGFZDW.js +23 -0
- package/dist/{renderer-YVMETH6V.js → renderer-O4ECS2BI.js} +13 -12
- package/dist/{renderer-YEFOOULC.js → renderer-OZIPP7VF.js} +14 -13
- package/dist/{renderer-C3RI4OPJ.js → renderer-P7O6OUYC.js} +13 -12
- package/dist/renderer-Q3A7572V.js +25 -0
- package/dist/renderer-QRX7Q2YN.js +22 -0
- package/dist/{renderer-WCWI4I6A.js → renderer-RJT3MOUU.js} +5 -5
- package/dist/{renderer-7HMZ5OCJ.js → renderer-SYT4L7GE.js} +6 -6
- package/dist/{renderer-G4UOW3RH.js → renderer-TOKGYFTG.js} +6 -6
- package/dist/renderer-WWC5VGHH.js +27 -0
- package/dist/{renderer-P3YQES7B.js → renderer-YVCD55ZX.js} +15 -13
- package/dist/renderer-YWYX6WAI.js +16 -0
- package/dist/renderer-radial-QG644QYY.js +21 -0
- package/dist/{resolver-WFKZYBJ2.js → resolver-W3WKLWDP.js} +4 -4
- package/dist/state-parser-NQGVYSM3.js +19 -0
- package/dist/state-renderer-NKV5B3KH.js +40 -0
- package/docs/language-reference.md +11 -2
- package/package.json +2 -2
- package/dist/charts-d3-25E4VWXO.js +0 -27
- package/dist/dgmo-router-TGZWFIZO.js +0 -88
- package/dist/dimensions-L6BXQXXL.js +0 -22
- package/dist/flowchart-parser-UKYOW3VM.js +0 -21
- package/dist/layout-25Y3VDYF.js +0 -19
- package/dist/layout-4SPLI4HG.js +0 -15
- package/dist/layout-CH4HFFRD.js +0 -15
- package/dist/layout-NY7MHJCL.js +0 -15
- package/dist/parser-2UWWNTFL.js +0 -12
- package/dist/parser-3RXYQSA7.js +0 -18
- package/dist/parser-5C3PEZK3.js +0 -11
- package/dist/parser-6GN5YJBJ.js +0 -13
- package/dist/parser-6MQM7WT3.js +0 -15
- package/dist/parser-B2A7XOAK.js +0 -12
- package/dist/parser-CCNJKDDA.js +0 -16
- package/dist/parser-ESHNUFME.js +0 -13
- package/dist/parser-F4FEU57T.js +0 -11
- package/dist/parser-FHRMFUNX.js +0 -15
- package/dist/parser-FPCWDYQV.js +0 -13
- package/dist/parser-FY3YFFBS.js +0 -20
- package/dist/parser-GML6V2KZ.js +0 -14
- package/dist/parser-HA3PF5FL.js +0 -15
- package/dist/parser-KTYF6WO5.js +0 -11
- package/dist/parser-LU7UAKNB.js +0 -13
- package/dist/parser-MHKYQPC2.js +0 -11
- package/dist/parser-MVSYFK63.js +0 -17
- package/dist/parser-O7YQYFEN.js +0 -15
- package/dist/parser-S4EJPNVN.js +0 -19
- package/dist/parser-T3D7BV6O.js +0 -11
- package/dist/parser-WPPJGB4R.js +0 -12
- package/dist/parser-XCPMEB2Z.js +0 -11
- package/dist/parser-XRDUX2AR.js +0 -14
- package/dist/parser-YPWYT46P.js +0 -16
- package/dist/parser-YULS5MLD.js +0 -13
- package/dist/renderer-2DME63VZ.js +0 -16
- package/dist/renderer-3VY3VXJE.js +0 -37
- package/dist/renderer-4A32DX5L.js +0 -24
- package/dist/renderer-4K5YYX5R.js +0 -28
- package/dist/renderer-6CFML5G3.js +0 -22
- package/dist/renderer-7ZNVOVFG.js +0 -16
- package/dist/renderer-CJ56SUMF.js +0 -26
- package/dist/renderer-COJZZ4F6.js +0 -25
- package/dist/renderer-OZX5KGQM.js +0 -21
- package/dist/renderer-PLVIARM7.js +0 -24
- package/dist/renderer-RA4PTAMF.js +0 -19
- package/dist/renderer-RMAM2SOJ.js +0 -28
- package/dist/renderer-SES7QZYL.js +0 -37
- package/dist/renderer-TQ5QDZOE.js +0 -22
- package/dist/renderer-V5SNTPAM.js +0 -27
- package/dist/renderer-Y3NXZINM.js +0 -24
- package/dist/renderer-YP3P6UVT.js +0 -24
- package/dist/renderer-Z4GNKNXO.js +0 -24
- package/dist/renderer-radial-VYBZAXXE.js +0 -21
- package/dist/state-parser-VIW2WNA5.js +0 -19
- package/dist/state-renderer-H22AQD3U.js +0 -38
|
@@ -11,10 +11,19 @@ import {
|
|
|
11
11
|
initD3Chart,
|
|
12
12
|
renderChartTitle,
|
|
13
13
|
resolveExportPalette
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CQ7Y3O67.js";
|
|
15
|
+
import {
|
|
16
|
+
layoutInlineHeader
|
|
17
|
+
} from "./chunk-6VJCURWU.js";
|
|
15
18
|
import {
|
|
16
19
|
computeLegendLayout
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ES66QH6J.js";
|
|
21
|
+
import {
|
|
22
|
+
TITLE_FONT_SIZE,
|
|
23
|
+
TITLE_FONT_WEIGHT,
|
|
24
|
+
TITLE_OFFSET,
|
|
25
|
+
TITLE_Y
|
|
26
|
+
} from "./chunk-A4GOY3PE.js";
|
|
18
27
|
import {
|
|
19
28
|
FONT_FAMILY
|
|
20
29
|
} from "./chunk-6KFWC4CO.js";
|
|
@@ -23,7 +32,7 @@ import {
|
|
|
23
32
|
getSimpleChartLegendGroups,
|
|
24
33
|
parseChart,
|
|
25
34
|
parseExtendedChart
|
|
26
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CY5KE2P5.js";
|
|
27
36
|
import {
|
|
28
37
|
EMPHASIS_DIM_OPACITY,
|
|
29
38
|
EMPHASIS_DIM_TEXT_OPACITY,
|
|
@@ -35,7 +44,7 @@ import {
|
|
|
35
44
|
LEGEND_HEIGHT,
|
|
36
45
|
LEGEND_PILL_FONT_SIZE,
|
|
37
46
|
legendChromeColors
|
|
38
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-SCJ7CAJF.js";
|
|
39
48
|
import {
|
|
40
49
|
measureText
|
|
41
50
|
} from "./chunk-4ASYQ347.js";
|
|
@@ -48,10 +57,10 @@ import {
|
|
|
48
57
|
mix,
|
|
49
58
|
shapeFill,
|
|
50
59
|
themeBaseBg
|
|
51
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-42IT4BG2.js";
|
|
52
61
|
import {
|
|
53
62
|
tagAttrKey
|
|
54
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-D5FANMSG.js";
|
|
55
64
|
|
|
56
65
|
// src/utils/legend-svg.ts
|
|
57
66
|
function esc(s) {
|
|
@@ -88,7 +97,10 @@ function renderLegendSvg(groups, options) {
|
|
|
88
97
|
const wrapWidth = containerWidth > 0 ? containerWidth : 1200;
|
|
89
98
|
const config = {
|
|
90
99
|
groups,
|
|
91
|
-
position: {
|
|
100
|
+
position: {
|
|
101
|
+
placement: "top-center",
|
|
102
|
+
titleRelation: options.align === "left" ? "inline-with-title" : "below-title"
|
|
103
|
+
},
|
|
92
104
|
mode: "preview"
|
|
93
105
|
};
|
|
94
106
|
const state = { activeGroup: activeGroup ?? null };
|
|
@@ -147,7 +159,47 @@ function fmtNum(n) {
|
|
|
147
159
|
if (Math.abs(n) >= 1e3) return n.toLocaleString("en-US");
|
|
148
160
|
return String(Math.round(n * 100) / 100);
|
|
149
161
|
}
|
|
150
|
-
function
|
|
162
|
+
function renderInlineHeader(svg, groups, palette, isDark, width, info) {
|
|
163
|
+
const {
|
|
164
|
+
svg: legendSvg,
|
|
165
|
+
height: legendH,
|
|
166
|
+
width: legendW
|
|
167
|
+
} = renderLegendSvg(groups, {
|
|
168
|
+
palette,
|
|
169
|
+
isDark,
|
|
170
|
+
containerWidth: width,
|
|
171
|
+
activeGroup: groups[0].name,
|
|
172
|
+
className: "chart-legend",
|
|
173
|
+
align: "left"
|
|
174
|
+
});
|
|
175
|
+
if (!legendSvg) return null;
|
|
176
|
+
const geom = layoutInlineHeader({
|
|
177
|
+
requested: true,
|
|
178
|
+
title: info.title,
|
|
179
|
+
hasLegend: true,
|
|
180
|
+
legendWidth: legendW,
|
|
181
|
+
legendHeight: legendH,
|
|
182
|
+
containerWidth: width,
|
|
183
|
+
titleBandHeight: TITLE_OFFSET,
|
|
184
|
+
legendReserve: 0,
|
|
185
|
+
titleBaselineY: TITLE_Y,
|
|
186
|
+
titleFontSize: TITLE_FONT_SIZE
|
|
187
|
+
});
|
|
188
|
+
if (!geom.inline) return null;
|
|
189
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", geom.titleX).attr("y", TITLE_Y).attr("fill", info.textColor).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).text(info.title);
|
|
190
|
+
if (info.titleLineNumber) {
|
|
191
|
+
titleEl.attr("data-line-number", info.titleLineNumber);
|
|
192
|
+
}
|
|
193
|
+
const node = svg.node();
|
|
194
|
+
if (node) {
|
|
195
|
+
node.insertAdjacentHTML(
|
|
196
|
+
"beforeend",
|
|
197
|
+
`<g transform="translate(${geom.legendX},${geom.legendY})">${legendSvg}</g>`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
return TITLE_OFFSET + 12;
|
|
201
|
+
}
|
|
202
|
+
function reserveHeader(svg, chart, colors, palette, isDark, hasTitle, width, inlineTitle) {
|
|
151
203
|
return injectLegendGroups(
|
|
152
204
|
svg,
|
|
153
205
|
// `no-legend` (#48) → pass no groups; injectLegendGroups then returns the
|
|
@@ -156,10 +208,31 @@ function reserveHeader(svg, chart, colors, palette, isDark, hasTitle, width) {
|
|
|
156
208
|
palette,
|
|
157
209
|
isDark,
|
|
158
210
|
hasTitle,
|
|
159
|
-
width
|
|
211
|
+
width,
|
|
212
|
+
inlineTitle
|
|
160
213
|
);
|
|
161
214
|
}
|
|
162
|
-
function injectLegendGroups(svg, groups, palette, isDark, hasTitle, width) {
|
|
215
|
+
function injectLegendGroups(svg, groups, palette, isDark, hasTitle, width, inlineTitle) {
|
|
216
|
+
if (inlineTitle && groups.length > 0) {
|
|
217
|
+
const inset = renderInlineHeader(
|
|
218
|
+
svg,
|
|
219
|
+
groups,
|
|
220
|
+
palette,
|
|
221
|
+
isDark,
|
|
222
|
+
width,
|
|
223
|
+
inlineTitle
|
|
224
|
+
);
|
|
225
|
+
if (inset !== null) return inset;
|
|
226
|
+
}
|
|
227
|
+
if (inlineTitle) {
|
|
228
|
+
renderChartTitle(
|
|
229
|
+
svg,
|
|
230
|
+
inlineTitle.title,
|
|
231
|
+
inlineTitle.titleLineNumber,
|
|
232
|
+
width,
|
|
233
|
+
inlineTitle.textColor
|
|
234
|
+
);
|
|
235
|
+
}
|
|
163
236
|
const titleH = hasTitle ? 40 : 0;
|
|
164
237
|
if (groups.length === 0) return hasTitle ? titleH + 12 : 24;
|
|
165
238
|
const legendY = 8 + titleH;
|
|
@@ -202,6 +275,7 @@ function tagDatum(sel, o) {
|
|
|
202
275
|
if (o.name != null) sel.attr("data-name", o.name);
|
|
203
276
|
if (o.value != null) sel.attr("data-value", String(o.value));
|
|
204
277
|
if (o.color != null) sel.attr("data-color", o.color);
|
|
278
|
+
if (o.seriesName != null) sel.attr("data-series-name", o.seriesName);
|
|
205
279
|
return sel;
|
|
206
280
|
}
|
|
207
281
|
function drawValueLabel(svg, text, x, y, color, anchor = "middle") {
|
|
@@ -210,13 +284,13 @@ function drawValueLabel(svg, text, x, y, color, anchor = "middle") {
|
|
|
210
284
|
|
|
211
285
|
// src/charts-d3/bar.ts
|
|
212
286
|
import { scaleBand, scaleLinear } from "d3-scale";
|
|
213
|
-
import { max as d3max } from "d3-array";
|
|
287
|
+
import { max as d3max, min as d3min } from "d3-array";
|
|
214
288
|
function seriesValues(pt, seriesCount) {
|
|
215
289
|
const out = [pt.value];
|
|
216
290
|
for (let s = 1; s < seriesCount; s++) out.push(pt.extraValues?.[s - 1] ?? 0);
|
|
217
291
|
return out;
|
|
218
292
|
}
|
|
219
|
-
function renderBar(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, hasTitle) {
|
|
293
|
+
function renderBar(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, hasTitle, inlineTitle) {
|
|
220
294
|
const data = chart.data;
|
|
221
295
|
const seriesNames = chart.seriesNames?.length ? chart.seriesNames : [chart.series ?? ""];
|
|
222
296
|
const stacked = chart.barLayout === "stack";
|
|
@@ -231,7 +305,7 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
231
305
|
const fillMode = chart.fillMode;
|
|
232
306
|
const colorFor = (seriesIdx, catIdx, override) => {
|
|
233
307
|
if (override) return override;
|
|
234
|
-
return multiSeries ? colors[seriesIdx % colors.length] : colors[catIdx % colors.length];
|
|
308
|
+
return multiSeries ? chart.seriesNameColors?.[seriesIdx] ?? colors[seriesIdx % colors.length] : colors[catIdx % colors.length];
|
|
235
309
|
};
|
|
236
310
|
const fillOf = (c) => shapeFill(palette, c, isDark, { mode: fillMode });
|
|
237
311
|
const top = reserveHeader(
|
|
@@ -241,12 +315,22 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
241
315
|
palette,
|
|
242
316
|
isDark,
|
|
243
317
|
hasTitle,
|
|
244
|
-
width
|
|
318
|
+
width,
|
|
319
|
+
inlineTitle
|
|
245
320
|
);
|
|
246
321
|
const perCat = data.map((d) => seriesValues(d, seriesCount));
|
|
247
|
-
const maxVal = stacked ? d3max(
|
|
248
|
-
|
|
249
|
-
|
|
322
|
+
const maxVal = stacked ? d3max(
|
|
323
|
+
perCat,
|
|
324
|
+
(vals) => vals.filter((v) => v > 0).reduce((a, b) => a + b, 0)
|
|
325
|
+
) ?? 0 : d3max(perCat, (vals) => d3max(vals) ?? 0) ?? 0;
|
|
326
|
+
const minVal = stacked ? d3min(
|
|
327
|
+
perCat,
|
|
328
|
+
(vals) => vals.filter((v) => v < 0).reduce((a, b) => a + b, 0)
|
|
329
|
+
) ?? 0 : d3min(perCat, (vals) => d3min(vals) ?? 0) ?? 0;
|
|
330
|
+
const hiVal = Math.max(0, maxVal);
|
|
331
|
+
const loVal = Math.min(0, minVal);
|
|
332
|
+
const niceMax = hiVal === 0 && loVal === 0 ? 1 : hiVal;
|
|
333
|
+
const leftLabels = horizontal ? data.map((d) => d.label) : [fmtNum(niceMax), fmtNum(niceMax / 2), fmtNum(loVal), fmtNum(loVal / 2)];
|
|
250
334
|
const m = {
|
|
251
335
|
top: top + 8,
|
|
252
336
|
right: 32,
|
|
@@ -259,7 +343,7 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
259
343
|
const catRange = horiz ? [m.top, m.top + plotH] : [m.left, m.left + plotW];
|
|
260
344
|
const cat = scaleBand().domain(data.map((d) => d.label)).range(catRange).padding(0.3);
|
|
261
345
|
const valRange = horiz ? [m.left, m.left + plotW] : [m.top + plotH, m.top];
|
|
262
|
-
const val = scaleLinear().domain([
|
|
346
|
+
const val = scaleLinear().domain([loVal, niceMax]).nice().range(valRange);
|
|
263
347
|
for (const t of val.ticks(6)) {
|
|
264
348
|
if (horiz) {
|
|
265
349
|
const x = val(t);
|
|
@@ -284,7 +368,8 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
284
368
|
data.forEach((d, ci) => {
|
|
285
369
|
const base = cat(d.label) ?? 0;
|
|
286
370
|
const vals = seriesValues(d, seriesCount);
|
|
287
|
-
let
|
|
371
|
+
let accPos = 0;
|
|
372
|
+
let accNeg = 0;
|
|
288
373
|
vals.forEach((v, s) => {
|
|
289
374
|
const stroke = colorFor(s, ci, seriesCount === 1 ? d.color : void 0);
|
|
290
375
|
const fill = fillOf(stroke);
|
|
@@ -294,9 +379,11 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
294
379
|
key: multiSeries ? sName : d.label,
|
|
295
380
|
name: multiSeries ? `${d.label} \xB7 ${sName}` : d.label,
|
|
296
381
|
value: v,
|
|
297
|
-
color: stroke
|
|
382
|
+
color: stroke,
|
|
383
|
+
seriesName: multiSeries ? sName : void 0
|
|
298
384
|
};
|
|
299
385
|
if (stacked) {
|
|
386
|
+
const acc = v < 0 ? accNeg : accPos;
|
|
300
387
|
if (horiz) {
|
|
301
388
|
const x0 = val(acc);
|
|
302
389
|
const x1 = val(acc + v);
|
|
@@ -340,7 +427,8 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
340
427
|
textColor
|
|
341
428
|
);
|
|
342
429
|
}
|
|
343
|
-
|
|
430
|
+
if (v < 0) accNeg += v;
|
|
431
|
+
else accPos += v;
|
|
344
432
|
} else {
|
|
345
433
|
const off = inner(s) ?? 0;
|
|
346
434
|
const bw = inner.bandwidth();
|
|
@@ -356,13 +444,16 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
356
444
|
stroke,
|
|
357
445
|
tag
|
|
358
446
|
);
|
|
447
|
+
const txt = fmtNum(v);
|
|
448
|
+
const approxW = txt.length * 7 + 6;
|
|
449
|
+
const inside = v < 0 ? x1 - approxW < m.left : x1 + approxW > m.left + plotW;
|
|
359
450
|
drawValueLabel(
|
|
360
451
|
svg,
|
|
361
|
-
|
|
362
|
-
x1 + 6,
|
|
452
|
+
txt,
|
|
453
|
+
v < 0 ? inside ? x1 + 6 : x1 - 6 : inside ? x1 - 6 : x1 + 6,
|
|
363
454
|
base + off + bw / 2 + 4,
|
|
364
455
|
textColor,
|
|
365
|
-
"start"
|
|
456
|
+
v < 0 !== inside ? "end" : "start"
|
|
366
457
|
);
|
|
367
458
|
} else {
|
|
368
459
|
const y1 = val(v);
|
|
@@ -376,11 +467,13 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
376
467
|
stroke,
|
|
377
468
|
tag
|
|
378
469
|
);
|
|
470
|
+
const yOut = v < 0 ? y1 + 14 : y1 - 6;
|
|
471
|
+
const yInside = v < 0 ? yOut > m.top + plotH - 2 : yOut < m.top + 2;
|
|
379
472
|
drawValueLabel(
|
|
380
473
|
svg,
|
|
381
474
|
fmtNum(v),
|
|
382
475
|
base + off + bw / 2,
|
|
383
|
-
y1 - 6,
|
|
476
|
+
yInside ? v < 0 ? y1 - 6 : y1 + 14 : yOut,
|
|
384
477
|
textColor
|
|
385
478
|
);
|
|
386
479
|
}
|
|
@@ -407,7 +500,7 @@ import { line as d3line, area as d3area } from "d3-shape";
|
|
|
407
500
|
function seriesValue(pt, s) {
|
|
408
501
|
return s === 0 ? pt.value : pt.extraValues?.[s - 1] ?? 0;
|
|
409
502
|
}
|
|
410
|
-
function renderLine(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, bgColor, hasTitle) {
|
|
503
|
+
function renderLine(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, bgColor, hasTitle, inlineTitle) {
|
|
411
504
|
const data = chart.data;
|
|
412
505
|
const isArea = chart.fill === true;
|
|
413
506
|
const solid = chart.fillMode === "solid";
|
|
@@ -433,7 +526,8 @@ function renderLine(svg, chart, width, height, colors, palette, isDark, textColo
|
|
|
433
526
|
palette,
|
|
434
527
|
isDark,
|
|
435
528
|
hasTitle,
|
|
436
|
-
width
|
|
529
|
+
width,
|
|
530
|
+
inlineTitle
|
|
437
531
|
);
|
|
438
532
|
const extentFor = (side) => {
|
|
439
533
|
let lo = Infinity;
|
|
@@ -585,7 +679,7 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
585
679
|
const MARGIN2 = 6;
|
|
586
680
|
const halfW = width / 2 - MARGIN2;
|
|
587
681
|
const rH = availH / 2 - availH * 0.06;
|
|
588
|
-
const labelExtent = 1.
|
|
682
|
+
const labelExtent = 1.27 + 0.06 * maxLabelLen;
|
|
589
683
|
const rLabeled = Math.min(rH, halfW / labelExtent);
|
|
590
684
|
const showLabels = maxLabelLen > 0 && rLabeled >= 45;
|
|
591
685
|
const rPlain = Math.min(rH, halfW * 0.94);
|
|
@@ -599,6 +693,7 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
599
693
|
const arcs = d3pie().sort(null).value((d) => d.value)(data.map((d) => ({ value: d.value })));
|
|
600
694
|
const arcGen = d3arc().innerRadius(hasHole ? radius * holeRatio : 0).outerRadius(radius);
|
|
601
695
|
const g = svg.append("g").attr("transform", `translate(${cx},${cy})`);
|
|
696
|
+
const labelInfos = [];
|
|
602
697
|
arcs.forEach((a, i) => {
|
|
603
698
|
const stroke = strokeFor(i, data[i].color);
|
|
604
699
|
const fill = shapeFill(palette, stroke, isDark, { mode: fillMode });
|
|
@@ -612,32 +707,65 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
612
707
|
color: stroke
|
|
613
708
|
});
|
|
614
709
|
if (!showLabels) return;
|
|
710
|
+
const label = labels[i];
|
|
711
|
+
if (!label) return;
|
|
615
712
|
const mid = (a.startAngle + a.endAngle) / 2 - Math.PI / 2;
|
|
616
713
|
const rightSide = Math.cos(mid) >= 0;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
714
|
+
labelInfos.push({
|
|
715
|
+
rightSide,
|
|
716
|
+
x0: Math.cos(mid) * radius,
|
|
717
|
+
y0: Math.sin(mid) * radius,
|
|
718
|
+
// Radial stub end — meets the arc at 90° to the circle edge.
|
|
719
|
+
x1: Math.cos(mid) * (radius + elbowOut),
|
|
720
|
+
y1: Math.sin(mid) * (radius + elbowOut),
|
|
721
|
+
idealY: Math.sin(mid) * (radius + elbowOut),
|
|
722
|
+
y: 0,
|
|
723
|
+
label,
|
|
724
|
+
stroke,
|
|
725
|
+
// Tag the leader-line + label with the same emph-key as the wedge so
|
|
726
|
+
// hover (baked-CSS :has() and the app's JS dim) emphasizes all three
|
|
727
|
+
// together; colour the label text to match its segment.
|
|
728
|
+
tag: {
|
|
625
729
|
line: data[i].lineNumber,
|
|
626
730
|
key: data[i].label,
|
|
627
731
|
name: data[i].label,
|
|
628
732
|
value: `${fmtNum(data[i].value)} (${pct}%)`,
|
|
629
733
|
color: stroke
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
g.append("polyline").attr("points", `${x0},${y0} ${x1},${y1} ${x2},${y1}`).attr("fill", "none").attr("stroke", stroke).attr("stroke-width", 1),
|
|
633
|
-
tag
|
|
634
|
-
);
|
|
635
|
-
tagDatum(
|
|
636
|
-
g.append("text").attr("x", x2 + (rightSide ? font * 0.3 : -font * 0.3)).attr("y", y1 + font * 0.3).attr("text-anchor", rightSide ? "start" : "end").attr("fill", stroke).attr("font-size", font).attr("font-family", FONT_FAMILY).text(label),
|
|
637
|
-
tag
|
|
638
|
-
);
|
|
639
|
-
}
|
|
734
|
+
}
|
|
735
|
+
});
|
|
640
736
|
});
|
|
737
|
+
if (showLabels && labelInfos.length > 0) {
|
|
738
|
+
const labelX = radius + elbowOut + elbowRun;
|
|
739
|
+
const minGap = font * 1.18;
|
|
740
|
+
const bound = availH / 2 - font;
|
|
741
|
+
for (const side of [true, false]) {
|
|
742
|
+
const group = labelInfos.filter((l) => l.rightSide === side);
|
|
743
|
+
if (group.length === 0) continue;
|
|
744
|
+
const topHalf = group.filter((l) => l.idealY < 0).sort((a, b) => b.idealY - a.idealY);
|
|
745
|
+
const botHalf = group.filter((l) => l.idealY >= 0).sort((a, b) => a.idealY - b.idealY);
|
|
746
|
+
topHalf.forEach((l, i) => {
|
|
747
|
+
l.y = i === 0 ? l.idealY : Math.min(l.idealY, topHalf[i - 1].y - minGap);
|
|
748
|
+
l.y = Math.max(l.y, -bound);
|
|
749
|
+
});
|
|
750
|
+
botHalf.forEach((l, i) => {
|
|
751
|
+
l.y = i === 0 ? l.idealY : Math.max(l.idealY, botHalf[i - 1].y + minGap);
|
|
752
|
+
l.y = Math.min(l.y, bound);
|
|
753
|
+
});
|
|
754
|
+
const sx = side ? 1 : -1;
|
|
755
|
+
const tx = sx * labelX;
|
|
756
|
+
for (const l of group) {
|
|
757
|
+
const xr = Math.abs(l.y0) < 1e-3 ? l.x1 : l.y * l.x0 / l.y0;
|
|
758
|
+
tagDatum(
|
|
759
|
+
g.append("polyline").attr("points", `${l.x0},${l.y0} ${xr},${l.y} ${tx},${l.y}`).attr("fill", "none").attr("stroke", l.stroke).attr("stroke-width", 1),
|
|
760
|
+
l.tag
|
|
761
|
+
);
|
|
762
|
+
tagDatum(
|
|
763
|
+
g.append("text").attr("x", tx + sx * font * 0.3).attr("y", l.y + font * 0.3).attr("text-anchor", side ? "start" : "end").attr("fill", l.stroke).attr("font-size", font).attr("font-family", FONT_FAMILY).text(l.label),
|
|
764
|
+
l.tag
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
641
769
|
if (hasHole && !chart.noCenterTotal) {
|
|
642
770
|
g.append("text").attr("text-anchor", "middle").attr("y", Math.max(4, 8 * labelScale)).attr("fill", textColor).attr("font-size", Math.max(11, 26 * labelScale)).attr("font-weight", 700).attr("font-family", FONT_FAMILY).text(fmtNum(total));
|
|
643
771
|
}
|
|
@@ -1408,13 +1536,166 @@ function renderChord(svg, chart, width, height, colors, palette, isDark, textCol
|
|
|
1408
1536
|
|
|
1409
1537
|
// src/charts-d3/function.ts
|
|
1410
1538
|
import { scaleLinear as scaleLinear4 } from "d3-scale";
|
|
1411
|
-
import { line as d3line2 } from "d3-shape";
|
|
1539
|
+
import { line as d3line2, area as d3area2 } from "d3-shape";
|
|
1412
1540
|
|
|
1413
1541
|
// src/utils/expr-eval.ts
|
|
1542
|
+
var FUNCS = {
|
|
1543
|
+
sin: Math.sin,
|
|
1544
|
+
cos: Math.cos,
|
|
1545
|
+
tan: Math.tan,
|
|
1546
|
+
ln: Math.log,
|
|
1547
|
+
log: Math.log10,
|
|
1548
|
+
exp: Math.exp,
|
|
1549
|
+
sqrt: Math.sqrt,
|
|
1550
|
+
abs: Math.abs
|
|
1551
|
+
};
|
|
1552
|
+
function tokenize(expr) {
|
|
1553
|
+
const tokens = [];
|
|
1554
|
+
let i = 0;
|
|
1555
|
+
const n = expr.length;
|
|
1556
|
+
while (i < n) {
|
|
1557
|
+
const c = expr.charAt(i);
|
|
1558
|
+
if (c === " " || c === " ") {
|
|
1559
|
+
i++;
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1562
|
+
if (c >= "0" && c <= "9" || c === ".") {
|
|
1563
|
+
let j = i + 1;
|
|
1564
|
+
while (/[0-9.]/.test(expr.charAt(j))) j++;
|
|
1565
|
+
const exp = expr.charAt(j);
|
|
1566
|
+
if (exp === "e" || exp === "E") {
|
|
1567
|
+
let k = j + 1;
|
|
1568
|
+
const sign = expr.charAt(k);
|
|
1569
|
+
if (sign === "+" || sign === "-") k++;
|
|
1570
|
+
if (/[0-9]/.test(expr.charAt(k))) {
|
|
1571
|
+
while (/[0-9]/.test(expr.charAt(k))) k++;
|
|
1572
|
+
j = k;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
const num = Number(expr.slice(i, j));
|
|
1576
|
+
if (!isFinite(num)) throw new Error("bad number");
|
|
1577
|
+
tokens.push({ t: "num", v: num });
|
|
1578
|
+
i = j;
|
|
1579
|
+
continue;
|
|
1580
|
+
}
|
|
1581
|
+
if (/[a-zA-Z]/.test(c)) {
|
|
1582
|
+
let j = i + 1;
|
|
1583
|
+
while (/[a-zA-Z0-9]/.test(expr.charAt(j))) j++;
|
|
1584
|
+
tokens.push({ t: "id", v: expr.slice(i, j).toLowerCase() });
|
|
1585
|
+
i = j;
|
|
1586
|
+
continue;
|
|
1587
|
+
}
|
|
1588
|
+
if ("+-*/^()".includes(c)) {
|
|
1589
|
+
tokens.push({ t: "op", v: c });
|
|
1590
|
+
i++;
|
|
1591
|
+
continue;
|
|
1592
|
+
}
|
|
1593
|
+
throw new Error(`unexpected char: ${c}`);
|
|
1594
|
+
}
|
|
1595
|
+
return tokens;
|
|
1596
|
+
}
|
|
1597
|
+
var Parser = class {
|
|
1598
|
+
constructor(tokens, x) {
|
|
1599
|
+
this.tokens = tokens;
|
|
1600
|
+
this.x = x;
|
|
1601
|
+
}
|
|
1602
|
+
tokens;
|
|
1603
|
+
x;
|
|
1604
|
+
pos = 0;
|
|
1605
|
+
peek() {
|
|
1606
|
+
return this.tokens[this.pos];
|
|
1607
|
+
}
|
|
1608
|
+
eatOp(v) {
|
|
1609
|
+
const tk = this.peek();
|
|
1610
|
+
if (tk?.t !== "op" || tk.v !== v) throw new Error(`expected ${v}`);
|
|
1611
|
+
this.pos++;
|
|
1612
|
+
}
|
|
1613
|
+
evaluate() {
|
|
1614
|
+
const value = this.parseExpr();
|
|
1615
|
+
if (this.pos !== this.tokens.length) throw new Error("trailing input");
|
|
1616
|
+
return value;
|
|
1617
|
+
}
|
|
1618
|
+
// expr = term (('+' | '-') term)*
|
|
1619
|
+
parseExpr() {
|
|
1620
|
+
let value = this.parseTerm();
|
|
1621
|
+
for (; ; ) {
|
|
1622
|
+
const tk = this.peek();
|
|
1623
|
+
if (tk?.t === "op" && (tk.v === "+" || tk.v === "-")) {
|
|
1624
|
+
this.pos++;
|
|
1625
|
+
const rhs = this.parseTerm();
|
|
1626
|
+
value = tk.v === "+" ? value + rhs : value - rhs;
|
|
1627
|
+
} else break;
|
|
1628
|
+
}
|
|
1629
|
+
return value;
|
|
1630
|
+
}
|
|
1631
|
+
// term = factor (('*' | '/') factor)*
|
|
1632
|
+
parseTerm() {
|
|
1633
|
+
let value = this.parseFactor();
|
|
1634
|
+
for (; ; ) {
|
|
1635
|
+
const tk = this.peek();
|
|
1636
|
+
if (tk?.t === "op" && (tk.v === "*" || tk.v === "/")) {
|
|
1637
|
+
this.pos++;
|
|
1638
|
+
const rhs = this.parseFactor();
|
|
1639
|
+
value = tk.v === "*" ? value * rhs : value / rhs;
|
|
1640
|
+
} else break;
|
|
1641
|
+
}
|
|
1642
|
+
return value;
|
|
1643
|
+
}
|
|
1644
|
+
// factor = ('+' | '-') factor | power
|
|
1645
|
+
parseFactor() {
|
|
1646
|
+
const tk = this.peek();
|
|
1647
|
+
if (tk?.t === "op" && (tk.v === "+" || tk.v === "-")) {
|
|
1648
|
+
this.pos++;
|
|
1649
|
+
const operand = this.parseFactor();
|
|
1650
|
+
return tk.v === "-" ? -operand : operand;
|
|
1651
|
+
}
|
|
1652
|
+
return this.parsePower();
|
|
1653
|
+
}
|
|
1654
|
+
// power = primary ('^' factor)? — right-associative
|
|
1655
|
+
parsePower() {
|
|
1656
|
+
const base = this.parsePrimary();
|
|
1657
|
+
const tk = this.peek();
|
|
1658
|
+
if (tk?.t === "op" && tk.v === "^") {
|
|
1659
|
+
this.pos++;
|
|
1660
|
+
const exponent = this.parseFactor();
|
|
1661
|
+
return base ** exponent;
|
|
1662
|
+
}
|
|
1663
|
+
return base;
|
|
1664
|
+
}
|
|
1665
|
+
// primary = number | const | 'x' | func '(' expr ')' | '(' expr ')'
|
|
1666
|
+
parsePrimary() {
|
|
1667
|
+
const tk = this.peek();
|
|
1668
|
+
if (!tk) throw new Error("unexpected end");
|
|
1669
|
+
if (tk.t === "num") {
|
|
1670
|
+
this.pos++;
|
|
1671
|
+
return tk.v;
|
|
1672
|
+
}
|
|
1673
|
+
if (tk.t === "op" && tk.v === "(") {
|
|
1674
|
+
this.pos++;
|
|
1675
|
+
const value = this.parseExpr();
|
|
1676
|
+
this.eatOp(")");
|
|
1677
|
+
return value;
|
|
1678
|
+
}
|
|
1679
|
+
if (tk.t === "id") {
|
|
1680
|
+
this.pos++;
|
|
1681
|
+
if (tk.v === "x") return this.x;
|
|
1682
|
+
if (tk.v === "pi") return Math.PI;
|
|
1683
|
+
if (tk.v === "e") return Math.E;
|
|
1684
|
+
const fn = FUNCS[tk.v];
|
|
1685
|
+
if (fn) {
|
|
1686
|
+
this.eatOp("(");
|
|
1687
|
+
const arg = this.parseExpr();
|
|
1688
|
+
this.eatOp(")");
|
|
1689
|
+
return fn(arg);
|
|
1690
|
+
}
|
|
1691
|
+
throw new Error(`unknown identifier: ${tk.v}`);
|
|
1692
|
+
}
|
|
1693
|
+
throw new Error("unexpected token");
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1414
1696
|
function evaluateExpression(expr, x) {
|
|
1415
1697
|
try {
|
|
1416
|
-
const
|
|
1417
|
-
const result = new Function(`return ${processed}`)();
|
|
1698
|
+
const result = new Parser(tokenize(expr), x).evaluate();
|
|
1418
1699
|
return typeof result === "number" && isFinite(result) ? result : NaN;
|
|
1419
1700
|
} catch {
|
|
1420
1701
|
return NaN;
|
|
@@ -1423,7 +1704,7 @@ function evaluateExpression(expr, x) {
|
|
|
1423
1704
|
|
|
1424
1705
|
// src/charts-d3/function.ts
|
|
1425
1706
|
var SAMPLES = 200;
|
|
1426
|
-
function renderFunction(svg, chart, width, height, colors, textColor, mutedColor, topInset) {
|
|
1707
|
+
function renderFunction(svg, chart, width, height, colors, textColor, mutedColor, topInset, palette, isDark) {
|
|
1427
1708
|
const fns = chart.functions ?? [];
|
|
1428
1709
|
if (fns.length === 0) return;
|
|
1429
1710
|
const xr = chart.xRange ?? { min: -10, max: 10 };
|
|
@@ -1471,7 +1752,15 @@ function renderFunction(svg, chart, width, height, colors, textColor, mutedColor
|
|
|
1471
1752
|
svg.append("line").attr("x1", xx).attr("x2", xx).attr("y1", m.top).attr("y2", m.top + plotH).attr("stroke", mutedColor).attr("stroke-opacity", t === 0 ? 0.6 : 0.2);
|
|
1472
1753
|
svg.append("text").attr("class", "dgmo-tick").attr("x", xx).attr("y", m.top + plotH + 18).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", TICK_FONT).attr("font-family", FONT_FAMILY).text(fmtNum(t));
|
|
1473
1754
|
}
|
|
1474
|
-
const
|
|
1755
|
+
const inRange = (p) => isFinite(p[1]) && p[1] >= yLo - 1 && p[1] <= yHi + 1;
|
|
1756
|
+
if (chart.fill === true) {
|
|
1757
|
+
const solid = chart.fillMode === "solid";
|
|
1758
|
+
const areaGen = d3area2().defined(inRange).x((p) => x(p[0])).y0(y(Math.max(y.domain()[0], 0))).y1((p) => y(p[1]));
|
|
1759
|
+
for (const c of curves) {
|
|
1760
|
+
svg.append("path").attr("class", "dgmo-series-area").attr("d", areaGen(c.pts) ?? "").attr("fill", solid ? c.color : shapeFill(palette, c.color, isDark)).attr("stroke", "none").attr("data-series-name", c.name);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
const gen = d3line2().defined(inRange).x((p) => x(p[0])).y((p) => y(p[1]));
|
|
1475
1764
|
for (const c of curves) {
|
|
1476
1765
|
const path = svg.append("path").attr("d", gen(c.pts) ?? "").attr("fill", "none").attr("stroke", c.color).attr("stroke-width", 1.75).attr("stroke-linejoin", "round").attr("data-series-name", c.name);
|
|
1477
1766
|
tagDatum(path, { line: c.line, key: c.name, name: c.name, color: c.color });
|
|
@@ -1500,6 +1789,25 @@ var D3_DATA_CHART_TYPES = /* @__PURE__ */ new Set([...STANDARD, ...EXTENDED]);
|
|
|
1500
1789
|
function supportsD3DataChart(type) {
|
|
1501
1790
|
return D3_DATA_CHART_TYPES.has(type);
|
|
1502
1791
|
}
|
|
1792
|
+
var INLINE_LEGEND_TYPES = /* @__PURE__ */ new Set([
|
|
1793
|
+
"bar",
|
|
1794
|
+
"line",
|
|
1795
|
+
"radar",
|
|
1796
|
+
"scatter",
|
|
1797
|
+
"function"
|
|
1798
|
+
]);
|
|
1799
|
+
function inlineTitleFor(chart, hasTitle, textColor) {
|
|
1800
|
+
if (!hasTitle || !chart.legendInline || chart.noLegend || !INLINE_LEGEND_TYPES.has(chart.type)) {
|
|
1801
|
+
return void 0;
|
|
1802
|
+
}
|
|
1803
|
+
return {
|
|
1804
|
+
title: chart.title,
|
|
1805
|
+
...chart.titleLineNumber !== void 0 && {
|
|
1806
|
+
titleLineNumber: chart.titleLineNumber
|
|
1807
|
+
},
|
|
1808
|
+
textColor
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1503
1811
|
function firstNonCommentToken(content) {
|
|
1504
1812
|
for (const raw of content.split("\n")) {
|
|
1505
1813
|
const l = raw.trim();
|
|
@@ -1547,7 +1855,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1547
1855
|
const std = forceExtended ? null : parseChart(content, palette);
|
|
1548
1856
|
if (std && !std.error && std.data.length > 0 && STANDARD.has(std.type)) {
|
|
1549
1857
|
const hasTitle2 = !std.noTitle && !!std.title;
|
|
1550
|
-
|
|
1858
|
+
const inlineTitle2 = inlineTitleFor(std, hasTitle2, textColor);
|
|
1859
|
+
if (hasTitle2 && !inlineTitle2)
|
|
1551
1860
|
renderChartTitle(s, std.title, std.titleLineNumber, width, textColor);
|
|
1552
1861
|
switch (std.type) {
|
|
1553
1862
|
case "bar":
|
|
@@ -1561,7 +1870,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1561
1870
|
isDark,
|
|
1562
1871
|
textColor,
|
|
1563
1872
|
mutedColor,
|
|
1564
|
-
hasTitle2
|
|
1873
|
+
hasTitle2,
|
|
1874
|
+
inlineTitle2
|
|
1565
1875
|
);
|
|
1566
1876
|
return true;
|
|
1567
1877
|
case "line":
|
|
@@ -1576,7 +1886,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1576
1886
|
textColor,
|
|
1577
1887
|
mutedColor,
|
|
1578
1888
|
bgColor,
|
|
1579
|
-
hasTitle2
|
|
1889
|
+
hasTitle2,
|
|
1890
|
+
inlineTitle2
|
|
1580
1891
|
);
|
|
1581
1892
|
return true;
|
|
1582
1893
|
case "pie":
|
|
@@ -1599,7 +1910,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1599
1910
|
palette,
|
|
1600
1911
|
isDark,
|
|
1601
1912
|
hasTitle2,
|
|
1602
|
-
width
|
|
1913
|
+
width,
|
|
1914
|
+
inlineTitle2
|
|
1603
1915
|
);
|
|
1604
1916
|
renderRadar(
|
|
1605
1917
|
s,
|
|
@@ -1633,7 +1945,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1633
1945
|
if (ext.error || !EXTENDED.has(ext.type)) return false;
|
|
1634
1946
|
const seriesColors = getSeriesColors(palette);
|
|
1635
1947
|
const hasTitle = !ext.noTitle && !!ext.title;
|
|
1636
|
-
|
|
1948
|
+
const inlineTitle = inlineTitleFor(ext, hasTitle, textColor);
|
|
1949
|
+
if (hasTitle && !inlineTitle)
|
|
1637
1950
|
renderChartTitle(s, ext.title, ext.titleLineNumber, width, textColor);
|
|
1638
1951
|
switch (ext.type) {
|
|
1639
1952
|
case "funnel":
|
|
@@ -1669,7 +1982,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1669
1982
|
palette,
|
|
1670
1983
|
isDark,
|
|
1671
1984
|
hasTitle,
|
|
1672
|
-
width
|
|
1985
|
+
width,
|
|
1986
|
+
inlineTitle
|
|
1673
1987
|
);
|
|
1674
1988
|
renderScatter(
|
|
1675
1989
|
s,
|
|
@@ -1718,7 +2032,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1718
2032
|
palette,
|
|
1719
2033
|
isDark,
|
|
1720
2034
|
hasTitle,
|
|
1721
|
-
width
|
|
2035
|
+
width,
|
|
2036
|
+
inlineTitle
|
|
1722
2037
|
);
|
|
1723
2038
|
renderFunction(
|
|
1724
2039
|
s,
|
|
@@ -1728,7 +2043,9 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1728
2043
|
seriesColors,
|
|
1729
2044
|
textColor,
|
|
1730
2045
|
mutedColor,
|
|
1731
|
-
top
|
|
2046
|
+
top,
|
|
2047
|
+
palette,
|
|
2048
|
+
isDark
|
|
1732
2049
|
);
|
|
1733
2050
|
return true;
|
|
1734
2051
|
}
|
|
@@ -1744,4 +2061,4 @@ export {
|
|
|
1744
2061
|
supportsD3DataChart,
|
|
1745
2062
|
renderDataChartD3
|
|
1746
2063
|
};
|
|
1747
|
-
//# sourceMappingURL=chunk-
|
|
2064
|
+
//# sourceMappingURL=chunk-BR2VSKHI.js.map
|