@likec4/core 1.31.0 → 1.32.1

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 (185) hide show
  1. package/README.md +407 -5
  2. package/dist/builder/index.d.mts +221 -42
  3. package/dist/builder/index.mjs +118 -65
  4. package/dist/compute-view/index.d.mts +23 -7
  5. package/dist/compute-view/index.mjs +11 -6
  6. package/dist/compute-view/relationships-view/index.d.mts +9 -7
  7. package/dist/compute-view/relationships-view/index.mjs +3 -2
  8. package/dist/index.d.mts +10 -14
  9. package/dist/index.mjs +9 -6
  10. package/dist/model/index.d.mts +173 -19
  11. package/dist/model/index.mjs +6 -1
  12. package/dist/shared/core.BaYE_r29.d.mts +258 -0
  13. package/dist/shared/core.Bk7wEZFG.mjs +276 -0
  14. package/dist/shared/core.BrCnZFTn.mjs +32 -0
  15. package/dist/shared/core.BuO4ncfY.d.mts +146 -0
  16. package/dist/shared/{core.Bq753SYD.mjs → core.CBpKAlhj.mjs} +2012 -4422
  17. package/dist/shared/core.CUYDgv2-.mjs +214 -0
  18. package/dist/shared/{core.Cu-UdkSl.mjs → core.CpXlRyE5.mjs} +7 -494
  19. package/dist/shared/{core.C-YXI-43.mjs → core.Cy9smucx.mjs} +3 -1
  20. package/dist/shared/core.CywrQs86.d.mts +31 -0
  21. package/dist/shared/core.DXzRBkuI.d.mts +1264 -0
  22. package/dist/shared/core.DoK86JEe.mjs +518 -0
  23. package/dist/shared/{core.D2830qgg.d.mts → core.Pf5I9o0e.d.mts} +1 -1
  24. package/dist/shared/core.cbA9VZ02.mjs +2681 -0
  25. package/dist/shared/{core.CQXU9DF7.mjs → core.rmvsy0n3.mjs} +23 -32
  26. package/dist/shared/core.znRaUX_A.d.mts +920 -0
  27. package/dist/types/aux.d.mts +3 -0
  28. package/dist/types/aux.mjs +1 -0
  29. package/dist/types/index.d.mts +7 -45
  30. package/dist/types/index.mjs +130 -3
  31. package/dist/utils/index.d.mts +221 -53
  32. package/dist/utils/index.mjs +14 -10
  33. package/package.json +16 -8
  34. package/src/builder/Builder.deploymentModel.ts +82 -18
  35. package/src/builder/Builder.element.ts +40 -20
  36. package/src/builder/Builder.model.ts +66 -17
  37. package/src/builder/Builder.ts +168 -76
  38. package/src/builder/Builder.view-common.ts +35 -17
  39. package/src/builder/Builder.view-deployment.ts +25 -25
  40. package/src/builder/Builder.view-element.ts +13 -12
  41. package/src/builder/Builder.views.ts +12 -7
  42. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +62 -34
  43. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +319 -0
  44. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +45 -24
  45. package/src/builder/_types.ts +34 -27
  46. package/src/compute-view/compute-view.ts +31 -34
  47. package/src/compute-view/deployment-view/__test__/TestHelper.ts +27 -14
  48. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -13
  49. package/src/compute-view/deployment-view/_types.ts +10 -10
  50. package/src/compute-view/deployment-view/clean-connections.ts +5 -7
  51. package/src/compute-view/deployment-view/compute.ts +16 -13
  52. package/src/compute-view/deployment-view/memory/memory.ts +5 -6
  53. package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +4 -5
  54. package/src/compute-view/deployment-view/predicates/relation-direct.ts +25 -50
  55. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +5 -7
  56. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +7 -11
  57. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +7 -10
  58. package/src/compute-view/deployment-view/predicates/utils.ts +37 -31
  59. package/src/compute-view/deployment-view/predicates/wildcard.ts +3 -2
  60. package/src/compute-view/deployment-view/stages/stage-final.ts +2 -2
  61. package/src/compute-view/deployment-view/stages/stage-include.ts +1 -1
  62. package/src/compute-view/deployment-view/utils.ts +79 -72
  63. package/src/compute-view/dynamic-view/__test__/fixture.ts +20 -11
  64. package/src/compute-view/dynamic-view/compute.ts +60 -53
  65. package/src/compute-view/element-view/__test__/TestHelper.ts +53 -29
  66. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +26 -26
  67. package/src/compute-view/element-view/__test__/fixture.ts +134 -83
  68. package/src/compute-view/element-view/_types.ts +14 -19
  69. package/src/compute-view/element-view/clean-connections.ts +12 -8
  70. package/src/compute-view/element-view/compute.ts +61 -51
  71. package/src/compute-view/element-view/memory/NodeGroup.ts +8 -9
  72. package/src/compute-view/element-view/memory/memory.ts +22 -22
  73. package/src/compute-view/element-view/memory/stage-include.ts +5 -3
  74. package/src/compute-view/element-view/predicates/_utils.ts +18 -14
  75. package/src/compute-view/element-view/predicates/element-expand.ts +4 -5
  76. package/src/compute-view/element-view/predicates/element-kind-tag.ts +3 -4
  77. package/src/compute-view/element-view/predicates/element-ref.ts +3 -4
  78. package/src/compute-view/element-view/predicates/relation-direct.ts +16 -12
  79. package/src/compute-view/element-view/predicates/relation-in-out.ts +7 -8
  80. package/src/compute-view/element-view/predicates/relation-in.ts +19 -26
  81. package/src/compute-view/element-view/predicates/relation-out.ts +20 -21
  82. package/src/compute-view/element-view/predicates/wildcard.ts +3 -3
  83. package/src/compute-view/element-view/utils.ts +25 -23
  84. package/src/compute-view/index.ts +1 -1
  85. package/src/compute-view/memory/AbstractStageExclude.ts +3 -4
  86. package/src/compute-view/memory/AbstractStageInclude.ts +1 -1
  87. package/src/compute-view/memory/_types.ts +3 -2
  88. package/src/compute-view/relationships-view/_types.ts +3 -4
  89. package/src/compute-view/relationships-view/compute.ts +8 -11
  90. package/src/compute-view/relationships-view/layout.ts +6 -6
  91. package/src/compute-view/relationships-view/utils.ts +4 -4
  92. package/src/compute-view/utils/ancestorsOfNode.ts +7 -7
  93. package/src/compute-view/utils/applyCustomElementProperties.ts +16 -8
  94. package/src/compute-view/utils/applyCustomRelationProperties.ts +19 -9
  95. package/src/compute-view/utils/applyViewRuleStyles.ts +18 -10
  96. package/src/compute-view/utils/buildComputedNodes.ts +40 -40
  97. package/src/compute-view/utils/buildElementNotations.ts +14 -14
  98. package/src/compute-view/utils/elementExpressionToPredicate.ts +14 -15
  99. package/src/compute-view/utils/link-nodes-with-edges.ts +6 -4
  100. package/src/compute-view/utils/merge-props-from-relationships.ts +52 -20
  101. package/src/compute-view/utils/relationExpressionToPredicates.ts +19 -19
  102. package/src/compute-view/utils/resolve-extended-views.ts +8 -7
  103. package/src/compute-view/utils/resolve-global-rules.ts +31 -26
  104. package/src/compute-view/utils/topological-sort.ts +14 -14
  105. package/src/compute-view/utils/view-hash.ts +2 -2
  106. package/src/compute-view/utils/with-readable-edges.ts +9 -5
  107. package/src/index.ts +0 -32
  108. package/src/model/DeploymentElementModel.ts +171 -144
  109. package/src/model/DeploymentModel.ts +88 -65
  110. package/src/model/ElementModel.ts +85 -74
  111. package/src/model/LikeC4Model.ts +430 -241
  112. package/src/model/RelationModel.ts +63 -29
  113. package/src/model/__test__/fixture.ts +50 -36
  114. package/src/model/connection/Connection.ts +2 -2
  115. package/src/model/connection/deployment/DeploymentConnectionModel.ts +21 -24
  116. package/src/model/connection/deployment/find.ts +1 -1
  117. package/src/model/connection/model/ConnectionModel.ts +21 -20
  118. package/src/model/connection/model/find.ts +7 -7
  119. package/src/model/connection/ops.ts +6 -6
  120. package/src/model/guards.ts +66 -14
  121. package/src/model/index.ts +20 -7
  122. package/src/model/types.ts +41 -97
  123. package/src/model/view/EdgeModel.ts +47 -41
  124. package/src/model/view/LikeC4ViewModel.ts +130 -80
  125. package/src/model/view/NodeModel.ts +102 -96
  126. package/src/theme/element.ts +1 -1
  127. package/src/theme/index.ts +9 -9
  128. package/src/theme/relationships.ts +1 -1
  129. package/src/types/_common.ts +21 -15
  130. package/src/types/aux.ts +285 -0
  131. package/src/types/const.ts +34 -0
  132. package/src/types/expression-model.ts +292 -0
  133. package/src/types/expression.ts +311 -0
  134. package/src/types/fqnRef.ts +88 -0
  135. package/src/types/geometry.ts +131 -0
  136. package/src/types/global.ts +10 -8
  137. package/src/types/index.ts +39 -201
  138. package/src/types/model-data.ts +52 -84
  139. package/src/types/model-deployment.ts +87 -0
  140. package/src/types/model-dump.ts +72 -0
  141. package/src/types/model-logical.ts +111 -0
  142. package/src/types/model-spec.ts +81 -0
  143. package/src/types/operators.ts +51 -52
  144. package/src/types/scalar.ts +114 -0
  145. package/src/types/{theme.ts → styles.ts} +55 -15
  146. package/src/types/view-changes.ts +4 -5
  147. package/src/types/view-common.ts +157 -0
  148. package/src/types/view-computed.ts +113 -0
  149. package/src/types/view-layouted.ts +82 -0
  150. package/src/types/view-parsed.deployment.ts +40 -0
  151. package/src/types/view-parsed.dynamic.ts +78 -0
  152. package/src/types/view-parsed.element.ts +65 -0
  153. package/src/types/view.ts +122 -542
  154. package/src/utils/compare-natural.ts +43 -1
  155. package/src/utils/getOrCreate.ts +0 -34
  156. package/src/utils/index.ts +7 -12
  157. package/src/utils/iterable/filter.ts +1 -1
  158. package/src/utils/iterable/find.ts +3 -1
  159. package/src/utils/iterable/head.ts +22 -0
  160. package/src/utils/iterable/index.ts +1 -0
  161. package/src/utils/iterable/map.ts +1 -1
  162. package/src/utils/iterable/reduce.ts +1 -1
  163. package/src/utils/iterable/some.ts +1 -1
  164. package/src/utils/memoize-prop.ts +30 -0
  165. package/src/utils/object-hash.ts +1 -1
  166. package/src/utils/relations.ts +14 -11
  167. package/src/utils/string-hash.ts +1 -1
  168. package/dist/shared/core.CQDU11hR.d.mts +0 -753
  169. package/dist/shared/core.DJvmfnEi.d.mts +0 -1153
  170. package/dist/shared/core.DgfwjBtu.mjs +0 -495
  171. package/dist/shared/core.Dx7siloV.d.mts +0 -146
  172. package/dist/shared/core.SjLhMA7a.d.mts +0 -62
  173. package/src/builder/__snapshots__/Builder.spec.ts.snap +0 -374
  174. package/src/compute-view/element-view/predicates.ts +0 -520
  175. package/src/compute-view/utils/uniqueTags.ts +0 -21
  176. package/src/types/deployments.ts +0 -170
  177. package/src/types/element.ts +0 -109
  178. package/src/types/expression-v2-model.ts +0 -314
  179. package/src/types/expression-v2.ts +0 -392
  180. package/src/types/overview-graph.ts +0 -43
  181. package/src/types/relation.ts +0 -61
  182. package/src/types/scalars.ts +0 -39
  183. package/src/types/view-notation.ts +0 -9
  184. package/src/utils/graphlib.ts +0 -10
  185. /package/src/{errors/index.ts → utils/invariant.ts} +0 -0
