@likec4/core 1.32.1 → 1.33.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.
Files changed (101) hide show
  1. package/dist/builder/index.d.mts +10 -6
  2. package/dist/builder/index.mjs +45 -13
  3. package/dist/compute-view/index.d.mts +6 -4
  4. package/dist/compute-view/index.mjs +33 -10
  5. package/dist/compute-view/relationships-view/index.d.mts +6 -4
  6. package/dist/compute-view/relationships-view/index.mjs +6 -3
  7. package/dist/index.d.mts +9 -138
  8. package/dist/index.mjs +31 -3712
  9. package/dist/model/connection/deployment/index.d.mts +10 -0
  10. package/dist/model/connection/deployment/index.mjs +18 -0
  11. package/dist/model/connection/index.d.mts +70 -0
  12. package/dist/model/connection/index.mjs +23 -0
  13. package/dist/model/connection/model/index.d.mts +10 -0
  14. package/dist/model/connection/model/index.mjs +11 -0
  15. package/dist/model/index.d.mts +14 -256
  16. package/dist/model/index.mjs +27 -5
  17. package/dist/shared/{core.DXzRBkuI.d.mts → core.1pNeDdRk.d.mts} +92 -81
  18. package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
  19. package/dist/shared/core.8KM0D6va.mjs +33 -0
  20. package/dist/shared/core.B0oEIXqd.mjs +47 -0
  21. package/dist/shared/core.BH9nN-_I.mjs +22 -0
  22. package/dist/shared/core.BMCb0wJI.mjs +177 -0
  23. package/dist/shared/core.BTnf14gD.mjs +331 -0
  24. package/dist/shared/core.BgvIuGGU.mjs +3 -0
  25. package/dist/shared/core.BoyJPEen.mjs +21 -0
  26. package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
  27. package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
  28. package/dist/shared/core.ByrmCl9I.mjs +5 -0
  29. package/dist/shared/core.C80Z37Eu.mjs +29 -0
  30. package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
  31. package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
  32. package/dist/shared/core.CeQbbp7K.d.mts +41 -0
  33. package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
  34. package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
  35. package/dist/shared/core.CxGKeL-L.mjs +144 -0
  36. package/dist/shared/core.CzdwsPmY.d.mts +69 -0
  37. package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
  38. package/dist/shared/core.D56nCp7e.mjs +168 -0
  39. package/dist/shared/core.D5qVzkws.mjs +724 -0
  40. package/dist/shared/core.DDAPzd3T.d.mts +87 -0
  41. package/dist/shared/{core.CBpKAlhj.mjs → core.DDynPqbh.mjs} +96 -56
  42. package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
  43. package/dist/shared/core.DcS-0zys.mjs +10 -0
  44. package/dist/shared/{core.BaYE_r29.d.mts → core.De___iBS.d.mts} +4 -3
  45. package/dist/shared/core.DsMrjY2q.mjs +34 -0
  46. package/dist/shared/core.DuSLYTG6.d.mts +57 -0
  47. package/dist/shared/core.Dy-F3xRP.d.mts +83 -0
  48. package/dist/shared/{core.znRaUX_A.d.mts → core.OLInHaJx.d.mts} +48 -41
  49. package/dist/shared/core.XptQjhMA.mjs +1295 -0
  50. package/dist/shared/{core.cbA9VZ02.mjs → core.hoq9W4rW.mjs} +28 -1073
  51. package/dist/shared/core.zLlww-07.mjs +3 -0
  52. package/dist/theme/index.d.mts +134 -0
  53. package/dist/theme/index.mjs +3709 -0
  54. package/dist/types/aux.d.mts +3 -2
  55. package/dist/types/index.d.mts +9 -5
  56. package/dist/types/index.mjs +17 -146
  57. package/dist/utils/index.d.mts +16 -100
  58. package/dist/utils/index.mjs +25 -1312
  59. package/dist/utils/iterable/index.d.mts +100 -0
  60. package/dist/utils/iterable/index.mjs +24 -0
  61. package/package.json +26 -10
  62. package/src/builder/Builder.ts +13 -4
  63. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
  64. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
  65. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
  66. package/src/builder/_types.ts +6 -2
  67. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
  68. package/src/compute-view/deployment-view/utils.ts +13 -13
  69. package/src/compute-view/dynamic-view/compute.ts +2 -1
  70. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
  71. package/src/compute-view/relationships-view/layout.ts +1 -1
  72. package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
  73. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  74. package/src/compute-view/utils/buildComputedNodes.ts +4 -3
  75. package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
  76. package/src/compute-view/utils/view-hash.ts +24 -3
  77. package/src/model/DeploymentElementModel.ts +22 -18
  78. package/src/model/ElementModel.ts +14 -10
  79. package/src/model/RelationModel.ts +21 -21
  80. package/src/model/index.ts +4 -0
  81. package/src/model/types.ts +11 -0
  82. package/src/model/view/EdgeModel.ts +6 -5
  83. package/src/model/view/LikeC4ViewModel.ts +10 -4
  84. package/src/model/view/NodeModel.ts +6 -4
  85. package/src/theme/index.ts +12 -5
  86. package/src/types/RichText.ts +200 -0
  87. package/src/types/aux.ts +1 -1
  88. package/src/types/index.ts +2 -0
  89. package/src/types/model-deployment.ts +4 -3
  90. package/src/types/model-logical.ts +3 -3
  91. package/src/types/scalar.ts +47 -2
  92. package/src/types/view-common.ts +1 -1
  93. package/src/types/view-computed.ts +2 -4
  94. package/src/types/view-layouted.ts +9 -0
  95. package/src/types/view-parsed.deployment.ts +0 -1
  96. package/src/types/view.ts +0 -27
  97. package/src/utils/index.ts +5 -10
  98. package/src/utils/markdown/index.ts +2 -0
  99. package/src/utils/markdown/to-html.ts +32 -0
  100. package/src/utils/markdown/to-text.ts +14 -0
  101. package/src/utils/promises.ts +4 -0
