@diagrammo/dgmo 0.96.0 → 0.97.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 +172 -8
- package/dist/advanced.js +225 -243
- package/dist/block.d.ts +8 -0
- package/dist/block.js +138 -66
- package/dist/{calculator-GIB7POFX.js → calculator-CIGGTURF.js} +2 -2
- package/dist/{chart-meta-uImk4eTn.d.ts → chart-meta-B7niEd52.d.ts} +3 -1
- package/dist/chart-meta.d.ts +2 -2
- package/dist/chart-meta.js +19 -19
- package/dist/{chart-types-CBVYiLqy.d.ts → chart-types-Dxtv4XSz.d.ts} +3 -0
- package/dist/{charts-d3-IRP5VANE.js → charts-d3-INWEGMSD.js} +14 -14
- package/dist/{chunk-MVUNMJKO.js → chunk-2FMOLWX4.js} +71 -57
- package/dist/{chunk-2BYFNZVM.js → chunk-2SZILMQT.js} +57 -15
- package/dist/{chunk-VLI6AWS3.js → chunk-3C4OXVZJ.js} +2 -2
- package/dist/{chunk-OO4GUE4E.js → chunk-3HL6NSSQ.js} +63 -18
- package/dist/{chunk-RGFVHYDP.js → chunk-3IUMSK72.js} +2 -2
- package/dist/{chunk-LRHPBWOY.js → chunk-44RLIAYC.js} +17 -10
- package/dist/{chunk-H7AXCRO7.js → chunk-453IWXZ3.js} +0 -11
- package/dist/{chunk-FHX373L5.js → chunk-47INRTZ6.js} +2 -2
- package/dist/{chunk-IN7XI6NO.js → chunk-4NMRS6HW.js} +1 -1
- package/dist/{chunk-HH3DHNQA.js → chunk-4TK26YHH.js} +2 -2
- package/dist/{chunk-5LG526X7.js → chunk-5TGZBHEJ.js} +1 -1
- package/dist/{chunk-BD4O4D2A.js → chunk-5WZYJC2P.js} +2 -2
- package/dist/{chunk-DPNSDCR3.js → chunk-65JFUANT.js} +1 -1
- package/dist/{chunk-EZ6BI5LL.js → chunk-6OUMYNAJ.js} +1 -1
- package/dist/{chunk-U6N547QA.js → chunk-6PUBFB6D.js} +24 -3
- package/dist/{chunk-5GU6C5WB.js → chunk-6S2H6EKN.js} +3 -3
- package/dist/{chunk-OYGJZA24.js → chunk-6SDEXSJY.js} +39 -19
- package/dist/{chunk-IKXQ6NVR.js → chunk-6YBZFOTA.js} +13 -13
- package/dist/{chunk-4B45SNZH.js → chunk-74XR7Z3I.js} +13 -13
- package/dist/{chunk-VNAPEZX2.js → chunk-7ASVGFW3.js} +1 -1
- package/dist/{chunk-RTRORHSP.js → chunk-7QKWU7FX.js} +3 -3
- package/dist/{chunk-A6YINTY6.js → chunk-7RACGVUY.js} +1 -1
- package/dist/{chunk-5G4DOOX2.js → chunk-7TEAFIEJ.js} +9 -5
- package/dist/{chunk-UNCCZ3NU.js → chunk-A3V72YIL.js} +14 -1
- package/dist/{chunk-VJ7NLYFE.js → chunk-A5LFM62B.js} +3 -3
- package/dist/{chunk-P3PSLC2K.js → chunk-AULFF7L2.js} +2 -2
- package/dist/{chunk-SCYVGPLI.js → chunk-B7ZH5EQ2.js} +2 -2
- package/dist/{chunk-VGAMBOOC.js → chunk-C6ME2L4T.js} +2 -2
- package/dist/{chunk-B2YVZ3QU.js → chunk-CGP7RGLJ.js} +1 -1
- package/dist/{chunk-67N26CER.js → chunk-CLW45YKE.js} +2 -1
- package/dist/{chunk-THTYCJGF.js → chunk-CUOMNKYW.js} +4 -4
- package/dist/{chunk-34JOHSVE.js → chunk-CUTEHGXO.js} +2 -2
- package/dist/{chunk-NERQSSYD.js → chunk-D67YE4LR.js} +1 -1
- package/dist/{chunk-DKCVAQU3.js → chunk-D7KZE2XJ.js} +39 -17
- package/dist/{chunk-PGD6CNWO.js → chunk-DFEVFLEG.js} +3 -3
- package/dist/{chunk-VVTCUIPN.js → chunk-DKMZ4VMV.js} +1 -1
- package/dist/{chunk-H7JVKUA5.js → chunk-DRY4W4W6.js} +36 -15
- package/dist/{chunk-IQZSKWE5.js → chunk-E6GHXMH2.js} +8 -8
- package/dist/{chunk-I2I2FKAK.js → chunk-EBJLT7PH.js} +1 -1
- package/dist/{chunk-GEHK4UD5.js → chunk-EEIGHOJR.js} +92 -23
- package/dist/{chunk-FKJWZWNU.js → chunk-EUPUVYWO.js} +1 -1
- package/dist/{chunk-3W73ZP6W.js → chunk-F2OAZHOX.js} +3 -3
- package/dist/{chunk-IU7XKZA6.js → chunk-FK6HZYGK.js} +4 -14
- package/dist/{chunk-2M3K6GD2.js → chunk-FTW2E2YH.js} +6 -6
- package/dist/{chunk-5P2L5QXE.js → chunk-FZVCS2XY.js} +4 -2
- package/dist/chunk-G24NSISJ.js +69 -0
- package/dist/{chunk-5H7SA5ZD.js → chunk-GFQFLLP3.js} +2 -2
- package/dist/{chunk-BUVLLK3D.js → chunk-GLLYHYGT.js} +27 -17
- package/dist/{chunk-VLC6WNRD.js → chunk-GULGSH2Z.js} +4 -0
- package/dist/{chunk-H5NVCOEJ.js → chunk-GXBH7WNN.js} +2 -2
- package/dist/{chunk-7UWVHNPM.js → chunk-H242TVAE.js} +9 -9
- package/dist/{chunk-M4ZUIW3J.js → chunk-H7DZYHQF.js} +3 -3
- package/dist/{chunk-GLCMUTO5.js → chunk-HQNZJMNS.js} +1 -1
- package/dist/{chunk-H7RQG4PH.js → chunk-IAM3IDL4.js} +2 -2
- package/dist/{chunk-WTPS73RM.js → chunk-II6D6NWX.js} +8 -8
- package/dist/{chunk-5ARANBIE.js → chunk-IUFTAFGN.js} +2 -2
- package/dist/{chunk-AQRSEQZV.js → chunk-IZEKHIV6.js} +3 -3
- package/dist/{chunk-WGNP5ND2.js → chunk-J3YM6RA5.js} +3 -3
- package/dist/{chunk-YFIUABSF.js → chunk-J467QBZF.js} +23 -3
- package/dist/{chunk-CD7VQCDL.js → chunk-J7JF4QKA.js} +40 -30
- package/dist/{chunk-MYHR3PMH.js → chunk-JULBDTNU.js} +7 -7
- package/dist/{chunk-EPDBWATV.js → chunk-K7RRXZHS.js} +4 -2
- package/dist/{chunk-YVIPJGFG.js → chunk-KMB754DO.js} +33 -6
- package/dist/chunk-KNKZGRRB.js +439 -0
- package/dist/{chunk-SIABEREK.js → chunk-KTGJQJB3.js} +2 -2
- package/dist/{chunk-LGUFJ7Y2.js → chunk-KW3CC7SB.js} +1 -1
- package/dist/{chunk-ITDF3MWD.js → chunk-L3K5O3Z5.js} +3 -3
- package/dist/chunk-LRTSTDJ6.js +126 -0
- package/dist/{chunk-NI4L6HEU.js → chunk-LZATSXAA.js} +1 -1
- package/dist/{chunk-RVOSA4RR.js → chunk-MJ725XHD.js} +441 -267
- package/dist/{chunk-EPB3UEMD.js → chunk-NBISN6FH.js} +2 -2
- package/dist/{chunk-IZFJZCF6.js → chunk-NN5RUHXV.js} +84 -16
- package/dist/{chunk-KDWEOT54.js → chunk-NOZMRPXI.js} +96 -153
- package/dist/{chunk-EM5SA7NC.js → chunk-NQFZ7LXC.js} +4 -4
- package/dist/chunk-NTDWVTEY.js +12 -0
- package/dist/{chunk-AUXUNV73.js → chunk-O3HRF25Z.js} +1 -1
- package/dist/{chunk-GLL237AP.js → chunk-OSSA5UWA.js} +3 -3
- package/dist/{chunk-UOCWYLYT.js → chunk-OZXKW5NA.js} +1 -1
- package/dist/{chunk-QEU6VM4O.js → chunk-PLQZJZ2K.js} +1 -1
- package/dist/chunk-PRG7NIUU.js +272 -0
- package/dist/{chunk-MAYTYF5S.js → chunk-PSNRB75I.js} +3 -3
- package/dist/{chunk-B5CEV7IR.js → chunk-PT5VFY3B.js} +38 -14
- package/dist/{chunk-KAO7JL4I.js → chunk-PU5X3P3T.js} +6 -5
- package/dist/{chunk-B7BSRVNC.js → chunk-PZ5LAAO3.js} +2 -2
- package/dist/{chunk-TOHTKLKE.js → chunk-Q5Q5JLRT.js} +1 -1
- package/dist/{chunk-TUOZ6AXC.js → chunk-Q6V342WS.js} +16 -4
- package/dist/{chunk-ZOKD5F7M.js → chunk-QDPTOIG7.js} +5 -5
- package/dist/{chunk-ERT7XDQW.js → chunk-QIITSGI5.js} +1 -1
- package/dist/{chunk-K2WXMXI2.js → chunk-QLIZ7SB7.js} +1 -1
- package/dist/chunk-QLNLRZ37.js +181 -0
- package/dist/{chunk-P6LKX3IQ.js → chunk-QOLRTPGH.js} +6 -6
- package/dist/{chunk-FBK32S4D.js → chunk-R4SXMBGF.js} +1 -1
- package/dist/chunk-R4U7IIRX.js +178 -0
- package/dist/{chunk-DWMQ24JR.js → chunk-RC6PISCK.js} +4 -2
- package/dist/{chunk-R5L5E3TC.js → chunk-REKLKGR6.js} +3 -3
- package/dist/{chunk-FUYEXLAN.js → chunk-RFGQDIOI.js} +837 -220
- package/dist/{chunk-W5MMPPGX.js → chunk-ROFSIFSY.js} +4 -4
- package/dist/{chunk-JCC3B2GS.js → chunk-ROH4LYBL.js} +65 -21
- package/dist/{chunk-OAZ6BIIB.js → chunk-SNDCXT5R.js} +9 -7
- package/dist/{chunk-JRN2CRXJ.js → chunk-TDUBTDXS.js} +1 -1
- package/dist/{chunk-GM2SLMQW.js → chunk-TMB4YY3J.js} +34 -4
- package/dist/{chunk-ZBOIYC2G.js → chunk-V3ICBS2O.js} +5 -5
- package/dist/{chunk-HZX4QZGR.js → chunk-V65EDV6S.js} +3 -3
- package/dist/{chunk-67RKJEKF.js → chunk-VKT3BVRO.js} +35 -11
- package/dist/{chunk-5BG4OSWJ.js → chunk-VOO65FKC.js} +12 -12
- package/dist/{chunk-KQAPFIYF.js → chunk-VQWLASDC.js} +2 -2
- package/dist/{chunk-JILEYZ2V.js → chunk-VVL2KKG4.js} +1 -1
- package/dist/{chunk-D7DGLJ7N.js → chunk-VVZDBUHA.js} +2 -2
- package/dist/{chunk-JBAFAKGX.js → chunk-W46OMHOK.js} +23 -27
- package/dist/{chunk-XCKNFFKM.js → chunk-WH6E6SHC.js} +2 -4
- package/dist/{chunk-P2GNNEMN.js → chunk-WPYJAHRP.js} +1 -1
- package/dist/{chunk-TPCP2UOI.js → chunk-WXGFB2O2.js} +3 -3
- package/dist/{chunk-RIK6WUMO.js → chunk-XCYGOCMS.js} +43 -26
- package/dist/{chunk-I3ZRIMR7.js → chunk-XEMCNQQW.js} +15 -15
- package/dist/{chunk-PWZEJNO6.js → chunk-XMUFXJI2.js} +6 -6
- package/dist/{chunk-EMGNCG5C.js → chunk-XZGXVN4T.js} +5 -5
- package/dist/{chunk-WLGOIMTI.js → chunk-YCIBBVI2.js} +2 -2
- package/dist/{chunk-V2NQV7VL.js → chunk-YFIDR7JH.js} +2 -2
- package/dist/{chunk-K2SFH3GJ.js → chunk-YFWIFKRQ.js} +3 -3
- package/dist/{chunk-6XLMTAEX.js → chunk-YIHRLY55.js} +33 -6
- package/dist/{chunk-CYRB2JTN.js → chunk-YLKPRT6U.js} +1 -1
- package/dist/{chunk-KMU65FYM.js → chunk-YSDSFXQD.js} +1 -1
- package/dist/{chunk-ZI6WC24V.js → chunk-ZBJV4KNU.js} +1 -1
- package/dist/{chunk-TIPNNOZC.js → chunk-ZCKVTZHD.js} +41 -19
- package/dist/{chunk-YSGOXZBB.js → chunk-ZMVMGZAJ.js} +1 -1
- package/dist/{chunk-CP73WWLN.js → chunk-ZRW4B4KF.js} +48 -14
- package/dist/{chunk-O2HNVNKO.js → chunk-ZTKO2RD4.js} +5 -5
- package/dist/collapse-6IGH2B24.js +31 -0
- package/dist/collapse-GOWNCVHZ.js +7 -0
- package/dist/collapse-HNTPLB2Q.js +11 -0
- package/dist/collapse-NUM7DPJA.js +10 -0
- package/dist/completion-registry.js +27 -4
- package/dist/dgmo-router-RSYWR5IS.js +101 -0
- package/dist/dimensions-KXAI7U2B.js +21 -0
- package/dist/editor.js +882 -215
- package/dist/{flowchart-parser-SM5LHF2D.js → flowchart-parser-UI5VZNGJ.js} +5 -5
- package/dist/{flowchart-renderer-PPS2GTTD.js → flowchart-renderer-IYWPKPCF.js} +18 -18
- package/dist/fold-at-line-DmSAa1eU.d.ts +11 -0
- package/dist/highlight.js +883 -216
- package/dist/index.d.ts +52 -5
- package/dist/index.js +79 -63
- package/dist/{layout-AF4KA5B2.js → layout-6VY3DHYD.js} +6 -6
- package/dist/{layout-FCFUVCRI.js → layout-7C2QZCEZ.js} +10 -10
- package/dist/{layout-2WESJYRE.js → layout-7E7BNOGO.js} +3 -2
- package/dist/layout-BSK374N6.js +11 -0
- package/dist/{layout-R6G4MEO3.js → layout-FJDBY3WG.js} +5 -5
- package/dist/{layout-KELSNWBD.js → layout-G3RVKEC4.js} +10 -10
- package/dist/{layout-H2KP5A6M.js → layout-GC5XX2RH.js} +2 -2
- package/dist/{layout-LNVIH45F.js → layout-R6ULGQJK.js} +6 -6
- package/dist/{layout-PPIVGJXD.js → layout-ROI5KVSO.js} +3 -3
- package/dist/{layout-3TSVAGWH.js → layout-SPPS225I.js} +3 -3
- package/dist/{layout-HF3PMI4H.js → layout-VTGOYGRC.js} +2 -2
- package/dist/{layout-MPSH3YWE.js → layout-WBH5IHYK.js} +10 -10
- package/dist/layout-WTHBGTH2.js +15 -0
- package/dist/layout-ZCCABSV7.js +15 -0
- package/dist/{layout-search-C2TYUH4L.js → layout-search-DSIDKKQO.js} +8 -8
- package/dist/{legend-constants-55MFBXYF.js → legend-constants-KF3MKWL2.js} +2 -2
- package/dist/{parser-DGLKH4NT.js → parser-3PMYAVFL.js} +2 -2
- package/dist/{parser-OHBBDCG4.js → parser-5KVFS4RN.js} +2 -2
- package/dist/{parser-UHKROC7Z.js → parser-BA43YPIQ.js} +3 -3
- package/dist/{parser-F75WNYMK.js → parser-CFAYEWLF.js} +3 -3
- package/dist/{parser-MWINQNQW.js → parser-DRFEX6OX.js} +3 -3
- package/dist/{parser-W6NX3AIV.js → parser-DWVBRBB2.js} +3 -3
- package/dist/{parser-6WURFLOB.js → parser-E4B7HJT2.js} +3 -3
- package/dist/{parser-DRUGM3R6.js → parser-FWQY3HJX.js} +2 -2
- package/dist/{parser-GBQY3WOZ.js → parser-GMCXCJSP.js} +3 -3
- package/dist/{parser-BPYHIG24.js → parser-IHFHPFL7.js} +3 -3
- package/dist/{parser-QWTECQEC.js → parser-IU6425JW.js} +6 -6
- package/dist/{parser-ZV756RMP.js → parser-IZYIXDJX.js} +6 -6
- package/dist/{parser-TTGZYLYD.js → parser-JQGUTDSX.js} +3 -3
- package/dist/{parser-BNRX35NT.js → parser-JRKPOO2Z.js} +3 -3
- package/dist/{parser-B7SCN7FG.js → parser-KI2XYB2R.js} +2 -2
- package/dist/parser-LDVVBP7S.js +12 -0
- package/dist/{parser-L7SI3PW4.js → parser-MAGFK6OK.js} +4 -4
- package/dist/{parser-722KLLAQ.js → parser-MH5BDN7X.js} +3 -3
- package/dist/{parser-5RUD4A3X.js → parser-MUHFEM4G.js} +3 -3
- package/dist/{parser-Y7QXD2UR.js → parser-P375HO7Q.js} +2 -2
- package/dist/{parser-LUJX7AXO.js → parser-PYY5BRLQ.js} +2 -2
- package/dist/parser-QEMFMVF5.js +12 -0
- package/dist/{parser-WIKXZP4X.js → parser-QIPDBT5M.js} +2 -2
- package/dist/{parser-2AXU2MHJ.js → parser-RNBDDEGL.js} +3 -3
- package/dist/{parser-4GHAYZKZ.js → parser-RSWZGQA7.js} +6 -6
- package/dist/{parser-H6HT2WFQ.js → parser-SGX2PVR5.js} +2 -2
- package/dist/{parser-ZWWQZ4XZ.js → parser-SJUEFKNM.js} +3 -3
- package/dist/{parser-4BOP77CD.js → parser-UMNBPXG2.js} +2 -2
- package/dist/{parser-GM5B2EPW.js → parser-WE4VSBBY.js} +3 -3
- package/dist/{parser-XEJP37GQ.js → parser-WKEYS7N3.js} +3 -3
- package/dist/{parser-DWV2CYBS.js → parser-WPXUUNA2.js} +3 -3
- package/dist/{parser-5HQPPVHJ.js → parser-XP3RCOTN.js} +3 -3
- package/dist/{parser-F3JJNIFC.js → parser-YV4RBHG7.js} +3 -3
- package/dist/{parser-CRJYLOHA.js → parser-YZ3J542U.js} +2 -2
- package/dist/{renderer-BYLQ37T2.js → renderer-2V5NVI3V.js} +15 -15
- package/dist/renderer-4PKYVOYL.js +39 -0
- package/dist/{renderer-ONENGXFQ.js → renderer-66SCERH7.js} +14 -12
- package/dist/renderer-6IAXRZLK.js +85 -0
- package/dist/{renderer-GKY55M4Z.js → renderer-6O5SV5YE.js} +10 -10
- package/dist/{renderer-F7YGMEGQ.js → renderer-7OXMSF4R.js} +4 -4
- package/dist/{renderer-6HU44IGJ.js → renderer-A36NL2SS.js} +8 -8
- package/dist/{renderer-66NCRXSC.js → renderer-ASPBBACI.js} +13 -11
- package/dist/{renderer-5GP7YUS4.js → renderer-BXVTYE27.js} +7 -6
- package/dist/renderer-CC6O6GQK.js +18 -0
- package/dist/{renderer-VNJOZPSH.js → renderer-CNDB4JTZ.js} +17 -17
- package/dist/renderer-COV2DXTM.js +41 -0
- package/dist/renderer-DXCATVLO.js +30 -0
- package/dist/{renderer-VUXAAGUG.js → renderer-E5E3OJ42.js} +12 -11
- package/dist/{renderer-MGF2NNGG.js → renderer-E7LC7HCU.js} +5 -5
- package/dist/{renderer-PEJF6R2I.js → renderer-F3JYZERE.js} +4 -4
- package/dist/{renderer-CVCCW7UT.js → renderer-FAFSRFGR.js} +9 -9
- package/dist/renderer-HIB6LZWZ.js +26 -0
- package/dist/renderer-HLDRRFZB.js +28 -0
- package/dist/renderer-INQMQPNN.js +22 -0
- package/dist/renderer-ITJ67HXO.js +27 -0
- package/dist/{renderer-SYRH3B62.js → renderer-JLOKFKOZ.js} +14 -13
- package/dist/{renderer-LJPUCG3U.js → renderer-KOPJ76GS.js} +10 -10
- package/dist/{renderer-N6PM5CSG.js → renderer-M2467III.js} +14 -13
- package/dist/{renderer-MVBAQP3M.js → renderer-MYKL6VG6.js} +6 -6
- package/dist/{renderer-YJVQT7QG.js → renderer-S6L3JR6C.js} +11 -11
- package/dist/{renderer-NOYLNVTI.js → renderer-SYWVZ4CY.js} +3 -3
- package/dist/renderer-TCTZZ5Y6.js +32 -0
- package/dist/{renderer-D6EH5UQ6.js → renderer-UIHCYXBY.js} +12 -12
- package/dist/{renderer-QZJZIAT3.js → renderer-WIBVOPRC.js} +6 -4
- package/dist/{renderer-TS5NHOQD.js → renderer-XMJ6XZGL.js} +12 -11
- package/dist/{renderer-2V2XY2V7.js → renderer-ZTHXOBXW.js} +8 -8
- package/dist/{renderer-radial-4R7AKETK.js → renderer-radial-FC25BDCZ.js} +8 -8
- package/dist/{state-parser-EQBBEKHR.js → state-parser-2PQRH5JE.js} +6 -6
- package/dist/state-renderer-YP6HWLJR.js +43 -0
- package/dist/{themes-CbJL3w8L.d.ts → themes-DoLdhUXV.d.ts} +1 -1
- package/docs/ai-integration.md +4 -3
- package/docs/language-reference.md +99 -13
- package/gallery/fixtures/swot-relabel.dgmo +19 -0
- package/gallery/fixtures/swot-tags.dgmo +16 -0
- package/gallery/fixtures/swot.dgmo +13 -0
- package/package.json +1 -1
- package/dist/chunk-R2K5L4UA.js +0 -49
- package/dist/collapse-TCVK3RPO.js +0 -8
- package/dist/dgmo-router-EPBQKQW2.js +0 -100
- package/dist/dimensions-DBCRBZIU.js +0 -21
- package/dist/layout-3J72UULM.js +0 -15
- package/dist/layout-IXQNVRBE.js +0 -15
- package/dist/layout-VDCJOZSH.js +0 -11
- package/dist/parser-HM6FEX5K.js +0 -14
- package/dist/renderer-2MCV75JQ.js +0 -41
- package/dist/renderer-5AEDVLAA.js +0 -31
- package/dist/renderer-7C76HP5W.js +0 -30
- package/dist/renderer-7RAMBMTH.js +0 -22
- package/dist/renderer-E3334XLT.js +0 -84
- package/dist/renderer-LFZKG2GR.js +0 -26
- package/dist/renderer-MZIWP55B.js +0 -28
- package/dist/renderer-N75E3UVY.js +0 -25
- package/dist/renderer-VNUDN6F5.js +0 -39
- package/dist/state-renderer-SOGZ2CNN.js +0 -42
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeName
|
|
3
|
+
} from "./chunk-NOTA6TEI.js";
|
|
4
|
+
import {
|
|
5
|
+
AUTO_TAG_COLOR_SENTINEL,
|
|
6
|
+
activeTagNoMatchMessage,
|
|
7
|
+
finalizeAutoTagColors,
|
|
8
|
+
matchTagBlockHeading,
|
|
9
|
+
stripDefaultModifier,
|
|
10
|
+
tagAttrKey,
|
|
11
|
+
validateTagGroupNames
|
|
12
|
+
} from "./chunk-KW3CC7SB.js";
|
|
13
|
+
import {
|
|
14
|
+
SWOT_REGISTRY,
|
|
15
|
+
extractColor,
|
|
16
|
+
measureIndent,
|
|
17
|
+
parseFirstLine,
|
|
18
|
+
peelQuotedName,
|
|
19
|
+
splitNameAndMeta,
|
|
20
|
+
warnUnknownMetaKeys,
|
|
21
|
+
withTagAliases
|
|
22
|
+
} from "./chunk-RFGQDIOI.js";
|
|
23
|
+
import {
|
|
24
|
+
resolveColorWithDiagnostic
|
|
25
|
+
} from "./chunk-3J7O3CU6.js";
|
|
26
|
+
import {
|
|
27
|
+
emit,
|
|
28
|
+
formatDgmoError,
|
|
29
|
+
makeDgmoError,
|
|
30
|
+
makeFail,
|
|
31
|
+
suggest
|
|
32
|
+
} from "./chunk-BYU54C3S.js";
|
|
33
|
+
|
|
34
|
+
// src/swot/diagnostics.ts
|
|
35
|
+
var SWOT_DX = {
|
|
36
|
+
UNKNOWN_SECTION: {
|
|
37
|
+
code: "E_SWOT_UNKNOWN_SECTION",
|
|
38
|
+
severity: "error",
|
|
39
|
+
chartType: "swot",
|
|
40
|
+
title: "Unknown section",
|
|
41
|
+
message: (p) => `Unknown section '${p.word ?? "word"}'. Did you mean '${p.nearest ?? "strengths"}'?`,
|
|
42
|
+
hint: "A line at indent 0 opens one of: strengths, weaknesses, opportunities, threats. There are no brackets.",
|
|
43
|
+
example: `swot
|
|
44
|
+
|
|
45
|
+
[Strengths]
|
|
46
|
+
Loyal crew`
|
|
47
|
+
},
|
|
48
|
+
DUPLICATE_SECTION: {
|
|
49
|
+
code: "E_SWOT_DUPLICATE_SECTION",
|
|
50
|
+
severity: "error",
|
|
51
|
+
chartType: "swot",
|
|
52
|
+
title: "Duplicate section",
|
|
53
|
+
message: (p) => `Section '${p.section ?? "strengths"}' appears more than once.`,
|
|
54
|
+
hint: "Merge the items under one section line.",
|
|
55
|
+
example: `swot
|
|
56
|
+
|
|
57
|
+
strengths
|
|
58
|
+
Loyal crew
|
|
59
|
+
strengths
|
|
60
|
+
Fast ship`
|
|
61
|
+
},
|
|
62
|
+
EMPTY_SECTION: {
|
|
63
|
+
code: "W_SWOT_EMPTY_SECTION",
|
|
64
|
+
severity: "warning",
|
|
65
|
+
chartType: "swot",
|
|
66
|
+
title: "Empty section",
|
|
67
|
+
message: (p) => `Section '${p.section ?? "threats"}' has no items, so its panel says "None listed".`,
|
|
68
|
+
hint: "Indent at least one item under the section line.",
|
|
69
|
+
example: `swot
|
|
70
|
+
|
|
71
|
+
strengths
|
|
72
|
+
Loyal crew
|
|
73
|
+
weaknesses
|
|
74
|
+
Old sails
|
|
75
|
+
opportunities
|
|
76
|
+
New trade route`
|
|
77
|
+
},
|
|
78
|
+
ORPHAN_ITEM: {
|
|
79
|
+
code: "E_SWOT_ORPHAN_ITEM",
|
|
80
|
+
severity: "error",
|
|
81
|
+
chartType: "swot",
|
|
82
|
+
title: "Item before a section",
|
|
83
|
+
message: (p) => `Item '${p.item ?? "item"}' comes before any section.`,
|
|
84
|
+
hint: "Put a section line above it: strengths, weaknesses, opportunities or threats.",
|
|
85
|
+
example: `swot
|
|
86
|
+
|
|
87
|
+
Loyal crew
|
|
88
|
+
strengths
|
|
89
|
+
Fast ship`
|
|
90
|
+
},
|
|
91
|
+
TOO_DEEP: {
|
|
92
|
+
code: "E_SWOT_TOO_DEEP",
|
|
93
|
+
severity: "error",
|
|
94
|
+
chartType: "swot",
|
|
95
|
+
title: "Nested too deep",
|
|
96
|
+
message: (p) => `'${p.item ?? "line"}' is nested too deep. An item takes one detail level.`,
|
|
97
|
+
hint: "Move the line up to the detail level, or make it an item of its own.",
|
|
98
|
+
example: `swot
|
|
99
|
+
|
|
100
|
+
strengths
|
|
101
|
+
Loyal crew
|
|
102
|
+
Sworn in
|
|
103
|
+
At Tortuga`
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var SWOT_DIAGNOSTICS = Object.values(SWOT_DX);
|
|
107
|
+
|
|
108
|
+
// src/swot/parser.ts
|
|
109
|
+
var SECTION_DEFAULTS = [
|
|
110
|
+
{ key: "strengths", label: "Strengths", color: "green" },
|
|
111
|
+
{ key: "weaknesses", label: "Weaknesses", color: "yellow" },
|
|
112
|
+
{ key: "opportunities", label: "Opportunities", color: "blue" },
|
|
113
|
+
{ key: "threats", label: "Threats", color: "red" }
|
|
114
|
+
];
|
|
115
|
+
var SECTION_KEYS = SECTION_DEFAULTS.map((s) => s.key);
|
|
116
|
+
var VALUE_OPTIONS = /* @__PURE__ */ new Set(["active-tag", "palette"]);
|
|
117
|
+
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
118
|
+
"no-axes",
|
|
119
|
+
"no-tint-items",
|
|
120
|
+
"no-title",
|
|
121
|
+
"no-legend",
|
|
122
|
+
"legend-inline"
|
|
123
|
+
]);
|
|
124
|
+
var DEFAULT_X_LABELS = ["Helpful", "Harmful"];
|
|
125
|
+
var DEFAULT_Y_LABELS = ["Internal", "External"];
|
|
126
|
+
function editDistance(a, b) {
|
|
127
|
+
let row = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
128
|
+
for (let i = 1; i <= a.length; i++) {
|
|
129
|
+
const next = [i];
|
|
130
|
+
for (let j = 1; j <= b.length; j++) {
|
|
131
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
132
|
+
next.push(Math.min(row[j] + 1, next[j - 1] + 1, row[j - 1] + cost));
|
|
133
|
+
}
|
|
134
|
+
row = next;
|
|
135
|
+
}
|
|
136
|
+
return row[b.length];
|
|
137
|
+
}
|
|
138
|
+
function nearestSection(word) {
|
|
139
|
+
const clean = word.toLowerCase().replace(/[^a-z]/g, "");
|
|
140
|
+
let best = SECTION_KEYS[0];
|
|
141
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
142
|
+
for (const key of SECTION_KEYS) {
|
|
143
|
+
const distance = editDistance(clean, key);
|
|
144
|
+
if (distance < bestDistance) {
|
|
145
|
+
best = key;
|
|
146
|
+
bestDistance = distance;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return best;
|
|
150
|
+
}
|
|
151
|
+
function parseItemLine(trimmed, lineNumber, counter, metaAliasMap, diagnostics) {
|
|
152
|
+
const text = trimmed.startsWith("- ") ? trimmed.slice(2).trim() : trimmed;
|
|
153
|
+
const registry = withTagAliases(SWOT_REGISTRY, new Set(metaAliasMap.keys()));
|
|
154
|
+
const split = splitNameAndMeta(
|
|
155
|
+
text,
|
|
156
|
+
registry,
|
|
157
|
+
metaAliasMap,
|
|
158
|
+
void 0,
|
|
159
|
+
diagnostics,
|
|
160
|
+
lineNumber,
|
|
161
|
+
{ peelAlias: false }
|
|
162
|
+
);
|
|
163
|
+
warnUnknownMetaKeys(
|
|
164
|
+
split.meta,
|
|
165
|
+
registry,
|
|
166
|
+
(msg) => diagnostics.push(makeDgmoError(lineNumber, msg, "warning")),
|
|
167
|
+
split.name
|
|
168
|
+
);
|
|
169
|
+
const name = peelQuotedName(split.name);
|
|
170
|
+
const title = split.color !== void 0 ? `${name} ${split.color}` : name;
|
|
171
|
+
return {
|
|
172
|
+
id: `item-${counter}`,
|
|
173
|
+
title,
|
|
174
|
+
tags: { ...split.meta },
|
|
175
|
+
details: [],
|
|
176
|
+
lineNumber,
|
|
177
|
+
endLineNumber: lineNumber
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function parseSwot(content, palette) {
|
|
181
|
+
const options = {};
|
|
182
|
+
const sectionsByKey = /* @__PURE__ */ new Map();
|
|
183
|
+
const result = {
|
|
184
|
+
type: "swot",
|
|
185
|
+
sections: [],
|
|
186
|
+
tagGroups: [],
|
|
187
|
+
options,
|
|
188
|
+
xLabels: DEFAULT_X_LABELS,
|
|
189
|
+
yLabels: DEFAULT_Y_LABELS,
|
|
190
|
+
diagnostics: [],
|
|
191
|
+
error: null
|
|
192
|
+
};
|
|
193
|
+
const diagnostics = result.diagnostics;
|
|
194
|
+
const fail = makeFail(result);
|
|
195
|
+
const report = (spec, line, params) => {
|
|
196
|
+
const diag = emit(spec, line, params);
|
|
197
|
+
diagnostics.push(diag);
|
|
198
|
+
if (diag.severity === "error") result.error ??= formatDgmoError(diag);
|
|
199
|
+
};
|
|
200
|
+
const warn = (line, message, code) => {
|
|
201
|
+
diagnostics.push(makeDgmoError(line, message, "warning", code));
|
|
202
|
+
};
|
|
203
|
+
const defaultColor = (word, line) => resolveColorWithDiagnostic(word, line, diagnostics, palette) ?? word;
|
|
204
|
+
if (!content?.trim()) {
|
|
205
|
+
return fail(0, "No content provided");
|
|
206
|
+
}
|
|
207
|
+
const lines = content.split("\n");
|
|
208
|
+
const metaAliasMap = /* @__PURE__ */ new Map();
|
|
209
|
+
const tagGroups = result.tagGroups;
|
|
210
|
+
let firstLineSeen = false;
|
|
211
|
+
let contentStarted = false;
|
|
212
|
+
let activeTagLine = 0;
|
|
213
|
+
let currentTagGroup = null;
|
|
214
|
+
let currentSection = null;
|
|
215
|
+
let currentItem = null;
|
|
216
|
+
let itemIndent = 0;
|
|
217
|
+
let detailIndent = null;
|
|
218
|
+
let itemCounter = 0;
|
|
219
|
+
for (let i = 0; i < lines.length; i++) {
|
|
220
|
+
const line = lines[i];
|
|
221
|
+
const lineNumber = i + 1;
|
|
222
|
+
const trimmed = line.trim();
|
|
223
|
+
if (!trimmed) {
|
|
224
|
+
currentTagGroup = null;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (trimmed.startsWith("//")) continue;
|
|
228
|
+
if (!firstLineSeen) {
|
|
229
|
+
firstLineSeen = true;
|
|
230
|
+
const firstLine = parseFirstLine(trimmed);
|
|
231
|
+
if (firstLine) {
|
|
232
|
+
if (firstLine.chartType !== "swot") {
|
|
233
|
+
let msg = `Expected chart type "swot", got "${firstLine.chartType}"`;
|
|
234
|
+
const hint = suggest(firstLine.chartType, ["swot"]);
|
|
235
|
+
if (hint) msg += `. ${hint}`;
|
|
236
|
+
return fail(lineNumber, msg);
|
|
237
|
+
}
|
|
238
|
+
if (firstLine.title) {
|
|
239
|
+
result.title = firstLine.title;
|
|
240
|
+
result.titleLineNumber = lineNumber;
|
|
241
|
+
}
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const indent = measureIndent(line);
|
|
246
|
+
if (currentTagGroup && !contentStarted) {
|
|
247
|
+
if (indent > 0) {
|
|
248
|
+
const { text, isDefault } = stripDefaultModifier(trimmed);
|
|
249
|
+
const { label, color } = extractColor(
|
|
250
|
+
text,
|
|
251
|
+
palette,
|
|
252
|
+
diagnostics,
|
|
253
|
+
lineNumber
|
|
254
|
+
);
|
|
255
|
+
if (isDefault || currentTagGroup.entries.length === 0) {
|
|
256
|
+
currentTagGroup.defaultValue = label;
|
|
257
|
+
}
|
|
258
|
+
currentTagGroup.entries.push({
|
|
259
|
+
value: label,
|
|
260
|
+
color: color ?? AUTO_TAG_COLOR_SENTINEL,
|
|
261
|
+
lineNumber
|
|
262
|
+
});
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
currentTagGroup = null;
|
|
266
|
+
}
|
|
267
|
+
if (indent === 0) {
|
|
268
|
+
if (!contentStarted) {
|
|
269
|
+
const heading = matchTagBlockHeading(trimmed);
|
|
270
|
+
if (heading) {
|
|
271
|
+
currentTagGroup = {
|
|
272
|
+
name: heading.name,
|
|
273
|
+
...heading.alias !== void 0 && { alias: heading.alias },
|
|
274
|
+
entries: [],
|
|
275
|
+
lineNumber
|
|
276
|
+
};
|
|
277
|
+
if (heading.alias) {
|
|
278
|
+
metaAliasMap.set(
|
|
279
|
+
normalizeName(heading.alias),
|
|
280
|
+
tagAttrKey(heading.name)
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
metaAliasMap.set(
|
|
284
|
+
normalizeName(heading.name),
|
|
285
|
+
tagAttrKey(heading.name)
|
|
286
|
+
);
|
|
287
|
+
tagGroups.push(currentTagGroup);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const space = trimmed.search(/\s/);
|
|
292
|
+
const word = space < 0 ? trimmed : trimmed.slice(0, space);
|
|
293
|
+
const rest = space < 0 ? "" : trimmed.slice(space + 1).trim();
|
|
294
|
+
const keyword = word.toLowerCase();
|
|
295
|
+
if (SECTION_KEYS.includes(keyword)) {
|
|
296
|
+
contentStarted = true;
|
|
297
|
+
currentItem = null;
|
|
298
|
+
const key = keyword;
|
|
299
|
+
const existing = sectionsByKey.get(key);
|
|
300
|
+
if (existing) {
|
|
301
|
+
report(SWOT_DX.DUPLICATE_SECTION, lineNumber, { section: keyword });
|
|
302
|
+
currentSection = existing;
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
const { label, color } = extractColor(
|
|
306
|
+
`${keyword} ${rest}`.trim(),
|
|
307
|
+
palette,
|
|
308
|
+
diagnostics,
|
|
309
|
+
lineNumber
|
|
310
|
+
);
|
|
311
|
+
const defaults = SECTION_DEFAULTS.find((s) => s.key === key);
|
|
312
|
+
const written = peelQuotedName(label.slice(keyword.length).trim());
|
|
313
|
+
currentSection = {
|
|
314
|
+
key,
|
|
315
|
+
label: written || defaults.label,
|
|
316
|
+
color: color ?? defaultColor(defaults.color, lineNumber),
|
|
317
|
+
items: [],
|
|
318
|
+
lineNumber
|
|
319
|
+
};
|
|
320
|
+
sectionsByKey.set(key, currentSection);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (BOOLEAN_OPTIONS.has(keyword) && !rest) {
|
|
324
|
+
options[keyword] = "on";
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (VALUE_OPTIONS.has(keyword) && rest) {
|
|
328
|
+
options[keyword] = rest;
|
|
329
|
+
if (keyword === "active-tag") activeTagLine = lineNumber;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (keyword === "x-label" || keyword === "y-label") {
|
|
333
|
+
const parts = rest.split(",").map((s) => s.trim()).filter(Boolean);
|
|
334
|
+
if (parts.length === 2) {
|
|
335
|
+
const pair = [parts[0], parts[1]];
|
|
336
|
+
if (keyword === "x-label") result.xLabels = pair;
|
|
337
|
+
else result.yLabels = pair;
|
|
338
|
+
} else {
|
|
339
|
+
warn(
|
|
340
|
+
lineNumber,
|
|
341
|
+
`'${keyword}' takes two labels, like '${keyword} A, B'. Using the defaults.`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
report(SWOT_DX.UNKNOWN_SECTION, lineNumber, {
|
|
347
|
+
word,
|
|
348
|
+
nearest: nearestSection(word)
|
|
349
|
+
});
|
|
350
|
+
currentSection = null;
|
|
351
|
+
currentItem = null;
|
|
352
|
+
contentStarted = true;
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (!currentSection) {
|
|
356
|
+
if (result.error === null) {
|
|
357
|
+
report(SWOT_DX.ORPHAN_ITEM, lineNumber, { item: trimmed });
|
|
358
|
+
}
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
if (currentItem && indent > itemIndent) {
|
|
362
|
+
if (detailIndent === null || indent <= detailIndent) {
|
|
363
|
+
currentItem.details.push(trimmed);
|
|
364
|
+
currentItem.endLineNumber = lineNumber;
|
|
365
|
+
detailIndent = indent;
|
|
366
|
+
} else {
|
|
367
|
+
report(SWOT_DX.TOO_DEEP, lineNumber, { item: trimmed });
|
|
368
|
+
}
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
itemCounter++;
|
|
372
|
+
currentItem = parseItemLine(
|
|
373
|
+
trimmed,
|
|
374
|
+
lineNumber,
|
|
375
|
+
itemCounter,
|
|
376
|
+
metaAliasMap,
|
|
377
|
+
diagnostics
|
|
378
|
+
);
|
|
379
|
+
itemIndent = indent;
|
|
380
|
+
detailIndent = null;
|
|
381
|
+
currentSection.items.push(currentItem);
|
|
382
|
+
}
|
|
383
|
+
const tagValueSets = new Map(
|
|
384
|
+
tagGroups.map((group) => [
|
|
385
|
+
tagAttrKey(group.name),
|
|
386
|
+
new Set(group.entries.map((e) => e.value.toLowerCase()))
|
|
387
|
+
])
|
|
388
|
+
);
|
|
389
|
+
result.sections = SECTION_DEFAULTS.map((defaults) => {
|
|
390
|
+
const section = sectionsByKey.get(defaults.key);
|
|
391
|
+
if (section) return section;
|
|
392
|
+
return {
|
|
393
|
+
key: defaults.key,
|
|
394
|
+
label: defaults.label,
|
|
395
|
+
color: defaultColor(defaults.color, 1),
|
|
396
|
+
items: [],
|
|
397
|
+
lineNumber: 0
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
for (const section of result.sections) {
|
|
401
|
+
if (section.items.length === 0) {
|
|
402
|
+
report(SWOT_DX.EMPTY_SECTION, section.lineNumber || 1, {
|
|
403
|
+
section: section.key
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
for (const item of section.items) {
|
|
407
|
+
for (const [tagKey, tagValue] of Object.entries(item.tags)) {
|
|
408
|
+
const groupKey = metaAliasMap.get(tagKey.toLowerCase()) ?? tagKey;
|
|
409
|
+
const valid = tagValueSets.get(groupKey);
|
|
410
|
+
if (valid && !valid.has(tagValue.toLowerCase())) {
|
|
411
|
+
const entries = tagGroups.find((g) => tagAttrKey(g.name) === groupKey)?.entries.map((e) => e.value);
|
|
412
|
+
let msg = `Unknown tag value "${tagValue}" for group "${groupKey}"`;
|
|
413
|
+
const hint = entries ? suggest(tagValue, entries) : null;
|
|
414
|
+
if (hint) msg += `. ${hint}`;
|
|
415
|
+
warn(item.lineNumber, msg);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
finalizeAutoTagColors(tagGroups, palette);
|
|
421
|
+
validateTagGroupNames(tagGroups, warn, (line, msg) => {
|
|
422
|
+
const diag = makeDgmoError(line, msg);
|
|
423
|
+
diagnostics.push(diag);
|
|
424
|
+
result.error ??= formatDgmoError(diag);
|
|
425
|
+
});
|
|
426
|
+
const activeTagWarning = activeTagNoMatchMessage(
|
|
427
|
+
options["active-tag"],
|
|
428
|
+
tagGroups
|
|
429
|
+
);
|
|
430
|
+
if (activeTagWarning) {
|
|
431
|
+
warn(activeTagLine || 1, activeTagWarning, "W_ACTIVE_TAG_NO_MATCH");
|
|
432
|
+
}
|
|
433
|
+
return result;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export {
|
|
437
|
+
SWOT_DIAGNOSTICS,
|
|
438
|
+
parseSwot
|
|
439
|
+
};
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
tagAttrKey,
|
|
15
15
|
validateTagGroupNames,
|
|
16
16
|
validateTagValues
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KW3CC7SB.js";
|
|
18
18
|
import {
|
|
19
19
|
MINDMAP_REGISTRY,
|
|
20
20
|
OPTION_NOCOLON_RE,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
tryParseSharedOption,
|
|
27
27
|
warnUnknownMetaKeys,
|
|
28
28
|
withTagAliases
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-RFGQDIOI.js";
|
|
30
30
|
import {
|
|
31
31
|
formatDgmoError,
|
|
32
32
|
makeDgmoError,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractDatePrefix,
|
|
3
3
|
parseTimelineDate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O3HRF25Z.js";
|
|
5
5
|
import {
|
|
6
6
|
makeYearContext,
|
|
7
7
|
parseDateToken,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tagAttrKey,
|
|
17
17
|
validateTagGroupNames,
|
|
18
18
|
validateTagValues
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KW3CC7SB.js";
|
|
20
20
|
import {
|
|
21
21
|
EVENT_LINE_REGISTRY,
|
|
22
22
|
extractColor,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
tryParseSharedOption,
|
|
28
28
|
warnUnknownMetaKeys,
|
|
29
29
|
withTagAliases
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-RFGQDIOI.js";
|
|
31
31
|
import {
|
|
32
32
|
emit,
|
|
33
33
|
formatDgmoError,
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COLLAPSE_BAR_HEIGHT,
|
|
3
|
+
EDGE_DASH
|
|
4
|
+
} from "./chunk-WH6E6SHC.js";
|
|
5
|
+
import {
|
|
6
|
+
measureText
|
|
7
|
+
} from "./chunk-PU5X3P3T.js";
|
|
8
|
+
|
|
9
|
+
// src/utils/card.ts
|
|
10
|
+
function renderNodeCard(container, opts) {
|
|
11
|
+
const rect = container.append("rect").attr("x", 0).attr("y", 0).attr("width", opts.width).attr("height", opts.height).attr("rx", opts.rx).attr("fill", opts.fill).attr("stroke", opts.stroke).attr("stroke-width", opts.strokeWidth);
|
|
12
|
+
if (opts.dashed) {
|
|
13
|
+
rect.attr("stroke-dasharray", EDGE_DASH);
|
|
14
|
+
}
|
|
15
|
+
const labelLines = opts.labelLines;
|
|
16
|
+
if (labelLines && labelLines.length > 1) {
|
|
17
|
+
const lineH = opts.labelFontSize * 1.2;
|
|
18
|
+
const midY = opts.headerHeight / 2;
|
|
19
|
+
const startY = midY - (labelLines.length - 1) * lineH / 2;
|
|
20
|
+
for (let li = 0; li < labelLines.length; li++) {
|
|
21
|
+
container.append("text").attr("x", opts.width / 2).attr("y", startY + li * lineH).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", opts.labelColor).attr("font-size", opts.labelFontSize).attr("font-weight", "bold").text(labelLines[li]);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
container.append("text").attr("x", opts.width / 2).attr("y", opts.headerHeight / 2).attr("dominant-baseline", "central").attr("text-anchor", "middle").attr("fill", opts.labelColor).attr("font-size", opts.labelFontSize).attr("font-weight", "bold").text(labelLines?.[0] ?? opts.label);
|
|
25
|
+
}
|
|
26
|
+
const meta = opts.meta;
|
|
27
|
+
if (!meta || meta.rows.length === 0) return;
|
|
28
|
+
container.append("line").attr("x1", 0).attr("y1", opts.headerHeight).attr("x2", opts.width).attr("y2", opts.headerHeight).attr("stroke", meta.separatorColor).attr("stroke-opacity", 0.3).attr("stroke-width", 1);
|
|
29
|
+
const keyX = meta.keyX ?? 10;
|
|
30
|
+
const maxKeyWidth = Math.max(
|
|
31
|
+
...meta.rows.map(([key]) => measureText(`${key}: `, meta.fontSize))
|
|
32
|
+
);
|
|
33
|
+
const valueX = keyX + maxKeyWidth;
|
|
34
|
+
const metaStartY = opts.headerHeight + meta.separatorGap + meta.fontSize;
|
|
35
|
+
for (let i = 0; i < meta.rows.length; i++) {
|
|
36
|
+
const [displayKey, value] = meta.rows[i];
|
|
37
|
+
const rowY = metaStartY + i * meta.lineHeight;
|
|
38
|
+
container.append("text").attr("x", keyX).attr("y", rowY).attr("fill", meta.textColor).attr("font-size", meta.fontSize).text(`${displayKey}: `);
|
|
39
|
+
container.append("text").attr("x", valueX).attr("y", rowY).attr("fill", meta.textColor).attr("font-size", meta.fontSize).text(value);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function collapseBarHeight(scale) {
|
|
43
|
+
if (scale === void 0) return COLLAPSE_BAR_HEIGHT;
|
|
44
|
+
if (typeof scale === "number") return COLLAPSE_BAR_HEIGHT * scale;
|
|
45
|
+
return scale.structural(COLLAPSE_BAR_HEIGHT);
|
|
46
|
+
}
|
|
47
|
+
function renderCollapseBar(container, opts) {
|
|
48
|
+
const x = opts.x ?? 0;
|
|
49
|
+
const y = opts.y ?? 0;
|
|
50
|
+
const barHeight = collapseBarHeight(opts.scale);
|
|
51
|
+
container.append("clipPath").attr("id", opts.clipId).append("rect").attr("x", x).attr("y", y).attr("width", opts.width).attr("height", opts.height).attr("rx", opts.rx);
|
|
52
|
+
const bar = container.append("rect").attr("x", x).attr("y", y + opts.height - barHeight).attr("width", opts.width).attr("height", barHeight).attr("fill", opts.fill).attr("clip-path", `url(#${opts.clipId})`);
|
|
53
|
+
if (!opts.expanded) {
|
|
54
|
+
return bar.attr("class", `${opts.prefix}-collapse-bar dgmo-collapse-bar`);
|
|
55
|
+
}
|
|
56
|
+
return bar.attr(
|
|
57
|
+
"class",
|
|
58
|
+
`${opts.prefix}-collapse-bar-preview dgmo-collapse-bar-preview`
|
|
59
|
+
).attr("opacity", 0).attr("pointer-events", "none");
|
|
60
|
+
}
|
|
61
|
+
var TOGGLE_ATTRS = [
|
|
62
|
+
"data-node-toggle",
|
|
63
|
+
"data-group-toggle",
|
|
64
|
+
"data-section-toggle",
|
|
65
|
+
"data-note-toggle"
|
|
66
|
+
];
|
|
67
|
+
var COLLAPSE_PREVIEW_HOVER_OPACITY = 0.35;
|
|
68
|
+
function toggleCueCss(theme = "light") {
|
|
69
|
+
const t = TOGGLE_ATTRS.map((a) => `[${a}]`);
|
|
70
|
+
const on = (suffix) => t.map((s) => s + suffix).join(",");
|
|
71
|
+
const step = theme === "dark" ? 1.2 : 0.95;
|
|
72
|
+
return `${t.join(",")}{cursor:pointer}${on(":hover>rect:first-child")},${on(":hover>path:first-child")}{filter:brightness(${step})}${on(":hover>rect[fill=transparent]:first-child")}{fill:${theme === "dark" ? "#fff" : "#000"};fill-opacity:${theme === "dark" ? 0.08 : 0.05}}.dgmo-collapse-bar-preview{transition:opacity 120ms ease-out}${on(":hover>.dgmo-collapse-bar-preview")}{opacity:${COLLAPSE_PREVIEW_HOVER_OPACITY}}${on(":focus-visible")}{outline:2px solid currentColor;outline-offset:2px}@media (prefers-reduced-motion:reduce){.dgmo-collapse-bar-preview{transition:none}}`;
|
|
73
|
+
}
|
|
74
|
+
function injectToggleCue(svg, theme) {
|
|
75
|
+
if (!svg || !TOGGLE_ATTRS.some((a) => svg.includes(`${a}=`))) return svg;
|
|
76
|
+
const open = svg.match(/<svg\b[^>]*>/);
|
|
77
|
+
if (open?.index == null) return svg;
|
|
78
|
+
const at = open.index + open[0].length;
|
|
79
|
+
const css = toggleCueCss(theme);
|
|
80
|
+
if (svg.startsWith("<style>", at)) {
|
|
81
|
+
const end = svg.indexOf("</style>", at);
|
|
82
|
+
if (end !== -1) return `${svg.slice(0, end)}${css}${svg.slice(end)}`;
|
|
83
|
+
}
|
|
84
|
+
return `${svg.slice(0, at)}<style>${css}</style>${svg.slice(at)}`;
|
|
85
|
+
}
|
|
86
|
+
var TOGGLE_OPEN_TAG = /<[a-zA-Z][\w:-]*\b(?=[^>]*\sdata-(?:node|group|section|note)-toggle=)[^>]*>/g;
|
|
87
|
+
var PREVIEW_BAR = /<rect\b[^>]*\bdgmo-collapse-bar-preview\b[^>]*>(?:<\/rect>)?/g;
|
|
88
|
+
function stripFoldAffordance(svg) {
|
|
89
|
+
if (!TOGGLE_ATTRS.some((a) => svg.includes(`${a}=`))) return svg;
|
|
90
|
+
const clipIds = /* @__PURE__ */ new Set();
|
|
91
|
+
let out = svg.replace(PREVIEW_BAR, (rect) => {
|
|
92
|
+
const id = /clip-path="url\(#([^)"]+)\)"/.exec(rect)?.[1];
|
|
93
|
+
if (id) clipIds.add(id);
|
|
94
|
+
return "";
|
|
95
|
+
});
|
|
96
|
+
for (const id of clipIds) {
|
|
97
|
+
if (out.includes(`url(#${id})`)) continue;
|
|
98
|
+
const esc = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
99
|
+
out = out.replace(
|
|
100
|
+
new RegExp(`<clipPath\\b[^>]*\\sid="${esc}"[^>]*>[\\s\\S]*?</clipPath>`),
|
|
101
|
+
""
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return out.replace(
|
|
105
|
+
TOGGLE_OPEN_TAG,
|
|
106
|
+
(tag) => tag.replace(
|
|
107
|
+
/\s(?:role="button"|aria-expanded="[^"]*"|tabindex="[^"]*"|cursor="[^"]*")/g,
|
|
108
|
+
""
|
|
109
|
+
).replace(
|
|
110
|
+
/(\saria-label=")(?:Collapse|Expand) (\w)/,
|
|
111
|
+
(_m, head, first) => head + first.toUpperCase()
|
|
112
|
+
).replace(/(\sstyle=")([^"]*)"/, (_m, head, body) => {
|
|
113
|
+
const rest = body.replace(/\s*cursor\s*:\s*[^;"]*;?/g, "").trim();
|
|
114
|
+
return rest ? `${head}${rest}"` : "";
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
renderNodeCard,
|
|
121
|
+
collapseBarHeight,
|
|
122
|
+
renderCollapseBar,
|
|
123
|
+
toggleCueCss,
|
|
124
|
+
injectToggleCue,
|
|
125
|
+
stripFoldAffordance
|
|
126
|
+
};
|