@@ -0,0 +1,319 @@
1
+ {
2
+ "_stage": "computed",
3
+ "deployments": {
4
+ "elements": {},
5
+ "relations": {},
6
+ },
7
+ "elements": {
8
+ "cloud": {
9
+ "color": "primary",
10
+ "description": null,
11
+ "id": "cloud",
12
+ "kind": "system",
13
+ "links": null,
14
+ "shape": "rectangle",
15
+ "style": {
16
+ "size": "lg",
17
+ "textSize": "sm",
18
+ },
19
+ "tags": [],
20
+ "technology": null,
21
+ "title": "cloud",
22
+ },
23
+ "cloud.api": {
24
+ "color": "primary",
25
+ "description": null,
26
+ "id": "cloud.api",
27
+ "kind": "component",
28
+ "links": null,
29
+ "shape": "rectangle",
30
+ "style": {},
31
+ "tags": [],
32
+ "technology": null,
33
+ "title": "api",
34
+ },
35
+ "cloud.ui": {
36
+ "color": "primary",
37
+ "description": null,
38
+ "id": "cloud.ui",
39
+ "kind": "component",
40
+ "links": null,
41
+ "shape": "rectangle",
42
+ "style": {},
43
+ "tags": [],
44
+ "technology": null,
45
+ "title": "ui",
46
+ },
47
+ "customer": {
48
+ "color": "primary",
49
+ "description": null,
50
+ "id": "customer",
51
+ "kind": "actor",
52
+ "links": null,
53
+ "shape": "rectangle",
54
+ "style": {},
55
+ "tags": [
56
+ "tag3",
57
+ ],
58
+ "technology": null,
59
+ "title": "customer",
60
+ },
61
+ },
62
+ "globals": {
63
+ "dynamicPredicates": {},
64
+ "predicates": {},
65
+ "styles": {},
66
+ },
67
+ "imports": {},
68
+ "projectId": "from-builder",
69
+ "relations": {
70
+ "rel1": {
71
+ "id": "rel1",
72
+ "source": {
73
+ "model": "customer",
74
+ },
75
+ "tags": [
76
+ "tag1",
77
+ ],
78
+ "target": {
79
+ "model": "cloud.ui",
80
+ },
81
+ "title": "uses",
82
+ },
83
+ "rel2": {
84
+ "id": "rel2",
85
+ "source": {
86
+ "model": "cloud.ui",
87
+ },
88
+ "tags": [
89
+ "tag2",
90
+ ],
91
+ "target": {
92
+ "model": "cloud.api",
93
+ },
94
+ "title": "calls",
95
+ },
96
+ },
97
+ "specification": {
98
+ "customColors": {},
99
+ "deployments": {
100
+ "env": {
101
+ "style": {
102
+ "size": "lg",
103
+ },
104
+ },
105
+ "node": {},
106
+ },
107
+ "elements": {
108
+ "actor": {
109
+ "tags": [
110
+ "tag3",
111
+ ],
112
+ },
113
+ "component": {},
114
+ "system": {
115
+ "style": {
116
+ "size": "lg",
117
+ "textSize": "sm",
118
+ },
119
+ },
120
+ },
121
+ "relationships": {},
122
+ "tags": {
123
+ "tag1": {
124
+ "color": "#FFF",
125
+ },
126
+ "tag2": {
127
+ "color": "primary",
128
+ },
129
+ "tag3": {
130
+ "color": "primary",
131
+ },
132
+ },
133
+ },
134
+ "views": {
135
+ "cloudui": {
136
+ "_stage": "computed",
137
+ "_type": "element",
138
+ "autoLayout": {
139
+ "direction": "TB",
140
+ },
141
+ "description": null,
142
+ "edges": [
143
+ {
144
+ "id": "1r2spnx",
145
+ "label": "uses",
146
+ "parent": null,
147
+ "relations": [
148
+ "rel1",
149
+ ],
150
+ "source": "customer",
151
+ "tags": [
152
+ "tag1",
153
+ ],
154
+ "target": "cloud.ui",
155
+ },
156
+ {
157
+ "id": "9r1z3i",
158
+ "label": "calls",
159
+ "parent": null,
160
+ "relations": [
161
+ "rel2",
162
+ ],
163
+ "source": "cloud.ui",
164
+ "tags": [
165
+ "tag2",
166
+ ],
167
+ "target": "cloud.api",
168
+ },
169
+ ],
170
+ "hash": "e2efe9f71b40357a84c900d60e5332c97d0af742",
171
+ "id": "cloudui",
172
+ "links": null,
173
+ "nodes": [
174
+ {
175
+ "children": [],
176
+ "color": "primary",
177
+ "description": null,
178
+ "id": "customer",
179
+ "inEdges": [],
180
+ "kind": "actor",
181
+ "level": 0,
182
+ "links": null,
183
+ "modelRef": "customer",
184
+ "outEdges": [
185
+ "1r2spnx",
186
+ ],
187
+ "parent": null,
188
+ "shape": "rectangle",
189
+ "style": {},
190
+ "tags": [
191
+ "tag3",
192
+ ],
193
+ "technology": null,
194
+ "title": "customer",
195
+ },
196
+ {
197
+ "children": [],
198
+ "color": "primary",
199
+ "description": null,
200
+ "id": "cloud.ui",
201
+ "inEdges": [
202
+ "1r2spnx",
203
+ ],
204
+ "kind": "component",
205
+ "level": 0,
206
+ "links": null,
207
+ "modelRef": "cloud.ui",
208
+ "outEdges": [
209
+ "9r1z3i",
210
+ ],
211
+ "parent": null,
212
+ "shape": "rectangle",
213
+ "style": {},
214
+ "tags": [],
215
+ "technology": null,
216
+ "title": "ui",
217
+ },
218
+ {
219
+ "children": [],
220
+ "color": "primary",
221
+ "description": null,
222
+ "id": "cloud.api",
223
+ "inEdges": [
224
+ "9r1z3i",
225
+ ],
226
+ "kind": "component",
227
+ "level": 0,
228
+ "links": null,
229
+ "modelRef": "cloud.api",
230
+ "outEdges": [],
231
+ "parent": null,
232
+ "shape": "rectangle",
233
+ "style": {},
234
+ "tags": [],
235
+ "technology": null,
236
+ "title": "api",
237
+ },
238
+ ],
239
+ "tags": [],
240
+ "title": null,
241
+ "viewOf": "cloud.ui",
242
+ },
243
+ "index": {
244
+ "_stage": "computed",
245
+ "_type": "element",
246
+ "autoLayout": {
247
+ "direction": "TB",
248
+ },
249
+ "description": null,
250
+ "edges": [
251
+ {
252
+ "id": "kzb1r3",
253
+ "label": "uses",
254
+ "parent": null,
255
+ "relations": [
256
+ "rel1",
257
+ ],
258
+ "source": "customer",
259
+ "tags": [
260
+ "tag1",
261
+ ],
262
+ "target": "cloud",
263
+ },
264
+ ],
265
+ "hash": "717ea7de18ab0b5f85bb78a612ad1644052ad367",
266
+ "id": "index",
267
+ "links": null,
268
+ "nodes": [
269
+ {
270
+ "children": [],
271
+ "color": "primary",
272
+ "description": null,
273
+ "id": "customer",
274
+ "inEdges": [],
275
+ "kind": "actor",
276
+ "level": 0,
277
+ "links": null,
278
+ "modelRef": "customer",
279
+ "outEdges": [
280
+ "kzb1r3",
281
+ ],
282
+ "parent": null,
283
+ "shape": "rectangle",
284
+ "style": {},
285
+ "tags": [
286
+ "tag3",
287
+ ],
288
+ "technology": null,
289
+ "title": "customer",
290
+ },
291
+ {
292
+ "children": [],
293
+ "color": "primary",
294
+ "description": null,
295
+ "id": "cloud",
296
+ "inEdges": [
297
+ "kzb1r3",
298
+ ],
299
+ "kind": "system",
300
+ "level": 0,
301
+ "links": null,
302
+ "modelRef": "cloud",
303
+ "outEdges": [],
304
+ "parent": null,
305
+ "shape": "rectangle",
306
+ "style": {
307
+ "size": "lg",
308
+ "textSize": "sm",
309
+ },
310
+ "tags": [],
311
+ "technology": null,
312
+ "title": "cloud",
313
+ },
314
+ ],
315
+ "tags": [],
316
+ "title": "Index",
317
+ },
318
+ },
319
+ }
@@ -2,15 +2,16 @@
2
2
 
