@aiderdesk/aiderdesk 0.88.0 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/bin/aiderdesk.js +23 -4
  2. package/out/renderer/assets/2DXBBFLN-CN7PCbP4.js +666 -0
  3. package/out/renderer/assets/46IJ22JX-C0JBV-DN.js +853 -0
  4. package/out/renderer/assets/4TTDE5I4-9dfnF-mJ.js +501 -0
  5. package/out/renderer/assets/4UF3HTLV-BOGNNOtG.js +29 -0
  6. package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
  7. package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
  8. package/out/renderer/assets/AAXQQPKT-CUxujcLx.js +1130 -0
  9. package/out/renderer/assets/AKE5O7KZ-BacZZCk1.js +184 -0
  10. package/out/renderer/assets/{AgentSettings-DffQ3g7i.js → AgentSettings-d970JEBg.js} +711 -265
  11. package/out/renderer/assets/BNMLP6AG-CPZZ4Yk4.js +804 -0
  12. package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
  13. package/out/renderer/assets/DR6PKOQU-B1RVO4q1.js +301 -0
  14. package/out/renderer/assets/E4RJ7UJB-DblNDQqr.js +441 -0
  15. package/out/renderer/assets/ELSXBIJH-Cv7twqii.js +39 -0
  16. package/out/renderer/assets/ERTIBQVS-BOWB3hEk.js +182 -0
  17. package/out/renderer/assets/F653G4FO-W-KqfQ-Y.js +1497 -0
  18. package/out/renderer/assets/FKCDD66M-B14TkcR1.js +205 -0
  19. package/out/renderer/assets/FP7KDXVC-CfbGNJSU.js +221 -0
  20. package/out/renderer/assets/FT5I3RHX-CN4zS9Hs.js +243 -0
  21. package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
  22. package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
  23. package/out/renderer/assets/GY35JXOZ-JZ4iNyhl.js +168 -0
  24. package/out/renderer/assets/H5EEJPP2-uIwpGj04.js +353 -0
  25. package/out/renderer/assets/HWDLEDTA-B-21e-nW.js +982 -0
  26. package/out/renderer/assets/{InfoIcon-CMLVIQF3.js → InfoIcon-BdHyLaWR.js} +1 -1
  27. package/out/renderer/assets/JZWSX6AR-CGOPcITT.js +67 -0
  28. package/out/renderer/assets/KQOEJWJY-CVXfAIs2.js +84 -0
  29. package/out/renderer/assets/KS3BB3KE-CtBv4FqR.js +138 -0
  30. package/out/renderer/assets/KXJRRZHI-BM99Fieb.js +502 -0
  31. package/out/renderer/assets/MFVI5XKI-CnIb_NK6.js +10 -0
  32. package/out/renderer/assets/MWY2J62P-_tQcE8Un.js +1102 -0
  33. package/out/renderer/assets/MXGNCBL2-BNrmRaJD.js +216 -0
  34. package/out/renderer/assets/N6DAJLIZ-BAz5hAGi.js +120 -0
  35. package/out/renderer/assets/NU5M23IW-CffAjbNM.js +116 -0
  36. package/out/renderer/assets/NV4XNBIS-CVgN6zoj.js +1221 -0
  37. package/out/renderer/assets/OGLU4SIR-BWc9bhhe.js +289 -0
  38. package/out/renderer/assets/OUNS5N76-Da3c60xf.js +1064 -0
  39. package/out/renderer/assets/{Onboarding-699qRMTN.js → Onboarding-C_40udgn.js} +4 -4
  40. package/out/renderer/assets/PU4ISKXV-caynfvUT.js +515 -0
  41. package/out/renderer/assets/PUZGS23X-BBtie16s.js +21 -0
  42. package/out/renderer/assets/{ProviderHeader-BnuGEmze.js → ProviderHeader-DTr3RouJ.js} +226 -68
  43. package/out/renderer/assets/Q3IYVLG5-BtsgTutD.js +500 -0
  44. package/out/renderer/assets/QYHQDLKZ-B_qsOSul.js +983 -0
  45. package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
  46. package/out/renderer/assets/RZSVICHU-Bmzdqx47.js +263 -0
  47. package/out/renderer/assets/{SettingsPage-CLTNRnQI.js → SettingsPage-BfCnceVZ.js} +1952 -1744
  48. package/out/renderer/assets/UEXXS2NB-BzcZ5Jtl.js +25 -0
  49. package/out/renderer/assets/UHTQJXKL-C3dTKgrU.js +134 -0
  50. package/out/renderer/assets/URA2L2QI-B0LuLlBK.js +201 -0
  51. package/out/renderer/assets/UXCHDUKG-BCkRaN06.js +173 -0
  52. package/out/renderer/assets/{UsageDashboard-DRihVOqx.js → UsageDashboard-C8R2mFRK.js} +11329 -8646
  53. package/out/renderer/assets/VKNV3BUX-DIigERiR.js +277 -0
  54. package/out/renderer/assets/VMV7XPHP-ZutksyU0.js +127 -0
  55. package/out/renderer/assets/WEVWDWVA-RbwADIlH.js +57 -0
  56. package/out/renderer/assets/XRRJ35LF-C0MrgsVR.js +119 -0
  57. package/out/renderer/assets/YFKBLVVN-DWeGL1O-.js +990 -0
  58. package/out/renderer/assets/YHRE5QGZ-QRdA6Sjw.js +697 -0
  59. package/out/renderer/assets/ZF3OVT4B-Br3NszUk.js +420 -0
  60. package/out/renderer/assets/{index-DTwId9nn.js → index--wHnLMDb.js} +1 -1
  61. package/out/renderer/assets/{index-D1Him45L.js → index-8j5_0Xmy.js} +2 -2
  62. package/out/renderer/assets/{index-BeF6VrSe.js → index-B5RSRSoJ.js} +1 -1
  63. package/out/renderer/assets/{index-8-JzmzqC.js → index-B7B7XIvK.js} +2 -2
  64. package/out/renderer/assets/{index-4IKrE3Ch.js → index-B8KC4V_E.js} +2 -2
  65. package/out/renderer/assets/{index-CNGDTtBW.js → index-BE3TwVrI.js} +1 -1
  66. package/out/renderer/assets/{index-BSh2X31_.js → index-BI_bWG8f.js} +5 -5
  67. package/out/renderer/assets/{index-DBHj35Nq.js → index-BSVdNEPT.js} +2 -2
  68. package/out/renderer/assets/{index-CY4zeK5l.js → index-Bfv_tHDl.js} +3 -3
  69. package/out/renderer/assets/{index-tkTKXqGX.js → index-BgwAdiY-.js} +3 -3
  70. package/out/renderer/assets/{index-TTgmBk0H.js → index-CCXOgMyH.js} +1 -1
  71. package/out/renderer/assets/{index-DZ8Tuuit.js → index-CPsc5AXE.js} +33253 -56520
  72. package/out/renderer/assets/{index-Z7VaFhjR.js → index-CbIhyJsA.js} +1 -1
  73. package/out/renderer/assets/{index-ly0cB32v.css → index-CmC58I3A.css} +147 -0
  74. package/out/renderer/assets/{index-C-WEDvyw.js → index-CmZ1Jh7h.js} +5 -5
  75. package/out/renderer/assets/{index-Dq8m0XiD.js → index-Cpbtrl5u.js} +2 -2
  76. package/out/renderer/assets/{index-D2Y9BB9n.js → index-Ctxv0x2L.js} +5 -5
  77. package/out/renderer/assets/{index-BFLm6WFt.js → index-CuPAggjp.js} +5 -5
  78. package/out/renderer/assets/{index-BhXi7Le_.js → index-D3XbzIRk.js} +5 -5
  79. package/out/renderer/assets/{index-3hl2j-_p.js → index-D5x1sIX6.js} +2 -2
  80. package/out/renderer/assets/{index-vBiBurKH.js → index-D6Wnf7gd.js} +2 -2
  81. package/out/renderer/assets/{index-Otcl72On.js → index-DLjRa0WD.js} +1403 -1403
  82. package/out/renderer/assets/{index-D1jY29Az.js → index-DjulCRn0.js} +4 -4
  83. package/out/renderer/assets/{index-CnxPOcjf.js → index-Dmxn6jrh.js} +1 -1
  84. package/out/renderer/assets/{index-HjbPyDJm.js → index-Dq6Gglw0.js} +5 -5
  85. package/out/renderer/assets/{index-DUOs3uZb.js → index-DvBIPTnQ.js} +1 -1
  86. package/out/renderer/assets/{index--DpoC2Fa.js → index-XefJXdnR.js} +2 -2
  87. package/out/renderer/assets/{index-CC_7dh5L.js → index-ZECsEmSY.js} +2 -2
  88. package/out/renderer/assets/{index-B41U46QG.js → index-cOR6WxqF.js} +1 -1
  89. package/out/renderer/assets/{index-Bv8Yvnki.js → index-dFdSx4rr.js} +2 -2
  90. package/out/renderer/assets/{index-BJ-vdpjD.js → index-j2Lce0uE.js} +1 -1
  91. package/out/renderer/assets/{index-DHZvdQmh.js → index-rCofdqK1.js} +2 -2
  92. package/out/renderer/assets/{index-CBVmxCYX.js → index-sKm26BNt.js} +2 -2
  93. package/out/renderer/assets/{jsx-dev-runtime-DshTpFeb.js → jsx-dev-runtime-Cc6Jhn6s.js} +1 -1
  94. package/out/renderer/index.html +2 -2
  95. package/out/resources/prompts/system-prompt.hbs +11 -0
  96. package/out/resources/skills/extension-creator/SKILL.md +32 -1
  97. package/out/resources/skills/extension-creator/references/event-types.md +3 -3
  98. package/out/resources/skills/extension-creator/references/extension-interface.md +67 -0
  99. package/out/resources/skills/extension-creator/references/external-agent-providers.md +90 -0
  100. package/out/resources/skills/extension-creator/references/ui-components.md +29 -4
  101. package/out/runner.js +2235 -393
  102. package/package.json +22 -22
  103. package/out/renderer/assets/abnfDiagram-N423BO3Z-D0STbTTF.js +0 -118
  104. package/out/renderer/assets/arc-DeFSKBzy.js +0 -131
  105. package/out/renderer/assets/architectureDiagram-T3A2C74G-BDrfxwK6.js +0 -8829
  106. package/out/renderer/assets/band-zXq5o_Ib.js +0 -77
  107. package/out/renderer/assets/blockDiagram-VBNYF7ZC-x_YF9Yme.js +0 -3824
  108. package/out/renderer/assets/c4Diagram-5PPSVZJV-C7kuvNRf.js +0 -2482
  109. package/out/renderer/assets/channel-T97-CMvj.js +0 -7
  110. package/out/renderer/assets/chunk-2GRJ4B5K-C7nbnxgH.js +0 -116
  111. package/out/renderer/assets/chunk-2Q5K7J3B-D5IUyzX4.js +0 -19
  112. package/out/renderer/assets/chunk-5RXB4S5H-DkL2I1-Q.js +0 -1988
  113. package/out/renderer/assets/chunk-5VM5RSS4-qszW8EYL.js +0 -19
  114. package/out/renderer/assets/chunk-6Q2QTUOP-CbtMo4y_.js +0 -860
  115. package/out/renderer/assets/chunk-GF5L2VYU-C6qdgHXJ.js +0 -2026
  116. package/out/renderer/assets/chunk-JWPE2WC7-DxAg7bLn.js +0 -16
  117. package/out/renderer/assets/chunk-KBJHAD2P-Cqd2HDdS.js +0 -24
  118. package/out/renderer/assets/chunk-RYQCIY6F-DVzbqgRf.js +0 -474
  119. package/out/renderer/assets/chunk-XXDRQBXY-DF_8pbWI.js +0 -13
  120. package/out/renderer/assets/classDiagram-JCYQIIEL-MfTsDS5w.js +0 -23
  121. package/out/renderer/assets/classDiagram-v2-OCEON4UE-MfTsDS5w.js +0 -23
  122. package/out/renderer/assets/cose-bilkent-JH36ORCC-BvzyW9fn.js +0 -4942
  123. package/out/renderer/assets/cynefin-VYW2F7L2-BmRenSSB.js +0 -32093
  124. package/out/renderer/assets/cynefinDiagram-MW4NZA55-DmybMaTR.js +0 -453
  125. package/out/renderer/assets/cytoscape.esm-Bx_1tVW-.js +0 -30332
  126. package/out/renderer/assets/dagre-VZM6K2ZE-b6plu1_t.js +0 -522
  127. package/out/renderer/assets/defaultLocale-B2RvLBDe.js +0 -206
  128. package/out/renderer/assets/diagram-7IWD3JNH-B0LyLNK-.js +0 -488
  129. package/out/renderer/assets/diagram-B4RE2ZJO-BtJGLH72.js +0 -632
  130. package/out/renderer/assets/diagram-LBJQPF4R-BpSykW90.js +0 -212
  131. package/out/renderer/assets/diagram-Q27KOJAE-_vw0jdNl.js +0 -857
  132. package/out/renderer/assets/diagram-UB23O5K3-rE12zYQ8.js +0 -311
  133. package/out/renderer/assets/ebnfDiagram-BXEA7PRR-BXR1_d_o.js +0 -138
  134. package/out/renderer/assets/erDiagram-JOGREHBK-B1QCAGl4.js +0 -1238
  135. package/out/renderer/assets/flowDiagram-UKHOOZJN-wRfN63to.js +0 -2348
  136. package/out/renderer/assets/ganttDiagram-PKOTCBZU-DsXpzatp.js +0 -2782
  137. package/out/renderer/assets/gitGraphDiagram-DS77QQ5N-CsYsZ42q.js +0 -1373
  138. package/out/renderer/assets/graph-CfUL5tFv.js +0 -1308
  139. package/out/renderer/assets/infoDiagram-6WML65LV-BXT6TYnf.js +0 -31
  140. package/out/renderer/assets/init-CTO7spbL.js +0 -35
  141. package/out/renderer/assets/ishikawaDiagram-WSZJBQD7-6BJ687Ec.js +0 -967
  142. package/out/renderer/assets/journeyDiagram-NVQOT4AX-HgkRlCT0.js +0 -1255
  143. package/out/renderer/assets/kanban-definition-27J2QSJJ-COYri25f.js +0 -1052
  144. package/out/renderer/assets/layout-BBVpFPy1.js +0 -2326
  145. package/out/renderer/assets/linear-DuNIFrPi.js +0 -361
  146. package/out/renderer/assets/map-toxJVbdU.js +0 -299
  147. package/out/renderer/assets/mindmap-definition-FAOFIHXS-DhCEcxPL.js +0 -1153
  148. package/out/renderer/assets/ordinal-BD3Y6v77.js +0 -77
  149. package/out/renderer/assets/pegDiagram-VL7TDLO6-DZ8w3ViJ.js +0 -126
  150. package/out/renderer/assets/pieDiagram-7S7Q4E2Y-JcEYE_Dn.js +0 -316
  151. package/out/renderer/assets/quadrantDiagram-CIZ2JOQS-De59Sk4l.js +0 -1343
  152. package/out/renderer/assets/railroadDiagram-AXF67PYL-D7nWbE5S.js +0 -92
  153. package/out/renderer/assets/requirementDiagram-LRYGKXZP-DKWcKu7I.js +0 -1204
  154. package/out/renderer/assets/sankeyDiagram-W5VNT64P-Bj8jLitx.js +0 -1274
  155. package/out/renderer/assets/sequenceDiagram-SI44F4Z6-D9Jp65xC.js +0 -4514
  156. package/out/renderer/assets/sizeCapture-X5ZJPWSS-mY9H2lE6.js +0 -62
  157. package/out/renderer/assets/stateDiagram-OKZ733FA-BEn9ud4k.js +0 -452
  158. package/out/renderer/assets/stateDiagram-v2-UEYNNEHI-D_psrMs3.js +0 -22
  159. package/out/renderer/assets/swimlanes-SLNWSIFB-BMcpfWEi.js +0 -8557
  160. package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-OwdbT2xV.js +0 -20
  161. package/out/renderer/assets/time-DMe8nTku.js +0 -985
  162. package/out/renderer/assets/timeline-definition-Z64GVDOM-BTi-OvtJ.js +0 -1596
  163. package/out/renderer/assets/vennDiagram-T6HMQDX7-CoxSnB7W.js +0 -2515
  164. package/out/renderer/assets/wardleyDiagram-T6FBY63Y-Dj0FNpwr.js +0 -975
  165. package/out/renderer/assets/xychartDiagram-ELKLHX3M-jVSDR4Ov.js +0 -1943
  166. package/patches/ai+7.0.127.patch +0 -29
