@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,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./markdown-1s5vwkf2.js";
|
|
4
|
+
import"./markdown-809k7q41.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/sizeCapture-X5ZJPWSS.mjs
|
|
7
|
+
var DDLT_SIZE_CAPTURE_VERSION = 1;
|
|
8
|
+
function getCaptureGlobal() {
|
|
9
|
+
if (typeof globalThis === "undefined") {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
return globalThis;
|
|
13
|
+
}
|
|
14
|
+
__name(getCaptureGlobal, "getCaptureGlobal");
|
|
15
|
+
function shouldCaptureSizes() {
|
|
16
|
+
return Boolean(getCaptureGlobal()?.mermaidCaptureSizes);
|
|
17
|
+
}
|
|
18
|
+
__name(shouldCaptureSizes, "shouldCaptureSizes");
|
|
19
|
+
function capturedFromLocation() {
|
|
20
|
+
if (typeof location === "undefined") {
|
|
21
|
+
return "browser-dev";
|
|
22
|
+
}
|
|
23
|
+
return `${location.pathname}${location.search}`;
|
|
24
|
+
}
|
|
25
|
+
__name(capturedFromLocation, "capturedFromLocation");
|
|
26
|
+
function emitCapturedSizes(captured, element) {
|
|
27
|
+
const g = getCaptureGlobal();
|
|
28
|
+
if (!g) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const domNode = element.node();
|
|
32
|
+
const ownerSvg = (domNode && "ownerSVGElement" in domNode ? domNode.ownerSVGElement : null) ?? domNode;
|
|
33
|
+
const svgId = ownerSvg?.id ?? "(unknown)";
|
|
34
|
+
g.mermaidCapturedSizes ??= [];
|
|
35
|
+
const entry = { svgId, sizes: captured };
|
|
36
|
+
g.mermaidCapturedSizes.push(entry);
|
|
37
|
+
g.mermaidLastCapturedSizes = entry;
|
|
38
|
+
}
|
|
39
|
+
__name(emitCapturedSizes, "emitCapturedSizes");
|
|
40
|
+
function captureNodeSizes(element, data4Layout) {
|
|
41
|
+
const nodes = [];
|
|
42
|
+
for (const node of data4Layout.nodes) {
|
|
43
|
+
if (node.isGroup) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
nodes.push({ id: node.id, width: node.width ?? 0, height: node.height ?? 0 });
|
|
47
|
+
}
|
|
48
|
+
if (nodes.length === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
emitCapturedSizes({
|
|
52
|
+
metadata: {
|
|
53
|
+
captureVersion: DDLT_SIZE_CAPTURE_VERSION,
|
|
54
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
55
|
+
capturedFrom: capturedFromLocation()
|
|
56
|
+
},
|
|
57
|
+
nodes
|
|
58
|
+
}, element);
|
|
59
|
+
}
|
|
60
|
+
__name(captureNodeSizes, "captureNodeSizes");
|
|
61
|
+
export {
|
|
62
|
+
captureNodeSizes,
|
|
63
|
+
shouldCaptureSizes
|
|
64
|
+
};
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StateDB,
|
|
3
|
+
stateDiagram_default,
|
|
4
|
+
styles_default
|
|
5
|
+
} from "./markdown-30b7rwmp.js";
|
|
6
|
+
import"./markdown-hjp6sj8t.js";
|
|
7
|
+
import"./markdown-gvyszqpv.js";
|
|
8
|
+
import"./markdown-6r4svars.js";
|
|
9
|
+
import"./markdown-h7pzv34e.js";
|
|
10
|
+
import {
|
|
11
|
+
layout
|
|
12
|
+
} from "./markdown-jka64qgp.js";
|
|
13
|
+
import {
|
|
14
|
+
Graph
|
|
15
|
+
} from "./markdown-2h6bwsms.js";
|
|
16
|
+
import"./markdown-s1jatrnk.js";
|
|
17
|
+
import"./markdown-m7frq8x8.js";
|
|
18
|
+
import"./markdown-tvdpppw8.js";
|
|
19
|
+
import"./markdown-sgfg5vvq.js";
|
|
20
|
+
import"./markdown-82xmzhzd.js";
|
|
21
|
+
import"./markdown-c9k0fvp1.js";
|
|
22
|
+
import"./markdown-qx3cngz2.js";
|
|
23
|
+
import"./markdown-yengsms5.js";
|
|
24
|
+
import {
|
|
25
|
+
utils_default
|
|
26
|
+
} from "./markdown-ff5wvb43.js";
|
|
27
|
+
import"./markdown-pzgd8z3s.js";
|
|
28
|
+
import {
|
|
29
|
+
common_default,
|
|
30
|
+
configureSvgSize,
|
|
31
|
+
getConfig2,
|
|
32
|
+
getUrl
|
|
33
|
+
} from "./markdown-92n37gd4.js";
|
|
34
|
+
import {
|
|
35
|
+
log,
|
|
36
|
+
select_default
|
|
37
|
+
} from "./markdown-xw8dsk8b.js";
|
|
38
|
+
import {
|
|
39
|
+
__name
|
|
40
|
+
} from "./markdown-1s5vwkf2.js";
|
|
41
|
+
import {
|
|
42
|
+
basis_default,
|
|
43
|
+
line_default
|
|
44
|
+
} from "./markdown-dy5sgjhc.js";
|
|
45
|
+
import"./markdown-809k7q41.js";
|
|
46
|
+
|
|
47
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.mjs
|
|
48
|
+
var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState");
|
|
49
|
+
var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
|
|
50
|
+
var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
|
|
51
|
+
const state = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 2 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
|
|
52
|
+
const classBox = state.node().getBBox();
|
|
53
|
+
g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", classBox.width + 2 * getConfig2().state.padding).attr("height", classBox.height + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
|
|
54
|
+
return state;
|
|
55
|
+
}, "drawSimpleState");
|
|
56
|
+
var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
|
|
57
|
+
const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
|
|
58
|
+
const tSpan = textEl.append("tspan").attr("x", 2 * getConfig2().state.padding).text(txt);
|
|
59
|
+
if (!isFirst2) {
|
|
60
|
+
tSpan.attr("dy", getConfig2().state.textHeight);
|
|
61
|
+
}
|
|
62
|
+
}, "addTspan");
|
|
63
|
+
const title = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 1.3 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
|
|
64
|
+
const titleBox = title.node().getBBox();
|
|
65
|
+
const titleHeight = titleBox.height;
|
|
66
|
+
const description = g.append("text").attr("x", getConfig2().state.padding).attr("y", titleHeight + getConfig2().state.padding * 0.4 + getConfig2().state.dividerMargin + getConfig2().state.textHeight).attr("class", "state-description");
|
|
67
|
+
let isFirst = true;
|
|
68
|
+
let isSecond = true;
|
|
69
|
+
stateDef.descriptions.forEach(function(descr) {
|
|
70
|
+
if (!isFirst) {
|
|
71
|
+
addTspan(description, descr, isSecond);
|
|
72
|
+
isSecond = false;
|
|
73
|
+
}
|
|
74
|
+
isFirst = false;
|
|
75
|
+
});
|
|
76
|
+
const descrLine = g.append("line").attr("x1", getConfig2().state.padding).attr("y1", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("y2", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("class", "descr-divider");
|
|
77
|
+
const descrBox = description.node().getBBox();
|
|
78
|
+
const width = Math.max(descrBox.width, titleBox.width);
|
|
79
|
+
descrLine.attr("x2", width + 3 * getConfig2().state.padding);
|
|
80
|
+
g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", width + 2 * getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
|
|
81
|
+
return g;
|
|
82
|
+
}, "drawDescrState");
|
|
83
|
+
var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
|
|
84
|
+
const pad = getConfig2().state.padding;
|
|
85
|
+
const dblPad = 2 * getConfig2().state.padding;
|
|
86
|
+
const orgBox = g.node().getBBox();
|
|
87
|
+
const orgWidth = orgBox.width;
|
|
88
|
+
const orgX = orgBox.x;
|
|
89
|
+
const title = g.append("text").attr("x", 0).attr("y", getConfig2().state.titleShift).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
|
|
90
|
+
const titleBox = title.node().getBBox();
|
|
91
|
+
const titleWidth = titleBox.width + dblPad;
|
|
92
|
+
let width = Math.max(titleWidth, orgWidth);
|
|
93
|
+
if (width === orgWidth) {
|
|
94
|
+
width = width + dblPad;
|
|
95
|
+
}
|
|
96
|
+
let startX;
|
|
97
|
+
const graphBox = g.node().getBBox();
|
|
98
|
+
if (stateDef.doc) {}
|
|
99
|
+
startX = orgX - pad;
|
|
100
|
+
if (titleWidth > orgWidth) {
|
|
101
|
+
startX = (orgWidth - width) / 2 + pad;
|
|
102
|
+
}
|
|
103
|
+
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
|
|
104
|
+
startX = orgX - (titleWidth - orgWidth) / 2;
|
|
105
|
+
}
|
|
106
|
+
const lineY = 1 - getConfig2().state.textHeight;
|
|
107
|
+
g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr("height", graphBox.height + getConfig2().state.textHeight + getConfig2().state.titleShift + 1).attr("rx", "0");
|
|
108
|
+
title.attr("x", startX + pad);
|
|
109
|
+
if (titleWidth <= orgWidth) {
|
|
110
|
+
title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
|
|
111
|
+
}
|
|
112
|
+
g.insert("rect", ":first-child").attr("x", startX).attr("y", getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding).attr("width", width).attr("height", getConfig2().state.textHeight * 3).attr("rx", getConfig2().state.radius);
|
|
113
|
+
g.insert("rect", ":first-child").attr("x", startX).attr("y", getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig2().state.textHeight).attr("rx", getConfig2().state.radius);
|
|
114
|
+
return g;
|
|
115
|
+
}, "addTitleAndBox");
|
|
116
|
+
var drawEndState = /* @__PURE__ */ __name((g) => {
|
|
117
|
+
g.append("circle").attr("class", "end-state-outer").attr("r", getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding);
|
|
118
|
+
return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + 2).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + 2);
|
|
119
|
+
}, "drawEndState");
|
|
120
|
+
var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
|
|
121
|
+
let width = getConfig2().state.forkWidth;
|
|
122
|
+
let height = getConfig2().state.forkHeight;
|
|
123
|
+
if (stateDef.parentId) {
|
|
124
|
+
let tmp = width;
|
|
125
|
+
width = height;
|
|
126
|
+
height = tmp;
|
|
127
|
+
}
|
|
128
|
+
return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding);
|
|
129
|
+
}, "drawForkJoinState");
|
|
130
|
+
var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
|
|
131
|
+
let textHeight = 0;
|
|
132
|
+
const textElem = g.append("text");
|
|
133
|
+
textElem.style("text-anchor", "start");
|
|
134
|
+
textElem.attr("class", "noteText");
|
|
135
|
+
let text = _text.replace(/\r\n/g, "<br/>");
|
|
136
|
+
text = text.replace(/\n/g, "<br/>");
|
|
137
|
+
const lines = text.split(common_default.lineBreakRegex);
|
|
138
|
+
let tHeight = 1.25 * getConfig2().state.noteMargin;
|
|
139
|
+
for (const line2 of lines) {
|
|
140
|
+
const txt = line2.trim();
|
|
141
|
+
if (txt.length > 0) {
|
|
142
|
+
const span = textElem.append("tspan");
|
|
143
|
+
span.text(txt);
|
|
144
|
+
if (tHeight === 0) {
|
|
145
|
+
const textBounds = span.node().getBBox();
|
|
146
|
+
tHeight += textBounds.height;
|
|
147
|
+
}
|
|
148
|
+
textHeight += tHeight;
|
|
149
|
+
span.attr("x", x + getConfig2().state.noteMargin);
|
|
150
|
+
span.attr("y", y + textHeight + 1.25 * getConfig2().state.noteMargin);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { textWidth: textElem.node().getBBox().width, textHeight };
|
|
154
|
+
}, "_drawLongText");
|
|
155
|
+
var drawNote = /* @__PURE__ */ __name((text, g) => {
|
|
156
|
+
g.attr("class", "state-note");
|
|
157
|
+
const note = g.append("rect").attr("x", 0).attr("y", getConfig2().state.padding);
|
|
158
|
+
const rectElem = g.append("g");
|
|
159
|
+
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
|
|
160
|
+
note.attr("height", textHeight + 2 * getConfig2().state.noteMargin);
|
|
161
|
+
note.attr("width", textWidth + getConfig2().state.noteMargin * 2);
|
|
162
|
+
return note;
|
|
163
|
+
}, "drawNote");
|
|
164
|
+
var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
|
|
165
|
+
const id = stateDef.id;
|
|
166
|
+
const stateInfo = {
|
|
167
|
+
id,
|
|
168
|
+
label: stateDef.id,
|
|
169
|
+
width: 0,
|
|
170
|
+
height: 0
|
|
171
|
+
};
|
|
172
|
+
const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
|
|
173
|
+
if (stateDef.type === "start") {
|
|
174
|
+
drawStartState(g);
|
|
175
|
+
}
|
|
176
|
+
if (stateDef.type === "end") {
|
|
177
|
+
drawEndState(g);
|
|
178
|
+
}
|
|
179
|
+
if (stateDef.type === "fork" || stateDef.type === "join") {
|
|
180
|
+
drawForkJoinState(g, stateDef);
|
|
181
|
+
}
|
|
182
|
+
if (stateDef.type === "note") {
|
|
183
|
+
drawNote(stateDef.note.text, g);
|
|
184
|
+
}
|
|
185
|
+
if (stateDef.type === "divider") {
|
|
186
|
+
drawDivider(g);
|
|
187
|
+
}
|
|
188
|
+
if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
|
|
189
|
+
drawSimpleState(g, stateDef);
|
|
190
|
+
}
|
|
191
|
+
if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
|
|
192
|
+
drawDescrState(g, stateDef);
|
|
193
|
+
}
|
|
194
|
+
const stateBox = g.node().getBBox();
|
|
195
|
+
stateInfo.width = stateBox.width + 2 * getConfig2().state.padding;
|
|
196
|
+
stateInfo.height = stateBox.height + 2 * getConfig2().state.padding;
|
|
197
|
+
return stateInfo;
|
|
198
|
+
}, "drawState");
|
|
199
|
+
var edgeCount = 0;
|
|
200
|
+
var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
|
|
201
|
+
const getRelationType = /* @__PURE__ */ __name(function(type) {
|
|
202
|
+
switch (type) {
|
|
203
|
+
case StateDB.relationType.AGGREGATION:
|
|
204
|
+
return "aggregation";
|
|
205
|
+
case StateDB.relationType.EXTENSION:
|
|
206
|
+
return "extension";
|
|
207
|
+
case StateDB.relationType.COMPOSITION:
|
|
208
|
+
return "composition";
|
|
209
|
+
case StateDB.relationType.DEPENDENCY:
|
|
210
|
+
return "dependency";
|
|
211
|
+
}
|
|
212
|
+
}, "getRelationType");
|
|
213
|
+
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
|
214
|
+
const lineData = path.points;
|
|
215
|
+
const lineFunction = line_default().x(function(d) {
|
|
216
|
+
return d.x;
|
|
217
|
+
}).y(function(d) {
|
|
218
|
+
return d.y;
|
|
219
|
+
}).curve(basis_default);
|
|
220
|
+
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
|
|
221
|
+
let url = "";
|
|
222
|
+
if (getConfig2().state.arrowMarkerAbsolute) {
|
|
223
|
+
url = getUrl(true);
|
|
224
|
+
}
|
|
225
|
+
svgPath.attr("marker-end", "url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)");
|
|
226
|
+
if (relation.title !== undefined) {
|
|
227
|
+
const label = elem.append("g").attr("class", "stateLabel");
|
|
228
|
+
const { x, y } = utils_default.calcLabelPosition(path.points);
|
|
229
|
+
const rows = common_default.getRows(relation.title);
|
|
230
|
+
let titleHeight = 0;
|
|
231
|
+
const titleRows = [];
|
|
232
|
+
let maxWidth = 0;
|
|
233
|
+
let minX = 0;
|
|
234
|
+
for (let i = 0;i <= rows.length; i++) {
|
|
235
|
+
const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
|
|
236
|
+
const boundsTmp = title.node().getBBox();
|
|
237
|
+
maxWidth = Math.max(maxWidth, boundsTmp.width);
|
|
238
|
+
minX = Math.min(minX, boundsTmp.x);
|
|
239
|
+
log.info(boundsTmp.x, x, y + titleHeight);
|
|
240
|
+
if (titleHeight === 0) {
|
|
241
|
+
const titleBox = title.node().getBBox();
|
|
242
|
+
titleHeight = titleBox.height;
|
|
243
|
+
log.info("Title height", titleHeight, y);
|
|
244
|
+
}
|
|
245
|
+
titleRows.push(title);
|
|
246
|
+
}
|
|
247
|
+
let boxHeight = titleHeight * rows.length;
|
|
248
|
+
if (rows.length > 1) {
|
|
249
|
+
const heightAdj = (rows.length - 1) * titleHeight * 0.5;
|
|
250
|
+
titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
|
|
251
|
+
boxHeight = titleHeight * rows.length;
|
|
252
|
+
}
|
|
253
|
+
const bounds = label.node().getBBox();
|
|
254
|
+
label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig2().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig2().state.padding).attr("height", boxHeight + getConfig2().state.padding);
|
|
255
|
+
log.info(bounds);
|
|
256
|
+
}
|
|
257
|
+
edgeCount++;
|
|
258
|
+
}, "drawEdge");
|
|
259
|
+
var conf;
|
|
260
|
+
var transformationLog = {};
|
|
261
|
+
var setConf = /* @__PURE__ */ __name(function() {}, "setConf");
|
|
262
|
+
var insertMarkers = /* @__PURE__ */ __name(function(elem) {
|
|
263
|
+
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
|
|
264
|
+
}, "insertMarkers");
|
|
265
|
+
var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
|
|
266
|
+
conf = getConfig2().state;
|
|
267
|
+
const securityLevel = getConfig2().securityLevel;
|
|
268
|
+
let sandboxElement;
|
|
269
|
+
if (securityLevel === "sandbox") {
|
|
270
|
+
sandboxElement = select_default("#i" + id);
|
|
271
|
+
}
|
|
272
|
+
const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
|
|
273
|
+
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
274
|
+
log.debug("Rendering diagram " + text);
|
|
275
|
+
const diagram2 = root.select(`[id='${id}']`);
|
|
276
|
+
insertMarkers(diagram2);
|
|
277
|
+
const rootDoc = diagObj.db.getRootDoc();
|
|
278
|
+
const rootG = diagram2.append("g").attr("id", id + "-root");
|
|
279
|
+
renderDoc(rootDoc, rootG, undefined, false, root, doc, diagObj);
|
|
280
|
+
const padding = conf.padding;
|
|
281
|
+
const bounds = diagram2.node().getBBox();
|
|
282
|
+
const width = bounds.width + padding * 2;
|
|
283
|
+
const height = bounds.height + padding * 2;
|
|
284
|
+
const svgWidth = width * 1.75;
|
|
285
|
+
configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
|
|
286
|
+
diagram2.attr("viewBox", `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height);
|
|
287
|
+
}, "draw");
|
|
288
|
+
var getLabelWidth = /* @__PURE__ */ __name((text) => {
|
|
289
|
+
return text ? text.length * conf.fontSizeFactor : 1;
|
|
290
|
+
}, "getLabelWidth");
|
|
291
|
+
var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
|
|
292
|
+
const graph = new Graph({
|
|
293
|
+
compound: true,
|
|
294
|
+
multigraph: true
|
|
295
|
+
});
|
|
296
|
+
let i;
|
|
297
|
+
let edgeFreeDoc = true;
|
|
298
|
+
for (i = 0;i < doc.length; i++) {
|
|
299
|
+
if (doc[i].stmt === "relation") {
|
|
300
|
+
edgeFreeDoc = false;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (parentId) {
|
|
305
|
+
graph.setGraph({
|
|
306
|
+
rankdir: "LR",
|
|
307
|
+
multigraph: true,
|
|
308
|
+
compound: true,
|
|
309
|
+
ranker: "tight-tree",
|
|
310
|
+
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
|
311
|
+
nodeSep: edgeFreeDoc ? 1 : 50,
|
|
312
|
+
isMultiGraph: true
|
|
313
|
+
});
|
|
314
|
+
} else {
|
|
315
|
+
graph.setGraph({
|
|
316
|
+
rankdir: "TB",
|
|
317
|
+
multigraph: true,
|
|
318
|
+
compound: true,
|
|
319
|
+
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
|
320
|
+
nodeSep: edgeFreeDoc ? 1 : 50,
|
|
321
|
+
ranker: "tight-tree",
|
|
322
|
+
isMultiGraph: true
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
graph.setDefaultEdgeLabel(function() {
|
|
326
|
+
return {};
|
|
327
|
+
});
|
|
328
|
+
const states = diagObj.db.getStates();
|
|
329
|
+
const relations = diagObj.db.getRelations();
|
|
330
|
+
const keys = Object.keys(states);
|
|
331
|
+
let first = true;
|
|
332
|
+
for (const key of keys) {
|
|
333
|
+
const stateDef = states[key];
|
|
334
|
+
if (parentId) {
|
|
335
|
+
stateDef.parentId = parentId;
|
|
336
|
+
}
|
|
337
|
+
let node;
|
|
338
|
+
if (stateDef.doc) {
|
|
339
|
+
let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
|
|
340
|
+
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
|
|
341
|
+
if (first) {
|
|
342
|
+
sub = addTitleAndBox(sub, stateDef, altBkg);
|
|
343
|
+
let boxBounds = sub.node().getBBox();
|
|
344
|
+
node.width = boxBounds.width;
|
|
345
|
+
node.height = boxBounds.height + conf.padding / 2;
|
|
346
|
+
transformationLog[stateDef.id] = { y: conf.compositTitleSize };
|
|
347
|
+
} else {
|
|
348
|
+
let boxBounds = sub.node().getBBox();
|
|
349
|
+
node.width = boxBounds.width;
|
|
350
|
+
node.height = boxBounds.height;
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
node = drawState(diagram2, stateDef, graph);
|
|
354
|
+
}
|
|
355
|
+
if (stateDef.note) {
|
|
356
|
+
const noteDef = {
|
|
357
|
+
descriptions: [],
|
|
358
|
+
id: stateDef.id + "-note",
|
|
359
|
+
note: stateDef.note,
|
|
360
|
+
type: "note"
|
|
361
|
+
};
|
|
362
|
+
const note = drawState(diagram2, noteDef, graph);
|
|
363
|
+
if (stateDef.note.position === "left of") {
|
|
364
|
+
graph.setNode(node.id + "-note", note);
|
|
365
|
+
graph.setNode(node.id, node);
|
|
366
|
+
} else {
|
|
367
|
+
graph.setNode(node.id, node);
|
|
368
|
+
graph.setNode(node.id + "-note", note);
|
|
369
|
+
}
|
|
370
|
+
graph.setParent(node.id, node.id + "-group");
|
|
371
|
+
graph.setParent(node.id + "-note", node.id + "-group");
|
|
372
|
+
} else {
|
|
373
|
+
graph.setNode(node.id, node);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
log.debug("Count=", graph.nodeCount(), graph);
|
|
377
|
+
let cnt = 0;
|
|
378
|
+
relations.forEach(function(relation) {
|
|
379
|
+
cnt++;
|
|
380
|
+
log.debug("Setting edge", relation);
|
|
381
|
+
graph.setEdge(relation.id1, relation.id2, {
|
|
382
|
+
relation,
|
|
383
|
+
width: getLabelWidth(relation.title),
|
|
384
|
+
height: conf.labelHeight * common_default.getRows(relation.title).length,
|
|
385
|
+
labelpos: "c"
|
|
386
|
+
}, "id" + cnt);
|
|
387
|
+
});
|
|
388
|
+
layout(graph);
|
|
389
|
+
log.debug("Graph after layout", graph.nodes());
|
|
390
|
+
const svgElem = diagram2.node();
|
|
391
|
+
graph.nodes().forEach(function(v) {
|
|
392
|
+
if (v !== undefined && graph.node(v) !== undefined) {
|
|
393
|
+
log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
|
|
394
|
+
root.select("#" + svgElem.id + " #" + v).attr("transform", "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )");
|
|
395
|
+
root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
|
|
396
|
+
const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
|
|
397
|
+
dividers.forEach((divider) => {
|
|
398
|
+
const parent = divider.parentElement;
|
|
399
|
+
let pWidth = 0;
|
|
400
|
+
let pShift = 0;
|
|
401
|
+
if (parent) {
|
|
402
|
+
if (parent.parentElement) {
|
|
403
|
+
pWidth = parent.parentElement.getBBox().width;
|
|
404
|
+
}
|
|
405
|
+
pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
|
|
406
|
+
if (Number.isNaN(pShift)) {
|
|
407
|
+
pShift = 0;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
divider.setAttribute("x1", 0 - pShift + 8);
|
|
411
|
+
divider.setAttribute("x2", pWidth - pShift - 8);
|
|
412
|
+
});
|
|
413
|
+
} else {
|
|
414
|
+
log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
let stateBox = svgElem.getBBox();
|
|
418
|
+
graph.edges().forEach(function(e) {
|
|
419
|
+
if (e !== undefined && graph.edge(e) !== undefined) {
|
|
420
|
+
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
|
|
421
|
+
drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
stateBox = svgElem.getBBox();
|
|
425
|
+
const stateInfo = {
|
|
426
|
+
id: parentId ? parentId : "root",
|
|
427
|
+
label: parentId ? parentId : "root",
|
|
428
|
+
width: 0,
|
|
429
|
+
height: 0
|
|
430
|
+
};
|
|
431
|
+
stateInfo.width = stateBox.width + 2 * conf.padding;
|
|
432
|
+
stateInfo.height = stateBox.height + 2 * conf.padding;
|
|
433
|
+
log.debug("Doc rendered", stateInfo, graph);
|
|
434
|
+
return stateInfo;
|
|
435
|
+
}, "renderDoc");
|
|
436
|
+
var stateRenderer_default = {
|
|
437
|
+
setConf,
|
|
438
|
+
draw
|
|
439
|
+
};
|
|
440
|
+
var diagram = {
|
|
441
|
+
parser: stateDiagram_default,
|
|
442
|
+
get db() {
|
|
443
|
+
return new StateDB(1);
|
|
444
|
+
},
|
|
445
|
+
renderer: stateRenderer_default,
|
|
446
|
+
styles: styles_default,
|
|
447
|
+
init: /* @__PURE__ */ __name((cnf) => {
|
|
448
|
+
if (!cnf.state) {
|
|
449
|
+
cnf.state = {};
|
|
450
|
+
}
|
|
451
|
+
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
452
|
+
}, "init")
|
|
453
|
+
};
|
|
454
|
+
export {
|
|
455
|
+
diagram
|
|
456
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StateDB,
|
|
3
|
+
stateDiagram_default,
|
|
4
|
+
stateRenderer_v3_unified_default,
|
|
5
|
+
styles_default
|
|
6
|
+
} from "./markdown-30b7rwmp.js";
|
|
7
|
+
import"./markdown-hjp6sj8t.js";
|
|
8
|
+
import"./markdown-gvyszqpv.js";
|
|
9
|
+
import"./markdown-6r4svars.js";
|
|
10
|
+
import"./markdown-h7pzv34e.js";
|
|
11
|
+
import"./markdown-s1jatrnk.js";
|
|
12
|
+
import"./markdown-m7frq8x8.js";
|
|
13
|
+
import"./markdown-tvdpppw8.js";
|
|
14
|
+
import"./markdown-sgfg5vvq.js";
|
|
15
|
+
import"./markdown-82xmzhzd.js";
|
|
16
|
+
import"./markdown-c9k0fvp1.js";
|
|
17
|
+
import"./markdown-qx3cngz2.js";
|
|
18
|
+
import"./markdown-yengsms5.js";
|
|
19
|
+
import"./markdown-ff5wvb43.js";
|
|
20
|
+
import"./markdown-pzgd8z3s.js";
|
|
21
|
+
import"./markdown-92n37gd4.js";
|
|
22
|
+
import"./markdown-xw8dsk8b.js";
|
|
23
|
+
import {
|
|
24
|
+
__name
|
|
25
|
+
} from "./markdown-1s5vwkf2.js";
|
|
26
|
+
import"./markdown-dy5sgjhc.js";
|
|
27
|
+
import"./markdown-809k7q41.js";
|
|
28
|
+
|
|
29
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.mjs
|
|
30
|
+
var diagram = {
|
|
31
|
+
parser: stateDiagram_default,
|
|
32
|
+
get db() {
|
|
33
|
+
return new StateDB(2);
|
|
34
|
+
},
|
|
35
|
+
renderer: stateRenderer_v3_unified_default,
|
|
36
|
+
styles: styles_default,
|
|
37
|
+
init: /* @__PURE__ */ __name((cnf) => {
|
|
38
|
+
if (!cnf.state) {
|
|
39
|
+
cnf.state = {};
|
|
40
|
+
}
|
|
41
|
+
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
42
|
+
}, "init")
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
diagram
|
|
46
|
+
};
|