3
3
  exports[`Builder (style 2) > should build 1`] = `
4
4
  {
5
+ "_stage": "parsed",
5
6
  "deployments": {
6
7
  "elements": {
7
8
  "dev": {
8
- "color": "primary",
9
9
  "description": null,
10
10
  "id": "dev",
11
11
  "kind": "env",
12
- "shape": "rectangle",
13
12
  "style": {
13
+ "color": "primary",
14
+ "shape": "rectangle",
14
15
  "size": "lg",
15
16
  },
16
17
  "tags": null,
@@ -18,23 +19,24 @@ exports[`Builder (style 2) > should build 1`] = `
18
19
  "title": "dev",
19
20
  },
20
21
  "dev.local": {
21
- "color": "primary",
22
22
  "description": null,
23
23
  "id": "dev.local",
24
24
  "kind": "node",
25
- "shape": "rectangle",
26
- "style": {},
25
+ "style": {
26
+ "color": "primary",
27
+ "shape": "rectangle",
28
+ },
27
29
  "tags": null,
28
30
  "technology": null,
29
31
  "title": "local",
30
32
  },
31
33
  "prod": {
32
- "color": "primary",
33
34
  "description": null,
34
35
  "id": "prod",
35
36
  "kind": "env",
36
- "shape": "rectangle",
37
37
  "style": {
38
+ "color": "primary",
39
+ "shape": "rectangle",
38
40
  "size": "lg",
39
41
  },
40
42
  "tags": null,
@@ -42,12 +44,13 @@ exports[`Builder (style 2) > should build 1`] = `
42
44
  "title": "prod",
43
45
  },
44
46
  "prod.eu": {
45
- "color": "primary",
46
47
  "description": null,
47
48
  "id": "prod.eu",
48
49
  "kind": "node",
49
- "shape": "rectangle",
50
- "style": {},
50
+ "style": {
51
+ "color": "primary",
52
+ "shape": "rectangle",
53
+ },
51
54
  "tags": null,
52
55
  "technology": null,
53
56
  "title": "eu",
@@ -71,7 +74,7 @@ exports[`Builder (style 2) > should build 1`] = `
71
74
  "size": "lg",
72
75
  "textSize": "sm",
73
76
  },
