ranui 0.2.1-alpha.1 → 0.2.1-alpha.4
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/abnfDiagram-VRR7QNED-CH_pIv_l.cjs +1 -0
- package/dist/abnfDiagram-VRR7QNED-CTsqwzwi.js +95 -0
- package/dist/arc-D25LhgTs.cjs +1 -0
- package/dist/arc-DRPGof21.js +82 -0
- package/dist/architecture-TIHT7OUA-BbBd15_y.cjs +1 -0
- package/dist/architecture-TIHT7OUA-pbFO1xSx.js +5 -0
- package/dist/architectureDiagram-ZJ3FMSHR-8mjyXr-w.js +4279 -0
- package/dist/architectureDiagram-ZJ3FMSHR-D_jWFFZx.cjs +36 -0
- package/dist/array-By5736M5.js +7 -0
- package/dist/array-C3cbN3GY.cjs +1 -0
- package/dist/blockDiagram-677ZJIJ3-3F79MOSt.js +3321 -0
- package/dist/blockDiagram-677ZJIJ3-Cx35khWe.cjs +132 -0
- package/dist/builder.d.ts +2 -2
- package/dist/builder.js +39 -34
- package/dist/{builtin-D9djWkCE.js → builtin-1lUEp_ro.js} +83 -76
- package/dist/button-Cj-XSCsd.js +117 -0
- package/dist/button.js +1 -1
- package/dist/c4Diagram-LMCZKHZV-Cxn_gqu_.js +3064 -0
- package/dist/c4Diagram-LMCZKHZV-TRNb3Gvl.cjs +10 -0
- package/dist/{card-CqJa4Q_v.js → card-BHN9Xp4S.js} +2 -2
- package/dist/card.js +1 -1
- package/dist/channel-C9WSNwcS.cjs +1 -0
- package/dist/channel-k5-UxdcV.js +5 -0
- package/dist/{checkbox-CThC9-vy.js → checkbox-O_J_n1_W.js} +10 -10
- package/dist/checkbox.js +1 -1
- package/dist/chunk-2Q5K7J3B-CTMy5FII.cjs +1 -0
- package/dist/chunk-2Q5K7J3B-DlFVJRAn.js +15 -0
- package/dist/chunk-32BRIVSS-BXVdG_nV.cjs +1 -0
- package/dist/chunk-32BRIVSS-jAuAwMVV.js +68 -0
- package/dist/chunk-52WLFC77-BChUrU24.cjs +10 -0
- package/dist/chunk-52WLFC77-wpL7en7e.js +630 -0
- package/dist/chunk-5VM5RSS4-Cni2Ogq2.js +19 -0
- package/dist/chunk-5VM5RSS4-DudUFQ_Z.cjs +15 -0
- package/dist/chunk-7BUUIJ7U-9hiBbc7O.js +87 -0
- package/dist/chunk-7BUUIJ7U-DMv_UkjI.cjs +1 -0
- package/dist/chunk-C7G6YPKG-CA-DNpvI.js +71 -0
- package/dist/chunk-C7G6YPKG-CKEeW9TM.cjs +1 -0
- package/dist/chunk-EX3LRPZG-BCmf0iDq.js +2137 -0
- package/dist/chunk-EX3LRPZG-DbfbNdXo.cjs +231 -0
- package/dist/chunk-FWX5IMBZ-D11-gbhc.cjs +1 -0
- package/dist/chunk-FWX5IMBZ-DZ5VYvm5.js +60 -0
- package/dist/chunk-HOUHSVGY-BGB3dOvI.cjs +1 -0
- package/dist/chunk-HOUHSVGY-DRQcQeMT.js +268 -0
- package/dist/chunk-ICXQ74PX-BbT9JaEW.cjs +2 -0
- package/dist/chunk-ICXQ74PX-DR8rL-xF.js +1377 -0
- package/dist/chunk-JWPE2WC7-CGEmUMMZ.js +8 -0
- package/dist/chunk-JWPE2WC7-D8EnWK1B.cjs +1 -0
- package/dist/chunk-KEIR6QF5-B2Op7cFH.js +22155 -0
- package/dist/chunk-KEIR6QF5-C4fcHpY0.cjs +161 -0
- package/dist/chunk-MOJQB5TN-BC46HDyu.js +516 -0
- package/dist/chunk-MOJQB5TN-oOeq982_.cjs +88 -0
- package/dist/chunk-OGEWGWER-BV51ll2w.js +33 -0
- package/dist/chunk-OGEWGWER-DX8sW1dT.cjs +1 -0
- package/dist/chunk-PUDLZKDR-48YaqVoF.cjs +156 -0
- package/dist/chunk-PUDLZKDR-NdMR0Ft5.js +4282 -0
- package/dist/chunk-Q4XR5HBZ-3BHjjc9u.js +1709 -0
- package/dist/chunk-Q4XR5HBZ-aBnPq509.cjs +70 -0
- package/dist/chunk-RYQCIY6F-BER2T9t0.js +246 -0
- package/dist/chunk-RYQCIY6F-DVRzSnsI.cjs +1 -0
- package/dist/chunk-V7JOEXUC-Cr_hr02u.js +3467 -0
- package/dist/chunk-V7JOEXUC-DHizzTla.cjs +206 -0
- package/dist/chunk-VAUOI2AC-DfQf5L2_.cjs +1 -0
- package/dist/chunk-VAUOI2AC-izt0o4id.js +11 -0
- package/dist/chunk-VR4S4FIN-CJi5okl4.js +26 -0
- package/dist/chunk-VR4S4FIN-KiwnPF31.cjs +1 -0
- package/dist/chunk-WYO6CB5R-DDHkKowO.js +4535 -0
- package/dist/chunk-WYO6CB5R-u4mJNOcO.cjs +127 -0
- package/dist/chunk-XXDRQBXY-BB1i_53q.js +9 -0
- package/dist/chunk-XXDRQBXY-C8VGLZmt.cjs +1 -0
- package/dist/chunk-Y2CYZVJY-0JxdZxki.js +13 -0
- package/dist/chunk-Y2CYZVJY-DPaYLFFP.cjs +1 -0
- package/dist/chunk-ZGVPDNZ5-6uMbTJXy.js +3841 -0
- package/dist/chunk-ZGVPDNZ5-Cw5_HJba.cjs +62 -0
- package/dist/chunk-ZIRB5QZD-C7OH2FI2.js +1280 -0
- package/dist/chunk-ZIRB5QZD-aLu-4ITN.cjs +32 -0
- package/dist/classDiagram-OUVF2IWQ-D6rqYIh0.cjs +1 -0
- package/dist/classDiagram-OUVF2IWQ-Df0ghim9.js +30 -0
- package/dist/classDiagram-v2-EOCWNBFH-D6rqYIh0.cjs +1 -0
- package/dist/classDiagram-v2-EOCWNBFH-Df0ghim9.js +30 -0
- package/dist/{colorpicker-XNxDRcQ-.js → colorpicker-mebH0XLm.js} +8 -8
- package/dist/colorpicker.js +1 -1
- package/dist/components/glass/index.d.ts +52 -0
- package/dist/components/icon/core-icons.d.ts +13 -0
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/mermaid/index.d.ts +52 -0
- package/dist/components/modal/index.d.ts +9 -0
- package/dist/content-YOKzMoc7.js +39 -0
- package/dist/content.js +5 -0
- package/dist/cose-bilkent-JH36ORCC-BUxFTdey.cjs +1 -0
- package/dist/cose-bilkent-JH36ORCC-DTwvJlGw.js +2353 -0
- package/dist/cynefin-VYW2F7L2-6c1GOGXW.cjs +1 -0
- package/dist/cynefin-VYW2F7L2-ALQKF7N6.js +5 -0
- package/dist/cynefinDiagram-TSTJHNR4-Bjt4QTVh.js +355 -0
- package/dist/cynefinDiagram-TSTJHNR4-ISDORSxO.cjs +62 -0
- package/dist/cytoscape.esm-CFq1_DTa.js +18906 -0
- package/dist/cytoscape.esm-pygMw4dR.cjs +321 -0
- package/dist/dagre-D1-W1tt6.cjs +1 -0
- package/dist/dagre-D8GLTwuf.js +1578 -0
- package/dist/dagre-VKFMJZFB-DXI69qAN.cjs +4 -0
- package/dist/dagre-VKFMJZFB-Dfku86Az.js +341 -0
- package/dist/defaultLocale-0M_kMcEH.js +184 -0
- package/dist/defaultLocale-DSqtvhxg.cjs +1 -0
- package/dist/diagram-FQU43EPY-BAiRt5eL.cjs +3 -0
- package/dist/diagram-FQU43EPY-BvQ5jmVn.js +452 -0
- package/dist/diagram-G47NLZAW-DGnmEa8u.cjs +24 -0
- package/dist/diagram-G47NLZAW-DT2BBA0T.js +498 -0
- package/dist/diagram-NH7WQ7WH-DxgkStA3.cjs +24 -0
- package/dist/diagram-NH7WQ7WH-W7jg4Vh8.js +135 -0
- package/dist/diagram-OA4YK3LP-DkvFII73.cjs +30 -0
- package/dist/diagram-OA4YK3LP-jU--aqQl.js +317 -0
- package/dist/diagram-WEI45ONY-C_Qhf4ny.js +215 -0
- package/dist/diagram-WEI45ONY-XvzRFmmY.cjs +41 -0
- package/dist/dist-C0Fwsvsq.js +70 -0
- package/dist/dist-C20XxSsP.cjs +1 -0
- package/dist/{dropdown-CCvsambb.js → dropdown-CzGAVWYC.js} +4 -4
- package/dist/dropdown.js +1 -1
- package/dist/ebnfDiagram-CCIWWBDH-Cu8bAlhC.cjs +1 -0
- package/dist/ebnfDiagram-CCIWWBDH-Gnr20Oc1.js +112 -0
- package/dist/erDiagram-Q63AITRT-CxLSa9Yv.cjs +85 -0
- package/dist/erDiagram-Q63AITRT-D0Hh9b-W.js +1822 -0
- package/dist/eventmodeling-45OFAUF4-C6VXxUn1.cjs +1 -0
- package/dist/eventmodeling-45OFAUF4-DMpGs2yI.js +5 -0
- package/dist/factory-ZNhcQ4tf.js +482 -0
- package/dist/flowDiagram-23GEKE2U-B6gASEYG.cjs +1 -0
- package/dist/flowDiagram-23GEKE2U-BY4wE2vw.js +19 -0
- package/dist/{form-Ceq3uJzz.js → form-B8afuJlF.js} +5 -5
- package/dist/form.js +1 -1
- package/dist/ganttDiagram-NO4QXBWP-B40Eabk0.js +3125 -0
- package/dist/ganttDiagram-NO4QXBWP-DZT79qJr.cjs +292 -0
- package/dist/gitGraph-TEB2WS4Q-BbtF3MDr.cjs +1 -0
- package/dist/gitGraph-TEB2WS4Q-D6Ru11Cs.js +5 -0
- package/dist/gitGraphDiagram-IHSO6WYX-BUJNSssA.js +754 -0
- package/dist/gitGraphDiagram-IHSO6WYX-DW06165m.cjs +106 -0
- package/dist/glass-BniIptBE.js +115 -0
- package/dist/glass.js +5 -0
- package/dist/graphlib-CCKThIKP.js +1104 -0
- package/dist/graphlib-Du-578Js.cjs +1 -0
- package/dist/{icon-C_ENrJ3F.js → icon-GZrfSeon.js} +77 -25
- package/dist/icon.js +1 -1
- package/dist/icons.js +1 -1
- package/dist/iife/button.iife.js +1 -1
- package/dist/iife/card.iife.js +1 -1
- package/dist/iife/checkbox.iife.js +1 -1
- package/dist/iife/colorpicker.iife.js +2 -2
- package/dist/iife/content.iife.js +1 -0
- package/dist/iife/dropdown.iife.js +1 -1
- package/dist/iife/form.iife.js +1 -1
- package/dist/iife/glass.iife.js +1 -0
- package/dist/iife/icon.iife.js +1 -1
- package/dist/iife/image.iife.js +1 -1
- package/dist/iife/input.iife.js +1 -1
- package/dist/iife/loading.iife.js +1 -1
- package/dist/iife/math.iife.js +14 -14
- package/dist/iife/mermaid.iife.js +3535 -0
- package/dist/iife/message.iife.js +1 -1
- package/dist/iife/modal.iife.js +1 -1
- package/dist/iife/player.iife.js +8 -8
- package/dist/iife/popover.iife.js +1 -1
- package/dist/iife/progress.iife.js +1 -1
- package/dist/iife/radar.iife.js +1 -1
- package/dist/iife/route.iife.js +1 -1
- package/dist/iife/router.iife.js +1 -1
- package/dist/iife/scratch.iife.js +1 -1
- package/dist/iife/section.iife.js +1 -1
- package/dist/iife/select.iife.js +2 -2
- package/dist/iife/skeleton.iife.js +1 -1
- package/dist/iife/tab.iife.js +1 -1
- package/dist/iife/tabpane.iife.js +1 -1
- package/dist/iife/theme-switch.iife.js +1 -1
- package/dist/{image-B7MBI5n_.js → image-CqoQfJoV.js} +4 -4
- package/dist/image.js +1 -1
- package/dist/index.cjs +38 -37
- package/dist/index.d.ts +8 -0
- package/dist/index.iife.js +3623 -88
- package/dist/index.js +88 -84
- package/dist/info-DKCQHKI2-DNOtUIin.cjs +1 -0
- package/dist/info-DKCQHKI2-Df7h9MSE.js +5 -0
- package/dist/infoDiagram-FWYZ7A6U-C8dZc-Ki.cjs +2 -0
- package/dist/infoDiagram-FWYZ7A6U-Dc0m9qAx.js +21 -0
- package/dist/init-1VpIn1S3.js +16 -0
- package/dist/init-CbDwVtpO.cjs +1 -0
- package/dist/{input-RNqdEHPf.js → input-BlwAXu7I.js} +6 -6
- package/dist/input.js +1 -1
- package/dist/ishikawaDiagram-FXEZZL3T-BugNyysB.cjs +70 -0
- package/dist/ishikawaDiagram-FXEZZL3T-DuFtHOmf.js +742 -0
- package/dist/journeyDiagram-5HDEW3XC-Bshelnhq.js +928 -0
- package/dist/journeyDiagram-5HDEW3XC-ItmURvA2.cjs +139 -0
- package/dist/kanban-definition-HUTT4EX6-BL512R2A.cjs +89 -0
- package/dist/kanban-definition-HUTT4EX6-Dogv2paU.js +1050 -0
- package/dist/katex-Cq3Y8cmK.cjs +257 -0
- package/dist/katex-Pg2EqTH0.js +23485 -0
- package/dist/line-BIPmUVxO.js +33 -0
- package/dist/line-CAB5QHC6.cjs +1 -0
- package/dist/linear-B2AM4ZBe.js +259 -0
- package/dist/linear-CSAfNEpl.cjs +1 -0
- package/dist/{link-DURZzd7u.js → link-BCrmHvXP.js} +3 -3
- package/dist/link.js +1 -1
- package/dist/{loading-B9MFI03l.js → loading-M6gWxLbm.js} +4 -4
- package/dist/loading.js +1 -1
- package/dist/map-BC2bk_rV.cjs +1 -0
- package/dist/map-DMSWkcq6.js +208 -0
- package/dist/{math-CudIwEXZ.js → math-8E-45Y8e.js} +4 -4
- package/dist/math.js +1 -1
- package/dist/mermaid-C1oQyPE3.js +261 -0
- package/dist/mermaid-parser.core-DYumW1vq.cjs +6 -0
- package/dist/mermaid-parser.core-uIDZYuBu.js +654 -0
- package/dist/mermaid.core-B2d5lQW2.js +1085 -0
- package/dist/mermaid.core-a1hgpWfs.cjs +10 -0
- package/dist/mermaid.js +5 -0
- package/dist/{message-DW7qWpEm.js → message-CNdmbeLf.js} +6 -6
- package/dist/message.js +1 -1
- package/dist/mindmap-definition-LN4V7U3C-DYZgIZym.cjs +96 -0
- package/dist/mindmap-definition-LN4V7U3C-f7s5ZePP.js +1070 -0
- package/dist/{modal-CrvGKL2B.js → modal-gRagDkTb.js} +40 -24
- package/dist/modal.js +1 -1
- package/dist/ordinal-BMN81JG2.js +64 -0
- package/dist/ordinal-BplLHIij.cjs +1 -0
- package/dist/packet-7NZHBO7P-4PLslLZJ.js +5 -0
- package/dist/packet-7NZHBO7P-DeyLCrSn.cjs +1 -0
- package/dist/path-Bja5PoYn.js +82 -0
- package/dist/path-DmfWsuKi.cjs +1 -0
- package/dist/pegDiagram-2B236MQR-B-Xeh55J.js +107 -0
- package/dist/pegDiagram-2B236MQR-Bo5Nj40u.cjs +1 -0
- package/dist/pie-RZYD4A2V-DBE9a8Kz.js +5 -0
- package/dist/pie-RZYD4A2V-pDNZ2ZyB.cjs +1 -0
- package/dist/pieDiagram-ENE6RG2P-BkSiP4iu.cjs +39 -0
- package/dist/pieDiagram-ENE6RG2P-CVSE95zc.js +207 -0
- package/dist/{player-BKQaaT7o.js → player-CAQ5Og2P.js} +196 -195
- package/dist/player.js +1 -1
- package/dist/{popover-CvYIVgUS.js → popover-BZKSLe3D.js} +22 -54
- package/dist/popover.js +1 -1
- package/dist/{progress-C6jctsFH.js → progress-vk40tuhm.js} +5 -5
- package/dist/progress.js +1 -1
- package/dist/quadrantDiagram-ABIIQ3AL-BDmdDGsh.cjs +7 -0
- package/dist/quadrantDiagram-ABIIQ3AL-TJ8FmqES.js +2058 -0
- package/dist/{radar-BUb4EzmG.js → radar-Bg0cexzU.js} +5 -5
- package/dist/radar-I7S5WNFK-CY5ycn2a.cjs +1 -0
- package/dist/radar-I7S5WNFK-DFTxtd_t.js +5 -0
- package/dist/radar.js +1 -1
- package/dist/railroad-3IZDKUUU-DALJwv16.js +5 -0
- package/dist/railroad-3IZDKUUU-DGzXHqt7.cjs +1 -0
- package/dist/railroad-abnf-AHOZXSZD-BCIHdSw6.cjs +1 -0
- package/dist/railroad-abnf-AHOZXSZD-CntW2udQ.js +5 -0
- package/dist/railroad-ebnf-EBAXGLYW-4vFZrfHF.cjs +1 -0
- package/dist/railroad-ebnf-EBAXGLYW-s_1ZOb_9.js +5 -0
- package/dist/railroad-peg-LSFZ7HO6-CaM5A0Ml.js +5 -0
- package/dist/railroad-peg-LSFZ7HO6-D_oFW1Bo.cjs +1 -0
- package/dist/railroadDiagram-RFXS5EU6-0lS5wYI7.js +83 -0
- package/dist/railroadDiagram-RFXS5EU6-DJKAtnQk.cjs +1 -0
- package/dist/ranui.css +1 -1
- package/dist/requirementDiagram-TGXJPOKE-Bg701bNl.cjs +84 -0
- package/dist/requirementDiagram-TGXJPOKE-viCQLyJd.js +2301 -0
- package/dist/rolldown-runtime-9ZSF5uba.js +16 -0
- package/dist/rolldown-runtime-CAnuVJ4g.cjs +1 -0
- package/dist/rough.esm-BWe9E0Nz.js +1387 -0
- package/dist/rough.esm-BfSi6CZE.cjs +1 -0
- package/dist/{route-Djrf9UR_.js → route-CGwS0cd_.js} +10 -10
- package/dist/route.js +1 -1
- package/dist/{router-BU2KhtxV.js → router-BK6DEkcN.js} +5 -5
- package/dist/router.js +1 -1
- package/dist/sankeyDiagram-HTMAVEWB-CV6_AuMF.js +974 -0
- package/dist/sankeyDiagram-HTMAVEWB-K-nGMsuS.cjs +40 -0
- package/dist/{scratch-CO4I2dIa.js → scratch-ClF1awGi.js} +2 -2
- package/dist/scratch.js +1 -1
- package/dist/{section-CsUkp8bv.js → section-BL0V7Kjf.js} +2 -2
- package/dist/section.js +1 -1
- package/dist/{select-Dn26ajJZ.js → select-BIFVbQIj.js} +13 -13
- package/dist/select.js +1 -1
- package/dist/sequenceDiagram-DBY2YBRQ-4GdkLnUr.cjs +162 -0
- package/dist/sequenceDiagram-DBY2YBRQ-B9WNesh2.js +4326 -0
- package/dist/sizeCapture-X5ZJPWSS-BUY3-n09.cjs +1 -0
- package/dist/sizeCapture-X5ZJPWSS-D7rGsqTl.js +48 -0
- package/dist/{skeleton-BuMLhvzQ.js → skeleton-D7JIbROq.js} +5 -5
- package/dist/skeleton.js +1 -1
- package/dist/src-C9EhKhbk.cjs +1 -0
- package/dist/src-DtRLxcYO.js +2104 -0
- package/dist/stateDiagram-2N3HPSRC-B7VpgjJu.cjs +1 -0
- package/dist/stateDiagram-2N3HPSRC-DxH4BMSh.js +237 -0
- package/dist/stateDiagram-v2-6OUMAXLB-CQv7GIaO.cjs +1 -0
- package/dist/stateDiagram-v2-6OUMAXLB-CWfn6e7n.js +30 -0
- package/dist/swimlanes-5IMT3BWC-DcADNGpg.js +5258 -0
- package/dist/swimlanes-5IMT3BWC-o-MjdPlw.cjs +1 -0
- package/dist/swimlanesDiagram-G3AALYLV-D-rmAGky.cjs +8 -0
- package/dist/swimlanesDiagram-G3AALYLV-DDtDtl1L.js +31 -0
- package/dist/{tab-40fDkuox.js → tab-DFVtDJb2.js} +5 -5
- package/dist/tab.js +1 -1
- package/dist/{tabpane-F4Pd7JtC.js → tabpane-C3qZGN-D.js} +5 -5
- package/dist/tabpane.js +1 -1
- package/dist/test/ssr/stream.test.d.ts +1 -0
- package/dist/{theme-switch-B09egc6h.js → theme-switch-BXNH5uPD.js} +45 -45
- package/dist/theme-switch.js +1 -1
- package/dist/timeline-definition-FHXFAJF6-C80VjPLh.js +1119 -0
- package/dist/timeline-definition-FHXFAJF6-DOwvOb3S.cjs +120 -0
- package/dist/treeView-QDETBFTQ-B1Ejxfpg.cjs +1 -0
- package/dist/treeView-QDETBFTQ-vTKOZls1.js +5 -0
- package/dist/treemap-6X3UGDF4-D0FeO_NX.cjs +1 -0
- package/dist/treemap-6X3UGDF4-Ddzv6Gqd.js +5 -0
- package/dist/utils/builder/core.d.ts +135 -3
- package/dist/utils/builder/index.d.ts +1 -1
- package/dist/{utils-DBfrRFoE.js → utils-D1iZnChu.js} +38 -31
- package/dist/vennDiagram-L72KCM5P-BYHB7OW8.js +1955 -0
- package/dist/vennDiagram-L72KCM5P-CidVJK6y.cjs +34 -0
- package/dist/wardley-OPB4EBWU-C1hXbbD4.cjs +1 -0
- package/dist/wardley-OPB4EBWU-DBgFLc64.js +5 -0
- package/dist/wardleyDiagram-EHGQE667--ubmCaWM.js +652 -0
- package/dist/wardleyDiagram-EHGQE667-K6ckkRZS.cjs +78 -0
- package/dist/xychartDiagram-FW5EYKEG-CzdokxrM.cjs +7 -0
- package/dist/xychartDiagram-FW5EYKEG-DLqWcTPt.js +2154 -0
- package/docs/BUILDER.md +170 -2
- package/package.json +7 -1
- package/dist/button-BfYw0fes.js +0 -117
- package/dist/factory-DCrO37si.js +0 -334
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { n as c } from "./chunk-Y2CYZVJY-0JxdZxki.js";
|
|
2
|
+
import { m as x } from "./src-DtRLxcYO.js";
|
|
3
|
+
import { D as P, a as L, b as W, c as I, x as X, z as H } from "./chunk-WYO6CB5R-DDHkKowO.js";
|
|
4
|
+
import { t as q } from "./chunk-VAUOI2AC-izt0o4id.js";
|
|
5
|
+
var N = "", $ = "", z = "", b = [], R = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ c((e) => H(e, X()), "sanitizeText"), v = /* @__PURE__ */ c((e) => {
|
|
6
|
+
switch (e.type) {
|
|
7
|
+
case "terminal":
|
|
8
|
+
return {
|
|
9
|
+
...e,
|
|
10
|
+
value: S(e.value)
|
|
11
|
+
};
|
|
12
|
+
case "nonterminal":
|
|
13
|
+
return {
|
|
14
|
+
...e,
|
|
15
|
+
name: S(e.name)
|
|
16
|
+
};
|
|
17
|
+
case "sequence":
|
|
18
|
+
return {
|
|
19
|
+
...e,
|
|
20
|
+
elements: e.elements.map(v)
|
|
21
|
+
};
|
|
22
|
+
case "choice":
|
|
23
|
+
return {
|
|
24
|
+
...e,
|
|
25
|
+
alternatives: e.alternatives.map(v)
|
|
26
|
+
};
|
|
27
|
+
case "optional":
|
|
28
|
+
return {
|
|
29
|
+
...e,
|
|
30
|
+
element: v(e.element)
|
|
31
|
+
};
|
|
32
|
+
case "repetition":
|
|
33
|
+
return {
|
|
34
|
+
...e,
|
|
35
|
+
element: v(e.element),
|
|
36
|
+
separator: e.separator ? v(e.separator) : void 0
|
|
37
|
+
};
|
|
38
|
+
case "special":
|
|
39
|
+
return {
|
|
40
|
+
...e,
|
|
41
|
+
text: S(e.text)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}, "sanitizeAstNode"), U = /* @__PURE__ */ c(() => {
|
|
45
|
+
N = "", $ = "", z = "", b.length = 0, R.clear(), L(), x.debug("[Railroad] Database cleared");
|
|
46
|
+
}, "clear"), O = /* @__PURE__ */ c((e) => {
|
|
47
|
+
N = S(e), x.debug("[Railroad] Title set:", e);
|
|
48
|
+
}, "setTitle"), D = /* @__PURE__ */ c(() => N, "getTitle"), G = {
|
|
49
|
+
clear: U,
|
|
50
|
+
setTitle: O,
|
|
51
|
+
getTitle: D,
|
|
52
|
+
addRule: /* @__PURE__ */ c((e) => {
|
|
53
|
+
const n = {
|
|
54
|
+
...e,
|
|
55
|
+
name: S(e.name),
|
|
56
|
+
definition: v(e.definition),
|
|
57
|
+
comment: e.comment ? S(e.comment) : void 0
|
|
58
|
+
};
|
|
59
|
+
x.debug("[Railroad] Adding rule:", n.name), R.has(n.name) && x.warn(`[Railroad] Rule '${n.name}' is already defined. Overwriting.`), b.push(n), R.set(n.name, n);
|
|
60
|
+
}, "addRule"),
|
|
61
|
+
getRules: /* @__PURE__ */ c(() => b, "getRules"),
|
|
62
|
+
getRule: /* @__PURE__ */ c((e) => R.get(e), "getRule"),
|
|
63
|
+
setAccTitle: /* @__PURE__ */ c((e) => {
|
|
64
|
+
$ = S(e).replace(/^\s+/g, ""), x.debug("[Railroad] Accessibility title set:", e);
|
|
65
|
+
}, "setAccTitle"),
|
|
66
|
+
getAccTitle: /* @__PURE__ */ c(() => $, "getAccTitle"),
|
|
67
|
+
setAccDescription: /* @__PURE__ */ c((e) => {
|
|
68
|
+
z = S(e).replace(/\n\s+/g, `
|
|
69
|
+
`), x.debug("[Railroad] Accessibility description set:", e);
|
|
70
|
+
}, "setAccDescription"),
|
|
71
|
+
getAccDescription: /* @__PURE__ */ c(() => z, "getAccDescription"),
|
|
72
|
+
setDiagramTitle: O,
|
|
73
|
+
getDiagramTitle: D
|
|
74
|
+
}, f = {
|
|
75
|
+
compactMode: !1,
|
|
76
|
+
padding: 10,
|
|
77
|
+
verticalSeparation: 8,
|
|
78
|
+
horizontalSeparation: 10,
|
|
79
|
+
arcRadius: 10,
|
|
80
|
+
fontSize: 14,
|
|
81
|
+
fontFamily: "monospace",
|
|
82
|
+
terminalFill: "#FFFFC0",
|
|
83
|
+
terminalStroke: "#000000",
|
|
84
|
+
terminalTextColor: "#000000",
|
|
85
|
+
nonTerminalFill: "#FFFFFF",
|
|
86
|
+
nonTerminalStroke: "#000000",
|
|
87
|
+
nonTerminalTextColor: "#000000",
|
|
88
|
+
lineColor: "#000000",
|
|
89
|
+
strokeWidth: 2,
|
|
90
|
+
markerFill: "#000000",
|
|
91
|
+
commentFill: "#E8E8E8",
|
|
92
|
+
commentStroke: "#888888",
|
|
93
|
+
commentTextColor: "#666666",
|
|
94
|
+
specialFill: "#F0E0FF",
|
|
95
|
+
specialStroke: "#8800CC",
|
|
96
|
+
ruleNameColor: "#000066",
|
|
97
|
+
showMarkers: !0,
|
|
98
|
+
markerRadius: 5
|
|
99
|
+
}, j = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i, K = /^[\w "',.-]+$/, J = /* @__PURE__ */ new Set([
|
|
100
|
+
"compactMode",
|
|
101
|
+
"padding",
|
|
102
|
+
"verticalSeparation",
|
|
103
|
+
"horizontalSeparation",
|
|
104
|
+
"arcRadius",
|
|
105
|
+
"fontSize",
|
|
106
|
+
"fontFamily",
|
|
107
|
+
"terminalFill",
|
|
108
|
+
"terminalStroke",
|
|
109
|
+
"terminalTextColor",
|
|
110
|
+
"nonTerminalFill",
|
|
111
|
+
"nonTerminalStroke",
|
|
112
|
+
"nonTerminalTextColor",
|
|
113
|
+
"lineColor",
|
|
114
|
+
"strokeWidth",
|
|
115
|
+
"markerFill",
|
|
116
|
+
"commentFill",
|
|
117
|
+
"commentStroke",
|
|
118
|
+
"commentTextColor",
|
|
119
|
+
"specialFill",
|
|
120
|
+
"specialStroke",
|
|
121
|
+
"ruleNameColor",
|
|
122
|
+
"showMarkers",
|
|
123
|
+
"markerRadius"
|
|
124
|
+
]), _ = /* @__PURE__ */ c((e) => e ? Object.keys(e).every((n) => n === "railroad" || J.has(n)) : !1, "isRailroadStyleOptions"), Q = /* @__PURE__ */ c((e) => e ? "railroad" in e && e.railroad ? e.railroad : _(e) ? e : {} : {}, "extractRailroadOverrides"), Z = /* @__PURE__ */ c((e) => {
|
|
125
|
+
if (!e || _(e)) return {};
|
|
126
|
+
const { railroad: n, svgId: r, theme: t, look: i, ...a } = e;
|
|
127
|
+
return a;
|
|
128
|
+
}, "extractThemeOverrides"), d = /* @__PURE__ */ c((e, n) => {
|
|
129
|
+
if (typeof e != "string") return n;
|
|
130
|
+
const r = e.trim();
|
|
131
|
+
return j.test(r) ? r : n;
|
|
132
|
+
}, "sanitizeColorValue"), B = /* @__PURE__ */ c((e, n) => {
|
|
133
|
+
if (typeof e != "string") return n;
|
|
134
|
+
const r = e.trim();
|
|
135
|
+
return K.test(r) ? r : n;
|
|
136
|
+
}, "sanitizeFontFamilyValue"), F = /* @__PURE__ */ c((e, n) => {
|
|
137
|
+
const r = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : NaN;
|
|
138
|
+
return Number.isFinite(r) && r >= 0 ? r : n;
|
|
139
|
+
}, "sanitizeNumberValue"), V = /* @__PURE__ */ c((e) => {
|
|
140
|
+
const n = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : NaN;
|
|
141
|
+
return Number.isFinite(n) && n > 0 ? n : void 0;
|
|
142
|
+
}, "parseThemeFontSize"), ee = /* @__PURE__ */ c((e) => {
|
|
143
|
+
const n = B(e.fontFamily, f.fontFamily), r = V(e.fontSize) ?? f.fontSize;
|
|
144
|
+
return {
|
|
145
|
+
...f,
|
|
146
|
+
fontFamily: n,
|
|
147
|
+
fontSize: r,
|
|
148
|
+
terminalFill: d(e.secondBkg ?? e.secondaryColor, f.terminalFill),
|
|
149
|
+
terminalStroke: d(e.secondaryBorderColor ?? e.lineColor, f.terminalStroke),
|
|
150
|
+
terminalTextColor: d(e.secondaryTextColor ?? e.textColor, f.terminalTextColor),
|
|
151
|
+
nonTerminalFill: d(e.mainBkg ?? e.background, f.nonTerminalFill),
|
|
152
|
+
nonTerminalStroke: d(e.primaryBorderColor ?? e.lineColor, f.nonTerminalStroke),
|
|
153
|
+
nonTerminalTextColor: d(e.primaryTextColor ?? e.textColor, f.nonTerminalTextColor),
|
|
154
|
+
lineColor: d(e.lineColor, f.lineColor),
|
|
155
|
+
markerFill: d(e.lineColor, f.markerFill),
|
|
156
|
+
commentFill: d(e.labelBackground ?? e.tertiaryColor, f.commentFill),
|
|
157
|
+
commentStroke: d(e.tertiaryBorderColor ?? e.lineColor, f.commentStroke),
|
|
158
|
+
commentTextColor: d(e.tertiaryTextColor ?? e.textColor, f.commentTextColor),
|
|
159
|
+
specialFill: d(e.tertiaryColor ?? e.secondaryColor, f.specialFill),
|
|
160
|
+
specialStroke: d(e.tertiaryBorderColor ?? e.secondaryBorderColor, f.specialStroke),
|
|
161
|
+
ruleNameColor: d(e.titleColor ?? e.textColor, f.ruleNameColor)
|
|
162
|
+
};
|
|
163
|
+
}, "buildThemeDefaults"), A = /* @__PURE__ */ c((e) => {
|
|
164
|
+
const n = W(), r = ee({
|
|
165
|
+
...P(),
|
|
166
|
+
...n.themeVariables ?? {},
|
|
167
|
+
...Z(e)
|
|
168
|
+
}), t = {
|
|
169
|
+
...n.railroad ?? {},
|
|
170
|
+
...Q(e)
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
compactMode: t.compactMode ?? r.compactMode,
|
|
174
|
+
padding: F(t.padding, r.padding),
|
|
175
|
+
verticalSeparation: F(t.verticalSeparation, r.verticalSeparation),
|
|
176
|
+
horizontalSeparation: F(t.horizontalSeparation, r.horizontalSeparation),
|
|
177
|
+
arcRadius: F(t.arcRadius, r.arcRadius),
|
|
178
|
+
fontSize: F(t.fontSize, r.fontSize),
|
|
179
|
+
fontFamily: B(t.fontFamily, r.fontFamily),
|
|
180
|
+
terminalFill: d(t.terminalFill, r.terminalFill),
|
|
181
|
+
terminalStroke: d(t.terminalStroke, r.terminalStroke),
|
|
182
|
+
terminalTextColor: d(t.terminalTextColor, r.terminalTextColor),
|
|
183
|
+
nonTerminalFill: d(t.nonTerminalFill, r.nonTerminalFill),
|
|
184
|
+
nonTerminalStroke: d(t.nonTerminalStroke, r.nonTerminalStroke),
|
|
185
|
+
nonTerminalTextColor: d(t.nonTerminalTextColor, r.nonTerminalTextColor),
|
|
186
|
+
lineColor: d(t.lineColor, r.lineColor),
|
|
187
|
+
strokeWidth: F(t.strokeWidth, r.strokeWidth),
|
|
188
|
+
markerFill: d(t.markerFill, r.markerFill),
|
|
189
|
+
commentFill: d(t.commentFill, r.commentFill),
|
|
190
|
+
commentStroke: d(t.commentStroke, r.commentStroke),
|
|
191
|
+
commentTextColor: d(t.commentTextColor, r.commentTextColor),
|
|
192
|
+
specialFill: d(t.specialFill, r.specialFill),
|
|
193
|
+
specialStroke: d(t.specialStroke, r.specialStroke),
|
|
194
|
+
ruleNameColor: d(t.ruleNameColor, r.ruleNameColor),
|
|
195
|
+
showMarkers: t.showMarkers ?? r.showMarkers,
|
|
196
|
+
markerRadius: F(t.markerRadius, r.markerRadius)
|
|
197
|
+
};
|
|
198
|
+
}, "buildRailroadStyleOptions"), oe = /* @__PURE__ */ c((e) => {
|
|
199
|
+
const { fontFamily: n, fontSize: r, terminalFill: t, terminalStroke: i, terminalTextColor: a, nonTerminalFill: p, nonTerminalStroke: s, nonTerminalTextColor: l, lineColor: u, strokeWidth: o, markerFill: g, commentFill: m, commentStroke: h, commentTextColor: C, specialFill: k, specialStroke: w, ruleNameColor: y } = A(e);
|
|
200
|
+
return `
|
|
201
|
+
.railroad-diagram {
|
|
202
|
+
font-family: ${n};
|
|
203
|
+
font-size: ${r}px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.railroad-terminal rect {
|
|
207
|
+
fill: ${t};
|
|
208
|
+
stroke: ${i};
|
|
209
|
+
stroke-width: ${o}px;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.railroad-terminal text {
|
|
213
|
+
fill: ${a};
|
|
214
|
+
font-family: ${n};
|
|
215
|
+
font-size: ${r}px;
|
|
216
|
+
text-anchor: middle;
|
|
217
|
+
dominant-baseline: middle;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.railroad-nonterminal rect {
|
|
221
|
+
fill: ${p};
|
|
222
|
+
stroke: ${s};
|
|
223
|
+
stroke-width: ${o}px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.railroad-nonterminal text {
|
|
227
|
+
fill: ${l};
|
|
228
|
+
font-family: ${n};
|
|
229
|
+
font-size: ${r}px;
|
|
230
|
+
text-anchor: middle;
|
|
231
|
+
dominant-baseline: middle;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.railroad-line {
|
|
235
|
+
stroke: ${u};
|
|
236
|
+
stroke-width: ${o}px;
|
|
237
|
+
fill: none;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.railroad-start circle,
|
|
241
|
+
.railroad-end circle {
|
|
242
|
+
fill: ${g};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.railroad-comment ellipse {
|
|
246
|
+
fill: ${m};
|
|
247
|
+
stroke: ${h};
|
|
248
|
+
stroke-width: ${o}px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.railroad-comment text {
|
|
252
|
+
fill: ${C};
|
|
253
|
+
font-style: italic;
|
|
254
|
+
font-family: ${n};
|
|
255
|
+
font-size: ${r}px;
|
|
256
|
+
text-anchor: middle;
|
|
257
|
+
dominant-baseline: middle;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.railroad-special rect {
|
|
261
|
+
fill: ${k};
|
|
262
|
+
stroke: ${w};
|
|
263
|
+
stroke-width: ${o}px;
|
|
264
|
+
stroke-dasharray: 5,3;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.railroad-special text {
|
|
268
|
+
fill: ${l};
|
|
269
|
+
font-family: ${n};
|
|
270
|
+
font-size: ${r}px;
|
|
271
|
+
text-anchor: middle;
|
|
272
|
+
dominant-baseline: middle;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.railroad-rule-name {
|
|
276
|
+
font-weight: bold;
|
|
277
|
+
fill: ${y};
|
|
278
|
+
font-family: ${n};
|
|
279
|
+
font-size: ${r}px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.railroad-group {
|
|
283
|
+
/* Grouping container, no specific styles */
|
|
284
|
+
}
|
|
285
|
+
`;
|
|
286
|
+
}, "getStyles"), T = class {
|
|
287
|
+
constructor() {
|
|
288
|
+
this.d = "";
|
|
289
|
+
}
|
|
290
|
+
static {
|
|
291
|
+
c(this, "PathBuilder");
|
|
292
|
+
}
|
|
293
|
+
moveTo(e, n) {
|
|
294
|
+
return this.d += `M ${e} ${n} `, this;
|
|
295
|
+
}
|
|
296
|
+
lineTo(e, n) {
|
|
297
|
+
return this.d += `L ${e} ${n} `, this;
|
|
298
|
+
}
|
|
299
|
+
horizontalTo(e) {
|
|
300
|
+
return this.d += `H ${e} `, this;
|
|
301
|
+
}
|
|
302
|
+
verticalTo(e) {
|
|
303
|
+
return this.d += `V ${e} `, this;
|
|
304
|
+
}
|
|
305
|
+
arcTo(e, n, r, t, i, a, p) {
|
|
306
|
+
return this.d += `A ${e} ${n} ${r} ${t ? 1 : 0} ${i ? 1 : 0} ${a} ${p} `, this;
|
|
307
|
+
}
|
|
308
|
+
build() {
|
|
309
|
+
return this.d.trim();
|
|
310
|
+
}
|
|
311
|
+
}, te = class {
|
|
312
|
+
constructor(e, n = A()) {
|
|
313
|
+
this.textCache = /* @__PURE__ */ new Map(), this.svg = e, this.config = n;
|
|
314
|
+
}
|
|
315
|
+
static {
|
|
316
|
+
c(this, "RailroadRenderer");
|
|
317
|
+
}
|
|
318
|
+
measureText(e) {
|
|
319
|
+
if (this.textCache.has(e)) return this.textCache.get(e);
|
|
320
|
+
const n = this.svg.append("text").attr("font-family", this.config.fontFamily).attr("font-size", this.config.fontSize).text(e), r = n.node().getBBox(), t = {
|
|
321
|
+
width: r.width,
|
|
322
|
+
height: r.height
|
|
323
|
+
};
|
|
324
|
+
return n.remove(), this.textCache.set(e, t), t;
|
|
325
|
+
}
|
|
326
|
+
renderTerminal(e, n) {
|
|
327
|
+
const r = this.measureText(n), t = r.width + this.config.padding * 2, i = r.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-terminal");
|
|
328
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", i).attr("rx", 10).attr("ry", 10), a.append("text").attr("x", t / 2).attr("y", i / 2).text(n), {
|
|
329
|
+
element: a.node(),
|
|
330
|
+
dimensions: {
|
|
331
|
+
width: t,
|
|
332
|
+
height: i,
|
|
333
|
+
up: i / 2,
|
|
334
|
+
down: i / 2
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
renderNonTerminal(e, n) {
|
|
339
|
+
const r = this.measureText(n), t = r.width + this.config.padding * 2, i = r.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-nonterminal");
|
|
340
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", i), a.append("text").attr("x", t / 2).attr("y", i / 2).text(n), {
|
|
341
|
+
element: a.node(),
|
|
342
|
+
dimensions: {
|
|
343
|
+
width: t,
|
|
344
|
+
height: i,
|
|
345
|
+
up: i / 2,
|
|
346
|
+
down: i / 2
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
renderSequence(e, n) {
|
|
351
|
+
const r = n.map((l) => this.renderExpression(e, l));
|
|
352
|
+
let t = 0, i = 0, a = 0;
|
|
353
|
+
for (const l of r)
|
|
354
|
+
t += l.dimensions.width, i = Math.max(i, l.dimensions.up), a = Math.max(a, l.dimensions.down);
|
|
355
|
+
t += (r.length - 1) * this.config.horizontalSeparation;
|
|
356
|
+
const p = e.append("g").attr("class", "railroad-sequence");
|
|
357
|
+
let s = 0;
|
|
358
|
+
for (let l = 0; l < r.length; l++) {
|
|
359
|
+
const u = r[l], o = i - u.dimensions.up;
|
|
360
|
+
if (p.node().appendChild(u.element).setAttribute("transform", `translate(${s}, ${o})`), l < r.length - 1) {
|
|
361
|
+
const g = s + u.dimensions.width, m = g + this.config.horizontalSeparation, h = i;
|
|
362
|
+
p.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(g, h).lineTo(m, h).build());
|
|
363
|
+
}
|
|
364
|
+
s += u.dimensions.width + this.config.horizontalSeparation;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
element: p.node(),
|
|
368
|
+
dimensions: {
|
|
369
|
+
width: t,
|
|
370
|
+
height: i + a,
|
|
371
|
+
up: i,
|
|
372
|
+
down: a
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
renderChoice(e, n) {
|
|
377
|
+
const r = n.map((g) => this.renderExpression(e, g));
|
|
378
|
+
let t = 0, i = 0;
|
|
379
|
+
for (const g of r)
|
|
380
|
+
t = Math.max(t, g.dimensions.width), i += g.dimensions.height;
|
|
381
|
+
i += (r.length - 1) * this.config.verticalSeparation;
|
|
382
|
+
const a = this.config.arcRadius, p = a * 4, s = t + p, l = e.append("g").attr("class", "railroad-choice");
|
|
383
|
+
let u = 0;
|
|
384
|
+
const o = i / 2;
|
|
385
|
+
for (const g of r) {
|
|
386
|
+
const m = u, h = m + g.dimensions.up, C = a * 2 + (t - g.dimensions.width) / 2;
|
|
387
|
+
l.node().appendChild(g.element).setAttribute("transform", `translate(${C}, ${m})`);
|
|
388
|
+
const k = new T(), w = h > o;
|
|
389
|
+
h === o ? k.moveTo(0, o).lineTo(C, h) : k.moveTo(0, o).arcTo(a, a, 0, !1, w, a, o + (w ? a : -a)).lineTo(a, h - (w ? a : -a)).arcTo(a, a, 0, !1, !w, a * 2, h).lineTo(C, h), l.append("path").attr("class", "railroad-line").attr("d", k.build());
|
|
390
|
+
const y = new T(), M = C + g.dimensions.width, Y = s - a * 2;
|
|
391
|
+
h === o ? y.moveTo(M, h).lineTo(s, o) : y.moveTo(M, h).lineTo(Y, h).arcTo(a, a, 0, !1, !w, s - a, h + (w ? -a : a)).lineTo(s - a, o + (w ? a : -a)).arcTo(a, a, 0, !1, w, s, o), l.append("path").attr("class", "railroad-line").attr("d", y.build()), u += g.dimensions.height + this.config.verticalSeparation;
|
|
392
|
+
}
|
|
393
|
+
return {
|
|
394
|
+
element: l.node(),
|
|
395
|
+
dimensions: {
|
|
396
|
+
width: s,
|
|
397
|
+
height: i,
|
|
398
|
+
up: o,
|
|
399
|
+
down: i - o
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
renderOptional(e, n) {
|
|
404
|
+
const r = this.renderExpression(e, n), t = this.config.arcRadius, i = t * 2, a = r.dimensions.width + t * 4, p = r.dimensions.height + i, s = e.append("g").attr("class", "railroad-optional"), l = t * 2, u = i;
|
|
405
|
+
s.node().appendChild(r.element).setAttribute("transform", `translate(${l}, ${u})`);
|
|
406
|
+
const o = u + r.dimensions.up, g = new T().moveTo(0, o).lineTo(t * 2, o);
|
|
407
|
+
s.append("path").attr("class", "railroad-line").attr("d", g.build());
|
|
408
|
+
const m = new T().moveTo(l + r.dimensions.width, o).lineTo(a, o);
|
|
409
|
+
s.append("path").attr("class", "railroad-line").attr("d", m.build());
|
|
410
|
+
const h = new T().moveTo(0, o).arcTo(t, t, 0, !1, !1, t, o - t).lineTo(t, t).arcTo(t, t, 0, !1, !0, t * 2, 0).lineTo(a - t * 2, 0).arcTo(t, t, 0, !1, !0, a - t, t).lineTo(a - t, o - t).arcTo(t, t, 0, !1, !1, a, o);
|
|
411
|
+
return s.append("path").attr("class", "railroad-line").attr("d", h.build()), {
|
|
412
|
+
element: s.node(),
|
|
413
|
+
dimensions: {
|
|
414
|
+
width: a,
|
|
415
|
+
height: p,
|
|
416
|
+
up: o,
|
|
417
|
+
down: p - o
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
renderRepetition(e, n, r) {
|
|
422
|
+
const t = this.renderExpression(e, n), i = this.config.arcRadius, a = i * 2, p = t.dimensions.width + i * 4, s = r === 0, l = t.dimensions.height + a + (s ? a : 0), u = e.append("g").attr("class", "railroad-repetition"), o = i * 2, g = s ? a : 0;
|
|
423
|
+
u.node().appendChild(t.element).setAttribute("transform", `translate(${o}, ${g})`);
|
|
424
|
+
const m = g + t.dimensions.up;
|
|
425
|
+
u.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(0, m).lineTo(i * 2, m).build()), u.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(o + t.dimensions.width, m).lineTo(p, m).build());
|
|
426
|
+
const h = g + t.dimensions.height + i, C = new T().moveTo(o + t.dimensions.width, m).arcTo(i, i, 0, !1, !0, o + t.dimensions.width + i, m + i).lineTo(o + t.dimensions.width + i, h).arcTo(i, i, 0, !1, !0, o + t.dimensions.width, h + i).lineTo(i * 2, h + i).arcTo(i, i, 0, !1, !0, i, h).lineTo(i, m + i).arcTo(i, i, 0, !1, !0, i * 2, m);
|
|
427
|
+
if (u.append("path").attr("class", "railroad-line").attr("d", C.build()), s) {
|
|
428
|
+
const k = new T().moveTo(0, m).arcTo(i, i, 0, !1, !1, i, m - i).lineTo(i, i).arcTo(i, i, 0, !1, !0, i * 2, 0).lineTo(p - i * 2, 0).arcTo(i, i, 0, !1, !0, p - i, i).lineTo(p - i, m - i).arcTo(i, i, 0, !1, !1, p, m);
|
|
429
|
+
u.append("path").attr("class", "railroad-line").attr("d", k.build());
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
element: u.node(),
|
|
433
|
+
dimensions: {
|
|
434
|
+
width: p,
|
|
435
|
+
height: l,
|
|
436
|
+
up: m,
|
|
437
|
+
down: l - m
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
renderSpecial(e, n) {
|
|
442
|
+
const r = this.measureText("? " + n + " ?"), t = r.width + this.config.padding * 2, i = r.height + this.config.padding * 2, a = e.append("g").attr("class", "railroad-special");
|
|
443
|
+
return a.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", i), a.append("text").attr("x", t / 2).attr("y", i / 2).text("? " + n + " ?"), {
|
|
444
|
+
element: a.node(),
|
|
445
|
+
dimensions: {
|
|
446
|
+
width: t,
|
|
447
|
+
height: i,
|
|
448
|
+
up: i / 2,
|
|
449
|
+
down: i / 2
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
renderExpression(e, n) {
|
|
454
|
+
switch (n.type) {
|
|
455
|
+
case "terminal":
|
|
456
|
+
return this.renderTerminal(e, n.value);
|
|
457
|
+
case "nonterminal":
|
|
458
|
+
return this.renderNonTerminal(e, n.name);
|
|
459
|
+
case "sequence":
|
|
460
|
+
return this.renderSequence(e, n.elements);
|
|
461
|
+
case "choice":
|
|
462
|
+
return this.renderChoice(e, n.alternatives);
|
|
463
|
+
case "optional":
|
|
464
|
+
return this.renderOptional(e, n.element);
|
|
465
|
+
case "repetition":
|
|
466
|
+
return this.renderRepetition(e, n.element, n.min);
|
|
467
|
+
case "special":
|
|
468
|
+
return this.renderSpecial(e, n.text);
|
|
469
|
+
default:
|
|
470
|
+
throw new Error(`Unknown node type: ${n.type}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
renderRule(e, n) {
|
|
474
|
+
const r = this.svg.append("g").attr("class", "railroad-rule").attr("transform", `translate(0, ${n})`), t = e.name + " =", i = this.measureText(t).width + 20, a = i + 20, p = r.append("g"), s = this.renderExpression(p, e.definition), l = Math.max(20, s.dimensions.up), u = l - s.dimensions.up;
|
|
475
|
+
return p.attr("transform", `translate(${a}, ${u})`), r.append("g").attr("class", "railroad-rule-name-group").append("text").attr("class", "railroad-rule-name").attr("x", 0).attr("y", l).text(t), r.append("g").attr("class", "railroad-start").append("circle").attr("cx", i).attr("cy", l).attr("r", this.config.markerRadius), r.append("g").attr("class", "railroad-end").append("circle").attr("cx", a + s.dimensions.width + 10).attr("cy", l).attr("r", this.config.markerRadius), r.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(i + this.config.markerRadius, l).lineTo(a, l).build()), r.append("path").attr("class", "railroad-line").attr("d", new T().moveTo(a + s.dimensions.width, l).lineTo(a + s.dimensions.width + 10 - this.config.markerRadius, l).build()), {
|
|
476
|
+
height: Math.max(40, u + s.dimensions.height + this.config.padding * 2),
|
|
477
|
+
width: a + s.dimensions.width + 10 + this.config.markerRadius
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
renderDiagram(e) {
|
|
481
|
+
let n = this.config.padding, r = 0;
|
|
482
|
+
for (const t of e) {
|
|
483
|
+
const i = this.renderRule(t, n);
|
|
484
|
+
n += i.height + this.config.verticalSeparation, r = Math.max(r, i.width);
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
width: r + this.config.padding * 2,
|
|
488
|
+
height: n + this.config.padding
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}, E = /* @__PURE__ */ c((e, n, r) => {
|
|
492
|
+
I(e, n.height, n.width, r), e.attr("viewBox", `0 0 ${n.width} ${n.height}`);
|
|
493
|
+
}, "configureRailroadSvgSize"), le = { draw: /* @__PURE__ */ c((e, n, r) => {
|
|
494
|
+
x.debug(`[Railroad] Rendering diagram
|
|
495
|
+
` + e);
|
|
496
|
+
try {
|
|
497
|
+
const t = q(n);
|
|
498
|
+
t.attr("class", "railroad-diagram");
|
|
499
|
+
const i = W().railroad?.useMaxWidth ?? !0, a = G.getRules();
|
|
500
|
+
if (x.debug(`[Railroad] Rendering ${a.length} rules`), a.length === 0) {
|
|
501
|
+
x.warn("[Railroad] No rules to render"), E(t, {
|
|
502
|
+
height: 100,
|
|
503
|
+
width: 200
|
|
504
|
+
}, i);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
E(t, new te(t, A()).renderDiagram(a), i), x.debug("[Railroad] Render complete");
|
|
508
|
+
} catch (t) {
|
|
509
|
+
throw x.error("[Railroad] Render error:", t), t;
|
|
510
|
+
}
|
|
511
|
+
}, "draw") };
|
|
512
|
+
export {
|
|
513
|
+
oe as n,
|
|
514
|
+
le as r,
|
|
515
|
+
G as t
|
|
516
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const c=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),x=require("./src-C9EhKhbk.cjs"),y=require("./chunk-WYO6CB5R-u4mJNOcO.cjs"),q=require("./chunk-VAUOI2AC-DfQf5L2_.cjs");var A="",$="",z="",b=[],R=new Map,k=c.__name(e=>y.sanitizeText(e,y.getConfig2()),"sanitizeText"),_=c.__name(e=>{switch(e.type){case"terminal":return{...e,value:k(e.value)};case"nonterminal":return{...e,name:k(e.name)};case"sequence":return{...e,elements:e.elements.map(_)};case"choice":return{...e,alternatives:e.alternatives.map(_)};case"optional":return{...e,element:_(e.element)};case"repetition":return{...e,element:_(e.element),separator:e.separator?_(e.separator):void 0};case"special":return{...e,text:k(e.text)}}},"sanitizeAstNode"),L=c.__name(()=>{A="",$="",z="",b.length=0,R.clear(),y.clear(),x.log.debug("[Railroad] Database cleared")},"clear"),M=c.__name(e=>{A=k(e),x.log.debug("[Railroad] Title set:",e)},"setTitle"),D=c.__name(()=>A,"getTitle"),Y={clear:L,setTitle:M,getTitle:D,addRule:c.__name(e=>{const n={...e,name:k(e.name),definition:_(e.definition),comment:e.comment?k(e.comment):void 0};x.log.debug("[Railroad] Adding rule:",n.name),R.has(n.name)&&x.log.warn(`[Railroad] Rule '${n.name}' is already defined. Overwriting.`),b.push(n),R.set(n.name,n)},"addRule"),getRules:c.__name(()=>b,"getRules"),getRule:c.__name(e=>R.get(e),"getRule"),setAccTitle:c.__name(e=>{$=k(e).replace(/^\s+/g,""),x.log.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),getAccTitle:c.__name(()=>$,"getAccTitle"),setAccDescription:c.__name(e=>{z=k(e).replace(/\n\s+/g,`
|
|
2
|
+
`),x.log.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),getAccDescription:c.__name(()=>z,"getAccDescription"),setDiagramTitle:M,getDiagramTitle:D},f={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},I=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,X=/^[\w "',.-]+$/,H=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),W=c.__name(e=>e?Object.keys(e).every(n=>n==="railroad"||H.has(n)):!1,"isRailroadStyleOptions"),U=c.__name(e=>e?"railroad"in e&&e.railroad?e.railroad:W(e)?e:{}:{},"extractRailroadOverrides"),j=c.__name(e=>{if(!e||W(e))return{};const{railroad:n,svgId:r,theme:t,look:i,...a}=e;return a},"extractThemeOverrides"),d=c.__name((e,n)=>{if(typeof e!="string")return n;const r=e.trim();return I.test(r)?r:n},"sanitizeColorValue"),B=c.__name((e,n)=>{if(typeof e!="string")return n;const r=e.trim();return X.test(r)?r:n},"sanitizeFontFamilyValue"),F=c.__name((e,n)=>{const r=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):NaN;return Number.isFinite(r)&&r>=0?r:n},"sanitizeNumberValue"),G=c.__name(e=>{const n=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):NaN;return Number.isFinite(n)&&n>0?n:void 0},"parseThemeFontSize"),J=c.__name(e=>{const n=B(e.fontFamily,f.fontFamily),r=G(e.fontSize)??f.fontSize;return{...f,fontFamily:n,fontSize:r,terminalFill:d(e.secondBkg??e.secondaryColor,f.terminalFill),terminalStroke:d(e.secondaryBorderColor??e.lineColor,f.terminalStroke),terminalTextColor:d(e.secondaryTextColor??e.textColor,f.terminalTextColor),nonTerminalFill:d(e.mainBkg??e.background,f.nonTerminalFill),nonTerminalStroke:d(e.primaryBorderColor??e.lineColor,f.nonTerminalStroke),nonTerminalTextColor:d(e.primaryTextColor??e.textColor,f.nonTerminalTextColor),lineColor:d(e.lineColor,f.lineColor),markerFill:d(e.lineColor,f.markerFill),commentFill:d(e.labelBackground??e.tertiaryColor,f.commentFill),commentStroke:d(e.tertiaryBorderColor??e.lineColor,f.commentStroke),commentTextColor:d(e.tertiaryTextColor??e.textColor,f.commentTextColor),specialFill:d(e.tertiaryColor??e.secondaryColor,f.specialFill),specialStroke:d(e.tertiaryBorderColor??e.secondaryBorderColor,f.specialStroke),ruleNameColor:d(e.titleColor??e.textColor,f.ruleNameColor)}},"buildThemeDefaults"),N=c.__name(e=>{const n=y.getConfig(),r=J({...y.getThemeVariables3(),...n.themeVariables??{},...j(e)}),t={...n.railroad??{},...U(e)};return{compactMode:t.compactMode??r.compactMode,padding:F(t.padding,r.padding),verticalSeparation:F(t.verticalSeparation,r.verticalSeparation),horizontalSeparation:F(t.horizontalSeparation,r.horizontalSeparation),arcRadius:F(t.arcRadius,r.arcRadius),fontSize:F(t.fontSize,r.fontSize),fontFamily:B(t.fontFamily,r.fontFamily),terminalFill:d(t.terminalFill,r.terminalFill),terminalStroke:d(t.terminalStroke,r.terminalStroke),terminalTextColor:d(t.terminalTextColor,r.terminalTextColor),nonTerminalFill:d(t.nonTerminalFill,r.nonTerminalFill),nonTerminalStroke:d(t.nonTerminalStroke,r.nonTerminalStroke),nonTerminalTextColor:d(t.nonTerminalTextColor,r.nonTerminalTextColor),lineColor:d(t.lineColor,r.lineColor),strokeWidth:F(t.strokeWidth,r.strokeWidth),markerFill:d(t.markerFill,r.markerFill),commentFill:d(t.commentFill,r.commentFill),commentStroke:d(t.commentStroke,r.commentStroke),commentTextColor:d(t.commentTextColor,r.commentTextColor),specialFill:d(t.specialFill,r.specialFill),specialStroke:d(t.specialStroke,r.specialStroke),ruleNameColor:d(t.ruleNameColor,r.ruleNameColor),showMarkers:t.showMarkers??r.showMarkers,markerRadius:F(t.markerRadius,r.markerRadius)}},"buildRailroadStyleOptions"),K=c.__name(e=>{const{fontFamily:n,fontSize:r,terminalFill:t,terminalStroke:i,terminalTextColor:a,nonTerminalFill:p,nonTerminalStroke:s,nonTerminalTextColor:l,lineColor:u,strokeWidth:o,markerFill:g,commentFill:m,commentStroke:h,commentTextColor:C,specialFill:S,specialStroke:w,ruleNameColor:v}=N(e);return`
|
|
3
|
+
.railroad-diagram {
|
|
4
|
+
font-family: ${n};
|
|
5
|
+
font-size: ${r}px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.railroad-terminal rect {
|
|
9
|
+
fill: ${t};
|
|
10
|
+
stroke: ${i};
|
|
11
|
+
stroke-width: ${o}px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.railroad-terminal text {
|
|
15
|
+
fill: ${a};
|
|
16
|
+
font-family: ${n};
|
|
17
|
+
font-size: ${r}px;
|
|
18
|
+
text-anchor: middle;
|
|
19
|
+
dominant-baseline: middle;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.railroad-nonterminal rect {
|
|
23
|
+
fill: ${p};
|
|
24
|
+
stroke: ${s};
|
|
25
|
+
stroke-width: ${o}px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.railroad-nonterminal text {
|
|
29
|
+
fill: ${l};
|
|
30
|
+
font-family: ${n};
|
|
31
|
+
font-size: ${r}px;
|
|
32
|
+
text-anchor: middle;
|
|
33
|
+
dominant-baseline: middle;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.railroad-line {
|
|
37
|
+
stroke: ${u};
|
|
38
|
+
stroke-width: ${o}px;
|
|
39
|
+
fill: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.railroad-start circle,
|
|
43
|
+
.railroad-end circle {
|
|
44
|
+
fill: ${g};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.railroad-comment ellipse {
|
|
48
|
+
fill: ${m};
|
|
49
|
+
stroke: ${h};
|
|
50
|
+
stroke-width: ${o}px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.railroad-comment text {
|
|
54
|
+
fill: ${C};
|
|
55
|
+
font-style: italic;
|
|
56
|
+
font-family: ${n};
|
|
57
|
+
font-size: ${r}px;
|
|
58
|
+
text-anchor: middle;
|
|
59
|
+
dominant-baseline: middle;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.railroad-special rect {
|
|
63
|
+
fill: ${S};
|
|
64
|
+
stroke: ${w};
|
|
65
|
+
stroke-width: ${o}px;
|
|
66
|
+
stroke-dasharray: 5,3;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.railroad-special text {
|
|
70
|
+
fill: ${l};
|
|
71
|
+
font-family: ${n};
|
|
72
|
+
font-size: ${r}px;
|
|
73
|
+
text-anchor: middle;
|
|
74
|
+
dominant-baseline: middle;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.railroad-rule-name {
|
|
78
|
+
font-weight: bold;
|
|
79
|
+
fill: ${v};
|
|
80
|
+
font-family: ${n};
|
|
81
|
+
font-size: ${r}px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.railroad-group {
|
|
85
|
+
/* Grouping container, no specific styles */
|
|
86
|
+
}
|
|
87
|
+
`},"getStyles"),T=class{constructor(){this.d=""}static{c.__name(this,"PathBuilder")}moveTo(e,n){return this.d+=`M ${e} ${n} `,this}lineTo(e,n){return this.d+=`L ${e} ${n} `,this}horizontalTo(e){return this.d+=`H ${e} `,this}verticalTo(e){return this.d+=`V ${e} `,this}arcTo(e,n,r,t,i,a,p){return this.d+=`A ${e} ${n} ${r} ${t?1:0} ${i?1:0} ${a} ${p} `,this}build(){return this.d.trim()}},Z=class{constructor(e,n=N()){this.textCache=new Map,this.svg=e,this.config=n}static{c.__name(this,"RailroadRenderer")}measureText(e){if(this.textCache.has(e))return this.textCache.get(e);const n=this.svg.append("text").attr("font-family",this.config.fontFamily).attr("font-size",this.config.fontSize).text(e),r=n.node().getBBox(),t={width:r.width,height:r.height};return n.remove(),this.textCache.set(e,t),t}renderTerminal(e,n){const r=this.measureText(n),t=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-terminal");return a.append("rect").attr("x",0).attr("y",0).attr("width",t).attr("height",i).attr("rx",10).attr("ry",10),a.append("text").attr("x",t/2).attr("y",i/2).text(n),{element:a.node(),dimensions:{width:t,height:i,up:i/2,down:i/2}}}renderNonTerminal(e,n){const r=this.measureText(n),t=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-nonterminal");return a.append("rect").attr("x",0).attr("y",0).attr("width",t).attr("height",i),a.append("text").attr("x",t/2).attr("y",i/2).text(n),{element:a.node(),dimensions:{width:t,height:i,up:i/2,down:i/2}}}renderSequence(e,n){const r=n.map(l=>this.renderExpression(e,l));let t=0,i=0,a=0;for(const l of r)t+=l.dimensions.width,i=Math.max(i,l.dimensions.up),a=Math.max(a,l.dimensions.down);t+=(r.length-1)*this.config.horizontalSeparation;const p=e.append("g").attr("class","railroad-sequence");let s=0;for(let l=0;l<r.length;l++){const u=r[l],o=i-u.dimensions.up;if(p.node().appendChild(u.element).setAttribute("transform",`translate(${s}, ${o})`),l<r.length-1){const g=s+u.dimensions.width,m=g+this.config.horizontalSeparation,h=i;p.append("path").attr("class","railroad-line").attr("d",new T().moveTo(g,h).lineTo(m,h).build())}s+=u.dimensions.width+this.config.horizontalSeparation}return{element:p.node(),dimensions:{width:t,height:i+a,up:i,down:a}}}renderChoice(e,n){const r=n.map(g=>this.renderExpression(e,g));let t=0,i=0;for(const g of r)t=Math.max(t,g.dimensions.width),i+=g.dimensions.height;i+=(r.length-1)*this.config.verticalSeparation;const a=this.config.arcRadius,p=a*4,s=t+p,l=e.append("g").attr("class","railroad-choice");let u=0;const o=i/2;for(const g of r){const m=u,h=m+g.dimensions.up,C=a*2+(t-g.dimensions.width)/2;l.node().appendChild(g.element).setAttribute("transform",`translate(${C}, ${m})`);const S=new T,w=h>o;h===o?S.moveTo(0,o).lineTo(C,h):S.moveTo(0,o).arcTo(a,a,0,!1,w,a,o+(w?a:-a)).lineTo(a,h-(w?a:-a)).arcTo(a,a,0,!1,!w,a*2,h).lineTo(C,h),l.append("path").attr("class","railroad-line").attr("d",S.build());const v=new T,O=C+g.dimensions.width,P=s-a*2;h===o?v.moveTo(O,h).lineTo(s,o):v.moveTo(O,h).lineTo(P,h).arcTo(a,a,0,!1,!w,s-a,h+(w?-a:a)).lineTo(s-a,o+(w?a:-a)).arcTo(a,a,0,!1,w,s,o),l.append("path").attr("class","railroad-line").attr("d",v.build()),u+=g.dimensions.height+this.config.verticalSeparation}return{element:l.node(),dimensions:{width:s,height:i,up:o,down:i-o}}}renderOptional(e,n){const r=this.renderExpression(e,n),t=this.config.arcRadius,i=t*2,a=r.dimensions.width+t*4,p=r.dimensions.height+i,s=e.append("g").attr("class","railroad-optional"),l=t*2,u=i;s.node().appendChild(r.element).setAttribute("transform",`translate(${l}, ${u})`);const o=u+r.dimensions.up,g=new T().moveTo(0,o).lineTo(t*2,o);s.append("path").attr("class","railroad-line").attr("d",g.build());const m=new T().moveTo(l+r.dimensions.width,o).lineTo(a,o);s.append("path").attr("class","railroad-line").attr("d",m.build());const h=new T().moveTo(0,o).arcTo(t,t,0,!1,!1,t,o-t).lineTo(t,t).arcTo(t,t,0,!1,!0,t*2,0).lineTo(a-t*2,0).arcTo(t,t,0,!1,!0,a-t,t).lineTo(a-t,o-t).arcTo(t,t,0,!1,!1,a,o);return s.append("path").attr("class","railroad-line").attr("d",h.build()),{element:s.node(),dimensions:{width:a,height:p,up:o,down:p-o}}}renderRepetition(e,n,r){const t=this.renderExpression(e,n),i=this.config.arcRadius,a=i*2,p=t.dimensions.width+i*4,s=r===0,l=t.dimensions.height+a+(s?a:0),u=e.append("g").attr("class","railroad-repetition"),o=i*2,g=s?a:0;u.node().appendChild(t.element).setAttribute("transform",`translate(${o}, ${g})`);const m=g+t.dimensions.up;u.append("path").attr("class","railroad-line").attr("d",new T().moveTo(0,m).lineTo(i*2,m).build()),u.append("path").attr("class","railroad-line").attr("d",new T().moveTo(o+t.dimensions.width,m).lineTo(p,m).build());const h=g+t.dimensions.height+i,C=new T().moveTo(o+t.dimensions.width,m).arcTo(i,i,0,!1,!0,o+t.dimensions.width+i,m+i).lineTo(o+t.dimensions.width+i,h).arcTo(i,i,0,!1,!0,o+t.dimensions.width,h+i).lineTo(i*2,h+i).arcTo(i,i,0,!1,!0,i,h).lineTo(i,m+i).arcTo(i,i,0,!1,!0,i*2,m);if(u.append("path").attr("class","railroad-line").attr("d",C.build()),s){const S=new T().moveTo(0,m).arcTo(i,i,0,!1,!1,i,m-i).lineTo(i,i).arcTo(i,i,0,!1,!0,i*2,0).lineTo(p-i*2,0).arcTo(i,i,0,!1,!0,p-i,i).lineTo(p-i,m-i).arcTo(i,i,0,!1,!1,p,m);u.append("path").attr("class","railroad-line").attr("d",S.build())}return{element:u.node(),dimensions:{width:p,height:l,up:m,down:l-m}}}renderSpecial(e,n){const r=this.measureText("? "+n+" ?"),t=r.width+this.config.padding*2,i=r.height+this.config.padding*2,a=e.append("g").attr("class","railroad-special");return a.append("rect").attr("x",0).attr("y",0).attr("width",t).attr("height",i),a.append("text").attr("x",t/2).attr("y",i/2).text("? "+n+" ?"),{element:a.node(),dimensions:{width:t,height:i,up:i/2,down:i/2}}}renderExpression(e,n){switch(n.type){case"terminal":return this.renderTerminal(e,n.value);case"nonterminal":return this.renderNonTerminal(e,n.name);case"sequence":return this.renderSequence(e,n.elements);case"choice":return this.renderChoice(e,n.alternatives);case"optional":return this.renderOptional(e,n.element);case"repetition":return this.renderRepetition(e,n.element,n.min);case"special":return this.renderSpecial(e,n.text);default:throw new Error(`Unknown node type: ${n.type}`)}}renderRule(e,n){const r=this.svg.append("g").attr("class","railroad-rule").attr("transform",`translate(0, ${n})`),t=e.name+" =",i=this.measureText(t).width+20,a=i+20,p=r.append("g"),s=this.renderExpression(p,e.definition),l=Math.max(20,s.dimensions.up),u=l-s.dimensions.up;return p.attr("transform",`translate(${a}, ${u})`),r.append("g").attr("class","railroad-rule-name-group").append("text").attr("class","railroad-rule-name").attr("x",0).attr("y",l).text(t),r.append("g").attr("class","railroad-start").append("circle").attr("cx",i).attr("cy",l).attr("r",this.config.markerRadius),r.append("g").attr("class","railroad-end").append("circle").attr("cx",a+s.dimensions.width+10).attr("cy",l).attr("r",this.config.markerRadius),r.append("path").attr("class","railroad-line").attr("d",new T().moveTo(i+this.config.markerRadius,l).lineTo(a,l).build()),r.append("path").attr("class","railroad-line").attr("d",new T().moveTo(a+s.dimensions.width,l).lineTo(a+s.dimensions.width+10-this.config.markerRadius,l).build()),{height:Math.max(40,u+s.dimensions.height+this.config.padding*2),width:a+s.dimensions.width+10+this.config.markerRadius}}renderDiagram(e){let n=this.config.padding,r=0;for(const t of e){const i=this.renderRule(t,n);n+=i.height+this.config.verticalSeparation,r=Math.max(r,i.width)}return{width:r+this.config.padding*2,height:n+this.config.padding}}},E=c.__name((e,n,r)=>{y.configureSvgSize(e,n.height,n.width,r),e.attr("viewBox",`0 0 ${n.width} ${n.height}`)},"configureRailroadSvgSize"),Q={draw:c.__name((e,n,r)=>{x.log.debug(`[Railroad] Rendering diagram
|
|
88
|
+
`+e);try{const t=q.selectSvgElement(n);t.attr("class","railroad-diagram");const i=y.getConfig().railroad?.useMaxWidth??!0,a=Y.getRules();if(x.log.debug(`[Railroad] Rendering ${a.length} rules`),a.length===0){x.log.warn("[Railroad] No rules to render"),E(t,{height:100,width:200},i);return}E(t,new Z(t,N()).renderDiagram(a),i),x.log.debug("[Railroad] Render complete")}catch(t){throw x.log.error("[Railroad] Render error:",t),t}},"draw")};Object.defineProperty(exports,"db",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"getStyles",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"renderer",{enumerable:!0,get:function(){return Q}});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { n as i } from "./chunk-Y2CYZVJY-0JxdZxki.js";
|
|
2
|
+
import { f, x as r } from "./chunk-WYO6CB5R-DDHkKowO.js";
|
|
3
|
+
import { p as d } from "./chunk-ICXQ74PX-DR8rL-xF.js";
|
|
4
|
+
var h = /* @__PURE__ */ i(({ flowchart: n }) => {
|
|
5
|
+
const o = n?.subGraphTitleMargin?.top ?? 0, t = n?.subGraphTitleMargin?.bottom ?? 0;
|
|
6
|
+
return {
|
|
7
|
+
subGraphTitleTopMargin: o,
|
|
8
|
+
subGraphTitleBottomMargin: t,
|
|
9
|
+
subGraphTitleTotalMargin: o + t
|
|
10
|
+
};
|
|
11
|
+
}, "getSubGraphTitleMargins");
|
|
12
|
+
async function c(n, o) {
|
|
13
|
+
const t = n.getElementsByTagName("img");
|
|
14
|
+
if (!t || t.length === 0) return;
|
|
15
|
+
const l = o.replace(/<img[^>]*>/g, "").trim() === "";
|
|
16
|
+
await Promise.all([...t].map((e) => new Promise((p) => {
|
|
17
|
+
function a() {
|
|
18
|
+
if (e.style.display = "flex", e.style.flexDirection = "column", l) {
|
|
19
|
+
const m = r().fontSize ? r().fontSize : window.getComputedStyle(document.body).fontSize, g = 5, [u = f.fontSize] = d(m), s = u * g + "px";
|
|
20
|
+
e.style.minWidth = s, e.style.maxWidth = s;
|
|
21
|
+
} else e.style.width = "100%";
|
|
22
|
+
p(e);
|
|
23
|
+
}
|
|
24
|
+
i(a, "setupImage"), setTimeout(() => {
|
|
25
|
+
e.complete && a();
|
|
26
|
+
}), e.addEventListener("error", a), e.addEventListener("load", a);
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
i(c, "configureLabelImages");
|
|
30
|
+
export {
|
|
31
|
+
h as n,
|
|
32
|
+
c as t
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),o=require("./chunk-WYO6CB5R-u4mJNOcO.cjs"),d=require("./chunk-ICXQ74PX-BbT9JaEW.cjs");var m=a.__name(({flowchart:n})=>{const r=n?.subGraphTitleMargin?.top??0,t=n?.subGraphTitleMargin?.bottom??0;return{subGraphTitleTopMargin:r,subGraphTitleBottomMargin:t,subGraphTitleTotalMargin:r+t}},"getSubGraphTitleMargins");async function u(n,r){const t=n.getElementsByTagName("img");if(!t||t.length===0)return;const l=r.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...t].map(e=>new Promise(c=>{function i(){if(e.style.display="flex",e.style.flexDirection="column",l){const g=o.getConfig2().fontSize?o.getConfig2().fontSize:window.getComputedStyle(document.body).fontSize,f=5,[p=o.defaultConfig_default.fontSize]=d.parseFontSize(g),s=p*f+"px";e.style.minWidth=s,e.style.maxWidth=s}else e.style.width="100%";c(e)}a.__name(i,"setupImage"),setTimeout(()=>{e.complete&&i()}),e.addEventListener("error",i),e.addEventListener("load",i)})))}a.__name(u,"configureLabelImages");Object.defineProperty(exports,"configureLabelImages",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"getSubGraphTitleMargins",{enumerable:!0,get:function(){return m}});
|