@likec4/language-server 1.1.1 → 1.2.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 (173) hide show
  1. package/contrib/likec4.monarch.ts +4 -4
  2. package/contrib/likec4.tmLanguage.json +1 -1
  3. package/package.json +8 -10
  4. package/src/Rpc.ts +108 -0
  5. package/src/ast.ts +443 -0
  6. package/src/browser/index.ts +30 -0
  7. package/src/elementRef.ts +26 -0
  8. package/src/generated/ast.ts +1632 -0
  9. package/src/generated/grammar.ts +10 -0
  10. package/src/generated/module.ts +32 -0
  11. package/src/index.ts +4 -0
  12. package/src/like-c4.langium +395 -0
  13. package/src/logger.ts +54 -0
  14. package/src/lsp/CodeLensProvider.ts +51 -0
  15. package/src/lsp/DocumentHighlightProvider.ts +12 -0
  16. package/src/lsp/DocumentLinkProvider.test.ts +66 -0
  17. package/src/lsp/DocumentLinkProvider.ts +53 -0
  18. package/src/lsp/DocumentSymbolProvider.ts +201 -0
  19. package/src/lsp/HoverProvider.ts +58 -0
  20. package/{dist/lsp/SemanticTokenProvider.js → src/lsp/SemanticTokenProvider.ts} +58 -43
  21. package/src/lsp/index.ts +6 -0
  22. package/src/model/fqn-computation.ts +47 -0
  23. package/src/model/fqn-index.ts +161 -0
  24. package/src/model/index.ts +5 -0
  25. package/src/model/model-builder.ts +447 -0
  26. package/src/model/model-locator.ts +130 -0
  27. package/src/model/model-parser.ts +580 -0
  28. package/src/model-change/ModelChanges.ts +120 -0
  29. package/src/model-change/changeElementStyle.ts +176 -0
  30. package/src/model-change/changeViewLayout.ts +41 -0
  31. package/src/module.ts +197 -0
  32. package/src/node/index.ts +20 -0
  33. package/src/protocol.ts +87 -0
  34. package/src/references/index.ts +2 -0
  35. package/src/references/scope-computation.ts +142 -0
  36. package/src/references/scope-provider.ts +166 -0
  37. package/src/shared/NodeKindProvider.ts +67 -0
  38. package/src/shared/WorkspaceManager.ts +39 -0
  39. package/src/shared/WorkspaceSymbolProvider.ts +3 -0
  40. package/src/shared/index.ts +3 -0
  41. package/src/test/index.ts +1 -0
  42. package/src/test/testServices.ts +119 -0
  43. package/src/utils/index.ts +1 -0
  44. package/src/utils/printDocs.ts +3 -0
  45. package/src/utils/stringHash.ts +6 -0
  46. package/src/validation/dynamic-view-rule.ts +35 -0
  47. package/src/validation/dynamic-view-step.ts +39 -0
  48. package/src/validation/element.ts +52 -0
  49. package/{dist/validation/index.js → src/validation/index.ts} +25 -17
  50. package/src/validation/property-checks.ts +17 -0
  51. package/src/validation/relation.ts +57 -0
  52. package/src/validation/specification.ts +118 -0
  53. package/src/validation/view-predicates/custom-element-expr.ts +21 -0
  54. package/src/validation/view-predicates/expanded-element.ts +34 -0
  55. package/src/validation/view-predicates/incoming.ts +19 -0
  56. package/src/validation/view-predicates/index.ts +4 -0
  57. package/src/validation/view-predicates/outgoing.ts +19 -0
  58. package/src/validation/view.ts +26 -0
  59. package/src/view-utils/assignNavigateTo.ts +30 -0
  60. package/src/view-utils/index.ts +3 -0
  61. package/src/view-utils/resolve-extended-views.ts +57 -0
  62. package/src/view-utils/resolve-relative-paths.ts +84 -0
  63. package/dist/Rpc.d.ts +0 -10
  64. package/dist/Rpc.js +0 -98
  65. package/dist/ast.d.ts +0 -133
  66. package/dist/ast.js +0 -267
  67. package/dist/browser/index.d.ts +0 -9
  68. package/dist/browser/index.js +0 -16
  69. package/dist/elementRef.d.ts +0 -12
  70. package/dist/elementRef.js +0 -15
  71. package/dist/generated/ast.d.ts +0 -559
  72. package/dist/generated/ast.js +0 -868
  73. package/dist/generated/grammar.d.ts +0 -7
  74. package/dist/generated/grammar.js +0 -3
  75. package/dist/generated/module.d.ts +0 -14
  76. package/dist/generated/module.js +0 -22
  77. package/dist/index.d.ts +0 -5
  78. package/dist/index.js +0 -2
  79. package/dist/logger.d.ts +0 -12
  80. package/dist/logger.js +0 -51
  81. package/dist/lsp/CodeLensProvider.d.ts +0 -10
  82. package/dist/lsp/CodeLensProvider.js +0 -37
  83. package/dist/lsp/DocumentHighlightProvider.d.ts +0 -10
  84. package/dist/lsp/DocumentHighlightProvider.js +0 -10
  85. package/dist/lsp/DocumentLinkProvider.d.ts +0 -11
  86. package/dist/lsp/DocumentLinkProvider.js +0 -41
  87. package/dist/lsp/DocumentLinkProvider.test.d.ts +0 -2
  88. package/dist/lsp/DocumentLinkProvider.test.js +0 -54
  89. package/dist/lsp/DocumentSymbolProvider.d.ts +0 -22
  90. package/dist/lsp/DocumentSymbolProvider.js +0 -184
  91. package/dist/lsp/HoverProvider.d.ts +0 -10
  92. package/dist/lsp/HoverProvider.js +0 -36
  93. package/dist/lsp/SemanticTokenProvider.d.ts +0 -8
  94. package/dist/lsp/index.d.ts +0 -7
  95. package/dist/lsp/index.js +0 -6
  96. package/dist/model/fqn-computation.d.ts +0 -4
  97. package/dist/model/fqn-computation.js +0 -43
  98. package/dist/model/fqn-index.d.ts +0 -26
  99. package/dist/model/fqn-index.js +0 -114
  100. package/dist/model/index.d.ts +0 -6
  101. package/dist/model/index.js +0 -5
  102. package/dist/model/model-builder.d.ts +0 -20
  103. package/dist/model/model-builder.js +0 -352
  104. package/dist/model/model-locator.d.ts +0 -22
  105. package/dist/model/model-locator.js +0 -119
  106. package/dist/model/model-parser.d.ts +0 -27
  107. package/dist/model/model-parser.js +0 -410
  108. package/dist/model-change/ModelChanges.d.ts +0 -15
  109. package/dist/model-change/ModelChanges.js +0 -100
  110. package/dist/model-change/changeElementStyle.d.ts +0 -15
  111. package/dist/model-change/changeElementStyle.js +0 -141
  112. package/dist/model-change/changeViewLayout.d.ts +0 -13
  113. package/dist/model-change/changeViewLayout.js +0 -30
  114. package/dist/module.d.ts +0 -59
  115. package/dist/module.js +0 -121
  116. package/dist/node/index.d.ts +0 -6
  117. package/dist/node/index.js +0 -13
  118. package/dist/protocol.d.ts +0 -58
  119. package/dist/protocol.js +0 -14
  120. package/dist/references/index.d.ts +0 -3
  121. package/dist/references/index.js +0 -2
  122. package/dist/references/scope-computation.d.ts +0 -11
  123. package/dist/references/scope-computation.js +0 -108
  124. package/dist/references/scope-provider.d.ts +0 -18
  125. package/dist/references/scope-provider.js +0 -136
  126. package/dist/shared/NodeKindProvider.d.ts +0 -16
  127. package/dist/shared/NodeKindProvider.js +0 -58
  128. package/dist/shared/WorkspaceManager.d.ts +0 -17
  129. package/dist/shared/WorkspaceManager.js +0 -29
  130. package/dist/shared/WorkspaceSymbolProvider.d.ts +0 -4
  131. package/dist/shared/WorkspaceSymbolProvider.js +0 -3
  132. package/dist/shared/index.d.ts +0 -4
  133. package/dist/shared/index.js +0 -3
  134. package/dist/test/index.d.ts +0 -2
  135. package/dist/test/index.js +0 -1
  136. package/dist/test/testServices.d.ts +0 -23
  137. package/dist/test/testServices.js +0 -102
  138. package/dist/utils/index.d.ts +0 -2
  139. package/dist/utils/index.js +0 -1
  140. package/dist/utils/printDocs.d.ts +0 -3
  141. package/dist/utils/printDocs.js +0 -1
  142. package/dist/utils/stringHash.d.ts +0 -2
  143. package/dist/utils/stringHash.js +0 -5
  144. package/dist/validation/element.d.ts +0 -6
  145. package/dist/validation/element.js +0 -38
  146. package/dist/validation/index.d.ts +0 -3
  147. package/dist/validation/property-checks.d.ts +0 -5
  148. package/dist/validation/property-checks.js +0 -11
  149. package/dist/validation/relation.d.ts +0 -5
  150. package/dist/validation/relation.js +0 -50
  151. package/dist/validation/specification.d.ts +0 -10
  152. package/dist/validation/specification.js +0 -97
  153. package/dist/validation/view-predicates/custom-element-expr.d.ts +0 -5
  154. package/dist/validation/view-predicates/custom-element-expr.js +0 -16
  155. package/dist/validation/view-predicates/expanded-element.d.ts +0 -5
  156. package/dist/validation/view-predicates/expanded-element.js +0 -28
  157. package/dist/validation/view-predicates/incoming.d.ts +0 -5
  158. package/dist/validation/view-predicates/incoming.js +0 -14
  159. package/dist/validation/view-predicates/index.d.ts +0 -5
  160. package/dist/validation/view-predicates/index.js +0 -4
  161. package/dist/validation/view-predicates/outgoing.d.ts +0 -5
  162. package/dist/validation/view-predicates/outgoing.js +0 -14
  163. package/dist/validation/view.d.ts +0 -5
  164. package/dist/validation/view.js +0 -18
  165. package/dist/view-utils/assignNavigateTo.d.ts +0 -3
  166. package/dist/view-utils/assignNavigateTo.js +0 -23
  167. package/dist/view-utils/index.d.ts +0 -4
  168. package/dist/view-utils/index.js +0 -3
  169. package/dist/view-utils/resolve-extended-views.d.ts +0 -7
  170. package/dist/view-utils/resolve-extended-views.js +0 -41
  171. package/dist/view-utils/resolve-relative-paths.d.ts +0 -3
  172. package/dist/view-utils/resolve-relative-paths.js +0 -76
  173. /package/{dist → src}/reset.d.ts +0 -0
