@likec4/core 1.40.0 → 1.42.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 (257) hide show
  1. package/builder/package.json +4 -0
  2. package/compute-view/package.json +4 -0
  3. package/compute-view/relationships/package.json +4 -0
  4. package/dist/builder/index.d.mts +83 -20
  5. package/dist/builder/index.mjs +210 -126
  6. package/dist/compute-view/index.d.mts +8 -7
  7. package/dist/compute-view/index.mjs +14 -11
  8. package/dist/compute-view/relationships-view/index.d.mts +9 -8
  9. package/dist/compute-view/relationships-view/index.mjs +6 -6
  10. package/dist/index.d.mts +7 -7
  11. package/dist/index.mjs +12 -12
  12. package/dist/model/connection/deployment/index.d.mts +11 -10
  13. package/dist/model/connection/deployment/index.mjs +2 -2
  14. package/dist/model/connection/index.d.mts +12 -11
  15. package/dist/model/connection/index.mjs +3 -3
  16. package/dist/model/connection/model/index.d.mts +11 -10
  17. package/dist/model/connection/model/index.mjs +2 -2
  18. package/dist/model/index.d.mts +14 -14
  19. package/dist/model/index.mjs +4 -5
  20. package/dist/shared/{core.DHQ32OHa.mjs → core.01VTr9qu.mjs} +10 -29
  21. package/dist/shared/core.1vX5a9AY.mjs +86 -0
  22. package/dist/shared/{core.BVNaR17u.mjs → core.B7KhhkRY.mjs} +1 -1
  23. package/dist/shared/core.B85MJLTf.mjs +5 -0
  24. package/dist/shared/{core.BIAlzwKc.mjs → core.BIqHjQiH.mjs} +85 -45
  25. package/dist/shared/core.BKlholso.mjs +3 -0
  26. package/dist/shared/core.BR4zXDH-.mjs +13 -0
  27. package/dist/shared/{core.yHe79zEl.mjs → core.BYNkXQ8A.mjs} +21 -12
  28. package/dist/shared/core.BazD6cot.mjs +14 -0
  29. package/dist/shared/{core.BuoXfSMj.mjs → core.BbE4y-yl.mjs} +1 -1
  30. package/dist/shared/core.BoYfZOBm.mjs +3 -0
  31. package/dist/shared/core.BsSXS-_R.mjs +7 -0
  32. package/dist/shared/{core.T-eLZTW_.mjs → core.BzTakU3I.mjs} +15 -7
  33. package/dist/shared/{core.4u1dVmfX.mjs → core.C2TiyjI6.mjs} +2 -2
  34. package/dist/shared/{core.DLpidoWc.mjs → core.C3JowhaZ.mjs} +3 -3
  35. package/dist/shared/{core.CNGyqkJh.mjs → core.C4x8aaWa.mjs} +3 -1
  36. package/dist/shared/{core.BB6zA-UU.mjs → core.C8YY6Uub.mjs} +38 -9
  37. package/dist/shared/{core.FPITT8Vx.mjs → core.C8sl5Y8Z.mjs} +144 -61
  38. package/dist/shared/{core.DuR3R-xJ.mjs → core.CNgZvKb8.mjs} +3 -5176
  39. package/dist/shared/{core.BbThmf6M.d.mts → core.CQngdcuj.d.mts} +85 -4
  40. package/dist/shared/{core.Be1n9a0i.mjs → core.C_Ni6yHl.mjs} +5 -4
  41. package/dist/shared/core.CbT8JVYL.mjs +5 -0
  42. package/dist/shared/core.CqAJJpK_.mjs +3 -0
  43. package/dist/shared/{core.CySf-2gP.d.mts → core.D0PjZzIS.d.mts} +52 -15
  44. package/dist/shared/{core.DrvfVXkh.d.mts → core.D5fzJWbF.d.mts} +11 -2
  45. package/dist/shared/{core.DrVOJuxX.d.mts → core.DACpKp35.d.mts} +5 -5
  46. package/dist/shared/core.DFi2dOTl.mjs +39548 -0
  47. package/dist/shared/{core.D704WZES.d.mts → core.DIol3syK.d.mts} +2 -2
  48. package/dist/shared/{core.DlG1xWt2.mjs → core.DMMOWQqc.mjs} +3 -2
  49. package/dist/shared/core.DNbUPnve.mjs +3990 -0
  50. package/dist/shared/{core.CCD1ID81.mjs → core.DRJma0Ol.mjs} +4 -3
  51. package/dist/shared/{core.DgttqsJc.mjs → core.DRhg-gVU.mjs} +9 -9
  52. package/dist/shared/core.DSO_rTC2.mjs +5322 -0
  53. package/dist/shared/{core.vWJTxpLV.d.mts → core.D_vkffV4.d.mts} +4 -2
  54. package/dist/shared/core.DdMJk7nx.d.mts +476 -0
  55. package/dist/shared/{core.D_fI5Lf6.d.mts → core.Dgs6-nuz.d.mts} +24 -4
  56. package/dist/shared/{core.Be4Jy9Qx.mjs → core.FZ305VYd.mjs} +2 -2
  57. package/dist/shared/core.OHD4KXm9.mjs +5 -0
  58. package/dist/shared/{core.GTgsmXS_.mjs → core.QJD_fcrc.mjs} +2 -2
  59. package/dist/shared/core.RfnaEmgA.mjs +7 -0
  60. package/dist/shared/core.fHR_8Tnq.d.mts +450 -0
  61. package/dist/shared/{core.D0EgVMQK.mjs → core.lRvxPoao.mjs} +14 -12
  62. package/dist/shared/{core.CaT0SUUK.mjs → core.rCeaAqgW.mjs} +1 -84
  63. package/dist/shared/{core.kxeJe0OY.d.mts → core.s9uwOt60.d.mts} +4 -4
  64. package/dist/shared/core.yna0OdV5.d.mts +98 -0
  65. package/dist/styles/index.d.mts +106 -0
  66. package/dist/styles/index.mjs +1 -0
  67. package/dist/types/_aux.d.mts +2 -2
  68. package/dist/types/_aux.mjs +1 -5
  69. package/dist/types/expression-model.d.mts +3 -4
  70. package/dist/types/expression.d.mts +3 -4
  71. package/dist/types/fqnRef.d.mts +2 -2
  72. package/dist/types/fqnRef.mjs +3 -3
  73. package/dist/types/index.d.mts +8 -8
  74. package/dist/types/index.mjs +151 -6
  75. package/dist/types/scalar.mjs +3 -2
  76. package/dist/utils/graphology/index.d.mts +1864 -0
  77. package/dist/utils/graphology/index.mjs +1 -0
  78. package/dist/utils/index.d.mts +11 -6
  79. package/dist/utils/index.mjs +21 -37
  80. package/dist/utils/iterable/index.d.mts +1 -1
  81. package/dist/utils/iterable/index.mjs +45 -7
  82. package/model/package.json +4 -0
  83. package/package.json +42 -24
  84. package/styles/package.json +4 -0
  85. package/types/package.json +4 -0
  86. package/utils/graphology/package.json +4 -0
  87. package/utils/package.json +4 -0
  88. package/dist/shared/core.6_Vp2iiN.mjs +0 -172
  89. package/dist/shared/core.Bpou6c2f.d.mts +0 -850
  90. package/dist/shared/core.CUw_2J9j.mjs +0 -47
  91. package/dist/shared/core.CzdwsPmY.d.mts +0 -69
  92. package/dist/shared/core.DoM6aM9N.mjs +0 -7
  93. package/dist/shared/core.ILwny7BV.mjs +0 -38
  94. package/dist/theme/index.d.mts +0 -11
  95. package/dist/theme/index.mjs +0 -232
  96. package/src/builder/Builder.deployment.ts +0 -224
  97. package/src/builder/Builder.deploymentModel.ts +0 -449
  98. package/src/builder/Builder.element.ts +0 -241
  99. package/src/builder/Builder.model.ts +0 -494
  100. package/src/builder/Builder.ts +0 -870
  101. package/src/builder/Builder.view-common.ts +0 -273
  102. package/src/builder/Builder.view-deployment.ts +0 -135
  103. package/src/builder/Builder.view-element.ts +0 -202
  104. package/src/builder/Builder.views.ts +0 -399
  105. package/src/builder/Builder.with.ts +0 -156
  106. package/src/builder/_types.ts +0 -320
  107. package/src/builder/index.ts +0 -11
  108. package/src/compute-view/compute-view.ts +0 -80
  109. package/src/compute-view/deployment-view/_types.ts +0 -38
  110. package/src/compute-view/deployment-view/clean-connections.ts +0 -236
  111. package/src/compute-view/deployment-view/compute.ts +0 -94
  112. package/src/compute-view/deployment-view/memory/index.ts +0 -9
  113. package/src/compute-view/deployment-view/memory/memory.ts +0 -96
  114. package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +0 -18
  115. package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +0 -154
  116. package/src/compute-view/deployment-view/predicates/index.ts +0 -8
  117. package/src/compute-view/deployment-view/predicates/relation-direct.ts +0 -243
  118. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +0 -70
  119. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +0 -101
  120. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +0 -95
  121. package/src/compute-view/deployment-view/predicates/relation-where.ts +0 -18
  122. package/src/compute-view/deployment-view/predicates/utils.ts +0 -282
  123. package/src/compute-view/deployment-view/predicates/wildcard.ts +0 -41
  124. package/src/compute-view/deployment-view/stages/stage-exclude.ts +0 -5
  125. package/src/compute-view/deployment-view/stages/stage-final.ts +0 -245
  126. package/src/compute-view/deployment-view/stages/stage-include.ts +0 -95
  127. package/src/compute-view/deployment-view/utils.ts +0 -286
  128. package/src/compute-view/dynamic-view/compute.ts +0 -312
  129. package/src/compute-view/element-view/_types.ts +0 -47
  130. package/src/compute-view/element-view/clean-connections.ts +0 -117
  131. package/src/compute-view/element-view/compute.ts +0 -324
  132. package/src/compute-view/element-view/memory/NodeGroup.ts +0 -31
  133. package/src/compute-view/element-view/memory/index.ts +0 -10
  134. package/src/compute-view/element-view/memory/memory.ts +0 -178
  135. package/src/compute-view/element-view/memory/stage-exclude.ts +0 -59
  136. package/src/compute-view/element-view/memory/stage-final.ts +0 -129
  137. package/src/compute-view/element-view/memory/stage-include.ts +0 -130
  138. package/src/compute-view/element-view/predicates/_utils.ts +0 -91
  139. package/src/compute-view/element-view/predicates/element-expand.ts +0 -29
  140. package/src/compute-view/element-view/predicates/element-kind-tag.ts +0 -27
  141. package/src/compute-view/element-view/predicates/element-ref.ts +0 -24
  142. package/src/compute-view/element-view/predicates/relation-direct.ts +0 -321
  143. package/src/compute-view/element-view/predicates/relation-in-out.ts +0 -64
  144. package/src/compute-view/element-view/predicates/relation-in.ts +0 -115
  145. package/src/compute-view/element-view/predicates/relation-out.ts +0 -119
  146. package/src/compute-view/element-view/predicates/wildcard.ts +0 -88
  147. package/src/compute-view/element-view/utils.ts +0 -65
  148. package/src/compute-view/index.ts +0 -4
  149. package/src/compute-view/memory/AbstractMemory.ts +0 -45
  150. package/src/compute-view/memory/AbstractStageExclude.ts +0 -215
  151. package/src/compute-view/memory/AbstractStageInclude.ts +0 -200
  152. package/src/compute-view/memory/_types.ts +0 -148
  153. package/src/compute-view/memory/index.ts +0 -5
  154. package/src/compute-view/memory/ops.ts +0 -43
  155. package/src/compute-view/relationships-view/_types.ts +0 -16
  156. package/src/compute-view/relationships-view/compute.ts +0 -159
  157. package/src/compute-view/relationships-view/index.ts +0 -3
  158. package/src/compute-view/relationships-view/layout.ts +0 -357
  159. package/src/compute-view/relationships-view/utils.ts +0 -73
  160. package/src/compute-view/utils/ancestorsOfNode.ts +0 -19
  161. package/src/compute-view/utils/applyCustomElementProperties.ts +0 -107
  162. package/src/compute-view/utils/applyCustomRelationProperties.ts +0 -58
  163. package/src/compute-view/utils/applyViewRuleStyles.ts +0 -73
  164. package/src/compute-view/utils/buildComputedNodes.ts +0 -153
  165. package/src/compute-view/utils/buildElementNotations.ts +0 -63
  166. package/src/compute-view/utils/elementExpressionToPredicate.ts +0 -50
  167. package/src/compute-view/utils/link-nodes-with-edges.ts +0 -56
  168. package/src/compute-view/utils/merge-props-from-relationships.ts +0 -161
  169. package/src/compute-view/utils/relationExpressionToPredicates.ts +0 -55
  170. package/src/compute-view/utils/resolve-extended-views.ts +0 -85
  171. package/src/compute-view/utils/resolve-global-rules.ts +0 -88
  172. package/src/compute-view/utils/topological-sort.ts +0 -256
  173. package/src/compute-view/utils/view-hash.ts +0 -45
  174. package/src/compute-view/utils/with-readable-edges.ts +0 -40
  175. package/src/index.ts +0 -32
  176. package/src/model/DeploymentElementModel.ts +0 -682
  177. package/src/model/DeploymentModel.ts +0 -393
  178. package/src/model/ElementModel.ts +0 -293
  179. package/src/model/LikeC4Model.ts +0 -882
  180. package/src/model/RelationModel.ts +0 -152
  181. package/src/model/connection/Connection.ts +0 -72
  182. package/src/model/connection/deployment/DeploymentConnectionModel.ts +0 -185
  183. package/src/model/connection/deployment/find.ts +0 -120
  184. package/src/model/connection/deployment/index.ts +0 -8
  185. package/src/model/connection/index.ts +0 -22
  186. package/src/model/connection/model/ConnectionModel.ts +0 -158
  187. package/src/model/connection/model/find.ts +0 -117
  188. package/src/model/connection/model/index.ts +0 -8
  189. package/src/model/connection/ops.ts +0 -276
  190. package/src/model/guards.ts +0 -77
  191. package/src/model/index.ts +0 -72
  192. package/src/model/types.ts +0 -67
  193. package/src/model/utils.ts +0 -66
  194. package/src/model/view/EdgeModel.ts +0 -120
  195. package/src/model/view/LikeC4ViewModel.ts +0 -361
  196. package/src/model/view/LikeC4ViewsFolder.ts +0 -151
  197. package/src/model/view/NodeModel.ts +0 -247
  198. package/src/theme/element.ts +0 -61
  199. package/src/theme/index.ts +0 -127
  200. package/src/theme/relationships.ts +0 -54
  201. package/src/types/RichText.ts +0 -206
  202. package/src/types/_aux.ts +0 -291
  203. package/src/types/_common.ts +0 -80
  204. package/src/types/const.ts +0 -34
  205. package/src/types/expression-model.ts +0 -294
  206. package/src/types/expression.ts +0 -313
  207. package/src/types/fqnRef.ts +0 -91
  208. package/src/types/geometry.ts +0 -159
  209. package/src/types/global.ts +0 -21
  210. package/src/types/index.ts +0 -42
  211. package/src/types/model-data.ts +0 -77
  212. package/src/types/model-deployment.ts +0 -88
  213. package/src/types/model-dump.ts +0 -79
  214. package/src/types/model-logical.ts +0 -135
  215. package/src/types/model-spec.ts +0 -85
  216. package/src/types/operators.ts +0 -156
  217. package/src/types/project.ts +0 -14
  218. package/src/types/scalar.ts +0 -162
  219. package/src/types/styles.ts +0 -122
  220. package/src/types/view-changes.ts +0 -32
  221. package/src/types/view-common.ts +0 -157
  222. package/src/types/view-computed.ts +0 -118
  223. package/src/types/view-layouted.ts +0 -98
  224. package/src/types/view-parsed.deployment.ts +0 -39
  225. package/src/types/view-parsed.dynamic.ts +0 -89
  226. package/src/types/view-parsed.element.ts +0 -65
  227. package/src/types/view.ts +0 -113
  228. package/src/utils/common-head.ts +0 -22
  229. package/src/utils/compare-natural.ts +0 -60
  230. package/src/utils/const.ts +0 -1
  231. package/src/utils/fqn.ts +0 -302
  232. package/src/utils/getOrCreate.ts +0 -8
  233. package/src/utils/guards.ts +0 -9
  234. package/src/utils/index.ts +0 -68
  235. package/src/utils/invariant.ts +0 -29
  236. package/src/utils/iterable/_types.ts +0 -5
  237. package/src/utils/iterable/filter.ts +0 -55
  238. package/src/utils/iterable/find.ts +0 -38
  239. package/src/utils/iterable/first.ts +0 -48
  240. package/src/utils/iterable/flat.ts +0 -17
  241. package/src/utils/iterable/head.ts +0 -22
  242. package/src/utils/iterable/index.ts +0 -15
  243. package/src/utils/iterable/map.ts +0 -40
  244. package/src/utils/iterable/reduce.ts +0 -24
  245. package/src/utils/iterable/some.ts +0 -36
  246. package/src/utils/iterable/to.ts +0 -19
  247. package/src/utils/iterable/unique.ts +0 -23
  248. package/src/utils/markdown/index.ts +0 -2
  249. package/src/utils/markdown/to-html.ts +0 -32
  250. package/src/utils/markdown/to-text.ts +0 -14
  251. package/src/utils/memoize-prop.ts +0 -30
  252. package/src/utils/mnemonist.ts +0 -9
  253. package/src/utils/object-hash.ts +0 -14
  254. package/src/utils/promises.ts +0 -24
  255. package/src/utils/relations.ts +0 -36
  256. package/src/utils/set.ts +0 -83
  257. package/src/utils/string-hash.ts +0 -16
