@likec4/language-server 0.37.1 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/contrib/likec4.monarch.ts +5 -5
  2. package/contrib/likec4.tmLanguage.json +1 -1
  3. package/dist/Rpc.d.ts +7 -0
  4. package/dist/Rpc.js +130 -0
  5. package/dist/ast.d.ts +20 -0
  6. package/dist/ast.js +169 -141
  7. package/dist/elementRef.js +31 -44
  8. package/dist/generated/ast.d.ts +48 -7
  9. package/dist/generated/ast.js +344 -315
  10. package/dist/generated/grammar.js +2 -3177
  11. package/dist/generated/module.js +13 -18
  12. package/dist/index.js +2 -3
  13. package/dist/logger.js +39 -42
  14. package/dist/lsp/CodeLensProvider.js +28 -32
  15. package/dist/lsp/DocumentLinkProvider.js +26 -33
  16. package/dist/lsp/DocumentSymbolProvider.js +165 -167
  17. package/dist/lsp/HoverProvider.js +35 -48
  18. package/dist/lsp/SemanticTokenProvider.js +160 -201
  19. package/dist/lsp/index.js +5 -6
  20. package/dist/model/fqn-computation.js +39 -40
  21. package/dist/model/fqn-index.js +117 -141
  22. package/dist/model/index.js +5 -6
  23. package/dist/model/model-builder.d.ts +10 -5
  24. package/dist/model/model-builder.js +247 -176
  25. package/dist/model/model-locator.d.ts +1 -1
  26. package/dist/model/model-locator.js +102 -100
  27. package/dist/model/model-parser.d.ts +2 -6
  28. package/dist/model/model-parser.js +284 -286
  29. package/dist/module.d.ts +4 -1
  30. package/dist/module.js +69 -60
  31. package/dist/protocol.d.ts +16 -19
  32. package/dist/protocol.js +14 -22
  33. package/dist/references/index.js +2 -3
  34. package/dist/references/scope-computation.js +72 -69
  35. package/dist/references/scope-provider.js +126 -116
  36. package/dist/shared/WorkspaceManager.d.ts +2 -3
  37. package/dist/shared/WorkspaceManager.js +13 -16
  38. package/dist/shared/index.js +1 -2
  39. package/dist/test/index.js +1 -2
  40. package/dist/test/testServices.js +73 -61
  41. package/dist/utils.d.ts +1 -0
  42. package/dist/utils.js +4 -3
  43. package/dist/validation/element.d.ts +1 -0
  44. package/dist/validation/element.js +31 -38
  45. package/dist/validation/index.js +37 -46
  46. package/dist/validation/relation.js +46 -46
  47. package/dist/validation/specification.d.ts +1 -0
  48. package/dist/validation/specification.js +33 -30
  49. package/dist/validation/view.js +16 -22
  50. package/dist/view-utils/assignNavigateTo.d.ts +3 -0
  51. package/dist/view-utils/assignNavigateTo.js +20 -0
  52. package/dist/view-utils/index.d.ts +4 -0
  53. package/dist/view-utils/index.js +3 -0
  54. package/dist/view-utils/resolve-extended-views.d.ts +7 -0
  55. package/dist/view-utils/resolve-extended-views.js +41 -0
  56. package/dist/view-utils/resolve-relative-paths.d.ts +3 -0
  57. package/dist/view-utils/resolve-relative-paths.js +76 -0
  58. package/package.json +33 -18
  59. package/dist/registerProtocolHandlers.d.ts +0 -3
  60. package/dist/registerProtocolHandlers.js +0 -112
