@miragon/event-storming-renderer 0.2.0 → 0.2.2
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/dist/event-storming.css +1 -1
- package/dist/index.js +413 -372
- package/dist/index.js.map +1 -1
- package/dist/palette/EventStormingPaletteTooltip.d.ts +22 -0
- package/dist/palette/EventStormingPaletteTooltip.d.ts.map +1 -0
- package/dist/palette/index.d.ts +2 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/package.json +15 -10
package/dist/index.js
CHANGED
|
@@ -22,11 +22,13 @@ import ce from "diagram-js/lib/command/CommandInterceptor";
|
|
|
22
22
|
import le from "diagram-js/lib/features/mouse";
|
|
23
23
|
import ue from "diagram-js/lib/features/lasso-tool";
|
|
24
24
|
import de from "diagram-js/lib/features/rules/RuleProvider";
|
|
25
|
-
import fe from "diagram-js/lib/features/
|
|
26
|
-
import pe from "diagram-js/lib/
|
|
27
|
-
import me from "diagram-js/lib/features/
|
|
25
|
+
import fe from "diagram-js/lib/features/palette/PaletteTooltipComponent";
|
|
26
|
+
import { html as pe } from "diagram-js/lib/ui";
|
|
27
|
+
import me from "diagram-js/lib/features/connection-preview";
|
|
28
|
+
import he from "diagram-js/lib/features/ordering/OrderingProvider";
|
|
29
|
+
import ge from "diagram-js/lib/features/resize";
|
|
28
30
|
//#region src/io/saveSvg.ts
|
|
29
|
-
function
|
|
31
|
+
function _e(e, t) {
|
|
30
32
|
let n = e.getContainer().querySelector("svg");
|
|
31
33
|
if (!n) throw Error("No SVG found in the canvas container.");
|
|
32
34
|
let r = n.cloneNode(!0), i = t ?? {
|
|
@@ -40,10 +42,10 @@ function he(e, t) {
|
|
|
40
42
|
}
|
|
41
43
|
//#endregion
|
|
42
44
|
//#region src/EventStormingBaseViewer.ts
|
|
43
|
-
function
|
|
45
|
+
function ve(e) {
|
|
44
46
|
return typeof e == "number" ? `${e}px` : e;
|
|
45
47
|
}
|
|
46
|
-
var
|
|
48
|
+
var ye = class {
|
|
47
49
|
_diagram;
|
|
48
50
|
_container;
|
|
49
51
|
_options;
|
|
@@ -52,7 +54,7 @@ var _e = class {
|
|
|
52
54
|
}
|
|
53
55
|
_createContainer(e) {
|
|
54
56
|
let t = e.container ?? document.createElement("div");
|
|
55
|
-
return t.classList.add("event-storming-container"), t.style.width =
|
|
57
|
+
return t.classList.add("event-storming-container"), t.style.width = ve(e.width ?? "100%"), t.style.height = ve(e.height ?? (e.container ? "100%" : "600px")), t;
|
|
56
58
|
}
|
|
57
59
|
_ensureDiagram() {
|
|
58
60
|
if (!this._diagram) {
|
|
@@ -102,7 +104,7 @@ var _e = class {
|
|
|
102
104
|
return n(this.exportMap());
|
|
103
105
|
}
|
|
104
106
|
async saveSVG() {
|
|
105
|
-
return
|
|
107
|
+
return _e(this.get("canvas"), this.get("boardBounds").contentBounds());
|
|
106
108
|
}
|
|
107
109
|
attachTo(e) {
|
|
108
110
|
e.appendChild(this._container), this.get("canvas").resized();
|
|
@@ -137,7 +139,7 @@ var _e = class {
|
|
|
137
139
|
S.grau, S.schwarz, S.weiss, S.blau, S.gruen, S.danger, S.schwarz, S.navy, S.grau;
|
|
138
140
|
//#endregion
|
|
139
141
|
//#region src/draw/note-markdown.ts
|
|
140
|
-
var
|
|
142
|
+
var be = [
|
|
141
143
|
{
|
|
142
144
|
marker: "***",
|
|
143
145
|
bold: !0,
|
|
@@ -159,23 +161,23 @@ function C(e) {
|
|
|
159
161
|
let t = e.startsWith("- ");
|
|
160
162
|
return {
|
|
161
163
|
bullet: t,
|
|
162
|
-
runs:
|
|
164
|
+
runs: Ce(t ? e.slice(2) : e)
|
|
163
165
|
};
|
|
164
166
|
});
|
|
165
167
|
}
|
|
166
|
-
function
|
|
168
|
+
function xe(e) {
|
|
167
169
|
return e.map((e) => {
|
|
168
|
-
let t =
|
|
170
|
+
let t = Te(e.runs).map((e) => {
|
|
169
171
|
let t = e.bold && e.italic ? "***" : e.bold ? "**" : e.italic ? "*" : "";
|
|
170
172
|
return t + e.text + t;
|
|
171
173
|
}).join("");
|
|
172
174
|
return (e.bullet ? "- " : "") + t;
|
|
173
175
|
}).join("\n");
|
|
174
176
|
}
|
|
175
|
-
function
|
|
177
|
+
function Se(e) {
|
|
176
178
|
return C(e).map((e) => (e.bullet ? "• " : "") + e.runs.map((e) => e.text).join("")).join("\n");
|
|
177
179
|
}
|
|
178
|
-
function
|
|
180
|
+
function Ce(e) {
|
|
179
181
|
let t = [], n = "", r = () => {
|
|
180
182
|
n && t.push({
|
|
181
183
|
text: n,
|
|
@@ -184,7 +186,7 @@ function xe(e) {
|
|
|
184
186
|
}), n = "";
|
|
185
187
|
}, i = 0;
|
|
186
188
|
for (; i < e.length;) {
|
|
187
|
-
let a = e[i] === "*" ?
|
|
189
|
+
let a = e[i] === "*" ? we(e, i) : void 0;
|
|
188
190
|
if (!a) {
|
|
189
191
|
n += e[i], i++;
|
|
190
192
|
continue;
|
|
@@ -195,10 +197,10 @@ function xe(e) {
|
|
|
195
197
|
italic: a.italic
|
|
196
198
|
}), i = a.end;
|
|
197
199
|
}
|
|
198
|
-
return r(),
|
|
200
|
+
return r(), Te(t);
|
|
199
201
|
}
|
|
200
|
-
function
|
|
201
|
-
for (let { marker: n, bold: r, italic: i } of
|
|
202
|
+
function we(e, t) {
|
|
203
|
+
for (let { marker: n, bold: r, italic: i } of be) {
|
|
202
204
|
if (!e.startsWith(n, t)) continue;
|
|
203
205
|
let a = e.indexOf(n, t + n.length);
|
|
204
206
|
if (!(a <= t + n.length)) return {
|
|
@@ -209,7 +211,7 @@ function Se(e, t) {
|
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
function
|
|
214
|
+
function Te(e) {
|
|
213
215
|
let t = [];
|
|
214
216
|
for (let n of e) {
|
|
215
217
|
if (!n.text) continue;
|
|
@@ -288,23 +290,23 @@ var w = {
|
|
|
288
290
|
}, E = {
|
|
289
291
|
width: 60,
|
|
290
292
|
height: 40
|
|
291
|
-
}, D = 7.5,
|
|
293
|
+
}, D = 7.5, Ee = {
|
|
292
294
|
width: w.aggregate.width,
|
|
293
295
|
height: w.aggregate.height
|
|
294
296
|
};
|
|
295
297
|
function O(e) {
|
|
296
|
-
let t =
|
|
298
|
+
let t = Se(e), n = (t && t.length ? t : "note").split("\n"), r = Math.max(1, ...n.map((e) => e.length));
|
|
297
299
|
return {
|
|
298
300
|
lines: n,
|
|
299
|
-
width: Math.max(
|
|
300
|
-
height: Math.max(
|
|
301
|
+
width: Math.max(Ee.width, Math.round(r * D) + 16),
|
|
302
|
+
height: Math.max(Ee.height, n.length * 17 + 16)
|
|
301
303
|
};
|
|
302
304
|
}
|
|
303
|
-
function
|
|
305
|
+
function k(e, t) {
|
|
304
306
|
let n = O(e);
|
|
305
307
|
return t.width !== n.width || t.height !== n.height;
|
|
306
308
|
}
|
|
307
|
-
var
|
|
309
|
+
var A = {
|
|
308
310
|
paper: S.grau,
|
|
309
311
|
ink: S.schwarz,
|
|
310
312
|
inkSoft: "#5B5B5B",
|
|
@@ -314,20 +316,20 @@ var k = {
|
|
|
314
316
|
accent: S.blau,
|
|
315
317
|
accentSoft: "rgba(51,93,229,0.12)",
|
|
316
318
|
stickyText: "#333333"
|
|
317
|
-
},
|
|
319
|
+
}, j = `var(--event-storming-drawing-ink, ${S.schwarz})`, M = {
|
|
318
320
|
family: "'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
319
321
|
label: 13
|
|
320
|
-
},
|
|
321
|
-
function
|
|
322
|
+
}, De = "event-storming-root";
|
|
323
|
+
function Oe(e) {
|
|
322
324
|
return typeof e == "object" && !!e;
|
|
323
325
|
}
|
|
324
|
-
function M(e) {
|
|
325
|
-
return De(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
|
|
326
|
-
}
|
|
327
326
|
function N(e) {
|
|
328
|
-
return
|
|
327
|
+
return Oe(e) && typeof e.eventStormingType == "string" && !("waypoints" in e);
|
|
328
|
+
}
|
|
329
|
+
function P(e) {
|
|
330
|
+
return Oe(e) && typeof e.eventStormingType == "string" && "waypoints" in e;
|
|
329
331
|
}
|
|
330
|
-
var
|
|
332
|
+
var F = [
|
|
331
333
|
"event",
|
|
332
334
|
"command",
|
|
333
335
|
"actor",
|
|
@@ -337,33 +339,33 @@ var P = [
|
|
|
337
339
|
"external",
|
|
338
340
|
"hotspot"
|
|
339
341
|
];
|
|
340
|
-
function F(e) {
|
|
341
|
-
return P.includes(e);
|
|
342
|
-
}
|
|
343
342
|
function I(e) {
|
|
344
|
-
return
|
|
343
|
+
return F.includes(e);
|
|
345
344
|
}
|
|
346
345
|
function L(e) {
|
|
346
|
+
return N(e) && I(e.eventStormingType);
|
|
347
|
+
}
|
|
348
|
+
function ke(e) {
|
|
347
349
|
return r.includes(e);
|
|
348
350
|
}
|
|
349
351
|
function R(e) {
|
|
350
352
|
return s.includes(e);
|
|
351
353
|
}
|
|
352
|
-
function
|
|
353
|
-
return
|
|
354
|
+
function Ae(e) {
|
|
355
|
+
return N(e) && ke(e.eventStormingType);
|
|
354
356
|
}
|
|
355
357
|
function z(e) {
|
|
356
|
-
return
|
|
358
|
+
return N(e) && R(e.eventStormingType);
|
|
357
359
|
}
|
|
358
360
|
function B(e) {
|
|
359
|
-
return
|
|
361
|
+
return N(e) && e.eventStormingType === "drawing";
|
|
360
362
|
}
|
|
361
|
-
function
|
|
362
|
-
return
|
|
363
|
+
function je(e) {
|
|
364
|
+
return N(e) && e.eventStormingType === "note";
|
|
363
365
|
}
|
|
364
366
|
//#endregion
|
|
365
367
|
//#region src/model/EventStormingElementFactory.ts
|
|
366
|
-
var
|
|
368
|
+
var Me = {
|
|
367
369
|
event: "event",
|
|
368
370
|
command: "cmd",
|
|
369
371
|
actor: "actor",
|
|
@@ -374,7 +376,7 @@ var Ae = {
|
|
|
374
376
|
hotspot: "hot",
|
|
375
377
|
note: "note",
|
|
376
378
|
drawing: "draw"
|
|
377
|
-
},
|
|
379
|
+
}, Ne = class {
|
|
378
380
|
elementFactory;
|
|
379
381
|
elementRegistry;
|
|
380
382
|
static $inject = ["elementFactory", "elementRegistry"];
|
|
@@ -393,14 +395,14 @@ var Ae = {
|
|
|
393
395
|
return `${e} ${n}`;
|
|
394
396
|
}
|
|
395
397
|
allocateId(e, t) {
|
|
396
|
-
let n =
|
|
398
|
+
let n = Me[e];
|
|
397
399
|
for (let e = 1;; e++) {
|
|
398
400
|
let r = `${n}_${e}`;
|
|
399
401
|
if (!this.elementRegistry.get(r) && !t?.has(r)) return r;
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
404
|
createSticky(e) {
|
|
403
|
-
if (!
|
|
405
|
+
if (!I(e.elementType)) throw Error(`not a sticky kind: ${e.elementType}`);
|
|
404
406
|
let { width: t, height: n } = w[e.elementType];
|
|
405
407
|
return this.elementFactory.createShape({
|
|
406
408
|
id: e.id,
|
|
@@ -460,7 +462,7 @@ var Ae = {
|
|
|
460
462
|
});
|
|
461
463
|
}
|
|
462
464
|
createNew(e, t) {
|
|
463
|
-
let n = this.uniqueLabel(t), { width: r, height: i } =
|
|
465
|
+
let n = this.uniqueLabel(t), { width: r, height: i } = I(e) ? w[e] : O(n);
|
|
464
466
|
return this.elementFactory.createShape({
|
|
465
467
|
id: this.allocateId(e),
|
|
466
468
|
width: r,
|
|
@@ -485,14 +487,14 @@ var Ae = {
|
|
|
485
487
|
id: e.id,
|
|
486
488
|
source: t,
|
|
487
489
|
target: n,
|
|
488
|
-
waypoints: [
|
|
490
|
+
waypoints: [Pe(t), Pe(n)],
|
|
489
491
|
eventStormingType: "arrow",
|
|
490
492
|
...e.label ? { linkLabel: e.label } : {},
|
|
491
493
|
businessObject: e
|
|
492
494
|
});
|
|
493
495
|
}
|
|
494
496
|
};
|
|
495
|
-
function
|
|
497
|
+
function Pe(e) {
|
|
496
498
|
return {
|
|
497
499
|
x: e.x + e.width / 2,
|
|
498
500
|
y: e.y + e.height / 2
|
|
@@ -500,20 +502,20 @@ function Me(e) {
|
|
|
500
502
|
}
|
|
501
503
|
//#endregion
|
|
502
504
|
//#region src/model/index.ts
|
|
503
|
-
var
|
|
505
|
+
var Fe = { eventStormingElementFactory: ["type", Ne] };
|
|
504
506
|
//#endregion
|
|
505
507
|
//#region src/board-bounds/BoardBounds.ts
|
|
506
|
-
function
|
|
508
|
+
function Ie(e) {
|
|
507
509
|
return e.id !== "event-storming-root" && !e.waypoints && typeof e.x == "number" && typeof e.y == "number" && typeof e.width == "number" && typeof e.height == "number";
|
|
508
510
|
}
|
|
509
|
-
var
|
|
511
|
+
var Le = class {
|
|
510
512
|
elementRegistry;
|
|
511
513
|
static $inject = ["elementRegistry"];
|
|
512
514
|
constructor(e) {
|
|
513
515
|
this.elementRegistry = e;
|
|
514
516
|
}
|
|
515
517
|
contentBounds(e = 120) {
|
|
516
|
-
let t = this.elementRegistry.getAll().filter(
|
|
518
|
+
let t = this.elementRegistry.getAll().filter(Ie);
|
|
517
519
|
if (!t.length) return {
|
|
518
520
|
x: 0,
|
|
519
521
|
y: 0,
|
|
@@ -527,7 +529,7 @@ var Fe = class {
|
|
|
527
529
|
height: a - r + 2 * e
|
|
528
530
|
};
|
|
529
531
|
}
|
|
530
|
-
},
|
|
532
|
+
}, Re = { boardBounds: ["type", Le] }, ze = "eventStorming.viewOptions.changed", Be = class {
|
|
531
533
|
eventBus;
|
|
532
534
|
elementRegistry;
|
|
533
535
|
static $inject = ["eventBus", "elementRegistry"];
|
|
@@ -540,15 +542,15 @@ var Fe = class {
|
|
|
540
542
|
}
|
|
541
543
|
setTypeCaptionsVisible(e) {
|
|
542
544
|
if (e === this._typeCaptionsVisible) return;
|
|
543
|
-
this._typeCaptionsVisible = e, this.eventBus.fire(
|
|
544
|
-
let t = this.elementRegistry.filter(
|
|
545
|
+
this._typeCaptionsVisible = e, this.eventBus.fire(ze, { typeCaptionsVisible: e });
|
|
546
|
+
let t = this.elementRegistry.filter(L);
|
|
545
547
|
t.length && this.eventBus.fire("elements.changed", { elements: t });
|
|
546
548
|
}
|
|
547
549
|
}, V = {
|
|
548
550
|
__depends__: [u],
|
|
549
|
-
eventStormingViewOptions: ["type",
|
|
550
|
-
},
|
|
551
|
-
function
|
|
551
|
+
eventStormingViewOptions: ["type", Be]
|
|
552
|
+
}, Ve = 1500, He = -3, Ue = "event-storming-kind-caption", We = 9, Ge = 300, Ke = "#606060", qe = 7, Je = "#FBFBFB", Ye = "#B9B9B9", Xe = "6 4", Ze = "event-storming-sticky-shadow";
|
|
553
|
+
function Qe(e) {
|
|
552
554
|
let t = e.closest("svg");
|
|
553
555
|
if (!t) return !1;
|
|
554
556
|
if (t.querySelector("#event-storming-sticky-shadow")) return !0;
|
|
@@ -559,7 +561,7 @@ function Xe(e) {
|
|
|
559
561
|
"flood-color": "#000000",
|
|
560
562
|
"flood-opacity": .2
|
|
561
563
|
}), r = p(m("filter"), {
|
|
562
|
-
id:
|
|
564
|
+
id: Ze,
|
|
563
565
|
x: "-40%",
|
|
564
566
|
y: "-40%",
|
|
565
567
|
width: "180%",
|
|
@@ -569,14 +571,14 @@ function Xe(e) {
|
|
|
569
571
|
let i = m("defs");
|
|
570
572
|
return f(i, r), t.insertBefore(i, t.firstChild), !0;
|
|
571
573
|
}
|
|
572
|
-
var
|
|
574
|
+
var $e = class extends d {
|
|
573
575
|
viewOptions;
|
|
574
576
|
static $inject = ["eventBus", "eventStormingViewOptions"];
|
|
575
577
|
constructor(e, t) {
|
|
576
|
-
super(e,
|
|
578
|
+
super(e, Ve), this.viewOptions = t;
|
|
577
579
|
}
|
|
578
580
|
canRender(e) {
|
|
579
|
-
return
|
|
581
|
+
return N(e) || P(e);
|
|
580
582
|
}
|
|
581
583
|
drawShape(e, t) {
|
|
582
584
|
let n = t;
|
|
@@ -586,7 +588,7 @@ var Ze = class extends d {
|
|
|
586
588
|
let n = t.drawingPoints ?? [], r = t.strokeStyle === "dashed" ? "8 5" : t.strokeStyle === "dotted" ? "2 4" : void 0, i = p(m(t.closed ? "polygon" : "polyline"), {
|
|
587
589
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
588
590
|
fill: "none",
|
|
589
|
-
stroke: t.color ??
|
|
591
|
+
stroke: t.color ?? j,
|
|
590
592
|
"stroke-width": 2,
|
|
591
593
|
"stroke-linecap": "round",
|
|
592
594
|
"stroke-linejoin": "round",
|
|
@@ -595,9 +597,9 @@ var Ze = class extends d {
|
|
|
595
597
|
return f(e, i), i;
|
|
596
598
|
}
|
|
597
599
|
drawSticky(e, t) {
|
|
598
|
-
let n = t.eventStormingType, r =
|
|
600
|
+
let n = t.eventStormingType, r = I(n) ? w[n] : T, i = t.provisional === !0, a = e;
|
|
599
601
|
if (n === "hotspot") {
|
|
600
|
-
let n = p(m("g"), { transform: `rotate(${
|
|
602
|
+
let n = p(m("g"), { transform: `rotate(${He} ${t.width / 2} ${t.height / 2})` });
|
|
601
603
|
f(e, n), a = n;
|
|
602
604
|
}
|
|
603
605
|
let o = p(m("rect"), {
|
|
@@ -606,37 +608,37 @@ var Ze = class extends d {
|
|
|
606
608
|
width: Math.max(t.width, 1),
|
|
607
609
|
height: Math.max(t.height, 1),
|
|
608
610
|
rx: 0,
|
|
609
|
-
fill: i ?
|
|
610
|
-
stroke: i ?
|
|
611
|
+
fill: i ? Je : t.color ?? r.fill,
|
|
612
|
+
stroke: i ? Ye : r.stroke,
|
|
611
613
|
"stroke-width": 1.5,
|
|
612
|
-
...i ? { "stroke-dasharray":
|
|
614
|
+
...i ? { "stroke-dasharray": Xe } : {}
|
|
613
615
|
});
|
|
614
|
-
if (
|
|
615
|
-
if (n === "note" ?
|
|
616
|
-
let e = H(w[n].label, t.width / 2, t.height -
|
|
616
|
+
if (Qe(e) && o.setAttribute("filter", `url(#${Ze})`), f(a, o), i) return o;
|
|
617
|
+
if (n === "note" ? it(a, t) : tt(a, t), I(n) && this.viewOptions.typeCaptionsVisible()) {
|
|
618
|
+
let e = H(w[n].label, t.width / 2, t.height - qe, {
|
|
617
619
|
"text-anchor": "middle",
|
|
618
|
-
"font-size":
|
|
619
|
-
fill:
|
|
620
|
+
"font-size": We,
|
|
621
|
+
fill: Ke
|
|
620
622
|
});
|
|
621
|
-
e.setAttribute("class",
|
|
623
|
+
e.setAttribute("class", Ue), e.setAttribute("font-weight", String(Ge)), f(a, e);
|
|
622
624
|
}
|
|
623
625
|
return o;
|
|
624
626
|
}
|
|
625
627
|
drawConnection(e, t) {
|
|
626
|
-
let n = t, [r, i] =
|
|
628
|
+
let n = t, [r, i] = dt(n), a = p(m("polyline"), {
|
|
627
629
|
points: `${r.x},${r.y} ${i.x},${i.y}`,
|
|
628
630
|
fill: "none",
|
|
629
|
-
stroke:
|
|
631
|
+
stroke: A.arrow,
|
|
630
632
|
"stroke-width": 1.5,
|
|
631
633
|
"stroke-linecap": "round"
|
|
632
634
|
});
|
|
633
|
-
if (f(e, a), f(e,
|
|
635
|
+
if (f(e, a), f(e, lt(r, i, A.arrow, 11, 5)), n.linkLabel) {
|
|
634
636
|
let t = (r.x + i.x) / 2, a = (r.y + i.y) / 2;
|
|
635
637
|
f(e, H(n.linkLabel, t, a - 5, {
|
|
636
638
|
"text-anchor": "middle",
|
|
637
639
|
"font-size": 11,
|
|
638
640
|
"font-style": "italic",
|
|
639
|
-
fill:
|
|
641
|
+
fill: A.inkSoft
|
|
640
642
|
}));
|
|
641
643
|
}
|
|
642
644
|
return a;
|
|
@@ -650,7 +652,7 @@ var Ze = class extends d {
|
|
|
650
652
|
return t ? `M${t.x},${t.y}` + n.map((e) => `L${e.x},${e.y}`).join("") : "";
|
|
651
653
|
}
|
|
652
654
|
};
|
|
653
|
-
function
|
|
655
|
+
function et(e, t) {
|
|
654
656
|
let n = e.split(/\s+/).filter((e) => e.length);
|
|
655
657
|
if (!n.length) return [""];
|
|
656
658
|
let r = [], i = "";
|
|
@@ -667,25 +669,25 @@ function Qe(e, t) {
|
|
|
667
669
|
}
|
|
668
670
|
return r.push(i), r;
|
|
669
671
|
}
|
|
670
|
-
function
|
|
671
|
-
let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) =>
|
|
672
|
+
function tt(e, t) {
|
|
673
|
+
let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = (t.eventStormingLabel ?? "").split("\n").flatMap((e) => et(e, r)).slice(0, i), o = t.width / 2, s = t.height / 2 - (a.length - 1) * 17 / 2 + 4;
|
|
672
674
|
a.forEach((t, n) => {
|
|
673
675
|
f(e, H(t, o, s + n * 17, {
|
|
674
676
|
"text-anchor": "middle",
|
|
675
|
-
fill:
|
|
677
|
+
fill: A.stickyText
|
|
676
678
|
}));
|
|
677
679
|
});
|
|
678
680
|
}
|
|
679
|
-
var
|
|
680
|
-
function
|
|
681
|
-
let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = C(t.eventStormingLabel ?? "").flatMap((e) =>
|
|
681
|
+
var nt = 2, rt = 12.5;
|
|
682
|
+
function it(e, t) {
|
|
683
|
+
let n = t.width - 16, r = Math.max(1, Math.floor(n / D)), i = Math.max(1, Math.floor((t.height - 16) / 17)), a = C(t.eventStormingLabel ?? "").flatMap((e) => at(e, r)).slice(0, i), o = t.alignHorizontal ?? "left", s = t.alignVertical ?? "top", c = o === "left" ? "start" : o === "center" ? "middle" : "end", l = a.length * 17, u = s === "top" ? 8 : s === "middle" ? (t.height - l) / 2 : t.height - 8 - l;
|
|
682
684
|
a.forEach((n, r) => {
|
|
683
685
|
let i = o === "left" ? 8 + (n.indent ? 12 : 0) : o === "center" ? t.width / 2 : t.width - 8, a = p(m("text"), {
|
|
684
686
|
x: i,
|
|
685
|
-
y: u + r * 17 +
|
|
686
|
-
"font-family":
|
|
687
|
-
"font-size":
|
|
688
|
-
fill:
|
|
687
|
+
y: u + r * 17 + rt,
|
|
688
|
+
"font-family": M.family,
|
|
689
|
+
"font-size": M.label,
|
|
690
|
+
fill: A.stickyText,
|
|
689
691
|
"text-anchor": c
|
|
690
692
|
}), s = n.marker ? [{
|
|
691
693
|
text: "• ",
|
|
@@ -699,19 +701,19 @@ function nt(e, t) {
|
|
|
699
701
|
f(e, a);
|
|
700
702
|
});
|
|
701
703
|
}
|
|
702
|
-
function
|
|
703
|
-
let n = Math.max(1, t - (e.bullet ?
|
|
704
|
-
return
|
|
704
|
+
function at(e, t) {
|
|
705
|
+
let n = Math.max(1, t - (e.bullet ? nt : 0));
|
|
706
|
+
return ot(e.runs, n).map((t, n) => ({
|
|
705
707
|
runs: t,
|
|
706
708
|
marker: e.bullet && n === 0,
|
|
707
709
|
indent: e.bullet && n > 0
|
|
708
710
|
}));
|
|
709
711
|
}
|
|
710
|
-
function
|
|
712
|
+
function ot(e, t) {
|
|
711
713
|
let n = e.map((e) => e.text).join("");
|
|
712
|
-
return n.length <= t ? [e] :
|
|
714
|
+
return n.length <= t ? [e] : st(n, t).map(([t, n]) => ct(e, t, n));
|
|
713
715
|
}
|
|
714
|
-
function
|
|
716
|
+
function st(e, t) {
|
|
715
717
|
let n = [...e.matchAll(/\S+/g)];
|
|
716
718
|
if (!n.length) return [[0, 0]];
|
|
717
719
|
let r = [], i = -1, a = -1, o = () => {
|
|
@@ -732,7 +734,7 @@ function at(e, t) {
|
|
|
732
734
|
}
|
|
733
735
|
return o(), r;
|
|
734
736
|
}
|
|
735
|
-
function
|
|
737
|
+
function ct(e, t, n) {
|
|
736
738
|
let r = [], i = 0;
|
|
737
739
|
for (let a of e) {
|
|
738
740
|
let e = i;
|
|
@@ -750,14 +752,14 @@ function H(e, t, n, r = {}) {
|
|
|
750
752
|
let i = p(m("text"), {
|
|
751
753
|
x: t,
|
|
752
754
|
y: n,
|
|
753
|
-
"font-family":
|
|
754
|
-
"font-size":
|
|
755
|
-
fill:
|
|
755
|
+
"font-family": M.family,
|
|
756
|
+
"font-size": M.label,
|
|
757
|
+
fill: A.ink,
|
|
756
758
|
...r
|
|
757
759
|
});
|
|
758
760
|
return i.textContent = e, i;
|
|
759
761
|
}
|
|
760
|
-
function
|
|
762
|
+
function lt(e, t, n, r = 10, i = 5) {
|
|
761
763
|
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)}`;
|
|
762
764
|
return p(m("polygon"), {
|
|
763
765
|
points: c,
|
|
@@ -770,7 +772,7 @@ function U(e) {
|
|
|
770
772
|
y: e.y + e.height / 2
|
|
771
773
|
};
|
|
772
774
|
}
|
|
773
|
-
function
|
|
775
|
+
function ut(e, t) {
|
|
774
776
|
let n = U(e), r = t.x - n.x, i = t.y - n.y;
|
|
775
777
|
if (r === 0 && i === 0) return n;
|
|
776
778
|
let a = e.width / 2 + 2, o = e.height / 2 + 2, s = Math.min(r === 0 ? Infinity : a / Math.abs(r), i === 0 ? Infinity : o / Math.abs(i));
|
|
@@ -779,7 +781,7 @@ function ct(e, t) {
|
|
|
779
781
|
y: n.y + i * s
|
|
780
782
|
};
|
|
781
783
|
}
|
|
782
|
-
function
|
|
784
|
+
function dt(e) {
|
|
783
785
|
let t = e.source, n = e.target, r = e.waypoints;
|
|
784
786
|
if (!t || !n) {
|
|
785
787
|
let e = r[0] ?? {
|
|
@@ -788,16 +790,16 @@ function lt(e) {
|
|
|
788
790
|
};
|
|
789
791
|
return [e, r[r.length - 1] ?? e];
|
|
790
792
|
}
|
|
791
|
-
let i = U(t), a = U(n), o =
|
|
793
|
+
let i = U(t), a = U(n), o = ut(t, a), s = ut(n, i);
|
|
792
794
|
return (a.x - i.x) * (s.x - o.x) + (a.y - i.y) * (s.y - o.y) <= 0 ? [i, a] : [o, s];
|
|
793
795
|
}
|
|
794
796
|
//#endregion
|
|
795
797
|
//#region src/draw/index.ts
|
|
796
|
-
var
|
|
798
|
+
var ft = {
|
|
797
799
|
__depends__: [V],
|
|
798
800
|
__init__: ["eventStormingRenderer"],
|
|
799
|
-
eventStormingRenderer: ["type",
|
|
800
|
-
},
|
|
801
|
+
eventStormingRenderer: ["type", $e]
|
|
802
|
+
}, pt = { drawing: 0 }, mt = class {
|
|
801
803
|
canvas;
|
|
802
804
|
elementFactory;
|
|
803
805
|
factory;
|
|
@@ -828,8 +830,8 @@ var ut = {
|
|
|
828
830
|
r = void 0;
|
|
829
831
|
}
|
|
830
832
|
let i;
|
|
831
|
-
r && r.id === "event-storming-root" ? i = r : (i = this.elementFactory.createRoot({ id:
|
|
832
|
-
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (
|
|
833
|
+
r && r.id === "event-storming-root" ? i = r : (i = this.elementFactory.createRoot({ id: De }), this.canvas.setRootElement(i)), i.businessObject = n;
|
|
834
|
+
let a = /* @__PURE__ */ new Map(), o = [...e.elements].sort((e, t) => (pt[e.elementType] ?? 9) - (pt[t.elementType] ?? 9)), s = o.filter((e) => e.elementType === "drawing"), c = o.filter((e) => e.elementType !== "drawing");
|
|
833
835
|
for (let e of s) {
|
|
834
836
|
let t = this.createShape(e);
|
|
835
837
|
this.canvas.addShape(t, i), a.set(e.id, t);
|
|
@@ -880,7 +882,7 @@ var ut = {
|
|
|
880
882
|
} catch {}
|
|
881
883
|
}
|
|
882
884
|
}
|
|
883
|
-
},
|
|
885
|
+
}, ht = class {
|
|
884
886
|
elementRegistry;
|
|
885
887
|
canvas;
|
|
886
888
|
static $inject = ["elementRegistry", "canvas"];
|
|
@@ -890,14 +892,14 @@ var ut = {
|
|
|
890
892
|
export() {
|
|
891
893
|
let e = this.canvas.getRootElement().businessObject, t = e?.config ?? { title: "Untitled Board" }, n = [], r = [];
|
|
892
894
|
for (let e of this.elementRegistry.getAll()) if (e.id !== "event-storming-root") {
|
|
893
|
-
if (
|
|
895
|
+
if (P(e)) r.push({
|
|
894
896
|
id: e.id,
|
|
895
897
|
edgeType: "arrow",
|
|
896
898
|
from: e.source?.id ?? "",
|
|
897
899
|
to: e.target?.id ?? "",
|
|
898
900
|
...e.linkLabel ? { label: e.linkLabel } : {}
|
|
899
901
|
});
|
|
900
|
-
else if (
|
|
902
|
+
else if (N(e)) {
|
|
901
903
|
let t = this.buildElement(e);
|
|
902
904
|
t && n.push(t);
|
|
903
905
|
}
|
|
@@ -928,10 +930,10 @@ var ut = {
|
|
|
928
930
|
...e.color ? { color: e.color } : {}
|
|
929
931
|
};
|
|
930
932
|
}
|
|
931
|
-
let t = e.eventStormingType === "note" &&
|
|
933
|
+
let t = e.eventStormingType === "note" && k(e.eventStormingLabel, e) ? {
|
|
932
934
|
width: e.width,
|
|
933
935
|
height: e.height
|
|
934
|
-
} : void 0, n = e.eventStormingType === "note" ?
|
|
936
|
+
} : void 0, n = e.eventStormingType === "note" ? gt(e) : void 0;
|
|
935
937
|
return {
|
|
936
938
|
id: e.id,
|
|
937
939
|
elementType: e.eventStormingType,
|
|
@@ -947,29 +949,29 @@ var ut = {
|
|
|
947
949
|
};
|
|
948
950
|
}
|
|
949
951
|
};
|
|
950
|
-
function
|
|
952
|
+
function gt(e) {
|
|
951
953
|
let t = e.alignHorizontal && e.alignHorizontal !== "left" ? e.alignHorizontal : void 0, n = e.alignVertical && e.alignVertical !== "top" ? e.alignVertical : void 0;
|
|
952
|
-
if (
|
|
954
|
+
if (t || n) return {
|
|
953
955
|
...t ? { horizontal: t } : {},
|
|
954
956
|
...n ? { vertical: n } : {}
|
|
955
957
|
};
|
|
956
958
|
}
|
|
957
959
|
//#endregion
|
|
958
960
|
//#region src/io/index.ts
|
|
959
|
-
var
|
|
960
|
-
eventStormingImporter: ["type",
|
|
961
|
-
eventStormingExporter: ["type",
|
|
962
|
-
},
|
|
961
|
+
var _t = {
|
|
962
|
+
eventStormingImporter: ["type", mt],
|
|
963
|
+
eventStormingExporter: ["type", ht]
|
|
964
|
+
}, vt = class extends ye {
|
|
963
965
|
_getModules() {
|
|
964
966
|
return [
|
|
965
|
-
|
|
966
|
-
|
|
967
|
+
Fe,
|
|
968
|
+
Re,
|
|
967
969
|
V,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
+
ft,
|
|
971
|
+
_t
|
|
970
972
|
];
|
|
971
973
|
}
|
|
972
|
-
},
|
|
974
|
+
}, yt = class extends vt {
|
|
973
975
|
_getModules() {
|
|
974
976
|
return [
|
|
975
977
|
...super._getModules(),
|
|
@@ -979,34 +981,34 @@ var ht = {
|
|
|
979
981
|
y
|
|
980
982
|
];
|
|
981
983
|
}
|
|
982
|
-
},
|
|
984
|
+
}, bt = class extends ce {
|
|
983
985
|
static $inject = ["eventBus", "modeling"];
|
|
984
986
|
constructor(e, t) {
|
|
985
987
|
super(e), this.preExecute("element.updateProperties", (e) => {
|
|
986
988
|
let { element: n, properties: r } = e.context, i = r.eventStormingType;
|
|
987
989
|
if (typeof i != "string") return;
|
|
988
990
|
let a = n;
|
|
989
|
-
if (a.host && !
|
|
991
|
+
if (a.host && !ke(i) && t.updateAttachment(a, void 0), a.attachers?.length && !R(i)) for (let e of [...a.attachers]) t.updateAttachment(e, void 0);
|
|
990
992
|
});
|
|
991
993
|
}
|
|
992
|
-
},
|
|
994
|
+
}, xt = {
|
|
993
995
|
__depends__: [se],
|
|
994
996
|
__init__: ["eventStormingAttachBehavior"],
|
|
995
|
-
eventStormingAttachBehavior: ["type",
|
|
997
|
+
eventStormingAttachBehavior: ["type", bt]
|
|
996
998
|
};
|
|
997
999
|
//#endregion
|
|
998
1000
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
999
|
-
function
|
|
1001
|
+
function St(e, t, n) {
|
|
1000
1002
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
1001
1003
|
}
|
|
1002
|
-
var
|
|
1004
|
+
var Ct = [
|
|
1003
1005
|
"x",
|
|
1004
1006
|
"y",
|
|
1005
1007
|
"width",
|
|
1006
1008
|
"height"
|
|
1007
1009
|
];
|
|
1008
|
-
function
|
|
1009
|
-
if (!t.some((e) =>
|
|
1010
|
+
function wt(e, t) {
|
|
1011
|
+
if (!t.some((e) => Ct.includes(e))) return [e];
|
|
1010
1012
|
let n = e;
|
|
1011
1013
|
return [
|
|
1012
1014
|
e,
|
|
@@ -1014,18 +1016,18 @@ function St(e, t) {
|
|
|
1014
1016
|
...n.outgoing ?? []
|
|
1015
1017
|
];
|
|
1016
1018
|
}
|
|
1017
|
-
var
|
|
1019
|
+
var Tt = class {
|
|
1018
1020
|
execute(e) {
|
|
1019
1021
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
1020
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
1021
|
-
return e.oldProperties = i,
|
|
1022
|
+
for (let e of Object.keys(n)) i[e] = r[e], St(r, e, n[e]);
|
|
1023
|
+
return e.oldProperties = i, wt(t, Object.keys(n));
|
|
1022
1024
|
}
|
|
1023
1025
|
revert(e) {
|
|
1024
1026
|
let { element: t, oldProperties: n } = e, r = t;
|
|
1025
|
-
if (n) for (let e of Object.keys(n))
|
|
1026
|
-
return
|
|
1027
|
+
if (n) for (let e of Object.keys(n)) St(r, e, n[e]);
|
|
1028
|
+
return wt(t, Object.keys(n ?? {}));
|
|
1027
1029
|
}
|
|
1028
|
-
}, W = "element.updateProperties",
|
|
1030
|
+
}, W = "element.updateProperties", Et = class {
|
|
1029
1031
|
commandStack;
|
|
1030
1032
|
canvas;
|
|
1031
1033
|
elementRegistry;
|
|
@@ -1035,7 +1037,7 @@ var Ct = class {
|
|
|
1035
1037
|
"elementRegistry"
|
|
1036
1038
|
];
|
|
1037
1039
|
constructor(e, t, n) {
|
|
1038
|
-
this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(W,
|
|
1040
|
+
this.commandStack = e, this.canvas = t, this.elementRegistry = n, e.registerHandler(W, Tt);
|
|
1039
1041
|
}
|
|
1040
1042
|
updateProperties(e, t) {
|
|
1041
1043
|
this.commandStack.execute(W, {
|
|
@@ -1044,7 +1046,7 @@ var Ct = class {
|
|
|
1044
1046
|
});
|
|
1045
1047
|
}
|
|
1046
1048
|
updateLabel(e, t) {
|
|
1047
|
-
if (e.eventStormingType === "note" && !
|
|
1049
|
+
if (e.eventStormingType === "note" && !k(e.eventStormingLabel, e)) {
|
|
1048
1050
|
let { width: n, height: r } = O(t), i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
1049
1051
|
this.updateProperties(e, {
|
|
1050
1052
|
eventStormingLabel: t,
|
|
@@ -1058,7 +1060,7 @@ var Ct = class {
|
|
|
1058
1060
|
this.updateProperties(e, { eventStormingLabel: t });
|
|
1059
1061
|
}
|
|
1060
1062
|
setStickyKind(e, t) {
|
|
1061
|
-
if (!
|
|
1063
|
+
if (!I(e.eventStormingType) || !I(t)) throw Error("setStickyKind: only sticky kinds can be retyped");
|
|
1062
1064
|
if (e.eventStormingType === t && !e.provisional) return;
|
|
1063
1065
|
let { width: n, height: r } = w[t], i = e.x + e.width / 2, a = e.y + e.height / 2;
|
|
1064
1066
|
this.updateProperties(e, {
|
|
@@ -1096,7 +1098,7 @@ var Ct = class {
|
|
|
1096
1098
|
root() {
|
|
1097
1099
|
return this.elementRegistry.get("event-storming-root") ?? this.canvas.getRootElement();
|
|
1098
1100
|
}
|
|
1099
|
-
},
|
|
1101
|
+
}, Dt = 24, Ot = [
|
|
1100
1102
|
"eventStormingType",
|
|
1101
1103
|
"color",
|
|
1102
1104
|
"drawingPoints",
|
|
@@ -1104,8 +1106,8 @@ var Ct = class {
|
|
|
1104
1106
|
"strokeStyle",
|
|
1105
1107
|
"alignHorizontal",
|
|
1106
1108
|
"alignVertical"
|
|
1107
|
-
],
|
|
1108
|
-
function
|
|
1109
|
+
], kt = ["eventStormingType", "linkLabel"];
|
|
1110
|
+
function At(e, t) {
|
|
1109
1111
|
let n = {};
|
|
1110
1112
|
for (let r of t) {
|
|
1111
1113
|
let t = e[r];
|
|
@@ -1113,7 +1115,7 @@ function Ot(e, t) {
|
|
|
1113
1115
|
}
|
|
1114
1116
|
return n;
|
|
1115
1117
|
}
|
|
1116
|
-
var
|
|
1118
|
+
var jt = class {
|
|
1117
1119
|
selection;
|
|
1118
1120
|
modeling;
|
|
1119
1121
|
elementFactory;
|
|
@@ -1136,23 +1138,23 @@ var kt = class {
|
|
|
1136
1138
|
this.selection = e, this.modeling = t, this.elementFactory = n, this.esFactory = r, this.canvas = i, this.create = a, this.mouse = o;
|
|
1137
1139
|
}
|
|
1138
1140
|
copy() {
|
|
1139
|
-
let e = this.selection.get().filter((e) =>
|
|
1141
|
+
let e = this.selection.get().filter((e) => N(e));
|
|
1140
1142
|
if (!e.length) return !1;
|
|
1141
1143
|
let t = new Map(e.map((e, t) => [e, t])), n = [], r = /* @__PURE__ */ new Set();
|
|
1142
1144
|
for (let i of e) for (let e of [...i.incoming ?? [], ...i.outgoing ?? []]) {
|
|
1143
|
-
if (!
|
|
1145
|
+
if (!P(e) || r.has(e)) continue;
|
|
1144
1146
|
let i = t.get(e.source), a = t.get(e.target);
|
|
1145
1147
|
i !== void 0 && a !== void 0 && (r.add(e), n.push({
|
|
1146
1148
|
sourceIdx: i,
|
|
1147
1149
|
targetIdx: a,
|
|
1148
|
-
props:
|
|
1150
|
+
props: At(e, kt)
|
|
1149
1151
|
}));
|
|
1150
1152
|
}
|
|
1151
1153
|
return this.clipboard = {
|
|
1152
1154
|
shapes: e.map((e) => {
|
|
1153
1155
|
let n = e.host ? t.get(e.host) : void 0;
|
|
1154
1156
|
return {
|
|
1155
|
-
props:
|
|
1157
|
+
props: At(e, Ot),
|
|
1156
1158
|
x: e.x,
|
|
1157
1159
|
y: e.y,
|
|
1158
1160
|
width: e.width,
|
|
@@ -1193,26 +1195,26 @@ var kt = class {
|
|
|
1193
1195
|
...structuredClone(e.props),
|
|
1194
1196
|
source: n[e.sourceIdx],
|
|
1195
1197
|
target: n[e.targetIdx],
|
|
1196
|
-
waypoints: [
|
|
1198
|
+
waypoints: [Mt(n[e.sourceIdx]), Mt(n[e.targetIdx])]
|
|
1197
1199
|
}))
|
|
1198
1200
|
};
|
|
1199
1201
|
}
|
|
1200
1202
|
insertWithOffset(e) {
|
|
1201
1203
|
this.pasteCount++;
|
|
1202
|
-
let t =
|
|
1204
|
+
let t = Dt * this.pasteCount, n = Nt(e.shapes), r = this.modeling.createElements([...e.shapes, ...e.connections], {
|
|
1203
1205
|
x: n.cx + t,
|
|
1204
1206
|
y: n.cy + t
|
|
1205
1207
|
}, this.canvas.getRootElement());
|
|
1206
1208
|
return this.selection.select(r), !0;
|
|
1207
1209
|
}
|
|
1208
1210
|
};
|
|
1209
|
-
function
|
|
1211
|
+
function Mt(e) {
|
|
1210
1212
|
return {
|
|
1211
1213
|
x: e.x + e.width / 2,
|
|
1212
1214
|
y: e.y + e.height / 2
|
|
1213
1215
|
};
|
|
1214
1216
|
}
|
|
1215
|
-
function
|
|
1217
|
+
function Nt(e) {
|
|
1216
1218
|
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));
|
|
1217
1219
|
return {
|
|
1218
1220
|
cx: (t + r) / 2,
|
|
@@ -1221,12 +1223,12 @@ function jt(e) {
|
|
|
1221
1223
|
}
|
|
1222
1224
|
//#endregion
|
|
1223
1225
|
//#region src/modeling/index.ts
|
|
1224
|
-
var
|
|
1226
|
+
var Pt = {
|
|
1225
1227
|
__depends__: [le, ee],
|
|
1226
1228
|
__init__: ["eventStormingModeling"],
|
|
1227
|
-
eventStormingModeling: ["type",
|
|
1228
|
-
eventStormingCopyPaste: ["type",
|
|
1229
|
-
},
|
|
1229
|
+
eventStormingModeling: ["type", Et],
|
|
1230
|
+
eventStormingCopyPaste: ["type", jt]
|
|
1231
|
+
}, Ft = {
|
|
1230
1232
|
__depends__: [ue],
|
|
1231
1233
|
__init__: ["eventStormingLassoBehavior"],
|
|
1232
1234
|
eventStormingLassoBehavior: ["type", class {
|
|
@@ -1252,43 +1254,43 @@ var Mt = {
|
|
|
1252
1254
|
};
|
|
1253
1255
|
//#endregion
|
|
1254
1256
|
//#region src/rules/EventStormingRules.ts
|
|
1255
|
-
function
|
|
1257
|
+
function It(e, t) {
|
|
1256
1258
|
return (e.outgoing ?? []).some((e) => e.target === t);
|
|
1257
1259
|
}
|
|
1258
|
-
function
|
|
1259
|
-
return e.length !== 1 || !
|
|
1260
|
+
function Lt(e, t) {
|
|
1261
|
+
return e.length !== 1 || !Ae(e[0]) || !z(t) ? !1 : "attach";
|
|
1260
1262
|
}
|
|
1261
|
-
var
|
|
1263
|
+
var Rt = class extends de {
|
|
1262
1264
|
static $inject = ["eventBus"];
|
|
1263
1265
|
constructor(e) {
|
|
1264
1266
|
super(e);
|
|
1265
1267
|
}
|
|
1266
1268
|
init() {
|
|
1267
|
-
this.addRule("connection.start", (e) =>
|
|
1269
|
+
this.addRule("connection.start", (e) => L(e.source)), this.addRule("connection.create", (e) => {
|
|
1268
1270
|
let { source: t, target: n } = e;
|
|
1269
|
-
return !
|
|
1270
|
-
}), this.addRule(["shape.move", "elements.move"], (e) =>
|
|
1271
|
-
if (!
|
|
1271
|
+
return !L(t) || !L(n) || t === n || It(t, n) ? !1 : { eventStormingType: "arrow" };
|
|
1272
|
+
}), this.addRule(["shape.move", "elements.move"], (e) => Lt(e.shapes ?? (e.shape ? [e.shape] : []), e.target) || !0), this.addRule("shape.create", () => !0), this.addRule("elements.create", () => !0), this.addRule("shape.resize", (e) => {
|
|
1273
|
+
if (!je(e.shape)) return !1;
|
|
1272
1274
|
let { newBounds: t } = e;
|
|
1273
1275
|
return !t || t.width >= E.width && t.height >= E.height;
|
|
1274
1276
|
});
|
|
1275
1277
|
}
|
|
1276
|
-
},
|
|
1278
|
+
}, zt = {
|
|
1277
1279
|
__init__: ["eventStormingRules"],
|
|
1278
|
-
eventStormingRules: ["type",
|
|
1279
|
-
},
|
|
1280
|
+
eventStormingRules: ["type", Rt]
|
|
1281
|
+
}, Bt = 8, Vt = {
|
|
1280
1282
|
__init__: ["elementSnapping"],
|
|
1281
1283
|
elementSnapping: ["type", class {
|
|
1282
1284
|
static $inject = ["eventBus", "elementRegistry"];
|
|
1283
1285
|
constructor(e, t) {
|
|
1284
|
-
let n = (e) => t.getAll().filter((t) =>
|
|
1286
|
+
let n = (e) => t.getAll().filter((t) => N(t) && t.eventStormingType !== "drawing" && !e.has(t.id)).map((e) => ({
|
|
1285
1287
|
x: e.x + e.width / 2,
|
|
1286
1288
|
y: e.y + e.height / 2
|
|
1287
1289
|
})), r = (e, t) => {
|
|
1288
1290
|
let n, r = 9;
|
|
1289
1291
|
for (let i of t) {
|
|
1290
1292
|
let t = Math.abs(i - e);
|
|
1291
|
-
t <=
|
|
1293
|
+
t <= Bt && t < r && (n = i, r = t);
|
|
1292
1294
|
}
|
|
1293
1295
|
return n;
|
|
1294
1296
|
};
|
|
@@ -1320,21 +1322,21 @@ var It = class extends de {
|
|
|
1320
1322
|
});
|
|
1321
1323
|
}
|
|
1322
1324
|
}]
|
|
1323
|
-
}, G = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`,
|
|
1324
|
-
draw: G(`<polyline points="3,18 8.5,7 14,14 21,4" fill="none" stroke="${
|
|
1325
|
-
lasso: G(`<rect x="3" y="3" width="13" height="13" rx="2" fill="none" stroke="${
|
|
1326
|
-
note:
|
|
1325
|
+
}, G = (e) => `<svg width="24" height="24" viewBox="0 0 24 24" class="event-storming-palette-svg">${e}</svg>`, Ht = (e, t, n = 0) => G(`<rect x="4" y="5" width="16" height="14" fill="${e}" stroke="${t}" stroke-width="1.5"${n ? ` transform="rotate(${n} 12 12)"` : ""}/>`), K = {
|
|
1326
|
+
draw: G(`<polyline points="3,18 8.5,7 14,14 21,4" fill="none" stroke="${A.ink}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><circle cx="3" cy="18" r="2.2" fill="${A.surface}" stroke="${A.ink}" stroke-width="1.4"/>`),
|
|
1327
|
+
lasso: G(`<rect x="3" y="3" width="13" height="13" rx="2" fill="none" stroke="${A.ink}" stroke-width="1.5" stroke-dasharray="3 2.5"/><path d="M13.5 13.5l7 2.7-3 1.3-1.3 3z" fill="${A.ink}"/>`),
|
|
1328
|
+
note: Ht(T.fill, T.stroke)
|
|
1327
1329
|
};
|
|
1328
|
-
for (let e of
|
|
1330
|
+
for (let e of F) {
|
|
1329
1331
|
let t = w[e];
|
|
1330
|
-
K[e] =
|
|
1332
|
+
K[e] = Ht(t.fill, t.stroke, e === "hotspot" ? -6 : 0);
|
|
1331
1333
|
}
|
|
1332
|
-
function
|
|
1334
|
+
function Ut(e, t) {
|
|
1333
1335
|
return `<svg width="14" height="14" viewBox="0 0 14 14" class="event-storming-palette-svg"><rect x="1" y="1" width="12" height="12" fill="${e}" stroke="${t}" stroke-width="1"/></svg>`;
|
|
1334
1336
|
}
|
|
1335
1337
|
//#endregion
|
|
1336
1338
|
//#region src/palette/EventStormingPaletteProvider.ts
|
|
1337
|
-
var q = "stickies-1", J = "stickies-2",
|
|
1339
|
+
var q = "stickies-1", J = "stickies-2", Wt = "stickies-3", Gt = [
|
|
1338
1340
|
{
|
|
1339
1341
|
key: "event",
|
|
1340
1342
|
type: "event",
|
|
@@ -1389,80 +1391,119 @@ var q = "stickies-1", J = "stickies-2", Ht = "stickies-3", Ut = [
|
|
|
1389
1391
|
type: "hotspot",
|
|
1390
1392
|
label: w.hotspot.label,
|
|
1391
1393
|
title: "Hotspot",
|
|
1392
|
-
group:
|
|
1394
|
+
group: Wt
|
|
1393
1395
|
},
|
|
1394
1396
|
{
|
|
1395
1397
|
key: "note",
|
|
1396
1398
|
type: "note",
|
|
1397
1399
|
label: T.label,
|
|
1398
1400
|
title: "Note",
|
|
1399
|
-
group:
|
|
1401
|
+
group: Wt
|
|
1400
1402
|
}
|
|
1401
|
-
],
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1403
|
+
], Kt = class {
|
|
1404
|
+
create;
|
|
1405
|
+
factory;
|
|
1406
|
+
lassoTool;
|
|
1407
|
+
drawTool;
|
|
1408
|
+
eventStormingModeling;
|
|
1409
|
+
static $inject = [
|
|
1410
|
+
"palette",
|
|
1411
|
+
"create",
|
|
1412
|
+
"eventStormingElementFactory",
|
|
1413
|
+
"lassoTool",
|
|
1414
|
+
"eventStormingDrawTool",
|
|
1415
|
+
"eventStormingModeling",
|
|
1416
|
+
"eventBus"
|
|
1417
|
+
];
|
|
1418
|
+
constructor(e, t, n, r, i, a, o) {
|
|
1419
|
+
this.create = t, this.factory = n, this.lassoTool = r, this.drawTool = i, this.eventStormingModeling = a, e.registerProvider(this);
|
|
1420
|
+
let s = () => e._rebuild();
|
|
1421
|
+
o.on("import.done", s), o.on(["commandStack.element.updateProperties.postExecuted", "commandStack.element.updateProperties.reverted"], (e) => {
|
|
1422
|
+
e.context.element.id === "event-storming-root" && s();
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
getPaletteEntries() {
|
|
1426
|
+
let e = {};
|
|
1427
|
+
e["lasso-tool"] = {
|
|
1428
|
+
group: "tools",
|
|
1429
|
+
title: "Selection tool — L (or Shift+drag)",
|
|
1430
|
+
html: `<div class="entry event-storming-palette-entry">${K.lasso}</div>`,
|
|
1431
|
+
action: { click: (e) => this.lassoTool.activateSelection(e) }
|
|
1432
|
+
}, e["draw-tool"] = {
|
|
1433
|
+
group: "tools",
|
|
1434
|
+
title: "Draw — click point by point, double-click/Enter finishes, click the start point to close",
|
|
1435
|
+
html: `<div class="entry event-storming-palette-entry">${K.draw}</div>`,
|
|
1436
|
+
action: { click: () => this.drawTool.toggle() }
|
|
1437
|
+
};
|
|
1438
|
+
let t = c[this.eventStormingModeling.getLevel()];
|
|
1439
|
+
for (let n of Gt) {
|
|
1440
|
+
if (n.type !== "note" && !t.includes(n.type)) continue;
|
|
1441
|
+
let r = (e) => {
|
|
1442
|
+
let t = this.factory.createNew(n.type, n.label);
|
|
1443
|
+
this.create.start(e, t);
|
|
1444
|
+
};
|
|
1445
|
+
e[`create.${n.key}`] = {
|
|
1446
|
+
group: n.group,
|
|
1447
|
+
title: n.title,
|
|
1448
|
+
html: `<div class="entry event-storming-palette-entry" draggable="true">${K[n.key]}</div>`,
|
|
1449
|
+
action: {
|
|
1450
|
+
dragstart: r,
|
|
1451
|
+
click: r
|
|
1452
|
+
}
|
|
1437
1453
|
};
|
|
1438
|
-
let t = c[this.eventStormingModeling.getLevel()];
|
|
1439
|
-
for (let n of Ut) {
|
|
1440
|
-
if (n.type !== "note" && !t.includes(n.type)) continue;
|
|
1441
|
-
let r = (e) => {
|
|
1442
|
-
let t = this.factory.createNew(n.type, n.label);
|
|
1443
|
-
this.create.start(e, t);
|
|
1444
|
-
};
|
|
1445
|
-
e[`create.${n.key}`] = {
|
|
1446
|
-
group: n.group,
|
|
1447
|
-
title: n.title,
|
|
1448
|
-
html: `<div class="entry event-storming-palette-entry" draggable="true" title="${n.title}">${K[n.key]}</div>`,
|
|
1449
|
-
action: {
|
|
1450
|
-
dragstart: r,
|
|
1451
|
-
click: r
|
|
1452
|
-
}
|
|
1453
|
-
};
|
|
1454
|
-
}
|
|
1455
|
-
return e;
|
|
1456
1454
|
}
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1455
|
+
return e;
|
|
1456
|
+
}
|
|
1457
|
+
}, qt = ".djs-palette-entries .entry", Jt = "bottom", Yt = class {
|
|
1458
|
+
palette;
|
|
1459
|
+
hoverTooltip;
|
|
1460
|
+
static $inject = [
|
|
1461
|
+
"eventBus",
|
|
1462
|
+
"palette",
|
|
1463
|
+
"hoverTooltip"
|
|
1464
|
+
];
|
|
1465
|
+
entries = {};
|
|
1466
|
+
constructor(e, t, n) {
|
|
1467
|
+
this.palette = t, this.hoverTooltip = n, e.on("palette.create", (e) => this.attachTo(e.container)), e.on("palette.changed", () => this.refreshEntries());
|
|
1468
|
+
}
|
|
1469
|
+
attachTo(e) {
|
|
1470
|
+
this.refreshEntries(), this.hoverTooltip.add({
|
|
1471
|
+
container: e,
|
|
1472
|
+
selector: qt,
|
|
1473
|
+
getContent: (e) => this.contentFor(e),
|
|
1474
|
+
getPosition: (e) => Xt(e)
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
refreshEntries() {
|
|
1478
|
+
this.entries = this.palette.getEntries();
|
|
1479
|
+
}
|
|
1480
|
+
contentFor(e) {
|
|
1481
|
+
let t = this.entries[e.getAttribute("data-action") ?? ""];
|
|
1482
|
+
return t?.title ? pe`<${fe} title=${t.title} shortcut=${t.shortcut} />` : null;
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
function Xt(e) {
|
|
1486
|
+
let t = e.getBoundingClientRect();
|
|
1487
|
+
return {
|
|
1488
|
+
x: t.left + t.width / 2,
|
|
1489
|
+
y: t.bottom + 8,
|
|
1490
|
+
placement: Jt
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
//#endregion
|
|
1494
|
+
//#region src/palette/index.ts
|
|
1495
|
+
var Zt = {
|
|
1496
|
+
__init__: ["eventStormingPaletteProvider", "paletteTooltip"],
|
|
1497
|
+
eventStormingPaletteProvider: ["type", Kt],
|
|
1498
|
+
paletteTooltip: ["type", Yt]
|
|
1499
|
+
}, Y = "event-storming-element-settings", Qt = {
|
|
1459
1500
|
id: "kind",
|
|
1460
1501
|
name: "Change type"
|
|
1461
1502
|
};
|
|
1462
|
-
function
|
|
1503
|
+
function $t(e, t) {
|
|
1463
1504
|
return e ? `✓ ${t}` : t;
|
|
1464
1505
|
}
|
|
1465
|
-
var
|
|
1506
|
+
var en = class {
|
|
1466
1507
|
modeling;
|
|
1467
1508
|
static $inject = ["popupMenu", "eventStormingModeling"];
|
|
1468
1509
|
constructor(e, t) {
|
|
@@ -1470,38 +1511,38 @@ var qt = class {
|
|
|
1470
1511
|
}
|
|
1471
1512
|
getPopupMenuEntries(e) {
|
|
1472
1513
|
let t = Array.isArray(e) ? e[0] : e;
|
|
1473
|
-
return
|
|
1514
|
+
return L(t) ? this.kindEntries(t) : {};
|
|
1474
1515
|
}
|
|
1475
1516
|
kindEntries(e) {
|
|
1476
1517
|
let t = {}, n = e.provisional === !0, r = c[this.modeling.getLevel()];
|
|
1477
|
-
for (let i of
|
|
1518
|
+
for (let i of F) {
|
|
1478
1519
|
if (!r.includes(i) && (n || i !== e.eventStormingType)) continue;
|
|
1479
1520
|
let a = w[i];
|
|
1480
1521
|
t[`kind-${i}`] = {
|
|
1481
|
-
label: n ? a.label :
|
|
1482
|
-
imageHtml:
|
|
1483
|
-
group:
|
|
1522
|
+
label: n ? a.label : $t(e.eventStormingType === i, a.label),
|
|
1523
|
+
imageHtml: Ut(a.fill, a.stroke),
|
|
1524
|
+
group: Qt,
|
|
1484
1525
|
action: () => this.modeling.setStickyKind(e, i)
|
|
1485
1526
|
};
|
|
1486
1527
|
}
|
|
1487
1528
|
return t;
|
|
1488
1529
|
}
|
|
1489
|
-
},
|
|
1530
|
+
}, tn = {
|
|
1490
1531
|
__init__: ["eventStormingElementSettings"],
|
|
1491
|
-
eventStormingElementSettings: ["type",
|
|
1492
|
-
},
|
|
1532
|
+
eventStormingElementSettings: ["type", en]
|
|
1533
|
+
}, nn = "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", rn = "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z", X = "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", Z = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z", an = "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", on = "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", sn = "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", cn = "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", ln = "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z", un = "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", dn = "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", fn = "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", pn = "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", mn = "M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 8 6.5 8 8 8.67 8 9.5 7.33 11 6.5 11zm3-4C8.67 7 8 6.33 8 5.5S8.67 4 9.5 4s1.5.67 1.5 1.5S10.33 7 9.5 7zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 4 14.5 4s1.5.67 1.5 1.5S15.33 7 14.5 7zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 8 17.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z", hn = "M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z", gn = "M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z", _n = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z", vn = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z", yn = "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", bn = "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";
|
|
1493
1534
|
function Q(e, t = 18) {
|
|
1494
1535
|
return `<svg viewBox="0 0 24 24" width="${t}" height="${t}" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
|
|
1495
1536
|
}
|
|
1496
1537
|
//#endregion
|
|
1497
1538
|
//#region src/context-pad/EventStormingContextPadProvider.ts
|
|
1498
|
-
var
|
|
1539
|
+
var xn = "Append sticky (auto-connect, choose the type after placing)";
|
|
1499
1540
|
function $(e, t, n = !1) {
|
|
1500
1541
|
return `<div class="entry event-storming-cp-entry"${n ? " draggable=\"true\"" : ""} title="${t}">${Q(e)}</div>`;
|
|
1501
1542
|
}
|
|
1502
1543
|
//#endregion
|
|
1503
1544
|
//#region src/context-pad/index.ts
|
|
1504
|
-
var
|
|
1545
|
+
var Sn = {
|
|
1505
1546
|
__init__: ["eventStormingContextPadProvider"],
|
|
1506
1547
|
eventStormingContextPadProvider: ["type", class {
|
|
1507
1548
|
modeling;
|
|
@@ -1527,7 +1568,7 @@ var hn = {
|
|
|
1527
1568
|
this.modeling = t, this.connect = n, this.create = r, this.popupMenu = i, this.eventStormingModeling = a, this.labelEditing = o, this.factory = s, this.colorPicker = c, e.registerProvider(this);
|
|
1528
1569
|
}
|
|
1529
1570
|
getContextPadEntries(e) {
|
|
1530
|
-
if (
|
|
1571
|
+
if (P(e)) {
|
|
1531
1572
|
let t = e;
|
|
1532
1573
|
return {
|
|
1533
1574
|
"edit-label": {
|
|
@@ -1544,17 +1585,17 @@ var hn = {
|
|
|
1544
1585
|
}
|
|
1545
1586
|
};
|
|
1546
1587
|
}
|
|
1547
|
-
if (!
|
|
1588
|
+
if (!N(e)) return {};
|
|
1548
1589
|
let t = e, n = {}, r = t.eventStormingType;
|
|
1549
|
-
if (
|
|
1590
|
+
if (I(r)) {
|
|
1550
1591
|
let e = (e) => {
|
|
1551
1592
|
let n = this.factory.createProvisional();
|
|
1552
1593
|
this.create.start(e, n, { source: t });
|
|
1553
1594
|
};
|
|
1554
1595
|
n.append = {
|
|
1555
1596
|
group: "append",
|
|
1556
|
-
title:
|
|
1557
|
-
html: $(
|
|
1597
|
+
title: xn,
|
|
1598
|
+
html: $(vn, xn, !0),
|
|
1558
1599
|
action: {
|
|
1559
1600
|
click: e,
|
|
1560
1601
|
dragstart: e
|
|
@@ -1566,7 +1607,7 @@ var hn = {
|
|
|
1566
1607
|
n.connect = {
|
|
1567
1608
|
group: "edit",
|
|
1568
1609
|
title: "Connect to existing sticky",
|
|
1569
|
-
html: $(
|
|
1610
|
+
html: $(rn, "Connect to existing sticky", !0),
|
|
1570
1611
|
action: {
|
|
1571
1612
|
click: r,
|
|
1572
1613
|
dragstart: r
|
|
@@ -1574,7 +1615,7 @@ var hn = {
|
|
|
1574
1615
|
}, n["change-kind"] = {
|
|
1575
1616
|
group: "sticky",
|
|
1576
1617
|
title: "Change type",
|
|
1577
|
-
html: $(
|
|
1618
|
+
html: $(gn, "Change type"),
|
|
1578
1619
|
action: { click: (e) => {
|
|
1579
1620
|
let n = e;
|
|
1580
1621
|
this.popupMenu.open(t, Y, {
|
|
@@ -1589,14 +1630,14 @@ var hn = {
|
|
|
1589
1630
|
n["stroke-style"] = {
|
|
1590
1631
|
group: "sticky",
|
|
1591
1632
|
title: r,
|
|
1592
|
-
html: $(
|
|
1633
|
+
html: $(hn, r),
|
|
1593
1634
|
action: { click: () => this.eventStormingModeling.setStrokeStyle(t, e) }
|
|
1594
1635
|
};
|
|
1595
1636
|
}
|
|
1596
1637
|
return r === "drawing" && (n.color = {
|
|
1597
1638
|
group: "sticky",
|
|
1598
1639
|
title: "Color",
|
|
1599
|
-
html: $(
|
|
1640
|
+
html: $(mn, "Color"),
|
|
1600
1641
|
action: { click: (e) => {
|
|
1601
1642
|
let n = e;
|
|
1602
1643
|
this.colorPicker.open(t, n.clientX, n.clientY);
|
|
@@ -1614,36 +1655,36 @@ var hn = {
|
|
|
1614
1655
|
}, n;
|
|
1615
1656
|
}
|
|
1616
1657
|
}]
|
|
1617
|
-
},
|
|
1658
|
+
}, Cn = "bullet", wn = [
|
|
1618
1659
|
"left",
|
|
1619
1660
|
"center",
|
|
1620
1661
|
"right"
|
|
1621
|
-
],
|
|
1662
|
+
], Tn = [
|
|
1622
1663
|
"top",
|
|
1623
1664
|
"middle",
|
|
1624
1665
|
"bottom"
|
|
1625
1666
|
];
|
|
1626
|
-
function
|
|
1667
|
+
function En(e, t) {
|
|
1627
1668
|
return e[(e.indexOf(t) + 1) % e.length];
|
|
1628
1669
|
}
|
|
1629
|
-
function
|
|
1670
|
+
function Dn(e, t) {
|
|
1630
1671
|
let n = e.ownerDocument;
|
|
1631
1672
|
e.textContent = "";
|
|
1632
1673
|
for (let r of C(t)) {
|
|
1633
1674
|
let t = n.createElement("div");
|
|
1634
|
-
r.bullet && (t.className =
|
|
1675
|
+
r.bullet && (t.className = Cn);
|
|
1635
1676
|
for (let e of r.runs) {
|
|
1636
1677
|
let r = n.createTextNode(e.text);
|
|
1637
|
-
e.italic && (r =
|
|
1678
|
+
e.italic && (r = On(n, "i", r)), e.bold && (r = On(n, "b", r)), t.appendChild(r);
|
|
1638
1679
|
}
|
|
1639
1680
|
r.runs.length === 0 && t.appendChild(n.createElement("br")), e.appendChild(t);
|
|
1640
1681
|
}
|
|
1641
1682
|
}
|
|
1642
|
-
function
|
|
1683
|
+
function On(e, t, n) {
|
|
1643
1684
|
let r = e.createElement(t);
|
|
1644
1685
|
return r.appendChild(n), r;
|
|
1645
1686
|
}
|
|
1646
|
-
function
|
|
1687
|
+
function kn(e) {
|
|
1647
1688
|
let t = [], n = null, r = (e) => (n = {
|
|
1648
1689
|
bullet: e,
|
|
1649
1690
|
runs: []
|
|
@@ -1664,11 +1705,11 @@ function Sn(e) {
|
|
|
1664
1705
|
s.nextSibling && r(!1);
|
|
1665
1706
|
return;
|
|
1666
1707
|
}
|
|
1667
|
-
if (
|
|
1708
|
+
if (An(s.tagName)) {
|
|
1668
1709
|
a(s);
|
|
1669
1710
|
return;
|
|
1670
1711
|
}
|
|
1671
|
-
let c =
|
|
1712
|
+
let c = jn(s, t, o);
|
|
1672
1713
|
for (let e of s.childNodes) i(e, c.bold, c.italic);
|
|
1673
1714
|
}, a = (e) => {
|
|
1674
1715
|
r(e.classList.contains("bullet") || e.tagName === "LI");
|
|
@@ -1676,12 +1717,12 @@ function Sn(e) {
|
|
|
1676
1717
|
n = null;
|
|
1677
1718
|
};
|
|
1678
1719
|
for (let t of e.childNodes) i(t, !1, !1);
|
|
1679
|
-
return
|
|
1720
|
+
return xe(t);
|
|
1680
1721
|
}
|
|
1681
|
-
function
|
|
1722
|
+
function An(e) {
|
|
1682
1723
|
return e === "DIV" || e === "P" || e === "LI";
|
|
1683
1724
|
}
|
|
1684
|
-
function
|
|
1725
|
+
function jn(e, t, n) {
|
|
1685
1726
|
let r = e.tagName;
|
|
1686
1727
|
(r === "B" || r === "STRONG") && (t = !0), (r === "I" || r === "EM") && (n = !0);
|
|
1687
1728
|
let i = e.style.fontWeight;
|
|
@@ -1692,13 +1733,13 @@ function wn(e, t, n) {
|
|
|
1692
1733
|
italic: n
|
|
1693
1734
|
};
|
|
1694
1735
|
}
|
|
1695
|
-
function
|
|
1736
|
+
function Mn(e) {
|
|
1696
1737
|
let t = e.ownerDocument, n = t.getSelection();
|
|
1697
1738
|
if (!n) return;
|
|
1698
1739
|
let r = t.createRange();
|
|
1699
1740
|
r.selectNodeContents(e), n.removeAllRanges(), n.addRange(r);
|
|
1700
1741
|
}
|
|
1701
|
-
function
|
|
1742
|
+
function Nn(e, t) {
|
|
1702
1743
|
let n = e.ownerDocument;
|
|
1703
1744
|
if (typeof n.execCommand == "function" && n.execCommand("insertText", !1, t)) return;
|
|
1704
1745
|
let r = n.getSelection();
|
|
@@ -1709,30 +1750,30 @@ function En(e, t) {
|
|
|
1709
1750
|
let a = n.createTextNode(t);
|
|
1710
1751
|
i.insertNode(a), i.setStartAfter(a), i.collapse(!0), r.removeAllRanges(), r.addRange(i);
|
|
1711
1752
|
}
|
|
1712
|
-
function
|
|
1753
|
+
function Pn(e) {
|
|
1713
1754
|
let t = e.ownerDocument.getSelection();
|
|
1714
1755
|
if (!t || t.rangeCount === 0) return [];
|
|
1715
1756
|
let n = t.getRangeAt(0);
|
|
1716
1757
|
return e.contains(n.commonAncestorContainer) ? Array.from(e.children).filter((e) => n.intersectsNode(e)) : [];
|
|
1717
1758
|
}
|
|
1718
|
-
function
|
|
1719
|
-
|
|
1720
|
-
let t =
|
|
1759
|
+
function Fn(e) {
|
|
1760
|
+
In(e);
|
|
1761
|
+
let t = Pn(e);
|
|
1721
1762
|
if (t.length === 0) return;
|
|
1722
|
-
let n = t.every((e) => e.classList.contains(
|
|
1723
|
-
for (let e of t) e.classList.toggle(
|
|
1763
|
+
let n = t.every((e) => e.classList.contains(Cn));
|
|
1764
|
+
for (let e of t) e.classList.toggle(Cn, !n);
|
|
1724
1765
|
}
|
|
1725
|
-
function
|
|
1766
|
+
function In(e) {
|
|
1726
1767
|
let t = e.ownerDocument, n = null;
|
|
1727
1768
|
for (let r of Array.from(e.childNodes)) {
|
|
1728
|
-
if (r.nodeType === Node.ELEMENT_NODE &&
|
|
1769
|
+
if (r.nodeType === Node.ELEMENT_NODE && An(r.tagName)) {
|
|
1729
1770
|
n = null;
|
|
1730
1771
|
continue;
|
|
1731
1772
|
}
|
|
1732
1773
|
n || (n = t.createElement("div"), e.insertBefore(n, r)), n.appendChild(r);
|
|
1733
1774
|
}
|
|
1734
1775
|
}
|
|
1735
|
-
var
|
|
1776
|
+
var Ln = {
|
|
1736
1777
|
horizontal: {
|
|
1737
1778
|
left: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z",
|
|
1738
1779
|
center: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z",
|
|
@@ -1744,7 +1785,7 @@ var An = {
|
|
|
1744
1785
|
bottom: "M16 13h-3V3h-2v10H8l4 4 4-4zM4 19v2h16v-2H4z"
|
|
1745
1786
|
}
|
|
1746
1787
|
};
|
|
1747
|
-
function
|
|
1788
|
+
function Rn(e, t) {
|
|
1748
1789
|
let n = e.createElement("div");
|
|
1749
1790
|
n.className = "event-storming-note-toolbar";
|
|
1750
1791
|
let r = (r, i, a) => {
|
|
@@ -1755,18 +1796,18 @@ function jn(e, t) {
|
|
|
1755
1796
|
let i = e.createElement("span");
|
|
1756
1797
|
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;
|
|
1757
1798
|
}
|
|
1758
|
-
function
|
|
1759
|
-
e.innerHTML = Q(
|
|
1799
|
+
function zn(e, t, n) {
|
|
1800
|
+
e.innerHTML = Q(Ln[t][n] ?? "", 16), e.title = t === "horizontal" ? `Horizontal alignment: ${n} (click to cycle)` : `Vertical alignment: ${n} (click to cycle)`;
|
|
1760
1801
|
}
|
|
1761
|
-
function
|
|
1802
|
+
function Bn(e, t) {
|
|
1762
1803
|
e.style.textAlign = t.horizontal, e.style.justifyContent = t.vertical === "top" ? "flex-start" : t.vertical === "middle" ? "center" : "flex-end";
|
|
1763
1804
|
}
|
|
1764
1805
|
//#endregion
|
|
1765
1806
|
//#region src/label-editing/EventStormingLabelEditing.ts
|
|
1766
|
-
function
|
|
1807
|
+
function Vn(e) {
|
|
1767
1808
|
return e.replace(/(?<!:)\/\//g, "∕∕").replace(/\/\*/g, "∕*").replace(/->/g, "→").replace(/;/g, ",").replace(/\[/g, "(").replace(/\]/g, ")").trim();
|
|
1768
1809
|
}
|
|
1769
|
-
var
|
|
1810
|
+
var Hn = class {
|
|
1770
1811
|
canvas;
|
|
1771
1812
|
modeling;
|
|
1772
1813
|
static $inject = [
|
|
@@ -1777,7 +1818,7 @@ var Fn = class {
|
|
|
1777
1818
|
active = null;
|
|
1778
1819
|
constructor(e, t, n) {
|
|
1779
1820
|
this.canvas = t, this.modeling = n, e.on("element.dblclick", (e) => {
|
|
1780
|
-
|
|
1821
|
+
N(e.element) ? this.activate(e.element) : P(e.element) && this.activateConnection(e.element);
|
|
1781
1822
|
}), e.on([
|
|
1782
1823
|
"element.mousedown",
|
|
1783
1824
|
"drag.init",
|
|
@@ -1796,7 +1837,7 @@ var Fn = class {
|
|
|
1796
1837
|
s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null);
|
|
1797
1838
|
}, l = () => {
|
|
1798
1839
|
if (s) return;
|
|
1799
|
-
let t =
|
|
1840
|
+
let t = Vn(o.value), n = t && t !== e.eventStormingLabel;
|
|
1800
1841
|
c(), n && this.modeling.updateLabel(e, t);
|
|
1801
1842
|
}, u = (e) => {
|
|
1802
1843
|
if (e.key === "Escape") {
|
|
@@ -1816,38 +1857,38 @@ var Fn = class {
|
|
|
1816
1857
|
}
|
|
1817
1858
|
activateNote(e) {
|
|
1818
1859
|
let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = (e.x + e.width / 2 - r.x) * n, a = (e.y + e.height / 2 - r.y) * n, o = document.createElement("div");
|
|
1819
|
-
o.className = "event-storming-label-input event-storming-note-editor", o.contentEditable = "true", o.style.position = "absolute", o.style.left = `${i}px`, o.style.top = `${a}px`, o.style.transform = "translate(-50%, -50%)", o.style.minWidth = `${e.width * n}px`, o.style.minHeight = `${e.height * n}px`,
|
|
1860
|
+
o.className = "event-storming-label-input event-storming-note-editor", o.contentEditable = "true", o.style.position = "absolute", o.style.left = `${i}px`, o.style.top = `${a}px`, o.style.transform = "translate(-50%, -50%)", o.style.minWidth = `${e.width * n}px`, o.style.minHeight = `${e.height * n}px`, Dn(o, e.eventStormingLabel ?? "");
|
|
1820
1861
|
let s = {
|
|
1821
1862
|
horizontal: e.alignHorizontal ?? "left",
|
|
1822
1863
|
vertical: e.alignVertical ?? "top"
|
|
1823
1864
|
};
|
|
1824
|
-
|
|
1825
|
-
let c =
|
|
1826
|
-
c.style.left = `${i}px`, c.style.top = `${(e.y - r.y) * n - 8}px`, c.style.transform = "translate(-50%, -100%)", t.appendChild(o), t.appendChild(c), o.focus(),
|
|
1865
|
+
Bn(o, s);
|
|
1866
|
+
let c = Rn(document, (e) => m(e));
|
|
1867
|
+
c.style.left = `${i}px`, c.style.top = `${(e.y - r.y) * n - 8}px`, c.style.transform = "translate(-50%, -100%)", t.appendChild(o), t.appendChild(c), o.focus(), Mn(o);
|
|
1827
1868
|
let l = (e) => c.querySelector(`[data-action="${e}"]`), u = (e, t) => {
|
|
1828
1869
|
let n = l(e);
|
|
1829
1870
|
n?.classList.toggle("active", t), n?.setAttribute("aria-pressed", String(t));
|
|
1830
1871
|
}, d = () => {
|
|
1831
|
-
u("note-bold",
|
|
1832
|
-
let e =
|
|
1872
|
+
u("note-bold", Wn("bold")), u("note-italic", Wn("italic"));
|
|
1873
|
+
let e = Pn(o);
|
|
1833
1874
|
u("note-bullet", e.length > 0 && e.every((e) => e.classList.contains("bullet")));
|
|
1834
1875
|
let t = l("note-align-horizontal");
|
|
1835
|
-
t &&
|
|
1876
|
+
t && zn(t, "horizontal", s.horizontal);
|
|
1836
1877
|
let n = l("note-align-vertical");
|
|
1837
|
-
n &&
|
|
1878
|
+
n && zn(n, "vertical", s.vertical);
|
|
1838
1879
|
}, f = (e) => {
|
|
1839
1880
|
typeof document.execCommand == "function" && document.execCommand(e, !1), d();
|
|
1840
1881
|
}, p = (e) => {
|
|
1841
|
-
e === "horizontal" ? s.horizontal =
|
|
1882
|
+
e === "horizontal" ? s.horizontal = En(wn, s.horizontal) : s.vertical = En(Tn, s.vertical), Bn(o, s), d();
|
|
1842
1883
|
}, m = (e) => {
|
|
1843
|
-
e === "note-bold" ? f("bold") : e === "note-italic" ? f("italic") : e === "note-bullet" ? (
|
|
1884
|
+
e === "note-bold" ? f("bold") : e === "note-italic" ? f("italic") : e === "note-bullet" ? (Fn(o), d()) : p(e === "note-align-horizontal" ? "horizontal" : "vertical");
|
|
1844
1885
|
}, h = () => d();
|
|
1845
1886
|
document.addEventListener("selectionchange", h);
|
|
1846
1887
|
let g = !1, _ = () => {
|
|
1847
1888
|
g || (g = !0, document.removeEventListener("selectionchange", h), o.removeEventListener("keydown", y), o.removeEventListener("blur", b), o.removeEventListener("paste", x), o.remove(), c.remove(), this.active = null);
|
|
1848
1889
|
}, v = () => {
|
|
1849
1890
|
if (g) return;
|
|
1850
|
-
let t =
|
|
1891
|
+
let t = Un(e, Vn(kn(o)), s);
|
|
1851
1892
|
_(), t && this.modeling.updateProperties(e, t);
|
|
1852
1893
|
}, y = (e) => {
|
|
1853
1894
|
if (e.key === "Escape") {
|
|
@@ -1866,7 +1907,7 @@ var Fn = class {
|
|
|
1866
1907
|
}, x = (e) => {
|
|
1867
1908
|
e.preventDefault();
|
|
1868
1909
|
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
1869
|
-
t &&
|
|
1910
|
+
t && Nn(o, t);
|
|
1870
1911
|
};
|
|
1871
1912
|
o.addEventListener("keydown", y), o.addEventListener("blur", b), o.addEventListener("paste", x), d(), this.active = {
|
|
1872
1913
|
field: o,
|
|
@@ -1884,7 +1925,7 @@ var Fn = class {
|
|
|
1884
1925
|
s || (s = !0, o.removeEventListener("keydown", u), o.removeEventListener("blur", d), o.remove(), this.active = null);
|
|
1885
1926
|
}, l = () => {
|
|
1886
1927
|
if (s) return;
|
|
1887
|
-
let t =
|
|
1928
|
+
let t = Vn(o.value), n = e.linkLabel ?? "";
|
|
1888
1929
|
c(), t !== n && this.modeling.updateProperties(e, { linkLabel: t || void 0 });
|
|
1889
1930
|
}, u = (e) => {
|
|
1890
1931
|
e.key === "Escape" ? (e.preventDefault(), c()) : e.key === "Enter" && (e.preventDefault(), l());
|
|
@@ -1899,17 +1940,17 @@ var Fn = class {
|
|
|
1899
1940
|
this.active?.cleanup();
|
|
1900
1941
|
}
|
|
1901
1942
|
};
|
|
1902
|
-
function
|
|
1943
|
+
function Un(e, t, n) {
|
|
1903
1944
|
let r = !!t && t !== e.eventStormingLabel, i = n.horizontal !== (e.alignHorizontal ?? "left") || n.vertical !== (e.alignVertical ?? "top");
|
|
1904
1945
|
if (!r && !i) return null;
|
|
1905
1946
|
let a = {};
|
|
1906
|
-
if (r && (a.eventStormingLabel = t, !
|
|
1947
|
+
if (r && (a.eventStormingLabel = t, !k(e.eventStormingLabel, e))) {
|
|
1907
1948
|
let { width: n, height: r } = O(t);
|
|
1908
1949
|
a.width = n, a.height = r, a.x = e.x + e.width / 2 - n / 2, a.y = e.y + e.height / 2 - r / 2;
|
|
1909
1950
|
}
|
|
1910
1951
|
return i && (a.alignHorizontal = n.horizontal === "left" ? void 0 : n.horizontal, a.alignVertical = n.vertical === "top" ? void 0 : n.vertical), a;
|
|
1911
1952
|
}
|
|
1912
|
-
function
|
|
1953
|
+
function Wn(e) {
|
|
1913
1954
|
if (typeof document.queryCommandState != "function") return !1;
|
|
1914
1955
|
try {
|
|
1915
1956
|
return document.queryCommandState(e);
|
|
@@ -1919,10 +1960,10 @@ function Ln(e) {
|
|
|
1919
1960
|
}
|
|
1920
1961
|
//#endregion
|
|
1921
1962
|
//#region src/label-editing/index.ts
|
|
1922
|
-
var
|
|
1963
|
+
var Gn = {
|
|
1923
1964
|
__init__: ["eventStormingLabelEditing"],
|
|
1924
|
-
eventStormingLabelEditing: ["type",
|
|
1925
|
-
},
|
|
1965
|
+
eventStormingLabelEditing: ["type", Hn]
|
|
1966
|
+
}, Kn = 2, qn = 10, Jn = {
|
|
1926
1967
|
arrowleft: {
|
|
1927
1968
|
x: -1,
|
|
1928
1969
|
y: 0
|
|
@@ -1939,7 +1980,7 @@ var Rn = {
|
|
|
1939
1980
|
x: 0,
|
|
1940
1981
|
y: 1
|
|
1941
1982
|
}
|
|
1942
|
-
},
|
|
1983
|
+
}, Yn = class {
|
|
1943
1984
|
static $inject = [
|
|
1944
1985
|
"canvas",
|
|
1945
1986
|
"commandStack",
|
|
@@ -1956,7 +1997,7 @@ var Rn = {
|
|
|
1956
1997
|
let u = e.getContainer();
|
|
1957
1998
|
u.hasAttribute("tabindex") || u.setAttribute("tabindex", "0");
|
|
1958
1999
|
let d = (e) => {
|
|
1959
|
-
if (
|
|
2000
|
+
if (Xn(e.target)) return;
|
|
1960
2001
|
let l = e.ctrlKey || e.metaKey, u = e.key.toLowerCase();
|
|
1961
2002
|
if (l && u === "z" && !e.shiftKey) e.preventDefault(), t.undo();
|
|
1962
2003
|
else if (l && u === "z" && e.shiftKey || l && u === "y") e.preventDefault(), t.redo();
|
|
@@ -1977,11 +2018,11 @@ var Rn = {
|
|
|
1977
2018
|
e.preventDefault();
|
|
1978
2019
|
let t = s.getLastMoveEvent();
|
|
1979
2020
|
c.activateSelection(t ?? e, !!t);
|
|
1980
|
-
} else if (u in
|
|
2021
|
+
} else if (u in Jn && !l) {
|
|
1981
2022
|
let t = n.get();
|
|
1982
2023
|
if (t.length) {
|
|
1983
2024
|
e.preventDefault();
|
|
1984
|
-
let n = e.shiftKey ?
|
|
2025
|
+
let n = e.shiftKey ? qn : Kn, i = Jn[u];
|
|
1985
2026
|
r.moveElements(t, {
|
|
1986
2027
|
x: i.x * n,
|
|
1987
2028
|
y: i.y * n
|
|
@@ -1992,17 +2033,17 @@ var Rn = {
|
|
|
1992
2033
|
document.addEventListener("keydown", d), l.on("diagram.destroy", () => document.removeEventListener("keydown", d));
|
|
1993
2034
|
}
|
|
1994
2035
|
};
|
|
1995
|
-
function
|
|
2036
|
+
function Xn(e) {
|
|
1996
2037
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1997
2038
|
let t = e.tagName;
|
|
1998
2039
|
return t === "INPUT" || t === "TEXTAREA" || e.isContentEditable;
|
|
1999
2040
|
}
|
|
2000
2041
|
//#endregion
|
|
2001
2042
|
//#region src/keyboard/index.ts
|
|
2002
|
-
var
|
|
2043
|
+
var Zn = {
|
|
2003
2044
|
__init__: ["eventStormingKeyboard"],
|
|
2004
|
-
eventStormingKeyboard: ["type",
|
|
2005
|
-
},
|
|
2045
|
+
eventStormingKeyboard: ["type", Yn]
|
|
2046
|
+
}, Qn = 500, $n = 6, er = class {
|
|
2006
2047
|
static $inject = ["injector", "eventBus"];
|
|
2007
2048
|
constructor(e, t) {
|
|
2008
2049
|
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;
|
|
@@ -2035,7 +2076,7 @@ var Wn = {
|
|
|
2035
2076
|
let n = o.getAbsoluteBBox(e), c = o.getContainer().getBoundingClientRect();
|
|
2036
2077
|
if (i.open(e, Y, {
|
|
2037
2078
|
x: c.left + n.x,
|
|
2038
|
-
y: c.top + n.y + n.height +
|
|
2079
|
+
y: c.top + n.y + n.height + $n
|
|
2039
2080
|
}), !i.isOpen()) {
|
|
2040
2081
|
a.removeElements([e]);
|
|
2041
2082
|
return;
|
|
@@ -2052,7 +2093,7 @@ var Wn = {
|
|
|
2052
2093
|
}, 0);
|
|
2053
2094
|
});
|
|
2054
2095
|
};
|
|
2055
|
-
t.on("create.end",
|
|
2096
|
+
t.on("create.end", Qn, (e) => {
|
|
2056
2097
|
let { context: t } = e;
|
|
2057
2098
|
if (!t.source || !t.canExecute || !t.shape) return;
|
|
2058
2099
|
let n = t.shape;
|
|
@@ -2071,14 +2112,14 @@ var Wn = {
|
|
|
2071
2112
|
r && setTimeout(() => r.activate(n), 0);
|
|
2072
2113
|
});
|
|
2073
2114
|
}
|
|
2074
|
-
},
|
|
2075
|
-
__depends__: [
|
|
2115
|
+
}, tr = {
|
|
2116
|
+
__depends__: [me],
|
|
2076
2117
|
__init__: ["eventStormingAppendBehavior"],
|
|
2077
|
-
eventStormingAppendBehavior: ["type",
|
|
2078
|
-
},
|
|
2118
|
+
eventStormingAppendBehavior: ["type", er]
|
|
2119
|
+
}, nr = F.map((e) => ({
|
|
2079
2120
|
value: w[e].fill,
|
|
2080
2121
|
title: w[e].label
|
|
2081
|
-
})),
|
|
2122
|
+
})), rr = class {
|
|
2082
2123
|
canvas;
|
|
2083
2124
|
modeling;
|
|
2084
2125
|
static $inject = [
|
|
@@ -2108,7 +2149,7 @@ var Wn = {
|
|
|
2108
2149
|
value: void 0,
|
|
2109
2150
|
title: "No color",
|
|
2110
2151
|
cls: "event-storming-cp-none"
|
|
2111
|
-
}, ...
|
|
2152
|
+
}, ...nr.map((e) => ({
|
|
2112
2153
|
value: e.value,
|
|
2113
2154
|
title: e.title,
|
|
2114
2155
|
cls: ""
|
|
@@ -2128,12 +2169,12 @@ var Wn = {
|
|
|
2128
2169
|
close() {
|
|
2129
2170
|
this.popover && (this.popover.remove(), this.popover = void 0, document.removeEventListener("click", this.onDocPointer, !0), document.removeEventListener("keydown", this.onKey, !0));
|
|
2130
2171
|
}
|
|
2131
|
-
},
|
|
2172
|
+
}, ir = {
|
|
2132
2173
|
__init__: ["eventStormingColorPicker"],
|
|
2133
|
-
eventStormingColorPicker: ["type",
|
|
2134
|
-
},
|
|
2174
|
+
eventStormingColorPicker: ["type", rr]
|
|
2175
|
+
}, ar = {
|
|
2135
2176
|
__init__: ["eventStormingOrderingProvider"],
|
|
2136
|
-
eventStormingOrderingProvider: ["type", class extends
|
|
2177
|
+
eventStormingOrderingProvider: ["type", class extends he {
|
|
2137
2178
|
static $inject = ["eventBus"];
|
|
2138
2179
|
constructor(e) {
|
|
2139
2180
|
super(e);
|
|
@@ -2141,8 +2182,8 @@ var Wn = {
|
|
|
2141
2182
|
getOrdering(e, t) {
|
|
2142
2183
|
for (; t.parent;) t = t.parent;
|
|
2143
2184
|
let n = t.children ?? [];
|
|
2144
|
-
if (
|
|
2145
|
-
let r = n.filter((t) => t !== e && (B(t) ||
|
|
2185
|
+
if (P(e)) {
|
|
2186
|
+
let r = n.filter((t) => t !== e && (B(t) || P(t))).length;
|
|
2146
2187
|
return {
|
|
2147
2188
|
parent: t,
|
|
2148
2189
|
index: r
|
|
@@ -2158,7 +2199,7 @@ var Wn = {
|
|
|
2158
2199
|
return { parent: t };
|
|
2159
2200
|
}
|
|
2160
2201
|
}]
|
|
2161
|
-
},
|
|
2202
|
+
}, or = 12, sr = class {
|
|
2162
2203
|
canvas;
|
|
2163
2204
|
eventBus;
|
|
2164
2205
|
modeling;
|
|
@@ -2235,12 +2276,12 @@ var Wn = {
|
|
|
2235
2276
|
if (e.button !== 0 || this.isChromeTarget(e)) return;
|
|
2236
2277
|
e.preventDefault(), e.stopPropagation();
|
|
2237
2278
|
let t = this.toCanvasPoint(e), n = this.points[0];
|
|
2238
|
-
if (n && this.points.length >= 3 &&
|
|
2279
|
+
if (n && this.points.length >= 3 && cr(t, n) <= or) {
|
|
2239
2280
|
this.finishClosed();
|
|
2240
2281
|
return;
|
|
2241
2282
|
}
|
|
2242
2283
|
let r = this.points[this.points.length - 1];
|
|
2243
|
-
if (r &&
|
|
2284
|
+
if (r && cr(t, r) <= or) {
|
|
2244
2285
|
this.points.length >= 2 && this.finish();
|
|
2245
2286
|
return;
|
|
2246
2287
|
}
|
|
@@ -2261,7 +2302,7 @@ var Wn = {
|
|
|
2261
2302
|
f(t, p(m("polyline"), {
|
|
2262
2303
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2263
2304
|
fill: "none",
|
|
2264
|
-
stroke:
|
|
2305
|
+
stroke: j,
|
|
2265
2306
|
"stroke-width": 2,
|
|
2266
2307
|
"stroke-linecap": "round",
|
|
2267
2308
|
"stroke-linejoin": "round",
|
|
@@ -2272,8 +2313,8 @@ var Wn = {
|
|
|
2272
2313
|
cx: r.x,
|
|
2273
2314
|
cy: r.y,
|
|
2274
2315
|
r: this.points.length >= 3 ? 5 : 3,
|
|
2275
|
-
fill:
|
|
2276
|
-
stroke:
|
|
2316
|
+
fill: A.paper,
|
|
2317
|
+
stroke: j,
|
|
2277
2318
|
"stroke-width": 1.5
|
|
2278
2319
|
})), this.points.length >= 2) {
|
|
2279
2320
|
let e = this.points[this.points.length - 1];
|
|
@@ -2281,8 +2322,8 @@ var Wn = {
|
|
|
2281
2322
|
cx: e.x,
|
|
2282
2323
|
cy: e.y,
|
|
2283
2324
|
r: 5,
|
|
2284
|
-
fill:
|
|
2285
|
-
stroke:
|
|
2325
|
+
fill: A.paper,
|
|
2326
|
+
stroke: j,
|
|
2286
2327
|
"stroke-width": 1.5
|
|
2287
2328
|
}));
|
|
2288
2329
|
}
|
|
@@ -2292,12 +2333,12 @@ var Wn = {
|
|
|
2292
2333
|
this.layer &&= (h(this.layer), null);
|
|
2293
2334
|
}
|
|
2294
2335
|
};
|
|
2295
|
-
function
|
|
2336
|
+
function cr(e, t) {
|
|
2296
2337
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
2297
2338
|
}
|
|
2298
2339
|
//#endregion
|
|
2299
2340
|
//#region src/draw-tool/EventStormingDrawingHandles.ts
|
|
2300
|
-
var
|
|
2341
|
+
var lr = class {
|
|
2301
2342
|
eventBus;
|
|
2302
2343
|
canvas;
|
|
2303
2344
|
modeling;
|
|
@@ -2335,8 +2376,8 @@ var nr = class {
|
|
|
2335
2376
|
cx: e.x,
|
|
2336
2377
|
cy: e.y,
|
|
2337
2378
|
r: 5,
|
|
2338
|
-
fill:
|
|
2339
|
-
stroke:
|
|
2379
|
+
fill: A.paper,
|
|
2380
|
+
stroke: A.ink,
|
|
2340
2381
|
"stroke-width": 1.5,
|
|
2341
2382
|
class: "event-storming-drawing-handle"
|
|
2342
2383
|
});
|
|
@@ -2371,7 +2412,7 @@ var nr = class {
|
|
|
2371
2412
|
let n = this.canvas.getLayer("event-storming-drawing-handles", 1100), r = p(m(t ? "polygon" : "polyline"), {
|
|
2372
2413
|
points: e.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2373
2414
|
fill: "none",
|
|
2374
|
-
stroke:
|
|
2415
|
+
stroke: A.ink,
|
|
2375
2416
|
"stroke-width": 1.5,
|
|
2376
2417
|
"stroke-dasharray": "5 4",
|
|
2377
2418
|
"pointer-events": "none"
|
|
@@ -2391,17 +2432,17 @@ var nr = class {
|
|
|
2391
2432
|
y: (e.clientY - t.top) / r + n.y
|
|
2392
2433
|
};
|
|
2393
2434
|
}
|
|
2394
|
-
},
|
|
2435
|
+
}, ur = class {
|
|
2395
2436
|
static $inject = ["eventBus", "interactionEvents"];
|
|
2396
2437
|
constructor(e, t) {
|
|
2397
2438
|
e.on("interactionEvents.createHit", (e) => {
|
|
2398
|
-
if (
|
|
2439
|
+
if (B(e.element) && e.gfx) return dr(e.element, e.gfx), !1;
|
|
2399
2440
|
}), e.on("interactionEvents.updateHit", (e) => {
|
|
2400
|
-
if (
|
|
2441
|
+
if (B(e.element) && e.gfx) return t.removeHits(e.gfx), dr(e.element, e.gfx), !1;
|
|
2401
2442
|
});
|
|
2402
2443
|
}
|
|
2403
2444
|
};
|
|
2404
|
-
function
|
|
2445
|
+
function dr(e, t) {
|
|
2405
2446
|
let n = e.drawingPoints ?? [], r = m(e.closed ? "polygon" : "polyline");
|
|
2406
2447
|
p(r, {
|
|
2407
2448
|
points: n.map((e) => `${e.x},${e.y}`).join(" "),
|
|
@@ -2414,28 +2455,28 @@ function ir(e, t) {
|
|
|
2414
2455
|
}
|
|
2415
2456
|
//#endregion
|
|
2416
2457
|
//#region src/draw-tool/index.ts
|
|
2417
|
-
var
|
|
2458
|
+
var fr = {
|
|
2418
2459
|
__init__: [
|
|
2419
2460
|
"eventStormingDrawTool",
|
|
2420
2461
|
"eventStormingDrawingHandles",
|
|
2421
2462
|
"eventStormingDrawingHitProvider"
|
|
2422
2463
|
],
|
|
2423
|
-
eventStormingDrawTool: ["type",
|
|
2424
|
-
eventStormingDrawingHandles: ["type",
|
|
2425
|
-
eventStormingDrawingHitProvider: ["type",
|
|
2426
|
-
},
|
|
2464
|
+
eventStormingDrawTool: ["type", sr],
|
|
2465
|
+
eventStormingDrawingHandles: ["type", lr],
|
|
2466
|
+
eventStormingDrawingHitProvider: ["type", ur]
|
|
2467
|
+
}, pr = class {
|
|
2427
2468
|
static $inject = ["eventBus"];
|
|
2428
2469
|
constructor(e) {
|
|
2429
2470
|
e.on("resize.start", 1500, (e) => {
|
|
2430
2471
|
let t = e.context;
|
|
2431
|
-
|
|
2472
|
+
je(t.shape) && (t.minDimensions = E);
|
|
2432
2473
|
});
|
|
2433
2474
|
}
|
|
2434
|
-
},
|
|
2435
|
-
__depends__: [
|
|
2475
|
+
}, mr = {
|
|
2476
|
+
__depends__: [ge],
|
|
2436
2477
|
__init__: ["eventStormingResizeBehavior"],
|
|
2437
|
-
eventStormingResizeBehavior: ["type",
|
|
2438
|
-
},
|
|
2478
|
+
eventStormingResizeBehavior: ["type", pr]
|
|
2479
|
+
}, hr = class extends yt {
|
|
2439
2480
|
_getModules() {
|
|
2440
2481
|
return [
|
|
2441
2482
|
...super._getModules(),
|
|
@@ -2448,21 +2489,21 @@ var ar = {
|
|
|
2448
2489
|
re,
|
|
2449
2490
|
ae,
|
|
2450
2491
|
oe,
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
Lt,
|
|
2492
|
+
Pt,
|
|
2493
|
+
xt,
|
|
2454
2494
|
zt,
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
Jt,
|
|
2460
|
-
Jn,
|
|
2495
|
+
Vt,
|
|
2496
|
+
Zt,
|
|
2497
|
+
Sn,
|
|
2498
|
+
Gn,
|
|
2461
2499
|
Zn,
|
|
2462
|
-
|
|
2463
|
-
|
|
2500
|
+
tn,
|
|
2501
|
+
tr,
|
|
2502
|
+
ir,
|
|
2503
|
+
Ft,
|
|
2464
2504
|
ar,
|
|
2465
|
-
|
|
2505
|
+
fr,
|
|
2506
|
+
mr
|
|
2466
2507
|
];
|
|
2467
2508
|
}
|
|
2468
2509
|
undo() {
|
|
@@ -2479,6 +2520,6 @@ var ar = {
|
|
|
2479
2520
|
}
|
|
2480
2521
|
};
|
|
2481
2522
|
//#endregion
|
|
2482
|
-
export {
|
|
2523
|
+
export { Le as BoardBounds, A as COLORS, er as EventStormingAppendBehavior, bt as EventStormingAttachBehavior, ye as EventStormingBaseViewer, rr as EventStormingColorPicker, Ne as EventStormingElementFactory, en as EventStormingElementSettingsProvider, ht as EventStormingExporter, mt as EventStormingImporter, Hn as EventStormingLabelEditing, Et as EventStormingModeling, $e as EventStormingRenderer, pr as EventStormingResizeBehavior, Rt as EventStormingRules, Be as EventStormingViewOptions, vn as ICON_ADD, cn as ICON_CODE, sn as ICON_DATA_OBJECT, Z as ICON_DELETE, ln as ICON_DOWNLOAD, X as ICON_EDIT, bn as ICON_EYE, yn as ICON_FIT, dn as ICON_FOLDER_OPEN, fn as ICON_IMAGE, _n as ICON_MENU, pn as ICON_NEW, nn as ICON_PERSON, on as ICON_REDO, un as ICON_SHARE, an as ICON_UNDO, S as MIRAGON, hr as Modeler, T as NOTE_STYLE, yt as NavigatedViewer, Y as POPUP_PROVIDER_ID, De as ROOT_ID, F as STICKY_KINDS, w as STICKY_STYLES, ze as VIEW_OPTIONS_CHANGED_EVENT, vt as Viewer, Re as boardBoundsModule, Vt as elementSnappingModule, tr as eventStormingAppendModule, xt as eventStormingAttachModule, ir as eventStormingColorPickerModule, Sn as eventStormingContextPadModule, ft as eventStormingDrawModule, Zn as eventStormingKeyboardModule, Fe as eventStormingModelModule, Pt as eventStormingModelingModule, Zt as eventStormingPaletteModule, tn as eventStormingPopupModule, mr as eventStormingResizeModule, zt as eventStormingRulesModule, V as eventStormingViewOptionsModule, Q as iconMarkup, _t as ioModule, ke as isAttachableKind, Ae as isAttachableSticky, P as isEventStormingConnection, N as isEventStormingShape, R as isHostKind, z as isHostSticky, L as isSticky, I as isStickyKind, Gn as labelEditingModule, C as parseNoteMarkdown, Se as plainNoteText, _e as saveSVG, xe as serializeNoteMarkdown };
|
|
2483
2524
|
|
|
2484
2525
|
//# sourceMappingURL=index.js.map
|