@likec4/language-server 1.2.0 → 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/package.json +8 -10
  2. package/src/Rpc.ts +108 -0
  3. package/src/ast.ts +443 -0
  4. package/src/browser/index.ts +30 -0
  5. package/src/elementRef.ts +26 -0
  6. package/src/generated/ast.ts +1632 -0
  7. package/src/generated/grammar.ts +10 -0
  8. package/src/generated/module.ts +32 -0
  9. package/src/index.ts +4 -0
  10. package/src/like-c4.langium +395 -0
  11. package/src/logger.ts +54 -0
  12. package/src/lsp/CodeLensProvider.ts +51 -0
  13. package/src/lsp/DocumentHighlightProvider.ts +12 -0
  14. package/src/lsp/DocumentLinkProvider.test.ts +66 -0
  15. package/src/lsp/DocumentLinkProvider.ts +53 -0
  16. package/src/lsp/DocumentSymbolProvider.ts +201 -0
  17. package/src/lsp/HoverProvider.ts +58 -0
  18. package/{dist/lsp/SemanticTokenProvider.js → src/lsp/SemanticTokenProvider.ts} +57 -42
  19. package/src/lsp/index.ts +6 -0
  20. package/src/model/fqn-computation.ts +47 -0
  21. package/src/model/fqn-index.ts +161 -0
  22. package/src/model/index.ts +5 -0
  23. package/src/model/model-builder.ts +447 -0
  24. package/src/model/model-locator.ts +130 -0
  25. package/src/model/model-parser.ts +580 -0
  26. package/src/model-change/ModelChanges.ts +120 -0
  27. package/src/model-change/changeElementStyle.ts +176 -0
  28. package/src/model-change/changeViewLayout.ts +41 -0
  29. package/src/module.ts +197 -0
  30. package/src/node/index.ts +20 -0
  31. package/src/protocol.ts +87 -0
  32. package/src/references/index.ts +2 -0
  33. package/src/references/scope-computation.ts +142 -0
  34. package/src/references/scope-provider.ts +166 -0
  35. package/src/shared/NodeKindProvider.ts +67 -0
  36. package/src/shared/WorkspaceManager.ts +39 -0
  37. package/src/shared/WorkspaceSymbolProvider.ts +3 -0
  38. package/src/shared/index.ts +3 -0
  39. package/src/test/index.ts +1 -0
  40. package/src/test/testServices.ts +119 -0
  41. package/src/utils/index.ts +1 -0
  42. package/src/utils/printDocs.ts +3 -0
  43. package/src/utils/stringHash.ts +6 -0
  44. package/{dist/validation/dynamic-view-rule.js → src/validation/dynamic-view-rule.ts} +14 -11
  45. package/src/validation/dynamic-view-step.ts +39 -0
  46. package/src/validation/element.ts +52 -0
  47. package/{dist/validation/index.js → src/validation/index.ts} +22 -18
  48. package/src/validation/property-checks.ts +17 -0
  49. package/src/validation/relation.ts +57 -0
  50. package/src/validation/specification.ts +118 -0
  51. package/src/validation/view-predicates/custom-element-expr.ts +21 -0
  52. package/{dist/validation/view-predicates/expanded-element.js → src/validation/view-predicates/expanded-element.ts} +18 -13
  53. package/src/validation/view-predicates/incoming.ts +19 -0
  54. package/src/validation/view-predicates/index.ts +4 -0
  55. package/src/validation/view-predicates/outgoing.ts +19 -0
  56. package/src/validation/view.ts +26 -0
  57. package/src/view-utils/assignNavigateTo.ts +30 -0
  58. package/src/view-utils/index.ts +3 -0
  59. package/src/view-utils/resolve-extended-views.ts +57 -0
  60. package/src/view-utils/resolve-relative-paths.ts +84 -0
  61. package/dist/Rpc.d.ts +0 -10
  62. package/dist/Rpc.js +0 -98
  63. package/dist/ast.d.ts +0 -149
  64. package/dist/ast.js +0 -271
  65. package/dist/browser/index.d.ts +0 -9
  66. package/dist/browser/index.js +0 -16
  67. package/dist/elementRef.d.ts +0 -12
  68. package/dist/elementRef.js +0 -15
  69. package/dist/generated/ast.d.ts +0 -615
  70. package/dist/generated/ast.js +0 -957
  71. package/dist/generated/grammar.d.ts +0 -7
  72. package/dist/generated/grammar.js +0 -3
  73. package/dist/generated/module.d.ts +0 -14
  74. package/dist/generated/module.js +0 -22
  75. package/dist/index.d.ts +0 -5
  76. package/dist/index.js +0 -2
  77. package/dist/logger.d.ts +0 -12
  78. package/dist/logger.js +0 -51
  79. package/dist/lsp/CodeLensProvider.d.ts +0 -10
  80. package/dist/lsp/CodeLensProvider.js +0 -40
  81. package/dist/lsp/DocumentHighlightProvider.d.ts +0 -10
  82. package/dist/lsp/DocumentHighlightProvider.js +0 -10
  83. package/dist/lsp/DocumentLinkProvider.d.ts +0 -11
  84. package/dist/lsp/DocumentLinkProvider.js +0 -41
  85. package/dist/lsp/DocumentLinkProvider.test.d.ts +0 -2
  86. package/dist/lsp/DocumentLinkProvider.test.js +0 -54
  87. package/dist/lsp/DocumentSymbolProvider.d.ts +0 -22
  88. package/dist/lsp/DocumentSymbolProvider.js +0 -189
  89. package/dist/lsp/HoverProvider.d.ts +0 -10
  90. package/dist/lsp/HoverProvider.js +0 -36
  91. package/dist/lsp/SemanticTokenProvider.d.ts +0 -8
  92. package/dist/lsp/index.d.ts +0 -7
  93. package/dist/lsp/index.js +0 -6
  94. package/dist/model/fqn-computation.d.ts +0 -4
  95. package/dist/model/fqn-computation.js +0 -43
  96. package/dist/model/fqn-index.d.ts +0 -26
  97. package/dist/model/fqn-index.js +0 -114
  98. package/dist/model/index.d.ts +0 -6
  99. package/dist/model/index.js +0 -5
  100. package/dist/model/model-builder.d.ts +0 -20
  101. package/dist/model/model-builder.js +0 -365
  102. package/dist/model/model-locator.d.ts +0 -22
  103. package/dist/model/model-locator.js +0 -115
  104. package/dist/model/model-parser.d.ts +0 -29
  105. package/dist/model/model-parser.js +0 -520
  106. package/dist/model-change/ModelChanges.d.ts +0 -16
  107. package/dist/model-change/ModelChanges.js +0 -106
  108. package/dist/model-change/changeElementStyle.d.ts +0 -18
  109. package/dist/model-change/changeElementStyle.js +0 -141
  110. package/dist/model-change/changeViewLayout.d.ts +0 -13
  111. package/dist/model-change/changeViewLayout.js +0 -29
  112. package/dist/module.d.ts +0 -59
  113. package/dist/module.js +0 -121
  114. package/dist/node/index.d.ts +0 -6
  115. package/dist/node/index.js +0 -13
  116. package/dist/protocol.d.ts +0 -58
  117. package/dist/protocol.js +0 -14
  118. package/dist/references/index.d.ts +0 -3
  119. package/dist/references/index.js +0 -2
  120. package/dist/references/scope-computation.d.ts +0 -11
  121. package/dist/references/scope-computation.js +0 -111
  122. package/dist/references/scope-provider.d.ts +0 -18
  123. package/dist/references/scope-provider.js +0 -136
  124. package/dist/shared/NodeKindProvider.d.ts +0 -16
  125. package/dist/shared/NodeKindProvider.js +0 -60
  126. package/dist/shared/WorkspaceManager.d.ts +0 -17
  127. package/dist/shared/WorkspaceManager.js +0 -29
  128. package/dist/shared/WorkspaceSymbolProvider.d.ts +0 -4
  129. package/dist/shared/WorkspaceSymbolProvider.js +0 -3
  130. package/dist/shared/index.d.ts +0 -4
  131. package/dist/shared/index.js +0 -3
  132. package/dist/test/index.d.ts +0 -2
  133. package/dist/test/index.js +0 -1
  134. package/dist/test/testServices.d.ts +0 -23
  135. package/dist/test/testServices.js +0 -102
  136. package/dist/utils/index.d.ts +0 -2
  137. package/dist/utils/index.js +0 -1
  138. package/dist/utils/printDocs.d.ts +0 -3
  139. package/dist/utils/printDocs.js +0 -1
  140. package/dist/utils/stringHash.d.ts +0 -2
  141. package/dist/utils/stringHash.js +0 -5
  142. package/dist/validation/dynamic-view-rule.d.ts +0 -5
  143. package/dist/validation/dynamic-view-step.d.ts +0 -5
  144. package/dist/validation/dynamic-view-step.js +0 -33
  145. package/dist/validation/element.d.ts +0 -6
  146. package/dist/validation/element.js +0 -38
  147. package/dist/validation/index.d.ts +0 -3
  148. package/dist/validation/property-checks.d.ts +0 -5
  149. package/dist/validation/property-checks.js +0 -11
  150. package/dist/validation/relation.d.ts +0 -5
  151. package/dist/validation/relation.js +0 -50
  152. package/dist/validation/specification.d.ts +0 -10
  153. package/dist/validation/specification.js +0 -97
  154. package/dist/validation/view-predicates/custom-element-expr.d.ts +0 -5
  155. package/dist/validation/view-predicates/custom-element-expr.js +0 -16
  156. package/dist/validation/view-predicates/expanded-element.d.ts +0 -5
  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 -16
  165. package/dist/view-utils/assignNavigateTo.d.ts +0 -3
  166. package/dist/view-utils/assignNavigateTo.js +0 -24
  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 -75
  173. /package/{dist → src}/reset.d.ts +0 -0