@@ -1,16 +1,22 @@
1
- import defu from 'defu';
2
- import { isArray, isString, map, entries, mapValues, fromEntries, mapToObj, isNullish, pickBy, isNonNullish, hasAtLeast, isFunction } from 'remeda';
3
- import { c as computeLikeC4Model } from '../shared/core.DuR3R-xJ.mjs';
4
- import { n as nameFromFqn, d as isSameHierarchy, p as parentFqn } from '../shared/core.DgttqsJc.mjs';
1
+ import { d as defu, t as t$6 } from '../shared/core.DNbUPnve.mjs';
2
+ import { t as t$1, a as t$7 } from '../shared/core.BsSXS-_R.mjs';
3
+ import { a as t$5 } from '../shared/core.C8sl5Y8Z.mjs';
4
+ import { s as e, d as isElementView } from '../shared/core.BzTakU3I.mjs';
5
+ import { e as e$3 } from '../shared/core.DRJma0Ol.mjs';
6
+ import { a as _type, k as e$2, _ as _stage, c as isDeployedInstance } from '../shared/core.BYNkXQ8A.mjs';
7
+ import { t as t$2 } from '../shared/core.CbT8JVYL.mjs';
8
+ import { a as t$3, b as t$4, c as computeLikeC4Model } from '../shared/core.DSO_rTC2.mjs';
9
+ import { n as nameFromFqn, d as isSameHierarchy, p as parentFqn } from '../shared/core.DRhg-gVU.mjs';
10
+ import { e as e$1 } from '../shared/core.CqAJJpK_.mjs';
5
11
  import { ModelFqnExpr } from '../types/expression-model.mjs';
