@miragon/context-maps-renderer 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -21
- package/dist/CmBaseViewer.d.ts.map +1 -1
- package/dist/Modeler.d.ts +3 -2
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/behaviors/CmFlatModelBehavior.d.ts.map +1 -1
- package/dist/context-maps.css +1 -1
- package/dist/context-pad/CmContextPadProvider.d.ts +96 -0
- package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -0
- package/dist/context-pad/index.d.ts +4 -0
- package/dist/context-pad/index.d.ts.map +1 -0
- package/dist/draw/ContextMapsRenderer.d.ts +4 -0
- package/dist/draw/ContextMapsRenderer.d.ts.map +1 -1
- package/dist/draw/icons.d.ts +6 -0
- package/dist/draw/icons.d.ts.map +1 -1
- package/dist/draw/palette-icons.d.ts +8 -3
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +11 -0
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1017 -447
- package/dist/index.js.map +1 -1
- package/dist/label-editing/CmLabelEditing.d.ts +39 -3
- package/dist/label-editing/CmLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/index.d.ts +1 -1
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/legend/CmLegend.d.ts +15 -0
- package/dist/legend/CmLegend.d.ts.map +1 -0
- package/dist/legend/index.d.ts +4 -0
- package/dist/legend/index.d.ts.map +1 -0
- package/dist/model/CmElementFactory.d.ts +2 -1
- package/dist/model/CmElementFactory.d.ts.map +1 -1
- package/dist/palette/CmPaletteProvider.d.ts +3 -1
- package/dist/palette/CmPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +1 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/rules/CmRules.d.ts.map +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import e from "diagram-js/lib/Diagram";
|
|
2
2
|
import t from "diagram-js/lib/layout/CroppingConnectionDocking";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { getMid as
|
|
6
|
-
import
|
|
7
|
-
import { append as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
3
|
+
import { ALL_PATTERN_SPECS as n, ALL_SUBDOMAIN_SPECS as r, DOCUMENT_VERSION as i, DOWNSTREAM_ROLES as a, DOWNSTREAM_ROLE_SPECS as o, MARK_COLORS as s, MARK_TEXT_COLOR as c, RELATIONSHIP_PATTERN_SPECS as l, SUBDOMAIN_TYPE_SPECS as u, UPSTREAM_ROLES as d, UPSTREAM_ROLE_SPECS as f, isSymmetricPattern as p, newId as m, validateDocument as h } from "@miragon/context-maps-schema-model";
|
|
4
|
+
import g from "diagram-js/lib/core/ElementFactory";
|
|
5
|
+
import { asTRBL as ee, getMid as _ } from "diagram-js/lib/layout/LayoutUtil";
|
|
6
|
+
import te from "diagram-js/lib/draw/BaseRenderer";
|
|
7
|
+
import { append as v, attr as y, clear as b, create as x } from "tiny-svg";
|
|
8
|
+
import S from "diagram-js/lib/features/selection";
|
|
9
|
+
import C from "diagram-js/lib/navigation/zoomscroll";
|
|
10
|
+
import ne from "diagram-js/lib/navigation/movecanvas";
|
|
11
|
+
import re from "diagram-js/lib/features/connection-preview";
|
|
12
|
+
import ie from "diagram-js/lib/features/modeling";
|
|
13
|
+
import ae from "diagram-js/lib/features/move";
|
|
14
|
+
import oe from "diagram-js/lib/features/outline";
|
|
15
|
+
import se from "diagram-js/lib/features/rules";
|
|
16
|
+
import ce from "diagram-js/lib/features/rules/RuleProvider";
|
|
17
|
+
import le from "diagram-js/lib/command/CommandInterceptor";
|
|
18
|
+
import { hasPrimaryModifier as ue } from "diagram-js/lib/util/Mouse";
|
|
19
|
+
import de from "diagram-js/lib/features/palette";
|
|
20
|
+
import fe from "diagram-js/lib/features/create";
|
|
21
|
+
import w from "diagram-js/lib/features/connect";
|
|
22
|
+
import pe from "diagram-js/lib/features/lasso-tool";
|
|
23
|
+
import me from "diagram-js/lib/features/context-pad";
|
|
24
|
+
import he from "diagram-js/lib/features/popup-menu";
|
|
25
|
+
import ge from "diagram-js/lib/features/auto-place";
|
|
26
|
+
import _e from "diagram-js-direct-editing";
|
|
27
|
+
import { DEFAULT_DISTANCE as ve, findFreePosition as ye, generateGetNextPosition as be } from "diagram-js/lib/features/auto-place/AutoPlaceUtil";
|
|
28
|
+
import xe from "diagram-js/lib/features/overlays";
|
|
24
29
|
//#region src/model/di-types.ts
|
|
25
30
|
function T(e) {
|
|
26
31
|
return typeof e == "object" && e ? e.cmKind : void 0;
|
|
@@ -36,8 +41,8 @@ function O(e) {
|
|
|
36
41
|
}
|
|
37
42
|
//#endregion
|
|
38
43
|
//#region src/io/saveSvg.ts
|
|
39
|
-
var
|
|
40
|
-
function
|
|
44
|
+
var Se = 40;
|
|
45
|
+
function Ce(e, t) {
|
|
41
46
|
let n = e.getContainer().querySelector("svg");
|
|
42
47
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
43
48
|
let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
@@ -47,20 +52,20 @@ function A(e, t) {
|
|
|
47
52
|
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);
|
|
48
53
|
}
|
|
49
54
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
50
|
-
let s = r -
|
|
55
|
+
let s = r - Se, c = i - Se, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
|
|
51
56
|
d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("viewBox", `${s} ${c} ${l} ${u}`), d.setAttribute("width", String(Math.round(l))), d.setAttribute("height", String(Math.round(u)));
|
|
52
57
|
let f = d.querySelector(".viewport");
|
|
53
58
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
54
59
|
}
|
|
55
60
|
//#endregion
|
|
56
61
|
//#region src/io/types.ts
|
|
57
|
-
var
|
|
62
|
+
var we = "cm-root";
|
|
58
63
|
//#endregion
|
|
59
64
|
//#region src/CmBaseViewer.ts
|
|
60
|
-
function
|
|
65
|
+
function Te(e) {
|
|
61
66
|
return typeof e == "number" ? `${e}px` : e;
|
|
62
67
|
}
|
|
63
|
-
var
|
|
68
|
+
var k = class {
|
|
64
69
|
_diagram;
|
|
65
70
|
_container;
|
|
66
71
|
_options;
|
|
@@ -69,7 +74,7 @@ var N = class {
|
|
|
69
74
|
}
|
|
70
75
|
_createContainer(e) {
|
|
71
76
|
let t = e.container ?? document.createElement("div");
|
|
72
|
-
return t.classList.add("cm-djs-container"), t.style.width =
|
|
77
|
+
return t.classList.add("cm-djs-container"), t.style.width = Te(e.width ?? "100%"), t.style.height = Te(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
73
78
|
}
|
|
74
79
|
_ensureDiagram() {
|
|
75
80
|
if (!this._diagram) {
|
|
@@ -121,26 +126,26 @@ var N = class {
|
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
128
|
saveSVG() {
|
|
124
|
-
return
|
|
129
|
+
return Ce(this.get("canvas"), this.get("elementRegistry"));
|
|
125
130
|
}
|
|
126
|
-
_fit(e = 84, t = 56) {
|
|
127
|
-
let
|
|
128
|
-
for (let e of
|
|
131
|
+
_fit(e = 84, t = 56, n = t) {
|
|
132
|
+
let r = this.get("canvas"), i = this.get("elementRegistry"), a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
|
|
133
|
+
for (let e of i.getAll()) {
|
|
129
134
|
let t = e;
|
|
130
|
-
typeof t.x
|
|
135
|
+
typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number" && (a = Math.min(a, t.x), o = Math.min(o, t.y), s = Math.max(s, t.x + t.width), c = Math.max(c, t.y + t.height));
|
|
131
136
|
}
|
|
132
|
-
if (!Number.isFinite(
|
|
133
|
-
let
|
|
134
|
-
if (!
|
|
135
|
-
|
|
137
|
+
if (!Number.isFinite(a)) return;
|
|
138
|
+
let l = this._container.getBoundingClientRect(), u = l.width, d = l.height, f = Math.max(s - a, 1), p = Math.max(c - o, 1);
|
|
139
|
+
if (!u || !d) {
|
|
140
|
+
r.zoom("fit-viewport");
|
|
136
141
|
return;
|
|
137
142
|
}
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
x:
|
|
141
|
-
y:
|
|
142
|
-
width:
|
|
143
|
-
height:
|
|
143
|
+
let m = Math.min((u - n - t) / f, (d - e - t) / p, 1.25), h = n + (u - n - t - m * f) / 2;
|
|
144
|
+
r.viewbox({
|
|
145
|
+
x: a - h / m,
|
|
146
|
+
y: o - e / m,
|
|
147
|
+
width: u / m,
|
|
148
|
+
height: d / m
|
|
144
149
|
});
|
|
145
150
|
}
|
|
146
151
|
attachTo(e) {
|
|
@@ -158,19 +163,23 @@ var N = class {
|
|
|
158
163
|
get container() {
|
|
159
164
|
return this._container;
|
|
160
165
|
}
|
|
161
|
-
},
|
|
166
|
+
}, Ee = class {
|
|
162
167
|
elementFactory;
|
|
163
168
|
static $inject = ["elementFactory"];
|
|
164
169
|
constructor(e) {
|
|
165
170
|
this.elementFactory = e;
|
|
166
171
|
}
|
|
167
172
|
createContext(e) {
|
|
173
|
+
let t = (e.subdomainType ? u[e.subdomainType] : void 0)?.minSize ?? {
|
|
174
|
+
width: 120,
|
|
175
|
+
height: 72
|
|
176
|
+
};
|
|
168
177
|
return this.elementFactory.createShape({
|
|
169
178
|
id: e.id,
|
|
170
179
|
x: e.position.x,
|
|
171
180
|
y: e.position.y,
|
|
172
|
-
width: e.size.width,
|
|
173
|
-
height: e.size.height,
|
|
181
|
+
width: Math.max(e.size.width, t.width),
|
|
182
|
+
height: Math.max(e.size.height, t.height),
|
|
174
183
|
cmKind: "context",
|
|
175
184
|
cmLabel: e.label,
|
|
176
185
|
...e.subdomainType ? { subdomainType: e.subdomainType } : {},
|
|
@@ -196,37 +205,37 @@ var N = class {
|
|
|
196
205
|
});
|
|
197
206
|
}
|
|
198
207
|
createNewContext(e, t) {
|
|
199
|
-
let n =
|
|
208
|
+
let n = (e ? u[e] : void 0)?.defaultSize ?? u.generic.defaultSize;
|
|
200
209
|
return this.elementFactory.createShape({
|
|
201
|
-
width: n.
|
|
202
|
-
height: n.
|
|
210
|
+
width: n.width,
|
|
211
|
+
height: n.height,
|
|
203
212
|
cmKind: "context",
|
|
204
|
-
subdomainType: e,
|
|
213
|
+
...e ? { subdomainType: e } : {},
|
|
205
214
|
cmLabel: t ?? "New Context"
|
|
206
215
|
});
|
|
207
216
|
}
|
|
208
|
-
},
|
|
217
|
+
}, De = class extends g {
|
|
209
218
|
create(e, t) {
|
|
210
219
|
return !t?.id && (e === "shape" || e === "connection") && (t = {
|
|
211
220
|
...t,
|
|
212
|
-
id:
|
|
221
|
+
id: m(e === "shape" ? "ctx" : "rel")
|
|
213
222
|
}), super.create(e, t);
|
|
214
223
|
}
|
|
215
|
-
},
|
|
224
|
+
}, Oe = class {
|
|
216
225
|
docking;
|
|
217
226
|
static $inject = ["connectionDocking"];
|
|
218
227
|
constructor(e) {
|
|
219
228
|
this.docking = e;
|
|
220
229
|
}
|
|
221
230
|
layoutConnection(e, t = {}) {
|
|
222
|
-
let n = t.source ?? e.source, r = t.target ?? e.target, i = [n ?
|
|
231
|
+
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);
|
|
223
232
|
return e.waypoints = i, n && r && i.length === 2 ? this.docking.getCroppedWaypoints(e, n, r) : i;
|
|
224
233
|
}
|
|
225
|
-
},
|
|
226
|
-
elementFactory: ["type",
|
|
227
|
-
cmElementFactory: ["type",
|
|
234
|
+
}, ke = {
|
|
235
|
+
elementFactory: ["type", De],
|
|
236
|
+
cmElementFactory: ["type", Ee],
|
|
228
237
|
connectionDocking: ["type", t]
|
|
229
|
-
},
|
|
238
|
+
}, A = {
|
|
230
239
|
blau: "#335DE5",
|
|
231
240
|
blauLink: "#2B50D4",
|
|
232
241
|
blauHell: "#6B8AFF",
|
|
@@ -239,35 +248,35 @@ var N = class {
|
|
|
239
248
|
danger: "#C92A2A",
|
|
240
249
|
info: "#2B50D4",
|
|
241
250
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
242
|
-
},
|
|
243
|
-
"--cd-blau":
|
|
244
|
-
"--cd-gruen":
|
|
245
|
-
"--cd-grau":
|
|
246
|
-
"--cd-schwarz":
|
|
247
|
-
"--cd-weiss":
|
|
248
|
-
"--cd-blau-link":
|
|
249
|
-
"--cd-blau-hell":
|
|
250
|
-
"--cd-success":
|
|
251
|
+
}, Ae = {
|
|
252
|
+
"--cd-blau": A.blau,
|
|
253
|
+
"--cd-gruen": A.gruen,
|
|
254
|
+
"--cd-grau": A.grau,
|
|
255
|
+
"--cd-schwarz": A.schwarz,
|
|
256
|
+
"--cd-weiss": A.weiss,
|
|
257
|
+
"--cd-blau-link": A.blauLink,
|
|
258
|
+
"--cd-blau-hell": A.blauHell,
|
|
259
|
+
"--cd-success": A.success,
|
|
251
260
|
"--cd-success-soft": "rgba(11, 122, 85, 0.12)",
|
|
252
|
-
"--cd-warning":
|
|
261
|
+
"--cd-warning": A.warning,
|
|
253
262
|
"--cd-warning-soft": "rgba(146, 97, 10, 0.12)",
|
|
254
|
-
"--cd-danger":
|
|
263
|
+
"--cd-danger": A.danger,
|
|
255
264
|
"--cd-danger-soft": "rgba(201, 42, 42, 0.12)",
|
|
256
|
-
"--cd-info":
|
|
265
|
+
"--cd-info": A.info,
|
|
257
266
|
"--cd-info-soft": "rgba(43, 80, 212, 0.12)",
|
|
258
|
-
"--cd-gradient-brand":
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
var
|
|
267
|
+
"--cd-gradient-brand": A.gradientBrand
|
|
268
|
+
}, je = 1500;
|
|
269
|
+
A.blau;
|
|
270
|
+
var j = A.schwarz, Me = "#5B5B5B", M = {
|
|
262
271
|
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
263
272
|
label: 13.5,
|
|
264
273
|
small: 11
|
|
265
|
-
},
|
|
274
|
+
}, N = A.weiss, Ne = "#F1F1EE", Pe = "#8A8577";
|
|
266
275
|
//#endregion
|
|
267
276
|
//#region src/draw/endRoleChips.ts
|
|
268
|
-
function
|
|
277
|
+
function P(e, t, n, r) {
|
|
269
278
|
if (r.length === 0) return null;
|
|
270
|
-
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l =
|
|
279
|
+
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l = M.small * .64, u = M.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 = {
|
|
271
280
|
x: e.x + s * h,
|
|
272
281
|
y: e.y + c * h
|
|
273
282
|
};
|
|
@@ -287,31 +296,31 @@ function V(e, t, n, r) {
|
|
|
287
296
|
}
|
|
288
297
|
//#endregion
|
|
289
298
|
//#region src/draw/ContextMapsRenderer.ts
|
|
290
|
-
var
|
|
299
|
+
var Fe = class extends te {
|
|
291
300
|
static $inject = ["eventBus"];
|
|
292
301
|
constructor(e) {
|
|
293
|
-
super(e,
|
|
302
|
+
super(e, je);
|
|
294
303
|
}
|
|
295
304
|
canRender(e) {
|
|
296
305
|
return E(e);
|
|
297
306
|
}
|
|
298
307
|
drawShape(e, t) {
|
|
299
|
-
if (
|
|
300
|
-
let n =
|
|
308
|
+
if (b(e), D(t)) return this.drawContext(e, t);
|
|
309
|
+
let n = y(x("rect"), {
|
|
301
310
|
width: t.width,
|
|
302
311
|
height: t.height,
|
|
303
312
|
fill: "#eee"
|
|
304
313
|
});
|
|
305
|
-
return
|
|
314
|
+
return v(e, n), n;
|
|
306
315
|
}
|
|
307
316
|
drawConnection(e, t) {
|
|
308
|
-
if (
|
|
309
|
-
let n =
|
|
317
|
+
if (b(e), O(t)) return this.drawRelationship(e, t);
|
|
318
|
+
let n = y(x("polyline"), {
|
|
310
319
|
points: (t.waypoints ?? []).map((e) => `${e.x},${e.y}`).join(" "),
|
|
311
320
|
fill: "none",
|
|
312
|
-
stroke:
|
|
321
|
+
stroke: j
|
|
313
322
|
});
|
|
314
|
-
return
|
|
323
|
+
return v(e, n), n;
|
|
315
324
|
}
|
|
316
325
|
getShapePath(e) {
|
|
317
326
|
let { x: t, y: n, width: r, height: i } = e;
|
|
@@ -322,53 +331,52 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
322
331
|
return t.length === 0 ? "" : t.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join("");
|
|
323
332
|
}
|
|
324
333
|
drawContext(e, t) {
|
|
325
|
-
let n = t.subdomainType ?
|
|
334
|
+
let n = t.subdomainType ? u[t.subdomainType] : void 0, r = Math.max(t.width, 1), i = Math.max(t.height, 1), a = y(x("rect"), {
|
|
326
335
|
x: 1,
|
|
327
336
|
y: 1,
|
|
328
337
|
width: r - 2,
|
|
329
338
|
height: i - 2,
|
|
330
339
|
rx: 8,
|
|
331
340
|
ry: 8,
|
|
332
|
-
fill: t.fill ?? n?.fill ??
|
|
333
|
-
stroke: t.stroke ?? n?.stroke ??
|
|
341
|
+
fill: t.fill ?? n?.fill ?? "#F1F1EE",
|
|
342
|
+
stroke: t.stroke ?? n?.stroke ?? "#8A8577",
|
|
334
343
|
"stroke-width": 2,
|
|
335
344
|
"stroke-linejoin": "round"
|
|
336
345
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
m(e, _e(t.subdomainType, 15, 15, 18, n.stroke));
|
|
341
|
-
let r = h(_("text"), {
|
|
346
|
+
if (v(e, a), this.appendLabel(e, t.cmLabel ?? "", r, i, !!t.team, { "font-weight": "650" }), t.subdomainType && n) {
|
|
347
|
+
v(e, ze(t.subdomainType, 15, 15, 18, n.stroke));
|
|
348
|
+
let r = y(x("text"), {
|
|
342
349
|
x: 28,
|
|
343
350
|
y: 15,
|
|
344
|
-
"font-family":
|
|
345
|
-
"font-size":
|
|
351
|
+
"font-family": M.family,
|
|
352
|
+
"font-size": M.small,
|
|
346
353
|
"font-weight": "700",
|
|
347
354
|
fill: n.stroke,
|
|
348
355
|
"text-anchor": "start",
|
|
349
356
|
"dominant-baseline": "central",
|
|
350
357
|
"letter-spacing": "0.03em"
|
|
351
358
|
});
|
|
352
|
-
r.textContent = n.label,
|
|
359
|
+
r.textContent = n.label, v(e, r);
|
|
353
360
|
}
|
|
354
361
|
if (t.team) {
|
|
355
|
-
let n = 19 + t.team.length *
|
|
356
|
-
|
|
357
|
-
let
|
|
362
|
+
let n = 19 + t.team.length * M.small * .55, a = r / 2 - n / 2, o = i - 12, s = Ve(a + 7, o, 14, Me);
|
|
363
|
+
y(s, { class: "cm-team" }), v(e, s);
|
|
364
|
+
let c = y(x("text"), {
|
|
365
|
+
class: "cm-team",
|
|
358
366
|
x: a + 14 + 5,
|
|
359
367
|
y: o,
|
|
360
|
-
"font-family":
|
|
361
|
-
"font-size":
|
|
362
|
-
fill:
|
|
368
|
+
"font-family": M.family,
|
|
369
|
+
"font-size": M.small,
|
|
370
|
+
fill: Me,
|
|
363
371
|
"text-anchor": "start",
|
|
364
372
|
"dominant-baseline": "central"
|
|
365
373
|
});
|
|
366
|
-
|
|
374
|
+
c.textContent = t.team, v(e, c);
|
|
367
375
|
}
|
|
368
376
|
return a;
|
|
369
377
|
}
|
|
370
378
|
drawRelationship(e, t) {
|
|
371
|
-
let n =
|
|
379
|
+
let n = l[t.pattern] ?? l["upstream-downstream"], r = t.waypoints ?? [], i = n.dash, a = y(x("polyline"), {
|
|
372
380
|
points: r.map((e) => `${e.x},${e.y}`).join(" "),
|
|
373
381
|
fill: "none",
|
|
374
382
|
stroke: n.stroke,
|
|
@@ -377,11 +385,11 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
377
385
|
"stroke-linecap": "round",
|
|
378
386
|
...i ? { "stroke-dasharray": i } : {}
|
|
379
387
|
});
|
|
380
|
-
if (
|
|
388
|
+
if (v(e, a), r.length >= 2) {
|
|
381
389
|
let i = r[0], a = r[r.length - 1], o = t.upstreamRoles ?? [], s = t.downstreamRoles ?? [];
|
|
382
390
|
if (n.symmetric) {
|
|
383
391
|
let t = (i.x + a.x) / 2, r = (i.y + a.y) / 2;
|
|
384
|
-
this.chip(e, t, r, n.abbreviation,
|
|
392
|
+
this.chip(e, t, r, n.abbreviation, N, n.stroke, n.stroke);
|
|
385
393
|
} else {
|
|
386
394
|
let n = t.pattern === "customer-supplier";
|
|
387
395
|
this.endMarkers(e, i, a, n ? "S" : "U", o), this.endMarkers(e, a, i, n ? "C" : "D", s);
|
|
@@ -389,70 +397,70 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
389
397
|
}
|
|
390
398
|
return a;
|
|
391
399
|
}
|
|
392
|
-
endMarkers(e, t, n, r,
|
|
393
|
-
let
|
|
400
|
+
endMarkers(e, t, n, r, i) {
|
|
401
|
+
let a = n.x - t.x, o = n.y - t.y, c = Math.hypot(a, o) || 1, l = a / c, u = o / c, d = s[r] ?? j, f = y(x("text"), {
|
|
394
402
|
x: t.x + l * 11,
|
|
395
403
|
y: t.y + u * 11,
|
|
396
|
-
"font-family":
|
|
397
|
-
"font-size":
|
|
404
|
+
"font-family": M.family,
|
|
405
|
+
"font-size": M.small + 1,
|
|
398
406
|
"font-weight": "800",
|
|
399
407
|
fill: d,
|
|
400
|
-
stroke:
|
|
408
|
+
stroke: N,
|
|
401
409
|
"stroke-width": 3,
|
|
402
410
|
"paint-order": "stroke",
|
|
403
411
|
"text-anchor": "middle",
|
|
404
412
|
"dominant-baseline": "central"
|
|
405
413
|
});
|
|
406
|
-
f.textContent = r,
|
|
407
|
-
let p =
|
|
414
|
+
f.textContent = r, v(e, f);
|
|
415
|
+
let p = P(t, n, r, i);
|
|
408
416
|
if (!p) return;
|
|
409
|
-
let { box:
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
height: g.height,
|
|
417
|
+
let { box: m, center: h, chipWidths: g, chipHeight: ee, innerWidth: _, gap: te } = p, b = h.y, S = y(x("rect"), {
|
|
418
|
+
x: m.x,
|
|
419
|
+
y: m.y,
|
|
420
|
+
width: m.width,
|
|
421
|
+
height: m.height,
|
|
415
422
|
rx: 6,
|
|
416
423
|
ry: 6,
|
|
417
|
-
fill:
|
|
424
|
+
fill: N,
|
|
418
425
|
"fill-opacity": .96,
|
|
419
426
|
stroke: "#d9d5cc",
|
|
420
427
|
"stroke-width": 1
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
428
|
+
});
|
|
429
|
+
v(e, S);
|
|
430
|
+
let C = h.x - _ / 2;
|
|
431
|
+
i.forEach((t, n) => {
|
|
432
|
+
let r = g[n], i = s[t] ?? "#8A8577";
|
|
433
|
+
this.miniChip(e, C + r / 2, b, r, ee, t, i), C += r + te;
|
|
426
434
|
});
|
|
427
435
|
}
|
|
428
|
-
miniChip(e, t, n, r, i,
|
|
429
|
-
|
|
436
|
+
miniChip(e, t, n, r, i, a, o) {
|
|
437
|
+
let s = y(x("rect"), {
|
|
430
438
|
x: t - r / 2,
|
|
431
439
|
y: n - i / 2,
|
|
432
440
|
width: r,
|
|
433
441
|
height: i,
|
|
434
442
|
rx: 3,
|
|
435
443
|
ry: 3,
|
|
436
|
-
fill:
|
|
437
|
-
stroke:
|
|
444
|
+
fill: o,
|
|
445
|
+
stroke: Ie(o),
|
|
438
446
|
"stroke-width": 1
|
|
439
|
-
})
|
|
440
|
-
|
|
447
|
+
});
|
|
448
|
+
v(e, s);
|
|
449
|
+
let l = y(x("text"), {
|
|
441
450
|
x: t,
|
|
442
451
|
y: n,
|
|
443
|
-
"font-family":
|
|
444
|
-
"font-size":
|
|
452
|
+
"font-family": M.family,
|
|
453
|
+
"font-size": M.small,
|
|
445
454
|
"font-weight": "700",
|
|
446
|
-
fill:
|
|
455
|
+
fill: c,
|
|
447
456
|
"text-anchor": "middle",
|
|
448
457
|
"dominant-baseline": "central"
|
|
449
458
|
});
|
|
450
|
-
|
|
459
|
+
l.textContent = a, v(e, l);
|
|
451
460
|
}
|
|
452
461
|
chip(e, t, n, r, i, a, o) {
|
|
453
462
|
if (!r) return;
|
|
454
|
-
let s =
|
|
455
|
-
m(e, h(_("rect"), {
|
|
463
|
+
let s = M.small * .64, c = r.length * s + 12, l = M.small + 8, u = y(x("rect"), {
|
|
456
464
|
x: t - c / 2,
|
|
457
465
|
y: n - l / 2,
|
|
458
466
|
width: c,
|
|
@@ -462,48 +470,51 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
462
470
|
fill: i,
|
|
463
471
|
stroke: o,
|
|
464
472
|
"stroke-width": 1,
|
|
465
|
-
...i ===
|
|
466
|
-
})
|
|
467
|
-
|
|
473
|
+
...i === N ? { "fill-opacity": .95 } : {}
|
|
474
|
+
});
|
|
475
|
+
v(e, u);
|
|
476
|
+
let d = y(x("text"), {
|
|
468
477
|
x: t,
|
|
469
478
|
y: n,
|
|
470
|
-
"font-family":
|
|
471
|
-
"font-size":
|
|
479
|
+
"font-family": M.family,
|
|
480
|
+
"font-size": M.small,
|
|
472
481
|
"font-weight": "700",
|
|
473
482
|
fill: a,
|
|
474
483
|
"text-anchor": "middle",
|
|
475
484
|
"dominant-baseline": "central"
|
|
476
485
|
});
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
appendLabel(e, t, n, r, i) {
|
|
480
|
-
let
|
|
481
|
-
|
|
482
|
-
|
|
486
|
+
d.textContent = r, v(e, d);
|
|
487
|
+
}
|
|
488
|
+
appendLabel(e, t, n, r, i, a) {
|
|
489
|
+
let o = typeof a["font-size"] == "number" ? a["font-size"] : M.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l = We(t, c, o, s), u = o * 1.2, d = r - 36 - (i ? 18 : 8), f = Math.max(1, Math.floor(d / u));
|
|
490
|
+
l.length > f && (l = l.slice(0, f), l[f - 1] = Ue(l[f - 1], c, o, s));
|
|
491
|
+
let p = 36 + u / 2;
|
|
492
|
+
l.forEach((t, r) => {
|
|
493
|
+
let i = y(x("text"), {
|
|
494
|
+
class: "cm-name",
|
|
483
495
|
x: n / 2,
|
|
484
|
-
y:
|
|
485
|
-
"font-family":
|
|
486
|
-
"font-size":
|
|
487
|
-
fill:
|
|
496
|
+
y: p + r * u,
|
|
497
|
+
"font-family": M.family,
|
|
498
|
+
"font-size": o,
|
|
499
|
+
fill: j,
|
|
488
500
|
"text-anchor": "middle",
|
|
489
501
|
"dominant-baseline": "central",
|
|
490
|
-
...
|
|
502
|
+
...a
|
|
491
503
|
});
|
|
492
|
-
|
|
504
|
+
i.textContent = t, v(e, i);
|
|
493
505
|
});
|
|
494
506
|
}
|
|
495
507
|
};
|
|
496
|
-
function
|
|
508
|
+
function Ie(e, t = .7) {
|
|
497
509
|
let n = /^#([0-9a-f]{6})$/i.exec(e);
|
|
498
510
|
if (!n) return e;
|
|
499
511
|
let r = parseInt(n[1], 16);
|
|
500
512
|
return `rgb(${Math.round((r >> 16 & 255) * t)},${Math.round((r >> 8 & 255) * t)},${Math.round((r & 255) * t)})`;
|
|
501
513
|
}
|
|
502
|
-
var
|
|
503
|
-
function
|
|
514
|
+
var Le = "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", Re = "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";
|
|
515
|
+
function ze(e, t, n, r, i) {
|
|
504
516
|
if (e === "generic") {
|
|
505
|
-
let e =
|
|
506
|
-
return m(e, h(_("circle"), {
|
|
517
|
+
let e = x("g"), a = y(x("circle"), {
|
|
507
518
|
cx: t,
|
|
508
519
|
cy: n,
|
|
509
520
|
r: r / 2 - 1,
|
|
@@ -511,41 +522,76 @@ function _e(e, t, n, r, i) {
|
|
|
511
522
|
stroke: i,
|
|
512
523
|
"stroke-width": 1.6,
|
|
513
524
|
"stroke-dasharray": "2.2 2.2"
|
|
514
|
-
})
|
|
525
|
+
});
|
|
526
|
+
return v(e, a), e;
|
|
515
527
|
}
|
|
516
|
-
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s =
|
|
517
|
-
|
|
518
|
-
|
|
528
|
+
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = x("g");
|
|
529
|
+
y(s, { transform: `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}` });
|
|
530
|
+
let c = y(x("path"), {
|
|
531
|
+
d: e === "core" ? Le : Re,
|
|
519
532
|
fill: i
|
|
520
|
-
})
|
|
533
|
+
});
|
|
534
|
+
return v(s, c), s;
|
|
521
535
|
}
|
|
522
|
-
var
|
|
523
|
-
function
|
|
524
|
-
let i = n / 24, a =
|
|
525
|
-
|
|
526
|
-
|
|
536
|
+
var Be = "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z";
|
|
537
|
+
function Ve(e, t, n, r) {
|
|
538
|
+
let i = n / 24, a = x("g");
|
|
539
|
+
y(a, { transform: `translate(${e - 12 * i} ${t - 12 * i}) scale(${i})` });
|
|
540
|
+
let o = y(x("path"), {
|
|
541
|
+
d: Be,
|
|
527
542
|
fill: r
|
|
528
|
-
})
|
|
543
|
+
});
|
|
544
|
+
return v(a, o), a;
|
|
545
|
+
}
|
|
546
|
+
var F;
|
|
547
|
+
function He(e, t, n) {
|
|
548
|
+
return F === void 0 && (F = typeof document > "u" ? null : document.createElement("canvas").getContext("2d")), F ? (F.font = `${n} ${t}px ${M.family}`, F.measureText(e).width) : e.length * t * .58;
|
|
549
|
+
}
|
|
550
|
+
function Ue(e, t, n, r) {
|
|
551
|
+
let i = e;
|
|
552
|
+
for (; i && He(`${i}…`, n, r) > t;) i = i.slice(0, -1).trimEnd();
|
|
553
|
+
return `${i}…`;
|
|
529
554
|
}
|
|
530
|
-
function
|
|
531
|
-
let
|
|
555
|
+
function We(e, t, n, r) {
|
|
556
|
+
let i = e.split("\n");
|
|
557
|
+
return i.every((e) => e.trim() === "") ? [] : i.flatMap((e) => {
|
|
558
|
+
let i = Ge(e, t, n, r);
|
|
559
|
+
return i.length ? i : [""];
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
function Ge(e, t, n, r) {
|
|
563
|
+
let i = e.split(/\s+/).filter(Boolean);
|
|
532
564
|
if (i.length === 0) return [];
|
|
533
|
-
let a = [],
|
|
565
|
+
let a = (e) => He(e, n, r) <= t, o = [], s = "";
|
|
534
566
|
for (let e of i) {
|
|
535
|
-
let t =
|
|
536
|
-
|
|
567
|
+
let t = s ? `${s} ${e}` : e;
|
|
568
|
+
if (a(t)) {
|
|
569
|
+
s = t;
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
s && o.push(s);
|
|
573
|
+
let n = e;
|
|
574
|
+
for (; n && !a(n);) {
|
|
575
|
+
let e = 1, t = n.length - 1;
|
|
576
|
+
for (; e < t;) {
|
|
577
|
+
let r = Math.ceil((e + t) / 2);
|
|
578
|
+
a(n.slice(0, r)) ? e = r : t = r - 1;
|
|
579
|
+
}
|
|
580
|
+
o.push(n.slice(0, e)), n = n.slice(e);
|
|
581
|
+
}
|
|
582
|
+
s = n;
|
|
537
583
|
}
|
|
538
|
-
return
|
|
584
|
+
return s && o.push(s), o;
|
|
539
585
|
}
|
|
540
586
|
//#endregion
|
|
541
587
|
//#region src/draw/index.ts
|
|
542
|
-
var
|
|
588
|
+
var Ke = {
|
|
543
589
|
__init__: ["cmRenderer"],
|
|
544
|
-
cmRenderer: ["type",
|
|
590
|
+
cmRenderer: ["type", Fe]
|
|
545
591
|
};
|
|
546
592
|
//#endregion
|
|
547
593
|
//#region src/io/CmImporter.ts
|
|
548
|
-
function
|
|
594
|
+
function qe(e, t) {
|
|
549
595
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r;
|
|
550
596
|
if (i === 0 && a === 0) return {
|
|
551
597
|
x: n,
|
|
@@ -557,13 +603,13 @@ function G(e, t) {
|
|
|
557
603
|
y: r + a * c
|
|
558
604
|
};
|
|
559
605
|
}
|
|
560
|
-
function
|
|
606
|
+
function Je(e) {
|
|
561
607
|
return {
|
|
562
608
|
x: e.x + e.width / 2,
|
|
563
609
|
y: e.y + e.height / 2
|
|
564
610
|
};
|
|
565
611
|
}
|
|
566
|
-
var
|
|
612
|
+
var Ye = class {
|
|
567
613
|
canvas;
|
|
568
614
|
elementFactory;
|
|
569
615
|
factory;
|
|
@@ -589,7 +635,7 @@ var q = class {
|
|
|
589
635
|
n = void 0;
|
|
590
636
|
}
|
|
591
637
|
let r;
|
|
592
|
-
n && n.id === "cm-root" ? r = n : (r = this.elementFactory.createRoot({ id:
|
|
638
|
+
n && n.id === "cm-root" ? r = n : (r = this.elementFactory.createRoot({ id: we }), this.canvas.setRootElement(r)), r.businessObject = { title: e.title };
|
|
593
639
|
let i = /* @__PURE__ */ new Map();
|
|
594
640
|
for (let t of e.contexts) {
|
|
595
641
|
let e = this.factory.createContext(t);
|
|
@@ -604,7 +650,7 @@ var q = class {
|
|
|
604
650
|
});
|
|
605
651
|
continue;
|
|
606
652
|
}
|
|
607
|
-
let o = [
|
|
653
|
+
let o = [qe(e, Je(a)), qe(a, Je(e))], s = this.factory.createRelationship(n, e, a, o);
|
|
608
654
|
this.canvas.addConnection(s, r);
|
|
609
655
|
}
|
|
610
656
|
for (let e of i.values()) this.canvas.addShape(e, r);
|
|
@@ -615,7 +661,7 @@ var q = class {
|
|
|
615
661
|
"waypoints" in e ? this.canvas.removeConnection(e.id) : this.canvas.removeShape(e.id);
|
|
616
662
|
} catch {}
|
|
617
663
|
}
|
|
618
|
-
},
|
|
664
|
+
}, Xe = class {
|
|
619
665
|
elementRegistry;
|
|
620
666
|
canvas;
|
|
621
667
|
static $inject = ["elementRegistry", "canvas"];
|
|
@@ -667,64 +713,64 @@ var q = class {
|
|
|
667
713
|
}
|
|
668
714
|
}
|
|
669
715
|
return {
|
|
670
|
-
version:
|
|
716
|
+
version: i,
|
|
671
717
|
title: e?.title ?? "Untitled context map",
|
|
672
718
|
contexts: t,
|
|
673
719
|
relationships: n
|
|
674
720
|
};
|
|
675
721
|
}
|
|
676
|
-
},
|
|
677
|
-
cmImporter: ["type",
|
|
678
|
-
cmExporter: ["type",
|
|
679
|
-
},
|
|
722
|
+
}, Ze = {
|
|
723
|
+
cmImporter: ["type", Ye],
|
|
724
|
+
cmExporter: ["type", Xe]
|
|
725
|
+
}, Qe = class extends k {
|
|
680
726
|
_getModules() {
|
|
681
727
|
return [
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
728
|
+
ke,
|
|
729
|
+
Ke,
|
|
730
|
+
Ze
|
|
685
731
|
];
|
|
686
732
|
}
|
|
687
|
-
},
|
|
733
|
+
}, $e = class extends Qe {
|
|
688
734
|
_getModules() {
|
|
689
735
|
return [
|
|
690
736
|
...super._getModules(),
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
737
|
+
S,
|
|
738
|
+
C,
|
|
739
|
+
ne
|
|
694
740
|
];
|
|
695
741
|
}
|
|
696
742
|
};
|
|
697
743
|
//#endregion
|
|
698
744
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
699
|
-
function
|
|
745
|
+
function et(e, t, n) {
|
|
700
746
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
701
747
|
}
|
|
702
|
-
var
|
|
748
|
+
var tt = class {
|
|
703
749
|
execute(e) {
|
|
704
750
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
705
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
751
|
+
for (let e of Object.keys(n)) i[e] = r[e], et(r, e, n[e]);
|
|
706
752
|
return e.oldProperties = i, [t];
|
|
707
753
|
}
|
|
708
754
|
revert(e) {
|
|
709
755
|
let { element: t, oldProperties: n } = e, r = t;
|
|
710
|
-
if (n) for (let e of Object.keys(n))
|
|
756
|
+
if (n) for (let e of Object.keys(n)) et(r, e, n[e]);
|
|
711
757
|
return [t];
|
|
712
758
|
}
|
|
713
759
|
};
|
|
714
760
|
//#endregion
|
|
715
761
|
//#region src/modeling/cmd/SwapEndsHandler.ts
|
|
716
|
-
function
|
|
762
|
+
function I(e) {
|
|
717
763
|
let t = e.source;
|
|
718
764
|
return e.source = e.target, e.target = t, Array.isArray(e.waypoints) && (e.waypoints = [...e.waypoints].reverse()), [e];
|
|
719
765
|
}
|
|
720
|
-
var
|
|
766
|
+
var nt = class {
|
|
721
767
|
execute(e) {
|
|
722
|
-
return
|
|
768
|
+
return I(e.connection);
|
|
723
769
|
}
|
|
724
770
|
revert(e) {
|
|
725
|
-
return
|
|
771
|
+
return I(e.connection);
|
|
726
772
|
}
|
|
727
|
-
},
|
|
773
|
+
}, rt = "element.updateProperties", it = "relationship.swapEnds", at = class {
|
|
728
774
|
commandStack;
|
|
729
775
|
elementRegistry;
|
|
730
776
|
graphicsFactory;
|
|
@@ -734,17 +780,17 @@ var we = class {
|
|
|
734
780
|
"graphicsFactory"
|
|
735
781
|
];
|
|
736
782
|
constructor(e, t, n) {
|
|
737
|
-
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(
|
|
783
|
+
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(rt, tt), e.registerHandler(it, nt);
|
|
738
784
|
}
|
|
739
785
|
redraw(e) {
|
|
740
786
|
let t = this.elementRegistry.getGraphics(e);
|
|
741
787
|
t && this.graphicsFactory.update(O(e) ? "connection" : "shape", e, t);
|
|
742
788
|
}
|
|
743
789
|
swapEnds(e) {
|
|
744
|
-
this.commandStack.execute(
|
|
790
|
+
this.commandStack.execute(it, { connection: e }), this.redraw(e);
|
|
745
791
|
}
|
|
746
792
|
updateProperties(e, t) {
|
|
747
|
-
this.commandStack.execute(
|
|
793
|
+
this.commandStack.execute(rt, {
|
|
748
794
|
element: e,
|
|
749
795
|
properties: t
|
|
750
796
|
}), this.redraw(e);
|
|
@@ -769,7 +815,7 @@ var we = class {
|
|
|
769
815
|
}
|
|
770
816
|
setPattern(e, t) {
|
|
771
817
|
let n = { pattern: t };
|
|
772
|
-
if (
|
|
818
|
+
if (p(t)) n.upstreamRoles = void 0, n.downstreamRoles = void 0;
|
|
773
819
|
else if (t === "customer-supplier") {
|
|
774
820
|
let t = (e.upstreamRoles ?? []).filter((e) => e !== "OHS"), r = (e.downstreamRoles ?? []).filter((e) => e !== "CF");
|
|
775
821
|
n.upstreamRoles = t.length ? t : void 0, n.downstreamRoles = r.length ? r : void 0;
|
|
@@ -785,36 +831,36 @@ var we = class {
|
|
|
785
831
|
setImplementationTechnology(e, t) {
|
|
786
832
|
this.updateProperties(e, { implementationTechnology: t || void 0 });
|
|
787
833
|
}
|
|
788
|
-
},
|
|
834
|
+
}, L = {
|
|
789
835
|
__init__: ["cmModeling"],
|
|
790
|
-
cmModeling: ["type",
|
|
791
|
-
layouter: ["type",
|
|
792
|
-
},
|
|
836
|
+
cmModeling: ["type", at],
|
|
837
|
+
layouter: ["type", Oe]
|
|
838
|
+
}, ot = class extends ce {
|
|
793
839
|
static $inject = ["eventBus"];
|
|
794
840
|
constructor(e) {
|
|
795
841
|
super(e);
|
|
796
842
|
}
|
|
797
843
|
init() {
|
|
798
|
-
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !
|
|
844
|
+
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) => ct(e.source, e.target)), this.addRule("connection.reconnect", (e) => !!ct(e.source, e.target, e.connection)), this.addRule("connection.updateWaypoints", () => !0);
|
|
799
845
|
}
|
|
800
846
|
};
|
|
801
|
-
function
|
|
847
|
+
function st(e, t, n) {
|
|
802
848
|
let { incoming: r = [], outgoing: i = [] } = e;
|
|
803
849
|
return [...r, ...i].some((r) => r !== n && (r.source === e && r.target === t || r.source === t && r.target === e));
|
|
804
850
|
}
|
|
805
|
-
function
|
|
806
|
-
return !D(e) || !D(t) || e === t ||
|
|
851
|
+
function ct(e, t, n) {
|
|
852
|
+
return !D(e) || !D(t) || e === t || st(e, t, n) ? !1 : {
|
|
807
853
|
cmKind: "relationship",
|
|
808
854
|
pattern: "upstream-downstream"
|
|
809
855
|
};
|
|
810
856
|
}
|
|
811
857
|
//#endregion
|
|
812
858
|
//#region src/rules/index.ts
|
|
813
|
-
var
|
|
814
|
-
__depends__: [
|
|
859
|
+
var R = {
|
|
860
|
+
__depends__: [se],
|
|
815
861
|
__init__: ["cmRules"],
|
|
816
|
-
cmRules: ["type",
|
|
817
|
-
},
|
|
862
|
+
cmRules: ["type", ot]
|
|
863
|
+
}, lt = class extends le {
|
|
818
864
|
static $inject = [
|
|
819
865
|
"eventBus",
|
|
820
866
|
"canvas",
|
|
@@ -823,89 +869,120 @@ var Me = {
|
|
|
823
869
|
constructor(e, t, n) {
|
|
824
870
|
super(e), this.preExecute(["shape.create", "elements.create"], (e) => {
|
|
825
871
|
e.parent = t.getRootElement();
|
|
826
|
-
}, !0)
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
872
|
+
}, !0);
|
|
873
|
+
let r = null;
|
|
874
|
+
this.preExecute("elements.move", (e) => {
|
|
875
|
+
r = new Set((e.shapes ?? []).map((e) => e.id));
|
|
876
|
+
}, !0), this.postExecuted("elements.move", () => {
|
|
877
|
+
r = null;
|
|
878
|
+
}, !0), this.postExecute(["shape.move", "shape.resize"], (e) => {
|
|
879
|
+
let t = e.shapes ?? (e.shape ? [e.shape] : []), i = /* @__PURE__ */ new Set();
|
|
832
880
|
for (let e of t) {
|
|
833
881
|
let t = [...e.incoming ?? [], ...e.outgoing ?? []];
|
|
834
|
-
for (let e of t)
|
|
882
|
+
for (let e of t) {
|
|
883
|
+
if (i.has(e.id)) continue;
|
|
884
|
+
i.add(e.id);
|
|
885
|
+
let t = e.source?.id, a = e.target?.id;
|
|
886
|
+
t && a && r?.has(t) && r.has(a) || n.layoutConnection(e);
|
|
887
|
+
}
|
|
835
888
|
}
|
|
836
889
|
}, !0);
|
|
837
890
|
}
|
|
838
|
-
},
|
|
891
|
+
}, ut = "cm-dragging", dt = class {
|
|
839
892
|
static $inject = ["eventBus", "canvas"];
|
|
840
893
|
constructor(e, t) {
|
|
841
894
|
e.on("drag.init", () => {
|
|
842
|
-
t.getContainer().classList.add(
|
|
895
|
+
t.getContainer().classList.add(ut);
|
|
843
896
|
}), e.on("drag.cleanup", () => {
|
|
844
|
-
t.getContainer().classList.remove(
|
|
897
|
+
t.getContainer().classList.remove(ut);
|
|
845
898
|
});
|
|
846
899
|
}
|
|
847
|
-
},
|
|
900
|
+
}, ft = 2e3, pt = {
|
|
848
901
|
__init__: [
|
|
849
902
|
"cmFlatModelBehavior",
|
|
850
903
|
"cmDragBehavior",
|
|
851
904
|
"cmClickSelectionBehavior"
|
|
852
905
|
],
|
|
853
|
-
cmFlatModelBehavior: ["type",
|
|
854
|
-
cmDragBehavior: ["type",
|
|
906
|
+
cmFlatModelBehavior: ["type", lt],
|
|
907
|
+
cmDragBehavior: ["type", dt],
|
|
855
908
|
cmClickSelectionBehavior: ["type", class {
|
|
856
909
|
static $inject = ["eventBus", "selection"];
|
|
857
910
|
constructor(e, t) {
|
|
858
|
-
e.on("element.click",
|
|
911
|
+
e.on("element.click", ft, (e) => {
|
|
859
912
|
let n = e.element;
|
|
860
|
-
if (E(n) && !
|
|
913
|
+
if (E(n) && !ue(e) && t.isSelected(n)) return !1;
|
|
861
914
|
});
|
|
862
915
|
}
|
|
863
916
|
}]
|
|
864
917
|
};
|
|
865
918
|
//#endregion
|
|
866
919
|
//#region src/draw/palette-icons.ts
|
|
867
|
-
function
|
|
868
|
-
return `<svg class="cm-palette-svg" width="
|
|
920
|
+
function z(e, t = 24) {
|
|
921
|
+
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
|
|
869
922
|
}
|
|
870
|
-
var
|
|
871
|
-
function
|
|
923
|
+
var mt = "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", ht = "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";
|
|
924
|
+
function gt(e, t, n, r, i) {
|
|
872
925
|
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"/>`;
|
|
873
926
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}`;
|
|
874
|
-
return `<path d="${e === "core" ?
|
|
927
|
+
return `<path d="${e === "core" ? mt : ht}" fill="${i}" transform="${s}"/>`;
|
|
928
|
+
}
|
|
929
|
+
function B(e) {
|
|
930
|
+
let t = e ? u[e] : void 0;
|
|
931
|
+
return z(!e || !t ? `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${Ne}" stroke="${Pe}" 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"/>` + gt(e, 13, 13, 12, t.stroke));
|
|
932
|
+
}
|
|
933
|
+
function _t(e, t = 18) {
|
|
934
|
+
let n = u[e], r = n?.stroke ?? "#8A8577";
|
|
935
|
+
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" ? mt : ht}" fill="${r}"/>`}</svg>`;
|
|
875
936
|
}
|
|
876
|
-
function
|
|
877
|
-
|
|
878
|
-
return Re(`<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5"/>` + Ve(e, 13, 13, 12, t.stroke));
|
|
937
|
+
function V(e) {
|
|
938
|
+
return z(`<rect x="1" y="6.5" width="24" height="13" rx="3" fill="${s[e] ?? "#8A8577"}"/><text x="13" y="16.4" text-anchor="middle" font-size="9.5" font-weight="700" fill="${c}" font-family="${M.family}">${e}</text>`);
|
|
879
939
|
}
|
|
880
|
-
function
|
|
881
|
-
let
|
|
882
|
-
return
|
|
940
|
+
function H(e = "upstream-downstream", t = 24) {
|
|
941
|
+
let n = l[e] ?? l["upstream-downstream"], r = n.dash ? ` stroke-dasharray="${n.dash}"` : "", i = Math.min(n.strokeWidth, 2.6);
|
|
942
|
+
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);
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/draw/icons.ts
|
|
946
|
+
var vt = "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z", yt = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", bt = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", xt = "M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z", St = "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z", Ct = "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z", wt = "M3 18h12v-2H3v2zM3 6v2h18V6H3zm0 7h18v-2H3v2z", Tt = "M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z";
|
|
947
|
+
function U(e, t = 18) {
|
|
948
|
+
return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
|
|
949
|
+
}
|
|
950
|
+
function Et(e = 18) {
|
|
951
|
+
return `<svg width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="2" stroke-dasharray="3.2 2.6"/></svg>`;
|
|
883
952
|
}
|
|
884
953
|
//#endregion
|
|
885
954
|
//#region src/palette/CmPaletteProvider.ts
|
|
886
|
-
var
|
|
887
|
-
function
|
|
888
|
-
return `<div class="entry cm-palette-entry" draggable
|
|
955
|
+
var Dt = "tools", Ot = "cm-1-contexts";
|
|
956
|
+
function kt(e, t, n = !0) {
|
|
957
|
+
return `<div class="entry cm-palette-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${e}</div>`;
|
|
889
958
|
}
|
|
890
|
-
var
|
|
959
|
+
var At = class {
|
|
891
960
|
create;
|
|
961
|
+
lassoTool;
|
|
892
962
|
factory;
|
|
893
963
|
static $inject = [
|
|
894
964
|
"palette",
|
|
895
965
|
"create",
|
|
966
|
+
"lassoTool",
|
|
896
967
|
"cmElementFactory"
|
|
897
968
|
];
|
|
898
|
-
constructor(e, t, n) {
|
|
899
|
-
this.create = t, this.
|
|
969
|
+
constructor(e, t, n, r) {
|
|
970
|
+
this.create = t, this.lassoTool = n, this.factory = r, e.registerProvider(this);
|
|
900
971
|
}
|
|
901
972
|
getPaletteEntries() {
|
|
902
|
-
let e = {};
|
|
903
|
-
|
|
973
|
+
let e = {}, t = "Lasso tool — drag a box to select multiple elements";
|
|
974
|
+
e["lasso-tool"] = {
|
|
975
|
+
group: Dt,
|
|
976
|
+
title: t,
|
|
977
|
+
html: kt(Et(), t, !1),
|
|
978
|
+
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
979
|
+
};
|
|
980
|
+
for (let t of r) {
|
|
904
981
|
let n = (e) => this.create.start(e, this.factory.createNewContext(t.type, t.label));
|
|
905
982
|
e[`context.${t.type}`] = {
|
|
906
|
-
group:
|
|
983
|
+
group: Ot,
|
|
907
984
|
title: `${t.label} — ${t.description}`,
|
|
908
|
-
html:
|
|
985
|
+
html: kt(B(t.type), `${t.label} — ${t.description}`),
|
|
909
986
|
action: {
|
|
910
987
|
dragstart: n,
|
|
911
988
|
click: n
|
|
@@ -914,190 +991,590 @@ var Ke = class {
|
|
|
914
991
|
}
|
|
915
992
|
return e;
|
|
916
993
|
}
|
|
917
|
-
},
|
|
994
|
+
}, jt = {
|
|
918
995
|
__depends__: [
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
996
|
+
de,
|
|
997
|
+
fe,
|
|
998
|
+
w,
|
|
999
|
+
pe
|
|
922
1000
|
],
|
|
923
1001
|
__init__: ["cmPaletteProvider"],
|
|
924
|
-
cmPaletteProvider: ["type",
|
|
925
|
-
},
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1002
|
+
cmPaletteProvider: ["type", At]
|
|
1003
|
+
}, Mt = {
|
|
1004
|
+
name: "cm-direct-editing",
|
|
1005
|
+
team: "cm-direct-editing-team"
|
|
1006
|
+
}, Nt = 10, Pt = 20, Ft = class {
|
|
1007
|
+
canvas;
|
|
1008
|
+
directEditing;
|
|
1009
|
+
modeling;
|
|
1010
|
+
static $inject = [
|
|
1011
|
+
"eventBus",
|
|
1012
|
+
"canvas",
|
|
1013
|
+
"directEditing",
|
|
1014
|
+
"cmModeling"
|
|
1015
|
+
];
|
|
1016
|
+
mode = "name";
|
|
1017
|
+
activeMarker;
|
|
1018
|
+
constructor(e, t, n, r) {
|
|
1019
|
+
this.canvas = t, this.directEditing = n, this.modeling = r, n.registerProvider({
|
|
1020
|
+
activate: (e) => this.activationContext(e),
|
|
1021
|
+
update: (e, t) => this.commit(e, t)
|
|
1022
|
+
}), e.on("element.dblclick", (e) => {
|
|
1023
|
+
let t = e.element;
|
|
1024
|
+
E(t) && (this.mode = D(t) && t.team && this.isInTeamBand(t, e.originalEvent) ? "team" : "name", n.activate(t));
|
|
1025
|
+
}), e.on(["canvas.viewbox.changing", "drag.init"], () => n.complete()), e.on("directEditing.activate", (e) => {
|
|
1026
|
+
let n = e.active?.element;
|
|
1027
|
+
if (!n) return;
|
|
1028
|
+
let r = Mt[this.mode];
|
|
1029
|
+
t.addMarker(n, r), this.activeMarker = {
|
|
1030
|
+
element: n,
|
|
1031
|
+
marker: r
|
|
1032
|
+
};
|
|
1033
|
+
}), e.on(["directEditing.complete", "directEditing.cancel"], () => {
|
|
1034
|
+
let e = this.activeMarker;
|
|
1035
|
+
e && t.removeMarker(e.element, e.marker), this.activeMarker = void 0;
|
|
1036
|
+
});
|
|
947
1037
|
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1038
|
+
activate(e) {
|
|
1039
|
+
this.mode = "name", this.directEditing.activate(e);
|
|
1040
|
+
}
|
|
1041
|
+
activateTeam(e) {
|
|
1042
|
+
this.mode = "team", this.directEditing.activate(e);
|
|
1043
|
+
}
|
|
1044
|
+
cancel() {
|
|
1045
|
+
this.directEditing.cancel();
|
|
1046
|
+
}
|
|
1047
|
+
isInTeamBand(e, t) {
|
|
1048
|
+
if (typeof t?.clientY != "number") return !1;
|
|
1049
|
+
let n = this.canvas.zoom(), r = this.canvas.getAbsoluteBBox(e), i = this.canvas.getContainer().getBoundingClientRect().top;
|
|
1050
|
+
return t.clientY - i >= r.y + r.height - 22 * n;
|
|
1051
|
+
}
|
|
1052
|
+
activationContext(e) {
|
|
1053
|
+
if (!E(e)) return;
|
|
1054
|
+
this.mode === "team" && !D(e) && (this.mode = "name");
|
|
1055
|
+
let t = this.canvas.zoom(), n = this.canvas.getAbsoluteBBox(e);
|
|
1056
|
+
if (this.mode === "team") {
|
|
1057
|
+
let r = e;
|
|
1058
|
+
return {
|
|
1059
|
+
bounds: {
|
|
1060
|
+
x: n.x + Nt * t,
|
|
1061
|
+
y: n.y + n.height - 22 * t,
|
|
1062
|
+
width: n.width - 20 * t,
|
|
1063
|
+
height: Pt * t
|
|
1064
|
+
},
|
|
1065
|
+
text: r.team ?? "",
|
|
1066
|
+
style: {
|
|
1067
|
+
fontFamily: M.family,
|
|
1068
|
+
fontSize: `${M.small * t}px`,
|
|
1069
|
+
fontWeight: 400,
|
|
1070
|
+
lineHeight: 1.2,
|
|
1071
|
+
backgroundColor: "transparent",
|
|
1072
|
+
border: "1px dashed rgba(51, 93, 229, 0.65)",
|
|
1073
|
+
textAlign: "center"
|
|
1074
|
+
},
|
|
1075
|
+
options: { centerVertically: !0 }
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
let r = {
|
|
1079
|
+
fontFamily: M.family,
|
|
1080
|
+
fontSize: `${M.label * t}px`,
|
|
1081
|
+
fontWeight: 650,
|
|
1082
|
+
lineHeight: 1.2,
|
|
1083
|
+
backgroundColor: "transparent",
|
|
1084
|
+
border: "1px dashed rgba(51, 93, 229, 0.65)",
|
|
1085
|
+
textAlign: "center"
|
|
963
1086
|
};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1087
|
+
if (D(e)) {
|
|
1088
|
+
let i = e.team ? 18 * t : 0;
|
|
1089
|
+
return {
|
|
1090
|
+
bounds: {
|
|
1091
|
+
x: n.x + Nt * t,
|
|
1092
|
+
y: n.y + 36 * t - 1,
|
|
1093
|
+
width: n.width - 20 * t,
|
|
1094
|
+
height: n.height - 36 * t - i
|
|
1095
|
+
},
|
|
1096
|
+
text: e.cmLabel ?? "",
|
|
1097
|
+
style: r
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
let i = 160 * t, a = 44 * t;
|
|
1101
|
+
return {
|
|
1102
|
+
bounds: {
|
|
1103
|
+
x: n.x + n.width / 2 - i / 2,
|
|
1104
|
+
y: n.y + n.height / 2 - a / 2,
|
|
1105
|
+
width: i,
|
|
1106
|
+
height: a
|
|
1107
|
+
},
|
|
1108
|
+
text: e.cmLabel ?? "",
|
|
1109
|
+
style: {
|
|
1110
|
+
...r,
|
|
1111
|
+
backgroundColor: "rgba(255, 255, 255, 0.95)"
|
|
1112
|
+
},
|
|
1113
|
+
options: { centerVertically: !0 }
|
|
967
1114
|
};
|
|
968
1115
|
}
|
|
1116
|
+
commit(e, t) {
|
|
1117
|
+
let n = t.trim();
|
|
1118
|
+
if (this.mode === "team") {
|
|
1119
|
+
let t = e;
|
|
1120
|
+
if (n === (t.team ?? "")) return;
|
|
1121
|
+
this.modeling.setTeam(t, n || void 0);
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1125
|
+
}
|
|
1126
|
+
}, W = {
|
|
1127
|
+
__depends__: [_e, L],
|
|
1128
|
+
__init__: ["cmLabelEditing"],
|
|
1129
|
+
cmLabelEditing: ["type", Ft]
|
|
1130
|
+
}, G = "cm-subdomain-menu", It = "cm-pattern-menu", K = "cm-roles-menu", q = "cm-popup-active", J = 8, Lt = {
|
|
1131
|
+
OHS: "Open Host Service is one-size-fits-all and not applicable in a customer-supplier relationship.",
|
|
1132
|
+
CF: "Conformist is not applicable in a customer-supplier relationship — a customer can negotiate."
|
|
1133
|
+
};
|
|
1134
|
+
function Y(e, t, n = {}) {
|
|
1135
|
+
let r = n.draggable ? " draggable=\"true\"" : "";
|
|
1136
|
+
return `<div class="entry cm-pad-entry${n.danger ? " cm-pad-entry--danger" : ""}"${r} title="${t}">${e}</div>`;
|
|
969
1137
|
}
|
|
970
|
-
var
|
|
1138
|
+
var Rt = class {
|
|
1139
|
+
contextPad;
|
|
1140
|
+
popupMenu;
|
|
971
1141
|
eventBus;
|
|
972
|
-
|
|
973
|
-
|
|
1142
|
+
create;
|
|
1143
|
+
autoPlace;
|
|
1144
|
+
rules;
|
|
974
1145
|
dragging;
|
|
1146
|
+
modeling;
|
|
1147
|
+
cmModeling;
|
|
1148
|
+
labelEditing;
|
|
1149
|
+
elementFactory;
|
|
1150
|
+
selection;
|
|
1151
|
+
canvas;
|
|
1152
|
+
scheduler;
|
|
975
1153
|
static $inject = [
|
|
1154
|
+
"contextPad",
|
|
1155
|
+
"popupMenu",
|
|
976
1156
|
"eventBus",
|
|
977
|
-
"selection",
|
|
978
|
-
"overlays",
|
|
979
1157
|
"connect",
|
|
980
|
-
"
|
|
1158
|
+
"create",
|
|
1159
|
+
"autoPlace",
|
|
1160
|
+
"rules",
|
|
1161
|
+
"dragging",
|
|
1162
|
+
"modeling",
|
|
1163
|
+
"cmModeling",
|
|
1164
|
+
"cmLabelEditing",
|
|
1165
|
+
"cmElementFactory",
|
|
1166
|
+
"selection",
|
|
1167
|
+
"canvas",
|
|
1168
|
+
"scheduler"
|
|
981
1169
|
];
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1170
|
+
currentMenu;
|
|
1171
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
1172
|
+
this.contextPad = e, this.popupMenu = t, this.eventBus = n, this.create = i, this.autoPlace = a, this.rules = o, this.dragging = s, this.modeling = c, this.cmModeling = l, this.labelEditing = u, this.elementFactory = d, this.selection = f, this.canvas = p, this.scheduler = m, e.registerProvider(this), t.registerProvider(G, { getPopupMenuEntries: (e) => this.subdomainMenuEntries(e) }), t.registerProvider(It, { getPopupMenuEntries: (e) => this.patternMenuEntries(e) }), t.registerProvider(K, { getPopupMenuEntries: (e) => this.rolesMenuEntries(e) }), n.on("autoPlace", (e) => {
|
|
1173
|
+
let { source: t, shape: n } = e, r = {
|
|
1174
|
+
x: ee(t).right + ve + n.width / 2,
|
|
1175
|
+
y: _(t).y
|
|
1176
|
+
};
|
|
1177
|
+
return ye(t, n, r, be({ y: {
|
|
1178
|
+
margin: 30,
|
|
1179
|
+
minDistance: 30
|
|
1180
|
+
} }));
|
|
1181
|
+
}), n.on("contextPad.create", (e) => {
|
|
1182
|
+
let { pad: t, target: n } = e;
|
|
1183
|
+
if (!t) return;
|
|
1184
|
+
let r = !1, i = !1;
|
|
1185
|
+
if (O(n)) {
|
|
1186
|
+
let e = n.waypoints ?? [], t = e[e.length - 1], a = e[e.length - 2];
|
|
1187
|
+
if (t && a) {
|
|
1188
|
+
let e = t.x - a.x, n = t.y - a.y;
|
|
1189
|
+
r = Math.abs(e) >= Math.abs(n) && e > 0, i = Math.abs(n) > Math.abs(e) && n > 0;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
t.classList.toggle("cm-pad-flip-x", r), t.classList.toggle("cm-pad-flip-y", i);
|
|
1193
|
+
}), n.on([
|
|
1194
|
+
"contextPad.open",
|
|
1195
|
+
"contextPad.show",
|
|
1196
|
+
"canvas.viewbox.changed"
|
|
1197
|
+
], 250, () => this.clampPadIntoView());
|
|
1198
|
+
}
|
|
1199
|
+
clampPadIntoView() {
|
|
1200
|
+
this.scheduler.schedule(() => {
|
|
1201
|
+
let e = this.canvas.getContainer(), t = e.querySelector(".djs-context-pad.open");
|
|
1202
|
+
if (!t) return;
|
|
1203
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.right - (n.right - 4);
|
|
1204
|
+
i > 0 && (t.style.left = `${parseFloat(t.style.left || "0") - i}px`);
|
|
1205
|
+
let a = n.left + 4 - r.left;
|
|
1206
|
+
a > 0 && (t.style.left = `${parseFloat(t.style.left || "0") + a}px`);
|
|
1207
|
+
let o = 0, s = r.bottom - (n.bottom - 4);
|
|
1208
|
+
s > 0 && (o = -s);
|
|
1209
|
+
let c = n.top + 4 - (r.top + o);
|
|
1210
|
+
c > 0 && (o += c), o !== 0 && (t.style.top = `${parseFloat(t.style.top || "0") + o}px`);
|
|
1211
|
+
}, "cmContextPad#clampIntoView");
|
|
1212
|
+
}
|
|
1213
|
+
getContextPadEntries(e) {
|
|
1214
|
+
return D(e) ? this.contextEntries(e) : O(e) ? this.relationshipEntries(e) : {};
|
|
1215
|
+
}
|
|
1216
|
+
getMultiElementContextPadEntries(e) {
|
|
1217
|
+
let t = e.filter(E);
|
|
1218
|
+
return t.length === e.length ? { delete: this.deleteEntry(t, "Delete selection") } : {};
|
|
1219
|
+
}
|
|
1220
|
+
contextEntries(e) {
|
|
1221
|
+
let t = e.subdomainType ? u[e.subdomainType] : void 0;
|
|
1222
|
+
return {
|
|
1223
|
+
"append-context": {
|
|
1224
|
+
group: "edit",
|
|
1225
|
+
html: Y(U(Ct), "Append a connected context — click to place automatically, drag to position", { draggable: !0 }),
|
|
1226
|
+
action: {
|
|
1227
|
+
click: () => this.appendContext(e),
|
|
1228
|
+
dragstart: (t) => this.startAppend(t, e)
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
connect: {
|
|
1232
|
+
group: "edit",
|
|
1233
|
+
html: Y(U(vt), "Connect to another context", { draggable: !0 }),
|
|
1234
|
+
action: {
|
|
1235
|
+
click: (t) => this.startConnect(t, e, !0),
|
|
1236
|
+
dragstart: (t) => this.startConnect(t, e, !1)
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1239
|
+
"subdomain-type": {
|
|
1240
|
+
group: "edit",
|
|
1241
|
+
html: Y(B(e.subdomainType), `Change subdomain type — currently ${t?.label ?? "unclassified"}`),
|
|
1242
|
+
action: { click: (t) => this.openMenu(t, e, G, "Subdomain type") }
|
|
1243
|
+
},
|
|
1244
|
+
team: {
|
|
1245
|
+
group: "edit",
|
|
1246
|
+
html: Y(U(Tt), `Set owning team — currently ${e.team ?? "none"}`),
|
|
1247
|
+
action: { click: () => this.labelEditing.activateTeam(e) }
|
|
1248
|
+
},
|
|
1249
|
+
"edit-label": this.editLabelEntry(e, "Rename context"),
|
|
1250
|
+
description: this.descriptionEntry(e, "Purpose, ubiquitous language, notes…"),
|
|
1251
|
+
delete: this.deleteEntry([e], "Delete context")
|
|
1252
|
+
};
|
|
986
1253
|
}
|
|
987
|
-
|
|
988
|
-
this.
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
1008
|
-
this.selection.get().length === 0 && this.selection.select(t);
|
|
1009
|
-
}));
|
|
1010
|
-
}), this.overlays.add(t, Xe, {
|
|
1011
|
-
position: et(e, n),
|
|
1012
|
-
html: i
|
|
1254
|
+
startConnect(e, t, n) {
|
|
1255
|
+
if (this.dragging.init(e, "connect", {
|
|
1256
|
+
autoActivate: n,
|
|
1257
|
+
trapClick: !1,
|
|
1258
|
+
data: {
|
|
1259
|
+
shape: t,
|
|
1260
|
+
context: {
|
|
1261
|
+
start: t,
|
|
1262
|
+
connectionStart: _(t)
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}), n) {
|
|
1266
|
+
let e = () => !1;
|
|
1267
|
+
this.eventBus.once("connect.cleanup", 250, () => {
|
|
1268
|
+
this.eventBus.once("element.click", 1e4, e);
|
|
1269
|
+
let t = () => this.eventBus.off("element.click", e);
|
|
1270
|
+
document.addEventListener("mouseup", () => setTimeout(t, 0), {
|
|
1271
|
+
capture: !0,
|
|
1272
|
+
once: !0
|
|
1273
|
+
}), setTimeout(t, 400);
|
|
1013
1274
|
});
|
|
1014
1275
|
}
|
|
1276
|
+
this.eventBus.once("connect.cleanup", 250, () => {
|
|
1277
|
+
this.selection.get().length === 0 && this.selection.select(t);
|
|
1278
|
+
});
|
|
1015
1279
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1280
|
+
appendContext(e) {
|
|
1281
|
+
let t = this.elementFactory.createNewContext(), n = this.rules.allowed("connection.create", {
|
|
1282
|
+
source: e,
|
|
1283
|
+
target: t
|
|
1284
|
+
}), r = this.autoPlace.append(e, t, n && typeof n == "object" ? { connection: n } : {});
|
|
1285
|
+
this.openTypeMenu(r);
|
|
1286
|
+
}
|
|
1287
|
+
startAppend(e, t) {
|
|
1288
|
+
let n = this.elementFactory.createNewContext(), r = () => this.openTypeMenu(n);
|
|
1289
|
+
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 });
|
|
1290
|
+
}
|
|
1291
|
+
openTypeMenu(e) {
|
|
1292
|
+
this.scheduler.schedule(() => {
|
|
1293
|
+
if (!this.contextPad.isOpen(e)) return;
|
|
1294
|
+
let t = this.canvas.getContainer().querySelector(".djs-context-pad.open [data-action=\"subdomain-type\"]");
|
|
1295
|
+
t && this.openMenuBeside(t.getBoundingClientRect(), e, G, "Subdomain type");
|
|
1296
|
+
}, "cmContextPad#openTypeMenu");
|
|
1297
|
+
}
|
|
1298
|
+
relationshipEntries(e) {
|
|
1299
|
+
let t = l[e.pattern], n = { pattern: {
|
|
1300
|
+
group: "edit",
|
|
1301
|
+
html: Y(H(t?.pattern), `Change pattern — currently ${t?.label ?? e.pattern}`),
|
|
1302
|
+
action: { click: (t) => this.openMenu(t, e, It, "Relationship pattern") }
|
|
1303
|
+
} };
|
|
1304
|
+
return t && !t.symmetric && (n.roles = {
|
|
1305
|
+
group: "edit",
|
|
1306
|
+
html: Y(U(St), "Edit integration roles — OHS/PL upstream, ACL/CF downstream"),
|
|
1307
|
+
action: { click: (t) => this.openMenu(t, e, K, "Integration roles") }
|
|
1308
|
+
}, n["swap-ends"] = {
|
|
1309
|
+
group: "edit",
|
|
1310
|
+
html: Y(U(xt), "Swap ends — reverse upstream/downstream"),
|
|
1311
|
+
action: { click: () => this.cmModeling.swapEnds(e) }
|
|
1312
|
+
}), 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;
|
|
1313
|
+
}
|
|
1314
|
+
editLabelEntry(e, t) {
|
|
1315
|
+
return {
|
|
1316
|
+
group: "edit",
|
|
1317
|
+
html: Y(U(yt), `${t} — edit the name in place`),
|
|
1318
|
+
action: { click: () => this.labelEditing.activate(e) }
|
|
1319
|
+
};
|
|
1041
1320
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
e.key === "Enter" ? (e.preventDefault(), d()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1054
|
-
}, p = () => d();
|
|
1055
|
-
c.addEventListener("keydown", f), c.addEventListener("blur", p), this.active = {
|
|
1056
|
-
commit: d,
|
|
1057
|
-
cleanup: u
|
|
1321
|
+
descriptionEntry(e, t) {
|
|
1322
|
+
return {
|
|
1323
|
+
group: "edit",
|
|
1324
|
+
html: Y(U(wt), "Edit description"),
|
|
1325
|
+
action: { click: (n) => this.openPrompt(n, {
|
|
1326
|
+
value: e.description ?? "",
|
|
1327
|
+
placeholder: t,
|
|
1328
|
+
label: "Description",
|
|
1329
|
+
multiline: !0,
|
|
1330
|
+
onCommit: (t) => this.cmModeling.setDescription(e, t || void 0)
|
|
1331
|
+
}) }
|
|
1058
1332
|
};
|
|
1059
1333
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1334
|
+
activePrompt;
|
|
1335
|
+
openPrompt(e, t) {
|
|
1336
|
+
this.activePrompt?.cancel();
|
|
1337
|
+
let n = (e.delegateTarget ?? e.target).getBoundingClientRect(), r = document.createElement("div");
|
|
1338
|
+
r.className = "cm-pad-prompt", r.style.left = `${n.right + J}px`, r.style.top = `${n.top}px`;
|
|
1339
|
+
let i = document.createElement(t.multiline ? "textarea" : "input");
|
|
1340
|
+
if (i.className = "cm-pad-prompt__field", i.value = t.value, i.placeholder = t.placeholder, i.setAttribute("aria-label", t.label), i instanceof HTMLTextAreaElement && (i.rows = 4), r.appendChild(i), t.multiline) {
|
|
1341
|
+
let e = document.createElement("div");
|
|
1342
|
+
e.className = "cm-pad-prompt__hint", e.textContent = "Esc to cancel · ⌘/Ctrl+Enter to save", r.appendChild(e);
|
|
1343
|
+
}
|
|
1344
|
+
this.canvas.getContainer().appendChild(r);
|
|
1345
|
+
let a = r.getBoundingClientRect();
|
|
1346
|
+
a.right > window.innerWidth - 8 && (r.style.left = `${Math.max(8, n.left - a.width - J)}px`), a.bottom > window.innerHeight - 8 && (r.style.top = `${Math.max(8, window.innerHeight - 8 - a.height)}px`), i.focus(), i instanceof HTMLTextAreaElement ? i.setSelectionRange(i.value.length, i.value.length) : i.select();
|
|
1347
|
+
let o = () => l();
|
|
1348
|
+
this.eventBus.on("canvas.viewbox.changing", o);
|
|
1349
|
+
let s = !1, c = () => {
|
|
1350
|
+
s || (s = !0, this.eventBus.off("canvas.viewbox.changing", o), r.remove(), this.activePrompt = void 0, this.canvas.restoreFocus?.());
|
|
1351
|
+
}, l = () => {
|
|
1352
|
+
if (s) return;
|
|
1353
|
+
let e = i.value.trim(), n = e !== t.value.trim();
|
|
1354
|
+
c(), n && t.onCommit(e);
|
|
1355
|
+
};
|
|
1356
|
+
i.addEventListener("keydown", (e) => {
|
|
1357
|
+
let n = e;
|
|
1358
|
+
n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), c()) : n.key === "Enter" && (!t.multiline || n.ctrlKey || n.metaKey) && (n.preventDefault(), l());
|
|
1359
|
+
}), i.addEventListener("blur", l), this.activePrompt = { cancel: c };
|
|
1062
1360
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1361
|
+
deleteEntry(e, t) {
|
|
1362
|
+
return {
|
|
1363
|
+
group: "delete",
|
|
1364
|
+
html: Y(U(bt), t, { danger: !0 }),
|
|
1365
|
+
action: { click: () => this.modeling.removeElements(e) }
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
openMenu(e, t, n, r) {
|
|
1369
|
+
let i = e.delegateTarget ?? e.target;
|
|
1370
|
+
this.openMenuBeside(i.getBoundingClientRect(), t, n, r);
|
|
1371
|
+
}
|
|
1372
|
+
openMenuBeside(e, t, n, r) {
|
|
1373
|
+
let i = {
|
|
1374
|
+
x: e.right + J,
|
|
1375
|
+
y: e.top
|
|
1376
|
+
};
|
|
1377
|
+
this.popupMenu.open(t, n, i, { title: r });
|
|
1378
|
+
let a = document.querySelector(".djs-popup"), o = a?.getBoundingClientRect();
|
|
1379
|
+
a && o && o.left < e.right && (i.x = Math.max(J, e.left - J - o.width), a.style.left = `${i.x}px`), this.currentMenu = {
|
|
1380
|
+
element: t,
|
|
1381
|
+
menuId: n,
|
|
1382
|
+
title: r,
|
|
1383
|
+
position: i
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
reopenMenu(e, t) {
|
|
1387
|
+
let n = this.currentMenu;
|
|
1388
|
+
!n || n.menuId !== t || n.element !== e || this.popupMenu.open(e, t, n.position, { title: n.title });
|
|
1389
|
+
}
|
|
1390
|
+
subdomainMenuEntries(e) {
|
|
1391
|
+
if (!D(e)) return {};
|
|
1392
|
+
let t = e.subdomainType, n = {};
|
|
1393
|
+
for (let i of r) n[`type-${i.type}`] = {
|
|
1394
|
+
label: i.label,
|
|
1395
|
+
description: i.description,
|
|
1396
|
+
imageHtml: B(i.type),
|
|
1397
|
+
...i.type === t ? { className: q } : {},
|
|
1398
|
+
action: () => {
|
|
1399
|
+
i.type !== t && this.cmModeling.setSubdomainType(e, i.type);
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
return n["type-none"] = {
|
|
1403
|
+
label: "Unclassified",
|
|
1404
|
+
description: "No subdomain classification.",
|
|
1405
|
+
imageHtml: B(),
|
|
1406
|
+
...t === void 0 ? { className: q } : {},
|
|
1407
|
+
action: () => {
|
|
1408
|
+
t !== void 0 && this.cmModeling.setSubdomainType(e, void 0);
|
|
1409
|
+
}
|
|
1410
|
+
}, n;
|
|
1411
|
+
}
|
|
1412
|
+
patternMenuEntries(e) {
|
|
1413
|
+
if (!O(e)) return {};
|
|
1414
|
+
let t = e.pattern, r = {};
|
|
1415
|
+
for (let i of n) r[`pattern-${i.pattern}`] = {
|
|
1416
|
+
label: i.label,
|
|
1417
|
+
description: i.description,
|
|
1418
|
+
imageHtml: H(i.pattern),
|
|
1419
|
+
...i.pattern === t ? { className: q } : {},
|
|
1420
|
+
action: () => {
|
|
1421
|
+
i.pattern !== t && this.cmModeling.setPattern(e, i.pattern);
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
return r;
|
|
1425
|
+
}
|
|
1426
|
+
rolesMenuEntries(e) {
|
|
1427
|
+
if (!O(e)) return {};
|
|
1428
|
+
let t = l[e.pattern];
|
|
1429
|
+
if (!t || t.symmetric) return {};
|
|
1430
|
+
let n = e.pattern === "customer-supplier", r = e.upstreamRoles ?? [], i = e.downstreamRoles ?? [], s = {};
|
|
1431
|
+
for (let t of d) {
|
|
1432
|
+
let i = r.includes(t), a = n ? Lt[t] : void 0, o = a !== void 0 && !i;
|
|
1433
|
+
s[`upstream-${t}`] = {
|
|
1434
|
+
label: f[t].label,
|
|
1435
|
+
description: a ? i ? `${a} Click to remove it.` : a : f[t].description,
|
|
1436
|
+
imageHtml: V(t),
|
|
1437
|
+
group: {
|
|
1438
|
+
id: "upstream",
|
|
1439
|
+
name: "Upstream (from) — OHS and/or PL"
|
|
1440
|
+
},
|
|
1441
|
+
...o ? { disabled: !0 } : {},
|
|
1442
|
+
...i ? { className: q } : {},
|
|
1443
|
+
action: () => {
|
|
1444
|
+
o || (this.cmModeling.setUpstreamRoles(e, i ? r.filter((e) => e !== t) : [...r, t]), this.reopenMenu(e, K));
|
|
1445
|
+
}
|
|
1072
1446
|
};
|
|
1073
1447
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1448
|
+
for (let t of a) {
|
|
1449
|
+
let r = i.includes(t), a = n ? Lt[t] : void 0, c = a !== void 0 && !r;
|
|
1450
|
+
s[`downstream-${t}`] = {
|
|
1451
|
+
label: o[t].label,
|
|
1452
|
+
description: a ? r ? `${a} Click to remove it.` : a : o[t].description,
|
|
1453
|
+
imageHtml: V(t),
|
|
1454
|
+
group: {
|
|
1455
|
+
id: "downstream",
|
|
1456
|
+
name: "Downstream (to) — ACL or CF, not both"
|
|
1457
|
+
},
|
|
1458
|
+
...c ? { disabled: !0 } : {},
|
|
1459
|
+
...r ? { className: q } : {},
|
|
1460
|
+
action: () => {
|
|
1461
|
+
c || (this.cmModeling.setDownstreamRoles(e, r ? [] : [t]), this.reopenMenu(e, K));
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
return s;
|
|
1081
1466
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1467
|
+
}, zt = {
|
|
1468
|
+
__depends__: [
|
|
1469
|
+
me,
|
|
1470
|
+
he,
|
|
1471
|
+
w,
|
|
1472
|
+
fe,
|
|
1473
|
+
ge,
|
|
1474
|
+
S,
|
|
1475
|
+
ie,
|
|
1476
|
+
L,
|
|
1477
|
+
R,
|
|
1478
|
+
W
|
|
1479
|
+
],
|
|
1480
|
+
__init__: ["cmContextPadProvider"],
|
|
1481
|
+
cmContextPadProvider: ["type", Rt]
|
|
1482
|
+
}, Bt = [
|
|
1483
|
+
{
|
|
1484
|
+
token: "OHS",
|
|
1485
|
+
...f.OHS
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
token: "PL",
|
|
1489
|
+
...f.PL
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
token: "ACL",
|
|
1493
|
+
...o.ACL
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
token: "CF",
|
|
1497
|
+
...o.CF
|
|
1498
|
+
}
|
|
1499
|
+
];
|
|
1500
|
+
function X(e, t, n) {
|
|
1501
|
+
let r = document.createElement("div");
|
|
1502
|
+
r.className = "cm-legend__row cm-legend-item";
|
|
1503
|
+
let i = document.createElement("span");
|
|
1504
|
+
i.textContent = t;
|
|
1505
|
+
let a = document.createElement("span");
|
|
1506
|
+
return a.className = "cm-legend-tip", a.textContent = n, r.addEventListener("mouseenter", () => {
|
|
1507
|
+
let e = r.getBoundingClientRect();
|
|
1508
|
+
a.style.left = `${e.right + 10}px`, a.style.top = `${e.top + e.height / 2}px`;
|
|
1509
|
+
}), r.append(e, i, a), r;
|
|
1087
1510
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1511
|
+
function Vt(e) {
|
|
1512
|
+
let t = document.createElement("span");
|
|
1513
|
+
return t.className = "cm-legend__icon", t.innerHTML = e, t;
|
|
1514
|
+
}
|
|
1515
|
+
function Ht(e) {
|
|
1516
|
+
let t = document.createElement("span");
|
|
1517
|
+
return t.className = "cm-legend__mark", t.style.background = s[e], t.textContent = e, t;
|
|
1518
|
+
}
|
|
1519
|
+
function Z(e, t) {
|
|
1520
|
+
let n = document.createElement("div");
|
|
1521
|
+
return n.className = "cm-legend__group", n.setAttribute("aria-label", e), n.append(...t), n;
|
|
1522
|
+
}
|
|
1523
|
+
function Ut() {
|
|
1524
|
+
let e = document.createElement("div");
|
|
1525
|
+
return e.className = "cm-legend__divider", e;
|
|
1526
|
+
}
|
|
1527
|
+
var Wt = class {
|
|
1528
|
+
static $inject = ["canvas", "eventBus"];
|
|
1529
|
+
openState = !0;
|
|
1530
|
+
host;
|
|
1531
|
+
constructor(e, t) {
|
|
1532
|
+
this.host = document.createElement("div"), e.getContainer().appendChild(this.host), this.render(), t.on("diagram.destroy", () => this.host.remove());
|
|
1533
|
+
}
|
|
1534
|
+
isOpen() {
|
|
1535
|
+
return this.openState;
|
|
1536
|
+
}
|
|
1537
|
+
setOpen(e) {
|
|
1538
|
+
this.openState !== e && (this.openState = e, this.render());
|
|
1539
|
+
}
|
|
1540
|
+
toggle() {
|
|
1541
|
+
this.setOpen(!this.openState);
|
|
1542
|
+
}
|
|
1543
|
+
render() {
|
|
1544
|
+
let e = this.host.contains(this.host.ownerDocument.activeElement);
|
|
1545
|
+
this.host.replaceChildren(this.openState ? this.panel() : this.collapsedButton()), e && this.host.querySelector(".cm-legend__close, .cm-legend-toggle")?.focus();
|
|
1546
|
+
}
|
|
1547
|
+
panel() {
|
|
1548
|
+
let e = document.createElement("div");
|
|
1549
|
+
e.className = "cm-legend", e.setAttribute("aria-label", "Legend");
|
|
1550
|
+
let t = document.createElement("div");
|
|
1551
|
+
t.className = "cm-legend__head";
|
|
1552
|
+
let i = document.createElement("strong");
|
|
1553
|
+
i.textContent = "Legend";
|
|
1554
|
+
let a = document.createElement("button");
|
|
1555
|
+
a.type = "button", a.className = "cm-legend__close", a.setAttribute("aria-expanded", "true"), a.setAttribute("aria-label", "Collapse legend"), a.textContent = "–", a.addEventListener("click", () => this.toggle()), t.append(i, a);
|
|
1556
|
+
let o = Z("Subdomain types", r.map((e) => X(Vt(_t(e.type)), e.label, e.description))), s = Z("Integration roles", Bt.map((e) => X(Ht(e.token), e.label, `${e.label} — ${e.description}`))), c = Z("Relationship patterns", n.map((e) => X(Vt(H(e.pattern, 18)), `${e.abbreviation} · ${e.label}`, e.description))), l = document.createElement("div");
|
|
1557
|
+
return l.className = "cm-legend__body", l.append(o, Ut(), s, Ut(), c), e.append(t, l), e;
|
|
1558
|
+
}
|
|
1559
|
+
collapsedButton() {
|
|
1560
|
+
let e = document.createElement("button");
|
|
1561
|
+
e.type = "button", e.className = "cm-legend-toggle", e.setAttribute("aria-expanded", "false"), e.setAttribute("aria-label", "Show legend");
|
|
1562
|
+
let t = document.createElement("span");
|
|
1563
|
+
t.setAttribute("aria-hidden", "true"), t.textContent = "▤";
|
|
1564
|
+
let n = document.createElement("span");
|
|
1565
|
+
return n.textContent = "Legend", e.append(t, n), e.addEventListener("click", () => this.toggle()), e;
|
|
1566
|
+
}
|
|
1567
|
+
}, Gt = {
|
|
1568
|
+
__init__: ["cmLegend"],
|
|
1569
|
+
cmLegend: ["type", Wt]
|
|
1093
1570
|
};
|
|
1094
1571
|
//#endregion
|
|
1095
1572
|
//#region src/keyboard/CmKeyboard.ts
|
|
1096
|
-
function
|
|
1573
|
+
function Kt(e) {
|
|
1097
1574
|
let t = e;
|
|
1098
1575
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
1099
1576
|
}
|
|
1100
|
-
var
|
|
1577
|
+
var qt = class {
|
|
1101
1578
|
static $inject = [
|
|
1102
1579
|
"canvas",
|
|
1103
1580
|
"commandStack",
|
|
@@ -1106,7 +1583,7 @@ var st = class {
|
|
|
1106
1583
|
];
|
|
1107
1584
|
constructor(e, t, n, r) {
|
|
1108
1585
|
(e.getContainer().ownerDocument ?? document).addEventListener("keydown", (e) => {
|
|
1109
|
-
if (
|
|
1586
|
+
if (Kt(e.target)) return;
|
|
1110
1587
|
let i = e.ctrlKey || e.metaKey, a = e.key.toLowerCase();
|
|
1111
1588
|
if (i && a === "z" && !e.shiftKey) e.preventDefault(), t.canUndo() && t.undo();
|
|
1112
1589
|
else if (i && a === "z" && e.shiftKey || i && a === "y") e.preventDefault(), t.canRedo() && t.redo();
|
|
@@ -1116,12 +1593,12 @@ var st = class {
|
|
|
1116
1593
|
}
|
|
1117
1594
|
});
|
|
1118
1595
|
}
|
|
1119
|
-
},
|
|
1596
|
+
}, Jt = {
|
|
1120
1597
|
__init__: ["cmKeyboard"],
|
|
1121
|
-
cmKeyboard: ["type",
|
|
1122
|
-
},
|
|
1123
|
-
function
|
|
1124
|
-
let t = e.some((e) => e.kind === "error") ?
|
|
1598
|
+
cmKeyboard: ["type", qt]
|
|
1599
|
+
}, Yt = "cm-validation", Q = 20, $ = 16, Xt = 44, Zt = "#d97706", Qt = "#dc2626";
|
|
1600
|
+
function $t(e) {
|
|
1601
|
+
let t = e.some((e) => e.kind === "error") ? Qt : Zt, n = document.createElement("div");
|
|
1125
1602
|
n.className = "cm-validation-marker", n.innerHTML = `<svg width="${Q}" height="${Q}" viewBox="0 0 24 24"><path d="M12 2.5 23 21.5H1Z" fill="${t}" stroke="#fff" stroke-width="1.6" stroke-linejoin="round"/><text x="12" y="18.5" text-anchor="middle" font-size="12" font-weight="800" fill="#fff" font-family="system-ui, sans-serif">!</text></svg>`;
|
|
1126
1603
|
let r = document.createElement("div");
|
|
1127
1604
|
r.className = "cm-validation-tooltip";
|
|
@@ -1131,13 +1608,13 @@ function pt(e) {
|
|
|
1131
1608
|
}
|
|
1132
1609
|
return n.appendChild(r), n;
|
|
1133
1610
|
}
|
|
1134
|
-
function
|
|
1611
|
+
function en(e, t, n) {
|
|
1135
1612
|
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;
|
|
1136
1613
|
if (n === "middle") return {
|
|
1137
1614
|
x: (r.x + i.x) / 2 + -l * $,
|
|
1138
1615
|
y: (r.y + i.y) / 2 + c * $
|
|
1139
1616
|
};
|
|
1140
|
-
let u = e.pattern === "customer-supplier", d = n === "upstream" ?
|
|
1617
|
+
let u = e.pattern === "customer-supplier", d = n === "upstream" ? P(r, i, u ? "S" : "U", e.upstreamRoles ?? []) : P(i, r, u ? "C" : "D", e.downstreamRoles ?? []);
|
|
1141
1618
|
if (d) {
|
|
1142
1619
|
let e = {
|
|
1143
1620
|
x: d.box.x + d.box.width,
|
|
@@ -1148,7 +1625,7 @@ function mt(e, t, n) {
|
|
|
1148
1625
|
y: e.y + 1
|
|
1149
1626
|
};
|
|
1150
1627
|
}
|
|
1151
|
-
let f = Math.min(
|
|
1628
|
+
let f = Math.min(Xt, s * .35), p = n === "upstream" ? r.x + c * f : i.x - c * f, m = n === "upstream" ? r.y + l * f : i.y - l * f;
|
|
1152
1629
|
return {
|
|
1153
1630
|
x: p + -l * $,
|
|
1154
1631
|
y: m + c * $
|
|
@@ -1156,8 +1633,8 @@ function mt(e, t, n) {
|
|
|
1156
1633
|
}
|
|
1157
1634
|
//#endregion
|
|
1158
1635
|
//#region src/validation/index.ts
|
|
1159
|
-
var
|
|
1160
|
-
__depends__: [
|
|
1636
|
+
var tn = {
|
|
1637
|
+
__depends__: [xe],
|
|
1161
1638
|
__init__: ["cmValidationMarkers"],
|
|
1162
1639
|
cmValidationMarkers: ["type", class {
|
|
1163
1640
|
elementRegistry;
|
|
@@ -1175,8 +1652,8 @@ var ht = {
|
|
|
1175
1652
|
e.on("import.render.done", i), e.on("commandStack.changed", i);
|
|
1176
1653
|
}
|
|
1177
1654
|
refresh() {
|
|
1178
|
-
this.overlays.remove({ type:
|
|
1179
|
-
let e =
|
|
1655
|
+
this.overlays.remove({ type: Yt });
|
|
1656
|
+
let e = h(this.exporter.export()), t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
1180
1657
|
for (let r of e) {
|
|
1181
1658
|
if (!r.relationshipId) continue;
|
|
1182
1659
|
let e = `${r.relationshipId} ${r.side ?? "middle"}`, i = t.get(e) ?? {
|
|
@@ -1195,13 +1672,13 @@ var ht = {
|
|
|
1195
1672
|
if (!O(t)) continue;
|
|
1196
1673
|
let r = t.waypoints ?? [];
|
|
1197
1674
|
if (r.length < 2) continue;
|
|
1198
|
-
let i = e.split(" ")[1], { x: a, y: o } =
|
|
1199
|
-
this.overlays.add(t,
|
|
1675
|
+
let i = e.split(" ")[1], { x: a, y: o } = en(t, r, i), s = Math.min(...r.map((e) => e.x)), c = Math.min(...r.map((e) => e.y));
|
|
1676
|
+
this.overlays.add(t, Yt, {
|
|
1200
1677
|
position: {
|
|
1201
1678
|
left: a - s - Q / 2,
|
|
1202
1679
|
top: o - c - Q / 2
|
|
1203
1680
|
},
|
|
1204
|
-
html:
|
|
1681
|
+
html: $t(n.findings)
|
|
1205
1682
|
});
|
|
1206
1683
|
}
|
|
1207
1684
|
}
|
|
@@ -1209,10 +1686,10 @@ var ht = {
|
|
|
1209
1686
|
};
|
|
1210
1687
|
//#endregion
|
|
1211
1688
|
//#region src/zorder/CmZOrder.ts
|
|
1212
|
-
function
|
|
1689
|
+
function nn(e) {
|
|
1213
1690
|
return +!O(e);
|
|
1214
1691
|
}
|
|
1215
|
-
var
|
|
1692
|
+
var rn = class {
|
|
1216
1693
|
canvas;
|
|
1217
1694
|
elementRegistry;
|
|
1218
1695
|
static $inject = [
|
|
@@ -1231,33 +1708,33 @@ var _t = class {
|
|
|
1231
1708
|
});
|
|
1232
1709
|
}
|
|
1233
1710
|
reorder() {
|
|
1234
|
-
let e = this.elementRegistry.getAll().filter(E).sort((e, t) =>
|
|
1711
|
+
let e = this.elementRegistry.getAll().filter(E).sort((e, t) => nn(e) - nn(t));
|
|
1235
1712
|
for (let t of e) {
|
|
1236
1713
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
1237
1714
|
e && n && n.appendChild(e);
|
|
1238
1715
|
}
|
|
1239
1716
|
}
|
|
1240
|
-
},
|
|
1717
|
+
}, an = {
|
|
1241
1718
|
__init__: ["cmZOrder"],
|
|
1242
|
-
cmZOrder: ["type",
|
|
1243
|
-
},
|
|
1719
|
+
cmZOrder: ["type", rn]
|
|
1720
|
+
}, on = class extends $e {
|
|
1244
1721
|
_getModules() {
|
|
1245
1722
|
return [
|
|
1246
1723
|
...super._getModules(),
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1724
|
+
re,
|
|
1725
|
+
ie,
|
|
1726
|
+
ae,
|
|
1727
|
+
oe,
|
|
1728
|
+
L,
|
|
1729
|
+
R,
|
|
1730
|
+
pt,
|
|
1731
|
+
jt,
|
|
1732
|
+
zt,
|
|
1733
|
+
Gt,
|
|
1734
|
+
W,
|
|
1735
|
+
Jt,
|
|
1736
|
+
tn,
|
|
1737
|
+
an
|
|
1261
1738
|
];
|
|
1262
1739
|
}
|
|
1263
1740
|
undo() {
|
|
@@ -1272,8 +1749,101 @@ var _t = class {
|
|
|
1272
1749
|
canRedo() {
|
|
1273
1750
|
return this.get("commandStack").canRedo();
|
|
1274
1751
|
}
|
|
1752
|
+
}, sn = "cm-connect-handle", cn = 28, ln = 12, un = [
|
|
1753
|
+
{
|
|
1754
|
+
side: "top",
|
|
1755
|
+
rotationDeg: -90
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
side: "right",
|
|
1759
|
+
rotationDeg: 0
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
side: "bottom",
|
|
1763
|
+
rotationDeg: 90
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
side: "left",
|
|
1767
|
+
rotationDeg: 180
|
|
1768
|
+
}
|
|
1769
|
+
];
|
|
1770
|
+
function dn(e, t) {
|
|
1771
|
+
let n = t.width / 2 - cn / 2, r = t.height / 2 - cn / 2;
|
|
1772
|
+
switch (e) {
|
|
1773
|
+
case "top": return {
|
|
1774
|
+
top: -40,
|
|
1775
|
+
left: n
|
|
1776
|
+
};
|
|
1777
|
+
case "bottom": return {
|
|
1778
|
+
top: t.height + ln,
|
|
1779
|
+
left: n
|
|
1780
|
+
};
|
|
1781
|
+
case "left": return {
|
|
1782
|
+
top: r,
|
|
1783
|
+
left: -40
|
|
1784
|
+
};
|
|
1785
|
+
case "right": return {
|
|
1786
|
+
top: r,
|
|
1787
|
+
left: t.width + ln
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
var fn = class {
|
|
1792
|
+
eventBus;
|
|
1793
|
+
selection;
|
|
1794
|
+
overlays;
|
|
1795
|
+
dragging;
|
|
1796
|
+
static $inject = [
|
|
1797
|
+
"eventBus",
|
|
1798
|
+
"selection",
|
|
1799
|
+
"overlays",
|
|
1800
|
+
"connect",
|
|
1801
|
+
"dragging"
|
|
1802
|
+
];
|
|
1803
|
+
constructor(e, t, n, r, i) {
|
|
1804
|
+
this.eventBus = e, this.selection = t, this.overlays = n, this.dragging = i;
|
|
1805
|
+
let a = () => this.refresh();
|
|
1806
|
+
e.on("selection.changed", a), e.on("commandStack.changed", a);
|
|
1807
|
+
}
|
|
1808
|
+
refresh() {
|
|
1809
|
+
this.overlays.remove({ type: sn });
|
|
1810
|
+
let e = this.selection.get();
|
|
1811
|
+
if (e.length !== 1) return;
|
|
1812
|
+
let t = e[0];
|
|
1813
|
+
if (!D(t)) return;
|
|
1814
|
+
let n = t;
|
|
1815
|
+
for (let { side: e, rotationDeg: r } of un) {
|
|
1816
|
+
let i = document.createElement("div");
|
|
1817
|
+
i.className = "cm-connect-handle", i.dataset.side = e, i.title = "Connect to another context", i.innerHTML = `<span style="display:flex;transform:rotate(${r}deg)">${U(vt)}</span>`, i.addEventListener("mousedown", (e) => {
|
|
1818
|
+
e.button === 0 && (e.preventDefault(), e.stopPropagation(), this.dragging.init(e, "connect", {
|
|
1819
|
+
autoActivate: !1,
|
|
1820
|
+
trapClick: !1,
|
|
1821
|
+
data: {
|
|
1822
|
+
shape: t,
|
|
1823
|
+
context: {
|
|
1824
|
+
start: t,
|
|
1825
|
+
connectionStart: _(t)
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
1829
|
+
this.selection.get().length === 0 && this.selection.select(t);
|
|
1830
|
+
}));
|
|
1831
|
+
}), this.overlays.add(t, sn, {
|
|
1832
|
+
position: dn(e, n),
|
|
1833
|
+
html: i
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
}, pn = {
|
|
1838
|
+
__depends__: [
|
|
1839
|
+
w,
|
|
1840
|
+
xe,
|
|
1841
|
+
S
|
|
1842
|
+
],
|
|
1843
|
+
__init__: ["cmConnectHandles"],
|
|
1844
|
+
cmConnectHandles: ["type", fn]
|
|
1275
1845
|
};
|
|
1276
1846
|
//#endregion
|
|
1277
|
-
export {
|
|
1847
|
+
export { Ae as CD_TOKENS, k as CmBaseViewer, fn as CmConnectHandles, Rt as CmContextPadProvider, Ee as CmElementFactory, Xe as CmExporter, lt as CmFlatModelBehavior, Ye as CmImporter, qt as CmKeyboard, Ft as CmLabelEditing, Wt as CmLegend, at as CmModeling, At as CmPaletteProvider, ot as CmRules, rn as CmZOrder, Fe as ContextMapsRenderer, A as MIRAGON, on as Modeler, $e as NavigatedViewer, we as ROOT_ID, Qe as Viewer, pt as cmBehaviorsModule, pn as cmConnectHandlesModule, zt as cmContextPadModule, Ke as cmDrawModule, Jt as cmKeyboardModule, W as cmLabelEditingModule, Gt as cmLegendModule, ke as cmModelModule, L as cmModelingModule, jt as cmPaletteModule, R as cmRulesModule, an as cmZOrderModule, B as contextIconSvg, Ze as ioModule, D as isCmContext, E as isCmElement, O as isCmRelationship, H as relationshipIconSvg, V as roleChipSvg, Ce as saveSVG, _t as subdomainIconSvg };
|
|
1278
1848
|
|
|
1279
1849
|
//# sourceMappingURL=index.js.map
|