@@ -1,957 +0,0 @@
1
- import { AbstractAstReflection } from "langium";
2
- export const LikeC4Terminals = {
3
- BLOCK_COMMENT: /\/\*[\s\S]*?\*\//,
4
- LINE_COMMENT: /\/\/[^\n\r]*/,
5
- WS: /\s+/,
6
- URI_WITH_SCHEMA: /\w+:\/\/\S+/,
7
- URI_RELATIVE: /\.{0,2}\/[^\/]\S+/,
8
- DotUnderscore: /\b\._/,
9
- DotWildcard: /\b\.\*/,
10
- TagHash: /\#\b/,
11
- Dot: /\b\./,
12
- NotEqual: /\!\={1,2}/,
13
- Eq: /\={1,2}/,
14
- Colon: /:/,
15
- SemiColon: /;/,
16
- Comma: /,/,
17
- Percent: /\b\d+%/,
18
- String: /"[^"]*"|'[^']*'/,
19
- IdTerminal: /\b[_]*[a-zA-Z][_-\w]*/
20
- };
21
- export function isArrowType(item) {
22
- return item === "none" || item === "normal" || item === "onormal" || item === "diamond" || item === "odiamond" || item === "crow" || item === "open" || item === "vee";
23
- }
24
- export function isBorderStyleValue(item) {
25
- return isLineOptions(item) || item === "none";
26
- }
27
- export const DynamicViewRule = "DynamicViewRule";
28
- export function isDynamicViewRule(item) {
29
- return reflection.isInstance(item, DynamicViewRule);
30
- }
31
- export const ElementExpr = "ElementExpr";
32
- export function isElementExpr(item) {
33
- return reflection.isInstance(item, ElementExpr);
34
- }
35
- export const ElementProperty = "ElementProperty";
36
- export function isElementProperty(item) {
37
- return reflection.isInstance(item, ElementProperty);
38
- }
39
- export function isElementShape(item) {
40
- return item === "rectangle" || item === "person" || item === "browser" || item === "mobile" || item === "cylinder" || item === "storage" || item === "queue";
41
- }
42
- export function isId(item) {
43
- return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || item === "element" || item === "model" || typeof item === "string" && /\b[_]*[a-zA-Z][_-\w]*/.test(item);
44
- }
45
- export const LikeC4View = "LikeC4View";
46
- export function isLikeC4View(item) {
47
- return reflection.isInstance(item, LikeC4View);
48
- }
49
- export function isLineOptions(item) {
50
- return item === "solid" || item === "dashed" || item === "dotted";
51
- }
52
- export const Relation = "Relation";
53
- export function isRelation(item) {
54
- return reflection.isInstance(item, Relation);
55
- }
56
- export const RelationProperty = "RelationProperty";
57
- export function isRelationProperty(item) {
58
- return reflection.isInstance(item, RelationProperty);
59
- }
60
- export const RelationshipStyleProperty = "RelationshipStyleProperty";
61
- export function isRelationshipStyleProperty(item) {
62
- return reflection.isInstance(item, RelationshipStyleProperty);
63
- }
64
- export const StyleProperty = "StyleProperty";
65
- export function isStyleProperty(item) {
66
- return reflection.isInstance(item, StyleProperty);
67
- }
68
- export function isTagId(item) {
69
- return typeof item === "string";
70
- }
71
- export function isThemeColor(item) {
72
- return item === "primary" || item === "secondary" || item === "muted" || item === "slate" || item === "blue" || item === "indigo" || item === "sky" || item === "red" || item === "gray" || item === "green" || item === "amber";
73
- }
74
- export function isUri(item) {
75
- return typeof item === "string" && (/\w+:\/\/\S+/.test(item) || /\.{0,2}\/[^\/]\S+/.test(item));
76
- }
77
- export function isViewLayoutDirection(item) {
78
- return item === "TopBottom" || item === "LeftRight" || item === "BottomTop" || item === "RightLeft";
79
- }
80
- export const ViewProperty = "ViewProperty";
81
- export function isViewProperty(item) {
82
- return reflection.isInstance(item, ViewProperty);
83
- }
84
- export const ViewRule = "ViewRule";
85
- export function isViewRule(item) {
86
- return reflection.isInstance(item, ViewRule);
87
- }
88
- export const ViewRulePredicate = "ViewRulePredicate";
89
- export function isViewRulePredicate(item) {
90
- return reflection.isInstance(item, ViewRulePredicate);
91
- }
92
- export const ViewRulePredicateExpr = "ViewRulePredicateExpr";
93
- export function isViewRulePredicateExpr(item) {
94
- return reflection.isInstance(item, ViewRulePredicateExpr);
95
- }
96
- export const ArrowProperty = "ArrowProperty";
97
- export function isArrowProperty(item) {
98
- return reflection.isInstance(item, ArrowProperty);
99
- }
100
- export const BorderProperty = "BorderProperty";
101
- export function isBorderProperty(item) {
102
- return reflection.isInstance(item, BorderProperty);
103
- }
104
- export const ColorProperty = "ColorProperty";
105
- export function isColorProperty(item) {
106
- return reflection.isInstance(item, ColorProperty);
107
- }
108
- export const CustomElementExpr = "CustomElementExpr";
109
- export function isCustomElementExpr(item) {
110
- return reflection.isInstance(item, CustomElementExpr);
111
- }
112
- export const CustomElementExprBody = "CustomElementExprBody";
113
- export function isCustomElementExprBody(item) {
114
- return reflection.isInstance(item, CustomElementExprBody);
115
- }
116
- export const DescedantsExpr = "DescedantsExpr";
117
- export function isDescedantsExpr(item) {
118
- return reflection.isInstance(item, DescedantsExpr);
119
- }
120
- export const DynamicView = "DynamicView";
121
- export function isDynamicView(item) {
122
- return reflection.isInstance(item, DynamicView);
123
- }
124
- export const DynamicViewBody = "DynamicViewBody";
125
- export function isDynamicViewBody(item) {
126
- return reflection.isInstance(item, DynamicViewBody);
127
- }
128
- export const DynamicViewRulePredicate = "DynamicViewRulePredicate";
129
- export function isDynamicViewRulePredicate(item) {
130
- return reflection.isInstance(item, DynamicViewRulePredicate);
131
- }
132
- export const DynamicViewStep = "DynamicViewStep";
133
- export function isDynamicViewStep(item) {
134
- return reflection.isInstance(item, DynamicViewStep);
135
- }
136
- export const Element = "Element";
137
- export function isElement(item) {
138
- return reflection.isInstance(item, Element);
139
- }
140
- export const ElementBody = "ElementBody";
141
- export function isElementBody(item) {
142
- return reflection.isInstance(item, ElementBody);
143
- }
144
- export const ElementKind = "ElementKind";
145
- export function isElementKind(item) {
146
- return reflection.isInstance(item, ElementKind);
147
- }
148
- export const ElementKindExpr = "ElementKindExpr";
149
- export function isElementKindExpr(item) {
150
- return reflection.isInstance(item, ElementKindExpr);
151
- }
152
- export const ElementRef = "ElementRef";
153
- export function isElementRef(item) {
154
- return reflection.isInstance(item, ElementRef);
155
- }
156
- export const ElementStringProperty = "ElementStringProperty";
157
- export function isElementStringProperty(item) {
158
- return reflection.isInstance(item, ElementStringProperty);
159
- }
160
- export const ElementTagExpr = "ElementTagExpr";
161
- export function isElementTagExpr(item) {
162
- return reflection.isInstance(item, ElementTagExpr);
163
- }
164
- export const ElementView = "ElementView";
165
- export function isElementView(item) {
166
- return reflection.isInstance(item, ElementView);
167
- }
168
- export const ElementViewBody = "ElementViewBody";
169
- export function isElementViewBody(item) {
170
- return reflection.isInstance(item, ElementViewBody);
171
- }
172
- export const ElementViewRef = "ElementViewRef";
173
- export function isElementViewRef(item) {
174
- return reflection.isInstance(item, ElementViewRef);
175
- }
176
- export const ExcludePredicate = "ExcludePredicate";
177
- export function isExcludePredicate(item) {
178
- return reflection.isInstance(item, ExcludePredicate);
179
- }
180
- export const ExpandElementExpr = "ExpandElementExpr";
181
- export function isExpandElementExpr(item) {
182
- return reflection.isInstance(item, ExpandElementExpr);
183
- }
184
- export const ExplicitRelation = "ExplicitRelation";
185
- export function isExplicitRelation(item) {
186
- return reflection.isInstance(item, ExplicitRelation);
187
- }
188
- export const ExtendElement = "ExtendElement";
189
- export function isExtendElement(item) {
190
- return reflection.isInstance(item, ExtendElement);
191
- }
192
- export const ExtendElementBody = "ExtendElementBody";
193
- export function isExtendElementBody(item) {
194
- return reflection.isInstance(item, ExtendElementBody);
195
- }
196
- export const FqnElementRef = "FqnElementRef";
197
- export function isFqnElementRef(item) {
198
- return reflection.isInstance(item, FqnElementRef);
199
- }
200
- export const IconProperty = "IconProperty";
201
- export function isIconProperty(item) {
202
- return reflection.isInstance(item, IconProperty);
203
- }
204
- export const ImplicitRelation = "ImplicitRelation";
205
- export function isImplicitRelation(item) {
206
- return reflection.isInstance(item, ImplicitRelation);
207
- }
208
- export const IncludePredicate = "IncludePredicate";
209
- export function isIncludePredicate(item) {
210
- return reflection.isInstance(item, IncludePredicate);
211
- }
212
- export const IncomingExpr = "IncomingExpr";
213
- export function isIncomingExpr(item) {
214
- return reflection.isInstance(item, IncomingExpr);
215
- }
216
- export const InOutExpr = "InOutExpr";
217
- export function isInOutExpr(item) {
218
- return reflection.isInstance(item, InOutExpr);
219
- }
220
- export const LikeC4Grammar = "LikeC4Grammar";
221
- export function isLikeC4Grammar(item) {
222
- return reflection.isInstance(item, LikeC4Grammar);
223
- }
224
- export const LineProperty = "LineProperty";
225
- export function isLineProperty(item) {
226
- return reflection.isInstance(item, LineProperty);
227
- }
228
- export const LinkProperty = "LinkProperty";
229
- export function isLinkProperty(item) {
230
- return reflection.isInstance(item, LinkProperty);
231
- }
232
- export const Model = "Model";
233
- export function isModel(item) {
234
- return reflection.isInstance(item, Model);
235
- }
236
- export const ModelViews = "ModelViews";
237
- export function isModelViews(item) {
238
- return reflection.isInstance(item, ModelViews);
239
- }
240
- export const NavigateToProperty = "NavigateToProperty";
241
- export function isNavigateToProperty(item) {
242
- return reflection.isInstance(item, NavigateToProperty);
243
- }
244
- export const OpacityProperty = "OpacityProperty";
245
- export function isOpacityProperty(item) {
246
- return reflection.isInstance(item, OpacityProperty);
247
- }
248
- export const OutgoingExpr = "OutgoingExpr";
249
- export function isOutgoingExpr(item) {
250
- return reflection.isInstance(item, OutgoingExpr);
251
- }
252
- export const RelationBody = "RelationBody";
253
- export function isRelationBody(item) {
254
- return reflection.isInstance(item, RelationBody);
255
- }
256
- export const RelationExpr = "RelationExpr";
257
- export function isRelationExpr(item) {
258
- return reflection.isInstance(item, RelationExpr);
259
- }
260
- export const RelationshipKind = "RelationshipKind";
261
- export function isRelationshipKind(item) {
262
- return reflection.isInstance(item, RelationshipKind);
263
- }
264
- export const RelationStringProperty = "RelationStringProperty";
265
- export function isRelationStringProperty(item) {
266
- return reflection.isInstance(item, RelationStringProperty);
267
- }
268
- export const RelationStyleProperty = "RelationStyleProperty";
269
- export function isRelationStyleProperty(item) {
270
- return reflection.isInstance(item, RelationStyleProperty);
271
- }
272
- export const ShapeProperty = "ShapeProperty";
273
- export function isShapeProperty(item) {
274
- return reflection.isInstance(item, ShapeProperty);
275
- }
276
- export const SpecificationElementKind = "SpecificationElementKind";
277
- export function isSpecificationElementKind(item) {
278
- return reflection.isInstance(item, SpecificationElementKind);
279
- }
280
- export const SpecificationRelationshipKind = "SpecificationRelationshipKind";
281
- export function isSpecificationRelationshipKind(item) {
282
- return reflection.isInstance(item, SpecificationRelationshipKind);
283
- }
284
- export const SpecificationRule = "SpecificationRule";
285
- export function isSpecificationRule(item) {
286
- return reflection.isInstance(item, SpecificationRule);
287
- }
288
- export const SpecificationTag = "SpecificationTag";
289
- export function isSpecificationTag(item) {
290
- return reflection.isInstance(item, SpecificationTag);
291
- }
292
- export const StyleProperties = "StyleProperties";
293
- export function isStyleProperties(item) {
294
- return reflection.isInstance(item, StyleProperties);
295
- }
296
- export const Tag = "Tag";
297
- export function isTag(item) {
298
- return reflection.isInstance(item, Tag);
299
- }
300
- export const Tags = "Tags";
301
- export function isTags(item) {
302
- return reflection.isInstance(item, Tags);
303
- }
304
- export const ViewRef = "ViewRef";
305
- export function isViewRef(item) {
306
- return reflection.isInstance(item, ViewRef);
307
- }
308
- export const ViewRuleAutoLayout = "ViewRuleAutoLayout";
309
- export function isViewRuleAutoLayout(item) {
310
- return reflection.isInstance(item, ViewRuleAutoLayout);
311
- }
312
- export const ViewRuleStyle = "ViewRuleStyle";
313
- export function isViewRuleStyle(item) {
314
- return reflection.isInstance(item, ViewRuleStyle);
315
- }
316
- export const ViewStringProperty = "ViewStringProperty";
317
- export function isViewStringProperty(item) {
318
- return reflection.isInstance(item, ViewStringProperty);
319
- }
320
- export const WildcardExpr = "WildcardExpr";
321
- export function isWildcardExpr(item) {
322
- return reflection.isInstance(item, WildcardExpr);
323
- }
324
- export class LikeC4AstReflection extends AbstractAstReflection {
325
- getAllTypes() {
326
- 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"];
327
- }
328
- computeIsSubtype(subtype, supertype) {
329
- switch (subtype) {
330
- case ArrowProperty:
331
- case LineProperty: {
332
- return this.isSubtype(RelationshipStyleProperty, supertype);
333
- }
334
- case BorderProperty:
335
- case IconProperty:
336
- case OpacityProperty:
337
- case ShapeProperty: {
338
- return this.isSubtype(StyleProperty, supertype);
339
- }
340
- case ColorProperty: {
341
- return this.isSubtype(RelationshipStyleProperty, supertype) || this.isSubtype(StyleProperty, supertype);
342
- }
343
- case CustomElementExpr:
344
- case ElementExpr:
345
- case IncomingExpr:
346
- case InOutExpr:
347
- case OutgoingExpr:
348
- case RelationExpr: {
349
- return this.isSubtype(ViewRulePredicateExpr, supertype);
350
- }
351
- case DescedantsExpr:
352
- case ElementKindExpr:
353
- case ElementRef:
354
- case ElementTagExpr:
355
- case ExpandElementExpr:
356
- case WildcardExpr: {
357
- return this.isSubtype(ElementExpr, supertype);
358
- }
359
- case DynamicView:
360
- case ElementView: {
361
- return this.isSubtype(LikeC4View, supertype);
362
- }
363
- case DynamicViewRulePredicate: {
364
- return this.isSubtype(DynamicViewRule, supertype);
365
- }
366
- case ElementStringProperty:
367
- case StyleProperties: {
368
- return this.isSubtype(ElementProperty, supertype);
369
- }
370
- case ExcludePredicate:
371
- case IncludePredicate: {
372
- return this.isSubtype(ViewRulePredicate, supertype);
373
- }
374
- case ExplicitRelation:
375
- case ImplicitRelation: {
376
- return this.isSubtype(Relation, supertype);
377
- }
378
- case LinkProperty: {
379
- return this.isSubtype(ElementProperty, supertype) || this.isSubtype(RelationProperty, supertype) || this.isSubtype(ViewProperty, supertype);
380
- }
381
- case RelationStringProperty:
382
- case RelationStyleProperty: {
383
- return this.isSubtype(RelationProperty, supertype);
384
- }
385
- case ViewRuleAutoLayout:
386
- case ViewRuleStyle: {
387
- return this.isSubtype(DynamicViewRule, supertype) || this.isSubtype(ViewRule, supertype);
388
- }
389
- case ViewRulePredicate: {
390
- return this.isSubtype(ViewRule, supertype);
391
- }
392
- case ViewStringProperty: {
393
- return this.isSubtype(ViewProperty, supertype);
394
- }
395
- default: {
396
- return false;
397
- }
398
- }
399
- }
400
- getReferenceType(refInfo) {
401
- const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
402
- switch (referenceId) {
403
- case "DynamicViewStep:kind":
404
- case "ExplicitRelation:kind":
405
- case "ImplicitRelation:kind": {
406
- return RelationshipKind;
407
- }
408
- case "Element:kind":
409
- case "ElementKindExpr:kind": {
410
- return ElementKind;
411
- }
412
- case "ElementRef:el":
413
- case "FqnElementRef:el": {
414
- return Element;
415
- }
416
- case "ElementTagExpr:tag":
417
- case "Tags:value": {
418
- return Tag;
419
- }
420
- case "ElementViewRef:view": {
421
- return ElementView;
422
- }
423
- case "ViewRef:view": {
424
- return LikeC4View;
425
- }
426
- default: {
427
- throw new Error(`${referenceId} is not a valid reference id.`);
428
- }
429
- }
430
- }
431
- getTypeMetaData(type) {
432
- switch (type) {
433
- case "ArrowProperty": {
434
- return {
435
- name: "ArrowProperty",
436
- properties: [
437
- { name: "key" },
438
- { name: "value" }
439
- ]
440
- };
441
- }
442
- case "BorderProperty": {
443
- return {
444
- name: "BorderProperty",
445
- properties: [
446
- { name: "key" },
447
- { name: "value" }
448
- ]
449
- };
450
- }
451
- case "ColorProperty": {
452
- return {
453
- name: "ColorProperty",
454
- properties: [
455
- { name: "key" },
456
- { name: "value" }
457
- ]
458
- };
459
- }
460
- case "CustomElementExpr": {
461
- return {
462
- name: "CustomElementExpr",
463
- properties: [
464
- { name: "body" },
465
- { name: "target" }
466
- ]
467
- };
468
- }
469
- case "CustomElementExprBody": {
470
- return {
471
- name: "CustomElementExprBody",
472
- properties: [
473
- { name: "props", defaultValue: [] }
474
- ]
475
- };
476
- }
477
- case "DescedantsExpr": {
478
- return {
479
- name: "DescedantsExpr",
480
- properties: [
481
- { name: "parent" }
482
- ]
483
- };
484
- }
485
- case "DynamicView": {
486
- return {
487
- name: "DynamicView",
488
- properties: [
489
- { name: "body" },
490
- { name: "name" }
491
- ]
492
- };
493
- }
494
- case "DynamicViewBody": {
495
- return {
496
- name: "DynamicViewBody",
497
- properties: [
498
- { name: "props", defaultValue: [] },
499
- { name: "rules", defaultValue: [] },
500
- { name: "steps", defaultValue: [] },
501
- { name: "tags" }
502
- ]
503
- };
504
- }
505
- case "DynamicViewRulePredicate": {
506
- return {
507
- name: "DynamicViewRulePredicate",
508
- properties: [
509
- { name: "expressions", defaultValue: [] }
510
- ]
511
- };
512
- }
513
- case "DynamicViewStep": {
514
- return {
515
- name: "DynamicViewStep",
516
- properties: [
517
- { name: "isBackward", defaultValue: false },
518
- { name: "kind" },
519
- { name: "source" },
520
- { name: "target" },
521
- { name: "title" }
522
- ]
523
- };
524
- }
525
- case "Element": {
526
- return {
527
- name: "Element",
528
- properties: [
529
- { name: "body" },
530
- { name: "kind" },
531
- { name: "name" },
532
- { name: "props" }
533
- ]
534
- };
535
- }
536
- case "ElementBody": {
537
- return {
538
- name: "ElementBody",
539
- properties: [
540
- { name: "elements", defaultValue: [] },
541
- { name: "props", defaultValue: [] },
542
- { name: "tags" }
543
- ]
544
- };
545
- }
546
- case "ElementKind": {
547
- return {
548
- name: "ElementKind",
549
- properties: [
550
- { name: "name" }
551
- ]
552
- };
553
- }
554
- case "ElementKindExpr": {
555
- return {
556
- name: "ElementKindExpr",
557
- properties: [
558
- { name: "isEqual", defaultValue: false },
559
- { name: "kind" }
560
- ]
561
- };
562
- }
563
- case "ElementRef": {
564
- return {
565
- name: "ElementRef",
566
- properties: [
567
- { name: "el" },
568
- { name: "parent" }
569
- ]
570
- };
571
- }
572
- case "ElementStringProperty": {
573
- return {
574
- name: "ElementStringProperty",
575
- properties: [
576
- { name: "key" },
577
- { name: "value" }
578
- ]
579
- };
580
- }
581
- case "ElementTagExpr": {
582
- return {
583
- name: "ElementTagExpr",
584
- properties: [
585
- { name: "isEqual", defaultValue: false },
586
- { name: "tag" }
587
- ]
588
- };
589
- }
590
- case "ElementView": {
591
- return {
592
- name: "ElementView",
593
- properties: [
594
- { name: "body" },
595
- { name: "extends" },
596
- { name: "name" },
597
- { name: "viewOf" }
598
- ]
599
- };
600
- }
601
- case "ElementViewBody": {
602
- return {
603
- name: "ElementViewBody",
604
- properties: [
605
- { name: "props", defaultValue: [] },
606
- { name: "rules", defaultValue: [] },
607
- { name: "tags" }
608
- ]
609
- };
610
- }
611
- case "ElementViewRef": {
612
- return {
613
- name: "ElementViewRef",
614
- properties: [
615
- { name: "view" }
616
- ]
617
- };
618
- }
619
- case "ExcludePredicate": {
620
- return {
621
- name: "ExcludePredicate",
622
- properties: [
623
- { name: "expressions", defaultValue: [] }
624
- ]
625
- };
626
- }
627
- case "ExpandElementExpr": {
628
- return {
629
- name: "ExpandElementExpr",
630
- properties: [
631
- { name: "parent" }
632
- ]
633
- };
634
- }
635
- case "ExplicitRelation": {
636
- return {
637
- name: "ExplicitRelation",
638
- properties: [
639
- { name: "body" },
640
- { name: "kind" },
641
- { name: "source" },
642
- { name: "tags" },
643
- { name: "target" },
644
- { name: "title" }
645
- ]
646
- };
647
- }
648
- case "ExtendElement": {
649
- return {
650
- name: "ExtendElement",
651
- properties: [
652
- { name: "body" },
653
- { name: "element" }
654
- ]
655
- };
656
- }
657
- case "ExtendElementBody": {
658
- return {
659
- name: "ExtendElementBody",
660
- properties: [
661
- { name: "elements", defaultValue: [] }
662
- ]
663
- };
664
- }
665
- case "FqnElementRef": {
666
- return {
667
- name: "FqnElementRef",
668
- properties: [
669
- { name: "el" },
670
- { name: "parent" }
671
- ]
672
- };
673
- }
674
- case "IconProperty": {
675
- return {
676
- name: "IconProperty",
677
- properties: [
678
- { name: "key" },
679
- { name: "value" }
680
- ]
681
- };
682
- }
683
- case "ImplicitRelation": {
684
- return {
685
- name: "ImplicitRelation",
686
- properties: [
687
- { name: "body" },
688
- { name: "kind" },
689
- { name: "tags" },
690
- { name: "target" },
691
- { name: "title" }
692
- ]
693
- };
694
- }
695
- case "IncludePredicate": {
696
- return {
697
- name: "IncludePredicate",
698
- properties: [
699
- { name: "expressions", defaultValue: [] }
700
- ]
701
- };
702
- }
703
- case "IncomingExpr": {
704
- return {
705
- name: "IncomingExpr",
706
- properties: [
707
- { name: "to" }
708
- ]
709
- };
710
- }
711
- case "InOutExpr": {
712
- return {
713
- name: "InOutExpr",
714
- properties: [
715
- { name: "inout" }
716
- ]
717
- };
718
- }
719
- case "LikeC4Grammar": {
720
- return {
721
- name: "LikeC4Grammar",
722
- properties: [
723
- { name: "models", defaultValue: [] },
724
- { name: "specifications", defaultValue: [] },
725
- { name: "views", defaultValue: [] }
726
- ]
727
- };
728
- }
729
- case "LineProperty": {
730
- return {
731
- name: "LineProperty",
732
- properties: [
733
- { name: "key" },
734
- { name: "value" }
735
- ]
736
- };
737
- }
738
- case "LinkProperty": {
739
- return {
740
- name: "LinkProperty",
741
- properties: [
742
- { name: "key" },
743
- { name: "value" }
744
- ]
745
- };
746
- }
747
- case "Model": {
748
- return {
749
- name: "Model",
750
- properties: [
751
- { name: "elements", defaultValue: [] },
752
- { name: "name" }
753
- ]
754
- };
755
- }
756
- case "ModelViews": {
757
- return {
758
- name: "ModelViews",
759
- properties: [
760
- { name: "name" },
761
- { name: "views", defaultValue: [] }
762
- ]
763
- };
764
- }
765
- case "NavigateToProperty": {
766
- return {
767
- name: "NavigateToProperty",
768
- properties: [
769
- { name: "value" }
770
- ]
771
- };
772
- }
773
- case "OpacityProperty": {
774
- return {
775
- name: "OpacityProperty",
776
- properties: [
777
- { name: "key" },
778
- { name: "value" }
779
- ]
780
- };
781
- }
782
- case "OutgoingExpr": {
783
- return {
784
- name: "OutgoingExpr",
785
- properties: [
786
- { name: "from" }
787
- ]
788
- };
789
- }
790
- case "RelationBody": {
791
- return {
792
- name: "RelationBody",
793
- properties: [
794
- { name: "props", defaultValue: [] },
795
- { name: "tags" }
796
- ]
797
- };
798
- }
799
- case "RelationExpr": {
800
- return {
801
- name: "RelationExpr",
802
- properties: [
803
- { name: "isBidirectional", defaultValue: false },
804
- { name: "source" },
805
- { name: "target" }
806
- ]
807
- };
808
- }
809
- case "RelationshipKind": {
810
- return {
811
- name: "RelationshipKind",
812
- properties: [
813
- { name: "name" }
814
- ]
815
- };
816
- }
817
- case "RelationStringProperty": {
818
- return {
819
- name: "RelationStringProperty",
820
- properties: [
821
- { name: "key" },
822
- { name: "value" }
823
- ]
824
- };
825
- }
826
- case "RelationStyleProperty": {
827
- return {
828
- name: "RelationStyleProperty",
829
- properties: [
830
- { name: "key" },
831
- { name: "props", defaultValue: [] }
832
- ]
833
- };
834
- }
835
- case "ShapeProperty": {
836
- return {
837
- name: "ShapeProperty",
838
- properties: [
839
- { name: "key" },
840
- { name: "value" }
841
- ]
842
- };
843
- }
844
- case "SpecificationElementKind": {
845
- return {
846
- name: "SpecificationElementKind",
847
- properties: [
848
- { name: "kind" },
849
- { name: "style" }
850
- ]
851
- };
852
- }
853
- case "SpecificationRelationshipKind": {
854
- return {
855
- name: "SpecificationRelationshipKind",
856
- properties: [
857
- { name: "kind" },
858
- { name: "props", defaultValue: [] }
859
- ]
860
- };
861
- }
862
- case "SpecificationRule": {
863
- return {
864
- name: "SpecificationRule",
865
- properties: [
866
- { name: "elements", defaultValue: [] },
867
- { name: "name" },
868
- { name: "relationships", defaultValue: [] },
869
- { name: "tags", defaultValue: [] }
870
- ]
871
- };
872
- }
873
- case "SpecificationTag": {
874
- return {
875
- name: "SpecificationTag",
876
- properties: [
877
- { name: "tag" }
878
- ]
879
- };
880
- }
881
- case "StyleProperties": {
882
- return {
883
- name: "StyleProperties",
884
- properties: [
885
- { name: "key" },
886
- { name: "props", defaultValue: [] }
887
- ]
888
- };
889
- }
890
- case "Tag": {
891
- return {
892
- name: "Tag",
893
- properties: [
894
- { name: "name" }
895
- ]
896
- };
897
- }
898
- case "Tags": {
899
- return {
900
- name: "Tags",
901
- properties: [
902
- { name: "value", defaultValue: [] }
903
- ]
904
- };
905
- }
906
- case "ViewRef": {
907
- return {
908
- name: "ViewRef",
909
- properties: [
910
- { name: "view" }
911
- ]
912
- };
913
- }
914
- case "ViewRuleAutoLayout": {
915
- return {
916
- name: "ViewRuleAutoLayout",
917
- properties: [
918
- { name: "direction" }
919
- ]
920
- };
921
- }
922
- case "ViewRuleStyle": {
923
- return {
924
- name: "ViewRuleStyle",
925
- properties: [
926
- { name: "styleprops", defaultValue: [] },
927
- { name: "targets", defaultValue: [] }
928
- ]
929
- };
930
- }
931
- case "ViewStringProperty": {
932
- return {
933
- name: "ViewStringProperty",
934
- properties: [
935
- { name: "key" },
936
- { name: "value" }
937
- ]
938
- };
939
- }
940
- case "WildcardExpr": {
941
- return {
942
- name: "WildcardExpr",
943
- properties: [
944
- { name: "isWildcard", defaultValue: false }
945
- ]
946
- };
947
- }
948
- default: {
949
- return {
950
- name: type,
951
- properties: []
952
- };
953
- }
954
- }
955
- }
956
- }
957
- export const reflection = new LikeC4AstReflection();