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