6
- import { a as _type, _ as _stage, c as isDeployedInstance } from '../shared/core.yHe79zEl.mjs';
7
12
  import { i as invariant } from '../shared/core.D4npX2q8.mjs';
8
- import { d as isElementView } from '../shared/core.T-eLZTW_.mjs';
13
+ import { e as exact } from '../shared/core.01VTr9qu.mjs';
9
14
  import { FqnRef } from '../types/fqnRef.mjs';
10
- import { D as DefaultThemeColor, a as DefaultElementShape } from '../shared/core.DHQ32OHa.mjs';
15
+
16
+ function t(...t){return t$1(Object.fromEntries,t)}
11
17
 
12
18
  function parseWhere(where) {
13
- if (isString(where)) {
19
+ if (e$1(where)) {
14
20
  const op = where;
15
21
  switch (true) {
16
22
  case op.startsWith("tag is not #"):
@@ -57,12 +63,12 @@ function parseWhere(where) {
57
63
  }
58
64
  if (where.and) {
59
65
  return {
60
- and: map(where.and, parseWhere)
66
+ and: t$2(where.and, parseWhere)
61
67
  };
62
68
  }
63
69
  if (where.or) {
64
70
  return {
65
- or: map(where.or, parseWhere)
71
+ or: t$2(where.or, parseWhere)
66
72
  };
67
73
  }
68
74
  if (where.not) {
@@ -127,7 +133,7 @@ function $exclude(...args) {
127
133
  }
128
134
  function $style(element, { notation, ...style }) {
129
135
  return (b) => b.style({
130
- targets: (isArray(element) ? element : [element]).map((e) => b.$expr(e)),
136
+ targets: (e(element) ? element : [element]).map((e) => b.$expr(e)),
131
137
  ...notation ? { notation } : {},
132
138
  style: {
133
139
  ...style
@@ -142,7 +148,7 @@ function $rules(...rules) {
142
148
  }
143
149
 
144
150
  function $deploymentExpr(expr) {
145
- if (!isString(expr)) {
151
+ if (!e$1(expr)) {
146
152
  return expr;
147
153
  }
148
154
  const asTypedDeploymentExpression = (expr2) => {
@@ -216,7 +222,7 @@ const asTypedExpr = (expr) => {
216
222
  return expr;
217
223
  };
218
224
  function $expr(expr) {
219
- if (!isString(expr)) {
225
+ if (!e$1(expr)) {
220
226
  return expr;
221
227
  }
222
228
  if (expr === "*") {
@@ -320,60 +326,68 @@ function mkViewBuilder(view) {
320
326
  return viewBuilder;
321
327
  }
322
328
 
323
- function validateSpec(specification) {
324
- for (const [kind, spec] of entries(specification.elements)) {
329
+ function ensureObj(value) {
330
+ return e(value) ? t$6(value, (_) => ({})) : value;
331
+ }
332
+ function validateSpec({ tags, elements, deployments, relationships, ...specification }) {
333
+ const spectags = {};
334
+ if (tags) {
335
+ Object.assign(
336
+ spectags,
337
+ ensureObj(tags)
338
+ );
339
+ }
340
+ const _elements = ensureObj(elements);
341
+ for (const [kind, spec] of t$5(_elements)) {
325
342
  if (spec.tags) {
326
343
  for (const tag of spec.tags) {
327
- invariant(specification.tags?.[tag], `Invalid specification for element kind "${kind}": tag "${tag}" not found`);
344
+ invariant(tag in spectags, `Invalid specification for element kind "${kind}": tag "${tag}" not found`);
328
345
  }
329
346
  }
330
347
  }
331
- if (specification.deployments) {
332
- for (const [kind, spec] of entries(specification.deployments)) {
333
- if (spec.tags) {
334
- for (const tag of spec.tags) {
335
- invariant(
336
- specification.tags?.[tag],
337
- `Invalid specification for deployment kind "${kind}": tag "${tag}" not found`
338
- );
339
- }
348
+ const _deployments = ensureObj(deployments ?? {});
349
+ for (const [kind, spec] of t$5(_deployments)) {
350
+ if (spec.tags) {
351
+ for (const tag of spec.tags) {
352
+ invariant(
353
+ tag in spectags,
354
+ `Invalid specification for deployment kind "${kind}": tag "${tag}" not found`
355
+ );
340
356
  }
341
357
  }
342
358
  }
359
+ return {
360
+ ...specification,
361
+ tags: spectags,
362
+ elements: _elements,
363
+ deployments: _deployments,
364
+ relationships: ensureObj(relationships ?? {})
365
+ };
343
366
  }
344
- function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
367
+ function builder(_spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
345
368
  predicates: {},
346
369
  dynamicPredicates: {},
347
370
  styles: {}
348
371
  }, _deployments = /* @__PURE__ */ new Map(), _deploymentRelations = []) {
372
+ const spec = validateSpec(_spec);
349
373
  const toLikeC4Specification = () => {
350
- validateSpec(spec);
351
374
  return {
352
- elements: {
353
- ...structuredClone(spec.elements)
354
- },
355
- deployments: {
356
- ...structuredClone(spec.deployments)
357
- },
358
- relationships: {
359
- ...structuredClone(spec.relationships)
360
- },
361
- tags: mapValues(spec.tags ?? {}, (tagSpec) => ({
362
- color: DefaultThemeColor,
363
- ...tagSpec
364
- })),
365
- ...!!spec.metadataKeys ? { metadataKeys: spec.metadataKeys } : {},
375
+ elements: structuredClone(spec.elements),
376
+ deployments: structuredClone(spec.deployments),
377
+ relationships: structuredClone(spec.relationships),
378
+ tags: structuredClone(spec.tags),
379
+ ...spec.metadataKeys ? { metadataKeys: spec.metadataKeys } : {},
366
380
  customColors: {}
367
381
  };
368
382
  };
369
383
  const mapLinks = (links) => {
370
- if (!links || !hasAtLeast(links, 1)) {
371
- return null;
384
+ if (!links || !t$7(links, 1)) {
385
+ return void 0;
372
386
  }
373
- return map(links, (l) => typeof l === "string" ? { url: l } : l);
387
+ return t$2(links, (l) => typeof l === "string" ? { url: l } : l);
374
388
  };
375
389
  const createGenericView = (id, _props, builder2) => {
376
- if (isFunction(_props)) {
390
+ if (e$3(_props)) {
377
391
  builder2 = _props;
378
392
  _props = {};
379
393
  }
@@ -386,15 +400,18 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
386
400
  ...props
387
401
  } = typeof _props === "string" ? { title: _props } : { ..._props };
388
402
  const links = mapLinks(_links);
389
- return [{
390
- id,
391
- title,
392
- description: description ? { txt: description } : null,
393
- tags,
394
- links,
395
- _stage: "parsed",
396
- ...props
397
- }, builder2];
403
+ return [
404
+ exact({
405
+ id,
406
+ title,
407
+ description: description ? { txt: description } : null,
408
+ tags,
409
+ links,
410
+ _stage: "parsed",
411
+ ...props
412
+ }),
413
+ builder2
414
+ ];
398
415
  };
399
416
  const self = {
400
417
  get Types() {
@@ -427,9 +444,9 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
427
444
  },
428
445
  __addRelation(relation) {
429
446
  const sourceEl = _elements.get(FqnRef.flatten(relation.source));
430
- invariant(sourceEl, `Element with id "${relation.source}" not found`);
447
+ invariant(sourceEl, `Element with id "${relation.source.model}" not found`);
431
448
  const targetEl = _elements.get(FqnRef.flatten(relation.target));
432
- invariant(targetEl, `Element with id "${relation.target}" not found`);
449
+ invariant(targetEl, `Element with id "${relation.target.model}" not found`);
433
450
  invariant(
434
451
  !isSameHierarchy(sourceEl, targetEl),
435
452
  "Cannot create relationship between elements in the same hierarchy"
@@ -512,22 +529,22 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
512
529
  ...project
513
530
  },
514
531
  specification: toLikeC4Specification(),
515
- elements: fromEntries(
532
+ elements: t(
516
533
  structuredClone(
517
534
  Array.from(_elements.entries())
518
535
  )
519
536
  ),
520
- relations: mapToObj(_relations, (r) => [r.id, structuredClone(r)]),
537
+ relations: t$4(_relations, (r) => [r.id, structuredClone(r)]),
521
538
  globals: structuredClone(_globals),
522
539
  deployments: {
523
- elements: fromEntries(
540
+ elements: t(
524
541
  structuredClone(
525
542
  Array.from(_deployments.entries())
526
543
  )
527
544
  ),
528
- relations: mapToObj(_deploymentRelations, (r) => [r.id, structuredClone(r)])
545
+ relations: t$4(_deploymentRelations, (r) => [r.id, structuredClone(r)])
529
546
  },
530
- views: fromEntries(
547
+ views: t(
531
548
  structuredClone(
532
549
  Array.from(_views.entries())
533
550
  )
@@ -557,7 +574,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
557
574
  { title: null, links: null }
558
575
  );
559
576
  const links = mapLinks(_links);
560
- b.__addRelation({
577
+ b.__addRelation(exact({
561
578
  source: {
562
579
  model: source
563
580
  },
@@ -566,9 +583,9 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
566
583
  },
567
584
  title,
568
585
  ...description && { description: { txt: description } },
569
- ...links && { links },
586
+ links,
570
587
  ...props
571
- });
588
+ }));
572
589
  return b;
573
590
  };
574
591
  },
@@ -576,63 +593,63 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
576
593
  return (b) => {
577
594
  const {
578
595
  title = "",
579
- links: _links = [],
596
+ links,
580
597
  description = null,
581
598
  ...props
582
599
  } = defu(
583
600
  typeof _props === "string" ? { title: _props } : { ..._props },
584
601
  { title: null, links: null }
585
602
  );
586
- const links = mapLinks(_links);
587
- b.__addSourcelessRelation({
603
+ b.__addSourcelessRelation(exact({
588
604
  target: {
589
605
  model: target
590
606
  },
591
607
  title,
592
608
  ...description && { description: { txt: description } },
593
- ...links && { links },
609
+ links: mapLinks(links),
594
610
  ...props
595
- });
611
+ }));
596
612
  return b;
597
613
  };
598
614
  },
599
- ...mapValues(
615
+ ...t$3(
600
616
  spec.elements,
601
617
  ({ style: specStyle, ...spec2 }, kind) => (id, _props) => {
602
618
  const add = ((b) => {
603
619
  const {
604
- links: _links,
620
+ links,
605
621
  icon: _icon,
622
+ color,
623
+ shape,
606
624
  style,
607
625
  title,
608
- description = null,
626
+ description,
627
+ summary,
609
628
  ...props
610
629
  } = typeof _props === "string" ? { title: _props } : { ..._props };
611
- const links = mapLinks(_links);
612
630
  const icon = _icon ?? specStyle?.icon;
613
631
  const _id = b.__fqn(id);
614
- b.__addElement({
632
+ b.__addElement(exact({
615
633
  id: _id,
616
634
  kind,
617
635
  title: title ?? nameFromFqn(_id),
618
636
  ...description && { description: { txt: description } },
619
- technology: null,
620
- tags: [],
621
- color: specStyle?.color ?? DefaultThemeColor,
622
- shape: specStyle?.shape ?? DefaultElementShape,
623
- style: pickBy({
637
+ ...summary && { summary: { txt: summary } },
638
+ style: exact({
639
+ icon,
640
+ color: color ?? specStyle?.color,
641
+ shape: shape ?? specStyle?.shape,
624
642
  border: specStyle?.border,
625
643
  opacity: specStyle?.opacity,
626
644
  size: specStyle?.size,
627
645
  padding: specStyle?.padding,
628
646
  textSize: specStyle?.textSize,
629
647
  ...style
630
- }, isNonNullish),
631
- links,
632
- ...icon && { icon },
648
+ }),
649
+ links: mapLinks(links),
633
650
  ...spec2,
634
651
  ...props
635
- });
652
+ }));
636
653
  return b;
637
654
  });
638
655
  add.with = (...ops) => (b) => {
@@ -752,7 +769,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
752
769
  },
753
770
  instanceOf: (id, target, _props) => {
754
771
  return (b) => {
755
- if (isNullish(target)) {
772
+ if (e$2(target)) {
756
773
  target = id;
757
774
  id = nameFromFqn(id);
758
775
  } else if (typeof target === "string") {
@@ -765,19 +782,33 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
765
782
  const {
766
783
  links,
767
784
  title,
768
- description = null,
785
+ description,
786
+ summary,
787
+ icon,
788
+ color,
789
+ shape,
790
+ style,
769
791
  ...props
770
792
  } = typeof _props === "string" ? { title: _props } : { ..._props };
771
793
  const _id = b.__deploymentFqn(id);
772
794
  invariant(_elements.has(target), `Target element with id "${target}" not found`);
773
- b.__addDeployment({
774
- id: _id,
775
- element: target,
776
- ...title && { title },
777
- ...description && { description: { txt: description } },
778
- ...links && { links: mapLinks(links) },
779
- ...props
780
- });
795
+ b.__addDeployment(
796
+ exact({
797
+ id: _id,
798
+ element: target,
799
+ ...title && { title },
800
+ ...summary && { summary: { txt: summary } },
801
+ ...description && { description: { txt: description } },
802
+ style: exact({
803
+ icon,
804
+ color,
805
+ shape,
806
+ ...style
807
+ }),
808
+ links: mapLinks(links),
809
+ ...props
810
+ })
811
+ );
781
812
  return b;
782
813
  };
783
814
  },
@@ -789,7 +820,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
789
820
  description = null,
790
821
  ...props
791
822
  } = typeof _props === "string" ? { title: _props } : { ..._props };
792
- b.__addDeploymentRelation({
823
+ b.__addDeploymentRelation(exact({
793
824
  source: {
794
825
  deployment: source
795
826
  },
@@ -798,13 +829,13 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
798
829
  },
799
830
  title,
800
831
  ...description && { description: { txt: description } },
801
- ...links && { links: mapLinks(links) },
832
+ links: mapLinks(links),
802
833
  ...props
803
- });
834
+ }));
804
835
  return b;
805
836
  };
806
837
  },
807
- ...mapValues(
838
+ ...t$3(
808
839
  spec.deployments ?? {},
809
840
  ({ style: specStyle, ...spec2 }, kind) => (id, _props) => {
810
841
  const add = ((b) => {
@@ -813,35 +844,37 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
813
844
  icon: _icon,
814
845
  style,
815
846
  title,
816
- description = null,
847
+ description,
848
+ summary,
849
+ color,
850
+ shape,
817
851
  ...props
818
852
  } = typeof _props === "string" ? { title: _props } : { ..._props };
819
853
  const icon = _icon ?? specStyle?.icon;
820
854
  const _id = b.__deploymentFqn(id);
821
- b.__addDeployment({
822
- id: _id,
823
- kind,
824
- title: title ?? nameFromFqn(_id),
825
- ...description && { description: { txt: description } },
826
- technology: null,
827
- tags: null,
828
- style: {
829
- ...icon && { icon },
830
- color: specStyle?.color ?? DefaultThemeColor,
831
- shape: specStyle?.shape ?? DefaultElementShape,
832
- ...pickBy({
855
+ b.__addDeployment(
856
+ exact({
857
+ id: _id,
858
+ kind,
859
+ title: title ?? nameFromFqn(_id),
860
+ ...description && { description: { txt: description } },
861
+ ...summary && { summary: { txt: summary } },
862
+ style: exact({
863
+ icon,
864
+ color: color ?? specStyle?.color,
865
+ shape: shape ?? specStyle?.shape,
833
866
  border: specStyle?.border,
834
867
  opacity: specStyle?.opacity,
835
868
  size: specStyle?.size,
836
869
  padding: specStyle?.padding,
837
870
  textSize: specStyle?.textSize,
838
871
  ...style
839
- }, isNonNullish)
840
- },
841
- ...links && { links: mapLinks(links) },
842
- ...spec2,
843
- ...props
844
- });
872
+ }),
873
+ links: mapLinks(links),
874
+ ...spec2,
875
+ ...props
876
+ })
877
+ );
845
878
  return b;
846
879
  });
847
880
  add.with = (...ops) => (b) => {
@@ -886,22 +919,73 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
886
919
  };
887
920
  return self;
888
921
  }
889
- var Builder;
890
- ((Builder2) => {
891
- function forSpecification(spec) {
892
- validateSpec(spec);
922
+ const Builder = {
923
+ /**
924
+ * Creates a builder with compositional methods
925
+ *
926
+ * @example
927
+ * ```ts
928
+ * const {
929
+ * model: { model, system, component, relTo },
930
+ * deployment: { env, vm},
931
+ * views: { view, $include },
932
+ * builder,
933
+ * } = Builder.forSpecification({
934
+ * elements: {
935
+ * system: {},
936
+ * component: {},
937
+ * },
938
+ * deployments: ['env', 'vm'],
939
+ * })
940
+ *
941
+ * const b = builder
942
+ * .with(
943
+ * model(
944
+ * system('cloud').with(
945
+ * component('backend'),
946
+ * component('backend.api'),
947
+ * component('frontend').with(
948
+ * relTo('cloud.backend.api'),
949
+ * ),
950
+ * ),
951
+ * ),
952
+ * )
953
+ * ```
954
+ */
955
+ forSpecification(spec) {
893
956
  const b = builder(spec);
894
957
  return {
895
958
  ...b.helpers(),
896
959
  builder: b
897
960
  };
898
- }
899
- Builder2.forSpecification = forSpecification;
900
- function specification(spec) {
901
- validateSpec(spec);
961
+ },
962
+ /**
963
+ * Creates a builder with chainable methods
964
+ *
965
+ * @example
966
+ * ```ts
967
+ * const b = Builder
968
+ * .specification({
969
+ * elements: ['system', 'component'],
970
+ * deployments: ['env', 'vm'],
971
+ * })
972
+ * .model(({ system, component, relTo }, _) =>
973
+ * _(
974
+ * system('cloud').with(
975
+ * component('backend').with(
976
+ * component('api'),
977
+ * ),
978
+ * component('frontend').with(
979
+ * relTo('cloud.backend.api'),
980
+ * )
981
+ * )
982
+ * )
983
+ * )
984
+ * ```
985
+ */
986
+ specification(spec) {
902
987
  return builder(spec);
903
988
  }
904
- Builder2.specification = specification;
905
- })(Builder || (Builder = {}));
989
+ };
906
990
 
907
991
  export { Builder };
@@ -1,14 +1,15 @@
1
- import { A as Any } from '../shared/core.D_fI5Lf6.mjs';
2
- import { g as LikeC4Model } from '../shared/core.CySf-2gP.mjs';
3
- import { h as ParsedLikeC4ModelData, C as ComputedLikeC4ModelData, $ as ParsedView, a2 as ComputedView } from '../shared/core.Bpou6c2f.mjs';
1
+ import { A as Any } from '../shared/core.Dgs6-nuz.mjs';
2
+ import { f as LikeC4Model } from '../shared/core.D0PjZzIS.mjs';
3
+ import { P as ParsedLikeC4ModelData, C as ComputedLikeC4ModelData, r as ParsedView, u as ComputedView } from '../shared/core.DdMJk7nx.mjs';
4
4
  import 'type-fest';
5
- import '../shared/core.DrvfVXkh.mjs';
5
+ import '../shared/core.D5fzJWbF.mjs';
6
6
  import '../shared/core.DX-WYEPA.mjs';
7
- import '../shared/core.CywrQs86.mjs';
8
- import '../shared/core.CzdwsPmY.mjs';
9
- import '../shared/core.BbThmf6M.mjs';
7
+ import '../shared/core.yna0OdV5.mjs';
8
+ import '../shared/core.CQngdcuj.mjs';
10
9
  import '../types/fqnRef.mjs';
10
+ import '../shared/core.fHR_8Tnq.mjs';
11
11
  import '../types/expression-model.mjs';
12
+ import '../shared/core.CywrQs86.mjs';
12
13
 
13
14
  type ComputeViewResult<V> = {
14
15
  isSuccess: true;
@@ -1,15 +1,18 @@
1
- import { G as Graph, w as willCreateCycle, t as topologicalSortExports } from '../shared/core.DuR3R-xJ.mjs';
2
- export { c as computeLikeC4Model, a as computeParsedModelData, b as computeView, u as unsafeComputeView } from '../shared/core.DuR3R-xJ.mjs';
3
- import { values, unique, mapValues, omit, mapToObj, map } from 'remeda';
4
- import { f as isExtendsElementView, d as isElementView } from '../shared/core.T-eLZTW_.mjs';
5
- import { c as isNonEmptyArray } from '../shared/core.DgttqsJc.mjs';
1
+ import { w as willCreateCycle, t as topologicalSortExports, a as t$1, b as t$2, n as n$1 } from '../shared/core.DSO_rTC2.mjs';
2
+ export { c as computeLikeC4Model, d as computeParsedModelData, e as computeView, u as unsafeComputeView } from '../shared/core.DSO_rTC2.mjs';
3
+ import { n } from '../shared/core.BIqHjQiH.mjs';
4
+ import { t } from '../shared/core.C8sl5Y8Z.mjs';
5
+ import { f as isExtendsElementView, d as isElementView } from '../shared/core.BzTakU3I.mjs';
6
+ import { G as Graph } from '../shared/core.CNgZvKb8.mjs';
7
+ import { c as isNonEmptyArray } from '../shared/core.DRhg-gVU.mjs';
8
+ import { t as t$3 } from '../shared/core.CbT8JVYL.mjs';
6
9
 
7
10
  function resolveRulesExtendedViews(unresolvedViews) {
8
11
  const g = new Graph({
9
12
  type: "directed"
10
13
  });
11
14
  const extendedViews = [];
12
- for (const view of values(unresolvedViews)) {
15
+ for (const view of t(unresolvedViews)) {
13
16
  g.addNode(view.id, { view });
14
17
  if (isExtendsElementView(view)) {
15
18
  extendedViews.push(view);
@@ -40,7 +43,7 @@ function resolveRulesExtendedViews(unresolvedViews) {
40
43
  if (!extendsFrom || !isElementView(extendsFrom)) {
41
44
  return acc;
42
45
  }
43
- const tags = unique([
46
+ const tags = n([
44
47
  ...extendsFrom.tags ?? [],
45
48
  ...view.tags ?? []
46
49
  ]);
@@ -62,7 +65,7 @@ function resolveRulesExtendedViews(unresolvedViews) {
62
65
  }
63
66
 
64
67
  function withReadableEdges({ edges, nodes, ...view }, separator = ":") {
65
- const edgeids = mapToObj(edges, (e) => [e.id, `${e.source}${separator}${e.target}`]);
68
+ const edgeids = t$2(edges, (e) => [e.id, `${e.source}${separator}${e.target}`]);
66
69
  return {
67
70
  ...view,
68
71
  edges: edges.map((e) => ({
@@ -71,8 +74,8 @@ function withReadableEdges({ edges, nodes, ...view }, separator = ":") {
71
74
  })),
72
75
  nodes: nodes.map((n) => ({
73
76
  ...n,
74
- inEdges: map(n.inEdges, (e) => edgeids[e]),
75
- outEdges: map(n.outEdges, (e) => edgeids[e])
77
+ inEdges: t$3(n.inEdges, (e) => edgeids[e]),
78
+ outEdges: t$3(n.outEdges, (e) => edgeids[e])
76
79
  })),
77
80
  nodeIds: nodes.map((n) => n.id),
78
81
  edgeIds: edges.map((e) => edgeids[e.id])
@@ -81,7 +84,7 @@ function withReadableEdges({ edges, nodes, ...view }, separator = ":") {
81
84
  function viewsWithReadableEdges({ views, ...model }) {
82
85
  return {
83
86
  ...model,
84
- views: mapValues(views, (v) => omit(withReadableEdges(v), ["nodeIds", "edgeIds"]))
87
+ views: t$1(views, (v) => n$1(withReadableEdges(v), ["nodeIds", "edgeIds"]))
85
88
  };
86
89
  }
87
90
 
@@ -1,14 +1,15 @@
1
- import { A as Any, U as Unknown, j as ElementId, V as ViewId } from '../../shared/core.D_fI5Lf6.mjs';
2
- import { E as ElementModel, R as RelationshipModel, g as LikeC4Model } from '../../shared/core.CySf-2gP.mjs';
1
+ import { A as Any, U as Unknown, k as ElementId, V as ViewId } from '../../shared/core.Dgs6-nuz.mjs';
2
+ import { E as ElementModel, R as RelationshipModel, f as LikeC4Model } from '../../shared/core.D0PjZzIS.mjs';
3
3
  import 'type-fest';
4
- import '../../shared/core.DrvfVXkh.mjs';
4
+ import '../../shared/core.D5fzJWbF.mjs';
5
5
  import '../../shared/core.DX-WYEPA.mjs';
6
- import '../../shared/core.CywrQs86.mjs';
7
- import '../../shared/core.Bpou6c2f.mjs';
8
- import '../../types/expression-model.mjs';
9
- import '../../shared/core.BbThmf6M.mjs';
6
+ import '../../shared/core.yna0OdV5.mjs';
7
+ import '../../shared/core.CQngdcuj.mjs';
10
8
  import '../../types/fqnRef.mjs';
11
- import '../../shared/core.CzdwsPmY.mjs';
9
+ import '../../shared/core.fHR_8Tnq.mjs';
10
+ import '../../types/expression-model.mjs';
11
+ import '../../shared/core.CywrQs86.mjs';
12
+ import '../../shared/core.DdMJk7nx.mjs';
12
13
 
13
14
  type RelationshipsViewData<M extends Any = Unknown> = {
14
15
  incomers: ReadonlySet<ElementModel<M>>;