@miragon/wardley-renderer 0.15.0 → 0.16.1
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/README.md +90 -198
- package/dist/WardleyBaseViewer.d.ts +19 -0
- package/dist/WardleyBaseViewer.d.ts.map +1 -1
- package/dist/collaborative/CollaborativeWardley.d.ts +8 -1
- package/dist/collaborative/CollaborativeWardley.d.ts.map +1 -1
- package/dist/context-pad/WardleyContextPadProvider.d.ts +10 -1
- package/dist/context-pad/WardleyContextPadProvider.d.ts.map +1 -1
- package/dist/draw/WardleyRenderer.d.ts +9 -1
- package/dist/draw/WardleyRenderer.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +2 -1
- package/dist/draw/lucide.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +7 -0
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/index.js +1031 -957
- package/dist/index.js.map +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/link-editing/WardleyLinkOpener.d.ts +24 -0
- package/dist/link-editing/WardleyLinkOpener.d.ts.map +1 -0
- package/dist/link-editing/index.d.ts +4 -2
- package/dist/link-editing/index.d.ts.map +1 -1
- package/dist/link-editing/link-url.d.ts +14 -0
- package/dist/link-editing/link-url.d.ts.map +1 -1
- package/dist/wardley.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -56,12 +56,12 @@ var O = {
|
|
|
56
56
|
marginTop: 38,
|
|
57
57
|
marginRight: 44,
|
|
58
58
|
marginBottom: 58
|
|
59
|
-
}, Fe = 7.5;
|
|
60
|
-
function
|
|
59
|
+
}, Fe = "wardley-link-badge", Ie = 7.5;
|
|
60
|
+
function Le(e) {
|
|
61
61
|
let t = (e && e.length ? e : "note").split("\n"), n = Math.max(1, ...t.map((e) => e.length));
|
|
62
62
|
return {
|
|
63
63
|
lines: t,
|
|
64
|
-
width: Math.max(34, Math.round(n *
|
|
64
|
+
width: Math.max(34, Math.round(n * Ie) + 16),
|
|
65
65
|
height: Math.max(34, t.length * 17 + 12)
|
|
66
66
|
};
|
|
67
67
|
}
|
|
@@ -93,7 +93,7 @@ var A = {
|
|
|
93
93
|
plotBackground: O.weiss,
|
|
94
94
|
accelerator: A.success,
|
|
95
95
|
deaccelerator: A.danger
|
|
96
|
-
},
|
|
96
|
+
}, Re = [
|
|
97
97
|
{
|
|
98
98
|
id: "green",
|
|
99
99
|
name: "Green · good",
|
|
@@ -134,7 +134,7 @@ var A = {
|
|
|
134
134
|
name: "Slate · neutral",
|
|
135
135
|
value: "#4A4A4A"
|
|
136
136
|
}
|
|
137
|
-
],
|
|
137
|
+
], ze = {
|
|
138
138
|
pioneers: {
|
|
139
139
|
fill: "rgba(51,93,229,0.07)",
|
|
140
140
|
stroke: O.blau
|
|
@@ -147,7 +147,7 @@ var A = {
|
|
|
147
147
|
fill: "rgba(0,230,118,0.10)",
|
|
148
148
|
stroke: A.success
|
|
149
149
|
}
|
|
150
|
-
},
|
|
150
|
+
}, Be = {
|
|
151
151
|
pioneers: "Pioneers",
|
|
152
152
|
settlers: "Settlers",
|
|
153
153
|
townplanners: "Town Planners"
|
|
@@ -158,11 +158,11 @@ var A = {
|
|
|
158
158
|
stage: 12
|
|
159
159
|
};
|
|
160
160
|
// src/io/saveSvg.ts
|
|
161
|
-
function
|
|
161
|
+
function Ve(e, t) {
|
|
162
162
|
let n = e.getContainer().querySelector(":scope > svg");
|
|
163
163
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
164
164
|
let r = n.cloneNode(!0);
|
|
165
|
-
r.querySelectorAll(".layer-wardley-map-resize").forEach((e) => e.remove()), r.querySelectorAll(".layer-wardley-drawing-handles").forEach((e) => e.remove()), r.querySelectorAll(".djs-outline, .layer-selectionOutline > *, .layer-resizers > *").forEach((e) => e.remove()), r.querySelectorAll(".selected, .hover").forEach((e) => {
|
|
165
|
+
r.querySelectorAll(".layer-wardley-map-resize").forEach((e) => e.remove()), r.querySelectorAll(".layer-wardley-drawing-handles").forEach((e) => e.remove()), r.querySelectorAll(`.${Fe}`).forEach((e) => e.remove()), r.querySelectorAll(".djs-outline, .layer-selectionOutline > *, .layer-resizers > *").forEach((e) => e.remove()), r.querySelectorAll(".selected, .hover").forEach((e) => {
|
|
166
166
|
e.classList.remove("selected", "hover"), e.classList.length || e.removeAttribute("class");
|
|
167
167
|
});
|
|
168
168
|
let i = t ?? {
|
|
@@ -182,19 +182,19 @@ function Be(e, t) {
|
|
|
182
182
|
return a && a.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
|
|
183
183
|
}
|
|
184
184
|
// src/io/exportBounds.ts
|
|
185
|
-
var
|
|
186
|
-
function
|
|
187
|
-
let r = [t.outerBounds()], i =
|
|
185
|
+
var He = "wardley-axes", Ue = 4;
|
|
186
|
+
function We(e, t, n = 12) {
|
|
187
|
+
let r = [t.outerBounds()], i = Ke(e);
|
|
188
188
|
i && r.push({
|
|
189
189
|
x: i.x - n,
|
|
190
190
|
y: i.y - n,
|
|
191
191
|
width: i.width + 2 * n,
|
|
192
192
|
height: i.height + 2 * n
|
|
193
193
|
});
|
|
194
|
-
let a =
|
|
194
|
+
let a = Ge(e);
|
|
195
195
|
a && r.push({
|
|
196
|
-
x: a.x -
|
|
197
|
-
y: a.y -
|
|
196
|
+
x: a.x - Ue,
|
|
197
|
+
y: a.y - Ue,
|
|
198
198
|
width: a.width + 8,
|
|
199
199
|
height: a.height + 8
|
|
200
200
|
});
|
|
@@ -206,9 +206,9 @@ function Ue(e, t, n = 12) {
|
|
|
206
206
|
height: l - s
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Ge(e) {
|
|
210
210
|
try {
|
|
211
|
-
let t = e.getContainer().querySelector(`.viewport > .layer-${
|
|
211
|
+
let t = e.getContainer().querySelector(`.viewport > .layer-${He}`);
|
|
212
212
|
if (!t) return;
|
|
213
213
|
let { x: n, y: r, width: i, height: a } = t.getBBox();
|
|
214
214
|
return i === 0 && a === 0 ? void 0 : {
|
|
@@ -221,7 +221,7 @@ function We(e) {
|
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Ke(e) {
|
|
225
225
|
let t = e.getActiveLayer();
|
|
226
226
|
if (t) try {
|
|
227
227
|
let e = t.getCTM();
|
|
@@ -257,15 +257,15 @@ function Ge(e) {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
// src/io/types.ts
|
|
260
|
-
var
|
|
260
|
+
var qe = "wardley-root", Je = {
|
|
261
261
|
top: 0,
|
|
262
262
|
right: 0,
|
|
263
263
|
bottom: 0,
|
|
264
264
|
left: 0
|
|
265
265
|
};
|
|
266
|
-
function
|
|
266
|
+
function Ye(e, t, n = Je) {
|
|
267
267
|
if (!(t.width > 0 && t.height > 0) || !(e.width > 0 && e.height > 0)) return;
|
|
268
|
-
let r =
|
|
268
|
+
let r = Xe(t.width, n.left, n.right), i = Xe(t.height, n.top, n.bottom), a = Math.min(1, r.extent / e.width, i.extent / e.height), o = {
|
|
269
269
|
x: e.x + e.width / 2 - (r.start + r.extent / 2) / a,
|
|
270
270
|
y: e.y + e.height / 2 - (i.start + i.extent / 2) / a,
|
|
271
271
|
width: t.width / a,
|
|
@@ -273,7 +273,7 @@ function Je(e, t, n = qe) {
|
|
|
273
273
|
};
|
|
274
274
|
return Object.values(o).every(Number.isFinite) ? o : void 0;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function Xe(e, t, n) {
|
|
277
277
|
let r = e - t - n;
|
|
278
278
|
return r > 0 ? {
|
|
279
279
|
start: t,
|
|
@@ -284,7 +284,7 @@ function Ye(e, t, n) {
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
// src/io/WardleyImporter.ts
|
|
287
|
-
var
|
|
287
|
+
var Ze = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Qe = {
|
|
288
288
|
attitude: 0,
|
|
289
289
|
pipeline: 1,
|
|
290
290
|
note: 2,
|
|
@@ -293,7 +293,7 @@ var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
|
293
293
|
annotation: 5,
|
|
294
294
|
submap: 3,
|
|
295
295
|
accelerator: 3
|
|
296
|
-
},
|
|
296
|
+
}, $e = class {
|
|
297
297
|
canvas;
|
|
298
298
|
elementFactory;
|
|
299
299
|
factory;
|
|
@@ -328,8 +328,8 @@ var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
|
328
328
|
r = void 0;
|
|
329
329
|
}
|
|
330
330
|
let i;
|
|
331
|
-
r && r.id === "wardley-root" ? i = r : (i = this.elementFactory.createRoot({ id:
|
|
332
|
-
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (
|
|
331
|
+
r && r.id === "wardley-root" ? i = r : (i = this.elementFactory.createRoot({ id: qe }), this.canvas.setRootElement(i)), i.businessObject = n, this.grid.render();
|
|
332
|
+
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (Qe[e.elementType] ?? 9) - (Qe[t.elementType] ?? 9)), s = o.filter((e) => Ze.has(e.elementType)), c = o.filter((e) => !Ze.has(e.elementType)), l = 0;
|
|
333
333
|
for (let e of s) {
|
|
334
334
|
let t = this.createShape(e);
|
|
335
335
|
t && (this.canvas.addShape(t, i), a.set(e.id, t), l++);
|
|
@@ -363,7 +363,7 @@ var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
|
363
363
|
}
|
|
364
364
|
fitPlot() {
|
|
365
365
|
let e = this.grid.outerBounds(), t = this.freeRect?.insets();
|
|
366
|
-
this.canvas.viewbox(
|
|
366
|
+
this.canvas.viewbox(Ye(e, this.canvas.getSize(), t) ?? e);
|
|
367
367
|
}
|
|
368
368
|
createShape(e) {
|
|
369
369
|
return this.factory.createFromModel(e);
|
|
@@ -379,15 +379,15 @@ var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
381
|
// src/model/di-types.ts
|
|
382
|
-
function
|
|
382
|
+
function et(e) {
|
|
383
383
|
return typeof e == "object" && !!e;
|
|
384
384
|
}
|
|
385
385
|
function N(e) {
|
|
386
|
-
return
|
|
386
|
+
return et(e) && typeof e.wardleyType == "string" && "evolution" in e;
|
|
387
387
|
}
|
|
388
|
-
var
|
|
388
|
+
var tt = /* @__PURE__ */ new Set(["dependency", "flow"]);
|
|
389
389
|
function P(e) {
|
|
390
|
-
return
|
|
390
|
+
return et(e) && tt.has(e.wardleyType);
|
|
391
391
|
}
|
|
392
392
|
function F(e) {
|
|
393
393
|
return N(e) && e.wardleyType === "component";
|
|
@@ -395,16 +395,16 @@ function F(e) {
|
|
|
395
395
|
function I(e) {
|
|
396
396
|
return N(e) && e.wardleyType === "pipeline";
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function nt(e) {
|
|
399
399
|
return N(e) && e.wardleyType === "attitude";
|
|
400
400
|
}
|
|
401
401
|
// src/io/WardleyExporter.ts
|
|
402
|
-
function
|
|
402
|
+
function rt(e) {
|
|
403
403
|
let t = {};
|
|
404
404
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
405
405
|
return t;
|
|
406
406
|
}
|
|
407
|
-
var
|
|
407
|
+
var it = class {
|
|
408
408
|
elementRegistry;
|
|
409
409
|
canvas;
|
|
410
410
|
grid;
|
|
@@ -471,7 +471,7 @@ var rt = class {
|
|
|
471
471
|
evolution: e.evolution
|
|
472
472
|
}, r = e.businessObject, { movement: i, labelOffset: a } = t ?? e;
|
|
473
473
|
switch (e.wardleyType) {
|
|
474
|
-
case "component": return
|
|
474
|
+
case "component": return rt({
|
|
475
475
|
id: e.id,
|
|
476
476
|
elementType: "component",
|
|
477
477
|
label: e.wardleyLabel,
|
|
@@ -483,7 +483,7 @@ var rt = class {
|
|
|
483
483
|
url: r?.url,
|
|
484
484
|
color: e.color
|
|
485
485
|
});
|
|
486
|
-
case "anchor": return
|
|
486
|
+
case "anchor": return rt({
|
|
487
487
|
id: e.id,
|
|
488
488
|
elementType: "anchor",
|
|
489
489
|
label: e.wardleyLabel,
|
|
@@ -491,7 +491,7 @@ var rt = class {
|
|
|
491
491
|
labelOffset: a ?? r?.labelOffset,
|
|
492
492
|
color: e.color
|
|
493
493
|
});
|
|
494
|
-
case "note": return
|
|
494
|
+
case "note": return rt({
|
|
495
495
|
id: e.id,
|
|
496
496
|
elementType: "note",
|
|
497
497
|
label: e.wardleyLabel,
|
|
@@ -542,7 +542,7 @@ var rt = class {
|
|
|
542
542
|
...e.color ? { color: e.color } : {}
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
case "submap": return
|
|
545
|
+
case "submap": return rt({
|
|
546
546
|
id: e.id,
|
|
547
547
|
elementType: "submap",
|
|
548
548
|
label: e.wardleyLabel,
|
|
@@ -572,7 +572,7 @@ var rt = class {
|
|
|
572
572
|
} : void 0;
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
},
|
|
575
|
+
}, at = class {
|
|
576
576
|
static $inject = ["eventBus"];
|
|
577
577
|
elementIndex = /* @__PURE__ */ new Map();
|
|
578
578
|
edgeIndex = /* @__PURE__ */ new Map();
|
|
@@ -586,13 +586,13 @@ var rt = class {
|
|
|
586
586
|
this.elementIndex = new Map(e.elements.map((e, t) => [e.id, t])), this.edgeIndex = new Map(e.edges.map((e, t) => [e.id, t]));
|
|
587
587
|
}
|
|
588
588
|
sortElements(e) {
|
|
589
|
-
return
|
|
589
|
+
return ot(e, this.elementIndex);
|
|
590
590
|
}
|
|
591
591
|
sortEdges(e) {
|
|
592
|
-
return
|
|
592
|
+
return ot(e, this.edgeIndex);
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
|
-
function
|
|
595
|
+
function ot(e, t) {
|
|
596
596
|
let n = (e) => t.get(e.id) ?? Infinity;
|
|
597
597
|
return [...e].sort((e, t) => {
|
|
598
598
|
let r = n(e), i = n(t);
|
|
@@ -600,21 +600,21 @@ function at(e, t) {
|
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
602
|
// src/io/blobToBase64.ts
|
|
603
|
-
function
|
|
603
|
+
function st(e) {
|
|
604
604
|
return new Promise((t, n) => {
|
|
605
605
|
let r = new FileReader();
|
|
606
606
|
r.onload = () => t(String(r.result).split(",")[1] ?? ""), r.onerror = () => n(/* @__PURE__ */ Error("Could not read the export blob.")), r.readAsDataURL(e);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
// src/io/index.ts
|
|
610
|
-
var
|
|
610
|
+
var ct = {
|
|
611
611
|
__init__: ["wardleySourceOrder"],
|
|
612
|
-
wardleySourceOrder: ["type",
|
|
613
|
-
wardleyImporter: ["type",
|
|
614
|
-
wardleyExporter: ["type",
|
|
612
|
+
wardleySourceOrder: ["type", at],
|
|
613
|
+
wardleyImporter: ["type", $e],
|
|
614
|
+
wardleyExporter: ["type", it]
|
|
615
615
|
};
|
|
616
616
|
// src/map-resize/MapProjection.ts
|
|
617
|
-
function
|
|
617
|
+
function lt(e, t) {
|
|
618
618
|
let { size: n, ...r } = e;
|
|
619
619
|
return t ? {
|
|
620
620
|
...r,
|
|
@@ -624,13 +624,13 @@ function ct(e, t) {
|
|
|
624
624
|
}
|
|
625
625
|
} : r;
|
|
626
626
|
}
|
|
627
|
-
function lt(e) {
|
|
628
|
-
return e.getRootElements().find((e) => e.id === Ke);
|
|
629
|
-
}
|
|
630
627
|
function ut(e) {
|
|
628
|
+
return e.getRootElements().find((e) => e.id === qe);
|
|
629
|
+
}
|
|
630
|
+
function dt(e) {
|
|
631
631
|
return re(e, "size");
|
|
632
632
|
}
|
|
633
|
-
var
|
|
633
|
+
var ft = class {
|
|
634
634
|
canvas;
|
|
635
635
|
elementRegistry;
|
|
636
636
|
grid;
|
|
@@ -653,7 +653,7 @@ var dt = class {
|
|
|
653
653
|
this.canvas = e, this.elementRegistry = t, this.grid = n, this.factory = r, this.exporter = i, this.layouter = a, this.eventBus = o, this.livePreview = s;
|
|
654
654
|
}
|
|
655
655
|
root() {
|
|
656
|
-
let e =
|
|
656
|
+
let e = ut(this.canvas);
|
|
657
657
|
return e?.businessObject ? e : void 0;
|
|
658
658
|
}
|
|
659
659
|
captureModel() {
|
|
@@ -668,7 +668,7 @@ var dt = class {
|
|
|
668
668
|
let t = this.elementRegistry.get(e.id);
|
|
669
669
|
if (!N(t)) continue;
|
|
670
670
|
let n = this.factory.createFromModel(e);
|
|
671
|
-
n && (
|
|
671
|
+
n && (pt(t, n), i.push(t));
|
|
672
672
|
}
|
|
673
673
|
return i.push(...this.layoutConnections()), this.fireConfigChanged(e.config, n.transient === !0), i;
|
|
674
674
|
}
|
|
@@ -699,7 +699,7 @@ var dt = class {
|
|
|
699
699
|
let i = [];
|
|
700
700
|
for (let [t, n] of e.shapes) {
|
|
701
701
|
let e = this.elementRegistry.get(t);
|
|
702
|
-
N(e) && (
|
|
702
|
+
N(e) && (pt(e, n), i.push(e));
|
|
703
703
|
}
|
|
704
704
|
for (let [t, n] of e.waypoints) {
|
|
705
705
|
let e = this.elementRegistry.get(t);
|
|
@@ -711,7 +711,7 @@ var dt = class {
|
|
|
711
711
|
let t = this.root()?.businessObject;
|
|
712
712
|
return t && {
|
|
713
713
|
...t,
|
|
714
|
-
config:
|
|
714
|
+
config: lt(t.config, e)
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
fireConfigChanged(e, t) {
|
|
@@ -729,7 +729,7 @@ var dt = class {
|
|
|
729
729
|
return e;
|
|
730
730
|
}
|
|
731
731
|
};
|
|
732
|
-
function
|
|
732
|
+
function pt(e, t) {
|
|
733
733
|
e.x = t.x, e.y = t.y, e.width = t.width, e.height = t.height, t.drawingPoints && (e.drawingPoints = t.drawingPoints.map((e) => ({ ...e })));
|
|
734
734
|
}
|
|
735
735
|
// src/live-preview/LivePreview.ts
|
|
@@ -737,7 +737,7 @@ var L = [
|
|
|
737
737
|
"commandStack.preExecute",
|
|
738
738
|
"commandStack.execute",
|
|
739
739
|
"commandStack.revert"
|
|
740
|
-
],
|
|
740
|
+
], mt = 1e4, ht = { wardleyLivePreview: ["type", class {
|
|
741
741
|
eventBus;
|
|
742
742
|
exporter;
|
|
743
743
|
static $inject = ["eventBus", "wardleyExporter"];
|
|
@@ -786,7 +786,7 @@ var L = [
|
|
|
786
786
|
config: t
|
|
787
787
|
};
|
|
788
788
|
}
|
|
789
|
-
}] },
|
|
789
|
+
}] }, gt = "wardley.readOnly.changed", _t = "wardley-read-only", vt = 5e3, yt = [
|
|
790
790
|
"elements.move",
|
|
791
791
|
"shape.move",
|
|
792
792
|
"shape.create",
|
|
@@ -801,7 +801,7 @@ var L = [
|
|
|
801
801
|
"connection.reconnectEnd",
|
|
802
802
|
"connection.updateWaypoints",
|
|
803
803
|
"elements.delete"
|
|
804
|
-
],
|
|
804
|
+
], bt = class extends se {
|
|
805
805
|
bus;
|
|
806
806
|
canvas;
|
|
807
807
|
injector;
|
|
@@ -817,7 +817,7 @@ var L = [
|
|
|
817
817
|
super(e), this.bus = e, this.canvas = t, this.injector = n, e.on("diagram.destroy", () => this.stopShowTimer());
|
|
818
818
|
}
|
|
819
819
|
init() {
|
|
820
|
-
this.addRule(
|
|
820
|
+
this.addRule(yt, vt, () => !this.locked && void 0);
|
|
821
821
|
}
|
|
822
822
|
isReadOnly() {
|
|
823
823
|
return this.locked;
|
|
@@ -828,11 +828,11 @@ var L = [
|
|
|
828
828
|
setReadOnly(e, t) {
|
|
829
829
|
if (!e) {
|
|
830
830
|
if (this.stopShowTimer(), !this.locked) return;
|
|
831
|
-
this.locked = !1, this.shown = !1, this.outerContainer().classList.remove(
|
|
831
|
+
this.locked = !1, this.shown = !1, this.outerContainer().classList.remove(_t), this.announce();
|
|
832
832
|
return;
|
|
833
833
|
}
|
|
834
834
|
let n = !this.locked;
|
|
835
|
-
n && (this.locked = !0, this.outerContainer().classList.add(
|
|
835
|
+
n && (this.locked = !0, this.outerContainer().classList.add(_t), this.endInteractions());
|
|
836
836
|
let r = t?.delayMs ?? 0, i = this.shown || this.showTimer !== void 0;
|
|
837
837
|
!i && r > 0 && (this.showTimer = setTimeout(() => {
|
|
838
838
|
this.showTimer = void 0, this.shown = !0, this.announce();
|
|
@@ -841,7 +841,7 @@ var L = [
|
|
|
841
841
|
a && (this.shown = !0), (n || a) && this.announce();
|
|
842
842
|
}
|
|
843
843
|
announce() {
|
|
844
|
-
this.bus.fire(
|
|
844
|
+
this.bus.fire(gt, {
|
|
845
845
|
readOnly: this.locked,
|
|
846
846
|
shown: this.shown
|
|
847
847
|
});
|
|
@@ -866,104 +866,104 @@ var L = [
|
|
|
866
866
|
let e = this.canvas.getContainer();
|
|
867
867
|
return e.closest(".wardley-container") ?? e;
|
|
868
868
|
}
|
|
869
|
-
},
|
|
869
|
+
}, xt = {
|
|
870
870
|
__init__: ["wardleyReadOnly"],
|
|
871
|
-
wardleyReadOnly: ["type",
|
|
871
|
+
wardleyReadOnly: ["type", bt]
|
|
872
872
|
};
|
|
873
|
-
function
|
|
873
|
+
function R(e) {
|
|
874
874
|
return e.get("wardleyReadOnly", !1)?.isReadOnly() === !0;
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function St(e) {
|
|
877
877
|
return e.get("wardleyReadOnly", !1)?.isReadOnlyShown() === !0;
|
|
878
878
|
}
|
|
879
879
|
// src/a11y/canvasFocus.ts
|
|
880
|
-
function
|
|
880
|
+
function Ct(e) {
|
|
881
881
|
return e._svg ?? e.getContainer().querySelector(":scope > svg");
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function wt(e, t) {
|
|
884
884
|
let n = e.target;
|
|
885
|
-
return typeof e.key == "string" && !e.defaultPrevented && !e.isComposing && n instanceof Node && !!t?.contains(n) && !
|
|
885
|
+
return typeof e.key == "string" && !e.defaultPrevented && !e.isComposing && n instanceof Node && !!t?.contains(n) && !Dt(n) && kt(t);
|
|
886
886
|
}
|
|
887
|
-
function
|
|
887
|
+
function z(e) {
|
|
888
888
|
let t = e.target;
|
|
889
|
-
return t instanceof Node && (
|
|
889
|
+
return t instanceof Node && (Dt(t) || !kt(t));
|
|
890
890
|
}
|
|
891
|
-
var
|
|
892
|
-
function
|
|
893
|
-
if (
|
|
894
|
-
|
|
891
|
+
var Tt = /* @__PURE__ */ new WeakSet();
|
|
892
|
+
function Et(e) {
|
|
893
|
+
if (Tt.has(e)) return;
|
|
894
|
+
Tt.add(e);
|
|
895
895
|
let t = e.trigger.bind(e);
|
|
896
|
-
e.trigger = (e, n, r) =>
|
|
896
|
+
e.trigger = (e, n, r) => z(e) ? void 0 : t(e, n, r);
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function Dt(e) {
|
|
899
899
|
return !!(e instanceof Element ? e : e.parentElement)?.closest("[inert]");
|
|
900
900
|
}
|
|
901
|
-
function
|
|
902
|
-
return
|
|
901
|
+
function Ot(e, t) {
|
|
902
|
+
return wt(e, Ct(t));
|
|
903
903
|
}
|
|
904
|
-
function
|
|
904
|
+
function kt(e) {
|
|
905
905
|
return !(e instanceof Element) || typeof e.checkVisibility != "function" || e.checkVisibility({ visibilityProperty: !0 });
|
|
906
906
|
}
|
|
907
|
-
function
|
|
908
|
-
let t =
|
|
907
|
+
function B(e) {
|
|
908
|
+
let t = Ct(e);
|
|
909
909
|
t ? t.focus({
|
|
910
910
|
preventScroll: !0,
|
|
911
911
|
focusVisible: !1
|
|
912
912
|
}) : e.focus();
|
|
913
913
|
}
|
|
914
|
-
var
|
|
915
|
-
function
|
|
916
|
-
|
|
917
|
-
e.target instanceof HTMLElement && e.target.closest("input, textarea") || (
|
|
914
|
+
var At = "pointer", jt = !1;
|
|
915
|
+
function Mt() {
|
|
916
|
+
jt || typeof document > "u" || (jt = !0, document.addEventListener("pointerdown", () => At = "pointer", !0), document.addEventListener("mousedown", () => At = "pointer", !0), document.addEventListener("keydown", (e) => {
|
|
917
|
+
e.target instanceof HTMLElement && e.target.closest("input, textarea") || (At = "keyboard");
|
|
918
918
|
}, !0));
|
|
919
919
|
}
|
|
920
|
-
function
|
|
921
|
-
return
|
|
920
|
+
function Nt() {
|
|
921
|
+
return At === "pointer";
|
|
922
922
|
}
|
|
923
923
|
// src/a11y/describeCanvas.ts
|
|
924
|
-
function
|
|
925
|
-
let t =
|
|
924
|
+
function Pt(e) {
|
|
925
|
+
let t = Ct(e);
|
|
926
926
|
t && (t.setAttribute("role", "application"), t.setAttribute("aria-roledescription", "Wardley map"), t.setAttribute("aria-label", "Map canvas"));
|
|
927
927
|
}
|
|
928
|
-
|
|
928
|
+
Pt.$inject = ["canvas"];
|
|
929
929
|
// src/a11y/index.ts
|
|
930
|
-
var
|
|
930
|
+
var Ft = { __init__: [Pt] }, It = "wardley.mapResize", Lt = "wardley-map-resize", Rt = -.5, zt = 10, Bt = 12, Vt = 8, Ht = 16, Ut = 10, Wt = 16, Gt = {
|
|
931
931
|
x: "ew-resize",
|
|
932
932
|
y: "ns-resize",
|
|
933
933
|
xy: "nwse-resize"
|
|
934
934
|
};
|
|
935
|
-
function
|
|
935
|
+
function Kt(e, t) {
|
|
936
936
|
return Math.round(e / t) * t;
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function qt(e, t, n) {
|
|
939
939
|
return e < t ? t : e > n ? n : e;
|
|
940
940
|
}
|
|
941
|
-
function
|
|
941
|
+
function Jt(e) {
|
|
942
942
|
return e.setAttribute("fill", "none"), e.setAttribute("stroke", "none"), e.setAttribute("opacity", "0"), e;
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function Yt(e, t, n, r, i = {
|
|
945
945
|
keepAspectRatio: !1,
|
|
946
946
|
disableSnapping: !1
|
|
947
947
|
}) {
|
|
948
|
-
let a = t === "y" ? e.width : e.width + n, o = t === "x" ? e.height : e.height + r, s = i.disableSnapping ? 1 :
|
|
948
|
+
let a = t === "y" ? e.width : e.width + n, o = t === "x" ? e.height : e.height + r, s = i.disableSnapping ? 1 : zt;
|
|
949
949
|
if (i.keepAspectRatio) {
|
|
950
950
|
let n = e.width / e.height;
|
|
951
|
-
return t === "x" || t === "xy" && Math.abs(a - e.width) / e.width >= Math.abs(o - e.height) / e.height ? (a =
|
|
951
|
+
return t === "x" || t === "xy" && Math.abs(a - e.width) / e.width >= Math.abs(o - e.height) / e.height ? (a = qt(Kt(a, s), p.width, d.width), o = a / n) : (o = qt(Kt(o, s), p.height, d.height), a = o * n), v(a, o);
|
|
952
952
|
}
|
|
953
953
|
if (!i.disableSnapping) {
|
|
954
|
-
let e = l.find((e) => Math.abs(a - e.width) <=
|
|
954
|
+
let e = l.find((e) => Math.abs(a - e.width) <= Bt && Math.abs(o - e.height) <= Bt);
|
|
955
955
|
if (e) return {
|
|
956
956
|
width: e.width,
|
|
957
957
|
height: e.height
|
|
958
958
|
};
|
|
959
959
|
}
|
|
960
|
-
return v(t === "y" ? a :
|
|
960
|
+
return v(t === "y" ? a : Kt(a, s), t === "x" ? o : Kt(o, s));
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Xt(e) {
|
|
963
963
|
let t = l.find((t) => t.width === e.width && t.height === e.height);
|
|
964
964
|
return `${e.width} × ${e.height}${t ? ` · ${t.name}` : ""}`;
|
|
965
965
|
}
|
|
966
|
-
var
|
|
966
|
+
var Zt = class {
|
|
967
967
|
canvas;
|
|
968
968
|
grid;
|
|
969
969
|
dragging;
|
|
@@ -984,16 +984,16 @@ var Yt = class {
|
|
|
984
984
|
badge;
|
|
985
985
|
scale;
|
|
986
986
|
constructor(e, t, n, r, i, a, o) {
|
|
987
|
-
this.canvas = t, this.grid = n, this.dragging = r, this.projection = i, this.modeling = a, this.injector = o, this.layer = D("g", { class: "wardley-map-resize" }), T(t.getLayer(
|
|
987
|
+
this.canvas = t, this.grid = n, this.dragging = r, this.projection = i, this.modeling = a, this.injector = o, this.layer = D("g", { class: "wardley-map-resize" }), T(t.getLayer(Lt, Rt), this.layer), this.handles = {
|
|
988
988
|
x: this.createHandle("x"),
|
|
989
989
|
y: this.createHandle("y"),
|
|
990
990
|
xy: this.createHandle("xy")
|
|
991
991
|
}, this.handles.xy.group.addEventListener("dblclick", (e) => {
|
|
992
|
-
e.stopPropagation(), e.preventDefault(), !
|
|
992
|
+
e.stopPropagation(), e.preventDefault(), !R(this.injector) && this.modeling.resizeMap(void 0);
|
|
993
993
|
}), e.on(["import.done", "wardley.config.changed"], () => this.render()), e.on("canvas.viewbox.changed", (e) => {
|
|
994
994
|
let t = e.viewbox?.scale;
|
|
995
995
|
t !== this.scale && (this.scale = t, this.render());
|
|
996
|
-
}), e.on(`${
|
|
996
|
+
}), e.on(`${It}.start`, (e) => this.onStart(e)), e.on(`${It}.move`, (e) => this.onMove(e)), e.on(`${It}.end`, (e) => this.onEnd(e)), e.on(`${It}.cleanup`, (e) => this.onCleanup(e)), e.on(L, mt, () => this.cancelPreviewingDrag()), this.render();
|
|
997
997
|
}
|
|
998
998
|
cancelPreviewingDrag() {
|
|
999
999
|
let e = this.dragging.context();
|
|
@@ -1002,13 +1002,13 @@ var Yt = class {
|
|
|
1002
1002
|
t?.snapshot && !t.committed && this.dragging.cancel(!0);
|
|
1003
1003
|
}
|
|
1004
1004
|
start(e, t) {
|
|
1005
|
-
if (
|
|
1005
|
+
if (R(this.injector)) return;
|
|
1006
1006
|
let n = {
|
|
1007
1007
|
axis: t,
|
|
1008
1008
|
startSize: this.grid.getPlotSize()
|
|
1009
1009
|
};
|
|
1010
|
-
this.dragging.init(e,
|
|
1011
|
-
cursor:
|
|
1010
|
+
this.dragging.init(e, It, {
|
|
1011
|
+
cursor: Gt[t],
|
|
1012
1012
|
keepSelection: !0,
|
|
1013
1013
|
data: { context: n }
|
|
1014
1014
|
});
|
|
@@ -1017,9 +1017,9 @@ var Yt = class {
|
|
|
1017
1017
|
let t = D("g", {
|
|
1018
1018
|
class: `wardley-map-resize-handle wardley-map-resize-${e}`,
|
|
1019
1019
|
"data-axis": e
|
|
1020
|
-
}), n =
|
|
1020
|
+
}), n = Jt(D(e === "xy" ? "rect" : "line", { class: "wardley-map-resize-visual" })), r = Jt(D("rect", { class: "wardley-map-resize-hit" }));
|
|
1021
1021
|
return T(t, n), T(t, r), T(this.layer, t), t.addEventListener("mousedown", (t) => {
|
|
1022
|
-
t.button !== 0 || this.dragging.context() || (t.stopPropagation(), t.preventDefault(),
|
|
1022
|
+
t.button !== 0 || this.dragging.context() || (t.stopPropagation(), t.preventDefault(), B(this.canvas), this.start(t, e));
|
|
1023
1023
|
}), {
|
|
1024
1024
|
group: t,
|
|
1025
1025
|
hit: r,
|
|
@@ -1029,7 +1029,7 @@ var Yt = class {
|
|
|
1029
1029
|
render() {
|
|
1030
1030
|
let e = this.projection.root() !== void 0;
|
|
1031
1031
|
if (E(this.layer, { display: e ? "inline" : "none" }), !e) return;
|
|
1032
|
-
let { width: t, height: n } = this.grid.getPlotSize(), r = k.marginLeft, i = k.marginTop, a = r + t, o = i + n, s = 1 / this.currentScale(), c =
|
|
1032
|
+
let { width: t, height: n } = this.grid.getPlotSize(), r = k.marginLeft, i = k.marginTop, a = r + t, o = i + n, s = 1 / this.currentScale(), c = Vt * s, l = c / 2, u = Ht * s, d = u / 2, f = Ut * s;
|
|
1033
1033
|
E(this.handles.x.hit, {
|
|
1034
1034
|
x: a - l,
|
|
1035
1035
|
y: i,
|
|
@@ -1077,7 +1077,7 @@ var Yt = class {
|
|
|
1077
1077
|
onMove(e) {
|
|
1078
1078
|
let t = e.context;
|
|
1079
1079
|
if (!t.snapshot || !t.model) return;
|
|
1080
|
-
let n =
|
|
1080
|
+
let n = Yt(t.startSize, t.axis, e.dx, e.dy, {
|
|
1081
1081
|
keepAspectRatio: e.originalEvent?.shiftKey === !0,
|
|
1082
1082
|
disableSnapping: e.originalEvent?.altKey === !0
|
|
1083
1083
|
});
|
|
@@ -1099,15 +1099,15 @@ var Yt = class {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
showBadge(e, t) {
|
|
1101
1101
|
let n = this.canvas.getContainer();
|
|
1102
|
-
if (this.badge || (this.badge = document.createElement("div"), this.badge.className = "wardley-map-resize-badge", this.badge.setAttribute("role", "status"), n.appendChild(this.badge)), this.badge.textContent =
|
|
1102
|
+
if (this.badge || (this.badge = document.createElement("div"), this.badge.className = "wardley-map-resize-badge", this.badge.setAttribute("role", "status"), n.appendChild(this.badge)), this.badge.textContent = Xt(e), this.badge.hidden = !1, t) {
|
|
1103
1103
|
let e = n.getBoundingClientRect();
|
|
1104
|
-
this.badge.style.left = `${t.clientX - e.left +
|
|
1104
|
+
this.badge.style.left = `${t.clientX - e.left + Wt}px`, this.badge.style.top = `${t.clientY - e.top + Wt}px`;
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
hideBadge() {
|
|
1108
1108
|
this.badge && (this.badge.hidden = !0);
|
|
1109
1109
|
}
|
|
1110
|
-
},
|
|
1110
|
+
}, Qt = class extends ce {
|
|
1111
1111
|
injector;
|
|
1112
1112
|
static $inject = [
|
|
1113
1113
|
"config.autoScroll",
|
|
@@ -1121,17 +1121,17 @@ var Yt = class {
|
|
|
1121
1121
|
startScroll(e) {
|
|
1122
1122
|
this.injector.get("dragging", !1)?.context()?.prefix === "wardley.mapResize" ? this.stopScroll() : super.startScroll(e);
|
|
1123
1123
|
}
|
|
1124
|
-
},
|
|
1125
|
-
__depends__: [
|
|
1126
|
-
wardleyMapProjection: ["type",
|
|
1127
|
-
},
|
|
1128
|
-
__depends__: [ie,
|
|
1124
|
+
}, $t = {
|
|
1125
|
+
__depends__: [ht],
|
|
1126
|
+
wardleyMapProjection: ["type", ft]
|
|
1127
|
+
}, en = {
|
|
1128
|
+
__depends__: [ie, $t],
|
|
1129
1129
|
__init__: ["mapResizeHandles"],
|
|
1130
|
-
mapResizeHandles: ["type",
|
|
1130
|
+
mapResizeHandles: ["type", Zt]
|
|
1131
1131
|
};
|
|
1132
1132
|
// src/modeling/cmd/UpdateConfigHandler.ts
|
|
1133
|
-
function
|
|
1134
|
-
let a =
|
|
1133
|
+
function tn(e, t, n, r, i = {}) {
|
|
1134
|
+
let a = ut(e);
|
|
1135
1135
|
if (!a?.businessObject) return {};
|
|
1136
1136
|
let o = {}, s = { ...a.businessObject.config };
|
|
1137
1137
|
for (let [e, t] of Object.entries(r)) e !== "size" && (o[e] = s[e], t === void 0 ? delete s[e] : s[e] = t);
|
|
@@ -1144,7 +1144,7 @@ function $t(e, t, n, r, i = {}) {
|
|
|
1144
1144
|
...i.transient ? { transient: !0 } : {}
|
|
1145
1145
|
}), o;
|
|
1146
1146
|
}
|
|
1147
|
-
var
|
|
1147
|
+
var nn = class {
|
|
1148
1148
|
canvas;
|
|
1149
1149
|
grid;
|
|
1150
1150
|
eventBus;
|
|
@@ -1163,16 +1163,16 @@ var en = class {
|
|
|
1163
1163
|
return e.oldProperties && this.apply(e.oldProperties), [];
|
|
1164
1164
|
}
|
|
1165
1165
|
apply(e) {
|
|
1166
|
-
return
|
|
1166
|
+
return tn(this.canvas, this.grid, this.eventBus, e);
|
|
1167
1167
|
}
|
|
1168
|
-
},
|
|
1168
|
+
}, rn = "wardley.interaction.changed", an = /* @__PURE__ */ new Set(["lasso.selection"]), V = 1e5, on = [
|
|
1169
1169
|
"drag.init",
|
|
1170
1170
|
"drag.start",
|
|
1171
1171
|
"drag.end",
|
|
1172
1172
|
"drag.cancel",
|
|
1173
1173
|
"drag.cleanup",
|
|
1174
1174
|
...L
|
|
1175
|
-
],
|
|
1175
|
+
], sn = class {
|
|
1176
1176
|
eventBus;
|
|
1177
1177
|
static $inject = ["eventBus", "injector"];
|
|
1178
1178
|
gesture = null;
|
|
@@ -1184,7 +1184,7 @@ var en = class {
|
|
|
1184
1184
|
constructor(e, t) {
|
|
1185
1185
|
this.eventBus = e;
|
|
1186
1186
|
let n = t.get("dragging", !1);
|
|
1187
|
-
n && this.followDragging(n), e.on(L,
|
|
1187
|
+
n && this.followDragging(n), e.on(L, V, () => this.handlerRuns()), e.on(on, V, () => this.noteHandlerGoesOn()), e.on("diagram.destroy", () => {
|
|
1188
1188
|
clearTimeout(this.settling), this.settling = void 0, this.settled();
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
@@ -1217,10 +1217,10 @@ var en = class {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
followDragging(e) {
|
|
1219
1219
|
let t = () => e.context(), n = null, r = null;
|
|
1220
|
-
this.eventBus.on("drag.start",
|
|
1220
|
+
this.eventBus.on("drag.start", V, () => this.handlerRuns()), this.eventBus.on("drag.move", V, () => {
|
|
1221
1221
|
let e = t();
|
|
1222
|
-
e && e !== this.gesture && !
|
|
1223
|
-
}), this.eventBus.on("drag.end",
|
|
1222
|
+
e && e !== this.gesture && !an.has(e.prefix) && this.begin(e);
|
|
1223
|
+
}), this.eventBus.on("drag.end", V, () => {
|
|
1224
1224
|
let e = t();
|
|
1225
1225
|
e && e === this.gesture && (n = e, this.dropStarts());
|
|
1226
1226
|
});
|
|
@@ -1228,12 +1228,12 @@ var en = class {
|
|
|
1228
1228
|
let e = r;
|
|
1229
1229
|
r = null, e && (e === n ? (n = null, this.endDrop(() => this.end(e))) : this.end(e));
|
|
1230
1230
|
};
|
|
1231
|
-
this.eventBus.on("drag.cleanup",
|
|
1231
|
+
this.eventBus.on("drag.cleanup", V, () => {
|
|
1232
1232
|
let e = t();
|
|
1233
1233
|
r = e, queueMicrotask(() => {
|
|
1234
1234
|
r === e && i();
|
|
1235
1235
|
});
|
|
1236
|
-
}), this.eventBus.on(["drag.ended", "drag.canceled"],
|
|
1236
|
+
}), this.eventBus.on(["drag.ended", "drag.canceled"], V, i);
|
|
1237
1237
|
}
|
|
1238
1238
|
noteHandlerGoesOn() {
|
|
1239
1239
|
this.handlerGoesOn || (this.handlerGoesOn = !0, queueMicrotask(() => {
|
|
@@ -1267,35 +1267,44 @@ var en = class {
|
|
|
1267
1267
|
for (let e of this.waiting.splice(0)) e();
|
|
1268
1268
|
}
|
|
1269
1269
|
changed(e) {
|
|
1270
|
-
this.noteHandlerGoesOn(), this.eventBus.fire(
|
|
1270
|
+
this.noteHandlerGoesOn(), this.eventBus.fire(rn, { active: e });
|
|
1271
1271
|
}
|
|
1272
|
-
},
|
|
1272
|
+
}, cn = {
|
|
1273
1273
|
__init__: ["wardleyInteraction"],
|
|
1274
|
-
wardleyInteraction: ["type",
|
|
1274
|
+
wardleyInteraction: ["type", sn]
|
|
1275
1275
|
};
|
|
1276
1276
|
// src/WardleyBaseViewer.ts
|
|
1277
|
-
function
|
|
1278
|
-
let
|
|
1277
|
+
function ln(e) {
|
|
1278
|
+
let { openRelativeLink: t, openExternalLink: n, chooseLinkTarget: r } = e;
|
|
1279
|
+
if (t || n || r) return {
|
|
1280
|
+
...t ? { openRelative: t } : {},
|
|
1281
|
+
...n ? { openExternal: n } : {},
|
|
1282
|
+
...r ? { chooseTarget: r } : {}
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
function un(e) {
|
|
1286
|
+
let t = e.undoRedoKeys, n = e.freeArea ? e.freeArea.insets ? { insets: e.freeArea.insets } : { center: e.freeArea.center } : void 0, r = ln(e);
|
|
1279
1287
|
return {
|
|
1280
1288
|
...t === void 0 ? {} : { wardleyKeyboard: { undoRedo: t } },
|
|
1281
1289
|
...n ? { wardleyFreeRect: n } : {},
|
|
1282
|
-
...e.fitOnImport === !1 ? { wardleyImport: { fit: !1 } } : {}
|
|
1290
|
+
...e.fitOnImport === !1 ? { wardleyImport: { fit: !1 } } : {},
|
|
1291
|
+
...r ? { wardleyLinks: r } : {}
|
|
1283
1292
|
};
|
|
1284
1293
|
}
|
|
1285
|
-
var
|
|
1286
|
-
function
|
|
1287
|
-
let t = S(e), n = [...t.elements, ...t.edges].find(({ id: e }) => e === "wardley-root" || e.startsWith(
|
|
1294
|
+
var dn = "__implicitroot";
|
|
1295
|
+
function fn(e) {
|
|
1296
|
+
let t = S(e), n = [...t.elements, ...t.edges].find(({ id: e }) => e === "wardley-root" || e.startsWith(dn));
|
|
1288
1297
|
if (n) throw Error(`The id "${n.id}" is reserved for the canvas itself.`);
|
|
1289
1298
|
return t;
|
|
1290
1299
|
}
|
|
1291
|
-
function
|
|
1300
|
+
function pn(e) {
|
|
1292
1301
|
return typeof e == "number" ? `${e}px` : e;
|
|
1293
1302
|
}
|
|
1294
|
-
function
|
|
1303
|
+
function mn(e, t) {
|
|
1295
1304
|
let n = e.get("dragging", !1), r = n?.context();
|
|
1296
|
-
n && r && r !== t && (
|
|
1305
|
+
n && r && r !== t && (an.has(r.prefix) || n.cancel(!1));
|
|
1297
1306
|
}
|
|
1298
|
-
var
|
|
1307
|
+
var hn = class {
|
|
1299
1308
|
_diagram;
|
|
1300
1309
|
_container;
|
|
1301
1310
|
_options;
|
|
@@ -1307,7 +1316,7 @@ var fn = class {
|
|
|
1307
1316
|
}
|
|
1308
1317
|
_createContainer(e) {
|
|
1309
1318
|
let t = e.container ?? document.createElement("div");
|
|
1310
|
-
return t.classList.add("wardley-container"), t.style.width =
|
|
1319
|
+
return t.classList.add("wardley-container"), t.style.width = pn(e.width ?? "100%"), t.style.height = pn(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
1311
1320
|
}
|
|
1312
1321
|
_ensureDiagram() {
|
|
1313
1322
|
if (!this._diagram) {
|
|
@@ -1315,8 +1324,8 @@ var fn = class {
|
|
|
1315
1324
|
this._diagram = new t({
|
|
1316
1325
|
canvas: { container: this._container },
|
|
1317
1326
|
modules: e,
|
|
1318
|
-
...
|
|
1319
|
-
}), this._diagram.get("eventBus").on(L,
|
|
1327
|
+
...un(this._options)
|
|
1328
|
+
}), this._diagram.get("eventBus").on(L, mt, () => this._putBackSizePreview()), this._markDrops(this._diagram);
|
|
1320
1329
|
}
|
|
1321
1330
|
return this._diagram;
|
|
1322
1331
|
}
|
|
@@ -1324,9 +1333,9 @@ var fn = class {
|
|
|
1324
1333
|
let t = e.get("dragging", !1);
|
|
1325
1334
|
if (!t) return;
|
|
1326
1335
|
let n = e.get("eventBus");
|
|
1327
|
-
n.on("drag.end",
|
|
1336
|
+
n.on("drag.end", V, () => {
|
|
1328
1337
|
this._dropping = t.context();
|
|
1329
|
-
}), n.on("drag.cleanup",
|
|
1338
|
+
}), n.on("drag.cleanup", V, () => {
|
|
1330
1339
|
this._dropping = null;
|
|
1331
1340
|
});
|
|
1332
1341
|
}
|
|
@@ -1340,8 +1349,8 @@ var fn = class {
|
|
|
1340
1349
|
this.get("eventBus").off(e, t);
|
|
1341
1350
|
}
|
|
1342
1351
|
async importMap(e) {
|
|
1343
|
-
let t =
|
|
1344
|
-
this._labelsBeforePreview = void 0, this._sizePreview = void 0,
|
|
1352
|
+
let t = fn(e), n = this._ensureDiagram(), r = n.get("eventBus"), i = n.get("wardleyImporter"), a = n.get("commandStack", !1), o = this._rootBusinessObject() ? this._livePreview()?.committedMap() ?? this.exportMap() : void 0;
|
|
1353
|
+
this._labelsBeforePreview = void 0, this._sizePreview = void 0, mn(n, this._dropping), i.clear();
|
|
1345
1354
|
let s;
|
|
1346
1355
|
try {
|
|
1347
1356
|
s = i.import(t);
|
|
@@ -1413,10 +1422,10 @@ var fn = class {
|
|
|
1413
1422
|
if (!this._rootBusinessObject()) return { warnings: [] };
|
|
1414
1423
|
let t = this.exportMap(), n = t.config.size;
|
|
1415
1424
|
if (e ? n?.width === e.width && n.height === e.height : n === void 0) return { warnings: [] };
|
|
1416
|
-
let r =
|
|
1425
|
+
let r = dt(t.rawPassthrough), { rawPassthrough: i, ...a } = t;
|
|
1417
1426
|
return this.importMap({
|
|
1418
1427
|
...a,
|
|
1419
|
-
config:
|
|
1428
|
+
config: lt(t.config, e),
|
|
1420
1429
|
...r?.length ? { rawPassthrough: r } : {}
|
|
1421
1430
|
});
|
|
1422
1431
|
}
|
|
@@ -1442,7 +1451,7 @@ var fn = class {
|
|
|
1442
1451
|
} else this._applyConfigDirectly({ evolutionLabels: n });
|
|
1443
1452
|
}
|
|
1444
1453
|
_applyConfigDirectly(e, t = {}) {
|
|
1445
|
-
|
|
1454
|
+
tn(this.get("canvas"), this.get("evolutionGrid"), this.get("eventBus"), e, t);
|
|
1446
1455
|
}
|
|
1447
1456
|
_wardleyModeling() {
|
|
1448
1457
|
return this._ensureDiagram().get("wardleyModeling", !1);
|
|
@@ -1451,7 +1460,7 @@ var fn = class {
|
|
|
1451
1460
|
return this._ensureDiagram().get("wardleyLivePreview", !1);
|
|
1452
1461
|
}
|
|
1453
1462
|
_root() {
|
|
1454
|
-
return
|
|
1463
|
+
return ut(this.get("canvas"));
|
|
1455
1464
|
}
|
|
1456
1465
|
_rootBusinessObject() {
|
|
1457
1466
|
return this._root()?.businessObject;
|
|
@@ -1461,7 +1470,7 @@ var fn = class {
|
|
|
1461
1470
|
}
|
|
1462
1471
|
async saveSVG() {
|
|
1463
1472
|
let e = this.get("canvas");
|
|
1464
|
-
return
|
|
1473
|
+
return Ve(e, We(e, this.get("evolutionGrid")));
|
|
1465
1474
|
}
|
|
1466
1475
|
attachTo(e) {
|
|
1467
1476
|
e.appendChild(this._container), this.get("canvas").resized();
|
|
@@ -1480,7 +1489,7 @@ var fn = class {
|
|
|
1480
1489
|
}
|
|
1481
1490
|
};
|
|
1482
1491
|
// src/layout/WardleyLayouter.ts
|
|
1483
|
-
function
|
|
1492
|
+
function H(e) {
|
|
1484
1493
|
return I(e) ? {
|
|
1485
1494
|
x: e.x + e.width / 2,
|
|
1486
1495
|
y: e.y
|
|
@@ -1489,32 +1498,32 @@ function U(e) {
|
|
|
1489
1498
|
y: e.y + e.height / 2
|
|
1490
1499
|
};
|
|
1491
1500
|
}
|
|
1492
|
-
var
|
|
1501
|
+
var gn = class extends le {
|
|
1493
1502
|
layoutConnection(e, t = {}) {
|
|
1494
1503
|
let n = t.source ?? e.source, r = t.target ?? e.target;
|
|
1495
1504
|
return super.layoutConnection(e, {
|
|
1496
1505
|
...t,
|
|
1497
|
-
...n ? { connectionStart:
|
|
1498
|
-
...r ? { connectionEnd:
|
|
1506
|
+
...n ? { connectionStart: H(n) } : {},
|
|
1507
|
+
...r ? { connectionEnd: H(r) } : {}
|
|
1499
1508
|
});
|
|
1500
1509
|
}
|
|
1501
|
-
},
|
|
1510
|
+
}, _n = { layouter: ["type", gn] }, vn = /* @__PURE__ */ new Set([
|
|
1502
1511
|
"component",
|
|
1503
1512
|
"anchor",
|
|
1504
1513
|
"submap",
|
|
1505
1514
|
"pipeline",
|
|
1506
1515
|
"accelerator"
|
|
1507
1516
|
]);
|
|
1508
|
-
function
|
|
1509
|
-
return typeof e == "string" &&
|
|
1517
|
+
function yn(e) {
|
|
1518
|
+
return typeof e == "string" && vn.has(e);
|
|
1510
1519
|
}
|
|
1511
|
-
function
|
|
1520
|
+
function bn(e, t) {
|
|
1512
1521
|
if (!t.has(e)) return e;
|
|
1513
1522
|
let n = / (\d+)$/.exec(e), r = n ? e.slice(0, n.index) : e, i = n ? Number(n[1]) + 1 : 2;
|
|
1514
1523
|
for (; t.has(`${r} ${i}`);) i++;
|
|
1515
1524
|
return `${r} ${i}`;
|
|
1516
1525
|
}
|
|
1517
|
-
var
|
|
1526
|
+
var xn = class {
|
|
1518
1527
|
elementFactory;
|
|
1519
1528
|
grid;
|
|
1520
1529
|
elementRegistry;
|
|
@@ -1527,25 +1536,25 @@ var vn = class {
|
|
|
1527
1536
|
this.elementFactory = e, this.grid = t, this.elementRegistry = n;
|
|
1528
1537
|
}
|
|
1529
1538
|
uniqueLabel(e, t) {
|
|
1530
|
-
return
|
|
1539
|
+
return bn(e, this.takenLinkableLabels(t, this.pairableTypeFor(t)));
|
|
1531
1540
|
}
|
|
1532
1541
|
uniqueLabels(e) {
|
|
1533
1542
|
let t = this.takenLinkableLabels();
|
|
1534
1543
|
return e.map(({ type: e, label: n }) => {
|
|
1535
|
-
if (!
|
|
1536
|
-
let r =
|
|
1544
|
+
if (!yn(e)) return n;
|
|
1545
|
+
let r = bn(n, t);
|
|
1537
1546
|
return t.add(r), r;
|
|
1538
1547
|
});
|
|
1539
1548
|
}
|
|
1540
1549
|
isLinkable(e) {
|
|
1541
|
-
return
|
|
1550
|
+
return yn(e);
|
|
1542
1551
|
}
|
|
1543
1552
|
takenLinkableLabels(e, t) {
|
|
1544
1553
|
let n = /* @__PURE__ */ new Set();
|
|
1545
1554
|
for (let r of this.elementRegistry.getAll()) {
|
|
1546
1555
|
if (e && r.id === e) continue;
|
|
1547
1556
|
let { wardleyType: i, wardleyLabel: a } = r;
|
|
1548
|
-
|
|
1557
|
+
yn(i) && typeof a == "string" && (i === t && this.isUnpaired(r) || n.add(a));
|
|
1549
1558
|
}
|
|
1550
1559
|
return n;
|
|
1551
1560
|
}
|
|
@@ -1581,7 +1590,7 @@ var vn = class {
|
|
|
1581
1590
|
return this.node("anchor", e.id, e.label, e.position.visibility, e.position.evolution, e, { ...e.labelOffset ? { labelOffset: e.labelOffset } : {} });
|
|
1582
1591
|
}
|
|
1583
1592
|
createNote(e) {
|
|
1584
|
-
let { width: t, height: n } =
|
|
1593
|
+
let { width: t, height: n } = Le(e.label), r = this.grid.toCanvas(e.position);
|
|
1585
1594
|
return this.elementFactory.createShape({
|
|
1586
1595
|
id: e.id,
|
|
1587
1596
|
x: r.x - t / 2,
|
|
@@ -1697,7 +1706,7 @@ var vn = class {
|
|
|
1697
1706
|
});
|
|
1698
1707
|
}
|
|
1699
1708
|
createNew(e, t, n = {}) {
|
|
1700
|
-
let r = e === "attitude" ? n.attitudeKind ?? "pioneers" :
|
|
1709
|
+
let r = e === "attitude" ? n.attitudeKind ?? "pioneers" : yn(e) ? this.uniqueLabel(t) : t;
|
|
1701
1710
|
if (e === "pipeline") return this.elementFactory.createShape({
|
|
1702
1711
|
width: 200,
|
|
1703
1712
|
height: 30,
|
|
@@ -1720,7 +1729,7 @@ var vn = class {
|
|
|
1720
1729
|
isFrame: !0
|
|
1721
1730
|
});
|
|
1722
1731
|
if (e === "note") {
|
|
1723
|
-
let { width: e, height: t } =
|
|
1732
|
+
let { width: e, height: t } = Le(r);
|
|
1724
1733
|
return this.elementFactory.createShape({
|
|
1725
1734
|
width: e,
|
|
1726
1735
|
height: t,
|
|
@@ -1776,7 +1785,7 @@ var vn = class {
|
|
|
1776
1785
|
id: t.id,
|
|
1777
1786
|
source: n,
|
|
1778
1787
|
target: r,
|
|
1779
|
-
waypoints: [
|
|
1788
|
+
waypoints: [H(n), H(r)],
|
|
1780
1789
|
wardleyType: e,
|
|
1781
1790
|
bidirectional: i,
|
|
1782
1791
|
...a ? { flowValue: a } : {},
|
|
@@ -1784,24 +1793,24 @@ var vn = class {
|
|
|
1784
1793
|
businessObject: t
|
|
1785
1794
|
});
|
|
1786
1795
|
}
|
|
1787
|
-
},
|
|
1788
|
-
function
|
|
1796
|
+
}, Sn = { wardleyElementFactory: ["type", xn] }, Cn = "wardley-axes", wn = ["Invisible", "Visible"], Tn = "wardley-axis", En = "wardley-axis-text";
|
|
1797
|
+
function Dn(e) {
|
|
1789
1798
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1790
1799
|
}
|
|
1791
|
-
var
|
|
1800
|
+
var On = class {
|
|
1792
1801
|
canvas;
|
|
1793
1802
|
static $inject = ["canvas"];
|
|
1794
1803
|
boundaries = o;
|
|
1795
1804
|
labels = r;
|
|
1796
1805
|
yAxisLabel = "Value Chain";
|
|
1797
|
-
yAxisEndLabels =
|
|
1806
|
+
yAxisEndLabels = wn;
|
|
1798
1807
|
plotWidth = k.width;
|
|
1799
1808
|
plotHeight = k.height;
|
|
1800
1809
|
constructor(e) {
|
|
1801
1810
|
this.canvas = e;
|
|
1802
1811
|
}
|
|
1803
1812
|
configure(e) {
|
|
1804
|
-
this.boundaries = e.stageBoundaries ?? o, this.labels = e.evolutionLabels ?? r, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ??
|
|
1813
|
+
this.boundaries = e.stageBoundaries ?? o, this.labels = e.evolutionLabels ?? r, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? wn, this.plotWidth = m(e.size?.width, "width"), this.plotHeight = m(e.size?.height, "height");
|
|
1805
1814
|
}
|
|
1806
1815
|
toCanvas(e) {
|
|
1807
1816
|
return {
|
|
@@ -1811,8 +1820,8 @@ var Tn = class {
|
|
|
1811
1820
|
}
|
|
1812
1821
|
fromCanvas(e) {
|
|
1813
1822
|
return {
|
|
1814
|
-
evolution:
|
|
1815
|
-
visibility:
|
|
1823
|
+
evolution: Dn((e.x - k.marginLeft) / this.plotWidth),
|
|
1824
|
+
visibility: Dn(1 - (e.y - k.marginTop) / this.plotHeight)
|
|
1816
1825
|
};
|
|
1817
1826
|
}
|
|
1818
1827
|
stageOf(e) {
|
|
@@ -1836,10 +1845,10 @@ var Tn = class {
|
|
|
1836
1845
|
};
|
|
1837
1846
|
}
|
|
1838
1847
|
render() {
|
|
1839
|
-
let e = this.canvas.getLayer(
|
|
1848
|
+
let e = this.canvas.getLayer(Cn, -1);
|
|
1840
1849
|
ae(e);
|
|
1841
1850
|
let t = k.marginLeft, n = k.marginTop, r = t + this.plotWidth, i = n + this.plotHeight;
|
|
1842
|
-
T(e,
|
|
1851
|
+
T(e, kn(t, n, this.plotWidth, this.plotHeight, {
|
|
1843
1852
|
fill: j.plotBackground,
|
|
1844
1853
|
stroke: j.grid
|
|
1845
1854
|
}));
|
|
@@ -1850,51 +1859,51 @@ var Tn = class {
|
|
|
1850
1859
|
];
|
|
1851
1860
|
for (let r = 0; r < 4; r++) {
|
|
1852
1861
|
let o = t + a[r] * this.plotWidth, s = t + a[r + 1] * this.plotWidth;
|
|
1853
|
-
r % 2 == 1 && T(e,
|
|
1862
|
+
r % 2 == 1 && T(e, kn(o, n, s - o, this.plotHeight, {
|
|
1854
1863
|
fill: j.band,
|
|
1855
1864
|
stroke: "none"
|
|
1856
|
-
})), r > 0 && T(e,
|
|
1865
|
+
})), r > 0 && T(e, An(o, n, o, i, {
|
|
1857
1866
|
stroke: j.grid,
|
|
1858
1867
|
"stroke-dasharray": "3 5"
|
|
1859
1868
|
}));
|
|
1860
1869
|
let c = (o + s) / 2;
|
|
1861
|
-
T(e,
|
|
1870
|
+
T(e, jn(this.labels[r].toUpperCase(), c, i + 18, {
|
|
1862
1871
|
"text-anchor": "middle",
|
|
1863
1872
|
"font-size": M.stage,
|
|
1864
1873
|
"letter-spacing": "0.08em",
|
|
1865
1874
|
fill: j.axisText
|
|
1866
1875
|
}));
|
|
1867
1876
|
}
|
|
1868
|
-
T(e,
|
|
1877
|
+
T(e, An(t, i, r + 10, i, {
|
|
1869
1878
|
stroke: j.axis,
|
|
1870
|
-
class:
|
|
1871
|
-
})), T(e,
|
|
1879
|
+
class: Tn
|
|
1880
|
+
})), T(e, Mn(r + 10, i, "right")), T(e, jn("Evolution", r + 6, i + 38, {
|
|
1872
1881
|
"text-anchor": "end",
|
|
1873
1882
|
"font-size": M.axis,
|
|
1874
1883
|
fill: j.axisText,
|
|
1875
1884
|
"font-style": "italic"
|
|
1876
|
-
})), T(e,
|
|
1885
|
+
})), T(e, An(t, i, t, n - 10, {
|
|
1877
1886
|
stroke: j.axis,
|
|
1878
|
-
class:
|
|
1879
|
-
})), T(e,
|
|
1880
|
-
let o =
|
|
1887
|
+
class: Tn
|
|
1888
|
+
})), T(e, Mn(t, n - 10, "up"));
|
|
1889
|
+
let o = jn(this.yAxisLabel, 0, 0, {
|
|
1881
1890
|
"text-anchor": "middle",
|
|
1882
1891
|
"font-size": M.axis,
|
|
1883
1892
|
fill: j.axisText,
|
|
1884
1893
|
"font-style": "italic"
|
|
1885
1894
|
});
|
|
1886
|
-
E(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), T(e, o), T(e,
|
|
1895
|
+
E(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), T(e, o), T(e, jn(this.yAxisEndLabels[1], t - 10, n + 11, {
|
|
1887
1896
|
"text-anchor": "end",
|
|
1888
1897
|
"font-size": M.stage,
|
|
1889
1898
|
fill: j.axisText
|
|
1890
|
-
})), T(e,
|
|
1899
|
+
})), T(e, jn(this.yAxisEndLabels[0], t - 10, i - 2, {
|
|
1891
1900
|
"text-anchor": "end",
|
|
1892
1901
|
"font-size": M.stage,
|
|
1893
1902
|
fill: j.axisText
|
|
1894
1903
|
}));
|
|
1895
1904
|
}
|
|
1896
1905
|
};
|
|
1897
|
-
function
|
|
1906
|
+
function kn(e, t, n, r, i) {
|
|
1898
1907
|
return E(D("rect"), {
|
|
1899
1908
|
x: e,
|
|
1900
1909
|
y: t,
|
|
@@ -1904,7 +1913,7 @@ function En(e, t, n, r, i) {
|
|
|
1904
1913
|
...i
|
|
1905
1914
|
});
|
|
1906
1915
|
}
|
|
1907
|
-
function
|
|
1916
|
+
function An(e, t, n, r, i) {
|
|
1908
1917
|
return E(D("line"), {
|
|
1909
1918
|
x1: e,
|
|
1910
1919
|
y1: t,
|
|
@@ -1914,30 +1923,30 @@ function Dn(e, t, n, r, i) {
|
|
|
1914
1923
|
...i
|
|
1915
1924
|
});
|
|
1916
1925
|
}
|
|
1917
|
-
function
|
|
1926
|
+
function jn(e, t, n, r) {
|
|
1918
1927
|
let i = E(D("text"), {
|
|
1919
1928
|
x: t,
|
|
1920
1929
|
y: n,
|
|
1921
1930
|
"font-family": M.family,
|
|
1922
|
-
class:
|
|
1931
|
+
class: En,
|
|
1923
1932
|
...r
|
|
1924
1933
|
});
|
|
1925
1934
|
return i.textContent = e, i;
|
|
1926
1935
|
}
|
|
1927
|
-
function
|
|
1936
|
+
function Mn(e, t, n) {
|
|
1928
1937
|
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}`;
|
|
1929
1938
|
return E(D("polygon"), {
|
|
1930
1939
|
points: r,
|
|
1931
1940
|
fill: j.axis,
|
|
1932
|
-
class:
|
|
1941
|
+
class: Tn
|
|
1933
1942
|
});
|
|
1934
1943
|
}
|
|
1935
1944
|
// src/evolve/constants.ts
|
|
1936
|
-
var
|
|
1937
|
-
function
|
|
1945
|
+
var Nn = .005, Pn = "wardley.evolve", Fn = "wardley-evolve-handle";
|
|
1946
|
+
function In(e) {
|
|
1938
1947
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1939
1948
|
}
|
|
1940
|
-
var
|
|
1949
|
+
var Ln = class {
|
|
1941
1950
|
dragging;
|
|
1942
1951
|
injector;
|
|
1943
1952
|
static $inject = [
|
|
@@ -1960,9 +1969,9 @@ var Pn = class {
|
|
|
1960
1969
|
...r,
|
|
1961
1970
|
targetEvolution: n
|
|
1962
1971
|
}, e.fire("element.changed", { element: t });
|
|
1963
|
-
}, u = (e, t) => Math.max(
|
|
1972
|
+
}, u = (e, t) => Math.max(In(t), Math.min(1, e.evolution + Nn)), d = (e, t) => {
|
|
1964
1973
|
let r = i.getContainer().getBoundingClientRect(), a = i.viewbox(), o = a.x + (e - r.left) * (a.width / r.width);
|
|
1965
|
-
return
|
|
1974
|
+
return In(n.fromCanvas({
|
|
1966
1975
|
x: o,
|
|
1967
1976
|
y: t
|
|
1968
1977
|
}).evolution);
|
|
@@ -1972,10 +1981,10 @@ var Pn = class {
|
|
|
1972
1981
|
};
|
|
1973
1982
|
i.getContainer().addEventListener("mousedown", (e) => {
|
|
1974
1983
|
let t = e.target;
|
|
1975
|
-
if (!t?.closest(`.${
|
|
1984
|
+
if (!t?.closest(`.${Fn}`) || f() || R(o)) return;
|
|
1976
1985
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), p = n ? a.get(n) : void 0;
|
|
1977
1986
|
if (!p || p.wardleyType !== "component") return;
|
|
1978
|
-
e.stopPropagation(), e.preventDefault(),
|
|
1987
|
+
e.stopPropagation(), e.preventDefault(), B(i), this.handleDrag?.cancel();
|
|
1979
1988
|
let m = p.y + p.height / 2, h, g = () => {
|
|
1980
1989
|
this.handleDrag = null, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", y), document.removeEventListener("keydown", b, !0), c.putBackShape(p);
|
|
1981
1990
|
}, _ = {
|
|
@@ -1988,79 +1997,79 @@ var Pn = class {
|
|
|
1988
1997
|
}, y = () => s.drop(_, () => {
|
|
1989
1998
|
g(), h !== void 0 && h > p.evolution + .005 && r.evolveComponent(p, h);
|
|
1990
1999
|
}), b = (e) => {
|
|
1991
|
-
e.key === "Escape" &&
|
|
2000
|
+
e.key === "Escape" && Ot(e, i) && (e.preventDefault(), e.stopPropagation(), _.cancel());
|
|
1992
2001
|
};
|
|
1993
2002
|
document.addEventListener("mousemove", v), document.addEventListener("mouseup", y), document.addEventListener("keydown", b, !0), this.handleDrag = _;
|
|
1994
2003
|
}, !0), e.on("shape.remove", ({ element: e }) => {
|
|
1995
2004
|
let t = this.handleDrag;
|
|
1996
2005
|
t && t.shape === e && t.cancel();
|
|
1997
|
-
}), e.on("diagram.destroy", () => this.handleDrag?.cancel()), e.on(L,
|
|
2006
|
+
}), e.on("diagram.destroy", () => this.handleDrag?.cancel()), e.on(L, mt, () => {
|
|
1998
2007
|
let e = this.handleDrag;
|
|
1999
2008
|
e && c.previewsShape(e.shape) && e.cancel();
|
|
2000
2009
|
let n = this.runningPlacement();
|
|
2001
2010
|
n && c.previewsShape(n.shape) && t.cancel(!0);
|
|
2002
|
-
}), e.on(`${
|
|
2011
|
+
}), e.on(`${Pn}.move`, (e) => {
|
|
2003
2012
|
let { shape: t } = e.context, r = t.y + t.height / 2, i = u(t, n.fromCanvas({
|
|
2004
2013
|
x: e.x,
|
|
2005
2014
|
y: r
|
|
2006
2015
|
}).evolution);
|
|
2007
2016
|
e.context.target = i, l(t, i);
|
|
2008
|
-
}), e.on(`${
|
|
2017
|
+
}), e.on(`${Pn}.end`, (e) => {
|
|
2009
2018
|
let { shape: t, target: n } = e.context;
|
|
2010
2019
|
c.putBackShape(t), n !== void 0 && n > t.evolution + .005 && r.evolveComponent(t, n);
|
|
2011
|
-
}), e.on(`${
|
|
2020
|
+
}), e.on(`${Pn}.cleanup`, (e) => {
|
|
2012
2021
|
e.context && c.putBackShape(e.context.shape);
|
|
2013
2022
|
});
|
|
2014
2023
|
}
|
|
2015
2024
|
runningPlacement() {
|
|
2016
2025
|
let e = this.dragging.context();
|
|
2017
|
-
return e?.prefix ===
|
|
2026
|
+
return e?.prefix === Pn ? e.data?.context : void 0;
|
|
2018
2027
|
}
|
|
2019
2028
|
start(e, t) {
|
|
2020
|
-
if (
|
|
2029
|
+
if (R(this.injector)) return;
|
|
2021
2030
|
let n = { shape: t };
|
|
2022
|
-
this.dragging.init(e,
|
|
2031
|
+
this.dragging.init(e, Pn, {
|
|
2023
2032
|
cursor: "ew-resize",
|
|
2024
2033
|
data: { context: n }
|
|
2025
2034
|
});
|
|
2026
2035
|
}
|
|
2027
|
-
},
|
|
2028
|
-
__depends__: [
|
|
2036
|
+
}, Rn = {
|
|
2037
|
+
__depends__: [cn, ht],
|
|
2029
2038
|
__init__: ["wardleyEvolveDragging"],
|
|
2030
|
-
wardleyEvolveDragging: ["type",
|
|
2039
|
+
wardleyEvolveDragging: ["type", Ln]
|
|
2031
2040
|
};
|
|
2032
2041
|
// src/pipeline/pipelineMembership.ts
|
|
2033
|
-
function
|
|
2042
|
+
function U(e) {
|
|
2034
2043
|
return {
|
|
2035
2044
|
x: e.x + e.width / 2,
|
|
2036
2045
|
y: e.y + e.height / 2
|
|
2037
2046
|
};
|
|
2038
2047
|
}
|
|
2039
|
-
function
|
|
2048
|
+
function zn(e, t) {
|
|
2040
2049
|
return t.x >= e.x && t.x <= e.x + e.width && t.y >= e.y && t.y <= e.y + e.height;
|
|
2041
2050
|
}
|
|
2042
|
-
function
|
|
2051
|
+
function Bn(e) {
|
|
2043
2052
|
return e.filter((e) => I(e));
|
|
2044
2053
|
}
|
|
2045
|
-
function
|
|
2054
|
+
function Vn(e, t) {
|
|
2046
2055
|
return e.filter((e) => F(e) && e.pipelineId === t.id);
|
|
2047
2056
|
}
|
|
2048
|
-
function
|
|
2057
|
+
function Hn(e, t) {
|
|
2049
2058
|
return e.find((e) => F(e) && e.wardleyLabel === t.wardleyLabel && e.pipelineId !== t.id);
|
|
2050
2059
|
}
|
|
2051
|
-
function
|
|
2052
|
-
if (F(t)) return
|
|
2060
|
+
function Un(e, t) {
|
|
2061
|
+
if (F(t)) return Bn(e).find((e) => e.wardleyLabel === t.wardleyLabel && t.pipelineId !== e.id);
|
|
2053
2062
|
}
|
|
2054
|
-
function
|
|
2055
|
-
let n =
|
|
2056
|
-
return [...
|
|
2063
|
+
function Wn(e, t) {
|
|
2064
|
+
let n = Hn(e, t);
|
|
2065
|
+
return [...Vn(e, t), ...n ? [n] : []];
|
|
2057
2066
|
}
|
|
2058
|
-
function
|
|
2059
|
-
let i =
|
|
2067
|
+
function Gn(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
2068
|
+
let i = Bn(e).filter((e) => !r.has(e) && e.wardleyLabel !== t.wardleyLabel && zn(e, n));
|
|
2060
2069
|
return i.find((e) => e.id === t.pipelineId) ?? i[0];
|
|
2061
2070
|
}
|
|
2062
2071
|
// src/pipeline/PipelineGroupBehavior.ts
|
|
2063
|
-
var
|
|
2072
|
+
var Kn = 1400, qn = 450, Jn = 400, Yn = 1500, Xn = "wardley-pipeline-drag", Zn = 900, Qn = "wardley-drop-target", $n = class extends ue {
|
|
2064
2073
|
elementRegistry;
|
|
2065
2074
|
canvas;
|
|
2066
2075
|
static $inject = [
|
|
@@ -2075,27 +2084,27 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2075
2084
|
this.preExecute("element.updateProperties", (e) => {
|
|
2076
2085
|
let { context: t } = e, n = t.element, r = t.properties.wardleyLabel;
|
|
2077
2086
|
if (typeof r != "string" || r === n.wardleyLabel) return;
|
|
2078
|
-
let i = I(n) ?
|
|
2087
|
+
let i = I(n) ? Hn(this.elementRegistry, n) : Un(this.elementRegistry, n);
|
|
2079
2088
|
i && (t.renamedCounterpart = i);
|
|
2080
2089
|
}), this.postExecute("element.updateProperties", (e) => {
|
|
2081
2090
|
let { context: t } = e, n = t.renamedCounterpart, i = t.properties.wardleyLabel;
|
|
2082
2091
|
n && typeof i == "string" && n.wardleyLabel !== i && r.get("wardleyModeling").updateProperties(n, { wardleyLabel: i });
|
|
2083
|
-
}), e.on("shape.move.start",
|
|
2092
|
+
}), e.on("shape.move.start", Kn, (e) => {
|
|
2084
2093
|
let { context: t } = e;
|
|
2085
2094
|
t.shapes = this.withFollowers(t.shapes ?? []);
|
|
2086
|
-
}), this.preExecuted("elements.move",
|
|
2095
|
+
}), this.preExecuted("elements.move", Yn, (e) => {
|
|
2087
2096
|
let t = e.context.closure;
|
|
2088
2097
|
if (t) {
|
|
2089
|
-
for (let e of Object.values(t.allShapes)) if (I(e)) for (let n of
|
|
2098
|
+
for (let e of Object.values(t.allShapes)) if (I(e)) for (let n of Wn(this.elementRegistry, e)) t.allShapes[n.id] || t.add(n, !!t.topLevel[e.id]);
|
|
2090
2099
|
}
|
|
2091
|
-
}), i && e.on("shape.move.start",
|
|
2100
|
+
}), i && e.on("shape.move.start", qn, (e) => {
|
|
2092
2101
|
let { context: t } = e, n = this.carriedVertically(t.shapes ?? []);
|
|
2093
2102
|
if (!n.length) return;
|
|
2094
2103
|
let r = D("g");
|
|
2095
|
-
E(r, { class: "djs-drag-group" }), T(this.canvas.getLayer(
|
|
2104
|
+
E(r, { class: "djs-drag-group" }), T(this.canvas.getLayer(Xn, Zn), r);
|
|
2096
2105
|
for (let e of n) i.addDragger(e, r);
|
|
2097
2106
|
t.pipelineVerticalPreview = r;
|
|
2098
|
-
}), e.on("shape.move.move",
|
|
2107
|
+
}), e.on("shape.move.move", Jn, (e) => {
|
|
2099
2108
|
let { context: t } = e;
|
|
2100
2109
|
t.pipelineVerticalPreview && de(t.pipelineVerticalPreview, 0, e.dy), this.markDropTarget(t, this.dropTargetFor(t, e.dx, e.dy));
|
|
2101
2110
|
}), e.on("shape.move.cleanup", (e) => {
|
|
@@ -2105,47 +2114,47 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2105
2114
|
}
|
|
2106
2115
|
withFollowers(e) {
|
|
2107
2116
|
let t = new Set(e);
|
|
2108
|
-
for (let n of e) if (I(n)) for (let e of
|
|
2117
|
+
for (let n of e) if (I(n)) for (let e of Wn(this.elementRegistry, n)) t.add(e);
|
|
2109
2118
|
return [...t];
|
|
2110
2119
|
}
|
|
2111
2120
|
carriedVertically(e) {
|
|
2112
2121
|
let t = new Set(e), n = [];
|
|
2113
2122
|
for (let r of e) {
|
|
2114
2123
|
if (!F(r)) continue;
|
|
2115
|
-
let e =
|
|
2116
|
-
e && !t.has(e) && n.push(e, ...
|
|
2124
|
+
let e = Un(this.elementRegistry, r);
|
|
2125
|
+
e && !t.has(e) && n.push(e, ...Vn(this.elementRegistry, e).filter((e) => !t.has(e)));
|
|
2117
2126
|
}
|
|
2118
2127
|
return n;
|
|
2119
2128
|
}
|
|
2120
2129
|
dropTargetFor(e, t, n) {
|
|
2121
2130
|
let r = e.shape;
|
|
2122
|
-
if (!F(r) ||
|
|
2123
|
-
let i =
|
|
2124
|
-
return
|
|
2131
|
+
if (!F(r) || Un(this.elementRegistry, r)) return;
|
|
2132
|
+
let i = U(r);
|
|
2133
|
+
return Gn(this.elementRegistry, r, {
|
|
2125
2134
|
x: i.x + t,
|
|
2126
2135
|
y: i.y + n
|
|
2127
2136
|
}, new Set(e.shapes ?? []));
|
|
2128
2137
|
}
|
|
2129
2138
|
markDropTarget(e, t) {
|
|
2130
2139
|
let n = e.pipelineDropTarget;
|
|
2131
|
-
n !== t && (n && this.canvas.removeMarker(n,
|
|
2140
|
+
n !== t && (n && this.canvas.removeMarker(n, Qn), t && this.canvas.addMarker(t, Qn), t ? e.pipelineDropTarget = t : delete e.pipelineDropTarget);
|
|
2132
2141
|
}
|
|
2133
|
-
},
|
|
2142
|
+
}, er = {
|
|
2134
2143
|
__init__: ["pipelineGroupBehavior"],
|
|
2135
|
-
pipelineGroupBehavior: ["type",
|
|
2136
|
-
},
|
|
2144
|
+
pipelineGroupBehavior: ["type", $n]
|
|
2145
|
+
}, tr = [
|
|
2137
2146
|
"shape.move",
|
|
2138
2147
|
"shape.create",
|
|
2139
2148
|
"shape.resize"
|
|
2140
|
-
],
|
|
2141
|
-
...
|
|
2149
|
+
], nr = [
|
|
2150
|
+
...tr,
|
|
2142
2151
|
"elements.move",
|
|
2143
2152
|
"elements.create"
|
|
2144
|
-
],
|
|
2153
|
+
], rr = [
|
|
2145
2154
|
"shape.create",
|
|
2146
2155
|
"shape.delete",
|
|
2147
2156
|
"element.updateProperties"
|
|
2148
|
-
],
|
|
2157
|
+
], ir = 2e3, ar = 1e3, or = 10, sr = 1e-6, cr = class extends ue {
|
|
2149
2158
|
eventBus;
|
|
2150
2159
|
grid;
|
|
2151
2160
|
elementRegistry;
|
|
@@ -2165,9 +2174,9 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2165
2174
|
constructor(e, t, n, r, i, a) {
|
|
2166
2175
|
super(e), this.eventBus = e, this.grid = t, this.elementRegistry = n, this.canvas = r, this.modeling = i, this.wardleyModeling = a;
|
|
2167
2176
|
let o = (e) => {
|
|
2168
|
-
for (let t of
|
|
2177
|
+
for (let t of lr(e.context)) this.deriveFromGeometry(t);
|
|
2169
2178
|
};
|
|
2170
|
-
this.executed(
|
|
2179
|
+
this.executed(tr, o), this.reverted(tr, o), this.preExecute(nr, ir, (e) => {
|
|
2171
2180
|
this.topLevelContext ||= e.context;
|
|
2172
2181
|
}), e.on("commandStack.changed", () => {
|
|
2173
2182
|
this.topLevelContext = null;
|
|
@@ -2176,18 +2185,18 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2176
2185
|
if (!this.isTopLevel(t) || !N(t.shape) || !t.delta) return;
|
|
2177
2186
|
let n = [t.shape, ...this.followersOf(t.shape)];
|
|
2178
2187
|
this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
|
|
2179
|
-
}), this.preExecuted("elements.move",
|
|
2188
|
+
}), this.preExecuted("elements.move", ar, (e) => {
|
|
2180
2189
|
let { context: t } = e;
|
|
2181
2190
|
if (!this.isTopLevel(t) || !t.delta) return;
|
|
2182
|
-
let n =
|
|
2191
|
+
let n = ur(t);
|
|
2183
2192
|
this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
|
|
2184
2193
|
}), this.preExecute(["shape.create", "elements.create"], (e) => {
|
|
2185
2194
|
let { context: t } = e;
|
|
2186
|
-
t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t,
|
|
2195
|
+
t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t, lr(t));
|
|
2187
2196
|
}), this.preExecute("shape.resize", (e) => {
|
|
2188
2197
|
let { context: t } = e, n = t.shape;
|
|
2189
2198
|
N(n) && t.newBounds && (n.wardleyType === "pipeline" ? t.newBounds = this.horizontalPipelineBounds(n, t.newBounds) : n.wardleyType === "attitude" && (t.newBounds = this.boundsInsidePlot(t.newBounds)));
|
|
2190
|
-
}), this.postExecuted(
|
|
2199
|
+
}), this.postExecuted(nr, (e) => {
|
|
2191
2200
|
if (e.context === this.topLevelContext) try {
|
|
2192
2201
|
this.applyCorrections(e.command, e.context);
|
|
2193
2202
|
} finally {
|
|
@@ -2210,13 +2219,13 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2210
2219
|
]), o = this.elementRegistry.filter((e) => F(e) && a.has(e.wardleyLabel));
|
|
2211
2220
|
for (let e of o) this.eventBus.fire("element.changed", { element: e });
|
|
2212
2221
|
};
|
|
2213
|
-
this.executed(
|
|
2222
|
+
this.executed(rr, s), this.reverted(rr, s);
|
|
2214
2223
|
}
|
|
2215
2224
|
isTopLevel(e) {
|
|
2216
2225
|
return e === this.topLevelContext;
|
|
2217
2226
|
}
|
|
2218
2227
|
followersOf(e) {
|
|
2219
|
-
return I(e) ?
|
|
2228
|
+
return I(e) ? Wn(this.elementRegistry, e) : [];
|
|
2220
2229
|
}
|
|
2221
2230
|
rememberEvolutions(e, t) {
|
|
2222
2231
|
this.evolutionsBefore.set(e, new Map(t.map((e) => [e, e.evolution])));
|
|
@@ -2249,7 +2258,7 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2249
2258
|
return;
|
|
2250
2259
|
}
|
|
2251
2260
|
default: {
|
|
2252
|
-
let t = this.grid.fromCanvas(
|
|
2261
|
+
let t = this.grid.fromCanvas(U(e));
|
|
2253
2262
|
e.evolution = t.evolution;
|
|
2254
2263
|
let n = this.pipelineOfMember(e);
|
|
2255
2264
|
e.visibility = n ? this.pipelineVisibility(n) : t.visibility;
|
|
@@ -2263,9 +2272,9 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2263
2272
|
}), n = this.grid.fromCanvas({
|
|
2264
2273
|
x: e.x + e.width,
|
|
2265
2274
|
y: e.y
|
|
2266
|
-
}), [r, i] =
|
|
2267
|
-
e.evolutionStart = r, e.evolutionEnd = i, e.evolution =
|
|
2268
|
-
for (let t of
|
|
2275
|
+
}), [r, i] = mr(t.evolution, n.evolution);
|
|
2276
|
+
e.evolutionStart = r, e.evolutionEnd = i, e.evolution = pr((r + i) / 2), e.visibility = t.visibility;
|
|
2277
|
+
for (let t of Vn(this.elementRegistry, e)) t.visibility = e.visibility;
|
|
2269
2278
|
}
|
|
2270
2279
|
pipelineOfMember(e) {
|
|
2271
2280
|
if (!F(e) || !e.pipelineId) return;
|
|
@@ -2292,14 +2301,14 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2292
2301
|
return;
|
|
2293
2302
|
}
|
|
2294
2303
|
case "elements.move":
|
|
2295
|
-
this.completeMove(
|
|
2304
|
+
this.completeMove(ur(t), t.delta ?? {
|
|
2296
2305
|
x: 0,
|
|
2297
2306
|
y: 0
|
|
2298
2307
|
}, t);
|
|
2299
2308
|
return;
|
|
2300
2309
|
case "shape.create":
|
|
2301
2310
|
case "elements.create": {
|
|
2302
|
-
let e =
|
|
2311
|
+
let e = lr(t), n = this.clampDelta({
|
|
2303
2312
|
x: 0,
|
|
2304
2313
|
y: 0
|
|
2305
2314
|
}, e);
|
|
@@ -2316,12 +2325,12 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2316
2325
|
this.carryPipelinesOfMovedAnchors(e, t), this.reconcileMembership(e), this.shiftPassedEvolveTargets(n);
|
|
2317
2326
|
}
|
|
2318
2327
|
carryPipelinesOfMovedAnchors(e, t) {
|
|
2319
|
-
if (Math.abs(t.y) <
|
|
2328
|
+
if (Math.abs(t.y) < sr) return;
|
|
2320
2329
|
let n = new Set(e);
|
|
2321
2330
|
for (let r of e) {
|
|
2322
|
-
let e =
|
|
2331
|
+
let e = Un(this.elementRegistry, r);
|
|
2323
2332
|
if (!e || n.has(e)) continue;
|
|
2324
|
-
let i = [e, ...
|
|
2333
|
+
let i = [e, ...Vn(this.elementRegistry, e).filter((e) => !n.has(e))], a = this.clampDelta({
|
|
2325
2334
|
x: 0,
|
|
2326
2335
|
y: t.y
|
|
2327
2336
|
}, i);
|
|
@@ -2330,8 +2339,8 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2330
2339
|
}
|
|
2331
2340
|
reconcileMembership(e) {
|
|
2332
2341
|
for (let t of e) {
|
|
2333
|
-
if (!F(t) ||
|
|
2334
|
-
let e =
|
|
2342
|
+
if (!F(t) || Un(this.elementRegistry, t)) continue;
|
|
2343
|
+
let e = U(t), n = Gn(this.elementRegistry, t, e);
|
|
2335
2344
|
n ? (this.moveBy(t, {
|
|
2336
2345
|
x: 0,
|
|
2337
2346
|
y: n.y + n.height / 2 - e.y
|
|
@@ -2342,15 +2351,15 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2342
2351
|
}
|
|
2343
2352
|
}
|
|
2344
2353
|
releaseMembersOutside(e) {
|
|
2345
|
-
for (let t of
|
|
2346
|
-
let n =
|
|
2354
|
+
for (let t of Vn(this.elementRegistry, e)) {
|
|
2355
|
+
let n = U(t);
|
|
2347
2356
|
(n.x < e.x || n.x > e.x + e.width) && this.release(t);
|
|
2348
2357
|
}
|
|
2349
2358
|
}
|
|
2350
2359
|
release(e) {
|
|
2351
2360
|
this.wardleyModeling.updateProperties(e, {
|
|
2352
2361
|
pipelineId: void 0,
|
|
2353
|
-
visibility: this.grid.fromCanvas(
|
|
2362
|
+
visibility: this.grid.fromCanvas(U(e)).visibility
|
|
2354
2363
|
});
|
|
2355
2364
|
}
|
|
2356
2365
|
shiftPassedEvolveTargets(e) {
|
|
@@ -2368,7 +2377,7 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2368
2377
|
}
|
|
2369
2378
|
}
|
|
2370
2379
|
moveBy(e, t) {
|
|
2371
|
-
Math.abs(t.x) <
|
|
2380
|
+
Math.abs(t.x) < sr && Math.abs(t.y) < sr || this.modeling.moveShape(e, {
|
|
2372
2381
|
x: t.x,
|
|
2373
2382
|
y: t.y
|
|
2374
2383
|
});
|
|
@@ -2405,7 +2414,7 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2405
2414
|
case "drawing": {
|
|
2406
2415
|
let t = e.drawingPoints ?? [];
|
|
2407
2416
|
if (!t.length) return {
|
|
2408
|
-
...
|
|
2417
|
+
...U(e),
|
|
2409
2418
|
width: 0,
|
|
2410
2419
|
height: 0
|
|
2411
2420
|
};
|
|
@@ -2418,7 +2427,7 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2418
2427
|
};
|
|
2419
2428
|
}
|
|
2420
2429
|
default: return {
|
|
2421
|
-
...
|
|
2430
|
+
...U(e),
|
|
2422
2431
|
width: 0,
|
|
2423
2432
|
height: 0
|
|
2424
2433
|
};
|
|
@@ -2437,8 +2446,8 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2437
2446
|
r.min = Math.max(r.min, n.x - t.x), r.max = Math.min(r.max, n.x + n.width - (t.x + t.width)), i.min = Math.max(i.min, n.y - t.y), i.max = Math.min(i.max, n.y + n.height - (t.y + t.height));
|
|
2438
2447
|
}
|
|
2439
2448
|
return {
|
|
2440
|
-
x:
|
|
2441
|
-
y:
|
|
2449
|
+
x: dr(e.x, r),
|
|
2450
|
+
y: dr(e.y, i)
|
|
2442
2451
|
};
|
|
2443
2452
|
}
|
|
2444
2453
|
horizontalPipelineBounds(e, t) {
|
|
@@ -2460,11 +2469,11 @@ var Un = 1400, Wn = 450, Gn = 400, Kn = 1500, qn = "wardley-pipeline-drag", Jn =
|
|
|
2460
2469
|
};
|
|
2461
2470
|
}
|
|
2462
2471
|
spanInside(e, t, n) {
|
|
2463
|
-
let r = this.plotBounds(), i = n === "x" ? r.x : r.y, a = i + (n === "x" ? r.width : r.height), o = Math.max(e, i), s = Math.max(Math.min(e + t, a) - o,
|
|
2472
|
+
let r = this.plotBounds(), i = n === "x" ? r.x : r.y, a = i + (n === "x" ? r.width : r.height), o = Math.max(e, i), s = Math.max(Math.min(e + t, a) - o, or);
|
|
2464
2473
|
return [Math.min(o, a - s), s];
|
|
2465
2474
|
}
|
|
2466
2475
|
};
|
|
2467
|
-
function
|
|
2476
|
+
function lr(e) {
|
|
2468
2477
|
let t = [
|
|
2469
2478
|
...e.shape ? [e.shape] : [],
|
|
2470
2479
|
...e.shapes ?? [],
|
|
@@ -2472,36 +2481,36 @@ function or(e) {
|
|
|
2472
2481
|
];
|
|
2473
2482
|
return [...new Set(t)].filter(N);
|
|
2474
2483
|
}
|
|
2475
|
-
function
|
|
2476
|
-
return e.closure ? Object.values(e.closure.allShapes).filter(N) :
|
|
2484
|
+
function ur(e) {
|
|
2485
|
+
return e.closure ? Object.values(e.closure.allShapes).filter(N) : lr(e);
|
|
2477
2486
|
}
|
|
2478
|
-
function
|
|
2487
|
+
function dr(e, t) {
|
|
2479
2488
|
return t.min > t.max ? e : Math.min(Math.max(e, t.min), t.max);
|
|
2480
2489
|
}
|
|
2481
|
-
var
|
|
2482
|
-
function
|
|
2490
|
+
var fr = .001;
|
|
2491
|
+
function pr(e) {
|
|
2483
2492
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2484
2493
|
}
|
|
2485
|
-
function
|
|
2486
|
-
let n =
|
|
2487
|
-
return [Math.max(0, Math.min(e, n -
|
|
2494
|
+
function mr(e, t) {
|
|
2495
|
+
let n = pr(Math.max(t, e + fr));
|
|
2496
|
+
return [Math.max(0, Math.min(e, n - fr)), n];
|
|
2488
2497
|
}
|
|
2489
2498
|
// src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
2490
|
-
function
|
|
2499
|
+
function hr(e, t, n) {
|
|
2491
2500
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
2492
2501
|
}
|
|
2493
|
-
var
|
|
2502
|
+
var gr = class {
|
|
2494
2503
|
execute(e) {
|
|
2495
2504
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
2496
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
2505
|
+
for (let e of Object.keys(n)) i[e] = r[e], hr(r, e, n[e]);
|
|
2497
2506
|
return e.oldProperties = i, [t];
|
|
2498
2507
|
}
|
|
2499
2508
|
revert(e) {
|
|
2500
2509
|
let { element: t, oldProperties: n } = e, r = t;
|
|
2501
|
-
if (n) for (let e of Object.keys(n))
|
|
2510
|
+
if (n) for (let e of Object.keys(n)) hr(r, e, n[e]);
|
|
2502
2511
|
return [t];
|
|
2503
2512
|
}
|
|
2504
|
-
},
|
|
2513
|
+
}, _r = class {
|
|
2505
2514
|
projection;
|
|
2506
2515
|
static $inject = ["wardleyMapProjection"];
|
|
2507
2516
|
constructor(e) {
|
|
@@ -2509,20 +2518,20 @@ var pr = class {
|
|
|
2509
2518
|
}
|
|
2510
2519
|
execute(e) {
|
|
2511
2520
|
let t = this.projection.root()?.businessObject;
|
|
2512
|
-
return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(
|
|
2521
|
+
return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(vr({
|
|
2513
2522
|
...t,
|
|
2514
|
-
config:
|
|
2515
|
-
},
|
|
2523
|
+
config: lt(t.config, e.size)
|
|
2524
|
+
}, dt(t.rawPassthrough)))) : [];
|
|
2516
2525
|
}
|
|
2517
2526
|
revert(e) {
|
|
2518
2527
|
let t = this.projection.root()?.businessObject;
|
|
2519
|
-
return t ? this.projection.apply(
|
|
2528
|
+
return t ? this.projection.apply(vr({
|
|
2520
2529
|
...t,
|
|
2521
|
-
config:
|
|
2530
|
+
config: lt(t.config, e.oldSize)
|
|
2522
2531
|
}, e.oldRawPassthrough)) : [];
|
|
2523
2532
|
}
|
|
2524
2533
|
};
|
|
2525
|
-
function
|
|
2534
|
+
function vr(e, t) {
|
|
2526
2535
|
let { rawPassthrough: n, ...r } = e;
|
|
2527
2536
|
return t ? {
|
|
2528
2537
|
...r,
|
|
@@ -2530,41 +2539,41 @@ function hr(e, t) {
|
|
|
2530
2539
|
} : r;
|
|
2531
2540
|
}
|
|
2532
2541
|
// src/modeling/WardleyModeling.ts
|
|
2533
|
-
var
|
|
2534
|
-
function
|
|
2542
|
+
var yr = "element.updateProperties", br = "wardley.map.resize", xr = "wardley.config.update";
|
|
2543
|
+
function Sr(e) {
|
|
2535
2544
|
let t = {};
|
|
2536
2545
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
2537
2546
|
return t;
|
|
2538
2547
|
}
|
|
2539
|
-
var
|
|
2548
|
+
var Cr = class {
|
|
2540
2549
|
commandStack;
|
|
2541
2550
|
canvas;
|
|
2542
2551
|
static $inject = ["commandStack", "canvas"];
|
|
2543
2552
|
constructor(e, t) {
|
|
2544
|
-
this.commandStack = e, this.canvas = t, e.registerHandler(
|
|
2553
|
+
this.commandStack = e, this.canvas = t, e.registerHandler(yr, gr), e.registerHandler(br, _r), e.registerHandler(xr, nn);
|
|
2545
2554
|
}
|
|
2546
2555
|
resizeMap(e) {
|
|
2547
2556
|
let t = this.currentConfig();
|
|
2548
|
-
t && !
|
|
2557
|
+
t && !wr(t.size, e) && this.commandStack.execute(br, { size: e });
|
|
2549
2558
|
}
|
|
2550
2559
|
updateConfig(e) {
|
|
2551
2560
|
let t = this.currentConfig();
|
|
2552
2561
|
if (!t) return;
|
|
2553
2562
|
let n = t, r = Object.fromEntries(Object.entries(e).filter(([e, t]) => e !== "size" && JSON.stringify(n[e]) !== JSON.stringify(t)));
|
|
2554
|
-
Object.keys(r).length !== 0 && this.commandStack.execute(
|
|
2563
|
+
Object.keys(r).length !== 0 && this.commandStack.execute(xr, { properties: r });
|
|
2555
2564
|
}
|
|
2556
2565
|
currentConfig() {
|
|
2557
|
-
return
|
|
2566
|
+
return ut(this.canvas)?.businessObject?.config;
|
|
2558
2567
|
}
|
|
2559
2568
|
updateProperties(e, t) {
|
|
2560
|
-
this.commandStack.execute(
|
|
2569
|
+
this.commandStack.execute(yr, {
|
|
2561
2570
|
element: e,
|
|
2562
2571
|
properties: t
|
|
2563
2572
|
});
|
|
2564
2573
|
}
|
|
2565
2574
|
updateLabel(e, t) {
|
|
2566
2575
|
if (e.wardleyType === "note") {
|
|
2567
|
-
let { width: n, height: r } =
|
|
2576
|
+
let { width: n, height: r } = Le(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
2568
2577
|
this.updateProperties(e, {
|
|
2569
2578
|
wardleyLabel: t,
|
|
2570
2579
|
width: n,
|
|
@@ -2575,11 +2584,11 @@ var br = class {
|
|
|
2575
2584
|
} else this.updateProperties(e, { wardleyLabel: t });
|
|
2576
2585
|
}
|
|
2577
2586
|
evolveComponent(e, t, n = {}) {
|
|
2578
|
-
let r =
|
|
2579
|
-
r <= e.evolution || this.updateProperties(e, { movement:
|
|
2587
|
+
let r = Tr(t);
|
|
2588
|
+
r <= e.evolution || this.updateProperties(e, { movement: Sr({
|
|
2580
2589
|
...e.movement,
|
|
2581
2590
|
targetEvolution: r,
|
|
2582
|
-
...
|
|
2591
|
+
...Sr({
|
|
2583
2592
|
newLabel: n.newLabel,
|
|
2584
2593
|
method: n.method
|
|
2585
2594
|
})
|
|
@@ -2604,14 +2613,14 @@ var br = class {
|
|
|
2604
2613
|
this.updateProperties(e, { color: t });
|
|
2605
2614
|
}
|
|
2606
2615
|
};
|
|
2607
|
-
function
|
|
2616
|
+
function wr(e, t) {
|
|
2608
2617
|
return !e || !t ? e === t : e.width === t.width && e.height === t.height;
|
|
2609
2618
|
}
|
|
2610
|
-
function
|
|
2619
|
+
function Tr(e) {
|
|
2611
2620
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2612
2621
|
}
|
|
2613
2622
|
// src/modeling/WardleyCopyPaste.ts
|
|
2614
|
-
var
|
|
2623
|
+
var Er = 24, Dr = [
|
|
2615
2624
|
"wardleyType",
|
|
2616
2625
|
"evolution",
|
|
2617
2626
|
"visibility",
|
|
@@ -2628,13 +2637,13 @@ var Cr = 24, wr = [
|
|
|
2628
2637
|
"drawingPoints",
|
|
2629
2638
|
"closed",
|
|
2630
2639
|
"strokeStyle"
|
|
2631
|
-
],
|
|
2640
|
+
], Or = [
|
|
2632
2641
|
"wardleyType",
|
|
2633
2642
|
"bidirectional",
|
|
2634
2643
|
"flowValue",
|
|
2635
2644
|
"linkLabel"
|
|
2636
2645
|
];
|
|
2637
|
-
function
|
|
2646
|
+
function kr(e, t) {
|
|
2638
2647
|
let n = {};
|
|
2639
2648
|
for (let r of t) {
|
|
2640
2649
|
let t = e[r];
|
|
@@ -2642,7 +2651,7 @@ function Er(e, t) {
|
|
|
2642
2651
|
}
|
|
2643
2652
|
return n;
|
|
2644
2653
|
}
|
|
2645
|
-
var
|
|
2654
|
+
var Ar = class {
|
|
2646
2655
|
selection;
|
|
2647
2656
|
modeling;
|
|
2648
2657
|
elementFactory;
|
|
@@ -2674,14 +2683,14 @@ var Dr = class {
|
|
|
2674
2683
|
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
2675
2684
|
sourceIdx: i,
|
|
2676
2685
|
targetIdx: a,
|
|
2677
|
-
props:
|
|
2686
|
+
props: kr(e, Or)
|
|
2678
2687
|
}));
|
|
2679
2688
|
}
|
|
2680
2689
|
return this.clipboard = {
|
|
2681
2690
|
shapes: e.map((e) => ({
|
|
2682
2691
|
id: e.id,
|
|
2683
2692
|
...e.pipelineId ? { pipelineId: e.pipelineId } : {},
|
|
2684
|
-
props:
|
|
2693
|
+
props: kr(e, Dr),
|
|
2685
2694
|
x: e.x,
|
|
2686
2695
|
y: e.y,
|
|
2687
2696
|
width: e.width,
|
|
@@ -2718,7 +2727,7 @@ var Dr = class {
|
|
|
2718
2727
|
...structuredClone(e.props),
|
|
2719
2728
|
source: n[e.sourceIdx],
|
|
2720
2729
|
target: n[e.targetIdx],
|
|
2721
|
-
waypoints: [
|
|
2730
|
+
waypoints: [H(n[e.sourceIdx]), H(n[e.targetIdx])]
|
|
2722
2731
|
}))
|
|
2723
2732
|
};
|
|
2724
2733
|
}
|
|
@@ -2742,14 +2751,14 @@ var Dr = class {
|
|
|
2742
2751
|
}
|
|
2743
2752
|
insertWithOffset(e) {
|
|
2744
2753
|
this.pasteCount++;
|
|
2745
|
-
let t =
|
|
2754
|
+
let t = Er * this.pasteCount, n = jr(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
2746
2755
|
x: n.cx + t,
|
|
2747
2756
|
y: n.cy + t
|
|
2748
2757
|
}, this.canvas.getRootElement());
|
|
2749
2758
|
return this.selection.select(r), !0;
|
|
2750
2759
|
}
|
|
2751
2760
|
};
|
|
2752
|
-
function
|
|
2761
|
+
function jr(e) {
|
|
2753
2762
|
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));
|
|
2754
2763
|
return {
|
|
2755
2764
|
cx: (t + r) / 2,
|
|
@@ -2757,26 +2766,49 @@ function Or(e) {
|
|
|
2757
2766
|
};
|
|
2758
2767
|
}
|
|
2759
2768
|
// src/modeling/index.ts
|
|
2760
|
-
var
|
|
2769
|
+
var Mr = {
|
|
2761
2770
|
__depends__: [
|
|
2762
2771
|
pe,
|
|
2763
2772
|
me,
|
|
2764
|
-
|
|
2773
|
+
$t
|
|
2765
2774
|
],
|
|
2766
2775
|
__init__: ["wardleyModeling"],
|
|
2767
|
-
wardleyModeling: ["type",
|
|
2768
|
-
wardleyCopyPaste: ["type",
|
|
2769
|
-
},
|
|
2776
|
+
wardleyModeling: ["type", Cr],
|
|
2777
|
+
wardleyCopyPaste: ["type", Ar]
|
|
2778
|
+
}, Nr = { evolutionGrid: ["type", On] }, Pr = {
|
|
2770
2779
|
__init__: ["evolutionConstraintBehavior"],
|
|
2771
2780
|
__depends__: [
|
|
2772
|
-
|
|
2773
|
-
|
|
2781
|
+
Nr,
|
|
2782
|
+
_n,
|
|
2774
2783
|
fe,
|
|
2775
|
-
|
|
2784
|
+
Mr
|
|
2776
2785
|
],
|
|
2777
|
-
evolutionConstraintBehavior: ["type",
|
|
2778
|
-
},
|
|
2779
|
-
|
|
2786
|
+
evolutionConstraintBehavior: ["type", cr]
|
|
2787
|
+
}, Fr = {
|
|
2788
|
+
pencil: "<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"/><path d=\"m15 5 4 4\"/>",
|
|
2789
|
+
trash: "<path d=\"M10 11v6\"/><path d=\"M14 11v6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M3 6h18\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/>",
|
|
2790
|
+
"circle-plus": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8 12h8\"/><path d=\"M12 8v8\"/>",
|
|
2791
|
+
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
2792
|
+
"chevrons-right": "<path d=\"m6 17 5-5-5-5\"/><path d=\"m13 17 5-5-5-5\"/>",
|
|
2793
|
+
"chevrons-right-x": "<path d=\"m4 16 5-5-5-5\"/><path d=\"m11 16 5-5-5-5\"/><path d=\"m17 16 5 5\"/><path d=\"m17 21 5-5\"/>",
|
|
2794
|
+
"sliders-horizontal": "<path d=\"M10 5H3\"/><path d=\"M12 19H3\"/><path d=\"M14 3v4\"/><path d=\"M16 17v4\"/><path d=\"M21 12h-9\"/><path d=\"M21 19h-5\"/><path d=\"M21 5h-7\"/><path d=\"M8 10v4\"/><path d=\"M8 12H3\"/>",
|
|
2795
|
+
"line-style": "<path d=\"M11 5h2\"/><path d=\"M15 12h6\"/><path d=\"M19 5h2\"/><path d=\"M3 12h6\"/><path d=\"M3 19h18\"/><path d=\"M3 5h2\"/>",
|
|
2796
|
+
palette: "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>",
|
|
2797
|
+
link: "<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>",
|
|
2798
|
+
"external-link": "<path d=\"M15 3h6v6\"/><path d=\"M10 14 21 3\"/><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>",
|
|
2799
|
+
map: "<path d=\"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z\"/><path d=\"M15 5.764v15\"/><path d=\"M9 3.236v15\"/>"
|
|
2800
|
+
};
|
|
2801
|
+
/*! @miragon/wardley-renderer icon geometry: the context pad icons. Lucide (lucide-static 1.59.0)
|
|
2802
|
+
* @license ISC Copyright (c) 2026 Lucide Icons and Contributors
|
|
2803
|
+
* arrow-right, chevrons-right, circle-plus, external-link, link, map and trash derive from Feather
|
|
2804
|
+
* @license MIT, Copyright (c) 2013-present Cole Bemis
|
|
2805
|
+
* Full notices: README.md of @miragon/wardley-renderer */
|
|
2806
|
+
function W(e) {
|
|
2807
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${Fr[e]}</svg>`;
|
|
2808
|
+
}
|
|
2809
|
+
// src/draw/icons.ts
|
|
2810
|
+
var Ir = "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", Lr = "M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z", Rr = "M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z";
|
|
2811
|
+
function zr(e, t, n, r, i) {
|
|
2780
2812
|
let a = D("g"), o = r / 24;
|
|
2781
2813
|
return E(a, {
|
|
2782
2814
|
transform: `translate(${t - r / 2}, ${n - r / 2}) scale(${o})`,
|
|
@@ -2784,8 +2816,8 @@ function Fr(e, t, n, r, i) {
|
|
|
2784
2816
|
stroke: "none"
|
|
2785
2817
|
}), T(a, E(D("path"), { d: e })), a;
|
|
2786
2818
|
}
|
|
2787
|
-
var
|
|
2788
|
-
function
|
|
2819
|
+
var Br = 7.5;
|
|
2820
|
+
function Vr(e, t) {
|
|
2789
2821
|
let n = e.movement;
|
|
2790
2822
|
if (!n) return;
|
|
2791
2823
|
let r = t.toCanvas({
|
|
@@ -2797,47 +2829,47 @@ function Lr(e, t) {
|
|
|
2797
2829
|
evolution: n.targetEvolution
|
|
2798
2830
|
}).x - r.x;
|
|
2799
2831
|
}
|
|
2800
|
-
function
|
|
2801
|
-
return Math.max(...
|
|
2832
|
+
function Hr(e) {
|
|
2833
|
+
return Math.max(...Ur(e).map((e) => e.length)) * Br;
|
|
2802
2834
|
}
|
|
2803
|
-
function
|
|
2835
|
+
function Ur(e) {
|
|
2804
2836
|
return (e ?? "").split("\n");
|
|
2805
2837
|
}
|
|
2806
|
-
function
|
|
2838
|
+
function Wr(e, t, n) {
|
|
2807
2839
|
let r = (t - 1) * 16;
|
|
2808
2840
|
return n === "up" ? e - r : n === "down" ? e : e - r / 2;
|
|
2809
2841
|
}
|
|
2810
|
-
function
|
|
2811
|
-
return
|
|
2842
|
+
function Gr(e, t, n) {
|
|
2843
|
+
return Wr(e, t, n) + (t - 1) * 16;
|
|
2812
2844
|
}
|
|
2813
2845
|
function G(e, t) {
|
|
2814
2846
|
switch (e.wardleyType) {
|
|
2815
2847
|
case "anchor":
|
|
2816
2848
|
case "pipeline": return "up";
|
|
2817
|
-
case "component": return e.pipelineId === void 0 ? e.movement ||
|
|
2849
|
+
case "component": return e.pipelineId === void 0 ? e.movement || Kr(e, t) ? "up" : "centered" : "down";
|
|
2818
2850
|
default: return "centered";
|
|
2819
2851
|
}
|
|
2820
2852
|
}
|
|
2821
|
-
function
|
|
2853
|
+
function Kr(e, t) {
|
|
2822
2854
|
return t.find((t) => I(t) && t.wardleyLabel === e.wardleyLabel) !== void 0;
|
|
2823
2855
|
}
|
|
2824
|
-
function
|
|
2856
|
+
function qr() {
|
|
2825
2857
|
return {
|
|
2826
2858
|
x: 22,
|
|
2827
2859
|
y: -4
|
|
2828
2860
|
};
|
|
2829
2861
|
}
|
|
2830
|
-
function
|
|
2831
|
-
return t > 0 && t <
|
|
2862
|
+
function Jr(e, t) {
|
|
2863
|
+
return t > 0 && t < Hr(e.wardleyLabel) + 30 + 14;
|
|
2832
2864
|
}
|
|
2833
|
-
function
|
|
2834
|
-
let n =
|
|
2865
|
+
function Yr(e, t) {
|
|
2866
|
+
let n = qr();
|
|
2835
2867
|
if (e.labelOffset) return {
|
|
2836
2868
|
x: n.x + e.labelOffset.dx,
|
|
2837
2869
|
y: n.y + e.labelOffset.dy,
|
|
2838
2870
|
anchor: "start"
|
|
2839
2871
|
};
|
|
2840
|
-
if (t !== void 0 &&
|
|
2872
|
+
if (t !== void 0 && Jr(e, t)) return {
|
|
2841
2873
|
x: -n.x,
|
|
2842
2874
|
y: n.y,
|
|
2843
2875
|
anchor: "end"
|
|
@@ -2849,14 +2881,14 @@ function Gr(e, t) {
|
|
|
2849
2881
|
anchor: "start"
|
|
2850
2882
|
};
|
|
2851
2883
|
}
|
|
2852
|
-
function
|
|
2884
|
+
function Xr(e) {
|
|
2853
2885
|
return {
|
|
2854
2886
|
x: e + 15 + 7,
|
|
2855
2887
|
y: -4
|
|
2856
2888
|
};
|
|
2857
2889
|
}
|
|
2858
|
-
function
|
|
2859
|
-
let n =
|
|
2890
|
+
function Zr(e, t) {
|
|
2891
|
+
let n = Xr(t);
|
|
2860
2892
|
return e ? {
|
|
2861
2893
|
x: n.x + e.dx,
|
|
2862
2894
|
y: n.y + e.dy,
|
|
@@ -2871,21 +2903,21 @@ function qr(e, t) {
|
|
|
2871
2903
|
anchor: "start"
|
|
2872
2904
|
};
|
|
2873
2905
|
}
|
|
2874
|
-
function
|
|
2906
|
+
function Qr() {
|
|
2875
2907
|
return {
|
|
2876
2908
|
x: 0,
|
|
2877
2909
|
y: -17
|
|
2878
2910
|
};
|
|
2879
2911
|
}
|
|
2880
|
-
function
|
|
2881
|
-
let t =
|
|
2912
|
+
function $r(e) {
|
|
2913
|
+
let t = Qr();
|
|
2882
2914
|
return {
|
|
2883
2915
|
x: t.x + (e.labelOffset?.dx ?? 0),
|
|
2884
2916
|
y: t.y + (e.labelOffset?.dy ?? 0),
|
|
2885
2917
|
anchor: "middle"
|
|
2886
2918
|
};
|
|
2887
2919
|
}
|
|
2888
|
-
function
|
|
2920
|
+
function ei(e, t) {
|
|
2889
2921
|
let n = (e) => Math.max(-200, Math.min(200, Math.round(e))), r = {
|
|
2890
2922
|
dx: n(e) || 0,
|
|
2891
2923
|
dy: n(t) || 0
|
|
@@ -2893,16 +2925,18 @@ function Xr(e, t) {
|
|
|
2893
2925
|
return r.dx === 0 && r.dy === 0 ? void 0 : r;
|
|
2894
2926
|
}
|
|
2895
2927
|
// src/draw/WardleyRenderer.ts
|
|
2896
|
-
var
|
|
2928
|
+
var ti = 1500, K = "wardley-name-label", ni = "wardley-movement", ri = "wardley-label-handle", ii = "data-label-role", ai = 6, oi = class extends he {
|
|
2897
2929
|
grid;
|
|
2898
2930
|
elementRegistry;
|
|
2931
|
+
injector;
|
|
2899
2932
|
static $inject = [
|
|
2900
2933
|
"eventBus",
|
|
2901
2934
|
"evolutionGrid",
|
|
2902
|
-
"elementRegistry"
|
|
2935
|
+
"elementRegistry",
|
|
2936
|
+
"injector"
|
|
2903
2937
|
];
|
|
2904
|
-
constructor(e, t, n) {
|
|
2905
|
-
super(e,
|
|
2938
|
+
constructor(e, t, n, r) {
|
|
2939
|
+
super(e, ti), this.grid = t, this.elementRegistry = n, this.injector = r;
|
|
2906
2940
|
}
|
|
2907
2941
|
canRender(e) {
|
|
2908
2942
|
return N(e) || P(e);
|
|
@@ -2934,14 +2968,14 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
2934
2968
|
return T(e, i), i;
|
|
2935
2969
|
}
|
|
2936
2970
|
drawConnection(e, t) {
|
|
2937
|
-
let n = t, r = n.wardleyType === "flow", i = r ? j.flow : j.dependency, [a, o] =
|
|
2971
|
+
let n = t, r = n.wardleyType === "flow", i = r ? j.flow : j.dependency, [a, o] = mi(n), s = E(D("polyline"), {
|
|
2938
2972
|
points: `${a.x},${a.y} ${o.x},${o.y}`,
|
|
2939
2973
|
fill: "none",
|
|
2940
2974
|
stroke: i,
|
|
2941
2975
|
"stroke-width": r ? 2.5 : 1.5,
|
|
2942
2976
|
"stroke-linecap": "round"
|
|
2943
2977
|
});
|
|
2944
|
-
T(e, s), r && (T(e,
|
|
2978
|
+
T(e, s), r && (T(e, fi(a, o, i, 11, 5)), n.bidirectional && T(e, fi(o, a, i, 11, 5)));
|
|
2945
2979
|
let c = (a.x + o.x) / 2, l = (a.y + o.y) / 2;
|
|
2946
2980
|
return r && n.flowValue && T(e, q(n.flowValue, c, l - 5, {
|
|
2947
2981
|
"text-anchor": "middle",
|
|
@@ -2963,55 +2997,57 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
2963
2997
|
return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
|
|
2964
2998
|
}
|
|
2965
2999
|
drawComponent(e, t) {
|
|
2966
|
-
let n = t.width / 2, r = t.height / 2, i = t.decorators, a =
|
|
2967
|
-
a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia &&
|
|
2968
|
-
let o = t.color ?? j.stroke, s =
|
|
3000
|
+
let n = t.width / 2, r = t.height / 2, i = t.decorators, a = Vr(t, this.grid);
|
|
3001
|
+
a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia && si(e, n, r);
|
|
3002
|
+
let o = t.color ?? j.stroke, s = ui(n, r, 15, {
|
|
2969
3003
|
fill: j.componentFill,
|
|
2970
3004
|
stroke: o,
|
|
2971
3005
|
"stroke-width": 2
|
|
2972
3006
|
});
|
|
2973
|
-
|
|
3007
|
+
T(e, s), t.movement && T(e, ui(n, r, 12, {
|
|
2974
3008
|
fill: "none",
|
|
2975
3009
|
stroke: o,
|
|
2976
3010
|
"stroke-width": 1.5
|
|
2977
|
-
})),
|
|
3011
|
+
})), ci(e, n, r, o, i);
|
|
3012
|
+
let c = 15 * Math.SQRT1_2;
|
|
3013
|
+
return this.drawLinkBadge(e, t, n - c, r + c), li(e, t, n, r, Yr(t, a), G(t, this.elementRegistry)), s;
|
|
2978
3014
|
}
|
|
2979
3015
|
drawMovement(e, t, n, r, i) {
|
|
2980
3016
|
let a = t.movement;
|
|
2981
3017
|
if (!a) return;
|
|
2982
|
-
let o = E(D("g"), { class:
|
|
3018
|
+
let o = E(D("g"), { class: ni });
|
|
2983
3019
|
T(e, o);
|
|
2984
3020
|
let s = n + i, c = s - (Math.sign(i) || 1) * 17;
|
|
2985
|
-
T(o,
|
|
3021
|
+
T(o, di(n, r, c, r, {
|
|
2986
3022
|
stroke: j.plotBackground,
|
|
2987
3023
|
"stroke-width": 4,
|
|
2988
3024
|
"stroke-linecap": "butt",
|
|
2989
3025
|
class: "wardley-movement-underlay"
|
|
2990
|
-
})), T(o,
|
|
3026
|
+
})), T(o, di(n, r, c, r, {
|
|
2991
3027
|
stroke: j.movement,
|
|
2992
3028
|
"stroke-width": 1.5,
|
|
2993
3029
|
"stroke-dasharray": "6 4"
|
|
2994
|
-
})), T(o,
|
|
3030
|
+
})), T(o, fi({
|
|
2995
3031
|
x: n,
|
|
2996
3032
|
y: r
|
|
2997
3033
|
}, {
|
|
2998
3034
|
x: c,
|
|
2999
3035
|
y: r
|
|
3000
|
-
}, j.movement)), T(o,
|
|
3036
|
+
}, j.movement)), T(o, ui(s, r, 15, {
|
|
3001
3037
|
fill: j.paper,
|
|
3002
3038
|
stroke: j.movement,
|
|
3003
3039
|
"stroke-width": 2,
|
|
3004
3040
|
class: "wardley-evolve-handle"
|
|
3005
3041
|
}));
|
|
3006
|
-
let l =
|
|
3042
|
+
let l = Zr(a.labelOffset, i), u = a.newLabel ?? t.wardleyLabel;
|
|
3007
3043
|
if (T(o, q(u, n + l.x, r + l.y, {
|
|
3008
3044
|
"font-weight": "500",
|
|
3009
3045
|
fill: j.movement,
|
|
3010
3046
|
"text-anchor": l.anchor,
|
|
3011
|
-
class: `wardley-movement-label ${
|
|
3012
|
-
[
|
|
3047
|
+
class: `wardley-movement-label ${ri}`,
|
|
3048
|
+
[ii]: "movement"
|
|
3013
3049
|
}, !0, "centered")), a.method) {
|
|
3014
|
-
let e =
|
|
3050
|
+
let e = Gr(r + l.y, Ur(u).length, "centered");
|
|
3015
3051
|
T(o, q(a.method, n + l.x, e + 15, {
|
|
3016
3052
|
"font-size": 10.5,
|
|
3017
3053
|
fill: j.movement,
|
|
@@ -3020,14 +3056,14 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3020
3056
|
}
|
|
3021
3057
|
}
|
|
3022
3058
|
drawAnchor(e, t) {
|
|
3023
|
-
let n = t.width / 2, r = t.height / 2, i =
|
|
3059
|
+
let n = t.width / 2, r = t.height / 2, i = zr(Ir, n, r, 26, t.color ?? j.ink);
|
|
3024
3060
|
T(e, i);
|
|
3025
|
-
let a =
|
|
3061
|
+
let a = $r(t);
|
|
3026
3062
|
return T(e, q(t.wardleyLabel, n + a.x, r + a.y, {
|
|
3027
3063
|
"text-anchor": a.anchor,
|
|
3028
3064
|
"font-weight": "700",
|
|
3029
|
-
class: `${K} ${
|
|
3030
|
-
[
|
|
3065
|
+
class: `${K} ${ri}`,
|
|
3066
|
+
[ii]: "name",
|
|
3031
3067
|
...t.color ? { fill: t.color } : {}
|
|
3032
3068
|
}, !0, G(t, this.elementRegistry))), i;
|
|
3033
3069
|
}
|
|
@@ -3071,7 +3107,7 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3071
3107
|
}), s ?? D("text");
|
|
3072
3108
|
}
|
|
3073
3109
|
drawAttitude(e, t) {
|
|
3074
|
-
let n = t.attitudeKind ?? "pioneers", r =
|
|
3110
|
+
let n = t.attitudeKind ?? "pioneers", r = ze[n] ?? ze.pioneers, i = t.color ?? r.stroke, a = E(D("rect"), {
|
|
3075
3111
|
x: 0,
|
|
3076
3112
|
y: 0,
|
|
3077
3113
|
width: Math.max(t.width, 1),
|
|
@@ -3086,8 +3122,8 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3086
3122
|
let o = this.grid.toCanvas({
|
|
3087
3123
|
visibility: 1,
|
|
3088
3124
|
evolution: 0
|
|
3089
|
-
}).y, s = t.y -
|
|
3090
|
-
return T(e, q(
|
|
3125
|
+
}).y, s = t.y - ai - M.label >= o;
|
|
3126
|
+
return T(e, q(Be[n] ?? n, s ? 4 : 10, s ? -6 : 18, {
|
|
3091
3127
|
fill: i,
|
|
3092
3128
|
"font-weight": "700",
|
|
3093
3129
|
"letter-spacing": "0.04em",
|
|
@@ -3095,7 +3131,7 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3095
3131
|
})), a;
|
|
3096
3132
|
}
|
|
3097
3133
|
drawAnnotation(e, t) {
|
|
3098
|
-
let n = t.width / 2, r = t.height / 2, i =
|
|
3134
|
+
let n = t.width / 2, r = t.height / 2, i = ui(n, r, 10, {
|
|
3099
3135
|
fill: j.annotationFill,
|
|
3100
3136
|
stroke: t.color ?? j.stroke,
|
|
3101
3137
|
"stroke-width": 1.25
|
|
@@ -3111,7 +3147,7 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3111
3147
|
}, !0, G(t, this.elementRegistry))), i;
|
|
3112
3148
|
}
|
|
3113
3149
|
drawAccelerator(e, t) {
|
|
3114
|
-
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a =
|
|
3150
|
+
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a = zr(i ? Lr : Rr, n, r, 24, t.color ?? (i ? j.accelerator : j.deaccelerator));
|
|
3115
3151
|
return T(e, a), t.wardleyLabel && T(e, q(t.wardleyLabel, n + 15, r + 5, {
|
|
3116
3152
|
"font-size": 12,
|
|
3117
3153
|
class: K
|
|
@@ -3141,19 +3177,40 @@ var Zr = 1500, K = "wardley-name-label", Qr = "wardley-movement", $r = "wardley-
|
|
|
3141
3177
|
"font-weight": "500",
|
|
3142
3178
|
class: K,
|
|
3143
3179
|
...t.color ? { fill: t.color } : {}
|
|
3144
|
-
}, !0, G(t, this.elementRegistry))), a;
|
|
3180
|
+
}, !0, G(t, this.elementRegistry))), this.drawLinkBadge(e, t, n - 16 + 1, r + 16 - 1), a;
|
|
3181
|
+
}
|
|
3182
|
+
drawLinkBadge(e, t, n, r) {
|
|
3183
|
+
if (!this.injector.get("wardleyLinkOpener", !1)?.openableLink(t)) return;
|
|
3184
|
+
let i = E(D("g"), {
|
|
3185
|
+
class: Fe,
|
|
3186
|
+
"aria-hidden": "true"
|
|
3187
|
+
});
|
|
3188
|
+
T(i, E(D("circle"), {
|
|
3189
|
+
cx: n,
|
|
3190
|
+
cy: r,
|
|
3191
|
+
r: 8
|
|
3192
|
+
}));
|
|
3193
|
+
let a = D(`<g>${Fr.link}</g>`), o = 11 / 2;
|
|
3194
|
+
E(a, {
|
|
3195
|
+
transform: `translate(${n - o}, ${r - o}) scale(0.4583333333333333)`,
|
|
3196
|
+
fill: "none",
|
|
3197
|
+
stroke: "currentColor",
|
|
3198
|
+
"stroke-width": 2.5,
|
|
3199
|
+
"stroke-linecap": "round",
|
|
3200
|
+
"stroke-linejoin": "round"
|
|
3201
|
+
}), T(i, a), T(e, i);
|
|
3145
3202
|
}
|
|
3146
3203
|
};
|
|
3147
|
-
function
|
|
3204
|
+
function si(e, t, n) {
|
|
3148
3205
|
let r = t + 15 + 3;
|
|
3149
|
-
T(e,
|
|
3206
|
+
T(e, di(r, n - 13, r, n + 13, {
|
|
3150
3207
|
stroke: j.inertia,
|
|
3151
3208
|
"stroke-width": 3,
|
|
3152
3209
|
"stroke-linecap": "round"
|
|
3153
3210
|
}));
|
|
3154
3211
|
}
|
|
3155
|
-
function
|
|
3156
|
-
if (i?.ecosystem && T(e,
|
|
3212
|
+
function ci(e, t, n, r, i) {
|
|
3213
|
+
if (i?.ecosystem && T(e, ui(t, n, 18.5, {
|
|
3157
3214
|
fill: "none",
|
|
3158
3215
|
stroke: r,
|
|
3159
3216
|
"stroke-width": 1.25,
|
|
@@ -3163,20 +3220,20 @@ function ii(e, t, n, r, i) {
|
|
|
3163
3220
|
[0, -3.8],
|
|
3164
3221
|
[-3.4, 2.4],
|
|
3165
3222
|
[3.4, 2.4]
|
|
3166
|
-
]) T(e,
|
|
3223
|
+
]) T(e, ui(t + i, n + a, 1.7, { fill: r }));
|
|
3167
3224
|
}
|
|
3168
|
-
function
|
|
3225
|
+
function li(e, t, n, r, i, a) {
|
|
3169
3226
|
let o = n + i.x, s = r + i.y;
|
|
3170
3227
|
T(e, q(t.wardleyLabel, o, s, {
|
|
3171
3228
|
"font-weight": "500",
|
|
3172
3229
|
"text-anchor": i.anchor,
|
|
3173
|
-
class: `${K} ${
|
|
3174
|
-
[
|
|
3230
|
+
class: `${K} ${ri}`,
|
|
3231
|
+
[ii]: "name",
|
|
3175
3232
|
...t.color ? { fill: t.color } : {}
|
|
3176
3233
|
}, !0, a));
|
|
3177
3234
|
let c = t.decorators?.method;
|
|
3178
3235
|
if (c) {
|
|
3179
|
-
let n =
|
|
3236
|
+
let n = Gr(s, Ur(t.wardleyLabel).length, a);
|
|
3180
3237
|
T(e, q(c, o, n + 15, {
|
|
3181
3238
|
"font-size": 10.5,
|
|
3182
3239
|
"text-anchor": i.anchor,
|
|
@@ -3184,7 +3241,7 @@ function ai(e, t, n, r, i, a) {
|
|
|
3184
3241
|
}));
|
|
3185
3242
|
}
|
|
3186
3243
|
}
|
|
3187
|
-
function
|
|
3244
|
+
function ui(e, t, n, r) {
|
|
3188
3245
|
return E(D("circle"), {
|
|
3189
3246
|
cx: e,
|
|
3190
3247
|
cy: t,
|
|
@@ -3193,7 +3250,7 @@ function oi(e, t, n, r) {
|
|
|
3193
3250
|
...r
|
|
3194
3251
|
});
|
|
3195
3252
|
}
|
|
3196
|
-
function
|
|
3253
|
+
function di(e, t, n, r, i) {
|
|
3197
3254
|
return E(D("line"), {
|
|
3198
3255
|
x1: e,
|
|
3199
3256
|
y1: t,
|
|
@@ -3203,7 +3260,7 @@ function si(e, t, n, r, i) {
|
|
|
3203
3260
|
});
|
|
3204
3261
|
}
|
|
3205
3262
|
function q(e, t, n, r = {}, i = !0, a) {
|
|
3206
|
-
let o = a ?
|
|
3263
|
+
let o = a ? Ur(e) : [e], s = a ? Wr(n, o.length, a) : n, c = i ? {
|
|
3207
3264
|
stroke: j.paper,
|
|
3208
3265
|
"stroke-width": 3.5,
|
|
3209
3266
|
"paint-order": "stroke",
|
|
@@ -3225,17 +3282,17 @@ function q(e, t, n, r = {}, i = !0, a) {
|
|
|
3225
3282
|
r.textContent = e, T(l, r);
|
|
3226
3283
|
}), l);
|
|
3227
3284
|
}
|
|
3228
|
-
function
|
|
3285
|
+
function fi(e, t, n, r = 10, i = 5) {
|
|
3229
3286
|
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)}`;
|
|
3230
3287
|
return E(D("polygon"), {
|
|
3231
3288
|
points: c,
|
|
3232
3289
|
fill: n
|
|
3233
3290
|
});
|
|
3234
3291
|
}
|
|
3235
|
-
function
|
|
3292
|
+
function pi(e) {
|
|
3236
3293
|
return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
|
|
3237
3294
|
}
|
|
3238
|
-
function
|
|
3295
|
+
function mi(e) {
|
|
3239
3296
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
3240
3297
|
if (!t || !n) {
|
|
3241
3298
|
let e = r[0] ?? {
|
|
@@ -3244,7 +3301,7 @@ function ui(e) {
|
|
|
3244
3301
|
};
|
|
3245
3302
|
return [e, r[r.length - 1] ?? e];
|
|
3246
3303
|
}
|
|
3247
|
-
let i =
|
|
3304
|
+
let i = H(t), a = H(n), o = a.x - i.x, s = a.y - i.y, c = Math.hypot(o, s) || 1, l = o / c, u = s / c, d = pi(t), f = pi(n);
|
|
3248
3305
|
return c <= d + f + 2 ? [i, a] : [{
|
|
3249
3306
|
x: i.x + l * d,
|
|
3250
3307
|
y: i.y + u * d
|
|
@@ -3254,35 +3311,35 @@ function ui(e) {
|
|
|
3254
3311
|
}];
|
|
3255
3312
|
}
|
|
3256
3313
|
// src/draw/index.ts
|
|
3257
|
-
var
|
|
3314
|
+
var hi = {
|
|
3258
3315
|
__init__: ["wardleyRenderer"],
|
|
3259
|
-
wardleyRenderer: ["type",
|
|
3260
|
-
},
|
|
3316
|
+
wardleyRenderer: ["type", oi]
|
|
3317
|
+
}, gi = class extends hn {
|
|
3261
3318
|
_getModules() {
|
|
3262
3319
|
return [
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3320
|
+
Sn,
|
|
3321
|
+
Nr,
|
|
3322
|
+
hi,
|
|
3323
|
+
ct
|
|
3267
3324
|
];
|
|
3268
3325
|
}
|
|
3269
|
-
},
|
|
3270
|
-
function
|
|
3326
|
+
}, _i = 180, vi = 80, yi = 120, bi = 96, xi = .5, Si = (e, t, n) => e < t ? t : e > n ? n : e;
|
|
3327
|
+
function Ci(e, t, n, r) {
|
|
3271
3328
|
let i = n.min - n.padBefore, a = n.max + n.padAfter;
|
|
3272
|
-
return !r && t >= n.max - n.min ?
|
|
3329
|
+
return !r && t >= n.max - n.min ? Si(e, Math.min(n.max - t, i), Math.max(n.min, a - t)) : t <= a - i ? Si(e, i, a - t) : (i + a) / 2 - t / 2;
|
|
3273
3330
|
}
|
|
3274
|
-
function
|
|
3331
|
+
function wi(e, t, n) {
|
|
3275
3332
|
let r = e - n.after;
|
|
3276
3333
|
return {
|
|
3277
3334
|
lowest: Math.min(t.min - n.before - n.slack, t.max - r - n.slack),
|
|
3278
3335
|
highest: Math.max(t.max - r + n.slack, t.min - n.before + n.slack)
|
|
3279
3336
|
};
|
|
3280
3337
|
}
|
|
3281
|
-
function
|
|
3282
|
-
let a =
|
|
3283
|
-
return
|
|
3338
|
+
function Ti(e, t, n, r, i) {
|
|
3339
|
+
let a = wi(t, n, i), o = wi(t, r, i);
|
|
3340
|
+
return Si(e, Math.min(a.lowest, o.lowest), Math.max(a.highest, o.highest));
|
|
3284
3341
|
}
|
|
3285
|
-
var
|
|
3342
|
+
var Ei = class {
|
|
3286
3343
|
canvas;
|
|
3287
3344
|
grid;
|
|
3288
3345
|
static $inject = [
|
|
@@ -3309,12 +3366,12 @@ var Si = class {
|
|
|
3309
3366
|
});
|
|
3310
3367
|
}
|
|
3311
3368
|
contentBounds() {
|
|
3312
|
-
return this.measured ??=
|
|
3369
|
+
return this.measured ??= We(this.canvas, this.grid, 0), this.measured;
|
|
3313
3370
|
}
|
|
3314
3371
|
freeArea(e) {
|
|
3315
3372
|
let t = this.freeRect?.insets(), n = t ? e.scale ?? this.canvas.zoom() : 0;
|
|
3316
3373
|
if (!t || !(n > 0)) return;
|
|
3317
|
-
let r =
|
|
3374
|
+
let r = bi / n, i = (e, t, i) => e * n - t - i > 0 ? {
|
|
3318
3375
|
before: t / n,
|
|
3319
3376
|
after: i / n,
|
|
3320
3377
|
slack: r
|
|
@@ -3339,26 +3396,26 @@ var Si = class {
|
|
|
3339
3396
|
min: r.y,
|
|
3340
3397
|
max: r.y + r.height
|
|
3341
3398
|
}, o = this.freeArea(n), s = this.grid.outerBounds(), c = {
|
|
3342
|
-
top:
|
|
3343
|
-
right:
|
|
3344
|
-
bottom:
|
|
3345
|
-
left:
|
|
3346
|
-
}, l = o ?
|
|
3399
|
+
top: _i,
|
|
3400
|
+
right: yi,
|
|
3401
|
+
bottom: vi,
|
|
3402
|
+
left: yi
|
|
3403
|
+
}, l = o ? Ti(n.x, n.width, i, {
|
|
3347
3404
|
min: s.x,
|
|
3348
3405
|
max: s.x + s.width
|
|
3349
|
-
}, o.x) :
|
|
3406
|
+
}, o.x) : Ci(n.x, n.width, {
|
|
3350
3407
|
...i,
|
|
3351
3408
|
padBefore: c.left,
|
|
3352
3409
|
padAfter: c.right
|
|
3353
|
-
}, t), u = o ?
|
|
3410
|
+
}, t), u = o ? Ti(n.y, n.height, a, {
|
|
3354
3411
|
min: s.y,
|
|
3355
3412
|
max: s.y + s.height
|
|
3356
|
-
}, o.y) :
|
|
3413
|
+
}, o.y) : Ci(n.y, n.height, {
|
|
3357
3414
|
...a,
|
|
3358
3415
|
padBefore: c.top,
|
|
3359
3416
|
padAfter: c.bottom
|
|
3360
3417
|
}, t);
|
|
3361
|
-
if (!(Math.abs(l - n.x) <
|
|
3418
|
+
if (!(Math.abs(l - n.x) < xi && Math.abs(u - n.y) < xi)) {
|
|
3362
3419
|
this.applying = !0;
|
|
3363
3420
|
try {
|
|
3364
3421
|
this.canvas.viewbox({
|
|
@@ -3372,10 +3429,10 @@ var Si = class {
|
|
|
3372
3429
|
}
|
|
3373
3430
|
}
|
|
3374
3431
|
}
|
|
3375
|
-
},
|
|
3432
|
+
}, Di = {
|
|
3376
3433
|
__init__: ["panConstraint"],
|
|
3377
|
-
panConstraint: ["type",
|
|
3378
|
-
},
|
|
3434
|
+
panConstraint: ["type", Ei]
|
|
3435
|
+
}, Oi = class {
|
|
3379
3436
|
canvas;
|
|
3380
3437
|
config;
|
|
3381
3438
|
static $inject = ["canvas", "config.wardleyFreeRect"];
|
|
@@ -3405,7 +3462,7 @@ var Si = class {
|
|
|
3405
3462
|
y: t.y + a(i, n.top, n.bottom) / t.scale
|
|
3406
3463
|
};
|
|
3407
3464
|
}
|
|
3408
|
-
},
|
|
3465
|
+
}, ki = { wardleyFreeRect: ["type", Oi] }, Ai = class extends gi {
|
|
3409
3466
|
_getModules() {
|
|
3410
3467
|
return [
|
|
3411
3468
|
...super._getModules(),
|
|
@@ -3413,11 +3470,11 @@ var Si = class {
|
|
|
3413
3470
|
_e,
|
|
3414
3471
|
ve,
|
|
3415
3472
|
ye,
|
|
3416
|
-
|
|
3417
|
-
|
|
3473
|
+
ki,
|
|
3474
|
+
Di
|
|
3418
3475
|
];
|
|
3419
3476
|
}
|
|
3420
|
-
},
|
|
3477
|
+
}, ji = "lasso", Mi = "lasso.selection", Ni = class {
|
|
3421
3478
|
static $inject = [
|
|
3422
3479
|
"eventBus",
|
|
3423
3480
|
"canvas",
|
|
@@ -3435,41 +3492,41 @@ var Si = class {
|
|
|
3435
3492
|
return;
|
|
3436
3493
|
}
|
|
3437
3494
|
if (e.element === i) return n.activateLasso(r), !1;
|
|
3438
|
-
}), e.on(`${
|
|
3439
|
-
r.isActive(
|
|
3495
|
+
}), e.on(`${Mi}.cleanup`, () => {
|
|
3496
|
+
r.isActive(ji) && r.setActive(null);
|
|
3440
3497
|
});
|
|
3441
3498
|
}
|
|
3442
|
-
},
|
|
3499
|
+
}, Pi = {
|
|
3443
3500
|
__depends__: [ke],
|
|
3444
3501
|
__init__: ["wardleyLassoBehavior"],
|
|
3445
|
-
wardleyLassoBehavior: ["type",
|
|
3446
|
-
},
|
|
3502
|
+
wardleyLassoBehavior: ["type", Ni]
|
|
3503
|
+
}, Fi = /* @__PURE__ */ new Set([
|
|
3447
3504
|
"component",
|
|
3448
3505
|
"anchor",
|
|
3449
3506
|
"submap",
|
|
3450
3507
|
"pipeline"
|
|
3451
|
-
]),
|
|
3452
|
-
function
|
|
3453
|
-
return N(e) &&
|
|
3508
|
+
]), Ii = /* @__PURE__ */ new Set(["e", "w"]);
|
|
3509
|
+
function Li(e) {
|
|
3510
|
+
return N(e) && Fi.has(e.wardleyType);
|
|
3454
3511
|
}
|
|
3455
|
-
function
|
|
3512
|
+
function Ri(e, t) {
|
|
3456
3513
|
return (e.outgoing ?? []).some((e) => e.target === t) || (e.incoming ?? []).some((e) => e.source === t);
|
|
3457
3514
|
}
|
|
3458
|
-
var
|
|
3515
|
+
var zi = class extends se {
|
|
3459
3516
|
static $inject = ["eventBus"];
|
|
3460
3517
|
constructor(e) {
|
|
3461
3518
|
super(e);
|
|
3462
3519
|
}
|
|
3463
3520
|
init() {
|
|
3464
|
-
this.addRule("connection.start", (e) =>
|
|
3521
|
+
this.addRule("connection.start", (e) => Li(e.source)), this.addRule("connection.create", (e) => {
|
|
3465
3522
|
let { source: t, target: n } = e;
|
|
3466
|
-
return !
|
|
3467
|
-
}), this.addRule("shape.move", () => !0), this.addRule("elements.move", (e) => !e.target?.parent || null), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => I(e.shape) ? !e.direction ||
|
|
3523
|
+
return !Li(t) || !Li(n) || t === n || Ri(t, n) ? !1 : { wardleyType: "dependency" };
|
|
3524
|
+
}), this.addRule("shape.move", () => !0), this.addRule("elements.move", (e) => !e.target?.parent || null), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => I(e.shape) ? !e.direction || Ii.has(e.direction) : nt(e.shape));
|
|
3468
3525
|
}
|
|
3469
|
-
},
|
|
3526
|
+
}, Bi = {
|
|
3470
3527
|
__init__: ["wardleyRules"],
|
|
3471
|
-
wardleyRules: ["type",
|
|
3472
|
-
},
|
|
3528
|
+
wardleyRules: ["type", zi]
|
|
3529
|
+
}, Vi = {
|
|
3473
3530
|
__init__: ["stageSnapping"],
|
|
3474
3531
|
stageSnapping: ["type", class {
|
|
3475
3532
|
static $inject = [
|
|
@@ -3509,20 +3566,20 @@ var Fi = class extends se {
|
|
|
3509
3566
|
});
|
|
3510
3567
|
}
|
|
3511
3568
|
}]
|
|
3512
|
-
}, J = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`,
|
|
3513
|
-
draw:
|
|
3514
|
-
lasso:
|
|
3515
|
-
component: J(
|
|
3516
|
-
market: J(
|
|
3517
|
-
ecosystem: J(
|
|
3518
|
-
anchor: J(`<path d="${
|
|
3569
|
+
}, J = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`, Hi = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="wardley-palette-svg">${e}</svg>`, Ui = "<path d=\"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z\"/><path d=\"M5 3a2 2 0 0 0-2 2\"/><path d=\"M19 3a2 2 0 0 1 2 2\"/><path d=\"M5 21a2 2 0 0 1-2-2\"/><path d=\"M9 3h1\"/><path d=\"M9 21h2\"/><path d=\"M14 3h1\"/><path d=\"M3 9v1\"/><path d=\"M21 9v2\"/><path d=\"M3 14v1\"/>", Wi = "<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>", Gi = (e = "") => `<circle cx="12" cy="12" r="7" fill="${j.componentFill}" stroke="${j.stroke}" stroke-width="2"/>${e}`, Ki = (e, t) => `<text x="12" text-anchor="middle" font-family="${M.family}" ${t}>${e}</text>`, Y = {
|
|
3570
|
+
draw: Hi(Wi),
|
|
3571
|
+
lasso: Hi(Ui),
|
|
3572
|
+
component: J(Gi()),
|
|
3573
|
+
market: J(Gi(`<circle cx="12" cy="10" r="1.4" fill="${j.stroke}"/><circle cx="10.2" cy="13.4" r="1.4" fill="${j.stroke}"/><circle cx="13.8" cy="13.4" r="1.4" fill="${j.stroke}"/>`)),
|
|
3574
|
+
ecosystem: J(Gi(`<circle cx="12" cy="12" r="10" fill="none" stroke="${j.stroke}" stroke-width="1.25" stroke-dasharray="1.5 3" stroke-linecap="round"/>`)),
|
|
3575
|
+
anchor: J(`<path d="${Ir}" fill="${j.ink}"/>`),
|
|
3519
3576
|
pipeline: J(`<rect x="9.5" y="2.5" width="5.5" height="5.5" fill="${j.componentFill}" stroke="${j.stroke}" stroke-width="1.5"/><rect x="2" y="10" width="20" height="9" rx="2" fill="none" stroke="${j.pipeline}" stroke-width="1.25" stroke-dasharray="3 2"/><circle cx="7" cy="14.5" r="2.2" fill="${j.componentFill}" stroke="${j.stroke}" stroke-width="1.2"/><circle cx="17" cy="14.5" r="2.2" fill="${j.componentFill}" stroke="${j.stroke}" stroke-width="1.2"/>`),
|
|
3520
3577
|
note: J(`<g fill="none" stroke="${j.noteText}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4h14v11l-5 5H5z" fill="${j.componentFill}"/><path d="M14 20v-5h5"/><line x1="8" y1="8.5" x2="16" y2="8.5"/><line x1="8" y1="12" x2="13" y2="12"/></g>`),
|
|
3521
|
-
annotation: J(`<circle cx="12" cy="12" r="8" fill="${j.annotationFill}" stroke="${j.stroke}" stroke-width="1.25"/>` +
|
|
3522
|
-
accelerator: J(`<path d="${
|
|
3523
|
-
deaccelerator: J(`<path d="${
|
|
3578
|
+
annotation: J(`<circle cx="12" cy="12" r="8" fill="${j.annotationFill}" stroke="${j.stroke}" stroke-width="1.25"/>` + Ki("1", `y="16" font-size="11" font-weight="700" fill="${j.stroke}"`)),
|
|
3579
|
+
accelerator: J(`<path d="${Lr}" fill="${j.accelerator}"/>`),
|
|
3580
|
+
deaccelerator: J(`<path d="${Rr}" fill="${j.deaccelerator}"/>`),
|
|
3524
3581
|
submap: J(`<rect x="4" y="4" width="16" height="16" rx="3" fill="${j.componentFill}" stroke="${j.stroke}" stroke-width="2"/><rect x="7.5" y="7.5" width="9" height="9" rx="1.5" fill="none" stroke="${j.stroke}" stroke-width="1"/>`)
|
|
3525
|
-
},
|
|
3582
|
+
}, qi = {
|
|
3526
3583
|
pioneers: "P",
|
|
3527
3584
|
settlers: "S",
|
|
3528
3585
|
townplanners: "T"
|
|
@@ -3531,15 +3588,15 @@ var Fi = class extends se {
|
|
|
3531
3588
|
* straight segment. Lucide (lucide-static 1.59.0) @license ISC
|
|
3532
3589
|
* Copyright (c) 2026 Lucide Icons and Contributors
|
|
3533
3590
|
* Full notice: README.md of @miragon/wardley-renderer */
|
|
3534
|
-
function
|
|
3535
|
-
let t =
|
|
3591
|
+
function Ji(e) {
|
|
3592
|
+
let t = ze[e] ?? {
|
|
3536
3593
|
fill: j.band,
|
|
3537
3594
|
stroke: j.dependency
|
|
3538
|
-
}, n =
|
|
3539
|
-
return J(`<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"/>` +
|
|
3595
|
+
}, n = qi[e] ?? "";
|
|
3596
|
+
return J(`<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"/>` + Ki(n, `y="15.3" font-size="9" font-weight="700" fill="${j.ink}"`));
|
|
3540
3597
|
}
|
|
3541
3598
|
// src/palette/WardleyPaletteProvider.ts
|
|
3542
|
-
var
|
|
3599
|
+
var Yi = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
3543
3600
|
{
|
|
3544
3601
|
key: "component",
|
|
3545
3602
|
type: "component",
|
|
@@ -3547,7 +3604,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3547
3604
|
title: "Component",
|
|
3548
3605
|
shortcut: "C",
|
|
3549
3606
|
icon: Y.component,
|
|
3550
|
-
group:
|
|
3607
|
+
group: Yi
|
|
3551
3608
|
},
|
|
3552
3609
|
{
|
|
3553
3610
|
key: "market",
|
|
@@ -3555,7 +3612,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3555
3612
|
label: "Market",
|
|
3556
3613
|
title: "Market component",
|
|
3557
3614
|
icon: Y.market,
|
|
3558
|
-
group:
|
|
3615
|
+
group: Yi,
|
|
3559
3616
|
extra: { market: !0 }
|
|
3560
3617
|
},
|
|
3561
3618
|
{
|
|
@@ -3564,7 +3621,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3564
3621
|
label: "Ecosystem",
|
|
3565
3622
|
title: "Ecosystem component",
|
|
3566
3623
|
icon: Y.ecosystem,
|
|
3567
|
-
group:
|
|
3624
|
+
group: Yi,
|
|
3568
3625
|
extra: { ecosystem: !0 }
|
|
3569
3626
|
},
|
|
3570
3627
|
{
|
|
@@ -3574,7 +3631,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3574
3631
|
title: "Anchor / User",
|
|
3575
3632
|
shortcut: "U",
|
|
3576
3633
|
icon: Y.anchor,
|
|
3577
|
-
group:
|
|
3634
|
+
group: Yi
|
|
3578
3635
|
},
|
|
3579
3636
|
{
|
|
3580
3637
|
key: "pipeline",
|
|
@@ -3583,7 +3640,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3583
3640
|
title: "Pipeline",
|
|
3584
3641
|
shortcut: "P",
|
|
3585
3642
|
icon: Y.pipeline,
|
|
3586
|
-
group:
|
|
3643
|
+
group: Yi
|
|
3587
3644
|
},
|
|
3588
3645
|
{
|
|
3589
3646
|
key: "submap",
|
|
@@ -3591,15 +3648,15 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3591
3648
|
label: "Submap",
|
|
3592
3649
|
title: "Submap",
|
|
3593
3650
|
icon: Y.submap,
|
|
3594
|
-
group:
|
|
3651
|
+
group: Yi
|
|
3595
3652
|
},
|
|
3596
3653
|
{
|
|
3597
3654
|
key: "pioneers",
|
|
3598
3655
|
type: "attitude",
|
|
3599
3656
|
label: "Pioneers",
|
|
3600
3657
|
title: "Pioneers region",
|
|
3601
|
-
icon:
|
|
3602
|
-
group:
|
|
3658
|
+
icon: Ji("pioneers"),
|
|
3659
|
+
group: Xi,
|
|
3603
3660
|
extra: { attitudeKind: "pioneers" }
|
|
3604
3661
|
},
|
|
3605
3662
|
{
|
|
@@ -3607,8 +3664,8 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3607
3664
|
type: "attitude",
|
|
3608
3665
|
label: "Settlers",
|
|
3609
3666
|
title: "Settlers region",
|
|
3610
|
-
icon:
|
|
3611
|
-
group:
|
|
3667
|
+
icon: Ji("settlers"),
|
|
3668
|
+
group: Xi,
|
|
3612
3669
|
extra: { attitudeKind: "settlers" }
|
|
3613
3670
|
},
|
|
3614
3671
|
{
|
|
@@ -3616,8 +3673,8 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3616
3673
|
type: "attitude",
|
|
3617
3674
|
label: "Town Planners",
|
|
3618
3675
|
title: "Town Planners region",
|
|
3619
|
-
icon:
|
|
3620
|
-
group:
|
|
3676
|
+
icon: Ji("townplanners"),
|
|
3677
|
+
group: Xi,
|
|
3621
3678
|
extra: { attitudeKind: "townplanners" }
|
|
3622
3679
|
},
|
|
3623
3680
|
{
|
|
@@ -3626,7 +3683,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3626
3683
|
label: "Accelerate",
|
|
3627
3684
|
title: "Accelerator",
|
|
3628
3685
|
icon: Y.accelerator,
|
|
3629
|
-
group:
|
|
3686
|
+
group: Xi,
|
|
3630
3687
|
extra: { acceleratorDirection: "accelerate" }
|
|
3631
3688
|
},
|
|
3632
3689
|
{
|
|
@@ -3635,7 +3692,7 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3635
3692
|
label: "Deaccelerate",
|
|
3636
3693
|
title: "Deaccelerator",
|
|
3637
3694
|
icon: Y.deaccelerator,
|
|
3638
|
-
group:
|
|
3695
|
+
group: Xi,
|
|
3639
3696
|
extra: { acceleratorDirection: "deaccelerate" }
|
|
3640
3697
|
},
|
|
3641
3698
|
{
|
|
@@ -3647,23 +3704,23 @@ var Gi = "wardley-1-blocks", Ki = "wardley-2-strategy", qi = [
|
|
|
3647
3704
|
icon: Y.note,
|
|
3648
3705
|
group: "wardley-3-notes"
|
|
3649
3706
|
}
|
|
3650
|
-
],
|
|
3707
|
+
], Qi = {
|
|
3651
3708
|
key: "lasso-tool",
|
|
3652
3709
|
title: "Lasso",
|
|
3653
3710
|
shortcut: "L",
|
|
3654
3711
|
icon: Y.lasso
|
|
3655
|
-
},
|
|
3712
|
+
}, $i = {
|
|
3656
3713
|
key: "draw-tool",
|
|
3657
3714
|
title: "Draw",
|
|
3658
3715
|
icon: Y.draw
|
|
3659
|
-
},
|
|
3660
|
-
function
|
|
3716
|
+
}, ea = 24, ta = 24, na = 12;
|
|
3717
|
+
function ra(e) {
|
|
3661
3718
|
return e.replace(/&/g, "&").replace(/"/g, """);
|
|
3662
3719
|
}
|
|
3663
|
-
function
|
|
3720
|
+
function ia(e) {
|
|
3664
3721
|
return e.type === "click" && e.detail === 0;
|
|
3665
3722
|
}
|
|
3666
|
-
var
|
|
3723
|
+
var aa = class {
|
|
3667
3724
|
create;
|
|
3668
3725
|
factory;
|
|
3669
3726
|
lassoTool;
|
|
@@ -3683,26 +3740,26 @@ var ta = class {
|
|
|
3683
3740
|
}
|
|
3684
3741
|
getPaletteEntries() {
|
|
3685
3742
|
let e = {};
|
|
3686
|
-
e[
|
|
3743
|
+
e[Qi.key] = {
|
|
3687
3744
|
group: "tools",
|
|
3688
|
-
...this.describe(
|
|
3689
|
-
html: this.entryHtml(
|
|
3745
|
+
...this.describe(Qi.title, Qi.shortcut),
|
|
3746
|
+
html: this.entryHtml(Qi.title, Qi.icon, Qi.shortcut),
|
|
3690
3747
|
action: { click: (e) => {
|
|
3691
|
-
|
|
3748
|
+
ia(e) && this.lassoArmed() ? this.putLassoDown() : (this.lassoTool.activateSelection(e), this.focusCanvasAfterPointer(e));
|
|
3692
3749
|
} }
|
|
3693
|
-
}, e[
|
|
3750
|
+
}, e[$i.key] = {
|
|
3694
3751
|
group: "tools",
|
|
3695
|
-
...this.describe(
|
|
3696
|
-
html: this.entryHtml(
|
|
3752
|
+
...this.describe($i.title, $i.shortcut),
|
|
3753
|
+
html: this.entryHtml($i.title, $i.icon, $i.shortcut),
|
|
3697
3754
|
action: { click: (e) => {
|
|
3698
|
-
|
|
3755
|
+
ia(e) && !R(this.injector) && this.putLassoDown(), this.drawTool.toggle(), this.focusCanvasAfterPointer(e);
|
|
3699
3756
|
} }
|
|
3700
3757
|
};
|
|
3701
|
-
for (let t of
|
|
3758
|
+
for (let t of Zi) {
|
|
3702
3759
|
let n = (e) => {
|
|
3703
3760
|
this.create.start(e, this.createShapeFor(t)), this.focusCanvasAfterPointer(e);
|
|
3704
3761
|
}, r = (e) => {
|
|
3705
|
-
|
|
3762
|
+
ia(e) ? this.createAtFreeCenter(`create.${t.key}`) : n(e);
|
|
3706
3763
|
};
|
|
3707
3764
|
e[`create.${t.key}`] = {
|
|
3708
3765
|
group: t.group,
|
|
@@ -3717,16 +3774,16 @@ var ta = class {
|
|
|
3717
3774
|
return e;
|
|
3718
3775
|
}
|
|
3719
3776
|
createAtFreeCenter(e) {
|
|
3720
|
-
let t =
|
|
3721
|
-
if (!t ||
|
|
3777
|
+
let t = Zi.find((t) => `create.${t.key}` === e);
|
|
3778
|
+
if (!t || R(this.injector)) return;
|
|
3722
3779
|
let n = this.injector.get("modeling"), r = this.injector.get("canvas"), i = this.injector.get("evolutionGrid"), a = this.createShapeFor(t), o = this.freeCenterPosition(a, r, i);
|
|
3723
3780
|
return n.createShape(a, o, r.getRootElement()), this.injector.get("selection", !1)?.select(a), r.focus(), t.type !== "attitude" && this.injector.get("wardleyLabelEditing", !1)?.activate(a), a;
|
|
3724
3781
|
}
|
|
3725
3782
|
focusCanvasAfterPointer(e) {
|
|
3726
|
-
|
|
3783
|
+
ia(e) || B(this.injector.get("canvas"));
|
|
3727
3784
|
}
|
|
3728
3785
|
lassoArmed() {
|
|
3729
|
-
return this.injector.get("dragging").context()?.prefix ===
|
|
3786
|
+
return this.injector.get("dragging").context()?.prefix === Mi;
|
|
3730
3787
|
}
|
|
3731
3788
|
putLassoDown() {
|
|
3732
3789
|
this.lassoArmed() && this.injector.get("dragging").cancel(!1);
|
|
@@ -3745,13 +3802,13 @@ var ta = class {
|
|
|
3745
3802
|
evolution: 1,
|
|
3746
3803
|
visibility: 0
|
|
3747
3804
|
}), o = (e, t, n, r) => {
|
|
3748
|
-
let i = t + r / 2 +
|
|
3805
|
+
let i = t + r / 2 + ea, a = n - r / 2 - ea;
|
|
3749
3806
|
return i > a ? (t + n) / 2 : Math.min(a, Math.max(i, e));
|
|
3750
3807
|
}, s = (t) => ({
|
|
3751
|
-
x: o(r.x + t *
|
|
3752
|
-
y: o(r.y + t *
|
|
3808
|
+
x: o(r.x + t * ta, i.x, a.x, e.width),
|
|
3809
|
+
y: o(r.y + t * ta, i.y, a.y, e.height)
|
|
3753
3810
|
}), c = this.injector.get("elementRegistry"), l = (t) => c.find((n) => N(n) && n.wardleyType !== "attitude" && n.wardleyType !== "drawing" && Math.abs(n.x + n.width / 2 - t.x) < (n.width + e.width) / 2 && Math.abs(n.y + n.height / 2 - t.y) < (n.height + e.height) / 2) !== void 0;
|
|
3754
|
-
for (let e = 0; e <
|
|
3811
|
+
for (let e = 0; e < na; e++) {
|
|
3755
3812
|
let t = s(e);
|
|
3756
3813
|
if (!l(t)) return t;
|
|
3757
3814
|
}
|
|
@@ -3764,10 +3821,10 @@ var ta = class {
|
|
|
3764
3821
|
} : { title: e };
|
|
3765
3822
|
}
|
|
3766
3823
|
entryHtml(e, t, n, r = !1) {
|
|
3767
|
-
let i = this.needsNativeTitle ? ` title="${
|
|
3824
|
+
let i = this.needsNativeTitle ? ` title="${ra(n ? `${e} (${n})` : e)}"` : "", a = n ? ` aria-keyshortcuts="${ra(n)}"` : "";
|
|
3768
3825
|
return `<div class="entry wardley-palette-entry"${r ? " draggable=\"true\"" : ""}${i}${a}>${t}</div>`;
|
|
3769
3826
|
}
|
|
3770
|
-
},
|
|
3827
|
+
}, oa = ".djs-palette-entries .entry", sa = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), ca = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), la = /* @__PURE__ */ new Set(["Enter", " "]), ua = class {
|
|
3771
3828
|
palette;
|
|
3772
3829
|
provider;
|
|
3773
3830
|
static $inject = [
|
|
@@ -3799,7 +3856,7 @@ var ta = class {
|
|
|
3799
3856
|
}), this.updateTabStops());
|
|
3800
3857
|
}
|
|
3801
3858
|
entries() {
|
|
3802
|
-
return this.container ? Array.from(this.container.querySelectorAll(
|
|
3859
|
+
return this.container ? Array.from(this.container.querySelectorAll(oa)) : [];
|
|
3803
3860
|
}
|
|
3804
3861
|
entryOf(e) {
|
|
3805
3862
|
if (!(e instanceof Element) || !this.container) return null;
|
|
@@ -3814,9 +3871,9 @@ var ta = class {
|
|
|
3814
3871
|
}
|
|
3815
3872
|
onKeydown(e) {
|
|
3816
3873
|
let t = this.entryOf(e.target);
|
|
3817
|
-
if (!t || e.altKey || e.ctrlKey || e.metaKey || !
|
|
3874
|
+
if (!t || e.altKey || e.ctrlKey || e.metaKey || !wt(e, t)) return;
|
|
3818
3875
|
let n = this.entries(), r = n.indexOf(t), i;
|
|
3819
|
-
|
|
3876
|
+
sa.has(e.key) ? i = n[(r - 1 + n.length) % n.length] : ca.has(e.key) ? i = n[(r + 1) % n.length] : e.key === "Home" ? i = n[0] : e.key === "End" && (i = n[n.length - 1]), i ? (e.preventDefault(), e.stopPropagation(), i.focus()) : la.has(e.key) && (e.preventDefault(), e.stopPropagation(), this.activate(t));
|
|
3820
3877
|
}
|
|
3821
3878
|
activate(e) {
|
|
3822
3879
|
let t = e.getAttribute("data-action");
|
|
@@ -3828,7 +3885,7 @@ var ta = class {
|
|
|
3828
3885
|
});
|
|
3829
3886
|
this.palette.triggerEntry(t, "click", r);
|
|
3830
3887
|
}
|
|
3831
|
-
},
|
|
3888
|
+
}, da = ".djs-palette-entries .group[data-group=\"tools\"] .entry[data-action]", fa = "-tool", pa = class {
|
|
3832
3889
|
static $inject = ["eventBus", "injector"];
|
|
3833
3890
|
container;
|
|
3834
3891
|
armedTool = null;
|
|
@@ -3841,14 +3898,14 @@ var ta = class {
|
|
|
3841
3898
|
}
|
|
3842
3899
|
apply() {
|
|
3843
3900
|
let e = this.container;
|
|
3844
|
-
if (e && e.getAttribute("data-chrome") !== "palette") for (let t of e.querySelectorAll(
|
|
3901
|
+
if (e && e.getAttribute("data-chrome") !== "palette") for (let t of e.querySelectorAll(da)) {
|
|
3845
3902
|
let e = t.getAttribute("data-action");
|
|
3846
|
-
if (!e.endsWith(
|
|
3903
|
+
if (!e.endsWith(fa)) continue;
|
|
3847
3904
|
let n = e.slice(0, -5);
|
|
3848
3905
|
t.setAttribute("aria-pressed", String(n === this.armedTool));
|
|
3849
3906
|
}
|
|
3850
3907
|
}
|
|
3851
|
-
},
|
|
3908
|
+
}, ma = ".djs-palette-entries .entry", ha = /* @__PURE__ */ new Set(["Enter", " "]), ga = 300, _a = 8, va = 12, ya = 8, ba = 0, xa = class {
|
|
3852
3909
|
palette;
|
|
3853
3910
|
canvas;
|
|
3854
3911
|
static $inject = [
|
|
@@ -3858,7 +3915,7 @@ var ta = class {
|
|
|
3858
3915
|
];
|
|
3859
3916
|
entries = {};
|
|
3860
3917
|
paletteContainer;
|
|
3861
|
-
id = `wardley-palette-tooltip-${++
|
|
3918
|
+
id = `wardley-palette-tooltip-${++ba}`;
|
|
3862
3919
|
shown;
|
|
3863
3920
|
pending;
|
|
3864
3921
|
hovered;
|
|
@@ -3882,7 +3939,7 @@ var ta = class {
|
|
|
3882
3939
|
}
|
|
3883
3940
|
entryOf(e) {
|
|
3884
3941
|
if (!(e instanceof Element)) return;
|
|
3885
|
-
let t = e.closest(
|
|
3942
|
+
let t = e.closest(ma);
|
|
3886
3943
|
return t && this.paletteContainer?.contains(t) ? t : void 0;
|
|
3887
3944
|
}
|
|
3888
3945
|
onPointerOver = (e) => {
|
|
@@ -3909,19 +3966,19 @@ var ta = class {
|
|
|
3909
3966
|
};
|
|
3910
3967
|
onPaletteScroll = () => {
|
|
3911
3968
|
let e = this.shown, t = this.paletteContainer;
|
|
3912
|
-
e && t && (
|
|
3969
|
+
e && t && (wa(e.entry, t) ? this.hide() : this.place(e.element, e.entry));
|
|
3913
3970
|
};
|
|
3914
3971
|
pressesEntry(e) {
|
|
3915
|
-
return
|
|
3972
|
+
return ha.has(e.key) && !e.altKey && !e.ctrlKey && !e.metaKey && this.entryOf(e.target) !== void 0;
|
|
3916
3973
|
}
|
|
3917
3974
|
enter(e, t) {
|
|
3918
3975
|
t.pointerType !== "touch" && this.pressed !== e && (this.shown || Date.now() < this.warmUntil ? this.show(e) : (this.cancelPending(), this.pending = {
|
|
3919
3976
|
entry: e,
|
|
3920
|
-
timer: setTimeout(() => this.show(e),
|
|
3977
|
+
timer: setTimeout(() => this.show(e), ga)
|
|
3921
3978
|
}));
|
|
3922
3979
|
}
|
|
3923
3980
|
leave(e) {
|
|
3924
|
-
this.pressed === e && (this.pressed = void 0), this.pending?.entry === e && this.cancelPending(), this.shown?.entry === e && (this.hide(), this.warmUntil = Date.now() +
|
|
3981
|
+
this.pressed === e && (this.pressed = void 0), this.pending?.entry === e && this.cancelPending(), this.shown?.entry === e && (this.hide(), this.warmUntil = Date.now() + ga);
|
|
3925
3982
|
}
|
|
3926
3983
|
cancelPending() {
|
|
3927
3984
|
this.pending && clearTimeout(this.pending.timer), this.pending = void 0;
|
|
@@ -3934,17 +3991,17 @@ var ta = class {
|
|
|
3934
3991
|
return;
|
|
3935
3992
|
}
|
|
3936
3993
|
this.hide();
|
|
3937
|
-
let n =
|
|
3994
|
+
let n = Sa(e.ownerDocument, this.id, Ca(e), t.title, t.shortcut);
|
|
3938
3995
|
this.canvas.getContainer().append(n);
|
|
3939
3996
|
let r = e.getAttribute("aria-describedby");
|
|
3940
3997
|
this.shown = {
|
|
3941
3998
|
entry: e,
|
|
3942
3999
|
element: n,
|
|
3943
4000
|
describedBy: r
|
|
3944
|
-
},
|
|
4001
|
+
}, Ea(e, t.title, t.shortcut) && e.setAttribute("aria-describedby", [r, this.id].filter(Boolean).join(" ")), this.place(n, e);
|
|
3945
4002
|
}
|
|
3946
4003
|
place(e, t) {
|
|
3947
|
-
|
|
4004
|
+
Ca(t) ? Ta(e, t) : this.placeBelowPalette(e, t);
|
|
3948
4005
|
}
|
|
3949
4006
|
hide() {
|
|
3950
4007
|
if (this.cancelPending(), !this.shown) return;
|
|
@@ -3952,11 +4009,11 @@ var ta = class {
|
|
|
3952
4009
|
this.shown = void 0, t.remove(), n === null ? e.removeAttribute("aria-describedby") : e.setAttribute("aria-describedby", n);
|
|
3953
4010
|
}
|
|
3954
4011
|
placeBelowPalette(e, t) {
|
|
3955
|
-
let n = this.canvas.getContainer().getBoundingClientRect(), r = t.getBoundingClientRect(), i = (t.closest(".djs-palette") ?? t).getBoundingClientRect(), a = e.getBoundingClientRect().width / 2, o = r.left + r.width / 2 - n.left, s = Math.max(
|
|
3956
|
-
e.style.left = `${s}px`, e.style.top = `${i.bottom +
|
|
4012
|
+
let n = this.canvas.getContainer().getBoundingClientRect(), r = t.getBoundingClientRect(), i = (t.closest(".djs-palette") ?? t).getBoundingClientRect(), a = e.getBoundingClientRect().width / 2, o = r.left + r.width / 2 - n.left, s = Math.max(va + a, Math.min(o, n.width - va - a));
|
|
4013
|
+
e.style.left = `${s}px`, e.style.top = `${i.bottom + _a - n.top}px`;
|
|
3957
4014
|
}
|
|
3958
4015
|
};
|
|
3959
|
-
function
|
|
4016
|
+
function Sa(e, t, n, r, i) {
|
|
3960
4017
|
let a = e.createElement("div");
|
|
3961
4018
|
a.id = t, a.setAttribute("role", "tooltip"), a.className = `djs-hover-tooltip djs-hover-tooltip--${n ? "right" : "bottom"}`;
|
|
3962
4019
|
let o = e.createElement("span");
|
|
@@ -3966,22 +4023,22 @@ function va(e, t, n, r, i) {
|
|
|
3966
4023
|
}
|
|
3967
4024
|
return a;
|
|
3968
4025
|
}
|
|
3969
|
-
function
|
|
4026
|
+
function Ca(e) {
|
|
3970
4027
|
return e.closest(".djs-palette")?.getAttribute("data-chrome") === "palette";
|
|
3971
4028
|
}
|
|
3972
|
-
function
|
|
4029
|
+
function wa(e, t) {
|
|
3973
4030
|
let n = t.getBoundingClientRect().left + t.clientLeft, r = e.getBoundingClientRect();
|
|
3974
4031
|
return r.right <= n || r.left >= n + t.clientWidth;
|
|
3975
4032
|
}
|
|
3976
|
-
function
|
|
4033
|
+
function Ta(e, t) {
|
|
3977
4034
|
let n = t.getBoundingClientRect();
|
|
3978
|
-
e.style.left = `${n.right +
|
|
4035
|
+
e.style.left = `${n.right + ya}px`, e.style.top = `${n.top + n.height / 2}px`;
|
|
3979
4036
|
}
|
|
3980
|
-
function
|
|
4037
|
+
function Ea(e, t, n) {
|
|
3981
4038
|
return !(e.getAttribute("aria-label") ?? e.textContent ?? "").includes(t) || !!n && !e.hasAttribute("aria-keyshortcuts");
|
|
3982
4039
|
}
|
|
3983
4040
|
// src/palette/WardleyPaletteReadOnly.ts
|
|
3984
|
-
var
|
|
4041
|
+
var Da = ".djs-palette-entries .entry[data-action]", Oa = /* @__PURE__ */ new Set(["lasso-tool"]), ka = 2e3, Aa = class {
|
|
3985
4042
|
injector;
|
|
3986
4043
|
static $inject = ["eventBus", "injector"];
|
|
3987
4044
|
container;
|
|
@@ -3989,10 +4046,10 @@ var Ca = ".djs-palette-entries .entry[data-action]", wa = /* @__PURE__ */ new Se
|
|
|
3989
4046
|
constructor(e, t) {
|
|
3990
4047
|
this.injector = t, !t.get("modelerShell", !1) && (e.on("palette.create", (e) => {
|
|
3991
4048
|
this.container = e.container;
|
|
3992
|
-
}), e.on(["palette.changed",
|
|
4049
|
+
}), e.on(["palette.changed", gt], () => this.apply()), e.on("palette.trigger", ka, (e) => this.vetoes(e) ? this.refuse(e) : void 0));
|
|
3993
4050
|
}
|
|
3994
4051
|
isDisabled(e) {
|
|
3995
|
-
return this.ownsPalette() &&
|
|
4052
|
+
return this.ownsPalette() && R(this.injector) && ja(e);
|
|
3996
4053
|
}
|
|
3997
4054
|
ownsPalette() {
|
|
3998
4055
|
let e = this.container;
|
|
@@ -4001,15 +4058,15 @@ var Ca = ".djs-palette-entries .entry[data-action]", wa = /* @__PURE__ */ new Se
|
|
|
4001
4058
|
apply() {
|
|
4002
4059
|
let e = this.container;
|
|
4003
4060
|
if (!e || !this.ownsPalette()) return;
|
|
4004
|
-
let t =
|
|
4005
|
-
for (let n of e.querySelectorAll(
|
|
4061
|
+
let t = St(this.injector);
|
|
4062
|
+
for (let n of e.querySelectorAll(Da)) if (t && ja(n)) this.ownMarks.has(n) || this.ownMarks.set(n, n.getAttribute("aria-disabled")), n.setAttribute("aria-disabled", "true");
|
|
4006
4063
|
else if (this.ownMarks.has(n)) {
|
|
4007
4064
|
let e = this.ownMarks.get(n);
|
|
4008
4065
|
this.ownMarks.delete(n), e == null ? n.removeAttribute("aria-disabled") : n.setAttribute("aria-disabled", e);
|
|
4009
4066
|
}
|
|
4010
4067
|
}
|
|
4011
4068
|
vetoes({ entry: e, event: t }) {
|
|
4012
|
-
if (!this.ownsPalette() || !
|
|
4069
|
+
if (!this.ownsPalette() || !R(this.injector)) return !1;
|
|
4013
4070
|
let n = t?.delegateTarget ?? t?.target, r = n instanceof Element ? n.closest(".entry[data-action]") : null;
|
|
4014
4071
|
return r && this.container.contains(r) ? this.isDisabled(r) : e?.group !== "tools";
|
|
4015
4072
|
}
|
|
@@ -4017,11 +4074,11 @@ var Ca = ".djs-palette-entries .entry[data-action]", wa = /* @__PURE__ */ new Se
|
|
|
4017
4074
|
return e?.preventDefault(), !1;
|
|
4018
4075
|
}
|
|
4019
4076
|
};
|
|
4020
|
-
function
|
|
4021
|
-
return !
|
|
4077
|
+
function ja(e) {
|
|
4078
|
+
return !Oa.has(e.getAttribute("data-action") ?? "");
|
|
4022
4079
|
}
|
|
4023
4080
|
// src/palette/WardleyHoverTooltipTeardown.ts
|
|
4024
|
-
var
|
|
4081
|
+
var Ma = 1500, Na = {
|
|
4025
4082
|
__depends__: [we, {
|
|
4026
4083
|
__depends__: [Ae],
|
|
4027
4084
|
__init__: ["wardleyHoverTooltipTeardown"],
|
|
@@ -4030,7 +4087,7 @@ var Oa = 1500, ka = {
|
|
|
4030
4087
|
constructor(e, t) {
|
|
4031
4088
|
if (!t) return;
|
|
4032
4089
|
let n = t;
|
|
4033
|
-
e.on("diagram.destroy",
|
|
4090
|
+
e.on("diagram.destroy", Ma, () => {
|
|
4034
4091
|
clearTimeout(n._showTimer ?? void 0), n._showTimer = null, n._current = null;
|
|
4035
4092
|
});
|
|
4036
4093
|
}
|
|
@@ -4043,34 +4100,34 @@ var Oa = 1500, ka = {
|
|
|
4043
4100
|
"wardleyPaletteReadOnly",
|
|
4044
4101
|
"paletteTooltip"
|
|
4045
4102
|
],
|
|
4046
|
-
wardleyPaletteProvider: ["type",
|
|
4047
|
-
wardleyPaletteKeyboard: ["type",
|
|
4048
|
-
wardleyPaletteArmedTool: ["type",
|
|
4049
|
-
wardleyPaletteReadOnly: ["type",
|
|
4050
|
-
paletteTooltip: ["type",
|
|
4051
|
-
},
|
|
4103
|
+
wardleyPaletteProvider: ["type", aa],
|
|
4104
|
+
wardleyPaletteKeyboard: ["type", ua],
|
|
4105
|
+
wardleyPaletteArmedTool: ["type", pa],
|
|
4106
|
+
wardleyPaletteReadOnly: ["type", Aa],
|
|
4107
|
+
paletteTooltip: ["type", xa]
|
|
4108
|
+
}, Pa = 8, Fa = 134, Ia = class extends je {
|
|
4052
4109
|
_getTargetBounds(e) {
|
|
4053
4110
|
let t = Array.isArray(e) ? e : [e], n = t.flatMap((e) => this.visualRects(e, "node"));
|
|
4054
4111
|
if (!n.length) return je.prototype._getTargetBounds.call(this, e);
|
|
4055
|
-
let r =
|
|
4056
|
-
return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ?
|
|
4112
|
+
let r = La(n), i = r.right + this.padWidth() + Pa * this.internals()._canvas.zoom(), a = t.flatMap((e) => this.visualRects(e, "movement"));
|
|
4113
|
+
return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ? La([...n, ...a]) : r;
|
|
4057
4114
|
}
|
|
4058
4115
|
internals() {
|
|
4059
4116
|
return this;
|
|
4060
4117
|
}
|
|
4061
4118
|
padWidth() {
|
|
4062
|
-
return this.internals()._current?.html?.getBoundingClientRect().width ||
|
|
4119
|
+
return this.internals()._current?.html?.getBoundingClientRect().width || Fa;
|
|
4063
4120
|
}
|
|
4064
4121
|
movementTargetRects(e) {
|
|
4065
|
-
let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${
|
|
4122
|
+
let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${ni} > :is(.wardley-evolve-handle, text)`);
|
|
4066
4123
|
return Array.from(t ?? []).map((e) => e.getBoundingClientRect());
|
|
4067
4124
|
}
|
|
4068
4125
|
visualRects(e, t) {
|
|
4069
4126
|
let n = this.internals()._canvas.getGraphics(e);
|
|
4070
|
-
return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(
|
|
4127
|
+
return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(ni) === (t === "movement")) : t === "node" ? [e] : []).map((e) => e.getBoundingClientRect()).filter((e) => e.width > 0 || e.height > 0) : [];
|
|
4071
4128
|
}
|
|
4072
4129
|
};
|
|
4073
|
-
function
|
|
4130
|
+
function La(e) {
|
|
4074
4131
|
let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.right)), i = Math.max(...e.map((e) => e.bottom));
|
|
4075
4132
|
return {
|
|
4076
4133
|
left: t,
|
|
@@ -4084,7 +4141,7 @@ function Na(e) {
|
|
|
4084
4141
|
};
|
|
4085
4142
|
}
|
|
4086
4143
|
// src/label-editing/fieldError.ts
|
|
4087
|
-
function
|
|
4144
|
+
function Ra(e, t, n, r) {
|
|
4088
4145
|
let i;
|
|
4089
4146
|
return {
|
|
4090
4147
|
get caption() {
|
|
@@ -4099,30 +4156,30 @@ function Pa(e, t, n, r) {
|
|
|
4099
4156
|
};
|
|
4100
4157
|
}
|
|
4101
4158
|
// src/label-editing/imeComposition.ts
|
|
4102
|
-
function
|
|
4159
|
+
function za(e) {
|
|
4103
4160
|
return e.isComposing || e.keyCode === 229;
|
|
4104
4161
|
}
|
|
4105
4162
|
// src/label-editing/WardleyLabelEditing.ts
|
|
4106
|
-
function
|
|
4163
|
+
function Ba(e, t) {
|
|
4107
4164
|
if (e.focus(), t.selection) {
|
|
4108
4165
|
let n = e.value.length;
|
|
4109
4166
|
e.setSelectionRange(Math.min(t.selection.start, n), Math.min(t.selection.end, n));
|
|
4110
4167
|
} else e.select();
|
|
4111
4168
|
}
|
|
4112
|
-
var
|
|
4113
|
-
function
|
|
4169
|
+
var Va = "wardley-name-label", Ha = "wardley-label-editing", Ua = /* @__PURE__ */ new Set(["attitude", "drawing"]), Wa = 500, Ga = 6, Ka = 2, qa = 1.5, Ja = 1.25, Ya = 11, Xa = 4, Za = "Cmd/Ctrl+Enter to save · Esc to cancel";
|
|
4170
|
+
function Qa(e) {
|
|
4114
4171
|
return `“${e}” already exists. Names must be unique because links refer to them.`;
|
|
4115
4172
|
}
|
|
4116
|
-
var
|
|
4117
|
-
function
|
|
4173
|
+
var $a = "∖";
|
|
4174
|
+
function eo(e, t) {
|
|
4118
4175
|
let n = e.replace(/\r\n?/g, "\n").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
4119
|
-
return t ? n.replace(/\\(?=n)/g,
|
|
4176
|
+
return t ? n.replace(/\\(?=n)/g, $a) : n;
|
|
4120
4177
|
}
|
|
4121
|
-
var
|
|
4122
|
-
function
|
|
4123
|
-
return
|
|
4178
|
+
var to;
|
|
4179
|
+
function no(e, t, n) {
|
|
4180
|
+
return to === void 0 && (to = document.createElement("canvas").getContext("2d")), to ? (to.font = t, to.measureText(e).width) : e.length * n * .6;
|
|
4124
4181
|
}
|
|
4125
|
-
var
|
|
4182
|
+
var ro = class {
|
|
4126
4183
|
eventBus;
|
|
4127
4184
|
canvas;
|
|
4128
4185
|
elementRegistry;
|
|
@@ -4142,19 +4199,19 @@ var $a = class {
|
|
|
4142
4199
|
selection;
|
|
4143
4200
|
locked;
|
|
4144
4201
|
constructor(e, t, n, r, i, a) {
|
|
4145
|
-
this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.factory = i,
|
|
4202
|
+
this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.factory = i, Mt(), this.contextPad = a.get("contextPad", !1) ?? null, this.selection = a.get("selection", !1) ?? null, this.locked = () => R(a), e.on("element.dblclick", (e) => {
|
|
4146
4203
|
N(e.element) ? this.activate(e.element) : P(e.element) && this.activateConnection(e.element);
|
|
4147
|
-
}), e.on(["element.mousedown", "drag.init"], () => this.active?.commit("outside")), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on(["shape.changed", "connection.changed"],
|
|
4204
|
+
}), e.on(["element.mousedown", "drag.init"], () => this.active?.commit("outside")), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on(["shape.changed", "connection.changed"], Wa, (e) => {
|
|
4148
4205
|
this.active && e.element?.id === this.active.elementId && this.active.relayout();
|
|
4149
4206
|
}), e.on(["shape.remove", "connection.remove"], (e) => {
|
|
4150
4207
|
this.active && e.element?.id === this.active.elementId && this.cancel();
|
|
4151
4208
|
}), e.on("diagram.destroy", () => this.cancel());
|
|
4152
4209
|
}
|
|
4153
4210
|
activate(e, t = {}) {
|
|
4154
|
-
if (!N(e) ||
|
|
4211
|
+
if (!N(e) || Ua.has(e.wardleyType) || this.locked() || this.elementRegistry.get(e.id) !== e) return;
|
|
4155
4212
|
this.active?.commit("outside");
|
|
4156
|
-
let n = this.canvas.getContainer(), r = e.wardleyType === "note", i =
|
|
4157
|
-
let { left: e, top: t, width: n, height: i } =
|
|
4213
|
+
let n = this.canvas.getContainer(), r = e.wardleyType === "note", i = Nt(), a = this.factory.isLinkable(e.wardleyType), o = this.nameLabelElements(e), s = [...o.classedByFallback], c = this.labelGeometry(e, o.labelElements), l = () => r ? "centered" : G(e, this.elementRegistry), u = l(), d = (e) => Math.max(e * Ja, r ? 17 * this.canvas.zoom() : 0), f = d(c.fontSize), p = io(r, t.value ?? e.wardleyLabel ?? "", c, f), m = r ? oo("wardley-label-hint", Za) : void 0, h = () => {
|
|
4214
|
+
let { left: e, top: t, width: n, height: i } = ao(p.value, c, f, r, u);
|
|
4158
4215
|
Object.assign(p.style, {
|
|
4159
4216
|
left: `${e}px`,
|
|
4160
4217
|
top: `${t}px`,
|
|
@@ -4162,20 +4219,20 @@ var $a = class {
|
|
|
4162
4219
|
height: `${i}px`
|
|
4163
4220
|
}), p.scrollTop = 0;
|
|
4164
4221
|
let a = t + i + 8;
|
|
4165
|
-
for (let t of [g.caption, m]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight +
|
|
4166
|
-
}, g =
|
|
4167
|
-
g.show(
|
|
4222
|
+
for (let t of [g.caption, m]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight + Xa);
|
|
4223
|
+
}, g = Ra(n, p, `wardley-label-error-${e.id}`, () => h()), _ = (e) => {
|
|
4224
|
+
g.show(Qa(e)), p.select();
|
|
4168
4225
|
}, v = () => g.clear();
|
|
4169
|
-
this.contextPad?.close(), this.canvas.addMarker(e,
|
|
4226
|
+
this.contextPad?.close(), this.canvas.addMarker(e, Ha), n.appendChild(p), m && n.appendChild(m), h(), Ba(p, t);
|
|
4170
4227
|
let y = !1, b = () => {
|
|
4171
4228
|
if (!y) {
|
|
4172
|
-
y = !0, p.removeEventListener("keydown", x), p.removeEventListener("blur", S), p.removeEventListener("input", te), p.remove(), m?.remove(), g.clear(), this.canvas.removeMarker(e,
|
|
4173
|
-
for (let e of s) e.classList.remove(
|
|
4229
|
+
y = !0, p.removeEventListener("keydown", x), p.removeEventListener("blur", S), p.removeEventListener("input", te), p.remove(), m?.remove(), g.clear(), this.canvas.removeMarker(e, Ha);
|
|
4230
|
+
for (let e of s) e.classList.remove(Va), e.classList.length || e.removeAttribute("class");
|
|
4174
4231
|
this.active = null;
|
|
4175
4232
|
}
|
|
4176
4233
|
}, ee = (t) => {
|
|
4177
4234
|
if (y) return;
|
|
4178
|
-
let n =
|
|
4235
|
+
let n = eo(p.value, a);
|
|
4179
4236
|
if (!n || n === e.wardleyLabel) {
|
|
4180
4237
|
b();
|
|
4181
4238
|
return;
|
|
@@ -4187,7 +4244,7 @@ var $a = class {
|
|
|
4187
4244
|
applied: r
|
|
4188
4245
|
}));
|
|
4189
4246
|
}, x = (t) => {
|
|
4190
|
-
if (!(
|
|
4247
|
+
if (!(za(t) || z(t))) {
|
|
4191
4248
|
if (t.key === "Escape") t.preventDefault(), b(), this.returnToCanvas(e, i);
|
|
4192
4249
|
else if (t.key === "Enter") {
|
|
4193
4250
|
if (r ? !(t.metaKey || t.ctrlKey) : t.shiftKey) return;
|
|
@@ -4219,7 +4276,7 @@ var $a = class {
|
|
|
4219
4276
|
this.active?.commit("outside");
|
|
4220
4277
|
let n = this.canvas.getContainer();
|
|
4221
4278
|
if (e.waypoints.length < 1) return;
|
|
4222
|
-
let r = e.wardleyType === "flow", i =
|
|
4279
|
+
let r = e.wardleyType === "flow", i = Nt(), a = document.createElement("input");
|
|
4223
4280
|
a.type = "text", a.className = "wardley-label-input", a.placeholder = r ? "flow value (e.g. $0.10)" : "link annotation", a.value = t.value ?? (r ? e.flowValue : e.linkLabel) ?? "", a.style.position = "absolute";
|
|
4224
4281
|
let o = () => {
|
|
4225
4282
|
let t = e.waypoints[0], n = e.waypoints[e.waypoints.length - 1];
|
|
@@ -4227,7 +4284,7 @@ var $a = class {
|
|
|
4227
4284
|
let r = this.canvas.zoom(), i = this.canvas.viewbox();
|
|
4228
4285
|
a.style.left = `${((t.x + n.x) / 2 - 60 - i.x) * r}px`, a.style.top = `${((t.y + n.y) / 2 - 26 - i.y) * r}px`;
|
|
4229
4286
|
};
|
|
4230
|
-
o(), n.appendChild(a),
|
|
4287
|
+
o(), n.appendChild(a), Ba(a, t);
|
|
4231
4288
|
let s = !1, c = () => {
|
|
4232
4289
|
s || (s = !0, a.removeEventListener("keydown", u), a.removeEventListener("blur", d), a.remove(), this.active = null);
|
|
4233
4290
|
}, l = () => {
|
|
@@ -4246,7 +4303,7 @@ var $a = class {
|
|
|
4246
4303
|
...o ? { businessObject: o } : {}
|
|
4247
4304
|
});
|
|
4248
4305
|
}, u = (t) => {
|
|
4249
|
-
|
|
4306
|
+
za(t) || z(t) || (t.key === "Escape" ? (t.preventDefault(), c(), this.returnToCanvas(e, i)) : t.key === "Enter" && (t.preventDefault(), l(), this.returnToCanvas(e, i)));
|
|
4250
4307
|
}, d = () => l();
|
|
4251
4308
|
a.addEventListener("keydown", u), a.addEventListener("blur", d);
|
|
4252
4309
|
let f = () => {
|
|
@@ -4286,7 +4343,7 @@ var $a = class {
|
|
|
4286
4343
|
};
|
|
4287
4344
|
}
|
|
4288
4345
|
returnToCanvas(e, t) {
|
|
4289
|
-
t ?
|
|
4346
|
+
t ? B(this.canvas) : this.canvas.focus();
|
|
4290
4347
|
let n = this.selection?.get() ?? [];
|
|
4291
4348
|
n.length === 1 && n[0] === e && this.contextPad?.open(e);
|
|
4292
4349
|
}
|
|
@@ -4296,20 +4353,20 @@ var $a = class {
|
|
|
4296
4353
|
labelElements: [],
|
|
4297
4354
|
classedByFallback: []
|
|
4298
4355
|
};
|
|
4299
|
-
let n = [...t.querySelectorAll(`.${
|
|
4356
|
+
let n = [...t.querySelectorAll(`.${Va}`)];
|
|
4300
4357
|
if (n.length) return {
|
|
4301
4358
|
labelElements: n,
|
|
4302
4359
|
classedByFallback: []
|
|
4303
4360
|
};
|
|
4304
4361
|
let r = [...t.querySelectorAll("text")].filter((e) => !e.closest(".wardley-movement")), i = (e.wardleyLabel ?? "").split("\n").join(""), a = e.wardleyType === "note" ? r : r.filter((e) => e.textContent === i).slice(-1);
|
|
4305
|
-
for (let e of a) e.classList.add(
|
|
4362
|
+
for (let e of a) e.classList.add(Va);
|
|
4306
4363
|
return {
|
|
4307
4364
|
labelElements: a,
|
|
4308
4365
|
classedByFallback: a
|
|
4309
4366
|
};
|
|
4310
4367
|
}
|
|
4311
4368
|
labelGeometry(e, t) {
|
|
4312
|
-
let n = this.canvas.zoom(), r = this.canvas.viewbox(), i = this.canvas.getContainer().getBoundingClientRect(), a = t[0], o = a ? getComputedStyle(a) : void 0, s = Math.max(
|
|
4369
|
+
let n = this.canvas.zoom(), r = this.canvas.viewbox(), i = this.canvas.getContainer().getBoundingClientRect(), a = t[0], o = a ? getComputedStyle(a) : void 0, s = Math.max(Ya, (Number.parseFloat(o?.fontSize ?? "") || M.label) * n), c = {
|
|
4313
4370
|
fontSize: s,
|
|
4314
4371
|
fontWeight: o?.fontWeight || "normal",
|
|
4315
4372
|
fontStyle: o?.fontStyle || "normal",
|
|
@@ -4347,7 +4404,7 @@ var $a = class {
|
|
|
4347
4404
|
};
|
|
4348
4405
|
}
|
|
4349
4406
|
};
|
|
4350
|
-
function
|
|
4407
|
+
function io(e, t, n, r) {
|
|
4351
4408
|
let i = document.createElement("textarea");
|
|
4352
4409
|
return i.className = "wardley-label-input wardley-label-input--name wardley-label-textarea", i.value = t, i.rows = 1, i.setAttribute("aria-label", e ? "Note text" : "Name"), i.spellcheck = !1, i.wrap = "off", Object.assign(i.style, {
|
|
4353
4410
|
position: "absolute",
|
|
@@ -4356,12 +4413,12 @@ function eo(e, t, n, r) {
|
|
|
4356
4413
|
fontWeight: n.fontWeight,
|
|
4357
4414
|
fontStyle: n.fontStyle,
|
|
4358
4415
|
lineHeight: `${r}px`,
|
|
4359
|
-
padding: `${
|
|
4416
|
+
padding: `${Ka}px ${Ga}px`,
|
|
4360
4417
|
textAlign: n.centered ? "center" : "left"
|
|
4361
4418
|
}), i;
|
|
4362
4419
|
}
|
|
4363
|
-
function
|
|
4364
|
-
let a = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, o = (e || " ").split("\n"), s = Math.max(...o.map((e) =>
|
|
4420
|
+
function ao(e, t, n, r, i) {
|
|
4421
|
+
let a = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, o = (e || " ").split("\n"), s = Math.max(...o.map((e) => no(e, a, t.fontSize))), c = Math.max(s + 17, t.fontSize * 2 + 17, r ? t.width : 0), l = Math.max(o.length * n + 7, r ? t.height : 0), u = t.centered ? t.left + t.width / 2 - c / 2 : t.left - Ga - qa, d = t.top + t.height / 2, f = t.lineCount * n + 7;
|
|
4365
4422
|
return {
|
|
4366
4423
|
left: u,
|
|
4367
4424
|
top: i === "up" ? d + f / 2 - l : i === "down" ? d - f / 2 : d - l / 2,
|
|
@@ -4369,42 +4426,45 @@ function to(e, t, n, r, i) {
|
|
|
4369
4426
|
height: l
|
|
4370
4427
|
};
|
|
4371
4428
|
}
|
|
4372
|
-
function
|
|
4429
|
+
function oo(e, t) {
|
|
4373
4430
|
let n = document.createElement("div");
|
|
4374
4431
|
return n.className = `wardley-label-caption ${e}`, n.textContent = t, n;
|
|
4375
4432
|
}
|
|
4376
4433
|
// src/label-editing/index.ts
|
|
4377
|
-
var
|
|
4434
|
+
var so = {
|
|
4378
4435
|
__init__: ["wardleyLabelEditing"],
|
|
4379
|
-
wardleyLabelEditing: ["type",
|
|
4380
|
-
},
|
|
4436
|
+
wardleyLabelEditing: ["type", ro]
|
|
4437
|
+
}, co = /* @__PURE__ */ new Set([
|
|
4381
4438
|
"http:",
|
|
4382
4439
|
"https:",
|
|
4383
4440
|
"mailto:"
|
|
4384
|
-
]),
|
|
4385
|
-
function
|
|
4386
|
-
return e.replace(
|
|
4441
|
+
]), lo = /^([a-z][a-z0-9+.-]*):/i, uo = /[\u0000-\u001f\u007f]/g;
|
|
4442
|
+
function fo(e) {
|
|
4443
|
+
return e.replace(uo, "").replace(/[[\]]/g, "").trim();
|
|
4444
|
+
}
|
|
4445
|
+
function po(e) {
|
|
4446
|
+
let t = lo.exec(e)?.[1];
|
|
4447
|
+
return t === void 0 || co.has(`${t.toLowerCase()}:`);
|
|
4387
4448
|
}
|
|
4388
|
-
function
|
|
4389
|
-
|
|
4390
|
-
return t === void 0 || io.has(`${t.toLowerCase()}:`);
|
|
4449
|
+
function mo(e) {
|
|
4450
|
+
return !lo.test(e);
|
|
4391
4451
|
}
|
|
4392
|
-
function
|
|
4452
|
+
function ho(e) {
|
|
4393
4453
|
if (e === void 0) return;
|
|
4394
|
-
let t =
|
|
4395
|
-
return t &&
|
|
4454
|
+
let t = fo(e);
|
|
4455
|
+
return t && po(t) ? t : void 0;
|
|
4396
4456
|
}
|
|
4397
4457
|
// src/link-editing/WardleyLinkEditing.ts
|
|
4398
|
-
var
|
|
4399
|
-
function
|
|
4458
|
+
var go = 72, _o = 500, vo = "Use an http(s) or mailto address, or a relative path such as ./other.wmap";
|
|
4459
|
+
function yo(e) {
|
|
4400
4460
|
return e.wardleyType === "component" || e.wardleyType === "submap";
|
|
4401
4461
|
}
|
|
4402
|
-
function
|
|
4462
|
+
function bo(e) {
|
|
4403
4463
|
let t = e.businessObject;
|
|
4404
4464
|
if (e.wardleyType === "submap") return t?.urlRef;
|
|
4405
4465
|
if (e.wardleyType === "component") return t?.url;
|
|
4406
4466
|
}
|
|
4407
|
-
var
|
|
4467
|
+
var xo = class {
|
|
4408
4468
|
canvas;
|
|
4409
4469
|
modeling;
|
|
4410
4470
|
injector;
|
|
@@ -4417,15 +4477,15 @@ var go = class {
|
|
|
4417
4477
|
active = null;
|
|
4418
4478
|
relayoutPending = !1;
|
|
4419
4479
|
constructor(e, t, n, r) {
|
|
4420
|
-
this.canvas = t, this.modeling = n, this.injector = r, e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on("shape.changed",
|
|
4480
|
+
this.canvas = t, this.modeling = n, this.injector = r, e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changing", () => this.relayoutAfterViewChange()), e.on("canvas.viewbox.changed", () => this.active?.relayout()), e.on("shape.changed", _o, (e) => {
|
|
4421
4481
|
this.active && e.element?.id === this.active.elementId && this.active.relayout();
|
|
4422
4482
|
}), e.on(["diagram.clear", "diagram.destroy"], () => this.cancel());
|
|
4423
4483
|
}
|
|
4424
4484
|
setLink(e, t) {
|
|
4425
|
-
if (!
|
|
4426
|
-
let n =
|
|
4427
|
-
if (n && !
|
|
4428
|
-
if ((
|
|
4485
|
+
if (!yo(e)) return !1;
|
|
4486
|
+
let n = fo(t ?? "");
|
|
4487
|
+
if (n && !po(n)) return !1;
|
|
4488
|
+
if ((bo(e) ?? "") === n) return !0;
|
|
4429
4489
|
let r = e.wardleyType === "submap" ? "urlRef" : "url";
|
|
4430
4490
|
e.businessObject ||= {
|
|
4431
4491
|
id: e.id,
|
|
@@ -4440,27 +4500,27 @@ var go = class {
|
|
|
4440
4500
|
return n ? i[r] = n : delete i[r], this.modeling.updateProperties(e, { businessObject: i }), !0;
|
|
4441
4501
|
}
|
|
4442
4502
|
activate(e, t = {}) {
|
|
4443
|
-
if (!
|
|
4503
|
+
if (!yo(e) || R(this.injector)) return;
|
|
4444
4504
|
this.active?.commit();
|
|
4445
4505
|
let n = this.canvas.getContainer(), r = document.createElement("input");
|
|
4446
|
-
r.type = "text", r.inputMode = "url", r.spellcheck = !1, r.autocomplete = "off", r.className = "wardley-label-input wardley-link-input", r.placeholder = "https://… or ./other.wmap", r.setAttribute("aria-label", `Link of ${e.wardleyLabel || e.wardleyType}`), r.value = t.value ??
|
|
4506
|
+
r.type = "text", r.inputMode = "url", r.spellcheck = !1, r.autocomplete = "off", r.className = "wardley-label-input wardley-link-input", r.placeholder = "https://… or ./other.wmap", r.setAttribute("aria-label", `Link of ${e.wardleyLabel || e.wardleyType}`), r.value = t.value ?? bo(e) ?? "", r.style.position = "absolute";
|
|
4447
4507
|
let i = () => {
|
|
4448
4508
|
let t = this.canvas.zoom(), n = this.canvas.viewbox();
|
|
4449
|
-
r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t +
|
|
4509
|
+
r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t + go}px`;
|
|
4450
4510
|
};
|
|
4451
|
-
i(), n.appendChild(r),
|
|
4511
|
+
i(), n.appendChild(r), Ba(r, t);
|
|
4452
4512
|
let a = !1, o = () => {
|
|
4453
4513
|
a || (a = !0, r.removeEventListener("keydown", p), r.removeEventListener("blur", m), r.removeEventListener("input", u), c.clear(), r.remove(), this.active = null);
|
|
4454
4514
|
}, s = (e) => {
|
|
4455
4515
|
e.style.left = r.style.left, e.style.top = `${r.offsetTop + r.offsetHeight + 8}px`;
|
|
4456
|
-
}, c =
|
|
4516
|
+
}, c = Ra(n, r, `wardley-link-error-${e.id}`, s), l = () => c.show(vo), u = () => c.clear(), d = () => {
|
|
4457
4517
|
if (a) return !0;
|
|
4458
|
-
let t =
|
|
4459
|
-
return t && !
|
|
4518
|
+
let t = fo(r.value);
|
|
4519
|
+
return t && !po(t) ? (l(), !1) : (o(), this.setLink(e, t), !0);
|
|
4460
4520
|
}, f = () => {
|
|
4461
4521
|
d() || o();
|
|
4462
4522
|
}, p = (e) => {
|
|
4463
|
-
|
|
4523
|
+
za(e) || z(e) || (e.key === "Escape" ? (e.preventDefault(), o(), this.canvas.focus()) : e.key === "Enter" && (e.preventDefault(), d() && this.canvas.focus()));
|
|
4464
4524
|
}, m = () => f();
|
|
4465
4525
|
r.addEventListener("keydown", p), r.addEventListener("blur", m), r.addEventListener("input", u);
|
|
4466
4526
|
let h = () => {
|
|
@@ -4497,26 +4557,41 @@ var go = class {
|
|
|
4497
4557
|
}
|
|
4498
4558
|
};
|
|
4499
4559
|
}
|
|
4500
|
-
},
|
|
4560
|
+
}, So = {
|
|
4501
4561
|
__init__: ["wardleyLinkEditing"],
|
|
4502
|
-
wardleyLinkEditing: ["type",
|
|
4503
|
-
|
|
4562
|
+
wardleyLinkEditing: ["type", xo],
|
|
4563
|
+
wardleyLinkOpener: ["type", class {
|
|
4564
|
+
config;
|
|
4565
|
+
static $inject = ["config.wardleyLinks"];
|
|
4566
|
+
constructor(e) {
|
|
4567
|
+
this.config = e;
|
|
4568
|
+
}
|
|
4569
|
+
openableLink(e) {
|
|
4570
|
+
if (!yo(e)) return;
|
|
4571
|
+
let t = ho(bo(e));
|
|
4572
|
+
if (t !== void 0) return mo(t) && !this.config?.openRelative ? void 0 : t;
|
|
4573
|
+
}
|
|
4574
|
+
open(e) {
|
|
4575
|
+
mo(e) ? this.config?.openRelative?.(e) : this.config?.openExternal ? this.config.openExternal(e) : window.open(e, "_blank", "noopener,noreferrer");
|
|
4576
|
+
}
|
|
4577
|
+
}]
|
|
4578
|
+
}, Co = "wardley-element-settings", wo = {
|
|
4504
4579
|
id: "type",
|
|
4505
4580
|
name: "Type"
|
|
4506
|
-
},
|
|
4581
|
+
}, To = {
|
|
4507
4582
|
id: "method",
|
|
4508
4583
|
name: "Sourcing"
|
|
4509
|
-
},
|
|
4584
|
+
}, Eo = {
|
|
4510
4585
|
id: "props",
|
|
4511
4586
|
name: "Properties"
|
|
4512
4587
|
};
|
|
4513
|
-
function
|
|
4514
|
-
e.key !== "Escape" && !
|
|
4588
|
+
function Do(e) {
|
|
4589
|
+
e.key !== "Escape" && !z(e) && e.stopPropagation();
|
|
4515
4590
|
}
|
|
4516
4591
|
function X(e, t) {
|
|
4517
4592
|
return e ? `✓ ${t}` : t;
|
|
4518
4593
|
}
|
|
4519
|
-
var
|
|
4594
|
+
var Oo = class {
|
|
4520
4595
|
modeling;
|
|
4521
4596
|
static $inject = [
|
|
4522
4597
|
"popupMenu",
|
|
@@ -4524,9 +4599,9 @@ var Co = class {
|
|
|
4524
4599
|
"eventBus"
|
|
4525
4600
|
];
|
|
4526
4601
|
constructor(e, t, n) {
|
|
4527
|
-
this.modeling = t, e.registerProvider(
|
|
4602
|
+
this.modeling = t, e.registerProvider(Co, this), Et(e), n.on("popupMenu.open", () => {
|
|
4528
4603
|
let t = e._current?.container;
|
|
4529
|
-
t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown",
|
|
4604
|
+
t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown", Do);
|
|
4530
4605
|
});
|
|
4531
4606
|
}
|
|
4532
4607
|
getPopupMenuEntries(e) {
|
|
@@ -4538,84 +4613,62 @@ var Co = class {
|
|
|
4538
4613
|
return {
|
|
4539
4614
|
"type-normal": {
|
|
4540
4615
|
label: X(n === "normal", "Normal"),
|
|
4541
|
-
group:
|
|
4616
|
+
group: wo,
|
|
4542
4617
|
action: () => this.modeling.setMarketEcosystem(e, void 0)
|
|
4543
4618
|
},
|
|
4544
4619
|
"type-market": {
|
|
4545
4620
|
label: X(n === "market", "Market"),
|
|
4546
|
-
group:
|
|
4621
|
+
group: wo,
|
|
4547
4622
|
action: () => this.modeling.setMarketEcosystem(e, "market")
|
|
4548
4623
|
},
|
|
4549
4624
|
"type-ecosystem": {
|
|
4550
4625
|
label: X(n === "ecosystem", "Ecosystem"),
|
|
4551
|
-
group:
|
|
4626
|
+
group: wo,
|
|
4552
4627
|
action: () => this.modeling.setMarketEcosystem(e, "ecosystem")
|
|
4553
4628
|
},
|
|
4554
4629
|
"method-none": {
|
|
4555
4630
|
label: X(!r, "None"),
|
|
4556
|
-
group:
|
|
4631
|
+
group: To,
|
|
4557
4632
|
action: () => this.modeling.setMethod(e, void 0)
|
|
4558
4633
|
},
|
|
4559
4634
|
"method-build": {
|
|
4560
4635
|
label: X(r === "build", "Build"),
|
|
4561
|
-
group:
|
|
4636
|
+
group: To,
|
|
4562
4637
|
action: () => this.modeling.setMethod(e, "build")
|
|
4563
4638
|
},
|
|
4564
4639
|
"method-buy": {
|
|
4565
4640
|
label: X(r === "buy", "Buy"),
|
|
4566
|
-
group:
|
|
4641
|
+
group: To,
|
|
4567
4642
|
action: () => this.modeling.setMethod(e, "buy")
|
|
4568
4643
|
},
|
|
4569
4644
|
"method-outsource": {
|
|
4570
4645
|
label: X(r === "outsource", "Outsource"),
|
|
4571
|
-
group:
|
|
4646
|
+
group: To,
|
|
4572
4647
|
action: () => this.modeling.setMethod(e, "outsource")
|
|
4573
4648
|
},
|
|
4574
4649
|
"prop-inertia": {
|
|
4575
4650
|
label: X(!!t.inertia, "Inertia"),
|
|
4576
|
-
group:
|
|
4651
|
+
group: Eo,
|
|
4577
4652
|
action: () => this.modeling.toggleInertia(e)
|
|
4578
4653
|
}
|
|
4579
4654
|
};
|
|
4580
4655
|
}
|
|
4581
|
-
},
|
|
4656
|
+
}, ko = {
|
|
4582
4657
|
__init__: ["wardleyElementSettings"],
|
|
4583
|
-
wardleyElementSettings: ["type",
|
|
4584
|
-
},
|
|
4585
|
-
|
|
4586
|
-
trash: "<path d=\"M10 11v6\"/><path d=\"M14 11v6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M3 6h18\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/>",
|
|
4587
|
-
"circle-plus": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8 12h8\"/><path d=\"M12 8v8\"/>",
|
|
4588
|
-
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
4589
|
-
"chevrons-right": "<path d=\"m6 17 5-5-5-5\"/><path d=\"m13 17 5-5-5-5\"/>",
|
|
4590
|
-
"chevrons-right-x": "<path d=\"m4 16 5-5-5-5\"/><path d=\"m11 16 5-5-5-5\"/><path d=\"m17 16 5 5\"/><path d=\"m17 21 5-5\"/>",
|
|
4591
|
-
"sliders-horizontal": "<path d=\"M10 5H3\"/><path d=\"M12 19H3\"/><path d=\"M14 3v4\"/><path d=\"M16 17v4\"/><path d=\"M21 12h-9\"/><path d=\"M21 19h-5\"/><path d=\"M21 5h-7\"/><path d=\"M8 10v4\"/><path d=\"M8 12H3\"/>",
|
|
4592
|
-
"line-style": "<path d=\"M11 5h2\"/><path d=\"M15 12h6\"/><path d=\"M19 5h2\"/><path d=\"M3 12h6\"/><path d=\"M3 19h18\"/><path d=\"M3 5h2\"/>",
|
|
4593
|
-
palette: "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>",
|
|
4594
|
-
link: "<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>",
|
|
4595
|
-
"external-link": "<path d=\"M15 3h6v6\"/><path d=\"M10 14 21 3\"/><path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"/>"
|
|
4596
|
-
};
|
|
4597
|
-
/*! @miragon/wardley-renderer icon geometry: the context pad icons. Lucide (lucide-static 1.59.0)
|
|
4598
|
-
* @license ISC Copyright (c) 2026 Lucide Icons and Contributors
|
|
4599
|
-
* arrow-right, chevrons-right, circle-plus, external-link, link and trash derive from Feather
|
|
4600
|
-
* @license MIT, Copyright (c) 2013-present Cole Bemis
|
|
4601
|
-
* Full notices: README.md of @miragon/wardley-renderer */
|
|
4602
|
-
function Z(e) {
|
|
4603
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${To[e]}</svg>`;
|
|
4604
|
-
}
|
|
4605
|
-
// src/context-pad/WardleyContextPadProvider.ts
|
|
4606
|
-
var Eo = "edit", Do = "wardley", Oo = "danger", ko = 80, Ao = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), jo = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
|
|
4607
|
-
function Mo(e) {
|
|
4658
|
+
wardleyElementSettings: ["type", Oo]
|
|
4659
|
+
}, Ao = "edit", jo = "wardley", Mo = "danger", No = 80, Po = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Fo = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
|
|
4660
|
+
function Io(e) {
|
|
4608
4661
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
4609
4662
|
}
|
|
4610
|
-
function
|
|
4611
|
-
let r =
|
|
4663
|
+
function Z(e, t, n = !1) {
|
|
4664
|
+
let r = Io(t);
|
|
4612
4665
|
return `<div class="entry wardley-cp-entry" role="button" tabindex="0" aria-label="${r}"${n ? " draggable=\"true\"" : ""} title="${r}">${e}</div>`;
|
|
4613
4666
|
}
|
|
4614
4667
|
// src/context-pad/index.ts
|
|
4615
|
-
var
|
|
4668
|
+
var Lo = {
|
|
4616
4669
|
__depends__: [Ce],
|
|
4617
4670
|
__init__: ["wardleyContextPadProvider"],
|
|
4618
|
-
contextPad: ["type",
|
|
4671
|
+
contextPad: ["type", Ia],
|
|
4619
4672
|
wardleyContextPadProvider: ["type", class {
|
|
4620
4673
|
contextPad;
|
|
4621
4674
|
modeling;
|
|
@@ -4629,6 +4682,7 @@ var No = {
|
|
|
4629
4682
|
colorPicker;
|
|
4630
4683
|
canvas;
|
|
4631
4684
|
injector;
|
|
4685
|
+
linksConfig;
|
|
4632
4686
|
static $inject = [
|
|
4633
4687
|
"contextPad",
|
|
4634
4688
|
"modeling",
|
|
@@ -4642,23 +4696,24 @@ var No = {
|
|
|
4642
4696
|
"wardleyColorPicker",
|
|
4643
4697
|
"eventBus",
|
|
4644
4698
|
"canvas",
|
|
4645
|
-
"injector"
|
|
4699
|
+
"injector",
|
|
4700
|
+
"config.wardleyLinks"
|
|
4646
4701
|
];
|
|
4647
4702
|
keyboardEvents = /* @__PURE__ */ new WeakSet();
|
|
4648
|
-
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
4649
|
-
this.contextPad = e, 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, this.canvas = d, this.injector = f, e.registerProvider(this), u.on("contextPad.create", (e) => {
|
|
4703
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
4704
|
+
this.contextPad = e, 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, this.canvas = d, this.injector = f, this.linksConfig = p, e.registerProvider(this), u.on("contextPad.create", (e) => {
|
|
4650
4705
|
e.pad.setAttribute("role", "toolbar"), e.pad.setAttribute("aria-label", "Element actions"), e.pad.addEventListener("keydown", (t) => this.onPadKeydown(t, e.pad));
|
|
4651
4706
|
});
|
|
4652
4707
|
}
|
|
4653
4708
|
getContextPadEntries(e) {
|
|
4654
|
-
if (
|
|
4709
|
+
if (R(this.injector)) return {};
|
|
4655
4710
|
if (P(e)) return this.connectionEntries(e);
|
|
4656
4711
|
if (!N(e)) return {};
|
|
4657
4712
|
let t = e, n = {};
|
|
4658
4713
|
return this.addPrimaryEntries(t, n), this.addPropertyEntries(t, n), n.delete = {
|
|
4659
|
-
group:
|
|
4714
|
+
group: Mo,
|
|
4660
4715
|
title: "Delete",
|
|
4661
|
-
html:
|
|
4716
|
+
html: Z(W("trash"), "Delete"),
|
|
4662
4717
|
action: { click: this.focusingCanvas(() => this.modeling.removeElements([t])) }
|
|
4663
4718
|
}, n;
|
|
4664
4719
|
}
|
|
@@ -4666,24 +4721,24 @@ var No = {
|
|
|
4666
4721
|
let t = e.wardleyType === "flow" ? "Edit flow value" : "Edit link annotation";
|
|
4667
4722
|
return {
|
|
4668
4723
|
"edit-value": {
|
|
4669
|
-
group:
|
|
4724
|
+
group: Ao,
|
|
4670
4725
|
title: t,
|
|
4671
|
-
html:
|
|
4726
|
+
html: Z(W("pencil"), t),
|
|
4672
4727
|
action: { click: () => this.labelEditing.activateConnection(e) }
|
|
4673
4728
|
},
|
|
4674
4729
|
delete: {
|
|
4675
|
-
group:
|
|
4730
|
+
group: Mo,
|
|
4676
4731
|
title: "Delete connection",
|
|
4677
|
-
html:
|
|
4732
|
+
html: Z(W("trash"), "Delete connection"),
|
|
4678
4733
|
action: { click: this.focusingCanvas(() => this.modeling.removeElements([e])) }
|
|
4679
4734
|
}
|
|
4680
4735
|
};
|
|
4681
4736
|
}
|
|
4682
4737
|
addPrimaryEntries(e, t) {
|
|
4683
4738
|
if (e.wardleyType !== "drawing" && e.wardleyType !== "attitude" && (t["edit-label"] = {
|
|
4684
|
-
group:
|
|
4739
|
+
group: Ao,
|
|
4685
4740
|
title: "Edit label",
|
|
4686
|
-
html:
|
|
4741
|
+
html: Z(W("pencil"), "Edit label"),
|
|
4687
4742
|
action: { click: () => this.labelEditing.activate(e) }
|
|
4688
4743
|
}), e.wardleyType === "component" || e.wardleyType === "anchor" || e.wardleyType === "submap" || e.wardleyType === "pipeline") {
|
|
4689
4744
|
let n = this.focusingCanvas((t) => {
|
|
@@ -4695,9 +4750,9 @@ var No = {
|
|
|
4695
4750
|
this.create.start(t, n, { source: e });
|
|
4696
4751
|
});
|
|
4697
4752
|
t.append = {
|
|
4698
|
-
group:
|
|
4753
|
+
group: Ao,
|
|
4699
4754
|
title: "Append component (auto-connect)",
|
|
4700
|
-
html:
|
|
4755
|
+
html: Z(W("circle-plus"), "Append component", !0),
|
|
4701
4756
|
action: {
|
|
4702
4757
|
click: n,
|
|
4703
4758
|
dragstart: n
|
|
@@ -4707,9 +4762,9 @@ var No = {
|
|
|
4707
4762
|
this.connect.start(t, e);
|
|
4708
4763
|
});
|
|
4709
4764
|
t.connect = {
|
|
4710
|
-
group:
|
|
4765
|
+
group: Ao,
|
|
4711
4766
|
title: "Connect to existing element (A)",
|
|
4712
|
-
html:
|
|
4767
|
+
html: Z(W("arrow-right"), "Connect to existing element (A)", !0),
|
|
4713
4768
|
action: {
|
|
4714
4769
|
click: r,
|
|
4715
4770
|
dragstart: r
|
|
@@ -4718,17 +4773,17 @@ var No = {
|
|
|
4718
4773
|
}
|
|
4719
4774
|
if (e.wardleyType === "component") {
|
|
4720
4775
|
if (e.movement) t["evolve-clear"] = {
|
|
4721
|
-
group:
|
|
4776
|
+
group: Ao,
|
|
4722
4777
|
title: "Remove evolve",
|
|
4723
|
-
html:
|
|
4778
|
+
html: Z(W("chevrons-right-x"), "Remove evolve"),
|
|
4724
4779
|
action: { click: this.focusingCanvas(() => this.wardleyModeling.clearMovement(e)) }
|
|
4725
4780
|
};
|
|
4726
4781
|
else if (e.evolution < .999) {
|
|
4727
4782
|
let n = this.focusingCanvas((t) => this.evolveDragging.start(t, e));
|
|
4728
4783
|
t.evolve = {
|
|
4729
|
-
group:
|
|
4784
|
+
group: Ao,
|
|
4730
4785
|
title: "Evolve: drag to set the target maturity",
|
|
4731
|
-
html:
|
|
4786
|
+
html: Z(W("chevrons-right"), "Evolve: drag to set the target maturity", !0),
|
|
4732
4787
|
action: {
|
|
4733
4788
|
click: n,
|
|
4734
4789
|
dragstart: n
|
|
@@ -4739,12 +4794,12 @@ var No = {
|
|
|
4739
4794
|
}
|
|
4740
4795
|
addPropertyEntries(e, t) {
|
|
4741
4796
|
if (e.wardleyType === "component" && (t.settings = {
|
|
4742
|
-
group:
|
|
4797
|
+
group: jo,
|
|
4743
4798
|
title: "Settings (type, sourcing, inertia)",
|
|
4744
|
-
html:
|
|
4799
|
+
html: Z(W("sliders-horizontal"), "Settings (type, sourcing, inertia)"),
|
|
4745
4800
|
action: { click: (t) => {
|
|
4746
4801
|
let n = t;
|
|
4747
|
-
this.popupMenu.open(e,
|
|
4802
|
+
this.popupMenu.open(e, Co, {
|
|
4748
4803
|
x: n.clientX,
|
|
4749
4804
|
y: n.clientY
|
|
4750
4805
|
});
|
|
@@ -4752,50 +4807,66 @@ var No = {
|
|
|
4752
4807
|
}), e.wardleyType === "drawing") {
|
|
4753
4808
|
let n = e.strokeStyle === "dashed" ? "dotted" : e.strokeStyle === "dotted" ? void 0 : "dashed", r = `Line style: ${e.strokeStyle ?? "solid"} (click to change)`;
|
|
4754
4809
|
t["stroke-style"] = {
|
|
4755
|
-
group:
|
|
4810
|
+
group: jo,
|
|
4756
4811
|
title: r,
|
|
4757
|
-
html:
|
|
4812
|
+
html: Z(W("line-style"), r),
|
|
4758
4813
|
action: { click: this.focusingCanvas(() => this.wardleyModeling.updateProperties(e, { strokeStyle: n })) }
|
|
4759
4814
|
};
|
|
4760
4815
|
}
|
|
4761
4816
|
t.color = {
|
|
4762
|
-
group:
|
|
4817
|
+
group: jo,
|
|
4763
4818
|
title: "Color",
|
|
4764
|
-
html:
|
|
4819
|
+
html: Z(W("palette"), "Color"),
|
|
4765
4820
|
action: { click: (t) => {
|
|
4766
4821
|
let n = t;
|
|
4767
4822
|
this.colorPicker.open(e, n.clientX, n.clientY);
|
|
4768
4823
|
} }
|
|
4769
4824
|
};
|
|
4770
|
-
let n = this.injector.get("wardleyLinkEditing", !1), r =
|
|
4771
|
-
if (n &&
|
|
4825
|
+
let n = this.injector.get("wardleyLinkEditing", !1), r = bo(e);
|
|
4826
|
+
if (n && yo(e)) {
|
|
4772
4827
|
let i = r ? "Edit link…" : "Set link…";
|
|
4773
4828
|
t.link = {
|
|
4774
|
-
group:
|
|
4829
|
+
group: jo,
|
|
4775
4830
|
title: i,
|
|
4776
|
-
html:
|
|
4831
|
+
html: Z(W("link"), i),
|
|
4777
4832
|
action: { click: () => n.activate(e) }
|
|
4778
4833
|
};
|
|
4779
4834
|
}
|
|
4780
|
-
let i =
|
|
4781
|
-
i && (t["
|
|
4782
|
-
group:
|
|
4783
|
-
title:
|
|
4784
|
-
html:
|
|
4785
|
-
action: { click: this.focusingCanvas(() =>
|
|
4835
|
+
let i = this.linksConfig?.chooseTarget;
|
|
4836
|
+
n && i && yo(e) && (t["link-map"] = {
|
|
4837
|
+
group: jo,
|
|
4838
|
+
title: "Link to map…",
|
|
4839
|
+
html: Z(W("map"), "Link to map…"),
|
|
4840
|
+
action: { click: this.focusingCanvas(() => void this.linkChosenMap(e.id, n, i)) }
|
|
4841
|
+
});
|
|
4842
|
+
let a = this.injector.get("wardleyLinkOpener", !1), o = a?.openableLink(e);
|
|
4843
|
+
a && o && (t["open-link"] = {
|
|
4844
|
+
group: jo,
|
|
4845
|
+
title: `Open link (${o})`,
|
|
4846
|
+
html: Z(W("external-link"), `Open link (${o})`),
|
|
4847
|
+
action: { click: this.focusingCanvas(() => a.open(o)) }
|
|
4786
4848
|
});
|
|
4787
4849
|
}
|
|
4850
|
+
async linkChosenMap(e, t, n) {
|
|
4851
|
+
let r = await n().catch(() => void 0);
|
|
4852
|
+
if (r === void 0 || R(this.injector)) return;
|
|
4853
|
+
let i = this.injector.get("elementRegistry").get(e);
|
|
4854
|
+
if (!N(i) || !yo(i)) return;
|
|
4855
|
+
t.setLink(i, r);
|
|
4856
|
+
let a = document.activeElement;
|
|
4857
|
+
a && a !== document.body || this.canvas.focus();
|
|
4858
|
+
}
|
|
4788
4859
|
focusingCanvas(e) {
|
|
4789
4860
|
return (t) => {
|
|
4790
|
-
e(t), this.keyboardEvents.has(t) ||
|
|
4861
|
+
e(t), this.keyboardEvents.has(t) || B(this.canvas);
|
|
4791
4862
|
};
|
|
4792
4863
|
}
|
|
4793
4864
|
onPadKeydown(e, t) {
|
|
4794
|
-
if (e.altKey || e.ctrlKey || e.metaKey ||
|
|
4865
|
+
if (e.altKey || e.ctrlKey || e.metaKey || z(e)) return;
|
|
4795
4866
|
let n = e.target?.closest?.(".entry"), r = n?.getAttribute("data-action");
|
|
4796
4867
|
if (!n || !r || !t.contains(n)) return;
|
|
4797
4868
|
let i = Array.from(t.querySelectorAll(".entry")), a = i.indexOf(n), o;
|
|
4798
|
-
if (
|
|
4869
|
+
if (Po.has(e.key) ? o = i[(a - 1 + i.length) % i.length] : Fo.has(e.key) ? o = i[(a + 1) % i.length] : e.key === "Home" ? o = i[0] : e.key === "End" && (o = i[i.length - 1]), o || e.key === "Escape") {
|
|
4799
4870
|
e.preventDefault(), e.stopPropagation(), o ? o.focus() : this.canvas.focus();
|
|
4800
4871
|
return;
|
|
4801
4872
|
}
|
|
@@ -4836,12 +4907,12 @@ var No = {
|
|
|
4836
4907
|
visibility: 0
|
|
4837
4908
|
}).y, n = this.factory.createNew("component", "Component"), r = {
|
|
4838
4909
|
x: e.x + e.width / 2,
|
|
4839
|
-
y: Math.min(e.y + e.height / 2 +
|
|
4910
|
+
y: Math.min(e.y + e.height / 2 + No, t - n.height / 2)
|
|
4840
4911
|
}, i = this.modeling.appendShape(e, n, r, e.parent, { connection: { wardleyType: "dependency" } });
|
|
4841
4912
|
this.injector.get("selection", !1)?.select(i ?? n), this.labelEditing.activate(i ?? n);
|
|
4842
4913
|
}
|
|
4843
4914
|
}]
|
|
4844
|
-
},
|
|
4915
|
+
}, Ro = 2, zo = 10, Bo = {
|
|
4845
4916
|
arrowleft: {
|
|
4846
4917
|
x: -1,
|
|
4847
4918
|
y: 0
|
|
@@ -4858,7 +4929,7 @@ var No = {
|
|
|
4858
4929
|
x: 0,
|
|
4859
4930
|
y: 1
|
|
4860
4931
|
}
|
|
4861
|
-
},
|
|
4932
|
+
}, Vo = {
|
|
4862
4933
|
c: {
|
|
4863
4934
|
type: "component",
|
|
4864
4935
|
label: "Component"
|
|
@@ -4876,13 +4947,13 @@ var No = {
|
|
|
4876
4947
|
label: "Pipeline"
|
|
4877
4948
|
}
|
|
4878
4949
|
};
|
|
4879
|
-
function
|
|
4880
|
-
return !e.altKey && (t in
|
|
4950
|
+
function Ho(e, t) {
|
|
4951
|
+
return !e.altKey && (t in Vo || t === "a" || t === "l");
|
|
4881
4952
|
}
|
|
4882
|
-
var
|
|
4953
|
+
var Uo = 40, Wo = 56, Go = 160, Ko = {
|
|
4883
4954
|
x: 48,
|
|
4884
4955
|
y: 40
|
|
4885
|
-
},
|
|
4956
|
+
}, qo = 40, Jo = class {
|
|
4886
4957
|
canvas;
|
|
4887
4958
|
selection;
|
|
4888
4959
|
modeling;
|
|
@@ -4928,7 +4999,7 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
4928
4999
|
}, 0));
|
|
4929
5000
|
}, re = (e) => {
|
|
4930
5001
|
C !== void 0 && e.defaultPrevented && (clearTimeout(C), C = void 0);
|
|
4931
|
-
}, ie = () =>
|
|
5002
|
+
}, ie = () => R(d), T = (e, r) => {
|
|
4932
5003
|
if (!ie() || ["a", "c"].includes(r)) {
|
|
4933
5004
|
if (r === "z" || r === "y") {
|
|
4934
5005
|
if (!m) return;
|
|
@@ -4937,12 +5008,12 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
4937
5008
|
}
|
|
4938
5009
|
}, E = (e, t) => {
|
|
4939
5010
|
if (ie() && t !== "escape" && t !== "l" || this.takenByGesture(e, t)) return;
|
|
4940
|
-
let i =
|
|
5011
|
+
let i = Ho(e, t);
|
|
4941
5012
|
if (t === "escape") !ee && n.get().length && n.select(null);
|
|
4942
5013
|
else if (t === "delete" || t === "backspace") te(e);
|
|
4943
|
-
else if (i && t in
|
|
5014
|
+
else if (i && t in Vo) {
|
|
4944
5015
|
e.preventDefault();
|
|
4945
|
-
let { type: n, label: r } =
|
|
5016
|
+
let { type: n, label: r } = Vo[t];
|
|
4946
5017
|
this.quickCreate(n, r);
|
|
4947
5018
|
} else if (i && t === "a") {
|
|
4948
5019
|
let t = this.singleSelectedShape();
|
|
@@ -4954,17 +5025,17 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
4954
5025
|
};
|
|
4955
5026
|
g.start(this.pointerEventOr(n), t, n, !0);
|
|
4956
5027
|
} else if (i && t === "l") e.preventDefault(), c.activateSelection(s.getLastMoveEvent(), !0);
|
|
4957
|
-
else if (t in
|
|
5028
|
+
else if (t in Bo) {
|
|
4958
5029
|
let i = n.get();
|
|
4959
5030
|
if (!i.length || (e.preventDefault(), this.pointDragged())) return;
|
|
4960
|
-
let a = e.shiftKey ?
|
|
5031
|
+
let a = e.shiftKey ? zo : Ro, o = Bo[t];
|
|
4961
5032
|
r.moveElements(i, {
|
|
4962
5033
|
x: o.x * a,
|
|
4963
5034
|
y: o.y * a
|
|
4964
5035
|
});
|
|
4965
5036
|
}
|
|
4966
5037
|
}, ae = (t) => {
|
|
4967
|
-
if (!
|
|
5038
|
+
if (!Ot(t, e)) return;
|
|
4968
5039
|
let n = t.key.toLowerCase();
|
|
4969
5040
|
t.ctrlKey || t.metaKey ? T(t, n) : E(t, n);
|
|
4970
5041
|
};
|
|
@@ -4991,10 +5062,10 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
4991
5062
|
evolution: 1
|
|
4992
5063
|
});
|
|
4993
5064
|
return {
|
|
4994
|
-
left: e.x +
|
|
4995
|
-
top: e.y +
|
|
4996
|
-
right: t.x -
|
|
4997
|
-
bottom: t.y -
|
|
5065
|
+
left: e.x + Uo,
|
|
5066
|
+
top: e.y + Uo,
|
|
5067
|
+
right: t.x - Uo,
|
|
5068
|
+
bottom: t.y - Uo
|
|
4998
5069
|
};
|
|
4999
5070
|
}
|
|
5000
5071
|
visiblePlotCenter(e) {
|
|
@@ -5003,17 +5074,17 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
5003
5074
|
y: t.y + t.height / 2
|
|
5004
5075
|
};
|
|
5005
5076
|
return e ? {
|
|
5006
|
-
x:
|
|
5007
|
-
y:
|
|
5077
|
+
x: Yo(n.x, e.left, e.right),
|
|
5078
|
+
y: Yo(n.y, e.top, e.bottom)
|
|
5008
5079
|
} : n;
|
|
5009
5080
|
}
|
|
5010
5081
|
freeSpotNear(e, t) {
|
|
5011
|
-
let n = (e) => !!this.elementRegistry.find((t) => N(t) && Math.abs(t.x + t.width / 2 - e.x) <
|
|
5012
|
-
for (let i = 0; i <
|
|
5082
|
+
let n = (e) => !!this.elementRegistry.find((t) => N(t) && Math.abs(t.x + t.width / 2 - e.x) < Ko.x && Math.abs(t.y + t.height / 2 - e.y) < Ko.y), r = e;
|
|
5083
|
+
for (let i = 0; i < qo && n(r); i++) if (r = {
|
|
5013
5084
|
x: r.x,
|
|
5014
|
-
y: r.y +
|
|
5085
|
+
y: r.y + Wo
|
|
5015
5086
|
}, t && r.y > t.bottom && (r = {
|
|
5016
|
-
x: r.x +
|
|
5087
|
+
x: r.x + Go,
|
|
5017
5088
|
y: e.y
|
|
5018
5089
|
}, r.x > t.right)) return e;
|
|
5019
5090
|
return r;
|
|
@@ -5026,7 +5097,7 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
5026
5097
|
return !!this.drawingHandles?.isDraggingPoint();
|
|
5027
5098
|
}
|
|
5028
5099
|
takenByGesture(e, t) {
|
|
5029
|
-
return !
|
|
5100
|
+
return !Ho(e, t) || !this.pointDragged() && !this.drawTool?.holdsLine() ? !1 : (e.preventDefault(), !0);
|
|
5030
5101
|
}
|
|
5031
5102
|
pointerEventOr(e) {
|
|
5032
5103
|
if (this.pointerOverCanvas) return this.mouse.getLastMoveEvent();
|
|
@@ -5037,21 +5108,21 @@ var zo = 40, Bo = 56, Vo = 160, Ho = {
|
|
|
5037
5108
|
});
|
|
5038
5109
|
}
|
|
5039
5110
|
};
|
|
5040
|
-
function
|
|
5111
|
+
function Yo(e, t, n) {
|
|
5041
5112
|
return t > n ? (t + n) / 2 : Math.min(Math.max(e, t), n);
|
|
5042
5113
|
}
|
|
5043
5114
|
// src/keyboard/index.ts
|
|
5044
|
-
var
|
|
5115
|
+
var Xo = {
|
|
5045
5116
|
__init__: ["wardleyKeyboard"],
|
|
5046
|
-
wardleyKeyboard: ["type",
|
|
5047
|
-
},
|
|
5117
|
+
wardleyKeyboard: ["type", Jo]
|
|
5118
|
+
}, Zo = /* @__PURE__ */ new Set([
|
|
5048
5119
|
"component",
|
|
5049
5120
|
"anchor",
|
|
5050
5121
|
"submap",
|
|
5051
5122
|
"pipeline",
|
|
5052
5123
|
"accelerator",
|
|
5053
5124
|
"note"
|
|
5054
|
-
]),
|
|
5125
|
+
]), Qo = 500, $o = class {
|
|
5055
5126
|
static $inject = ["injector", "eventBus"];
|
|
5056
5127
|
constructor(e, t) {
|
|
5057
5128
|
let n = e.get("connectionPreview", !1), r = e.get("wardleyLabelEditing", !1);
|
|
@@ -5080,24 +5151,24 @@ var Ko = {
|
|
|
5080
5151
|
let e = !1;
|
|
5081
5152
|
t.on("diagram.destroy", () => {
|
|
5082
5153
|
e = !0;
|
|
5083
|
-
}), t.on("create.end",
|
|
5154
|
+
}), t.on("create.end", Qo, (t) => {
|
|
5084
5155
|
let { context: n } = t, i = n.shape;
|
|
5085
|
-
n.canExecute && i && !n.wardleyPaste && (n.elements?.length ?? 1) === 1 &&
|
|
5156
|
+
n.canExecute && i && !n.wardleyPaste && (n.elements?.length ?? 1) === 1 && Zo.has(i.wardleyType) && setTimeout(() => {
|
|
5086
5157
|
e || r.activate(i);
|
|
5087
5158
|
}, 0);
|
|
5088
5159
|
});
|
|
5089
5160
|
}
|
|
5090
5161
|
}
|
|
5091
|
-
},
|
|
5162
|
+
}, es = {
|
|
5092
5163
|
__depends__: [Me],
|
|
5093
5164
|
__init__: ["wardleyAppendBehavior"],
|
|
5094
|
-
wardleyAppendBehavior: ["type",
|
|
5095
|
-
},
|
|
5165
|
+
wardleyAppendBehavior: ["type", $o]
|
|
5166
|
+
}, ts = {
|
|
5096
5167
|
ArrowLeft: -1,
|
|
5097
5168
|
ArrowRight: 1,
|
|
5098
5169
|
ArrowUp: -3,
|
|
5099
5170
|
ArrowDown: 3
|
|
5100
|
-
},
|
|
5171
|
+
}, ns = class {
|
|
5101
5172
|
canvas;
|
|
5102
5173
|
modeling;
|
|
5103
5174
|
injector;
|
|
@@ -5112,7 +5183,7 @@ var Ko = {
|
|
|
5112
5183
|
this.popover && !this.popover.contains(e.target) && this.close();
|
|
5113
5184
|
};
|
|
5114
5185
|
onKey = (e) => {
|
|
5115
|
-
e.key === "Escape" && (
|
|
5186
|
+
e.key === "Escape" && (wt(e, this.popover) || Ot(e, this.canvas)) && (e.preventDefault(), e.stopPropagation(), this.close({ restoreFocus: !0 }));
|
|
5116
5187
|
};
|
|
5117
5188
|
constructor(e, t, n, r) {
|
|
5118
5189
|
this.canvas = e, this.modeling = n, this.injector = r, t.on([
|
|
@@ -5123,14 +5194,14 @@ var Ko = {
|
|
|
5123
5194
|
], () => this.close());
|
|
5124
5195
|
}
|
|
5125
5196
|
open(e, t, n) {
|
|
5126
|
-
if (this.close(),
|
|
5197
|
+
if (this.close(), R(this.injector)) return;
|
|
5127
5198
|
let r = this.canvas.getContainer(), i = r.getBoundingClientRect(), a = document.createElement("div");
|
|
5128
5199
|
a.className = "wardley-color-picker", a.setAttribute("role", "dialog"), a.setAttribute("aria-label", "Color");
|
|
5129
5200
|
let o = [{
|
|
5130
5201
|
value: void 0,
|
|
5131
5202
|
title: "No color",
|
|
5132
5203
|
cls: "wardley-cp-none"
|
|
5133
|
-
}, ...
|
|
5204
|
+
}, ...Re.map((e) => ({
|
|
5134
5205
|
value: e.value,
|
|
5135
5206
|
title: e.name,
|
|
5136
5207
|
cls: ""
|
|
@@ -5140,7 +5211,7 @@ var Ko = {
|
|
|
5140
5211
|
n.type = "button", n.className = `wardley-cp-swatch ${t.cls}`.trim(), n.title = t.title, n.setAttribute("aria-label", t.title), t.value && (n.style.background = t.value);
|
|
5141
5212
|
let r = (e.color ?? void 0) === t.value;
|
|
5142
5213
|
n.setAttribute("aria-pressed", String(r)), r && (n.classList.add("wardley-cp-active"), c = n), n.addEventListener("click", (n) => {
|
|
5143
|
-
|
|
5214
|
+
z(n) || (n.stopPropagation(), this.modeling.setColor(e, t.value), this.close({ restoreFocus: !0 }));
|
|
5144
5215
|
}), s.push(n), a.append(n);
|
|
5145
5216
|
}
|
|
5146
5217
|
a.addEventListener("keydown", (e) => this.onGridKeydown(e, s)), r.appendChild(a);
|
|
@@ -5158,19 +5229,19 @@ var Ko = {
|
|
|
5158
5229
|
this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0), (e.restoreFocus || t) && this.canvas.focus();
|
|
5159
5230
|
}
|
|
5160
5231
|
onGridKeydown(e, t) {
|
|
5161
|
-
if (
|
|
5162
|
-
let n =
|
|
5232
|
+
if (z(e)) return;
|
|
5233
|
+
let n = ts[e.key], r = t.indexOf(document.activeElement), i;
|
|
5163
5234
|
n === void 0 ? e.key === "Home" ? i = 0 : e.key === "End" ? i = t.length - 1 : e.key === "Tab" && (i = r + (e.shiftKey ? -1 : 1), i = (i + t.length) % t.length) : i = r < 0 ? 0 : r + n, i !== void 0 && (e.preventDefault(), e.stopPropagation(), t[Math.min(t.length - 1, Math.max(0, i))]?.focus());
|
|
5164
5235
|
}
|
|
5165
|
-
},
|
|
5236
|
+
}, rs = {
|
|
5166
5237
|
__init__: ["wardleyColorPicker"],
|
|
5167
|
-
wardleyColorPicker: ["type",
|
|
5238
|
+
wardleyColorPicker: ["type", ns]
|
|
5168
5239
|
};
|
|
5169
5240
|
// src/ordering/WardleyOrderingProvider.ts
|
|
5170
|
-
function
|
|
5241
|
+
function is(e) {
|
|
5171
5242
|
return N(e) && (e.wardleyType === "attitude" || e.wardleyType === "pipeline");
|
|
5172
5243
|
}
|
|
5173
|
-
var
|
|
5244
|
+
var as = class extends Ne {
|
|
5174
5245
|
static $inject = ["eventBus"];
|
|
5175
5246
|
constructor(e) {
|
|
5176
5247
|
super(e);
|
|
@@ -5181,18 +5252,18 @@ var ts = class extends Ne {
|
|
|
5181
5252
|
let r = e.wardleyType === "flow";
|
|
5182
5253
|
return {
|
|
5183
5254
|
parent: t,
|
|
5184
|
-
index: n.filter((t) => t !== e && (
|
|
5255
|
+
index: n.filter((t) => t !== e && (is(t) || P(t) && (r || t.wardleyType !== "flow"))).length
|
|
5185
5256
|
};
|
|
5186
5257
|
}
|
|
5187
|
-
return
|
|
5258
|
+
return is(e) ? {
|
|
5188
5259
|
parent: t,
|
|
5189
|
-
index: n.filter((t) => t !== e &&
|
|
5260
|
+
index: n.filter((t) => t !== e && is(t)).length
|
|
5190
5261
|
} : { parent: t };
|
|
5191
5262
|
}
|
|
5192
|
-
},
|
|
5263
|
+
}, os = {
|
|
5193
5264
|
__init__: ["wardleyOrderingProvider"],
|
|
5194
|
-
wardleyOrderingProvider: ["type",
|
|
5195
|
-
},
|
|
5265
|
+
wardleyOrderingProvider: ["type", as]
|
|
5266
|
+
}, ss = 12, cs = ".djs-palette .entry[data-action=\"draw-tool\"]", ls = "draw", us = class {
|
|
5196
5267
|
canvas;
|
|
5197
5268
|
eventBus;
|
|
5198
5269
|
modeling;
|
|
@@ -5217,7 +5288,7 @@ var ts = class extends Ne {
|
|
|
5217
5288
|
this.canvas = e, this.eventBus = t, this.modeling = n, this.selection = r, this.factory = i, this.grid = a, this.injector = o, t.on("diagram.destroy", () => this.cancel()), t.on(["import.render.start", "diagram.clear"], () => {
|
|
5218
5289
|
this.holdsLine() && this.cancel();
|
|
5219
5290
|
}), t.on("tool-manager.update", (e) => {
|
|
5220
|
-
this.active && e.tool && e.tool !==
|
|
5291
|
+
this.active && e.tool && e.tool !== ls && this.giveWay();
|
|
5221
5292
|
});
|
|
5222
5293
|
}
|
|
5223
5294
|
isActive() {
|
|
@@ -5234,10 +5305,10 @@ var ts = class extends Ne {
|
|
|
5234
5305
|
return e.closest(".wardley-container") ?? e;
|
|
5235
5306
|
}
|
|
5236
5307
|
activate() {
|
|
5237
|
-
if (this.active ||
|
|
5308
|
+
if (this.active || R(this.injector)) return;
|
|
5238
5309
|
this.active = !0, this.points = [], this.cursor = null;
|
|
5239
5310
|
let e = this.canvas.getContainer();
|
|
5240
|
-
this.outerContainer().classList.add("wardley-draw-mode"), e.addEventListener("mousedown", this.onMouseDown, !0), e.addEventListener("dblclick", this.onDblClick, !0), e.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("keydown", this.onKeyDown, !0), this.eventBus.fire("tool-manager.update", { tool:
|
|
5311
|
+
this.outerContainer().classList.add("wardley-draw-mode"), e.addEventListener("mousedown", this.onMouseDown, !0), e.addEventListener("dblclick", this.onDblClick, !0), e.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("keydown", this.onKeyDown, !0), this.eventBus.fire("tool-manager.update", { tool: ls });
|
|
5241
5312
|
}
|
|
5242
5313
|
finish() {
|
|
5243
5314
|
this.finishLine({ reportRelease: !0 });
|
|
@@ -5283,14 +5354,14 @@ var ts = class extends Ne {
|
|
|
5283
5354
|
}
|
|
5284
5355
|
onMouseDown = (e) => {
|
|
5285
5356
|
if (e.button !== 0 || this.isChromeTarget(e)) return;
|
|
5286
|
-
e.preventDefault(), e.stopPropagation(),
|
|
5357
|
+
e.preventDefault(), e.stopPropagation(), B(this.canvas);
|
|
5287
5358
|
let t = this.toCanvasPoint(e), n = this.points[0];
|
|
5288
|
-
if (n && this.points.length >= 3 &&
|
|
5359
|
+
if (n && this.points.length >= 3 && ds(t, n) <= ss) {
|
|
5289
5360
|
this.finishClosed();
|
|
5290
5361
|
return;
|
|
5291
5362
|
}
|
|
5292
5363
|
let r = this.points[this.points.length - 1];
|
|
5293
|
-
r &&
|
|
5364
|
+
r && ds(t, r) <= ss ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
|
|
5294
5365
|
};
|
|
5295
5366
|
onDblClick = (e) => {
|
|
5296
5367
|
this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
|
|
@@ -5299,13 +5370,13 @@ var ts = class extends Ne {
|
|
|
5299
5370
|
this.points.length && (this.cursor = this.toCanvasPoint(e), this.renderPreview());
|
|
5300
5371
|
};
|
|
5301
5372
|
ownsKey(e) {
|
|
5302
|
-
return
|
|
5373
|
+
return Ot(e, this.canvas) || this.targetsOwnPaletteEntry(e);
|
|
5303
5374
|
}
|
|
5304
5375
|
targetsOwnPaletteEntry(e) {
|
|
5305
5376
|
let t = e.target;
|
|
5306
5377
|
if (!(t instanceof globalThis.Element)) return !1;
|
|
5307
|
-
let n = t.closest(
|
|
5308
|
-
return !!n && this.canvas.getContainer().contains(n) &&
|
|
5378
|
+
let n = t.closest(cs);
|
|
5379
|
+
return !!n && this.canvas.getContainer().contains(n) && wt(e, n);
|
|
5309
5380
|
}
|
|
5310
5381
|
savesWithSpace(e) {
|
|
5311
5382
|
return e.key === " " && !e.altKey && !e.ctrlKey && !e.metaKey && this.holdsLine() && this.targetsOwnPaletteEntry(e);
|
|
@@ -5350,11 +5421,11 @@ var ts = class extends Ne {
|
|
|
5350
5421
|
this.layer &&= (oe(this.layer), null);
|
|
5351
5422
|
}
|
|
5352
5423
|
};
|
|
5353
|
-
function
|
|
5424
|
+
function ds(e, t) {
|
|
5354
5425
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
5355
5426
|
}
|
|
5356
5427
|
// src/draw-tool/WardleyDrawingHandles.ts
|
|
5357
|
-
var
|
|
5428
|
+
var fs = class {
|
|
5358
5429
|
eventBus;
|
|
5359
5430
|
canvas;
|
|
5360
5431
|
modeling;
|
|
@@ -5382,7 +5453,7 @@ var cs = class {
|
|
|
5382
5453
|
this.shape && e.element === this.shape && this.render();
|
|
5383
5454
|
}), e.on("shape.remove", (e) => {
|
|
5384
5455
|
this.pointDrag?.shape === e.element && this.endPointDrag();
|
|
5385
|
-
}), e.on(L,
|
|
5456
|
+
}), e.on(L, mt, () => {
|
|
5386
5457
|
this.pointDrag && (this.swallowClickOfRelease(), this.endPointDrag());
|
|
5387
5458
|
}), e.on(["diagram.clear", "diagram.destroy"], () => {
|
|
5388
5459
|
this.endPointDrag(), this.attach(null);
|
|
@@ -5415,8 +5486,8 @@ var cs = class {
|
|
|
5415
5486
|
}), T(e, t), this.group = t;
|
|
5416
5487
|
}
|
|
5417
5488
|
startDrag(e, t) {
|
|
5418
|
-
if (e.button !== 0 || !this.shape ||
|
|
5419
|
-
e.preventDefault(), e.stopPropagation(),
|
|
5489
|
+
if (e.button !== 0 || !this.shape || R(this.injector)) return;
|
|
5490
|
+
e.preventDefault(), e.stopPropagation(), B(this.canvas), this.endPointDrag();
|
|
5420
5491
|
let n = this.shape, r = this.absolutePoints(), i = {
|
|
5421
5492
|
shape: n,
|
|
5422
5493
|
unbind: () => void 0
|
|
@@ -5427,7 +5498,7 @@ var cs = class {
|
|
|
5427
5498
|
this.stopPointDrag(), this.commit(n, r);
|
|
5428
5499
|
});
|
|
5429
5500
|
}, s = (e) => {
|
|
5430
|
-
e.key === "Escape" &&
|
|
5501
|
+
e.key === "Escape" && Ot(e, this.canvas) && (e.preventDefault(), e.stopPropagation(), this.swallowClickOfRelease(), this.endPointDrag());
|
|
5431
5502
|
};
|
|
5432
5503
|
document.addEventListener("mousemove", a, !0), document.addEventListener("mouseup", o, !0), document.addEventListener("keydown", s, !0), i.unbind = () => {
|
|
5433
5504
|
document.removeEventListener("mousemove", a, !0), document.removeEventListener("mouseup", o, !0), document.removeEventListener("keydown", s, !0);
|
|
@@ -5501,20 +5572,20 @@ var cs = class {
|
|
|
5501
5572
|
}
|
|
5502
5573
|
};
|
|
5503
5574
|
// src/draw-tool/WardleyDrawingHitProvider.ts
|
|
5504
|
-
function
|
|
5575
|
+
function ps(e) {
|
|
5505
5576
|
return N(e) && e.wardleyType === "drawing";
|
|
5506
5577
|
}
|
|
5507
|
-
var
|
|
5578
|
+
var ms = class {
|
|
5508
5579
|
static $inject = ["eventBus", "interactionEvents"];
|
|
5509
5580
|
constructor(e, t) {
|
|
5510
5581
|
e.on("interactionEvents.createHit", (e) => {
|
|
5511
|
-
if (
|
|
5582
|
+
if (ps(e.element) && e.gfx) return hs(e.element, e.gfx), !1;
|
|
5512
5583
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
5513
|
-
if (
|
|
5584
|
+
if (ps(e.element) && e.gfx) return t.removeHits(e.gfx), hs(e.element, e.gfx), !1;
|
|
5514
5585
|
});
|
|
5515
5586
|
}
|
|
5516
5587
|
};
|
|
5517
|
-
function
|
|
5588
|
+
function hs(e, t) {
|
|
5518
5589
|
let n = e.drawingPoints ?? [], r = D(e.closed ? "polygon" : "polyline");
|
|
5519
5590
|
E(r, {
|
|
5520
5591
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
@@ -5526,17 +5597,17 @@ function ds(e, t) {
|
|
|
5526
5597
|
}), T(t, r);
|
|
5527
5598
|
}
|
|
5528
5599
|
// src/draw-tool/index.ts
|
|
5529
|
-
var
|
|
5530
|
-
__depends__: [
|
|
5600
|
+
var gs = {
|
|
5601
|
+
__depends__: [cn],
|
|
5531
5602
|
__init__: [
|
|
5532
5603
|
"wardleyDrawTool",
|
|
5533
5604
|
"wardleyDrawingHandles",
|
|
5534
5605
|
"wardleyDrawingHitProvider"
|
|
5535
5606
|
],
|
|
5536
|
-
wardleyDrawTool: ["type",
|
|
5537
|
-
wardleyDrawingHandles: ["type",
|
|
5538
|
-
wardleyDrawingHitProvider: ["type",
|
|
5539
|
-
},
|
|
5607
|
+
wardleyDrawTool: ["type", us],
|
|
5608
|
+
wardleyDrawingHandles: ["type", fs],
|
|
5609
|
+
wardleyDrawingHitProvider: ["type", ms]
|
|
5610
|
+
}, _s = 3, vs = 4, ys = "wardley-labels-draggable", bs = "wardley-label-dragging", xs = class {
|
|
5540
5611
|
eventBus;
|
|
5541
5612
|
canvas;
|
|
5542
5613
|
elementRegistry;
|
|
@@ -5561,9 +5632,9 @@ var fs = {
|
|
|
5561
5632
|
constructor(e, t, n, r, i, a, o, s, c) {
|
|
5562
5633
|
this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.selection = i, this.grid = a, this.injector = o, this.interaction = s, this.livePreview = c;
|
|
5563
5634
|
let l = t.getContainer();
|
|
5564
|
-
this.outerContainer().classList.add(
|
|
5635
|
+
this.outerContainer().classList.add(ys), l.addEventListener("mousedown", this.onMouseDown, !0), l.addEventListener("dblclick", this.onDoubleClick, !0), e.on("shape.remove", ({ element: e }) => {
|
|
5565
5636
|
this.active?.shape === e && this.cancel();
|
|
5566
|
-
}), e.on(L,
|
|
5637
|
+
}), e.on(L, mt, () => {
|
|
5567
5638
|
this.active && c.previewsShape(this.active.shape) && this.cancel();
|
|
5568
5639
|
}), e.on("diagram.destroy", () => {
|
|
5569
5640
|
this.cancel(), l.removeEventListener("mousedown", this.onMouseDown, !0), l.removeEventListener("dblclick", this.onDoubleClick, !0);
|
|
@@ -5573,12 +5644,12 @@ var fs = {
|
|
|
5573
5644
|
t === "movement" ? e.movement?.labelOffset && this.commitMovementOffset(e, void 0) : e.labelOffset && this.commitNameOffset(e, void 0);
|
|
5574
5645
|
}
|
|
5575
5646
|
onMouseDown = (e) => {
|
|
5576
|
-
if (e.button !== 0 || this.outerContainer().classList.contains("wardley-draw-mode") ||
|
|
5647
|
+
if (e.button !== 0 || this.outerContainer().classList.contains("wardley-draw-mode") || R(this.injector)) return;
|
|
5577
5648
|
let t = this.labelTarget(e);
|
|
5578
5649
|
if (!t) return;
|
|
5579
5650
|
e.stopPropagation(), e.preventDefault(), this.cancel();
|
|
5580
5651
|
let n = document.activeElement;
|
|
5581
|
-
n instanceof HTMLElement && this.outerContainer().contains(n) && n.blur(),
|
|
5652
|
+
n instanceof HTMLElement && this.outerContainer().contains(n) && n.blur(), B(this.canvas);
|
|
5582
5653
|
let { shape: r, role: i, handle: a } = t, o = this.renderedOffset(r, i, a);
|
|
5583
5654
|
this.active = {
|
|
5584
5655
|
shape: r,
|
|
@@ -5598,8 +5669,8 @@ var fs = {
|
|
|
5598
5669
|
if (!t) return;
|
|
5599
5670
|
let n = e.clientX - t.startClient.x, r = e.clientY - t.startClient.y;
|
|
5600
5671
|
if (!t.dragging) {
|
|
5601
|
-
if (Math.hypot(n, r) <
|
|
5602
|
-
t.dragging = !0, this.outerContainer().classList.add(
|
|
5672
|
+
if (Math.hypot(n, r) < _s) return;
|
|
5673
|
+
t.dragging = !0, this.outerContainer().classList.add(bs), this.interaction.begin(t);
|
|
5603
5674
|
}
|
|
5604
5675
|
t.latest = {
|
|
5605
5676
|
dx: Math.round(t.startOffset.dx + n / t.zoom),
|
|
@@ -5613,7 +5684,7 @@ var fs = {
|
|
|
5613
5684
|
dropLabel(e) {
|
|
5614
5685
|
if (this.finish(), !e.latest || this.elementRegistry.get(e.shape.id) !== e.shape) return;
|
|
5615
5686
|
let t = this.snapHome(e.latest, e.homeOffset);
|
|
5616
|
-
|
|
5687
|
+
Cs(t, e.role === "name" ? e.shape.labelOffset : e.shape.movement?.labelOffset) || (e.role === "name" ? this.commitNameOffset(e.shape, t) : this.commitMovementOffset(e.shape, t)), this.suppressNextClick(), this.selection.select(e.shape);
|
|
5617
5688
|
}
|
|
5618
5689
|
suppressNextClick() {
|
|
5619
5690
|
let e = this.canvas.getContainer(), t = (e) => e.stopPropagation();
|
|
@@ -5623,10 +5694,10 @@ var fs = {
|
|
|
5623
5694
|
}), setTimeout(() => e.removeEventListener("click", t, !0), 0);
|
|
5624
5695
|
}
|
|
5625
5696
|
onKeyDown = (e) => {
|
|
5626
|
-
e.key === "Escape" && this.active &&
|
|
5697
|
+
e.key === "Escape" && this.active && Ot(e, this.canvas) && (e.stopPropagation(), this.cancel());
|
|
5627
5698
|
};
|
|
5628
5699
|
onDoubleClick = (e) => {
|
|
5629
|
-
if (!e.altKey ||
|
|
5700
|
+
if (!e.altKey || R(this.injector)) return;
|
|
5630
5701
|
let t = this.labelTarget(e);
|
|
5631
5702
|
t && (e.stopPropagation(), e.preventDefault(), this.resetLabelOffset(t.shape, t.role));
|
|
5632
5703
|
};
|
|
@@ -5636,7 +5707,7 @@ var fs = {
|
|
|
5636
5707
|
}
|
|
5637
5708
|
finish() {
|
|
5638
5709
|
let e = this.active;
|
|
5639
|
-
e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(
|
|
5710
|
+
e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(bs), this.livePreview.putBackShape(e.shape));
|
|
5640
5711
|
}
|
|
5641
5712
|
preview(e, t) {
|
|
5642
5713
|
let { movement: n } = this.livePreview.beginShape(e.shape);
|
|
@@ -5646,7 +5717,7 @@ var fs = {
|
|
|
5646
5717
|
}), this.eventBus.fire("element.changed", { element: e.shape });
|
|
5647
5718
|
}
|
|
5648
5719
|
snapHome(e, t) {
|
|
5649
|
-
return Math.abs(e.dx - t.dx) <=
|
|
5720
|
+
return Math.abs(e.dx - t.dx) <= vs && Math.abs(e.dy - t.dy) <= vs ? void 0 : ei(e.dx, e.dy);
|
|
5650
5721
|
}
|
|
5651
5722
|
commitNameOffset(e, t) {
|
|
5652
5723
|
let n = { labelOffset: t }, r = e.businessObject;
|
|
@@ -5673,17 +5744,17 @@ var fs = {
|
|
|
5673
5744
|
dx: 0,
|
|
5674
5745
|
dy: 0
|
|
5675
5746
|
};
|
|
5676
|
-
let r =
|
|
5747
|
+
let r = Vr(e, this.grid);
|
|
5677
5748
|
return t === "movement" ? r === void 0 ? {
|
|
5678
5749
|
dx: 0,
|
|
5679
5750
|
dy: 0
|
|
5680
|
-
} :
|
|
5751
|
+
} : Ss(Zr(void 0, r), Xr(r), n, e) : Ss(Yr({
|
|
5681
5752
|
...e,
|
|
5682
5753
|
labelOffset: void 0
|
|
5683
|
-
}, r),
|
|
5754
|
+
}, r), qr(), n, e);
|
|
5684
5755
|
}
|
|
5685
5756
|
labelTarget(e) {
|
|
5686
|
-
let t = e.target?.closest?.(`.${
|
|
5757
|
+
let t = e.target?.closest?.(`.${ri}`);
|
|
5687
5758
|
if (!(t instanceof SVGTextElement)) return null;
|
|
5688
5759
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), r = n ? this.elementRegistry.get(n) : void 0;
|
|
5689
5760
|
if (!N(r)) return null;
|
|
@@ -5699,31 +5770,31 @@ var fs = {
|
|
|
5699
5770
|
return e.closest(".wardley-container") ?? e;
|
|
5700
5771
|
}
|
|
5701
5772
|
};
|
|
5702
|
-
function
|
|
5773
|
+
function Ss(e, t, n, r) {
|
|
5703
5774
|
let i = r.width / 2, a = e.anchor === "end" ? n.getBBox().x - i : e.x;
|
|
5704
5775
|
return {
|
|
5705
5776
|
dx: Math.round(a - t.x),
|
|
5706
5777
|
dy: Math.round(e.y - t.y)
|
|
5707
5778
|
};
|
|
5708
5779
|
}
|
|
5709
|
-
function
|
|
5780
|
+
function Cs(e, t) {
|
|
5710
5781
|
return !e || !t ? !e && !t : e.dx === t.dx && e.dy === t.dy;
|
|
5711
5782
|
}
|
|
5712
5783
|
// src/label-drag/index.ts
|
|
5713
|
-
var
|
|
5714
|
-
__depends__: [
|
|
5784
|
+
var ws = {
|
|
5785
|
+
__depends__: [cn, ht],
|
|
5715
5786
|
__init__: ["wardleyLabelDragging"],
|
|
5716
|
-
wardleyLabelDragging: ["type",
|
|
5717
|
-
},
|
|
5787
|
+
wardleyLabelDragging: ["type", xs]
|
|
5788
|
+
}, Ts = { autoScroll: ["type", Qt] }, Es = class extends Ai {
|
|
5718
5789
|
_getModules() {
|
|
5719
5790
|
return [
|
|
5720
5791
|
...super._getModules(),
|
|
5721
5792
|
fe,
|
|
5722
|
-
|
|
5793
|
+
_n,
|
|
5723
5794
|
Te,
|
|
5724
5795
|
be,
|
|
5725
5796
|
xe,
|
|
5726
|
-
|
|
5797
|
+
Ts,
|
|
5727
5798
|
me,
|
|
5728
5799
|
Se,
|
|
5729
5800
|
Ce,
|
|
@@ -5731,28 +5802,28 @@ var bs = {
|
|
|
5731
5802
|
Ee,
|
|
5732
5803
|
De,
|
|
5733
5804
|
Oe,
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
Ko,
|
|
5742
|
-
Fn,
|
|
5743
|
-
wo,
|
|
5805
|
+
Mr,
|
|
5806
|
+
Bi,
|
|
5807
|
+
Pr,
|
|
5808
|
+
Vi,
|
|
5809
|
+
Na,
|
|
5810
|
+
Lo,
|
|
5811
|
+
so,
|
|
5744
5812
|
Xo,
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5813
|
+
Rn,
|
|
5814
|
+
ko,
|
|
5815
|
+
es,
|
|
5816
|
+
rs,
|
|
5817
|
+
Pi,
|
|
5818
|
+
os,
|
|
5819
|
+
gs,
|
|
5820
|
+
er,
|
|
5821
|
+
en,
|
|
5822
|
+
So,
|
|
5823
|
+
Ft,
|
|
5824
|
+
ws,
|
|
5825
|
+
xt,
|
|
5826
|
+
cn
|
|
5756
5827
|
];
|
|
5757
5828
|
}
|
|
5758
5829
|
commitPendingEdits() {
|
|
@@ -5772,7 +5843,7 @@ var bs = {
|
|
|
5772
5843
|
}
|
|
5773
5844
|
};
|
|
5774
5845
|
// src/editor-state.ts
|
|
5775
|
-
function
|
|
5846
|
+
function Ds(e) {
|
|
5776
5847
|
let t;
|
|
5777
5848
|
try {
|
|
5778
5849
|
t = w(e.exportMap());
|
|
@@ -5781,18 +5852,18 @@ function Cs(e) {
|
|
|
5781
5852
|
}
|
|
5782
5853
|
return (e) => t.get(e) ?? e;
|
|
5783
5854
|
}
|
|
5784
|
-
function
|
|
5855
|
+
function Os(e, t = (e) => e) {
|
|
5785
5856
|
return {
|
|
5786
5857
|
sourceId: t(e.source?.id ?? ""),
|
|
5787
5858
|
targetId: t(e.target?.id ?? ""),
|
|
5788
5859
|
wardleyType: e.wardleyType
|
|
5789
5860
|
};
|
|
5790
5861
|
}
|
|
5791
|
-
function
|
|
5862
|
+
function ks(e, t) {
|
|
5792
5863
|
return e.find((e) => P(e) && e.source?.id === t.sourceId && e.target?.id === t.targetId && e.wardleyType === t.wardleyType);
|
|
5793
5864
|
}
|
|
5794
|
-
function
|
|
5795
|
-
let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o =
|
|
5865
|
+
function As(e) {
|
|
5866
|
+
let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o = Ds(e), s = (e) => {
|
|
5796
5867
|
let t = o(e);
|
|
5797
5868
|
return a.set(t, e), t;
|
|
5798
5869
|
}, c, l = r.getActiveEdit(), u = i.getActiveEdit();
|
|
@@ -5800,7 +5871,7 @@ function Es(e) {
|
|
|
5800
5871
|
let e = n.get(l.elementId);
|
|
5801
5872
|
P(e) && (c = {
|
|
5802
5873
|
kind: "connection",
|
|
5803
|
-
key:
|
|
5874
|
+
key: Os(e, s),
|
|
5804
5875
|
value: l.value,
|
|
5805
5876
|
...l.selection ? { selection: l.selection } : {}
|
|
5806
5877
|
});
|
|
@@ -5817,13 +5888,13 @@ function Es(e) {
|
|
|
5817
5888
|
});
|
|
5818
5889
|
return r.cancel(), i.cancel(), {
|
|
5819
5890
|
shapeIds: t.filter(N).map((e) => s(e.id)),
|
|
5820
|
-
connections: t.filter(P).map((e) =>
|
|
5891
|
+
connections: t.filter(P).map((e) => Os(e, s)),
|
|
5821
5892
|
...c ? { edit: c } : {},
|
|
5822
5893
|
canvasIds: a
|
|
5823
5894
|
};
|
|
5824
5895
|
}
|
|
5825
|
-
function
|
|
5826
|
-
let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) =>
|
|
5896
|
+
function js(e, t, n = {}) {
|
|
5897
|
+
let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) => ks(r, {
|
|
5827
5898
|
...e,
|
|
5828
5899
|
sourceId: i(e.sourceId),
|
|
5829
5900
|
targetId: i(e.targetId)
|
|
@@ -5848,29 +5919,32 @@ function Ds(e, t, n = {}) {
|
|
|
5848
5919
|
value: u.value,
|
|
5849
5920
|
...u.selection ? { selection: u.selection } : {}
|
|
5850
5921
|
}), !0) : !1;
|
|
5851
|
-
})() ||
|
|
5922
|
+
})() || B(e.get("canvas"));
|
|
5852
5923
|
}
|
|
5853
5924
|
// src/collaborative/CollaborativeWardley.ts
|
|
5854
|
-
var
|
|
5925
|
+
var Ms = "wardley", Ns = /* @__PURE__ */ new Set([
|
|
5855
5926
|
"component",
|
|
5856
5927
|
"anchor",
|
|
5857
5928
|
"pipeline",
|
|
5858
5929
|
"submap",
|
|
5859
5930
|
"accelerator"
|
|
5860
5931
|
]);
|
|
5861
|
-
function
|
|
5862
|
-
return N(e) &&
|
|
5863
|
-
}
|
|
5864
|
-
function
|
|
5865
|
-
return
|
|
5866
|
-
...
|
|
5867
|
-
undoRedoKeys: e.undoRedoKeys
|
|
5932
|
+
function Ps(e) {
|
|
5933
|
+
return N(e) && Ns.has(e.wardleyType);
|
|
5934
|
+
}
|
|
5935
|
+
function Fs(e = {}) {
|
|
5936
|
+
return Us(new Es({
|
|
5937
|
+
...Ls(e),
|
|
5938
|
+
undoRedoKeys: e.undoRedoKeys,
|
|
5939
|
+
openRelativeLink: e.openRelativeLink,
|
|
5940
|
+
openExternalLink: e.openExternalLink,
|
|
5941
|
+
chooseLinkTarget: e.chooseLinkTarget
|
|
5868
5942
|
}), !0);
|
|
5869
5943
|
}
|
|
5870
|
-
function
|
|
5871
|
-
return
|
|
5944
|
+
function Is(e = {}) {
|
|
5945
|
+
return Us(new Ai(Ls(e)), !1);
|
|
5872
5946
|
}
|
|
5873
|
-
function
|
|
5947
|
+
function Ls(e) {
|
|
5874
5948
|
return {
|
|
5875
5949
|
width: "100%",
|
|
5876
5950
|
height: "100%",
|
|
@@ -5879,7 +5953,7 @@ function Ns(e) {
|
|
|
5879
5953
|
fitOnImport: e.fitOnImport
|
|
5880
5954
|
};
|
|
5881
5955
|
}
|
|
5882
|
-
function
|
|
5956
|
+
function Rs(e, t) {
|
|
5883
5957
|
let n, r;
|
|
5884
5958
|
t.on([
|
|
5885
5959
|
"elements.changed",
|
|
@@ -5906,9 +5980,9 @@ function Ps(e, t) {
|
|
|
5906
5980
|
canvasIdOf: (e) => i().byDocumentId.get(e) ?? e
|
|
5907
5981
|
};
|
|
5908
5982
|
}
|
|
5909
|
-
function
|
|
5983
|
+
function zs(e, t) {
|
|
5910
5984
|
let n = t ? e.get("wardleyInteraction") : void 0, r = /* @__PURE__ */ new Set(), i = !1;
|
|
5911
|
-
return e.get("eventBus").on(
|
|
5985
|
+
return e.get("eventBus").on(rn, (e) => {
|
|
5912
5986
|
for (let t of [...r]) if (r.has(t)) try {
|
|
5913
5987
|
t(e.active);
|
|
5914
5988
|
} catch (e) {
|
|
@@ -5934,7 +6008,7 @@ function Fs(e, t) {
|
|
|
5934
6008
|
}
|
|
5935
6009
|
};
|
|
5936
6010
|
}
|
|
5937
|
-
function
|
|
6011
|
+
function Bs(e, t) {
|
|
5938
6012
|
let n = 0;
|
|
5939
6013
|
return {
|
|
5940
6014
|
delivering: () => n > 0,
|
|
@@ -5955,7 +6029,7 @@ function Is(e, t) {
|
|
|
5955
6029
|
}
|
|
5956
6030
|
};
|
|
5957
6031
|
}
|
|
5958
|
-
function
|
|
6032
|
+
function Vs(t, n) {
|
|
5959
6033
|
return {
|
|
5960
6034
|
themes: e,
|
|
5961
6035
|
set(r) {
|
|
@@ -5965,10 +6039,10 @@ function Ls(t, n) {
|
|
|
5965
6039
|
}
|
|
5966
6040
|
};
|
|
5967
6041
|
}
|
|
5968
|
-
function
|
|
6042
|
+
function Hs(e, t) {
|
|
5969
6043
|
let n, r = async (n, r) => {
|
|
5970
6044
|
for (n && await n.catch(() => void 0);; r = e()) {
|
|
5971
|
-
if (t()) throw
|
|
6045
|
+
if (t()) throw Ws();
|
|
5972
6046
|
if (!r) return;
|
|
5973
6047
|
await r;
|
|
5974
6048
|
}
|
|
@@ -5984,16 +6058,16 @@ function Rs(e, t) {
|
|
|
5984
6058
|
return a.then(o, o), a;
|
|
5985
6059
|
};
|
|
5986
6060
|
}
|
|
5987
|
-
function
|
|
5988
|
-
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s =
|
|
5989
|
-
notation:
|
|
6061
|
+
function Us(e, t) {
|
|
6062
|
+
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s = Rs(e, n), c = t ? e.get("wardleyLivePreview") : void 0, l = zs(e, t), u = /* @__PURE__ */ new Set(), d = 0, f = !1, p = !1, m = "", h = Bs(n, () => p), g = Hs(l.afterUserAction, () => p), _ = {
|
|
6063
|
+
notation: Ms,
|
|
5990
6064
|
apiVersion: Pe,
|
|
5991
6065
|
editable: t
|
|
5992
6066
|
};
|
|
5993
6067
|
t && n.on("commandStack.changed", () => {
|
|
5994
6068
|
if (!(d > 0)) for (let e of [...u]) u.has(e) && e();
|
|
5995
6069
|
});
|
|
5996
|
-
let v = (e) => e.filter(
|
|
6070
|
+
let v = (e) => e.filter(Ps).map((e) => s.of(e.id)), y = (e) => {
|
|
5997
6071
|
let t = s.of(e.id);
|
|
5998
6072
|
return e.wardleyLabel ? {
|
|
5999
6073
|
id: t,
|
|
@@ -6002,13 +6076,13 @@ function zs(e, t) {
|
|
|
6002
6076
|
}, b = (e) => {
|
|
6003
6077
|
if (p) return;
|
|
6004
6078
|
let t = i.get(s.canvasIdOf(e));
|
|
6005
|
-
return
|
|
6079
|
+
return Ps(t) && s.of(t.id) === e ? t : void 0;
|
|
6006
6080
|
}, ee = {
|
|
6007
|
-
list: () => p ? [] : i.getAll().filter(
|
|
6081
|
+
list: () => p ? [] : i.getAll().filter(Ps).map(y),
|
|
6008
6082
|
reveal(e) {
|
|
6009
6083
|
if (p) return !1;
|
|
6010
6084
|
let t = i.get(s.canvasIdOf(e));
|
|
6011
|
-
return
|
|
6085
|
+
return Ps(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
6012
6086
|
},
|
|
6013
6087
|
selection: () => p ? [] : v(a.get()),
|
|
6014
6088
|
onSelection: (e) => h.subscribe((t) => e(v(t))),
|
|
@@ -6028,18 +6102,18 @@ function zs(e, t) {
|
|
|
6028
6102
|
return t ? ne(t) : e.exportDSL();
|
|
6029
6103
|
};
|
|
6030
6104
|
async function te(n) {
|
|
6031
|
-
if (p) throw
|
|
6105
|
+
if (p) throw Ws();
|
|
6032
6106
|
let r = g();
|
|
6033
6107
|
r && await r, d += 1;
|
|
6034
|
-
let i = t && f ?
|
|
6108
|
+
let i = t && f ? As(e) : void 0;
|
|
6035
6109
|
try {
|
|
6036
6110
|
let t = e.importDSL(n), r = p, { warnings: a } = await t;
|
|
6037
6111
|
f = !0;
|
|
6038
6112
|
let o = i !== void 0 && !p;
|
|
6039
|
-
if (o &&
|
|
6113
|
+
if (o && js(e, i), o ? p : r) throw Ws();
|
|
6040
6114
|
return { warnings: a.map((e) => e.message) };
|
|
6041
6115
|
} catch (t) {
|
|
6042
|
-
throw i && !p &&
|
|
6116
|
+
throw i && !p && js(e, i, { importRejected: !0 }), t;
|
|
6043
6117
|
} finally {
|
|
6044
6118
|
--d;
|
|
6045
6119
|
}
|
|
@@ -6048,7 +6122,7 @@ function zs(e, t) {
|
|
|
6048
6122
|
meta: _,
|
|
6049
6123
|
elements: ee,
|
|
6050
6124
|
interaction: l.surface,
|
|
6051
|
-
appearance:
|
|
6125
|
+
appearance: Vs(e.container, () => p),
|
|
6052
6126
|
diagram: e,
|
|
6053
6127
|
attachTo(t) {
|
|
6054
6128
|
e.attachTo(t);
|
|
@@ -6068,13 +6142,13 @@ function zs(e, t) {
|
|
|
6068
6142
|
width: n,
|
|
6069
6143
|
height: i
|
|
6070
6144
|
};
|
|
6071
|
-
return
|
|
6145
|
+
return Ks(a) ? a : void 0;
|
|
6072
6146
|
} catch {
|
|
6073
6147
|
return;
|
|
6074
6148
|
}
|
|
6075
6149
|
},
|
|
6076
6150
|
setViewState(e) {
|
|
6077
|
-
!p &&
|
|
6151
|
+
!p && Ks(e) && r.viewbox({
|
|
6078
6152
|
x: e.x,
|
|
6079
6153
|
y: e.y,
|
|
6080
6154
|
width: e.width,
|
|
@@ -6093,45 +6167,45 @@ function zs(e, t) {
|
|
|
6093
6167
|
},
|
|
6094
6168
|
destroy() {
|
|
6095
6169
|
if (p) return;
|
|
6096
|
-
m =
|
|
6170
|
+
m = Gs(x), p = !0, u.clear(), l.stop();
|
|
6097
6171
|
let t = !1;
|
|
6098
6172
|
n.on("import.done", () => {
|
|
6099
6173
|
t = !0;
|
|
6100
6174
|
});
|
|
6101
6175
|
let r = () => {
|
|
6102
|
-
t && (m =
|
|
6176
|
+
t && (m = Gs(x)), e.destroy();
|
|
6103
6177
|
};
|
|
6104
6178
|
h.delivering() ? queueMicrotask(r) : l.tearDownAfterHandler(r);
|
|
6105
6179
|
}
|
|
6106
6180
|
};
|
|
6107
6181
|
}
|
|
6108
|
-
function
|
|
6182
|
+
function Ws() {
|
|
6109
6183
|
return /* @__PURE__ */ Error("The modeler was destroyed.");
|
|
6110
6184
|
}
|
|
6111
|
-
function
|
|
6185
|
+
function Gs(e) {
|
|
6112
6186
|
try {
|
|
6113
6187
|
return e();
|
|
6114
6188
|
} catch {
|
|
6115
6189
|
return "";
|
|
6116
6190
|
}
|
|
6117
6191
|
}
|
|
6118
|
-
function
|
|
6192
|
+
function Ks(e) {
|
|
6119
6193
|
if (typeof e != "object" || !e) return !1;
|
|
6120
6194
|
let { x: t, y: n, width: r, height: i } = e;
|
|
6121
|
-
return
|
|
6195
|
+
return qs(t) && qs(n) && qs(r) && qs(i) && r > 0 && i > 0;
|
|
6122
6196
|
}
|
|
6123
|
-
function
|
|
6197
|
+
function qs(e) {
|
|
6124
6198
|
return typeof e == "number" && Number.isFinite(e);
|
|
6125
6199
|
}
|
|
6126
6200
|
// src/map-menu/menu.ts
|
|
6127
|
-
var
|
|
6201
|
+
var Q = {
|
|
6128
6202
|
png: "Export as PNG",
|
|
6129
6203
|
svg: "Export as SVG",
|
|
6130
6204
|
transparentPng: "Export as PNG (4×, transparent)",
|
|
6131
6205
|
json: "Export as JSON",
|
|
6132
6206
|
wmap: "Export as .wmap"
|
|
6133
6207
|
};
|
|
6134
|
-
function
|
|
6208
|
+
function Js(e, t, n, r) {
|
|
6135
6209
|
return {
|
|
6136
6210
|
kind: "action",
|
|
6137
6211
|
id: e,
|
|
@@ -6141,11 +6215,11 @@ function Gs(e, t, n, r) {
|
|
|
6141
6215
|
onSelect: () => n.onSelect()
|
|
6142
6216
|
};
|
|
6143
6217
|
}
|
|
6144
|
-
function
|
|
6145
|
-
let t = [
|
|
6146
|
-
return e.transparentPng && t.push(
|
|
6218
|
+
function Ys(e) {
|
|
6219
|
+
let t = [Js("export-png", Q.png, e.png, "file-image"), Js("export-svg", Q.svg, e.svg, "file-code-corner")];
|
|
6220
|
+
return e.transparentPng && t.push(Js("export-png-transparent", Q.transparentPng, e.transparentPng)), e.json && t.push(Js("export-json", Q.json, e.json)), e.wmap && t.push(Js("export-wmap", Q.wmap, e.wmap)), t;
|
|
6147
6221
|
}
|
|
6148
|
-
function
|
|
6222
|
+
function Xs(e) {
|
|
6149
6223
|
let { mapTitle: t, shortcutsKey: n } = e;
|
|
6150
6224
|
return {
|
|
6151
6225
|
model: [
|
|
@@ -6168,7 +6242,7 @@ function qs(e) {
|
|
|
6168
6242
|
onSelect: () => e.axisLabels()
|
|
6169
6243
|
}
|
|
6170
6244
|
],
|
|
6171
|
-
export:
|
|
6245
|
+
export: Ys(e.exports),
|
|
6172
6246
|
help: [{
|
|
6173
6247
|
kind: "dialog",
|
|
6174
6248
|
id: "keyboard-shortcuts",
|
|
@@ -6180,15 +6254,15 @@ function qs(e) {
|
|
|
6180
6254
|
};
|
|
6181
6255
|
}
|
|
6182
6256
|
// src/map-menu/shortcuts.ts
|
|
6183
|
-
var
|
|
6184
|
-
function
|
|
6257
|
+
var Zs = "←↑→↓";
|
|
6258
|
+
function Qs(e) {
|
|
6185
6259
|
try {
|
|
6186
6260
|
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
6187
6261
|
} catch {
|
|
6188
6262
|
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
6189
6263
|
}
|
|
6190
6264
|
}
|
|
6191
|
-
function
|
|
6265
|
+
function $s(e, t) {
|
|
6192
6266
|
if (e === "mac") return {
|
|
6193
6267
|
command: (e) => `⌘${e}`,
|
|
6194
6268
|
shiftCommand: (e) => `⌘⇧${e}`,
|
|
@@ -6217,7 +6291,7 @@ function Xs(e, t) {
|
|
|
6217
6291
|
breakLine: `${r}+Enter`
|
|
6218
6292
|
};
|
|
6219
6293
|
}
|
|
6220
|
-
function
|
|
6294
|
+
function ec(e, t) {
|
|
6221
6295
|
return {
|
|
6222
6296
|
title: "File",
|
|
6223
6297
|
rows: [
|
|
@@ -6226,7 +6300,7 @@ function Zs(e, t) {
|
|
|
6226
6300
|
keys: [t("O")]
|
|
6227
6301
|
},
|
|
6228
6302
|
{
|
|
6229
|
-
action:
|
|
6303
|
+
action: Q.wmap,
|
|
6230
6304
|
keys: [t("S")]
|
|
6231
6305
|
},
|
|
6232
6306
|
{
|
|
@@ -6236,10 +6310,10 @@ function Zs(e, t) {
|
|
|
6236
6310
|
]
|
|
6237
6311
|
};
|
|
6238
6312
|
}
|
|
6239
|
-
function
|
|
6240
|
-
let { platform: n, messages: r } = e, i =
|
|
6313
|
+
function tc(e, t = {}) {
|
|
6314
|
+
let { platform: n, messages: r } = e, i = $s(n, r.keyNames);
|
|
6241
6315
|
return [
|
|
6242
|
-
...t.fileKeys ? [
|
|
6316
|
+
...t.fileKeys ? [ec(e, i.command)] : [],
|
|
6243
6317
|
{
|
|
6244
6318
|
title: "View",
|
|
6245
6319
|
rows: [
|
|
@@ -6252,7 +6326,7 @@ function Qs(e, t = {}) {
|
|
|
6252
6326
|
keys: [i.zoomOut]
|
|
6253
6327
|
},
|
|
6254
6328
|
{
|
|
6255
|
-
action: r.zoomToActual(
|
|
6329
|
+
action: r.zoomToActual(Qs(e.lang)),
|
|
6256
6330
|
keys: [i.zoomToActual]
|
|
6257
6331
|
},
|
|
6258
6332
|
{
|
|
@@ -6306,11 +6380,11 @@ function Qs(e, t = {}) {
|
|
|
6306
6380
|
},
|
|
6307
6381
|
{
|
|
6308
6382
|
action: "Move the selection",
|
|
6309
|
-
keys: [
|
|
6383
|
+
keys: [Zs]
|
|
6310
6384
|
},
|
|
6311
6385
|
{
|
|
6312
6386
|
action: "Move the selection further",
|
|
6313
|
-
keys: [i.shift(
|
|
6387
|
+
keys: [i.shift(Zs)]
|
|
6314
6388
|
},
|
|
6315
6389
|
{
|
|
6316
6390
|
action: "Select all",
|
|
@@ -6407,33 +6481,33 @@ function Qs(e, t = {}) {
|
|
|
6407
6481
|
* Copyright (c) 2026 Lucide Icons and Contributors
|
|
6408
6482
|
* Derived from Feather @license MIT, Copyright (c) 2013-present Cole Bemis
|
|
6409
6483
|
* Full notices: README.md of @miragon/wardley-renderer */
|
|
6410
|
-
var
|
|
6484
|
+
var nc = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
|
|
6411
6485
|
function $(e, t, n) {
|
|
6412
6486
|
let r = document.createElement(e);
|
|
6413
6487
|
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
6414
6488
|
}
|
|
6415
|
-
var
|
|
6416
|
-
function
|
|
6417
|
-
return
|
|
6489
|
+
var rc = 0;
|
|
6490
|
+
function ic(e) {
|
|
6491
|
+
return rc += 1, `${e}-${rc}`;
|
|
6418
6492
|
}
|
|
6419
6493
|
// src/map-menu/dialog.ts
|
|
6420
|
-
function
|
|
6494
|
+
function ac(e, t) {
|
|
6421
6495
|
let n = $("button", "wardley-button", e);
|
|
6422
6496
|
return n.type = "button", n.dataset.variant = t, n;
|
|
6423
6497
|
}
|
|
6424
|
-
function
|
|
6498
|
+
function oc(e, t, n, r) {
|
|
6425
6499
|
let i = $("header", "wardley-dialog-header"), a = $("h3", "wardley-dialog-title", t);
|
|
6426
6500
|
a.id = n;
|
|
6427
6501
|
let o = $("button", "wardley-dialog-close");
|
|
6428
|
-
return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML =
|
|
6502
|
+
return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = nc, o.addEventListener("click", r), i.append(a, o), i;
|
|
6429
6503
|
}
|
|
6430
|
-
function
|
|
6504
|
+
function sc(e, t) {
|
|
6431
6505
|
let n;
|
|
6432
6506
|
function r() {
|
|
6433
|
-
let n =
|
|
6507
|
+
let n = ic(`${t.className}-title`), r = $("dialog", `wardley-dialog ${t.className}`);
|
|
6434
6508
|
r.setAttribute("aria-labelledby", n);
|
|
6435
6509
|
let i = () => r.close(), a = $("div", "wardley-dialog-panel");
|
|
6436
|
-
a.append(
|
|
6510
|
+
a.append(oc(e, t.title, n, i), ...t.content(i)), r.append(a);
|
|
6437
6511
|
let o = !1;
|
|
6438
6512
|
return r.addEventListener("pointerdown", (e) => {
|
|
6439
6513
|
o = e.target === r;
|
|
@@ -6457,19 +6531,19 @@ function ic(e, t) {
|
|
|
6457
6531
|
};
|
|
6458
6532
|
}
|
|
6459
6533
|
// src/map-menu/TitleDialog.ts
|
|
6460
|
-
function
|
|
6534
|
+
function cc(e) {
|
|
6461
6535
|
return e.exportMap().config.title ?? i;
|
|
6462
6536
|
}
|
|
6463
|
-
function
|
|
6537
|
+
function lc(e, t) {
|
|
6464
6538
|
let n = $("input", "wardley-field-input");
|
|
6465
|
-
n.id =
|
|
6466
|
-
(e.key === "Enter" || e.key === "Escape") &&
|
|
6539
|
+
n.id = ic("wardley-title-field"), n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.maxLength = 120, n.autofocus = !0, n.addEventListener("keydown", (e) => {
|
|
6540
|
+
(e.key === "Enter" || e.key === "Escape") && za(e) && e.preventDefault();
|
|
6467
6541
|
});
|
|
6468
|
-
let r =
|
|
6542
|
+
let r = sc(e, {
|
|
6469
6543
|
className: "wardley-title-dialog",
|
|
6470
6544
|
title: "Map title",
|
|
6471
6545
|
beforeOpen() {
|
|
6472
|
-
n.value =
|
|
6546
|
+
n.value = cc(t);
|
|
6473
6547
|
},
|
|
6474
6548
|
afterOpen() {
|
|
6475
6549
|
n.select();
|
|
@@ -6479,29 +6553,29 @@ function oc(e, t) {
|
|
|
6479
6553
|
r.noValidate = !0;
|
|
6480
6554
|
let a = $("div", "wardley-dialog-body"), o = $("div", "wardley-field"), s = $("label", "wardley-field-label", "Title");
|
|
6481
6555
|
s.htmlFor = n.id, o.append(s, n), a.append(o);
|
|
6482
|
-
let c = $("div", "wardley-dialog-footer"), l =
|
|
6556
|
+
let c = $("div", "wardley-dialog-footer"), l = ac("Cancel", "secondary");
|
|
6483
6557
|
l.addEventListener("click", e);
|
|
6484
|
-
let u =
|
|
6558
|
+
let u = ac("Apply", "primary");
|
|
6485
6559
|
return u.type = "submit", c.append(l, u), r.append(a, c), r.addEventListener("submit", (r) => {
|
|
6486
6560
|
r.preventDefault();
|
|
6487
6561
|
let a = n.value.replace(/\s+/g, " ").trim() || i;
|
|
6488
|
-
e(), a !==
|
|
6562
|
+
e(), a !== cc(t) && t.setTitle(a);
|
|
6489
6563
|
}), [r];
|
|
6490
6564
|
}
|
|
6491
6565
|
}), a = (e) => {
|
|
6492
6566
|
e.readOnly && r.close();
|
|
6493
6567
|
};
|
|
6494
|
-
return t.on(
|
|
6568
|
+
return t.on(gt, a), {
|
|
6495
6569
|
open: () => r.open(),
|
|
6496
6570
|
isOpen: () => r.isOpen(),
|
|
6497
6571
|
close: () => r.close(),
|
|
6498
6572
|
destroy() {
|
|
6499
|
-
t.off(
|
|
6573
|
+
t.off(gt, a), r.destroy();
|
|
6500
6574
|
}
|
|
6501
6575
|
};
|
|
6502
6576
|
}
|
|
6503
6577
|
// src/map-menu/popover.ts
|
|
6504
|
-
function
|
|
6578
|
+
function uc() {
|
|
6505
6579
|
let e = (e) => {
|
|
6506
6580
|
e.key === "Escape" && (e.stopPropagation(), n());
|
|
6507
6581
|
}, t = (e) => {
|
|
@@ -6512,14 +6586,14 @@ function sc() {
|
|
|
6512
6586
|
}
|
|
6513
6587
|
document.addEventListener("keyup", e, !0), document.addEventListener("keydown", t, !0);
|
|
6514
6588
|
}
|
|
6515
|
-
function
|
|
6589
|
+
function dc(e, t) {
|
|
6516
6590
|
let n, r = (e) => {
|
|
6517
6591
|
n && !n.contains(e.target) && s("done");
|
|
6518
6592
|
}, i = () => s("done"), a = (e) => {
|
|
6519
|
-
e.key !== "Escape" ||
|
|
6593
|
+
e.key !== "Escape" || za(e) || z(e) || (e.preventDefault(), e.stopPropagation(), s("done", { returnFocus: !0 }), uc());
|
|
6520
6594
|
};
|
|
6521
6595
|
function o() {
|
|
6522
|
-
let n =
|
|
6596
|
+
let n = ic(`${t.className}-title`), r = $("div", `wardley-popover ${t.className}`);
|
|
6523
6597
|
r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", n), r.hidden = !0;
|
|
6524
6598
|
let i = $("h2", "wardley-popover-title", t.title);
|
|
6525
6599
|
i.id = n;
|
|
@@ -6544,8 +6618,8 @@ function cc(e, t) {
|
|
|
6544
6618
|
}
|
|
6545
6619
|
};
|
|
6546
6620
|
}
|
|
6547
|
-
function
|
|
6548
|
-
let n = $("div", "wardley-field"), r =
|
|
6621
|
+
function fc(e, t) {
|
|
6622
|
+
let n = $("div", "wardley-field"), r = ic("wardley-field"), i = $("label", "wardley-field-label", e);
|
|
6549
6623
|
i.htmlFor = r, t.id = r, t.classList.add("wardley-field-input"), n.append(i, t);
|
|
6550
6624
|
let a;
|
|
6551
6625
|
return {
|
|
@@ -6558,35 +6632,35 @@ function lc(e, t) {
|
|
|
6558
6632
|
}
|
|
6559
6633
|
};
|
|
6560
6634
|
}
|
|
6561
|
-
function
|
|
6635
|
+
function pc(e, t) {
|
|
6562
6636
|
let n = () => t.end("import"), r = (e) => {
|
|
6563
6637
|
e.readOnly && t.end("cancel");
|
|
6564
6638
|
};
|
|
6565
|
-
return e.on("import.done", n), e.on(
|
|
6639
|
+
return e.on("import.done", n), e.on(gt, r), {
|
|
6566
6640
|
open: () => t.open(),
|
|
6567
6641
|
isOpen: () => t.isOpen(),
|
|
6568
6642
|
close: () => t.close(),
|
|
6569
6643
|
destroy() {
|
|
6570
|
-
e.off("import.done", n), e.off(
|
|
6644
|
+
e.off("import.done", n), e.off(gt, r), t.destroy();
|
|
6571
6645
|
}
|
|
6572
6646
|
};
|
|
6573
6647
|
}
|
|
6574
6648
|
// src/map-menu/MapSizePopover.ts
|
|
6575
|
-
var
|
|
6576
|
-
function
|
|
6649
|
+
var mc = "custom";
|
|
6650
|
+
function hc(e, t) {
|
|
6577
6651
|
let n = $("input", "");
|
|
6578
6652
|
return n.type = "number", n.inputMode = "numeric", n.min = String(e), n.max = String(t), n.step = "10", n;
|
|
6579
6653
|
}
|
|
6580
|
-
function
|
|
6654
|
+
function gc(e, t) {
|
|
6581
6655
|
let n = $("select", "");
|
|
6582
6656
|
for (let e of l) {
|
|
6583
6657
|
let t = $("option", "", `${e.name} (${e.width} × ${e.height})`);
|
|
6584
6658
|
t.value = e.id, n.append(t);
|
|
6585
6659
|
}
|
|
6586
6660
|
let r = $("option", "", "Custom");
|
|
6587
|
-
r.value =
|
|
6588
|
-
let i =
|
|
6589
|
-
n.value = e.presetId ??
|
|
6661
|
+
r.value = mc, n.append(r);
|
|
6662
|
+
let i = hc(p.width, d.width), a = hc(p.height, d.height), o = ac("Reset to default", "ghost"), s = fc("Size", n), c = fc("Width", i), u = fc("Height", a), f, m, h = (e) => {
|
|
6663
|
+
n.value = e.presetId ?? mc, i.value = String(e.width), a.value = String(e.height), o.disabled = !e.isExplicit, c.clearError(), u.clearError();
|
|
6590
6664
|
}, g = (e) => {
|
|
6591
6665
|
m = { size: e }, (e ? t.setMapSize(e.width, e.height, { transient: !0 }) : t.resetMapSize({ transient: !0 })).then(() => h(t.getMapSize()));
|
|
6592
6666
|
}, _ = (e, n) => {
|
|
@@ -6603,7 +6677,7 @@ function pc(e, t) {
|
|
|
6603
6677
|
[n]: i
|
|
6604
6678
|
});
|
|
6605
6679
|
};
|
|
6606
|
-
return
|
|
6680
|
+
return pc(t, dc(e, {
|
|
6607
6681
|
className: "wardley-map-size",
|
|
6608
6682
|
title: "Map size",
|
|
6609
6683
|
build(e, t, r) {
|
|
@@ -6611,9 +6685,9 @@ function pc(e, t) {
|
|
|
6611
6685
|
f.setAttribute("aria-hidden", "true"), d.append(c.wrapper, f, u.wrapper);
|
|
6612
6686
|
let p = $("p", "wardley-popover-hint", "Or drag the plot’s right or bottom edge.");
|
|
6613
6687
|
e.append(s.wrapper, d, p);
|
|
6614
|
-
let m =
|
|
6688
|
+
let m = ac("Done", "secondary");
|
|
6615
6689
|
m.addEventListener("click", (e) => {
|
|
6616
|
-
|
|
6690
|
+
z(e) || r();
|
|
6617
6691
|
}), t.append(o, m), n.addEventListener("change", () => {
|
|
6618
6692
|
let e = l.find((e) => e.id === n.value);
|
|
6619
6693
|
e ? g({
|
|
@@ -6621,7 +6695,7 @@ function pc(e, t) {
|
|
|
6621
6695
|
height: e.height
|
|
6622
6696
|
}) : i.focus();
|
|
6623
6697
|
}), i.addEventListener("change", () => _(i, "width")), a.addEventListener("change", () => _(a, "height")), o.addEventListener("click", (e) => {
|
|
6624
|
-
|
|
6698
|
+
z(e) || (n.focus(), g(void 0));
|
|
6625
6699
|
});
|
|
6626
6700
|
},
|
|
6627
6701
|
opened() {
|
|
@@ -6630,30 +6704,30 @@ function pc(e, t) {
|
|
|
6630
6704
|
closed(e) {
|
|
6631
6705
|
let n = m;
|
|
6632
6706
|
if (m = void 0, !n || e === "import") return;
|
|
6633
|
-
let r = e === "done" ? n.size :
|
|
6707
|
+
let r = e === "done" ? n.size : _c(f);
|
|
6634
6708
|
r ? t.setMapSize(r.width, r.height) : t.resetMapSize();
|
|
6635
6709
|
}
|
|
6636
6710
|
}));
|
|
6637
6711
|
}
|
|
6638
|
-
function
|
|
6712
|
+
function _c(e) {
|
|
6639
6713
|
return e?.isExplicit ? {
|
|
6640
6714
|
width: e.width,
|
|
6641
6715
|
height: e.height
|
|
6642
6716
|
} : void 0;
|
|
6643
6717
|
}
|
|
6644
6718
|
// src/map-menu/AxisLabelsPopover.ts
|
|
6645
|
-
var
|
|
6646
|
-
function
|
|
6647
|
-
return s.find((t) => t.labels.every((t, n) => t === e[n]))?.id ??
|
|
6719
|
+
var vc = "custom";
|
|
6720
|
+
function yc(e) {
|
|
6721
|
+
return s.find((t) => t.labels.every((t, n) => t === e[n]))?.id ?? vc;
|
|
6648
6722
|
}
|
|
6649
|
-
function
|
|
6723
|
+
function bc(e, t) {
|
|
6650
6724
|
let n = $("select", "");
|
|
6651
6725
|
for (let e of s) {
|
|
6652
6726
|
let t = $("option", "", e.name);
|
|
6653
6727
|
t.value = e.id, t.title = e.labels.join(" · "), n.append(t);
|
|
6654
6728
|
}
|
|
6655
6729
|
let i = $("option", "", "Custom");
|
|
6656
|
-
i.value =
|
|
6730
|
+
i.value = vc, n.append(i);
|
|
6657
6731
|
let a = [
|
|
6658
6732
|
1,
|
|
6659
6733
|
2,
|
|
@@ -6663,30 +6737,30 @@ function _c(e, t) {
|
|
|
6663
6737
|
let e = $("input", "");
|
|
6664
6738
|
return e.type = "text", e.autocomplete = "off", e.spellcheck = !1, e;
|
|
6665
6739
|
}), o = r, c = !1, l = (e) => {
|
|
6666
|
-
a.forEach((t, n) => t.value = e[n] ?? ""), n.value =
|
|
6740
|
+
a.forEach((t, n) => t.value = e[n] ?? ""), n.value = yc(e);
|
|
6667
6741
|
}, u = () => g(a.map((e) => e.value)), d = () => {
|
|
6668
6742
|
c = !0;
|
|
6669
6743
|
let e = u();
|
|
6670
|
-
t.setEvolutionLabels(e, { transient: !0 }), n.value =
|
|
6744
|
+
t.setEvolutionLabels(e, { transient: !0 }), n.value = yc(e ?? r);
|
|
6671
6745
|
};
|
|
6672
|
-
return
|
|
6746
|
+
return pc(t, dc(e, {
|
|
6673
6747
|
className: "wardley-axis-labels",
|
|
6674
6748
|
title: "X-axis labels",
|
|
6675
6749
|
build(e, t, i) {
|
|
6676
6750
|
let o = $("p", "wardley-popover-hint"), c = $("a", "wardley-popover-link", "Learn Wardley Mapping");
|
|
6677
|
-
c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", o.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(
|
|
6678
|
-
let u =
|
|
6751
|
+
c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", o.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(fc("Preset", n).wrapper, o), a.forEach((t, n) => e.append(fc(`Stage ${n + 1}`, t).wrapper));
|
|
6752
|
+
let u = ac("Reset to default", "ghost"), f = ac("Done", "secondary");
|
|
6679
6753
|
t.append(u, f), n.addEventListener("change", () => {
|
|
6680
6754
|
let e = s.find((e) => e.id === n.value);
|
|
6681
6755
|
e && (l(e.labels), d());
|
|
6682
6756
|
});
|
|
6683
6757
|
for (let e of a) e.addEventListener("input", d), e.addEventListener("keydown", (e) => {
|
|
6684
|
-
e.key !== "Enter" ||
|
|
6758
|
+
e.key !== "Enter" || za(e) || z(e) || (e.preventDefault(), i());
|
|
6685
6759
|
});
|
|
6686
6760
|
u.addEventListener("click", (e) => {
|
|
6687
|
-
|
|
6761
|
+
z(e) || (l(r), d());
|
|
6688
6762
|
}), f.addEventListener("click", (e) => {
|
|
6689
|
-
|
|
6763
|
+
z(e) || i();
|
|
6690
6764
|
});
|
|
6691
6765
|
},
|
|
6692
6766
|
opened() {
|
|
@@ -6697,6 +6771,6 @@ function _c(e, t) {
|
|
|
6697
6771
|
}
|
|
6698
6772
|
}));
|
|
6699
6773
|
}
|
|
6700
|
-
export { j as COLORS,
|
|
6774
|
+
export { j as COLORS, Q as EXPORT_LABELS, On as EvolutionGrid, Oi as FreeRect, rn as INTERACTION_CHANGED, c as MAP_SIZE_PRESETS, O as MIRAGON, ft as MapProjection, Zt as MapResizeHandles, Es as Modeler, Re as NOTE_COLORS, Ai as NavigatedViewer, k as PLOT, u as PLOT_MAX, f as PLOT_MIN, Co as POPUP_PROVIDER_ID, Ei as PanConstraint, Di as PanConstraintModule, $n as PipelineGroupBehavior, gt as READ_ONLY_CHANGED, br as RESIZE_MAP, qe as ROOT_ID, Qt as ResizeAwareAutoScroll, xr as UPDATE_CONFIG, gi as Viewer, Ms as WARDLEY_NOTATION, e as WARDLEY_THEMES, $o as WardleyAppendBehavior, hn as WardleyBaseViewer, ns as WardleyColorPicker, us as WardleyDrawTool, xn as WardleyElementFactory, Oo as WardleyElementSettingsProvider, Ln as WardleyEvolveDragging, it as WardleyExporter, $e as WardleyImporter, sn as WardleyInteraction, xs as WardleyLabelDragging, ro as WardleyLabelEditing, Ni as WardleyLassoBehavior, gn as WardleyLayouter, xo as WardleyLinkEditing, Cr as WardleyModeling, as as WardleyOrderingProvider, bt as WardleyReadOnly, oi as WardleyRenderer, zi as WardleyRules, at as WardleySourceOrder, st as blobToBase64, yo as canHaveLink, Ft as canvasAccessibilityModule, bc as createAxisLabelsPopover, Fs as createCollaborativeModeler, Is as createCollaborativeViewer, sc as createMapDialog, gc as createMapSizePopover, lc as createTitleDialog, ac as dialogButton, Pr as evolutionConstraintModule, Nr as evolutionGridModule, We as exportBounds, ki as freeRectModule, ct as ioModule, F as isComponent, I as isPipeline, P as isWardleyConnection, N as isWardleyShape, so as labelEditingModule, So as linkEditingModule, bo as linkOf, Xs as mapMenu, en as mapResizeModule, tc as mapShortcuts, _ as normalizeMapSize, er as pipelineGroupModule, ee as presetIdForSize, xt as readOnlyModule, js as restoreEditorState, Ve as saveSVG, As as setAsideEditorState, Vi as stageSnappingModule, es as wardleyAppendModule, rs as wardleyColorPickerModule, Lo as wardleyContextPadModule, hi as wardleyDrawModule, gs as wardleyDrawToolModule, Rn as wardleyEvolveModule, cn as wardleyInteractionModule, Xo as wardleyKeyboardModule, ws as wardleyLabelDragModule, Pi as wardleyLassoModule, _n as wardleyLayoutModule, Sn as wardleyModelModule, Mr as wardleyModelingModule, os as wardleyOrderingModule, Na as wardleyPaletteModule, ko as wardleyPopupModule, Bi as wardleyRulesModule };
|
|
6701
6775
|
|
|
6702
6776
|
//# sourceMappingURL=index.js.map
|