@miragon/team-topologies-renderer 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/copy-paste/TtCopyPaste.d.ts +17 -0
- package/dist/copy-paste/TtCopyPaste.d.ts.map +1 -0
- package/dist/copy-paste/TtCopyPasteProps.d.ts +6 -0
- package/dist/copy-paste/TtCopyPasteProps.d.ts.map +1 -0
- package/dist/copy-paste/index.d.ts +9 -0
- package/dist/copy-paste/index.d.ts.map +1 -0
- package/dist/draw/styles.d.ts +15 -8
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/index.js +186 -100
- package/dist/index.js.map +1 -1
- package/dist/keyboard/TtKeyboard.d.ts +2 -1
- package/dist/keyboard/TtKeyboard.d.ts.map +1 -1
- package/dist/rules/TtRules.d.ts.map +1 -1
- package/dist/team-topologies.css +1 -1
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/palette.d.ts +47 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -15,6 +15,8 @@ import ae from "diagram-js/lib/command/CommandInterceptor";
|
|
|
15
15
|
import oe from "diagram-js/lib/features/palette";
|
|
16
16
|
import se from "diagram-js/lib/features/create";
|
|
17
17
|
import ce from "diagram-js/lib/features/context-pad";
|
|
18
|
+
import le from "diagram-js/lib/features/copy-paste";
|
|
19
|
+
import ue from "diagram-js/lib/features/copy-paste/CopyPaste.js";
|
|
18
20
|
//#region src/model/di-types.ts
|
|
19
21
|
function _(e) {
|
|
20
22
|
return typeof e == "object" && e ? e.ttKind : void 0;
|
|
@@ -44,7 +46,7 @@ function C(e, t) {
|
|
|
44
46
|
r = Math.min(r, t.x), i = Math.min(i, t.y), a = Math.max(a, t.x + t.width), o = Math.max(o, t.y + t.height);
|
|
45
47
|
}
|
|
46
48
|
Number.isFinite(r) || (r = 0, i = 0, a = 100, o = 100);
|
|
47
|
-
let s = r - S, c = i - S, l = a - r +
|
|
49
|
+
let s = r - S, c = i - S, l = a - r + 80, u = o - i + 80, d = n.cloneNode(!0);
|
|
48
50
|
d.setAttribute("xmlns", "http://www.w3.org/2000/svg"), d.setAttribute("viewBox", `${s} ${c} ${l} ${u}`), d.setAttribute("width", String(Math.round(l))), d.setAttribute("height", String(Math.round(u)));
|
|
49
51
|
let f = d.querySelector(".viewport");
|
|
50
52
|
return f && f.removeAttribute("transform"), { svg: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + new XMLSerializer().serializeToString(d) };
|
|
@@ -124,7 +126,7 @@ var E = class {
|
|
|
124
126
|
let n = this.get("canvas"), r = this.get("elementRegistry"), i = Infinity, a = Infinity, o = -Infinity, s = -Infinity;
|
|
125
127
|
for (let e of r.getAll()) {
|
|
126
128
|
let t = e;
|
|
127
|
-
typeof t.x
|
|
129
|
+
typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number" && (i = Math.min(i, t.x), a = Math.min(a, t.y), o = Math.max(o, t.x + t.width), s = Math.max(s, t.y + t.height));
|
|
128
130
|
}
|
|
129
131
|
if (!Number.isFinite(i)) return;
|
|
130
132
|
let c = this._container.getBoundingClientRect(), l = c.width, u = c.height, d = Math.max(o - i, 1), f = Math.max(s - a, 1);
|
|
@@ -231,14 +233,37 @@ var E = class {
|
|
|
231
233
|
ttLabel: i.label
|
|
232
234
|
});
|
|
233
235
|
}
|
|
234
|
-
}, O = { ttElementFactory: ["type", D] },
|
|
235
|
-
|
|
236
|
+
}, O = { ttElementFactory: ["type", D] }, k = {
|
|
237
|
+
blau: "#335DE5",
|
|
238
|
+
blauLink: "#2B50D4",
|
|
239
|
+
blauHell: "#6B8AFF",
|
|
240
|
+
gruen: "#00E676",
|
|
241
|
+
grau: "#F9F7F7",
|
|
242
|
+
schwarz: "#1D1D1D",
|
|
243
|
+
weiss: "#FFFFFF",
|
|
244
|
+
success: "#0B7A55",
|
|
245
|
+
warning: "#92610A",
|
|
246
|
+
danger: "#C92A2A",
|
|
247
|
+
info: "#2B50D4",
|
|
248
|
+
gradientBrand: "linear-gradient(120deg, #335DE5 30%, #00E676)"
|
|
249
|
+
};
|
|
250
|
+
k.blau, k.gruen, k.grau, k.schwarz, k.weiss, k.blauLink, k.blauHell, k.success, k.warning, k.danger, k.info, k.gradientBrand;
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/draw/styles.ts
|
|
253
|
+
var de = 1500;
|
|
254
|
+
k.blau;
|
|
255
|
+
var fe = k.schwarz, pe = "#5B5B5B", A = {
|
|
256
|
+
family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
|
|
236
257
|
label: 13.5,
|
|
237
258
|
small: 11
|
|
238
|
-
}
|
|
259
|
+
};
|
|
260
|
+
k.weiss;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/draw/TeamTopologiesRenderer.ts
|
|
263
|
+
var j = class extends l {
|
|
239
264
|
static $inject = ["eventBus"];
|
|
240
265
|
constructor(e) {
|
|
241
|
-
super(e,
|
|
266
|
+
super(e, de);
|
|
242
267
|
}
|
|
243
268
|
canRender(e) {
|
|
244
269
|
return v(e);
|
|
@@ -273,7 +298,7 @@ var E = class {
|
|
|
273
298
|
if (e === "octagon") {
|
|
274
299
|
let e = Math.min(o, s) * .29;
|
|
275
300
|
return d(f("polygon"), {
|
|
276
|
-
points:
|
|
301
|
+
points: me(a, o, s, e),
|
|
277
302
|
...i
|
|
278
303
|
});
|
|
279
304
|
}
|
|
@@ -318,7 +343,7 @@ var E = class {
|
|
|
318
343
|
});
|
|
319
344
|
}
|
|
320
345
|
return u(e, c), t.ttLabel && this.appendLabel(e, t.ttLabel, r, i, {
|
|
321
|
-
"font-size":
|
|
346
|
+
"font-size": A.small,
|
|
322
347
|
"font-weight": "600"
|
|
323
348
|
}), c;
|
|
324
349
|
}
|
|
@@ -340,21 +365,21 @@ var E = class {
|
|
|
340
365
|
"stroke-linejoin": "round"
|
|
341
366
|
});
|
|
342
367
|
return u(e, g), t.ttLabel && this.appendLabel(e, t.ttLabel, n - c, r, {
|
|
343
|
-
"font-size":
|
|
368
|
+
"font-size": A.small,
|
|
344
369
|
"font-weight": "650",
|
|
345
370
|
"letter-spacing": "0.06em",
|
|
346
|
-
fill:
|
|
371
|
+
fill: pe
|
|
347
372
|
}), g;
|
|
348
373
|
}
|
|
349
374
|
appendLabel(e, t, n, r, i) {
|
|
350
|
-
let a = typeof i["font-size"] == "number" ? i["font-size"] :
|
|
375
|
+
let a = typeof i["font-size"] == "number" ? i["font-size"] : A.label, o = he(t, n - 20, a), s = a * 1.2, c = r / 2 - (o.length - 1) * s / 2;
|
|
351
376
|
o.forEach((t, r) => {
|
|
352
377
|
let o = d(f("text"), {
|
|
353
378
|
x: n / 2,
|
|
354
379
|
y: c + r * s,
|
|
355
|
-
"font-family":
|
|
380
|
+
"font-family": A.family,
|
|
356
381
|
"font-size": a,
|
|
357
|
-
fill:
|
|
382
|
+
fill: fe,
|
|
358
383
|
"text-anchor": "middle",
|
|
359
384
|
"dominant-baseline": "central",
|
|
360
385
|
...i
|
|
@@ -363,7 +388,7 @@ var E = class {
|
|
|
363
388
|
});
|
|
364
389
|
}
|
|
365
390
|
};
|
|
366
|
-
function
|
|
391
|
+
function me(e, t, n, r) {
|
|
367
392
|
return [
|
|
368
393
|
[e + r, e],
|
|
369
394
|
[e + t - r, e],
|
|
@@ -375,7 +400,7 @@ function fe(e, t, n, r) {
|
|
|
375
400
|
[e, e + r]
|
|
376
401
|
].map((e) => e.join(",")).join(" ");
|
|
377
402
|
}
|
|
378
|
-
function
|
|
403
|
+
function he(e, t, n) {
|
|
379
404
|
let r = Math.max(4, Math.floor(t / (n * .58))), i = e.split(/\s+/).filter(Boolean);
|
|
380
405
|
if (i.length === 0) return [];
|
|
381
406
|
let a = [], o = "";
|
|
@@ -387,10 +412,10 @@ function pe(e, t, n) {
|
|
|
387
412
|
}
|
|
388
413
|
//#endregion
|
|
389
414
|
//#region src/draw/index.ts
|
|
390
|
-
var
|
|
415
|
+
var M = {
|
|
391
416
|
__init__: ["ttRenderer"],
|
|
392
|
-
ttRenderer: ["type",
|
|
393
|
-
},
|
|
417
|
+
ttRenderer: ["type", j]
|
|
418
|
+
}, N = class {
|
|
394
419
|
canvas;
|
|
395
420
|
elementFactory;
|
|
396
421
|
factory;
|
|
@@ -427,7 +452,7 @@ var j = {
|
|
|
427
452
|
this.canvas.removeShape(e.id);
|
|
428
453
|
} catch {}
|
|
429
454
|
}
|
|
430
|
-
},
|
|
455
|
+
}, P = class {
|
|
431
456
|
elementRegistry;
|
|
432
457
|
canvas;
|
|
433
458
|
static $inject = ["elementRegistry", "canvas"];
|
|
@@ -483,18 +508,18 @@ var j = {
|
|
|
483
508
|
flows: i
|
|
484
509
|
};
|
|
485
510
|
}
|
|
486
|
-
},
|
|
487
|
-
ttImporter: ["type",
|
|
488
|
-
ttExporter: ["type",
|
|
489
|
-
},
|
|
511
|
+
}, F = {
|
|
512
|
+
ttImporter: ["type", N],
|
|
513
|
+
ttExporter: ["type", P]
|
|
514
|
+
}, I = class extends E {
|
|
490
515
|
_getModules() {
|
|
491
516
|
return [
|
|
492
517
|
O,
|
|
493
|
-
|
|
494
|
-
|
|
518
|
+
M,
|
|
519
|
+
F
|
|
495
520
|
];
|
|
496
521
|
}
|
|
497
|
-
},
|
|
522
|
+
}, L = class extends I {
|
|
498
523
|
_getModules() {
|
|
499
524
|
return [
|
|
500
525
|
...super._getModules(),
|
|
@@ -506,28 +531,28 @@ var j = {
|
|
|
506
531
|
};
|
|
507
532
|
//#endregion
|
|
508
533
|
//#region src/modeling/cmd/UpdatePropertiesHandler.ts
|
|
509
|
-
function
|
|
534
|
+
function R(e, t, n) {
|
|
510
535
|
n === void 0 ? delete e[t] : e[t] = n;
|
|
511
536
|
}
|
|
512
|
-
var
|
|
537
|
+
var ge = class {
|
|
513
538
|
execute(e) {
|
|
514
539
|
let { element: t, properties: n } = e, r = t, i = {};
|
|
515
|
-
for (let e of Object.keys(n)) i[e] = r[e],
|
|
540
|
+
for (let e of Object.keys(n)) i[e] = r[e], R(r, e, n[e]);
|
|
516
541
|
return e.oldProperties = i, [t];
|
|
517
542
|
}
|
|
518
543
|
revert(e) {
|
|
519
544
|
let { element: t, oldProperties: n } = e, r = t;
|
|
520
|
-
if (n) for (let e of Object.keys(n))
|
|
545
|
+
if (n) for (let e of Object.keys(n)) R(r, e, n[e]);
|
|
521
546
|
return [t];
|
|
522
547
|
}
|
|
523
|
-
},
|
|
548
|
+
}, z = "element.updateProperties", B = class {
|
|
524
549
|
commandStack;
|
|
525
550
|
static $inject = ["commandStack"];
|
|
526
551
|
constructor(e) {
|
|
527
|
-
this.commandStack = e, e.registerHandler(
|
|
552
|
+
this.commandStack = e, e.registerHandler(z, ge);
|
|
528
553
|
}
|
|
529
554
|
updateProperties(e, t) {
|
|
530
|
-
this.commandStack.execute(
|
|
555
|
+
this.commandStack.execute(z, {
|
|
531
556
|
element: e,
|
|
532
557
|
properties: t
|
|
533
558
|
});
|
|
@@ -550,64 +575,64 @@ var me = class {
|
|
|
550
575
|
setDescription(e, t) {
|
|
551
576
|
this.updateProperties(e, { description: t });
|
|
552
577
|
}
|
|
553
|
-
},
|
|
578
|
+
}, V = {
|
|
554
579
|
__init__: ["ttModeling"],
|
|
555
|
-
ttModeling: ["type",
|
|
556
|
-
},
|
|
580
|
+
ttModeling: ["type", B]
|
|
581
|
+
}, H = class extends ie {
|
|
557
582
|
static $inject = ["eventBus"];
|
|
558
583
|
constructor(e) {
|
|
559
584
|
super(e);
|
|
560
585
|
}
|
|
561
586
|
init() {
|
|
562
|
-
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !0);
|
|
587
|
+
this.addRule(["shape.move", "elements.move"], (e) => e.target && e.target.parent ? null : !0), this.addRule("shape.create", () => !0), this.addRule("shape.resize", () => !0), this.addRule("element.copy", () => !0);
|
|
563
588
|
}
|
|
564
|
-
},
|
|
589
|
+
}, U = {
|
|
565
590
|
__depends__: [re],
|
|
566
591
|
__init__: ["ttRules"],
|
|
567
|
-
ttRules: ["type",
|
|
568
|
-
},
|
|
592
|
+
ttRules: ["type", H]
|
|
593
|
+
}, W = class extends ae {
|
|
569
594
|
static $inject = ["eventBus", "canvas"];
|
|
570
595
|
constructor(e, t) {
|
|
571
596
|
super(e), this.preExecute(["shape.create", "elements.create"], (e) => {
|
|
572
597
|
e.parent = t.getRootElement();
|
|
573
598
|
}, !0);
|
|
574
599
|
}
|
|
575
|
-
},
|
|
600
|
+
}, _e = {
|
|
576
601
|
__init__: ["ttFlatModelBehavior"],
|
|
577
|
-
ttFlatModelBehavior: ["type",
|
|
602
|
+
ttFlatModelBehavior: ["type", W]
|
|
578
603
|
};
|
|
579
604
|
//#endregion
|
|
580
605
|
//#region src/draw/palette-icons.ts
|
|
581
|
-
function
|
|
606
|
+
function G(e) {
|
|
582
607
|
return `<svg class="tt-palette-svg" width="24" height="24" viewBox="0 0 26 26" aria-hidden="true">${e}</svg>`;
|
|
583
608
|
}
|
|
584
|
-
function
|
|
609
|
+
function K(e) {
|
|
585
610
|
let t = o[e], n = s(t.strokeStyle, 1.5), r = `fill="${t.fill}" stroke="${t.stroke}" stroke-width="1.5"` + (n ? ` stroke-dasharray="${n}"` : "");
|
|
586
611
|
switch (t.shape) {
|
|
587
|
-
case "octagon": return
|
|
588
|
-
case "rounded-rect-vertical": return
|
|
589
|
-
case "rect": return
|
|
590
|
-
default: return
|
|
612
|
+
case "octagon": return G(`<polygon points="8,3 18,3 23,8 23,18 18,23 8,23 3,18 3,8" ${r}/>`);
|
|
613
|
+
case "rounded-rect-vertical": return G(`<rect x="8" y="3" width="10" height="20" rx="4" ${r}/>`);
|
|
614
|
+
case "rect": return G(`<rect x="3" y="7" width="20" height="12" rx="1.5" ${r}/>`);
|
|
615
|
+
default: return G(`<rect x="3" y="8" width="20" height="10" rx="5" ${r}/>`);
|
|
591
616
|
}
|
|
592
617
|
}
|
|
593
|
-
function
|
|
594
|
-
return
|
|
618
|
+
function q() {
|
|
619
|
+
return G("<g fill=\"none\" stroke=\"#6b6459\" stroke-width=\"1.5\" stroke-linejoin=\"round\" stroke-dasharray=\"3 2\"><polygon points=\"3,9 16,9 16,5 23,13 16,21 16,17 3,17\"/></g>");
|
|
595
620
|
}
|
|
596
|
-
function
|
|
621
|
+
function J(e) {
|
|
597
622
|
let t = a[e], n = s(t.strokeStyle, 1.5), r = `fill="${t.fill}" fill-opacity="${t.opacity}" stroke="${t.stroke}" stroke-width="1.5"` + (n ? ` stroke-dasharray="${n}"` : "");
|
|
598
623
|
switch (t.shape) {
|
|
599
|
-
case "circle": return
|
|
600
|
-
case "triangle": return
|
|
601
|
-
default: return
|
|
624
|
+
case "circle": return G(`<circle cx="13" cy="13" r="9" ${r}/>`);
|
|
625
|
+
case "triangle": return G(`<polygon points="5,6 22,13 5,20" ${r}/>`);
|
|
626
|
+
default: return G(`<polygon points="9,6 23,6 17,20 3,20" ${r}/>`);
|
|
602
627
|
}
|
|
603
628
|
}
|
|
604
629
|
//#endregion
|
|
605
630
|
//#region src/palette/TtPaletteProvider.ts
|
|
606
|
-
var
|
|
607
|
-
function
|
|
631
|
+
var ve = "tt-1-teams", ye = "tt-2-modes", be = "tt-3-flow";
|
|
632
|
+
function Y(e, t) {
|
|
608
633
|
return `<div class="entry tt-palette-entry" draggable="true" title="${t}">${e}</div>`;
|
|
609
634
|
}
|
|
610
|
-
var
|
|
635
|
+
var X = class {
|
|
611
636
|
create;
|
|
612
637
|
factory;
|
|
613
638
|
static $inject = [
|
|
@@ -623,9 +648,9 @@ var Y = class {
|
|
|
623
648
|
for (let t of n) {
|
|
624
649
|
let n = (e) => this.create.start(e, this.factory.createNewTeam(t.type, t.label));
|
|
625
650
|
e[`team.${t.type}`] = {
|
|
626
|
-
group:
|
|
651
|
+
group: ve,
|
|
627
652
|
title: `${t.label} team — ${t.description}`,
|
|
628
|
-
html:
|
|
653
|
+
html: Y(K(t.type), `${t.label} team — ${t.description}`),
|
|
629
654
|
action: {
|
|
630
655
|
dragstart: n,
|
|
631
656
|
click: n
|
|
@@ -635,9 +660,9 @@ var Y = class {
|
|
|
635
660
|
for (let n of t) {
|
|
636
661
|
let t = (e) => this.create.start(e, this.factory.createNewInteraction(n.mode));
|
|
637
662
|
e[`mode.${n.mode}`] = {
|
|
638
|
-
group:
|
|
663
|
+
group: ye,
|
|
639
664
|
title: `${n.label} — ${n.description} (place over the teams it relates to)`,
|
|
640
|
-
html: J(
|
|
665
|
+
html: Y(J(n.mode), `${n.label} — ${n.description}`),
|
|
641
666
|
action: {
|
|
642
667
|
dragstart: t,
|
|
643
668
|
click: t
|
|
@@ -646,29 +671,29 @@ var Y = class {
|
|
|
646
671
|
}
|
|
647
672
|
let r = (e) => this.create.start(e, this.factory.createNewFlow());
|
|
648
673
|
return e.flow = {
|
|
649
|
-
group:
|
|
674
|
+
group: be,
|
|
650
675
|
title: `${i.label} — the implied left-to-right flow`,
|
|
651
|
-
html:
|
|
676
|
+
html: Y(q(), i.label),
|
|
652
677
|
action: {
|
|
653
678
|
dragstart: r,
|
|
654
679
|
click: r
|
|
655
680
|
}
|
|
656
681
|
}, e;
|
|
657
682
|
}
|
|
658
|
-
},
|
|
683
|
+
}, Z = {
|
|
659
684
|
__depends__: [oe, se],
|
|
660
685
|
__init__: ["ttPaletteProvider"],
|
|
661
|
-
ttPaletteProvider: ["type",
|
|
662
|
-
},
|
|
663
|
-
function
|
|
686
|
+
ttPaletteProvider: ["type", X]
|
|
687
|
+
}, xe = "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.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z", Se = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z";
|
|
688
|
+
function Ce(e, t = 18) {
|
|
664
689
|
return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="${e}"/></svg>`;
|
|
665
690
|
}
|
|
666
691
|
//#endregion
|
|
667
692
|
//#region src/context-pad/TtContextPadProvider.ts
|
|
668
|
-
function
|
|
669
|
-
return `<div class="entry tt-cp-entry" title="${t}">${
|
|
693
|
+
function Q(e, t) {
|
|
694
|
+
return `<div class="entry tt-cp-entry" title="${t}">${Ce(e)}</div>`;
|
|
670
695
|
}
|
|
671
|
-
var
|
|
696
|
+
var we = class {
|
|
672
697
|
modeling;
|
|
673
698
|
labelEditing;
|
|
674
699
|
static $inject = [
|
|
@@ -684,22 +709,22 @@ var Q = class {
|
|
|
684
709
|
"edit-label": {
|
|
685
710
|
group: "edit",
|
|
686
711
|
title: "Rename",
|
|
687
|
-
html:
|
|
712
|
+
html: Q(xe, "Rename"),
|
|
688
713
|
action: { click: () => this.labelEditing.activate(e) }
|
|
689
714
|
},
|
|
690
715
|
delete: {
|
|
691
716
|
group: "edit",
|
|
692
717
|
title: "Delete",
|
|
693
|
-
html:
|
|
718
|
+
html: Q(Se, "Delete"),
|
|
694
719
|
action: { click: () => this.modeling.removeElements([e]) }
|
|
695
720
|
}
|
|
696
721
|
} : {};
|
|
697
722
|
}
|
|
698
|
-
},
|
|
723
|
+
}, Te = {
|
|
699
724
|
__depends__: [ce],
|
|
700
725
|
__init__: ["ttContextPadProvider"],
|
|
701
|
-
ttContextPadProvider: ["type",
|
|
702
|
-
},
|
|
726
|
+
ttContextPadProvider: ["type", we]
|
|
727
|
+
}, Ee = class {
|
|
703
728
|
canvas;
|
|
704
729
|
modeling;
|
|
705
730
|
static $inject = [
|
|
@@ -719,7 +744,7 @@ var Q = class {
|
|
|
719
744
|
}
|
|
720
745
|
activate(e) {
|
|
721
746
|
this.active?.commit();
|
|
722
|
-
let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = e.x + e.width / 2, a = e.y + e.height / 2, o = (i - r.x) * n -
|
|
747
|
+
let t = this.canvas.getContainer(), n = this.canvas.zoom(), r = this.canvas.viewbox(), i = e.x + e.width / 2, a = e.y + e.height / 2, o = (i - r.x) * n - 85, s = (a - r.y) * n - 14, c = document.createElement("input");
|
|
723
748
|
c.type = "text", c.className = "tt-label-input", c.value = e.ttLabel ?? "", c.style.position = "absolute", c.style.left = `${o}px`, c.style.top = `${s}px`, c.style.width = "170px", t.appendChild(c), c.focus(), c.select();
|
|
724
749
|
let l = !1, u = () => {
|
|
725
750
|
l || (l = !0, c.removeEventListener("keydown", f), c.removeEventListener("blur", p), c.remove(), this.active = null);
|
|
@@ -738,45 +763,105 @@ var Q = class {
|
|
|
738
763
|
cancel() {
|
|
739
764
|
this.active?.cleanup();
|
|
740
765
|
}
|
|
741
|
-
},
|
|
766
|
+
}, De = {
|
|
742
767
|
__init__: ["ttLabelEditing"],
|
|
743
|
-
ttLabelEditing: ["type",
|
|
768
|
+
ttLabelEditing: ["type", Ee]
|
|
744
769
|
};
|
|
745
770
|
//#endregion
|
|
746
771
|
//#region src/keyboard/TtKeyboard.ts
|
|
747
|
-
function
|
|
772
|
+
function Oe(e) {
|
|
748
773
|
let t = e;
|
|
749
774
|
return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
|
|
750
775
|
}
|
|
751
|
-
var
|
|
776
|
+
var ke = class {
|
|
752
777
|
static $inject = [
|
|
753
778
|
"canvas",
|
|
754
779
|
"commandStack",
|
|
755
780
|
"selection",
|
|
756
|
-
"modeling"
|
|
781
|
+
"modeling",
|
|
782
|
+
"copyPaste"
|
|
757
783
|
];
|
|
758
|
-
constructor(e, t, n, r) {
|
|
784
|
+
constructor(e, t, n, r, i) {
|
|
759
785
|
(e.getContainer().ownerDocument ?? document).addEventListener("keydown", (e) => {
|
|
760
|
-
if (
|
|
761
|
-
let
|
|
762
|
-
if (
|
|
763
|
-
else if (
|
|
764
|
-
else if (
|
|
786
|
+
if (Oe(e.target)) return;
|
|
787
|
+
let a = e.ctrlKey || e.metaKey, o = e.key.toLowerCase();
|
|
788
|
+
if (a && o === "z" && !e.shiftKey) e.preventDefault(), t.canUndo() && t.undo();
|
|
789
|
+
else if (a && o === "z" && e.shiftKey || a && o === "y") e.preventDefault(), t.canRedo() && t.redo();
|
|
790
|
+
else if (o === "delete" || o === "backspace") {
|
|
765
791
|
let t = n.get();
|
|
766
792
|
t.length && (e.preventDefault(), r.removeElements([...t]));
|
|
767
|
-
}
|
|
793
|
+
} else if (a && o === "c") {
|
|
794
|
+
let t = n.get();
|
|
795
|
+
t.length && (e.preventDefault(), i.copy(t));
|
|
796
|
+
} else a && o === "v" && (e.preventDefault(), i.paste());
|
|
768
797
|
});
|
|
769
798
|
}
|
|
770
|
-
},
|
|
799
|
+
}, Ae = {
|
|
771
800
|
__init__: ["ttKeyboard"],
|
|
772
|
-
ttKeyboard: ["type",
|
|
801
|
+
ttKeyboard: ["type", ke]
|
|
802
|
+
};
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/copy-paste/TtCopyPaste.ts
|
|
805
|
+
function je(e) {
|
|
806
|
+
switch (e) {
|
|
807
|
+
case "team": return "team";
|
|
808
|
+
case "interaction": return "int";
|
|
809
|
+
case "flow": return "flow";
|
|
810
|
+
default: return;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
var Me = class extends ue {
|
|
814
|
+
elementFactory;
|
|
815
|
+
static $inject = [
|
|
816
|
+
"canvas",
|
|
817
|
+
"create",
|
|
818
|
+
"clipboard",
|
|
819
|
+
"elementFactory",
|
|
820
|
+
"eventBus",
|
|
821
|
+
"modeling",
|
|
822
|
+
"mouse",
|
|
823
|
+
"rules"
|
|
824
|
+
];
|
|
825
|
+
constructor(e, t, n, r, i, a, o, s) {
|
|
826
|
+
super(e, t, n, r, i, a, o, s), this.elementFactory = r;
|
|
827
|
+
}
|
|
828
|
+
createShape(e) {
|
|
829
|
+
let t = je(e.ttKind);
|
|
830
|
+
return t ? this.elementFactory.createShape({
|
|
831
|
+
...e,
|
|
832
|
+
id: c(t)
|
|
833
|
+
}) : super.createShape(e);
|
|
834
|
+
}
|
|
835
|
+
}, Ne = [
|
|
836
|
+
"ttKind",
|
|
837
|
+
"teamType",
|
|
838
|
+
"mode",
|
|
839
|
+
"ttLabel",
|
|
840
|
+
"description",
|
|
841
|
+
"fill",
|
|
842
|
+
"stroke"
|
|
843
|
+
], Pe = {
|
|
844
|
+
__depends__: [le],
|
|
845
|
+
__init__: ["ttCopyPasteProps"],
|
|
846
|
+
copyPaste: ["type", Me],
|
|
847
|
+
ttCopyPasteProps: ["type", class {
|
|
848
|
+
static $inject = ["eventBus"];
|
|
849
|
+
constructor(e) {
|
|
850
|
+
e.on("copyPaste.copyElement", (e) => {
|
|
851
|
+
let { descriptor: t, element: n } = e;
|
|
852
|
+
if (!v(n)) return;
|
|
853
|
+
let r = n;
|
|
854
|
+
for (let e of Ne) r[e] !== void 0 && (t[e] = r[e]);
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
}]
|
|
773
858
|
};
|
|
774
859
|
//#endregion
|
|
775
860
|
//#region src/zorder/TtZOrder.ts
|
|
776
|
-
function
|
|
861
|
+
function Fe(e) {
|
|
777
862
|
return x(e) ? 0 : y(e) ? e.teamType === "enabling" ? 3 : e.teamType === "complicated-subsystem" ? 2 : 1 : b(e) ? 4 : 1;
|
|
778
863
|
}
|
|
779
|
-
var
|
|
864
|
+
var Ie = class {
|
|
780
865
|
canvas;
|
|
781
866
|
elementRegistry;
|
|
782
867
|
static $inject = [
|
|
@@ -795,7 +880,7 @@ var ke = class {
|
|
|
795
880
|
});
|
|
796
881
|
}
|
|
797
882
|
reorder() {
|
|
798
|
-
let e = this.elementRegistry.getAll().filter(v).sort((e, t) =>
|
|
883
|
+
let e = this.elementRegistry.getAll().filter(v).sort((e, t) => Fe(e) - Fe(t));
|
|
799
884
|
for (let t of e) {
|
|
800
885
|
let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
|
|
801
886
|
e && n && n.appendChild(e);
|
|
@@ -803,8 +888,8 @@ var ke = class {
|
|
|
803
888
|
}
|
|
804
889
|
}, $ = {
|
|
805
890
|
__init__: ["ttZOrder"],
|
|
806
|
-
ttZOrder: ["type",
|
|
807
|
-
},
|
|
891
|
+
ttZOrder: ["type", Ie]
|
|
892
|
+
}, Le = class extends L {
|
|
808
893
|
_getModules() {
|
|
809
894
|
return [
|
|
810
895
|
...super._getModules(),
|
|
@@ -812,13 +897,14 @@ var ke = class {
|
|
|
812
897
|
ee,
|
|
813
898
|
te,
|
|
814
899
|
ne,
|
|
815
|
-
z,
|
|
816
900
|
V,
|
|
817
901
|
U,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
902
|
+
_e,
|
|
903
|
+
Z,
|
|
904
|
+
Te,
|
|
821
905
|
De,
|
|
906
|
+
Ae,
|
|
907
|
+
Pe,
|
|
822
908
|
$
|
|
823
909
|
];
|
|
824
910
|
}
|
|
@@ -836,6 +922,6 @@ var ke = class {
|
|
|
836
922
|
}
|
|
837
923
|
};
|
|
838
924
|
//#endregion
|
|
839
|
-
export {
|
|
925
|
+
export { Le as Modeler, L as NavigatedViewer, w as ROOT_ID, j as TeamTopologiesRenderer, E as TtBaseViewer, we as TtContextPadProvider, D as TtElementFactory, P as TtExporter, W as TtFlatModelBehavior, N as TtImporter, ke as TtKeyboard, Ee as TtLabelEditing, B as TtModeling, X as TtPaletteProvider, H as TtRules, Ie as TtZOrder, I as Viewer, q as flowIconSvg, J as interactionIconSvg, F as ioModule, v as isTtElement, x as isTtFlow, b as isTtInteraction, y as isTtTeam, C as saveSVG, K as teamIconSvg, _e as ttBehaviorsModule, Te as ttContextPadModule, M as ttDrawModule, Ae as ttKeyboardModule, De as ttLabelEditingModule, O as ttModelModule, V as ttModelingModule, Z as ttPaletteModule, U as ttRulesModule, $ as ttZOrderModule };
|
|
840
926
|
|
|
841
927
|
//# sourceMappingURL=index.js.map
|