@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,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
db,
|
|
3
|
+
getStyles,
|
|
4
|
+
renderer
|
|
5
|
+
} from "./markdown-5avymm8t.js";
|
|
6
|
+
import {
|
|
7
|
+
populateCommonDb
|
|
8
|
+
} from "./markdown-b4s7ntq2.js";
|
|
9
|
+
import {
|
|
10
|
+
MermaidParseError
|
|
11
|
+
} from "./markdown-ceefymn8.js";
|
|
12
|
+
import"./markdown-gx1p0ew0.js";
|
|
13
|
+
import"./markdown-pxfeh231.js";
|
|
14
|
+
import {
|
|
15
|
+
createRailroadPegServices
|
|
16
|
+
} from "./markdown-y18mve73.js";
|
|
17
|
+
import"./markdown-2x113yh8.js";
|
|
18
|
+
import"./markdown-56enrf2r.js";
|
|
19
|
+
import"./markdown-ag2sssf8.js";
|
|
20
|
+
import"./markdown-tnmabqvz.js";
|
|
21
|
+
import"./markdown-hab789t9.js";
|
|
22
|
+
import"./markdown-gxye5frz.js";
|
|
23
|
+
import"./markdown-k8xkn8mw.js";
|
|
24
|
+
import"./markdown-p740v4qm.js";
|
|
25
|
+
import"./markdown-ffg06nfz.js";
|
|
26
|
+
import"./markdown-w6sgd54z.js";
|
|
27
|
+
import"./markdown-rawhfvvc.js";
|
|
28
|
+
import"./markdown-v14td68x.js";
|
|
29
|
+
import"./markdown-dz3z5w30.js";
|
|
30
|
+
import"./markdown-6zz8efx2.js";
|
|
31
|
+
import"./markdown-92n37gd4.js";
|
|
32
|
+
import {
|
|
33
|
+
log
|
|
34
|
+
} from "./markdown-xw8dsk8b.js";
|
|
35
|
+
import {
|
|
36
|
+
__name
|
|
37
|
+
} from "./markdown-1s5vwkf2.js";
|
|
38
|
+
import"./markdown-dy5sgjhc.js";
|
|
39
|
+
import"./markdown-809k7q41.js";
|
|
40
|
+
|
|
41
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/pegDiagram-VL7TDLO6.mjs
|
|
42
|
+
var langiumParser = createRailroadPegServices().RailroadPeg.parser.LangiumParser;
|
|
43
|
+
var transformOrderedChoice = /* @__PURE__ */ __name((choice) => {
|
|
44
|
+
const alternatives = choice.alternatives.map(transformSequence);
|
|
45
|
+
if (alternatives.length === 1) {
|
|
46
|
+
return alternatives[0];
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
type: "choice",
|
|
50
|
+
alternatives
|
|
51
|
+
};
|
|
52
|
+
}, "transformOrderedChoice");
|
|
53
|
+
var transformSequence = /* @__PURE__ */ __name((sequence) => {
|
|
54
|
+
const elements = sequence.elements.map(transformPrefix);
|
|
55
|
+
if (elements.length === 1) {
|
|
56
|
+
return elements[0];
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
type: "sequence",
|
|
60
|
+
elements
|
|
61
|
+
};
|
|
62
|
+
}, "transformSequence");
|
|
63
|
+
var transformPrefix = /* @__PURE__ */ __name((prefix) => {
|
|
64
|
+
const inner = transformSuffix(prefix.suffix);
|
|
65
|
+
if (!prefix.operator) {
|
|
66
|
+
return inner;
|
|
67
|
+
}
|
|
68
|
+
const label = prefix.operator === "&" ? `&${nodeToLabel(inner)}` : `!${nodeToLabel(inner)}`;
|
|
69
|
+
return {
|
|
70
|
+
type: "special",
|
|
71
|
+
text: label
|
|
72
|
+
};
|
|
73
|
+
}, "transformPrefix");
|
|
74
|
+
var nodeToLabel = /* @__PURE__ */ __name((node) => {
|
|
75
|
+
switch (node.type) {
|
|
76
|
+
case "terminal":
|
|
77
|
+
return `"${node.value}"`;
|
|
78
|
+
case "nonterminal":
|
|
79
|
+
return node.name;
|
|
80
|
+
case "special":
|
|
81
|
+
return node.text;
|
|
82
|
+
default:
|
|
83
|
+
return "(...)";
|
|
84
|
+
}
|
|
85
|
+
}, "nodeToLabel");
|
|
86
|
+
var transformSuffix = /* @__PURE__ */ __name((suffix) => {
|
|
87
|
+
const inner = transformPrimary(suffix.primary);
|
|
88
|
+
if (!suffix.operator) {
|
|
89
|
+
return inner;
|
|
90
|
+
}
|
|
91
|
+
switch (suffix.operator) {
|
|
92
|
+
case "?":
|
|
93
|
+
return { type: "optional", element: inner };
|
|
94
|
+
case "*":
|
|
95
|
+
return { type: "repetition", element: inner, min: 0, max: Infinity };
|
|
96
|
+
case "+":
|
|
97
|
+
return { type: "repetition", element: inner, min: 1, max: Infinity };
|
|
98
|
+
default:
|
|
99
|
+
throw new Error(`Unsupported PEG suffix operator: ${suffix.operator}`);
|
|
100
|
+
}
|
|
101
|
+
}, "transformSuffix");
|
|
102
|
+
var transformPrimary = /* @__PURE__ */ __name((primary) => {
|
|
103
|
+
switch (primary.$type) {
|
|
104
|
+
case "PegLiteral":
|
|
105
|
+
return {
|
|
106
|
+
type: "terminal",
|
|
107
|
+
value: primary.value
|
|
108
|
+
};
|
|
109
|
+
case "PegIdentifier":
|
|
110
|
+
return {
|
|
111
|
+
type: "nonterminal",
|
|
112
|
+
name: primary.name
|
|
113
|
+
};
|
|
114
|
+
case "PegGroup":
|
|
115
|
+
return transformOrderedChoice(primary.element);
|
|
116
|
+
case "PegAny":
|
|
117
|
+
return {
|
|
118
|
+
type: "special",
|
|
119
|
+
text: primary.dot
|
|
120
|
+
};
|
|
121
|
+
default:
|
|
122
|
+
throw new Error(`Unsupported PEG primary node: ${primary.$type}`);
|
|
123
|
+
}
|
|
124
|
+
}, "transformPrimary");
|
|
125
|
+
var transformRule = /* @__PURE__ */ __name((rule) => {
|
|
126
|
+
return {
|
|
127
|
+
name: rule.name,
|
|
128
|
+
definition: transformOrderedChoice(rule.definition)
|
|
129
|
+
};
|
|
130
|
+
}, "transformRule");
|
|
131
|
+
var populateDb = /* @__PURE__ */ __name((ast) => {
|
|
132
|
+
populateCommonDb(ast, db);
|
|
133
|
+
if (ast.title) {
|
|
134
|
+
db.setTitle(ast.title);
|
|
135
|
+
}
|
|
136
|
+
ast.rules.map((rule) => db.addRule(transformRule(rule)));
|
|
137
|
+
}, "populateDb");
|
|
138
|
+
var parser = {
|
|
139
|
+
parse: /* @__PURE__ */ __name((input) => {
|
|
140
|
+
db.clear();
|
|
141
|
+
log.debug("[PEG Parser] Starting Langium parse");
|
|
142
|
+
const result = langiumParser.parse(input);
|
|
143
|
+
if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {
|
|
144
|
+
throw new MermaidParseError(result);
|
|
145
|
+
}
|
|
146
|
+
const ast = result.value;
|
|
147
|
+
log.debug("[PEG Parser] Parsed rules:", ast.rules.length);
|
|
148
|
+
populateDb(ast);
|
|
149
|
+
log.debug("[PEG Parser] Parse complete");
|
|
150
|
+
}, "parse"),
|
|
151
|
+
parser: {
|
|
152
|
+
yy: db
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var diagram = {
|
|
156
|
+
parser,
|
|
157
|
+
db,
|
|
158
|
+
renderer,
|
|
159
|
+
styles: getStyles
|
|
160
|
+
};
|
|
161
|
+
export {
|
|
162
|
+
diagram
|
|
163
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
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"./markdown-dz3z5w30.js";
|
|
23
|
+
import {
|
|
24
|
+
selectSvgElement
|
|
25
|
+
} from "./markdown-6zz8efx2.js";
|
|
26
|
+
import {
|
|
27
|
+
cleanAndMerge,
|
|
28
|
+
parseFontSize
|
|
29
|
+
} from "./markdown-ff5wvb43.js";
|
|
30
|
+
import"./markdown-pzgd8z3s.js";
|
|
31
|
+
import {
|
|
32
|
+
clear,
|
|
33
|
+
configureSvgSize,
|
|
34
|
+
defaultConfig_default,
|
|
35
|
+
getAccDescription,
|
|
36
|
+
getAccTitle,
|
|
37
|
+
getConfig2,
|
|
38
|
+
getDiagramTitle,
|
|
39
|
+
setAccDescription,
|
|
40
|
+
setAccTitle,
|
|
41
|
+
setDiagramTitle
|
|
42
|
+
} from "./markdown-92n37gd4.js";
|
|
43
|
+
import {
|
|
44
|
+
log
|
|
45
|
+
} from "./markdown-xw8dsk8b.js";
|
|
46
|
+
import {
|
|
47
|
+
__name
|
|
48
|
+
} from "./markdown-1s5vwkf2.js";
|
|
49
|
+
import {
|
|
50
|
+
arc_default,
|
|
51
|
+
ordinal,
|
|
52
|
+
pie_default
|
|
53
|
+
} from "./markdown-dy5sgjhc.js";
|
|
54
|
+
import"./markdown-809k7q41.js";
|
|
55
|
+
|
|
56
|
+
// node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-7S7Q4E2Y.mjs
|
|
57
|
+
var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
|
|
58
|
+
var DEFAULT_PIE_DB = {
|
|
59
|
+
sections: /* @__PURE__ */ new Map,
|
|
60
|
+
showData: false,
|
|
61
|
+
config: DEFAULT_PIE_CONFIG
|
|
62
|
+
};
|
|
63
|
+
var sections = DEFAULT_PIE_DB.sections;
|
|
64
|
+
var showData = DEFAULT_PIE_DB.showData;
|
|
65
|
+
var config = structuredClone(DEFAULT_PIE_CONFIG);
|
|
66
|
+
var getConfig22 = /* @__PURE__ */ __name(() => structuredClone(config), "getConfig");
|
|
67
|
+
var clear2 = /* @__PURE__ */ __name(() => {
|
|
68
|
+
sections = /* @__PURE__ */ new Map;
|
|
69
|
+
showData = DEFAULT_PIE_DB.showData;
|
|
70
|
+
clear();
|
|
71
|
+
}, "clear");
|
|
72
|
+
var addSection = /* @__PURE__ */ __name(({ label, value }) => {
|
|
73
|
+
if (value < 0) {
|
|
74
|
+
throw new Error(`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
|
|
75
|
+
}
|
|
76
|
+
if (!sections.has(label)) {
|
|
77
|
+
sections.set(label, value);
|
|
78
|
+
log.debug(`added new section: ${label}, with value: ${value}`);
|
|
79
|
+
}
|
|
80
|
+
}, "addSection");
|
|
81
|
+
var getSections = /* @__PURE__ */ __name(() => sections, "getSections");
|
|
82
|
+
var setShowData = /* @__PURE__ */ __name((toggle) => {
|
|
83
|
+
showData = toggle;
|
|
84
|
+
}, "setShowData");
|
|
85
|
+
var getShowData = /* @__PURE__ */ __name(() => showData, "getShowData");
|
|
86
|
+
var db = {
|
|
87
|
+
getConfig: getConfig22,
|
|
88
|
+
clear: clear2,
|
|
89
|
+
setDiagramTitle,
|
|
90
|
+
getDiagramTitle,
|
|
91
|
+
setAccTitle,
|
|
92
|
+
getAccTitle,
|
|
93
|
+
setAccDescription,
|
|
94
|
+
getAccDescription,
|
|
95
|
+
addSection,
|
|
96
|
+
getSections,
|
|
97
|
+
setShowData,
|
|
98
|
+
getShowData
|
|
99
|
+
};
|
|
100
|
+
var populateDb = /* @__PURE__ */ __name((ast, db2) => {
|
|
101
|
+
populateCommonDb(ast, db2);
|
|
102
|
+
db2.setShowData(ast.showData);
|
|
103
|
+
ast.sections.map(db2.addSection);
|
|
104
|
+
}, "populateDb");
|
|
105
|
+
var parser = {
|
|
106
|
+
parse: /* @__PURE__ */ __name(async (input) => {
|
|
107
|
+
const ast = await parse("pie", input);
|
|
108
|
+
log.debug(ast);
|
|
109
|
+
populateDb(ast, db);
|
|
110
|
+
}, "parse")
|
|
111
|
+
};
|
|
112
|
+
var getStyles = /* @__PURE__ */ __name((options) => `
|
|
113
|
+
.pieCircle{
|
|
114
|
+
stroke: ${options.pieStrokeColor};
|
|
115
|
+
stroke-width : ${options.pieStrokeWidth};
|
|
116
|
+
opacity : ${options.pieOpacity};
|
|
117
|
+
}
|
|
118
|
+
.pieCircle.highlighted{
|
|
119
|
+
scale: 1.05;
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
.pieCircle.highlightedOnHover:hover{
|
|
123
|
+
transition-duration: 250ms;
|
|
124
|
+
scale: 1.05;
|
|
125
|
+
opacity: 1;
|
|
126
|
+
}
|
|
127
|
+
.pieOuterCircle{
|
|
128
|
+
stroke: ${options.pieOuterStrokeColor};
|
|
129
|
+
stroke-width: ${options.pieOuterStrokeWidth};
|
|
130
|
+
fill: none;
|
|
131
|
+
}
|
|
132
|
+
.pieTitleText {
|
|
133
|
+
text-anchor: middle;
|
|
134
|
+
font-size: ${options.pieTitleTextSize};
|
|
135
|
+
fill: ${options.pieTitleTextColor};
|
|
136
|
+
font-family: ${options.fontFamily};
|
|
137
|
+
}
|
|
138
|
+
.slice {
|
|
139
|
+
font-family: ${options.fontFamily};
|
|
140
|
+
fill: ${options.pieSectionTextColor};
|
|
141
|
+
font-size:${options.pieSectionTextSize};
|
|
142
|
+
// fill: white;
|
|
143
|
+
}
|
|
144
|
+
.legend text {
|
|
145
|
+
fill: ${options.pieLegendTextColor};
|
|
146
|
+
font-family: ${options.fontFamily};
|
|
147
|
+
font-size: ${options.pieLegendTextSize};
|
|
148
|
+
}
|
|
149
|
+
`, "getStyles");
|
|
150
|
+
var pieStyles_default = getStyles;
|
|
151
|
+
var createPieArcs = /* @__PURE__ */ __name((sections2) => {
|
|
152
|
+
const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
|
|
153
|
+
const pieData = [...sections2.entries()].map(([label, value]) => ({ label, value })).filter((d) => d.value / sum * 100 >= 1);
|
|
154
|
+
const pie = pie_default().value((d) => d.value).sort(null);
|
|
155
|
+
return pie(pieData);
|
|
156
|
+
}, "createPieArcs");
|
|
157
|
+
var draw = /* @__PURE__ */ __name((text, id, _version, diagObj) => {
|
|
158
|
+
log.debug(`rendering pie chart
|
|
159
|
+
` + text);
|
|
160
|
+
const db2 = diagObj.db;
|
|
161
|
+
const globalConfig = getConfig2();
|
|
162
|
+
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
|
|
163
|
+
const MARGIN = 40;
|
|
164
|
+
const LEGEND_RECT_SIZE = 18;
|
|
165
|
+
const LEGEND_SPACING = 4;
|
|
166
|
+
const height = 450;
|
|
167
|
+
const pieWidth = height;
|
|
168
|
+
const svg = selectSvgElement(id);
|
|
169
|
+
const group = svg.append("g");
|
|
170
|
+
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
|
|
171
|
+
const { themeVariables } = globalConfig;
|
|
172
|
+
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
|
173
|
+
outerStrokeWidth ??= 2;
|
|
174
|
+
const legendPosition = pieConfig.legendPosition;
|
|
175
|
+
const textPosition = pieConfig.textPosition;
|
|
176
|
+
const innerHole = pieConfig.donutHole > 0 && pieConfig.donutHole <= 0.9 ? pieConfig.donutHole : 0;
|
|
177
|
+
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
|
|
178
|
+
const arcGenerator = arc_default().innerRadius(innerHole * radius).outerRadius(radius);
|
|
179
|
+
const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
|
|
180
|
+
const pie = group.append("g");
|
|
181
|
+
pie.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
|
|
182
|
+
const sections2 = db2.getSections();
|
|
183
|
+
const arcs = createPieArcs(sections2);
|
|
184
|
+
const myGeneratedColors = [
|
|
185
|
+
themeVariables.pie1,
|
|
186
|
+
themeVariables.pie2,
|
|
187
|
+
themeVariables.pie3,
|
|
188
|
+
themeVariables.pie4,
|
|
189
|
+
themeVariables.pie5,
|
|
190
|
+
themeVariables.pie6,
|
|
191
|
+
themeVariables.pie7,
|
|
192
|
+
themeVariables.pie8,
|
|
193
|
+
themeVariables.pie9,
|
|
194
|
+
themeVariables.pie10,
|
|
195
|
+
themeVariables.pie11,
|
|
196
|
+
themeVariables.pie12
|
|
197
|
+
];
|
|
198
|
+
let sum = 0;
|
|
199
|
+
sections2.forEach((section) => {
|
|
200
|
+
sum += section;
|
|
201
|
+
});
|
|
202
|
+
const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
|
|
203
|
+
const color = ordinal(myGeneratedColors).domain([
|
|
204
|
+
...sections2.keys()
|
|
205
|
+
]);
|
|
206
|
+
pie.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
|
|
207
|
+
return color(datum.data.label);
|
|
208
|
+
}).attr("class", (datum) => {
|
|
209
|
+
let className = "pieCircle";
|
|
210
|
+
if (pieConfig.highlightSlice === "hover") {
|
|
211
|
+
className += " highlightedOnHover";
|
|
212
|
+
} else if (pieConfig.highlightSlice === datum.data.label) {
|
|
213
|
+
className += " highlighted";
|
|
214
|
+
}
|
|
215
|
+
return className;
|
|
216
|
+
});
|
|
217
|
+
pie.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
|
|
218
|
+
return (datum.data.value / sum * 100).toFixed(0) + "%";
|
|
219
|
+
}).attr("transform", (datum) => {
|
|
220
|
+
return "translate(" + labelArcGenerator.centroid(datum) + ")";
|
|
221
|
+
}).style("text-anchor", "middle").attr("class", "slice");
|
|
222
|
+
const titleText = group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
|
|
223
|
+
const allSectionData = [...sections2.entries()].map(([label, value]) => ({
|
|
224
|
+
label,
|
|
225
|
+
value
|
|
226
|
+
}));
|
|
227
|
+
const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend");
|
|
228
|
+
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
|
|
229
|
+
legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
|
|
230
|
+
if (db2.getShowData()) {
|
|
231
|
+
return `${d.label} [${d.value}]`;
|
|
232
|
+
}
|
|
233
|
+
return d.label;
|
|
234
|
+
});
|
|
235
|
+
const longestTextWidth = Math.max(...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0));
|
|
236
|
+
let chartAndLegendHeight = height;
|
|
237
|
+
let chartAndLegendWidth = pieWidth + MARGIN;
|
|
238
|
+
const legendHeight = LEGEND_RECT_SIZE + LEGEND_SPACING;
|
|
239
|
+
const totalLegendHeight = allSectionData.length * legendHeight;
|
|
240
|
+
switch (legendPosition) {
|
|
241
|
+
case "center":
|
|
242
|
+
legend.attr("transform", (_datum, index) => {
|
|
243
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
244
|
+
const horizontal = -longestTextWidth / 2 - (LEGEND_RECT_SIZE + LEGEND_SPACING);
|
|
245
|
+
const vertical = index * legendHeight - offset;
|
|
246
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
247
|
+
});
|
|
248
|
+
break;
|
|
249
|
+
case "top":
|
|
250
|
+
chartAndLegendHeight += totalLegendHeight;
|
|
251
|
+
legend.attr("transform", (_datum, index) => {
|
|
252
|
+
const offset = radius;
|
|
253
|
+
const horizontal = -longestTextWidth / 2 - (LEGEND_RECT_SIZE + LEGEND_SPACING);
|
|
254
|
+
const vertical = index * legendHeight - offset;
|
|
255
|
+
return `translate(${horizontal}, ${vertical})`;
|
|
256
|
+
});
|
|
257
|
+
pie.attr("transform", () => {
|
|
258
|
+
return `translate(0, ${totalLegendHeight + legendHeight})`;
|
|
259
|
+
});
|
|
260
|
+
break;
|
|
261
|
+
case "bottom":
|
|
262
|
+
chartAndLegendHeight += totalLegendHeight;
|
|
263
|
+
legend.attr("transform", (_datum, index) => {
|
|
264
|
+
const offset = -radius - legendHeight;
|
|
265
|
+
const horizontal = -longestTextWidth / 2 - (LEGEND_RECT_SIZE + LEGEND_SPACING);
|
|
266
|
+
const vertical = index * legendHeight - offset;
|
|
267
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
268
|
+
});
|
|
269
|
+
break;
|
|
270
|
+
case "left":
|
|
271
|
+
chartAndLegendWidth += LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
|
|
272
|
+
legend.attr("transform", (_datum, index) => {
|
|
273
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
274
|
+
const horizontal = -radius - (LEGEND_RECT_SIZE + LEGEND_SPACING);
|
|
275
|
+
const vertical = index * legendHeight - offset;
|
|
276
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
277
|
+
});
|
|
278
|
+
pie.attr("transform", () => {
|
|
279
|
+
return `translate(${longestTextWidth + LEGEND_RECT_SIZE + LEGEND_SPACING}, 0)`;
|
|
280
|
+
});
|
|
281
|
+
break;
|
|
282
|
+
case "right":
|
|
283
|
+
default:
|
|
284
|
+
chartAndLegendWidth += LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
|
|
285
|
+
legend.attr("transform", (_datum, index) => {
|
|
286
|
+
const offset = legendHeight * allSectionData.length / 2;
|
|
287
|
+
const horizontal = 12 * LEGEND_RECT_SIZE;
|
|
288
|
+
const vertical = index * legendHeight - offset;
|
|
289
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
290
|
+
});
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0;
|
|
294
|
+
const titleLeft = pieWidth / 2 - titleWidth / 2;
|
|
295
|
+
const titleRight = pieWidth / 2 + titleWidth / 2;
|
|
296
|
+
const viewBoxX = Math.min(0, titleLeft);
|
|
297
|
+
const viewBoxRight = Math.max(chartAndLegendWidth, titleRight);
|
|
298
|
+
const totalWidth = viewBoxRight - viewBoxX;
|
|
299
|
+
svg.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${chartAndLegendHeight}`);
|
|
300
|
+
configureSvgSize(svg, chartAndLegendHeight, totalWidth, pieConfig.useMaxWidth);
|
|
301
|
+
}, "draw");
|
|
302
|
+
var renderer = { draw };
|
|
303
|
+
var diagram = {
|
|
304
|
+
parser,
|
|
305
|
+
db,
|
|
306
|
+
renderer,
|
|
307
|
+
styles: pieStyles_default
|
|
308
|
+
};
|
|
309
|
+
export {
|
|
310
|
+
diagram
|
|
311
|
+
};
|