@likec4/language-server 1.7.4 → 1.8.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/contrib/likec4.tmLanguage.json +1 -1
- package/package.json +9 -9
- package/src/ast.ts +30 -10
- package/src/generated/ast.ts +181 -41
- package/src/generated/grammar.ts +1 -1
- package/src/like-c4.langium +50 -8
- package/src/lsp/SemanticTokenProvider.ts +2 -2
- package/src/model/model-builder.ts +30 -13
- package/src/model/model-parser.ts +92 -22
- package/src/model-graph/compute-view/compute.ts +27 -5
- package/src/model-graph/dynamic-view/compute.ts +11 -3
- package/src/model-graph/utils/applyCustomElementProperties.ts +4 -3
- package/src/model-graph/utils/applyViewRuleStyles.ts +3 -0
- package/src/model-graph/utils/buildElementNotations.ts +63 -0
- package/src/references/scope-computation.ts +5 -5
- package/src/validation/dynamic-view-rule.ts +0 -6
- package/src/validation/property-checks.ts +1 -1
- package/src/view-utils/view-hash.ts +12 -18
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "keyword.control.likec4",
|
|
15
|
-
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|and|autoLayout|blue|border|browser|color|crow|cylinder|dashed|description|diamond|dot|dotted|dynamic|element|element\\.kind|element\\.tag|exclude|extend|extends|gray|green|head|icon|icons|include|indigo|is|it|kind|likec4lib|line|link|mobile|model|muted|navigateTo|none|normal|not|odiamond|odot|of|onormal|opacity|open|or|person|primary|queue|rectangle|red|relationship|secondary|shape|sky|slate|solid|specification|storage|style|tag|tail|technology|this|title|vee|view|views|where|with)\\b"
|
|
15
|
+
"match": "\\b(BottomTop|LeftRight|RightLeft|TopBottom|amber|and|autoLayout|blue|border|browser|color|crow|cylinder|dashed|description|diamond|dot|dotted|dynamic|element|element\\.kind|element\\.tag|exclude|extend|extends|gray|green|head|icon|icons|include|indigo|is|it|kind|likec4lib|line|link|metadata|mobile|model|muted|navigateTo|none|normal|not|notation|odiamond|odot|of|onormal|opacity|open|or|person|primary|queue|rectangle|red|relationship|secondary|shape|sky|slate|solid|specification|storage|style|tag|tail|technology|this|title|vee|view|views|where|with)\\b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "string.quoted.double.likec4",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
3
|
"description": "LikeC4 Language Server",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
"test:watch": "vitest"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@dagrejs/graphlib": "^2.2.
|
|
95
|
-
"@likec4/core": "1.
|
|
96
|
-
"@likec4/log": "1.
|
|
94
|
+
"@dagrejs/graphlib": "^2.2.4",
|
|
95
|
+
"@likec4/core": "1.8.0",
|
|
96
|
+
"@likec4/log": "1.8.0",
|
|
97
97
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
98
98
|
"@smithy/util-base64": "^3.0.0",
|
|
99
99
|
"@total-typescript/ts-reset": "^0.5.1",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"langium": "3.1.3",
|
|
104
104
|
"object-hash": "^3.0.0",
|
|
105
105
|
"p-debounce": "^4.0.0",
|
|
106
|
-
"remeda": "^2.
|
|
106
|
+
"remeda": "^2.11.0",
|
|
107
107
|
"string-hash": "^1.1.3",
|
|
108
108
|
"strip-indent": "^4.0.0",
|
|
109
109
|
"type-fest": "^4.21.0",
|
|
@@ -114,12 +114,12 @@
|
|
|
114
114
|
"vscode-uri": "3.0.8"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@likec4/icons": "1.
|
|
118
|
-
"@likec4/tsconfig": "1.
|
|
119
|
-
"@types/node": "^20.
|
|
117
|
+
"@likec4/icons": "1.8.0",
|
|
118
|
+
"@likec4/tsconfig": "1.8.0",
|
|
119
|
+
"@types/node": "^20.16.1",
|
|
120
120
|
"@types/object-hash": "^3.0.6",
|
|
121
121
|
"@types/string-hash": "^1.1.3",
|
|
122
|
-
"execa": "^9.3.
|
|
122
|
+
"execa": "^9.3.1",
|
|
123
123
|
"glob": "^11.0.0",
|
|
124
124
|
"langium-cli": "3.1.1",
|
|
125
125
|
"npm-run-all2": "^6.2.2",
|
package/src/ast.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DefaultLineStyle,
|
|
5
5
|
DefaultRelationshipColor,
|
|
6
6
|
nonexhaustive,
|
|
7
|
+
NullableError,
|
|
7
8
|
RelationRefError
|
|
8
9
|
} from '@likec4/core'
|
|
9
10
|
import type { AstNode, AstNodeDescription, DiagnosticInfo, LangiumDocument, MultiMap } from 'langium'
|
|
@@ -42,10 +43,16 @@ type ParsedElementStyle = {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export interface ParsedAstSpecification {
|
|
45
|
-
kinds: Record<c4.ElementKind,
|
|
46
|
+
kinds: Record<c4.ElementKind, {
|
|
47
|
+
technology?: string
|
|
48
|
+
notation?: string
|
|
49
|
+
style: ParsedElementStyle
|
|
50
|
+
}>
|
|
46
51
|
relationships: Record<
|
|
47
52
|
c4.RelationshipKind,
|
|
48
53
|
{
|
|
54
|
+
technology?: string
|
|
55
|
+
notation?: string
|
|
49
56
|
color?: c4.ThemeColor
|
|
50
57
|
line?: c4.RelationshipLineType
|
|
51
58
|
head?: c4.RelationshipArrowType
|
|
@@ -62,8 +69,9 @@ export interface ParsedAstElement {
|
|
|
62
69
|
description?: string
|
|
63
70
|
technology?: string
|
|
64
71
|
tags?: c4.NonEmptyArray<c4.Tag>
|
|
65
|
-
links?: c4.NonEmptyArray<
|
|
72
|
+
links?: c4.NonEmptyArray<ParsedLink>
|
|
66
73
|
style: ParsedElementStyle
|
|
74
|
+
metadata?: { [key: string]: string }
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
export interface ParsedAstRelation {
|
|
@@ -80,7 +88,8 @@ export interface ParsedAstRelation {
|
|
|
80
88
|
line?: c4.RelationshipLineType
|
|
81
89
|
head?: c4.RelationshipArrowType
|
|
82
90
|
tail?: c4.RelationshipArrowType
|
|
83
|
-
links?: c4.NonEmptyArray<
|
|
91
|
+
links?: c4.NonEmptyArray<ParsedLink>
|
|
92
|
+
metadata?: { [key: string]: string }
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
export interface ParsedAstElementView {
|
|
@@ -92,7 +101,7 @@ export interface ParsedAstElementView {
|
|
|
92
101
|
title: string | null
|
|
93
102
|
description: string | null
|
|
94
103
|
tags: c4.NonEmptyArray<c4.Tag> | null
|
|
95
|
-
links: c4.NonEmptyArray<
|
|
104
|
+
links: c4.NonEmptyArray<ParsedLink> | null
|
|
96
105
|
rules: c4.ViewRule[]
|
|
97
106
|
manualLayout?: c4.ViewManualLayout
|
|
98
107
|
}
|
|
@@ -104,7 +113,7 @@ export interface ParsedAstDynamicView {
|
|
|
104
113
|
title: string | null
|
|
105
114
|
description: string | null
|
|
106
115
|
tags: c4.NonEmptyArray<c4.Tag> | null
|
|
107
|
-
links: c4.NonEmptyArray<
|
|
116
|
+
links: c4.NonEmptyArray<ParsedLink> | null
|
|
108
117
|
steps: c4.DynamicViewStep[]
|
|
109
118
|
rules: Array<c4.DynamicViewRule>
|
|
110
119
|
manualLayout?: c4.ViewManualLayout
|
|
@@ -121,6 +130,11 @@ export const ViewOps = {
|
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
|
|
133
|
+
export interface ParsedLink {
|
|
134
|
+
title?: string
|
|
135
|
+
url: string
|
|
136
|
+
}
|
|
137
|
+
|
|
124
138
|
export const ElementOps = {
|
|
125
139
|
writeId(node: ast.Element, id: c4.Fqn | null) {
|
|
126
140
|
if (isNullish(id)) {
|
|
@@ -338,15 +352,21 @@ export function toElementStyle(props?: Array<ast.StyleProperty>) {
|
|
|
338
352
|
for (const prop of props) {
|
|
339
353
|
switch (true) {
|
|
340
354
|
case ast.isBorderProperty(prop): {
|
|
341
|
-
|
|
355
|
+
if (isTruthy(prop.value)) {
|
|
356
|
+
result.border = prop.value
|
|
357
|
+
}
|
|
342
358
|
break
|
|
343
359
|
}
|
|
344
360
|
case ast.isColorProperty(prop): {
|
|
345
|
-
|
|
361
|
+
if (isTruthy(prop.value)) {
|
|
362
|
+
result.color = prop.value
|
|
363
|
+
}
|
|
346
364
|
break
|
|
347
365
|
}
|
|
348
366
|
case ast.isShapeProperty(prop): {
|
|
349
|
-
|
|
367
|
+
if (isTruthy(prop.value)) {
|
|
368
|
+
result.shape = prop.value
|
|
369
|
+
}
|
|
350
370
|
break
|
|
351
371
|
}
|
|
352
372
|
case ast.isIconProperty(prop): {
|
|
@@ -368,7 +388,7 @@ export function toElementStyle(props?: Array<ast.StyleProperty>) {
|
|
|
368
388
|
return result
|
|
369
389
|
}
|
|
370
390
|
|
|
371
|
-
export function toRelationshipStyle(props?: ast.
|
|
391
|
+
export function toRelationshipStyle(props?: ast.RelationshipStyleProperty[]) {
|
|
372
392
|
const result = {} as {
|
|
373
393
|
color?: c4.ThemeColor
|
|
374
394
|
line?: c4.RelationshipLineType
|
|
@@ -411,7 +431,7 @@ export function toRelationshipStyle(props?: ast.SpecificationRelationshipKind['p
|
|
|
411
431
|
export function toRelationshipStyleExcludeDefaults(
|
|
412
432
|
props?: ast.SpecificationRelationshipKind['props']
|
|
413
433
|
) {
|
|
414
|
-
const { color, line, head, tail } = toRelationshipStyle(props)
|
|
434
|
+
const { color, line, head, tail } = toRelationshipStyle(props?.filter(ast.isRelationshipStyleProperty))
|
|
415
435
|
return {
|
|
416
436
|
...(color && color !== DefaultRelationshipColor ? { color } : {}),
|
|
417
437
|
...(line && line !== DefaultLineStyle ? { line } : {}),
|
package/src/generated/ast.ts
CHANGED
|
@@ -76,7 +76,7 @@ export function isElementPredicateOrWhere(item: unknown): item is ElementPredica
|
|
|
76
76
|
return reflection.isInstance(item, ElementPredicateOrWhere);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
export type ElementProperty = ElementStringProperty | IconProperty | LinkProperty |
|
|
79
|
+
export type ElementProperty = ElementStringProperty | ElementStyleProperty | IconProperty | LinkProperty | MetadataProperty;
|
|
80
80
|
|
|
81
81
|
export const ElementProperty = 'ElementProperty';
|
|
82
82
|
|
|
@@ -116,6 +116,14 @@ export function isLineOptions(item: unknown): item is LineOptions {
|
|
|
116
116
|
return item === 'solid' || item === 'dashed' || item === 'dotted';
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
export type MetadataProperty = MetadataBody;
|
|
120
|
+
|
|
121
|
+
export const MetadataProperty = 'MetadataProperty';
|
|
122
|
+
|
|
123
|
+
export function isMetadataProperty(item: unknown): item is MetadataProperty {
|
|
124
|
+
return reflection.isInstance(item, MetadataProperty);
|
|
125
|
+
}
|
|
126
|
+
|
|
119
127
|
export type Predicate = ElementPredicate | RelationPredicate;
|
|
120
128
|
|
|
121
129
|
export const Predicate = 'Predicate';
|
|
@@ -156,7 +164,7 @@ export function isRelationPredicateOrWhere(item: unknown): item is RelationPredi
|
|
|
156
164
|
return reflection.isInstance(item, RelationPredicateOrWhere);
|
|
157
165
|
}
|
|
158
166
|
|
|
159
|
-
export type RelationProperty = LinkProperty | RelationStringProperty | RelationStyleProperty;
|
|
167
|
+
export type RelationProperty = LinkProperty | MetadataProperty | RelationStringProperty | RelationStyleProperty;
|
|
160
168
|
|
|
161
169
|
export const RelationProperty = 'RelationProperty';
|
|
162
170
|
|
|
@@ -172,7 +180,7 @@ export function isRelationshipStyleProperty(item: unknown): item is Relationship
|
|
|
172
180
|
return reflection.isInstance(item, RelationshipStyleProperty);
|
|
173
181
|
}
|
|
174
182
|
|
|
175
|
-
export type StringProperty = ElementStringProperty | RelationStringProperty | ViewStringProperty;
|
|
183
|
+
export type StringProperty = ElementStringProperty | MetadataAttribute | NotationProperty | RelationStringProperty | SpecificationElementStringProperty | SpecificationRelationshipStringProperty | ViewStringProperty;
|
|
176
184
|
|
|
177
185
|
export const StringProperty = 'StringProperty';
|
|
178
186
|
|
|
@@ -306,7 +314,7 @@ export function isArrowProperty(item: unknown): item is ArrowProperty {
|
|
|
306
314
|
}
|
|
307
315
|
|
|
308
316
|
export interface BorderProperty extends AstNode {
|
|
309
|
-
readonly $container: CustomElementProperties |
|
|
317
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
310
318
|
readonly $type: 'BorderProperty';
|
|
311
319
|
key: 'border';
|
|
312
320
|
value: BorderStyleValue;
|
|
@@ -319,7 +327,7 @@ export function isBorderProperty(item: unknown): item is BorderProperty {
|
|
|
319
327
|
}
|
|
320
328
|
|
|
321
329
|
export interface ColorProperty extends AstNode {
|
|
322
|
-
readonly $container: CustomElementProperties | CustomRelationProperties |
|
|
330
|
+
readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleStyle;
|
|
323
331
|
readonly $type: 'ColorProperty';
|
|
324
332
|
key: 'color';
|
|
325
333
|
value: ThemeColor;
|
|
@@ -334,7 +342,7 @@ export function isColorProperty(item: unknown): item is ColorProperty {
|
|
|
334
342
|
export interface CustomElementProperties extends AstNode {
|
|
335
343
|
readonly $container: ElementPredicateWith;
|
|
336
344
|
readonly $type: 'CustomElementProperties';
|
|
337
|
-
props: Array<ElementStringProperty | NavigateToProperty | StyleProperty>;
|
|
345
|
+
props: Array<ElementStringProperty | NavigateToProperty | NotationProperty | StyleProperty>;
|
|
338
346
|
}
|
|
339
347
|
|
|
340
348
|
export const CustomElementProperties = 'CustomElementProperties';
|
|
@@ -346,7 +354,7 @@ export function isCustomElementProperties(item: unknown): item is CustomElementP
|
|
|
346
354
|
export interface CustomRelationProperties extends AstNode {
|
|
347
355
|
readonly $container: DynamicViewStep | RelationPredicateWith;
|
|
348
356
|
readonly $type: 'CustomRelationProperties';
|
|
349
|
-
props: Array<RelationStringProperty | RelationshipStyleProperty>;
|
|
357
|
+
props: Array<NotationProperty | RelationStringProperty | RelationshipStyleProperty>;
|
|
350
358
|
}
|
|
351
359
|
|
|
352
360
|
export const CustomRelationProperties = 'CustomRelationProperties';
|
|
@@ -569,6 +577,19 @@ export function isElementStringProperty(item: unknown): item is ElementStringPro
|
|
|
569
577
|
return reflection.isInstance(item, ElementStringProperty);
|
|
570
578
|
}
|
|
571
579
|
|
|
580
|
+
export interface ElementStyleProperty extends AstNode {
|
|
581
|
+
readonly $container: ElementBody | SpecificationElementKind;
|
|
582
|
+
readonly $type: 'ElementStyleProperty';
|
|
583
|
+
key: 'style';
|
|
584
|
+
props: Array<StyleProperty>;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export const ElementStyleProperty = 'ElementStyleProperty';
|
|
588
|
+
|
|
589
|
+
export function isElementStyleProperty(item: unknown): item is ElementStyleProperty {
|
|
590
|
+
return reflection.isInstance(item, ElementStyleProperty);
|
|
591
|
+
}
|
|
592
|
+
|
|
572
593
|
export interface ElementTagExpression extends AstNode {
|
|
573
594
|
readonly $container: DirectedRelationExpression | DynamicViewPredicateIterator | ElementExpressionsIterator | ElementPredicateWhere | ElementPredicateWith | IncomingRelationExpression | OutgoingRelationExpression | Predicates;
|
|
574
595
|
readonly $type: 'ElementTagExpression';
|
|
@@ -655,6 +676,7 @@ export interface ExplicitRelation extends AstNode {
|
|
|
655
676
|
source: ElementRef;
|
|
656
677
|
tags?: Tags;
|
|
657
678
|
target: ElementRef;
|
|
679
|
+
technology?: string;
|
|
658
680
|
title?: string;
|
|
659
681
|
}
|
|
660
682
|
|
|
@@ -703,7 +725,7 @@ export function isFqnElementRef(item: unknown): item is FqnElementRef {
|
|
|
703
725
|
}
|
|
704
726
|
|
|
705
727
|
export interface IconProperty extends AstNode {
|
|
706
|
-
readonly $container: CustomElementProperties | ElementBody |
|
|
728
|
+
readonly $container: CustomElementProperties | ElementBody | ElementStyleProperty | ViewRuleStyle;
|
|
707
729
|
readonly $type: 'IconProperty';
|
|
708
730
|
key: 'icon';
|
|
709
731
|
libicon?: Reference<LibIcon>;
|
|
@@ -723,6 +745,7 @@ export interface ImplicitRelation extends AstNode {
|
|
|
723
745
|
kind?: Reference<RelationshipKind>;
|
|
724
746
|
tags?: Tags;
|
|
725
747
|
target: ElementRef;
|
|
748
|
+
technology?: string;
|
|
726
749
|
title?: string;
|
|
727
750
|
}
|
|
728
751
|
|
|
@@ -823,6 +846,7 @@ export interface LinkProperty extends AstNode {
|
|
|
823
846
|
readonly $container: DynamicViewBody | ElementBody | ElementViewBody | RelationBody;
|
|
824
847
|
readonly $type: 'LinkProperty';
|
|
825
848
|
key: 'link';
|
|
849
|
+
title?: string;
|
|
826
850
|
value: Uri;
|
|
827
851
|
}
|
|
828
852
|
|
|
@@ -832,6 +856,31 @@ export function isLinkProperty(item: unknown): item is LinkProperty {
|
|
|
832
856
|
return reflection.isInstance(item, LinkProperty);
|
|
833
857
|
}
|
|
834
858
|
|
|
859
|
+
export interface MetadataAttribute extends AstNode {
|
|
860
|
+
readonly $container: MetadataBody;
|
|
861
|
+
readonly $type: 'MetadataAttribute';
|
|
862
|
+
key: string;
|
|
863
|
+
value: string;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
export const MetadataAttribute = 'MetadataAttribute';
|
|
867
|
+
|
|
868
|
+
export function isMetadataAttribute(item: unknown): item is MetadataAttribute {
|
|
869
|
+
return reflection.isInstance(item, MetadataAttribute);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export interface MetadataBody extends AstNode {
|
|
873
|
+
readonly $container: ElementBody | RelationBody;
|
|
874
|
+
readonly $type: 'MetadataBody';
|
|
875
|
+
props: Array<MetadataAttribute>;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
export const MetadataBody = 'MetadataBody';
|
|
879
|
+
|
|
880
|
+
export function isMetadataBody(item: unknown): item is MetadataBody {
|
|
881
|
+
return reflection.isInstance(item, MetadataBody);
|
|
882
|
+
}
|
|
883
|
+
|
|
835
884
|
export interface Model extends AstNode {
|
|
836
885
|
readonly $container: LikeC4Grammar;
|
|
837
886
|
readonly $type: 'Model';
|
|
@@ -871,8 +920,21 @@ export function isNavigateToProperty(item: unknown): item is NavigateToProperty
|
|
|
871
920
|
return reflection.isInstance(item, NavigateToProperty);
|
|
872
921
|
}
|
|
873
922
|
|
|
923
|
+
export interface NotationProperty extends AstNode {
|
|
924
|
+
readonly $container: CustomElementProperties | CustomRelationProperties | ViewRuleStyle;
|
|
925
|
+
readonly $type: 'NotationProperty';
|
|
926
|
+
key: 'notation';
|
|
927
|
+
value: string;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
export const NotationProperty = 'NotationProperty';
|
|
931
|
+
|
|
932
|
+
export function isNotationProperty(item: unknown): item is NotationProperty {
|
|
933
|
+
return reflection.isInstance(item, NotationProperty);
|
|
934
|
+
}
|
|
935
|
+
|
|
874
936
|
export interface OpacityProperty extends AstNode {
|
|
875
|
-
readonly $container: CustomElementProperties |
|
|
937
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
876
938
|
readonly $type: 'OpacityProperty';
|
|
877
939
|
key: 'opacity';
|
|
878
940
|
value: string;
|
|
@@ -989,7 +1051,7 @@ export function isRelationStyleProperty(item: unknown): item is RelationStylePro
|
|
|
989
1051
|
}
|
|
990
1052
|
|
|
991
1053
|
export interface ShapeProperty extends AstNode {
|
|
992
|
-
readonly $container: CustomElementProperties |
|
|
1054
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
993
1055
|
readonly $type: 'ShapeProperty';
|
|
994
1056
|
key: 'shape';
|
|
995
1057
|
value: ElementShape;
|
|
@@ -1005,7 +1067,7 @@ export interface SpecificationElementKind extends AstNode {
|
|
|
1005
1067
|
readonly $container: SpecificationRule;
|
|
1006
1068
|
readonly $type: 'SpecificationElementKind';
|
|
1007
1069
|
kind: ElementKind;
|
|
1008
|
-
|
|
1070
|
+
props: Array<ElementStyleProperty | SpecificationElementStringProperty>;
|
|
1009
1071
|
}
|
|
1010
1072
|
|
|
1011
1073
|
export const SpecificationElementKind = 'SpecificationElementKind';
|
|
@@ -1014,11 +1076,24 @@ export function isSpecificationElementKind(item: unknown): item is Specification
|
|
|
1014
1076
|
return reflection.isInstance(item, SpecificationElementKind);
|
|
1015
1077
|
}
|
|
1016
1078
|
|
|
1079
|
+
export interface SpecificationElementStringProperty extends AstNode {
|
|
1080
|
+
readonly $container: SpecificationElementKind;
|
|
1081
|
+
readonly $type: 'SpecificationElementStringProperty';
|
|
1082
|
+
key: 'notation' | 'technology';
|
|
1083
|
+
value: string;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
export const SpecificationElementStringProperty = 'SpecificationElementStringProperty';
|
|
1087
|
+
|
|
1088
|
+
export function isSpecificationElementStringProperty(item: unknown): item is SpecificationElementStringProperty {
|
|
1089
|
+
return reflection.isInstance(item, SpecificationElementStringProperty);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1017
1092
|
export interface SpecificationRelationshipKind extends AstNode {
|
|
1018
1093
|
readonly $container: SpecificationRule;
|
|
1019
1094
|
readonly $type: 'SpecificationRelationshipKind';
|
|
1020
1095
|
kind: RelationshipKind;
|
|
1021
|
-
props: Array<RelationshipStyleProperty>;
|
|
1096
|
+
props: Array<RelationshipStyleProperty | SpecificationRelationshipStringProperty>;
|
|
1022
1097
|
}
|
|
1023
1098
|
|
|
1024
1099
|
export const SpecificationRelationshipKind = 'SpecificationRelationshipKind';
|
|
@@ -1027,6 +1102,19 @@ export function isSpecificationRelationshipKind(item: unknown): item is Specific
|
|
|
1027
1102
|
return reflection.isInstance(item, SpecificationRelationshipKind);
|
|
1028
1103
|
}
|
|
1029
1104
|
|
|
1105
|
+
export interface SpecificationRelationshipStringProperty extends AstNode {
|
|
1106
|
+
readonly $container: SpecificationRelationshipKind;
|
|
1107
|
+
readonly $type: 'SpecificationRelationshipStringProperty';
|
|
1108
|
+
key: 'notation' | 'technology';
|
|
1109
|
+
value: string;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
export const SpecificationRelationshipStringProperty = 'SpecificationRelationshipStringProperty';
|
|
1113
|
+
|
|
1114
|
+
export function isSpecificationRelationshipStringProperty(item: unknown): item is SpecificationRelationshipStringProperty {
|
|
1115
|
+
return reflection.isInstance(item, SpecificationRelationshipStringProperty);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1030
1118
|
export interface SpecificationRule extends AstNode {
|
|
1031
1119
|
readonly $container: LikeC4Grammar;
|
|
1032
1120
|
readonly $type: 'SpecificationRule';
|
|
@@ -1054,19 +1142,6 @@ export function isSpecificationTag(item: unknown): item is SpecificationTag {
|
|
|
1054
1142
|
return reflection.isInstance(item, SpecificationTag);
|
|
1055
1143
|
}
|
|
1056
1144
|
|
|
1057
|
-
export interface StyleProperties extends AstNode {
|
|
1058
|
-
readonly $container: ElementBody | SpecificationElementKind;
|
|
1059
|
-
readonly $type: 'StyleProperties';
|
|
1060
|
-
key: 'style';
|
|
1061
|
-
props: Array<StyleProperty>;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
export const StyleProperties = 'StyleProperties';
|
|
1065
|
-
|
|
1066
|
-
export function isStyleProperties(item: unknown): item is StyleProperties {
|
|
1067
|
-
return reflection.isInstance(item, StyleProperties);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
1145
|
export interface Tag extends AstNode {
|
|
1071
1146
|
readonly $container: SpecificationTag;
|
|
1072
1147
|
readonly $type: 'Tag';
|
|
@@ -1119,7 +1194,7 @@ export function isViewRuleAutoLayout(item: unknown): item is ViewRuleAutoLayout
|
|
|
1119
1194
|
export interface ViewRuleStyle extends AstNode {
|
|
1120
1195
|
readonly $container: DynamicViewBody | ElementViewBody;
|
|
1121
1196
|
readonly $type: 'ViewRuleStyle';
|
|
1122
|
-
props: Array<StyleProperty>;
|
|
1197
|
+
props: Array<NotationProperty | StyleProperty>;
|
|
1123
1198
|
target: ElementExpressionsIterator;
|
|
1124
1199
|
}
|
|
1125
1200
|
|
|
@@ -1275,6 +1350,7 @@ export type LikeC4AstType = {
|
|
|
1275
1350
|
ElementProperty: ElementProperty
|
|
1276
1351
|
ElementRef: ElementRef
|
|
1277
1352
|
ElementStringProperty: ElementStringProperty
|
|
1353
|
+
ElementStyleProperty: ElementStyleProperty
|
|
1278
1354
|
ElementTagExpression: ElementTagExpression
|
|
1279
1355
|
ElementView: ElementView
|
|
1280
1356
|
ElementViewBody: ElementViewBody
|
|
@@ -1296,9 +1372,13 @@ export type LikeC4AstType = {
|
|
|
1296
1372
|
LikeC4View: LikeC4View
|
|
1297
1373
|
LineProperty: LineProperty
|
|
1298
1374
|
LinkProperty: LinkProperty
|
|
1375
|
+
MetadataAttribute: MetadataAttribute
|
|
1376
|
+
MetadataBody: MetadataBody
|
|
1377
|
+
MetadataProperty: MetadataProperty
|
|
1299
1378
|
Model: Model
|
|
1300
1379
|
ModelViews: ModelViews
|
|
1301
1380
|
NavigateToProperty: NavigateToProperty
|
|
1381
|
+
NotationProperty: NotationProperty
|
|
1302
1382
|
OpacityProperty: OpacityProperty
|
|
1303
1383
|
OutgoingRelationExpression: OutgoingRelationExpression
|
|
1304
1384
|
Predicate: Predicate
|
|
@@ -1317,11 +1397,12 @@ export type LikeC4AstType = {
|
|
|
1317
1397
|
RelationshipStyleProperty: RelationshipStyleProperty
|
|
1318
1398
|
ShapeProperty: ShapeProperty
|
|
1319
1399
|
SpecificationElementKind: SpecificationElementKind
|
|
1400
|
+
SpecificationElementStringProperty: SpecificationElementStringProperty
|
|
1320
1401
|
SpecificationRelationshipKind: SpecificationRelationshipKind
|
|
1402
|
+
SpecificationRelationshipStringProperty: SpecificationRelationshipStringProperty
|
|
1321
1403
|
SpecificationRule: SpecificationRule
|
|
1322
1404
|
SpecificationTag: SpecificationTag
|
|
1323
1405
|
StringProperty: StringProperty
|
|
1324
|
-
StyleProperties: StyleProperties
|
|
1325
1406
|
StyleProperty: StyleProperty
|
|
1326
1407
|
Tag: Tag
|
|
1327
1408
|
Tags: Tags
|
|
@@ -1352,7 +1433,7 @@ export type LikeC4AstType = {
|
|
|
1352
1433
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
1353
1434
|
|
|
1354
1435
|
getAllTypes(): string[] {
|
|
1355
|
-
return [ArrowProperty, BorderProperty, ColorProperty, CustomElementProperties, CustomRelationProperties, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewIncludePredicate, DynamicViewPredicateIterator, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExplicitRelation, ExtendElement, ExtendElementBody, FqnElementRef, IconProperty, ImplicitRelation, InOutRelationExpression, IncludePredicate, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, Model, ModelViews, NavigateToProperty, OpacityProperty, OutgoingRelationExpression, Predicate, Predicates, Relation, RelationBody, RelationExpression, RelationPredicate, RelationPredicateOrWhere, RelationPredicateWhere, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationElementKind, SpecificationRelationshipKind, SpecificationRule, SpecificationTag, StringProperty,
|
|
1436
|
+
return [ArrowProperty, BorderProperty, ColorProperty, CustomElementProperties, CustomRelationProperties, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewIncludePredicate, DynamicViewPredicateIterator, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExplicitRelation, ExtendElement, ExtendElementBody, FqnElementRef, IconProperty, ImplicitRelation, InOutRelationExpression, IncludePredicate, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelViews, NavigateToProperty, NotationProperty, OpacityProperty, OutgoingRelationExpression, Predicate, Predicates, Relation, RelationBody, RelationExpression, RelationPredicate, RelationPredicateOrWhere, RelationPredicateWhere, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StringProperty, StyleProperty, Tag, Tags, ViewProperty, ViewRef, ViewRule, ViewRuleAutoLayout, ViewRulePredicate, ViewRuleStyle, ViewStringProperty, WhereBinaryExpression, WhereElement, WhereElementExpression, WhereElementKind, WhereElementNegation, WhereElementTag, WhereExpression, WhereKindEqual, WhereRelation, WhereRelationExpression, WhereRelationKind, WhereRelationNegation, WhereRelationTag, WhereTagEqual, WildcardExpression];
|
|
1356
1437
|
}
|
|
1357
1438
|
|
|
1358
1439
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
@@ -1405,6 +1486,9 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1405
1486
|
case ElementStringProperty: {
|
|
1406
1487
|
return this.isSubtype(ElementProperty, supertype) || this.isSubtype(StringProperty, supertype);
|
|
1407
1488
|
}
|
|
1489
|
+
case ElementStyleProperty: {
|
|
1490
|
+
return this.isSubtype(ElementProperty, supertype);
|
|
1491
|
+
}
|
|
1408
1492
|
case ExcludePredicate:
|
|
1409
1493
|
case IncludePredicate: {
|
|
1410
1494
|
return this.isSubtype(ViewRulePredicate, supertype);
|
|
@@ -1419,6 +1503,18 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1419
1503
|
case LinkProperty: {
|
|
1420
1504
|
return this.isSubtype(ElementProperty, supertype) || this.isSubtype(RelationProperty, supertype) || this.isSubtype(ViewProperty, supertype);
|
|
1421
1505
|
}
|
|
1506
|
+
case MetadataAttribute:
|
|
1507
|
+
case NotationProperty:
|
|
1508
|
+
case SpecificationElementStringProperty:
|
|
1509
|
+
case SpecificationRelationshipStringProperty: {
|
|
1510
|
+
return this.isSubtype(StringProperty, supertype);
|
|
1511
|
+
}
|
|
1512
|
+
case MetadataBody: {
|
|
1513
|
+
return this.isSubtype(MetadataProperty, supertype);
|
|
1514
|
+
}
|
|
1515
|
+
case MetadataProperty: {
|
|
1516
|
+
return this.isSubtype(ElementProperty, supertype) || this.isSubtype(RelationProperty, supertype);
|
|
1517
|
+
}
|
|
1422
1518
|
case RelationExpression:
|
|
1423
1519
|
case RelationPredicateWhere: {
|
|
1424
1520
|
return this.isSubtype(RelationPredicateOrWhere, supertype);
|
|
@@ -1433,9 +1529,6 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1433
1529
|
case RelationStyleProperty: {
|
|
1434
1530
|
return this.isSubtype(RelationProperty, supertype);
|
|
1435
1531
|
}
|
|
1436
|
-
case StyleProperties: {
|
|
1437
|
-
return this.isSubtype(ElementProperty, supertype);
|
|
1438
|
-
}
|
|
1439
1532
|
case ViewRuleAutoLayout:
|
|
1440
1533
|
case ViewRuleStyle: {
|
|
1441
1534
|
return this.isSubtype(DynamicViewRule, supertype) || this.isSubtype(ViewRule, supertype);
|
|
@@ -1714,6 +1807,15 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1714
1807
|
]
|
|
1715
1808
|
};
|
|
1716
1809
|
}
|
|
1810
|
+
case ElementStyleProperty: {
|
|
1811
|
+
return {
|
|
1812
|
+
name: ElementStyleProperty,
|
|
1813
|
+
properties: [
|
|
1814
|
+
{ name: 'key' },
|
|
1815
|
+
{ name: 'props', defaultValue: [] }
|
|
1816
|
+
]
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1717
1819
|
case ElementTagExpression: {
|
|
1718
1820
|
return {
|
|
1719
1821
|
name: ElementTagExpression,
|
|
@@ -1777,6 +1879,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1777
1879
|
{ name: 'source' },
|
|
1778
1880
|
{ name: 'tags' },
|
|
1779
1881
|
{ name: 'target' },
|
|
1882
|
+
{ name: 'technology' },
|
|
1780
1883
|
{ name: 'title' }
|
|
1781
1884
|
]
|
|
1782
1885
|
};
|
|
@@ -1825,6 +1928,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1825
1928
|
{ name: 'kind' },
|
|
1826
1929
|
{ name: 'tags' },
|
|
1827
1930
|
{ name: 'target' },
|
|
1931
|
+
{ name: 'technology' },
|
|
1828
1932
|
{ name: 'title' }
|
|
1829
1933
|
]
|
|
1830
1934
|
};
|
|
@@ -1892,12 +1996,30 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1892
1996
|
case LinkProperty: {
|
|
1893
1997
|
return {
|
|
1894
1998
|
name: LinkProperty,
|
|
1999
|
+
properties: [
|
|
2000
|
+
{ name: 'key' },
|
|
2001
|
+
{ name: 'title' },
|
|
2002
|
+
{ name: 'value' }
|
|
2003
|
+
]
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
case MetadataAttribute: {
|
|
2007
|
+
return {
|
|
2008
|
+
name: MetadataAttribute,
|
|
1895
2009
|
properties: [
|
|
1896
2010
|
{ name: 'key' },
|
|
1897
2011
|
{ name: 'value' }
|
|
1898
2012
|
]
|
|
1899
2013
|
};
|
|
1900
2014
|
}
|
|
2015
|
+
case MetadataBody: {
|
|
2016
|
+
return {
|
|
2017
|
+
name: MetadataBody,
|
|
2018
|
+
properties: [
|
|
2019
|
+
{ name: 'props', defaultValue: [] }
|
|
2020
|
+
]
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
1901
2023
|
case Model: {
|
|
1902
2024
|
return {
|
|
1903
2025
|
name: Model,
|
|
@@ -1925,6 +2047,15 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1925
2047
|
]
|
|
1926
2048
|
};
|
|
1927
2049
|
}
|
|
2050
|
+
case NotationProperty: {
|
|
2051
|
+
return {
|
|
2052
|
+
name: NotationProperty,
|
|
2053
|
+
properties: [
|
|
2054
|
+
{ name: 'key' },
|
|
2055
|
+
{ name: 'value' }
|
|
2056
|
+
]
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
1928
2059
|
case OpacityProperty: {
|
|
1929
2060
|
return {
|
|
1930
2061
|
name: OpacityProperty,
|
|
@@ -2020,7 +2151,16 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2020
2151
|
name: SpecificationElementKind,
|
|
2021
2152
|
properties: [
|
|
2022
2153
|
{ name: 'kind' },
|
|
2023
|
-
{ name: '
|
|
2154
|
+
{ name: 'props', defaultValue: [] }
|
|
2155
|
+
]
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
case SpecificationElementStringProperty: {
|
|
2159
|
+
return {
|
|
2160
|
+
name: SpecificationElementStringProperty,
|
|
2161
|
+
properties: [
|
|
2162
|
+
{ name: 'key' },
|
|
2163
|
+
{ name: 'value' }
|
|
2024
2164
|
]
|
|
2025
2165
|
};
|
|
2026
2166
|
}
|
|
@@ -2033,6 +2173,15 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2033
2173
|
]
|
|
2034
2174
|
};
|
|
2035
2175
|
}
|
|
2176
|
+
case SpecificationRelationshipStringProperty: {
|
|
2177
|
+
return {
|
|
2178
|
+
name: SpecificationRelationshipStringProperty,
|
|
2179
|
+
properties: [
|
|
2180
|
+
{ name: 'key' },
|
|
2181
|
+
{ name: 'value' }
|
|
2182
|
+
]
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2036
2185
|
case SpecificationRule: {
|
|
2037
2186
|
return {
|
|
2038
2187
|
name: SpecificationRule,
|
|
@@ -2052,15 +2201,6 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2052
2201
|
]
|
|
2053
2202
|
};
|
|
2054
2203
|
}
|
|
2055
|
-
case StyleProperties: {
|
|
2056
|
-
return {
|
|
2057
|
-
name: StyleProperties,
|
|
2058
|
-
properties: [
|
|
2059
|
-
{ name: 'key' },
|
|
2060
|
-
{ name: 'props', defaultValue: [] }
|
|
2061
|
-
]
|
|
2062
|
-
};
|
|
2063
|
-
}
|
|
2064
2204
|
case Tag: {
|
|
2065
2205
|
return {
|
|
2066
2206
|
name: Tag,
|