@legionworks/facet 1.9.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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +23 -0
- package/README.md +158 -0
- package/dist/gallery/chunk-4g8rem85.css +656 -0
- package/dist/gallery/chunk-c6s9k9ty.js +5970 -0
- package/dist/gallery/frame/artifact.css +8424 -0
- package/dist/gallery/frame/chunks/abnfDiagram-N423BO3Z-jj74szbm.js +155 -0
- package/dist/gallery/frame/chunks/architecture-TIHT7OUA-cvdjn7dt.js +10 -0
- package/dist/gallery/frame/chunks/architectureDiagram-T3A2C74G-n4z77eg6.js +8675 -0
- package/dist/gallery/frame/chunks/blockDiagram-VBNYF7ZC-7xsqzrd1.js +3529 -0
- package/dist/gallery/frame/chunks/c4Diagram-5PPSVZJV-z2zjs7wx.js +2413 -0
- package/dist/gallery/frame/chunks/classDiagram-JCYQIIEL-ve8rngqp.js +47 -0
- package/dist/gallery/frame/chunks/classDiagram-v2-OCEON4UE-8cfaxb8z.js +47 -0
- package/dist/gallery/frame/chunks/cose-bilkent-JH36ORCC-sn92qexx.js +4822 -0
- package/dist/gallery/frame/chunks/cynefin-VYW2F7L2-tqjv913d.js +10 -0
- package/dist/gallery/frame/chunks/cynefinDiagram-MW4NZA55-c1c0dj12.js +500 -0
- package/dist/gallery/frame/chunks/dagre-VZM6K2ZE-7tyg4yt2.js +476 -0
- package/dist/gallery/frame/chunks/diagram-7IWD3JNH-y4eng9sc.js +526 -0
- package/dist/gallery/frame/chunks/diagram-B4RE2ZJO-rn3p7j5h.js +673 -0
- package/dist/gallery/frame/chunks/diagram-LBJQPF4R-w4a2cm9q.js +255 -0
- package/dist/gallery/frame/chunks/diagram-Q27KOJAE-aqc2v7wy.js +575 -0
- package/dist/gallery/frame/chunks/diagram-UB23O5K3-xncy8nyd.js +355 -0
- package/dist/gallery/frame/chunks/ebnfDiagram-BXEA7PRR-acwgxz16.js +175 -0
- package/dist/gallery/frame/chunks/erDiagram-JOGREHBK-mzp5nswt.js +1332 -0
- package/dist/gallery/frame/chunks/eventmodeling-45OFAUF4-sg07qr0c.js +10 -0
- package/dist/gallery/frame/chunks/flowDiagram-UKHOOZJN-2e5ygs44.js +29 -0
- package/dist/gallery/frame/chunks/ganttDiagram-PKOTCBZU-p2hhh7hr.js +2620 -0
- package/dist/gallery/frame/chunks/gitGraph-TEB2WS4Q-j6kw0naa.js +10 -0
- package/dist/gallery/frame/chunks/gitGraphDiagram-DS77QQ5N-4z9z8wjm.js +1347 -0
- package/dist/gallery/frame/chunks/info-DKCQHKI2-mpt80jd3.js +10 -0
- package/dist/gallery/frame/chunks/infoDiagram-6WML65LV-5rqm3mgg.js +65 -0
- package/dist/gallery/frame/chunks/ishikawaDiagram-WSZJBQD7-b51z96jy.js +975 -0
- package/dist/gallery/frame/chunks/journeyDiagram-NVQOT4AX-9jbfp0pk.js +1272 -0
- package/dist/gallery/frame/chunks/kanban-definition-27J2QSJJ-4x0vx4se.js +1116 -0
- package/dist/gallery/frame/chunks/katex-xfgk95tv.js +14034 -0
- package/dist/gallery/frame/chunks/markdown-1s5vwkf2.js +9 -0
- package/dist/gallery/frame/chunks/markdown-2h6bwsms.js +3239 -0
- package/dist/gallery/frame/chunks/markdown-2x113yh8.js +107 -0
- package/dist/gallery/frame/chunks/markdown-30b7rwmp.js +1943 -0
- package/dist/gallery/frame/chunks/markdown-356bfj4g.js +2031 -0
- package/dist/gallery/frame/chunks/markdown-44n9ea69.js +2406 -0
- package/dist/gallery/frame/chunks/markdown-56enrf2r.js +39 -0
- package/dist/gallery/frame/chunks/markdown-5avymm8t.js +725 -0
- package/dist/gallery/frame/chunks/markdown-6r4svars.js +33 -0
- package/dist/gallery/frame/chunks/markdown-6zz8efx2.js +24 -0
- package/dist/gallery/frame/chunks/markdown-7jp6prnb.js +19 -0
- package/dist/gallery/frame/chunks/markdown-809k7q41.js +55 -0
- package/dist/gallery/frame/chunks/markdown-82xmzhzd.js +1076 -0
- package/dist/gallery/frame/chunks/markdown-92n37gd4.js +7627 -0
- package/dist/gallery/frame/chunks/markdown-ag2sssf8.js +36 -0
- package/dist/gallery/frame/chunks/markdown-b4s7ntq2.js +19 -0
- package/dist/gallery/frame/chunks/markdown-c9k0fvp1.js +100 -0
- package/dist/gallery/frame/chunks/markdown-ceefymn8.js +125 -0
- package/dist/gallery/frame/chunks/markdown-d1wfbs70.js +243 -0
- package/dist/gallery/frame/chunks/markdown-dy5sgjhc.js +11022 -0
- package/dist/gallery/frame/chunks/markdown-dz3z5w30.js +30868 -0
- package/dist/gallery/frame/chunks/markdown-eg6ngz7y.js +30340 -0
- package/dist/gallery/frame/chunks/markdown-ff5wvb43.js +1149 -0
- package/dist/gallery/frame/chunks/markdown-ffg06nfz.js +86 -0
- package/dist/gallery/frame/chunks/markdown-fvfncadf.js +472 -0
- package/dist/gallery/frame/chunks/markdown-gvyszqpv.js +19 -0
- package/dist/gallery/frame/chunks/markdown-gx1p0ew0.js +88 -0
- package/dist/gallery/frame/chunks/markdown-gxye5frz.js +65 -0
- package/dist/gallery/frame/chunks/markdown-h7pzv34e.js +105 -0
- package/dist/gallery/frame/chunks/markdown-hab789t9.js +47 -0
- package/dist/gallery/frame/chunks/markdown-hjp6sj8t.js +125 -0
- package/dist/gallery/frame/chunks/markdown-jka64qgp.js +1993 -0
- package/dist/gallery/frame/chunks/markdown-k8xkn8mw.js +56 -0
- package/dist/gallery/frame/chunks/markdown-m7frq8x8.js +112 -0
- package/dist/gallery/frame/chunks/markdown-p740v4qm.js +36 -0
- package/dist/gallery/frame/chunks/markdown-pxfeh231.js +57 -0
- package/dist/gallery/frame/chunks/markdown-pzgd8z3s.js +87 -0
- package/dist/gallery/frame/chunks/markdown-qx3cngz2.js +1673 -0
- package/dist/gallery/frame/chunks/markdown-rawhfvvc.js +85 -0
- package/dist/gallery/frame/chunks/markdown-rd8w0ng9.js +49 -0
- package/dist/gallery/frame/chunks/markdown-rm2yxfjj.js +2773 -0
- package/dist/gallery/frame/chunks/markdown-s1jatrnk.js +993 -0
- package/dist/gallery/frame/chunks/markdown-sgfg5vvq.js +59 -0
- package/dist/gallery/frame/chunks/markdown-t4ethv9d.js +409 -0
- package/dist/gallery/frame/chunks/markdown-tnmabqvz.js +36 -0
- package/dist/gallery/frame/chunks/markdown-tvdpppw8.js +5292 -0
- package/dist/gallery/frame/chunks/markdown-v0x27twr.js +22 -0
- package/dist/gallery/frame/chunks/markdown-v14td68x.js +36 -0
- package/dist/gallery/frame/chunks/markdown-w6sgd54z.js +36 -0
- package/dist/gallery/frame/chunks/markdown-xw8dsk8b.js +2125 -0
- package/dist/gallery/frame/chunks/markdown-y18mve73.js +85 -0
- package/dist/gallery/frame/chunks/markdown-yengsms5.js +427 -0
- package/dist/gallery/frame/chunks/markdown-z1wc0v0d.js +1826 -0
- package/dist/gallery/frame/chunks/markdown-zazx9h4n.js +329 -0
- package/dist/gallery/frame/chunks/mermaid-de7p4v0x.js +30 -0
- package/dist/gallery/frame/chunks/mindmap-definition-FAOFIHXS-ra44cbem.js +1216 -0
- package/dist/gallery/frame/chunks/packet-7NZHBO7P-xppm5913.js +10 -0
- package/dist/gallery/frame/chunks/pegDiagram-VL7TDLO6-a2a4wg03.js +163 -0
- package/dist/gallery/frame/chunks/pie-RZYD4A2V-hnbxk152.js +10 -0
- package/dist/gallery/frame/chunks/pieDiagram-7S7Q4E2Y-f1vxjtmx.js +311 -0
- package/dist/gallery/frame/chunks/quadrantDiagram-CIZ2JOQS-ywafa6kh.js +1390 -0
- package/dist/gallery/frame/chunks/radar-I7S5WNFK-ewqd27se.js +10 -0
- package/dist/gallery/frame/chunks/railroad-3IZDKUUU-5hy4bdx3.js +10 -0
- package/dist/gallery/frame/chunks/railroad-abnf-AHOZXSZD-bh5sxz0d.js +10 -0
- package/dist/gallery/frame/chunks/railroad-ebnf-EBAXGLYW-6b9c3zeh.js +10 -0
- package/dist/gallery/frame/chunks/railroad-peg-LSFZ7HO6-avc8v39s.js +10 -0
- package/dist/gallery/frame/chunks/railroadDiagram-AXF67PYL-qc61wax4.js +131 -0
- package/dist/gallery/frame/chunks/requirementDiagram-LRYGKXZP-9bs4786c.js +1295 -0
- package/dist/gallery/frame/chunks/sankeyDiagram-W5VNT64P-awt1em8b.js +1339 -0
- package/dist/gallery/frame/chunks/sequenceDiagram-SI44F4Z6-qaf9mz3t.js +4324 -0
- package/dist/gallery/frame/chunks/sizeCapture-X5ZJPWSS-9fq685xd.js +64 -0
- package/dist/gallery/frame/chunks/stateDiagram-OKZ733FA-vx7a7hh0.js +456 -0
- package/dist/gallery/frame/chunks/stateDiagram-v2-UEYNNEHI-x4m6ws5t.js +46 -0
- package/dist/gallery/frame/chunks/swimlanes-SLNWSIFB-e4mxm1gh.js +8287 -0
- package/dist/gallery/frame/chunks/swimlanesDiagram-ULZ7WXOC-0h93e2qq.js +42 -0
- package/dist/gallery/frame/chunks/timeline-definition-Z64GVDOM-wp0bhbzg.js +1549 -0
- package/dist/gallery/frame/chunks/treeView-QDETBFTQ-hcx7n0vt.js +10 -0
- package/dist/gallery/frame/chunks/treemap-6X3UGDF4-av02skdw.js +10 -0
- package/dist/gallery/frame/chunks/vennDiagram-T6HMQDX7-pmvk1p7n.js +2566 -0
- package/dist/gallery/frame/chunks/wardley-OPB4EBWU-njsp6e40.js +10 -0
- package/dist/gallery/frame/chunks/wardleyDiagram-T6FBY63Y-eggmnv4z.js +979 -0
- package/dist/gallery/frame/chunks/xychartDiagram-ELKLHX3M-q40tnpe5.js +1954 -0
- package/dist/gallery/frame/frame.css +183 -0
- package/dist/gallery/frame/runtime/chart.js +42744 -0
- package/dist/gallery/frame/runtime/html.js +14 -0
- package/dist/gallery/frame/runtime/markdown.js +1403 -0
- package/dist/gallery/frame/runtime/mermaid.js +32 -0
- package/dist/gallery/frame/runtime/svg.js +14 -0
- package/dist/gallery/frame/runtime/tsx.js +52 -0
- package/dist/gallery/index.html +104 -0
- package/docs/reference/cli.md +163 -0
- package/docs/reference/export.md +106 -0
- package/docs/reference/html.md +215 -0
- package/docs/reference/http.md +85 -0
- package/docs/reference/mcp.md +78 -0
- package/docs/reference/security.md +119 -0
- package/docs/reference/storage.md +93 -0
- package/docs/reference/tsx.md +101 -0
- package/docs/reference/validation.md +212 -0
- package/package.json +89 -0
- package/scripts/build-gallery.ts +127 -0
- package/scripts/launch-netns.sh +67 -0
- package/skills/facet/SKILL.md +100 -0
- package/src/cli/client.ts +311 -0
- package/src/cli/commands/create.ts +49 -0
- package/src/cli/commands/doctor.ts +249 -0
- package/src/cli/commands/export.ts +179 -0
- package/src/cli/commands/instantiate.ts +35 -0
- package/src/cli/commands/list.ts +49 -0
- package/src/cli/commands/open.ts +75 -0
- package/src/cli/commands/pin.ts +39 -0
- package/src/cli/commands/promote.ts +49 -0
- package/src/cli/commands/publish.ts +122 -0
- package/src/cli/commands/read-back.ts +56 -0
- package/src/cli/commands/status.ts +114 -0
- package/src/cli/commands/watch.ts +146 -0
- package/src/cli/main.ts +522 -0
- package/src/cli/output.ts +106 -0
- package/src/cli/parser.ts +376 -0
- package/src/cli/presenter.ts +212 -0
- package/src/cli/service-metadata.ts +134 -0
- package/src/cli/spawn-service.ts +326 -0
- package/src/css.d.ts +4 -0
- package/src/gallery-web/app.ts +1581 -0
- package/src/gallery-web/export-menu.ts +121 -0
- package/src/gallery-web/export.ts +112 -0
- package/src/gallery-web/favicon.ts +54 -0
- package/src/gallery-web/frame/entries/chart.ts +6 -0
- package/src/gallery-web/frame/entries/html.ts +6 -0
- package/src/gallery-web/frame/entries/markdown.ts +6 -0
- package/src/gallery-web/frame/entries/mermaid.ts +6 -0
- package/src/gallery-web/frame/entries/svg.ts +6 -0
- package/src/gallery-web/frame/entries/tsx.ts +6 -0
- package/src/gallery-web/frame/frame-payload.ts +91 -0
- package/src/gallery-web/frame/renderer-validation.ts +13 -0
- package/src/gallery-web/frame/renderers/chart.ts +182 -0
- package/src/gallery-web/frame/renderers/dompurify-shim.ts +112 -0
- package/src/gallery-web/frame/renderers/html.ts +48 -0
- package/src/gallery-web/frame/renderers/markdown.ts +81 -0
- package/src/gallery-web/frame/renderers/mermaid.ts +120 -0
- package/src/gallery-web/frame/renderers/registry.ts +260 -0
- package/src/gallery-web/frame/renderers/svg.ts +393 -0
- package/src/gallery-web/frame/renderers/tsx.ts +61 -0
- package/src/gallery-web/frame/runtime.ts +501 -0
- package/src/gallery-web/frame/styles/artifact.css +8424 -0
- package/src/gallery-web/frame/styles/frame.css +183 -0
- package/src/gallery-web/frame/styles/html-source.css +23 -0
- package/src/gallery-web/frame/view-box.ts +33 -0
- package/src/gallery-web/frame-html.ts +72 -0
- package/src/gallery-web/index.html +104 -0
- package/src/gallery-web/session.ts +107 -0
- package/src/gallery-web/sse-client.ts +212 -0
- package/src/gallery-web/styles/app.css +420 -0
- package/src/gallery-web/styles/tokens.css +112 -0
- package/src/gallery-web/styles/verdict.css +186 -0
- package/src/gallery-web/swap.ts +64 -0
- package/src/gallery-web/theme.ts +40 -0
- package/src/gallery-web/view-state.ts +93 -0
- package/src/harness-adapters/claude-code/README.md +10 -0
- package/src/harness-adapters/claude-code/facet.sh +4 -0
- package/src/harness-adapters/codex/README.md +10 -0
- package/src/harness-adapters/codex/facet.sh +4 -0
- package/src/harness-adapters/mcp/README.md +13 -0
- package/src/harness-adapters/mcp/cli-bridge.ts +216 -0
- package/src/harness-adapters/mcp/main.ts +15 -0
- package/src/harness-adapters/mcp/server.ts +164 -0
- package/src/harness-adapters/mcp/tool-schemas.ts +53 -0
- package/src/harness-adapters/opencode/README.md +10 -0
- package/src/harness-adapters/opencode/facet.sh +4 -0
- package/src/runtime/compiled-entrypoints.ts +69 -0
- package/src/service/dispatcher.ts +717 -0
- package/src/service/export.ts +218 -0
- package/src/service/http-utils.ts +55 -0
- package/src/service/lexical/expectations.ts +210 -0
- package/src/service/lifecycle/idle-controller.ts +125 -0
- package/src/service/lifecycle/orphan-cleanup.ts +128 -0
- package/src/service/lifecycle/process-lock.ts +235 -0
- package/src/service/main.ts +136 -0
- package/src/service/process.ts +240 -0
- package/src/service/router-guards.ts +239 -0
- package/src/service/router.ts +627 -0
- package/src/service/security/auth.ts +168 -0
- package/src/service/security/host-origin.ts +138 -0
- package/src/service/security/http-guards.ts +13 -0
- package/src/service/security/leases.ts +182 -0
- package/src/service/security/token-store.ts +138 -0
- package/src/service/server.ts +356 -0
- package/src/service/store/database.ts +61 -0
- package/src/service/store/evidence-retention.ts +234 -0
- package/src/service/store/migrations.ts +167 -0
- package/src/service/store/repository-lifecycle.ts +121 -0
- package/src/service/store/repository.ts +732 -0
- package/src/service/store/schema.ts +218 -0
- package/src/service/stored-verdict.ts +97 -0
- package/src/service/stream.ts +301 -0
- package/src/service/verdict-enrichment.ts +45 -0
- package/src/shared/build/frame-bundle-plugins.ts +61 -0
- package/src/shared/build-mode.ts +28 -0
- package/src/shared/config/evidence-read.ts +98 -0
- package/src/shared/config/limits.ts +56 -0
- package/src/shared/config/paths.ts +96 -0
- package/src/shared/contracts/artifact-types.ts +2 -0
- package/src/shared/contracts/artifact.ts +98 -0
- package/src/shared/contracts/commands/_shared.ts +59 -0
- package/src/shared/contracts/commands/guards.ts +86 -0
- package/src/shared/contracts/commands/index.ts +204 -0
- package/src/shared/contracts/commands/names.ts +35 -0
- package/src/shared/contracts/commands/requests.ts +149 -0
- package/src/shared/contracts/commands/results.ts +200 -0
- package/src/shared/contracts/envelope.ts +140 -0
- package/src/shared/contracts/events.ts +41 -0
- package/src/shared/contracts/observed-counts.ts +19 -0
- package/src/shared/contracts/renderers.ts +6 -0
- package/src/shared/contracts/validation.ts +296 -0
- package/src/shared/errors/facet-error.ts +127 -0
- package/src/shared/errors/store-error.ts +68 -0
- package/src/shared/evidence-image.ts +37 -0
- package/src/shared/export.ts +31 -0
- package/src/shared/html/policy.ts +108 -0
- package/src/shared/html/style-vocabulary.ts +352 -0
- package/src/shared/logging/logger.ts +108 -0
- package/src/shared/logging/redact.ts +49 -0
- package/src/shared/security/frozen-csp.ts +13 -0
- package/src/shared/storage-version.ts +2 -0
- package/src/shared/tsx/execution.ts +29 -0
- package/src/shared/tsx/import-policy.ts +94 -0
- package/src/shared/util/dir-permissions.ts +94 -0
- package/src/shared/util/mermaid-nodes.ts +230 -0
- package/src/shared/util/process.ts +67 -0
- package/src/shared/util/time.ts +21 -0
- package/src/shared/version.ts +3 -0
- package/src/validation/sandbox/limits.ts +41 -0
- package/src/validation/sandbox/netns.ts +177 -0
- package/src/validation/tier0/chart.ts +177 -0
- package/src/validation/tier0/dom-shim.ts +54 -0
- package/src/validation/tier0/html.ts +408 -0
- package/src/validation/tier0/markdown.ts +285 -0
- package/src/validation/tier0/mermaid.ts +98 -0
- package/src/validation/tier0/runner.ts +504 -0
- package/src/validation/tier0/svg.ts +321 -0
- package/src/validation/tier0/tsx/allowlist-resolver.ts +77 -0
- package/src/validation/tier0/tsx/ast-policy-capabilities.ts +238 -0
- package/src/validation/tier0/tsx/ast-policy-shared.ts +71 -0
- package/src/validation/tier0/tsx/ast-policy.ts +181 -0
- package/src/validation/tier0/tsx/compiler.ts +156 -0
- package/src/validation/tier0/worker-dispatch.ts +211 -0
- package/src/validation/tier0/worker-entry.ts +96 -0
- package/src/validation/tier0/worker-input.ts +75 -0
- package/src/validation/tier1/browser-process.ts +147 -0
- package/src/validation/tier1/cdp-pipe.ts +281 -0
- package/src/validation/tier1/entries/chart.ts +5 -0
- package/src/validation/tier1/entries/html.ts +6 -0
- package/src/validation/tier1/entries/markdown.ts +5 -0
- package/src/validation/tier1/entries/mermaid.ts +5 -0
- package/src/validation/tier1/entries/svg.ts +5 -0
- package/src/validation/tier1/entries/tsx.ts +5 -0
- package/src/validation/tier1/frame-target.ts +162 -0
- package/src/validation/tier1/harness-entry.ts +261 -0
- package/src/validation/tier1/harness.ts +215 -0
- package/src/validation/tier1/isolated-probe.ts +94 -0
- package/src/validation/tier1/launcher.ts +177 -0
- package/src/validation/tier1/limits.ts +80 -0
- package/src/validation/tier1/nonce.ts +17 -0
- package/src/validation/tier1/protocol-probe.ts +519 -0
- package/src/validation/tier1/runner.ts +1122 -0
- package/src/validation/tier1/verdict.ts +246 -0
- package/src/validation/tier1/webp.ts +69 -0
- package/templates/README.md +88 -0
- package/templates/bar-compare.vl.json +63 -0
- package/templates/capacity-report.tsx +102 -0
- package/templates/decision-record.md +24 -0
- package/templates/deployment-state.mmd +40 -0
- package/templates/exemplar.md +91 -0
- package/templates/facet-story.tsx +799 -0
- package/templates/fleet-dashboard.html +141 -0
- package/templates/html-release-ledger.html +91 -0
- package/templates/html-status-report.html +114 -0
- package/templates/incident-console.tsx +147 -0
- package/templates/legion-boundaries.mmd +23 -0
- package/templates/legion-flow.mmd +15 -0
- package/templates/legion-sequence.mmd +14 -0
- package/templates/legion-state.mmd +7 -0
- package/templates/metric-card.svg +29 -0
- package/templates/observability-map.svg +101 -0
- package/templates/pipeline-audit.md +108 -0
- package/templates/release-metrics.vl.json +98 -0
- package/templates/service-topology.mmd +47 -0
- package/templates/status-report.md +32 -0
- package/templates/system-map.svg +53 -0
- package/templates/timeseries.vl.json +71 -0
- package/templates/tsx-interactive-counter.tsx +19 -0
- package/templates/tsx-status-report.tsx +31 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseFontSize
|
|
3
|
+
} from "./markdown-ff5wvb43.js";
|
|
4
|
+
import {
|
|
5
|
+
defaultConfig_default,
|
|
6
|
+
getConfig2
|
|
7
|
+
} from "./markdown-92n37gd4.js";
|
|
8
|
+
import {
|
|
9
|
+
__name
|
|
10
|
+
} from "./markdown-1s5vwkf2.js";
|
|
11
|
+
|
|
12
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/chunk-UBXNYLIW.mjs
|
|
13
|
+
var getSubGraphTitleMargins = /* @__PURE__ */ __name(({
|
|
14
|
+
flowchart
|
|
15
|
+
}) => {
|
|
16
|
+
const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;
|
|
17
|
+
const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;
|
|
18
|
+
const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
|
|
19
|
+
return {
|
|
20
|
+
subGraphTitleTopMargin,
|
|
21
|
+
subGraphTitleBottomMargin,
|
|
22
|
+
subGraphTitleTotalMargin
|
|
23
|
+
};
|
|
24
|
+
}, "getSubGraphTitleMargins");
|
|
25
|
+
async function configureLabelImages(container, labelText) {
|
|
26
|
+
const images = container.getElementsByTagName("img");
|
|
27
|
+
if (!images || images.length === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
|
|
31
|
+
await Promise.all([...images].map((img) => new Promise((res) => {
|
|
32
|
+
function setupImage() {
|
|
33
|
+
img.style.display = "flex";
|
|
34
|
+
img.style.flexDirection = "column";
|
|
35
|
+
if (noImgText) {
|
|
36
|
+
const bodyFontSize = getConfig2().fontSize ? getConfig2().fontSize : window.getComputedStyle(document.body).fontSize;
|
|
37
|
+
const enlargingFactor = 5;
|
|
38
|
+
const [parsedBodyFontSize = defaultConfig_default.fontSize] = parseFontSize(bodyFontSize);
|
|
39
|
+
const width = parsedBodyFontSize * enlargingFactor + "px";
|
|
40
|
+
img.style.minWidth = width;
|
|
41
|
+
img.style.maxWidth = width;
|
|
42
|
+
} else {
|
|
43
|
+
img.style.width = "100%";
|
|
44
|
+
}
|
|
45
|
+
res(img);
|
|
46
|
+
}
|
|
47
|
+
__name(setupImage, "setupImage");
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
if (img.complete) {
|
|
50
|
+
setupImage();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
img.addEventListener("error", setupImage);
|
|
54
|
+
img.addEventListener("load", setupImage);
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
__name(configureLabelImages, "configureLabelImages");
|
|
58
|
+
|
|
59
|
+
export { getSubGraphTitleMargins, configureLabelImages };
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Graph,
|
|
3
|
+
clone_default,
|
|
4
|
+
isUndefined_default,
|
|
5
|
+
map_default
|
|
6
|
+
} from "./markdown-2h6bwsms.js";
|
|
7
|
+
import {
|
|
8
|
+
log
|
|
9
|
+
} from "./markdown-xw8dsk8b.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./markdown-1s5vwkf2.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/dagre-d3-es/src/graphlib/json.js
|
|
15
|
+
function write(g) {
|
|
16
|
+
var json = {
|
|
17
|
+
options: {
|
|
18
|
+
directed: g.isDirected(),
|
|
19
|
+
multigraph: g.isMultigraph(),
|
|
20
|
+
compound: g.isCompound()
|
|
21
|
+
},
|
|
22
|
+
nodes: writeNodes(g),
|
|
23
|
+
edges: writeEdges(g)
|
|
24
|
+
};
|
|
25
|
+
if (!isUndefined_default(g.graph())) {
|
|
26
|
+
json.value = clone_default(g.graph());
|
|
27
|
+
}
|
|
28
|
+
return json;
|
|
29
|
+
}
|
|
30
|
+
function writeNodes(g) {
|
|
31
|
+
return map_default(g.nodes(), function(v) {
|
|
32
|
+
var nodeValue = g.node(v);
|
|
33
|
+
var parent = g.parent(v);
|
|
34
|
+
var node = { v };
|
|
35
|
+
if (!isUndefined_default(nodeValue)) {
|
|
36
|
+
node.value = nodeValue;
|
|
37
|
+
}
|
|
38
|
+
if (!isUndefined_default(parent)) {
|
|
39
|
+
node.parent = parent;
|
|
40
|
+
}
|
|
41
|
+
return node;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function writeEdges(g) {
|
|
45
|
+
return map_default(g.edges(), function(e) {
|
|
46
|
+
var edgeValue = g.edge(e);
|
|
47
|
+
var edge = { v: e.v, w: e.w };
|
|
48
|
+
if (!isUndefined_default(e.name)) {
|
|
49
|
+
edge.name = e.name;
|
|
50
|
+
}
|
|
51
|
+
if (!isUndefined_default(edgeValue)) {
|
|
52
|
+
edge.value = edgeValue;
|
|
53
|
+
}
|
|
54
|
+
return edge;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/chunk-RYQCIY6F.mjs
|
|
59
|
+
var clusterDb = /* @__PURE__ */ new Map;
|
|
60
|
+
var descendants = /* @__PURE__ */ new Map;
|
|
61
|
+
var parents = /* @__PURE__ */ new Map;
|
|
62
|
+
var clear = /* @__PURE__ */ __name(() => {
|
|
63
|
+
descendants.clear();
|
|
64
|
+
parents.clear();
|
|
65
|
+
clusterDb.clear();
|
|
66
|
+
}, "clear");
|
|
67
|
+
var isDescendant = /* @__PURE__ */ __name((id, ancestorId) => {
|
|
68
|
+
const ancestorDescendants = descendants.get(ancestorId) || [];
|
|
69
|
+
log.trace("In isDescendant", ancestorId, " ", id, " = ", ancestorDescendants.includes(id));
|
|
70
|
+
return ancestorDescendants.includes(id);
|
|
71
|
+
}, "isDescendant");
|
|
72
|
+
var edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
|
|
73
|
+
const clusterDescendants = descendants.get(clusterId) || [];
|
|
74
|
+
log.info("Descendants of ", clusterId, " is ", clusterDescendants);
|
|
75
|
+
log.info("Edge is ", edge);
|
|
76
|
+
if (edge.v === clusterId || edge.w === clusterId) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (!clusterDescendants) {
|
|
80
|
+
log.debug("Tilt, ", clusterId, ",not in descendants");
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return clusterDescendants.includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || clusterDescendants.includes(edge.w);
|
|
84
|
+
}, "edgeInCluster");
|
|
85
|
+
var copy = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
|
|
86
|
+
log.warn("Copying children of ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
|
|
87
|
+
const nodes = graph.children(clusterId) || [];
|
|
88
|
+
if (clusterId !== rootId) {
|
|
89
|
+
nodes.push(clusterId);
|
|
90
|
+
}
|
|
91
|
+
log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes);
|
|
92
|
+
nodes.forEach((node) => {
|
|
93
|
+
if (graph.children(node).length > 0) {
|
|
94
|
+
copy(node, graph, newGraph, rootId);
|
|
95
|
+
} else {
|
|
96
|
+
const data = graph.node(node);
|
|
97
|
+
log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
|
|
98
|
+
newGraph.setNode(node, data);
|
|
99
|
+
if (rootId !== graph.parent(node)) {
|
|
100
|
+
log.warn("Setting parent", node, graph.parent(node));
|
|
101
|
+
newGraph.setParent(node, graph.parent(node));
|
|
102
|
+
}
|
|
103
|
+
if (clusterId !== rootId && node !== clusterId) {
|
|
104
|
+
log.debug("Setting parent", node, clusterId);
|
|
105
|
+
newGraph.setParent(node, clusterId);
|
|
106
|
+
} else {
|
|
107
|
+
log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
|
|
108
|
+
log.debug("Not Setting parent for node=", node, "cluster!==rootId", clusterId !== rootId, "node!==clusterId", node !== clusterId);
|
|
109
|
+
}
|
|
110
|
+
const edges = graph.edges(node);
|
|
111
|
+
log.debug("Copying Edges", edges);
|
|
112
|
+
edges.forEach((edge) => {
|
|
113
|
+
log.info("Edge", edge);
|
|
114
|
+
const data2 = graph.edge(edge.v, edge.w, edge.name);
|
|
115
|
+
log.info("Edge data", data2, rootId);
|
|
116
|
+
try {
|
|
117
|
+
if (edgeInCluster(edge, rootId)) {
|
|
118
|
+
const rootDescendants = descendants.get(rootId) || [];
|
|
119
|
+
const vIn = rootDescendants.includes(edge.v) || isDescendant(edge.v, rootId) || edge.v === rootId;
|
|
120
|
+
const wIn = rootDescendants.includes(edge.w) || isDescendant(edge.w, rootId) || edge.w === rootId;
|
|
121
|
+
if (vIn && wIn) {
|
|
122
|
+
log.info("Copying as ", edge.v, edge.w, data2, edge.name);
|
|
123
|
+
newGraph.setEdge(edge.v, edge.w, data2, edge.name);
|
|
124
|
+
log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
|
|
125
|
+
} else {
|
|
126
|
+
const newV = vIn ? rootId : edge.v;
|
|
127
|
+
const newW = wIn ? rootId : edge.w;
|
|
128
|
+
log.info("Rebinding cross-boundary edge as ", newV, newW, data2, edge.name);
|
|
129
|
+
graph.setEdge(newV, newW, data2, edge.name);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
log.info("Skipping copy of edge ", edge.v, "-->", edge.w, " rootId: ", rootId, " clusterId:", clusterId);
|
|
133
|
+
}
|
|
134
|
+
} catch (e) {
|
|
135
|
+
log.error(e);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
log.debug("Removing node", node);
|
|
140
|
+
graph.removeNode(node);
|
|
141
|
+
});
|
|
142
|
+
}, "copy");
|
|
143
|
+
var extractDescendants = /* @__PURE__ */ __name((id, graph) => {
|
|
144
|
+
const children = graph.children(id);
|
|
145
|
+
let res = [...children];
|
|
146
|
+
for (const child of children) {
|
|
147
|
+
parents.set(child, id);
|
|
148
|
+
res = [...res, ...extractDescendants(child, graph)];
|
|
149
|
+
}
|
|
150
|
+
return res;
|
|
151
|
+
}, "extractDescendants");
|
|
152
|
+
var findCommonEdges = /* @__PURE__ */ __name((graph, id1, id2) => {
|
|
153
|
+
const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);
|
|
154
|
+
const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);
|
|
155
|
+
const edges1Prim = edges1.map((edge) => {
|
|
156
|
+
return { v: edge.v === id1 ? id2 : edge.v, w: edge.w === id1 ? id1 : edge.w };
|
|
157
|
+
});
|
|
158
|
+
const edges2Prim = edges2.map((edge) => {
|
|
159
|
+
return { v: edge.v, w: edge.w };
|
|
160
|
+
});
|
|
161
|
+
const result = edges1Prim.filter((edgeIn1) => {
|
|
162
|
+
return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);
|
|
163
|
+
});
|
|
164
|
+
return result;
|
|
165
|
+
}, "findCommonEdges");
|
|
166
|
+
var findNonClusterChild = /* @__PURE__ */ __name((id, graph, clusterId) => {
|
|
167
|
+
const children = graph.children(id);
|
|
168
|
+
log.trace("Searching children of id ", id, children);
|
|
169
|
+
if (children.length < 1) {
|
|
170
|
+
return id;
|
|
171
|
+
}
|
|
172
|
+
let reserve;
|
|
173
|
+
for (const child of children) {
|
|
174
|
+
const _id = findNonClusterChild(child, graph, clusterId);
|
|
175
|
+
const commonEdges = findCommonEdges(graph, clusterId, _id);
|
|
176
|
+
if (_id) {
|
|
177
|
+
if (commonEdges.length > 0) {
|
|
178
|
+
reserve = _id;
|
|
179
|
+
} else {
|
|
180
|
+
return _id;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return reserve;
|
|
185
|
+
}, "findNonClusterChild");
|
|
186
|
+
var getAnchorId = /* @__PURE__ */ __name((id) => {
|
|
187
|
+
if (!clusterDb.has(id)) {
|
|
188
|
+
return id;
|
|
189
|
+
}
|
|
190
|
+
if (!clusterDb.get(id).externalConnections) {
|
|
191
|
+
return id;
|
|
192
|
+
}
|
|
193
|
+
if (clusterDb.has(id)) {
|
|
194
|
+
return clusterDb.get(id).id;
|
|
195
|
+
}
|
|
196
|
+
return id;
|
|
197
|
+
}, "getAnchorId");
|
|
198
|
+
var adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
|
|
199
|
+
if (!graph || depth > 10) {
|
|
200
|
+
log.debug("Opting out, no graph ");
|
|
201
|
+
return;
|
|
202
|
+
} else {
|
|
203
|
+
log.debug("Opting in, graph ");
|
|
204
|
+
}
|
|
205
|
+
graph.nodes().forEach(function(id) {
|
|
206
|
+
const children = graph.children(id);
|
|
207
|
+
if (children.length > 0) {
|
|
208
|
+
log.warn("Cluster identified", id, " Replacement id in edges: ", findNonClusterChild(id, graph, id));
|
|
209
|
+
descendants.set(id, extractDescendants(id, graph));
|
|
210
|
+
clusterDb.set(id, { id: findNonClusterChild(id, graph, id), clusterData: graph.node(id) });
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
graph.nodes().forEach(function(id) {
|
|
214
|
+
const children = graph.children(id);
|
|
215
|
+
const edges = graph.edges();
|
|
216
|
+
if (children.length > 0) {
|
|
217
|
+
log.debug("Cluster identified", id, descendants);
|
|
218
|
+
edges.forEach((edge) => {
|
|
219
|
+
const d1 = isDescendant(edge.v, id);
|
|
220
|
+
const d2 = isDescendant(edge.w, id);
|
|
221
|
+
if (d1 ^ d2) {
|
|
222
|
+
log.warn("Edge: ", edge, " leaves cluster ", id);
|
|
223
|
+
log.warn("Descendants of XXX ", id, ": ", descendants.get(id));
|
|
224
|
+
clusterDb.get(id).externalConnections = true;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
log.debug("Not a cluster ", id, descendants);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
for (let id of clusterDb.keys()) {
|
|
232
|
+
const nonClusterChild = clusterDb.get(id).id;
|
|
233
|
+
const parent = graph.parent(nonClusterChild);
|
|
234
|
+
if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) {
|
|
235
|
+
clusterDb.get(id).id = parent;
|
|
236
|
+
}
|
|
237
|
+
const hasDirectOutgoingEdge = graph.edges().some((edge) => edge.v === id);
|
|
238
|
+
if (nonClusterChild && clusterDb.get(id)?.externalConnections && hasDirectOutgoingEdge && isNodeInExtractableCluster(graph, nonClusterChild, id)) {
|
|
239
|
+
const safeAnchor = findSafeAnchorNode(graph, id, graph.parent(nonClusterChild));
|
|
240
|
+
if (safeAnchor) {
|
|
241
|
+
clusterDb.get(id).id = safeAnchor;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
graph.edges().forEach(function(e) {
|
|
246
|
+
const edge = graph.edge(e);
|
|
247
|
+
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
|
|
248
|
+
log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
|
|
249
|
+
let v = e.v;
|
|
250
|
+
let w = e.w;
|
|
251
|
+
log.warn("Fix XXX", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb.get(e.v), " --- ", clusterDb.get(e.w));
|
|
252
|
+
if (clusterDb.get(e.v) || clusterDb.get(e.w)) {
|
|
253
|
+
log.warn("Fixing and trying - removing XXX", e.v, e.w, e.name);
|
|
254
|
+
v = getAnchorId(e.v);
|
|
255
|
+
w = getAnchorId(e.w);
|
|
256
|
+
graph.removeEdge(e.v, e.w, e.name);
|
|
257
|
+
if (v !== e.v) {
|
|
258
|
+
const parent = graph.parent(v);
|
|
259
|
+
clusterDb.get(parent).externalConnections = true;
|
|
260
|
+
edge.fromCluster = e.v;
|
|
261
|
+
}
|
|
262
|
+
if (w !== e.w) {
|
|
263
|
+
const parent = graph.parent(w);
|
|
264
|
+
clusterDb.get(parent).externalConnections = true;
|
|
265
|
+
edge.toCluster = e.w;
|
|
266
|
+
}
|
|
267
|
+
log.warn("Fix Replacing with XXX", v, w, e.name);
|
|
268
|
+
graph.setEdge(v, w, edge, e.name);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
log.warn("Adjusted Graph", write(graph));
|
|
272
|
+
extractor(graph, 0);
|
|
273
|
+
log.trace(clusterDb);
|
|
274
|
+
}, "adjustClustersAndEdges");
|
|
275
|
+
var extractor = /* @__PURE__ */ __name((graph, depth) => {
|
|
276
|
+
log.warn("extractor - ", depth, write(graph), graph.children("D"));
|
|
277
|
+
if (depth > 10) {
|
|
278
|
+
log.error("Bailing out");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
let nodes = graph.nodes();
|
|
282
|
+
let hasChildren = false;
|
|
283
|
+
for (const node of nodes) {
|
|
284
|
+
const children = graph.children(node);
|
|
285
|
+
hasChildren = hasChildren || children.length > 0;
|
|
286
|
+
}
|
|
287
|
+
if (!hasChildren) {
|
|
288
|
+
log.debug("Done, no node has children", graph.nodes());
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
log.debug("Nodes = ", nodes, depth);
|
|
292
|
+
for (const node of nodes) {
|
|
293
|
+
log.debug("Extracting node", node, clusterDb, clusterDb.has(node) && !clusterDb.get(node).externalConnections, !graph.parent(node), graph.node(node), graph.children("D"), " Depth ", depth);
|
|
294
|
+
if (!clusterDb.has(node)) {
|
|
295
|
+
log.debug("Not a cluster", node, depth);
|
|
296
|
+
} else if (clusterDb.get(node)?.clusterData?.explicitDir && graph.children(node) && graph.children(node).length > 0) {
|
|
297
|
+
log.warn("Cluster with explicit dir, creating subgraph for children", node, depth);
|
|
298
|
+
const dir = clusterDb.get(node).clusterData.dir;
|
|
299
|
+
const clusterGraph = new Graph({
|
|
300
|
+
multigraph: true,
|
|
301
|
+
compound: true
|
|
302
|
+
}).setGraph({
|
|
303
|
+
rankdir: dir,
|
|
304
|
+
nodesep: 50,
|
|
305
|
+
ranksep: 50,
|
|
306
|
+
marginx: 8,
|
|
307
|
+
marginy: 8
|
|
308
|
+
}).setDefaultEdgeLabel(function() {
|
|
309
|
+
return {};
|
|
310
|
+
});
|
|
311
|
+
copy(node, graph, clusterGraph, node);
|
|
312
|
+
const clusterNodeData = graph.node(node) || {};
|
|
313
|
+
graph.setNode(node, {
|
|
314
|
+
...clusterNodeData,
|
|
315
|
+
clusterNode: true,
|
|
316
|
+
id: node,
|
|
317
|
+
clusterData: clusterDb.get(node).clusterData,
|
|
318
|
+
label: clusterDb.get(node).label,
|
|
319
|
+
graph: clusterGraph
|
|
320
|
+
});
|
|
321
|
+
log.warn("Subgraph for cluster with explicit dir created:", node, write(clusterGraph));
|
|
322
|
+
} else if (!clusterDb.get(node).externalConnections && graph.children(node) && graph.children(node).length > 0) {
|
|
323
|
+
log.warn("Cluster without external connections, without a parent and with children", node, depth);
|
|
324
|
+
const graphSettings = graph.graph();
|
|
325
|
+
let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
|
|
326
|
+
if (clusterDb.get(node)?.clusterData?.dir) {
|
|
327
|
+
dir = clusterDb.get(node).clusterData.dir;
|
|
328
|
+
log.warn("Fixing dir", clusterDb.get(node).clusterData.dir, dir);
|
|
329
|
+
}
|
|
330
|
+
const clusterGraph = new Graph({
|
|
331
|
+
multigraph: true,
|
|
332
|
+
compound: true
|
|
333
|
+
}).setGraph({
|
|
334
|
+
rankdir: dir,
|
|
335
|
+
nodesep: 50,
|
|
336
|
+
ranksep: 50,
|
|
337
|
+
marginx: 8,
|
|
338
|
+
marginy: 8
|
|
339
|
+
}).setDefaultEdgeLabel(function() {
|
|
340
|
+
return {};
|
|
341
|
+
});
|
|
342
|
+
copy(node, graph, clusterGraph, node);
|
|
343
|
+
const clusterNodeData = graph.node(node) || {};
|
|
344
|
+
graph.setNode(node, {
|
|
345
|
+
...clusterNodeData,
|
|
346
|
+
clusterNode: true,
|
|
347
|
+
id: node,
|
|
348
|
+
clusterData: clusterDb.get(node).clusterData,
|
|
349
|
+
label: clusterDb.get(node).label,
|
|
350
|
+
graph: clusterGraph
|
|
351
|
+
});
|
|
352
|
+
log.debug("Old graph after copy", write(graph));
|
|
353
|
+
} else {
|
|
354
|
+
log.warn("Cluster ** ", node, " **not meeting the criteria !externalConnections:", !clusterDb.get(node).externalConnections, " no parent: ", !graph.parent(node), " children ", graph.children(node) && graph.children(node).length > 0, graph.children("D"), depth);
|
|
355
|
+
log.debug(clusterDb);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
nodes = graph.nodes();
|
|
359
|
+
log.warn("New list of nodes", nodes);
|
|
360
|
+
for (const node of nodes) {
|
|
361
|
+
const data = graph.node(node);
|
|
362
|
+
log.warn(" Now next level", node, data);
|
|
363
|
+
if (data?.clusterNode) {
|
|
364
|
+
extractor(data.graph, depth + 1);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, "extractor");
|
|
368
|
+
var sorter = /* @__PURE__ */ __name((graph, nodes) => {
|
|
369
|
+
if (nodes.length === 0) {
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
372
|
+
let result = Object.assign([], nodes);
|
|
373
|
+
nodes.forEach((node) => {
|
|
374
|
+
const children = graph.children(node);
|
|
375
|
+
const sorted = sorter(graph, children);
|
|
376
|
+
result = [...result, ...sorted];
|
|
377
|
+
});
|
|
378
|
+
return result;
|
|
379
|
+
}, "sorter");
|
|
380
|
+
var sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
|
|
381
|
+
var isNodeInExtractableCluster = /* @__PURE__ */ __name((graph, node, rootId) => {
|
|
382
|
+
let parent = graph.parent(node);
|
|
383
|
+
while (parent && parent !== rootId) {
|
|
384
|
+
const cluster = clusterDb.get(parent);
|
|
385
|
+
if (cluster && !cluster.externalConnections) {
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
parent = graph.parent(parent);
|
|
389
|
+
}
|
|
390
|
+
return false;
|
|
391
|
+
}, "isNodeInExtractableCluster");
|
|
392
|
+
var findSafeAnchorNode = /* @__PURE__ */ __name((graph, clusterId, excludedCluster) => {
|
|
393
|
+
const children = graph.children(clusterId) ?? [];
|
|
394
|
+
for (const child of children) {
|
|
395
|
+
if (child === excludedCluster || isDescendant(child, excludedCluster)) {
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
const candidate = findNonClusterChild(child, graph, clusterId);
|
|
399
|
+
if (!candidate) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
if (!isNodeInExtractableCluster(graph, candidate, clusterId)) {
|
|
403
|
+
return candidate;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return null;
|
|
407
|
+
}, "findSafeAnchorNode");
|
|
408
|
+
|
|
409
|
+
export { write, clusterDb, clear, findNonClusterChild, adjustClustersAndEdges, sortNodesByHierarchy };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractMermaidTokenBuilder,
|
|
3
|
+
CommonValueConverter,
|
|
4
|
+
EmptyFileSystem,
|
|
5
|
+
MermaidGeneratedSharedModule,
|
|
6
|
+
PacketGrammarGeneratedModule,
|
|
7
|
+
__name,
|
|
8
|
+
createDefaultCoreModule,
|
|
9
|
+
createDefaultSharedCoreModule,
|
|
10
|
+
inject
|
|
11
|
+
} from "./markdown-dz3z5w30.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-EMLP6XTP.mjs
|
|
14
|
+
var PacketTokenBuilder = class extends AbstractMermaidTokenBuilder {
|
|
15
|
+
static {
|
|
16
|
+
__name(this, "PacketTokenBuilder");
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super(["packet"]);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var PacketModule = {
|
|
23
|
+
parser: {
|
|
24
|
+
TokenBuilder: /* @__PURE__ */ __name(() => new PacketTokenBuilder, "TokenBuilder"),
|
|
25
|
+
ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter, "ValueConverter")
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function createPacketServices(context = EmptyFileSystem) {
|
|
29
|
+
const shared = inject(createDefaultSharedCoreModule(context), MermaidGeneratedSharedModule);
|
|
30
|
+
const Packet = inject(createDefaultCoreModule({ shared }), PacketGrammarGeneratedModule, PacketModule);
|
|
31
|
+
shared.ServiceRegistry.register(Packet);
|
|
32
|
+
return { shared, Packet };
|
|
33
|
+
}
|
|
34
|
+
__name(createPacketServices, "createPacketServices");
|
|
35
|
+
|
|
36
|
+
export { PacketModule, createPacketServices };
|