@@ -1,975 +0,0 @@
1
- import { p as populateCommonDb } from "./chunk-JWPE2WC7-DxAg7bLn.js";
2
- import { u as setAccDescription, v as getAccDescription, W as getDiagramTitle, V as setDiagramTitle, w as getAccTitle, x as setAccTitle, _ as __name, ao as getThemeVariables3, a3 as getConfig, a5 as cleanAndMerge, A as log, a8 as selectSvgElement, B as configureSvgSize, X as clear, y as getConfig2 } from "./index-DZ8Tuuit.js";
3
- import { p as parse } from "./cynefin-VYW2F7L2-BmRenSSB.js";
4
- var toPercent = /* @__PURE__ */ __name((value, context) => {
5
- const normalized = value <= 1 ? value * 100 : value;
6
- if (normalized < 0 || normalized > 100) {
7
- throw new Error(
8
- `${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value}`
9
- );
10
- }
11
- return normalized;
12
- }, "toPercent");
13
- var toCoordinates = /* @__PURE__ */ __name((visibility, evolution, context) => {
14
- return {
15
- x: toPercent(evolution, `${context} evolution`),
16
- y: toPercent(visibility, `${context} visibility`)
17
- };
18
- }, "toCoordinates");
19
- var getFlowFromPort = /* @__PURE__ */ __name((port) => {
20
- if (!port) {
21
- return void 0;
22
- }
23
- if (port === "+<>") {
24
- return "bidirectional";
25
- }
26
- if (port === "+<") {
27
- return "backward";
28
- }
29
- if (port === "+>") {
30
- return "forward";
31
- }
32
- return void 0;
33
- }, "getFlowFromPort");
34
- var extractFlowFromArrow = /* @__PURE__ */ __name((arrow) => {
35
- if (!arrow?.startsWith("+")) {
36
- return {};
37
- }
38
- const labelMatch = /^\+'([^']*)'/.exec(arrow);
39
- const flowLabel = labelMatch?.[1];
40
- if (arrow.includes("<>")) {
41
- return { flow: "bidirectional", label: flowLabel };
42
- }
43
- if (arrow.includes("<")) {
44
- return { flow: "backward", label: flowLabel };
45
- }
46
- if (arrow.includes(">")) {
47
- return { flow: "forward", label: flowLabel };
48
- }
49
- return { label: flowLabel };
50
- }, "extractFlowFromArrow");
51
- var populateDb = /* @__PURE__ */ __name((ast, db) => {
52
- populateCommonDb(ast, db);
53
- if (ast.size) {
54
- db.setSize(ast.size.width, ast.size.height);
55
- }
56
- if (ast.evolution) {
57
- const stages = ast.evolution.stages.map((stage) => {
58
- if (stage.secondName) {
59
- return `${stage.name.trim()} / ${stage.secondName.trim()}`;
60
- }
61
- return stage.name.trim();
62
- });
63
- const stageBoundaries = ast.evolution.stages.filter((stage) => stage.boundary !== void 0).map((stage) => stage.boundary);
64
- db.updateAxes({ stages, stageBoundaries });
65
- }
66
- ast.anchors.forEach((anchor) => {
67
- const coords = toCoordinates(anchor.visibility, anchor.evolution, `Anchor "${anchor.name}"`);
68
- db.addNode(anchor.name, anchor.name, coords.x, coords.y, "anchor");
69
- });
70
- ast.components.forEach((component) => {
71
- const coords = toCoordinates(
72
- component.visibility,
73
- component.evolution,
74
- `Component "${component.name}"`
75
- );
76
- const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
77
- const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
78
- const sourceStrategy = component.decorator?.strategy;
79
- db.addNode(
80
- component.name,
81
- component.name,
82
- coords.x,
83
- coords.y,
84
- "component",
85
- labelOffsetX,
86
- labelOffsetY,
87
- component.inertia,
88
- sourceStrategy
89
- );
90
- });
91
- ast.notes.forEach((note) => {
92
- const coords = toCoordinates(note.visibility, note.evolution, `Note "${note.text}"`);
93
- db.addNote(note.text, coords.x, coords.y);
94
- });
95
- ast.pipelines.forEach((pipeline) => {
96
- const parentNode = db.getNode(pipeline.parent);
97
- if (!parentNode || typeof parentNode.y !== "number") {
98
- throw new Error(
99
- `Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`
100
- );
101
- }
102
- const parentY = parentNode.y;
103
- db.startPipeline(pipeline.parent);
104
- pipeline.components.forEach((component) => {
105
- const componentId = `${pipeline.parent}_${component.name}`;
106
- const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
107
- const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
108
- const x = toPercent(component.evolution, `Pipeline component "${component.name}" evolution`);
109
- db.addNode(
110
- componentId,
111
- component.name,
112
- x,
113
- parentY,
114
- "pipeline-component",
115
- labelOffsetX,
116
- labelOffsetY
117
- );
118
- db.addPipelineComponent(pipeline.parent, componentId);
119
- });
120
- });
121
- ast.links.forEach((link) => {
122
- const isDashed = !!link.arrow && (link.arrow.includes("-.->") || link.arrow.includes(".-."));
123
- let flow = getFlowFromPort(link.fromPort) ?? getFlowFromPort(link.toPort);
124
- const { flow: arrowFlow, label: flowLabel } = extractFlowFromArrow(link.arrow);
125
- if (!flow && arrowFlow) {
126
- flow = arrowFlow;
127
- }
128
- const annotation = link.linkLabel;
129
- const label = flowLabel ?? annotation;
130
- db.addLink(db.resolveNodeId(link.from), db.resolveNodeId(link.to), isDashed, label, flow);
131
- });
132
- ast.evolves.forEach((evolve) => {
133
- const node = db.getNode(evolve.component);
134
- if (node?.y !== void 0) {
135
- const target = toPercent(evolve.target, `Evolve target for "${evolve.component}"`);
136
- db.addTrend(evolve.component, target, node.y);
137
- }
138
- });
139
- if (ast.annotations.length > 0) {
140
- const annotationsBox = ast.annotations[0];
141
- const coords = toCoordinates(annotationsBox.x, annotationsBox.y, "Annotations box");
142
- db.setAnnotationsBox(coords.x, coords.y);
143
- }
144
- ast.annotation.forEach((annotation) => {
145
- const coords = toCoordinates(annotation.x, annotation.y, `Annotation ${annotation.number}`);
146
- db.addAnnotation(annotation.number, [{ x: coords.x, y: coords.y }], annotation.text);
147
- });
148
- ast.accelerators.forEach((accelerator) => {
149
- const coords = toCoordinates(accelerator.x, accelerator.y, `Accelerator "${accelerator.name}"`);
150
- db.addAccelerator(accelerator.name, coords.x, coords.y);
151
- });
152
- ast.deaccelerators.forEach((deaccelerator) => {
153
- const coords = toCoordinates(
154
- deaccelerator.x,
155
- deaccelerator.y,
156
- `Deaccelerator "${deaccelerator.name}"`
157
- );
158
- db.addDeaccelerator(deaccelerator.name, coords.x, coords.y);
159
- });
160
- }, "populateDb");
161
- var parser = {
162
- parser: {
163
- // @ts-expect-error - WardleyDB is not assignable to DiagramDB
164
- yy: void 0
165
- },
166
- parse: /* @__PURE__ */ __name(async (input) => {
167
- const ast = await parse("wardley", input);
168
- log.debug(ast);
169
- const db = parser.parser?.yy;
170
- if (!db || typeof db.addNode !== "function") {
171
- throw new Error(
172
- "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."
173
- );
174
- }
175
- populateDb(ast, db);
176
- }, "parse")
177
- };
178
- var WardleyBuilder = class {
179
- constructor() {
180
- this.nodes = /* @__PURE__ */ new Map();
181
- this.links = [];
182
- this.trends = /* @__PURE__ */ new Map();
183
- this.pipelines = /* @__PURE__ */ new Map();
184
- this.annotations = [];
185
- this.notes = [];
186
- this.accelerators = [];
187
- this.deaccelerators = [];
188
- this.axes = {};
189
- }
190
- static {
191
- __name(this, "WardleyBuilder");
192
- }
193
- addNode(node) {
194
- const existing = this.nodes.get(node.id) ?? { id: node.id, label: node.label };
195
- const merged = {
196
- ...existing,
197
- ...node,
198
- className: node.className ?? existing.className,
199
- labelOffsetX: node.labelOffsetX ?? existing.labelOffsetX,
200
- labelOffsetY: node.labelOffsetY ?? existing.labelOffsetY
201
- };
202
- this.nodes.set(node.id, merged);
203
- }
204
- addLink(link) {
205
- this.links.push(link);
206
- }
207
- addTrend(trend) {
208
- this.trends.set(trend.nodeId, trend);
209
- }
210
- startPipeline(nodeId) {
211
- this.pipelines.set(nodeId, { nodeId, componentIds: [] });
212
- const node = this.nodes.get(nodeId);
213
- if (node) {
214
- node.isPipelineParent = true;
215
- }
216
- }
217
- addPipelineComponent(pipelineNodeId, componentId) {
218
- const pipeline = this.pipelines.get(pipelineNodeId);
219
- if (pipeline) {
220
- pipeline.componentIds.push(componentId);
221
- }
222
- const node = this.nodes.get(componentId);
223
- if (node) {
224
- node.inPipeline = true;
225
- }
226
- }
227
- addAnnotation(annotation) {
228
- this.annotations.push(annotation);
229
- }
230
- addNote(note) {
231
- this.notes.push(note);
232
- }
233
- addAccelerator(accelerator) {
234
- this.accelerators.push(accelerator);
235
- }
236
- addDeaccelerator(deaccelerator) {
237
- this.deaccelerators.push(deaccelerator);
238
- }
239
- setAnnotationsBox(x, y) {
240
- this.annotationsBox = { x, y };
241
- }
242
- setAxes(partial) {
243
- this.axes = {
244
- ...this.axes,
245
- ...partial
246
- };
247
- }
248
- setSize(width, height) {
249
- this.size = { width, height };
250
- }
251
- getNode(id) {
252
- return this.nodes.get(id);
253
- }
254
- /**
255
- * Resolve a name to a node ID. Tries exact ID match first,
256
- * then falls back to finding a node whose label matches the name
257
- * (handles pipeline components which have synthetic IDs like "Parent_Child").
258
- */
259
- resolveNodeId(name) {
260
- if (this.nodes.has(name)) {
261
- return name;
262
- }
263
- for (const [id, node] of this.nodes) {
264
- if (node.label === name) {
265
- return id;
266
- }
267
- }
268
- return name;
269
- }
270
- build() {
271
- const nodes = [];
272
- for (const node of this.nodes.values()) {
273
- if (typeof node.x !== "number" || typeof node.y !== "number") {
274
- throw new Error(`Node "${node.label}" is missing coordinates`);
275
- }
276
- nodes.push(node);
277
- }
278
- return {
279
- nodes,
280
- links: [...this.links],
281
- trends: [...this.trends.values()],
282
- pipelines: [...this.pipelines.values()],
283
- annotations: [...this.annotations],
284
- notes: [...this.notes],
285
- accelerators: [...this.accelerators],
286
- deaccelerators: [...this.deaccelerators],
287
- annotationsBox: this.annotationsBox,
288
- axes: { ...this.axes },
289
- size: this.size
290
- };
291
- }
292
- clear() {
293
- this.nodes.clear();
294
- this.links = [];
295
- this.trends.clear();
296
- this.pipelines.clear();
297
- this.annotations = [];
298
- this.notes = [];
299
- this.accelerators = [];
300
- this.deaccelerators = [];
301
- this.annotationsBox = void 0;
302
- this.axes = {};
303
- this.size = void 0;
304
- }
305
- };
306
- var builder = new WardleyBuilder();
307
- function getConfig3() {
308
- return getConfig2()["wardley-beta"];
309
- }
310
- __name(getConfig3, "getConfig");
311
- function addNode(id, label, x, y, className, labelOffsetX, labelOffsetY, inertia, sourceStrategy) {
312
- builder.addNode({
313
- id,
314
- label,
315
- x,
316
- y,
317
- className,
318
- labelOffsetX,
319
- labelOffsetY,
320
- inertia,
321
- sourceStrategy
322
- });
323
- }
324
- __name(addNode, "addNode");
325
- function addLink(sourceId, targetId, dashed = false, label, flow) {
326
- builder.addLink({
327
- source: sourceId,
328
- target: targetId,
329
- dashed,
330
- label,
331
- flow
332
- });
333
- }
334
- __name(addLink, "addLink");
335
- function addTrend(nodeId, targetX, targetY) {
336
- builder.addTrend({ nodeId, targetX, targetY });
337
- }
338
- __name(addTrend, "addTrend");
339
- function addAnnotation(number, coordinates, text) {
340
- builder.addAnnotation({
341
- number,
342
- coordinates,
343
- text
344
- });
345
- }
346
- __name(addAnnotation, "addAnnotation");
347
- function addNote(text, x, y) {
348
- builder.addNote({
349
- text,
350
- x,
351
- y
352
- });
353
- }
354
- __name(addNote, "addNote");
355
- function addAccelerator(name, x, y) {
356
- builder.addAccelerator({
357
- name,
358
- x,
359
- y
360
- });
361
- }
362
- __name(addAccelerator, "addAccelerator");
363
- function addDeaccelerator(name, x, y) {
364
- builder.addDeaccelerator({
365
- name,
366
- x,
367
- y
368
- });
369
- }
370
- __name(addDeaccelerator, "addDeaccelerator");
371
- function setAnnotationsBox(x, y) {
372
- builder.setAnnotationsBox(x, y);
373
- }
374
- __name(setAnnotationsBox, "setAnnotationsBox");
375
- function setSize(width, height) {
376
- builder.setSize(width, height);
377
- }
378
- __name(setSize, "setSize");
379
- function startPipeline(nodeId) {
380
- builder.startPipeline(nodeId);
381
- }
382
- __name(startPipeline, "startPipeline");
383
- function addPipelineComponent(pipelineNodeId, componentId) {
384
- builder.addPipelineComponent(pipelineNodeId, componentId);
385
- }
386
- __name(addPipelineComponent, "addPipelineComponent");
387
- function updateAxes(partial) {
388
- builder.setAxes(partial);
389
- }
390
- __name(updateAxes, "updateAxes");
391
- function getNode(id) {
392
- return builder.getNode(id);
393
- }
394
- __name(getNode, "getNode");
395
- function resolveNodeId(name) {
396
- return builder.resolveNodeId(name);
397
- }
398
- __name(resolveNodeId, "resolveNodeId");
399
- function getWardleyData() {
400
- return builder.build();
401
- }
402
- __name(getWardleyData, "getWardleyData");
403
- function clear2() {
404
- builder.clear();
405
- clear();
406
- }
407
- __name(clear2, "clear");
408
- var wardleyDb_default = {
409
- getConfig: getConfig3,
410
- addNode,
411
- addLink,
412
- addTrend,
413
- addAnnotation,
414
- addNote,
415
- addAccelerator,
416
- addDeaccelerator,
417
- setAnnotationsBox,
418
- setSize,
419
- startPipeline,
420
- addPipelineComponent,
421
- updateAxes,
422
- getNode,
423
- resolveNodeId,
424
- getWardleyData,
425
- clear: clear2,
426
- setAccTitle,
427
- getAccTitle,
428
- setDiagramTitle,
429
- getDiagramTitle,
430
- getAccDescription,
431
- setAccDescription
432
- };
433
- var DEFAULT_STAGES = ["Genesis", "Custom Built", "Product", "Commodity"];
434
- var getTheme = /* @__PURE__ */ __name(() => {
435
- const { themeVariables } = getConfig2();
436
- return {
437
- backgroundColor: themeVariables.wardley?.backgroundColor ?? themeVariables.background ?? "#fff",
438
- axisColor: themeVariables.wardley?.axisColor ?? "#000",
439
- axisTextColor: themeVariables.wardley?.axisTextColor ?? themeVariables.primaryTextColor ?? "#222",
440
- gridColor: themeVariables.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
441
- componentFill: themeVariables.wardley?.componentFill ?? "#fff",
442
- componentStroke: themeVariables.wardley?.componentStroke ?? "#000",
443
- componentLabelColor: themeVariables.wardley?.componentLabelColor ?? themeVariables.primaryTextColor ?? "#222",
444
- linkStroke: themeVariables.wardley?.linkStroke ?? "#000",
445
- evolutionStroke: themeVariables.wardley?.evolutionStroke ?? "#dc3545",
446
- annotationStroke: themeVariables.wardley?.annotationStroke ?? "#000",
447
- annotationTextColor: themeVariables.wardley?.annotationTextColor ?? themeVariables.primaryTextColor ?? "#222",
448
- annotationFill: themeVariables.wardley?.annotationFill ?? themeVariables.background ?? "#fff"
449
- };
450
- }, "getTheme");
451
- var getConfigValues = /* @__PURE__ */ __name(() => {
452
- const wardleyConfig = getConfig2()["wardley-beta"];
453
- return {
454
- width: wardleyConfig?.width ?? 900,
455
- height: wardleyConfig?.height ?? 600,
456
- padding: wardleyConfig?.padding ?? 48,
457
- nodeRadius: wardleyConfig?.nodeRadius ?? 6,
458
- nodeLabelOffset: wardleyConfig?.nodeLabelOffset ?? 8,
459
- axisFontSize: wardleyConfig?.axisFontSize ?? 12,
460
- labelFontSize: wardleyConfig?.labelFontSize ?? 10,
461
- showGrid: wardleyConfig?.showGrid ?? false,
462
- useMaxWidth: wardleyConfig?.useMaxWidth ?? true
463
- };
464
- }, "getConfigValues");
465
- var draw = /* @__PURE__ */ __name((text, id, _version, diagObj) => {
466
- log.debug("Rendering Wardley map\n" + text);
467
- const configValues = getConfigValues();
468
- const theme = getTheme();
469
- const squareSize = configValues.nodeRadius * 1.6;
470
- const db = diagObj.db;
471
- const data = db.getWardleyData();
472
- const title = db.getDiagramTitle();
473
- const width = data.size?.width ?? configValues.width;
474
- const height = data.size?.height ?? configValues.height;
475
- const svg = selectSvgElement(id);
476
- svg.selectAll("*").remove();
477
- configureSvgSize(svg, height, width, configValues.useMaxWidth);
478
- svg.attr("viewBox", `0 0 ${width} ${height}`);
479
- const root = svg.append("g").attr("class", "wardley-map");
480
- const defs = svg.append("defs");
481
- defs.append("marker").attr("id", `arrow-${id}`).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", theme.evolutionStroke).attr("stroke", "none");
482
- defs.append("marker").attr("id", `link-arrow-end-${id}`).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", theme.linkStroke).attr("stroke", "none");
483
- defs.append("marker").attr("id", `link-arrow-start-${id}`).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", theme.linkStroke).attr("stroke", "none");
484
- root.append("rect").attr("class", "wardley-background").attr("width", width).attr("height", height).attr("fill", theme.backgroundColor);
485
- const chartWidth = width - configValues.padding * 2;
486
- const chartHeight = height - configValues.padding * 2;
487
- if (title) {
488
- root.append("text").attr("class", "wardley-title").attr("x", width / 2).attr("y", configValues.padding / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
489
- }
490
- const projectX = /* @__PURE__ */ __name((value) => configValues.padding + value / 100 * chartWidth, "projectX");
491
- const projectY = /* @__PURE__ */ __name((value) => height - configValues.padding - value / 100 * chartHeight, "projectY");
492
- const axisGroup = root.append("g").attr("class", "wardley-axes");
493
- axisGroup.append("line").attr("x1", configValues.padding).attr("x2", width - configValues.padding).attr("y1", height - configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
494
- axisGroup.append("line").attr("x1", configValues.padding).attr("x2", configValues.padding).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1);
495
- const xLabel = data.axes.xLabel ?? "Evolution";
496
- const yLabel = data.axes.yLabel ?? "Visibility";
497
- axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", configValues.padding + chartWidth / 2).attr("y", height - configValues.padding / 4).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(xLabel);
498
- axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", configValues.padding / 3).attr("y", configValues.padding + chartHeight / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr(
499
- "transform",
500
- `rotate(-90 ${configValues.padding / 3} ${configValues.padding + chartHeight / 2})`
501
- ).text(yLabel);
502
- const stages = data.axes.stages && data.axes.stages.length > 0 ? data.axes.stages : DEFAULT_STAGES;
503
- if (stages.length > 0) {
504
- const stageGroup = root.append("g").attr("class", "wardley-stages");
505
- const boundaries = data.axes.stageBoundaries;
506
- const stagePositions = [];
507
- if (boundaries && boundaries.length === stages.length) {
508
- let prevBoundary = 0;
509
- boundaries.forEach((boundary) => {
510
- stagePositions.push({ start: prevBoundary, end: boundary });
511
- prevBoundary = boundary;
512
- });
513
- } else {
514
- const stageWidth = 1 / stages.length;
515
- stages.forEach((_, index) => {
516
- stagePositions.push({
517
- start: index * stageWidth,
518
- end: (index + 1) * stageWidth
519
- });
520
- });
521
- }
522
- stages.forEach((stage, index) => {
523
- const pos = stagePositions[index];
524
- const startX = configValues.padding + pos.start * chartWidth;
525
- const endX = configValues.padding + pos.end * chartWidth;
526
- const centerX = (startX + endX) / 2;
527
- if (index > 0) {
528
- stageGroup.append("line").attr("x1", startX).attr("x2", startX).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", 0.8);
529
- }
530
- stageGroup.append("text").attr("class", "wardley-stage-label").attr("x", centerX).attr("y", height - configValues.padding / 1.5).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize - 2).attr("text-anchor", "middle").text(stage);
531
- });
532
- }
533
- if (configValues.showGrid) {
534
- const gridGroup = root.append("g").attr("class", "wardley-grid");
535
- for (let i = 1; i < 4; i++) {
536
- const ratio = i / 4;
537
- const x = configValues.padding + chartWidth * ratio;
538
- gridGroup.append("line").attr("x1", x).attr("x2", x).attr("y1", configValues.padding).attr("y2", height - configValues.padding).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
539
- gridGroup.append("line").attr("x1", configValues.padding).attr("x2", width - configValues.padding).attr("y1", height - configValues.padding - chartHeight * ratio).attr("y2", height - configValues.padding - chartHeight * ratio).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6");
540
- }
541
- }
542
- const positions = /* @__PURE__ */ new Map();
543
- data.nodes.forEach((node) => {
544
- positions.set(node.id, {
545
- x: projectX(node.x),
546
- y: projectY(node.y),
547
- node
548
- });
549
- });
550
- if (data.pipelines.length > 0) {
551
- const pipelineGroup = root.append("g").attr("class", "wardley-pipelines");
552
- const pipelineLinksGroup = root.append("g").attr("class", "wardley-pipeline-links");
553
- data.pipelines.forEach((pipeline) => {
554
- if (pipeline.componentIds.length === 0) {
555
- return;
556
- }
557
- const sortedComponents = pipeline.componentIds.map((id2) => ({ id: id2, pos: positions.get(id2), node: data.nodes.find((n) => n.id === id2) })).filter((c) => c.pos && c.node).sort((a, b) => a.node.x - b.node.x);
558
- for (let i = 0; i < sortedComponents.length - 1; i++) {
559
- const current = sortedComponents[i];
560
- const next = sortedComponents[i + 1];
561
- pipelineLinksGroup.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", current.pos.x).attr("y1", current.pos.y).attr("x2", next.pos.x).attr("y2", next.pos.y).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
562
- }
563
- let minX = Infinity;
564
- let maxX = -Infinity;
565
- let y = 0;
566
- pipeline.componentIds.forEach((componentId) => {
567
- const pos = positions.get(componentId);
568
- if (pos) {
569
- minX = Math.min(minX, pos.x);
570
- maxX = Math.max(maxX, pos.x);
571
- y = pos.y;
572
- }
573
- });
574
- if (minX !== Infinity && maxX !== -Infinity) {
575
- const padding = 15;
576
- const height2 = configValues.nodeRadius * 4;
577
- const boxTop = y - height2 / 2;
578
- const parentPos = positions.get(pipeline.nodeId);
579
- if (parentPos) {
580
- const centerX = (minX + maxX) / 2;
581
- parentPos.x = centerX;
582
- parentPos.y = boxTop - squareSize / 6;
583
- }
584
- pipelineGroup.append("rect").attr("class", "wardley-pipeline-box").attr("x", minX - padding).attr("y", boxTop).attr("width", maxX - minX + padding * 2).attr("height", height2).attr("fill", "none").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
585
- }
586
- });
587
- }
588
- const linksGroup = root.append("g").attr("class", "wardley-links");
589
- const pipelineMap = /* @__PURE__ */ new Map();
590
- data.pipelines.forEach((pipeline) => {
591
- pipelineMap.set(pipeline.nodeId, new Set(pipeline.componentIds));
592
- });
593
- const validLinks = data.links.filter((link) => {
594
- if (!positions.has(link.source) || !positions.has(link.target)) {
595
- return false;
596
- }
597
- const pipelineComponents = pipelineMap.get(link.target);
598
- if (pipelineComponents?.has(link.source)) {
599
- return false;
600
- }
601
- return true;
602
- });
603
- linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class", (link) => `wardley-link${link.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (link) => {
604
- const sourcePos = positions.get(link.source);
605
- const targetPos = positions.get(link.target);
606
- const sourceNode = data.nodes.find((n) => n.id === link.source);
607
- const radius = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
608
- const dx = targetPos.x - sourcePos.x;
609
- const dy = targetPos.y - sourcePos.y;
610
- const distance = Math.sqrt(dx * dx + dy * dy);
611
- return sourcePos.x + dx / distance * radius;
612
- }).attr("y1", (link) => {
613
- const sourcePos = positions.get(link.source);
614
- const targetPos = positions.get(link.target);
615
- const sourceNode = data.nodes.find((n) => n.id === link.source);
616
- const radius = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
617
- const dx = targetPos.x - sourcePos.x;
618
- const dy = targetPos.y - sourcePos.y;
619
- const distance = Math.sqrt(dx * dx + dy * dy);
620
- return sourcePos.y + dy / distance * radius;
621
- }).attr("x2", (link) => {
622
- const sourcePos = positions.get(link.source);
623
- const targetPos = positions.get(link.target);
624
- const targetNode = data.nodes.find((n) => n.id === link.target);
625
- const radius = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
626
- const dx = sourcePos.x - targetPos.x;
627
- const dy = sourcePos.y - targetPos.y;
628
- const distance = Math.sqrt(dx * dx + dy * dy);
629
- return targetPos.x + dx / distance * radius;
630
- }).attr("y2", (link) => {
631
- const sourcePos = positions.get(link.source);
632
- const targetPos = positions.get(link.target);
633
- const targetNode = data.nodes.find((n) => n.id === link.target);
634
- const radius = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
635
- const dx = sourcePos.x - targetPos.x;
636
- const dy = sourcePos.y - targetPos.y;
637
- const distance = Math.sqrt(dx * dx + dy * dy);
638
- return targetPos.y + dy / distance * radius;
639
- }).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (link) => link.dashed ? "6 6" : null).attr("marker-end", (link) => {
640
- if (link.flow === "forward" || link.flow === "bidirectional") {
641
- return `url(#link-arrow-end-${id})`;
642
- }
643
- return null;
644
- }).attr("marker-start", (link) => {
645
- if (link.flow === "backward" || link.flow === "bidirectional") {
646
- return `url(#link-arrow-start-${id})`;
647
- }
648
- return null;
649
- });
650
- linksGroup.selectAll("text").data(validLinks.filter((link) => link.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (link) => {
651
- const sourcePos = positions.get(link.source);
652
- const targetPos = positions.get(link.target);
653
- const midX = (sourcePos.x + targetPos.x) / 2;
654
- const dy = targetPos.y - sourcePos.y;
655
- const dx = targetPos.x - sourcePos.x;
656
- const distance = Math.sqrt(dx * dx + dy * dy);
657
- const offset = 8;
658
- const perpX = dy / distance;
659
- return midX + perpX * offset;
660
- }).attr("y", (link) => {
661
- const sourcePos = positions.get(link.source);
662
- const targetPos = positions.get(link.target);
663
- const midY = (sourcePos.y + targetPos.y) / 2;
664
- const dx = targetPos.x - sourcePos.x;
665
- const dy = targetPos.y - sourcePos.y;
666
- const distance = Math.sqrt(dx * dx + dy * dy);
667
- const offset = 8;
668
- const perpY = -dx / distance;
669
- return midY + perpY * offset;
670
- }).attr("fill", theme.axisTextColor).attr("font-size", configValues.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (link) => {
671
- const sourcePos = positions.get(link.source);
672
- const targetPos = positions.get(link.target);
673
- const midX = (sourcePos.x + targetPos.x) / 2;
674
- const midY = (sourcePos.y + targetPos.y) / 2;
675
- const dx = targetPos.x - sourcePos.x;
676
- const dy = targetPos.y - sourcePos.y;
677
- const distance = Math.sqrt(dx * dx + dy * dy);
678
- const offset = 8;
679
- const perpX = dy / distance;
680
- const perpY = -dx / distance;
681
- const labelX = midX + perpX * offset;
682
- const labelY = midY + perpY * offset;
683
- let angle = Math.atan2(dy, dx) * 180 / Math.PI;
684
- if (angle > 90 || angle < -90) {
685
- angle += 180;
686
- }
687
- return `rotate(${angle} ${labelX} ${labelY})`;
688
- }).text((link) => link.label);
689
- const trendGroup = root.append("g").attr("class", "wardley-trends");
690
- const trendsWithPositions = data.trends.map((trend) => {
691
- const origin = positions.get(trend.nodeId);
692
- if (!origin) {
693
- return null;
694
- }
695
- const targetX = projectX(trend.targetX);
696
- const targetY = projectY(trend.targetY);
697
- const dx = targetX - origin.x;
698
- const dy = targetY - origin.y;
699
- const distance = Math.sqrt(dx * dx + dy * dy);
700
- const shortenBy = configValues.nodeRadius + 2;
701
- const adjustedX2 = distance > shortenBy ? targetX - dx / distance * shortenBy : targetX;
702
- const adjustedY2 = distance > shortenBy ? targetY - dy / distance * shortenBy : targetY;
703
- return {
704
- origin,
705
- targetX,
706
- targetY,
707
- adjustedX2,
708
- adjustedY2
709
- };
710
- }).filter((trend) => trend !== null);
711
- trendGroup.selectAll("line").data(trendsWithPositions).enter().append("line").attr("class", "wardley-trend").attr("x1", (trend) => trend.origin.x).attr("y1", (trend) => trend.origin.y).attr("x2", (trend) => trend.adjustedX2).attr("y2", (trend) => trend.adjustedY2).attr("stroke", theme.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${id})`);
712
- const nodesGroup = root.append("g").attr("class", "wardley-nodes");
713
- const nodeEnter = nodesGroup.selectAll("g").data(data.nodes).enter().append("g").attr(
714
- "class",
715
- (node) => ["wardley-node", node.className ? `wardley-node--${node.className}` : ""].filter(Boolean).join(" ")
716
- );
717
- nodeEnter.filter((node) => node.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#666").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
718
- nodeEnter.filter((node) => node.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
719
- nodeEnter.filter((node) => node.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1);
720
- const marketNodes = nodeEnter.filter((node) => node.sourceStrategy === "market");
721
- marketNodes.append("circle").attr("class", "wardley-market-overlay").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
722
- nodeEnter.filter(
723
- (node) => !node.isPipelineParent && node.sourceStrategy !== "market" && node.className !== "anchor"
724
- ).append("circle").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y).attr("r", configValues.nodeRadius).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
725
- const smallCircleRadius = configValues.nodeRadius * 0.7;
726
- const triangleRadius = configValues.nodeRadius * 1.2;
727
- marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x).attr("y1", (node) => positions.get(node.id).y - triangleRadius).attr("x2", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
728
- marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
729
- marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node) => positions.get(node.id).x).attr("y2", (node) => positions.get(node.id).y - triangleRadius).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
730
- marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x).attr("cy", (node) => positions.get(node.id).y - triangleRadius).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
731
- marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
732
- marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node) => positions.get(node.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node) => positions.get(node.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2);
733
- nodeEnter.filter((node) => node.isPipelineParent === true).append("rect").attr("x", (node) => positions.get(node.id).x - squareSize / 2).attr("y", (node) => positions.get(node.id).y - squareSize / 2).attr("width", squareSize).attr("height", squareSize).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1);
734
- nodeEnter.filter((node) => node.inertia === true).append("line").attr("class", "wardley-inertia").attr("x1", (node) => {
735
- const pos = positions.get(node.id);
736
- let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
737
- if (node.sourceStrategy) {
738
- offset += configValues.nodeRadius + 10;
739
- }
740
- return pos.x + offset;
741
- }).attr("y1", (node) => {
742
- const pos = positions.get(node.id);
743
- const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
744
- return pos.y - lineHeight / 2;
745
- }).attr("x2", (node) => {
746
- const pos = positions.get(node.id);
747
- let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
748
- if (node.sourceStrategy) {
749
- offset += configValues.nodeRadius + 10;
750
- }
751
- return pos.x + offset;
752
- }).attr("y2", (node) => {
753
- const pos = positions.get(node.id);
754
- const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
755
- return pos.y + lineHeight / 2;
756
- }).attr("stroke", theme.componentStroke).attr("stroke-width", 6);
757
- nodeEnter.append("text").attr("x", (node) => {
758
- const pos = positions.get(node.id);
759
- if (node.className === "anchor") {
760
- return node.labelOffsetX !== void 0 ? pos.x + node.labelOffsetX : pos.x;
761
- }
762
- let defaultOffset = configValues.nodeLabelOffset;
763
- if (node.sourceStrategy && node.labelOffsetX === void 0) {
764
- defaultOffset += 10;
765
- }
766
- const customOffset = node.labelOffsetX ?? defaultOffset;
767
- return pos.x + customOffset;
768
- }).attr("y", (node) => {
769
- const pos = positions.get(node.id);
770
- if (node.className === "anchor") {
771
- return node.labelOffsetY !== void 0 ? pos.y + node.labelOffsetY : pos.y - 3;
772
- }
773
- let defaultOffset = -configValues.nodeLabelOffset;
774
- if (node.sourceStrategy && node.labelOffsetY === void 0) {
775
- defaultOffset -= 10;
776
- }
777
- const customOffset = node.labelOffsetY ?? defaultOffset;
778
- return pos.y + customOffset;
779
- }).attr("class", "wardley-node-label").attr("fill", (node) => {
780
- if (node.className === "evolved") {
781
- return theme.evolutionStroke;
782
- }
783
- if (node.className === "anchor") {
784
- return "#000";
785
- }
786
- return theme.componentLabelColor;
787
- }).attr("font-size", configValues.labelFontSize).attr("font-weight", (node) => node.className === "anchor" ? "bold" : "normal").attr("text-anchor", (node) => node.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (node) => node.className === "anchor" ? "middle" : "auto").text((node) => node.label);
788
- if (data.annotations.length > 0) {
789
- const annotationsGroup = root.append("g").attr("class", "wardley-annotations");
790
- data.annotations.forEach((annotation) => {
791
- const projectedCoords = annotation.coordinates.map((coord) => ({
792
- x: projectX(coord.x),
793
- y: projectY(coord.y)
794
- }));
795
- if (projectedCoords.length > 1) {
796
- for (let i = 0; i < projectedCoords.length - 1; i++) {
797
- annotationsGroup.append("line").attr("class", "wardley-annotation-line").attr("x1", projectedCoords[i].x).attr("y1", projectedCoords[i].y).attr("x2", projectedCoords[i + 1].x).attr("y2", projectedCoords[i + 1].y).attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4");
798
- }
799
- }
800
- projectedCoords.forEach((coord) => {
801
- const annotationNode = annotationsGroup.append("g").attr("class", "wardley-annotation");
802
- annotationNode.append("circle").attr("cx", coord.x).attr("cy", coord.y).attr("r", 10).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5);
803
- annotationNode.append("text").attr("x", coord.x).attr("y", coord.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(annotation.number);
804
- });
805
- });
806
- if (data.annotationsBox) {
807
- let boxX = projectX(data.annotationsBox.x);
808
- let boxY = projectY(data.annotationsBox.y);
809
- const padding = 10;
810
- const lineHeight = 16;
811
- const fontSize = 11;
812
- const textBoxGroup = annotationsGroup.append("g").attr("class", "wardley-annotations-box");
813
- const sortedAnnotations = [...data.annotations].filter((a) => a.text).sort((a, b) => a.number - b.number);
814
- const textElements = [];
815
- sortedAnnotations.forEach((annotation, idx) => {
816
- const text2 = textBoxGroup.append("text").attr("x", boxX + padding).attr("y", boxY + padding + (idx + 1) * lineHeight).attr("font-size", fontSize).attr("fill", theme.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${annotation.number}. ${annotation.text}`);
817
- textElements.push(text2);
818
- });
819
- if (textElements.length > 0) {
820
- let maxWidth = 0;
821
- let maxHeight = 0;
822
- textElements.forEach((text2) => {
823
- const textNode = text2.node();
824
- const textWidth = textNode.getComputedTextLength();
825
- maxWidth = Math.max(maxWidth, textWidth);
826
- const bbox = textNode.getBBox();
827
- maxHeight = Math.max(maxHeight, bbox.height);
828
- });
829
- const boxWidth = maxWidth + padding * 2 + 105;
830
- const boxHeight = sortedAnnotations.length * lineHeight + padding * 2 + maxHeight / 2;
831
- const minX = configValues.padding;
832
- const maxX = width - configValues.padding - boxWidth;
833
- const minY = configValues.padding;
834
- const maxY = height - configValues.padding - boxHeight;
835
- boxX = Math.max(minX, Math.min(boxX, maxX));
836
- boxY = Math.max(minY, Math.min(boxY, maxY));
837
- textElements.forEach((text2, idx) => {
838
- text2.attr("x", boxX + padding).attr("y", boxY + padding + (idx + 1) * lineHeight);
839
- });
840
- textBoxGroup.insert("rect", "text").attr("x", boxX).attr("y", boxY).attr("width", boxWidth).attr("height", boxHeight).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
841
- }
842
- }
843
- }
844
- if (data.notes.length > 0) {
845
- const notesGroup = root.append("g").attr("class", "wardley-notes");
846
- data.notes.forEach((note) => {
847
- const noteX = projectX(note.x);
848
- const noteY = projectY(note.y);
849
- notesGroup.append("text").attr("x", noteX).attr("y", noteY).attr("text-anchor", "start").attr("font-size", 11).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(note.text);
850
- });
851
- }
852
- if (data.accelerators.length > 0) {
853
- const acceleratorsGroup = root.append("g").attr("class", "wardley-accelerators");
854
- data.accelerators.forEach((accelerator) => {
855
- const accX = projectX(accelerator.x);
856
- const accY = projectY(accelerator.y);
857
- const arrowWidth = 60;
858
- const arrowHeight = 30;
859
- const arrowHeadWidth = 20;
860
- const arrowPath = `
861
- M ${accX} ${accY - arrowHeight / 2}
862
- L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2}
863
- L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2 - 8}
864
- L ${accX + arrowWidth} ${accY}
865
- L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2 + 8}
866
- L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2}
867
- L ${accX} ${accY + arrowHeight / 2}
868
- Z
869
- `;
870
- acceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
871
- acceleratorsGroup.append("text").attr("x", accX + arrowWidth / 2).attr("y", accY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(accelerator.name);
872
- });
873
- }
874
- if (data.deaccelerators.length > 0) {
875
- const deacceleratorsGroup = root.append("g").attr("class", "wardley-deaccelerators");
876
- data.deaccelerators.forEach((deaccelerator) => {
877
- const decX = projectX(deaccelerator.x);
878
- const decY = projectY(deaccelerator.y);
879
- const arrowWidth = 60;
880
- const arrowHeight = 30;
881
- const arrowHeadWidth = 20;
882
- const arrowPath = `
883
- M ${decX + arrowWidth} ${decY - arrowHeight / 2}
884
- L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2}
885
- L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2 - 8}
886
- L ${decX} ${decY}
887
- L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2 + 8}
888
- L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2}
889
- L ${decX + arrowWidth} ${decY + arrowHeight / 2}
890
- Z
891
- `;
892
- deacceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
893
- deacceleratorsGroup.append("text").attr("x", decX + arrowWidth / 2).attr("y", decY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(deaccelerator.name);
894
- });
895
- }
896
- }, "draw");
897
- var wardleyRenderer_default = {
898
- draw
899
- };
900
- var styles = /* @__PURE__ */ __name(({
901
- wardley
902
- } = {}) => {
903
- const defaultThemeVariables = getThemeVariables3();
904
- const currentConfig = getConfig();
905
- const themeVariables = cleanAndMerge(defaultThemeVariables, currentConfig.themeVariables);
906
- const w = cleanAndMerge(themeVariables.wardley, wardley);
907
- return `
908
- .wardley-background {
909
- fill: ${w.backgroundColor};
910
- }
911
- .wardley-axes line, .wardley-axes path {
912
- stroke: ${w.axisColor};
913
- }
914
- .wardley-axis-label {
915
- fill: ${w.axisTextColor};
916
- }
917
- .wardley-stage-label {
918
- fill: ${w.axisTextColor};
919
- }
920
- .wardley-grid line {
921
- stroke: ${w.gridColor};
922
- }
923
- .wardley-node circle {
924
- fill: ${w.componentFill};
925
- stroke: ${w.componentStroke};
926
- }
927
- .wardley-node-label {
928
- fill: ${w.componentLabelColor};
929
- }
930
- .wardley-link {
931
- stroke: ${w.linkStroke};
932
- }
933
- .wardley-link--dashed {
934
- stroke-dasharray: 4 4;
935
- }
936
- .wardley-link-label {
937
- fill: ${w.axisTextColor};
938
- }
939
- .wardley-trend line {
940
- stroke: ${w.evolutionStroke};
941
- }
942
- .wardley-annotation-line {
943
- stroke: ${w.annotationStroke};
944
- }
945
- .wardley-annotation circle {
946
- fill: ${w.annotationFill};
947
- stroke: ${w.annotationStroke};
948
- }
949
- .wardley-annotation text {
950
- fill: ${w.annotationTextColor};
951
- }
952
- .wardley-annotations-box rect {
953
- fill: ${w.annotationFill};
954
- stroke: ${w.annotationStroke};
955
- }
956
- .wardley-annotations-box text {
957
- fill: ${w.annotationTextColor};
958
- }
959
- .wardley-pipeline-box {
960
- stroke: ${w.componentStroke};
961
- }
962
- .wardley-notes text {
963
- fill: ${w.axisTextColor};
964
- }
965
- `;
966
- }, "styles");
967
- var diagram = {
968
- parser,
969
- db: wardleyDb_default,
970
- renderer: wardleyRenderer_default,
971
- styles
972
- };
973
- export {
974
- diagram
975
- };