74
- "tags": null,
77
+ "tags": [],
75
78
  "technology": null,
76
79
  "title": "cloud",
77
80
  },
@@ -83,7 +86,7 @@ exports[`Builder (style 2) > should build 1`] = `
83
86
  "links": null,
84
87
  "shape": "rectangle",
85
88
  "style": {},
86
- "tags": null,
89
+ "tags": [],
87
90
  "technology": null,
88
91
  "title": "ui",
89
92
  },
@@ -95,7 +98,9 @@ exports[`Builder (style 2) > should build 1`] = `
95
98
  "links": null,
96
99
  "shape": "rectangle",
97
100
  "style": {},
98
- "tags": null,
101
+ "tags": [
102
+ "tag3",
103
+ ],
99
104
  "technology": null,
100
105
  "title": "customer",
101
106
  },
@@ -106,8 +111,10 @@ exports[`Builder (style 2) > should build 1`] = `
106
111
  "styles": {},
107
112
  },
108
113
  "imports": {},
114
+ "projectId": "from-builder",
109
115
  "relations": {},
110
116
  "specification": {
117
+ "customColors": {},
111
118
  "deployments": {
112
119
  "env": {
113
120
  "style": {
@@ -117,7 +124,11 @@ exports[`Builder (style 2) > should build 1`] = `
117
124
  "node": {},
