@diagrammo/dgmo 0.46.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/{src/block/parser.ts → dist/chunk-7JEGTRLD.js} +100 -189
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/{editor.cjs → chunk-DKEPS5LH.js} +14 -225
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/{src/c4/layout.ts → dist/chunk-QEBUY5NY.js} +384 -1140
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/{src/utils/time-ticks.ts → dist/chunk-YRYKTYMQ.js} +45 -112
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/{src/gantt/calculator.ts → dist/chunk-Z72XRXD4.js} +236 -428
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +19 -70
- package/dist/advanced.cjs +0 -71648
- package/dist/advanced.d.cts +0 -6571
- package/dist/auto.cjs +0 -70648
- package/dist/auto.d.cts +0 -54
- package/dist/block.cjs +0 -70208
- package/dist/block.d.cts +0 -115
- package/dist/editor.d.cts +0 -26
- package/dist/element.cjs +0 -70530
- package/dist/element.d.cts +0 -62
- package/dist/highlight.cjs +0 -852
- package/dist/highlight.d.cts +0 -49
- package/dist/index.cjs +0 -70491
- package/dist/index.d.cts +0 -626
- package/dist/pert.cjs +0 -325
- package/dist/pert.d.cts +0 -559
- package/src/advanced.ts +0 -873
- package/src/arc/parser.ts +0 -15
- package/src/arc/renderer.ts +0 -633
- package/src/auto/index.ts +0 -621
- package/src/auto/shared.ts +0 -370
- package/src/auto/styles.ts +0 -73
- package/src/block/layout.ts +0 -198
- package/src/block/renderer.ts +0 -484
- package/src/block/types.ts +0 -67
- package/src/boxes-and-lines/collapse.ts +0 -96
- package/src/boxes-and-lines/focus.ts +0 -257
- package/src/boxes-and-lines/label-placement.ts +0 -339
- package/src/boxes-and-lines/layout-grouped.ts +0 -912
- package/src/boxes-and-lines/layout-layered.ts +0 -722
- package/src/boxes-and-lines/layout-search.ts +0 -1678
- package/src/boxes-and-lines/layout.ts +0 -398
- package/src/boxes-and-lines/parser.ts +0 -1181
- package/src/boxes-and-lines/renderer.ts +0 -1465
- package/src/boxes-and-lines/types.ts +0 -66
- package/src/c4/parser.ts +0 -1158
- package/src/c4/renderer.ts +0 -2008
- package/src/c4/types.ts +0 -89
- package/src/chart-type-registry.ts +0 -529
- package/src/chart-types.ts +0 -225
- package/src/chart.ts +0 -685
- package/src/charts-d3/bar.ts +0 -338
- package/src/charts-d3/chord.ts +0 -140
- package/src/charts-d3/function.ts +0 -147
- package/src/charts-d3/funnel.ts +0 -104
- package/src/charts-d3/heatmap.ts +0 -145
- package/src/charts-d3/index.ts +0 -337
- package/src/charts-d3/interactions.ts +0 -477
- package/src/charts-d3/line.ts +0 -344
- package/src/charts-d3/mount.ts +0 -151
- package/src/charts-d3/pie.ts +0 -117
- package/src/charts-d3/polar.ts +0 -89
- package/src/charts-d3/radar.ts +0 -0
- package/src/charts-d3/sankey.ts +0 -0
- package/src/charts-d3/scatter.ts +0 -185
- package/src/charts-d3/shared.ts +0 -208
- package/src/class/layout.ts +0 -326
- package/src/class/parser.ts +0 -635
- package/src/class/renderer.ts +0 -793
- package/src/class/types.ts +0 -58
- package/src/cli-banner.ts +0 -106
- package/src/cli.ts +0 -1080
- package/src/colors-diagnostics.ts +0 -35
- package/src/colors.ts +0 -379
- package/src/completion-types.ts +0 -27
- package/src/completion.ts +0 -2668
- package/src/cycle/layout.ts +0 -1026
- package/src/cycle/parser.ts +0 -387
- package/src/cycle/renderer.ts +0 -653
- package/src/cycle/types.ts +0 -101
- package/src/d3.ts +0 -1434
- package/src/data-chart-parser.ts +0 -1007
- package/src/dgmo-router.ts +0 -296
- package/src/diagnostics-registry.ts +0 -108
- package/src/diagnostics.ts +0 -0
- package/src/dimensions.ts +0 -20
- package/src/directives-registry.ts +0 -396
- package/src/editor/dgmo.grammar +0 -76
- package/src/editor/dgmo.grammar.d.ts +0 -2
- package/src/editor/dgmo.grammar.js +0 -18
- package/src/editor/dgmo.grammar.terms.d.ts +0 -5
- package/src/editor/dgmo.grammar.terms.js +0 -35
- package/src/editor/highlight-api.ts +0 -596
- package/src/editor/highlight.ts +0 -36
- package/src/editor/index.ts +0 -27
- package/src/editor/keywords.ts +0 -128
- package/src/editor/tokens.ts +0 -30
- package/src/element/index.ts +0 -432
- package/src/embed/css.ts +0 -312
- package/src/embed/escape.ts +0 -15
- package/src/embed/index.ts +0 -280
- package/src/er/classify.ts +0 -228
- package/src/er/layout.ts +0 -530
- package/src/er/parser.ts +0 -750
- package/src/er/renderer.ts +0 -725
- package/src/er/types.ts +0 -52
- package/src/error-card.ts +0 -269
- package/src/event-line/diagnostics.ts +0 -117
- package/src/event-line/parser.ts +0 -643
- package/src/event-line/renderer.ts +0 -1742
- package/src/event-line/types.ts +0 -74
- package/src/fonts.ts +0 -3
- package/src/gantt/parser.ts +0 -1641
- package/src/gantt/renderer.ts +0 -3787
- package/src/gantt/resolver.ts +0 -172
- package/src/gantt/types.ts +0 -206
- package/src/graph/diagnostics.ts +0 -64
- package/src/graph/edge-spline.ts +0 -29
- package/src/graph/flowchart-parser.ts +0 -759
- package/src/graph/flowchart-renderer.ts +0 -817
- package/src/graph/layout.ts +0 -472
- package/src/graph/notes.ts +0 -21
- package/src/graph/state-collapse.ts +0 -78
- package/src/graph/state-parser.ts +0 -574
- package/src/graph/state-renderer.ts +0 -653
- package/src/graph/types.ts +0 -65
- package/src/index.ts +0 -261
- package/src/infra/compute.ts +0 -1385
- package/src/infra/layout.ts +0 -888
- package/src/infra/parser.ts +0 -1234
- package/src/infra/renderer.ts +0 -2534
- package/src/infra/roles.ts +0 -75
- package/src/infra/types.ts +0 -216
- package/src/infra/validation.ts +0 -201
- package/src/journey-map/layout.ts +0 -490
- package/src/journey-map/parser.ts +0 -557
- package/src/journey-map/renderer.ts +0 -1580
- package/src/journey-map/types.ts +0 -47
- package/src/kanban/mutations.ts +0 -175
- package/src/kanban/parser.ts +0 -509
- package/src/kanban/renderer.ts +0 -1449
- package/src/kanban/types.ts +0 -39
- package/src/label-layout.ts +0 -368
- package/src/map/colorize.ts +0 -54
- package/src/map/completion.ts +0 -316
- package/src/map/context-labels.ts +0 -609
- package/src/map/data/PROVENANCE.json +0 -1
- package/src/map/data/README.md +0 -40
- package/src/map/data/airport-collisions.json +0 -1
- package/src/map/data/airports.json +0 -1
- package/src/map/data/gazetteer.json +0 -1
- package/src/map/data/lakes.json +0 -1
- package/src/map/data/mountain-ranges.json +0 -1
- package/src/map/data/na-lakes.json +0 -1
- package/src/map/data/na-land.json +0 -1
- package/src/map/data/region-names.json +0 -1
- package/src/map/data/rivers.json +0 -1
- package/src/map/data/types.ts +0 -121
- package/src/map/data/us-states.json +0 -1
- package/src/map/data/water-bodies.json +0 -1
- package/src/map/data/world-coarse.json +0 -1
- package/src/map/data/world-detail.json +0 -1
- package/src/map/diagnostics.ts +0 -134
- package/src/map/dimensions.ts +0 -150
- package/src/map/geo-query.ts +0 -295
- package/src/map/geo.ts +0 -438
- package/src/map/invert.ts +0 -111
- package/src/map/layout.ts +0 -5069
- package/src/map/legend-band.ts +0 -127
- package/src/map/load-data.ts +0 -186
- package/src/map/parser.ts +0 -783
- package/src/map/renderer.ts +0 -1445
- package/src/map/resolved-types.ts +0 -160
- package/src/map/resolver.ts +0 -1146
- package/src/map/types.ts +0 -194
- package/src/mindmap/collapse.ts +0 -67
- package/src/mindmap/layout.ts +0 -649
- package/src/mindmap/parser.ts +0 -430
- package/src/mindmap/renderer.ts +0 -637
- package/src/mindmap/text-wrap.ts +0 -218
- package/src/mindmap/types.ts +0 -56
- package/src/org/collapse.ts +0 -151
- package/src/org/layout.ts +0 -1262
- package/src/org/parser.ts +0 -519
- package/src/org/renderer.ts +0 -866
- package/src/org/resolver.ts +0 -636
- package/src/palettes/atlas.ts +0 -77
- package/src/palettes/blueprint.ts +0 -73
- package/src/palettes/catppuccin.ts +0 -84
- package/src/palettes/color-utils.ts +0 -443
- package/src/palettes/index.ts +0 -67
- package/src/palettes/nord.ts +0 -67
- package/src/palettes/registry.ts +0 -114
- package/src/palettes/slate.ts +0 -73
- package/src/palettes/tidewater.ts +0 -73
- package/src/palettes/tokyo-night.ts +0 -86
- package/src/palettes/types.ts +0 -88
- package/src/pert/analyzer.ts +0 -1183
- package/src/pert/diagnostics.ts +0 -110
- package/src/pert/index.ts +0 -43
- package/src/pert/internal.ts +0 -252
- package/src/pert/layout.ts +0 -971
- package/src/pert/monte-carlo.ts +0 -446
- package/src/pert/parser.ts +0 -1606
- package/src/pert/renderer.ts +0 -4009
- package/src/pert/share-normalize.ts +0 -62
- package/src/pert/types.ts +0 -604
- package/src/pyramid/parser.ts +0 -185
- package/src/pyramid/renderer.ts +0 -768
- package/src/pyramid/types.ts +0 -28
- package/src/quadrant/parser.ts +0 -18
- package/src/quadrant/renderer.ts +0 -638
- package/src/raci/diagnostics.ts +0 -213
- package/src/raci/index.ts +0 -23
- package/src/raci/mutations.ts +0 -321
- package/src/raci/parser.ts +0 -699
- package/src/raci/renderer.ts +0 -1627
- package/src/raci/types.ts +0 -82
- package/src/raci/variants.ts +0 -320
- package/src/render.ts +0 -268
- package/src/ring/parser.ts +0 -212
- package/src/ring/renderer.ts +0 -490
- package/src/ring/types.ts +0 -27
- package/src/sequence/collapse.ts +0 -174
- package/src/sequence/parser.ts +0 -1596
- package/src/sequence/participant-inference.ts +0 -152
- package/src/sequence/renderer.ts +0 -3168
- package/src/sequence/tag-resolution.ts +0 -164
- package/src/sharing.ts +0 -211
- package/src/sitemap/collapse.ts +0 -100
- package/src/sitemap/layout.ts +0 -925
- package/src/sitemap/parser.ts +0 -755
- package/src/sitemap/renderer.ts +0 -828
- package/src/sitemap/types.ts +0 -42
- package/src/slope/parser.ts +0 -18
- package/src/slope/renderer.ts +0 -378
- package/src/swimlane/diagnostics.ts +0 -94
- package/src/swimlane/layout.ts +0 -597
- package/src/swimlane/parser.ts +0 -613
- package/src/swimlane/renderer.ts +0 -681
- package/src/swimlane/types.ts +0 -151
- package/src/tech-radar/interactive.ts +0 -1129
- package/src/tech-radar/layout.ts +0 -197
- package/src/tech-radar/parser.ts +0 -436
- package/src/tech-radar/renderer.ts +0 -1239
- package/src/tech-radar/shared.ts +0 -151
- package/src/tech-radar/types.ts +0 -86
- package/src/themes.ts +0 -22
- package/src/timeline/parser.ts +0 -472
- package/src/timeline/renderer.ts +0 -3024
- package/src/timeline/types.ts +0 -33
- package/src/timeline/viz-parser.ts +0 -21
- package/src/treemap/diagnostics.ts +0 -62
- package/src/treemap/layout-radial.ts +0 -233
- package/src/treemap/layout.ts +0 -189
- package/src/treemap/parser.ts +0 -463
- package/src/treemap/renderer-radial.ts +0 -438
- package/src/treemap/renderer.ts +0 -572
- package/src/treemap/treemap-shared.ts +0 -309
- package/src/treemap/types.ts +0 -60
- package/src/utils/arrow-markers.ts +0 -51
- package/src/utils/arrows-diagnostics.ts +0 -62
- package/src/utils/arrows.ts +0 -227
- package/src/utils/brand.ts +0 -61
- package/src/utils/card.ts +0 -183
- package/src/utils/collapse-engine/tree-edges.ts +0 -115
- package/src/utils/collapse-engine/tree.ts +0 -117
- package/src/utils/d3-helpers.ts +0 -219
- package/src/utils/d3-types.ts +0 -9
- package/src/utils/description-helpers.ts +0 -38
- package/src/utils/duration.ts +0 -312
- package/src/utils/export-container.ts +0 -41
- package/src/utils/expr-eval.ts +0 -27
- package/src/utils/fit-canvas.ts +0 -64
- package/src/utils/hover-styles.ts +0 -673
- package/src/utils/inline-markdown.ts +0 -96
- package/src/utils/legend-constants.ts +0 -48
- package/src/utils/legend-d3.ts +0 -618
- package/src/utils/legend-integration.ts +0 -107
- package/src/utils/legend-layout.ts +0 -776
- package/src/utils/legend-svg.ts +0 -214
- package/src/utils/legend-types.ts +0 -272
- package/src/utils/name-normalize.ts +0 -163
- package/src/utils/note-box/constants.ts +0 -25
- package/src/utils/note-box/index.ts +0 -11
- package/src/utils/note-box/metrics.ts +0 -90
- package/src/utils/note-box/svg.ts +0 -331
- package/src/utils/notes/bounds.ts +0 -30
- package/src/utils/notes/build.ts +0 -131
- package/src/utils/notes/index.ts +0 -18
- package/src/utils/notes/model.ts +0 -19
- package/src/utils/notes/parse.ts +0 -131
- package/src/utils/notes/place.ts +0 -177
- package/src/utils/notes/resolve.ts +0 -88
- package/src/utils/number-format.ts +0 -36
- package/src/utils/parsing.ts +0 -953
- package/src/utils/reserved-key-registry.ts +0 -239
- package/src/utils/safe-href.ts +0 -38
- package/src/utils/scaling.ts +0 -97
- package/src/utils/svg-embed.ts +0 -251
- package/src/utils/tag-groups.ts +0 -607
- package/src/utils/text-measure.ts +0 -122
- package/src/utils/title-constants.ts +0 -24
- package/src/utils/visual-conventions.ts +0 -61
- package/src/utils/wrapped-desc.ts +0 -87
- package/src/venn/parser.ts +0 -18
- package/src/venn/renderer.ts +0 -1047
- package/src/version-control/diagnostics.ts +0 -67
- package/src/version-control/parser.ts +0 -544
- package/src/version-control/renderer.ts +0 -724
- package/src/version-control/types.ts +0 -100
- package/src/visualizations/parse.ts +0 -1560
- package/src/visualizations/types.ts +0 -262
- package/src/wireframe/layout.ts +0 -479
- package/src/wireframe/parser.ts +0 -1114
- package/src/wireframe/renderer.ts +0 -1318
- package/src/wireframe/types.ts +0 -110
- package/src/wordcloud/parser.ts +0 -18
- package/src/wordcloud/renderer.ts +0 -357
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderInlineText
|
|
3
|
+
} from "./chunk-3HDBAXF5.js";
|
|
4
|
+
import {
|
|
5
|
+
wrapDescriptionLines
|
|
6
|
+
} from "./chunk-BMR4CIEO.js";
|
|
7
|
+
import {
|
|
8
|
+
renderIntegratedLegend
|
|
9
|
+
} from "./chunk-PWIHZ6NJ.js";
|
|
10
|
+
import {
|
|
11
|
+
ScaleContext
|
|
12
|
+
} from "./chunk-YYVTBZZC.js";
|
|
13
|
+
import {
|
|
14
|
+
TITLE_FONT_SIZE,
|
|
15
|
+
TITLE_FONT_WEIGHT,
|
|
16
|
+
TITLE_Y
|
|
17
|
+
} from "./chunk-A4GOY3PE.js";
|
|
18
|
+
import {
|
|
19
|
+
FONT_FAMILY
|
|
20
|
+
} from "./chunk-6KFWC4CO.js";
|
|
21
|
+
import {
|
|
22
|
+
LEGEND_HEIGHT
|
|
23
|
+
} from "./chunk-QOOUC2J5.js";
|
|
24
|
+
import {
|
|
25
|
+
measureText,
|
|
26
|
+
wrapTextToWidth
|
|
27
|
+
} from "./chunk-WCT3NYCV.js";
|
|
28
|
+
import {
|
|
29
|
+
contrastText,
|
|
30
|
+
shapeFill
|
|
31
|
+
} from "./chunk-P6T66CCZ.js";
|
|
32
|
+
import {
|
|
33
|
+
resolveColor
|
|
34
|
+
} from "./chunk-TLVIHFRO.js";
|
|
35
|
+
|
|
36
|
+
// src/cycle/renderer.ts
|
|
37
|
+
import * as d3Selection from "d3-selection";
|
|
38
|
+
|
|
39
|
+
// src/cycle/types.ts
|
|
40
|
+
var DEFAULT_EDGE_WIDTH = 3;
|
|
41
|
+
var MIN_EDGE_WIDTH = 2;
|
|
42
|
+
var BASE_ARROW_SIZE = 8;
|
|
43
|
+
var ARROW_SCALE = 6;
|
|
44
|
+
function arrowHeadLength(strokeWidth) {
|
|
45
|
+
return BASE_ARROW_SIZE + ARROW_SCALE * Math.sqrt(strokeWidth);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/cycle/layout.ts
|
|
49
|
+
var MIN_ARC_ANGLE = 15 * Math.PI / 180;
|
|
50
|
+
var LABEL_FONT_SIZE = 13;
|
|
51
|
+
var CIRCLE_LABEL_FONT_SIZE = 16;
|
|
52
|
+
var DESC_FONT_SIZE = 11;
|
|
53
|
+
var EDGE_LABEL_FONT_SIZE = 11;
|
|
54
|
+
var MIN_NODE_WIDTH = 70;
|
|
55
|
+
var MAX_NODE_WIDTH = 260;
|
|
56
|
+
var DESC_MIN_WIDTH = 140;
|
|
57
|
+
var DESC_WIDTH_STEP = 20;
|
|
58
|
+
var DESC_TARGET_RATIO = 1.6;
|
|
59
|
+
var PLAIN_NODE_HEIGHT = 50;
|
|
60
|
+
var HEADER_HEIGHT = 36;
|
|
61
|
+
var DESC_LINE_HEIGHT = 16;
|
|
62
|
+
var DESC_PAD_Y = 14;
|
|
63
|
+
var NODE_PAD_X = 20;
|
|
64
|
+
var MIN_CIRCLE_RADIUS = 35;
|
|
65
|
+
var CIRCLE_PAD = 14;
|
|
66
|
+
function computeCycleLayout(parsed, options) {
|
|
67
|
+
const width = options?.width ?? 800;
|
|
68
|
+
const height = options?.height ?? 600;
|
|
69
|
+
const hideDescriptions = options?.hideDescriptions ?? false;
|
|
70
|
+
if (parsed.nodes.length === 0) {
|
|
71
|
+
return {
|
|
72
|
+
nodes: [],
|
|
73
|
+
edges: [],
|
|
74
|
+
cx: width / 2,
|
|
75
|
+
cy: height / 2,
|
|
76
|
+
radius: 0,
|
|
77
|
+
width,
|
|
78
|
+
height,
|
|
79
|
+
scale: 1
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const nodeCount = parsed.nodes.length;
|
|
83
|
+
const cx = width / 2;
|
|
84
|
+
const cy = height / 2;
|
|
85
|
+
const circleNodes = parsed.options["circle-nodes"] === "true";
|
|
86
|
+
const nodeDims = parsed.nodes.map((node) => {
|
|
87
|
+
const hasDesc = !hideDescriptions && node.description.length > 0;
|
|
88
|
+
const labelWidth = Math.max(
|
|
89
|
+
MIN_NODE_WIDTH,
|
|
90
|
+
measureText(node.label, LABEL_FONT_SIZE) + NODE_PAD_X * 2
|
|
91
|
+
);
|
|
92
|
+
if (circleNodes) {
|
|
93
|
+
return computeCircleNodeDims(node, hasDesc);
|
|
94
|
+
}
|
|
95
|
+
if (!hasDesc) {
|
|
96
|
+
return {
|
|
97
|
+
width: Math.min(MAX_NODE_WIDTH, labelWidth),
|
|
98
|
+
height: PLAIN_NODE_HEIGHT,
|
|
99
|
+
wrappedDesc: []
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return chooseDescribedRectDims(node.description, labelWidth);
|
|
103
|
+
});
|
|
104
|
+
if (circleNodes) {
|
|
105
|
+
const maxDiam = Math.max(...nodeDims.map((d) => d.width));
|
|
106
|
+
for (const d of nodeDims) {
|
|
107
|
+
d.width = maxDiam;
|
|
108
|
+
d.height = maxDiam;
|
|
109
|
+
const nodeIdx = nodeDims.indexOf(d);
|
|
110
|
+
const node = parsed.nodes[nodeIdx];
|
|
111
|
+
const hasDesc = !hideDescriptions && node.description.length > 0;
|
|
112
|
+
if (hasDesc) {
|
|
113
|
+
d.wrappedDesc = wrapLinesForCircle(node.description, maxDiam / 2).map(
|
|
114
|
+
(text) => ({ text, kind: "plain" })
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const totalSpan = parsed.nodes.reduce((sum, n) => sum + n.span, 0);
|
|
120
|
+
let rawAngles = parsed.nodes.map((n) => n.span / totalSpan * 2 * Math.PI);
|
|
121
|
+
const tooSmall = rawAngles.filter((a) => a < MIN_ARC_ANGLE);
|
|
122
|
+
if (tooSmall.length > 0 && tooSmall.length < nodeCount) {
|
|
123
|
+
const deficit = tooSmall.reduce((sum, a) => sum + (MIN_ARC_ANGLE - a), 0);
|
|
124
|
+
const largeTotal = rawAngles.filter((a) => a >= MIN_ARC_ANGLE).reduce((sum, a) => sum + a, 0);
|
|
125
|
+
rawAngles = rawAngles.map((a) => {
|
|
126
|
+
if (a < MIN_ARC_ANGLE) return MIN_ARC_ANGLE;
|
|
127
|
+
return a - a / largeTotal * deficit;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const isClockwise = parsed.direction === "clockwise";
|
|
131
|
+
const GAP = 20;
|
|
132
|
+
let minRadiusForNodes = 0;
|
|
133
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
134
|
+
const j = (i + 1) % nodeCount;
|
|
135
|
+
const diA = Math.sqrt(nodeDims[i].width ** 2 + nodeDims[i].height ** 2) / 2;
|
|
136
|
+
const diB = Math.sqrt(nodeDims[j].width ** 2 + nodeDims[j].height ** 2) / 2;
|
|
137
|
+
const neededChord = diA + diB + GAP;
|
|
138
|
+
const halfAngle = rawAngles[i] / 2;
|
|
139
|
+
if (halfAngle > 1e-3) {
|
|
140
|
+
const r = neededChord / (2 * Math.sin(halfAngle));
|
|
141
|
+
minRadiusForNodes = Math.max(minRadiusForNodes, r);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const maxNodeHalf = Math.max(
|
|
145
|
+
...nodeDims.map((d) => Math.max(d.width, d.height) / 2)
|
|
146
|
+
);
|
|
147
|
+
const maxRadius = Math.min(cx, cy) - maxNodeHalf - 10;
|
|
148
|
+
let radius;
|
|
149
|
+
let scale = 1;
|
|
150
|
+
if (minRadiusForNodes <= maxRadius) {
|
|
151
|
+
radius = Math.max(100, maxRadius);
|
|
152
|
+
} else {
|
|
153
|
+
radius = Math.max(80, maxRadius);
|
|
154
|
+
scale = radius / minRadiusForNodes;
|
|
155
|
+
for (let i = 0; i < nodeDims.length; i++) {
|
|
156
|
+
const d = nodeDims[i];
|
|
157
|
+
const node = parsed.nodes[i];
|
|
158
|
+
const hasDesc = !hideDescriptions && node.description.length > 0;
|
|
159
|
+
const newW = Math.max(50, d.width * scale);
|
|
160
|
+
if (circleNodes) {
|
|
161
|
+
d.width = newW;
|
|
162
|
+
d.height = newW;
|
|
163
|
+
if (hasDesc) {
|
|
164
|
+
d.wrappedDesc = wrapLinesForCircle(node.description, newW / 2).map(
|
|
165
|
+
(text) => ({ text, kind: "plain" })
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
} else if (hasDesc) {
|
|
169
|
+
d.width = newW;
|
|
170
|
+
const layoutWidth = newW / scale;
|
|
171
|
+
d.wrappedDesc = wrapDescForWidth(node.description, layoutWidth);
|
|
172
|
+
d.height = renderedDescNodeHeight(d.wrappedDesc.length, scale);
|
|
173
|
+
} else {
|
|
174
|
+
d.width = newW;
|
|
175
|
+
d.height = Math.max(30, d.height * scale);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const nodeAngles = new Array(nodeCount);
|
|
180
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
181
|
+
nodeAngles[i] = -Math.PI / 2 + i * (2 * Math.PI / nodeCount) * (isClockwise ? 1 : -1);
|
|
182
|
+
}
|
|
183
|
+
const ITERATIONS = 3;
|
|
184
|
+
const footprints = new Array(nodeCount);
|
|
185
|
+
for (let iter = 0; iter < ITERATIONS; iter++) {
|
|
186
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
187
|
+
const theta = nodeAngles[i];
|
|
188
|
+
const approxX = cx + radius * Math.cos(theta);
|
|
189
|
+
const approxY = cy + radius * Math.sin(theta);
|
|
190
|
+
const hw = nodeDims[i].width / 2;
|
|
191
|
+
const hh = nodeDims[i].height / 2;
|
|
192
|
+
let exitCW, exitCCW;
|
|
193
|
+
if (circleNodes) {
|
|
194
|
+
const nodeR = hw;
|
|
195
|
+
exitCW = circleNodeExitAngle(nodeR, radius, theta, 1);
|
|
196
|
+
exitCCW = circleNodeExitAngle(nodeR, radius, theta, -1);
|
|
197
|
+
} else {
|
|
198
|
+
exitCW = circleRectExitAngle(
|
|
199
|
+
approxX,
|
|
200
|
+
approxY,
|
|
201
|
+
hw,
|
|
202
|
+
hh,
|
|
203
|
+
cx,
|
|
204
|
+
cy,
|
|
205
|
+
radius,
|
|
206
|
+
theta,
|
|
207
|
+
1
|
|
208
|
+
);
|
|
209
|
+
exitCCW = circleRectExitAngle(
|
|
210
|
+
approxX,
|
|
211
|
+
approxY,
|
|
212
|
+
hw,
|
|
213
|
+
hh,
|
|
214
|
+
cx,
|
|
215
|
+
cy,
|
|
216
|
+
radius,
|
|
217
|
+
theta,
|
|
218
|
+
-1
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
footprints[i] = Math.abs(exitCW - exitCCW);
|
|
222
|
+
}
|
|
223
|
+
const totalFootprint = footprints.reduce(
|
|
224
|
+
(s, f) => s + f,
|
|
225
|
+
0
|
|
226
|
+
);
|
|
227
|
+
const totalGapAngle = Math.max(0, 2 * Math.PI - totalFootprint);
|
|
228
|
+
const gapAngles = parsed.nodes.map(
|
|
229
|
+
(n) => n.span / totalSpan * totalGapAngle
|
|
230
|
+
);
|
|
231
|
+
let cumAngle = -Math.PI / 2;
|
|
232
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
233
|
+
nodeAngles[i] = cumAngle;
|
|
234
|
+
const nextIdx = (i + 1) % nodeCount;
|
|
235
|
+
const advance = footprints[i] / 2 + gapAngles[i] + footprints[nextIdx] / 2;
|
|
236
|
+
cumAngle += isClockwise ? advance : -advance;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const layoutNodes = [];
|
|
240
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
241
|
+
const angle = nodeAngles[i];
|
|
242
|
+
layoutNodes.push({
|
|
243
|
+
label: parsed.nodes[i].label,
|
|
244
|
+
x: cx + radius * Math.cos(angle),
|
|
245
|
+
y: cy + radius * Math.sin(angle),
|
|
246
|
+
angle,
|
|
247
|
+
width: nodeDims[i].width,
|
|
248
|
+
height: nodeDims[i].height,
|
|
249
|
+
wrappedDesc: nodeDims[i].wrappedDesc,
|
|
250
|
+
isCircle: circleNodes
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
let layoutEdges = computeEdgePaths(
|
|
254
|
+
layoutNodes,
|
|
255
|
+
parsed,
|
|
256
|
+
cx,
|
|
257
|
+
cy,
|
|
258
|
+
radius,
|
|
259
|
+
isClockwise
|
|
260
|
+
);
|
|
261
|
+
const fitResult = fitToCanvas(
|
|
262
|
+
layoutNodes,
|
|
263
|
+
layoutEdges,
|
|
264
|
+
parsed,
|
|
265
|
+
cx,
|
|
266
|
+
cy,
|
|
267
|
+
radius,
|
|
268
|
+
width,
|
|
269
|
+
height,
|
|
270
|
+
isClockwise
|
|
271
|
+
);
|
|
272
|
+
if (fitResult) {
|
|
273
|
+
radius = fitResult.radius;
|
|
274
|
+
for (let i = 0; i < nodeCount; i++) {
|
|
275
|
+
layoutNodes[i].x = cx + radius * Math.cos(nodeAngles[i]);
|
|
276
|
+
layoutNodes[i].y = cy + radius * Math.sin(nodeAngles[i]);
|
|
277
|
+
}
|
|
278
|
+
layoutEdges = computeEdgePaths(
|
|
279
|
+
layoutNodes,
|
|
280
|
+
parsed,
|
|
281
|
+
cx,
|
|
282
|
+
cy,
|
|
283
|
+
radius,
|
|
284
|
+
isClockwise
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
nodes: layoutNodes,
|
|
289
|
+
edges: layoutEdges,
|
|
290
|
+
cx,
|
|
291
|
+
cy,
|
|
292
|
+
radius,
|
|
293
|
+
width,
|
|
294
|
+
height,
|
|
295
|
+
scale
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function chooseDescribedRectDims(description, labelWidth) {
|
|
299
|
+
const minW = Math.min(
|
|
300
|
+
MAX_NODE_WIDTH,
|
|
301
|
+
Math.max(MIN_NODE_WIDTH, labelWidth, DESC_MIN_WIDTH)
|
|
302
|
+
);
|
|
303
|
+
let best = null;
|
|
304
|
+
let bestScore = Infinity;
|
|
305
|
+
for (let w = minW; w <= MAX_NODE_WIDTH; w += DESC_WIDTH_STEP) {
|
|
306
|
+
const wrapped2 = wrapDescForWidth(description, w);
|
|
307
|
+
const h = HEADER_HEIGHT + wrapped2.length * DESC_LINE_HEIGHT + DESC_PAD_Y;
|
|
308
|
+
const ratio = w / h;
|
|
309
|
+
const score = Math.abs(Math.log(ratio / DESC_TARGET_RATIO));
|
|
310
|
+
if (score < bestScore) {
|
|
311
|
+
bestScore = score;
|
|
312
|
+
best = { width: w, height: h, wrappedDesc: wrapped2 };
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (best) return best;
|
|
316
|
+
const wrapped = wrapDescForWidth(description, minW);
|
|
317
|
+
return {
|
|
318
|
+
width: minW,
|
|
319
|
+
height: HEADER_HEIGHT + wrapped.length * DESC_LINE_HEIGHT + DESC_PAD_Y,
|
|
320
|
+
wrappedDesc: wrapped
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function wrapDescForWidth(description, nodeWidth) {
|
|
324
|
+
const textWidth = Math.max(40, nodeWidth - NODE_PAD_X * 2);
|
|
325
|
+
return wrapDescriptionLines(
|
|
326
|
+
[...description],
|
|
327
|
+
textWidth,
|
|
328
|
+
(s) => measureText(s, DESC_FONT_SIZE)
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
var RENDERER_DESC_FONT = 11;
|
|
332
|
+
var RENDERER_DESC_FONT_MIN = 8;
|
|
333
|
+
var RENDERER_DESC_LINE_H = 15;
|
|
334
|
+
var RENDERER_DESC_LINE_H_MIN = 11;
|
|
335
|
+
function renderedDescNodeHeight(numLines, scale) {
|
|
336
|
+
const headerH = HEADER_HEIGHT * scale;
|
|
337
|
+
const descFont = Math.max(
|
|
338
|
+
RENDERER_DESC_FONT_MIN,
|
|
339
|
+
Math.round(RENDERER_DESC_FONT * scale)
|
|
340
|
+
);
|
|
341
|
+
const descLineH = Math.max(
|
|
342
|
+
RENDERER_DESC_LINE_H_MIN,
|
|
343
|
+
Math.round(RENDERER_DESC_LINE_H * scale)
|
|
344
|
+
);
|
|
345
|
+
const textBlockH = 4 + descFont + (numLines - 1) * descLineH;
|
|
346
|
+
const bottomPad = 8;
|
|
347
|
+
return headerH + textBlockH + bottomPad;
|
|
348
|
+
}
|
|
349
|
+
var EDGE_LABEL_MAX_WIDTH = 197;
|
|
350
|
+
function wrapEdgeLabelText(label, description, maxWidth = EDGE_LABEL_MAX_WIDTH) {
|
|
351
|
+
const labelLines = label ? wrapTextToWidth(label, EDGE_LABEL_FONT_SIZE, maxWidth) : [];
|
|
352
|
+
const descLines = [];
|
|
353
|
+
for (const d of description) {
|
|
354
|
+
descLines.push(...wrapTextToWidth(d, EDGE_LABEL_FONT_SIZE, maxWidth));
|
|
355
|
+
}
|
|
356
|
+
return { labelLines, descLines };
|
|
357
|
+
}
|
|
358
|
+
function computeCircleNodeDims(node, hasDesc) {
|
|
359
|
+
if (!hasDesc) {
|
|
360
|
+
const textW = measureText(node.label, CIRCLE_LABEL_FONT_SIZE);
|
|
361
|
+
const r2 = Math.max(MIN_CIRCLE_RADIUS, textW / 2 + CIRCLE_PAD);
|
|
362
|
+
return { width: r2 * 2, height: r2 * 2, wrappedDesc: [] };
|
|
363
|
+
}
|
|
364
|
+
let r = MIN_CIRCLE_RADIUS;
|
|
365
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
366
|
+
const wrappedDesc2 = wrapLinesForCircle(node.description, r);
|
|
367
|
+
const totalLines = 1 + wrappedDesc2.length;
|
|
368
|
+
const textBlockH = totalLines * DESC_LINE_HEIGHT + CIRCLE_PAD;
|
|
369
|
+
if (textBlockH / 2 <= r * 0.85) {
|
|
370
|
+
const labelW = measureText(node.label, CIRCLE_LABEL_FONT_SIZE);
|
|
371
|
+
const labelY = -textBlockH / 2 + DESC_LINE_HEIGHT;
|
|
372
|
+
const availW = 2 * Math.sqrt(Math.max(0, r * r - labelY * labelY));
|
|
373
|
+
if (labelW <= availW - CIRCLE_PAD) {
|
|
374
|
+
return {
|
|
375
|
+
width: r * 2,
|
|
376
|
+
height: r * 2,
|
|
377
|
+
wrappedDesc: wrappedDesc2.map((text) => ({
|
|
378
|
+
text,
|
|
379
|
+
kind: "plain"
|
|
380
|
+
}))
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
r += 10;
|
|
385
|
+
}
|
|
386
|
+
const wrappedDesc = wrapLinesForCircle(node.description, r);
|
|
387
|
+
return {
|
|
388
|
+
width: r * 2,
|
|
389
|
+
height: r * 2,
|
|
390
|
+
wrappedDesc: wrappedDesc.map((text) => ({ text, kind: "plain" }))
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function wrapLinesForCircle(descriptions, radius) {
|
|
394
|
+
const centerWidth = radius * 2 * 0.75;
|
|
395
|
+
const roughWrapped = descriptions.flatMap(
|
|
396
|
+
(d) => wrapTextToWidth(d, DESC_FONT_SIZE, centerWidth)
|
|
397
|
+
);
|
|
398
|
+
const totalLines = 1 + roughWrapped.length;
|
|
399
|
+
const blockH = totalLines * DESC_LINE_HEIGHT;
|
|
400
|
+
const result = [];
|
|
401
|
+
let lineIdx = 1;
|
|
402
|
+
for (const srcLine of descriptions) {
|
|
403
|
+
const words = srcLine.split(/\s+/).filter((w) => w.length > 0);
|
|
404
|
+
let current = "";
|
|
405
|
+
for (const word of words) {
|
|
406
|
+
const y = -blockH / 2 + (lineIdx + 0.5) * DESC_LINE_HEIGHT;
|
|
407
|
+
const rSq = radius * radius;
|
|
408
|
+
const availPx = Math.max(
|
|
409
|
+
20,
|
|
410
|
+
y * y < rSq ? 2 * Math.sqrt(rSq - y * y) - CIRCLE_PAD * 2 : centerWidth
|
|
411
|
+
);
|
|
412
|
+
const test = current ? `${current} ${word}` : word;
|
|
413
|
+
if (measureText(test, DESC_FONT_SIZE) > availPx && current) {
|
|
414
|
+
result.push(current);
|
|
415
|
+
lineIdx++;
|
|
416
|
+
current = word;
|
|
417
|
+
} else {
|
|
418
|
+
current = test;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (current) {
|
|
422
|
+
result.push(current);
|
|
423
|
+
lineIdx++;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
function circleNodeExitAngle(nodeR, cycleR, nodeAngle, direction) {
|
|
429
|
+
const cosAlpha = Math.max(
|
|
430
|
+
-1,
|
|
431
|
+
Math.min(1, 1 - nodeR * nodeR / (2 * cycleR * cycleR))
|
|
432
|
+
);
|
|
433
|
+
const halfAngle = Math.acos(cosAlpha);
|
|
434
|
+
return nodeAngle + direction * halfAngle;
|
|
435
|
+
}
|
|
436
|
+
function insideRect(px, py, rx, ry, hw, hh) {
|
|
437
|
+
return Math.abs(px - rx) < hw && Math.abs(py - ry) < hh;
|
|
438
|
+
}
|
|
439
|
+
function circleRectExitAngle(nodeCx, nodeCy, halfW, halfH, circleCx, circleCy, radius, nodeAngle, direction) {
|
|
440
|
+
const steps = 90;
|
|
441
|
+
const maxSweep = Math.PI;
|
|
442
|
+
const step = maxSweep / steps;
|
|
443
|
+
let insideAngle = nodeAngle;
|
|
444
|
+
let outsideAngle = nodeAngle + direction * step;
|
|
445
|
+
for (let i = 1; i <= steps; i++) {
|
|
446
|
+
const angle = nodeAngle + direction * step * i;
|
|
447
|
+
const px = circleCx + radius * Math.cos(angle);
|
|
448
|
+
const py = circleCy + radius * Math.sin(angle);
|
|
449
|
+
if (!insideRect(px, py, nodeCx, nodeCy, halfW, halfH)) {
|
|
450
|
+
outsideAngle = angle;
|
|
451
|
+
insideAngle = nodeAngle + direction * step * (i - 1);
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
for (let i = 0; i < 16; i++) {
|
|
456
|
+
const mid = (insideAngle + outsideAngle) / 2;
|
|
457
|
+
const px = circleCx + radius * Math.cos(mid);
|
|
458
|
+
const py = circleCy + radius * Math.sin(mid);
|
|
459
|
+
if (insideRect(px, py, nodeCx, nodeCy, halfW, halfH)) {
|
|
460
|
+
insideAngle = mid;
|
|
461
|
+
} else {
|
|
462
|
+
outsideAngle = mid;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return (insideAngle + outsideAngle) / 2;
|
|
466
|
+
}
|
|
467
|
+
function computeEdgePaths(layoutNodes, parsed, cx, cy, radius, isClockwise) {
|
|
468
|
+
return parsed.edges.map((edge) => {
|
|
469
|
+
const src = layoutNodes[edge.sourceIndex];
|
|
470
|
+
const tgt = layoutNodes[edge.targetIndex];
|
|
471
|
+
const strokeWidth = Math.max(
|
|
472
|
+
edge.width ?? DEFAULT_EDGE_WIDTH,
|
|
473
|
+
MIN_EDGE_WIDTH
|
|
474
|
+
);
|
|
475
|
+
const arrowLen = arrowHeadLength(strokeWidth) * 0.9;
|
|
476
|
+
const { path, midAngle } = buildEdgeArc(
|
|
477
|
+
src,
|
|
478
|
+
tgt,
|
|
479
|
+
cx,
|
|
480
|
+
cy,
|
|
481
|
+
radius,
|
|
482
|
+
isClockwise,
|
|
483
|
+
arrowLen
|
|
484
|
+
);
|
|
485
|
+
const { labelLines, descLines } = wrapEdgeLabelText(
|
|
486
|
+
edge.label,
|
|
487
|
+
edge.description
|
|
488
|
+
);
|
|
489
|
+
const lineCount = labelLines.length + descLines.length;
|
|
490
|
+
let labelPxW = 0;
|
|
491
|
+
for (const l of labelLines)
|
|
492
|
+
labelPxW = Math.max(labelPxW, measureText(l, EDGE_LABEL_FONT_SIZE));
|
|
493
|
+
for (const l of descLines)
|
|
494
|
+
labelPxW = Math.max(labelPxW, measureText(l, EDGE_LABEL_FONT_SIZE));
|
|
495
|
+
const { labelX, labelY, labelAngle } = computeEdgeLabelPosition(
|
|
496
|
+
midAngle,
|
|
497
|
+
radius,
|
|
498
|
+
cx,
|
|
499
|
+
cy,
|
|
500
|
+
lineCount,
|
|
501
|
+
labelPxW,
|
|
502
|
+
layoutNodes
|
|
503
|
+
);
|
|
504
|
+
const layoutEdge = {
|
|
505
|
+
sourceIndex: edge.sourceIndex,
|
|
506
|
+
targetIndex: edge.targetIndex,
|
|
507
|
+
path,
|
|
508
|
+
labelX,
|
|
509
|
+
labelY,
|
|
510
|
+
labelAngle,
|
|
511
|
+
...edge.label !== void 0 && { label: edge.label }
|
|
512
|
+
};
|
|
513
|
+
return layoutEdge;
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function computeEdgeLabelPosition(midAngle, radius, cx, cy, lineCount, labelPxW, layoutNodes) {
|
|
517
|
+
if (lineCount === 0 || labelPxW === 0) {
|
|
518
|
+
return {
|
|
519
|
+
labelX: cx + radius * Math.cos(midAngle),
|
|
520
|
+
labelY: cy + radius * Math.sin(midAngle),
|
|
521
|
+
labelAngle: midAngle
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
const EDGE_LABEL_CORNER_OFFSET = 10;
|
|
525
|
+
const labelW = labelPxW;
|
|
526
|
+
const labelH = lineCount * 15;
|
|
527
|
+
const cosT = Math.cos(midAngle);
|
|
528
|
+
const sinT = Math.sin(midAngle);
|
|
529
|
+
function place(sign) {
|
|
530
|
+
const cornerX = cx + (radius + sign * EDGE_LABEL_CORNER_OFFSET) * cosT;
|
|
531
|
+
const cornerY = cy + (radius + sign * EDGE_LABEL_CORNER_OFFSET) * sinT;
|
|
532
|
+
const ROUND_THRESH = 0.3;
|
|
533
|
+
const radialX = sign * cosT;
|
|
534
|
+
const radialY = sign * sinT;
|
|
535
|
+
const sx = Math.abs(radialX) < ROUND_THRESH ? 0 : Math.sign(radialX);
|
|
536
|
+
const sy = Math.abs(radialY) < ROUND_THRESH ? 0 : Math.sign(radialY);
|
|
537
|
+
const bboxCx = cornerX + sx * labelW / 2;
|
|
538
|
+
const bboxCy = cornerY + sy * labelH / 2;
|
|
539
|
+
let labelX;
|
|
540
|
+
if (sx > 0) labelX = bboxCx - labelW / 2;
|
|
541
|
+
else if (sx < 0) labelX = bboxCx + labelW / 2;
|
|
542
|
+
else labelX = bboxCx;
|
|
543
|
+
const labelY = bboxCy - labelH / 2 + 12;
|
|
544
|
+
const bbX1 = bboxCx - labelW / 2;
|
|
545
|
+
const bbX2 = bboxCx + labelW / 2;
|
|
546
|
+
const bbY1 = bboxCy - labelH / 2;
|
|
547
|
+
const bbY2 = bboxCy + labelH / 2;
|
|
548
|
+
let overlap = 0;
|
|
549
|
+
for (const n of layoutNodes) {
|
|
550
|
+
const nx1 = n.x - n.width / 2;
|
|
551
|
+
const nx2 = n.x + n.width / 2;
|
|
552
|
+
const ny1 = n.y - n.height / 2;
|
|
553
|
+
const ny2 = n.y + n.height / 2;
|
|
554
|
+
const ox = Math.max(0, Math.min(bbX2, nx2) - Math.max(bbX1, nx1));
|
|
555
|
+
const oy = Math.max(0, Math.min(bbY2, ny2) - Math.max(bbY1, ny1));
|
|
556
|
+
overlap += ox * oy;
|
|
557
|
+
}
|
|
558
|
+
const labelAngle = sign === 1 ? midAngle : midAngle + Math.PI;
|
|
559
|
+
return { labelX, labelY, labelAngle, bbX1, bbX2, bbY1, bbY2, overlap };
|
|
560
|
+
}
|
|
561
|
+
const outward = place(1);
|
|
562
|
+
if (outward.overlap === 0) {
|
|
563
|
+
return {
|
|
564
|
+
labelX: outward.labelX,
|
|
565
|
+
labelY: outward.labelY,
|
|
566
|
+
labelAngle: outward.labelAngle
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
const inward = place(-1);
|
|
570
|
+
const best = inward.overlap < outward.overlap ? inward : outward;
|
|
571
|
+
return {
|
|
572
|
+
labelX: best.labelX,
|
|
573
|
+
labelY: best.labelY,
|
|
574
|
+
labelAngle: best.labelAngle
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function fitToCanvas(nodes, edges, parsed, _cx, _cy, radius, width, height, _isClockwise) {
|
|
578
|
+
const PADDING = 30;
|
|
579
|
+
let contentMinX = Infinity, contentMaxX = -Infinity;
|
|
580
|
+
let contentMinY = Infinity, contentMaxY = -Infinity;
|
|
581
|
+
for (const n of nodes) {
|
|
582
|
+
contentMinX = Math.min(contentMinX, n.x - n.width / 2);
|
|
583
|
+
contentMaxX = Math.max(contentMaxX, n.x + n.width / 2);
|
|
584
|
+
contentMinY = Math.min(contentMinY, n.y - n.height / 2);
|
|
585
|
+
contentMaxY = Math.max(contentMaxY, n.y + n.height / 2);
|
|
586
|
+
}
|
|
587
|
+
for (let i = 0; i < edges.length; i++) {
|
|
588
|
+
const le = edges[i];
|
|
589
|
+
const edge = parsed.edges[i];
|
|
590
|
+
const { labelLines, descLines } = wrapEdgeLabelText(
|
|
591
|
+
le.label,
|
|
592
|
+
edge.description
|
|
593
|
+
);
|
|
594
|
+
let textWidth = 0;
|
|
595
|
+
for (const l of labelLines)
|
|
596
|
+
textWidth = Math.max(textWidth, measureText(l, EDGE_LABEL_FONT_SIZE));
|
|
597
|
+
for (const l of descLines)
|
|
598
|
+
textWidth = Math.max(textWidth, measureText(l, EDGE_LABEL_FONT_SIZE));
|
|
599
|
+
if (textWidth === 0) continue;
|
|
600
|
+
const normAngle = (le.labelAngle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
|
|
601
|
+
const isRight = normAngle < Math.PI * 0.4 || normAngle > Math.PI * 1.6;
|
|
602
|
+
const isLeft = normAngle > Math.PI * 0.6 && normAngle < Math.PI * 1.4;
|
|
603
|
+
let labelLeft, labelRight;
|
|
604
|
+
if (isRight) {
|
|
605
|
+
labelLeft = le.labelX;
|
|
606
|
+
labelRight = le.labelX + textWidth;
|
|
607
|
+
} else if (isLeft) {
|
|
608
|
+
labelLeft = le.labelX - textWidth;
|
|
609
|
+
labelRight = le.labelX;
|
|
610
|
+
} else {
|
|
611
|
+
labelLeft = le.labelX - textWidth / 2;
|
|
612
|
+
labelRight = le.labelX + textWidth / 2;
|
|
613
|
+
}
|
|
614
|
+
contentMinX = Math.min(contentMinX, labelLeft);
|
|
615
|
+
contentMaxX = Math.max(contentMaxX, labelRight);
|
|
616
|
+
const lineCount = labelLines.length + descLines.length;
|
|
617
|
+
contentMinY = Math.min(contentMinY, le.labelY - 12);
|
|
618
|
+
contentMaxY = Math.max(contentMaxY, le.labelY + (lineCount - 1) * 15);
|
|
619
|
+
}
|
|
620
|
+
const overflowX = Math.max(0, PADDING - contentMinX) + Math.max(0, contentMaxX - (width - PADDING));
|
|
621
|
+
const overflowY = Math.max(0, PADDING - contentMinY) + Math.max(0, contentMaxY - (height - PADDING));
|
|
622
|
+
if (overflowX <= 0 && overflowY <= 0) return null;
|
|
623
|
+
const contentW = contentMaxX - contentMinX;
|
|
624
|
+
const contentH = contentMaxY - contentMinY;
|
|
625
|
+
const availW = width - 2 * PADDING;
|
|
626
|
+
const availH = height - 2 * PADDING;
|
|
627
|
+
const shrink = Math.min(availW / contentW, availH / contentH);
|
|
628
|
+
const newRadius = Math.max(80, radius * shrink);
|
|
629
|
+
return { radius: newRadius };
|
|
630
|
+
}
|
|
631
|
+
function buildEdgeArc(src, tgt, cx, cy, radius, isClockwise, arrowLength = 0) {
|
|
632
|
+
const dir = isClockwise ? 1 : -1;
|
|
633
|
+
const startAngle = src.angle;
|
|
634
|
+
const srcExitAngle = src.isCircle ? circleNodeExitAngle(src.width / 2, radius, src.angle, dir) : circleRectExitAngle(
|
|
635
|
+
src.x,
|
|
636
|
+
src.y,
|
|
637
|
+
src.width / 2,
|
|
638
|
+
src.height / 2,
|
|
639
|
+
cx,
|
|
640
|
+
cy,
|
|
641
|
+
radius,
|
|
642
|
+
src.angle,
|
|
643
|
+
dir
|
|
644
|
+
);
|
|
645
|
+
const nodeEndAngle = tgt.isCircle ? circleNodeExitAngle(tgt.width / 2, radius, tgt.angle, -dir) : circleRectExitAngle(
|
|
646
|
+
tgt.x,
|
|
647
|
+
tgt.y,
|
|
648
|
+
tgt.width / 2,
|
|
649
|
+
tgt.height / 2,
|
|
650
|
+
cx,
|
|
651
|
+
cy,
|
|
652
|
+
radius,
|
|
653
|
+
tgt.angle,
|
|
654
|
+
-dir
|
|
655
|
+
);
|
|
656
|
+
const arrowPullback = arrowLength > 0 ? arrowLength / radius : 0;
|
|
657
|
+
const endAngle = nodeEndAngle - dir * arrowPullback;
|
|
658
|
+
const startX = cx + radius * Math.cos(startAngle);
|
|
659
|
+
const startY = cy + radius * Math.sin(startAngle);
|
|
660
|
+
const endX = cx + radius * Math.cos(endAngle);
|
|
661
|
+
const endY = cy + radius * Math.sin(endAngle);
|
|
662
|
+
let effectiveSweep = (endAngle - startAngle) * dir;
|
|
663
|
+
if (effectiveSweep <= 0) effectiveSweep += 2 * Math.PI;
|
|
664
|
+
const largeArc = effectiveSweep > Math.PI ? 1 : 0;
|
|
665
|
+
const sweepFlag = isClockwise ? 1 : 0;
|
|
666
|
+
const path = `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArc} ${sweepFlag} ${endX} ${endY}`;
|
|
667
|
+
let visibleSweep = (nodeEndAngle - srcExitAngle) * dir;
|
|
668
|
+
if (visibleSweep <= 0) visibleSweep += 2 * Math.PI;
|
|
669
|
+
const midAngle = srcExitAngle + dir * visibleSweep / 2;
|
|
670
|
+
return { path, midAngle };
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// src/cycle/renderer.ts
|
|
674
|
+
var NODE_FONT_SIZE = 13;
|
|
675
|
+
var DESC_FONT_SIZE2 = 11;
|
|
676
|
+
var EDGE_LABEL_FONT_SIZE2 = 11;
|
|
677
|
+
var DESC_LINE_HEIGHT2 = 15;
|
|
678
|
+
var TITLE_AREA_HEIGHT = 50;
|
|
679
|
+
function renderCycle(container, parsed, palette, isDark, onClickItem, exportDims, viewState, renderOptions) {
|
|
680
|
+
if (parsed.nodes.length === 0) return;
|
|
681
|
+
const solid = parsed.options?.["solid-fill"] === "on";
|
|
682
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
683
|
+
const width = exportDims?.width ?? container.clientWidth;
|
|
684
|
+
const height = exportDims?.height ?? container.clientHeight;
|
|
685
|
+
if (width <= 0 || height <= 0) return;
|
|
686
|
+
const idealWidth = width;
|
|
687
|
+
const sctx = exportDims ? ScaleContext.identity() : ScaleContext.from(width, idealWidth);
|
|
688
|
+
const sTitleFontSize = sctx.text(TITLE_FONT_SIZE);
|
|
689
|
+
const sTitleY = sctx.structural(TITLE_Y);
|
|
690
|
+
const sTitleAreaHeight = sctx.structural(TITLE_AREA_HEIGHT);
|
|
691
|
+
const sLegendHeight = sctx.structural(LEGEND_HEIGHT);
|
|
692
|
+
const hideDescriptions = (renderOptions?.hideDescriptions ?? false) || parsed.options["no-descriptions"] === "true" || viewState?.hd === true;
|
|
693
|
+
const showDescriptions = !hideDescriptions;
|
|
694
|
+
const hasDescriptions = parsed.nodes.some((n) => n.description.length > 0) || parsed.edges.some((e) => e.description.length > 0);
|
|
695
|
+
const appHostedControls = renderOptions?.controlsHost === "app";
|
|
696
|
+
const hasLegend = !appHostedControls && hasDescriptions && !!renderOptions?.onToggleDescriptions;
|
|
697
|
+
const showTitle = !!parsed.title && parsed.options["no-title"] !== "on";
|
|
698
|
+
const legendOffset = hasLegend ? sLegendHeight : 0;
|
|
699
|
+
const layoutHeight = height - (showTitle ? sTitleAreaHeight : 0) - legendOffset;
|
|
700
|
+
const layout = computeCycleLayout(parsed, {
|
|
701
|
+
width,
|
|
702
|
+
height: layoutHeight,
|
|
703
|
+
hideDescriptions
|
|
704
|
+
});
|
|
705
|
+
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMid meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY);
|
|
706
|
+
if (sctx.isBelowFloor) {
|
|
707
|
+
svg.attr("width", "100%");
|
|
708
|
+
}
|
|
709
|
+
svg.append("rect").attr("width", width).attr("height", height).attr("fill", palette.bg);
|
|
710
|
+
if (showTitle) {
|
|
711
|
+
const titleText = svg.append("text").attr("x", width / 2).attr("y", sTitleY).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber).text(parsed.title).style("cursor", onClickItem ? "pointer" : "default");
|
|
712
|
+
if (onClickItem) {
|
|
713
|
+
titleText.on("click", () => onClickItem(parsed.titleLineNumber));
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
if (hasLegend) {
|
|
717
|
+
const controlsGroup = {
|
|
718
|
+
toggles: [
|
|
719
|
+
{
|
|
720
|
+
id: "descriptions",
|
|
721
|
+
type: "toggle",
|
|
722
|
+
label: "Descriptions",
|
|
723
|
+
active: !hideDescriptions,
|
|
724
|
+
onToggle: () => {
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
]
|
|
728
|
+
};
|
|
729
|
+
const legendCallbacks = {
|
|
730
|
+
...renderOptions?.onToggleControlsExpand !== void 0 && {
|
|
731
|
+
onControlsExpand: renderOptions.onToggleControlsExpand
|
|
732
|
+
},
|
|
733
|
+
onControlsToggle: (toggleId, active) => {
|
|
734
|
+
if (toggleId === "descriptions" && renderOptions?.onToggleDescriptions) {
|
|
735
|
+
renderOptions.onToggleDescriptions(active);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
const titleOffsetForLegend = showTitle ? sTitleAreaHeight : 0;
|
|
740
|
+
const legendG = svg.append("g").attr("transform", `translate(0, ${titleOffsetForLegend + 4})`);
|
|
741
|
+
renderIntegratedLegend(legendG, {
|
|
742
|
+
groups: [],
|
|
743
|
+
activeGroup: null,
|
|
744
|
+
mode: renderOptions?.exportMode ? "export" : "preview",
|
|
745
|
+
controlsGroup,
|
|
746
|
+
...renderOptions?.controlsHost !== void 0 && {
|
|
747
|
+
controlsHost: renderOptions.controlsHost
|
|
748
|
+
},
|
|
749
|
+
...renderOptions?.controlsExpanded !== void 0 && {
|
|
750
|
+
controlsExpanded: renderOptions.controlsExpanded
|
|
751
|
+
},
|
|
752
|
+
callbacks: legendCallbacks,
|
|
753
|
+
palette,
|
|
754
|
+
isDark,
|
|
755
|
+
width
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
const diagramTop = (showTitle ? sTitleAreaHeight : 0) + legendOffset;
|
|
759
|
+
const g = svg.append("g").attr("transform", `translate(0, ${diagramTop})`);
|
|
760
|
+
const defs = svg.append("defs");
|
|
761
|
+
const defaultNodeColor = palette.primary;
|
|
762
|
+
const markerKeys = /* @__PURE__ */ new Set();
|
|
763
|
+
for (const edge of parsed.edges) {
|
|
764
|
+
const color = resolveEdgeColor(edge, parsed, palette, defaultNodeColor);
|
|
765
|
+
const sw = Math.max(edge.width ?? DEFAULT_EDGE_WIDTH, MIN_EDGE_WIDTH);
|
|
766
|
+
const key = `${color}|${sw}`;
|
|
767
|
+
if (!markerKeys.has(key)) {
|
|
768
|
+
markerKeys.add(key);
|
|
769
|
+
ensureArrowMarker(defs, color, sw);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
const edgeLabelInfo = [];
|
|
773
|
+
for (let i = 0; i < layout.edges.length; i++) {
|
|
774
|
+
const le = layout.edges[i];
|
|
775
|
+
const edge = parsed.edges[i];
|
|
776
|
+
const color = resolveEdgeColor(edge, parsed, palette, defaultNodeColor);
|
|
777
|
+
const strokeWidth = Math.max(
|
|
778
|
+
edge.width ?? DEFAULT_EDGE_WIDTH,
|
|
779
|
+
MIN_EDGE_WIDTH
|
|
780
|
+
);
|
|
781
|
+
const markerId = arrowMarkerId(color, strokeWidth);
|
|
782
|
+
const edgeG = g.append("g").attr("class", "cycle-edge");
|
|
783
|
+
if (edge.lineNumber) {
|
|
784
|
+
edgeG.attr("data-line-number", edge.lineNumber);
|
|
785
|
+
}
|
|
786
|
+
edgeG.attr("data-from", String(edge.sourceIndex)).attr("data-to", String(edge.targetIndex));
|
|
787
|
+
const pathEl = edgeG.append("path").attr("d", le.path).attr("fill", "none").attr("stroke", color).attr("stroke-width", strokeWidth).attr("marker-end", `url(#${markerId})`);
|
|
788
|
+
if (onClickItem && edge.lineNumber) {
|
|
789
|
+
const ln = edge.lineNumber;
|
|
790
|
+
pathEl.style("cursor", "pointer").on("click", () => onClickItem(ln));
|
|
791
|
+
}
|
|
792
|
+
edgeLabelInfo.push({ le, edge });
|
|
793
|
+
}
|
|
794
|
+
const HEADER_H = 36 * layout.scale;
|
|
795
|
+
const scaledNodeFont = Math.max(6, Math.round(NODE_FONT_SIZE * layout.scale));
|
|
796
|
+
const scaledEdgeLabelFont = Math.max(
|
|
797
|
+
6,
|
|
798
|
+
Math.round(EDGE_LABEL_FONT_SIZE2 * layout.scale)
|
|
799
|
+
);
|
|
800
|
+
const CIRCLE_LABEL_FONT_SIZE2 = 16;
|
|
801
|
+
const scaledCircleLabelFont = Math.max(
|
|
802
|
+
8,
|
|
803
|
+
Math.round(CIRCLE_LABEL_FONT_SIZE2 * layout.scale)
|
|
804
|
+
);
|
|
805
|
+
const scaledDescFont = Math.max(5, Math.round(DESC_FONT_SIZE2 * layout.scale));
|
|
806
|
+
const scaledDescLineH = Math.max(
|
|
807
|
+
7,
|
|
808
|
+
Math.round(DESC_LINE_HEIGHT2 * layout.scale)
|
|
809
|
+
);
|
|
810
|
+
const scaledEdgeLineH = Math.max(
|
|
811
|
+
8,
|
|
812
|
+
Math.round(DESC_LINE_HEIGHT2 * layout.scale)
|
|
813
|
+
);
|
|
814
|
+
for (let i = 0; i < layout.nodes.length; i++) {
|
|
815
|
+
const ln = layout.nodes[i];
|
|
816
|
+
const node = parsed.nodes[i];
|
|
817
|
+
const solidColor = resolveNodeColor(node.color, palette, defaultNodeColor);
|
|
818
|
+
const fillColor = shapeFill(palette, solidColor, isDark, { solid });
|
|
819
|
+
const textColor = contrastText(
|
|
820
|
+
fillColor,
|
|
821
|
+
palette.textOnFillLight,
|
|
822
|
+
palette.textOnFillDark
|
|
823
|
+
);
|
|
824
|
+
const descColor = textColor;
|
|
825
|
+
const nodeW = ln.width;
|
|
826
|
+
const nodeH = ln.height;
|
|
827
|
+
const wrappedDesc = ln.wrappedDesc;
|
|
828
|
+
const hasDesc = showDescriptions && wrappedDesc.length > 0;
|
|
829
|
+
const nodeG = g.append("g").attr("class", "cycle-node").attr("data-line-number", node.lineNumber).attr("data-node-index", String(i)).style("cursor", onClickItem ? "pointer" : "default");
|
|
830
|
+
if (onClickItem) {
|
|
831
|
+
const lineNum = node.lineNumber;
|
|
832
|
+
nodeG.on("click", () => onClickItem(lineNum));
|
|
833
|
+
}
|
|
834
|
+
if (ln.isCircle) {
|
|
835
|
+
const r = nodeW / 2;
|
|
836
|
+
nodeG.append("circle").attr("cx", ln.x).attr("cy", ln.y).attr("r", r).attr("fill", fillColor).attr("stroke", solidColor).attr("stroke-width", 2);
|
|
837
|
+
if (hasDesc) {
|
|
838
|
+
const labelFont = scaledCircleLabelFont;
|
|
839
|
+
const blockH = labelFont + 4 + wrappedDesc.length * scaledDescLineH;
|
|
840
|
+
const startY = ln.y - blockH / 2 + labelFont;
|
|
841
|
+
const labelText = nodeG.append("text").attr("x", ln.x).attr("y", startY).attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", labelFont).attr("font-weight", "600");
|
|
842
|
+
renderInlineText(labelText, node.label, palette, labelFont);
|
|
843
|
+
let descY = startY + scaledDescLineH + 4;
|
|
844
|
+
wrappedDesc.forEach((line) => {
|
|
845
|
+
const descText = nodeG.append("text").attr("x", ln.x).attr("y", descY).attr("text-anchor", "middle").attr("fill", descColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledDescFont);
|
|
846
|
+
renderInlineText(descText, line.text, palette, DESC_FONT_SIZE2);
|
|
847
|
+
descY += scaledDescLineH;
|
|
848
|
+
});
|
|
849
|
+
} else {
|
|
850
|
+
const labelFont = scaledCircleLabelFont;
|
|
851
|
+
const labelText = nodeG.append("text").attr("x", ln.x).attr("y", ln.y + labelFont / 3).attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", labelFont).attr("font-weight", "600");
|
|
852
|
+
renderInlineText(labelText, node.label, palette, labelFont);
|
|
853
|
+
}
|
|
854
|
+
} else {
|
|
855
|
+
const rx = 6;
|
|
856
|
+
nodeG.append("rect").attr("x", ln.x - nodeW / 2).attr("y", ln.y - nodeH / 2).attr("width", nodeW).attr("height", nodeH).attr("rx", rx).attr("ry", rx).attr("fill", fillColor).attr("stroke", solidColor).attr("stroke-width", 2);
|
|
857
|
+
if (hasDesc) {
|
|
858
|
+
const headerCenterY = ln.y - nodeH / 2 + HEADER_H / 2;
|
|
859
|
+
const labelText = nodeG.append("text").attr("x", ln.x).attr("y", headerCenterY + scaledNodeFont / 3).attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledNodeFont).attr("font-weight", "600");
|
|
860
|
+
renderInlineText(labelText, node.label, palette, scaledNodeFont);
|
|
861
|
+
const sepY = ln.y - nodeH / 2 + HEADER_H;
|
|
862
|
+
nodeG.append("line").attr("x1", ln.x - nodeW / 2).attr("y1", sepY).attr("x2", ln.x + nodeW / 2).attr("y2", sepY).attr("stroke", solid ? descColor : solidColor).attr("stroke-opacity", 0.3).attr("stroke-width", 1);
|
|
863
|
+
const descStartY = sepY + 4 + scaledDescFont;
|
|
864
|
+
const descPadX = Math.max(8, 12 * layout.scale);
|
|
865
|
+
const descX = ln.x - nodeW / 2 + descPadX;
|
|
866
|
+
const bulletBodyX = descX + Math.max(8, 12 * layout.scale);
|
|
867
|
+
wrappedDesc.forEach((line, li) => {
|
|
868
|
+
const lineY = descStartY + li * scaledDescLineH;
|
|
869
|
+
if (line.kind === "bullet-first") {
|
|
870
|
+
nodeG.append("text").attr("x", descX).attr("y", lineY).attr("text-anchor", "start").attr("fill", descColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledDescFont).text("\u2022");
|
|
871
|
+
const bodyText = nodeG.append("text").attr("x", bulletBodyX).attr("y", lineY).attr("text-anchor", "start").attr("fill", descColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledDescFont);
|
|
872
|
+
renderInlineText(bodyText, line.text, palette, DESC_FONT_SIZE2);
|
|
873
|
+
} else {
|
|
874
|
+
const x = line.kind === "bullet-cont" ? bulletBodyX : descX;
|
|
875
|
+
const descText = nodeG.append("text").attr("x", x).attr("y", lineY).attr("text-anchor", "start").attr("fill", descColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledDescFont);
|
|
876
|
+
renderInlineText(descText, line.text, palette, DESC_FONT_SIZE2);
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
} else {
|
|
880
|
+
const labelText = nodeG.append("text").attr("x", ln.x).attr("y", ln.y + scaledNodeFont / 3).attr("text-anchor", "middle").attr("fill", textColor).attr("font-family", FONT_FAMILY).attr("font-size", scaledNodeFont).attr("font-weight", "600");
|
|
881
|
+
renderInlineText(labelText, node.label, palette, scaledNodeFont);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
const labelLayer = g.append("g").attr("class", "cycle-edge-labels");
|
|
886
|
+
for (const { le, edge } of edgeLabelInfo) {
|
|
887
|
+
const hasEdgeLabel = !!le.label;
|
|
888
|
+
const hasEdgeDesc = showDescriptions && edge.description.length > 0;
|
|
889
|
+
const { labelLines, descLines } = wrapEdgeLabelText(
|
|
890
|
+
hasEdgeLabel ? le.label : void 0,
|
|
891
|
+
hasEdgeDesc ? edge.description : []
|
|
892
|
+
);
|
|
893
|
+
if (labelLines.length === 0 && descLines.length === 0) continue;
|
|
894
|
+
const edgeG = labelLayer.append("g").attr("class", "cycle-edge");
|
|
895
|
+
if (edge.lineNumber) {
|
|
896
|
+
edgeG.attr("data-line-number", edge.lineNumber);
|
|
897
|
+
}
|
|
898
|
+
const normAngle = (le.labelAngle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
|
|
899
|
+
const isRight = normAngle < Math.PI * 0.4 || normAngle > Math.PI * 1.6;
|
|
900
|
+
const isLeft = normAngle > Math.PI * 0.6 && normAngle < Math.PI * 1.4;
|
|
901
|
+
const anchor = isRight ? "start" : isLeft ? "end" : "middle";
|
|
902
|
+
const lineCount = labelLines.length + descLines.length;
|
|
903
|
+
let maxLineW = 0;
|
|
904
|
+
for (const l of labelLines)
|
|
905
|
+
maxLineW = Math.max(maxLineW, measureText(l, scaledEdgeLabelFont));
|
|
906
|
+
for (const l of descLines)
|
|
907
|
+
maxLineW = Math.max(maxLineW, measureText(l, scaledDescFont));
|
|
908
|
+
const bgW = maxLineW + 12;
|
|
909
|
+
const bgH = lineCount * scaledEdgeLineH + 6;
|
|
910
|
+
const bgX = isRight ? le.labelX - 4 : isLeft ? le.labelX - bgW + 4 : le.labelX - bgW / 2;
|
|
911
|
+
const bgY = le.labelY - scaledEdgeLabelFont - 2;
|
|
912
|
+
edgeG.append("rect").attr("x", bgX).attr("y", bgY).attr("width", bgW).attr("height", bgH).attr("rx", 3).attr("fill", palette.bg).attr("fill-opacity", 0.85);
|
|
913
|
+
let textY = le.labelY;
|
|
914
|
+
for (const line of labelLines) {
|
|
915
|
+
const labelText = edgeG.append("text").attr("x", le.labelX).attr("y", textY).attr("text-anchor", anchor).attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", scaledEdgeLabelFont).attr("font-weight", "600");
|
|
916
|
+
renderInlineText(labelText, line, palette, scaledEdgeLabelFont);
|
|
917
|
+
textY += scaledEdgeLineH;
|
|
918
|
+
}
|
|
919
|
+
for (const line of descLines) {
|
|
920
|
+
const descText = edgeG.append("text").attr("x", le.labelX).attr("y", textY).attr("text-anchor", anchor).attr("fill", palette.textMuted).attr("font-family", FONT_FAMILY).attr("font-size", scaledDescFont);
|
|
921
|
+
renderInlineText(descText, line, palette, scaledDescFont);
|
|
922
|
+
textY += scaledEdgeLineH;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function renderCycleForExport(container, parsed, palette, isDark, exportDims, viewState, exportMode) {
|
|
927
|
+
renderCycle(
|
|
928
|
+
container,
|
|
929
|
+
parsed,
|
|
930
|
+
palette,
|
|
931
|
+
isDark,
|
|
932
|
+
void 0,
|
|
933
|
+
exportDims,
|
|
934
|
+
viewState,
|
|
935
|
+
{ ...exportMode !== void 0 && { exportMode } }
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
function resolveNodeColor(color, palette, defaultColor) {
|
|
939
|
+
if (!color) return defaultColor;
|
|
940
|
+
return resolveColor(color, palette) ?? defaultColor;
|
|
941
|
+
}
|
|
942
|
+
function resolveEdgeColor(edge, parsed, palette, defaultNodeColor) {
|
|
943
|
+
if (edge.color) {
|
|
944
|
+
return resolveColor(edge.color, palette) ?? defaultNodeColor;
|
|
945
|
+
}
|
|
946
|
+
const sourceNode = parsed.nodes[edge.sourceIndex];
|
|
947
|
+
if (sourceNode?.color) {
|
|
948
|
+
return resolveColor(sourceNode.color, palette) ?? defaultNodeColor;
|
|
949
|
+
}
|
|
950
|
+
return defaultNodeColor;
|
|
951
|
+
}
|
|
952
|
+
function arrowMarkerId(color, strokeWidth) {
|
|
953
|
+
return `cycle-arrow-${color.replace("#", "")}-w${strokeWidth}`;
|
|
954
|
+
}
|
|
955
|
+
function ensureArrowMarker(defs, color, strokeWidth) {
|
|
956
|
+
const id = arrowMarkerId(color, strokeWidth);
|
|
957
|
+
const mw = arrowHeadLength(strokeWidth) / strokeWidth;
|
|
958
|
+
const mh = Math.max(1.5, mw * 0.5);
|
|
959
|
+
defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${mw} ${mh}`).attr("refX", mw * 0.1).attr("refY", mh / 2).attr("markerWidth", mw).attr("markerHeight", mh).attr("orient", "auto").append("polygon").attr("points", `0,0 ${mw},${mh / 2} 0,${mh}`).attr("fill", color);
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export {
|
|
963
|
+
computeCycleLayout,
|
|
964
|
+
renderCycle,
|
|
965
|
+
renderCycleForExport
|
|
966
|
+
};
|
|
967
|
+
//# sourceMappingURL=chunk-3R5POCTZ.js.map
|