@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,1530 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeInfra
|
|
3
|
+
} from "./chunk-A44USUV7.js";
|
|
4
|
+
import {
|
|
5
|
+
layoutInfra
|
|
6
|
+
} from "./chunk-Y2ZE3MSG.js";
|
|
7
|
+
import {
|
|
8
|
+
renderInlineText
|
|
9
|
+
} from "./chunk-3HDBAXF5.js";
|
|
10
|
+
import {
|
|
11
|
+
COLLAPSE_BAR_HEIGHT,
|
|
12
|
+
COLLAPSE_BAR_INSET,
|
|
13
|
+
EDGE_STROKE_WIDTH,
|
|
14
|
+
NODE_STROKE_WIDTH
|
|
15
|
+
} from "./chunk-3CIOJ5YJ.js";
|
|
16
|
+
import {
|
|
17
|
+
renderIntegratedLegend
|
|
18
|
+
} from "./chunk-PWIHZ6NJ.js";
|
|
19
|
+
import {
|
|
20
|
+
ScaleContext
|
|
21
|
+
} from "./chunk-YYVTBZZC.js";
|
|
22
|
+
import {
|
|
23
|
+
getMaxLegendReservedHeight
|
|
24
|
+
} from "./chunk-YAA6IID3.js";
|
|
25
|
+
import {
|
|
26
|
+
TITLE_FONT_SIZE,
|
|
27
|
+
TITLE_FONT_WEIGHT,
|
|
28
|
+
TITLE_OFFSET,
|
|
29
|
+
TITLE_Y
|
|
30
|
+
} from "./chunk-A4GOY3PE.js";
|
|
31
|
+
import {
|
|
32
|
+
FONT_FAMILY
|
|
33
|
+
} from "./chunk-6KFWC4CO.js";
|
|
34
|
+
import {
|
|
35
|
+
LEGEND_CAPSULE_PAD,
|
|
36
|
+
LEGEND_DOT_R,
|
|
37
|
+
LEGEND_ENTRY_DOT_GAP,
|
|
38
|
+
LEGEND_ENTRY_FONT_SIZE,
|
|
39
|
+
LEGEND_ENTRY_TRAIL,
|
|
40
|
+
LEGEND_HEIGHT,
|
|
41
|
+
LEGEND_PILL_FONT_SIZE,
|
|
42
|
+
LEGEND_PILL_PAD,
|
|
43
|
+
measureLegendText
|
|
44
|
+
} from "./chunk-QOOUC2J5.js";
|
|
45
|
+
import {
|
|
46
|
+
CHAR_WIDTH_RATIO,
|
|
47
|
+
measureText,
|
|
48
|
+
truncateText
|
|
49
|
+
} from "./chunk-WCT3NYCV.js";
|
|
50
|
+
import {
|
|
51
|
+
parseInfra
|
|
52
|
+
} from "./chunk-33LCUH4H.js";
|
|
53
|
+
import {
|
|
54
|
+
preprocessDescriptionLine
|
|
55
|
+
} from "./chunk-IYULMRBE.js";
|
|
56
|
+
import {
|
|
57
|
+
contrastText,
|
|
58
|
+
mix,
|
|
59
|
+
shapeFill
|
|
60
|
+
} from "./chunk-P6T66CCZ.js";
|
|
61
|
+
import {
|
|
62
|
+
tagAttrKey
|
|
63
|
+
} from "./chunk-QLCCJEJI.js";
|
|
64
|
+
import {
|
|
65
|
+
resolveColor
|
|
66
|
+
} from "./chunk-TLVIHFRO.js";
|
|
67
|
+
|
|
68
|
+
// src/infra/renderer.ts
|
|
69
|
+
import * as d3Selection from "d3-selection";
|
|
70
|
+
import * as d3Shape from "d3-shape";
|
|
71
|
+
|
|
72
|
+
// src/infra/roles.ts
|
|
73
|
+
var ROLE_RULES = [
|
|
74
|
+
{ keys: ["cache-hit"], role: { name: "Cache", color: "#22c55e" } },
|
|
75
|
+
{ keys: ["firewall-block"], role: { name: "Firewall", color: "#ef4444" } },
|
|
76
|
+
{ keys: ["ratelimit-rps"], role: { name: "Rate Limiter", color: "#eab308" } },
|
|
77
|
+
{ keys: ["max-rps"], role: { name: "Service", color: "#3b82f6" } },
|
|
78
|
+
{ keys: ["cb-error-threshold", "cb-latency-threshold-ms"], role: { name: "Circuit Breaker", color: "#a855f7" } },
|
|
79
|
+
{ keys: ["concurrency"], role: { name: "Serverless", color: "#06b6d4" } },
|
|
80
|
+
{ keys: ["buffer"], role: { name: "Queue", color: "#8b5cf6" } }
|
|
81
|
+
];
|
|
82
|
+
function inferRoles(properties) {
|
|
83
|
+
const propKeys = new Set(properties.map((p) => p.key));
|
|
84
|
+
const roles = [];
|
|
85
|
+
for (const rule of ROLE_RULES) {
|
|
86
|
+
if (rule.keys.some((k) => propKeys.has(k))) {
|
|
87
|
+
roles.push(rule.role);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return roles;
|
|
91
|
+
}
|
|
92
|
+
var FANOUT_ROLE = { name: "Fan-Out", color: "#f97316" };
|
|
93
|
+
function collectFanoutSourceIds(edges) {
|
|
94
|
+
const ids = /* @__PURE__ */ new Set();
|
|
95
|
+
for (const e of edges) {
|
|
96
|
+
if (e.fanout != null) ids.add(e.sourceId);
|
|
97
|
+
}
|
|
98
|
+
return ids;
|
|
99
|
+
}
|
|
100
|
+
function collectDiagramRoles(allProperties) {
|
|
101
|
+
const seen = /* @__PURE__ */ new Set();
|
|
102
|
+
const roles = [];
|
|
103
|
+
for (const props of allProperties) {
|
|
104
|
+
for (const role of inferRoles(props)) {
|
|
105
|
+
if (!seen.has(role.name)) {
|
|
106
|
+
seen.add(role.name);
|
|
107
|
+
roles.push(role);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return roles;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/infra/renderer.ts
|
|
115
|
+
var NODE_FONT_SIZE = 13;
|
|
116
|
+
var META_FONT_SIZE = 10;
|
|
117
|
+
var META_LINE_HEIGHT = 14;
|
|
118
|
+
var EDGE_LABEL_FONT_SIZE = 11;
|
|
119
|
+
var GROUP_LABEL_FONT_SIZE = 14;
|
|
120
|
+
var NODE_BORDER_RADIUS = 8;
|
|
121
|
+
var OVERLOAD_STROKE_WIDTH = 3;
|
|
122
|
+
var ROLE_DOT_RADIUS = 3;
|
|
123
|
+
var NODE_HEADER_HEIGHT = 28;
|
|
124
|
+
var NODE_SEPARATOR_GAP = 4;
|
|
125
|
+
var NODE_PAD_BOTTOM = 10;
|
|
126
|
+
var LEGEND_FIXED_GAP = 16;
|
|
127
|
+
var SPEED_BADGE_H_PAD = 5;
|
|
128
|
+
var SPEED_BADGE_V_PAD = 3;
|
|
129
|
+
var SPEED_BADGE_GAP = 6;
|
|
130
|
+
function buildScaledConstants(ctx) {
|
|
131
|
+
return {
|
|
132
|
+
sNodeFontSize: ctx.text(NODE_FONT_SIZE),
|
|
133
|
+
sMetaFontSize: ctx.text(META_FONT_SIZE),
|
|
134
|
+
sMetaLineHeight: ctx.structural(META_LINE_HEIGHT),
|
|
135
|
+
sEdgeLabelFontSize: ctx.text(EDGE_LABEL_FONT_SIZE),
|
|
136
|
+
sGroupLabelFontSize: ctx.text(GROUP_LABEL_FONT_SIZE),
|
|
137
|
+
sNodeBorderRadius: ctx.structural(NODE_BORDER_RADIUS),
|
|
138
|
+
sEdgeStrokeWidth: ctx.structural(EDGE_STROKE_WIDTH),
|
|
139
|
+
sNodeStrokeWidth: ctx.structural(NODE_STROKE_WIDTH),
|
|
140
|
+
sOverloadStrokeWidth: ctx.structural(OVERLOAD_STROKE_WIDTH),
|
|
141
|
+
sRoleDotRadius: ctx.structural(ROLE_DOT_RADIUS),
|
|
142
|
+
sNodeSeparatorGap: ctx.structural(NODE_SEPARATOR_GAP),
|
|
143
|
+
sNodePadBottom: ctx.structural(NODE_PAD_BOTTOM),
|
|
144
|
+
sCollapseBarHeight: ctx.structural(COLLAPSE_BAR_HEIGHT),
|
|
145
|
+
sCollapseBarInset: ctx.structural(COLLAPSE_BAR_INSET),
|
|
146
|
+
sParticleR: ctx.structural(PARTICLE_R),
|
|
147
|
+
sRejectParticleR: ctx.structural(PARTICLE_R),
|
|
148
|
+
sRejectDropDistance: ctx.structural(REJECT_DROP_DISTANCE),
|
|
149
|
+
sTitleFontSize: ctx.text(TITLE_FONT_SIZE),
|
|
150
|
+
sTitleY: ctx.structural(TITLE_Y),
|
|
151
|
+
sLegendFixedGap: ctx.aesthetic(LEGEND_FIXED_GAP)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
var COLOR_HEALTHY = "#22c55e";
|
|
155
|
+
var COLOR_WARNING = "#eab308";
|
|
156
|
+
var COLOR_OVERLOADED = "#ef4444";
|
|
157
|
+
function resolveNodeSlo(node, diagramOptions) {
|
|
158
|
+
const nodeProp = (key) => node.properties.find((p) => p.key === key);
|
|
159
|
+
const availRaw = nodeProp("slo-availability")?.value ?? diagramOptions["slo-availability"];
|
|
160
|
+
const latencyRaw = nodeProp("slo-p90-latency-ms")?.value ?? diagramOptions["slo-p90-latency-ms"];
|
|
161
|
+
const marginRaw = nodeProp("slo-warning-margin")?.value ?? diagramOptions["slo-warning-margin"];
|
|
162
|
+
const availParsed = availRaw != null ? parseFloat(String(availRaw).replace("%", "")) / 100 : NaN;
|
|
163
|
+
const availThreshold = !isNaN(availParsed) ? availParsed : null;
|
|
164
|
+
const latencyParsed = latencyRaw != null ? parseFloat(String(latencyRaw)) : NaN;
|
|
165
|
+
const latencyP90 = !isNaN(latencyParsed) ? latencyParsed : null;
|
|
166
|
+
const marginParsed = marginRaw != null ? parseFloat(String(marginRaw).replace("%", "")) / 100 : NaN;
|
|
167
|
+
const warningMargin = !isNaN(marginParsed) ? marginParsed : 0.05;
|
|
168
|
+
if (availThreshold == null && latencyP90 == null) return null;
|
|
169
|
+
return { availThreshold, latencyP90, warningMargin };
|
|
170
|
+
}
|
|
171
|
+
var FLOW_SPEED_MIN = 2.5;
|
|
172
|
+
var FLOW_SPEED_MAX = 6;
|
|
173
|
+
var PARTICLE_R = 5;
|
|
174
|
+
var PARTICLE_COUNT_MIN = 1;
|
|
175
|
+
var PARTICLE_COUNT_MAX = 4;
|
|
176
|
+
var NODE_PULSE_SPEED = 1.5;
|
|
177
|
+
var NODE_PULSE_OVERLOAD = 0.7;
|
|
178
|
+
var REJECT_DROP_DISTANCE = 30;
|
|
179
|
+
var REJECT_DURATION_MIN = 1.5;
|
|
180
|
+
var REJECT_DURATION_MAX = 3;
|
|
181
|
+
var REJECT_COUNT_MIN = 1;
|
|
182
|
+
var REJECT_COUNT_MAX = 3;
|
|
183
|
+
function buildPathD(pts, direction) {
|
|
184
|
+
const gen = d3Shape.line().x((d) => d.x).y((d) => d.y);
|
|
185
|
+
if (pts.length <= 2) {
|
|
186
|
+
gen.curve(direction === "TB" ? d3Shape.curveBumpY : d3Shape.curveBumpX);
|
|
187
|
+
} else {
|
|
188
|
+
gen.curve(d3Shape.curveCatmullRom.alpha(0.5));
|
|
189
|
+
}
|
|
190
|
+
return gen(pts) ?? "";
|
|
191
|
+
}
|
|
192
|
+
function computePortPts(edges, nodeMap, direction) {
|
|
193
|
+
const srcPts = /* @__PURE__ */ new Map();
|
|
194
|
+
const tgtPts = /* @__PURE__ */ new Map();
|
|
195
|
+
const PAD = 0.1;
|
|
196
|
+
const activeEdges = edges.filter((e) => e.points.length > 0);
|
|
197
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const e of activeEdges) {
|
|
199
|
+
if (!bySource.has(e.sourceId)) bySource.set(e.sourceId, []);
|
|
200
|
+
bySource.get(e.sourceId).push(e);
|
|
201
|
+
}
|
|
202
|
+
for (const [sourceId, es] of bySource) {
|
|
203
|
+
if (es.length < 2) continue;
|
|
204
|
+
const source = nodeMap.get(sourceId);
|
|
205
|
+
if (!source) continue;
|
|
206
|
+
const sorted = es.map((e) => ({ e, t: nodeMap.get(e.targetId) })).filter(
|
|
207
|
+
(x) => x.t != null
|
|
208
|
+
).sort((a, b) => direction === "LR" ? a.t.y - b.t.y : a.t.x - b.t.x);
|
|
209
|
+
const n = sorted.length;
|
|
210
|
+
for (let i = 0; i < n; i++) {
|
|
211
|
+
const frac = n === 1 ? 0.5 : PAD + (1 - 2 * PAD) * i / (n - 1);
|
|
212
|
+
const { e, t } = sorted[i];
|
|
213
|
+
const isBackward = direction === "LR" ? t.x < source.x : t.y < source.y;
|
|
214
|
+
if (direction === "LR") {
|
|
215
|
+
srcPts.set(`${e.sourceId}:${e.targetId}`, {
|
|
216
|
+
x: isBackward ? source.x - source.width / 2 : source.x + source.width / 2,
|
|
217
|
+
y: source.y - source.height / 2 + frac * source.height
|
|
218
|
+
});
|
|
219
|
+
} else {
|
|
220
|
+
srcPts.set(`${e.sourceId}:${e.targetId}`, {
|
|
221
|
+
x: source.x - source.width / 2 + frac * source.width,
|
|
222
|
+
y: isBackward ? source.y - source.height / 2 : source.y + source.height / 2
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const byTarget = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const e of activeEdges) {
|
|
229
|
+
if (!byTarget.has(e.targetId)) byTarget.set(e.targetId, []);
|
|
230
|
+
byTarget.get(e.targetId).push(e);
|
|
231
|
+
}
|
|
232
|
+
for (const [targetId, es] of byTarget) {
|
|
233
|
+
if (es.length < 2) continue;
|
|
234
|
+
const target = nodeMap.get(targetId);
|
|
235
|
+
if (!target) continue;
|
|
236
|
+
const sorted = es.map((e) => ({ e, s: nodeMap.get(e.sourceId) })).filter(
|
|
237
|
+
(x) => x.s != null
|
|
238
|
+
).sort((a, b) => direction === "LR" ? a.s.y - b.s.y : a.s.x - b.s.x);
|
|
239
|
+
const n = sorted.length;
|
|
240
|
+
for (let i = 0; i < n; i++) {
|
|
241
|
+
const frac = n === 1 ? 0.5 : PAD + (1 - 2 * PAD) * i / (n - 1);
|
|
242
|
+
const { e, s } = sorted[i];
|
|
243
|
+
const isBackward = direction === "LR" ? target.x < s.x : target.y < s.y;
|
|
244
|
+
if (direction === "LR") {
|
|
245
|
+
tgtPts.set(`${e.sourceId}:${e.targetId}`, {
|
|
246
|
+
x: isBackward ? target.x + target.width / 2 : target.x - target.width / 2,
|
|
247
|
+
y: target.y - target.height / 2 + frac * target.height
|
|
248
|
+
});
|
|
249
|
+
} else {
|
|
250
|
+
tgtPts.set(`${e.sourceId}:${e.targetId}`, {
|
|
251
|
+
x: target.x - target.width / 2 + frac * target.width,
|
|
252
|
+
y: isBackward ? target.y + target.height / 2 : target.y - target.height / 2
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return { srcPts, tgtPts };
|
|
258
|
+
}
|
|
259
|
+
function findRoutingLane(blocking, targetY, margin) {
|
|
260
|
+
const MERGE_SLOP = 4;
|
|
261
|
+
const sorted = [...blocking].sort(
|
|
262
|
+
(a, b) => a.y + a.height / 2 - (b.y + b.height / 2)
|
|
263
|
+
);
|
|
264
|
+
const merged = [];
|
|
265
|
+
for (const r of sorted) {
|
|
266
|
+
const lo = r.y - MERGE_SLOP;
|
|
267
|
+
const hi = r.y + r.height + MERGE_SLOP;
|
|
268
|
+
if (merged.length && lo <= merged[merged.length - 1][1]) {
|
|
269
|
+
merged[merged.length - 1][1] = Math.max(
|
|
270
|
+
merged[merged.length - 1][1],
|
|
271
|
+
hi
|
|
272
|
+
);
|
|
273
|
+
} else {
|
|
274
|
+
merged.push([lo, hi]);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (merged.length === 0) return targetY;
|
|
278
|
+
const MIN_GAP = 10;
|
|
279
|
+
const candidates = [
|
|
280
|
+
// In-bounds: merged.length > 0 guarded above.
|
|
281
|
+
merged[0][0] - margin,
|
|
282
|
+
// above all blocking rects
|
|
283
|
+
merged[merged.length - 1][1] + margin
|
|
284
|
+
// below all blocking rects
|
|
285
|
+
];
|
|
286
|
+
for (let i = 0; i < merged.length - 1; i++) {
|
|
287
|
+
const gapLo = merged[i][1];
|
|
288
|
+
const gapHi = merged[i + 1][0];
|
|
289
|
+
if (gapHi - gapLo >= MIN_GAP) {
|
|
290
|
+
candidates.push((gapLo + gapHi) / 2);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return candidates.reduce(
|
|
294
|
+
// candidates[0] is a non-empty array (two seed values pushed above).
|
|
295
|
+
(best, c) => Math.abs(c - targetY) < Math.abs(best - targetY) ? c : best,
|
|
296
|
+
candidates[0]
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
function segmentIntersectsRect(p1, p2, rect) {
|
|
300
|
+
const { x: rx, y: ry, width: rw, height: rh } = rect;
|
|
301
|
+
const rr = rx + rw;
|
|
302
|
+
const rb = ry + rh;
|
|
303
|
+
const inRect = (p) => p.x >= rx && p.x <= rr && p.y >= ry && p.y <= rb;
|
|
304
|
+
if (inRect(p1) || inRect(p2)) return true;
|
|
305
|
+
if (Math.max(p1.x, p2.x) < rx || Math.min(p1.x, p2.x) > rr) return false;
|
|
306
|
+
if (Math.max(p1.y, p2.y) < ry || Math.min(p1.y, p2.y) > rb) return false;
|
|
307
|
+
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
|
308
|
+
const crosses = (a, b) => {
|
|
309
|
+
const d1 = cross(a, b, p1);
|
|
310
|
+
const d2 = cross(a, b, p2);
|
|
311
|
+
const d3 = cross(p1, p2, a);
|
|
312
|
+
const d4 = cross(p1, p2, b);
|
|
313
|
+
return (d1 > 0 && d2 < 0 || d1 < 0 && d2 > 0) && (d3 > 0 && d4 < 0 || d3 < 0 && d4 > 0);
|
|
314
|
+
};
|
|
315
|
+
const tl = { x: rx, y: ry };
|
|
316
|
+
const tr = { x: rr, y: ry };
|
|
317
|
+
const br = { x: rr, y: rb };
|
|
318
|
+
const bl = { x: rx, y: rb };
|
|
319
|
+
return crosses(tl, tr) || crosses(tr, br) || crosses(br, bl) || crosses(bl, tl);
|
|
320
|
+
}
|
|
321
|
+
function curveIntersectsRect(sc, tc, rect, direction) {
|
|
322
|
+
if (direction === "LR") {
|
|
323
|
+
const midX = (sc.x + tc.x) / 2;
|
|
324
|
+
const m1 = { x: midX, y: sc.y };
|
|
325
|
+
const m2 = { x: midX, y: tc.y };
|
|
326
|
+
return segmentIntersectsRect(sc, m1, rect) || segmentIntersectsRect(m1, m2, rect) || segmentIntersectsRect(m2, tc, rect);
|
|
327
|
+
} else {
|
|
328
|
+
const midY = (sc.y + tc.y) / 2;
|
|
329
|
+
const m1 = { x: sc.x, y: midY };
|
|
330
|
+
const m2 = { x: tc.x, y: midY };
|
|
331
|
+
return segmentIntersectsRect(sc, m1, rect) || segmentIntersectsRect(m1, m2, rect) || segmentIntersectsRect(m2, tc, rect);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function edgeWaypoints(source, target, groups, nodes, direction, margin = 30, srcExitPt, tgtEnterPt) {
|
|
335
|
+
const sc = { x: source.x, y: source.y };
|
|
336
|
+
const tc = { x: target.x, y: target.y };
|
|
337
|
+
const isBackward = direction === "LR" ? tc.x < sc.x : tc.y < sc.y;
|
|
338
|
+
if (isBackward) {
|
|
339
|
+
if (direction === "LR") {
|
|
340
|
+
const xBandObs = [];
|
|
341
|
+
for (const g of groups) {
|
|
342
|
+
if (g.x + g.width < tc.x - margin || g.x > sc.x + margin) continue;
|
|
343
|
+
xBandObs.push({ x: g.x, y: g.y, width: g.width, height: g.height });
|
|
344
|
+
}
|
|
345
|
+
for (const n of nodes) {
|
|
346
|
+
if (n.id === source.id || n.id === target.id) continue;
|
|
347
|
+
const nLeft = n.x - n.width / 2;
|
|
348
|
+
const nRight = n.x + n.width / 2;
|
|
349
|
+
if (nRight < tc.x - margin || nLeft > sc.x + margin) continue;
|
|
350
|
+
xBandObs.push({
|
|
351
|
+
x: nLeft,
|
|
352
|
+
y: n.y - n.height / 2,
|
|
353
|
+
width: n.width,
|
|
354
|
+
height: n.height
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
const midY = (sc.y + tc.y) / 2;
|
|
358
|
+
const routeY2 = xBandObs.length > 0 ? findRoutingLane(xBandObs, midY, margin) : midY;
|
|
359
|
+
const exitBorder = srcExitPt ?? nodeBorderPoint(source, { x: sc.x, y: routeY2 });
|
|
360
|
+
const exitPt2 = { x: exitBorder.x, y: routeY2 };
|
|
361
|
+
const enterPt2 = { x: tc.x, y: routeY2 };
|
|
362
|
+
const tp2 = tgtEnterPt ?? nodeBorderPoint(target, enterPt2);
|
|
363
|
+
return srcExitPt ? [srcExitPt, exitPt2, enterPt2, tp2] : [exitBorder, exitPt2, enterPt2, tp2];
|
|
364
|
+
} else {
|
|
365
|
+
const yBandObs = [];
|
|
366
|
+
for (const g of groups) {
|
|
367
|
+
if (g.y + g.height < tc.y - margin || g.y > sc.y + margin) continue;
|
|
368
|
+
yBandObs.push({ x: g.x, y: g.y, width: g.width, height: g.height });
|
|
369
|
+
}
|
|
370
|
+
for (const n of nodes) {
|
|
371
|
+
if (n.id === source.id || n.id === target.id) continue;
|
|
372
|
+
const nTop = n.y - n.height / 2;
|
|
373
|
+
const nBot = n.y + n.height / 2;
|
|
374
|
+
if (nBot < tc.y - margin || nTop > sc.y + margin) continue;
|
|
375
|
+
yBandObs.push({
|
|
376
|
+
x: n.x - n.width / 2,
|
|
377
|
+
y: nTop,
|
|
378
|
+
width: n.width,
|
|
379
|
+
height: n.height
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
const rotated = yBandObs.map((r) => ({
|
|
383
|
+
x: r.y,
|
|
384
|
+
y: r.x,
|
|
385
|
+
width: r.height,
|
|
386
|
+
height: r.width
|
|
387
|
+
}));
|
|
388
|
+
const midX = (sc.x + tc.x) / 2;
|
|
389
|
+
const routeX = rotated.length > 0 ? findRoutingLane(rotated, midX, margin) : midX;
|
|
390
|
+
const exitPt2 = srcExitPt ?? { x: routeX, y: sc.y };
|
|
391
|
+
const enterPt2 = { x: routeX, y: tc.y };
|
|
392
|
+
return [
|
|
393
|
+
srcExitPt ?? nodeBorderPoint(source, exitPt2),
|
|
394
|
+
exitPt2,
|
|
395
|
+
enterPt2,
|
|
396
|
+
tgtEnterPt ?? nodeBorderPoint(target, enterPt2)
|
|
397
|
+
];
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const blocking = [];
|
|
401
|
+
const blockingGroupIds = /* @__PURE__ */ new Set();
|
|
402
|
+
const pathSrc = srcExitPt ?? sc;
|
|
403
|
+
const pathTgt = tgtEnterPt ?? tc;
|
|
404
|
+
for (const g of groups) {
|
|
405
|
+
if (g.id === source.groupId || g.id === target.groupId) continue;
|
|
406
|
+
const gRect = { x: g.x, y: g.y, width: g.width, height: g.height };
|
|
407
|
+
if (curveIntersectsRect(pathSrc, pathTgt, gRect, direction)) {
|
|
408
|
+
blocking.push(gRect);
|
|
409
|
+
blockingGroupIds.add(g.id);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (const n of nodes) {
|
|
413
|
+
if (n.id === source.id || n.id === target.id) continue;
|
|
414
|
+
if (n.groupId && (n.groupId === source.groupId || n.groupId === target.groupId))
|
|
415
|
+
continue;
|
|
416
|
+
if (n.groupId && blockingGroupIds.has(n.groupId)) continue;
|
|
417
|
+
const nodeRect = {
|
|
418
|
+
x: n.x - n.width / 2,
|
|
419
|
+
y: n.y - n.height / 2,
|
|
420
|
+
width: n.width,
|
|
421
|
+
height: n.height
|
|
422
|
+
};
|
|
423
|
+
if (curveIntersectsRect(pathSrc, pathTgt, nodeRect, direction)) {
|
|
424
|
+
blocking.push(nodeRect);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (blocking.length === 0) {
|
|
428
|
+
const sp = srcExitPt ?? nodeBorderPoint(source, tc);
|
|
429
|
+
const tp2 = tgtEnterPt ?? nodeBorderPoint(target, sp);
|
|
430
|
+
return [sp, tp2];
|
|
431
|
+
}
|
|
432
|
+
const obsLeft = Math.min(...blocking.map((o) => o.x));
|
|
433
|
+
const obsRight = Math.max(...blocking.map((o) => o.x + o.width));
|
|
434
|
+
const routeY = findRoutingLane(blocking, tc.y, margin);
|
|
435
|
+
const exitX = direction === "LR" ? Math.max(sc.x, obsLeft - margin) : obsLeft - margin;
|
|
436
|
+
const enterX = direction === "LR" ? Math.min(tc.x, obsRight + margin) : obsRight + margin;
|
|
437
|
+
const exitPt = { x: exitX, y: routeY };
|
|
438
|
+
const enterPt = { x: enterX, y: routeY };
|
|
439
|
+
const tp = tgtEnterPt ?? nodeBorderPoint(target, enterPt);
|
|
440
|
+
if (srcExitPt) {
|
|
441
|
+
return [srcExitPt, exitPt, enterPt, tp];
|
|
442
|
+
}
|
|
443
|
+
return [nodeBorderPoint(source, exitPt), exitPt, enterPt, tp];
|
|
444
|
+
}
|
|
445
|
+
function nodeBorderPoint(node, target) {
|
|
446
|
+
const hw = node.width / 2;
|
|
447
|
+
const hh = node.height / 2;
|
|
448
|
+
const dx = target.x - node.x;
|
|
449
|
+
const dy = target.y - node.y;
|
|
450
|
+
if (dx === 0 && dy === 0) return { x: node.x + hw, y: node.y };
|
|
451
|
+
const sx = hw / Math.abs(dx || 1);
|
|
452
|
+
const sy = hh / Math.abs(dy || 1);
|
|
453
|
+
const s = Math.min(sx, sy);
|
|
454
|
+
return { x: node.x + dx * s, y: node.y + dy * s };
|
|
455
|
+
}
|
|
456
|
+
function flowDuration(rps, maxRps) {
|
|
457
|
+
if (maxRps <= 0) return FLOW_SPEED_MAX;
|
|
458
|
+
const t = Math.min(rps / maxRps, 1);
|
|
459
|
+
return FLOW_SPEED_MAX - t * (FLOW_SPEED_MAX - FLOW_SPEED_MIN);
|
|
460
|
+
}
|
|
461
|
+
function particleCount(rps, maxRps) {
|
|
462
|
+
if (maxRps <= 0) return PARTICLE_COUNT_MIN;
|
|
463
|
+
const t = Math.min(rps / maxRps, 1);
|
|
464
|
+
return Math.round(
|
|
465
|
+
PARTICLE_COUNT_MIN + t * (PARTICLE_COUNT_MAX - PARTICLE_COUNT_MIN)
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
function isWarning(node) {
|
|
469
|
+
if (node.overloaded || node.isEdge) return false;
|
|
470
|
+
const concurrencyProp = node.properties.find((p) => p.key === "concurrency");
|
|
471
|
+
if (concurrencyProp) {
|
|
472
|
+
const concurrency = Number(concurrencyProp.value);
|
|
473
|
+
const durationProp = node.properties.find((p) => p.key === "duration-ms");
|
|
474
|
+
const durationMs = durationProp ? Number(durationProp.value) : 100;
|
|
475
|
+
const cap2 = concurrency / (durationMs / 1e3);
|
|
476
|
+
return cap2 > 0 && node.computedRps / cap2 > 0.7;
|
|
477
|
+
}
|
|
478
|
+
const maxRps = node.properties.find((p) => p.key === "max-rps");
|
|
479
|
+
if (!maxRps) return false;
|
|
480
|
+
const cap = Number(maxRps.value) * node.computedInstances;
|
|
481
|
+
return cap > 0 && node.computedRps / cap > 0.7;
|
|
482
|
+
}
|
|
483
|
+
var PROP_DISPLAY = {
|
|
484
|
+
"cache-hit": "cache hit",
|
|
485
|
+
"firewall-block": "firewall block",
|
|
486
|
+
"ratelimit-rps": "rate limit RPS",
|
|
487
|
+
"latency-ms": "latency",
|
|
488
|
+
uptime: "uptime",
|
|
489
|
+
instances: "instances",
|
|
490
|
+
"max-rps": "max RPS",
|
|
491
|
+
"cb-error-threshold": "CB error threshold",
|
|
492
|
+
"cb-latency-threshold-ms": "CB latency threshold",
|
|
493
|
+
concurrency: "concurrency",
|
|
494
|
+
"duration-ms": "duration",
|
|
495
|
+
"cold-start-ms": "cold start",
|
|
496
|
+
buffer: "buffer",
|
|
497
|
+
"drain-rate": "drain rate",
|
|
498
|
+
"retention-hours": "retention",
|
|
499
|
+
partitions: "partitions"
|
|
500
|
+
};
|
|
501
|
+
var DESC_MAX_CHARS = 120;
|
|
502
|
+
var DESC_MAX_WIDTH = DESC_MAX_CHARS * CHAR_WIDTH_RATIO * META_FONT_SIZE;
|
|
503
|
+
function truncateDesc(text) {
|
|
504
|
+
return truncateText(text, META_FONT_SIZE, DESC_MAX_WIDTH);
|
|
505
|
+
}
|
|
506
|
+
var RPS_FORMAT_KEYS = /* @__PURE__ */ new Set(["max-rps", "ratelimit-rps"]);
|
|
507
|
+
var MS_FORMAT_KEYS = /* @__PURE__ */ new Set([
|
|
508
|
+
"latency-ms",
|
|
509
|
+
"cb-latency-threshold-ms",
|
|
510
|
+
"duration-ms",
|
|
511
|
+
"cold-start-ms"
|
|
512
|
+
]);
|
|
513
|
+
var PCT_FORMAT_KEYS = /* @__PURE__ */ new Set([
|
|
514
|
+
"cache-hit",
|
|
515
|
+
"firewall-block",
|
|
516
|
+
"uptime",
|
|
517
|
+
"cb-error-threshold"
|
|
518
|
+
]);
|
|
519
|
+
function sloLatencyColor(p90, slo) {
|
|
520
|
+
const t = slo.latencyP90 ?? 0;
|
|
521
|
+
if (t === 0) return COLOR_HEALTHY;
|
|
522
|
+
const m = slo.warningMargin;
|
|
523
|
+
return p90 > t ? COLOR_OVERLOADED : p90 > t * (1 - m) ? COLOR_WARNING : COLOR_HEALTHY;
|
|
524
|
+
}
|
|
525
|
+
function getComputedRows(node, expanded, slo) {
|
|
526
|
+
const rows = [];
|
|
527
|
+
if (node.computedConcurrentInvocations > 0) {
|
|
528
|
+
const concurrency = getNodeNumProp(node, "concurrency", 0);
|
|
529
|
+
const demand = node.computedConcurrentInvocations;
|
|
530
|
+
const ratio = concurrency > 0 ? demand / concurrency : 0;
|
|
531
|
+
const color = ratio > 1 ? COLOR_OVERLOADED : ratio > 0.7 ? COLOR_WARNING : void 0;
|
|
532
|
+
const value = concurrency > 0 ? `${formatCount(demand)} / ${formatCount(concurrency)}` : `${formatCount(demand)}`;
|
|
533
|
+
rows.push({
|
|
534
|
+
key: "instances",
|
|
535
|
+
value,
|
|
536
|
+
...color !== void 0 && { color },
|
|
537
|
+
inverted: color != null
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
const p = node.computedLatencyPercentiles;
|
|
541
|
+
if (p.p50 > 0 || p.p90 > 0 || p.p99 > 0) {
|
|
542
|
+
if (expanded) {
|
|
543
|
+
rows.push({ key: "p50", value: formatMsShort(p.p50) });
|
|
544
|
+
if (slo?.latencyP90 != null) {
|
|
545
|
+
const color = sloLatencyColor(p.p90, slo);
|
|
546
|
+
const p90Value = color !== COLOR_HEALTHY ? `${formatMsShort(p.p90)} / ${formatMsShort(slo.latencyP90)}` : formatMsShort(p.p90);
|
|
547
|
+
rows.push({
|
|
548
|
+
key: "p90",
|
|
549
|
+
value: p90Value,
|
|
550
|
+
color,
|
|
551
|
+
inverted: color !== COLOR_HEALTHY
|
|
552
|
+
});
|
|
553
|
+
} else {
|
|
554
|
+
rows.push({ key: "p90", value: formatMsShort(p.p90) });
|
|
555
|
+
}
|
|
556
|
+
rows.push({ key: "p99", value: formatMsShort(p.p99) });
|
|
557
|
+
} else if (p.p90 > 0) {
|
|
558
|
+
if (slo?.latencyP90 != null) {
|
|
559
|
+
const color = sloLatencyColor(p.p90, slo);
|
|
560
|
+
const p90Value = color !== COLOR_HEALTHY ? `${formatMsShort(p.p90)} / ${formatMsShort(slo.latencyP90)}` : formatMsShort(p.p90);
|
|
561
|
+
rows.push({
|
|
562
|
+
key: "p90",
|
|
563
|
+
value: p90Value,
|
|
564
|
+
color,
|
|
565
|
+
inverted: color !== COLOR_HEALTHY
|
|
566
|
+
});
|
|
567
|
+
} else {
|
|
568
|
+
rows.push({ key: "p90", value: formatMsShort(p.p90) });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (node.computedUptime < 1) {
|
|
573
|
+
const declaredUptime = node.properties.find((p2) => p2.key === "uptime");
|
|
574
|
+
const declaredVal = declaredUptime ? Number(declaredUptime.value) / 100 : 1;
|
|
575
|
+
const differs = Math.abs(node.computedUptime - declaredVal) > 1e-6;
|
|
576
|
+
if (differs || node.isEdge) {
|
|
577
|
+
rows.push({
|
|
578
|
+
key: "eff. uptime",
|
|
579
|
+
value: formatUptimeShort(node.computedUptime)
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (node.computedAvailability < 1) {
|
|
584
|
+
let color;
|
|
585
|
+
if (slo?.availThreshold != null) {
|
|
586
|
+
const t = slo.availThreshold;
|
|
587
|
+
const m = slo.warningMargin;
|
|
588
|
+
if (node.computedAvailability < t) color = COLOR_OVERLOADED;
|
|
589
|
+
else if (node.computedAvailability < Math.min(1, t + m))
|
|
590
|
+
color = COLOR_WARNING;
|
|
591
|
+
else color = COLOR_HEALTHY;
|
|
592
|
+
} else {
|
|
593
|
+
color = node.computedAvailability < 0.95 ? COLOR_OVERLOADED : node.computedAvailability < 0.99 ? COLOR_WARNING : void 0;
|
|
594
|
+
}
|
|
595
|
+
rows.push({
|
|
596
|
+
key: "availability",
|
|
597
|
+
value: formatUptimeShort(node.computedAvailability),
|
|
598
|
+
...color !== void 0 && { color },
|
|
599
|
+
inverted: color != null && color !== COLOR_HEALTHY
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
if (node.computedCbState === "open") {
|
|
603
|
+
rows.push({
|
|
604
|
+
key: "CB",
|
|
605
|
+
value: "OPEN",
|
|
606
|
+
color: COLOR_OVERLOADED,
|
|
607
|
+
inverted: true
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
if (node.queueMetrics) {
|
|
611
|
+
const { fillRate, timeToOverflow } = node.queueMetrics;
|
|
612
|
+
if (fillRate > 0) {
|
|
613
|
+
rows.push({
|
|
614
|
+
key: "lag",
|
|
615
|
+
value: `${formatCount(Math.round(fillRate))} msg/s`
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
if (fillRate > 0 && timeToOverflow < Infinity) {
|
|
619
|
+
const overflowColor = timeToOverflow < 60 ? COLOR_OVERLOADED : COLOR_WARNING;
|
|
620
|
+
rows.push({
|
|
621
|
+
key: "overflow",
|
|
622
|
+
value: `~${Math.round(timeToOverflow)}s`,
|
|
623
|
+
color: overflowColor,
|
|
624
|
+
inverted: timeToOverflow < 60
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return rows;
|
|
629
|
+
}
|
|
630
|
+
function formatCount(n) {
|
|
631
|
+
if (n >= 1e6)
|
|
632
|
+
return `${(n / 1e6).toFixed(n % 1e6 === 0 ? 0 : 1)}M`;
|
|
633
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(n % 1e3 === 0 ? 0 : 1)}k`;
|
|
634
|
+
return String(n);
|
|
635
|
+
}
|
|
636
|
+
function formatMsShort(ms) {
|
|
637
|
+
if (ms >= 1e3) return `${(ms / 1e3).toFixed(1)}s`;
|
|
638
|
+
return `${Math.round(ms)}ms`;
|
|
639
|
+
}
|
|
640
|
+
function formatUptimeShort(fraction) {
|
|
641
|
+
const pct = fraction * 100;
|
|
642
|
+
if (pct >= 99.99) return "99.99%";
|
|
643
|
+
if (pct >= 99.9) return `${pct.toFixed(2)}%`;
|
|
644
|
+
if (pct >= 99) return `${pct.toFixed(1)}%`;
|
|
645
|
+
return `${pct.toFixed(1)}%`;
|
|
646
|
+
}
|
|
647
|
+
function getDisplayProps(node, expanded, diagramOptions) {
|
|
648
|
+
if (node.isEdge) return [];
|
|
649
|
+
const rows = [];
|
|
650
|
+
for (const p of node.properties) {
|
|
651
|
+
const displayKey = PROP_DISPLAY[p.key];
|
|
652
|
+
if (!displayKey) continue;
|
|
653
|
+
if (p.key === "ratelimit-rps" && !expanded) continue;
|
|
654
|
+
if (p.key === "max-rps" && !expanded) continue;
|
|
655
|
+
if (p.key === "concurrency" && !expanded) continue;
|
|
656
|
+
if (RPS_FORMAT_KEYS.has(p.key)) {
|
|
657
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
658
|
+
rows.push({
|
|
659
|
+
key: p.key,
|
|
660
|
+
displayKey,
|
|
661
|
+
value: isNaN(num) ? String(p.value) : formatRpsShort(num)
|
|
662
|
+
});
|
|
663
|
+
} else if (MS_FORMAT_KEYS.has(p.key)) {
|
|
664
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
665
|
+
rows.push({
|
|
666
|
+
key: p.key,
|
|
667
|
+
displayKey,
|
|
668
|
+
value: isNaN(num) ? String(p.value) : formatMsShort(num)
|
|
669
|
+
});
|
|
670
|
+
} else if (PCT_FORMAT_KEYS.has(p.key)) {
|
|
671
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
672
|
+
rows.push({
|
|
673
|
+
key: p.key,
|
|
674
|
+
displayKey,
|
|
675
|
+
value: isNaN(num) ? String(p.value) : `${num}%`
|
|
676
|
+
});
|
|
677
|
+
} else if (p.key === "buffer") {
|
|
678
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
679
|
+
rows.push({
|
|
680
|
+
key: p.key,
|
|
681
|
+
displayKey,
|
|
682
|
+
value: isNaN(num) ? String(p.value) : formatCount(num)
|
|
683
|
+
});
|
|
684
|
+
} else if (p.key === "drain-rate") {
|
|
685
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
686
|
+
rows.push({
|
|
687
|
+
key: p.key,
|
|
688
|
+
displayKey,
|
|
689
|
+
value: isNaN(num) ? String(p.value) : `${formatRpsShort(num)}/s`
|
|
690
|
+
});
|
|
691
|
+
} else if (p.key === "retention-hours") {
|
|
692
|
+
const num = typeof p.value === "number" ? p.value : parseFloat(String(p.value));
|
|
693
|
+
rows.push({
|
|
694
|
+
key: p.key,
|
|
695
|
+
displayKey,
|
|
696
|
+
value: isNaN(num) ? String(p.value) : `${num}h`
|
|
697
|
+
});
|
|
698
|
+
} else {
|
|
699
|
+
rows.push({ key: p.key, displayKey, value: String(p.value) });
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
if (diagramOptions) {
|
|
703
|
+
const hasLatency = node.properties.some((p) => p.key === "latency-ms");
|
|
704
|
+
const hasUptime = node.properties.some((p) => p.key === "uptime");
|
|
705
|
+
const isServerlessNode = node.properties.some(
|
|
706
|
+
(p) => p.key === "concurrency"
|
|
707
|
+
);
|
|
708
|
+
const defaultLatency = parseFloat(diagramOptions["default-latency-ms"] ?? "") || 0;
|
|
709
|
+
const defaultUptime = parseFloat(diagramOptions["default-uptime"] ?? "") || 0;
|
|
710
|
+
if (!hasLatency && !isServerlessNode && defaultLatency > 0) {
|
|
711
|
+
rows.push({
|
|
712
|
+
key: "latency-ms",
|
|
713
|
+
displayKey: "latency",
|
|
714
|
+
value: formatMsShort(defaultLatency)
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
if (!hasUptime && defaultUptime > 0 && defaultUptime < 100) {
|
|
718
|
+
rows.push({
|
|
719
|
+
key: "uptime",
|
|
720
|
+
displayKey: "uptime",
|
|
721
|
+
value: `${defaultUptime}%`
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return rows;
|
|
726
|
+
}
|
|
727
|
+
function formatRpsShort(rps) {
|
|
728
|
+
if (rps >= 1e3) return `${(rps / 1e3).toFixed(1)}k`;
|
|
729
|
+
return `${Math.round(rps)}`;
|
|
730
|
+
}
|
|
731
|
+
function worstNodeSeverity(node, slo) {
|
|
732
|
+
let worst = "normal";
|
|
733
|
+
const upgrade = (s) => {
|
|
734
|
+
if (s === "overloaded") worst = "overloaded";
|
|
735
|
+
else if (worst !== "overloaded") worst = "warning";
|
|
736
|
+
};
|
|
737
|
+
if (node.childHealthState === "overloaded") upgrade("overloaded");
|
|
738
|
+
else if (node.childHealthState === "warning") upgrade("warning");
|
|
739
|
+
if (node.overloaded) upgrade("overloaded");
|
|
740
|
+
if (node.rateLimited) upgrade("warning");
|
|
741
|
+
if (isWarning(node)) upgrade("warning");
|
|
742
|
+
if (slo?.availThreshold != null) {
|
|
743
|
+
const t = slo.availThreshold;
|
|
744
|
+
const m = slo.warningMargin;
|
|
745
|
+
if (node.computedAvailability < t) upgrade("overloaded");
|
|
746
|
+
else if (node.computedAvailability < Math.min(1, t + m)) upgrade("warning");
|
|
747
|
+
} else {
|
|
748
|
+
if (node.computedAvailability < 0.95) upgrade("overloaded");
|
|
749
|
+
else if (node.computedAvailability < 0.99) upgrade("warning");
|
|
750
|
+
}
|
|
751
|
+
if (slo?.latencyP90 != null) {
|
|
752
|
+
const t = slo.latencyP90;
|
|
753
|
+
const m = slo.warningMargin;
|
|
754
|
+
const p90 = node.computedLatencyPercentiles.p90;
|
|
755
|
+
if (p90 > t) upgrade("overloaded");
|
|
756
|
+
else if (p90 > t * (1 - m)) upgrade("warning");
|
|
757
|
+
}
|
|
758
|
+
if (node.computedCbState === "open") upgrade("overloaded");
|
|
759
|
+
if (node.queueMetrics && node.queueMetrics.fillRate > 0) {
|
|
760
|
+
if (node.queueMetrics.timeToOverflow < 60) upgrade("overloaded");
|
|
761
|
+
else upgrade("warning");
|
|
762
|
+
}
|
|
763
|
+
if (!node.isEdge) {
|
|
764
|
+
const nodeRateLimit = getNodeNumProp(node, "ratelimit-rps", 0);
|
|
765
|
+
if (nodeRateLimit > 0 && node.computedRps > 0) {
|
|
766
|
+
let preRl = node.computedRps;
|
|
767
|
+
const ch = getNodeNumProp(node, "cache-hit", 0);
|
|
768
|
+
if (ch > 0) preRl *= (100 - ch) / 100;
|
|
769
|
+
const fw = getNodeNumProp(node, "firewall-block", 0);
|
|
770
|
+
if (fw > 0) preRl *= (100 - fw) / 100;
|
|
771
|
+
if (preRl > nodeRateLimit) upgrade("overloaded");
|
|
772
|
+
else if (preRl > nodeRateLimit * 0.8) upgrade("warning");
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
if (worst === "normal" && slo != null) {
|
|
776
|
+
const availGreen = slo.availThreshold == null || node.computedAvailability >= Math.min(1, slo.availThreshold + slo.warningMargin);
|
|
777
|
+
const latencyGreen = slo.latencyP90 == null || node.computedLatencyPercentiles.p90 <= slo.latencyP90 * (1 - slo.warningMargin);
|
|
778
|
+
if (availGreen && latencyGreen) return "healthy";
|
|
779
|
+
}
|
|
780
|
+
return worst;
|
|
781
|
+
}
|
|
782
|
+
function nodeColor(_node, palette, isDark, severity, solid) {
|
|
783
|
+
if (severity === "overloaded") {
|
|
784
|
+
const fill = shapeFill(palette, COLOR_OVERLOADED, isDark, {
|
|
785
|
+
...solid !== void 0 && { solid }
|
|
786
|
+
});
|
|
787
|
+
return {
|
|
788
|
+
fill,
|
|
789
|
+
stroke: COLOR_OVERLOADED,
|
|
790
|
+
textFill: contrastText(
|
|
791
|
+
fill,
|
|
792
|
+
palette.textOnFillLight,
|
|
793
|
+
palette.textOnFillDark
|
|
794
|
+
)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
if (severity === "warning") {
|
|
798
|
+
const fill = shapeFill(palette, COLOR_WARNING, isDark, {
|
|
799
|
+
...solid !== void 0 && { solid }
|
|
800
|
+
});
|
|
801
|
+
return {
|
|
802
|
+
fill,
|
|
803
|
+
stroke: COLOR_WARNING,
|
|
804
|
+
textFill: contrastText(
|
|
805
|
+
fill,
|
|
806
|
+
palette.textOnFillLight,
|
|
807
|
+
palette.textOnFillDark
|
|
808
|
+
)
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
if (severity === "healthy") {
|
|
812
|
+
const fill = shapeFill(palette, COLOR_HEALTHY, isDark, {
|
|
813
|
+
...solid !== void 0 && { solid }
|
|
814
|
+
});
|
|
815
|
+
return {
|
|
816
|
+
fill,
|
|
817
|
+
stroke: COLOR_HEALTHY,
|
|
818
|
+
textFill: contrastText(
|
|
819
|
+
fill,
|
|
820
|
+
palette.textOnFillLight,
|
|
821
|
+
palette.textOnFillDark
|
|
822
|
+
)
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
return {
|
|
826
|
+
fill: isDark ? mix(palette.bg, palette.text, 90) : mix(palette.bg, palette.text, 95),
|
|
827
|
+
stroke: isDark ? mix(palette.text, palette.bg, 60) : mix(palette.text, palette.bg, 40),
|
|
828
|
+
textFill: palette.text
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
function edgeColor(_edge, palette) {
|
|
832
|
+
return palette.textMuted;
|
|
833
|
+
}
|
|
834
|
+
function renderGroups(svg, groups, palette, _isDark, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
835
|
+
for (const group of groups) {
|
|
836
|
+
const g = svg.append("g").attr("class", "infra-group").attr("data-line-number", group.lineNumber).attr("data-node-toggle", group.id).style("cursor", "pointer");
|
|
837
|
+
const groupFill = mix(palette.surface, palette.bg, 40);
|
|
838
|
+
const groupStroke = palette.textMuted;
|
|
839
|
+
g.append("rect").attr("x", group.x).attr("y", group.y).attr("width", group.width).attr("height", group.height).attr("rx", 6).attr("fill", groupFill).attr("stroke", groupStroke).attr("stroke-opacity", 0.35).attr("stroke-width", 1);
|
|
840
|
+
g.append("text").attr("x", group.x + group.width / 2).attr("y", group.y + 16).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sGroupLabelFontSize).attr("font-weight", "600").attr("fill", palette.text).text(group.label);
|
|
841
|
+
const gi = typeof group.instances === "number" ? group.instances : typeof group.instances === "string" ? parseInt(String(group.instances), 10) || 0 : 0;
|
|
842
|
+
if (gi > 1) {
|
|
843
|
+
g.append("text").attr("x", group.x + group.width - 8).attr("y", group.y + 16).attr("text-anchor", "end").attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("fill", palette.textMuted).text(`${gi}x`);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
function renderEdgePaths(svg, edges, nodes, groups, palette, _isDark, animate, direction, speedMultiplier = 1, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
848
|
+
const nodeMap = new Map(nodes.map((n) => [n.id, n]));
|
|
849
|
+
const maxRps = Math.max(...edges.map((e) => e.computedRps), 1);
|
|
850
|
+
const { srcPts, tgtPts } = computePortPts(edges, nodeMap, direction);
|
|
851
|
+
for (const edge of edges) {
|
|
852
|
+
if (edge.points.length === 0) continue;
|
|
853
|
+
const targetNode = nodeMap.get(edge.targetId);
|
|
854
|
+
const sourceNode = nodeMap.get(edge.sourceId);
|
|
855
|
+
const color = edgeColor(edge, palette);
|
|
856
|
+
const strokeW = sc.sEdgeStrokeWidth;
|
|
857
|
+
if (!sourceNode || !targetNode) continue;
|
|
858
|
+
const key = `${edge.sourceId}:${edge.targetId}`;
|
|
859
|
+
const pts = edgeWaypoints(
|
|
860
|
+
sourceNode,
|
|
861
|
+
targetNode,
|
|
862
|
+
groups,
|
|
863
|
+
nodes,
|
|
864
|
+
direction,
|
|
865
|
+
30,
|
|
866
|
+
srcPts.get(key),
|
|
867
|
+
tgtPts.get(key)
|
|
868
|
+
);
|
|
869
|
+
const pathD = buildPathD(pts, direction);
|
|
870
|
+
const edgeG = svg.append("g").attr("class", "infra-edge").attr("data-line-number", edge.lineNumber).attr("data-from", edge.sourceId).attr("data-to", edge.targetId);
|
|
871
|
+
const edgePath = edgeG.append("path").attr("d", pathD).attr("fill", "none").attr("stroke", color).attr("stroke-width", strokeW);
|
|
872
|
+
if (edge.async) {
|
|
873
|
+
edgePath.attr("stroke-dasharray", "6 4");
|
|
874
|
+
}
|
|
875
|
+
if (animate && edge.computedRps > 0) {
|
|
876
|
+
const baseDur = flowDuration(edge.computedRps, maxRps);
|
|
877
|
+
const dur = speedMultiplier > 0 ? baseDur / speedMultiplier : baseDur;
|
|
878
|
+
const count = particleCount(edge.computedRps, maxRps);
|
|
879
|
+
const particleColor = palette.colors.green;
|
|
880
|
+
for (let i = 0; i < count; i++) {
|
|
881
|
+
const delay = dur / count * i;
|
|
882
|
+
const circle = edgeG.append("circle").attr("r", sc.sParticleR).attr("fill", particleColor).attr("opacity", 0.85);
|
|
883
|
+
circle.append("animateMotion").attr("dur", `${dur}s`).attr("repeatCount", "indefinite").attr("begin", `${delay}s`).attr("path", pathD);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
function renderEdgeLabels(svg, edges, nodes, groups, palette, _isDark, animate, direction, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
889
|
+
const nodeMap = new Map(nodes.map((n) => [n.id, n]));
|
|
890
|
+
const { srcPts, tgtPts } = computePortPts(edges, nodeMap, direction);
|
|
891
|
+
for (const edge of edges) {
|
|
892
|
+
if (edge.points.length === 0) continue;
|
|
893
|
+
if (!edge.label) continue;
|
|
894
|
+
const sourceNode = nodeMap.get(edge.sourceId);
|
|
895
|
+
const targetNode = nodeMap.get(edge.targetId);
|
|
896
|
+
if (!sourceNode || !targetNode) continue;
|
|
897
|
+
const key = `${edge.sourceId}:${edge.targetId}`;
|
|
898
|
+
const wps = edgeWaypoints(
|
|
899
|
+
sourceNode,
|
|
900
|
+
targetNode,
|
|
901
|
+
groups,
|
|
902
|
+
nodes,
|
|
903
|
+
direction,
|
|
904
|
+
30,
|
|
905
|
+
srcPts.get(key),
|
|
906
|
+
tgtPts.get(key)
|
|
907
|
+
);
|
|
908
|
+
const midPt = wps[Math.floor(wps.length / 2)];
|
|
909
|
+
if (!midPt) continue;
|
|
910
|
+
const labelText = edge.label;
|
|
911
|
+
const g = svg.append("g").attr("class", animate ? "infra-edge-label" : "");
|
|
912
|
+
const textWidth = measureText(labelText, EDGE_LABEL_FONT_SIZE) + 8;
|
|
913
|
+
g.append("rect").attr("x", midPt.x - textWidth / 2).attr("y", midPt.y - 8).attr("width", textWidth).attr("height", 16).attr("rx", 3).attr("fill", palette.bg).attr("opacity", 0.9);
|
|
914
|
+
g.append("text").attr("x", midPt.x).attr("y", midPt.y + 4).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sEdgeLabelFontSize).attr("fill", palette.textMuted).text(labelText);
|
|
915
|
+
if (animate) {
|
|
916
|
+
const pathD = buildPathD(wps, direction);
|
|
917
|
+
g.insert("path", ":first-child").attr("d", pathD).attr("fill", "none").attr("stroke", "transparent").attr("stroke-width", 20);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function resolveActiveTagStroke(node, activeGroup, tagGroups, palette) {
|
|
922
|
+
const tg = tagGroups.find(
|
|
923
|
+
(t) => t.name.toLowerCase() === activeGroup.toLowerCase()
|
|
924
|
+
);
|
|
925
|
+
if (!tg) return null;
|
|
926
|
+
const tagKey = tagAttrKey(tg.alias ?? tg.name);
|
|
927
|
+
const tagVal = node.tags[tagKey];
|
|
928
|
+
if (!tagVal) return null;
|
|
929
|
+
const tv = tg.values.find(
|
|
930
|
+
(v) => v.name.toLowerCase() === tagVal.toLowerCase()
|
|
931
|
+
);
|
|
932
|
+
if (!tv?.color) return null;
|
|
933
|
+
return resolveColor(tv.color, palette);
|
|
934
|
+
}
|
|
935
|
+
function renderNodes(svg, nodes, palette, isDark, animate, expandedNodeIds, activeGroup, diagramOptions, collapsedNodes, tagGroups, fanoutSourceIds, scaledGroupIds, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
936
|
+
for (const node of nodes) {
|
|
937
|
+
const slo = !node.isEdge && diagramOptions ? resolveNodeSlo(node, diagramOptions) : null;
|
|
938
|
+
const severity = worstNodeSeverity(node, slo);
|
|
939
|
+
const nodeColors = nodeColor(node, palette, isDark, severity, false);
|
|
940
|
+
const textFill = nodeColors.textFill;
|
|
941
|
+
let { fill, stroke } = nodeColors;
|
|
942
|
+
if (activeGroup && tagGroups && !node.isEdge) {
|
|
943
|
+
const tagStroke = resolveActiveTagStroke(
|
|
944
|
+
node,
|
|
945
|
+
activeGroup,
|
|
946
|
+
tagGroups,
|
|
947
|
+
palette
|
|
948
|
+
);
|
|
949
|
+
if (tagStroke) {
|
|
950
|
+
stroke = tagStroke;
|
|
951
|
+
fill = shapeFill(palette, tagStroke, isDark);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
let cls = "infra-node";
|
|
955
|
+
if (animate && node.isEdge) {
|
|
956
|
+
cls += " infra-node-edge-throb";
|
|
957
|
+
} else if (animate && !node.isEdge) {
|
|
958
|
+
if (node.computedCbState === "open") cls += " infra-node-cb-open";
|
|
959
|
+
else if (severity === "overloaded") cls += " infra-node-overload";
|
|
960
|
+
else if (severity === "warning") cls += " infra-node-warning";
|
|
961
|
+
}
|
|
962
|
+
const g = svg.append("g").attr("class", cls).attr("data-line-number", node.lineNumber).attr("data-infra-node", node.id).attr("data-node-collapse", node.id).style("cursor", "pointer");
|
|
963
|
+
if (node.id.startsWith("[")) {
|
|
964
|
+
g.attr("data-node-toggle", node.id);
|
|
965
|
+
}
|
|
966
|
+
for (const [tagKey, tagVal] of Object.entries(node.tags)) {
|
|
967
|
+
g.attr(`data-tag-${tagKey.toLowerCase()}`, tagVal.toLowerCase());
|
|
968
|
+
}
|
|
969
|
+
if (!node.isEdge) {
|
|
970
|
+
const roles = inferRoles(node.properties);
|
|
971
|
+
for (const role of roles) {
|
|
972
|
+
g.attr(
|
|
973
|
+
`data-role-${role.name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
974
|
+
"true"
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
if (fanoutSourceIds?.has(node.id)) {
|
|
978
|
+
g.attr("data-role-fan-out", "true");
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const x = node.x - node.width / 2;
|
|
982
|
+
const y = node.y - node.height / 2;
|
|
983
|
+
const isCollapsedGroup = node.id.startsWith("[");
|
|
984
|
+
const strokeWidth = severity !== "normal" ? sc.sOverloadStrokeWidth : sc.sNodeStrokeWidth;
|
|
985
|
+
g.append("rect").attr("x", x).attr("y", y).attr("width", node.width).attr("height", node.height).attr("rx", sc.sNodeBorderRadius).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", strokeWidth);
|
|
986
|
+
const headerCenterY = y + NODE_HEADER_HEIGHT / 2 + sc.sNodeFontSize * 0.35;
|
|
987
|
+
g.append("text").attr("x", node.x).attr("y", headerCenterY).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sNodeFontSize).attr("font-weight", "600").attr("fill", textFill).text(node.label);
|
|
988
|
+
const isNodeCollapsed = collapsedNodes?.has(node.id) ?? false;
|
|
989
|
+
if (isNodeCollapsed) {
|
|
990
|
+
const chevronY = y + node.height - 6;
|
|
991
|
+
g.append("text").attr("x", node.x).attr("y", chevronY).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", 8).attr("fill", textFill).attr("opacity", 0.6).text("\u25B6");
|
|
992
|
+
}
|
|
993
|
+
if (!isNodeCollapsed) {
|
|
994
|
+
const expanded = expandedNodeIds?.has(node.id) ?? false;
|
|
995
|
+
const descLines = expanded && node.description && !node.isEdge ? node.description : [];
|
|
996
|
+
const descH = descLines.length * META_LINE_HEIGHT;
|
|
997
|
+
for (let di = 0; di < descLines.length; di++) {
|
|
998
|
+
const rawLine = descLines[di];
|
|
999
|
+
const processed = preprocessDescriptionLine(rawLine);
|
|
1000
|
+
const descTruncated = truncateDesc(processed);
|
|
1001
|
+
const isTruncated = descTruncated !== processed;
|
|
1002
|
+
const textEl = g.append("text").attr("x", node.x).attr(
|
|
1003
|
+
"y",
|
|
1004
|
+
y + NODE_HEADER_HEIGHT + di * META_LINE_HEIGHT + META_LINE_HEIGHT / 2 + sc.sMetaFontSize * 0.35
|
|
1005
|
+
).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("fill", textFill);
|
|
1006
|
+
renderInlineText(textEl, descTruncated, palette, sc.sMetaFontSize);
|
|
1007
|
+
if (isTruncated) textEl.append("title").text(rawLine);
|
|
1008
|
+
}
|
|
1009
|
+
const displayProps = !node.isEdge && expanded ? getDisplayProps(node, expanded, diagramOptions) : [];
|
|
1010
|
+
const computedRows = getComputedRows(node, expanded, slo);
|
|
1011
|
+
const hasContent = displayProps.length > 0 || computedRows.length > 0 || node.computedRps > 0;
|
|
1012
|
+
if (hasContent) {
|
|
1013
|
+
const sepY = y + NODE_HEADER_HEIGHT + descH;
|
|
1014
|
+
g.append("line").attr("x1", x).attr("y1", sepY).attr("x2", x + node.width).attr("y2", sepY).attr("stroke", stroke).attr("stroke-opacity", 0.3).attr("stroke-width", 1);
|
|
1015
|
+
const computedSection = [];
|
|
1016
|
+
const declaredSection = [];
|
|
1017
|
+
const nodeMaxRps = getNodeNumProp(node, "max-rps", 0);
|
|
1018
|
+
const nodeRateLimit = getNodeNumProp(node, "ratelimit-rps", 0);
|
|
1019
|
+
const nodeConcurrency = getNodeNumProp(node, "concurrency", 0);
|
|
1020
|
+
const nodeDurationMs = getNodeNumProp(node, "duration-ms", 100);
|
|
1021
|
+
const serverlessCap = nodeConcurrency > 0 ? nodeConcurrency / (nodeDurationMs / 1e3) : 0;
|
|
1022
|
+
const effectiveCap = serverlessCap > 0 ? serverlessCap : nodeMaxRps > 0 && nodeRateLimit > 0 ? Math.min(nodeMaxRps * node.computedInstances, nodeRateLimit) : nodeMaxRps > 0 ? nodeMaxRps * node.computedInstances : nodeRateLimit > 0 ? nodeRateLimit : 0;
|
|
1023
|
+
if (node.computedRps > 0) {
|
|
1024
|
+
let rlSeverity = "normal";
|
|
1025
|
+
if (nodeRateLimit > 0 && node.computedRps > 0 && !node.isEdge) {
|
|
1026
|
+
let preRl = node.computedRps;
|
|
1027
|
+
const ch = getNodeNumProp(node, "cache-hit", 0);
|
|
1028
|
+
if (ch > 0) preRl *= (100 - ch) / 100;
|
|
1029
|
+
const fw = getNodeNumProp(node, "firewall-block", 0);
|
|
1030
|
+
if (fw > 0) preRl *= (100 - fw) / 100;
|
|
1031
|
+
if (preRl > nodeRateLimit) rlSeverity = "overloaded";
|
|
1032
|
+
else if (preRl > nodeRateLimit * 0.8) rlSeverity = "warning";
|
|
1033
|
+
}
|
|
1034
|
+
const rpsSeverity = node.overloaded ? "overloaded" : rlSeverity === "overloaded" ? "overloaded" : node.rateLimited ? "warning" : isWarning(node) ? "warning" : rlSeverity === "warning" ? "warning" : "normal";
|
|
1035
|
+
const rpsColor = rpsSeverity === "overloaded" ? COLOR_OVERLOADED : rpsSeverity === "warning" ? COLOR_WARNING : textFill;
|
|
1036
|
+
const rpsInverted = rpsSeverity !== "normal";
|
|
1037
|
+
const rpsText = effectiveCap > 0 && !node.isEdge ? `${formatRpsShort(node.computedRps)} / ${formatRpsShort(effectiveCap)}` : formatRpsShort(node.computedRps);
|
|
1038
|
+
computedSection.push({
|
|
1039
|
+
key: "RPS",
|
|
1040
|
+
value: rpsText,
|
|
1041
|
+
valueFill: rpsColor,
|
|
1042
|
+
fontWeight: "500",
|
|
1043
|
+
inverted: rpsInverted,
|
|
1044
|
+
...rpsInverted && { invertedBg: rpsColor }
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
for (const cr of computedRows) {
|
|
1048
|
+
computedSection.push({
|
|
1049
|
+
key: cr.key,
|
|
1050
|
+
value: cr.value,
|
|
1051
|
+
valueFill: cr.color ?? textFill,
|
|
1052
|
+
fontWeight: "normal",
|
|
1053
|
+
...cr.inverted !== void 0 && { inverted: cr.inverted },
|
|
1054
|
+
...cr.inverted && cr.color !== void 0 && { invertedBg: cr.color }
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
for (const prop of displayProps) {
|
|
1058
|
+
let propColor = textFill;
|
|
1059
|
+
let inverted = false;
|
|
1060
|
+
let invertedBg;
|
|
1061
|
+
if (prop.key === "ratelimit-rps" && nodeRateLimit > 0 && node.computedRps > 0) {
|
|
1062
|
+
let preRl = node.computedRps;
|
|
1063
|
+
const ch = getNodeNumProp(node, "cache-hit", 0);
|
|
1064
|
+
if (ch > 0) preRl *= (100 - ch) / 100;
|
|
1065
|
+
const fw = getNodeNumProp(node, "firewall-block", 0);
|
|
1066
|
+
if (fw > 0) preRl *= (100 - fw) / 100;
|
|
1067
|
+
if (preRl > nodeRateLimit) {
|
|
1068
|
+
propColor = COLOR_OVERLOADED;
|
|
1069
|
+
inverted = true;
|
|
1070
|
+
invertedBg = COLOR_OVERLOADED;
|
|
1071
|
+
} else if (preRl > nodeRateLimit * 0.8) {
|
|
1072
|
+
propColor = COLOR_WARNING;
|
|
1073
|
+
inverted = true;
|
|
1074
|
+
invertedBg = COLOR_WARNING;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
declaredSection.push({
|
|
1078
|
+
key: prop.displayKey,
|
|
1079
|
+
value: prop.value,
|
|
1080
|
+
valueFill: propColor,
|
|
1081
|
+
fontWeight: "normal",
|
|
1082
|
+
inverted,
|
|
1083
|
+
...invertedBg !== void 0 && { invertedBg }
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
const rows = [...computedSection, ...declaredSection];
|
|
1087
|
+
const maxKeyWidth = Math.max(
|
|
1088
|
+
...rows.map((r) => measureText(`${r.key}: `, sc.sMetaFontSize))
|
|
1089
|
+
);
|
|
1090
|
+
const valueX = x + 10 + maxKeyWidth;
|
|
1091
|
+
let rowY = sepY + NODE_SEPARATOR_GAP + sc.sMetaFontSize;
|
|
1092
|
+
const needsSectionSep = computedSection.length > 0 && declaredSection.length > 0;
|
|
1093
|
+
let rowIdx = 0;
|
|
1094
|
+
for (const row of rows) {
|
|
1095
|
+
if (needsSectionSep && rowIdx === computedSection.length) {
|
|
1096
|
+
const sepLineY = rowY - sc.sMetaFontSize + 1;
|
|
1097
|
+
g.append("line").attr("x1", x).attr("y1", sepLineY).attr("x2", x + node.width).attr("y2", sepLineY).attr("stroke", stroke).attr("stroke-opacity", 0.3).attr("stroke-width", 1);
|
|
1098
|
+
rowY += sc.sNodeSeparatorGap;
|
|
1099
|
+
}
|
|
1100
|
+
if (row.inverted && row.invertedBg) {
|
|
1101
|
+
const pillH = sc.sMetaLineHeight - 1;
|
|
1102
|
+
const pillPad = 4;
|
|
1103
|
+
const pillX = x + pillPad;
|
|
1104
|
+
const pillY = rowY - sc.sMetaFontSize + 1;
|
|
1105
|
+
const pillW = node.width - pillPad * 2;
|
|
1106
|
+
g.append("rect").attr("x", pillX).attr("y", pillY).attr("width", pillW).attr("height", pillH).attr("rx", 3).attr("fill", row.invertedBg).attr("opacity", 0.9);
|
|
1107
|
+
const pillTextColor = isDark ? "#ffffff" : palette.text;
|
|
1108
|
+
g.append("text").attr("x", x + 10).attr("y", rowY).attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("font-weight", "600").attr("fill", pillTextColor).text(`${row.key}: `);
|
|
1109
|
+
g.append("text").attr("x", valueX).attr("y", rowY).attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("font-weight", "600").attr("fill", pillTextColor).text(row.value);
|
|
1110
|
+
} else {
|
|
1111
|
+
g.append("text").attr("x", x + 10).attr("y", rowY).attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("fill", textFill).text(`${row.key}: `);
|
|
1112
|
+
g.append("text").attr("x", valueX).attr("y", rowY).attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("font-weight", row.fontWeight).attr("fill", row.valueFill).text(row.value);
|
|
1113
|
+
}
|
|
1114
|
+
rowY += sc.sMetaLineHeight;
|
|
1115
|
+
rowIdx++;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
const inScaledGroup = node.groupId != null && (scaledGroupIds?.has(node.groupId) ?? false);
|
|
1119
|
+
if (!node.isEdge && node.computedConcurrentInvocations === 0 && node.computedInstances > 1 && !inScaledGroup) {
|
|
1120
|
+
const badgeText = `${node.computedInstances}x`;
|
|
1121
|
+
g.append("text").attr("x", x + node.width - 6).attr("y", y + NODE_HEADER_HEIGHT / 2 + sc.sMetaFontSize * 0.35).attr("text-anchor", "end").attr("font-family", FONT_FAMILY).attr("font-size", sc.sMetaFontSize).attr("fill", textFill).attr("data-instance-node", node.id).style("cursor", "pointer").text(badgeText);
|
|
1122
|
+
}
|
|
1123
|
+
const showDots = activeGroup?.toLowerCase() === "capabilities";
|
|
1124
|
+
const roles = showDots && !node.isEdge ? inferRoles(node.properties) : [];
|
|
1125
|
+
if (roles.length > 0) {
|
|
1126
|
+
const dotY = isCollapsedGroup ? y + node.height - sc.sCollapseBarHeight - sc.sNodePadBottom / 2 : y + node.height - sc.sNodePadBottom / 2;
|
|
1127
|
+
const totalDotsWidth = roles.length * (sc.sRoleDotRadius * 2 + 2) - 2;
|
|
1128
|
+
const startX = node.x - totalDotsWidth / 2 + sc.sRoleDotRadius;
|
|
1129
|
+
for (let i = 0; i < roles.length; i++) {
|
|
1130
|
+
g.append("circle").attr("cx", startX + i * (sc.sRoleDotRadius * 2 + 2)).attr("cy", dotY).attr("r", sc.sRoleDotRadius).attr("fill", roles[i].color);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (isCollapsedGroup) {
|
|
1134
|
+
const clipId = `clip-${node.id.replace(/[[\]\s]/g, "")}`;
|
|
1135
|
+
g.append("clipPath").attr("id", clipId).append("rect").attr("x", x).attr("y", y).attr("width", node.width).attr("height", node.height).attr("rx", sc.sNodeBorderRadius);
|
|
1136
|
+
g.append("rect").attr("x", x + sc.sCollapseBarInset).attr("y", y + node.height - sc.sCollapseBarHeight).attr("width", node.width - sc.sCollapseBarInset * 2).attr("height", sc.sCollapseBarHeight).attr("fill", stroke).attr("clip-path", `url(#${clipId})`).attr("class", "infra-collapse-bar");
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
function getNodeNumProp(node, key, fallback) {
|
|
1142
|
+
const prop = node.properties.find((p) => p.key === key);
|
|
1143
|
+
if (!prop) return fallback;
|
|
1144
|
+
if (typeof prop.value === "number") return prop.value;
|
|
1145
|
+
const num = parseFloat(String(prop.value));
|
|
1146
|
+
return isNaN(num) ? fallback : num;
|
|
1147
|
+
}
|
|
1148
|
+
function computeRejectedRps(node) {
|
|
1149
|
+
if (node.isEdge || node.computedRps <= 0) return 0;
|
|
1150
|
+
let rejected = 0;
|
|
1151
|
+
const inbound = node.computedRps;
|
|
1152
|
+
const fwBlock = getNodeNumProp(node, "firewall-block", 0);
|
|
1153
|
+
if (fwBlock > 0) rejected += inbound * (fwBlock / 100);
|
|
1154
|
+
const rateLimit = getNodeNumProp(node, "ratelimit-rps", 0);
|
|
1155
|
+
if (rateLimit > 0) {
|
|
1156
|
+
let preRateLimitRps = inbound;
|
|
1157
|
+
const cacheHit = getNodeNumProp(node, "cache-hit", 0);
|
|
1158
|
+
if (cacheHit > 0) preRateLimitRps *= (100 - cacheHit) / 100;
|
|
1159
|
+
if (fwBlock > 0) preRateLimitRps *= (100 - fwBlock) / 100;
|
|
1160
|
+
if (preRateLimitRps > rateLimit) {
|
|
1161
|
+
rejected += preRateLimitRps - rateLimit;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
if (node.overloaded || node.childHealthState === "overloaded") {
|
|
1165
|
+
const maxRps = getNodeNumProp(node, "max-rps", 0);
|
|
1166
|
+
if (maxRps > 0) {
|
|
1167
|
+
const capacity = maxRps * node.computedInstances;
|
|
1168
|
+
if (inbound > capacity) {
|
|
1169
|
+
rejected += inbound - capacity;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
if (rejected === 0) {
|
|
1173
|
+
rejected = inbound * 0.1;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return rejected;
|
|
1177
|
+
}
|
|
1178
|
+
function renderRejectParticles(svg, nodes, speedMultiplier = 1, sc = buildScaledConstants(ScaleContext.identity())) {
|
|
1179
|
+
const rejectMap = [];
|
|
1180
|
+
for (const node of nodes) {
|
|
1181
|
+
const rejected = computeRejectedRps(node);
|
|
1182
|
+
if (rejected > 0) rejectMap.push({ node, rejected });
|
|
1183
|
+
}
|
|
1184
|
+
if (rejectMap.length === 0) return;
|
|
1185
|
+
const maxRejected = Math.max(...rejectMap.map((r) => r.rejected));
|
|
1186
|
+
for (const { node, rejected } of rejectMap) {
|
|
1187
|
+
const t = Math.min(rejected / maxRejected, 1);
|
|
1188
|
+
const count = Math.round(
|
|
1189
|
+
REJECT_COUNT_MIN + t * (REJECT_COUNT_MAX - REJECT_COUNT_MIN)
|
|
1190
|
+
);
|
|
1191
|
+
const baseDur = REJECT_DURATION_MAX - t * (REJECT_DURATION_MAX - REJECT_DURATION_MIN);
|
|
1192
|
+
const dur = speedMultiplier > 0 ? baseDur / speedMultiplier : baseDur;
|
|
1193
|
+
const nodeBottom = node.y + node.height / 2;
|
|
1194
|
+
for (let i = 0; i < count; i++) {
|
|
1195
|
+
const delay = dur / count * i;
|
|
1196
|
+
const spread = node.width * 0.3;
|
|
1197
|
+
const startX = node.x + (count > 1 ? -spread / 2 + spread * (i / (count - 1)) : 0);
|
|
1198
|
+
const startY = nodeBottom;
|
|
1199
|
+
const endY = nodeBottom + sc.sRejectDropDistance;
|
|
1200
|
+
const rejectColor = node.overloaded || node.childHealthState === "overloaded" ? COLOR_OVERLOADED : COLOR_WARNING;
|
|
1201
|
+
const circle = svg.append("circle").attr("r", sc.sRejectParticleR).attr("fill", rejectColor).attr("opacity", 0);
|
|
1202
|
+
circle.append("animate").attr("attributeName", "cy").attr("from", startY).attr("to", endY).attr("dur", `${dur}s`).attr("repeatCount", "indefinite").attr("begin", `${delay}s`);
|
|
1203
|
+
circle.append("animate").attr("attributeName", "cx").attr("from", startX).attr("to", startX).attr("dur", `${dur}s`).attr("repeatCount", "indefinite").attr("begin", `${delay}s`);
|
|
1204
|
+
circle.append("animate").attr("attributeName", "opacity").attr("values", "0;0.8;0.6;0").attr("keyTimes", "0;0.1;0.5;1").attr("dur", `${dur}s`).attr("repeatCount", "indefinite").attr("begin", `${delay}s`);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function computeInfraLegendGroups(nodes, tagGroups, palette, edges) {
|
|
1209
|
+
const groups = [];
|
|
1210
|
+
const roles = collectDiagramRoles(
|
|
1211
|
+
nodes.filter((n) => !n.isEdge).map((n) => n.properties)
|
|
1212
|
+
);
|
|
1213
|
+
if (edges && collectFanoutSourceIds([...edges]).size > 0) {
|
|
1214
|
+
roles.push(FANOUT_ROLE);
|
|
1215
|
+
}
|
|
1216
|
+
if (roles.length > 0) {
|
|
1217
|
+
const entries = roles.map((r) => ({
|
|
1218
|
+
value: r.name,
|
|
1219
|
+
color: r.color,
|
|
1220
|
+
key: r.name.toLowerCase().replace(/\s+/g, "-")
|
|
1221
|
+
}));
|
|
1222
|
+
const pillWidth = measureLegendText("Capabilities", LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD;
|
|
1223
|
+
let entriesWidth = 0;
|
|
1224
|
+
for (const e of entries) {
|
|
1225
|
+
entriesWidth += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + measureLegendText(e.value, LEGEND_ENTRY_FONT_SIZE) + LEGEND_ENTRY_TRAIL;
|
|
1226
|
+
}
|
|
1227
|
+
groups.push({
|
|
1228
|
+
name: "Capabilities",
|
|
1229
|
+
type: "role",
|
|
1230
|
+
entries,
|
|
1231
|
+
width: LEGEND_CAPSULE_PAD * 2 + pillWidth + 4 + entriesWidth,
|
|
1232
|
+
minifiedWidth: pillWidth
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
for (const tg of tagGroups) {
|
|
1236
|
+
const entries = [];
|
|
1237
|
+
for (const tv of tg.values) {
|
|
1238
|
+
if (tv.color) {
|
|
1239
|
+
entries.push({
|
|
1240
|
+
value: tv.name,
|
|
1241
|
+
color: resolveColor(tv.color, palette) ?? tv.color,
|
|
1242
|
+
key: tv.name.toLowerCase()
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
if (entries.length === 0) continue;
|
|
1247
|
+
const pillWidth = measureLegendText(tg.name, LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD;
|
|
1248
|
+
let entriesWidth = 0;
|
|
1249
|
+
for (const e of entries) {
|
|
1250
|
+
entriesWidth += LEGEND_DOT_R * 2 + LEGEND_ENTRY_DOT_GAP + measureLegendText(e.value, LEGEND_ENTRY_FONT_SIZE) + LEGEND_ENTRY_TRAIL;
|
|
1251
|
+
}
|
|
1252
|
+
groups.push({
|
|
1253
|
+
name: tg.name,
|
|
1254
|
+
type: "tag",
|
|
1255
|
+
tagKey: tagAttrKey(tg.alias ?? tg.name),
|
|
1256
|
+
entries,
|
|
1257
|
+
width: LEGEND_CAPSULE_PAD * 2 + pillWidth + 4 + entriesWidth,
|
|
1258
|
+
minifiedWidth: pillWidth
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
return groups;
|
|
1262
|
+
}
|
|
1263
|
+
function renderLegend(rootSvg, legendGroups, totalWidth, legendY, palette, isDark, activeGroup, playback, exportMode = false, controlsHost) {
|
|
1264
|
+
if (legendGroups.length === 0 && !playback) return;
|
|
1265
|
+
const appHostedPlayback = controlsHost === "app" && !!playback;
|
|
1266
|
+
const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
|
|
1267
|
+
if (activeGroup) {
|
|
1268
|
+
legendG.attr("data-legend-active", tagAttrKey(activeGroup));
|
|
1269
|
+
}
|
|
1270
|
+
const allGroups = legendGroups.map((g) => ({
|
|
1271
|
+
name: g.name,
|
|
1272
|
+
entries: g.entries.map((e) => ({ value: e.value, color: e.color }))
|
|
1273
|
+
}));
|
|
1274
|
+
if (playback && !appHostedPlayback) {
|
|
1275
|
+
allGroups.push({ name: "Playback", entries: [] });
|
|
1276
|
+
}
|
|
1277
|
+
renderIntegratedLegend(legendG, {
|
|
1278
|
+
groups: allGroups,
|
|
1279
|
+
activeGroup,
|
|
1280
|
+
mode: exportMode ? "export" : "preview",
|
|
1281
|
+
showEmptyGroups: true,
|
|
1282
|
+
...appHostedPlayback && {
|
|
1283
|
+
controlsHost: "app",
|
|
1284
|
+
controlsGroup: {
|
|
1285
|
+
toggles: [
|
|
1286
|
+
{
|
|
1287
|
+
id: "playback",
|
|
1288
|
+
type: "toggle",
|
|
1289
|
+
label: "Playback",
|
|
1290
|
+
active: true,
|
|
1291
|
+
onToggle: () => {
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
]
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
palette,
|
|
1298
|
+
isDark,
|
|
1299
|
+
width: totalWidth
|
|
1300
|
+
});
|
|
1301
|
+
legendG.selectAll("[data-legend-group]").classed("infra-legend-group", true);
|
|
1302
|
+
for (const group of legendGroups) {
|
|
1303
|
+
const groupKey = tagAttrKey(group.name);
|
|
1304
|
+
for (const entry of group.entries) {
|
|
1305
|
+
const entryEl = legendG.select(
|
|
1306
|
+
`[data-legend-group="${groupKey}"] [data-legend-entry="${entry.value.toLowerCase()}"]`
|
|
1307
|
+
);
|
|
1308
|
+
if (!entryEl.empty()) {
|
|
1309
|
+
entryEl.attr("data-legend-entry", entry.key.toLowerCase()).attr("data-legend-color", entry.color).attr("data-legend-type", group.type).attr(
|
|
1310
|
+
"data-legend-tag-group",
|
|
1311
|
+
group.type === "tag" ? group.tagKey ?? "" : null
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const playbackEl = legendG.select('[data-legend-group="playback"]');
|
|
1317
|
+
if (!playbackEl.empty()) {
|
|
1318
|
+
playbackEl.classed("infra-playback-pill", true);
|
|
1319
|
+
}
|
|
1320
|
+
if (playback && playback.expanded && !playbackEl.empty()) {
|
|
1321
|
+
const pillWidth = measureLegendText("Playback", LEGEND_PILL_FONT_SIZE) + LEGEND_PILL_PAD;
|
|
1322
|
+
let entryX = pillWidth + 8;
|
|
1323
|
+
const entryY = LEGEND_HEIGHT / 2 + LEGEND_ENTRY_FONT_SIZE / 2 - 1;
|
|
1324
|
+
const ppLabel = playback.paused ? "\u25B6" : "\u23F8";
|
|
1325
|
+
playbackEl.append("text").attr("x", entryX).attr("y", entryY).attr("font-family", FONT_FAMILY).attr("font-size", LEGEND_PILL_FONT_SIZE).attr("fill", palette.textMuted).attr("data-playback-action", "toggle-pause").style("cursor", "pointer").text(ppLabel);
|
|
1326
|
+
entryX += LEGEND_PILL_FONT_SIZE * 0.8 + 6;
|
|
1327
|
+
for (const s of playback.speedOptions) {
|
|
1328
|
+
const label = `${s}x`;
|
|
1329
|
+
const isSpeedActive = playback.speed === s;
|
|
1330
|
+
const slotW = measureLegendText(label, LEGEND_ENTRY_FONT_SIZE) + SPEED_BADGE_H_PAD * 2;
|
|
1331
|
+
const badgeH = LEGEND_ENTRY_FONT_SIZE + SPEED_BADGE_V_PAD * 2;
|
|
1332
|
+
const badgeY = (LEGEND_HEIGHT - badgeH) / 2;
|
|
1333
|
+
const speedG = playbackEl.append("g").attr("data-playback-action", "set-speed").attr("data-playback-value", String(s)).style("cursor", "pointer");
|
|
1334
|
+
speedG.append("rect").attr("x", entryX).attr("y", badgeY).attr("width", slotW).attr("height", badgeH).attr("rx", badgeH / 2).attr("fill", isSpeedActive ? palette.primary : "transparent");
|
|
1335
|
+
speedG.append("text").attr("x", entryX + slotW / 2).attr("y", entryY).attr("font-family", FONT_FAMILY).attr("font-size", LEGEND_ENTRY_FONT_SIZE).attr("font-weight", isSpeedActive ? "600" : "400").attr("fill", isSpeedActive ? palette.bg : palette.textMuted).attr("text-anchor", "middle").text(label);
|
|
1336
|
+
entryX += slotW + SPEED_BADGE_GAP;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function renderInfra(container, layout, palette, isDark, title, titleLineNumber, tagGroups, activeGroup, animate, playback, expandedNodeIds, exportMode, collapsedNodes, controlsHost) {
|
|
1341
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
1342
|
+
const appHostedPlayback = controlsHost === "app" && !!playback;
|
|
1343
|
+
const ctx = ScaleContext.identity();
|
|
1344
|
+
const sc = buildScaledConstants(ctx);
|
|
1345
|
+
const legendGroups = computeInfraLegendGroups(
|
|
1346
|
+
layout.nodes,
|
|
1347
|
+
tagGroups ?? [],
|
|
1348
|
+
palette,
|
|
1349
|
+
layout.edges
|
|
1350
|
+
);
|
|
1351
|
+
const hasLegend = legendGroups.length > 0 || !!playback && !appHostedPlayback;
|
|
1352
|
+
const fixedLegend = !exportMode && hasLegend;
|
|
1353
|
+
const legendDynamicH = hasLegend ? getMaxLegendReservedHeight(
|
|
1354
|
+
{
|
|
1355
|
+
groups: legendGroups,
|
|
1356
|
+
position: { placement: "top-center", titleRelation: "below-title" },
|
|
1357
|
+
mode: exportMode ? "export" : "preview",
|
|
1358
|
+
showEmptyGroups: true
|
|
1359
|
+
},
|
|
1360
|
+
container.clientWidth || layout.width
|
|
1361
|
+
) : LEGEND_HEIGHT;
|
|
1362
|
+
const legendOffset = hasLegend && !fixedLegend ? legendDynamicH : 0;
|
|
1363
|
+
const titleOffset = title ? TITLE_OFFSET : 0;
|
|
1364
|
+
const totalWidth = layout.width;
|
|
1365
|
+
const totalHeight = layout.height + titleOffset + legendOffset;
|
|
1366
|
+
const shouldAnimate = animate !== false;
|
|
1367
|
+
const fixedTitleH = fixedLegend && title ? TITLE_OFFSET : 0;
|
|
1368
|
+
const diagramViewHeight = fixedLegend ? layout.height + (title && !fixedTitleH ? titleOffset : 0) + legendOffset : totalHeight;
|
|
1369
|
+
if (fixedTitleH) {
|
|
1370
|
+
const titleContainerW = container.clientWidth || totalWidth;
|
|
1371
|
+
const titleSvg = d3Selection.select(container).append("svg").attr("class", "infra-title-fixed").attr("width", "100%").attr("height", fixedTitleH).attr("viewBox", `0 0 ${titleContainerW} ${fixedTitleH}`).attr("preserveAspectRatio", "xMidYMid meet").style("display", "block");
|
|
1372
|
+
titleSvg.append("text").attr("class", "chart-title").attr("x", titleContainerW / 2).attr("y", sc.sTitleY).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).attr("data-line-number", titleLineNumber != null ? titleLineNumber : "").text(title);
|
|
1373
|
+
}
|
|
1374
|
+
const fixedOverheadH = (fixedLegend ? legendDynamicH + sc.sLegendFixedGap : 0) + fixedTitleH;
|
|
1375
|
+
const rootSvg = d3Selection.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", "100%").attr(
|
|
1376
|
+
"height",
|
|
1377
|
+
fixedOverheadH > 0 ? `calc(100% - ${fixedOverheadH}px)` : "100%"
|
|
1378
|
+
).attr("viewBox", `0 0 ${totalWidth} ${diagramViewHeight}`).attr("preserveAspectRatio", "xMidYMid meet");
|
|
1379
|
+
if (ctx.isBelowFloor) {
|
|
1380
|
+
rootSvg.attr("width", "100%");
|
|
1381
|
+
}
|
|
1382
|
+
if (shouldAnimate) {
|
|
1383
|
+
rootSvg.append("style").text(`
|
|
1384
|
+
@keyframes infra-pulse-warning {
|
|
1385
|
+
0%, 100% { opacity: 1; }
|
|
1386
|
+
50% { opacity: 0.7; }
|
|
1387
|
+
}
|
|
1388
|
+
@keyframes infra-pulse-overload {
|
|
1389
|
+
0%, 100% { stroke-width: ${sc.sOverloadStrokeWidth}; }
|
|
1390
|
+
50% { stroke-width: ${sc.sOverloadStrokeWidth + 2}; }
|
|
1391
|
+
}
|
|
1392
|
+
@keyframes infra-pulse-cb {
|
|
1393
|
+
0%, 49% { stroke-dasharray: none; }
|
|
1394
|
+
50%, 100% { stroke-dasharray: 6 4; }
|
|
1395
|
+
}
|
|
1396
|
+
.infra-node-warning > rect:first-of-type {
|
|
1397
|
+
animation: infra-pulse-warning ${NODE_PULSE_SPEED}s ease-in-out infinite;
|
|
1398
|
+
}
|
|
1399
|
+
.infra-node-overload > rect:first-of-type {
|
|
1400
|
+
animation: infra-pulse-overload ${NODE_PULSE_OVERLOAD}s ease-in-out infinite;
|
|
1401
|
+
}
|
|
1402
|
+
.infra-node-cb-open > rect:first-of-type {
|
|
1403
|
+
stroke-dasharray: 6 4;
|
|
1404
|
+
animation: infra-pulse-cb 1s step-end infinite;
|
|
1405
|
+
}
|
|
1406
|
+
@keyframes infra-edge-throb {
|
|
1407
|
+
0%, 100% { stroke-width: ${sc.sEdgeStrokeWidth}; }
|
|
1408
|
+
50% { stroke-width: ${sc.sEdgeStrokeWidth * 2}; }
|
|
1409
|
+
}
|
|
1410
|
+
.infra-node-edge-throb > rect:first-of-type {
|
|
1411
|
+
animation: infra-edge-throb 2s ease-in-out infinite;
|
|
1412
|
+
cursor: pointer;
|
|
1413
|
+
}
|
|
1414
|
+
.infra-edge-label {
|
|
1415
|
+
opacity: 0;
|
|
1416
|
+
transition: opacity 0.15s ease;
|
|
1417
|
+
pointer-events: all;
|
|
1418
|
+
}
|
|
1419
|
+
.infra-edge-label:hover {
|
|
1420
|
+
opacity: 1;
|
|
1421
|
+
}
|
|
1422
|
+
`);
|
|
1423
|
+
}
|
|
1424
|
+
const contentTitleOffset = fixedTitleH ? 0 : titleOffset;
|
|
1425
|
+
const svg = rootSvg.append("g").attr("transform", `translate(0, ${contentTitleOffset + legendOffset})`);
|
|
1426
|
+
if (title && !fixedTitleH) {
|
|
1427
|
+
rootSvg.append("text").attr("class", "chart-title").attr("x", totalWidth / 2).attr("y", sc.sTitleY).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sc.sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).attr("data-line-number", titleLineNumber != null ? titleLineNumber : "").text(title);
|
|
1428
|
+
}
|
|
1429
|
+
renderGroups(svg, layout.groups, palette, isDark, sc);
|
|
1430
|
+
const speedMultiplier = playback?.speed ?? 1;
|
|
1431
|
+
renderEdgePaths(
|
|
1432
|
+
svg,
|
|
1433
|
+
layout.edges,
|
|
1434
|
+
layout.nodes,
|
|
1435
|
+
layout.groups,
|
|
1436
|
+
palette,
|
|
1437
|
+
isDark,
|
|
1438
|
+
shouldAnimate,
|
|
1439
|
+
layout.direction,
|
|
1440
|
+
speedMultiplier,
|
|
1441
|
+
sc
|
|
1442
|
+
);
|
|
1443
|
+
const fanoutSourceIds = collectFanoutSourceIds([...layout.edges]);
|
|
1444
|
+
const scaledGroupIds = new Set(
|
|
1445
|
+
layout.groups.filter((g) => {
|
|
1446
|
+
const gi = typeof g.instances === "number" ? g.instances : typeof g.instances === "string" ? parseInt(String(g.instances), 10) || 0 : 0;
|
|
1447
|
+
return gi > 1;
|
|
1448
|
+
}).map((g) => g.id)
|
|
1449
|
+
);
|
|
1450
|
+
renderNodes(
|
|
1451
|
+
svg,
|
|
1452
|
+
layout.nodes,
|
|
1453
|
+
palette,
|
|
1454
|
+
isDark,
|
|
1455
|
+
shouldAnimate,
|
|
1456
|
+
expandedNodeIds,
|
|
1457
|
+
activeGroup,
|
|
1458
|
+
layout.options,
|
|
1459
|
+
collapsedNodes,
|
|
1460
|
+
tagGroups ?? [],
|
|
1461
|
+
fanoutSourceIds,
|
|
1462
|
+
scaledGroupIds,
|
|
1463
|
+
sc
|
|
1464
|
+
);
|
|
1465
|
+
if (shouldAnimate) {
|
|
1466
|
+
renderRejectParticles(svg, layout.nodes, speedMultiplier, sc);
|
|
1467
|
+
}
|
|
1468
|
+
renderEdgeLabels(
|
|
1469
|
+
svg,
|
|
1470
|
+
layout.edges,
|
|
1471
|
+
layout.nodes,
|
|
1472
|
+
layout.groups,
|
|
1473
|
+
palette,
|
|
1474
|
+
isDark,
|
|
1475
|
+
shouldAnimate,
|
|
1476
|
+
layout.direction,
|
|
1477
|
+
sc
|
|
1478
|
+
);
|
|
1479
|
+
if (hasLegend) {
|
|
1480
|
+
if (fixedLegend) {
|
|
1481
|
+
const legendContainerW = container.clientWidth || totalWidth;
|
|
1482
|
+
const legendSvg = d3Selection.select(container).insert("svg", "svg:last-of-type").attr("class", "infra-legend-fixed").attr("width", "100%").attr("height", legendDynamicH + sc.sLegendFixedGap).attr(
|
|
1483
|
+
"viewBox",
|
|
1484
|
+
`0 0 ${legendContainerW} ${legendDynamicH + sc.sLegendFixedGap}`
|
|
1485
|
+
).attr("preserveAspectRatio", "xMidYMid meet").style("display", "block").style("pointer-events", "none");
|
|
1486
|
+
renderLegend(
|
|
1487
|
+
legendSvg,
|
|
1488
|
+
legendGroups,
|
|
1489
|
+
legendContainerW,
|
|
1490
|
+
sc.sLegendFixedGap / 2,
|
|
1491
|
+
palette,
|
|
1492
|
+
isDark,
|
|
1493
|
+
activeGroup ?? null,
|
|
1494
|
+
playback ?? void 0,
|
|
1495
|
+
exportMode,
|
|
1496
|
+
controlsHost
|
|
1497
|
+
);
|
|
1498
|
+
legendSvg.selectAll(".infra-legend-group").style("pointer-events", "auto");
|
|
1499
|
+
} else {
|
|
1500
|
+
renderLegend(
|
|
1501
|
+
rootSvg,
|
|
1502
|
+
legendGroups,
|
|
1503
|
+
totalWidth,
|
|
1504
|
+
titleOffset,
|
|
1505
|
+
palette,
|
|
1506
|
+
isDark,
|
|
1507
|
+
activeGroup ?? null,
|
|
1508
|
+
playback ?? void 0,
|
|
1509
|
+
exportMode,
|
|
1510
|
+
controlsHost
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
function parseAndLayoutInfra(content) {
|
|
1516
|
+
const parsed = parseInfra(content);
|
|
1517
|
+
if (parsed.error) return { parsed, computed: null, layout: null };
|
|
1518
|
+
const computed = computeInfra(parsed);
|
|
1519
|
+
const layout = layoutInfra(computed);
|
|
1520
|
+
return { parsed, computed, layout };
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
export {
|
|
1524
|
+
inferRoles,
|
|
1525
|
+
collectDiagramRoles,
|
|
1526
|
+
computeInfraLegendGroups,
|
|
1527
|
+
renderInfra,
|
|
1528
|
+
parseAndLayoutInfra
|
|
1529
|
+
};
|
|
1530
|
+
//# sourceMappingURL=chunk-PBHE5UG6.js.map
|