@likec4/language-server 0.30.0 → 0.32.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.
- package/README.md +5 -0
- package/contrib/likec4.monarch.ts +1 -1
- package/contrib/likec4.tmLanguage.json +1 -1
- package/dist/ast.d.ts +15 -4
- package/dist/ast.js +32 -11
- package/dist/generated/ast.d.ts +29 -31
- package/dist/generated/ast.js +14 -30
- package/dist/generated/grammar.js +342 -223
- package/dist/logger.d.ts +1 -0
- package/dist/lsp/DocumentSymbolProvider.js +3 -3
- package/dist/lsp/SemanticTokenProvider.js +42 -21
- package/dist/model/fqn-computation.js +3 -2
- package/dist/model/fqn-index.js +4 -4
- package/dist/model/model-builder.d.ts +2 -1
- package/dist/model/model-builder.js +33 -27
- package/package.json +7 -6
package/README.md
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Monarch syntax highlighting for the likec4 language.
|
|
2
2
|
export default {
|
|
3
3
|
keywords: [
|
|
4
|
-
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','cylinder','description','element','exclude','extend','gray','green','include','indigo','it','kind','link','mobile','model','muted','of','person','primary','queue','rectangle','red','secondary','shape','sky','slate','specification','storage','style','tag','technology','this','title','view','views'
|
|
4
|
+
'BottomTop','LeftRight','RightLeft','TopBottom','amber','autoLayout','blue','browser','color','cylinder','description','element','exclude','extend','gray','green','icon','include','indigo','it','kind','link','mobile','model','muted','of','person','primary','queue','rectangle','red','secondary','shape','sky','slate','specification','storage','style','tag','technology','this','title','view','views'
|
|
5
5
|
],
|
|
6
6
|
operators: [
|
|
7
7
|
'*','.*'
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "keyword.control.likec4",
|
|
15
|
-
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|cylinder|description|element|exclude|extend|gray|green|include|indigo|it|kind|link|mobile|model|muted|of|person|primary|queue|rectangle|red|secondary|shape|sky|slate|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|autoLayout|blue|browser|color|cylinder|description|element|exclude|extend|gray|green|icon|include|indigo|it|kind|link|mobile|model|muted|of|person|primary|queue|rectangle|red|secondary|shape|sky|slate|specification|storage|style|tag|technology|this|title|view|views)\\b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "string.quoted.double.likec4",
|
package/dist/ast.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import * as ast from './generated/ast';
|
|
|
5
5
|
export { ast };
|
|
6
6
|
export interface ParsedAstSpecification {
|
|
7
7
|
kinds: Record<c4.ElementKind, {
|
|
8
|
-
shape
|
|
9
|
-
color
|
|
8
|
+
shape?: c4.ElementShape;
|
|
9
|
+
color?: c4.ThemeColor;
|
|
10
|
+
icon?: c4.IconUrl;
|
|
10
11
|
}>;
|
|
11
12
|
}
|
|
12
13
|
export interface ParsedAstElement {
|
|
@@ -16,7 +17,9 @@ export interface ParsedAstElement {
|
|
|
16
17
|
title: string;
|
|
17
18
|
description?: string;
|
|
18
19
|
technology?: string;
|
|
19
|
-
|
|
20
|
+
icon?: c4.IconUrl;
|
|
21
|
+
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
22
|
+
links?: c4.NonEmptyArray<string>;
|
|
20
23
|
shape?: c4.ElementShape;
|
|
21
24
|
color?: c4.ThemeColor;
|
|
22
25
|
}
|
|
@@ -33,6 +36,8 @@ export interface ParsedAstElementView {
|
|
|
33
36
|
viewOf?: c4.Fqn;
|
|
34
37
|
title?: string;
|
|
35
38
|
description?: string;
|
|
39
|
+
tags?: c4.NonEmptyArray<c4.Tag>;
|
|
40
|
+
links?: c4.NonEmptyArray<string>;
|
|
36
41
|
rules: c4.ViewRule[];
|
|
37
42
|
}
|
|
38
43
|
export declare const ElementViewOps: {
|
|
@@ -64,9 +69,15 @@ export declare function resolveRelationPoints(node: ast.Relation): {
|
|
|
64
69
|
source: ast.Element;
|
|
65
70
|
target: ast.Element;
|
|
66
71
|
};
|
|
67
|
-
export declare function toElementStyle(props?: ast.
|
|
72
|
+
export declare function toElementStyle(props?: ast.StyleProperties['props']): {
|
|
68
73
|
color?: c4.ThemeColor;
|
|
69
74
|
shape?: c4.ElementShape;
|
|
75
|
+
icon?: c4.IconUrl;
|
|
76
|
+
};
|
|
77
|
+
export declare function toElementStyleExcludeDefaults(props?: ast.StyleProperties['props']): {
|
|
78
|
+
shape?: c4.ElementShape;
|
|
79
|
+
color?: c4.ThemeColor;
|
|
80
|
+
icon?: c4.IconUrl;
|
|
70
81
|
};
|
|
71
82
|
export declare function toAutoLayout(direction: ast.ViewRuleLayoutDirection): c4.ViewRuleAutoLayout['autoLayout'];
|
|
72
83
|
//# sourceMappingURL=ast.d.ts.map
|
package/dist/ast.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RelationRefError } from '@likec4/core';
|
|
1
|
+
import { DefaultElementShape, DefaultThemeColor, RelationRefError, nonexhaustive } from '@likec4/core';
|
|
2
2
|
import { DocumentState } from 'langium/lib/workspace';
|
|
3
|
-
// import objectHash from 'object-hash'
|
|
4
3
|
import { elementRef } from './elementRef';
|
|
5
4
|
import * as ast from './generated/ast';
|
|
6
5
|
import { LikeC4LanguageMetaData } from './generated/module';
|
|
@@ -8,7 +7,7 @@ export { ast };
|
|
|
8
7
|
const idattr = Symbol.for('idattr');
|
|
9
8
|
export const ElementViewOps = {
|
|
10
9
|
writeId(node, id) {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-extra-semi
|
|
12
11
|
;
|
|
13
12
|
node[idattr] = id;
|
|
14
13
|
return node;
|
|
@@ -25,7 +24,7 @@ export const ElementOps = {
|
|
|
25
24
|
delete node[idattr];
|
|
26
25
|
}
|
|
27
26
|
else {
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-extra-semi
|
|
29
28
|
;
|
|
30
29
|
node[idattr] = id;
|
|
31
30
|
}
|
|
@@ -55,7 +54,11 @@ export function isLikeC4LangiumDocument(doc) {
|
|
|
55
54
|
}
|
|
56
55
|
export function isParsedLikeC4LangiumDocument(doc) {
|
|
57
56
|
return (isLikeC4LangiumDocument(doc) &&
|
|
58
|
-
|
|
57
|
+
doc.state >= DocumentState.Validated &&
|
|
58
|
+
'c4Specification' in doc &&
|
|
59
|
+
'c4Elements' in doc &&
|
|
60
|
+
'c4Relations' in doc &&
|
|
61
|
+
'c4Views' in doc);
|
|
59
62
|
}
|
|
60
63
|
export const isValidLikeC4LangiumDocument = (doc) => {
|
|
61
64
|
if (!isParsedLikeC4LangiumDocument(doc))
|
|
@@ -122,16 +125,34 @@ export function resolveRelationPoints(node) {
|
|
|
122
125
|
}
|
|
123
126
|
export function toElementStyle(props) {
|
|
124
127
|
const result = {};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
result.color = color;
|
|
128
|
+
if (!props || props.length === 0) {
|
|
129
|
+
return result;
|
|
128
130
|
}
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
for (const prop of props) {
|
|
132
|
+
if (ast.isColorProperty(prop)) {
|
|
133
|
+
result.color = prop.value;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (ast.isShapeProperty(prop)) {
|
|
137
|
+
result.shape = prop.value;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (ast.isIconProperty(prop)) {
|
|
141
|
+
result.icon = prop.value;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
nonexhaustive(prop);
|
|
132
145
|
}
|
|
133
146
|
return result;
|
|
134
147
|
}
|
|
148
|
+
export function toElementStyleExcludeDefaults(props) {
|
|
149
|
+
const { color, shape, ...rest } = toElementStyle(props);
|
|
150
|
+
return {
|
|
151
|
+
...rest,
|
|
152
|
+
...(color && color !== DefaultThemeColor ? { color } : {}),
|
|
153
|
+
...(shape && shape !== DefaultElementShape ? { shape } : {})
|
|
154
|
+
};
|
|
155
|
+
}
|
|
135
156
|
export function toAutoLayout(direction) {
|
|
136
157
|
switch (direction) {
|
|
137
158
|
case 'TopBottom': {
|
package/dist/generated/ast.d.ts
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
|
|
6
6
|
import { AbstractAstReflection } from 'langium';
|
|
7
|
-
export type AStyleProperty = ColorProperty | ShapeProperty;
|
|
8
|
-
export declare const AStyleProperty = "AStyleProperty";
|
|
9
|
-
export declare function isAStyleProperty(item: unknown): item is AStyleProperty;
|
|
10
7
|
export type ElementExpression = ElementKindExpression | ElementRefExpression | ElementTagExpression | WildcardExpression;
|
|
11
8
|
export declare const ElementExpression = "ElementExpression";
|
|
12
9
|
export declare function isElementExpression(item: unknown): item is ElementExpression;
|
|
13
|
-
export type ElementProperty = ElementStringProperty |
|
|
10
|
+
export type ElementProperty = ElementStringProperty | StyleProperties;
|
|
14
11
|
export declare const ElementProperty = "ElementProperty";
|
|
15
12
|
export declare function isElementProperty(item: unknown): item is ElementProperty;
|
|
16
13
|
export type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
|
|
@@ -35,7 +32,7 @@ export declare function isViewRule(item: unknown): item is ViewRule;
|
|
|
35
32
|
export type ViewRuleLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom';
|
|
36
33
|
export declare function isViewRuleLayoutDirection(item: unknown): item is ViewRuleLayoutDirection;
|
|
37
34
|
export interface ColorProperty extends AstNode {
|
|
38
|
-
readonly $container:
|
|
35
|
+
readonly $container: StyleProperties | ViewRuleStyle;
|
|
39
36
|
readonly $type: 'ColorProperty';
|
|
40
37
|
key: 'color';
|
|
41
38
|
value: ThemeColor;
|
|
@@ -93,21 +90,13 @@ export interface ElementRefExpression extends AstNode {
|
|
|
93
90
|
export declare const ElementRefExpression = "ElementRefExpression";
|
|
94
91
|
export declare function isElementRefExpression(item: unknown): item is ElementRefExpression;
|
|
95
92
|
export interface ElementStringProperty extends AstNode {
|
|
96
|
-
readonly $container: ElementBody;
|
|
93
|
+
readonly $container: ElementBody | SpecificationElementKind | SpecificationTag;
|
|
97
94
|
readonly $type: 'ElementStringProperty';
|
|
98
95
|
key: 'description' | 'technology' | 'title';
|
|
99
96
|
value: string;
|
|
100
97
|
}
|
|
101
98
|
export declare const ElementStringProperty = "ElementStringProperty";
|
|
102
99
|
export declare function isElementStringProperty(item: unknown): item is ElementStringProperty;
|
|
103
|
-
export interface ElementStyleProperties extends AstNode {
|
|
104
|
-
readonly $container: ElementBody;
|
|
105
|
-
readonly $type: 'ElementStyleProperties';
|
|
106
|
-
key: 'style';
|
|
107
|
-
props: Array<ColorProperty | ShapeProperty>;
|
|
108
|
-
}
|
|
109
|
-
export declare const ElementStyleProperties = "ElementStyleProperties";
|
|
110
|
-
export declare function isElementStyleProperties(item: unknown): item is ElementStyleProperties;
|
|
111
100
|
export interface ElementTagExpression extends AstNode {
|
|
112
101
|
readonly $container: InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression | ViewRuleExpression | ViewRuleStyle;
|
|
113
102
|
readonly $type: 'ElementTagExpression';
|
|
@@ -120,8 +109,9 @@ export interface ElementView extends AstNode {
|
|
|
120
109
|
readonly $container: ModelViews;
|
|
121
110
|
readonly $type: 'ElementView';
|
|
122
111
|
name?: Name;
|
|
123
|
-
|
|
112
|
+
props: Array<LinkProperty | ViewProperty>;
|
|
124
113
|
rules: Array<ViewRuleAutoLayout | ViewRuleExpression | ViewRuleStyle>;
|
|
114
|
+
tags?: Tags;
|
|
125
115
|
viewOf?: ElementRef;
|
|
126
116
|
}
|
|
127
117
|
export declare const ElementView = "ElementView";
|
|
@@ -141,6 +131,14 @@ export interface ExtendElementBody extends AstNode {
|
|
|
141
131
|
}
|
|
142
132
|
export declare const ExtendElementBody = "ExtendElementBody";
|
|
143
133
|
export declare function isExtendElementBody(item: unknown): item is ExtendElementBody;
|
|
134
|
+
export interface IconProperty extends AstNode {
|
|
135
|
+
readonly $container: StyleProperties | ViewRuleStyle;
|
|
136
|
+
readonly $type: 'IconProperty';
|
|
137
|
+
key: 'icon';
|
|
138
|
+
value: Uri;
|
|
139
|
+
}
|
|
140
|
+
export declare const IconProperty = "IconProperty";
|
|
141
|
+
export declare function isIconProperty(item: unknown): item is IconProperty;
|
|
144
142
|
export interface IncomingExpression extends AstNode {
|
|
145
143
|
readonly $container: InOutExpression | IncomingExpression | OutgoingExpression | RelationExpression | ViewRuleExpression | ViewRuleStyle;
|
|
146
144
|
readonly $type: 'IncomingExpression';
|
|
@@ -166,7 +164,7 @@ export interface LikeC4Document extends AstNode {
|
|
|
166
164
|
export declare const LikeC4Document = "LikeC4Document";
|
|
167
165
|
export declare function isLikeC4Document(item: unknown): item is LikeC4Document;
|
|
168
166
|
export interface LinkProperty extends AstNode {
|
|
169
|
-
readonly $container: ElementBody;
|
|
167
|
+
readonly $container: ElementBody | ElementView;
|
|
170
168
|
readonly $type: 'LinkProperty';
|
|
171
169
|
key: 'link';
|
|
172
170
|
value: Uri;
|
|
@@ -234,7 +232,7 @@ export interface RelationStringProperty extends AstNode {
|
|
|
234
232
|
export declare const RelationStringProperty = "RelationStringProperty";
|
|
235
233
|
export declare function isRelationStringProperty(item: unknown): item is RelationStringProperty;
|
|
236
234
|
export interface ShapeProperty extends AstNode {
|
|
237
|
-
readonly $container:
|
|
235
|
+
readonly $container: StyleProperties | ViewRuleStyle;
|
|
238
236
|
readonly $type: 'ShapeProperty';
|
|
239
237
|
key: 'shape';
|
|
240
238
|
value: ElementShape;
|
|
@@ -245,7 +243,7 @@ export interface SpecificationElementKind extends AstNode {
|
|
|
245
243
|
readonly $container: SpecificationRule;
|
|
246
244
|
readonly $type: 'SpecificationElementKind';
|
|
247
245
|
kind: ElementKind;
|
|
248
|
-
style?:
|
|
246
|
+
style?: StyleProperties;
|
|
249
247
|
}
|
|
250
248
|
export declare const SpecificationElementKind = "SpecificationElementKind";
|
|
251
249
|
export declare function isSpecificationElementKind(item: unknown): item is SpecificationElementKind;
|
|
@@ -257,17 +255,10 @@ export interface SpecificationRule extends AstNode {
|
|
|
257
255
|
}
|
|
258
256
|
export declare const SpecificationRule = "SpecificationRule";
|
|
259
257
|
export declare function isSpecificationRule(item: unknown): item is SpecificationRule;
|
|
260
|
-
export interface SpecificationStyleProperties extends AstNode {
|
|
261
|
-
readonly $container: SpecificationElementKind | SpecificationTag;
|
|
262
|
-
readonly $type: 'SpecificationStyleProperties';
|
|
263
|
-
props: Array<ColorProperty | ShapeProperty>;
|
|
264
|
-
}
|
|
265
|
-
export declare const SpecificationStyleProperties = "SpecificationStyleProperties";
|
|
266
|
-
export declare function isSpecificationStyleProperties(item: unknown): item is SpecificationStyleProperties;
|
|
267
258
|
export interface SpecificationTag extends AstNode {
|
|
268
259
|
readonly $container: SpecificationRule;
|
|
269
260
|
readonly $type: 'SpecificationTag';
|
|
270
|
-
style?:
|
|
261
|
+
style?: StyleProperties;
|
|
271
262
|
tag: Tag;
|
|
272
263
|
}
|
|
273
264
|
export declare const SpecificationTag = "SpecificationTag";
|
|
@@ -280,6 +271,14 @@ export interface StrictElementRef extends AstNode {
|
|
|
280
271
|
}
|
|
281
272
|
export declare const StrictElementRef = "StrictElementRef";
|
|
282
273
|
export declare function isStrictElementRef(item: unknown): item is StrictElementRef;
|
|
274
|
+
export interface StyleProperties extends AstNode {
|
|
275
|
+
readonly $container: ElementBody | SpecificationElementKind | SpecificationTag;
|
|
276
|
+
readonly $type: 'StyleProperties';
|
|
277
|
+
key: 'style';
|
|
278
|
+
props: Array<ColorProperty | IconProperty | ShapeProperty>;
|
|
279
|
+
}
|
|
280
|
+
export declare const StyleProperties = "StyleProperties";
|
|
281
|
+
export declare function isStyleProperties(item: unknown): item is StyleProperties;
|
|
283
282
|
export interface Tag extends AstNode {
|
|
284
283
|
readonly $container: SpecificationTag;
|
|
285
284
|
readonly $type: 'Tag';
|
|
@@ -288,7 +287,7 @@ export interface Tag extends AstNode {
|
|
|
288
287
|
export declare const Tag = "Tag";
|
|
289
288
|
export declare function isTag(item: unknown): item is Tag;
|
|
290
289
|
export interface Tags extends AstNode {
|
|
291
|
-
readonly $container: ElementBody | RelationBody;
|
|
290
|
+
readonly $container: ElementBody | ElementView | RelationBody;
|
|
292
291
|
readonly $type: 'Tags';
|
|
293
292
|
value: Array<Reference<Tag>>;
|
|
294
293
|
}
|
|
@@ -320,7 +319,7 @@ export declare function isViewRuleExpression(item: unknown): item is ViewRuleExp
|
|
|
320
319
|
export interface ViewRuleStyle extends AstNode {
|
|
321
320
|
readonly $container: ElementView;
|
|
322
321
|
readonly $type: 'ViewRuleStyle';
|
|
323
|
-
props: Array<ColorProperty | ShapeProperty>;
|
|
322
|
+
props: Array<ColorProperty | IconProperty | ShapeProperty>;
|
|
324
323
|
targets: Array<ElementExpression>;
|
|
325
324
|
}
|
|
326
325
|
export declare const ViewRuleStyle = "ViewRuleStyle";
|
|
@@ -333,7 +332,6 @@ export interface WildcardExpression extends AstNode {
|
|
|
333
332
|
export declare const WildcardExpression = "WildcardExpression";
|
|
334
333
|
export declare function isWildcardExpression(item: unknown): item is WildcardExpression;
|
|
335
334
|
export type LikeC4AstType = {
|
|
336
|
-
AStyleProperty: AStyleProperty;
|
|
337
335
|
ColorProperty: ColorProperty;
|
|
338
336
|
Element: Element;
|
|
339
337
|
ElementBody: ElementBody;
|
|
@@ -344,12 +342,12 @@ export type LikeC4AstType = {
|
|
|
344
342
|
ElementRef: ElementRef;
|
|
345
343
|
ElementRefExpression: ElementRefExpression;
|
|
346
344
|
ElementStringProperty: ElementStringProperty;
|
|
347
|
-
ElementStyleProperties: ElementStyleProperties;
|
|
348
345
|
ElementTagExpression: ElementTagExpression;
|
|
349
346
|
ElementView: ElementView;
|
|
350
347
|
Expression: Expression;
|
|
351
348
|
ExtendElement: ExtendElement;
|
|
352
349
|
ExtendElementBody: ExtendElementBody;
|
|
350
|
+
IconProperty: IconProperty;
|
|
353
351
|
InOutExpression: InOutExpression;
|
|
354
352
|
IncomingExpression: IncomingExpression;
|
|
355
353
|
LikeC4Document: LikeC4Document;
|
|
@@ -364,9 +362,9 @@ export type LikeC4AstType = {
|
|
|
364
362
|
ShapeProperty: ShapeProperty;
|
|
365
363
|
SpecificationElementKind: SpecificationElementKind;
|
|
366
364
|
SpecificationRule: SpecificationRule;
|
|
367
|
-
SpecificationStyleProperties: SpecificationStyleProperties;
|
|
368
365
|
SpecificationTag: SpecificationTag;
|
|
369
366
|
StrictElementRef: StrictElementRef;
|
|
367
|
+
StyleProperties: StyleProperties;
|
|
370
368
|
Tag: Tag;
|
|
371
369
|
Tags: Tags;
|
|
372
370
|
View: View;
|
package/dist/generated/ast.js
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
import { AbstractAstReflection } from 'langium';
|
|
6
|
-
export const AStyleProperty = 'AStyleProperty';
|
|
7
|
-
export function isAStyleProperty(item) {
|
|
8
|
-
return reflection.isInstance(item, AStyleProperty);
|
|
9
|
-
}
|
|
10
6
|
export const ElementExpression = 'ElementExpression';
|
|
11
7
|
export function isElementExpression(item) {
|
|
12
8
|
return reflection.isInstance(item, ElementExpression);
|
|
@@ -23,7 +19,7 @@ export function isExpression(item) {
|
|
|
23
19
|
return reflection.isInstance(item, Expression);
|
|
24
20
|
}
|
|
25
21
|
export function isName(item) {
|
|
26
|
-
return isElementShape(item) || isThemeColor(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/((([^\W\d_])|(_))((([^\W\d_])|([0-9]))|(_))*)/.test(item)));
|
|
22
|
+
return isElementShape(item) || isThemeColor(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/((([^\W\d_])|(_))(((([^\W\d_])|([0-9]))|(_))|(-))*)/.test(item)));
|
|
27
23
|
}
|
|
28
24
|
export function isRArrow(item) {
|
|
29
25
|
return (typeof item === 'string' && (/->/.test(item)));
|
|
@@ -77,10 +73,6 @@ export const ElementStringProperty = 'ElementStringProperty';
|
|
|
77
73
|
export function isElementStringProperty(item) {
|
|
78
74
|
return reflection.isInstance(item, ElementStringProperty);
|
|
79
75
|
}
|
|
80
|
-
export const ElementStyleProperties = 'ElementStyleProperties';
|
|
81
|
-
export function isElementStyleProperties(item) {
|
|
82
|
-
return reflection.isInstance(item, ElementStyleProperties);
|
|
83
|
-
}
|
|
84
76
|
export const ElementTagExpression = 'ElementTagExpression';
|
|
85
77
|
export function isElementTagExpression(item) {
|
|
86
78
|
return reflection.isInstance(item, ElementTagExpression);
|
|
@@ -97,6 +89,10 @@ export const ExtendElementBody = 'ExtendElementBody';
|
|
|
97
89
|
export function isExtendElementBody(item) {
|
|
98
90
|
return reflection.isInstance(item, ExtendElementBody);
|
|
99
91
|
}
|
|
92
|
+
export const IconProperty = 'IconProperty';
|
|
93
|
+
export function isIconProperty(item) {
|
|
94
|
+
return reflection.isInstance(item, IconProperty);
|
|
95
|
+
}
|
|
100
96
|
export const IncomingExpression = 'IncomingExpression';
|
|
101
97
|
export function isIncomingExpression(item) {
|
|
102
98
|
return reflection.isInstance(item, IncomingExpression);
|
|
@@ -153,10 +149,6 @@ export const SpecificationRule = 'SpecificationRule';
|
|
|
153
149
|
export function isSpecificationRule(item) {
|
|
154
150
|
return reflection.isInstance(item, SpecificationRule);
|
|
155
151
|
}
|
|
156
|
-
export const SpecificationStyleProperties = 'SpecificationStyleProperties';
|
|
157
|
-
export function isSpecificationStyleProperties(item) {
|
|
158
|
-
return reflection.isInstance(item, SpecificationStyleProperties);
|
|
159
|
-
}
|
|
160
152
|
export const SpecificationTag = 'SpecificationTag';
|
|
161
153
|
export function isSpecificationTag(item) {
|
|
162
154
|
return reflection.isInstance(item, SpecificationTag);
|
|
@@ -165,6 +157,10 @@ export const StrictElementRef = 'StrictElementRef';
|
|
|
165
157
|
export function isStrictElementRef(item) {
|
|
166
158
|
return reflection.isInstance(item, StrictElementRef);
|
|
167
159
|
}
|
|
160
|
+
export const StyleProperties = 'StyleProperties';
|
|
161
|
+
export function isStyleProperties(item) {
|
|
162
|
+
return reflection.isInstance(item, StyleProperties);
|
|
163
|
+
}
|
|
168
164
|
export const Tag = 'Tag';
|
|
169
165
|
export function isTag(item) {
|
|
170
166
|
return reflection.isInstance(item, Tag);
|
|
@@ -195,14 +191,10 @@ export function isWildcardExpression(item) {
|
|
|
195
191
|
}
|
|
196
192
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
197
193
|
getAllTypes() {
|
|
198
|
-
return ['
|
|
194
|
+
return ['ColorProperty', 'Element', 'ElementBody', 'ElementExpression', 'ElementKind', 'ElementKindExpression', 'ElementProperty', 'ElementRef', 'ElementRefExpression', 'ElementStringProperty', 'ElementTagExpression', 'ElementView', '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'];
|
|
199
195
|
}
|
|
200
196
|
computeIsSubtype(subtype, supertype) {
|
|
201
197
|
switch (subtype) {
|
|
202
|
-
case ColorProperty:
|
|
203
|
-
case ShapeProperty: {
|
|
204
|
-
return this.isSubtype(AStyleProperty, supertype);
|
|
205
|
-
}
|
|
206
198
|
case ElementExpression:
|
|
207
199
|
case IncomingExpression:
|
|
208
200
|
case InOutExpression:
|
|
@@ -217,7 +209,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
217
209
|
return this.isSubtype(ElementExpression, supertype);
|
|
218
210
|
}
|
|
219
211
|
case ElementStringProperty:
|
|
220
|
-
case
|
|
212
|
+
case StyleProperties: {
|
|
221
213
|
return this.isSubtype(ElementProperty, supertype);
|
|
222
214
|
}
|
|
223
215
|
case ElementView: {
|
|
@@ -288,14 +280,6 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
288
280
|
]
|
|
289
281
|
};
|
|
290
282
|
}
|
|
291
|
-
case 'ElementStyleProperties': {
|
|
292
|
-
return {
|
|
293
|
-
name: 'ElementStyleProperties',
|
|
294
|
-
mandatory: [
|
|
295
|
-
{ name: 'props', type: 'array' }
|
|
296
|
-
]
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
283
|
case 'ElementTagExpression': {
|
|
300
284
|
return {
|
|
301
285
|
name: 'ElementTagExpression',
|
|
@@ -308,7 +292,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
308
292
|
return {
|
|
309
293
|
name: 'ElementView',
|
|
310
294
|
mandatory: [
|
|
311
|
-
{ name: '
|
|
295
|
+
{ name: 'props', type: 'array' },
|
|
312
296
|
{ name: 'rules', type: 'array' }
|
|
313
297
|
]
|
|
314
298
|
};
|
|
@@ -353,9 +337,9 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
353
337
|
]
|
|
354
338
|
};
|
|
355
339
|
}
|
|
356
|
-
case '
|
|
340
|
+
case 'StyleProperties': {
|
|
357
341
|
return {
|
|
358
|
-
name: '
|
|
342
|
+
name: 'StyleProperties',
|
|
359
343
|
mandatory: [
|
|
360
344
|
{ name: 'props', type: 'array' }
|
|
361
345
|
]
|