@umami/shiso 1.11.0 → 1.13.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 (148) hide show
  1. package/bin/shiso.mjs +20 -1
  2. package/dist/chunks/App.js +412 -51
  3. package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
  4. package/dist/chunks/arc.js +130 -0
  5. package/dist/chunks/architecture-7GRP2DOG.js +4 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
  7. package/dist/chunks/array.js +8 -0
  8. package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
  9. package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
  10. package/dist/chunks/channel.js +9 -0
  11. package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
  12. package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
  13. package/dist/chunks/chunk-5VM5RSS4.js +21 -0
  14. package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
  15. package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
  16. package/dist/chunks/chunk-F27PBJKO.js +95 -0
  17. package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
  18. package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
  19. package/dist/chunks/chunk-GVQU2GXP.js +58 -0
  20. package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
  21. package/dist/chunks/chunk-JWPE2WC7.js +12 -0
  22. package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
  23. package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
  24. package/dist/chunks/chunk-P2QGCYS3.js +95 -0
  25. package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
  26. package/dist/chunks/chunk-PWAF6VOD.js +467 -0
  27. package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
  28. package/dist/chunks/chunk-SVP7TREG.js +686 -0
  29. package/dist/chunks/chunk-TICWLB2K.js +3800 -0
  30. package/dist/chunks/chunk-XXDRQBXY.js +12 -0
  31. package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
  32. package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
  33. package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
  34. package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
  35. package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
  36. package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
  37. package/dist/chunks/cytoscape.esm.js +28282 -0
  38. package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
  39. package/dist/chunks/dagre.js +4235 -0
  40. package/dist/chunks/defaultLocale.js +246 -0
  41. package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
  42. package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
  43. package/dist/chunks/diagram-VSXAHHWV.js +553 -0
  44. package/dist/chunks/diagram-VX7I27RA.js +798 -0
  45. package/dist/chunks/diagram-Z3DM3KII.js +186 -0
  46. package/dist/chunks/dist.js +92 -0
  47. package/dist/chunks/docs.js +989 -93
  48. package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
  49. package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
  50. package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
  51. package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
  52. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
  53. package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
  54. package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
  55. package/dist/chunks/graphlib.js +4194 -0
  56. package/dist/chunks/info-A6RAGUB7.js +4 -0
  57. package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
  58. package/dist/chunks/init.js +14 -0
  59. package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
  60. package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
  61. package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
  62. package/dist/chunks/katex.js +26463 -0
  63. package/dist/chunks/line.js +48 -0
  64. package/dist/chunks/linear.js +391 -0
  65. package/dist/chunks/mermaid-parser.core.js +754 -0
  66. package/dist/chunks/mermaid.core.js +4898 -0
  67. package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
  68. package/dist/chunks/ordinal.js +84 -0
  69. package/dist/chunks/packet-AYTQ26CC.js +4 -0
  70. package/dist/chunks/path.js +106 -0
  71. package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
  72. package/dist/chunks/pie-WAS4IAKB.js +4 -0
  73. package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
  74. package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
  75. package/dist/chunks/radar-RG4KPBEZ.js +4 -0
  76. package/dist/chunks/railroad-74A4TZTK.js +4 -0
  77. package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
  78. package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
  79. package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
  80. package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
  81. package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
  82. package/dist/chunks/rough.esm.js +1396 -0
  83. package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
  84. package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
  85. package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
  86. package/dist/chunks/src.js +2653 -0
  87. package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
  88. package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
  89. package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
  90. package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
  91. package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
  92. package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
  93. package/dist/chunks/treemap-WGGIJYW6.js +4 -0
  94. package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
  95. package/dist/chunks/wardley-WFR3VGLG.js +4 -0
  96. package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
  97. package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
  98. package/dist/components.js +2 -2
  99. package/dist/entry-client.js +2 -2
  100. package/dist/entry-server.js +31 -3
  101. package/docs.schema.json +90 -0
  102. package/mdx.config.ts +13 -97
  103. package/package.json +6 -4
  104. package/scripts/build-runtime.mjs +1 -0
  105. package/scripts/check-content.mjs +358 -0
  106. package/scripts/expand-navigation-globs.mjs +277 -0
  107. package/scripts/expand-openapi-navigation.mjs +94 -0
  108. package/scripts/generate-openapi.mjs +117 -0
  109. package/scripts/generate-search-index.mjs +31 -1
  110. package/scripts/lib/openapi.mjs +653 -0
  111. package/scripts/load-docs-config.mjs +52 -6
  112. package/scripts/load-shiso-config.mjs +45 -3
  113. package/scripts/prerender.mjs +83 -3
  114. package/scripts/vite-docs-config.mjs +27 -6
  115. package/src/App.tsx +0 -1
  116. package/src/components/CodeBlock.tsx +108 -8
  117. package/src/components/DocContent.tsx +18 -0
  118. package/src/components/Docs.tsx +45 -17
  119. package/src/components/OpenApiOperation.tsx +205 -0
  120. package/src/components/SideNav.tsx +13 -2
  121. package/src/components/docs/Changelog.tsx +163 -0
  122. package/src/components/docs/CodeGroup.tsx +6 -2
  123. package/src/components/docs/Mermaid.tsx +164 -0
  124. package/src/components/docs/Panel.tsx +23 -0
  125. package/src/components/docs/ParamField.tsx +17 -5
  126. package/src/components/docs/PropertiesTable.tsx +2 -2
  127. package/src/components/docs/ResponseField.tsx +17 -5
  128. package/src/components/docs/Tiles.tsx +59 -0
  129. package/src/components/docs/Tree.tsx +359 -0
  130. package/src/components/docs/Update.tsx +72 -0
  131. package/src/components/docs/index.ts +7 -0
  132. package/src/components/docs/panel-context.tsx +25 -0
  133. package/src/components/docs/styles.ts +49 -0
  134. package/src/components/icons/index.ts +4 -0
  135. package/src/entry-server.tsx +50 -0
  136. package/src/lib/code-blocks.ts +18 -0
  137. package/src/lib/code-meta.ts +87 -0
  138. package/src/lib/docs-config.ts +4 -1
  139. package/src/lib/openapi.generated.ts +4 -0
  140. package/src/lib/openapi.ts +63 -0
  141. package/src/lib/rehype-shiki.ts +213 -0
  142. package/src/lib/site-model.ts +2 -0
  143. package/src/lib/types.ts +116 -2
  144. package/src/styles/global.css +63 -73
  145. package/types/components.d.ts +79 -0
  146. package/types/config.d.ts +11 -4
  147. package/vite.config.ts +49 -3
  148. package/CHANGELOG.md +0 -171