118
125
  },
119
126
  "elements": {
120
- "actor": {},
127
+ "actor": {
128
+ "tags": [
129
+ "tag3",
130
+ ],
131
+ },
121
132
  "component": {},
122
133
  "system": {
123
134
  "style": {
@@ -127,12 +138,22 @@ exports[`Builder (style 2) > should build 1`] = `
127
138
  },
128
139
  },
129
140
  "relationships": {},
130
- "tags": [],
141
+ "tags": {
142
+ "tag1": {
143
+ "color": "#FFF",
144
+ },
145
+ "tag2": {
146
+ "color": "primary",
147
+ },
148
+ "tag3": {
149
+ "color": "primary",
150
+ },
151
+ },
131
152
  },
132
153
  "views": {
133
154
  "cloud": {
134
- "__": "element",
135
- "customColorDefinitions": {},
155
+ "_stage": "parsed",
156
+ "_type": "element",
136
157
  "description": null,
137
158
  "id": "cloud",
138
159
  "links": null,
@@ -153,13 +174,13 @@ exports[`Builder (style 2) > should build 1`] = `
153
174
  ],
154
175
  },
155
176
  ],
156
- "tags": null,
177
+ "tags": [],
157
178
  "title": null,
158
179
  "viewOf": "cloud.ui",
