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