@@ -0,0 +1,87 @@
1
+ import { C as Connection, c as customInspectSymbol } from './core.CeQbbp7K.mjs';
2
+ import { e as DeploymentElementModel, i as RelationshipsAccum, D as DeploymentNodeModel, R as RelationshipModel, b as DeploymentRelationModel } from './core.OLInHaJx.mjs';
3
+ import { A as Any, B as EdgeId } from './core.De___iBS.mjs';
4
+ import { I as IteratorLike } from './core.DuSLYTG6.mjs';
5
+
6
+ /**
7
+ * Connection is ephemeral entity, result of a resolving relationships between source and target.
8
+ * Includes direct relationships and/or between their nested elements.
9
+ */
10
+ declare class DeploymentConnectionModel<A extends Any = Any> implements Connection<DeploymentElementModel<A>, EdgeId> {
11
+ readonly source: DeploymentElementModel<A>;
12
+ readonly target: DeploymentElementModel<A>;
13
+ readonly relations: RelationshipsAccum<A>;
14
+ readonly id: EdgeId;
15
+ constructor(source: DeploymentElementModel<A>, target: DeploymentElementModel<A>, relations: RelationshipsAccum<A>);
16
+ /**
17
+ * Human readable expression of the connection
18
+ * Mostly used for testing and debugging
19
+ */
20
+ get expression(): string;
21
+ private _boundary;
22
+ /**
23
+ * Common ancestor of the source and target elements.
24
+ * Represents the boundary of the connection.
25
+ */
26
+ get boundary(): DeploymentNodeModel<A> | null;
27
+ nonEmpty(): boolean;
28
+ [customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
29
+ toString(): string;
30
+ /**
31
+ * Check if connection contains deployment relation,
32
+ * that is directly connected to source or target.
33
+ */
34
+ hasDirectDeploymentRelation(): boolean;
35
+ values(): IteratorLike<RelationshipModel<A> | DeploymentRelationModel<A>>;
36
+ /**
37
+ * Merge with another connections, if it has the same source and target.
38
+ * Returns new connection with union of relationships.
39
+ */
40
+ mergeWith(others: DeploymentConnectionModel<A>[]): DeploymentConnectionModel<A>;
41
+ /**
42
+ * Merge with another connection, if it has the same source and target.
43
+ * Returns new connection with union of relationships.
44
+ */
45
+ mergeWith(other: DeploymentConnectionModel<A>): DeploymentConnectionModel<A>;
46
+ difference(other: DeploymentConnectionModel<A>): DeploymentConnectionModel<A>;
47
+ intersect(other: DeploymentConnectionModel<A>): DeploymentConnectionModel<A>;
48
+ equals(other: Connection): boolean;
49
+ /**
50
+ * Creates a clone of the current `DeploymentConnectionModel` instance with optional overrides.
51
+ * if `null` is provided in overrides, the corresponding relation set will be empty.
52
+ */
53
+ update(overrides?: {
54
+ model?: ReadonlySet<RelationshipModel<A>> | null;
55
+ deployment?: ReadonlySet<DeploymentRelationModel<A>> | null;
56
+ }): DeploymentConnectionModel<A>;
57
+ }
58
+
59
+ /**
60
+ * Resolve connection from source to target
61
+ * If direction is `both`, also look for reverse connection
62
+ *
63
+ * @default direction directed
64
+ */
65
+ declare function findConnection<M extends Any>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'directed'): readonly [DeploymentConnectionModel<M>] | readonly [];
66
+ declare function findConnection<M extends Any>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
67
+ declare function findConnection<M extends Any>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction?: 'directed' | 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
68
+ /**
69
+ * Resolve all connections between element and others
70
+ * By default, look for both directions.
71
+ *
72
+ * @default direction both
73
+ */
74
+ declare function findConnectionsBetween<M extends Any>(element: DeploymentElementModel<M>, others: Iterable<DeploymentElementModel<NoInfer<M>>>, direction?: 'directed' | 'both'): readonly DeploymentConnectionModel<M>[];
75
+ /**
76
+ * Resolve all connections within a given set of elements
77
+ */
78
+ declare function findConnectionsWithin<M extends Any>(elements: Iterable<DeploymentElementModel<M>>): readonly DeploymentConnectionModel<M>[];
79
+
80
+ declare const find_findConnection: typeof findConnection;
81
+ declare const find_findConnectionsBetween: typeof findConnectionsBetween;
82
+ declare const find_findConnectionsWithin: typeof findConnectionsWithin;
83
+ declare namespace find {
84
+ export { find_findConnection as findConnection, find_findConnectionsBetween as findConnectionsBetween, find_findConnectionsWithin as findConnectionsWithin };
85
+ }
86
+
87
+ export { DeploymentConnectionModel as D, findConnection as a, findConnectionsBetween as b, findConnectionsWithin as c, find as f };
@@ -1,12 +1,22 @@
1
- import { a as a$4, p as p$1, t as t$3, i as i$a, f as findAscendingConnections, m as mergeConnections, C as Connection, b as t$4, d as deploymentConnection, c as differenceConnections, R as RelationshipsAccum, e as isNestedConnection, D as DeploymentConnectionModel, s as sortConnectionsByBoundaryHierarchy, r as r$3, g as customInspectSymbol, h as findConnectionsBetween$3, j as isElementModel, k as isNestedElementOfDeployedInstanceModel, l as isDeployedInstanceModel, n as isDeploymentNodeModel, o as isDeploymentElementModel, q as modelConnection, u as findDescendantConnections, v as findDeepestNestedConnection, w as isAnyInOut, x as isOutgoing, y as isIncoming, z as ConnectionModel, L as LikeC4Model } from './core.cbA9VZ02.mjs';
1
+ import { n as a$4, t as t$3, r as r$3, j as isElementModel, f as isNestedElementOfDeployedInstanceModel, d as isDeployedInstanceModel, i as isDeploymentNodeModel, e as isDeploymentElementModel, L as LikeC4Model } from './core.hoq9W4rW.mjs';
2
2
  import { u as u$6 } from './core.DbRvwARP.mjs';
