@miragon/team-topologies-renderer 0.5.0 → 0.6.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 CHANGED
@@ -52,8 +52,12 @@ modeler.redo();
52
52
  ```
53
53
 
54
54
  > **The CSS is required.** Import `@miragon/team-topologies-renderer/assets/team-topologies.css`
55
- > (it also pulls in `diagram-js`'s own stylesheet) — without it the palette, context pad and label
56
- > editor are unstyled.
55
+ > (it also pulls in `diagram-js`'s own stylesheet and the Miragon `--cd-*` brand tokens) — without it
56
+ > the palette, context pad and label editor are unstyled.
57
+
58
+ > **Typeface.** The canvas labels are drawn in the Miragon typeface **Geist**. The library does not
59
+ > ship the font; self-host it in the host app (e.g. `@fontsource-variable/geist`) so the on-screen
60
+ > canvas and exported SVG render in Geist. Without it, text falls back to a system sans.
57
61
 
58
62
  ## API
59
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"Modeler.d.ts","sourceRoot":"","sources":["../src/Modeler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQ9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAUvD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IAoBrD,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
1
+ {"version":3,"file":"Modeler.d.ts","sourceRoot":"","sources":["../src/Modeler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQ9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAWvD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IAqBrD,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
@@ -0,0 +1,17 @@
1
+ import { default as CopyPaste } from 'diagram-js/lib/features/copy-paste/CopyPaste.js';
2
+ import { default as Canvas } from 'diagram-js/lib/core/Canvas';
3
+ import { default as Create } from 'diagram-js/lib/features/create/Create';
4
+ import { default as Clipboard } from 'diagram-js/lib/features/clipboard/Clipboard';
5
+ import { default as ElementFactory } from 'diagram-js/lib/core/ElementFactory';
6
+ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
7
+ import { default as Modeling } from 'diagram-js/lib/features/modeling/Modeling';
8
+ import { default as Mouse } from 'diagram-js/lib/features/mouse/Mouse';
9
+ import { default as Rules } from 'diagram-js/lib/features/rules/Rules';
10
+ import { Shape } from 'diagram-js/lib/model/Types';
11
+ export default class TtCopyPaste extends CopyPaste {
12
+ private readonly elementFactory;
13
+ static $inject: string[];
14
+ constructor(canvas: Canvas, create: Create, clipboard: Clipboard, elementFactory: ElementFactory, eventBus: EventBus, modeling: Modeling, mouse: Mouse, rules: Rules);
15
+ createShape(attrs: Record<string, unknown>): Shape;
16
+ }
17
+ //# sourceMappingURL=TtCopyPaste.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtCopyPaste.d.ts","sourceRoot":"","sources":["../../src/copy-paste/TtCopyPaste.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,iDAAiD,CAAC;AAGxE,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AACzE,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAgBxD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IAgB9C,OAAO,CAAC,QAAQ,CAAC,cAAc;IAfjC,OAAgB,OAAO,WASrB;gBAGA,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACH,cAAc,EAAE,cAAc,EAC/C,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK;IAKL,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK;CAS5D"}
@@ -0,0 +1,6 @@
1
+ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
2
+ export default class TtCopyPasteProps {
3
+ static $inject: string[];
4
+ constructor(eventBus: EventBus);
5
+ }
6
+ //# sourceMappingURL=TtCopyPasteProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TtCopyPasteProps.d.ts","sourceRoot":"","sources":["../../src/copy-paste/TtCopyPasteProps.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AAczD,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAC,OAAO,WAAgB;gBAElB,QAAQ,EAAE,QAAQ;CAa/B"}
@@ -0,0 +1,9 @@
1
+ import { ModuleDeclaration } from 'didi';
2
+ /**
3
+ * Copy-paste of Team Topologies shapes: the stock diagram-js feature (clipboard,
4
+ * cursor-follow placement) with `copyPaste` overridden to mint model-style ids
5
+ * and a listener that preserves the flat `tt*` props across the round-trip.
6
+ */
7
+ export declare const ttCopyPasteModule: ModuleDeclaration;
8
+ export { default as TtCopyPaste } from './TtCopyPaste.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/copy-paste/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAK/B,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,20 +1,25 @@
1
- /** Shared rendering constants (typography, accent, priorities). */
1
+ /** Shared rendering constants (typography, accent, priorities) — Miragon corporate identity.
2
+ * Colours are derived from the single source of truth in `theme/palette.ts` (`MIRAGON`), which
3
+ * mirrors the vendored `--cd-*` brand tokens. */
2
4
  /** BaseRenderer default priority is 1000; 1500 wins the render.shape/connection event. */
3
5
  export declare const TT_RENDER_PRIORITY = 1500;
4
- /** Selection / hover accent (kept in sync with the app theme). */
5
- export declare const ACCENT = "#4f46e5";
6
- export declare const INK = "#1f2430";
7
- export declare const INK_SOFT = "#525a6b";
6
+ /** Selection / hover accent (Miragon blue — kept in sync with the app theme via the shared palette). */
7
+ export declare const ACCENT: "#335DE5";
8
+ export declare const INK: "#1D1D1D";
9
+ export declare const INK_SOFT = "#5B5B5B";
8
10
  export declare const FONT: {
9
11
  /**
10
12
  * Set directly as the `font-family` attribute on every SVG <text> (canvas
11
13
  * labels and therefore the SVG export too) — not inherited from a CSS
12
- * container. Falls back to system sans when the host doesn't provide Inter.
14
+ * container. Prefers the self-hosted Miragon typeface Geist (registered as
15
+ * 'Geist Variable' by @fontsource-variable/geist, with 'Geist' as a fallback
16
+ * name), and falls back to a system sans when the host hasn't loaded it (e.g.
17
+ * an exported SVG opened standalone).
13
18
  */
14
- readonly family: "'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif";
19
+ readonly family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif";
15
20
  readonly label: 13.5;
16
21
  readonly small: 11;
17
22
  };
18
23
  /** Paper colour used for the label halo so text stays legible over lines. */
19
- export declare const PAPER = "#ffffff";
24
+ export declare const PAPER: "#FFFFFF";
20
25
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/draw/styles.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,kEAAkE;AAClE,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,GAAG,YAAY,CAAC;AAC7B,eAAO,MAAM,QAAQ,YAAY,CAAC;AAElC,eAAO,MAAM,IAAI;IACf;;;;OAIG;;;;CAIK,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,KAAK,YAAY,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/draw/styles.ts"],"names":[],"mappings":"AAAA;;kDAEkD;AAIlD,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,wGAAwG;AACxG,eAAO,MAAM,MAAM,WAAe,CAAC;AAEnC,eAAO,MAAM,GAAG,WAAkB,CAAC;AACnC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAElC,eAAO,MAAM,IAAI;IACf;;;;;;;OAOG;;;;CAKK,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,KAAK,WAAgB,CAAC"}
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;
@@ -231,14 +233,37 @@ var E = class {
231
233
  ttLabel: i.label
232
234
  });
233
235
  }
234
- }, O = { ttElementFactory: ["type", D] }, le = 1500, ue = "#1f2430", de = "#525a6b", k = {
235
- family: "'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
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
- }, A = class extends l {
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, le);
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: fe(a, o, s, e),
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": k.small,
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": k.small,
368
+ "font-size": A.small,
344
369
  "font-weight": "650",
345
370
  "letter-spacing": "0.06em",
346
- fill: de
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"] : k.label, o = pe(t, n - 20, a), s = a * 1.2, c = r / 2 - (o.length - 1) * s / 2;
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": k.family,
380
+ "font-family": A.family,
356
381
  "font-size": a,
357
- fill: ue,
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 fe(e, t, n, r) {
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 pe(e, t, n) {
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 j = {
415
+ var M = {
391
416
  __init__: ["ttRenderer"],
392
- ttRenderer: ["type", A]
393
- }, M = class {
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
- }, N = class {
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
- }, P = {
487
- ttImporter: ["type", M],
488
- ttExporter: ["type", N]
489
- }, F = class extends E {
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
- j,
494
- P
518
+ M,
519
+ F
495
520
  ];
496
521
  }
497
- }, I = class extends F {
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 L(e, t, n) {
534
+ function R(e, t, n) {
510
535
  n === void 0 ? delete e[t] : e[t] = n;
511
536
  }
512
- var me = class {
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], L(r, e, n[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)) L(r, e, n[e]);
545
+ if (n) for (let e of Object.keys(n)) R(r, e, n[e]);
521
546
  return [t];
522
547
  }
523
- }, R = "element.updateProperties", he = class {
548
+ }, z = "element.updateProperties", B = class {
524
549
  commandStack;
525
550
  static $inject = ["commandStack"];
526
551
  constructor(e) {
527
- this.commandStack = e, e.registerHandler(R, me);
552
+ this.commandStack = e, e.registerHandler(z, ge);
528
553
  }
529
554
  updateProperties(e, t) {
530
- this.commandStack.execute(R, {
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
- }, z = {
578
+ }, V = {
554
579
  __init__: ["ttModeling"],
555
- ttModeling: ["type", he]
556
- }, B = class extends ie {
580
+ ttModeling: ["type", B]
581
+ }, _e = 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
- }, V = {
589
+ }, H = {
565
590
  __depends__: [re],
566
591
  __init__: ["ttRules"],
567
- ttRules: ["type", B]
568
- }, H = class extends ae {
592
+ ttRules: ["type", _e]
593
+ }, U = 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
- }, U = {
600
+ }, W = {
576
601
  __init__: ["ttFlatModelBehavior"],
577
- ttFlatModelBehavior: ["type", H]
602
+ ttFlatModelBehavior: ["type", U]
578
603
  };
579
604
  //#endregion
580
605
  //#region src/draw/palette-icons.ts
581
- function W(e) {
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 G(e) {
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 W(`<polygon points="8,3 18,3 23,8 23,18 18,23 8,23 3,18 3,8" ${r}/>`);
588
- case "rounded-rect-vertical": return W(`<rect x="8" y="3" width="10" height="20" rx="4" ${r}/>`);
589
- case "rect": return W(`<rect x="3" y="7" width="20" height="12" rx="1.5" ${r}/>`);
590
- default: return W(`<rect x="3" y="8" width="20" height="10" rx="5" ${r}/>`);
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 K() {
594
- return W("<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>");
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 q(e) {
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 W(`<circle cx="13" cy="13" r="9" ${r}/>`);
600
- case "triangle": return W(`<polygon points="5,6 22,13 5,20" ${r}/>`);
601
- default: return W(`<polygon points="9,6 23,6 17,20 3,20" ${r}/>`);
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 ge = "tt-1-teams", _e = "tt-2-modes", ve = "tt-3-flow";
607
- function J(e, t) {
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 Y = class {
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: ge,
651
+ group: ve,
627
652
  title: `${t.label} team — ${t.description}`,
628
- html: J(G(t.type), `${t.label} team — ${t.description}`),
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: _e,
663
+ group: ye,
639
664
  title: `${n.label} — ${n.description} (place over the teams it relates to)`,
640
- html: J(q(n.mode), `${n.label} — ${n.description}`),
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: ve,
674
+ group: be,
650
675
  title: `${i.label} — the implied left-to-right flow`,
651
- html: J(K(), i.label),
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
- }, X = {
683
+ }, Z = {
659
684
  __depends__: [oe, se],
660
685
  __init__: ["ttPaletteProvider"],
661
- ttPaletteProvider: ["type", Y]
662
- }, ye = "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", be = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z";
663
- function xe(e, t = 18) {
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 Z(e, t) {
669
- return `<div class="entry tt-cp-entry" title="${t}">${xe(e)}</div>`;
693
+ function Q(e, t) {
694
+ return `<div class="entry tt-cp-entry" title="${t}">${Ce(e)}</div>`;
670
695
  }
671
- var Q = class {
696
+ var $ = 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: Z(ye, "Rename"),
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: Z(be, "Delete"),
718
+ html: Q(Se, "Delete"),
694
719
  action: { click: () => this.modeling.removeElements([e]) }
695
720
  }
696
721
  } : {};
697
722
  }
698
- }, Se = {
723
+ }, we = {
699
724
  __depends__: [ce],
700
725
  __init__: ["ttContextPadProvider"],
701
- ttContextPadProvider: ["type", Q]
702
- }, Ce = class {
726
+ ttContextPadProvider: ["type", $]
727
+ }, Te = class {
703
728
  canvas;
704
729
  modeling;
705
730
  static $inject = [
@@ -738,45 +763,105 @@ var Q = class {
738
763
  cancel() {
739
764
  this.active?.cleanup();
740
765
  }
741
- }, we = {
766
+ }, Ee = {
742
767
  __init__: ["ttLabelEditing"],
743
- ttLabelEditing: ["type", Ce]
768
+ ttLabelEditing: ["type", Te]
744
769
  };
745
770
  //#endregion
746
771
  //#region src/keyboard/TtKeyboard.ts
747
- function Te(e) {
772
+ function De(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 Ee = class {
776
+ var Oe = 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 (Te(e.target)) return;
761
- let i = e.ctrlKey || e.metaKey, a = e.key.toLowerCase();
762
- if (i && a === "z" && !e.shiftKey) e.preventDefault(), t.canUndo() && t.undo();
763
- else if (i && a === "z" && e.shiftKey || i && a === "y") e.preventDefault(), t.canRedo() && t.redo();
764
- else if (a === "delete" || a === "backspace") {
786
+ if (De(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
- }, De = {
799
+ }, ke = {
771
800
  __init__: ["ttKeyboard"],
772
- ttKeyboard: ["type", Ee]
801
+ ttKeyboard: ["type", Oe]
802
+ };
803
+ //#endregion
804
+ //#region src/copy-paste/TtCopyPaste.ts
805
+ function Ae(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 je = 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 = Ae(e.ttKind);
830
+ return t ? this.elementFactory.createShape({
831
+ ...e,
832
+ id: c(t)
833
+ }) : super.createShape(e);
834
+ }
835
+ }, Me = [
836
+ "ttKind",
837
+ "teamType",
838
+ "mode",
839
+ "ttLabel",
840
+ "description",
841
+ "fill",
842
+ "stroke"
843
+ ], Ne = {
844
+ __depends__: [le],
845
+ __init__: ["ttCopyPasteProps"],
846
+ copyPaste: ["type", je],
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 Me) 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 Oe(e) {
861
+ function Pe(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 ke = class {
864
+ var Fe = class {
780
865
  canvas;
781
866
  elementRegistry;
782
867
  static $inject = [
@@ -795,16 +880,16 @@ var ke = class {
795
880
  });
796
881
  }
797
882
  reorder() {
798
- let e = this.elementRegistry.getAll().filter(v).sort((e, t) => Oe(e) - Oe(t));
883
+ let e = this.elementRegistry.getAll().filter(v).sort((e, t) => Pe(e) - Pe(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);
802
887
  }
803
888
  }
804
- }, $ = {
889
+ }, Ie = {
805
890
  __init__: ["ttZOrder"],
806
- ttZOrder: ["type", ke]
807
- }, Ae = class extends I {
891
+ ttZOrder: ["type", Fe]
892
+ }, Le = class extends L {
808
893
  _getModules() {
809
894
  return [
810
895
  ...super._getModules(),
@@ -812,14 +897,15 @@ var ke = class {
812
897
  ee,
813
898
  te,
814
899
  ne,
815
- z,
816
900
  V,
817
- U,
818
- X,
819
- Se,
901
+ H,
902
+ W,
903
+ Z,
820
904
  we,
821
- De,
822
- $
905
+ Ee,
906
+ ke,
907
+ Ne,
908
+ Ie
823
909
  ];
824
910
  }
825
911
  undo() {
@@ -836,6 +922,6 @@ var ke = class {
836
922
  }
837
923
  };
838
924
  //#endregion
839
- export { Ae as Modeler, I as NavigatedViewer, w as ROOT_ID, A as TeamTopologiesRenderer, E as TtBaseViewer, Q as TtContextPadProvider, D as TtElementFactory, N as TtExporter, H as TtFlatModelBehavior, M as TtImporter, Ee as TtKeyboard, Ce as TtLabelEditing, he as TtModeling, Y as TtPaletteProvider, B as TtRules, ke as TtZOrder, F as Viewer, K as flowIconSvg, q as interactionIconSvg, P as ioModule, v as isTtElement, x as isTtFlow, b as isTtInteraction, y as isTtTeam, C as saveSVG, G as teamIconSvg, U as ttBehaviorsModule, Se as ttContextPadModule, j as ttDrawModule, De as ttKeyboardModule, we as ttLabelEditingModule, O as ttModelModule, z as ttModelingModule, X as ttPaletteModule, V as ttRulesModule, $ as ttZOrderModule };
925
+ export { Le as Modeler, L as NavigatedViewer, w as ROOT_ID, j as TeamTopologiesRenderer, E as TtBaseViewer, $ as TtContextPadProvider, D as TtElementFactory, P as TtExporter, U as TtFlatModelBehavior, N as TtImporter, Oe as TtKeyboard, Te as TtLabelEditing, B as TtModeling, X as TtPaletteProvider, _e as TtRules, Fe 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, W as ttBehaviorsModule, we as ttContextPadModule, M as ttDrawModule, ke as ttKeyboardModule, Ee as ttLabelEditingModule, O as ttModelModule, V as ttModelingModule, Z as ttPaletteModule, H as ttRulesModule, Ie as ttZOrderModule };
840
926
 
841
927
  //# sourceMappingURL=index.js.map