@miragon/context-maps-renderer 0.3.0 → 0.4.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 +35 -15
- package/dist/CmBaseViewer.d.ts +16 -4
- package/dist/CmBaseViewer.d.ts.map +1 -1
- package/dist/collaborative/CollaborativeContextMaps.d.ts +11 -7
- package/dist/collaborative/CollaborativeContextMaps.d.ts.map +1 -1
- package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -1
- package/dist/index.js +357 -309
- package/dist/index.js.map +1 -1
- package/dist/io/CmImporter.d.ts +4 -3
- package/dist/io/CmImporter.d.ts.map +1 -1
- package/dist/io/types.d.ts +0 -1
- package/dist/io/types.d.ts.map +1 -1
- package/dist/label-editing/CmLabelEditing.d.ts +6 -4
- package/dist/label-editing/CmLabelEditing.d.ts.map +1 -1
- package/dist/palette/CmPaletteProvider.d.ts +3 -0
- package/dist/palette/CmPaletteProvider.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "diagram-js/lib/Diagram";
|
|
2
|
-
import { ALL_PATTERN_SPECS as t, ALL_SUBDOMAIN_SPECS as n, CONTEXT_KEYS as r, DIAGRAM_ROOT_ID as i, DOCUMENT_KEYS as a, DOCUMENT_VERSION as o, DOWNSTREAM_ROLES as s, DOWNSTREAM_ROLE_SPECS as c, MARK_COLORS as l, MARK_TEXT_COLOR as u, RELATIONSHIP_KEYS as d, RELATIONSHIP_PATTERN_SPECS as f, SUBDOMAIN_TYPE_SPECS as p, UPSTREAM_ROLES as m, UPSTREAM_ROLE_SPECS as h, foreignFields as g,
|
|
2
|
+
import { ALL_PATTERN_SPECS as t, ALL_SUBDOMAIN_SPECS as n, CONTEXT_KEYS as r, DIAGRAM_ROOT_ID as i, DOCUMENT_KEYS as a, DOCUMENT_VERSION as o, DOWNSTREAM_ROLES as s, DOWNSTREAM_ROLE_SPECS as c, MARK_COLORS as l, MARK_TEXT_COLOR as u, RELATIONSHIP_KEYS as d, RELATIONSHIP_PATTERN_SPECS as f, SUBDOMAIN_TYPE_SPECS as p, UPSTREAM_ROLES as m, UPSTREAM_ROLE_SPECS as h, foreignFields as g, isSymmetricPattern as ee, newId as te, parseDocumentText as ne, reservedIdProblem as re, serializeDocumentText as ie, validateDocument as ae } from "@miragon/context-maps-schema-model";
|
|
3
3
|
import oe from "diagram-js/lib/layout/CroppingConnectionDocking";
|
|
4
4
|
import se from "diagram-js/lib/core/ElementFactory";
|
|
5
5
|
import { asTRBL as ce, getMid as _ } from "diagram-js/lib/layout/LayoutUtil";
|
|
@@ -27,27 +27,28 @@ import Ee from "diagram-js/lib/features/auto-place";
|
|
|
27
27
|
import { DEFAULT_DISTANCE as De, findFreePosition as Oe, generateGetNextPosition as ke } from "diagram-js/lib/features/auto-place/AutoPlaceUtil";
|
|
28
28
|
import Ae from "diagram-js/lib/features/overlays";
|
|
29
29
|
import { MODELER_API_VERSION as je } from "@miragon/modeler-api";
|
|
30
|
+
import { getBBox as Me } from "diagram-js/lib/util/Elements";
|
|
30
31
|
//#region src/model/di-types.ts
|
|
31
|
-
function
|
|
32
|
+
function Ne(e) {
|
|
32
33
|
return typeof e == "object" && e ? e.cmKind : void 0;
|
|
33
34
|
}
|
|
34
35
|
function w(e) {
|
|
35
|
-
return typeof
|
|
36
|
+
return typeof Ne(e) == "string";
|
|
36
37
|
}
|
|
37
38
|
function T(e) {
|
|
38
|
-
return
|
|
39
|
+
return Ne(e) === "context";
|
|
39
40
|
}
|
|
40
41
|
function E(e) {
|
|
41
|
-
return
|
|
42
|
+
return Ne(e) === "relationship";
|
|
42
43
|
}
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/io/saveSvg.ts
|
|
45
|
-
var
|
|
46
|
+
var Pe = 40, Fe = [
|
|
46
47
|
"tabindex",
|
|
47
48
|
"role",
|
|
48
49
|
"aria-label"
|
|
49
50
|
];
|
|
50
|
-
function
|
|
51
|
+
function Ie(e, t) {
|
|
51
52
|
let n = e.getContainer().querySelector(":scope > svg");
|
|
52
53
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
53
54
|
let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
@@ -57,24 +58,24 @@ function Fe(e, t) {
|
|
|
57
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);
|
|
58
59
|
}
|
|
59
60
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
60
|
-
let s = r -
|
|
61
|
-
for (let e of
|
|
61
|
+
let s = r - Pe, c = i - Pe, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
|
|
62
|
+
for (let e of Fe) d.removeAttribute(e);
|
|
62
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)));
|
|
63
64
|
let f = d.querySelector(".viewport");
|
|
64
65
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
65
66
|
}
|
|
66
67
|
//#endregion
|
|
67
68
|
//#region src/io/types.ts
|
|
68
|
-
var D = i,
|
|
69
|
+
var D = i, Le = {
|
|
69
70
|
top: 84,
|
|
70
71
|
right: 56,
|
|
71
72
|
bottom: 56,
|
|
72
73
|
left: 56
|
|
73
|
-
},
|
|
74
|
-
function
|
|
74
|
+
}, Re = .001;
|
|
75
|
+
function ze(e) {
|
|
75
76
|
return typeof e == "number" ? `${e}px` : e;
|
|
76
77
|
}
|
|
77
|
-
var
|
|
78
|
+
var Be = class {
|
|
78
79
|
_diagram;
|
|
79
80
|
_container;
|
|
80
81
|
_options;
|
|
@@ -83,7 +84,7 @@ var ze = class {
|
|
|
83
84
|
}
|
|
84
85
|
_createContainer(e) {
|
|
85
86
|
let t = e.container ?? document.createElement("div");
|
|
86
|
-
return t.classList.add("cm-djs-container"), t.style.width =
|
|
87
|
+
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;
|
|
87
88
|
}
|
|
88
89
|
_ensureDiagram() {
|
|
89
90
|
if (!this._diagram) {
|
|
@@ -92,7 +93,10 @@ var ze = class {
|
|
|
92
93
|
canvas: { container: this._container },
|
|
93
94
|
modules: t,
|
|
94
95
|
cmKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
|
|
95
|
-
cmPalette: {
|
|
96
|
+
cmPalette: {
|
|
97
|
+
freeRectInsets: this.freeRectInsets,
|
|
98
|
+
freeRectCenter: this.freeRectCenter
|
|
99
|
+
}
|
|
96
100
|
});
|
|
97
101
|
}
|
|
98
102
|
return this._diagram;
|
|
@@ -100,7 +104,11 @@ var ze = class {
|
|
|
100
104
|
get(e) {
|
|
101
105
|
return this._ensureDiagram().get(e);
|
|
102
106
|
}
|
|
103
|
-
freeRectInsets = () =>
|
|
107
|
+
freeRectInsets = () => {
|
|
108
|
+
let { freeArea: e, freeRectInsets: t } = this._options;
|
|
109
|
+
return (e ? e.insets?.() : t?.()) ?? Le;
|
|
110
|
+
};
|
|
111
|
+
freeRectCenter = () => this._options.freeArea?.center?.();
|
|
104
112
|
_optional(e) {
|
|
105
113
|
return this._ensureDiagram().get(e, !1);
|
|
106
114
|
}
|
|
@@ -116,10 +124,10 @@ var ze = class {
|
|
|
116
124
|
let i = this._optional("cmLabelEditing");
|
|
117
125
|
i?.suspend(), this._optional("cmContextPadProvider")?.cancelPrompt(), this._optional("popupMenu")?.close(), r.clear();
|
|
118
126
|
let a = r.import(e);
|
|
119
|
-
return this._optional("commandStack")?.clear(!1), this._fit(), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
|
|
127
|
+
return this._optional("commandStack")?.clear(!1), (this._options.fitOnImport ?? !0) && this._fit(), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
|
|
120
128
|
}
|
|
121
129
|
importText(e) {
|
|
122
|
-
let t =
|
|
130
|
+
let t = ne(e);
|
|
123
131
|
if (!t.ok) throw Error(t.error);
|
|
124
132
|
return this.importDocument(t.document);
|
|
125
133
|
}
|
|
@@ -146,7 +154,7 @@ var ze = class {
|
|
|
146
154
|
return this.get("elementRegistry").get(D);
|
|
147
155
|
}
|
|
148
156
|
saveSVG() {
|
|
149
|
-
return
|
|
157
|
+
return Ie(this.get("canvas"), this.get("elementRegistry"));
|
|
150
158
|
}
|
|
151
159
|
_fit() {
|
|
152
160
|
let e = this.get("canvas"), t = this.get("elementRegistry"), n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
@@ -165,7 +173,7 @@ var ze = class {
|
|
|
165
173
|
});
|
|
166
174
|
return;
|
|
167
175
|
}
|
|
168
|
-
let c = this.freeRectInsets(), l = Math.max(o - c.left - c.right, 1), u = Math.max(s - c.top - c.bottom, 1), d = Math.max(i - n, 1), f = Math.max(a - r, 1), p = Math.max(Math.min(l / d, u / f, 1),
|
|
176
|
+
let c = this.freeRectInsets(), l = Math.max(o - c.left - c.right, 1), u = Math.max(s - c.top - c.bottom, 1), d = Math.max(i - n, 1), f = Math.max(a - r, 1), p = Math.max(Math.min(l / d, u / f, 1), Re);
|
|
169
177
|
e.viewbox({
|
|
170
178
|
x: n + d / 2 - (c.left + l / 2) / p,
|
|
171
179
|
y: r + f / 2 - (c.top + u / 2) / p,
|
|
@@ -191,11 +199,11 @@ var ze = class {
|
|
|
191
199
|
};
|
|
192
200
|
//#endregion
|
|
193
201
|
//#region src/model/CmElementFactory.ts
|
|
194
|
-
function
|
|
202
|
+
function Ve(e, t) {
|
|
195
203
|
let n = g(e, t);
|
|
196
204
|
return Object.keys(n).length > 0 ? { cmForeign: n } : {};
|
|
197
205
|
}
|
|
198
|
-
var
|
|
206
|
+
var He = class {
|
|
199
207
|
elementFactory;
|
|
200
208
|
static $inject = ["elementFactory"];
|
|
201
209
|
constructor(e) {
|
|
@@ -219,7 +227,7 @@ var Ve = class {
|
|
|
219
227
|
...e.description ? { description: e.description } : {},
|
|
220
228
|
...e.fill ? { fill: e.fill } : {},
|
|
221
229
|
...e.stroke ? { stroke: e.stroke } : {},
|
|
222
|
-
...
|
|
230
|
+
...Ve(e, r)
|
|
223
231
|
});
|
|
224
232
|
}
|
|
225
233
|
createRelationship(e, t, n, r) {
|
|
@@ -235,7 +243,7 @@ var Ve = class {
|
|
|
235
243
|
...e.label ? { cmLabel: e.label } : {},
|
|
236
244
|
...e.description ? { description: e.description } : {},
|
|
237
245
|
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
238
|
-
...
|
|
246
|
+
...Ve(e, d)
|
|
239
247
|
});
|
|
240
248
|
}
|
|
241
249
|
createNewContext(e, t) {
|
|
@@ -248,14 +256,14 @@ var Ve = class {
|
|
|
248
256
|
cmLabel: t ?? "New Context"
|
|
249
257
|
});
|
|
250
258
|
}
|
|
251
|
-
},
|
|
259
|
+
}, Ue = class extends se {
|
|
252
260
|
create(e, t) {
|
|
253
261
|
return !t?.id && (e === "shape" || e === "connection") && (t = {
|
|
254
262
|
...t,
|
|
255
|
-
id:
|
|
263
|
+
id: te(e === "shape" ? "ctx" : "rel")
|
|
256
264
|
}), super.create(e, t);
|
|
257
265
|
}
|
|
258
|
-
},
|
|
266
|
+
}, We = class {
|
|
259
267
|
docking;
|
|
260
268
|
static $inject = ["connectionDocking"];
|
|
261
269
|
constructor(e) {
|
|
@@ -265,9 +273,9 @@ var Ve = class {
|
|
|
265
273
|
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);
|
|
266
274
|
return e.waypoints = i, n && r && i.length === 2 ? this.docking.getCroppedWaypoints(e, n, r) : i;
|
|
267
275
|
}
|
|
268
|
-
},
|
|
269
|
-
elementFactory: ["type",
|
|
270
|
-
cmElementFactory: ["type",
|
|
276
|
+
}, Ge = {
|
|
277
|
+
elementFactory: ["type", Ue],
|
|
278
|
+
cmElementFactory: ["type", He],
|
|
271
279
|
connectionDocking: ["type", oe]
|
|
272
280
|
}, O = {
|
|
273
281
|
blau: "#335DE5",
|
|
@@ -283,7 +291,7 @@ var Ve = class {
|
|
|
283
291
|
danger: "#CD1839",
|
|
284
292
|
info: "#335DE5",
|
|
285
293
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
286
|
-
},
|
|
294
|
+
}, Ke = {
|
|
287
295
|
"--cd-blau": O.blau,
|
|
288
296
|
"--cd-gruen": O.gruen,
|
|
289
297
|
"--cd-grau": O.grau,
|
|
@@ -297,13 +305,13 @@ var Ve = class {
|
|
|
297
305
|
"--cd-danger": O.danger,
|
|
298
306
|
"--cd-info": O.info,
|
|
299
307
|
"--cd-gradient-brand": O.gradientBrand
|
|
300
|
-
},
|
|
308
|
+
}, qe = 1500;
|
|
301
309
|
O.blau;
|
|
302
|
-
var k = O.schwarz,
|
|
310
|
+
var k = O.schwarz, Je = "#5B5B5B", A = {
|
|
303
311
|
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
304
312
|
label: 13.5,
|
|
305
313
|
small: 11
|
|
306
|
-
}, j = O.weiss,
|
|
314
|
+
}, j = O.weiss, Ye = "#F1F1EE", Xe = "#8A8577";
|
|
307
315
|
//#endregion
|
|
308
316
|
//#region src/draw/endRoleChips.ts
|
|
309
317
|
function M(e, t, n, r) {
|
|
@@ -328,10 +336,10 @@ function M(e, t, n, r) {
|
|
|
328
336
|
}
|
|
329
337
|
//#endregion
|
|
330
338
|
//#region src/draw/ContextMapsRenderer.ts
|
|
331
|
-
var
|
|
339
|
+
var Ze = class extends le {
|
|
332
340
|
static $inject = ["eventBus"];
|
|
333
341
|
constructor(e) {
|
|
334
|
-
super(e,
|
|
342
|
+
super(e, qe);
|
|
335
343
|
}
|
|
336
344
|
canRender(e) {
|
|
337
345
|
return w(e);
|
|
@@ -376,7 +384,7 @@ var Xe = class extends le {
|
|
|
376
384
|
"stroke-linejoin": "round"
|
|
377
385
|
});
|
|
378
386
|
if (v(e, a), this.appendLabel(e, t.cmLabel ?? "", r, i, !!t.team, { "font-weight": "650" }), t.subdomainType && n) {
|
|
379
|
-
v(e,
|
|
387
|
+
v(e, tt(t.subdomainType, 15, 15, 18, n.stroke));
|
|
380
388
|
let r = y(b("text"), {
|
|
381
389
|
x: 28,
|
|
382
390
|
y: 15,
|
|
@@ -391,7 +399,7 @@ var Xe = class extends le {
|
|
|
391
399
|
r.textContent = n.label, v(e, r);
|
|
392
400
|
}
|
|
393
401
|
if (t.team) {
|
|
394
|
-
let n = 19 + t.team.length * A.small * .55, a = r / 2 - n / 2, o = i - 12, s =
|
|
402
|
+
let n = 19 + t.team.length * A.small * .55, a = r / 2 - n / 2, o = i - 12, s = rt(a + 7, o, 14, Je);
|
|
395
403
|
y(s, { class: "cm-team" }), v(e, s);
|
|
396
404
|
let c = y(b("text"), {
|
|
397
405
|
class: "cm-team",
|
|
@@ -399,7 +407,7 @@ var Xe = class extends le {
|
|
|
399
407
|
y: o,
|
|
400
408
|
"font-family": A.family,
|
|
401
409
|
"font-size": A.small,
|
|
402
|
-
fill:
|
|
410
|
+
fill: Je,
|
|
403
411
|
"text-anchor": "start",
|
|
404
412
|
"dominant-baseline": "central"
|
|
405
413
|
});
|
|
@@ -474,7 +482,7 @@ var Xe = class extends le {
|
|
|
474
482
|
rx: 3,
|
|
475
483
|
ry: 3,
|
|
476
484
|
fill: o,
|
|
477
|
-
stroke:
|
|
485
|
+
stroke: Qe(o),
|
|
478
486
|
"stroke-width": 1
|
|
479
487
|
});
|
|
480
488
|
v(e, s);
|
|
@@ -518,8 +526,8 @@ var Xe = class extends le {
|
|
|
518
526
|
d.textContent = r, v(e, d);
|
|
519
527
|
}
|
|
520
528
|
appendLabel(e, t, n, r, i, a) {
|
|
521
|
-
let o = typeof a["font-size"] == "number" ? a["font-size"] : A.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l =
|
|
522
|
-
l.length > f && (l = l.slice(0, f), l[f - 1] =
|
|
529
|
+
let o = typeof a["font-size"] == "number" ? a["font-size"] : A.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l = ot(t, c, o, s), u = o * 1.2, d = r - 36 - (i ? 18 : 8), f = Math.max(1, Math.floor(d / u));
|
|
530
|
+
l.length > f && (l = l.slice(0, f), l[f - 1] = at(l[f - 1], c, o, s));
|
|
523
531
|
let p = 36 + u / 2;
|
|
524
532
|
l.forEach((t, r) => {
|
|
525
533
|
let i = y(b("text"), {
|
|
@@ -537,14 +545,14 @@ var Xe = class extends le {
|
|
|
537
545
|
});
|
|
538
546
|
}
|
|
539
547
|
};
|
|
540
|
-
function
|
|
548
|
+
function Qe(e, t = .7) {
|
|
541
549
|
let n = /^#([0-9a-f]{6})$/i.exec(e);
|
|
542
550
|
if (!n) return e;
|
|
543
551
|
let r = parseInt(n[1], 16);
|
|
544
552
|
return `rgb(${Math.round((r >> 16 & 255) * t)},${Math.round((r >> 8 & 255) * t)},${Math.round((r & 255) * t)})`;
|
|
545
553
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
554
|
+
var $e = "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", et = "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";
|
|
555
|
+
function tt(e, t, n, r, i) {
|
|
548
556
|
if (e === "generic") {
|
|
549
557
|
let e = b("g"), a = y(b("circle"), {
|
|
550
558
|
cx: t,
|
|
@@ -560,41 +568,41 @@ function et(e, t, n, r, i) {
|
|
|
560
568
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = b("g");
|
|
561
569
|
y(s, { transform: `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}` });
|
|
562
570
|
let c = y(b("path"), {
|
|
563
|
-
d: e === "core" ?
|
|
571
|
+
d: e === "core" ? $e : et,
|
|
564
572
|
fill: i
|
|
565
573
|
});
|
|
566
574
|
return v(s, c), s;
|
|
567
575
|
}
|
|
568
|
-
var
|
|
569
|
-
function
|
|
576
|
+
var nt = "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";
|
|
577
|
+
function rt(e, t, n, r) {
|
|
570
578
|
let i = n / 24, a = b("g");
|
|
571
579
|
y(a, { transform: `translate(${e - 12 * i} ${t - 12 * i}) scale(${i})` });
|
|
572
580
|
let o = y(b("path"), {
|
|
573
|
-
d:
|
|
581
|
+
d: nt,
|
|
574
582
|
fill: r
|
|
575
583
|
});
|
|
576
584
|
return v(a, o), a;
|
|
577
585
|
}
|
|
578
586
|
var N;
|
|
579
|
-
function
|
|
587
|
+
function it(e, t, n) {
|
|
580
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;
|
|
581
589
|
}
|
|
582
|
-
function
|
|
590
|
+
function at(e, t, n, r) {
|
|
583
591
|
let i = e;
|
|
584
|
-
for (; i &&
|
|
592
|
+
for (; i && it(`${i}…`, n, r) > t;) i = i.slice(0, -1).trimEnd();
|
|
585
593
|
return `${i}…`;
|
|
586
594
|
}
|
|
587
|
-
function
|
|
595
|
+
function ot(e, t, n, r) {
|
|
588
596
|
let i = e.split("\n");
|
|
589
597
|
return i.every((e) => e.trim() === "") ? [] : i.flatMap((e) => {
|
|
590
|
-
let i =
|
|
598
|
+
let i = st(e, t, n, r);
|
|
591
599
|
return i.length ? i : [""];
|
|
592
600
|
});
|
|
593
601
|
}
|
|
594
|
-
function
|
|
602
|
+
function st(e, t, n, r) {
|
|
595
603
|
let i = e.split(/\s+/).filter(Boolean);
|
|
596
604
|
if (i.length === 0) return [];
|
|
597
|
-
let a = (e) =>
|
|
605
|
+
let a = (e) => it(e, n, r) <= t, o = [], s = "";
|
|
598
606
|
for (let e of i) {
|
|
599
607
|
let t = s ? `${s} ${e}` : e;
|
|
600
608
|
if (a(t)) {
|
|
@@ -617,13 +625,13 @@ function ot(e, t, n, r) {
|
|
|
617
625
|
}
|
|
618
626
|
//#endregion
|
|
619
627
|
//#region src/draw/index.ts
|
|
620
|
-
var
|
|
628
|
+
var ct = {
|
|
621
629
|
__init__: ["cmRenderer"],
|
|
622
|
-
cmRenderer: ["type",
|
|
630
|
+
cmRenderer: ["type", Ze]
|
|
623
631
|
};
|
|
624
632
|
//#endregion
|
|
625
633
|
//#region src/io/CmImporter.ts
|
|
626
|
-
function
|
|
634
|
+
function lt(e, t) {
|
|
627
635
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r;
|
|
628
636
|
if (i === 0 && a === 0) return {
|
|
629
637
|
x: n,
|
|
@@ -635,13 +643,13 @@ function ct(e, t) {
|
|
|
635
643
|
y: r + a * c
|
|
636
644
|
};
|
|
637
645
|
}
|
|
638
|
-
function
|
|
646
|
+
function ut(e) {
|
|
639
647
|
return {
|
|
640
648
|
x: e.x + e.width / 2,
|
|
641
649
|
y: e.y + e.height / 2
|
|
642
650
|
};
|
|
643
651
|
}
|
|
644
|
-
var
|
|
652
|
+
var dt = class {
|
|
645
653
|
canvas;
|
|
646
654
|
elementFactory;
|
|
647
655
|
factory;
|
|
@@ -660,7 +668,8 @@ var ut = class {
|
|
|
660
668
|
assertImportable(e) {
|
|
661
669
|
let t = /* @__PURE__ */ new Set();
|
|
662
670
|
for (let { id: n } of [...e.contexts, ...e.relationships]) {
|
|
663
|
-
|
|
671
|
+
let e = re(n);
|
|
672
|
+
if (e) throw Error(`Cannot draw the map: ${e}.`);
|
|
664
673
|
if (t.has(n)) throw Error(`The id "${n}" is used more than once.`);
|
|
665
674
|
t.add(n);
|
|
666
675
|
}
|
|
@@ -687,7 +696,7 @@ var ut = class {
|
|
|
687
696
|
});
|
|
688
697
|
continue;
|
|
689
698
|
}
|
|
690
|
-
let s = [
|
|
699
|
+
let s = [lt(e, ut(a)), lt(a, ut(e))], c = this.factory.createRelationship(r, e, a, s);
|
|
691
700
|
this.canvas.addConnection(c, n);
|
|
692
701
|
}
|
|
693
702
|
for (let e of o.values()) this.canvas.addShape(e, n);
|
|
@@ -705,7 +714,7 @@ var ut = class {
|
|
|
705
714
|
"waypoints" in t ? this.canvas.removeConnection(t.id) : this.canvas.removeShape(t.id);
|
|
706
715
|
} catch {}
|
|
707
716
|
}
|
|
708
|
-
},
|
|
717
|
+
}, ft = class {
|
|
709
718
|
elementRegistry;
|
|
710
719
|
static $inject = ["elementRegistry"];
|
|
711
720
|
constructor(e) {
|
|
@@ -759,22 +768,22 @@ var ut = class {
|
|
|
759
768
|
...e?.foreign
|
|
760
769
|
};
|
|
761
770
|
}
|
|
762
|
-
},
|
|
763
|
-
cmImporter: ["type",
|
|
764
|
-
cmExporter: ["type",
|
|
765
|
-
},
|
|
771
|
+
}, pt = {
|
|
772
|
+
cmImporter: ["type", dt],
|
|
773
|
+
cmExporter: ["type", ft]
|
|
774
|
+
}, mt = class extends Be {
|
|
766
775
|
_getModules() {
|
|
767
776
|
return [
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
777
|
+
Ge,
|
|
778
|
+
ct,
|
|
779
|
+
pt
|
|
771
780
|
];
|
|
772
781
|
}
|
|
773
|
-
},
|
|
782
|
+
}, ht = {
|
|
774
783
|
x: 14,
|
|
775
784
|
y: 18
|
|
776
|
-
},
|
|
777
|
-
function
|
|
785
|
+
}, gt = 12;
|
|
786
|
+
function _t(e) {
|
|
778
787
|
if (T(e)) {
|
|
779
788
|
let t = [];
|
|
780
789
|
return e.description && t.push(e.description), e.team && t.push(`Team: ${e.team}`), t.length === 0 ? null : {
|
|
@@ -791,7 +800,7 @@ function gt(e) {
|
|
|
791
800
|
}
|
|
792
801
|
return null;
|
|
793
802
|
}
|
|
794
|
-
var
|
|
803
|
+
var vt = class {
|
|
795
804
|
static $inject = ["eventBus", "canvas"];
|
|
796
805
|
tooltip;
|
|
797
806
|
title;
|
|
@@ -800,13 +809,13 @@ var _t = class {
|
|
|
800
809
|
let n = t.getContainer();
|
|
801
810
|
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);
|
|
802
811
|
let r = (e) => {
|
|
803
|
-
let t = n.getBoundingClientRect(), r = this.tooltip.offsetWidth, i = Math.min(e.clientX - t.left +
|
|
804
|
-
this.tooltip.style.left = `${Math.max(
|
|
812
|
+
let t = n.getBoundingClientRect(), r = this.tooltip.offsetWidth, i = Math.min(e.clientX - t.left + ht.x, t.width - r - gt);
|
|
813
|
+
this.tooltip.style.left = `${Math.max(gt, i)}px`, this.tooltip.style.top = `${e.clientY - t.top + ht.y}px`;
|
|
805
814
|
}, i = () => {
|
|
806
815
|
this.tooltip.hidden = !0, n.removeEventListener("mousemove", r);
|
|
807
816
|
};
|
|
808
817
|
e.on("element.hover", (e) => {
|
|
809
|
-
let t =
|
|
818
|
+
let t = _t(e.element);
|
|
810
819
|
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();
|
|
811
820
|
}), e.on([
|
|
812
821
|
"element.out",
|
|
@@ -817,51 +826,51 @@ var _t = class {
|
|
|
817
826
|
i(), this.tooltip.remove();
|
|
818
827
|
});
|
|
819
828
|
}
|
|
820
|
-
},
|
|
829
|
+
}, yt = {
|
|
821
830
|
__init__: ["cmHoverTooltip"],
|
|
822
|
-
cmHoverTooltip: ["type",
|
|
823
|
-
}, P = class extends
|
|
831
|
+
cmHoverTooltip: ["type", vt]
|
|
832
|
+
}, P = class extends mt {
|
|
824
833
|
_getModules() {
|
|
825
834
|
return [
|
|
826
835
|
...super._getModules(),
|
|
827
836
|
x,
|
|
828
837
|
de,
|
|
829
838
|
fe,
|
|
830
|
-
|
|
839
|
+
yt
|
|
831
840
|
];
|
|
832
841
|
}
|
|
833
842
|
};
|
|
834
843
|
//#endregion
|
|
835
844
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
836
|
-
function
|
|
845
|
+
function bt(e, t, n) {
|
|
837
846
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
838
847
|
}
|
|
839
|
-
var
|
|
848
|
+
var xt = class {
|
|
840
849
|
execute(e) {
|
|
841
850
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
842
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
851
|
+
for (let e of Object.keys(n)) i[e] = r[e], bt(r, e, n[e]);
|
|
843
852
|
return e.oldProperties = i, [t];
|
|
844
853
|
}
|
|
845
854
|
revert(e) {
|
|
846
855
|
let { element: t, oldProperties: n } = e, r = t;
|
|
847
|
-
if (n) for (let e of Object.keys(n))
|
|
856
|
+
if (n) for (let e of Object.keys(n)) bt(r, e, n[e]);
|
|
848
857
|
return [t];
|
|
849
858
|
}
|
|
850
859
|
};
|
|
851
860
|
//#endregion
|
|
852
861
|
//#region src/modeling/cmd/SwapEndsHandler.ts
|
|
853
|
-
function
|
|
862
|
+
function St(e) {
|
|
854
863
|
let t = e.source;
|
|
855
864
|
return e.source = e.target, e.target = t, Array.isArray(e.waypoints) && (e.waypoints = [...e.waypoints].reverse()), [e];
|
|
856
865
|
}
|
|
857
|
-
var
|
|
866
|
+
var Ct = class {
|
|
858
867
|
execute(e) {
|
|
859
|
-
return
|
|
868
|
+
return St(e.connection);
|
|
860
869
|
}
|
|
861
870
|
revert(e) {
|
|
862
|
-
return
|
|
871
|
+
return St(e.connection);
|
|
863
872
|
}
|
|
864
|
-
},
|
|
873
|
+
}, wt = class {
|
|
865
874
|
elementRegistry;
|
|
866
875
|
static $inject = ["elementRegistry"];
|
|
867
876
|
constructor(e) {
|
|
@@ -886,7 +895,7 @@ var St = class {
|
|
|
886
895
|
title: e.oldTitle ?? ""
|
|
887
896
|
}, [];
|
|
888
897
|
}
|
|
889
|
-
},
|
|
898
|
+
}, Tt = "element.updateProperties", Et = "relationship.swapEnds", Dt = "map.updateTitle", Ot = class {
|
|
890
899
|
commandStack;
|
|
891
900
|
elementRegistry;
|
|
892
901
|
graphicsFactory;
|
|
@@ -896,20 +905,20 @@ var St = class {
|
|
|
896
905
|
"graphicsFactory"
|
|
897
906
|
];
|
|
898
907
|
constructor(e, t, n) {
|
|
899
|
-
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(
|
|
908
|
+
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(Tt, xt), e.registerHandler(Et, Ct), e.registerHandler(Dt, wt);
|
|
900
909
|
}
|
|
901
910
|
setTitle(e) {
|
|
902
|
-
this.commandStack.execute(
|
|
911
|
+
this.commandStack.execute(Dt, { title: e });
|
|
903
912
|
}
|
|
904
913
|
redraw(e) {
|
|
905
914
|
let t = this.elementRegistry.getGraphics(e);
|
|
906
915
|
t && this.graphicsFactory.update(E(e) ? "connection" : "shape", e, t);
|
|
907
916
|
}
|
|
908
917
|
swapEnds(e) {
|
|
909
|
-
this.commandStack.execute(
|
|
918
|
+
this.commandStack.execute(Et, { connection: e }), this.redraw(e);
|
|
910
919
|
}
|
|
911
920
|
updateProperties(e, t) {
|
|
912
|
-
this.commandStack.execute(
|
|
921
|
+
this.commandStack.execute(Tt, {
|
|
913
922
|
element: e,
|
|
914
923
|
properties: t
|
|
915
924
|
}), this.redraw(e);
|
|
@@ -934,7 +943,7 @@ var St = class {
|
|
|
934
943
|
}
|
|
935
944
|
setPattern(e, t) {
|
|
936
945
|
let n = { pattern: t };
|
|
937
|
-
if (
|
|
946
|
+
if (ee(t)) n.upstreamRoles = void 0, n.downstreamRoles = void 0;
|
|
938
947
|
else if (t === "customer-supplier") {
|
|
939
948
|
let t = (e.upstreamRoles ?? []).filter((e) => e !== "OHS"), r = (e.downstreamRoles ?? []).filter((e) => e !== "CF");
|
|
940
949
|
n.upstreamRoles = t.length ? t : void 0, n.downstreamRoles = r.length ? r : void 0;
|
|
@@ -952,23 +961,23 @@ var St = class {
|
|
|
952
961
|
}
|
|
953
962
|
}, F = {
|
|
954
963
|
__init__: ["cmModeling"],
|
|
955
|
-
cmModeling: ["type",
|
|
956
|
-
layouter: ["type",
|
|
957
|
-
},
|
|
964
|
+
cmModeling: ["type", Ot],
|
|
965
|
+
layouter: ["type", We]
|
|
966
|
+
}, kt = class extends _e {
|
|
958
967
|
static $inject = ["eventBus"];
|
|
959
968
|
constructor(e) {
|
|
960
969
|
super(e);
|
|
961
970
|
}
|
|
962
971
|
init() {
|
|
963
|
-
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) =>
|
|
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) => jt(e.source, e.target)), this.addRule("connection.reconnect", (e) => !!jt(e.source, e.target, e.connection)), this.addRule("connection.updateWaypoints", () => !0);
|
|
964
973
|
}
|
|
965
974
|
};
|
|
966
|
-
function
|
|
975
|
+
function At(e, t, n) {
|
|
967
976
|
let { incoming: r = [], outgoing: i = [] } = e;
|
|
968
977
|
return [...r, ...i].some((r) => r !== n && (r.source === e && r.target === t || r.source === t && r.target === e));
|
|
969
978
|
}
|
|
970
|
-
function
|
|
971
|
-
return !T(e) || !T(t) || e === t ||
|
|
979
|
+
function jt(e, t, n) {
|
|
980
|
+
return !T(e) || !T(t) || e === t || At(e, t, n) ? !1 : {
|
|
972
981
|
cmKind: "relationship",
|
|
973
982
|
pattern: "upstream-downstream"
|
|
974
983
|
};
|
|
@@ -978,8 +987,8 @@ function At(e, t, n) {
|
|
|
978
987
|
var I = {
|
|
979
988
|
__depends__: [ge],
|
|
980
989
|
__init__: ["cmRules"],
|
|
981
|
-
cmRules: ["type",
|
|
982
|
-
},
|
|
990
|
+
cmRules: ["type", kt]
|
|
991
|
+
}, Mt = class extends ve {
|
|
983
992
|
static $inject = [
|
|
984
993
|
"eventBus",
|
|
985
994
|
"canvas",
|
|
@@ -1007,33 +1016,33 @@ var I = {
|
|
|
1007
1016
|
}
|
|
1008
1017
|
}, !0);
|
|
1009
1018
|
}
|
|
1010
|
-
},
|
|
1019
|
+
}, Nt = "cm-dragging", Pt = class {
|
|
1011
1020
|
static $inject = ["eventBus", "canvas"];
|
|
1012
1021
|
constructor(e, t) {
|
|
1013
1022
|
e.on("drag.init", () => {
|
|
1014
|
-
t.getContainer().classList.add(
|
|
1023
|
+
t.getContainer().classList.add(Nt);
|
|
1015
1024
|
}), e.on("drag.cleanup", () => {
|
|
1016
|
-
t.getContainer().classList.remove(
|
|
1025
|
+
t.getContainer().classList.remove(Nt);
|
|
1017
1026
|
});
|
|
1018
1027
|
}
|
|
1019
|
-
},
|
|
1028
|
+
}, Ft = 2e3, It = {
|
|
1020
1029
|
__init__: [
|
|
1021
1030
|
"cmFlatModelBehavior",
|
|
1022
1031
|
"cmDragBehavior",
|
|
1023
1032
|
"cmClickSelectionBehavior"
|
|
1024
1033
|
],
|
|
1025
|
-
cmFlatModelBehavior: ["type",
|
|
1026
|
-
cmDragBehavior: ["type",
|
|
1034
|
+
cmFlatModelBehavior: ["type", Mt],
|
|
1035
|
+
cmDragBehavior: ["type", Pt],
|
|
1027
1036
|
cmClickSelectionBehavior: ["type", class {
|
|
1028
1037
|
static $inject = ["eventBus", "selection"];
|
|
1029
1038
|
constructor(e, t) {
|
|
1030
|
-
e.on("element.click",
|
|
1039
|
+
e.on("element.click", Ft, (e) => {
|
|
1031
1040
|
let n = e.element;
|
|
1032
1041
|
if (w(n) && !ye(e) && t.isSelected(n)) return !1;
|
|
1033
1042
|
});
|
|
1034
1043
|
}
|
|
1035
1044
|
}]
|
|
1036
|
-
}, L = "cm.readOnly.changed",
|
|
1045
|
+
}, L = "cm.readOnly.changed", Lt = 5e3, Rt = [
|
|
1037
1046
|
"elements.move",
|
|
1038
1047
|
"shape.move",
|
|
1039
1048
|
"shape.resize",
|
|
@@ -1045,7 +1054,7 @@ var I = {
|
|
|
1045
1054
|
"connection.reconnect",
|
|
1046
1055
|
"connection.updateWaypoints",
|
|
1047
1056
|
"elements.delete"
|
|
1048
|
-
],
|
|
1057
|
+
], zt = class extends _e {
|
|
1049
1058
|
bus;
|
|
1050
1059
|
static $inject = ["eventBus"];
|
|
1051
1060
|
readOnly = !1;
|
|
@@ -1053,7 +1062,7 @@ var I = {
|
|
|
1053
1062
|
super(e), this.bus = e;
|
|
1054
1063
|
}
|
|
1055
1064
|
init() {
|
|
1056
|
-
this.addRule(
|
|
1065
|
+
this.addRule(Rt, Lt, () => !this.readOnly && void 0);
|
|
1057
1066
|
}
|
|
1058
1067
|
isReadOnly() {
|
|
1059
1068
|
return this.readOnly;
|
|
@@ -1064,11 +1073,11 @@ var I = {
|
|
|
1064
1073
|
}, R = {
|
|
1065
1074
|
__depends__: [ge],
|
|
1066
1075
|
__init__: ["cmReadOnly"],
|
|
1067
|
-
cmReadOnly: ["type",
|
|
1068
|
-
},
|
|
1076
|
+
cmReadOnly: ["type", zt]
|
|
1077
|
+
}, Bt = {
|
|
1069
1078
|
name: "cm-direct-editing",
|
|
1070
1079
|
team: "cm-direct-editing-team"
|
|
1071
|
-
},
|
|
1080
|
+
}, Vt = 10, Ht = 20, Ut = class {
|
|
1072
1081
|
canvas;
|
|
1073
1082
|
directEditing;
|
|
1074
1083
|
modeling;
|
|
@@ -1093,10 +1102,10 @@ var I = {
|
|
|
1093
1102
|
}), e.on("element.dblclick", (e) => {
|
|
1094
1103
|
let t = e.element;
|
|
1095
1104
|
w(t) && (this.mode = T(t) && t.team && this.isInTeamBand(t, e.originalEvent) ? "team" : "name", n.activate(t));
|
|
1096
|
-
}), e.on(
|
|
1105
|
+
}), e.on("drag.init", () => n.complete()), e.on("canvas.viewbox.changed", () => this.placeOpenEdit()), e.on("directEditing.activate", (e) => {
|
|
1097
1106
|
let n = e.active?.element;
|
|
1098
1107
|
if (!n) return;
|
|
1099
|
-
let r =
|
|
1108
|
+
let r = Bt[this.mode];
|
|
1100
1109
|
t.addMarker(n, r), this.activeMarker = {
|
|
1101
1110
|
element: n,
|
|
1102
1111
|
marker: r
|
|
@@ -1132,11 +1141,26 @@ var I = {
|
|
|
1132
1141
|
text: this.directEditing.getValue()
|
|
1133
1142
|
};
|
|
1134
1143
|
}
|
|
1144
|
+
placeOpenEdit() {
|
|
1145
|
+
let e = this.activeMarker?.element, t = this.directEditing.$textbox;
|
|
1146
|
+
if (!this.directEditing.isActive() || !e || !t) return;
|
|
1147
|
+
let n = this.activationContext(e);
|
|
1148
|
+
if (!n) return;
|
|
1149
|
+
let { x: r, y: i, width: a, height: o } = n.bounds;
|
|
1150
|
+
Object.assign(t.style, {
|
|
1151
|
+
left: `${r}px`,
|
|
1152
|
+
top: `${i}px`,
|
|
1153
|
+
width: `${a}px`,
|
|
1154
|
+
height: `${o}px`
|
|
1155
|
+
});
|
|
1156
|
+
let s = t.querySelector("[contenteditable]"), c = n.style?.fontSize;
|
|
1157
|
+
s && c !== void 0 && (s.style.fontSize = String(c));
|
|
1158
|
+
}
|
|
1135
1159
|
resume(e) {
|
|
1136
1160
|
let t = this.elementRegistry.get(e.elementId);
|
|
1137
1161
|
if (!w(t) || e.mode === "team" && !T(t) || (this.mode = e.mode, !this.directEditing.activate(t))) return;
|
|
1138
1162
|
let n = this.directEditing.$textbox?.querySelector("[contenteditable]");
|
|
1139
|
-
n && (n.innerText = e.text,
|
|
1163
|
+
n && (n.innerText = e.text, Wt(n));
|
|
1140
1164
|
}
|
|
1141
1165
|
activate(e) {
|
|
1142
1166
|
this.mode = "name", this.directEditing.activate(e);
|
|
@@ -1160,10 +1184,10 @@ var I = {
|
|
|
1160
1184
|
let r = e;
|
|
1161
1185
|
return {
|
|
1162
1186
|
bounds: {
|
|
1163
|
-
x: n.x +
|
|
1187
|
+
x: n.x + Vt * t,
|
|
1164
1188
|
y: n.y + n.height - 22 * t,
|
|
1165
1189
|
width: n.width - 20 * t,
|
|
1166
|
-
height:
|
|
1190
|
+
height: Ht * t
|
|
1167
1191
|
},
|
|
1168
1192
|
text: r.team ?? "",
|
|
1169
1193
|
style: {
|
|
@@ -1191,7 +1215,7 @@ var I = {
|
|
|
1191
1215
|
let i = e.team ? 18 * t : 0;
|
|
1192
1216
|
return {
|
|
1193
1217
|
bounds: {
|
|
1194
|
-
x: n.x +
|
|
1218
|
+
x: n.x + Vt * t,
|
|
1195
1219
|
y: n.y + 36 * t - 1,
|
|
1196
1220
|
width: n.width - 20 * t,
|
|
1197
1221
|
height: n.height - 36 * t - i
|
|
@@ -1225,7 +1249,7 @@ var I = {
|
|
|
1225
1249
|
} else n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1226
1250
|
}
|
|
1227
1251
|
};
|
|
1228
|
-
function
|
|
1252
|
+
function Wt(e) {
|
|
1229
1253
|
let t = document.createRange();
|
|
1230
1254
|
t.selectNodeContents(e), t.collapse(!1);
|
|
1231
1255
|
let n = window.getSelection();
|
|
@@ -1240,11 +1264,11 @@ var z = {
|
|
|
1240
1264
|
R
|
|
1241
1265
|
],
|
|
1242
1266
|
__init__: ["cmLabelEditing"],
|
|
1243
|
-
cmLabelEditing: ["type",
|
|
1267
|
+
cmLabelEditing: ["type", Ut]
|
|
1244
1268
|
};
|
|
1245
1269
|
//#endregion
|
|
1246
1270
|
//#region src/draw/palette-icons.ts
|
|
1247
|
-
function
|
|
1271
|
+
function B(e, t = 24) {
|
|
1248
1272
|
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
|
|
1249
1273
|
}
|
|
1250
1274
|
var Gt = "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", Kt = "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";
|
|
@@ -1253,20 +1277,20 @@ function qt(e, t, n, r, i) {
|
|
|
1253
1277
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}`;
|
|
1254
1278
|
return `<path d="${e === "core" ? Gt : Kt}" fill="${i}" transform="${s}"/>`;
|
|
1255
1279
|
}
|
|
1256
|
-
function
|
|
1280
|
+
function V(e) {
|
|
1257
1281
|
let t = e ? p[e] : void 0;
|
|
1258
|
-
return
|
|
1282
|
+
return B(!e || !t ? `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${Ye}" stroke="${Xe}" 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"/>` + qt(e, 13, 13, 12, t.stroke));
|
|
1259
1283
|
}
|
|
1260
1284
|
function Jt(e, t = 18) {
|
|
1261
1285
|
let n = p[e], r = n?.stroke ?? "#8A8577";
|
|
1262
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" ? Gt : Kt}" fill="${r}"/>`}</svg>`;
|
|
1263
1287
|
}
|
|
1264
|
-
function
|
|
1265
|
-
return
|
|
1288
|
+
function H(e) {
|
|
1289
|
+
return B(`<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="${A.family}">${e}</text>`);
|
|
1266
1290
|
}
|
|
1267
|
-
function
|
|
1291
|
+
function U(e = "upstream-downstream", t = 24) {
|
|
1268
1292
|
let n = f[e] ?? f["upstream-downstream"], r = n.dash ? ` stroke-dasharray="${n.dash}"` : "", i = Math.min(n.strokeWidth, 2.6);
|
|
1269
|
-
return
|
|
1293
|
+
return B(`<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);
|
|
1270
1294
|
}
|
|
1271
1295
|
//#endregion
|
|
1272
1296
|
//#region src/draw/lucide.ts
|
|
@@ -1287,7 +1311,7 @@ var Yt = {
|
|
|
1287
1311
|
function Xt(e, t, n) {
|
|
1288
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">${Yt[e]}</svg>`;
|
|
1289
1313
|
}
|
|
1290
|
-
function
|
|
1314
|
+
function W(e) {
|
|
1291
1315
|
return Xt(e, 16, 2.5);
|
|
1292
1316
|
}
|
|
1293
1317
|
function Zt(e) {
|
|
@@ -1348,7 +1372,7 @@ var an = class {
|
|
|
1348
1372
|
e[`context.${t.type}`] = {
|
|
1349
1373
|
group: $t,
|
|
1350
1374
|
title: nn(t.label),
|
|
1351
|
-
html: tn(
|
|
1375
|
+
html: tn(V(t.type), !0),
|
|
1352
1376
|
action: {
|
|
1353
1377
|
dragstart: n,
|
|
1354
1378
|
click: n
|
|
@@ -1359,13 +1383,16 @@ var an = class {
|
|
|
1359
1383
|
}
|
|
1360
1384
|
placeInFreeRect(e) {
|
|
1361
1385
|
if (this.readOnly.isReadOnly()) return;
|
|
1362
|
-
let t = this.
|
|
1386
|
+
let t = this.config?.freeRectCenter?.(), n = t ? {
|
|
1387
|
+
x: t.x,
|
|
1388
|
+
y: t.y
|
|
1389
|
+
} : this.freeRectCentre(), r = (e) => this.elementRegistry.filter((e) => T(e)).some((t) => {
|
|
1363
1390
|
let n = t;
|
|
1364
1391
|
return Math.abs(n.x + n.width / 2 - e.x) < 1 && Math.abs(n.y + n.height / 2 - e.y) < 1;
|
|
1365
1392
|
});
|
|
1366
|
-
for (; n
|
|
1367
|
-
let
|
|
1368
|
-
this.selection.select(
|
|
1393
|
+
for (; r(n);) n.x += en, n.y += en;
|
|
1394
|
+
let i = this.modeling.createShape(e, n, this.canvas.getRootElement());
|
|
1395
|
+
this.selection.select(i), this.canvas.focus(), this.labelEditing.activate(i);
|
|
1369
1396
|
}
|
|
1370
1397
|
freeRectCentre() {
|
|
1371
1398
|
let e = this.canvas.viewbox(), t = this.config?.freeRectInsets?.() ?? {
|
|
@@ -1392,18 +1419,24 @@ var an = class {
|
|
|
1392
1419
|
],
|
|
1393
1420
|
__init__: ["cmPaletteProvider"],
|
|
1394
1421
|
cmPaletteProvider: ["type", an]
|
|
1395
|
-
}, sn = "cm-subdomain-menu", cn = "cm-pattern-menu",
|
|
1422
|
+
}, sn = "cm-subdomain-menu", cn = "cm-pattern-menu", G = "cm-roles-menu", K = "cm-popup-active", q = 8, ln = {
|
|
1396
1423
|
OHS: "Open Host Service is one-size-fits-all and not applicable in a customer-supplier relationship.",
|
|
1397
1424
|
CF: "Conformist is not applicable in a customer-supplier relationship — a customer can negotiate."
|
|
1398
1425
|
};
|
|
1399
1426
|
function un(e) {
|
|
1400
1427
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1401
1428
|
}
|
|
1402
|
-
function
|
|
1429
|
+
function J(e, t, n = {}) {
|
|
1403
1430
|
let r = n.draggable ? " draggable=\"true\"" : "", i = n.danger ? " cm-pad-entry--danger" : "", a = un(t);
|
|
1404
1431
|
return `<div class="entry cm-pad-entry${i}"${r} title="${a}" aria-label="${a}">${e}</div>`;
|
|
1405
1432
|
}
|
|
1406
|
-
|
|
1433
|
+
function dn(e, t) {
|
|
1434
|
+
let n = t.getBoundingClientRect();
|
|
1435
|
+
e.style.left = `${n.right + q}px`, e.style.top = `${n.top}px`;
|
|
1436
|
+
let r = e.getBoundingClientRect();
|
|
1437
|
+
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
|
+
}
|
|
1439
|
+
var fn = class {
|
|
1407
1440
|
contextPad;
|
|
1408
1441
|
popupMenu;
|
|
1409
1442
|
eventBus;
|
|
@@ -1446,7 +1479,7 @@ var dn = class {
|
|
|
1446
1479
|
}
|
|
1447
1480
|
let r = f.get();
|
|
1448
1481
|
r.length === 1 ? e.open(r[0], !0) : r.length > 1 && e.open(r, !0);
|
|
1449
|
-
}), t.registerProvider(sn, { getPopupMenuEntries: (e) => this.subdomainMenuEntries(e) }), t.registerProvider(cn, { getPopupMenuEntries: (e) => this.patternMenuEntries(e) }), t.registerProvider(
|
|
1482
|
+
}), t.registerProvider(sn, { getPopupMenuEntries: (e) => this.subdomainMenuEntries(e) }), t.registerProvider(cn, { getPopupMenuEntries: (e) => this.patternMenuEntries(e) }), t.registerProvider(G, { getPopupMenuEntries: (e) => this.rolesMenuEntries(e) }), n.on("autoPlace", (e) => {
|
|
1450
1483
|
let { source: t, shape: n } = e, r = {
|
|
1451
1484
|
x: ce(t).right + De + n.width / 2,
|
|
1452
1485
|
y: _(t).y
|
|
@@ -1500,7 +1533,7 @@ var dn = class {
|
|
|
1500
1533
|
return {
|
|
1501
1534
|
"append-context": {
|
|
1502
1535
|
group: "edit",
|
|
1503
|
-
html:
|
|
1536
|
+
html: J(W("square-plus"), "Append a connected context — click to place automatically, drag to position", { draggable: !0 }),
|
|
1504
1537
|
action: {
|
|
1505
1538
|
click: () => this.appendContext(e),
|
|
1506
1539
|
dragstart: (t) => this.startAppend(t, e)
|
|
@@ -1508,7 +1541,7 @@ var dn = class {
|
|
|
1508
1541
|
},
|
|
1509
1542
|
connect: {
|
|
1510
1543
|
group: "edit",
|
|
1511
|
-
html:
|
|
1544
|
+
html: J(W("arrow-right"), "Connect to another context", { draggable: !0 }),
|
|
1512
1545
|
action: {
|
|
1513
1546
|
click: (t) => this.startConnect(t, e, !0),
|
|
1514
1547
|
dragstart: (t) => this.startConnect(t, e, !1)
|
|
@@ -1516,12 +1549,12 @@ var dn = class {
|
|
|
1516
1549
|
},
|
|
1517
1550
|
"subdomain-type": {
|
|
1518
1551
|
group: "edit",
|
|
1519
|
-
html:
|
|
1552
|
+
html: J(V(e.subdomainType), `Change subdomain type — currently ${t?.label ?? "unclassified"}`),
|
|
1520
1553
|
action: { click: (t) => this.openMenu(t, e, sn, "Subdomain type") }
|
|
1521
1554
|
},
|
|
1522
1555
|
team: {
|
|
1523
1556
|
group: "edit",
|
|
1524
|
-
html:
|
|
1557
|
+
html: J(W("users"), `Set owning team — currently ${e.team ?? "none"}`),
|
|
1525
1558
|
action: { click: () => this.labelEditing.activateTeam(e) }
|
|
1526
1559
|
},
|
|
1527
1560
|
"edit-label": this.editLabelEntry(e, "Rename context"),
|
|
@@ -1576,30 +1609,30 @@ var dn = class {
|
|
|
1576
1609
|
relationshipEntries(e) {
|
|
1577
1610
|
let t = f[e.pattern], n = { pattern: {
|
|
1578
1611
|
group: "edit",
|
|
1579
|
-
html:
|
|
1612
|
+
html: J(U(t?.pattern), `Change pattern — currently ${t?.label ?? e.pattern}`),
|
|
1580
1613
|
action: { click: (t) => this.openMenu(t, e, cn, "Relationship pattern") }
|
|
1581
1614
|
} };
|
|
1582
1615
|
return t && !t.symmetric && (n.roles = {
|
|
1583
1616
|
group: "edit",
|
|
1584
|
-
html:
|
|
1585
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1617
|
+
html: J(W("sliders-horizontal"), "Edit integration roles — OHS/PL upstream, ACL/CF downstream"),
|
|
1618
|
+
action: { click: (t) => this.openMenu(t, e, G, "Integration roles") }
|
|
1586
1619
|
}, n["swap-ends"] = {
|
|
1587
1620
|
group: "edit",
|
|
1588
|
-
html:
|
|
1621
|
+
html: J(W("arrow-left-right"), "Swap ends — reverse upstream/downstream"),
|
|
1589
1622
|
action: { click: () => this.cmModeling.swapEnds(e) }
|
|
1590
1623
|
}), 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;
|
|
1591
1624
|
}
|
|
1592
1625
|
editLabelEntry(e, t) {
|
|
1593
1626
|
return {
|
|
1594
1627
|
group: "edit",
|
|
1595
|
-
html:
|
|
1628
|
+
html: J(W("pencil"), `${t} — edit the name in place`),
|
|
1596
1629
|
action: { click: () => this.labelEditing.activate(e) }
|
|
1597
1630
|
};
|
|
1598
1631
|
}
|
|
1599
1632
|
descriptionEntry(e, t) {
|
|
1600
1633
|
return {
|
|
1601
1634
|
group: "edit",
|
|
1602
|
-
html:
|
|
1635
|
+
html: J(W("text-align-start"), "Edit description"),
|
|
1603
1636
|
action: { click: (n) => this.openPrompt(n, {
|
|
1604
1637
|
value: e.description ?? "",
|
|
1605
1638
|
placeholder: t,
|
|
@@ -1615,34 +1648,36 @@ var dn = class {
|
|
|
1615
1648
|
}
|
|
1616
1649
|
openPrompt(e, t) {
|
|
1617
1650
|
this.activePrompt?.cancel();
|
|
1618
|
-
let n =
|
|
1619
|
-
r.className = "cm-pad-prompt"
|
|
1651
|
+
let n = e.delegateTarget ?? e.target, r = document.createElement("div");
|
|
1652
|
+
r.className = "cm-pad-prompt";
|
|
1620
1653
|
let i = document.createElement(t.multiline ? "textarea" : "input");
|
|
1621
1654
|
if (i.className = "cm-pad-prompt__field", i.value = t.value, i.placeholder = t.placeholder, i.setAttribute("aria-label", t.label), i instanceof HTMLTextAreaElement && (i.rows = 4), r.appendChild(i), t.multiline) {
|
|
1622
1655
|
let e = document.createElement("div");
|
|
1623
1656
|
e.className = "cm-pad-prompt__hint", e.textContent = "Esc to cancel · ⌘/Ctrl+Enter to save", r.appendChild(e);
|
|
1624
1657
|
}
|
|
1625
|
-
this.canvas.getContainer().appendChild(r);
|
|
1626
|
-
let a =
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1658
|
+
this.canvas.getContainer().appendChild(r), dn(r, n), i.focus(), i instanceof HTMLTextAreaElement ? i.setSelectionRange(i.value.length, i.value.length) : i.select();
|
|
1659
|
+
let a = () => {
|
|
1660
|
+
this.scheduler.schedule(() => {
|
|
1661
|
+
n.isConnected && dn(r, n);
|
|
1662
|
+
}, "cmContextPad#placePrompt");
|
|
1663
|
+
};
|
|
1664
|
+
this.eventBus.on("canvas.viewbox.changed", 200, a);
|
|
1665
|
+
let o = !1, s = () => {
|
|
1666
|
+
o || (o = !0, this.eventBus.off("canvas.viewbox.changed", a), this.scheduler.cancel("cmContextPad#placePrompt"), r.remove(), this.activePrompt = void 0, this.canvas.restoreFocus?.());
|
|
1667
|
+
}, c = () => {
|
|
1668
|
+
if (o) return;
|
|
1634
1669
|
let e = i.value.trim(), n = e !== t.value.trim();
|
|
1635
|
-
|
|
1670
|
+
s(), n && t.onCommit(e);
|
|
1636
1671
|
};
|
|
1637
1672
|
i.addEventListener("keydown", (e) => {
|
|
1638
1673
|
let n = e;
|
|
1639
|
-
n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(),
|
|
1640
|
-
}), i.addEventListener("blur",
|
|
1674
|
+
n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), s()) : n.key === "Enter" && (!t.multiline || n.ctrlKey || n.metaKey) && (n.preventDefault(), c());
|
|
1675
|
+
}), i.addEventListener("blur", c), this.activePrompt = { cancel: s };
|
|
1641
1676
|
}
|
|
1642
1677
|
deleteEntry(e, t) {
|
|
1643
1678
|
return {
|
|
1644
1679
|
group: "delete",
|
|
1645
|
-
html:
|
|
1680
|
+
html: J(W("trash"), t, { danger: !0 }),
|
|
1646
1681
|
action: { click: () => this.modeling.removeElements(e) }
|
|
1647
1682
|
};
|
|
1648
1683
|
}
|
|
@@ -1652,12 +1687,12 @@ var dn = class {
|
|
|
1652
1687
|
}
|
|
1653
1688
|
openMenuBeside(e, t, n, r) {
|
|
1654
1689
|
let i = {
|
|
1655
|
-
x: e.right +
|
|
1690
|
+
x: e.right + q,
|
|
1656
1691
|
y: e.top
|
|
1657
1692
|
};
|
|
1658
1693
|
this.popupMenu.open(t, n, i, { title: r });
|
|
1659
1694
|
let a = document.querySelector(".djs-popup"), o = a?.getBoundingClientRect();
|
|
1660
|
-
a && o && o.left < e.right && (i.x = Math.max(
|
|
1695
|
+
a && o && o.left < e.right && (i.x = Math.max(q, e.left - q - o.width), a.style.left = `${i.x}px`), this.currentMenu = {
|
|
1661
1696
|
element: t,
|
|
1662
1697
|
menuId: n,
|
|
1663
1698
|
title: r,
|
|
@@ -1674,8 +1709,8 @@ var dn = class {
|
|
|
1674
1709
|
for (let i of n) r[`type-${i.type}`] = {
|
|
1675
1710
|
label: i.label,
|
|
1676
1711
|
description: i.description,
|
|
1677
|
-
imageHtml:
|
|
1678
|
-
...i.type === t ? { className:
|
|
1712
|
+
imageHtml: V(i.type),
|
|
1713
|
+
...i.type === t ? { className: K } : {},
|
|
1679
1714
|
action: () => {
|
|
1680
1715
|
i.type !== t && this.cmModeling.setSubdomainType(e, i.type);
|
|
1681
1716
|
}
|
|
@@ -1683,8 +1718,8 @@ var dn = class {
|
|
|
1683
1718
|
return r["type-none"] = {
|
|
1684
1719
|
label: "Unclassified",
|
|
1685
1720
|
description: "No subdomain classification.",
|
|
1686
|
-
imageHtml:
|
|
1687
|
-
...t === void 0 ? { className:
|
|
1721
|
+
imageHtml: V(),
|
|
1722
|
+
...t === void 0 ? { className: K } : {},
|
|
1688
1723
|
action: () => {
|
|
1689
1724
|
t !== void 0 && this.cmModeling.setSubdomainType(e, void 0);
|
|
1690
1725
|
}
|
|
@@ -1696,8 +1731,8 @@ var dn = class {
|
|
|
1696
1731
|
for (let i of t) r[`pattern-${i.pattern}`] = {
|
|
1697
1732
|
label: i.label,
|
|
1698
1733
|
description: i.description,
|
|
1699
|
-
imageHtml:
|
|
1700
|
-
...i.pattern === n ? { className:
|
|
1734
|
+
imageHtml: U(i.pattern),
|
|
1735
|
+
...i.pattern === n ? { className: K } : {},
|
|
1701
1736
|
action: () => {
|
|
1702
1737
|
i.pattern !== n && this.cmModeling.setPattern(e, i.pattern);
|
|
1703
1738
|
}
|
|
@@ -1714,15 +1749,15 @@ var dn = class {
|
|
|
1714
1749
|
a[`upstream-${t}`] = {
|
|
1715
1750
|
label: h[t].label,
|
|
1716
1751
|
description: o ? i ? `${o} Click to remove it.` : o : h[t].description,
|
|
1717
|
-
imageHtml:
|
|
1752
|
+
imageHtml: H(t),
|
|
1718
1753
|
group: {
|
|
1719
1754
|
id: "upstream",
|
|
1720
1755
|
name: "Upstream (from) — OHS and/or PL"
|
|
1721
1756
|
},
|
|
1722
1757
|
...s ? { disabled: !0 } : {},
|
|
1723
|
-
...i ? { className:
|
|
1758
|
+
...i ? { className: K } : {},
|
|
1724
1759
|
action: () => {
|
|
1725
|
-
s || (this.cmModeling.setUpstreamRoles(e, i ? r.filter((e) => e !== t) : [...r, t]), this.reopenMenu(e,
|
|
1760
|
+
s || (this.cmModeling.setUpstreamRoles(e, i ? r.filter((e) => e !== t) : [...r, t]), this.reopenMenu(e, G));
|
|
1726
1761
|
}
|
|
1727
1762
|
};
|
|
1728
1763
|
}
|
|
@@ -1731,21 +1766,21 @@ var dn = class {
|
|
|
1731
1766
|
a[`downstream-${t}`] = {
|
|
1732
1767
|
label: c[t].label,
|
|
1733
1768
|
description: o ? r ? `${o} Click to remove it.` : o : c[t].description,
|
|
1734
|
-
imageHtml:
|
|
1769
|
+
imageHtml: H(t),
|
|
1735
1770
|
group: {
|
|
1736
1771
|
id: "downstream",
|
|
1737
1772
|
name: "Downstream (to) — ACL or CF, not both"
|
|
1738
1773
|
},
|
|
1739
1774
|
...s ? { disabled: !0 } : {},
|
|
1740
|
-
...r ? { className:
|
|
1775
|
+
...r ? { className: K } : {},
|
|
1741
1776
|
action: () => {
|
|
1742
|
-
s || (this.cmModeling.setDownstreamRoles(e, r ? [] : [t]), this.reopenMenu(e,
|
|
1777
|
+
s || (this.cmModeling.setDownstreamRoles(e, r ? [] : [t]), this.reopenMenu(e, G));
|
|
1743
1778
|
}
|
|
1744
1779
|
};
|
|
1745
1780
|
}
|
|
1746
1781
|
return a;
|
|
1747
1782
|
}
|
|
1748
|
-
},
|
|
1783
|
+
}, pn = {
|
|
1749
1784
|
__depends__: [
|
|
1750
1785
|
we,
|
|
1751
1786
|
Te,
|
|
@@ -1760,20 +1795,20 @@ var dn = class {
|
|
|
1760
1795
|
R
|
|
1761
1796
|
],
|
|
1762
1797
|
__init__: ["cmContextPadProvider"],
|
|
1763
|
-
cmContextPadProvider: ["type",
|
|
1798
|
+
cmContextPadProvider: ["type", fn]
|
|
1764
1799
|
};
|
|
1765
1800
|
//#endregion
|
|
1766
1801
|
//#region src/keyboard/CmKeyboard.ts
|
|
1767
|
-
function
|
|
1802
|
+
function mn(e) {
|
|
1768
1803
|
let t = e;
|
|
1769
1804
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
1770
1805
|
}
|
|
1771
|
-
function
|
|
1806
|
+
function hn(e, t) {
|
|
1772
1807
|
if (!(e instanceof Node) || e instanceof Element && e.closest(".djs-palette")) return !1;
|
|
1773
1808
|
let n = t.ownerDocument;
|
|
1774
1809
|
return t.contains(e) || e === n.body || e === n.documentElement;
|
|
1775
1810
|
}
|
|
1776
|
-
var
|
|
1811
|
+
var gn = class {
|
|
1777
1812
|
static $inject = [
|
|
1778
1813
|
"config.cmKeyboard",
|
|
1779
1814
|
"canvas",
|
|
@@ -1786,7 +1821,7 @@ var hn = class {
|
|
|
1786
1821
|
];
|
|
1787
1822
|
constructor(e, t, n, r, i, a, o, s) {
|
|
1788
1823
|
let c = t.getContainer(), l = c.ownerDocument ?? document, u = e?.undoRedoKeys ?? !0, d = (e) => {
|
|
1789
|
-
if (e.defaultPrevented || !
|
|
1824
|
+
if (e.defaultPrevented || !hn(e.target, c) || mn(e.target)) return;
|
|
1790
1825
|
let t = e.ctrlKey || e.metaKey, o = e.key.toLowerCase();
|
|
1791
1826
|
if (t && o === "a" && !e.shiftKey && !e.altKey) {
|
|
1792
1827
|
e.preventDefault(), r.select(a.filter((e) => w(e)));
|
|
@@ -1804,14 +1839,14 @@ var hn = class {
|
|
|
1804
1839
|
};
|
|
1805
1840
|
l.addEventListener("keydown", d), o.on("diagram.destroy", () => l.removeEventListener("keydown", d));
|
|
1806
1841
|
}
|
|
1807
|
-
},
|
|
1842
|
+
}, _n = {
|
|
1808
1843
|
__depends__: [R],
|
|
1809
1844
|
__init__: ["cmKeyboard"],
|
|
1810
|
-
cmKeyboard: ["type",
|
|
1811
|
-
},
|
|
1812
|
-
function
|
|
1845
|
+
cmKeyboard: ["type", gn]
|
|
1846
|
+
}, vn = "cm-validation", yn = 22, Y = 16, bn = 44;
|
|
1847
|
+
function xn(e) {
|
|
1813
1848
|
let t = e.some((e) => e.kind === "error"), n = document.createElement("div");
|
|
1814
|
-
n.className = "cm-validation-marker", n.dataset.severity = t ? "error" : "warning", n.innerHTML =
|
|
1849
|
+
n.className = "cm-validation-marker", n.dataset.severity = t ? "error" : "warning", n.innerHTML = W(t ? "circle-x" : "triangle-alert");
|
|
1815
1850
|
let r = document.createElement("div");
|
|
1816
1851
|
r.className = "cm-validation-tooltip";
|
|
1817
1852
|
for (let t of e) {
|
|
@@ -1820,11 +1855,11 @@ function bn(e) {
|
|
|
1820
1855
|
}
|
|
1821
1856
|
return n.appendChild(r), n;
|
|
1822
1857
|
}
|
|
1823
|
-
function
|
|
1858
|
+
function Sn(e, t, n) {
|
|
1824
1859
|
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;
|
|
1825
1860
|
if (n === "middle") return {
|
|
1826
|
-
x: (r.x + i.x) / 2 + -l *
|
|
1827
|
-
y: (r.y + i.y) / 2 + c *
|
|
1861
|
+
x: (r.x + i.x) / 2 + -l * Y,
|
|
1862
|
+
y: (r.y + i.y) / 2 + c * Y
|
|
1828
1863
|
};
|
|
1829
1864
|
let u = e.pattern === "customer-supplier", d = n === "upstream" ? M(r, i, u ? "S" : "U", e.upstreamRoles ?? []) : M(i, r, u ? "C" : "D", e.downstreamRoles ?? []);
|
|
1830
1865
|
if (d) {
|
|
@@ -1837,15 +1872,15 @@ function xn(e, t, n) {
|
|
|
1837
1872
|
y: e.y + 1
|
|
1838
1873
|
};
|
|
1839
1874
|
}
|
|
1840
|
-
let f = Math.min(
|
|
1875
|
+
let f = Math.min(bn, s * .35), p = n === "upstream" ? r.x + c * f : i.x - c * f, m = n === "upstream" ? r.y + l * f : i.y - l * f;
|
|
1841
1876
|
return {
|
|
1842
|
-
x: p + -l *
|
|
1843
|
-
y: m + c *
|
|
1877
|
+
x: p + -l * Y,
|
|
1878
|
+
y: m + c * Y
|
|
1844
1879
|
};
|
|
1845
1880
|
}
|
|
1846
1881
|
//#endregion
|
|
1847
1882
|
//#region src/validation/index.ts
|
|
1848
|
-
var
|
|
1883
|
+
var Cn = {
|
|
1849
1884
|
__depends__: [Ae],
|
|
1850
1885
|
__init__: ["cmValidationMarkers"],
|
|
1851
1886
|
cmValidationMarkers: ["type", class {
|
|
@@ -1864,7 +1899,7 @@ var Sn = {
|
|
|
1864
1899
|
e.on("import.render.done", i), e.on("commandStack.changed", i);
|
|
1865
1900
|
}
|
|
1866
1901
|
refresh() {
|
|
1867
|
-
this.overlays.remove({ type:
|
|
1902
|
+
this.overlays.remove({ type: vn });
|
|
1868
1903
|
let e = ae(this.exporter.export()), t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
1869
1904
|
for (let r of e) {
|
|
1870
1905
|
if (!r.relationshipId) continue;
|
|
@@ -1884,13 +1919,13 @@ var Sn = {
|
|
|
1884
1919
|
if (!E(t)) continue;
|
|
1885
1920
|
let r = t.waypoints ?? [];
|
|
1886
1921
|
if (r.length < 2) continue;
|
|
1887
|
-
let i = e.split(" ")[1], { x: a, y: o } =
|
|
1888
|
-
this.overlays.add(t,
|
|
1922
|
+
let i = e.split(" ")[1], { x: a, y: o } = Sn(t, r, i), s = Math.min(...r.map((e) => e.x)), c = Math.min(...r.map((e) => e.y));
|
|
1923
|
+
this.overlays.add(t, vn, {
|
|
1889
1924
|
position: {
|
|
1890
|
-
left: a - s -
|
|
1891
|
-
top: o - c -
|
|
1925
|
+
left: a - s - yn / 2,
|
|
1926
|
+
top: o - c - yn / 2
|
|
1892
1927
|
},
|
|
1893
|
-
html:
|
|
1928
|
+
html: xn(n.findings)
|
|
1894
1929
|
});
|
|
1895
1930
|
}
|
|
1896
1931
|
}
|
|
@@ -1898,10 +1933,10 @@ var Sn = {
|
|
|
1898
1933
|
};
|
|
1899
1934
|
//#endregion
|
|
1900
1935
|
//#region src/zorder/CmZOrder.ts
|
|
1901
|
-
function
|
|
1936
|
+
function wn(e) {
|
|
1902
1937
|
return +!E(e);
|
|
1903
1938
|
}
|
|
1904
|
-
var
|
|
1939
|
+
var Tn = class {
|
|
1905
1940
|
canvas;
|
|
1906
1941
|
elementRegistry;
|
|
1907
1942
|
static $inject = [
|
|
@@ -1920,16 +1955,16 @@ var wn = class {
|
|
|
1920
1955
|
});
|
|
1921
1956
|
}
|
|
1922
1957
|
reorder() {
|
|
1923
|
-
let e = this.elementRegistry.getAll().filter(w).sort((e, t) =>
|
|
1958
|
+
let e = this.elementRegistry.getAll().filter(w).sort((e, t) => wn(e) - wn(t));
|
|
1924
1959
|
for (let t of e) {
|
|
1925
1960
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
1926
1961
|
e && n && n.appendChild(e);
|
|
1927
1962
|
}
|
|
1928
1963
|
}
|
|
1929
|
-
},
|
|
1964
|
+
}, En = {
|
|
1930
1965
|
__init__: ["cmZOrder"],
|
|
1931
|
-
cmZOrder: ["type",
|
|
1932
|
-
},
|
|
1966
|
+
cmZOrder: ["type", Tn]
|
|
1967
|
+
}, Dn = class extends P {
|
|
1933
1968
|
_getModules() {
|
|
1934
1969
|
return [
|
|
1935
1970
|
...super._getModules(),
|
|
@@ -1940,13 +1975,13 @@ var wn = class {
|
|
|
1940
1975
|
R,
|
|
1941
1976
|
F,
|
|
1942
1977
|
I,
|
|
1943
|
-
|
|
1978
|
+
It,
|
|
1944
1979
|
on,
|
|
1945
|
-
|
|
1980
|
+
pn,
|
|
1946
1981
|
z,
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1982
|
+
_n,
|
|
1983
|
+
Cn,
|
|
1984
|
+
En
|
|
1950
1985
|
];
|
|
1951
1986
|
}
|
|
1952
1987
|
undo() {
|
|
@@ -1961,30 +1996,29 @@ var wn = class {
|
|
|
1961
1996
|
canRedo() {
|
|
1962
1997
|
return this.get("commandStack").canRedo();
|
|
1963
1998
|
}
|
|
1964
|
-
},
|
|
1965
|
-
function
|
|
1966
|
-
return
|
|
1967
|
-
...
|
|
1968
|
-
undoRedoKeys: e.undoRedoKeys ?? !0
|
|
1969
|
-
freeRectInsets: e.freeRectInsets
|
|
1999
|
+
}, On = "context-maps";
|
|
2000
|
+
function kn(e = {}) {
|
|
2001
|
+
return Mn(new Dn({
|
|
2002
|
+
...jn(e),
|
|
2003
|
+
undoRedoKeys: e.undoRedoKeys ?? !0
|
|
1970
2004
|
}), !0);
|
|
1971
2005
|
}
|
|
1972
|
-
function
|
|
1973
|
-
return
|
|
1974
|
-
...An(e),
|
|
1975
|
-
freeRectInsets: e.freeRectInsets
|
|
1976
|
-
}), !1);
|
|
2006
|
+
function An(e = {}) {
|
|
2007
|
+
return Mn(new P(jn(e)), !1);
|
|
1977
2008
|
}
|
|
1978
|
-
function
|
|
2009
|
+
function jn(e) {
|
|
1979
2010
|
return {
|
|
1980
2011
|
width: "100%",
|
|
1981
2012
|
height: "100%",
|
|
1982
|
-
additionalModules: e.additionalModules ?? []
|
|
2013
|
+
additionalModules: e.additionalModules ?? [],
|
|
2014
|
+
freeArea: e.freeArea,
|
|
2015
|
+
freeRectInsets: e.freeRectInsets,
|
|
2016
|
+
fitOnImport: e.fitOnImport
|
|
1983
2017
|
};
|
|
1984
2018
|
}
|
|
1985
|
-
function
|
|
2019
|
+
function Mn(e, t) {
|
|
1986
2020
|
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 = {
|
|
1987
|
-
notation:
|
|
2021
|
+
notation: On,
|
|
1988
2022
|
apiVersion: je,
|
|
1989
2023
|
editable: t
|
|
1990
2024
|
};
|
|
@@ -1993,15 +2027,20 @@ function jn(e, t) {
|
|
|
1993
2027
|
}), {
|
|
1994
2028
|
meta: l,
|
|
1995
2029
|
elements: {
|
|
1996
|
-
list: () => s ? [] : i.getAll().filter(w).map(
|
|
2030
|
+
list: () => s ? [] : i.getAll().filter(w).map(Fn),
|
|
2031
|
+
bounds(e) {
|
|
2032
|
+
if (s) return;
|
|
2033
|
+
let t = i.get(e);
|
|
2034
|
+
return w(t) ? Pn(t) : void 0;
|
|
2035
|
+
},
|
|
1997
2036
|
reveal(e) {
|
|
1998
2037
|
if (s) return !1;
|
|
1999
2038
|
let t = i.get(e);
|
|
2000
2039
|
return w(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
2001
2040
|
},
|
|
2002
|
-
selection: () => s ? [] :
|
|
2041
|
+
selection: () => s ? [] : Nn(a.get()),
|
|
2003
2042
|
onSelection(e) {
|
|
2004
|
-
let t = (t) => e(
|
|
2043
|
+
let t = (t) => e(Nn(t.newSelection ?? []));
|
|
2005
2044
|
return n.on("selection.changed", t), () => n.off("selection.changed", t);
|
|
2006
2045
|
}
|
|
2007
2046
|
},
|
|
@@ -2028,13 +2067,13 @@ function jn(e, t) {
|
|
|
2028
2067
|
width: n,
|
|
2029
2068
|
height: i
|
|
2030
2069
|
};
|
|
2031
|
-
return
|
|
2070
|
+
return In(a) ? a : void 0;
|
|
2032
2071
|
} catch {
|
|
2033
2072
|
return;
|
|
2034
2073
|
}
|
|
2035
2074
|
},
|
|
2036
2075
|
setViewState(e) {
|
|
2037
|
-
!s &&
|
|
2076
|
+
!s && In(e) && r.viewbox({
|
|
2038
2077
|
x: e.x,
|
|
2039
2078
|
y: e.y,
|
|
2040
2079
|
width: e.width,
|
|
@@ -2053,26 +2092,35 @@ function jn(e, t) {
|
|
|
2053
2092
|
}
|
|
2054
2093
|
};
|
|
2055
2094
|
}
|
|
2056
|
-
function
|
|
2095
|
+
function Nn(e) {
|
|
2057
2096
|
return e.filter(w).map((e) => e.id);
|
|
2058
2097
|
}
|
|
2059
|
-
function
|
|
2098
|
+
function Pn(e) {
|
|
2099
|
+
let { x: t, y: n, width: r, height: i } = Me(e);
|
|
2100
|
+
return {
|
|
2101
|
+
x: t,
|
|
2102
|
+
y: n,
|
|
2103
|
+
width: r,
|
|
2104
|
+
height: i
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
function Fn(e) {
|
|
2060
2108
|
return e.cmLabel ? {
|
|
2061
2109
|
id: e.id,
|
|
2062
2110
|
name: e.cmLabel
|
|
2063
2111
|
} : { id: e.id };
|
|
2064
2112
|
}
|
|
2065
|
-
function
|
|
2113
|
+
function In(e) {
|
|
2066
2114
|
if (typeof e != "object" || !e) return !1;
|
|
2067
2115
|
let { x: t, y: n, width: r, height: i } = e;
|
|
2068
|
-
return
|
|
2116
|
+
return X(t) && X(n) && X(r) && X(i) && r > 0 && i > 0;
|
|
2069
2117
|
}
|
|
2070
|
-
function
|
|
2118
|
+
function X(e) {
|
|
2071
2119
|
return typeof e == "number" && Number.isFinite(e);
|
|
2072
2120
|
}
|
|
2073
2121
|
//#endregion
|
|
2074
2122
|
//#region src/connect-handles/CmConnectHandles.ts
|
|
2075
|
-
var
|
|
2123
|
+
var Ln = "cm-connect-handle", Rn = 28, zn = 12, Bn = [
|
|
2076
2124
|
{
|
|
2077
2125
|
side: "top",
|
|
2078
2126
|
rotationDeg: -90
|
|
@@ -2090,15 +2138,15 @@ var Fn = "cm-connect-handle", In = 28, Ln = 12, Rn = [
|
|
|
2090
2138
|
rotationDeg: 180
|
|
2091
2139
|
}
|
|
2092
2140
|
];
|
|
2093
|
-
function
|
|
2094
|
-
let n = t.width / 2 -
|
|
2141
|
+
function Vn(e, t) {
|
|
2142
|
+
let n = t.width / 2 - Rn / 2, r = t.height / 2 - Rn / 2;
|
|
2095
2143
|
switch (e) {
|
|
2096
2144
|
case "top": return {
|
|
2097
2145
|
top: -40,
|
|
2098
2146
|
left: n
|
|
2099
2147
|
};
|
|
2100
2148
|
case "bottom": return {
|
|
2101
|
-
top: t.height +
|
|
2149
|
+
top: t.height + zn,
|
|
2102
2150
|
left: n
|
|
2103
2151
|
};
|
|
2104
2152
|
case "left": return {
|
|
@@ -2107,11 +2155,11 @@ function zn(e, t) {
|
|
|
2107
2155
|
};
|
|
2108
2156
|
case "right": return {
|
|
2109
2157
|
top: r,
|
|
2110
|
-
left: t.width +
|
|
2158
|
+
left: t.width + zn
|
|
2111
2159
|
};
|
|
2112
2160
|
}
|
|
2113
2161
|
}
|
|
2114
|
-
var
|
|
2162
|
+
var Hn = class {
|
|
2115
2163
|
eventBus;
|
|
2116
2164
|
selection;
|
|
2117
2165
|
overlays;
|
|
@@ -2131,17 +2179,17 @@ var Bn = class {
|
|
|
2131
2179
|
e.on("selection.changed", o), e.on("commandStack.changed", o), e.on(L, o);
|
|
2132
2180
|
}
|
|
2133
2181
|
refresh() {
|
|
2134
|
-
if (this.overlays.remove({ type:
|
|
2182
|
+
if (this.overlays.remove({ type: Ln }), this.readOnly.isReadOnly()) return;
|
|
2135
2183
|
let e = this.selection.get();
|
|
2136
2184
|
if (e.length !== 1) return;
|
|
2137
2185
|
let t = e[0];
|
|
2138
2186
|
if (!T(t)) return;
|
|
2139
2187
|
let n = t;
|
|
2140
|
-
for (let { side: e, rotationDeg: r } of
|
|
2188
|
+
for (let { side: e, rotationDeg: r } of Bn) {
|
|
2141
2189
|
let i = document.createElement("div");
|
|
2142
2190
|
i.className = "cm-connect-handle", i.dataset.side = e, i.title = "Connect to another context", i.setAttribute("aria-label", "Connect to another context");
|
|
2143
2191
|
let a = document.createElement("span");
|
|
2144
|
-
a.className = "cm-connect-handle__arrow", a.style.transform = `rotate(${r}deg)`, a.innerHTML =
|
|
2192
|
+
a.className = "cm-connect-handle__arrow", a.style.transform = `rotate(${r}deg)`, a.innerHTML = W("arrow-right"), i.append(a), i.addEventListener("mousedown", (e) => {
|
|
2145
2193
|
e.button === 0 && (e.preventDefault(), e.stopPropagation(), this.dragging.init(e, "connect", {
|
|
2146
2194
|
autoActivate: !1,
|
|
2147
2195
|
trapClick: !1,
|
|
@@ -2155,13 +2203,13 @@ var Bn = class {
|
|
|
2155
2203
|
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
2156
2204
|
this.selection.get().length === 0 && this.selection.select(t);
|
|
2157
2205
|
}));
|
|
2158
|
-
}), this.overlays.add(t,
|
|
2159
|
-
position:
|
|
2206
|
+
}), this.overlays.add(t, Ln, {
|
|
2207
|
+
position: Vn(e, n),
|
|
2160
2208
|
html: i
|
|
2161
2209
|
});
|
|
2162
2210
|
}
|
|
2163
2211
|
}
|
|
2164
|
-
},
|
|
2212
|
+
}, Un = {
|
|
2165
2213
|
__depends__: [
|
|
2166
2214
|
C,
|
|
2167
2215
|
Ae,
|
|
@@ -2169,8 +2217,8 @@ var Bn = class {
|
|
|
2169
2217
|
R
|
|
2170
2218
|
],
|
|
2171
2219
|
__init__: ["cmConnectHandles"],
|
|
2172
|
-
cmConnectHandles: ["type",
|
|
2173
|
-
},
|
|
2220
|
+
cmConnectHandles: ["type", Hn]
|
|
2221
|
+
}, Wn = [
|
|
2174
2222
|
{
|
|
2175
2223
|
token: "OHS",
|
|
2176
2224
|
...h.OHS
|
|
@@ -2188,20 +2236,20 @@ var Bn = class {
|
|
|
2188
2236
|
...c.CF
|
|
2189
2237
|
}
|
|
2190
2238
|
];
|
|
2191
|
-
function
|
|
2239
|
+
function Gn() {
|
|
2192
2240
|
return [
|
|
2193
2241
|
{
|
|
2194
2242
|
label: "Subdomain types",
|
|
2195
2243
|
rows: n.map((e) => ({
|
|
2196
|
-
preview:
|
|
2244
|
+
preview: V(e.type),
|
|
2197
2245
|
label: e.label,
|
|
2198
2246
|
explanation: e.description
|
|
2199
2247
|
}))
|
|
2200
2248
|
},
|
|
2201
2249
|
{
|
|
2202
2250
|
label: "Integration roles",
|
|
2203
|
-
rows:
|
|
2204
|
-
preview:
|
|
2251
|
+
rows: Wn.map((e) => ({
|
|
2252
|
+
preview: H(e.token),
|
|
2205
2253
|
label: `${e.token} · ${e.label}`,
|
|
2206
2254
|
explanation: e.description
|
|
2207
2255
|
}))
|
|
@@ -2209,16 +2257,16 @@ function X() {
|
|
|
2209
2257
|
{
|
|
2210
2258
|
label: "Relationship patterns",
|
|
2211
2259
|
rows: t.map((e) => ({
|
|
2212
|
-
preview:
|
|
2260
|
+
preview: U(e.pattern),
|
|
2213
2261
|
label: `${e.abbreviation} · ${e.label}`,
|
|
2214
2262
|
explanation: e.description
|
|
2215
2263
|
}))
|
|
2216
2264
|
}
|
|
2217
2265
|
];
|
|
2218
2266
|
}
|
|
2219
|
-
function
|
|
2267
|
+
function Kn(e, t = {}) {
|
|
2220
2268
|
let n = [];
|
|
2221
|
-
return
|
|
2269
|
+
return Gn().forEach((r, i) => {
|
|
2222
2270
|
if (i > 0) {
|
|
2223
2271
|
let t = document.createElement("div");
|
|
2224
2272
|
t.className = "cd-shell-legend-separator", t.setAttribute("role", "separator"), e.append(t);
|
|
@@ -2245,7 +2293,7 @@ function Un(e, t = {}) {
|
|
|
2245
2293
|
}
|
|
2246
2294
|
//#endregion
|
|
2247
2295
|
//#region src/legend/CmLegend.ts
|
|
2248
|
-
function
|
|
2296
|
+
function qn(e) {
|
|
2249
2297
|
let t = document.createElement("div");
|
|
2250
2298
|
t.className = "cm-legend__row cm-legend-item";
|
|
2251
2299
|
let n = document.createElement("span");
|
|
@@ -2258,15 +2306,15 @@ function Wn(e) {
|
|
|
2258
2306
|
i.style.left = `${e.right + 10}px`, i.style.top = `${e.top + e.height / 2}px`;
|
|
2259
2307
|
}), t.append(n, r, i), t;
|
|
2260
2308
|
}
|
|
2261
|
-
function
|
|
2309
|
+
function Jn(e, t) {
|
|
2262
2310
|
let n = document.createElement("div");
|
|
2263
2311
|
return n.className = "cm-legend__group", n.setAttribute("role", "group"), n.setAttribute("aria-label", e), n.append(...t), n;
|
|
2264
2312
|
}
|
|
2265
|
-
function
|
|
2313
|
+
function Yn() {
|
|
2266
2314
|
let e = document.createElement("div");
|
|
2267
2315
|
return e.className = "cm-legend__divider", e;
|
|
2268
2316
|
}
|
|
2269
|
-
var
|
|
2317
|
+
var Xn = class {
|
|
2270
2318
|
static $inject = ["canvas", "eventBus"];
|
|
2271
2319
|
openState = !0;
|
|
2272
2320
|
host;
|
|
@@ -2294,18 +2342,18 @@ var qn = class {
|
|
|
2294
2342
|
let n = document.createElement("strong");
|
|
2295
2343
|
n.textContent = "Legend";
|
|
2296
2344
|
let r = document.createElement("button");
|
|
2297
|
-
r.type = "button", r.className = "cm-legend__close", r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", "Close legend"), r.innerHTML =
|
|
2298
|
-
let i =
|
|
2299
|
-
return a.className = "cm-legend__body", i.forEach((e, t) => a.append(...t > 0 ? [
|
|
2345
|
+
r.type = "button", r.className = "cm-legend__close", r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", "Close legend"), r.innerHTML = W("x"), r.addEventListener("click", () => this.toggle()), t.append(n, r);
|
|
2346
|
+
let i = Gn().map((e) => Jn(e.label, e.rows.map(qn))), a = document.createElement("div");
|
|
2347
|
+
return a.className = "cm-legend__body", i.forEach((e, t) => a.append(...t > 0 ? [Yn()] : [], e)), e.append(t, a), e;
|
|
2300
2348
|
}
|
|
2301
2349
|
collapsedButton() {
|
|
2302
2350
|
let e = document.createElement("button");
|
|
2303
2351
|
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;
|
|
2304
2352
|
}
|
|
2305
|
-
},
|
|
2353
|
+
}, Zn = {
|
|
2306
2354
|
__init__: ["cmLegend"],
|
|
2307
|
-
cmLegend: ["type",
|
|
2308
|
-
},
|
|
2355
|
+
cmLegend: ["type", Xn]
|
|
2356
|
+
}, Qn = "Export as JSON";
|
|
2309
2357
|
function Z(e, t, n, r) {
|
|
2310
2358
|
return {
|
|
2311
2359
|
kind: "action",
|
|
@@ -2316,7 +2364,7 @@ function Z(e, t, n, r) {
|
|
|
2316
2364
|
onSelect: () => n.onSelect()
|
|
2317
2365
|
};
|
|
2318
2366
|
}
|
|
2319
|
-
function
|
|
2367
|
+
function $n(e) {
|
|
2320
2368
|
let { editTitle: t } = e;
|
|
2321
2369
|
return {
|
|
2322
2370
|
model: t ? [{
|
|
@@ -2328,7 +2376,7 @@ function Xn(e) {
|
|
|
2328
2376
|
export: [
|
|
2329
2377
|
Z("export-png", "Export as PNG", e.exports.png, "file-image"),
|
|
2330
2378
|
Z("export-svg", "Export as SVG", e.exports.svg, "file-code-corner"),
|
|
2331
|
-
Z("export-json",
|
|
2379
|
+
Z("export-json", Qn, e.exports.json),
|
|
2332
2380
|
Z("export-cml", "Export as CML", e.exports.cml)
|
|
2333
2381
|
],
|
|
2334
2382
|
help: [{
|
|
@@ -2342,17 +2390,17 @@ function Xn(e) {
|
|
|
2342
2390
|
}
|
|
2343
2391
|
//#endregion
|
|
2344
2392
|
//#region src/chrome/shortcuts.ts
|
|
2345
|
-
function
|
|
2393
|
+
function er(e, t, n) {
|
|
2346
2394
|
return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
|
|
2347
2395
|
}
|
|
2348
|
-
function
|
|
2396
|
+
function tr(e) {
|
|
2349
2397
|
try {
|
|
2350
2398
|
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
2351
2399
|
} catch {
|
|
2352
2400
|
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
2353
2401
|
}
|
|
2354
2402
|
}
|
|
2355
|
-
function
|
|
2403
|
+
function nr(e, t) {
|
|
2356
2404
|
if (e === "mac") return {
|
|
2357
2405
|
zoomIn: "⌘+",
|
|
2358
2406
|
zoomOut: "⌘−",
|
|
@@ -2367,7 +2415,7 @@ function $n(e, t) {
|
|
|
2367
2415
|
fit: `${r}+1`
|
|
2368
2416
|
};
|
|
2369
2417
|
}
|
|
2370
|
-
function
|
|
2418
|
+
function rr(e, t) {
|
|
2371
2419
|
if (e === "mac") return {
|
|
2372
2420
|
undo: ["⌘Z"],
|
|
2373
2421
|
redo: ["⌘⇧Z"],
|
|
@@ -2386,23 +2434,23 @@ function er(e, t) {
|
|
|
2386
2434
|
lassoDrag: [`${r}+Drag`]
|
|
2387
2435
|
};
|
|
2388
2436
|
}
|
|
2389
|
-
function
|
|
2437
|
+
function ir(e) {
|
|
2390
2438
|
let { platform: t, messages: n } = e;
|
|
2391
2439
|
return {
|
|
2392
2440
|
title: "File",
|
|
2393
2441
|
rows: [{
|
|
2394
2442
|
action: n.openFile ?? "Open…",
|
|
2395
|
-
keys: [
|
|
2443
|
+
keys: [er("O", t, n.keyNames)]
|
|
2396
2444
|
}, {
|
|
2397
|
-
action:
|
|
2398
|
-
keys: [
|
|
2445
|
+
action: Qn,
|
|
2446
|
+
keys: [er("S", t, n.keyNames)]
|
|
2399
2447
|
}]
|
|
2400
2448
|
};
|
|
2401
2449
|
}
|
|
2402
|
-
function
|
|
2403
|
-
let { platform: n, messages: r } = e, i =
|
|
2450
|
+
function ar(e, t = {}) {
|
|
2451
|
+
let { platform: n, messages: r } = e, i = nr(n, r.keyNames), a = rr(n, r.keyNames);
|
|
2404
2452
|
return [
|
|
2405
|
-
...t.fileKeys ? [
|
|
2453
|
+
...t.fileKeys ? [ir(e)] : [],
|
|
2406
2454
|
{
|
|
2407
2455
|
title: "View",
|
|
2408
2456
|
rows: [
|
|
@@ -2415,7 +2463,7 @@ function nr(e, t = {}) {
|
|
|
2415
2463
|
keys: [i.zoomOut]
|
|
2416
2464
|
},
|
|
2417
2465
|
{
|
|
2418
|
-
action: r.zoomToActual(
|
|
2466
|
+
action: r.zoomToActual(tr(e.lang)),
|
|
2419
2467
|
keys: [i.zoomToActual]
|
|
2420
2468
|
},
|
|
2421
2469
|
{
|
|
@@ -2479,19 +2527,19 @@ function Q(e, t, n) {
|
|
|
2479
2527
|
let r = document.createElement(e);
|
|
2480
2528
|
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
2481
2529
|
}
|
|
2482
|
-
function
|
|
2530
|
+
function or(e, t, n) {
|
|
2483
2531
|
let r = Q("header", "cm-dialog-header"), i = Q("h3", "cm-dialog-title", t.title);
|
|
2484
2532
|
i.id = t.titleId;
|
|
2485
2533
|
let a = Q("button", "cm-dialog-close");
|
|
2486
|
-
return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML =
|
|
2534
|
+
return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML = W("x"), a.addEventListener("click", n), r.append(i, a), r;
|
|
2487
2535
|
}
|
|
2488
|
-
function
|
|
2536
|
+
function sr(e, t) {
|
|
2489
2537
|
let n;
|
|
2490
2538
|
function r() {
|
|
2491
2539
|
let n = Q("dialog", `cm-dialog ${t.className}`);
|
|
2492
2540
|
n.setAttribute("aria-labelledby", t.titleId);
|
|
2493
2541
|
let r = () => n.close(), i = Q("div", "cm-dialog-panel");
|
|
2494
|
-
return i.append(
|
|
2542
|
+
return i.append(or(e, t, r), ...t.content(r)), n.append(i), n.addEventListener("click", (e) => {
|
|
2495
2543
|
e.target === n && n.close();
|
|
2496
2544
|
}), n.addEventListener("close", () => {
|
|
2497
2545
|
e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
|
|
@@ -2512,9 +2560,9 @@ function ir(e, t) {
|
|
|
2512
2560
|
}
|
|
2513
2561
|
//#endregion
|
|
2514
2562
|
//#region src/chrome/ShortcutsDialog.ts
|
|
2515
|
-
var $ = "cm-shortcuts",
|
|
2516
|
-
function
|
|
2517
|
-
let n = Q("section", `${$}-group`), r = `${
|
|
2563
|
+
var $ = "cm-shortcuts", cr = "cm-shortcuts-title";
|
|
2564
|
+
function lr(e, t) {
|
|
2565
|
+
let n = Q("section", `${$}-group`), r = `${cr}-group-${t}`, i = Q("h4", `${$}-group-title`, e.title);
|
|
2518
2566
|
i.id = r;
|
|
2519
2567
|
let a = Q("table", `${$}-table`);
|
|
2520
2568
|
a.setAttribute("aria-labelledby", r);
|
|
@@ -2528,29 +2576,29 @@ function or(e, t) {
|
|
|
2528
2576
|
}
|
|
2529
2577
|
return n.append(i, a), n;
|
|
2530
2578
|
}
|
|
2531
|
-
function
|
|
2532
|
-
return
|
|
2579
|
+
function ur(e, t = {}) {
|
|
2580
|
+
return sr(e, {
|
|
2533
2581
|
className: $,
|
|
2534
|
-
titleId:
|
|
2582
|
+
titleId: cr,
|
|
2535
2583
|
title: "Keyboard shortcuts",
|
|
2536
2584
|
content() {
|
|
2537
2585
|
let n = Q("div", "cm-dialog-body cm-shortcuts-body");
|
|
2538
|
-
return n.append(...
|
|
2586
|
+
return n.append(...ar(e, t).map(lr)), [n];
|
|
2539
2587
|
}
|
|
2540
2588
|
});
|
|
2541
2589
|
}
|
|
2542
2590
|
//#endregion
|
|
2543
2591
|
//#region src/chrome/TitleDialog.ts
|
|
2544
|
-
var
|
|
2545
|
-
function
|
|
2592
|
+
var dr = "cm-title-dialog", fr = "cm-title-dialog-title", pr = "cm-title-dialog-field";
|
|
2593
|
+
function mr(e, t) {
|
|
2546
2594
|
let n = Q("button", "cm-dialog-button", e);
|
|
2547
2595
|
return n.type = t === "primary" ? "submit" : "button", n.dataset.variant = t, n;
|
|
2548
2596
|
}
|
|
2549
|
-
function
|
|
2597
|
+
function hr(e, t) {
|
|
2550
2598
|
let n = Q("input", "cm-dialog-input");
|
|
2551
|
-
return n.id =
|
|
2552
|
-
className:
|
|
2553
|
-
titleId:
|
|
2599
|
+
return n.id = pr, n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.autofocus = !0, sr(e, {
|
|
2600
|
+
className: dr,
|
|
2601
|
+
titleId: fr,
|
|
2554
2602
|
title: "Map title",
|
|
2555
2603
|
beforeOpen() {
|
|
2556
2604
|
n.value = t.title();
|
|
@@ -2562,9 +2610,9 @@ function fr(e, t) {
|
|
|
2562
2610
|
let r = Q("form", "cm-dialog-form");
|
|
2563
2611
|
r.noValidate = !0;
|
|
2564
2612
|
let i = Q("div", "cm-dialog-body"), a = Q("label", "cm-dialog-label", "Title");
|
|
2565
|
-
a.htmlFor =
|
|
2566
|
-
let o = Q("div", "cm-dialog-footer"), s =
|
|
2567
|
-
return s.addEventListener("click", e), o.append(s,
|
|
2613
|
+
a.htmlFor = pr, i.append(a, n);
|
|
2614
|
+
let o = Q("div", "cm-dialog-footer"), s = mr("Cancel", "secondary");
|
|
2615
|
+
return s.addEventListener("click", e), o.append(s, mr("Apply", "primary")), r.append(i, o), r.addEventListener("submit", (r) => {
|
|
2568
2616
|
r.preventDefault();
|
|
2569
2617
|
let i = n.value.trim();
|
|
2570
2618
|
e(), i !== t.title() && t.setTitle(i);
|
|
@@ -2573,6 +2621,6 @@ function fr(e, t) {
|
|
|
2573
2621
|
});
|
|
2574
2622
|
}
|
|
2575
2623
|
//#endregion
|
|
2576
|
-
export {
|
|
2624
|
+
export { Ke as CD_TOKENS, On as CONTEXT_MAPS_NOTATION, Be as CmBaseViewer, Hn as CmConnectHandles, fn as CmContextPadProvider, He as CmElementFactory, ft as CmExporter, Mt as CmFlatModelBehavior, vt as CmHoverTooltip, dt as CmImporter, gn as CmKeyboard, Ut as CmLabelEditing, Xn as CmLegend, Ot as CmModeling, an as CmPaletteProvider, zt as CmReadOnly, kt as CmRules, Tn as CmZOrder, Ze as ContextMapsRenderer, Qn as JSON_EXPORT_LABEL, O as MIRAGON, Dn as Modeler, P as NavigatedViewer, L as READ_ONLY_CHANGED_EVENT, D as ROOT_ID, mt as Viewer, It as cmBehaviorsModule, Un as cmConnectHandlesModule, pn as cmContextPadModule, ct as cmDrawModule, yt as cmHoverTooltipModule, _n as cmKeyboardModule, z as cmLabelEditingModule, Zn as cmLegendModule, Ge as cmModelModule, F as cmModelingModule, on as cmPaletteModule, R as cmReadOnlyModule, I as cmRulesModule, En as cmZOrderModule, V as contextIconSvg, $n as contextMapMenu, ar as contextMapShortcuts, kn as createCollaborativeModeler, An as createCollaborativeViewer, ur as createShortcutsDialog, hr as createTitleDialog, _t as hoverTipFor, pt as ioModule, T as isCmContext, w as isCmElement, E as isCmRelationship, Gn as legendGroups, U as relationshipIconSvg, Kn as renderLegend, H as roleChipSvg, Ie as saveSVG, Jt as subdomainIconSvg };
|
|
2577
2625
|
|
|
2578
2626
|
//# sourceMappingURL=index.js.map
|