3
- import { m as m$2, d as difference, a as intersection, b as isome, u as union, i as i$b, h as hasIntersection } from './core.DoK86JEe.mjs';
4
- import { e as a$3, C, f as s, g as getDefaultExportFromCjs, b as ifilter, i as isDescendantOf, s as sortParentsFirst, D as DefaultMap, a as isAncestor, p as parentFqn, h as compareByFqnHierarchically, c as isNonEmptyArray, n as nameFromFqn, j as sortByFqnHierarchically, k as commonAncestor, l as ancestorsFqn, d as isSameHierarchy } from './core.rmvsy0n3.mjs';
5
- import { c as commonHead, r as requireForeach, a as requireIterator, u as u$7, o as objectHash, i as isIterable, n as n$3, d as d$5, l as l$6, S as Stack, b as iunique, e as iflat } from './core.CpXlRyE5.mjs';
6
- import { n as nonNullable, i as invariant, a as nonexhaustive } from './core.Cy9smucx.mjs';
7
- import { c as n$2, w as whereOperatorAsPredicate, F as FqnRef, y, o as o$7, e as isGroupElementKind, G as GroupElementKind, D as DefaultElementShape, a as DefaultThemeColor, f as DefaultArrowType, _ as _type, b as _stage, n as n$4, s as stepEdgeId, g as DefaultLineStyle, h as DefaultRelationshipColor } from './core.CUYDgv2-.mjs';
8
- import { M as ModelFqnExpr, b as isViewRuleStyle, F as FqnExpr, R as RelationExpr, o as o$8, c as isViewRulePredicate, d as isViewRuleAutoLayout, e as isViewRuleGroup, f as isViewRuleGlobalPredicateRef, g as isViewRuleGlobalStyle, h as isDynamicViewParallelSteps, j as ModelRelationExpr, k as ModelExpression, l as isDynamicView, m as isDeploymentView, a as isElementView } from './core.Bk7wEZFG.mjs';
9
- import { t as toSet, a as toArray, i as imap } from './core.BrCnZFTn.mjs';
3
+ import { m as m$2 } from './core.ByrmCl9I.mjs';
4
+ import { i as i$a, t as t$4, n as n$3, d as deploymentConnection, R as RelationshipsAccum, D as DeploymentConnectionModel } from './core.D5qVzkws.mjs';
5
+ import { p as p$1, f as findAscendingConnections, m as mergeConnections, d as differenceConnections, j as isNestedConnection, s as sortConnectionsByBoundaryHierarchy, o as findConnectionsBetween$3, n as modelConnection, b as findDescendantConnections, a as findDeepestNestedConnection, i as isAnyInOut, k as isOutgoing, g as isIncoming, C as ConnectionModel } from './core.BTnf14gD.mjs';
6
+ import { u as a$3, C, t as s, r as getDefaultExportFromCjs, j as isDescendantOf, m as sortParentsFirst, i as isAncestor, p as parentFqn, e as compareByFqnHierarchically, o as isNonEmptyArray, n as nameFromFqn, s as sortByFqnHierarchically, d as commonAncestor, b as ancestorsFqn, k as isSameHierarchy } from './core.C_C-3c1S.mjs';
7
+ import { c as commonHead, r as requireForeach, a as requireIterator, u as u$7, o as objectHash, d as d$5, S as Stack } from './core.CtKXPqN_.mjs';
8
+ import { a as nonNullable, i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
9
+ import { n as n$1, a as DefaultElementShape, D as DefaultThemeColor, f as DefaultArrowType, e as DefaultLineStyle, g as DefaultRelationshipColor } from './core.D56nCp7e.mjs';
10
+ import { d as difference, a as intersection, u as union, i as i$b, h as hasIntersection } from './core.CpwrZi3D.mjs';
11
+ import { a as isIterable, n as n$2, l as l$6, b as iunique, i as iflat } from './core.8KM0D6va.mjs';
12
+ import { o as o$7 } from './core.BgvIuGGU.mjs';
13
+ import { w as whereOperatorAsPredicate, F as FqnRef, y, m as isGroupElementKind, G as GroupElementKind, a as _type, _ as _stage, t as n$4, p as stepEdgeId } from './core.Br7Fab9l.mjs';
14
+ import { M as ModelFqnExpr, c as isViewRuleStyle, F as FqnExpr, R as RelationExpr, s as o$8, i as isViewRulePredicate, o as isViewRuleAutoLayout, r as isViewRuleGroup, m as isViewRuleGlobalPredicateRef, l as isViewRuleGlobalStyle, q as isDynamicViewParallelSteps, a as ModelRelationExpr, b as ModelExpression, k as isDynamicView, j as isDeploymentView, f as isElementView } from './core.DXRAwwDB.mjs';
15
+ import { a as toSet, t as toArray, i as imap } from './core.Btl47GOn.mjs';
16
+ import { D as DefaultMap } from './core.BMCb0wJI.mjs';
17
+ import { i as ifilter } from './core.BH9nN-_I.mjs';
18
+ import { C as Connection, c as customInspectSymbol } from './core.C80Z37Eu.mjs';
19
+ import { i as isome } from './core.BoyJPEen.mjs';
10
20
 
11
21
  function d$4(...e){return e.length===2?(n,...r)=>t$2(n,...e,...r):t$2(...e)}var t$2=(e,n,r,...a)=>n(e,...a)?typeof r=="function"?r(e,...a):r.onTrue(e,...a):typeof r=="function"?e:r.onFalse(e,...a);
12
22
 
@@ -30,9 +40,7 @@ function l$2(...n){return u$6(d,n)}function d(n,o){let e={};for(let[a,t]of n.ent
30
40
 
31
41
  function i$5(...e){return u$6(o$4,e)}function o$4(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
32
42
 
33
- function a$2(...e){return u$6(n$1,e)}var n$1=e=>e.at(-1);
34
-
35
- function n(e){return e===void 0?true:typeof e=="string"||Array.isArray(e)?e.length===0:Object.keys(e).length===0}
43
+ function a$2(...e){return u$6(n,e)}var n=e=>e.at(-1);
36
44
 
37
45
  function e(o){return typeof o=="boolean"}
38
46
 
@@ -1260,12 +1268,33 @@ function calcViewLayoutHash(view) {
1260
1268
  autoLayout: view.autoLayout,
1261
1269
  nodes: C(
1262
1270
  view.nodes,
1263
- m$2(i$8(["id", "title", "description", "technology", "shape", "icon", "children"])),
1264
- l$2(({ id, icon, ...node }) => [id, { ...node, icon: n$2(icon) ? "Y" : "N" }])
1271
+ m$2((n) => ({
1272
+ id: n.id,
1273
+ icon: n$1(n.icon) ? "Y" : "N",
1274
+ title: n.title,
1275
+ description: n.description?.md ?? n.description?.txt ?? null,
1276
+ technology: n.technology ?? null,
1277
+ shape: n.shape,
1278
+ size: n.style.size ?? null,
1279
+ textSize: n.style.textSize ?? null,
1280
+ padding: n.style.padding ?? null,
1281
+ children: n.children
1282
+ })),
1283
+ l$2(({ id, ...node }) => [id, node])
1265
1284
  ),
1266
1285
  edges: C(
1267
1286
  view.edges,
1268
- m$2(i$8(["source", "target", "label", "description", "technology", "dir", "head", "tail", "line"])),
1287
+ m$2((e) => ({
1288
+ source: e.source,
1289
+ target: e.target,
1290
+ label: e.label,
1291
+ description: e.description?.md ?? e.description?.txt ?? null,
1292
+ technology: e.technology ?? null,
1293
+ dir: e.dir,
1294
+ head: e.head,
1295
+ tail: e.tail,
1296
+ line: e.line
1297
+ })),
1269
1298
  l$2(({ source, target, ...edge }) => [`${source}:${target}`, edge])
1270
1299
  )
1271
1300
  };
@@ -1710,29 +1739,29 @@ function applyViewRuleStyle(rule, predicates, nodes) {
1710
1739
  u((n) => {
1711
1740
  n.shape = rule.style.shape ?? n.shape;
1712
1741
  n.color = rule.style.color ?? n.color;
1713
- if (n$3(rule.style.icon)) {
1742
+ if (n$2(rule.style.icon)) {
1714
1743
  n.icon = rule.style.icon;
1715
1744
  }
1716
- if (n$3(rule.notation)) {
1745
+ if (n$2(rule.notation)) {
1717
1746
  n.notation = rule.notation;
1718
1747
  }
1719
1748
  let styleOverride;
1720
- if (n$3(rule.style.border)) {
1749
+ if (n$2(rule.style.border)) {
1721
1750
  styleOverride = { border: rule.style.border };
1722
1751
  }
1723
- if (n$3(rule.style.opacity)) {
1752
+ if (n$2(rule.style.opacity)) {
1724
1753
  styleOverride = { ...styleOverride, opacity: rule.style.opacity };
1725
1754
  }
1726
- if (n$3(rule.style.multiple)) {
1755
+ if (n$2(rule.style.multiple)) {
1727
1756
  styleOverride = { ...styleOverride, multiple: rule.style.multiple };
1728
1757
  }
1729
- if (n$3(rule.style.padding)) {
1758
+ if (n$2(rule.style.padding)) {
1730
1759
  styleOverride = { ...styleOverride, padding: rule.style.padding };
1731
1760
  }
1732
- if (n$3(rule.style.size)) {
1761
+ if (n$2(rule.style.size)) {
1733
1762
  styleOverride = { ...styleOverride, size: rule.style.size };
1734
1763
  }
1735
- if (n$3(rule.style.textSize)) {
1764
+ if (n$2(rule.style.textSize)) {
1736
1765
  styleOverride = { ...styleOverride, textSize: rule.style.textSize };
1737
1766
  }
1738
1767
  if (styleOverride) {
@@ -1809,7 +1838,7 @@ function buildComputedNodes(elements, groups) {
1809
1838
  elementToGroup.set(e.id, id);
1810
1839
  }
1811
1840
  });
1812
- Array.from(elements).sort(compareByFqnHierarchically).forEach(({ id, style, kind, title, color, shape, tags, ...el }) => {
1841
+ Array.from(elements).sort(compareByFqnHierarchically).forEach(({ id, style, kind, title, color, shape, tags, notation, ...el }) => {
1813
1842
  let parent = parentFqn(id);
1814
1843
  let level = 0;
1815
1844
  let parentNd;
@@ -1848,6 +1877,7 @@ function buildComputedNodes(elements, groups) {
1848
1877
  children: [],
1849
1878
  inEdges: [],
1850
1879
  outEdges: [],
1880
+ ...notation && { notation },
1851
1881
  ...el,
1852
1882
  style: {
1853
1883
  ...style
@@ -1897,31 +1927,31 @@ function mergePropsFromRelationships(relations, prefer) {
1897
1927
  relations,
1898
1928
  l$4(
1899
1929
  (acc, r) => {
1900
- if (n$2(r.title) && !acc.title.includes(r.title)) {
1930
+ if (n$1(r.title) && !acc.title.includes(r.title)) {
1901
1931
  acc.title.push(r.title);
1902
1932
  }
1903
- if (n$2(r.description) && !acc.description.includes(r.description)) {
1933
+ if (n$1(r.description) && !acc.description.some(k(r.description))) {
1904
1934
  acc.description.push(r.description);
1905
1935
  }
1906
- if (n$2(r.technology) && !acc.technology.includes(r.technology)) {
1936
+ if (n$1(r.technology) && !acc.technology.includes(r.technology)) {
1907
1937
  acc.technology.push(r.technology);
1908
1938
  }
1909
- if (n$2(r.kind) && !acc.kind.includes(r.kind)) {
1939
+ if (n$1(r.kind) && !acc.kind.includes(r.kind)) {
1910
1940
  acc.kind.push(r.kind);
1911
1941
  }
1912
- if (n$2(r.color) && !acc.color.includes(r.color)) {
1942
+ if (n$1(r.color) && !acc.color.includes(r.color)) {
1913
1943
  acc.color.push(r.color);
1914
1944
  }
1915
- if (n$2(r.line) && !acc.line.includes(r.line)) {
1945
+ if (n$1(r.line) && !acc.line.includes(r.line)) {
1916
1946
  acc.line.push(r.line);
1917
1947
  }
1918
- if (n$2(r.head) && !acc.head.includes(r.head)) {
1948
+ if (n$1(r.head) && !acc.head.includes(r.head)) {
1919
1949
  acc.head.push(r.head);
1920
1950
  }
1921
- if (n$2(r.tail) && !acc.tail.includes(r.tail)) {
1951
+ if (n$1(r.tail) && !acc.tail.includes(r.tail)) {
1922
1952
  acc.tail.push(r.tail);
1923
1953
  }
1924
- if (n$2(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
1954
+ if (n$1(r.navigateTo) && !acc.navigateTo.includes(r.navigateTo)) {
1925
1955
  acc.navigateTo.push(r.navigateTo);
1926
1956
  }
1927
1957
  if (r.tags) {
@@ -1965,12 +1995,12 @@ function mergePropsFromRelationships(relations, prefer) {
1965
1995
  ...isNonEmptyArray(allprops.links) && { links: allprops.links },
1966
1996
  ...isNonEmptyArray(tags) && { tags }
1967
1997
  },
1968
- n$2
1998
+ n$1
1969
1999
  );
1970
2000
  if (prefer) {
1971
2001
  return {
1972
2002
  ...merged,
1973
- ...d$2(pickRelationshipProps(prefer), n$2)
2003
+ ...d$2(pickRelationshipProps(prefer), n$1)
1974
2004
  };
1975
2005
  }
1976
2006
  return merged;
@@ -2071,14 +2101,15 @@ function deploymentExpressionToPredicate(target) {
2071
2101
  function toNodeSource(el) {
2072
2102
  if (el.isDeploymentNode()) {
2073
2103
  const onlyOneInstance = el.onlyOneInstance();
2074
- let { title, kind, id, ...$node } = el.$node;
2075
- const { icon: icon2, color: color2, shape: shape2, ...style } = el.$node.style ?? {};
2104
+ let { title, kind, id, description: description2, ...$node } = el.$node;
2105
+ const { icon: icon2, color: color2, shape: shape2, ...style2 } = el.$node.style ?? {};
2076
2106
  let tags = [...el.tags];
2077
2107
  if (onlyOneInstance) {
2078
2108
  tags = i$a([...tags, ...onlyOneInstance.tags]);
2079
2109
  if (title === nameFromFqn(el.id)) {
2080
2110
  title = onlyOneInstance.title;
2081
2111
  }
2112
+ description2 = onlyOneInstance.description.$source ?? description2;
2082
2113
  }
2083
2114
  return {
2084
2115
  ...onlyOneInstance && {
@@ -2090,9 +2121,10 @@ function toNodeSource(el) {
2090
2121
  ...icon2 && { icon: icon2 },
2091
2122
  ...color2 && { color: color2 },
2092
2123
  ...shape2 && { shape: shape2 },
2124
+ ...description2 && { description: description2 },
2093
2125
  tags,
2094
2126
  style: {
2095
- ...style
2127
+ ...style2
2096
2128
  },
2097
2129
  deploymentRef: id,
2098
2130
  kind,
@@ -2102,9 +2134,7 @@ function toNodeSource(el) {
2102
2134
  invariant(el.isInstance(), "Expected Instance");
2103
2135
  const instance = el.$instance;
2104
2136
  const element = el.element;
2105
- const icon = instance.style?.icon ?? element.icon;
2106
- const color = instance.style?.color ?? element.color;
2107
- const shape = instance.style?.shape ?? element.shape;
2137
+ const { icon, color, shape, ...style } = el.style;
2108
2138
  const links = [
2109
2139
  ...element.links,
2110
2140
  ...instance.links ?? []
@@ -2114,25 +2144,24 @@ function toNodeSource(el) {
2114
2144
  ...instance.metadata
2115
2145
  };
2116
2146
  const notation = instance.notation ?? element.$element.notation;
2147
+ let description = el.description.$source;
2148
+ let technology = instance.technology ?? element.technology;
2117
2149
  return {
2118
2150
  id: el.id,
2119
2151
  kind: "instance",
2120
- title: instance.title ?? element.title,
2121
- description: instance.description ?? element.description,
2122
- technology: instance.technology ?? element.technology,
2152
+ title: el.title,
2153
+ ...description && { description },
2154
+ ...technology && { technology },
2123
2155
  tags: [...el.tags],
2124
2156
  links: i$b(links, 1) ? links : null,
2125
2157
  ...icon && { icon },
2126
2158
  ...color && { color },
2127
2159
  ...shape && { shape },
2128
- style: {
2129
- ...element.style,
2130
- ...instance.style
2131
- },
2160
+ style,
2132
2161
  deploymentRef: instance.id,
2133
2162
  modelRef: element.id,
2134
2163
  ...notation && { notation },
2135
- ...!n(metadata) && { metadata }
2164
+ ...!n$3(metadata) && { metadata }
2136
2165
  };
2137
2166
  }
2138
2167
  function toComputedEdges$1(connections) {
@@ -3347,9 +3376,10 @@ function applyCustomElementProperties(_rules, _nodes) {
3347
3376
  padding,
3348
3377
  size,
3349
3378
  textSize,
3379
+ description,
3350
3380
  ...rest
3351
3381
  } = d$1(props, n$4);
3352
- const notEmpty = !n(rest);
3382
+ const notEmpty = !n$3(rest);
3353
3383
  const satisfies = elementExprToPredicate(expr);
3354
3384
  nodes.forEach((node, i) => {
3355
3385
  if (isGroupElementKind(node) || !satisfies(node)) {
@@ -3362,6 +3392,13 @@ function applyCustomElementProperties(_rules, _nodes) {
3362
3392
  ...rest
3363
3393
  };
3364
3394
  }
3395
+ if (description !== void 0) {
3396
+ node = {
3397
+ ...node,
3398
+ isCustomized: true,
3399
+ description: { txt: description }
3400
+ };
3401
+ }
3365
3402
  let styleOverride;
3366
3403
  if (border !== void 0) {
3367
3404
  styleOverride = { border };
@@ -3468,7 +3505,7 @@ class DynamicViewCompute {
3468
3505
  color,
3469
3506
  line
3470
3507
  } = this.findRelations(source, target);
3471
- const navigateTo = n$2(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
3508
+ const navigateTo = n$1(stepNavigateTo) && stepNavigateTo !== this.view.id ? stepNavigateTo : derivedNavigateTo;
3472
3509
  this.steps.push({
3473
3510
  id,
3474
3511
  ...step,
@@ -3524,7 +3561,7 @@ class DynamicViewCompute {
3524
3561
  const nodesMap = buildComputedNodes(
3525
3562
  [...this.explicits].map(elementModelToNodeSource)
3526
3563
  );
3527
- const edges = this.steps.map(({ id, source, target, relations, title, isBackward, tags, ...step }) => {
3564
+ const edges = this.steps.map(({ id, source, target, relations, title, description, isBackward, tags, ...step }) => {
3528
3565
  const sourceNode = nonNullable(nodesMap.get(source.id), `Source node ${source.id} not found`);
3529
3566
  const targetNode = nonNullable(nodesMap.get(target.id), `Target node ${target.id} not found`);
3530
3567
  const edge = {
@@ -3534,6 +3571,7 @@ class DynamicViewCompute {
3534
3571
  target: targetNode.id,
3535
3572
  label: title,
3536
3573
  relations,
3574
+ description: description ? { txt: description } : null,
3537
3575
  color: DefaultRelationshipColor,
3538
3576
  line: DefaultLineStyle,
3539
3577
  head: DefaultArrowType,
@@ -3610,7 +3648,7 @@ class DynamicViewCompute {
3610
3648
  const alltags = C(
3611
3649
  relationships,
3612
3650
  u$1((r) => r.tags),
3613
- m$1(n$2),
3651
+ m$1(n$1),
3614
3652
  i$a()
3615
3653
  );
3616
3654
  const tags = i$b(alltags, 1) ? alltags : null;
@@ -3620,7 +3658,7 @@ class DynamicViewCompute {
3620
3658
  const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : C(
3621
3659
  relationships,
3622
3660
  m$2((r) => r.$relationship.navigateTo),
3623
- m$1(n$2),
3661
+ m$1(n$1),
3624
3662
  m$1((v) => v !== this.view.id),
3625
3663
  i$a(),
3626
3664
  t$4()
@@ -3628,9 +3666,9 @@ class DynamicViewCompute {
3628
3666
  const commonProperties = C(
3629
3667
  relationships,
3630
3668
  l$4((acc, { title, $relationship: r }) => {
3631
- n$2(title) && acc.title.add(title);
3632
- n$2(r.color) && acc.color.add(r.color);
3633
- n$2(r.line) && acc.line.add(r.line);
3669
+ n$1(title) && acc.title.add(title);
3670
+ n$1(r.color) && acc.color.add(r.color);
3671
+ n$1(r.line) && acc.line.add(r.line);
3634
3672
  return acc;
3635
3673
  }, {
3636
3674
  color: /* @__PURE__ */ new Set(),
@@ -3701,6 +3739,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
3701
3739
  customRelation: {
3702
3740
  expr,
3703
3741
  title,
3742
+ description,
3704
3743
  ...customprops
3705
3744
  }
3706
3745
  } of rules) {
@@ -3726,6 +3765,7 @@ function applyCustomRelationProperties(_rules, nodes, _edges) {
3726
3765
  edges[i] = {
3727
3766
  ...edge,
3728
3767
  ...props,
3768
+ ...description && { description: { txt: description } },
3729
3769
  label: title ?? edge.label,
3730
3770
  isCustomized: true
3731
3771
  };
@@ -1,4 +1,5 @@
1
- import { F as FqnRef, c as n, d as isStepEdgeId } from './core.CUYDgv2-.mjs';
1
+ import { F as FqnRef, q as isStepEdgeId } from './core.Br7Fab9l.mjs';
2
+ import { n } from './core.D56nCp7e.mjs';
2
3
 
3
4
  function o(r){return Array.isArray(r)}
4
5
 
@@ -273,4 +274,4 @@ function isViewRuleGroup(rule) {
273
274
  return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
274
275
  }
275
276
 
276
- export { Expression as E, FqnExpr as F, ModelFqnExpr as M, RelationExpr as R, isElementView as a, isViewRuleStyle as b, isViewRulePredicate as c, isViewRuleAutoLayout as d, isViewRuleGroup as e, isViewRuleGlobalPredicateRef as f, isViewRuleGlobalStyle as g, isDynamicViewParallelSteps as h, isExtendsElementView as i, ModelRelationExpr as j, ModelExpression as k, isDynamicView as l, isDeploymentView as m, isComputedView as n, o, isDiagramView as p, isScopedElementView as q, isAutoLayoutDirection as r, getParallelStepsPrefix as s };
277
+ export { Expression as E, FqnExpr as F, ModelFqnExpr as M, RelationExpr as R, ModelRelationExpr as a, ModelExpression as b, isViewRuleStyle as c, isComputedView as d, isDiagramView as e, isElementView as f, isScopedElementView as g, isExtendsElementView as h, isViewRulePredicate as i, isDeploymentView as j, isDynamicView as k, isViewRuleGlobalStyle as l, isViewRuleGlobalPredicateRef as m, isAutoLayoutDirection as n, isViewRuleAutoLayout as o, getParallelStepsPrefix as p, isDynamicViewParallelSteps as q, isViewRuleGroup as r, o as s };
@@ -0,0 +1,10 @@
1
+ function getOrCreate(map, key, create) {
2
+ let entry = map.get(key);
3
+ if (!entry) {
4
+ entry = create(key);
5
+ map.set(key, entry);
6
+ }
7
+ return entry;
8
+ }
9
+
10
+ export { getOrCreate as g };
@@ -1,5 +1,6 @@
1
1
  import { IfNever, IsNever, IsLiteral } from 'type-fest';
2
- import { D as DeploymentFqn$1, C as Coalesce, F as Fqn$1, R as RelationId$1, N as NodeId$1, E as EdgeId$1, P as ProjectId$1, V as ViewId$1, T as Tag$1, a as ElementKind$1, b as DeploymentKind$1, c as RelationshipKind, L as Link } from './core.BuO4ncfY.mjs';
2
+ import { C as Coalesce, L as Link } from './core.DuSLYTG6.mjs';
3
+ import { D as DeploymentFqn$1, F as Fqn$1, d as RelationId$1, N as NodeId$1, j as EdgeId$1, P as ProjectId$1, V as ViewId$1, T as Tag$1, E as ElementKind$1, b as DeploymentKind$1, c as RelationshipKind } from './core.668kXpZq.mjs';
3
4
 
4
5
  /**
5
6
  * Determines the stage of the model:
@@ -153,7 +154,7 @@ type MetadataKey<A> = A extends infer T extends Any ? Coalesce<T['MetadataKey']>
153
154
  * Metadata object from Aux
154
155
  */
155
156
  type Metadata<A extends Any> = IsNever<A['MetadataKey']> extends true ? never : IsLiteral<A['MetadataKey']> extends true ? {
156
- [key in Coalesce<A['MetadataKey']>]?: string;
157
+ [key in A['MetadataKey']]?: string;
157
158
  } : Record<string, string>;
158
159
  /**
159
160
  * All known kinds from Aux as a literal union.
@@ -255,4 +256,4 @@ declare namespace aux {
255
256
  export type { aux_AllKinds as AllKinds, aux_Any as Any, Any as AnyAux, aux_AnySpec as AnySpec, aux_Aux as Aux, aux_DeploymentFqn as DeploymentFqn, aux_DeploymentId as DeploymentId, aux_DeploymentKind as DeploymentKind, aux_EdgeId as EdgeId, aux_ElementId as ElementId, aux_ElementKind as ElementKind, aux_Fqn as Fqn, aux_LooseDeploymentId as LooseDeploymentId, aux_LooseDeploymentKind as LooseDeploymentKind, aux_LooseElementId as LooseElementId, aux_LooseElementKind as LooseElementKind, aux_LooseRelationKind as LooseRelationKind, aux_LooseTag as LooseTag, aux_LooseTags as LooseTags, aux_LooseViewId as LooseViewId, aux_Metadata as Metadata, aux_MetadataKey as MetadataKey, aux_Never as Never, aux_NodeId as NodeId, aux_OrString as OrString, aux_PickByStage as PickByStage, aux_ProjectId as ProjectId, aux_RelationId as RelationId, aux_RelationKind as RelationKind, aux_Spec as Spec, aux_SpecAux as SpecAux, aux_Stage as Stage, DeploymentFqn as StrictDeploymentFqn, aux_StrictDeploymentKind as StrictDeploymentKind, aux_StrictElementKind as StrictElementKind, Fqn as StrictFqn, aux_StrictProjectId as StrictProjectId, aux_StrictRelationKind as StrictRelationKind, aux_StrictTag as StrictTag, aux_StrictViewId as StrictViewId, aux_Tag as Tag, aux_Tags as Tags, aux_Unknown as Unknown, aux_UnknownComputed as UnknownComputed, aux_UnknownLayouted as UnknownLayouted, aux_UnknownParsed as UnknownParsed, aux_ViewId as ViewId, aux_WithLinks as WithLinks, aux_WithMetadata as WithMetadata, aux_WithOptionalLinks as WithOptionalLinks, aux_WithOptionalTags as WithOptionalTags, aux_WithTags as WithTags, aux_setStage as setStage, aux_toComputed as toComputed, aux_toLayouted as toLayouted, aux_toParsed as toParsed };
256
257
  }
257
258
 
258
- export { type WithLinks as $, type Any as A, type WithMetadata as B, type AnySpec as C, type DeploymentKind as D, type ExtractOnStage as E, type Fqn as F, type PickByStage as G, type setStage as H, type NodeId as I, type Spec as J, type StrictProjectId as K, type LooseTag as L, type ModelStage as M, type Never as N, type StrictTag as O, type ProjectId as P, type StrictElementKind as Q, type RelationKind as R, type SpecAux as S, type Tags as T, type Unknown as U, type ViewId as V, type WithOptionalTags as W, type StrictDeploymentKind as X, type StrictRelationKind as Y, type WithTags as Z, _stage as _, aux as a, type OrString as a0, type LooseTags as a1, type LooseElementKind as a2, type LooseDeploymentKind as a3, type LooseRelationKind as a4, type Aux as b, type UnknownComputed as c, type UnknownLayouted as d, type UnknownParsed as e, _type as f, type ElementId as g, type EdgeId as h, isOnStage as i, type Metadata as j, type MetadataKey as k, type ElementKind as l, type RelationId as m, type StrictViewId as n, type LooseElementId as o, type LooseDeploymentId as p, type DeploymentFqn as q, type toLayouted as r, type Stage as s, type toComputed as t, type DeploymentId as u, type Tag as v, type toParsed as w, type LooseViewId as x, type AllKinds as y, type WithOptionalLinks as z };
259
+ export { type WithLinks as $, type Any as A, type EdgeId as B, type AnySpec as C, type DeploymentKind as D, type ExtractOnStage as E, type Fqn as F, type PickByStage as G, type setStage as H, type NodeId as I, type Spec as J, type StrictProjectId as K, type LooseTag as L, type ModelStage as M, type Never as N, type StrictTag as O, type ProjectId as P, type StrictElementKind as Q, type RelationKind as R, type SpecAux as S, type Tags as T, type Unknown as U, type ViewId as V, type WithOptionalTags as W, type StrictDeploymentKind as X, type StrictRelationKind as Y, type WithTags as Z, _stage as _, aux as a, type OrString as a0, type LooseTags as a1, type LooseElementKind as a2, type LooseDeploymentKind as a3, type LooseRelationKind as a4, type Aux as b, type UnknownComputed as c, type UnknownLayouted as d, type UnknownParsed as e, _type as f, type ElementId as g, type Metadata as h, isOnStage as i, type MetadataKey as j, type ElementKind as k, type RelationId as l, type StrictViewId as m, type LooseElementId as n, type LooseDeploymentId as o, type DeploymentFqn as p, type toLayouted as q, type Stage as r, type DeploymentId as s, type toComputed as t, type Tag as u, type toParsed as v, type LooseViewId as w, type AllKinds as x, type WithOptionalLinks as y, type WithMetadata as z };
@@ -0,0 +1,34 @@
1
+ import { t } from './core.BH9nN-_I.mjs';
2
+ import { i as invariant } from './core.D4npX2q8.mjs';
3
+
4
+ function ifind(arg1, arg2) {
5
+ const pred = arg2 ?? arg1;
6
+ invariant(t(pred));
7
+ function _find(iter) {
8
+ for (const value of iter) {
9
+ if (pred(value)) {
10
+ return value;
11
+ }
12
+ }
13
+ return;
14
+ }
15
+ if (!arg2) {
16
+ return _find;
17
+ }
18
+ return _find(arg1);
19
+ }
20
+
21
+ function ihead(iterable) {
22
+ if (!iterable) {
23
+ return _head;
24
+ }
25
+ return _head(iterable);
26
+ }
27
+ function _head(iter) {
28
+ for (const value of iter) {
29
+ return value;
30
+ }
31
+ return;
32
+ }
33
+
34
+ export { ihead as a, ifind as i };
@@ -0,0 +1,57 @@
1
+ import { IsAny, UnionToIntersection, Simplify } from 'type-fest';
2
+
3
+ type NonEmptyArray<T> = [T, ...T[]];
4
+ type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
5
+ type KeysOf<T> = keyof T extends infer K extends string ? K : never;
6
+ type AllNever<Expressions> = UnionToIntersection<{
7
+ [Name in keyof Expressions]: {
8
+ -readonly [Key in keyof Expressions[Name]]?: never;
9
+ };
10
+ }[keyof Expressions]>;
11
+ /**
12
+ * @example
13
+ * ```ts
14
+ * type Variant1 = {
15
+ * a: string
16
+ * }
17
+ * type Variant2 = {
18
+ * b: number
19
+ * }
20
+ *
21
+ * type Variants = ExclusiveUnion<{
22
+ * Variant1: Variant1,
23
+ * Variant2: Variant2
24
+ * }>
25
+ *
26
+ * // Fail here
27
+ * const variant1: Variants = {
28
+ * a: 'one',
29
+ * b: 1
30
+ * }
31
+ * ```
32
+ */
33
+ type ExclusiveUnion<Expressions, All = AllNever<Expressions>> = Expressions extends object ? {
34
+ [Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]>;
35
+ }[keyof Expressions] : never;
36
+ /**
37
+ * Copy from https://github.com/remeda/remeda/blob/main/src/internal/types/NTuple.ts
38
+ * An array with *exactly* N elements in it.
39
+ *
40
+ * Only literal N values are supported. For very large N the type might result
41
+ * in a recurse depth error. For negative N the type would result in an infinite
42
+ * recursion. None of these have protections because this is an internal type!
43
+ */
44
+ type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
45
+ type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
46
+ type Predicate<T> = (x: T) => boolean;
47
+ interface Link {
48
+ title?: string;
49
+ url: string;
50
+ relative?: string;
51
+ }
52
+ /**
53
+ * Coalesce `V` to a string if it is `any`
54
+ */
55
+ type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
56
+
57
+ export type { Coalesce as C, ExclusiveUnion as E, IteratorLike as I, KeysOf as K, Link as L, NonEmptyArray as N, Predicate as P, NonEmptyReadonlyArray as a, NTuple as b };