@likec4/core 1.45.0 → 1.46.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.
Files changed (64) hide show
  1. package/dist/builder/index.d.mts +8 -7
  2. package/dist/builder/index.mjs +8 -7
  3. package/dist/compute-view/index.d.mts +8 -7
  4. package/dist/compute-view/index.mjs +5 -5
  5. package/dist/compute-view/relationships-view/index.d.mts +8 -7
  6. package/dist/geometry/index.d.mts +109 -0
  7. package/dist/geometry/index.mjs +328 -0
  8. package/dist/index.d.mts +10 -8
  9. package/dist/index.mjs +9 -8
  10. package/dist/model/connection/deployment/index.d.mts +10 -9
  11. package/dist/model/connection/deployment/index.mjs +2 -2
  12. package/dist/model/connection/index.d.mts +11 -10
  13. package/dist/model/connection/index.mjs +3 -3
  14. package/dist/model/connection/model/index.d.mts +10 -9
  15. package/dist/model/connection/model/index.mjs +2 -2
  16. package/dist/model/index.d.mts +12 -11
  17. package/dist/model/index.mjs +4 -4
  18. package/dist/shared/{core.DnCLhN8C.d.mts → core.5gPDaaG5.d.mts} +5 -4
  19. package/dist/shared/{core.CQPEY2wQ.mjs → core.78IWAHAE.mjs} +1 -1
  20. package/dist/shared/{core.0zAQeenX.d.mts → core.9U0HL3oG.d.mts} +2 -2
  21. package/dist/shared/{core.DqlrMlsf.mjs → core.BFd1lU9R.mjs} +1 -1
  22. package/dist/shared/core.BPGOjone.d.mts +46 -0
  23. package/dist/shared/{core.DIE3F6sw.mjs → core.BYdtmqY5.mjs} +1 -2
  24. package/dist/shared/{core.B73yxfPi.d.mts → core.BkSYCfRg.d.mts} +1 -1
  25. package/dist/shared/{core.5ZQ-r3Oa.d.mts → core.BqtAzeAh.d.mts} +1 -1
  26. package/dist/shared/{core.DEieYfbG.mjs → core.BspBF3SJ.mjs} +22 -70
  27. package/dist/shared/{core.CR3PmPzr.mjs → core.CBLX4mT8.mjs} +3811 -15032
  28. package/dist/shared/{core.DX-WYEPA.d.mts → core.CDdf8izT.d.mts} +4 -2
  29. package/dist/shared/core.CLSZtnFh.mjs +69 -0
  30. package/dist/shared/{core.D_f4F48-.mjs → core.CRhT4Iio.mjs} +10 -7
  31. package/dist/shared/{core.DrUt0Lbi.mjs → core.CmGY9blO.mjs} +198 -291
  32. package/dist/shared/{core.C_Ni6yHl.mjs → core.D0WZutNd.mjs} +3 -1
  33. package/dist/shared/{core.mUnpvHtA.d.mts → core.DE-g9oFF.d.mts} +19 -49
  34. package/dist/shared/{core.M9ayqQZa.mjs → core.DEK-BO3_.mjs} +4 -5
  35. package/dist/shared/{core.CpURdWRM.d.mts → core.DK3pdsTf.d.mts} +8 -6
  36. package/dist/shared/{core.vzLtp8i3.mjs → core.DSalPD6v.mjs} +259 -189
  37. package/dist/shared/{core.CRI1AjFj.mjs → core.DVfPJPJj.mjs} +33 -30
  38. package/dist/shared/{core.Cog93roC.d.mts → core.DezoCAzf.d.mts} +3 -3
  39. package/dist/shared/{core.BGFjN3nv.d.mts → core.I8sCl3WM.d.mts} +3 -3
  40. package/dist/shared/{core.t3qfsVvn.d.mts → core.e5GJ61_a.d.mts} +3 -3
  41. package/dist/shared/{core.BuQZczj6.mjs → core.om36dXXW.mjs} +5 -2
  42. package/dist/shared/{core.Dvh1H0T2.d.mts → core.or6-EHsb.d.mts} +2 -2
  43. package/dist/shared/{core.DViDmiAu.mjs → core.xeuDd__E.mjs} +1 -2
  44. package/dist/shared/{core.CWwSgOzF.mjs → core.xgoPk2RG.mjs} +165 -135
  45. package/dist/styles/index.d.mts +7 -6
  46. package/dist/styles/index.mjs +1 -1
  47. package/dist/types/_aux.d.mts +2 -2
  48. package/dist/types/expression-model.d.mts +3 -3
  49. package/dist/types/expression.d.mts +3 -3
  50. package/dist/types/fqnRef.d.mts +2 -2
  51. package/dist/types/fqnRef.mjs +1 -1
  52. package/dist/types/index.d.mts +11 -9
  53. package/dist/types/index.mjs +6 -180
  54. package/dist/types/scalar.d.mts +1 -1
  55. package/dist/types/scalar.mjs +1 -1
  56. package/dist/utils/graphology/index.mjs +1 -1
  57. package/dist/utils/index.d.mts +3 -3
  58. package/dist/utils/index.mjs +5 -5
  59. package/dist/utils/iterable/index.d.mts +17 -1
  60. package/dist/utils/iterable/index.mjs +17 -1
  61. package/geometry/package.json +4 -0
  62. package/package.json +20 -12
  63. package/dist/shared/core.BR4zXDH-.mjs +0 -13
  64. package/dist/shared/core.BdPcbSkN.mjs +0 -118
@@ -1,37 +1,37 @@
1
- import { n as n$d, b as t$i, d as t$k, e as t$l, f as t$n, g as buildElementNotations, t as t$q } from './core.vzLtp8i3.mjs';
1
+ import { n as n$d, b as t$i, d as t$j, e as t$l, f as t$m, g as buildElementNotations, t as t$q } from './core.DSalPD6v.mjs';
2
2
  import { t as t$a, a as t$b } from './core.BsSXS-_R.mjs';