159
180
  },
160
181
  "deployment": {
161
- "__": "deployment",
162
- "customColorDefinitions": {},
182
+ "_stage": "parsed",
183
+ "_type": "deployment",
163
184
  "description": null,
164
185
  "id": "deployment",
165
186
  "links": null,
@@ -175,12 +196,12 @@ exports[`Builder (style 2) > should build 1`] = `
175
196
  ],
176
197
  },
177
198
  ],
178
- "tags": null,
199
+ "tags": [],
179
200
  "title": "Deployment",
180
201
  },
181
202
  "index": {
182
- "__": "element",
183
- "customColorDefinitions": {},
203
+ "_stage": "parsed",
204
+ "_type": "element",
184
205
  "description": null,
185
206
  "id": "index",
186
207
  "links": null,
@@ -196,7 +217,7 @@ exports[`Builder (style 2) > should build 1`] = `
196
217
  ],
197
218
  },
198
219
  ],
199
- "tags": null,
220
+ "tags": [],
200
221
  "title": "Index",
201
222
  },
202
223
  },
@@ -1,37 +1,44 @@
1
- import type { IfNever, IsLiteral, IsStringLiteral, Tagged, TupleToUnion } from 'type-fest'
2
- import type { LikeC4Model } from '../model/LikeC4Model'
1
+ import type { IfNever, IsLiteral, Tagged, TupleToUnion } from 'type-fest'
3
2
  import type {
3
+ AnyAux,
4
+ Aux,
4
5
  BorderStyle,
5
- Color,
6
- DeploymentNodeKindSpecification,
7
- ElementKindSpecification,
8
6
  ElementShape,
7
+ ElementSpecification as ElementKindSpecification,
8
+ Expression,
9
9
  KeysOf,
10
10
  NonEmptyArray,
11
- ParsedLikeC4ModelData,
12
11
  RelationshipArrowType,
13
- RelationshipKindSpecification,
14
12
  RelationshipLineType,
13
+ RelationshipSpecification as RelationshipKindSpecification,
15
14
  ShapeSize,
16
15
  SpacingSize,
16
+ SpecAux,
17
+ TagSpecification,
17
18
  TextSize,
19
+ ThemeColor as Color,
18
20
  } from '../types'