@@ -0,0 +1,877 @@
1
+ import { n as parse } from "./mermaid-parser.core.js";
2
+ import { n as __name } from "./chunk-Y2CYZVJY.js";
3
+ import { m as log } from "./src.js";
4
+ import { D as getThemeVariables3, H as setAccDescription, K as setDiagramTitle, U as setAccTitle, a as clear, b as getConfig, c as configureSvgSize, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-DU6HZSFF.js";
5
+ import { i as cleanAndMerge } from "./chunk-75Z2AOVW.js";
6
+ import { t as populateCommonDb } from "./chunk-JWPE2WC7.js";
7
+ import { f as selectSvgElement } from "./mermaid.core.js";
8
+
9
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-VM6X3IG4.mjs
10
+ var toPercent = /* @__PURE__ */ __name((value, context) => {
11
+ const normalized = value <= 1 ? value * 100 : value;
12
+ if (normalized < 0 || normalized > 100) throw new Error(`${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value}`);
13
+ return normalized;
14
+ }, "toPercent");
15
+ var toCoordinates = /* @__PURE__ */ __name((visibility, evolution, context) => {
16
+ return {
17
+ x: toPercent(evolution, `${context} evolution`),
18
+ y: toPercent(visibility, `${context} visibility`)
19
+ };
20
+ }, "toCoordinates");
21
+ var getFlowFromPort = /* @__PURE__ */ __name((port) => {
22
+ if (!port) return;
23
+ if (port === "+<>") return "bidirectional";
24
+ if (port === "+<") return "backward";
25
+ if (port === "+>") return "forward";
26
+ }, "getFlowFromPort");
27
+ var extractFlowFromArrow = /* @__PURE__ */ __name((arrow) => {
28
+ if (!arrow?.startsWith("+")) return {};
29
+ const flowLabel = /^\+'([^']*)'/.exec(arrow)?.[1];
30
+ if (arrow.includes("<>")) return {
31
+ flow: "bidirectional",
32
+ label: flowLabel
33
+ };
34
+ if (arrow.includes("<")) return {
35
+ flow: "backward",
36
+ label: flowLabel
37
+ };
38
+ if (arrow.includes(">")) return {
39
+ flow: "forward",
40
+ label: flowLabel
41
+ };
42
+ return { label: flowLabel };
43
+ }, "extractFlowFromArrow");
44
+ var populateDb = /* @__PURE__ */ __name((ast, db) => {
45
+ populateCommonDb(ast, db);
46
+ if (ast.size) db.setSize(ast.size.width, ast.size.height);
47
+ if (ast.evolution) {
48
+ const stages = ast.evolution.stages.map((stage) => {
49
+ if (stage.secondName) return `${stage.name.trim()} / ${stage.secondName.trim()}`;
50
+ return stage.name.trim();
51
+ });
52
+ const stageBoundaries = ast.evolution.stages.filter((stage) => stage.boundary !== void 0).map((stage) => stage.boundary);
53
+ db.updateAxes({
54
+ stages,
55
+ stageBoundaries
56
+ });
57
+ }
58
+ ast.anchors.forEach((anchor) => {
59
+ const coords = toCoordinates(anchor.visibility, anchor.evolution, `Anchor "${anchor.name}"`);
60
+ db.addNode(anchor.name, anchor.name, coords.x, coords.y, "anchor");
61
+ });
62
+ ast.components.forEach((component) => {
63
+ const coords = toCoordinates(component.visibility, component.evolution, `Component "${component.name}"`);
64
+ const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
65
+ const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
66
+ const sourceStrategy = component.decorator?.strategy;
67
+ db.addNode(component.name, component.name, coords.x, coords.y, "component", labelOffsetX, labelOffsetY, component.inertia, sourceStrategy);
68
+ });
69
+ ast.notes.forEach((note) => {
70
+ const coords = toCoordinates(note.visibility, note.evolution, `Note "${note.text}"`);
71
+ db.addNote(note.text, coords.x, coords.y);
72
+ });
73
+ ast.pipelines.forEach((pipeline) => {
74
+ const parentNode = db.getNode(pipeline.parent);
75
+ if (!parentNode || typeof parentNode.y !== "number") throw new Error(`Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`);
76
+ const parentY = parentNode.y;
77
+ db.startPipeline(pipeline.parent);
78
+ pipeline.components.forEach((component) => {
79
+ const componentId = `${pipeline.parent}_${component.name}`;
80
+ const labelOffsetX = component.label ? (component.label.negX ? -1 : 1) * component.label.offsetX : void 0;
81
+ const labelOffsetY = component.label ? (component.label.negY ? -1 : 1) * component.label.offsetY : void 0;
82
+ const x = toPercent(component.evolution, `Pipeline component "${component.name}" evolution`);
83
+ db.addNode(componentId, component.name, x, parentY, "pipeline-component", labelOffsetX, labelOffsetY);
84
+ db.addPipelineComponent(pipeline.parent, componentId);
85
+ });
86
+ });
87
+ ast.links.forEach((link) => {
88
+ const isDashed = !!link.arrow && (link.arrow.includes("-.->") || link.arrow.includes(".-."));
89
+ let flow = getFlowFromPort(link.fromPort) ?? getFlowFromPort(link.toPort);
90
+ const { flow: arrowFlow, label: flowLabel } = extractFlowFromArrow(link.arrow);
91
+ if (!flow && arrowFlow) flow = arrowFlow;
92
+ const annotation = link.linkLabel;
93
+ const label = flowLabel ?? annotation;
94
+ db.addLink(db.resolveNodeId(link.from), db.resolveNodeId(link.to), isDashed, label, flow);
95
+ });
96
+ ast.evolves.forEach((evolve) => {
97
+ const node = db.getNode(evolve.component);
98
+ if (node?.y !== void 0) {
99
+ const target = toPercent(evolve.target, `Evolve target for "${evolve.component}"`);
100
+ db.addTrend(evolve.component, target, node.y);
101
+ }
102
+ });
103
+ if (ast.annotations.length > 0) {
104
+ const annotationsBox = ast.annotations[0];
105
+ const coords = toCoordinates(annotationsBox.x, annotationsBox.y, "Annotations box");
106
+ db.setAnnotationsBox(coords.x, coords.y);
107
+ }
108
+ ast.annotation.forEach((annotation) => {
109
+ const coords = toCoordinates(annotation.x, annotation.y, `Annotation ${annotation.number}`);
110
+ db.addAnnotation(annotation.number, [{
111
+ x: coords.x,
112
+ y: coords.y
113
+ }], annotation.text);
114
+ });
115
+ ast.accelerators.forEach((accelerator) => {
116
+ const coords = toCoordinates(accelerator.x, accelerator.y, `Accelerator "${accelerator.name}"`);
117
+ db.addAccelerator(accelerator.name, coords.x, coords.y);
118
+ });
119
+ ast.deaccelerators.forEach((deaccelerator) => {
120
+ const coords = toCoordinates(deaccelerator.x, deaccelerator.y, `Deaccelerator "${deaccelerator.name}"`);
121
+ db.addDeaccelerator(deaccelerator.name, coords.x, coords.y);
122
+ });
123
+ }, "populateDb");
124
+ var parser = {
125
+ parser: { yy: void 0 },
126
+ parse: /* @__PURE__ */ __name(async (input) => {
127
+ const ast = await parse("wardley", input);
128
+ log.debug(ast);
129
+ const db = parser.parser?.yy;
130
+ if (!db || typeof db.addNode !== "function") throw new 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.");
131
+ populateDb(ast, db);
132
+ }, "parse")
133
+ };
134
+ var WardleyBuilder = class {
135
+ constructor() {
136
+ this.nodes = /* @__PURE__ */ new Map();
137
+ this.links = [];
138
+ this.trends = /* @__PURE__ */ new Map();
139
+ this.pipelines = /* @__PURE__ */ new Map();
140
+ this.annotations = [];
141
+ this.notes = [];
142
+ this.accelerators = [];
143
+ this.deaccelerators = [];
144
+ this.axes = {};
145
+ }
146
+ static {
147
+ __name(this, "WardleyBuilder");
148
+ }
149
+ addNode(node) {
150
+ const existing = this.nodes.get(node.id) ?? {
151
+ id: node.id,
152
+ label: node.label
153
+ };
154
+ const merged = {
155
+ ...existing,
156
+ ...node,
157
+ className: node.className ?? existing.className,
158
+ labelOffsetX: node.labelOffsetX ?? existing.labelOffsetX,
159
+ labelOffsetY: node.labelOffsetY ?? existing.labelOffsetY
160
+ };
161
+ this.nodes.set(node.id, merged);
162
+ }
163
+ addLink(link) {
164
+ this.links.push(link);
165
+ }
166
+ addTrend(trend) {
167
+ this.trends.set(trend.nodeId, trend);
168
+ }
169
+ startPipeline(nodeId) {
170
+ this.pipelines.set(nodeId, {
171
+ nodeId,
172
+ componentIds: []
173
+ });
174
+ const node = this.nodes.get(nodeId);
175
+ if (node) node.isPipelineParent = true;
176
+ }
177
+ addPipelineComponent(pipelineNodeId, componentId) {
178
+ const pipeline = this.pipelines.get(pipelineNodeId);
179
+ if (pipeline) pipeline.componentIds.push(componentId);
180
+ const node = this.nodes.get(componentId);
181
+ if (node) node.inPipeline = true;
182
+ }
183
+ addAnnotation(annotation) {
184
+ this.annotations.push(annotation);
185
+ }
186
+ addNote(note) {
187
+ this.notes.push(note);
188
+ }
189
+ addAccelerator(accelerator) {
190
+ this.accelerators.push(accelerator);
191
+ }
192
+ addDeaccelerator(deaccelerator) {
193
+ this.deaccelerators.push(deaccelerator);
194
+ }
195
+ setAnnotationsBox(x, y) {
196
+ this.annotationsBox = {
197
+ x,
198
+ y
199
+ };
200
+ }
201
+ setAxes(partial) {
202
+ this.axes = {
203
+ ...this.axes,
204
+ ...partial
205
+ };
206
+ }
207
+ setSize(width, height) {
208
+ this.size = {
209
+ width,
210
+ height
211
+ };
212
+ }
213
+ getNode(id) {
214
+ return this.nodes.get(id);
215
+ }
216
+ /**
217
+ * Resolve a name to a node ID. Tries exact ID match first,
218
+ * then falls back to finding a node whose label matches the name
219
+ * (handles pipeline components which have synthetic IDs like "Parent_Child").
220
+ */
221
+ resolveNodeId(name) {
222
+ if (this.nodes.has(name)) return name;
223
+ for (const [id, node] of this.nodes) if (node.label === name) return id;
224
+ return name;
225
+ }
226
+ build() {
227
+ const nodes = [];
228
+ for (const node of this.nodes.values()) {
229
+ if (typeof node.x !== "number" || typeof node.y !== "number") throw new Error(`Node "${node.label}" is missing coordinates`);
230
+ nodes.push(node);
231
+ }
232
+ return {
233
+ nodes,
234
+ links: [...this.links],
235
+ trends: [...this.trends.values()],
236
+ pipelines: [...this.pipelines.values()],
237
+ annotations: [...this.annotations],
238
+ notes: [...this.notes],
239
+ accelerators: [...this.accelerators],
240
+ deaccelerators: [...this.deaccelerators],
241
+ annotationsBox: this.annotationsBox,
242
+ axes: { ...this.axes },
243
+ size: this.size
244
+ };
245
+ }
246
+ clear() {
247
+ this.nodes.clear();
248
+ this.links = [];
249
+ this.trends.clear();
250
+ this.pipelines.clear();
251
+ this.annotations = [];
252
+ this.notes = [];
253
+ this.accelerators = [];
254
+ this.deaccelerators = [];
255
+ this.annotationsBox = void 0;
256
+ this.axes = {};
257
+ this.size = void 0;
258
+ }
259
+ };
260
+ var builder = new WardleyBuilder();
261
+ function getConfig3() {
262
+ return getConfig2()["wardley-beta"];
263
+ }
264
+ __name(getConfig3, "getConfig");
265
+ function addNode(id, label, x, y, className, labelOffsetX, labelOffsetY, inertia, sourceStrategy) {
266
+ builder.addNode({
267
+ id,
268
+ label,
269
+ x,
270
+ y,
271
+ className,
272
+ labelOffsetX,
273
+ labelOffsetY,
274
+ inertia,
275
+ sourceStrategy
276
+ });
277
+ }
278
+ __name(addNode, "addNode");
279
+ function addLink(sourceId, targetId, dashed = false, label, flow) {
280
+ builder.addLink({
281
+ source: sourceId,
282
+ target: targetId,
283
+ dashed,
284
+ label,
285
+ flow
286
+ });
287
+ }
288
+ __name(addLink, "addLink");
289
+ function addTrend(nodeId, targetX, targetY) {
290
+ builder.addTrend({
291
+ nodeId,
292
+ targetX,
293
+ targetY
294
+ });
295
+ }
296
+ __name(addTrend, "addTrend");
297
+ function addAnnotation(number, coordinates, text) {
298
+ builder.addAnnotation({
299
+ number,
300
+ coordinates,
301
+ text
302
+ });
303
+ }
304
+ __name(addAnnotation, "addAnnotation");
305
+ function addNote(text, x, y) {
306
+ builder.addNote({
307
+ text,
308
+ x,
309
+ y
310
+ });
311
+ }
312
+ __name(addNote, "addNote");
313
+ function addAccelerator(name, x, y) {
314
+ builder.addAccelerator({
315
+ name,
316
+ x,
317
+ y
318
+ });
319
+ }
320
+ __name(addAccelerator, "addAccelerator");
321
+ function addDeaccelerator(name, x, y) {
322
+ builder.addDeaccelerator({
323
+ name,
324
+ x,
325
+ y
326
+ });
327
+ }
328
+ __name(addDeaccelerator, "addDeaccelerator");
329
+ function setAnnotationsBox(x, y) {
330
+ builder.setAnnotationsBox(x, y);
331
+ }
332
+ __name(setAnnotationsBox, "setAnnotationsBox");
333
+ function setSize(width, height) {
334
+ builder.setSize(width, height);
335
+ }
336
+ __name(setSize, "setSize");
337
+ function startPipeline(nodeId) {
338
+ builder.startPipeline(nodeId);
339
+ }
340
+ __name(startPipeline, "startPipeline");
341
+ function addPipelineComponent(pipelineNodeId, componentId) {
342
+ builder.addPipelineComponent(pipelineNodeId, componentId);
343
+ }
344
+ __name(addPipelineComponent, "addPipelineComponent");
345
+ function updateAxes(partial) {
346
+ builder.setAxes(partial);
347
+ }
348
+ __name(updateAxes, "updateAxes");
349
+ function getNode(id) {
350
+ return builder.getNode(id);
351
+ }
352
+ __name(getNode, "getNode");
353
+ function resolveNodeId(name) {
354
+ return builder.resolveNodeId(name);
355
+ }
356
+ __name(resolveNodeId, "resolveNodeId");
357
+ function getWardleyData() {
358
+ return builder.build();
359
+ }
360
+ __name(getWardleyData, "getWardleyData");
361
+ function clear2() {
362
+ builder.clear();
363
+ clear();
364
+ }
365
+ __name(clear2, "clear");
366
+ var wardleyDb_default = {
367
+ getConfig: getConfig3,
368
+ addNode,
369
+ addLink,
370
+ addTrend,
371
+ addAnnotation,
372
+ addNote,
373
+ addAccelerator,
374
+ addDeaccelerator,
375
+ setAnnotationsBox,
376
+ setSize,
377
+ startPipeline,
378
+ addPipelineComponent,
379
+ updateAxes,
380
+ getNode,
381
+ resolveNodeId,
382
+ getWardleyData,
383
+ clear: clear2,
384
+ setAccTitle,
385
+ getAccTitle,
386
+ setDiagramTitle,
387
+ getDiagramTitle,
388
+ getAccDescription,
389
+ setAccDescription
390
+ };
391
+ var DEFAULT_STAGES = [
392
+ "Genesis",
393
+ "Custom Built",
394
+ "Product",
395
+ "Commodity"
396
+ ];
397
+ var getTheme = /* @__PURE__ */ __name(() => {
398
+ const { themeVariables } = getConfig2();
399
+ return {
400
+ backgroundColor: themeVariables.wardley?.backgroundColor ?? themeVariables.background ?? "#fff",
401
+ axisColor: themeVariables.wardley?.axisColor ?? "#000",
402
+ axisTextColor: themeVariables.wardley?.axisTextColor ?? themeVariables.primaryTextColor ?? "#222",
403
+ gridColor: themeVariables.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)",
404
+ componentFill: themeVariables.wardley?.componentFill ?? "#fff",
405
+ componentStroke: themeVariables.wardley?.componentStroke ?? "#000",
406
+ componentLabelColor: themeVariables.wardley?.componentLabelColor ?? themeVariables.primaryTextColor ?? "#222",
407
+ linkStroke: themeVariables.wardley?.linkStroke ?? "#000",
408
+ evolutionStroke: themeVariables.wardley?.evolutionStroke ?? "#dc3545",
409
+ annotationStroke: themeVariables.wardley?.annotationStroke ?? "#000",
410
+ annotationTextColor: themeVariables.wardley?.annotationTextColor ?? themeVariables.primaryTextColor ?? "#222",
411
+ annotationFill: themeVariables.wardley?.annotationFill ?? themeVariables.background ?? "#fff"
412
+ };
413
+ }, "getTheme");
414
+ var getConfigValues = /* @__PURE__ */ __name(() => {
415
+ const wardleyConfig = getConfig2()["wardley-beta"];
416
+ return {
417
+ width: wardleyConfig?.width ?? 900,
418
+ height: wardleyConfig?.height ?? 600,
419
+ padding: wardleyConfig?.padding ?? 48,
420
+ nodeRadius: wardleyConfig?.nodeRadius ?? 6,
421
+ nodeLabelOffset: wardleyConfig?.nodeLabelOffset ?? 8,
422
+ axisFontSize: wardleyConfig?.axisFontSize ?? 12,
423
+ labelFontSize: wardleyConfig?.labelFontSize ?? 10,
424
+ showGrid: wardleyConfig?.showGrid ?? false,
425
+ useMaxWidth: wardleyConfig?.useMaxWidth ?? true
426
+ };
427
+ }, "getConfigValues");
428
+ var diagram = {
429
+ parser,
430
+ db: wardleyDb_default,
431
+ renderer: { draw: /* @__PURE__ */ __name((text, id, _version, diagObj) => {
432
+ log.debug("Rendering Wardley map\n" + text);
433
+ const configValues = getConfigValues();
434
+ const theme = getTheme();
435
+ const squareSize = configValues.nodeRadius * 1.6;
436
+ const db = diagObj.db;
437
+ const data = db.getWardleyData();
438
+ const title = db.getDiagramTitle();
439
+ const width = data.size?.width ?? configValues.width;
440
+ const height = data.size?.height ?? configValues.height;
441
+ const svg = selectSvgElement(id);
442
+ svg.selectAll("*").remove();
443
+ configureSvgSize(svg, height, width, configValues.useMaxWidth);
444
+ svg.attr("viewBox", `0 0 ${width} ${height}`);
445
+ const root = svg.append("g").attr("class", "wardley-map");
446
+ const defs = svg.append("defs");
447
+ 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");
448
+ 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");
449
+ 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");
450
+ root.append("rect").attr("class", "wardley-background").attr("width", width).attr("height", height).attr("fill", theme.backgroundColor);
451
+ const chartWidth = width - configValues.padding * 2;
452
+ const chartHeight = height - configValues.padding * 2;
453
+ if (title) 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);
454
+ const projectX = /* @__PURE__ */ __name((value) => configValues.padding + value / 100 * chartWidth, "projectX");
455
+ const projectY = /* @__PURE__ */ __name((value) => height - configValues.padding - value / 100 * chartHeight, "projectY");
456
+ const axisGroup = root.append("g").attr("class", "wardley-axes");
457
+ 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);
458
+ 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);
459
+ const xLabel = data.axes.xLabel ?? "Evolution";
460
+ const yLabel = data.axes.yLabel ?? "Visibility";
461
+ 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);
462
+ 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("transform", `rotate(-90 ${configValues.padding / 3} ${configValues.padding + chartHeight / 2})`).text(yLabel);
463
+ const stages = data.axes.stages && data.axes.stages.length > 0 ? data.axes.stages : DEFAULT_STAGES;
464
+ if (stages.length > 0) {
465
+ const stageGroup = root.append("g").attr("class", "wardley-stages");
466
+ const boundaries = data.axes.stageBoundaries;
467
+ const stagePositions = [];
468
+ if (boundaries && boundaries.length === stages.length) {
469
+ let prevBoundary = 0;
470
+ boundaries.forEach((boundary) => {
471
+ stagePositions.push({
472
+ start: prevBoundary,
473
+ end: boundary
474
+ });
475
+ prevBoundary = boundary;
476
+ });
477
+ } else {
478
+ const stageWidth = 1 / stages.length;
479
+ stages.forEach((_, index) => {
480
+ stagePositions.push({
481
+ start: index * stageWidth,
482
+ end: (index + 1) * stageWidth
483
+ });
484
+ });
485
+ }
486
+ stages.forEach((stage, index) => {
487
+ const pos = stagePositions[index];
488
+ const startX = configValues.padding + pos.start * chartWidth;
489
+ const centerX = (startX + (configValues.padding + pos.end * chartWidth)) / 2;
490
+ if (index > 0) 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", .8);
491
+ 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);
492
+ });
493
+ }
494
+ if (configValues.showGrid) {
495
+ const gridGroup = root.append("g").attr("class", "wardley-grid");
496
+ for (let i = 1; i < 4; i++) {
497
+ const ratio = i / 4;
498
+ const x = configValues.padding + chartWidth * ratio;
499
+ 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");
500
+ 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");
501
+ }
502
+ }
503
+ const positions = /* @__PURE__ */ new Map();
504
+ data.nodes.forEach((node) => {
505
+ positions.set(node.id, {
506
+ x: projectX(node.x),
507
+ y: projectY(node.y),
508
+ node
509
+ });
510
+ });
511
+ if (data.pipelines.length > 0) {
512
+ const pipelineGroup = root.append("g").attr("class", "wardley-pipelines");
513
+ const pipelineLinksGroup = root.append("g").attr("class", "wardley-pipeline-links");
514
+ data.pipelines.forEach((pipeline) => {
515
+ if (pipeline.componentIds.length === 0) return;
516
+ const sortedComponents = pipeline.componentIds.map((id2) => ({
517
+ id: id2,
518
+ pos: positions.get(id2),
519
+ node: data.nodes.find((n) => n.id === id2)
520
+ })).filter((c) => c.pos && c.node).sort((a, b) => a.node.x - b.node.x);
521
+ for (let i = 0; i < sortedComponents.length - 1; i++) {
522
+ const current = sortedComponents[i];
523
+ const next = sortedComponents[i + 1];
524
+ 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");
525
+ }
526
+ let minX = Infinity;
527
+ let maxX = -Infinity;
528
+ let y = 0;
529
+ pipeline.componentIds.forEach((componentId) => {
530
+ const pos = positions.get(componentId);
531
+ if (pos) {
532
+ minX = Math.min(minX, pos.x);
533
+ maxX = Math.max(maxX, pos.x);
534
+ y = pos.y;
535
+ }
536
+ });
537
+ if (minX !== Infinity && maxX !== -Infinity) {
538
+ const padding = 15;
539
+ const height2 = configValues.nodeRadius * 4;
540
+ const boxTop = y - height2 / 2;
541
+ const parentPos = positions.get(pipeline.nodeId);
542
+ if (parentPos) {
543
+ parentPos.x = (minX + maxX) / 2;
544
+ parentPos.y = boxTop - squareSize / 6;
545
+ }
546
+ pipelineGroup.append("rect").attr("class", "wardley-pipeline-box").attr("x", minX - padding).attr("y", boxTop).attr("width", maxX - minX + 30).attr("height", height2).attr("fill", "none").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
547
+ }
548
+ });
549
+ }
550
+ const linksGroup = root.append("g").attr("class", "wardley-links");
551
+ const pipelineMap = /* @__PURE__ */ new Map();
552
+ data.pipelines.forEach((pipeline) => {
553
+ pipelineMap.set(pipeline.nodeId, new Set(pipeline.componentIds));
554
+ });
555
+ const validLinks = data.links.filter((link) => {
556
+ if (!positions.has(link.source) || !positions.has(link.target)) return false;
557
+ if (pipelineMap.get(link.target)?.has(link.source)) return false;
558
+ return true;
559
+ });
560
+ linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class", (link) => `wardley-link${link.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (link) => {
561
+ const sourcePos = positions.get(link.source);
562
+ const targetPos = positions.get(link.target);
563
+ const radius = data.nodes.find((n) => n.id === link.source).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
564
+ const dx = targetPos.x - sourcePos.x;
565
+ const dy = targetPos.y - sourcePos.y;
566
+ const distance = Math.sqrt(dx * dx + dy * dy);
567
+ return sourcePos.x + dx / distance * radius;
568
+ }).attr("y1", (link) => {
569
+ const sourcePos = positions.get(link.source);
570
+ const targetPos = positions.get(link.target);
571
+ const radius = data.nodes.find((n) => n.id === link.source).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
572
+ const dx = targetPos.x - sourcePos.x;
573
+ const dy = targetPos.y - sourcePos.y;
574
+ const distance = Math.sqrt(dx * dx + dy * dy);
575
+ return sourcePos.y + dy / distance * radius;
576
+ }).attr("x2", (link) => {
577
+ const sourcePos = positions.get(link.source);
578
+ const targetPos = positions.get(link.target);
579
+ const radius = data.nodes.find((n) => n.id === link.target).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
580
+ const dx = sourcePos.x - targetPos.x;
581
+ const dy = sourcePos.y - targetPos.y;
582
+ const distance = Math.sqrt(dx * dx + dy * dy);
583
+ return targetPos.x + dx / distance * radius;
584
+ }).attr("y2", (link) => {
585
+ const sourcePos = positions.get(link.source);
586
+ const targetPos = positions.get(link.target);
587
+ const radius = data.nodes.find((n) => n.id === link.target).isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius;
588
+ const dx = sourcePos.x - targetPos.x;
589
+ const dy = sourcePos.y - targetPos.y;
590
+ const distance = Math.sqrt(dx * dx + dy * dy);
591
+ return targetPos.y + dy / distance * radius;
592
+ }).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (link) => link.dashed ? "6 6" : null).attr("marker-end", (link) => {
593
+ if (link.flow === "forward" || link.flow === "bidirectional") return `url(#link-arrow-end-${id})`;
594
+ return null;
595
+ }).attr("marker-start", (link) => {
596
+ if (link.flow === "backward" || link.flow === "bidirectional") return `url(#link-arrow-start-${id})`;
597
+ return null;
598
+ });
599
+ linksGroup.selectAll("text").data(validLinks.filter((link) => link.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (link) => {
600
+ const sourcePos = positions.get(link.source);
601
+ const targetPos = positions.get(link.target);
602
+ const midX = (sourcePos.x + targetPos.x) / 2;
603
+ const dy = targetPos.y - sourcePos.y;
604
+ const dx = targetPos.x - sourcePos.x;
605
+ return midX + dy / Math.sqrt(dx * dx + dy * dy) * 8;
606
+ }).attr("y", (link) => {
607
+ const sourcePos = positions.get(link.source);
608
+ const targetPos = positions.get(link.target);
609
+ const midY = (sourcePos.y + targetPos.y) / 2;
610
+ const dx = targetPos.x - sourcePos.x;
611
+ const dy = targetPos.y - sourcePos.y;
612
+ const distance = Math.sqrt(dx * dx + dy * dy);
613
+ return midY + -dx / distance * 8;
614
+ }).attr("fill", theme.axisTextColor).attr("font-size", configValues.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (link) => {
615
+ const sourcePos = positions.get(link.source);
616
+ const targetPos = positions.get(link.target);
617
+ const midX = (sourcePos.x + targetPos.x) / 2;
618
+ const midY = (sourcePos.y + targetPos.y) / 2;
619
+ const dx = targetPos.x - sourcePos.x;
620
+ const dy = targetPos.y - sourcePos.y;
621
+ const distance = Math.sqrt(dx * dx + dy * dy);
622
+ const offset = 8;
623
+ const perpX = dy / distance;
624
+ const perpY = -dx / distance;
625
+ const labelX = midX + perpX * offset;
626
+ const labelY = midY + perpY * offset;
627
+ let angle = Math.atan2(dy, dx) * 180 / Math.PI;
628
+ if (angle > 90 || angle < -90) angle += 180;
629
+ return `rotate(${angle} ${labelX} ${labelY})`;
630
+ }).text((link) => link.label);
631
+ const trendGroup = root.append("g").attr("class", "wardley-trends");
632
+ const trendsWithPositions = data.trends.map((trend) => {
633
+ const origin = positions.get(trend.nodeId);
634
+ if (!origin) return null;
635
+ const targetX = projectX(trend.targetX);
636
+ const targetY = projectY(trend.targetY);
637
+ const dx = targetX - origin.x;
638
+ const dy = targetY - origin.y;
639
+ const distance = Math.sqrt(dx * dx + dy * dy);
640
+ const shortenBy = configValues.nodeRadius + 2;
641
+ return {
642
+ origin,
643
+ targetX,
644
+ targetY,
645
+ adjustedX2: distance > shortenBy ? targetX - dx / distance * shortenBy : targetX,
646
+ adjustedY2: distance > shortenBy ? targetY - dy / distance * shortenBy : targetY
647
+ };
648
+ }).filter((trend) => trend !== null);
649
+ 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})`);
650
+ const nodeEnter = root.append("g").attr("class", "wardley-nodes").selectAll("g").data(data.nodes).enter().append("g").attr("class", (node) => ["wardley-node", node.className ? `wardley-node--${node.className}` : ""].filter(Boolean).join(" "));
651
+ 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);
652
+ 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);
653
+ 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);
654
+ const marketNodes = nodeEnter.filter((node) => node.sourceStrategy === "market");
655
+ 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);
656
+ nodeEnter.filter((node) => !node.isPipelineParent && node.sourceStrategy !== "market" && node.className !== "anchor").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);
657
+ const smallCircleRadius = configValues.nodeRadius * .7;
658
+ const triangleRadius = configValues.nodeRadius * 1.2;
659
+ 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);
660
+ 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);
661
+ 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);
662
+ 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);
663
+ 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);
664
+ 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);
665
+ 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);
666
+ nodeEnter.filter((node) => node.inertia === true).append("line").attr("class", "wardley-inertia").attr("x1", (node) => {
667
+ const pos = positions.get(node.id);
668
+ let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
669
+ if (node.sourceStrategy) offset += configValues.nodeRadius + 10;
670
+ return pos.x + offset;
671
+ }).attr("y1", (node) => {
672
+ const pos = positions.get(node.id);
673
+ const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
674
+ return pos.y - lineHeight / 2;
675
+ }).attr("x2", (node) => {
676
+ const pos = positions.get(node.id);
677
+ let offset = node.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15;
678
+ if (node.sourceStrategy) offset += configValues.nodeRadius + 10;
679
+ return pos.x + offset;
680
+ }).attr("y2", (node) => {
681
+ const pos = positions.get(node.id);
682
+ const lineHeight = node.isPipelineParent ? squareSize : configValues.nodeRadius * 2;
683
+ return pos.y + lineHeight / 2;
684
+ }).attr("stroke", theme.componentStroke).attr("stroke-width", 6);
685
+ nodeEnter.append("text").attr("x", (node) => {
686
+ const pos = positions.get(node.id);
687
+ if (node.className === "anchor") return node.labelOffsetX !== void 0 ? pos.x + node.labelOffsetX : pos.x;
688
+ let defaultOffset = configValues.nodeLabelOffset;
689
+ if (node.sourceStrategy && node.labelOffsetX === void 0) defaultOffset += 10;
690
+ const customOffset = node.labelOffsetX ?? defaultOffset;
691
+ return pos.x + customOffset;
692
+ }).attr("y", (node) => {
693
+ const pos = positions.get(node.id);
694
+ if (node.className === "anchor") return node.labelOffsetY !== void 0 ? pos.y + node.labelOffsetY : pos.y - 3;
695
+ let defaultOffset = -configValues.nodeLabelOffset;
696
+ if (node.sourceStrategy && node.labelOffsetY === void 0) defaultOffset -= 10;
697
+ const customOffset = node.labelOffsetY ?? defaultOffset;
698
+ return pos.y + customOffset;
699
+ }).attr("class", "wardley-node-label").attr("fill", (node) => {
700
+ if (node.className === "evolved") return theme.evolutionStroke;
701
+ if (node.className === "anchor") return "#000";
702
+ return theme.componentLabelColor;
703
+ }).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);
704
+ if (data.annotations.length > 0) {
705
+ const annotationsGroup = root.append("g").attr("class", "wardley-annotations");
706
+ data.annotations.forEach((annotation) => {
707
+ const projectedCoords = annotation.coordinates.map((coord) => ({
708
+ x: projectX(coord.x),
709
+ y: projectY(coord.y)
710
+ }));
711
+ if (projectedCoords.length > 1) for (let i = 0; i < projectedCoords.length - 1; i++) 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");
712
+ projectedCoords.forEach((coord) => {
713
+ const annotationNode = annotationsGroup.append("g").attr("class", "wardley-annotation");
714
+ 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);
715
+ 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);
716
+ });
717
+ });
718
+ if (data.annotationsBox) {
719
+ let boxX = projectX(data.annotationsBox.x);
720
+ let boxY = projectY(data.annotationsBox.y);
721
+ const padding = 10;
722
+ const lineHeight = 16;
723
+ const fontSize = 11;
724
+ const textBoxGroup = annotationsGroup.append("g").attr("class", "wardley-annotations-box");
725
+ const sortedAnnotations = [...data.annotations].filter((a) => a.text).sort((a, b) => a.number - b.number);
726
+ const textElements = [];
727
+ sortedAnnotations.forEach((annotation, idx) => {
728
+ 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}`);
729
+ textElements.push(text2);
730
+ });
731
+ if (textElements.length > 0) {
732
+ let maxWidth = 0;
733
+ let maxHeight = 0;
734
+ textElements.forEach((text2) => {
735
+ const textNode = text2.node();
736
+ const textWidth = textNode.getComputedTextLength();
737
+ maxWidth = Math.max(maxWidth, textWidth);
738
+ const bbox = textNode.getBBox();
739
+ maxHeight = Math.max(maxHeight, bbox.height);
740
+ });
741
+ const boxWidth = maxWidth + 20 + 105;
742
+ const boxHeight = sortedAnnotations.length * lineHeight + 20 + maxHeight / 2;
743
+ const minX = configValues.padding;
744
+ const maxX = width - configValues.padding - boxWidth;
745
+ const minY = configValues.padding;
746
+ const maxY = height - configValues.padding - boxHeight;
747
+ boxX = Math.max(minX, Math.min(boxX, maxX));
748
+ boxY = Math.max(minY, Math.min(boxY, maxY));
749
+ textElements.forEach((text2, idx) => {
750
+ text2.attr("x", boxX + padding).attr("y", boxY + padding + (idx + 1) * lineHeight);
751
+ });
752
+ 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);
753
+ }
754
+ }
755
+ }
756
+ if (data.notes.length > 0) {
757
+ const notesGroup = root.append("g").attr("class", "wardley-notes");
758
+ data.notes.forEach((note) => {
759
+ const noteX = projectX(note.x);
760
+ const noteY = projectY(note.y);
761
+ 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);
762
+ });
763
+ }
764
+ if (data.accelerators.length > 0) {
765
+ const acceleratorsGroup = root.append("g").attr("class", "wardley-accelerators");
766
+ data.accelerators.forEach((accelerator) => {
767
+ const accX = projectX(accelerator.x);
768
+ const accY = projectY(accelerator.y);
769
+ const arrowWidth = 60;
770
+ const arrowHeight = 30;
771
+ const arrowHeadWidth = 20;
772
+ const arrowPath = `
773
+ M ${accX} ${accY - arrowHeight / 2}
774
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2}
775
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2 - 8}
776
+ L ${accX + arrowWidth} ${accY}
777
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2 + 8}
778
+ L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2}
779
+ L ${accX} ${accY + arrowHeight / 2}
780
+ Z
781
+ `;
782
+ acceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
783
+ 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);
784
+ });
785
+ }
786
+ if (data.deaccelerators.length > 0) {
787
+ const deacceleratorsGroup = root.append("g").attr("class", "wardley-deaccelerators");
788
+ data.deaccelerators.forEach((deaccelerator) => {
789
+ const decX = projectX(deaccelerator.x);
790
+ const decY = projectY(deaccelerator.y);
791
+ const arrowWidth = 60;
792
+ const arrowHeight = 30;
793
+ const arrowHeadWidth = 20;
794
+ const arrowPath = `
795
+ M ${decX + arrowWidth} ${decY - arrowHeight / 2}
796
+ L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2}
797
+ L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2 - 8}
798
+ L ${decX} ${decY}
799
+ L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2 + 8}
800
+ L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2}
801
+ L ${decX + arrowWidth} ${decY + arrowHeight / 2}
802
+ Z
803
+ `;
804
+ deacceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1);
805
+ 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);
806
+ });
807
+ }
808
+ }, "draw") },
809
+ styles: /* @__PURE__ */ __name(({ wardley } = {}) => {
810
+ const defaultThemeVariables = getThemeVariables3();
811
+ const currentConfig = getConfig();
812
+ const themeVariables = cleanAndMerge(defaultThemeVariables, currentConfig.themeVariables);
813
+ const w = cleanAndMerge(themeVariables.wardley, wardley);
814
+ return `
815
+ .wardley-background {
816
+ fill: ${w.backgroundColor};
817
+ }
818
+ .wardley-axes line, .wardley-axes path {
819
+ stroke: ${w.axisColor};
820
+ }
821
+ .wardley-axis-label {
822
+ fill: ${w.axisTextColor};
823
+ }
824
+ .wardley-stage-label {
825
+ fill: ${w.axisTextColor};
826
+ }
827
+ .wardley-grid line {
828
+ stroke: ${w.gridColor};
829
+ }
830
+ .wardley-node circle {
831
+ fill: ${w.componentFill};
832
+ stroke: ${w.componentStroke};
833
+ }
834
+ .wardley-node-label {
835
+ fill: ${w.componentLabelColor};
836
+ }
837
+ .wardley-link {
838
+ stroke: ${w.linkStroke};
839
+ }
840
+ .wardley-link--dashed {
841
+ stroke-dasharray: 4 4;
842
+ }
843
+ .wardley-link-label {
844
+ fill: ${w.axisTextColor};
845
+ }
846
+ .wardley-trend line {
847
+ stroke: ${w.evolutionStroke};
848
+ }
849
+ .wardley-annotation-line {
850
+ stroke: ${w.annotationStroke};
851
+ }
852
+ .wardley-annotation circle {
853
+ fill: ${w.annotationFill};
854
+ stroke: ${w.annotationStroke};
855
+ }
856
+ .wardley-annotation text {
857
+ fill: ${w.annotationTextColor};
858
+ }
859
+ .wardley-annotations-box rect {
860
+ fill: ${w.annotationFill};
861
+ stroke: ${w.annotationStroke};
862
+ }
863
+ .wardley-annotations-box text {
864
+ fill: ${w.annotationTextColor};
865
+ }
866
+ .wardley-pipeline-box {
867
+ stroke: ${w.componentStroke};
868
+ }
869
+ .wardley-notes text {
870
+ fill: ${w.axisTextColor};
871
+ }
872
+ `;
873
+ }, "styles")
874
+ };
875
+
876
+ //#endregion
877
+ export { diagram };