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