19
- import type { ExpressionV2 } from '../types/expression-v2'
20
21
  import type { Builder } from './Builder'
21
22
  import type { DeploymentRulesBuilderOp } from './Builder.view-deployment'
22
23
 
24
+ type ElementSpecification = Omit<ElementKindSpecification, 'tags'> & {
25
+ tags?: string[]
26
+ }
27
+
23
28
  export type BuilderSpecification = {
24
29
  elements: {
25
- [kind: string]: Partial<ElementKindSpecification>
30
+ [kind: string]: Partial<ElementSpecification>
26
31
  }
27
32
  relationships?: {
28
33
  [kind: string]: Partial<RelationshipKindSpecification>
29
34
  }
30
35
  deployments?: {
31
- [kind: string]: Partial<DeploymentNodeKindSpecification>
36
+ [kind: string]: Partial<ElementSpecification>
32
37
  }
33
- tags?: [string, ...string[]]
34
- metadataKeys?: [string, ...string[]]
38
+ tags?: {
39
+ [kind: string]: Partial<TagSpecification>
40
+ }
41
+ metadataKeys?: string[]
35
42
  }
36
43
 
37
44
  export type Metadata<MetadataKey extends string> = IfNever<MetadataKey, never, Record<MetadataKey, string>>
@@ -104,7 +111,7 @@ export type Warn<Id, Existing> = IsLiteral<Existing> extends true ? Id extends E
104
111
  export type ValidId<Id> =
