@miragon/team-topologies-renderer 0.11.2 → 0.12.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/dist/index.js CHANGED
@@ -162,7 +162,10 @@ var Me = class {
162
162
  canvas: { container: this._container },
163
163
  modules: t,
164
164
  ttKeyboard: { undoRedoKeys: this._options.undoRedoKeys ?? !0 },
165
- ttPalette: { freeRectCenter: this._options.freeRectCenter }
165
+ ttPalette: {
166
+ freeArea: this._options.freeArea,
167
+ freeRectCenter: this._options.freeRectCenter
168
+ }
166
169
  }), this._describeCanvas(this._diagram);
167
170
  }
168
171
  return this._diagram;
@@ -1139,7 +1142,14 @@ function $t(e) {
1139
1142
  y: e.y + e.height / 2
1140
1143
  };
1141
1144
  }
1142
- var en = class {
1145
+ function en(e, t) {
1146
+ let { x: n, y: r, scale: i, outer: a } = e.viewbox(), o = a.width - t.left - t.right, s = a.height - t.top - t.bottom;
1147
+ if (i > 0 && o > 0 && s > 0) return {
1148
+ x: n + (t.left + o / 2) / i,
1149
+ y: r + (t.top + s / 2) / i
1150
+ };
1151
+ }
1152
+ var tn = class {
1143
1153
  config;
1144
1154
  create;
1145
1155
  factory;
@@ -1192,7 +1202,7 @@ var en = class {
1192
1202
  };
1193
1203
  }
1194
1204
  freePlace() {
1195
- let e = this.canvas.viewbox(), t = this.config?.freeRectCenter?.() ?? {
1205
+ let e = this.canvas.viewbox(), t = this.freeAreaCentre() ?? {
1196
1206
  x: e.x + e.width / 2,
1197
1207
  y: e.y + e.height / 2
1198
1208
  }, n = {
@@ -1205,20 +1215,24 @@ var en = class {
1205
1215
  for (; r();) n.x += Xt, n.y += Xt;
1206
1216
  return n;
1207
1217
  }
1218
+ freeAreaCentre() {
1219
+ let e = this.config?.freeArea;
1220
+ return e?.center ? e.center() : e?.insets ? en(this.canvas, e.insets()) : this.config?.freeRectCenter?.();
1221
+ }
1208
1222
  placeInFreeRect(e) {
1209
1223
  if (this.readOnly?.isReadOnly()) return;
1210
1224
  let t = this.modeling.createShape(e, this.freePlace(), this.canvas.getRootElement());
1211
1225
  this.selection.select(t), this.canvas.focus(), T(t) && this.labelEditing?.activate(t);
1212
1226
  }
1213
- }, tn = {
1227
+ }, nn = {
1214
1228
  __depends__: [
1215
1229
  ge,
1216
1230
  _e,
1217
1231
  se
1218
1232
  ],
1219
1233
  __init__: ["ttPaletteProvider"],
1220
- ttPaletteProvider: ["type", en]
1221
- }, X = "tt.readOnly.changed", nn = 5e3, rn = [
1234
+ ttPaletteProvider: ["type", tn]
1235
+ }, X = "tt.readOnly.changed", rn = 5e3, an = [
1222
1236
  "elements.move",
1223
1237
  "shape.move",
1224
1238
  "shape.resize",
@@ -1230,7 +1244,7 @@ var en = class {
1230
1244
  "connection.reconnect",
1231
1245
  "connection.updateWaypoints",
1232
1246
  "elements.delete"
1233
- ], an = class extends me {
1247
+ ], on = class extends me {
1234
1248
  bus;
1235
1249
  static $inject = ["eventBus"];
1236
1250
  readOnly = !1;
@@ -1238,7 +1252,7 @@ var en = class {
1238
1252
  super(e), this.bus = e;
1239
1253
  }
1240
1254
  init() {
1241
- this.addRule(rn, nn, () => !this.readOnly && void 0);
1255
+ this.addRule(an, rn, () => !this.readOnly && void 0);
1242
1256
  }
1243
1257
  isReadOnly() {
1244
1258
  return this.readOnly;
@@ -1246,18 +1260,18 @@ var en = class {
1246
1260
  setReadOnly(e) {
1247
1261
  this.readOnly !== e && (this.readOnly = e, this.bus.fire(X, { readOnly: e }));
1248
1262
  }
1249
- }, on = {
1263
+ }, sn = {
1250
1264
  __depends__: [pe],
1251
1265
  __init__: ["ttReadOnly"],
1252
- ttReadOnly: ["type", an]
1253
- }, sn = ".djs-context-pad .entry[data-action]";
1266
+ ttReadOnly: ["type", on]
1267
+ }, cn = ".djs-context-pad .entry[data-action]";
1254
1268
  function Z(e, t, n = !0) {
1255
1269
  return `<div class="entry tt-cp-entry" role="button" tabindex="${n ? 0 : -1}" aria-label="${t}">${J(e)}</div>`;
1256
1270
  }
1257
- function cn(e) {
1271
+ function ln(e) {
1258
1272
  return k(e) ? "Edit text" : D(e) || O(e) ? "Edit label" : "Rename";
1259
1273
  }
1260
- var ln = class {
1274
+ var un = class {
1261
1275
  contextPad;
1262
1276
  modeling;
1263
1277
  ttModeling;
@@ -1325,11 +1339,11 @@ var ln = class {
1325
1339
  }
1326
1340
  onEntryKeyDown(e) {
1327
1341
  if (e.key !== "Enter" && e.key !== " " || e.repeat) return;
1328
- let t = (e.target?.closest?.(sn))?.getAttribute("data-action");
1342
+ let t = (e.target?.closest?.(cn))?.getAttribute("data-action");
1329
1343
  t && (e.preventDefault(), e.stopPropagation(), this.contextPad.triggerEntry(t, "keyboard", e));
1330
1344
  }
1331
1345
  editEntry(e) {
1332
- let t = cn(e), n = () => this.labelEditing.activate(e);
1346
+ let t = ln(e), n = () => this.labelEditing.activate(e);
1333
1347
  return {
1334
1348
  group: "edit",
1335
1349
  title: t,
@@ -1353,19 +1367,19 @@ var ln = class {
1353
1367
  }
1354
1368
  };
1355
1369
  }
1356
- }, un = {
1370
+ }, dn = {
1357
1371
  __depends__: [
1358
1372
  be,
1359
1373
  ve,
1360
1374
  ye
1361
1375
  ],
1362
1376
  __init__: ["ttContextPadProvider"],
1363
- ttContextPadProvider: ["type", ln]
1364
- }, dn = "tt-label-editing", fn = 96;
1365
- function pn(e) {
1377
+ ttContextPadProvider: ["type", un]
1378
+ }, fn = "tt-label-editing", pn = 96;
1379
+ function mn(e) {
1366
1380
  return k(e) ? "Annotation text" : D(e) ? "Interaction label" : O(e) ? "Flow label" : "Team name";
1367
1381
  }
1368
- var mn = class {
1382
+ var hn = class {
1369
1383
  canvas;
1370
1384
  modeling;
1371
1385
  elementRegistry;
@@ -1383,11 +1397,7 @@ var mn = class {
1383
1397
  constructor(e, t, n, r, i) {
1384
1398
  this.canvas = t, this.modeling = n, this.elementRegistry = r, this.readOnly = i.get("ttReadOnly", !1), e.on("element.dblclick", (e) => {
1385
1399
  T(e.element) && this.activate(e.element);
1386
- }), e.on([
1387
- "element.mousedown",
1388
- "drag.init",
1389
- "canvas.viewbox.changing"
1390
- ], () => this.active?.commit()), e.on("import.render.start", () => this.cancel()), e.on(X, (e) => {
1400
+ }), e.on(["element.mousedown", "drag.init"], () => this.active?.commit()), e.on("canvas.viewbox.changed", () => this.active?.place()), e.on("import.render.start", () => this.cancel()), e.on(X, (e) => {
1391
1401
  e.readOnly && this.cancel();
1392
1402
  }), e.on("diagram.destroy", () => {
1393
1403
  clearTimeout(this.resumeTimer), this.suspended = null, this.cancel();
@@ -1414,53 +1424,58 @@ var mn = class {
1414
1424
  }
1415
1425
  activate(e, t) {
1416
1426
  if (this.active?.commit(), this.readOnly?.isReadOnly()) return;
1417
- let n = H(e), r = n.align === "center", i = this.canvas.zoom(), a = this.canvas.viewbox(), o = r ? Math.max(n.box.width, fn) : n.box.width, s = e.x + n.box.x + (n.box.width - o) / 2, c = (e.y + n.box.y - a.y) * i, l = n.box.height * i, u = document.createElement("textarea");
1418
- u.className = "tt-label-editor", u.value = t ? t.value : e.ttLabel ?? "", u.rows = 1, u.setAttribute("aria-label", pn(e)), Object.assign(u.style, {
1419
- left: `${(s - a.x) * i}px`,
1420
- width: `${o * i}px`,
1427
+ let n = H(e), r = n.align === "center", i = r ? Math.max(n.box.width, pn) : n.box.width, a = e.x + n.box.x + (n.box.width - i) / 2, o = document.createElement("textarea");
1428
+ o.className = "tt-label-editor", o.value = t ? t.value : e.ttLabel ?? "", o.rows = 1, o.setAttribute("aria-label", mn(e)), Object.assign(o.style, {
1421
1429
  fontFamily: I.family,
1422
- fontSize: `${n.fontSize * i}px`,
1423
1430
  fontWeight: n.fontWeight,
1424
1431
  letterSpacing: n.letterSpacing ?? "normal",
1425
1432
  lineHeight: String(R),
1426
1433
  color: n.fill,
1427
1434
  textAlign: r ? "center" : "left"
1428
1435
  });
1429
- let d = () => {
1430
- u.style.height = "0px";
1431
- let e = u.scrollHeight;
1432
- u.style.height = `${r ? e : Math.max(e, l)}px`, u.style.top = `${r ? c + (l - e) / 2 : c}px`;
1436
+ let s = 0, c = 0, l = () => {
1437
+ o.style.height = "0px";
1438
+ let e = o.scrollHeight;
1439
+ o.style.height = `${r ? e : Math.max(e, c)}px`, o.style.top = `${r ? s + (c - e) / 2 : s}px`;
1440
+ }, u = () => {
1441
+ let t = this.canvas.zoom(), r = this.canvas.viewbox();
1442
+ s = (e.y + n.box.y - r.y) * t, c = n.box.height * t, Object.assign(o.style, {
1443
+ left: `${(a - r.x) * t}px`,
1444
+ width: `${i * t}px`,
1445
+ fontSize: `${n.fontSize * t}px`
1446
+ }), l();
1433
1447
  };
1434
- this.canvas.getContainer().appendChild(u), this.canvas.addMarker(e, dn), d(), u.focus(), t ? u.setSelectionRange(t.selectionStart, t.selectionEnd) : u.select();
1435
- let f = !1, p = () => {
1436
- f || (f = !0, u.removeEventListener("keydown", h), u.removeEventListener("input", d), u.removeEventListener("blur", g), u.remove(), this.elementRegistry.get(e.id) === e && this.canvas.removeMarker(e, dn), this.active = null, this.canvas.restoreFocus());
1437
- }, m = () => {
1438
- if (f) return;
1439
- let t = u.value.trim(), n = t !== (e.ttLabel ?? "");
1440
- p(), n && this.modeling.updateLabel(e, t);
1441
- }, h = (e) => {
1442
- e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), m(), this.canvas.focus()) : e.key === "Escape" && (e.preventDefault(), p(), this.canvas.focus());
1443
- }, g = () => m();
1444
- u.addEventListener("keydown", h), u.addEventListener("input", d), u.addEventListener("blur", g);
1445
- let _ = () => ({
1448
+ this.canvas.getContainer().appendChild(o), this.canvas.addMarker(e, fn), u(), o.focus(), t ? o.setSelectionRange(t.selectionStart, t.selectionEnd) : o.select();
1449
+ let d = !1, f = () => {
1450
+ d || (d = !0, o.removeEventListener("keydown", m), o.removeEventListener("input", l), o.removeEventListener("blur", h), o.remove(), this.elementRegistry.get(e.id) === e && this.canvas.removeMarker(e, fn), this.active = null, this.canvas.restoreFocus());
1451
+ }, p = () => {
1452
+ if (d) return;
1453
+ let t = o.value.trim(), n = t !== (e.ttLabel ?? "");
1454
+ f(), n && this.modeling.updateLabel(e, t);
1455
+ }, m = (e) => {
1456
+ e.key === "Enter" && !e.shiftKey && !e.isComposing ? (e.preventDefault(), p(), this.canvas.focus()) : e.key === "Escape" && (e.preventDefault(), f(), this.canvas.focus());
1457
+ }, h = () => p();
1458
+ o.addEventListener("keydown", m), o.addEventListener("input", l), o.addEventListener("blur", h);
1459
+ let g = () => ({
1446
1460
  elementId: e.id,
1447
- value: u.value,
1448
- selectionStart: u.selectionStart,
1449
- selectionEnd: u.selectionEnd
1461
+ value: o.value,
1462
+ selectionStart: o.selectionStart,
1463
+ selectionEnd: o.selectionEnd
1450
1464
  });
1451
1465
  this.active = {
1452
- commit: m,
1453
- cleanup: p,
1454
- snapshot: _
1466
+ commit: p,
1467
+ cleanup: f,
1468
+ place: u,
1469
+ snapshot: g
1455
1470
  };
1456
1471
  }
1457
1472
  cancel() {
1458
1473
  this.active?.cleanup();
1459
1474
  }
1460
- }, hn = {
1475
+ }, gn = {
1461
1476
  __init__: ["ttLabelEditing"],
1462
- ttLabelEditing: ["type", mn]
1463
- }, gn = 1, _n = 10, vn = {
1477
+ ttLabelEditing: ["type", hn]
1478
+ }, _n = 1, vn = 10, yn = {
1464
1479
  ArrowLeft: {
1465
1480
  x: -1,
1466
1481
  y: 0
@@ -1477,21 +1492,21 @@ var mn = class {
1477
1492
  x: 0,
1478
1493
  y: 1
1479
1494
  }
1480
- }, yn = "[aria-modal=\"true\"], dialog[open]";
1481
- function bn(e) {
1495
+ }, bn = "[aria-modal=\"true\"], dialog[open]";
1496
+ function xn(e) {
1482
1497
  let t = e;
1483
1498
  return t ? t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable : !1;
1484
1499
  }
1485
- function xn(e) {
1500
+ function Sn(e) {
1486
1501
  return typeof e?.nodeType == "number";
1487
1502
  }
1488
- function Sn(e, t) {
1503
+ function Cn(e, t) {
1489
1504
  if (t.closest("[inert]")) return !1;
1490
- if (!xn(e) || e.nodeType === Node.DOCUMENT_NODE) return !0;
1505
+ if (!Sn(e) || e.nodeType === Node.DOCUMENT_NODE) return !0;
1491
1506
  let n = e.ownerDocument;
1492
1507
  return e === n?.body || e === n?.documentElement || t.contains(e);
1493
1508
  }
1494
- function Cn(e) {
1509
+ function wn(e) {
1495
1510
  return !("waypoints" in e);
1496
1511
  }
1497
1512
  var Q = class {
@@ -1528,30 +1543,30 @@ var Q = class {
1528
1543
  let t = a.get();
1529
1544
  t.length && (e.preventDefault(), o.removeElements([...t]));
1530
1545
  } else if (t && n === "v" && !e.shiftKey) e.preventDefault(), s.paste();
1531
- else if (!t && Object.hasOwn(vn, e.key)) {
1532
- let t = a.get().filter(Cn);
1546
+ else if (!t && Object.hasOwn(yn, e.key)) {
1547
+ let t = a.get().filter(wn);
1533
1548
  if (!t.length || !c.allowed("elements.move", { shapes: t })) return;
1534
1549
  e.preventDefault();
1535
- let n = vn[e.key], r = e.shiftKey ? _n : gn;
1550
+ let n = yn[e.key], r = e.shiftKey ? vn : _n;
1536
1551
  o.moveElements(t, {
1537
1552
  x: n.x * r,
1538
1553
  y: n.y * r
1539
1554
  });
1540
1555
  }
1541
1556
  }, _ = (e) => {
1542
- if (e.defaultPrevented || e.altKey || e.isComposing || bn(e.target) || !Sn(e.target, u) || d.querySelector(yn)) return;
1557
+ if (e.defaultPrevented || e.altKey || e.isComposing || xn(e.target) || !Cn(e.target, u) || d.querySelector(bn)) return;
1543
1558
  let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
1544
1559
  h(e, t, n) || m?.isReadOnly() || g(e, t, n);
1545
1560
  };
1546
1561
  d.addEventListener("keydown", _), t.on("diagram.destroy", () => d.removeEventListener("keydown", _));
1547
1562
  }
1548
- }, wn = {
1563
+ }, Tn = {
1549
1564
  __init__: ["ttKeyboard"],
1550
1565
  ttKeyboard: ["type", Q]
1551
1566
  };
1552
1567
  //#endregion
1553
1568
  //#region src/copy-paste/TtCopyPaste.ts
1554
- function Tn(e) {
1569
+ function En(e) {
1555
1570
  switch (e) {
1556
1571
  case "team": return "team";
1557
1572
  case "interaction": return "int";
@@ -1561,7 +1576,7 @@ function Tn(e) {
1561
1576
  default: return;
1562
1577
  }
1563
1578
  }
1564
- var En = class extends Se {
1579
+ var Dn = class extends Se {
1565
1580
  elementFactory;
1566
1581
  static $inject = [
1567
1582
  "canvas",
@@ -1577,20 +1592,20 @@ var En = class extends Se {
1577
1592
  super(e, t, n, r, i, a, o, s), this.elementFactory = r;
1578
1593
  }
1579
1594
  createConnection(e) {
1580
- let t = Tn(e.ttKind);
1595
+ let t = En(e.ttKind);
1581
1596
  return t ? this.elementFactory.createConnection({
1582
1597
  ...e,
1583
1598
  id: v(t)
1584
1599
  }) : super.createConnection(e);
1585
1600
  }
1586
1601
  createShape(e) {
1587
- let t = Tn(e.ttKind);
1602
+ let t = En(e.ttKind);
1588
1603
  return t ? this.elementFactory.createShape({
1589
1604
  ...e,
1590
1605
  id: v(t)
1591
1606
  }) : super.createShape(e);
1592
1607
  }
1593
- }, Dn = [
1608
+ }, On = [
1594
1609
  "ttKind",
1595
1610
  "teamType",
1596
1611
  "mode",
@@ -1599,10 +1614,10 @@ var En = class extends Se {
1599
1614
  "fill",
1600
1615
  "stroke",
1601
1616
  "ttForeign"
1602
- ], On = {
1617
+ ], kn = {
1603
1618
  __depends__: [xe],
1604
1619
  __init__: ["ttCopyPasteProps"],
1605
- copyPaste: ["type", En],
1620
+ copyPaste: ["type", Dn],
1606
1621
  ttCopyPasteProps: ["type", class {
1607
1622
  static $inject = ["eventBus"];
1608
1623
  constructor(e) {
@@ -1610,20 +1625,20 @@ var En = class extends Se {
1610
1625
  let { descriptor: t, element: n } = e;
1611
1626
  if (!T(n) && !A(n)) return;
1612
1627
  let r = n;
1613
- for (let e of Dn) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1628
+ for (let e of On) r[e] !== void 0 && (t[e] = structuredClone(r[e]));
1614
1629
  });
1615
1630
  }
1616
1631
  }]
1617
1632
  };
1618
1633
  //#endregion
1619
1634
  //#region src/zorder/TtZOrder.ts
1620
- function kn(e) {
1635
+ function An(e) {
1621
1636
  return O(e) ? 0 : E(e) ? e.teamType === "enabling" ? 3 : e.teamType === "complicated-subsystem" ? 2 : 1 : D(e) ? 4 : k(e) ? 5 : A(e) ? 6 : 1;
1622
1637
  }
1623
- function An(e) {
1638
+ function jn(e) {
1624
1639
  return T(e) || A(e);
1625
1640
  }
1626
- var jn = class {
1641
+ var Mn = class {
1627
1642
  canvas;
1628
1643
  elementRegistry;
1629
1644
  static $inject = [
@@ -1642,16 +1657,16 @@ var jn = class {
1642
1657
  });
1643
1658
  }
1644
1659
  reorder() {
1645
- let e = this.elementRegistry.getAll().filter(An).sort((e, t) => kn(e) - kn(t));
1660
+ let e = this.elementRegistry.getAll().filter(jn).sort((e, t) => An(e) - An(t));
1646
1661
  for (let t of e) {
1647
1662
  let e = this.canvas.getGraphics(t)?.parentNode, n = e?.parentNode;
1648
1663
  e && n && n.appendChild(e);
1649
1664
  }
1650
1665
  }
1651
- }, Mn = {
1666
+ }, Nn = {
1652
1667
  __init__: ["ttZOrder"],
1653
- ttZOrder: ["type", jn]
1654
- }, Nn = class extends K {
1668
+ ttZOrder: ["type", Mn]
1669
+ }, Pn = class extends K {
1655
1670
  _getModules() {
1656
1671
  return [
1657
1672
  ...super._getModules(),
@@ -1660,16 +1675,16 @@ var jn = class {
1660
1675
  le,
1661
1676
  ue,
1662
1677
  de,
1663
- on,
1678
+ sn,
1664
1679
  gt,
1665
1680
  yt,
1666
1681
  St,
1667
- tn,
1668
- un,
1669
- hn,
1670
- wn,
1671
- On,
1672
- Mn
1682
+ nn,
1683
+ dn,
1684
+ gn,
1685
+ Tn,
1686
+ kn,
1687
+ Nn
1673
1688
  ];
1674
1689
  }
1675
1690
  undo() {
@@ -1684,32 +1699,33 @@ var jn = class {
1684
1699
  canRedo() {
1685
1700
  return this.get("commandStack").canRedo();
1686
1701
  }
1687
- }, Pn = "team-topologies";
1688
- function Fn(e = {}) {
1689
- return zn(new Nn({
1690
- ...Ln(e),
1702
+ }, Fn = "team-topologies";
1703
+ function In(e = {}) {
1704
+ return Bn(new Pn({
1705
+ ...Rn(e),
1691
1706
  undoRedoKeys: e.undoRedoKeys ?? !0,
1707
+ freeArea: e.freeArea,
1692
1708
  freeRectCenter: e.freeRectCenter
1693
1709
  }), !0, e.fitOnImport ?? !0);
1694
1710
  }
1695
- function In(e = {}) {
1696
- return zn(new K(Ln(e)), !1, e.fitOnImport ?? !0);
1711
+ function Ln(e = {}) {
1712
+ return Bn(new K(Rn(e)), !1, e.fitOnImport ?? !0);
1697
1713
  }
1698
- function Ln(e) {
1714
+ function Rn(e) {
1699
1715
  return {
1700
1716
  width: "100%",
1701
1717
  height: "100%",
1702
1718
  additionalModules: e.additionalModules ?? []
1703
1719
  };
1704
1720
  }
1705
- function Rn(e) {
1721
+ function zn(e) {
1706
1722
  let t = ee(e.trim() === "" ? {} : JSON.parse(e));
1707
1723
  if (!t.ok) throw Error(t.error);
1708
1724
  return t.document;
1709
1725
  }
1710
- function zn(e, t, n) {
1726
+ function Bn(e, t, n) {
1711
1727
  let r = e.get("eventBus"), i = e.get("canvas"), a = e.get("elementRegistry"), o = e.get("selection"), s = /* @__PURE__ */ new Set(), c = 0, l = !1, u = "", d = {
1712
- notation: Pn,
1728
+ notation: Fn,
1713
1729
  apiVersion: Ce,
1714
1730
  editable: t
1715
1731
  };
@@ -1720,16 +1736,28 @@ function zn(e, t, n) {
1720
1736
  return {
1721
1737
  meta: d,
1722
1738
  elements: {
1723
- list: () => l ? [] : a.getAll().filter(T).map(Vn),
1739
+ list: () => l ? [] : a.getAll().filter(T).map(Hn),
1724
1740
  reveal(e) {
1725
1741
  if (l) return !1;
1726
1742
  let t = a.get(e);
1727
1743
  return T(t) ? (o.select(t), i.scrollToElement(t), !0) : !1;
1728
1744
  },
1729
- selection: () => l ? [] : Bn(o.get()),
1745
+ selection: () => l ? [] : Vn(o.get()),
1730
1746
  onSelection(e) {
1731
- let t = (t) => e(Bn(t.newSelection ?? []));
1747
+ let t = (t) => e(Vn(t.newSelection ?? []));
1732
1748
  return r.on("selection.changed", t), () => r.off("selection.changed", t);
1749
+ },
1750
+ bounds(e) {
1751
+ if (l) return;
1752
+ let t = a.get(e);
1753
+ if (!T(t)) return;
1754
+ let { x: n, y: r, width: i, height: o } = t;
1755
+ return {
1756
+ x: n,
1757
+ y: r,
1758
+ width: i,
1759
+ height: o
1760
+ };
1733
1761
  }
1734
1762
  },
1735
1763
  diagram: e,
@@ -1738,7 +1766,7 @@ function zn(e, t, n) {
1738
1766
  },
1739
1767
  async importText(t) {
1740
1768
  if (l) throw Error("The modeler was destroyed.");
1741
- let r = Rn(t);
1769
+ let r = zn(t);
1742
1770
  c += 1;
1743
1771
  try {
1744
1772
  let { warnings: t } = e.importDocument(r, { fit: n });
@@ -1761,13 +1789,13 @@ function zn(e, t, n) {
1761
1789
  width: n,
1762
1790
  height: r
1763
1791
  };
1764
- return Hn(a) ? a : void 0;
1792
+ return Un(a) ? a : void 0;
1765
1793
  } catch {
1766
1794
  return;
1767
1795
  }
1768
1796
  },
1769
1797
  setViewState(e) {
1770
- !l && Hn(e) && i.viewbox({
1798
+ !l && Un(e) && i.viewbox({
1771
1799
  x: e.x,
1772
1800
  y: e.y,
1773
1801
  width: e.width,
@@ -1786,17 +1814,17 @@ function zn(e, t, n) {
1786
1814
  }
1787
1815
  };
1788
1816
  }
1789
- function Bn(e) {
1817
+ function Vn(e) {
1790
1818
  return e.filter(T).map((e) => e.id);
1791
1819
  }
1792
- function Vn(e) {
1820
+ function Hn(e) {
1793
1821
  let t = e.ttLabel;
1794
1822
  return t ? {
1795
1823
  id: e.id,
1796
1824
  name: t
1797
1825
  } : { id: e.id };
1798
1826
  }
1799
- function Hn(e) {
1827
+ function Un(e) {
1800
1828
  if (typeof e != "object" || !e) return !1;
1801
1829
  let { x: t, y: n, width: r, height: i } = e;
1802
1830
  return $(t) && $(n) && $(r) && $(i) && r > 0 && i > 0;
@@ -1805,6 +1833,6 @@ function $(e) {
1805
1833
  return typeof e == "number" && Number.isFinite(e);
1806
1834
  }
1807
1835
  //#endregion
1808
- export { Te as CD_TOKENS, G as GEIST_UNICODE_RANGES, Mt as ICON_DOWNLOAD, Tt as ICON_LINK, jt as ICON_MAXIMIZE, Ot as ICON_MENU, Et as ICON_MESSAGE_SQUARE_PLUS, kt as ICON_MINUS, Ct as ICON_PENCIL, At as ICON_PLUS, Dt as ICON_SQUARE_DASHED_MOUSE_POINTER, wt as ICON_TRASH, Nt as ICON_X, j as MIRAGON, Nn as Modeler, K as NavigatedViewer, X as READ_ONLY_CHANGED_EVENT, N as ROOT_ID, Pn as TEAM_TOPOLOGIES_NOTATION, Ge as TeamTopologiesRenderer, xt as TtAssociationBehavior, Me as TtBaseViewer, ln as TtContextPadProvider, Ne as TtElementFactory, Xe as TtExporter, bt as TtFlatModelBehavior, Ye as TtImporter, Q as TtKeyboard, mn as TtLabelEditing, ht as TtLayouter, mt as TtModeling, en as TtPaletteProvider, an as TtReadOnly, vt as TtRules, rt as TtViewport, jn as TtZOrder, st as Viewer, Ut as annotationIconSvg, Fn as createCollaborativeModeler, In as createCollaborativeViewer, at as embedSvgStyles, Ht as flowIconSvg, it as geistFontFaceCss, J as iconMarkup, Gt as interactionIconSvg, ot as ioModule, k as isTtAnnotation, A as isTtAssociation, T as isTtElement, O as isTtFlow, D as isTtInteraction, E as isTtTeam, Rn as parseDocumentText, Ae as saveSVG, Vt as teamIconSvg, St as ttBehaviorsModule, un as ttContextPadModule, Je as ttDrawModule, wn as ttKeyboardModule, hn as ttLabelEditingModule, Pe as ttModelModule, gt as ttModelingModule, tn as ttPaletteModule, on as ttReadOnlyModule, yt as ttRulesModule, Mn as ttZOrderModule };
1836
+ export { Te as CD_TOKENS, G as GEIST_UNICODE_RANGES, Mt as ICON_DOWNLOAD, Tt as ICON_LINK, jt as ICON_MAXIMIZE, Ot as ICON_MENU, Et as ICON_MESSAGE_SQUARE_PLUS, kt as ICON_MINUS, Ct as ICON_PENCIL, At as ICON_PLUS, Dt as ICON_SQUARE_DASHED_MOUSE_POINTER, wt as ICON_TRASH, Nt as ICON_X, j as MIRAGON, Pn as Modeler, K as NavigatedViewer, X as READ_ONLY_CHANGED_EVENT, N as ROOT_ID, Fn as TEAM_TOPOLOGIES_NOTATION, Ge as TeamTopologiesRenderer, xt as TtAssociationBehavior, Me as TtBaseViewer, un as TtContextPadProvider, Ne as TtElementFactory, Xe as TtExporter, bt as TtFlatModelBehavior, Ye as TtImporter, Q as TtKeyboard, hn as TtLabelEditing, ht as TtLayouter, mt as TtModeling, tn as TtPaletteProvider, on as TtReadOnly, vt as TtRules, rt as TtViewport, Mn as TtZOrder, st as Viewer, Ut as annotationIconSvg, In as createCollaborativeModeler, Ln as createCollaborativeViewer, at as embedSvgStyles, Ht as flowIconSvg, it as geistFontFaceCss, J as iconMarkup, Gt as interactionIconSvg, ot as ioModule, k as isTtAnnotation, A as isTtAssociation, T as isTtElement, O as isTtFlow, D as isTtInteraction, E as isTtTeam, zn as parseDocumentText, Ae as saveSVG, Vt as teamIconSvg, St as ttBehaviorsModule, dn as ttContextPadModule, Je as ttDrawModule, Tn as ttKeyboardModule, gn as ttLabelEditingModule, Pe as ttModelModule, gt as ttModelingModule, nn as ttPaletteModule, sn as ttReadOnlyModule, yt as ttRulesModule, Nn as ttZOrderModule };
1809
1837
 
1810
1838
  //# sourceMappingURL=index.js.map