@loopstack/loopstack-studio 0.25.0 → 0.25.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/dist/components/ai-elements/message.js +2 -2
- package/dist/components/ai-elements/reasoning.js +9 -9
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
- package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
- package/dist/node_modules/katex/dist/katex.js +1256 -1209
- package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
- package/dist/node_modules/lodash-es/_baseClone.js +2 -2
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseToString.js +1 -1
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/flatMap.js +1 -1
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
- package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
- package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
- package/dist/node_modules/remend/dist/index.js +333 -264
- package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
- package/dist/node_modules/streamdown/dist/index.js +1 -1
- package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
- package/dist/pages/DashboardPage.js +3 -3
- package/package.json +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
- package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
- package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
- package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
- package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
- package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
- package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
- package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
- package/dist/node_modules/lodash-es/_baseSome.js +0 -9
- package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
- package/dist/node_modules/lodash-es/assign.js +0 -14
- package/dist/node_modules/lodash-es/compact.js +0 -9
- package/dist/node_modules/lodash-es/difference.js +0 -8
- package/dist/node_modules/lodash-es/drop.js +0 -8
- package/dist/node_modules/lodash-es/dropRight.js +0 -8
- package/dist/node_modules/lodash-es/every.js +0 -11
- package/dist/node_modules/lodash-es/groupBy.js +0 -6
- package/dist/node_modules/lodash-es/head.js +0 -5
- package/dist/node_modules/lodash-es/includes.js +0 -13
- package/dist/node_modules/lodash-es/indexOf.js +0 -11
- package/dist/node_modules/lodash-es/isRegExp.js +0 -5
- package/dist/node_modules/lodash-es/negate.js +0 -16
- package/dist/node_modules/lodash-es/pickBy.js +0 -15
- package/dist/node_modules/lodash-es/reject.js +0 -10
- package/dist/node_modules/lodash-es/some.js +0 -11
- package/dist/node_modules/lodash-es/uniq.js +0 -6
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { __name, log } from "./chunk-AGHRB4JF.js";
|
|
2
|
+
import { clear, configureSvgSize, getAccDescription, getAccTitle, getConfig2, getDiagramTitle, sanitizeText, setAccDescription, setAccTitle, setDiagramTitle } from "./chunk-ICPOFSXX.js";
|
|
3
|
+
import { selectSvgElement } from "./chunk-426QAEUC.js";
|
|
4
|
+
import { populateCommonDb } from "./chunk-4BX2VUAB.js";
|
|
5
|
+
import { parse } from "../../../../@mermaid-js/parser/dist/mermaid-parser.core.js";
|
|
6
|
+
var toPercent = /* @__PURE__ */ __name((r, c) => {
|
|
7
|
+
let l = r <= 1 ? r * 100 : r;
|
|
8
|
+
if (l < 0 || l > 100) throw Error(`${c} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${r}`);
|
|
9
|
+
return l;
|
|
10
|
+
}, "toPercent"), toCoordinates = /* @__PURE__ */ __name((r, c, l) => ({
|
|
11
|
+
x: toPercent(c, `${l} evolution`),
|
|
12
|
+
y: toPercent(r, `${l} visibility`)
|
|
13
|
+
}), "toCoordinates"), getFlowFromPort = /* @__PURE__ */ __name((r) => {
|
|
14
|
+
if (r) {
|
|
15
|
+
if (r === "+<>") return "bidirectional";
|
|
16
|
+
if (r === "+<") return "backward";
|
|
17
|
+
if (r === "+>") return "forward";
|
|
18
|
+
}
|
|
19
|
+
}, "getFlowFromPort"), extractFlowFromArrow = /* @__PURE__ */ __name((r) => {
|
|
20
|
+
if (!r?.startsWith("+")) return {};
|
|
21
|
+
let c = /^\+'([^']*)'/.exec(r)?.[1];
|
|
22
|
+
return r.includes("<>") ? {
|
|
23
|
+
flow: "bidirectional",
|
|
24
|
+
label: c
|
|
25
|
+
} : r.includes("<") ? {
|
|
26
|
+
flow: "backward",
|
|
27
|
+
label: c
|
|
28
|
+
} : r.includes(">") ? {
|
|
29
|
+
flow: "forward",
|
|
30
|
+
label: c
|
|
31
|
+
} : { label: c };
|
|
32
|
+
}, "extractFlowFromArrow"), populateDb = /* @__PURE__ */ __name((r, c) => {
|
|
33
|
+
if (populateCommonDb(r, c), r.size && c.setSize(r.size.width, r.size.height), r.evolution) {
|
|
34
|
+
let l = r.evolution.stages.map((r) => r.secondName ? `${r.name.trim()} / ${r.secondName.trim()}` : r.name.trim()), u = r.evolution.stages.filter((r) => r.boundary !== void 0).map((r) => r.boundary);
|
|
35
|
+
c.updateAxes({
|
|
36
|
+
stages: l,
|
|
37
|
+
stageBoundaries: u
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (r.anchors.forEach((r) => {
|
|
41
|
+
let l = toCoordinates(r.visibility, r.evolution, `Anchor "${r.name}"`);
|
|
42
|
+
c.addNode(r.name, r.name, l.x, l.y, "anchor");
|
|
43
|
+
}), r.components.forEach((r) => {
|
|
44
|
+
let l = toCoordinates(r.visibility, r.evolution, `Component "${r.name}"`), u = r.label ? (r.label.negX ? -1 : 1) * r.label.offsetX : void 0, d = r.label ? (r.label.negY ? -1 : 1) * r.label.offsetY : void 0, f = r.decorator?.strategy;
|
|
45
|
+
c.addNode(r.name, r.name, l.x, l.y, "component", u, d, r.inertia, f);
|
|
46
|
+
}), r.notes.forEach((r) => {
|
|
47
|
+
let l = toCoordinates(r.visibility, r.evolution, `Note "${r.text}"`);
|
|
48
|
+
c.addNote(r.text, l.x, l.y);
|
|
49
|
+
}), r.pipelines.forEach((r) => {
|
|
50
|
+
let l = c.getNode(r.parent);
|
|
51
|
+
if (!l || typeof l.y != "number") throw Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);
|
|
52
|
+
let u = l.y;
|
|
53
|
+
c.startPipeline(r.parent), r.components.forEach((l) => {
|
|
54
|
+
let d = `${r.parent}_${l.name}`, f = l.label ? (l.label.negX ? -1 : 1) * l.label.offsetX : void 0, p = l.label ? (l.label.negY ? -1 : 1) * l.label.offsetY : void 0, m = toPercent(l.evolution, `Pipeline component "${l.name}" evolution`);
|
|
55
|
+
c.addNode(d, l.name, m, u, "pipeline-component", f, p), c.addPipelineComponent(r.parent, d);
|
|
56
|
+
});
|
|
57
|
+
}), r.links.forEach((r) => {
|
|
58
|
+
let l = !!r.arrow && (r.arrow.includes("-.->") || r.arrow.includes(".-.")), u = getFlowFromPort(r.fromPort) ?? getFlowFromPort(r.toPort), { flow: d, label: f } = extractFlowFromArrow(r.arrow);
|
|
59
|
+
!u && d && (u = d);
|
|
60
|
+
let p = r.linkLabel, m = f ?? p;
|
|
61
|
+
c.addLink(r.from, r.to, l, m, u);
|
|
62
|
+
}), r.evolves.forEach((r) => {
|
|
63
|
+
let l = c.getNode(r.component);
|
|
64
|
+
if (l?.y !== void 0) {
|
|
65
|
+
let u = toPercent(r.target, `Evolve target for "${r.component}"`);
|
|
66
|
+
c.addTrend(r.component, u, l.y);
|
|
67
|
+
}
|
|
68
|
+
}), r.annotations.length > 0) {
|
|
69
|
+
let l = r.annotations[0], u = toCoordinates(l.x, l.y, "Annotations box");
|
|
70
|
+
c.setAnnotationsBox(u.x, u.y);
|
|
71
|
+
}
|
|
72
|
+
r.annotation.forEach((r) => {
|
|
73
|
+
let l = toCoordinates(r.x, r.y, `Annotation ${r.number}`);
|
|
74
|
+
c.addAnnotation(r.number, [{
|
|
75
|
+
x: l.x,
|
|
76
|
+
y: l.y
|
|
77
|
+
}], r.text);
|
|
78
|
+
}), r.accelerators.forEach((r) => {
|
|
79
|
+
let l = toCoordinates(r.x, r.y, `Accelerator "${r.name}"`);
|
|
80
|
+
c.addAccelerator(r.name, l.x, l.y);
|
|
81
|
+
}), r.deaccelerators.forEach((r) => {
|
|
82
|
+
let l = toCoordinates(r.x, r.y, `Deaccelerator "${r.name}"`);
|
|
83
|
+
c.addDeaccelerator(r.name, l.x, l.y);
|
|
84
|
+
});
|
|
85
|
+
}, "populateDb"), parser = {
|
|
86
|
+
parser: { yy: void 0 },
|
|
87
|
+
parse: /* @__PURE__ */ __name(async (r) => {
|
|
88
|
+
let l = await parse("wardley", r);
|
|
89
|
+
log.debug(l);
|
|
90
|
+
let u = parser.parser?.yy;
|
|
91
|
+
if (!u || typeof u.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.");
|
|
92
|
+
populateDb(l, u);
|
|
93
|
+
}, "parse")
|
|
94
|
+
}, builder = new class {
|
|
95
|
+
constructor() {
|
|
96
|
+
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 = {};
|
|
97
|
+
}
|
|
98
|
+
static #e = __name(this, "WardleyBuilder");
|
|
99
|
+
addNode(r) {
|
|
100
|
+
let c = this.nodes.get(r.id) ?? {
|
|
101
|
+
id: r.id,
|
|
102
|
+
label: r.label
|
|
103
|
+
}, l = {
|
|
104
|
+
...c,
|
|
105
|
+
...r,
|
|
106
|
+
className: r.className ?? c.className,
|
|
107
|
+
labelOffsetX: r.labelOffsetX ?? c.labelOffsetX,
|
|
108
|
+
labelOffsetY: r.labelOffsetY ?? c.labelOffsetY
|
|
109
|
+
};
|
|
110
|
+
this.nodes.set(r.id, l);
|
|
111
|
+
}
|
|
112
|
+
addLink(r) {
|
|
113
|
+
this.links.push(r);
|
|
114
|
+
}
|
|
115
|
+
addTrend(r) {
|
|
116
|
+
this.trends.set(r.nodeId, r);
|
|
117
|
+
}
|
|
118
|
+
startPipeline(r) {
|
|
119
|
+
this.pipelines.set(r, {
|
|
120
|
+
nodeId: r,
|
|
121
|
+
componentIds: []
|
|
122
|
+
});
|
|
123
|
+
let c = this.nodes.get(r);
|
|
124
|
+
c && (c.isPipelineParent = !0);
|
|
125
|
+
}
|
|
126
|
+
addPipelineComponent(r, c) {
|
|
127
|
+
let l = this.pipelines.get(r);
|
|
128
|
+
l && l.componentIds.push(c);
|
|
129
|
+
let u = this.nodes.get(c);
|
|
130
|
+
u && (u.inPipeline = !0);
|
|
131
|
+
}
|
|
132
|
+
addAnnotation(r) {
|
|
133
|
+
this.annotations.push(r);
|
|
134
|
+
}
|
|
135
|
+
addNote(r) {
|
|
136
|
+
this.notes.push(r);
|
|
137
|
+
}
|
|
138
|
+
addAccelerator(r) {
|
|
139
|
+
this.accelerators.push(r);
|
|
140
|
+
}
|
|
141
|
+
addDeaccelerator(r) {
|
|
142
|
+
this.deaccelerators.push(r);
|
|
143
|
+
}
|
|
144
|
+
setAnnotationsBox(r, c) {
|
|
145
|
+
this.annotationsBox = {
|
|
146
|
+
x: r,
|
|
147
|
+
y: c
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
setAxes(r) {
|
|
151
|
+
this.axes = {
|
|
152
|
+
...this.axes,
|
|
153
|
+
...r
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
setSize(r, c) {
|
|
157
|
+
this.size = {
|
|
158
|
+
width: r,
|
|
159
|
+
height: c
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
getNode(r) {
|
|
163
|
+
return this.nodes.get(r);
|
|
164
|
+
}
|
|
165
|
+
build() {
|
|
166
|
+
let r = [];
|
|
167
|
+
for (let c of this.nodes.values()) {
|
|
168
|
+
if (typeof c.x != "number" || typeof c.y != "number") throw Error(`Node "${c.label}" is missing coordinates`);
|
|
169
|
+
r.push(c);
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
nodes: r,
|
|
173
|
+
links: [...this.links],
|
|
174
|
+
trends: [...this.trends.values()],
|
|
175
|
+
pipelines: [...this.pipelines.values()],
|
|
176
|
+
annotations: [...this.annotations],
|
|
177
|
+
notes: [...this.notes],
|
|
178
|
+
accelerators: [...this.accelerators],
|
|
179
|
+
deaccelerators: [...this.deaccelerators],
|
|
180
|
+
annotationsBox: this.annotationsBox,
|
|
181
|
+
axes: { ...this.axes },
|
|
182
|
+
size: this.size
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
clear() {
|
|
186
|
+
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;
|
|
187
|
+
}
|
|
188
|
+
}();
|
|
189
|
+
function textSanitizer(r) {
|
|
190
|
+
let c = getConfig2();
|
|
191
|
+
return sanitizeText(r.trim(), c);
|
|
192
|
+
}
|
|
193
|
+
__name(textSanitizer, "textSanitizer");
|
|
194
|
+
function getConfig2$1() {
|
|
195
|
+
return getConfig2()["wardley-beta"];
|
|
196
|
+
}
|
|
197
|
+
__name(getConfig2$1, "getConfig");
|
|
198
|
+
function addNode(r, c, l, u, d, f, p, m, h) {
|
|
199
|
+
builder.addNode({
|
|
200
|
+
id: r,
|
|
201
|
+
label: textSanitizer(c),
|
|
202
|
+
x: l,
|
|
203
|
+
y: u,
|
|
204
|
+
className: d,
|
|
205
|
+
labelOffsetX: f,
|
|
206
|
+
labelOffsetY: p,
|
|
207
|
+
inertia: m,
|
|
208
|
+
sourceStrategy: h
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
__name(addNode, "addNode");
|
|
212
|
+
function addLink(r, c, l = !1, u, d) {
|
|
213
|
+
builder.addLink({
|
|
214
|
+
source: r,
|
|
215
|
+
target: c,
|
|
216
|
+
dashed: l,
|
|
217
|
+
label: u,
|
|
218
|
+
flow: d
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
__name(addLink, "addLink");
|
|
222
|
+
function addTrend(r, c, l) {
|
|
223
|
+
builder.addTrend({
|
|
224
|
+
nodeId: r,
|
|
225
|
+
targetX: c,
|
|
226
|
+
targetY: l
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
__name(addTrend, "addTrend");
|
|
230
|
+
function addAnnotation(r, c, l) {
|
|
231
|
+
builder.addAnnotation({
|
|
232
|
+
number: r,
|
|
233
|
+
coordinates: c,
|
|
234
|
+
text: l ? textSanitizer(l) : void 0
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
__name(addAnnotation, "addAnnotation");
|
|
238
|
+
function addNote(r, c, l) {
|
|
239
|
+
builder.addNote({
|
|
240
|
+
text: textSanitizer(r),
|
|
241
|
+
x: c,
|
|
242
|
+
y: l
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
__name(addNote, "addNote");
|
|
246
|
+
function addAccelerator(r, c, l) {
|
|
247
|
+
builder.addAccelerator({
|
|
248
|
+
name: textSanitizer(r),
|
|
249
|
+
x: c,
|
|
250
|
+
y: l
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
__name(addAccelerator, "addAccelerator");
|
|
254
|
+
function addDeaccelerator(r, c, l) {
|
|
255
|
+
builder.addDeaccelerator({
|
|
256
|
+
name: textSanitizer(r),
|
|
257
|
+
x: c,
|
|
258
|
+
y: l
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
__name(addDeaccelerator, "addDeaccelerator");
|
|
262
|
+
function setAnnotationsBox(r, c) {
|
|
263
|
+
builder.setAnnotationsBox(r, c);
|
|
264
|
+
}
|
|
265
|
+
__name(setAnnotationsBox, "setAnnotationsBox");
|
|
266
|
+
function setSize(r, c) {
|
|
267
|
+
builder.setSize(r, c);
|
|
268
|
+
}
|
|
269
|
+
__name(setSize, "setSize");
|
|
270
|
+
function startPipeline(r) {
|
|
271
|
+
builder.startPipeline(r);
|
|
272
|
+
}
|
|
273
|
+
__name(startPipeline, "startPipeline");
|
|
274
|
+
function addPipelineComponent(r, c) {
|
|
275
|
+
builder.addPipelineComponent(r, c);
|
|
276
|
+
}
|
|
277
|
+
__name(addPipelineComponent, "addPipelineComponent");
|
|
278
|
+
function updateAxes(r) {
|
|
279
|
+
let c = {};
|
|
280
|
+
r.xLabel && (c.xLabel = textSanitizer(r.xLabel)), r.yLabel && (c.yLabel = textSanitizer(r.yLabel)), r.stages && (c.stages = r.stages.map((r) => textSanitizer(r))), r.stageBoundaries && (c.stageBoundaries = r.stageBoundaries), builder.setAxes(c);
|
|
281
|
+
}
|
|
282
|
+
__name(updateAxes, "updateAxes");
|
|
283
|
+
function getNode(r) {
|
|
284
|
+
return builder.getNode(r);
|
|
285
|
+
}
|
|
286
|
+
__name(getNode, "getNode");
|
|
287
|
+
function getWardleyData() {
|
|
288
|
+
return builder.build();
|
|
289
|
+
}
|
|
290
|
+
__name(getWardleyData, "getWardleyData");
|
|
291
|
+
function clear2() {
|
|
292
|
+
builder.clear(), clear();
|
|
293
|
+
}
|
|
294
|
+
__name(clear2, "clear");
|
|
295
|
+
var wardleyDb_default = {
|
|
296
|
+
getConfig: getConfig2$1,
|
|
297
|
+
addNode,
|
|
298
|
+
addLink,
|
|
299
|
+
addTrend,
|
|
300
|
+
addAnnotation,
|
|
301
|
+
addNote,
|
|
302
|
+
addAccelerator,
|
|
303
|
+
addDeaccelerator,
|
|
304
|
+
setAnnotationsBox,
|
|
305
|
+
setSize,
|
|
306
|
+
startPipeline,
|
|
307
|
+
addPipelineComponent,
|
|
308
|
+
updateAxes,
|
|
309
|
+
getNode,
|
|
310
|
+
getWardleyData,
|
|
311
|
+
clear: clear2,
|
|
312
|
+
setAccTitle,
|
|
313
|
+
getAccTitle,
|
|
314
|
+
setDiagramTitle,
|
|
315
|
+
getDiagramTitle,
|
|
316
|
+
getAccDescription,
|
|
317
|
+
setAccDescription
|
|
318
|
+
}, DEFAULT_STAGES = [
|
|
319
|
+
"Genesis",
|
|
320
|
+
"Custom Built",
|
|
321
|
+
"Product",
|
|
322
|
+
"Commodity"
|
|
323
|
+
], getTheme = /* @__PURE__ */ __name(() => {
|
|
324
|
+
let { themeVariables: r } = getConfig2();
|
|
325
|
+
return {
|
|
326
|
+
backgroundColor: r.wardley?.backgroundColor ?? r.background ?? "#fff",
|
|
327
|
+
axisColor: r.wardley?.axisColor ?? "#000",
|
|
328
|
+
axisTextColor: r.wardley?.axisTextColor ?? r.primaryTextColor ?? "#222",
|
|
329
|
+
gridColor: r.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
|
|
330
|
+
componentFill: r.wardley?.componentFill ?? "#fff",
|
|
331
|
+
componentStroke: r.wardley?.componentStroke ?? "#000",
|
|
332
|
+
componentLabelColor: r.wardley?.componentLabelColor ?? r.primaryTextColor ?? "#222",
|
|
333
|
+
linkStroke: r.wardley?.linkStroke ?? "#000",
|
|
334
|
+
evolutionStroke: r.wardley?.evolutionStroke ?? "#dc3545",
|
|
335
|
+
annotationStroke: r.wardley?.annotationStroke ?? "#000",
|
|
336
|
+
annotationTextColor: r.wardley?.annotationTextColor ?? r.primaryTextColor ?? "#222",
|
|
337
|
+
annotationFill: r.wardley?.annotationFill ?? r.background ?? "#fff"
|
|
338
|
+
};
|
|
339
|
+
}, "getTheme"), getConfigValues = /* @__PURE__ */ __name(() => {
|
|
340
|
+
let r = getConfig2()["wardley-beta"];
|
|
341
|
+
return {
|
|
342
|
+
width: r?.width ?? 900,
|
|
343
|
+
height: r?.height ?? 600,
|
|
344
|
+
padding: r?.padding ?? 48,
|
|
345
|
+
nodeRadius: r?.nodeRadius ?? 6,
|
|
346
|
+
nodeLabelOffset: r?.nodeLabelOffset ?? 8,
|
|
347
|
+
axisFontSize: r?.axisFontSize ?? 12,
|
|
348
|
+
labelFontSize: r?.labelFontSize ?? 10,
|
|
349
|
+
showGrid: r?.showGrid ?? !1,
|
|
350
|
+
useMaxWidth: r?.useMaxWidth ?? !0
|
|
351
|
+
};
|
|
352
|
+
}, "getConfigValues"), diagram = {
|
|
353
|
+
parser,
|
|
354
|
+
db: wardleyDb_default,
|
|
355
|
+
renderer: { draw: /* @__PURE__ */ __name((l, d, f, p) => {
|
|
356
|
+
log.debug("Rendering Wardley map\n" + l);
|
|
357
|
+
let m = getConfigValues(), h = getTheme(), g = m.nodeRadius * 1.6, _ = p.db, v = _.getWardleyData(), b = _.getDiagramTitle(), x = v.size?.width ?? m.width, S = v.size?.height ?? m.height, C = selectSvgElement(d);
|
|
358
|
+
C.selectAll("*").remove(), configureSvgSize(C, S, x, m.useMaxWidth), C.attr("viewBox", `0 0 ${x} ${S}`);
|
|
359
|
+
let w = C.append("g").attr("class", "wardley-map"), T = C.append("defs");
|
|
360
|
+
T.append("marker").attr("id", `arrow-${d}`).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", h.evolutionStroke).attr("stroke", "none"), T.append("marker").attr("id", `link-arrow-end-${d}`).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", h.linkStroke).attr("stroke", "none"), T.append("marker").attr("id", `link-arrow-start-${d}`).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", h.linkStroke).attr("stroke", "none"), w.append("rect").attr("class", "wardley-background").attr("width", x).attr("height", S).attr("fill", h.backgroundColor);
|
|
361
|
+
let E = x - m.padding * 2, D = S - m.padding * 2;
|
|
362
|
+
b && w.append("text").attr("class", "wardley-title").attr("x", x / 2).attr("y", m.padding / 2).attr("fill", h.axisTextColor).attr("font-size", m.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(b);
|
|
363
|
+
let O = /* @__PURE__ */ __name((r) => m.padding + r / 100 * E, "projectX"), k = /* @__PURE__ */ __name((r) => S - m.padding - r / 100 * D, "projectY"), A = w.append("g").attr("class", "wardley-axes");
|
|
364
|
+
A.append("line").attr("x1", m.padding).attr("x2", x - m.padding).attr("y1", S - m.padding).attr("y2", S - m.padding).attr("stroke", h.axisColor).attr("stroke-width", 1), A.append("line").attr("x1", m.padding).attr("x2", m.padding).attr("y1", m.padding).attr("y2", S - m.padding).attr("stroke", h.axisColor).attr("stroke-width", 1);
|
|
365
|
+
let j = v.axes.xLabel ?? "Evolution", M = v.axes.yLabel ?? "Visibility";
|
|
366
|
+
A.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", m.padding + E / 2).attr("y", S - m.padding / 4).attr("fill", h.axisTextColor).attr("font-size", m.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(j), A.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", m.padding / 3).attr("y", m.padding + D / 2).attr("fill", h.axisTextColor).attr("font-size", m.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr("transform", `rotate(-90 ${m.padding / 3} ${m.padding + D / 2})`).text(M);
|
|
367
|
+
let N = v.axes.stages && v.axes.stages.length > 0 ? v.axes.stages : DEFAULT_STAGES;
|
|
368
|
+
if (N.length > 0) {
|
|
369
|
+
let r = w.append("g").attr("class", "wardley-stages"), c = v.axes.stageBoundaries, l = [];
|
|
370
|
+
if (c && c.length === N.length) {
|
|
371
|
+
let r = 0;
|
|
372
|
+
c.forEach((c) => {
|
|
373
|
+
l.push({
|
|
374
|
+
start: r,
|
|
375
|
+
end: c
|
|
376
|
+
}), r = c;
|
|
377
|
+
});
|
|
378
|
+
} else {
|
|
379
|
+
let r = 1 / N.length;
|
|
380
|
+
N.forEach((c, u) => {
|
|
381
|
+
l.push({
|
|
382
|
+
start: u * r,
|
|
383
|
+
end: (u + 1) * r
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
N.forEach((c, u) => {
|
|
388
|
+
let d = l[u], f = m.padding + d.start * E, p = (f + (m.padding + d.end * E)) / 2;
|
|
389
|
+
u > 0 && r.append("line").attr("x1", f).attr("x2", f).attr("y1", m.padding).attr("y2", S - m.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", .8), r.append("text").attr("class", "wardley-stage-label").attr("x", p).attr("y", S - m.padding / 1.5).attr("fill", h.axisTextColor).attr("font-size", m.axisFontSize - 2).attr("text-anchor", "middle").text(c);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
if (m.showGrid) {
|
|
393
|
+
let r = w.append("g").attr("class", "wardley-grid");
|
|
394
|
+
for (let c = 1; c < 4; c++) {
|
|
395
|
+
let l = c / 4, u = m.padding + E * l;
|
|
396
|
+
r.append("line").attr("x1", u).attr("x2", u).attr("y1", m.padding).attr("y2", S - m.padding).attr("stroke", h.gridColor).attr("stroke-dasharray", "2 6"), r.append("line").attr("x1", m.padding).attr("x2", x - m.padding).attr("y1", S - m.padding - D * l).attr("y2", S - m.padding - D * l).attr("stroke", h.gridColor).attr("stroke-dasharray", "2 6");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
let P = /* @__PURE__ */ new Map();
|
|
400
|
+
if (v.nodes.forEach((r) => {
|
|
401
|
+
P.set(r.id, {
|
|
402
|
+
x: O(r.x),
|
|
403
|
+
y: k(r.y),
|
|
404
|
+
node: r
|
|
405
|
+
});
|
|
406
|
+
}), v.pipelines.length > 0) {
|
|
407
|
+
let r = w.append("g").attr("class", "wardley-pipelines"), c = w.append("g").attr("class", "wardley-pipeline-links");
|
|
408
|
+
v.pipelines.forEach((l) => {
|
|
409
|
+
if (l.componentIds.length === 0) return;
|
|
410
|
+
let u = l.componentIds.map((r) => ({
|
|
411
|
+
id: r,
|
|
412
|
+
pos: P.get(r),
|
|
413
|
+
node: v.nodes.find((c) => c.id === r)
|
|
414
|
+
})).filter((r) => r.pos && r.node).sort((r, c) => r.node.x - c.node.x);
|
|
415
|
+
for (let r = 0; r < u.length - 1; r++) {
|
|
416
|
+
let l = u[r], d = u[r + 1];
|
|
417
|
+
c.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", l.pos.x).attr("y1", l.pos.y).attr("x2", d.pos.x).attr("y2", d.pos.y).attr("stroke", h.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
|
|
418
|
+
}
|
|
419
|
+
let d = Infinity, f = -Infinity, p = 0;
|
|
420
|
+
if (l.componentIds.forEach((r) => {
|
|
421
|
+
let c = P.get(r);
|
|
422
|
+
c && (d = Math.min(d, c.x), f = Math.max(f, c.x), p = c.y);
|
|
423
|
+
}), d !== Infinity && f !== -Infinity) {
|
|
424
|
+
let c = m.nodeRadius * 4, u = p - c / 2, _ = P.get(l.nodeId);
|
|
425
|
+
_ && (_.x = (d + f) / 2, _.y = u - g / 6), r.append("rect").attr("class", "wardley-pipeline-box").attr("x", d - 15).attr("y", u).attr("width", f - d + 30).attr("height", c).attr("fill", "none").attr("stroke", h.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
let F = w.append("g").attr("class", "wardley-links"), I = /* @__PURE__ */ new Map();
|
|
430
|
+
v.pipelines.forEach((r) => {
|
|
431
|
+
I.set(r.nodeId, new Set(r.componentIds));
|
|
432
|
+
});
|
|
433
|
+
let L = v.links.filter((r) => !(!P.has(r.source) || !P.has(r.target) || I.get(r.target)?.has(r.source)));
|
|
434
|
+
F.selectAll("line").data(L).enter().append("line").attr("class", (r) => `wardley-link${r.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (r) => {
|
|
435
|
+
let c = P.get(r.source), l = P.get(r.target), u = v.nodes.find((c) => c.id === r.source).isPipelineParent ? g / Math.sqrt(2) : m.nodeRadius, d = l.x - c.x, f = l.y - c.y, p = Math.sqrt(d * d + f * f);
|
|
436
|
+
return c.x + d / p * u;
|
|
437
|
+
}).attr("y1", (r) => {
|
|
438
|
+
let c = P.get(r.source), l = P.get(r.target), u = v.nodes.find((c) => c.id === r.source).isPipelineParent ? g / Math.sqrt(2) : m.nodeRadius, d = l.x - c.x, f = l.y - c.y, p = Math.sqrt(d * d + f * f);
|
|
439
|
+
return c.y + f / p * u;
|
|
440
|
+
}).attr("x2", (r) => {
|
|
441
|
+
let c = P.get(r.source), l = P.get(r.target), u = v.nodes.find((c) => c.id === r.target).isPipelineParent ? g / Math.sqrt(2) : m.nodeRadius, d = c.x - l.x, f = c.y - l.y, p = Math.sqrt(d * d + f * f);
|
|
442
|
+
return l.x + d / p * u;
|
|
443
|
+
}).attr("y2", (r) => {
|
|
444
|
+
let c = P.get(r.source), l = P.get(r.target), u = v.nodes.find((c) => c.id === r.target).isPipelineParent ? g / Math.sqrt(2) : m.nodeRadius, d = c.x - l.x, f = c.y - l.y, p = Math.sqrt(d * d + f * f);
|
|
445
|
+
return l.y + f / p * u;
|
|
446
|
+
}).attr("stroke", h.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (r) => r.dashed ? "6 6" : null).attr("marker-end", (r) => r.flow === "forward" || r.flow === "bidirectional" ? `url(#link-arrow-end-${d})` : null).attr("marker-start", (r) => r.flow === "backward" || r.flow === "bidirectional" ? `url(#link-arrow-start-${d})` : null), F.selectAll("text").data(L.filter((r) => r.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (r) => {
|
|
447
|
+
let c = P.get(r.source), l = P.get(r.target), u = (c.x + l.x) / 2, d = l.y - c.y, f = l.x - c.x;
|
|
448
|
+
return u + d / Math.sqrt(f * f + d * d) * 8;
|
|
449
|
+
}).attr("y", (r) => {
|
|
450
|
+
let c = P.get(r.source), l = P.get(r.target), u = (c.y + l.y) / 2, d = l.x - c.x, f = l.y - c.y, p = Math.sqrt(d * d + f * f);
|
|
451
|
+
return u + -d / p * 8;
|
|
452
|
+
}).attr("fill", h.axisTextColor).attr("font-size", m.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (r) => {
|
|
453
|
+
let c = P.get(r.source), l = P.get(r.target), u = (c.x + l.x) / 2, d = (c.y + l.y) / 2, f = l.x - c.x, p = l.y - c.y, m = Math.sqrt(f * f + p * p), h = p / m, g = -f / m, _ = u + h * 8, v = d + g * 8, y = Math.atan2(p, f) * 180 / Math.PI;
|
|
454
|
+
return (y > 90 || y < -90) && (y += 180), `rotate(${y} ${_} ${v})`;
|
|
455
|
+
}).text((r) => r.label);
|
|
456
|
+
let R = w.append("g").attr("class", "wardley-trends"), z = v.trends.map((r) => {
|
|
457
|
+
let c = P.get(r.nodeId);
|
|
458
|
+
if (!c) return null;
|
|
459
|
+
let l = O(r.targetX), u = k(r.targetY), d = l - c.x, f = u - c.y, p = Math.sqrt(d * d + f * f), h = m.nodeRadius + 2;
|
|
460
|
+
return {
|
|
461
|
+
origin: c,
|
|
462
|
+
targetX: l,
|
|
463
|
+
targetY: u,
|
|
464
|
+
adjustedX2: p > h ? l - d / p * h : l,
|
|
465
|
+
adjustedY2: p > h ? u - f / p * h : u
|
|
466
|
+
};
|
|
467
|
+
}).filter((r) => r !== null);
|
|
468
|
+
R.selectAll("line").data(z).enter().append("line").attr("class", "wardley-trend").attr("x1", (r) => r.origin.x).attr("y1", (r) => r.origin.y).attr("x2", (r) => r.adjustedX2).attr("y2", (r) => r.adjustedY2).attr("stroke", h.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${d})`);
|
|
469
|
+
let B = w.append("g").attr("class", "wardley-nodes").selectAll("g").data(v.nodes).enter().append("g").attr("class", (r) => ["wardley-node", r.className ? `wardley-node--${r.className}` : ""].filter(Boolean).join(" "));
|
|
470
|
+
B.filter((r) => r.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y).attr("r", m.nodeRadius * 2).attr("fill", "#666").attr("stroke", h.componentStroke).attr("stroke-width", 1), B.filter((r) => r.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y).attr("r", m.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", h.componentStroke).attr("stroke-width", 1), B.filter((r) => r.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y).attr("r", m.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1);
|
|
471
|
+
let V = B.filter((r) => r.sourceStrategy === "market");
|
|
472
|
+
V.append("circle").attr("class", "wardley-market-overlay").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y).attr("r", m.nodeRadius * 2).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 1), B.filter((r) => !r.isPipelineParent && r.sourceStrategy !== "market" && r.className !== "anchor").append("circle").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y).attr("r", m.nodeRadius).attr("fill", h.componentFill).attr("stroke", h.componentStroke).attr("stroke-width", 1);
|
|
473
|
+
let H = m.nodeRadius * .7, U = m.nodeRadius * 1.2;
|
|
474
|
+
if (V.append("line").attr("class", "wardley-market-line").attr("x1", (r) => P.get(r.id).x).attr("y1", (r) => P.get(r.id).y - U).attr("x2", (r) => P.get(r.id).x - U * Math.cos(Math.PI / 6)).attr("y2", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("stroke", h.componentStroke).attr("stroke-width", 1), V.append("line").attr("class", "wardley-market-line").attr("x1", (r) => P.get(r.id).x - U * Math.cos(Math.PI / 6)).attr("y1", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("x2", (r) => P.get(r.id).x + U * Math.cos(Math.PI / 6)).attr("y2", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("stroke", h.componentStroke).attr("stroke-width", 1), V.append("line").attr("class", "wardley-market-line").attr("x1", (r) => P.get(r.id).x + U * Math.cos(Math.PI / 6)).attr("y1", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("x2", (r) => P.get(r.id).x).attr("y2", (r) => P.get(r.id).y - U).attr("stroke", h.componentStroke).attr("stroke-width", 1), V.append("circle").attr("class", "wardley-market-dot").attr("cx", (r) => P.get(r.id).x).attr("cy", (r) => P.get(r.id).y - U).attr("r", H).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 2), V.append("circle").attr("class", "wardley-market-dot").attr("cx", (r) => P.get(r.id).x - U * Math.cos(Math.PI / 6)).attr("cy", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("r", H).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 2), V.append("circle").attr("class", "wardley-market-dot").attr("cx", (r) => P.get(r.id).x + U * Math.cos(Math.PI / 6)).attr("cy", (r) => P.get(r.id).y + U * Math.sin(Math.PI / 6)).attr("r", H).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 2), B.filter((r) => r.isPipelineParent === !0).append("rect").attr("x", (r) => P.get(r.id).x - g / 2).attr("y", (r) => P.get(r.id).y - g / 2).attr("width", g).attr("height", g).attr("fill", h.componentFill).attr("stroke", h.componentStroke).attr("stroke-width", 1), B.filter((r) => r.inertia === !0).append("line").attr("class", "wardley-inertia").attr("x1", (r) => {
|
|
475
|
+
let c = P.get(r.id), l = r.isPipelineParent ? g / 2 + 15 : m.nodeRadius + 15;
|
|
476
|
+
return r.sourceStrategy && (l += m.nodeRadius + 10), c.x + l;
|
|
477
|
+
}).attr("y1", (r) => {
|
|
478
|
+
let c = P.get(r.id), l = r.isPipelineParent ? g : m.nodeRadius * 2;
|
|
479
|
+
return c.y - l / 2;
|
|
480
|
+
}).attr("x2", (r) => {
|
|
481
|
+
let c = P.get(r.id), l = r.isPipelineParent ? g / 2 + 15 : m.nodeRadius + 15;
|
|
482
|
+
return r.sourceStrategy && (l += m.nodeRadius + 10), c.x + l;
|
|
483
|
+
}).attr("y2", (r) => {
|
|
484
|
+
let c = P.get(r.id), l = r.isPipelineParent ? g : m.nodeRadius * 2;
|
|
485
|
+
return c.y + l / 2;
|
|
486
|
+
}).attr("stroke", h.componentStroke).attr("stroke-width", 6), B.append("text").attr("x", (r) => {
|
|
487
|
+
let c = P.get(r.id);
|
|
488
|
+
if (r.className === "anchor") return r.labelOffsetX === void 0 ? c.x : c.x + r.labelOffsetX;
|
|
489
|
+
let l = m.nodeLabelOffset;
|
|
490
|
+
r.sourceStrategy && r.labelOffsetX === void 0 && (l += 10);
|
|
491
|
+
let u = r.labelOffsetX ?? l;
|
|
492
|
+
return c.x + u;
|
|
493
|
+
}).attr("y", (r) => {
|
|
494
|
+
let c = P.get(r.id);
|
|
495
|
+
if (r.className === "anchor") return r.labelOffsetY === void 0 ? c.y - 3 : c.y + r.labelOffsetY;
|
|
496
|
+
let l = -m.nodeLabelOffset;
|
|
497
|
+
r.sourceStrategy && r.labelOffsetY === void 0 && (l -= 10);
|
|
498
|
+
let u = r.labelOffsetY ?? l;
|
|
499
|
+
return c.y + u;
|
|
500
|
+
}).attr("class", "wardley-node-label").attr("fill", (r) => r.className === "evolved" ? h.evolutionStroke : r.className === "anchor" ? "#000" : h.componentLabelColor).attr("font-size", m.labelFontSize).attr("font-weight", (r) => r.className === "anchor" ? "bold" : "normal").attr("text-anchor", (r) => r.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (r) => r.className === "anchor" ? "middle" : "auto").text((r) => r.label), v.annotations.length > 0) {
|
|
501
|
+
let r = w.append("g").attr("class", "wardley-annotations");
|
|
502
|
+
if (v.annotations.forEach((c) => {
|
|
503
|
+
let l = c.coordinates.map((r) => ({
|
|
504
|
+
x: O(r.x),
|
|
505
|
+
y: k(r.y)
|
|
506
|
+
}));
|
|
507
|
+
if (l.length > 1) for (let c = 0; c < l.length - 1; c++) r.append("line").attr("class", "wardley-annotation-line").attr("x1", l[c].x).attr("y1", l[c].y).attr("x2", l[c + 1].x).attr("y2", l[c + 1].y).attr("stroke", h.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4");
|
|
508
|
+
l.forEach((l) => {
|
|
509
|
+
let u = r.append("g").attr("class", "wardley-annotation");
|
|
510
|
+
u.append("circle").attr("cx", l.x).attr("cy", l.y).attr("r", 10).attr("fill", "white").attr("stroke", h.axisColor).attr("stroke-width", 1.5), u.append("text").attr("x", l.x).attr("y", l.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", h.axisTextColor).attr("font-weight", "bold").text(c.number);
|
|
511
|
+
});
|
|
512
|
+
}), v.annotationsBox) {
|
|
513
|
+
let c = O(v.annotationsBox.x), l = k(v.annotationsBox.y), u = r.append("g").attr("class", "wardley-annotations-box"), d = [...v.annotations].filter((r) => r.text).sort((r, c) => r.number - c.number), f = [];
|
|
514
|
+
if (d.forEach((r, d) => {
|
|
515
|
+
let p = u.append("text").attr("x", c + 10).attr("y", l + 10 + (d + 1) * 16).attr("font-size", 11).attr("fill", h.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${r.number}. ${r.text}`);
|
|
516
|
+
f.push(p);
|
|
517
|
+
}), f.length > 0) {
|
|
518
|
+
let r = 0, p = 0;
|
|
519
|
+
f.forEach((c) => {
|
|
520
|
+
let l = c.node(), u = l.getComputedTextLength();
|
|
521
|
+
r = Math.max(r, u);
|
|
522
|
+
let d = l.getBBox();
|
|
523
|
+
p = Math.max(p, d.height);
|
|
524
|
+
});
|
|
525
|
+
let g = r + 20 + 105, _ = d.length * 16 + 20 + p / 2, v = m.padding, y = x - m.padding - g, b = m.padding, C = S - m.padding - _;
|
|
526
|
+
c = Math.max(v, Math.min(c, y)), l = Math.max(b, Math.min(l, C)), f.forEach((r, u) => {
|
|
527
|
+
r.attr("x", c + 10).attr("y", l + 10 + (u + 1) * 16);
|
|
528
|
+
}), u.insert("rect", "text").attr("x", c).attr("y", l).attr("width", g).attr("height", _).attr("fill", "white").attr("stroke", h.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (v.notes.length > 0) {
|
|
533
|
+
let r = w.append("g").attr("class", "wardley-notes");
|
|
534
|
+
v.notes.forEach((c) => {
|
|
535
|
+
let l = O(c.x), u = k(c.y);
|
|
536
|
+
r.append("text").attr("x", l).attr("y", u).attr("text-anchor", "start").attr("font-size", 11).attr("fill", h.axisTextColor).attr("font-weight", "bold").text(c.text);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
if (v.accelerators.length > 0) {
|
|
540
|
+
let r = w.append("g").attr("class", "wardley-accelerators");
|
|
541
|
+
v.accelerators.forEach((c) => {
|
|
542
|
+
let l = O(c.x), u = k(c.y), d = `
|
|
543
|
+
M ${l} ${u - 30 / 2}
|
|
544
|
+
L ${l + 60 - 20} ${u - 30 / 2}
|
|
545
|
+
L ${l + 60 - 20} ${u - 30 / 2 - 8}
|
|
546
|
+
L ${l + 60} ${u}
|
|
547
|
+
L ${l + 60 - 20} ${u + 30 / 2 + 8}
|
|
548
|
+
L ${l + 60 - 20} ${u + 30 / 2}
|
|
549
|
+
L ${l} ${u + 30 / 2}
|
|
550
|
+
Z
|
|
551
|
+
`;
|
|
552
|
+
r.append("path").attr("d", d).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 1), r.append("text").attr("x", l + 60 / 2).attr("y", u + 30 / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", h.axisTextColor).attr("font-weight", "bold").text(c.name);
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
if (v.deaccelerators.length > 0) {
|
|
556
|
+
let r = w.append("g").attr("class", "wardley-deaccelerators");
|
|
557
|
+
v.deaccelerators.forEach((c) => {
|
|
558
|
+
let l = O(c.x), u = k(c.y), d = `
|
|
559
|
+
M ${l + 60} ${u - 30 / 2}
|
|
560
|
+
L ${l + 20} ${u - 30 / 2}
|
|
561
|
+
L ${l + 20} ${u - 30 / 2 - 8}
|
|
562
|
+
L ${l} ${u}
|
|
563
|
+
L ${l + 20} ${u + 30 / 2 + 8}
|
|
564
|
+
L ${l + 20} ${u + 30 / 2}
|
|
565
|
+
L ${l + 60} ${u + 30 / 2}
|
|
566
|
+
Z
|
|
567
|
+
`;
|
|
568
|
+
r.append("path").attr("d", d).attr("fill", "white").attr("stroke", h.componentStroke).attr("stroke-width", 1), r.append("text").attr("x", l + 60 / 2).attr("y", u + 30 / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", h.axisTextColor).attr("font-weight", "bold").text(c.name);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}, "draw") },
|
|
572
|
+
styles: /* @__PURE__ */ __name(() => "", "styles")
|
|
573
|
+
};
|
|
574
|
+
export { diagram };
|