105
112
  // Id extends `${string}.${string}` ? Invalid<'Id must not contain dot'>
106
113
  Id extends `${number}${string}` ? Invalid<'Id must not start with number'>
107
- : IsStringLiteral<Id> extends true ? Id
114
+ : IsLiteral<Id> extends true ? Id
108
115
  : Invalid<'Id must be a literal'>
109
116
 
110
117
  /**
@@ -196,7 +203,7 @@ export namespace Types {
196
203
  never,
197
204
  never,
198
205
  KeysOf<Spec['relationships']>,
199
- TupleToUnion<Spec['tags']>,
206
+ KeysOf<Spec['tags']>,
200
207
  TupleToUnion<Spec['metadataKeys']>,
201
208
  KeysOf<Spec['deployments']>,
202
209
  never
@@ -275,23 +282,23 @@ export namespace Types {
275
282
  >
276
283
  : never
277
284
 
278
- export type ToParsedLikeC4Model<T> = T extends AnyTypes ? ParsedLikeC4ModelData<
279
- T['ElementKind'],
280
- T['RelationshipKind'],
281
- T['Tag'],
285
+ export type ToAux<T> = T extends AnyTypes ? Aux<
286
+ 'parsed',
282
287
  T['Fqn'],
288
+ T['DeploymentFqn'],
283
289
  T['ViewId'],
284
- T['DeploymentFqn']
290
+ 'from-builder',
291
+ SpecAux<
292
+ T['ElementKind'],
293
+ T['DeploymentKind'],
294
+ T['RelationshipKind'],
295
+ T['Tag'],
296
+ T['MetadataKey']
297
+ >
285
298
  >
286
- : never
287
-
288
- export type ToLikeC4Model<T extends AnyTypes> = LikeC4Model.Computed<
289
- T['Fqn'],
290
- T['DeploymentFqn'],
291
- T['ViewId']
292
- >
299
+ : AnyAux
293
300
 
294
- export type ToExpression<T> = T extends AnyTypes ? ExpressionV2<T['DeploymentFqn'], T['Fqn']> : never
301
+ export type ToExpression<T> = T extends AnyTypes ? Expression<ToAux<T>> : never
295
302
 
296
303
  export type From<B> = B extends Builder<infer T> ? B['Types'] extends AnyTypes ? T : AnyTypes : never
297
304