@miragon/event-storming-renderer 0.2.2 → 0.4.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 +160 -0
- package/dist/EventStormingBaseViewer.d.ts +25 -3
- package/dist/EventStormingBaseViewer.d.ts.map +1 -1
- package/dist/Modeler.d.ts +1 -1
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/board-bounds/BoardBounds.d.ts +3 -0
- package/dist/board-bounds/BoardBounds.d.ts.map +1 -1
- package/dist/board-menu/ShortcutsDialog.d.ts +27 -0
- package/dist/board-menu/ShortcutsDialog.d.ts.map +1 -0
- package/dist/board-menu/index.d.ts +7 -0
- package/dist/board-menu/index.d.ts.map +1 -0
- package/dist/board-menu/menu.d.ts +85 -0
- package/dist/board-menu/menu.d.ts.map +1 -0
- package/dist/board-menu/shortcuts.d.ts +43 -0
- package/dist/board-menu/shortcuts.d.ts.map +1 -0
- package/dist/collaborative/CollaborativeEventStorming.d.ts +33 -0
- package/dist/collaborative/CollaborativeEventStorming.d.ts.map +1 -0
- package/dist/collaborative/index.d.ts +2 -0
- package/dist/collaborative/index.d.ts.map +1 -0
- package/dist/context-pad/EventStormingContextPadProvider.d.ts +4 -1
- package/dist/context-pad/EventStormingContextPadProvider.d.ts.map +1 -1
- package/dist/draw/EventStormingRenderer.d.ts.map +1 -1
- package/dist/draw/icons.d.ts +20 -19
- package/dist/draw/icons.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +31 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +10 -9
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/draw-tool/EventStormingDrawTool.d.ts.map +1 -1
- package/dist/draw-tool/EventStormingDrawingHandles.d.ts +3 -1
- package/dist/draw-tool/EventStormingDrawingHandles.d.ts.map +1 -1
- package/dist/event-storming.css +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1517 -873
- package/dist/index.js.map +1 -1
- package/dist/io/EventStormingExporter.d.ts +1 -3
- package/dist/io/EventStormingExporter.d.ts.map +1 -1
- package/dist/io/EventStormingImporter.d.ts +19 -1
- package/dist/io/EventStormingImporter.d.ts.map +1 -1
- package/dist/io/index.d.ts +1 -0
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/io/types.d.ts +5 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/io/warnings.d.ts +7 -0
- package/dist/io/warnings.d.ts.map +1 -0
- package/dist/keyboard/EventStormingKeyboard.d.ts +14 -4
- package/dist/keyboard/EventStormingKeyboard.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/EventStormingLabelEditing.d.ts +27 -1
- package/dist/label-editing/EventStormingLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/note-editor-dom.d.ts.map +1 -1
- package/dist/model/EventStormingElementFactory.d.ts +5 -3
- package/dist/model/EventStormingElementFactory.d.ts.map +1 -1
- package/dist/model/random-id.d.ts +5 -0
- package/dist/model/random-id.d.ts.map +1 -0
- package/dist/palette/EventStormingPaletteProvider.d.ts +39 -1
- package/dist/palette/EventStormingPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +1 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/read-only/EventStormingReadOnly.d.ts +20 -0
- package/dist/read-only/EventStormingReadOnly.d.ts.map +1 -0
- package/dist/read-only/index.d.ts +5 -0
- package/dist/read-only/index.d.ts.map +1 -0
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +27 -31
- package/dist/theme/palette.d.ts.map +1 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -7,31 +7,40 @@ import { append as f, attr as p, create as m, remove as h } from "tiny-svg";
|
|
|
7
7
|
import g from "diagram-js/lib/features/selection";
|
|
8
8
|
import _ from "diagram-js/lib/navigation/zoomscroll";
|
|
9
9
|
import v from "diagram-js/lib/navigation/movecanvas";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { html as
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
10
|
+
import ee from "diagram-js/lib/features/keyboard";
|
|
11
|
+
import te from "diagram-js/lib/features/modeling";
|
|
12
|
+
import ne from "diagram-js/lib/features/move";
|
|
13
|
+
import re from "diagram-js/lib/features/create";
|
|
14
|
+
import ie from "diagram-js/lib/features/connect";
|
|
15
|
+
import ae from "diagram-js/lib/features/context-pad";
|
|
16
|
+
import oe from "diagram-js/lib/features/palette";
|
|
17
|
+
import se from "diagram-js/lib/features/rules";
|
|
18
|
+
import ce from "diagram-js/lib/features/outline";
|
|
19
|
+
import le from "diagram-js/lib/features/popup-menu";
|
|
20
|
+
import ue from "diagram-js/lib/features/attach-support";
|
|
21
|
+
import de from "diagram-js/lib/command/CommandInterceptor";
|
|
22
|
+
import fe from "diagram-js/lib/features/mouse";
|
|
23
|
+
import pe from "diagram-js/lib/features/lasso-tool";
|
|
24
|
+
import me from "diagram-js/lib/features/rules/RuleProvider";
|
|
25
|
+
import he from "diagram-js/lib/features/palette/PaletteTooltipComponent";
|
|
26
|
+
import { html as ge } from "diagram-js/lib/ui";
|
|
27
|
+
import _e from "diagram-js/lib/features/connection-preview";
|
|
28
|
+
import ve from "diagram-js/lib/features/ordering/OrderingProvider";
|
|
29
|
+
import ye from "diagram-js/lib/features/resize";
|
|
30
|
+
import { MODELER_API_VERSION as be } from "@miragon/modeler-api";
|
|
30
31
|
//#region src/io/saveSvg.ts
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
var xe = [
|
|
33
|
+
"tabindex",
|
|
34
|
+
"role",
|
|
35
|
+
"aria-label",
|
|
36
|
+
"aria-labelledby"
|
|
37
|
+
];
|
|
38
|
+
function Se(e, t) {
|
|
39
|
+
let n = e.getContainer().querySelector(":scope > svg");
|
|
33
40
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
34
|
-
let r = n.cloneNode(!0)
|
|
41
|
+
let r = n.cloneNode(!0);
|
|
42
|
+
for (let e of xe) r.removeAttribute(e);
|
|
43
|
+
let i = t ?? {
|
|
35
44
|
x: 0,
|
|
36
45
|
y: 0,
|
|
37
46
|
...o
|
|
@@ -41,87 +50,54 @@ function _e(e, t) {
|
|
|
41
50
|
return a && a.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(r) };
|
|
42
51
|
}
|
|
43
52
|
//#endregion
|
|
44
|
-
//#region src/
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
//#region src/model/di-types.ts
|
|
54
|
+
var y = "event-storming-root";
|
|
55
|
+
function Ce(e) {
|
|
56
|
+
return typeof e == "object" && !!e;
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
n.fire("import.parse.start", { text: e });
|
|
92
|
-
let { board: r, diagnostics: i } = t(e);
|
|
93
|
-
n.fire("import.parse.done", {
|
|
94
|
-
board: r,
|
|
95
|
-
diagnostics: i
|
|
96
|
-
});
|
|
97
|
-
let { warnings: a } = await this.importMap(r);
|
|
98
|
-
return { warnings: [...i.map((e) => ({ message: `Line ${e.line}: ${e.message} — "${e.text}"` })), ...a] };
|
|
99
|
-
}
|
|
100
|
-
exportMap() {
|
|
101
|
-
return this.get("eventStormingExporter").export();
|
|
102
|
-
}
|
|
103
|
-
exportDSL() {
|
|
104
|
-
return n(this.exportMap());
|
|
105
|
-
}
|
|
106
|
-
async saveSVG() {
|
|
107
|
-
return _e(this.get("canvas"), this.get("boardBounds").contentBounds());
|
|
108
|
-
}
|
|
109
|
-
attachTo(e) {
|
|
110
|
-
e.appendChild(this._container), this.get("canvas").resized();
|
|
111
|
-
}
|
|
112
|
-
detach() {
|
|
113
|
-
this._container.remove();
|
|
114
|
-
}
|
|
115
|
-
clear() {
|
|
116
|
-
this._ensureDiagram().clear();
|
|
117
|
-
}
|
|
118
|
-
destroy() {
|
|
119
|
-
this._diagram &&= (this._diagram.destroy(), void 0), this._container.remove();
|
|
120
|
-
}
|
|
121
|
-
get container() {
|
|
122
|
-
return this._container;
|
|
123
|
-
}
|
|
124
|
-
}, S = {
|
|
58
|
+
function b(e) {
|
|
59
|
+
return Ce(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
|
|
60
|
+
}
|
|
61
|
+
function x(e) {
|
|
62
|
+
return Ce(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
|
|
63
|
+
}
|
|
64
|
+
var S = [
|
|
65
|
+
"event",
|
|
66
|
+
"command",
|
|
67
|
+
"actor",
|
|
68
|
+
"aggregate",
|
|
69
|
+
"policy",
|
|
70
|
+
"readmodel",
|
|
71
|
+
"external",
|
|
72
|
+
"hotspot"
|
|
73
|
+
];
|
|
74
|
+
function C(e) {
|
|
75
|
+
return S.includes(e);
|
|
76
|
+
}
|
|
77
|
+
function w(e) {
|
|
78
|
+
return b(e) && C(e.eventStormingType);
|
|
79
|
+
}
|
|
80
|
+
function we(e) {
|
|
81
|
+
return r.includes(e);
|
|
82
|
+
}
|
|
83
|
+
function Te(e) {
|
|
84
|
+
return s.includes(e);
|
|
85
|
+
}
|
|
86
|
+
function Ee(e) {
|
|
87
|
+
return b(e) && we(e.eventStormingType);
|
|
88
|
+
}
|
|
89
|
+
function De(e) {
|
|
90
|
+
return b(e) && Te(e.eventStormingType);
|
|
91
|
+
}
|
|
92
|
+
function T(e) {
|
|
93
|
+
return b(e) && e.eventStormingType === "drawing";
|
|
94
|
+
}
|
|
95
|
+
function Oe(e) {
|
|
96
|
+
return b(e) && e.eventStormingType === "note";
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/theme/palette.ts
|
|
100
|
+
var E = {
|
|
125
101
|
blau: "#335DE5",
|
|
126
102
|
blauLink: "#2B50D4",
|
|
127
103
|
blauHell: "#6B8AFF",
|
|
@@ -129,17 +105,14 @@ var ye = class {
|
|
|
129
105
|
grau: "#F9F7F7",
|
|
130
106
|
schwarz: "#1D1D1D",
|
|
131
107
|
weiss: "#FFFFFF",
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
108
|
+
linie: "#E6E2E2",
|
|
109
|
+
success: "#00E676",
|
|
110
|
+
warning: "#FFB000",
|
|
111
|
+
danger: "#CD1839",
|
|
112
|
+
info: "#335DE5",
|
|
136
113
|
navy: "#080A20",
|
|
137
114
|
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
138
|
-
}
|
|
139
|
-
S.grau, S.schwarz, S.weiss, S.blau, S.gruen, S.danger, S.schwarz, S.navy, S.grau;
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/draw/note-markdown.ts
|
|
142
|
-
var be = [
|
|
115
|
+
}, ke = [
|
|
143
116
|
{
|
|
144
117
|
marker: "***",
|
|
145
118
|
bold: !0,
|
|
@@ -156,28 +129,28 @@ var be = [
|
|
|
156
129
|
italic: !0
|
|
157
130
|
}
|
|
158
131
|
];
|
|
159
|
-
function
|
|
132
|
+
function D(e) {
|
|
160
133
|
return e.split("\n").map((e) => {
|
|
161
134
|
let t = e.startsWith("- ");
|
|
162
135
|
return {
|
|
163
136
|
bullet: t,
|
|
164
|
-
runs:
|
|
137
|
+
runs: Me(t ? e.slice(2) : e)
|
|
165
138
|
};
|
|
166
139
|
});
|
|
167
140
|
}
|
|
168
|
-
function
|
|
141
|
+
function Ae(e) {
|
|
169
142
|
return e.map((e) => {
|
|
170
|
-
let t =
|
|
143
|
+
let t = Pe(e.runs).map((e) => {
|
|
171
144
|
let t = e.bold && e.italic ? "***" : e.bold ? "**" : e.italic ? "*" : "";
|
|
172
145
|
return t + e.text + t;
|
|
173
146
|
}).join("");
|
|
174
147
|
return (e.bullet ? "- " : "") + t;
|
|
175
148
|
}).join("\n");
|
|
176
149
|
}
|
|
177
|
-
function
|
|
178
|
-
return
|
|
150
|
+
function je(e) {
|
|
151
|
+
return D(e).map((e) => (e.bullet ? "• " : "") + e.runs.map((e) => e.text).join("")).join("\n");
|
|
179
152
|
}
|
|
180
|
-
function
|
|
153
|
+
function Me(e) {
|
|
181
154
|
let t = [], n = "", r = () => {
|
|
182
155
|
n && t.push({
|
|
183
156
|
text: n,
|
|
@@ -186,21 +159,17 @@ function Ce(e) {
|
|
|
186
159
|
}), n = "";
|
|
187
160
|
}, i = 0;
|
|
188
161
|
for (; i < e.length;) {
|
|
189
|
-
let a = e[i] === "*" ?
|
|
190
|
-
|
|
191
|
-
n += e[i], i++;
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
r(), t.push({
|
|
162
|
+
let a = e[i] === "*" ? Ne(e, i) : void 0;
|
|
163
|
+
a ? (r(), t.push({
|
|
195
164
|
text: a.content,
|
|
196
165
|
bold: a.bold,
|
|
197
166
|
italic: a.italic
|
|
198
|
-
}), i = a.end;
|
|
167
|
+
}), i = a.end) : (n += e[i], i++);
|
|
199
168
|
}
|
|
200
|
-
return r(),
|
|
169
|
+
return r(), Pe(t);
|
|
201
170
|
}
|
|
202
|
-
function
|
|
203
|
-
for (let { marker: n, bold: r, italic: i } of
|
|
171
|
+
function Ne(e, t) {
|
|
172
|
+
for (let { marker: n, bold: r, italic: i } of ke) {
|
|
204
173
|
if (!e.startsWith(n, t)) continue;
|
|
205
174
|
let a = e.indexOf(n, t + n.length);
|
|
206
175
|
if (!(a <= t + n.length)) return {
|
|
@@ -211,7 +180,7 @@ function we(e, t) {
|
|
|
211
180
|
};
|
|
212
181
|
}
|
|
213
182
|
}
|
|
214
|
-
function
|
|
183
|
+
function Pe(e) {
|
|
215
184
|
let t = [];
|
|
216
185
|
for (let n of e) {
|
|
217
186
|
if (!n.text) continue;
|
|
@@ -226,7 +195,7 @@ function Te(e) {
|
|
|
226
195
|
}
|
|
227
196
|
//#endregion
|
|
228
197
|
//#region src/draw/styles.ts
|
|
229
|
-
var
|
|
198
|
+
var O = {
|
|
230
199
|
event: {
|
|
231
200
|
label: "Domain Event",
|
|
232
201
|
width: 130,
|
|
@@ -283,89 +252,321 @@ var w = {
|
|
|
283
252
|
fill: "#E85D75",
|
|
284
253
|
stroke: "#C43B55"
|
|
285
254
|
}
|
|
286
|
-
},
|
|
255
|
+
}, k = {
|
|
287
256
|
label: "Note",
|
|
288
257
|
fill: "#ECECEC",
|
|
289
258
|
stroke: "#C4C4C4"
|
|
290
|
-
},
|
|
259
|
+
}, A = {
|
|
291
260
|
width: 60,
|
|
292
261
|
height: 40
|
|
293
|
-
},
|
|
294
|
-
width:
|
|
295
|
-
height:
|
|
262
|
+
}, j = 7.5, Fe = {
|
|
263
|
+
width: O.aggregate.width,
|
|
264
|
+
height: O.aggregate.height
|
|
296
265
|
};
|
|
297
|
-
function
|
|
298
|
-
let t =
|
|
266
|
+
function M(e) {
|
|
267
|
+
let t = je(e), n = (t && t.length ? t : "note").split("\n"), r = Math.max(1, ...n.map((e) => e.length));
|
|
299
268
|
return {
|
|
300
269
|
lines: n,
|
|
301
|
-
width: Math.max(
|
|
302
|
-
height: Math.max(
|
|
270
|
+
width: Math.max(Fe.width, Math.round(r * j) + 16),
|
|
271
|
+
height: Math.max(Fe.height, n.length * 17 + 16)
|
|
303
272
|
};
|
|
304
273
|
}
|
|
305
|
-
function
|
|
306
|
-
let n =
|
|
274
|
+
function N(e, t) {
|
|
275
|
+
let n = M(e);
|
|
307
276
|
return t.width !== n.width || t.height !== n.height;
|
|
308
277
|
}
|
|
309
|
-
var
|
|
310
|
-
paper:
|
|
311
|
-
ink:
|
|
278
|
+
var P = {
|
|
279
|
+
paper: E.grau,
|
|
280
|
+
ink: E.schwarz,
|
|
312
281
|
inkSoft: "#5B5B5B",
|
|
313
|
-
surface:
|
|
314
|
-
stroke:
|
|
282
|
+
surface: E.weiss,
|
|
283
|
+
stroke: E.schwarz,
|
|
315
284
|
arrow: "#9E9E9E",
|
|
316
|
-
accent:
|
|
285
|
+
accent: E.blau,
|
|
317
286
|
accentSoft: "rgba(51,93,229,0.12)",
|
|
318
|
-
stickyText:
|
|
319
|
-
},
|
|
320
|
-
family: "'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
287
|
+
stickyText: E.schwarz
|
|
288
|
+
}, F = E.schwarz, I = {
|
|
289
|
+
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
321
290
|
label: 13
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return Oe(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
|
|
331
|
-
}
|
|
332
|
-
var F = [
|
|
333
|
-
"event",
|
|
334
|
-
"command",
|
|
335
|
-
"actor",
|
|
336
|
-
"aggregate",
|
|
337
|
-
"policy",
|
|
338
|
-
"readmodel",
|
|
339
|
-
"external",
|
|
340
|
-
"hotspot"
|
|
341
|
-
];
|
|
342
|
-
function I(e) {
|
|
343
|
-
return F.includes(e);
|
|
344
|
-
}
|
|
345
|
-
function L(e) {
|
|
346
|
-
return N(e) && I(e.eventStormingType);
|
|
291
|
+
}, Ie = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Le = (e, t, n = 0) => Ie(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), Re = (e) => `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" class="event-storming-palette-svg">${e}</svg>`, L = {
|
|
292
|
+
draw: Re("<circle cx=\"19\" cy=\"5\" r=\"2\"/><circle cx=\"5\" cy=\"19\" r=\"2\"/><path d=\"M6.5 17.5 17.5 6.5\"/>"),
|
|
293
|
+
lasso: Re("<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\"/>"),
|
|
294
|
+
note: Le(k.fill, k.stroke)
|
|
295
|
+
};
|
|
296
|
+
for (let e of S) {
|
|
297
|
+
let t = O[e];
|
|
298
|
+
L[e] = Le(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
|
|
347
299
|
}
|
|
348
|
-
function
|
|
349
|
-
return
|
|
300
|
+
function ze(e, t) {
|
|
301
|
+
return `<svg width="14" height="14" viewBox="0 0 14 14" class="event-storming-palette-svg"><rect x="1" y="1" width="12" height="12" fill="${e}" stroke="${t}" stroke-width="1"/></svg>`;
|
|
350
302
|
}
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/palette/EventStormingPaletteProvider.ts
|
|
351
305
|
function R(e) {
|
|
352
|
-
|
|
306
|
+
if (e.freeArea) return e.freeArea;
|
|
307
|
+
let t = e.freeRectInsets;
|
|
308
|
+
return t ? { insets: t } : void 0;
|
|
353
309
|
}
|
|
354
|
-
|
|
355
|
-
|
|
310
|
+
var Be = 24, z = "stickies-1", B = "stickies-2", Ve = "stickies-3", He = [
|
|
311
|
+
{
|
|
312
|
+
key: "event",
|
|
313
|
+
type: "event",
|
|
314
|
+
label: O.event.label,
|
|
315
|
+
title: "Domain event",
|
|
316
|
+
shortcut: "E",
|
|
317
|
+
group: z
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
key: "command",
|
|
321
|
+
type: "command",
|
|
322
|
+
label: O.command.label,
|
|
323
|
+
title: "Command",
|
|
324
|
+
shortcut: "C",
|
|
325
|
+
group: z
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
key: "actor",
|
|
329
|
+
type: "actor",
|
|
330
|
+
label: O.actor.label,
|
|
331
|
+
title: "Actor",
|
|
332
|
+
group: z
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
key: "aggregate",
|
|
336
|
+
type: "aggregate",
|
|
337
|
+
label: O.aggregate.label,
|
|
338
|
+
title: "Aggregate",
|
|
339
|
+
group: z
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
key: "policy",
|
|
343
|
+
type: "policy",
|
|
344
|
+
label: O.policy.label,
|
|
345
|
+
title: "Policy",
|
|
346
|
+
group: B
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: "readmodel",
|
|
350
|
+
type: "readmodel",
|
|
351
|
+
label: O.readmodel.label,
|
|
352
|
+
title: "Read model",
|
|
353
|
+
group: B
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
key: "external",
|
|
357
|
+
type: "external",
|
|
358
|
+
label: O.external.label,
|
|
359
|
+
title: "External system",
|
|
360
|
+
group: B
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
key: "hotspot",
|
|
364
|
+
type: "hotspot",
|
|
365
|
+
label: O.hotspot.label,
|
|
366
|
+
title: "Hotspot",
|
|
367
|
+
group: Ve
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
key: "note",
|
|
371
|
+
type: "note",
|
|
372
|
+
label: k.label,
|
|
373
|
+
title: "Note",
|
|
374
|
+
group: Ve
|
|
375
|
+
}
|
|
376
|
+
], Ue = class {
|
|
377
|
+
create;
|
|
378
|
+
factory;
|
|
379
|
+
lassoTool;
|
|
380
|
+
drawTool;
|
|
381
|
+
eventStormingModeling;
|
|
382
|
+
canvas;
|
|
383
|
+
modeling;
|
|
384
|
+
selection;
|
|
385
|
+
elementRegistry;
|
|
386
|
+
labelEditing;
|
|
387
|
+
config;
|
|
388
|
+
static $inject = [
|
|
389
|
+
"palette",
|
|
390
|
+
"create",
|
|
391
|
+
"eventStormingElementFactory",
|
|
392
|
+
"lassoTool",
|
|
393
|
+
"eventStormingDrawTool",
|
|
394
|
+
"eventStormingModeling",
|
|
395
|
+
"eventBus",
|
|
396
|
+
"canvas",
|
|
397
|
+
"modeling",
|
|
398
|
+
"selection",
|
|
399
|
+
"elementRegistry",
|
|
400
|
+
"eventStormingLabelEditing",
|
|
401
|
+
"config.eventStormingPalette"
|
|
402
|
+
];
|
|
403
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
404
|
+
this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, this.canvas = s, this.modeling = c, this.selection = l, this.elementRegistry = u, this.labelEditing = d, this.config = f, e.registerProvider(this);
|
|
405
|
+
let p = () => e._rebuild();
|
|
406
|
+
o.on("import.done", p), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
|
|
407
|
+
e.context.element.id === "event-storming-root" && p();
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
getPaletteEntries() {
|
|
411
|
+
let e = {};
|
|
412
|
+
e["lasso-tool"] = {
|
|
413
|
+
group: "tools",
|
|
414
|
+
title: "Lasso",
|
|
415
|
+
shortcut: "L",
|
|
416
|
+
html: `<div class="entry event-storming-palette-entry">${L.lasso}</div>`,
|
|
417
|
+
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
418
|
+
}, e["draw-tool"] = {
|
|
419
|
+
group: "tools",
|
|
420
|
+
title: "Draw",
|
|
421
|
+
html: `<div class="entry event-storming-palette-entry">${L.draw}</div>`,
|
|
422
|
+
action: { click: () => this.drawTool.toggle() }
|
|
423
|
+
};
|
|
424
|
+
let t = c[this.eventStormingModeling.getLevel()];
|
|
425
|
+
for (let n of He) {
|
|
426
|
+
if (n.type !== "note" && !t.includes(n.type)) continue;
|
|
427
|
+
let r = (e) => {
|
|
428
|
+
let t = this.factory.createNew(n.type, n.label);
|
|
429
|
+
We(e) && this.placeInFreeRect(t) || this.create.start(e, t);
|
|
430
|
+
};
|
|
431
|
+
e[`create.${n.key}`] = {
|
|
432
|
+
group: n.group,
|
|
433
|
+
title: n.title,
|
|
434
|
+
...n.shortcut ? { shortcut: n.shortcut } : {},
|
|
435
|
+
html: `<div class="entry event-storming-palette-entry" draggable="true">${L[n.key]}</div>`,
|
|
436
|
+
action: {
|
|
437
|
+
dragstart: r,
|
|
438
|
+
click: r
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
return e;
|
|
443
|
+
}
|
|
444
|
+
placeInFreeRect(e) {
|
|
445
|
+
let { canvas: t, modeling: n, selection: r, elementRegistry: i } = this;
|
|
446
|
+
if (!t || !n || !r || !i) return !1;
|
|
447
|
+
let a = this.freeAreaCentre(t), o = (e) => i.filter(b).some((t) => Math.abs(t.x + t.width / 2 - e.x) < 1 && Math.abs(t.y + t.height / 2 - e.y) < 1);
|
|
448
|
+
for (; o(a);) a.x += Be, a.y += Be;
|
|
449
|
+
let s = n.createShape(e, a, t.getRootElement());
|
|
450
|
+
return r.select(s), t.focus(), this.labelEditing?.activate(s), !0;
|
|
451
|
+
}
|
|
452
|
+
freeAreaCentre(e) {
|
|
453
|
+
let t = this.config && R(this.config), n = t?.center?.();
|
|
454
|
+
if (n) return {
|
|
455
|
+
x: n.x,
|
|
456
|
+
y: n.y
|
|
457
|
+
};
|
|
458
|
+
let r = e.viewbox(), i = t?.insets?.() ?? {
|
|
459
|
+
top: 0,
|
|
460
|
+
right: 0,
|
|
461
|
+
bottom: 0,
|
|
462
|
+
left: 0
|
|
463
|
+
}, a = Math.max(0, r.outer.width - i.left - i.right), o = Math.max(0, r.outer.height - i.top - i.bottom);
|
|
464
|
+
return {
|
|
465
|
+
x: r.x + (i.left + a / 2) / r.scale,
|
|
466
|
+
y: r.y + (i.top + o / 2) / r.scale
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
function We(e) {
|
|
471
|
+
return e.type === "click" && e.detail === 0;
|
|
356
472
|
}
|
|
357
|
-
|
|
358
|
-
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/EventStormingBaseViewer.ts
|
|
475
|
+
function Ge(e) {
|
|
476
|
+
for (let { id: t } of [...e.elements, ...e.edges]) if (t === "event-storming-root" || t.startsWith("__implicitroot")) throw Error(`Element id "${t}" is reserved for the board itself.`);
|
|
359
477
|
}
|
|
360
|
-
function
|
|
361
|
-
return
|
|
478
|
+
function Ke(e) {
|
|
479
|
+
return typeof e == "number" ? `${e}px` : e;
|
|
362
480
|
}
|
|
363
|
-
|
|
364
|
-
|
|
481
|
+
var qe = class {
|
|
482
|
+
_diagram;
|
|
483
|
+
_container;
|
|
484
|
+
_options;
|
|
485
|
+
constructor(e = {}) {
|
|
486
|
+
this._options = e, this._container = this._createContainer(e);
|
|
487
|
+
}
|
|
488
|
+
_createContainer(e) {
|
|
489
|
+
let t = e.container ?? document.createElement("div");
|
|
490
|
+
return t.classList.add("event-storming-container"), t.style.width = Ke(e.width ?? "100%"), t.style.height = Ke(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
491
|
+
}
|
|
492
|
+
_ensureDiagram() {
|
|
493
|
+
if (!this._diagram) {
|
|
494
|
+
let t = [...this._getModules(), ...this._options.additionalModules ?? []];
|
|
495
|
+
this._diagram = new e({
|
|
496
|
+
canvas: { container: this._container },
|
|
497
|
+
modules: t,
|
|
498
|
+
eventStormingKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
|
|
499
|
+
eventStormingPalette: { freeArea: R(this._options) },
|
|
500
|
+
eventStormingImporter: { fitOnImport: this._options.fitOnImport ?? !0 }
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
return this._diagram;
|
|
504
|
+
}
|
|
505
|
+
get(e) {
|
|
506
|
+
return this._ensureDiagram().get(e);
|
|
507
|
+
}
|
|
508
|
+
on(e, t, n = 1e3) {
|
|
509
|
+
this.get("eventBus").on(e, n, t);
|
|
510
|
+
}
|
|
511
|
+
off(e, t) {
|
|
512
|
+
this.get("eventBus").off(e, t);
|
|
513
|
+
}
|
|
514
|
+
async importMap(e) {
|
|
515
|
+
let t = this._ensureDiagram(), n = t.get("eventBus"), r = t.get("eventStormingImporter");
|
|
516
|
+
Ge(e);
|
|
517
|
+
let i = t.get("eventStormingLabelEditing", !1);
|
|
518
|
+
i?.suspend(), t.get("popupMenu", !1)?.close(), r.clear();
|
|
519
|
+
let a = r.import(e);
|
|
520
|
+
return t.get("commandStack", !1)?.clear(!1), n.fire("import.done", { warnings: a }), i?.resumeAfterImport(), { warnings: a };
|
|
521
|
+
}
|
|
522
|
+
async importDSL(e) {
|
|
523
|
+
let n = this._ensureDiagram().get("eventBus");
|
|
524
|
+
n.fire("import.parse.start", { text: e });
|
|
525
|
+
let { board: r, diagnostics: i } = t(e);
|
|
526
|
+
n.fire("import.parse.done", {
|
|
527
|
+
board: r,
|
|
528
|
+
diagnostics: i
|
|
529
|
+
});
|
|
530
|
+
let { warnings: a } = await this.importMap(r);
|
|
531
|
+
return { warnings: [...i.map((e) => ({
|
|
532
|
+
message: `Line ${e.line}: ${e.message}`,
|
|
533
|
+
line: e.line,
|
|
534
|
+
source: e.text
|
|
535
|
+
})), ...a] };
|
|
536
|
+
}
|
|
537
|
+
exportMap() {
|
|
538
|
+
return this.get("eventStormingExporter").export();
|
|
539
|
+
}
|
|
540
|
+
exportDSL() {
|
|
541
|
+
return n(this.exportMap());
|
|
542
|
+
}
|
|
543
|
+
async saveSVG() {
|
|
544
|
+
return Se(this.get("canvas"), this.get("boardBounds").contentBounds());
|
|
545
|
+
}
|
|
546
|
+
attachTo(e) {
|
|
547
|
+
e.appendChild(this._container), this.get("canvas").resized();
|
|
548
|
+
}
|
|
549
|
+
detach() {
|
|
550
|
+
this._container.remove();
|
|
551
|
+
}
|
|
552
|
+
clear() {
|
|
553
|
+
this._ensureDiagram().clear();
|
|
554
|
+
}
|
|
555
|
+
destroy() {
|
|
556
|
+
this._diagram &&= (this._diagram.destroy(), void 0), this._container.remove();
|
|
557
|
+
}
|
|
558
|
+
get container() {
|
|
559
|
+
return this._container;
|
|
560
|
+
}
|
|
561
|
+
}, Je = "0123456789abcdefghijklmnopqrstuvwxyz", Ye = 252;
|
|
562
|
+
function Xe() {
|
|
563
|
+
let e = "";
|
|
564
|
+
for (; e.length < 8;) for (let t of globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8))) t >= Ye || e.length === 8 || (e += Je[t % 36]);
|
|
565
|
+
return e;
|
|
365
566
|
}
|
|
366
567
|
//#endregion
|
|
367
568
|
//#region src/model/EventStormingElementFactory.ts
|
|
368
|
-
var
|
|
569
|
+
var Ze = {
|
|
369
570
|
event: "event",
|
|
370
571
|
command: "cmd",
|
|
371
572
|
actor: "actor",
|
|
@@ -376,7 +577,7 @@ var Me = {
|
|
|
376
577
|
hotspot: "hot",
|
|
377
578
|
note: "note",
|
|
378
579
|
drawing: "draw"
|
|
379
|
-
},
|
|
580
|
+
}, Qe = class {
|
|
380
581
|
elementFactory;
|
|
381
582
|
elementRegistry;
|
|
382
583
|
static $inject = ["elementFactory", "elementRegistry"];
|
|
@@ -395,15 +596,15 @@ var Me = {
|
|
|
395
596
|
return `${e} ${n}`;
|
|
396
597
|
}
|
|
397
598
|
allocateId(e, t) {
|
|
398
|
-
let n =
|
|
399
|
-
for (
|
|
400
|
-
let
|
|
401
|
-
if (!this.elementRegistry.get(
|
|
599
|
+
let n = Ze[e];
|
|
600
|
+
for (;;) {
|
|
601
|
+
let e = `${n}_${Xe()}`;
|
|
602
|
+
if (!this.elementRegistry.get(e) && !t?.has(e)) return e;
|
|
402
603
|
}
|
|
403
604
|
}
|
|
404
605
|
createSticky(e) {
|
|
405
|
-
if (!
|
|
406
|
-
let { width: t, height: n } =
|
|
606
|
+
if (!C(e.elementType)) throw Error(`not a sticky kind: ${e.elementType}`);
|
|
607
|
+
let { width: t, height: n } = O[e.elementType];
|
|
407
608
|
return this.elementFactory.createShape({
|
|
408
609
|
id: e.id,
|
|
409
610
|
x: e.position.x - t / 2,
|
|
@@ -417,7 +618,7 @@ var Me = {
|
|
|
417
618
|
});
|
|
418
619
|
}
|
|
419
620
|
createNote(e) {
|
|
420
|
-
let { width: t, height: n } = e.size ??
|
|
621
|
+
let { width: t, height: n } = e.size ?? M(e.label), r = e.align?.horizontal, i = e.align?.vertical;
|
|
421
622
|
return this.elementFactory.createShape({
|
|
422
623
|
id: e.id,
|
|
423
624
|
x: e.position.x - t / 2,
|
|
@@ -462,7 +663,7 @@ var Me = {
|
|
|
462
663
|
});
|
|
463
664
|
}
|
|
464
665
|
createNew(e, t) {
|
|
465
|
-
let n = this.uniqueLabel(t), { width: r, height: i } =
|
|
666
|
+
let n = this.uniqueLabel(t), { width: r, height: i } = C(e) ? O[e] : M(n);
|
|
466
667
|
return this.elementFactory.createShape({
|
|
467
668
|
id: this.allocateId(e),
|
|
468
669
|
width: r,
|
|
@@ -472,7 +673,7 @@ var Me = {
|
|
|
472
673
|
});
|
|
473
674
|
}
|
|
474
675
|
createProvisional() {
|
|
475
|
-
let { width: e, height: t } =
|
|
676
|
+
let { width: e, height: t } = O.event;
|
|
476
677
|
return this.elementFactory.createShape({
|
|
477
678
|
id: this.allocateId("event"),
|
|
478
679
|
width: e,
|
|
@@ -487,14 +688,14 @@ var Me = {
|
|
|
487
688
|
id: e.id,
|
|
488
689
|
source: t,
|
|
489
690
|
target: n,
|
|
490
|
-
waypoints: [
|
|
691
|
+
waypoints: [$e(t), $e(n)],
|
|
491
692
|
eventStormingType: "arrow",
|
|
492
693
|
...e.label ? { linkLabel: e.label } : {},
|
|
493
694
|
businessObject: e
|
|
494
695
|
});
|
|
495
696
|
}
|
|
496
697
|
};
|
|
497
|
-
function
|
|
698
|
+
function $e(e) {
|
|
498
699
|
return {
|
|
499
700
|
x: e.x + e.width / 2,
|
|
500
701
|
y: e.y + e.height / 2
|
|
@@ -502,20 +703,20 @@ function Pe(e) {
|
|
|
502
703
|
}
|
|
503
704
|
//#endregion
|
|
504
705
|
//#region src/model/index.ts
|
|
505
|
-
var
|
|
706
|
+
var et = { eventStormingElementFactory: ["type", Qe] };
|
|
506
707
|
//#endregion
|
|
507
708
|
//#region src/board-bounds/BoardBounds.ts
|
|
508
|
-
function
|
|
709
|
+
function tt(e) {
|
|
509
710
|
return e.id !== "event-storming-root" && !e.waypoints && typeof e.x == "number" && typeof e.y == "number" && typeof e.width == "number" && typeof e.height == "number";
|
|
510
711
|
}
|
|
511
|
-
var
|
|
712
|
+
var nt = class {
|
|
512
713
|
elementRegistry;
|
|
513
714
|
static $inject = ["elementRegistry"];
|
|
514
715
|
constructor(e) {
|
|
515
716
|
this.elementRegistry = e;
|
|
516
717
|
}
|
|
517
718
|
contentBounds(e = 120) {
|
|
518
|
-
let t = this.
|
|
719
|
+
let t = this.positionedShapes();
|
|
519
720
|
if (!t.length) return {
|
|
520
721
|
x: 0,
|
|
521
722
|
y: 0,
|
|
@@ -529,7 +730,13 @@ var Le = class {
|
|
|
529
730
|
height: a - r + 2 * e
|
|
530
731
|
};
|
|
531
732
|
}
|
|
532
|
-
|
|
733
|
+
isEmpty() {
|
|
734
|
+
return this.positionedShapes().length === 0;
|
|
735
|
+
}
|
|
736
|
+
positionedShapes() {
|
|
737
|
+
return this.elementRegistry.getAll().filter(tt);
|
|
738
|
+
}
|
|
739
|
+
}, rt = { boardBounds: ["type", nt] }, it = "eventStorming.viewOptions.changed", at = class {
|
|
533
740
|
eventBus;
|
|
534
741
|
elementRegistry;
|
|
535
742
|
static $inject = ["eventBus", "elementRegistry"];
|
|
@@ -542,15 +749,15 @@ var Le = class {
|
|
|
542
749
|
}
|
|
543
750
|
setTypeCaptionsVisible(e) {
|
|
544
751
|
if (e === this._typeCaptionsVisible) return;
|
|
545
|
-
this._typeCaptionsVisible = e, this.eventBus.fire(
|
|
546
|
-
let t = this.elementRegistry.filter(
|
|
752
|
+
this._typeCaptionsVisible = e, this.eventBus.fire(it, { typeCaptionsVisible: e });
|
|
753
|
+
let t = this.elementRegistry.filter(w);
|
|
547
754
|
t.length && this.eventBus.fire("elements.changed", { elements: t });
|
|
548
755
|
}
|
|
549
756
|
}, V = {
|
|
550
757
|
__depends__: [u],
|
|
551
|
-
eventStormingViewOptions: ["type",
|
|
552
|
-
},
|
|
553
|
-
function
|
|
758
|
+
eventStormingViewOptions: ["type", at]
|
|
759
|
+
}, ot = 1500, st = -3, ct = "event-storming-kind-caption", lt = 9, ut = 300, dt = P.stickyText, ft = 7, pt = "#FBFBFB", mt = "#B9B9B9", ht = "6 4", gt = "event-storming-sticky-shadow";
|
|
760
|
+
function _t(e) {
|
|
554
761
|
let t = e.closest("svg");
|
|
555
762
|
if (!t) return !1;
|
|
556
763
|
if (t.querySelector("#event-storming-sticky-shadow")) return !0;
|
|
@@ -561,7 +768,7 @@ function Qe(e) {
|
|
|
561
768
|
"flood-color": "#000000",
|
|
562
769
|
"flood-opacity": .2
|
|
563
770
|
}), r = p(m("filter"), {
|
|
564
|
-
id:
|
|
771
|
+
id: gt,
|
|
565
772
|
x: "-40%",
|
|
566
773
|
y: "-40%",
|
|
567
774
|
width: "180%",
|
|
@@ -571,14 +778,14 @@ function Qe(e) {
|
|
|
571
778
|
let i = m("defs");
|
|
572
779
|
return f(i, r), t.insertBefore(i, t.firstChild), !0;
|
|
573
780
|
}
|
|
574
|
-
var
|
|
781
|
+
var vt = class extends d {
|
|
575
782
|
viewOptions;
|
|
576
783
|
static $inject = ["eventBus", "eventStormingViewOptions"];
|
|
577
784
|
constructor(e, t) {
|
|
578
|
-
super(e,
|
|
785
|
+
super(e, ot), this.viewOptions = t;
|
|
579
786
|
}
|
|
580
787
|
canRender(e) {
|
|
581
|
-
return
|
|
788
|
+
return b(e) || x(e);
|
|
582
789
|
}
|
|
583
790
|
drawShape(e, t) {
|
|
584
791
|
let n = t;
|
|
@@ -588,7 +795,7 @@ var $e = class extends d {
|
|
|
588
795
|
let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = p(m(t.closed ? "polygon" : "polyline"), {
|
|
589
796
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
590
797
|
fill: "none",
|
|
591
|
-
stroke: t.color ??
|
|
798
|
+
stroke: t.color ?? F,
|
|
592
799
|
"stroke-width": 2,
|
|
593
800
|
"stroke-linecap": "round",
|
|
594
801
|
"stroke-linejoin": "round",
|
|
@@ -597,9 +804,9 @@ var $e = class extends d {
|
|
|
597
804
|
return f(e, i), i;
|
|
598
805
|
}
|
|
599
806
|
drawSticky(e, t) {
|
|
600
|
-
let n = t.eventStormingType, r =
|
|
807
|
+
let n = t.eventStormingType, r = C(n) ? O[n] : k, i = t.provisional === !0, a = e;
|
|
601
808
|
if (n === "hotspot") {
|
|
602
|
-
let n = p(m("g"), { transform: `rotate(${
|
|
809
|
+
let n = p(m("g"), { transform: `rotate(${st} ${t.width / 2} ${t.height / 2})` });
|
|
603
810
|
f(e, n), a = n;
|
|
604
811
|
}
|
|
605
812
|
let o = p(m("rect"), {
|
|
@@ -608,37 +815,37 @@ var $e = class extends d {
|
|
|
608
815
|
width: Math.max(t.width, 1),
|
|
609
816
|
height: Math.max(t.height, 1),
|
|
610
817
|
rx: 0,
|
|
611
|
-
fill: i ?
|
|
612
|
-
stroke: i ?
|
|
818
|
+
fill: i ? pt : t.color ?? r.fill,
|
|
819
|
+
stroke: i ? mt : r.stroke,
|
|
613
820
|
"stroke-width": 1.5,
|
|
614
|
-
...i ? { "stroke-dasharray":
|
|
821
|
+
...i ? { "stroke-dasharray": ht } : {}
|
|
615
822
|
});
|
|
616
|
-
if (
|
|
617
|
-
if (n === "note" ?
|
|
618
|
-
let e = H(
|
|
823
|
+
if (_t(e) && o.setAttribute("filter", `url(#${gt})`), f(a, o), i) return o;
|
|
824
|
+
if (n === "note" ? Ct(a, t) : bt(a, t), C(n) && this.viewOptions.typeCaptionsVisible()) {
|
|
825
|
+
let e = H(O[n].label, t.width / 2, t.height - ft, {
|
|
619
826
|
"text-anchor": "middle",
|
|
620
|
-
"font-size":
|
|
621
|
-
fill:
|
|
827
|
+
"font-size": lt,
|
|
828
|
+
fill: dt
|
|
622
829
|
});
|
|
623
|
-
e.setAttribute("class",
|
|
830
|
+
e.setAttribute("class", ct), e.setAttribute("font-weight", String(ut)), f(a, e);
|
|
624
831
|
}
|
|
625
832
|
return o;
|
|
626
833
|
}
|
|
627
834
|
drawConnection(e, t) {
|
|
628
|
-
let n = t, [r, i] =
|
|
835
|
+
let n = t, [r, i] = At(n), a = p(m("polyline"), {
|
|
629
836
|
points: `${r.x},${r.y} ${i.x},${i.y}`,
|
|
630
837
|
fill: "none",
|
|
631
|
-
stroke:
|
|
838
|
+
stroke: P.arrow,
|
|
632
839
|
"stroke-width": 1.5,
|
|
633
840
|
"stroke-linecap": "round"
|
|
634
841
|
});
|
|
635
|
-
if (f(e, a), f(e,
|
|
842
|
+
if (f(e, a), f(e, Ot(r, i, P.arrow, 11, 5)), n.linkLabel) {
|
|
636
843
|
let t = (r.x + i.x) / 2, a = (r.y + i.y) / 2;
|
|
637
844
|
f(e, H(n.linkLabel, t, a - 5, {
|
|
638
845
|
"text-anchor": "middle",
|
|
639
846
|
"font-size": 11,
|
|
640
847
|
"font-style": "italic",
|
|
641
|
-
fill:
|
|
848
|
+
fill: P.inkSoft
|
|
642
849
|
}));
|
|
643
850
|
}
|
|
644
851
|
return a;
|
|
@@ -652,7 +859,7 @@ var $e = class extends d {
|
|
|
652
859
|
return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
|
|
653
860
|
}
|
|
654
861
|
};
|
|
655
|
-
function
|
|
862
|
+
function yt(e, t) {
|
|
656
863
|
let n = e.split(/\s+/).filter((e) => e.length);
|
|
657
864
|
if (!n.length) return [""];
|
|
658
865
|
let r = [], i = "";
|
|
@@ -669,25 +876,25 @@ function et(e, t) {
|
|
|
669
876
|
}
|
|
670
877
|
return r.push(i), r;
|
|
671
878
|
}
|
|
672
|
-
function
|
|
673
|
-
let n = t.width - 16, r = Math.max(1, Math.floor(n /
|
|
879
|
+
function bt(e, t) {
|
|
880
|
+
let n = t.width - 16, r = Math.max(1, Math.floor(n / j)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) => yt(e, r)).slice(0, i), o = t.width / 2, s = t.height / 2 - (a.length - 1) * 17 / 2 + 4;
|
|
674
881
|
a.forEach((t, n) => {
|
|
675
882
|
f(e, H(t, o, s + n * 17, {
|
|
676
883
|
"text-anchor": "middle",
|
|
677
|
-
fill:
|
|
884
|
+
fill: P.stickyText
|
|
678
885
|
}));
|
|
679
886
|
});
|
|
680
887
|
}
|
|
681
|
-
var
|
|
682
|
-
function
|
|
683
|
-
let n = t.width - 16, r = Math.max(1, Math.floor(n /
|
|
888
|
+
var xt = 2, St = 12.5;
|
|
889
|
+
function Ct(e, t) {
|
|
890
|
+
let n = t.width - 16, r = Math.max(1, Math.floor(n / j)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = D(t.eventStormingLabel ?? "").flatMap((e) => wt(e, r)).slice(0, i), o = t.alignHorizontal ?? "left", s = t.alignVertical ?? "top", c = o === "left" ? "start" : o === "center" ? "middle" : "end", l = a.length * 17, u = s === "top" ? 8 : s === "middle" ? (t.height - l) / 2 : t.height - 8 - l;
|
|
684
891
|
a.forEach((n, r) => {
|
|
685
892
|
let i = o === "left" ? 8 + (n.indent ? 12 : 0) : o === "center" ? t.width / 2 : t.width - 8, a = p(m("text"), {
|
|
686
893
|
x: i,
|
|
687
|
-
y: u + r * 17 +
|
|
688
|
-
"font-family":
|
|
689
|
-
"font-size":
|
|
690
|
-
fill:
|
|
894
|
+
y: u + r * 17 + St,
|
|
895
|
+
"font-family": I.family,
|
|
896
|
+
"font-size": I.label,
|
|
897
|
+
fill: P.stickyText,
|
|
691
898
|
"text-anchor": c
|
|
692
899
|
}), s = n.marker ? [{
|
|
693
900
|
text: "• ",
|
|
@@ -701,19 +908,19 @@ function it(e, t) {
|
|
|
701
908
|
f(e, a);
|
|
702
909
|
});
|
|
703
910
|
}
|
|
704
|
-
function
|
|
705
|
-
let n = Math.max(1, t - (e.bullet ?
|
|
706
|
-
return
|
|
911
|
+
function wt(e, t) {
|
|
912
|
+
let n = Math.max(1, t - (e.bullet ? xt : 0));
|
|
913
|
+
return Tt(e.runs, n).map((t, n) => ({
|
|
707
914
|
runs: t,
|
|
708
915
|
marker: e.bullet && n === 0,
|
|
709
916
|
indent: e.bullet && n > 0
|
|
710
917
|
}));
|
|
711
918
|
}
|
|
712
|
-
function
|
|
919
|
+
function Tt(e, t) {
|
|
713
920
|
let n = e.map((e) => e.text).join("");
|
|
714
|
-
return n.length <= t ? [e] :
|
|
921
|
+
return n.length <= t ? [e] : Et(n, t).map(([t, n]) => Dt(e, t, n));
|
|
715
922
|
}
|
|
716
|
-
function
|
|
923
|
+
function Et(e, t) {
|
|
717
924
|
let n = [...e.matchAll(/\S+/g)];
|
|
718
925
|
if (!n.length) return [[0, 0]];
|
|
719
926
|
let r = [], i = -1, a = -1, o = () => {
|
|
@@ -724,17 +931,11 @@ function st(e, t) {
|
|
|
724
931
|
if (e[0].length > t) {
|
|
725
932
|
for (o(); s - n > t;) r.push([n, n + t]), n += t;
|
|
726
933
|
i = n, a = s;
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
if (i < 0 || s - i <= t) {
|
|
730
|
-
i < 0 && (i = n), a = s;
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
o(), i = n, a = s;
|
|
934
|
+
} else i < 0 || s - i <= t ? (i < 0 && (i = n), a = s) : (o(), i = n, a = s);
|
|
734
935
|
}
|
|
735
936
|
return o(), r;
|
|
736
937
|
}
|
|
737
|
-
function
|
|
938
|
+
function Dt(e, t, n) {
|
|
738
939
|
let r = [], i = 0;
|
|
739
940
|
for (let a of e) {
|
|
740
941
|
let e = i;
|
|
@@ -752,14 +953,14 @@ function H(e, t, n, r = {}) {
|
|
|
752
953
|
let i = p(m("text"), {
|
|
753
954
|
x: t,
|
|
754
955
|
y: n,
|
|
755
|
-
"font-family":
|
|
756
|
-
"font-size":
|
|
757
|
-
fill:
|
|
956
|
+
"font-family": I.family,
|
|
957
|
+
"font-size": I.label,
|
|
958
|
+
fill: P.ink,
|
|
758
959
|
...r
|
|
759
960
|
});
|
|
760
961
|
return i.textContent = e, i;
|
|
761
962
|
}
|
|
762
|
-
function
|
|
963
|
+
function Ot(e, t, n, r = 10, i = 5) {
|
|
763
964
|
let a = Math.atan2(t.y - e.y, t.x - e.x), o = t.x - r * Math.cos(a), s = t.y - r * Math.sin(a), c = `${t.x},${t.y} ${o - i * Math.sin(a)},${s + i * Math.cos(a)} ${o + i * Math.sin(a)},${s - i * Math.cos(a)}`;
|
|
764
965
|
return p(m("polygon"), {
|
|
765
966
|
points: c,
|
|
@@ -772,7 +973,7 @@ function U(e) {
|
|
|
772
973
|
y: e.y + e.height / 2
|
|
773
974
|
};
|
|
774
975
|
}
|
|
775
|
-
function
|
|
976
|
+
function kt(e, t) {
|
|
776
977
|
let n = U(e), r = t.x - n.x, i = t.y - n.y;
|
|
777
978
|
if (r === 0 && i === 0) return n;
|
|
778
979
|
let a = e.width / 2 + 2, o = e.height / 2 + 2, s = Math.min(r === 0 ? Infinity : a / Math.abs(r), i === 0 ? Infinity : o / Math.abs(i));
|
|
@@ -781,7 +982,7 @@ function ut(e, t) {
|
|
|
781
982
|
y: n.y + i * s
|
|
782
983
|
};
|
|
783
984
|
}
|
|
784
|
-
function
|
|
985
|
+
function At(e) {
|
|
785
986
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
786
987
|
if (!t || !n) {
|
|
787
988
|
let e = r[0] ?? {
|
|
@@ -790,32 +991,34 @@ function dt(e) {
|
|
|
790
991
|
};
|
|
791
992
|
return [e, r[r.length - 1] ?? e];
|
|
792
993
|
}
|
|
793
|
-
let i = U(t), a = U(n), o =
|
|
994
|
+
let i = U(t), a = U(n), o = kt(t, a), s = kt(n, i);
|
|
794
995
|
return (a.x - i.x) * (s.x - o.x) + (a.y - i.y) * (s.y - o.y) <= 0 ? [i, a] : [o, s];
|
|
795
996
|
}
|
|
796
997
|
//#endregion
|
|
797
998
|
//#region src/draw/index.ts
|
|
798
|
-
var
|
|
999
|
+
var jt = {
|
|
799
1000
|
__depends__: [V],
|
|
800
1001
|
__init__: ["eventStormingRenderer"],
|
|
801
|
-
eventStormingRenderer: ["type",
|
|
802
|
-
},
|
|
1002
|
+
eventStormingRenderer: ["type", vt]
|
|
1003
|
+
}, Mt = { drawing: 0 }, Nt = .001, Pt = class {
|
|
803
1004
|
canvas;
|
|
804
1005
|
elementFactory;
|
|
805
1006
|
factory;
|
|
806
1007
|
boardBounds;
|
|
807
1008
|
eventBus;
|
|
808
1009
|
elementRegistry;
|
|
1010
|
+
config;
|
|
809
1011
|
static $inject = [
|
|
810
1012
|
"canvas",
|
|
811
1013
|
"elementFactory",
|
|
812
1014
|
"eventStormingElementFactory",
|
|
813
1015
|
"boardBounds",
|
|
814
1016
|
"eventBus",
|
|
815
|
-
"elementRegistry"
|
|
1017
|
+
"elementRegistry",
|
|
1018
|
+
"config.eventStormingImporter"
|
|
816
1019
|
];
|
|
817
|
-
constructor(e, t, n, r, i, a) {
|
|
818
|
-
this.canvas = e, this.elementFactory = t, this.factory = n, this.boardBounds = r, this.eventBus = i, this.elementRegistry = a;
|
|
1020
|
+
constructor(e, t, n, r, i, a, o) {
|
|
1021
|
+
this.canvas = e, this.elementFactory = t, this.factory = n, this.boardBounds = r, this.eventBus = i, this.elementRegistry = a, this.config = o;
|
|
819
1022
|
}
|
|
820
1023
|
import(e) {
|
|
821
1024
|
let t = [];
|
|
@@ -823,49 +1026,59 @@ var ft = {
|
|
|
823
1026
|
let n = {
|
|
824
1027
|
config: e.config,
|
|
825
1028
|
...e.rawPassthrough ? { rawPassthrough: e.rawPassthrough } : {}
|
|
826
|
-
}, r;
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
r = void 0;
|
|
831
|
-
}
|
|
832
|
-
let i;
|
|
833
|
-
r && r.id === "event-storming-root" ? i = r : (i = this.elementFactory.createRoot({ id: De }), this.canvas.setRootElement(i)), i.businessObject = n;
|
|
834
|
-
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (pt[e.elementType] ?? 9) - (pt[t.elementType] ?? 9)), s = o.filter((e) => e.elementType === "drawing"), c = o.filter((e) => e.elementType !== "drawing");
|
|
835
|
-
for (let e of s) {
|
|
1029
|
+
}, r = this.boardRoot();
|
|
1030
|
+
r.businessObject = n;
|
|
1031
|
+
let i = /* @__PURE__ */ new Map(), a = [...e.elements].sort((e, t) => (Mt[e.elementType] ?? 9) - (Mt[t.elementType] ?? 9)), o = a.filter((e) => e.elementType === "drawing"), s = a.filter((e) => e.elementType !== "drawing");
|
|
1032
|
+
for (let e of o) {
|
|
836
1033
|
let t = this.createShape(e);
|
|
837
|
-
this.canvas.addShape(t,
|
|
1034
|
+
this.canvas.addShape(t, r), i.set(e.id, t);
|
|
838
1035
|
}
|
|
839
|
-
for (let e of
|
|
1036
|
+
for (let e of s) {
|
|
840
1037
|
let t = this.createShape(e);
|
|
841
|
-
this.canvas.addShape(t,
|
|
1038
|
+
this.canvas.addShape(t, r), i.set(e.id, t);
|
|
842
1039
|
}
|
|
843
|
-
for (let e of
|
|
1040
|
+
for (let e of s) {
|
|
844
1041
|
let n = "attachedTo" in e ? e.attachedTo : void 0;
|
|
845
1042
|
if (!n) continue;
|
|
846
|
-
let r =
|
|
847
|
-
|
|
848
|
-
t.
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
});
|
|
852
|
-
continue;
|
|
853
|
-
}
|
|
854
|
-
a.get(e.id).host = r;
|
|
1043
|
+
let r = i.get(n);
|
|
1044
|
+
!r || !De(r) ? t.push({
|
|
1045
|
+
message: `“${e.id}” is pinned to “${n}”, which isn't on the board or can't hold a pin. It stays unpinned.`,
|
|
1046
|
+
elementId: e.id
|
|
1047
|
+
}) : i.get(e.id).host = r;
|
|
855
1048
|
}
|
|
856
1049
|
for (let n of e.edges) {
|
|
857
|
-
let e =
|
|
858
|
-
if (!e || !
|
|
1050
|
+
let e = i.get(n.from), a = i.get(n.to);
|
|
1051
|
+
if (!e || !a) {
|
|
859
1052
|
t.push({
|
|
860
|
-
message: `
|
|
1053
|
+
message: `The arrow “${n.id}” has an end that isn't on the board, so it was left out.`,
|
|
861
1054
|
elementId: n.id
|
|
862
1055
|
});
|
|
863
1056
|
continue;
|
|
864
1057
|
}
|
|
865
|
-
let
|
|
866
|
-
this.canvas.addConnection(
|
|
1058
|
+
let s = this.factory.createArrow(n, e, a);
|
|
1059
|
+
this.canvas.addConnection(s, r, o.length);
|
|
867
1060
|
}
|
|
868
|
-
return this.
|
|
1061
|
+
return this.config?.fitOnImport !== !1 && this.fitToContent(), this.eventBus.fire("import.render.done", { warnings: t }), t;
|
|
1062
|
+
}
|
|
1063
|
+
boardRoot() {
|
|
1064
|
+
let e = this.elementRegistry.get(y);
|
|
1065
|
+
e || (e = this.elementFactory.createRoot({ id: y }), this.canvas.setRootElement(e));
|
|
1066
|
+
for (let t of this.canvas.getRootElements()) t !== e && this.canvas.removeRootElement(t);
|
|
1067
|
+
return e;
|
|
1068
|
+
}
|
|
1069
|
+
fitToContent() {
|
|
1070
|
+
let e = this.boardBounds.contentBounds(), { width: t, height: n } = this.canvas.getSize();
|
|
1071
|
+
if (!(t > 0 && n > 0)) {
|
|
1072
|
+
this.canvas.viewbox(e);
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
let r = this.boardBounds.isEmpty() ? 1 : Math.max(Math.min(t / e.width, n / e.height, 1), Nt);
|
|
1076
|
+
this.canvas.viewbox({
|
|
1077
|
+
x: e.x + e.width / 2 - t / 2 / r,
|
|
1078
|
+
y: e.y + e.height / 2 - n / 2 / r,
|
|
1079
|
+
width: t / r,
|
|
1080
|
+
height: n / r
|
|
1081
|
+
});
|
|
869
1082
|
}
|
|
870
1083
|
createShape(e) {
|
|
871
1084
|
switch (e.elementType) {
|
|
@@ -875,31 +1088,32 @@ var ft = {
|
|
|
875
1088
|
}
|
|
876
1089
|
}
|
|
877
1090
|
clear() {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
if (t
|
|
881
|
-
|
|
1091
|
+
let e = new Set(this.canvas.getRootElements());
|
|
1092
|
+
for (let t of [...this.elementRegistry.getAll()]) {
|
|
1093
|
+
if (e.has(t)) continue;
|
|
1094
|
+
let n = t;
|
|
1095
|
+
try {
|
|
1096
|
+
n.waypoints ? this.canvas.removeConnection(n.id) : this.canvas.removeShape(n.id);
|
|
882
1097
|
} catch {}
|
|
883
1098
|
}
|
|
884
1099
|
}
|
|
885
|
-
},
|
|
1100
|
+
}, Ft = class {
|
|
886
1101
|
elementRegistry;
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
this.elementRegistry = e, this.canvas = t;
|
|
1102
|
+
static $inject = ["elementRegistry"];
|
|
1103
|
+
constructor(e) {
|
|
1104
|
+
this.elementRegistry = e;
|
|
891
1105
|
}
|
|
892
1106
|
export() {
|
|
893
|
-
let e = this.
|
|
1107
|
+
let e = this.elementRegistry.get(y)?.businessObject, t = e?.config ?? { title: "Untitled Board" }, n = [], r = [];
|
|
894
1108
|
for (let e of this.elementRegistry.getAll()) if (e.id !== "event-storming-root") {
|
|
895
|
-
if (
|
|
1109
|
+
if (x(e)) r.push({
|
|
896
1110
|
id: e.id,
|
|
897
1111
|
edgeType: "arrow",
|
|
898
1112
|
from: e.source?.id ?? "",
|
|
899
1113
|
to: e.target?.id ?? "",
|
|
900
1114
|
...e.linkLabel ? { label: e.linkLabel } : {}
|
|
901
1115
|
});
|
|
902
|
-
else if (
|
|
1116
|
+
else if (b(e)) {
|
|
903
1117
|
let t = this.buildElement(e);
|
|
904
1118
|
t && n.push(t);
|
|
905
1119
|
}
|
|
@@ -930,10 +1144,10 @@ var ft = {
|
|
|
930
1144
|
...e.color ? { color: e.color } : {}
|
|
931
1145
|
};
|
|
932
1146
|
}
|
|
933
|
-
let t = e.eventStormingType === "note" &&
|
|
1147
|
+
let t = e.eventStormingType === "note" && N(e.eventStormingLabel, e) ? {
|
|
934
1148
|
width: e.width,
|
|
935
1149
|
height: e.height
|
|
936
|
-
} : void 0, n = e.eventStormingType === "note" ?
|
|
1150
|
+
} : void 0, n = e.eventStormingType === "note" ? It(e) : void 0;
|
|
937
1151
|
return {
|
|
938
1152
|
id: e.id,
|
|
939
1153
|
elementType: e.eventStormingType,
|
|
@@ -949,7 +1163,7 @@ var ft = {
|
|
|
949
1163
|
};
|
|
950
1164
|
}
|
|
951
1165
|
};
|
|
952
|
-
function
|
|
1166
|
+
function It(e) {
|
|
953
1167
|
let t = e.alignHorizontal && e.alignHorizontal !== "left" ? e.alignHorizontal : void 0, n = e.alignVertical && e.alignVertical !== "top" ? e.alignVertical : void 0;
|
|
954
1168
|
if (t || n) return {
|
|
955
1169
|
...t ? { horizontal: t } : {},
|
|
@@ -957,58 +1171,63 @@ function gt(e) {
|
|
|
957
1171
|
};
|
|
958
1172
|
}
|
|
959
1173
|
//#endregion
|
|
1174
|
+
//#region src/io/warnings.ts
|
|
1175
|
+
function Lt(e) {
|
|
1176
|
+
return e.source === void 0 ? e.message : `${e.message} (“${e.source}”)`;
|
|
1177
|
+
}
|
|
1178
|
+
//#endregion
|
|
960
1179
|
//#region src/io/index.ts
|
|
961
|
-
var
|
|
962
|
-
eventStormingImporter: ["type",
|
|
963
|
-
eventStormingExporter: ["type",
|
|
964
|
-
},
|
|
1180
|
+
var Rt = {
|
|
1181
|
+
eventStormingImporter: ["type", Pt],
|
|
1182
|
+
eventStormingExporter: ["type", Ft]
|
|
1183
|
+
}, zt = class extends qe {
|
|
965
1184
|
_getModules() {
|
|
966
1185
|
return [
|
|
967
|
-
|
|
968
|
-
|
|
1186
|
+
et,
|
|
1187
|
+
rt,
|
|
969
1188
|
V,
|
|
970
|
-
|
|
971
|
-
|
|
1189
|
+
jt,
|
|
1190
|
+
Rt
|
|
972
1191
|
];
|
|
973
1192
|
}
|
|
974
|
-
},
|
|
1193
|
+
}, W = class extends zt {
|
|
975
1194
|
_getModules() {
|
|
976
1195
|
return [
|
|
977
1196
|
...super._getModules(),
|
|
978
1197
|
g,
|
|
979
1198
|
_,
|
|
980
1199
|
v,
|
|
981
|
-
|
|
1200
|
+
ee
|
|
982
1201
|
];
|
|
983
1202
|
}
|
|
984
|
-
},
|
|
1203
|
+
}, Bt = class extends de {
|
|
985
1204
|
static $inject = ["eventBus", "modeling"];
|
|
986
1205
|
constructor(e, t) {
|
|
987
1206
|
super(e), this.preExecute("element.updateProperties", (e) => {
|
|
988
1207
|
let { element: n, properties: r } = e.context, i = r.eventStormingType;
|
|
989
1208
|
if (typeof i != "string") return;
|
|
990
1209
|
let a = n;
|
|
991
|
-
if (a.host && !
|
|
1210
|
+
if (a.host && !we(i) && t.updateAttachment(a, void 0), a.attachers?.length && !Te(i)) for (let e of [...a.attachers]) t.updateAttachment(e, void 0);
|
|
992
1211
|
});
|
|
993
1212
|
}
|
|
994
|
-
},
|
|
995
|
-
__depends__: [
|
|
1213
|
+
}, Vt = {
|
|
1214
|
+
__depends__: [ue],
|
|
996
1215
|
__init__: ["eventStormingAttachBehavior"],
|
|
997
|
-
eventStormingAttachBehavior: ["type",
|
|
1216
|
+
eventStormingAttachBehavior: ["type", Bt]
|
|
998
1217
|
};
|
|
999
1218
|
//#endregion
|
|
1000
1219
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
1001
|
-
function
|
|
1220
|
+
function Ht(e, t, n) {
|
|
1002
1221
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
1003
1222
|
}
|
|
1004
|
-
var
|
|
1223
|
+
var Ut = [
|
|
1005
1224
|
"x",
|
|
1006
1225
|
"y",
|
|
1007
1226
|
"width",
|
|
1008
1227
|
"height"
|
|
1009
1228
|
];
|
|
1010
|
-
function
|
|
1011
|
-
if (!t.some((e) =>
|
|
1229
|
+
function Wt(e, t) {
|
|
1230
|
+
if (!t.some((e) => Ut.includes(e))) return [e];
|
|
1012
1231
|
let n = e;
|
|
1013
1232
|
return [
|
|
1014
1233
|
e,
|
|
@@ -1016,18 +1235,18 @@ function wt(e, t) {
|
|
|
1016
1235
|
...n.outgoing ?? []
|
|
1017
1236
|
];
|
|
1018
1237
|
}
|
|
1019
|
-
var
|
|
1238
|
+
var Gt = class {
|
|
1020
1239
|
execute(e) {
|
|
1021
1240
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
1022
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
1023
|
-
return e.oldProperties = i,
|
|
1241
|
+
for (let e of Object.keys(n)) i[e] = r[e], Ht(r, e, n[e]);
|
|
1242
|
+
return e.oldProperties = i, Wt(t, Object.keys(n));
|
|
1024
1243
|
}
|
|
1025
1244
|
revert(e) {
|
|
1026
1245
|
let { element: t, oldProperties: n } = e, r = t;
|
|
1027
|
-
if (n) for (let e of Object.keys(n))
|
|
1028
|
-
return
|
|
1246
|
+
if (n) for (let e of Object.keys(n)) Ht(r, e, n[e]);
|
|
1247
|
+
return Wt(t, Object.keys(n ?? {}));
|
|
1029
1248
|
}
|
|
1030
|
-
},
|
|
1249
|
+
}, Kt = "element.updateProperties", qt = class {
|
|
1031
1250
|
commandStack;
|
|
1032
1251
|
canvas;
|
|
1033
1252
|
elementRegistry;
|
|
@@ -1037,17 +1256,17 @@ var Tt = class {
|
|
|
1037
1256
|
"elementRegistry"
|
|
1038
1257
|
];
|
|
1039
1258
|
constructor(e, t, n) {
|
|
1040
|
-
this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(
|
|
1259
|
+
this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(Kt, Gt);
|
|
1041
1260
|
}
|
|
1042
1261
|
updateProperties(e, t) {
|
|
1043
|
-
this.commandStack.execute(
|
|
1262
|
+
this.commandStack.execute(Kt, {
|
|
1044
1263
|
element: e,
|
|
1045
1264
|
properties: t
|
|
1046
1265
|
});
|
|
1047
1266
|
}
|
|
1048
1267
|
updateLabel(e, t) {
|
|
1049
|
-
if (e.eventStormingType === "note" && !
|
|
1050
|
-
let { width: n, height: r } =
|
|
1268
|
+
if (e.eventStormingType === "note" && !N(e.eventStormingLabel, e)) {
|
|
1269
|
+
let { width: n, height: r } = M(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
1051
1270
|
this.updateProperties(e, {
|
|
1052
1271
|
eventStormingLabel: t,
|
|
1053
1272
|
width: n,
|
|
@@ -1055,14 +1274,12 @@ var Tt = class {
|
|
|
1055
1274
|
x: i - n / 2,
|
|
1056
1275
|
y: a - r / 2
|
|
1057
1276
|
});
|
|
1058
|
-
|
|
1059
|
-
}
|
|
1060
|
-
this.updateProperties(e, { eventStormingLabel: t });
|
|
1277
|
+
} else this.updateProperties(e, { eventStormingLabel: t });
|
|
1061
1278
|
}
|
|
1062
1279
|
setStickyKind(e, t) {
|
|
1063
|
-
if (!
|
|
1280
|
+
if (!C(e.eventStormingType) || !C(t)) throw Error("setStickyKind: only sticky kinds can be retyped");
|
|
1064
1281
|
if (e.eventStormingType === t && !e.provisional) return;
|
|
1065
|
-
let { width: n, height: r } =
|
|
1282
|
+
let { width: n, height: r } = O[t], i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
1066
1283
|
this.updateProperties(e, {
|
|
1067
1284
|
eventStormingType: t,
|
|
1068
1285
|
...e.provisional ? { provisional: void 0 } : {},
|
|
@@ -1084,7 +1301,7 @@ var Tt = class {
|
|
|
1084
1301
|
setLevel(e) {
|
|
1085
1302
|
if (this.getLevel() === e) return;
|
|
1086
1303
|
let t = this.root(), n = t.businessObject ?? { config: { title: "Untitled Board" } };
|
|
1087
|
-
this.commandStack.execute(
|
|
1304
|
+
this.commandStack.execute(Kt, {
|
|
1088
1305
|
element: t,
|
|
1089
1306
|
properties: { businessObject: {
|
|
1090
1307
|
...n,
|
|
@@ -1098,7 +1315,7 @@ var Tt = class {
|
|
|
1098
1315
|
root() {
|
|
1099
1316
|
return this.elementRegistry.get("event-storming-root") ?? this.canvas.getRootElement();
|
|
1100
1317
|
}
|
|
1101
|
-
},
|
|
1318
|
+
}, Jt = 24, Yt = [
|
|
1102
1319
|
"eventStormingType",
|
|
1103
1320
|
"color",
|
|
1104
1321
|
"drawingPoints",
|
|
@@ -1106,8 +1323,8 @@ var Tt = class {
|
|
|
1106
1323
|
"strokeStyle",
|
|
1107
1324
|
"alignHorizontal",
|
|
1108
1325
|
"alignVertical"
|
|
1109
|
-
],
|
|
1110
|
-
function
|
|
1326
|
+
], Xt = ["eventStormingType", "linkLabel"];
|
|
1327
|
+
function Zt(e, t) {
|
|
1111
1328
|
let n = {};
|
|
1112
1329
|
for (let r of t) {
|
|
1113
1330
|
let t = e[r];
|
|
@@ -1115,7 +1332,7 @@ function At(e, t) {
|
|
|
1115
1332
|
}
|
|
1116
1333
|
return n;
|
|
1117
1334
|
}
|
|
1118
|
-
var
|
|
1335
|
+
var Qt = class {
|
|
1119
1336
|
selection;
|
|
1120
1337
|
modeling;
|
|
1121
1338
|
elementFactory;
|
|
@@ -1138,23 +1355,23 @@ var jt = class {
|
|
|
1138
1355
|
this.selection = e, this.modeling = t, this.elementFactory = n, this.esFactory = r, this.canvas = i, this.create = a, this.mouse = o;
|
|
1139
1356
|
}
|
|
1140
1357
|
copy() {
|
|
1141
|
-
let e = this.selection.get().filter((e) =>
|
|
1358
|
+
let e = this.selection.get().filter((e) => b(e));
|
|
1142
1359
|
if (!e.length) return !1;
|
|
1143
1360
|
let t = new Map(e.map((e, t) => [e, t])), n = [], r = /* @__PURE__ */ new Set();
|
|
1144
1361
|
for (let i of e) for (let e of [...i.incoming ?? [], ...i.outgoing ?? []]) {
|
|
1145
|
-
if (!
|
|
1362
|
+
if (!x(e) || r.has(e)) continue;
|
|
1146
1363
|
let i = t.get(e.source), a = t.get(e.target);
|
|
1147
1364
|
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
1148
1365
|
sourceIdx: i,
|
|
1149
1366
|
targetIdx: a,
|
|
1150
|
-
props:
|
|
1367
|
+
props: Zt(e, Xt)
|
|
1151
1368
|
}));
|
|
1152
1369
|
}
|
|
1153
1370
|
return this.clipboard = {
|
|
1154
1371
|
shapes: e.map((e) => {
|
|
1155
1372
|
let n = e.host ? t.get(e.host) : void 0;
|
|
1156
1373
|
return {
|
|
1157
|
-
props:
|
|
1374
|
+
props: Zt(e, Yt),
|
|
1158
1375
|
x: e.x,
|
|
1159
1376
|
y: e.y,
|
|
1160
1377
|
width: e.width,
|
|
@@ -1195,26 +1412,26 @@ var jt = class {
|
|
|
1195
1412
|
...structuredClone(e.props),
|
|
1196
1413
|
source: n[e.sourceIdx],
|
|
1197
1414
|
target: n[e.targetIdx],
|
|
1198
|
-
waypoints: [
|
|
1415
|
+
waypoints: [$t(n[e.sourceIdx]), $t(n[e.targetIdx])]
|
|
1199
1416
|
}))
|
|
1200
1417
|
};
|
|
1201
1418
|
}
|
|
1202
1419
|
insertWithOffset(e) {
|
|
1203
1420
|
this.pasteCount++;
|
|
1204
|
-
let t =
|
|
1421
|
+
let t = Jt * this.pasteCount, n = en(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
1205
1422
|
x: n.cx + t,
|
|
1206
1423
|
y: n.cy + t
|
|
1207
1424
|
}, this.canvas.getRootElement());
|
|
1208
1425
|
return this.selection.select(r), !0;
|
|
1209
1426
|
}
|
|
1210
1427
|
};
|
|
1211
|
-
function
|
|
1428
|
+
function $t(e) {
|
|
1212
1429
|
return {
|
|
1213
1430
|
x: e.x + e.width / 2,
|
|
1214
1431
|
y: e.y + e.height / 2
|
|
1215
1432
|
};
|
|
1216
1433
|
}
|
|
1217
|
-
function
|
|
1434
|
+
function en(e) {
|
|
1218
1435
|
let t = Math.min(...e.map((e) => e.x)), n = Math.min(...e.map((e) => e.y)), r = Math.max(...e.map((e) => e.x + e.width)), i = Math.max(...e.map((e) => e.y + e.height));
|
|
1219
1436
|
return {
|
|
1220
1437
|
cx: (t + r) / 2,
|
|
@@ -1223,13 +1440,13 @@ function Nt(e) {
|
|
|
1223
1440
|
}
|
|
1224
1441
|
//#endregion
|
|
1225
1442
|
//#region src/modeling/index.ts
|
|
1226
|
-
var
|
|
1227
|
-
__depends__: [
|
|
1443
|
+
var tn = {
|
|
1444
|
+
__depends__: [fe, re],
|
|
1228
1445
|
__init__: ["eventStormingModeling"],
|
|
1229
|
-
eventStormingModeling: ["type",
|
|
1230
|
-
eventStormingCopyPaste: ["type",
|
|
1231
|
-
},
|
|
1232
|
-
__depends__: [
|
|
1446
|
+
eventStormingModeling: ["type", qt],
|
|
1447
|
+
eventStormingCopyPaste: ["type", Qt]
|
|
1448
|
+
}, nn = {
|
|
1449
|
+
__depends__: [pe],
|
|
1233
1450
|
__init__: ["eventStormingLassoBehavior"],
|
|
1234
1451
|
eventStormingLassoBehavior: ["type", class {
|
|
1235
1452
|
static $inject = [
|
|
@@ -1254,207 +1471,75 @@ var Pt = {
|
|
|
1254
1471
|
};
|
|
1255
1472
|
//#endregion
|
|
1256
1473
|
//#region src/rules/EventStormingRules.ts
|
|
1257
|
-
function
|
|
1474
|
+
function rn(e, t) {
|
|
1258
1475
|
return (e.outgoing ?? []).some((e) => e.target === t);
|
|
1259
1476
|
}
|
|
1260
|
-
function
|
|
1261
|
-
return e.length !== 1 || !
|
|
1477
|
+
function an(e, t) {
|
|
1478
|
+
return e.length !== 1 || !Ee(e[0]) || !De(t) ? !1 : "attach";
|
|
1262
1479
|
}
|
|
1263
|
-
var
|
|
1264
|
-
static $inject = ["eventBus"];
|
|
1265
|
-
constructor(e) {
|
|
1266
|
-
super(e);
|
|
1267
|
-
}
|
|
1268
|
-
init() {
|
|
1269
|
-
this.addRule("connection.start", (e) => L(e.source)), this.addRule("connection.create", (e) => {
|
|
1270
|
-
let { source: t, target: n } = e;
|
|
1271
|
-
return !L(t) || !L(n) || t === n || It(t, n) ? !1 : { eventStormingType: "arrow" };
|
|
1272
|
-
}), this.addRule(["shape.move", "elements.move"], (e) => Lt(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
|
|
1273
|
-
if (!je(e.shape)) return !1;
|
|
1274
|
-
let { newBounds: t } = e;
|
|
1275
|
-
return !t || t.width >= E.width && t.height >= E.height;
|
|
1276
|
-
});
|
|
1277
|
-
}
|
|
1278
|
-
}, zt = {
|
|
1279
|
-
__init__: ["eventStormingRules"],
|
|
1280
|
-
eventStormingRules: ["type", Rt]
|
|
1281
|
-
}, Bt = 8, Vt = {
|
|
1282
|
-
__init__: ["elementSnapping"],
|
|
1283
|
-
elementSnapping: ["type", class {
|
|
1284
|
-
static $inject = ["eventBus", "elementRegistry"];
|
|
1285
|
-
constructor(e, t) {
|
|
1286
|
-
let n = (e) => t.getAll().filter((t) => N(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
|
|
1287
|
-
x: e.x + e.width / 2,
|
|
1288
|
-
y: e.y + e.height / 2
|
|
1289
|
-
})), r = (e, t) => {
|
|
1290
|
-
let n, r = 9;
|
|
1291
|
-
for (let i of t) {
|
|
1292
|
-
let t = Math.abs(i - e);
|
|
1293
|
-
t <= Bt && t < r && (n = i, r = t);
|
|
1294
|
-
}
|
|
1295
|
-
return n;
|
|
1296
|
-
};
|
|
1297
|
-
e.on(["shape.move.move", "shape.move.end"], 1500, (e) => {
|
|
1298
|
-
if (e.originalEvent?.shiftKey || typeof e.x != "number" || typeof e.dx != "number" || typeof e.y != "number" || typeof e.dy != "number") return;
|
|
1299
|
-
let t = e.context?.shape;
|
|
1300
|
-
if (!t) return;
|
|
1301
|
-
let i = new Set((e.context?.shapes ?? [t]).map((e) => e.id ?? "").filter(Boolean)), a = n(i), o = t.x + t.width / 2 + e.dx, s = t.y + t.height / 2 + e.dy, c = r(o, a.map((e) => e.x));
|
|
1302
|
-
if (c !== void 0) {
|
|
1303
|
-
let t = c - o;
|
|
1304
|
-
e.dx += t, e.x += t;
|
|
1305
|
-
}
|
|
1306
|
-
let l = r(s, a.map((e) => e.y));
|
|
1307
|
-
if (l !== void 0) {
|
|
1308
|
-
let t = l - s;
|
|
1309
|
-
e.dy += t, e.y += t;
|
|
1310
|
-
}
|
|
1311
|
-
}), e.on(["create.move", "create.end"], 1500, (e) => {
|
|
1312
|
-
if (e.originalEvent?.shiftKey) return;
|
|
1313
|
-
let t = n(/* @__PURE__ */ new Set());
|
|
1314
|
-
if (typeof e.x == "number") {
|
|
1315
|
-
let n = r(e.x, t.map((e) => e.x));
|
|
1316
|
-
n !== void 0 && (typeof e.dx == "number" && (e.dx += n - e.x), e.x = n);
|
|
1317
|
-
}
|
|
1318
|
-
if (typeof e.y == "number") {
|
|
1319
|
-
let n = r(e.y, t.map((e) => e.y));
|
|
1320
|
-
n !== void 0 && (typeof e.dy == "number" && (e.dy += n - e.y), e.y = n);
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
}
|
|
1324
|
-
}]
|
|
1325
|
-
}, G = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Ht = (e, t, n = 0) => G(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), K = {
|
|
1326
|
-
draw: G(`<polyline points="3,18 8.5,7 14,14 21,4" fill="none" stroke="${A.ink}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="3" cy="18" r="2.2" fill="${A.surface}" stroke="${A.ink}" stroke-width="1.4"/>`),
|
|
1327
|
-
lasso: G(`<rect x="3" y="3" width="13" height="13" rx="2" fill="none" stroke="${A.ink}" stroke-width="1.5" stroke-dasharray="3 2.5"/><path d="M13.5 13.5l7 2.7-3 1.3-1.3 3z" fill="${A.ink}"/>`),
|
|
1328
|
-
note: Ht(T.fill, T.stroke)
|
|
1329
|
-
};
|
|
1330
|
-
for (let e of F) {
|
|
1331
|
-
let t = w[e];
|
|
1332
|
-
K[e] = Ht(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
|
|
1333
|
-
}
|
|
1334
|
-
function Ut(e, t) {
|
|
1335
|
-
return `<svg width="14" height="14" viewBox="0 0 14 14" class="event-storming-palette-svg"><rect x="1" y="1" width="12" height="12" fill="${e}" stroke="${t}" stroke-width="1"/></svg>`;
|
|
1336
|
-
}
|
|
1337
|
-
//#endregion
|
|
1338
|
-
//#region src/palette/EventStormingPaletteProvider.ts
|
|
1339
|
-
var q = "stickies-1", J = "stickies-2", Wt = "stickies-3", Gt = [
|
|
1340
|
-
{
|
|
1341
|
-
key: "event",
|
|
1342
|
-
type: "event",
|
|
1343
|
-
label: w.event.label,
|
|
1344
|
-
title: "Domain Event — E",
|
|
1345
|
-
group: q
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
key: "command",
|
|
1349
|
-
type: "command",
|
|
1350
|
-
label: w.command.label,
|
|
1351
|
-
title: "Command — C",
|
|
1352
|
-
group: q
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
key: "actor",
|
|
1356
|
-
type: "actor",
|
|
1357
|
-
label: w.actor.label,
|
|
1358
|
-
title: "Actor",
|
|
1359
|
-
group: q
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
key: "aggregate",
|
|
1363
|
-
type: "aggregate",
|
|
1364
|
-
label: w.aggregate.label,
|
|
1365
|
-
title: "Aggregate",
|
|
1366
|
-
group: q
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
key: "policy",
|
|
1370
|
-
type: "policy",
|
|
1371
|
-
label: w.policy.label,
|
|
1372
|
-
title: "Policy",
|
|
1373
|
-
group: J
|
|
1374
|
-
},
|
|
1375
|
-
{
|
|
1376
|
-
key: "readmodel",
|
|
1377
|
-
type: "readmodel",
|
|
1378
|
-
label: w.readmodel.label,
|
|
1379
|
-
title: "Read Model",
|
|
1380
|
-
group: J
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
key: "external",
|
|
1384
|
-
type: "external",
|
|
1385
|
-
label: w.external.label,
|
|
1386
|
-
title: "External System",
|
|
1387
|
-
group: J
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
key: "hotspot",
|
|
1391
|
-
type: "hotspot",
|
|
1392
|
-
label: w.hotspot.label,
|
|
1393
|
-
title: "Hotspot",
|
|
1394
|
-
group: Wt
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
key: "note",
|
|
1398
|
-
type: "note",
|
|
1399
|
-
label: T.label,
|
|
1400
|
-
title: "Note",
|
|
1401
|
-
group: Wt
|
|
1480
|
+
var on = class extends me {
|
|
1481
|
+
static $inject = ["eventBus"];
|
|
1482
|
+
constructor(e) {
|
|
1483
|
+
super(e);
|
|
1402
1484
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
"create",
|
|
1412
|
-
"eventStormingElementFactory",
|
|
1413
|
-
"lassoTool",
|
|
1414
|
-
"eventStormingDrawTool",
|
|
1415
|
-
"eventStormingModeling",
|
|
1416
|
-
"eventBus"
|
|
1417
|
-
];
|
|
1418
|
-
constructor(e, t, n, r, i, a, o) {
|
|
1419
|
-
this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, e.registerProvider(this);
|
|
1420
|
-
let s = () => e._rebuild();
|
|
1421
|
-
o.on("import.done", s), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
|
|
1422
|
-
e.context.element.id === "event-storming-root" && s();
|
|
1485
|
+
init() {
|
|
1486
|
+
this.addRule("connection.start", (e) => w(e.source)), this.addRule("connection.create", (e) => {
|
|
1487
|
+
let { source: t, target: n } = e;
|
|
1488
|
+
return !w(t) || !w(n) || t === n || rn(t, n) ? !1 : { eventStormingType: "arrow" };
|
|
1489
|
+
}), this.addRule(["shape.move", "elements.move"], (e) => an(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
|
|
1490
|
+
if (!Oe(e.shape)) return !1;
|
|
1491
|
+
let { newBounds: t } = e;
|
|
1492
|
+
return !t || t.width >= A.width && t.height >= A.height;
|
|
1423
1493
|
});
|
|
1424
1494
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
let r = (e) => {
|
|
1442
|
-
let t = this.factory.createNew(n.type, n.label);
|
|
1443
|
-
this.create.start(e, t);
|
|
1444
|
-
};
|
|
1445
|
-
e[`create.${n.key}`] = {
|
|
1446
|
-
group: n.group,
|
|
1447
|
-
title: n.title,
|
|
1448
|
-
html: `<div class="entry event-storming-palette-entry" draggable="true">${K[n.key]}</div>`,
|
|
1449
|
-
action: {
|
|
1450
|
-
dragstart: r,
|
|
1451
|
-
click: r
|
|
1495
|
+
}, sn = {
|
|
1496
|
+
__init__: ["eventStormingRules"],
|
|
1497
|
+
eventStormingRules: ["type", on]
|
|
1498
|
+
}, cn = 8, ln = {
|
|
1499
|
+
__init__: ["elementSnapping"],
|
|
1500
|
+
elementSnapping: ["type", class {
|
|
1501
|
+
static $inject = ["eventBus", "elementRegistry"];
|
|
1502
|
+
constructor(e, t) {
|
|
1503
|
+
let n = (e) => t.getAll().filter((t) => b(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
|
|
1504
|
+
x: e.x + e.width / 2,
|
|
1505
|
+
y: e.y + e.height / 2
|
|
1506
|
+
})), r = (e, t) => {
|
|
1507
|
+
let n, r = 9;
|
|
1508
|
+
for (let i of t) {
|
|
1509
|
+
let t = Math.abs(i - e);
|
|
1510
|
+
t <= cn && t < r && (n = i, r = t);
|
|
1452
1511
|
}
|
|
1512
|
+
return n;
|
|
1453
1513
|
};
|
|
1514
|
+
e.on(["shape.move.move", "shape.move.end"], 1500, (e) => {
|
|
1515
|
+
if (e.originalEvent?.shiftKey || typeof e.x != "number" || typeof e.dx != "number" || typeof e.y != "number" || typeof e.dy != "number") return;
|
|
1516
|
+
let t = e.context?.shape;
|
|
1517
|
+
if (!t) return;
|
|
1518
|
+
let i = new Set((e.context?.shapes ?? [t]).map((e) => e.id ?? "").filter(Boolean)), a = n(i), o = t.x + t.width / 2 + e.dx, s = t.y + t.height / 2 + e.dy, c = r(o, a.map((e) => e.x));
|
|
1519
|
+
if (c !== void 0) {
|
|
1520
|
+
let t = c - o;
|
|
1521
|
+
e.dx += t, e.x += t;
|
|
1522
|
+
}
|
|
1523
|
+
let l = r(s, a.map((e) => e.y));
|
|
1524
|
+
if (l !== void 0) {
|
|
1525
|
+
let t = l - s;
|
|
1526
|
+
e.dy += t, e.y += t;
|
|
1527
|
+
}
|
|
1528
|
+
}), e.on(["create.move", "create.end"], 1500, (e) => {
|
|
1529
|
+
if (e.originalEvent?.shiftKey) return;
|
|
1530
|
+
let t = n(/* @__PURE__ */ new Set());
|
|
1531
|
+
if (typeof e.x == "number") {
|
|
1532
|
+
let n = r(e.x, t.map((e) => e.x));
|
|
1533
|
+
n !== void 0 && (typeof e.dx == "number" && (e.dx += n - e.x), e.x = n);
|
|
1534
|
+
}
|
|
1535
|
+
if (typeof e.y == "number") {
|
|
1536
|
+
let n = r(e.y, t.map((e) => e.y));
|
|
1537
|
+
n !== void 0 && (typeof e.dy == "number" && (e.dy += n - e.y), e.y = n);
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1454
1540
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
}, qt = ".djs-palette-entries .entry", Jt = "bottom", Yt = class {
|
|
1541
|
+
}]
|
|
1542
|
+
}, un = ".djs-palette-entries .entry", dn = "bottom", fn = class {
|
|
1458
1543
|
palette;
|
|
1459
1544
|
hoverTooltip;
|
|
1460
1545
|
static $inject = [
|
|
@@ -1469,9 +1554,9 @@ var q = "stickies-1", J = "stickies-2", Wt = "stickies-3", Gt = [
|
|
|
1469
1554
|
attachTo(e) {
|
|
1470
1555
|
this.refreshEntries(), this.hoverTooltip.add({
|
|
1471
1556
|
container: e,
|
|
1472
|
-
selector:
|
|
1557
|
+
selector: un,
|
|
1473
1558
|
getContent: (e) => this.contentFor(e),
|
|
1474
|
-
getPosition: (e) =>
|
|
1559
|
+
getPosition: (e) => pn(e)
|
|
1475
1560
|
});
|
|
1476
1561
|
}
|
|
1477
1562
|
refreshEntries() {
|
|
@@ -1479,70 +1564,121 @@ var q = "stickies-1", J = "stickies-2", Wt = "stickies-3", Gt = [
|
|
|
1479
1564
|
}
|
|
1480
1565
|
contentFor(e) {
|
|
1481
1566
|
let t = this.entries[e.getAttribute("data-action") ?? ""];
|
|
1482
|
-
return t?.title ?
|
|
1567
|
+
return t?.title ? ge`<${he} title=${t.title} shortcut=${t.shortcut} />` : null;
|
|
1483
1568
|
}
|
|
1484
1569
|
};
|
|
1485
|
-
function
|
|
1570
|
+
function pn(e) {
|
|
1486
1571
|
let t = e.getBoundingClientRect();
|
|
1487
1572
|
return {
|
|
1488
1573
|
x: t.left + t.width / 2,
|
|
1489
1574
|
y: t.bottom + 8,
|
|
1490
|
-
placement:
|
|
1575
|
+
placement: dn
|
|
1491
1576
|
};
|
|
1492
1577
|
}
|
|
1493
1578
|
//#endregion
|
|
1494
1579
|
//#region src/palette/index.ts
|
|
1495
|
-
var
|
|
1580
|
+
var mn = {
|
|
1496
1581
|
__init__: ["eventStormingPaletteProvider", "paletteTooltip"],
|
|
1497
|
-
eventStormingPaletteProvider: ["type",
|
|
1498
|
-
paletteTooltip: ["type",
|
|
1499
|
-
},
|
|
1582
|
+
eventStormingPaletteProvider: ["type", Ue],
|
|
1583
|
+
paletteTooltip: ["type", fn]
|
|
1584
|
+
}, G = "event-storming-element-settings", hn = {
|
|
1500
1585
|
id: "kind",
|
|
1501
1586
|
name: "Change type"
|
|
1502
1587
|
};
|
|
1503
|
-
function
|
|
1588
|
+
function gn(e, t) {
|
|
1504
1589
|
return e ? `✓ ${t}` : t;
|
|
1505
1590
|
}
|
|
1506
|
-
var
|
|
1591
|
+
var _n = class {
|
|
1507
1592
|
modeling;
|
|
1508
1593
|
static $inject = ["popupMenu", "eventStormingModeling"];
|
|
1509
1594
|
constructor(e, t) {
|
|
1510
|
-
this.modeling = t, e.registerProvider(
|
|
1595
|
+
this.modeling = t, e.registerProvider(G, this);
|
|
1511
1596
|
}
|
|
1512
1597
|
getPopupMenuEntries(e) {
|
|
1513
1598
|
let t = Array.isArray(e) ? e[0] : e;
|
|
1514
|
-
return
|
|
1599
|
+
return w(t) ? this.kindEntries(t) : {};
|
|
1515
1600
|
}
|
|
1516
1601
|
kindEntries(e) {
|
|
1517
1602
|
let t = {}, n = e.provisional === !0, r = c[this.modeling.getLevel()];
|
|
1518
|
-
for (let i of
|
|
1603
|
+
for (let i of S) {
|
|
1519
1604
|
if (!r.includes(i) && (n || i !== e.eventStormingType)) continue;
|
|
1520
|
-
let a =
|
|
1605
|
+
let a = O[i];
|
|
1521
1606
|
t[`kind-${i}`] = {
|
|
1522
|
-
label: n ? a.label :
|
|
1523
|
-
imageHtml:
|
|
1524
|
-
group:
|
|
1607
|
+
label: n ? a.label : gn(e.eventStormingType === i, a.label),
|
|
1608
|
+
imageHtml: ze(a.fill, a.stroke),
|
|
1609
|
+
group: hn,
|
|
1525
1610
|
action: () => this.modeling.setStickyKind(e, i)
|
|
1526
1611
|
};
|
|
1527
1612
|
}
|
|
1528
1613
|
return t;
|
|
1529
1614
|
}
|
|
1530
|
-
},
|
|
1615
|
+
}, vn = {
|
|
1531
1616
|
__init__: ["eventStormingElementSettings"],
|
|
1532
|
-
eventStormingElementSettings: ["type",
|
|
1533
|
-
},
|
|
1534
|
-
|
|
1535
|
-
|
|
1617
|
+
eventStormingElementSettings: ["type", _n]
|
|
1618
|
+
}, K = "eventStorming.readOnly.changed", yn = 5e3, bn = [
|
|
1619
|
+
"elements.move",
|
|
1620
|
+
"shape.move",
|
|
1621
|
+
"shape.resize",
|
|
1622
|
+
"shape.create",
|
|
1623
|
+
"elements.create",
|
|
1624
|
+
"shape.append",
|
|
1625
|
+
"shape.attach",
|
|
1626
|
+
"connection.start",
|
|
1627
|
+
"connection.create",
|
|
1628
|
+
"connection.reconnect",
|
|
1629
|
+
"connection.updateWaypoints",
|
|
1630
|
+
"elements.delete"
|
|
1631
|
+
], xn = class extends me {
|
|
1632
|
+
bus;
|
|
1633
|
+
static $inject = ["eventBus"];
|
|
1634
|
+
readOnly = !1;
|
|
1635
|
+
constructor(e) {
|
|
1636
|
+
super(e), this.bus = e;
|
|
1637
|
+
}
|
|
1638
|
+
init() {
|
|
1639
|
+
this.addRule(bn, yn, () => !this.readOnly && void 0);
|
|
1640
|
+
}
|
|
1641
|
+
isReadOnly() {
|
|
1642
|
+
return this.readOnly;
|
|
1643
|
+
}
|
|
1644
|
+
setReadOnly(e) {
|
|
1645
|
+
this.readOnly !== e && (this.readOnly = e, this.bus.fire(K, { readOnly: e }));
|
|
1646
|
+
}
|
|
1647
|
+
}, Sn = {
|
|
1648
|
+
__depends__: [se],
|
|
1649
|
+
__init__: ["eventStormingReadOnly"],
|
|
1650
|
+
eventStormingReadOnly: ["type", xn]
|
|
1651
|
+
}, Cn = {
|
|
1652
|
+
plus: "<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>",
|
|
1653
|
+
"arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>",
|
|
1654
|
+
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\"/>",
|
|
1655
|
+
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\"/>",
|
|
1656
|
+
replace: "<path d=\"M14 4a1 1 0 0 1 1-1\"/><path d=\"M15 10a1 1 0 0 1-1-1\"/><path d=\"M21 4a1 1 0 0 0-1-1\"/><path d=\"M21 9a1 1 0 0 1-1 1\"/><path d=\"m3 7 3 3 3-3\"/><path d=\"M6 10V5a2 2 0 0 1 2-2h2\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>",
|
|
1657
|
+
palette: "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>",
|
|
1658
|
+
"line-style": "<path d=\"M11 5h2\"/><path d=\"M15 12h6\"/><path d=\"M19 5h2\"/><path d=\"M3 12h6\"/><path d=\"M3 19h18\"/><path d=\"M3 5h2\"/>",
|
|
1659
|
+
bold: "<path d=\"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8\"/>",
|
|
1660
|
+
italic: "<line x1=\"19\" x2=\"10\" y1=\"4\" y2=\"4\"/><line x1=\"14\" x2=\"5\" y1=\"20\" y2=\"20\"/><line x1=\"15\" x2=\"9\" y1=\"4\" y2=\"20\"/>",
|
|
1661
|
+
list: "<path d=\"M3 5h.01\"/><path d=\"M3 12h.01\"/><path d=\"M3 19h.01\"/><path d=\"M8 5h13\"/><path d=\"M8 12h13\"/><path d=\"M8 19h13\"/>",
|
|
1662
|
+
"text-align-start": "<path d=\"M21 5H3\"/><path d=\"M15 12H3\"/><path d=\"M17 19H3\"/>",
|
|
1663
|
+
"text-align-center": "<path d=\"M21 5H3\"/><path d=\"M17 12H7\"/><path d=\"M19 19H5\"/>",
|
|
1664
|
+
"text-align-end": "<path d=\"M21 5H3\"/><path d=\"M21 12H9\"/><path d=\"M21 19H7\"/>",
|
|
1665
|
+
"align-vertical-justify-start": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"16\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"6\" rx=\"2\"/><path d=\"M2 2h20\"/>",
|
|
1666
|
+
"align-vertical-justify-center": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"16\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"2\" rx=\"2\"/><path d=\"M2 12h20\"/>",
|
|
1667
|
+
"align-vertical-justify-end": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"12\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"2\" rx=\"2\"/><path d=\"M2 22h20\"/>",
|
|
1668
|
+
x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>"
|
|
1669
|
+
};
|
|
1670
|
+
function q(e) {
|
|
1671
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${Cn[e]}</svg>`;
|
|
1536
1672
|
}
|
|
1537
1673
|
//#endregion
|
|
1538
1674
|
//#region src/context-pad/EventStormingContextPadProvider.ts
|
|
1539
|
-
var
|
|
1540
|
-
function
|
|
1541
|
-
return `<div class="entry event-storming-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${
|
|
1675
|
+
var wn = "Append sticky (auto-connect, choose the type after placing)";
|
|
1676
|
+
function J(e, t, n = !1) {
|
|
1677
|
+
return `<div class="entry event-storming-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${q(e)}</div>`;
|
|
1542
1678
|
}
|
|
1543
1679
|
//#endregion
|
|
1544
1680
|
//#region src/context-pad/index.ts
|
|
1545
|
-
var
|
|
1681
|
+
var Tn = {
|
|
1546
1682
|
__init__: ["eventStormingContextPadProvider"],
|
|
1547
1683
|
eventStormingContextPadProvider: ["type", class {
|
|
1548
1684
|
modeling;
|
|
@@ -1553,6 +1689,7 @@ var Sn = {
|
|
|
1553
1689
|
labelEditing;
|
|
1554
1690
|
factory;
|
|
1555
1691
|
colorPicker;
|
|
1692
|
+
readOnly;
|
|
1556
1693
|
static $inject = [
|
|
1557
1694
|
"contextPad",
|
|
1558
1695
|
"modeling",
|
|
@@ -1562,40 +1699,45 @@ var Sn = {
|
|
|
1562
1699
|
"eventStormingModeling",
|
|
1563
1700
|
"eventStormingLabelEditing",
|
|
1564
1701
|
"eventStormingElementFactory",
|
|
1565
|
-
"eventStormingColorPicker"
|
|
1702
|
+
"eventStormingColorPicker",
|
|
1703
|
+
"eventBus",
|
|
1704
|
+
"eventStormingReadOnly"
|
|
1566
1705
|
];
|
|
1567
|
-
constructor(e, t, n, r, i, a, o, s, c) {
|
|
1568
|
-
this.modeling = t, this.connect = n, this.create = r, this.popupMenu = i, this.eventStormingModeling = a, this.labelEditing = o, this.factory = s, this.colorPicker = c, e.registerProvider(this)
|
|
1706
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u) {
|
|
1707
|
+
this.modeling = t, this.connect = n, this.create = r, this.popupMenu = i, this.eventStormingModeling = a, this.labelEditing = o, this.factory = s, this.colorPicker = c, this.readOnly = u, e.registerProvider(this), l?.on(K, (t) => {
|
|
1708
|
+
t.readOnly && e.close();
|
|
1709
|
+
});
|
|
1569
1710
|
}
|
|
1570
1711
|
getContextPadEntries(e) {
|
|
1571
|
-
if (
|
|
1712
|
+
if (this.readOnly?.isReadOnly()) return {};
|
|
1713
|
+
if (x(e)) {
|
|
1572
1714
|
let t = e;
|
|
1573
1715
|
return {
|
|
1574
1716
|
"edit-label": {
|
|
1575
1717
|
group: "edit",
|
|
1576
1718
|
title: "Edit arrow label",
|
|
1577
|
-
html:
|
|
1719
|
+
html: J("pencil", "Edit arrow label"),
|
|
1578
1720
|
action: { click: () => this.labelEditing.activateConnection(t) }
|
|
1579
1721
|
},
|
|
1580
1722
|
delete: {
|
|
1581
|
-
group: "
|
|
1723
|
+
group: "delete",
|
|
1582
1724
|
title: "Delete connection",
|
|
1583
|
-
html:
|
|
1725
|
+
html: J("trash", "Delete connection"),
|
|
1584
1726
|
action: { click: () => this.modeling.removeElements([e]) }
|
|
1585
1727
|
}
|
|
1586
1728
|
};
|
|
1587
1729
|
}
|
|
1588
|
-
if (!
|
|
1730
|
+
if (!b(e)) return {};
|
|
1589
1731
|
let t = e, n = {}, r = t.eventStormingType;
|
|
1590
|
-
if (
|
|
1732
|
+
if (C(r)) {
|
|
1591
1733
|
let e = (e) => {
|
|
1592
1734
|
let n = this.factory.createProvisional();
|
|
1593
1735
|
this.create.start(e, n, { source: t });
|
|
1594
1736
|
};
|
|
1595
1737
|
n.append = {
|
|
1596
1738
|
group: "append",
|
|
1597
|
-
title:
|
|
1598
|
-
html:
|
|
1739
|
+
title: wn,
|
|
1740
|
+
html: J("plus", wn, !0),
|
|
1599
1741
|
action: {
|
|
1600
1742
|
click: e,
|
|
1601
1743
|
dragstart: e
|
|
@@ -1607,18 +1749,18 @@ var Sn = {
|
|
|
1607
1749
|
n.connect = {
|
|
1608
1750
|
group: "edit",
|
|
1609
1751
|
title: "Connect to existing sticky",
|
|
1610
|
-
html:
|
|
1752
|
+
html: J("arrow-right", "Connect to existing sticky", !0),
|
|
1611
1753
|
action: {
|
|
1612
1754
|
click: r,
|
|
1613
1755
|
dragstart: r
|
|
1614
1756
|
}
|
|
1615
1757
|
}, n["change-kind"] = {
|
|
1616
|
-
group: "
|
|
1758
|
+
group: "edit",
|
|
1617
1759
|
title: "Change type",
|
|
1618
|
-
html:
|
|
1760
|
+
html: J("replace", "Change type"),
|
|
1619
1761
|
action: { click: (e) => {
|
|
1620
1762
|
let n = e;
|
|
1621
|
-
this.popupMenu.open(t,
|
|
1763
|
+
this.popupMenu.open(t, G, {
|
|
1622
1764
|
x: n.clientX,
|
|
1623
1765
|
y: n.clientY
|
|
1624
1766
|
});
|
|
@@ -1628,16 +1770,16 @@ var Sn = {
|
|
|
1628
1770
|
if (r === "drawing") {
|
|
1629
1771
|
let e = t.strokeStyle === "dashed" ? "dotted" : t.strokeStyle === "dotted" ? void 0 : "dashed", r = `Line style: ${t.strokeStyle ?? "solid"} (click to change)`;
|
|
1630
1772
|
n["stroke-style"] = {
|
|
1631
|
-
group: "
|
|
1773
|
+
group: "edit",
|
|
1632
1774
|
title: r,
|
|
1633
|
-
html:
|
|
1775
|
+
html: J("line-style", r),
|
|
1634
1776
|
action: { click: () => this.eventStormingModeling.setStrokeStyle(t, e) }
|
|
1635
1777
|
};
|
|
1636
1778
|
}
|
|
1637
1779
|
return r === "drawing" && (n.color = {
|
|
1638
|
-
group: "
|
|
1780
|
+
group: "edit",
|
|
1639
1781
|
title: "Color",
|
|
1640
|
-
html:
|
|
1782
|
+
html: J("palette", "Color"),
|
|
1641
1783
|
action: { click: (e) => {
|
|
1642
1784
|
let n = e;
|
|
1643
1785
|
this.colorPicker.open(t, n.clientX, n.clientY);
|
|
@@ -1645,46 +1787,46 @@ var Sn = {
|
|
|
1645
1787
|
}), r !== "drawing" && (n["edit-label"] = {
|
|
1646
1788
|
group: "edit",
|
|
1647
1789
|
title: "Edit label",
|
|
1648
|
-
html:
|
|
1790
|
+
html: J("pencil", "Edit label"),
|
|
1649
1791
|
action: { click: () => this.labelEditing.activate(t) }
|
|
1650
1792
|
}), n.delete = {
|
|
1651
|
-
group: "
|
|
1793
|
+
group: "delete",
|
|
1652
1794
|
title: "Delete",
|
|
1653
|
-
html:
|
|
1795
|
+
html: J("trash", "Delete"),
|
|
1654
1796
|
action: { click: () => this.modeling.removeElements([t]) }
|
|
1655
1797
|
}, n;
|
|
1656
1798
|
}
|
|
1657
1799
|
}]
|
|
1658
|
-
},
|
|
1800
|
+
}, En = "bullet", Dn = [
|
|
1659
1801
|
"left",
|
|
1660
1802
|
"center",
|
|
1661
1803
|
"right"
|
|
1662
|
-
],
|
|
1804
|
+
], On = [
|
|
1663
1805
|
"top",
|
|
1664
1806
|
"middle",
|
|
1665
1807
|
"bottom"
|
|
1666
1808
|
];
|
|
1667
|
-
function
|
|
1809
|
+
function kn(e, t) {
|
|
1668
1810
|
return e[(e.indexOf(t) + 1) % e.length];
|
|
1669
1811
|
}
|
|
1670
|
-
function
|
|
1812
|
+
function An(e, t) {
|
|
1671
1813
|
let n = e.ownerDocument;
|
|
1672
1814
|
e.textContent = "";
|
|
1673
|
-
for (let r of
|
|
1815
|
+
for (let r of D(t)) {
|
|
1674
1816
|
let t = n.createElement("div");
|
|
1675
|
-
r.bullet && (t.className =
|
|
1817
|
+
r.bullet && (t.className = En);
|
|
1676
1818
|
for (let e of r.runs) {
|
|
1677
1819
|
let r = n.createTextNode(e.text);
|
|
1678
|
-
e.italic && (r =
|
|
1820
|
+
e.italic && (r = jn(n, "i", r)), e.bold && (r = jn(n, "b", r)), t.appendChild(r);
|
|
1679
1821
|
}
|
|
1680
1822
|
r.runs.length === 0 && t.appendChild(n.createElement("br")), e.appendChild(t);
|
|
1681
1823
|
}
|
|
1682
1824
|
}
|
|
1683
|
-
function
|
|
1825
|
+
function jn(e, t, n) {
|
|
1684
1826
|
let r = e.createElement(t);
|
|
1685
1827
|
return r.appendChild(n), r;
|
|
1686
1828
|
}
|
|
1687
|
-
function
|
|
1829
|
+
function Mn(e) {
|
|
1688
1830
|
let t = [], n = null, r = (e) => (n = {
|
|
1689
1831
|
bullet: e,
|
|
1690
1832
|
runs: []
|
|
@@ -1705,11 +1847,11 @@ function kn(e) {
|
|
|
1705
1847
|
s.nextSibling && r(!1);
|
|
1706
1848
|
return;
|
|
1707
1849
|
}
|
|
1708
|
-
if (
|
|
1850
|
+
if (Nn(s.tagName)) {
|
|
1709
1851
|
a(s);
|
|
1710
1852
|
return;
|
|
1711
1853
|
}
|
|
1712
|
-
let c =
|
|
1854
|
+
let c = Pn(s, t, o);
|
|
1713
1855
|
for (let e of s.childNodes) i(e, c.bold, c.italic);
|
|
1714
1856
|
}, a = (e) => {
|
|
1715
1857
|
r(e.classList.contains("bullet") || e.tagName === "LI");
|
|
@@ -1717,12 +1859,12 @@ function kn(e) {
|
|
|
1717
1859
|
n = null;
|
|
1718
1860
|
};
|
|
1719
1861
|
for (let t of e.childNodes) i(t, !1, !1);
|
|
1720
|
-
return
|
|
1862
|
+
return Ae(t);
|
|
1721
1863
|
}
|
|
1722
|
-
function
|
|
1864
|
+
function Nn(e) {
|
|
1723
1865
|
return e === "DIV" || e === "P" || e === "LI";
|
|
1724
1866
|
}
|
|
1725
|
-
function
|
|
1867
|
+
function Pn(e, t, n) {
|
|
1726
1868
|
let r = e.tagName;
|
|
1727
1869
|
(r === "B" || r === "STRONG") && (t = !0), (r === "I" || r === "EM") && (n = !0);
|
|
1728
1870
|
let i = e.style.fontWeight;
|
|
@@ -1733,13 +1875,13 @@ function jn(e, t, n) {
|
|
|
1733
1875
|
italic: n
|
|
1734
1876
|
};
|
|
1735
1877
|
}
|
|
1736
|
-
function
|
|
1878
|
+
function Fn(e) {
|
|
1737
1879
|
let t = e.ownerDocument, n = t.getSelection();
|
|
1738
1880
|
if (!n) return;
|
|
1739
1881
|
let r = t.createRange();
|
|
1740
1882
|
r.selectNodeContents(e), n.removeAllRanges(), n.addRange(r);
|
|
1741
1883
|
}
|
|
1742
|
-
function
|
|
1884
|
+
function In(e, t) {
|
|
1743
1885
|
let n = e.ownerDocument;
|
|
1744
1886
|
if (typeof n.execCommand == "function" && n.execCommand("insertText", !1, t)) return;
|
|
1745
1887
|
let r = n.getSelection();
|
|
@@ -1750,207 +1892,287 @@ function Nn(e, t) {
|
|
|
1750
1892
|
let a = n.createTextNode(t);
|
|
1751
1893
|
i.insertNode(a), i.setStartAfter(a), i.collapse(!0), r.removeAllRanges(), r.addRange(i);
|
|
1752
1894
|
}
|
|
1753
|
-
function
|
|
1895
|
+
function Ln(e) {
|
|
1754
1896
|
let t = e.ownerDocument.getSelection();
|
|
1755
1897
|
if (!t || t.rangeCount === 0) return [];
|
|
1756
1898
|
let n = t.getRangeAt(0);
|
|
1757
1899
|
return e.contains(n.commonAncestorContainer) ? Array.from(e.children).filter((e) => n.intersectsNode(e)) : [];
|
|
1758
1900
|
}
|
|
1759
|
-
function
|
|
1760
|
-
|
|
1761
|
-
let t =
|
|
1901
|
+
function Rn(e) {
|
|
1902
|
+
zn(e);
|
|
1903
|
+
let t = Ln(e);
|
|
1762
1904
|
if (t.length === 0) return;
|
|
1763
|
-
let n = t.every((e) => e.classList.contains(
|
|
1764
|
-
for (let e of t) e.classList.toggle(
|
|
1905
|
+
let n = t.every((e) => e.classList.contains(En));
|
|
1906
|
+
for (let e of t) e.classList.toggle(En, !n);
|
|
1765
1907
|
}
|
|
1766
|
-
function
|
|
1908
|
+
function zn(e) {
|
|
1767
1909
|
let t = e.ownerDocument, n = null;
|
|
1768
|
-
for (let r of Array.from(e.childNodes))
|
|
1769
|
-
if (r.nodeType === Node.ELEMENT_NODE && An(r.tagName)) {
|
|
1770
|
-
n = null;
|
|
1771
|
-
continue;
|
|
1772
|
-
}
|
|
1773
|
-
n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r);
|
|
1774
|
-
}
|
|
1910
|
+
for (let r of Array.from(e.childNodes)) r.nodeType === Node.ELEMENT_NODE && Nn(r.tagName) ? n = null : (n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r));
|
|
1775
1911
|
}
|
|
1776
|
-
var
|
|
1912
|
+
var Bn = {
|
|
1777
1913
|
horizontal: {
|
|
1778
|
-
left: "
|
|
1779
|
-
center: "
|
|
1780
|
-
right: "
|
|
1914
|
+
left: "text-align-start",
|
|
1915
|
+
center: "text-align-center",
|
|
1916
|
+
right: "text-align-end"
|
|
1781
1917
|
},
|
|
1782
1918
|
vertical: {
|
|
1783
|
-
top: "
|
|
1784
|
-
middle: "
|
|
1785
|
-
bottom: "
|
|
1919
|
+
top: "align-vertical-justify-start",
|
|
1920
|
+
middle: "align-vertical-justify-center",
|
|
1921
|
+
bottom: "align-vertical-justify-end"
|
|
1786
1922
|
}
|
|
1787
1923
|
};
|
|
1788
|
-
function
|
|
1924
|
+
function Vn(e, t) {
|
|
1789
1925
|
let n = e.createElement("div");
|
|
1790
1926
|
n.className = "event-storming-note-toolbar";
|
|
1791
1927
|
let r = (r, i, a) => {
|
|
1792
1928
|
let o = e.createElement("button");
|
|
1793
1929
|
o.type = "button", o.setAttribute("data-action", r), o.title = i, o.innerHTML = a, o.addEventListener("mousedown", (e) => e.preventDefault()), o.addEventListener("click", () => t(r)), n.appendChild(o);
|
|
1794
1930
|
};
|
|
1795
|
-
r("note-bold", "Bold (Cmd/Ctrl+B)", "
|
|
1931
|
+
r("note-bold", "Bold (Cmd/Ctrl+B)", q("bold")), r("note-italic", "Italic (Cmd/Ctrl+I)", q("italic")), r("note-bullet", "Bullet list", q("list"));
|
|
1796
1932
|
let i = e.createElement("span");
|
|
1797
1933
|
return i.className = "event-storming-note-toolbar-separator", n.appendChild(i), r("note-align-horizontal", "Horizontal alignment (click to cycle)", ""), r("note-align-vertical", "Vertical alignment (click to cycle)", ""), n;
|
|
1798
1934
|
}
|
|
1799
|
-
function
|
|
1800
|
-
|
|
1935
|
+
function Hn(e, t, n) {
|
|
1936
|
+
let r = Bn[t][n];
|
|
1937
|
+
e.innerHTML = r ? q(r) : "", e.title = t === "horizontal" ? `Horizontal alignment: ${n} (click to cycle)` : `Vertical alignment: ${n} (click to cycle)`;
|
|
1801
1938
|
}
|
|
1802
|
-
function
|
|
1939
|
+
function Un(e, t) {
|
|
1803
1940
|
e.style.textAlign = t.horizontal, e.style.justifyContent = t.vertical === "top" ? "flex-start" : t.vertical === "middle" ? "center" : "flex-end";
|
|
1804
1941
|
}
|
|
1805
1942
|
//#endregion
|
|
1806
1943
|
//#region src/label-editing/EventStormingLabelEditing.ts
|
|
1807
|
-
function
|
|
1944
|
+
function Wn(e) {
|
|
1808
1945
|
return e.replace(/(?<!:)\/\//g, "∕∕").replace(/\/\*/g, "∕*").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
1809
1946
|
}
|
|
1810
|
-
var
|
|
1947
|
+
var Gn = class {
|
|
1811
1948
|
canvas;
|
|
1812
1949
|
modeling;
|
|
1950
|
+
elementRegistry;
|
|
1951
|
+
readOnly;
|
|
1813
1952
|
static $inject = [
|
|
1814
1953
|
"eventBus",
|
|
1815
1954
|
"canvas",
|
|
1816
|
-
"eventStormingModeling"
|
|
1955
|
+
"eventStormingModeling",
|
|
1956
|
+
"elementRegistry",
|
|
1957
|
+
"eventStormingReadOnly"
|
|
1817
1958
|
];
|
|
1818
1959
|
active = null;
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1960
|
+
suspended = null;
|
|
1961
|
+
resumeTimer;
|
|
1962
|
+
constructor(e, t, n, r, i) {
|
|
1963
|
+
this.canvas = t, this.modeling = n, this.elementRegistry = r, this.readOnly = i, e.on(K, (e) => {
|
|
1964
|
+
e.readOnly && this.cancel();
|
|
1965
|
+
}), e.on("diagram.destroy", () => {
|
|
1966
|
+
clearTimeout(this.resumeTimer), this.suspended = null, this.cancel();
|
|
1967
|
+
}), e.on("element.dblclick", (e) => {
|
|
1968
|
+
b(e.element) ? this.activate(e.element) : x(e.element) && this.activateConnection(e.element);
|
|
1969
|
+
}), e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changed", () => this.active?.place());
|
|
1970
|
+
}
|
|
1971
|
+
suspend() {
|
|
1972
|
+
clearTimeout(this.resumeTimer), this.active && (this.suspended = this.active.snapshot(), this.active.cleanup());
|
|
1973
|
+
}
|
|
1974
|
+
resumeAfterImport() {
|
|
1975
|
+
clearTimeout(this.resumeTimer), this.suspended && (this.resumeTimer = setTimeout(() => {
|
|
1976
|
+
let e = this.suspended;
|
|
1977
|
+
this.suspended = null, e && !this.active && this.resume(e);
|
|
1978
|
+
}, 0));
|
|
1979
|
+
}
|
|
1980
|
+
resume(e) {
|
|
1981
|
+
let t = this.elementRegistry?.get(e.elementId);
|
|
1982
|
+
if (e.connection) {
|
|
1983
|
+
if (!x(t)) return;
|
|
1984
|
+
this.activateConnection(t);
|
|
1985
|
+
} else {
|
|
1986
|
+
if (!b(t)) return;
|
|
1987
|
+
this.activate(t);
|
|
1988
|
+
}
|
|
1989
|
+
let n = this.active?.field;
|
|
1990
|
+
n && (n instanceof HTMLTextAreaElement || n instanceof HTMLInputElement ? (n.value = e.value, n instanceof HTMLTextAreaElement && (n.rows = Math.max(2, e.value.split("\n").length)), n.setSelectionRange(e.selectionStart ?? e.value.length, e.selectionEnd ?? e.value.length)) : (An(n, e.value), e.align && this.restoreNoteAlign?.(e.align), qn(n)));
|
|
1827
1991
|
}
|
|
1992
|
+
restoreNoteAlign;
|
|
1828
1993
|
activate(e) {
|
|
1829
|
-
if (this.active?.commit(), e.eventStormingType === "drawing") return;
|
|
1994
|
+
if (this.active?.commit(), this.readOnly?.isReadOnly() || e.eventStormingType === "drawing") return;
|
|
1830
1995
|
if (e.eventStormingType === "note") {
|
|
1831
1996
|
this.activateNote(e);
|
|
1832
1997
|
return;
|
|
1833
1998
|
}
|
|
1834
|
-
let t = this.canvas.getContainer(), n =
|
|
1835
|
-
|
|
1836
|
-
let
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1999
|
+
let t = this.canvas.getContainer(), n = document.createElement("textarea");
|
|
2000
|
+
n.className = "event-storming-label-input event-storming-label-textarea", n.value = e.eventStormingLabel ?? "", n.rows = Math.max(2, n.value.split("\n").length), n.wrap = "off", n.style.position = "absolute", n.style.transform = "translate(-50%, -50%)";
|
|
2001
|
+
let r = () => {
|
|
2002
|
+
let t = this.canvas.zoom(), r = this.canvas.viewbox();
|
|
2003
|
+
n.style.left = `${(e.x + e.width / 2 - r.x) * t}px`, n.style.top = `${(e.y + e.height / 2 - r.y) * t}px`, n.style.width = `${e.width * t}px`;
|
|
2004
|
+
};
|
|
2005
|
+
r(), t.appendChild(n), n.focus(), n.select();
|
|
2006
|
+
let i = !1, a = () => {
|
|
2007
|
+
i || (i = !0, n.removeEventListener("keydown", s), n.removeEventListener("blur", c), n.remove(), this.active = null, this.canvas.restoreFocus?.());
|
|
2008
|
+
}, o = () => {
|
|
2009
|
+
if (i) return;
|
|
2010
|
+
let t = Wn(n.value), r = t && t !== e.eventStormingLabel;
|
|
2011
|
+
a(), r && this.modeling.updateLabel(e, t);
|
|
2012
|
+
}, s = (e) => {
|
|
2013
|
+
if (e.key === "Escape") e.preventDefault(), a();
|
|
2014
|
+
else if (e.key === "Enter") {
|
|
1848
2015
|
if (!(e.metaKey || e.ctrlKey)) return;
|
|
1849
|
-
e.preventDefault(),
|
|
2016
|
+
e.preventDefault(), o();
|
|
1850
2017
|
}
|
|
1851
|
-
},
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2018
|
+
}, c = () => o();
|
|
2019
|
+
n.addEventListener("keydown", s), n.addEventListener("blur", c);
|
|
2020
|
+
let l = () => ({
|
|
2021
|
+
elementId: e.id,
|
|
2022
|
+
connection: !1,
|
|
2023
|
+
value: n.value,
|
|
2024
|
+
selectionStart: n.selectionStart ?? void 0,
|
|
2025
|
+
selectionEnd: n.selectionEnd ?? void 0
|
|
2026
|
+
});
|
|
2027
|
+
this.active = {
|
|
2028
|
+
field: n,
|
|
2029
|
+
place: r,
|
|
2030
|
+
commit: o,
|
|
2031
|
+
cleanup: a,
|
|
2032
|
+
snapshot: l
|
|
1856
2033
|
};
|
|
1857
2034
|
}
|
|
1858
2035
|
activateNote(e) {
|
|
1859
|
-
let t = this.canvas.getContainer(), n =
|
|
1860
|
-
|
|
1861
|
-
let
|
|
2036
|
+
let t = this.canvas.getContainer(), n = document.createElement("div");
|
|
2037
|
+
n.className = "event-storming-label-input event-storming-note-editor", n.contentEditable = "true", n.style.position = "absolute", n.style.transform = "translate(-50%, -50%)", An(n, e.eventStormingLabel ?? "");
|
|
2038
|
+
let r = {
|
|
1862
2039
|
horizontal: e.alignHorizontal ?? "left",
|
|
1863
2040
|
vertical: e.alignVertical ?? "top"
|
|
1864
2041
|
};
|
|
1865
|
-
|
|
1866
|
-
let
|
|
1867
|
-
|
|
1868
|
-
let
|
|
1869
|
-
let
|
|
2042
|
+
Un(n, r);
|
|
2043
|
+
let i = Vn(document, (e) => d(e));
|
|
2044
|
+
i.style.transform = "translate(-50%, -100%)";
|
|
2045
|
+
let a = () => {
|
|
2046
|
+
let t = this.canvas.zoom(), r = this.canvas.viewbox(), a = (e.x + e.width / 2 - r.x) * t;
|
|
2047
|
+
n.style.left = `${a}px`, n.style.top = `${(e.y + e.height / 2 - r.y) * t}px`, n.style.minWidth = `${e.width * t}px`, n.style.minHeight = `${e.height * t}px`, i.style.left = `${a}px`, i.style.top = `${(e.y - r.y) * t - 8}px`;
|
|
2048
|
+
};
|
|
2049
|
+
a(), t.appendChild(n), t.appendChild(i), n.focus(), Fn(n);
|
|
2050
|
+
let o = (e) => i.querySelector(`[data-action="${e}"]`), s = (e, t) => {
|
|
2051
|
+
let n = o(e);
|
|
1870
2052
|
n?.classList.toggle("active", t), n?.setAttribute("aria-pressed", String(t));
|
|
1871
|
-
},
|
|
1872
|
-
|
|
1873
|
-
let e =
|
|
1874
|
-
|
|
1875
|
-
let t =
|
|
1876
|
-
t &&
|
|
1877
|
-
let
|
|
1878
|
-
|
|
1879
|
-
},
|
|
1880
|
-
typeof document.execCommand == "function" && document.execCommand(e, !1),
|
|
1881
|
-
},
|
|
1882
|
-
e === "horizontal" ?
|
|
1883
|
-
},
|
|
1884
|
-
e === "note-bold" ?
|
|
1885
|
-
},
|
|
1886
|
-
document.addEventListener("selectionchange",
|
|
1887
|
-
let
|
|
1888
|
-
|
|
1889
|
-
},
|
|
1890
|
-
if (
|
|
1891
|
-
let t =
|
|
1892
|
-
|
|
1893
|
-
},
|
|
2053
|
+
}, c = () => {
|
|
2054
|
+
s("note-bold", Jn("bold")), s("note-italic", Jn("italic"));
|
|
2055
|
+
let e = Ln(n);
|
|
2056
|
+
s("note-bullet", e.length > 0 && e.every((e) => e.classList.contains("bullet")));
|
|
2057
|
+
let t = o("note-align-horizontal");
|
|
2058
|
+
t && Hn(t, "horizontal", r.horizontal);
|
|
2059
|
+
let i = o("note-align-vertical");
|
|
2060
|
+
i && Hn(i, "vertical", r.vertical);
|
|
2061
|
+
}, l = (e) => {
|
|
2062
|
+
typeof document.execCommand == "function" && document.execCommand(e, !1), c();
|
|
2063
|
+
}, u = (e) => {
|
|
2064
|
+
e === "horizontal" ? r.horizontal = kn(Dn, r.horizontal) : r.vertical = kn(On, r.vertical), Un(n, r), c();
|
|
2065
|
+
}, d = (e) => {
|
|
2066
|
+
e === "note-bold" ? l("bold") : e === "note-italic" ? l("italic") : e === "note-bullet" ? (Rn(n), c()) : u(e === "note-align-horizontal" ? "horizontal" : "vertical");
|
|
2067
|
+
}, f = () => c();
|
|
2068
|
+
document.addEventListener("selectionchange", f);
|
|
2069
|
+
let p = !1, m = () => {
|
|
2070
|
+
p || (p = !0, document.removeEventListener("selectionchange", f), n.removeEventListener("keydown", g), n.removeEventListener("blur", _), n.removeEventListener("paste", v), n.remove(), i.remove(), this.active = null, this.restoreNoteAlign = void 0, this.canvas.restoreFocus?.());
|
|
2071
|
+
}, h = () => {
|
|
2072
|
+
if (p) return;
|
|
2073
|
+
let t = Kn(e, Wn(Mn(n)), r);
|
|
2074
|
+
m(), t && this.modeling.updateProperties(e, t);
|
|
2075
|
+
}, g = (e) => {
|
|
1894
2076
|
if (e.key === "Escape") {
|
|
1895
|
-
e.preventDefault(),
|
|
2077
|
+
e.preventDefault(), m();
|
|
1896
2078
|
return;
|
|
1897
2079
|
}
|
|
1898
2080
|
if (e.key === "Enter") {
|
|
1899
2081
|
if (!(e.metaKey || e.ctrlKey)) return;
|
|
1900
|
-
e.preventDefault(),
|
|
2082
|
+
e.preventDefault(), h();
|
|
1901
2083
|
return;
|
|
1902
2084
|
}
|
|
1903
2085
|
let t = e.key.toLowerCase();
|
|
1904
|
-
(e.metaKey || e.ctrlKey) && (t === "b" || t === "i") && (e.preventDefault(),
|
|
1905
|
-
},
|
|
1906
|
-
e.relatedTarget instanceof Node &&
|
|
1907
|
-
},
|
|
2086
|
+
(e.metaKey || e.ctrlKey) && (t === "b" || t === "i") && (e.preventDefault(), l(t === "b" ? "bold" : "italic"));
|
|
2087
|
+
}, _ = (e) => {
|
|
2088
|
+
e.relatedTarget instanceof Node && i.contains(e.relatedTarget) || h();
|
|
2089
|
+
}, v = (e) => {
|
|
1908
2090
|
e.preventDefault();
|
|
1909
2091
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1910
|
-
t &&
|
|
2092
|
+
t && In(n, t);
|
|
1911
2093
|
};
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2094
|
+
n.addEventListener("keydown", g), n.addEventListener("blur", _), n.addEventListener("paste", v), c(), this.restoreNoteAlign = (e) => {
|
|
2095
|
+
r.horizontal = e.horizontal, r.vertical = e.vertical, Un(n, r), c();
|
|
2096
|
+
};
|
|
2097
|
+
let ee = () => ({
|
|
2098
|
+
elementId: e.id,
|
|
2099
|
+
connection: !1,
|
|
2100
|
+
value: Mn(n),
|
|
2101
|
+
align: { ...r }
|
|
2102
|
+
});
|
|
2103
|
+
this.active = {
|
|
2104
|
+
field: n,
|
|
2105
|
+
place: a,
|
|
2106
|
+
commit: h,
|
|
2107
|
+
cleanup: m,
|
|
2108
|
+
snapshot: ee
|
|
1916
2109
|
};
|
|
1917
2110
|
}
|
|
1918
2111
|
activateConnection(e) {
|
|
1919
|
-
this.active?.commit();
|
|
1920
|
-
let t = this.canvas.getContainer(), n =
|
|
1921
|
-
if (!
|
|
1922
|
-
let
|
|
1923
|
-
|
|
1924
|
-
let
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
2112
|
+
if (this.active?.commit(), this.readOnly?.isReadOnly()) return;
|
|
2113
|
+
let t = this.canvas.getContainer(), n = e.waypoints[0], r = e.waypoints[e.waypoints.length - 1];
|
|
2114
|
+
if (!n || !r) return;
|
|
2115
|
+
let i = document.createElement("input");
|
|
2116
|
+
i.type = "text", i.className = "event-storming-label-input", i.placeholder = "arrow label", i.value = e.linkLabel ?? "", i.style.position = "absolute";
|
|
2117
|
+
let a = () => {
|
|
2118
|
+
let e = this.canvas.zoom(), t = this.canvas.viewbox();
|
|
2119
|
+
i.style.left = `${((n.x + r.x) / 2 - 60 - t.x) * e}px`, i.style.top = `${((n.y + r.y) / 2 - 26 - t.y) * e}px`;
|
|
2120
|
+
};
|
|
2121
|
+
a(), t.appendChild(i), i.focus(), i.select();
|
|
2122
|
+
let o = !1, s = () => {
|
|
2123
|
+
o || (o = !0, i.removeEventListener("keydown", l), i.removeEventListener("blur", u), i.remove(), this.active = null, this.canvas.restoreFocus?.());
|
|
2124
|
+
}, c = () => {
|
|
2125
|
+
if (o) return;
|
|
2126
|
+
let t = Wn(i.value), n = e.linkLabel ?? "";
|
|
2127
|
+
s(), t !== n && this.modeling.updateProperties(e, { linkLabel: t || void 0 });
|
|
2128
|
+
}, l = (e) => {
|
|
2129
|
+
e.key === "Escape" ? (e.preventDefault(), s()) : e.key === "Enter" && (e.preventDefault(), c());
|
|
2130
|
+
}, u = () => c();
|
|
2131
|
+
i.addEventListener("keydown", l), i.addEventListener("blur", u);
|
|
2132
|
+
let d = () => ({
|
|
2133
|
+
elementId: e.id,
|
|
2134
|
+
connection: !0,
|
|
2135
|
+
value: i.value,
|
|
2136
|
+
selectionStart: i.selectionStart ?? void 0,
|
|
2137
|
+
selectionEnd: i.selectionEnd ?? void 0
|
|
2138
|
+
});
|
|
2139
|
+
this.active = {
|
|
2140
|
+
field: i,
|
|
2141
|
+
place: a,
|
|
2142
|
+
commit: c,
|
|
2143
|
+
cleanup: s,
|
|
2144
|
+
snapshot: d
|
|
1937
2145
|
};
|
|
1938
2146
|
}
|
|
1939
2147
|
cancel() {
|
|
1940
2148
|
this.active?.cleanup();
|
|
1941
2149
|
}
|
|
2150
|
+
openEdit() {
|
|
2151
|
+
if (!this.active) return;
|
|
2152
|
+
let { elementId: e, value: t } = this.active.snapshot();
|
|
2153
|
+
return {
|
|
2154
|
+
elementId: e,
|
|
2155
|
+
value: t
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
1942
2158
|
};
|
|
1943
|
-
function
|
|
2159
|
+
function Kn(e, t, n) {
|
|
1944
2160
|
let r = !!t && t !== e.eventStormingLabel, i = n.horizontal !== (e.alignHorizontal ?? "left") || n.vertical !== (e.alignVertical ?? "top");
|
|
1945
2161
|
if (!r && !i) return null;
|
|
1946
2162
|
let a = {};
|
|
1947
|
-
if (r && (a.eventStormingLabel = t, !
|
|
1948
|
-
let { width: n, height: r } =
|
|
2163
|
+
if (r && (a.eventStormingLabel = t, !N(e.eventStormingLabel, e))) {
|
|
2164
|
+
let { width: n, height: r } = M(t);
|
|
1949
2165
|
a.width = n, a.height = r, a.x = e.x + e.width / 2 - n / 2, a.y = e.y + e.height / 2 - r / 2;
|
|
1950
2166
|
}
|
|
1951
2167
|
return i && (a.alignHorizontal = n.horizontal === "left" ? void 0 : n.horizontal, a.alignVertical = n.vertical === "top" ? void 0 : n.vertical), a;
|
|
1952
2168
|
}
|
|
1953
|
-
function
|
|
2169
|
+
function qn(e) {
|
|
2170
|
+
let t = document.createRange();
|
|
2171
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
2172
|
+
let n = window.getSelection();
|
|
2173
|
+
n?.removeAllRanges(), n?.addRange(t);
|
|
2174
|
+
}
|
|
2175
|
+
function Jn(e) {
|
|
1954
2176
|
if (typeof document.queryCommandState != "function") return !1;
|
|
1955
2177
|
try {
|
|
1956
2178
|
return document.queryCommandState(e);
|
|
@@ -1960,10 +2182,10 @@ function Wn(e) {
|
|
|
1960
2182
|
}
|
|
1961
2183
|
//#endregion
|
|
1962
2184
|
//#region src/label-editing/index.ts
|
|
1963
|
-
var
|
|
2185
|
+
var Yn = {
|
|
1964
2186
|
__init__: ["eventStormingLabelEditing"],
|
|
1965
|
-
eventStormingLabelEditing: ["type",
|
|
1966
|
-
},
|
|
2187
|
+
eventStormingLabelEditing: ["type", Gn]
|
|
2188
|
+
}, Xn = 2, Zn = 10, Qn = {
|
|
1967
2189
|
arrowleft: {
|
|
1968
2190
|
x: -1,
|
|
1969
2191
|
y: 0
|
|
@@ -1980,8 +2202,9 @@ var Gn = {
|
|
|
1980
2202
|
x: 0,
|
|
1981
2203
|
y: 1
|
|
1982
2204
|
}
|
|
1983
|
-
},
|
|
2205
|
+
}, $n = class {
|
|
1984
2206
|
static $inject = [
|
|
2207
|
+
"config.eventStormingKeyboard",
|
|
1985
2208
|
"canvas",
|
|
1986
2209
|
"commandStack",
|
|
1987
2210
|
"selection",
|
|
@@ -1991,59 +2214,72 @@ var Gn = {
|
|
|
1991
2214
|
"create",
|
|
1992
2215
|
"mouse",
|
|
1993
2216
|
"lassoTool",
|
|
1994
|
-
"eventBus"
|
|
2217
|
+
"eventBus",
|
|
2218
|
+
"elementRegistry",
|
|
2219
|
+
"eventStormingReadOnly"
|
|
1995
2220
|
];
|
|
1996
|
-
constructor(e, t, n, r, i, a, o, s, c, l) {
|
|
1997
|
-
let
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
else if (
|
|
2006
|
-
else if (
|
|
2007
|
-
|
|
2008
|
-
let t =
|
|
2009
|
-
t
|
|
2010
|
-
} else
|
|
2011
|
-
|
|
2221
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
2222
|
+
let p = t.getContainer(), m = e?.undoRedoKeys ?? !0, h = (e) => {
|
|
2223
|
+
e.defaultPrevented || er(e.target, p) && (tr(e.target) || g(e) || f?.isReadOnly() || _(e));
|
|
2224
|
+
}, g = (e) => {
|
|
2225
|
+
let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
|
|
2226
|
+
if (t && n === "a" && !e.shiftKey && !e.altKey) {
|
|
2227
|
+
e.preventDefault();
|
|
2228
|
+
let t = (d?.getAll() ?? []).filter((e) => b(e) || x(e));
|
|
2229
|
+
r.select(t);
|
|
2230
|
+
} else if (t && n === "c") a.copy() && e.preventDefault();
|
|
2231
|
+
else if (!t && !e.altKey && n === "l") {
|
|
2232
|
+
e.preventDefault();
|
|
2233
|
+
let t = c.getLastMoveEvent();
|
|
2234
|
+
l.activateSelection(t ?? e, !!t);
|
|
2235
|
+
} else return !1;
|
|
2236
|
+
return !0;
|
|
2237
|
+
}, _ = (e) => {
|
|
2238
|
+
let t = e.ctrlKey || e.metaKey, l = e.key.toLowerCase(), u = t && l === "z" && !e.shiftKey, d = t && l === "z" && e.shiftKey || t && l === "y";
|
|
2239
|
+
if (u || d) {
|
|
2240
|
+
if (!m) return;
|
|
2241
|
+
e.preventDefault(), u ? n.undo() : n.redo();
|
|
2242
|
+
} else if (t && l === "v") a.paste() && e.preventDefault();
|
|
2243
|
+
else if (t && l === "d") e.preventDefault(), a.duplicate();
|
|
2244
|
+
else if (l === "delete" || l === "backspace") {
|
|
2245
|
+
let t = r.get();
|
|
2246
|
+
t.length && (e.preventDefault(), i.removeElements(t));
|
|
2247
|
+
} else if (!t && !e.altKey && (l === "e" || l === "c")) {
|
|
2248
|
+
let t = c.getLastMoveEvent();
|
|
2012
2249
|
if (t) {
|
|
2013
2250
|
e.preventDefault();
|
|
2014
|
-
let n =
|
|
2015
|
-
|
|
2251
|
+
let n = l === "e" ? o.createNew("event", O.event.label) : o.createNew("command", O.command.label);
|
|
2252
|
+
s.start(t, n);
|
|
2016
2253
|
}
|
|
2017
|
-
} else if (
|
|
2018
|
-
|
|
2019
|
-
let t = s.getLastMoveEvent();
|
|
2020
|
-
c.activateSelection(t ?? e, !!t);
|
|
2021
|
-
} else if (u in Jn && !l) {
|
|
2022
|
-
let t = n.get();
|
|
2254
|
+
} else if (l in Qn && !t) {
|
|
2255
|
+
let t = r.get();
|
|
2023
2256
|
if (t.length) {
|
|
2024
2257
|
e.preventDefault();
|
|
2025
|
-
let n = e.shiftKey ?
|
|
2026
|
-
|
|
2027
|
-
x:
|
|
2028
|
-
y:
|
|
2258
|
+
let n = e.shiftKey ? Zn : Xn, r = Qn[l];
|
|
2259
|
+
i.moveElements(t, {
|
|
2260
|
+
x: r.x * n,
|
|
2261
|
+
y: r.y * n
|
|
2029
2262
|
});
|
|
2030
2263
|
}
|
|
2031
2264
|
}
|
|
2032
2265
|
};
|
|
2033
|
-
document.addEventListener("keydown",
|
|
2266
|
+
document.addEventListener("keydown", h), u.on("diagram.destroy", () => document.removeEventListener("keydown", h));
|
|
2034
2267
|
}
|
|
2035
2268
|
};
|
|
2036
|
-
function
|
|
2269
|
+
function er(e, t) {
|
|
2270
|
+
return e instanceof Node ? t.contains(e) || e === document.body || e === document.documentElement : !1;
|
|
2271
|
+
}
|
|
2272
|
+
function tr(e) {
|
|
2037
2273
|
if (!(e instanceof HTMLElement)) return !1;
|
|
2038
2274
|
let t = e.tagName;
|
|
2039
2275
|
return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
|
|
2040
2276
|
}
|
|
2041
2277
|
//#endregion
|
|
2042
2278
|
//#region src/keyboard/index.ts
|
|
2043
|
-
var
|
|
2279
|
+
var nr = {
|
|
2044
2280
|
__init__: ["eventStormingKeyboard"],
|
|
2045
|
-
eventStormingKeyboard: ["type",
|
|
2046
|
-
},
|
|
2281
|
+
eventStormingKeyboard: ["type", $n]
|
|
2282
|
+
}, rr = 500, ir = 6, ar = class {
|
|
2047
2283
|
static $inject = ["injector", "eventBus"];
|
|
2048
2284
|
constructor(e, t) {
|
|
2049
2285
|
let n = e.get("connectionPreview", !1), r = e.get("eventStormingLabelEditing", !1), i = e.get("popupMenu", !1), a = e.get("modeling", !1), o = e.get("canvas", !1), s = !1;
|
|
@@ -2074,26 +2310,16 @@ var Zn = {
|
|
|
2074
2310
|
let c = (e) => {
|
|
2075
2311
|
if (s || !e.parent || !i || !a || !o) return;
|
|
2076
2312
|
let n = o.getAbsoluteBBox(e), c = o.getContainer().getBoundingClientRect();
|
|
2077
|
-
|
|
2313
|
+
i.open(e, G, {
|
|
2078
2314
|
x: c.left + n.x,
|
|
2079
|
-
y: c.top + n.y + n.height +
|
|
2080
|
-
}),
|
|
2081
|
-
a.removeElements([e]);
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
t.once("popupMenu.close", () => {
|
|
2315
|
+
y: c.top + n.y + n.height + ir
|
|
2316
|
+
}), i.isOpen() ? t.once("popupMenu.close", () => {
|
|
2085
2317
|
setTimeout(() => {
|
|
2086
|
-
|
|
2087
|
-
if (e.provisional) {
|
|
2088
|
-
e.parent && a.removeElements([e]);
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
r?.activate(e);
|
|
2092
|
-
}
|
|
2318
|
+
s || (e.provisional ? e.parent && a.removeElements([e]) : r?.activate(e));
|
|
2093
2319
|
}, 0);
|
|
2094
|
-
});
|
|
2320
|
+
}) : a.removeElements([e]);
|
|
2095
2321
|
};
|
|
2096
|
-
t.on("create.end",
|
|
2322
|
+
t.on("create.end", rr, (e) => {
|
|
2097
2323
|
let { context: t } = e;
|
|
2098
2324
|
if (!t.source || !t.canExecute || !t.shape) return;
|
|
2099
2325
|
let n = t.shape;
|
|
@@ -2107,19 +2333,17 @@ var Zn = {
|
|
|
2107
2333
|
return;
|
|
2108
2334
|
}
|
|
2109
2335
|
setTimeout(() => c(n), 0);
|
|
2110
|
-
|
|
2111
|
-
}
|
|
2112
|
-
r && setTimeout(() => r.activate(n), 0);
|
|
2336
|
+
} else r && setTimeout(() => r.activate(n), 0);
|
|
2113
2337
|
});
|
|
2114
2338
|
}
|
|
2115
|
-
},
|
|
2116
|
-
__depends__: [
|
|
2339
|
+
}, or = {
|
|
2340
|
+
__depends__: [_e],
|
|
2117
2341
|
__init__: ["eventStormingAppendBehavior"],
|
|
2118
|
-
eventStormingAppendBehavior: ["type",
|
|
2119
|
-
},
|
|
2120
|
-
value:
|
|
2121
|
-
title:
|
|
2122
|
-
})),
|
|
2342
|
+
eventStormingAppendBehavior: ["type", ar]
|
|
2343
|
+
}, sr = S.map((e) => ({
|
|
2344
|
+
value: O[e].fill,
|
|
2345
|
+
title: O[e].label
|
|
2346
|
+
})), cr = class {
|
|
2123
2347
|
canvas;
|
|
2124
2348
|
modeling;
|
|
2125
2349
|
static $inject = [
|
|
@@ -2149,7 +2373,7 @@ var Zn = {
|
|
|
2149
2373
|
value: void 0,
|
|
2150
2374
|
title: "No color",
|
|
2151
2375
|
cls: "event-storming-cp-none"
|
|
2152
|
-
}, ...
|
|
2376
|
+
}, ...sr.map((e) => ({
|
|
2153
2377
|
value: e.value,
|
|
2154
2378
|
title: e.title,
|
|
2155
2379
|
cls: ""
|
|
@@ -2169,12 +2393,12 @@ var Zn = {
|
|
|
2169
2393
|
close() {
|
|
2170
2394
|
this.popover && (this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0));
|
|
2171
2395
|
}
|
|
2172
|
-
},
|
|
2396
|
+
}, lr = {
|
|
2173
2397
|
__init__: ["eventStormingColorPicker"],
|
|
2174
|
-
eventStormingColorPicker: ["type",
|
|
2175
|
-
},
|
|
2398
|
+
eventStormingColorPicker: ["type", cr]
|
|
2399
|
+
}, ur = {
|
|
2176
2400
|
__init__: ["eventStormingOrderingProvider"],
|
|
2177
|
-
eventStormingOrderingProvider: ["type", class extends
|
|
2401
|
+
eventStormingOrderingProvider: ["type", class extends ve {
|
|
2178
2402
|
static $inject = ["eventBus"];
|
|
2179
2403
|
constructor(e) {
|
|
2180
2404
|
super(e);
|
|
@@ -2182,15 +2406,15 @@ var Zn = {
|
|
|
2182
2406
|
getOrdering(e, t) {
|
|
2183
2407
|
for (; t.parent;) t = t.parent;
|
|
2184
2408
|
let n = t.children ?? [];
|
|
2185
|
-
if (
|
|
2186
|
-
let r = n.filter((t) => t !== e && (
|
|
2409
|
+
if (x(e)) {
|
|
2410
|
+
let r = n.filter((t) => t !== e && (T(t) || x(t))).length;
|
|
2187
2411
|
return {
|
|
2188
2412
|
parent: t,
|
|
2189
2413
|
index: r
|
|
2190
2414
|
};
|
|
2191
2415
|
}
|
|
2192
|
-
if (
|
|
2193
|
-
let r = n.filter((t) => t !== e &&
|
|
2416
|
+
if (T(e)) {
|
|
2417
|
+
let r = n.filter((t) => t !== e && T(t)).length;
|
|
2194
2418
|
return {
|
|
2195
2419
|
parent: t,
|
|
2196
2420
|
index: r
|
|
@@ -2199,7 +2423,7 @@ var Zn = {
|
|
|
2199
2423
|
return { parent: t };
|
|
2200
2424
|
}
|
|
2201
2425
|
}]
|
|
2202
|
-
},
|
|
2426
|
+
}, dr = 12, fr = class {
|
|
2203
2427
|
canvas;
|
|
2204
2428
|
eventBus;
|
|
2205
2429
|
modeling;
|
|
@@ -2217,7 +2441,9 @@ var Zn = {
|
|
|
2217
2441
|
cursor = null;
|
|
2218
2442
|
layer = null;
|
|
2219
2443
|
constructor(e, t, n, r, i) {
|
|
2220
|
-
this.canvas = e, this.eventBus = t, this.modeling = n, this.selection = r, this.factory = i, t.on("diagram.destroy", () => this.cancel())
|
|
2444
|
+
this.canvas = e, this.eventBus = t, this.modeling = n, this.selection = r, this.factory = i, t.on("diagram.destroy", () => this.cancel()), t.on(K, (e) => {
|
|
2445
|
+
e.readOnly && this.cancel();
|
|
2446
|
+
});
|
|
2221
2447
|
}
|
|
2222
2448
|
isActive() {
|
|
2223
2449
|
return this.active;
|
|
@@ -2276,16 +2502,12 @@ var Zn = {
|
|
|
2276
2502
|
if (e.button !== 0 || this.isChromeTarget(e)) return;
|
|
2277
2503
|
e.preventDefault(), e.stopPropagation();
|
|
2278
2504
|
let t = this.toCanvasPoint(e), n = this.points[0];
|
|
2279
|
-
if (n && this.points.length >= 3 &&
|
|
2505
|
+
if (n && this.points.length >= 3 && pr(t, n) <= dr) {
|
|
2280
2506
|
this.finishClosed();
|
|
2281
2507
|
return;
|
|
2282
2508
|
}
|
|
2283
2509
|
let r = this.points[this.points.length - 1];
|
|
2284
|
-
|
|
2285
|
-
this.points.length >= 2 && this.finish();
|
|
2286
|
-
return;
|
|
2287
|
-
}
|
|
2288
|
-
this.points.push(t), this.renderPreview();
|
|
2510
|
+
r && pr(t, r) <= dr ? this.points.length >= 2 && this.finish() : (this.points.push(t), this.renderPreview());
|
|
2289
2511
|
};
|
|
2290
2512
|
onDblClick = (e) => {
|
|
2291
2513
|
this.isChromeTarget(e) || (e.preventDefault(), e.stopPropagation(), this.finish());
|
|
@@ -2302,7 +2524,7 @@ var Zn = {
|
|
|
2302
2524
|
f(t, p(m("polyline"), {
|
|
2303
2525
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2304
2526
|
fill: "none",
|
|
2305
|
-
stroke:
|
|
2527
|
+
stroke: F,
|
|
2306
2528
|
"stroke-width": 2,
|
|
2307
2529
|
"stroke-linecap": "round",
|
|
2308
2530
|
"stroke-linejoin": "round",
|
|
@@ -2313,8 +2535,8 @@ var Zn = {
|
|
|
2313
2535
|
cx: r.x,
|
|
2314
2536
|
cy: r.y,
|
|
2315
2537
|
r: this.points.length >= 3 ? 5 : 3,
|
|
2316
|
-
fill:
|
|
2317
|
-
stroke:
|
|
2538
|
+
fill: P.paper,
|
|
2539
|
+
stroke: F,
|
|
2318
2540
|
"stroke-width": 1.5
|
|
2319
2541
|
})), this.points.length >= 2) {
|
|
2320
2542
|
let e = this.points[this.points.length - 1];
|
|
@@ -2322,8 +2544,8 @@ var Zn = {
|
|
|
2322
2544
|
cx: e.x,
|
|
2323
2545
|
cy: e.y,
|
|
2324
2546
|
r: 5,
|
|
2325
|
-
fill:
|
|
2326
|
-
stroke:
|
|
2547
|
+
fill: P.paper,
|
|
2548
|
+
stroke: F,
|
|
2327
2549
|
"stroke-width": 1.5
|
|
2328
2550
|
}));
|
|
2329
2551
|
}
|
|
@@ -2333,27 +2555,29 @@ var Zn = {
|
|
|
2333
2555
|
this.layer &&= (h(this.layer), null);
|
|
2334
2556
|
}
|
|
2335
2557
|
};
|
|
2336
|
-
function
|
|
2558
|
+
function pr(e, t) {
|
|
2337
2559
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
2338
2560
|
}
|
|
2339
2561
|
//#endregion
|
|
2340
2562
|
//#region src/draw-tool/EventStormingDrawingHandles.ts
|
|
2341
|
-
var
|
|
2563
|
+
var mr = class {
|
|
2342
2564
|
eventBus;
|
|
2343
2565
|
canvas;
|
|
2344
2566
|
modeling;
|
|
2567
|
+
readOnly;
|
|
2345
2568
|
static $inject = [
|
|
2346
2569
|
"eventBus",
|
|
2347
2570
|
"canvas",
|
|
2348
|
-
"eventStormingModeling"
|
|
2571
|
+
"eventStormingModeling",
|
|
2572
|
+
"eventStormingReadOnly"
|
|
2349
2573
|
];
|
|
2350
2574
|
shape = null;
|
|
2351
2575
|
group = null;
|
|
2352
2576
|
dragPreview = null;
|
|
2353
|
-
constructor(e, t, n) {
|
|
2354
|
-
this.eventBus = e, this.canvas = t, this.modeling = n, e.on("selection.changed", (e) => {
|
|
2577
|
+
constructor(e, t, n, r) {
|
|
2578
|
+
this.eventBus = e, this.canvas = t, this.modeling = n, this.readOnly = r, e.on(K, () => this.render()), e.on("selection.changed", (e) => {
|
|
2355
2579
|
let t = e.newSelection ?? [], n = t.length === 1 ? t[0] : null;
|
|
2356
|
-
this.attach(
|
|
2580
|
+
this.attach(T(n) ? n : null);
|
|
2357
2581
|
}), e.on("element.changed", (e) => {
|
|
2358
2582
|
this.shape && e.element === this.shape && this.render();
|
|
2359
2583
|
}), e.on(["diagram.clear", "diagram.destroy"], () => this.attach(null));
|
|
@@ -2369,15 +2593,15 @@ var lr = class {
|
|
|
2369
2593
|
}));
|
|
2370
2594
|
}
|
|
2371
2595
|
render() {
|
|
2372
|
-
if (this.clear(), !this.shape) return;
|
|
2596
|
+
if (this.clear(), !this.shape || this.readOnly?.isReadOnly()) return;
|
|
2373
2597
|
let e = this.canvas.getLayer("event-storming-drawing-handles", 1100), t = m("g");
|
|
2374
2598
|
this.absolutePoints().forEach((e, n) => {
|
|
2375
2599
|
let r = p(m("circle"), {
|
|
2376
2600
|
cx: e.x,
|
|
2377
2601
|
cy: e.y,
|
|
2378
2602
|
r: 5,
|
|
2379
|
-
fill:
|
|
2380
|
-
stroke:
|
|
2603
|
+
fill: P.paper,
|
|
2604
|
+
stroke: P.ink,
|
|
2381
2605
|
"stroke-width": 1.5,
|
|
2382
2606
|
class: "event-storming-drawing-handle"
|
|
2383
2607
|
});
|
|
@@ -2412,7 +2636,7 @@ var lr = class {
|
|
|
2412
2636
|
let n = this.canvas.getLayer("event-storming-drawing-handles", 1100), r = p(m(t ? "polygon" : "polyline"), {
|
|
2413
2637
|
points: e.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2414
2638
|
fill: "none",
|
|
2415
|
-
stroke:
|
|
2639
|
+
stroke: P.ink,
|
|
2416
2640
|
"stroke-width": 1.5,
|
|
2417
2641
|
"stroke-dasharray": "5 4",
|
|
2418
2642
|
"pointer-events": "none"
|
|
@@ -2432,17 +2656,17 @@ var lr = class {
|
|
|
2432
2656
|
y: (e.clientY - t.top) / r + n.y
|
|
2433
2657
|
};
|
|
2434
2658
|
}
|
|
2435
|
-
},
|
|
2659
|
+
}, hr = class {
|
|
2436
2660
|
static $inject = ["eventBus", "interactionEvents"];
|
|
2437
2661
|
constructor(e, t) {
|
|
2438
2662
|
e.on("interactionEvents.createHit", (e) => {
|
|
2439
|
-
if (
|
|
2663
|
+
if (T(e.element) && e.gfx) return gr(e.element, e.gfx), !1;
|
|
2440
2664
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
2441
|
-
if (
|
|
2665
|
+
if (T(e.element) && e.gfx) return t.removeHits(e.gfx), gr(e.element, e.gfx), !1;
|
|
2442
2666
|
});
|
|
2443
2667
|
}
|
|
2444
2668
|
};
|
|
2445
|
-
function
|
|
2669
|
+
function gr(e, t) {
|
|
2446
2670
|
let n = e.drawingPoints ?? [], r = m(e.closed ? "polygon" : "polyline");
|
|
2447
2671
|
p(r, {
|
|
2448
2672
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
@@ -2455,55 +2679,56 @@ function dr(e, t) {
|
|
|
2455
2679
|
}
|
|
2456
2680
|
//#endregion
|
|
2457
2681
|
//#region src/draw-tool/index.ts
|
|
2458
|
-
var
|
|
2682
|
+
var _r = {
|
|
2459
2683
|
__init__: [
|
|
2460
2684
|
"eventStormingDrawTool",
|
|
2461
2685
|
"eventStormingDrawingHandles",
|
|
2462
2686
|
"eventStormingDrawingHitProvider"
|
|
2463
2687
|
],
|
|
2464
|
-
eventStormingDrawTool: ["type",
|
|
2465
|
-
eventStormingDrawingHandles: ["type",
|
|
2466
|
-
eventStormingDrawingHitProvider: ["type",
|
|
2467
|
-
},
|
|
2688
|
+
eventStormingDrawTool: ["type", fr],
|
|
2689
|
+
eventStormingDrawingHandles: ["type", mr],
|
|
2690
|
+
eventStormingDrawingHitProvider: ["type", hr]
|
|
2691
|
+
}, vr = class {
|
|
2468
2692
|
static $inject = ["eventBus"];
|
|
2469
2693
|
constructor(e) {
|
|
2470
2694
|
e.on("resize.start", 1500, (e) => {
|
|
2471
2695
|
let t = e.context;
|
|
2472
|
-
|
|
2696
|
+
Oe(t.shape) && (t.minDimensions = A);
|
|
2473
2697
|
});
|
|
2474
2698
|
}
|
|
2475
|
-
},
|
|
2476
|
-
__depends__: [
|
|
2699
|
+
}, yr = {
|
|
2700
|
+
__depends__: [ye],
|
|
2477
2701
|
__init__: ["eventStormingResizeBehavior"],
|
|
2478
|
-
eventStormingResizeBehavior: ["type",
|
|
2479
|
-
},
|
|
2702
|
+
eventStormingResizeBehavior: ["type", vr]
|
|
2703
|
+
}, br = class extends W {
|
|
2480
2704
|
_getModules() {
|
|
2481
2705
|
return [
|
|
2482
2706
|
...super._getModules(),
|
|
2483
|
-
b,
|
|
2484
|
-
ie,
|
|
2485
|
-
x,
|
|
2486
|
-
ee,
|
|
2487
2707
|
te,
|
|
2708
|
+
se,
|
|
2488
2709
|
ne,
|
|
2489
2710
|
re,
|
|
2711
|
+
ie,
|
|
2490
2712
|
ae,
|
|
2491
2713
|
oe,
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
zt,
|
|
2495
|
-
Vt,
|
|
2496
|
-
Zt,
|
|
2714
|
+
ce,
|
|
2715
|
+
le,
|
|
2497
2716
|
Sn,
|
|
2498
|
-
Gn,
|
|
2499
|
-
Zn,
|
|
2500
2717
|
tn,
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2718
|
+
Vt,
|
|
2719
|
+
sn,
|
|
2720
|
+
ln,
|
|
2721
|
+
mn,
|
|
2722
|
+
Tn,
|
|
2723
|
+
Yn,
|
|
2724
|
+
nr,
|
|
2725
|
+
vn,
|
|
2726
|
+
or,
|
|
2727
|
+
lr,
|
|
2728
|
+
nn,
|
|
2729
|
+
ur,
|
|
2730
|
+
_r,
|
|
2731
|
+
yr
|
|
2507
2732
|
];
|
|
2508
2733
|
}
|
|
2509
2734
|
undo() {
|
|
@@ -2518,8 +2743,427 @@ var fr = {
|
|
|
2518
2743
|
canRedo() {
|
|
2519
2744
|
return this.get("commandStack").canRedo();
|
|
2520
2745
|
}
|
|
2521
|
-
};
|
|
2746
|
+
}, xr = "event-storming";
|
|
2747
|
+
function Sr(e = {}) {
|
|
2748
|
+
return Tr(new br({
|
|
2749
|
+
...wr(e),
|
|
2750
|
+
undoRedoKeys: e.undoRedoKeys ?? !0,
|
|
2751
|
+
freeArea: R(e)
|
|
2752
|
+
}), !0);
|
|
2753
|
+
}
|
|
2754
|
+
function Cr(e = {}) {
|
|
2755
|
+
return Tr(new W(wr(e)), !1);
|
|
2756
|
+
}
|
|
2757
|
+
function wr(e) {
|
|
2758
|
+
return {
|
|
2759
|
+
width: "100%",
|
|
2760
|
+
height: "100%",
|
|
2761
|
+
additionalModules: e.additionalModules ?? [],
|
|
2762
|
+
fitOnImport: e.fitOnImport ?? !0
|
|
2763
|
+
};
|
|
2764
|
+
}
|
|
2765
|
+
function Tr(e, t) {
|
|
2766
|
+
let n = e.get("eventBus"), r = e.get("canvas"), i = e.get("elementRegistry"), a = e.get("selection"), o = /* @__PURE__ */ new Set(), s = 0, c = !1, l = "", u = {
|
|
2767
|
+
notation: xr,
|
|
2768
|
+
apiVersion: be,
|
|
2769
|
+
editable: t
|
|
2770
|
+
};
|
|
2771
|
+
return t && n.on("commandStack.changed", () => {
|
|
2772
|
+
if (!(s > 0)) for (let e of [...o]) e();
|
|
2773
|
+
}), {
|
|
2774
|
+
meta: u,
|
|
2775
|
+
elements: {
|
|
2776
|
+
list: () => c ? [] : i.getAll().filter(Y).map((e) => Or(e)),
|
|
2777
|
+
reveal(e) {
|
|
2778
|
+
if (c) return !1;
|
|
2779
|
+
let t = i.get(e);
|
|
2780
|
+
return Y(t) ? (a.select(t), r.scrollToElement(t), !0) : !1;
|
|
2781
|
+
},
|
|
2782
|
+
selection: () => c ? [] : Er(a.get()),
|
|
2783
|
+
onSelection(e) {
|
|
2784
|
+
let t = (t) => e(Er(t.newSelection ?? []));
|
|
2785
|
+
return n.on("selection.changed", t), () => n.off("selection.changed", t);
|
|
2786
|
+
},
|
|
2787
|
+
bounds(e) {
|
|
2788
|
+
if (c) return;
|
|
2789
|
+
let t = i.get(e);
|
|
2790
|
+
return Y(t) ? Dr(t) : void 0;
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
diagram: e,
|
|
2794
|
+
attachTo(t) {
|
|
2795
|
+
e.attachTo(t);
|
|
2796
|
+
},
|
|
2797
|
+
async importText(t) {
|
|
2798
|
+
if (c) throw Error("The modeler was destroyed.");
|
|
2799
|
+
s += 1;
|
|
2800
|
+
try {
|
|
2801
|
+
let { warnings: n } = await e.importDSL(t);
|
|
2802
|
+
return { warnings: n.map(Lt) };
|
|
2803
|
+
} finally {
|
|
2804
|
+
--s;
|
|
2805
|
+
}
|
|
2806
|
+
},
|
|
2807
|
+
exportText() {
|
|
2808
|
+
return c ? l : e.exportDSL();
|
|
2809
|
+
},
|
|
2810
|
+
onContentChanged(e) {
|
|
2811
|
+
return t ? (o.add(e), () => o.delete(e)) : () => void 0;
|
|
2812
|
+
},
|
|
2813
|
+
getViewState() {
|
|
2814
|
+
if (!c) try {
|
|
2815
|
+
let { x: e, y: t, width: n, height: i } = r.viewbox(), a = {
|
|
2816
|
+
x: e,
|
|
2817
|
+
y: t,
|
|
2818
|
+
width: n,
|
|
2819
|
+
height: i
|
|
2820
|
+
};
|
|
2821
|
+
return kr(a) ? a : void 0;
|
|
2822
|
+
} catch {
|
|
2823
|
+
return;
|
|
2824
|
+
}
|
|
2825
|
+
},
|
|
2826
|
+
setViewState(e) {
|
|
2827
|
+
!c && kr(e) && r.viewbox({
|
|
2828
|
+
x: e.x,
|
|
2829
|
+
y: e.y,
|
|
2830
|
+
width: e.width,
|
|
2831
|
+
height: e.height
|
|
2832
|
+
});
|
|
2833
|
+
},
|
|
2834
|
+
destroy() {
|
|
2835
|
+
if (!c) {
|
|
2836
|
+
try {
|
|
2837
|
+
l = e.exportDSL();
|
|
2838
|
+
} catch {
|
|
2839
|
+
l = "";
|
|
2840
|
+
}
|
|
2841
|
+
c = !0, o.clear(), e.destroy();
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2846
|
+
function Y(e) {
|
|
2847
|
+
return w(e);
|
|
2848
|
+
}
|
|
2849
|
+
function Er(e) {
|
|
2850
|
+
return e.filter(Y).map((e) => e.id);
|
|
2851
|
+
}
|
|
2852
|
+
function Dr(e) {
|
|
2853
|
+
return {
|
|
2854
|
+
x: e.x,
|
|
2855
|
+
y: e.y,
|
|
2856
|
+
width: e.width,
|
|
2857
|
+
height: e.height
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2860
|
+
function Or(e) {
|
|
2861
|
+
let t = e.eventStormingLabel;
|
|
2862
|
+
return t ? {
|
|
2863
|
+
id: e.id,
|
|
2864
|
+
name: t
|
|
2865
|
+
} : { id: e.id };
|
|
2866
|
+
}
|
|
2867
|
+
function kr(e) {
|
|
2868
|
+
if (typeof e != "object" || !e) return !1;
|
|
2869
|
+
let { x: t, y: n, width: r, height: i } = e;
|
|
2870
|
+
return X(t) && X(n) && X(r) && X(i) && r > 0 && i > 0;
|
|
2871
|
+
}
|
|
2872
|
+
function X(e) {
|
|
2873
|
+
return typeof e == "number" && Number.isFinite(e);
|
|
2874
|
+
}
|
|
2875
|
+
//#endregion
|
|
2876
|
+
//#region src/board-menu/menu.ts
|
|
2877
|
+
var Ar = "Export as .storm", jr = [
|
|
2878
|
+
{
|
|
2879
|
+
value: "big-picture",
|
|
2880
|
+
label: "Big picture"
|
|
2881
|
+
},
|
|
2882
|
+
{
|
|
2883
|
+
value: "process",
|
|
2884
|
+
label: "Process modeling"
|
|
2885
|
+
},
|
|
2886
|
+
{
|
|
2887
|
+
value: "design",
|
|
2888
|
+
label: "Software design"
|
|
2889
|
+
}
|
|
2890
|
+
];
|
|
2891
|
+
function Mr(e) {
|
|
2892
|
+
return jr.some((t) => t.value === e);
|
|
2893
|
+
}
|
|
2894
|
+
function Z(e, t, n, r) {
|
|
2895
|
+
return {
|
|
2896
|
+
kind: "action",
|
|
2897
|
+
id: e,
|
|
2898
|
+
label: t,
|
|
2899
|
+
...r ? { icon: r } : {},
|
|
2900
|
+
...n.shortcut ? { shortcut: n.shortcut } : {},
|
|
2901
|
+
onSelect: () => n.onSelect()
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
function Nr(e) {
|
|
2905
|
+
let t = [Z("export-png", "Export as PNG", e.png, "file-image"), Z("export-svg", "Export as SVG", e.svg, "file-code-corner")];
|
|
2906
|
+
return e.transparentPng && t.push(Z("export-png-transparent", "Export as PNG (4×, transparent)", e.transparentPng)), e.json && t.push(Z("export-json", "Export as JSON", e.json)), e.storm && t.push(Z("export-storm", Ar, e.storm)), t;
|
|
2907
|
+
}
|
|
2908
|
+
function Pr(e) {
|
|
2909
|
+
return {
|
|
2910
|
+
model: [{
|
|
2911
|
+
kind: "radio",
|
|
2912
|
+
id: "level",
|
|
2913
|
+
label: "Level",
|
|
2914
|
+
options: jr,
|
|
2915
|
+
value: () => e.levels.getLevel(),
|
|
2916
|
+
onSelect: (t) => {
|
|
2917
|
+
Mr(t) && e.levels.setLevel(t);
|
|
2918
|
+
}
|
|
2919
|
+
}, {
|
|
2920
|
+
kind: "checkbox",
|
|
2921
|
+
id: "type-captions",
|
|
2922
|
+
label: "Type captions",
|
|
2923
|
+
keepEnabledWhenReadOnly: !0,
|
|
2924
|
+
checked: () => e.typeCaptions.typeCaptionsVisible(),
|
|
2925
|
+
onToggle: (t) => {
|
|
2926
|
+
e.typeCaptions.setTypeCaptionsVisible(t), e.onTypeCaptionsToggled?.(t);
|
|
2927
|
+
}
|
|
2928
|
+
}],
|
|
2929
|
+
export: Nr(e.exports),
|
|
2930
|
+
help: [{
|
|
2931
|
+
kind: "dialog",
|
|
2932
|
+
id: "keyboard-shortcuts",
|
|
2933
|
+
label: "Keyboard shortcuts…",
|
|
2934
|
+
icon: "keyboard",
|
|
2935
|
+
onSelect: () => e.showKeyboardShortcuts()
|
|
2936
|
+
}]
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
//#endregion
|
|
2940
|
+
//#region src/board-menu/shortcuts.ts
|
|
2941
|
+
var Fr = [
|
|
2942
|
+
"←",
|
|
2943
|
+
"↑",
|
|
2944
|
+
"→",
|
|
2945
|
+
"↓"
|
|
2946
|
+
];
|
|
2947
|
+
function Ir(e, t, n) {
|
|
2948
|
+
return t === "mac" ? `⌘${e}` : `${n.ctrl}+${e}`;
|
|
2949
|
+
}
|
|
2950
|
+
function Lr(e) {
|
|
2951
|
+
try {
|
|
2952
|
+
return new Intl.NumberFormat(e, { style: "percent" }).format(1);
|
|
2953
|
+
} catch {
|
|
2954
|
+
return new Intl.NumberFormat("en", { style: "percent" }).format(1);
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
function Rr(e, t) {
|
|
2958
|
+
if (e === "mac") return {
|
|
2959
|
+
zoomIn: "⌘+",
|
|
2960
|
+
zoomOut: "⌘−",
|
|
2961
|
+
zoomToActual: "⌘0",
|
|
2962
|
+
fit: "⇧1"
|
|
2963
|
+
};
|
|
2964
|
+
let { ctrl: n, shift: r, plus: i, minus: a } = t;
|
|
2965
|
+
return {
|
|
2966
|
+
zoomIn: `${n}+${i}`,
|
|
2967
|
+
zoomOut: `${n}+${a}`,
|
|
2968
|
+
zoomToActual: `${n}+0`,
|
|
2969
|
+
fit: `${r}+1`
|
|
2970
|
+
};
|
|
2971
|
+
}
|
|
2972
|
+
function zr(e, t) {
|
|
2973
|
+
if (e === "mac") return {
|
|
2974
|
+
undo: ["⌘Z"],
|
|
2975
|
+
redo: ["⌘⇧Z"],
|
|
2976
|
+
selectAll: ["⌘A"],
|
|
2977
|
+
copy: ["⌘C"],
|
|
2978
|
+
paste: ["⌘V"],
|
|
2979
|
+
duplicate: ["⌘D"],
|
|
2980
|
+
remove: ["⌫"],
|
|
2981
|
+
coarseMove: Fr.map((e) => `⇧${e}`),
|
|
2982
|
+
lassoDrag: ["⇧ Drag"]
|
|
2983
|
+
};
|
|
2984
|
+
let { ctrl: n, shift: r } = t;
|
|
2985
|
+
return {
|
|
2986
|
+
undo: [`${n}+Z`],
|
|
2987
|
+
redo: [`${n}+${r}+Z`, `${n}+Y`],
|
|
2988
|
+
selectAll: [`${n}+A`],
|
|
2989
|
+
copy: [`${n}+C`],
|
|
2990
|
+
paste: [`${n}+V`],
|
|
2991
|
+
duplicate: [`${n}+D`],
|
|
2992
|
+
remove: ["Del", "Backspace"],
|
|
2993
|
+
coarseMove: Fr.map((e) => `${r}+${e}`),
|
|
2994
|
+
lassoDrag: [`${r}+Drag`]
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
2997
|
+
function Br(e) {
|
|
2998
|
+
let { platform: t, messages: n } = e;
|
|
2999
|
+
return {
|
|
3000
|
+
title: "File",
|
|
3001
|
+
rows: [{
|
|
3002
|
+
action: n.openFile ?? "Open…",
|
|
3003
|
+
keys: [Ir("O", t, n.keyNames)]
|
|
3004
|
+
}, {
|
|
3005
|
+
action: Ar,
|
|
3006
|
+
keys: [Ir("S", t, n.keyNames)]
|
|
3007
|
+
}]
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
function Vr(e, t = {}) {
|
|
3011
|
+
let { platform: n, messages: r } = e, i = Rr(n, r.keyNames), a = zr(n, r.keyNames);
|
|
3012
|
+
return [
|
|
3013
|
+
...t.fileKeys ? [Br(e)] : [],
|
|
3014
|
+
{
|
|
3015
|
+
title: "View",
|
|
3016
|
+
rows: [
|
|
3017
|
+
{
|
|
3018
|
+
action: r.zoomIn,
|
|
3019
|
+
keys: [i.zoomIn]
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
action: r.zoomOut,
|
|
3023
|
+
keys: [i.zoomOut]
|
|
3024
|
+
},
|
|
3025
|
+
{
|
|
3026
|
+
action: r.zoomToActual(Lr(e.lang)),
|
|
3027
|
+
keys: [i.zoomToActual]
|
|
3028
|
+
},
|
|
3029
|
+
{
|
|
3030
|
+
action: r.fit,
|
|
3031
|
+
keys: [i.fit]
|
|
3032
|
+
}
|
|
3033
|
+
]
|
|
3034
|
+
},
|
|
3035
|
+
{
|
|
3036
|
+
title: "Edit",
|
|
3037
|
+
rows: [
|
|
3038
|
+
{
|
|
3039
|
+
action: "Undo",
|
|
3040
|
+
keys: a.undo
|
|
3041
|
+
},
|
|
3042
|
+
{
|
|
3043
|
+
action: "Redo",
|
|
3044
|
+
keys: a.redo
|
|
3045
|
+
},
|
|
3046
|
+
{
|
|
3047
|
+
action: "Select all",
|
|
3048
|
+
keys: a.selectAll
|
|
3049
|
+
},
|
|
3050
|
+
{
|
|
3051
|
+
action: "Copy",
|
|
3052
|
+
keys: a.copy
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
action: "Paste",
|
|
3056
|
+
keys: a.paste
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
action: "Duplicate",
|
|
3060
|
+
keys: a.duplicate
|
|
3061
|
+
},
|
|
3062
|
+
{
|
|
3063
|
+
action: "Delete",
|
|
3064
|
+
keys: a.remove
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
action: "Move selection",
|
|
3068
|
+
keys: Fr
|
|
3069
|
+
},
|
|
3070
|
+
{
|
|
3071
|
+
action: "Move selection in large steps",
|
|
3072
|
+
keys: a.coarseMove
|
|
3073
|
+
}
|
|
3074
|
+
]
|
|
3075
|
+
},
|
|
3076
|
+
{
|
|
3077
|
+
title: "Tools",
|
|
3078
|
+
rows: [
|
|
3079
|
+
{
|
|
3080
|
+
action: "Lasso",
|
|
3081
|
+
keys: ["L"]
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
action: "Lasso by dragging",
|
|
3085
|
+
keys: a.lassoDrag
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
action: "Domain event at the pointer",
|
|
3089
|
+
keys: ["E"]
|
|
3090
|
+
},
|
|
3091
|
+
{
|
|
3092
|
+
action: "Command at the pointer",
|
|
3093
|
+
keys: ["C"]
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
action: "Finish a drawing",
|
|
3097
|
+
keys: [
|
|
3098
|
+
"Enter",
|
|
3099
|
+
"Esc",
|
|
3100
|
+
"Double-click"
|
|
3101
|
+
]
|
|
3102
|
+
}
|
|
3103
|
+
]
|
|
3104
|
+
}
|
|
3105
|
+
];
|
|
3106
|
+
}
|
|
3107
|
+
//#endregion
|
|
3108
|
+
//#region src/board-menu/ShortcutsDialog.ts
|
|
3109
|
+
var Q = "event-storming-shortcuts", Hr = "event-storming-shortcuts-title";
|
|
3110
|
+
function $(e, t, n) {
|
|
3111
|
+
let r = document.createElement(e);
|
|
3112
|
+
return r.className = t, n !== void 0 && (r.textContent = n), r;
|
|
3113
|
+
}
|
|
3114
|
+
function Ur(e, t) {
|
|
3115
|
+
let n = $("section", `${Q}-group`), r = `${Hr}-group-${t}`, i = $("h4", `${Q}-group-title`, e.title);
|
|
3116
|
+
i.id = r;
|
|
3117
|
+
let a = $("table", `${Q}-table`);
|
|
3118
|
+
a.setAttribute("aria-labelledby", r);
|
|
3119
|
+
let o = a.createTBody();
|
|
3120
|
+
for (let t of e.rows) {
|
|
3121
|
+
let e = o.insertRow(), n = $("th", `${Q}-action`, t.action);
|
|
3122
|
+
n.scope = "row";
|
|
3123
|
+
let r = $("td", `${Q}-keys`);
|
|
3124
|
+
for (let e of t.keys) r.append($("kbd", `${Q}-key`, e));
|
|
3125
|
+
e.append(n, r);
|
|
3126
|
+
}
|
|
3127
|
+
return n.append(i, a), n;
|
|
3128
|
+
}
|
|
3129
|
+
function Wr(e, t, n) {
|
|
3130
|
+
let r = $("div", `${Q}-panel`), i = $("header", `${Q}-header`), a = $("h3", `${Q}-title`, "Keyboard shortcuts");
|
|
3131
|
+
a.id = Hr;
|
|
3132
|
+
let o = $("button", `${Q}-close`);
|
|
3133
|
+
o.type = "button", o.setAttribute("aria-label", e.messages.close), o.innerHTML = q("x"), o.addEventListener("click", n), i.append(a, o);
|
|
3134
|
+
let s = $("div", `${Q}-body`);
|
|
3135
|
+
return s.append(...Vr(e, t).map(Ur)), r.append(i, s), r;
|
|
3136
|
+
}
|
|
3137
|
+
function Gr(e, t = {}) {
|
|
3138
|
+
let n;
|
|
3139
|
+
function r() {
|
|
3140
|
+
let n = $("dialog", Q);
|
|
3141
|
+
return n.setAttribute("aria-labelledby", Hr), n.append(Wr(e, t, () => n.close())), n.addEventListener("click", (e) => {
|
|
3142
|
+
e.target === n && n.close();
|
|
3143
|
+
}), n.addEventListener("close", () => {
|
|
3144
|
+
e.menu.trigger.hidden || e.menu.trigger.focus({ preventScroll: !0 });
|
|
3145
|
+
}), e.root.append(n), n;
|
|
3146
|
+
}
|
|
3147
|
+
return {
|
|
3148
|
+
open() {
|
|
3149
|
+
n ??= r(), n.open || n.showModal();
|
|
3150
|
+
},
|
|
3151
|
+
close() {
|
|
3152
|
+
n?.close();
|
|
3153
|
+
},
|
|
3154
|
+
isOpen: () => n?.open === !0,
|
|
3155
|
+
destroy() {
|
|
3156
|
+
n?.remove(), n = void 0;
|
|
3157
|
+
}
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
//#endregion
|
|
3161
|
+
//#region src/draw/icons.ts
|
|
3162
|
+
var Kr = "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z", qr = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", Jr = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", Yr = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z", Xr = "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z", Zr = "M4 7v2c0 .55-.45 1-1 1H2v2h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h1v-2H7c-.55 0-1-.45-1-1v-2c0-.84-.35-1.61-.92-2.18L4.85 12l.23-.82C5.65 10.61 6 9.84 6 9V7c0-.55.45-1 1-1h1V4H7C5.35 4 4 5.35 4 7zm16 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-1v2h1c.55 0 1 .45 1 1v2c0 .84.35 1.61.92 2.18l.23.82-.23.82c-.57.57-.92 1.34-.92 2.18v2c0 .55-.45 1-1 1h-1v2h1c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-2h-1z", Qr = "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z", $r = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", ei = "M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92z", ti = "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", ni = "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z", ri = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z", ii = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", ai = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", oi = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z", si = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
|
|
3163
|
+
function ci(e, t = 18) {
|
|
3164
|
+
return `<svg viewBox="0 0 24 24" width="${t}" height="${t}" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
|
|
3165
|
+
}
|
|
2522
3166
|
//#endregion
|
|
2523
|
-
export {
|
|
3167
|
+
export { jr as BOARD_LEVELS, nt as BoardBounds, P as COLORS, xr as EVENT_STORMING_NOTATION, ar as EventStormingAppendBehavior, Bt as EventStormingAttachBehavior, qe as EventStormingBaseViewer, cr as EventStormingColorPicker, Qe as EventStormingElementFactory, _n as EventStormingElementSettingsProvider, Ft as EventStormingExporter, Pt as EventStormingImporter, Gn as EventStormingLabelEditing, qt as EventStormingModeling, xn as EventStormingReadOnly, vt as EventStormingRenderer, vr as EventStormingResizeBehavior, on as EventStormingRules, at as EventStormingViewOptions, ai as ICON_ADD, Qr as ICON_CODE, Zr as ICON_DATA_OBJECT, Jr as ICON_DELETE, $r as ICON_DOWNLOAD, qr as ICON_EDIT, si as ICON_EYE, oi as ICON_FIT, ti as ICON_FOLDER_OPEN, ni as ICON_IMAGE, ii as ICON_MENU, ri as ICON_NEW, Kr as ICON_PERSON, Xr as ICON_REDO, ei as ICON_SHARE, Yr as ICON_UNDO, E as MIRAGON, br as Modeler, k as NOTE_STYLE, W as NavigatedViewer, G as POPUP_PROVIDER_ID, K as READ_ONLY_CHANGED_EVENT, y as ROOT_ID, S as STICKY_KINDS, O as STICKY_STYLES, Ar as STORM_EXPORT_LABEL, it as VIEW_OPTIONS_CHANGED_EVENT, zt as Viewer, rt as boardBoundsModule, Pr as boardMenu, Vr as boardShortcuts, Ir as commandKeyLabel, Sr as createCollaborativeModeler, Cr as createCollaborativeViewer, Gr as createShortcutsDialog, ln as elementSnappingModule, or as eventStormingAppendModule, Vt as eventStormingAttachModule, lr as eventStormingColorPickerModule, Tn as eventStormingContextPadModule, jt as eventStormingDrawModule, nr as eventStormingKeyboardModule, et as eventStormingModelModule, tn as eventStormingModelingModule, mn as eventStormingPaletteModule, vn as eventStormingPopupModule, Sn as eventStormingReadOnlyModule, yr as eventStormingResizeModule, sn as eventStormingRulesModule, V as eventStormingViewOptionsModule, ci as iconMarkup, Lt as importWarningText, Rt as ioModule, we as isAttachableKind, Ee as isAttachableSticky, x as isEventStormingConnection, b as isEventStormingShape, Te as isHostKind, De as isHostSticky, w as isSticky, C as isStickyKind, Yn as labelEditingModule, D as parseNoteMarkdown, je as plainNoteText, Se as saveSVG, Ae as serializeNoteMarkdown };
|
|
2524
3168
|
|
|
2525
3169
|
//# sourceMappingURL=index.js.map
|