@miragon/context-maps-renderer 0.2.0 → 0.3.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 +80 -10
- package/dist/CmBaseViewer.d.ts +55 -8
- 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/NavigatedViewer.d.ts +1 -1
- package/dist/NavigatedViewer.d.ts.map +1 -1
- package/dist/chrome/ShortcutsDialog.d.ts +13 -0
- package/dist/chrome/ShortcutsDialog.d.ts.map +1 -0
- package/dist/chrome/TitleDialog.d.ts +15 -0
- package/dist/chrome/TitleDialog.d.ts.map +1 -0
- package/dist/chrome/dialog.d.ts +39 -0
- package/dist/chrome/dialog.d.ts.map +1 -0
- package/dist/chrome/index.d.ts +10 -0
- package/dist/chrome/index.d.ts.map +1 -0
- package/dist/chrome/menu.d.ts +50 -0
- package/dist/chrome/menu.d.ts.map +1 -0
- package/dist/chrome/shortcuts.d.ts +41 -0
- package/dist/chrome/shortcuts.d.ts.map +1 -0
- package/dist/collaborative/CollaborativeContextMaps.d.ts +28 -0
- package/dist/collaborative/CollaborativeContextMaps.d.ts.map +1 -0
- package/dist/collaborative/index.d.ts +2 -0
- package/dist/collaborative/index.d.ts.map +1 -0
- package/dist/connect-handles/CmConnectHandles.d.ts +3 -1
- package/dist/connect-handles/CmConnectHandles.d.ts.map +1 -1
- package/dist/connect-handles/index.d.ts.map +1 -1
- package/dist/context-maps.css +1 -1
- package/dist/context-pad/CmContextPadProvider.d.ts +5 -1
- package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -1
- package/dist/context-pad/index.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +29 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/hover-tooltip/CmHoverTooltip.d.ts +16 -0
- package/dist/hover-tooltip/CmHoverTooltip.d.ts.map +1 -0
- package/dist/hover-tooltip/index.d.ts +5 -0
- package/dist/hover-tooltip/index.d.ts.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1365 -636
- package/dist/index.js.map +1 -1
- package/dist/io/CmExporter.d.ts +1 -3
- package/dist/io/CmExporter.d.ts.map +1 -1
- package/dist/io/CmImporter.d.ts +13 -1
- package/dist/io/CmImporter.d.ts.map +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/io/types.d.ts +10 -1
- package/dist/io/types.d.ts.map +1 -1
- package/dist/keyboard/CmKeyboard.d.ts +11 -1
- package/dist/keyboard/CmKeyboard.d.ts.map +1 -1
- package/dist/keyboard/index.d.ts +2 -1
- package/dist/keyboard/index.d.ts.map +1 -1
- package/dist/label-editing/CmLabelEditing.d.ts +28 -1
- package/dist/label-editing/CmLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/legend/CmLegend.d.ts.map +1 -1
- package/dist/legend/index.d.ts +6 -0
- package/dist/legend/index.d.ts.map +1 -1
- package/dist/legend/legendContent.d.ts +38 -0
- package/dist/legend/legendContent.d.ts.map +1 -0
- package/dist/model/CmElementFactory.d.ts.map +1 -1
- package/dist/model/di-types.d.ts +4 -0
- package/dist/model/di-types.d.ts.map +1 -1
- package/dist/modeling/CmModeling.d.ts +2 -0
- package/dist/modeling/CmModeling.d.ts.map +1 -1
- package/dist/modeling/cmd/UpdateTitleHandler.d.ts +17 -0
- package/dist/modeling/cmd/UpdateTitleHandler.d.ts.map +1 -0
- package/dist/palette/CmPaletteProvider.d.ts +27 -2
- package/dist/palette/CmPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +2 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/read-only/CmReadOnly.d.ts +20 -0
- package/dist/read-only/CmReadOnly.d.ts.map +1 -0
- package/dist/read-only/index.d.ts +5 -0
- package/dist/read-only/index.d.ts.map +1 -0
- package/dist/theme/palette.d.ts +26 -22
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/validation/CmValidationMarkers.d.ts.map +1 -1
- package/package.json +15 -7
- package/dist/draw/icons.d.ts +0 -16
- package/dist/draw/icons.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,71 +1,80 @@
|
|
|
1
1
|
import e from "diagram-js/lib/Diagram";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { asTRBL as
|
|
6
|
-
import
|
|
7
|
-
import { append as v, attr as y, clear as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { hasPrimaryModifier as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { DEFAULT_DISTANCE as
|
|
28
|
-
import
|
|
2
|
+
import { ALL_PATTERN_SPECS as t, ALL_SUBDOMAIN_SPECS as n, CONTEXT_KEYS as r, DIAGRAM_ROOT_ID as i, DOCUMENT_KEYS as a, DOCUMENT_VERSION as o, DOWNSTREAM_ROLES as s, DOWNSTREAM_ROLE_SPECS as c, MARK_COLORS as l, MARK_TEXT_COLOR as u, RELATIONSHIP_KEYS as d, RELATIONSHIP_PATTERN_SPECS as f, SUBDOMAIN_TYPE_SPECS as p, UPSTREAM_ROLES as m, UPSTREAM_ROLE_SPECS as h, foreignFields as g, isReservedId as ee, isSymmetricPattern as te, newId as ne, parseDocumentText as re, serializeDocumentText as ie, validateDocument as ae } from "@miragon/context-maps-schema-model";
|
|
3
|
+
import oe from "diagram-js/lib/layout/CroppingConnectionDocking";
|
|
4
|
+
import se from "diagram-js/lib/core/ElementFactory";
|
|
5
|
+
import { asTRBL as ce, getMid as _ } from "diagram-js/lib/layout/LayoutUtil";
|
|
6
|
+
import le from "diagram-js/lib/draw/BaseRenderer";
|
|
7
|
+
import { append as v, attr as y, clear as ue, create as b } from "tiny-svg";
|
|
8
|
+
import x from "diagram-js/lib/features/selection";
|
|
9
|
+
import de from "diagram-js/lib/navigation/zoomscroll";
|
|
10
|
+
import fe from "diagram-js/lib/navigation/movecanvas";
|
|
11
|
+
import pe from "diagram-js/lib/features/connection-preview";
|
|
12
|
+
import S from "diagram-js/lib/features/modeling";
|
|
13
|
+
import me from "diagram-js/lib/features/move";
|
|
14
|
+
import he from "diagram-js/lib/features/outline";
|
|
15
|
+
import ge from "diagram-js/lib/features/rules";
|
|
16
|
+
import _e from "diagram-js/lib/features/rules/RuleProvider";
|
|
17
|
+
import ve from "diagram-js/lib/command/CommandInterceptor";
|
|
18
|
+
import { hasPrimaryModifier as ye } from "diagram-js/lib/util/Mouse";
|
|
19
|
+
import be from "diagram-js/lib/features/palette";
|
|
20
|
+
import xe from "diagram-js/lib/features/create";
|
|
21
|
+
import C from "diagram-js/lib/features/connect";
|
|
22
|
+
import Se from "diagram-js/lib/features/lasso-tool";
|
|
23
|
+
import Ce from "diagram-js-direct-editing";
|
|
24
|
+
import we from "diagram-js/lib/features/context-pad";
|
|
25
|
+
import Te from "diagram-js/lib/features/popup-menu";
|
|
26
|
+
import Ee from "diagram-js/lib/features/auto-place";
|
|
27
|
+
import { DEFAULT_DISTANCE as De, findFreePosition as Oe, generateGetNextPosition as ke } from "diagram-js/lib/features/auto-place/AutoPlaceUtil";
|
|
28
|
+
import Ae from "diagram-js/lib/features/overlays";
|
|
29
|
+
import { MODELER_API_VERSION as je } from "@miragon/modeler-api";
|
|
29
30
|
//#region src/model/di-types.ts
|
|
30
|
-
function
|
|
31
|
+
function Me(e) {
|
|
31
32
|
return typeof e == "object" && e ? e.cmKind : void 0;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
return typeof
|
|
34
|
+
function w(e) {
|
|
35
|
+
return typeof Me(e) == "string";
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
37
|
+
function T(e) {
|
|
38
|
+
return Me(e) === "context";
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
40
|
+
function E(e) {
|
|
41
|
+
return Me(e) === "relationship";
|
|
41
42
|
}
|
|
42
43
|
//#endregion
|
|
43
44
|
//#region src/io/saveSvg.ts
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
var Ne = 40, Pe = [
|
|
46
|
+
"tabindex",
|
|
47
|
+
"role",
|
|
48
|
+
"aria-label"
|
|
49
|
+
];
|
|
50
|
+
function Fe(e, t) {
|
|
51
|
+
let n = e.getContainer().querySelector(":scope > svg");
|
|
47
52
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
48
53
|
let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
49
54
|
for (let e of t.getAll()) {
|
|
50
|
-
if (!
|
|
55
|
+
if (!T(e)) continue;
|
|
51
56
|
let t = e;
|
|
52
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);
|
|
53
58
|
}
|
|
54
59
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
55
|
-
let s = r -
|
|
60
|
+
let s = r - Ne, c = i - Ne, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
|
|
61
|
+
for (let e of Pe) d.removeAttribute(e);
|
|
56
62
|
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)));
|
|
57
63
|
let f = d.querySelector(".viewport");
|
|
58
64
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
59
65
|
}
|
|
60
66
|
//#endregion
|
|
61
67
|
//#region src/io/types.ts
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
var D = i, Ie = {
|
|
69
|
+
top: 84,
|
|
70
|
+
right: 56,
|
|
71
|
+
bottom: 56,
|
|
72
|
+
left: 56
|
|
73
|
+
}, Le = .001;
|
|
74
|
+
function Re(e) {
|
|
66
75
|
return typeof e == "number" ? `${e}px` : e;
|
|
67
76
|
}
|
|
68
|
-
var
|
|
77
|
+
var ze = class {
|
|
69
78
|
_diagram;
|
|
70
79
|
_container;
|
|
71
80
|
_options;
|
|
@@ -74,14 +83,16 @@ var k = class {
|
|
|
74
83
|
}
|
|
75
84
|
_createContainer(e) {
|
|
76
85
|
let t = e.container ?? document.createElement("div");
|
|
77
|
-
return t.classList.add("cm-djs-container"), t.style.width =
|
|
86
|
+
return t.classList.add("cm-djs-container"), t.style.width = Re(e.width ?? "100%"), t.style.height = Re(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
78
87
|
}
|
|
79
88
|
_ensureDiagram() {
|
|
80
89
|
if (!this._diagram) {
|
|
81
90
|
let t = [...this._getModules(), ...this._options.additionalModules ?? []];
|
|
82
91
|
this._diagram = new e({
|
|
83
92
|
canvas: { container: this._container },
|
|
84
|
-
modules: t
|
|
93
|
+
modules: t,
|
|
94
|
+
cmKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
|
|
95
|
+
cmPalette: { freeRectInsets: this.freeRectInsets }
|
|
85
96
|
});
|
|
86
97
|
}
|
|
87
98
|
return this._diagram;
|
|
@@ -89,6 +100,10 @@ var k = class {
|
|
|
89
100
|
get(e) {
|
|
90
101
|
return this._ensureDiagram().get(e);
|
|
91
102
|
}
|
|
103
|
+
freeRectInsets = () => this._options.freeRectInsets?.() ?? Ie;
|
|
104
|
+
_optional(e) {
|
|
105
|
+
return this._ensureDiagram().get(e, !1);
|
|
106
|
+
}
|
|
92
107
|
on(e, t, n = 1e3) {
|
|
93
108
|
this.get("eventBus").on(e, n, t);
|
|
94
109
|
}
|
|
@@ -97,55 +112,65 @@ var k = class {
|
|
|
97
112
|
}
|
|
98
113
|
importDocument(e) {
|
|
99
114
|
let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("cmImporter");
|
|
100
|
-
r.
|
|
101
|
-
let i =
|
|
102
|
-
|
|
115
|
+
r.assertImportable(e);
|
|
116
|
+
let i = this._optional("cmLabelEditing");
|
|
117
|
+
i?.suspend(), this._optional("cmContextPadProvider")?.cancelPrompt(), this._optional("popupMenu")?.close(), r.clear();
|
|
118
|
+
let a = r.import(e);
|
|
119
|
+
return this._optional("commandStack")?.clear(!1), this._fit(), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
|
|
120
|
+
}
|
|
121
|
+
importText(e) {
|
|
122
|
+
let t = re(e);
|
|
123
|
+
if (!t.ok) throw Error(t.error);
|
|
124
|
+
return this.importDocument(t.document);
|
|
103
125
|
}
|
|
104
126
|
exportDocument() {
|
|
105
127
|
return this.get("cmExporter").export();
|
|
106
128
|
}
|
|
129
|
+
exportText() {
|
|
130
|
+
return ie(this.exportDocument());
|
|
131
|
+
}
|
|
107
132
|
setMeta(e) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
let r = n.businessObject ?? { title: "Untitled context map" };
|
|
116
|
-
n.businessObject = {
|
|
117
|
-
...r,
|
|
118
|
-
...e
|
|
133
|
+
if (e.title === void 0 || this._optional("cmReadOnly")?.isReadOnly()) return;
|
|
134
|
+
let t = this._documentRoot();
|
|
135
|
+
if (!t?.businessObject || t.businessObject.title === e.title) return;
|
|
136
|
+
let n = this._optional("cmModeling");
|
|
137
|
+
n ? n.setTitle(e.title) : t.businessObject = {
|
|
138
|
+
...t.businessObject,
|
|
139
|
+
title: e.title
|
|
119
140
|
};
|
|
120
141
|
}
|
|
121
142
|
getMeta() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
143
|
+
return this._documentRoot()?.businessObject;
|
|
144
|
+
}
|
|
145
|
+
_documentRoot() {
|
|
146
|
+
return this.get("elementRegistry").get(D);
|
|
127
147
|
}
|
|
128
148
|
saveSVG() {
|
|
129
|
-
return
|
|
149
|
+
return Fe(this.get("canvas"), this.get("elementRegistry"));
|
|
130
150
|
}
|
|
131
|
-
_fit(
|
|
132
|
-
let
|
|
133
|
-
for (let e of
|
|
151
|
+
_fit() {
|
|
152
|
+
let e = this.get("canvas"), t = this.get("elementRegistry"), n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
153
|
+
for (let e of t.getAll()) {
|
|
134
154
|
let t = e;
|
|
135
|
-
typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number" && (
|
|
155
|
+
typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number" && (n = Math.min(n, t.x), r = Math.min(r, t.y), i = Math.max(i, t.x + t.width), a = Math.max(a, t.y + t.height));
|
|
136
156
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (!
|
|
140
|
-
|
|
157
|
+
let { width: o, height: s } = e.getSize();
|
|
158
|
+
if (!(o > 0 && s > 0)) return;
|
|
159
|
+
if (!Number.isFinite(n)) {
|
|
160
|
+
e.viewbox({
|
|
161
|
+
x: 0,
|
|
162
|
+
y: 0,
|
|
163
|
+
width: o,
|
|
164
|
+
height: s
|
|
165
|
+
});
|
|
141
166
|
return;
|
|
142
167
|
}
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
x:
|
|
146
|
-
y:
|
|
147
|
-
width:
|
|
148
|
-
height:
|
|
168
|
+
let c = this.freeRectInsets(), l = Math.max(o - c.left - c.right, 1), u = Math.max(s - c.top - c.bottom, 1), d = Math.max(i - n, 1), f = Math.max(a - r, 1), p = Math.max(Math.min(l / d, u / f, 1), Le);
|
|
169
|
+
e.viewbox({
|
|
170
|
+
x: n + d / 2 - (c.left + l / 2) / p,
|
|
171
|
+
y: r + f / 2 - (c.top + u / 2) / p,
|
|
172
|
+
width: o / p,
|
|
173
|
+
height: s / p
|
|
149
174
|
});
|
|
150
175
|
}
|
|
151
176
|
attachTo(e) {
|
|
@@ -163,14 +188,21 @@ var k = class {
|
|
|
163
188
|
get container() {
|
|
164
189
|
return this._container;
|
|
165
190
|
}
|
|
166
|
-
}
|
|
191
|
+
};
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/model/CmElementFactory.ts
|
|
194
|
+
function Be(e, t) {
|
|
195
|
+
let n = g(e, t);
|
|
196
|
+
return Object.keys(n).length > 0 ? { cmForeign: n } : {};
|
|
197
|
+
}
|
|
198
|
+
var Ve = class {
|
|
167
199
|
elementFactory;
|
|
168
200
|
static $inject = ["elementFactory"];
|
|
169
201
|
constructor(e) {
|
|
170
202
|
this.elementFactory = e;
|
|
171
203
|
}
|
|
172
204
|
createContext(e) {
|
|
173
|
-
let t = (e.subdomainType ?
|
|
205
|
+
let t = (e.subdomainType ? p[e.subdomainType] : void 0)?.minSize ?? {
|
|
174
206
|
width: 120,
|
|
175
207
|
height: 72
|
|
176
208
|
};
|
|
@@ -186,7 +218,8 @@ var k = class {
|
|
|
186
218
|
...e.team ? { team: e.team } : {},
|
|
187
219
|
...e.description ? { description: e.description } : {},
|
|
188
220
|
...e.fill ? { fill: e.fill } : {},
|
|
189
|
-
...e.stroke ? { stroke: e.stroke } : {}
|
|
221
|
+
...e.stroke ? { stroke: e.stroke } : {},
|
|
222
|
+
...Be(e, r)
|
|
190
223
|
});
|
|
191
224
|
}
|
|
192
225
|
createRelationship(e, t, n, r) {
|
|
@@ -201,11 +234,12 @@ var k = class {
|
|
|
201
234
|
...e.downstreamRoles?.length ? { downstreamRoles: [...e.downstreamRoles] } : {},
|
|
202
235
|
...e.label ? { cmLabel: e.label } : {},
|
|
203
236
|
...e.description ? { description: e.description } : {},
|
|
204
|
-
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {}
|
|
237
|
+
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
238
|
+
...Be(e, d)
|
|
205
239
|
});
|
|
206
240
|
}
|
|
207
241
|
createNewContext(e, t) {
|
|
208
|
-
let n = (e ?
|
|
242
|
+
let n = (e ? p[e] : void 0)?.defaultSize ?? p.generic.defaultSize;
|
|
209
243
|
return this.elementFactory.createShape({
|
|
210
244
|
width: n.width,
|
|
211
245
|
height: n.height,
|
|
@@ -214,14 +248,14 @@ var k = class {
|
|
|
214
248
|
cmLabel: t ?? "New Context"
|
|
215
249
|
});
|
|
216
250
|
}
|
|
217
|
-
},
|
|
251
|
+
}, He = class extends se {
|
|
218
252
|
create(e, t) {
|
|
219
253
|
return !t?.id && (e === "shape" || e === "connection") && (t = {
|
|
220
254
|
...t,
|
|
221
|
-
id:
|
|
255
|
+
id: ne(e === "shape" ? "ctx" : "rel")
|
|
222
256
|
}), super.create(e, t);
|
|
223
257
|
}
|
|
224
|
-
},
|
|
258
|
+
}, Ue = class {
|
|
225
259
|
docking;
|
|
226
260
|
static $inject = ["connectionDocking"];
|
|
227
261
|
constructor(e) {
|
|
@@ -231,11 +265,11 @@ var k = class {
|
|
|
231
265
|
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);
|
|
232
266
|
return e.waypoints = i, n && r && i.length === 2 ? this.docking.getCroppedWaypoints(e, n, r) : i;
|
|
233
267
|
}
|
|
234
|
-
},
|
|
235
|
-
elementFactory: ["type",
|
|
236
|
-
cmElementFactory: ["type",
|
|
237
|
-
connectionDocking: ["type",
|
|
238
|
-
},
|
|
268
|
+
}, We = {
|
|
269
|
+
elementFactory: ["type", He],
|
|
270
|
+
cmElementFactory: ["type", Ve],
|
|
271
|
+
connectionDocking: ["type", oe]
|
|
272
|
+
}, O = {
|
|
239
273
|
blau: "#335DE5",
|
|
240
274
|
blauLink: "#2B50D4",
|
|
241
275
|
blauHell: "#6B8AFF",
|
|
@@ -243,40 +277,38 @@ var k = class {
|
|
|
243
277
|
grau: "#F9F7F7",
|
|
244
278
|
schwarz: "#1D1D1D",
|
|
245
279
|
weiss: "#FFFFFF",
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
280
|
+
linie: "#E6E2E2",
|
|
281
|
+
success: "#00E676",
|
|
282
|
+
warning: "#FFB000",
|
|
283
|
+
danger: "#CD1839",
|
|
284
|
+
info: "#335DE5",
|
|
250
285
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
251
|
-
},
|
|
252
|
-
"--cd-blau":
|
|
253
|
-
"--cd-gruen":
|
|
254
|
-
"--cd-grau":
|
|
255
|
-
"--cd-schwarz":
|
|
256
|
-
"--cd-weiss":
|
|
257
|
-
"--cd-blau-link":
|
|
258
|
-
"--cd-blau-hell":
|
|
259
|
-
"--cd-
|
|
260
|
-
"--cd-success
|
|
261
|
-
"--cd-warning":
|
|
262
|
-
"--cd-
|
|
263
|
-
"--cd-
|
|
264
|
-
"--cd-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}, je = 1500;
|
|
269
|
-
A.blau;
|
|
270
|
-
var j = A.schwarz, Me = "#5B5B5B", M = {
|
|
286
|
+
}, Ge = {
|
|
287
|
+
"--cd-blau": O.blau,
|
|
288
|
+
"--cd-gruen": O.gruen,
|
|
289
|
+
"--cd-grau": O.grau,
|
|
290
|
+
"--cd-schwarz": O.schwarz,
|
|
291
|
+
"--cd-weiss": O.weiss,
|
|
292
|
+
"--cd-blau-link": O.blauLink,
|
|
293
|
+
"--cd-blau-hell": O.blauHell,
|
|
294
|
+
"--cd-linie": O.linie,
|
|
295
|
+
"--cd-success": O.success,
|
|
296
|
+
"--cd-warning": O.warning,
|
|
297
|
+
"--cd-danger": O.danger,
|
|
298
|
+
"--cd-info": O.info,
|
|
299
|
+
"--cd-gradient-brand": O.gradientBrand
|
|
300
|
+
}, Ke = 1500;
|
|
301
|
+
O.blau;
|
|
302
|
+
var k = O.schwarz, qe = "#5B5B5B", A = {
|
|
271
303
|
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
272
304
|
label: 13.5,
|
|
273
305
|
small: 11
|
|
274
|
-
},
|
|
306
|
+
}, j = O.weiss, Je = "#F1F1EE", Ye = "#8A8577";
|
|
275
307
|
//#endregion
|
|
276
308
|
//#region src/draw/endRoleChips.ts
|
|
277
|
-
function
|
|
309
|
+
function M(e, t, n, r) {
|
|
278
310
|
if (r.length === 0) return null;
|
|
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 =
|
|
311
|
+
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l = A.small * .64, u = A.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 = {
|
|
280
312
|
x: e.x + s * h,
|
|
281
313
|
y: e.y + c * h
|
|
282
314
|
};
|
|
@@ -296,17 +328,17 @@ function P(e, t, n, r) {
|
|
|
296
328
|
}
|
|
297
329
|
//#endregion
|
|
298
330
|
//#region src/draw/ContextMapsRenderer.ts
|
|
299
|
-
var
|
|
331
|
+
var Xe = class extends le {
|
|
300
332
|
static $inject = ["eventBus"];
|
|
301
333
|
constructor(e) {
|
|
302
|
-
super(e,
|
|
334
|
+
super(e, Ke);
|
|
303
335
|
}
|
|
304
336
|
canRender(e) {
|
|
305
|
-
return
|
|
337
|
+
return w(e);
|
|
306
338
|
}
|
|
307
339
|
drawShape(e, t) {
|
|
308
|
-
if (
|
|
309
|
-
let n = y(
|
|
340
|
+
if (ue(e), T(t)) return this.drawContext(e, t);
|
|
341
|
+
let n = y(b("rect"), {
|
|
310
342
|
width: t.width,
|
|
311
343
|
height: t.height,
|
|
312
344
|
fill: "#eee"
|
|
@@ -314,11 +346,11 @@ var Fe = class extends te {
|
|
|
314
346
|
return v(e, n), n;
|
|
315
347
|
}
|
|
316
348
|
drawConnection(e, t) {
|
|
317
|
-
if (
|
|
318
|
-
let n = y(
|
|
349
|
+
if (ue(e), E(t)) return this.drawRelationship(e, t);
|
|
350
|
+
let n = y(b("polyline"), {
|
|
319
351
|
points: (t.waypoints ?? []).map((e) => `${e.x},${e.y}`).join(" "),
|
|
320
352
|
fill: "none",
|
|
321
|
-
stroke:
|
|
353
|
+
stroke: k
|
|
322
354
|
});
|
|
323
355
|
return v(e, n), n;
|
|
324
356
|
}
|
|
@@ -331,7 +363,7 @@ var Fe = class extends te {
|
|
|
331
363
|
return t.length === 0 ? "" : t.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join("");
|
|
332
364
|
}
|
|
333
365
|
drawContext(e, t) {
|
|
334
|
-
let n = t.subdomainType ?
|
|
366
|
+
let n = t.subdomainType ? p[t.subdomainType] : void 0, r = Math.max(t.width, 1), i = Math.max(t.height, 1), a = y(b("rect"), {
|
|
335
367
|
x: 1,
|
|
336
368
|
y: 1,
|
|
337
369
|
width: r - 2,
|
|
@@ -344,12 +376,12 @@ var Fe = class extends te {
|
|
|
344
376
|
"stroke-linejoin": "round"
|
|
345
377
|
});
|
|
346
378
|
if (v(e, a), this.appendLabel(e, t.cmLabel ?? "", r, i, !!t.team, { "font-weight": "650" }), t.subdomainType && n) {
|
|
347
|
-
v(e,
|
|
348
|
-
let r = y(
|
|
379
|
+
v(e, et(t.subdomainType, 15, 15, 18, n.stroke));
|
|
380
|
+
let r = y(b("text"), {
|
|
349
381
|
x: 28,
|
|
350
382
|
y: 15,
|
|
351
|
-
"font-family":
|
|
352
|
-
"font-size":
|
|
383
|
+
"font-family": A.family,
|
|
384
|
+
"font-size": A.small,
|
|
353
385
|
"font-weight": "700",
|
|
354
386
|
fill: n.stroke,
|
|
355
387
|
"text-anchor": "start",
|
|
@@ -359,15 +391,15 @@ var Fe = class extends te {
|
|
|
359
391
|
r.textContent = n.label, v(e, r);
|
|
360
392
|
}
|
|
361
393
|
if (t.team) {
|
|
362
|
-
let n = 19 + t.team.length *
|
|
394
|
+
let n = 19 + t.team.length * A.small * .55, a = r / 2 - n / 2, o = i - 12, s = nt(a + 7, o, 14, qe);
|
|
363
395
|
y(s, { class: "cm-team" }), v(e, s);
|
|
364
|
-
let c = y(
|
|
396
|
+
let c = y(b("text"), {
|
|
365
397
|
class: "cm-team",
|
|
366
398
|
x: a + 14 + 5,
|
|
367
399
|
y: o,
|
|
368
|
-
"font-family":
|
|
369
|
-
"font-size":
|
|
370
|
-
fill:
|
|
400
|
+
"font-family": A.family,
|
|
401
|
+
"font-size": A.small,
|
|
402
|
+
fill: qe,
|
|
371
403
|
"text-anchor": "start",
|
|
372
404
|
"dominant-baseline": "central"
|
|
373
405
|
});
|
|
@@ -376,7 +408,7 @@ var Fe = class extends te {
|
|
|
376
408
|
return a;
|
|
377
409
|
}
|
|
378
410
|
drawRelationship(e, t) {
|
|
379
|
-
let n =
|
|
411
|
+
let n = f[t.pattern] ?? f["upstream-downstream"], r = t.waypoints ?? [], i = n.dash, a = y(b("polyline"), {
|
|
380
412
|
points: r.map((e) => `${e.x},${e.y}`).join(" "),
|
|
381
413
|
fill: "none",
|
|
382
414
|
stroke: n.stroke,
|
|
@@ -389,7 +421,7 @@ var Fe = class extends te {
|
|
|
389
421
|
let i = r[0], a = r[r.length - 1], o = t.upstreamRoles ?? [], s = t.downstreamRoles ?? [];
|
|
390
422
|
if (n.symmetric) {
|
|
391
423
|
let t = (i.x + a.x) / 2, r = (i.y + a.y) / 2;
|
|
392
|
-
this.chip(e, t, r, n.abbreviation,
|
|
424
|
+
this.chip(e, t, r, n.abbreviation, j, n.stroke, n.stroke);
|
|
393
425
|
} else {
|
|
394
426
|
let n = t.pattern === "customer-supplier";
|
|
395
427
|
this.endMarkers(e, i, a, n ? "S" : "U", o), this.endMarkers(e, a, i, n ? "C" : "D", s);
|
|
@@ -398,43 +430,43 @@ var Fe = class extends te {
|
|
|
398
430
|
return a;
|
|
399
431
|
}
|
|
400
432
|
endMarkers(e, t, n, r, i) {
|
|
401
|
-
let a = n.x - t.x, o = n.y - t.y,
|
|
402
|
-
x: t.x +
|
|
433
|
+
let a = n.x - t.x, o = n.y - t.y, s = Math.hypot(a, o) || 1, c = a / s, u = o / s, d = l[r] ?? k, f = y(b("text"), {
|
|
434
|
+
x: t.x + c * 11,
|
|
403
435
|
y: t.y + u * 11,
|
|
404
|
-
"font-family":
|
|
405
|
-
"font-size":
|
|
436
|
+
"font-family": A.family,
|
|
437
|
+
"font-size": A.small + 1,
|
|
406
438
|
"font-weight": "800",
|
|
407
439
|
fill: d,
|
|
408
|
-
stroke:
|
|
440
|
+
stroke: j,
|
|
409
441
|
"stroke-width": 3,
|
|
410
442
|
"paint-order": "stroke",
|
|
411
443
|
"text-anchor": "middle",
|
|
412
444
|
"dominant-baseline": "central"
|
|
413
445
|
});
|
|
414
446
|
f.textContent = r, v(e, f);
|
|
415
|
-
let p =
|
|
447
|
+
let p = M(t, n, r, i);
|
|
416
448
|
if (!p) return;
|
|
417
|
-
let { box: m, center: h, chipWidths: g, chipHeight: ee, innerWidth:
|
|
449
|
+
let { box: m, center: h, chipWidths: g, chipHeight: ee, innerWidth: te, gap: ne } = p, re = h.y, ie = y(b("rect"), {
|
|
418
450
|
x: m.x,
|
|
419
451
|
y: m.y,
|
|
420
452
|
width: m.width,
|
|
421
453
|
height: m.height,
|
|
422
454
|
rx: 6,
|
|
423
455
|
ry: 6,
|
|
424
|
-
fill:
|
|
456
|
+
fill: j,
|
|
425
457
|
"fill-opacity": .96,
|
|
426
458
|
stroke: "#d9d5cc",
|
|
427
459
|
"stroke-width": 1
|
|
428
460
|
});
|
|
429
|
-
v(e,
|
|
430
|
-
let
|
|
461
|
+
v(e, ie);
|
|
462
|
+
let ae = h.x - te / 2;
|
|
431
463
|
i.forEach((t, n) => {
|
|
432
|
-
let r = g[n], i =
|
|
433
|
-
this.miniChip(e,
|
|
464
|
+
let r = g[n], i = l[t] ?? "#8A8577";
|
|
465
|
+
this.miniChip(e, ae + r / 2, re, r, ee, t, i), ae += r + ne;
|
|
434
466
|
});
|
|
435
467
|
}
|
|
436
468
|
miniChip(e, t, n, r, i, a, o) {
|
|
437
|
-
let s = y(
|
|
469
|
+
let s = y(b("rect"), {
|
|
438
470
|
x: t - r / 2,
|
|
439
471
|
y: n - i / 2,
|
|
440
472
|
width: r,
|
|
@@ -442,25 +474,25 @@ var Fe = class extends te {
|
|
|
442
474
|
rx: 3,
|
|
443
475
|
ry: 3,
|
|
444
476
|
fill: o,
|
|
445
|
-
stroke:
|
|
477
|
+
stroke: Ze(o),
|
|
446
478
|
"stroke-width": 1
|
|
447
479
|
});
|
|
448
480
|
v(e, s);
|
|
449
|
-
let
|
|
481
|
+
let c = y(b("text"), {
|
|
450
482
|
x: t,
|
|
451
483
|
y: n,
|
|
452
|
-
"font-family":
|
|
453
|
-
"font-size":
|
|
484
|
+
"font-family": A.family,
|
|
485
|
+
"font-size": A.small,
|
|
454
486
|
"font-weight": "700",
|
|
455
|
-
fill:
|
|
487
|
+
fill: u,
|
|
456
488
|
"text-anchor": "middle",
|
|
457
489
|
"dominant-baseline": "central"
|
|
458
490
|
});
|
|
459
|
-
|
|
491
|
+
c.textContent = a, v(e, c);
|
|
460
492
|
}
|
|
461
493
|
chip(e, t, n, r, i, a, o) {
|
|
462
494
|
if (!r) return;
|
|
463
|
-
let s =
|
|
495
|
+
let s = A.small * .64, c = r.length * s + 12, l = A.small + 8, u = y(b("rect"), {
|
|
464
496
|
x: t - c / 2,
|
|
465
497
|
y: n - l / 2,
|
|
466
498
|
width: c,
|
|
@@ -470,14 +502,14 @@ var Fe = class extends te {
|
|
|
470
502
|
fill: i,
|
|
471
503
|
stroke: o,
|
|
472
504
|
"stroke-width": 1,
|
|
473
|
-
...i ===
|
|
505
|
+
...i === j ? { "fill-opacity": .95 } : {}
|
|
474
506
|
});
|
|
475
507
|
v(e, u);
|
|
476
|
-
let d = y(
|
|
508
|
+
let d = y(b("text"), {
|
|
477
509
|
x: t,
|
|
478
510
|
y: n,
|
|
479
|
-
"font-family":
|
|
480
|
-
"font-size":
|
|
511
|
+
"font-family": A.family,
|
|
512
|
+
"font-size": A.small,
|
|
481
513
|
"font-weight": "700",
|
|
482
514
|
fill: a,
|
|
483
515
|
"text-anchor": "middle",
|
|
@@ -486,17 +518,17 @@ var Fe = class extends te {
|
|
|
486
518
|
d.textContent = r, v(e, d);
|
|
487
519
|
}
|
|
488
520
|
appendLabel(e, t, n, r, i, a) {
|
|
489
|
-
let o = typeof a["font-size"] == "number" ? a["font-size"] :
|
|
490
|
-
l.length > f && (l = l.slice(0, f), l[f - 1] =
|
|
521
|
+
let o = typeof a["font-size"] == "number" ? a["font-size"] : A.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l = at(t, c, o, s), u = o * 1.2, d = r - 36 - (i ? 18 : 8), f = Math.max(1, Math.floor(d / u));
|
|
522
|
+
l.length > f && (l = l.slice(0, f), l[f - 1] = it(l[f - 1], c, o, s));
|
|
491
523
|
let p = 36 + u / 2;
|
|
492
524
|
l.forEach((t, r) => {
|
|
493
|
-
let i = y(
|
|
525
|
+
let i = y(b("text"), {
|
|
494
526
|
class: "cm-name",
|
|
495
527
|
x: n / 2,
|
|
496
528
|
y: p + r * u,
|
|
497
|
-
"font-family":
|
|
529
|
+
"font-family": A.family,
|
|
498
530
|
"font-size": o,
|
|
499
|
-
fill:
|
|
531
|
+
fill: k,
|
|
500
532
|
"text-anchor": "middle",
|
|
501
533
|
"dominant-baseline": "central",
|
|
502
534
|
...a
|
|
@@ -505,16 +537,16 @@ var Fe = class extends te {
|
|
|
505
537
|
});
|
|
506
538
|
}
|
|
507
539
|
};
|
|
508
|
-
function
|
|
540
|
+
function Ze(e, t = .7) {
|
|
509
541
|
let n = /^#([0-9a-f]{6})$/i.exec(e);
|
|
510
542
|
if (!n) return e;
|
|
511
543
|
let r = parseInt(n[1], 16);
|
|
512
544
|
return `rgb(${Math.round((r >> 16 & 255) * t)},${Math.round((r >> 8 & 255) * t)},${Math.round((r & 255) * t)})`;
|
|
513
545
|
}
|
|
514
|
-
var
|
|
515
|
-
function
|
|
546
|
+
var Qe = "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", $e = "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";
|
|
547
|
+
function et(e, t, n, r, i) {
|
|
516
548
|
if (e === "generic") {
|
|
517
|
-
let e =
|
|
549
|
+
let e = b("g"), a = y(b("circle"), {
|
|
518
550
|
cx: t,
|
|
519
551
|
cy: n,
|
|
520
552
|
r: r / 2 - 1,
|
|
@@ -525,44 +557,44 @@ function ze(e, t, n, r, i) {
|
|
|
525
557
|
});
|
|
526
558
|
return v(e, a), e;
|
|
527
559
|
}
|
|
528
|
-
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s =
|
|
560
|
+
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = b("g");
|
|
529
561
|
y(s, { transform: `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}` });
|
|
530
|
-
let c = y(
|
|
531
|
-
d: e === "core" ?
|
|
562
|
+
let c = y(b("path"), {
|
|
563
|
+
d: e === "core" ? Qe : $e,
|
|
532
564
|
fill: i
|
|
533
565
|
});
|
|
534
566
|
return v(s, c), s;
|
|
535
567
|
}
|
|
536
|
-
var
|
|
537
|
-
function
|
|
538
|
-
let i = n / 24, a =
|
|
568
|
+
var 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 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";
|
|
569
|
+
function nt(e, t, n, r) {
|
|
570
|
+
let i = n / 24, a = b("g");
|
|
539
571
|
y(a, { transform: `translate(${e - 12 * i} ${t - 12 * i}) scale(${i})` });
|
|
540
|
-
let o = y(
|
|
541
|
-
d:
|
|
572
|
+
let o = y(b("path"), {
|
|
573
|
+
d: tt,
|
|
542
574
|
fill: r
|
|
543
575
|
});
|
|
544
576
|
return v(a, o), a;
|
|
545
577
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
548
|
-
return
|
|
578
|
+
var N;
|
|
579
|
+
function rt(e, t, n) {
|
|
580
|
+
return N === void 0 && (N = typeof document > "u" ? null : document.createElement("canvas").getContext("2d")), N ? (N.font = `${n} ${t}px ${A.family}`, N.measureText(e).width) : e.length * t * .58;
|
|
549
581
|
}
|
|
550
|
-
function
|
|
582
|
+
function it(e, t, n, r) {
|
|
551
583
|
let i = e;
|
|
552
|
-
for (; i &&
|
|
584
|
+
for (; i && rt(`${i}…`, n, r) > t;) i = i.slice(0, -1).trimEnd();
|
|
553
585
|
return `${i}…`;
|
|
554
586
|
}
|
|
555
|
-
function
|
|
587
|
+
function at(e, t, n, r) {
|
|
556
588
|
let i = e.split("\n");
|
|
557
589
|
return i.every((e) => e.trim() === "") ? [] : i.flatMap((e) => {
|
|
558
|
-
let i =
|
|
590
|
+
let i = ot(e, t, n, r);
|
|
559
591
|
return i.length ? i : [""];
|
|
560
592
|
});
|
|
561
593
|
}
|
|
562
|
-
function
|
|
594
|
+
function ot(e, t, n, r) {
|
|
563
595
|
let i = e.split(/\s+/).filter(Boolean);
|
|
564
596
|
if (i.length === 0) return [];
|
|
565
|
-
let a = (e) =>
|
|
597
|
+
let a = (e) => rt(e, n, r) <= t, o = [], s = "";
|
|
566
598
|
for (let e of i) {
|
|
567
599
|
let t = s ? `${s} ${e}` : e;
|
|
568
600
|
if (a(t)) {
|
|
@@ -585,13 +617,13 @@ function Ge(e, t, n, r) {
|
|
|
585
617
|
}
|
|
586
618
|
//#endregion
|
|
587
619
|
//#region src/draw/index.ts
|
|
588
|
-
var
|
|
620
|
+
var st = {
|
|
589
621
|
__init__: ["cmRenderer"],
|
|
590
|
-
cmRenderer: ["type",
|
|
622
|
+
cmRenderer: ["type", Xe]
|
|
591
623
|
};
|
|
592
624
|
//#endregion
|
|
593
625
|
//#region src/io/CmImporter.ts
|
|
594
|
-
function
|
|
626
|
+
function ct(e, t) {
|
|
595
627
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r;
|
|
596
628
|
if (i === 0 && a === 0) return {
|
|
597
629
|
x: n,
|
|
@@ -603,13 +635,13 @@ function qe(e, t) {
|
|
|
603
635
|
y: r + a * c
|
|
604
636
|
};
|
|
605
637
|
}
|
|
606
|
-
function
|
|
638
|
+
function lt(e) {
|
|
607
639
|
return {
|
|
608
640
|
x: e.x + e.width / 2,
|
|
609
641
|
y: e.y + e.height / 2
|
|
610
642
|
};
|
|
611
643
|
}
|
|
612
|
-
var
|
|
644
|
+
var ut = class {
|
|
613
645
|
canvas;
|
|
614
646
|
elementFactory;
|
|
615
647
|
factory;
|
|
@@ -625,59 +657,64 @@ var Ye = class {
|
|
|
625
657
|
constructor(e, t, n, r, i) {
|
|
626
658
|
this.canvas = e, this.elementFactory = t, this.factory = n, this.eventBus = r, this.elementRegistry = i;
|
|
627
659
|
}
|
|
660
|
+
assertImportable(e) {
|
|
661
|
+
let t = /* @__PURE__ */ new Set();
|
|
662
|
+
for (let { id: n } of [...e.contexts, ...e.relationships]) {
|
|
663
|
+
if (ee(n)) throw Error(`The id "${n}" is reserved for the diagram itself.`);
|
|
664
|
+
if (t.has(n)) throw Error(`The id "${n}" is used more than once.`);
|
|
665
|
+
t.add(n);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
628
668
|
import(e) {
|
|
629
669
|
let t = [];
|
|
630
670
|
this.eventBus.fire("import.render.start", { document: e });
|
|
631
|
-
let n;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
let r;
|
|
638
|
-
n && n.id === "cm-root" ? r = n : (r = this.elementFactory.createRoot({ id: we }), this.canvas.setRootElement(r)), r.businessObject = { title: e.title };
|
|
639
|
-
let i = /* @__PURE__ */ new Map();
|
|
671
|
+
let n = this.documentRoot(), r = g(e, a), i = [];
|
|
672
|
+
n.businessObject = {
|
|
673
|
+
title: e.title,
|
|
674
|
+
...Object.keys(r).length > 0 ? { foreign: r } : {}
|
|
675
|
+
};
|
|
676
|
+
let o = /* @__PURE__ */ new Map();
|
|
640
677
|
for (let t of e.contexts) {
|
|
641
678
|
let e = this.factory.createContext(t);
|
|
642
|
-
|
|
679
|
+
o.set(t.id, e);
|
|
643
680
|
}
|
|
644
|
-
for (let
|
|
645
|
-
let e =
|
|
681
|
+
for (let r of e.relationships) {
|
|
682
|
+
let e = o.get(r.from), a = o.get(r.to);
|
|
646
683
|
if (!e || !a) {
|
|
647
|
-
t.push({
|
|
648
|
-
message: `Relationship "${
|
|
649
|
-
elementId:
|
|
684
|
+
i.push(r), t.push({
|
|
685
|
+
message: `Relationship "${r.id}" references a missing context; it stays in the file but is not drawn.`,
|
|
686
|
+
elementId: r.id
|
|
650
687
|
});
|
|
651
688
|
continue;
|
|
652
689
|
}
|
|
653
|
-
let
|
|
654
|
-
this.canvas.addConnection(
|
|
690
|
+
let s = [ct(e, lt(a)), ct(a, lt(e))], c = this.factory.createRelationship(r, e, a, s);
|
|
691
|
+
this.canvas.addConnection(c, n);
|
|
655
692
|
}
|
|
656
|
-
for (let e of
|
|
657
|
-
return this.eventBus.fire("import.render.done", { warnings: t }), t;
|
|
693
|
+
for (let e of o.values()) this.canvas.addShape(e, n);
|
|
694
|
+
return i.length > 0 && (n.businessObject.unplacedRelationships = i), this.eventBus.fire("import.render.done", { warnings: t }), t;
|
|
695
|
+
}
|
|
696
|
+
documentRoot() {
|
|
697
|
+
let e = this.elementRegistry.get(D);
|
|
698
|
+
e || (e = this.elementFactory.createRoot({ id: D }), this.canvas.setRootElement(e));
|
|
699
|
+
for (let t of this.canvas.getRootElements()) t !== e && this.canvas.removeRootElement(t);
|
|
700
|
+
return e;
|
|
658
701
|
}
|
|
659
702
|
clear() {
|
|
660
|
-
|
|
661
|
-
|
|
703
|
+
let e = new Set(this.canvas.getRootElements());
|
|
704
|
+
for (let t of [...this.elementRegistry.getAll()]) if (!e.has(t)) try {
|
|
705
|
+
"waypoints" in t ? this.canvas.removeConnection(t.id) : this.canvas.removeShape(t.id);
|
|
662
706
|
} catch {}
|
|
663
707
|
}
|
|
664
|
-
},
|
|
708
|
+
}, dt = class {
|
|
665
709
|
elementRegistry;
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
this.elementRegistry = e, this.canvas = t;
|
|
710
|
+
static $inject = ["elementRegistry"];
|
|
711
|
+
constructor(e) {
|
|
712
|
+
this.elementRegistry = e;
|
|
670
713
|
}
|
|
671
714
|
export() {
|
|
672
|
-
let e;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
} catch {
|
|
676
|
-
e = void 0;
|
|
677
|
-
}
|
|
678
|
-
let t = [], n = [];
|
|
679
|
-
for (let e of this.elementRegistry.getAll()) if (e.id !== "cm-root") {
|
|
680
|
-
if (D(e)) {
|
|
715
|
+
let e = this.elementRegistry.get(D)?.businessObject, t = [], n = [];
|
|
716
|
+
for (let e of this.elementRegistry.getAll()) if (e.id !== D) {
|
|
717
|
+
if (T(e)) {
|
|
681
718
|
let n = e;
|
|
682
719
|
t.push({
|
|
683
720
|
id: e.id,
|
|
@@ -694,9 +731,10 @@ var Ye = class {
|
|
|
694
731
|
...e.team ? { team: e.team } : {},
|
|
695
732
|
...e.description ? { description: e.description } : {},
|
|
696
733
|
...e.fill ? { fill: e.fill } : {},
|
|
697
|
-
...e.stroke ? { stroke: e.stroke } : {}
|
|
734
|
+
...e.stroke ? { stroke: e.stroke } : {},
|
|
735
|
+
...e.cmForeign
|
|
698
736
|
});
|
|
699
|
-
} else if (
|
|
737
|
+
} else if (E(e)) {
|
|
700
738
|
let t = e.source, r = e.target;
|
|
701
739
|
if (!t?.id || !r?.id) continue;
|
|
702
740
|
n.push({
|
|
@@ -708,69 +746,147 @@ var Ye = class {
|
|
|
708
746
|
...e.downstreamRoles?.length ? { downstreamRoles: [...e.downstreamRoles] } : {},
|
|
709
747
|
...e.cmLabel ? { label: e.cmLabel } : {},
|
|
710
748
|
...e.description ? { description: e.description } : {},
|
|
711
|
-
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {}
|
|
749
|
+
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
750
|
+
...e.cmForeign
|
|
712
751
|
});
|
|
713
752
|
}
|
|
714
753
|
}
|
|
715
|
-
return {
|
|
716
|
-
version:
|
|
754
|
+
return n.push(...e?.unplacedRelationships ?? []), {
|
|
755
|
+
version: o,
|
|
717
756
|
title: e?.title ?? "Untitled context map",
|
|
718
757
|
contexts: t,
|
|
719
|
-
relationships: n
|
|
758
|
+
relationships: n,
|
|
759
|
+
...e?.foreign
|
|
720
760
|
};
|
|
721
761
|
}
|
|
722
|
-
},
|
|
723
|
-
cmImporter: ["type",
|
|
724
|
-
cmExporter: ["type",
|
|
725
|
-
},
|
|
762
|
+
}, ft = {
|
|
763
|
+
cmImporter: ["type", ut],
|
|
764
|
+
cmExporter: ["type", dt]
|
|
765
|
+
}, pt = class extends ze {
|
|
726
766
|
_getModules() {
|
|
727
767
|
return [
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
768
|
+
We,
|
|
769
|
+
st,
|
|
770
|
+
ft
|
|
731
771
|
];
|
|
732
772
|
}
|
|
733
|
-
},
|
|
773
|
+
}, mt = {
|
|
774
|
+
x: 14,
|
|
775
|
+
y: 18
|
|
776
|
+
}, ht = 12;
|
|
777
|
+
function gt(e) {
|
|
778
|
+
if (T(e)) {
|
|
779
|
+
let t = [];
|
|
780
|
+
return e.description && t.push(e.description), e.team && t.push(`Team: ${e.team}`), t.length === 0 ? null : {
|
|
781
|
+
title: e.cmLabel ?? "Bounded context",
|
|
782
|
+
body: t.join(" · ")
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
if (E(e)) {
|
|
786
|
+
let t = f[e.pattern]?.label ?? e.pattern, n = [];
|
|
787
|
+
return e.description && n.push(e.description), e.implementationTechnology && n.push(e.implementationTechnology), {
|
|
788
|
+
title: e.cmLabel ? `${t} · ${e.cmLabel}` : t,
|
|
789
|
+
body: n.join(" · ")
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
return null;
|
|
793
|
+
}
|
|
794
|
+
var _t = class {
|
|
795
|
+
static $inject = ["eventBus", "canvas"];
|
|
796
|
+
tooltip;
|
|
797
|
+
title;
|
|
798
|
+
body;
|
|
799
|
+
constructor(e, t) {
|
|
800
|
+
let n = t.getContainer();
|
|
801
|
+
this.tooltip = document.createElement("div"), this.tooltip.className = "cm-hover-tooltip", this.tooltip.setAttribute("role", "tooltip"), this.tooltip.hidden = !0, this.title = document.createElement("strong"), this.body = document.createElement("span"), this.tooltip.append(this.title, this.body), n.append(this.tooltip);
|
|
802
|
+
let r = (e) => {
|
|
803
|
+
let t = n.getBoundingClientRect(), r = this.tooltip.offsetWidth, i = Math.min(e.clientX - t.left + mt.x, t.width - r - ht);
|
|
804
|
+
this.tooltip.style.left = `${Math.max(ht, i)}px`, this.tooltip.style.top = `${e.clientY - t.top + mt.y}px`;
|
|
805
|
+
}, i = () => {
|
|
806
|
+
this.tooltip.hidden = !0, n.removeEventListener("mousemove", r);
|
|
807
|
+
};
|
|
808
|
+
e.on("element.hover", (e) => {
|
|
809
|
+
let t = gt(e.element);
|
|
810
|
+
t ? (this.title.textContent = t.title, this.body.textContent = t.body, this.body.hidden = t.body === "", this.tooltip.hidden = !1, e.originalEvent && r(e.originalEvent), n.addEventListener("mousemove", r)) : i();
|
|
811
|
+
}), e.on([
|
|
812
|
+
"element.out",
|
|
813
|
+
"drag.init",
|
|
814
|
+
"canvas.viewbox.changing",
|
|
815
|
+
"diagram.clear"
|
|
816
|
+
], i), e.on("diagram.destroy", () => {
|
|
817
|
+
i(), this.tooltip.remove();
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
}, vt = {
|
|
821
|
+
__init__: ["cmHoverTooltip"],
|
|
822
|
+
cmHoverTooltip: ["type", _t]
|
|
823
|
+
}, P = class extends pt {
|
|
734
824
|
_getModules() {
|
|
735
825
|
return [
|
|
736
826
|
...super._getModules(),
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
827
|
+
x,
|
|
828
|
+
de,
|
|
829
|
+
fe,
|
|
830
|
+
vt
|
|
740
831
|
];
|
|
741
832
|
}
|
|
742
833
|
};
|
|
743
834
|
//#endregion
|
|
744
835
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
745
|
-
function
|
|
836
|
+
function yt(e, t, n) {
|
|
746
837
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
747
838
|
}
|
|
748
|
-
var
|
|
839
|
+
var bt = class {
|
|
749
840
|
execute(e) {
|
|
750
841
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
751
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
842
|
+
for (let e of Object.keys(n)) i[e] = r[e], yt(r, e, n[e]);
|
|
752
843
|
return e.oldProperties = i, [t];
|
|
753
844
|
}
|
|
754
845
|
revert(e) {
|
|
755
846
|
let { element: t, oldProperties: n } = e, r = t;
|
|
756
|
-
if (n) for (let e of Object.keys(n))
|
|
847
|
+
if (n) for (let e of Object.keys(n)) yt(r, e, n[e]);
|
|
757
848
|
return [t];
|
|
758
849
|
}
|
|
759
850
|
};
|
|
760
851
|
//#endregion
|
|
761
852
|
//#region src/modeling/cmd/SwapEndsHandler.ts
|
|
762
|
-
function
|
|
853
|
+
function xt(e) {
|
|
763
854
|
let t = e.source;
|
|
764
855
|
return e.source = e.target, e.target = t, Array.isArray(e.waypoints) && (e.waypoints = [...e.waypoints].reverse()), [e];
|
|
765
856
|
}
|
|
766
|
-
var
|
|
857
|
+
var St = class {
|
|
767
858
|
execute(e) {
|
|
768
|
-
return
|
|
859
|
+
return xt(e.connection);
|
|
769
860
|
}
|
|
770
861
|
revert(e) {
|
|
771
|
-
return
|
|
862
|
+
return xt(e.connection);
|
|
863
|
+
}
|
|
864
|
+
}, Ct = class {
|
|
865
|
+
elementRegistry;
|
|
866
|
+
static $inject = ["elementRegistry"];
|
|
867
|
+
constructor(e) {
|
|
868
|
+
this.elementRegistry = e;
|
|
869
|
+
}
|
|
870
|
+
root() {
|
|
871
|
+
let e = this.elementRegistry.get(D);
|
|
872
|
+
if (!e?.businessObject) throw Error("No context map is loaded to rename.");
|
|
873
|
+
return e;
|
|
874
|
+
}
|
|
875
|
+
execute(e) {
|
|
876
|
+
let t = this.root(), n = t.businessObject;
|
|
877
|
+
return e.oldTitle = n.title, t.businessObject = {
|
|
878
|
+
...n,
|
|
879
|
+
title: e.title
|
|
880
|
+
}, [];
|
|
772
881
|
}
|
|
773
|
-
|
|
882
|
+
revert(e) {
|
|
883
|
+
let t = this.root();
|
|
884
|
+
return t.businessObject = {
|
|
885
|
+
...t.businessObject,
|
|
886
|
+
title: e.oldTitle ?? ""
|
|
887
|
+
}, [];
|
|
888
|
+
}
|
|
889
|
+
}, wt = "element.updateProperties", Tt = "relationship.swapEnds", Et = "map.updateTitle", Dt = class {
|
|
774
890
|
commandStack;
|
|
775
891
|
elementRegistry;
|
|
776
892
|
graphicsFactory;
|
|
@@ -780,17 +896,20 @@ var nt = class {
|
|
|
780
896
|
"graphicsFactory"
|
|
781
897
|
];
|
|
782
898
|
constructor(e, t, n) {
|
|
783
|
-
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(
|
|
899
|
+
this.commandStack = e, this.elementRegistry = t, this.graphicsFactory = n, e.registerHandler(wt, bt), e.registerHandler(Tt, St), e.registerHandler(Et, Ct);
|
|
900
|
+
}
|
|
901
|
+
setTitle(e) {
|
|
902
|
+
this.commandStack.execute(Et, { title: e });
|
|
784
903
|
}
|
|
785
904
|
redraw(e) {
|
|
786
905
|
let t = this.elementRegistry.getGraphics(e);
|
|
787
|
-
t && this.graphicsFactory.update(
|
|
906
|
+
t && this.graphicsFactory.update(E(e) ? "connection" : "shape", e, t);
|
|
788
907
|
}
|
|
789
908
|
swapEnds(e) {
|
|
790
|
-
this.commandStack.execute(
|
|
909
|
+
this.commandStack.execute(Tt, { connection: e }), this.redraw(e);
|
|
791
910
|
}
|
|
792
911
|
updateProperties(e, t) {
|
|
793
|
-
this.commandStack.execute(
|
|
912
|
+
this.commandStack.execute(wt, {
|
|
794
913
|
element: e,
|
|
795
914
|
properties: t
|
|
796
915
|
}), this.redraw(e);
|
|
@@ -815,7 +934,7 @@ var nt = class {
|
|
|
815
934
|
}
|
|
816
935
|
setPattern(e, t) {
|
|
817
936
|
let n = { pattern: t };
|
|
818
|
-
if (
|
|
937
|
+
if (te(t)) n.upstreamRoles = void 0, n.downstreamRoles = void 0;
|
|
819
938
|
else if (t === "customer-supplier") {
|
|
820
939
|
let t = (e.upstreamRoles ?? []).filter((e) => e !== "OHS"), r = (e.downstreamRoles ?? []).filter((e) => e !== "CF");
|
|
821
940
|
n.upstreamRoles = t.length ? t : void 0, n.downstreamRoles = r.length ? r : void 0;
|
|
@@ -831,36 +950,36 @@ var nt = class {
|
|
|
831
950
|
setImplementationTechnology(e, t) {
|
|
832
951
|
this.updateProperties(e, { implementationTechnology: t || void 0 });
|
|
833
952
|
}
|
|
834
|
-
},
|
|
953
|
+
}, F = {
|
|
835
954
|
__init__: ["cmModeling"],
|
|
836
|
-
cmModeling: ["type",
|
|
837
|
-
layouter: ["type",
|
|
838
|
-
},
|
|
955
|
+
cmModeling: ["type", Dt],
|
|
956
|
+
layouter: ["type", Ue]
|
|
957
|
+
}, Ot = class extends _e {
|
|
839
958
|
static $inject = ["eventBus"];
|
|
840
959
|
constructor(e) {
|
|
841
960
|
super(e);
|
|
842
961
|
}
|
|
843
962
|
init() {
|
|
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) =>
|
|
963
|
+
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !1), this.addRule("connection.create", (e) => At(e.source, e.target)), this.addRule("connection.reconnect", (e) => !!At(e.source, e.target, e.connection)), this.addRule("connection.updateWaypoints", () => !0);
|
|
845
964
|
}
|
|
846
965
|
};
|
|
847
|
-
function
|
|
966
|
+
function kt(e, t, n) {
|
|
848
967
|
let { incoming: r = [], outgoing: i = [] } = e;
|
|
849
968
|
return [...r, ...i].some((r) => r !== n && (r.source === e && r.target === t || r.source === t && r.target === e));
|
|
850
969
|
}
|
|
851
|
-
function
|
|
852
|
-
return !
|
|
970
|
+
function At(e, t, n) {
|
|
971
|
+
return !T(e) || !T(t) || e === t || kt(e, t, n) ? !1 : {
|
|
853
972
|
cmKind: "relationship",
|
|
854
973
|
pattern: "upstream-downstream"
|
|
855
974
|
};
|
|
856
975
|
}
|
|
857
976
|
//#endregion
|
|
858
977
|
//#region src/rules/index.ts
|
|
859
|
-
var
|
|
860
|
-
__depends__: [
|
|
978
|
+
var I = {
|
|
979
|
+
__depends__: [ge],
|
|
861
980
|
__init__: ["cmRules"],
|
|
862
|
-
cmRules: ["type",
|
|
863
|
-
},
|
|
981
|
+
cmRules: ["type", Ot]
|
|
982
|
+
}, jt = class extends ve {
|
|
864
983
|
static $inject = [
|
|
865
984
|
"eventBus",
|
|
866
985
|
"canvas",
|
|
@@ -888,144 +1007,96 @@ var R = {
|
|
|
888
1007
|
}
|
|
889
1008
|
}, !0);
|
|
890
1009
|
}
|
|
891
|
-
},
|
|
1010
|
+
}, Mt = "cm-dragging", Nt = class {
|
|
892
1011
|
static $inject = ["eventBus", "canvas"];
|
|
893
1012
|
constructor(e, t) {
|
|
894
1013
|
e.on("drag.init", () => {
|
|
895
|
-
t.getContainer().classList.add(
|
|
1014
|
+
t.getContainer().classList.add(Mt);
|
|
896
1015
|
}), e.on("drag.cleanup", () => {
|
|
897
|
-
t.getContainer().classList.remove(
|
|
1016
|
+
t.getContainer().classList.remove(Mt);
|
|
898
1017
|
});
|
|
899
1018
|
}
|
|
900
|
-
},
|
|
1019
|
+
}, Pt = 2e3, Ft = {
|
|
901
1020
|
__init__: [
|
|
902
1021
|
"cmFlatModelBehavior",
|
|
903
1022
|
"cmDragBehavior",
|
|
904
1023
|
"cmClickSelectionBehavior"
|
|
905
1024
|
],
|
|
906
|
-
cmFlatModelBehavior: ["type",
|
|
907
|
-
cmDragBehavior: ["type",
|
|
1025
|
+
cmFlatModelBehavior: ["type", jt],
|
|
1026
|
+
cmDragBehavior: ["type", Nt],
|
|
908
1027
|
cmClickSelectionBehavior: ["type", class {
|
|
909
1028
|
static $inject = ["eventBus", "selection"];
|
|
910
1029
|
constructor(e, t) {
|
|
911
|
-
e.on("element.click",
|
|
1030
|
+
e.on("element.click", Pt, (e) => {
|
|
912
1031
|
let n = e.element;
|
|
913
|
-
if (
|
|
1032
|
+
if (w(n) && !ye(e) && t.isSelected(n)) return !1;
|
|
914
1033
|
});
|
|
915
1034
|
}
|
|
916
1035
|
}]
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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>`;
|
|
936
|
-
}
|
|
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>`);
|
|
939
|
-
}
|
|
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>`;
|
|
952
|
-
}
|
|
953
|
-
//#endregion
|
|
954
|
-
//#region src/palette/CmPaletteProvider.ts
|
|
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>`;
|
|
958
|
-
}
|
|
959
|
-
var At = class {
|
|
960
|
-
create;
|
|
961
|
-
lassoTool;
|
|
962
|
-
factory;
|
|
963
|
-
static $inject = [
|
|
964
|
-
"palette",
|
|
965
|
-
"create",
|
|
966
|
-
"lassoTool",
|
|
967
|
-
"cmElementFactory"
|
|
968
|
-
];
|
|
969
|
-
constructor(e, t, n, r) {
|
|
970
|
-
this.create = t, this.lassoTool = n, this.factory = r, e.registerProvider(this);
|
|
1036
|
+
}, L = "cm.readOnly.changed", It = 5e3, Lt = [
|
|
1037
|
+
"elements.move",
|
|
1038
|
+
"shape.move",
|
|
1039
|
+
"shape.resize",
|
|
1040
|
+
"shape.create",
|
|
1041
|
+
"elements.create",
|
|
1042
|
+
"shape.append",
|
|
1043
|
+
"connection.start",
|
|
1044
|
+
"connection.create",
|
|
1045
|
+
"connection.reconnect",
|
|
1046
|
+
"connection.updateWaypoints",
|
|
1047
|
+
"elements.delete"
|
|
1048
|
+
], Rt = class extends _e {
|
|
1049
|
+
bus;
|
|
1050
|
+
static $inject = ["eventBus"];
|
|
1051
|
+
readOnly = !1;
|
|
1052
|
+
constructor(e) {
|
|
1053
|
+
super(e), this.bus = e;
|
|
971
1054
|
}
|
|
972
|
-
|
|
973
|
-
|
|
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) {
|
|
981
|
-
let n = (e) => this.create.start(e, this.factory.createNewContext(t.type, t.label));
|
|
982
|
-
e[`context.${t.type}`] = {
|
|
983
|
-
group: Ot,
|
|
984
|
-
title: `${t.label} — ${t.description}`,
|
|
985
|
-
html: kt(B(t.type), `${t.label} — ${t.description}`),
|
|
986
|
-
action: {
|
|
987
|
-
dragstart: n,
|
|
988
|
-
click: n
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
return e;
|
|
1055
|
+
init() {
|
|
1056
|
+
this.addRule(Lt, It, () => !this.readOnly && void 0);
|
|
993
1057
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1058
|
+
isReadOnly() {
|
|
1059
|
+
return this.readOnly;
|
|
1060
|
+
}
|
|
1061
|
+
setReadOnly(e) {
|
|
1062
|
+
this.readOnly !== e && (this.readOnly = e, this.bus.fire(L, { readOnly: e }));
|
|
1063
|
+
}
|
|
1064
|
+
}, R = {
|
|
1065
|
+
__depends__: [ge],
|
|
1066
|
+
__init__: ["cmReadOnly"],
|
|
1067
|
+
cmReadOnly: ["type", Rt]
|
|
1068
|
+
}, zt = {
|
|
1004
1069
|
name: "cm-direct-editing",
|
|
1005
1070
|
team: "cm-direct-editing-team"
|
|
1006
|
-
},
|
|
1071
|
+
}, Bt = 10, Vt = 20, Ht = class {
|
|
1007
1072
|
canvas;
|
|
1008
1073
|
directEditing;
|
|
1009
1074
|
modeling;
|
|
1075
|
+
elementRegistry;
|
|
1076
|
+
readOnly;
|
|
1010
1077
|
static $inject = [
|
|
1011
1078
|
"eventBus",
|
|
1012
1079
|
"canvas",
|
|
1013
1080
|
"directEditing",
|
|
1014
|
-
"cmModeling"
|
|
1081
|
+
"cmModeling",
|
|
1082
|
+
"elementRegistry",
|
|
1083
|
+
"cmReadOnly"
|
|
1015
1084
|
];
|
|
1016
1085
|
mode = "name";
|
|
1017
1086
|
activeMarker;
|
|
1018
|
-
|
|
1019
|
-
|
|
1087
|
+
suspended;
|
|
1088
|
+
resumeTimer;
|
|
1089
|
+
constructor(e, t, n, r, i, a) {
|
|
1090
|
+
this.canvas = t, this.directEditing = n, this.modeling = r, this.elementRegistry = i, this.readOnly = a, n.registerProvider({
|
|
1020
1091
|
activate: (e) => this.activationContext(e),
|
|
1021
1092
|
update: (e, t) => this.commit(e, t)
|
|
1022
1093
|
}), e.on("element.dblclick", (e) => {
|
|
1023
1094
|
let t = e.element;
|
|
1024
|
-
|
|
1095
|
+
w(t) && (this.mode = T(t) && t.team && this.isInTeamBand(t, e.originalEvent) ? "team" : "name", n.activate(t));
|
|
1025
1096
|
}), e.on(["canvas.viewbox.changing", "drag.init"], () => n.complete()), e.on("directEditing.activate", (e) => {
|
|
1026
1097
|
let n = e.active?.element;
|
|
1027
1098
|
if (!n) return;
|
|
1028
|
-
let r =
|
|
1099
|
+
let r = zt[this.mode];
|
|
1029
1100
|
t.addMarker(n, r), this.activeMarker = {
|
|
1030
1101
|
element: n,
|
|
1031
1102
|
marker: r
|
|
@@ -1033,8 +1104,40 @@ var At = class {
|
|
|
1033
1104
|
}), e.on(["directEditing.complete", "directEditing.cancel"], () => {
|
|
1034
1105
|
let e = this.activeMarker;
|
|
1035
1106
|
e && t.removeMarker(e.element, e.marker), this.activeMarker = void 0;
|
|
1107
|
+
}), e.on("diagram.destroy", () => {
|
|
1108
|
+
clearTimeout(this.resumeTimer), this.suspended = void 0;
|
|
1109
|
+
}), e.on("directEditing.activate.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), e.on(L, (e) => {
|
|
1110
|
+
e.readOnly && n.cancel();
|
|
1036
1111
|
});
|
|
1037
1112
|
}
|
|
1113
|
+
suspend() {
|
|
1114
|
+
clearTimeout(this.resumeTimer);
|
|
1115
|
+
let e = this.activeMarker?.element;
|
|
1116
|
+
this.directEditing.isActive() && e && (this.suspended = {
|
|
1117
|
+
elementId: e.id,
|
|
1118
|
+
mode: this.mode,
|
|
1119
|
+
text: this.directEditing.getValue()
|
|
1120
|
+
}, this.directEditing.cancel());
|
|
1121
|
+
}
|
|
1122
|
+
resumeAfterImport() {
|
|
1123
|
+
clearTimeout(this.resumeTimer), this.suspended && (this.resumeTimer = setTimeout(() => {
|
|
1124
|
+
let e = this.suspended;
|
|
1125
|
+
this.suspended = void 0, e && !this.directEditing.isActive() && this.resume(e);
|
|
1126
|
+
}, 0));
|
|
1127
|
+
}
|
|
1128
|
+
openEdit() {
|
|
1129
|
+
let e = this.activeMarker?.element;
|
|
1130
|
+
if (this.directEditing.isActive() && e) return {
|
|
1131
|
+
elementId: e.id,
|
|
1132
|
+
text: this.directEditing.getValue()
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
resume(e) {
|
|
1136
|
+
let t = this.elementRegistry.get(e.elementId);
|
|
1137
|
+
if (!w(t) || e.mode === "team" && !T(t) || (this.mode = e.mode, !this.directEditing.activate(t))) return;
|
|
1138
|
+
let n = this.directEditing.$textbox?.querySelector("[contenteditable]");
|
|
1139
|
+
n && (n.innerText = e.text, Ut(n));
|
|
1140
|
+
}
|
|
1038
1141
|
activate(e) {
|
|
1039
1142
|
this.mode = "name", this.directEditing.activate(e);
|
|
1040
1143
|
}
|
|
@@ -1050,45 +1153,45 @@ var At = class {
|
|
|
1050
1153
|
return t.clientY - i >= r.y + r.height - 22 * n;
|
|
1051
1154
|
}
|
|
1052
1155
|
activationContext(e) {
|
|
1053
|
-
if (!
|
|
1054
|
-
this.mode === "team" && !
|
|
1156
|
+
if (!w(e)) return;
|
|
1157
|
+
this.mode === "team" && !T(e) && (this.mode = "name");
|
|
1055
1158
|
let t = this.canvas.zoom(), n = this.canvas.getAbsoluteBBox(e);
|
|
1056
1159
|
if (this.mode === "team") {
|
|
1057
1160
|
let r = e;
|
|
1058
1161
|
return {
|
|
1059
1162
|
bounds: {
|
|
1060
|
-
x: n.x +
|
|
1163
|
+
x: n.x + Bt * t,
|
|
1061
1164
|
y: n.y + n.height - 22 * t,
|
|
1062
1165
|
width: n.width - 20 * t,
|
|
1063
|
-
height:
|
|
1166
|
+
height: Vt * t
|
|
1064
1167
|
},
|
|
1065
1168
|
text: r.team ?? "",
|
|
1066
1169
|
style: {
|
|
1067
|
-
fontFamily:
|
|
1068
|
-
fontSize: `${
|
|
1170
|
+
fontFamily: A.family,
|
|
1171
|
+
fontSize: `${A.small * t}px`,
|
|
1069
1172
|
fontWeight: 400,
|
|
1070
1173
|
lineHeight: 1.2,
|
|
1071
1174
|
backgroundColor: "transparent",
|
|
1072
|
-
border: "1px dashed
|
|
1175
|
+
border: "1px dashed var(--cd-ui-interaktion)",
|
|
1073
1176
|
textAlign: "center"
|
|
1074
1177
|
},
|
|
1075
1178
|
options: { centerVertically: !0 }
|
|
1076
1179
|
};
|
|
1077
1180
|
}
|
|
1078
1181
|
let r = {
|
|
1079
|
-
fontFamily:
|
|
1080
|
-
fontSize: `${
|
|
1182
|
+
fontFamily: A.family,
|
|
1183
|
+
fontSize: `${A.label * t}px`,
|
|
1081
1184
|
fontWeight: 650,
|
|
1082
1185
|
lineHeight: 1.2,
|
|
1083
1186
|
backgroundColor: "transparent",
|
|
1084
|
-
border: "1px dashed
|
|
1187
|
+
border: "1px dashed var(--cd-ui-interaktion)",
|
|
1085
1188
|
textAlign: "center"
|
|
1086
1189
|
};
|
|
1087
|
-
if (
|
|
1190
|
+
if (T(e)) {
|
|
1088
1191
|
let i = e.team ? 18 * t : 0;
|
|
1089
1192
|
return {
|
|
1090
1193
|
bounds: {
|
|
1091
|
-
x: n.x +
|
|
1194
|
+
x: n.x + Bt * t,
|
|
1092
1195
|
y: n.y + 36 * t - 1,
|
|
1093
1196
|
width: n.width - 20 * t,
|
|
1094
1197
|
height: n.height - 36 * t - i
|
|
@@ -1108,7 +1211,7 @@ var At = class {
|
|
|
1108
1211
|
text: e.cmLabel ?? "",
|
|
1109
1212
|
style: {
|
|
1110
1213
|
...r,
|
|
1111
|
-
backgroundColor: "
|
|
1214
|
+
backgroundColor: "var(--cd-ui-flaeche-hoch)"
|
|
1112
1215
|
},
|
|
1113
1216
|
options: { centerVertically: !0 }
|
|
1114
1217
|
};
|
|
@@ -1119,23 +1222,188 @@ var At = class {
|
|
|
1119
1222
|
let t = e;
|
|
1120
1223
|
if (n === (t.team ?? "")) return;
|
|
1121
1224
|
this.modeling.setTeam(t, n || void 0);
|
|
1122
|
-
|
|
1123
|
-
}
|
|
1124
|
-
n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1225
|
+
} else n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1125
1226
|
}
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1227
|
+
};
|
|
1228
|
+
function Ut(e) {
|
|
1229
|
+
let t = document.createRange();
|
|
1230
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
1231
|
+
let n = window.getSelection();
|
|
1232
|
+
n?.removeAllRanges(), n?.addRange(t);
|
|
1233
|
+
}
|
|
1234
|
+
//#endregion
|
|
1235
|
+
//#region src/label-editing/index.ts
|
|
1236
|
+
var z = {
|
|
1237
|
+
__depends__: [
|
|
1238
|
+
Ce,
|
|
1239
|
+
F,
|
|
1240
|
+
R
|
|
1241
|
+
],
|
|
1128
1242
|
__init__: ["cmLabelEditing"],
|
|
1129
|
-
cmLabelEditing: ["type",
|
|
1130
|
-
}
|
|
1243
|
+
cmLabelEditing: ["type", Ht]
|
|
1244
|
+
};
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/draw/palette-icons.ts
|
|
1247
|
+
function Wt(e, t = 24) {
|
|
1248
|
+
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
|
|
1249
|
+
}
|
|
1250
|
+
var Gt = "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 22 12 18.56 5.82 22 7 14.14l-5-4.87 7.1-1.01z", Kt = "M23 5.5V20c0 2.2-1.8 4-4 4h-7.3c-1.08 0-2.1-.43-2.85-1.19L1 14.83s1.26-1.23 1.3-1.25c.22-.19.49-.29.79-.29.22 0 .42.06.6.16.04.01 4.31 2.46 4.31 2.46V4c0-.83.67-1.5 1.5-1.5S11 3.17 11 4v7h1V1.5c0-.83.67-1.5 1.5-1.5S15 .67 15 1.5V11h1V2.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V11h1V5.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5z";
|
|
1251
|
+
function qt(e, t, n, r, i) {
|
|
1252
|
+
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"/>`;
|
|
1253
|
+
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}`;
|
|
1254
|
+
return `<path d="${e === "core" ? Gt : Kt}" fill="${i}" transform="${s}"/>`;
|
|
1255
|
+
}
|
|
1256
|
+
function B(e) {
|
|
1257
|
+
let t = e ? p[e] : void 0;
|
|
1258
|
+
return Wt(!e || !t ? `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${Je}" stroke="${Ye}" stroke-width="1.5"/>` : `<rect x="2" y="4" width="22" height="18" rx="3.5" fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5"/>` + qt(e, 13, 13, 12, t.stroke));
|
|
1259
|
+
}
|
|
1260
|
+
function Jt(e, t = 18) {
|
|
1261
|
+
let n = p[e], r = n?.stroke ?? "#8A8577";
|
|
1262
|
+
return `<svg class="cm-palette-svg" width="${t}" height="${t}" viewBox="0 0 24 24" aria-hidden="true">${!n || e === "generic" ? `<circle cx="12" cy="12" r="9" fill="none" stroke="${r}" stroke-width="1.8" stroke-dasharray="2.4 2.4"/>` : `<path d="${e === "core" ? Gt : Kt}" fill="${r}"/>`}</svg>`;
|
|
1263
|
+
}
|
|
1264
|
+
function V(e) {
|
|
1265
|
+
return Wt(`<rect x="1" y="6.5" width="24" height="13" rx="3" fill="${l[e] ?? "#8A8577"}"/><text x="13" y="16.4" text-anchor="middle" font-size="9.5" font-weight="700" fill="${u}" font-family="${A.family}">${e}</text>`);
|
|
1266
|
+
}
|
|
1267
|
+
function H(e = "upstream-downstream", t = 24) {
|
|
1268
|
+
let n = f[e] ?? f["upstream-downstream"], r = n.dash ? ` stroke-dasharray="${n.dash}"` : "", i = Math.min(n.strokeWidth, 2.6);
|
|
1269
|
+
return Wt(`<g stroke="${n.stroke}" stroke-width="${i}" stroke-linecap="round"><circle cx="5" cy="13" r="2.5" fill="${n.stroke}" stroke="none"/><line x1="7" y1="13" x2="19" y2="13"${r}/><circle cx="21" cy="13" r="2.5" fill="${n.stroke}" stroke="none"/></g>`, t);
|
|
1270
|
+
}
|
|
1271
|
+
//#endregion
|
|
1272
|
+
//#region src/draw/lucide.ts
|
|
1273
|
+
var Yt = {
|
|
1274
|
+
"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\"/>",
|
|
1275
|
+
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
1276
|
+
"circle-x": "<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"m15 9-6 6\"/><path d=\"m9 9 6 6\"/>",
|
|
1277
|
+
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\"/>",
|
|
1278
|
+
"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\"/>",
|
|
1279
|
+
"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\"/>",
|
|
1280
|
+
"square-plus": "<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M8 12h8\"/><path d=\"M12 8v8\"/>",
|
|
1281
|
+
"text-align-start": "<path d=\"M21 5H3\"/><path d=\"M15 12H3\"/><path d=\"M17 19H3\"/>",
|
|
1282
|
+
"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\"/>",
|
|
1283
|
+
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\"/>",
|
|
1284
|
+
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\"/>",
|
|
1285
|
+
x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"
|
|
1286
|
+
};
|
|
1287
|
+
function Xt(e, t, n) {
|
|
1288
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${Yt[e]}</svg>`;
|
|
1289
|
+
}
|
|
1290
|
+
function U(e) {
|
|
1291
|
+
return Xt(e, 16, 2.5);
|
|
1292
|
+
}
|
|
1293
|
+
function Zt(e) {
|
|
1294
|
+
return Xt(e, 20, 2);
|
|
1295
|
+
}
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region src/palette/CmPaletteProvider.ts
|
|
1298
|
+
var Qt = "tools", $t = "cm-1-contexts", en = 24;
|
|
1299
|
+
function tn(e, t) {
|
|
1300
|
+
return `<div class="entry cm-palette-entry"${t ? " draggable=\"true\"" : ""}>${e}</div>`;
|
|
1301
|
+
}
|
|
1302
|
+
function nn(e) {
|
|
1303
|
+
return e.charAt(0) + e.slice(1).toLowerCase();
|
|
1304
|
+
}
|
|
1305
|
+
function rn(e) {
|
|
1306
|
+
return e.type === "click" && e.detail === 0;
|
|
1307
|
+
}
|
|
1308
|
+
var an = class {
|
|
1309
|
+
create;
|
|
1310
|
+
lassoTool;
|
|
1311
|
+
factory;
|
|
1312
|
+
canvas;
|
|
1313
|
+
modeling;
|
|
1314
|
+
selection;
|
|
1315
|
+
elementRegistry;
|
|
1316
|
+
labelEditing;
|
|
1317
|
+
readOnly;
|
|
1318
|
+
config;
|
|
1319
|
+
static $inject = [
|
|
1320
|
+
"palette",
|
|
1321
|
+
"create",
|
|
1322
|
+
"lassoTool",
|
|
1323
|
+
"cmElementFactory",
|
|
1324
|
+
"canvas",
|
|
1325
|
+
"modeling",
|
|
1326
|
+
"selection",
|
|
1327
|
+
"elementRegistry",
|
|
1328
|
+
"cmLabelEditing",
|
|
1329
|
+
"cmReadOnly",
|
|
1330
|
+
"config.cmPalette"
|
|
1331
|
+
];
|
|
1332
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u) {
|
|
1333
|
+
this.create = t, this.lassoTool = n, this.factory = r, this.canvas = i, this.modeling = a, this.selection = o, this.elementRegistry = s, this.labelEditing = c, this.readOnly = l, this.config = u, e.registerProvider(this);
|
|
1334
|
+
}
|
|
1335
|
+
getPaletteEntries() {
|
|
1336
|
+
let e = {};
|
|
1337
|
+
e["lasso-tool"] = {
|
|
1338
|
+
group: Qt,
|
|
1339
|
+
title: "Lasso",
|
|
1340
|
+
html: tn(Zt("square-dashed-mouse-pointer"), !1),
|
|
1341
|
+
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
1342
|
+
};
|
|
1343
|
+
for (let t of n) {
|
|
1344
|
+
let n = (e) => {
|
|
1345
|
+
let n = this.factory.createNewContext(t.type, t.label);
|
|
1346
|
+
rn(e) ? this.placeInFreeRect(n) : this.create.start(e, n);
|
|
1347
|
+
};
|
|
1348
|
+
e[`context.${t.type}`] = {
|
|
1349
|
+
group: $t,
|
|
1350
|
+
title: nn(t.label),
|
|
1351
|
+
html: tn(B(t.type), !0),
|
|
1352
|
+
action: {
|
|
1353
|
+
dragstart: n,
|
|
1354
|
+
click: n
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
return e;
|
|
1359
|
+
}
|
|
1360
|
+
placeInFreeRect(e) {
|
|
1361
|
+
if (this.readOnly.isReadOnly()) return;
|
|
1362
|
+
let t = this.freeRectCentre(), n = (e) => this.elementRegistry.filter((e) => T(e)).some((t) => {
|
|
1363
|
+
let n = t;
|
|
1364
|
+
return Math.abs(n.x + n.width / 2 - e.x) < 1 && Math.abs(n.y + n.height / 2 - e.y) < 1;
|
|
1365
|
+
});
|
|
1366
|
+
for (; n(t);) t.x += en, t.y += en;
|
|
1367
|
+
let r = this.modeling.createShape(e, t, this.canvas.getRootElement());
|
|
1368
|
+
this.selection.select(r), this.canvas.focus(), this.labelEditing.activate(r);
|
|
1369
|
+
}
|
|
1370
|
+
freeRectCentre() {
|
|
1371
|
+
let e = this.canvas.viewbox(), t = this.config?.freeRectInsets?.() ?? {
|
|
1372
|
+
top: 0,
|
|
1373
|
+
right: 0,
|
|
1374
|
+
bottom: 0,
|
|
1375
|
+
left: 0
|
|
1376
|
+
}, n = Math.max(0, e.outer.width - t.left - t.right), r = Math.max(0, e.outer.height - t.top - t.bottom);
|
|
1377
|
+
return {
|
|
1378
|
+
x: e.x + (t.left + n / 2) / e.scale,
|
|
1379
|
+
y: e.y + (t.top + r / 2) / e.scale
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
}, on = {
|
|
1383
|
+
__depends__: [
|
|
1384
|
+
be,
|
|
1385
|
+
xe,
|
|
1386
|
+
C,
|
|
1387
|
+
Se,
|
|
1388
|
+
S,
|
|
1389
|
+
x,
|
|
1390
|
+
z,
|
|
1391
|
+
R
|
|
1392
|
+
],
|
|
1393
|
+
__init__: ["cmPaletteProvider"],
|
|
1394
|
+
cmPaletteProvider: ["type", an]
|
|
1395
|
+
}, sn = "cm-subdomain-menu", cn = "cm-pattern-menu", W = "cm-roles-menu", G = "cm-popup-active", K = 8, ln = {
|
|
1131
1396
|
OHS: "Open Host Service is one-size-fits-all and not applicable in a customer-supplier relationship.",
|
|
1132
1397
|
CF: "Conformist is not applicable in a customer-supplier relationship — a customer can negotiate."
|
|
1133
1398
|
};
|
|
1134
|
-
function
|
|
1135
|
-
|
|
1136
|
-
|
|
1399
|
+
function un(e) {
|
|
1400
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1401
|
+
}
|
|
1402
|
+
function q(e, t, n = {}) {
|
|
1403
|
+
let r = n.draggable ? " draggable=\"true\"" : "", i = n.danger ? " cm-pad-entry--danger" : "", a = un(t);
|
|
1404
|
+
return `<div class="entry cm-pad-entry${i}"${r} title="${a}" aria-label="${a}">${e}</div>`;
|
|
1137
1405
|
}
|
|
1138
|
-
var
|
|
1406
|
+
var dn = class {
|
|
1139
1407
|
contextPad;
|
|
1140
1408
|
popupMenu;
|
|
1141
1409
|
eventBus;
|
|
@@ -1150,6 +1418,7 @@ var Rt = class {
|
|
|
1150
1418
|
selection;
|
|
1151
1419
|
canvas;
|
|
1152
1420
|
scheduler;
|
|
1421
|
+
readOnly;
|
|
1153
1422
|
static $inject = [
|
|
1154
1423
|
"contextPad",
|
|
1155
1424
|
"popupMenu",
|
|
@@ -1165,16 +1434,24 @@ var Rt = class {
|
|
|
1165
1434
|
"cmElementFactory",
|
|
1166
1435
|
"selection",
|
|
1167
1436
|
"canvas",
|
|
1168
|
-
"scheduler"
|
|
1437
|
+
"scheduler",
|
|
1438
|
+
"cmReadOnly"
|
|
1169
1439
|
];
|
|
1170
1440
|
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,
|
|
1441
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
|
|
1442
|
+
this.contextPad = e, this.popupMenu = t, this.eventBus = n, this.create = i, this.autoPlace = a, this.rules = o, this.dragging = s, this.modeling = c, this.cmModeling = l, this.labelEditing = u, this.elementFactory = d, this.selection = f, this.canvas = p, this.scheduler = m, this.readOnly = h, e.registerProvider(this), n.on("contextPad.open.allowed", 2e3, () => !this.readOnly.isReadOnly() && void 0), n.on(L, (n) => {
|
|
1443
|
+
if (n.readOnly) {
|
|
1444
|
+
this.cancelPrompt(), t.close(), e.close();
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
let r = f.get();
|
|
1448
|
+
r.length === 1 ? e.open(r[0], !0) : r.length > 1 && e.open(r, !0);
|
|
1449
|
+
}), t.registerProvider(sn, { getPopupMenuEntries: (e) => this.subdomainMenuEntries(e) }), t.registerProvider(cn, { getPopupMenuEntries: (e) => this.patternMenuEntries(e) }), t.registerProvider(W, { getPopupMenuEntries: (e) => this.rolesMenuEntries(e) }), n.on("autoPlace", (e) => {
|
|
1173
1450
|
let { source: t, shape: n } = e, r = {
|
|
1174
|
-
x:
|
|
1451
|
+
x: ce(t).right + De + n.width / 2,
|
|
1175
1452
|
y: _(t).y
|
|
1176
1453
|
};
|
|
1177
|
-
return
|
|
1454
|
+
return Oe(t, n, r, ke({ y: {
|
|
1178
1455
|
margin: 30,
|
|
1179
1456
|
minDistance: 30
|
|
1180
1457
|
} }));
|
|
@@ -1182,7 +1459,7 @@ var Rt = class {
|
|
|
1182
1459
|
let { pad: t, target: n } = e;
|
|
1183
1460
|
if (!t) return;
|
|
1184
1461
|
let r = !1, i = !1;
|
|
1185
|
-
if (
|
|
1462
|
+
if (E(n)) {
|
|
1186
1463
|
let e = n.waypoints ?? [], t = e[e.length - 1], a = e[e.length - 2];
|
|
1187
1464
|
if (t && a) {
|
|
1188
1465
|
let e = t.x - a.x, n = t.y - a.y;
|
|
@@ -1211,18 +1488,19 @@ var Rt = class {
|
|
|
1211
1488
|
}, "cmContextPad#clampIntoView");
|
|
1212
1489
|
}
|
|
1213
1490
|
getContextPadEntries(e) {
|
|
1214
|
-
return
|
|
1491
|
+
return this.readOnly.isReadOnly() ? {} : T(e) ? this.contextEntries(e) : E(e) ? this.relationshipEntries(e) : {};
|
|
1215
1492
|
}
|
|
1216
1493
|
getMultiElementContextPadEntries(e) {
|
|
1217
|
-
|
|
1494
|
+
if (this.readOnly.isReadOnly()) return {};
|
|
1495
|
+
let t = e.filter(w);
|
|
1218
1496
|
return t.length === e.length ? { delete: this.deleteEntry(t, "Delete selection") } : {};
|
|
1219
1497
|
}
|
|
1220
1498
|
contextEntries(e) {
|
|
1221
|
-
let t = e.subdomainType ?
|
|
1499
|
+
let t = e.subdomainType ? p[e.subdomainType] : void 0;
|
|
1222
1500
|
return {
|
|
1223
1501
|
"append-context": {
|
|
1224
1502
|
group: "edit",
|
|
1225
|
-
html:
|
|
1503
|
+
html: q(U("square-plus"), "Append a connected context — click to place automatically, drag to position", { draggable: !0 }),
|
|
1226
1504
|
action: {
|
|
1227
1505
|
click: () => this.appendContext(e),
|
|
1228
1506
|
dragstart: (t) => this.startAppend(t, e)
|
|
@@ -1230,7 +1508,7 @@ var Rt = class {
|
|
|
1230
1508
|
},
|
|
1231
1509
|
connect: {
|
|
1232
1510
|
group: "edit",
|
|
1233
|
-
html:
|
|
1511
|
+
html: q(U("arrow-right"), "Connect to another context", { draggable: !0 }),
|
|
1234
1512
|
action: {
|
|
1235
1513
|
click: (t) => this.startConnect(t, e, !0),
|
|
1236
1514
|
dragstart: (t) => this.startConnect(t, e, !1)
|
|
@@ -1238,12 +1516,12 @@ var Rt = class {
|
|
|
1238
1516
|
},
|
|
1239
1517
|
"subdomain-type": {
|
|
1240
1518
|
group: "edit",
|
|
1241
|
-
html:
|
|
1242
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1519
|
+
html: q(B(e.subdomainType), `Change subdomain type — currently ${t?.label ?? "unclassified"}`),
|
|
1520
|
+
action: { click: (t) => this.openMenu(t, e, sn, "Subdomain type") }
|
|
1243
1521
|
},
|
|
1244
1522
|
team: {
|
|
1245
1523
|
group: "edit",
|
|
1246
|
-
html:
|
|
1524
|
+
html: q(U("users"), `Set owning team — currently ${e.team ?? "none"}`),
|
|
1247
1525
|
action: { click: () => this.labelEditing.activateTeam(e) }
|
|
1248
1526
|
},
|
|
1249
1527
|
"edit-label": this.editLabelEntry(e, "Rename context"),
|
|
@@ -1292,36 +1570,36 @@ var Rt = class {
|
|
|
1292
1570
|
this.scheduler.schedule(() => {
|
|
1293
1571
|
if (!this.contextPad.isOpen(e)) return;
|
|
1294
1572
|
let t = this.canvas.getContainer().querySelector(".djs-context-pad.open [data-action=\"subdomain-type\"]");
|
|
1295
|
-
t && this.openMenuBeside(t.getBoundingClientRect(), e,
|
|
1573
|
+
t && this.openMenuBeside(t.getBoundingClientRect(), e, sn, "Subdomain type");
|
|
1296
1574
|
}, "cmContextPad#openTypeMenu");
|
|
1297
1575
|
}
|
|
1298
1576
|
relationshipEntries(e) {
|
|
1299
|
-
let t =
|
|
1577
|
+
let t = f[e.pattern], n = { pattern: {
|
|
1300
1578
|
group: "edit",
|
|
1301
|
-
html:
|
|
1302
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1579
|
+
html: q(H(t?.pattern), `Change pattern — currently ${t?.label ?? e.pattern}`),
|
|
1580
|
+
action: { click: (t) => this.openMenu(t, e, cn, "Relationship pattern") }
|
|
1303
1581
|
} };
|
|
1304
1582
|
return t && !t.symmetric && (n.roles = {
|
|
1305
1583
|
group: "edit",
|
|
1306
|
-
html:
|
|
1307
|
-
action: { click: (t) => this.openMenu(t, e,
|
|
1584
|
+
html: q(U("sliders-horizontal"), "Edit integration roles — OHS/PL upstream, ACL/CF downstream"),
|
|
1585
|
+
action: { click: (t) => this.openMenu(t, e, W, "Integration roles") }
|
|
1308
1586
|
}, n["swap-ends"] = {
|
|
1309
1587
|
group: "edit",
|
|
1310
|
-
html:
|
|
1588
|
+
html: q(U("arrow-left-right"), "Swap ends — reverse upstream/downstream"),
|
|
1311
1589
|
action: { click: () => this.cmModeling.swapEnds(e) }
|
|
1312
1590
|
}), 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
1591
|
}
|
|
1314
1592
|
editLabelEntry(e, t) {
|
|
1315
1593
|
return {
|
|
1316
1594
|
group: "edit",
|
|
1317
|
-
html:
|
|
1595
|
+
html: q(U("pencil"), `${t} — edit the name in place`),
|
|
1318
1596
|
action: { click: () => this.labelEditing.activate(e) }
|
|
1319
1597
|
};
|
|
1320
1598
|
}
|
|
1321
1599
|
descriptionEntry(e, t) {
|
|
1322
1600
|
return {
|
|
1323
1601
|
group: "edit",
|
|
1324
|
-
html:
|
|
1602
|
+
html: q(U("text-align-start"), "Edit description"),
|
|
1325
1603
|
action: { click: (n) => this.openPrompt(n, {
|
|
1326
1604
|
value: e.description ?? "",
|
|
1327
1605
|
placeholder: t,
|
|
@@ -1332,10 +1610,13 @@ var Rt = class {
|
|
|
1332
1610
|
};
|
|
1333
1611
|
}
|
|
1334
1612
|
activePrompt;
|
|
1613
|
+
cancelPrompt() {
|
|
1614
|
+
this.activePrompt?.cancel();
|
|
1615
|
+
}
|
|
1335
1616
|
openPrompt(e, t) {
|
|
1336
1617
|
this.activePrompt?.cancel();
|
|
1337
1618
|
let n = (e.delegateTarget ?? e.target).getBoundingClientRect(), r = document.createElement("div");
|
|
1338
|
-
r.className = "cm-pad-prompt", r.style.left = `${n.right +
|
|
1619
|
+
r.className = "cm-pad-prompt", r.style.left = `${n.right + K}px`, r.style.top = `${n.top}px`;
|
|
1339
1620
|
let i = document.createElement(t.multiline ? "textarea" : "input");
|
|
1340
1621
|
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
1622
|
let e = document.createElement("div");
|
|
@@ -1343,7 +1624,7 @@ var Rt = class {
|
|
|
1343
1624
|
}
|
|
1344
1625
|
this.canvas.getContainer().appendChild(r);
|
|
1345
1626
|
let a = r.getBoundingClientRect();
|
|
1346
|
-
a.right > window.innerWidth - 8 && (r.style.left = `${Math.max(8, n.left - a.width -
|
|
1627
|
+
a.right > window.innerWidth - 8 && (r.style.left = `${Math.max(8, n.left - a.width - K)}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
1628
|
let o = () => l();
|
|
1348
1629
|
this.eventBus.on("canvas.viewbox.changing", o);
|
|
1349
1630
|
let s = !1, c = () => {
|
|
@@ -1361,7 +1642,7 @@ var Rt = class {
|
|
|
1361
1642
|
deleteEntry(e, t) {
|
|
1362
1643
|
return {
|
|
1363
1644
|
group: "delete",
|
|
1364
|
-
html:
|
|
1645
|
+
html: q(U("trash"), t, { danger: !0 }),
|
|
1365
1646
|
action: { click: () => this.modeling.removeElements(e) }
|
|
1366
1647
|
};
|
|
1367
1648
|
}
|
|
@@ -1371,12 +1652,12 @@ var Rt = class {
|
|
|
1371
1652
|
}
|
|
1372
1653
|
openMenuBeside(e, t, n, r) {
|
|
1373
1654
|
let i = {
|
|
1374
|
-
x: e.right +
|
|
1655
|
+
x: e.right + K,
|
|
1375
1656
|
y: e.top
|
|
1376
1657
|
};
|
|
1377
1658
|
this.popupMenu.open(t, n, i, { title: r });
|
|
1378
1659
|
let a = document.querySelector(".djs-popup"), o = a?.getBoundingClientRect();
|
|
1379
|
-
a && o && o.left < e.right && (i.x = Math.max(
|
|
1660
|
+
a && o && o.left < e.right && (i.x = Math.max(K, e.left - K - o.width), a.style.left = `${i.x}px`), this.currentMenu = {
|
|
1380
1661
|
element: t,
|
|
1381
1662
|
menuId: n,
|
|
1382
1663
|
title: r,
|
|
@@ -1385,221 +1666,152 @@ var Rt = class {
|
|
|
1385
1666
|
}
|
|
1386
1667
|
reopenMenu(e, t) {
|
|
1387
1668
|
let n = this.currentMenu;
|
|
1388
|
-
|
|
1669
|
+
n && n.menuId === t && n.element === e && this.popupMenu.open(e, t, n.position, { title: n.title });
|
|
1389
1670
|
}
|
|
1390
1671
|
subdomainMenuEntries(e) {
|
|
1391
|
-
if (!
|
|
1392
|
-
let t = e.subdomainType,
|
|
1393
|
-
for (let i of
|
|
1672
|
+
if (!T(e)) return {};
|
|
1673
|
+
let t = e.subdomainType, r = {};
|
|
1674
|
+
for (let i of n) r[`type-${i.type}`] = {
|
|
1394
1675
|
label: i.label,
|
|
1395
1676
|
description: i.description,
|
|
1396
1677
|
imageHtml: B(i.type),
|
|
1397
|
-
...i.type === t ? { className:
|
|
1678
|
+
...i.type === t ? { className: G } : {},
|
|
1398
1679
|
action: () => {
|
|
1399
1680
|
i.type !== t && this.cmModeling.setSubdomainType(e, i.type);
|
|
1400
1681
|
}
|
|
1401
1682
|
};
|
|
1402
|
-
return
|
|
1683
|
+
return r["type-none"] = {
|
|
1403
1684
|
label: "Unclassified",
|
|
1404
1685
|
description: "No subdomain classification.",
|
|
1405
1686
|
imageHtml: B(),
|
|
1406
|
-
...t === void 0 ? { className:
|
|
1687
|
+
...t === void 0 ? { className: G } : {},
|
|
1407
1688
|
action: () => {
|
|
1408
1689
|
t !== void 0 && this.cmModeling.setSubdomainType(e, void 0);
|
|
1409
1690
|
}
|
|
1410
|
-
},
|
|
1691
|
+
}, r;
|
|
1411
1692
|
}
|
|
1412
1693
|
patternMenuEntries(e) {
|
|
1413
|
-
if (!
|
|
1414
|
-
let
|
|
1415
|
-
for (let i of
|
|
1694
|
+
if (!E(e)) return {};
|
|
1695
|
+
let n = e.pattern, r = {};
|
|
1696
|
+
for (let i of t) r[`pattern-${i.pattern}`] = {
|
|
1416
1697
|
label: i.label,
|
|
1417
1698
|
description: i.description,
|
|
1418
1699
|
imageHtml: H(i.pattern),
|
|
1419
|
-
...i.pattern ===
|
|
1700
|
+
...i.pattern === n ? { className: G } : {},
|
|
1420
1701
|
action: () => {
|
|
1421
|
-
i.pattern !==
|
|
1702
|
+
i.pattern !== n && this.cmModeling.setPattern(e, i.pattern);
|
|
1422
1703
|
}
|
|
1423
1704
|
};
|
|
1424
1705
|
return r;
|
|
1425
1706
|
}
|
|
1426
1707
|
rolesMenuEntries(e) {
|
|
1427
|
-
if (!
|
|
1428
|
-
let t =
|
|
1708
|
+
if (!E(e)) return {};
|
|
1709
|
+
let t = f[e.pattern];
|
|
1429
1710
|
if (!t || t.symmetric) return {};
|
|
1430
|
-
let n = e.pattern === "customer-supplier", r = e.upstreamRoles ?? [], i = e.downstreamRoles ?? [],
|
|
1431
|
-
for (let t of
|
|
1432
|
-
let i = r.includes(t),
|
|
1433
|
-
|
|
1434
|
-
label:
|
|
1435
|
-
description:
|
|
1711
|
+
let n = e.pattern === "customer-supplier", r = e.upstreamRoles ?? [], i = e.downstreamRoles ?? [], a = {};
|
|
1712
|
+
for (let t of m) {
|
|
1713
|
+
let i = r.includes(t), o = n ? ln[t] : void 0, s = o !== void 0 && !i;
|
|
1714
|
+
a[`upstream-${t}`] = {
|
|
1715
|
+
label: h[t].label,
|
|
1716
|
+
description: o ? i ? `${o} Click to remove it.` : o : h[t].description,
|
|
1436
1717
|
imageHtml: V(t),
|
|
1437
1718
|
group: {
|
|
1438
1719
|
id: "upstream",
|
|
1439
1720
|
name: "Upstream (from) — OHS and/or PL"
|
|
1440
1721
|
},
|
|
1441
|
-
...
|
|
1442
|
-
...i ? { className:
|
|
1722
|
+
...s ? { disabled: !0 } : {},
|
|
1723
|
+
...i ? { className: G } : {},
|
|
1443
1724
|
action: () => {
|
|
1444
|
-
|
|
1725
|
+
s || (this.cmModeling.setUpstreamRoles(e, i ? r.filter((e) => e !== t) : [...r, t]), this.reopenMenu(e, W));
|
|
1445
1726
|
}
|
|
1446
1727
|
};
|
|
1447
1728
|
}
|
|
1448
|
-
for (let t of
|
|
1449
|
-
let r = i.includes(t),
|
|
1450
|
-
|
|
1451
|
-
label:
|
|
1452
|
-
description:
|
|
1729
|
+
for (let t of s) {
|
|
1730
|
+
let r = i.includes(t), o = n ? ln[t] : void 0, s = o !== void 0 && !r;
|
|
1731
|
+
a[`downstream-${t}`] = {
|
|
1732
|
+
label: c[t].label,
|
|
1733
|
+
description: o ? r ? `${o} Click to remove it.` : o : c[t].description,
|
|
1453
1734
|
imageHtml: V(t),
|
|
1454
1735
|
group: {
|
|
1455
1736
|
id: "downstream",
|
|
1456
1737
|
name: "Downstream (to) — ACL or CF, not both"
|
|
1457
1738
|
},
|
|
1458
|
-
...
|
|
1459
|
-
...r ? { className:
|
|
1739
|
+
...s ? { disabled: !0 } : {},
|
|
1740
|
+
...r ? { className: G } : {},
|
|
1460
1741
|
action: () => {
|
|
1461
|
-
|
|
1742
|
+
s || (this.cmModeling.setDownstreamRoles(e, r ? [] : [t]), this.reopenMenu(e, W));
|
|
1462
1743
|
}
|
|
1463
1744
|
};
|
|
1464
1745
|
}
|
|
1465
|
-
return
|
|
1746
|
+
return a;
|
|
1466
1747
|
}
|
|
1467
|
-
},
|
|
1748
|
+
}, fn = {
|
|
1468
1749
|
__depends__: [
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1750
|
+
we,
|
|
1751
|
+
Te,
|
|
1752
|
+
C,
|
|
1753
|
+
xe,
|
|
1754
|
+
Ee,
|
|
1755
|
+
x,
|
|
1474
1756
|
S,
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1757
|
+
F,
|
|
1758
|
+
I,
|
|
1759
|
+
z,
|
|
1760
|
+
R
|
|
1479
1761
|
],
|
|
1480
1762
|
__init__: ["cmContextPadProvider"],
|
|
1481
|
-
cmContextPadProvider: ["type",
|
|
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;
|
|
1510
|
-
}
|
|
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]
|
|
1763
|
+
cmContextPadProvider: ["type", dn]
|
|
1570
1764
|
};
|
|
1571
1765
|
//#endregion
|
|
1572
1766
|
//#region src/keyboard/CmKeyboard.ts
|
|
1573
|
-
function
|
|
1767
|
+
function pn(e) {
|
|
1574
1768
|
let t = e;
|
|
1575
1769
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
1576
1770
|
}
|
|
1577
|
-
|
|
1771
|
+
function mn(e, t) {
|
|
1772
|
+
if (!(e instanceof Node) || e instanceof Element && e.closest(".djs-palette")) return !1;
|
|
1773
|
+
let n = t.ownerDocument;
|
|
1774
|
+
return t.contains(e) || e === n.body || e === n.documentElement;
|
|
1775
|
+
}
|
|
1776
|
+
var hn = class {
|
|
1578
1777
|
static $inject = [
|
|
1778
|
+
"config.cmKeyboard",
|
|
1579
1779
|
"canvas",
|
|
1580
1780
|
"commandStack",
|
|
1581
1781
|
"selection",
|
|
1582
|
-
"modeling"
|
|
1782
|
+
"modeling",
|
|
1783
|
+
"elementRegistry",
|
|
1784
|
+
"eventBus",
|
|
1785
|
+
"cmReadOnly"
|
|
1583
1786
|
];
|
|
1584
|
-
constructor(e, t, n, r) {
|
|
1585
|
-
|
|
1586
|
-
if (
|
|
1587
|
-
let
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
let t = n.get();
|
|
1592
|
-
t.length && (e.preventDefault(), r.removeElements([...t]));
|
|
1787
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
1788
|
+
let c = t.getContainer(), l = c.ownerDocument ?? document, u = e?.undoRedoKeys ?? !0, d = (e) => {
|
|
1789
|
+
if (e.defaultPrevented || !mn(e.target, c) || pn(e.target)) return;
|
|
1790
|
+
let t = e.ctrlKey || e.metaKey, o = e.key.toLowerCase();
|
|
1791
|
+
if (t && o === "a" && !e.shiftKey && !e.altKey) {
|
|
1792
|
+
e.preventDefault(), r.select(a.filter((e) => w(e)));
|
|
1793
|
+
return;
|
|
1593
1794
|
}
|
|
1594
|
-
|
|
1795
|
+
if (s.isReadOnly()) return;
|
|
1796
|
+
let l = t && o === "z" && !e.shiftKey, d = t && o === "z" && e.shiftKey || t && o === "y" && !e.shiftKey;
|
|
1797
|
+
if (l || d) {
|
|
1798
|
+
if (!u) return;
|
|
1799
|
+
e.preventDefault(), l && n.canUndo() && n.undo(), d && n.canRedo() && n.redo();
|
|
1800
|
+
} else if (o === "delete" || o === "backspace") {
|
|
1801
|
+
let t = r.get();
|
|
1802
|
+
t.length && (e.preventDefault(), i.removeElements([...t]));
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1805
|
+
l.addEventListener("keydown", d), o.on("diagram.destroy", () => l.removeEventListener("keydown", d));
|
|
1595
1806
|
}
|
|
1596
|
-
},
|
|
1807
|
+
}, gn = {
|
|
1808
|
+
__depends__: [R],
|
|
1597
1809
|
__init__: ["cmKeyboard"],
|
|
1598
|
-
cmKeyboard: ["type",
|
|
1599
|
-
},
|
|
1600
|
-
function
|
|
1601
|
-
let t = e.some((e) => e.kind === "error")
|
|
1602
|
-
n.className = "cm-validation-marker", n.
|
|
1810
|
+
cmKeyboard: ["type", hn]
|
|
1811
|
+
}, _n = "cm-validation", vn = 22, J = 16, yn = 44;
|
|
1812
|
+
function bn(e) {
|
|
1813
|
+
let t = e.some((e) => e.kind === "error"), n = document.createElement("div");
|
|
1814
|
+
n.className = "cm-validation-marker", n.dataset.severity = t ? "error" : "warning", n.innerHTML = U(t ? "circle-x" : "triangle-alert");
|
|
1603
1815
|
let r = document.createElement("div");
|
|
1604
1816
|
r.className = "cm-validation-tooltip";
|
|
1605
1817
|
for (let t of e) {
|
|
@@ -1608,13 +1820,13 @@ function $t(e) {
|
|
|
1608
1820
|
}
|
|
1609
1821
|
return n.appendChild(r), n;
|
|
1610
1822
|
}
|
|
1611
|
-
function
|
|
1823
|
+
function xn(e, t, n) {
|
|
1612
1824
|
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;
|
|
1613
1825
|
if (n === "middle") return {
|
|
1614
|
-
x: (r.x + i.x) / 2 + -l *
|
|
1615
|
-
y: (r.y + i.y) / 2 + c *
|
|
1826
|
+
x: (r.x + i.x) / 2 + -l * J,
|
|
1827
|
+
y: (r.y + i.y) / 2 + c * J
|
|
1616
1828
|
};
|
|
1617
|
-
let u = e.pattern === "customer-supplier", d = n === "upstream" ?
|
|
1829
|
+
let u = e.pattern === "customer-supplier", d = n === "upstream" ? M(r, i, u ? "S" : "U", e.upstreamRoles ?? []) : M(i, r, u ? "C" : "D", e.downstreamRoles ?? []);
|
|
1618
1830
|
if (d) {
|
|
1619
1831
|
let e = {
|
|
1620
1832
|
x: d.box.x + d.box.width,
|
|
@@ -1625,16 +1837,16 @@ function en(e, t, n) {
|
|
|
1625
1837
|
y: e.y + 1
|
|
1626
1838
|
};
|
|
1627
1839
|
}
|
|
1628
|
-
let f = Math.min(
|
|
1840
|
+
let f = Math.min(yn, s * .35), p = n === "upstream" ? r.x + c * f : i.x - c * f, m = n === "upstream" ? r.y + l * f : i.y - l * f;
|
|
1629
1841
|
return {
|
|
1630
|
-
x: p + -l *
|
|
1631
|
-
y: m + c *
|
|
1842
|
+
x: p + -l * J,
|
|
1843
|
+
y: m + c * J
|
|
1632
1844
|
};
|
|
1633
1845
|
}
|
|
1634
1846
|
//#endregion
|
|
1635
1847
|
//#region src/validation/index.ts
|
|
1636
|
-
var
|
|
1637
|
-
__depends__: [
|
|
1848
|
+
var Sn = {
|
|
1849
|
+
__depends__: [Ae],
|
|
1638
1850
|
__init__: ["cmValidationMarkers"],
|
|
1639
1851
|
cmValidationMarkers: ["type", class {
|
|
1640
1852
|
elementRegistry;
|
|
@@ -1652,8 +1864,8 @@ var tn = {
|
|
|
1652
1864
|
e.on("import.render.done", i), e.on("commandStack.changed", i);
|
|
1653
1865
|
}
|
|
1654
1866
|
refresh() {
|
|
1655
|
-
this.overlays.remove({ type:
|
|
1656
|
-
let e =
|
|
1867
|
+
this.overlays.remove({ type: _n });
|
|
1868
|
+
let e = ae(this.exporter.export()), t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
1657
1869
|
for (let r of e) {
|
|
1658
1870
|
if (!r.relationshipId) continue;
|
|
1659
1871
|
let e = `${r.relationshipId} ${r.side ?? "middle"}`, i = t.get(e) ?? {
|
|
@@ -1669,16 +1881,16 @@ var tn = {
|
|
|
1669
1881
|
n(e.errors, "error"), n(e.warnings, "warning");
|
|
1670
1882
|
for (let [e, n] of t) {
|
|
1671
1883
|
let t = this.elementRegistry.get(n.relationshipId);
|
|
1672
|
-
if (!
|
|
1884
|
+
if (!E(t)) continue;
|
|
1673
1885
|
let r = t.waypoints ?? [];
|
|
1674
1886
|
if (r.length < 2) continue;
|
|
1675
|
-
let i = e.split(" ")[1], { x: a, y: o } =
|
|
1676
|
-
this.overlays.add(t,
|
|
1887
|
+
let i = e.split(" ")[1], { x: a, y: o } = xn(t, r, i), s = Math.min(...r.map((e) => e.x)), c = Math.min(...r.map((e) => e.y));
|
|
1888
|
+
this.overlays.add(t, _n, {
|
|
1677
1889
|
position: {
|
|
1678
|
-
left: a - s -
|
|
1679
|
-
top: o - c -
|
|
1890
|
+
left: a - s - vn / 2,
|
|
1891
|
+
top: o - c - vn / 2
|
|
1680
1892
|
},
|
|
1681
|
-
html:
|
|
1893
|
+
html: bn(n.findings)
|
|
1682
1894
|
});
|
|
1683
1895
|
}
|
|
1684
1896
|
}
|
|
@@ -1686,10 +1898,10 @@ var tn = {
|
|
|
1686
1898
|
};
|
|
1687
1899
|
//#endregion
|
|
1688
1900
|
//#region src/zorder/CmZOrder.ts
|
|
1689
|
-
function
|
|
1690
|
-
return +!
|
|
1901
|
+
function Cn(e) {
|
|
1902
|
+
return +!E(e);
|
|
1691
1903
|
}
|
|
1692
|
-
var
|
|
1904
|
+
var wn = class {
|
|
1693
1905
|
canvas;
|
|
1694
1906
|
elementRegistry;
|
|
1695
1907
|
static $inject = [
|
|
@@ -1708,33 +1920,33 @@ var rn = class {
|
|
|
1708
1920
|
});
|
|
1709
1921
|
}
|
|
1710
1922
|
reorder() {
|
|
1711
|
-
let e = this.elementRegistry.getAll().filter(
|
|
1923
|
+
let e = this.elementRegistry.getAll().filter(w).sort((e, t) => Cn(e) - Cn(t));
|
|
1712
1924
|
for (let t of e) {
|
|
1713
1925
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
1714
1926
|
e && n && n.appendChild(e);
|
|
1715
1927
|
}
|
|
1716
1928
|
}
|
|
1717
|
-
},
|
|
1929
|
+
}, Tn = {
|
|
1718
1930
|
__init__: ["cmZOrder"],
|
|
1719
|
-
cmZOrder: ["type",
|
|
1720
|
-
},
|
|
1931
|
+
cmZOrder: ["type", wn]
|
|
1932
|
+
}, En = class extends P {
|
|
1721
1933
|
_getModules() {
|
|
1722
1934
|
return [
|
|
1723
1935
|
...super._getModules(),
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
L,
|
|
1936
|
+
pe,
|
|
1937
|
+
S,
|
|
1938
|
+
me,
|
|
1939
|
+
he,
|
|
1729
1940
|
R,
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1941
|
+
F,
|
|
1942
|
+
I,
|
|
1943
|
+
Ft,
|
|
1944
|
+
on,
|
|
1945
|
+
fn,
|
|
1946
|
+
z,
|
|
1947
|
+
gn,
|
|
1948
|
+
Sn,
|
|
1949
|
+
Tn
|
|
1738
1950
|
];
|
|
1739
1951
|
}
|
|
1740
1952
|
undo() {
|
|
@@ -1749,7 +1961,118 @@ var rn = class {
|
|
|
1749
1961
|
canRedo() {
|
|
1750
1962
|
return this.get("commandStack").canRedo();
|
|
1751
1963
|
}
|
|
1752
|
-
},
|
|
1964
|
+
}, Dn = "context-maps";
|
|
1965
|
+
function On(e = {}) {
|
|
1966
|
+
return jn(new En({
|
|
1967
|
+
...An(e),
|
|
1968
|
+
undoRedoKeys: e.undoRedoKeys ?? !0,
|
|
1969
|
+
freeRectInsets: e.freeRectInsets
|
|
1970
|
+
}), !0);
|
|
1971
|
+
}
|
|
1972
|
+
function kn(e = {}) {
|
|
1973
|
+
return jn(new P({
|
|
1974
|
+
...An(e),
|
|
1975
|
+
freeRectInsets: e.freeRectInsets
|
|
1976
|
+
}), !1);
|
|
1977
|
+
}
|
|
1978
|
+
function An(e) {
|
|
1979
|
+
return {
|
|
1980
|
+
width: "100%",
|
|
1981
|
+
height: "100%",
|
|
1982
|
+
additionalModules: e.additionalModules ?? []
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
function jn(e, t) {
|
|
1986
|
+
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = /* @__PURE__ */ new Set(), s = !1, c = "", l = {
|
|
1987
|
+
notation: Dn,
|
|
1988
|
+
apiVersion: je,
|
|
1989
|
+
editable: t
|
|
1990
|
+
};
|
|
1991
|
+
return t && n.on("commandStack.changed", () => {
|
|
1992
|
+
for (let e of [...o]) e();
|
|
1993
|
+
}), {
|
|
1994
|
+
meta: l,
|
|
1995
|
+
elements: {
|
|
1996
|
+
list: () => s ? [] : i.getAll().filter(w).map(Nn),
|
|
1997
|
+
reveal(e) {
|
|
1998
|
+
if (s) return !1;
|
|
1999
|
+
let t = i.get(e);
|
|
2000
|
+
return w(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
2001
|
+
},
|
|
2002
|
+
selection: () => s ? [] : Mn(a.get()),
|
|
2003
|
+
onSelection(e) {
|
|
2004
|
+
let t = (t) => e(Mn(t.newSelection ?? []));
|
|
2005
|
+
return n.on("selection.changed", t), () => n.off("selection.changed", t);
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
diagram: e,
|
|
2009
|
+
attachTo(t) {
|
|
2010
|
+
e.attachTo(t);
|
|
2011
|
+
},
|
|
2012
|
+
async importText(t) {
|
|
2013
|
+
if (s) throw Error("The modeler was destroyed.");
|
|
2014
|
+
let { warnings: n } = e.importText(t);
|
|
2015
|
+
return { warnings: n.map((e) => e.message) };
|
|
2016
|
+
},
|
|
2017
|
+
exportText() {
|
|
2018
|
+
return s ? c : e.exportText();
|
|
2019
|
+
},
|
|
2020
|
+
onContentChanged(e) {
|
|
2021
|
+
return t ? (o.add(e), () => o.delete(e)) : () => void 0;
|
|
2022
|
+
},
|
|
2023
|
+
getViewState() {
|
|
2024
|
+
if (!s) try {
|
|
2025
|
+
let { x: e, y: t, width: n, height: i } = r.viewbox(), a = {
|
|
2026
|
+
x: e,
|
|
2027
|
+
y: t,
|
|
2028
|
+
width: n,
|
|
2029
|
+
height: i
|
|
2030
|
+
};
|
|
2031
|
+
return Pn(a) ? a : void 0;
|
|
2032
|
+
} catch {
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
},
|
|
2036
|
+
setViewState(e) {
|
|
2037
|
+
!s && Pn(e) && r.viewbox({
|
|
2038
|
+
x: e.x,
|
|
2039
|
+
y: e.y,
|
|
2040
|
+
width: e.width,
|
|
2041
|
+
height: e.height
|
|
2042
|
+
});
|
|
2043
|
+
},
|
|
2044
|
+
destroy() {
|
|
2045
|
+
if (!s) {
|
|
2046
|
+
try {
|
|
2047
|
+
c = e.exportText();
|
|
2048
|
+
} catch {
|
|
2049
|
+
c = "";
|
|
2050
|
+
}
|
|
2051
|
+
s = !0, o.clear(), e.destroy();
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
function Mn(e) {
|
|
2057
|
+
return e.filter(w).map((e) => e.id);
|
|
2058
|
+
}
|
|
2059
|
+
function Nn(e) {
|
|
2060
|
+
return e.cmLabel ? {
|
|
2061
|
+
id: e.id,
|
|
2062
|
+
name: e.cmLabel
|
|
2063
|
+
} : { id: e.id };
|
|
2064
|
+
}
|
|
2065
|
+
function Pn(e) {
|
|
2066
|
+
if (typeof e != "object" || !e) return !1;
|
|
2067
|
+
let { x: t, y: n, width: r, height: i } = e;
|
|
2068
|
+
return Y(t) && Y(n) && Y(r) && Y(i) && r > 0 && i > 0;
|
|
2069
|
+
}
|
|
2070
|
+
function Y(e) {
|
|
2071
|
+
return typeof e == "number" && Number.isFinite(e);
|
|
2072
|
+
}
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region src/connect-handles/CmConnectHandles.ts
|
|
2075
|
+
var Fn = "cm-connect-handle", In = 28, Ln = 12, Rn = [
|
|
1753
2076
|
{
|
|
1754
2077
|
side: "top",
|
|
1755
2078
|
rotationDeg: -90
|
|
@@ -1767,15 +2090,15 @@ var rn = class {
|
|
|
1767
2090
|
rotationDeg: 180
|
|
1768
2091
|
}
|
|
1769
2092
|
];
|
|
1770
|
-
function
|
|
1771
|
-
let n = t.width / 2 -
|
|
2093
|
+
function zn(e, t) {
|
|
2094
|
+
let n = t.width / 2 - In / 2, r = t.height / 2 - In / 2;
|
|
1772
2095
|
switch (e) {
|
|
1773
2096
|
case "top": return {
|
|
1774
2097
|
top: -40,
|
|
1775
2098
|
left: n
|
|
1776
2099
|
};
|
|
1777
2100
|
case "bottom": return {
|
|
1778
|
-
top: t.height +
|
|
2101
|
+
top: t.height + Ln,
|
|
1779
2102
|
left: n
|
|
1780
2103
|
};
|
|
1781
2104
|
case "left": return {
|
|
@@ -1784,37 +2107,41 @@ function dn(e, t) {
|
|
|
1784
2107
|
};
|
|
1785
2108
|
case "right": return {
|
|
1786
2109
|
top: r,
|
|
1787
|
-
left: t.width +
|
|
2110
|
+
left: t.width + Ln
|
|
1788
2111
|
};
|
|
1789
2112
|
}
|
|
1790
2113
|
}
|
|
1791
|
-
var
|
|
2114
|
+
var Bn = class {
|
|
1792
2115
|
eventBus;
|
|
1793
2116
|
selection;
|
|
1794
2117
|
overlays;
|
|
1795
2118
|
dragging;
|
|
2119
|
+
readOnly;
|
|
1796
2120
|
static $inject = [
|
|
1797
2121
|
"eventBus",
|
|
1798
2122
|
"selection",
|
|
1799
2123
|
"overlays",
|
|
1800
2124
|
"connect",
|
|
1801
|
-
"dragging"
|
|
2125
|
+
"dragging",
|
|
2126
|
+
"cmReadOnly"
|
|
1802
2127
|
];
|
|
1803
|
-
constructor(e, t, n, r, i) {
|
|
1804
|
-
this.eventBus = e, this.selection = t, this.overlays = n, this.dragging = i;
|
|
1805
|
-
let
|
|
1806
|
-
e.on("selection.changed",
|
|
2128
|
+
constructor(e, t, n, r, i, a) {
|
|
2129
|
+
this.eventBus = e, this.selection = t, this.overlays = n, this.dragging = i, this.readOnly = a;
|
|
2130
|
+
let o = () => this.refresh();
|
|
2131
|
+
e.on("selection.changed", o), e.on("commandStack.changed", o), e.on(L, o);
|
|
1807
2132
|
}
|
|
1808
2133
|
refresh() {
|
|
1809
|
-
this.overlays.remove({ type:
|
|
2134
|
+
if (this.overlays.remove({ type: Fn }), this.readOnly.isReadOnly()) return;
|
|
1810
2135
|
let e = this.selection.get();
|
|
1811
2136
|
if (e.length !== 1) return;
|
|
1812
2137
|
let t = e[0];
|
|
1813
|
-
if (!
|
|
2138
|
+
if (!T(t)) return;
|
|
1814
2139
|
let n = t;
|
|
1815
|
-
for (let { side: e, rotationDeg: r } of
|
|
2140
|
+
for (let { side: e, rotationDeg: r } of Rn) {
|
|
1816
2141
|
let i = document.createElement("div");
|
|
1817
|
-
i.className = "cm-connect-handle", i.dataset.side = e, i.title = "Connect to another context", i.
|
|
2142
|
+
i.className = "cm-connect-handle", i.dataset.side = e, i.title = "Connect to another context", i.setAttribute("aria-label", "Connect to another context");
|
|
2143
|
+
let a = document.createElement("span");
|
|
2144
|
+
a.className = "cm-connect-handle__arrow", a.style.transform = `rotate(${r}deg)`, a.innerHTML = U("arrow-right"), i.append(a), i.addEventListener("mousedown", (e) => {
|
|
1818
2145
|
e.button === 0 && (e.preventDefault(), e.stopPropagation(), this.dragging.init(e, "connect", {
|
|
1819
2146
|
autoActivate: !1,
|
|
1820
2147
|
trapClick: !1,
|
|
@@ -1828,22 +2155,424 @@ var fn = class {
|
|
|
1828
2155
|
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
1829
2156
|
this.selection.get().length === 0 && this.selection.select(t);
|
|
1830
2157
|
}));
|
|
1831
|
-
}), this.overlays.add(t,
|
|
1832
|
-
position:
|
|
2158
|
+
}), this.overlays.add(t, Fn, {
|
|
2159
|
+
position: zn(e, n),
|
|
1833
2160
|
html: i
|
|
1834
2161
|
});
|
|
1835
2162
|
}
|
|
1836
2163
|
}
|
|
1837
|
-
},
|
|
2164
|
+
}, Vn = {
|
|
1838
2165
|
__depends__: [
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
2166
|
+
C,
|
|
2167
|
+
Ae,
|
|
2168
|
+
x,
|
|
2169
|
+
R
|
|
1842
2170
|
],
|
|
1843
2171
|
__init__: ["cmConnectHandles"],
|
|
1844
|
-
cmConnectHandles: ["type",
|
|
1845
|
-
}
|
|
2172
|
+
cmConnectHandles: ["type", Bn]
|
|
2173
|
+
}, Hn = [
|
|
2174
|
+
{
|
|
2175
|
+
token: "OHS",
|
|
2176
|
+
...h.OHS
|
|
2177
|
+
},
|
|
2178
|
+
{
|
|
2179
|
+
token: "PL",
|
|
2180
|
+
...h.PL
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
token: "ACL",
|
|
2184
|
+
...c.ACL
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
token: "CF",
|
|
2188
|
+
...c.CF
|
|
2189
|
+
}
|
|
2190
|
+
];
|
|
2191
|
+
function X() {
|
|
2192
|
+
return [
|
|
2193
|
+
{
|
|
2194
|
+
label: "Subdomain types",
|
|
2195
|
+
rows: n.map((e) => ({
|
|
2196
|
+
preview: B(e.type),
|
|
2197
|
+
label: e.label,
|
|
2198
|
+
explanation: e.description
|
|
2199
|
+
}))
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
label: "Integration roles",
|
|
2203
|
+
rows: Hn.map((e) => ({
|
|
2204
|
+
preview: V(e.token),
|
|
2205
|
+
label: `${e.token} · ${e.label}`,
|
|
2206
|
+
explanation: e.description
|
|
2207
|
+
}))
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
label: "Relationship patterns",
|
|
2211
|
+
rows: t.map((e) => ({
|
|
2212
|
+
preview: H(e.pattern),
|
|
2213
|
+
label: `${e.abbreviation} · ${e.label}`,
|
|
2214
|
+
explanation: e.description
|
|
2215
|
+
}))
|
|
2216
|
+
}
|
|
2217
|
+
];
|
|
2218
|
+
}
|
|
2219
|
+
function Un(e, t = {}) {
|
|
2220
|
+
let n = [];
|
|
2221
|
+
return X().forEach((r, i) => {
|
|
2222
|
+
if (i > 0) {
|
|
2223
|
+
let t = document.createElement("div");
|
|
2224
|
+
t.className = "cd-shell-legend-separator", t.setAttribute("role", "separator"), e.append(t);
|
|
2225
|
+
}
|
|
2226
|
+
let a = document.createElement("div");
|
|
2227
|
+
a.className = "cm-legend-group", a.setAttribute("role", "group"), a.setAttribute("aria-label", r.label);
|
|
2228
|
+
for (let e of r.rows) {
|
|
2229
|
+
let r = document.createElement("div");
|
|
2230
|
+
r.className = "cd-shell-legend-row cm-legend-row";
|
|
2231
|
+
let i = document.createElement("span");
|
|
2232
|
+
i.className = "cd-shell-legend-preview", i.innerHTML = e.preview;
|
|
2233
|
+
let o = document.createElement("span");
|
|
2234
|
+
if (o.textContent = e.label, r.append(i, o), t.tooltip) n.push(t.tooltip.attach(r, { label: e.explanation }));
|
|
2235
|
+
else {
|
|
2236
|
+
let t = document.createElement("span");
|
|
2237
|
+
t.className = "cm-visually-hidden", t.textContent = `: ${e.explanation}`, r.append(t);
|
|
2238
|
+
}
|
|
2239
|
+
a.append(r);
|
|
2240
|
+
}
|
|
2241
|
+
e.append(a);
|
|
2242
|
+
}), () => {
|
|
2243
|
+
for (let e of n.splice(0)) e();
|
|
2244
|
+
};
|
|
2245
|
+
}
|
|
2246
|
+
//#endregion
|
|
2247
|
+
//#region src/legend/CmLegend.ts
|
|
2248
|
+
function Wn(e) {
|
|
2249
|
+
let t = document.createElement("div");
|
|
2250
|
+
t.className = "cm-legend__row cm-legend-item";
|
|
2251
|
+
let n = document.createElement("span");
|
|
2252
|
+
n.className = "cm-legend__icon", n.innerHTML = e.preview;
|
|
2253
|
+
let r = document.createElement("span");
|
|
2254
|
+
r.textContent = e.label;
|
|
2255
|
+
let i = document.createElement("span");
|
|
2256
|
+
return i.className = "cm-legend-tip", i.textContent = e.explanation, t.addEventListener("mouseenter", () => {
|
|
2257
|
+
let e = t.getBoundingClientRect();
|
|
2258
|
+
i.style.left = `${e.right + 10}px`, i.style.top = `${e.top + e.height / 2}px`;
|
|
2259
|
+
}), t.append(n, r, i), t;
|
|
2260
|
+
}
|
|
2261
|
+
function Gn(e, t) {
|
|
2262
|
+
let n = document.createElement("div");
|
|
2263
|
+
return n.className = "cm-legend__group", n.setAttribute("role", "group"), n.setAttribute("aria-label", e), n.append(...t), n;
|
|
2264
|
+
}
|
|
2265
|
+
function Kn() {
|
|
2266
|
+
let e = document.createElement("div");
|
|
2267
|
+
return e.className = "cm-legend__divider", e;
|
|
2268
|
+
}
|
|
2269
|
+
var qn = class {
|
|
2270
|
+
static $inject = ["canvas", "eventBus"];
|
|
2271
|
+
openState = !0;
|
|
2272
|
+
host;
|
|
2273
|
+
constructor(e, t) {
|
|
2274
|
+
this.host = document.createElement("div"), e.getContainer().appendChild(this.host), this.render(), t.on("diagram.destroy", () => this.host.remove());
|
|
2275
|
+
}
|
|
2276
|
+
isOpen() {
|
|
2277
|
+
return this.openState;
|
|
2278
|
+
}
|
|
2279
|
+
setOpen(e) {
|
|
2280
|
+
this.openState !== e && (this.openState = e, this.render());
|
|
2281
|
+
}
|
|
2282
|
+
toggle() {
|
|
2283
|
+
this.setOpen(!this.openState);
|
|
2284
|
+
}
|
|
2285
|
+
render() {
|
|
2286
|
+
let e = this.host.contains(this.host.ownerDocument.activeElement);
|
|
2287
|
+
this.host.replaceChildren(this.openState ? this.panel() : this.collapsedButton()), e && this.host.querySelector(".cm-legend__close, .cm-legend-toggle")?.focus();
|
|
2288
|
+
}
|
|
2289
|
+
panel() {
|
|
2290
|
+
let e = document.createElement("div");
|
|
2291
|
+
e.className = "cm-legend", e.setAttribute("aria-label", "Legend");
|
|
2292
|
+
let t = document.createElement("div");
|
|
2293
|
+
t.className = "cm-legend__head";
|
|
2294
|
+
let n = document.createElement("strong");
|
|
2295
|
+
n.textContent = "Legend";
|
|
2296
|
+
let r = document.createElement("button");
|
|
2297
|
+
r.type = "button", r.className = "cm-legend__close", r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-label", "Close legend"), r.innerHTML = U("x"), r.addEventListener("click", () => this.toggle()), t.append(n, r);
|
|
2298
|
+
let i = X().map((e) => Gn(e.label, e.rows.map(Wn))), a = document.createElement("div");
|
|
2299
|
+
return a.className = "cm-legend__body", i.forEach((e, t) => a.append(...t > 0 ? [Kn()] : [], e)), e.append(t, a), e;
|
|
2300
|
+
}
|
|
2301
|
+
collapsedButton() {
|
|
2302
|
+
let e = document.createElement("button");
|
|
2303
|
+
return e.type = "button", e.className = "cm-legend-toggle", e.setAttribute("aria-expanded", "false"), e.setAttribute("aria-label", "Show legend"), e.textContent = "Legend", e.addEventListener("click", () => this.toggle()), e;
|
|
2304
|
+
}
|
|
2305
|
+
}, Jn = {
|
|
2306
|
+
__init__: ["cmLegend"],
|
|
2307
|
+
cmLegend: ["type", qn]
|
|
2308
|
+
}, Yn = "Export as JSON";
|
|
2309
|
+
function Z(e, t, n, r) {
|
|
2310
|
+
return {
|
|
2311
|
+
kind: "action",
|
|
2312
|
+
id: e,
|
|
2313
|
+
label: t,
|
|
2314
|
+
...r ? { icon: r } : {},
|
|
2315
|
+
...n.shortcut ? { shortcut: n.shortcut } : {},
|
|
2316
|
+
onSelect: () => n.onSelect()
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
function Xn(e) {
|
|
2320
|
+
let { editTitle: t } = e;
|
|
2321
|
+
return {
|
|
2322
|
+
model: t ? [{
|
|
2323
|
+
kind: "dialog",
|
|
2324
|
+
id: "map-title",
|
|
2325
|
+
label: "Map title…",
|
|
2326
|
+
onSelect: () => t()
|
|
2327
|
+
}] : [],
|
|
2328
|
+
export: [
|
|
2329
|
+
Z("export-png", "Export as PNG", e.exports.png, "file-image"),
|
|
2330
|
+
Z("export-svg", "Export as SVG", e.exports.svg, "file-code-corner"),
|
|
2331
|
+
Z("export-json", Yn, e.exports.json),
|
|
2332
|
+
Z("export-cml", "Export as CML", e.exports.cml)
|
|
2333
|
+
],
|
|
2334
|
+
help: [{
|
|
2335
|
+
kind: "dialog",
|
|
2336
|
+
id: "keyboard-shortcuts",
|
|
2337
|
+
label: "Keyboard shortcuts…",
|
|
2338
|
+
icon: "keyboard",
|
|
2339
|
+
onSelect: () => e.showKeyboardShortcuts()
|
|
2340
|
+
}]
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
//#endregion
|
|
2344
|
+
//#region src/chrome/shortcuts.ts
|
|
2345
|
+
function Zn(e, t, n) {
|
|
2346
|
+
return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
|
|
2347
|
+
}
|
|
2348
|
+
function Qn(e) {
|
|
2349
|
+
try {
|
|
2350
|
+
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
2351
|
+
} catch {
|
|
2352
|
+
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
function $n(e, t) {
|
|
2356
|
+
if (e === "mac") return {
|
|
2357
|
+
zoomIn: "⌘+",
|
|
2358
|
+
zoomOut: "⌘−",
|
|
2359
|
+
zoomToActual: "⌘0",
|
|
2360
|
+
fit: "⇧1"
|
|
2361
|
+
};
|
|
2362
|
+
let { ctrl: n, shift: r, plus: i, minus: a } = t;
|
|
2363
|
+
return {
|
|
2364
|
+
zoomIn: `${n}+${i}`,
|
|
2365
|
+
zoomOut: `${n}+${a}`,
|
|
2366
|
+
zoomToActual: `${n}+0`,
|
|
2367
|
+
fit: `${r}+1`
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
function er(e, t) {
|
|
2371
|
+
if (e === "mac") return {
|
|
2372
|
+
undo: ["⌘Z"],
|
|
2373
|
+
redo: ["⌘⇧Z"],
|
|
2374
|
+
selectAll: ["⌘A"],
|
|
2375
|
+
remove: ["⌫"],
|
|
2376
|
+
lineBreak: ["⇧Enter"],
|
|
2377
|
+
lassoDrag: ["⇧ Drag"]
|
|
2378
|
+
};
|
|
2379
|
+
let { ctrl: n, shift: r } = t;
|
|
2380
|
+
return {
|
|
2381
|
+
undo: [`${n}+Z`],
|
|
2382
|
+
redo: [`${n}+${r}+Z`, `${n}+Y`],
|
|
2383
|
+
selectAll: [`${n}+A`],
|
|
2384
|
+
remove: ["Del", "Backspace"],
|
|
2385
|
+
lineBreak: [`${r}+Enter`],
|
|
2386
|
+
lassoDrag: [`${r}+Drag`]
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
function tr(e) {
|
|
2390
|
+
let { platform: t, messages: n } = e;
|
|
2391
|
+
return {
|
|
2392
|
+
title: "File",
|
|
2393
|
+
rows: [{
|
|
2394
|
+
action: n.openFile ?? "Open…",
|
|
2395
|
+
keys: [Zn("O", t, n.keyNames)]
|
|
2396
|
+
}, {
|
|
2397
|
+
action: Yn,
|
|
2398
|
+
keys: [Zn("S", t, n.keyNames)]
|
|
2399
|
+
}]
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2402
|
+
function nr(e, t = {}) {
|
|
2403
|
+
let { platform: n, messages: r } = e, i = $n(n, r.keyNames), a = er(n, r.keyNames);
|
|
2404
|
+
return [
|
|
2405
|
+
...t.fileKeys ? [tr(e)] : [],
|
|
2406
|
+
{
|
|
2407
|
+
title: "View",
|
|
2408
|
+
rows: [
|
|
2409
|
+
{
|
|
2410
|
+
action: r.zoomIn,
|
|
2411
|
+
keys: [i.zoomIn]
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
action: r.zoomOut,
|
|
2415
|
+
keys: [i.zoomOut]
|
|
2416
|
+
},
|
|
2417
|
+
{
|
|
2418
|
+
action: r.zoomToActual(Qn(e.lang)),
|
|
2419
|
+
keys: [i.zoomToActual]
|
|
2420
|
+
},
|
|
2421
|
+
{
|
|
2422
|
+
action: r.fit,
|
|
2423
|
+
keys: [i.fit]
|
|
2424
|
+
}
|
|
2425
|
+
]
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
title: "Edit",
|
|
2429
|
+
rows: [
|
|
2430
|
+
{
|
|
2431
|
+
action: "Undo",
|
|
2432
|
+
keys: a.undo
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
action: "Redo",
|
|
2436
|
+
keys: a.redo
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
action: "Select all",
|
|
2440
|
+
keys: a.selectAll
|
|
2441
|
+
},
|
|
2442
|
+
{
|
|
2443
|
+
action: "Delete",
|
|
2444
|
+
keys: a.remove
|
|
2445
|
+
},
|
|
2446
|
+
{
|
|
2447
|
+
action: "Rename",
|
|
2448
|
+
keys: ["Double-click"]
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
action: "Save a name",
|
|
2452
|
+
keys: ["Enter"]
|
|
2453
|
+
},
|
|
2454
|
+
{
|
|
2455
|
+
action: "Line break in a name",
|
|
2456
|
+
keys: a.lineBreak
|
|
2457
|
+
},
|
|
2458
|
+
{
|
|
2459
|
+
action: "Discard a name",
|
|
2460
|
+
keys: ["Esc"]
|
|
2461
|
+
}
|
|
2462
|
+
]
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
title: "Tools",
|
|
2466
|
+
rows: [{
|
|
2467
|
+
action: "Create a context from the palette",
|
|
2468
|
+
keys: ["Enter", "Space"]
|
|
2469
|
+
}, {
|
|
2470
|
+
action: "Lasso by dragging",
|
|
2471
|
+
keys: a.lassoDrag
|
|
2472
|
+
}]
|
|
2473
|
+
}
|
|
2474
|
+
];
|
|
2475
|
+
}
|
|
2476
|
+
//#endregion
|
|
2477
|
+
//#region src/chrome/dialog.ts
|
|
2478
|
+
function Q(e, t, n) {
|
|
2479
|
+
let r = document.createElement(e);
|
|
2480
|
+
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
2481
|
+
}
|
|
2482
|
+
function rr(e, t, n) {
|
|
2483
|
+
let r = Q("header", "cm-dialog-header"), i = Q("h3", "cm-dialog-title", t.title);
|
|
2484
|
+
i.id = t.titleId;
|
|
2485
|
+
let a = Q("button", "cm-dialog-close");
|
|
2486
|
+
return a.type = "button", a.setAttribute("aria-label", e.messages.close), a.innerHTML = U("x"), a.addEventListener("click", n), r.append(i, a), r;
|
|
2487
|
+
}
|
|
2488
|
+
function ir(e, t) {
|
|
2489
|
+
let n;
|
|
2490
|
+
function r() {
|
|
2491
|
+
let n = Q("dialog", `cm-dialog ${t.className}`);
|
|
2492
|
+
n.setAttribute("aria-labelledby", t.titleId);
|
|
2493
|
+
let r = () => n.close(), i = Q("div", "cm-dialog-panel");
|
|
2494
|
+
return i.append(rr(e, t, r), ...t.content(r)), n.append(i), n.addEventListener("click", (e) => {
|
|
2495
|
+
e.target === n && n.close();
|
|
2496
|
+
}), n.addEventListener("close", () => {
|
|
2497
|
+
e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
|
|
2498
|
+
}), e.root.append(n), n;
|
|
2499
|
+
}
|
|
2500
|
+
return {
|
|
2501
|
+
open() {
|
|
2502
|
+
n ??= r(), !n.open && (t.beforeOpen?.(), n.showModal(), t.afterOpen?.());
|
|
2503
|
+
},
|
|
2504
|
+
close() {
|
|
2505
|
+
n?.close();
|
|
2506
|
+
},
|
|
2507
|
+
isOpen: () => n?.open === !0,
|
|
2508
|
+
destroy() {
|
|
2509
|
+
n?.remove(), n = void 0;
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
//#endregion
|
|
2514
|
+
//#region src/chrome/ShortcutsDialog.ts
|
|
2515
|
+
var $ = "cm-shortcuts", ar = "cm-shortcuts-title";
|
|
2516
|
+
function or(e, t) {
|
|
2517
|
+
let n = Q("section", `${$}-group`), r = `${ar}-group-${t}`, i = Q("h4", `${$}-group-title`, e.title);
|
|
2518
|
+
i.id = r;
|
|
2519
|
+
let a = Q("table", `${$}-table`);
|
|
2520
|
+
a.setAttribute("aria-labelledby", r);
|
|
2521
|
+
let o = a.createTBody();
|
|
2522
|
+
for (let t of e.rows) {
|
|
2523
|
+
let e = o.insertRow(), n = Q("th", `${$}-action`, t.action);
|
|
2524
|
+
n.scope = "row";
|
|
2525
|
+
let r = Q("td", `${$}-keys`);
|
|
2526
|
+
for (let e of t.keys) r.append(Q("kbd", `${$}-key`, e));
|
|
2527
|
+
e.append(n, r);
|
|
2528
|
+
}
|
|
2529
|
+
return n.append(i, a), n;
|
|
2530
|
+
}
|
|
2531
|
+
function sr(e, t = {}) {
|
|
2532
|
+
return ir(e, {
|
|
2533
|
+
className: $,
|
|
2534
|
+
titleId: ar,
|
|
2535
|
+
title: "Keyboard shortcuts",
|
|
2536
|
+
content() {
|
|
2537
|
+
let n = Q("div", "cm-dialog-body cm-shortcuts-body");
|
|
2538
|
+
return n.append(...nr(e, t).map(or)), [n];
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region src/chrome/TitleDialog.ts
|
|
2544
|
+
var cr = "cm-title-dialog", lr = "cm-title-dialog-title", ur = "cm-title-dialog-field";
|
|
2545
|
+
function dr(e, t) {
|
|
2546
|
+
let n = Q("button", "cm-dialog-button", e);
|
|
2547
|
+
return n.type = t === "primary" ? "submit" : "button", n.dataset.variant = t, n;
|
|
2548
|
+
}
|
|
2549
|
+
function fr(e, t) {
|
|
2550
|
+
let n = Q("input", "cm-dialog-input");
|
|
2551
|
+
return n.id = ur, n.type = "text", n.autocomplete = "off", n.spellcheck = !1, n.autofocus = !0, ir(e, {
|
|
2552
|
+
className: cr,
|
|
2553
|
+
titleId: lr,
|
|
2554
|
+
title: "Map title",
|
|
2555
|
+
beforeOpen() {
|
|
2556
|
+
n.value = t.title();
|
|
2557
|
+
},
|
|
2558
|
+
afterOpen() {
|
|
2559
|
+
n.select();
|
|
2560
|
+
},
|
|
2561
|
+
content(e) {
|
|
2562
|
+
let r = Q("form", "cm-dialog-form");
|
|
2563
|
+
r.noValidate = !0;
|
|
2564
|
+
let i = Q("div", "cm-dialog-body"), a = Q("label", "cm-dialog-label", "Title");
|
|
2565
|
+
a.htmlFor = ur, i.append(a, n);
|
|
2566
|
+
let o = Q("div", "cm-dialog-footer"), s = dr("Cancel", "secondary");
|
|
2567
|
+
return s.addEventListener("click", e), o.append(s, dr("Apply", "primary")), r.append(i, o), r.addEventListener("submit", (r) => {
|
|
2568
|
+
r.preventDefault();
|
|
2569
|
+
let i = n.value.trim();
|
|
2570
|
+
e(), i !== t.title() && t.setTitle(i);
|
|
2571
|
+
}), [r];
|
|
2572
|
+
}
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
1846
2575
|
//#endregion
|
|
1847
|
-
export {
|
|
2576
|
+
export { Ge as CD_TOKENS, Dn as CONTEXT_MAPS_NOTATION, ze as CmBaseViewer, Bn as CmConnectHandles, dn as CmContextPadProvider, Ve as CmElementFactory, dt as CmExporter, jt as CmFlatModelBehavior, _t as CmHoverTooltip, ut as CmImporter, hn as CmKeyboard, Ht as CmLabelEditing, qn as CmLegend, Dt as CmModeling, an as CmPaletteProvider, Rt as CmReadOnly, Ot as CmRules, wn as CmZOrder, Xe as ContextMapsRenderer, Yn as JSON_EXPORT_LABEL, O as MIRAGON, En as Modeler, P as NavigatedViewer, L as READ_ONLY_CHANGED_EVENT, D as ROOT_ID, pt as Viewer, Ft as cmBehaviorsModule, Vn as cmConnectHandlesModule, fn as cmContextPadModule, st as cmDrawModule, vt as cmHoverTooltipModule, gn as cmKeyboardModule, z as cmLabelEditingModule, Jn as cmLegendModule, We as cmModelModule, F as cmModelingModule, on as cmPaletteModule, R as cmReadOnlyModule, I as cmRulesModule, Tn as cmZOrderModule, B as contextIconSvg, Xn as contextMapMenu, nr as contextMapShortcuts, On as createCollaborativeModeler, kn as createCollaborativeViewer, sr as createShortcutsDialog, fr as createTitleDialog, gt as hoverTipFor, ft as ioModule, T as isCmContext, w as isCmElement, E as isCmRelationship, X as legendGroups, H as relationshipIconSvg, Un as renderLegend, V as roleChipSvg, Fe as saveSVG, Jt as subdomainIconSvg };
|
|
1848
2577
|
|
|
1849
2578
|
//# sourceMappingURL=index.js.map
|