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