@miragon/context-maps-renderer 0.1.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 +97 -25
- package/dist/CmBaseViewer.d.ts +55 -8
- package/dist/CmBaseViewer.d.ts.map +1 -1
- package/dist/Modeler.d.ts +4 -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/behaviors/CmFlatModelBehavior.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 +100 -0
- package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -0
- package/dist/context-pad/index.d.ts +4 -0
- package/dist/context-pad/index.d.ts.map +1 -0
- package/dist/draw/ContextMapsRenderer.d.ts +4 -0
- package/dist/draw/ContextMapsRenderer.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +29 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/draw/palette-icons.d.ts +8 -3
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +11 -0
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/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 +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1852 -553
- 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 +66 -3
- package/dist/label-editing/CmLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/index.d.ts +1 -1
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/legend/CmLegend.d.ts +15 -0
- package/dist/legend/CmLegend.d.ts.map +1 -0
- package/dist/legend/index.d.ts +10 -0
- package/dist/legend/index.d.ts.map +1 -0
- package/dist/legend/legendContent.d.ts +38 -0
- package/dist/legend/legendContent.d.ts.map +1 -0
- package/dist/model/CmElementFactory.d.ts +2 -1
- 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 +29 -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/rules/CmRules.d.ts.map +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/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 -6
- package/dist/draw/icons.d.ts +0 -10
- package/dist/draw/icons.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,66 +1,80 @@
|
|
|
1
1
|
import e from "diagram-js/lib/Diagram";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getMid as
|
|
6
|
-
import
|
|
7
|
-
import { append as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
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
12
|
import S from "diagram-js/lib/features/modeling";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
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";
|
|
24
30
|
//#region src/model/di-types.ts
|
|
25
|
-
function
|
|
31
|
+
function Me(e) {
|
|
26
32
|
return typeof e == "object" && e ? e.cmKind : void 0;
|
|
27
33
|
}
|
|
28
|
-
function
|
|
29
|
-
return typeof
|
|
34
|
+
function w(e) {
|
|
35
|
+
return typeof Me(e) == "string";
|
|
30
36
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
37
|
+
function T(e) {
|
|
38
|
+
return Me(e) === "context";
|
|
33
39
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
40
|
+
function E(e) {
|
|
41
|
+
return Me(e) === "relationship";
|
|
36
42
|
}
|
|
37
43
|
//#endregion
|
|
38
44
|
//#region src/io/saveSvg.ts
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
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");
|
|
42
52
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
43
53
|
let r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
44
54
|
for (let e of t.getAll()) {
|
|
45
|
-
if (!
|
|
55
|
+
if (!T(e)) continue;
|
|
46
56
|
let t = e;
|
|
47
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);
|
|
48
58
|
}
|
|
49
59
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
50
|
-
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);
|
|
51
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)));
|
|
52
63
|
let f = d.querySelector(".viewport");
|
|
53
64
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
54
65
|
}
|
|
55
66
|
//#endregion
|
|
56
67
|
//#region src/io/types.ts
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
var D = i, Ie = {
|
|
69
|
+
top: 84,
|
|
70
|
+
right: 56,
|
|
71
|
+
bottom: 56,
|
|
72
|
+
left: 56
|
|
73
|
+
}, Le = .001;
|
|
74
|
+
function Re(e) {
|
|
61
75
|
return typeof e == "number" ? `${e}px` : e;
|
|
62
76
|
}
|
|
63
|
-
var
|
|
77
|
+
var ze = class {
|
|
64
78
|
_diagram;
|
|
65
79
|
_container;
|
|
66
80
|
_options;
|
|
@@ -69,14 +83,16 @@ var N = class {
|
|
|
69
83
|
}
|
|
70
84
|
_createContainer(e) {
|
|
71
85
|
let t = e.container ?? document.createElement("div");
|
|
72
|
-
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;
|
|
73
87
|
}
|
|
74
88
|
_ensureDiagram() {
|
|
75
89
|
if (!this._diagram) {
|
|
76
90
|
let t = [...this._getModules(), ...this._options.additionalModules ?? []];
|
|
77
91
|
this._diagram = new e({
|
|
78
92
|
canvas: { container: this._container },
|
|
79
|
-
modules: t
|
|
93
|
+
modules: t,
|
|
94
|
+
cmKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
|
|
95
|
+
cmPalette: { freeRectInsets: this.freeRectInsets }
|
|
80
96
|
});
|
|
81
97
|
}
|
|
82
98
|
return this._diagram;
|
|
@@ -84,6 +100,10 @@ var N = class {
|
|
|
84
100
|
get(e) {
|
|
85
101
|
return this._ensureDiagram().get(e);
|
|
86
102
|
}
|
|
103
|
+
freeRectInsets = () => this._options.freeRectInsets?.() ?? Ie;
|
|
104
|
+
_optional(e) {
|
|
105
|
+
return this._ensureDiagram().get(e, !1);
|
|
106
|
+
}
|
|
87
107
|
on(e, t, n = 1e3) {
|
|
88
108
|
this.get("eventBus").on(e, n, t);
|
|
89
109
|
}
|
|
@@ -92,55 +112,65 @@ var N = class {
|
|
|
92
112
|
}
|
|
93
113
|
importDocument(e) {
|
|
94
114
|
let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("cmImporter");
|
|
95
|
-
r.
|
|
96
|
-
let i =
|
|
97
|
-
|
|
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);
|
|
98
125
|
}
|
|
99
126
|
exportDocument() {
|
|
100
127
|
return this.get("cmExporter").export();
|
|
101
128
|
}
|
|
129
|
+
exportText() {
|
|
130
|
+
return ie(this.exportDocument());
|
|
131
|
+
}
|
|
102
132
|
setMeta(e) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
let r = n.businessObject ?? { title: "Untitled context map" };
|
|
111
|
-
n.businessObject = {
|
|
112
|
-
...r,
|
|
113
|
-
...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
|
|
114
140
|
};
|
|
115
141
|
}
|
|
116
142
|
getMeta() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
143
|
+
return this._documentRoot()?.businessObject;
|
|
144
|
+
}
|
|
145
|
+
_documentRoot() {
|
|
146
|
+
return this.get("elementRegistry").get(D);
|
|
122
147
|
}
|
|
123
148
|
saveSVG() {
|
|
124
|
-
return
|
|
149
|
+
return Fe(this.get("canvas"), this.get("elementRegistry"));
|
|
125
150
|
}
|
|
126
|
-
_fit(
|
|
127
|
-
let
|
|
128
|
-
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()) {
|
|
129
154
|
let t = e;
|
|
130
|
-
typeof t.x
|
|
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));
|
|
131
156
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!
|
|
135
|
-
|
|
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
|
+
});
|
|
136
166
|
return;
|
|
137
167
|
}
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
x:
|
|
141
|
-
y:
|
|
142
|
-
width:
|
|
143
|
-
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
|
|
144
174
|
});
|
|
145
175
|
}
|
|
146
176
|
attachTo(e) {
|
|
@@ -158,26 +188,38 @@ var N = class {
|
|
|
158
188
|
get container() {
|
|
159
189
|
return this._container;
|
|
160
190
|
}
|
|
161
|
-
}
|
|
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 {
|
|
162
199
|
elementFactory;
|
|
163
200
|
static $inject = ["elementFactory"];
|
|
164
201
|
constructor(e) {
|
|
165
202
|
this.elementFactory = e;
|
|
166
203
|
}
|
|
167
204
|
createContext(e) {
|
|
205
|
+
let t = (e.subdomainType ? p[e.subdomainType] : void 0)?.minSize ?? {
|
|
206
|
+
width: 120,
|
|
207
|
+
height: 72
|
|
208
|
+
};
|
|
168
209
|
return this.elementFactory.createShape({
|
|
169
210
|
id: e.id,
|
|
170
211
|
x: e.position.x,
|
|
171
212
|
y: e.position.y,
|
|
172
|
-
width: e.size.width,
|
|
173
|
-
height: e.size.height,
|
|
213
|
+
width: Math.max(e.size.width, t.width),
|
|
214
|
+
height: Math.max(e.size.height, t.height),
|
|
174
215
|
cmKind: "context",
|
|
175
216
|
cmLabel: e.label,
|
|
176
217
|
...e.subdomainType ? { subdomainType: e.subdomainType } : {},
|
|
177
218
|
...e.team ? { team: e.team } : {},
|
|
178
219
|
...e.description ? { description: e.description } : {},
|
|
179
220
|
...e.fill ? { fill: e.fill } : {},
|
|
180
|
-
...e.stroke ? { stroke: e.stroke } : {}
|
|
221
|
+
...e.stroke ? { stroke: e.stroke } : {},
|
|
222
|
+
...Be(e, r)
|
|
181
223
|
});
|
|
182
224
|
}
|
|
183
225
|
createRelationship(e, t, n, r) {
|
|
@@ -192,41 +234,42 @@ var N = class {
|
|
|
192
234
|
...e.downstreamRoles?.length ? { downstreamRoles: [...e.downstreamRoles] } : {},
|
|
193
235
|
...e.label ? { cmLabel: e.label } : {},
|
|
194
236
|
...e.description ? { description: e.description } : {},
|
|
195
|
-
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {}
|
|
237
|
+
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
238
|
+
...Be(e, d)
|
|
196
239
|
});
|
|
197
240
|
}
|
|
198
241
|
createNewContext(e, t) {
|
|
199
|
-
let n =
|
|
242
|
+
let n = (e ? p[e] : void 0)?.defaultSize ?? p.generic.defaultSize;
|
|
200
243
|
return this.elementFactory.createShape({
|
|
201
|
-
width: n.
|
|
202
|
-
height: n.
|
|
244
|
+
width: n.width,
|
|
245
|
+
height: n.height,
|
|
203
246
|
cmKind: "context",
|
|
204
|
-
subdomainType: e,
|
|
247
|
+
...e ? { subdomainType: e } : {},
|
|
205
248
|
cmLabel: t ?? "New Context"
|
|
206
249
|
});
|
|
207
250
|
}
|
|
208
|
-
},
|
|
251
|
+
}, He = class extends se {
|
|
209
252
|
create(e, t) {
|
|
210
253
|
return !t?.id && (e === "shape" || e === "connection") && (t = {
|
|
211
254
|
...t,
|
|
212
|
-
id:
|
|
255
|
+
id: ne(e === "shape" ? "ctx" : "rel")
|
|
213
256
|
}), super.create(e, t);
|
|
214
257
|
}
|
|
215
|
-
},
|
|
258
|
+
}, Ue = class {
|
|
216
259
|
docking;
|
|
217
260
|
static $inject = ["connectionDocking"];
|
|
218
261
|
constructor(e) {
|
|
219
262
|
this.docking = e;
|
|
220
263
|
}
|
|
221
264
|
layoutConnection(e, t = {}) {
|
|
222
|
-
let n = t.source ?? e.source, r = t.target ?? e.target, i = [n ?
|
|
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);
|
|
223
266
|
return e.waypoints = i, n && r && i.length === 2 ? this.docking.getCroppedWaypoints(e, n, r) : i;
|
|
224
267
|
}
|
|
225
|
-
},
|
|
226
|
-
elementFactory: ["type",
|
|
227
|
-
cmElementFactory: ["type",
|
|
228
|
-
connectionDocking: ["type",
|
|
229
|
-
},
|
|
268
|
+
}, We = {
|
|
269
|
+
elementFactory: ["type", He],
|
|
270
|
+
cmElementFactory: ["type", Ve],
|
|
271
|
+
connectionDocking: ["type", oe]
|
|
272
|
+
}, O = {
|
|
230
273
|
blau: "#335DE5",
|
|
231
274
|
blauLink: "#2B50D4",
|
|
232
275
|
blauHell: "#6B8AFF",
|
|
@@ -234,40 +277,38 @@ var N = class {
|
|
|
234
277
|
grau: "#F9F7F7",
|
|
235
278
|
schwarz: "#1D1D1D",
|
|
236
279
|
weiss: "#FFFFFF",
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
280
|
+
linie: "#E6E2E2",
|
|
281
|
+
success: "#00E676",
|
|
282
|
+
warning: "#FFB000",
|
|
283
|
+
danger: "#CD1839",
|
|
284
|
+
info: "#335DE5",
|
|
241
285
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
242
|
-
},
|
|
243
|
-
"--cd-blau":
|
|
244
|
-
"--cd-gruen":
|
|
245
|
-
"--cd-grau":
|
|
246
|
-
"--cd-schwarz":
|
|
247
|
-
"--cd-weiss":
|
|
248
|
-
"--cd-blau-link":
|
|
249
|
-
"--cd-blau-hell":
|
|
250
|
-
"--cd-
|
|
251
|
-
"--cd-success
|
|
252
|
-
"--cd-warning":
|
|
253
|
-
"--cd-
|
|
254
|
-
"--cd-
|
|
255
|
-
"--cd-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}, fe = 1500;
|
|
260
|
-
I.blau;
|
|
261
|
-
var L = I.schwarz, R = "#5B5B5B", z = {
|
|
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 = {
|
|
262
303
|
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
263
304
|
label: 13.5,
|
|
264
305
|
small: 11
|
|
265
|
-
},
|
|
306
|
+
}, j = O.weiss, Je = "#F1F1EE", Ye = "#8A8577";
|
|
266
307
|
//#endregion
|
|
267
308
|
//#region src/draw/endRoleChips.ts
|
|
268
|
-
function
|
|
309
|
+
function M(e, t, n, r) {
|
|
269
310
|
if (r.length === 0) return null;
|
|
270
|
-
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l =
|
|
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 = {
|
|
271
312
|
x: e.x + s * h,
|
|
272
313
|
y: e.y + c * h
|
|
273
314
|
};
|
|
@@ -287,31 +328,31 @@ function V(e, t, n, r) {
|
|
|
287
328
|
}
|
|
288
329
|
//#endregion
|
|
289
330
|
//#region src/draw/ContextMapsRenderer.ts
|
|
290
|
-
var
|
|
331
|
+
var Xe = class extends le {
|
|
291
332
|
static $inject = ["eventBus"];
|
|
292
333
|
constructor(e) {
|
|
293
|
-
super(e,
|
|
334
|
+
super(e, Ke);
|
|
294
335
|
}
|
|
295
336
|
canRender(e) {
|
|
296
|
-
return
|
|
337
|
+
return w(e);
|
|
297
338
|
}
|
|
298
339
|
drawShape(e, t) {
|
|
299
|
-
if (
|
|
300
|
-
let n =
|
|
340
|
+
if (ue(e), T(t)) return this.drawContext(e, t);
|
|
341
|
+
let n = y(b("rect"), {
|
|
301
342
|
width: t.width,
|
|
302
343
|
height: t.height,
|
|
303
344
|
fill: "#eee"
|
|
304
345
|
});
|
|
305
|
-
return
|
|
346
|
+
return v(e, n), n;
|
|
306
347
|
}
|
|
307
348
|
drawConnection(e, t) {
|
|
308
|
-
if (
|
|
309
|
-
let n =
|
|
349
|
+
if (ue(e), E(t)) return this.drawRelationship(e, t);
|
|
350
|
+
let n = y(b("polyline"), {
|
|
310
351
|
points: (t.waypoints ?? []).map((e) => `${e.x},${e.y}`).join(" "),
|
|
311
352
|
fill: "none",
|
|
312
|
-
stroke:
|
|
353
|
+
stroke: k
|
|
313
354
|
});
|
|
314
|
-
return
|
|
355
|
+
return v(e, n), n;
|
|
315
356
|
}
|
|
316
357
|
getShapePath(e) {
|
|
317
358
|
let { x: t, y: n, width: r, height: i } = e;
|
|
@@ -322,53 +363,52 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
322
363
|
return t.length === 0 ? "" : t.map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join("");
|
|
323
364
|
}
|
|
324
365
|
drawContext(e, t) {
|
|
325
|
-
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"), {
|
|
326
367
|
x: 1,
|
|
327
368
|
y: 1,
|
|
328
369
|
width: r - 2,
|
|
329
370
|
height: i - 2,
|
|
330
371
|
rx: 8,
|
|
331
372
|
ry: 8,
|
|
332
|
-
fill: t.fill ?? n?.fill ??
|
|
333
|
-
stroke: t.stroke ?? n?.stroke ??
|
|
373
|
+
fill: t.fill ?? n?.fill ?? "#F1F1EE",
|
|
374
|
+
stroke: t.stroke ?? n?.stroke ?? "#8A8577",
|
|
334
375
|
"stroke-width": 2,
|
|
335
376
|
"stroke-linejoin": "round"
|
|
336
377
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
m(e, _e(t.subdomainType, 15, 15, 18, n.stroke));
|
|
341
|
-
let r = h(_("text"), {
|
|
378
|
+
if (v(e, a), this.appendLabel(e, t.cmLabel ?? "", r, i, !!t.team, { "font-weight": "650" }), t.subdomainType && n) {
|
|
379
|
+
v(e, et(t.subdomainType, 15, 15, 18, n.stroke));
|
|
380
|
+
let r = y(b("text"), {
|
|
342
381
|
x: 28,
|
|
343
382
|
y: 15,
|
|
344
|
-
"font-family":
|
|
345
|
-
"font-size":
|
|
383
|
+
"font-family": A.family,
|
|
384
|
+
"font-size": A.small,
|
|
346
385
|
"font-weight": "700",
|
|
347
386
|
fill: n.stroke,
|
|
348
387
|
"text-anchor": "start",
|
|
349
388
|
"dominant-baseline": "central",
|
|
350
389
|
"letter-spacing": "0.03em"
|
|
351
390
|
});
|
|
352
|
-
r.textContent = n.label,
|
|
391
|
+
r.textContent = n.label, v(e, r);
|
|
353
392
|
}
|
|
354
393
|
if (t.team) {
|
|
355
|
-
let n = 19 + t.team.length *
|
|
356
|
-
|
|
357
|
-
let
|
|
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);
|
|
395
|
+
y(s, { class: "cm-team" }), v(e, s);
|
|
396
|
+
let c = y(b("text"), {
|
|
397
|
+
class: "cm-team",
|
|
358
398
|
x: a + 14 + 5,
|
|
359
399
|
y: o,
|
|
360
|
-
"font-family":
|
|
361
|
-
"font-size":
|
|
362
|
-
fill:
|
|
400
|
+
"font-family": A.family,
|
|
401
|
+
"font-size": A.small,
|
|
402
|
+
fill: qe,
|
|
363
403
|
"text-anchor": "start",
|
|
364
404
|
"dominant-baseline": "central"
|
|
365
405
|
});
|
|
366
|
-
|
|
406
|
+
c.textContent = t.team, v(e, c);
|
|
367
407
|
}
|
|
368
408
|
return a;
|
|
369
409
|
}
|
|
370
410
|
drawRelationship(e, t) {
|
|
371
|
-
let n =
|
|
411
|
+
let n = f[t.pattern] ?? f["upstream-downstream"], r = t.waypoints ?? [], i = n.dash, a = y(b("polyline"), {
|
|
372
412
|
points: r.map((e) => `${e.x},${e.y}`).join(" "),
|
|
373
413
|
fill: "none",
|
|
374
414
|
stroke: n.stroke,
|
|
@@ -377,11 +417,11 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
377
417
|
"stroke-linecap": "round",
|
|
378
418
|
...i ? { "stroke-dasharray": i } : {}
|
|
379
419
|
});
|
|
380
|
-
if (
|
|
420
|
+
if (v(e, a), r.length >= 2) {
|
|
381
421
|
let i = r[0], a = r[r.length - 1], o = t.upstreamRoles ?? [], s = t.downstreamRoles ?? [];
|
|
382
422
|
if (n.symmetric) {
|
|
383
423
|
let t = (i.x + a.x) / 2, r = (i.y + a.y) / 2;
|
|
384
|
-
this.chip(e, t, r, n.abbreviation,
|
|
424
|
+
this.chip(e, t, r, n.abbreviation, j, n.stroke, n.stroke);
|
|
385
425
|
} else {
|
|
386
426
|
let n = t.pattern === "customer-supplier";
|
|
387
427
|
this.endMarkers(e, i, a, n ? "S" : "U", o), this.endMarkers(e, a, i, n ? "C" : "D", s);
|
|
@@ -389,70 +429,70 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
389
429
|
}
|
|
390
430
|
return a;
|
|
391
431
|
}
|
|
392
|
-
endMarkers(e, t, n, r,
|
|
393
|
-
let
|
|
394
|
-
x: t.x +
|
|
432
|
+
endMarkers(e, t, n, r, i) {
|
|
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,
|
|
395
435
|
y: t.y + u * 11,
|
|
396
|
-
"font-family":
|
|
397
|
-
"font-size":
|
|
436
|
+
"font-family": A.family,
|
|
437
|
+
"font-size": A.small + 1,
|
|
398
438
|
"font-weight": "800",
|
|
399
439
|
fill: d,
|
|
400
|
-
stroke:
|
|
440
|
+
stroke: j,
|
|
401
441
|
"stroke-width": 3,
|
|
402
442
|
"paint-order": "stroke",
|
|
403
443
|
"text-anchor": "middle",
|
|
404
444
|
"dominant-baseline": "central"
|
|
405
445
|
});
|
|
406
|
-
f.textContent = r,
|
|
407
|
-
let p =
|
|
446
|
+
f.textContent = r, v(e, f);
|
|
447
|
+
let p = M(t, n, r, i);
|
|
408
448
|
if (!p) return;
|
|
409
|
-
let { box:
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
height: g.height,
|
|
449
|
+
let { box: m, center: h, chipWidths: g, chipHeight: ee, innerWidth: te, gap: ne } = p, re = h.y, ie = y(b("rect"), {
|
|
450
|
+
x: m.x,
|
|
451
|
+
y: m.y,
|
|
452
|
+
width: m.width,
|
|
453
|
+
height: m.height,
|
|
415
454
|
rx: 6,
|
|
416
455
|
ry: 6,
|
|
417
|
-
fill:
|
|
456
|
+
fill: j,
|
|
418
457
|
"fill-opacity": .96,
|
|
419
458
|
stroke: "#d9d5cc",
|
|
420
459
|
"stroke-width": 1
|
|
421
|
-
})
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
460
|
+
});
|
|
461
|
+
v(e, ie);
|
|
462
|
+
let ae = h.x - te / 2;
|
|
463
|
+
i.forEach((t, n) => {
|
|
464
|
+
let r = g[n], i = l[t] ?? "#8A8577";
|
|
465
|
+
this.miniChip(e, ae + r / 2, re, r, ee, t, i), ae += r + ne;
|
|
426
466
|
});
|
|
427
467
|
}
|
|
428
|
-
miniChip(e, t, n, r, i,
|
|
429
|
-
|
|
468
|
+
miniChip(e, t, n, r, i, a, o) {
|
|
469
|
+
let s = y(b("rect"), {
|
|
430
470
|
x: t - r / 2,
|
|
431
471
|
y: n - i / 2,
|
|
432
472
|
width: r,
|
|
433
473
|
height: i,
|
|
434
474
|
rx: 3,
|
|
435
475
|
ry: 3,
|
|
436
|
-
fill:
|
|
437
|
-
stroke:
|
|
476
|
+
fill: o,
|
|
477
|
+
stroke: Ze(o),
|
|
438
478
|
"stroke-width": 1
|
|
439
|
-
})
|
|
440
|
-
|
|
479
|
+
});
|
|
480
|
+
v(e, s);
|
|
481
|
+
let c = y(b("text"), {
|
|
441
482
|
x: t,
|
|
442
483
|
y: n,
|
|
443
|
-
"font-family":
|
|
444
|
-
"font-size":
|
|
484
|
+
"font-family": A.family,
|
|
485
|
+
"font-size": A.small,
|
|
445
486
|
"font-weight": "700",
|
|
446
|
-
fill:
|
|
487
|
+
fill: u,
|
|
447
488
|
"text-anchor": "middle",
|
|
448
489
|
"dominant-baseline": "central"
|
|
449
490
|
});
|
|
450
|
-
c.textContent =
|
|
491
|
+
c.textContent = a, v(e, c);
|
|
451
492
|
}
|
|
452
493
|
chip(e, t, n, r, i, a, o) {
|
|
453
494
|
if (!r) return;
|
|
454
|
-
let s =
|
|
455
|
-
m(e, h(_("rect"), {
|
|
495
|
+
let s = A.small * .64, c = r.length * s + 12, l = A.small + 8, u = y(b("rect"), {
|
|
456
496
|
x: t - c / 2,
|
|
457
497
|
y: n - l / 2,
|
|
458
498
|
width: c,
|
|
@@ -462,48 +502,51 @@ var pe = "#F1F1EE", H = "#8A8577", U = class extends p {
|
|
|
462
502
|
fill: i,
|
|
463
503
|
stroke: o,
|
|
464
504
|
"stroke-width": 1,
|
|
465
|
-
...i ===
|
|
466
|
-
})
|
|
467
|
-
|
|
505
|
+
...i === j ? { "fill-opacity": .95 } : {}
|
|
506
|
+
});
|
|
507
|
+
v(e, u);
|
|
508
|
+
let d = y(b("text"), {
|
|
468
509
|
x: t,
|
|
469
510
|
y: n,
|
|
470
|
-
"font-family":
|
|
471
|
-
"font-size":
|
|
511
|
+
"font-family": A.family,
|
|
512
|
+
"font-size": A.small,
|
|
472
513
|
"font-weight": "700",
|
|
473
514
|
fill: a,
|
|
474
515
|
"text-anchor": "middle",
|
|
475
516
|
"dominant-baseline": "central"
|
|
476
517
|
});
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
appendLabel(e, t, n, r, i) {
|
|
480
|
-
let
|
|
481
|
-
|
|
482
|
-
|
|
518
|
+
d.textContent = r, v(e, d);
|
|
519
|
+
}
|
|
520
|
+
appendLabel(e, t, n, r, i, a) {
|
|
521
|
+
let o = typeof a["font-size"] == "number" ? a["font-size"] : A.label, s = String(a["font-weight"] ?? "400"), c = n - 20, l = 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));
|
|
523
|
+
let p = 36 + u / 2;
|
|
524
|
+
l.forEach((t, r) => {
|
|
525
|
+
let i = y(b("text"), {
|
|
526
|
+
class: "cm-name",
|
|
483
527
|
x: n / 2,
|
|
484
|
-
y:
|
|
485
|
-
"font-family":
|
|
486
|
-
"font-size":
|
|
487
|
-
fill:
|
|
528
|
+
y: p + r * u,
|
|
529
|
+
"font-family": A.family,
|
|
530
|
+
"font-size": o,
|
|
531
|
+
fill: k,
|
|
488
532
|
"text-anchor": "middle",
|
|
489
533
|
"dominant-baseline": "central",
|
|
490
|
-
...
|
|
534
|
+
...a
|
|
491
535
|
});
|
|
492
|
-
|
|
536
|
+
i.textContent = t, v(e, i);
|
|
493
537
|
});
|
|
494
538
|
}
|
|
495
539
|
};
|
|
496
|
-
function
|
|
540
|
+
function Ze(e, t = .7) {
|
|
497
541
|
let n = /^#([0-9a-f]{6})$/i.exec(e);
|
|
498
542
|
if (!n) return e;
|
|
499
543
|
let r = parseInt(n[1], 16);
|
|
500
544
|
return `rgb(${Math.round((r >> 16 & 255) * t)},${Math.round((r >> 8 & 255) * t)},${Math.round((r & 255) * t)})`;
|
|
501
545
|
}
|
|
502
|
-
var
|
|
503
|
-
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) {
|
|
504
548
|
if (e === "generic") {
|
|
505
|
-
let e =
|
|
506
|
-
return m(e, h(_("circle"), {
|
|
549
|
+
let e = b("g"), a = y(b("circle"), {
|
|
507
550
|
cx: t,
|
|
508
551
|
cy: n,
|
|
509
552
|
r: r / 2 - 1,
|
|
@@ -511,41 +554,76 @@ function _e(e, t, n, r, i) {
|
|
|
511
554
|
stroke: i,
|
|
512
555
|
"stroke-width": 1.6,
|
|
513
556
|
"stroke-dasharray": "2.2 2.2"
|
|
514
|
-
})
|
|
557
|
+
});
|
|
558
|
+
return v(e, a), e;
|
|
515
559
|
}
|
|
516
|
-
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s =
|
|
517
|
-
|
|
518
|
-
|
|
560
|
+
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = b("g");
|
|
561
|
+
y(s, { transform: `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}` });
|
|
562
|
+
let c = y(b("path"), {
|
|
563
|
+
d: e === "core" ? Qe : $e,
|
|
519
564
|
fill: i
|
|
520
|
-
})
|
|
565
|
+
});
|
|
566
|
+
return v(s, c), s;
|
|
521
567
|
}
|
|
522
|
-
var
|
|
523
|
-
function
|
|
524
|
-
let i = n / 24, a =
|
|
525
|
-
|
|
526
|
-
|
|
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");
|
|
571
|
+
y(a, { transform: `translate(${e - 12 * i} ${t - 12 * i}) scale(${i})` });
|
|
572
|
+
let o = y(b("path"), {
|
|
573
|
+
d: tt,
|
|
527
574
|
fill: r
|
|
528
|
-
})
|
|
575
|
+
});
|
|
576
|
+
return v(a, o), a;
|
|
577
|
+
}
|
|
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;
|
|
581
|
+
}
|
|
582
|
+
function it(e, t, n, r) {
|
|
583
|
+
let i = e;
|
|
584
|
+
for (; i && rt(`${i}…`, n, r) > t;) i = i.slice(0, -1).trimEnd();
|
|
585
|
+
return `${i}…`;
|
|
529
586
|
}
|
|
530
|
-
function
|
|
531
|
-
let
|
|
587
|
+
function at(e, t, n, r) {
|
|
588
|
+
let i = e.split("\n");
|
|
589
|
+
return i.every((e) => e.trim() === "") ? [] : i.flatMap((e) => {
|
|
590
|
+
let i = ot(e, t, n, r);
|
|
591
|
+
return i.length ? i : [""];
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function ot(e, t, n, r) {
|
|
595
|
+
let i = e.split(/\s+/).filter(Boolean);
|
|
532
596
|
if (i.length === 0) return [];
|
|
533
|
-
let a = [],
|
|
597
|
+
let a = (e) => rt(e, n, r) <= t, o = [], s = "";
|
|
534
598
|
for (let e of i) {
|
|
535
|
-
let t =
|
|
536
|
-
|
|
599
|
+
let t = s ? `${s} ${e}` : e;
|
|
600
|
+
if (a(t)) {
|
|
601
|
+
s = t;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
s && o.push(s);
|
|
605
|
+
let n = e;
|
|
606
|
+
for (; n && !a(n);) {
|
|
607
|
+
let e = 1, t = n.length - 1;
|
|
608
|
+
for (; e < t;) {
|
|
609
|
+
let r = Math.ceil((e + t) / 2);
|
|
610
|
+
a(n.slice(0, r)) ? e = r : t = r - 1;
|
|
611
|
+
}
|
|
612
|
+
o.push(n.slice(0, e)), n = n.slice(e);
|
|
613
|
+
}
|
|
614
|
+
s = n;
|
|
537
615
|
}
|
|
538
|
-
return
|
|
616
|
+
return s && o.push(s), o;
|
|
539
617
|
}
|
|
540
618
|
//#endregion
|
|
541
619
|
//#region src/draw/index.ts
|
|
542
|
-
var
|
|
620
|
+
var st = {
|
|
543
621
|
__init__: ["cmRenderer"],
|
|
544
|
-
cmRenderer: ["type",
|
|
622
|
+
cmRenderer: ["type", Xe]
|
|
545
623
|
};
|
|
546
624
|
//#endregion
|
|
547
625
|
//#region src/io/CmImporter.ts
|
|
548
|
-
function
|
|
626
|
+
function ct(e, t) {
|
|
549
627
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r;
|
|
550
628
|
if (i === 0 && a === 0) return {
|
|
551
629
|
x: n,
|
|
@@ -557,13 +635,13 @@ function G(e, t) {
|
|
|
557
635
|
y: r + a * c
|
|
558
636
|
};
|
|
559
637
|
}
|
|
560
|
-
function
|
|
638
|
+
function lt(e) {
|
|
561
639
|
return {
|
|
562
640
|
x: e.x + e.width / 2,
|
|
563
641
|
y: e.y + e.height / 2
|
|
564
642
|
};
|
|
565
643
|
}
|
|
566
|
-
var
|
|
644
|
+
var ut = class {
|
|
567
645
|
canvas;
|
|
568
646
|
elementFactory;
|
|
569
647
|
factory;
|
|
@@ -579,59 +657,64 @@ var q = class {
|
|
|
579
657
|
constructor(e, t, n, r, i) {
|
|
580
658
|
this.canvas = e, this.elementFactory = t, this.factory = n, this.eventBus = r, this.elementRegistry = i;
|
|
581
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
|
+
}
|
|
582
668
|
import(e) {
|
|
583
669
|
let t = [];
|
|
584
670
|
this.eventBus.fire("import.render.start", { document: e });
|
|
585
|
-
let n;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
let r;
|
|
592
|
-
n && n.id === "cm-root" ? r = n : (r = this.elementFactory.createRoot({ id: j }), this.canvas.setRootElement(r)), r.businessObject = { title: e.title };
|
|
593
|
-
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();
|
|
594
677
|
for (let t of e.contexts) {
|
|
595
678
|
let e = this.factory.createContext(t);
|
|
596
|
-
|
|
679
|
+
o.set(t.id, e);
|
|
597
680
|
}
|
|
598
|
-
for (let
|
|
599
|
-
let e =
|
|
681
|
+
for (let r of e.relationships) {
|
|
682
|
+
let e = o.get(r.from), a = o.get(r.to);
|
|
600
683
|
if (!e || !a) {
|
|
601
|
-
t.push({
|
|
602
|
-
message: `Relationship "${
|
|
603
|
-
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
|
|
604
687
|
});
|
|
605
688
|
continue;
|
|
606
689
|
}
|
|
607
|
-
let
|
|
608
|
-
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);
|
|
609
692
|
}
|
|
610
|
-
for (let e of
|
|
611
|
-
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;
|
|
612
701
|
}
|
|
613
702
|
clear() {
|
|
614
|
-
|
|
615
|
-
|
|
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);
|
|
616
706
|
} catch {}
|
|
617
707
|
}
|
|
618
|
-
},
|
|
708
|
+
}, dt = class {
|
|
619
709
|
elementRegistry;
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
this.elementRegistry = e, this.canvas = t;
|
|
710
|
+
static $inject = ["elementRegistry"];
|
|
711
|
+
constructor(e) {
|
|
712
|
+
this.elementRegistry = e;
|
|
624
713
|
}
|
|
625
714
|
export() {
|
|
626
|
-
let e;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
} catch {
|
|
630
|
-
e = void 0;
|
|
631
|
-
}
|
|
632
|
-
let t = [], n = [];
|
|
633
|
-
for (let e of this.elementRegistry.getAll()) if (e.id !== "cm-root") {
|
|
634
|
-
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)) {
|
|
635
718
|
let n = e;
|
|
636
719
|
t.push({
|
|
637
720
|
id: e.id,
|
|
@@ -648,9 +731,10 @@ var q = class {
|
|
|
648
731
|
...e.team ? { team: e.team } : {},
|
|
649
732
|
...e.description ? { description: e.description } : {},
|
|
650
733
|
...e.fill ? { fill: e.fill } : {},
|
|
651
|
-
...e.stroke ? { stroke: e.stroke } : {}
|
|
734
|
+
...e.stroke ? { stroke: e.stroke } : {},
|
|
735
|
+
...e.cmForeign
|
|
652
736
|
});
|
|
653
|
-
} else if (
|
|
737
|
+
} else if (E(e)) {
|
|
654
738
|
let t = e.source, r = e.target;
|
|
655
739
|
if (!t?.id || !r?.id) continue;
|
|
656
740
|
n.push({
|
|
@@ -662,69 +746,147 @@ var q = class {
|
|
|
662
746
|
...e.downstreamRoles?.length ? { downstreamRoles: [...e.downstreamRoles] } : {},
|
|
663
747
|
...e.cmLabel ? { label: e.cmLabel } : {},
|
|
664
748
|
...e.description ? { description: e.description } : {},
|
|
665
|
-
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {}
|
|
749
|
+
...e.implementationTechnology ? { implementationTechnology: e.implementationTechnology } : {},
|
|
750
|
+
...e.cmForeign
|
|
666
751
|
});
|
|
667
752
|
}
|
|
668
753
|
}
|
|
669
|
-
return {
|
|
670
|
-
version:
|
|
754
|
+
return n.push(...e?.unplacedRelationships ?? []), {
|
|
755
|
+
version: o,
|
|
671
756
|
title: e?.title ?? "Untitled context map",
|
|
672
757
|
contexts: t,
|
|
673
|
-
relationships: n
|
|
758
|
+
relationships: n,
|
|
759
|
+
...e?.foreign
|
|
674
760
|
};
|
|
675
761
|
}
|
|
676
|
-
},
|
|
677
|
-
cmImporter: ["type",
|
|
678
|
-
cmExporter: ["type",
|
|
679
|
-
},
|
|
762
|
+
}, ft = {
|
|
763
|
+
cmImporter: ["type", ut],
|
|
764
|
+
cmExporter: ["type", dt]
|
|
765
|
+
}, pt = class extends ze {
|
|
680
766
|
_getModules() {
|
|
681
767
|
return [
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
768
|
+
We,
|
|
769
|
+
st,
|
|
770
|
+
ft
|
|
685
771
|
];
|
|
686
772
|
}
|
|
687
|
-
},
|
|
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 {
|
|
688
824
|
_getModules() {
|
|
689
825
|
return [
|
|
690
826
|
...super._getModules(),
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
827
|
+
x,
|
|
828
|
+
de,
|
|
829
|
+
fe,
|
|
830
|
+
vt
|
|
694
831
|
];
|
|
695
832
|
}
|
|
696
833
|
};
|
|
697
834
|
//#endregion
|
|
698
835
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
699
|
-
function
|
|
836
|
+
function yt(e, t, n) {
|
|
700
837
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
701
838
|
}
|
|
702
|
-
var
|
|
839
|
+
var bt = class {
|
|
703
840
|
execute(e) {
|
|
704
841
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
705
|
-
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]);
|
|
706
843
|
return e.oldProperties = i, [t];
|
|
707
844
|
}
|
|
708
845
|
revert(e) {
|
|
709
846
|
let { element: t, oldProperties: n } = e, r = t;
|
|
710
|
-
if (n) for (let e of Object.keys(n))
|
|
847
|
+
if (n) for (let e of Object.keys(n)) yt(r, e, n[e]);
|
|
711
848
|
return [t];
|
|
712
849
|
}
|
|
713
850
|
};
|
|
714
851
|
//#endregion
|
|
715
852
|
//#region src/modeling/cmd/SwapEndsHandler.ts
|
|
716
|
-
function
|
|
853
|
+
function xt(e) {
|
|
717
854
|
let t = e.source;
|
|
718
855
|
return e.source = e.target, e.target = t, Array.isArray(e.waypoints) && (e.waypoints = [...e.waypoints].reverse()), [e];
|
|
719
856
|
}
|
|
720
|
-
var
|
|
857
|
+
var St = class {
|
|
721
858
|
execute(e) {
|
|
722
|
-
return
|
|
859
|
+
return xt(e.connection);
|
|
723
860
|
}
|
|
724
861
|
revert(e) {
|
|
725
|
-
return
|
|
862
|
+
return xt(e.connection);
|
|
726
863
|
}
|
|
727
|
-
},
|
|
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
|
+
}, [];
|
|
881
|
+
}
|
|
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 {
|
|
728
890
|
commandStack;
|
|
729
891
|
elementRegistry;
|
|
730
892
|
graphicsFactory;
|
|
@@ -734,17 +896,20 @@ var we = class {
|
|
|
734
896
|
"graphicsFactory"
|
|
735
897
|
];
|
|
736
898
|
constructor(e, t, n) {
|
|
737
|
-
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 });
|
|
738
903
|
}
|
|
739
904
|
redraw(e) {
|
|
740
905
|
let t = this.elementRegistry.getGraphics(e);
|
|
741
|
-
t && this.graphicsFactory.update(
|
|
906
|
+
t && this.graphicsFactory.update(E(e) ? "connection" : "shape", e, t);
|
|
742
907
|
}
|
|
743
908
|
swapEnds(e) {
|
|
744
|
-
this.commandStack.execute(
|
|
909
|
+
this.commandStack.execute(Tt, { connection: e }), this.redraw(e);
|
|
745
910
|
}
|
|
746
911
|
updateProperties(e, t) {
|
|
747
|
-
this.commandStack.execute(
|
|
912
|
+
this.commandStack.execute(wt, {
|
|
748
913
|
element: e,
|
|
749
914
|
properties: t
|
|
750
915
|
}), this.redraw(e);
|
|
@@ -769,7 +934,7 @@ var we = class {
|
|
|
769
934
|
}
|
|
770
935
|
setPattern(e, t) {
|
|
771
936
|
let n = { pattern: t };
|
|
772
|
-
if (
|
|
937
|
+
if (te(t)) n.upstreamRoles = void 0, n.downstreamRoles = void 0;
|
|
773
938
|
else if (t === "customer-supplier") {
|
|
774
939
|
let t = (e.upstreamRoles ?? []).filter((e) => e !== "OHS"), r = (e.downstreamRoles ?? []).filter((e) => e !== "CF");
|
|
775
940
|
n.upstreamRoles = t.length ? t : void 0, n.downstreamRoles = r.length ? r : void 0;
|
|
@@ -785,36 +950,36 @@ var we = class {
|
|
|
785
950
|
setImplementationTechnology(e, t) {
|
|
786
951
|
this.updateProperties(e, { implementationTechnology: t || void 0 });
|
|
787
952
|
}
|
|
788
|
-
},
|
|
953
|
+
}, F = {
|
|
789
954
|
__init__: ["cmModeling"],
|
|
790
|
-
cmModeling: ["type",
|
|
791
|
-
layouter: ["type",
|
|
792
|
-
},
|
|
955
|
+
cmModeling: ["type", Dt],
|
|
956
|
+
layouter: ["type", Ue]
|
|
957
|
+
}, Ot = class extends _e {
|
|
793
958
|
static $inject = ["eventBus"];
|
|
794
959
|
constructor(e) {
|
|
795
960
|
super(e);
|
|
796
961
|
}
|
|
797
962
|
init() {
|
|
798
|
-
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !
|
|
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);
|
|
799
964
|
}
|
|
800
965
|
};
|
|
801
|
-
function
|
|
966
|
+
function kt(e, t, n) {
|
|
802
967
|
let { incoming: r = [], outgoing: i = [] } = e;
|
|
803
968
|
return [...r, ...i].some((r) => r !== n && (r.source === e && r.target === t || r.source === t && r.target === e));
|
|
804
969
|
}
|
|
805
|
-
function
|
|
806
|
-
return !
|
|
970
|
+
function At(e, t, n) {
|
|
971
|
+
return !T(e) || !T(t) || e === t || kt(e, t, n) ? !1 : {
|
|
807
972
|
cmKind: "relationship",
|
|
808
973
|
pattern: "upstream-downstream"
|
|
809
974
|
};
|
|
810
975
|
}
|
|
811
976
|
//#endregion
|
|
812
977
|
//#region src/rules/index.ts
|
|
813
|
-
var
|
|
814
|
-
__depends__: [
|
|
978
|
+
var I = {
|
|
979
|
+
__depends__: [ge],
|
|
815
980
|
__init__: ["cmRules"],
|
|
816
|
-
cmRules: ["type",
|
|
817
|
-
},
|
|
981
|
+
cmRules: ["type", Ot]
|
|
982
|
+
}, jt = class extends ve {
|
|
818
983
|
static $inject = [
|
|
819
984
|
"eventBus",
|
|
820
985
|
"canvas",
|
|
@@ -823,89 +988,367 @@ var Me = {
|
|
|
823
988
|
constructor(e, t, n) {
|
|
824
989
|
super(e), this.preExecute(["shape.create", "elements.create"], (e) => {
|
|
825
990
|
e.parent = t.getRootElement();
|
|
826
|
-
}, !0)
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
991
|
+
}, !0);
|
|
992
|
+
let r = null;
|
|
993
|
+
this.preExecute("elements.move", (e) => {
|
|
994
|
+
r = new Set((e.shapes ?? []).map((e) => e.id));
|
|
995
|
+
}, !0), this.postExecuted("elements.move", () => {
|
|
996
|
+
r = null;
|
|
997
|
+
}, !0), this.postExecute(["shape.move", "shape.resize"], (e) => {
|
|
998
|
+
let t = e.shapes ?? (e.shape ? [e.shape] : []), i = /* @__PURE__ */ new Set();
|
|
832
999
|
for (let e of t) {
|
|
833
1000
|
let t = [...e.incoming ?? [], ...e.outgoing ?? []];
|
|
834
|
-
for (let e of t)
|
|
1001
|
+
for (let e of t) {
|
|
1002
|
+
if (i.has(e.id)) continue;
|
|
1003
|
+
i.add(e.id);
|
|
1004
|
+
let t = e.source?.id, a = e.target?.id;
|
|
1005
|
+
t && a && r?.has(t) && r.has(a) || n.layoutConnection(e);
|
|
1006
|
+
}
|
|
835
1007
|
}
|
|
836
1008
|
}, !0);
|
|
837
1009
|
}
|
|
838
|
-
},
|
|
1010
|
+
}, Mt = "cm-dragging", Nt = class {
|
|
839
1011
|
static $inject = ["eventBus", "canvas"];
|
|
840
1012
|
constructor(e, t) {
|
|
841
1013
|
e.on("drag.init", () => {
|
|
842
|
-
t.getContainer().classList.add(
|
|
1014
|
+
t.getContainer().classList.add(Mt);
|
|
843
1015
|
}), e.on("drag.cleanup", () => {
|
|
844
|
-
t.getContainer().classList.remove(
|
|
1016
|
+
t.getContainer().classList.remove(Mt);
|
|
845
1017
|
});
|
|
846
1018
|
}
|
|
847
|
-
},
|
|
1019
|
+
}, Pt = 2e3, Ft = {
|
|
848
1020
|
__init__: [
|
|
849
1021
|
"cmFlatModelBehavior",
|
|
850
1022
|
"cmDragBehavior",
|
|
851
1023
|
"cmClickSelectionBehavior"
|
|
852
1024
|
],
|
|
853
|
-
cmFlatModelBehavior: ["type",
|
|
854
|
-
cmDragBehavior: ["type",
|
|
1025
|
+
cmFlatModelBehavior: ["type", jt],
|
|
1026
|
+
cmDragBehavior: ["type", Nt],
|
|
855
1027
|
cmClickSelectionBehavior: ["type", class {
|
|
856
1028
|
static $inject = ["eventBus", "selection"];
|
|
857
1029
|
constructor(e, t) {
|
|
858
|
-
e.on("element.click",
|
|
1030
|
+
e.on("element.click", Pt, (e) => {
|
|
859
1031
|
let n = e.element;
|
|
860
|
-
if (
|
|
1032
|
+
if (w(n) && !ye(e) && t.isSelected(n)) return !1;
|
|
861
1033
|
});
|
|
862
1034
|
}
|
|
863
1035
|
}]
|
|
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;
|
|
1054
|
+
}
|
|
1055
|
+
init() {
|
|
1056
|
+
this.addRule(Lt, It, () => !this.readOnly && void 0);
|
|
1057
|
+
}
|
|
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 = {
|
|
1069
|
+
name: "cm-direct-editing",
|
|
1070
|
+
team: "cm-direct-editing-team"
|
|
1071
|
+
}, Bt = 10, Vt = 20, Ht = class {
|
|
1072
|
+
canvas;
|
|
1073
|
+
directEditing;
|
|
1074
|
+
modeling;
|
|
1075
|
+
elementRegistry;
|
|
1076
|
+
readOnly;
|
|
1077
|
+
static $inject = [
|
|
1078
|
+
"eventBus",
|
|
1079
|
+
"canvas",
|
|
1080
|
+
"directEditing",
|
|
1081
|
+
"cmModeling",
|
|
1082
|
+
"elementRegistry",
|
|
1083
|
+
"cmReadOnly"
|
|
1084
|
+
];
|
|
1085
|
+
mode = "name";
|
|
1086
|
+
activeMarker;
|
|
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({
|
|
1091
|
+
activate: (e) => this.activationContext(e),
|
|
1092
|
+
update: (e, t) => this.commit(e, t)
|
|
1093
|
+
}), e.on("element.dblclick", (e) => {
|
|
1094
|
+
let t = e.element;
|
|
1095
|
+
w(t) && (this.mode = T(t) && t.team && this.isInTeamBand(t, e.originalEvent) ? "team" : "name", n.activate(t));
|
|
1096
|
+
}), e.on(["canvas.viewbox.changing", "drag.init"], () => n.complete()), e.on("directEditing.activate", (e) => {
|
|
1097
|
+
let n = e.active?.element;
|
|
1098
|
+
if (!n) return;
|
|
1099
|
+
let r = zt[this.mode];
|
|
1100
|
+
t.addMarker(n, r), this.activeMarker = {
|
|
1101
|
+
element: n,
|
|
1102
|
+
marker: r
|
|
1103
|
+
};
|
|
1104
|
+
}), e.on(["directEditing.complete", "directEditing.cancel"], () => {
|
|
1105
|
+
let e = this.activeMarker;
|
|
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();
|
|
1111
|
+
});
|
|
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
|
+
}
|
|
1141
|
+
activate(e) {
|
|
1142
|
+
this.mode = "name", this.directEditing.activate(e);
|
|
1143
|
+
}
|
|
1144
|
+
activateTeam(e) {
|
|
1145
|
+
this.mode = "team", this.directEditing.activate(e);
|
|
1146
|
+
}
|
|
1147
|
+
cancel() {
|
|
1148
|
+
this.directEditing.cancel();
|
|
1149
|
+
}
|
|
1150
|
+
isInTeamBand(e, t) {
|
|
1151
|
+
if (typeof t?.clientY != "number") return !1;
|
|
1152
|
+
let n = this.canvas.zoom(), r = this.canvas.getAbsoluteBBox(e), i = this.canvas.getContainer().getBoundingClientRect().top;
|
|
1153
|
+
return t.clientY - i >= r.y + r.height - 22 * n;
|
|
1154
|
+
}
|
|
1155
|
+
activationContext(e) {
|
|
1156
|
+
if (!w(e)) return;
|
|
1157
|
+
this.mode === "team" && !T(e) && (this.mode = "name");
|
|
1158
|
+
let t = this.canvas.zoom(), n = this.canvas.getAbsoluteBBox(e);
|
|
1159
|
+
if (this.mode === "team") {
|
|
1160
|
+
let r = e;
|
|
1161
|
+
return {
|
|
1162
|
+
bounds: {
|
|
1163
|
+
x: n.x + Bt * t,
|
|
1164
|
+
y: n.y + n.height - 22 * t,
|
|
1165
|
+
width: n.width - 20 * t,
|
|
1166
|
+
height: Vt * t
|
|
1167
|
+
},
|
|
1168
|
+
text: r.team ?? "",
|
|
1169
|
+
style: {
|
|
1170
|
+
fontFamily: A.family,
|
|
1171
|
+
fontSize: `${A.small * t}px`,
|
|
1172
|
+
fontWeight: 400,
|
|
1173
|
+
lineHeight: 1.2,
|
|
1174
|
+
backgroundColor: "transparent",
|
|
1175
|
+
border: "1px dashed var(--cd-ui-interaktion)",
|
|
1176
|
+
textAlign: "center"
|
|
1177
|
+
},
|
|
1178
|
+
options: { centerVertically: !0 }
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
let r = {
|
|
1182
|
+
fontFamily: A.family,
|
|
1183
|
+
fontSize: `${A.label * t}px`,
|
|
1184
|
+
fontWeight: 650,
|
|
1185
|
+
lineHeight: 1.2,
|
|
1186
|
+
backgroundColor: "transparent",
|
|
1187
|
+
border: "1px dashed var(--cd-ui-interaktion)",
|
|
1188
|
+
textAlign: "center"
|
|
1189
|
+
};
|
|
1190
|
+
if (T(e)) {
|
|
1191
|
+
let i = e.team ? 18 * t : 0;
|
|
1192
|
+
return {
|
|
1193
|
+
bounds: {
|
|
1194
|
+
x: n.x + Bt * t,
|
|
1195
|
+
y: n.y + 36 * t - 1,
|
|
1196
|
+
width: n.width - 20 * t,
|
|
1197
|
+
height: n.height - 36 * t - i
|
|
1198
|
+
},
|
|
1199
|
+
text: e.cmLabel ?? "",
|
|
1200
|
+
style: r
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
let i = 160 * t, a = 44 * t;
|
|
1204
|
+
return {
|
|
1205
|
+
bounds: {
|
|
1206
|
+
x: n.x + n.width / 2 - i / 2,
|
|
1207
|
+
y: n.y + n.height / 2 - a / 2,
|
|
1208
|
+
width: i,
|
|
1209
|
+
height: a
|
|
1210
|
+
},
|
|
1211
|
+
text: e.cmLabel ?? "",
|
|
1212
|
+
style: {
|
|
1213
|
+
...r,
|
|
1214
|
+
backgroundColor: "var(--cd-ui-flaeche-hoch)"
|
|
1215
|
+
},
|
|
1216
|
+
options: { centerVertically: !0 }
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
commit(e, t) {
|
|
1220
|
+
let n = t.trim();
|
|
1221
|
+
if (this.mode === "team") {
|
|
1222
|
+
let t = e;
|
|
1223
|
+
if (n === (t.team ?? "")) return;
|
|
1224
|
+
this.modeling.setTeam(t, n || void 0);
|
|
1225
|
+
} else n !== (e.cmLabel ?? "") && this.modeling.updateLabel(e, n);
|
|
1226
|
+
}
|
|
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
|
+
],
|
|
1242
|
+
__init__: ["cmLabelEditing"],
|
|
1243
|
+
cmLabelEditing: ["type", Ht]
|
|
864
1244
|
};
|
|
865
1245
|
//#endregion
|
|
866
1246
|
//#region src/draw/palette-icons.ts
|
|
867
|
-
function
|
|
868
|
-
return `<svg class="cm-palette-svg" width="
|
|
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>`;
|
|
869
1249
|
}
|
|
870
|
-
var
|
|
871
|
-
function
|
|
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) {
|
|
872
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"/>`;
|
|
873
1253
|
let a = r / 24, o = e === "supporting" ? " rotate(90 12 12)" : "", s = `translate(${t - 12 * a} ${n - 12 * a}) scale(${a})${o}`;
|
|
874
|
-
return `<path d="${e === "core" ?
|
|
1254
|
+
return `<path d="${e === "core" ? Gt : Kt}" fill="${i}" transform="${s}"/>`;
|
|
875
1255
|
}
|
|
876
|
-
function
|
|
877
|
-
let t =
|
|
878
|
-
return
|
|
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));
|
|
879
1259
|
}
|
|
880
|
-
function
|
|
881
|
-
let
|
|
882
|
-
return
|
|
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);
|
|
883
1295
|
}
|
|
884
1296
|
//#endregion
|
|
885
1297
|
//#region src/palette/CmPaletteProvider.ts
|
|
886
|
-
var
|
|
887
|
-
function
|
|
888
|
-
return `<div class="entry cm-palette-entry" draggable
|
|
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();
|
|
889
1304
|
}
|
|
890
|
-
|
|
1305
|
+
function rn(e) {
|
|
1306
|
+
return e.type === "click" && e.detail === 0;
|
|
1307
|
+
}
|
|
1308
|
+
var an = class {
|
|
891
1309
|
create;
|
|
1310
|
+
lassoTool;
|
|
892
1311
|
factory;
|
|
1312
|
+
canvas;
|
|
1313
|
+
modeling;
|
|
1314
|
+
selection;
|
|
1315
|
+
elementRegistry;
|
|
1316
|
+
labelEditing;
|
|
1317
|
+
readOnly;
|
|
1318
|
+
config;
|
|
893
1319
|
static $inject = [
|
|
894
1320
|
"palette",
|
|
895
1321
|
"create",
|
|
896
|
-
"
|
|
1322
|
+
"lassoTool",
|
|
1323
|
+
"cmElementFactory",
|
|
1324
|
+
"canvas",
|
|
1325
|
+
"modeling",
|
|
1326
|
+
"selection",
|
|
1327
|
+
"elementRegistry",
|
|
1328
|
+
"cmLabelEditing",
|
|
1329
|
+
"cmReadOnly",
|
|
1330
|
+
"config.cmPalette"
|
|
897
1331
|
];
|
|
898
|
-
constructor(e, t, n) {
|
|
899
|
-
this.create = t, this.
|
|
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);
|
|
900
1334
|
}
|
|
901
1335
|
getPaletteEntries() {
|
|
902
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
|
+
};
|
|
903
1343
|
for (let t of n) {
|
|
904
|
-
let n = (e) =>
|
|
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
|
+
};
|
|
905
1348
|
e[`context.${t.type}`] = {
|
|
906
|
-
group:
|
|
907
|
-
title:
|
|
908
|
-
html:
|
|
1349
|
+
group: $t,
|
|
1350
|
+
title: nn(t.label),
|
|
1351
|
+
html: tn(B(t.type), !0),
|
|
909
1352
|
action: {
|
|
910
1353
|
dragstart: n,
|
|
911
1354
|
click: n
|
|
@@ -914,215 +1357,461 @@ var Ke = class {
|
|
|
914
1357
|
}
|
|
915
1358
|
return e;
|
|
916
1359
|
}
|
|
917
|
-
|
|
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 = {
|
|
918
1383
|
__depends__: [
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1384
|
+
be,
|
|
1385
|
+
xe,
|
|
1386
|
+
C,
|
|
1387
|
+
Se,
|
|
1388
|
+
S,
|
|
1389
|
+
x,
|
|
1390
|
+
z,
|
|
1391
|
+
R
|
|
922
1392
|
],
|
|
923
1393
|
__init__: ["cmPaletteProvider"],
|
|
924
|
-
cmPaletteProvider: ["type",
|
|
925
|
-
},
|
|
926
|
-
|
|
927
|
-
|
|
1394
|
+
cmPaletteProvider: ["type", an]
|
|
1395
|
+
}, sn = "cm-subdomain-menu", cn = "cm-pattern-menu", W = "cm-roles-menu", G = "cm-popup-active", K = 8, ln = {
|
|
1396
|
+
OHS: "Open Host Service is one-size-fits-all and not applicable in a customer-supplier relationship.",
|
|
1397
|
+
CF: "Conformist is not applicable in a customer-supplier relationship — a customer can negotiate."
|
|
1398
|
+
};
|
|
1399
|
+
function un(e) {
|
|
1400
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
928
1401
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
{
|
|
933
|
-
side: "top",
|
|
934
|
-
rotationDeg: -90
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
side: "right",
|
|
938
|
-
rotationDeg: 0
|
|
939
|
-
},
|
|
940
|
-
{
|
|
941
|
-
side: "bottom",
|
|
942
|
-
rotationDeg: 90
|
|
943
|
-
},
|
|
944
|
-
{
|
|
945
|
-
side: "left",
|
|
946
|
-
rotationDeg: 180
|
|
947
|
-
}
|
|
948
|
-
];
|
|
949
|
-
function et(e, t) {
|
|
950
|
-
let n = t.width / 2 - Ze / 2, r = t.height / 2 - Ze / 2;
|
|
951
|
-
switch (e) {
|
|
952
|
-
case "top": return {
|
|
953
|
-
top: -40,
|
|
954
|
-
left: n
|
|
955
|
-
};
|
|
956
|
-
case "bottom": return {
|
|
957
|
-
top: t.height + Qe,
|
|
958
|
-
left: n
|
|
959
|
-
};
|
|
960
|
-
case "left": return {
|
|
961
|
-
top: r,
|
|
962
|
-
left: -40
|
|
963
|
-
};
|
|
964
|
-
case "right": return {
|
|
965
|
-
top: r,
|
|
966
|
-
left: t.width + Qe
|
|
967
|
-
};
|
|
968
|
-
}
|
|
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>`;
|
|
969
1405
|
}
|
|
970
|
-
var
|
|
1406
|
+
var dn = class {
|
|
1407
|
+
contextPad;
|
|
1408
|
+
popupMenu;
|
|
971
1409
|
eventBus;
|
|
972
|
-
|
|
973
|
-
|
|
1410
|
+
create;
|
|
1411
|
+
autoPlace;
|
|
1412
|
+
rules;
|
|
974
1413
|
dragging;
|
|
1414
|
+
modeling;
|
|
1415
|
+
cmModeling;
|
|
1416
|
+
labelEditing;
|
|
1417
|
+
elementFactory;
|
|
1418
|
+
selection;
|
|
1419
|
+
canvas;
|
|
1420
|
+
scheduler;
|
|
1421
|
+
readOnly;
|
|
975
1422
|
static $inject = [
|
|
1423
|
+
"contextPad",
|
|
1424
|
+
"popupMenu",
|
|
976
1425
|
"eventBus",
|
|
977
|
-
"selection",
|
|
978
|
-
"overlays",
|
|
979
1426
|
"connect",
|
|
980
|
-
"
|
|
1427
|
+
"create",
|
|
1428
|
+
"autoPlace",
|
|
1429
|
+
"rules",
|
|
1430
|
+
"dragging",
|
|
1431
|
+
"modeling",
|
|
1432
|
+
"cmModeling",
|
|
1433
|
+
"cmLabelEditing",
|
|
1434
|
+
"cmElementFactory",
|
|
1435
|
+
"selection",
|
|
1436
|
+
"canvas",
|
|
1437
|
+
"scheduler",
|
|
1438
|
+
"cmReadOnly"
|
|
981
1439
|
];
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1440
|
+
currentMenu;
|
|
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) => {
|
|
1450
|
+
let { source: t, shape: n } = e, r = {
|
|
1451
|
+
x: ce(t).right + De + n.width / 2,
|
|
1452
|
+
y: _(t).y
|
|
1453
|
+
};
|
|
1454
|
+
return Oe(t, n, r, ke({ y: {
|
|
1455
|
+
margin: 30,
|
|
1456
|
+
minDistance: 30
|
|
1457
|
+
} }));
|
|
1458
|
+
}), n.on("contextPad.create", (e) => {
|
|
1459
|
+
let { pad: t, target: n } = e;
|
|
1460
|
+
if (!t) return;
|
|
1461
|
+
let r = !1, i = !1;
|
|
1462
|
+
if (E(n)) {
|
|
1463
|
+
let e = n.waypoints ?? [], t = e[e.length - 1], a = e[e.length - 2];
|
|
1464
|
+
if (t && a) {
|
|
1465
|
+
let e = t.x - a.x, n = t.y - a.y;
|
|
1466
|
+
r = Math.abs(e) >= Math.abs(n) && e > 0, i = Math.abs(n) > Math.abs(e) && n > 0;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
t.classList.toggle("cm-pad-flip-x", r), t.classList.toggle("cm-pad-flip-y", i);
|
|
1470
|
+
}), n.on([
|
|
1471
|
+
"contextPad.open",
|
|
1472
|
+
"contextPad.show",
|
|
1473
|
+
"canvas.viewbox.changed"
|
|
1474
|
+
], 250, () => this.clampPadIntoView());
|
|
1475
|
+
}
|
|
1476
|
+
clampPadIntoView() {
|
|
1477
|
+
this.scheduler.schedule(() => {
|
|
1478
|
+
let e = this.canvas.getContainer(), t = e.querySelector(".djs-context-pad.open");
|
|
1479
|
+
if (!t) return;
|
|
1480
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = r.right - (n.right - 4);
|
|
1481
|
+
i > 0 && (t.style.left = `${parseFloat(t.style.left || "0") - i}px`);
|
|
1482
|
+
let a = n.left + 4 - r.left;
|
|
1483
|
+
a > 0 && (t.style.left = `${parseFloat(t.style.left || "0") + a}px`);
|
|
1484
|
+
let o = 0, s = r.bottom - (n.bottom - 4);
|
|
1485
|
+
s > 0 && (o = -s);
|
|
1486
|
+
let c = n.top + 4 - (r.top + o);
|
|
1487
|
+
c > 0 && (o += c), o !== 0 && (t.style.top = `${parseFloat(t.style.top || "0") + o}px`);
|
|
1488
|
+
}, "cmContextPad#clampIntoView");
|
|
1489
|
+
}
|
|
1490
|
+
getContextPadEntries(e) {
|
|
1491
|
+
return this.readOnly.isReadOnly() ? {} : T(e) ? this.contextEntries(e) : E(e) ? this.relationshipEntries(e) : {};
|
|
1492
|
+
}
|
|
1493
|
+
getMultiElementContextPadEntries(e) {
|
|
1494
|
+
if (this.readOnly.isReadOnly()) return {};
|
|
1495
|
+
let t = e.filter(w);
|
|
1496
|
+
return t.length === e.length ? { delete: this.deleteEntry(t, "Delete selection") } : {};
|
|
1497
|
+
}
|
|
1498
|
+
contextEntries(e) {
|
|
1499
|
+
let t = e.subdomainType ? p[e.subdomainType] : void 0;
|
|
1500
|
+
return {
|
|
1501
|
+
"append-context": {
|
|
1502
|
+
group: "edit",
|
|
1503
|
+
html: q(U("square-plus"), "Append a connected context — click to place automatically, drag to position", { draggable: !0 }),
|
|
1504
|
+
action: {
|
|
1505
|
+
click: () => this.appendContext(e),
|
|
1506
|
+
dragstart: (t) => this.startAppend(t, e)
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
connect: {
|
|
1510
|
+
group: "edit",
|
|
1511
|
+
html: q(U("arrow-right"), "Connect to another context", { draggable: !0 }),
|
|
1512
|
+
action: {
|
|
1513
|
+
click: (t) => this.startConnect(t, e, !0),
|
|
1514
|
+
dragstart: (t) => this.startConnect(t, e, !1)
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
"subdomain-type": {
|
|
1518
|
+
group: "edit",
|
|
1519
|
+
html: q(B(e.subdomainType), `Change subdomain type — currently ${t?.label ?? "unclassified"}`),
|
|
1520
|
+
action: { click: (t) => this.openMenu(t, e, sn, "Subdomain type") }
|
|
1521
|
+
},
|
|
1522
|
+
team: {
|
|
1523
|
+
group: "edit",
|
|
1524
|
+
html: q(U("users"), `Set owning team — currently ${e.team ?? "none"}`),
|
|
1525
|
+
action: { click: () => this.labelEditing.activateTeam(e) }
|
|
1526
|
+
},
|
|
1527
|
+
"edit-label": this.editLabelEntry(e, "Rename context"),
|
|
1528
|
+
description: this.descriptionEntry(e, "Purpose, ubiquitous language, notes…"),
|
|
1529
|
+
delete: this.deleteEntry([e], "Delete context")
|
|
1530
|
+
};
|
|
986
1531
|
}
|
|
987
|
-
|
|
988
|
-
this.
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
1008
|
-
this.selection.get().length === 0 && this.selection.select(t);
|
|
1009
|
-
}));
|
|
1010
|
-
}), this.overlays.add(t, Xe, {
|
|
1011
|
-
position: et(e, n),
|
|
1012
|
-
html: i
|
|
1532
|
+
startConnect(e, t, n) {
|
|
1533
|
+
if (this.dragging.init(e, "connect", {
|
|
1534
|
+
autoActivate: n,
|
|
1535
|
+
trapClick: !1,
|
|
1536
|
+
data: {
|
|
1537
|
+
shape: t,
|
|
1538
|
+
context: {
|
|
1539
|
+
start: t,
|
|
1540
|
+
connectionStart: _(t)
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}), n) {
|
|
1544
|
+
let e = () => !1;
|
|
1545
|
+
this.eventBus.once("connect.cleanup", 250, () => {
|
|
1546
|
+
this.eventBus.once("element.click", 1e4, e);
|
|
1547
|
+
let t = () => this.eventBus.off("element.click", e);
|
|
1548
|
+
document.addEventListener("mouseup", () => setTimeout(t, 0), {
|
|
1549
|
+
capture: !0,
|
|
1550
|
+
once: !0
|
|
1551
|
+
}), setTimeout(t, 400);
|
|
1013
1552
|
});
|
|
1014
1553
|
}
|
|
1554
|
+
this.eventBus.once("connect.cleanup", 250, () => {
|
|
1555
|
+
this.selection.get().length === 0 && this.selection.select(t);
|
|
1556
|
+
});
|
|
1015
1557
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1558
|
+
appendContext(e) {
|
|
1559
|
+
let t = this.elementFactory.createNewContext(), n = this.rules.allowed("connection.create", {
|
|
1560
|
+
source: e,
|
|
1561
|
+
target: t
|
|
1562
|
+
}), r = this.autoPlace.append(e, t, n && typeof n == "object" ? { connection: n } : {});
|
|
1563
|
+
this.openTypeMenu(r);
|
|
1564
|
+
}
|
|
1565
|
+
startAppend(e, t) {
|
|
1566
|
+
let n = this.elementFactory.createNewContext(), r = () => this.openTypeMenu(n);
|
|
1567
|
+
this.eventBus.once("create.end", 250, r), this.eventBus.once("create.cleanup", () => this.eventBus.off("create.end", r)), this.create.start(e, n, { source: t });
|
|
1568
|
+
}
|
|
1569
|
+
openTypeMenu(e) {
|
|
1570
|
+
this.scheduler.schedule(() => {
|
|
1571
|
+
if (!this.contextPad.isOpen(e)) return;
|
|
1572
|
+
let t = this.canvas.getContainer().querySelector(".djs-context-pad.open [data-action=\"subdomain-type\"]");
|
|
1573
|
+
t && this.openMenuBeside(t.getBoundingClientRect(), e, sn, "Subdomain type");
|
|
1574
|
+
}, "cmContextPad#openTypeMenu");
|
|
1575
|
+
}
|
|
1576
|
+
relationshipEntries(e) {
|
|
1577
|
+
let t = f[e.pattern], n = { pattern: {
|
|
1578
|
+
group: "edit",
|
|
1579
|
+
html: q(H(t?.pattern), `Change pattern — currently ${t?.label ?? e.pattern}`),
|
|
1580
|
+
action: { click: (t) => this.openMenu(t, e, cn, "Relationship pattern") }
|
|
1581
|
+
} };
|
|
1582
|
+
return t && !t.symmetric && (n.roles = {
|
|
1583
|
+
group: "edit",
|
|
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") }
|
|
1586
|
+
}, n["swap-ends"] = {
|
|
1587
|
+
group: "edit",
|
|
1588
|
+
html: q(U("arrow-left-right"), "Swap ends — reverse upstream/downstream"),
|
|
1589
|
+
action: { click: () => this.cmModeling.swapEnds(e) }
|
|
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;
|
|
1591
|
+
}
|
|
1592
|
+
editLabelEntry(e, t) {
|
|
1593
|
+
return {
|
|
1594
|
+
group: "edit",
|
|
1595
|
+
html: q(U("pencil"), `${t} — edit the name in place`),
|
|
1596
|
+
action: { click: () => this.labelEditing.activate(e) }
|
|
1597
|
+
};
|
|
1041
1598
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
e.key === "Enter" ? (e.preventDefault(), d()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1054
|
-
}, p = () => d();
|
|
1055
|
-
c.addEventListener("keydown", f), c.addEventListener("blur", p), this.active = {
|
|
1056
|
-
commit: d,
|
|
1057
|
-
cleanup: u
|
|
1599
|
+
descriptionEntry(e, t) {
|
|
1600
|
+
return {
|
|
1601
|
+
group: "edit",
|
|
1602
|
+
html: q(U("text-align-start"), "Edit description"),
|
|
1603
|
+
action: { click: (n) => this.openPrompt(n, {
|
|
1604
|
+
value: e.description ?? "",
|
|
1605
|
+
placeholder: t,
|
|
1606
|
+
label: "Description",
|
|
1607
|
+
multiline: !0,
|
|
1608
|
+
onCommit: (t) => this.cmModeling.setDescription(e, t || void 0)
|
|
1609
|
+
}) }
|
|
1058
1610
|
};
|
|
1059
1611
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1612
|
+
activePrompt;
|
|
1613
|
+
cancelPrompt() {
|
|
1614
|
+
this.activePrompt?.cancel();
|
|
1615
|
+
}
|
|
1616
|
+
openPrompt(e, t) {
|
|
1617
|
+
this.activePrompt?.cancel();
|
|
1618
|
+
let n = (e.delegateTarget ?? e.target).getBoundingClientRect(), r = document.createElement("div");
|
|
1619
|
+
r.className = "cm-pad-prompt", r.style.left = `${n.right + K}px`, r.style.top = `${n.top}px`;
|
|
1620
|
+
let i = document.createElement(t.multiline ? "textarea" : "input");
|
|
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) {
|
|
1622
|
+
let e = document.createElement("div");
|
|
1623
|
+
e.className = "cm-pad-prompt__hint", e.textContent = "Esc to cancel · ⌘/Ctrl+Enter to save", r.appendChild(e);
|
|
1624
|
+
}
|
|
1625
|
+
this.canvas.getContainer().appendChild(r);
|
|
1626
|
+
let a = r.getBoundingClientRect();
|
|
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();
|
|
1628
|
+
let o = () => l();
|
|
1629
|
+
this.eventBus.on("canvas.viewbox.changing", o);
|
|
1630
|
+
let s = !1, c = () => {
|
|
1631
|
+
s || (s = !0, this.eventBus.off("canvas.viewbox.changing", o), r.remove(), this.activePrompt = void 0, this.canvas.restoreFocus?.());
|
|
1632
|
+
}, l = () => {
|
|
1633
|
+
if (s) return;
|
|
1634
|
+
let e = i.value.trim(), n = e !== t.value.trim();
|
|
1635
|
+
c(), n && t.onCommit(e);
|
|
1636
|
+
};
|
|
1637
|
+
i.addEventListener("keydown", (e) => {
|
|
1638
|
+
let n = e;
|
|
1639
|
+
n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), c()) : n.key === "Enter" && (!t.multiline || n.ctrlKey || n.metaKey) && (n.preventDefault(), l());
|
|
1640
|
+
}), i.addEventListener("blur", l), this.activePrompt = { cancel: c };
|
|
1062
1641
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1642
|
+
deleteEntry(e, t) {
|
|
1643
|
+
return {
|
|
1644
|
+
group: "delete",
|
|
1645
|
+
html: q(U("trash"), t, { danger: !0 }),
|
|
1646
|
+
action: { click: () => this.modeling.removeElements(e) }
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
openMenu(e, t, n, r) {
|
|
1650
|
+
let i = e.delegateTarget ?? e.target;
|
|
1651
|
+
this.openMenuBeside(i.getBoundingClientRect(), t, n, r);
|
|
1652
|
+
}
|
|
1653
|
+
openMenuBeside(e, t, n, r) {
|
|
1654
|
+
let i = {
|
|
1655
|
+
x: e.right + K,
|
|
1656
|
+
y: e.top
|
|
1657
|
+
};
|
|
1658
|
+
this.popupMenu.open(t, n, i, { title: r });
|
|
1659
|
+
let a = document.querySelector(".djs-popup"), o = a?.getBoundingClientRect();
|
|
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 = {
|
|
1661
|
+
element: t,
|
|
1662
|
+
menuId: n,
|
|
1663
|
+
title: r,
|
|
1664
|
+
position: i
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
reopenMenu(e, t) {
|
|
1668
|
+
let n = this.currentMenu;
|
|
1669
|
+
n && n.menuId === t && n.element === e && this.popupMenu.open(e, t, n.position, { title: n.title });
|
|
1670
|
+
}
|
|
1671
|
+
subdomainMenuEntries(e) {
|
|
1672
|
+
if (!T(e)) return {};
|
|
1673
|
+
let t = e.subdomainType, r = {};
|
|
1674
|
+
for (let i of n) r[`type-${i.type}`] = {
|
|
1675
|
+
label: i.label,
|
|
1676
|
+
description: i.description,
|
|
1677
|
+
imageHtml: B(i.type),
|
|
1678
|
+
...i.type === t ? { className: G } : {},
|
|
1679
|
+
action: () => {
|
|
1680
|
+
i.type !== t && this.cmModeling.setSubdomainType(e, i.type);
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
return r["type-none"] = {
|
|
1684
|
+
label: "Unclassified",
|
|
1685
|
+
description: "No subdomain classification.",
|
|
1686
|
+
imageHtml: B(),
|
|
1687
|
+
...t === void 0 ? { className: G } : {},
|
|
1688
|
+
action: () => {
|
|
1689
|
+
t !== void 0 && this.cmModeling.setSubdomainType(e, void 0);
|
|
1690
|
+
}
|
|
1691
|
+
}, r;
|
|
1692
|
+
}
|
|
1693
|
+
patternMenuEntries(e) {
|
|
1694
|
+
if (!E(e)) return {};
|
|
1695
|
+
let n = e.pattern, r = {};
|
|
1696
|
+
for (let i of t) r[`pattern-${i.pattern}`] = {
|
|
1697
|
+
label: i.label,
|
|
1698
|
+
description: i.description,
|
|
1699
|
+
imageHtml: H(i.pattern),
|
|
1700
|
+
...i.pattern === n ? { className: G } : {},
|
|
1701
|
+
action: () => {
|
|
1702
|
+
i.pattern !== n && this.cmModeling.setPattern(e, i.pattern);
|
|
1703
|
+
}
|
|
1704
|
+
};
|
|
1705
|
+
return r;
|
|
1706
|
+
}
|
|
1707
|
+
rolesMenuEntries(e) {
|
|
1708
|
+
if (!E(e)) return {};
|
|
1709
|
+
let t = f[e.pattern];
|
|
1710
|
+
if (!t || t.symmetric) return {};
|
|
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,
|
|
1717
|
+
imageHtml: V(t),
|
|
1718
|
+
group: {
|
|
1719
|
+
id: "upstream",
|
|
1720
|
+
name: "Upstream (from) — OHS and/or PL"
|
|
1721
|
+
},
|
|
1722
|
+
...s ? { disabled: !0 } : {},
|
|
1723
|
+
...i ? { className: G } : {},
|
|
1724
|
+
action: () => {
|
|
1725
|
+
s || (this.cmModeling.setUpstreamRoles(e, i ? r.filter((e) => e !== t) : [...r, t]), this.reopenMenu(e, W));
|
|
1726
|
+
}
|
|
1072
1727
|
};
|
|
1073
1728
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
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,
|
|
1734
|
+
imageHtml: V(t),
|
|
1735
|
+
group: {
|
|
1736
|
+
id: "downstream",
|
|
1737
|
+
name: "Downstream (to) — ACL or CF, not both"
|
|
1738
|
+
},
|
|
1739
|
+
...s ? { disabled: !0 } : {},
|
|
1740
|
+
...r ? { className: G } : {},
|
|
1741
|
+
action: () => {
|
|
1742
|
+
s || (this.cmModeling.setDownstreamRoles(e, r ? [] : [t]), this.reopenMenu(e, W));
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
return a;
|
|
1081
1747
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1748
|
+
}, fn = {
|
|
1749
|
+
__depends__: [
|
|
1750
|
+
we,
|
|
1751
|
+
Te,
|
|
1752
|
+
C,
|
|
1753
|
+
xe,
|
|
1754
|
+
Ee,
|
|
1755
|
+
x,
|
|
1756
|
+
S,
|
|
1757
|
+
F,
|
|
1758
|
+
I,
|
|
1759
|
+
z,
|
|
1760
|
+
R
|
|
1761
|
+
],
|
|
1762
|
+
__init__: ["cmContextPadProvider"],
|
|
1763
|
+
cmContextPadProvider: ["type", dn]
|
|
1093
1764
|
};
|
|
1094
1765
|
//#endregion
|
|
1095
1766
|
//#region src/keyboard/CmKeyboard.ts
|
|
1096
|
-
function
|
|
1767
|
+
function pn(e) {
|
|
1097
1768
|
let t = e;
|
|
1098
1769
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
1099
1770
|
}
|
|
1100
|
-
|
|
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 {
|
|
1101
1777
|
static $inject = [
|
|
1778
|
+
"config.cmKeyboard",
|
|
1102
1779
|
"canvas",
|
|
1103
1780
|
"commandStack",
|
|
1104
1781
|
"selection",
|
|
1105
|
-
"modeling"
|
|
1782
|
+
"modeling",
|
|
1783
|
+
"elementRegistry",
|
|
1784
|
+
"eventBus",
|
|
1785
|
+
"cmReadOnly"
|
|
1106
1786
|
];
|
|
1107
|
-
constructor(e, t, n, r) {
|
|
1108
|
-
|
|
1109
|
-
if (
|
|
1110
|
-
let
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
let t = n.get();
|
|
1115
|
-
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;
|
|
1116
1794
|
}
|
|
1117
|
-
|
|
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));
|
|
1118
1806
|
}
|
|
1119
|
-
},
|
|
1807
|
+
}, gn = {
|
|
1808
|
+
__depends__: [R],
|
|
1120
1809
|
__init__: ["cmKeyboard"],
|
|
1121
|
-
cmKeyboard: ["type",
|
|
1122
|
-
},
|
|
1123
|
-
function
|
|
1124
|
-
let t = e.some((e) => e.kind === "error")
|
|
1125
|
-
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");
|
|
1126
1815
|
let r = document.createElement("div");
|
|
1127
1816
|
r.className = "cm-validation-tooltip";
|
|
1128
1817
|
for (let t of e) {
|
|
@@ -1131,13 +1820,13 @@ function pt(e) {
|
|
|
1131
1820
|
}
|
|
1132
1821
|
return n.appendChild(r), n;
|
|
1133
1822
|
}
|
|
1134
|
-
function
|
|
1823
|
+
function xn(e, t, n) {
|
|
1135
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;
|
|
1136
1825
|
if (n === "middle") return {
|
|
1137
|
-
x: (r.x + i.x) / 2 + -l *
|
|
1138
|
-
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
|
|
1139
1828
|
};
|
|
1140
|
-
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 ?? []);
|
|
1141
1830
|
if (d) {
|
|
1142
1831
|
let e = {
|
|
1143
1832
|
x: d.box.x + d.box.width,
|
|
@@ -1148,16 +1837,16 @@ function mt(e, t, n) {
|
|
|
1148
1837
|
y: e.y + 1
|
|
1149
1838
|
};
|
|
1150
1839
|
}
|
|
1151
|
-
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;
|
|
1152
1841
|
return {
|
|
1153
|
-
x: p + -l *
|
|
1154
|
-
y: m + c *
|
|
1842
|
+
x: p + -l * J,
|
|
1843
|
+
y: m + c * J
|
|
1155
1844
|
};
|
|
1156
1845
|
}
|
|
1157
1846
|
//#endregion
|
|
1158
1847
|
//#region src/validation/index.ts
|
|
1159
|
-
var
|
|
1160
|
-
__depends__: [
|
|
1848
|
+
var Sn = {
|
|
1849
|
+
__depends__: [Ae],
|
|
1161
1850
|
__init__: ["cmValidationMarkers"],
|
|
1162
1851
|
cmValidationMarkers: ["type", class {
|
|
1163
1852
|
elementRegistry;
|
|
@@ -1175,8 +1864,8 @@ var ht = {
|
|
|
1175
1864
|
e.on("import.render.done", i), e.on("commandStack.changed", i);
|
|
1176
1865
|
}
|
|
1177
1866
|
refresh() {
|
|
1178
|
-
this.overlays.remove({ type:
|
|
1179
|
-
let e =
|
|
1867
|
+
this.overlays.remove({ type: _n });
|
|
1868
|
+
let e = ae(this.exporter.export()), t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
1180
1869
|
for (let r of e) {
|
|
1181
1870
|
if (!r.relationshipId) continue;
|
|
1182
1871
|
let e = `${r.relationshipId} ${r.side ?? "middle"}`, i = t.get(e) ?? {
|
|
@@ -1192,16 +1881,16 @@ var ht = {
|
|
|
1192
1881
|
n(e.errors, "error"), n(e.warnings, "warning");
|
|
1193
1882
|
for (let [e, n] of t) {
|
|
1194
1883
|
let t = this.elementRegistry.get(n.relationshipId);
|
|
1195
|
-
if (!
|
|
1884
|
+
if (!E(t)) continue;
|
|
1196
1885
|
let r = t.waypoints ?? [];
|
|
1197
1886
|
if (r.length < 2) continue;
|
|
1198
|
-
let i = e.split(" ")[1], { x: a, y: o } =
|
|
1199
|
-
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, {
|
|
1200
1889
|
position: {
|
|
1201
|
-
left: a - s -
|
|
1202
|
-
top: o - c -
|
|
1890
|
+
left: a - s - vn / 2,
|
|
1891
|
+
top: o - c - vn / 2
|
|
1203
1892
|
},
|
|
1204
|
-
html:
|
|
1893
|
+
html: bn(n.findings)
|
|
1205
1894
|
});
|
|
1206
1895
|
}
|
|
1207
1896
|
}
|
|
@@ -1209,10 +1898,10 @@ var ht = {
|
|
|
1209
1898
|
};
|
|
1210
1899
|
//#endregion
|
|
1211
1900
|
//#region src/zorder/CmZOrder.ts
|
|
1212
|
-
function
|
|
1213
|
-
return +!
|
|
1901
|
+
function Cn(e) {
|
|
1902
|
+
return +!E(e);
|
|
1214
1903
|
}
|
|
1215
|
-
var
|
|
1904
|
+
var wn = class {
|
|
1216
1905
|
canvas;
|
|
1217
1906
|
elementRegistry;
|
|
1218
1907
|
static $inject = [
|
|
@@ -1231,33 +1920,33 @@ var _t = class {
|
|
|
1231
1920
|
});
|
|
1232
1921
|
}
|
|
1233
1922
|
reorder() {
|
|
1234
|
-
let e = this.elementRegistry.getAll().filter(
|
|
1923
|
+
let e = this.elementRegistry.getAll().filter(w).sort((e, t) => Cn(e) - Cn(t));
|
|
1235
1924
|
for (let t of e) {
|
|
1236
1925
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
1237
1926
|
e && n && n.appendChild(e);
|
|
1238
1927
|
}
|
|
1239
1928
|
}
|
|
1240
|
-
},
|
|
1929
|
+
}, Tn = {
|
|
1241
1930
|
__init__: ["cmZOrder"],
|
|
1242
|
-
cmZOrder: ["type",
|
|
1243
|
-
},
|
|
1931
|
+
cmZOrder: ["type", wn]
|
|
1932
|
+
}, En = class extends P {
|
|
1244
1933
|
_getModules() {
|
|
1245
1934
|
return [
|
|
1246
1935
|
...super._getModules(),
|
|
1247
|
-
|
|
1936
|
+
pe,
|
|
1248
1937
|
S,
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1938
|
+
me,
|
|
1939
|
+
he,
|
|
1940
|
+
R,
|
|
1941
|
+
F,
|
|
1942
|
+
I,
|
|
1943
|
+
Ft,
|
|
1944
|
+
on,
|
|
1945
|
+
fn,
|
|
1946
|
+
z,
|
|
1947
|
+
gn,
|
|
1948
|
+
Sn,
|
|
1949
|
+
Tn
|
|
1261
1950
|
];
|
|
1262
1951
|
}
|
|
1263
1952
|
undo() {
|
|
@@ -1272,8 +1961,618 @@ var _t = class {
|
|
|
1272
1961
|
canRedo() {
|
|
1273
1962
|
return this.get("commandStack").canRedo();
|
|
1274
1963
|
}
|
|
1275
|
-
};
|
|
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 = [
|
|
2076
|
+
{
|
|
2077
|
+
side: "top",
|
|
2078
|
+
rotationDeg: -90
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
side: "right",
|
|
2082
|
+
rotationDeg: 0
|
|
2083
|
+
},
|
|
2084
|
+
{
|
|
2085
|
+
side: "bottom",
|
|
2086
|
+
rotationDeg: 90
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
side: "left",
|
|
2090
|
+
rotationDeg: 180
|
|
2091
|
+
}
|
|
2092
|
+
];
|
|
2093
|
+
function zn(e, t) {
|
|
2094
|
+
let n = t.width / 2 - In / 2, r = t.height / 2 - In / 2;
|
|
2095
|
+
switch (e) {
|
|
2096
|
+
case "top": return {
|
|
2097
|
+
top: -40,
|
|
2098
|
+
left: n
|
|
2099
|
+
};
|
|
2100
|
+
case "bottom": return {
|
|
2101
|
+
top: t.height + Ln,
|
|
2102
|
+
left: n
|
|
2103
|
+
};
|
|
2104
|
+
case "left": return {
|
|
2105
|
+
top: r,
|
|
2106
|
+
left: -40
|
|
2107
|
+
};
|
|
2108
|
+
case "right": return {
|
|
2109
|
+
top: r,
|
|
2110
|
+
left: t.width + Ln
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
var Bn = class {
|
|
2115
|
+
eventBus;
|
|
2116
|
+
selection;
|
|
2117
|
+
overlays;
|
|
2118
|
+
dragging;
|
|
2119
|
+
readOnly;
|
|
2120
|
+
static $inject = [
|
|
2121
|
+
"eventBus",
|
|
2122
|
+
"selection",
|
|
2123
|
+
"overlays",
|
|
2124
|
+
"connect",
|
|
2125
|
+
"dragging",
|
|
2126
|
+
"cmReadOnly"
|
|
2127
|
+
];
|
|
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);
|
|
2132
|
+
}
|
|
2133
|
+
refresh() {
|
|
2134
|
+
if (this.overlays.remove({ type: Fn }), this.readOnly.isReadOnly()) return;
|
|
2135
|
+
let e = this.selection.get();
|
|
2136
|
+
if (e.length !== 1) return;
|
|
2137
|
+
let t = e[0];
|
|
2138
|
+
if (!T(t)) return;
|
|
2139
|
+
let n = t;
|
|
2140
|
+
for (let { side: e, rotationDeg: r } of Rn) {
|
|
2141
|
+
let i = document.createElement("div");
|
|
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) => {
|
|
2145
|
+
e.button === 0 && (e.preventDefault(), e.stopPropagation(), this.dragging.init(e, "connect", {
|
|
2146
|
+
autoActivate: !1,
|
|
2147
|
+
trapClick: !1,
|
|
2148
|
+
data: {
|
|
2149
|
+
shape: t,
|
|
2150
|
+
context: {
|
|
2151
|
+
start: t,
|
|
2152
|
+
connectionStart: _(t)
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
}), this.eventBus.once("connect.cleanup", 250, () => {
|
|
2156
|
+
this.selection.get().length === 0 && this.selection.select(t);
|
|
2157
|
+
}));
|
|
2158
|
+
}), this.overlays.add(t, Fn, {
|
|
2159
|
+
position: zn(e, n),
|
|
2160
|
+
html: i
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
}, Vn = {
|
|
2165
|
+
__depends__: [
|
|
2166
|
+
C,
|
|
2167
|
+
Ae,
|
|
2168
|
+
x,
|
|
2169
|
+
R
|
|
2170
|
+
],
|
|
2171
|
+
__init__: ["cmConnectHandles"],
|
|
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
|
+
}
|
|
1276
2575
|
//#endregion
|
|
1277
|
-
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 };
|
|
1278
2577
|
|
|
1279
2578
|
//# sourceMappingURL=index.js.map
|