mermaid 13.0.0-alpha.3 → 13.0.0-beta.5
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 +28 -11
- package/THIRD_PARTY_NOTICES +0 -126
- package/dist/analyser.d.ts +58 -0
- package/dist/analyser.js +160 -0
- package/dist/analysis-cache.d.ts +63 -0
- package/dist/analysis-cache.js +54 -0
- package/dist/api-types.d.ts +137 -0
- package/dist/api-types.js +1 -0
- package/dist/api.d.ts +23 -130
- package/dist/api.js +161 -602
- package/dist/ascii.d.ts +5 -4
- package/dist/ascii.js +20 -0
- package/dist/block-pass.d.ts +144 -0
- package/dist/block-pass.js +460 -0
- package/dist/chunks/chunk-34CNSMZO.mjs +2 -0
- package/dist/chunks/chunk-34CNSMZO.mjs.map +1 -0
- package/dist/chunks/chunk-35VDXA3F.mjs +3 -0
- package/dist/chunks/chunk-35VDXA3F.mjs.map +1 -0
- package/dist/chunks/chunk-3BVCMOYJ.mjs +3 -0
- package/dist/chunks/chunk-3BVCMOYJ.mjs.map +1 -0
- package/dist/chunks/chunk-3MYLJHPW.mjs +2 -0
- package/dist/chunks/chunk-3MYLJHPW.mjs.map +1 -0
- package/dist/chunks/chunk-4Y6EKTOM.mjs +2 -0
- package/dist/chunks/chunk-4Y6EKTOM.mjs.map +1 -0
- package/dist/chunks/chunk-54X7EXAD.mjs +2 -0
- package/dist/chunks/chunk-54X7EXAD.mjs.map +1 -0
- package/dist/chunks/chunk-57JERKFE.mjs +2 -0
- package/dist/chunks/chunk-57JERKFE.mjs.map +1 -0
- package/dist/chunks/chunk-5P3W53PJ.mjs +2 -0
- package/dist/chunks/chunk-5P3W53PJ.mjs.map +1 -0
- package/dist/chunks/chunk-5SJDMHSY.mjs +2 -0
- package/dist/chunks/chunk-5SJDMHSY.mjs.map +1 -0
- package/dist/chunks/chunk-63EMOOT5.mjs +3 -0
- package/dist/chunks/chunk-63EMOOT5.mjs.map +1 -0
- package/dist/chunks/chunk-65NV4M6T.mjs +2 -0
- package/dist/chunks/chunk-65NV4M6T.mjs.map +1 -0
- package/dist/chunks/chunk-6MLWUK4R.mjs +11 -0
- package/dist/chunks/chunk-6MLWUK4R.mjs.map +1 -0
- package/dist/chunks/chunk-7445R5LN.mjs +3 -0
- package/dist/chunks/chunk-7445R5LN.mjs.map +1 -0
- package/dist/chunks/chunk-7GDL2TWK.mjs +5 -0
- package/dist/chunks/chunk-7GDL2TWK.mjs.map +1 -0
- package/dist/chunks/chunk-7UX6Z54Y.mjs +2 -0
- package/dist/chunks/chunk-7UX6Z54Y.mjs.map +1 -0
- package/dist/chunks/chunk-A5PG4H2A.mjs +2 -0
- package/dist/chunks/chunk-A5PG4H2A.mjs.map +1 -0
- package/dist/chunks/chunk-AA5A5TTE.mjs +2 -0
- package/dist/chunks/chunk-AA5A5TTE.mjs.map +1 -0
- package/dist/chunks/chunk-ATRV5TEE.mjs +2 -0
- package/dist/chunks/chunk-ATRV5TEE.mjs.map +1 -0
- package/dist/chunks/chunk-B4PZC3M4.mjs +3 -0
- package/dist/chunks/chunk-B4PZC3M4.mjs.map +1 -0
- package/dist/chunks/chunk-BIV33NIH.mjs +3 -0
- package/dist/chunks/chunk-BIV33NIH.mjs.map +1 -0
- package/dist/chunks/chunk-BNFS7F7S.mjs +5 -0
- package/dist/chunks/chunk-BNFS7F7S.mjs.map +1 -0
- package/dist/chunks/chunk-BT2K77IK.mjs +3 -0
- package/dist/chunks/chunk-BT2K77IK.mjs.map +1 -0
- package/dist/chunks/chunk-BVSQMGIZ.mjs +2 -0
- package/dist/chunks/chunk-BVSQMGIZ.mjs.map +1 -0
- package/dist/chunks/chunk-C4SDPANP.mjs +5 -0
- package/dist/chunks/chunk-C4SDPANP.mjs.map +1 -0
- package/dist/chunks/chunk-C6TDUBRR.mjs +7 -0
- package/dist/chunks/chunk-C6TDUBRR.mjs.map +1 -0
- package/dist/chunks/chunk-CCM24AVG.mjs +2 -0
- package/dist/chunks/chunk-CCM24AVG.mjs.map +1 -0
- package/dist/chunks/chunk-CHEOV6RV.mjs +3 -0
- package/dist/chunks/chunk-CHEOV6RV.mjs.map +1 -0
- package/dist/chunks/chunk-CIRJ4NYK.mjs +2 -0
- package/dist/chunks/chunk-CIRJ4NYK.mjs.map +1 -0
- package/dist/chunks/chunk-CMVAKZHL.mjs +7 -0
- package/dist/chunks/chunk-CMVAKZHL.mjs.map +1 -0
- package/dist/chunks/chunk-CPJV4WUF.mjs +2 -0
- package/dist/chunks/{chunk-YKQIHLV5.mjs.map → chunk-CPJV4WUF.mjs.map} +1 -1
- package/dist/chunks/chunk-DLU4BZ6H.mjs +2 -0
- package/dist/chunks/chunk-DLU4BZ6H.mjs.map +1 -0
- package/dist/chunks/chunk-DPSPHODO.mjs +2 -0
- package/dist/chunks/chunk-DPSPHODO.mjs.map +1 -0
- package/dist/chunks/chunk-EAGNTERD.mjs +2 -0
- package/dist/chunks/chunk-EAGNTERD.mjs.map +1 -0
- package/dist/chunks/chunk-EK4S7EXT.mjs +2 -0
- package/dist/chunks/chunk-EK4S7EXT.mjs.map +1 -0
- package/dist/chunks/chunk-ESGJI3CB.mjs +2 -0
- package/dist/chunks/chunk-ESGJI3CB.mjs.map +1 -0
- package/dist/chunks/chunk-EVRF73VT.mjs +3 -0
- package/dist/chunks/chunk-EVRF73VT.mjs.map +1 -0
- package/dist/chunks/chunk-EVZ53CQP.mjs +2 -0
- package/dist/chunks/chunk-EVZ53CQP.mjs.map +1 -0
- package/dist/chunks/chunk-F2VKDTOW.mjs +1 -0
- package/dist/chunks/chunk-F6KJEEFC.mjs +2 -0
- package/dist/chunks/chunk-F6KJEEFC.mjs.map +1 -0
- package/dist/chunks/chunk-FC5BAB6Y.mjs +4 -0
- package/dist/chunks/chunk-FC5BAB6Y.mjs.map +1 -0
- package/dist/chunks/chunk-FGPTI5LN.mjs +2 -0
- package/dist/chunks/chunk-FGPTI5LN.mjs.map +1 -0
- package/dist/chunks/chunk-FVBLN5SX.mjs +2 -0
- package/dist/chunks/chunk-FVBLN5SX.mjs.map +1 -0
- package/dist/chunks/chunk-FYP52GV4.mjs +3 -0
- package/dist/chunks/chunk-FYP52GV4.mjs.map +1 -0
- package/dist/chunks/chunk-G7JG3T44.mjs +8 -0
- package/dist/chunks/chunk-G7JG3T44.mjs.map +1 -0
- package/dist/chunks/chunk-GYTZZAWH.mjs +6 -0
- package/dist/chunks/chunk-GYTZZAWH.mjs.map +1 -0
- package/dist/chunks/chunk-GZ4G72AU.mjs +2 -0
- package/dist/chunks/chunk-GZ4G72AU.mjs.map +1 -0
- package/dist/chunks/chunk-HDD66BKK.mjs +2 -0
- package/dist/chunks/chunk-HDD66BKK.mjs.map +1 -0
- package/dist/chunks/chunk-HHLXJJ7H.mjs +2 -0
- package/dist/chunks/chunk-HHLXJJ7H.mjs.map +1 -0
- package/dist/chunks/chunk-HZQAGUYT.mjs +11 -0
- package/dist/chunks/chunk-HZQAGUYT.mjs.map +1 -0
- package/dist/chunks/chunk-IY436MEC.mjs +2 -0
- package/dist/chunks/chunk-IY436MEC.mjs.map +1 -0
- package/dist/chunks/chunk-J4P53XG6.mjs +2 -0
- package/dist/chunks/chunk-J4P53XG6.mjs.map +1 -0
- package/dist/chunks/chunk-JUCDZ7CP.mjs +3 -0
- package/dist/chunks/chunk-JUCDZ7CP.mjs.map +1 -0
- package/dist/chunks/chunk-JVLFSOHI.mjs +3 -0
- package/dist/chunks/chunk-JVLFSOHI.mjs.map +1 -0
- package/dist/chunks/chunk-JXHIG6FZ.mjs +2 -0
- package/dist/chunks/chunk-JXHIG6FZ.mjs.map +1 -0
- package/dist/chunks/{chunk-53XKVPPJ.mjs → chunk-K6GRKAXG.mjs} +1 -1
- package/dist/chunks/chunk-K6GRKAXG.mjs.map +1 -0
- package/dist/chunks/chunk-LEQ57ZOM.mjs +6 -0
- package/dist/chunks/chunk-LEQ57ZOM.mjs.map +1 -0
- package/dist/chunks/chunk-M3NSD6ZW.mjs +3 -0
- package/dist/chunks/chunk-M3NSD6ZW.mjs.map +1 -0
- package/dist/chunks/chunk-M7Z3J4NO.mjs +2 -0
- package/dist/chunks/chunk-M7Z3J4NO.mjs.map +1 -0
- package/dist/chunks/chunk-MNLDZQNB.mjs +3 -0
- package/dist/chunks/chunk-MNLDZQNB.mjs.map +1 -0
- package/dist/chunks/chunk-MOVLMRFC.mjs +2 -0
- package/dist/chunks/chunk-MOVLMRFC.mjs.map +1 -0
- package/dist/chunks/chunk-MPMWZO6R.mjs +6 -0
- package/dist/chunks/chunk-MPMWZO6R.mjs.map +1 -0
- package/dist/chunks/chunk-NGJUUS6G.mjs +7 -0
- package/dist/chunks/chunk-NGJUUS6G.mjs.map +1 -0
- package/dist/chunks/chunk-NKB7NH64.mjs +2 -0
- package/dist/chunks/chunk-NKB7NH64.mjs.map +1 -0
- package/dist/chunks/chunk-NNXXXZOH.mjs +2 -0
- package/dist/chunks/chunk-NNXXXZOH.mjs.map +1 -0
- package/dist/chunks/chunk-OIW2ACTI.mjs +2 -0
- package/dist/chunks/chunk-OIW2ACTI.mjs.map +1 -0
- package/dist/chunks/chunk-OKL6T5MF.mjs +2 -0
- package/dist/chunks/chunk-OKL6T5MF.mjs.map +1 -0
- package/dist/chunks/chunk-ON3DSIC6.mjs +2 -0
- package/dist/chunks/chunk-ON3DSIC6.mjs.map +1 -0
- package/dist/chunks/chunk-OTDD3VKD.mjs +2 -0
- package/dist/chunks/chunk-OTDD3VKD.mjs.map +1 -0
- package/dist/chunks/chunk-P4TOP4AF.mjs +4 -0
- package/dist/chunks/chunk-P4TOP4AF.mjs.map +1 -0
- package/dist/chunks/chunk-P7ASZ2DF.mjs +2 -0
- package/dist/chunks/chunk-P7ASZ2DF.mjs.map +1 -0
- package/dist/chunks/chunk-PFAC3TV3.mjs +2 -0
- package/dist/chunks/chunk-PFAC3TV3.mjs.map +1 -0
- package/dist/chunks/chunk-PGLDPGVR.mjs +9 -0
- package/dist/chunks/chunk-PGLDPGVR.mjs.map +1 -0
- package/dist/chunks/chunk-PY4MJHBX.mjs +7 -0
- package/dist/chunks/chunk-PY4MJHBX.mjs.map +1 -0
- package/dist/chunks/chunk-PZNE6TK6.mjs +2 -0
- package/dist/chunks/chunk-PZNE6TK6.mjs.map +1 -0
- package/dist/chunks/chunk-Q2TSECSK.mjs +2 -0
- package/dist/chunks/chunk-Q2TSECSK.mjs.map +1 -0
- package/dist/chunks/chunk-QGV44AQG.mjs +2 -0
- package/dist/chunks/chunk-QGV44AQG.mjs.map +1 -0
- package/dist/chunks/chunk-QNCYRYSM.mjs +2 -0
- package/dist/chunks/chunk-QNCYRYSM.mjs.map +1 -0
- package/dist/chunks/chunk-QSOECHY3.mjs +2 -0
- package/dist/chunks/chunk-QSOECHY3.mjs.map +1 -0
- package/dist/chunks/chunk-R3FKHKB6.mjs +3 -0
- package/dist/chunks/chunk-R3FKHKB6.mjs.map +1 -0
- package/dist/chunks/chunk-RGYOWKGP.mjs +3 -0
- package/dist/chunks/chunk-RGYOWKGP.mjs.map +1 -0
- package/dist/chunks/chunk-RSPJTOPF.mjs +2 -0
- package/dist/chunks/chunk-RSPJTOPF.mjs.map +1 -0
- package/dist/chunks/chunk-S4VYITV3.mjs +2 -0
- package/dist/chunks/chunk-S4VYITV3.mjs.map +1 -0
- package/dist/chunks/chunk-SASGMFFB.mjs +2 -0
- package/dist/chunks/chunk-SASGMFFB.mjs.map +1 -0
- package/dist/chunks/chunk-SKTDVG3X.mjs +6 -0
- package/dist/chunks/chunk-SKTDVG3X.mjs.map +1 -0
- package/dist/chunks/chunk-SRYATSMJ.mjs +3 -0
- package/dist/chunks/chunk-SRYATSMJ.mjs.map +1 -0
- package/dist/chunks/chunk-SUH3QCTV.mjs +2 -0
- package/dist/chunks/chunk-SUH3QCTV.mjs.map +1 -0
- package/dist/chunks/chunk-TEKRHUSC.mjs +9 -0
- package/dist/chunks/chunk-TEKRHUSC.mjs.map +1 -0
- package/dist/chunks/chunk-TI27NBVQ.mjs +2 -0
- package/dist/chunks/chunk-TI27NBVQ.mjs.map +1 -0
- package/dist/chunks/chunk-TNQLTQZT.mjs +2 -0
- package/dist/chunks/chunk-TNQLTQZT.mjs.map +1 -0
- package/dist/chunks/chunk-TOA72OFK.mjs +5 -0
- package/dist/chunks/chunk-TOA72OFK.mjs.map +1 -0
- package/dist/chunks/chunk-TRXZHDEJ.mjs +2 -0
- package/dist/chunks/chunk-TRXZHDEJ.mjs.map +1 -0
- package/dist/chunks/chunk-VYBXWFSY.mjs +2 -0
- package/dist/chunks/chunk-VYBXWFSY.mjs.map +1 -0
- package/dist/chunks/chunk-W3OIJRHI.mjs +2 -0
- package/dist/chunks/chunk-W3OIJRHI.mjs.map +1 -0
- package/dist/chunks/chunk-W6UVS5YO.mjs +2 -0
- package/dist/chunks/chunk-W6UVS5YO.mjs.map +1 -0
- package/dist/chunks/chunk-WEAEHFAN.mjs +4 -0
- package/dist/chunks/chunk-WEAEHFAN.mjs.map +1 -0
- package/dist/chunks/chunk-WGSYFIUA.mjs +3 -0
- package/dist/chunks/chunk-WGSYFIUA.mjs.map +1 -0
- package/dist/chunks/chunk-WHZNT2D3.mjs +2 -0
- package/dist/chunks/chunk-WHZNT2D3.mjs.map +1 -0
- package/dist/chunks/chunk-WIESXAR7.mjs +2 -0
- package/dist/chunks/chunk-WIESXAR7.mjs.map +1 -0
- package/dist/chunks/chunk-WJKVYSQH.mjs +9 -0
- package/dist/chunks/chunk-WJKVYSQH.mjs.map +1 -0
- package/dist/chunks/chunk-WMW43FL7.mjs +2 -0
- package/dist/chunks/chunk-WMW43FL7.mjs.map +1 -0
- package/dist/chunks/chunk-X4QTHGQU.mjs +28 -0
- package/dist/chunks/chunk-X4QTHGQU.mjs.map +1 -0
- package/dist/chunks/chunk-X7RNGEDH.mjs +2 -0
- package/dist/chunks/chunk-X7RNGEDH.mjs.map +1 -0
- package/dist/chunks/chunk-XWDBF7XH.mjs +2 -0
- package/dist/chunks/chunk-XWDBF7XH.mjs.map +1 -0
- package/dist/chunks/chunk-YO3WCZ5G.mjs +2 -0
- package/dist/chunks/chunk-YO3WCZ5G.mjs.map +1 -0
- package/dist/chunks/chunk-YTHSONFA.mjs +2 -0
- package/dist/chunks/chunk-YTHSONFA.mjs.map +1 -0
- package/dist/chunks/{chunk-2G45NV5W.mjs → chunk-YUOTUL2V.mjs} +1 -1
- package/dist/chunks/chunk-YUOTUL2V.mjs.map +1 -0
- package/dist/chunks/chunk-Z5PRIQDH.mjs +3 -0
- package/dist/chunks/chunk-Z5PRIQDH.mjs.map +1 -0
- package/dist/chunks/chunk-ZGESO7SP.mjs +9 -0
- package/dist/chunks/chunk-ZGESO7SP.mjs.map +1 -0
- package/dist/chunks/chunk-ZYHWXZDV.mjs +8 -0
- package/dist/chunks/chunk-ZYHWXZDV.mjs.map +1 -0
- package/dist/chunks/core-layout-compass-index.mjs +1 -1
- package/dist/chunks/core-layout-compass-index.mjs.map +1 -1
- package/dist/chunks/core-layout-grid-index.mjs +2 -0
- package/dist/chunks/core-layout-grid-index.mjs.map +1 -0
- package/dist/chunks/core-layout-swimlane-index.mjs +1 -1
- package/dist/chunks/core-layout-swimlane-index.mjs.map +1 -1
- package/dist/chunks/core-layout-tree-index.mjs +1 -1
- package/dist/chunks/core-layout-tree-index.mjs.map +1 -1
- package/dist/chunks/core-text-font-tables.mjs +2 -0
- package/dist/chunks/core-text-font-tables.mjs.map +1 -0
- package/dist/chunks/core-theme-specs-base.mjs +1 -1
- package/dist/chunks/core-theme-specs-base.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-default.mjs +1 -1
- package/dist/chunks/core-theme-specs-default.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs +1 -1
- package/dist/chunks/core-theme-specs-forest.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo-dark.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs +1 -1
- package/dist/chunks/core-theme-specs-neo.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs +1 -1
- package/dist/chunks/core-theme-specs-neutral.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark-color.mjs.map +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs +1 -1
- package/dist/chunks/core-theme-specs-redux-dark.mjs.map +1 -1
- package/dist/chunks/diagram-agentflow-ascii.mjs +1 -4
- package/dist/chunks/diagram-agentflow-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-agentflow-language.mjs +11 -22
- package/dist/chunks/diagram-agentflow-language.mjs.map +1 -1
- package/dist/chunks/diagram-agentflow.mjs +1 -1
- package/dist/chunks/diagram-agentflow.mjs.map +1 -1
- package/dist/chunks/diagram-architecture-language.mjs +6 -8
- package/dist/chunks/diagram-architecture-language.mjs.map +1 -1
- package/dist/chunks/diagram-architecture.mjs +1 -1
- package/dist/chunks/diagram-architecture.mjs.map +1 -1
- package/dist/chunks/diagram-block-ascii.mjs +1 -3
- package/dist/chunks/diagram-block-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-block-language.mjs +7 -7
- package/dist/chunks/diagram-block-language.mjs.map +1 -1
- package/dist/chunks/diagram-block.mjs +1 -1
- package/dist/chunks/diagram-block.mjs.map +1 -1
- package/dist/chunks/diagram-c4-ascii.mjs +1 -3
- package/dist/chunks/diagram-c4-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-c4-language.mjs +21 -11
- package/dist/chunks/diagram-c4-language.mjs.map +1 -1
- package/dist/chunks/diagram-c4.mjs +1 -1
- package/dist/chunks/diagram-c4.mjs.map +1 -1
- package/dist/chunks/diagram-class-language.mjs +12 -18
- package/dist/chunks/diagram-class-language.mjs.map +1 -1
- package/dist/chunks/diagram-class.mjs +1 -1
- package/dist/chunks/diagram-class.mjs.map +1 -1
- package/dist/chunks/diagram-cynefin-language.mjs +2 -4
- package/dist/chunks/diagram-cynefin-language.mjs.map +1 -1
- package/dist/chunks/diagram-cynefin.mjs +1 -1
- package/dist/chunks/diagram-cynefin.mjs.map +1 -1
- package/dist/chunks/diagram-er-ascii.mjs +1 -4
- package/dist/chunks/diagram-er-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-er-language.mjs +10 -17
- package/dist/chunks/diagram-er-language.mjs.map +1 -1
- package/dist/chunks/diagram-er.mjs +1 -1
- package/dist/chunks/diagram-er.mjs.map +1 -1
- package/dist/chunks/diagram-eventmodeling-language.mjs +7 -9
- package/dist/chunks/diagram-eventmodeling-language.mjs.map +1 -1
- package/dist/chunks/diagram-eventmodeling.mjs +2 -2
- package/dist/chunks/diagram-eventmodeling.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-ascii.mjs +1 -4
- package/dist/chunks/diagram-flowchart-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-lanes.mjs +1 -1
- package/dist/chunks/diagram-flowchart-lanes.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart-language.mjs +9 -20
- package/dist/chunks/diagram-flowchart-language.mjs.map +1 -1
- package/dist/chunks/diagram-flowchart.mjs +1 -1
- package/dist/chunks/diagram-flowchart.mjs.map +1 -1
- package/dist/chunks/diagram-gantt-language.mjs +6 -7
- package/dist/chunks/diagram-gantt-language.mjs.map +1 -1
- package/dist/chunks/diagram-gantt.mjs +1 -1
- package/dist/chunks/diagram-gantt.mjs.map +1 -1
- package/dist/chunks/diagram-gitgraph-language.mjs +9 -11
- package/dist/chunks/diagram-gitgraph-language.mjs.map +1 -1
- package/dist/chunks/diagram-gitgraph.mjs +2 -2
- package/dist/chunks/diagram-gitgraph.mjs.map +1 -1
- package/dist/chunks/diagram-info-ascii.mjs +1 -1
- package/dist/chunks/diagram-info-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-info-language.mjs +1 -3
- package/dist/chunks/diagram-info-language.mjs.map +1 -1
- package/dist/chunks/diagram-info.mjs +1 -1
- package/dist/chunks/diagram-info.mjs.map +1 -1
- package/dist/chunks/diagram-ishikawa-ascii.mjs +3 -3
- package/dist/chunks/diagram-ishikawa-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-ishikawa-language.mjs +7 -7
- package/dist/chunks/diagram-ishikawa-language.mjs.map +1 -1
- package/dist/chunks/diagram-ishikawa.mjs +1 -1
- package/dist/chunks/diagram-ishikawa.mjs.map +1 -1
- package/dist/chunks/diagram-journey-language.mjs +11 -12
- package/dist/chunks/diagram-journey-language.mjs.map +1 -1
- package/dist/chunks/diagram-journey.mjs +1 -1
- package/dist/chunks/diagram-journey.mjs.map +1 -1
- package/dist/chunks/diagram-json-ascii.mjs +2 -0
- package/dist/chunks/diagram-json-ascii.mjs.map +1 -0
- package/dist/chunks/diagram-json-language.mjs +5 -0
- package/dist/chunks/diagram-json-language.mjs.map +1 -0
- package/dist/chunks/diagram-json.mjs +2 -0
- package/dist/chunks/diagram-json.mjs.map +1 -0
- package/dist/chunks/diagram-kanban-ascii.mjs +1 -3
- package/dist/chunks/diagram-kanban-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-kanban-language.mjs +10 -10
- package/dist/chunks/diagram-kanban-language.mjs.map +1 -1
- package/dist/chunks/diagram-kanban.mjs +1 -1
- package/dist/chunks/diagram-kanban.mjs.map +1 -1
- package/dist/chunks/diagram-mindmap-language.mjs +9 -9
- package/dist/chunks/diagram-mindmap-language.mjs.map +1 -1
- package/dist/chunks/diagram-mindmap.mjs +1 -1
- package/dist/chunks/diagram-mindmap.mjs.map +1 -1
- package/dist/chunks/diagram-packet-ascii.mjs +4 -5
- package/dist/chunks/diagram-packet-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-packet-language.mjs +4 -6
- package/dist/chunks/diagram-packet-language.mjs.map +1 -1
- package/dist/chunks/diagram-packet.mjs +2 -1
- package/dist/chunks/diagram-packet.mjs.map +1 -1
- package/dist/chunks/diagram-pie-language.mjs +5 -7
- package/dist/chunks/diagram-pie-language.mjs.map +1 -1
- package/dist/chunks/diagram-pie.mjs +1 -1
- package/dist/chunks/diagram-pie.mjs.map +1 -1
- package/dist/chunks/diagram-quadrant-language.mjs +9 -9
- package/dist/chunks/diagram-quadrant-language.mjs.map +1 -1
- package/dist/chunks/diagram-quadrant.mjs +1 -1
- package/dist/chunks/diagram-quadrant.mjs.map +1 -1
- package/dist/chunks/diagram-radar-language.mjs +7 -10
- package/dist/chunks/diagram-radar-language.mjs.map +1 -1
- package/dist/chunks/diagram-radar.mjs +1 -1
- package/dist/chunks/diagram-radar.mjs.map +1 -1
- package/dist/chunks/diagram-railroad-ascii.mjs +1 -1
- package/dist/chunks/diagram-railroad-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-railroad-language.mjs +7 -11
- package/dist/chunks/diagram-railroad-language.mjs.map +1 -1
- package/dist/chunks/diagram-railroad.mjs +1 -1
- package/dist/chunks/diagram-railroad.mjs.map +1 -1
- package/dist/chunks/diagram-requirement-ascii.mjs +1 -4
- package/dist/chunks/diagram-requirement-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-requirement-language.mjs +7 -11
- package/dist/chunks/diagram-requirement-language.mjs.map +1 -1
- package/dist/chunks/diagram-requirement.mjs +1 -1
- package/dist/chunks/diagram-requirement.mjs.map +1 -1
- package/dist/chunks/diagram-sankey-language.mjs +6 -8
- package/dist/chunks/diagram-sankey-language.mjs.map +1 -1
- package/dist/chunks/diagram-sankey.mjs +1 -1
- package/dist/chunks/diagram-sankey.mjs.map +1 -1
- package/dist/chunks/diagram-sequence-ascii.mjs +3 -3
- package/dist/chunks/diagram-sequence-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-sequence-language.mjs +7 -10
- package/dist/chunks/diagram-sequence-language.mjs.map +1 -1
- package/dist/chunks/diagram-sequence.mjs +1 -1
- package/dist/chunks/diagram-sequence.mjs.map +1 -1
- package/dist/chunks/diagram-state-language.mjs +9 -16
- package/dist/chunks/diagram-state-language.mjs.map +1 -1
- package/dist/chunks/diagram-state.mjs +3 -3
- package/dist/chunks/diagram-state.mjs.map +1 -1
- package/dist/chunks/diagram-timeline-language.mjs +2 -2
- package/dist/chunks/diagram-timeline-language.mjs.map +1 -1
- package/dist/chunks/diagram-timeline.mjs +1 -1
- package/dist/chunks/diagram-timeline.mjs.map +1 -1
- package/dist/chunks/diagram-treemap-language.mjs +9 -12
- package/dist/chunks/diagram-treemap-language.mjs.map +1 -1
- package/dist/chunks/diagram-treemap.mjs +2 -1
- package/dist/chunks/diagram-treemap.mjs.map +1 -1
- package/dist/chunks/diagram-treeview-ascii.mjs +3 -3
- package/dist/chunks/diagram-treeview-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-treeview-language.mjs +4 -6
- package/dist/chunks/diagram-treeview-language.mjs.map +1 -1
- package/dist/chunks/diagram-treeview.mjs +2 -1
- package/dist/chunks/diagram-treeview.mjs.map +1 -1
- package/dist/chunks/diagram-usecase-ascii.mjs +1 -4
- package/dist/chunks/diagram-usecase-ascii.mjs.map +1 -1
- package/dist/chunks/diagram-usecase-language.mjs +7 -10
- package/dist/chunks/diagram-usecase-language.mjs.map +1 -1
- package/dist/chunks/diagram-usecase.mjs +2 -2
- package/dist/chunks/diagram-usecase.mjs.map +1 -1
- package/dist/chunks/diagram-venn-language.mjs +5 -5
- package/dist/chunks/diagram-venn-language.mjs.map +1 -1
- package/dist/chunks/diagram-venn.mjs +1 -1
- package/dist/chunks/diagram-venn.mjs.map +1 -1
- package/dist/chunks/diagram-wardley-language.mjs +5 -8
- package/dist/chunks/diagram-wardley-language.mjs.map +1 -1
- package/dist/chunks/diagram-wardley.mjs +2 -1
- package/dist/chunks/diagram-wardley.mjs.map +1 -1
- package/dist/chunks/diagram-xychart-language.mjs +6 -9
- package/dist/chunks/diagram-xychart-language.mjs.map +1 -1
- package/dist/chunks/diagram-xychart.mjs +1 -1
- package/dist/chunks/diagram-xychart.mjs.map +1 -1
- package/dist/chunks/mermaid-ascii.mjs +1 -1
- package/dist/chunks/mermaid-ascii.mjs.map +1 -1
- package/dist/chunks/mermaid-block-pass.mjs +5 -0
- package/dist/chunks/mermaid-block-pass.mjs.map +1 -0
- package/dist/cli-plugins.d.ts +20 -0
- package/dist/cli-plugins.js +165 -0
- package/dist/cli.js +36 -3
- package/dist/config-snapshot.d.ts +33 -5
- package/dist/config-snapshot.js +70 -18
- package/dist/discovery.d.ts +12 -21
- package/dist/discovery.js +8 -17
- package/dist/dom.d.ts +4 -1
- package/dist/dom.js +40 -7
- package/dist/draw-context.d.ts +42 -0
- package/dist/draw-context.js +324 -0
- package/dist/draw.d.ts +28 -0
- package/dist/draw.js +130 -0
- package/dist/embeds.d.ts +48 -0
- package/dist/embeds.js +57 -0
- package/dist/errors.d.ts +15 -4
- package/dist/errors.js +33 -9
- package/dist/exports.d.ts +3 -1
- package/dist/exports.js +0 -1
- package/dist/generated/detectors.gen.d.ts +2 -0
- package/dist/generated/detectors.gen.js +4 -1
- package/dist/generated/registry.gen.d.ts +1 -1
- package/dist/generated/registry.gen.js +27 -68
- package/dist/index.d.ts +30 -24
- package/dist/index.js +2 -9
- package/dist/measurer.d.ts +2 -0
- package/dist/measurer.js +3 -4
- package/dist/mermaid.esm.min.mjs +4 -3
- package/dist/mermaid.esm.min.mjs.map +1 -1
- package/dist/mermaid.min.js +1 -1
- package/dist/mermaid.min.js.map +1 -1
- package/dist/plugin-queue.js +3 -11
- package/dist/prepare.d.ts +17 -0
- package/dist/prepare.js +145 -0
- package/dist/registry.d.ts +40 -29
- package/dist/registry.js +106 -98
- package/dist/seam.d.ts +12 -21
- package/dist/seam.js +31 -49
- package/dist/session.d.ts +58 -0
- package/dist/session.js +40 -0
- package/dist/slim.d.ts +19 -10
- package/dist/slim.js +57 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +37 -46
- package/dist/bundled.d.ts +0 -2
- package/dist/bundled.js +0 -8
- package/dist/chunks/chunk-2G45NV5W.mjs.map +0 -1
- package/dist/chunks/chunk-2MDKOWUQ.mjs +0 -11
- package/dist/chunks/chunk-2MDKOWUQ.mjs.map +0 -1
- package/dist/chunks/chunk-33QZBPQK.mjs +0 -2
- package/dist/chunks/chunk-33QZBPQK.mjs.map +0 -1
- package/dist/chunks/chunk-4DR73ZXX.mjs +0 -6
- package/dist/chunks/chunk-4DR73ZXX.mjs.map +0 -1
- package/dist/chunks/chunk-4XJZCOJ5.mjs +0 -6
- package/dist/chunks/chunk-4XJZCOJ5.mjs.map +0 -1
- package/dist/chunks/chunk-53XKVPPJ.mjs.map +0 -1
- package/dist/chunks/chunk-66W4K2AQ.mjs +0 -6
- package/dist/chunks/chunk-66W4K2AQ.mjs.map +0 -1
- package/dist/chunks/chunk-7M5U2MEN.mjs +0 -6
- package/dist/chunks/chunk-7M5U2MEN.mjs.map +0 -1
- package/dist/chunks/chunk-7ZMEJOJJ.mjs +0 -7
- package/dist/chunks/chunk-7ZMEJOJJ.mjs.map +0 -1
- package/dist/chunks/chunk-AVHUPARR.mjs +0 -3
- package/dist/chunks/chunk-AVHUPARR.mjs.map +0 -1
- package/dist/chunks/chunk-AWBQHRRG.mjs +0 -2
- package/dist/chunks/chunk-AWBQHRRG.mjs.map +0 -1
- package/dist/chunks/chunk-B24N3EFY.mjs +0 -2
- package/dist/chunks/chunk-B24N3EFY.mjs.map +0 -1
- package/dist/chunks/chunk-B3YRDLFF.mjs +0 -2
- package/dist/chunks/chunk-B3YRDLFF.mjs.map +0 -1
- package/dist/chunks/chunk-BNYOSPTM.mjs +0 -7
- package/dist/chunks/chunk-BNYOSPTM.mjs.map +0 -1
- package/dist/chunks/chunk-CR7BS4ZT.mjs +0 -2
- package/dist/chunks/chunk-CR7BS4ZT.mjs.map +0 -1
- package/dist/chunks/chunk-D57VZ7SP.mjs +0 -8
- package/dist/chunks/chunk-D57VZ7SP.mjs.map +0 -1
- package/dist/chunks/chunk-DAWKCFB3.mjs +0 -3
- package/dist/chunks/chunk-DAWKCFB3.mjs.map +0 -1
- package/dist/chunks/chunk-DXRKQGX5.mjs +0 -13
- package/dist/chunks/chunk-DXRKQGX5.mjs.map +0 -1
- package/dist/chunks/chunk-E6QAXEJ5.mjs +0 -8
- package/dist/chunks/chunk-E6QAXEJ5.mjs.map +0 -1
- package/dist/chunks/chunk-ECJELNAF.mjs +0 -12
- package/dist/chunks/chunk-ECJELNAF.mjs.map +0 -1
- package/dist/chunks/chunk-F4JMGHZK.mjs +0 -2
- package/dist/chunks/chunk-F4JMGHZK.mjs.map +0 -1
- package/dist/chunks/chunk-FSPKR3UC.mjs +0 -6
- package/dist/chunks/chunk-FSPKR3UC.mjs.map +0 -1
- package/dist/chunks/chunk-GAH5QBYB.mjs +0 -6
- package/dist/chunks/chunk-GAH5QBYB.mjs.map +0 -1
- package/dist/chunks/chunk-GBVNGTXG.mjs +0 -3
- package/dist/chunks/chunk-GBVNGTXG.mjs.map +0 -1
- package/dist/chunks/chunk-HVBYWS5S.mjs +0 -10
- package/dist/chunks/chunk-HVBYWS5S.mjs.map +0 -1
- package/dist/chunks/chunk-I22UEOUC.mjs +0 -9
- package/dist/chunks/chunk-I22UEOUC.mjs.map +0 -1
- package/dist/chunks/chunk-IJ5P4GFV.mjs +0 -2
- package/dist/chunks/chunk-IJ5P4GFV.mjs.map +0 -1
- package/dist/chunks/chunk-IPLCT667.mjs +0 -2
- package/dist/chunks/chunk-IPLCT667.mjs.map +0 -1
- package/dist/chunks/chunk-IXOM253I.mjs +0 -7
- package/dist/chunks/chunk-IXOM253I.mjs.map +0 -1
- package/dist/chunks/chunk-J6NFIU3A.mjs +0 -5
- package/dist/chunks/chunk-J6NFIU3A.mjs.map +0 -1
- package/dist/chunks/chunk-JDIMSSA6.mjs +0 -6
- package/dist/chunks/chunk-JDIMSSA6.mjs.map +0 -1
- package/dist/chunks/chunk-JDOD4XCT.mjs +0 -2
- package/dist/chunks/chunk-JDOD4XCT.mjs.map +0 -1
- package/dist/chunks/chunk-JYMLZQ2B.mjs +0 -8
- package/dist/chunks/chunk-JYMLZQ2B.mjs.map +0 -1
- package/dist/chunks/chunk-KJT4SRSJ.mjs +0 -25
- package/dist/chunks/chunk-KJT4SRSJ.mjs.map +0 -1
- package/dist/chunks/chunk-KX2OAC2D.mjs +0 -5
- package/dist/chunks/chunk-KX2OAC2D.mjs.map +0 -1
- package/dist/chunks/chunk-LQYFD6JY.mjs +0 -10
- package/dist/chunks/chunk-LQYFD6JY.mjs.map +0 -1
- package/dist/chunks/chunk-LXCHQLNA.mjs +0 -2
- package/dist/chunks/chunk-LXCHQLNA.mjs.map +0 -1
- package/dist/chunks/chunk-MBJJBXJZ.mjs +0 -16
- package/dist/chunks/chunk-MBJJBXJZ.mjs.map +0 -1
- package/dist/chunks/chunk-ODVGAOCZ.mjs +0 -4
- package/dist/chunks/chunk-ODVGAOCZ.mjs.map +0 -1
- package/dist/chunks/chunk-OKDL7PKZ.mjs +0 -7
- package/dist/chunks/chunk-OKDL7PKZ.mjs.map +0 -1
- package/dist/chunks/chunk-PVRCMZP4.mjs +0 -6
- package/dist/chunks/chunk-PVRCMZP4.mjs.map +0 -1
- package/dist/chunks/chunk-Q7W6MMRR.mjs +0 -5
- package/dist/chunks/chunk-Q7W6MMRR.mjs.map +0 -1
- package/dist/chunks/chunk-QYJEIDIR.mjs +0 -6
- package/dist/chunks/chunk-QYJEIDIR.mjs.map +0 -1
- package/dist/chunks/chunk-SE5N425R.mjs +0 -10
- package/dist/chunks/chunk-SE5N425R.mjs.map +0 -1
- package/dist/chunks/chunk-SYA7GVFH.mjs +0 -7
- package/dist/chunks/chunk-SYA7GVFH.mjs.map +0 -1
- package/dist/chunks/chunk-UN4MBN2V.mjs +0 -5
- package/dist/chunks/chunk-UN4MBN2V.mjs.map +0 -1
- package/dist/chunks/chunk-UWZJI5W3.mjs +0 -7
- package/dist/chunks/chunk-UWZJI5W3.mjs.map +0 -1
- package/dist/chunks/chunk-V4K3YOUF.mjs +0 -11
- package/dist/chunks/chunk-V4K3YOUF.mjs.map +0 -1
- package/dist/chunks/chunk-VXHJOKOD.mjs +0 -2
- package/dist/chunks/chunk-VXHJOKOD.mjs.map +0 -1
- package/dist/chunks/chunk-X5LC6Z6E.mjs +0 -6
- package/dist/chunks/chunk-X5LC6Z6E.mjs.map +0 -1
- package/dist/chunks/chunk-YKQIHLV5.mjs +0 -2
- package/dist/chunks/chunk-YQGIJV4G.mjs +0 -2
- package/dist/chunks/chunk-YQGIJV4G.mjs.map +0 -1
- package/dist/chunks/chunk-ZOQOZJZV.mjs +0 -2
- package/dist/chunks/chunk-ZOQOZJZV.mjs.map +0 -1
- package/dist/chunks/chunk-ZPEZXPWQ.mjs +0 -6
- package/dist/chunks/chunk-ZPEZXPWQ.mjs.map +0 -1
- package/dist/chunks/core-layout-hops-index.mjs +0 -2
- package/dist/discovered.d.ts +0 -11
- package/dist/discovered.js +0 -3
- package/dist/node-scan.d.ts +0 -63
- package/dist/node-scan.js +0 -215
- package/dist/node.d.ts +0 -24
- package/dist/node.js +0 -166
- /package/dist/chunks/{core-layout-hops-index.mjs.map → chunk-F2VKDTOW.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# mermaid
|
|
1
|
+
# mermaid
|
|
2
2
|
|
|
3
|
-
> [!
|
|
4
|
-
>
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> `mermaid@latest` is v12. Mermaid v13 is published under the npm tag `v13-beta`, which the commands below use.
|
|
5
5
|
|
|
6
|
-
Mermaid v13 renders without a browser DOM: in Node, Deno, web workers and browsers. Its output is deterministic, and it has no third-party runtime dependencies.
|
|
6
|
+
Mermaid v13 renders without a browser DOM: in Node, Deno, web workers and browsers. Its output is deterministic, and it has no third-party runtime dependencies.
|
|
7
7
|
|
|
8
8
|
## Everything
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install mermaid@v13-
|
|
11
|
+
npm install mermaid@v13-beta --save-exact
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
```js
|
|
@@ -20,14 +20,14 @@ const { text } = await mermaid.render('id', 'flowchart LR\n A --> B', { format:
|
|
|
20
20
|
|
|
21
21
|
Every first-party diagram type is included. Bundlers split each type into its own chunk, so a page downloads only the types it renders.
|
|
22
22
|
|
|
23
|
-
The size budget is in [`size-budget.json`](./size-budget.json): core, everything the `mermaid` entry loads before any diagram chunk,
|
|
23
|
+
The size budget is in [`size-budget.json`](./size-budget.json). It has two limits, both gzipped: one for core, which is everything the `mermaid` entry loads before any diagram chunk, and one for core plus flowchart, as loaded for one flowchart render.
|
|
24
24
|
|
|
25
25
|
## Pick your diagrams
|
|
26
26
|
|
|
27
|
-
`mermaid/slim` is the same API without the first-party diagrams. Only the diagrams you pass in are bundled. Each package has its own version. The newest `mermaid@v13-
|
|
27
|
+
`mermaid/slim` is the same API without the first-party diagrams. Only the diagrams you pass in are bundled. Each package has its own version. The newest `mermaid@v13-beta` depends on the newest `@v13-beta` of each diagram package, so install them together:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npm install mermaid@v13-
|
|
30
|
+
npm install mermaid@v13-beta @mermaid-js/diagram-flowchart@v13-beta --save-exact
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
```js
|
|
@@ -40,14 +40,31 @@ const mermaid = createMermaid({ diagrams: [{ ...flowchart, ascii }] });
|
|
|
40
40
|
const { svg } = await mermaid.render('id', 'flowchart LR\n A --> B');
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
To load each diagram on first use, pass loaders keyed by diagram id instead. A loader runs when a diagram of that type is first rendered, never at `createMermaid`, and a bundler puts each in a chunk of its own. Objects and loaders mix, and a key that is not a first-party id is an error:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { createMermaid } from 'mermaid/slim';
|
|
47
|
+
import { pie } from '@mermaid-js/diagram-pie';
|
|
48
|
+
|
|
49
|
+
const mermaid = createMermaid({
|
|
50
|
+
diagrams: {
|
|
51
|
+
flowchart: () => import('@mermaid-js/diagram-flowchart'),
|
|
52
|
+
sequence: () => import('@mermaid-js/diagram-sequence'),
|
|
53
|
+
pie,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
A loader that fails, or that resolves to a module without that diagram's plugin, rejects the render with an error naming the id (a failed load is tried again on the next render). For text output, resolve to the module with its hook added: `() => import('@mermaid-js/diagram-flowchart').then(async (m) => ({ ...m, ascii: (await import('@mermaid-js/diagram-flowchart/ascii')).ascii }))`. Before the first load, `supportsFormat` answers from the diagram's manifest.
|
|
59
|
+
|
|
60
|
+
A diagram type that you did not pass in is still detected, and rendering it rejects with an `UNSUPPORTED_DIAGRAM` error. `mermaid/slim` has no default instance and does not render `.mermaid` elements on page load: call `mermaid.run()` yourself.
|
|
44
61
|
|
|
45
62
|
## Command line
|
|
46
63
|
|
|
47
64
|
```bash
|
|
48
|
-
npx mermaid@v13-
|
|
65
|
+
npx mermaid@v13-beta render diagram.mmd --format ascii
|
|
49
66
|
```
|
|
50
67
|
|
|
51
68
|
## Feedback
|
|
52
69
|
|
|
53
|
-
[Open an issue](https://github.com/mermaid-js/mermaid/issues/new/choose) with **v13** in the title, the exact
|
|
70
|
+
[Open an issue](https://github.com/mermaid-js/mermaid/issues/new/choose) with **v13** in the title, the exact version (`npm ls mermaid`) and the diagram source.
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -1,132 +1,6 @@
|
|
|
1
1
|
Third-party notices for mermaid
|
|
2
2
|
===============================
|
|
3
3
|
|
|
4
|
-
Pele
|
|
5
|
-
----
|
|
6
|
-
|
|
7
|
-
The files below are ported from, or based on, Pele (https://github.com/obsidianmd/pele) at
|
|
8
|
-
commit 3a2f075 (release 1.13.0). Each file's header says what it took and what changed. Pele is
|
|
9
|
-
used under the MIT License:
|
|
10
|
-
|
|
11
|
-
src/measurer.ts
|
|
12
|
-
|
|
13
|
-
MIT License
|
|
14
|
-
|
|
15
|
-
Copyright (c) 2026 kepano
|
|
16
|
-
|
|
17
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
-
in the Software without restriction, including without limitation the rights
|
|
20
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
-
furnished to do so, subject to the following conditions:
|
|
23
|
-
|
|
24
|
-
The above copyright notice and this permission notice shall be included in all
|
|
25
|
-
copies or substantial portions of the Software.
|
|
26
|
-
|
|
27
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
-
SOFTWARE.
|
|
34
|
-
|
|
35
|
-
Pele, in @mermaid-js/diagram-agentflow
|
|
36
|
-
--------------------------------------
|
|
37
|
-
|
|
38
|
-
The CDN build also bundles @mermaid-js/diagram-agentflow without its legal comments. That
|
|
39
|
-
package's parser/lexer.ts, parser/parser.ts, parser/base.ts, parser/statements.ts,
|
|
40
|
-
parser/model.ts, layout/prepare.ts, layout/shapes.ts, render/shapes.ts and render/edges.ts are
|
|
41
|
-
local copies of @mermaid-js/diagram-flowchart's lexer, parser, builder, shapes and edges (D446,
|
|
42
|
-
D467), which are ported from, or based on, Pele (https://github.com/obsidianmd/pele) at commit
|
|
43
|
-
3a2f075 (release 1.13.0). Pele is used under the MIT License:
|
|
44
|
-
|
|
45
|
-
MIT License
|
|
46
|
-
|
|
47
|
-
Copyright (c) 2026 kepano
|
|
48
|
-
|
|
49
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
50
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
51
|
-
in the Software without restriction, including without limitation the rights
|
|
52
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
53
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
54
|
-
furnished to do so, subject to the following conditions:
|
|
55
|
-
|
|
56
|
-
The above copyright notice and this permission notice shall be included in all
|
|
57
|
-
copies or substantial portions of the Software.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
60
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
61
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
62
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
63
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
64
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
65
|
-
SOFTWARE.
|
|
66
|
-
|
|
67
|
-
Pele, in @mermaid-js/diagram-block
|
|
68
|
-
----------------------------------
|
|
69
|
-
|
|
70
|
-
The CDN build also bundles @mermaid-js/diagram-block without its legal comments. That
|
|
71
|
-
package's shapes/leaf.ts, shapes/draw.ts and render/arrowheads.ts are local copies of
|
|
72
|
-
@mermaid-js/diagram-flowchart's shapes and arrowheads (D446), which are ported from, or based
|
|
73
|
-
on, Pele (https://github.com/obsidianmd/pele) at commit 3a2f075 (release 1.13.0). Pele is used
|
|
74
|
-
under the MIT License:
|
|
75
|
-
|
|
76
|
-
MIT License
|
|
77
|
-
|
|
78
|
-
Copyright (c) 2026 kepano
|
|
79
|
-
|
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
82
|
-
in the Software without restriction, including without limitation the rights
|
|
83
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
84
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
85
|
-
furnished to do so, subject to the following conditions:
|
|
86
|
-
|
|
87
|
-
The above copyright notice and this permission notice shall be included in all
|
|
88
|
-
copies or substantial portions of the Software.
|
|
89
|
-
|
|
90
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
91
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
92
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
93
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
94
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
95
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
96
|
-
SOFTWARE.
|
|
97
|
-
|
|
98
|
-
Pele, in @mermaid-js/diagram-c4
|
|
99
|
-
-------------------------------
|
|
100
|
-
|
|
101
|
-
The CDN build also bundles @mermaid-js/diagram-c4 without its legal comments. That package's
|
|
102
|
-
layout/grid.ts, layout/layout.ts, layout/metrics.ts, layout/path.ts, layout/route.ts and
|
|
103
|
-
layout/shapes.ts are ported from Pele's C4 grid, relation router and label placement, and its
|
|
104
|
-
render/shapes.ts is a local copy of @mermaid-js/diagram-flowchart's shapes (D446), all ported
|
|
105
|
-
from, or based on, Pele (https://github.com/obsidianmd/pele) at commit 3a2f075 (release
|
|
106
|
-
1.13.0). Pele is used under the MIT License:
|
|
107
|
-
|
|
108
|
-
MIT License
|
|
109
|
-
|
|
110
|
-
Copyright (c) 2026 kepano
|
|
111
|
-
|
|
112
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
113
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
114
|
-
in the Software without restriction, including without limitation the rights
|
|
115
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
116
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
117
|
-
furnished to do so, subject to the following conditions:
|
|
118
|
-
|
|
119
|
-
The above copyright notice and this permission notice shall be included in all
|
|
120
|
-
copies or substantial portions of the Software.
|
|
121
|
-
|
|
122
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
123
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
124
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
125
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
126
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
127
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
128
|
-
SOFTWARE.
|
|
129
|
-
|
|
130
4
|
d3-sankey
|
|
131
5
|
---------
|
|
132
6
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ResolvedConfig } from '@mermaid-js/core/config';
|
|
2
|
+
import { type PreprocessResult } from '@mermaid-js/core/preprocess';
|
|
3
|
+
import { AnalysisCache, type Analysis, type Detection, type Parsed } from './analysis-cache.ts';
|
|
4
|
+
import { type SiteConfigs, type Snapshot } from './config-snapshot.ts';
|
|
5
|
+
import type { BlockHost } from './embeds.ts';
|
|
6
|
+
import type { AnyPlugin, Detected, Registry } from './registry.ts';
|
|
7
|
+
/** What `detect` found, for a type with a plugin package. */
|
|
8
|
+
export interface Found {
|
|
9
|
+
readonly detected: Detected & {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
};
|
|
12
|
+
readonly pre: PreprocessResult;
|
|
13
|
+
}
|
|
14
|
+
/** A type may read its own section on top of its plugin's (`swimlane` over `flowchart`, D534). */
|
|
15
|
+
export declare function sectionOf(detected: Detected, plugin?: AnyPlugin): string | string[] | undefined;
|
|
16
|
+
export declare class Analyser {
|
|
17
|
+
private readonly registry;
|
|
18
|
+
private readonly siteConfigs;
|
|
19
|
+
private readonly claims;
|
|
20
|
+
private readonly readsAst;
|
|
21
|
+
/** The analyses of recent texts, each valid only for the snapshot it was made with. */
|
|
22
|
+
readonly cache: AnalysisCache<Analysis>;
|
|
23
|
+
/** The configs of recent diagram-text configs, by value, over each site config. */
|
|
24
|
+
private texts;
|
|
25
|
+
/**
|
|
26
|
+
* `claims`: what the registered extensions claim of a parse, read at each parse because the
|
|
27
|
+
* hooks are rebuilt after a registration. `readsAst`: whether a `postParse` hook of a render
|
|
28
|
+
* of `plugin` with `config` reads the AST, so its parse is full (DESIGN §4.2).
|
|
29
|
+
*/
|
|
30
|
+
constructor(registry: Registry, siteConfigs: SiteConfigs, claims: () => readonly string[], readsAst: (plugin: AnyPlugin, config: ResolvedConfig) => boolean);
|
|
31
|
+
/** Drops every parsed text: a registration changes how texts detect, resolve and parse. */
|
|
32
|
+
invalidate(): void;
|
|
33
|
+
/** The author's config layers and the config they resolve to, over the site's and a host's. */
|
|
34
|
+
private layers;
|
|
35
|
+
/**
|
|
36
|
+
* Detect, resolve config and parse with a loaded plugin (DESIGN §3 steps 1–4). The parse is
|
|
37
|
+
* lean (DESIGN §4.2) unless the call asks for it `full` or a `postParse` hook of the render
|
|
38
|
+
* reads the AST; a lean parse with an error is parsed again in full for its diagnostics.
|
|
39
|
+
*/
|
|
40
|
+
analyse(text: string, snap: Snapshot, plugin: AnyPlugin, { detected, pre }: Detection, host?: BlockHost, full?: boolean): Parsed;
|
|
41
|
+
detect(text: string, s: Snapshot): Detection;
|
|
42
|
+
/**
|
|
43
|
+
* Whether `a`'s type has text output (R-ASCII-5, D80). Asked by type: a type can draw fewer
|
|
44
|
+
* formats than its plugin (`typeOptions` `formats`).
|
|
45
|
+
*/
|
|
46
|
+
textOf(a: {
|
|
47
|
+
detected: Detected;
|
|
48
|
+
}): boolean;
|
|
49
|
+
/** Throws `UnsupportedFormatError` unless `detected` declares ascii (R-ASCII-5, D80). */
|
|
50
|
+
checkText(detected: Detected): void;
|
|
51
|
+
/** `detect`, for a type with a plugin package that can draw `ascii` when that is asked for. */
|
|
52
|
+
detectSupported(text: string, s: Snapshot, ascii: boolean): Found;
|
|
53
|
+
/**
|
|
54
|
+
* Parses with the loaded `plugin` and caches the analysis (DESIGN §3 steps 2–4): only its
|
|
55
|
+
* lean parse; a full parse goes to the call that asked for it.
|
|
56
|
+
*/
|
|
57
|
+
analysisOf(text: string, s: Snapshot, found: Found, plugin: AnyPlugin | undefined, full?: boolean): Parsed;
|
|
58
|
+
}
|
package/dist/analyser.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The analyser of one API object (DESIGN §3 steps 1–4): detect, site config, parse, and the
|
|
3
|
+
* cache of what they made. Every registration drops the cache through `invalidate()`, the one
|
|
4
|
+
* place it is cleared from.
|
|
5
|
+
*/
|
|
6
|
+
import { errorFromDiagnostics, UnsupportedFormatError, } from '@mermaid-js/core';
|
|
7
|
+
import { resolveText } from '@mermaid-js/core/config';
|
|
8
|
+
import { checkSource } from '@mermaid-js/core/limits';
|
|
9
|
+
import { preprocess } from '@mermaid-js/core/preprocess';
|
|
10
|
+
import { stageEnd, stageStart } from '@mermaid-js/core/timing';
|
|
11
|
+
import { AnalysisCache, dataAstOf, fullParse, parseStep, } from "./analysis-cache.js";
|
|
12
|
+
import { directiveConfig, textConfig, } from "./config-snapshot.js";
|
|
13
|
+
import { toWarning, unsupportedDiagram } from "./errors.js";
|
|
14
|
+
import { outsideBlocks } from "./embeds.js";
|
|
15
|
+
/** A type may read its own section on top of its plugin's (`swimlane` over `flowchart`, D534). */
|
|
16
|
+
export function sectionOf(detected, plugin) {
|
|
17
|
+
const own = plugin?.configSection ?? plugin?.id ?? detected.id;
|
|
18
|
+
return detected.section && detected.section !== own ? [detected.section, own] : own;
|
|
19
|
+
}
|
|
20
|
+
/** Whether `diagnostics` hold an error: only then does `errorFromDiagnostics` make one. */
|
|
21
|
+
function hasError(diagnostics) {
|
|
22
|
+
for (const d of diagnostics)
|
|
23
|
+
if (d.severity === 'error')
|
|
24
|
+
return true;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
/** Hands the warnings among `diagnostics` to `warn`. */
|
|
28
|
+
function warnOf(diagnostics, warn) {
|
|
29
|
+
for (const d of diagnostics)
|
|
30
|
+
if (d.severity === 'warning')
|
|
31
|
+
warn(d);
|
|
32
|
+
}
|
|
33
|
+
export class Analyser {
|
|
34
|
+
registry;
|
|
35
|
+
siteConfigs;
|
|
36
|
+
claims;
|
|
37
|
+
readsAst;
|
|
38
|
+
/** The analyses of recent texts, each valid only for the snapshot it was made with. */
|
|
39
|
+
cache = new AnalysisCache();
|
|
40
|
+
/** The configs of recent diagram-text configs, by value, over each site config. */
|
|
41
|
+
texts = new WeakMap();
|
|
42
|
+
/**
|
|
43
|
+
* `claims`: what the registered extensions claim of a parse, read at each parse because the
|
|
44
|
+
* hooks are rebuilt after a registration. `readsAst`: whether a `postParse` hook of a render
|
|
45
|
+
* of `plugin` with `config` reads the AST, so its parse is full (DESIGN §4.2).
|
|
46
|
+
*/
|
|
47
|
+
constructor(registry, siteConfigs, claims, readsAst) {
|
|
48
|
+
this.registry = registry;
|
|
49
|
+
this.siteConfigs = siteConfigs;
|
|
50
|
+
this.claims = claims;
|
|
51
|
+
this.readsAst = readsAst;
|
|
52
|
+
}
|
|
53
|
+
/** Drops every parsed text: a registration changes how texts detect, resolve and parse. */
|
|
54
|
+
invalidate() {
|
|
55
|
+
this.cache.clear();
|
|
56
|
+
this.texts = new WeakMap();
|
|
57
|
+
}
|
|
58
|
+
/** The author's config layers and the config they resolve to, over the site's and a host's. */
|
|
59
|
+
layers(pre, snap, plugin, detected, warn, host) {
|
|
60
|
+
const section = sectionOf(detected, plugin);
|
|
61
|
+
let front = pre.frontMatter?.config;
|
|
62
|
+
let directives = directiveConfig(pre, section);
|
|
63
|
+
const hit = this.siteConfigs.get(snap, plugin, detected, section, this.registry.fragments());
|
|
64
|
+
for (const w of hit.warnings)
|
|
65
|
+
warn(w);
|
|
66
|
+
// An embedded diagram (ADR-15) sets only its own options, with one warning for the rest.
|
|
67
|
+
if (host)
|
|
68
|
+
({ front, directives } = host.layers(front, directives, hit.site, warn));
|
|
69
|
+
// An embedded diagram starts from its host's config, and takes its theme.
|
|
70
|
+
let config = host
|
|
71
|
+
? resolveText(hit.site, front, directives, { warn, under: host.config })
|
|
72
|
+
: textConfig(this.texts, hit, front, directives, warn);
|
|
73
|
+
if (host)
|
|
74
|
+
config = host.resolve(config, [section ?? []].flat());
|
|
75
|
+
return { config, sources: [hit.site.site, front, ...directives] };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Detect, resolve config and parse with a loaded plugin (DESIGN §3 steps 1–4). The parse is
|
|
79
|
+
* lean (DESIGN §4.2) unless the call asks for it `full` or a `postParse` hook of the render
|
|
80
|
+
* reads the AST; a lean parse with an error is parsed again in full for its diagnostics.
|
|
81
|
+
*/
|
|
82
|
+
analyse(text, snap, plugin, { detected, pre }, host, full = false) {
|
|
83
|
+
const warnings = [];
|
|
84
|
+
const warn = (w) => void warnings.push(toWarning(w, this.registry.fragments()));
|
|
85
|
+
warnOf(pre.diagnostics, warn);
|
|
86
|
+
const { config, sources } = this.layers(pre, snap, plugin, detected, warn, host);
|
|
87
|
+
const t = stageStart();
|
|
88
|
+
const claims = this.claims();
|
|
89
|
+
const ctx = claims.length > 0
|
|
90
|
+
? { config, preprocessed: pre, limits: snap.limits, claims }
|
|
91
|
+
: { config, preprocessed: pre, limits: snap.limits };
|
|
92
|
+
const readsAst = this.readsAst(plugin, config);
|
|
93
|
+
const dataAst = dataAstOf(snap.options, plugin, readsAst);
|
|
94
|
+
const parsed = parseStep(plugin, text, ctx, !full && !readsAst, dataAst);
|
|
95
|
+
const parse = parsed.lean;
|
|
96
|
+
stageEnd('parse', t);
|
|
97
|
+
// A directive inside a block belongs to the block (ADR-15): parse again without it.
|
|
98
|
+
const outside = outsideBlocks(pre, parse);
|
|
99
|
+
if (outside !== pre)
|
|
100
|
+
return this.analyse(text, snap, plugin, { detected, pre: outside }, host, full);
|
|
101
|
+
if (hasError(pre.diagnostics) || hasError(parse.diagnostics))
|
|
102
|
+
throw errorFromDiagnostics(text, [...pre.diagnostics, ...parse.diagnostics]);
|
|
103
|
+
warnOf(parse.diagnostics, warn);
|
|
104
|
+
const analysis = {
|
|
105
|
+
detected,
|
|
106
|
+
plugin,
|
|
107
|
+
prepared: { diagramType: detected.type, config, parse, warnings },
|
|
108
|
+
title: pre.frontMatter?.title,
|
|
109
|
+
sources,
|
|
110
|
+
dataAst,
|
|
111
|
+
full: () => fullParse(plugin, text, ctx),
|
|
112
|
+
};
|
|
113
|
+
return { analysis, full: parsed.full };
|
|
114
|
+
}
|
|
115
|
+
detect(text, s) {
|
|
116
|
+
// DESIGN §3 step 1: the source limit, before the text is read at all.
|
|
117
|
+
checkSource(text, s.limits);
|
|
118
|
+
const pre = preprocess(text);
|
|
119
|
+
if (hasError(pre.diagnostics))
|
|
120
|
+
throw errorFromDiagnostics(text, pre.diagnostics);
|
|
121
|
+
return {
|
|
122
|
+
detected: this.registry.detect(text, pre, s.config),
|
|
123
|
+
pre,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Whether `a`'s type has text output (R-ASCII-5, D80). Asked by type: a type can draw fewer
|
|
128
|
+
* formats than its plugin (`typeOptions` `formats`).
|
|
129
|
+
*/
|
|
130
|
+
textOf(a) {
|
|
131
|
+
return a.detected.id !== undefined && this.registry.formats(a.detected.type).includes('ascii');
|
|
132
|
+
}
|
|
133
|
+
/** Throws `UnsupportedFormatError` unless `detected` declares ascii (R-ASCII-5, D80). */
|
|
134
|
+
checkText(detected) {
|
|
135
|
+
if (!this.textOf({ detected }))
|
|
136
|
+
throw new UnsupportedFormatError(detected.type, 'ascii');
|
|
137
|
+
}
|
|
138
|
+
/** `detect`, for a type with a plugin package that can draw `ascii` when that is asked for. */
|
|
139
|
+
detectSupported(text, s, ascii) {
|
|
140
|
+
const found = this.detect(text, s);
|
|
141
|
+
const { detected } = found;
|
|
142
|
+
if (detected.id === undefined)
|
|
143
|
+
throw unsupportedDiagram(detected.type);
|
|
144
|
+
if (ascii)
|
|
145
|
+
this.checkText(detected);
|
|
146
|
+
// The registry's row itself, its id now known to be set: nothing writes it (readonly).
|
|
147
|
+
return found;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Parses with the loaded `plugin` and caches the analysis (DESIGN §3 steps 2–4): only its
|
|
151
|
+
* lean parse; a full parse goes to the call that asked for it.
|
|
152
|
+
*/
|
|
153
|
+
analysisOf(text, s, found, plugin, full = false) {
|
|
154
|
+
if (!plugin)
|
|
155
|
+
throw unsupportedDiagram(found.detected.type);
|
|
156
|
+
const parsed = this.analyse(text, s, plugin, found, undefined, full);
|
|
157
|
+
this.cache.set(text, s, parsed.analysis);
|
|
158
|
+
return parsed;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type DiagramParseContext } from '@mermaid-js/core';
|
|
2
|
+
import type { LeanParseResult, ParseResult } from '@mermaid-js/core/parser-kit';
|
|
3
|
+
import type { PreprocessResult } from '@mermaid-js/core/preprocess';
|
|
4
|
+
import type { Prepared } from './api-types.ts';
|
|
5
|
+
import type { IntegratorOptions, Snapshot } from './config-snapshot.ts';
|
|
6
|
+
import type { AnyPlugin, Detected } from './registry.ts';
|
|
7
|
+
/**
|
|
8
|
+
* What the API object keeps of one parsed text (DESIGN §3 steps 1–4): its parse is lean
|
|
9
|
+
* (DESIGN §4.2), whatever the plugin returned, so a cached text holds no AST.
|
|
10
|
+
*/
|
|
11
|
+
export interface Analysis {
|
|
12
|
+
readonly detected: Detected;
|
|
13
|
+
readonly plugin: AnyPlugin;
|
|
14
|
+
readonly prepared: Omit<Prepared, 'parse'> & {
|
|
15
|
+
readonly parse: LeanParseResult<unknown>;
|
|
16
|
+
};
|
|
17
|
+
/** The front-matter title, for text output (D82). */
|
|
18
|
+
readonly title: string | undefined;
|
|
19
|
+
/** The author's config layers (`initialize`, front matter, directives), for line hops (D537). */
|
|
20
|
+
readonly sources: readonly (Readonly<Record<string, unknown>> | undefined)[];
|
|
21
|
+
/** Whether its SVG draws write `data-ast` (`RenderContext.dataAst`). */
|
|
22
|
+
readonly dataAst: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The text parsed again in full, for a call that reads the AST (`prepare()`, text output, a
|
|
25
|
+
* `postParse` hook). It is the caller's: nothing keeps it.
|
|
26
|
+
*/
|
|
27
|
+
readonly full: () => ParseResult<unknown>;
|
|
28
|
+
}
|
|
29
|
+
/** An analysis, with the full parse when the call that made it parsed in full. */
|
|
30
|
+
export interface Parsed {
|
|
31
|
+
readonly analysis: Analysis;
|
|
32
|
+
readonly full?: ParseResult<unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether an analysis's SVG draws write `data-ast` (R-PARSE-8): as the integrator says
|
|
36
|
+
* (`output.dataAst`); unset, for a plugin that parses lean only when an extension reads the AST
|
|
37
|
+
* (`postParse`), and always for one that does not (its parse always gives the ids).
|
|
38
|
+
*/
|
|
39
|
+
export declare function dataAstOf(options: Readonly<IntegratorOptions>, plugin: AnyPlugin, readsAst: boolean): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The parse step of an analysis (DESIGN §3 step 3): lean when `lean` (DESIGN §4.2), with the
|
|
42
|
+
* model's AST ids when `astIds`. A lean parse with an error is parsed again in full, so the
|
|
43
|
+
* error and its diagnostics are the full parse's. Returns the lean view of the result, and the
|
|
44
|
+
* result itself when it is full.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseStep(plugin: AnyPlugin, text: string, ctx: DiagramParseContext, lean: boolean, astIds: boolean): {
|
|
47
|
+
readonly lean: LeanParseResult<unknown>;
|
|
48
|
+
readonly full?: ParseResult<unknown>;
|
|
49
|
+
};
|
|
50
|
+
/** `plugin`'s full parse: a plugin gives a lean one only when asked for it. */
|
|
51
|
+
export declare function fullParse(plugin: AnyPlugin, text: string, ctx: DiagramParseContext): ParseResult<unknown>;
|
|
52
|
+
/** What `detect` found. */
|
|
53
|
+
export interface Detection {
|
|
54
|
+
readonly detected: Detected;
|
|
55
|
+
readonly pre: PreprocessResult;
|
|
56
|
+
}
|
|
57
|
+
/** The analyses of recent texts, each valid only for the snapshot it was made with. */
|
|
58
|
+
export declare class AnalysisCache<A> {
|
|
59
|
+
private entries;
|
|
60
|
+
get(text: string, snap: Snapshot): A | undefined;
|
|
61
|
+
set(text: string, snap: Snapshot, analysis: A): void;
|
|
62
|
+
clear(): void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { MermaidError } from '@mermaid-js/core';
|
|
2
|
+
/**
|
|
3
|
+
* Whether an analysis's SVG draws write `data-ast` (R-PARSE-8): as the integrator says
|
|
4
|
+
* (`output.dataAst`); unset, for a plugin that parses lean only when an extension reads the AST
|
|
5
|
+
* (`postParse`), and always for one that does not (its parse always gives the ids).
|
|
6
|
+
*/
|
|
7
|
+
export function dataAstOf(options, plugin, readsAst) {
|
|
8
|
+
return options.output?.dataAst ?? (!plugin.leanParse || readsAst);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The parse step of an analysis (DESIGN §3 step 3): lean when `lean` (DESIGN §4.2), with the
|
|
12
|
+
* model's AST ids when `astIds`. A lean parse with an error is parsed again in full, so the
|
|
13
|
+
* error and its diagnostics are the full parse's. Returns the lean view of the result, and the
|
|
14
|
+
* result itself when it is full.
|
|
15
|
+
*/
|
|
16
|
+
export function parseStep(plugin, text, ctx, lean, astIds) {
|
|
17
|
+
let parse = plugin.parse(text, lean ? { ...ctx, lean, astIds } : ctx);
|
|
18
|
+
if (parse.lean && parse.diagnostics.some((d) => d.severity === 'error'))
|
|
19
|
+
parse = plugin.parse(text, ctx);
|
|
20
|
+
if (parse.lean)
|
|
21
|
+
return { lean: parse };
|
|
22
|
+
// The lean view: what a draw reads, nothing of the AST, symbols, statements or tokens.
|
|
23
|
+
const full = parse;
|
|
24
|
+
const { model, diagnostics, embeds, edgeCount } = full;
|
|
25
|
+
return { lean: { lean: true, model, diagnostics, embeds, edgeCount }, full };
|
|
26
|
+
}
|
|
27
|
+
/** `plugin`'s full parse: a plugin gives a lean one only when asked for it. */
|
|
28
|
+
export function fullParse(plugin, text, ctx) {
|
|
29
|
+
const parse = plugin.parse(text, ctx);
|
|
30
|
+
if (parse.lean)
|
|
31
|
+
throw new MermaidError('INTERNAL', `${plugin.id}: lean parse unasked`);
|
|
32
|
+
return parse;
|
|
33
|
+
}
|
|
34
|
+
const CACHE_SIZE = 32;
|
|
35
|
+
/** The analyses of recent texts, each valid only for the snapshot it was made with. */
|
|
36
|
+
export class AnalysisCache {
|
|
37
|
+
entries = new Map();
|
|
38
|
+
get(text, snap) {
|
|
39
|
+
const hit = this.entries.get(text);
|
|
40
|
+
return hit && hit.snap === snap ? hit.analysis : undefined;
|
|
41
|
+
}
|
|
42
|
+
set(text, snap, analysis) {
|
|
43
|
+
this.entries.delete(text);
|
|
44
|
+
this.entries.set(text, { snap, analysis });
|
|
45
|
+
if (this.entries.size > CACHE_SIZE)
|
|
46
|
+
this.entries.delete(this.entries.keys().next().value);
|
|
47
|
+
}
|
|
48
|
+
clear() {
|
|
49
|
+
// A new map, not `Map#clear()`: V8 leaves a cleared map's old table pointing at its new one,
|
|
50
|
+
// so once the GC has promoted one table, every later table and the analyses in it survive
|
|
51
|
+
// each scavenge until a full GC. Only these methods read `entries`, so none holds the old map.
|
|
52
|
+
this.entries = new Map();
|
|
53
|
+
}
|
|
54
|
+
}
|