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