@@ -1,423 +1,452 @@
1
- /******************************************************************************
2
- * This file was generated by langium-cli 2.0.1.
3
- * DO NOT EDIT MANUALLY!
4
- ******************************************************************************/
5
- import { AbstractAstReflection } from 'langium';
1
+ import { AbstractAstReflection } from "langium";
6
2
  export const LikeC4Terminals = {
7
- URI_WITH_SCHEMA: /\w+:\/\/\S+/,
8
- URI_RELATIVE: /\.{0,2}\/[^\/]\S+/,
9
- RARROW: /->/,
10
- Dot: /\b\.\b/,
11
- NotEqual: /!=/,
12
- Eq: /=/,
13
- OpenBlock: /\{/,
14
- CloseBlock: /\}/,
15
- Colon: /:/,
16
- SemiColon: /;/,
17
- Comma: /,/,
18
- TagID: /((#)([^\W\d_])(((([^\W\d_])|([0-9]))|(_))|(-))*)/,
19
- ID: /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/,
20
- STRING: /"[^"]*"|'[^']*'/,
21
- WS: /(([\t\r\n\v\f])|([^\S\r\n]))+/,
22
- BLOCK_COMMENT: /\/\*[\s\S]*?\*\//,
23
- LINE_COMMENT: /\/\/[^\n\r]*/,
3
+ BLOCK_COMMENT: /\/\*[\s\S]*?\*\//,
4
+ LINE_COMMENT: /\/\/[^\n\r]*/,
5
+ WS: /(([\t\r\n\v\f])|([^\S\r\n]))+/,
6
+ URI_WITH_SCHEMA: /\w+:\/\/\S+/,
7
+ URI_RELATIVE: /\.{0,2}\/[^\/]\S+/,
8
+ RARROW: /->/,
9
+ Dot: /\b\.\b/,
10
+ NotEqual: /!=/,
11
+ Eq: /=/,
12
+ OpenBlock: /\{/,
13
+ CloseBlock: /\}/,
14
+ Colon: /:/,
15
+ SemiColon: /;/,
16
+ Comma: /,/,
17
+ STRING: /"[^"]*"|'[^']*'/,
18
+ TagID: /((#)([^\W\d_])(((([^\W\d_])|([0-9]))|(_))|(-))*)/,
19
+ ID: /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/
24
20
  };
25
- export const ElementExpression = 'ElementExpression';
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 const ElementExpression = "ElementExpression";
26
25
  export function isElementExpression(item) {
27
- return reflection.isInstance(item, ElementExpression);
26
+ return reflection.isInstance(item, ElementExpression);
28
27
  }
29
- export const ElementProperty = 'ElementProperty';
28
+ export const ElementProperty = "ElementProperty";
30
29
  export function isElementProperty(item) {
31
- return reflection.isInstance(item, ElementProperty);
30
+ return reflection.isInstance(item, ElementProperty);
32
31
  }
33
32
  export function isElementShape(item) {
34
- return item === 'rectangle' || item === 'person' || item === 'browser' || item === 'mobile' || item === 'cylinder' || item === 'storage' || item === 'queue';
33
+ return item === "rectangle" || item === "person" || item === "browser" || item === "mobile" || item === "cylinder" || item === "storage" || item === "queue";
35
34
  }
36
- export const Expression = 'Expression';
35
+ export const Expression = "Expression";
37
36
  export function isExpression(item) {
38
- return reflection.isInstance(item, Expression);
37
+ return reflection.isInstance(item, Expression);
38
+ }
39
+ export function isLineOptions(item) {
40
+ return item === "solid" || item === "dashed" || item === "dotted";
39
41
  }
40
42
  export function isName(item) {
41
- return isElementShape(item) || isThemeColor(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/.test(item)));
43
+ return isElementShape(item) || isThemeColor(item) || isLineOptions(item) || isArrowType(item) || item === "element" || item === "model" || typeof item === "string" && /((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/.test(item);
42
44
  }
43
45
  export function isRArrow(item) {
44
- return (typeof item === 'string' && (/->/.test(item)));
46
+ return typeof item === "string" && /->/.test(item);
45
47
  }
46
48
  export function isThemeColor(item) {
47
- return item === 'primary' || item === 'secondary' || item === 'muted' || item === 'slate' || item === 'blue' || item === 'indigo' || item === 'sky' || item === 'red' || item === 'gray' || item === 'green' || item === 'amber';
49
+ return item === "primary" || item === "secondary" || item === "muted" || item === "slate" || item === "blue" || item === "indigo" || item === "sky" || item === "red" || item === "gray" || item === "green" || item === "amber";
48
50
  }
49
51
  export function isUri(item) {
50
- return (typeof item === 'string' && (/\w+:\/\/\S+/.test(item) || /\.{0,2}\/[^\/]\S+/.test(item)));
52
+ return typeof item === "string" && (/\w+:\/\/\S+/.test(item) || /\.{0,2}\/[^\/]\S+/.test(item));
51
53
  }
52
- export const View = 'View';
54
+ export const View = "View";
53
55
  export function isView(item) {
54
- return reflection.isInstance(item, View);
56
+ return reflection.isInstance(item, View);
55
57
  }
56
- export const ViewRule = 'ViewRule';
58
+ export const ViewRule = "ViewRule";
57
59
  export function isViewRule(item) {
58
- return reflection.isInstance(item, ViewRule);
60
+ return reflection.isInstance(item, ViewRule);
59
61
  }
60
62
  export function isViewRuleLayoutDirection(item) {
61
- return item === 'TopBottom' || item === 'LeftRight' || item === 'BottomTop' || item === 'RightLeft';
63
+ return item === "TopBottom" || item === "LeftRight" || item === "BottomTop" || item === "RightLeft";
62
64
  }
63
- export const ColorProperty = 'ColorProperty';
65
+ export const ArrowProperty = "ArrowProperty";
66
+ export function isArrowProperty(item) {
67
+ return reflection.isInstance(item, ArrowProperty);
68
+ }
69
+ export const ColorProperty = "ColorProperty";
64
70
  export function isColorProperty(item) {
65
- return reflection.isInstance(item, ColorProperty);
71
+ return reflection.isInstance(item, ColorProperty);
66
72
  }
67
- export const Element = 'Element';
73
+ export const Element = "Element";
68
74
  export function isElement(item) {
69
- return reflection.isInstance(item, Element);
75
+ return reflection.isInstance(item, Element);
70
76
  }
71
- export const ElementBody = 'ElementBody';
77
+ export const ElementBody = "ElementBody";
72
78
  export function isElementBody(item) {
73
- return reflection.isInstance(item, ElementBody);
79
+ return reflection.isInstance(item, ElementBody);
74
80
  }
75
- export const ElementKind = 'ElementKind';
81
+ export const ElementKind = "ElementKind";
76
82
  export function isElementKind(item) {
77
- return reflection.isInstance(item, ElementKind);
83
+ return reflection.isInstance(item, ElementKind);
78
84
  }
79
- export const ElementKindExpression = 'ElementKindExpression';
85
+ export const ElementKindExpression = "ElementKindExpression";
80
86
  export function isElementKindExpression(item) {
81
- return reflection.isInstance(item, ElementKindExpression);
87
+ return reflection.isInstance(item, ElementKindExpression);
82
88
  }
83
- export const ElementRef = 'ElementRef';
89
+ export const ElementRef = "ElementRef";
84
90
  export function isElementRef(item) {
85
- return reflection.isInstance(item, ElementRef);
91
+ return reflection.isInstance(item, ElementRef);
86
92
  }
87
- export const ElementRefExpression = 'ElementRefExpression';
93
+ export const ElementRefExpression = "ElementRefExpression";
88
94
  export function isElementRefExpression(item) {
89
- return reflection.isInstance(item, ElementRefExpression);
95
+ return reflection.isInstance(item, ElementRefExpression);
90
96
  }
91
- export const ElementStringProperty = 'ElementStringProperty';
97
+ export const ElementStringProperty = "ElementStringProperty";
92
98
  export function isElementStringProperty(item) {
93
- return reflection.isInstance(item, ElementStringProperty);
99
+ return reflection.isInstance(item, ElementStringProperty);
94
100
  }
95
- export const ElementTagExpression = 'ElementTagExpression';
101
+ export const ElementTagExpression = "ElementTagExpression";
96
102
  export function isElementTagExpression(item) {
97
- return reflection.isInstance(item, ElementTagExpression);
103
+ return reflection.isInstance(item, ElementTagExpression);
98
104
  }
99
- export const ElementView = 'ElementView';
105
+ export const ElementView = "ElementView";
100
106
  export function isElementView(item) {
101
- return reflection.isInstance(item, ElementView);
107
+ return reflection.isInstance(item, ElementView);
102
108
  }
103
- export const ElementViewBody = 'ElementViewBody';
109
+ export const ElementViewBody = "ElementViewBody";
104
110
  export function isElementViewBody(item) {
105
- return reflection.isInstance(item, ElementViewBody);
111
+ return reflection.isInstance(item, ElementViewBody);
106
112
  }
107
- export const ElementViewRef = 'ElementViewRef';
113
+ export const ElementViewRef = "ElementViewRef";
108
114
  export function isElementViewRef(item) {
109
- return reflection.isInstance(item, ElementViewRef);
115
+ return reflection.isInstance(item, ElementViewRef);
110
116
  }
111
- export const ExtendElement = 'ExtendElement';
117
+ export const ExtendElement = "ExtendElement";
112
118
  export function isExtendElement(item) {
113
- return reflection.isInstance(item, ExtendElement);
119
+ return reflection.isInstance(item, ExtendElement);
114
120
  }
115
- export const ExtendElementBody = 'ExtendElementBody';
121
+ export const ExtendElementBody = "ExtendElementBody";
116
122
  export function isExtendElementBody(item) {
117
- return reflection.isInstance(item, ExtendElementBody);
123
+ return reflection.isInstance(item, ExtendElementBody);
118
124
  }
119
- export const IconProperty = 'IconProperty';
125
+ export const IconProperty = "IconProperty";
120
126
  export function isIconProperty(item) {
121
- return reflection.isInstance(item, IconProperty);
127
+ return reflection.isInstance(item, IconProperty);
122
128
  }
123
- export const IncomingExpression = 'IncomingExpression';
129
+ export const IncomingExpression = "IncomingExpression";
124
130
  export function isIncomingExpression(item) {
125
- return reflection.isInstance(item, IncomingExpression);
131
+ return reflection.isInstance(item, IncomingExpression);
126
132
  }
127
- export const InOutExpression = 'InOutExpression';
133
+ export const InOutExpression = "InOutExpression";
128
134
  export function isInOutExpression(item) {
129
- return reflection.isInstance(item, InOutExpression);
135
+ return reflection.isInstance(item, InOutExpression);
130
136
  }
131
- export const LikeC4Document = 'LikeC4Document';
137
+ export const LikeC4Document = "LikeC4Document";
132
138
  export function isLikeC4Document(item) {
133
- return reflection.isInstance(item, LikeC4Document);
139
+ return reflection.isInstance(item, LikeC4Document);
140
+ }
141
+ export const LineProperty = "LineProperty";
142
+ export function isLineProperty(item) {
143
+ return reflection.isInstance(item, LineProperty);
134
144
  }
135
- export const LinkProperty = 'LinkProperty';
145
+ export const LinkProperty = "LinkProperty";
136
146
  export function isLinkProperty(item) {
137
- return reflection.isInstance(item, LinkProperty);
147
+ return reflection.isInstance(item, LinkProperty);
138
148
  }
139
- export const Model = 'Model';
149
+ export const Model = "Model";
140
150
  export function isModel(item) {
141
- return reflection.isInstance(item, Model);
151
+ return reflection.isInstance(item, Model);
142
152
  }
143
- export const ModelViews = 'ModelViews';
153
+ export const ModelViews = "ModelViews";
144
154
  export function isModelViews(item) {
145
- return reflection.isInstance(item, ModelViews);
155
+ return reflection.isInstance(item, ModelViews);
146
156
  }
147
- export const OutgoingExpression = 'OutgoingExpression';
157
+ export const OutgoingExpression = "OutgoingExpression";
148
158
  export function isOutgoingExpression(item) {
149
- return reflection.isInstance(item, OutgoingExpression);
159
+ return reflection.isInstance(item, OutgoingExpression);
150
160
  }
151
- export const Relation = 'Relation';
161
+ export const Relation = "Relation";
152
162
  export function isRelation(item) {
153
- return reflection.isInstance(item, Relation);
163
+ return reflection.isInstance(item, Relation);
154
164
  }
155
- export const RelationBody = 'RelationBody';
165
+ export const RelationBody = "RelationBody";
156
166
  export function isRelationBody(item) {
157
- return reflection.isInstance(item, RelationBody);
167
+ return reflection.isInstance(item, RelationBody);
158
168
  }
159
- export const RelationExpression = 'RelationExpression';
169
+ export const RelationExpression = "RelationExpression";
160
170
  export function isRelationExpression(item) {
161
- return reflection.isInstance(item, RelationExpression);
171
+ return reflection.isInstance(item, RelationExpression);
162
172
  }
163
- export const RelationStringProperty = 'RelationStringProperty';
173
+ export const RelationshipKind = "RelationshipKind";
174
+ export function isRelationshipKind(item) {
175
+ return reflection.isInstance(item, RelationshipKind);
176
+ }
177
+ export const RelationStringProperty = "RelationStringProperty";
164
178
  export function isRelationStringProperty(item) {
165
- return reflection.isInstance(item, RelationStringProperty);
179
+ return reflection.isInstance(item, RelationStringProperty);
166
180
  }
167
- export const ShapeProperty = 'ShapeProperty';
181
+ export const ShapeProperty = "ShapeProperty";
168
182
  export function isShapeProperty(item) {
169
- return reflection.isInstance(item, ShapeProperty);
183
+ return reflection.isInstance(item, ShapeProperty);
170
184
  }
171
- export const SpecificationElementKind = 'SpecificationElementKind';
185
+ export const SpecificationElementKind = "SpecificationElementKind";
172
186
  export function isSpecificationElementKind(item) {
173
- return reflection.isInstance(item, SpecificationElementKind);
187
+ return reflection.isInstance(item, SpecificationElementKind);
188
+ }
189
+ export const SpecificationRelationshipKind = "SpecificationRelationshipKind";
190
+ export function isSpecificationRelationshipKind(item) {
191
+ return reflection.isInstance(item, SpecificationRelationshipKind);
174
192
  }
175
- export const SpecificationRule = 'SpecificationRule';
193
+ export const SpecificationRule = "SpecificationRule";
176
194
  export function isSpecificationRule(item) {
177
- return reflection.isInstance(item, SpecificationRule);
195
+ return reflection.isInstance(item, SpecificationRule);
178
196
  }
179
- export const SpecificationTag = 'SpecificationTag';
197
+ export const SpecificationTag = "SpecificationTag";
180
198
  export function isSpecificationTag(item) {
181
- return reflection.isInstance(item, SpecificationTag);
199
+ return reflection.isInstance(item, SpecificationTag);
182
200
  }
183
- export const StrictElementRef = 'StrictElementRef';
201
+ export const StrictElementRef = "StrictElementRef";
184
202
  export function isStrictElementRef(item) {
185
- return reflection.isInstance(item, StrictElementRef);
203
+ return reflection.isInstance(item, StrictElementRef);
186
204
  }
187
- export const StyleProperties = 'StyleProperties';
205
+ export const StyleProperties = "StyleProperties";
188
206
  export function isStyleProperties(item) {
189
- return reflection.isInstance(item, StyleProperties);
207
+ return reflection.isInstance(item, StyleProperties);
190
208
  }
191
- export const Tag = 'Tag';
209
+ export const Tag = "Tag";
192
210
  export function isTag(item) {
193
- return reflection.isInstance(item, Tag);
211
+ return reflection.isInstance(item, Tag);
194
212
  }
195
- export const Tags = 'Tags';
213
+ export const Tags = "Tags";
196
214
  export function isTags(item) {
197
- return reflection.isInstance(item, Tags);
215
+ return reflection.isInstance(item, Tags);
198
216
  }
199
- export const ViewProperty = 'ViewProperty';
217
+ export const ViewProperty = "ViewProperty";
200
218
  export function isViewProperty(item) {
201
- return reflection.isInstance(item, ViewProperty);
219
+ return reflection.isInstance(item, ViewProperty);
202
220
  }
203
- export const ViewRuleAutoLayout = 'ViewRuleAutoLayout';
221
+ export const ViewRuleAutoLayout = "ViewRuleAutoLayout";
204
222
  export function isViewRuleAutoLayout(item) {
205
- return reflection.isInstance(item, ViewRuleAutoLayout);
223
+ return reflection.isInstance(item, ViewRuleAutoLayout);
206
224
  }
207
- export const ViewRuleExpression = 'ViewRuleExpression';
225
+ export const ViewRuleExpression = "ViewRuleExpression";
208
226
  export function isViewRuleExpression(item) {
209
- return reflection.isInstance(item, ViewRuleExpression);
227
+ return reflection.isInstance(item, ViewRuleExpression);
210
228
  }
211
- export const ViewRuleStyle = 'ViewRuleStyle';
229
+ export const ViewRuleStyle = "ViewRuleStyle";
212
230
  export function isViewRuleStyle(item) {
213
- return reflection.isInstance(item, ViewRuleStyle);
231
+ return reflection.isInstance(item, ViewRuleStyle);
214
232
  }
215
- export const WildcardExpression = 'WildcardExpression';
233
+ export const WildcardExpression = "WildcardExpression";
216
234
  export function isWildcardExpression(item) {
217
- return reflection.isInstance(item, WildcardExpression);
235
+ return reflection.isInstance(item, WildcardExpression);
218
236
  }
219
237
  export class LikeC4AstReflection extends AbstractAstReflection {
220
- getAllTypes() {
221
- return ['ColorProperty', 'Element', 'ElementBody', 'ElementExpression', 'ElementKind', 'ElementKindExpression', 'ElementProperty', 'ElementRef', 'ElementRefExpression', 'ElementStringProperty', 'ElementTagExpression', 'ElementView', 'ElementViewBody', 'ElementViewRef', 'Expression', 'ExtendElement', 'ExtendElementBody', 'IconProperty', 'InOutExpression', 'IncomingExpression', 'LikeC4Document', 'LinkProperty', 'Model', 'ModelViews', 'OutgoingExpression', 'Relation', 'RelationBody', 'RelationExpression', 'RelationStringProperty', 'ShapeProperty', 'SpecificationElementKind', 'SpecificationRule', 'SpecificationTag', 'StrictElementRef', 'StyleProperties', 'Tag', 'Tags', 'View', 'ViewProperty', 'ViewRule', 'ViewRuleAutoLayout', 'ViewRuleExpression', 'ViewRuleStyle', 'WildcardExpression'];
222
- }
223
- computeIsSubtype(subtype, supertype) {
224
- switch (subtype) {
225
- case ElementExpression:
226
- case IncomingExpression:
227
- case InOutExpression:
228
- case OutgoingExpression:
229
- case RelationExpression: {
230
- return this.isSubtype(Expression, supertype);
231
- }
232
- case ElementKindExpression:
233
- case ElementRefExpression:
234
- case ElementTagExpression:
235
- case WildcardExpression: {
236
- return this.isSubtype(ElementExpression, supertype);
237
- }
238
- case ElementStringProperty:
239
- case StyleProperties: {
240
- return this.isSubtype(ElementProperty, supertype);
241
- }
242
- case ElementView: {
243
- return this.isSubtype(View, supertype);
244
- }
245
- case ViewRuleAutoLayout:
246
- case ViewRuleExpression:
247
- case ViewRuleStyle: {
248
- return this.isSubtype(ViewRule, supertype);
249
- }
250
- default: {
251
- return false;
252
- }
253
- }
238
+ getAllTypes() {
239
+ return ["ArrowProperty", "ColorProperty", "Element", "ElementBody", "ElementExpression", "ElementKind", "ElementKindExpression", "ElementProperty", "ElementRef", "ElementRefExpression", "ElementStringProperty", "ElementTagExpression", "ElementView", "ElementViewBody", "ElementViewRef", "Expression", "ExtendElement", "ExtendElementBody", "IconProperty", "InOutExpression", "IncomingExpression", "LikeC4Document", "LineProperty", "LinkProperty", "Model", "ModelViews", "OutgoingExpression", "Relation", "RelationBody", "RelationExpression", "RelationStringProperty", "RelationshipKind", "ShapeProperty", "SpecificationElementKind", "SpecificationRelationshipKind", "SpecificationRule", "SpecificationTag", "StrictElementRef", "StyleProperties", "Tag", "Tags", "View", "ViewProperty", "ViewRule", "ViewRuleAutoLayout", "ViewRuleExpression", "ViewRuleStyle", "WildcardExpression"];
240
+ }
241
+ computeIsSubtype(subtype, supertype) {
242
+ switch (subtype) {
243
+ case ElementExpression:
244
+ case IncomingExpression:
245
+ case InOutExpression:
246
+ case OutgoingExpression:
247
+ case RelationExpression: {
248
+ return this.isSubtype(Expression, supertype);
249
+ }
250
+ case ElementKindExpression:
251
+ case ElementRefExpression:
252
+ case ElementTagExpression:
253
+ case WildcardExpression: {
254
+ return this.isSubtype(ElementExpression, supertype);
255
+ }
256
+ case ElementStringProperty:
257
+ case StyleProperties: {
258
+ return this.isSubtype(ElementProperty, supertype);
259
+ }
260
+ case ElementView: {
261
+ return this.isSubtype(View, supertype);
262
+ }
263
+ case ViewRuleAutoLayout:
264
+ case ViewRuleExpression:
265
+ case ViewRuleStyle: {
266
+ return this.isSubtype(ViewRule, supertype);
267
+ }
268
+ default: {
269
+ return false;
270
+ }
254
271
  }
255
- getReferenceType(refInfo) {
256
- const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
257
- switch (referenceId) {
258
- case 'Element:kind':
259
- case 'ElementKindExpression:kind': {
260
- return ElementKind;
261
- }
262
- case 'ElementRef:el':
263
- case 'StrictElementRef:el': {
264
- return Element;
265
- }
266
- case 'ElementTagExpression:tag':
267
- case 'Tags:value': {
268
- return Tag;
269
- }
270
- case 'ElementViewRef:view': {
271
- return ElementView;
272
- }
273
- default: {
274
- throw new Error(`${referenceId} is not a valid reference id.`);
275
- }
276
- }
272
+ }
273
+ getReferenceType(refInfo) {
274
+ const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
275
+ switch (referenceId) {
276
+ case "Element:kind":
277
+ case "ElementKindExpression:kind": {
278
+ return ElementKind;
279
+ }
280
+ case "ElementRef:el":
281
+ case "StrictElementRef:el": {
282
+ return Element;
283
+ }
284
+ case "ElementTagExpression:tag":
285
+ case "Tags:value": {
286
+ return Tag;
287
+ }
288
+ case "ElementViewRef:view": {
289
+ return ElementView;
290
+ }
291
+ case "Relation:kind": {
292
+ return RelationshipKind;
293
+ }
294
+ default: {
295
+ throw new Error(`${referenceId} is not a valid reference id.`);
296
+ }
277
297
  }
278
- getTypeMetaData(type) {
279
- switch (type) {
280
- case 'Element': {
281
- return {
282
- name: 'Element',
283
- mandatory: [
284
- { name: 'props', type: 'array' }
285
- ]
286
- };
287
- }
288
- case 'ElementBody': {
289
- return {
290
- name: 'ElementBody',
291
- mandatory: [
292
- { name: 'elements', type: 'array' },
293
- { name: 'props', type: 'array' }
294
- ]
295
- };
296
- }
297
- case 'ElementKindExpression': {
298
- return {
299
- name: 'ElementKindExpression',
300
- mandatory: [
301
- { name: 'isEqual', type: 'boolean' }
302
- ]
303
- };
304
- }
305
- case 'ElementRefExpression': {
306
- return {
307
- name: 'ElementRefExpression',
308
- mandatory: [
309
- { name: 'isDescedants', type: 'boolean' }
310
- ]
311
- };
312
- }
313
- case 'ElementTagExpression': {
314
- return {
315
- name: 'ElementTagExpression',
316
- mandatory: [
317
- { name: 'isEqual', type: 'boolean' }
318
- ]
319
- };
320
- }
321
- case 'ElementViewBody': {
322
- return {
323
- name: 'ElementViewBody',
324
- mandatory: [
325
- { name: 'props', type: 'array' },
326
- { name: 'rules', type: 'array' }
327
- ]
328
- };
329
- }
330
- case 'ExtendElementBody': {
331
- return {
332
- name: 'ExtendElementBody',
333
- mandatory: [
334
- { name: 'elements', type: 'array' }
335
- ]
336
- };
337
- }
338
- case 'Model': {
339
- return {
340
- name: 'Model',
341
- mandatory: [
342
- { name: 'elements', type: 'array' }
343
- ]
344
- };
345
- }
346
- case 'ModelViews': {
347
- return {
348
- name: 'ModelViews',
349
- mandatory: [
350
- { name: 'views', type: 'array' }
351
- ]
352
- };
353
- }
354
- case 'RelationBody': {
355
- return {
356
- name: 'RelationBody',
357
- mandatory: [
358
- { name: 'props', type: 'array' }
359
- ]
360
- };
361
- }
362
- case 'SpecificationRule': {
363
- return {
364
- name: 'SpecificationRule',
365
- mandatory: [
366
- { name: 'elements', type: 'array' },
367
- { name: 'tags', type: 'array' }
368
- ]
369
- };
370
- }
371
- case 'StyleProperties': {
372
- return {
373
- name: 'StyleProperties',
374
- mandatory: [
375
- { name: 'props', type: 'array' }
376
- ]
377
- };
378
- }
379
- case 'Tags': {
380
- return {
381
- name: 'Tags',
382
- mandatory: [
383
- { name: 'value', type: 'array' }
384
- ]
385
- };
386
- }
387
- case 'ViewRuleExpression': {
388
- return {
389
- name: 'ViewRuleExpression',
390
- mandatory: [
391
- { name: 'expressions', type: 'array' },
392
- { name: 'isInclude', type: 'boolean' }
393
- ]
394
- };
395
- }
396
- case 'ViewRuleStyle': {
397
- return {
398
- name: 'ViewRuleStyle',
399
- mandatory: [
400
- { name: 'props', type: 'array' },
401
- { name: 'targets', type: 'array' }
402
- ]
403
- };
404
- }
405
- case 'WildcardExpression': {
406
- return {
407
- name: 'WildcardExpression',
408
- mandatory: [
409
- { name: 'isWildcard', type: 'boolean' }
410
- ]
411
- };
412
- }
413
- default: {
414
- return {
415
- name: type,
416
- mandatory: []
417
- };
418
- }
419
- }
298
+ }
299
+ getTypeMetaData(type) {
300
+ switch (type) {
301
+ case "Element": {
302
+ return {
303
+ name: "Element",
304
+ mandatory: [
305
+ { name: "props", type: "array" }
306
+ ]
307
+ };
308
+ }
309
+ case "ElementBody": {
310
+ return {
311
+ name: "ElementBody",
312
+ mandatory: [
313
+ { name: "elements", type: "array" },
314
+ { name: "props", type: "array" }
315
+ ]
316
+ };
317
+ }
318
+ case "ElementKindExpression": {
319
+ return {
320
+ name: "ElementKindExpression",
321
+ mandatory: [
322
+ { name: "isEqual", type: "boolean" }
323
+ ]
324
+ };
325
+ }
326
+ case "ElementRefExpression": {
327
+ return {
328
+ name: "ElementRefExpression",
329
+ mandatory: [
330
+ { name: "isDescedants", type: "boolean" }
331
+ ]
332
+ };
333
+ }
334
+ case "ElementTagExpression": {
335
+ return {
336
+ name: "ElementTagExpression",
337
+ mandatory: [
338
+ { name: "isEqual", type: "boolean" }
339
+ ]
340
+ };
341
+ }
342
+ case "ElementViewBody": {
343
+ return {
344
+ name: "ElementViewBody",
345
+ mandatory: [
346
+ { name: "props", type: "array" },
347
+ { name: "rules", type: "array" }
348
+ ]
349
+ };
350
+ }
351
+ case "ExtendElementBody": {
352
+ return {
353
+ name: "ExtendElementBody",
354
+ mandatory: [
355
+ { name: "elements", type: "array" }
356
+ ]
357
+ };
358
+ }
359
+ case "Model": {
360
+ return {
361
+ name: "Model",
362
+ mandatory: [
363
+ { name: "elements", type: "array" }
364
+ ]
365
+ };
366
+ }
367
+ case "ModelViews": {
368
+ return {
369
+ name: "ModelViews",
370
+ mandatory: [
371
+ { name: "views", type: "array" }
372
+ ]
373
+ };
374
+ }
375
+ case "RelationBody": {
376
+ return {
377
+ name: "RelationBody",
378
+ mandatory: [
379
+ { name: "props", type: "array" }
380
+ ]
381
+ };
382
+ }
383
+ case "SpecificationRelationshipKind": {
384
+ return {
385
+ name: "SpecificationRelationshipKind",
386
+ mandatory: [
387
+ { name: "props", type: "array" }
388
+ ]
389
+ };
390
+ }
391
+ case "SpecificationRule": {
392
+ return {
393
+ name: "SpecificationRule",
394
+ mandatory: [
395
+ { name: "elements", type: "array" },
396
+ { name: "relationships", type: "array" },
397
+ { name: "tags", type: "array" }
398
+ ]
399
+ };
400
+ }
401
+ case "StyleProperties": {
402
+ return {
403
+ name: "StyleProperties",
404
+ mandatory: [
405
+ { name: "props", type: "array" }
406
+ ]
407
+ };
408
+ }
409
+ case "Tags": {
410
+ return {
411
+ name: "Tags",
412
+ mandatory: [
413
+ { name: "value", type: "array" }
414
+ ]
415
+ };
416
+ }
417
+ case "ViewRuleExpression": {
418
+ return {
419
+ name: "ViewRuleExpression",
420
+ mandatory: [
421
+ { name: "expressions", type: "array" },
422
+ { name: "isInclude", type: "boolean" }
423
+ ]
424
+ };
425
+ }
426
+ case "ViewRuleStyle": {
427
+ return {
428
+ name: "ViewRuleStyle",
429
+ mandatory: [
430
+ { name: "props", type: "array" },
431
+ { name: "targets", type: "array" }
432
+ ]
433
+ };
434
+ }
435
+ case "WildcardExpression": {
436
+ return {
437
+ name: "WildcardExpression",
438
+ mandatory: [
439
+ { name: "isWildcard", type: "boolean" }
440
+ ]
441
+ };
442
+ }
443
+ default: {
444
+ return {
445
+ name: type,
446
+ mandatory: []
447
+ };
448
+ }
420
449
  }
450
+ }
421
451
  }
422
452
  export const reflection = new LikeC4AstReflection();
423
- //# sourceMappingURL=ast.js.map