@miragon/context-maps-renderer 0.4.1 → 0.5.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 +21 -8
- package/dist/CmBaseViewer.d.ts +12 -4
- package/dist/CmBaseViewer.d.ts.map +1 -1
- package/dist/collaborative/CollaborativeContextMaps.d.ts +2 -1
- package/dist/collaborative/CollaborativeContextMaps.d.ts.map +1 -1
- package/dist/draw/ContextMapsRenderer.d.ts.map +1 -1
- package/dist/draw/contextLayout.d.ts +33 -0
- package/dist/draw/contextLayout.d.ts.map +1 -0
- package/dist/draw/textMetrics.d.ts +6 -0
- package/dist/draw/textMetrics.d.ts.map +1 -0
- package/dist/index.js +537 -462
- package/dist/index.js.map +1 -1
- package/dist/legend/CmLegend.d.ts +4 -0
- package/dist/legend/CmLegend.d.ts.map +1 -1
- package/dist/model/contentBounds.d.ts +12 -0
- package/dist/model/contentBounds.d.ts.map +1 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +2 -1
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/theme/sizes.d.ts +13 -0
- package/dist/theme/sizes.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18,64 +18,162 @@ import ve from "diagram-js/lib/command/CommandInterceptor";
|
|
|
18
18
|
import { hasPrimaryModifier as ye } from "diagram-js/lib/util/Mouse";
|
|
19
19
|
import be from "diagram-js/lib/features/palette";
|
|
20
20
|
import xe from "diagram-js/lib/features/create";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { DEFAULT_DISTANCE as
|
|
28
|
-
import
|
|
29
|
-
import { MODELER_API_VERSION as
|
|
30
|
-
import { getBBox as
|
|
21
|
+
import Se from "diagram-js/lib/features/connect";
|
|
22
|
+
import Ce from "diagram-js/lib/features/lasso-tool";
|
|
23
|
+
import we from "diagram-js-direct-editing";
|
|
24
|
+
import Te from "diagram-js/lib/features/context-pad";
|
|
25
|
+
import Ee from "diagram-js/lib/features/popup-menu";
|
|
26
|
+
import De from "diagram-js/lib/features/auto-place";
|
|
27
|
+
import { DEFAULT_DISTANCE as Oe, findFreePosition as ke, generateGetNextPosition as Ae } from "diagram-js/lib/features/auto-place/AutoPlaceUtil";
|
|
28
|
+
import je from "diagram-js/lib/features/overlays";
|
|
29
|
+
import { MODELER_API_VERSION as Me } from "@miragon/modeler-api";
|
|
30
|
+
import { getBBox as Ne } from "diagram-js/lib/util/Elements";
|
|
31
31
|
//#region src/model/di-types.ts
|
|
32
|
-
function
|
|
32
|
+
function Pe(e) {
|
|
33
33
|
return typeof e == "object" && e ? e.cmKind : void 0;
|
|
34
34
|
}
|
|
35
|
+
function C(e) {
|
|
36
|
+
return typeof Pe(e) == "string";
|
|
37
|
+
}
|
|
35
38
|
function w(e) {
|
|
36
|
-
return
|
|
39
|
+
return Pe(e) === "context";
|
|
37
40
|
}
|
|
38
41
|
function T(e) {
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
function E(e) {
|
|
42
|
-
return Ne(e) === "relationship";
|
|
42
|
+
return Pe(e) === "relationship";
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/io/saveSvg.ts
|
|
46
|
-
var
|
|
46
|
+
var Fe = 40, Ie = [
|
|
47
47
|
"tabindex",
|
|
48
48
|
"role",
|
|
49
49
|
"aria-label"
|
|
50
50
|
];
|
|
51
|
-
function
|
|
51
|
+
function Le(e, t) {
|
|
52
52
|
let n = e.getContainer().querySelector(":scope > svg");
|
|
53
53
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
54
54
|
let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
55
55
|
for (let e of t.getAll()) {
|
|
56
|
-
if (!
|
|
56
|
+
if (!w(e)) continue;
|
|
57
57
|
let t = e;
|
|
58
58
|
r = Math.min(r, t.x), i = Math.min(i, t.y), a = Math.max(a, t.x + t.width), o = Math.max(o, t.y + t.height);
|
|
59
59
|
}
|
|
60
60
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
61
|
-
let s = r -
|
|
62
|
-
for (let e of
|
|
61
|
+
let s = r - Fe, c = i - Fe, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
|
|
62
|
+
for (let e of Ie) d.removeAttribute(e);
|
|
63
63
|
d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("viewBox", `${s} ${c} ${l} ${u}`), d.setAttribute("width", String(Math.round(l))), d.setAttribute("height", String(Math.round(u)));
|
|
64
64
|
let f = d.querySelector(".viewport");
|
|
65
65
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
|
+
//#region src/theme/palette.ts
|
|
69
|
+
var E = {
|
|
70
|
+
blau: "#335DE5",
|
|
71
|
+
blauLink: "#2B50D4",
|
|
72
|
+
blauHell: "#6B8AFF",
|
|
73
|
+
gruen: "#00E676",
|
|
74
|
+
grau: "#F9F7F7",
|
|
75
|
+
schwarz: "#1D1D1D",
|
|
76
|
+
weiss: "#FFFFFF",
|
|
77
|
+
linie: "#E6E2E2",
|
|
78
|
+
success: "#00E676",
|
|
79
|
+
warning: "#FFB000",
|
|
80
|
+
danger: "#CD1839",
|
|
81
|
+
info: "#335DE5",
|
|
82
|
+
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
83
|
+
}, Re = {
|
|
84
|
+
"--cd-blau": E.blau,
|
|
85
|
+
"--cd-gruen": E.gruen,
|
|
86
|
+
"--cd-grau": E.grau,
|
|
87
|
+
"--cd-schwarz": E.schwarz,
|
|
88
|
+
"--cd-weiss": E.weiss,
|
|
89
|
+
"--cd-blau-link": E.blauLink,
|
|
90
|
+
"--cd-blau-hell": E.blauHell,
|
|
91
|
+
"--cd-linie": E.linie,
|
|
92
|
+
"--cd-success": E.success,
|
|
93
|
+
"--cd-warning": E.warning,
|
|
94
|
+
"--cd-danger": E.danger,
|
|
95
|
+
"--cd-info": E.info,
|
|
96
|
+
"--cd-gradient-brand": E.gradientBrand
|
|
97
|
+
}, ze = {
|
|
98
|
+
width: 440,
|
|
99
|
+
height: 820
|
|
100
|
+
}, Be = 1500;
|
|
101
|
+
E.blau;
|
|
102
|
+
var D = E.schwarz, Ve = "#5B5B5B", O = {
|
|
103
|
+
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
104
|
+
label: 13.5,
|
|
105
|
+
small: 11
|
|
106
|
+
}, k = E.weiss, He = "#F1F1EE", Ue = "#8A8577", A;
|
|
107
|
+
function j(e, t, n) {
|
|
108
|
+
return A === void 0 && (A = typeof document > "u" ? null : document.createElement("canvas").getContext("2d")), A ? (A.font = `${n} ${t}px ${O.family}`, A.measureText(e).width) : e.length * t * .58;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/draw/contextLayout.ts
|
|
112
|
+
var M = {
|
|
113
|
+
x: 28,
|
|
114
|
+
y: 15,
|
|
115
|
+
fontWeight: "700",
|
|
116
|
+
letterSpacingEm: .03
|
|
117
|
+
}, We = 5, Ge = 12;
|
|
118
|
+
function Ke(e, t, n) {
|
|
119
|
+
let r = n.length * O.small * .55, i = e / 2 - (19 + r) / 2, a = i + 14 + We;
|
|
120
|
+
return {
|
|
121
|
+
left: i,
|
|
122
|
+
iconCenterX: i + 7,
|
|
123
|
+
textX: a,
|
|
124
|
+
centerY: t - Ge,
|
|
125
|
+
right: a + j(n, O.small, "400")
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function qe(e) {
|
|
129
|
+
let { label: t } = p[e], n = M.letterSpacingEm * O.small;
|
|
130
|
+
return M.x + j(t, O.small, M.fontWeight) + t.length * n;
|
|
131
|
+
}
|
|
132
|
+
function Je(e) {
|
|
133
|
+
let t = 0, n = e.width;
|
|
134
|
+
if (e.subdomainType && p[e.subdomainType] && (n = Math.max(n, qe(e.subdomainType))), e.team) {
|
|
135
|
+
let r = Ke(e.width, 0, e.team);
|
|
136
|
+
t = Math.min(t, r.left), n = Math.max(n, r.right);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
left: e.x + t,
|
|
140
|
+
right: e.x + n
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/model/contentBounds.ts
|
|
145
|
+
function Ye(e) {
|
|
146
|
+
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity, a = (e, a, o, s) => {
|
|
147
|
+
[
|
|
148
|
+
e,
|
|
149
|
+
a,
|
|
150
|
+
o,
|
|
151
|
+
s
|
|
152
|
+
].every(Number.isFinite) && (t = Math.min(t, e), n = Math.min(n, a), r = Math.max(r, e + o), i = Math.max(i, a + s));
|
|
153
|
+
};
|
|
154
|
+
for (let t of e) if (w(t)) {
|
|
155
|
+
let e = Je(t);
|
|
156
|
+
a(e.left, t.y, e.right - e.left, t.height);
|
|
157
|
+
} else if (T(t)) for (let e of t.waypoints ?? []) a(e.x, e.y, 0, 0);
|
|
158
|
+
if (!(t > r || n > i)) return {
|
|
159
|
+
x: t,
|
|
160
|
+
y: n,
|
|
161
|
+
width: r - t,
|
|
162
|
+
height: i - n
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
68
166
|
//#region src/io/types.ts
|
|
69
|
-
var
|
|
167
|
+
var N = i, Xe = {
|
|
70
168
|
top: 84,
|
|
71
169
|
right: 56,
|
|
72
170
|
bottom: 56,
|
|
73
171
|
left: 56
|
|
74
|
-
},
|
|
75
|
-
function
|
|
172
|
+
}, Ze = .001;
|
|
173
|
+
function Qe(e) {
|
|
76
174
|
return typeof e == "number" ? `${e}px` : e;
|
|
77
175
|
}
|
|
78
|
-
var
|
|
176
|
+
var $e = class {
|
|
79
177
|
_diagram;
|
|
80
178
|
_container;
|
|
81
179
|
_options;
|
|
@@ -84,7 +182,7 @@ var Be = class {
|
|
|
84
182
|
}
|
|
85
183
|
_createContainer(e) {
|
|
86
184
|
let t = e.container ?? document.createElement("div");
|
|
87
|
-
return t.classList.add("cm-djs-container"), t.style.width =
|
|
185
|
+
return t.classList.add("cm-djs-container"), t.style.width = Qe(e.width ?? "100%"), t.style.height = Qe(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
88
186
|
}
|
|
89
187
|
_ensureDiagram() {
|
|
90
188
|
if (!this._diagram) {
|
|
@@ -106,7 +204,7 @@ var Be = class {
|
|
|
106
204
|
}
|
|
107
205
|
freeRectInsets = () => {
|
|
108
206
|
let { freeArea: e, freeRectInsets: t } = this._options;
|
|
109
|
-
return (e ? e.insets?.() : t?.()) ??
|
|
207
|
+
return (e ? e.insets?.() : t?.()) ?? Xe;
|
|
110
208
|
};
|
|
111
209
|
freeRectCenter = () => this._options.freeArea?.center?.();
|
|
112
210
|
_optional(e) {
|
|
@@ -151,34 +249,33 @@ var Be = class {
|
|
|
151
249
|
return this._documentRoot()?.businessObject;
|
|
152
250
|
}
|
|
153
251
|
_documentRoot() {
|
|
154
|
-
return this.get("elementRegistry").get(
|
|
252
|
+
return this.get("elementRegistry").get(N);
|
|
155
253
|
}
|
|
156
254
|
saveSVG() {
|
|
157
|
-
return
|
|
255
|
+
return Le(this.get("canvas"), this.get("elementRegistry"));
|
|
256
|
+
}
|
|
257
|
+
contentBounds() {
|
|
258
|
+
if (this._diagram) return Ye(this._diagram.get("elementRegistry").getAll());
|
|
158
259
|
}
|
|
159
260
|
_fit() {
|
|
160
|
-
let e = this.get("canvas"),
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
let { width: o, height: s } = e.getSize();
|
|
166
|
-
if (!(o > 0 && s > 0)) return;
|
|
167
|
-
if (!Number.isFinite(n)) {
|
|
261
|
+
let e = this.get("canvas"), { width: t, height: n } = e.getSize();
|
|
262
|
+
if (!(t > 0 && n > 0)) return;
|
|
263
|
+
let r = this.contentBounds();
|
|
264
|
+
if (!r) {
|
|
168
265
|
e.viewbox({
|
|
169
266
|
x: 0,
|
|
170
267
|
y: 0,
|
|
171
|
-
width:
|
|
172
|
-
height:
|
|
268
|
+
width: t,
|
|
269
|
+
height: n
|
|
173
270
|
});
|
|
174
271
|
return;
|
|
175
272
|
}
|
|
176
|
-
let
|
|
273
|
+
let i = this.freeRectInsets(), a = Math.max(t - i.left - i.right, 1), o = Math.max(n - i.top - i.bottom, 1), s = Math.max(r.width, 1), c = Math.max(r.height, 1), l = Math.max(Math.min(a / s, o / c, 1), Ze);
|
|
177
274
|
e.viewbox({
|
|
178
|
-
x:
|
|
179
|
-
y: r +
|
|
180
|
-
width:
|
|
181
|
-
height:
|
|
275
|
+
x: r.x + s / 2 - (i.left + a / 2) / l,
|
|
276
|
+
y: r.y + c / 2 - (i.top + o / 2) / l,
|
|
277
|
+
width: t / l,
|
|
278
|
+
height: n / l
|
|
182
279
|
});
|
|
183
280
|
}
|
|
184
281
|
attachTo(e) {
|
|
@@ -199,11 +296,11 @@ var Be = class {
|
|
|
199
296
|
};
|
|
200
297
|
//#endregion
|
|
201
298
|
//#region src/model/CmElementFactory.ts
|
|
202
|
-
function
|
|
299
|
+
function et(e, t) {
|
|
203
300
|
let n = g(e, t);
|
|
204
301
|
return Object.keys(n).length > 0 ? { cmForeign: n } : {};
|
|
205
302
|
}
|
|
206
|
-
var
|
|
303
|
+
var tt = class {
|
|
207
304
|
elementFactory;
|
|
208
305
|
static $inject = ["elementFactory"];
|
|
209
306
|
constructor(e) {
|
|
@@ -227,7 +324,7 @@ var He = class {
|
|
|
227
324
|
...e.description ? { description: e.description } : {},
|
|
228
325
|
...e.fill ? { fill: e.fill } : {},
|
|
229
326
|
...e.stroke ? { stroke: e.stroke } : {},
|
|
230
|
-
...
|
|
327
|
+
...et(e, r)
|
|
231
328
|
});
|
|
232
329
|
}
|
|
233
330
|
createRelationship(e, t, n, r) {
|
|
@@ -243,7 +340,7 @@ var He = class {
|
|
|
243
340
|
...e.label ? { cmLabel: e.label } : {},
|
|
244
341
|
...e.description ? { description: e.description } : {},
|
|
245
342
|
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
246
|
-
...
|
|
343
|
+
...et(e, d)
|
|
247
344
|
});
|
|
248
345
|
}
|
|
249
346
|
createNewContext(e, t) {
|
|
@@ -256,14 +353,14 @@ var He = class {
|
|
|
256
353
|
cmLabel: t ?? "New Context"
|
|
257
354
|
});
|
|
258
355
|
}
|
|
259
|
-
},
|
|
356
|
+
}, nt = class extends se {
|
|
260
357
|
create(e, t) {
|
|
261
358
|
return !t?.id && (e === "shape" || e === "connection") && (t = {
|
|
262
359
|
...t,
|
|
263
360
|
id: te(e === "shape" ? "ctx" : "rel")
|
|
264
361
|
}), super.create(e, t);
|
|
265
362
|
}
|
|
266
|
-
},
|
|
363
|
+
}, rt = class {
|
|
267
364
|
docking;
|
|
268
365
|
static $inject = ["connectionDocking"];
|
|
269
366
|
constructor(e) {
|
|
@@ -273,50 +370,16 @@ var He = class {
|
|
|
273
370
|
let n = t.source ?? e.source, r = t.target ?? e.target, i = [n ? _(n) : t.connectionStart || void 0, r ? _(r) : t.connectionEnd || void 0].filter(Boolean);
|
|
274
371
|
return e.waypoints = i, n && r && i.length === 2 ? this.docking.getCroppedWaypoints(e, n, r) : i;
|
|
275
372
|
}
|
|
276
|
-
},
|
|
277
|
-
elementFactory: ["type",
|
|
278
|
-
cmElementFactory: ["type",
|
|
373
|
+
}, it = {
|
|
374
|
+
elementFactory: ["type", nt],
|
|
375
|
+
cmElementFactory: ["type", tt],
|
|
279
376
|
connectionDocking: ["type", oe]
|
|
280
|
-
}
|
|
281
|
-
blau: "#335DE5",
|
|
282
|
-
blauLink: "#2B50D4",
|
|
283
|
-
blauHell: "#6B8AFF",
|
|
284
|
-
gruen: "#00E676",
|
|
285
|
-
grau: "#F9F7F7",
|
|
286
|
-
schwarz: "#1D1D1D",
|
|
287
|
-
weiss: "#FFFFFF",
|
|
288
|
-
linie: "#E6E2E2",
|
|
289
|
-
success: "#00E676",
|
|
290
|
-
warning: "#FFB000",
|
|
291
|
-
danger: "#CD1839",
|
|
292
|
-
info: "#335DE5",
|
|
293
|
-
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
294
|
-
}, Ke = {
|
|
295
|
-
"--cd-blau": O.blau,
|
|
296
|
-
"--cd-gruen": O.gruen,
|
|
297
|
-
"--cd-grau": O.grau,
|
|
298
|
-
"--cd-schwarz": O.schwarz,
|
|
299
|
-
"--cd-weiss": O.weiss,
|
|
300
|
-
"--cd-blau-link": O.blauLink,
|
|
301
|
-
"--cd-blau-hell": O.blauHell,
|
|
302
|
-
"--cd-linie": O.linie,
|
|
303
|
-
"--cd-success": O.success,
|
|
304
|
-
"--cd-warning": O.warning,
|
|
305
|
-
"--cd-danger": O.danger,
|
|
306
|
-
"--cd-info": O.info,
|
|
307
|
-
"--cd-gradient-brand": O.gradientBrand
|
|
308
|
-
}, qe = 1500;
|
|
309
|
-
O.blau;
|
|
310
|
-
var k = O.schwarz, Je = "#5B5B5B", A = {
|
|
311
|
-
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
312
|
-
label: 13.5,
|
|
313
|
-
small: 11
|
|
314
|
-
}, j = O.weiss, Ye = "#F1F1EE", Xe = "#8A8577";
|
|
377
|
+
};
|
|
315
378
|
//#endregion
|
|
316
379
|
//#region src/draw/endRoleChips.ts
|
|
317
|
-
function
|
|
380
|
+
function at(e, t, n, r) {
|
|
318
381
|
if (r.length === 0) return null;
|
|
319
|
-
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l =
|
|
382
|
+
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l = O.small * .64, u = O.small + 6, d = r.map((e) => e.length * l + 12), f = d.reduce((e, t) => e + t, 0) + 3 * (r.length - 1), p = f + 8, m = u + 8, h = 11 + n.length * l / 2 + 8 + p / 2, g = {
|
|
320
383
|
x: e.x + s * h,
|
|
321
384
|
y: e.y + c * h
|
|
322
385
|
};
|
|
@@ -336,16 +399,16 @@ function M(e, t, n, r) {
|
|
|
336
399
|
}
|
|
337
400
|
//#endregion
|
|
338
401
|
//#region src/draw/ContextMapsRenderer.ts
|
|
339
|
-
var
|
|
402
|
+
var ot = class extends le {
|
|
340
403
|
static $inject = ["eventBus"];
|
|
341
404
|
constructor(e) {
|
|
342
|
-
super(e,
|
|
405
|
+
super(e, Be);
|
|
343
406
|
}
|
|
344
407
|
canRender(e) {
|
|
345
|
-
return
|
|
408
|
+
return C(e);
|
|
346
409
|
}
|
|
347
410
|
drawShape(e, t) {
|
|
348
|
-
if (ue(e),
|
|
411
|
+
if (ue(e), w(t)) return this.drawContext(e, t);
|
|
349
412
|
let n = y(b("rect"), {
|
|
350
413
|
width: t.width,
|
|
351
414
|
height: t.height,
|
|
@@ -354,11 +417,11 @@ var Ze = class extends le {
|
|
|
354
417
|
return v(e, n), n;
|
|
355
418
|
}
|
|
356
419
|
drawConnection(e, t) {
|
|
357
|
-
if (ue(e),
|
|
420
|
+
if (ue(e), T(t)) return this.drawRelationship(e, t);
|
|
358
421
|
let n = y(b("polyline"), {
|
|
359
422
|
points: (t.waypoints ?? []).map((e) => `${e.x},${e.y}`).join(" "),
|
|
360
423
|
fill: "none",
|
|
361
|
-
stroke:
|
|
424
|
+
stroke: D
|
|
362
425
|
});
|
|
363
426
|
return v(e, n), n;
|
|
364
427
|
}
|
|
@@ -384,34 +447,34 @@ var Ze = class extends le {
|
|
|
384
447
|
"stroke-linejoin": "round"
|
|
385
448
|
});
|
|
386
449
|
if (v(e, a), this.appendLabel(e, t.cmLabel ?? "", r, i, !!t.team, { "font-weight": "650" }), t.subdomainType && n) {
|
|
387
|
-
v(e,
|
|
450
|
+
v(e, ut(t.subdomainType, 15, 15, 18, n.stroke));
|
|
388
451
|
let r = y(b("text"), {
|
|
389
|
-
x:
|
|
390
|
-
y:
|
|
391
|
-
"font-family":
|
|
392
|
-
"font-size":
|
|
393
|
-
"font-weight":
|
|
452
|
+
x: M.x,
|
|
453
|
+
y: M.y,
|
|
454
|
+
"font-family": O.family,
|
|
455
|
+
"font-size": O.small,
|
|
456
|
+
"font-weight": M.fontWeight,
|
|
394
457
|
fill: n.stroke,
|
|
395
458
|
"text-anchor": "start",
|
|
396
459
|
"dominant-baseline": "central",
|
|
397
|
-
"letter-spacing":
|
|
460
|
+
"letter-spacing": `${M.letterSpacingEm}em`
|
|
398
461
|
});
|
|
399
462
|
r.textContent = n.label, v(e, r);
|
|
400
463
|
}
|
|
401
464
|
if (t.team) {
|
|
402
|
-
let n =
|
|
403
|
-
y(
|
|
404
|
-
let
|
|
465
|
+
let n = Ke(r, i, t.team), a = ft(n.iconCenterX, n.centerY, 14, Ve);
|
|
466
|
+
y(a, { class: "cm-team" }), v(e, a);
|
|
467
|
+
let o = y(b("text"), {
|
|
405
468
|
class: "cm-team",
|
|
406
|
-
x:
|
|
407
|
-
y:
|
|
408
|
-
"font-family":
|
|
409
|
-
"font-size":
|
|
410
|
-
fill:
|
|
469
|
+
x: n.textX,
|
|
470
|
+
y: n.centerY,
|
|
471
|
+
"font-family": O.family,
|
|
472
|
+
"font-size": O.small,
|
|
473
|
+
fill: Ve,
|
|
411
474
|
"text-anchor": "start",
|
|
412
475
|
"dominant-baseline": "central"
|
|
413
476
|
});
|
|
414
|
-
|
|
477
|
+
o.textContent = t.team, v(e, o);
|
|
415
478
|
}
|
|
416
479
|
return a;
|
|
417
480
|
}
|
|
@@ -429,7 +492,7 @@ var Ze = class extends le {
|
|
|
429
492
|
let i = r[0], a = r[r.length - 1], o = t.upstreamRoles ?? [], s = t.downstreamRoles ?? [];
|
|
430
493
|
if (n.symmetric) {
|
|
431
494
|
let t = (i.x + a.x) / 2, r = (i.y + a.y) / 2;
|
|
432
|
-
this.chip(e, t, r, n.abbreviation,
|
|
495
|
+
this.chip(e, t, r, n.abbreviation, k, n.stroke, n.stroke);
|
|
433
496
|
} else {
|
|
434
497
|
let n = t.pattern === "customer-supplier";
|
|
435
498
|
this.endMarkers(e, i, a, n ? "S" : "U", o), this.endMarkers(e, a, i, n ? "C" : "D", s);
|
|
@@ -438,21 +501,21 @@ var Ze = class extends le {
|
|
|
438
501
|
return a;
|
|
439
502
|
}
|
|
440
503
|
endMarkers(e, t, n, r, i) {
|
|
441
|
-
let a = n.x - t.x, o = n.y - t.y, s = Math.hypot(a, o) || 1, c = a / s, u = o / s, d = l[r] ??
|
|
504
|
+
let a = n.x - t.x, o = n.y - t.y, s = Math.hypot(a, o) || 1, c = a / s, u = o / s, d = l[r] ?? D, f = y(b("text"), {
|
|
442
505
|
x: t.x + c * 11,
|
|
443
506
|
y: t.y + u * 11,
|
|
444
|
-
"font-family":
|
|
445
|
-
"font-size":
|
|
507
|
+
"font-family": O.family,
|
|
508
|
+
"font-size": O.small + 1,
|
|
446
509
|
"font-weight": "800",
|
|
447
510
|
fill: d,
|
|
448
|
-
stroke:
|
|
511
|
+
stroke: k,
|
|
449
512
|
"stroke-width": 3,
|
|
450
513
|
"paint-order": "stroke",
|
|
451
514
|
"text-anchor": "middle",
|
|
452
515
|
"dominant-baseline": "central"
|
|
453
516
|
});
|
|
454
517
|
f.textContent = r, v(e, f);
|
|
455
|
-
let p =
|
|
518
|
+
let p = at(t, n, r, i);
|
|
456
519
|
if (!p) return;
|
|
457
520
|
let { box: m, center: h, chipWidths: g, chipHeight: ee, innerWidth: te, gap: ne } = p, re = h.y, ie = y(b("rect"), {
|
|
458
521
|
x: m.x,
|
|
@@ -461,7 +524,7 @@ var Ze = class extends le {
|
|
|
461
524
|
height: m.height,
|
|
462
525
|
rx: 6,
|
|
463
526
|
ry: 6,
|
|
464
|
-
fill:
|
|
527
|
+
fill: k,
|
|
465
528
|
"fill-opacity": .96,
|
|
466
529
|
stroke: "#d9d5cc",
|
|
467
530
|
"stroke-width": 1
|
|
@@ -482,15 +545,15 @@ var Ze = class extends le {
|
|
|
482
545
|
rx: 3,
|
|
483
546
|
ry: 3,
|
|
484
547
|
fill: o,
|
|
485
|
-
stroke:
|
|
548
|
+
stroke: st(o),
|
|
486
549
|
"stroke-width": 1
|
|
487
550
|
});
|
|
488
551
|
v(e, s);
|
|
489
552
|
let c = y(b("text"), {
|
|
490
553
|
x: t,
|
|
491
554
|
y: n,
|
|
492
|
-
"font-family":
|
|
493
|
-
"font-size":
|
|
555
|
+
"font-family": O.family,
|
|
556
|
+
"font-size": O.small,
|
|
494
557
|
"font-weight": "700",
|
|
495
558
|
fill: u,
|
|
496
559
|
"text-anchor": "middle",
|
|
@@ -500,7 +563,7 @@ var Ze = class extends le {
|
|
|
500
563
|
}
|
|
501
564
|
chip(e, t, n, r, i, a, o) {
|
|
502
565
|
if (!r) return;
|
|
503
|
-
let s =
|
|
566
|
+
let s = O.small * .64, c = r.length * s + 12, l = O.small + 8, u = y(b("rect"), {
|
|
504
567
|
x: t - c / 2,
|
|
505
568
|
y: n - l / 2,
|
|
506
569
|
width: c,
|
|
@@ -510,14 +573,14 @@ var Ze = class extends le {
|
|
|
510
573
|
fill: i,
|
|
511
574
|
stroke: o,
|
|
512
575
|
"stroke-width": 1,
|
|
513
|
-
...i ===
|
|
576
|
+
...i === k ? { "fill-opacity": .95 } : {}
|
|
514
577
|
});
|
|
515
578
|
v(e, u);
|
|
516
579
|
let d = y(b("text"), {
|
|
517
580
|
x: t,
|
|
518
581
|
y: n,
|
|
519
|
-
"font-family":
|
|
520
|
-
"font-size":
|
|
582
|
+
"font-family": O.family,
|
|
583
|
+
"font-size": O.small,
|
|
521
584
|
"font-weight": "700",
|
|
522
585
|
fill: a,
|
|
523
586
|
"text-anchor": "middle",
|
|
@@ -526,17 +589,17 @@ var Ze = class extends le {
|
|
|
526
589
|
d.textContent = r, v(e, d);
|
|
527
590
|
}
|
|
528
591
|
appendLabel(e, t, n, r, i, a) {
|
|
529
|
-
let o = typeof a["font-size"] == "number" ? a["font-size"] :
|
|
530
|
-
l.length > f && (l = l.slice(0, f), l[f - 1] =
|
|
592
|
+
let o = typeof a["font-size"] == "number" ? a["font-size"] : O.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l = mt(t, c, o, s), u = o * 1.2, d = r - 36 - (i ? 18 : 8), f = Math.max(1, Math.floor(d / u));
|
|
593
|
+
l.length > f && (l = l.slice(0, f), l[f - 1] = pt(l[f - 1], c, o, s));
|
|
531
594
|
let p = 36 + u / 2;
|
|
532
595
|
l.forEach((t, r) => {
|
|
533
596
|
let i = y(b("text"), {
|
|
534
597
|
class: "cm-name",
|
|
535
598
|
x: n / 2,
|
|
536
599
|
y: p + r * u,
|
|
537
|
-
"font-family":
|
|
600
|
+
"font-family": O.family,
|
|
538
601
|
"font-size": o,
|
|
539
|
-
fill:
|
|
602
|
+
fill: D,
|
|
540
603
|
"text-anchor": "middle",
|
|
541
604
|
"dominant-baseline": "central",
|
|
542
605
|
...a
|
|
@@ -545,14 +608,14 @@ var Ze = class extends le {
|
|
|
545
608
|
});
|
|
546
609
|
}
|
|
547
610
|
};
|
|
548
|
-
function
|
|
611
|
+
function st(e, t = .7) {
|
|
549
612
|
let n = /^#([0-9a-f]{6})$/i.exec(e);
|
|
550
613
|
if (!n) return e;
|
|
551
614
|
let r = parseInt(n[1], 16);
|
|
552
615
|
return `rgb(${Math.round((r >> 16 & 255) * t)},${Math.round((r >> 8 & 255) * t)},${Math.round((r & 255) * t)})`;
|
|
553
616
|
}
|
|
554
|
-
var
|
|
555
|
-
function
|
|
617
|
+
var ct = "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 7.1-1.01z", lt = "M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z";
|
|
618
|
+
function ut(e, t, n, r, i) {
|
|
556
619
|
if (e === "generic") {
|
|
557
620
|
let e = b("g"), a = y(b("circle"), {
|
|
558
621
|
cx: t,
|
|
@@ -568,41 +631,37 @@ function tt(e, t, n, r, i) {
|
|
|
568
631
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = b("g");
|
|
569
632
|
y(s, { transform: `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}` });
|
|
570
633
|
let c = y(b("path"), {
|
|
571
|
-
d: e === "core" ?
|
|
634
|
+
d: e === "core" ? ct : lt,
|
|
572
635
|
fill: i
|
|
573
636
|
});
|
|
574
637
|
return v(s, c), s;
|
|
575
638
|
}
|
|
576
|
-
var
|
|
577
|
-
function
|
|
639
|
+
var dt = "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z";
|
|
640
|
+
function ft(e, t, n, r) {
|
|
578
641
|
let i = n / 24, a = b("g");
|
|
579
642
|
y(a, { transform: `translate(${e - 12 * i} ${t - 12 * i}) scale(${i})` });
|
|
580
643
|
let o = y(b("path"), {
|
|
581
|
-
d:
|
|
644
|
+
d: dt,
|
|
582
645
|
fill: r
|
|
583
646
|
});
|
|
584
647
|
return v(a, o), a;
|
|
585
648
|
}
|
|
586
|
-
|
|
587
|
-
function it(e, t, n) {
|
|
588
|
-
return N === void 0 && (N = typeof document > "u" ? null : document.createElement("canvas").getContext("2d")), N ? (N.font = `${n} ${t}px ${A.family}`, N.measureText(e).width) : e.length * t * .58;
|
|
589
|
-
}
|
|
590
|
-
function at(e, t, n, r) {
|
|
649
|
+
function pt(e, t, n, r) {
|
|
591
650
|
let i = e;
|
|
592
|
-
for (; i &&
|
|
651
|
+
for (; i && j(`${i}…`, n, r) > t;) i = i.slice(0, -1).trimEnd();
|
|
593
652
|
return `${i}…`;
|
|
594
653
|
}
|
|
595
|
-
function
|
|
654
|
+
function mt(e, t, n, r) {
|
|
596
655
|
let i = e.split("\n");
|
|
597
656
|
return i.every((e) => e.trim() === "") ? [] : i.flatMap((e) => {
|
|
598
|
-
let i =
|
|
657
|
+
let i = ht(e, t, n, r);
|
|
599
658
|
return i.length ? i : [""];
|
|
600
659
|
});
|
|
601
660
|
}
|
|
602
|
-
function
|
|
661
|
+
function ht(e, t, n, r) {
|
|
603
662
|
let i = e.split(/\s+/).filter(Boolean);
|
|
604
663
|
if (i.length === 0) return [];
|
|
605
|
-
let a = (e) =>
|
|
664
|
+
let a = (e) => j(e, n, r) <= t, o = [], s = "";
|
|
606
665
|
for (let e of i) {
|
|
607
666
|
let t = s ? `${s} ${e}` : e;
|
|
608
667
|
if (a(t)) {
|
|
@@ -625,13 +684,13 @@ function st(e, t, n, r) {
|
|
|
625
684
|
}
|
|
626
685
|
//#endregion
|
|
627
686
|
//#region src/draw/index.ts
|
|
628
|
-
var
|
|
687
|
+
var gt = {
|
|
629
688
|
__init__: ["cmRenderer"],
|
|
630
|
-
cmRenderer: ["type",
|
|
689
|
+
cmRenderer: ["type", ot]
|
|
631
690
|
};
|
|
632
691
|
//#endregion
|
|
633
692
|
//#region src/io/CmImporter.ts
|
|
634
|
-
function
|
|
693
|
+
function _t(e, t) {
|
|
635
694
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r;
|
|
636
695
|
if (i === 0 && a === 0) return {
|
|
637
696
|
x: n,
|
|
@@ -643,13 +702,13 @@ function lt(e, t) {
|
|
|
643
702
|
y: r + a * c
|
|
644
703
|
};
|
|
645
704
|
}
|
|
646
|
-
function
|
|
705
|
+
function vt(e) {
|
|
647
706
|
return {
|
|
648
707
|
x: e.x + e.width / 2,
|
|
649
708
|
y: e.y + e.height / 2
|
|
650
709
|
};
|
|
651
710
|
}
|
|
652
|
-
var
|
|
711
|
+
var yt = class {
|
|
653
712
|
canvas;
|
|
654
713
|
elementFactory;
|
|
655
714
|
factory;
|
|
@@ -696,15 +755,15 @@ var dt = class {
|
|
|
696
755
|
});
|
|
697
756
|
continue;
|
|
698
757
|
}
|
|
699
|
-
let s = [
|
|
758
|
+
let s = [_t(e, vt(a)), _t(a, vt(e))], c = this.factory.createRelationship(r, e, a, s);
|
|
700
759
|
this.canvas.addConnection(c, n);
|
|
701
760
|
}
|
|
702
761
|
for (let e of o.values()) this.canvas.addShape(e, n);
|
|
703
762
|
return i.length > 0 && (n.businessObject.unplacedRelationships = i), this.eventBus.fire("import.render.done", { warnings: t }), t;
|
|
704
763
|
}
|
|
705
764
|
documentRoot() {
|
|
706
|
-
let e = this.elementRegistry.get(
|
|
707
|
-
e || (e = this.elementFactory.createRoot({ id:
|
|
765
|
+
let e = this.elementRegistry.get(N);
|
|
766
|
+
e || (e = this.elementFactory.createRoot({ id: N }), this.canvas.setRootElement(e));
|
|
708
767
|
for (let t of this.canvas.getRootElements()) t !== e && this.canvas.removeRootElement(t);
|
|
709
768
|
return e;
|
|
710
769
|
}
|
|
@@ -714,16 +773,16 @@ var dt = class {
|
|
|
714
773
|
"waypoints" in t ? this.canvas.removeConnection(t.id) : this.canvas.removeShape(t.id);
|
|
715
774
|
} catch {}
|
|
716
775
|
}
|
|
717
|
-
},
|
|
776
|
+
}, bt = class {
|
|
718
777
|
elementRegistry;
|
|
719
778
|
static $inject = ["elementRegistry"];
|
|
720
779
|
constructor(e) {
|
|
721
780
|
this.elementRegistry = e;
|
|
722
781
|
}
|
|
723
782
|
export() {
|
|
724
|
-
let e = this.elementRegistry.get(
|
|
725
|
-
for (let e of this.elementRegistry.getAll()) if (e.id !==
|
|
726
|
-
if (
|
|
783
|
+
let e = this.elementRegistry.get(N)?.businessObject, t = [], n = [];
|
|
784
|
+
for (let e of this.elementRegistry.getAll()) if (e.id !== N) {
|
|
785
|
+
if (w(e)) {
|
|
727
786
|
let n = e;
|
|
728
787
|
t.push({
|
|
729
788
|
id: e.id,
|
|
@@ -743,7 +802,7 @@ var dt = class {
|
|
|
743
802
|
...e.stroke ? { stroke: e.stroke } : {},
|
|
744
803
|
...e.cmForeign
|
|
745
804
|
});
|
|
746
|
-
} else if (
|
|
805
|
+
} else if (T(e)) {
|
|
747
806
|
let t = e.source, r = e.target;
|
|
748
807
|
if (!t?.id || !r?.id) continue;
|
|
749
808
|
n.push({
|
|
@@ -768,30 +827,30 @@ var dt = class {
|
|
|
768
827
|
...e?.foreign
|
|
769
828
|
};
|
|
770
829
|
}
|
|
771
|
-
},
|
|
772
|
-
cmImporter: ["type",
|
|
773
|
-
cmExporter: ["type",
|
|
774
|
-
},
|
|
830
|
+
}, xt = {
|
|
831
|
+
cmImporter: ["type", yt],
|
|
832
|
+
cmExporter: ["type", bt]
|
|
833
|
+
}, St = class extends $e {
|
|
775
834
|
_getModules() {
|
|
776
835
|
return [
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
836
|
+
it,
|
|
837
|
+
gt,
|
|
838
|
+
xt
|
|
780
839
|
];
|
|
781
840
|
}
|
|
782
|
-
},
|
|
841
|
+
}, Ct = {
|
|
783
842
|
x: 14,
|
|
784
843
|
y: 18
|
|
785
|
-
},
|
|
786
|
-
function
|
|
787
|
-
if (
|
|
844
|
+
}, wt = 12;
|
|
845
|
+
function Tt(e) {
|
|
846
|
+
if (w(e)) {
|
|
788
847
|
let t = [];
|
|
789
848
|
return e.description && t.push(e.description), e.team && t.push(`Team: ${e.team}`), t.length === 0 ? null : {
|
|
790
849
|
title: e.cmLabel ?? "Bounded context",
|
|
791
850
|
body: t.join(" · ")
|
|
792
851
|
};
|
|
793
852
|
}
|
|
794
|
-
if (
|
|
853
|
+
if (T(e)) {
|
|
795
854
|
let t = f[e.pattern]?.label ?? e.pattern, n = [];
|
|
796
855
|
return e.description && n.push(e.description), e.implementationTechnology && n.push(e.implementationTechnology), {
|
|
797
856
|
title: e.cmLabel ? `${t} · ${e.cmLabel}` : t,
|
|
@@ -800,7 +859,7 @@ function _t(e) {
|
|
|
800
859
|
}
|
|
801
860
|
return null;
|
|
802
861
|
}
|
|
803
|
-
var
|
|
862
|
+
var Et = class {
|
|
804
863
|
static $inject = ["eventBus", "canvas"];
|
|
805
864
|
tooltip;
|
|
806
865
|
title;
|
|
@@ -809,13 +868,13 @@ var vt = class {
|
|
|
809
868
|
let n = t.getContainer();
|
|
810
869
|
this.tooltip = document.createElement("div"), this.tooltip.className = "cm-hover-tooltip", this.tooltip.setAttribute("role", "tooltip"), this.tooltip.hidden = !0, this.title = document.createElement("strong"), this.body = document.createElement("span"), this.tooltip.append(this.title, this.body), n.append(this.tooltip);
|
|
811
870
|
let r = (e) => {
|
|
812
|
-
let t = n.getBoundingClientRect(), r = this.tooltip.offsetWidth, i = Math.min(e.clientX - t.left +
|
|
813
|
-
this.tooltip.style.left = `${Math.max(
|
|
871
|
+
let t = n.getBoundingClientRect(), r = this.tooltip.offsetWidth, i = Math.min(e.clientX - t.left + Ct.x, t.width - r - wt);
|
|
872
|
+
this.tooltip.style.left = `${Math.max(wt, i)}px`, this.tooltip.style.top = `${e.clientY - t.top + Ct.y}px`;
|
|
814
873
|
}, i = () => {
|
|
815
874
|
this.tooltip.hidden = !0, n.removeEventListener("mousemove", r);
|
|
816
875
|
};
|
|
817
876
|
e.on("element.hover", (e) => {
|
|
818
|
-
let t =
|
|
877
|
+
let t = Tt(e.element);
|
|
819
878
|
t ? (this.title.textContent = t.title, this.body.textContent = t.body, this.body.hidden = t.body === "", this.tooltip.hidden = !1, e.originalEvent && r(e.originalEvent), n.addEventListener("mousemove", r)) : i();
|
|
820
879
|
}), e.on([
|
|
821
880
|
"element.out",
|
|
@@ -826,58 +885,58 @@ var vt = class {
|
|
|
826
885
|
i(), this.tooltip.remove();
|
|
827
886
|
});
|
|
828
887
|
}
|
|
829
|
-
},
|
|
888
|
+
}, Dt = {
|
|
830
889
|
__init__: ["cmHoverTooltip"],
|
|
831
|
-
cmHoverTooltip: ["type",
|
|
832
|
-
},
|
|
890
|
+
cmHoverTooltip: ["type", Et]
|
|
891
|
+
}, Ot = class extends St {
|
|
833
892
|
_getModules() {
|
|
834
893
|
return [
|
|
835
894
|
...super._getModules(),
|
|
836
895
|
x,
|
|
837
896
|
de,
|
|
838
897
|
fe,
|
|
839
|
-
|
|
898
|
+
Dt
|
|
840
899
|
];
|
|
841
900
|
}
|
|
842
901
|
};
|
|
843
902
|
//#endregion
|
|
844
903
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
845
|
-
function
|
|
904
|
+
function kt(e, t, n) {
|
|
846
905
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
847
906
|
}
|
|
848
|
-
var
|
|
907
|
+
var At = class {
|
|
849
908
|
execute(e) {
|
|
850
909
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
851
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
910
|
+
for (let e of Object.keys(n)) i[e] = r[e], kt(r, e, n[e]);
|
|
852
911
|
return e.oldProperties = i, [t];
|
|
853
912
|
}
|
|
854
913
|
revert(e) {
|
|
855
914
|
let { element: t, oldProperties: n } = e, r = t;
|
|
856
|
-
if (n) for (let e of Object.keys(n))
|
|
915
|
+
if (n) for (let e of Object.keys(n)) kt(r, e, n[e]);
|
|
857
916
|
return [t];
|
|
858
917
|
}
|
|
859
918
|
};
|
|
860
919
|
//#endregion
|
|
861
920
|
//#region src/modeling/cmd/SwapEndsHandler.ts
|
|
862
|
-
function
|
|
921
|
+
function jt(e) {
|
|
863
922
|
let t = e.source;
|
|
864
923
|
return e.source = e.target, e.target = t, Array.isArray(e.waypoints) && (e.waypoints = [...e.waypoints].reverse()), [e];
|
|
865
924
|
}
|
|
866
|
-
var
|
|
925
|
+
var Mt = class {
|
|
867
926
|
execute(e) {
|
|
868
|
-
return
|
|
927
|
+
return jt(e.connection);
|
|
869
928
|
}
|
|
870
929
|
revert(e) {
|
|
871
|
-
return
|
|
930
|
+
return jt(e.connection);
|
|
872
931
|
}
|
|
873
|
-
},
|
|
932
|
+
}, Nt = class {
|
|
874
933
|
elementRegistry;
|
|
875
934
|
static $inject = ["elementRegistry"];
|
|
876
935
|
constructor(e) {
|
|
877
936
|
this.elementRegistry = e;
|
|
878
937
|
}
|
|
879
938
|
root() {
|
|
880
|
-
let e = this.elementRegistry.get(
|
|
939
|
+
let e = this.elementRegistry.get(N);
|
|
881
940
|
if (!e?.businessObject) throw Error("No context map is loaded to rename.");
|
|
882
941
|
return e;
|
|
883
942
|
}
|
|
@@ -895,7 +954,7 @@ var Ct = class {
|
|
|
895
954
|
title: e.oldTitle ?? ""
|
|
896
955
|
}, [];
|
|
897
956
|
}
|
|
898
|
-
},
|
|
957
|
+
}, Pt = "element.updateProperties", Ft = "relationship.swapEnds", It = "map.updateTitle", Lt = class {
|
|
899
958
|
commandStack;
|
|
900
959
|
elementRegistry;
|
|
901
960
|
graphicsFactory;
|
|
@@ -905,20 +964,20 @@ var Ct = class {
|
|
|
905
964
|
"graphicsFactory"
|
|
906
965
|
];
|
|
907
966
|
constructor(e, t, n) {
|
|
908
|
-
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(
|
|
967
|
+
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(Pt, At), e.registerHandler(Ft, Mt), e.registerHandler(It, Nt);
|
|
909
968
|
}
|
|
910
969
|
setTitle(e) {
|
|
911
|
-
this.commandStack.execute(
|
|
970
|
+
this.commandStack.execute(It, { title: e });
|
|
912
971
|
}
|
|
913
972
|
redraw(e) {
|
|
914
973
|
let t = this.elementRegistry.getGraphics(e);
|
|
915
|
-
t && this.graphicsFactory.update(
|
|
974
|
+
t && this.graphicsFactory.update(T(e) ? "connection" : "shape", e, t);
|
|
916
975
|
}
|
|
917
976
|
swapEnds(e) {
|
|
918
|
-
this.commandStack.execute(
|
|
977
|
+
this.commandStack.execute(Ft, { connection: e }), this.redraw(e);
|
|
919
978
|
}
|
|
920
979
|
updateProperties(e, t) {
|
|
921
|
-
this.commandStack.execute(
|
|
980
|
+
this.commandStack.execute(Pt, {
|
|
922
981
|
element: e,
|
|
923
982
|
properties: t
|
|
924
983
|
}), this.redraw(e);
|
|
@@ -959,36 +1018,36 @@ var Ct = class {
|
|
|
959
1018
|
setImplementationTechnology(e, t) {
|
|
960
1019
|
this.updateProperties(e, { implementationTechnology: t || void 0 });
|
|
961
1020
|
}
|
|
962
|
-
},
|
|
1021
|
+
}, P = {
|
|
963
1022
|
__init__: ["cmModeling"],
|
|
964
|
-
cmModeling: ["type",
|
|
965
|
-
layouter: ["type",
|
|
966
|
-
},
|
|
1023
|
+
cmModeling: ["type", Lt],
|
|
1024
|
+
layouter: ["type", rt]
|
|
1025
|
+
}, Rt = class extends _e {
|
|
967
1026
|
static $inject = ["eventBus"];
|
|
968
1027
|
constructor(e) {
|
|
969
1028
|
super(e);
|
|
970
1029
|
}
|
|
971
1030
|
init() {
|
|
972
|
-
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !1), this.addRule("connection.create", (e) =>
|
|
1031
|
+
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !1), this.addRule("connection.create", (e) => Bt(e.source, e.target)), this.addRule("connection.reconnect", (e) => !!Bt(e.source, e.target, e.connection)), this.addRule("connection.updateWaypoints", () => !0);
|
|
973
1032
|
}
|
|
974
1033
|
};
|
|
975
|
-
function
|
|
1034
|
+
function zt(e, t, n) {
|
|
976
1035
|
let { incoming: r = [], outgoing: i = [] } = e;
|
|
977
1036
|
return [...r, ...i].some((r) => r !== n && (r.source === e && r.target === t || r.source === t && r.target === e));
|
|
978
1037
|
}
|
|
979
|
-
function
|
|
980
|
-
return !
|
|
1038
|
+
function Bt(e, t, n) {
|
|
1039
|
+
return !w(e) || !w(t) || e === t || zt(e, t, n) ? !1 : {
|
|
981
1040
|
cmKind: "relationship",
|
|
982
1041
|
pattern: "upstream-downstream"
|
|
983
1042
|
};
|
|
984
1043
|
}
|
|
985
1044
|
//#endregion
|
|
986
1045
|
//#region src/rules/index.ts
|
|
987
|
-
var
|
|
1046
|
+
var F = {
|
|
988
1047
|
__depends__: [ge],
|
|
989
1048
|
__init__: ["cmRules"],
|
|
990
|
-
cmRules: ["type",
|
|
991
|
-
},
|
|
1049
|
+
cmRules: ["type", Rt]
|
|
1050
|
+
}, Vt = class extends ve {
|
|
992
1051
|
static $inject = [
|
|
993
1052
|
"eventBus",
|
|
994
1053
|
"canvas",
|
|
@@ -1016,33 +1075,33 @@ var I = {
|
|
|
1016
1075
|
}
|
|
1017
1076
|
}, !0);
|
|
1018
1077
|
}
|
|
1019
|
-
},
|
|
1078
|
+
}, Ht = "cm-dragging", Ut = class {
|
|
1020
1079
|
static $inject = ["eventBus", "canvas"];
|
|
1021
1080
|
constructor(e, t) {
|
|
1022
1081
|
e.on("drag.init", () => {
|
|
1023
|
-
t.getContainer().classList.add(
|
|
1082
|
+
t.getContainer().classList.add(Ht);
|
|
1024
1083
|
}), e.on("drag.cleanup", () => {
|
|
1025
|
-
t.getContainer().classList.remove(
|
|
1084
|
+
t.getContainer().classList.remove(Ht);
|
|
1026
1085
|
});
|
|
1027
1086
|
}
|
|
1028
|
-
},
|
|
1087
|
+
}, Wt = 2e3, Gt = {
|
|
1029
1088
|
__init__: [
|
|
1030
1089
|
"cmFlatModelBehavior",
|
|
1031
1090
|
"cmDragBehavior",
|
|
1032
1091
|
"cmClickSelectionBehavior"
|
|
1033
1092
|
],
|
|
1034
|
-
cmFlatModelBehavior: ["type",
|
|
1035
|
-
cmDragBehavior: ["type",
|
|
1093
|
+
cmFlatModelBehavior: ["type", Vt],
|
|
1094
|
+
cmDragBehavior: ["type", Ut],
|
|
1036
1095
|
cmClickSelectionBehavior: ["type", class {
|
|
1037
1096
|
static $inject = ["eventBus", "selection"];
|
|
1038
1097
|
constructor(e, t) {
|
|
1039
|
-
e.on("element.click",
|
|
1098
|
+
e.on("element.click", Wt, (e) => {
|
|
1040
1099
|
let n = e.element;
|
|
1041
|
-
if (
|
|
1100
|
+
if (C(n) && !ye(e) && t.isSelected(n)) return !1;
|
|
1042
1101
|
});
|
|
1043
1102
|
}
|
|
1044
1103
|
}]
|
|
1045
|
-
},
|
|
1104
|
+
}, I = "cm.readOnly.changed", Kt = 5e3, qt = [
|
|
1046
1105
|
"elements.move",
|
|
1047
1106
|
"shape.move",
|
|
1048
1107
|
"shape.resize",
|
|
@@ -1054,7 +1113,7 @@ var I = {
|
|
|
1054
1113
|
"connection.reconnect",
|
|
1055
1114
|
"connection.updateWaypoints",
|
|
1056
1115
|
"elements.delete"
|
|
1057
|
-
],
|
|
1116
|
+
], Jt = class extends _e {
|
|
1058
1117
|
bus;
|
|
1059
1118
|
static $inject = ["eventBus"];
|
|
1060
1119
|
readOnly = !1;
|
|
@@ -1062,22 +1121,22 @@ var I = {
|
|
|
1062
1121
|
super(e), this.bus = e;
|
|
1063
1122
|
}
|
|
1064
1123
|
init() {
|
|
1065
|
-
this.addRule(
|
|
1124
|
+
this.addRule(qt, Kt, () => !this.readOnly && void 0);
|
|
1066
1125
|
}
|
|
1067
1126
|
isReadOnly() {
|
|
1068
1127
|
return this.readOnly;
|
|
1069
1128
|
}
|
|
1070
1129
|
setReadOnly(e) {
|
|
1071
|
-
this.readOnly !== e && (this.readOnly = e, this.bus.fire(
|
|
1130
|
+
this.readOnly !== e && (this.readOnly = e, this.bus.fire(I, { readOnly: e }));
|
|
1072
1131
|
}
|
|
1073
|
-
},
|
|
1132
|
+
}, L = {
|
|
1074
1133
|
__depends__: [ge],
|
|
1075
1134
|
__init__: ["cmReadOnly"],
|
|
1076
|
-
cmReadOnly: ["type",
|
|
1077
|
-
},
|
|
1135
|
+
cmReadOnly: ["type", Jt]
|
|
1136
|
+
}, Yt = {
|
|
1078
1137
|
name: "cm-direct-editing",
|
|
1079
1138
|
team: "cm-direct-editing-team"
|
|
1080
|
-
},
|
|
1139
|
+
}, Xt = 10, Zt = 20, Qt = class {
|
|
1081
1140
|
canvas;
|
|
1082
1141
|
directEditing;
|
|
1083
1142
|
modeling;
|
|
@@ -1101,11 +1160,11 @@ var I = {
|
|
|
1101
1160
|
update: (e, t) => this.commit(e, t)
|
|
1102
1161
|
}), e.on("element.dblclick", (e) => {
|
|
1103
1162
|
let t = e.element;
|
|
1104
|
-
|
|
1163
|
+
C(t) && (this.mode = w(t) && t.team && this.isInTeamBand(t, e.originalEvent) ? "team" : "name", n.activate(t));
|
|
1105
1164
|
}), e.on("drag.init", () => n.complete()), e.on("canvas.viewbox.changed", () => this.placeOpenEdit()), e.on("directEditing.activate", (e) => {
|
|
1106
1165
|
let n = e.active?.element;
|
|
1107
1166
|
if (!n) return;
|
|
1108
|
-
let r =
|
|
1167
|
+
let r = Yt[this.mode];
|
|
1109
1168
|
t.addMarker(n, r), this.activeMarker = {
|
|
1110
1169
|
element: n,
|
|
1111
1170
|
marker: r
|
|
@@ -1115,7 +1174,7 @@ var I = {
|
|
|
1115
1174
|
e && t.removeMarker(e.element, e.marker), this.activeMarker = void 0;
|
|
1116
1175
|
}), e.on("diagram.destroy", () => {
|
|
1117
1176
|
clearTimeout(this.resumeTimer), this.suspended = void 0;
|
|
1118
|
-
}), e.on("directEditing.activate.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), e.on(
|
|
1177
|
+
}), e.on("directEditing.activate.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), e.on(I, (e) => {
|
|
1119
1178
|
e.readOnly && n.cancel();
|
|
1120
1179
|
});
|
|
1121
1180
|
}
|
|
@@ -1158,9 +1217,9 @@ var I = {
|
|
|
1158
1217
|
}
|
|
1159
1218
|
resume(e) {
|
|
1160
1219
|
let t = this.elementRegistry.get(e.elementId);
|
|
1161
|
-
if (!
|
|
1220
|
+
if (!C(t) || e.mode === "team" && !w(t) || (this.mode = e.mode, !this.directEditing.activate(t))) return;
|
|
1162
1221
|
let n = this.directEditing.$textbox?.querySelector("[contenteditable]");
|
|
1163
|
-
n && (n.innerText = e.text,
|
|
1222
|
+
n && (n.innerText = e.text, $t(n));
|
|
1164
1223
|
}
|
|
1165
1224
|
activate(e) {
|
|
1166
1225
|
this.mode = "name", this.directEditing.activate(e);
|
|
@@ -1177,22 +1236,22 @@ var I = {
|
|
|
1177
1236
|
return t.clientY - i >= r.y + r.height - 22 * n;
|
|
1178
1237
|
}
|
|
1179
1238
|
activationContext(e) {
|
|
1180
|
-
if (!
|
|
1181
|
-
this.mode === "team" && !
|
|
1239
|
+
if (!C(e)) return;
|
|
1240
|
+
this.mode === "team" && !w(e) && (this.mode = "name");
|
|
1182
1241
|
let t = this.canvas.zoom(), n = this.canvas.getAbsoluteBBox(e);
|
|
1183
1242
|
if (this.mode === "team") {
|
|
1184
1243
|
let r = e;
|
|
1185
1244
|
return {
|
|
1186
1245
|
bounds: {
|
|
1187
|
-
x: n.x +
|
|
1246
|
+
x: n.x + Xt * t,
|
|
1188
1247
|
y: n.y + n.height - 22 * t,
|
|
1189
1248
|
width: n.width - 20 * t,
|
|
1190
|
-
height:
|
|
1249
|
+
height: Zt * t
|
|
1191
1250
|
},
|
|
1192
1251
|
text: r.team ?? "",
|
|
1193
1252
|
style: {
|
|
1194
|
-
fontFamily:
|
|
1195
|
-
fontSize: `${
|
|
1253
|
+
fontFamily: O.family,
|
|
1254
|
+
fontSize: `${O.small * t}px`,
|
|
1196
1255
|
fontWeight: 400,
|
|
1197
1256
|
lineHeight: 1.2,
|
|
1198
1257
|
backgroundColor: "transparent",
|
|
@@ -1203,19 +1262,19 @@ var I = {
|
|
|
1203
1262
|
};
|
|
1204
1263
|
}
|
|
1205
1264
|
let r = {
|
|
1206
|
-
fontFamily:
|
|
1207
|
-
fontSize: `${
|
|
1265
|
+
fontFamily: O.family,
|
|
1266
|
+
fontSize: `${O.label * t}px`,
|
|
1208
1267
|
fontWeight: 650,
|
|
1209
1268
|
lineHeight: 1.2,
|
|
1210
1269
|
backgroundColor: "transparent",
|
|
1211
1270
|
border: "1px dashed var(--cd-ui-interaktion)",
|
|
1212
1271
|
textAlign: "center"
|
|
1213
1272
|
};
|
|
1214
|
-
if (
|
|
1273
|
+
if (w(e)) {
|
|
1215
1274
|
let i = e.team ? 18 * t : 0;
|
|
1216
1275
|
return {
|
|
1217
1276
|
bounds: {
|
|
1218
|
-
x: n.x +
|
|
1277
|
+
x: n.x + Xt * t,
|
|
1219
1278
|
y: n.y + 36 * t - 1,
|
|
1220
1279
|
width: n.width - 20 * t,
|
|
1221
1280
|
height: n.height - 36 * t - i
|
|
@@ -1249,7 +1308,7 @@ var I = {
|
|
|
1249
1308
|
} else n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1250
1309
|
}
|
|
1251
1310
|
};
|
|
1252
|
-
function
|
|
1311
|
+
function $t(e) {
|
|
1253
1312
|
let t = document.createRange();
|
|
1254
1313
|
t.selectNodeContents(e), t.collapse(!1);
|
|
1255
1314
|
let n = window.getSelection();
|
|
@@ -1257,44 +1316,44 @@ function Wt(e) {
|
|
|
1257
1316
|
}
|
|
1258
1317
|
//#endregion
|
|
1259
1318
|
//#region src/label-editing/index.ts
|
|
1260
|
-
var
|
|
1319
|
+
var R = {
|
|
1261
1320
|
__depends__: [
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1321
|
+
we,
|
|
1322
|
+
P,
|
|
1323
|
+
L
|
|
1265
1324
|
],
|
|
1266
1325
|
__init__: ["cmLabelEditing"],
|
|
1267
|
-
cmLabelEditing: ["type",
|
|
1326
|
+
cmLabelEditing: ["type", Qt]
|
|
1268
1327
|
};
|
|
1269
1328
|
//#endregion
|
|
1270
1329
|
//#region src/draw/palette-icons.ts
|
|
1271
|
-
function
|
|
1330
|
+
function z(e, t = 24) {
|
|
1272
1331
|
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
|
|
1273
1332
|
}
|
|
1274
|
-
var
|
|
1275
|
-
function
|
|
1333
|
+
var en = "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 7.1-1.01z", tn = "M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z";
|
|
1334
|
+
function nn(e, t, n, r, i) {
|
|
1276
1335
|
if (e === "generic") return `<circle cx="${t}" cy="${n}" r="${r / 2 - .5}" fill="none" stroke="${i}" stroke-width="1.4" stroke-dasharray="1.8 1.8"/>`;
|
|
1277
1336
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}`;
|
|
1278
|
-
return `<path d="${e === "core" ?
|
|
1337
|
+
return `<path d="${e === "core" ? en : tn}" fill="${i}" transform="${s}"/>`;
|
|
1279
1338
|
}
|
|
1280
|
-
function
|
|
1339
|
+
function B(e) {
|
|
1281
1340
|
let t = e ? p[e] : void 0;
|
|
1282
|
-
return
|
|
1341
|
+
return z(!e || !t ? `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${He}" stroke="${Ue}" stroke-width="1.5"/>` : `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5"/>` + nn(e, 13, 13, 12, t.stroke));
|
|
1283
1342
|
}
|
|
1284
|
-
function
|
|
1343
|
+
function rn(e, t = 18) {
|
|
1285
1344
|
let n = p[e], r = n?.stroke ?? "#8A8577";
|
|
1286
|
-
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 24 24" aria-hidden="true">${!n || e === "generic" ? `<circle cx="12" cy="12" r="9" fill="none" stroke="${r}" stroke-width="1.8" stroke-dasharray="2.4 2.4"/>` : `<path d="${e === "core" ?
|
|
1345
|
+
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 24 24" aria-hidden="true">${!n || e === "generic" ? `<circle cx="12" cy="12" r="9" fill="none" stroke="${r}" stroke-width="1.8" stroke-dasharray="2.4 2.4"/>` : `<path d="${e === "core" ? en : tn}" fill="${r}"/>`}</svg>`;
|
|
1287
1346
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return
|
|
1347
|
+
function V(e) {
|
|
1348
|
+
return z(`<rect x="1" y="6.5" width="24" height="13" rx="3" fill="${l[e] ?? "#8A8577"}"/><text x="13" y="16.4" text-anchor="middle" font-size="9.5" font-weight="700" fill="${u}" font-family="${O.family}">${e}</text>`);
|
|
1290
1349
|
}
|
|
1291
|
-
function
|
|
1350
|
+
function H(e = "upstream-downstream", t = 24) {
|
|
1292
1351
|
let n = f[e] ?? f["upstream-downstream"], r = n.dash ? ` stroke-dasharray="${n.dash}"` : "", i = Math.min(n.strokeWidth, 2.6);
|
|
1293
|
-
return
|
|
1352
|
+
return z(`<g stroke="${n.stroke}" stroke-width="${i}" stroke-linecap="round"><circle cx="5" cy="13" r="2.5" fill="${n.stroke}" stroke="none"/><line x1="7" y1="13" x2="19" y2="13"${r}/><circle cx="21" cy="13" r="2.5" fill="${n.stroke}" stroke="none"/></g>`, t);
|
|
1294
1353
|
}
|
|
1295
1354
|
//#endregion
|
|
1296
1355
|
//#region src/draw/lucide.ts
|
|
1297
|
-
var
|
|
1356
|
+
var an = {
|
|
1298
1357
|
"arrow-left-right": "<path d=\"M8 3 4 7l4 4\"/><path d=\"M4 7h16\"/><path d=\"m16 21 4-4-4-4\"/><path d=\"M20 17H4\"/>",
|
|
1299
1358
|
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
1300
1359
|
"circle-x": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/>",
|
|
@@ -1308,28 +1367,28 @@ var Yt = {
|
|
|
1308
1367
|
users: "<path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\"/><path d=\"M16 3.128a4 4 0 0 1 0 7.744\"/><path d=\"M22 21v-2a4 4 0 0 0-3-3.87\"/><circle cx=\"9\" cy=\"7\" r=\"4\"/>",
|
|
1309
1368
|
x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"
|
|
1310
1369
|
};
|
|
1311
|
-
function
|
|
1312
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${
|
|
1370
|
+
function on(e, t, n) {
|
|
1371
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${an[e]}</svg>`;
|
|
1313
1372
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return
|
|
1373
|
+
function U(e) {
|
|
1374
|
+
return on(e, 16, 2.5);
|
|
1316
1375
|
}
|
|
1317
|
-
function
|
|
1318
|
-
return
|
|
1376
|
+
function sn(e) {
|
|
1377
|
+
return on(e, 20, 2);
|
|
1319
1378
|
}
|
|
1320
1379
|
//#endregion
|
|
1321
1380
|
//#region src/palette/CmPaletteProvider.ts
|
|
1322
|
-
var
|
|
1323
|
-
function
|
|
1381
|
+
var cn = "tools", ln = "cm-1-contexts", un = 24;
|
|
1382
|
+
function dn(e, t) {
|
|
1324
1383
|
return `<div class="entry cm-palette-entry"${t ? " draggable=\"true\"" : ""}>${e}</div>`;
|
|
1325
1384
|
}
|
|
1326
|
-
function
|
|
1385
|
+
function fn(e) {
|
|
1327
1386
|
return e.charAt(0) + e.slice(1).toLowerCase();
|
|
1328
1387
|
}
|
|
1329
|
-
function
|
|
1388
|
+
function pn(e) {
|
|
1330
1389
|
return e.type === "click" && e.detail === 0;
|
|
1331
1390
|
}
|
|
1332
|
-
var
|
|
1391
|
+
var mn = class {
|
|
1333
1392
|
create;
|
|
1334
1393
|
lassoTool;
|
|
1335
1394
|
factory;
|
|
@@ -1359,20 +1418,20 @@ var an = class {
|
|
|
1359
1418
|
getPaletteEntries() {
|
|
1360
1419
|
let e = {};
|
|
1361
1420
|
e["lasso-tool"] = {
|
|
1362
|
-
group:
|
|
1421
|
+
group: cn,
|
|
1363
1422
|
title: "Lasso",
|
|
1364
|
-
html:
|
|
1423
|
+
html: dn(sn("square-dashed-mouse-pointer"), !1),
|
|
1365
1424
|
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
1366
1425
|
};
|
|
1367
1426
|
for (let t of n) {
|
|
1368
1427
|
let n = (e) => {
|
|
1369
1428
|
let n = this.factory.createNewContext(t.type, t.label);
|
|
1370
|
-
|
|
1429
|
+
pn(e) ? this.placeInFreeRect(n) : this.create.start(e, n);
|
|
1371
1430
|
};
|
|
1372
1431
|
e[`context.${t.type}`] = {
|
|
1373
|
-
group:
|
|
1374
|
-
title:
|
|
1375
|
-
html:
|
|
1432
|
+
group: ln,
|
|
1433
|
+
title: fn(t.label),
|
|
1434
|
+
html: dn(B(t.type), !0),
|
|
1376
1435
|
action: {
|
|
1377
1436
|
dragstart: n,
|
|
1378
1437
|
click: n
|
|
@@ -1386,11 +1445,11 @@ var an = class {
|
|
|
1386
1445
|
let t = this.config?.freeRectCenter?.(), n = t ? {
|
|
1387
1446
|
x: t.x,
|
|
1388
1447
|
y: t.y
|
|
1389
|
-
} : this.freeRectCentre(), r = (e) => this.elementRegistry.filter((e) =>
|
|
1448
|
+
} : this.freeRectCentre(), r = (e) => this.elementRegistry.filter((e) => w(e)).some((t) => {
|
|
1390
1449
|
let n = t;
|
|
1391
1450
|
return Math.abs(n.x + n.width / 2 - e.x) < 1 && Math.abs(n.y + n.height / 2 - e.y) < 1;
|
|
1392
1451
|
});
|
|
1393
|
-
for (; r(n);) n.x +=
|
|
1452
|
+
for (; r(n);) n.x += un, n.y += un;
|
|
1394
1453
|
let i = this.modeling.createShape(e, n, this.canvas.getRootElement());
|
|
1395
1454
|
this.selection.select(i), this.canvas.focus(), this.labelEditing.activate(i);
|
|
1396
1455
|
}
|
|
@@ -1406,37 +1465,37 @@ var an = class {
|
|
|
1406
1465
|
y: e.y + (t.top + r / 2) / e.scale
|
|
1407
1466
|
};
|
|
1408
1467
|
}
|
|
1409
|
-
},
|
|
1468
|
+
}, hn = {
|
|
1410
1469
|
__depends__: [
|
|
1411
1470
|
be,
|
|
1412
1471
|
xe,
|
|
1413
|
-
C,
|
|
1414
1472
|
Se,
|
|
1473
|
+
Ce,
|
|
1415
1474
|
S,
|
|
1416
1475
|
x,
|
|
1417
|
-
|
|
1418
|
-
|
|
1476
|
+
R,
|
|
1477
|
+
L
|
|
1419
1478
|
],
|
|
1420
1479
|
__init__: ["cmPaletteProvider"],
|
|
1421
|
-
cmPaletteProvider: ["type",
|
|
1422
|
-
},
|
|
1480
|
+
cmPaletteProvider: ["type", mn]
|
|
1481
|
+
}, W = "cm-subdomain-menu", gn = "cm-pattern-menu", G = "cm-roles-menu", K = "cm-popup-active", q = 8, _n = {
|
|
1423
1482
|
OHS: "Open Host Service is one-size-fits-all and not applicable in a customer-supplier relationship.",
|
|
1424
1483
|
CF: "Conformist is not applicable in a customer-supplier relationship — a customer can negotiate."
|
|
1425
1484
|
};
|
|
1426
|
-
function
|
|
1485
|
+
function vn(e) {
|
|
1427
1486
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1428
1487
|
}
|
|
1429
1488
|
function J(e, t, n = {}) {
|
|
1430
|
-
let r = n.draggable ? " draggable=\"true\"" : "", i = n.danger ? " cm-pad-entry--danger" : "", a =
|
|
1489
|
+
let r = n.draggable ? " draggable=\"true\"" : "", i = n.danger ? " cm-pad-entry--danger" : "", a = vn(t);
|
|
1431
1490
|
return `<div class="entry cm-pad-entry${i}"${r} title="${a}" aria-label="${a}">${e}</div>`;
|
|
1432
1491
|
}
|
|
1433
|
-
function
|
|
1492
|
+
function yn(e, t) {
|
|
1434
1493
|
let n = t.getBoundingClientRect();
|
|
1435
1494
|
e.style.left = `${n.right + q}px`, e.style.top = `${n.top}px`;
|
|
1436
1495
|
let r = e.getBoundingClientRect();
|
|
1437
1496
|
r.right > window.innerWidth - 8 && (e.style.left = `${Math.max(8, n.left - r.width - q)}px`), r.bottom > window.innerHeight - 8 && (e.style.top = `${Math.max(8, window.innerHeight - 8 - r.height)}px`);
|
|
1438
1497
|
}
|
|
1439
|
-
var
|
|
1498
|
+
var bn = class {
|
|
1440
1499
|
contextPad;
|
|
1441
1500
|
popupMenu;
|
|
1442
1501
|
eventBus;
|
|
@@ -1472,19 +1531,19 @@ var fn = class {
|
|
|
1472
1531
|
];
|
|
1473
1532
|
currentMenu;
|
|
1474
1533
|
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
1475
|
-
this.contextPad = e, this.popupMenu = t, this.eventBus = n, this.create = i, this.autoPlace = a, this.rules = o, this.dragging = s, this.modeling = c, this.cmModeling = l, this.labelEditing = u, this.elementFactory = d, this.selection = f, this.canvas = p, this.scheduler = m, this.readOnly = h, e.registerProvider(this), n.on("contextPad.open.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), n.on(
|
|
1534
|
+
this.contextPad = e, this.popupMenu = t, this.eventBus = n, this.create = i, this.autoPlace = a, this.rules = o, this.dragging = s, this.modeling = c, this.cmModeling = l, this.labelEditing = u, this.elementFactory = d, this.selection = f, this.canvas = p, this.scheduler = m, this.readOnly = h, e.registerProvider(this), n.on("contextPad.open.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), n.on(I, (n) => {
|
|
1476
1535
|
if (n.readOnly) {
|
|
1477
1536
|
this.cancelPrompt(), t.close(), e.close();
|
|
1478
1537
|
return;
|
|
1479
1538
|
}
|
|
1480
1539
|
let r = f.get();
|
|
1481
1540
|
r.length === 1 ? e.open(r[0], !0) : r.length > 1 && e.open(r, !0);
|
|
1482
|
-
}), t.registerProvider(
|
|
1541
|
+
}), t.registerProvider(W, { getPopupMenuEntries: (e) => this.subdomainMenuEntries(e) }), t.registerProvider(gn, { getPopupMenuEntries: (e) => this.patternMenuEntries(e) }), t.registerProvider(G, { getPopupMenuEntries: (e) => this.rolesMenuEntries(e) }), n.on("autoPlace", (e) => {
|
|
1483
1542
|
let { source: t, shape: n } = e, r = {
|
|
1484
|
-
x: ce(t).right +
|
|
1543
|
+
x: ce(t).right + Oe + n.width / 2,
|
|
1485
1544
|
y: _(t).y
|
|
1486
1545
|
};
|
|
1487
|
-
return
|
|
1546
|
+
return ke(t, n, r, Ae({ y: {
|
|
1488
1547
|
margin: 30,
|
|
1489
1548
|
minDistance: 30
|
|
1490
1549
|
} }));
|
|
@@ -1492,7 +1551,7 @@ var fn = class {
|
|
|
1492
1551
|
let { pad: t, target: n } = e;
|
|
1493
1552
|
if (!t) return;
|
|
1494
1553
|
let r = !1, i = !1;
|
|
1495
|
-
if (
|
|
1554
|
+
if (T(n)) {
|
|
1496
1555
|
let e = n.waypoints ?? [], t = e[e.length - 1], a = e[e.length - 2];
|
|
1497
1556
|
if (t && a) {
|
|
1498
1557
|
let e = t.x - a.x, n = t.y - a.y;
|
|
@@ -1521,11 +1580,11 @@ var fn = class {
|
|
|
1521
1580
|
}, "cmContextPad#clampIntoView");
|
|
1522
1581
|
}
|
|
1523
1582
|
getContextPadEntries(e) {
|
|
1524
|
-
return this.readOnly.isReadOnly() ? {} :
|
|
1583
|
+
return this.readOnly.isReadOnly() ? {} : w(e) ? this.contextEntries(e) : T(e) ? this.relationshipEntries(e) : {};
|
|
1525
1584
|
}
|
|
1526
1585
|
getMultiElementContextPadEntries(e) {
|
|
1527
1586
|
if (this.readOnly.isReadOnly()) return {};
|
|
1528
|
-
let t = e.filter(
|
|
1587
|
+
let t = e.filter(C);
|
|
1529
1588
|
return t.length === e.length ? { delete: this.deleteEntry(t, "Delete selection") } : {};
|
|
1530
1589
|
}
|
|
1531
1590
|
contextEntries(e) {
|
|
@@ -1533,7 +1592,7 @@ var fn = class {
|
|
|
1533
1592
|
return {
|
|
1534
1593
|
"append-context": {
|
|
1535
1594
|
group: "edit",
|
|
1536
|
-
html: J(
|
|
1595
|
+
html: J(U("square-plus"), "Append a connected context — click to place automatically, drag to position", { draggable: !0 }),
|
|
1537
1596
|
action: {
|
|
1538
1597
|
click: () => this.appendContext(e),
|
|
1539
1598
|
dragstart: (t) => this.startAppend(t, e)
|
|
@@ -1541,7 +1600,7 @@ var fn = class {
|
|
|
1541
1600
|
},
|
|
1542
1601
|
connect: {
|
|
1543
1602
|
group: "edit",
|
|
1544
|
-
html: J(
|
|
1603
|
+
html: J(U("arrow-right"), "Connect to another context", { draggable: !0 }),
|
|
1545
1604
|
action: {
|
|
1546
1605
|
click: (t) => this.startConnect(t, e, !0),
|
|
1547
1606
|
dragstart: (t) => this.startConnect(t, e, !1)
|
|
@@ -1549,12 +1608,12 @@ var fn = class {
|
|
|
1549
1608
|
},
|
|
1550
1609
|
"subdomain-type": {
|
|
1551
1610
|
group: "edit",
|
|
1552
|
-
html: J(
|
|
1553
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1611
|
+
html: J(B(e.subdomainType), `Change subdomain type — currently ${t?.label ?? "unclassified"}`),
|
|
1612
|
+
action: { click: (t) => this.openMenu(t, e, W, "Subdomain type") }
|
|
1554
1613
|
},
|
|
1555
1614
|
team: {
|
|
1556
1615
|
group: "edit",
|
|
1557
|
-
html: J(
|
|
1616
|
+
html: J(U("users"), `Set owning team — currently ${e.team ?? "none"}`),
|
|
1558
1617
|
action: { click: () => this.labelEditing.activateTeam(e) }
|
|
1559
1618
|
},
|
|
1560
1619
|
"edit-label": this.editLabelEntry(e, "Rename context"),
|
|
@@ -1603,36 +1662,36 @@ var fn = class {
|
|
|
1603
1662
|
this.scheduler.schedule(() => {
|
|
1604
1663
|
if (!this.contextPad.isOpen(e)) return;
|
|
1605
1664
|
let t = this.canvas.getContainer().querySelector(".djs-context-pad.open [data-action=\"subdomain-type\"]");
|
|
1606
|
-
t && this.openMenuBeside(t.getBoundingClientRect(), e,
|
|
1665
|
+
t && this.openMenuBeside(t.getBoundingClientRect(), e, W, "Subdomain type");
|
|
1607
1666
|
}, "cmContextPad#openTypeMenu");
|
|
1608
1667
|
}
|
|
1609
1668
|
relationshipEntries(e) {
|
|
1610
1669
|
let t = f[e.pattern], n = { pattern: {
|
|
1611
1670
|
group: "edit",
|
|
1612
|
-
html: J(
|
|
1613
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1671
|
+
html: J(H(t?.pattern), `Change pattern — currently ${t?.label ?? e.pattern}`),
|
|
1672
|
+
action: { click: (t) => this.openMenu(t, e, gn, "Relationship pattern") }
|
|
1614
1673
|
} };
|
|
1615
1674
|
return t && !t.symmetric && (n.roles = {
|
|
1616
1675
|
group: "edit",
|
|
1617
|
-
html: J(
|
|
1676
|
+
html: J(U("sliders-horizontal"), "Edit integration roles — OHS/PL upstream, ACL/CF downstream"),
|
|
1618
1677
|
action: { click: (t) => this.openMenu(t, e, G, "Integration roles") }
|
|
1619
1678
|
}, n["swap-ends"] = {
|
|
1620
1679
|
group: "edit",
|
|
1621
|
-
html: J(
|
|
1680
|
+
html: J(U("arrow-left-right"), "Swap ends — reverse upstream/downstream"),
|
|
1622
1681
|
action: { click: () => this.cmModeling.swapEnds(e) }
|
|
1623
1682
|
}), n["edit-label"] = this.editLabelEntry(e, "Edit label"), n.description = this.descriptionEntry(e, "What flows here, contracts, notes…"), n.delete = this.deleteEntry([e], "Delete relationship"), n;
|
|
1624
1683
|
}
|
|
1625
1684
|
editLabelEntry(e, t) {
|
|
1626
1685
|
return {
|
|
1627
1686
|
group: "edit",
|
|
1628
|
-
html: J(
|
|
1687
|
+
html: J(U("pencil"), `${t} — edit the name in place`),
|
|
1629
1688
|
action: { click: () => this.labelEditing.activate(e) }
|
|
1630
1689
|
};
|
|
1631
1690
|
}
|
|
1632
1691
|
descriptionEntry(e, t) {
|
|
1633
1692
|
return {
|
|
1634
1693
|
group: "edit",
|
|
1635
|
-
html: J(
|
|
1694
|
+
html: J(U("text-align-start"), "Edit description"),
|
|
1636
1695
|
action: { click: (n) => this.openPrompt(n, {
|
|
1637
1696
|
value: e.description ?? "",
|
|
1638
1697
|
placeholder: t,
|
|
@@ -1655,10 +1714,10 @@ var fn = class {
|
|
|
1655
1714
|
let e = document.createElement("div");
|
|
1656
1715
|
e.className = "cm-pad-prompt__hint", e.textContent = "Esc to cancel · ⌘/Ctrl+Enter to save", r.appendChild(e);
|
|
1657
1716
|
}
|
|
1658
|
-
this.canvas.getContainer().appendChild(r),
|
|
1717
|
+
this.canvas.getContainer().appendChild(r), yn(r, n), i.focus(), i instanceof HTMLTextAreaElement ? i.setSelectionRange(i.value.length, i.value.length) : i.select();
|
|
1659
1718
|
let a = () => {
|
|
1660
1719
|
this.scheduler.schedule(() => {
|
|
1661
|
-
n.isConnected &&
|
|
1720
|
+
n.isConnected && yn(r, n);
|
|
1662
1721
|
}, "cmContextPad#placePrompt");
|
|
1663
1722
|
};
|
|
1664
1723
|
this.eventBus.on("canvas.viewbox.changed", 200, a);
|
|
@@ -1677,7 +1736,7 @@ var fn = class {
|
|
|
1677
1736
|
deleteEntry(e, t) {
|
|
1678
1737
|
return {
|
|
1679
1738
|
group: "delete",
|
|
1680
|
-
html: J(
|
|
1739
|
+
html: J(U("trash"), t, { danger: !0 }),
|
|
1681
1740
|
action: { click: () => this.modeling.removeElements(e) }
|
|
1682
1741
|
};
|
|
1683
1742
|
}
|
|
@@ -1704,12 +1763,12 @@ var fn = class {
|
|
|
1704
1763
|
n && n.menuId === t && n.element === e && this.popupMenu.open(e, t, n.position, { title: n.title });
|
|
1705
1764
|
}
|
|
1706
1765
|
subdomainMenuEntries(e) {
|
|
1707
|
-
if (!
|
|
1766
|
+
if (!w(e)) return {};
|
|
1708
1767
|
let t = e.subdomainType, r = {};
|
|
1709
1768
|
for (let i of n) r[`type-${i.type}`] = {
|
|
1710
1769
|
label: i.label,
|
|
1711
1770
|
description: i.description,
|
|
1712
|
-
imageHtml:
|
|
1771
|
+
imageHtml: B(i.type),
|
|
1713
1772
|
...i.type === t ? { className: K } : {},
|
|
1714
1773
|
action: () => {
|
|
1715
1774
|
i.type !== t && this.cmModeling.setSubdomainType(e, i.type);
|
|
@@ -1718,7 +1777,7 @@ var fn = class {
|
|
|
1718
1777
|
return r["type-none"] = {
|
|
1719
1778
|
label: "Unclassified",
|
|
1720
1779
|
description: "No subdomain classification.",
|
|
1721
|
-
imageHtml:
|
|
1780
|
+
imageHtml: B(),
|
|
1722
1781
|
...t === void 0 ? { className: K } : {},
|
|
1723
1782
|
action: () => {
|
|
1724
1783
|
t !== void 0 && this.cmModeling.setSubdomainType(e, void 0);
|
|
@@ -1726,12 +1785,12 @@ var fn = class {
|
|
|
1726
1785
|
}, r;
|
|
1727
1786
|
}
|
|
1728
1787
|
patternMenuEntries(e) {
|
|
1729
|
-
if (!
|
|
1788
|
+
if (!T(e)) return {};
|
|
1730
1789
|
let n = e.pattern, r = {};
|
|
1731
1790
|
for (let i of t) r[`pattern-${i.pattern}`] = {
|
|
1732
1791
|
label: i.label,
|
|
1733
1792
|
description: i.description,
|
|
1734
|
-
imageHtml:
|
|
1793
|
+
imageHtml: H(i.pattern),
|
|
1735
1794
|
...i.pattern === n ? { className: K } : {},
|
|
1736
1795
|
action: () => {
|
|
1737
1796
|
i.pattern !== n && this.cmModeling.setPattern(e, i.pattern);
|
|
@@ -1740,16 +1799,16 @@ var fn = class {
|
|
|
1740
1799
|
return r;
|
|
1741
1800
|
}
|
|
1742
1801
|
rolesMenuEntries(e) {
|
|
1743
|
-
if (!
|
|
1802
|
+
if (!T(e)) return {};
|
|
1744
1803
|
let t = f[e.pattern];
|
|
1745
1804
|
if (!t || t.symmetric) return {};
|
|
1746
1805
|
let n = e.pattern === "customer-supplier", r = e.upstreamRoles ?? [], i = e.downstreamRoles ?? [], a = {};
|
|
1747
1806
|
for (let t of m) {
|
|
1748
|
-
let i = r.includes(t), o = n ?
|
|
1807
|
+
let i = r.includes(t), o = n ? _n[t] : void 0, s = o !== void 0 && !i;
|
|
1749
1808
|
a[`upstream-${t}`] = {
|
|
1750
1809
|
label: h[t].label,
|
|
1751
1810
|
description: o ? i ? `${o} Click to remove it.` : o : h[t].description,
|
|
1752
|
-
imageHtml:
|
|
1811
|
+
imageHtml: V(t),
|
|
1753
1812
|
group: {
|
|
1754
1813
|
id: "upstream",
|
|
1755
1814
|
name: "Upstream (from) — OHS and/or PL"
|
|
@@ -1762,11 +1821,11 @@ var fn = class {
|
|
|
1762
1821
|
};
|
|
1763
1822
|
}
|
|
1764
1823
|
for (let t of s) {
|
|
1765
|
-
let r = i.includes(t), o = n ?
|
|
1824
|
+
let r = i.includes(t), o = n ? _n[t] : void 0, s = o !== void 0 && !r;
|
|
1766
1825
|
a[`downstream-${t}`] = {
|
|
1767
1826
|
label: c[t].label,
|
|
1768
1827
|
description: o ? r ? `${o} Click to remove it.` : o : c[t].description,
|
|
1769
|
-
imageHtml:
|
|
1828
|
+
imageHtml: V(t),
|
|
1770
1829
|
group: {
|
|
1771
1830
|
id: "downstream",
|
|
1772
1831
|
name: "Downstream (to) — ACL or CF, not both"
|
|
@@ -1780,35 +1839,35 @@ var fn = class {
|
|
|
1780
1839
|
}
|
|
1781
1840
|
return a;
|
|
1782
1841
|
}
|
|
1783
|
-
},
|
|
1842
|
+
}, xn = {
|
|
1784
1843
|
__depends__: [
|
|
1785
|
-
we,
|
|
1786
1844
|
Te,
|
|
1787
|
-
C,
|
|
1788
|
-
xe,
|
|
1789
1845
|
Ee,
|
|
1846
|
+
Se,
|
|
1847
|
+
xe,
|
|
1848
|
+
De,
|
|
1790
1849
|
x,
|
|
1791
1850
|
S,
|
|
1851
|
+
P,
|
|
1792
1852
|
F,
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
R
|
|
1853
|
+
R,
|
|
1854
|
+
L
|
|
1796
1855
|
],
|
|
1797
1856
|
__init__: ["cmContextPadProvider"],
|
|
1798
|
-
cmContextPadProvider: ["type",
|
|
1857
|
+
cmContextPadProvider: ["type", bn]
|
|
1799
1858
|
};
|
|
1800
1859
|
//#endregion
|
|
1801
1860
|
//#region src/keyboard/CmKeyboard.ts
|
|
1802
|
-
function
|
|
1861
|
+
function Sn(e) {
|
|
1803
1862
|
let t = e;
|
|
1804
1863
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
1805
1864
|
}
|
|
1806
|
-
function
|
|
1865
|
+
function Cn(e, t) {
|
|
1807
1866
|
if (!(e instanceof Node) || e instanceof Element && e.closest(".djs-palette")) return !1;
|
|
1808
1867
|
let n = t.ownerDocument;
|
|
1809
1868
|
return t.contains(e) || e === n.body || e === n.documentElement;
|
|
1810
1869
|
}
|
|
1811
|
-
var
|
|
1870
|
+
var wn = class {
|
|
1812
1871
|
static $inject = [
|
|
1813
1872
|
"config.cmKeyboard",
|
|
1814
1873
|
"canvas",
|
|
@@ -1821,10 +1880,10 @@ var gn = class {
|
|
|
1821
1880
|
];
|
|
1822
1881
|
constructor(e, t, n, r, i, a, o, s) {
|
|
1823
1882
|
let c = t.getContainer(), l = c.ownerDocument ?? document, u = e?.undoRedoKeys ?? !0, d = (e) => {
|
|
1824
|
-
if (e.defaultPrevented || !
|
|
1883
|
+
if (e.defaultPrevented || !Cn(e.target, c) || Sn(e.target)) return;
|
|
1825
1884
|
let t = e.ctrlKey || e.metaKey, o = e.key.toLowerCase();
|
|
1826
1885
|
if (t && o === "a" && !e.shiftKey && !e.altKey) {
|
|
1827
|
-
e.preventDefault(), r.select(a.filter((e) =>
|
|
1886
|
+
e.preventDefault(), r.select(a.filter((e) => C(e)));
|
|
1828
1887
|
return;
|
|
1829
1888
|
}
|
|
1830
1889
|
if (s.isReadOnly()) return;
|
|
@@ -1839,14 +1898,14 @@ var gn = class {
|
|
|
1839
1898
|
};
|
|
1840
1899
|
l.addEventListener("keydown", d), o.on("diagram.destroy", () => l.removeEventListener("keydown", d));
|
|
1841
1900
|
}
|
|
1842
|
-
},
|
|
1843
|
-
__depends__: [
|
|
1901
|
+
}, Tn = {
|
|
1902
|
+
__depends__: [L],
|
|
1844
1903
|
__init__: ["cmKeyboard"],
|
|
1845
|
-
cmKeyboard: ["type",
|
|
1846
|
-
},
|
|
1847
|
-
function
|
|
1904
|
+
cmKeyboard: ["type", wn]
|
|
1905
|
+
}, En = "cm-validation", Dn = 22, Y = 16, On = 44;
|
|
1906
|
+
function kn(e) {
|
|
1848
1907
|
let t = e.some((e) => e.kind === "error"), n = document.createElement("div");
|
|
1849
|
-
n.className = "cm-validation-marker", n.dataset.severity = t ? "error" : "warning", n.innerHTML =
|
|
1908
|
+
n.className = "cm-validation-marker", n.dataset.severity = t ? "error" : "warning", n.innerHTML = U(t ? "circle-x" : "triangle-alert");
|
|
1850
1909
|
let r = document.createElement("div");
|
|
1851
1910
|
r.className = "cm-validation-tooltip";
|
|
1852
1911
|
for (let t of e) {
|
|
@@ -1855,13 +1914,13 @@ function xn(e) {
|
|
|
1855
1914
|
}
|
|
1856
1915
|
return n.appendChild(r), n;
|
|
1857
1916
|
}
|
|
1858
|
-
function
|
|
1917
|
+
function An(e, t, n) {
|
|
1859
1918
|
let r = t[0], i = t[t.length - 1], a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || 1, c = a / s, l = o / s;
|
|
1860
1919
|
if (n === "middle") return {
|
|
1861
1920
|
x: (r.x + i.x) / 2 + -l * Y,
|
|
1862
1921
|
y: (r.y + i.y) / 2 + c * Y
|
|
1863
1922
|
};
|
|
1864
|
-
let u = e.pattern === "customer-supplier", d = n === "upstream" ?
|
|
1923
|
+
let u = e.pattern === "customer-supplier", d = n === "upstream" ? at(r, i, u ? "S" : "U", e.upstreamRoles ?? []) : at(i, r, u ? "C" : "D", e.downstreamRoles ?? []);
|
|
1865
1924
|
if (d) {
|
|
1866
1925
|
let e = {
|
|
1867
1926
|
x: d.box.x + d.box.width,
|
|
@@ -1872,7 +1931,7 @@ function Sn(e, t, n) {
|
|
|
1872
1931
|
y: e.y + 1
|
|
1873
1932
|
};
|
|
1874
1933
|
}
|
|
1875
|
-
let f = Math.min(
|
|
1934
|
+
let f = Math.min(On, s * .35), p = n === "upstream" ? r.x + c * f : i.x - c * f, m = n === "upstream" ? r.y + l * f : i.y - l * f;
|
|
1876
1935
|
return {
|
|
1877
1936
|
x: p + -l * Y,
|
|
1878
1937
|
y: m + c * Y
|
|
@@ -1880,8 +1939,8 @@ function Sn(e, t, n) {
|
|
|
1880
1939
|
}
|
|
1881
1940
|
//#endregion
|
|
1882
1941
|
//#region src/validation/index.ts
|
|
1883
|
-
var
|
|
1884
|
-
__depends__: [
|
|
1942
|
+
var jn = {
|
|
1943
|
+
__depends__: [je],
|
|
1885
1944
|
__init__: ["cmValidationMarkers"],
|
|
1886
1945
|
cmValidationMarkers: ["type", class {
|
|
1887
1946
|
elementRegistry;
|
|
@@ -1899,7 +1958,7 @@ var Cn = {
|
|
|
1899
1958
|
e.on("import.render.done", i), e.on("commandStack.changed", i);
|
|
1900
1959
|
}
|
|
1901
1960
|
refresh() {
|
|
1902
|
-
this.overlays.remove({ type:
|
|
1961
|
+
this.overlays.remove({ type: En });
|
|
1903
1962
|
let e = ae(this.exporter.export()), t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
1904
1963
|
for (let r of e) {
|
|
1905
1964
|
if (!r.relationshipId) continue;
|
|
@@ -1916,16 +1975,16 @@ var Cn = {
|
|
|
1916
1975
|
n(e.errors, "error"), n(e.warnings, "warning");
|
|
1917
1976
|
for (let [e, n] of t) {
|
|
1918
1977
|
let t = this.elementRegistry.get(n.relationshipId);
|
|
1919
|
-
if (!
|
|
1978
|
+
if (!T(t)) continue;
|
|
1920
1979
|
let r = t.waypoints ?? [];
|
|
1921
1980
|
if (r.length < 2) continue;
|
|
1922
|
-
let i = e.split(" ")[1], { x: a, y: o } =
|
|
1923
|
-
this.overlays.add(t,
|
|
1981
|
+
let i = e.split(" ")[1], { x: a, y: o } = An(t, r, i), s = Math.min(...r.map((e) => e.x)), c = Math.min(...r.map((e) => e.y));
|
|
1982
|
+
this.overlays.add(t, En, {
|
|
1924
1983
|
position: {
|
|
1925
|
-
left: a - s -
|
|
1926
|
-
top: o - c -
|
|
1984
|
+
left: a - s - Dn / 2,
|
|
1985
|
+
top: o - c - Dn / 2
|
|
1927
1986
|
},
|
|
1928
|
-
html:
|
|
1987
|
+
html: kn(n.findings)
|
|
1929
1988
|
});
|
|
1930
1989
|
}
|
|
1931
1990
|
}
|
|
@@ -1933,10 +1992,10 @@ var Cn = {
|
|
|
1933
1992
|
};
|
|
1934
1993
|
//#endregion
|
|
1935
1994
|
//#region src/zorder/CmZOrder.ts
|
|
1936
|
-
function
|
|
1937
|
-
return +!
|
|
1995
|
+
function Mn(e) {
|
|
1996
|
+
return +!T(e);
|
|
1938
1997
|
}
|
|
1939
|
-
var
|
|
1998
|
+
var Nn = class {
|
|
1940
1999
|
canvas;
|
|
1941
2000
|
elementRegistry;
|
|
1942
2001
|
static $inject = [
|
|
@@ -1955,16 +2014,16 @@ var Tn = class {
|
|
|
1955
2014
|
});
|
|
1956
2015
|
}
|
|
1957
2016
|
reorder() {
|
|
1958
|
-
let e = this.elementRegistry.getAll().filter(
|
|
2017
|
+
let e = this.elementRegistry.getAll().filter(C).sort((e, t) => Mn(e) - Mn(t));
|
|
1959
2018
|
for (let t of e) {
|
|
1960
2019
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
1961
2020
|
e && n && n.appendChild(e);
|
|
1962
2021
|
}
|
|
1963
2022
|
}
|
|
1964
|
-
},
|
|
2023
|
+
}, Pn = {
|
|
1965
2024
|
__init__: ["cmZOrder"],
|
|
1966
|
-
cmZOrder: ["type",
|
|
1967
|
-
},
|
|
2025
|
+
cmZOrder: ["type", Nn]
|
|
2026
|
+
}, Fn = class extends Ot {
|
|
1968
2027
|
_getModules() {
|
|
1969
2028
|
return [
|
|
1970
2029
|
...super._getModules(),
|
|
@@ -1972,16 +2031,16 @@ var Tn = class {
|
|
|
1972
2031
|
S,
|
|
1973
2032
|
me,
|
|
1974
2033
|
he,
|
|
1975
|
-
|
|
2034
|
+
L,
|
|
2035
|
+
P,
|
|
1976
2036
|
F,
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
En
|
|
2037
|
+
Gt,
|
|
2038
|
+
hn,
|
|
2039
|
+
xn,
|
|
2040
|
+
R,
|
|
2041
|
+
Tn,
|
|
2042
|
+
jn,
|
|
2043
|
+
Pn
|
|
1985
2044
|
];
|
|
1986
2045
|
}
|
|
1987
2046
|
undo() {
|
|
@@ -1996,17 +2055,17 @@ var Tn = class {
|
|
|
1996
2055
|
canRedo() {
|
|
1997
2056
|
return this.get("commandStack").canRedo();
|
|
1998
2057
|
}
|
|
1999
|
-
},
|
|
2000
|
-
function
|
|
2001
|
-
return
|
|
2002
|
-
...
|
|
2058
|
+
}, In = "context-maps";
|
|
2059
|
+
function Ln(e = {}) {
|
|
2060
|
+
return Bn(new Fn({
|
|
2061
|
+
...zn(e),
|
|
2003
2062
|
undoRedoKeys: e.undoRedoKeys ?? !0
|
|
2004
2063
|
}), !0);
|
|
2005
2064
|
}
|
|
2006
|
-
function
|
|
2007
|
-
return
|
|
2065
|
+
function Rn(e = {}) {
|
|
2066
|
+
return Bn(new Ot(zn(e)), !1);
|
|
2008
2067
|
}
|
|
2009
|
-
function
|
|
2068
|
+
function zn(e) {
|
|
2010
2069
|
return {
|
|
2011
2070
|
width: "100%",
|
|
2012
2071
|
height: "100%",
|
|
@@ -2016,10 +2075,10 @@ function jn(e) {
|
|
|
2016
2075
|
fitOnImport: e.fitOnImport
|
|
2017
2076
|
};
|
|
2018
2077
|
}
|
|
2019
|
-
function
|
|
2078
|
+
function Bn(e, t) {
|
|
2020
2079
|
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = /* @__PURE__ */ new Set(), s = !1, c = "", l = {
|
|
2021
|
-
notation:
|
|
2022
|
-
apiVersion:
|
|
2080
|
+
notation: In,
|
|
2081
|
+
apiVersion: Me,
|
|
2023
2082
|
editable: t
|
|
2024
2083
|
};
|
|
2025
2084
|
return t && n.on("commandStack.changed", () => {
|
|
@@ -2027,20 +2086,20 @@ function Mn(e, t) {
|
|
|
2027
2086
|
}), {
|
|
2028
2087
|
meta: l,
|
|
2029
2088
|
elements: {
|
|
2030
|
-
list: () => s ? [] : i.getAll().filter(
|
|
2089
|
+
list: () => s ? [] : i.getAll().filter(C).map(Un),
|
|
2031
2090
|
bounds(e) {
|
|
2032
2091
|
if (s) return;
|
|
2033
2092
|
let t = i.get(e);
|
|
2034
|
-
return
|
|
2093
|
+
return C(t) ? Hn(t) : void 0;
|
|
2035
2094
|
},
|
|
2036
2095
|
reveal(e) {
|
|
2037
2096
|
if (s) return !1;
|
|
2038
2097
|
let t = i.get(e);
|
|
2039
|
-
return
|
|
2098
|
+
return C(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
2040
2099
|
},
|
|
2041
|
-
selection: () => s ? [] :
|
|
2100
|
+
selection: () => s ? [] : Vn(a.get()),
|
|
2042
2101
|
onSelection(e) {
|
|
2043
|
-
let t = (t) => e(
|
|
2102
|
+
let t = (t) => e(Vn(t.newSelection ?? []));
|
|
2044
2103
|
return n.on("selection.changed", t), () => n.off("selection.changed", t);
|
|
2045
2104
|
}
|
|
2046
2105
|
},
|
|
@@ -2067,19 +2126,20 @@ function Mn(e, t) {
|
|
|
2067
2126
|
width: n,
|
|
2068
2127
|
height: i
|
|
2069
2128
|
};
|
|
2070
|
-
return
|
|
2129
|
+
return Wn(a) ? a : void 0;
|
|
2071
2130
|
} catch {
|
|
2072
2131
|
return;
|
|
2073
2132
|
}
|
|
2074
2133
|
},
|
|
2075
2134
|
setViewState(e) {
|
|
2076
|
-
!s &&
|
|
2135
|
+
!s && Wn(e) && r.viewbox({
|
|
2077
2136
|
x: e.x,
|
|
2078
2137
|
y: e.y,
|
|
2079
2138
|
width: e.width,
|
|
2080
2139
|
height: e.height
|
|
2081
2140
|
});
|
|
2082
2141
|
},
|
|
2142
|
+
contentBounds: () => s ? void 0 : e.contentBounds(),
|
|
2083
2143
|
destroy() {
|
|
2084
2144
|
if (!s) {
|
|
2085
2145
|
try {
|
|
@@ -2092,11 +2152,11 @@ function Mn(e, t) {
|
|
|
2092
2152
|
}
|
|
2093
2153
|
};
|
|
2094
2154
|
}
|
|
2095
|
-
function
|
|
2096
|
-
return e.filter(
|
|
2155
|
+
function Vn(e) {
|
|
2156
|
+
return e.filter(C).map((e) => e.id);
|
|
2097
2157
|
}
|
|
2098
|
-
function
|
|
2099
|
-
let { x: t, y: n, width: r, height: i } =
|
|
2158
|
+
function Hn(e) {
|
|
2159
|
+
let { x: t, y: n, width: r, height: i } = Ne(e);
|
|
2100
2160
|
return {
|
|
2101
2161
|
x: t,
|
|
2102
2162
|
y: n,
|
|
@@ -2104,13 +2164,13 @@ function Pn(e) {
|
|
|
2104
2164
|
height: i
|
|
2105
2165
|
};
|
|
2106
2166
|
}
|
|
2107
|
-
function
|
|
2167
|
+
function Un(e) {
|
|
2108
2168
|
return e.cmLabel ? {
|
|
2109
2169
|
id: e.id,
|
|
2110
2170
|
name: e.cmLabel
|
|
2111
2171
|
} : { id: e.id };
|
|
2112
2172
|
}
|
|
2113
|
-
function
|
|
2173
|
+
function Wn(e) {
|
|
2114
2174
|
if (typeof e != "object" || !e) return !1;
|
|
2115
2175
|
let { x: t, y: n, width: r, height: i } = e;
|
|
2116
2176
|
return X(t) && X(n) && X(r) && X(i) && r > 0 && i > 0;
|
|
@@ -2120,7 +2180,7 @@ function X(e) {
|
|
|
2120
2180
|
}
|
|
2121
2181
|
//#endregion
|
|
2122
2182
|
//#region src/connect-handles/CmConnectHandles.ts
|
|
2123
|
-
var
|
|
2183
|
+
var Gn = "cm-connect-handle", Kn = 28, qn = 12, Jn = [
|
|
2124
2184
|
{
|
|
2125
2185
|
side: "top",
|
|
2126
2186
|
rotationDeg: -90
|
|
@@ -2138,15 +2198,15 @@ var Ln = "cm-connect-handle", Rn = 28, zn = 12, Bn = [
|
|
|
2138
2198
|
rotationDeg: 180
|
|
2139
2199
|
}
|
|
2140
2200
|
];
|
|
2141
|
-
function
|
|
2142
|
-
let n = t.width / 2 -
|
|
2201
|
+
function Yn(e, t) {
|
|
2202
|
+
let n = t.width / 2 - Kn / 2, r = t.height / 2 - Kn / 2;
|
|
2143
2203
|
switch (e) {
|
|
2144
2204
|
case "top": return {
|
|
2145
2205
|
top: -40,
|
|
2146
2206
|
left: n
|
|
2147
2207
|
};
|
|
2148
2208
|
case "bottom": return {
|
|
2149
|
-
top: t.height +
|
|
2209
|
+
top: t.height + qn,
|
|
2150
2210
|
left: n
|
|
2151
2211
|
};
|
|
2152
2212
|
case "left": return {
|
|
@@ -2155,11 +2215,11 @@ function Vn(e, t) {
|
|
|
2155
2215
|
};
|
|
2156
2216
|
case "right": return {
|
|
2157
2217
|
top: r,
|
|
2158
|
-
left: t.width +
|
|
2218
|
+
left: t.width + qn
|
|
2159
2219
|
};
|
|
2160
2220
|
}
|
|
2161
2221
|
}
|
|
2162
|
-
var
|
|
2222
|
+
var Xn = class {
|
|
2163
2223
|
eventBus;
|
|
2164
2224
|
selection;
|
|
2165
2225
|
overlays;
|
|
@@ -2176,20 +2236,20 @@ var Hn = class {
|
|
|
2176
2236
|
constructor(e, t, n, r, i, a) {
|
|
2177
2237
|
this.eventBus = e, this.selection = t, this.overlays = n, this.dragging = i, this.readOnly = a;
|
|
2178
2238
|
let o = () => this.refresh();
|
|
2179
|
-
e.on("selection.changed", o), e.on("commandStack.changed", o), e.on(
|
|
2239
|
+
e.on("selection.changed", o), e.on("commandStack.changed", o), e.on(I, o);
|
|
2180
2240
|
}
|
|
2181
2241
|
refresh() {
|
|
2182
|
-
if (this.overlays.remove({ type:
|
|
2242
|
+
if (this.overlays.remove({ type: Gn }), this.readOnly.isReadOnly()) return;
|
|
2183
2243
|
let e = this.selection.get();
|
|
2184
2244
|
if (e.length !== 1) return;
|
|
2185
2245
|
let t = e[0];
|
|
2186
|
-
if (!
|
|
2246
|
+
if (!w(t)) return;
|
|
2187
2247
|
let n = t;
|
|
2188
|
-
for (let { side: e, rotationDeg: r } of
|
|
2248
|
+
for (let { side: e, rotationDeg: r } of Jn) {
|
|
2189
2249
|
let i = document.createElement("div");
|
|
2190
2250
|
i.className = "cm-connect-handle", i.dataset.side = e, i.title = "Connect to another context", i.setAttribute("aria-label", "Connect to another context");
|
|
2191
2251
|
let a = document.createElement("span");
|
|
2192
|
-
a.className = "cm-connect-handle__arrow", a.style.transform = `rotate(${r}deg)`, a.innerHTML =
|
|
2252
|
+
a.className = "cm-connect-handle__arrow", a.style.transform = `rotate(${r}deg)`, a.innerHTML = U("arrow-right"), i.append(a), i.addEventListener("mousedown", (e) => {
|
|
2193
2253
|
e.button === 0 && (e.preventDefault(), e.stopPropagation(), this.dragging.init(e, "connect", {
|
|
2194
2254
|
autoActivate: !1,
|
|
2195
2255
|
trapClick: !1,
|
|
@@ -2203,22 +2263,22 @@ var Hn = class {
|
|
|
2203
2263
|
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
2204
2264
|
this.selection.get().length === 0 && this.selection.select(t);
|
|
2205
2265
|
}));
|
|
2206
|
-
}), this.overlays.add(t,
|
|
2207
|
-
position:
|
|
2266
|
+
}), this.overlays.add(t, Gn, {
|
|
2267
|
+
position: Yn(e, n),
|
|
2208
2268
|
html: i
|
|
2209
2269
|
});
|
|
2210
2270
|
}
|
|
2211
2271
|
}
|
|
2212
|
-
},
|
|
2272
|
+
}, Zn = {
|
|
2213
2273
|
__depends__: [
|
|
2214
|
-
|
|
2215
|
-
|
|
2274
|
+
Se,
|
|
2275
|
+
je,
|
|
2216
2276
|
x,
|
|
2217
|
-
|
|
2277
|
+
L
|
|
2218
2278
|
],
|
|
2219
2279
|
__init__: ["cmConnectHandles"],
|
|
2220
|
-
cmConnectHandles: ["type",
|
|
2221
|
-
},
|
|
2280
|
+
cmConnectHandles: ["type", Xn]
|
|
2281
|
+
}, Qn = [
|
|
2222
2282
|
{
|
|
2223
2283
|
token: "OHS",
|
|
2224
2284
|
...h.OHS
|
|
@@ -2236,20 +2296,20 @@ var Hn = class {
|
|
|
2236
2296
|
...c.CF
|
|
2237
2297
|
}
|
|
2238
2298
|
];
|
|
2239
|
-
function
|
|
2299
|
+
function $n() {
|
|
2240
2300
|
return [
|
|
2241
2301
|
{
|
|
2242
2302
|
label: "Subdomain types",
|
|
2243
2303
|
rows: n.map((e) => ({
|
|
2244
|
-
preview:
|
|
2304
|
+
preview: B(e.type),
|
|
2245
2305
|
label: e.label,
|
|
2246
2306
|
explanation: e.description
|
|
2247
2307
|
}))
|
|
2248
2308
|
},
|
|
2249
2309
|
{
|
|
2250
2310
|
label: "Integration roles",
|
|
2251
|
-
rows:
|
|
2252
|
-
preview:
|
|
2311
|
+
rows: Qn.map((e) => ({
|
|
2312
|
+
preview: V(e.token),
|
|
2253
2313
|
label: `${e.token} · ${e.label}`,
|
|
2254
2314
|
explanation: e.description
|
|
2255
2315
|
}))
|
|
@@ -2257,16 +2317,16 @@ function Gn() {
|
|
|
2257
2317
|
{
|
|
2258
2318
|
label: "Relationship patterns",
|
|
2259
2319
|
rows: t.map((e) => ({
|
|
2260
|
-
preview:
|
|
2320
|
+
preview: H(e.pattern),
|
|
2261
2321
|
label: `${e.abbreviation} · ${e.label}`,
|
|
2262
2322
|
explanation: e.description
|
|
2263
2323
|
}))
|
|
2264
2324
|
}
|
|
2265
2325
|
];
|
|
2266
2326
|
}
|
|
2267
|
-
function
|
|
2327
|
+
function er(e, t = {}) {
|
|
2268
2328
|
let n = [];
|
|
2269
|
-
return
|
|
2329
|
+
return $n().forEach((r, i) => {
|
|
2270
2330
|
if (i > 0) {
|
|
2271
2331
|
let t = document.createElement("div");
|
|
2272
2332
|
t.className = "cd-shell-legend-separator", t.setAttribute("role", "separator"), e.append(t);
|
|
@@ -2293,7 +2353,7 @@ function Kn(e, t = {}) {
|
|
|
2293
2353
|
}
|
|
2294
2354
|
//#endregion
|
|
2295
2355
|
//#region src/legend/CmLegend.ts
|
|
2296
|
-
function
|
|
2356
|
+
function tr(e) {
|
|
2297
2357
|
let t = document.createElement("div");
|
|
2298
2358
|
t.className = "cm-legend__row cm-legend-item";
|
|
2299
2359
|
let n = document.createElement("span");
|
|
@@ -2306,26 +2366,41 @@ function qn(e) {
|
|
|
2306
2366
|
i.style.left = `${e.right + 10}px`, i.style.top = `${e.top + e.height / 2}px`;
|
|
2307
2367
|
}), t.append(n, r, i), t;
|
|
2308
2368
|
}
|
|
2309
|
-
function
|
|
2369
|
+
function nr(e, t) {
|
|
2310
2370
|
let n = document.createElement("div");
|
|
2311
2371
|
return n.className = "cm-legend__group", n.setAttribute("role", "group"), n.setAttribute("aria-label", e), n.append(...t), n;
|
|
2312
2372
|
}
|
|
2313
|
-
function
|
|
2373
|
+
function rr() {
|
|
2314
2374
|
let e = document.createElement("div");
|
|
2315
2375
|
return e.className = "cm-legend__divider", e;
|
|
2316
2376
|
}
|
|
2317
|
-
|
|
2377
|
+
function ir(e, t) {
|
|
2378
|
+
return e > ze.width && t > ze.height;
|
|
2379
|
+
}
|
|
2380
|
+
var ar = class {
|
|
2381
|
+
canvas;
|
|
2318
2382
|
static $inject = ["canvas", "eventBus"];
|
|
2319
|
-
openState = !
|
|
2383
|
+
openState = !1;
|
|
2384
|
+
started = !1;
|
|
2320
2385
|
host;
|
|
2321
2386
|
constructor(e, t) {
|
|
2322
|
-
this.host = document.createElement("div"), e.getContainer().appendChild(this.host), this.render(), t.on("
|
|
2387
|
+
this.canvas = e, this.host = document.createElement("div"), e.getContainer().appendChild(this.host), this.startFromContainerSize(), this.render(), t.on(["canvas.resized", "import.done"], () => {
|
|
2388
|
+
this.startFromContainerSize() && this.render();
|
|
2389
|
+
}), t.on("diagram.destroy", () => this.host.remove());
|
|
2323
2390
|
}
|
|
2324
2391
|
isOpen() {
|
|
2325
2392
|
return this.openState;
|
|
2326
2393
|
}
|
|
2327
2394
|
setOpen(e) {
|
|
2328
|
-
this.openState !== e && (this.openState = e, this.render());
|
|
2395
|
+
this.started = !0, this.openState !== e && (this.openState = e, this.render());
|
|
2396
|
+
}
|
|
2397
|
+
startFromContainerSize() {
|
|
2398
|
+
if (this.started) return !1;
|
|
2399
|
+
let { width: e, height: t } = this.canvas.getSize();
|
|
2400
|
+
if (!(e > 0 && t > 0)) return !1;
|
|
2401
|
+
this.started = !0;
|
|
2402
|
+
let n = ir(e, t);
|
|
2403
|
+
return n !== this.openState && (this.openState = n, !0);
|
|
2329
2404
|
}
|
|
2330
2405
|
toggle() {
|
|
2331
2406
|
this.setOpen(!this.openState);
|
|
@@ -2342,18 +2417,18 @@ var Xn = class {
|
|
|
2342
2417
|
let n = document.createElement("strong");
|
|
2343
2418
|
n.textContent = "Legend";
|
|
2344
2419
|
let r = document.createElement("button");
|
|
2345
|
-
r.type = "button", r.className = "cm-legend__close", r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", "Close legend"), r.innerHTML =
|
|
2346
|
-
let i =
|
|
2347
|
-
return a.className = "cm-legend__body", i.forEach((e, t) => a.append(...t > 0 ? [
|
|
2420
|
+
r.type = "button", r.className = "cm-legend__close", r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", "Close legend"), r.innerHTML = U("x"), r.addEventListener("click", () => this.toggle()), t.append(n, r);
|
|
2421
|
+
let i = $n().map((e) => nr(e.label, e.rows.map(tr))), a = document.createElement("div");
|
|
2422
|
+
return a.className = "cm-legend__body", i.forEach((e, t) => a.append(...t > 0 ? [rr()] : [], e)), e.append(t, a), e;
|
|
2348
2423
|
}
|
|
2349
2424
|
collapsedButton() {
|
|
2350
2425
|
let e = document.createElement("button");
|
|
2351
2426
|
return e.type = "button", e.className = "cm-legend-toggle", e.setAttribute("aria-expanded", "false"), e.setAttribute("aria-label", "Show legend"), e.textContent = "Legend", e.addEventListener("click", () => this.toggle()), e;
|
|
2352
2427
|
}
|
|
2353
|
-
},
|
|
2428
|
+
}, or = {
|
|
2354
2429
|
__init__: ["cmLegend"],
|
|
2355
|
-
cmLegend: ["type",
|
|
2356
|
-
},
|
|
2430
|
+
cmLegend: ["type", ar]
|
|
2431
|
+
}, sr = "Export as JSON";
|
|
2357
2432
|
function Z(e, t, n, r) {
|
|
2358
2433
|
return {
|
|
2359
2434
|
kind: "action",
|
|
@@ -2364,7 +2439,7 @@ function Z(e, t, n, r) {
|
|
|
2364
2439
|
onSelect: () => n.onSelect()
|
|
2365
2440
|
};
|
|
2366
2441
|
}
|
|
2367
|
-
function
|
|
2442
|
+
function cr(e) {
|
|
2368
2443
|
let { editTitle: t } = e;
|
|
2369
2444
|
return {
|
|
2370
2445
|
model: t ? [{
|
|
@@ -2376,7 +2451,7 @@ function $n(e) {
|
|
|
2376
2451
|
export: [
|
|
2377
2452
|
Z("export-png", "Export as PNG", e.exports.png, "file-image"),
|
|
2378
2453
|
Z("export-svg", "Export as SVG", e.exports.svg, "file-code-corner"),
|
|
2379
|
-
Z("export-json",
|
|
2454
|
+
Z("export-json", sr, e.exports.json),
|
|
2380
2455
|
Z("export-cml", "Export as CML", e.exports.cml)
|
|
2381
2456
|
],
|
|
2382
2457
|
help: [{
|
|
@@ -2390,17 +2465,17 @@ function $n(e) {
|
|
|
2390
2465
|
}
|
|
2391
2466
|
//#endregion
|
|
2392
2467
|
//#region src/chrome/shortcuts.ts
|
|
2393
|
-
function
|
|
2468
|
+
function lr(e, t, n) {
|
|
2394
2469
|
return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
|
|
2395
2470
|
}
|
|
2396
|
-
function
|
|
2471
|
+
function ur(e) {
|
|
2397
2472
|
try {
|
|
2398
2473
|
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
2399
2474
|
} catch {
|
|
2400
2475
|
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
2401
2476
|
}
|
|
2402
2477
|
}
|
|
2403
|
-
function
|
|
2478
|
+
function dr(e, t) {
|
|
2404
2479
|
if (e === "mac") return {
|
|
2405
2480
|
zoomIn: "⌘+",
|
|
2406
2481
|
zoomOut: "⌘−",
|
|
@@ -2415,7 +2490,7 @@ function nr(e, t) {
|
|
|
2415
2490
|
fit: `${r}+1`
|
|
2416
2491
|
};
|
|
2417
2492
|
}
|
|
2418
|
-
function
|
|
2493
|
+
function fr(e, t) {
|
|
2419
2494
|
if (e === "mac") return {
|
|
2420
2495
|
undo: ["⌘Z"],
|
|
2421
2496
|
redo: ["⌘⇧Z"],
|
|
@@ -2434,23 +2509,23 @@ function rr(e, t) {
|
|
|
2434
2509
|
lassoDrag: [`${r}+Drag`]
|
|
2435
2510
|
};
|
|
2436
2511
|
}
|
|
2437
|
-
function
|
|
2512
|
+
function pr(e) {
|
|
2438
2513
|
let { platform: t, messages: n } = e;
|
|
2439
2514
|
return {
|
|
2440
2515
|
title: "File",
|
|
2441
2516
|
rows: [{
|
|
2442
2517
|
action: n.openFile ?? "Open…",
|
|
2443
|
-
keys: [
|
|
2518
|
+
keys: [lr("O", t, n.keyNames)]
|
|
2444
2519
|
}, {
|
|
2445
|
-
action:
|
|
2446
|
-
keys: [
|
|
2520
|
+
action: sr,
|
|
2521
|
+
keys: [lr("S", t, n.keyNames)]
|
|
2447
2522
|
}]
|
|
2448
2523
|
};
|
|
2449
2524
|
}
|
|
2450
|
-
function
|
|
2451
|
-
let { platform: n, messages: r } = e, i =
|
|
2525
|
+
function mr(e, t = {}) {
|
|
2526
|
+
let { platform: n, messages: r } = e, i = dr(n, r.keyNames), a = fr(n, r.keyNames);
|
|
2452
2527
|
return [
|
|
2453
|
-
...t.fileKeys ? [
|
|
2528
|
+
...t.fileKeys ? [pr(e)] : [],
|
|
2454
2529
|
{
|
|
2455
2530
|
title: "View",
|
|
2456
2531
|
rows: [
|
|
@@ -2463,7 +2538,7 @@ function ar(e, t = {}) {
|
|
|
2463
2538
|
keys: [i.zoomOut]
|
|
2464
2539
|
},
|
|
2465
2540
|
{
|
|
2466
|
-
action: r.zoomToActual(
|
|
2541
|
+
action: r.zoomToActual(ur(e.lang)),
|
|
2467
2542
|
keys: [i.zoomToActual]
|
|
2468
2543
|
},
|
|
2469
2544
|
{
|
|
@@ -2527,19 +2602,19 @@ function Q(e, t, n) {
|
|
|
2527
2602
|
let r = document.createElement(e);
|
|
2528
2603
|
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
2529
2604
|
}
|
|
2530
|
-
function
|
|
2605
|
+
function hr(e, t, n) {
|
|
2531
2606
|
let r = Q("header", "cm-dialog-header"), i = Q("h3", "cm-dialog-title", t.title);
|
|
2532
2607
|
i.id = t.titleId;
|
|
2533
2608
|
let a = Q("button", "cm-dialog-close");
|
|
2534
|
-
return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML =
|
|
2609
|
+
return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML = U("x"), a.addEventListener("click", n), r.append(i, a), r;
|
|
2535
2610
|
}
|
|
2536
|
-
function
|
|
2611
|
+
function gr(e, t) {
|
|
2537
2612
|
let n;
|
|
2538
2613
|
function r() {
|
|
2539
2614
|
let n = Q("dialog", `cm-dialog ${t.className}`);
|
|
2540
2615
|
n.setAttribute("aria-labelledby", t.titleId);
|
|
2541
2616
|
let r = () => n.close(), i = Q("div", "cm-dialog-panel");
|
|
2542
|
-
return i.append(
|
|
2617
|
+
return i.append(hr(e, t, r), ...t.content(r)), n.append(i), n.addEventListener("click", (e) => {
|
|
2543
2618
|
e.target === n && n.close();
|
|
2544
2619
|
}), n.addEventListener("close", () => {
|
|
2545
2620
|
e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
|
|
@@ -2560,9 +2635,9 @@ function sr(e, t) {
|
|
|
2560
2635
|
}
|
|
2561
2636
|
//#endregion
|
|
2562
2637
|
//#region src/chrome/ShortcutsDialog.ts
|
|
2563
|
-
var $ = "cm-shortcuts",
|
|
2564
|
-
function
|
|
2565
|
-
let n = Q("section", `${$}-group`), r = `${
|
|
2638
|
+
var $ = "cm-shortcuts", _r = "cm-shortcuts-title";
|
|
2639
|
+
function vr(e, t) {
|
|
2640
|
+
let n = Q("section", `${$}-group`), r = `${_r}-group-${t}`, i = Q("h4", `${$}-group-title`, e.title);
|
|
2566
2641
|
i.id = r;
|
|
2567
2642
|
let a = Q("table", `${$}-table`);
|
|
2568
2643
|
a.setAttribute("aria-labelledby", r);
|
|
@@ -2576,29 +2651,29 @@ function lr(e, t) {
|
|
|
2576
2651
|
}
|
|
2577
2652
|
return n.append(i, a), n;
|
|
2578
2653
|
}
|
|
2579
|
-
function
|
|
2580
|
-
return
|
|
2654
|
+
function yr(e, t = {}) {
|
|
2655
|
+
return gr(e, {
|
|
2581
2656
|
className: $,
|
|
2582
|
-
titleId:
|
|
2657
|
+
titleId: _r,
|
|
2583
2658
|
title: "Keyboard shortcuts",
|
|
2584
2659
|
content() {
|
|
2585
2660
|
let n = Q("div", "cm-dialog-body cm-shortcuts-body");
|
|
2586
|
-
return n.append(...
|
|
2661
|
+
return n.append(...mr(e, t).map(vr)), [n];
|
|
2587
2662
|
}
|
|
2588
2663
|
});
|
|
2589
2664
|
}
|
|
2590
2665
|
//#endregion
|
|
2591
2666
|
//#region src/chrome/TitleDialog.ts
|
|
2592
|
-
var
|
|
2593
|
-
function
|
|
2667
|
+
var br = "cm-title-dialog", xr = "cm-title-dialog-title", Sr = "cm-title-dialog-field";
|
|
2668
|
+
function Cr(e, t) {
|
|
2594
2669
|
let n = Q("button", "cm-dialog-button", e);
|
|
2595
2670
|
return n.type = t === "primary" ? "submit" : "button", n.dataset.variant = t, n;
|
|
2596
2671
|
}
|
|
2597
|
-
function
|
|
2672
|
+
function wr(e, t) {
|
|
2598
2673
|
let n = Q("input", "cm-dialog-input");
|
|
2599
|
-
return n.id =
|
|
2600
|
-
className:
|
|
2601
|
-
titleId:
|
|
2674
|
+
return n.id = Sr, n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.autofocus = !0, gr(e, {
|
|
2675
|
+
className: br,
|
|
2676
|
+
titleId: xr,
|
|
2602
2677
|
title: "Map title",
|
|
2603
2678
|
beforeOpen() {
|
|
2604
2679
|
n.value = t.title();
|
|
@@ -2610,9 +2685,9 @@ function hr(e, t) {
|
|
|
2610
2685
|
let r = Q("form", "cm-dialog-form");
|
|
2611
2686
|
r.noValidate = !0;
|
|
2612
2687
|
let i = Q("div", "cm-dialog-body"), a = Q("label", "cm-dialog-label", "Title");
|
|
2613
|
-
a.htmlFor =
|
|
2614
|
-
let o = Q("div", "cm-dialog-footer"), s =
|
|
2615
|
-
return s.addEventListener("click", e), o.append(s,
|
|
2688
|
+
a.htmlFor = Sr, i.append(a, n);
|
|
2689
|
+
let o = Q("div", "cm-dialog-footer"), s = Cr("Cancel", "secondary");
|
|
2690
|
+
return s.addEventListener("click", e), o.append(s, Cr("Apply", "primary")), r.append(i, o), r.addEventListener("submit", (r) => {
|
|
2616
2691
|
r.preventDefault();
|
|
2617
2692
|
let i = n.value.trim();
|
|
2618
2693
|
e(), i !== t.title() && t.setTitle(i);
|
|
@@ -2621,6 +2696,6 @@ function hr(e, t) {
|
|
|
2621
2696
|
});
|
|
2622
2697
|
}
|
|
2623
2698
|
//#endregion
|
|
2624
|
-
export {
|
|
2699
|
+
export { Re as CD_TOKENS, In as CONTEXT_MAPS_NOTATION, $e as CmBaseViewer, Xn as CmConnectHandles, bn as CmContextPadProvider, tt as CmElementFactory, bt as CmExporter, Vt as CmFlatModelBehavior, Et as CmHoverTooltip, yt as CmImporter, wn as CmKeyboard, Qt as CmLabelEditing, ar as CmLegend, Lt as CmModeling, mn as CmPaletteProvider, Jt as CmReadOnly, Rt as CmRules, Nn as CmZOrder, ot as ContextMapsRenderer, sr as JSON_EXPORT_LABEL, E as MIRAGON, Fn as Modeler, Ot as NavigatedViewer, I as READ_ONLY_CHANGED_EVENT, N as ROOT_ID, St as Viewer, Gt as cmBehaviorsModule, Zn as cmConnectHandlesModule, xn as cmContextPadModule, gt as cmDrawModule, Dt as cmHoverTooltipModule, Tn as cmKeyboardModule, R as cmLabelEditingModule, or as cmLegendModule, it as cmModelModule, P as cmModelingModule, hn as cmPaletteModule, L as cmReadOnlyModule, F as cmRulesModule, Pn as cmZOrderModule, B as contextIconSvg, cr as contextMapMenu, mr as contextMapShortcuts, Ln as createCollaborativeModeler, Rn as createCollaborativeViewer, yr as createShortcutsDialog, wr as createTitleDialog, Tt as hoverTipFor, xt as ioModule, w as isCmContext, C as isCmElement, T as isCmRelationship, $n as legendGroups, H as relationshipIconSvg, er as renderLegend, V as roleChipSvg, Le as saveSVG, rn as subdomainIconSvg };
|
|
2625
2700
|
|
|
2626
2701
|
//# sourceMappingURL=index.js.map
|