@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,673 @@
|
|
|
1
|
+
import {
|
|
2
|
+
populateCommonDb
|
|
3
|
+
} from "./markdown-b4s7ntq2.js";
|
|
4
|
+
import {
|
|
5
|
+
parse
|
|
6
|
+
} from "./markdown-ceefymn8.js";
|
|
7
|
+
import"./markdown-gx1p0ew0.js";
|
|
8
|
+
import"./markdown-pxfeh231.js";
|
|
9
|
+
import"./markdown-y18mve73.js";
|
|
10
|
+
import"./markdown-2x113yh8.js";
|
|
11
|
+
import"./markdown-56enrf2r.js";
|
|
12
|
+
import"./markdown-ag2sssf8.js";
|
|
13
|
+
import"./markdown-tnmabqvz.js";
|
|
14
|
+
import"./markdown-hab789t9.js";
|
|
15
|
+
import"./markdown-gxye5frz.js";
|
|
16
|
+
import"./markdown-k8xkn8mw.js";
|
|
17
|
+
import"./markdown-p740v4qm.js";
|
|
18
|
+
import"./markdown-ffg06nfz.js";
|
|
19
|
+
import"./markdown-w6sgd54z.js";
|
|
20
|
+
import"./markdown-rawhfvvc.js";
|
|
21
|
+
import"./markdown-v14td68x.js";
|
|
22
|
+
import {
|
|
23
|
+
isEmResetFrame
|
|
24
|
+
} from "./markdown-dz3z5w30.js";
|
|
25
|
+
import {
|
|
26
|
+
calculateTextDimensions,
|
|
27
|
+
cleanAndMerge,
|
|
28
|
+
wrapLabel
|
|
29
|
+
} from "./markdown-ff5wvb43.js";
|
|
30
|
+
import"./markdown-pzgd8z3s.js";
|
|
31
|
+
import {
|
|
32
|
+
clear,
|
|
33
|
+
defaultConfig_default,
|
|
34
|
+
getAccDescription,
|
|
35
|
+
getAccTitle,
|
|
36
|
+
getConfig,
|
|
37
|
+
getConfig2,
|
|
38
|
+
getDiagramTitle,
|
|
39
|
+
sanitizeText,
|
|
40
|
+
setAccDescription,
|
|
41
|
+
setAccTitle,
|
|
42
|
+
setDiagramTitle,
|
|
43
|
+
setupGraphViewbox2
|
|
44
|
+
} from "./markdown-92n37gd4.js";
|
|
45
|
+
import {
|
|
46
|
+
log,
|
|
47
|
+
select_default
|
|
48
|
+
} from "./markdown-xw8dsk8b.js";
|
|
49
|
+
import {
|
|
50
|
+
__name
|
|
51
|
+
} from "./markdown-1s5vwkf2.js";
|
|
52
|
+
import"./markdown-dy5sgjhc.js";
|
|
53
|
+
import"./markdown-809k7q41.js";
|
|
54
|
+
|
|
55
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/diagram-B4RE2ZJO.mjs
|
|
56
|
+
var PositionFrameKind = "position frame";
|
|
57
|
+
var FramePositionedKind = "frame positioned";
|
|
58
|
+
var PositionRelationKind = "position relation";
|
|
59
|
+
var RelationPositionedKind = "relation positioned";
|
|
60
|
+
var setOptions = /* @__PURE__ */ __name(function(_rawOptString) {
|
|
61
|
+
log.debug("options str", _rawOptString);
|
|
62
|
+
}, "setOptions");
|
|
63
|
+
var getOptions = /* @__PURE__ */ __name(function() {
|
|
64
|
+
return {};
|
|
65
|
+
}, "getOptions");
|
|
66
|
+
var clear2 = /* @__PURE__ */ __name(function() {
|
|
67
|
+
reset();
|
|
68
|
+
clear();
|
|
69
|
+
}, "clear");
|
|
70
|
+
function reset() {
|
|
71
|
+
store = {};
|
|
72
|
+
}
|
|
73
|
+
__name(reset, "reset");
|
|
74
|
+
var DEFAULT_EVENTMODELING_CONFIG = defaultConfig_default.eventmodeling;
|
|
75
|
+
var getConfig3 = /* @__PURE__ */ __name(() => {
|
|
76
|
+
const config = cleanAndMerge({
|
|
77
|
+
...DEFAULT_EVENTMODELING_CONFIG,
|
|
78
|
+
...getConfig().eventmodeling
|
|
79
|
+
});
|
|
80
|
+
return config;
|
|
81
|
+
}, "getConfig");
|
|
82
|
+
var store = {};
|
|
83
|
+
function getState() {
|
|
84
|
+
let state = initial;
|
|
85
|
+
const { ast } = store;
|
|
86
|
+
const diagramProps2 = getDiagramProps();
|
|
87
|
+
if (!ast) {
|
|
88
|
+
throw new Error("No data for EventModel");
|
|
89
|
+
}
|
|
90
|
+
ast.frames.forEach((frame, index) => {
|
|
91
|
+
const textProps = calculateTextProps(frame, ast.dataEntities, diagramProps2);
|
|
92
|
+
state = dispatch(state, {
|
|
93
|
+
$kind: PositionFrameKind,
|
|
94
|
+
index,
|
|
95
|
+
frame,
|
|
96
|
+
textProps
|
|
97
|
+
});
|
|
98
|
+
let sourceFrames = undefined;
|
|
99
|
+
if (hasSourceFrame(frame)) {
|
|
100
|
+
log.debug(`source frame`, frame.sourceFrames);
|
|
101
|
+
sourceFrames = ast.frames.filter((currentFrame) => {
|
|
102
|
+
return frame.sourceFrames.some((sf) => sf.$refText === currentFrame.name);
|
|
103
|
+
});
|
|
104
|
+
sourceFrames.forEach((sourceFrame) => {
|
|
105
|
+
state = dispatch(state, {
|
|
106
|
+
$kind: PositionRelationKind,
|
|
107
|
+
index,
|
|
108
|
+
frame,
|
|
109
|
+
sourceFrame
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
state = dispatch(state, {
|
|
114
|
+
$kind: PositionRelationKind,
|
|
115
|
+
index,
|
|
116
|
+
frame
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
state = {
|
|
121
|
+
...state,
|
|
122
|
+
sortedSwimlanesArray: sortedSwimlanesArray(state.swimlanes)
|
|
123
|
+
};
|
|
124
|
+
return state;
|
|
125
|
+
}
|
|
126
|
+
__name(getState, "getState");
|
|
127
|
+
function setAst(ast) {
|
|
128
|
+
store.ast = ast;
|
|
129
|
+
}
|
|
130
|
+
__name(setAst, "setAst");
|
|
131
|
+
var diagramProps = {
|
|
132
|
+
swimlaneMinHeight: 70,
|
|
133
|
+
swimlanePadding: 15,
|
|
134
|
+
swimlaneGap: 10,
|
|
135
|
+
boxPadding: 10,
|
|
136
|
+
boxOverlap: 90,
|
|
137
|
+
boxDefaultY: 0,
|
|
138
|
+
boxMinWidth: 80,
|
|
139
|
+
boxMaxWidth: 450,
|
|
140
|
+
boxMinHeight: 80,
|
|
141
|
+
boxMaxHeight: 750,
|
|
142
|
+
contentStartX: 250,
|
|
143
|
+
textMaxWidth: 450 - 2 * 10,
|
|
144
|
+
boxTextFontWeight: "bold",
|
|
145
|
+
boxTextPadding: 10,
|
|
146
|
+
swimlaneTextFontWeight: "bold",
|
|
147
|
+
labelUiAutomation: "UI/Automation",
|
|
148
|
+
labelUiAutomationPrefix: "UI/A: ",
|
|
149
|
+
labelCommandReadModel: "Command/Read Model",
|
|
150
|
+
labelCommandReadModelPrefix: "C/RM: ",
|
|
151
|
+
labelEvents: "Events",
|
|
152
|
+
labelEventsPrefix: "Stream: "
|
|
153
|
+
};
|
|
154
|
+
function getDiagramProps() {
|
|
155
|
+
return diagramProps;
|
|
156
|
+
}
|
|
157
|
+
__name(getDiagramProps, "getDiagramProps");
|
|
158
|
+
var initial = {
|
|
159
|
+
boxes: [],
|
|
160
|
+
swimlanes: {},
|
|
161
|
+
relations: [],
|
|
162
|
+
maxR: 0,
|
|
163
|
+
sortedSwimlanesArray: []
|
|
164
|
+
};
|
|
165
|
+
function extractNamespace(entityIdentifier) {
|
|
166
|
+
const spl = entityIdentifier.split(".");
|
|
167
|
+
if (spl.length === 2) {
|
|
168
|
+
return spl[0];
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
__name(extractNamespace, "extractNamespace");
|
|
173
|
+
function extractName(entityIdentifier) {
|
|
174
|
+
const spl = entityIdentifier.split(".");
|
|
175
|
+
if (spl.length === 2) {
|
|
176
|
+
return spl[1];
|
|
177
|
+
}
|
|
178
|
+
return entityIdentifier;
|
|
179
|
+
}
|
|
180
|
+
__name(extractName, "extractName");
|
|
181
|
+
function findSwimlaneByNamespace(swimlanes, namespace) {
|
|
182
|
+
if (!namespace || namespace.length === 0) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
return Object.values(swimlanes).find((swimlane) => swimlane.namespace === namespace);
|
|
186
|
+
}
|
|
187
|
+
__name(findSwimlaneByNamespace, "findSwimlaneByNamespace");
|
|
188
|
+
function findNextAvailableIndex(swimlanes, boundaryMin, boundaryMax) {
|
|
189
|
+
return Math.max(boundaryMin, ...Object.keys(swimlanes).filter((key) => {
|
|
190
|
+
const index = Number.parseInt(key);
|
|
191
|
+
return index > boundaryMin && index < boundaryMax;
|
|
192
|
+
}).map((key) => Number.parseInt(key))) + 1;
|
|
193
|
+
}
|
|
194
|
+
__name(findNextAvailableIndex, "findNextAvailableIndex");
|
|
195
|
+
function calculateSwimlaneProps(frame, swimlanes) {
|
|
196
|
+
const namespace = extractNamespace(frame.entityIdentifier);
|
|
197
|
+
const sw = findSwimlaneByNamespace(swimlanes, namespace);
|
|
198
|
+
switch (frame.modelEntityType) {
|
|
199
|
+
case "ui":
|
|
200
|
+
case "pcr":
|
|
201
|
+
case "processor":
|
|
202
|
+
if (sw) {
|
|
203
|
+
return {
|
|
204
|
+
index: sw.index,
|
|
205
|
+
label: sw.namespace || diagramProps.labelUiAutomation
|
|
206
|
+
};
|
|
207
|
+
} else if (namespace) {
|
|
208
|
+
return {
|
|
209
|
+
index: findNextAvailableIndex(swimlanes, 0, 100),
|
|
210
|
+
label: diagramProps.labelUiAutomationPrefix + namespace
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return { index: 0, label: diagramProps.labelUiAutomation };
|
|
214
|
+
case "rmo":
|
|
215
|
+
case "readmodel":
|
|
216
|
+
case "cmd":
|
|
217
|
+
case "command":
|
|
218
|
+
if (sw) {
|
|
219
|
+
return {
|
|
220
|
+
index: sw.index,
|
|
221
|
+
label: sw.namespace || diagramProps.labelCommandReadModel
|
|
222
|
+
};
|
|
223
|
+
} else if (namespace) {
|
|
224
|
+
return {
|
|
225
|
+
index: findNextAvailableIndex(swimlanes, 100, 200),
|
|
226
|
+
label: diagramProps.labelCommandReadModelPrefix + namespace
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return { index: 100, label: diagramProps.labelCommandReadModel };
|
|
230
|
+
case "evt":
|
|
231
|
+
case "event":
|
|
232
|
+
default:
|
|
233
|
+
if (sw) {
|
|
234
|
+
return {
|
|
235
|
+
index: sw.index,
|
|
236
|
+
label: sw.namespace || diagramProps.labelEvents
|
|
237
|
+
};
|
|
238
|
+
} else if (namespace) {
|
|
239
|
+
return {
|
|
240
|
+
index: findNextAvailableIndex(swimlanes, 200, 300),
|
|
241
|
+
label: diagramProps.labelEventsPrefix + namespace
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return { index: 200, label: diagramProps.labelEvents };
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
__name(calculateSwimlaneProps, "calculateSwimlaneProps");
|
|
248
|
+
function calculateEntityVisualProps(frame) {
|
|
249
|
+
const { themeVariables } = getConfig();
|
|
250
|
+
switch (frame.modelEntityType) {
|
|
251
|
+
case "ui":
|
|
252
|
+
return {
|
|
253
|
+
fill: themeVariables.emUiFill ?? "white",
|
|
254
|
+
stroke: themeVariables.emUiStroke ?? "#dbdada"
|
|
255
|
+
};
|
|
256
|
+
case "pcr":
|
|
257
|
+
case "processor":
|
|
258
|
+
return {
|
|
259
|
+
fill: themeVariables.emProcessorFill ?? "#edb3f6",
|
|
260
|
+
stroke: themeVariables.emProcessorStroke ?? "#b88cbf"
|
|
261
|
+
};
|
|
262
|
+
case "rmo":
|
|
263
|
+
case "readmodel":
|
|
264
|
+
return {
|
|
265
|
+
fill: themeVariables.emReadModelFill ?? "#d3f1a2",
|
|
266
|
+
stroke: themeVariables.emReadModelStroke ?? "#a3b732"
|
|
267
|
+
};
|
|
268
|
+
case "cmd":
|
|
269
|
+
case "command":
|
|
270
|
+
return {
|
|
271
|
+
fill: themeVariables.emCommandFill ?? "#bcd6fe",
|
|
272
|
+
stroke: themeVariables.emCommandStroke ?? "#679ac3"
|
|
273
|
+
};
|
|
274
|
+
case "evt":
|
|
275
|
+
case "event":
|
|
276
|
+
return {
|
|
277
|
+
fill: themeVariables.emEventFill ?? "#ffb778",
|
|
278
|
+
stroke: themeVariables.emEventStroke ?? "#c19a0f"
|
|
279
|
+
};
|
|
280
|
+
default:
|
|
281
|
+
return {
|
|
282
|
+
fill: "red",
|
|
283
|
+
stroke: "black"
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
__name(calculateEntityVisualProps, "calculateEntityVisualProps");
|
|
288
|
+
function calculateTextProps(frame, dataEntities, diagramProps2) {
|
|
289
|
+
const config = getConfig();
|
|
290
|
+
const name = sanitizeText(extractName(frame.entityIdentifier) ?? "", config);
|
|
291
|
+
let toHtml;
|
|
292
|
+
const wrapLabelConfig = {
|
|
293
|
+
fontSize: 16,
|
|
294
|
+
fontWeight: 700,
|
|
295
|
+
fontFamily: '"trebuchet ms", verdana, arial, sans-serif',
|
|
296
|
+
joinWith: "<br/>"
|
|
297
|
+
};
|
|
298
|
+
const wrappedName = wrapLabel(name, diagramProps2.textMaxWidth, wrapLabelConfig);
|
|
299
|
+
let content = `<b>${wrappedName}</b>`;
|
|
300
|
+
if (frame.dataInlineValue) {
|
|
301
|
+
toHtml = frame.dataInlineValue;
|
|
302
|
+
toHtml = toHtml.substring(toHtml.indexOf("{") + 1);
|
|
303
|
+
toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
|
|
304
|
+
toHtml = sanitizeText(toHtml, config);
|
|
305
|
+
toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
|
|
306
|
+
toHtml = toHtml.replaceAll(" ", " ");
|
|
307
|
+
}
|
|
308
|
+
if (frame.dataReference) {
|
|
309
|
+
const dataEntity = dataEntities.find((dataEntity2) => dataEntity2.name === frame.dataReference?.$refText);
|
|
310
|
+
if (dataEntity) {
|
|
311
|
+
toHtml = dataEntity.dataBlockValue;
|
|
312
|
+
toHtml = toHtml.substring(toHtml.indexOf(`{
|
|
313
|
+
`) + 2);
|
|
314
|
+
toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1);
|
|
315
|
+
toHtml = sanitizeText(toHtml, config);
|
|
316
|
+
toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig);
|
|
317
|
+
toHtml = toHtml.replaceAll(" ", " ");
|
|
318
|
+
toHtml += `<br/>`;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const hasRenderedData = toHtml !== undefined;
|
|
322
|
+
if (hasRenderedData) {
|
|
323
|
+
content += `<br/><br/><code style="text-align: left; display: block;max-width:${diagramProps2.textMaxWidth}px">${toHtml}</code>`;
|
|
324
|
+
}
|
|
325
|
+
const textDimensionConfig = {
|
|
326
|
+
fontSize: wrapLabelConfig.fontSize,
|
|
327
|
+
fontWeight: wrapLabelConfig.fontWeight,
|
|
328
|
+
fontFamily: wrapLabelConfig.fontFamily
|
|
329
|
+
};
|
|
330
|
+
const dimensions = calculateTextDimensions(content, textDimensionConfig);
|
|
331
|
+
const calculatedWidthFix = hasRenderedData ? dimensions.width / 3 : dimensions.width;
|
|
332
|
+
const props = {
|
|
333
|
+
content,
|
|
334
|
+
width: calculatedWidthFix,
|
|
335
|
+
height: dimensions.height
|
|
336
|
+
};
|
|
337
|
+
log.debug(`[${frame.name}] ${frame.entityIdentifier} text`, props);
|
|
338
|
+
return props;
|
|
339
|
+
}
|
|
340
|
+
__name(calculateTextProps, "calculateTextProps");
|
|
341
|
+
function decidePositionFrame(state, _command) {
|
|
342
|
+
const command = _command;
|
|
343
|
+
const visual = calculateEntityVisualProps(command.frame);
|
|
344
|
+
const dimension = {
|
|
345
|
+
width: command.textProps.width + 2 * diagramProps.boxTextPadding,
|
|
346
|
+
height: command.textProps.height + 2 * diagramProps.boxTextPadding
|
|
347
|
+
};
|
|
348
|
+
const event = {
|
|
349
|
+
$kind: FramePositionedKind,
|
|
350
|
+
frame: command.frame,
|
|
351
|
+
index: command.index,
|
|
352
|
+
visual,
|
|
353
|
+
dimension,
|
|
354
|
+
textProps: command.textProps
|
|
355
|
+
};
|
|
356
|
+
return [event];
|
|
357
|
+
}
|
|
358
|
+
__name(decidePositionFrame, "decidePositionFrame");
|
|
359
|
+
function calculateX(swimlane, previousSwimlane, lastBox) {
|
|
360
|
+
if (previousSwimlane === undefined) {
|
|
361
|
+
return diagramProps.contentStartX;
|
|
362
|
+
}
|
|
363
|
+
if (previousSwimlane.index === swimlane.index && swimlane.r) {
|
|
364
|
+
return swimlane.r + diagramProps.boxPadding;
|
|
365
|
+
}
|
|
366
|
+
if (lastBox === undefined) {
|
|
367
|
+
return diagramProps.contentStartX;
|
|
368
|
+
}
|
|
369
|
+
return lastBox.r - diagramProps.boxOverlap + diagramProps.boxPadding;
|
|
370
|
+
}
|
|
371
|
+
__name(calculateX, "calculateX");
|
|
372
|
+
function calculateMaxRight(swimlanes, swimlaneR) {
|
|
373
|
+
const rs = [...swimlanes.map((s) => s.r), swimlaneR];
|
|
374
|
+
return Math.max(...rs);
|
|
375
|
+
}
|
|
376
|
+
__name(calculateMaxRight, "calculateMaxRight");
|
|
377
|
+
function sortedSwimlanesArray(swimlanes) {
|
|
378
|
+
return Object.values(swimlanes).sort((a, b) => a.index - b.index);
|
|
379
|
+
}
|
|
380
|
+
__name(sortedSwimlanesArray, "sortedSwimlanesArray");
|
|
381
|
+
function evolveFramePositioned(state, _event) {
|
|
382
|
+
const event = _event;
|
|
383
|
+
const swimlaneProps = calculateSwimlaneProps(event.frame, state.swimlanes);
|
|
384
|
+
let swimlane;
|
|
385
|
+
if (swimlaneProps.index in state.swimlanes) {
|
|
386
|
+
swimlane = state.swimlanes[swimlaneProps.index];
|
|
387
|
+
} else {
|
|
388
|
+
swimlane = {
|
|
389
|
+
index: swimlaneProps.index,
|
|
390
|
+
label: swimlaneProps.label,
|
|
391
|
+
r: 0,
|
|
392
|
+
y: swimlaneProps.index * diagramProps.swimlaneMinHeight + diagramProps.swimlaneGap,
|
|
393
|
+
height: diagramProps.swimlaneMinHeight,
|
|
394
|
+
maxHeight: diagramProps.swimlaneMinHeight
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
const lastBox = state.boxes.length > 0 ? state.boxes[state.boxes.length - 1] : undefined;
|
|
398
|
+
const previousSwimlane = state.previousSwimlaneNumber !== undefined ? state.swimlanes[state.previousSwimlaneNumber] : undefined;
|
|
399
|
+
const dimension = {
|
|
400
|
+
width: Math.max(diagramProps.boxMinWidth, Math.min(diagramProps.boxMaxWidth, event.dimension.width)) + 2 * diagramProps.boxPadding,
|
|
401
|
+
height: Math.max(diagramProps.boxMinHeight, Math.min(diagramProps.boxMaxHeight, event.dimension.height)) + 2 * diagramProps.boxPadding
|
|
402
|
+
};
|
|
403
|
+
const x = calculateX(swimlane, previousSwimlane, lastBox);
|
|
404
|
+
const r = x + dimension.width + diagramProps.boxPadding;
|
|
405
|
+
const maxR = calculateMaxRight(Object.values(state.swimlanes), r);
|
|
406
|
+
swimlane.r = x + dimension.width;
|
|
407
|
+
swimlane.maxHeight = Math.max(swimlane.maxHeight, dimension.height);
|
|
408
|
+
swimlane.height = Math.max(diagramProps.swimlaneMinHeight, swimlane.maxHeight) + 2 * diagramProps.swimlanePadding;
|
|
409
|
+
const box = {
|
|
410
|
+
x,
|
|
411
|
+
y: diagramProps.swimlanePadding + swimlane.y,
|
|
412
|
+
r,
|
|
413
|
+
dimension,
|
|
414
|
+
leftSibling: false,
|
|
415
|
+
swimlane,
|
|
416
|
+
visual: event.visual,
|
|
417
|
+
text: event.textProps.content,
|
|
418
|
+
frame: event.frame,
|
|
419
|
+
index: event.index
|
|
420
|
+
};
|
|
421
|
+
const newState = {
|
|
422
|
+
...state,
|
|
423
|
+
boxes: [...state.boxes, box],
|
|
424
|
+
swimlanes: {
|
|
425
|
+
...state.swimlanes,
|
|
426
|
+
[`${swimlane.index}`]: swimlane
|
|
427
|
+
},
|
|
428
|
+
previousSwimlaneNumber: swimlaneProps.index,
|
|
429
|
+
previousFrame: event.frame,
|
|
430
|
+
maxR
|
|
431
|
+
};
|
|
432
|
+
const swimlanes = sortedSwimlanesArray(newState.swimlanes);
|
|
433
|
+
if (swimlanes.length > 0) {
|
|
434
|
+
swimlanes[0].y = 0;
|
|
435
|
+
}
|
|
436
|
+
for (let i = 1;i < swimlanes.length; i++) {
|
|
437
|
+
const sw = swimlanes[i];
|
|
438
|
+
const prevSw = swimlanes[i - 1];
|
|
439
|
+
sw.y = prevSw.y + prevSw.height + diagramProps.swimlaneGap;
|
|
440
|
+
}
|
|
441
|
+
return newState;
|
|
442
|
+
}
|
|
443
|
+
__name(evolveFramePositioned, "evolveFramePositioned");
|
|
444
|
+
function isFirstFrame(index, frame) {
|
|
445
|
+
if (index === 0 && frame.sourceFrames.length === 0) {
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
__name(isFirstFrame, "isFirstFrame");
|
|
451
|
+
function hasSourceFrame(frame) {
|
|
452
|
+
return frame.sourceFrames !== undefined && frame.sourceFrames !== null && frame.sourceFrames.length > 0;
|
|
453
|
+
}
|
|
454
|
+
__name(hasSourceFrame, "hasSourceFrame");
|
|
455
|
+
function findBoxByFrame(boxes, frame) {
|
|
456
|
+
if (frame === undefined || frame === null) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
return boxes.find((box) => box.frame.name === frame.name);
|
|
460
|
+
}
|
|
461
|
+
__name(findBoxByFrame, "findBoxByFrame");
|
|
462
|
+
function findBoxByLineIndex(boxes, targetSwimlane, lineIndex) {
|
|
463
|
+
if (lineIndex < 0) {
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
for (let i = lineIndex;i >= 0; i--) {
|
|
467
|
+
const box = boxes[i];
|
|
468
|
+
if (box.swimlane.index !== targetSwimlane) {
|
|
469
|
+
return box;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
__name(findBoxByLineIndex, "findBoxByLineIndex");
|
|
475
|
+
function decidePositionRelation(state, _command) {
|
|
476
|
+
const command = _command;
|
|
477
|
+
if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) {
|
|
478
|
+
return [];
|
|
479
|
+
}
|
|
480
|
+
const targetBox = findBoxByFrame(state.boxes, command.frame);
|
|
481
|
+
if (targetBox === undefined) {
|
|
482
|
+
throw new Error(`Target box not found for frame ${command.frame.name}`);
|
|
483
|
+
}
|
|
484
|
+
let sourceBox;
|
|
485
|
+
if (command.sourceFrame) {
|
|
486
|
+
sourceBox = findBoxByFrame(state.boxes, command.sourceFrame);
|
|
487
|
+
} else {
|
|
488
|
+
sourceBox = findBoxByLineIndex(state.boxes, targetBox.swimlane.index, command.index - 1);
|
|
489
|
+
}
|
|
490
|
+
if (sourceBox === undefined) {
|
|
491
|
+
return [];
|
|
492
|
+
}
|
|
493
|
+
const event = {
|
|
494
|
+
$kind: RelationPositionedKind,
|
|
495
|
+
frame: command.frame,
|
|
496
|
+
index: command.index,
|
|
497
|
+
sourceBox,
|
|
498
|
+
targetBox
|
|
499
|
+
};
|
|
500
|
+
return [event];
|
|
501
|
+
}
|
|
502
|
+
__name(decidePositionRelation, "decidePositionRelation");
|
|
503
|
+
function evolveRelationPositioned(state, _event) {
|
|
504
|
+
const event = _event;
|
|
505
|
+
const relation = {
|
|
506
|
+
visual: {
|
|
507
|
+
fill: "none",
|
|
508
|
+
stroke: "#000"
|
|
509
|
+
},
|
|
510
|
+
source: {
|
|
511
|
+
x: event.sourceBox.x,
|
|
512
|
+
y: event.sourceBox.y
|
|
513
|
+
},
|
|
514
|
+
target: {
|
|
515
|
+
x: event.targetBox.x,
|
|
516
|
+
y: event.targetBox.y
|
|
517
|
+
},
|
|
518
|
+
sourceBox: event.sourceBox,
|
|
519
|
+
targetBox: event.targetBox
|
|
520
|
+
};
|
|
521
|
+
const newState = {
|
|
522
|
+
...state,
|
|
523
|
+
relations: [...state.relations, relation]
|
|
524
|
+
};
|
|
525
|
+
return newState;
|
|
526
|
+
}
|
|
527
|
+
__name(evolveRelationPositioned, "evolveRelationPositioned");
|
|
528
|
+
var deciders = {
|
|
529
|
+
[PositionFrameKind]: decidePositionFrame,
|
|
530
|
+
[PositionRelationKind]: decidePositionRelation
|
|
531
|
+
};
|
|
532
|
+
var evolvers = {
|
|
533
|
+
[FramePositionedKind]: evolveFramePositioned,
|
|
534
|
+
[RelationPositionedKind]: evolveRelationPositioned
|
|
535
|
+
};
|
|
536
|
+
function decide(state, command) {
|
|
537
|
+
const fn = deciders[command.$kind];
|
|
538
|
+
if (fn === undefined || fn === null) {
|
|
539
|
+
return [];
|
|
540
|
+
}
|
|
541
|
+
const events = fn(state, command);
|
|
542
|
+
log.debug(`decided events`, events);
|
|
543
|
+
return events;
|
|
544
|
+
}
|
|
545
|
+
__name(decide, "decide");
|
|
546
|
+
function evolve(state, events) {
|
|
547
|
+
const newState = events.reduce((previousState, event) => {
|
|
548
|
+
const fn = evolvers[event.$kind];
|
|
549
|
+
if (fn === undefined || fn === null) {
|
|
550
|
+
return previousState;
|
|
551
|
+
}
|
|
552
|
+
return fn(previousState, event);
|
|
553
|
+
}, state);
|
|
554
|
+
log.debug(`evolve events`, { state, newState, events });
|
|
555
|
+
return newState;
|
|
556
|
+
}
|
|
557
|
+
__name(evolve, "evolve");
|
|
558
|
+
function dispatch(state, command) {
|
|
559
|
+
const events = decide(state, command);
|
|
560
|
+
const newState = evolve(state, events);
|
|
561
|
+
return newState;
|
|
562
|
+
}
|
|
563
|
+
__name(dispatch, "dispatch");
|
|
564
|
+
var db = {
|
|
565
|
+
getConfig: getConfig3,
|
|
566
|
+
setOptions,
|
|
567
|
+
getOptions,
|
|
568
|
+
clear: clear2,
|
|
569
|
+
setAccTitle,
|
|
570
|
+
getAccTitle,
|
|
571
|
+
getAccDescription,
|
|
572
|
+
setAccDescription,
|
|
573
|
+
setDiagramTitle,
|
|
574
|
+
getDiagramTitle,
|
|
575
|
+
setAst,
|
|
576
|
+
getDiagramProps,
|
|
577
|
+
getState
|
|
578
|
+
};
|
|
579
|
+
var parser = {
|
|
580
|
+
parse: /* @__PURE__ */ __name(async (input) => {
|
|
581
|
+
const ast = await parse("eventmodeling", input);
|
|
582
|
+
log.debug(ast);
|
|
583
|
+
db.setAst(ast);
|
|
584
|
+
populateCommonDb(ast, db);
|
|
585
|
+
}, "parse")
|
|
586
|
+
};
|
|
587
|
+
if (undefined) {}
|
|
588
|
+
var DEFAULT_CONFIG = getConfig2();
|
|
589
|
+
var DEFAULT_EVENTMODELING_CONFIG2 = DEFAULT_CONFIG?.eventmodeling;
|
|
590
|
+
function renderD3Box(diagram2, diagramProps2) {
|
|
591
|
+
return (box) => {
|
|
592
|
+
const y = box.swimlane.y + diagramProps2.swimlanePadding;
|
|
593
|
+
const g = diagram2.append("g").attr("class", "em-box");
|
|
594
|
+
g.append("rect").attr("x", box.x).attr("y", y).attr("rx", "3").attr("width", box.dimension.width).attr("height", box.dimension.height).attr("stroke", box.visual.stroke).attr("fill", box.visual.fill);
|
|
595
|
+
const f = g.append("foreignObject").attr("x", box.x + diagramProps2.boxPadding).attr("y", y + 10).attr("width", box.dimension.width - 2 * diagramProps2.boxPadding).attr("height", box.dimension.height - 2 * diagramProps2.boxPadding);
|
|
596
|
+
const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
|
|
597
|
+
text.append("span").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").html(box.text);
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
__name(renderD3Box, "renderD3Box");
|
|
601
|
+
function dirUpwards(sourceY, targetY) {
|
|
602
|
+
return sourceY > targetY;
|
|
603
|
+
}
|
|
604
|
+
__name(dirUpwards, "dirUpwards");
|
|
605
|
+
function renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables) {
|
|
606
|
+
return (relation) => {
|
|
607
|
+
const sourceBoxY = relation.sourceBox.swimlane.y + diagramProps2.swimlanePadding;
|
|
608
|
+
const targetBoxY = relation.targetBox.swimlane.y + diagramProps2.swimlanePadding;
|
|
609
|
+
const upwards = dirUpwards(sourceBoxY, targetBoxY);
|
|
610
|
+
const sourceX = relation.sourceBox.x + relation.sourceBox.dimension.width * 2 / 3;
|
|
611
|
+
const targetX = relation.targetBox.x + relation.targetBox.dimension.width / 3;
|
|
612
|
+
let sourceY;
|
|
613
|
+
let targetY;
|
|
614
|
+
log.debug(`rendering relation up=${upwards} for `, {
|
|
615
|
+
sourceBox: relation.sourceBox,
|
|
616
|
+
targetBox: relation.targetBox
|
|
617
|
+
});
|
|
618
|
+
if (upwards) {
|
|
619
|
+
sourceY = sourceBoxY;
|
|
620
|
+
targetY = targetBoxY + relation.targetBox.dimension.height;
|
|
621
|
+
} else {
|
|
622
|
+
sourceY = sourceBoxY + relation.sourceBox.dimension.height;
|
|
623
|
+
targetY = targetBoxY;
|
|
624
|
+
}
|
|
625
|
+
const relationStroke = themeVariables.emRelationStroke ?? relation.visual.stroke;
|
|
626
|
+
diagram2.append("path").attr("class", "em-relation").attr("fill", relation.visual.fill).attr("stroke", relationStroke).attr("stroke-width", "1").attr("marker-end", `url(#${arrowheadId})`).attr("d", `M${sourceX} ${sourceY} L${targetX} ${targetY}`);
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
__name(renderD3Relation, "renderD3Relation");
|
|
630
|
+
function renderD3Swimlane(diagram2, maxR, diagramProps2, themeVariables) {
|
|
631
|
+
return (swimlane) => {
|
|
632
|
+
const g = diagram2.append("g").attr("class", "em-swimlane");
|
|
633
|
+
const oddBackground = themeVariables.emSwimlaneBackgroundOdd ?? "rgb(250,250,250)";
|
|
634
|
+
const backgroundStroke = themeVariables.emSwimlaneBackgroundStroke ?? "rgb(240,240,240)";
|
|
635
|
+
g.append("rect").attr("x", 0).attr("y", swimlane.y).attr("rx", "3").attr("width", maxR + diagramProps2.swimlanePadding).attr("height", swimlane.height).attr("fill", oddBackground).attr("stroke", backgroundStroke);
|
|
636
|
+
g.append("text").attr("font-weight", diagramProps2.swimlaneTextFontWeight).attr("x", 30).attr("y", swimlane.y + 30).text(swimlane.label);
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
__name(renderD3Swimlane, "renderD3Swimlane");
|
|
640
|
+
var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
|
|
641
|
+
log.debug("in eventmodeling renderer", txt + `
|
|
642
|
+
`, "id:", id, ver);
|
|
643
|
+
if (!DEFAULT_EVENTMODELING_CONFIG2) {
|
|
644
|
+
throw new Error("EventModeling config not found");
|
|
645
|
+
}
|
|
646
|
+
const db2 = diagObj.db;
|
|
647
|
+
const { themeVariables, eventmodeling: config } = getConfig2();
|
|
648
|
+
const diagram2 = select_default(`[id="${id}"]`);
|
|
649
|
+
const diagramProps2 = db2.getDiagramProps();
|
|
650
|
+
const state = db2.getState();
|
|
651
|
+
const arrowheadId = `em-arrowhead-${id}`;
|
|
652
|
+
const arrowheadColor = themeVariables.emArrowhead ?? "#000000";
|
|
653
|
+
state.sortedSwimlanesArray.forEach(renderD3Swimlane(diagram2, state.maxR, diagramProps2, themeVariables));
|
|
654
|
+
state.boxes.forEach(renderD3Box(diagram2, diagramProps2));
|
|
655
|
+
state.relations.forEach(renderD3Relation(diagram2, diagramProps2, arrowheadId, themeVariables));
|
|
656
|
+
const marker = diagram2.append("defs").append("marker").attr("id", arrowheadId).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto");
|
|
657
|
+
marker.append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", arrowheadColor);
|
|
658
|
+
setupGraphViewbox2(undefined, diagram2, config?.padding ?? 30, config?.useMaxWidth);
|
|
659
|
+
}, "draw");
|
|
660
|
+
var renderer_default = {
|
|
661
|
+
draw
|
|
662
|
+
};
|
|
663
|
+
var getStyles = /* @__PURE__ */ __name((_options) => ``, "getStyles");
|
|
664
|
+
var styles_default = getStyles;
|
|
665
|
+
var diagram = {
|
|
666
|
+
parser,
|
|
667
|
+
db,
|
|
668
|
+
renderer: renderer_default,
|
|
669
|
+
styles: styles_default
|
|
670
|
+
};
|
|
671
|
+
export {
|
|
672
|
+
diagram
|
|
673
|
+
};
|