@miragon/wardley-renderer 0.6.2 → 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 +467 -468
- 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 +8 -8
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,7 +11,7 @@ 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 h from "diagram-js/lib/features/create";
|
|
14
15
|
import ce from "diagram-js/lib/features/connect";
|
|
15
16
|
import le from "diagram-js/lib/features/context-pad";
|
|
16
17
|
import ue from "diagram-js/lib/features/palette";
|
|
@@ -24,7 +25,7 @@ import _e from "diagram-js/lib/features/rules/RuleProvider";
|
|
|
24
25
|
import ve from "diagram-js/lib/features/connection-preview";
|
|
25
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,10 +40,10 @@ var h = {
|
|
|
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,
|
|
@@ -53,7 +54,7 @@ var g = {
|
|
|
53
54
|
width: 480,
|
|
54
55
|
height: 320
|
|
55
56
|
}, xe = 7.5;
|
|
56
|
-
function
|
|
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,
|
|
@@ -61,29 +62,29 @@ function _(e) {
|
|
|
61
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
|
+
deaccelerator: g.danger
|
|
87
88
|
}, Se = [
|
|
88
89
|
{
|
|
89
90
|
id: "green",
|
|
@@ -125,7 +126,7 @@ var v = {
|
|
|
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 v = {
|
|
|
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,
|
|
@@ -152,8 +153,8 @@ function Ce(e, t) {
|
|
|
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");
|
|
@@ -280,7 +281,49 @@ var Ee = 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;
|
|
@@ -325,7 +368,7 @@ var Ee = class {
|
|
|
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 Ee = 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,
|
|
@@ -506,7 +549,7 @@ var Ee = 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 Ee = class {
|
|
|
514
557
|
businessObject: t
|
|
515
558
|
});
|
|
516
559
|
}
|
|
517
|
-
};
|
|
518
|
-
function
|
|
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 x(e) {
|
|
530
|
-
return typeof e == "object" && !!e;
|
|
531
|
-
}
|
|
532
|
-
function S(e) {
|
|
533
|
-
return x(e) && typeof e.wardleyType == "string" && "evolution" in e;
|
|
534
|
-
}
|
|
535
|
-
function C(e) {
|
|
536
|
-
return x(e) && typeof e.wardleyType == "string" && "waypoints" in e;
|
|
537
|
-
}
|
|
538
|
-
function w(e) {
|
|
539
|
-
return S(e) && e.wardleyType === "component";
|
|
540
|
-
}
|
|
541
|
-
function T(e) {
|
|
542
|
-
return S(e) && e.wardleyType === "pipeline";
|
|
543
|
-
}
|
|
544
|
-
function ke(e) {
|
|
545
|
-
return S(e) && e.wardleyType === "attitude";
|
|
546
|
-
}
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region src/model/index.ts
|
|
549
|
-
var E = { wardleyElementFactory: ["type", De] }, Ae = "wardley-axes";
|
|
550
|
-
function D(e) {
|
|
560
|
+
}, je = { wardleyElementFactory: ["type", Ae] }, Me = "wardley-axes";
|
|
561
|
+
function Ne(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 O = 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 O = 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
|
-
})),
|
|
646
|
+
})), u(e, k(t, i, t, n - 10, { stroke: y.axis })), u(e, Ie(t, n - 10, "up"));
|
|
636
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,
|
|
@@ -661,7 +672,7 @@ function je(e, t, n, r, i) {
|
|
|
661
672
|
});
|
|
662
673
|
}
|
|
663
674
|
function k(e, t, n, r, i) {
|
|
664
|
-
return
|
|
675
|
+
return d(p("line"), {
|
|
665
676
|
x1: e,
|
|
666
677
|
y1: t,
|
|
667
678
|
x2: n,
|
|
@@ -671,43 +682,45 @@ function k(e, t, n, r, i) {
|
|
|
671
682
|
});
|
|
672
683
|
}
|
|
673
684
|
function A(e, t, n, r) {
|
|
674
|
-
let i =
|
|
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,
|
|
@@ -718,11 +731,11 @@ var Ne = [
|
|
|
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;
|
|
@@ -742,8 +755,8 @@ var Ne = [
|
|
|
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
|
|
@@ -803,37 +816,37 @@ var Ne = [
|
|
|
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 j = { evolutionGrid: ["type",
|
|
831
|
+
var j = { evolutionGrid: ["type", Pe] }, He = {
|
|
819
832
|
__init__: ["evolutionConstraintBehavior"],
|
|
820
|
-
__depends__: [j],
|
|
821
|
-
evolutionConstraintBehavior: ["type",
|
|
822
|
-
}, 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",
|
|
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
|
|
849
|
+
var ft = 1500, pt = class extends te {
|
|
837
850
|
grid;
|
|
838
851
|
elementRegistry;
|
|
839
852
|
static $inject = [
|
|
@@ -842,7 +855,7 @@ var lt = 1500, ut = class extends te {
|
|
|
842
855
|
"elementRegistry"
|
|
843
856
|
];
|
|
844
857
|
constructor(e, t, n) {
|
|
845
|
-
super(e,
|
|
858
|
+
super(e, ft), this.grid = t, this.elementRegistry = n;
|
|
846
859
|
}
|
|
847
860
|
canRender(e) {
|
|
848
861
|
return S(e) || C(e);
|
|
@@ -862,36 +875,36 @@ var lt = 1500, ut = 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 lt = 1500, ut = 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 lt = 1500, ut = 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 =
|
|
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 lt = 1500, ut = 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 lt = 1500, ut = 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 lt = 1500, ut = 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 ft(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,43 +1119,34 @@ function mt(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
|
|
1146
|
+
function vt(e) {
|
|
1134
1147
|
return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
|
|
1135
1148
|
}
|
|
1136
|
-
function
|
|
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
|
-
};
|
|
1144
|
-
}
|
|
1145
|
-
function _t(e) {
|
|
1149
|
+
function yt(e) {
|
|
1146
1150
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
1147
1151
|
if (!t || !n) {
|
|
1148
1152
|
let e = r[0] ?? {
|
|
@@ -1151,7 +1155,7 @@ function _t(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
|
|
@@ -1160,15 +1164,15 @@ function _t(e) {
|
|
|
1160
1164
|
y: a.y - u * f
|
|
1161
1165
|
}];
|
|
1162
1166
|
}
|
|
1163
|
-
function
|
|
1167
|
+
function bt(e) {
|
|
1164
1168
|
return e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
1165
1169
|
}
|
|
1166
1170
|
//#endregion
|
|
1167
1171
|
//#region src/draw/index.ts
|
|
1168
|
-
var
|
|
1172
|
+
var xt = {
|
|
1169
1173
|
__init__: ["wardleyRenderer"],
|
|
1170
|
-
wardleyRenderer: ["type",
|
|
1171
|
-
},
|
|
1174
|
+
wardleyRenderer: ["type", pt]
|
|
1175
|
+
}, St = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ct = {
|
|
1172
1176
|
attitude: 0,
|
|
1173
1177
|
pipeline: 1,
|
|
1174
1178
|
note: 2,
|
|
@@ -1177,7 +1181,7 @@ var yt = {
|
|
|
1177
1181
|
annotation: 5,
|
|
1178
1182
|
submap: 3,
|
|
1179
1183
|
accelerator: 3
|
|
1180
|
-
},
|
|
1184
|
+
}, wt = class {
|
|
1181
1185
|
canvas;
|
|
1182
1186
|
elementFactory;
|
|
1183
1187
|
factory;
|
|
@@ -1209,7 +1213,7 @@ var yt = {
|
|
|
1209
1213
|
}
|
|
1210
1214
|
let i;
|
|
1211
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
|
-
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (
|
|
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);
|
|
1215
1219
|
t && (this.canvas.addShape(t, i), a.set(e.id, t), l++);
|
|
@@ -1261,12 +1265,12 @@ var yt = {
|
|
|
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;
|
|
1268
1272
|
}
|
|
1269
|
-
var
|
|
1273
|
+
var Tt = class {
|
|
1270
1274
|
elementRegistry;
|
|
1271
1275
|
canvas;
|
|
1272
1276
|
grid;
|
|
@@ -1331,7 +1335,7 @@ var Ct = class {
|
|
|
1331
1335
|
evolution: e.evolution
|
|
1332
1336
|
}, n = e.businessObject;
|
|
1333
1337
|
switch (e.wardleyType) {
|
|
1334
|
-
case "component": return
|
|
1338
|
+
case "component": return z({
|
|
1335
1339
|
id: e.id,
|
|
1336
1340
|
elementType: "component",
|
|
1337
1341
|
label: e.wardleyLabel,
|
|
@@ -1343,7 +1347,7 @@ var Ct = class {
|
|
|
1343
1347
|
url: n?.url,
|
|
1344
1348
|
color: e.color
|
|
1345
1349
|
});
|
|
1346
|
-
case "anchor": return
|
|
1350
|
+
case "anchor": return z({
|
|
1347
1351
|
id: e.id,
|
|
1348
1352
|
elementType: "anchor",
|
|
1349
1353
|
label: e.wardleyLabel,
|
|
@@ -1351,7 +1355,7 @@ var Ct = class {
|
|
|
1351
1355
|
labelOffset: e.labelOffset ?? n?.labelOffset,
|
|
1352
1356
|
color: e.color
|
|
1353
1357
|
});
|
|
1354
|
-
case "note": return
|
|
1358
|
+
case "note": return z({
|
|
1355
1359
|
id: e.id,
|
|
1356
1360
|
elementType: "note",
|
|
1357
1361
|
label: e.wardleyLabel,
|
|
@@ -1402,7 +1406,7 @@ var Ct = class {
|
|
|
1402
1406
|
...e.color ? { color: e.color } : {}
|
|
1403
1407
|
};
|
|
1404
1408
|
}
|
|
1405
|
-
case "submap": return
|
|
1409
|
+
case "submap": return z({
|
|
1406
1410
|
id: e.id,
|
|
1407
1411
|
elementType: "submap",
|
|
1408
1412
|
label: e.wardleyLabel,
|
|
@@ -1432,23 +1436,23 @@ var Ct = class {
|
|
|
1432
1436
|
} : void 0;
|
|
1433
1437
|
}
|
|
1434
1438
|
}
|
|
1435
|
-
},
|
|
1436
|
-
wardleyImporter: ["type",
|
|
1437
|
-
wardleyExporter: ["type",
|
|
1438
|
-
},
|
|
1439
|
+
}, Et = {
|
|
1440
|
+
wardleyImporter: ["type", wt],
|
|
1441
|
+
wardleyExporter: ["type", Tt]
|
|
1442
|
+
}, Dt = class extends Ee {
|
|
1439
1443
|
_getModules() {
|
|
1440
1444
|
return [
|
|
1441
|
-
|
|
1445
|
+
je,
|
|
1442
1446
|
j,
|
|
1443
|
-
|
|
1444
|
-
|
|
1447
|
+
xt,
|
|
1448
|
+
Et
|
|
1445
1449
|
];
|
|
1446
1450
|
}
|
|
1447
|
-
},
|
|
1448
|
-
function
|
|
1449
|
-
return t <= r ?
|
|
1451
|
+
}, Ot = 180, kt = 80, At = 120, jt = .5, Mt = (e, t, n) => e < t ? t : e > n ? n : e;
|
|
1452
|
+
function Nt(e, t, n, r) {
|
|
1453
|
+
return t <= r ? Mt(e, n, n + r - t) : n + r / 2 - t / 2;
|
|
1450
1454
|
}
|
|
1451
|
-
var
|
|
1455
|
+
var Pt = class {
|
|
1452
1456
|
canvas;
|
|
1453
1457
|
grid;
|
|
1454
1458
|
static $inject = [
|
|
@@ -1465,8 +1469,8 @@ var Mt = class {
|
|
|
1465
1469
|
constrain(e) {
|
|
1466
1470
|
let t = e ?? this.canvas.viewbox(), n = this.grid.outerBounds();
|
|
1467
1471
|
if (!(n.width > 0) || !(n.height > 0) || !(t.width > 0) || !(t.height > 0)) return;
|
|
1468
|
-
let r =
|
|
1469
|
-
if (!(Math.abs(r - t.x) <
|
|
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);
|
|
1473
|
+
if (!(Math.abs(r - t.x) < jt && Math.abs(i - t.y) < jt)) {
|
|
1470
1474
|
this.applying = !0;
|
|
1471
1475
|
try {
|
|
1472
1476
|
this.canvas.viewbox({
|
|
@@ -1480,10 +1484,10 @@ var Mt = class {
|
|
|
1480
1484
|
}
|
|
1481
1485
|
}
|
|
1482
1486
|
}
|
|
1483
|
-
},
|
|
1487
|
+
}, Ft = {
|
|
1484
1488
|
__init__: ["panConstraint"],
|
|
1485
|
-
panConstraint: ["type",
|
|
1486
|
-
},
|
|
1489
|
+
panConstraint: ["type", Pt]
|
|
1490
|
+
}, It = class extends Dt {
|
|
1487
1491
|
_getModules() {
|
|
1488
1492
|
return [
|
|
1489
1493
|
...super._getModules(),
|
|
@@ -1491,47 +1495,47 @@ var Mt = class {
|
|
|
1491
1495
|
re,
|
|
1492
1496
|
ie,
|
|
1493
1497
|
ae,
|
|
1494
|
-
|
|
1498
|
+
Ft
|
|
1495
1499
|
];
|
|
1496
1500
|
}
|
|
1497
1501
|
};
|
|
1498
1502
|
//#endregion
|
|
1499
1503
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
1500
|
-
function
|
|
1504
|
+
function Lt(e, t, n) {
|
|
1501
1505
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
1502
1506
|
}
|
|
1503
|
-
var
|
|
1507
|
+
var Rt = class {
|
|
1504
1508
|
execute(e) {
|
|
1505
1509
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
1506
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
1510
|
+
for (let e of Object.keys(n)) i[e] = r[e], Lt(r, e, n[e]);
|
|
1507
1511
|
return e.oldProperties = i, [t];
|
|
1508
1512
|
}
|
|
1509
1513
|
revert(e) {
|
|
1510
1514
|
let { element: t, oldProperties: n } = e, r = t;
|
|
1511
|
-
if (n) for (let e of Object.keys(n))
|
|
1515
|
+
if (n) for (let e of Object.keys(n)) Lt(r, e, n[e]);
|
|
1512
1516
|
return [t];
|
|
1513
1517
|
}
|
|
1514
|
-
},
|
|
1515
|
-
function
|
|
1518
|
+
}, zt = "element.updateProperties";
|
|
1519
|
+
function Bt(e) {
|
|
1516
1520
|
let t = {};
|
|
1517
1521
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
1518
1522
|
return t;
|
|
1519
1523
|
}
|
|
1520
|
-
var
|
|
1524
|
+
var Vt = class {
|
|
1521
1525
|
commandStack;
|
|
1522
1526
|
static $inject = ["commandStack"];
|
|
1523
1527
|
constructor(e) {
|
|
1524
|
-
this.commandStack = e, e.registerHandler(
|
|
1528
|
+
this.commandStack = e, e.registerHandler(zt, Rt);
|
|
1525
1529
|
}
|
|
1526
1530
|
updateProperties(e, t) {
|
|
1527
|
-
this.commandStack.execute(
|
|
1531
|
+
this.commandStack.execute(zt, {
|
|
1528
1532
|
element: e,
|
|
1529
1533
|
properties: t
|
|
1530
1534
|
});
|
|
1531
1535
|
}
|
|
1532
1536
|
updateLabel(e, t) {
|
|
1533
1537
|
if (e.wardleyType === "note") {
|
|
1534
|
-
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;
|
|
1535
1539
|
this.updateProperties(e, {
|
|
1536
1540
|
wardleyLabel: t,
|
|
1537
1541
|
width: n,
|
|
@@ -1544,8 +1548,8 @@ var zt = class {
|
|
|
1544
1548
|
this.updateProperties(e, { wardleyLabel: t });
|
|
1545
1549
|
}
|
|
1546
1550
|
evolveComponent(e, t, n = {}) {
|
|
1547
|
-
let r =
|
|
1548
|
-
r <= e.evolution || this.updateProperties(e, { movement:
|
|
1551
|
+
let r = Ht(t);
|
|
1552
|
+
r <= e.evolution || this.updateProperties(e, { movement: Bt({
|
|
1549
1553
|
targetEvolution: r,
|
|
1550
1554
|
newLabel: n.newLabel,
|
|
1551
1555
|
method: n.method
|
|
@@ -1570,12 +1574,12 @@ var zt = class {
|
|
|
1570
1574
|
this.updateProperties(e, { color: t });
|
|
1571
1575
|
}
|
|
1572
1576
|
};
|
|
1573
|
-
function
|
|
1577
|
+
function Ht(e) {
|
|
1574
1578
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1575
1579
|
}
|
|
1576
1580
|
//#endregion
|
|
1577
1581
|
//#region src/modeling/WardleyCopyPaste.ts
|
|
1578
|
-
var
|
|
1582
|
+
var Ut = 24, Wt = [
|
|
1579
1583
|
"wardleyType",
|
|
1580
1584
|
"evolution",
|
|
1581
1585
|
"visibility",
|
|
@@ -1592,13 +1596,13 @@ var Vt = 24, Ht = [
|
|
|
1592
1596
|
"drawingPoints",
|
|
1593
1597
|
"closed",
|
|
1594
1598
|
"strokeStyle"
|
|
1595
|
-
],
|
|
1599
|
+
], Gt = [
|
|
1596
1600
|
"wardleyType",
|
|
1597
1601
|
"bidirectional",
|
|
1598
1602
|
"flowValue",
|
|
1599
1603
|
"linkLabel"
|
|
1600
1604
|
];
|
|
1601
|
-
function
|
|
1605
|
+
function Kt(e, t) {
|
|
1602
1606
|
let n = {};
|
|
1603
1607
|
for (let r of t) {
|
|
1604
1608
|
let t = e[r];
|
|
@@ -1606,7 +1610,7 @@ function Wt(e, t) {
|
|
|
1606
1610
|
}
|
|
1607
1611
|
return n;
|
|
1608
1612
|
}
|
|
1609
|
-
var
|
|
1613
|
+
var qt = class {
|
|
1610
1614
|
selection;
|
|
1611
1615
|
modeling;
|
|
1612
1616
|
elementFactory;
|
|
@@ -1638,12 +1642,12 @@ var Gt = class {
|
|
|
1638
1642
|
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
1639
1643
|
sourceIdx: i,
|
|
1640
1644
|
targetIdx: a,
|
|
1641
|
-
props:
|
|
1645
|
+
props: Kt(e, Gt)
|
|
1642
1646
|
}));
|
|
1643
1647
|
}
|
|
1644
1648
|
return this.clipboard = {
|
|
1645
1649
|
shapes: e.map((e) => ({
|
|
1646
|
-
props:
|
|
1650
|
+
props: Kt(e, Wt),
|
|
1647
1651
|
x: e.x,
|
|
1648
1652
|
y: e.y,
|
|
1649
1653
|
width: e.width,
|
|
@@ -1677,13 +1681,13 @@ var Gt = class {
|
|
|
1677
1681
|
...structuredClone(e.props),
|
|
1678
1682
|
source: n[e.sourceIdx],
|
|
1679
1683
|
target: n[e.targetIdx],
|
|
1680
|
-
waypoints: [
|
|
1684
|
+
waypoints: [E(n[e.sourceIdx]), E(n[e.targetIdx])]
|
|
1681
1685
|
}))
|
|
1682
1686
|
};
|
|
1683
1687
|
}
|
|
1684
1688
|
insertWithOffset(e) {
|
|
1685
1689
|
this.pasteCount++;
|
|
1686
|
-
let t =
|
|
1690
|
+
let t = Ut * this.pasteCount, n = Jt(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
1687
1691
|
x: n.cx + t,
|
|
1688
1692
|
y: n.cy + t
|
|
1689
1693
|
}, this.canvas.getRootElement());
|
|
@@ -1702,13 +1706,7 @@ var Gt = class {
|
|
|
1702
1706
|
});
|
|
1703
1707
|
}
|
|
1704
1708
|
};
|
|
1705
|
-
function
|
|
1706
|
-
return {
|
|
1707
|
-
x: e.x + e.width / 2,
|
|
1708
|
-
y: e.y + e.height / 2
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
function qt(e) {
|
|
1709
|
+
function Jt(e) {
|
|
1712
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));
|
|
1713
1711
|
return {
|
|
1714
1712
|
cx: (t + r) / 2,
|
|
@@ -1717,12 +1715,12 @@ function qt(e) {
|
|
|
1717
1715
|
}
|
|
1718
1716
|
//#endregion
|
|
1719
1717
|
//#region src/modeling/index.ts
|
|
1720
|
-
var
|
|
1721
|
-
__depends__: [he,
|
|
1718
|
+
var Yt = {
|
|
1719
|
+
__depends__: [he, h],
|
|
1722
1720
|
__init__: ["wardleyModeling"],
|
|
1723
|
-
wardleyModeling: ["type",
|
|
1724
|
-
wardleyCopyPaste: ["type",
|
|
1725
|
-
},
|
|
1721
|
+
wardleyModeling: ["type", Vt],
|
|
1722
|
+
wardleyCopyPaste: ["type", qt]
|
|
1723
|
+
}, Xt = {
|
|
1726
1724
|
__depends__: [ge],
|
|
1727
1725
|
__init__: ["wardleyLassoBehavior"],
|
|
1728
1726
|
wardleyLassoBehavior: ["type", class {
|
|
@@ -1745,33 +1743,33 @@ var Jt = {
|
|
|
1745
1743
|
});
|
|
1746
1744
|
}
|
|
1747
1745
|
}]
|
|
1748
|
-
},
|
|
1746
|
+
}, Zt = /* @__PURE__ */ new Set([
|
|
1749
1747
|
"component",
|
|
1750
1748
|
"anchor",
|
|
1751
1749
|
"submap",
|
|
1752
1750
|
"pipeline"
|
|
1753
1751
|
]);
|
|
1754
|
-
function
|
|
1755
|
-
return S(e) &&
|
|
1752
|
+
function B(e) {
|
|
1753
|
+
return S(e) && Zt.has(e.wardleyType);
|
|
1756
1754
|
}
|
|
1757
|
-
function
|
|
1755
|
+
function Qt(e, t) {
|
|
1758
1756
|
return (e.outgoing ?? []).some((e) => e.target === t) || (e.incoming ?? []).some((e) => e.source === t);
|
|
1759
1757
|
}
|
|
1760
|
-
var
|
|
1758
|
+
var $t = class extends _e {
|
|
1761
1759
|
static $inject = ["eventBus"];
|
|
1762
1760
|
constructor(e) {
|
|
1763
1761
|
super(e);
|
|
1764
1762
|
}
|
|
1765
1763
|
init() {
|
|
1766
|
-
this.addRule("connection.start", (e) =>
|
|
1764
|
+
this.addRule("connection.start", (e) => B(e.source)), this.addRule("connection.create", (e) => {
|
|
1767
1765
|
let { source: t, target: n } = e;
|
|
1768
|
-
return !
|
|
1766
|
+
return !B(t) || !B(n) || t === n || Qt(t, n) ? !1 : { wardleyType: "dependency" };
|
|
1769
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));
|
|
1770
1768
|
}
|
|
1771
|
-
},
|
|
1769
|
+
}, en = {
|
|
1772
1770
|
__init__: ["wardleyRules"],
|
|
1773
|
-
wardleyRules: ["type",
|
|
1774
|
-
},
|
|
1771
|
+
wardleyRules: ["type", $t]
|
|
1772
|
+
}, tn = 8, nn = {
|
|
1775
1773
|
__init__: ["stageSnapping"],
|
|
1776
1774
|
stageSnapping: ["type", class {
|
|
1777
1775
|
static $inject = ["eventBus", "evolutionGrid"];
|
|
@@ -1787,7 +1785,7 @@ var Qt = class extends _e {
|
|
|
1787
1785
|
let t = e.context?.shape;
|
|
1788
1786
|
if (!t) return;
|
|
1789
1787
|
let r = t.x + t.width / 2 + e.dx;
|
|
1790
|
-
for (let t of n()) if (Math.abs(r - t) <=
|
|
1788
|
+
for (let t of n()) if (Math.abs(r - t) <= tn) {
|
|
1791
1789
|
let n = t - r;
|
|
1792
1790
|
e.dx += n, e.x += n;
|
|
1793
1791
|
break;
|
|
@@ -1799,7 +1797,7 @@ var Qt = class extends _e {
|
|
|
1799
1797
|
"resize.end"
|
|
1800
1798
|
], 1500, (e) => {
|
|
1801
1799
|
if (!e.originalEvent?.shiftKey && typeof e.x == "number") {
|
|
1802
|
-
for (let t of n()) if (Math.abs(e.x - t) <=
|
|
1800
|
+
for (let t of n()) if (Math.abs(e.x - t) <= tn) {
|
|
1803
1801
|
r(e, t);
|
|
1804
1802
|
break;
|
|
1805
1803
|
}
|
|
@@ -1807,45 +1805,45 @@ var Qt = class extends _e {
|
|
|
1807
1805
|
});
|
|
1808
1806
|
}
|
|
1809
1807
|
}]
|
|
1810
|
-
},
|
|
1811
|
-
draw:
|
|
1812
|
-
lasso:
|
|
1813
|
-
component:
|
|
1814
|
-
market:
|
|
1815
|
-
ecosystem:
|
|
1816
|
-
anchor:
|
|
1817
|
-
pipeline:
|
|
1818
|
-
note:
|
|
1819
|
-
annotation:
|
|
1820
|
-
accelerator:
|
|
1821
|
-
deaccelerator:
|
|
1822
|
-
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"/>`)
|
|
1823
1821
|
};
|
|
1824
|
-
function
|
|
1825
|
-
let t =
|
|
1826
|
-
fill:
|
|
1827
|
-
stroke:
|
|
1822
|
+
function W(e) {
|
|
1823
|
+
let t = b[e] ?? {
|
|
1824
|
+
fill: y.band,
|
|
1825
|
+
stroke: y.dependency
|
|
1828
1826
|
};
|
|
1829
|
-
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"/>`);
|
|
1830
1828
|
}
|
|
1831
1829
|
//#endregion
|
|
1832
1830
|
//#region src/palette/WardleyPaletteProvider.ts
|
|
1833
|
-
var
|
|
1831
|
+
var G = "wardley-1-blocks", K = "wardley-2-strategy", rn = [
|
|
1834
1832
|
{
|
|
1835
1833
|
key: "component",
|
|
1836
1834
|
type: "component",
|
|
1837
1835
|
label: "Component",
|
|
1838
1836
|
title: "Component — C",
|
|
1839
|
-
icon:
|
|
1840
|
-
group:
|
|
1837
|
+
icon: U.component,
|
|
1838
|
+
group: G
|
|
1841
1839
|
},
|
|
1842
1840
|
{
|
|
1843
1841
|
key: "market",
|
|
1844
1842
|
type: "component",
|
|
1845
1843
|
label: "Market",
|
|
1846
1844
|
title: "Market component",
|
|
1847
|
-
icon:
|
|
1848
|
-
group:
|
|
1845
|
+
icon: U.market,
|
|
1846
|
+
group: G,
|
|
1849
1847
|
extra: { market: !0 }
|
|
1850
1848
|
},
|
|
1851
1849
|
{
|
|
@@ -1853,8 +1851,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1853
1851
|
type: "component",
|
|
1854
1852
|
label: "Ecosystem",
|
|
1855
1853
|
title: "Ecosystem component",
|
|
1856
|
-
icon:
|
|
1857
|
-
group:
|
|
1854
|
+
icon: U.ecosystem,
|
|
1855
|
+
group: G,
|
|
1858
1856
|
extra: { ecosystem: !0 }
|
|
1859
1857
|
},
|
|
1860
1858
|
{
|
|
@@ -1862,32 +1860,32 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1862
1860
|
type: "anchor",
|
|
1863
1861
|
label: "User",
|
|
1864
1862
|
title: "Anchor / User — U",
|
|
1865
|
-
icon:
|
|
1866
|
-
group:
|
|
1863
|
+
icon: U.anchor,
|
|
1864
|
+
group: G
|
|
1867
1865
|
},
|
|
1868
1866
|
{
|
|
1869
1867
|
key: "pipeline",
|
|
1870
1868
|
type: "pipeline",
|
|
1871
1869
|
label: "Pipeline",
|
|
1872
1870
|
title: "Pipeline",
|
|
1873
|
-
icon:
|
|
1874
|
-
group:
|
|
1871
|
+
icon: U.pipeline,
|
|
1872
|
+
group: G
|
|
1875
1873
|
},
|
|
1876
1874
|
{
|
|
1877
1875
|
key: "submap",
|
|
1878
1876
|
type: "submap",
|
|
1879
1877
|
label: "Submap",
|
|
1880
1878
|
title: "Submap",
|
|
1881
|
-
icon:
|
|
1882
|
-
group:
|
|
1879
|
+
icon: U.submap,
|
|
1880
|
+
group: G
|
|
1883
1881
|
},
|
|
1884
1882
|
{
|
|
1885
1883
|
key: "pioneers",
|
|
1886
1884
|
type: "attitude",
|
|
1887
1885
|
label: "Pioneers",
|
|
1888
1886
|
title: "Pioneers region",
|
|
1889
|
-
icon:
|
|
1890
|
-
group:
|
|
1887
|
+
icon: W("pioneers"),
|
|
1888
|
+
group: K,
|
|
1891
1889
|
extra: { attitudeKind: "pioneers" }
|
|
1892
1890
|
},
|
|
1893
1891
|
{
|
|
@@ -1895,8 +1893,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1895
1893
|
type: "attitude",
|
|
1896
1894
|
label: "Settlers",
|
|
1897
1895
|
title: "Settlers region",
|
|
1898
|
-
icon:
|
|
1899
|
-
group:
|
|
1896
|
+
icon: W("settlers"),
|
|
1897
|
+
group: K,
|
|
1900
1898
|
extra: { attitudeKind: "settlers" }
|
|
1901
1899
|
},
|
|
1902
1900
|
{
|
|
@@ -1904,8 +1902,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1904
1902
|
type: "attitude",
|
|
1905
1903
|
label: "Town Planners",
|
|
1906
1904
|
title: "Town Planners region",
|
|
1907
|
-
icon:
|
|
1908
|
-
group:
|
|
1905
|
+
icon: W("townplanners"),
|
|
1906
|
+
group: K,
|
|
1909
1907
|
extra: { attitudeKind: "townplanners" }
|
|
1910
1908
|
},
|
|
1911
1909
|
{
|
|
@@ -1913,8 +1911,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1913
1911
|
type: "accelerator",
|
|
1914
1912
|
label: "Accelerate",
|
|
1915
1913
|
title: "Accelerator",
|
|
1916
|
-
icon:
|
|
1917
|
-
group:
|
|
1914
|
+
icon: U.accelerator,
|
|
1915
|
+
group: K,
|
|
1918
1916
|
extra: { acceleratorDirection: "accelerate" }
|
|
1919
1917
|
},
|
|
1920
1918
|
{
|
|
@@ -1922,8 +1920,8 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1922
1920
|
type: "accelerator",
|
|
1923
1921
|
label: "Deaccelerate",
|
|
1924
1922
|
title: "Deaccelerator",
|
|
1925
|
-
icon:
|
|
1926
|
-
group:
|
|
1923
|
+
icon: U.deaccelerator,
|
|
1924
|
+
group: K,
|
|
1927
1925
|
extra: { acceleratorDirection: "deaccelerate" }
|
|
1928
1926
|
},
|
|
1929
1927
|
{
|
|
@@ -1931,10 +1929,10 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1931
1929
|
type: "note",
|
|
1932
1930
|
label: "Note",
|
|
1933
1931
|
title: "Note",
|
|
1934
|
-
icon:
|
|
1932
|
+
icon: U.note,
|
|
1935
1933
|
group: "wardley-3-notes"
|
|
1936
1934
|
}
|
|
1937
|
-
],
|
|
1935
|
+
], an = {
|
|
1938
1936
|
__init__: ["wardleyPaletteProvider"],
|
|
1939
1937
|
wardleyPaletteProvider: ["type", class {
|
|
1940
1938
|
create;
|
|
@@ -1956,15 +1954,15 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1956
1954
|
e["lasso-tool"] = {
|
|
1957
1955
|
group: "tools",
|
|
1958
1956
|
title: "Selection tool — L (or Shift+drag)",
|
|
1959
|
-
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>`,
|
|
1960
1958
|
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
1961
1959
|
}, e["draw-tool"] = {
|
|
1962
1960
|
group: "tools",
|
|
1963
1961
|
title: "Draw — click point by point, double-click/Enter finishes, click the start point to close",
|
|
1964
|
-
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>`,
|
|
1965
1963
|
action: { click: () => this.drawTool.toggle() }
|
|
1966
1964
|
};
|
|
1967
|
-
for (let t of
|
|
1965
|
+
for (let t of rn) {
|
|
1968
1966
|
let n = (e) => {
|
|
1969
1967
|
let n = this.factory.createNew(t.type, t.label, t.extra ?? {});
|
|
1970
1968
|
this.create.start(e, n);
|
|
@@ -1982,24 +1980,24 @@ var W = "wardley-1-blocks", G = "wardley-2-strategy", nn = [
|
|
|
1982
1980
|
return e;
|
|
1983
1981
|
}
|
|
1984
1982
|
}]
|
|
1985
|
-
},
|
|
1983
|
+
}, q = "wardley-element-settings", J = {
|
|
1986
1984
|
id: "type",
|
|
1987
1985
|
name: "Type"
|
|
1988
|
-
},
|
|
1986
|
+
}, Y = {
|
|
1989
1987
|
id: "method",
|
|
1990
1988
|
name: "Sourcing"
|
|
1991
|
-
},
|
|
1989
|
+
}, on = {
|
|
1992
1990
|
id: "props",
|
|
1993
1991
|
name: "Properties"
|
|
1994
1992
|
};
|
|
1995
|
-
function
|
|
1993
|
+
function X(e, t) {
|
|
1996
1994
|
return e ? `✓ ${t}` : t;
|
|
1997
1995
|
}
|
|
1998
|
-
var
|
|
1996
|
+
var sn = class {
|
|
1999
1997
|
modeling;
|
|
2000
1998
|
static $inject = ["popupMenu", "wardleyModeling"];
|
|
2001
1999
|
constructor(e, t) {
|
|
2002
|
-
this.modeling = t, e.registerProvider(
|
|
2000
|
+
this.modeling = t, e.registerProvider(q, this);
|
|
2003
2001
|
}
|
|
2004
2002
|
getPopupMenuEntries(e) {
|
|
2005
2003
|
let t = Array.isArray(e) ? e[0] : e;
|
|
@@ -2009,59 +2007,59 @@ var on = class {
|
|
|
2009
2007
|
let t = e.decorators ?? {}, n = t.ecosystem ? "ecosystem" : t.market ? "market" : "normal", r = t.method;
|
|
2010
2008
|
return {
|
|
2011
2009
|
"type-normal": {
|
|
2012
|
-
label:
|
|
2013
|
-
group:
|
|
2010
|
+
label: X(n === "normal", "Normal"),
|
|
2011
|
+
group: J,
|
|
2014
2012
|
action: () => this.modeling.setMarketEcosystem(e, void 0)
|
|
2015
2013
|
},
|
|
2016
2014
|
"type-market": {
|
|
2017
|
-
label:
|
|
2018
|
-
group:
|
|
2015
|
+
label: X(n === "market", "Market"),
|
|
2016
|
+
group: J,
|
|
2019
2017
|
action: () => this.modeling.setMarketEcosystem(e, "market")
|
|
2020
2018
|
},
|
|
2021
2019
|
"type-ecosystem": {
|
|
2022
|
-
label:
|
|
2023
|
-
group:
|
|
2020
|
+
label: X(n === "ecosystem", "Ecosystem"),
|
|
2021
|
+
group: J,
|
|
2024
2022
|
action: () => this.modeling.setMarketEcosystem(e, "ecosystem")
|
|
2025
2023
|
},
|
|
2026
2024
|
"method-none": {
|
|
2027
|
-
label:
|
|
2028
|
-
group:
|
|
2025
|
+
label: X(!r, "None"),
|
|
2026
|
+
group: Y,
|
|
2029
2027
|
action: () => this.modeling.setMethod(e, void 0)
|
|
2030
2028
|
},
|
|
2031
2029
|
"method-build": {
|
|
2032
|
-
label:
|
|
2033
|
-
group:
|
|
2030
|
+
label: X(r === "build", "Build"),
|
|
2031
|
+
group: Y,
|
|
2034
2032
|
action: () => this.modeling.setMethod(e, "build")
|
|
2035
2033
|
},
|
|
2036
2034
|
"method-buy": {
|
|
2037
|
-
label:
|
|
2038
|
-
group:
|
|
2035
|
+
label: X(r === "buy", "Buy"),
|
|
2036
|
+
group: Y,
|
|
2039
2037
|
action: () => this.modeling.setMethod(e, "buy")
|
|
2040
2038
|
},
|
|
2041
2039
|
"method-outsource": {
|
|
2042
|
-
label:
|
|
2043
|
-
group:
|
|
2040
|
+
label: X(r === "outsource", "Outsource"),
|
|
2041
|
+
group: Y,
|
|
2044
2042
|
action: () => this.modeling.setMethod(e, "outsource")
|
|
2045
2043
|
},
|
|
2046
2044
|
"prop-inertia": {
|
|
2047
|
-
label:
|
|
2048
|
-
group:
|
|
2045
|
+
label: X(!!t.inertia, "Inertia"),
|
|
2046
|
+
group: on,
|
|
2049
2047
|
action: () => this.modeling.toggleInertia(e)
|
|
2050
2048
|
}
|
|
2051
2049
|
};
|
|
2052
2050
|
}
|
|
2053
|
-
},
|
|
2051
|
+
}, cn = {
|
|
2054
2052
|
__init__: ["wardleyElementSettings"],
|
|
2055
|
-
wardleyElementSettings: ["type",
|
|
2053
|
+
wardleyElementSettings: ["type", sn]
|
|
2056
2054
|
};
|
|
2057
2055
|
//#endregion
|
|
2058
2056
|
//#region src/context-pad/WardleyContextPadProvider.ts
|
|
2059
|
-
function
|
|
2060
|
-
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>`;
|
|
2061
2059
|
}
|
|
2062
2060
|
//#endregion
|
|
2063
2061
|
//#region src/context-pad/index.ts
|
|
2064
|
-
var
|
|
2062
|
+
var ln = {
|
|
2065
2063
|
__init__: ["wardleyContextPadProvider"],
|
|
2066
2064
|
wardleyContextPadProvider: ["type", class {
|
|
2067
2065
|
modeling;
|
|
@@ -2095,13 +2093,13 @@ var cn = {
|
|
|
2095
2093
|
"edit-value": {
|
|
2096
2094
|
group: "edit",
|
|
2097
2095
|
title: n ? "Edit flow value" : "Edit link annotation",
|
|
2098
|
-
html:
|
|
2096
|
+
html: Z(N, n ? "Edit flow value" : "Edit link annotation"),
|
|
2099
2097
|
action: { click: () => this.labelEditing.activateConnection(t) }
|
|
2100
2098
|
},
|
|
2101
2099
|
delete: {
|
|
2102
2100
|
group: "edit",
|
|
2103
2101
|
title: "Delete connection",
|
|
2104
|
-
html:
|
|
2102
|
+
html: Z(P, "Delete connection"),
|
|
2105
2103
|
action: { click: () => this.modeling.removeElements([e]) }
|
|
2106
2104
|
}
|
|
2107
2105
|
};
|
|
@@ -2116,7 +2114,7 @@ var cn = {
|
|
|
2116
2114
|
n.append = {
|
|
2117
2115
|
group: "edit",
|
|
2118
2116
|
title: "Append component (auto-connect)",
|
|
2119
|
-
html:
|
|
2117
|
+
html: Z(Ue, "Append component", !0),
|
|
2120
2118
|
action: {
|
|
2121
2119
|
click: e,
|
|
2122
2120
|
dragstart: e
|
|
@@ -2128,7 +2126,7 @@ var cn = {
|
|
|
2128
2126
|
n.connect = {
|
|
2129
2127
|
group: "edit",
|
|
2130
2128
|
title: "Connect to existing element",
|
|
2131
|
-
html:
|
|
2129
|
+
html: Z(We, "Connect to existing element", !0),
|
|
2132
2130
|
action: {
|
|
2133
2131
|
click: r,
|
|
2134
2132
|
dragstart: r
|
|
@@ -2139,7 +2137,7 @@ var cn = {
|
|
|
2139
2137
|
if (t.movement) n["evolve-clear"] = {
|
|
2140
2138
|
group: "wardley",
|
|
2141
2139
|
title: "Remove evolve",
|
|
2142
|
-
html:
|
|
2140
|
+
html: Z(Ke, "Remove evolve"),
|
|
2143
2141
|
action: { click: () => this.wardleyModeling.clearMovement(t) }
|
|
2144
2142
|
};
|
|
2145
2143
|
else if (t.evolution < .999) {
|
|
@@ -2147,7 +2145,7 @@ var cn = {
|
|
|
2147
2145
|
n.evolve = {
|
|
2148
2146
|
group: "wardley",
|
|
2149
2147
|
title: "Evolve: drag to set the target maturity",
|
|
2150
|
-
html:
|
|
2148
|
+
html: Z(Ge, "Evolve: drag to set the target maturity", !0),
|
|
2151
2149
|
action: {
|
|
2152
2150
|
click: e,
|
|
2153
2151
|
dragstart: e
|
|
@@ -2157,10 +2155,10 @@ var cn = {
|
|
|
2157
2155
|
n.settings = {
|
|
2158
2156
|
group: "wardley",
|
|
2159
2157
|
title: "Settings (type, sourcing, inertia)",
|
|
2160
|
-
html:
|
|
2158
|
+
html: Z(nt, "Settings"),
|
|
2161
2159
|
action: { click: (e) => {
|
|
2162
2160
|
let n = e;
|
|
2163
|
-
this.popupMenu.open(t,
|
|
2161
|
+
this.popupMenu.open(t, q, {
|
|
2164
2162
|
x: n.clientX,
|
|
2165
2163
|
y: n.clientY
|
|
2166
2164
|
});
|
|
@@ -2172,14 +2170,14 @@ var cn = {
|
|
|
2172
2170
|
n["stroke-style"] = {
|
|
2173
2171
|
group: "wardley",
|
|
2174
2172
|
title: r,
|
|
2175
|
-
html:
|
|
2173
|
+
html: Z(ot, r),
|
|
2176
2174
|
action: { click: () => this.wardleyModeling.updateProperties(t, { strokeStyle: e }) }
|
|
2177
2175
|
};
|
|
2178
2176
|
}
|
|
2179
2177
|
n.color = {
|
|
2180
2178
|
group: "wardley",
|
|
2181
2179
|
title: "Color",
|
|
2182
|
-
html:
|
|
2180
|
+
html: Z(rt, "Color"),
|
|
2183
2181
|
action: { click: (e) => {
|
|
2184
2182
|
let n = e;
|
|
2185
2183
|
this.colorPicker.open(t, n.clientX, n.clientY);
|
|
@@ -2189,17 +2187,17 @@ var cn = {
|
|
|
2189
2187
|
return i && (n["open-link"] = {
|
|
2190
2188
|
group: "wardley",
|
|
2191
2189
|
title: `Open link (${i})`,
|
|
2192
|
-
html:
|
|
2190
|
+
html: Z(We, "Open link"),
|
|
2193
2191
|
action: { click: () => window.open(i, "_blank", "noopener") }
|
|
2194
2192
|
}), t.wardleyType !== "drawing" && (n["edit-label"] = {
|
|
2195
2193
|
group: "edit",
|
|
2196
2194
|
title: "Edit label",
|
|
2197
|
-
html:
|
|
2195
|
+
html: Z(N, "Edit label"),
|
|
2198
2196
|
action: { click: () => this.labelEditing.activate(t) }
|
|
2199
2197
|
}), n.delete = {
|
|
2200
2198
|
group: "edit",
|
|
2201
2199
|
title: "Delete",
|
|
2202
|
-
html:
|
|
2200
|
+
html: Z(P, "Delete"),
|
|
2203
2201
|
action: { click: () => this.modeling.removeElements([t]) }
|
|
2204
2202
|
}, n;
|
|
2205
2203
|
}
|
|
@@ -2207,10 +2205,10 @@ var cn = {
|
|
|
2207
2205
|
};
|
|
2208
2206
|
//#endregion
|
|
2209
2207
|
//#region src/label-editing/WardleyLabelEditing.ts
|
|
2210
|
-
function
|
|
2208
|
+
function un(e) {
|
|
2211
2209
|
return e.replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
2212
2210
|
}
|
|
2213
|
-
var
|
|
2211
|
+
var dn = class {
|
|
2214
2212
|
canvas;
|
|
2215
2213
|
modeling;
|
|
2216
2214
|
factory;
|
|
@@ -2242,7 +2240,7 @@ var un = class {
|
|
|
2242
2240
|
c || (c = !0, s.removeEventListener("keydown", d), s.removeEventListener("blur", f), s.remove(), this.active = null);
|
|
2243
2241
|
}, u = () => {
|
|
2244
2242
|
if (c) return;
|
|
2245
|
-
let t =
|
|
2243
|
+
let t = un(s.value), n = t && t !== e.wardleyLabel;
|
|
2246
2244
|
if (l(), !n) return;
|
|
2247
2245
|
let r = i ? t : this.factory.uniqueLabel(t, e.id);
|
|
2248
2246
|
this.modeling.updateLabel(e, r);
|
|
@@ -2297,10 +2295,10 @@ var un = class {
|
|
|
2297
2295
|
cancel() {
|
|
2298
2296
|
this.active?.cleanup();
|
|
2299
2297
|
}
|
|
2300
|
-
},
|
|
2298
|
+
}, fn = {
|
|
2301
2299
|
__init__: ["wardleyLabelEditing"],
|
|
2302
|
-
wardleyLabelEditing: ["type",
|
|
2303
|
-
},
|
|
2300
|
+
wardleyLabelEditing: ["type", dn]
|
|
2301
|
+
}, pn = 2, mn = 10, hn = {
|
|
2304
2302
|
arrowleft: {
|
|
2305
2303
|
x: -1,
|
|
2306
2304
|
y: 0
|
|
@@ -2317,7 +2315,7 @@ var un = class {
|
|
|
2317
2315
|
x: 0,
|
|
2318
2316
|
y: 1
|
|
2319
2317
|
}
|
|
2320
|
-
},
|
|
2318
|
+
}, gn = class {
|
|
2321
2319
|
static $inject = [
|
|
2322
2320
|
"canvas",
|
|
2323
2321
|
"commandStack",
|
|
@@ -2334,7 +2332,7 @@ var un = class {
|
|
|
2334
2332
|
let u = e.getContainer();
|
|
2335
2333
|
u.hasAttribute("tabindex") || u.setAttribute("tabindex", "0");
|
|
2336
2334
|
let d = (e) => {
|
|
2337
|
-
if (
|
|
2335
|
+
if (_n(e.target)) return;
|
|
2338
2336
|
let l = e.ctrlKey || e.metaKey, u = e.key.toLowerCase();
|
|
2339
2337
|
if (l && u === "z" && !e.shiftKey) e.preventDefault(), t.undo();
|
|
2340
2338
|
else if (l && u === "z" && e.shiftKey || l && u === "y") e.preventDefault(), t.redo();
|
|
@@ -2355,11 +2353,11 @@ var un = class {
|
|
|
2355
2353
|
e.preventDefault();
|
|
2356
2354
|
let t = s.getLastMoveEvent();
|
|
2357
2355
|
c.activateSelection(t ?? e, !!t);
|
|
2358
|
-
} else if (u in
|
|
2356
|
+
} else if (u in hn && !l) {
|
|
2359
2357
|
let t = n.get();
|
|
2360
2358
|
if (t.length) {
|
|
2361
2359
|
e.preventDefault();
|
|
2362
|
-
let n = e.shiftKey ?
|
|
2360
|
+
let n = e.shiftKey ? mn : pn, i = hn[u];
|
|
2363
2361
|
r.moveElements(t, {
|
|
2364
2362
|
x: i.x * n,
|
|
2365
2363
|
y: i.y * n
|
|
@@ -2370,21 +2368,21 @@ var un = class {
|
|
|
2370
2368
|
document.addEventListener("keydown", d), l.on("diagram.destroy", () => document.removeEventListener("keydown", d));
|
|
2371
2369
|
}
|
|
2372
2370
|
};
|
|
2373
|
-
function
|
|
2371
|
+
function _n(e) {
|
|
2374
2372
|
if (!(e instanceof HTMLElement)) return !1;
|
|
2375
2373
|
let t = e.tagName;
|
|
2376
2374
|
return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
|
|
2377
2375
|
}
|
|
2378
2376
|
//#endregion
|
|
2379
2377
|
//#region src/keyboard/index.ts
|
|
2380
|
-
var
|
|
2378
|
+
var vn = {
|
|
2381
2379
|
__init__: ["wardleyKeyboard"],
|
|
2382
|
-
wardleyKeyboard: ["type",
|
|
2383
|
-
},
|
|
2384
|
-
function
|
|
2380
|
+
wardleyKeyboard: ["type", gn]
|
|
2381
|
+
}, Q = "wardley.evolve", yn = .005, bn = "wardley-evolve-handle";
|
|
2382
|
+
function xn(e) {
|
|
2385
2383
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2386
2384
|
}
|
|
2387
|
-
var
|
|
2385
|
+
var Sn = class {
|
|
2388
2386
|
dragging;
|
|
2389
2387
|
static $inject = [
|
|
2390
2388
|
"eventBus",
|
|
@@ -2400,33 +2398,33 @@ var Q = class {
|
|
|
2400
2398
|
n === void 0 ? delete t.movement : t.movement = n, e.fire("element.changed", { element: t });
|
|
2401
2399
|
}, s = (e, t) => {
|
|
2402
2400
|
let r = i.getContainer().getBoundingClientRect(), a = i.viewbox(), o = a.x + (e - r.left) * (a.width / r.width);
|
|
2403
|
-
return
|
|
2401
|
+
return xn(n.fromCanvas({
|
|
2404
2402
|
x: o,
|
|
2405
2403
|
y: t
|
|
2406
2404
|
}).evolution);
|
|
2407
2405
|
};
|
|
2408
2406
|
i.getContainer().addEventListener("mousedown", (e) => {
|
|
2409
2407
|
let t = e.target;
|
|
2410
|
-
if (!t?.closest(`.${
|
|
2408
|
+
if (!t?.closest(`.${bn}`)) return;
|
|
2411
2409
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), i = n ? a.get(n) : void 0;
|
|
2412
2410
|
if (!i || i.wardleyType !== "component") return;
|
|
2413
2411
|
e.stopPropagation(), e.preventDefault();
|
|
2414
2412
|
let c = i.movement, l = i.y + i.height / 2, u, d = (e) => {
|
|
2415
2413
|
u = s(e.clientX, l), o(i, { targetEvolution: u });
|
|
2416
2414
|
}, f = () => {
|
|
2417
|
-
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);
|
|
2418
2416
|
};
|
|
2419
2417
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", f);
|
|
2420
|
-
}, !0), e.on(`${
|
|
2421
|
-
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({
|
|
2422
2420
|
x: e.x,
|
|
2423
2421
|
y: r
|
|
2424
2422
|
}).evolution);
|
|
2425
2423
|
e.context.target = i, o(t, { targetEvolution: i });
|
|
2426
|
-
}), e.on(`${
|
|
2424
|
+
}), e.on(`${Q}.end`, (e) => {
|
|
2427
2425
|
let t = e.context, { shape: n, target: i } = t;
|
|
2428
|
-
o(n, t.originalMovement), i !== void 0 && Math.abs(i - n.evolution) >
|
|
2429
|
-
}), 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) => {
|
|
2430
2428
|
let t = e.context;
|
|
2431
2429
|
t && !t.committed && o(t.shape, t.originalMovement);
|
|
2432
2430
|
});
|
|
@@ -2436,15 +2434,15 @@ var Q = class {
|
|
|
2436
2434
|
shape: t,
|
|
2437
2435
|
...t.movement ? { originalMovement: t.movement } : {}
|
|
2438
2436
|
};
|
|
2439
|
-
this.dragging.init(e,
|
|
2437
|
+
this.dragging.init(e, Q, {
|
|
2440
2438
|
cursor: "ew-resize",
|
|
2441
2439
|
data: { context: n }
|
|
2442
2440
|
});
|
|
2443
2441
|
}
|
|
2444
|
-
},
|
|
2442
|
+
}, Cn = {
|
|
2445
2443
|
__init__: ["wardleyEvolveDragging"],
|
|
2446
|
-
wardleyEvolveDragging: ["type",
|
|
2447
|
-
},
|
|
2444
|
+
wardleyEvolveDragging: ["type", Sn]
|
|
2445
|
+
}, wn = 500, Tn = class {
|
|
2448
2446
|
static $inject = ["injector", "eventBus"];
|
|
2449
2447
|
constructor(e, t) {
|
|
2450
2448
|
let n = e.get("connectionPreview", !1), r = e.get("wardleyLabelEditing", !1);
|
|
@@ -2469,18 +2467,18 @@ var Q = class {
|
|
|
2469
2467
|
"create.cleanup"
|
|
2470
2468
|
], (e) => {
|
|
2471
2469
|
n.cleanUp(e.context);
|
|
2472
|
-
})), r && t.on("create.end",
|
|
2470
|
+
})), r && t.on("create.end", wn, (e) => {
|
|
2473
2471
|
let { context: t } = e;
|
|
2474
2472
|
if (!t.source || !t.canExecute || !t.shape) return;
|
|
2475
2473
|
let n = t.shape;
|
|
2476
2474
|
setTimeout(() => r.activate(n), 0);
|
|
2477
2475
|
});
|
|
2478
2476
|
}
|
|
2479
|
-
},
|
|
2477
|
+
}, En = {
|
|
2480
2478
|
__depends__: [ve],
|
|
2481
2479
|
__init__: ["wardleyAppendBehavior"],
|
|
2482
|
-
wardleyAppendBehavior: ["type",
|
|
2483
|
-
},
|
|
2480
|
+
wardleyAppendBehavior: ["type", Tn]
|
|
2481
|
+
}, Dn = class {
|
|
2484
2482
|
canvas;
|
|
2485
2483
|
modeling;
|
|
2486
2484
|
static $inject = [
|
|
@@ -2530,9 +2528,9 @@ var Q = class {
|
|
|
2530
2528
|
close() {
|
|
2531
2529
|
this.popover && (this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0));
|
|
2532
2530
|
}
|
|
2533
|
-
},
|
|
2531
|
+
}, On = {
|
|
2534
2532
|
__init__: ["wardleyColorPicker"],
|
|
2535
|
-
wardleyColorPicker: ["type",
|
|
2533
|
+
wardleyColorPicker: ["type", Dn]
|
|
2536
2534
|
};
|
|
2537
2535
|
//#endregion
|
|
2538
2536
|
//#region src/ordering/WardleyOrderingProvider.ts
|
|
@@ -2541,7 +2539,7 @@ function $(e) {
|
|
|
2541
2539
|
}
|
|
2542
2540
|
//#endregion
|
|
2543
2541
|
//#region src/ordering/index.ts
|
|
2544
|
-
var
|
|
2542
|
+
var kn = {
|
|
2545
2543
|
__init__: ["wardleyOrderingProvider"],
|
|
2546
2544
|
wardleyOrderingProvider: ["type", class extends ye {
|
|
2547
2545
|
static $inject = ["eventBus"];
|
|
@@ -2559,7 +2557,7 @@ var Dn = {
|
|
|
2559
2557
|
} : { parent: t };
|
|
2560
2558
|
}
|
|
2561
2559
|
}]
|
|
2562
|
-
},
|
|
2560
|
+
}, An = 12, jn = class {
|
|
2563
2561
|
canvas;
|
|
2564
2562
|
eventBus;
|
|
2565
2563
|
modeling;
|
|
@@ -2636,12 +2634,12 @@ var Dn = {
|
|
|
2636
2634
|
if (e.button !== 0 || this.isChromeTarget(e)) return;
|
|
2637
2635
|
e.preventDefault(), e.stopPropagation();
|
|
2638
2636
|
let t = this.toCanvasPoint(e), n = this.points[0];
|
|
2639
|
-
if (n && this.points.length >= 3 &&
|
|
2637
|
+
if (n && this.points.length >= 3 && Mn(t, n) <= An) {
|
|
2640
2638
|
this.finishClosed();
|
|
2641
2639
|
return;
|
|
2642
2640
|
}
|
|
2643
2641
|
let r = this.points[this.points.length - 1];
|
|
2644
|
-
if (r &&
|
|
2642
|
+
if (r && Mn(t, r) <= An) {
|
|
2645
2643
|
this.points.length >= 2 && this.finish();
|
|
2646
2644
|
return;
|
|
2647
2645
|
}
|
|
@@ -2658,47 +2656,47 @@ var Dn = {
|
|
|
2658
2656
|
};
|
|
2659
2657
|
renderPreview() {
|
|
2660
2658
|
if (this.clearPreview(), !this.points.length) return;
|
|
2661
|
-
let e = this.canvas.getLayer("wardley-draw-preview", 1e3), t =
|
|
2662
|
-
|
|
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"), {
|
|
2663
2661
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2664
2662
|
fill: "none",
|
|
2665
|
-
stroke:
|
|
2663
|
+
stroke: y.ink,
|
|
2666
2664
|
"stroke-width": 2,
|
|
2667
2665
|
"stroke-linecap": "round",
|
|
2668
2666
|
"stroke-linejoin": "round",
|
|
2669
2667
|
"stroke-dasharray": "5 4"
|
|
2670
2668
|
}));
|
|
2671
2669
|
let r = this.points[0];
|
|
2672
|
-
if (
|
|
2670
|
+
if (u(t, d(p("circle"), {
|
|
2673
2671
|
cx: r.x,
|
|
2674
2672
|
cy: r.y,
|
|
2675
2673
|
r: this.points.length >= 3 ? 5 : 3,
|
|
2676
|
-
fill:
|
|
2677
|
-
stroke:
|
|
2674
|
+
fill: y.paper,
|
|
2675
|
+
stroke: y.ink,
|
|
2678
2676
|
"stroke-width": 1.5
|
|
2679
2677
|
})), this.points.length >= 2) {
|
|
2680
2678
|
let e = this.points[this.points.length - 1];
|
|
2681
|
-
|
|
2679
|
+
u(t, d(p("circle"), {
|
|
2682
2680
|
cx: e.x,
|
|
2683
2681
|
cy: e.y,
|
|
2684
2682
|
r: 5,
|
|
2685
|
-
fill:
|
|
2686
|
-
stroke:
|
|
2683
|
+
fill: y.paper,
|
|
2684
|
+
stroke: y.ink,
|
|
2687
2685
|
"stroke-width": 1.5
|
|
2688
2686
|
}));
|
|
2689
2687
|
}
|
|
2690
|
-
|
|
2688
|
+
u(e, t), this.layer = t;
|
|
2691
2689
|
}
|
|
2692
2690
|
clearPreview() {
|
|
2693
|
-
this.layer &&= (
|
|
2691
|
+
this.layer &&= (m(this.layer), null);
|
|
2694
2692
|
}
|
|
2695
2693
|
};
|
|
2696
|
-
function
|
|
2694
|
+
function Mn(e, t) {
|
|
2697
2695
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
2698
2696
|
}
|
|
2699
2697
|
//#endregion
|
|
2700
2698
|
//#region src/draw-tool/WardleyDrawingHandles.ts
|
|
2701
|
-
var
|
|
2699
|
+
var Nn = class {
|
|
2702
2700
|
eventBus;
|
|
2703
2701
|
canvas;
|
|
2704
2702
|
modeling;
|
|
@@ -2732,19 +2730,19 @@ var jn = class {
|
|
|
2732
2730
|
}
|
|
2733
2731
|
render() {
|
|
2734
2732
|
if (this.clear(), !this.shape) return;
|
|
2735
|
-
let e = this.canvas.getLayer("wardley-drawing-handles", 1100), t =
|
|
2733
|
+
let e = this.canvas.getLayer("wardley-drawing-handles", 1100), t = p("g");
|
|
2736
2734
|
this.absolutePoints().forEach((e, n) => {
|
|
2737
|
-
let r =
|
|
2735
|
+
let r = d(p("circle"), {
|
|
2738
2736
|
cx: e.x,
|
|
2739
2737
|
cy: e.y,
|
|
2740
2738
|
r: 5,
|
|
2741
|
-
fill:
|
|
2742
|
-
stroke:
|
|
2739
|
+
fill: y.paper,
|
|
2740
|
+
stroke: y.ink,
|
|
2743
2741
|
"stroke-width": 1.5,
|
|
2744
2742
|
class: "wardley-drawing-handle"
|
|
2745
2743
|
});
|
|
2746
|
-
r.addEventListener("mousedown", (e) => this.startDrag(e, n)),
|
|
2747
|
-
}),
|
|
2744
|
+
r.addEventListener("mousedown", (e) => this.startDrag(e, n)), u(t, r);
|
|
2745
|
+
}), u(e, t), this.group = t;
|
|
2748
2746
|
}
|
|
2749
2747
|
startDrag(e, t) {
|
|
2750
2748
|
if (e.button !== 0 || !this.shape) return;
|
|
@@ -2773,21 +2771,21 @@ var jn = class {
|
|
|
2773
2771
|
}
|
|
2774
2772
|
renderDragPreview(e, t) {
|
|
2775
2773
|
this.clearDragPreview();
|
|
2776
|
-
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"), {
|
|
2777
2775
|
points: e.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2778
2776
|
fill: "none",
|
|
2779
|
-
stroke:
|
|
2777
|
+
stroke: y.ink,
|
|
2780
2778
|
"stroke-width": 1.5,
|
|
2781
2779
|
"stroke-dasharray": "5 4",
|
|
2782
2780
|
"pointer-events": "none"
|
|
2783
2781
|
});
|
|
2784
|
-
|
|
2782
|
+
u(n, r), this.dragPreview = r;
|
|
2785
2783
|
}
|
|
2786
2784
|
clearDragPreview() {
|
|
2787
|
-
this.dragPreview &&= (
|
|
2785
|
+
this.dragPreview &&= (m(this.dragPreview), null);
|
|
2788
2786
|
}
|
|
2789
2787
|
clear() {
|
|
2790
|
-
this.clearDragPreview(), this.group &&= (
|
|
2788
|
+
this.clearDragPreview(), this.group &&= (m(this.group), null);
|
|
2791
2789
|
}
|
|
2792
2790
|
toCanvasPoint(e) {
|
|
2793
2791
|
let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = this.canvas.zoom();
|
|
@@ -2799,70 +2797,71 @@ var jn = class {
|
|
|
2799
2797
|
};
|
|
2800
2798
|
//#endregion
|
|
2801
2799
|
//#region src/draw-tool/WardleyDrawingHitProvider.ts
|
|
2802
|
-
function
|
|
2800
|
+
function Pn(e) {
|
|
2803
2801
|
return S(e) && e.wardleyType === "drawing";
|
|
2804
2802
|
}
|
|
2805
|
-
var
|
|
2803
|
+
var Fn = class {
|
|
2806
2804
|
static $inject = ["eventBus", "interactionEvents"];
|
|
2807
2805
|
constructor(e, t) {
|
|
2808
2806
|
e.on("interactionEvents.createHit", (e) => {
|
|
2809
|
-
if (
|
|
2807
|
+
if (Pn(e.element) && e.gfx) return In(e.element, e.gfx), !1;
|
|
2810
2808
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
2811
|
-
if (
|
|
2809
|
+
if (Pn(e.element) && e.gfx) return t.removeHits(e.gfx), In(e.element, e.gfx), !1;
|
|
2812
2810
|
});
|
|
2813
2811
|
}
|
|
2814
2812
|
};
|
|
2815
|
-
function
|
|
2816
|
-
let n = e.drawingPoints ?? [], r =
|
|
2817
|
-
|
|
2813
|
+
function In(e, t) {
|
|
2814
|
+
let n = e.drawingPoints ?? [], r = p(e.closed ? "polygon" : "polyline");
|
|
2815
|
+
d(r, {
|
|
2818
2816
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2819
2817
|
class: "djs-hit djs-hit-stroke",
|
|
2820
2818
|
fill: "none",
|
|
2821
2819
|
stroke: "white",
|
|
2822
2820
|
"stroke-width": 15,
|
|
2823
2821
|
"stroke-opacity": 0
|
|
2824
|
-
}),
|
|
2822
|
+
}), u(t, r);
|
|
2825
2823
|
}
|
|
2826
2824
|
//#endregion
|
|
2827
2825
|
//#region src/draw-tool/index.ts
|
|
2828
|
-
var
|
|
2826
|
+
var Ln = {
|
|
2829
2827
|
__init__: [
|
|
2830
2828
|
"wardleyDrawTool",
|
|
2831
2829
|
"wardleyDrawingHandles",
|
|
2832
2830
|
"wardleyDrawingHitProvider"
|
|
2833
2831
|
],
|
|
2834
|
-
wardleyDrawTool: ["type",
|
|
2835
|
-
wardleyDrawingHandles: ["type",
|
|
2836
|
-
wardleyDrawingHitProvider: ["type",
|
|
2837
|
-
},
|
|
2832
|
+
wardleyDrawTool: ["type", jn],
|
|
2833
|
+
wardleyDrawingHandles: ["type", Nn],
|
|
2834
|
+
wardleyDrawingHitProvider: ["type", Fn]
|
|
2835
|
+
}, Rn = class extends It {
|
|
2838
2836
|
_getModules() {
|
|
2839
2837
|
return [
|
|
2840
2838
|
...super._getModules(),
|
|
2841
2839
|
oe,
|
|
2840
|
+
O,
|
|
2842
2841
|
de,
|
|
2843
2842
|
se,
|
|
2844
|
-
|
|
2843
|
+
h,
|
|
2845
2844
|
ce,
|
|
2846
2845
|
le,
|
|
2847
2846
|
ue,
|
|
2848
2847
|
fe,
|
|
2849
2848
|
pe,
|
|
2850
2849
|
me,
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2850
|
+
Yt,
|
|
2851
|
+
en,
|
|
2852
|
+
He,
|
|
2853
|
+
nn,
|
|
2854
|
+
an,
|
|
2855
|
+
ln,
|
|
2856
|
+
fn,
|
|
2857
|
+
vn,
|
|
2858
|
+
Cn,
|
|
2856
2859
|
cn,
|
|
2857
|
-
dn,
|
|
2858
|
-
_n,
|
|
2859
|
-
xn,
|
|
2860
|
-
sn,
|
|
2861
|
-
wn,
|
|
2862
2860
|
En,
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2861
|
+
On,
|
|
2862
|
+
Xt,
|
|
2863
|
+
kn,
|
|
2864
|
+
Ln
|
|
2866
2865
|
];
|
|
2867
2866
|
}
|
|
2868
2867
|
undo() {
|
|
@@ -2879,6 +2878,6 @@ var Fn = {
|
|
|
2879
2878
|
}
|
|
2880
2879
|
};
|
|
2881
2880
|
//#endregion
|
|
2882
|
-
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 };
|
|
2883
2882
|
|
|
2884
2883
|
//# sourceMappingURL=index.js.map
|