@miragon/wardley-renderer 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -16
- package/dist/color-picker/WardleyColorPicker.d.ts.map +1 -1
- package/dist/context-pad/WardleyContextPadProvider.d.ts +7 -0
- package/dist/context-pad/WardleyContextPadProvider.d.ts.map +1 -1
- package/dist/draw/icons.d.ts +6 -41
- package/dist/draw/icons.d.ts.map +1 -1
- package/dist/draw/label-layout.d.ts +2 -2
- package/dist/draw/lucide.d.ts +30 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/draw/styles.d.ts +1 -1
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/draw-tool/WardleyDrawTool.d.ts +7 -0
- package/dist/draw-tool/WardleyDrawTool.d.ts.map +1 -1
- package/dist/draw-tool/WardleyDrawingHandles.d.ts.map +1 -1
- package/dist/editor-state.d.ts +4 -3
- package/dist/editor-state.d.ts.map +1 -1
- package/dist/index.js +916 -943
- package/dist/index.js.map +1 -1
- package/dist/io/WardleySourceOrder.d.ts +1 -1
- package/dist/keyboard/WardleyKeyboard.d.ts +2 -11
- package/dist/keyboard/WardleyKeyboard.d.ts.map +1 -1
- package/dist/keyboard/index.d.ts +1 -1
- package/dist/keyboard/index.d.ts.map +1 -1
- package/dist/label-drag/WardleyLabelDragging.d.ts +1 -1
- package/dist/label-editing/WardleyLabelEditing.d.ts +6 -1
- package/dist/label-editing/WardleyLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/index.d.ts +1 -0
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/link-editing/WardleyLinkEditing.d.ts +7 -1
- package/dist/link-editing/WardleyLinkEditing.d.ts.map +1 -1
- package/dist/live-preview/LivePreview.d.ts +1 -1
- package/dist/map-menu/ShortcutsDialog.d.ts +1 -1
- package/dist/map-menu/dialog.d.ts +1 -1
- package/dist/map-menu/menu.d.ts +3 -3
- package/dist/map-menu/popover.d.ts +1 -1
- package/dist/map-menu/shortcuts.d.ts +1 -1
- package/dist/map-resize/MapResizeHandles.d.ts +1 -1
- package/dist/map-resize/MapResizeHandles.d.ts.map +1 -1
- package/dist/map-resize/ResizeAwareAutoScroll.d.ts +1 -1
- package/dist/model/WardleyElementFactory.d.ts +2 -2
- package/dist/model/di-types.d.ts +2 -2
- package/dist/modeling/WardleyModeling.d.ts +1 -1
- package/dist/modeling/cmd/UpdateConfigHandler.d.ts +1 -1
- package/dist/palette/WardleyPaletteProvider.d.ts +6 -0
- package/dist/palette/WardleyPaletteProvider.d.ts.map +1 -1
- package/dist/popup/WardleyElementSettingsProvider.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +5 -1
- package/dist/theme/palette.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import je from "diagram-js/lib/features/context-pad/ContextPad";
|
|
|
30
30
|
import Me from "diagram-js/lib/features/connection-preview";
|
|
31
31
|
import Ne from "diagram-js/lib/features/ordering/OrderingProvider";
|
|
32
32
|
import { MODELER_API_VERSION as Pe } from "@miragon/modeler-api";
|
|
33
|
-
|
|
33
|
+
// src/theme/palette.ts
|
|
34
34
|
var E = {
|
|
35
35
|
blau: "#335DE5",
|
|
36
36
|
blauLink: "#2B50D4",
|
|
@@ -88,7 +88,7 @@ var O = {
|
|
|
88
88
|
inertia: E.schwarz,
|
|
89
89
|
noteText: E.textLeise,
|
|
90
90
|
pipeline: E.schwarz,
|
|
91
|
-
annotationFill:
|
|
91
|
+
annotationFill: E.weiss,
|
|
92
92
|
plotBackground: E.weiss,
|
|
93
93
|
accelerator: O.success,
|
|
94
94
|
deaccelerator: O.danger
|
|
@@ -156,8 +156,7 @@ var O = {
|
|
|
156
156
|
axis: 12,
|
|
157
157
|
stage: 12
|
|
158
158
|
};
|
|
159
|
-
|
|
160
|
-
//#region src/io/saveSvg.ts
|
|
159
|
+
// src/io/saveSvg.ts
|
|
161
160
|
function Be(e, t) {
|
|
162
161
|
let n = e.getContainer().querySelector(":scope > svg");
|
|
163
162
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
@@ -181,8 +180,7 @@ function Be(e, t) {
|
|
|
181
180
|
let a = r.querySelector(".viewport");
|
|
182
181
|
return a && a.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
|
|
183
182
|
}
|
|
184
|
-
|
|
185
|
-
//#region src/io/exportBounds.ts
|
|
183
|
+
// src/io/exportBounds.ts
|
|
186
184
|
var Ve = "wardley-axes", He = 4;
|
|
187
185
|
function Ue(e, t, n = 12) {
|
|
188
186
|
let r = [t.outerBounds()], i = Ge(e);
|
|
@@ -257,8 +255,7 @@ function Ge(e) {
|
|
|
257
255
|
return;
|
|
258
256
|
}
|
|
259
257
|
}
|
|
260
|
-
|
|
261
|
-
//#region src/io/types.ts
|
|
258
|
+
// src/io/types.ts
|
|
262
259
|
var Ke = "wardley-root", qe = {
|
|
263
260
|
top: 0,
|
|
264
261
|
right: 0,
|
|
@@ -285,8 +282,7 @@ function Ye(e, t, n) {
|
|
|
285
282
|
extent: e
|
|
286
283
|
};
|
|
287
284
|
}
|
|
288
|
-
|
|
289
|
-
//#region src/io/WardleyImporter.ts
|
|
285
|
+
// src/io/WardleyImporter.ts
|
|
290
286
|
var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
291
287
|
attitude: 0,
|
|
292
288
|
pipeline: 1,
|
|
@@ -381,8 +377,7 @@ var Xe = /* @__PURE__ */ new Set(["attitude", "pipeline"]), Ze = {
|
|
|
381
377
|
}
|
|
382
378
|
}
|
|
383
379
|
};
|
|
384
|
-
|
|
385
|
-
//#region src/model/di-types.ts
|
|
380
|
+
// src/model/di-types.ts
|
|
386
381
|
function $e(e) {
|
|
387
382
|
return typeof e == "object" && !!e;
|
|
388
383
|
}
|
|
@@ -402,8 +397,7 @@ function P(e) {
|
|
|
402
397
|
function tt(e) {
|
|
403
398
|
return j(e) && e.wardleyType === "attitude";
|
|
404
399
|
}
|
|
405
|
-
|
|
406
|
-
//#region src/io/WardleyExporter.ts
|
|
400
|
+
// src/io/WardleyExporter.ts
|
|
407
401
|
function nt(e) {
|
|
408
402
|
let t = {};
|
|
409
403
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
@@ -604,8 +598,7 @@ function at(e, t) {
|
|
|
604
598
|
return r === i ? 0 : r < i ? -1 : 1;
|
|
605
599
|
});
|
|
606
600
|
}
|
|
607
|
-
|
|
608
|
-
//#region src/io/rasterize.ts
|
|
601
|
+
// src/io/rasterize.ts
|
|
609
602
|
var ot = {
|
|
610
603
|
width: 1e3,
|
|
611
604
|
height: 700
|
|
@@ -663,16 +656,14 @@ function pt(e) {
|
|
|
663
656
|
let t = /^\s*(\d+(?:\.\d+)?)\s*(?:px)?\s*$/.exec(e ?? ""), n = t ? Number(t[1]) : NaN;
|
|
664
657
|
return n > 0 ? n : void 0;
|
|
665
658
|
}
|
|
666
|
-
|
|
667
|
-
//#region src/io/index.ts
|
|
659
|
+
// src/io/index.ts
|
|
668
660
|
var mt = {
|
|
669
661
|
__init__: ["wardleySourceOrder"],
|
|
670
662
|
wardleySourceOrder: ["type", it],
|
|
671
663
|
wardleyImporter: ["type", Qe],
|
|
672
664
|
wardleyExporter: ["type", rt]
|
|
673
665
|
};
|
|
674
|
-
|
|
675
|
-
//#region src/map-resize/MapProjection.ts
|
|
666
|
+
// src/map-resize/MapProjection.ts
|
|
676
667
|
function ht(e, t) {
|
|
677
668
|
let { size: n, ...r } = e;
|
|
678
669
|
return t ? {
|
|
@@ -791,8 +782,7 @@ var vt = class {
|
|
|
791
782
|
function yt(e, t) {
|
|
792
783
|
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 })));
|
|
793
784
|
}
|
|
794
|
-
|
|
795
|
-
//#region src/live-preview/LivePreview.ts
|
|
785
|
+
// src/live-preview/LivePreview.ts
|
|
796
786
|
var bt = [
|
|
797
787
|
"commandStack.preExecute",
|
|
798
788
|
"commandStack.execute",
|
|
@@ -827,7 +817,7 @@ var bt = [
|
|
|
827
817
|
config: t
|
|
828
818
|
};
|
|
829
819
|
}
|
|
830
|
-
}] },
|
|
820
|
+
}] }, F = "wardley.readOnly.changed", Ct = "wardley-read-only", wt = 5e3, Tt = [
|
|
831
821
|
"elements.move",
|
|
832
822
|
"shape.move",
|
|
833
823
|
"shape.create",
|
|
@@ -842,7 +832,7 @@ var bt = [
|
|
|
842
832
|
"connection.reconnectEnd",
|
|
843
833
|
"connection.updateWaypoints",
|
|
844
834
|
"elements.delete"
|
|
845
|
-
],
|
|
835
|
+
], Et = class extends ce {
|
|
846
836
|
canvas;
|
|
847
837
|
injector;
|
|
848
838
|
static $inject = [
|
|
@@ -855,13 +845,13 @@ var bt = [
|
|
|
855
845
|
super(e), this.canvas = t, this.injector = n;
|
|
856
846
|
}
|
|
857
847
|
init() {
|
|
858
|
-
this.addRule(
|
|
848
|
+
this.addRule(Tt, wt, () => !this.locked && void 0);
|
|
859
849
|
}
|
|
860
850
|
isReadOnly() {
|
|
861
851
|
return this.locked;
|
|
862
852
|
}
|
|
863
853
|
setReadOnly(e) {
|
|
864
|
-
this.locked !== e && (this.locked = e, this.outerContainer().classList.toggle(
|
|
854
|
+
this.locked !== e && (this.locked = e, this.outerContainer().classList.toggle(Ct, e), e && this.endInteractions(), this.injector.get("eventBus").fire(F, { readOnly: e }));
|
|
865
855
|
}
|
|
866
856
|
endInteractions() {
|
|
867
857
|
this.injector.get("dragging", !1)?.cancel();
|
|
@@ -880,52 +870,77 @@ var bt = [
|
|
|
880
870
|
let e = this.canvas.getContainer();
|
|
881
871
|
return e.closest(".wardley-container") ?? e;
|
|
882
872
|
}
|
|
883
|
-
},
|
|
873
|
+
}, Dt = {
|
|
884
874
|
__init__: ["wardleyReadOnly"],
|
|
885
|
-
wardleyReadOnly: ["type",
|
|
875
|
+
wardleyReadOnly: ["type", Et]
|
|
886
876
|
};
|
|
887
|
-
function
|
|
877
|
+
function I(e) {
|
|
888
878
|
return e.get("wardleyReadOnly", !1)?.isReadOnly() === !0;
|
|
889
879
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
880
|
+
// src/a11y/canvasFocus.ts
|
|
881
|
+
function Ot(e) {
|
|
882
|
+
return e._svg ?? e.getContainer().querySelector(":scope > svg");
|
|
883
|
+
}
|
|
884
|
+
function L(e) {
|
|
885
|
+
let t = Ot(e);
|
|
886
|
+
t ? t.focus({
|
|
887
|
+
preventScroll: !0,
|
|
888
|
+
focusVisible: !1
|
|
889
|
+
}) : e.focus();
|
|
890
|
+
}
|
|
891
|
+
var kt = "pointer", At = !1;
|
|
892
|
+
function jt() {
|
|
893
|
+
At || typeof document > "u" || (At = !0, document.addEventListener("pointerdown", () => kt = "pointer", !0), document.addEventListener("mousedown", () => kt = "pointer", !0), document.addEventListener("keydown", (e) => {
|
|
894
|
+
e.target instanceof HTMLElement && e.target.closest("input, textarea") || (kt = "keyboard");
|
|
895
|
+
}, !0));
|
|
896
|
+
}
|
|
897
|
+
function Mt() {
|
|
898
|
+
return kt === "pointer";
|
|
899
|
+
}
|
|
900
|
+
// src/a11y/describeCanvas.ts
|
|
901
|
+
function Nt(e) {
|
|
902
|
+
let t = Ot(e);
|
|
903
|
+
t && (t.setAttribute("role", "application"), t.setAttribute("aria-roledescription", "Wardley map"), t.setAttribute("aria-label", "Map canvas"));
|
|
904
|
+
}
|
|
905
|
+
Nt.$inject = ["canvas"];
|
|
906
|
+
// src/a11y/index.ts
|
|
907
|
+
var Pt = { __init__: [Nt] }, Ft = "wardley.mapResize", It = "wardley-map-resize", Lt = -.5, Rt = 10, zt = 12, Bt = 8, Vt = 16, Ht = 10, Ut = 16, Wt = {
|
|
893
908
|
x: "ew-resize",
|
|
894
909
|
y: "ns-resize",
|
|
895
910
|
xy: "nwse-resize"
|
|
896
911
|
};
|
|
897
|
-
function
|
|
912
|
+
function Gt(e, t) {
|
|
898
913
|
return Math.round(e / t) * t;
|
|
899
914
|
}
|
|
900
|
-
function
|
|
915
|
+
function Kt(e, t, n) {
|
|
901
916
|
return e < t ? t : e > n ? n : e;
|
|
902
917
|
}
|
|
903
|
-
function
|
|
918
|
+
function qt(e) {
|
|
904
919
|
return e.setAttribute("fill", "none"), e.setAttribute("stroke", "none"), e.setAttribute("opacity", "0"), e;
|
|
905
920
|
}
|
|
906
|
-
function
|
|
921
|
+
function Jt(e, t, n, r, i = {
|
|
907
922
|
keepAspectRatio: !1,
|
|
908
923
|
disableSnapping: !1
|
|
909
924
|
}) {
|
|
910
|
-
let a = t === "y" ? e.width : e.width + n, o = t === "x" ? e.height : e.height + r, s = i.disableSnapping ? 1 :
|
|
925
|
+
let a = t === "y" ? e.width : e.width + n, o = t === "x" ? e.height : e.height + r, s = i.disableSnapping ? 1 : Rt;
|
|
911
926
|
if (i.keepAspectRatio) {
|
|
912
927
|
let n = e.width / e.height;
|
|
913
|
-
return t === "x" || t === "xy" && Math.abs(a - e.width) / e.width >= Math.abs(o - e.height) / e.height ? (a =
|
|
928
|
+
return t === "x" || t === "xy" && Math.abs(a - e.width) / e.width >= Math.abs(o - e.height) / e.height ? (a = Kt(Gt(a, s), f.width, u.width), o = a / n) : (o = Kt(Gt(o, s), f.height, u.height), a = o * n), _(a, o);
|
|
914
929
|
}
|
|
915
930
|
if (!i.disableSnapping) {
|
|
916
|
-
let e = c.find((e) => Math.abs(a - e.width) <=
|
|
931
|
+
let e = c.find((e) => Math.abs(a - e.width) <= zt && Math.abs(o - e.height) <= zt);
|
|
917
932
|
if (e) return {
|
|
918
933
|
width: e.width,
|
|
919
934
|
height: e.height
|
|
920
935
|
};
|
|
921
936
|
}
|
|
922
|
-
return _(t === "y" ? a :
|
|
937
|
+
return _(t === "y" ? a : Gt(a, s), t === "x" ? o : Gt(o, s));
|
|
923
938
|
}
|
|
924
|
-
function
|
|
939
|
+
function Yt(e) {
|
|
925
940
|
let t = c.find((t) => t.width === e.width && t.height === e.height);
|
|
926
941
|
return `${e.width} × ${e.height}${t ? ` · ${t.name}` : ""}`;
|
|
927
942
|
}
|
|
928
|
-
var
|
|
943
|
+
var Xt = class {
|
|
929
944
|
canvas;
|
|
930
945
|
grid;
|
|
931
946
|
dragging;
|
|
@@ -946,16 +961,16 @@ var Wt = class {
|
|
|
946
961
|
badge;
|
|
947
962
|
scale;
|
|
948
963
|
constructor(e, t, n, r, i, a, o) {
|
|
949
|
-
this.canvas = t, this.grid = n, this.dragging = r, this.projection = i, this.modeling = a, this.injector = o, this.layer = T("g", { class: "wardley-map-resize" }), C(t.getLayer(
|
|
964
|
+
this.canvas = t, this.grid = n, this.dragging = r, this.projection = i, this.modeling = a, this.injector = o, this.layer = T("g", { class: "wardley-map-resize" }), C(t.getLayer(It, Lt), this.layer), this.handles = {
|
|
950
965
|
x: this.createHandle("x"),
|
|
951
966
|
y: this.createHandle("y"),
|
|
952
967
|
xy: this.createHandle("xy")
|
|
953
968
|
}, this.handles.xy.group.addEventListener("dblclick", (e) => {
|
|
954
|
-
e.stopPropagation(), e.preventDefault(), !
|
|
969
|
+
e.stopPropagation(), e.preventDefault(), !I(this.injector) && this.modeling.resizeMap(void 0);
|
|
955
970
|
}), e.on(["import.done", "wardley.config.changed"], () => this.render()), e.on("canvas.viewbox.changed", (e) => {
|
|
956
971
|
let t = e.viewbox?.scale;
|
|
957
972
|
t !== this.scale && (this.scale = t, this.render());
|
|
958
|
-
}), e.on(`${
|
|
973
|
+
}), e.on(`${Ft}.start`, (e) => this.onStart(e)), e.on(`${Ft}.move`, (e) => this.onMove(e)), e.on(`${Ft}.end`, (e) => this.onEnd(e)), e.on(`${Ft}.cleanup`, (e) => this.onCleanup(e)), e.on(bt, xt, () => this.cancelPreviewingDrag()), this.render();
|
|
959
974
|
}
|
|
960
975
|
cancelPreviewingDrag() {
|
|
961
976
|
let e = this.dragging.context();
|
|
@@ -964,13 +979,13 @@ var Wt = class {
|
|
|
964
979
|
t?.snapshot && !t.committed && this.dragging.cancel(!0);
|
|
965
980
|
}
|
|
966
981
|
start(e, t) {
|
|
967
|
-
if (
|
|
982
|
+
if (I(this.injector)) return;
|
|
968
983
|
let n = {
|
|
969
984
|
axis: t,
|
|
970
985
|
startSize: this.grid.getPlotSize()
|
|
971
986
|
};
|
|
972
|
-
this.dragging.init(e,
|
|
973
|
-
cursor:
|
|
987
|
+
this.dragging.init(e, Ft, {
|
|
988
|
+
cursor: Wt[t],
|
|
974
989
|
keepSelection: !0,
|
|
975
990
|
data: { context: n }
|
|
976
991
|
});
|
|
@@ -979,9 +994,9 @@ var Wt = class {
|
|
|
979
994
|
let t = T("g", {
|
|
980
995
|
class: `wardley-map-resize-handle wardley-map-resize-${e}`,
|
|
981
996
|
"data-axis": e
|
|
982
|
-
}), n =
|
|
997
|
+
}), n = qt(T(e === "xy" ? "rect" : "line", { class: "wardley-map-resize-visual" })), r = qt(T("rect", { class: "wardley-map-resize-hit" }));
|
|
983
998
|
return C(t, n), C(t, r), C(this.layer, t), t.addEventListener("mousedown", (t) => {
|
|
984
|
-
t.button !== 0 || this.dragging.context() || (t.stopPropagation(), t.preventDefault(), this.start(t, e));
|
|
999
|
+
t.button !== 0 || this.dragging.context() || (t.stopPropagation(), t.preventDefault(), L(this.canvas), this.start(t, e));
|
|
985
1000
|
}), {
|
|
986
1001
|
group: t,
|
|
987
1002
|
hit: r,
|
|
@@ -991,7 +1006,7 @@ var Wt = class {
|
|
|
991
1006
|
render() {
|
|
992
1007
|
let e = this.projection.root() !== void 0;
|
|
993
1008
|
if (w(this.layer, { display: e ? "inline" : "none" }), !e) return;
|
|
994
|
-
let { width: t, height: n } = this.grid.getPlotSize(), r = D.marginLeft, i = D.marginTop, a = r + t, o = i + n, s = 1 / this.currentScale(), c =
|
|
1009
|
+
let { width: t, height: n } = this.grid.getPlotSize(), r = D.marginLeft, i = D.marginTop, a = r + t, o = i + n, s = 1 / this.currentScale(), c = Bt * s, l = c / 2, u = Vt * s, d = u / 2, f = Ht * s;
|
|
995
1010
|
w(this.handles.x.hit, {
|
|
996
1011
|
x: a - l,
|
|
997
1012
|
y: i,
|
|
@@ -1039,7 +1054,7 @@ var Wt = class {
|
|
|
1039
1054
|
onMove(e) {
|
|
1040
1055
|
let t = e.context;
|
|
1041
1056
|
if (!t.snapshot || !t.model) return;
|
|
1042
|
-
let n =
|
|
1057
|
+
let n = Jt(t.startSize, t.axis, e.dx, e.dy, {
|
|
1043
1058
|
keepAspectRatio: e.originalEvent?.shiftKey === !0,
|
|
1044
1059
|
disableSnapping: e.originalEvent?.altKey === !0
|
|
1045
1060
|
});
|
|
@@ -1061,15 +1076,15 @@ var Wt = class {
|
|
|
1061
1076
|
}
|
|
1062
1077
|
showBadge(e, t) {
|
|
1063
1078
|
let n = this.canvas.getContainer();
|
|
1064
|
-
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 =
|
|
1079
|
+
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 = Yt(e), this.badge.hidden = !1, t) {
|
|
1065
1080
|
let e = n.getBoundingClientRect();
|
|
1066
|
-
this.badge.style.left = `${t.clientX - e.left +
|
|
1081
|
+
this.badge.style.left = `${t.clientX - e.left + Ut}px`, this.badge.style.top = `${t.clientY - e.top + Ut}px`;
|
|
1067
1082
|
}
|
|
1068
1083
|
}
|
|
1069
1084
|
hideBadge() {
|
|
1070
1085
|
this.badge && (this.badge.hidden = !0);
|
|
1071
1086
|
}
|
|
1072
|
-
},
|
|
1087
|
+
}, Zt = class extends le {
|
|
1073
1088
|
injector;
|
|
1074
1089
|
static $inject = [
|
|
1075
1090
|
"config.autoScroll",
|
|
@@ -1083,17 +1098,16 @@ var Wt = class {
|
|
|
1083
1098
|
startScroll(e) {
|
|
1084
1099
|
this.injector.get("dragging", !1)?.context()?.prefix === "wardley.mapResize" ? this.stopScroll() : super.startScroll(e);
|
|
1085
1100
|
}
|
|
1086
|
-
},
|
|
1101
|
+
}, Qt = {
|
|
1087
1102
|
__depends__: [St],
|
|
1088
1103
|
wardleyMapProjection: ["type", vt]
|
|
1089
|
-
},
|
|
1090
|
-
__depends__: [S,
|
|
1104
|
+
}, $t = {
|
|
1105
|
+
__depends__: [S, Qt],
|
|
1091
1106
|
__init__: ["mapResizeHandles"],
|
|
1092
|
-
mapResizeHandles: ["type",
|
|
1107
|
+
mapResizeHandles: ["type", Xt]
|
|
1093
1108
|
};
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
function Jt(e, t, n, r, i = {}) {
|
|
1109
|
+
// src/modeling/cmd/UpdateConfigHandler.ts
|
|
1110
|
+
function en(e, t, n, r, i = {}) {
|
|
1097
1111
|
let a = gt(e);
|
|
1098
1112
|
if (!a?.businessObject) return {};
|
|
1099
1113
|
let o = {}, s = { ...a.businessObject.config };
|
|
@@ -1107,7 +1121,7 @@ function Jt(e, t, n, r, i = {}) {
|
|
|
1107
1121
|
...i.transient ? { transient: !0 } : {}
|
|
1108
1122
|
}), o;
|
|
1109
1123
|
}
|
|
1110
|
-
var
|
|
1124
|
+
var tn = class {
|
|
1111
1125
|
canvas;
|
|
1112
1126
|
grid;
|
|
1113
1127
|
eventBus;
|
|
@@ -1126,12 +1140,11 @@ var Yt = class {
|
|
|
1126
1140
|
return e.oldProperties && this.apply(e.oldProperties), [];
|
|
1127
1141
|
}
|
|
1128
1142
|
apply(e) {
|
|
1129
|
-
return
|
|
1143
|
+
return en(this.canvas, this.grid, this.eventBus, e);
|
|
1130
1144
|
}
|
|
1131
1145
|
};
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
function Xt(e) {
|
|
1146
|
+
// src/WardleyBaseViewer.ts
|
|
1147
|
+
function nn(e) {
|
|
1135
1148
|
let t = e.undoRedoKeys ?? e.keyboard?.undoRedo, n = e.freeArea ? e.freeArea.insets ? { insets: e.freeArea.insets } : { center: e.freeArea.center } : e.freeRectInsets ? { insets: e.freeRectInsets } : void 0;
|
|
1136
1149
|
return {
|
|
1137
1150
|
...t === void 0 ? {} : { wardleyKeyboard: { undoRedo: t } },
|
|
@@ -1139,16 +1152,16 @@ function Xt(e) {
|
|
|
1139
1152
|
...e.fitOnImport === !1 ? { wardleyImport: { fit: !1 } } : {}
|
|
1140
1153
|
};
|
|
1141
1154
|
}
|
|
1142
|
-
var
|
|
1143
|
-
function
|
|
1144
|
-
let t = re(e), n = [...t.elements, ...t.edges].find(({ id: e }) => e === "wardley-root" || e.startsWith(
|
|
1155
|
+
var rn = "__implicitroot";
|
|
1156
|
+
function an(e) {
|
|
1157
|
+
let t = re(e), n = [...t.elements, ...t.edges].find(({ id: e }) => e === "wardley-root" || e.startsWith(rn));
|
|
1145
1158
|
if (n) throw Error(`The id "${n.id}" is reserved for the canvas itself.`);
|
|
1146
1159
|
return t;
|
|
1147
1160
|
}
|
|
1148
|
-
function
|
|
1161
|
+
function on(e) {
|
|
1149
1162
|
return typeof e == "number" ? `${e}px` : e;
|
|
1150
1163
|
}
|
|
1151
|
-
var
|
|
1164
|
+
var sn = class {
|
|
1152
1165
|
_diagram;
|
|
1153
1166
|
_container;
|
|
1154
1167
|
_options;
|
|
@@ -1159,7 +1172,7 @@ var en = class {
|
|
|
1159
1172
|
}
|
|
1160
1173
|
_createContainer(e) {
|
|
1161
1174
|
let t = e.container ?? document.createElement("div");
|
|
1162
|
-
return t.classList.add("wardley-container"), t.style.width =
|
|
1175
|
+
return t.classList.add("wardley-container"), t.style.width = on(e.width ?? "100%"), t.style.height = on(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
1163
1176
|
}
|
|
1164
1177
|
_ensureDiagram() {
|
|
1165
1178
|
if (!this._diagram) {
|
|
@@ -1167,7 +1180,7 @@ var en = class {
|
|
|
1167
1180
|
this._diagram = new e({
|
|
1168
1181
|
canvas: { container: this._container },
|
|
1169
1182
|
modules: t,
|
|
1170
|
-
...
|
|
1183
|
+
...nn(this._options)
|
|
1171
1184
|
}), this._diagram.get("eventBus").on(bt, xt, () => this._putBackSizePreview());
|
|
1172
1185
|
}
|
|
1173
1186
|
return this._diagram;
|
|
@@ -1182,7 +1195,7 @@ var en = class {
|
|
|
1182
1195
|
this.get("eventBus").off(e, t);
|
|
1183
1196
|
}
|
|
1184
1197
|
async importMap(e) {
|
|
1185
|
-
let t =
|
|
1198
|
+
let t = an(e), n = this._ensureDiagram(), r = n.get("eventBus"), i = n.get("wardleyImporter"), a = n.get("commandStack", !1), o = this._rootBusinessObject() ? this.exportMap() : void 0;
|
|
1186
1199
|
this._labelsBeforePreview = void 0, this._sizePreview = void 0, n.get("dragging", !1)?.cancel(!1), i.clear();
|
|
1187
1200
|
let s;
|
|
1188
1201
|
try {
|
|
@@ -1202,7 +1215,7 @@ var en = class {
|
|
|
1202
1215
|
});
|
|
1203
1216
|
let { warnings: i } = await this.importMap(n);
|
|
1204
1217
|
return { warnings: [...r.map((e) => ({
|
|
1205
|
-
message: `Line ${e.line}: ${e.message}
|
|
1218
|
+
message: `Line ${e.line}: ${e.message} ("${e.text}")`,
|
|
1206
1219
|
line: e.line,
|
|
1207
1220
|
source: e.text
|
|
1208
1221
|
})), ...i] };
|
|
@@ -1284,7 +1297,7 @@ var en = class {
|
|
|
1284
1297
|
} else this._applyConfigDirectly({ evolutionLabels: n });
|
|
1285
1298
|
}
|
|
1286
1299
|
_applyConfigDirectly(e, t = {}) {
|
|
1287
|
-
|
|
1300
|
+
en(this.get("canvas"), this.get("evolutionGrid"), this.get("eventBus"), e, t);
|
|
1288
1301
|
}
|
|
1289
1302
|
_wardleyModeling() {
|
|
1290
1303
|
return this._ensureDiagram().get("wardleyModeling", !1);
|
|
@@ -1321,9 +1334,8 @@ var en = class {
|
|
|
1321
1334
|
return this._container;
|
|
1322
1335
|
}
|
|
1323
1336
|
};
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
function I(e) {
|
|
1337
|
+
// src/layout/WardleyLayouter.ts
|
|
1338
|
+
function R(e) {
|
|
1327
1339
|
return P(e) ? {
|
|
1328
1340
|
x: e.x + e.width / 2,
|
|
1329
1341
|
y: e.y
|
|
@@ -1332,32 +1344,32 @@ function I(e) {
|
|
|
1332
1344
|
y: e.y + e.height / 2
|
|
1333
1345
|
};
|
|
1334
1346
|
}
|
|
1335
|
-
var
|
|
1347
|
+
var cn = class extends ue {
|
|
1336
1348
|
layoutConnection(e, t = {}) {
|
|
1337
1349
|
let n = t.source ?? e.source, r = t.target ?? e.target;
|
|
1338
1350
|
return super.layoutConnection(e, {
|
|
1339
1351
|
...t,
|
|
1340
|
-
...n ? { connectionStart:
|
|
1341
|
-
...r ? { connectionEnd:
|
|
1352
|
+
...n ? { connectionStart: R(n) } : {},
|
|
1353
|
+
...r ? { connectionEnd: R(r) } : {}
|
|
1342
1354
|
});
|
|
1343
1355
|
}
|
|
1344
|
-
},
|
|
1356
|
+
}, ln = { layouter: ["type", cn] }, un = /* @__PURE__ */ new Set([
|
|
1345
1357
|
"component",
|
|
1346
1358
|
"anchor",
|
|
1347
1359
|
"submap",
|
|
1348
1360
|
"pipeline",
|
|
1349
1361
|
"accelerator"
|
|
1350
1362
|
]);
|
|
1351
|
-
function
|
|
1352
|
-
return typeof e == "string" &&
|
|
1363
|
+
function dn(e) {
|
|
1364
|
+
return typeof e == "string" && un.has(e);
|
|
1353
1365
|
}
|
|
1354
|
-
function
|
|
1366
|
+
function fn(e, t) {
|
|
1355
1367
|
if (!t.has(e)) return e;
|
|
1356
1368
|
let n = / (\d+)$/.exec(e), r = n ? e.slice(0, n.index) : e, i = n ? Number(n[1]) + 1 : 2;
|
|
1357
1369
|
for (; t.has(`${r} ${i}`);) i++;
|
|
1358
1370
|
return `${r} ${i}`;
|
|
1359
1371
|
}
|
|
1360
|
-
var
|
|
1372
|
+
var pn = class {
|
|
1361
1373
|
elementFactory;
|
|
1362
1374
|
grid;
|
|
1363
1375
|
elementRegistry;
|
|
@@ -1370,25 +1382,25 @@ var sn = class {
|
|
|
1370
1382
|
this.elementFactory = e, this.grid = t, this.elementRegistry = n;
|
|
1371
1383
|
}
|
|
1372
1384
|
uniqueLabel(e, t) {
|
|
1373
|
-
return
|
|
1385
|
+
return fn(e, this.takenLinkableLabels(t, this.pairableTypeFor(t)));
|
|
1374
1386
|
}
|
|
1375
1387
|
uniqueLabels(e) {
|
|
1376
1388
|
let t = this.takenLinkableLabels();
|
|
1377
1389
|
return e.map(({ type: e, label: n }) => {
|
|
1378
|
-
if (!
|
|
1379
|
-
let r =
|
|
1390
|
+
if (!dn(e)) return n;
|
|
1391
|
+
let r = fn(n, t);
|
|
1380
1392
|
return t.add(r), r;
|
|
1381
1393
|
});
|
|
1382
1394
|
}
|
|
1383
1395
|
isLinkable(e) {
|
|
1384
|
-
return
|
|
1396
|
+
return dn(e);
|
|
1385
1397
|
}
|
|
1386
1398
|
takenLinkableLabels(e, t) {
|
|
1387
1399
|
let n = /* @__PURE__ */ new Set();
|
|
1388
1400
|
for (let r of this.elementRegistry.getAll()) {
|
|
1389
1401
|
if (e && r.id === e) continue;
|
|
1390
1402
|
let { wardleyType: i, wardleyLabel: a } = r;
|
|
1391
|
-
|
|
1403
|
+
dn(i) && typeof a == "string" && (i === t && this.isUnpaired(r) || n.add(a));
|
|
1392
1404
|
}
|
|
1393
1405
|
return n;
|
|
1394
1406
|
}
|
|
@@ -1540,7 +1552,7 @@ var sn = class {
|
|
|
1540
1552
|
});
|
|
1541
1553
|
}
|
|
1542
1554
|
createNew(e, t, n = {}) {
|
|
1543
|
-
let r = e === "attitude" ? n.attitudeKind ?? "pioneers" :
|
|
1555
|
+
let r = e === "attitude" ? n.attitudeKind ?? "pioneers" : dn(e) ? this.uniqueLabel(t) : t;
|
|
1544
1556
|
if (e === "pipeline") return this.elementFactory.createShape({
|
|
1545
1557
|
width: 200,
|
|
1546
1558
|
height: 30,
|
|
@@ -1619,7 +1631,7 @@ var sn = class {
|
|
|
1619
1631
|
id: t.id,
|
|
1620
1632
|
source: n,
|
|
1621
1633
|
target: r,
|
|
1622
|
-
waypoints: [
|
|
1634
|
+
waypoints: [R(n), R(r)],
|
|
1623
1635
|
wardleyType: e,
|
|
1624
1636
|
bidirectional: i,
|
|
1625
1637
|
...a ? { flowValue: a } : {},
|
|
@@ -1627,24 +1639,24 @@ var sn = class {
|
|
|
1627
1639
|
businessObject: t
|
|
1628
1640
|
});
|
|
1629
1641
|
}
|
|
1630
|
-
},
|
|
1631
|
-
function
|
|
1642
|
+
}, mn = { wardleyElementFactory: ["type", pn] }, hn = "wardley-axes", gn = ["Invisible", "Visible"], _n = "wardley-axis", vn = "wardley-axis-text";
|
|
1643
|
+
function yn(e) {
|
|
1632
1644
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1633
1645
|
}
|
|
1634
|
-
var
|
|
1646
|
+
var bn = class {
|
|
1635
1647
|
canvas;
|
|
1636
1648
|
static $inject = ["canvas"];
|
|
1637
1649
|
boundaries = a;
|
|
1638
1650
|
labels = n;
|
|
1639
1651
|
yAxisLabel = "Value Chain";
|
|
1640
|
-
yAxisEndLabels =
|
|
1652
|
+
yAxisEndLabels = gn;
|
|
1641
1653
|
plotWidth = D.width;
|
|
1642
1654
|
plotHeight = D.height;
|
|
1643
1655
|
constructor(e) {
|
|
1644
1656
|
this.canvas = e;
|
|
1645
1657
|
}
|
|
1646
1658
|
configure(e) {
|
|
1647
|
-
this.boundaries = e.stageBoundaries ?? a, this.labels = e.evolutionLabels ?? n, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ??
|
|
1659
|
+
this.boundaries = e.stageBoundaries ?? a, this.labels = e.evolutionLabels ?? n, this.yAxisLabel = e.yAxisLabel ?? "Value Chain", this.yAxisEndLabels = e.yAxisEndLabels ?? gn, this.plotWidth = p(e.size?.width, "width"), this.plotHeight = p(e.size?.height, "height");
|
|
1648
1660
|
}
|
|
1649
1661
|
toCanvas(e) {
|
|
1650
1662
|
return {
|
|
@@ -1654,8 +1666,8 @@ var mn = class {
|
|
|
1654
1666
|
}
|
|
1655
1667
|
fromCanvas(e) {
|
|
1656
1668
|
return {
|
|
1657
|
-
evolution:
|
|
1658
|
-
visibility:
|
|
1669
|
+
evolution: yn((e.x - D.marginLeft) / this.plotWidth),
|
|
1670
|
+
visibility: yn(1 - (e.y - D.marginTop) / this.plotHeight)
|
|
1659
1671
|
};
|
|
1660
1672
|
}
|
|
1661
1673
|
stageOf(e) {
|
|
@@ -1679,10 +1691,10 @@ var mn = class {
|
|
|
1679
1691
|
};
|
|
1680
1692
|
}
|
|
1681
1693
|
render() {
|
|
1682
|
-
let e = this.canvas.getLayer(
|
|
1694
|
+
let e = this.canvas.getLayer(hn, -1);
|
|
1683
1695
|
oe(e);
|
|
1684
1696
|
let t = D.marginLeft, n = D.marginTop, r = t + this.plotWidth, i = n + this.plotHeight;
|
|
1685
|
-
C(e,
|
|
1697
|
+
C(e, xn(t, n, this.plotWidth, this.plotHeight, {
|
|
1686
1698
|
fill: k.plotBackground,
|
|
1687
1699
|
stroke: k.grid
|
|
1688
1700
|
}));
|
|
@@ -1693,51 +1705,51 @@ var mn = class {
|
|
|
1693
1705
|
];
|
|
1694
1706
|
for (let r = 0; r < 4; r++) {
|
|
1695
1707
|
let o = t + a[r] * this.plotWidth, s = t + a[r + 1] * this.plotWidth;
|
|
1696
|
-
r % 2 == 1 && C(e,
|
|
1708
|
+
r % 2 == 1 && C(e, xn(o, n, s - o, this.plotHeight, {
|
|
1697
1709
|
fill: k.band,
|
|
1698
1710
|
stroke: "none"
|
|
1699
|
-
})), r > 0 && C(e,
|
|
1711
|
+
})), r > 0 && C(e, Sn(o, n, o, i, {
|
|
1700
1712
|
stroke: k.grid,
|
|
1701
1713
|
"stroke-dasharray": "3 5"
|
|
1702
1714
|
}));
|
|
1703
1715
|
let c = (o + s) / 2;
|
|
1704
|
-
C(e,
|
|
1716
|
+
C(e, Cn(this.labels[r].toUpperCase(), c, i + 18, {
|
|
1705
1717
|
"text-anchor": "middle",
|
|
1706
1718
|
"font-size": A.stage,
|
|
1707
1719
|
"letter-spacing": "0.08em",
|
|
1708
1720
|
fill: k.axisText
|
|
1709
1721
|
}));
|
|
1710
1722
|
}
|
|
1711
|
-
C(e,
|
|
1723
|
+
C(e, Sn(t, i, r + 10, i, {
|
|
1712
1724
|
stroke: k.axis,
|
|
1713
|
-
class:
|
|
1714
|
-
})), C(e,
|
|
1725
|
+
class: _n
|
|
1726
|
+
})), C(e, wn(r + 10, i, "right")), C(e, Cn("Evolution", r + 6, i + 38, {
|
|
1715
1727
|
"text-anchor": "end",
|
|
1716
1728
|
"font-size": A.axis,
|
|
1717
1729
|
fill: k.axisText,
|
|
1718
1730
|
"font-style": "italic"
|
|
1719
|
-
})), C(e,
|
|
1731
|
+
})), C(e, Sn(t, i, t, n - 10, {
|
|
1720
1732
|
stroke: k.axis,
|
|
1721
|
-
class:
|
|
1722
|
-
})), C(e,
|
|
1723
|
-
let o =
|
|
1733
|
+
class: _n
|
|
1734
|
+
})), C(e, wn(t, n - 10, "up"));
|
|
1735
|
+
let o = Cn(this.yAxisLabel, 0, 0, {
|
|
1724
1736
|
"text-anchor": "middle",
|
|
1725
1737
|
"font-size": A.axis,
|
|
1726
1738
|
fill: k.axisText,
|
|
1727
1739
|
"font-style": "italic"
|
|
1728
1740
|
});
|
|
1729
|
-
w(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), C(e, o), C(e,
|
|
1741
|
+
w(o, { transform: `translate(${t - 46}, ${(n + i) / 2}) rotate(-90)` }), C(e, o), C(e, Cn(this.yAxisEndLabels[1], t - 10, n + 11, {
|
|
1730
1742
|
"text-anchor": "end",
|
|
1731
1743
|
"font-size": A.stage,
|
|
1732
1744
|
fill: k.axisText
|
|
1733
|
-
})), C(e,
|
|
1745
|
+
})), C(e, Cn(this.yAxisEndLabels[0], t - 10, i - 2, {
|
|
1734
1746
|
"text-anchor": "end",
|
|
1735
1747
|
"font-size": A.stage,
|
|
1736
1748
|
fill: k.axisText
|
|
1737
1749
|
}));
|
|
1738
1750
|
}
|
|
1739
1751
|
};
|
|
1740
|
-
function
|
|
1752
|
+
function xn(e, t, n, r, i) {
|
|
1741
1753
|
return w(T("rect"), {
|
|
1742
1754
|
x: e,
|
|
1743
1755
|
y: t,
|
|
@@ -1747,7 +1759,7 @@ function hn(e, t, n, r, i) {
|
|
|
1747
1759
|
...i
|
|
1748
1760
|
});
|
|
1749
1761
|
}
|
|
1750
|
-
function
|
|
1762
|
+
function Sn(e, t, n, r, i) {
|
|
1751
1763
|
return w(T("line"), {
|
|
1752
1764
|
x1: e,
|
|
1753
1765
|
y1: t,
|
|
@@ -1757,62 +1769,30 @@ function gn(e, t, n, r, i) {
|
|
|
1757
1769
|
...i
|
|
1758
1770
|
});
|
|
1759
1771
|
}
|
|
1760
|
-
function
|
|
1772
|
+
function Cn(e, t, n, r) {
|
|
1761
1773
|
let i = w(T("text"), {
|
|
1762
1774
|
x: t,
|
|
1763
1775
|
y: n,
|
|
1764
1776
|
"font-family": A.family,
|
|
1765
|
-
class:
|
|
1777
|
+
class: vn,
|
|
1766
1778
|
...r
|
|
1767
1779
|
});
|
|
1768
1780
|
return i.textContent = e, i;
|
|
1769
1781
|
}
|
|
1770
|
-
function
|
|
1782
|
+
function wn(e, t, n) {
|
|
1771
1783
|
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}`;
|
|
1772
1784
|
return w(T("polygon"), {
|
|
1773
1785
|
points: r,
|
|
1774
1786
|
fill: k.axis,
|
|
1775
|
-
class:
|
|
1787
|
+
class: _n
|
|
1776
1788
|
});
|
|
1777
1789
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
//#endregion
|
|
1782
|
-
//#region src/a11y/canvasFocus.ts
|
|
1783
|
-
function bn(e) {
|
|
1784
|
-
return e._svg ?? e.getContainer().querySelector(":scope > svg");
|
|
1785
|
-
}
|
|
1786
|
-
function xn(e) {
|
|
1787
|
-
let t = bn(e);
|
|
1788
|
-
t ? t.focus({
|
|
1789
|
-
preventScroll: !0,
|
|
1790
|
-
focusVisible: !1
|
|
1791
|
-
}) : e.focus();
|
|
1792
|
-
}
|
|
1793
|
-
var Sn = "pointer", Cn = !1;
|
|
1794
|
-
function wn() {
|
|
1795
|
-
Cn || typeof document > "u" || (Cn = !0, document.addEventListener("pointerdown", () => Sn = "pointer", !0), document.addEventListener("mousedown", () => Sn = "pointer", !0), document.addEventListener("keydown", (e) => {
|
|
1796
|
-
e.target instanceof HTMLElement && e.target.closest("input, textarea") || (Sn = "keyboard");
|
|
1797
|
-
}, !0));
|
|
1798
|
-
}
|
|
1799
|
-
function Tn() {
|
|
1800
|
-
return Sn === "pointer";
|
|
1801
|
-
}
|
|
1802
|
-
//#endregion
|
|
1803
|
-
//#region src/a11y/describeCanvas.ts
|
|
1804
|
-
function En(e) {
|
|
1805
|
-
let t = bn(e);
|
|
1806
|
-
t && (t.setAttribute("role", "application"), t.setAttribute("aria-roledescription", "Wardley map"), t.setAttribute("aria-label", "Map canvas"));
|
|
1807
|
-
}
|
|
1808
|
-
En.$inject = ["canvas"];
|
|
1809
|
-
//#endregion
|
|
1810
|
-
//#region src/a11y/index.ts
|
|
1811
|
-
var Dn = { __init__: [En] }, On = "wardley.evolve", kn = "wardley-evolve-handle";
|
|
1812
|
-
function An(e) {
|
|
1790
|
+
// src/evolve/constants.ts
|
|
1791
|
+
var Tn = .005, En = "wardley.evolve", Dn = "wardley-evolve-handle";
|
|
1792
|
+
function On(e) {
|
|
1813
1793
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1814
1794
|
}
|
|
1815
|
-
var
|
|
1795
|
+
var kn = class {
|
|
1816
1796
|
dragging;
|
|
1817
1797
|
injector;
|
|
1818
1798
|
static $inject = [
|
|
@@ -1828,9 +1808,9 @@ var jn = class {
|
|
|
1828
1808
|
this.dragging = t, this.injector = o;
|
|
1829
1809
|
let s = (t, n) => {
|
|
1830
1810
|
n === void 0 ? delete t.movement : t.movement = n, e.fire("element.changed", { element: t });
|
|
1831
|
-
}, c = (e, t) => Math.max(
|
|
1811
|
+
}, c = (e, t) => Math.max(On(t), Math.min(1, e.evolution + Tn)), l = (e, t) => {
|
|
1832
1812
|
let r = i.getContainer().getBoundingClientRect(), a = i.viewbox(), o = a.x + (e - r.left) * (a.width / r.width);
|
|
1833
|
-
return
|
|
1813
|
+
return On(n.fromCanvas({
|
|
1834
1814
|
x: o,
|
|
1835
1815
|
y: t
|
|
1836
1816
|
}).evolution);
|
|
@@ -1840,10 +1820,10 @@ var jn = class {
|
|
|
1840
1820
|
};
|
|
1841
1821
|
i.getContainer().addEventListener("mousedown", (e) => {
|
|
1842
1822
|
let t = e.target;
|
|
1843
|
-
if (!t?.closest(`.${
|
|
1823
|
+
if (!t?.closest(`.${Dn}`) || u() || I(o)) return;
|
|
1844
1824
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), d = n ? a.get(n) : void 0;
|
|
1845
1825
|
if (!d || d.wardleyType !== "component") return;
|
|
1846
|
-
e.stopPropagation(), e.preventDefault(),
|
|
1826
|
+
e.stopPropagation(), e.preventDefault(), L(i);
|
|
1847
1827
|
let f = d.movement, p = d.y + d.height / 2, m, h = (e) => {
|
|
1848
1828
|
m = c(d, l(e.clientX, p)), s(d, {
|
|
1849
1829
|
...f,
|
|
@@ -1853,7 +1833,7 @@ var jn = class {
|
|
|
1853
1833
|
document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", g), s(d, f), a.get(d.id) === d && m !== void 0 && m > d.evolution + .005 && r.evolveComponent(d, m);
|
|
1854
1834
|
};
|
|
1855
1835
|
document.addEventListener("mousemove", h), document.addEventListener("mouseup", g);
|
|
1856
|
-
}, !0), e.on(`${
|
|
1836
|
+
}, !0), e.on(`${En}.move`, (e) => {
|
|
1857
1837
|
let { shape: t } = e.context, r = t.y + t.height / 2, i = c(t, n.fromCanvas({
|
|
1858
1838
|
x: e.x,
|
|
1859
1839
|
y: r
|
|
@@ -1862,63 +1842,61 @@ var jn = class {
|
|
|
1862
1842
|
...e.context.originalMovement,
|
|
1863
1843
|
targetEvolution: i
|
|
1864
1844
|
});
|
|
1865
|
-
}), e.on(`${
|
|
1845
|
+
}), e.on(`${En}.end`, (e) => {
|
|
1866
1846
|
let t = e.context, { shape: n, target: i } = t;
|
|
1867
1847
|
s(n, t.originalMovement), i !== void 0 && i > n.evolution + .005 && r.evolveComponent(n, i), t.committed = !0;
|
|
1868
|
-
}), e.on(`${
|
|
1848
|
+
}), e.on(`${En}.cleanup`, (e) => {
|
|
1869
1849
|
let t = e.context;
|
|
1870
1850
|
t && !t.committed && s(t.shape, t.originalMovement);
|
|
1871
1851
|
});
|
|
1872
1852
|
}
|
|
1873
1853
|
start(e, t) {
|
|
1874
|
-
if (
|
|
1854
|
+
if (I(this.injector)) return;
|
|
1875
1855
|
let n = {
|
|
1876
1856
|
shape: t,
|
|
1877
1857
|
...t.movement ? { originalMovement: t.movement } : {}
|
|
1878
1858
|
};
|
|
1879
|
-
this.dragging.init(e,
|
|
1859
|
+
this.dragging.init(e, En, {
|
|
1880
1860
|
cursor: "ew-resize",
|
|
1881
1861
|
data: { context: n }
|
|
1882
1862
|
});
|
|
1883
1863
|
}
|
|
1884
|
-
},
|
|
1864
|
+
}, An = {
|
|
1885
1865
|
__init__: ["wardleyEvolveDragging"],
|
|
1886
|
-
wardleyEvolveDragging: ["type",
|
|
1866
|
+
wardleyEvolveDragging: ["type", kn]
|
|
1887
1867
|
};
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
function L(e) {
|
|
1868
|
+
// src/pipeline/pipelineMembership.ts
|
|
1869
|
+
function z(e) {
|
|
1891
1870
|
return {
|
|
1892
1871
|
x: e.x + e.width / 2,
|
|
1893
1872
|
y: e.y + e.height / 2
|
|
1894
1873
|
};
|
|
1895
1874
|
}
|
|
1896
|
-
function
|
|
1875
|
+
function jn(e, t) {
|
|
1897
1876
|
return t.x >= e.x && t.x <= e.x + e.width && t.y >= e.y && t.y <= e.y + e.height;
|
|
1898
1877
|
}
|
|
1899
|
-
function
|
|
1878
|
+
function Mn(e) {
|
|
1900
1879
|
return e.filter((e) => P(e));
|
|
1901
1880
|
}
|
|
1902
|
-
function
|
|
1881
|
+
function Nn(e, t) {
|
|
1903
1882
|
return e.filter((e) => N(e) && e.pipelineId === t.id);
|
|
1904
1883
|
}
|
|
1905
|
-
function
|
|
1884
|
+
function Pn(e, t) {
|
|
1906
1885
|
return e.find((e) => N(e) && e.wardleyLabel === t.wardleyLabel && e.pipelineId !== t.id);
|
|
1907
1886
|
}
|
|
1908
|
-
function
|
|
1909
|
-
if (N(t)) return
|
|
1887
|
+
function Fn(e, t) {
|
|
1888
|
+
if (N(t)) return Mn(e).find((e) => e.wardleyLabel === t.wardleyLabel && t.pipelineId !== e.id);
|
|
1910
1889
|
}
|
|
1911
|
-
function
|
|
1912
|
-
let n =
|
|
1913
|
-
return [...
|
|
1890
|
+
function In(e, t) {
|
|
1891
|
+
let n = Pn(e, t);
|
|
1892
|
+
return [...Nn(e, t), ...n ? [n] : []];
|
|
1914
1893
|
}
|
|
1915
|
-
function
|
|
1916
|
-
let i =
|
|
1894
|
+
function Ln(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
1895
|
+
let i = Mn(e).filter((e) => !r.has(e) && e.wardleyLabel !== t.wardleyLabel && jn(e, n));
|
|
1917
1896
|
return i.find((e) => e.id === t.pipelineId) ?? i[0];
|
|
1918
1897
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn = 900, Kn = "wardley-drop-target", qn = class extends de {
|
|
1898
|
+
// src/pipeline/PipelineGroupBehavior.ts
|
|
1899
|
+
var Rn = 1400, zn = 450, Bn = 400, Vn = 1500, Hn = "wardley-pipeline-drag", Un = 900, Wn = "wardley-drop-target", Gn = class extends de {
|
|
1922
1900
|
elementRegistry;
|
|
1923
1901
|
canvas;
|
|
1924
1902
|
static $inject = [
|
|
@@ -1933,27 +1911,27 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
1933
1911
|
this.preExecute("element.updateProperties", (e) => {
|
|
1934
1912
|
let { context: t } = e, n = t.element, r = t.properties.wardleyLabel;
|
|
1935
1913
|
if (typeof r != "string" || r === n.wardleyLabel) return;
|
|
1936
|
-
let i = P(n) ?
|
|
1914
|
+
let i = P(n) ? Pn(this.elementRegistry, n) : Fn(this.elementRegistry, n);
|
|
1937
1915
|
i && (t.renamedCounterpart = i);
|
|
1938
1916
|
}), this.postExecute("element.updateProperties", (e) => {
|
|
1939
1917
|
let { context: t } = e, n = t.renamedCounterpart, i = t.properties.wardleyLabel;
|
|
1940
1918
|
n && typeof i == "string" && n.wardleyLabel !== i && r.get("wardleyModeling").updateProperties(n, { wardleyLabel: i });
|
|
1941
|
-
}), e.on("shape.move.start",
|
|
1919
|
+
}), e.on("shape.move.start", Rn, (e) => {
|
|
1942
1920
|
let { context: t } = e;
|
|
1943
1921
|
t.shapes = this.withFollowers(t.shapes ?? []);
|
|
1944
|
-
}), this.preExecuted("elements.move",
|
|
1922
|
+
}), this.preExecuted("elements.move", Vn, (e) => {
|
|
1945
1923
|
let t = e.context.closure;
|
|
1946
1924
|
if (t) {
|
|
1947
|
-
for (let e of Object.values(t.allShapes)) if (P(e)) for (let n of
|
|
1925
|
+
for (let e of Object.values(t.allShapes)) if (P(e)) for (let n of In(this.elementRegistry, e)) t.allShapes[n.id] || t.add(n, !!t.topLevel[e.id]);
|
|
1948
1926
|
}
|
|
1949
|
-
}), i && e.on("shape.move.start",
|
|
1927
|
+
}), i && e.on("shape.move.start", zn, (e) => {
|
|
1950
1928
|
let { context: t } = e, n = this.carriedVertically(t.shapes ?? []);
|
|
1951
1929
|
if (!n.length) return;
|
|
1952
1930
|
let r = T("g");
|
|
1953
|
-
w(r, { class: "djs-drag-group" }), C(this.canvas.getLayer(
|
|
1931
|
+
w(r, { class: "djs-drag-group" }), C(this.canvas.getLayer(Hn, Un), r);
|
|
1954
1932
|
for (let e of n) i.addDragger(e, r);
|
|
1955
1933
|
t.pipelineVerticalPreview = r;
|
|
1956
|
-
}), e.on("shape.move.move",
|
|
1934
|
+
}), e.on("shape.move.move", Bn, (e) => {
|
|
1957
1935
|
let { context: t } = e;
|
|
1958
1936
|
t.pipelineVerticalPreview && fe(t.pipelineVerticalPreview, 0, e.dy), this.markDropTarget(t, this.dropTargetFor(t, e.dx, e.dy));
|
|
1959
1937
|
}), e.on("shape.move.cleanup", (e) => {
|
|
@@ -1963,47 +1941,47 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
1963
1941
|
}
|
|
1964
1942
|
withFollowers(e) {
|
|
1965
1943
|
let t = new Set(e);
|
|
1966
|
-
for (let n of e) if (P(n)) for (let e of
|
|
1944
|
+
for (let n of e) if (P(n)) for (let e of In(this.elementRegistry, n)) t.add(e);
|
|
1967
1945
|
return [...t];
|
|
1968
1946
|
}
|
|
1969
1947
|
carriedVertically(e) {
|
|
1970
1948
|
let t = new Set(e), n = [];
|
|
1971
1949
|
for (let r of e) {
|
|
1972
1950
|
if (!N(r)) continue;
|
|
1973
|
-
let e =
|
|
1974
|
-
e && !t.has(e) && n.push(e, ...
|
|
1951
|
+
let e = Fn(this.elementRegistry, r);
|
|
1952
|
+
e && !t.has(e) && n.push(e, ...Nn(this.elementRegistry, e).filter((e) => !t.has(e)));
|
|
1975
1953
|
}
|
|
1976
1954
|
return n;
|
|
1977
1955
|
}
|
|
1978
1956
|
dropTargetFor(e, t, n) {
|
|
1979
1957
|
let r = e.shape;
|
|
1980
|
-
if (!N(r) ||
|
|
1981
|
-
let i =
|
|
1982
|
-
return
|
|
1958
|
+
if (!N(r) || Fn(this.elementRegistry, r)) return;
|
|
1959
|
+
let i = z(r);
|
|
1960
|
+
return Ln(this.elementRegistry, r, {
|
|
1983
1961
|
x: i.x + t,
|
|
1984
1962
|
y: i.y + n
|
|
1985
1963
|
}, new Set(e.shapes ?? []));
|
|
1986
1964
|
}
|
|
1987
1965
|
markDropTarget(e, t) {
|
|
1988
1966
|
let n = e.pipelineDropTarget;
|
|
1989
|
-
n !== t && (n && this.canvas.removeMarker(n,
|
|
1967
|
+
n !== t && (n && this.canvas.removeMarker(n, Wn), t && this.canvas.addMarker(t, Wn), t ? e.pipelineDropTarget = t : delete e.pipelineDropTarget);
|
|
1990
1968
|
}
|
|
1991
|
-
},
|
|
1969
|
+
}, Kn = {
|
|
1992
1970
|
__init__: ["pipelineGroupBehavior"],
|
|
1993
|
-
pipelineGroupBehavior: ["type",
|
|
1994
|
-
},
|
|
1971
|
+
pipelineGroupBehavior: ["type", Gn]
|
|
1972
|
+
}, qn = [
|
|
1995
1973
|
"shape.move",
|
|
1996
1974
|
"shape.create",
|
|
1997
1975
|
"shape.resize"
|
|
1998
|
-
],
|
|
1999
|
-
...
|
|
1976
|
+
], Jn = [
|
|
1977
|
+
...qn,
|
|
2000
1978
|
"elements.move",
|
|
2001
1979
|
"elements.create"
|
|
2002
|
-
],
|
|
1980
|
+
], Yn = [
|
|
2003
1981
|
"shape.create",
|
|
2004
1982
|
"shape.delete",
|
|
2005
1983
|
"element.updateProperties"
|
|
2006
|
-
],
|
|
1984
|
+
], Xn = 2e3, Zn = 1e3, Qn = 10, $n = 1e-6, er = class extends de {
|
|
2007
1985
|
eventBus;
|
|
2008
1986
|
grid;
|
|
2009
1987
|
elementRegistry;
|
|
@@ -2023,9 +2001,9 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2023
2001
|
constructor(e, t, n, r, i, a) {
|
|
2024
2002
|
super(e), this.eventBus = e, this.grid = t, this.elementRegistry = n, this.canvas = r, this.modeling = i, this.wardleyModeling = a;
|
|
2025
2003
|
let o = (e) => {
|
|
2026
|
-
for (let t of
|
|
2004
|
+
for (let t of tr(e.context)) this.deriveFromGeometry(t);
|
|
2027
2005
|
};
|
|
2028
|
-
this.executed(
|
|
2006
|
+
this.executed(qn, o), this.reverted(qn, o), this.preExecute(Jn, Xn, (e) => {
|
|
2029
2007
|
this.topLevelContext ||= e.context;
|
|
2030
2008
|
}), e.on("commandStack.changed", () => {
|
|
2031
2009
|
this.topLevelContext = null;
|
|
@@ -2034,18 +2012,18 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2034
2012
|
if (!this.isTopLevel(t) || !j(t.shape) || !t.delta) return;
|
|
2035
2013
|
let n = [t.shape, ...this.followersOf(t.shape)];
|
|
2036
2014
|
this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
|
|
2037
|
-
}), this.preExecuted("elements.move",
|
|
2015
|
+
}), this.preExecuted("elements.move", Zn, (e) => {
|
|
2038
2016
|
let { context: t } = e;
|
|
2039
2017
|
if (!this.isTopLevel(t) || !t.delta) return;
|
|
2040
|
-
let n =
|
|
2018
|
+
let n = nr(t);
|
|
2041
2019
|
this.rememberEvolutions(t, n), t.delta = this.clampDelta(t.delta, n);
|
|
2042
2020
|
}), this.preExecute(["shape.create", "elements.create"], (e) => {
|
|
2043
2021
|
let { context: t } = e;
|
|
2044
|
-
t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t,
|
|
2022
|
+
t.parent?.parent && (t.parent = this.canvas.getRootElement()), this.isTopLevel(t) && this.rememberEvolutions(t, tr(t));
|
|
2045
2023
|
}), this.preExecute("shape.resize", (e) => {
|
|
2046
2024
|
let { context: t } = e, n = t.shape;
|
|
2047
2025
|
j(n) && t.newBounds && (n.wardleyType === "pipeline" ? t.newBounds = this.horizontalPipelineBounds(n, t.newBounds) : n.wardleyType === "attitude" && (t.newBounds = this.boundsInsidePlot(t.newBounds)));
|
|
2048
|
-
}), this.postExecuted(
|
|
2026
|
+
}), this.postExecuted(Jn, (e) => {
|
|
2049
2027
|
if (e.context === this.topLevelContext) try {
|
|
2050
2028
|
this.applyCorrections(e.command, e.context);
|
|
2051
2029
|
} finally {
|
|
@@ -2059,13 +2037,13 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2059
2037
|
...e.context?.elements ?? []
|
|
2060
2038
|
].some((e) => N(e))) for (let e of this.elementRegistry.filter((e) => P(e))) this.eventBus.fire("element.changed", { element: e });
|
|
2061
2039
|
};
|
|
2062
|
-
this.executed(
|
|
2040
|
+
this.executed(Yn, s), this.reverted(Yn, s);
|
|
2063
2041
|
}
|
|
2064
2042
|
isTopLevel(e) {
|
|
2065
2043
|
return e === this.topLevelContext;
|
|
2066
2044
|
}
|
|
2067
2045
|
followersOf(e) {
|
|
2068
|
-
return P(e) ?
|
|
2046
|
+
return P(e) ? In(this.elementRegistry, e) : [];
|
|
2069
2047
|
}
|
|
2070
2048
|
rememberEvolutions(e, t) {
|
|
2071
2049
|
this.evolutionsBefore.set(e, new Map(t.map((e) => [e, e.evolution])));
|
|
@@ -2098,7 +2076,7 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2098
2076
|
return;
|
|
2099
2077
|
}
|
|
2100
2078
|
default: {
|
|
2101
|
-
let t = this.grid.fromCanvas(
|
|
2079
|
+
let t = this.grid.fromCanvas(z(e));
|
|
2102
2080
|
e.evolution = t.evolution;
|
|
2103
2081
|
let n = this.pipelineOfMember(e);
|
|
2104
2082
|
e.visibility = n ? this.pipelineVisibility(n) : t.visibility;
|
|
@@ -2112,9 +2090,9 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2112
2090
|
}), n = this.grid.fromCanvas({
|
|
2113
2091
|
x: e.x + e.width,
|
|
2114
2092
|
y: e.y
|
|
2115
|
-
}), [r, i] =
|
|
2116
|
-
e.evolutionStart = r, e.evolutionEnd = i, e.evolution =
|
|
2117
|
-
for (let t of
|
|
2093
|
+
}), [r, i] = or(t.evolution, n.evolution);
|
|
2094
|
+
e.evolutionStart = r, e.evolutionEnd = i, e.evolution = ar((r + i) / 2), e.visibility = t.visibility;
|
|
2095
|
+
for (let t of Nn(this.elementRegistry, e)) t.visibility = e.visibility;
|
|
2118
2096
|
}
|
|
2119
2097
|
pipelineOfMember(e) {
|
|
2120
2098
|
if (!N(e) || !e.pipelineId) return;
|
|
@@ -2141,14 +2119,14 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2141
2119
|
return;
|
|
2142
2120
|
}
|
|
2143
2121
|
case "elements.move":
|
|
2144
|
-
this.completeMove(
|
|
2122
|
+
this.completeMove(nr(t), t.delta ?? {
|
|
2145
2123
|
x: 0,
|
|
2146
2124
|
y: 0
|
|
2147
2125
|
}, t);
|
|
2148
2126
|
return;
|
|
2149
2127
|
case "shape.create":
|
|
2150
2128
|
case "elements.create": {
|
|
2151
|
-
let e =
|
|
2129
|
+
let e = tr(t), n = this.clampDelta({
|
|
2152
2130
|
x: 0,
|
|
2153
2131
|
y: 0
|
|
2154
2132
|
}, e);
|
|
@@ -2165,12 +2143,12 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2165
2143
|
this.carryPipelinesOfMovedAnchors(e, t), this.reconcileMembership(e), this.shiftPassedEvolveTargets(n);
|
|
2166
2144
|
}
|
|
2167
2145
|
carryPipelinesOfMovedAnchors(e, t) {
|
|
2168
|
-
if (Math.abs(t.y) <
|
|
2146
|
+
if (Math.abs(t.y) < $n) return;
|
|
2169
2147
|
let n = new Set(e);
|
|
2170
2148
|
for (let r of e) {
|
|
2171
|
-
let e =
|
|
2149
|
+
let e = Fn(this.elementRegistry, r);
|
|
2172
2150
|
if (!e || n.has(e)) continue;
|
|
2173
|
-
let i = [e, ...
|
|
2151
|
+
let i = [e, ...Nn(this.elementRegistry, e).filter((e) => !n.has(e))], a = this.clampDelta({
|
|
2174
2152
|
x: 0,
|
|
2175
2153
|
y: t.y
|
|
2176
2154
|
}, i);
|
|
@@ -2179,8 +2157,8 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2179
2157
|
}
|
|
2180
2158
|
reconcileMembership(e) {
|
|
2181
2159
|
for (let t of e) {
|
|
2182
|
-
if (!N(t) ||
|
|
2183
|
-
let e =
|
|
2160
|
+
if (!N(t) || Fn(this.elementRegistry, t)) continue;
|
|
2161
|
+
let e = z(t), n = Ln(this.elementRegistry, t, e);
|
|
2184
2162
|
n ? (this.moveBy(t, {
|
|
2185
2163
|
x: 0,
|
|
2186
2164
|
y: n.y + n.height / 2 - e.y
|
|
@@ -2191,15 +2169,15 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2191
2169
|
}
|
|
2192
2170
|
}
|
|
2193
2171
|
releaseMembersOutside(e) {
|
|
2194
|
-
for (let t of
|
|
2195
|
-
let n =
|
|
2172
|
+
for (let t of Nn(this.elementRegistry, e)) {
|
|
2173
|
+
let n = z(t);
|
|
2196
2174
|
(n.x < e.x || n.x > e.x + e.width) && this.release(t);
|
|
2197
2175
|
}
|
|
2198
2176
|
}
|
|
2199
2177
|
release(e) {
|
|
2200
2178
|
this.wardleyModeling.updateProperties(e, {
|
|
2201
2179
|
pipelineId: void 0,
|
|
2202
|
-
visibility: this.grid.fromCanvas(
|
|
2180
|
+
visibility: this.grid.fromCanvas(z(e)).visibility
|
|
2203
2181
|
});
|
|
2204
2182
|
}
|
|
2205
2183
|
shiftPassedEvolveTargets(e) {
|
|
@@ -2217,7 +2195,7 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2217
2195
|
}
|
|
2218
2196
|
}
|
|
2219
2197
|
moveBy(e, t) {
|
|
2220
|
-
Math.abs(t.x) <
|
|
2198
|
+
Math.abs(t.x) < $n && Math.abs(t.y) < $n || this.modeling.moveShape(e, {
|
|
2221
2199
|
x: t.x,
|
|
2222
2200
|
y: t.y
|
|
2223
2201
|
});
|
|
@@ -2254,7 +2232,7 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2254
2232
|
case "drawing": {
|
|
2255
2233
|
let t = e.drawingPoints ?? [];
|
|
2256
2234
|
if (!t.length) return {
|
|
2257
|
-
...
|
|
2235
|
+
...z(e),
|
|
2258
2236
|
width: 0,
|
|
2259
2237
|
height: 0
|
|
2260
2238
|
};
|
|
@@ -2267,7 +2245,7 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2267
2245
|
};
|
|
2268
2246
|
}
|
|
2269
2247
|
default: return {
|
|
2270
|
-
...
|
|
2248
|
+
...z(e),
|
|
2271
2249
|
width: 0,
|
|
2272
2250
|
height: 0
|
|
2273
2251
|
};
|
|
@@ -2286,8 +2264,8 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2286
2264
|
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));
|
|
2287
2265
|
}
|
|
2288
2266
|
return {
|
|
2289
|
-
x:
|
|
2290
|
-
y:
|
|
2267
|
+
x: rr(e.x, r),
|
|
2268
|
+
y: rr(e.y, i)
|
|
2291
2269
|
};
|
|
2292
2270
|
}
|
|
2293
2271
|
horizontalPipelineBounds(e, t) {
|
|
@@ -2309,11 +2287,11 @@ var Bn = 1400, Vn = 450, Hn = 400, Un = 1500, Wn = "wardley-pipeline-drag", Gn =
|
|
|
2309
2287
|
};
|
|
2310
2288
|
}
|
|
2311
2289
|
spanInside(e, t, n) {
|
|
2312
|
-
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,
|
|
2290
|
+
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, Qn);
|
|
2313
2291
|
return [Math.min(o, a - s), s];
|
|
2314
2292
|
}
|
|
2315
2293
|
};
|
|
2316
|
-
function
|
|
2294
|
+
function tr(e) {
|
|
2317
2295
|
let t = [
|
|
2318
2296
|
...e.shape ? [e.shape] : [],
|
|
2319
2297
|
...e.shapes ?? [],
|
|
@@ -2321,37 +2299,36 @@ function rr(e) {
|
|
|
2321
2299
|
];
|
|
2322
2300
|
return [...new Set(t)].filter(j);
|
|
2323
2301
|
}
|
|
2324
|
-
function
|
|
2325
|
-
return e.closure ? Object.values(e.closure.allShapes).filter(j) :
|
|
2302
|
+
function nr(e) {
|
|
2303
|
+
return e.closure ? Object.values(e.closure.allShapes).filter(j) : tr(e);
|
|
2326
2304
|
}
|
|
2327
|
-
function
|
|
2305
|
+
function rr(e, t) {
|
|
2328
2306
|
return t.min > t.max ? e : Math.min(Math.max(e, t.min), t.max);
|
|
2329
2307
|
}
|
|
2330
|
-
var
|
|
2331
|
-
function
|
|
2308
|
+
var ir = .001;
|
|
2309
|
+
function ar(e) {
|
|
2332
2310
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2333
2311
|
}
|
|
2334
|
-
function
|
|
2335
|
-
let n =
|
|
2336
|
-
return [Math.max(0, Math.min(e, n -
|
|
2312
|
+
function or(e, t) {
|
|
2313
|
+
let n = ar(Math.max(t, e + ir));
|
|
2314
|
+
return [Math.max(0, Math.min(e, n - ir)), n];
|
|
2337
2315
|
}
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
function lr(e, t, n) {
|
|
2316
|
+
// src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
2317
|
+
function sr(e, t, n) {
|
|
2341
2318
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
2342
2319
|
}
|
|
2343
|
-
var
|
|
2320
|
+
var cr = class {
|
|
2344
2321
|
execute(e) {
|
|
2345
2322
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
2346
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
2323
|
+
for (let e of Object.keys(n)) i[e] = r[e], sr(r, e, n[e]);
|
|
2347
2324
|
return e.oldProperties = i, [t];
|
|
2348
2325
|
}
|
|
2349
2326
|
revert(e) {
|
|
2350
2327
|
let { element: t, oldProperties: n } = e, r = t;
|
|
2351
|
-
if (n) for (let e of Object.keys(n))
|
|
2328
|
+
if (n) for (let e of Object.keys(n)) sr(r, e, n[e]);
|
|
2352
2329
|
return [t];
|
|
2353
2330
|
}
|
|
2354
|
-
},
|
|
2331
|
+
}, lr = class {
|
|
2355
2332
|
projection;
|
|
2356
2333
|
static $inject = ["wardleyMapProjection"];
|
|
2357
2334
|
constructor(e) {
|
|
@@ -2359,56 +2336,55 @@ var ur = class {
|
|
|
2359
2336
|
}
|
|
2360
2337
|
execute(e) {
|
|
2361
2338
|
let t = this.projection.root()?.businessObject;
|
|
2362
|
-
return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(
|
|
2339
|
+
return t ? (e.oldSize = t.config.size, e.oldRawPassthrough = t.rawPassthrough, this.projection.apply(ur({
|
|
2363
2340
|
...t,
|
|
2364
2341
|
config: ht(t.config, e.size)
|
|
2365
2342
|
}, _t(t.rawPassthrough)))) : [];
|
|
2366
2343
|
}
|
|
2367
2344
|
revert(e) {
|
|
2368
2345
|
let t = this.projection.root()?.businessObject;
|
|
2369
|
-
return t ? this.projection.apply(
|
|
2346
|
+
return t ? this.projection.apply(ur({
|
|
2370
2347
|
...t,
|
|
2371
2348
|
config: ht(t.config, e.oldSize)
|
|
2372
2349
|
}, e.oldRawPassthrough)) : [];
|
|
2373
2350
|
}
|
|
2374
2351
|
};
|
|
2375
|
-
function
|
|
2352
|
+
function ur(e, t) {
|
|
2376
2353
|
let { rawPassthrough: n, ...r } = e;
|
|
2377
2354
|
return t ? {
|
|
2378
2355
|
...r,
|
|
2379
2356
|
rawPassthrough: t
|
|
2380
2357
|
} : r;
|
|
2381
2358
|
}
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
function gr(e) {
|
|
2359
|
+
// src/modeling/WardleyModeling.ts
|
|
2360
|
+
var dr = "element.updateProperties", fr = "wardley.map.resize", pr = "wardley.config.update";
|
|
2361
|
+
function mr(e) {
|
|
2386
2362
|
let t = {};
|
|
2387
2363
|
for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
|
|
2388
2364
|
return t;
|
|
2389
2365
|
}
|
|
2390
|
-
var
|
|
2366
|
+
var hr = class {
|
|
2391
2367
|
commandStack;
|
|
2392
2368
|
canvas;
|
|
2393
2369
|
static $inject = ["commandStack", "canvas"];
|
|
2394
2370
|
constructor(e, t) {
|
|
2395
|
-
this.commandStack = e, this.canvas = t, e.registerHandler(
|
|
2371
|
+
this.commandStack = e, this.canvas = t, e.registerHandler(dr, cr), e.registerHandler(fr, lr), e.registerHandler(pr, tn);
|
|
2396
2372
|
}
|
|
2397
2373
|
resizeMap(e) {
|
|
2398
2374
|
let t = this.currentConfig();
|
|
2399
|
-
t && !
|
|
2375
|
+
t && !gr(t.size, e) && this.commandStack.execute(fr, { size: e });
|
|
2400
2376
|
}
|
|
2401
2377
|
updateConfig(e) {
|
|
2402
2378
|
let t = this.currentConfig();
|
|
2403
2379
|
if (!t) return;
|
|
2404
2380
|
let n = t, r = Object.fromEntries(Object.entries(e).filter(([e, t]) => e !== "size" && JSON.stringify(n[e]) !== JSON.stringify(t)));
|
|
2405
|
-
Object.keys(r).length !== 0 && this.commandStack.execute(
|
|
2381
|
+
Object.keys(r).length !== 0 && this.commandStack.execute(pr, { properties: r });
|
|
2406
2382
|
}
|
|
2407
2383
|
currentConfig() {
|
|
2408
2384
|
return gt(this.canvas)?.businessObject?.config;
|
|
2409
2385
|
}
|
|
2410
2386
|
updateProperties(e, t) {
|
|
2411
|
-
this.commandStack.execute(
|
|
2387
|
+
this.commandStack.execute(dr, {
|
|
2412
2388
|
element: e,
|
|
2413
2389
|
properties: t
|
|
2414
2390
|
});
|
|
@@ -2426,11 +2402,11 @@ var _r = class {
|
|
|
2426
2402
|
} else this.updateProperties(e, { wardleyLabel: t });
|
|
2427
2403
|
}
|
|
2428
2404
|
evolveComponent(e, t, n = {}) {
|
|
2429
|
-
let r =
|
|
2430
|
-
r <= e.evolution || this.updateProperties(e, { movement:
|
|
2405
|
+
let r = _r(t);
|
|
2406
|
+
r <= e.evolution || this.updateProperties(e, { movement: mr({
|
|
2431
2407
|
...e.movement,
|
|
2432
2408
|
targetEvolution: r,
|
|
2433
|
-
...
|
|
2409
|
+
...mr({
|
|
2434
2410
|
newLabel: n.newLabel,
|
|
2435
2411
|
method: n.method
|
|
2436
2412
|
})
|
|
@@ -2455,15 +2431,14 @@ var _r = class {
|
|
|
2455
2431
|
this.updateProperties(e, { color: t });
|
|
2456
2432
|
}
|
|
2457
2433
|
};
|
|
2458
|
-
function
|
|
2434
|
+
function gr(e, t) {
|
|
2459
2435
|
return !e || !t ? e === t : e.width === t.width && e.height === t.height;
|
|
2460
2436
|
}
|
|
2461
|
-
function
|
|
2437
|
+
function _r(e) {
|
|
2462
2438
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
2463
2439
|
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
var br = 24, xr = [
|
|
2440
|
+
// src/modeling/WardleyCopyPaste.ts
|
|
2441
|
+
var vr = 24, yr = [
|
|
2467
2442
|
"wardleyType",
|
|
2468
2443
|
"evolution",
|
|
2469
2444
|
"visibility",
|
|
@@ -2480,13 +2455,13 @@ var br = 24, xr = [
|
|
|
2480
2455
|
"drawingPoints",
|
|
2481
2456
|
"closed",
|
|
2482
2457
|
"strokeStyle"
|
|
2483
|
-
],
|
|
2458
|
+
], br = [
|
|
2484
2459
|
"wardleyType",
|
|
2485
2460
|
"bidirectional",
|
|
2486
2461
|
"flowValue",
|
|
2487
2462
|
"linkLabel"
|
|
2488
2463
|
];
|
|
2489
|
-
function
|
|
2464
|
+
function xr(e, t) {
|
|
2490
2465
|
let n = {};
|
|
2491
2466
|
for (let r of t) {
|
|
2492
2467
|
let t = e[r];
|
|
@@ -2494,7 +2469,7 @@ function Cr(e, t) {
|
|
|
2494
2469
|
}
|
|
2495
2470
|
return n;
|
|
2496
2471
|
}
|
|
2497
|
-
var
|
|
2472
|
+
var Sr = class {
|
|
2498
2473
|
selection;
|
|
2499
2474
|
modeling;
|
|
2500
2475
|
elementFactory;
|
|
@@ -2526,14 +2501,14 @@ var wr = class {
|
|
|
2526
2501
|
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
2527
2502
|
sourceIdx: i,
|
|
2528
2503
|
targetIdx: a,
|
|
2529
|
-
props:
|
|
2504
|
+
props: xr(e, br)
|
|
2530
2505
|
}));
|
|
2531
2506
|
}
|
|
2532
2507
|
return this.clipboard = {
|
|
2533
2508
|
shapes: e.map((e) => ({
|
|
2534
2509
|
id: e.id,
|
|
2535
2510
|
...e.pipelineId ? { pipelineId: e.pipelineId } : {},
|
|
2536
|
-
props:
|
|
2511
|
+
props: xr(e, yr),
|
|
2537
2512
|
x: e.x,
|
|
2538
2513
|
y: e.y,
|
|
2539
2514
|
width: e.width,
|
|
@@ -2570,7 +2545,7 @@ var wr = class {
|
|
|
2570
2545
|
...structuredClone(e.props),
|
|
2571
2546
|
source: n[e.sourceIdx],
|
|
2572
2547
|
target: n[e.targetIdx],
|
|
2573
|
-
waypoints: [
|
|
2548
|
+
waypoints: [R(n[e.sourceIdx]), R(n[e.targetIdx])]
|
|
2574
2549
|
}))
|
|
2575
2550
|
};
|
|
2576
2551
|
}
|
|
@@ -2594,42 +2569,41 @@ var wr = class {
|
|
|
2594
2569
|
}
|
|
2595
2570
|
insertWithOffset(e) {
|
|
2596
2571
|
this.pasteCount++;
|
|
2597
|
-
let t =
|
|
2572
|
+
let t = vr * this.pasteCount, n = Cr(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
2598
2573
|
x: n.cx + t,
|
|
2599
2574
|
y: n.cy + t
|
|
2600
2575
|
}, this.canvas.getRootElement());
|
|
2601
2576
|
return this.selection.select(r), !0;
|
|
2602
2577
|
}
|
|
2603
2578
|
};
|
|
2604
|
-
function
|
|
2579
|
+
function Cr(e) {
|
|
2605
2580
|
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));
|
|
2606
2581
|
return {
|
|
2607
2582
|
cx: (t + r) / 2,
|
|
2608
2583
|
cy: (n + i) / 2
|
|
2609
2584
|
};
|
|
2610
2585
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
var Er = {
|
|
2586
|
+
// src/modeling/index.ts
|
|
2587
|
+
var wr = {
|
|
2614
2588
|
__depends__: [
|
|
2615
2589
|
me,
|
|
2616
2590
|
he,
|
|
2617
|
-
|
|
2591
|
+
Qt
|
|
2618
2592
|
],
|
|
2619
2593
|
__init__: ["wardleyModeling"],
|
|
2620
|
-
wardleyModeling: ["type",
|
|
2621
|
-
wardleyCopyPaste: ["type",
|
|
2622
|
-
},
|
|
2594
|
+
wardleyModeling: ["type", hr],
|
|
2595
|
+
wardleyCopyPaste: ["type", Sr]
|
|
2596
|
+
}, Tr = { evolutionGrid: ["type", bn] }, Er = {
|
|
2623
2597
|
__init__: ["evolutionConstraintBehavior"],
|
|
2624
2598
|
__depends__: [
|
|
2625
|
-
|
|
2626
|
-
|
|
2599
|
+
Tr,
|
|
2600
|
+
ln,
|
|
2627
2601
|
pe,
|
|
2628
|
-
|
|
2602
|
+
wr
|
|
2629
2603
|
],
|
|
2630
|
-
evolutionConstraintBehavior: ["type",
|
|
2631
|
-
},
|
|
2632
|
-
function
|
|
2604
|
+
evolutionConstraintBehavior: ["type", er]
|
|
2605
|
+
}, Dr = "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", Or = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", kr = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Ar = "M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z", jr = "M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z";
|
|
2606
|
+
function Mr(e, t, n, r, i) {
|
|
2633
2607
|
let a = T("g"), o = r / 24;
|
|
2634
2608
|
return w(a, {
|
|
2635
2609
|
transform: `translate(${t - r / 2}, ${n - r / 2}) scale(${o})`,
|
|
@@ -2637,19 +2611,14 @@ function Hr(e, t, n, r, i) {
|
|
|
2637
2611
|
stroke: "none"
|
|
2638
2612
|
}), C(a, w(T("path"), { d: e })), a;
|
|
2639
2613
|
}
|
|
2640
|
-
|
|
2641
|
-
function Kr(e) {
|
|
2614
|
+
function Nr(e) {
|
|
2642
2615
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2643
2616
|
}
|
|
2644
|
-
function
|
|
2645
|
-
|
|
2646
|
-
return `<svg viewBox="0 0 24 24" width="${Number(t)}" height="${Number(t)}" fill="currentColor" aria-hidden="true"><mask id="${n}" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="24"><rect width="24" height="24" fill="#fff"/><path d="${Ur}" fill="#000"/></mask><path d="${Kr(e)}" mask="url(#${n})"/><path d="${Gr}"/></svg>`;
|
|
2617
|
+
function Pr(e, t = 18) {
|
|
2618
|
+
return `<svg viewBox="0 0 24 24" width="${Number(t)}" height="${Number(t)}" fill="currentColor" aria-hidden="true"><path d="${Nr(e)}"/></svg>`;
|
|
2647
2619
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
}
|
|
2651
|
-
var Jr = 7.5;
|
|
2652
|
-
function Yr(e, t) {
|
|
2620
|
+
var Fr = 7.5;
|
|
2621
|
+
function Ir(e, t) {
|
|
2653
2622
|
let n = e.movement;
|
|
2654
2623
|
if (!n) return;
|
|
2655
2624
|
let r = t.toCanvas({
|
|
@@ -2661,26 +2630,26 @@ function Yr(e, t) {
|
|
|
2661
2630
|
evolution: n.targetEvolution
|
|
2662
2631
|
}).x - r.x;
|
|
2663
2632
|
}
|
|
2664
|
-
function
|
|
2665
|
-
return (e ?? "").length *
|
|
2633
|
+
function Lr(e) {
|
|
2634
|
+
return (e ?? "").length * Fr;
|
|
2666
2635
|
}
|
|
2667
|
-
function
|
|
2636
|
+
function Rr() {
|
|
2668
2637
|
return {
|
|
2669
2638
|
x: 22,
|
|
2670
2639
|
y: -4
|
|
2671
2640
|
};
|
|
2672
2641
|
}
|
|
2673
|
-
function
|
|
2674
|
-
return t > 0 && t <
|
|
2642
|
+
function zr(e, t) {
|
|
2643
|
+
return t > 0 && t < Lr(e.wardleyLabel) + 30 + 14;
|
|
2675
2644
|
}
|
|
2676
|
-
function
|
|
2677
|
-
let n =
|
|
2645
|
+
function Br(e, t) {
|
|
2646
|
+
let n = Rr();
|
|
2678
2647
|
if (e.labelOffset) return {
|
|
2679
2648
|
x: n.x + e.labelOffset.dx,
|
|
2680
2649
|
y: n.y + e.labelOffset.dy,
|
|
2681
2650
|
anchor: "start"
|
|
2682
2651
|
};
|
|
2683
|
-
if (t !== void 0 &&
|
|
2652
|
+
if (t !== void 0 && zr(e, t)) return {
|
|
2684
2653
|
x: -n.x,
|
|
2685
2654
|
y: n.y,
|
|
2686
2655
|
anchor: "end"
|
|
@@ -2692,14 +2661,14 @@ function $r(e, t) {
|
|
|
2692
2661
|
anchor: "start"
|
|
2693
2662
|
};
|
|
2694
2663
|
}
|
|
2695
|
-
function
|
|
2664
|
+
function Vr(e) {
|
|
2696
2665
|
return {
|
|
2697
2666
|
x: e + 15 + 7,
|
|
2698
2667
|
y: -4
|
|
2699
2668
|
};
|
|
2700
2669
|
}
|
|
2701
|
-
function
|
|
2702
|
-
let n =
|
|
2670
|
+
function Hr(e, t) {
|
|
2671
|
+
let n = Vr(t);
|
|
2703
2672
|
return e ? {
|
|
2704
2673
|
x: n.x + e.dx,
|
|
2705
2674
|
y: n.y + e.dy,
|
|
@@ -2714,30 +2683,29 @@ function ti(e, t) {
|
|
|
2714
2683
|
anchor: "start"
|
|
2715
2684
|
};
|
|
2716
2685
|
}
|
|
2717
|
-
function
|
|
2686
|
+
function Ur() {
|
|
2718
2687
|
return {
|
|
2719
2688
|
x: 0,
|
|
2720
2689
|
y: -17
|
|
2721
2690
|
};
|
|
2722
2691
|
}
|
|
2723
|
-
function
|
|
2724
|
-
let t =
|
|
2692
|
+
function Wr(e) {
|
|
2693
|
+
let t = Ur();
|
|
2725
2694
|
return {
|
|
2726
2695
|
x: t.x + (e.labelOffset?.dx ?? 0),
|
|
2727
2696
|
y: t.y + (e.labelOffset?.dy ?? 0),
|
|
2728
2697
|
anchor: "middle"
|
|
2729
2698
|
};
|
|
2730
2699
|
}
|
|
2731
|
-
function
|
|
2700
|
+
function Gr(e, t) {
|
|
2732
2701
|
let n = (e) => Math.max(-200, Math.min(200, Math.round(e))), r = {
|
|
2733
2702
|
dx: n(e) || 0,
|
|
2734
2703
|
dy: n(t) || 0
|
|
2735
2704
|
};
|
|
2736
2705
|
return r.dx === 0 && r.dy === 0 ? void 0 : r;
|
|
2737
2706
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-label-handle", ci = "data-label-role", li = 6, ui = class extends ge {
|
|
2707
|
+
// src/draw/WardleyRenderer.ts
|
|
2708
|
+
var Kr = 1500, B = "wardley-name-label", qr = "wardley-movement", Jr = "wardley-label-handle", Yr = "data-label-role", Xr = 6, Zr = class extends ge {
|
|
2741
2709
|
grid;
|
|
2742
2710
|
elementRegistry;
|
|
2743
2711
|
static $inject = [
|
|
@@ -2746,7 +2714,7 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2746
2714
|
"elementRegistry"
|
|
2747
2715
|
];
|
|
2748
2716
|
constructor(e, t, n) {
|
|
2749
|
-
super(e,
|
|
2717
|
+
super(e, Kr), this.grid = t, this.elementRegistry = n;
|
|
2750
2718
|
}
|
|
2751
2719
|
canRender(e) {
|
|
2752
2720
|
return j(e) || M(e);
|
|
@@ -2778,20 +2746,20 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2778
2746
|
return C(e, i), i;
|
|
2779
2747
|
}
|
|
2780
2748
|
drawConnection(e, t) {
|
|
2781
|
-
let n = t, r = n.wardleyType === "flow", i = r ? k.flow : k.dependency, [a, o] =
|
|
2749
|
+
let n = t, r = n.wardleyType === "flow", i = r ? k.flow : k.dependency, [a, o] = ii(n), s = w(T("polyline"), {
|
|
2782
2750
|
points: `${a.x},${a.y} ${o.x},${o.y}`,
|
|
2783
2751
|
fill: "none",
|
|
2784
2752
|
stroke: i,
|
|
2785
2753
|
"stroke-width": r ? 2.5 : 1.5,
|
|
2786
2754
|
"stroke-linecap": "round"
|
|
2787
2755
|
});
|
|
2788
|
-
C(e, s), r && (C(e,
|
|
2756
|
+
C(e, s), r && (C(e, ni(a, o, i, 11, 5)), n.bidirectional && C(e, ni(o, a, i, 11, 5)));
|
|
2789
2757
|
let c = (a.x + o.x) / 2, l = (a.y + o.y) / 2;
|
|
2790
|
-
return r && n.flowValue && C(e,
|
|
2758
|
+
return r && n.flowValue && C(e, H(n.flowValue, c, l - 5, {
|
|
2791
2759
|
"text-anchor": "middle",
|
|
2792
2760
|
"font-size": 11,
|
|
2793
2761
|
fill: k.flow
|
|
2794
|
-
})), n.linkLabel && C(e,
|
|
2762
|
+
})), n.linkLabel && C(e, H(n.linkLabel, c, l + (n.flowValue ? 12 : -4), {
|
|
2795
2763
|
"text-anchor": "middle",
|
|
2796
2764
|
"font-size": 11,
|
|
2797
2765
|
"font-style": "italic",
|
|
@@ -2807,68 +2775,68 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2807
2775
|
return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
|
|
2808
2776
|
}
|
|
2809
2777
|
drawComponent(e, t) {
|
|
2810
|
-
let n = t.width / 2, r = t.height / 2, i = t.decorators, a =
|
|
2811
|
-
a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia &&
|
|
2812
|
-
let o = t.color ?? k.stroke, s =
|
|
2778
|
+
let n = t.width / 2, r = t.height / 2, i = t.decorators, a = Ir(t, this.grid);
|
|
2779
|
+
a !== void 0 && this.drawMovement(e, t, n, r, a), i?.inertia && Qr(e, n, r);
|
|
2780
|
+
let o = t.color ?? k.stroke, s = V(n, r, 15, {
|
|
2813
2781
|
fill: k.componentFill,
|
|
2814
2782
|
stroke: o,
|
|
2815
2783
|
"stroke-width": 2
|
|
2816
2784
|
});
|
|
2817
|
-
return C(e, s), t.movement && C(e,
|
|
2785
|
+
return C(e, s), t.movement && C(e, V(n, r, 12, {
|
|
2818
2786
|
fill: "none",
|
|
2819
2787
|
stroke: o,
|
|
2820
2788
|
"stroke-width": 1.5
|
|
2821
|
-
})),
|
|
2789
|
+
})), $r(e, n, r, o, i), ei(e, t, n, r, Br(t, a)), s;
|
|
2822
2790
|
}
|
|
2823
2791
|
drawMovement(e, t, n, r, i) {
|
|
2824
2792
|
let a = t.movement;
|
|
2825
2793
|
if (!a) return;
|
|
2826
|
-
let o = w(T("g"), { class:
|
|
2794
|
+
let o = w(T("g"), { class: qr });
|
|
2827
2795
|
C(e, o);
|
|
2828
2796
|
let s = n + i, c = s - (Math.sign(i) || 1) * 17;
|
|
2829
|
-
C(o,
|
|
2797
|
+
C(o, ti(n, r, c, r, {
|
|
2830
2798
|
stroke: k.plotBackground,
|
|
2831
2799
|
"stroke-width": 4,
|
|
2832
2800
|
"stroke-linecap": "butt",
|
|
2833
2801
|
class: "wardley-movement-underlay"
|
|
2834
|
-
})), C(o,
|
|
2802
|
+
})), C(o, ti(n, r, c, r, {
|
|
2835
2803
|
stroke: k.movement,
|
|
2836
2804
|
"stroke-width": 1.5,
|
|
2837
2805
|
"stroke-dasharray": "6 4"
|
|
2838
|
-
})), C(o,
|
|
2806
|
+
})), C(o, ni({
|
|
2839
2807
|
x: n,
|
|
2840
2808
|
y: r
|
|
2841
2809
|
}, {
|
|
2842
2810
|
x: c,
|
|
2843
2811
|
y: r
|
|
2844
|
-
}, k.movement)), C(o,
|
|
2812
|
+
}, k.movement)), C(o, V(s, r, 15, {
|
|
2845
2813
|
fill: k.paper,
|
|
2846
2814
|
stroke: k.movement,
|
|
2847
2815
|
"stroke-width": 2,
|
|
2848
2816
|
class: "wardley-evolve-handle"
|
|
2849
2817
|
}));
|
|
2850
|
-
let l =
|
|
2851
|
-
C(o,
|
|
2818
|
+
let l = Hr(a.labelOffset, i);
|
|
2819
|
+
C(o, H(a.newLabel ?? t.wardleyLabel, n + l.x, r + l.y, {
|
|
2852
2820
|
"font-weight": "500",
|
|
2853
2821
|
fill: k.movement,
|
|
2854
2822
|
"text-anchor": l.anchor,
|
|
2855
|
-
class: `wardley-movement-label ${
|
|
2856
|
-
[
|
|
2857
|
-
})), a.method && C(o,
|
|
2823
|
+
class: `wardley-movement-label ${Jr}`,
|
|
2824
|
+
[Yr]: "movement"
|
|
2825
|
+
})), a.method && C(o, H(a.method, n + l.x, r + l.y + 15, {
|
|
2858
2826
|
"font-size": 10.5,
|
|
2859
2827
|
fill: k.movement,
|
|
2860
2828
|
"text-anchor": l.anchor
|
|
2861
2829
|
}));
|
|
2862
2830
|
}
|
|
2863
2831
|
drawAnchor(e, t) {
|
|
2864
|
-
let n = t.width / 2, r = t.height / 2, i =
|
|
2832
|
+
let n = t.width / 2, r = t.height / 2, i = Mr(Dr, n, r, 26, t.color ?? k.ink);
|
|
2865
2833
|
C(e, i);
|
|
2866
|
-
let a =
|
|
2867
|
-
return C(e,
|
|
2834
|
+
let a = Wr(t);
|
|
2835
|
+
return C(e, H(t.wardleyLabel, n + a.x, r + a.y, {
|
|
2868
2836
|
"text-anchor": a.anchor,
|
|
2869
2837
|
"font-weight": "700",
|
|
2870
|
-
class: `${
|
|
2871
|
-
[
|
|
2838
|
+
class: `${B} ${Jr}`,
|
|
2839
|
+
[Yr]: "name",
|
|
2872
2840
|
...t.color ? { fill: t.color } : {}
|
|
2873
2841
|
})), i;
|
|
2874
2842
|
}
|
|
@@ -2892,22 +2860,22 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2892
2860
|
fill: k.componentFill,
|
|
2893
2861
|
stroke: r ?? k.stroke,
|
|
2894
2862
|
"stroke-width": 2
|
|
2895
|
-
})), C(e,
|
|
2863
|
+
})), C(e, H(t.wardleyLabel, n / 2 + 8 + 6, -4, {
|
|
2896
2864
|
"font-weight": "500",
|
|
2897
|
-
class:
|
|
2865
|
+
class: B,
|
|
2898
2866
|
...r ? { fill: r } : {}
|
|
2899
2867
|
}))), i;
|
|
2900
2868
|
}
|
|
2901
2869
|
drawNote(e, t) {
|
|
2902
2870
|
let n = t.color, r = (t.wardleyLabel ?? "").split("\n"), i = t.width / 2, a = t.height / 2 - (r.length - 1) * 17 / 2 + 4, o = {
|
|
2903
2871
|
"text-anchor": "middle",
|
|
2904
|
-
class:
|
|
2872
|
+
class: B,
|
|
2905
2873
|
fill: n ?? k.noteText,
|
|
2906
2874
|
"font-style": "italic",
|
|
2907
2875
|
...n ? { "font-weight": "600" } : {}
|
|
2908
2876
|
}, s;
|
|
2909
2877
|
return r.forEach((t, n) => {
|
|
2910
|
-
let r =
|
|
2878
|
+
let r = H(t, i, a + n * 17, o);
|
|
2911
2879
|
C(e, r), s ||= r;
|
|
2912
2880
|
}), s ?? T("text");
|
|
2913
2881
|
}
|
|
@@ -2927,8 +2895,8 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2927
2895
|
let o = this.grid.toCanvas({
|
|
2928
2896
|
visibility: 1,
|
|
2929
2897
|
evolution: 0
|
|
2930
|
-
}).y, s = t.y -
|
|
2931
|
-
return C(e,
|
|
2898
|
+
}).y, s = t.y - Xr - A.label >= o;
|
|
2899
|
+
return C(e, H(ze[n] ?? n, s ? 4 : 10, s ? -6 : 18, {
|
|
2932
2900
|
fill: i,
|
|
2933
2901
|
"font-weight": "700",
|
|
2934
2902
|
"letter-spacing": "0.04em",
|
|
@@ -2936,25 +2904,25 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2936
2904
|
})), a;
|
|
2937
2905
|
}
|
|
2938
2906
|
drawAnnotation(e, t) {
|
|
2939
|
-
let n = t.width / 2, r = t.height / 2, i =
|
|
2907
|
+
let n = t.width / 2, r = t.height / 2, i = V(n, r, 10, {
|
|
2940
2908
|
fill: k.annotationFill,
|
|
2941
2909
|
stroke: t.color ?? k.stroke,
|
|
2942
2910
|
"stroke-width": 1.25
|
|
2943
2911
|
});
|
|
2944
|
-
return C(e, i), C(e,
|
|
2912
|
+
return C(e, i), C(e, H(String(t.annotationNumber ?? ""), n, r + 4, {
|
|
2945
2913
|
"text-anchor": "middle",
|
|
2946
2914
|
"font-size": 11,
|
|
2947
2915
|
"font-weight": "700"
|
|
2948
|
-
}, !1)), t.wardleyLabel && C(e,
|
|
2916
|
+
}, !1)), t.wardleyLabel && C(e, H(t.wardleyLabel, n + 15, r + 4, {
|
|
2949
2917
|
"font-size": 12,
|
|
2950
2918
|
fill: k.noteText
|
|
2951
2919
|
})), i;
|
|
2952
2920
|
}
|
|
2953
2921
|
drawAccelerator(e, t) {
|
|
2954
|
-
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a =
|
|
2955
|
-
return C(e, a), t.wardleyLabel && C(e,
|
|
2922
|
+
let n = t.width / 2, r = t.height / 2, i = t.acceleratorDirection !== "deaccelerate", a = Mr(i ? Ar : jr, n, r, 24, t.color ?? (i ? k.accelerator : k.deaccelerator));
|
|
2923
|
+
return C(e, a), t.wardleyLabel && C(e, H(t.wardleyLabel, n + 15, r + 5, {
|
|
2956
2924
|
"font-size": 12,
|
|
2957
|
-
class:
|
|
2925
|
+
class: B
|
|
2958
2926
|
})), a;
|
|
2959
2927
|
}
|
|
2960
2928
|
drawSubmap(e, t) {
|
|
@@ -2977,23 +2945,23 @@ var ai = 1500, z = "wardley-name-label", oi = "wardley-movement", si = "wardley-
|
|
|
2977
2945
|
fill: "none",
|
|
2978
2946
|
stroke: i,
|
|
2979
2947
|
"stroke-width": 1
|
|
2980
|
-
})), C(e,
|
|
2948
|
+
})), C(e, H(t.wardleyLabel, n + 16 + 6, r - 6, {
|
|
2981
2949
|
"font-weight": "500",
|
|
2982
|
-
class:
|
|
2950
|
+
class: B,
|
|
2983
2951
|
...t.color ? { fill: t.color } : {}
|
|
2984
2952
|
})), a;
|
|
2985
2953
|
}
|
|
2986
2954
|
};
|
|
2987
|
-
function
|
|
2955
|
+
function Qr(e, t, n) {
|
|
2988
2956
|
let r = t + 15 + 3;
|
|
2989
|
-
C(e,
|
|
2957
|
+
C(e, ti(r, n - 13, r, n + 13, {
|
|
2990
2958
|
stroke: k.inertia,
|
|
2991
2959
|
"stroke-width": 3,
|
|
2992
2960
|
"stroke-linecap": "round"
|
|
2993
2961
|
}));
|
|
2994
2962
|
}
|
|
2995
|
-
function
|
|
2996
|
-
if (i?.ecosystem && C(e,
|
|
2963
|
+
function $r(e, t, n, r, i) {
|
|
2964
|
+
if (i?.ecosystem && C(e, V(t, n, 18.5, {
|
|
2997
2965
|
fill: "none",
|
|
2998
2966
|
stroke: r,
|
|
2999
2967
|
"stroke-width": 1.25,
|
|
@@ -3003,25 +2971,25 @@ function fi(e, t, n, r, i) {
|
|
|
3003
2971
|
[0, -3.8],
|
|
3004
2972
|
[-3.4, 2.4],
|
|
3005
2973
|
[3.4, 2.4]
|
|
3006
|
-
]) C(e,
|
|
2974
|
+
]) C(e, V(t + i, n + a, 1.7, { fill: r }));
|
|
3007
2975
|
}
|
|
3008
|
-
function
|
|
2976
|
+
function ei(e, t, n, r, i) {
|
|
3009
2977
|
let a = n + i.x, o = r + i.y;
|
|
3010
|
-
C(e,
|
|
2978
|
+
C(e, H(t.wardleyLabel, a, o, {
|
|
3011
2979
|
"font-weight": "500",
|
|
3012
2980
|
"text-anchor": i.anchor,
|
|
3013
|
-
class: `${
|
|
3014
|
-
[
|
|
2981
|
+
class: `${B} ${Jr}`,
|
|
2982
|
+
[Yr]: "name",
|
|
3015
2983
|
...t.color ? { fill: t.color } : {}
|
|
3016
2984
|
}));
|
|
3017
2985
|
let s = t.decorators?.method;
|
|
3018
|
-
s && C(e,
|
|
2986
|
+
s && C(e, H(s, a, o + 15, {
|
|
3019
2987
|
"font-size": 10.5,
|
|
3020
2988
|
"text-anchor": i.anchor,
|
|
3021
2989
|
fill: k.axisText
|
|
3022
2990
|
}));
|
|
3023
2991
|
}
|
|
3024
|
-
function
|
|
2992
|
+
function V(e, t, n, r) {
|
|
3025
2993
|
return w(T("circle"), {
|
|
3026
2994
|
cx: e,
|
|
3027
2995
|
cy: t,
|
|
@@ -3030,7 +2998,7 @@ function B(e, t, n, r) {
|
|
|
3030
2998
|
...r
|
|
3031
2999
|
});
|
|
3032
3000
|
}
|
|
3033
|
-
function
|
|
3001
|
+
function ti(e, t, n, r, i) {
|
|
3034
3002
|
return w(T("line"), {
|
|
3035
3003
|
x1: e,
|
|
3036
3004
|
y1: t,
|
|
@@ -3039,7 +3007,7 @@ function mi(e, t, n, r, i) {
|
|
|
3039
3007
|
...i
|
|
3040
3008
|
});
|
|
3041
3009
|
}
|
|
3042
|
-
function
|
|
3010
|
+
function H(e, t, n, r = {}, i = !0) {
|
|
3043
3011
|
let a = i ? {
|
|
3044
3012
|
stroke: k.paper,
|
|
3045
3013
|
"stroke-width": 3.5,
|
|
@@ -3056,17 +3024,17 @@ function V(e, t, n, r = {}, i = !0) {
|
|
|
3056
3024
|
});
|
|
3057
3025
|
return o.textContent = e, o;
|
|
3058
3026
|
}
|
|
3059
|
-
function
|
|
3027
|
+
function ni(e, t, n, r = 10, i = 5) {
|
|
3060
3028
|
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)}`;
|
|
3061
3029
|
return w(T("polygon"), {
|
|
3062
3030
|
points: c,
|
|
3063
3031
|
fill: n
|
|
3064
3032
|
});
|
|
3065
3033
|
}
|
|
3066
|
-
function
|
|
3034
|
+
function ri(e) {
|
|
3067
3035
|
return e.wardleyType === "component" ? 17 : e.wardleyType === "anchor" ? 14 : e.wardleyType === "pipeline" ? 10 : Math.min(e.width, e.height) / 2;
|
|
3068
3036
|
}
|
|
3069
|
-
function
|
|
3037
|
+
function ii(e) {
|
|
3070
3038
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
3071
3039
|
if (!t || !n) {
|
|
3072
3040
|
let e = r[0] ?? {
|
|
@@ -3075,7 +3043,7 @@ function _i(e) {
|
|
|
3075
3043
|
};
|
|
3076
3044
|
return [e, r[r.length - 1] ?? e];
|
|
3077
3045
|
}
|
|
3078
|
-
let i =
|
|
3046
|
+
let i = R(t), a = R(n), o = a.x - i.x, s = a.y - i.y, c = Math.hypot(o, s) || 1, l = o / c, u = s / c, d = ri(t), f = ri(n);
|
|
3079
3047
|
return c <= d + f + 2 ? [i, a] : [{
|
|
3080
3048
|
x: i.x + l * d,
|
|
3081
3049
|
y: i.y + u * d
|
|
@@ -3084,37 +3052,36 @@ function _i(e) {
|
|
|
3084
3052
|
y: a.y - u * f
|
|
3085
3053
|
}];
|
|
3086
3054
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
var vi = {
|
|
3055
|
+
// src/draw/index.ts
|
|
3056
|
+
var ai = {
|
|
3090
3057
|
__init__: ["wardleyRenderer"],
|
|
3091
|
-
wardleyRenderer: ["type",
|
|
3092
|
-
},
|
|
3058
|
+
wardleyRenderer: ["type", Zr]
|
|
3059
|
+
}, oi = class extends sn {
|
|
3093
3060
|
_getModules() {
|
|
3094
3061
|
return [
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3062
|
+
mn,
|
|
3063
|
+
Tr,
|
|
3064
|
+
ai,
|
|
3098
3065
|
mt
|
|
3099
3066
|
];
|
|
3100
3067
|
}
|
|
3101
|
-
},
|
|
3102
|
-
function
|
|
3068
|
+
}, si = 180, ci = 80, li = 120, ui = 96, di = .5, fi = (e, t, n) => e < t ? t : e > n ? n : e;
|
|
3069
|
+
function pi(e, t, n, r) {
|
|
3103
3070
|
let i = n.min - n.padBefore, a = n.max + n.padAfter;
|
|
3104
|
-
return !r && t >= n.max - n.min ?
|
|
3071
|
+
return !r && t >= n.max - n.min ? fi(e, Math.min(n.max - t, i), Math.max(n.min, a - t)) : t <= a - i ? fi(e, i, a - t) : (i + a) / 2 - t / 2;
|
|
3105
3072
|
}
|
|
3106
|
-
function
|
|
3073
|
+
function mi(e, t, n) {
|
|
3107
3074
|
let r = e - n.after;
|
|
3108
3075
|
return {
|
|
3109
3076
|
lowest: Math.min(t.min - n.before - n.slack, t.max - r - n.slack),
|
|
3110
3077
|
highest: Math.max(t.max - r + n.slack, t.min - n.before + n.slack)
|
|
3111
3078
|
};
|
|
3112
3079
|
}
|
|
3113
|
-
function
|
|
3114
|
-
let a =
|
|
3115
|
-
return
|
|
3080
|
+
function hi(e, t, n, r, i) {
|
|
3081
|
+
let a = mi(t, n, i), o = mi(t, r, i);
|
|
3082
|
+
return fi(e, Math.min(a.lowest, o.lowest), Math.max(a.highest, o.highest));
|
|
3116
3083
|
}
|
|
3117
|
-
var
|
|
3084
|
+
var gi = class {
|
|
3118
3085
|
canvas;
|
|
3119
3086
|
grid;
|
|
3120
3087
|
static $inject = [
|
|
@@ -3146,7 +3113,7 @@ var ki = class {
|
|
|
3146
3113
|
freeArea(e) {
|
|
3147
3114
|
let t = this.freeRect?.insets(), n = t ? e.scale ?? this.canvas.zoom() : 0;
|
|
3148
3115
|
if (!t || !(n > 0)) return;
|
|
3149
|
-
let r =
|
|
3116
|
+
let r = ui / n, i = (e, t, i) => e * n - t - i > 0 ? {
|
|
3150
3117
|
before: t / n,
|
|
3151
3118
|
after: i / n,
|
|
3152
3119
|
slack: r
|
|
@@ -3171,26 +3138,26 @@ var ki = class {
|
|
|
3171
3138
|
min: r.y,
|
|
3172
3139
|
max: r.y + r.height
|
|
3173
3140
|
}, o = this.freeArea(n), s = this.grid.outerBounds(), c = {
|
|
3174
|
-
top:
|
|
3175
|
-
right:
|
|
3176
|
-
bottom:
|
|
3177
|
-
left:
|
|
3178
|
-
}, l = o ?
|
|
3141
|
+
top: si,
|
|
3142
|
+
right: li,
|
|
3143
|
+
bottom: ci,
|
|
3144
|
+
left: li
|
|
3145
|
+
}, l = o ? hi(n.x, n.width, i, {
|
|
3179
3146
|
min: s.x,
|
|
3180
3147
|
max: s.x + s.width
|
|
3181
|
-
}, o.x) :
|
|
3148
|
+
}, o.x) : pi(n.x, n.width, {
|
|
3182
3149
|
...i,
|
|
3183
3150
|
padBefore: c.left,
|
|
3184
3151
|
padAfter: c.right
|
|
3185
|
-
}, t), u = o ?
|
|
3152
|
+
}, t), u = o ? hi(n.y, n.height, a, {
|
|
3186
3153
|
min: s.y,
|
|
3187
3154
|
max: s.y + s.height
|
|
3188
|
-
}, o.y) :
|
|
3155
|
+
}, o.y) : pi(n.y, n.height, {
|
|
3189
3156
|
...a,
|
|
3190
3157
|
padBefore: c.top,
|
|
3191
3158
|
padAfter: c.bottom
|
|
3192
3159
|
}, t);
|
|
3193
|
-
if (!(Math.abs(l - n.x) <
|
|
3160
|
+
if (!(Math.abs(l - n.x) < di && Math.abs(u - n.y) < di)) {
|
|
3194
3161
|
this.applying = !0;
|
|
3195
3162
|
try {
|
|
3196
3163
|
this.canvas.viewbox({
|
|
@@ -3204,10 +3171,10 @@ var ki = class {
|
|
|
3204
3171
|
}
|
|
3205
3172
|
}
|
|
3206
3173
|
}
|
|
3207
|
-
},
|
|
3174
|
+
}, _i = {
|
|
3208
3175
|
__init__: ["panConstraint"],
|
|
3209
|
-
panConstraint: ["type",
|
|
3210
|
-
},
|
|
3176
|
+
panConstraint: ["type", gi]
|
|
3177
|
+
}, vi = class {
|
|
3211
3178
|
canvas;
|
|
3212
3179
|
config;
|
|
3213
3180
|
static $inject = ["canvas", "config.wardleyFreeRect"];
|
|
@@ -3237,7 +3204,7 @@ var ki = class {
|
|
|
3237
3204
|
y: t.y + a(i, n.top, n.bottom) / t.scale
|
|
3238
3205
|
};
|
|
3239
3206
|
}
|
|
3240
|
-
},
|
|
3207
|
+
}, yi = { wardleyFreeRect: ["type", vi] }, bi = class extends oi {
|
|
3241
3208
|
_getModules() {
|
|
3242
3209
|
return [
|
|
3243
3210
|
...super._getModules(),
|
|
@@ -3245,11 +3212,11 @@ var ki = class {
|
|
|
3245
3212
|
ve,
|
|
3246
3213
|
ye,
|
|
3247
3214
|
be,
|
|
3248
|
-
|
|
3249
|
-
|
|
3215
|
+
yi,
|
|
3216
|
+
_i
|
|
3250
3217
|
];
|
|
3251
3218
|
}
|
|
3252
|
-
},
|
|
3219
|
+
}, xi = class {
|
|
3253
3220
|
static $inject = [
|
|
3254
3221
|
"eventBus",
|
|
3255
3222
|
"canvas",
|
|
@@ -3268,37 +3235,37 @@ var ki = class {
|
|
|
3268
3235
|
if (e.element === i) return n.activateLasso(r), !1;
|
|
3269
3236
|
});
|
|
3270
3237
|
}
|
|
3271
|
-
},
|
|
3238
|
+
}, Si = {
|
|
3272
3239
|
__depends__: [Ae],
|
|
3273
3240
|
__init__: ["wardleyLassoBehavior"],
|
|
3274
|
-
wardleyLassoBehavior: ["type",
|
|
3275
|
-
},
|
|
3241
|
+
wardleyLassoBehavior: ["type", xi]
|
|
3242
|
+
}, Ci = /* @__PURE__ */ new Set([
|
|
3276
3243
|
"component",
|
|
3277
3244
|
"anchor",
|
|
3278
3245
|
"submap",
|
|
3279
3246
|
"pipeline"
|
|
3280
|
-
]),
|
|
3281
|
-
function
|
|
3282
|
-
return j(e) &&
|
|
3247
|
+
]), wi = /* @__PURE__ */ new Set(["e", "w"]);
|
|
3248
|
+
function Ti(e) {
|
|
3249
|
+
return j(e) && Ci.has(e.wardleyType);
|
|
3283
3250
|
}
|
|
3284
|
-
function
|
|
3251
|
+
function Ei(e, t) {
|
|
3285
3252
|
return (e.outgoing ?? []).some((e) => e.target === t) || (e.incoming ?? []).some((e) => e.source === t);
|
|
3286
3253
|
}
|
|
3287
|
-
var
|
|
3254
|
+
var Di = class extends ce {
|
|
3288
3255
|
static $inject = ["eventBus"];
|
|
3289
3256
|
constructor(e) {
|
|
3290
3257
|
super(e);
|
|
3291
3258
|
}
|
|
3292
3259
|
init() {
|
|
3293
|
-
this.addRule("connection.start", (e) =>
|
|
3260
|
+
this.addRule("connection.start", (e) => Ti(e.source)), this.addRule("connection.create", (e) => {
|
|
3294
3261
|
let { source: t, target: n } = e;
|
|
3295
|
-
return !
|
|
3296
|
-
}), 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) => P(e.shape) ? !e.direction ||
|
|
3262
|
+
return !Ti(t) || !Ti(n) || t === n || Ei(t, n) ? !1 : { wardleyType: "dependency" };
|
|
3263
|
+
}), 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) => P(e.shape) ? !e.direction || wi.has(e.direction) : tt(e.shape));
|
|
3297
3264
|
}
|
|
3298
|
-
},
|
|
3265
|
+
}, Oi = {
|
|
3299
3266
|
__init__: ["wardleyRules"],
|
|
3300
|
-
wardleyRules: ["type",
|
|
3301
|
-
},
|
|
3267
|
+
wardleyRules: ["type", Di]
|
|
3268
|
+
}, ki = {
|
|
3302
3269
|
__init__: ["stageSnapping"],
|
|
3303
3270
|
stageSnapping: ["type", class {
|
|
3304
3271
|
static $inject = [
|
|
@@ -3338,20 +3305,20 @@ var Bi = class extends ce {
|
|
|
3338
3305
|
});
|
|
3339
3306
|
}
|
|
3340
3307
|
}]
|
|
3341
|
-
},
|
|
3342
|
-
draw:
|
|
3343
|
-
lasso:
|
|
3344
|
-
component:
|
|
3345
|
-
market:
|
|
3346
|
-
ecosystem:
|
|
3347
|
-
anchor:
|
|
3348
|
-
pipeline:
|
|
3349
|
-
note:
|
|
3350
|
-
annotation:
|
|
3351
|
-
accelerator:
|
|
3352
|
-
deaccelerator:
|
|
3353
|
-
submap:
|
|
3354
|
-
},
|
|
3308
|
+
}, U = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="wardley-palette-svg">${e}</svg>`, Ai = (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>`, ji = "<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\"/>", Mi = "<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>", Ni = (e = "") => `<circle cx="12" cy="12" r="7" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="2"/>${e}`, Pi = (e, t) => `<text x="12" text-anchor="middle" font-family="${A.family}" ${t}>${e}</text>`, W = {
|
|
3309
|
+
draw: Ai(Mi),
|
|
3310
|
+
lasso: Ai(ji),
|
|
3311
|
+
component: U(Ni()),
|
|
3312
|
+
market: U(Ni(`<circle cx="12" cy="10" r="1.4" fill="${k.stroke}"/><circle cx="10.2" cy="13.4" r="1.4" fill="${k.stroke}"/><circle cx="13.8" cy="13.4" r="1.4" fill="${k.stroke}"/>`)),
|
|
3313
|
+
ecosystem: U(Ni(`<circle cx="12" cy="12" r="10" fill="none" stroke="${k.stroke}" stroke-width="1.25" stroke-dasharray="1.5 3" stroke-linecap="round"/>`)),
|
|
3314
|
+
anchor: U(`<path d="${Dr}" fill="${k.ink}"/>`),
|
|
3315
|
+
pipeline: U(`<rect x="9.5" y="2.5" width="5.5" height="5.5" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.5"/><rect x="2" y="10" width="20" height="9" rx="2" fill="none" stroke="${k.pipeline}" stroke-width="1.25" stroke-dasharray="3 2"/><circle cx="7" cy="14.5" r="2.2" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.2"/><circle cx="17" cy="14.5" r="2.2" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="1.2"/>`),
|
|
3316
|
+
note: U(`<g fill="none" stroke="${k.noteText}" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4h14v11l-5 5H5z" fill="${k.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>`),
|
|
3317
|
+
annotation: U(`<circle cx="12" cy="12" r="8" fill="${k.annotationFill}" stroke="${k.stroke}" stroke-width="1.25"/>` + Pi("1", `y="16" font-size="11" font-weight="700" fill="${k.stroke}"`)),
|
|
3318
|
+
accelerator: U(`<path d="${Ar}" fill="${k.accelerator}"/>`),
|
|
3319
|
+
deaccelerator: U(`<path d="${jr}" fill="${k.deaccelerator}"/>`),
|
|
3320
|
+
submap: U(`<rect x="4" y="4" width="16" height="16" rx="3" fill="${k.componentFill}" stroke="${k.stroke}" stroke-width="2"/><rect x="7.5" y="7.5" width="9" height="9" rx="1.5" fill="none" stroke="${k.stroke}" stroke-width="1"/>`)
|
|
3321
|
+
}, Fi = {
|
|
3355
3322
|
pioneers: "P",
|
|
3356
3323
|
settlers: "S",
|
|
3357
3324
|
townplanners: "T"
|
|
@@ -3360,32 +3327,31 @@ var Bi = class extends ce {
|
|
|
3360
3327
|
* straight segment. Lucide (lucide-static 1.59.0) @license ISC
|
|
3361
3328
|
* Copyright (c) 2026 Lucide Icons and Contributors
|
|
3362
3329
|
* Full notice: README.md of @miragon/wardley-renderer */
|
|
3363
|
-
function
|
|
3330
|
+
function Ii(e) {
|
|
3364
3331
|
let t = Re[e] ?? {
|
|
3365
3332
|
fill: k.band,
|
|
3366
3333
|
stroke: k.dependency
|
|
3367
|
-
}, n =
|
|
3368
|
-
return
|
|
3334
|
+
}, n = Fi[e] ?? "";
|
|
3335
|
+
return U(`<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"/>` + Pi(n, `y="15.3" font-size="9" font-weight="700" fill="${k.ink}"`));
|
|
3369
3336
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
3337
|
+
// src/palette/WardleyPaletteProvider.ts
|
|
3338
|
+
var G = "wardley-1-blocks", Li = "wardley-2-strategy", Ri = [
|
|
3373
3339
|
{
|
|
3374
3340
|
key: "component",
|
|
3375
3341
|
type: "component",
|
|
3376
3342
|
label: "Component",
|
|
3377
3343
|
title: "Component",
|
|
3378
3344
|
shortcut: "C",
|
|
3379
|
-
icon:
|
|
3380
|
-
group:
|
|
3345
|
+
icon: W.component,
|
|
3346
|
+
group: G
|
|
3381
3347
|
},
|
|
3382
3348
|
{
|
|
3383
3349
|
key: "market",
|
|
3384
3350
|
type: "component",
|
|
3385
3351
|
label: "Market",
|
|
3386
3352
|
title: "Market component",
|
|
3387
|
-
icon:
|
|
3388
|
-
group:
|
|
3353
|
+
icon: W.market,
|
|
3354
|
+
group: G,
|
|
3389
3355
|
extra: { market: !0 }
|
|
3390
3356
|
},
|
|
3391
3357
|
{
|
|
@@ -3393,8 +3359,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3393
3359
|
type: "component",
|
|
3394
3360
|
label: "Ecosystem",
|
|
3395
3361
|
title: "Ecosystem component",
|
|
3396
|
-
icon:
|
|
3397
|
-
group:
|
|
3362
|
+
icon: W.ecosystem,
|
|
3363
|
+
group: G,
|
|
3398
3364
|
extra: { ecosystem: !0 }
|
|
3399
3365
|
},
|
|
3400
3366
|
{
|
|
@@ -3403,8 +3369,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3403
3369
|
label: "User",
|
|
3404
3370
|
title: "Anchor / User",
|
|
3405
3371
|
shortcut: "U",
|
|
3406
|
-
icon:
|
|
3407
|
-
group:
|
|
3372
|
+
icon: W.anchor,
|
|
3373
|
+
group: G
|
|
3408
3374
|
},
|
|
3409
3375
|
{
|
|
3410
3376
|
key: "pipeline",
|
|
@@ -3412,24 +3378,24 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3412
3378
|
label: "Pipeline",
|
|
3413
3379
|
title: "Pipeline",
|
|
3414
3380
|
shortcut: "P",
|
|
3415
|
-
icon:
|
|
3416
|
-
group:
|
|
3381
|
+
icon: W.pipeline,
|
|
3382
|
+
group: G
|
|
3417
3383
|
},
|
|
3418
3384
|
{
|
|
3419
3385
|
key: "submap",
|
|
3420
3386
|
type: "submap",
|
|
3421
3387
|
label: "Submap",
|
|
3422
3388
|
title: "Submap",
|
|
3423
|
-
icon:
|
|
3424
|
-
group:
|
|
3389
|
+
icon: W.submap,
|
|
3390
|
+
group: G
|
|
3425
3391
|
},
|
|
3426
3392
|
{
|
|
3427
3393
|
key: "pioneers",
|
|
3428
3394
|
type: "attitude",
|
|
3429
3395
|
label: "Pioneers",
|
|
3430
3396
|
title: "Pioneers region",
|
|
3431
|
-
icon:
|
|
3432
|
-
group:
|
|
3397
|
+
icon: Ii("pioneers"),
|
|
3398
|
+
group: Li,
|
|
3433
3399
|
extra: { attitudeKind: "pioneers" }
|
|
3434
3400
|
},
|
|
3435
3401
|
{
|
|
@@ -3437,8 +3403,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3437
3403
|
type: "attitude",
|
|
3438
3404
|
label: "Settlers",
|
|
3439
3405
|
title: "Settlers region",
|
|
3440
|
-
icon:
|
|
3441
|
-
group:
|
|
3406
|
+
icon: Ii("settlers"),
|
|
3407
|
+
group: Li,
|
|
3442
3408
|
extra: { attitudeKind: "settlers" }
|
|
3443
3409
|
},
|
|
3444
3410
|
{
|
|
@@ -3446,8 +3412,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3446
3412
|
type: "attitude",
|
|
3447
3413
|
label: "Town Planners",
|
|
3448
3414
|
title: "Town Planners region",
|
|
3449
|
-
icon:
|
|
3450
|
-
group:
|
|
3415
|
+
icon: Ii("townplanners"),
|
|
3416
|
+
group: Li,
|
|
3451
3417
|
extra: { attitudeKind: "townplanners" }
|
|
3452
3418
|
},
|
|
3453
3419
|
{
|
|
@@ -3455,8 +3421,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3455
3421
|
type: "accelerator",
|
|
3456
3422
|
label: "Accelerate",
|
|
3457
3423
|
title: "Accelerator",
|
|
3458
|
-
icon:
|
|
3459
|
-
group:
|
|
3424
|
+
icon: W.accelerator,
|
|
3425
|
+
group: Li,
|
|
3460
3426
|
extra: { acceleratorDirection: "accelerate" }
|
|
3461
3427
|
},
|
|
3462
3428
|
{
|
|
@@ -3464,8 +3430,8 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3464
3430
|
type: "accelerator",
|
|
3465
3431
|
label: "Deaccelerate",
|
|
3466
3432
|
title: "Deaccelerator",
|
|
3467
|
-
icon:
|
|
3468
|
-
group:
|
|
3433
|
+
icon: W.deaccelerator,
|
|
3434
|
+
group: Li,
|
|
3469
3435
|
extra: { acceleratorDirection: "deaccelerate" }
|
|
3470
3436
|
},
|
|
3471
3437
|
{
|
|
@@ -3474,26 +3440,26 @@ var W = "wardley-1-blocks", Xi = "wardley-2-strategy", Zi = [
|
|
|
3474
3440
|
label: "Note",
|
|
3475
3441
|
title: "Note",
|
|
3476
3442
|
shortcut: "N",
|
|
3477
|
-
icon:
|
|
3443
|
+
icon: W.note,
|
|
3478
3444
|
group: "wardley-3-notes"
|
|
3479
3445
|
}
|
|
3480
|
-
],
|
|
3446
|
+
], K = {
|
|
3481
3447
|
key: "lasso-tool",
|
|
3482
3448
|
title: "Lasso",
|
|
3483
3449
|
shortcut: "L",
|
|
3484
|
-
icon:
|
|
3485
|
-
},
|
|
3450
|
+
icon: W.lasso
|
|
3451
|
+
}, zi = {
|
|
3486
3452
|
key: "draw-tool",
|
|
3487
3453
|
title: "Draw",
|
|
3488
|
-
icon:
|
|
3489
|
-
},
|
|
3490
|
-
function
|
|
3454
|
+
icon: W.draw
|
|
3455
|
+
}, Bi = 24, Vi = 24, Hi = 12;
|
|
3456
|
+
function Ui(e) {
|
|
3491
3457
|
return e.replace(/&/g, "&").replace(/"/g, """);
|
|
3492
3458
|
}
|
|
3493
|
-
function
|
|
3459
|
+
function Wi(e) {
|
|
3494
3460
|
return e.type === "click" && e.detail === 0;
|
|
3495
3461
|
}
|
|
3496
|
-
var
|
|
3462
|
+
var Gi = class {
|
|
3497
3463
|
create;
|
|
3498
3464
|
factory;
|
|
3499
3465
|
lassoTool;
|
|
@@ -3513,22 +3479,26 @@ var ra = class {
|
|
|
3513
3479
|
}
|
|
3514
3480
|
getPaletteEntries() {
|
|
3515
3481
|
let e = {};
|
|
3516
|
-
e[
|
|
3517
|
-
group: "tools",
|
|
3518
|
-
...this.describe(G.title, G.shortcut),
|
|
3519
|
-
html: this.entryHtml(G.title, G.icon, G.shortcut),
|
|
3520
|
-
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
3521
|
-
}, e[K.key] = {
|
|
3482
|
+
e[K.key] = {
|
|
3522
3483
|
group: "tools",
|
|
3523
3484
|
...this.describe(K.title, K.shortcut),
|
|
3524
3485
|
html: this.entryHtml(K.title, K.icon, K.shortcut),
|
|
3525
|
-
action: { click: () =>
|
|
3486
|
+
action: { click: (e) => {
|
|
3487
|
+
this.lassoTool.activateSelection(e), this.focusCanvasAfterPointer(e);
|
|
3488
|
+
} }
|
|
3489
|
+
}, e[zi.key] = {
|
|
3490
|
+
group: "tools",
|
|
3491
|
+
...this.describe(zi.title, zi.shortcut),
|
|
3492
|
+
html: this.entryHtml(zi.title, zi.icon, zi.shortcut),
|
|
3493
|
+
action: { click: (e) => {
|
|
3494
|
+
this.drawTool.toggle(), this.focusCanvasAfterPointer(e);
|
|
3495
|
+
} }
|
|
3526
3496
|
};
|
|
3527
|
-
for (let t of
|
|
3497
|
+
for (let t of Ri) {
|
|
3528
3498
|
let n = (e) => {
|
|
3529
|
-
this.create.start(e, this.createShapeFor(t));
|
|
3499
|
+
this.create.start(e, this.createShapeFor(t)), this.focusCanvasAfterPointer(e);
|
|
3530
3500
|
}, r = (e) => {
|
|
3531
|
-
|
|
3501
|
+
Wi(e) ? this.createAtFreeCenter(`create.${t.key}`) : n(e);
|
|
3532
3502
|
};
|
|
3533
3503
|
e[`create.${t.key}`] = {
|
|
3534
3504
|
group: t.group,
|
|
@@ -3543,11 +3513,14 @@ var ra = class {
|
|
|
3543
3513
|
return e;
|
|
3544
3514
|
}
|
|
3545
3515
|
createAtFreeCenter(e) {
|
|
3546
|
-
let t =
|
|
3516
|
+
let t = Ri.find((t) => `create.${t.key}` === e);
|
|
3547
3517
|
if (!t) return;
|
|
3548
3518
|
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);
|
|
3549
3519
|
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;
|
|
3550
3520
|
}
|
|
3521
|
+
focusCanvasAfterPointer(e) {
|
|
3522
|
+
Wi(e) || L(this.injector.get("canvas"));
|
|
3523
|
+
}
|
|
3551
3524
|
createShapeFor(e) {
|
|
3552
3525
|
return this.factory.createNew(e.type, e.label, e.extra ?? {});
|
|
3553
3526
|
}
|
|
@@ -3562,13 +3535,13 @@ var ra = class {
|
|
|
3562
3535
|
evolution: 1,
|
|
3563
3536
|
visibility: 0
|
|
3564
3537
|
}), o = (e, t, n, r) => {
|
|
3565
|
-
let i = t + r / 2 +
|
|
3538
|
+
let i = t + r / 2 + Bi, a = n - r / 2 - Bi;
|
|
3566
3539
|
return i > a ? (t + n) / 2 : Math.min(a, Math.max(i, e));
|
|
3567
3540
|
}, s = (t) => ({
|
|
3568
|
-
x: o(r.x + t *
|
|
3569
|
-
y: o(r.y + t *
|
|
3541
|
+
x: o(r.x + t * Vi, i.x, a.x, e.width),
|
|
3542
|
+
y: o(r.y + t * Vi, i.y, a.y, e.height)
|
|
3570
3543
|
}), c = this.injector.get("elementRegistry"), l = (t) => c.find((n) => j(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;
|
|
3571
|
-
for (let e = 0; e <
|
|
3544
|
+
for (let e = 0; e < Hi; e++) {
|
|
3572
3545
|
let t = s(e);
|
|
3573
3546
|
if (!l(t)) return t;
|
|
3574
3547
|
}
|
|
@@ -3581,12 +3554,12 @@ var ra = class {
|
|
|
3581
3554
|
} : { title: e };
|
|
3582
3555
|
}
|
|
3583
3556
|
entryHtml(e, t, n, r = !1) {
|
|
3584
|
-
let i = this.needsNativeTitle ? ` title="${
|
|
3557
|
+
let i = this.needsNativeTitle ? ` title="${Ui(n ? `${e} (${n})` : e)}"` : "", a = n ? ` aria-keyshortcuts="${Ui(n)}"` : "";
|
|
3585
3558
|
return `<div class="entry wardley-palette-entry"${r ? " draggable=\"true\"" : ""}${i}${a}>${t}</div>`;
|
|
3586
3559
|
}
|
|
3587
|
-
},
|
|
3560
|
+
}, Ki = ".djs-palette-entries .entry", qi = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Ji = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]), Yi = /* @__PURE__ */ new Set(["Enter", " "]), Xi = {
|
|
3588
3561
|
__init__: ["wardleyPaletteProvider", "wardleyPaletteKeyboard"],
|
|
3589
|
-
wardleyPaletteProvider: ["type",
|
|
3562
|
+
wardleyPaletteProvider: ["type", Gi],
|
|
3590
3563
|
wardleyPaletteKeyboard: ["type", class {
|
|
3591
3564
|
palette;
|
|
3592
3565
|
provider;
|
|
@@ -3611,7 +3584,7 @@ var ra = class {
|
|
|
3611
3584
|
}), this.updateTabStops());
|
|
3612
3585
|
}
|
|
3613
3586
|
entries() {
|
|
3614
|
-
return this.container ? Array.from(this.container.querySelectorAll(
|
|
3587
|
+
return this.container ? Array.from(this.container.querySelectorAll(Ki)) : [];
|
|
3615
3588
|
}
|
|
3616
3589
|
entryOf(e) {
|
|
3617
3590
|
if (!(e instanceof Element) || !this.container) return null;
|
|
@@ -3628,7 +3601,7 @@ var ra = class {
|
|
|
3628
3601
|
let t = this.entryOf(e.target);
|
|
3629
3602
|
if (!t || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
3630
3603
|
let n = this.entries(), r = n.indexOf(t), i;
|
|
3631
|
-
|
|
3604
|
+
qi.has(e.key) ? i = n[(r - 1 + n.length) % n.length] : Ji.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()) : Yi.has(e.key) && (e.preventDefault(), e.stopPropagation(), this.activate(t));
|
|
3632
3605
|
}
|
|
3633
3606
|
activate(e) {
|
|
3634
3607
|
let t = e.getAttribute("data-action");
|
|
@@ -3641,29 +3614,29 @@ var ra = class {
|
|
|
3641
3614
|
this.palette.triggerEntry(t, "click", r);
|
|
3642
3615
|
}
|
|
3643
3616
|
}]
|
|
3644
|
-
},
|
|
3617
|
+
}, Zi = 8, Qi = 134, $i = class extends je {
|
|
3645
3618
|
_getTargetBounds(e) {
|
|
3646
3619
|
let t = Array.isArray(e) ? e : [e], n = t.flatMap((e) => this.visualRects(e, "node"));
|
|
3647
3620
|
if (!n.length) return je.prototype._getTargetBounds.call(this, e);
|
|
3648
|
-
let r =
|
|
3649
|
-
return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ?
|
|
3621
|
+
let r = ea(n), i = r.right + this.padWidth() + Zi * this.internals()._canvas.zoom(), a = t.flatMap((e) => this.visualRects(e, "movement"));
|
|
3622
|
+
return t.flatMap((e) => this.movementTargetRects(e)).some((e) => e.right > r.right && e.left < i) ? ea([...n, ...a]) : r;
|
|
3650
3623
|
}
|
|
3651
3624
|
internals() {
|
|
3652
3625
|
return this;
|
|
3653
3626
|
}
|
|
3654
3627
|
padWidth() {
|
|
3655
|
-
return this.internals()._current?.html?.getBoundingClientRect().width ||
|
|
3628
|
+
return this.internals()._current?.html?.getBoundingClientRect().width || Qi;
|
|
3656
3629
|
}
|
|
3657
3630
|
movementTargetRects(e) {
|
|
3658
|
-
let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${
|
|
3631
|
+
let t = this.internals()._canvas.getGraphics(e)?.querySelectorAll(`.djs-visual > .${qr} > :is(.wardley-evolve-handle, text)`);
|
|
3659
3632
|
return Array.from(t ?? []).map((e) => e.getBoundingClientRect());
|
|
3660
3633
|
}
|
|
3661
3634
|
visualRects(e, t) {
|
|
3662
3635
|
let n = this.internals()._canvas.getGraphics(e);
|
|
3663
|
-
return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(
|
|
3636
|
+
return n ? Array.from(n.children).flatMap((e) => e.classList.contains("djs-visual") ? Array.from(e.children).filter((e) => e.classList.contains(qr) === (t === "movement")) : t === "node" ? [e] : []).map((e) => e.getBoundingClientRect()).filter((e) => e.width > 0 || e.height > 0) : [];
|
|
3664
3637
|
}
|
|
3665
3638
|
};
|
|
3666
|
-
function
|
|
3639
|
+
function ea(e) {
|
|
3667
3640
|
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));
|
|
3668
3641
|
return {
|
|
3669
3642
|
left: t,
|
|
@@ -3676,9 +3649,8 @@ function fa(e) {
|
|
|
3676
3649
|
height: i - n
|
|
3677
3650
|
};
|
|
3678
3651
|
}
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
function pa(e, t, n, r) {
|
|
3652
|
+
// src/label-editing/fieldError.ts
|
|
3653
|
+
function ta(e, t, n, r) {
|
|
3682
3654
|
let i;
|
|
3683
3655
|
return {
|
|
3684
3656
|
get caption() {
|
|
@@ -3692,26 +3664,25 @@ function pa(e, t, n, r) {
|
|
|
3692
3664
|
}
|
|
3693
3665
|
};
|
|
3694
3666
|
}
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
function ma(e, t) {
|
|
3667
|
+
// src/label-editing/WardleyLabelEditing.ts
|
|
3668
|
+
function na(e, t) {
|
|
3698
3669
|
if (e.focus(), t.selection) {
|
|
3699
3670
|
let n = e.value.length;
|
|
3700
3671
|
e.setSelectionRange(Math.min(t.selection.start, n), Math.min(t.selection.end, n));
|
|
3701
3672
|
} else e.select();
|
|
3702
3673
|
}
|
|
3703
|
-
var
|
|
3704
|
-
function
|
|
3705
|
-
return `“${e}” already exists
|
|
3674
|
+
var ra = "wardley-name-label", ia = "wardley-label-editing", aa = /* @__PURE__ */ new Set(["attitude", "drawing"]), oa = 500, sa = 6, ca = 2, la = 1.5, ua = 1.25, da = 11, fa = 4, pa = "Cmd/Ctrl+Enter to save · Esc to cancel";
|
|
3675
|
+
function ma(e) {
|
|
3676
|
+
return `“${e}” already exists. Names must be unique because links refer to them.`;
|
|
3706
3677
|
}
|
|
3707
|
-
function
|
|
3678
|
+
function ha(e) {
|
|
3708
3679
|
return e.replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
3709
3680
|
}
|
|
3710
|
-
var
|
|
3711
|
-
function
|
|
3712
|
-
return
|
|
3681
|
+
var ga;
|
|
3682
|
+
function _a(e, t, n) {
|
|
3683
|
+
return ga === void 0 && (ga = document.createElement("canvas").getContext("2d")), ga ? (ga.font = t, ga.measureText(e).width) : e.length * n * .6;
|
|
3713
3684
|
}
|
|
3714
|
-
var
|
|
3685
|
+
var va = class {
|
|
3715
3686
|
eventBus;
|
|
3716
3687
|
canvas;
|
|
3717
3688
|
modeling;
|
|
@@ -3729,40 +3700,40 @@ var Aa = class {
|
|
|
3729
3700
|
selection;
|
|
3730
3701
|
locked;
|
|
3731
3702
|
constructor(e, t, n, r, i) {
|
|
3732
|
-
this.eventBus = e, this.canvas = t, this.modeling = n, this.factory = r,
|
|
3703
|
+
this.eventBus = e, this.canvas = t, this.modeling = n, this.factory = r, jt(), this.contextPad = i.get("contextPad", !1) ?? null, this.selection = i.get("selection", !1) ?? null, this.locked = () => I(i), e.on("element.dblclick", (e) => {
|
|
3733
3704
|
j(e.element) ? this.activate(e.element) : M(e.element) && this.activateConnection(e.element);
|
|
3734
|
-
}), 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"],
|
|
3705
|
+
}), 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"], oa, (e) => {
|
|
3735
3706
|
this.active && e.element?.id === this.active.elementId && this.active.relayout();
|
|
3736
3707
|
}), e.on(["shape.remove", "connection.remove"], (e) => {
|
|
3737
3708
|
this.active && e.element?.id === this.active.elementId && this.cancel();
|
|
3738
3709
|
}), e.on("diagram.destroy", () => this.cancel());
|
|
3739
3710
|
}
|
|
3740
3711
|
activate(e, t = {}) {
|
|
3741
|
-
if (!j(e) ||
|
|
3712
|
+
if (!j(e) || aa.has(e.wardleyType) || this.locked()) return;
|
|
3742
3713
|
this.active?.commit("outside");
|
|
3743
|
-
let n = this.canvas.getContainer(), r = e.wardleyType === "note", i =
|
|
3744
|
-
let { left: e, top: t, width: n, height: i } =
|
|
3714
|
+
let n = this.canvas.getContainer(), r = e.wardleyType === "note", i = Mt(), a = this.factory.isLinkable(e.wardleyType), o = this.nameLabelElements(e), s = [...o.classedByFallback], c = this.labelGeometry(e, o.labelElements), l = (e) => Math.max(e * ua, r ? 17 * this.canvas.zoom() : 0), u = l(c.fontSize), d = ya(r, t.value ?? e.wardleyLabel ?? "", c, u), f = r ? xa("wardley-label-hint", pa) : void 0, p = () => {
|
|
3715
|
+
let { left: e, top: t, width: n, height: i } = ba(d.value, c, u, r);
|
|
3745
3716
|
Object.assign(d.style, {
|
|
3746
3717
|
left: `${e}px`,
|
|
3747
3718
|
top: `${t}px`,
|
|
3748
3719
|
width: `${n}px`,
|
|
3749
3720
|
height: `${i}px`
|
|
3750
3721
|
});
|
|
3751
|
-
let a = t + i +
|
|
3752
|
-
for (let t of [m.caption, f]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight +
|
|
3753
|
-
}, m =
|
|
3754
|
-
m.show(
|
|
3722
|
+
let a = t + i + fa;
|
|
3723
|
+
for (let t of [m.caption, f]) t && (t.style.left = `${e}px`, t.style.top = `${a}px`, a += t.offsetHeight + fa);
|
|
3724
|
+
}, m = ta(n, d, `wardley-label-error-${e.id}`, () => p()), h = (e) => {
|
|
3725
|
+
m.show(ma(e)), d.select();
|
|
3755
3726
|
}, g = () => m.clear();
|
|
3756
|
-
this.contextPad?.close(), this.canvas.addMarker(e,
|
|
3727
|
+
this.contextPad?.close(), this.canvas.addMarker(e, ia), n.appendChild(d), f && n.appendChild(f), p(), na(d, t);
|
|
3757
3728
|
let _ = !1, v = () => {
|
|
3758
3729
|
if (!_) {
|
|
3759
|
-
_ = !0, d.removeEventListener("keydown", ee), d.removeEventListener("blur", ne), d.removeEventListener("input", te), d.remove(), f?.remove(), m.clear(), this.canvas.removeMarker(e,
|
|
3760
|
-
for (let e of s) e.classList.remove(
|
|
3730
|
+
_ = !0, d.removeEventListener("keydown", ee), d.removeEventListener("blur", ne), d.removeEventListener("input", te), d.remove(), f?.remove(), m.clear(), this.canvas.removeMarker(e, ia);
|
|
3731
|
+
for (let e of s) e.classList.remove(ra), e.classList.length || e.removeAttribute("class");
|
|
3761
3732
|
this.active = null;
|
|
3762
3733
|
}
|
|
3763
3734
|
}, y = (t) => {
|
|
3764
3735
|
if (_) return;
|
|
3765
|
-
let n =
|
|
3736
|
+
let n = ha(d.value);
|
|
3766
3737
|
if (!n || n === e.wardleyLabel) {
|
|
3767
3738
|
v();
|
|
3768
3739
|
return;
|
|
@@ -3804,45 +3775,45 @@ var Aa = class {
|
|
|
3804
3775
|
this.active?.commit("outside");
|
|
3805
3776
|
let n = this.canvas.getContainer();
|
|
3806
3777
|
if (e.waypoints.length < 1) return;
|
|
3807
|
-
let r = e.wardleyType === "flow", i = document.createElement("input");
|
|
3808
|
-
|
|
3809
|
-
let
|
|
3778
|
+
let r = e.wardleyType === "flow", i = Mt(), a = document.createElement("input");
|
|
3779
|
+
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";
|
|
3780
|
+
let o = () => {
|
|
3810
3781
|
let t = e.waypoints[0], n = e.waypoints[e.waypoints.length - 1];
|
|
3811
3782
|
if (!t || !n) return;
|
|
3812
|
-
let r = this.canvas.zoom(),
|
|
3813
|
-
|
|
3783
|
+
let r = this.canvas.zoom(), i = this.canvas.viewbox();
|
|
3784
|
+
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`;
|
|
3814
3785
|
};
|
|
3815
|
-
|
|
3816
|
-
let
|
|
3817
|
-
|
|
3818
|
-
},
|
|
3819
|
-
if (
|
|
3820
|
-
let t =
|
|
3821
|
-
if (
|
|
3822
|
-
let
|
|
3823
|
-
...
|
|
3786
|
+
o(), n.appendChild(a), na(a, t);
|
|
3787
|
+
let s = !1, c = () => {
|
|
3788
|
+
s || (s = !0, a.removeEventListener("keydown", u), a.removeEventListener("blur", d), a.remove(), this.active = null);
|
|
3789
|
+
}, l = () => {
|
|
3790
|
+
if (s) return;
|
|
3791
|
+
let t = a.value.replace(/'/g, "’").replace(/;/g, ",").trim(), n = (r ? e.flowValue : e.linkLabel) ?? "";
|
|
3792
|
+
if (c(), t === n) return;
|
|
3793
|
+
let i = e.businessObject, o = i ? r ? {
|
|
3794
|
+
...i,
|
|
3824
3795
|
...t ? { flowValue: t } : {}
|
|
3825
3796
|
} : {
|
|
3826
|
-
...
|
|
3797
|
+
...i,
|
|
3827
3798
|
...t ? { label: t } : {}
|
|
3828
3799
|
} : void 0;
|
|
3829
|
-
|
|
3800
|
+
o && !t && (r ? delete o.flowValue : delete o.label), this.modeling.updateProperties(e, {
|
|
3830
3801
|
[r ? "flowValue" : "linkLabel"]: t || void 0,
|
|
3831
|
-
...
|
|
3802
|
+
...o ? { businessObject: o } : {}
|
|
3832
3803
|
});
|
|
3833
|
-
},
|
|
3834
|
-
|
|
3835
|
-
},
|
|
3836
|
-
|
|
3837
|
-
let
|
|
3838
|
-
|
|
3804
|
+
}, u = (t) => {
|
|
3805
|
+
t.key === "Escape" ? (t.preventDefault(), c(), this.returnToCanvas(e, i)) : t.key === "Enter" && (t.preventDefault(), l(), this.returnToCanvas(e, i));
|
|
3806
|
+
}, d = () => l();
|
|
3807
|
+
a.addEventListener("keydown", u), a.addEventListener("blur", d);
|
|
3808
|
+
let f = () => {
|
|
3809
|
+
s || o();
|
|
3839
3810
|
};
|
|
3840
3811
|
this.active = {
|
|
3841
3812
|
elementId: e.id,
|
|
3842
|
-
field:
|
|
3843
|
-
commit:
|
|
3844
|
-
cleanup:
|
|
3845
|
-
relayout:
|
|
3813
|
+
field: a,
|
|
3814
|
+
commit: l,
|
|
3815
|
+
cleanup: c,
|
|
3816
|
+
relayout: f,
|
|
3846
3817
|
connection: !0
|
|
3847
3818
|
};
|
|
3848
3819
|
}
|
|
@@ -3871,7 +3842,7 @@ var Aa = class {
|
|
|
3871
3842
|
};
|
|
3872
3843
|
}
|
|
3873
3844
|
returnToCanvas(e, t) {
|
|
3874
|
-
t ?
|
|
3845
|
+
t ? L(this.canvas) : this.canvas.focus();
|
|
3875
3846
|
let n = this.selection?.get() ?? [];
|
|
3876
3847
|
n.length === 1 && n[0] === e && this.contextPad?.open(e);
|
|
3877
3848
|
}
|
|
@@ -3881,20 +3852,20 @@ var Aa = class {
|
|
|
3881
3852
|
labelElements: [],
|
|
3882
3853
|
classedByFallback: []
|
|
3883
3854
|
};
|
|
3884
|
-
let n = [...t.querySelectorAll(`.${
|
|
3855
|
+
let n = [...t.querySelectorAll(`.${ra}`)];
|
|
3885
3856
|
if (n.length) return {
|
|
3886
3857
|
labelElements: n,
|
|
3887
3858
|
classedByFallback: []
|
|
3888
3859
|
};
|
|
3889
3860
|
let r = [...t.querySelectorAll("text")].filter((e) => !e.closest(".wardley-movement")), i = e.wardleyType === "note" ? r : r.filter((t) => t.textContent === e.wardleyLabel).slice(-1);
|
|
3890
|
-
for (let e of i) e.classList.add(
|
|
3861
|
+
for (let e of i) e.classList.add(ra);
|
|
3891
3862
|
return {
|
|
3892
3863
|
labelElements: i,
|
|
3893
3864
|
classedByFallback: i
|
|
3894
3865
|
};
|
|
3895
3866
|
}
|
|
3896
3867
|
labelGeometry(e, t) {
|
|
3897
|
-
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(
|
|
3868
|
+
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(da, (Number.parseFloat(o?.fontSize ?? "") || A.label) * n), c = {
|
|
3898
3869
|
fontSize: s,
|
|
3899
3870
|
fontWeight: o?.fontWeight || "normal",
|
|
3900
3871
|
fontStyle: o?.fontStyle || "normal",
|
|
@@ -3929,7 +3900,7 @@ var Aa = class {
|
|
|
3929
3900
|
};
|
|
3930
3901
|
}
|
|
3931
3902
|
};
|
|
3932
|
-
function
|
|
3903
|
+
function ya(e, t, n, r) {
|
|
3933
3904
|
let i = e ? document.createElement("textarea") : document.createElement("input");
|
|
3934
3905
|
return i.className = e ? "wardley-label-input wardley-label-input--name wardley-label-textarea" : "wardley-label-input wardley-label-input--name", i.value = t, i.setAttribute("aria-label", e ? "Note text" : "Name"), i.spellcheck = !1, i instanceof HTMLTextAreaElement ? i.wrap = "off" : i.type = "text", Object.assign(i.style, {
|
|
3935
3906
|
position: "absolute",
|
|
@@ -3938,57 +3909,55 @@ function ja(e, t, n, r) {
|
|
|
3938
3909
|
fontWeight: n.fontWeight,
|
|
3939
3910
|
fontStyle: n.fontStyle,
|
|
3940
3911
|
lineHeight: `${r}px`,
|
|
3941
|
-
padding: `${
|
|
3912
|
+
padding: `${ca}px ${sa}px`,
|
|
3942
3913
|
textAlign: n.centered ? "center" : "left"
|
|
3943
3914
|
}), i;
|
|
3944
3915
|
}
|
|
3945
|
-
function
|
|
3946
|
-
let i = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, a = (e || " ").split("\n"), o = Math.max(...a.map((e) =>
|
|
3916
|
+
function ba(e, t, n, r) {
|
|
3917
|
+
let i = `${t.fontStyle} ${t.fontWeight} ${t.fontSize}px ${t.fontFamily}`, a = (e || " ").split("\n"), o = Math.max(...a.map((e) => _a(e, i, t.fontSize))), s = Math.max(o + 17, t.fontSize * 2 + 17, r ? t.width : 0), c = Math.max(a.length * n + 7, r ? t.height : 0);
|
|
3947
3918
|
return {
|
|
3948
|
-
left: t.centered ? t.left + t.width / 2 - s / 2 : t.left -
|
|
3919
|
+
left: t.centered ? t.left + t.width / 2 - s / 2 : t.left - sa - la,
|
|
3949
3920
|
top: t.top + t.height / 2 - c / 2,
|
|
3950
3921
|
width: s,
|
|
3951
3922
|
height: c
|
|
3952
3923
|
};
|
|
3953
3924
|
}
|
|
3954
|
-
function
|
|
3925
|
+
function xa(e, t) {
|
|
3955
3926
|
let n = document.createElement("div");
|
|
3956
3927
|
return n.className = `wardley-label-caption ${e}`, n.textContent = t, n;
|
|
3957
3928
|
}
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
var Pa = {
|
|
3929
|
+
// src/label-editing/index.ts
|
|
3930
|
+
var Sa = {
|
|
3961
3931
|
__init__: ["wardleyLabelEditing"],
|
|
3962
|
-
wardleyLabelEditing: ["type",
|
|
3963
|
-
},
|
|
3932
|
+
wardleyLabelEditing: ["type", va]
|
|
3933
|
+
}, Ca = /* @__PURE__ */ new Set([
|
|
3964
3934
|
"http:",
|
|
3965
3935
|
"https:",
|
|
3966
3936
|
"mailto:"
|
|
3967
|
-
]),
|
|
3968
|
-
function
|
|
3969
|
-
return e.replace(
|
|
3937
|
+
]), wa = /^([a-z][a-z0-9+.-]*):/i, Ta = /[\u0000-\u001f\u007f]/g;
|
|
3938
|
+
function Ea(e) {
|
|
3939
|
+
return e.replace(Ta, "").replace(/[[\]]/g, "").trim();
|
|
3970
3940
|
}
|
|
3971
|
-
function
|
|
3972
|
-
let t =
|
|
3973
|
-
return t === void 0 ||
|
|
3941
|
+
function Da(e) {
|
|
3942
|
+
let t = wa.exec(e)?.[1];
|
|
3943
|
+
return t === void 0 || Ca.has(`${t.toLowerCase()}:`);
|
|
3974
3944
|
}
|
|
3975
|
-
function
|
|
3945
|
+
function Oa(e) {
|
|
3976
3946
|
if (e === void 0) return;
|
|
3977
|
-
let t =
|
|
3978
|
-
return t &&
|
|
3947
|
+
let t = Ea(e);
|
|
3948
|
+
return t && Da(t) ? t : void 0;
|
|
3979
3949
|
}
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
function Ga(e) {
|
|
3950
|
+
// src/link-editing/WardleyLinkEditing.ts
|
|
3951
|
+
var ka = 72, Aa = 500, ja = 4, Ma = "Use an http(s) or mailto address, or a relative path such as ./other.wmap";
|
|
3952
|
+
function Na(e) {
|
|
3984
3953
|
return e.wardleyType === "component" || e.wardleyType === "submap";
|
|
3985
3954
|
}
|
|
3986
|
-
function
|
|
3955
|
+
function Pa(e) {
|
|
3987
3956
|
let t = e.businessObject;
|
|
3988
3957
|
if (e.wardleyType === "submap") return t?.urlRef;
|
|
3989
3958
|
if (e.wardleyType === "component") return t?.url;
|
|
3990
3959
|
}
|
|
3991
|
-
var
|
|
3960
|
+
var Fa = class {
|
|
3992
3961
|
canvas;
|
|
3993
3962
|
modeling;
|
|
3994
3963
|
injector;
|
|
@@ -4001,15 +3970,15 @@ var qa = class {
|
|
|
4001
3970
|
active = null;
|
|
4002
3971
|
relayoutPending = !1;
|
|
4003
3972
|
constructor(e, t, n, r) {
|
|
4004
|
-
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",
|
|
3973
|
+
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", Aa, (e) => {
|
|
4005
3974
|
this.active && e.element?.id === this.active.elementId && this.active.relayout();
|
|
4006
3975
|
}), e.on(["diagram.clear", "diagram.destroy"], () => this.cancel());
|
|
4007
3976
|
}
|
|
4008
3977
|
setLink(e, t) {
|
|
4009
|
-
if (!
|
|
4010
|
-
let n =
|
|
4011
|
-
if (n && !
|
|
4012
|
-
if ((
|
|
3978
|
+
if (!Na(e)) return !1;
|
|
3979
|
+
let n = Ea(t ?? "");
|
|
3980
|
+
if (n && !Da(n)) return !1;
|
|
3981
|
+
if ((Pa(e) ?? "") === n) return !0;
|
|
4013
3982
|
let r = e.wardleyType === "submap" ? "urlRef" : "url";
|
|
4014
3983
|
e.businessObject ||= {
|
|
4015
3984
|
id: e.id,
|
|
@@ -4024,23 +3993,23 @@ var qa = class {
|
|
|
4024
3993
|
return n ? i[r] = n : delete i[r], this.modeling.updateProperties(e, { businessObject: i }), !0;
|
|
4025
3994
|
}
|
|
4026
3995
|
activate(e, t = {}) {
|
|
4027
|
-
if (!
|
|
3996
|
+
if (!Na(e) || I(this.injector)) return;
|
|
4028
3997
|
this.active?.commit();
|
|
4029
3998
|
let n = this.canvas.getContainer(), r = document.createElement("input");
|
|
4030
|
-
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 ??
|
|
3999
|
+
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 ?? Pa(e) ?? "", r.style.position = "absolute";
|
|
4031
4000
|
let i = () => {
|
|
4032
4001
|
let t = this.canvas.zoom(), n = this.canvas.viewbox();
|
|
4033
|
-
r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t +
|
|
4002
|
+
r.style.left = `${(e.x - n.x) * t}px`, r.style.top = `${(e.y - n.y) * t + ka}px`;
|
|
4034
4003
|
};
|
|
4035
|
-
i(), n.appendChild(r), r
|
|
4004
|
+
i(), n.appendChild(r), na(r, t);
|
|
4036
4005
|
let a = !1, o = () => {
|
|
4037
4006
|
a || (a = !0, r.removeEventListener("keydown", p), r.removeEventListener("blur", m), r.removeEventListener("input", u), c.clear(), r.remove(), this.active = null);
|
|
4038
4007
|
}, s = (e) => {
|
|
4039
|
-
e.style.left = r.style.left, e.style.top = `${r.offsetTop + r.offsetHeight +
|
|
4040
|
-
}, c =
|
|
4008
|
+
e.style.left = r.style.left, e.style.top = `${r.offsetTop + r.offsetHeight + ja}px`;
|
|
4009
|
+
}, c = ta(n, r, `wardley-link-error-${e.id}`, s), l = () => c.show(Ma), u = () => c.clear(), d = () => {
|
|
4041
4010
|
if (a) return !0;
|
|
4042
|
-
let t =
|
|
4043
|
-
return t && !
|
|
4011
|
+
let t = Ea(r.value);
|
|
4012
|
+
return t && !Da(t) ? (l(), !1) : (o(), this.setLink(e, t), !0);
|
|
4044
4013
|
}, f = () => {
|
|
4045
4014
|
d() || o();
|
|
4046
4015
|
}, p = (e) => {
|
|
@@ -4070,31 +4039,37 @@ var qa = class {
|
|
|
4070
4039
|
this.active?.commit();
|
|
4071
4040
|
}
|
|
4072
4041
|
getActiveEdit() {
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4042
|
+
if (!this.active) return null;
|
|
4043
|
+
let { elementId: e, field: t } = this.active;
|
|
4044
|
+
return {
|
|
4045
|
+
elementId: e,
|
|
4046
|
+
value: t.value,
|
|
4047
|
+
selection: {
|
|
4048
|
+
start: t.selectionStart ?? 0,
|
|
4049
|
+
end: t.selectionEnd ?? 0
|
|
4050
|
+
}
|
|
4051
|
+
};
|
|
4077
4052
|
}
|
|
4078
|
-
},
|
|
4053
|
+
}, Ia = {
|
|
4079
4054
|
__init__: ["wardleyLinkEditing"],
|
|
4080
|
-
wardleyLinkEditing: ["type",
|
|
4081
|
-
},
|
|
4055
|
+
wardleyLinkEditing: ["type", Fa]
|
|
4056
|
+
}, La = "wardley-element-settings", Ra = {
|
|
4082
4057
|
id: "type",
|
|
4083
4058
|
name: "Type"
|
|
4084
|
-
},
|
|
4059
|
+
}, za = {
|
|
4085
4060
|
id: "method",
|
|
4086
4061
|
name: "Sourcing"
|
|
4087
|
-
},
|
|
4062
|
+
}, Ba = {
|
|
4088
4063
|
id: "props",
|
|
4089
4064
|
name: "Properties"
|
|
4090
4065
|
};
|
|
4091
|
-
function
|
|
4066
|
+
function Va(e) {
|
|
4092
4067
|
e.key !== "Escape" && e.stopPropagation();
|
|
4093
4068
|
}
|
|
4094
4069
|
function q(e, t) {
|
|
4095
4070
|
return e ? `✓ ${t}` : t;
|
|
4096
4071
|
}
|
|
4097
|
-
var
|
|
4072
|
+
var Ha = class {
|
|
4098
4073
|
modeling;
|
|
4099
4074
|
static $inject = [
|
|
4100
4075
|
"popupMenu",
|
|
@@ -4102,9 +4077,9 @@ var eo = class {
|
|
|
4102
4077
|
"eventBus"
|
|
4103
4078
|
];
|
|
4104
4079
|
constructor(e, t, n) {
|
|
4105
|
-
this.modeling = t, e.registerProvider(
|
|
4080
|
+
this.modeling = t, e.registerProvider(La, this), n.on("popupMenu.open", () => {
|
|
4106
4081
|
let t = e._current?.container;
|
|
4107
|
-
t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown",
|
|
4082
|
+
t?.getAttribute("data-popup") === "wardley-element-settings" && t.addEventListener("keydown", Va);
|
|
4108
4083
|
});
|
|
4109
4084
|
}
|
|
4110
4085
|
getPopupMenuEntries(e) {
|
|
@@ -4116,63 +4091,84 @@ var eo = class {
|
|
|
4116
4091
|
return {
|
|
4117
4092
|
"type-normal": {
|
|
4118
4093
|
label: q(n === "normal", "Normal"),
|
|
4119
|
-
group:
|
|
4094
|
+
group: Ra,
|
|
4120
4095
|
action: () => this.modeling.setMarketEcosystem(e, void 0)
|
|
4121
4096
|
},
|
|
4122
4097
|
"type-market": {
|
|
4123
4098
|
label: q(n === "market", "Market"),
|
|
4124
|
-
group:
|
|
4099
|
+
group: Ra,
|
|
4125
4100
|
action: () => this.modeling.setMarketEcosystem(e, "market")
|
|
4126
4101
|
},
|
|
4127
4102
|
"type-ecosystem": {
|
|
4128
4103
|
label: q(n === "ecosystem", "Ecosystem"),
|
|
4129
|
-
group:
|
|
4104
|
+
group: Ra,
|
|
4130
4105
|
action: () => this.modeling.setMarketEcosystem(e, "ecosystem")
|
|
4131
4106
|
},
|
|
4132
4107
|
"method-none": {
|
|
4133
4108
|
label: q(!r, "None"),
|
|
4134
|
-
group:
|
|
4109
|
+
group: za,
|
|
4135
4110
|
action: () => this.modeling.setMethod(e, void 0)
|
|
4136
4111
|
},
|
|
4137
4112
|
"method-build": {
|
|
4138
4113
|
label: q(r === "build", "Build"),
|
|
4139
|
-
group:
|
|
4114
|
+
group: za,
|
|
4140
4115
|
action: () => this.modeling.setMethod(e, "build")
|
|
4141
4116
|
},
|
|
4142
4117
|
"method-buy": {
|
|
4143
4118
|
label: q(r === "buy", "Buy"),
|
|
4144
|
-
group:
|
|
4119
|
+
group: za,
|
|
4145
4120
|
action: () => this.modeling.setMethod(e, "buy")
|
|
4146
4121
|
},
|
|
4147
4122
|
"method-outsource": {
|
|
4148
4123
|
label: q(r === "outsource", "Outsource"),
|
|
4149
|
-
group:
|
|
4124
|
+
group: za,
|
|
4150
4125
|
action: () => this.modeling.setMethod(e, "outsource")
|
|
4151
4126
|
},
|
|
4152
4127
|
"prop-inertia": {
|
|
4153
4128
|
label: q(!!t.inertia, "Inertia"),
|
|
4154
|
-
group:
|
|
4129
|
+
group: Ba,
|
|
4155
4130
|
action: () => this.modeling.toggleInertia(e)
|
|
4156
4131
|
}
|
|
4157
4132
|
};
|
|
4158
4133
|
}
|
|
4159
|
-
},
|
|
4134
|
+
}, Ua = {
|
|
4160
4135
|
__init__: ["wardleyElementSettings"],
|
|
4161
|
-
wardleyElementSettings: ["type",
|
|
4162
|
-
},
|
|
4163
|
-
|
|
4136
|
+
wardleyElementSettings: ["type", Ha]
|
|
4137
|
+
}, Wa = {
|
|
4138
|
+
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\"/>",
|
|
4139
|
+
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\"/>",
|
|
4140
|
+
"circle-plus": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M8 12h8\"/><path d=\"M12 8v8\"/>",
|
|
4141
|
+
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
4142
|
+
"chevrons-right": "<path d=\"m6 17 5-5-5-5\"/><path d=\"m13 17 5-5-5-5\"/>",
|
|
4143
|
+
"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\"/>",
|
|
4144
|
+
"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\"/>",
|
|
4145
|
+
"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\"/>",
|
|
4146
|
+
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\"/>",
|
|
4147
|
+
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\"/>",
|
|
4148
|
+
"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\"/>"
|
|
4149
|
+
};
|
|
4150
|
+
/*! @miragon/wardley-renderer icon geometry: the context pad icons. Lucide (lucide-static 1.59.0)
|
|
4151
|
+
* @license ISC Copyright (c) 2026 Lucide Icons and Contributors
|
|
4152
|
+
* arrow-right, chevrons-right, circle-plus, external-link, link and trash derive from Feather
|
|
4153
|
+
* @license MIT, Copyright (c) 2013-present Cole Bemis
|
|
4154
|
+
* Full notices: README.md of @miragon/wardley-renderer */
|
|
4155
|
+
function J(e) {
|
|
4156
|
+
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">${Wa[e]}</svg>`;
|
|
4157
|
+
}
|
|
4158
|
+
// src/context-pad/WardleyContextPadProvider.ts
|
|
4159
|
+
var Ga = "edit", Ka = "wardley", qa = "danger", Ja = 80, Ya = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowUp"]), Xa = /* @__PURE__ */ new Set(["ArrowRight", "ArrowDown"]);
|
|
4160
|
+
function Za(e) {
|
|
4164
4161
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
4165
4162
|
}
|
|
4166
4163
|
function Y(e, t, n = !1) {
|
|
4167
|
-
let r =
|
|
4164
|
+
let r = Za(t);
|
|
4168
4165
|
return `<div class="entry wardley-cp-entry" role="button" tabindex="0" aria-label="${r}"${n ? " draggable=\"true\"" : ""} title="${r}">${e}</div>`;
|
|
4169
4166
|
}
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
var co = {
|
|
4167
|
+
// src/context-pad/index.ts
|
|
4168
|
+
var Qa = {
|
|
4173
4169
|
__depends__: [we],
|
|
4174
4170
|
__init__: ["wardleyContextPadProvider"],
|
|
4175
|
-
contextPad: ["type",
|
|
4171
|
+
contextPad: ["type", $i],
|
|
4176
4172
|
wardleyContextPadProvider: ["type", class {
|
|
4177
4173
|
contextPad;
|
|
4178
4174
|
modeling;
|
|
@@ -4208,65 +4204,65 @@ var co = {
|
|
|
4208
4204
|
});
|
|
4209
4205
|
}
|
|
4210
4206
|
getContextPadEntries(e) {
|
|
4211
|
-
if (
|
|
4207
|
+
if (I(this.injector)) return {};
|
|
4212
4208
|
if (M(e)) return this.connectionEntries(e);
|
|
4213
4209
|
if (!j(e)) return {};
|
|
4214
4210
|
let t = e, n = {};
|
|
4215
4211
|
return this.addPrimaryEntries(t, n), this.addPropertyEntries(t, n), n.delete = {
|
|
4216
|
-
group:
|
|
4212
|
+
group: qa,
|
|
4217
4213
|
title: "Delete",
|
|
4218
|
-
html: Y(
|
|
4219
|
-
action: { click: () => this.modeling.removeElements([t]) }
|
|
4214
|
+
html: Y(J("trash"), "Delete"),
|
|
4215
|
+
action: { click: this.focusingCanvas(() => this.modeling.removeElements([t])) }
|
|
4220
4216
|
}, n;
|
|
4221
4217
|
}
|
|
4222
4218
|
connectionEntries(e) {
|
|
4223
4219
|
let t = e.wardleyType === "flow" ? "Edit flow value" : "Edit link annotation";
|
|
4224
4220
|
return {
|
|
4225
4221
|
"edit-value": {
|
|
4226
|
-
group:
|
|
4222
|
+
group: Ga,
|
|
4227
4223
|
title: t,
|
|
4228
|
-
html: Y(
|
|
4224
|
+
html: Y(J("pencil"), t),
|
|
4229
4225
|
action: { click: () => this.labelEditing.activateConnection(e) }
|
|
4230
4226
|
},
|
|
4231
4227
|
delete: {
|
|
4232
|
-
group:
|
|
4228
|
+
group: qa,
|
|
4233
4229
|
title: "Delete connection",
|
|
4234
|
-
html: Y(
|
|
4235
|
-
action: { click: () => this.modeling.removeElements([e]) }
|
|
4230
|
+
html: Y(J("trash"), "Delete connection"),
|
|
4231
|
+
action: { click: this.focusingCanvas(() => this.modeling.removeElements([e])) }
|
|
4236
4232
|
}
|
|
4237
4233
|
};
|
|
4238
4234
|
}
|
|
4239
4235
|
addPrimaryEntries(e, t) {
|
|
4240
4236
|
if (e.wardleyType !== "drawing" && e.wardleyType !== "attitude" && (t["edit-label"] = {
|
|
4241
|
-
group:
|
|
4237
|
+
group: Ga,
|
|
4242
4238
|
title: "Edit label",
|
|
4243
|
-
html: Y(
|
|
4239
|
+
html: Y(J("pencil"), "Edit label"),
|
|
4244
4240
|
action: { click: () => this.labelEditing.activate(e) }
|
|
4245
4241
|
}), e.wardleyType === "component" || e.wardleyType === "anchor" || e.wardleyType === "submap" || e.wardleyType === "pipeline") {
|
|
4246
|
-
let n = (t) => {
|
|
4242
|
+
let n = this.focusingCanvas((t) => {
|
|
4247
4243
|
if (this.keyboardEvents.has(t)) {
|
|
4248
4244
|
this.appendBelow(e);
|
|
4249
4245
|
return;
|
|
4250
4246
|
}
|
|
4251
4247
|
let n = this.factory.createNew("component", "Component");
|
|
4252
4248
|
this.create.start(t, n, { source: e });
|
|
4253
|
-
};
|
|
4249
|
+
});
|
|
4254
4250
|
t.append = {
|
|
4255
|
-
group:
|
|
4251
|
+
group: Ga,
|
|
4256
4252
|
title: "Append component (auto-connect)",
|
|
4257
|
-
html: Y(
|
|
4253
|
+
html: Y(J("circle-plus"), "Append component", !0),
|
|
4258
4254
|
action: {
|
|
4259
4255
|
click: n,
|
|
4260
4256
|
dragstart: n
|
|
4261
4257
|
}
|
|
4262
4258
|
};
|
|
4263
|
-
let r = (t) => {
|
|
4259
|
+
let r = this.focusingCanvas((t) => {
|
|
4264
4260
|
this.connect.start(t, e);
|
|
4265
|
-
};
|
|
4261
|
+
});
|
|
4266
4262
|
t.connect = {
|
|
4267
|
-
group:
|
|
4263
|
+
group: Ga,
|
|
4268
4264
|
title: "Connect to existing element (A)",
|
|
4269
|
-
html: Y(
|
|
4265
|
+
html: Y(J("arrow-right"), "Connect to existing element (A)", !0),
|
|
4270
4266
|
action: {
|
|
4271
4267
|
click: r,
|
|
4272
4268
|
dragstart: r
|
|
@@ -4275,17 +4271,17 @@ var co = {
|
|
|
4275
4271
|
}
|
|
4276
4272
|
if (e.wardleyType === "component") {
|
|
4277
4273
|
if (e.movement) t["evolve-clear"] = {
|
|
4278
|
-
group:
|
|
4274
|
+
group: Ga,
|
|
4279
4275
|
title: "Remove evolve",
|
|
4280
|
-
html: Y(
|
|
4281
|
-
action: { click: () => this.wardleyModeling.clearMovement(e) }
|
|
4276
|
+
html: Y(J("chevrons-right-x"), "Remove evolve"),
|
|
4277
|
+
action: { click: this.focusingCanvas(() => this.wardleyModeling.clearMovement(e)) }
|
|
4282
4278
|
};
|
|
4283
4279
|
else if (e.evolution < .999) {
|
|
4284
|
-
let n = (t) => this.evolveDragging.start(t, e);
|
|
4280
|
+
let n = this.focusingCanvas((t) => this.evolveDragging.start(t, e));
|
|
4285
4281
|
t.evolve = {
|
|
4286
|
-
group:
|
|
4282
|
+
group: Ga,
|
|
4287
4283
|
title: "Evolve: drag to set the target maturity",
|
|
4288
|
-
html: Y(
|
|
4284
|
+
html: Y(J("chevrons-right"), "Evolve: drag to set the target maturity", !0),
|
|
4289
4285
|
action: {
|
|
4290
4286
|
click: n,
|
|
4291
4287
|
dragstart: n
|
|
@@ -4296,12 +4292,12 @@ var co = {
|
|
|
4296
4292
|
}
|
|
4297
4293
|
addPropertyEntries(e, t) {
|
|
4298
4294
|
if (e.wardleyType === "component" && (t.settings = {
|
|
4299
|
-
group:
|
|
4295
|
+
group: Ka,
|
|
4300
4296
|
title: "Settings (type, sourcing, inertia)",
|
|
4301
|
-
html: Y(
|
|
4297
|
+
html: Y(J("sliders-horizontal"), "Settings (type, sourcing, inertia)"),
|
|
4302
4298
|
action: { click: (t) => {
|
|
4303
4299
|
let n = t;
|
|
4304
|
-
this.popupMenu.open(e,
|
|
4300
|
+
this.popupMenu.open(e, La, {
|
|
4305
4301
|
x: n.clientX,
|
|
4306
4302
|
y: n.clientY
|
|
4307
4303
|
});
|
|
@@ -4309,45 +4305,50 @@ var co = {
|
|
|
4309
4305
|
}), e.wardleyType === "drawing") {
|
|
4310
4306
|
let n = e.strokeStyle === "dashed" ? "dotted" : e.strokeStyle === "dotted" ? void 0 : "dashed", r = `Line style: ${e.strokeStyle ?? "solid"} (click to change)`;
|
|
4311
4307
|
t["stroke-style"] = {
|
|
4312
|
-
group:
|
|
4308
|
+
group: Ka,
|
|
4313
4309
|
title: r,
|
|
4314
|
-
html: Y(
|
|
4315
|
-
action: { click: () => this.wardleyModeling.updateProperties(e, { strokeStyle: n }) }
|
|
4310
|
+
html: Y(J("line-style"), r),
|
|
4311
|
+
action: { click: this.focusingCanvas(() => this.wardleyModeling.updateProperties(e, { strokeStyle: n })) }
|
|
4316
4312
|
};
|
|
4317
4313
|
}
|
|
4318
4314
|
t.color = {
|
|
4319
|
-
group:
|
|
4315
|
+
group: Ka,
|
|
4320
4316
|
title: "Color",
|
|
4321
|
-
html: Y(
|
|
4317
|
+
html: Y(J("palette"), "Color"),
|
|
4322
4318
|
action: { click: (t) => {
|
|
4323
4319
|
let n = t;
|
|
4324
4320
|
this.colorPicker.open(e, n.clientX, n.clientY);
|
|
4325
4321
|
} }
|
|
4326
4322
|
};
|
|
4327
|
-
let n = this.injector.get("wardleyLinkEditing", !1), r =
|
|
4328
|
-
if (n &&
|
|
4323
|
+
let n = this.injector.get("wardleyLinkEditing", !1), r = Pa(e);
|
|
4324
|
+
if (n && Na(e)) {
|
|
4329
4325
|
let i = r ? "Edit link…" : "Set link…";
|
|
4330
4326
|
t.link = {
|
|
4331
|
-
group:
|
|
4327
|
+
group: Ka,
|
|
4332
4328
|
title: i,
|
|
4333
|
-
html: Y(
|
|
4329
|
+
html: Y(J("link"), i),
|
|
4334
4330
|
action: { click: () => n.activate(e) }
|
|
4335
4331
|
};
|
|
4336
4332
|
}
|
|
4337
|
-
let i =
|
|
4333
|
+
let i = Oa(r);
|
|
4338
4334
|
i && (t["open-link"] = {
|
|
4339
|
-
group:
|
|
4335
|
+
group: Ka,
|
|
4340
4336
|
title: `Open link (${i})`,
|
|
4341
|
-
html: Y(
|
|
4342
|
-
action: { click: () => window.open(i, "_blank", "noopener,noreferrer") }
|
|
4337
|
+
html: Y(J("external-link"), `Open link (${i})`),
|
|
4338
|
+
action: { click: this.focusingCanvas(() => window.open(i, "_blank", "noopener,noreferrer")) }
|
|
4343
4339
|
});
|
|
4344
4340
|
}
|
|
4341
|
+
focusingCanvas(e) {
|
|
4342
|
+
return (t) => {
|
|
4343
|
+
e(t), this.keyboardEvents.has(t) || L(this.canvas);
|
|
4344
|
+
};
|
|
4345
|
+
}
|
|
4345
4346
|
onPadKeydown(e, t) {
|
|
4346
4347
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
4347
4348
|
let n = e.target?.closest?.(".entry"), r = n?.getAttribute("data-action");
|
|
4348
4349
|
if (!n || !r || !t.contains(n)) return;
|
|
4349
4350
|
let i = Array.from(t.querySelectorAll(".entry")), a = i.indexOf(n), o;
|
|
4350
|
-
if (
|
|
4351
|
+
if (Ya.has(e.key) ? o = i[(a - 1 + i.length) % i.length] : Xa.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") {
|
|
4351
4352
|
e.preventDefault(), e.stopPropagation(), o ? o.focus() : this.canvas.focus();
|
|
4352
4353
|
return;
|
|
4353
4354
|
}
|
|
@@ -4360,7 +4361,7 @@ var co = {
|
|
|
4360
4361
|
});
|
|
4361
4362
|
this.keyboardEvents.add(l), this.contextPad.triggerEntry(r, "click", l);
|
|
4362
4363
|
let u = document.activeElement;
|
|
4363
|
-
|
|
4364
|
+
t.isConnected || u && u !== document.body || this.canvas.focus();
|
|
4364
4365
|
}
|
|
4365
4366
|
clientCenterOf(e) {
|
|
4366
4367
|
let t = this.canvas.getContainer().getBoundingClientRect(), n = this.canvas.viewbox(), r = {
|
|
@@ -4388,12 +4389,12 @@ var co = {
|
|
|
4388
4389
|
visibility: 0
|
|
4389
4390
|
}).y, n = this.factory.createNew("component", "Component"), r = {
|
|
4390
4391
|
x: e.x + e.width / 2,
|
|
4391
|
-
y: Math.min(e.y + e.height / 2 +
|
|
4392
|
+
y: Math.min(e.y + e.height / 2 + Ja, t - n.height / 2)
|
|
4392
4393
|
}, i = this.modeling.appendShape(e, n, r, e.parent, { connection: { wardleyType: "dependency" } });
|
|
4393
4394
|
this.injector.get("selection", !1)?.select(i ?? n), this.labelEditing.activate(i ?? n);
|
|
4394
4395
|
}
|
|
4395
4396
|
}]
|
|
4396
|
-
},
|
|
4397
|
+
}, $a = 2, eo = 10, to = {
|
|
4397
4398
|
arrowleft: {
|
|
4398
4399
|
x: -1,
|
|
4399
4400
|
y: 0
|
|
@@ -4410,7 +4411,7 @@ var co = {
|
|
|
4410
4411
|
x: 0,
|
|
4411
4412
|
y: 1
|
|
4412
4413
|
}
|
|
4413
|
-
},
|
|
4414
|
+
}, no = {
|
|
4414
4415
|
c: {
|
|
4415
4416
|
type: "component",
|
|
4416
4417
|
label: "Component"
|
|
@@ -4427,36 +4428,15 @@ var co = {
|
|
|
4427
4428
|
type: "pipeline",
|
|
4428
4429
|
label: "Pipeline"
|
|
4429
4430
|
}
|
|
4430
|
-
},
|
|
4431
|
+
}, ro = 40, io = 56, ao = 160, oo = {
|
|
4431
4432
|
x: 48,
|
|
4432
4433
|
y: 40
|
|
4433
|
-
},
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
"
|
|
4437
|
-
"[contenteditable=\"\"]",
|
|
4438
|
-
"[contenteditable=\"true\"]",
|
|
4439
|
-
"dialog",
|
|
4440
|
-
"[role=\"dialog\"]",
|
|
4441
|
-
"[aria-modal=\"true\"]",
|
|
4442
|
-
"[role=\"menu\"]",
|
|
4443
|
-
".wardley-color-picker"
|
|
4444
|
-
].join(", "), bo = /* @__PURE__ */ new Set([
|
|
4445
|
-
...Object.keys(po),
|
|
4446
|
-
"l",
|
|
4447
|
-
"a"
|
|
4448
|
-
]);
|
|
4449
|
-
function xo(e) {
|
|
4450
|
-
if (e.altKey) return !1;
|
|
4451
|
-
let t = e.key.toLowerCase();
|
|
4452
|
-
return e.ctrlKey || e.metaKey ? t === "z" || t === "y" : bo.has(t);
|
|
4453
|
-
}
|
|
4454
|
-
function So(e, t, n = !1) {
|
|
4455
|
-
if (e.defaultPrevented) return !0;
|
|
4456
|
-
let r = e.target;
|
|
4457
|
-
return r instanceof globalThis.Element ? r instanceof HTMLElement && r.isContentEditable || r.closest(yo) ? !0 : r === document.body || r === document.documentElement || t.contains(r) ? !1 : n ? !0 : !(r.closest(".djs-palette") || r.closest("button, [role=\"button\"]") && xo(e)) : !1;
|
|
4434
|
+
}, so = 40;
|
|
4435
|
+
function co(e, t) {
|
|
4436
|
+
let n = e.target;
|
|
4437
|
+
return typeof e.key == "string" && !e.defaultPrevented && !e.isComposing && n instanceof Node && !!t?.contains(n);
|
|
4458
4438
|
}
|
|
4459
|
-
var
|
|
4439
|
+
var lo = class {
|
|
4460
4440
|
canvas;
|
|
4461
4441
|
selection;
|
|
4462
4442
|
modeling;
|
|
@@ -4487,7 +4467,7 @@ var Co = class {
|
|
|
4487
4467
|
this.canvas = e, this.selection = n, this.modeling = r, this.factory = a, this.create = o, this.mouse = s, this.elementRegistry = u;
|
|
4488
4468
|
let p = e.getContainer(), m = f?.undoRedo !== !1, h = d.get("dragging", !1), g = d.get("connect", !1), _ = d.get("rules", !1), v = d.get("popupMenu", !1), y = d.get("wardleyDrawTool", !1);
|
|
4489
4469
|
this.labelEditing = d.get("wardleyLabelEditing", !1) ?? null, this.grid = d.get("evolutionGrid", !1) ?? null, this.freeRect = d.get("wardleyFreeRect", !1) ?? null;
|
|
4490
|
-
let ee =
|
|
4470
|
+
let ee = Ot(e), te = () => this.pointerOverCanvas = !0, ne = () => this.pointerOverCanvas = !1;
|
|
4491
4471
|
p.addEventListener("mousemove", te), p.addEventListener("mouseleave", ne);
|
|
4492
4472
|
let re = !1, ie = (e) => {
|
|
4493
4473
|
e.key === "Escape" && (re = !!h?.context() || !!y?.isActive() || !!v?.isOpen() || !!p.querySelector(".wardley-color-picker"));
|
|
@@ -4500,7 +4480,7 @@ var Co = class {
|
|
|
4500
4480
|
}, 0));
|
|
4501
4481
|
}, w = (e) => {
|
|
4502
4482
|
x !== void 0 && e.defaultPrevented && (clearTimeout(x), x = void 0);
|
|
4503
|
-
}, oe = () =>
|
|
4483
|
+
}, oe = () => I(d), T = (e, r) => {
|
|
4504
4484
|
if (!oe() || ["a", "c"].includes(r)) {
|
|
4505
4485
|
if (r === "z" || r === "y") {
|
|
4506
4486
|
if (!m) return;
|
|
@@ -4512,9 +4492,9 @@ var Co = class {
|
|
|
4512
4492
|
if (!(oe() && t !== "escape" && t !== "l")) {
|
|
4513
4493
|
if (t === "escape") !re && n.get().length && n.select(null);
|
|
4514
4494
|
else if (t === "delete" || t === "backspace") ae(e);
|
|
4515
|
-
else if (i && t in
|
|
4495
|
+
else if (i && t in no) {
|
|
4516
4496
|
e.preventDefault();
|
|
4517
|
-
let { type: n, label: r } =
|
|
4497
|
+
let { type: n, label: r } = no[t];
|
|
4518
4498
|
this.quickCreate(n, r);
|
|
4519
4499
|
} else if (i && t === "a") {
|
|
4520
4500
|
let t = this.singleSelectedShape();
|
|
@@ -4526,11 +4506,11 @@ var Co = class {
|
|
|
4526
4506
|
};
|
|
4527
4507
|
g.start(this.pointerEventOr(n), t, n, !0);
|
|
4528
4508
|
} else if (i && t === "l") e.preventDefault(), c.activateSelection(s.getLastMoveEvent(), !0);
|
|
4529
|
-
else if (t in
|
|
4509
|
+
else if (t in to) {
|
|
4530
4510
|
let i = n.get();
|
|
4531
4511
|
if (!i.length) return;
|
|
4532
4512
|
e.preventDefault();
|
|
4533
|
-
let a = e.shiftKey ?
|
|
4513
|
+
let a = e.shiftKey ? eo : $a, o = to[t];
|
|
4534
4514
|
r.moveElements(i, {
|
|
4535
4515
|
x: o.x * a,
|
|
4536
4516
|
y: o.y * a
|
|
@@ -4538,7 +4518,7 @@ var Co = class {
|
|
|
4538
4518
|
}
|
|
4539
4519
|
}
|
|
4540
4520
|
}, ce = (e) => {
|
|
4541
|
-
if (
|
|
4521
|
+
if (!co(e, ee)) return;
|
|
4542
4522
|
let t = e.key.toLowerCase();
|
|
4543
4523
|
e.ctrlKey || e.metaKey ? T(e, t) : se(e, t);
|
|
4544
4524
|
};
|
|
@@ -4565,10 +4545,10 @@ var Co = class {
|
|
|
4565
4545
|
evolution: 1
|
|
4566
4546
|
});
|
|
4567
4547
|
return {
|
|
4568
|
-
left: e.x +
|
|
4569
|
-
top: e.y +
|
|
4570
|
-
right: t.x -
|
|
4571
|
-
bottom: t.y -
|
|
4548
|
+
left: e.x + ro,
|
|
4549
|
+
top: e.y + ro,
|
|
4550
|
+
right: t.x - ro,
|
|
4551
|
+
bottom: t.y - ro
|
|
4572
4552
|
};
|
|
4573
4553
|
}
|
|
4574
4554
|
visiblePlotCenter(e) {
|
|
@@ -4577,17 +4557,17 @@ var Co = class {
|
|
|
4577
4557
|
y: t.y + t.height / 2
|
|
4578
4558
|
};
|
|
4579
4559
|
return e ? {
|
|
4580
|
-
x:
|
|
4581
|
-
y:
|
|
4560
|
+
x: uo(n.x, e.left, e.right),
|
|
4561
|
+
y: uo(n.y, e.top, e.bottom)
|
|
4582
4562
|
} : n;
|
|
4583
4563
|
}
|
|
4584
4564
|
freeSpotNear(e, t) {
|
|
4585
|
-
let n = (e) => !!this.elementRegistry.find((t) => j(t) && Math.abs(t.x + t.width / 2 - e.x) <
|
|
4586
|
-
for (let i = 0; i <
|
|
4565
|
+
let n = (e) => !!this.elementRegistry.find((t) => j(t) && Math.abs(t.x + t.width / 2 - e.x) < oo.x && Math.abs(t.y + t.height / 2 - e.y) < oo.y), r = e;
|
|
4566
|
+
for (let i = 0; i < so && n(r); i++) if (r = {
|
|
4587
4567
|
x: r.x,
|
|
4588
|
-
y: r.y +
|
|
4568
|
+
y: r.y + io
|
|
4589
4569
|
}, t && r.y > t.bottom && (r = {
|
|
4590
|
-
x: r.x +
|
|
4570
|
+
x: r.x + ao,
|
|
4591
4571
|
y: e.y
|
|
4592
4572
|
}, r.x > t.right)) return e;
|
|
4593
4573
|
return r;
|
|
@@ -4605,22 +4585,21 @@ var Co = class {
|
|
|
4605
4585
|
});
|
|
4606
4586
|
}
|
|
4607
4587
|
};
|
|
4608
|
-
function
|
|
4588
|
+
function uo(e, t, n) {
|
|
4609
4589
|
return t > n ? (t + n) / 2 : Math.min(Math.max(e, t), n);
|
|
4610
4590
|
}
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
var To = {
|
|
4591
|
+
// src/keyboard/index.ts
|
|
4592
|
+
var fo = {
|
|
4614
4593
|
__init__: ["wardleyKeyboard"],
|
|
4615
|
-
wardleyKeyboard: ["type",
|
|
4616
|
-
},
|
|
4594
|
+
wardleyKeyboard: ["type", lo]
|
|
4595
|
+
}, po = /* @__PURE__ */ new Set([
|
|
4617
4596
|
"component",
|
|
4618
4597
|
"anchor",
|
|
4619
4598
|
"submap",
|
|
4620
4599
|
"pipeline",
|
|
4621
4600
|
"accelerator",
|
|
4622
4601
|
"note"
|
|
4623
|
-
]),
|
|
4602
|
+
]), mo = 500, ho = class {
|
|
4624
4603
|
static $inject = ["injector", "eventBus"];
|
|
4625
4604
|
constructor(e, t) {
|
|
4626
4605
|
let n = e.get("connectionPreview", !1), r = e.get("wardleyLabelEditing", !1);
|
|
@@ -4645,21 +4624,21 @@ var To = {
|
|
|
4645
4624
|
"create.cleanup"
|
|
4646
4625
|
], (e) => {
|
|
4647
4626
|
n.cleanUp(e.context);
|
|
4648
|
-
})), r && t.on("create.end",
|
|
4627
|
+
})), r && t.on("create.end", mo, (e) => {
|
|
4649
4628
|
let { context: t } = e, n = t.shape;
|
|
4650
|
-
t.canExecute && n && !t.wardleyPaste && (t.elements?.length ?? 1) === 1 &&
|
|
4629
|
+
t.canExecute && n && !t.wardleyPaste && (t.elements?.length ?? 1) === 1 && po.has(n.wardleyType) && setTimeout(() => r.activate(n), 0);
|
|
4651
4630
|
});
|
|
4652
4631
|
}
|
|
4653
|
-
},
|
|
4632
|
+
}, go = {
|
|
4654
4633
|
__depends__: [Me],
|
|
4655
4634
|
__init__: ["wardleyAppendBehavior"],
|
|
4656
|
-
wardleyAppendBehavior: ["type",
|
|
4657
|
-
},
|
|
4635
|
+
wardleyAppendBehavior: ["type", ho]
|
|
4636
|
+
}, _o = {
|
|
4658
4637
|
ArrowLeft: -1,
|
|
4659
4638
|
ArrowRight: 1,
|
|
4660
4639
|
ArrowUp: -3,
|
|
4661
4640
|
ArrowDown: 3
|
|
4662
|
-
},
|
|
4641
|
+
}, vo = class {
|
|
4663
4642
|
canvas;
|
|
4664
4643
|
modeling;
|
|
4665
4644
|
injector;
|
|
@@ -4674,17 +4653,18 @@ var To = {
|
|
|
4674
4653
|
this.popover && !this.popover.contains(e.target) && this.close();
|
|
4675
4654
|
};
|
|
4676
4655
|
onKey = (e) => {
|
|
4677
|
-
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close({ restoreFocus: !0 }));
|
|
4656
|
+
e.key === "Escape" && e.target instanceof Node && this.canvas.getContainer().contains(e.target) && (e.preventDefault(), e.stopPropagation(), this.close({ restoreFocus: !0 }));
|
|
4678
4657
|
};
|
|
4679
4658
|
constructor(e, t, n, r) {
|
|
4680
4659
|
this.canvas = e, this.modeling = n, this.injector = r, t.on([
|
|
4681
4660
|
"canvas.viewbox.changing",
|
|
4682
4661
|
"drag.init",
|
|
4683
|
-
"diagram.clear"
|
|
4662
|
+
"diagram.clear",
|
|
4663
|
+
"diagram.destroy"
|
|
4684
4664
|
], () => this.close());
|
|
4685
4665
|
}
|
|
4686
4666
|
open(e, t, n) {
|
|
4687
|
-
if (this.close(),
|
|
4667
|
+
if (this.close(), I(this.injector)) return;
|
|
4688
4668
|
let r = this.canvas.getContainer(), i = r.getBoundingClientRect(), a = document.createElement("div");
|
|
4689
4669
|
a.className = "wardley-color-picker", a.setAttribute("role", "dialog"), a.setAttribute("aria-label", "Color");
|
|
4690
4670
|
let o = [{
|
|
@@ -4707,7 +4687,7 @@ var To = {
|
|
|
4707
4687
|
a.addEventListener("keydown", (e) => this.onGridKeydown(e, s)), r.appendChild(a);
|
|
4708
4688
|
let l = r.clientWidth, u = r.clientHeight, d = a.offsetWidth, f = a.offsetHeight, p = Math.max(4, Math.min(t - i.left, l - d - 4)), m = Math.max(4, Math.min(n - i.top, u - f - 4));
|
|
4709
4689
|
a.style.left = `${p}px`, a.style.top = `${m}px`, this.popover = a, (c ?? s[0])?.focus({ preventScroll: !0 }), setTimeout(() => {
|
|
4710
|
-
document.addEventListener("click", this.onDocPointer, !0), document.addEventListener("keydown", this.onKey, !0);
|
|
4690
|
+
this.popover === a && (document.addEventListener("click", this.onDocPointer, !0), document.addEventListener("keydown", this.onKey, !0));
|
|
4711
4691
|
}, 0);
|
|
4712
4692
|
}
|
|
4713
4693
|
isOpen() {
|
|
@@ -4719,19 +4699,18 @@ var To = {
|
|
|
4719
4699
|
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();
|
|
4720
4700
|
}
|
|
4721
4701
|
onGridKeydown(e, t) {
|
|
4722
|
-
let n =
|
|
4702
|
+
let n = _o[e.key], r = t.indexOf(document.activeElement), i;
|
|
4723
4703
|
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());
|
|
4724
4704
|
}
|
|
4725
|
-
},
|
|
4705
|
+
}, yo = {
|
|
4726
4706
|
__init__: ["wardleyColorPicker"],
|
|
4727
|
-
wardleyColorPicker: ["type",
|
|
4707
|
+
wardleyColorPicker: ["type", vo]
|
|
4728
4708
|
};
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
function No(e) {
|
|
4709
|
+
// src/ordering/WardleyOrderingProvider.ts
|
|
4710
|
+
function bo(e) {
|
|
4732
4711
|
return j(e) && (e.wardleyType === "attitude" || e.wardleyType === "pipeline");
|
|
4733
4712
|
}
|
|
4734
|
-
var
|
|
4713
|
+
var xo = class extends Ne {
|
|
4735
4714
|
static $inject = ["eventBus"];
|
|
4736
4715
|
constructor(e) {
|
|
4737
4716
|
super(e);
|
|
@@ -4742,18 +4721,18 @@ var Po = class extends Ne {
|
|
|
4742
4721
|
let r = e.wardleyType === "flow";
|
|
4743
4722
|
return {
|
|
4744
4723
|
parent: t,
|
|
4745
|
-
index: n.filter((t) => t !== e && (
|
|
4724
|
+
index: n.filter((t) => t !== e && (bo(t) || M(t) && (r || t.wardleyType !== "flow"))).length
|
|
4746
4725
|
};
|
|
4747
4726
|
}
|
|
4748
|
-
return
|
|
4727
|
+
return bo(e) ? {
|
|
4749
4728
|
parent: t,
|
|
4750
|
-
index: n.filter((t) => t !== e &&
|
|
4729
|
+
index: n.filter((t) => t !== e && bo(t)).length
|
|
4751
4730
|
} : { parent: t };
|
|
4752
4731
|
}
|
|
4753
|
-
},
|
|
4732
|
+
}, So = {
|
|
4754
4733
|
__init__: ["wardleyOrderingProvider"],
|
|
4755
|
-
wardleyOrderingProvider: ["type",
|
|
4756
|
-
},
|
|
4734
|
+
wardleyOrderingProvider: ["type", xo]
|
|
4735
|
+
}, Co = 12, wo = "input, textarea, select, .monaco-editor", To = class {
|
|
4757
4736
|
canvas;
|
|
4758
4737
|
eventBus;
|
|
4759
4738
|
modeling;
|
|
@@ -4788,7 +4767,7 @@ var Po = class extends Ne {
|
|
|
4788
4767
|
return e.closest(".wardley-container") ?? e;
|
|
4789
4768
|
}
|
|
4790
4769
|
activate() {
|
|
4791
|
-
if (this.active ||
|
|
4770
|
+
if (this.active || I(this.injector)) return;
|
|
4792
4771
|
this.active = !0, this.points = [], this.cursor = null;
|
|
4793
4772
|
let e = this.canvas.getContainer();
|
|
4794
4773
|
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: "draw" });
|
|
@@ -4831,14 +4810,14 @@ var Po = class extends Ne {
|
|
|
4831
4810
|
}
|
|
4832
4811
|
onMouseDown = (e) => {
|
|
4833
4812
|
if (e.button !== 0 || this.isChromeTarget(e)) return;
|
|
4834
|
-
e.preventDefault(), e.stopPropagation();
|
|
4813
|
+
e.preventDefault(), e.stopPropagation(), L(this.canvas);
|
|
4835
4814
|
let t = this.toCanvasPoint(e), n = this.points[0];
|
|
4836
|
-
if (n && this.points.length >= 3 &&
|
|
4815
|
+
if (n && this.points.length >= 3 && Eo(t, n) <= Co) {
|
|
4837
4816
|
this.finishClosed();
|
|
4838
4817
|
return;
|
|
4839
4818
|
}
|
|
4840
4819
|
let r = this.points[this.points.length - 1];
|
|
4841
|
-
r &&
|
|
4820
|
+
r && Eo(t, r) <= Co ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
|
|
4842
4821
|
};
|
|
4843
4822
|
onDblClick = (e) => {
|
|
4844
4823
|
this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
|
|
@@ -4846,8 +4825,12 @@ var Po = class extends Ne {
|
|
|
4846
4825
|
onMouseMove = (e) => {
|
|
4847
4826
|
this.points.length && (this.cursor = this.toCanvasPoint(e), this.renderPreview());
|
|
4848
4827
|
};
|
|
4828
|
+
ownsKey(e) {
|
|
4829
|
+
let t = e.target;
|
|
4830
|
+
return typeof e.key != "string" || e.defaultPrevented || e.isComposing || !(t instanceof globalThis.Element) || !this.canvas.getContainer().contains(t) ? !1 : !Do(t);
|
|
4831
|
+
}
|
|
4849
4832
|
onKeyDown = (e) => {
|
|
4850
|
-
e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.points.length >= 2 ? this.finish() : this.cancel()) : e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), this.finish());
|
|
4833
|
+
this.ownsKey(e) && (e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), this.points.length >= 2 ? this.finish() : this.cancel()) : e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), this.finish()));
|
|
4851
4834
|
};
|
|
4852
4835
|
renderPreview() {
|
|
4853
4836
|
if (this.clearPreview(), !this.points.length) return;
|
|
@@ -4886,12 +4869,14 @@ var Po = class extends Ne {
|
|
|
4886
4869
|
this.layer &&= (se(this.layer), null);
|
|
4887
4870
|
}
|
|
4888
4871
|
};
|
|
4889
|
-
function
|
|
4872
|
+
function Eo(e, t) {
|
|
4890
4873
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
4891
4874
|
}
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4875
|
+
function Do(e) {
|
|
4876
|
+
return e instanceof HTMLElement && e.isContentEditable || e.editContext ? !0 : e.closest(wo) !== null;
|
|
4877
|
+
}
|
|
4878
|
+
// src/draw-tool/WardleyDrawingHandles.ts
|
|
4879
|
+
var Oo = class {
|
|
4895
4880
|
eventBus;
|
|
4896
4881
|
canvas;
|
|
4897
4882
|
modeling;
|
|
@@ -4942,8 +4927,8 @@ var zo = class {
|
|
|
4942
4927
|
}), C(e, t), this.group = t;
|
|
4943
4928
|
}
|
|
4944
4929
|
startDrag(e, t) {
|
|
4945
|
-
if (e.button !== 0 || !this.shape ||
|
|
4946
|
-
e.preventDefault(), e.stopPropagation();
|
|
4930
|
+
if (e.button !== 0 || !this.shape || I(this.injector)) return;
|
|
4931
|
+
e.preventDefault(), e.stopPropagation(), L(this.canvas);
|
|
4947
4932
|
let n = this.shape, r = this.absolutePoints(), i = (e) => {
|
|
4948
4933
|
r[t] = this.toCanvasPoint(e), this.renderDragPreview(r, !!n.closed);
|
|
4949
4934
|
}, a = (e) => {
|
|
@@ -4992,22 +4977,21 @@ var zo = class {
|
|
|
4992
4977
|
}));
|
|
4993
4978
|
}
|
|
4994
4979
|
};
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
function Bo(e) {
|
|
4980
|
+
// src/draw-tool/WardleyDrawingHitProvider.ts
|
|
4981
|
+
function ko(e) {
|
|
4998
4982
|
return j(e) && e.wardleyType === "drawing";
|
|
4999
4983
|
}
|
|
5000
|
-
var
|
|
4984
|
+
var Ao = class {
|
|
5001
4985
|
static $inject = ["eventBus", "interactionEvents"];
|
|
5002
4986
|
constructor(e, t) {
|
|
5003
4987
|
e.on("interactionEvents.createHit", (e) => {
|
|
5004
|
-
if (
|
|
4988
|
+
if (ko(e.element) && e.gfx) return jo(e.element, e.gfx), !1;
|
|
5005
4989
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
5006
|
-
if (
|
|
4990
|
+
if (ko(e.element) && e.gfx) return t.removeHits(e.gfx), jo(e.element, e.gfx), !1;
|
|
5007
4991
|
});
|
|
5008
4992
|
}
|
|
5009
4993
|
};
|
|
5010
|
-
function
|
|
4994
|
+
function jo(e, t) {
|
|
5011
4995
|
let n = e.drawingPoints ?? [], r = T(e.closed ? "polygon" : "polyline");
|
|
5012
4996
|
w(r, {
|
|
5013
4997
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
@@ -5018,18 +5002,17 @@ function Ho(e, t) {
|
|
|
5018
5002
|
"stroke-opacity": 0
|
|
5019
5003
|
}), C(t, r);
|
|
5020
5004
|
}
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
var Uo = {
|
|
5005
|
+
// src/draw-tool/index.ts
|
|
5006
|
+
var Mo = {
|
|
5024
5007
|
__init__: [
|
|
5025
5008
|
"wardleyDrawTool",
|
|
5026
5009
|
"wardleyDrawingHandles",
|
|
5027
5010
|
"wardleyDrawingHitProvider"
|
|
5028
5011
|
],
|
|
5029
|
-
wardleyDrawTool: ["type",
|
|
5030
|
-
wardleyDrawingHandles: ["type",
|
|
5031
|
-
wardleyDrawingHitProvider: ["type",
|
|
5032
|
-
},
|
|
5012
|
+
wardleyDrawTool: ["type", To],
|
|
5013
|
+
wardleyDrawingHandles: ["type", Oo],
|
|
5014
|
+
wardleyDrawingHitProvider: ["type", Ao]
|
|
5015
|
+
}, No = 3, Po = 4, Fo = "wardley-labels-draggable", Io = "wardley-label-dragging", Lo = class {
|
|
5033
5016
|
eventBus;
|
|
5034
5017
|
canvas;
|
|
5035
5018
|
elementRegistry;
|
|
@@ -5050,7 +5033,7 @@ var Uo = {
|
|
|
5050
5033
|
constructor(e, t, n, r, i, a, o) {
|
|
5051
5034
|
this.eventBus = e, this.canvas = t, this.elementRegistry = n, this.modeling = r, this.selection = i, this.grid = a, this.injector = o;
|
|
5052
5035
|
let s = t.getContainer();
|
|
5053
|
-
this.outerContainer().classList.add(
|
|
5036
|
+
this.outerContainer().classList.add(Fo), s.addEventListener("mousedown", this.onMouseDown, !0), s.addEventListener("dblclick", this.onDoubleClick, !0), e.on("shape.remove", ({ element: e }) => {
|
|
5054
5037
|
this.active?.shape === e && this.cancel();
|
|
5055
5038
|
}), e.on("diagram.destroy", () => {
|
|
5056
5039
|
this.cancel(), s.removeEventListener("mousedown", this.onMouseDown, !0), s.removeEventListener("dblclick", this.onDoubleClick, !0);
|
|
@@ -5060,12 +5043,12 @@ var Uo = {
|
|
|
5060
5043
|
t === "movement" ? e.movement?.labelOffset && this.commitMovementOffset(e, void 0) : e.labelOffset && this.commitNameOffset(e, void 0);
|
|
5061
5044
|
}
|
|
5062
5045
|
onMouseDown = (e) => {
|
|
5063
|
-
if (e.button !== 0 || this.outerContainer().classList.contains("wardley-draw-mode") ||
|
|
5046
|
+
if (e.button !== 0 || this.outerContainer().classList.contains("wardley-draw-mode") || I(this.injector)) return;
|
|
5064
5047
|
let t = this.labelTarget(e);
|
|
5065
5048
|
if (!t) return;
|
|
5066
5049
|
e.stopPropagation(), e.preventDefault();
|
|
5067
5050
|
let n = document.activeElement;
|
|
5068
|
-
n instanceof HTMLElement && this.outerContainer().contains(n) && n.blur(),
|
|
5051
|
+
n instanceof HTMLElement && this.outerContainer().contains(n) && n.blur(), L(this.canvas);
|
|
5069
5052
|
let { shape: r, role: i, handle: a } = t, o = this.renderedOffset(r, i, a);
|
|
5070
5053
|
this.active = {
|
|
5071
5054
|
shape: r,
|
|
@@ -5087,8 +5070,8 @@ var Uo = {
|
|
|
5087
5070
|
if (!t) return;
|
|
5088
5071
|
let n = e.clientX - t.startClient.x, r = e.clientY - t.startClient.y;
|
|
5089
5072
|
if (!t.dragging) {
|
|
5090
|
-
if (Math.hypot(n, r) <
|
|
5091
|
-
t.dragging = !0, this.outerContainer().classList.add(
|
|
5073
|
+
if (Math.hypot(n, r) < No) return;
|
|
5074
|
+
t.dragging = !0, this.outerContainer().classList.add(Io);
|
|
5092
5075
|
}
|
|
5093
5076
|
t.latest = {
|
|
5094
5077
|
dx: Math.round(t.startOffset.dx + n / t.zoom),
|
|
@@ -5099,7 +5082,7 @@ var Uo = {
|
|
|
5099
5082
|
let e = this.active;
|
|
5100
5083
|
if (!e || (this.finish(), !e.dragging || !e.latest) || this.elementRegistry.get(e.shape.id) !== e.shape) return;
|
|
5101
5084
|
let t = this.snapHome(e.latest, e.homeOffset);
|
|
5102
|
-
|
|
5085
|
+
zo(t, e.role === "name" ? e.originalOffset : e.originalMovement?.labelOffset) || (e.role === "name" ? this.commitNameOffset(e.shape, t) : this.commitMovementOffset(e.shape, t)), this.suppressNextClick(), this.selection.select(e.shape);
|
|
5103
5086
|
};
|
|
5104
5087
|
suppressNextClick() {
|
|
5105
5088
|
let e = this.canvas.getContainer(), t = (e) => e.stopPropagation();
|
|
@@ -5112,7 +5095,7 @@ var Uo = {
|
|
|
5112
5095
|
e.key === "Escape" && this.active && (e.stopPropagation(), this.cancel());
|
|
5113
5096
|
};
|
|
5114
5097
|
onDoubleClick = (e) => {
|
|
5115
|
-
if (!e.altKey ||
|
|
5098
|
+
if (!e.altKey || I(this.injector)) return;
|
|
5116
5099
|
let t = this.labelTarget(e);
|
|
5117
5100
|
t && (e.stopPropagation(), e.preventDefault(), this.resetLabelOffset(t.shape, t.role));
|
|
5118
5101
|
};
|
|
@@ -5121,7 +5104,7 @@ var Uo = {
|
|
|
5121
5104
|
}
|
|
5122
5105
|
finish() {
|
|
5123
5106
|
let e = this.active;
|
|
5124
|
-
e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(
|
|
5107
|
+
e && (this.active = null, document.removeEventListener("mousemove", this.onMouseMove), document.removeEventListener("mouseup", this.onMouseUp), document.removeEventListener("keydown", this.onKeyDown, !0), this.outerContainer().classList.remove(Io), e.dragging && (e.originalOffset ? e.shape.labelOffset = e.originalOffset : delete e.shape.labelOffset, e.originalMovement && (e.shape.movement = e.originalMovement), this.eventBus.fire("element.changed", { element: e.shape })));
|
|
5125
5108
|
}
|
|
5126
5109
|
preview(e, t) {
|
|
5127
5110
|
e.role === "name" ? e.shape.labelOffset = t : e.originalMovement && (e.shape.movement = {
|
|
@@ -5130,7 +5113,7 @@ var Uo = {
|
|
|
5130
5113
|
}), this.eventBus.fire("element.changed", { element: e.shape });
|
|
5131
5114
|
}
|
|
5132
5115
|
snapHome(e, t) {
|
|
5133
|
-
return Math.abs(e.dx - t.dx) <=
|
|
5116
|
+
return Math.abs(e.dx - t.dx) <= Po && Math.abs(e.dy - t.dy) <= Po ? void 0 : Gr(e.dx, e.dy);
|
|
5134
5117
|
}
|
|
5135
5118
|
commitNameOffset(e, t) {
|
|
5136
5119
|
let n = { labelOffset: t }, r = e.businessObject;
|
|
@@ -5157,17 +5140,17 @@ var Uo = {
|
|
|
5157
5140
|
dx: 0,
|
|
5158
5141
|
dy: 0
|
|
5159
5142
|
};
|
|
5160
|
-
let r =
|
|
5143
|
+
let r = Ir(e, this.grid);
|
|
5161
5144
|
return t === "movement" ? r === void 0 ? {
|
|
5162
5145
|
dx: 0,
|
|
5163
5146
|
dy: 0
|
|
5164
|
-
} :
|
|
5147
|
+
} : Ro(Hr(void 0, r), Vr(r), n, e) : Ro(Br({
|
|
5165
5148
|
...e,
|
|
5166
5149
|
labelOffset: void 0
|
|
5167
|
-
}, r),
|
|
5150
|
+
}, r), Rr(), n, e);
|
|
5168
5151
|
}
|
|
5169
5152
|
labelTarget(e) {
|
|
5170
|
-
let t = e.target?.closest?.(`.${
|
|
5153
|
+
let t = e.target?.closest?.(`.${Jr}`);
|
|
5171
5154
|
if (!(t instanceof SVGTextElement)) return null;
|
|
5172
5155
|
let n = t.closest("[data-element-id]")?.getAttribute("data-element-id"), r = n ? this.elementRegistry.get(n) : void 0;
|
|
5173
5156
|
if (!j(r)) return null;
|
|
@@ -5183,31 +5166,30 @@ var Uo = {
|
|
|
5183
5166
|
return e.closest(".wardley-container") ?? e;
|
|
5184
5167
|
}
|
|
5185
5168
|
};
|
|
5186
|
-
function
|
|
5169
|
+
function Ro(e, t, n, r) {
|
|
5187
5170
|
let i = r.width / 2, a = e.anchor === "end" ? n.getBBox().x - i : e.x;
|
|
5188
5171
|
return {
|
|
5189
5172
|
dx: Math.round(a - t.x),
|
|
5190
5173
|
dy: Math.round(e.y - t.y)
|
|
5191
5174
|
};
|
|
5192
5175
|
}
|
|
5193
|
-
function
|
|
5176
|
+
function zo(e, t) {
|
|
5194
5177
|
return !e || !t ? !e && !t : e.dx === t.dx && e.dy === t.dy;
|
|
5195
5178
|
}
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
var Zo = {
|
|
5179
|
+
// src/label-drag/index.ts
|
|
5180
|
+
var Bo = {
|
|
5199
5181
|
__init__: ["wardleyLabelDragging"],
|
|
5200
|
-
wardleyLabelDragging: ["type",
|
|
5201
|
-
},
|
|
5182
|
+
wardleyLabelDragging: ["type", Lo]
|
|
5183
|
+
}, Vo = { autoScroll: ["type", Zt] }, Ho = class extends bi {
|
|
5202
5184
|
_getModules() {
|
|
5203
5185
|
return [
|
|
5204
5186
|
...super._getModules(),
|
|
5205
5187
|
pe,
|
|
5206
|
-
|
|
5188
|
+
ln,
|
|
5207
5189
|
Ee,
|
|
5208
5190
|
xe,
|
|
5209
5191
|
Se,
|
|
5210
|
-
|
|
5192
|
+
Vo,
|
|
5211
5193
|
he,
|
|
5212
5194
|
Ce,
|
|
5213
5195
|
we,
|
|
@@ -5215,27 +5197,27 @@ var Zo = {
|
|
|
5215
5197
|
De,
|
|
5216
5198
|
Oe,
|
|
5217
5199
|
ke,
|
|
5200
|
+
wr,
|
|
5201
|
+
Oi,
|
|
5218
5202
|
Er,
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5203
|
+
ki,
|
|
5204
|
+
Xi,
|
|
5205
|
+
Qa,
|
|
5206
|
+
Sa,
|
|
5207
|
+
fo,
|
|
5208
|
+
An,
|
|
5209
|
+
Ua,
|
|
5210
|
+
go,
|
|
5211
|
+
yo,
|
|
5212
|
+
Si,
|
|
5213
|
+
So,
|
|
5229
5214
|
Mo,
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
Dn,
|
|
5237
|
-
Zo,
|
|
5238
|
-
Ot
|
|
5215
|
+
Kn,
|
|
5216
|
+
$t,
|
|
5217
|
+
Ia,
|
|
5218
|
+
Pt,
|
|
5219
|
+
Bo,
|
|
5220
|
+
Dt
|
|
5239
5221
|
];
|
|
5240
5222
|
}
|
|
5241
5223
|
commitPendingEdits() {
|
|
@@ -5254,9 +5236,8 @@ var Zo = {
|
|
|
5254
5236
|
return this.get("commandStack").canRedo();
|
|
5255
5237
|
}
|
|
5256
5238
|
};
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
function es(e) {
|
|
5239
|
+
// src/editor-state.ts
|
|
5240
|
+
function Uo(e) {
|
|
5260
5241
|
let t;
|
|
5261
5242
|
try {
|
|
5262
5243
|
t = ae(e.exportMap());
|
|
@@ -5265,18 +5246,18 @@ function es(e) {
|
|
|
5265
5246
|
}
|
|
5266
5247
|
return (e) => t.get(e) ?? e;
|
|
5267
5248
|
}
|
|
5268
|
-
function
|
|
5249
|
+
function Wo(e, t = (e) => e) {
|
|
5269
5250
|
return {
|
|
5270
5251
|
sourceId: t(e.source?.id ?? ""),
|
|
5271
5252
|
targetId: t(e.target?.id ?? ""),
|
|
5272
5253
|
wardleyType: e.wardleyType
|
|
5273
5254
|
};
|
|
5274
5255
|
}
|
|
5275
|
-
function
|
|
5256
|
+
function Go(e, t) {
|
|
5276
5257
|
return e.find((e) => M(e) && e.source?.id === t.sourceId && e.target?.id === t.targetId && e.wardleyType === t.wardleyType);
|
|
5277
5258
|
}
|
|
5278
|
-
function
|
|
5279
|
-
let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o =
|
|
5259
|
+
function Ko(e) {
|
|
5260
|
+
let t = e.get("selection").get(), n = e.get("elementRegistry"), r = e.get("wardleyLabelEditing"), i = e.get("wardleyLinkEditing"), a = /* @__PURE__ */ new Map(), o = Uo(e), s = (e) => {
|
|
5280
5261
|
let t = o(e);
|
|
5281
5262
|
return a.set(t, e), t;
|
|
5282
5263
|
}, c, l = r.getActiveEdit(), u = i.getActiveEdit();
|
|
@@ -5284,7 +5265,7 @@ function rs(e) {
|
|
|
5284
5265
|
let e = n.get(l.elementId);
|
|
5285
5266
|
M(e) && (c = {
|
|
5286
5267
|
kind: "connection",
|
|
5287
|
-
key:
|
|
5268
|
+
key: Wo(e, s),
|
|
5288
5269
|
value: l.value,
|
|
5289
5270
|
...l.selection ? { selection: l.selection } : {}
|
|
5290
5271
|
});
|
|
@@ -5296,17 +5277,18 @@ function rs(e) {
|
|
|
5296
5277
|
} : u && (c = {
|
|
5297
5278
|
kind: "link",
|
|
5298
5279
|
elementId: s(u.elementId),
|
|
5299
|
-
value: u.value
|
|
5280
|
+
value: u.value,
|
|
5281
|
+
selection: u.selection
|
|
5300
5282
|
});
|
|
5301
5283
|
return r.cancel(), i.cancel(), {
|
|
5302
5284
|
shapeIds: t.filter(j).map((e) => s(e.id)),
|
|
5303
|
-
connections: t.filter(M).map((e) =>
|
|
5285
|
+
connections: t.filter(M).map((e) => Wo(e, s)),
|
|
5304
5286
|
...c ? { edit: c } : {},
|
|
5305
5287
|
canvasIds: a
|
|
5306
5288
|
};
|
|
5307
5289
|
}
|
|
5308
|
-
function
|
|
5309
|
-
let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) =>
|
|
5290
|
+
function qo(e, t, n = {}) {
|
|
5291
|
+
let r = e.get("elementRegistry"), i = (e) => n.importRejected ? t.canvasIds?.get(e) ?? e : e, a = (e) => r.get(i(e)), o = (e) => Go(r, {
|
|
5310
5292
|
...e,
|
|
5311
5293
|
sourceId: i(e.sourceId),
|
|
5312
5294
|
targetId: i(e.targetId)
|
|
@@ -5324,35 +5306,37 @@ function is(e, t, n = {}) {
|
|
|
5324
5306
|
}), !0) : !1;
|
|
5325
5307
|
}
|
|
5326
5308
|
let t = a(u.elementId);
|
|
5327
|
-
return j(t) ? (u.kind === "link" ? e.get("wardleyLinkEditing").activate(t, {
|
|
5309
|
+
return j(t) ? (u.kind === "link" ? e.get("wardleyLinkEditing").activate(t, {
|
|
5310
|
+
value: u.value,
|
|
5311
|
+
...u.selection ? { selection: u.selection } : {}
|
|
5312
|
+
}) : d.activate(t, {
|
|
5328
5313
|
value: u.value,
|
|
5329
5314
|
...u.selection ? { selection: u.selection } : {}
|
|
5330
5315
|
}), !0) : !1;
|
|
5331
|
-
})() ||
|
|
5316
|
+
})() || L(e.get("canvas"));
|
|
5332
5317
|
}
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
var as = "wardley", os = /* @__PURE__ */ new Set([
|
|
5318
|
+
// src/collaborative/CollaborativeWardley.ts
|
|
5319
|
+
var Jo = "wardley", Yo = /* @__PURE__ */ new Set([
|
|
5336
5320
|
"component",
|
|
5337
5321
|
"anchor",
|
|
5338
5322
|
"pipeline",
|
|
5339
5323
|
"submap",
|
|
5340
5324
|
"accelerator"
|
|
5341
5325
|
]);
|
|
5342
|
-
function
|
|
5343
|
-
return j(e) &&
|
|
5326
|
+
function Xo(e) {
|
|
5327
|
+
return j(e) && Yo.has(e.wardleyType);
|
|
5344
5328
|
}
|
|
5345
|
-
function
|
|
5346
|
-
return
|
|
5347
|
-
|
|
5329
|
+
function Zo(e = {}) {
|
|
5330
|
+
return ts(new Ho({
|
|
5331
|
+
...$o(e),
|
|
5348
5332
|
undoRedoKeys: e.undoRedoKeys,
|
|
5349
5333
|
keyboard: e.keyboard
|
|
5350
5334
|
}), !0);
|
|
5351
5335
|
}
|
|
5352
|
-
function
|
|
5353
|
-
return
|
|
5336
|
+
function Qo(e = {}) {
|
|
5337
|
+
return ts(new bi($o(e)), !1);
|
|
5354
5338
|
}
|
|
5355
|
-
function
|
|
5339
|
+
function $o(e) {
|
|
5356
5340
|
return {
|
|
5357
5341
|
width: "100%",
|
|
5358
5342
|
height: "100%",
|
|
@@ -5362,7 +5346,7 @@ function us(e) {
|
|
|
5362
5346
|
fitOnImport: e.fitOnImport
|
|
5363
5347
|
};
|
|
5364
5348
|
}
|
|
5365
|
-
function
|
|
5349
|
+
function es(e, t) {
|
|
5366
5350
|
let n, r;
|
|
5367
5351
|
t.on([
|
|
5368
5352
|
"elements.changed",
|
|
@@ -5389,16 +5373,16 @@ function ds(e, t) {
|
|
|
5389
5373
|
canvasIdOf: (e) => i().byDocumentId.get(e) ?? e
|
|
5390
5374
|
};
|
|
5391
5375
|
}
|
|
5392
|
-
function
|
|
5393
|
-
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s =
|
|
5394
|
-
notation:
|
|
5376
|
+
function ts(e, t) {
|
|
5377
|
+
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = e.get("panConstraint"), s = es(e, n), c = t ? e.get("wardleyLivePreview") : void 0, l = /* @__PURE__ */ new Set(), u = 0, d = !1, f = !1, p = "", m = {
|
|
5378
|
+
notation: Jo,
|
|
5395
5379
|
apiVersion: Pe,
|
|
5396
5380
|
editable: t
|
|
5397
5381
|
};
|
|
5398
5382
|
t && n.on("commandStack.changed", () => {
|
|
5399
5383
|
if (!(u > 0)) for (let e of [...l]) e();
|
|
5400
5384
|
});
|
|
5401
|
-
let h = (e) => e.filter(
|
|
5385
|
+
let h = (e) => e.filter(Xo).map((e) => s.of(e.id)), g = (e) => {
|
|
5402
5386
|
let t = s.of(e.id);
|
|
5403
5387
|
return e.wardleyLabel ? {
|
|
5404
5388
|
id: t,
|
|
@@ -5407,13 +5391,13 @@ function fs(e, t) {
|
|
|
5407
5391
|
}, _ = (e) => {
|
|
5408
5392
|
if (f) return;
|
|
5409
5393
|
let t = i.get(s.canvasIdOf(e));
|
|
5410
|
-
return
|
|
5394
|
+
return Xo(t) && s.of(t.id) === e ? t : void 0;
|
|
5411
5395
|
}, v = {
|
|
5412
|
-
list: () => f ? [] : i.getAll().filter(
|
|
5396
|
+
list: () => f ? [] : i.getAll().filter(Xo).map(g),
|
|
5413
5397
|
reveal(e) {
|
|
5414
5398
|
if (f) return !1;
|
|
5415
5399
|
let t = i.get(s.canvasIdOf(e));
|
|
5416
|
-
return
|
|
5400
|
+
return Xo(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
5417
5401
|
},
|
|
5418
5402
|
selection: () => f ? [] : h(a.get()),
|
|
5419
5403
|
onSelection(e) {
|
|
@@ -5438,12 +5422,12 @@ function fs(e, t) {
|
|
|
5438
5422
|
async function ee(n) {
|
|
5439
5423
|
if (f) throw Error("The modeler was destroyed.");
|
|
5440
5424
|
u += 1;
|
|
5441
|
-
let r = t && d ?
|
|
5425
|
+
let r = t && d ? Ko(e) : void 0;
|
|
5442
5426
|
try {
|
|
5443
5427
|
let { warnings: t } = await e.importDSL(n);
|
|
5444
|
-
return d = !0, r &&
|
|
5428
|
+
return d = !0, r && qo(e, r), { warnings: t.map((e) => e.message) };
|
|
5445
5429
|
} catch (t) {
|
|
5446
|
-
throw r &&
|
|
5430
|
+
throw r && qo(e, r, { importRejected: !0 }), t;
|
|
5447
5431
|
} finally {
|
|
5448
5432
|
--u;
|
|
5449
5433
|
}
|
|
@@ -5470,13 +5454,13 @@ function fs(e, t) {
|
|
|
5470
5454
|
width: n,
|
|
5471
5455
|
height: i
|
|
5472
5456
|
};
|
|
5473
|
-
return
|
|
5457
|
+
return ns(a) ? a : void 0;
|
|
5474
5458
|
} catch {
|
|
5475
5459
|
return;
|
|
5476
5460
|
}
|
|
5477
5461
|
},
|
|
5478
5462
|
setViewState(e) {
|
|
5479
|
-
!f &&
|
|
5463
|
+
!f && ns(e) && r.viewbox({
|
|
5480
5464
|
x: e.x,
|
|
5481
5465
|
y: e.y,
|
|
5482
5466
|
width: e.width,
|
|
@@ -5505,16 +5489,15 @@ function fs(e, t) {
|
|
|
5505
5489
|
}
|
|
5506
5490
|
};
|
|
5507
5491
|
}
|
|
5508
|
-
function
|
|
5492
|
+
function ns(e) {
|
|
5509
5493
|
if (typeof e != "object" || !e) return !1;
|
|
5510
5494
|
let { x: t, y: n, width: r, height: i } = e;
|
|
5511
|
-
return
|
|
5495
|
+
return rs(t) && rs(n) && rs(r) && rs(i) && r > 0 && i > 0;
|
|
5512
5496
|
}
|
|
5513
|
-
function
|
|
5497
|
+
function rs(e) {
|
|
5514
5498
|
return typeof e == "number" && Number.isFinite(e);
|
|
5515
5499
|
}
|
|
5516
|
-
|
|
5517
|
-
//#region src/map-menu/menu.ts
|
|
5500
|
+
// src/map-menu/menu.ts
|
|
5518
5501
|
var X = {
|
|
5519
5502
|
png: "Export as PNG",
|
|
5520
5503
|
svg: "Export as SVG",
|
|
@@ -5522,7 +5505,7 @@ var X = {
|
|
|
5522
5505
|
json: "Export as JSON",
|
|
5523
5506
|
wmap: "Export as .wmap"
|
|
5524
5507
|
};
|
|
5525
|
-
function
|
|
5508
|
+
function is(e, t, n, r) {
|
|
5526
5509
|
return {
|
|
5527
5510
|
kind: "action",
|
|
5528
5511
|
id: e,
|
|
@@ -5532,11 +5515,11 @@ function hs(e, t, n, r) {
|
|
|
5532
5515
|
onSelect: () => n.onSelect()
|
|
5533
5516
|
};
|
|
5534
5517
|
}
|
|
5535
|
-
function
|
|
5536
|
-
let t = [
|
|
5537
|
-
return e.transparentPng && t.push(
|
|
5518
|
+
function as(e) {
|
|
5519
|
+
let t = [is("export-png", X.png, e.png, "file-image"), is("export-svg", X.svg, e.svg, "file-code-corner")];
|
|
5520
|
+
return e.transparentPng && t.push(is("export-png-transparent", X.transparentPng, e.transparentPng)), e.json && t.push(is("export-json", X.json, e.json)), e.wmap && t.push(is("export-wmap", X.wmap, e.wmap)), t;
|
|
5538
5521
|
}
|
|
5539
|
-
function
|
|
5522
|
+
function os(e) {
|
|
5540
5523
|
let { mapTitle: t, shortcutsKey: n } = e;
|
|
5541
5524
|
return {
|
|
5542
5525
|
model: [
|
|
@@ -5559,7 +5542,7 @@ function _s(e) {
|
|
|
5559
5542
|
onSelect: () => e.axisLabels()
|
|
5560
5543
|
}
|
|
5561
5544
|
],
|
|
5562
|
-
export:
|
|
5545
|
+
export: as(e.exports),
|
|
5563
5546
|
help: [{
|
|
5564
5547
|
kind: "dialog",
|
|
5565
5548
|
id: "keyboard-shortcuts",
|
|
@@ -5570,17 +5553,16 @@ function _s(e) {
|
|
|
5570
5553
|
}]
|
|
5571
5554
|
};
|
|
5572
5555
|
}
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
function ys(e) {
|
|
5556
|
+
// src/map-menu/shortcuts.ts
|
|
5557
|
+
var ss = "←↑→↓";
|
|
5558
|
+
function cs(e) {
|
|
5577
5559
|
try {
|
|
5578
5560
|
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
5579
5561
|
} catch {
|
|
5580
5562
|
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
5581
5563
|
}
|
|
5582
5564
|
}
|
|
5583
|
-
function
|
|
5565
|
+
function ls(e, t) {
|
|
5584
5566
|
if (e === "mac") return {
|
|
5585
5567
|
command: (e) => `⌘${e}`,
|
|
5586
5568
|
shiftCommand: (e) => `⌘⇧${e}`,
|
|
@@ -5607,7 +5589,7 @@ function bs(e, t) {
|
|
|
5607
5589
|
enter: "Enter"
|
|
5608
5590
|
};
|
|
5609
5591
|
}
|
|
5610
|
-
function
|
|
5592
|
+
function us(e, t) {
|
|
5611
5593
|
return {
|
|
5612
5594
|
title: "File",
|
|
5613
5595
|
rows: [
|
|
@@ -5626,10 +5608,10 @@ function xs(e, t) {
|
|
|
5626
5608
|
]
|
|
5627
5609
|
};
|
|
5628
5610
|
}
|
|
5629
|
-
function
|
|
5630
|
-
let { platform: n, messages: r } = e, i =
|
|
5611
|
+
function ds(e, t = {}) {
|
|
5612
|
+
let { platform: n, messages: r } = e, i = ls(n, r.keyNames);
|
|
5631
5613
|
return [
|
|
5632
|
-
...t.fileKeys ? [
|
|
5614
|
+
...t.fileKeys ? [us(e, i.command)] : [],
|
|
5633
5615
|
{
|
|
5634
5616
|
title: "View",
|
|
5635
5617
|
rows: [
|
|
@@ -5642,7 +5624,7 @@ function Ss(e, t = {}) {
|
|
|
5642
5624
|
keys: [i.zoomOut]
|
|
5643
5625
|
},
|
|
5644
5626
|
{
|
|
5645
|
-
action: r.zoomToActual(
|
|
5627
|
+
action: r.zoomToActual(cs(e.lang)),
|
|
5646
5628
|
keys: [i.zoomToActual]
|
|
5647
5629
|
},
|
|
5648
5630
|
{
|
|
@@ -5692,11 +5674,11 @@ function Ss(e, t = {}) {
|
|
|
5692
5674
|
},
|
|
5693
5675
|
{
|
|
5694
5676
|
action: "Move the selection",
|
|
5695
|
-
keys: [
|
|
5677
|
+
keys: [ss]
|
|
5696
5678
|
},
|
|
5697
5679
|
{
|
|
5698
5680
|
action: "Move the selection further",
|
|
5699
|
-
keys: [i.shift(
|
|
5681
|
+
keys: [i.shift(ss)]
|
|
5700
5682
|
},
|
|
5701
5683
|
{
|
|
5702
5684
|
action: "Select all",
|
|
@@ -5788,40 +5770,38 @@ function Ss(e, t = {}) {
|
|
|
5788
5770
|
}
|
|
5789
5771
|
];
|
|
5790
5772
|
}
|
|
5791
|
-
|
|
5792
|
-
//#region src/map-menu/dom.ts
|
|
5773
|
+
// src/map-menu/dom.ts
|
|
5793
5774
|
/*! @miragon/wardley-renderer icon geometry: x. Lucide (lucide-static 1.59.0) @license ISC
|
|
5794
5775
|
* Copyright (c) 2026 Lucide Icons and Contributors
|
|
5795
5776
|
* Derived from Feather @license MIT, Copyright (c) 2013-present Cole Bemis
|
|
5796
5777
|
* Full notices: README.md of @miragon/wardley-renderer */
|
|
5797
|
-
var
|
|
5778
|
+
var fs = "<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>";
|
|
5798
5779
|
function Z(e, t, n) {
|
|
5799
5780
|
let r = document.createElement(e);
|
|
5800
5781
|
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
5801
5782
|
}
|
|
5802
|
-
var
|
|
5803
|
-
function
|
|
5804
|
-
return
|
|
5783
|
+
var ps = 0;
|
|
5784
|
+
function ms(e) {
|
|
5785
|
+
return ps += 1, `${e}-${ps}`;
|
|
5805
5786
|
}
|
|
5806
|
-
|
|
5807
|
-
//#region src/map-menu/dialog.ts
|
|
5787
|
+
// src/map-menu/dialog.ts
|
|
5808
5788
|
function Q(e, t) {
|
|
5809
5789
|
let n = Z("button", "wardley-button", e);
|
|
5810
5790
|
return n.type = "button", n.dataset.variant = t, n;
|
|
5811
5791
|
}
|
|
5812
|
-
function
|
|
5792
|
+
function hs(e, t, n, r) {
|
|
5813
5793
|
let i = Z("header", "wardley-dialog-header"), a = Z("h3", "wardley-dialog-title", t);
|
|
5814
5794
|
a.id = n;
|
|
5815
5795
|
let o = Z("button", "wardley-dialog-close");
|
|
5816
|
-
return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML =
|
|
5796
|
+
return o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = fs, o.addEventListener("click", r), i.append(a, o), i;
|
|
5817
5797
|
}
|
|
5818
|
-
function
|
|
5798
|
+
function gs(e, t) {
|
|
5819
5799
|
let n;
|
|
5820
5800
|
function r() {
|
|
5821
|
-
let n =
|
|
5801
|
+
let n = ms(`${t.className}-title`), r = Z("dialog", `wardley-dialog ${t.className}`);
|
|
5822
5802
|
r.setAttribute("aria-labelledby", n);
|
|
5823
5803
|
let i = () => r.close(), a = Z("div", "wardley-dialog-panel");
|
|
5824
|
-
a.append(
|
|
5804
|
+
a.append(hs(e, t.title, n, i), ...t.content(i)), r.append(a);
|
|
5825
5805
|
let o = !1;
|
|
5826
5806
|
return r.addEventListener("pointerdown", (e) => {
|
|
5827
5807
|
o = e.target === r;
|
|
@@ -5844,10 +5824,9 @@ function Ds(e, t) {
|
|
|
5844
5824
|
}
|
|
5845
5825
|
};
|
|
5846
5826
|
}
|
|
5847
|
-
|
|
5848
|
-
//#region src/map-menu/ShortcutsDialog.ts
|
|
5827
|
+
// src/map-menu/ShortcutsDialog.ts
|
|
5849
5828
|
var $ = "wardley-shortcuts";
|
|
5850
|
-
function
|
|
5829
|
+
function _s(e, t) {
|
|
5851
5830
|
let n = Z("section", `${$}-group`), r = Z("h4", `${$}-group-title`, e.title);
|
|
5852
5831
|
r.id = t;
|
|
5853
5832
|
let i = Z("table", `${$}-table`);
|
|
@@ -5862,29 +5841,28 @@ function Os(e, t) {
|
|
|
5862
5841
|
}
|
|
5863
5842
|
return n.append(r, i), n;
|
|
5864
5843
|
}
|
|
5865
|
-
function
|
|
5866
|
-
return
|
|
5844
|
+
function vs(e, t = {}) {
|
|
5845
|
+
return gs(e, {
|
|
5867
5846
|
className: $,
|
|
5868
5847
|
title: "Keyboard shortcuts",
|
|
5869
5848
|
content() {
|
|
5870
|
-
let n = Z("div", `wardley-dialog-body ${$}-body`), r =
|
|
5871
|
-
return n.append(...
|
|
5849
|
+
let n = Z("div", `wardley-dialog-body ${$}-body`), r = ms(`${$}-group`);
|
|
5850
|
+
return n.append(...ds(e, t).map((e, t) => _s(e, `${r}-${t}`))), [n];
|
|
5872
5851
|
}
|
|
5873
5852
|
});
|
|
5874
5853
|
}
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
function As(e) {
|
|
5854
|
+
// src/map-menu/TitleDialog.ts
|
|
5855
|
+
function ys(e) {
|
|
5878
5856
|
return e.exportMap().config.title ?? r;
|
|
5879
5857
|
}
|
|
5880
|
-
function
|
|
5858
|
+
function bs(e, t) {
|
|
5881
5859
|
let n = Z("input", "wardley-field-input");
|
|
5882
|
-
n.id =
|
|
5883
|
-
let i =
|
|
5860
|
+
n.id = ms("wardley-title-field"), n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.maxLength = 120, n.autofocus = !0;
|
|
5861
|
+
let i = gs(e, {
|
|
5884
5862
|
className: "wardley-title-dialog",
|
|
5885
5863
|
title: "Map title",
|
|
5886
5864
|
beforeOpen() {
|
|
5887
|
-
n.value =
|
|
5865
|
+
n.value = ys(t);
|
|
5888
5866
|
},
|
|
5889
5867
|
afterOpen() {
|
|
5890
5868
|
n.select();
|
|
@@ -5900,31 +5878,30 @@ function js(e, t) {
|
|
|
5900
5878
|
return u.type = "submit", c.append(l, u), i.append(a, c), i.addEventListener("submit", (i) => {
|
|
5901
5879
|
i.preventDefault();
|
|
5902
5880
|
let a = n.value.replace(/\s+/g, " ").trim() || r;
|
|
5903
|
-
e(), a !==
|
|
5881
|
+
e(), a !== ys(t) && t.setTitle(a);
|
|
5904
5882
|
}), [i];
|
|
5905
5883
|
}
|
|
5906
5884
|
}), a = (e) => {
|
|
5907
5885
|
e.readOnly && i.close();
|
|
5908
5886
|
};
|
|
5909
|
-
return t.on(
|
|
5887
|
+
return t.on(F, a), {
|
|
5910
5888
|
open: () => i.open(),
|
|
5911
5889
|
isOpen: () => i.isOpen(),
|
|
5912
5890
|
close: () => i.close(),
|
|
5913
5891
|
destroy() {
|
|
5914
|
-
t.off(
|
|
5892
|
+
t.off(F, a), i.destroy();
|
|
5915
5893
|
}
|
|
5916
5894
|
};
|
|
5917
5895
|
}
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
function Ms(e, t) {
|
|
5896
|
+
// src/map-menu/popover.ts
|
|
5897
|
+
function xs(e, t) {
|
|
5921
5898
|
let n, r = (e) => {
|
|
5922
5899
|
n && !n.contains(e.target) && s("done");
|
|
5923
5900
|
}, i = () => s("done"), a = (e) => {
|
|
5924
5901
|
e.key !== "Escape" || e.isComposing || (e.preventDefault(), e.stopPropagation(), s("done", { returnFocus: !0 }));
|
|
5925
5902
|
};
|
|
5926
5903
|
function o() {
|
|
5927
|
-
let n =
|
|
5904
|
+
let n = ms(`${t.className}-title`), r = Z("div", `wardley-popover ${t.className}`);
|
|
5928
5905
|
r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", n), r.hidden = !0;
|
|
5929
5906
|
let i = Z("h2", "wardley-popover-title", t.title);
|
|
5930
5907
|
i.id = n;
|
|
@@ -5949,8 +5926,8 @@ function Ms(e, t) {
|
|
|
5949
5926
|
}
|
|
5950
5927
|
};
|
|
5951
5928
|
}
|
|
5952
|
-
function
|
|
5953
|
-
let n = Z("div", "wardley-field"), r =
|
|
5929
|
+
function Ss(e, t) {
|
|
5930
|
+
let n = Z("div", "wardley-field"), r = ms("wardley-field"), i = Z("label", "wardley-field-label", e);
|
|
5954
5931
|
i.htmlFor = r, t.id = r, t.classList.add("wardley-field-input"), n.append(i, t);
|
|
5955
5932
|
let a;
|
|
5956
5933
|
return {
|
|
@@ -5963,36 +5940,35 @@ function Ns(e, t) {
|
|
|
5963
5940
|
}
|
|
5964
5941
|
};
|
|
5965
5942
|
}
|
|
5966
|
-
function
|
|
5943
|
+
function Cs(e, t) {
|
|
5967
5944
|
let n = () => t.end("import"), r = (e) => {
|
|
5968
5945
|
e.readOnly && t.end("cancel");
|
|
5969
5946
|
};
|
|
5970
|
-
return e.on("import.done", n), e.on(
|
|
5947
|
+
return e.on("import.done", n), e.on(F, r), {
|
|
5971
5948
|
open: () => t.open(),
|
|
5972
5949
|
isOpen: () => t.isOpen(),
|
|
5973
5950
|
close: () => t.close(),
|
|
5974
5951
|
destroy() {
|
|
5975
|
-
e.off("import.done", n), e.off(
|
|
5952
|
+
e.off("import.done", n), e.off(F, r), t.destroy();
|
|
5976
5953
|
}
|
|
5977
5954
|
};
|
|
5978
5955
|
}
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
function Is(e, t) {
|
|
5956
|
+
// src/map-menu/MapSizePopover.ts
|
|
5957
|
+
var ws = "custom";
|
|
5958
|
+
function Ts(e, t) {
|
|
5983
5959
|
let n = Z("input", "");
|
|
5984
5960
|
return n.type = "number", n.inputMode = "numeric", n.min = String(e), n.max = String(t), n.step = "10", n;
|
|
5985
5961
|
}
|
|
5986
|
-
function
|
|
5962
|
+
function Es(e, t) {
|
|
5987
5963
|
let n = Z("select", "");
|
|
5988
5964
|
for (let e of c) {
|
|
5989
5965
|
let t = Z("option", "", `${e.name} (${e.width} × ${e.height})`);
|
|
5990
5966
|
t.value = e.id, n.append(t);
|
|
5991
5967
|
}
|
|
5992
5968
|
let r = Z("option", "", "Custom");
|
|
5993
|
-
r.value =
|
|
5994
|
-
let i =
|
|
5995
|
-
n.value = e.presetId ??
|
|
5969
|
+
r.value = ws, n.append(r);
|
|
5970
|
+
let i = Ts(f.width, u.width), a = Ts(f.height, u.height), o = Q("Reset to default", "ghost"), s = Ss("Size", n), l = Ss("Width", i), d = Ss("Height", a), p, m, h = (e) => {
|
|
5971
|
+
n.value = e.presetId ?? ws, i.value = String(e.width), a.value = String(e.height), o.disabled = !e.isExplicit, l.clearError(), d.clearError();
|
|
5996
5972
|
}, g = (e) => {
|
|
5997
5973
|
m = { size: e }, (e ? t.setMapSize(e.width, e.height, { transient: !0 }) : t.resetMapSize({ transient: !0 })).then(() => h(t.getMapSize()));
|
|
5998
5974
|
}, _ = (e, n) => {
|
|
@@ -6009,7 +5985,7 @@ function Ls(e, t) {
|
|
|
6009
5985
|
[n]: i
|
|
6010
5986
|
});
|
|
6011
5987
|
};
|
|
6012
|
-
return
|
|
5988
|
+
return Cs(t, xs(e, {
|
|
6013
5989
|
className: "wardley-map-size",
|
|
6014
5990
|
title: "Map size",
|
|
6015
5991
|
build(e, t, r) {
|
|
@@ -6034,31 +6010,30 @@ function Ls(e, t) {
|
|
|
6034
6010
|
closed(e) {
|
|
6035
6011
|
let n = m;
|
|
6036
6012
|
if (m = void 0, !n || e === "import") return;
|
|
6037
|
-
let r = e === "done" ? n.size :
|
|
6013
|
+
let r = e === "done" ? n.size : Ds(p);
|
|
6038
6014
|
r ? t.setMapSize(r.width, r.height) : t.resetMapSize();
|
|
6039
6015
|
}
|
|
6040
6016
|
}));
|
|
6041
6017
|
}
|
|
6042
|
-
function
|
|
6018
|
+
function Ds(e) {
|
|
6043
6019
|
return e?.isExplicit ? {
|
|
6044
6020
|
width: e.width,
|
|
6045
6021
|
height: e.height
|
|
6046
6022
|
} : void 0;
|
|
6047
6023
|
}
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
return o.find((t) => t.labels.every((t, n) => t === e[n]))?.id ?? zs;
|
|
6024
|
+
// src/map-menu/AxisLabelsPopover.ts
|
|
6025
|
+
var Os = "custom";
|
|
6026
|
+
function ks(e) {
|
|
6027
|
+
return o.find((t) => t.labels.every((t, n) => t === e[n]))?.id ?? Os;
|
|
6053
6028
|
}
|
|
6054
|
-
function
|
|
6029
|
+
function As(e, t) {
|
|
6055
6030
|
let r = Z("select", "");
|
|
6056
6031
|
for (let e of o) {
|
|
6057
6032
|
let t = Z("option", "", e.name);
|
|
6058
6033
|
t.value = e.id, t.title = e.labels.join(" · "), r.append(t);
|
|
6059
6034
|
}
|
|
6060
6035
|
let i = Z("option", "", "Custom");
|
|
6061
|
-
i.value =
|
|
6036
|
+
i.value = Os, r.append(i);
|
|
6062
6037
|
let a = [
|
|
6063
6038
|
1,
|
|
6064
6039
|
2,
|
|
@@ -6068,18 +6043,18 @@ function Vs(e, t) {
|
|
|
6068
6043
|
let e = Z("input", "");
|
|
6069
6044
|
return e.type = "text", e.autocomplete = "off", e.spellcheck = !1, e;
|
|
6070
6045
|
}), s = n, c = !1, l = (e) => {
|
|
6071
|
-
a.forEach((t, n) => t.value = e[n] ?? ""), r.value =
|
|
6046
|
+
a.forEach((t, n) => t.value = e[n] ?? ""), r.value = ks(e);
|
|
6072
6047
|
}, u = () => h(a.map((e) => e.value)), d = () => {
|
|
6073
6048
|
c = !0;
|
|
6074
6049
|
let e = u();
|
|
6075
|
-
t.setEvolutionLabels(e, { transient: !0 }), r.value =
|
|
6050
|
+
t.setEvolutionLabels(e, { transient: !0 }), r.value = ks(e ?? n);
|
|
6076
6051
|
};
|
|
6077
|
-
return
|
|
6052
|
+
return Cs(t, xs(e, {
|
|
6078
6053
|
className: "wardley-axis-labels",
|
|
6079
6054
|
title: "X-axis labels",
|
|
6080
6055
|
build(e, t, i) {
|
|
6081
6056
|
let s = Z("p", "wardley-popover-hint"), c = Z("a", "wardley-popover-link", "Learn Wardley Mapping");
|
|
6082
|
-
c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", s.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(
|
|
6057
|
+
c.href = "https://learnwardleymapping.com/landscape/", c.target = "_blank", c.rel = "noopener noreferrer", s.append("Label sets from ", c, ". Pick a set, or name each stage."), e.append(Ss("Preset", r).wrapper, s), a.forEach((t, n) => e.append(Ss(`Stage ${n + 1}`, t).wrapper));
|
|
6083
6058
|
let u = Q("Reset to default", "ghost"), f = Q("Done", "secondary");
|
|
6084
6059
|
t.append(u, f), r.addEventListener("change", () => {
|
|
6085
6060
|
let e = o.find((e) => e.id === r.value);
|
|
@@ -6100,13 +6075,11 @@ function Vs(e, t) {
|
|
|
6100
6075
|
}
|
|
6101
6076
|
}));
|
|
6102
6077
|
}
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
return R(e, t);
|
|
6078
|
+
// src/draw/deprecated-icons.ts
|
|
6079
|
+
var js = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Ms = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Ns = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", Ps = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", Fs = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", Is = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", Ls = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", Rs = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", zs = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", Bs = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", Vs = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", Hs = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", Us = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z", Ws = Dr, Gs = Or, Ks = kr;
|
|
6080
|
+
function qs(e, t) {
|
|
6081
|
+
return Pr(e, t);
|
|
6108
6082
|
}
|
|
6109
|
-
|
|
6110
|
-
export { k as COLORS, X as EXPORT_LABELS, mn as EvolutionGrid, ji as FreeRect, $s as ICON_ADD, Zs as ICON_ASPECT_RATIO, Gs as ICON_CODE, Ws as ICON_DATA_OBJECT, rc as ICON_DELETE, Ks as ICON_DOWNLOAD, nc as ICON_EDIT, Js as ICON_FOLDER_OPEN, Ys as ICON_IMAGE, Qs as ICON_MENU, Xs as ICON_NEW, tc as ICON_PERSON, Us as ICON_REDO, qs as ICON_SHARE, Hs as ICON_UNDO, ec as ICON_VISIBILITY, s as MAP_SIZE_PRESETS, E as MIRAGON, vt as MapProjection, Wt as MapResizeHandles, $o as Modeler, Le as NOTE_COLORS, Ni as NavigatedViewer, D as PLOT, l as PLOT_MAX, d as PLOT_MIN, Ya as POPUP_PROVIDER_ID, ki as PanConstraint, Ai as PanConstraintModule, qn as PipelineGroupBehavior, Ct as READ_ONLY_CHANGED, mr as RESIZE_MAP, Ke as ROOT_ID, Gt as ResizeAwareAutoScroll, hr as UPDATE_CONFIG, yi as Viewer, as as WARDLEY_NOTATION, Oo as WardleyAppendBehavior, en as WardleyBaseViewer, jo as WardleyColorPicker, Lo as WardleyDrawTool, sn as WardleyElementFactory, eo as WardleyElementSettingsProvider, jn as WardleyEvolveDragging, rt as WardleyExporter, Qe as WardleyImporter, Jo as WardleyLabelDragging, Aa as WardleyLabelEditing, Pi as WardleyLassoBehavior, tn as WardleyLayouter, qa as WardleyLinkEditing, _r as WardleyModeling, Po as WardleyOrderingProvider, Dt as WardleyReadOnly, ui as WardleyRenderer, Bi as WardleyRules, it as WardleySourceOrder, dt as blobToBase64, Ga as canHaveLink, Dn as canvasAccessibilityModule, Vs as createAxisLabelsPopover, cs as createCollaborativeModeler, ls as createCollaborativeViewer, Ds as createMapDialog, Ls as createMapSizePopover, ks as createShortcutsDialog, js as createTitleDialog, Q as dialogButton, Or as evolutionConstraintModule, Dr as evolutionGridModule, Ue as exportBounds, Mi as freeRectModule, ic as iconMarkup, mt as ioModule, N as isComponent, P as isPipeline, M as isWardleyConnection, j as isWardleyShape, Pa as labelEditingModule, Ja as linkEditingModule, Ka as linkOf, _s as mapMenu, qt as mapResizeModule, Ss as mapShortcuts, g as normalizeMapSize, Jn as pipelineGroupModule, ee as presetIdForSize, Ot as readOnlyModule, is as restoreEditorState, Be as saveSVG, rs as setAsideEditorState, Hi as stageSnappingModule, lt as svgToPng, ko as wardleyAppendModule, Mo as wardleyColorPickerModule, co as wardleyContextPadModule, vi as wardleyDrawModule, Uo as wardleyDrawToolModule, Mn as wardleyEvolveModule, To as wardleyKeyboardModule, Zo as wardleyLabelDragModule, Fi as wardleyLassoModule, nn as wardleyLayoutModule, cn as wardleyModelModule, Er as wardleyModelingModule, Fo as wardleyOrderingModule, ca as wardleyPaletteModule, to as wardleyPopupModule, Vi as wardleyRulesModule };
|
|
6083
|
+
export { k as COLORS, X as EXPORT_LABELS, bn as EvolutionGrid, vi as FreeRect, Hs as ICON_ADD, Bs as ICON_ASPECT_RATIO, Ps as ICON_CODE, Ns as ICON_DATA_OBJECT, Ks as ICON_DELETE, Fs as ICON_DOWNLOAD, Gs as ICON_EDIT, Ls as ICON_FOLDER_OPEN, Rs as ICON_IMAGE, Vs as ICON_MENU, zs as ICON_NEW, Ws as ICON_PERSON, Ms as ICON_REDO, Is as ICON_SHARE, js as ICON_UNDO, Us as ICON_VISIBILITY, s as MAP_SIZE_PRESETS, E as MIRAGON, vt as MapProjection, Xt as MapResizeHandles, Ho as Modeler, Le as NOTE_COLORS, bi as NavigatedViewer, D as PLOT, l as PLOT_MAX, d as PLOT_MIN, La as POPUP_PROVIDER_ID, gi as PanConstraint, _i as PanConstraintModule, Gn as PipelineGroupBehavior, F as READ_ONLY_CHANGED, fr as RESIZE_MAP, Ke as ROOT_ID, Zt as ResizeAwareAutoScroll, pr as UPDATE_CONFIG, oi as Viewer, Jo as WARDLEY_NOTATION, ho as WardleyAppendBehavior, sn as WardleyBaseViewer, vo as WardleyColorPicker, To as WardleyDrawTool, pn as WardleyElementFactory, Ha as WardleyElementSettingsProvider, kn as WardleyEvolveDragging, rt as WardleyExporter, Qe as WardleyImporter, Lo as WardleyLabelDragging, va as WardleyLabelEditing, xi as WardleyLassoBehavior, cn as WardleyLayouter, Fa as WardleyLinkEditing, hr as WardleyModeling, xo as WardleyOrderingProvider, Et as WardleyReadOnly, Zr as WardleyRenderer, Di as WardleyRules, it as WardleySourceOrder, dt as blobToBase64, Na as canHaveLink, Pt as canvasAccessibilityModule, As as createAxisLabelsPopover, Zo as createCollaborativeModeler, Qo as createCollaborativeViewer, gs as createMapDialog, Es as createMapSizePopover, vs as createShortcutsDialog, bs as createTitleDialog, Q as dialogButton, Er as evolutionConstraintModule, Tr as evolutionGridModule, Ue as exportBounds, yi as freeRectModule, qs as iconMarkup, mt as ioModule, N as isComponent, P as isPipeline, M as isWardleyConnection, j as isWardleyShape, Sa as labelEditingModule, Ia as linkEditingModule, Pa as linkOf, os as mapMenu, $t as mapResizeModule, ds as mapShortcuts, g as normalizeMapSize, Kn as pipelineGroupModule, ee as presetIdForSize, Dt as readOnlyModule, qo as restoreEditorState, Be as saveSVG, Ko as setAsideEditorState, ki as stageSnappingModule, lt as svgToPng, go as wardleyAppendModule, yo as wardleyColorPickerModule, Qa as wardleyContextPadModule, ai as wardleyDrawModule, Mo as wardleyDrawToolModule, An as wardleyEvolveModule, fo as wardleyKeyboardModule, Bo as wardleyLabelDragModule, Si as wardleyLassoModule, ln as wardleyLayoutModule, mn as wardleyModelModule, wr as wardleyModelingModule, So as wardleyOrderingModule, Xi as wardleyPaletteModule, Ua as wardleyPopupModule, Oi as wardleyRulesModule };
|
|
6111
6084
|
|
|
6112
6085
|
//# sourceMappingURL=index.js.map
|