@@ -0,0 +1,1632 @@
1
+ /******************************************************************************
2
+ * This file was generated by langium-cli 3.0.3.
3
+ * DO NOT EDIT MANUALLY!
4
+ ******************************************************************************/
5
+
6
+ /* eslint-disable */
7
+ import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
8
+ import { AbstractAstReflection } from 'langium';
9
+
10
+ export const LikeC4Terminals = {
11
+ BLOCK_COMMENT: /\/\*[\s\S]*?\*\//,
12
+ LINE_COMMENT: /\/\/[^\n\r]*/,
13
+ WS: /\s+/,
14
+ URI_WITH_SCHEMA: /\w+:\/\/\S+/,
15
+ URI_RELATIVE: /\.{0,2}\/[^\/]\S+/,
16
+ DotUnderscore: /\b\._/,
17
+ DotWildcard: /\b\.\*/,
18
+ TagHash: /\#\b/,
19
+ Dot: /\b\./,
20
+ NotEqual: /\!\={1,2}/,
21
+ Eq: /\={1,2}/,
22
+ Colon: /:/,
23
+ SemiColon: /;/,
24
+ Comma: /,/,
25
+ Percent: /\b\d+%/,
26
+ String: /"[^"]*"|'[^']*'/,
27
+ IdTerminal: /\b[_]*[a-zA-Z][_-\w]*/,
28
+ };
29
+
30
+ export type ArrowType = 'crow' | 'diamond' | 'none' | 'normal' | 'odiamond' | 'onormal' | 'open' | 'vee';
31
+
32
+ export function isArrowType(item: unknown): item is ArrowType {
33
+ return item === 'none' || item === 'normal' || item === 'onormal' || item === 'diamond' || item === 'odiamond' || item === 'crow' || item === 'open' || item === 'vee';
34
+ }
35
+
36
+ export type BorderStyleValue = 'none' | LineOptions;
37
+
38
+ export function isBorderStyleValue(item: unknown): item is BorderStyleValue {
39
+ return isLineOptions(item) || item === 'none';
40
+ }
41
+
42
+ export type DynamicViewRule = DynamicViewRulePredicate | ViewRuleAutoLayout | ViewRuleStyle;
43
+
44
+ export const DynamicViewRule = 'DynamicViewRule';
45
+
46
+ export function isDynamicViewRule(item: unknown): item is DynamicViewRule {
47
+ return reflection.isInstance(item, DynamicViewRule);
48
+ }
49
+
50
+ export type ElementExpr = DescedantsExpr | ElementKindExpr | ElementRef | ElementTagExpr | ExpandElementExpr | WildcardExpr;
51
+
52
+ export const ElementExpr = 'ElementExpr';
53
+
54
+ export function isElementExpr(item: unknown): item is ElementExpr {
55
+ return reflection.isInstance(item, ElementExpr);
56
+ }
57
+
58
+ export type ElementProperty = ElementStringProperty | LinkProperty | StyleProperties;
59
+
60
+ export const ElementProperty = 'ElementProperty';
61
+
62
+ export function isElementProperty(item: unknown): item is ElementProperty {
63
+ return reflection.isInstance(item, ElementProperty);
64
+ }
65
+
66
+ export type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
67
+
68
+ export function isElementShape(item: unknown): item is ElementShape {
69
+ return item === 'rectangle' || item === 'person' || item === 'browser' || item === 'mobile' || item === 'cylinder' || item === 'storage' || item === 'queue';
70
+ }
71
+
72
+ export type Id = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
73
+
74
+ export function isId(item: unknown): item is Id {
75
+ return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/\b[_]*[a-zA-Z][_-\w]*/.test(item)));
76
+ }
77
+
78
+ export type LikeC4View = DynamicView | ElementView;
79
+
80
+ export const LikeC4View = 'LikeC4View';
81
+
82
+ export function isLikeC4View(item: unknown): item is LikeC4View {
83
+ return reflection.isInstance(item, LikeC4View);
84
+ }
85
+
86
+ export type LineOptions = 'dashed' | 'dotted' | 'solid';
87
+
88
+ export function isLineOptions(item: unknown): item is LineOptions {
89
+ return item === 'solid' || item === 'dashed' || item === 'dotted';
90
+ }
91
+
92
+ export type Relation = ExplicitRelation | ImplicitRelation;
93
+
94
+ export const Relation = 'Relation';
95
+
96
+ export function isRelation(item: unknown): item is Relation {
97
+ return reflection.isInstance(item, Relation);
98
+ }
99
+
100
+ export type RelationProperty = LinkProperty | RelationStringProperty | RelationStyleProperty;
101
+
102
+ export const RelationProperty = 'RelationProperty';
103
+
104
+ export function isRelationProperty(item: unknown): item is RelationProperty {
105
+ return reflection.isInstance(item, RelationProperty);
106
+ }
107
+
108
+ export type RelationshipStyleProperty = ArrowProperty | ColorProperty | LineProperty;
109
+
110
+ export const RelationshipStyleProperty = 'RelationshipStyleProperty';
111
+
112
+ export function isRelationshipStyleProperty(item: unknown): item is RelationshipStyleProperty {
113
+ return reflection.isInstance(item, RelationshipStyleProperty);
114
+ }
115
+
116
+ export type StyleProperty = BorderProperty | ColorProperty | IconProperty | OpacityProperty | ShapeProperty;
117
+
118
+ export const StyleProperty = 'StyleProperty';
119
+
120
+ export function isStyleProperty(item: unknown): item is StyleProperty {
121
+ return reflection.isInstance(item, StyleProperty);
122
+ }
123
+
124
+ export type TagId = string;
125
+
126
+ export function isTagId(item: unknown): item is TagId {
127
+ return typeof item === 'string';
128
+ }
129
+
130
+ export type ThemeColor = 'amber' | 'blue' | 'gray' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky' | 'slate';
131
+
132
+ export function isThemeColor(item: unknown): item is ThemeColor {
133
+ return item === 'primary' || item === 'secondary' || item === 'muted' || item === 'slate' || item === 'blue' || item === 'indigo' || item === 'sky' || item === 'red' || item === 'gray' || item === 'green' || item === 'amber';
134
+ }
135
+
136
+ export type Uri = string;
137
+
138
+ export function isUri(item: unknown): item is Uri {
139
+ return (typeof item === 'string' && (/\w+:\/\/\S+/.test(item) || /\.{0,2}\/[^\/]\S+/.test(item)));
140
+ }
141
+
142
+ export type ViewLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
143
+
144
+ export function isViewLayoutDirection(item: unknown): item is ViewLayoutDirection {
145
+ return item === 'TopBottom' || item === 'LeftRight' || item === 'BottomTop' || item === 'RightLeft';
146
+ }
147
+
148
+ export type ViewProperty = LinkProperty | ViewStringProperty;
149
+
150
+ export const ViewProperty = 'ViewProperty';
151
+
152
+ export function isViewProperty(item: unknown): item is ViewProperty {
153
+ return reflection.isInstance(item, ViewProperty);
154
+ }
155
+
156
+ export type ViewRule = ViewRuleAutoLayout | ViewRulePredicate | ViewRuleStyle;
157
+
158
+ export const ViewRule = 'ViewRule';
159
+
160
+ export function isViewRule(item: unknown): item is ViewRule {
161
+ return reflection.isInstance(item, ViewRule);
162
+ }
163
+
164
+ export type ViewRulePredicate = ExcludePredicate | IncludePredicate;
165
+
166
+ export const ViewRulePredicate = 'ViewRulePredicate';
167
+
168
+ export function isViewRulePredicate(item: unknown): item is ViewRulePredicate {
169
+ return reflection.isInstance(item, ViewRulePredicate);
170
+ }
171
+
172
+ export type ViewRulePredicateExpr = CustomElementExpr | ElementExpr | InOutExpr | IncomingExpr | OutgoingExpr | RelationExpr;
173
+
174
+ export const ViewRulePredicateExpr = 'ViewRulePredicateExpr';
175
+
176
+ export function isViewRulePredicateExpr(item: unknown): item is ViewRulePredicateExpr {
177
+ return reflection.isInstance(item, ViewRulePredicateExpr);
178
+ }
179
+
180
+ export interface ArrowProperty extends AstNode {
181
+ readonly $container: RelationStyleProperty | SpecificationRelationshipKind;
182
+ readonly $type: 'ArrowProperty';
183
+ key: 'head' | 'tail';
184
+ value: ArrowType;
185
+ }
186
+
187
+ export const ArrowProperty = 'ArrowProperty';
188
+
189
+ export function isArrowProperty(item: unknown): item is ArrowProperty {
190
+ return reflection.isInstance(item, ArrowProperty);
191
+ }
192
+
193
+ export interface BorderProperty extends AstNode {
194
+ readonly $container: CustomElementExprBody | StyleProperties | ViewRuleStyle;
195
+ readonly $type: 'BorderProperty';
196
+ key: 'border';
197
+ value: BorderStyleValue;
198
+ }
199
+
200
+ export const BorderProperty = 'BorderProperty';
201
+
202
+ export function isBorderProperty(item: unknown): item is BorderProperty {
203
+ return reflection.isInstance(item, BorderProperty);
204
+ }
205
+
206
+ export interface ColorProperty extends AstNode {
207
+ readonly $container: CustomElementExprBody | RelationStyleProperty | SpecificationRelationshipKind | StyleProperties | ViewRuleStyle;
208
+ readonly $type: 'ColorProperty';
209
+ key: 'color';
210
+ value: ThemeColor;
211
+ }
212
+
213
+ export const ColorProperty = 'ColorProperty';
214
+
215
+ export function isColorProperty(item: unknown): item is ColorProperty {
216
+ return reflection.isInstance(item, ColorProperty);
217
+ }
218
+
219
+ export interface CustomElementExpr extends AstNode {
220
+ readonly $container: DynamicViewRulePredicate | ExcludePredicate | IncludePredicate;
221
+ readonly $type: 'CustomElementExpr';
222
+ body: CustomElementExprBody;
223
+ target: ElementExpr;
224
+ }
225
+
226
+ export const CustomElementExpr = 'CustomElementExpr';
227
+
228
+ export function isCustomElementExpr(item: unknown): item is CustomElementExpr {
229
+ return reflection.isInstance(item, CustomElementExpr);
230
+ }
231
+
232
+ export interface CustomElementExprBody extends AstNode {
233
+ readonly $container: CustomElementExpr;
234
+ readonly $type: 'CustomElementExprBody';
235
+ props: Array<ElementStringProperty | NavigateToProperty | StyleProperty>;
236
+ }
237
+
238
+ export const CustomElementExprBody = 'CustomElementExprBody';
239
+
240
+ export function isCustomElementExprBody(item: unknown): item is CustomElementExprBody {
241
+ return reflection.isInstance(item, CustomElementExprBody);
242
+ }
243
+
244
+ export interface DescedantsExpr extends AstNode {
245
+ readonly $container: CustomElementExpr | DynamicViewRulePredicate | ExcludePredicate | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
246
+ readonly $type: 'DescedantsExpr';
247
+ parent: ElementRef;
248
+ }
249
+
250
+ export const DescedantsExpr = 'DescedantsExpr';
251
+
252
+ export function isDescedantsExpr(item: unknown): item is DescedantsExpr {
253
+ return reflection.isInstance(item, DescedantsExpr);
254
+ }
255
+
256
+ export interface DynamicView extends AstNode {
257
+ readonly $container: ModelViews;
258
+ readonly $type: 'DynamicView';
259
+ body: DynamicViewBody;
260
+ name: Id;
261
+ }
262
+
263
+ export const DynamicView = 'DynamicView';
264
+
265
+ export function isDynamicView(item: unknown): item is DynamicView {
266
+ return reflection.isInstance(item, DynamicView);
267
+ }
268
+
269
+ export interface DynamicViewBody extends AstNode {
270
+ readonly $container: DynamicView;
271
+ readonly $type: 'DynamicViewBody';
272
+ props: Array<ViewProperty>;
273
+ rules: Array<DynamicViewRule>;
274
+ steps: Array<DynamicViewStep>;
275
+ tags?: Tags;
276
+ }
277
+
278
+ export const DynamicViewBody = 'DynamicViewBody';
279
+
280
+ export function isDynamicViewBody(item: unknown): item is DynamicViewBody {
281
+ return reflection.isInstance(item, DynamicViewBody);
282
+ }
283
+
284
+ export interface DynamicViewRulePredicate extends AstNode {
285
+ readonly $container: DynamicViewBody;
286
+ readonly $type: 'DynamicViewRulePredicate';
287
+ expressions: Array<ViewRulePredicateExpr>;
288
+ }
289
+
290
+ export const DynamicViewRulePredicate = 'DynamicViewRulePredicate';
291
+
292
+ export function isDynamicViewRulePredicate(item: unknown): item is DynamicViewRulePredicate {
293
+ return reflection.isInstance(item, DynamicViewRulePredicate);
294
+ }
295
+
296
+ export interface DynamicViewStep extends AstNode {
297
+ readonly $container: DynamicViewBody;
298
+ readonly $type: 'DynamicViewStep';
299
+ isBackward: boolean;
300
+ kind?: Reference<RelationshipKind>;
301
+ source: ElementRef;
302
+ target: ElementRef;
303
+ title?: string;
304
+ }
305
+
306
+ export const DynamicViewStep = 'DynamicViewStep';
307
+
308
+ export function isDynamicViewStep(item: unknown): item is DynamicViewStep {
309
+ return reflection.isInstance(item, DynamicViewStep);
310
+ }
311
+
312
+ export interface Element extends AstNode {
313
+ readonly $container: ElementBody | ExtendElementBody | Model;
314
+ readonly $type: 'Element';
315
+ body?: ElementBody;
316
+ kind: Reference<ElementKind>;
317
+ name: Id;
318
+ props: Array<string>;
319
+ }
320
+
321
+ export const Element = 'Element';
322
+
323
+ export function isElement(item: unknown): item is Element {
324
+ return reflection.isInstance(item, Element);
325
+ }
326
+
327
+ export interface ElementBody extends AstNode {
328
+ readonly $container: Element;
329
+ readonly $type: 'ElementBody';
330
+ elements: Array<Element | Relation>;
331
+ props: Array<ElementProperty>;
332
+ tags?: Tags;
333
+ }
334
+
335
+ export const ElementBody = 'ElementBody';
336
+
337
+ export function isElementBody(item: unknown): item is ElementBody {
338
+ return reflection.isInstance(item, ElementBody);
339
+ }
340
+
341
+ export interface ElementKind extends AstNode {
342
+ readonly $container: SpecificationElementKind;
343
+ readonly $type: 'ElementKind';
344
+ name: Id;
345
+ }
346
+
347
+ export const ElementKind = 'ElementKind';
348
+
349
+ export function isElementKind(item: unknown): item is ElementKind {
350
+ return reflection.isInstance(item, ElementKind);
351
+ }
352
+
353
+ export interface ElementKindExpr extends AstNode {
354
+ readonly $container: CustomElementExpr | DynamicViewRulePredicate | ExcludePredicate | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
355
+ readonly $type: 'ElementKindExpr';
356
+ isEqual: boolean;
357
+ kind: Reference<ElementKind>;
358
+ }
359
+
360
+ export const ElementKindExpr = 'ElementKindExpr';
361
+
362
+ export function isElementKindExpr(item: unknown): item is ElementKindExpr {
363
+ return reflection.isInstance(item, ElementKindExpr);
364
+ }
365
+
366
+ export interface ElementRef extends AstNode {
367
+ readonly $container: CustomElementExpr | DescedantsExpr | DynamicViewRulePredicate | DynamicViewStep | ElementRef | ElementView | ExcludePredicate | ExpandElementExpr | ExplicitRelation | ImplicitRelation | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
368
+ readonly $type: 'ElementRef';
369
+ el: Reference<Element>;
370
+ parent?: ElementRef;
371
+ }
372
+
373
+ export const ElementRef = 'ElementRef';
374
+
375
+ export function isElementRef(item: unknown): item is ElementRef {
376
+ return reflection.isInstance(item, ElementRef);
377
+ }
378
+
379
+ export interface ElementStringProperty extends AstNode {
380
+ readonly $container: CustomElementExprBody | ElementBody;
381
+ readonly $type: 'ElementStringProperty';
382
+ key: 'description' | 'technology' | 'title';
383
+ value: string;
384
+ }
385
+
386
+ export const ElementStringProperty = 'ElementStringProperty';
387
+
388
+ export function isElementStringProperty(item: unknown): item is ElementStringProperty {
389
+ return reflection.isInstance(item, ElementStringProperty);
390
+ }
391
+
392
+ export interface ElementTagExpr extends AstNode {
393
+ readonly $container: CustomElementExpr | DynamicViewRulePredicate | ExcludePredicate | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
394
+ readonly $type: 'ElementTagExpr';
395
+ isEqual: boolean;
396
+ tag: Reference<Tag>;
397
+ }
398
+
399
+ export const ElementTagExpr = 'ElementTagExpr';
400
+
401
+ export function isElementTagExpr(item: unknown): item is ElementTagExpr {
402
+ return reflection.isInstance(item, ElementTagExpr);
403
+ }
404
+
405
+ export interface ElementView extends AstNode {
406
+ readonly $container: ModelViews;
407
+ readonly $type: 'ElementView';
408
+ body: ElementViewBody;
409
+ extends?: ElementViewRef;
410
+ name?: Id;
411
+ viewOf?: ElementRef;
412
+ }
413
+
414
+ export const ElementView = 'ElementView';
415
+
416
+ export function isElementView(item: unknown): item is ElementView {
417
+ return reflection.isInstance(item, ElementView);
418
+ }
419
+
420
+ export interface ElementViewBody extends AstNode {
421
+ readonly $container: ElementView;
422
+ readonly $type: 'ElementViewBody';
423
+ props: Array<ViewProperty>;
424
+ rules: Array<ViewRule>;
425
+ tags?: Tags;
426
+ }
427
+
428
+ export const ElementViewBody = 'ElementViewBody';
429
+
430
+ export function isElementViewBody(item: unknown): item is ElementViewBody {
431
+ return reflection.isInstance(item, ElementViewBody);
432
+ }
433
+
434
+ export interface ElementViewRef extends AstNode {
435
+ readonly $container: ElementView;
436
+ readonly $type: 'ElementViewRef';
437
+ view: Reference<ElementView>;
438
+ }
439
+
440
+ export const ElementViewRef = 'ElementViewRef';
441
+
442
+ export function isElementViewRef(item: unknown): item is ElementViewRef {
443
+ return reflection.isInstance(item, ElementViewRef);
444
+ }
445
+
446
+ export interface ExcludePredicate extends AstNode {
447
+ readonly $container: ElementViewBody;
448
+ readonly $type: 'ExcludePredicate';
449
+ expressions: Array<ViewRulePredicateExpr>;
450
+ }
451
+
452
+ export const ExcludePredicate = 'ExcludePredicate';
453
+
454
+ export function isExcludePredicate(item: unknown): item is ExcludePredicate {
455
+ return reflection.isInstance(item, ExcludePredicate);
456
+ }
457
+
458
+ export interface ExpandElementExpr extends AstNode {
459
+ readonly $container: CustomElementExpr | DynamicViewRulePredicate | ExcludePredicate | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
460
+ readonly $type: 'ExpandElementExpr';
461
+ parent: ElementRef;
462
+ }
463
+
464
+ export const ExpandElementExpr = 'ExpandElementExpr';
465
+
466
+ export function isExpandElementExpr(item: unknown): item is ExpandElementExpr {
467
+ return reflection.isInstance(item, ExpandElementExpr);
468
+ }
469
+
470
+ export interface ExplicitRelation extends AstNode {
471
+ readonly $container: ElementBody | ExtendElementBody | Model;
472
+ readonly $type: 'ExplicitRelation';
473
+ body?: RelationBody;
474
+ kind?: Reference<RelationshipKind>;
475
+ source: ElementRef;
476
+ tags?: Tags;
477
+ target: ElementRef;
478
+ title?: string;
479
+ }
480
+
481
+ export const ExplicitRelation = 'ExplicitRelation';
482
+
483
+ export function isExplicitRelation(item: unknown): item is ExplicitRelation {
484
+ return reflection.isInstance(item, ExplicitRelation);
485
+ }
486
+
487
+ export interface ExtendElement extends AstNode {
488
+ readonly $container: Model;
489
+ readonly $type: 'ExtendElement';
490
+ body: ExtendElementBody;
491
+ element: FqnElementRef;
492
+ }
493
+
494
+ export const ExtendElement = 'ExtendElement';
495
+
496
+ export function isExtendElement(item: unknown): item is ExtendElement {
497
+ return reflection.isInstance(item, ExtendElement);
498
+ }
499
+
500
+ export interface ExtendElementBody extends AstNode {
501
+ readonly $container: ExtendElement;
502
+ readonly $type: 'ExtendElementBody';
503
+ elements: Array<Element | ExplicitRelation>;
504
+ }
505
+
506
+ export const ExtendElementBody = 'ExtendElementBody';
507
+
508
+ export function isExtendElementBody(item: unknown): item is ExtendElementBody {
509
+ return reflection.isInstance(item, ExtendElementBody);
510
+ }
511
+
512
+ export interface FqnElementRef extends AstNode {
513
+ readonly $container: ExtendElement | FqnElementRef;
514
+ readonly $type: 'FqnElementRef';
515
+ el: Reference<Element>;
516
+ parent?: FqnElementRef;
517
+ }
518
+
519
+ export const FqnElementRef = 'FqnElementRef';
520
+
521
+ export function isFqnElementRef(item: unknown): item is FqnElementRef {
522
+ return reflection.isInstance(item, FqnElementRef);
523
+ }
524
+
525
+ export interface IconProperty extends AstNode {
526
+ readonly $container: CustomElementExprBody | StyleProperties | ViewRuleStyle;
527
+ readonly $type: 'IconProperty';
528
+ key: 'icon';
529
+ value: Uri;
530
+ }
531
+
532
+ export const IconProperty = 'IconProperty';
533
+
534
+ export function isIconProperty(item: unknown): item is IconProperty {
535
+ return reflection.isInstance(item, IconProperty);
536
+ }
537
+
538
+ export interface ImplicitRelation extends AstNode {
539
+ readonly $container: ElementBody;
540
+ readonly $type: 'ImplicitRelation';
541
+ body?: RelationBody;
542
+ kind?: Reference<RelationshipKind>;
543
+ tags?: Tags;
544
+ target: ElementRef;
545
+ title?: string;
546
+ }
547
+
548
+ export const ImplicitRelation = 'ImplicitRelation';
549
+
550
+ export function isImplicitRelation(item: unknown): item is ImplicitRelation {
551
+ return reflection.isInstance(item, ImplicitRelation);
552
+ }
553
+
554
+ export interface IncludePredicate extends AstNode {
555
+ readonly $container: ElementViewBody;
556
+ readonly $type: 'IncludePredicate';
557
+ expressions: Array<ViewRulePredicateExpr>;
558
+ }
559
+
560
+ export const IncludePredicate = 'IncludePredicate';
561
+
562
+ export function isIncludePredicate(item: unknown): item is IncludePredicate {
563
+ return reflection.isInstance(item, IncludePredicate);
564
+ }
565
+
566
+ export interface IncomingExpr extends AstNode {
567
+ readonly $container: DynamicViewRulePredicate | ExcludePredicate | InOutExpr | IncludePredicate;
568
+ readonly $type: 'IncomingExpr';
569
+ to: ElementExpr;
570
+ }
571
+
572
+ export const IncomingExpr = 'IncomingExpr';
573
+
574
+ export function isIncomingExpr(item: unknown): item is IncomingExpr {
575
+ return reflection.isInstance(item, IncomingExpr);
576
+ }
577
+
578
+ export interface InOutExpr extends AstNode {
579
+ readonly $container: DynamicViewRulePredicate | ExcludePredicate | IncludePredicate;
580
+ readonly $type: 'InOutExpr';
581
+ inout: IncomingExpr;
582
+ }
583
+
584
+ export const InOutExpr = 'InOutExpr';
585
+
586
+ export function isInOutExpr(item: unknown): item is InOutExpr {
587
+ return reflection.isInstance(item, InOutExpr);
588
+ }
589
+
590
+ export interface LikeC4Grammar extends AstNode {
591
+ readonly $type: 'LikeC4Grammar';
592
+ models: Array<Model>;
593
+ specifications: Array<SpecificationRule>;
594
+ views: Array<ModelViews>;
595
+ }
596
+
597
+ export const LikeC4Grammar = 'LikeC4Grammar';
598
+
599
+ export function isLikeC4Grammar(item: unknown): item is LikeC4Grammar {
600
+ return reflection.isInstance(item, LikeC4Grammar);
601
+ }
602
+
603
+ export interface LineProperty extends AstNode {
604
+ readonly $container: RelationStyleProperty | SpecificationRelationshipKind;
605
+ readonly $type: 'LineProperty';
606
+ key: 'line';
607
+ value: LineOptions;
608
+ }
609
+
610
+ export const LineProperty = 'LineProperty';
611
+
612
+ export function isLineProperty(item: unknown): item is LineProperty {
613
+ return reflection.isInstance(item, LineProperty);
614
+ }
615
+
616
+ export interface LinkProperty extends AstNode {
617
+ readonly $container: DynamicViewBody | ElementBody | ElementViewBody | RelationBody;
618
+ readonly $type: 'LinkProperty';
619
+ key: 'link';
620
+ value: Uri;
621
+ }
622
+
623
+ export const LinkProperty = 'LinkProperty';
624
+
625
+ export function isLinkProperty(item: unknown): item is LinkProperty {
626
+ return reflection.isInstance(item, LinkProperty);
627
+ }
628
+
629
+ export interface Model extends AstNode {
630
+ readonly $container: LikeC4Grammar;
631
+ readonly $type: 'Model';
632
+ elements: Array<Element | ExplicitRelation | ExtendElement>;
633
+ name: 'model';
634
+ }
635
+
636
+ export const Model = 'Model';
637
+
638
+ export function isModel(item: unknown): item is Model {
639
+ return reflection.isInstance(item, Model);
640
+ }
641
+
642
+ export interface ModelViews extends AstNode {
643
+ readonly $container: LikeC4Grammar;
644
+ readonly $type: 'ModelViews';
645
+ name: 'views';
646
+ views: Array<DynamicView | ElementView>;
647
+ }
648
+
649
+ export const ModelViews = 'ModelViews';
650
+
651
+ export function isModelViews(item: unknown): item is ModelViews {
652
+ return reflection.isInstance(item, ModelViews);
653
+ }
654
+
655
+ export interface NavigateToProperty extends AstNode {
656
+ readonly $container: CustomElementExprBody;
657
+ readonly $type: 'NavigateToProperty';
658
+ value: ViewRef;
659
+ }
660
+
661
+ export const NavigateToProperty = 'NavigateToProperty';
662
+
663
+ export function isNavigateToProperty(item: unknown): item is NavigateToProperty {
664
+ return reflection.isInstance(item, NavigateToProperty);
665
+ }
666
+
667
+ export interface OpacityProperty extends AstNode {
668
+ readonly $container: CustomElementExprBody | StyleProperties | ViewRuleStyle;
669
+ readonly $type: 'OpacityProperty';
670
+ key: 'opacity';
671
+ value: string;
672
+ }
673
+
674
+ export const OpacityProperty = 'OpacityProperty';
675
+
676
+ export function isOpacityProperty(item: unknown): item is OpacityProperty {
677
+ return reflection.isInstance(item, OpacityProperty);
678
+ }
679
+
680
+ export interface OutgoingExpr extends AstNode {
681
+ readonly $container: DynamicViewRulePredicate | ExcludePredicate | IncludePredicate;
682
+ readonly $type: 'OutgoingExpr';
683
+ from: ElementExpr;
684
+ }
685
+
686
+ export const OutgoingExpr = 'OutgoingExpr';
687
+
688
+ export function isOutgoingExpr(item: unknown): item is OutgoingExpr {
689
+ return reflection.isInstance(item, OutgoingExpr);
690
+ }
691
+
692
+ export interface RelationBody extends AstNode {
693
+ readonly $container: ExplicitRelation | ImplicitRelation;
694
+ readonly $type: 'RelationBody';
695
+ props: Array<RelationProperty>;
696
+ tags?: Tags;
697
+ }
698
+
699
+ export const RelationBody = 'RelationBody';
700
+
701
+ export function isRelationBody(item: unknown): item is RelationBody {
702
+ return reflection.isInstance(item, RelationBody);
703
+ }
704
+
705
+ export interface RelationExpr extends AstNode {
706
+ readonly $container: DynamicViewRulePredicate | ExcludePredicate | IncludePredicate;
707
+ readonly $type: 'RelationExpr';
708
+ isBidirectional: boolean;
709
+ source: ElementExpr;
710
+ target: ElementExpr;
711
+ }
712
+
713
+ export const RelationExpr = 'RelationExpr';
714
+
715
+ export function isRelationExpr(item: unknown): item is RelationExpr {
716
+ return reflection.isInstance(item, RelationExpr);
717
+ }
718
+
719
+ export interface RelationshipKind extends AstNode {
720
+ readonly $container: SpecificationRelationshipKind;
721
+ readonly $type: 'RelationshipKind';
722
+ name: Id;
723
+ }
724
+
725
+ export const RelationshipKind = 'RelationshipKind';
726
+
727
+ export function isRelationshipKind(item: unknown): item is RelationshipKind {
728
+ return reflection.isInstance(item, RelationshipKind);
729
+ }
730
+
731
+ export interface RelationStringProperty extends AstNode {
732
+ readonly $container: RelationBody;
733
+ readonly $type: 'RelationStringProperty';
734
+ key: 'title';
735
+ value: string;
736
+ }
737
+
738
+ export const RelationStringProperty = 'RelationStringProperty';
739
+
740
+ export function isRelationStringProperty(item: unknown): item is RelationStringProperty {
741
+ return reflection.isInstance(item, RelationStringProperty);
742
+ }
743
+
744
+ export interface RelationStyleProperty extends AstNode {
745
+ readonly $container: RelationBody;
746
+ readonly $type: 'RelationStyleProperty';
747
+ key: 'style';
748
+ props: Array<RelationshipStyleProperty>;
749
+ }
750
+
751
+ export const RelationStyleProperty = 'RelationStyleProperty';
752
+
753
+ export function isRelationStyleProperty(item: unknown): item is RelationStyleProperty {
754
+ return reflection.isInstance(item, RelationStyleProperty);
755
+ }
756
+
757
+ export interface ShapeProperty extends AstNode {
758
+ readonly $container: CustomElementExprBody | StyleProperties | ViewRuleStyle;
759
+ readonly $type: 'ShapeProperty';
760
+ key: 'shape';
761
+ value: ElementShape;
762
+ }
763
+
764
+ export const ShapeProperty = 'ShapeProperty';
765
+
766
+ export function isShapeProperty(item: unknown): item is ShapeProperty {
767
+ return reflection.isInstance(item, ShapeProperty);
768
+ }
769
+
770
+ export interface SpecificationElementKind extends AstNode {
771
+ readonly $container: SpecificationRule;
772
+ readonly $type: 'SpecificationElementKind';
773
+ kind: ElementKind;
774
+ style?: StyleProperties;
775
+ }
776
+
777
+ export const SpecificationElementKind = 'SpecificationElementKind';
778
+
779
+ export function isSpecificationElementKind(item: unknown): item is SpecificationElementKind {
780
+ return reflection.isInstance(item, SpecificationElementKind);
781
+ }
782
+
783
+ export interface SpecificationRelationshipKind extends AstNode {
784
+ readonly $container: SpecificationRule;
785
+ readonly $type: 'SpecificationRelationshipKind';
786
+ kind: RelationshipKind;
787
+ props: Array<RelationshipStyleProperty>;
788
+ }
789
+
790
+ export const SpecificationRelationshipKind = 'SpecificationRelationshipKind';
791
+
792
+ export function isSpecificationRelationshipKind(item: unknown): item is SpecificationRelationshipKind {
793
+ return reflection.isInstance(item, SpecificationRelationshipKind);
794
+ }
795
+
796
+ export interface SpecificationRule extends AstNode {
797
+ readonly $container: LikeC4Grammar;
798
+ readonly $type: 'SpecificationRule';
799
+ elements: Array<SpecificationElementKind>;
800
+ name: 'specification';
801
+ relationships: Array<SpecificationRelationshipKind>;
802
+ tags: Array<SpecificationTag>;
803
+ }
804
+
805
+ export const SpecificationRule = 'SpecificationRule';
806
+
807
+ export function isSpecificationRule(item: unknown): item is SpecificationRule {
808
+ return reflection.isInstance(item, SpecificationRule);
809
+ }
810
+
811
+ export interface SpecificationTag extends AstNode {
812
+ readonly $container: SpecificationRule;
813
+ readonly $type: 'SpecificationTag';
814
+ tag: Tag;
815
+ }
816
+
817
+ export const SpecificationTag = 'SpecificationTag';
818
+
819
+ export function isSpecificationTag(item: unknown): item is SpecificationTag {
820
+ return reflection.isInstance(item, SpecificationTag);
821
+ }
822
+
823
+ export interface StyleProperties extends AstNode {
824
+ readonly $container: ElementBody | SpecificationElementKind;
825
+ readonly $type: 'StyleProperties';
826
+ key: 'style';
827
+ props: Array<StyleProperty>;
828
+ }
829
+
830
+ export const StyleProperties = 'StyleProperties';
831
+
832
+ export function isStyleProperties(item: unknown): item is StyleProperties {
833
+ return reflection.isInstance(item, StyleProperties);
834
+ }
835
+
836
+ export interface Tag extends AstNode {
837
+ readonly $container: SpecificationTag;
838
+ readonly $type: 'Tag';
839
+ name: Id;
840
+ }
841
+
842
+ export const Tag = 'Tag';
843
+
844
+ export function isTag(item: unknown): item is Tag {
845
+ return reflection.isInstance(item, Tag);
846
+ }
847
+
848
+ export interface Tags extends AstNode {
849
+ readonly $container: DynamicViewBody | ElementBody | ElementViewBody | ExplicitRelation | ImplicitRelation | RelationBody;
850
+ readonly $type: 'Tags';
851
+ value: Array<Reference<Tag>>;
852
+ }
853
+
854
+ export const Tags = 'Tags';
855
+
856
+ export function isTags(item: unknown): item is Tags {
857
+ return reflection.isInstance(item, Tags);
858
+ }
859
+
860
+ export interface ViewRef extends AstNode {
861
+ readonly $container: NavigateToProperty;
862
+ readonly $type: 'ViewRef';
863
+ view: Reference<LikeC4View>;
864
+ }
865
+
866
+ export const ViewRef = 'ViewRef';
867
+
868
+ export function isViewRef(item: unknown): item is ViewRef {
869
+ return reflection.isInstance(item, ViewRef);
870
+ }
871
+
872
+ export interface ViewRuleAutoLayout extends AstNode {
873
+ readonly $container: DynamicViewBody | ElementViewBody;
874
+ readonly $type: 'ViewRuleAutoLayout';
875
+ direction: ViewLayoutDirection;
876
+ }
877
+
878
+ export const ViewRuleAutoLayout = 'ViewRuleAutoLayout';
879
+
880
+ export function isViewRuleAutoLayout(item: unknown): item is ViewRuleAutoLayout {
881
+ return reflection.isInstance(item, ViewRuleAutoLayout);
882
+ }
883
+
884
+ export interface ViewRuleStyle extends AstNode {
885
+ readonly $container: DynamicViewBody | ElementViewBody;
886
+ readonly $type: 'ViewRuleStyle';
887
+ styleprops: Array<StyleProperty>;
888
+ targets: Array<ElementExpr>;
889
+ }
890
+
891
+ export const ViewRuleStyle = 'ViewRuleStyle';
892
+
893
+ export function isViewRuleStyle(item: unknown): item is ViewRuleStyle {
894
+ return reflection.isInstance(item, ViewRuleStyle);
895
+ }
896
+
897
+ export interface ViewStringProperty extends AstNode {
898
+ readonly $container: DynamicViewBody | ElementViewBody;
899
+ readonly $type: 'ViewStringProperty';
900
+ key: 'description' | 'title';
901
+ value: string;
902
+ }
903
+
904
+ export const ViewStringProperty = 'ViewStringProperty';
905
+
906
+ export function isViewStringProperty(item: unknown): item is ViewStringProperty {
907
+ return reflection.isInstance(item, ViewStringProperty);
908
+ }
909
+
910
+ export interface WildcardExpr extends AstNode {
911
+ readonly $container: CustomElementExpr | DynamicViewRulePredicate | ExcludePredicate | IncludePredicate | IncomingExpr | OutgoingExpr | RelationExpr | ViewRuleStyle;
912
+ readonly $type: 'WildcardExpr';
913
+ isWildcard: boolean;
914
+ }
915
+
916
+ export const WildcardExpr = 'WildcardExpr';
917
+
918
+ export function isWildcardExpr(item: unknown): item is WildcardExpr {
919
+ return reflection.isInstance(item, WildcardExpr);
920
+ }
921
+
922
+ export type LikeC4AstType = {
923
+ ArrowProperty: ArrowProperty
924
+ BorderProperty: BorderProperty
925
+ ColorProperty: ColorProperty
926
+ CustomElementExpr: CustomElementExpr
927
+ CustomElementExprBody: CustomElementExprBody
928
+ DescedantsExpr: DescedantsExpr
929
+ DynamicView: DynamicView
930
+ DynamicViewBody: DynamicViewBody
931
+ DynamicViewRule: DynamicViewRule
932
+ DynamicViewRulePredicate: DynamicViewRulePredicate
933
+ DynamicViewStep: DynamicViewStep
934
+ Element: Element
935
+ ElementBody: ElementBody
936
+ ElementExpr: ElementExpr
937
+ ElementKind: ElementKind
938
+ ElementKindExpr: ElementKindExpr
939
+ ElementProperty: ElementProperty
940
+ ElementRef: ElementRef
941
+ ElementStringProperty: ElementStringProperty
942
+ ElementTagExpr: ElementTagExpr
943
+ ElementView: ElementView
944
+ ElementViewBody: ElementViewBody
945
+ ElementViewRef: ElementViewRef
946
+ ExcludePredicate: ExcludePredicate
947
+ ExpandElementExpr: ExpandElementExpr
948
+ ExplicitRelation: ExplicitRelation
949
+ ExtendElement: ExtendElement
950
+ ExtendElementBody: ExtendElementBody
951
+ FqnElementRef: FqnElementRef
952
+ IconProperty: IconProperty
953
+ ImplicitRelation: ImplicitRelation
954
+ InOutExpr: InOutExpr
955
+ IncludePredicate: IncludePredicate
956
+ IncomingExpr: IncomingExpr
957
+ LikeC4Grammar: LikeC4Grammar
958
+ LikeC4View: LikeC4View
959
+ LineProperty: LineProperty
960
+ LinkProperty: LinkProperty
961
+ Model: Model
962
+ ModelViews: ModelViews
963
+ NavigateToProperty: NavigateToProperty
964
+ OpacityProperty: OpacityProperty
965
+ OutgoingExpr: OutgoingExpr
966
+ Relation: Relation
967
+ RelationBody: RelationBody
968
+ RelationExpr: RelationExpr
969
+ RelationProperty: RelationProperty
970
+ RelationStringProperty: RelationStringProperty
971
+ RelationStyleProperty: RelationStyleProperty
972
+ RelationshipKind: RelationshipKind
973
+ RelationshipStyleProperty: RelationshipStyleProperty
974
+ ShapeProperty: ShapeProperty
975
+ SpecificationElementKind: SpecificationElementKind
976
+ SpecificationRelationshipKind: SpecificationRelationshipKind
977
+ SpecificationRule: SpecificationRule
978
+ SpecificationTag: SpecificationTag
979
+ StyleProperties: StyleProperties
980
+ StyleProperty: StyleProperty
981
+ Tag: Tag
982
+ Tags: Tags
983
+ ViewProperty: ViewProperty
984
+ ViewRef: ViewRef
985
+ ViewRule: ViewRule
986
+ ViewRuleAutoLayout: ViewRuleAutoLayout
987
+ ViewRulePredicate: ViewRulePredicate
988
+ ViewRulePredicateExpr: ViewRulePredicateExpr
989
+ ViewRuleStyle: ViewRuleStyle
990
+ ViewStringProperty: ViewStringProperty
991
+ WildcardExpr: WildcardExpr
992
+ }
993
+
994
+ export class LikeC4AstReflection extends AbstractAstReflection {
995
+
996
+ getAllTypes(): string[] {
997
+ return ['ArrowProperty', 'BorderProperty', 'ColorProperty', 'CustomElementExpr', 'CustomElementExprBody', 'DescedantsExpr', 'DynamicView', 'DynamicViewBody', 'DynamicViewRule', 'DynamicViewRulePredicate', 'DynamicViewStep', 'Element', 'ElementBody', 'ElementExpr', 'ElementKind', 'ElementKindExpr', 'ElementProperty', 'ElementRef', 'ElementStringProperty', 'ElementTagExpr', 'ElementView', 'ElementViewBody', 'ElementViewRef', 'ExcludePredicate', 'ExpandElementExpr', 'ExplicitRelation', 'ExtendElement', 'ExtendElementBody', 'FqnElementRef', 'IconProperty', 'ImplicitRelation', 'InOutExpr', 'IncludePredicate', 'IncomingExpr', 'LikeC4Grammar', 'LikeC4View', 'LineProperty', 'LinkProperty', 'Model', 'ModelViews', 'NavigateToProperty', 'OpacityProperty', 'OutgoingExpr', 'Relation', 'RelationBody', 'RelationExpr', 'RelationProperty', 'RelationStringProperty', 'RelationStyleProperty', 'RelationshipKind', 'RelationshipStyleProperty', 'ShapeProperty', 'SpecificationElementKind', 'SpecificationRelationshipKind', 'SpecificationRule', 'SpecificationTag', 'StyleProperties', 'StyleProperty', 'Tag', 'Tags', 'ViewProperty', 'ViewRef', 'ViewRule', 'ViewRuleAutoLayout', 'ViewRulePredicate', 'ViewRulePredicateExpr', 'ViewRuleStyle', 'ViewStringProperty', 'WildcardExpr'];
998
+ }
999
+
1000
+ protected override computeIsSubtype(subtype: string, supertype: string): boolean {
1001
+ switch (subtype) {
1002
+ case ArrowProperty:
1003
+ case LineProperty: {
1004
+ return this.isSubtype(RelationshipStyleProperty, supertype);
1005
+ }
1006
+ case BorderProperty:
1007
+ case IconProperty:
1008
+ case OpacityProperty:
1009
+ case ShapeProperty: {
1010
+ return this.isSubtype(StyleProperty, supertype);
1011
+ }
1012
+ case ColorProperty: {
1013
+ return this.isSubtype(RelationshipStyleProperty, supertype) || this.isSubtype(StyleProperty, supertype);
1014
+ }
1015
+ case CustomElementExpr:
1016
+ case ElementExpr:
1017
+ case IncomingExpr:
1018
+ case InOutExpr:
1019
+ case OutgoingExpr:
1020
+ case RelationExpr: {
1021
+ return this.isSubtype(ViewRulePredicateExpr, supertype);
1022
+ }
1023
+ case DescedantsExpr:
1024
+ case ElementKindExpr:
1025
+ case ElementRef:
1026
+ case ElementTagExpr:
1027
+ case ExpandElementExpr:
1028
+ case WildcardExpr: {
1029
+ return this.isSubtype(ElementExpr, supertype);
1030
+ }
1031
+ case DynamicView:
1032
+ case ElementView: {
1033
+ return this.isSubtype(LikeC4View, supertype);
1034
+ }
1035
+ case DynamicViewRulePredicate: {
1036
+ return this.isSubtype(DynamicViewRule, supertype);
1037
+ }
1038
+ case ElementStringProperty:
1039
+ case StyleProperties: {
1040
+ return this.isSubtype(ElementProperty, supertype);
1041
+ }
1042
+ case ExcludePredicate:
1043
+ case IncludePredicate: {
1044
+ return this.isSubtype(ViewRulePredicate, supertype);
1045
+ }
1046
+ case ExplicitRelation:
1047
+ case ImplicitRelation: {
1048
+ return this.isSubtype(Relation, supertype);
1049
+ }
1050
+ case LinkProperty: {
1051
+ return this.isSubtype(ElementProperty, supertype) || this.isSubtype(RelationProperty, supertype) || this.isSubtype(ViewProperty, supertype);
1052
+ }
1053
+ case RelationStringProperty:
1054
+ case RelationStyleProperty: {
1055
+ return this.isSubtype(RelationProperty, supertype);
1056
+ }
1057
+ case ViewRuleAutoLayout:
1058
+ case ViewRuleStyle: {
1059
+ return this.isSubtype(DynamicViewRule, supertype) || this.isSubtype(ViewRule, supertype);
1060
+ }
1061
+ case ViewRulePredicate: {
1062
+ return this.isSubtype(ViewRule, supertype);
1063
+ }
1064
+ case ViewStringProperty: {
1065
+ return this.isSubtype(ViewProperty, supertype);
1066
+ }
1067
+ default: {
1068
+ return false;
1069
+ }
1070
+ }
1071
+ }
1072
+
1073
+ getReferenceType(refInfo: ReferenceInfo): string {
1074
+ const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
1075
+ switch (referenceId) {
1076
+ case 'DynamicViewStep:kind':
1077
+ case 'ExplicitRelation:kind':
1078
+ case 'ImplicitRelation:kind': {
1079
+ return RelationshipKind;
1080
+ }
1081
+ case 'Element:kind':
1082
+ case 'ElementKindExpr:kind': {
1083
+ return ElementKind;
1084
+ }
1085
+ case 'ElementRef:el':
1086
+ case 'FqnElementRef:el': {
1087
+ return Element;
1088
+ }
1089
+ case 'ElementTagExpr:tag':
1090
+ case 'Tags:value': {
1091
+ return Tag;
1092
+ }
1093
+ case 'ElementViewRef:view': {
1094
+ return ElementView;
1095
+ }
1096
+ case 'ViewRef:view': {
1097
+ return LikeC4View;
1098
+ }
1099
+ default: {
1100
+ throw new Error(`${referenceId} is not a valid reference id.`);
1101
+ }
1102
+ }
1103
+ }
1104
+
1105
+ getTypeMetaData(type: string): TypeMetaData {
1106
+ switch (type) {
1107
+ case 'ArrowProperty': {
1108
+ return {
1109
+ name: 'ArrowProperty',
1110
+ properties: [
1111
+ { name: 'key' },
1112
+ { name: 'value' }
1113
+ ]
1114
+ };
1115
+ }
1116
+ case 'BorderProperty': {
1117
+ return {
1118
+ name: 'BorderProperty',
1119
+ properties: [
1120
+ { name: 'key' },
1121
+ { name: 'value' }
1122
+ ]
1123
+ };
1124
+ }
1125
+ case 'ColorProperty': {
1126
+ return {
1127
+ name: 'ColorProperty',
1128
+ properties: [
1129
+ { name: 'key' },
1130
+ { name: 'value' }
1131
+ ]
1132
+ };
1133
+ }
1134
+ case 'CustomElementExpr': {
1135
+ return {
1136
+ name: 'CustomElementExpr',
1137
+ properties: [
1138
+ { name: 'body' },
1139
+ { name: 'target' }
1140
+ ]
1141
+ };
1142
+ }
1143
+ case 'CustomElementExprBody': {
1144
+ return {
1145
+ name: 'CustomElementExprBody',
1146
+ properties: [
1147
+ { name: 'props', defaultValue: [] }
1148
+ ]
1149
+ };
1150
+ }
1151
+ case 'DescedantsExpr': {
1152
+ return {
1153
+ name: 'DescedantsExpr',
1154
+ properties: [
1155
+ { name: 'parent' }
1156
+ ]
1157
+ };
1158
+ }
1159
+ case 'DynamicView': {
1160
+ return {
1161
+ name: 'DynamicView',
1162
+ properties: [
1163
+ { name: 'body' },
1164
+ { name: 'name' }
1165
+ ]
1166
+ };
1167
+ }
1168
+ case 'DynamicViewBody': {
1169
+ return {
1170
+ name: 'DynamicViewBody',
1171
+ properties: [
1172
+ { name: 'props', defaultValue: [] },
1173
+ { name: 'rules', defaultValue: [] },
1174
+ { name: 'steps', defaultValue: [] },
1175
+ { name: 'tags' }
1176
+ ]
1177
+ };
1178
+ }
1179
+ case 'DynamicViewRulePredicate': {
1180
+ return {
1181
+ name: 'DynamicViewRulePredicate',
1182
+ properties: [
1183
+ { name: 'expressions', defaultValue: [] }
1184
+ ]
1185
+ };
1186
+ }
1187
+ case 'DynamicViewStep': {
1188
+ return {
1189
+ name: 'DynamicViewStep',
1190
+ properties: [
1191
+ { name: 'isBackward', defaultValue: false },
1192
+ { name: 'kind' },
1193
+ { name: 'source' },
1194
+ { name: 'target' },
1195
+ { name: 'title' }
1196
+ ]
1197
+ };
1198
+ }
1199
+ case 'Element': {
1200
+ return {
1201
+ name: 'Element',
1202
+ properties: [
1203
+ { name: 'body' },
1204
+ { name: 'kind' },
1205
+ { name: 'name' },
1206
+ { name: 'props' }
1207
+ ]
1208
+ };
1209
+ }
1210
+ case 'ElementBody': {
1211
+ return {
1212
+ name: 'ElementBody',
1213
+ properties: [
1214
+ { name: 'elements', defaultValue: [] },
1215
+ { name: 'props', defaultValue: [] },
1216
+ { name: 'tags' }
1217
+ ]
1218
+ };
1219
+ }
1220
+ case 'ElementKind': {
1221
+ return {
1222
+ name: 'ElementKind',
1223
+ properties: [
1224
+ { name: 'name' }
1225
+ ]
1226
+ };
1227
+ }
1228
+ case 'ElementKindExpr': {
1229
+ return {
1230
+ name: 'ElementKindExpr',
1231
+ properties: [
1232
+ { name: 'isEqual', defaultValue: false },
1233
+ { name: 'kind' }
1234
+ ]
1235
+ };
1236
+ }
1237
+ case 'ElementRef': {
1238
+ return {
1239
+ name: 'ElementRef',
1240
+ properties: [
1241
+ { name: 'el' },
1242
+ { name: 'parent' }
1243
+ ]
1244
+ };
1245
+ }
1246
+ case 'ElementStringProperty': {
1247
+ return {
1248
+ name: 'ElementStringProperty',
1249
+ properties: [
1250
+ { name: 'key' },
1251
+ { name: 'value' }
1252
+ ]
1253
+ };
1254
+ }
1255
+ case 'ElementTagExpr': {
1256
+ return {
1257
+ name: 'ElementTagExpr',
1258
+ properties: [
1259
+ { name: 'isEqual', defaultValue: false },
1260
+ { name: 'tag' }
1261
+ ]
1262
+ };
1263
+ }
1264
+ case 'ElementView': {
1265
+ return {
1266
+ name: 'ElementView',
1267
+ properties: [
1268
+ { name: 'body' },
1269
+ { name: 'extends' },
1270
+ { name: 'name' },
1271
+ { name: 'viewOf' }
1272
+ ]
1273
+ };
1274
+ }
1275
+ case 'ElementViewBody': {
1276
+ return {
1277
+ name: 'ElementViewBody',
1278
+ properties: [
1279
+ { name: 'props', defaultValue: [] },
1280
+ { name: 'rules', defaultValue: [] },
1281
+ { name: 'tags' }
1282
+ ]
1283
+ };
1284
+ }
1285
+ case 'ElementViewRef': {
1286
+ return {
1287
+ name: 'ElementViewRef',
1288
+ properties: [
1289
+ { name: 'view' }
1290
+ ]
1291
+ };
1292
+ }
1293
+ case 'ExcludePredicate': {
1294
+ return {
1295
+ name: 'ExcludePredicate',
1296
+ properties: [
1297
+ { name: 'expressions', defaultValue: [] }
1298
+ ]
1299
+ };
1300
+ }
1301
+ case 'ExpandElementExpr': {
1302
+ return {
1303
+ name: 'ExpandElementExpr',
1304
+ properties: [
1305
+ { name: 'parent' }
1306
+ ]
1307
+ };
1308
+ }
1309
+ case 'ExplicitRelation': {
1310
+ return {
1311
+ name: 'ExplicitRelation',
1312
+ properties: [
1313
+ { name: 'body' },
1314
+ { name: 'kind' },
1315
+ { name: 'source' },
1316
+ { name: 'tags' },
1317
+ { name: 'target' },
1318
+ { name: 'title' }
1319
+ ]
1320
+ };
1321
+ }
1322
+ case 'ExtendElement': {
1323
+ return {
1324
+ name: 'ExtendElement',
1325
+ properties: [
1326
+ { name: 'body' },
1327
+ { name: 'element' }
1328
+ ]
1329
+ };
1330
+ }
1331
+ case 'ExtendElementBody': {
1332
+ return {
1333
+ name: 'ExtendElementBody',
1334
+ properties: [
1335
+ { name: 'elements', defaultValue: [] }
1336
+ ]
1337
+ };
1338
+ }
1339
+ case 'FqnElementRef': {
1340
+ return {
1341
+ name: 'FqnElementRef',
1342
+ properties: [
1343
+ { name: 'el' },
1344
+ { name: 'parent' }
1345
+ ]
1346
+ };
1347
+ }
1348
+ case 'IconProperty': {
1349
+ return {
1350
+ name: 'IconProperty',
1351
+ properties: [
1352
+ { name: 'key' },
1353
+ { name: 'value' }
1354
+ ]
1355
+ };
1356
+ }
1357
+ case 'ImplicitRelation': {
1358
+ return {
1359
+ name: 'ImplicitRelation',
1360
+ properties: [
1361
+ { name: 'body' },
1362
+ { name: 'kind' },
1363
+ { name: 'tags' },
1364
+ { name: 'target' },
1365
+ { name: 'title' }
1366
+ ]
1367
+ };
1368
+ }
1369
+ case 'IncludePredicate': {
1370
+ return {
1371
+ name: 'IncludePredicate',
1372
+ properties: [
1373
+ { name: 'expressions', defaultValue: [] }
1374
+ ]
1375
+ };
1376
+ }
1377
+ case 'IncomingExpr': {
1378
+ return {
1379
+ name: 'IncomingExpr',
1380
+ properties: [
1381
+ { name: 'to' }
1382
+ ]
1383
+ };
1384
+ }
1385
+ case 'InOutExpr': {
1386
+ return {
1387
+ name: 'InOutExpr',
1388
+ properties: [
1389
+ { name: 'inout' }
1390
+ ]
1391
+ };
1392
+ }
1393
+ case 'LikeC4Grammar': {
1394
+ return {
1395
+ name: 'LikeC4Grammar',
1396
+ properties: [
1397
+ { name: 'models', defaultValue: [] },
1398
+ { name: 'specifications', defaultValue: [] },
1399
+ { name: 'views', defaultValue: [] }
1400
+ ]
1401
+ };
1402
+ }
1403
+ case 'LineProperty': {
1404
+ return {
1405
+ name: 'LineProperty',
1406
+ properties: [
1407
+ { name: 'key' },
1408
+ { name: 'value' }
1409
+ ]
1410
+ };
1411
+ }
1412
+ case 'LinkProperty': {
1413
+ return {
1414
+ name: 'LinkProperty',
1415
+ properties: [
1416
+ { name: 'key' },
1417
+ { name: 'value' }
1418
+ ]
1419
+ };
1420
+ }
1421
+ case 'Model': {
1422
+ return {
1423
+ name: 'Model',
1424
+ properties: [
1425
+ { name: 'elements', defaultValue: [] },
1426
+ { name: 'name' }
1427
+ ]
1428
+ };
1429
+ }
1430
+ case 'ModelViews': {
1431
+ return {
1432
+ name: 'ModelViews',
1433
+ properties: [
1434
+ { name: 'name' },
1435
+ { name: 'views', defaultValue: [] }
1436
+ ]
1437
+ };
1438
+ }
1439
+ case 'NavigateToProperty': {
1440
+ return {
1441
+ name: 'NavigateToProperty',
1442
+ properties: [
1443
+ { name: 'value' }
1444
+ ]
1445
+ };
1446
+ }
1447
+ case 'OpacityProperty': {
1448
+ return {
1449
+ name: 'OpacityProperty',
1450
+ properties: [
1451
+ { name: 'key' },
1452
+ { name: 'value' }
1453
+ ]
1454
+ };
1455
+ }
1456
+ case 'OutgoingExpr': {
1457
+ return {
1458
+ name: 'OutgoingExpr',
1459
+ properties: [
1460
+ { name: 'from' }
1461
+ ]
1462
+ };
1463
+ }
1464
+ case 'RelationBody': {
1465
+ return {
1466
+ name: 'RelationBody',
1467
+ properties: [
1468
+ { name: 'props', defaultValue: [] },
1469
+ { name: 'tags' }
1470
+ ]
1471
+ };
1472
+ }
1473
+ case 'RelationExpr': {
1474
+ return {
1475
+ name: 'RelationExpr',
1476
+ properties: [
1477
+ { name: 'isBidirectional', defaultValue: false },
1478
+ { name: 'source' },
1479
+ { name: 'target' }
1480
+ ]
1481
+ };
1482
+ }
1483
+ case 'RelationshipKind': {
1484
+ return {
1485
+ name: 'RelationshipKind',
1486
+ properties: [
1487
+ { name: 'name' }
1488
+ ]
1489
+ };
1490
+ }
1491
+ case 'RelationStringProperty': {
1492
+ return {
1493
+ name: 'RelationStringProperty',
1494
+ properties: [
1495
+ { name: 'key' },
1496
+ { name: 'value' }
1497
+ ]
1498
+ };
1499
+ }
1500
+ case 'RelationStyleProperty': {
1501
+ return {
1502
+ name: 'RelationStyleProperty',
1503
+ properties: [
1504
+ { name: 'key' },
1505
+ { name: 'props', defaultValue: [] }
1506
+ ]
1507
+ };
1508
+ }
1509
+ case 'ShapeProperty': {
1510
+ return {
1511
+ name: 'ShapeProperty',
1512
+ properties: [
1513
+ { name: 'key' },
1514
+ { name: 'value' }
1515
+ ]
1516
+ };
1517
+ }
1518
+ case 'SpecificationElementKind': {
1519
+ return {
1520
+ name: 'SpecificationElementKind',
1521
+ properties: [
1522
+ { name: 'kind' },
1523
+ { name: 'style' }
1524
+ ]
1525
+ };
1526
+ }
1527
+ case 'SpecificationRelationshipKind': {
1528
+ return {
1529
+ name: 'SpecificationRelationshipKind',
1530
+ properties: [
1531
+ { name: 'kind' },
1532
+ { name: 'props', defaultValue: [] }
1533
+ ]
1534
+ };
1535
+ }
1536
+ case 'SpecificationRule': {
1537
+ return {
1538
+ name: 'SpecificationRule',
1539
+ properties: [
1540
+ { name: 'elements', defaultValue: [] },
1541
+ { name: 'name' },
1542
+ { name: 'relationships', defaultValue: [] },
1543
+ { name: 'tags', defaultValue: [] }
1544
+ ]
1545
+ };
1546
+ }
1547
+ case 'SpecificationTag': {
1548
+ return {
1549
+ name: 'SpecificationTag',
1550
+ properties: [
1551
+ { name: 'tag' }
1552
+ ]
1553
+ };
1554
+ }
1555
+ case 'StyleProperties': {
1556
+ return {
1557
+ name: 'StyleProperties',
1558
+ properties: [
1559
+ { name: 'key' },
1560
+ { name: 'props', defaultValue: [] }
1561
+ ]
1562
+ };
1563
+ }
1564
+ case 'Tag': {
1565
+ return {
1566
+ name: 'Tag',
1567
+ properties: [
1568
+ { name: 'name' }
1569
+ ]
1570
+ };
1571
+ }
1572
+ case 'Tags': {
1573
+ return {
1574
+ name: 'Tags',
1575
+ properties: [
1576
+ { name: 'value', defaultValue: [] }
1577
+ ]
1578
+ };
1579
+ }
1580
+ case 'ViewRef': {
1581
+ return {
1582
+ name: 'ViewRef',
1583
+ properties: [
1584
+ { name: 'view' }
1585
+ ]
1586
+ };
1587
+ }
1588
+ case 'ViewRuleAutoLayout': {
1589
+ return {
1590
+ name: 'ViewRuleAutoLayout',
1591
+ properties: [
1592
+ { name: 'direction' }
1593
+ ]
1594
+ };
1595
+ }
1596
+ case 'ViewRuleStyle': {
1597
+ return {
1598
+ name: 'ViewRuleStyle',
1599
+ properties: [
1600
+ { name: 'styleprops', defaultValue: [] },
1601
+ { name: 'targets', defaultValue: [] }
1602
+ ]
1603
+ };
1604
+ }
1605
+ case 'ViewStringProperty': {
1606
+ return {
1607
+ name: 'ViewStringProperty',
1608
+ properties: [
1609
+ { name: 'key' },
1610
+ { name: 'value' }
1611
+ ]
1612
+ };
1613
+ }
1614
+ case 'WildcardExpr': {
1615
+ return {
1616
+ name: 'WildcardExpr',
1617
+ properties: [
1618
+ { name: 'isWildcard', defaultValue: false }
1619
+ ]
1620
+ };
1621
+ }
1622
+ default: {
1623
+ return {
1624
+ name: type,
1625
+ properties: []
1626
+ };
1627
+ }
1628
+ }
1629
+ }
1630
+ }
1631
+
1632
+ export const reflection = new LikeC4AstReflection();