@miragon/wardley-renderer 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/draw/WardleyRenderer.d.ts.map +1 -1
- package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts +7 -2
- package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts.map +1 -1
- package/dist/evolution-grid/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +496 -496
- package/dist/index.js.map +1 -1
- package/dist/layout/WardleyLayouter.d.ts +22 -0
- package/dist/layout/WardleyLayouter.d.ts.map +1 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/model/WardleyElementFactory.d.ts.map +1 -1
- package/dist/model/di-types.d.ts +4 -0
- package/dist/model/di-types.d.ts.map +1 -1
- package/dist/modeling/WardleyCopyPaste.d.ts.map +1 -1
- package/dist/wardley.css +1 -1
- package/package.json +18 -11
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import e from "diagram-js/lib/Diagram";
|
|
2
2
|
import { parseDSLWithDiagnostics as t, serializeDSL as n } from "@miragon/wardley-dsl";
|
|
3
3
|
import { CURRENT_SCHEMA_VERSION as r, DEFAULT_EVOLUTION_LABELS as i, DEFAULT_PLOT_SIZE as a, DEFAULT_STAGE_BOUNDARIES as o, evolutionStage as s, validateMap as c } from "@miragon/wardley-schema-model";
|
|
4
|
-
import
|
|
4
|
+
import l from "diagram-js/lib/layout/BaseLayouter";
|
|
5
|
+
import { append as u, attr as d, clear as f, create as p, remove as m } from "tiny-svg";
|
|
5
6
|
import ee from "diagram-js/lib/command/CommandInterceptor";
|
|
6
7
|
import te from "diagram-js/lib/draw/BaseRenderer";
|
|
7
8
|
import ne from "diagram-js/lib/features/selection";
|
|
@@ -10,21 +11,21 @@ import ie from "diagram-js/lib/navigation/movecanvas";
|
|
|
10
11
|
import ae from "diagram-js/lib/features/keyboard";
|
|
11
12
|
import oe from "diagram-js/lib/features/modeling";
|
|
12
13
|
import se from "diagram-js/lib/features/move";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
14
|
+
import h from "diagram-js/lib/features/create";
|
|
15
|
+
import ce from "diagram-js/lib/features/connect";
|
|
16
|
+
import le from "diagram-js/lib/features/context-pad";
|
|
17
|
+
import ue from "diagram-js/lib/features/palette";
|
|
18
|
+
import de from "diagram-js/lib/features/rules";
|
|
19
|
+
import fe from "diagram-js/lib/features/outline";
|
|
20
|
+
import pe from "diagram-js/lib/features/resize";
|
|
21
|
+
import me from "diagram-js/lib/features/popup-menu";
|
|
22
|
+
import he from "diagram-js/lib/features/mouse";
|
|
23
|
+
import ge from "diagram-js/lib/features/lasso-tool";
|
|
24
|
+
import _e from "diagram-js/lib/features/rules/RuleProvider";
|
|
25
|
+
import ve from "diagram-js/lib/features/connection-preview";
|
|
26
|
+
import ye from "diagram-js/lib/features/ordering/OrderingProvider";
|
|
26
27
|
//#region src/theme/palette.ts
|
|
27
|
-
var
|
|
28
|
+
var g = {
|
|
28
29
|
blau: "#335DE5",
|
|
29
30
|
blauLink: "#2B50D4",
|
|
30
31
|
blauHell: "#6B8AFF",
|
|
@@ -39,52 +40,52 @@ var m = {
|
|
|
39
40
|
navy: "#080A20",
|
|
40
41
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
g.grau, g.schwarz, g.weiss, g.blau, g.gruen, g.danger, g.navy;
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/draw/styles.ts
|
|
45
|
-
var
|
|
46
|
+
var _ = {
|
|
46
47
|
width: a.width,
|
|
47
48
|
height: a.height,
|
|
48
49
|
marginLeft: 66,
|
|
49
50
|
marginTop: 38,
|
|
50
51
|
marginRight: 44,
|
|
51
52
|
marginBottom: 58
|
|
52
|
-
},
|
|
53
|
+
}, be = {
|
|
53
54
|
width: 480,
|
|
54
55
|
height: 320
|
|
55
|
-
},
|
|
56
|
-
function
|
|
56
|
+
}, xe = 7.5;
|
|
57
|
+
function v(e) {
|
|
57
58
|
let t = (e && e.length ? e : "note").split("\n"), n = Math.max(1, ...t.map((e) => e.length));
|
|
58
59
|
return {
|
|
59
60
|
lines: t,
|
|
60
|
-
width: Math.max(34, Math.round(n *
|
|
61
|
-
height: Math.max(34, t.length * 17 +
|
|
61
|
+
width: Math.max(34, Math.round(n * xe) + 16),
|
|
62
|
+
height: Math.max(34, t.length * 17 + 12)
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
var
|
|
65
|
-
paper:
|
|
66
|
-
ink:
|
|
65
|
+
var y = {
|
|
66
|
+
paper: g.grau,
|
|
67
|
+
ink: g.schwarz,
|
|
67
68
|
inkSoft: "#5B5B5B",
|
|
68
69
|
axis: "rgba(51,93,229,0.22)",
|
|
69
70
|
axisText: "#6E7797",
|
|
70
71
|
grid: "rgba(51,93,229,0.12)",
|
|
71
72
|
band: "rgba(51,93,229,0.04)",
|
|
72
|
-
stroke:
|
|
73
|
-
componentFill:
|
|
74
|
-
anchorFill:
|
|
73
|
+
stroke: g.schwarz,
|
|
74
|
+
componentFill: g.weiss,
|
|
75
|
+
anchorFill: g.schwarz,
|
|
75
76
|
dependency: "#9E9E9E",
|
|
76
|
-
accent:
|
|
77
|
+
accent: g.blau,
|
|
77
78
|
accentSoft: "rgba(51,93,229,0.12)",
|
|
78
|
-
flow:
|
|
79
|
-
movement:
|
|
80
|
-
inertia:
|
|
79
|
+
flow: g.blau,
|
|
80
|
+
movement: g.danger,
|
|
81
|
+
inertia: g.schwarz,
|
|
81
82
|
noteText: "#5B5B5B",
|
|
82
|
-
pipeline:
|
|
83
|
+
pipeline: g.schwarz,
|
|
83
84
|
annotationFill: "#FBF3E0",
|
|
84
|
-
plotBackground:
|
|
85
|
+
plotBackground: g.weiss,
|
|
85
86
|
accelerator: "#00C853",
|
|
86
|
-
deaccelerator:
|
|
87
|
-
},
|
|
87
|
+
deaccelerator: g.danger
|
|
88
|
+
}, Se = [
|
|
88
89
|
{
|
|
89
90
|
id: "green",
|
|
90
91
|
name: "Green · good",
|
|
@@ -125,7 +126,7 @@ var _ = {
|
|
|
125
126
|
name: "Slate · neutral",
|
|
126
127
|
value: "#4A4A4A"
|
|
127
128
|
}
|
|
128
|
-
],
|
|
129
|
+
], b = {
|
|
129
130
|
pioneers: {
|
|
130
131
|
fill: "rgba(51,93,229,0.07)",
|
|
131
132
|
stroke: "#335DE5"
|
|
@@ -138,7 +139,7 @@ var _ = {
|
|
|
138
139
|
fill: "rgba(0,200,83,0.08)",
|
|
139
140
|
stroke: "#00C853"
|
|
140
141
|
}
|
|
141
|
-
},
|
|
142
|
+
}, x = {
|
|
142
143
|
family: "'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
143
144
|
label: 13,
|
|
144
145
|
axis: 12,
|
|
@@ -146,14 +147,14 @@ var _ = {
|
|
|
146
147
|
};
|
|
147
148
|
//#endregion
|
|
148
149
|
//#region src/io/saveSvg.ts
|
|
149
|
-
function
|
|
150
|
+
function Ce(e, t) {
|
|
150
151
|
let n = e.getContainer().querySelector("svg");
|
|
151
152
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
152
153
|
let r = n.cloneNode(!0), i = t ?? {
|
|
153
154
|
x: 0,
|
|
154
155
|
y: 0,
|
|
155
|
-
width:
|
|
156
|
-
height:
|
|
156
|
+
width: _.marginLeft + _.width + _.marginRight,
|
|
157
|
+
height: _.marginTop + _.height + _.marginBottom
|
|
157
158
|
};
|
|
158
159
|
r.setAttribute("xmlns", "http://www.w3.org/2000/svg"), r.setAttribute("viewBox", `${i.x} ${i.y} ${i.width} ${i.height}`), r.setAttribute("width", String(i.width)), r.setAttribute("height", String(i.height));
|
|
159
160
|
let a = r.querySelector(".viewport");
|
|
@@ -161,13 +162,13 @@ function Ee(e, t) {
|
|
|
161
162
|
}
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/io/types.ts
|
|
164
|
-
var
|
|
165
|
+
var we = "wardley-root";
|
|
165
166
|
//#endregion
|
|
166
167
|
//#region src/WardleyBaseViewer.ts
|
|
167
|
-
function
|
|
168
|
+
function Te(e) {
|
|
168
169
|
return typeof e == "number" ? `${e}px` : e;
|
|
169
170
|
}
|
|
170
|
-
var
|
|
171
|
+
var Ee = class {
|
|
171
172
|
_diagram;
|
|
172
173
|
_container;
|
|
173
174
|
_options;
|
|
@@ -176,7 +177,7 @@ var ke = class {
|
|
|
176
177
|
}
|
|
177
178
|
_createContainer(e) {
|
|
178
179
|
let t = e.container ?? document.createElement("div");
|
|
179
|
-
return t.classList.add("wardley-container"), t.style.width =
|
|
180
|
+
return t.classList.add("wardley-container"), t.style.width = Te(e.width ?? "100%"), t.style.height = Te(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
180
181
|
}
|
|
181
182
|
_ensureDiagram() {
|
|
182
183
|
if (!this._diagram) {
|
|
@@ -263,7 +264,7 @@ var ke = class {
|
|
|
263
264
|
return n(this.exportMap());
|
|
264
265
|
}
|
|
265
266
|
async saveSVG() {
|
|
266
|
-
return
|
|
267
|
+
return Ce(this.get("canvas"), this.get("evolutionGrid").outerBounds());
|
|
267
268
|
}
|
|
268
269
|
attachTo(e) {
|
|
269
270
|
e.appendChild(this._container), this.get("canvas").resized();
|
|
@@ -280,7 +281,49 @@ var ke = class {
|
|
|
280
281
|
get container() {
|
|
281
282
|
return this._container;
|
|
282
283
|
}
|
|
283
|
-
}
|
|
284
|
+
};
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/model/di-types.ts
|
|
287
|
+
function De(e) {
|
|
288
|
+
return typeof e == "object" && !!e;
|
|
289
|
+
}
|
|
290
|
+
function S(e) {
|
|
291
|
+
return De(e) && typeof e.wardleyType == "string" && "evolution" in e;
|
|
292
|
+
}
|
|
293
|
+
var Oe = /* @__PURE__ */ new Set(["dependency", "flow"]);
|
|
294
|
+
function C(e) {
|
|
295
|
+
return De(e) && Oe.has(e.wardleyType);
|
|
296
|
+
}
|
|
297
|
+
function w(e) {
|
|
298
|
+
return S(e) && e.wardleyType === "component";
|
|
299
|
+
}
|
|
300
|
+
function T(e) {
|
|
301
|
+
return S(e) && e.wardleyType === "pipeline";
|
|
302
|
+
}
|
|
303
|
+
function ke(e) {
|
|
304
|
+
return S(e) && e.wardleyType === "attitude";
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/layout/WardleyLayouter.ts
|
|
308
|
+
function E(e) {
|
|
309
|
+
return T(e) ? {
|
|
310
|
+
x: e.x + e.width / 2,
|
|
311
|
+
y: e.y
|
|
312
|
+
} : {
|
|
313
|
+
x: e.x + e.width / 2,
|
|
314
|
+
y: e.y + e.height / 2
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
var D = class extends l {
|
|
318
|
+
layoutConnection(e, t = {}) {
|
|
319
|
+
let n = t.source ?? e.source, r = t.target ?? e.target;
|
|
320
|
+
return super.layoutConnection(e, {
|
|
321
|
+
...t,
|
|
322
|
+
...n ? { connectionStart: E(n) } : {},
|
|
323
|
+
...r ? { connectionEnd: E(r) } : {}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}, O = { layouter: ["type", D] }, Ae = class {
|
|
284
327
|
elementFactory;
|
|
285
328
|
grid;
|
|
286
329
|
elementRegistry;
|
|
@@ -319,13 +362,13 @@ var ke = class {
|
|
|
319
362
|
...e.labelOffset ? { labelOffset: e.labelOffset } : {},
|
|
320
363
|
...e.pipelineId ? { pipelineId: e.pipelineId } : {}
|
|
321
364
|
});
|
|
322
|
-
return e.pipelineId && (t.y +=
|
|
365
|
+
return e.pipelineId && (t.y += 15), t;
|
|
323
366
|
}
|
|
324
367
|
createAnchor(e) {
|
|
325
368
|
return this.node("anchor", e.id, e.label, e.position.visibility, e.position.evolution, e, { ...e.labelOffset ? { labelOffset: e.labelOffset } : {} });
|
|
326
369
|
}
|
|
327
370
|
createNote(e) {
|
|
328
|
-
let { width: t, height: n } =
|
|
371
|
+
let { width: t, height: n } = v(e.label), r = this.grid.toCanvas(e.position);
|
|
329
372
|
return this.elementFactory.createShape({
|
|
330
373
|
id: e.id,
|
|
331
374
|
x: r.x - t / 2,
|
|
@@ -450,7 +493,7 @@ var ke = class {
|
|
|
450
493
|
isFrame: !0
|
|
451
494
|
});
|
|
452
495
|
if (e === "note") {
|
|
453
|
-
let { width: e, height: t } =
|
|
496
|
+
let { width: e, height: t } = v(r);
|
|
454
497
|
return this.elementFactory.createShape({
|
|
455
498
|
width: e,
|
|
456
499
|
height: t,
|
|
@@ -487,8 +530,8 @@ var ke = class {
|
|
|
487
530
|
}), c = a?.color;
|
|
488
531
|
return this.elementFactory.createShape({
|
|
489
532
|
id: t,
|
|
490
|
-
x: s.x -
|
|
491
|
-
y: s.y -
|
|
533
|
+
x: s.x - 17,
|
|
534
|
+
y: s.y - 17,
|
|
492
535
|
width: 34,
|
|
493
536
|
height: 34,
|
|
494
537
|
wardleyType: e,
|
|
@@ -506,7 +549,7 @@ var ke = class {
|
|
|
506
549
|
id: t.id,
|
|
507
550
|
source: n,
|
|
508
551
|
target: r,
|
|
509
|
-
waypoints: [
|
|
552
|
+
waypoints: [E(n), E(r)],
|
|
510
553
|
wardleyType: e,
|
|
511
554
|
bidirectional: i,
|
|
512
555
|
...a ? { flowValue: a } : {},
|
|
@@ -514,67 +557,35 @@ var ke = class {
|
|
|
514
557
|
businessObject: t
|
|
515
558
|
});
|
|
516
559
|
}
|
|
517
|
-
};
|
|
518
|
-
function je(e) {
|
|
519
|
-
return e.wardleyType === "pipeline" ? {
|
|
520
|
-
x: e.x + e.width / 2,
|
|
521
|
-
y: e.y
|
|
522
|
-
} : {
|
|
523
|
-
x: e.x + e.width / 2,
|
|
524
|
-
y: e.y + e.height / 2
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
//#endregion
|
|
528
|
-
//#region src/model/di-types.ts
|
|
529
|
-
function b(e) {
|
|
530
|
-
return typeof e == "object" && !!e;
|
|
531
|
-
}
|
|
532
|
-
function x(e) {
|
|
533
|
-
return b(e) && typeof e.wardleyType == "string" && "evolution" in e;
|
|
534
|
-
}
|
|
535
|
-
function S(e) {
|
|
536
|
-
return b(e) && typeof e.wardleyType == "string" && "waypoints" in e;
|
|
537
|
-
}
|
|
538
|
-
function Me(e) {
|
|
539
|
-
return x(e) && e.wardleyType === "component";
|
|
540
|
-
}
|
|
541
|
-
function C(e) {
|
|
542
|
-
return x(e) && e.wardleyType === "pipeline";
|
|
543
|
-
}
|
|
560
|
+
}, je = { wardleyElementFactory: ["type", Ae] }, Me = "wardley-axes";
|
|
544
561
|
function Ne(e) {
|
|
545
|
-
return x(e) && e.wardleyType === "attitude";
|
|
546
|
-
}
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region src/model/index.ts
|
|
549
|
-
var Pe = { wardleyElementFactory: ["type", Ae] }, Fe = "wardley-axes";
|
|
550
|
-
function Ie(e) {
|
|
551
562
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
552
563
|
}
|
|
553
|
-
var
|
|
564
|
+
var Pe = class {
|
|
554
565
|
canvas;
|
|
555
566
|
static $inject = ["canvas"];
|
|
556
567
|
boundaries = o;
|
|
557
568
|
labels = i;
|
|
558
569
|
yAxisLabel = "Value Chain";
|
|
559
570
|
yAxisEndLabels = ["invisible", "visible"];
|
|
560
|
-
plotWidth =
|
|
561
|
-
plotHeight =
|
|
571
|
+
plotWidth = _.width;
|
|
572
|
+
plotHeight = _.height;
|
|
562
573
|
constructor(e) {
|
|
563
574
|
this.canvas = e;
|
|
564
575
|
}
|
|
565
576
|
configure(e) {
|
|
566
|
-
this.boundaries = e.stageBoundaries ?? o, this.labels = e.evolutionLabels ?? i, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? ["invisible", "visible"], this.plotWidth = Math.max(e.size?.width ??
|
|
577
|
+
this.boundaries = e.stageBoundaries ?? o, this.labels = e.evolutionLabels ?? i, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? ["invisible", "visible"], this.plotWidth = Math.max(e.size?.width ?? _.width, be.width), this.plotHeight = Math.max(e.size?.height ?? _.height, be.height);
|
|
567
578
|
}
|
|
568
579
|
toCanvas(e) {
|
|
569
580
|
return {
|
|
570
|
-
x:
|
|
571
|
-
y:
|
|
581
|
+
x: _.marginLeft + e.evolution * this.plotWidth,
|
|
582
|
+
y: _.marginTop + (1 - e.visibility) * this.plotHeight
|
|
572
583
|
};
|
|
573
584
|
}
|
|
574
585
|
fromCanvas(e) {
|
|
575
586
|
return {
|
|
576
|
-
evolution:
|
|
577
|
-
visibility:
|
|
587
|
+
evolution: Ne((e.x - _.marginLeft) / this.plotWidth),
|
|
588
|
+
visibility: Ne(1 - (e.y - _.marginTop) / this.plotHeight)
|
|
578
589
|
};
|
|
579
590
|
}
|
|
580
591
|
stageOf(e) {
|
|
@@ -593,17 +604,17 @@ var Le = class {
|
|
|
593
604
|
return {
|
|
594
605
|
x: 0,
|
|
595
606
|
y: 0,
|
|
596
|
-
width:
|
|
597
|
-
height:
|
|
607
|
+
width: _.marginLeft + this.plotWidth + _.marginRight,
|
|
608
|
+
height: _.marginTop + this.plotHeight + _.marginBottom
|
|
598
609
|
};
|
|
599
610
|
}
|
|
600
611
|
render() {
|
|
601
|
-
let e = this.canvas.getLayer(
|
|
602
|
-
|
|
603
|
-
let t =
|
|
604
|
-
|
|
605
|
-
fill:
|
|
606
|
-
stroke:
|
|
612
|
+
let e = this.canvas.getLayer(Me, -1);
|
|
613
|
+
f(e);
|
|
614
|
+
let t = _.marginLeft, n = _.marginTop, r = t + this.plotWidth, i = n + this.plotHeight;
|
|
615
|
+
u(e, Fe(t, n, this.plotWidth, this.plotHeight, {
|
|
616
|
+
fill: y.plotBackground,
|
|
617
|
+
stroke: y.grid
|
|
607
618
|
}));
|
|
608
619
|
let a = [
|
|
609
620
|
0,
|
|
@@ -612,46 +623,46 @@ var Le = class {
|
|
|
612
623
|
];
|
|
613
624
|
for (let r = 0; r < 4; r++) {
|
|
614
625
|
let o = t + a[r] * this.plotWidth, s = t + a[r + 1] * this.plotWidth;
|
|
615
|
-
r % 2 == 1 &&
|
|
616
|
-
fill:
|
|
626
|
+
r % 2 == 1 && u(e, Fe(o, n, s - o, this.plotHeight, {
|
|
627
|
+
fill: y.band,
|
|
617
628
|
stroke: "none"
|
|
618
|
-
})), r > 0 &&
|
|
619
|
-
stroke:
|
|
629
|
+
})), r > 0 && u(e, k(o, n, o, i, {
|
|
630
|
+
stroke: y.grid,
|
|
620
631
|
"stroke-dasharray": "3 5"
|
|
621
632
|
}));
|
|
622
633
|
let c = (o + s) / 2;
|
|
623
|
-
|
|
634
|
+
u(e, A(this.labels[r].toUpperCase(), c, i + 18, {
|
|
624
635
|
"text-anchor": "middle",
|
|
625
|
-
"font-size":
|
|
636
|
+
"font-size": x.stage,
|
|
626
637
|
"letter-spacing": "0.08em",
|
|
627
|
-
fill:
|
|
638
|
+
fill: y.axisText
|
|
628
639
|
}));
|
|
629
640
|
}
|
|
630
|
-
|
|
641
|
+
u(e, k(t, i, r + 10, i, { stroke: y.axis })), u(e, Ie(r + 10, i, "right")), u(e, A("Evolution", r + 6, i + 38, {
|
|
631
642
|
"text-anchor": "end",
|
|
632
|
-
"font-size":
|
|
633
|
-
fill:
|
|
643
|
+
"font-size": x.axis,
|
|
644
|
+
fill: y.axisText,
|
|
634
645
|
"font-style": "italic"
|
|
635
|
-
})),
|
|
636
|
-
let o =
|
|
646
|
+
})), u(e, k(t, i, t, n - 10, { stroke: y.axis })), u(e, Ie(t, n - 10, "up"));
|
|
647
|
+
let o = A(this.yAxisLabel, 0, 0, {
|
|
637
648
|
"text-anchor": "middle",
|
|
638
|
-
"font-size":
|
|
639
|
-
fill:
|
|
649
|
+
"font-size": x.axis,
|
|
650
|
+
fill: y.axisText,
|
|
640
651
|
"font-style": "italic"
|
|
641
652
|
});
|
|
642
|
-
|
|
653
|
+
d(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), u(e, o), u(e, A(this.yAxisEndLabels[1], t - 10, n + 11, {
|
|
643
654
|
"text-anchor": "end",
|
|
644
|
-
"font-size":
|
|
645
|
-
fill:
|
|
646
|
-
})),
|
|
655
|
+
"font-size": x.stage,
|
|
656
|
+
fill: y.axisText
|
|
657
|
+
})), u(e, A(this.yAxisEndLabels[0], t - 10, i - 2, {
|
|
647
658
|
"text-anchor": "end",
|
|
648
|
-
"font-size":
|
|
649
|
-
fill:
|
|
659
|
+
"font-size": x.stage,
|
|
660
|
+
fill: y.axisText
|
|
650
661
|
}));
|
|
651
662
|
}
|
|
652
663
|
};
|
|
653
|
-
function
|
|
654
|
-
return
|
|
664
|
+
function Fe(e, t, n, r, i) {
|
|
665
|
+
return d(p("rect"), {
|
|
655
666
|
x: e,
|
|
656
667
|
y: t,
|
|
657
668
|
width: n,
|
|
@@ -660,8 +671,8 @@ function Re(e, t, n, r, i) {
|
|
|
660
671
|
...i
|
|
661
672
|
});
|
|
662
673
|
}
|
|
663
|
-
function
|
|
664
|
-
return
|
|
674
|
+
function k(e, t, n, r, i) {
|
|
675
|
+
return d(p("line"), {
|
|
665
676
|
x1: e,
|
|
666
677
|
y1: t,
|
|
667
678
|
x2: n,
|
|
@@ -670,59 +681,61 @@ function w(e, t, n, r, i) {
|
|
|
670
681
|
...i
|
|
671
682
|
});
|
|
672
683
|
}
|
|
673
|
-
function
|
|
674
|
-
let i =
|
|
684
|
+
function A(e, t, n, r) {
|
|
685
|
+
let i = d(p("text"), {
|
|
675
686
|
x: t,
|
|
676
687
|
y: n,
|
|
677
|
-
"font-family":
|
|
688
|
+
"font-family": x.family,
|
|
678
689
|
...r
|
|
679
690
|
});
|
|
680
691
|
return i.textContent = e, i;
|
|
681
692
|
}
|
|
682
|
-
function
|
|
693
|
+
function Ie(e, t, n) {
|
|
683
694
|
let r = n === "right" ? `${e - 5},${t - 5} ${e + 2},${t} ${e - 5},${t + 5}` : `${e - 5},${t + 5} ${e},${t - 2} ${e + 5},${t + 5}`;
|
|
684
|
-
return
|
|
695
|
+
return d(p("polygon"), {
|
|
685
696
|
points: r,
|
|
686
|
-
fill:
|
|
697
|
+
fill: y.axis
|
|
687
698
|
});
|
|
688
699
|
}
|
|
689
700
|
//#endregion
|
|
690
701
|
//#region src/evolution-grid/EvolutionConstraintBehavior.ts
|
|
691
|
-
var
|
|
702
|
+
var Le = [
|
|
692
703
|
"shape.move",
|
|
693
704
|
"shape.create",
|
|
694
705
|
"shape.resize",
|
|
695
706
|
"elements.move",
|
|
696
707
|
"elements.create"
|
|
697
|
-
],
|
|
708
|
+
], Re = class extends ee {
|
|
698
709
|
eventBus;
|
|
699
710
|
grid;
|
|
700
711
|
elementRegistry;
|
|
712
|
+
layouter;
|
|
701
713
|
static $inject = [
|
|
702
714
|
"eventBus",
|
|
703
715
|
"evolutionGrid",
|
|
704
|
-
"elementRegistry"
|
|
716
|
+
"elementRegistry",
|
|
717
|
+
"layouter"
|
|
705
718
|
];
|
|
706
|
-
constructor(e, t, n) {
|
|
707
|
-
super(e), this.eventBus = e, this.grid = t, this.elementRegistry = n;
|
|
708
|
-
let
|
|
709
|
-
this.postExecuted(
|
|
710
|
-
let
|
|
719
|
+
constructor(e, t, n, r) {
|
|
720
|
+
super(e), this.eventBus = e, this.grid = t, this.elementRegistry = n, this.layouter = r;
|
|
721
|
+
let i = (e) => this.syncAll(e.context);
|
|
722
|
+
this.postExecuted(Le, i), this.reverted(Le, i);
|
|
723
|
+
let a = (e) => {
|
|
711
724
|
if ([
|
|
712
725
|
e.context?.shape,
|
|
713
726
|
e.context?.element,
|
|
714
727
|
...e.context?.elements ?? []
|
|
715
|
-
].some((e) =>
|
|
728
|
+
].some((e) => S(e) && e.wardleyType === "component")) for (let e of this.elementRegistry.filter((e) => T(e))) this.eventBus.fire("element.changed", { element: e });
|
|
716
729
|
};
|
|
717
730
|
this.postExecuted([
|
|
718
731
|
"shape.create",
|
|
719
732
|
"shape.delete",
|
|
720
733
|
"element.updateProperties"
|
|
721
|
-
],
|
|
734
|
+
], a), this.reverted([
|
|
722
735
|
"shape.create",
|
|
723
736
|
"shape.delete",
|
|
724
737
|
"element.updateProperties"
|
|
725
|
-
],
|
|
738
|
+
], a);
|
|
726
739
|
}
|
|
727
740
|
syncAll(e) {
|
|
728
741
|
if (!e) return;
|
|
@@ -731,7 +744,7 @@ var Be = [
|
|
|
731
744
|
...e.shapes ?? [],
|
|
732
745
|
...e.elements ?? []
|
|
733
746
|
];
|
|
734
|
-
for (let e of t)
|
|
747
|
+
for (let e of t) S(e) && this.syncFromGeometry(e);
|
|
735
748
|
}
|
|
736
749
|
syncFromGeometry(e) {
|
|
737
750
|
let t = e.y + e.height / 2;
|
|
@@ -742,8 +755,8 @@ var Be = [
|
|
|
742
755
|
}), r = this.grid.fromCanvas({
|
|
743
756
|
x: e.x + e.width,
|
|
744
757
|
y: t
|
|
745
|
-
}), [i, a] =
|
|
746
|
-
e.evolutionStart = i, e.evolutionEnd = a, e.evolution =
|
|
758
|
+
}), [i, a] = Ve(n.evolution, r.evolution);
|
|
759
|
+
e.evolutionStart = i, e.evolutionEnd = a, e.evolution = Be((i + a) / 2), e.visibility = n.visibility;
|
|
747
760
|
let o = this.grid.toCanvas({
|
|
748
761
|
visibility: e.visibility,
|
|
749
762
|
evolution: i
|
|
@@ -779,14 +792,14 @@ var Be = [
|
|
|
779
792
|
(Math.abs(t - e.x) > .5 || Math.abs(n - e.y) > .5 || r !== void 0 && Math.abs(r - e.width) > .5 || i !== void 0 && Math.abs(i - e.height) > .5) && (e.x = t, e.y = n, r !== void 0 && (e.width = r), i !== void 0 && (e.height = i), this.fireChanged(e));
|
|
780
793
|
}
|
|
781
794
|
updateMembership(e) {
|
|
782
|
-
let t = e.x + e.width / 2, n = e.y + e.height / 2, r = this.elementRegistry.filter((e) =>
|
|
795
|
+
let t = e.x + e.width / 2, n = e.y + e.height / 2, r = this.elementRegistry.filter((e) => T(e)).find((r) => r.wardleyLabel !== e.wardleyLabel && t >= r.x && t <= r.x + r.width && n >= r.y && n <= r.y + r.height);
|
|
783
796
|
r ? (e.pipelineId = r.id, this.glueToPipeline(e, r)) : e.pipelineId && delete e.pipelineId;
|
|
784
797
|
}
|
|
785
798
|
glueToPipeline(e, t) {
|
|
786
799
|
e.y = t.y + t.height / 2 - e.height / 2, e.visibility = t.visibility, this.fireChanged(e);
|
|
787
800
|
}
|
|
788
801
|
reconcileMembership(e) {
|
|
789
|
-
let t = this.elementRegistry.filter((e) =>
|
|
802
|
+
let t = this.elementRegistry.filter((e) => S(e) && e.wardleyType === "component");
|
|
790
803
|
for (let n of t) {
|
|
791
804
|
if (n.wardleyLabel === e.wardleyLabel) continue;
|
|
792
805
|
let t = n.x + n.width / 2, r = n.y + n.height / 2, i = t >= e.x && t <= e.x + e.width && r >= e.y && r <= e.y + e.height;
|
|
@@ -803,37 +816,37 @@ var Be = [
|
|
|
803
816
|
}
|
|
804
817
|
fireChanged(e) {
|
|
805
818
|
this.eventBus.fire("element.changed", { element: e });
|
|
806
|
-
for (let t of [...e.incoming ?? [], ...e.outgoing ?? []]) this.eventBus.fire("element.changed", { element: t });
|
|
819
|
+
for (let t of [...e.incoming ?? [], ...e.outgoing ?? []]) t.waypoints = this.layouter.layoutConnection(t), this.eventBus.fire("element.changed", { element: t });
|
|
807
820
|
}
|
|
808
|
-
},
|
|
809
|
-
function
|
|
821
|
+
}, ze = .001;
|
|
822
|
+
function Be(e) {
|
|
810
823
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
811
824
|
}
|
|
812
|
-
function
|
|
813
|
-
let n =
|
|
814
|
-
return [Math.max(0, Math.min(e, n -
|
|
825
|
+
function Ve(e, t) {
|
|
826
|
+
let n = Be(Math.max(t, e + ze));
|
|
827
|
+
return [Math.max(0, Math.min(e, n - ze)), n];
|
|
815
828
|
}
|
|
816
829
|
//#endregion
|
|
817
830
|
//#region src/evolution-grid/index.ts
|
|
818
|
-
var
|
|
831
|
+
var j = { evolutionGrid: ["type", Pe] }, He = {
|
|
819
832
|
__init__: ["evolutionConstraintBehavior"],
|
|
820
|
-
__depends__: [
|
|
821
|
-
evolutionConstraintBehavior: ["type",
|
|
822
|
-
},
|
|
823
|
-
function
|
|
824
|
-
let a =
|
|
825
|
-
return
|
|
833
|
+
__depends__: [j, O],
|
|
834
|
+
evolutionConstraintBehavior: ["type", Re]
|
|
835
|
+
}, M = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", Ue = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z", We = "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z", Ge = "M15.5 5H11l5 7-5 7h4.5l5-7zM8.5 5H4l5 7-5 7h4.5l5-7z", N = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", P = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Ke = "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z", qe = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Je = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Ye = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", Xe = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", Ze = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", Qe = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", $e = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", et = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", tt = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", nt = "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z", rt = "M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 8 6.5 8 8 8.67 8 9.5 7.33 11 6.5 11zm3-4C8.67 7 8 6.33 8 5.5S8.67 4 9.5 4s1.5.67 1.5 1.5S10.33 7 9.5 7zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 4 14.5 4s1.5.67 1.5 1.5S15.33 7 14.5 7zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 8 17.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z", it = "M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z", at = "M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z", ot = "M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z", st = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", ct = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", lt = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", ut = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
|
|
836
|
+
function F(e, t, n, r, i) {
|
|
837
|
+
let a = p("g"), o = r / 24;
|
|
838
|
+
return d(a, {
|
|
826
839
|
transform: `translate(${t - r / 2}, ${n - r / 2}) scale(${o})`,
|
|
827
840
|
fill: i,
|
|
828
841
|
stroke: "none"
|
|
829
|
-
}),
|
|
842
|
+
}), u(a, d(p("path"), { d: e })), a;
|
|
830
843
|
}
|
|
831
|
-
function
|
|
844
|
+
function dt(e, t = 18) {
|
|
832
845
|
return `<svg viewBox="0 0 24 24" width="${t}" height="${t}" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
|
|
833
846
|
}
|
|
834
847
|
//#endregion
|
|
835
848
|
//#region src/draw/WardleyRenderer.ts
|
|
836
|
-
var ft = 1500,
|
|
849
|
+
var ft = 1500, pt = class extends te {
|
|
837
850
|
grid;
|
|
838
851
|
elementRegistry;
|
|
839
852
|
static $inject = [
|
|
@@ -845,7 +858,7 @@ var ft = 1500, P = class extends te {
|
|
|
845
858
|
super(e, ft), this.grid = t, this.elementRegistry = n;
|
|
846
859
|
}
|
|
847
860
|
canRender(e) {
|
|
848
|
-
return
|
|
861
|
+
return S(e) || C(e);
|
|
849
862
|
}
|
|
850
863
|
drawShape(e, t) {
|
|
851
864
|
let n = t;
|
|
@@ -862,36 +875,36 @@ var ft = 1500, P = class extends te {
|
|
|
862
875
|
}
|
|
863
876
|
}
|
|
864
877
|
drawDrawing(e, t) {
|
|
865
|
-
let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i =
|
|
878
|
+
let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = d(p(t.closed ? "polygon" : "polyline"), {
|
|
866
879
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
867
880
|
fill: "none",
|
|
868
|
-
stroke: t.color ??
|
|
881
|
+
stroke: t.color ?? y.ink,
|
|
869
882
|
"stroke-width": 2,
|
|
870
883
|
"stroke-linecap": "round",
|
|
871
884
|
"stroke-linejoin": "round",
|
|
872
885
|
...r ? { "stroke-dasharray": r } : {}
|
|
873
886
|
});
|
|
874
|
-
return
|
|
887
|
+
return u(e, i), i;
|
|
875
888
|
}
|
|
876
889
|
drawConnection(e, t) {
|
|
877
|
-
let n = t, r = n.wardleyType === "flow", i = r ?
|
|
890
|
+
let n = t, r = n.wardleyType === "flow", i = r ? y.flow : y.dependency, [a, o] = yt(n), s = d(p("polyline"), {
|
|
878
891
|
points: `${a.x},${a.y} ${o.x},${o.y}`,
|
|
879
892
|
fill: "none",
|
|
880
893
|
stroke: i,
|
|
881
894
|
"stroke-width": r ? 2.5 : 1.5,
|
|
882
895
|
"stroke-linecap": "round"
|
|
883
896
|
});
|
|
884
|
-
|
|
885
|
-
let c = (a.x + o.x) / 2,
|
|
886
|
-
return r && n.flowValue &&
|
|
897
|
+
u(e, s), r && (u(e, R(a, o, i, 11, 5)), n.bidirectional && u(e, R(o, a, i, 11, 5)));
|
|
898
|
+
let c = (a.x + o.x) / 2, l = (a.y + o.y) / 2;
|
|
899
|
+
return r && n.flowValue && u(e, L(n.flowValue, c, l - 5, {
|
|
887
900
|
"text-anchor": "middle",
|
|
888
901
|
"font-size": 11,
|
|
889
|
-
fill:
|
|
890
|
-
})), n.linkLabel &&
|
|
902
|
+
fill: y.flow
|
|
903
|
+
})), n.linkLabel && u(e, L(n.linkLabel, c, l + (n.flowValue ? 12 : -4), {
|
|
891
904
|
"text-anchor": "middle",
|
|
892
905
|
"font-size": 11,
|
|
893
906
|
"font-style": "italic",
|
|
894
|
-
fill:
|
|
907
|
+
fill: y.axisText
|
|
895
908
|
})), s;
|
|
896
909
|
}
|
|
897
910
|
getShapePath(e) {
|
|
@@ -904,17 +917,17 @@ var ft = 1500, P = class extends te {
|
|
|
904
917
|
}
|
|
905
918
|
drawComponent(e, t) {
|
|
906
919
|
let n = t.width / 2, r = t.height / 2, i = t.decorators;
|
|
907
|
-
t.movement && this.drawMovement(e, t, n, r), i?.inertia &&
|
|
908
|
-
let a = t.color ??
|
|
909
|
-
fill:
|
|
920
|
+
t.movement && this.drawMovement(e, t, n, r), i?.inertia && mt(e, n, r);
|
|
921
|
+
let a = t.color ?? y.stroke, o = I(n, r, 15, {
|
|
922
|
+
fill: y.componentFill,
|
|
910
923
|
stroke: a,
|
|
911
924
|
"stroke-width": 2
|
|
912
925
|
});
|
|
913
|
-
return
|
|
926
|
+
return u(e, o), t.movement && u(e, I(n, r, 12, {
|
|
914
927
|
fill: "none",
|
|
915
928
|
stroke: a,
|
|
916
929
|
"stroke-width": 1.5
|
|
917
|
-
})),
|
|
930
|
+
})), ht(e, n, r, a, i), gt(e, t, n, r), o;
|
|
918
931
|
}
|
|
919
932
|
drawMovement(e, t, n, r) {
|
|
920
933
|
let i = t.movement;
|
|
@@ -926,58 +939,58 @@ var ft = 1500, P = class extends te {
|
|
|
926
939
|
visibility: t.visibility,
|
|
927
940
|
evolution: i.targetEvolution
|
|
928
941
|
}).x - a.x, s = n + o, c = s - (Math.sign(o) || 1) * 17;
|
|
929
|
-
|
|
930
|
-
stroke:
|
|
942
|
+
u(e, _t(n, r, c, r, {
|
|
943
|
+
stroke: y.movement,
|
|
931
944
|
"stroke-width": 1.5,
|
|
932
945
|
"stroke-dasharray": "6 4"
|
|
933
|
-
})),
|
|
946
|
+
})), u(e, R({
|
|
934
947
|
x: n,
|
|
935
948
|
y: r
|
|
936
949
|
}, {
|
|
937
950
|
x: c,
|
|
938
951
|
y: r
|
|
939
|
-
},
|
|
940
|
-
fill:
|
|
941
|
-
stroke:
|
|
952
|
+
}, y.movement)), u(e, I(s, r, 15, {
|
|
953
|
+
fill: y.paper,
|
|
954
|
+
stroke: y.movement,
|
|
942
955
|
"stroke-width": 2,
|
|
943
956
|
class: "wardley-evolve-handle"
|
|
944
|
-
})),
|
|
957
|
+
})), u(e, L(i.newLabel ?? t.wardleyLabel, s + 15 + 7, r - 4, {
|
|
945
958
|
"font-weight": "500",
|
|
946
|
-
fill:
|
|
947
|
-
})), i.method &&
|
|
959
|
+
fill: y.movement
|
|
960
|
+
})), i.method && u(e, L(i.method, s + 15 + 7, r + 11, {
|
|
948
961
|
"font-size": 10.5,
|
|
949
|
-
fill:
|
|
962
|
+
fill: y.movement
|
|
950
963
|
}));
|
|
951
964
|
}
|
|
952
965
|
drawAnchor(e, t) {
|
|
953
|
-
let n = t.width / 2, r = t.height / 2, i = M
|
|
954
|
-
return
|
|
966
|
+
let n = t.width / 2, r = t.height / 2, i = F(M, n, r, 26, t.color ?? y.ink);
|
|
967
|
+
return u(e, i), u(e, L(t.wardleyLabel, n + (t.labelOffset?.dx ?? 0), r - 13 - 4 + (t.labelOffset?.dy ?? 0), {
|
|
955
968
|
"text-anchor": "middle",
|
|
956
969
|
"font-weight": "700",
|
|
957
970
|
...t.color ? { fill: t.color } : {}
|
|
958
971
|
})), i;
|
|
959
972
|
}
|
|
960
973
|
drawPipeline(e, t) {
|
|
961
|
-
let n = Math.max(t.width, 1), r = t.color, i =
|
|
974
|
+
let n = Math.max(t.width, 1), r = t.color, i = d(p("rect"), {
|
|
962
975
|
x: 0,
|
|
963
976
|
y: 0,
|
|
964
977
|
width: n,
|
|
965
978
|
height: Math.max(t.height, 1),
|
|
966
979
|
rx: 4,
|
|
967
980
|
fill: "none",
|
|
968
|
-
stroke: r ??
|
|
981
|
+
stroke: r ?? y.pipeline,
|
|
969
982
|
"stroke-width": 1.25,
|
|
970
983
|
"stroke-dasharray": "6 3"
|
|
971
984
|
});
|
|
972
|
-
return
|
|
985
|
+
return u(e, i), !this.elementRegistry.filter((e) => S(e) && e.wardleyType === "component").some((e) => e.wardleyLabel === t.wardleyLabel) && (u(e, d(p("rect"), {
|
|
973
986
|
x: n / 2 - 8,
|
|
974
987
|
y: -8,
|
|
975
988
|
width: 16,
|
|
976
989
|
height: 16,
|
|
977
|
-
fill:
|
|
978
|
-
stroke: r ??
|
|
990
|
+
fill: y.componentFill,
|
|
991
|
+
stroke: r ?? y.stroke,
|
|
979
992
|
"stroke-width": 2
|
|
980
|
-
})),
|
|
993
|
+
})), u(e, L(t.wardleyLabel, n / 2 + 8 + 6, -4, {
|
|
981
994
|
"font-weight": "500",
|
|
982
995
|
...r ? { fill: r } : {}
|
|
983
996
|
}))), i;
|
|
@@ -985,17 +998,17 @@ var ft = 1500, P = class extends te {
|
|
|
985
998
|
drawNote(e, t) {
|
|
986
999
|
let n = t.color, r = (t.wardleyLabel ?? "").split("\n"), i = t.width / 2, a = t.height / 2 - (r.length - 1) * 17 / 2 + 4, o = {
|
|
987
1000
|
"text-anchor": "middle",
|
|
988
|
-
fill: n ??
|
|
1001
|
+
fill: n ?? y.noteText,
|
|
989
1002
|
"font-style": "italic",
|
|
990
1003
|
...n ? { "font-weight": "600" } : {}
|
|
991
1004
|
}, s;
|
|
992
1005
|
return r.forEach((t, n) => {
|
|
993
|
-
let r =
|
|
994
|
-
|
|
995
|
-
}), s ??
|
|
1006
|
+
let r = L(t, i, a + n * 17, o);
|
|
1007
|
+
u(e, r), s ||= r;
|
|
1008
|
+
}), s ?? p("text");
|
|
996
1009
|
}
|
|
997
1010
|
drawAttitude(e, t) {
|
|
998
|
-
let n =
|
|
1011
|
+
let n = b[t.attitudeKind ?? "pioneers"] ?? b.pioneers, r = t.color ?? n.stroke, i = d(p("rect"), {
|
|
999
1012
|
x: 0,
|
|
1000
1013
|
y: 0,
|
|
1001
1014
|
width: Math.max(t.width, 1),
|
|
@@ -1006,43 +1019,43 @@ var ft = 1500, P = class extends te {
|
|
|
1006
1019
|
"stroke-width": 1.25,
|
|
1007
1020
|
"stroke-dasharray": "5 4"
|
|
1008
1021
|
});
|
|
1009
|
-
return
|
|
1022
|
+
return u(e, i), u(e, L(t.wardleyLabel && t.wardleyLabel !== t.attitudeKind ? t.wardleyLabel : bt(t.attitudeKind ?? "pioneers"), 10, 18, {
|
|
1010
1023
|
fill: r,
|
|
1011
1024
|
"font-weight": "700",
|
|
1012
1025
|
"letter-spacing": "0.04em"
|
|
1013
1026
|
})), i;
|
|
1014
1027
|
}
|
|
1015
1028
|
drawAnnotation(e, t) {
|
|
1016
|
-
let n = t.width / 2, r = t.height / 2, i =
|
|
1017
|
-
fill:
|
|
1018
|
-
stroke: t.color ??
|
|
1029
|
+
let n = t.width / 2, r = t.height / 2, i = I(n, r, 10, {
|
|
1030
|
+
fill: y.annotationFill,
|
|
1031
|
+
stroke: t.color ?? y.stroke,
|
|
1019
1032
|
"stroke-width": 1.25
|
|
1020
1033
|
});
|
|
1021
|
-
return
|
|
1034
|
+
return u(e, i), u(e, L(String(t.annotationNumber ?? ""), n, r + 4, {
|
|
1022
1035
|
"text-anchor": "middle",
|
|
1023
1036
|
"font-size": 11,
|
|
1024
1037
|
"font-weight": "700"
|
|
1025
|
-
}, !1)), t.wardleyLabel &&
|
|
1038
|
+
}, !1)), t.wardleyLabel && u(e, L(t.wardleyLabel, n + 15, r + 4, {
|
|
1026
1039
|
"font-size": 12,
|
|
1027
|
-
fill:
|
|
1040
|
+
fill: y.noteText
|
|
1028
1041
|
})), i;
|
|
1029
1042
|
}
|
|
1030
1043
|
drawAccelerator(e, t) {
|
|
1031
|
-
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a =
|
|
1032
|
-
return
|
|
1044
|
+
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a = F(i ? it : at, n, r, 24, t.color ?? (i ? y.accelerator : y.deaccelerator));
|
|
1045
|
+
return u(e, a), t.wardleyLabel && u(e, L(t.wardleyLabel, n + 15, r + 5, { "font-size": 12 })), a;
|
|
1033
1046
|
}
|
|
1034
1047
|
drawSubmap(e, t) {
|
|
1035
|
-
let n = t.width / 2, r = t.height / 2, i = t.color ??
|
|
1048
|
+
let n = t.width / 2, r = t.height / 2, i = t.color ?? y.stroke, a = d(p("rect"), {
|
|
1036
1049
|
x: n - 16,
|
|
1037
1050
|
y: r - 16,
|
|
1038
1051
|
width: 32,
|
|
1039
1052
|
height: 32,
|
|
1040
1053
|
rx: 3,
|
|
1041
|
-
fill:
|
|
1054
|
+
fill: y.componentFill,
|
|
1042
1055
|
stroke: i,
|
|
1043
1056
|
"stroke-width": 2
|
|
1044
1057
|
});
|
|
1045
|
-
return
|
|
1058
|
+
return u(e, a), u(e, d(p("rect"), {
|
|
1046
1059
|
x: n - 16 + 3,
|
|
1047
1060
|
y: r - 16 + 3,
|
|
1048
1061
|
width: 26,
|
|
@@ -1051,22 +1064,22 @@ var ft = 1500, P = class extends te {
|
|
|
1051
1064
|
fill: "none",
|
|
1052
1065
|
stroke: i,
|
|
1053
1066
|
"stroke-width": 1
|
|
1054
|
-
})),
|
|
1067
|
+
})), u(e, L(t.wardleyLabel, n + 16 + 6, r - 6, {
|
|
1055
1068
|
"font-weight": "500",
|
|
1056
1069
|
...t.color ? { fill: t.color } : {}
|
|
1057
1070
|
})), a;
|
|
1058
1071
|
}
|
|
1059
1072
|
};
|
|
1060
|
-
function
|
|
1073
|
+
function mt(e, t, n) {
|
|
1061
1074
|
let r = t + 15 + 3;
|
|
1062
|
-
|
|
1063
|
-
stroke:
|
|
1075
|
+
u(e, _t(r, n - 13, r, n + 13, {
|
|
1076
|
+
stroke: y.inertia,
|
|
1064
1077
|
"stroke-width": 3,
|
|
1065
1078
|
"stroke-linecap": "round"
|
|
1066
1079
|
}));
|
|
1067
1080
|
}
|
|
1068
|
-
function
|
|
1069
|
-
if (i?.ecosystem &&
|
|
1081
|
+
function ht(e, t, n, r, i) {
|
|
1082
|
+
if (i?.ecosystem && u(e, I(t, n, 18.5, {
|
|
1070
1083
|
fill: "none",
|
|
1071
1084
|
stroke: r,
|
|
1072
1085
|
"stroke-width": 1.25,
|
|
@@ -1076,20 +1089,20 @@ function mt(e, t, n, r, i) {
|
|
|
1076
1089
|
[0, -3.8],
|
|
1077
1090
|
[-3.4, 2.4],
|
|
1078
1091
|
[3.4, 2.4]
|
|
1079
|
-
])
|
|
1092
|
+
]) u(e, I(t + i, n + a, 1.7, { fill: r }));
|
|
1080
1093
|
}
|
|
1081
|
-
function
|
|
1094
|
+
function gt(e, t, n, r) {
|
|
1082
1095
|
let i = t.decorators, a = n + 15 + 7 + (t.labelOffset?.dx ?? 0), o = r - 4 + (t.labelOffset?.dy ?? 0);
|
|
1083
|
-
|
|
1096
|
+
u(e, L(t.wardleyLabel, a, o, {
|
|
1084
1097
|
"font-weight": "500",
|
|
1085
1098
|
...t.color ? { fill: t.color } : {}
|
|
1086
|
-
})), i?.method &&
|
|
1099
|
+
})), i?.method && u(e, L(i.method, a, o + 15, {
|
|
1087
1100
|
"font-size": 10.5,
|
|
1088
|
-
fill:
|
|
1101
|
+
fill: y.axisText
|
|
1089
1102
|
}));
|
|
1090
1103
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1104
|
+
function I(e, t, n, r) {
|
|
1105
|
+
return d(p("circle"), {
|
|
1093
1106
|
cx: e,
|
|
1094
1107
|
cy: t,
|
|
1095
1108
|
r: n,
|
|
@@ -1097,8 +1110,8 @@ function F(e, t, n, r) {
|
|
|
1097
1110
|
...r
|
|
1098
1111
|
});
|
|
1099
1112
|
}
|
|
1100
|
-
function
|
|
1101
|
-
return
|
|
1113
|
+
function _t(e, t, n, r, i) {
|
|
1114
|
+
return d(p("line"), {
|
|
1102
1115
|
x1: e,
|
|
1103
1116
|
y1: t,
|
|
1104
1117
|
x2: n,
|
|
@@ -1106,41 +1119,32 @@ function gt(e, t, n, r, i) {
|
|
|
1106
1119
|
...i
|
|
1107
1120
|
});
|
|
1108
1121
|
}
|
|
1109
|
-
function
|
|
1122
|
+
function L(e, t, n, r = {}, i = !0) {
|
|
1110
1123
|
let a = i ? {
|
|
1111
|
-
stroke:
|
|
1124
|
+
stroke: y.paper,
|
|
1112
1125
|
"stroke-width": 3.5,
|
|
1113
1126
|
"paint-order": "stroke",
|
|
1114
1127
|
"stroke-linejoin": "round"
|
|
1115
|
-
} : {}, o =
|
|
1128
|
+
} : {}, o = d(p("text"), {
|
|
1116
1129
|
x: t,
|
|
1117
1130
|
y: n,
|
|
1118
|
-
"font-family":
|
|
1119
|
-
"font-size":
|
|
1120
|
-
fill:
|
|
1131
|
+
"font-family": x.family,
|
|
1132
|
+
"font-size": x.label,
|
|
1133
|
+
fill: y.ink,
|
|
1121
1134
|
...a,
|
|
1122
1135
|
...r
|
|
1123
1136
|
});
|
|
1124
1137
|
return o.textContent = e, o;
|
|
1125
1138
|
}
|
|
1126
|
-
function
|
|
1139
|
+
function R(e, t, n, r = 10, i = 5) {
|
|
1127
1140
|
let a = Math.atan2(t.y - e.y, t.x - e.x), o = t.x - r * Math.cos(a), s = t.y - r * Math.sin(a), c = `${t.x},${t.y} ${o - i * Math.sin(a)},${s + i * Math.cos(a)} ${o + i * Math.sin(a)},${s - i * Math.cos(a)}`;
|
|
1128
|
-
return
|
|
1141
|
+
return d(p("polygon"), {
|
|
1129
1142
|
points: c,
|
|
1130
1143
|
fill: n
|
|
1131
1144
|
});
|
|
1132
1145
|
}
|
|
1133
|
-
function _t(e) {
|
|
1134
|
-
return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
|
|
1135
|
-
}
|
|
1136
1146
|
function vt(e) {
|
|
1137
|
-
return e.wardleyType === "pipeline" ?
|
|
1138
|
-
x: e.x + e.width / 2,
|
|
1139
|
-
y: e.y
|
|
1140
|
-
} : {
|
|
1141
|
-
x: e.x + e.width / 2,
|
|
1142
|
-
y: e.y + e.height / 2
|
|
1143
|
-
};
|
|
1147
|
+
return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
|
|
1144
1148
|
}
|
|
1145
1149
|
function yt(e) {
|
|
1146
1150
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
@@ -1151,7 +1155,7 @@ function yt(e) {
|
|
|
1151
1155
|
};
|
|
1152
1156
|
return [e, r[r.length - 1] ?? e];
|
|
1153
1157
|
}
|
|
1154
|
-
let i =
|
|
1158
|
+
let i = E(t), a = E(n), o = a.x - i.x, s = a.y - i.y, c = Math.hypot(o, s) || 1, l = o / c, u = s / c, d = vt(t), f = vt(n);
|
|
1155
1159
|
return c <= d + f + 2 ? [i, a] : [{
|
|
1156
1160
|
x: i.x + l * d,
|
|
1157
1161
|
y: i.y + u * d
|
|
@@ -1167,7 +1171,7 @@ function bt(e) {
|
|
|
1167
1171
|
//#region src/draw/index.ts
|
|
1168
1172
|
var xt = {
|
|
1169
1173
|
__init__: ["wardleyRenderer"],
|
|
1170
|
-
wardleyRenderer: ["type",
|
|
1174
|
+
wardleyRenderer: ["type", pt]
|
|
1171
1175
|
}, St = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ct = {
|
|
1172
1176
|
attitude: 0,
|
|
1173
1177
|
pipeline: 1,
|
|
@@ -1208,7 +1212,7 @@ var xt = {
|
|
|
1208
1212
|
r = void 0;
|
|
1209
1213
|
}
|
|
1210
1214
|
let i;
|
|
1211
|
-
r && r.id === "wardley-root" ? i = r : (i = this.elementFactory.createRoot({ id:
|
|
1215
|
+
r && r.id === "wardley-root" ? i = r : (i = this.elementFactory.createRoot({ id: we }), this.canvas.setRootElement(i)), i.businessObject = n, this.grid.render();
|
|
1212
1216
|
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (Ct[e.elementType] ?? 9) - (Ct[t.elementType] ?? 9)), s = o.filter((e) => St.has(e.elementType)), c = o.filter((e) => !St.has(e.elementType)), l = 0;
|
|
1213
1217
|
for (let e of s) {
|
|
1214
1218
|
let t = this.createShape(e);
|
|
@@ -1261,7 +1265,7 @@ var xt = {
|
|
|
1261
1265
|
};
|
|
1262
1266
|
//#endregion
|
|
1263
1267
|
//#region src/io/WardleyExporter.ts
|
|
1264
|
-
function
|
|
1268
|
+
function z(e) {
|
|
1265
1269
|
let t = {};
|
|
1266
1270
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
1267
1271
|
return t;
|
|
@@ -1281,48 +1285,49 @@ var Tt = class {
|
|
|
1281
1285
|
export() {
|
|
1282
1286
|
let e = this.canvas.getRootElement().businessObject, t = e?.config ?? { title: "Untitled Map" }, n = [], i = [];
|
|
1283
1287
|
for (let e of this.elementRegistry.getAll()) if (e.id !== "wardley-root") {
|
|
1284
|
-
if (
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1288
|
+
if (C(e)) {
|
|
1289
|
+
if (e.businessObject) i.push(e.businessObject);
|
|
1290
|
+
else {
|
|
1291
|
+
let t = {
|
|
1292
|
+
id: e.id,
|
|
1293
|
+
from: e.source?.id ?? "",
|
|
1294
|
+
to: e.target?.id ?? ""
|
|
1295
|
+
};
|
|
1296
|
+
i.push(e.wardleyType === "flow" ? {
|
|
1297
|
+
...t,
|
|
1298
|
+
edgeType: "flow",
|
|
1299
|
+
...e.bidirectional ? { bidirectional: !0 } : {}
|
|
1300
|
+
} : {
|
|
1301
|
+
...t,
|
|
1302
|
+
edgeType: "dependency"
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
} else if (S(e)) {
|
|
1301
1306
|
let t = this.buildElement(e);
|
|
1302
1307
|
t && n.push(t);
|
|
1303
1308
|
}
|
|
1304
1309
|
}
|
|
1305
|
-
let a = new Set(n.filter((e) => e.elementType === "pipeline").map((e) => e.id))
|
|
1306
|
-
|
|
1310
|
+
let a = new Set(n.filter((e) => e.elementType === "pipeline").map((e) => e.id)), o = n.map((e) => {
|
|
1311
|
+
if (e.elementType === "component" && e.pipelineId && !a.has(e.pipelineId)) {
|
|
1312
|
+
let { pipelineId: t, ...n } = e;
|
|
1313
|
+
return n;
|
|
1314
|
+
}
|
|
1315
|
+
if (e.elementType === "pipeline") {
|
|
1316
|
+
let t = n.filter((t) => t.elementType === "component" && t.pipelineId === e.id).map((e) => e.id);
|
|
1317
|
+
return {
|
|
1318
|
+
...e,
|
|
1319
|
+
childIds: t
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
return e;
|
|
1323
|
+
}), s = {
|
|
1307
1324
|
schemaVersion: r,
|
|
1308
1325
|
config: t,
|
|
1309
|
-
elements:
|
|
1310
|
-
if (e.elementType === "component" && e.pipelineId && !a.has(e.pipelineId)) {
|
|
1311
|
-
let { pipelineId: t, ...n } = e;
|
|
1312
|
-
return n;
|
|
1313
|
-
}
|
|
1314
|
-
if (e.elementType === "pipeline") {
|
|
1315
|
-
let t = n.filter((t) => t.elementType === "component" && t.pipelineId === e.id).map((e) => e.id);
|
|
1316
|
-
return {
|
|
1317
|
-
...e,
|
|
1318
|
-
childIds: t
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
return e;
|
|
1322
|
-
}),
|
|
1326
|
+
elements: o,
|
|
1323
1327
|
edges: i,
|
|
1324
1328
|
...e?.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
|
|
1325
|
-
}
|
|
1329
|
+
};
|
|
1330
|
+
return c(s);
|
|
1326
1331
|
}
|
|
1327
1332
|
buildElement(e) {
|
|
1328
1333
|
let t = {
|
|
@@ -1330,7 +1335,7 @@ var Tt = class {
|
|
|
1330
1335
|
evolution: e.evolution
|
|
1331
1336
|
}, n = e.businessObject;
|
|
1332
1337
|
switch (e.wardleyType) {
|
|
1333
|
-
case "component": return
|
|
1338
|
+
case "component": return z({
|
|
1334
1339
|
id: e.id,
|
|
1335
1340
|
elementType: "component",
|
|
1336
1341
|
label: e.wardleyLabel,
|
|
@@ -1342,7 +1347,7 @@ var Tt = class {
|
|
|
1342
1347
|
url: n?.url,
|
|
1343
1348
|
color: e.color
|
|
1344
1349
|
});
|
|
1345
|
-
case "anchor": return
|
|
1350
|
+
case "anchor": return z({
|
|
1346
1351
|
id: e.id,
|
|
1347
1352
|
elementType: "anchor",
|
|
1348
1353
|
label: e.wardleyLabel,
|
|
@@ -1350,7 +1355,7 @@ var Tt = class {
|
|
|
1350
1355
|
labelOffset: e.labelOffset ?? n?.labelOffset,
|
|
1351
1356
|
color: e.color
|
|
1352
1357
|
});
|
|
1353
|
-
case "note": return
|
|
1358
|
+
case "note": return z({
|
|
1354
1359
|
id: e.id,
|
|
1355
1360
|
elementType: "note",
|
|
1356
1361
|
label: e.wardleyLabel,
|
|
@@ -1401,7 +1406,7 @@ var Tt = class {
|
|
|
1401
1406
|
...e.color ? { color: e.color } : {}
|
|
1402
1407
|
};
|
|
1403
1408
|
}
|
|
1404
|
-
case "submap": return
|
|
1409
|
+
case "submap": return z({
|
|
1405
1410
|
id: e.id,
|
|
1406
1411
|
elementType: "submap",
|
|
1407
1412
|
label: e.wardleyLabel,
|
|
@@ -1434,11 +1439,11 @@ var Tt = class {
|
|
|
1434
1439
|
}, Et = {
|
|
1435
1440
|
wardleyImporter: ["type", wt],
|
|
1436
1441
|
wardleyExporter: ["type", Tt]
|
|
1437
|
-
}, Dt = class extends
|
|
1442
|
+
}, Dt = class extends Ee {
|
|
1438
1443
|
_getModules() {
|
|
1439
1444
|
return [
|
|
1440
|
-
|
|
1441
|
-
|
|
1445
|
+
je,
|
|
1446
|
+
j,
|
|
1442
1447
|
xt,
|
|
1443
1448
|
Et
|
|
1444
1449
|
];
|
|
@@ -1464,7 +1469,7 @@ var Pt = class {
|
|
|
1464
1469
|
constrain(e) {
|
|
1465
1470
|
let t = e ?? this.canvas.viewbox(), n = this.grid.outerBounds();
|
|
1466
1471
|
if (!(n.width > 0) || !(n.height > 0) || !(t.width > 0) || !(t.height > 0)) return;
|
|
1467
|
-
let r = Nt(t.x, t.width, n.x - At, n.width +
|
|
1472
|
+
let r = Nt(t.x, t.width, n.x - At, n.width + 240), i = Nt(t.y, t.height, n.y - Ot, n.height + Ot + kt);
|
|
1468
1473
|
if (!(Math.abs(r - t.x) < jt && Math.abs(i - t.y) < jt)) {
|
|
1469
1474
|
this.applying = !0;
|
|
1470
1475
|
try {
|
|
@@ -1530,7 +1535,7 @@ var Vt = class {
|
|
|
1530
1535
|
}
|
|
1531
1536
|
updateLabel(e, t) {
|
|
1532
1537
|
if (e.wardleyType === "note") {
|
|
1533
|
-
let { width: n, height: r } =
|
|
1538
|
+
let { width: n, height: r } = v(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
1534
1539
|
this.updateProperties(e, {
|
|
1535
1540
|
wardleyLabel: t,
|
|
1536
1541
|
width: n,
|
|
@@ -1628,13 +1633,13 @@ var qt = class {
|
|
|
1628
1633
|
this.selection = e, this.modeling = t, this.elementFactory = n, this.elementRegistry = r, this.canvas = i, this.create = a, this.mouse = o;
|
|
1629
1634
|
}
|
|
1630
1635
|
copy() {
|
|
1631
|
-
let e = this.selection.get().filter((e) =>
|
|
1636
|
+
let e = this.selection.get().filter((e) => S(e));
|
|
1632
1637
|
if (!e.length) return !1;
|
|
1633
1638
|
let t = new Map(e.map((e, t) => [e, t])), n = [], r = /* @__PURE__ */ new Set();
|
|
1634
1639
|
for (let i of e) for (let e of [...i.incoming ?? [], ...i.outgoing ?? []]) {
|
|
1635
|
-
if (!
|
|
1640
|
+
if (!C(e) || r.has(e)) continue;
|
|
1636
1641
|
let i = t.get(e.source), a = t.get(e.target);
|
|
1637
|
-
i
|
|
1642
|
+
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
1638
1643
|
sourceIdx: i,
|
|
1639
1644
|
targetIdx: a,
|
|
1640
1645
|
props: Kt(e, Gt)
|
|
@@ -1676,13 +1681,13 @@ var qt = class {
|
|
|
1676
1681
|
...structuredClone(e.props),
|
|
1677
1682
|
source: n[e.sourceIdx],
|
|
1678
1683
|
target: n[e.targetIdx],
|
|
1679
|
-
waypoints: [
|
|
1684
|
+
waypoints: [E(n[e.sourceIdx]), E(n[e.targetIdx])]
|
|
1680
1685
|
}))
|
|
1681
1686
|
};
|
|
1682
1687
|
}
|
|
1683
1688
|
insertWithOffset(e) {
|
|
1684
1689
|
this.pasteCount++;
|
|
1685
|
-
let t = Ut * this.pasteCount, n =
|
|
1690
|
+
let t = Ut * this.pasteCount, n = Jt(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
1686
1691
|
x: n.cx + t,
|
|
1687
1692
|
y: n.cy + t
|
|
1688
1693
|
}, this.canvas.getRootElement());
|
|
@@ -1702,12 +1707,6 @@ var qt = class {
|
|
|
1702
1707
|
}
|
|
1703
1708
|
};
|
|
1704
1709
|
function Jt(e) {
|
|
1705
|
-
return {
|
|
1706
|
-
x: e.x + e.width / 2,
|
|
1707
|
-
y: e.y + e.height / 2
|
|
1708
|
-
};
|
|
1709
|
-
}
|
|
1710
|
-
function Yt(e) {
|
|
1711
1710
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + e.width)), i = Math.max(...e.map((e) => e.y + e.height));
|
|
1712
1711
|
return {
|
|
1713
1712
|
cx: (t + r) / 2,
|
|
@@ -1716,13 +1715,13 @@ function Yt(e) {
|
|
|
1716
1715
|
}
|
|
1717
1716
|
//#endregion
|
|
1718
1717
|
//#region src/modeling/index.ts
|
|
1719
|
-
var
|
|
1720
|
-
__depends__: [
|
|
1718
|
+
var Yt = {
|
|
1719
|
+
__depends__: [he, h],
|
|
1721
1720
|
__init__: ["wardleyModeling"],
|
|
1722
1721
|
wardleyModeling: ["type", Vt],
|
|
1723
1722
|
wardleyCopyPaste: ["type", qt]
|
|
1724
|
-
},
|
|
1725
|
-
__depends__: [
|
|
1723
|
+
}, Xt = {
|
|
1724
|
+
__depends__: [ge],
|
|
1726
1725
|
__init__: ["wardleyLassoBehavior"],
|
|
1727
1726
|
wardleyLassoBehavior: ["type", class {
|
|
1728
1727
|
static $inject = [
|
|
@@ -1744,33 +1743,33 @@ var Xt = {
|
|
|
1744
1743
|
});
|
|
1745
1744
|
}
|
|
1746
1745
|
}]
|
|
1747
|
-
},
|
|
1746
|
+
}, Zt = /* @__PURE__ */ new Set([
|
|
1748
1747
|
"component",
|
|
1749
1748
|
"anchor",
|
|
1750
1749
|
"submap",
|
|
1751
1750
|
"pipeline"
|
|
1752
1751
|
]);
|
|
1753
|
-
function
|
|
1754
|
-
return
|
|
1752
|
+
function B(e) {
|
|
1753
|
+
return S(e) && Zt.has(e.wardleyType);
|
|
1755
1754
|
}
|
|
1756
|
-
function
|
|
1755
|
+
function Qt(e, t) {
|
|
1757
1756
|
return (e.outgoing ?? []).some((e) => e.target === t) || (e.incoming ?? []).some((e) => e.source === t);
|
|
1758
1757
|
}
|
|
1759
|
-
var
|
|
1758
|
+
var $t = class extends _e {
|
|
1760
1759
|
static $inject = ["eventBus"];
|
|
1761
1760
|
constructor(e) {
|
|
1762
1761
|
super(e);
|
|
1763
1762
|
}
|
|
1764
1763
|
init() {
|
|
1765
|
-
this.addRule("connection.start", (e) =>
|
|
1764
|
+
this.addRule("connection.start", (e) => B(e.source)), this.addRule("connection.create", (e) => {
|
|
1766
1765
|
let { source: t, target: n } = e;
|
|
1767
|
-
return !
|
|
1768
|
-
}), this.addRule(["shape.move", "elements.move"], () => !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) =>
|
|
1766
|
+
return !B(t) || !B(n) || t === n || Qt(t, n) ? !1 : { wardleyType: "dependency" };
|
|
1767
|
+
}), this.addRule(["shape.move", "elements.move"], () => !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => T(e.shape) || ke(e.shape));
|
|
1769
1768
|
}
|
|
1770
|
-
},
|
|
1769
|
+
}, en = {
|
|
1771
1770
|
__init__: ["wardleyRules"],
|
|
1772
|
-
wardleyRules: ["type",
|
|
1773
|
-
},
|
|
1771
|
+
wardleyRules: ["type", $t]
|
|
1772
|
+
}, tn = 8, nn = {
|
|
1774
1773
|
__init__: ["stageSnapping"],
|
|
1775
1774
|
stageSnapping: ["type", class {
|
|
1776
1775
|
static $inject = ["eventBus", "evolutionGrid"];
|
|
@@ -1786,7 +1785,7 @@ var en = class extends ve {
|
|
|
1786
1785
|
let t = e.context?.shape;
|
|
1787
1786
|
if (!t) return;
|
|
1788
1787
|
let r = t.x + t.width / 2 + e.dx;
|
|
1789
|
-
for (let t of n()) if (Math.abs(r - t) <=
|
|
1788
|
+
for (let t of n()) if (Math.abs(r - t) <= tn) {
|
|
1790
1789
|
let n = t - r;
|
|
1791
1790
|
e.dx += n, e.x += n;
|
|
1792
1791
|
break;
|
|
@@ -1798,7 +1797,7 @@ var en = class extends ve {
|
|
|
1798
1797
|
"resize.end"
|
|
1799
1798
|
], 1500, (e) => {
|
|
1800
1799
|
if (!e.originalEvent?.shiftKey && typeof e.x == "number") {
|
|
1801
|
-
for (let t of n()) if (Math.abs(e.x - t) <=
|
|
1800
|
+
for (let t of n()) if (Math.abs(e.x - t) <= tn) {
|
|
1802
1801
|
r(e, t);
|
|
1803
1802
|
break;
|
|
1804
1803
|
}
|
|
@@ -1806,45 +1805,45 @@ var en = class extends ve {
|
|
|
1806
1805
|
});
|
|
1807
1806
|
}
|
|
1808
1807
|
}]
|
|
1809
|
-
},
|
|
1810
|
-
draw:
|
|
1811
|
-
lasso:
|
|
1812
|
-
component:
|
|
1813
|
-
market:
|
|
1814
|
-
ecosystem:
|
|
1815
|
-
anchor:
|
|
1816
|
-
pipeline:
|
|
1817
|
-
note:
|
|
1818
|
-
annotation:
|
|
1819
|
-
accelerator:
|
|
1820
|
-
deaccelerator:
|
|
1821
|
-
submap:
|
|
1808
|
+
}, V = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`, H = (e = "") => `<circle cx="12" cy="12" r="7" fill="${y.componentFill}" stroke="${y.stroke}" stroke-width="2"/>${e}`, U = {
|
|
1809
|
+
draw: V(`<polyline points="3,18 8.5,7 14,14 21,4" fill="none" stroke="${y.ink}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="3" cy="18" r="2.2" fill="${y.componentFill}" stroke="${y.ink}" stroke-width="1.4"/>`),
|
|
1810
|
+
lasso: V(`<rect x="3" y="3" width="13" height="13" rx="2" fill="none" stroke="${y.ink}" stroke-width="1.5" stroke-dasharray="3 2.5"/><path d="M13.5 13.5l7 2.7-3 1.3-1.3 3z" fill="${y.ink}"/>`),
|
|
1811
|
+
component: V(H()),
|
|
1812
|
+
market: V(H(`<circle cx="12" cy="10" r="1.4" fill="${y.stroke}"/><circle cx="10.2" cy="13.4" r="1.4" fill="${y.stroke}"/><circle cx="13.8" cy="13.4" r="1.4" fill="${y.stroke}"/>`)),
|
|
1813
|
+
ecosystem: V(H(`<circle cx="12" cy="12" r="10" fill="none" stroke="${y.stroke}" stroke-width="1.25" stroke-dasharray="1.5 3" stroke-linecap="round"/>`)),
|
|
1814
|
+
anchor: V(`<path d="${M}" fill="${y.ink}"/>`),
|
|
1815
|
+
pipeline: V(`<rect x="9.5" y="2.5" width="5.5" height="5.5" fill="${y.componentFill}" stroke="${y.stroke}" stroke-width="1.5"/><rect x="2" y="10" width="20" height="9" rx="2" fill="none" stroke="${y.pipeline}" stroke-width="1.25" stroke-dasharray="3 2"/><circle cx="7" cy="14.5" r="2.2" fill="${y.componentFill}" stroke="${y.stroke}" stroke-width="1.2"/><circle cx="17" cy="14.5" r="2.2" fill="${y.componentFill}" stroke="${y.stroke}" stroke-width="1.2"/>`),
|
|
1816
|
+
note: V(`<g stroke="${y.noteText}" stroke-width="1.5" stroke-linecap="round"><line x1="5" y1="8" x2="19" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="5" y1="16" x2="13" y2="16"/></g>`),
|
|
1817
|
+
annotation: V(`<circle cx="12" cy="12" r="8" fill="${y.annotationFill}" stroke="${y.stroke}" stroke-width="1.25"/>` + ((e, t) => `<text x="12" text-anchor="middle" font-family="${x.family}" ${t}>${e}</text>`)("1", `y="16" font-size="11" font-weight="700" fill="${y.stroke}"`)),
|
|
1818
|
+
accelerator: V(`<path d="${it}" fill="${y.accelerator}"/>`),
|
|
1819
|
+
deaccelerator: V(`<path d="${at}" fill="${y.deaccelerator}"/>`),
|
|
1820
|
+
submap: V(`<rect x="4" y="4" width="16" height="16" rx="3" fill="${y.componentFill}" stroke="${y.stroke}" stroke-width="2"/><rect x="7.5" y="7.5" width="9" height="9" rx="1.5" fill="none" stroke="${y.stroke}" stroke-width="1"/>`)
|
|
1822
1821
|
};
|
|
1823
|
-
function
|
|
1824
|
-
let t =
|
|
1825
|
-
fill:
|
|
1826
|
-
stroke:
|
|
1822
|
+
function W(e) {
|
|
1823
|
+
let t = b[e] ?? {
|
|
1824
|
+
fill: y.band,
|
|
1825
|
+
stroke: y.dependency
|
|
1827
1826
|
};
|
|
1828
|
-
return
|
|
1827
|
+
return V(`<rect x="2" y="6" width="20" height="12" rx="3" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5" stroke-dasharray="3 2"/>`);
|
|
1829
1828
|
}
|
|
1830
1829
|
//#endregion
|
|
1831
1830
|
//#region src/palette/WardleyPaletteProvider.ts
|
|
1832
|
-
var
|
|
1831
|
+
var G = "wardley-1-blocks", K = "wardley-2-strategy", rn = [
|
|
1833
1832
|
{
|
|
1834
1833
|
key: "component",
|
|
1835
1834
|
type: "component",
|
|
1836
1835
|
label: "Component",
|
|
1837
1836
|
title: "Component — C",
|
|
1838
|
-
icon:
|
|
1839
|
-
group:
|
|
1837
|
+
icon: U.component,
|
|
1838
|
+
group: G
|
|
1840
1839
|
},
|
|
1841
1840
|
{
|
|
1842
1841
|
key: "market",
|
|
1843
1842
|
type: "component",
|
|
1844
1843
|
label: "Market",
|
|
1845
1844
|
title: "Market component",
|
|
1846
|
-
icon:
|
|
1847
|
-
group:
|
|
1845
|
+
icon: U.market,
|
|
1846
|
+
group: G,
|
|
1848
1847
|
extra: { market: !0 }
|
|
1849
1848
|
},
|
|
1850
1849
|
{
|
|
@@ -1852,8 +1851,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1852
1851
|
type: "component",
|
|
1853
1852
|
label: "Ecosystem",
|
|
1854
1853
|
title: "Ecosystem component",
|
|
1855
|
-
icon:
|
|
1856
|
-
group:
|
|
1854
|
+
icon: U.ecosystem,
|
|
1855
|
+
group: G,
|
|
1857
1856
|
extra: { ecosystem: !0 }
|
|
1858
1857
|
},
|
|
1859
1858
|
{
|
|
@@ -1861,32 +1860,32 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1861
1860
|
type: "anchor",
|
|
1862
1861
|
label: "User",
|
|
1863
1862
|
title: "Anchor / User — U",
|
|
1864
|
-
icon:
|
|
1865
|
-
group:
|
|
1863
|
+
icon: U.anchor,
|
|
1864
|
+
group: G
|
|
1866
1865
|
},
|
|
1867
1866
|
{
|
|
1868
1867
|
key: "pipeline",
|
|
1869
1868
|
type: "pipeline",
|
|
1870
1869
|
label: "Pipeline",
|
|
1871
1870
|
title: "Pipeline",
|
|
1872
|
-
icon:
|
|
1873
|
-
group:
|
|
1871
|
+
icon: U.pipeline,
|
|
1872
|
+
group: G
|
|
1874
1873
|
},
|
|
1875
1874
|
{
|
|
1876
1875
|
key: "submap",
|
|
1877
1876
|
type: "submap",
|
|
1878
1877
|
label: "Submap",
|
|
1879
1878
|
title: "Submap",
|
|
1880
|
-
icon:
|
|
1881
|
-
group:
|
|
1879
|
+
icon: U.submap,
|
|
1880
|
+
group: G
|
|
1882
1881
|
},
|
|
1883
1882
|
{
|
|
1884
1883
|
key: "pioneers",
|
|
1885
1884
|
type: "attitude",
|
|
1886
1885
|
label: "Pioneers",
|
|
1887
1886
|
title: "Pioneers region",
|
|
1888
|
-
icon:
|
|
1889
|
-
group:
|
|
1887
|
+
icon: W("pioneers"),
|
|
1888
|
+
group: K,
|
|
1890
1889
|
extra: { attitudeKind: "pioneers" }
|
|
1891
1890
|
},
|
|
1892
1891
|
{
|
|
@@ -1894,8 +1893,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1894
1893
|
type: "attitude",
|
|
1895
1894
|
label: "Settlers",
|
|
1896
1895
|
title: "Settlers region",
|
|
1897
|
-
icon:
|
|
1898
|
-
group:
|
|
1896
|
+
icon: W("settlers"),
|
|
1897
|
+
group: K,
|
|
1899
1898
|
extra: { attitudeKind: "settlers" }
|
|
1900
1899
|
},
|
|
1901
1900
|
{
|
|
@@ -1903,8 +1902,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1903
1902
|
type: "attitude",
|
|
1904
1903
|
label: "Town Planners",
|
|
1905
1904
|
title: "Town Planners region",
|
|
1906
|
-
icon:
|
|
1907
|
-
group:
|
|
1905
|
+
icon: W("townplanners"),
|
|
1906
|
+
group: K,
|
|
1908
1907
|
extra: { attitudeKind: "townplanners" }
|
|
1909
1908
|
},
|
|
1910
1909
|
{
|
|
@@ -1912,8 +1911,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1912
1911
|
type: "accelerator",
|
|
1913
1912
|
label: "Accelerate",
|
|
1914
1913
|
title: "Accelerator",
|
|
1915
|
-
icon:
|
|
1916
|
-
group:
|
|
1914
|
+
icon: U.accelerator,
|
|
1915
|
+
group: K,
|
|
1917
1916
|
extra: { acceleratorDirection: "accelerate" }
|
|
1918
1917
|
},
|
|
1919
1918
|
{
|
|
@@ -1921,8 +1920,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1921
1920
|
type: "accelerator",
|
|
1922
1921
|
label: "Deaccelerate",
|
|
1923
1922
|
title: "Deaccelerator",
|
|
1924
|
-
icon:
|
|
1925
|
-
group:
|
|
1923
|
+
icon: U.deaccelerator,
|
|
1924
|
+
group: K,
|
|
1926
1925
|
extra: { acceleratorDirection: "deaccelerate" }
|
|
1927
1926
|
},
|
|
1928
1927
|
{
|
|
@@ -1930,10 +1929,10 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1930
1929
|
type: "note",
|
|
1931
1930
|
label: "Note",
|
|
1932
1931
|
title: "Note",
|
|
1933
|
-
icon:
|
|
1932
|
+
icon: U.note,
|
|
1934
1933
|
group: "wardley-3-notes"
|
|
1935
1934
|
}
|
|
1936
|
-
],
|
|
1935
|
+
], an = {
|
|
1937
1936
|
__init__: ["wardleyPaletteProvider"],
|
|
1938
1937
|
wardleyPaletteProvider: ["type", class {
|
|
1939
1938
|
create;
|
|
@@ -1955,15 +1954,15 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1955
1954
|
e["lasso-tool"] = {
|
|
1956
1955
|
group: "tools",
|
|
1957
1956
|
title: "Selection tool — L (or Shift+drag)",
|
|
1958
|
-
html: `<div class="entry wardley-palette-entry" title="Selection tool — L (or Shift+drag)">${
|
|
1957
|
+
html: `<div class="entry wardley-palette-entry" title="Selection tool — L (or Shift+drag)">${U.lasso}</div>`,
|
|
1959
1958
|
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
1960
1959
|
}, e["draw-tool"] = {
|
|
1961
1960
|
group: "tools",
|
|
1962
1961
|
title: "Draw — click point by point, double-click/Enter finishes, click the start point to close",
|
|
1963
|
-
html: `<div class="entry wardley-palette-entry" title="Draw — click point by point, double-click/Enter finishes, click the start point to close">${
|
|
1962
|
+
html: `<div class="entry wardley-palette-entry" title="Draw — click point by point, double-click/Enter finishes, click the start point to close">${U.draw}</div>`,
|
|
1964
1963
|
action: { click: () => this.drawTool.toggle() }
|
|
1965
1964
|
};
|
|
1966
|
-
for (let t of
|
|
1965
|
+
for (let t of rn) {
|
|
1967
1966
|
let n = (e) => {
|
|
1968
1967
|
let n = this.factory.createNew(t.type, t.label, t.extra ?? {});
|
|
1969
1968
|
this.create.start(e, n);
|
|
@@ -1981,86 +1980,86 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", an = [
|
|
|
1981
1980
|
return e;
|
|
1982
1981
|
}
|
|
1983
1982
|
}]
|
|
1984
|
-
},
|
|
1983
|
+
}, q = "wardley-element-settings", J = {
|
|
1985
1984
|
id: "type",
|
|
1986
1985
|
name: "Type"
|
|
1987
|
-
},
|
|
1986
|
+
}, Y = {
|
|
1988
1987
|
id: "method",
|
|
1989
1988
|
name: "Sourcing"
|
|
1990
|
-
},
|
|
1989
|
+
}, on = {
|
|
1991
1990
|
id: "props",
|
|
1992
1991
|
name: "Properties"
|
|
1993
1992
|
};
|
|
1994
|
-
function
|
|
1993
|
+
function X(e, t) {
|
|
1995
1994
|
return e ? `✓ ${t}` : t;
|
|
1996
1995
|
}
|
|
1997
|
-
var
|
|
1996
|
+
var sn = class {
|
|
1998
1997
|
modeling;
|
|
1999
1998
|
static $inject = ["popupMenu", "wardleyModeling"];
|
|
2000
1999
|
constructor(e, t) {
|
|
2001
|
-
this.modeling = t, e.registerProvider(
|
|
2000
|
+
this.modeling = t, e.registerProvider(q, this);
|
|
2002
2001
|
}
|
|
2003
2002
|
getPopupMenuEntries(e) {
|
|
2004
2003
|
let t = Array.isArray(e) ? e[0] : e;
|
|
2005
|
-
return
|
|
2004
|
+
return w(t) ? this.componentEntries(t) : {};
|
|
2006
2005
|
}
|
|
2007
2006
|
componentEntries(e) {
|
|
2008
2007
|
let t = e.decorators ?? {}, n = t.ecosystem ? "ecosystem" : t.market ? "market" : "normal", r = t.method;
|
|
2009
2008
|
return {
|
|
2010
2009
|
"type-normal": {
|
|
2011
|
-
label:
|
|
2012
|
-
group:
|
|
2010
|
+
label: X(n === "normal", "Normal"),
|
|
2011
|
+
group: J,
|
|
2013
2012
|
action: () => this.modeling.setMarketEcosystem(e, void 0)
|
|
2014
2013
|
},
|
|
2015
2014
|
"type-market": {
|
|
2016
|
-
label:
|
|
2017
|
-
group:
|
|
2015
|
+
label: X(n === "market", "Market"),
|
|
2016
|
+
group: J,
|
|
2018
2017
|
action: () => this.modeling.setMarketEcosystem(e, "market")
|
|
2019
2018
|
},
|
|
2020
2019
|
"type-ecosystem": {
|
|
2021
|
-
label:
|
|
2022
|
-
group:
|
|
2020
|
+
label: X(n === "ecosystem", "Ecosystem"),
|
|
2021
|
+
group: J,
|
|
2023
2022
|
action: () => this.modeling.setMarketEcosystem(e, "ecosystem")
|
|
2024
2023
|
},
|
|
2025
2024
|
"method-none": {
|
|
2026
|
-
label:
|
|
2027
|
-
group:
|
|
2025
|
+
label: X(!r, "None"),
|
|
2026
|
+
group: Y,
|
|
2028
2027
|
action: () => this.modeling.setMethod(e, void 0)
|
|
2029
2028
|
},
|
|
2030
2029
|
"method-build": {
|
|
2031
|
-
label:
|
|
2032
|
-
group:
|
|
2030
|
+
label: X(r === "build", "Build"),
|
|
2031
|
+
group: Y,
|
|
2033
2032
|
action: () => this.modeling.setMethod(e, "build")
|
|
2034
2033
|
},
|
|
2035
2034
|
"method-buy": {
|
|
2036
|
-
label:
|
|
2037
|
-
group:
|
|
2035
|
+
label: X(r === "buy", "Buy"),
|
|
2036
|
+
group: Y,
|
|
2038
2037
|
action: () => this.modeling.setMethod(e, "buy")
|
|
2039
2038
|
},
|
|
2040
2039
|
"method-outsource": {
|
|
2041
|
-
label:
|
|
2042
|
-
group:
|
|
2040
|
+
label: X(r === "outsource", "Outsource"),
|
|
2041
|
+
group: Y,
|
|
2043
2042
|
action: () => this.modeling.setMethod(e, "outsource")
|
|
2044
2043
|
},
|
|
2045
2044
|
"prop-inertia": {
|
|
2046
|
-
label:
|
|
2047
|
-
group:
|
|
2045
|
+
label: X(!!t.inertia, "Inertia"),
|
|
2046
|
+
group: on,
|
|
2048
2047
|
action: () => this.modeling.toggleInertia(e)
|
|
2049
2048
|
}
|
|
2050
2049
|
};
|
|
2051
2050
|
}
|
|
2052
|
-
},
|
|
2051
|
+
}, cn = {
|
|
2053
2052
|
__init__: ["wardleyElementSettings"],
|
|
2054
|
-
wardleyElementSettings: ["type",
|
|
2053
|
+
wardleyElementSettings: ["type", sn]
|
|
2055
2054
|
};
|
|
2056
2055
|
//#endregion
|
|
2057
2056
|
//#region src/context-pad/WardleyContextPadProvider.ts
|
|
2058
|
-
function
|
|
2059
|
-
return `<div class="entry wardley-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${
|
|
2057
|
+
function Z(e, t, n = !1) {
|
|
2058
|
+
return `<div class="entry wardley-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${dt(e)}</div>`;
|
|
2060
2059
|
}
|
|
2061
2060
|
//#endregion
|
|
2062
2061
|
//#region src/context-pad/index.ts
|
|
2063
|
-
var
|
|
2062
|
+
var ln = {
|
|
2064
2063
|
__init__: ["wardleyContextPadProvider"],
|
|
2065
2064
|
wardleyContextPadProvider: ["type", class {
|
|
2066
2065
|
modeling;
|
|
@@ -2088,24 +2087,24 @@ var un = {
|
|
|
2088
2087
|
this.modeling = t, this.connect = n, this.create = r, this.popupMenu = i, this.wardleyModeling = a, this.labelEditing = o, this.evolveDragging = s, this.factory = c, this.colorPicker = l, e.registerProvider(this);
|
|
2089
2088
|
}
|
|
2090
2089
|
getContextPadEntries(e) {
|
|
2091
|
-
if (
|
|
2090
|
+
if (C(e)) {
|
|
2092
2091
|
let t = e, n = t.wardleyType === "flow";
|
|
2093
2092
|
return {
|
|
2094
2093
|
"edit-value": {
|
|
2095
2094
|
group: "edit",
|
|
2096
2095
|
title: n ? "Edit flow value" : "Edit link annotation",
|
|
2097
|
-
html:
|
|
2096
|
+
html: Z(N, n ? "Edit flow value" : "Edit link annotation"),
|
|
2098
2097
|
action: { click: () => this.labelEditing.activateConnection(t) }
|
|
2099
2098
|
},
|
|
2100
2099
|
delete: {
|
|
2101
2100
|
group: "edit",
|
|
2102
2101
|
title: "Delete connection",
|
|
2103
|
-
html:
|
|
2102
|
+
html: Z(P, "Delete connection"),
|
|
2104
2103
|
action: { click: () => this.modeling.removeElements([e]) }
|
|
2105
2104
|
}
|
|
2106
2105
|
};
|
|
2107
2106
|
}
|
|
2108
|
-
if (!
|
|
2107
|
+
if (!S(e)) return {};
|
|
2109
2108
|
let t = e, n = {};
|
|
2110
2109
|
if (t.wardleyType === "component" || t.wardleyType === "anchor" || t.wardleyType === "submap" || t.wardleyType === "pipeline") {
|
|
2111
2110
|
let e = (e) => {
|
|
@@ -2115,7 +2114,7 @@ var un = {
|
|
|
2115
2114
|
n.append = {
|
|
2116
2115
|
group: "edit",
|
|
2117
2116
|
title: "Append component (auto-connect)",
|
|
2118
|
-
html:
|
|
2117
|
+
html: Z(Ue, "Append component", !0),
|
|
2119
2118
|
action: {
|
|
2120
2119
|
click: e,
|
|
2121
2120
|
dragstart: e
|
|
@@ -2127,7 +2126,7 @@ var un = {
|
|
|
2127
2126
|
n.connect = {
|
|
2128
2127
|
group: "edit",
|
|
2129
2128
|
title: "Connect to existing element",
|
|
2130
|
-
html:
|
|
2129
|
+
html: Z(We, "Connect to existing element", !0),
|
|
2131
2130
|
action: {
|
|
2132
2131
|
click: r,
|
|
2133
2132
|
dragstart: r
|
|
@@ -2138,7 +2137,7 @@ var un = {
|
|
|
2138
2137
|
if (t.movement) n["evolve-clear"] = {
|
|
2139
2138
|
group: "wardley",
|
|
2140
2139
|
title: "Remove evolve",
|
|
2141
|
-
html:
|
|
2140
|
+
html: Z(Ke, "Remove evolve"),
|
|
2142
2141
|
action: { click: () => this.wardleyModeling.clearMovement(t) }
|
|
2143
2142
|
};
|
|
2144
2143
|
else if (t.evolution < .999) {
|
|
@@ -2146,7 +2145,7 @@ var un = {
|
|
|
2146
2145
|
n.evolve = {
|
|
2147
2146
|
group: "wardley",
|
|
2148
2147
|
title: "Evolve: drag to set the target maturity",
|
|
2149
|
-
html:
|
|
2148
|
+
html: Z(Ge, "Evolve: drag to set the target maturity", !0),
|
|
2150
2149
|
action: {
|
|
2151
2150
|
click: e,
|
|
2152
2151
|
dragstart: e
|
|
@@ -2156,10 +2155,10 @@ var un = {
|
|
|
2156
2155
|
n.settings = {
|
|
2157
2156
|
group: "wardley",
|
|
2158
2157
|
title: "Settings (type, sourcing, inertia)",
|
|
2159
|
-
html:
|
|
2158
|
+
html: Z(nt, "Settings"),
|
|
2160
2159
|
action: { click: (e) => {
|
|
2161
2160
|
let n = e;
|
|
2162
|
-
this.popupMenu.open(t,
|
|
2161
|
+
this.popupMenu.open(t, q, {
|
|
2163
2162
|
x: n.clientX,
|
|
2164
2163
|
y: n.clientY
|
|
2165
2164
|
});
|
|
@@ -2171,14 +2170,14 @@ var un = {
|
|
|
2171
2170
|
n["stroke-style"] = {
|
|
2172
2171
|
group: "wardley",
|
|
2173
2172
|
title: r,
|
|
2174
|
-
html:
|
|
2173
|
+
html: Z(ot, r),
|
|
2175
2174
|
action: { click: () => this.wardleyModeling.updateProperties(t, { strokeStyle: e }) }
|
|
2176
2175
|
};
|
|
2177
2176
|
}
|
|
2178
2177
|
n.color = {
|
|
2179
2178
|
group: "wardley",
|
|
2180
2179
|
title: "Color",
|
|
2181
|
-
html:
|
|
2180
|
+
html: Z(rt, "Color"),
|
|
2182
2181
|
action: { click: (e) => {
|
|
2183
2182
|
let n = e;
|
|
2184
2183
|
this.colorPicker.open(t, n.clientX, n.clientY);
|
|
@@ -2188,17 +2187,17 @@ var un = {
|
|
|
2188
2187
|
return i && (n["open-link"] = {
|
|
2189
2188
|
group: "wardley",
|
|
2190
2189
|
title: `Open link (${i})`,
|
|
2191
|
-
html:
|
|
2190
|
+
html: Z(We, "Open link"),
|
|
2192
2191
|
action: { click: () => window.open(i, "_blank", "noopener") }
|
|
2193
2192
|
}), t.wardleyType !== "drawing" && (n["edit-label"] = {
|
|
2194
2193
|
group: "edit",
|
|
2195
2194
|
title: "Edit label",
|
|
2196
|
-
html:
|
|
2195
|
+
html: Z(N, "Edit label"),
|
|
2197
2196
|
action: { click: () => this.labelEditing.activate(t) }
|
|
2198
2197
|
}), n.delete = {
|
|
2199
2198
|
group: "edit",
|
|
2200
2199
|
title: "Delete",
|
|
2201
|
-
html:
|
|
2200
|
+
html: Z(P, "Delete"),
|
|
2202
2201
|
action: { click: () => this.modeling.removeElements([t]) }
|
|
2203
2202
|
}, n;
|
|
2204
2203
|
}
|
|
@@ -2206,10 +2205,10 @@ var un = {
|
|
|
2206
2205
|
};
|
|
2207
2206
|
//#endregion
|
|
2208
2207
|
//#region src/label-editing/WardleyLabelEditing.ts
|
|
2209
|
-
function
|
|
2208
|
+
function un(e) {
|
|
2210
2209
|
return e.replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
2211
2210
|
}
|
|
2212
|
-
var
|
|
2211
|
+
var dn = class {
|
|
2213
2212
|
canvas;
|
|
2214
2213
|
modeling;
|
|
2215
2214
|
factory;
|
|
@@ -2222,7 +2221,7 @@ var fn = class {
|
|
|
2222
2221
|
active = null;
|
|
2223
2222
|
constructor(e, t, n, r) {
|
|
2224
2223
|
this.canvas = t, this.modeling = n, this.factory = r, e.on("element.dblclick", (e) => {
|
|
2225
|
-
|
|
2224
|
+
S(e.element) ? this.activate(e.element) : C(e.element) && this.activateConnection(e.element);
|
|
2226
2225
|
}), e.on([
|
|
2227
2226
|
"element.mousedown",
|
|
2228
2227
|
"drag.init",
|
|
@@ -2241,7 +2240,7 @@ var fn = class {
|
|
|
2241
2240
|
c || (c = !0, s.removeEventListener("keydown", d), s.removeEventListener("blur", f), s.remove(), this.active = null);
|
|
2242
2241
|
}, u = () => {
|
|
2243
2242
|
if (c) return;
|
|
2244
|
-
let t =
|
|
2243
|
+
let t = un(s.value), n = t && t !== e.wardleyLabel;
|
|
2245
2244
|
if (l(), !n) return;
|
|
2246
2245
|
let r = i ? t : this.factory.uniqueLabel(t, e.id);
|
|
2247
2246
|
this.modeling.updateLabel(e, r);
|
|
@@ -2296,10 +2295,10 @@ var fn = class {
|
|
|
2296
2295
|
cancel() {
|
|
2297
2296
|
this.active?.cleanup();
|
|
2298
2297
|
}
|
|
2299
|
-
},
|
|
2298
|
+
}, fn = {
|
|
2300
2299
|
__init__: ["wardleyLabelEditing"],
|
|
2301
|
-
wardleyLabelEditing: ["type",
|
|
2302
|
-
},
|
|
2300
|
+
wardleyLabelEditing: ["type", dn]
|
|
2301
|
+
}, pn = 2, mn = 10, hn = {
|
|
2303
2302
|
arrowleft: {
|
|
2304
2303
|
x: -1,
|
|
2305
2304
|
y: 0
|
|
@@ -2316,7 +2315,7 @@ var fn = class {
|
|
|
2316
2315
|
x: 0,
|
|
2317
2316
|
y: 1
|
|
2318
2317
|
}
|
|
2319
|
-
},
|
|
2318
|
+
}, gn = class {
|
|
2320
2319
|
static $inject = [
|
|
2321
2320
|
"canvas",
|
|
2322
2321
|
"commandStack",
|
|
@@ -2333,7 +2332,7 @@ var fn = class {
|
|
|
2333
2332
|
let u = e.getContainer();
|
|
2334
2333
|
u.hasAttribute("tabindex") || u.setAttribute("tabindex", "0");
|
|
2335
2334
|
let d = (e) => {
|
|
2336
|
-
if (
|
|
2335
|
+
if (_n(e.target)) return;
|
|
2337
2336
|
let l = e.ctrlKey || e.metaKey, u = e.key.toLowerCase();
|
|
2338
2337
|
if (l && u === "z" && !e.shiftKey) e.preventDefault(), t.undo();
|
|
2339
2338
|
else if (l && u === "z" && e.shiftKey || l && u === "y") e.preventDefault(), t.redo();
|
|
@@ -2354,11 +2353,11 @@ var fn = class {
|
|
|
2354
2353
|
e.preventDefault();
|
|
2355
2354
|
let t = s.getLastMoveEvent();
|
|
2356
2355
|
c.activateSelection(t ?? e, !!t);
|
|
2357
|
-
} else if (u in
|
|
2356
|
+
} else if (u in hn && !l) {
|
|
2358
2357
|
let t = n.get();
|
|
2359
2358
|
if (t.length) {
|
|
2360
2359
|
e.preventDefault();
|
|
2361
|
-
let n = e.shiftKey ?
|
|
2360
|
+
let n = e.shiftKey ? mn : pn, i = hn[u];
|
|
2362
2361
|
r.moveElements(t, {
|
|
2363
2362
|
x: i.x * n,
|
|
2364
2363
|
y: i.y * n
|
|
@@ -2369,21 +2368,21 @@ var fn = class {
|
|
|
2369
2368
|
document.addEventListener("keydown", d), l.on("diagram.destroy", () => document.removeEventListener("keydown", d));
|
|
2370
2369
|
}
|
|
2371
2370
|
};
|
|
2372
|
-
function
|
|
2371
|
+
function _n(e) {
|
|
2373
2372
|
if (!(e instanceof HTMLElement)) return !1;
|
|
2374
2373
|
let t = e.tagName;
|
|
2375
2374
|
return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
|
|
2376
2375
|
}
|
|
2377
2376
|
//#endregion
|
|
2378
2377
|
//#region src/keyboard/index.ts
|
|
2379
|
-
var
|
|
2378
|
+
var vn = {
|
|
2380
2379
|
__init__: ["wardleyKeyboard"],
|
|
2381
|
-
wardleyKeyboard: ["type",
|
|
2382
|
-
},
|
|
2383
|
-
function
|
|
2380
|
+
wardleyKeyboard: ["type", gn]
|
|
2381
|
+
}, Q = "wardley.evolve", yn = .005, bn = "wardley-evolve-handle";
|
|
2382
|
+
function xn(e) {
|
|
2384
2383
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2385
2384
|
}
|
|
2386
|
-
var
|
|
2385
|
+
var Sn = class {
|
|
2387
2386
|
dragging;
|
|
2388
2387
|
static $inject = [
|
|
2389
2388
|
"eventBus",
|
|
@@ -2399,33 +2398,33 @@ var Cn = class {
|
|
|
2399
2398
|
n === void 0 ? delete t.movement : t.movement = n, e.fire("element.changed", { element: t });
|
|
2400
2399
|
}, s = (e, t) => {
|
|
2401
2400
|
let r = i.getContainer().getBoundingClientRect(), a = i.viewbox(), o = a.x + (e - r.left) * (a.width / r.width);
|
|
2402
|
-
return
|
|
2401
|
+
return xn(n.fromCanvas({
|
|
2403
2402
|
x: o,
|
|
2404
2403
|
y: t
|
|
2405
2404
|
}).evolution);
|
|
2406
2405
|
};
|
|
2407
2406
|
i.getContainer().addEventListener("mousedown", (e) => {
|
|
2408
2407
|
let t = e.target;
|
|
2409
|
-
if (!t?.closest(`.${
|
|
2408
|
+
if (!t?.closest(`.${bn}`)) return;
|
|
2410
2409
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), i = n ? a.get(n) : void 0;
|
|
2411
2410
|
if (!i || i.wardleyType !== "component") return;
|
|
2412
2411
|
e.stopPropagation(), e.preventDefault();
|
|
2413
2412
|
let c = i.movement, l = i.y + i.height / 2, u, d = (e) => {
|
|
2414
2413
|
u = s(e.clientX, l), o(i, { targetEvolution: u });
|
|
2415
2414
|
}, f = () => {
|
|
2416
|
-
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", f), o(i, c), u !== void 0 && Math.abs(u - i.evolution) >
|
|
2415
|
+
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", f), o(i, c), u !== void 0 && Math.abs(u - i.evolution) > yn && r.evolveComponent(i, u);
|
|
2417
2416
|
};
|
|
2418
2417
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", f);
|
|
2419
|
-
}, !0), e.on(`${
|
|
2420
|
-
let { shape: t } = e.context, r = t.y + t.height / 2, i =
|
|
2418
|
+
}, !0), e.on(`${Q}.move`, (e) => {
|
|
2419
|
+
let { shape: t } = e.context, r = t.y + t.height / 2, i = xn(n.fromCanvas({
|
|
2421
2420
|
x: e.x,
|
|
2422
2421
|
y: r
|
|
2423
2422
|
}).evolution);
|
|
2424
2423
|
e.context.target = i, o(t, { targetEvolution: i });
|
|
2425
|
-
}), e.on(`${
|
|
2424
|
+
}), e.on(`${Q}.end`, (e) => {
|
|
2426
2425
|
let t = e.context, { shape: n, target: i } = t;
|
|
2427
|
-
o(n, t.originalMovement), i !== void 0 && Math.abs(i - n.evolution) >
|
|
2428
|
-
}), e.on(`${
|
|
2426
|
+
o(n, t.originalMovement), i !== void 0 && Math.abs(i - n.evolution) > yn && r.evolveComponent(n, i), t.committed = !0;
|
|
2427
|
+
}), e.on(`${Q}.cleanup`, (e) => {
|
|
2429
2428
|
let t = e.context;
|
|
2430
2429
|
t && !t.committed && o(t.shape, t.originalMovement);
|
|
2431
2430
|
});
|
|
@@ -2435,15 +2434,15 @@ var Cn = class {
|
|
|
2435
2434
|
shape: t,
|
|
2436
2435
|
...t.movement ? { originalMovement: t.movement } : {}
|
|
2437
2436
|
};
|
|
2438
|
-
this.dragging.init(e,
|
|
2437
|
+
this.dragging.init(e, Q, {
|
|
2439
2438
|
cursor: "ew-resize",
|
|
2440
2439
|
data: { context: n }
|
|
2441
2440
|
});
|
|
2442
2441
|
}
|
|
2443
|
-
},
|
|
2442
|
+
}, Cn = {
|
|
2444
2443
|
__init__: ["wardleyEvolveDragging"],
|
|
2445
|
-
wardleyEvolveDragging: ["type",
|
|
2446
|
-
},
|
|
2444
|
+
wardleyEvolveDragging: ["type", Sn]
|
|
2445
|
+
}, wn = 500, Tn = class {
|
|
2447
2446
|
static $inject = ["injector", "eventBus"];
|
|
2448
2447
|
constructor(e, t) {
|
|
2449
2448
|
let n = e.get("connectionPreview", !1), r = e.get("wardleyLabelEditing", !1);
|
|
@@ -2468,18 +2467,18 @@ var Cn = class {
|
|
|
2468
2467
|
"create.cleanup"
|
|
2469
2468
|
], (e) => {
|
|
2470
2469
|
n.cleanUp(e.context);
|
|
2471
|
-
})), r && t.on("create.end",
|
|
2470
|
+
})), r && t.on("create.end", wn, (e) => {
|
|
2472
2471
|
let { context: t } = e;
|
|
2473
2472
|
if (!t.source || !t.canExecute || !t.shape) return;
|
|
2474
2473
|
let n = t.shape;
|
|
2475
2474
|
setTimeout(() => r.activate(n), 0);
|
|
2476
2475
|
});
|
|
2477
2476
|
}
|
|
2478
|
-
},
|
|
2479
|
-
__depends__: [
|
|
2477
|
+
}, En = {
|
|
2478
|
+
__depends__: [ve],
|
|
2480
2479
|
__init__: ["wardleyAppendBehavior"],
|
|
2481
|
-
wardleyAppendBehavior: ["type",
|
|
2482
|
-
},
|
|
2480
|
+
wardleyAppendBehavior: ["type", Tn]
|
|
2481
|
+
}, Dn = class {
|
|
2483
2482
|
canvas;
|
|
2484
2483
|
modeling;
|
|
2485
2484
|
static $inject = [
|
|
@@ -2509,7 +2508,7 @@ var Cn = class {
|
|
|
2509
2508
|
value: void 0,
|
|
2510
2509
|
title: "No color",
|
|
2511
2510
|
cls: "wardley-cp-none"
|
|
2512
|
-
}, ...
|
|
2511
|
+
}, ...Se.map((e) => ({
|
|
2513
2512
|
value: e.value,
|
|
2514
2513
|
title: e.name,
|
|
2515
2514
|
cls: ""
|
|
@@ -2531,27 +2530,27 @@ var Cn = class {
|
|
|
2531
2530
|
}
|
|
2532
2531
|
}, On = {
|
|
2533
2532
|
__init__: ["wardleyColorPicker"],
|
|
2534
|
-
wardleyColorPicker: ["type",
|
|
2533
|
+
wardleyColorPicker: ["type", Dn]
|
|
2535
2534
|
};
|
|
2536
2535
|
//#endregion
|
|
2537
2536
|
//#region src/ordering/WardleyOrderingProvider.ts
|
|
2538
2537
|
function $(e) {
|
|
2539
|
-
return
|
|
2538
|
+
return S(e) && (e.wardleyType === "attitude" || e.wardleyType === "pipeline");
|
|
2540
2539
|
}
|
|
2541
2540
|
//#endregion
|
|
2542
2541
|
//#region src/ordering/index.ts
|
|
2543
2542
|
var kn = {
|
|
2544
2543
|
__init__: ["wardleyOrderingProvider"],
|
|
2545
|
-
wardleyOrderingProvider: ["type", class extends
|
|
2544
|
+
wardleyOrderingProvider: ["type", class extends ye {
|
|
2546
2545
|
static $inject = ["eventBus"];
|
|
2547
2546
|
constructor(e) {
|
|
2548
2547
|
super(e);
|
|
2549
2548
|
}
|
|
2550
2549
|
getOrdering(e, t) {
|
|
2551
2550
|
let n = t.children ?? [];
|
|
2552
|
-
return
|
|
2551
|
+
return C(e) ? {
|
|
2553
2552
|
parent: t,
|
|
2554
|
-
index: n.filter((t) => t !== e && ($(t) ||
|
|
2553
|
+
index: n.filter((t) => t !== e && ($(t) || C(t))).length
|
|
2555
2554
|
} : $(e) ? {
|
|
2556
2555
|
parent: t,
|
|
2557
2556
|
index: n.filter((t) => t !== e && $(t)).length
|
|
@@ -2657,39 +2656,39 @@ var kn = {
|
|
|
2657
2656
|
};
|
|
2658
2657
|
renderPreview() {
|
|
2659
2658
|
if (this.clearPreview(), !this.points.length) return;
|
|
2660
|
-
let e = this.canvas.getLayer("wardley-draw-preview", 1e3), t =
|
|
2661
|
-
|
|
2659
|
+
let e = this.canvas.getLayer("wardley-draw-preview", 1e3), t = p("g"), n = this.cursor ? [...this.points, this.cursor] : this.points;
|
|
2660
|
+
u(t, d(p("polyline"), {
|
|
2662
2661
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2663
2662
|
fill: "none",
|
|
2664
|
-
stroke:
|
|
2663
|
+
stroke: y.ink,
|
|
2665
2664
|
"stroke-width": 2,
|
|
2666
2665
|
"stroke-linecap": "round",
|
|
2667
2666
|
"stroke-linejoin": "round",
|
|
2668
2667
|
"stroke-dasharray": "5 4"
|
|
2669
2668
|
}));
|
|
2670
2669
|
let r = this.points[0];
|
|
2671
|
-
if (
|
|
2670
|
+
if (u(t, d(p("circle"), {
|
|
2672
2671
|
cx: r.x,
|
|
2673
2672
|
cy: r.y,
|
|
2674
2673
|
r: this.points.length >= 3 ? 5 : 3,
|
|
2675
|
-
fill:
|
|
2676
|
-
stroke:
|
|
2674
|
+
fill: y.paper,
|
|
2675
|
+
stroke: y.ink,
|
|
2677
2676
|
"stroke-width": 1.5
|
|
2678
2677
|
})), this.points.length >= 2) {
|
|
2679
2678
|
let e = this.points[this.points.length - 1];
|
|
2680
|
-
|
|
2679
|
+
u(t, d(p("circle"), {
|
|
2681
2680
|
cx: e.x,
|
|
2682
2681
|
cy: e.y,
|
|
2683
2682
|
r: 5,
|
|
2684
|
-
fill:
|
|
2685
|
-
stroke:
|
|
2683
|
+
fill: y.paper,
|
|
2684
|
+
stroke: y.ink,
|
|
2686
2685
|
"stroke-width": 1.5
|
|
2687
2686
|
}));
|
|
2688
2687
|
}
|
|
2689
|
-
|
|
2688
|
+
u(e, t), this.layer = t;
|
|
2690
2689
|
}
|
|
2691
2690
|
clearPreview() {
|
|
2692
|
-
this.layer &&= (
|
|
2691
|
+
this.layer &&= (m(this.layer), null);
|
|
2693
2692
|
}
|
|
2694
2693
|
};
|
|
2695
2694
|
function Mn(e, t) {
|
|
@@ -2714,7 +2713,7 @@ var Nn = class {
|
|
|
2714
2713
|
constructor(e, t, n, r) {
|
|
2715
2714
|
this.eventBus = e, this.canvas = t, this.modeling = n, this.grid = r, e.on("selection.changed", (e) => {
|
|
2716
2715
|
let t = e.newSelection ?? [], n = t.length === 1 ? t[0] : null;
|
|
2717
|
-
this.attach(
|
|
2716
|
+
this.attach(S(n) && n.wardleyType === "drawing" ? n : null);
|
|
2718
2717
|
}), e.on("element.changed", (e) => {
|
|
2719
2718
|
this.shape && e.element === this.shape && this.render();
|
|
2720
2719
|
}), e.on(["diagram.clear", "diagram.destroy"], () => this.attach(null));
|
|
@@ -2731,19 +2730,19 @@ var Nn = class {
|
|
|
2731
2730
|
}
|
|
2732
2731
|
render() {
|
|
2733
2732
|
if (this.clear(), !this.shape) return;
|
|
2734
|
-
let e = this.canvas.getLayer("wardley-drawing-handles", 1100), t =
|
|
2733
|
+
let e = this.canvas.getLayer("wardley-drawing-handles", 1100), t = p("g");
|
|
2735
2734
|
this.absolutePoints().forEach((e, n) => {
|
|
2736
|
-
let r =
|
|
2735
|
+
let r = d(p("circle"), {
|
|
2737
2736
|
cx: e.x,
|
|
2738
2737
|
cy: e.y,
|
|
2739
2738
|
r: 5,
|
|
2740
|
-
fill:
|
|
2741
|
-
stroke:
|
|
2739
|
+
fill: y.paper,
|
|
2740
|
+
stroke: y.ink,
|
|
2742
2741
|
"stroke-width": 1.5,
|
|
2743
2742
|
class: "wardley-drawing-handle"
|
|
2744
2743
|
});
|
|
2745
|
-
r.addEventListener("mousedown", (e) => this.startDrag(e, n)),
|
|
2746
|
-
}),
|
|
2744
|
+
r.addEventListener("mousedown", (e) => this.startDrag(e, n)), u(t, r);
|
|
2745
|
+
}), u(e, t), this.group = t;
|
|
2747
2746
|
}
|
|
2748
2747
|
startDrag(e, t) {
|
|
2749
2748
|
if (e.button !== 0 || !this.shape) return;
|
|
@@ -2772,21 +2771,21 @@ var Nn = class {
|
|
|
2772
2771
|
}
|
|
2773
2772
|
renderDragPreview(e, t) {
|
|
2774
2773
|
this.clearDragPreview();
|
|
2775
|
-
let n = this.canvas.getLayer("wardley-drawing-handles", 1100), r =
|
|
2774
|
+
let n = this.canvas.getLayer("wardley-drawing-handles", 1100), r = d(p(t ? "polygon" : "polyline"), {
|
|
2776
2775
|
points: e.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2777
2776
|
fill: "none",
|
|
2778
|
-
stroke:
|
|
2777
|
+
stroke: y.ink,
|
|
2779
2778
|
"stroke-width": 1.5,
|
|
2780
2779
|
"stroke-dasharray": "5 4",
|
|
2781
2780
|
"pointer-events": "none"
|
|
2782
2781
|
});
|
|
2783
|
-
|
|
2782
|
+
u(n, r), this.dragPreview = r;
|
|
2784
2783
|
}
|
|
2785
2784
|
clearDragPreview() {
|
|
2786
|
-
this.dragPreview &&= (
|
|
2785
|
+
this.dragPreview &&= (m(this.dragPreview), null);
|
|
2787
2786
|
}
|
|
2788
2787
|
clear() {
|
|
2789
|
-
this.clearDragPreview(), this.group &&= (
|
|
2788
|
+
this.clearDragPreview(), this.group &&= (m(this.group), null);
|
|
2790
2789
|
}
|
|
2791
2790
|
toCanvasPoint(e) {
|
|
2792
2791
|
let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = this.canvas.zoom();
|
|
@@ -2799,28 +2798,28 @@ var Nn = class {
|
|
|
2799
2798
|
//#endregion
|
|
2800
2799
|
//#region src/draw-tool/WardleyDrawingHitProvider.ts
|
|
2801
2800
|
function Pn(e) {
|
|
2802
|
-
return
|
|
2801
|
+
return S(e) && e.wardleyType === "drawing";
|
|
2803
2802
|
}
|
|
2804
2803
|
var Fn = class {
|
|
2805
2804
|
static $inject = ["eventBus", "interactionEvents"];
|
|
2806
2805
|
constructor(e, t) {
|
|
2807
2806
|
e.on("interactionEvents.createHit", (e) => {
|
|
2808
|
-
if (
|
|
2807
|
+
if (Pn(e.element) && e.gfx) return In(e.element, e.gfx), !1;
|
|
2809
2808
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
2810
|
-
if (
|
|
2809
|
+
if (Pn(e.element) && e.gfx) return t.removeHits(e.gfx), In(e.element, e.gfx), !1;
|
|
2811
2810
|
});
|
|
2812
2811
|
}
|
|
2813
2812
|
};
|
|
2814
2813
|
function In(e, t) {
|
|
2815
|
-
let n = e.drawingPoints ?? [], r =
|
|
2816
|
-
|
|
2814
|
+
let n = e.drawingPoints ?? [], r = p(e.closed ? "polygon" : "polyline");
|
|
2815
|
+
d(r, {
|
|
2817
2816
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2818
2817
|
class: "djs-hit djs-hit-stroke",
|
|
2819
2818
|
fill: "none",
|
|
2820
2819
|
stroke: "white",
|
|
2821
2820
|
"stroke-width": 15,
|
|
2822
2821
|
"stroke-opacity": 0
|
|
2823
|
-
}),
|
|
2822
|
+
}), u(t, r);
|
|
2824
2823
|
}
|
|
2825
2824
|
//#endregion
|
|
2826
2825
|
//#region src/draw-tool/index.ts
|
|
@@ -2838,28 +2837,29 @@ var Ln = {
|
|
|
2838
2837
|
return [
|
|
2839
2838
|
...super._getModules(),
|
|
2840
2839
|
oe,
|
|
2841
|
-
|
|
2840
|
+
O,
|
|
2841
|
+
de,
|
|
2842
2842
|
se,
|
|
2843
|
+
h,
|
|
2843
2844
|
ce,
|
|
2844
2845
|
le,
|
|
2845
2846
|
ue,
|
|
2846
|
-
|
|
2847
|
+
fe,
|
|
2847
2848
|
pe,
|
|
2848
2849
|
me,
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
on,
|
|
2855
|
-
un,
|
|
2856
|
-
pn,
|
|
2857
|
-
yn,
|
|
2858
|
-
wn,
|
|
2850
|
+
Yt,
|
|
2851
|
+
en,
|
|
2852
|
+
He,
|
|
2853
|
+
nn,
|
|
2854
|
+
an,
|
|
2859
2855
|
ln,
|
|
2860
|
-
|
|
2856
|
+
fn,
|
|
2857
|
+
vn,
|
|
2858
|
+
Cn,
|
|
2859
|
+
cn,
|
|
2860
|
+
En,
|
|
2861
2861
|
On,
|
|
2862
|
-
|
|
2862
|
+
Xt,
|
|
2863
2863
|
kn,
|
|
2864
2864
|
Ln
|
|
2865
2865
|
];
|
|
@@ -2878,6 +2878,6 @@ var Ln = {
|
|
|
2878
2878
|
}
|
|
2879
2879
|
};
|
|
2880
2880
|
//#endregion
|
|
2881
|
-
export {
|
|
2881
|
+
export { y as COLORS, Pe as EvolutionGrid, lt as ICON_ADD, st as ICON_ASPECT_RATIO, Xe as ICON_CODE, Ye as ICON_DATA_OBJECT, P as ICON_DELETE, Ze as ICON_DOWNLOAD, N as ICON_EDIT, $e as ICON_FOLDER_OPEN, et as ICON_IMAGE, ct as ICON_MENU, tt as ICON_NEW, M as ICON_PERSON, Je as ICON_REDO, Qe as ICON_SHARE, qe as ICON_UNDO, ut as ICON_VISIBILITY, g as MIRAGON, Rn as Modeler, Se as NOTE_COLORS, It as NavigatedViewer, _ as PLOT, q as POPUP_PROVIDER_ID, Pt as PanConstraint, Ft as PanConstraintModule, we as ROOT_ID, Dt as Viewer, Tn as WardleyAppendBehavior, Ee as WardleyBaseViewer, Dn as WardleyColorPicker, Ae as WardleyElementFactory, sn as WardleyElementSettingsProvider, Sn as WardleyEvolveDragging, Tt as WardleyExporter, wt as WardleyImporter, dn as WardleyLabelEditing, D as WardleyLayouter, Vt as WardleyModeling, pt as WardleyRenderer, $t as WardleyRules, He as evolutionConstraintModule, j as evolutionGridModule, dt as iconMarkup, Et as ioModule, w as isComponent, T as isPipeline, C as isWardleyConnection, S as isWardleyShape, fn as labelEditingModule, Ce as saveSVG, nn as stageSnappingModule, En as wardleyAppendModule, On as wardleyColorPickerModule, ln as wardleyContextPadModule, xt as wardleyDrawModule, Cn as wardleyEvolveModule, vn as wardleyKeyboardModule, O as wardleyLayoutModule, je as wardleyModelModule, Yt as wardleyModelingModule, an as wardleyPaletteModule, cn as wardleyPopupModule, en as wardleyRulesModule };
|
|
2882
2882
|
|
|
2883
2883
|
//# sourceMappingURL=index.js.map
|