docmedown 0.1.0 → 0.1.2
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/README.md +69 -20
- package/dist/abnfDiagram-VCTEODGH-CtQBp0Qv.mjs +89 -0
- package/dist/abnfDiagram-VCTEODGH-mccrzlD_.js +1 -0
- package/dist/arc-DgPKXEdT.mjs +82 -0
- package/dist/arc-n7TW7Bis.js +1 -0
- package/dist/architecture-7GRP2DOG-B7myQ46f.js +1 -0
- package/dist/architecture-7GRP2DOG-Cxj1ussQ.mjs +3 -0
- package/dist/architectureDiagram-5GKGNRK7-BdTCu5T3.js +36 -0
- package/dist/architectureDiagram-5GKGNRK7-CkgZa-G1.mjs +4154 -0
- package/dist/array-CApNbSU9.mjs +6 -0
- package/dist/array-DZSRzHA_.js +1 -0
- package/dist/blockDiagram-I7D4REHJ-CSYvpxQw.js +129 -0
- package/dist/blockDiagram-I7D4REHJ-CYngfPD9.mjs +1922 -0
- package/dist/c4Diagram-7LVT6UL2-B-sz5MUK.js +38 -0
- package/dist/c4Diagram-7LVT6UL2-DEzxFf2b.mjs +3010 -0
- package/dist/channel-LgHproiI.mjs +5 -0
- package/dist/channel-yqu0m4cl.js +1 -0
- package/dist/chunk-2E4U76K2-BOyeRQsI.js +1 -0
- package/dist/chunk-2E4U76K2-CoTrgtfg.mjs +348 -0
- package/dist/chunk-2Q5K7J3B-D4EgYPOq.mjs +15 -0
- package/dist/chunk-2Q5K7J3B-DhjCNjaM.js +1 -0
- package/dist/chunk-4HAMMTFA-GFyfmcSO.js +62 -0
- package/dist/chunk-4HAMMTFA-VgWPe1ng.mjs +4188 -0
- package/dist/chunk-5VM5RSS4-GINalzIv.js +15 -0
- package/dist/chunk-5VM5RSS4-TqxtqrwE.mjs +5 -0
- package/dist/chunk-75Z2AOVW-DYouz5MZ.js +2 -0
- package/dist/chunk-75Z2AOVW-Dz0Sko9Y.mjs +1330 -0
- package/dist/chunk-CLGD4ZFX-C5J-e2io.js +1 -0
- package/dist/chunk-CLGD4ZFX-DBkwyMMv.mjs +14 -0
- package/dist/chunk-DU6HZSFF-BEQZSmUu.mjs +3836 -0
- package/dist/chunk-DU6HZSFF-CWc5ewtb.js +127 -0
- package/dist/chunk-F27PBJKO-8jvY_jJK.js +1 -0
- package/dist/chunk-F27PBJKO-DFH3sRZG.mjs +61 -0
- package/dist/chunk-FOHPRMQF-LRqOLsSw.mjs +21456 -0
- package/dist/chunk-FOHPRMQF-tmTlwTeH.js +161 -0
- package/dist/chunk-GMAD6QVW-BZeZ4fdb.mjs +1863 -0
- package/dist/chunk-GMAD6QVW-DEQiTa0c.js +72 -0
- package/dist/chunk-GVQU2GXP-B1D3J05J.mjs +37 -0
- package/dist/chunk-GVQU2GXP-CdJIWN41.js +1 -0
- package/dist/chunk-IMKFNOWR-BmZb9U1f.mjs +2042 -0
- package/dist/chunk-IMKFNOWR-CPJsszGN.js +231 -0
- package/dist/chunk-JWPE2WC7-DIKiF5cm.mjs +8 -0
- package/dist/chunk-JWPE2WC7-p1fYVdYc.js +1 -0
- package/dist/chunk-L3NEJ4N5-TzDiVs78.js +1 -0
- package/dist/chunk-L3NEJ4N5-lal8wUID.mjs +245 -0
- package/dist/chunk-LNGE3PJU-BQX75wkM.js +34 -0
- package/dist/chunk-LNGE3PJU-DJ9JuXV6.mjs +1521 -0
- package/dist/chunk-OSK3NFVY-9AWK88m1.mjs +672 -0
- package/dist/chunk-OSK3NFVY-CHzvVe8m.js +10 -0
- package/dist/chunk-P2QGCYS3-6q3AXPt5.mjs +67 -0
- package/dist/chunk-P2QGCYS3-DKZzpRQW.js +1 -0
- package/dist/chunk-POPQ4Y6H-Dd7J9tx3.mjs +26 -0
- package/dist/chunk-POPQ4Y6H-T5C7wpjf.js +1 -0
- package/dist/chunk-PWAF6VOD-BYG76tEe.mjs +275 -0
- package/dist/chunk-PWAF6VOD-DxZLuCEw.js +1 -0
- package/dist/chunk-SHT3W25Y-B2Wes8jn.mjs +4183 -0
- package/dist/chunk-SHT3W25Y-BQjHSn5K.js +168 -0
- package/dist/chunk-SVP7TREG-BFMd615E.js +88 -0
- package/dist/chunk-SVP7TREG-CynckzeF.mjs +490 -0
- package/dist/chunk-TICWLB2K-BfCuoR1V.mjs +3357 -0
- package/dist/chunk-TICWLB2K-agcyBfUp.js +206 -0
- package/dist/chunk-TLUHSLCS-CUrWaKDG.mjs +59 -0
- package/dist/chunk-TLUHSLCS-Drx_a7am.js +1 -0
- package/dist/chunk-XXDRQBXY-AAk1-Cyg.js +1 -0
- package/dist/chunk-XXDRQBXY-DpR8eYzz.mjs +9 -0
- package/dist/chunk-Y2CYZVJY-CnmLqFtv.js +1 -0
- package/dist/chunk-Y2CYZVJY-i11wjrBe.mjs +12 -0
- package/dist/classDiagram-ZZMXUADV-B7IN9zcX.js +1 -0
- package/dist/classDiagram-ZZMXUADV-tcy6gxSB.mjs +30 -0
- package/dist/classDiagram-v2-VYDZK3BY-B7IN9zcX.js +1 -0
- package/dist/classDiagram-v2-VYDZK3BY-D5wM6Acp.mjs +30 -0
- package/dist/cli.js +719 -532
- package/dist/cose-bilkent-JH36ORCC-DBUPO3qJ.js +1 -0
- package/dist/cose-bilkent-JH36ORCC-Slpx4WIt.mjs +2253 -0
- package/dist/cynefin-OW5HDTMX--QVnfGi1.mjs +3 -0
- package/dist/cynefin-OW5HDTMX-lNKysi7S.js +1 -0
- package/dist/cynefinDiagram-5FMLGOSQ-CsFONYqx.js +62 -0
- package/dist/cynefinDiagram-5FMLGOSQ-DsrxYBcg.mjs +355 -0
- package/dist/cytoscape.esm-C5TvPYYm.mjs +18148 -0
- package/dist/cytoscape.esm-CBmWJr5M.js +321 -0
- package/dist/dagre-CZ6P9L_h.js +1 -0
- package/dist/dagre-GXQ25YYZ-CQszk-7P.js +4 -0
- package/dist/dagre-GXQ25YYZ-ecYByRSn.mjs +425 -0
- package/dist/dagre-J_1oH0eY.mjs +1934 -0
- package/dist/defaultLocale-N-0uLSyg.mjs +198 -0
- package/dist/defaultLocale-ybN1Vtvg.js +1 -0
- package/dist/diagram-S7CK7UJ4-CTMvxX__.js +30 -0
- package/dist/diagram-S7CK7UJ4-DxCghfa-.mjs +301 -0
- package/dist/diagram-UQ7AKVKN-1viEkqlG.js +41 -0
- package/dist/diagram-UQ7AKVKN-BA7Z_oB7.mjs +214 -0
- package/dist/diagram-VSXAHHWV-DgVT19mq.js +3 -0
- package/dist/diagram-VSXAHHWV-Dtqo03M5.mjs +432 -0
- package/dist/diagram-VX7I27RA-CNw0pOX_.js +24 -0
- package/dist/diagram-VX7I27RA-GMPRt8Zh.mjs +527 -0
- package/dist/diagram-Z3DM3KII-C6XdQK_Q.mjs +134 -0
- package/dist/diagram-Z3DM3KII-CPkBr3FT.js +24 -0
- package/dist/dist-CXWJafG_.js +1 -0
- package/dist/dist-DNdLIC8h.mjs +59 -0
- package/dist/docmedown.cjs +125 -44
- package/dist/docmedown.iife.js +3477 -72
- package/dist/docmedown.mjs +10003 -4807
- package/dist/ebnfDiagram-PWID7BFC-CseVsyL3.js +1 -0
- package/dist/ebnfDiagram-PWID7BFC-D_dBDXWC.mjs +100 -0
- package/dist/erDiagram-RLTQ6QDP-DFwfQTRS.js +99 -0
- package/dist/erDiagram-RLTQ6QDP-DP7ddGMH.mjs +1966 -0
- package/dist/eventmodeling-NTZA5JFV-CzxVg0l5.js +1 -0
- package/dist/eventmodeling-NTZA5JFV-Djsy__5n.mjs +3 -0
- package/dist/flowDiagram-HODETNUW-7hSJfI3W.js +1 -0
- package/dist/flowDiagram-HODETNUW-Dqu5Lr19.mjs +17 -0
- package/dist/ganttDiagram-EL5Y4UJY-KNL3tzTD.mjs +3072 -0
- package/dist/ganttDiagram-EL5Y4UJY-aiLqNWgi.js +292 -0
- package/dist/gitGraph-4MIJSDKK-DnElfqX7.js +1 -0
- package/dist/gitGraph-4MIJSDKK-xuKJBT2e.mjs +3 -0
- package/dist/gitGraphDiagram-WWUBYQGX-D4gSo_-e.js +106 -0
- package/dist/gitGraphDiagram-WWUBYQGX-Dooss5fG.mjs +733 -0
- package/dist/graphlib-BaETKKSa.js +1 -0
- package/dist/graphlib-XW-Jr8pF.mjs +1267 -0
- package/dist/info-A6RAGUB7-ClYskpn6.mjs +3 -0
- package/dist/info-A6RAGUB7-DDvvt-fW.js +1 -0
- package/dist/infoDiagram-27XIBGKW-B2-y2mdQ.mjs +20 -0
- package/dist/infoDiagram-27XIBGKW-DYQ9NzfL.js +2 -0
- package/dist/init-BJdqMO10.js +1 -0
- package/dist/init-CsQUQz36.mjs +13 -0
- package/dist/ishikawaDiagram-5VMMS53U-ULIhoYO5.js +70 -0
- package/dist/ishikawaDiagram-5VMMS53U-xAArNh-1.mjs +719 -0
- package/dist/journeyDiagram-3NMN7TZE-BBMYNZRL.js +139 -0
- package/dist/journeyDiagram-3NMN7TZE-BH-uKqP7.mjs +884 -0
- package/dist/kanban-definition-UXKFOSKX-Be49llXr.mjs +976 -0
- package/dist/kanban-definition-UXKFOSKX-CDL5yJkq.js +89 -0
- package/dist/line-BEwhHSLl.js +1 -0
- package/dist/line-CiXRog8O.mjs +34 -0
- package/dist/linear-75tfjrny.js +1 -0
- package/dist/linear-Ncx_RuON.mjs +288 -0
- package/dist/mermaid-parser.core-BBApyu_y.js +6 -0
- package/dist/mermaid-parser.core-BRHibdUE.mjs +638 -0
- package/dist/mindmap-definition-YA3MSWOX-Chy7XP_5.mjs +1006 -0
- package/dist/mindmap-definition-YA3MSWOX-DOda-fkL.js +96 -0
- package/dist/ordinal-B1BNQwUR.mjs +65 -0
- package/dist/ordinal-B9aFWmF9.js +1 -0
- package/dist/packet-AYTQ26CC-CorIy9Ul.js +1 -0
- package/dist/packet-AYTQ26CC-DWH8gXJK.mjs +3 -0
- package/dist/path-CnWkkRiY.mjs +84 -0
- package/dist/path-DIS6ck99.js +1 -0
- package/dist/pegDiagram-XKGWAZYB-Cdw6MeON.js +1 -0
- package/dist/pegDiagram-XKGWAZYB-uNfxRaq1.mjs +94 -0
- package/dist/pie-WAS4IAKB-Cn5eK-5P.mjs +3 -0
- package/dist/pie-WAS4IAKB-D84xrSoY.js +1 -0
- package/dist/pieDiagram-E7YTZNPT-Bd6mvpJw.js +39 -0
- package/dist/pieDiagram-E7YTZNPT-Cczo96a2.mjs +203 -0
- package/dist/quadrantDiagram-AXDQQJYC-BPfgvMsS.js +7 -0
- package/dist/quadrantDiagram-AXDQQJYC-eqRNtVRl.mjs +2001 -0
- package/dist/radar-RG4KPBEZ-DvkxGdO6.mjs +3 -0
- package/dist/radar-RG4KPBEZ-R2sQOLL9.js +1 -0
- package/dist/railroad-74A4TZTK-BOZIf6ts.js +1 -0
- package/dist/railroad-74A4TZTK-CrQzn8Nm.mjs +3 -0
- package/dist/railroad-abnf-HS5TGJTU-BZYetxLz.mjs +3 -0
- package/dist/railroad-abnf-HS5TGJTU-CXU1aC4B.js +1 -0
- package/dist/railroad-ebnf-LZEXJU2U-D29kI3YW.js +1 -0
- package/dist/railroad-ebnf-LZEXJU2U-qgzTOmN6.mjs +3 -0
- package/dist/railroad-peg-WCYAUIDC-Bjs9Ws3P.mjs +3 -0
- package/dist/railroad-peg-WCYAUIDC-CXviP0hz.js +1 -0
- package/dist/railroadDiagram-O6MQD6OU-58kvwt7H.mjs +76 -0
- package/dist/railroadDiagram-O6MQD6OU-CKY3uzTc.js +1 -0
- package/dist/requirementDiagram-BXWQKSXE-0hZ04Q6h.js +84 -0
- package/dist/requirementDiagram-BXWQKSXE-CS673B5n.mjs +2224 -0
- package/dist/rough.esm-ChRLLRha.js +1 -0
- package/dist/rough.esm-DXYGHN3m.mjs +1361 -0
- package/dist/sankeyDiagram-P5KCCOFB-D1D6HfAM.mjs +972 -0
- package/dist/sankeyDiagram-P5KCCOFB-ciJb9Zr8.js +40 -0
- package/dist/sequenceDiagram-WJ2MYXX4-BXEznuI6.js +162 -0
- package/dist/sequenceDiagram-WJ2MYXX4-CI1VT8AG.mjs +4156 -0
- package/dist/sizeCapture-INFHLROL-BihkCH-7.js +1 -0
- package/dist/sizeCapture-INFHLROL-BmxqyOLj.mjs +46 -0
- package/dist/src-B4mN2BMl.js +1 -0
- package/dist/src-D_hsMyeP.mjs +2154 -0
- package/dist/stateDiagram-D77RDMKH-BQrSs72W.mjs +220 -0
- package/dist/stateDiagram-D77RDMKH-D2PtkW2U.js +1 -0
- package/dist/stateDiagram-v2-MP3YSRHH-CCbvNfk-.mjs +30 -0
- package/dist/stateDiagram-v2-MP3YSRHH-Dq1QuPeN.js +1 -0
- package/dist/swimlanes-42K2YHIH-CA316NPm.mjs +4979 -0
- package/dist/swimlanes-42K2YHIH-DlggBCTy.js +1 -0
- package/dist/swimlanesDiagram-VR7AAH4N-BV9PEIoG.js +8 -0
- package/dist/swimlanesDiagram-VR7AAH4N-BfrOCfdf.mjs +31 -0
- package/dist/timeline-definition-24CTP7MA-Bkd8rWNJ.js +120 -0
- package/dist/timeline-definition-24CTP7MA-BvkqNYt1.mjs +1069 -0
- package/dist/treeView-Q6P3EWNA-Aof3Cp1M.mjs +3 -0
- package/dist/treeView-Q6P3EWNA-BTzvdwbb.js +1 -0
- package/dist/treemap-WGGIJYW6-BNXGg99p.mjs +3 -0
- package/dist/treemap-WGGIJYW6-DfR4P2Hh.js +1 -0
- package/dist/types/runtime/app.d.ts +3 -3
- package/dist/types/runtime/components/AppearanceMenu.d.ts +2 -0
- package/dist/types/runtime/components/Builtins.d.ts +3 -3
- package/dist/types/runtime/components/Content.d.ts +1 -1
- package/dist/types/runtime/components/DmdRegistry.d.ts +4 -2
- package/dist/types/runtime/components/Layout.d.ts +1 -1
- package/dist/types/runtime/components/MermaidDiagram.d.ts +16 -0
- package/dist/types/runtime/components/Navbar.d.ts +1 -1
- package/dist/types/runtime/components/OfflineDownloadButton.d.ts +2 -0
- package/dist/types/runtime/components/Sidebar.d.ts +1 -1
- package/dist/types/runtime/components/TableOfContents.d.ts +2 -2
- package/dist/types/runtime/config-schema.d.ts +386 -0
- package/dist/types/runtime/config.d.ts +10 -3
- package/dist/types/runtime/index.d.ts +7 -5
- package/dist/types/runtime/loader/auto-indexer.d.ts +1 -1
- package/dist/types/runtime/loader/local-loader.d.ts +1 -1
- package/dist/types/runtime/loader/remote-github.d.ts +2 -2
- package/dist/types/runtime/loader/remote-gitlab.d.ts +2 -2
- package/dist/types/runtime/markdown/callouts.d.ts +1 -1
- package/dist/types/runtime/markdown/highlighter.d.ts +16 -16
- package/dist/types/runtime/markdown/mermaid.d.ts +82 -1
- package/dist/types/runtime/markdown/parser.d.ts +1 -1
- package/dist/types/runtime/markdown/renderer.d.ts +1 -1
- package/dist/types/runtime/offline-export.d.ts +26 -0
- package/dist/types/runtime/provider/DocProvider.d.ts +5 -5
- package/dist/types/runtime/provider/ThemeProvider.d.ts +13 -6
- package/dist/types/runtime/search/SearchModal.d.ts +2 -2
- package/dist/types/runtime/search/search-index.d.ts +1 -1
- package/dist/types/runtime/types.d.ts +28 -99
- package/dist/vennDiagram-4TSXK5OY-BOUFXjso.js +34 -0
- package/dist/vennDiagram-4TSXK5OY-CeOg3-hU.mjs +1880 -0
- package/dist/wardley-WFR3VGLG-BOYcSLd1.mjs +3 -0
- package/dist/wardley-WFR3VGLG-DWDqJSgm.js +1 -0
- package/dist/wardleyDiagram-VM6X3IG4-BhWgMjFr.js +78 -0
- package/dist/wardleyDiagram-VM6X3IG4-C31KoRmF.mjs +645 -0
- package/dist/xychartDiagram-S5SC5T6Z-1yU8zz6I.js +7 -0
- package/dist/xychartDiagram-S5SC5T6Z-BK7upFom.mjs +2210 -0
- package/package.json +15 -4
- package/schemas/docs.schema.json +166 -0
- package/templates/README.md +4 -4
- package/templates/docs.json +5 -2
- package/templates/getting-started.md +1 -1
- package/templates/guides/custom-components.md +2 -0
- package/templates/index.html +2 -4
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
import { m as e } from "./src-D_hsMyeP.mjs";
|
|
2
|
+
import { n as t } from "./chunk-Y2CYZVJY-i11wjrBe.mjs";
|
|
3
|
+
import { D as n, H as r, K as i, U as a, a as o, b as s, c, v as l, w as u, x as d, y as f } from "./chunk-DU6HZSFF-BEQZSmUu.mjs";
|
|
4
|
+
import { i as p } from "./chunk-75Z2AOVW-Dz0Sko9Y.mjs";
|
|
5
|
+
import { t as m } from "./chunk-CLGD4ZFX-DBkwyMMv.mjs";
|
|
6
|
+
import { n as h } from "./mermaid-parser.core-BRHibdUE.mjs";
|
|
7
|
+
import { t as g } from "./chunk-JWPE2WC7-DIKiF5cm.mjs";
|
|
8
|
+
//#region node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
|
|
9
|
+
var _ = /* @__PURE__ */ t((e, t) => {
|
|
10
|
+
let n = e <= 1 ? e * 100 : e;
|
|
11
|
+
if (n < 0 || n > 100) throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);
|
|
12
|
+
return n;
|
|
13
|
+
}, "toPercent"), v = /* @__PURE__ */ t((e, t, n) => ({
|
|
14
|
+
x: _(t, `${n} evolution`),
|
|
15
|
+
y: _(e, `${n} visibility`)
|
|
16
|
+
}), "toCoordinates"), y = /* @__PURE__ */ t((e) => {
|
|
17
|
+
if (e) {
|
|
18
|
+
if (e === "+<>") return "bidirectional";
|
|
19
|
+
if (e === "+<") return "backward";
|
|
20
|
+
if (e === "+>") return "forward";
|
|
21
|
+
}
|
|
22
|
+
}, "getFlowFromPort"), b = /* @__PURE__ */ t((e) => {
|
|
23
|
+
if (!e?.startsWith("+")) return {};
|
|
24
|
+
let t = /^\+'([^']*)'/.exec(e)?.[1];
|
|
25
|
+
return e.includes("<>") ? {
|
|
26
|
+
flow: "bidirectional",
|
|
27
|
+
label: t
|
|
28
|
+
} : e.includes("<") ? {
|
|
29
|
+
flow: "backward",
|
|
30
|
+
label: t
|
|
31
|
+
} : e.includes(">") ? {
|
|
32
|
+
flow: "forward",
|
|
33
|
+
label: t
|
|
34
|
+
} : { label: t };
|
|
35
|
+
}, "extractFlowFromArrow"), x = /* @__PURE__ */ t((e, t) => {
|
|
36
|
+
if (g(e, t), e.size && t.setSize(e.size.width, e.size.height), e.evolution) {
|
|
37
|
+
let n = e.evolution.stages.map((e) => e.secondName ? `${e.name.trim()} / ${e.secondName.trim()}` : e.name.trim()), r = e.evolution.stages.filter((e) => e.boundary !== void 0).map((e) => e.boundary);
|
|
38
|
+
t.updateAxes({
|
|
39
|
+
stages: n,
|
|
40
|
+
stageBoundaries: r
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (e.anchors.forEach((e) => {
|
|
44
|
+
let n = v(e.visibility, e.evolution, `Anchor "${e.name}"`);
|
|
45
|
+
t.addNode(e.name, e.name, n.x, n.y, "anchor");
|
|
46
|
+
}), e.components.forEach((e) => {
|
|
47
|
+
let n = v(e.visibility, e.evolution, `Component "${e.name}"`), r = e.label ? (e.label.negX ? -1 : 1) * e.label.offsetX : void 0, i = e.label ? (e.label.negY ? -1 : 1) * e.label.offsetY : void 0, a = e.decorator?.strategy;
|
|
48
|
+
t.addNode(e.name, e.name, n.x, n.y, "component", r, i, e.inertia, a);
|
|
49
|
+
}), e.notes.forEach((e) => {
|
|
50
|
+
let n = v(e.visibility, e.evolution, `Note "${e.text}"`);
|
|
51
|
+
t.addNote(e.text, n.x, n.y);
|
|
52
|
+
}), e.pipelines.forEach((e) => {
|
|
53
|
+
let n = t.getNode(e.parent);
|
|
54
|
+
if (!n || typeof n.y != "number") throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);
|
|
55
|
+
let r = n.y;
|
|
56
|
+
t.startPipeline(e.parent), e.components.forEach((n) => {
|
|
57
|
+
let i = `${e.parent}_${n.name}`, a = n.label ? (n.label.negX ? -1 : 1) * n.label.offsetX : void 0, o = n.label ? (n.label.negY ? -1 : 1) * n.label.offsetY : void 0, s = _(n.evolution, `Pipeline component "${n.name}" evolution`);
|
|
58
|
+
t.addNode(i, n.name, s, r, "pipeline-component", a, o), t.addPipelineComponent(e.parent, i);
|
|
59
|
+
});
|
|
60
|
+
}), e.links.forEach((e) => {
|
|
61
|
+
let n = !!e.arrow && (e.arrow.includes("-.->") || e.arrow.includes(".-.")), r = y(e.fromPort) ?? y(e.toPort), { flow: i, label: a } = b(e.arrow);
|
|
62
|
+
!r && i && (r = i);
|
|
63
|
+
let o = e.linkLabel, s = a ?? o;
|
|
64
|
+
t.addLink(t.resolveNodeId(e.from), t.resolveNodeId(e.to), n, s, r);
|
|
65
|
+
}), e.evolves.forEach((e) => {
|
|
66
|
+
let n = t.getNode(e.component);
|
|
67
|
+
if (n?.y !== void 0) {
|
|
68
|
+
let r = _(e.target, `Evolve target for "${e.component}"`);
|
|
69
|
+
t.addTrend(e.component, r, n.y);
|
|
70
|
+
}
|
|
71
|
+
}), e.annotations.length > 0) {
|
|
72
|
+
let n = e.annotations[0], r = v(n.x, n.y, "Annotations box");
|
|
73
|
+
t.setAnnotationsBox(r.x, r.y);
|
|
74
|
+
}
|
|
75
|
+
e.annotation.forEach((e) => {
|
|
76
|
+
let n = v(e.x, e.y, `Annotation ${e.number}`);
|
|
77
|
+
t.addAnnotation(e.number, [{
|
|
78
|
+
x: n.x,
|
|
79
|
+
y: n.y
|
|
80
|
+
}], e.text);
|
|
81
|
+
}), e.accelerators.forEach((e) => {
|
|
82
|
+
let n = v(e.x, e.y, `Accelerator "${e.name}"`);
|
|
83
|
+
t.addAccelerator(e.name, n.x, n.y);
|
|
84
|
+
}), e.deaccelerators.forEach((e) => {
|
|
85
|
+
let n = v(e.x, e.y, `Deaccelerator "${e.name}"`);
|
|
86
|
+
t.addDeaccelerator(e.name, n.x, n.y);
|
|
87
|
+
});
|
|
88
|
+
}, "populateDb"), S = {
|
|
89
|
+
parser: { yy: void 0 },
|
|
90
|
+
parse: /* @__PURE__ */ t(async (t) => {
|
|
91
|
+
let n = await h("wardley", t);
|
|
92
|
+
e.debug(n);
|
|
93
|
+
let r = S.parser?.yy;
|
|
94
|
+
if (!r || typeof r.addNode != "function") throw Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");
|
|
95
|
+
x(n, r);
|
|
96
|
+
}, "parse")
|
|
97
|
+
}, C = new class {
|
|
98
|
+
constructor() {
|
|
99
|
+
this.nodes = /* @__PURE__ */ new Map(), this.links = [], this.trends = /* @__PURE__ */ new Map(), this.pipelines = /* @__PURE__ */ new Map(), this.annotations = [], this.notes = [], this.accelerators = [], this.deaccelerators = [], this.axes = {};
|
|
100
|
+
}
|
|
101
|
+
static {
|
|
102
|
+
t(this, "WardleyBuilder");
|
|
103
|
+
}
|
|
104
|
+
addNode(e) {
|
|
105
|
+
let t = this.nodes.get(e.id) ?? {
|
|
106
|
+
id: e.id,
|
|
107
|
+
label: e.label
|
|
108
|
+
}, n = {
|
|
109
|
+
...t,
|
|
110
|
+
...e,
|
|
111
|
+
className: e.className ?? t.className,
|
|
112
|
+
labelOffsetX: e.labelOffsetX ?? t.labelOffsetX,
|
|
113
|
+
labelOffsetY: e.labelOffsetY ?? t.labelOffsetY
|
|
114
|
+
};
|
|
115
|
+
this.nodes.set(e.id, n);
|
|
116
|
+
}
|
|
117
|
+
addLink(e) {
|
|
118
|
+
this.links.push(e);
|
|
119
|
+
}
|
|
120
|
+
addTrend(e) {
|
|
121
|
+
this.trends.set(e.nodeId, e);
|
|
122
|
+
}
|
|
123
|
+
startPipeline(e) {
|
|
124
|
+
this.pipelines.set(e, {
|
|
125
|
+
nodeId: e,
|
|
126
|
+
componentIds: []
|
|
127
|
+
});
|
|
128
|
+
let t = this.nodes.get(e);
|
|
129
|
+
t && (t.isPipelineParent = !0);
|
|
130
|
+
}
|
|
131
|
+
addPipelineComponent(e, t) {
|
|
132
|
+
let n = this.pipelines.get(e);
|
|
133
|
+
n && n.componentIds.push(t);
|
|
134
|
+
let r = this.nodes.get(t);
|
|
135
|
+
r && (r.inPipeline = !0);
|
|
136
|
+
}
|
|
137
|
+
addAnnotation(e) {
|
|
138
|
+
this.annotations.push(e);
|
|
139
|
+
}
|
|
140
|
+
addNote(e) {
|
|
141
|
+
this.notes.push(e);
|
|
142
|
+
}
|
|
143
|
+
addAccelerator(e) {
|
|
144
|
+
this.accelerators.push(e);
|
|
145
|
+
}
|
|
146
|
+
addDeaccelerator(e) {
|
|
147
|
+
this.deaccelerators.push(e);
|
|
148
|
+
}
|
|
149
|
+
setAnnotationsBox(e, t) {
|
|
150
|
+
this.annotationsBox = {
|
|
151
|
+
x: e,
|
|
152
|
+
y: t
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
setAxes(e) {
|
|
156
|
+
this.axes = {
|
|
157
|
+
...this.axes,
|
|
158
|
+
...e
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
setSize(e, t) {
|
|
162
|
+
this.size = {
|
|
163
|
+
width: e,
|
|
164
|
+
height: t
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
getNode(e) {
|
|
168
|
+
return this.nodes.get(e);
|
|
169
|
+
}
|
|
170
|
+
resolveNodeId(e) {
|
|
171
|
+
if (this.nodes.has(e)) return e;
|
|
172
|
+
for (let [t, n] of this.nodes) if (n.label === e) return t;
|
|
173
|
+
return e;
|
|
174
|
+
}
|
|
175
|
+
build() {
|
|
176
|
+
let e = [];
|
|
177
|
+
for (let t of this.nodes.values()) {
|
|
178
|
+
if (typeof t.x != "number" || typeof t.y != "number") throw Error(`Node "${t.label}" is missing coordinates`);
|
|
179
|
+
e.push(t);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
nodes: e,
|
|
183
|
+
links: [...this.links],
|
|
184
|
+
trends: [...this.trends.values()],
|
|
185
|
+
pipelines: [...this.pipelines.values()],
|
|
186
|
+
annotations: [...this.annotations],
|
|
187
|
+
notes: [...this.notes],
|
|
188
|
+
accelerators: [...this.accelerators],
|
|
189
|
+
deaccelerators: [...this.deaccelerators],
|
|
190
|
+
annotationsBox: this.annotationsBox,
|
|
191
|
+
axes: { ...this.axes },
|
|
192
|
+
size: this.size
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
clear() {
|
|
196
|
+
this.nodes.clear(), this.links = [], this.trends.clear(), this.pipelines.clear(), this.annotations = [], this.notes = [], this.accelerators = [], this.deaccelerators = [], this.annotationsBox = void 0, this.axes = {}, this.size = void 0;
|
|
197
|
+
}
|
|
198
|
+
}();
|
|
199
|
+
function w() {
|
|
200
|
+
return d()["wardley-beta"];
|
|
201
|
+
}
|
|
202
|
+
t(w, "getConfig");
|
|
203
|
+
function T(e, t, n, r, i, a, o, s, c) {
|
|
204
|
+
C.addNode({
|
|
205
|
+
id: e,
|
|
206
|
+
label: t,
|
|
207
|
+
x: n,
|
|
208
|
+
y: r,
|
|
209
|
+
className: i,
|
|
210
|
+
labelOffsetX: a,
|
|
211
|
+
labelOffsetY: o,
|
|
212
|
+
inertia: s,
|
|
213
|
+
sourceStrategy: c
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
t(T, "addNode");
|
|
217
|
+
function E(e, t, n = !1, r, i) {
|
|
218
|
+
C.addLink({
|
|
219
|
+
source: e,
|
|
220
|
+
target: t,
|
|
221
|
+
dashed: n,
|
|
222
|
+
label: r,
|
|
223
|
+
flow: i
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
t(E, "addLink");
|
|
227
|
+
function D(e, t, n) {
|
|
228
|
+
C.addTrend({
|
|
229
|
+
nodeId: e,
|
|
230
|
+
targetX: t,
|
|
231
|
+
targetY: n
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
t(D, "addTrend");
|
|
235
|
+
function O(e, t, n) {
|
|
236
|
+
C.addAnnotation({
|
|
237
|
+
number: e,
|
|
238
|
+
coordinates: t,
|
|
239
|
+
text: n
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
t(O, "addAnnotation");
|
|
243
|
+
function k(e, t, n) {
|
|
244
|
+
C.addNote({
|
|
245
|
+
text: e,
|
|
246
|
+
x: t,
|
|
247
|
+
y: n
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
t(k, "addNote");
|
|
251
|
+
function A(e, t, n) {
|
|
252
|
+
C.addAccelerator({
|
|
253
|
+
name: e,
|
|
254
|
+
x: t,
|
|
255
|
+
y: n
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
t(A, "addAccelerator");
|
|
259
|
+
function j(e, t, n) {
|
|
260
|
+
C.addDeaccelerator({
|
|
261
|
+
name: e,
|
|
262
|
+
x: t,
|
|
263
|
+
y: n
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
t(j, "addDeaccelerator");
|
|
267
|
+
function M(e, t) {
|
|
268
|
+
C.setAnnotationsBox(e, t);
|
|
269
|
+
}
|
|
270
|
+
t(M, "setAnnotationsBox");
|
|
271
|
+
function N(e, t) {
|
|
272
|
+
C.setSize(e, t);
|
|
273
|
+
}
|
|
274
|
+
t(N, "setSize");
|
|
275
|
+
function P(e) {
|
|
276
|
+
C.startPipeline(e);
|
|
277
|
+
}
|
|
278
|
+
t(P, "startPipeline");
|
|
279
|
+
function F(e, t) {
|
|
280
|
+
C.addPipelineComponent(e, t);
|
|
281
|
+
}
|
|
282
|
+
t(F, "addPipelineComponent");
|
|
283
|
+
function I(e) {
|
|
284
|
+
C.setAxes(e);
|
|
285
|
+
}
|
|
286
|
+
t(I, "updateAxes");
|
|
287
|
+
function L(e) {
|
|
288
|
+
return C.getNode(e);
|
|
289
|
+
}
|
|
290
|
+
t(L, "getNode");
|
|
291
|
+
function R(e) {
|
|
292
|
+
return C.resolveNodeId(e);
|
|
293
|
+
}
|
|
294
|
+
t(R, "resolveNodeId");
|
|
295
|
+
function z() {
|
|
296
|
+
return C.build();
|
|
297
|
+
}
|
|
298
|
+
t(z, "getWardleyData");
|
|
299
|
+
function B() {
|
|
300
|
+
C.clear(), o();
|
|
301
|
+
}
|
|
302
|
+
t(B, "clear");
|
|
303
|
+
var V = {
|
|
304
|
+
getConfig: w,
|
|
305
|
+
addNode: T,
|
|
306
|
+
addLink: E,
|
|
307
|
+
addTrend: D,
|
|
308
|
+
addAnnotation: O,
|
|
309
|
+
addNote: k,
|
|
310
|
+
addAccelerator: A,
|
|
311
|
+
addDeaccelerator: j,
|
|
312
|
+
setAnnotationsBox: M,
|
|
313
|
+
setSize: N,
|
|
314
|
+
startPipeline: P,
|
|
315
|
+
addPipelineComponent: F,
|
|
316
|
+
updateAxes: I,
|
|
317
|
+
getNode: L,
|
|
318
|
+
resolveNodeId: R,
|
|
319
|
+
getWardleyData: z,
|
|
320
|
+
clear: B,
|
|
321
|
+
setAccTitle: a,
|
|
322
|
+
getAccTitle: f,
|
|
323
|
+
setDiagramTitle: i,
|
|
324
|
+
getDiagramTitle: u,
|
|
325
|
+
getAccDescription: l,
|
|
326
|
+
setAccDescription: r
|
|
327
|
+
}, H = [
|
|
328
|
+
"Genesis",
|
|
329
|
+
"Custom Built",
|
|
330
|
+
"Product",
|
|
331
|
+
"Commodity"
|
|
332
|
+
], U = /* @__PURE__ */ t(() => {
|
|
333
|
+
let { themeVariables: e } = d();
|
|
334
|
+
return {
|
|
335
|
+
backgroundColor: e.wardley?.backgroundColor ?? e.background ?? "#fff",
|
|
336
|
+
axisColor: e.wardley?.axisColor ?? "#000",
|
|
337
|
+
axisTextColor: e.wardley?.axisTextColor ?? e.primaryTextColor ?? "#222",
|
|
338
|
+
gridColor: e.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
|
|
339
|
+
componentFill: e.wardley?.componentFill ?? "#fff",
|
|
340
|
+
componentStroke: e.wardley?.componentStroke ?? "#000",
|
|
341
|
+
componentLabelColor: e.wardley?.componentLabelColor ?? e.primaryTextColor ?? "#222",
|
|
342
|
+
linkStroke: e.wardley?.linkStroke ?? "#000",
|
|
343
|
+
evolutionStroke: e.wardley?.evolutionStroke ?? "#dc3545",
|
|
344
|
+
annotationStroke: e.wardley?.annotationStroke ?? "#000",
|
|
345
|
+
annotationTextColor: e.wardley?.annotationTextColor ?? e.primaryTextColor ?? "#222",
|
|
346
|
+
annotationFill: e.wardley?.annotationFill ?? e.background ?? "#fff"
|
|
347
|
+
};
|
|
348
|
+
}, "getTheme"), W = /* @__PURE__ */ t(() => {
|
|
349
|
+
let e = d()["wardley-beta"];
|
|
350
|
+
return {
|
|
351
|
+
width: e?.width ?? 900,
|
|
352
|
+
height: e?.height ?? 600,
|
|
353
|
+
padding: e?.padding ?? 48,
|
|
354
|
+
nodeRadius: e?.nodeRadius ?? 6,
|
|
355
|
+
nodeLabelOffset: e?.nodeLabelOffset ?? 8,
|
|
356
|
+
axisFontSize: e?.axisFontSize ?? 12,
|
|
357
|
+
labelFontSize: e?.labelFontSize ?? 10,
|
|
358
|
+
showGrid: e?.showGrid ?? !1,
|
|
359
|
+
useMaxWidth: e?.useMaxWidth ?? !0
|
|
360
|
+
};
|
|
361
|
+
}, "getConfigValues"), G = {
|
|
362
|
+
parser: S,
|
|
363
|
+
db: V,
|
|
364
|
+
renderer: { draw: /* @__PURE__ */ t((n, r, i, a) => {
|
|
365
|
+
e.debug("Rendering Wardley map\n" + n);
|
|
366
|
+
let o = W(), s = U(), l = o.nodeRadius * 1.6, u = a.db, d = u.getWardleyData(), f = u.getDiagramTitle(), p = d.size?.width ?? o.width, h = d.size?.height ?? o.height, g = m(r);
|
|
367
|
+
g.selectAll("*").remove(), c(g, h, p, o.useMaxWidth), g.attr("viewBox", `0 0 ${p} ${h}`);
|
|
368
|
+
let _ = g.append("g").attr("class", "wardley-map"), v = g.append("defs");
|
|
369
|
+
v.append("marker").attr("id", `arrow-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", s.evolutionStroke).attr("stroke", "none"), v.append("marker").attr("id", `link-arrow-end-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", s.linkStroke).attr("stroke", "none"), v.append("marker").attr("id", `link-arrow-start-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 1).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z").attr("fill", s.linkStroke).attr("stroke", "none"), _.append("rect").attr("class", "wardley-background").attr("width", p).attr("height", h).attr("fill", s.backgroundColor);
|
|
370
|
+
let y = p - o.padding * 2, b = h - o.padding * 2;
|
|
371
|
+
f && _.append("text").attr("class", "wardley-title").attr("x", p / 2).attr("y", o.padding / 2).attr("fill", s.axisTextColor).attr("font-size", o.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(f);
|
|
372
|
+
let x = /* @__PURE__ */ t((e) => o.padding + e / 100 * y, "projectX"), S = /* @__PURE__ */ t((e) => h - o.padding - e / 100 * b, "projectY"), C = _.append("g").attr("class", "wardley-axes");
|
|
373
|
+
C.append("line").attr("x1", o.padding).attr("x2", p - o.padding).attr("y1", h - o.padding).attr("y2", h - o.padding).attr("stroke", s.axisColor).attr("stroke-width", 1), C.append("line").attr("x1", o.padding).attr("x2", o.padding).attr("y1", o.padding).attr("y2", h - o.padding).attr("stroke", s.axisColor).attr("stroke-width", 1);
|
|
374
|
+
let w = d.axes.xLabel ?? "Evolution", T = d.axes.yLabel ?? "Visibility";
|
|
375
|
+
C.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", o.padding + y / 2).attr("y", h - o.padding / 4).attr("fill", s.axisTextColor).attr("font-size", o.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(w), C.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", o.padding / 3).attr("y", o.padding + b / 2).attr("fill", s.axisTextColor).attr("font-size", o.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr("transform", `rotate(-90 ${o.padding / 3} ${o.padding + b / 2})`).text(T);
|
|
376
|
+
let E = d.axes.stages && d.axes.stages.length > 0 ? d.axes.stages : H;
|
|
377
|
+
if (E.length > 0) {
|
|
378
|
+
let e = _.append("g").attr("class", "wardley-stages"), t = d.axes.stageBoundaries, n = [];
|
|
379
|
+
if (t && t.length === E.length) {
|
|
380
|
+
let e = 0;
|
|
381
|
+
t.forEach((t) => {
|
|
382
|
+
n.push({
|
|
383
|
+
start: e,
|
|
384
|
+
end: t
|
|
385
|
+
}), e = t;
|
|
386
|
+
});
|
|
387
|
+
} else {
|
|
388
|
+
let e = 1 / E.length;
|
|
389
|
+
E.forEach((t, r) => {
|
|
390
|
+
n.push({
|
|
391
|
+
start: r * e,
|
|
392
|
+
end: (r + 1) * e
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
E.forEach((t, r) => {
|
|
397
|
+
let i = n[r], a = o.padding + i.start * y, c = (a + (o.padding + i.end * y)) / 2;
|
|
398
|
+
r > 0 && e.append("line").attr("x1", a).attr("x2", a).attr("y1", o.padding).attr("y2", h - o.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", .8), e.append("text").attr("class", "wardley-stage-label").attr("x", c).attr("y", h - o.padding / 1.5).attr("fill", s.axisTextColor).attr("font-size", o.axisFontSize - 2).attr("text-anchor", "middle").text(t);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (o.showGrid) {
|
|
402
|
+
let e = _.append("g").attr("class", "wardley-grid");
|
|
403
|
+
for (let t = 1; t < 4; t++) {
|
|
404
|
+
let n = t / 4, r = o.padding + y * n;
|
|
405
|
+
e.append("line").attr("x1", r).attr("x2", r).attr("y1", o.padding).attr("y2", h - o.padding).attr("stroke", s.gridColor).attr("stroke-dasharray", "2 6"), e.append("line").attr("x1", o.padding).attr("x2", p - o.padding).attr("y1", h - o.padding - b * n).attr("y2", h - o.padding - b * n).attr("stroke", s.gridColor).attr("stroke-dasharray", "2 6");
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
let D = /* @__PURE__ */ new Map();
|
|
409
|
+
if (d.nodes.forEach((e) => {
|
|
410
|
+
D.set(e.id, {
|
|
411
|
+
x: x(e.x),
|
|
412
|
+
y: S(e.y),
|
|
413
|
+
node: e
|
|
414
|
+
});
|
|
415
|
+
}), d.pipelines.length > 0) {
|
|
416
|
+
let e = _.append("g").attr("class", "wardley-pipelines"), t = _.append("g").attr("class", "wardley-pipeline-links");
|
|
417
|
+
d.pipelines.forEach((n) => {
|
|
418
|
+
if (n.componentIds.length === 0) return;
|
|
419
|
+
let r = n.componentIds.map((e) => ({
|
|
420
|
+
id: e,
|
|
421
|
+
pos: D.get(e),
|
|
422
|
+
node: d.nodes.find((t) => t.id === e)
|
|
423
|
+
})).filter((e) => e.pos && e.node).sort((e, t) => e.node.x - t.node.x);
|
|
424
|
+
for (let e = 0; e < r.length - 1; e++) {
|
|
425
|
+
let n = r[e], i = r[e + 1];
|
|
426
|
+
t.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", n.pos.x).attr("y1", n.pos.y).attr("x2", i.pos.x).attr("y2", i.pos.y).attr("stroke", s.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
|
|
427
|
+
}
|
|
428
|
+
let i = Infinity, a = -Infinity, c = 0;
|
|
429
|
+
if (n.componentIds.forEach((e) => {
|
|
430
|
+
let t = D.get(e);
|
|
431
|
+
t && (i = Math.min(i, t.x), a = Math.max(a, t.x), c = t.y);
|
|
432
|
+
}), i !== Infinity && a !== -Infinity) {
|
|
433
|
+
let t = o.nodeRadius * 4, r = c - t / 2, u = D.get(n.nodeId);
|
|
434
|
+
u && (u.x = (i + a) / 2, u.y = r - l / 6), e.append("rect").attr("class", "wardley-pipeline-box").attr("x", i - 15).attr("y", r).attr("width", a - i + 30).attr("height", t).attr("fill", "none").attr("stroke", s.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
let O = _.append("g").attr("class", "wardley-links"), k = /* @__PURE__ */ new Map();
|
|
439
|
+
d.pipelines.forEach((e) => {
|
|
440
|
+
k.set(e.nodeId, new Set(e.componentIds));
|
|
441
|
+
});
|
|
442
|
+
let A = d.links.filter((e) => !(!D.has(e.source) || !D.has(e.target) || k.get(e.target)?.has(e.source)));
|
|
443
|
+
O.selectAll("line").data(A).enter().append("line").attr("class", (e) => `wardley-link${e.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (e) => {
|
|
444
|
+
let t = D.get(e.source), n = D.get(e.target), r = d.nodes.find((t) => t.id === e.source).isPipelineParent ? l / Math.sqrt(2) : o.nodeRadius, i = n.x - t.x, a = n.y - t.y, s = Math.sqrt(i * i + a * a);
|
|
445
|
+
return t.x + i / s * r;
|
|
446
|
+
}).attr("y1", (e) => {
|
|
447
|
+
let t = D.get(e.source), n = D.get(e.target), r = d.nodes.find((t) => t.id === e.source).isPipelineParent ? l / Math.sqrt(2) : o.nodeRadius, i = n.x - t.x, a = n.y - t.y, s = Math.sqrt(i * i + a * a);
|
|
448
|
+
return t.y + a / s * r;
|
|
449
|
+
}).attr("x2", (e) => {
|
|
450
|
+
let t = D.get(e.source), n = D.get(e.target), r = d.nodes.find((t) => t.id === e.target).isPipelineParent ? l / Math.sqrt(2) : o.nodeRadius, i = t.x - n.x, a = t.y - n.y, s = Math.sqrt(i * i + a * a);
|
|
451
|
+
return n.x + i / s * r;
|
|
452
|
+
}).attr("y2", (e) => {
|
|
453
|
+
let t = D.get(e.source), n = D.get(e.target), r = d.nodes.find((t) => t.id === e.target).isPipelineParent ? l / Math.sqrt(2) : o.nodeRadius, i = t.x - n.x, a = t.y - n.y, s = Math.sqrt(i * i + a * a);
|
|
454
|
+
return n.y + a / s * r;
|
|
455
|
+
}).attr("stroke", s.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (e) => e.dashed ? "6 6" : null).attr("marker-end", (e) => e.flow === "forward" || e.flow === "bidirectional" ? `url(#link-arrow-end-${r})` : null).attr("marker-start", (e) => e.flow === "backward" || e.flow === "bidirectional" ? `url(#link-arrow-start-${r})` : null), O.selectAll("text").data(A.filter((e) => e.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (e) => {
|
|
456
|
+
let t = D.get(e.source), n = D.get(e.target), r = (t.x + n.x) / 2, i = n.y - t.y, a = n.x - t.x;
|
|
457
|
+
return r + i / Math.sqrt(a * a + i * i) * 8;
|
|
458
|
+
}).attr("y", (e) => {
|
|
459
|
+
let t = D.get(e.source), n = D.get(e.target), r = (t.y + n.y) / 2, i = n.x - t.x, a = n.y - t.y, o = Math.sqrt(i * i + a * a);
|
|
460
|
+
return r + -i / o * 8;
|
|
461
|
+
}).attr("fill", s.axisTextColor).attr("font-size", o.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (e) => {
|
|
462
|
+
let t = D.get(e.source), n = D.get(e.target), r = (t.x + n.x) / 2, i = (t.y + n.y) / 2, a = n.x - t.x, o = n.y - t.y, s = Math.sqrt(a * a + o * o), c = o / s, l = -a / s, u = r + c * 8, d = i + l * 8, f = Math.atan2(o, a) * 180 / Math.PI;
|
|
463
|
+
return (f > 90 || f < -90) && (f += 180), `rotate(${f} ${u} ${d})`;
|
|
464
|
+
}).text((e) => e.label);
|
|
465
|
+
let j = _.append("g").attr("class", "wardley-trends"), M = d.trends.map((e) => {
|
|
466
|
+
let t = D.get(e.nodeId);
|
|
467
|
+
if (!t) return null;
|
|
468
|
+
let n = x(e.targetX), r = S(e.targetY), i = n - t.x, a = r - t.y, s = Math.sqrt(i * i + a * a), c = o.nodeRadius + 2;
|
|
469
|
+
return {
|
|
470
|
+
origin: t,
|
|
471
|
+
targetX: n,
|
|
472
|
+
targetY: r,
|
|
473
|
+
adjustedX2: s > c ? n - i / s * c : n,
|
|
474
|
+
adjustedY2: s > c ? r - a / s * c : r
|
|
475
|
+
};
|
|
476
|
+
}).filter((e) => e !== null);
|
|
477
|
+
j.selectAll("line").data(M).enter().append("line").attr("class", "wardley-trend").attr("x1", (e) => e.origin.x).attr("y1", (e) => e.origin.y).attr("x2", (e) => e.adjustedX2).attr("y2", (e) => e.adjustedY2).attr("stroke", s.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${r})`);
|
|
478
|
+
let N = _.append("g").attr("class", "wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class", (e) => ["wardley-node", e.className ? `wardley-node--${e.className}` : ""].filter(Boolean).join(" "));
|
|
479
|
+
N.filter((e) => e.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y).attr("r", o.nodeRadius * 2).attr("fill", "#666").attr("stroke", s.componentStroke).attr("stroke-width", 1), N.filter((e) => e.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y).attr("r", o.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", s.componentStroke).attr("stroke-width", 1), N.filter((e) => e.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y).attr("r", o.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1);
|
|
480
|
+
let P = N.filter((e) => e.sourceStrategy === "market");
|
|
481
|
+
P.append("circle").attr("class", "wardley-market-overlay").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y).attr("r", o.nodeRadius * 2).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 1), N.filter((e) => !e.isPipelineParent && e.sourceStrategy !== "market" && e.className !== "anchor").append("circle").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y).attr("r", o.nodeRadius).attr("fill", s.componentFill).attr("stroke", s.componentStroke).attr("stroke-width", 1);
|
|
482
|
+
let F = o.nodeRadius * .7, I = o.nodeRadius * 1.2;
|
|
483
|
+
if (P.append("line").attr("class", "wardley-market-line").attr("x1", (e) => D.get(e.id).x).attr("y1", (e) => D.get(e.id).y - I).attr("x2", (e) => D.get(e.id).x - I * Math.cos(Math.PI / 6)).attr("y2", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("stroke", s.componentStroke).attr("stroke-width", 1), P.append("line").attr("class", "wardley-market-line").attr("x1", (e) => D.get(e.id).x - I * Math.cos(Math.PI / 6)).attr("y1", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("x2", (e) => D.get(e.id).x + I * Math.cos(Math.PI / 6)).attr("y2", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("stroke", s.componentStroke).attr("stroke-width", 1), P.append("line").attr("class", "wardley-market-line").attr("x1", (e) => D.get(e.id).x + I * Math.cos(Math.PI / 6)).attr("y1", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("x2", (e) => D.get(e.id).x).attr("y2", (e) => D.get(e.id).y - I).attr("stroke", s.componentStroke).attr("stroke-width", 1), P.append("circle").attr("class", "wardley-market-dot").attr("cx", (e) => D.get(e.id).x).attr("cy", (e) => D.get(e.id).y - I).attr("r", F).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 2), P.append("circle").attr("class", "wardley-market-dot").attr("cx", (e) => D.get(e.id).x - I * Math.cos(Math.PI / 6)).attr("cy", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("r", F).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 2), P.append("circle").attr("class", "wardley-market-dot").attr("cx", (e) => D.get(e.id).x + I * Math.cos(Math.PI / 6)).attr("cy", (e) => D.get(e.id).y + I * Math.sin(Math.PI / 6)).attr("r", F).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 2), N.filter((e) => e.isPipelineParent === !0).append("rect").attr("x", (e) => D.get(e.id).x - l / 2).attr("y", (e) => D.get(e.id).y - l / 2).attr("width", l).attr("height", l).attr("fill", s.componentFill).attr("stroke", s.componentStroke).attr("stroke-width", 1), N.filter((e) => e.inertia === !0).append("line").attr("class", "wardley-inertia").attr("x1", (e) => {
|
|
484
|
+
let t = D.get(e.id), n = e.isPipelineParent ? l / 2 + 15 : o.nodeRadius + 15;
|
|
485
|
+
return e.sourceStrategy && (n += o.nodeRadius + 10), t.x + n;
|
|
486
|
+
}).attr("y1", (e) => {
|
|
487
|
+
let t = D.get(e.id), n = e.isPipelineParent ? l : o.nodeRadius * 2;
|
|
488
|
+
return t.y - n / 2;
|
|
489
|
+
}).attr("x2", (e) => {
|
|
490
|
+
let t = D.get(e.id), n = e.isPipelineParent ? l / 2 + 15 : o.nodeRadius + 15;
|
|
491
|
+
return e.sourceStrategy && (n += o.nodeRadius + 10), t.x + n;
|
|
492
|
+
}).attr("y2", (e) => {
|
|
493
|
+
let t = D.get(e.id), n = e.isPipelineParent ? l : o.nodeRadius * 2;
|
|
494
|
+
return t.y + n / 2;
|
|
495
|
+
}).attr("stroke", s.componentStroke).attr("stroke-width", 6), N.append("text").attr("x", (e) => {
|
|
496
|
+
let t = D.get(e.id);
|
|
497
|
+
if (e.className === "anchor") return e.labelOffsetX === void 0 ? t.x : t.x + e.labelOffsetX;
|
|
498
|
+
let n = o.nodeLabelOffset;
|
|
499
|
+
e.sourceStrategy && e.labelOffsetX === void 0 && (n += 10);
|
|
500
|
+
let r = e.labelOffsetX ?? n;
|
|
501
|
+
return t.x + r;
|
|
502
|
+
}).attr("y", (e) => {
|
|
503
|
+
let t = D.get(e.id);
|
|
504
|
+
if (e.className === "anchor") return e.labelOffsetY === void 0 ? t.y - 3 : t.y + e.labelOffsetY;
|
|
505
|
+
let n = -o.nodeLabelOffset;
|
|
506
|
+
e.sourceStrategy && e.labelOffsetY === void 0 && (n -= 10);
|
|
507
|
+
let r = e.labelOffsetY ?? n;
|
|
508
|
+
return t.y + r;
|
|
509
|
+
}).attr("class", "wardley-node-label").attr("fill", (e) => e.className === "evolved" ? s.evolutionStroke : e.className === "anchor" ? "#000" : s.componentLabelColor).attr("font-size", o.labelFontSize).attr("font-weight", (e) => e.className === "anchor" ? "bold" : "normal").attr("text-anchor", (e) => e.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (e) => e.className === "anchor" ? "middle" : "auto").text((e) => e.label), d.annotations.length > 0) {
|
|
510
|
+
let e = _.append("g").attr("class", "wardley-annotations");
|
|
511
|
+
if (d.annotations.forEach((t) => {
|
|
512
|
+
let n = t.coordinates.map((e) => ({
|
|
513
|
+
x: x(e.x),
|
|
514
|
+
y: S(e.y)
|
|
515
|
+
}));
|
|
516
|
+
if (n.length > 1) for (let t = 0; t < n.length - 1; t++) e.append("line").attr("class", "wardley-annotation-line").attr("x1", n[t].x).attr("y1", n[t].y).attr("x2", n[t + 1].x).attr("y2", n[t + 1].y).attr("stroke", s.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4");
|
|
517
|
+
n.forEach((n) => {
|
|
518
|
+
let r = e.append("g").attr("class", "wardley-annotation");
|
|
519
|
+
r.append("circle").attr("cx", n.x).attr("cy", n.y).attr("r", 10).attr("fill", "white").attr("stroke", s.axisColor).attr("stroke-width", 1.5), r.append("text").attr("x", n.x).attr("y", n.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", s.axisTextColor).attr("font-weight", "bold").text(t.number);
|
|
520
|
+
});
|
|
521
|
+
}), d.annotationsBox) {
|
|
522
|
+
let t = x(d.annotationsBox.x), n = S(d.annotationsBox.y), r = e.append("g").attr("class", "wardley-annotations-box"), i = [...d.annotations].filter((e) => e.text).sort((e, t) => e.number - t.number), a = [];
|
|
523
|
+
if (i.forEach((e, i) => {
|
|
524
|
+
let o = r.append("text").attr("x", t + 10).attr("y", n + 10 + (i + 1) * 16).attr("font-size", 11).attr("fill", s.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${e.number}. ${e.text}`);
|
|
525
|
+
a.push(o);
|
|
526
|
+
}), a.length > 0) {
|
|
527
|
+
let e = 0, c = 0;
|
|
528
|
+
a.forEach((t) => {
|
|
529
|
+
let n = t.node(), r = n.getComputedTextLength();
|
|
530
|
+
e = Math.max(e, r);
|
|
531
|
+
let i = n.getBBox();
|
|
532
|
+
c = Math.max(c, i.height);
|
|
533
|
+
});
|
|
534
|
+
let l = e + 20 + 105, u = i.length * 16 + 20 + c / 2, d = o.padding, f = p - o.padding - l, m = o.padding, g = h - o.padding - u;
|
|
535
|
+
t = Math.max(d, Math.min(t, f)), n = Math.max(m, Math.min(n, g)), a.forEach((e, r) => {
|
|
536
|
+
e.attr("x", t + 10).attr("y", n + 10 + (r + 1) * 16);
|
|
537
|
+
}), r.insert("rect", "text").attr("x", t).attr("y", n).attr("width", l).attr("height", u).attr("fill", "white").attr("stroke", s.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (d.notes.length > 0) {
|
|
542
|
+
let e = _.append("g").attr("class", "wardley-notes");
|
|
543
|
+
d.notes.forEach((t) => {
|
|
544
|
+
let n = x(t.x), r = S(t.y);
|
|
545
|
+
e.append("text").attr("x", n).attr("y", r).attr("text-anchor", "start").attr("font-size", 11).attr("fill", s.axisTextColor).attr("font-weight", "bold").text(t.text);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
if (d.accelerators.length > 0) {
|
|
549
|
+
let e = _.append("g").attr("class", "wardley-accelerators");
|
|
550
|
+
d.accelerators.forEach((t) => {
|
|
551
|
+
let n = x(t.x), r = S(t.y), i = `
|
|
552
|
+
M ${n} ${r - 15}
|
|
553
|
+
L ${n + 60 - 20} ${r - 15}
|
|
554
|
+
L ${n + 60 - 20} ${r - 15 - 8}
|
|
555
|
+
L ${n + 60} ${r}
|
|
556
|
+
L ${n + 60 - 20} ${r + 15 + 8}
|
|
557
|
+
L ${n + 60 - 20} ${r + 15}
|
|
558
|
+
L ${n} ${r + 15}
|
|
559
|
+
Z
|
|
560
|
+
`;
|
|
561
|
+
e.append("path").attr("d", i).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 1), e.append("text").attr("x", n + 30).attr("y", r + 15 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", s.axisTextColor).attr("font-weight", "bold").text(t.name);
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
if (d.deaccelerators.length > 0) {
|
|
565
|
+
let e = _.append("g").attr("class", "wardley-deaccelerators");
|
|
566
|
+
d.deaccelerators.forEach((t) => {
|
|
567
|
+
let n = x(t.x), r = S(t.y), i = `
|
|
568
|
+
M ${n + 60} ${r - 15}
|
|
569
|
+
L ${n + 20} ${r - 15}
|
|
570
|
+
L ${n + 20} ${r - 15 - 8}
|
|
571
|
+
L ${n} ${r}
|
|
572
|
+
L ${n + 20} ${r + 15 + 8}
|
|
573
|
+
L ${n + 20} ${r + 15}
|
|
574
|
+
L ${n + 60} ${r + 15}
|
|
575
|
+
Z
|
|
576
|
+
`;
|
|
577
|
+
e.append("path").attr("d", i).attr("fill", "white").attr("stroke", s.componentStroke).attr("stroke-width", 1), e.append("text").attr("x", n + 30).attr("y", r + 15 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", s.axisTextColor).attr("font-weight", "bold").text(t.name);
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}, "draw") },
|
|
581
|
+
styles: /* @__PURE__ */ t(({ wardley: e } = {}) => {
|
|
582
|
+
let t = n(), r = s(), i = p(t, r.themeVariables), a = p(i.wardley, e);
|
|
583
|
+
return `
|
|
584
|
+
.wardley-background {
|
|
585
|
+
fill: ${a.backgroundColor};
|
|
586
|
+
}
|
|
587
|
+
.wardley-axes line, .wardley-axes path {
|
|
588
|
+
stroke: ${a.axisColor};
|
|
589
|
+
}
|
|
590
|
+
.wardley-axis-label {
|
|
591
|
+
fill: ${a.axisTextColor};
|
|
592
|
+
}
|
|
593
|
+
.wardley-stage-label {
|
|
594
|
+
fill: ${a.axisTextColor};
|
|
595
|
+
}
|
|
596
|
+
.wardley-grid line {
|
|
597
|
+
stroke: ${a.gridColor};
|
|
598
|
+
}
|
|
599
|
+
.wardley-node circle {
|
|
600
|
+
fill: ${a.componentFill};
|
|
601
|
+
stroke: ${a.componentStroke};
|
|
602
|
+
}
|
|
603
|
+
.wardley-node-label {
|
|
604
|
+
fill: ${a.componentLabelColor};
|
|
605
|
+
}
|
|
606
|
+
.wardley-link {
|
|
607
|
+
stroke: ${a.linkStroke};
|
|
608
|
+
}
|
|
609
|
+
.wardley-link--dashed {
|
|
610
|
+
stroke-dasharray: 4 4;
|
|
611
|
+
}
|
|
612
|
+
.wardley-link-label {
|
|
613
|
+
fill: ${a.axisTextColor};
|
|
614
|
+
}
|
|
615
|
+
.wardley-trend line {
|
|
616
|
+
stroke: ${a.evolutionStroke};
|
|
617
|
+
}
|
|
618
|
+
.wardley-annotation-line {
|
|
619
|
+
stroke: ${a.annotationStroke};
|
|
620
|
+
}
|
|
621
|
+
.wardley-annotation circle {
|
|
622
|
+
fill: ${a.annotationFill};
|
|
623
|
+
stroke: ${a.annotationStroke};
|
|
624
|
+
}
|
|
625
|
+
.wardley-annotation text {
|
|
626
|
+
fill: ${a.annotationTextColor};
|
|
627
|
+
}
|
|
628
|
+
.wardley-annotations-box rect {
|
|
629
|
+
fill: ${a.annotationFill};
|
|
630
|
+
stroke: ${a.annotationStroke};
|
|
631
|
+
}
|
|
632
|
+
.wardley-annotations-box text {
|
|
633
|
+
fill: ${a.annotationTextColor};
|
|
634
|
+
}
|
|
635
|
+
.wardley-pipeline-box {
|
|
636
|
+
stroke: ${a.componentStroke};
|
|
637
|
+
}
|
|
638
|
+
.wardley-notes text {
|
|
639
|
+
fill: ${a.axisTextColor};
|
|
640
|
+
}
|
|
641
|
+
`;
|
|
642
|
+
}, "styles")
|
|
643
|
+
};
|
|
644
|
+
//#endregion
|
|
645
|
+
export { G as diagram };
|