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