@orangelogic/design-system 2.162.0 → 2.164.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library/chunks/{AxisLabelRadial.lE2gKah-.js → AxisLabelRadial.fe7zjixN.js} +1 -1
- package/library/chunks/{BaseColumnSeries.B57B3iHh.js → BaseColumnSeries.8Mpxz385.js} +1 -1
- package/library/chunks/{CandlestickSeries.CmmI426l.js → CandlestickSeries.DuadaOTa.js} +19 -19
- package/library/chunks/{Circle.DAhHYhrc.js → Circle.6LomW0ej.js} +1 -1
- package/library/chunks/{ColumnSeries.DBgXk-b4.js → ColumnSeries.D1NLfRh5.js} +2 -2
- package/library/chunks/{EditableAxisLabel.C6H99qiS.js → EditableAxisLabel.Bi9vxLDV.js} +2 -2
- package/library/chunks/{EditableLabel.B7HB7Cu4.js → EditableLabel.CMR3O9E-.js} +1 -1
- package/library/chunks/{Gradient.DHhBnhFd.js → Gradient.CquE8_a4.js} +1 -1
- package/library/chunks/{LinearGradient.CGx00O8B.js → LinearGradient.CVN1VJp-.js} +9 -9
- package/library/chunks/{Picture.DYltTVSo.js → Picture.BYTZ_I8g.js} +1 -1
- package/library/chunks/{Polygon.BCrxKagx.js → Polygon.CU2sMltE.js} +1 -1
- package/library/chunks/{ProgressPie.CXksPJFv.js → ProgressPie.Dd74dbmm.js} +6 -6
- package/library/chunks/{RadialLabel.BYH69FGU.js → RadialLabel.7ka6ND-t.js} +1 -1
- package/library/chunks/{Scrollbar.DEv50o4R.js → Scrollbar.DqUnZReo.js} +1 -1
- package/library/chunks/Slice.BVI8rfHI.js +34 -0
- package/library/chunks/{Slider.BX8g2iGv.js → Slider.DtjYaJOw.js} +1 -1
- package/library/chunks/{SpriteResizer.CfIBMSp3.js → SpriteResizer.Ci2Wt2YJ.js} +11 -11
- package/library/chunks/{Triangle.CNY8-QfL.js → Triangle.C75emy3D.js} +1 -1
- package/library/chunks/{ZoomTools.6jZrzA7x.js → ZoomTools.CA9mtHI8.js} +2 -2
- package/library/chunks/_arrayEach.DU4X1H_a.js +8 -0
- package/library/chunks/_baseClone.BHNjfIdS.js +215 -0
- package/library/chunks/_baseEach.DQk0As2f.js +32 -0
- package/library/chunks/{_baseIteratee.BdKyHJ5i.js → _baseIteratee.sC2wLi2m.js} +3 -2
- package/library/chunks/{_baseUniq.je-HWbb3.js → _baseUniq.lwMgmtt2.js} +16 -15
- package/library/chunks/_baseXor.DixEm6JQ.js +35 -0
- package/library/chunks/_flatRest.D3ZVApI5.js +30 -0
- package/library/chunks/abnfDiagram-VRR7QNED.DKqYa5p7.js +89 -0
- package/library/chunks/{am-chart.CqdmTS0P.js → am-chart.Cr-vMjcY.js} +1577 -1727
- package/library/chunks/{animation.S74lUDDc.js → animation.BD-1xugN.js} +1 -1
- package/library/chunks/arc.xqNd6x9S.js +84 -0
- package/library/chunks/architectureDiagram-ZJ3FMSHR.CBIOk9Kp.js +4757 -0
- package/library/chunks/{asset-link-format.DLAzKfhk.js → asset-link-format.0q_MQOYh.js} +691 -635
- package/library/chunks/asset-link-format.ClaYu_v8.js +7 -0
- package/library/chunks/blockDiagram-677ZJIJ3.CeQxLPwj.js +2428 -0
- package/library/chunks/{button.8syoJXYs.js → button.DGyqdBou.js} +2 -2
- package/library/chunks/c4Diagram-LMCZKHZV.B73xdpNh.js +1580 -0
- package/library/chunks/{capitalize.BTYI3NfM.js → capitalize.CIBKBL10.js} +1 -1
- package/library/chunks/{cardinal.BCA_LB0u.js → cardinal.BXTAeOLk.js} +1 -0
- package/library/chunks/cardinalClosed.Mdce1x5M.js +59 -0
- package/library/chunks/channel.s_XjcUYI.js +5 -0
- package/library/chunks/chunk-2Q5K7J3B.Dy1Z-bMH.js +15 -0
- package/library/chunks/chunk-32BRIVSS.BbIrVi3j.js +71 -0
- package/library/chunks/chunk-5VM5RSS4.D0-lddDM.js +19 -0
- package/library/chunks/chunk-EX3LRPZG.L693y8d4.js +1412 -0
- package/library/chunks/chunk-JWPE2WC7.BV0i4LDu.js +8 -0
- package/library/chunks/chunk-MOJQB5TN.BZstBMYC.js +664 -0
- package/library/chunks/chunk-RYQCIY6F.BMsuG7ya.js +314 -0
- package/library/chunks/chunk-V7JOEXUC.DcJlyQO0.js +1537 -0
- package/library/chunks/chunk-VR4S4FIN.BpryBs7q.js +19 -0
- package/library/chunks/chunk-XXDRQBXY.CSOjab1V.js +11 -0
- package/library/chunks/classDiagram-OUVF2IWQ.Dvz7CNwe.js +18 -0
- package/library/chunks/classDiagram-v2-EOCWNBFH.Dvz7CNwe.js +18 -0
- package/library/chunks/cloneDeep.B-5z5SI3.js +51 -0
- package/library/chunks/{color-swatch-group.CLv1LSZy.js → color-swatch-group.ChP9amU9.js} +2576 -2723
- package/library/chunks/{color-swatch.DsWP2fd-.js → color-swatch.QsHoy_K1.js} +1 -1
- package/library/chunks/{colorPicker.GYgA76kc.js → colorPicker.Cg6Zxf8f.js} +5 -5
- package/library/chunks/{confirm-popover.C-eHPJaU.js → confirm-popover.D8mdy6KG.js} +2 -2
- package/library/chunks/constant.BQ4UJ-kW.js +12 -0
- package/library/chunks/cose-bilkent-JH36ORCC.cfzS2XsK.js +2612 -0
- package/library/chunks/cynefin-VYW2F7L2.c7H5z9nQ.js +23790 -0
- package/library/chunks/cynefinDiagram-TSTJHNR4.C8SgNXWI.js +299 -0
- package/library/chunks/cytoscape.esm.Cbrwqewp.js +18786 -0
- package/library/chunks/dagre-VKFMJZFB.D5B1cAri.js +343 -0
- package/library/chunks/debounce.Bv1rtE8D.js +55 -0
- package/library/chunks/defaultLocale.CPy_WVtp.js +171 -0
- package/library/chunks/descending.AD5n-tFs.js +10 -0
- package/library/chunks/diagram-FQU43EPY.DJukDcLl.js +466 -0
- package/library/chunks/diagram-G47NLZAW.BBOvcbcR.js +316 -0
- package/library/chunks/diagram-NH7WQ7WH.DOpRwmC2.js +142 -0
- package/library/chunks/diagram-OA4YK3LP.Dm5WJs91.js +350 -0
- package/library/chunks/diagram-WEI45ONY.COuzdmSR.js +217 -0
- package/library/chunks/{dialog.Bzf4-IgH.js → dialog.05FgdLBZ.js} +2 -2
- package/library/chunks/{document-viewer.CGyOG1yw.js → document-viewer.Cng07M-1.js} +7 -7
- package/library/chunks/{dot-pagination.BdZc-K0r.js → dot-pagination.Pg9O0nIh.js} +1 -1
- package/library/chunks/ebnfDiagram-CCIWWBDH.Dz-QBH6Y.js +111 -0
- package/library/chunks/erDiagram-Q63AITRT.sSw_w-2B.js +913 -0
- package/library/chunks/{exporting.DQhKH1BX.js → exporting.Djsoh75g.js} +11 -11
- package/library/chunks/flow.aZRVH3p1.js +1304 -0
- package/library/chunks/flowDiagram-23GEKE2U.CMMbuUHf.js +1642 -0
- package/library/chunks/{folder-select.BKAuh4GE.js → folder-select.Dw1ZKZAq.js} +160 -140
- package/library/chunks/{gantt.tu-w6fQ5.js → gantt.Bv6_3H9y.js} +22 -22
- package/library/chunks/ganttDiagram-NO4QXBWP.DZdwd0O4.js +2715 -0
- package/library/chunks/gitGraphDiagram-IHSO6WYX.F6mwS3uS.js +818 -0
- package/library/chunks/graph.XHMI5hta.js +653 -0
- package/library/chunks/{header.e1FLwywx.js → header.DDI0MfJA.js} +1 -1
- package/library/chunks/{hierarchy.CTnBzzmQ.js → hierarchy.C4LxmFxx.js} +836 -904
- package/library/chunks/{hub-connection.CA_wS_wh.js → hub-connection.BtevPWYb.js} +1 -1
- package/library/chunks/{icon-button.DbVIFgu7.js → icon-button.BwmMJ0bI.js} +1 -1
- package/library/chunks/{icon.mxNZ85k0.js → icon.D5iM9wXS.js} +1 -1
- package/library/chunks/{iframe.DcHjOcLG.js → iframe.Cc-xZIm_.js} +1 -1
- package/library/chunks/{image.5mhGPvMN.js → image.BgODrAzQ.js} +2 -2
- package/library/chunks/{image.QVlPFadX.js → image.Y5c_hFx8.js} +1 -1
- package/library/chunks/{index.BVDhdCk-.js → index.2SOQHTpX.js} +23 -23
- package/library/chunks/index.BDn1QW8J.js +167 -0
- package/library/chunks/{index.DcjJFMlq.js → index.CrhRU5m8.js} +284 -273
- package/library/chunks/index.thKLME8E.js +77 -0
- package/library/chunks/infoDiagram-FWYZ7A6U.BnktKL7i.js +24 -0
- package/library/chunks/init.DjUOC4st.js +16 -0
- package/library/chunks/{input.BcyLZUmv.js → input.DOorVTYZ.js} +2 -2
- package/library/chunks/isArrayLikeObject.D7afXo-f.js +86 -0
- package/library/chunks/isEmpty.DtTJTUcf.js +27 -0
- package/library/chunks/ishikawaDiagram-FXEZZL3T.CFp-9Kes.js +621 -0
- package/library/chunks/journeyDiagram-5HDEW3XC.BxO1aPu_.js +837 -0
- package/library/chunks/{json.D7WeFaJm.js → json.Dz5QFEi5.js} +3 -3
- package/library/chunks/kanban-definition-HUTT4EX6.Bk8vmLFK.js +724 -0
- package/library/chunks/katex.DoRnZ_sp.js +11682 -0
- package/library/chunks/layout.DZcMFKol.js +1446 -0
- package/library/chunks/line.DP-iSN_J.js +157 -0
- package/library/chunks/linear.TNHhsH1m.js +215 -0
- package/library/chunks/{map.BjtxEozr.js → map.CBcV0WVq.js} +100 -105
- package/library/chunks/map.DJnohTgl.js +18 -0
- package/library/chunks/markdown.I1AJG75v.js +4180 -0
- package/library/chunks/math.D2lKC7md.js +22 -0
- package/library/chunks/mermaid.core.Dspbw7Ig.js +13598 -0
- package/library/chunks/mindmap-definition-LN4V7U3C.DuCBBYwE.js +808 -0
- package/library/chunks/{number.CtCaI0T_.js → number.Cx2ncfJJ.js} +2 -2
- package/library/chunks/{option.qN3aaqVI.js → option.DyNR1vzy.js} +2 -2
- package/library/chunks/ordinal.bqVaUip-.js +61 -0
- package/library/chunks/{pagination.Cupa46TN.js → pagination.qFmncShC.js} +5 -5
- package/library/chunks/pegDiagram-2B236MQR.DQrkEdJr.js +97 -0
- package/library/chunks/{percent.D_CkaRGb.js → percent.D8mkiJ2G.js} +17 -17
- package/library/chunks/pieDiagram-ENE6RG2P.B6nPW8Pj.js +212 -0
- package/library/chunks/position-picker.DjnhxIKF.js +4 -0
- package/library/chunks/quadrantDiagram-ABIIQ3AL.BFy9moxz.js +1026 -0
- package/library/chunks/{radar.BMKaNvJH.js → radar.B3p5bRix.js} +78 -129
- package/library/chunks/railroadDiagram-RFXS5EU6.CSao8YZX.js +79 -0
- package/library/chunks/range.DdOGybNB.js +9 -0
- package/library/chunks/requirementDiagram-TGXJPOKE.CjpliZnF.js +882 -0
- package/library/chunks/sankey.BR94A-8L.js +294 -0
- package/library/chunks/sankeyDiagram-HTMAVEWB.D8aAxVGe.js +564 -0
- package/library/chunks/select.C6_sM3Pr.js +7 -0
- package/library/chunks/sequenceDiagram-DBY2YBRQ.Cu9MV3h-.js +2891 -0
- package/library/chunks/sizeCapture-X5ZJPWSS.BDByEFcW.js +46 -0
- package/library/chunks/{sliceGrouper.C-t5ZRrz.js → sliceGrouper.CcRqQhZX.js} +1 -1
- package/library/chunks/stateDiagram-2N3HPSRC.DvrAW9Ck.js +267 -0
- package/library/chunks/stateDiagram-v2-6OUMAXLB.CFfuaFM1.js +18 -0
- package/library/chunks/step.almIqwJ6.js +51 -0
- package/library/chunks/{stock.vF_pji1F.js → stock.CQbn6zW4.js} +9 -9
- package/library/chunks/swimlanes-5IMT3BWC.AtMD47q7.js +5332 -0
- package/library/chunks/swimlanesDiagram-G3AALYLV.26A1eX7s.js +15 -0
- package/library/chunks/{tab-group.kSg5_10g.js → tab-group.1Y71_aN8.js} +3 -3
- package/library/chunks/{time.DWfbnPnM.js → time.DYWuX2id.js} +1 -1
- package/library/chunks/timeline-definition-FHXFAJF6.CYSh6xl5.js +1058 -0
- package/library/chunks/{timeline.gWu0up6r.js → timeline.Czz_uBEd.js} +33 -32
- package/library/chunks/toNumber.MuDz8DgU.js +31 -0
- package/library/chunks/{toString.Dcbz5jVT.js → toString.B1zKIiZc.js} +1 -1
- package/library/chunks/{toast.TDU3wVhq.js → toast.CXEAfCvN.js} +1 -1
- package/library/chunks/transformation.8uLv6uwG.js +264 -0
- package/library/chunks/{tree.C2dPd6gt.js → tree.vn5sHbdt.js} +123 -117
- package/library/chunks/value.BXEGBVFV.js +44 -0
- package/library/chunks/{venn.BVBe-JXs.js → venn.B5Jl-c4i.js} +2 -2
- package/library/chunks/vennDiagram-L72KCM5P.CSk1WWlu.js +1581 -0
- package/library/chunks/wardleyDiagram-EHGQE667.C7UzXYG7.js +675 -0
- package/library/chunks/{watch.DOt4Mabe.js → watch.DJF5K-8U.js} +27 -27
- package/library/chunks/{wc.DTNpfIc1.js → wc.B2THb2Kk.js} +18 -18
- package/library/chunks/xy.BO6U5QrZ.js +294 -0
- package/library/chunks/xychartDiagram-FW5EYKEG.idiZWvYS.js +1383 -0
- package/library/components/alert.js +2 -2
- package/library/components/am-chart.js +3 -3
- package/library/components/animated-image.js +2 -2
- package/library/components/animation.js +2 -2
- package/library/components/array-line-clamp.js +1 -1
- package/library/components/asset-link-format.js +8 -7
- package/library/components/atoms.js +29 -29
- package/library/components/audio.js +3 -3
- package/library/components/avatar.js +2 -2
- package/library/components/border-input-group.js +1 -1
- package/library/components/breadcrumb-item.js +1 -1
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +3 -3
- package/library/components/checkbox.js +195 -18
- package/library/components/color-picker.js +4 -4
- package/library/components/color-swatch-group.js +5 -5
- package/library/components/color-swatch.js +2 -2
- package/library/components/confirm-popover.js +3 -3
- package/library/components/copy-button.js +2 -2
- package/library/components/corner-position-input-group.js +2 -2
- package/library/components/cropper.js +4 -4
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +2 -2
- package/library/components/dialog.js +3 -3
- package/library/components/diff.js +1 -1
- package/library/components/divider.js +1 -1
- package/library/components/document-viewer.js +3 -3
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +3 -3
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +6 -6
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +350 -374
- package/library/components/folder-select.js +5 -5
- package/library/components/format-time.js +2 -2
- package/library/components/grid-item.js +1 -1
- package/library/components/header.js +2 -2
- package/library/components/hub-connection.js +2 -2
- package/library/components/icon-button.js +2 -2
- package/library/components/icon.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +2 -2
- package/library/components/image.js +3 -3
- package/library/components/include.js +1 -1
- package/library/components/input.js +3 -3
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +11 -2704
- package/library/components/masonry.js +76 -73
- package/library/components/menu-item.js +2 -2
- package/library/components/molecules.js +3 -3
- package/library/components/mutation-observer.js +1 -1
- package/library/components/option.js +3 -3
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +6 -6
- package/library/components/position-picker.js +25 -25
- package/library/components/qr-code.js +1 -1
- package/library/components/radio-button.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/radio-group.js +1 -1
- package/library/components/radio.js +2 -2
- package/library/components/range.js +1 -1
- package/library/components/rating.js +2 -2
- package/library/components/resize-observer.js +1 -1
- package/library/components/select.js +3 -3
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +2 -2
- package/library/components/sidebar.js +3 -3
- package/library/components/size-input-group.js +3 -3
- package/library/components/split-panel.js +1 -1
- package/library/components/step.js +1 -1
- package/library/components/stepper-wizard.js +1 -1
- package/library/components/stepper.js +1 -1
- package/library/components/switch.js +1 -1
- package/library/components/tab-group.js +4 -4
- package/library/components/tab-panel.js +1 -1
- package/library/components/tab.js +2 -2
- package/library/components/tag.js +1 -1
- package/library/components/textarea.js +1 -1
- package/library/components/timecode.js +1 -1
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +4 -4
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +122327 -120686
- package/library/components/video.js +2 -2
- package/library/package.json +2 -1
- package/library/packages/atoms/src/components/markdown/markdown.d.ts +41 -1
- package/library/packages/atoms/src/components/markdown/parser.d.ts +18 -3
- package/library/packages/atoms/src/components/markdown/styles.d.ts +17 -0
- package/library/packages/atoms/src/components/tree/tree.d.ts +7 -1
- package/library/packages/atoms/src/components/tree-item/tree-item.d.ts +11 -1
- package/library/packages/events/src/cx-folder-select-loading-change.d.ts +8 -0
- package/library/packages/events/src/events.d.ts +1 -0
- package/library/packages/hybrid/table-core/src/table/styles/table-frozen.styles.d.ts +8 -0
- package/library/packages/hybrid/table-core/src/table/table.d.ts +9 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/FrozenColumns/FrozenColumns.d.ts +14 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/ResizeColumns/ResizeColumns.d.ts +18 -1
- package/library/packages/molecules/src/folder-select/components/folder-select-tree/folder-select-tree.d.ts +7 -0
- package/library/packages/molecules/src/folder-select/folder-select.d.ts +7 -0
- package/library/packages/molecules/src/index.d.ts +1 -0
- package/library/packages/molecules/src/markdown-viewer/markdown-viewer.d.ts +124 -0
- package/library/packages/molecules/src/markdown-viewer/markdown-viewer.styles.d.ts +6 -0
- package/library/packages/molecules/src/masonry/masonry.d.ts +5 -0
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +9 -0
- package/library/packages/organisms/src/asset-link-format/components/asset-link-format-crop/asset-link-format-crop.d.ts +30 -0
- package/library/packages/tools/src/tiptap/utils/md/editor-controller.d.ts +57 -0
- package/library/packages/tools/src/tiptap/utils/md/from-markdown.d.ts +11 -0
- package/library/packages/tools/src/tiptap/utils/md/input-rules.d.ts +15 -0
- package/library/packages/tools/src/tiptap/utils/md/schema.d.ts +13 -0
- package/library/packages/tools/src/tiptap/utils/md/to-markdown.d.ts +14 -0
- package/library/packages/types/src/asset-link-format.d.ts +19 -0
- package/library/packages/types/src/markdown-viewer.d.ts +12 -0
- package/library/packages/types/src/tree-item.d.ts +12 -0
- package/library/react-web-component.d.ts +86 -8
- package/library/utils.js +64 -65
- package/package.json +2 -1
- package/library/chunks/Slice.C5lVu2g_.js +0 -120
- package/library/chunks/_baseXor.VohG8cOH.js +0 -116
- package/library/chunks/asset-link-format.QzzboHHE.js +0 -6
- package/library/chunks/checkbox.3i2j3PHc.js +0 -198
- package/library/chunks/content-builder.BU8X7I6V.js +0 -60
- package/library/chunks/debounce.C_J-9zJi.js +0 -82
- package/library/chunks/flow.hz0UDjCb.js +0 -1594
- package/library/chunks/index.DU0XUO4k.js +0 -176
- package/library/chunks/transformation.D1alV_s4.js +0 -189
- package/library/chunks/xy.BNgyrwGD.js +0 -333
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import { _ as p, l as C, E as H, y as B, p as q, F as G, d as U, h as j, c as K } from "./mermaid.core.Dspbw7Ig.js";
|
|
2
|
+
var A = "", M = "", O = "", D = [], b = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ p((e) => j(e, K()), "sanitizeText"), y = /* @__PURE__ */ p((e) => {
|
|
3
|
+
switch (e.type) {
|
|
4
|
+
case "terminal":
|
|
5
|
+
return { ...e, value: v(e.value) };
|
|
6
|
+
case "nonterminal":
|
|
7
|
+
return { ...e, name: v(e.name) };
|
|
8
|
+
case "sequence":
|
|
9
|
+
return { ...e, elements: e.elements.map(y) };
|
|
10
|
+
case "choice":
|
|
11
|
+
return { ...e, alternatives: e.alternatives.map(y) };
|
|
12
|
+
case "optional":
|
|
13
|
+
return { ...e, element: y(e.element) };
|
|
14
|
+
case "repetition":
|
|
15
|
+
return {
|
|
16
|
+
...e,
|
|
17
|
+
element: y(e.element),
|
|
18
|
+
separator: e.separator ? y(e.separator) : void 0
|
|
19
|
+
};
|
|
20
|
+
case "special":
|
|
21
|
+
return { ...e, text: v(e.text) };
|
|
22
|
+
}
|
|
23
|
+
}, "sanitizeAstNode"), J = /* @__PURE__ */ p(() => {
|
|
24
|
+
A = "", M = "", O = "", D.length = 0, b.clear(), q(), C.debug("[Railroad] Database cleared");
|
|
25
|
+
}, "clear"), Y = /* @__PURE__ */ p((e) => {
|
|
26
|
+
A = v(e), C.debug("[Railroad] Title set:", e);
|
|
27
|
+
}, "setTitle"), P = /* @__PURE__ */ p(() => A, "getTitle"), Q = /* @__PURE__ */ p((e) => {
|
|
28
|
+
const i = {
|
|
29
|
+
...e,
|
|
30
|
+
name: v(e.name),
|
|
31
|
+
definition: y(e.definition),
|
|
32
|
+
comment: e.comment ? v(e.comment) : void 0
|
|
33
|
+
};
|
|
34
|
+
C.debug("[Railroad] Adding rule:", i.name), b.has(i.name) && C.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`), D.push(i), b.set(i.name, i);
|
|
35
|
+
}, "addRule"), Z = /* @__PURE__ */ p(() => D, "getRules"), V = /* @__PURE__ */ p((e) => b.get(e), "getRule"), ee = /* @__PURE__ */ p((e) => {
|
|
36
|
+
M = v(e).replace(/^\s+/g, ""), C.debug("[Railroad] Accessibility title set:", e);
|
|
37
|
+
}, "setAccTitle"), te = /* @__PURE__ */ p(() => M, "getAccTitle"), re = /* @__PURE__ */ p((e) => {
|
|
38
|
+
O = v(e).replace(/\n\s+/g, `
|
|
39
|
+
`), C.debug("[Railroad] Accessibility description set:", e);
|
|
40
|
+
}, "setAccDescription"), ie = /* @__PURE__ */ p(() => O, "getAccDescription"), ne = Y, ae = P, oe = {
|
|
41
|
+
clear: J,
|
|
42
|
+
setTitle: Y,
|
|
43
|
+
getTitle: P,
|
|
44
|
+
addRule: Q,
|
|
45
|
+
getRules: Z,
|
|
46
|
+
getRule: V,
|
|
47
|
+
setAccTitle: ee,
|
|
48
|
+
getAccTitle: te,
|
|
49
|
+
setAccDescription: re,
|
|
50
|
+
getAccDescription: ie,
|
|
51
|
+
setDiagramTitle: ne,
|
|
52
|
+
getDiagramTitle: ae
|
|
53
|
+
}, f = {
|
|
54
|
+
// Layout
|
|
55
|
+
compactMode: !1,
|
|
56
|
+
// Spacing
|
|
57
|
+
padding: 10,
|
|
58
|
+
verticalSeparation: 8,
|
|
59
|
+
horizontalSeparation: 10,
|
|
60
|
+
arcRadius: 10,
|
|
61
|
+
// Typography
|
|
62
|
+
fontSize: 14,
|
|
63
|
+
fontFamily: "monospace",
|
|
64
|
+
// Colors - Terminal
|
|
65
|
+
terminalFill: "#FFFFC0",
|
|
66
|
+
terminalStroke: "#000000",
|
|
67
|
+
terminalTextColor: "#000000",
|
|
68
|
+
// Colors - Non-terminal
|
|
69
|
+
nonTerminalFill: "#FFFFFF",
|
|
70
|
+
nonTerminalStroke: "#000000",
|
|
71
|
+
nonTerminalTextColor: "#000000",
|
|
72
|
+
// Colors - Lines
|
|
73
|
+
lineColor: "#000000",
|
|
74
|
+
strokeWidth: 2,
|
|
75
|
+
// Colors - Markers
|
|
76
|
+
markerFill: "#000000",
|
|
77
|
+
// Colors - Comment
|
|
78
|
+
commentFill: "#E8E8E8",
|
|
79
|
+
commentStroke: "#888888",
|
|
80
|
+
commentTextColor: "#666666",
|
|
81
|
+
// Colors - Special
|
|
82
|
+
specialFill: "#F0E0FF",
|
|
83
|
+
specialStroke: "#8800CC",
|
|
84
|
+
// Other
|
|
85
|
+
ruleNameColor: "#000066",
|
|
86
|
+
showMarkers: !0,
|
|
87
|
+
markerRadius: 5
|
|
88
|
+
}, le = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i, se = /^[\w "',.-]+$/, de = /* @__PURE__ */ new Set([
|
|
89
|
+
"compactMode",
|
|
90
|
+
"padding",
|
|
91
|
+
"verticalSeparation",
|
|
92
|
+
"horizontalSeparation",
|
|
93
|
+
"arcRadius",
|
|
94
|
+
"fontSize",
|
|
95
|
+
"fontFamily",
|
|
96
|
+
"terminalFill",
|
|
97
|
+
"terminalStroke",
|
|
98
|
+
"terminalTextColor",
|
|
99
|
+
"nonTerminalFill",
|
|
100
|
+
"nonTerminalStroke",
|
|
101
|
+
"nonTerminalTextColor",
|
|
102
|
+
"lineColor",
|
|
103
|
+
"strokeWidth",
|
|
104
|
+
"markerFill",
|
|
105
|
+
"commentFill",
|
|
106
|
+
"commentStroke",
|
|
107
|
+
"commentTextColor",
|
|
108
|
+
"specialFill",
|
|
109
|
+
"specialStroke",
|
|
110
|
+
"ruleNameColor",
|
|
111
|
+
"showMarkers",
|
|
112
|
+
"markerRadius"
|
|
113
|
+
]), L = /* @__PURE__ */ p((e) => e ? Object.keys(e).every(
|
|
114
|
+
(i) => i === "railroad" || de.has(i)
|
|
115
|
+
) : !1, "isRailroadStyleOptions"), ce = /* @__PURE__ */ p((e) => e ? "railroad" in e && e.railroad ? e.railroad : L(e) ? e : {} : {}, "extractRailroadOverrides"), me = /* @__PURE__ */ p((e) => {
|
|
116
|
+
if (!e || L(e))
|
|
117
|
+
return {};
|
|
118
|
+
const {
|
|
119
|
+
railroad: i,
|
|
120
|
+
svgId: a,
|
|
121
|
+
theme: n,
|
|
122
|
+
look: t,
|
|
123
|
+
...r
|
|
124
|
+
} = e;
|
|
125
|
+
return r;
|
|
126
|
+
}, "extractThemeOverrides"), m = /* @__PURE__ */ p((e, i) => {
|
|
127
|
+
if (typeof e != "string")
|
|
128
|
+
return i;
|
|
129
|
+
const a = e.trim();
|
|
130
|
+
return le.test(a) ? a : i;
|
|
131
|
+
}, "sanitizeColorValue"), I = /* @__PURE__ */ p((e, i) => {
|
|
132
|
+
if (typeof e != "string")
|
|
133
|
+
return i;
|
|
134
|
+
const a = e.trim();
|
|
135
|
+
return se.test(a) ? a : i;
|
|
136
|
+
}, "sanitizeFontFamilyValue"), F = /* @__PURE__ */ p((e, i) => {
|
|
137
|
+
const a = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : Number.NaN;
|
|
138
|
+
return Number.isFinite(a) && a >= 0 ? a : i;
|
|
139
|
+
}, "sanitizeNumberValue"), he = /* @__PURE__ */ p((e) => {
|
|
140
|
+
const i = typeof e == "number" ? e : typeof e == "string" ? Number.parseFloat(e) : Number.NaN;
|
|
141
|
+
return Number.isFinite(i) && i > 0 ? i : void 0;
|
|
142
|
+
}, "parseThemeFontSize"), pe = /* @__PURE__ */ p((e) => {
|
|
143
|
+
const i = I(
|
|
144
|
+
e.fontFamily,
|
|
145
|
+
f.fontFamily
|
|
146
|
+
), a = he(e.fontSize) ?? f.fontSize;
|
|
147
|
+
return {
|
|
148
|
+
...f,
|
|
149
|
+
fontFamily: i,
|
|
150
|
+
fontSize: a,
|
|
151
|
+
terminalFill: m(
|
|
152
|
+
e.secondBkg ?? e.secondaryColor,
|
|
153
|
+
f.terminalFill
|
|
154
|
+
),
|
|
155
|
+
terminalStroke: m(
|
|
156
|
+
e.secondaryBorderColor ?? e.lineColor,
|
|
157
|
+
f.terminalStroke
|
|
158
|
+
),
|
|
159
|
+
terminalTextColor: m(
|
|
160
|
+
e.secondaryTextColor ?? e.textColor,
|
|
161
|
+
f.terminalTextColor
|
|
162
|
+
),
|
|
163
|
+
nonTerminalFill: m(
|
|
164
|
+
e.mainBkg ?? e.background,
|
|
165
|
+
f.nonTerminalFill
|
|
166
|
+
),
|
|
167
|
+
nonTerminalStroke: m(
|
|
168
|
+
e.primaryBorderColor ?? e.lineColor,
|
|
169
|
+
f.nonTerminalStroke
|
|
170
|
+
),
|
|
171
|
+
nonTerminalTextColor: m(
|
|
172
|
+
e.primaryTextColor ?? e.textColor,
|
|
173
|
+
f.nonTerminalTextColor
|
|
174
|
+
),
|
|
175
|
+
lineColor: m(e.lineColor, f.lineColor),
|
|
176
|
+
markerFill: m(e.lineColor, f.markerFill),
|
|
177
|
+
commentFill: m(
|
|
178
|
+
e.labelBackground ?? e.tertiaryColor,
|
|
179
|
+
f.commentFill
|
|
180
|
+
),
|
|
181
|
+
commentStroke: m(
|
|
182
|
+
e.tertiaryBorderColor ?? e.lineColor,
|
|
183
|
+
f.commentStroke
|
|
184
|
+
),
|
|
185
|
+
commentTextColor: m(
|
|
186
|
+
e.tertiaryTextColor ?? e.textColor,
|
|
187
|
+
f.commentTextColor
|
|
188
|
+
),
|
|
189
|
+
specialFill: m(
|
|
190
|
+
e.tertiaryColor ?? e.secondaryColor,
|
|
191
|
+
f.specialFill
|
|
192
|
+
),
|
|
193
|
+
specialStroke: m(
|
|
194
|
+
e.tertiaryBorderColor ?? e.secondaryBorderColor,
|
|
195
|
+
f.specialStroke
|
|
196
|
+
),
|
|
197
|
+
ruleNameColor: m(
|
|
198
|
+
e.titleColor ?? e.textColor,
|
|
199
|
+
f.ruleNameColor
|
|
200
|
+
)
|
|
201
|
+
};
|
|
202
|
+
}, "buildThemeDefaults"), E = /* @__PURE__ */ p((e) => {
|
|
203
|
+
const i = B(), a = {
|
|
204
|
+
...G(),
|
|
205
|
+
...i.themeVariables ?? {},
|
|
206
|
+
...me(e)
|
|
207
|
+
}, n = pe(a), t = {
|
|
208
|
+
...i.railroad ?? {},
|
|
209
|
+
...ce(e)
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
compactMode: t.compactMode ?? n.compactMode,
|
|
213
|
+
padding: F(t.padding, n.padding),
|
|
214
|
+
verticalSeparation: F(
|
|
215
|
+
t.verticalSeparation,
|
|
216
|
+
n.verticalSeparation
|
|
217
|
+
),
|
|
218
|
+
horizontalSeparation: F(
|
|
219
|
+
t.horizontalSeparation,
|
|
220
|
+
n.horizontalSeparation
|
|
221
|
+
),
|
|
222
|
+
arcRadius: F(t.arcRadius, n.arcRadius),
|
|
223
|
+
fontSize: F(t.fontSize, n.fontSize),
|
|
224
|
+
fontFamily: I(t.fontFamily, n.fontFamily),
|
|
225
|
+
terminalFill: m(t.terminalFill, n.terminalFill),
|
|
226
|
+
terminalStroke: m(
|
|
227
|
+
t.terminalStroke,
|
|
228
|
+
n.terminalStroke
|
|
229
|
+
),
|
|
230
|
+
terminalTextColor: m(
|
|
231
|
+
t.terminalTextColor,
|
|
232
|
+
n.terminalTextColor
|
|
233
|
+
),
|
|
234
|
+
nonTerminalFill: m(
|
|
235
|
+
t.nonTerminalFill,
|
|
236
|
+
n.nonTerminalFill
|
|
237
|
+
),
|
|
238
|
+
nonTerminalStroke: m(
|
|
239
|
+
t.nonTerminalStroke,
|
|
240
|
+
n.nonTerminalStroke
|
|
241
|
+
),
|
|
242
|
+
nonTerminalTextColor: m(
|
|
243
|
+
t.nonTerminalTextColor,
|
|
244
|
+
n.nonTerminalTextColor
|
|
245
|
+
),
|
|
246
|
+
lineColor: m(t.lineColor, n.lineColor),
|
|
247
|
+
strokeWidth: F(t.strokeWidth, n.strokeWidth),
|
|
248
|
+
markerFill: m(t.markerFill, n.markerFill),
|
|
249
|
+
commentFill: m(t.commentFill, n.commentFill),
|
|
250
|
+
commentStroke: m(t.commentStroke, n.commentStroke),
|
|
251
|
+
commentTextColor: m(
|
|
252
|
+
t.commentTextColor,
|
|
253
|
+
n.commentTextColor
|
|
254
|
+
),
|
|
255
|
+
specialFill: m(t.specialFill, n.specialFill),
|
|
256
|
+
specialStroke: m(t.specialStroke, n.specialStroke),
|
|
257
|
+
ruleNameColor: m(t.ruleNameColor, n.ruleNameColor),
|
|
258
|
+
showMarkers: t.showMarkers ?? n.showMarkers,
|
|
259
|
+
markerRadius: F(t.markerRadius, n.markerRadius)
|
|
260
|
+
};
|
|
261
|
+
}, "buildRailroadStyleOptions"), Te = /* @__PURE__ */ p((e) => {
|
|
262
|
+
const {
|
|
263
|
+
fontFamily: i,
|
|
264
|
+
fontSize: a,
|
|
265
|
+
terminalFill: n,
|
|
266
|
+
terminalStroke: t,
|
|
267
|
+
terminalTextColor: r,
|
|
268
|
+
nonTerminalFill: o,
|
|
269
|
+
nonTerminalStroke: g,
|
|
270
|
+
nonTerminalTextColor: l,
|
|
271
|
+
lineColor: s,
|
|
272
|
+
strokeWidth: h,
|
|
273
|
+
markerFill: u,
|
|
274
|
+
commentFill: c,
|
|
275
|
+
commentStroke: w,
|
|
276
|
+
commentTextColor: d,
|
|
277
|
+
specialFill: T,
|
|
278
|
+
specialStroke: z,
|
|
279
|
+
ruleNameColor: S
|
|
280
|
+
} = E(e);
|
|
281
|
+
return `
|
|
282
|
+
.railroad-diagram {
|
|
283
|
+
font-family: ${i};
|
|
284
|
+
font-size: ${a}px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.railroad-terminal rect {
|
|
288
|
+
fill: ${n};
|
|
289
|
+
stroke: ${t};
|
|
290
|
+
stroke-width: ${h}px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.railroad-terminal text {
|
|
294
|
+
fill: ${r};
|
|
295
|
+
font-family: ${i};
|
|
296
|
+
font-size: ${a}px;
|
|
297
|
+
text-anchor: middle;
|
|
298
|
+
dominant-baseline: middle;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.railroad-nonterminal rect {
|
|
302
|
+
fill: ${o};
|
|
303
|
+
stroke: ${g};
|
|
304
|
+
stroke-width: ${h}px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.railroad-nonterminal text {
|
|
308
|
+
fill: ${l};
|
|
309
|
+
font-family: ${i};
|
|
310
|
+
font-size: ${a}px;
|
|
311
|
+
text-anchor: middle;
|
|
312
|
+
dominant-baseline: middle;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.railroad-line {
|
|
316
|
+
stroke: ${s};
|
|
317
|
+
stroke-width: ${h}px;
|
|
318
|
+
fill: none;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.railroad-start circle,
|
|
322
|
+
.railroad-end circle {
|
|
323
|
+
fill: ${u};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.railroad-comment ellipse {
|
|
327
|
+
fill: ${c};
|
|
328
|
+
stroke: ${w};
|
|
329
|
+
stroke-width: ${h}px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.railroad-comment text {
|
|
333
|
+
fill: ${d};
|
|
334
|
+
font-style: italic;
|
|
335
|
+
font-family: ${i};
|
|
336
|
+
font-size: ${a}px;
|
|
337
|
+
text-anchor: middle;
|
|
338
|
+
dominant-baseline: middle;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.railroad-special rect {
|
|
342
|
+
fill: ${T};
|
|
343
|
+
stroke: ${z};
|
|
344
|
+
stroke-width: ${h}px;
|
|
345
|
+
stroke-dasharray: 5,3;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.railroad-special text {
|
|
349
|
+
fill: ${l};
|
|
350
|
+
font-family: ${i};
|
|
351
|
+
font-size: ${a}px;
|
|
352
|
+
text-anchor: middle;
|
|
353
|
+
dominant-baseline: middle;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.railroad-rule-name {
|
|
357
|
+
font-weight: bold;
|
|
358
|
+
fill: ${S};
|
|
359
|
+
font-family: ${i};
|
|
360
|
+
font-size: ${a}px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.railroad-group {
|
|
364
|
+
/* Grouping container, no specific styles */
|
|
365
|
+
}
|
|
366
|
+
`;
|
|
367
|
+
}, "getStyles"), R, x = (R = class {
|
|
368
|
+
constructor() {
|
|
369
|
+
this.d = "";
|
|
370
|
+
}
|
|
371
|
+
moveTo(i, a) {
|
|
372
|
+
return this.d += `M ${i} ${a} `, this;
|
|
373
|
+
}
|
|
374
|
+
lineTo(i, a) {
|
|
375
|
+
return this.d += `L ${i} ${a} `, this;
|
|
376
|
+
}
|
|
377
|
+
horizontalTo(i) {
|
|
378
|
+
return this.d += `H ${i} `, this;
|
|
379
|
+
}
|
|
380
|
+
verticalTo(i) {
|
|
381
|
+
return this.d += `V ${i} `, this;
|
|
382
|
+
}
|
|
383
|
+
arcTo(i, a, n, t, r, o, g) {
|
|
384
|
+
return this.d += `A ${i} ${a} ${n} ${t ? 1 : 0} ${r ? 1 : 0} ${o} ${g} `, this;
|
|
385
|
+
}
|
|
386
|
+
build() {
|
|
387
|
+
return this.d.trim();
|
|
388
|
+
}
|
|
389
|
+
}, p(R, "PathBuilder"), R), $, ue = ($ = class {
|
|
390
|
+
constructor(i, a = E()) {
|
|
391
|
+
this.textCache = /* @__PURE__ */ new Map(), this.svg = i, this.config = a;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Measure text dimensions
|
|
395
|
+
*/
|
|
396
|
+
measureText(i) {
|
|
397
|
+
if (this.textCache.has(i))
|
|
398
|
+
return this.textCache.get(i);
|
|
399
|
+
const a = this.svg.append("text").attr("font-family", this.config.fontFamily).attr("font-size", this.config.fontSize).text(i), n = a.node().getBBox(), t = { width: n.width, height: n.height };
|
|
400
|
+
return a.remove(), this.textCache.set(i, t), t;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Render terminal symbol (rounded rectangle)
|
|
404
|
+
*/
|
|
405
|
+
renderTerminal(i, a) {
|
|
406
|
+
const n = this.measureText(a), t = n.width + this.config.padding * 2, r = n.height + this.config.padding * 2, o = i.append("g").attr("class", "railroad-terminal");
|
|
407
|
+
return o.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", r).attr("rx", 10).attr("ry", 10), o.append("text").attr("x", t / 2).attr("y", r / 2).text(a), {
|
|
408
|
+
element: o.node(),
|
|
409
|
+
dimensions: {
|
|
410
|
+
width: t,
|
|
411
|
+
height: r,
|
|
412
|
+
up: r / 2,
|
|
413
|
+
down: r / 2
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Render non-terminal symbol (rectangle)
|
|
419
|
+
*/
|
|
420
|
+
renderNonTerminal(i, a) {
|
|
421
|
+
const n = this.measureText(a), t = n.width + this.config.padding * 2, r = n.height + this.config.padding * 2, o = i.append("g").attr("class", "railroad-nonterminal");
|
|
422
|
+
return o.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", r), o.append("text").attr("x", t / 2).attr("y", r / 2).text(a), {
|
|
423
|
+
element: o.node(),
|
|
424
|
+
dimensions: {
|
|
425
|
+
width: t,
|
|
426
|
+
height: r,
|
|
427
|
+
up: r / 2,
|
|
428
|
+
down: r / 2
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Render sequence (horizontal concatenation)
|
|
434
|
+
*/
|
|
435
|
+
renderSequence(i, a) {
|
|
436
|
+
const n = a.map((s) => this.renderExpression(i, s));
|
|
437
|
+
let t = 0, r = 0, o = 0;
|
|
438
|
+
for (const s of n)
|
|
439
|
+
t += s.dimensions.width, r = Math.max(r, s.dimensions.up), o = Math.max(o, s.dimensions.down);
|
|
440
|
+
t += (n.length - 1) * this.config.horizontalSeparation;
|
|
441
|
+
const g = i.append("g").attr("class", "railroad-sequence");
|
|
442
|
+
let l = 0;
|
|
443
|
+
for (let s = 0; s < n.length; s++) {
|
|
444
|
+
const h = n[s], u = r - h.dimensions.up;
|
|
445
|
+
if (g.node().appendChild(h.element).setAttribute("transform", `translate(${l}, ${u})`), s < n.length - 1) {
|
|
446
|
+
const w = l + h.dimensions.width, d = w + this.config.horizontalSeparation, T = r;
|
|
447
|
+
g.append("path").attr("class", "railroad-line").attr("d", new x().moveTo(w, T).lineTo(d, T).build());
|
|
448
|
+
}
|
|
449
|
+
l += h.dimensions.width + this.config.horizontalSeparation;
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
element: g.node(),
|
|
453
|
+
dimensions: {
|
|
454
|
+
width: t,
|
|
455
|
+
height: r + o,
|
|
456
|
+
up: r,
|
|
457
|
+
down: o
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Render choice (vertical alternatives)
|
|
463
|
+
*/
|
|
464
|
+
renderChoice(i, a) {
|
|
465
|
+
const n = a.map((c) => this.renderExpression(i, c));
|
|
466
|
+
let t = 0, r = 0;
|
|
467
|
+
for (const c of n)
|
|
468
|
+
t = Math.max(t, c.dimensions.width), r += c.dimensions.height;
|
|
469
|
+
r += (n.length - 1) * this.config.verticalSeparation;
|
|
470
|
+
const o = this.config.arcRadius, g = o * 4, l = t + g, s = i.append("g").attr("class", "railroad-choice");
|
|
471
|
+
let h = 0;
|
|
472
|
+
const u = r / 2;
|
|
473
|
+
for (const c of n) {
|
|
474
|
+
const w = h, d = w + c.dimensions.up, T = o * 2 + (t - c.dimensions.width) / 2;
|
|
475
|
+
s.node().appendChild(c.element).setAttribute("transform", `translate(${T}, ${w})`);
|
|
476
|
+
const S = new x(), k = d > u;
|
|
477
|
+
d === u ? S.moveTo(0, u).lineTo(T, d) : S.moveTo(0, u).arcTo(
|
|
478
|
+
o,
|
|
479
|
+
o,
|
|
480
|
+
0,
|
|
481
|
+
!1,
|
|
482
|
+
k,
|
|
483
|
+
o,
|
|
484
|
+
u + (k ? o : -o)
|
|
485
|
+
).lineTo(o, d - (k ? o : -o)).arcTo(o, o, 0, !1, !k, o * 2, d).lineTo(T, d), s.append("path").attr("class", "railroad-line").attr("d", S.build());
|
|
486
|
+
const N = new x(), _ = T + c.dimensions.width, X = l - o * 2;
|
|
487
|
+
d === u ? N.moveTo(_, d).lineTo(l, u) : N.moveTo(_, d).lineTo(X, d).arcTo(
|
|
488
|
+
o,
|
|
489
|
+
o,
|
|
490
|
+
0,
|
|
491
|
+
!1,
|
|
492
|
+
!k,
|
|
493
|
+
l - o,
|
|
494
|
+
d + (k ? -o : o)
|
|
495
|
+
).lineTo(l - o, u + (k ? o : -o)).arcTo(o, o, 0, !1, k, l, u), s.append("path").attr("class", "railroad-line").attr("d", N.build()), h += c.dimensions.height + this.config.verticalSeparation;
|
|
496
|
+
}
|
|
497
|
+
return {
|
|
498
|
+
element: s.node(),
|
|
499
|
+
dimensions: {
|
|
500
|
+
width: l,
|
|
501
|
+
height: r,
|
|
502
|
+
up: u,
|
|
503
|
+
down: r - u
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Render optional (bypass path above)
|
|
509
|
+
*/
|
|
510
|
+
renderOptional(i, a) {
|
|
511
|
+
const n = this.renderExpression(i, a), t = this.config.arcRadius, r = t * 2, o = n.dimensions.width + t * 4, g = n.dimensions.height + r, l = i.append("g").attr("class", "railroad-optional"), s = t * 2, h = r;
|
|
512
|
+
l.node().appendChild(n.element).setAttribute("transform", `translate(${s}, ${h})`);
|
|
513
|
+
const c = h + n.dimensions.up, w = new x().moveTo(0, c).lineTo(t * 2, c);
|
|
514
|
+
l.append("path").attr("class", "railroad-line").attr("d", w.build());
|
|
515
|
+
const d = new x().moveTo(s + n.dimensions.width, c).lineTo(o, c);
|
|
516
|
+
l.append("path").attr("class", "railroad-line").attr("d", d.build());
|
|
517
|
+
const T = new x().moveTo(0, c).arcTo(t, t, 0, !1, !1, t, c - t).lineTo(t, t).arcTo(t, t, 0, !1, !0, t * 2, 0).lineTo(o - t * 2, 0).arcTo(t, t, 0, !1, !0, o - t, t).lineTo(o - t, c - t).arcTo(t, t, 0, !1, !1, o, c);
|
|
518
|
+
return l.append("path").attr("class", "railroad-line").attr("d", T.build()), {
|
|
519
|
+
element: l.node(),
|
|
520
|
+
dimensions: {
|
|
521
|
+
width: o,
|
|
522
|
+
height: g,
|
|
523
|
+
up: c,
|
|
524
|
+
down: g - c
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Render repetition (loop back path)
|
|
530
|
+
*/
|
|
531
|
+
renderRepetition(i, a, n) {
|
|
532
|
+
const t = this.renderExpression(i, a), r = this.config.arcRadius, o = r * 2, g = t.dimensions.width + r * 4, l = n === 0, s = t.dimensions.height + o + (l ? o : 0), h = i.append("g").attr("class", "railroad-repetition"), u = r * 2, c = l ? o : 0;
|
|
533
|
+
h.node().appendChild(t.element).setAttribute("transform", `translate(${u}, ${c})`);
|
|
534
|
+
const d = c + t.dimensions.up;
|
|
535
|
+
h.append("path").attr("class", "railroad-line").attr(
|
|
536
|
+
"d",
|
|
537
|
+
new x().moveTo(0, d).lineTo(r * 2, d).build()
|
|
538
|
+
), h.append("path").attr("class", "railroad-line").attr(
|
|
539
|
+
"d",
|
|
540
|
+
new x().moveTo(u + t.dimensions.width, d).lineTo(g, d).build()
|
|
541
|
+
);
|
|
542
|
+
const T = c + t.dimensions.height + r, z = new x().moveTo(u + t.dimensions.width, d).arcTo(
|
|
543
|
+
r,
|
|
544
|
+
r,
|
|
545
|
+
0,
|
|
546
|
+
!1,
|
|
547
|
+
!0,
|
|
548
|
+
u + t.dimensions.width + r,
|
|
549
|
+
d + r
|
|
550
|
+
).lineTo(u + t.dimensions.width + r, T).arcTo(
|
|
551
|
+
r,
|
|
552
|
+
r,
|
|
553
|
+
0,
|
|
554
|
+
!1,
|
|
555
|
+
!0,
|
|
556
|
+
u + t.dimensions.width,
|
|
557
|
+
T + r
|
|
558
|
+
).lineTo(r * 2, T + r).arcTo(r, r, 0, !1, !0, r, T).lineTo(r, d + r).arcTo(r, r, 0, !1, !0, r * 2, d);
|
|
559
|
+
if (h.append("path").attr("class", "railroad-line").attr("d", z.build()), l) {
|
|
560
|
+
const S = new x().moveTo(0, d).arcTo(r, r, 0, !1, !1, r, d - r).lineTo(r, r).arcTo(r, r, 0, !1, !0, r * 2, 0).lineTo(g - r * 2, 0).arcTo(r, r, 0, !1, !0, g - r, r).lineTo(g - r, d - r).arcTo(r, r, 0, !1, !1, g, d);
|
|
561
|
+
h.append("path").attr("class", "railroad-line").attr("d", S.build());
|
|
562
|
+
}
|
|
563
|
+
return {
|
|
564
|
+
element: h.node(),
|
|
565
|
+
dimensions: {
|
|
566
|
+
width: g,
|
|
567
|
+
height: s,
|
|
568
|
+
up: d,
|
|
569
|
+
down: s - d
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Render special sequence
|
|
575
|
+
*/
|
|
576
|
+
renderSpecial(i, a) {
|
|
577
|
+
const n = this.measureText("? " + a + " ?"), t = n.width + this.config.padding * 2, r = n.height + this.config.padding * 2, o = i.append("g").attr("class", "railroad-special");
|
|
578
|
+
return o.append("rect").attr("x", 0).attr("y", 0).attr("width", t).attr("height", r), o.append("text").attr("x", t / 2).attr("y", r / 2).text("? " + a + " ?"), {
|
|
579
|
+
element: o.node(),
|
|
580
|
+
dimensions: {
|
|
581
|
+
width: t,
|
|
582
|
+
height: r,
|
|
583
|
+
up: r / 2,
|
|
584
|
+
down: r / 2
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Render an expression (recursive)
|
|
590
|
+
*/
|
|
591
|
+
renderExpression(i, a) {
|
|
592
|
+
switch (a.type) {
|
|
593
|
+
case "terminal":
|
|
594
|
+
return this.renderTerminal(i, a.value);
|
|
595
|
+
case "nonterminal":
|
|
596
|
+
return this.renderNonTerminal(i, a.name);
|
|
597
|
+
case "sequence":
|
|
598
|
+
return this.renderSequence(i, a.elements);
|
|
599
|
+
case "choice":
|
|
600
|
+
return this.renderChoice(i, a.alternatives);
|
|
601
|
+
case "optional":
|
|
602
|
+
return this.renderOptional(i, a.element);
|
|
603
|
+
case "repetition":
|
|
604
|
+
return this.renderRepetition(i, a.element, a.min);
|
|
605
|
+
case "special":
|
|
606
|
+
return this.renderSpecial(i, a.text);
|
|
607
|
+
default:
|
|
608
|
+
throw new Error(`Unknown node type: ${a.type}`);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Render a single rule
|
|
613
|
+
*/
|
|
614
|
+
renderRule(i, a) {
|
|
615
|
+
const n = this.svg.append("g").attr("class", "railroad-rule").attr("transform", `translate(0, ${a})`), t = i.name + " =", r = this.measureText(t).width + 20, o = r + 20, g = n.append("g"), l = this.renderExpression(g, i.definition), s = Math.max(20, l.dimensions.up), h = s - l.dimensions.up;
|
|
616
|
+
return g.attr("transform", `translate(${o}, ${h})`), n.append("g").attr("class", "railroad-rule-name-group").append("text").attr("class", "railroad-rule-name").attr("x", 0).attr("y", s).text(t), n.append("g").attr("class", "railroad-start").append("circle").attr("cx", r).attr("cy", s).attr("r", this.config.markerRadius), n.append("g").attr("class", "railroad-end").append("circle").attr("cx", o + l.dimensions.width + 10).attr("cy", s).attr("r", this.config.markerRadius), n.append("path").attr("class", "railroad-line").attr(
|
|
617
|
+
"d",
|
|
618
|
+
new x().moveTo(r + this.config.markerRadius, s).lineTo(o, s).build()
|
|
619
|
+
), n.append("path").attr("class", "railroad-line").attr(
|
|
620
|
+
"d",
|
|
621
|
+
new x().moveTo(o + l.dimensions.width, s).lineTo(o + l.dimensions.width + 10 - this.config.markerRadius, s).build()
|
|
622
|
+
), {
|
|
623
|
+
height: Math.max(40, h + l.dimensions.height + this.config.padding * 2),
|
|
624
|
+
width: o + l.dimensions.width + 10 + this.config.markerRadius
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Render all rules
|
|
629
|
+
*/
|
|
630
|
+
renderDiagram(i) {
|
|
631
|
+
let a = this.config.padding, n = 0;
|
|
632
|
+
for (const t of i) {
|
|
633
|
+
const r = this.renderRule(t, a);
|
|
634
|
+
a += r.height + this.config.verticalSeparation, n = Math.max(n, r.width);
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
width: n + this.config.padding * 2,
|
|
638
|
+
height: a + this.config.padding
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
}, p($, "RailroadRenderer"), $), W = /* @__PURE__ */ p((e, i, a) => {
|
|
642
|
+
U(e, i.height, i.width, a), e.attr("viewBox", `0 0 ${i.width} ${i.height}`);
|
|
643
|
+
}, "configureRailroadSvgSize"), ge = /* @__PURE__ */ p((e, i, a) => {
|
|
644
|
+
C.debug(`[Railroad] Rendering diagram
|
|
645
|
+
` + e);
|
|
646
|
+
try {
|
|
647
|
+
const n = H(i);
|
|
648
|
+
n.attr("class", "railroad-diagram");
|
|
649
|
+
const r = B().railroad?.useMaxWidth ?? !0, o = oe.getRules();
|
|
650
|
+
if (C.debug(`[Railroad] Rendering ${o.length} rules`), o.length === 0) {
|
|
651
|
+
C.warn("[Railroad] No rules to render"), W(n, { height: 100, width: 200 }, r);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const l = new ue(n, E()).renderDiagram(o);
|
|
655
|
+
W(n, l, r), C.debug("[Railroad] Render complete");
|
|
656
|
+
} catch (n) {
|
|
657
|
+
throw C.error("[Railroad] Render error:", n), n;
|
|
658
|
+
}
|
|
659
|
+
}, "draw"), xe = { draw: ge };
|
|
660
|
+
export {
|
|
661
|
+
oe as d,
|
|
662
|
+
Te as g,
|
|
663
|
+
xe as r
|
|
664
|
+
};
|