3
3
  import { t as t$e } from './core.CbT8JVYL.mjs';
4
- import { a as t$c, t as t$j, i as isElementModel, b as isNestedElementOfDeployedInstanceModel, c as isDeployedInstanceModel, d as isDeploymentNodeModel, e as isDeploymentElementModel, L as LikeC4Model } from './core.CRI1AjFj.mjs';
5
- import { c as commonHead, t as t$f, o as objectHash, b as t$m, a as compareRelations, S as Stack } from './core.DViDmiAu.mjs';
4
+ import { a as t$c, t as t$k, i as isElementModel, b as isNestedElementOfDeployedInstanceModel, c as isDeployedInstanceModel, d as isDeploymentNodeModel, e as isDeploymentElementModel, L as LikeC4Model } from './core.DVfPJPJj.mjs';
5
+ import { c as commonHead, t as t$f, o as objectHash, b as t$n, a as compareRelations, S as Stack } from './core.xeuDd__E.mjs';
6
6
  import { a as nonNullable, i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
7
- import { G as Graph } from './core.DrUt0Lbi.mjs';
8
- import { r as requireIterables, e as exact, t as t$o } from './core.M9ayqQZa.mjs';
9
- import { r as requireIterator } from './core.BdPcbSkN.mjs';
7
+ import { G as Graph } from './core.CmGY9blO.mjs';
8
+ import { r as requireIterables, e as exact, t as t$o } from './core.DEK-BO3_.mjs';
9
+ import { b as requireIterator } from './core.CBLX4mT8.mjs';
10
10
  import { g as getDefaultExportFromCjs } from './core.B85MJLTf.mjs';
11
11
  import { n as n$c, t as t$d } from './core.3ZhnKAlZ.mjs';
12
12
  import { e as e$4 } from './core.BKlholso.mjs';
13
- import { f as flattenMarkdownOrString, i as isGroupElementKind, G as GroupElementKind, d as stepEdgeId } from './core.C_Ni6yHl.mjs';
14
- import { b as isDescendantOf, f as sortParentsFirst, i as isAncestor, p as parentFqn, j as compareByFqnHierarchically, c as isNonEmptyArray, n as nameFromFqn, o as sortByFqnHierarchically, g as commonAncestor, a as ancestorsFqn, d as isSameHierarchy } from './core.CdNCAwq7.mjs';
13
+ import { f as flattenMarkdownOrString, i as isGroupElementKind, G as GroupElementKind, e as stepEdgeId } from './core.D0WZutNd.mjs';
14
+ import { b as isDescendantOf, f as sortParentsFirst, i as isAncestor, p as parentFqn, j as compareByFqnHierarchically, c as isNonEmptyArray, o as sortByFqnHierarchically, g as commonAncestor, a as ancestorsFqn, d as isSameHierarchy } from './core.CdNCAwq7.mjs';
15
15
  import { d as difference, i as intersection, u as union, h as hasIntersection } from './core.DbfO90vF.mjs';
16
- import { e as e$8 } from './core.Coi_LOUZ.mjs';
17
- import { n as n$e } from './core.BhNcrwzK.mjs';
18
- import { w as whereOperatorAsPredicate, m as isViewRuleStyle, v as t$g, l as isViewRulePredicate, a as _type, _ as _stage, u as e$b, t as isDynamicView, s as isDeploymentView, p as isElementView } from './core.DH7TXqXf.mjs';
16
+ import { e as e$9 } from './core.Coi_LOUZ.mjs';
17
+ import { w as whereOperatorAsPredicate, m as isViewRuleStyle, v as t$g, u as e$8, l as isViewRulePredicate, a as _type, _ as _stage, t as isDynamicView, s as isDeploymentView, p as isElementView } from './core.DH7TXqXf.mjs';
18
+ import { e as e$5, d as deploymentConnection, R as RelationshipsAccum, D as DeploymentConnectionModel } from './core.CRhT4Iio.mjs';
19
19
  import { e as e$6, a as iunique, i as iflat } from './core.C4x8aaWa.mjs';
20
- import { e as e$5, d as deploymentConnection, R as RelationshipsAccum, D as DeploymentConnectionModel } from './core.D_f4F48-.mjs';
21
20
  import { e as e$7 } from './core.BoYfZOBm.mjs';
22
21
  import { ModelFqnExpr, ModelRelationExpr, ModelExpression } from '../types/expression-model.mjs';
23
22
  import { FqnRef } from '../types/fqnRef.mjs';
24
23
  import { preferSummary } from '../types/_aux.mjs';
25
- import { a as t$h } from './core.DEieYfbG.mjs';
24
+ import { a as t$h } from './core.BspBF3SJ.mjs';
25
+ import { n as n$e } from './core.BhNcrwzK.mjs';
26
26
  import { FqnExpr, RelationExpr } from '../types/expression.mjs';
27
- import { f as findAscendingConnections, m as mergeConnections, d as differenceConnections, j as isNestedConnection, s as sortConnectionsByBoundaryHierarchy, o as findConnectionsBetween$3, p as findConnection$3, n as modelConnection, b as findDescendantConnections, a as findDeepestNestedConnection, i as isAnyInOut, k as isOutgoing, g as isIncoming, C as ConnectionModel } from './core.CQPEY2wQ.mjs';
27
+ import { f as findAscendingConnections, m as mergeConnections, d as differenceConnections, j as isNestedConnection, s as sortConnectionsByBoundaryHierarchy, o as findConnectionsBetween$3, p as findConnection$3, n as modelConnection, b as findDescendantConnections, a as findDeepestNestedConnection, i as isAnyInOut, k as isOutgoing, g as isIncoming, C as ConnectionModel } from './core.78IWAHAE.mjs';
28
28
  import { t as toSet, a as toArray, i as imap } from './core.C3JowhaZ.mjs';
29
29
  import { D as DefaultMap } from './core.BbE4y-yl.mjs';
30
30
  import { i as ifilter } from './core.DRJma0Ol.mjs';
31
- import { C as Connection, c as customInspectSymbol } from './core.DqlrMlsf.mjs';
31
+ import { C as Connection, c as customInspectSymbol } from './core.BFd1lU9R.mjs';
32
32
  import { i as isome } from './core.FZ305VYd.mjs';
33
- import { i as isIterable, e as e$9 } from './core.RfnaEmgA.mjs';
34
- import { j as e$a, c as isViewRuleAutoLayout, h as isViewRuleGroup, a as isViewRuleGlobalPredicateRef, i as isViewRuleGlobalStyle, e as isDynamicStepsParallel, f as isDynamicStepsSeries } from './core.BuQZczj6.mjs';
33
+ import { i as isIterable, e as e$a } from './core.RfnaEmgA.mjs';
34
+ import { k as e$b, c as isViewRuleAutoLayout, h as isViewRuleGroup, a as isViewRuleGlobalPredicateRef, i as isViewRuleGlobalStyle, e as isDynamicStepsParallel, f as isDynamicStepsSeries, j as isViewRuleRank } from './core.om36dXXW.mjs';
35
35
  import { t as t$p } from './core.q10OP9oJ.mjs';
36
36
 
37
37
  function e$3(e){return ()=>e}
@@ -1353,13 +1353,13 @@ function elementExprToPredicate(target) {
1353
1353
  nonexhaustive(target);
1354
1354
  }
1355
1355
 
1356
- function applyViewRuleStyle(rule, predicates, nodes) {
1356
+ function applyViewRuleStyle(rule, predicate, nodes) {
1357
1357
  const { shape, color, icon, ...rest } = rule.style;
1358
1358
  const nonEmptyStyle = !e$5(rest);
1359
1359
  t$d(
1360
1360
  nodes,
1361
1361
  n$d(e$7(isGroupElementKind)),
1362
- n$d(t$g(predicates)),
1362
+ n$d(predicate),
1363
1363
  t$7((n) => {
1364
1364
  n.shape = shape ?? n.shape;
1365
1365
  n.color = color ?? n.color;
@@ -1384,7 +1384,11 @@ function applyViewRuleStyles(rules, nodes) {
1384
1384
  continue;
1385
1385
  }
1386
1386
  const predicates = rule.targets.map(elementExprToPredicate);
1387
- applyViewRuleStyle(rule, predicates, nodes);
1387
+ applyViewRuleStyle(
1388
+ rule,
1389
+ t$g(predicates),
1390
+ nodes
1391
+ );
1388
1392
  }
1389
1393
  return nodes;
1390
1394
  }
@@ -1502,14 +1506,7 @@ function buildComputedNodes({ defaults }, elements, groups) {
1502
1506
  function pickRelationshipProps(relation) {
1503
1507
  const {
1504
1508
  title,
1505
- description = null,
1506
- technology = null,
1507
- kind = null,
1508
- color = null,
1509
- line = null,
1510
- head = null,
1511
- tail = null,
1512
- navigateTo = null
1509
+ description = null
1513
1510
  } = relation;
1514
1511
  return {
1515
1512
  // Pick description only if title is present
@@ -1517,13 +1514,7 @@ function pickRelationshipProps(relation) {
1517
1514
  title,
1518
1515
  description
1519
1516
  },
1520
- technology,
1521
- kind,
1522
- color,
1523
- line,
1524
- head,
1525
- tail,
1526
- navigateTo
1517
+ ...t$i(relation, ["color", "technology", "head", "line", "tail", "kind", "navigateTo"])
1527
1518
  };
1528
1519
  }
1529
1520
  function mergePropsFromRelationships(relations, prefer) {
@@ -1577,14 +1568,12 @@ function mergePropsFromRelationships(relations, prefer) {
1577
1568
  }
1578
1569
  )
1579
1570
  );
1580
- let technology = t$5(allprops.technology);
1581
- let title = t$5(allprops.title) ?? (allprops.title.length > 1 ? "[...]" : null);
1571
+ let title = t$5(allprops.title) ?? (allprops.title.length > 1 ? "[...]" : void 0);
1582
1572
  const tags = n$e(allprops.tags);
1583
1573
  let merged = exact({
1584
- // If there is no title, but there is technology, use technology as title
1585
- title: title ?? (technology ? `[${technology}]` : null),
1574
+ title,
1586
1575
  description: t$5(allprops.description),
1587
- technology,
1576
+ technology: t$5(allprops.technology),
1588
1577
  kind: t$5(allprops.kind),
1589
1578
  head: t$5(allprops.head),
1590
1579
  tail: t$5(allprops.tail),
@@ -1594,10 +1583,15 @@ function mergePropsFromRelationships(relations, prefer) {
1594
1583
  ...isNonEmptyArray(tags) && { tags }
1595
1584
  });
1596
1585
  if (prefer) {
1597
- return {
1586
+ const preferred = pickRelationshipProps(prefer);
1587
+ merged = t$3({
1598
1588
  ...merged,
1599
- ...t$3(pickRelationshipProps(prefer), e$4)
1600
- };
1589
+ ...preferred
1590
+ }, e$4);
1591
+ }
1592
+ if (e$8(merged.title) && e$4(merged.technology)) {
1593
+ merged.title = `[${merged.technology}]`;
1594
+ delete merged.technology;
1601
1595
  }
1602
1596
  return merged;
1603
1597
  }
@@ -1697,56 +1691,27 @@ function deploymentExpressionToPredicate(target) {
1697
1691
  function instanceSummary(model) {
1698
1692
  return preferSummary(model.$instance) ?? preferSummary(model.element.$element);
1699
1693
  }
1700
- function toNodeSource(el) {
1701
- if (el.isDeploymentNode()) {
1702
- const onlyOneInstance = el.onlyOneInstance();
1703
- let {
1704
- title,
1705
- id,
1706
- description: description2,
1707
- summary,
1708
- metadata: _metadata,
1709
- // omit
1710
- style: {
1711
- icon: icon2,
1712
- shape: shape2,
1713
- color: color2
1714
- },
1715
- element: _element,
1716
- // omit
1717
- tags: _tags,
1718
- // omit
1719
- ...$node
1720
- } = el.$node;
1721
- let tags = [...el.tags];
1722
- summary ??= description2;
1723
- if (onlyOneInstance) {
1724
- tags = n$e([...tags, ...onlyOneInstance.tags]);
1725
- if (title === nameFromFqn(el.id)) {
1726
- title = onlyOneInstance.title;
1727
- }
1728
- icon2 ??= onlyOneInstance.style.icon;
1729
- color2 ??= onlyOneInstance.style.color;
1730
- shape2 ??= onlyOneInstance.style.shape;
1731
- summary ??= instanceSummary(onlyOneInstance);
1732
- }
1733
- return exact({
1734
- id,
1735
- deploymentRef: id,
1736
- title,
1737
- ...$node,
1738
- color: color2 ?? el.color,
1739
- shape: shape2 ?? el.shape,
1740
- ...onlyOneInstance && {
1741
- modelRef: onlyOneInstance.element.id
1742
- },
1743
- icon: icon2,
1744
- description: summary,
1745
- tags,
1746
- style: n$6(el.style, ["icon", "shape", "color"])
1747
- });
1748
- }
1749
- invariant(el.isInstance(), "Expected Instance");
1694
+ function deploymentNodeToNodeSource(el) {
1695
+ const id = el.id;
1696
+ const onlyOneInstance = el.onlyOneInstance();
1697
+ return exact({
1698
+ id,
1699
+ deploymentRef: id,
1700
+ title: el.title,
1701
+ kind: el.kind,
1702
+ technology: el.technology ?? void 0,
1703
+ links: t$b(el.links, 1) ? [...el.links] : void 0,
1704
+ notation: el.$node.notation ?? void 0,
1705
+ color: el.color,
1706
+ shape: el.shape,
1707
+ modelRef: onlyOneInstance?.element.id,
1708
+ icon: el.style.icon,
1709
+ description: preferSummary(el.$node) ?? void 0,
1710
+ tags: [...el.tags],
1711
+ style: n$6(el.style, ["icon", "shape", "color"])
1712
+ });
1713
+ }
1714
+ function instanceToNodeSource(el) {
1750
1715
  const instance = el.$instance;
1751
1716
  const element = el.element;
1752
1717
  const { icon, color, shape, ...style } = el.style;
@@ -1754,15 +1719,12 @@ function toNodeSource(el) {
1754
1719
  ...element.links,
1755
1720
  ...instance.links ?? []
1756
1721
  ];
1757
- const notation = instance.notation ?? element.$element.notation;
1758
- const description = instanceSummary(el);
1759
- const technology = el.technology ?? void 0;
1760
1722
  return exact({
1761
1723
  id: el.id,
1762
1724
  kind: "instance",
1763
1725
  title: el.title,
1764
- description,
1765
- technology,
1726
+ description: instanceSummary(el) ?? void 0,
1727
+ technology: el.technology ?? void 0,
1766
1728
  tags: [...el.tags],
1767
1729
  links: t$b(links, 1) ? links : void 0,
1768
1730
  icon,
@@ -1771,9 +1733,15 @@ function toNodeSource(el) {
1771
1733
  style,
1772
1734
  deploymentRef: instance.id,
1773
1735
  modelRef: element.id,
1774
- notation
1736
+ notation: instance.notation
1775
1737
  });
1776
1738
  }
1739
+ function toNodeSource(el) {
1740
+ if (el.isInstance()) {
1741
+ return instanceToNodeSource(el);
1742
+ }
1743
+ return deploymentNodeToNodeSource(el);
1744
+ }
1777
1745
  function toComputedEdges$1(connections) {
1778
1746
  return connections.reduce((acc, e) => {
1779
1747
  const relations = [
@@ -1822,7 +1790,41 @@ function toComputedEdges$1(connections) {
1822
1790
  }, []);
1823
1791
  }
1824
1792
  function buildNodes$1(model, memory) {
1825
- return buildComputedNodes(model.$styles, [...memory.final].map(toNodeSource));
1793
+ const nodesMap = buildComputedNodes(model.$styles, [...memory.final].map(toNodeSource));
1794
+ for (const node of nodesMap.values()) {
1795
+ if (!node.deploymentRef || !node.modelRef || node.children.length > 0) {
1796
+ continue;
1797
+ }
1798
+ const deploymentNode = model.deployment.element(node.deploymentRef);
1799
+ const onlyOneInstance = deploymentNode.isDeploymentNode() && deploymentNode.onlyOneInstance();
1800
+ if (!onlyOneInstance) {
1801
+ continue;
1802
+ }
1803
+ if (node.title === deploymentNode.name) {
1804
+ node.title = onlyOneInstance.title;
1805
+ }
1806
+ node.description ??= instanceSummary(onlyOneInstance) ?? null;
1807
+ node.technology ??= onlyOneInstance.technology;
1808
+ if (e$5(node.tags)) {
1809
+ node.tags = [...onlyOneInstance.tags];
1810
+ }
1811
+ if ((!node.links || e$5(node.links)) && t$b(onlyOneInstance.links, 1)) {
1812
+ node.links = [...onlyOneInstance.links];
1813
+ }
1814
+ const defaults = model.$styles.defaults;
1815
+ if (node.shape === defaults.shape && node.shape !== onlyOneInstance.shape) {
1816
+ node.shape = onlyOneInstance.shape;
1817
+ node.notation = null;
1818
+ }
1819
+ if (node.color === defaults.color && node.color !== onlyOneInstance.color) {
1820
+ node.color = onlyOneInstance.color;
1821
+ node.notation = null;
1822
+ }
1823
+ if (!node.icon && onlyOneInstance.icon) {
1824
+ node.icon = onlyOneInstance.icon;
1825
+ }
1826
+ }
1827
+ return nodesMap;
1826
1828
  }
1827
1829
  function applyDeploymentViewRuleStyles(rules, nodes) {
1828
1830
  for (const rule of rules) {
@@ -1830,7 +1832,11 @@ function applyDeploymentViewRuleStyles(rules, nodes) {
1830
1832
  continue;
1831
1833
  }
1832
1834
  const predicates = rule.targets.map(deploymentExpressionToPredicate);
1833
- applyViewRuleStyle(rule, predicates, nodes);
1835
+ applyViewRuleStyle(
1836
+ rule,
1837
+ t$g(predicates),
1838
+ nodes
1839
+ );
1834
1840
  }
1835
1841
  return nodes;
1836
1842
  }
@@ -1849,17 +1855,17 @@ function findCrossBoundarySameSourceOrTarget(connections) {
1849
1855
  }
1850
1856
  t$d(
1851
1857
  sameRelationGroup,
1852
- t$l((conn) => [
1858
+ t$m((conn) => [
1853
1859
  { group: `$source-${conn.source.id}`, conn },
1854
1860
  { group: `$target-${conn.target.id}`, conn }
1855
1861
  ]),
1856
- t$k(e$8("group")),
1857
- t$j(),
1862
+ t$l(e$9("group")),
1863
+ t$k(),
1858
1864
  n$d(t$b(2)),
1859
1865
  t$7(
1860
1866
  // In each group, sort by hierarchy, first are deepest
1861
- t$i(
1862
- t$e(e$8("conn")),
1867
+ t$j(
1868
+ t$e(e$9("conn")),
1863
1869
  sortConnectionsByBoundaryHierarchy("desc"),
1864
1870
  // Drop first, as it is the deepest
1865
1871
  // Drop if boundary is same as previous
@@ -2021,7 +2027,7 @@ let StageInclude$1 = class StageInclude extends AbstractStageInclude {
2021
2027
  // filter(c => this._connections.some(c2 => c2.id === c.id)),
2022
2028
  t$7(({ source, target, boundary }) => {
2023
2029
  t$d(
2024
- t$m(
2030
+ t$n(
2025
2031
  [...toArray(source.ancestors()).reverse(), source],
2026
2032
  [...toArray(target.ancestors()).reverse(), target]
2027
2033
  ),
@@ -2282,7 +2288,7 @@ const DirectRelationPredicate = {
2282
2288
  }
2283
2289
  connections = t$d(
2284
2290
  sources,
2285
- t$l((source2) => {
2291
+ t$m((source2) => {
2286
2292
  const targets = resolveAscendingSiblings(source2);
2287
2293
  return findConnectionsBetween$2(source2, targets, dir);
2288
2294
  }),
@@ -2302,7 +2308,7 @@ const DirectRelationPredicate = {
2302
2308
  }
2303
2309
  connections = t$d(
2304
2310
  targets,
2305
- t$l((target2) => {
2311
+ t$m((target2) => {
2306
2312
  const sources = resolveAscendingSiblings(target2);
2307
2313
  return [...sources].flatMap((source2) => findConnection$2(source2, target2, dir));
2308
2314
  }),
@@ -2320,17 +2326,17 @@ const DirectRelationPredicate = {
2320
2326
  const isTarget = filterIncomingConnections(targets);
2321
2327
  connections = t$d(
2322
2328
  sources,
2323
- t$l((s) => findConnectionsBetween$2(s, targets, dir)),
2329
+ t$m((s) => findConnectionsBetween$2(s, targets, dir)),
2324
2330
  n$d((c) => isSource(c) && isTarget(c)),
2325
2331
  applyPredicate(where)
2326
2332
  );
2327
2333
  }
2328
2334
  }
2329
2335
  stage.addConnections(connections);
2330
- if (FqnExpr.isDeploymentRef(source) && e$9(source.selector)) {
2336
+ if (FqnExpr.isDeploymentRef(source) && e$a(source.selector)) {
2331
2337
  stage.addImplicit(model.element(source.ref.deployment));
2332
2338
  }
2333
- if (FqnExpr.isDeploymentRef(target) && e$9(target.selector)) {
2339
+ if (FqnExpr.isDeploymentRef(target) && e$a(target.selector)) {
2334
2340
  stage.addImplicit(model.element(target.ref.deployment));
2335
2341
  }
2336
2342
  return stage;
@@ -2565,7 +2571,7 @@ function applyPredicate(...args) {
2565
2571
  if (where === null) {
2566
2572
  return c;
2567
2573
  }
2568
- if (e$a(c)) {
2574
+ if (e$b(c)) {
2569
2575
  return c.map((x) => applyPredicate(x, where)).filter((x) => x.nonEmpty());
2570
2576
  }
2571
2577
  return c.update({
@@ -2578,7 +2584,7 @@ function applyElementPredicate(...args) {
2578
2584
  return (x) => applyElementPredicate(x, args[0]);
2579
2585
  }
2580
2586
  const [c, where] = args;
2581
- if (e$a(c)) {
2587
+ if (e$b(c)) {
2582
2588
  return c.filter((x) => applyElementPredicate(x, where));
2583
2589
  }
2584
2590
  return where?.(toFilterable(c, c)) ?? true;
@@ -2601,7 +2607,7 @@ function toFilterable(relationEndpoint, connectionEndpoint) {
2601
2607
  };
2602
2608
  }
2603
2609
  if (isNestedElementOfDeployedInstanceModel(relationEndpoint)) {
2604
- return t$n(relationEndpoint.element, ["tags", "kind"]);
2610
+ return t$i(relationEndpoint.element, ["tags", "kind"]);
2605
2611
  }
2606
2612
  if (isDeployedInstanceModel(relationEndpoint)) {
2607
2613
  return {
@@ -2610,7 +2616,7 @@ function toFilterable(relationEndpoint, connectionEndpoint) {
2610
2616
  };
2611
2617
  }
2612
2618
  if (isDeploymentNodeModel(relationEndpoint)) {
2613
- return t$n(relationEndpoint, ["tags", "kind"]);
2619
+ return t$i(relationEndpoint, ["tags", "kind"]);
2614
2620
  }
2615
2621
  nonexhaustive(relationEndpoint);
2616
2622
  }
@@ -2994,7 +3000,7 @@ function applyCustomElementProperties(_rules, _nodes) {
2994
3000
  textSize,
2995
3001
  description,
2996
3002
  ...rest
2997
- } = t$o(props, e$b);
3003
+ } = t$o(props, e$8);
2998
3004
  const style = exact({
2999
3005
  border,
3000
3006
  opacity,
@@ -3044,14 +3050,14 @@ function resolveGlobalRulesInElementView(rules, globals) {
3044
3050
  return rules.reduce((acc, rule) => {
3045
3051
  if (isViewRuleGlobalPredicateRef(rule)) {
3046
3052
  const globalPredicates = globals.predicates[rule.predicateId];
3047
- if (e$b(globalPredicates)) {
3053
+ if (e$8(globalPredicates)) {
3048
3054
  return acc;
3049
3055
  }
3050
3056
  return acc.concat(globalPredicates);
3051
3057
  }
3052
3058
  if (isViewRuleGlobalStyle(rule)) {
3053
3059
  const globalStyles = globals.styles[rule.styleId];
3054
- if (e$b(globalStyles)) {
3060
+ if (e$8(globalStyles)) {
3055
3061
  return acc;
3056
3062
  }
3057
3063
  return acc.concat(globalStyles);
@@ -3064,14 +3070,14 @@ function resolveGlobalRulesInDynamicView(rules, globals) {
3064
3070
  return rules.reduce((acc, rule) => {
3065
3071
  if (isViewRuleGlobalPredicateRef(rule)) {
3066
3072
  const globalPredicates = globals.dynamicPredicates[rule.predicateId];
3067
- if (e$b(globalPredicates)) {
3073
+ if (e$8(globalPredicates)) {
3068
3074
  return acc;
3069
3075
  }
3070
3076
  return acc.concat(globalPredicates);
3071
3077
  }
3072
3078
  if (isViewRuleGlobalStyle(rule)) {
3073
3079
  const globalStyles = globals.styles[rule.styleId];
3074
- if (e$b(globalStyles)) {
3080
+ if (e$8(globalStyles)) {
3075
3081
  return acc;
3076
3082
  }
3077
3083
  return acc.concat(globalStyles);
@@ -3133,7 +3139,7 @@ function elementsFromSteps(model, steps) {
3133
3139
  actors.push(target);
3134
3140
  }
3135
3141
  };
3136
- for (const step of t$l(steps, flattenSteps)) {
3142
+ for (const step of t$m(steps, flattenSteps)) {
3137
3143
  const source = model.element(step.source);
3138
3144
  const target = model.element(step.target);
3139
3145
  let sourceColumn = actors.indexOf(source);
@@ -3168,7 +3174,7 @@ function findRelations(source, target, currentViewId) {
3168
3174
  }
3169
3175
  const alltags = t$d(
3170
3176
  relationships,
3171
- t$l((r) => r.tags),
3177
+ t$m((r) => r.tags),
3172
3178
  n$e()
3173
3179
  );
3174
3180
  const tags = t$b(alltags, 1) ? alltags : void 0;
@@ -3181,7 +3187,7 @@ function findRelations(source, target, currentViewId) {
3181
3187
  if (!navigateTo) {
3182
3188
  navigateTo = t$d(
3183
3189
  relationships,
3184
- t$l(
3190
+ t$m(
3185
3191
  (r) => r.$relationship.navigateTo && r.$relationship.navigateTo !== currentViewId ? r.$relationship.navigateTo : []
3186
3192
  ),
3187
3193
  n$e(),
@@ -3453,7 +3459,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
3453
3459
  } of rules) {
3454
3460
  const description = _description ? { description: { txt: _description } } : {};
3455
3461
  const notes = _notes ? { notes: { txt: _notes } } : {};
3456
- const props = t$o(customprops, e$b);
3462
+ const props = t$o(customprops, e$8);
3457
3463
  const satisfies = relationExpressionToPredicates(expr);
3458
3464
  edges.forEach((edge, i) => {
3459
3465
  let source, target;
@@ -3471,7 +3477,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
3471
3477
  if (!source || !target) {
3472
3478
  return;
3473
3479
  }
3474
- if (satisfies({ source, target, ...t$n(edge, ["kind", "tags"]) })) {
3480
+ if (satisfies({ source, target, ...t$i(edge, ["kind", "tags"]) })) {
3475
3481
  edges[i] = {
3476
3482
  ...edge,
3477
3483
  ...props,
@@ -3614,7 +3620,7 @@ class StageInclude extends AbstractStageInclude {
3614
3620
  connections,
3615
3621
  t$7(({ source, target, boundary }) => {
3616
3622
  t$d(
3617
- t$m(
3623
+ t$n(
3618
3624
  [...toArray(source.ancestors()).reverse(), source],
3619
3625
  [...toArray(target.ancestors()).reverse(), target]
3620
3626
  ),
@@ -3779,7 +3785,7 @@ function findRedundantConnections(connections) {
3779
3785
  t$2((reducedConnections, connection, _, all) => {
3780
3786
  const descendants = findDescendantConnections(all, connection);
3781
3787
  const nestedRelations = union(
3782
- ...descendants.map(e$8("relations"))
3788
+ ...descendants.map(e$9("relations"))
3783
3789
  );
3784
3790
  let accum = intersection(connection.relations, nestedRelations);
3785
3791
  if (descendants.length > 0) {
@@ -4113,7 +4119,7 @@ const DirectRelationExprPredicate = {
4113
4119
  const sources = resolveElements(model, source);
4114
4120
  const connections2 = t$d(
4115
4121
  sources,
4116
- t$l(
4122
+ t$m(
4117
4123
  (source2) => t$d(
4118
4124
  source2,
4119
4125
  e(e$3(isBidirectional === true), {
@@ -4171,7 +4177,7 @@ const DirectRelationExprPredicate = {
4171
4177
  const targets = resolveElements(model, target);
4172
4178
  const connections2 = t$d(
4173
4179
  targets,
4174
- t$l(
4180
+ t$m(
4175
4181
  (target2) => t$d(
4176
4182
  target2,
4177
4183
  e(e$3(isBidirectional === true), {
@@ -4249,8 +4255,8 @@ const DirectRelationExprPredicate = {
4249
4255
  case (sourceIsWildcard && targetIsWildcard): {
4250
4256
  relations = t$d(
4251
4257
  memory.connections,
4252
- t$l(t$i(
4253
- e$8("relations"),
4258
+ t$m(t$j(
4259
+ e$9("relations"),
4254
4260
  ifilter(where),
4255
4261
  toArray()
4256
4262
  )),
@@ -4263,7 +4269,7 @@ const DirectRelationExprPredicate = {
4263
4269
  const sources = resolveElements(model, source);
4264
4270
  relations = t$d(
4265
4271
  sources,
4266
- t$l(
4272
+ t$m(
4267
4273
  (source2) => t$d(
4268
4274
  source2,
4269
4275
  e(e$3(isBidirectional === true), {
@@ -4283,7 +4289,7 @@ const DirectRelationExprPredicate = {
4283
4289
  const targets = resolveElements(model, target);
4284
4290
  relations = t$d(
4285
4291
  targets,
4286
- t$l(
4292
+ t$m(
4287
4293
  (target2) => t$d(
4288
4294
  target2,
4289
4295
  e(e$3(isBidirectional === true), {
@@ -4824,6 +4830,7 @@ function computeElementView(likec4model, {
4824
4830
  );
4825
4831
  const autoLayoutRule = t$8(rules, isViewRuleAutoLayout);
4826
4832
  const nodeNotations = buildElementNotations(nodes);
4833
+ const ranks = collectRankConstraints(rules, nodes);
4827
4834
  return calcViewLayoutHash({
4828
4835
  ...view,
4829
4836
  _stage: "computed",
@@ -4843,9 +4850,32 @@ function computeElementView(likec4model, {
4843
4850
  notation: {
4844
4851
  nodes: nodeNotations
4845
4852
  }
4846
- }
4853
+ },
4854
+ ...ranks.length > 0 && { ranks }
4847
4855
  });
4848
4856
  }
4857
+ function collectRankConstraints(rules, nodes) {
4858
+ const constraints = [];
4859
+ for (const rule of rules) {
4860
+ if (!isViewRuleRank(rule) || rule.targets.length === 0) {
4861
+ continue;
4862
+ }
4863
+ const isTargeted = t$g(rule.targets.map(elementExprToPredicate));
4864
+ const nodesInRank = t$d(
4865
+ nodes,
4866
+ n$d(isTargeted),
4867
+ t$e((n) => n.id)
4868
+ );
4869
+ if (!t$b(nodesInRank, 1)) {
4870
+ continue;
4871
+ }
4872
+ constraints.push({
4873
+ type: rule.rank,
4874
+ nodes: nodesInRank
4875
+ });
4876
+ }
4877
+ return constraints;
4878
+ }
4849
4879
  function assignElementsToGroups(memory) {
4850
4880
  if (memory.groups.length === 0) {
4851
4881
  return memory;
@@ -1,13 +1,14 @@
1
- import { T as Tag } from '../shared/core.DX-WYEPA.mjs';
2
- import { T as TagSpecification } from '../shared/core.mUnpvHtA.mjs';
3
- import { G as ColorLiteral, c as ThemeColorValues, b as LikeC4StyleDefaults, E as ElementColorValues, R as RelationshipColorValues } from '../shared/core.0zAQeenX.mjs';
4
- export { B as BorderStyle, z as BorderStyles, C as Color, U as CustomColor, Q as CustomColorDefinitions, h as ElementShape, D as ElementShapes, H as HexColor, L as LikeC4StylesConfig, a as LikeC4Theme, g as RelationshipArrowType, I as RelationshipArrowTypes, f as RelationshipLineType, e as ShapeSize, y as Size, x as Sizes, S as SpacingSize, d as TextSize, T as ThemeColor, J as ThemeColors, V as isCustomColor, M as isThemeColor } from '../shared/core.0zAQeenX.mjs';
5
- export { L as LikeC4Styles } from '../shared/core.Dvh1H0T2.mjs';
1
+ import { T as Tag } from '../shared/core.CDdf8izT.mjs';
2
+ import { T as TagSpecification } from '../shared/core.DE-g9oFF.mjs';
3
+ import { G as ColorLiteral, c as ThemeColorValues, b as LikeC4StyleDefaults, E as ElementColorValues, R as RelationshipColorValues } from '../shared/core.9U0HL3oG.mjs';
4
+ export { B as BorderStyle, z as BorderStyles, C as Color, U as CustomColor, Q as CustomColorDefinitions, h as ElementShape, D as ElementShapes, H as HexColor, L as LikeC4StylesConfig, a as LikeC4Theme, g as RelationshipArrowType, I as RelationshipArrowTypes, f as RelationshipLineType, e as ShapeSize, y as Size, x as Sizes, S as SpacingSize, d as TextSize, T as ThemeColor, J as ThemeColors, V as isCustomColor, M as isThemeColor } from '../shared/core.9U0HL3oG.mjs';
5
+ export { L as LikeC4Styles } from '../shared/core.or6-EHsb.mjs';
6
6
  import 'type-fest';
7
- import '../shared/core.B73yxfPi.mjs';
7
+ import '../shared/core.BkSYCfRg.mjs';
8
8
  import '../shared/core.DB0Ue5Wx.mjs';
9
9
  import '../types/fqnRef.mjs';
10
10
  import '../types/expression-model.mjs';
11
+ import '../shared/core.BPGOjone.mjs';
11
12
 
12
13
  /**
13
14
  * Colors are taken from the styles presets of the LikeC4 (Radix Colors)
@@ -6,7 +6,7 @@ import { t as t$6 } from '../shared/core.CbT8JVYL.mjs';
6
6
  import { t as t$1 } from '../shared/core.BsSXS-_R.mjs';
7
7
  import { t as t$4 } from '../shared/core.BkVA6gjl.mjs';
8
8
  import { a as nonNullable } from '../shared/core.D4npX2q8.mjs';
9
- export { B as BorderStyles, E as ElementShapes, L as LikeC4Styles, R as RelationshipArrowTypes, S as Sizes, T as ThemeColors, c as computeColorValues, b as defaultTheme, f as isCustomColor, i as isThemeColor, s as styleDefaults } from '../shared/core.DEieYfbG.mjs';
9
+ export { B as BorderStyles, E as ElementShapes, L as LikeC4Styles, R as RelationshipArrowTypes, S as Sizes, T as ThemeColors, c as computeColorValues, d as defaultTheme, b as isCustomColor, i as isThemeColor, s as styleDefaults } from '../shared/core.BspBF3SJ.mjs';
10
10
 
11
11
  function t(...t){return t$1(n,t)}function n(e,t,n){let r={};for(let[i,a]of e.entries()){let o=t(a,i,e);r[o]=n(a,i,e);}return r}
12
12
 
@@ -1,4 +1,4 @@
1
1
  import 'type-fest';
2
2
  import '../shared/core.DB0Ue5Wx.mjs';
3
- export { q as AllKinds, A as Any, A as AnyAux, b as AnyComputed, c as AnyLayouted, $ as AnyOnStage, d as AnyParsed, Z as AnySpec, e as Aux, x as DeploymentFqn, D as DeploymentId, y as DeploymentKind, z as EdgeId, a as ElementId, E as ElementKind, F as Fqn, O as LooseDeploymentId, ae as LooseDeploymentKind, K as LooseElementId, ad as LooseElementKind, L as LooseLiteral, af as LooseRelationKind, I as LooseTag, ac as LooseTags, X as LooseViewId, H as Metadata, C as MetadataKey, B as Never, N as NodeId, ab as OrString, a0 as PickByStage, P as ProjectId, J as RelationId, R as RelationKind, a4 as Spec, f as SpecAux, Q as Stage, x as StrictDeploymentFqn, a8 as StrictDeploymentKind, a7 as StrictElementKind, F as StrictFqn, a5 as StrictProjectId, a9 as StrictRelationKind, a6 as StrictTag, S as StrictViewId, T as Tag, r as Tags, U as Unknown, g as UnknownComputed, h as UnknownLayouted, i as UnknownParsed, V as ViewId, W as WithDescriptionAndTech, aa as WithLinks, v as WithMetadata, w as WithNotation, u as WithOptionalLinks, s as WithOptionalTags, G as WithTags, p as preferDescription, j as preferSummary, Y as setProject, a1 as setStage, t as toComputed, a3 as toLayouted, a2 as toParsed } from '../shared/core.B73yxfPi.mjs';
4
- import '../shared/core.DX-WYEPA.mjs';
3
+ export { q as AllKinds, A as Any, A as AnyAux, b as AnyComputed, c as AnyLayouted, $ as AnyOnStage, d as AnyParsed, Z as AnySpec, e as Aux, x as DeploymentFqn, D as DeploymentId, y as DeploymentKind, z as EdgeId, a as ElementId, E as ElementKind, F as Fqn, O as LooseDeploymentId, ae as LooseDeploymentKind, K as LooseElementId, ad as LooseElementKind, L as LooseLiteral, af as LooseRelationKind, I as LooseTag, ac as LooseTags, X as LooseViewId, H as Metadata, C as MetadataKey, B as Never, N as NodeId, ab as OrString, a0 as PickByStage, P as ProjectId, J as RelationId, R as RelationKind, a4 as Spec, f as SpecAux, Q as Stage, x as StrictDeploymentFqn, a8 as StrictDeploymentKind, a7 as StrictElementKind, F as StrictFqn, a5 as StrictProjectId, a9 as StrictRelationKind, a6 as StrictTag, S as StrictViewId, T as Tag, r as Tags, U as Unknown, g as UnknownComputed, h as UnknownLayouted, i as UnknownParsed, V as ViewId, W as WithDescriptionAndTech, aa as WithLinks, v as WithMetadata, w as WithNotation, u as WithOptionalLinks, s as WithOptionalTags, G as WithTags, p as preferDescription, j as preferSummary, Y as setProject, a1 as setStage, t as toComputed, a3 as toLayouted, a2 as toParsed } from '../shared/core.BkSYCfRg.mjs';
4
+ import '../shared/core.CDdf8izT.mjs';
@@ -1,8 +1,8 @@
1
- import { W as WhereOperator, C as Color, f as RelationshipLineType, g as RelationshipArrowType, P as PredicateSelector, h as ElementShape, B as BorderStyle, e as ShapeSize } from '../shared/core.0zAQeenX.mjs';
2
- import { A as Any, S as StrictViewId, E as ElementKind, T as Tag } from '../shared/core.B73yxfPi.mjs';
1
+ import { W as WhereOperator, C as Color, f as RelationshipLineType, g as RelationshipArrowType, P as PredicateSelector, h as ElementShape, B as BorderStyle, e as ShapeSize } from '../shared/core.9U0HL3oG.mjs';
2
+ import { A as Any, S as StrictViewId, E as ElementKind, T as Tag } from '../shared/core.BkSYCfRg.mjs';
3
3
  import { E as ExclusiveUnion } from '../shared/core.DB0Ue5Wx.mjs';
4
4
  import { FqnRef } from './fqnRef.mjs';
5
- import { M as MarkdownOrString, I as Icon } from '../shared/core.DX-WYEPA.mjs';
5
+ import { M as MarkdownOrString, I as Icon } from '../shared/core.CDdf8izT.mjs';
6
6
  import 'type-fest';
7
7
 
8
8
  type AnyAux = Any;