@likec4/language-server 1.13.0 → 1.15.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/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/likec4lib.cjs +0 -1
- package/dist/likec4lib.mjs +0 -1
- package/dist/model-graph/index.cjs +1 -1
- package/dist/model-graph/index.mjs +1 -1
- package/dist/shared/{language-server.CbDa016p.cjs → language-server.80ITEDo5.cjs} +272 -64
- package/dist/shared/{language-server.C2ebP2pZ.cjs → language-server.BUtiWTKg.cjs} +383 -32
- package/dist/shared/{language-server.DFLaUdYu.mjs → language-server.DXC9g4_f.mjs} +274 -66
- package/dist/shared/{language-server.ryB8CivX.d.mts → language-server.DfMwkd2l.d.mts} +81 -15
- package/dist/shared/{language-server.Cnq_hgfm.d.cts → language-server.U2piOAVt.d.cts} +81 -15
- package/dist/shared/{language-server.eY70DuKx.d.ts → language-server.j-ShR6as.d.ts} +81 -15
- package/dist/shared/{language-server.CrE0nFSB.mjs → language-server.zY53FGJE.mjs} +385 -34
- package/package.json +12 -12
- package/src/ast.ts +11 -0
- package/src/generated/ast.ts +177 -17
- package/src/generated/grammar.ts +1 -1
- package/src/generated-lib/icons.ts +0 -1
- package/src/like-c4.langium +50 -4
- package/src/lsp/CompletionProvider.ts +70 -2
- package/src/model/model-builder.ts +25 -3
- package/src/model/model-parser.ts +150 -33
- package/src/model-graph/compute-view/__test__/fixture.ts +45 -4
- package/src/model-graph/compute-view/compute.ts +223 -40
- package/src/model-graph/compute-view/predicates.ts +12 -6
- package/src/model-graph/utils/applyCustomElementProperties.ts +18 -4
- package/src/model-graph/utils/applyCustomRelationProperties.ts +2 -1
- package/src/model-graph/utils/applyViewRuleStyles.ts +30 -25
- package/src/model-graph/utils/buildComputeNodes.ts +69 -17
- package/src/model-graph/utils/elementExpressionToPredicate.ts +3 -1
- package/src/model-graph/utils/sortNodes.ts +11 -7
- package/src/references/scope-computation.ts +24 -1
- package/src/validation/index.ts +4 -0
- package/src/validation/specification.ts +30 -0
- package/src/view-utils/index.ts +1 -0
- package/src/view-utils/resolve-global-rules.ts +72 -0
- package/dist/shared/language-server.B-9_mDoo.d.mts +0 -1238
- package/dist/shared/language-server.C3oS5yhF.d.cts +0 -1238
- package/dist/shared/language-server.r5AXAWzc.d.ts +0 -1238
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.15.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@dagrejs/dagre": "^1.1.4",
|
|
115
|
-
"@likec4/core": "1.
|
|
116
|
-
"@likec4/log": "1.
|
|
115
|
+
"@likec4/core": "1.15.0",
|
|
116
|
+
"@likec4/log": "1.15.0",
|
|
117
117
|
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
118
118
|
"@smithy/util-base64": "^3.0.0",
|
|
119
119
|
"fast-equals": "^5.0.1",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"langium": "3.2.0",
|
|
123
123
|
"object-hash": "^3.0.0",
|
|
124
124
|
"p-debounce": "^4.0.0",
|
|
125
|
-
"remeda": "^2.
|
|
125
|
+
"remeda": "^2.15.0",
|
|
126
126
|
"string-hash": "^1.1.3",
|
|
127
127
|
"strip-indent": "^4.0.0",
|
|
128
128
|
"type-fest": "4.26.1",
|
|
@@ -133,20 +133,20 @@
|
|
|
133
133
|
"vscode-uri": "3.0.8"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
|
-
"@likec4/icons": "1.
|
|
137
|
-
"@likec4/tsconfig": "1.
|
|
138
|
-
"@types/node": "^20.16.
|
|
136
|
+
"@likec4/icons": "1.15.0",
|
|
137
|
+
"@likec4/tsconfig": "1.15.0",
|
|
138
|
+
"@types/node": "^20.16.14",
|
|
139
139
|
"@types/object-hash": "^3.0.6",
|
|
140
140
|
"@types/string-hash": "^1.1.3",
|
|
141
|
-
"@vitest/coverage-v8": "^2.1.
|
|
141
|
+
"@vitest/coverage-v8": "^2.1.3",
|
|
142
142
|
"execa": "^9.3.1",
|
|
143
143
|
"langium-cli": "3.2.0",
|
|
144
|
-
"npm-run-all2": "^6.2.
|
|
144
|
+
"npm-run-all2": "^6.2.6",
|
|
145
145
|
"tsx": "~4.9.3",
|
|
146
|
-
"turbo": "^2.
|
|
146
|
+
"turbo": "^2.2.3",
|
|
147
147
|
"typescript": "^5.6.3",
|
|
148
148
|
"unbuild": "^3.0.0-rc.11",
|
|
149
|
-
"vitest": "^2.1.
|
|
149
|
+
"vitest": "^2.1.3"
|
|
150
150
|
},
|
|
151
|
-
"packageManager": "yarn@4.5.
|
|
151
|
+
"packageManager": "yarn@4.5.1"
|
|
152
152
|
}
|
package/src/ast.ts
CHANGED
|
@@ -93,6 +93,10 @@ export interface ParsedAstRelation {
|
|
|
93
93
|
metadata?: { [key: string]: string }
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
export interface ParsedAstGlobals {
|
|
97
|
+
styles: Record<c4.GlobalStyleID, c4.NonEmptyArray<c4.ViewRuleStyle>>
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
export interface ParsedAstElementView {
|
|
97
101
|
__: 'element'
|
|
98
102
|
id: c4.ViewID
|
|
@@ -163,6 +167,7 @@ export interface LikeC4DocumentProps {
|
|
|
163
167
|
c4Specification?: ParsedAstSpecification
|
|
164
168
|
c4Elements?: ParsedAstElement[]
|
|
165
169
|
c4Relations?: ParsedAstRelation[]
|
|
170
|
+
c4Globals?: ParsedAstGlobals
|
|
166
171
|
c4Views?: ParsedAstView[]
|
|
167
172
|
// Fqn -> Element
|
|
168
173
|
c4fqnIndex?: MultiMap<c4.Fqn, DocFqnIndexAstNodeDescription>
|
|
@@ -190,6 +195,9 @@ export function cleanParsedModel(doc: LikeC4LangiumDocument) {
|
|
|
190
195
|
},
|
|
191
196
|
c4Elements: [],
|
|
192
197
|
c4Relations: [],
|
|
198
|
+
c4Globals: {
|
|
199
|
+
styles: {}
|
|
200
|
+
},
|
|
193
201
|
c4Views: []
|
|
194
202
|
}
|
|
195
203
|
return Object.assign(doc, props) as ParsedLikeC4LangiumDocument
|
|
@@ -226,6 +234,9 @@ function validatableAstNodeGuards<const Predicates extends Guard<AstNode>[]>(
|
|
|
226
234
|
return (n: AstNode): n is Guarded<Predicates[number]> => predicates.some(p => p(n))
|
|
227
235
|
}
|
|
228
236
|
const isValidatableAstNode = validatableAstNodeGuards([
|
|
237
|
+
ast.isGlobals,
|
|
238
|
+
ast.isGlobalStyle,
|
|
239
|
+
ast.isGlobalStyleGroup,
|
|
229
240
|
ast.isDynamicViewPredicateIterator,
|
|
230
241
|
ast.isElementPredicateWith,
|
|
231
242
|
ast.isRelationPredicateWith,
|
package/src/generated/ast.ts
CHANGED
|
@@ -68,8 +68,10 @@ export type LikeC4KeywordNames =
|
|
|
68
68
|
| "exclude"
|
|
69
69
|
| "extend"
|
|
70
70
|
| "extends"
|
|
71
|
+
| "global"
|
|
71
72
|
| "gray"
|
|
72
73
|
| "green"
|
|
74
|
+
| "group"
|
|
73
75
|
| "head"
|
|
74
76
|
| "icon"
|
|
75
77
|
| "icons"
|
|
@@ -113,6 +115,7 @@ export type LikeC4KeywordNames =
|
|
|
113
115
|
| "specification"
|
|
114
116
|
| "storage"
|
|
115
117
|
| "style"
|
|
118
|
+
| "styleGroup"
|
|
116
119
|
| "tag"
|
|
117
120
|
| "tail"
|
|
118
121
|
| "technology"
|
|
@@ -157,7 +160,7 @@ export function isDotId(item: unknown): item is DotId {
|
|
|
157
160
|
return typeof item === 'string';
|
|
158
161
|
}
|
|
159
162
|
|
|
160
|
-
export type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout |
|
|
163
|
+
export type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
|
|
161
164
|
|
|
162
165
|
export const DynamicViewRule = 'DynamicViewRule';
|
|
163
166
|
|
|
@@ -209,10 +212,10 @@ export function isIconId(item: unknown): item is IconId {
|
|
|
209
212
|
return (typeof item === 'string' && (/(aws|azure|gcp|tech):[-\w]*/.test(item)));
|
|
210
213
|
}
|
|
211
214
|
|
|
212
|
-
export type Id = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
|
|
215
|
+
export type Id = 'element' | 'group' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
|
|
213
216
|
|
|
214
217
|
export function isId(item: unknown): item is Id {
|
|
215
|
-
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || item === 'element' || item === 'model' || (typeof item === 'string' && (/[_]*[a-zA-Z][-\w]*/.test(item)));
|
|
218
|
+
return isElementShape(item) || isThemeColor(item) || isArrowType(item) || isLineOptions(item) || item === 'element' || item === 'model' || item === 'group' || (typeof item === 'string' && (/[_]*[a-zA-Z][-\w]*/.test(item)));
|
|
216
219
|
}
|
|
217
220
|
|
|
218
221
|
export type LikeC4View = DynamicView | ElementView;
|
|
@@ -333,7 +336,7 @@ export function isViewProperty(item: unknown): item is ViewProperty {
|
|
|
333
336
|
return reflection.isInstance(item, ViewProperty);
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
export type ViewRule = ViewRuleAutoLayout | ViewRulePredicate |
|
|
339
|
+
export type ViewRule = ViewRuleAutoLayout | ViewRuleGroup | ViewRulePredicate | ViewRuleStyleOrGlobalRef;
|
|
337
340
|
|
|
338
341
|
export const ViewRule = 'ViewRule';
|
|
339
342
|
|
|
@@ -349,6 +352,14 @@ export function isViewRulePredicate(item: unknown): item is ViewRulePredicate {
|
|
|
349
352
|
return reflection.isInstance(item, ViewRulePredicate);
|
|
350
353
|
}
|
|
351
354
|
|
|
355
|
+
export type ViewRuleStyleOrGlobalRef = ViewRuleGlobalStyle | ViewRuleStyle;
|
|
356
|
+
|
|
357
|
+
export const ViewRuleStyleOrGlobalRef = 'ViewRuleStyleOrGlobalRef';
|
|
358
|
+
|
|
359
|
+
export function isViewRuleStyleOrGlobalRef(item: unknown): item is ViewRuleStyleOrGlobalRef {
|
|
360
|
+
return reflection.isInstance(item, ViewRuleStyleOrGlobalRef);
|
|
361
|
+
}
|
|
362
|
+
|
|
352
363
|
export type WhereElement = WhereElementKind | WhereElementTag;
|
|
353
364
|
|
|
354
365
|
export const WhereElement = 'WhereElement';
|
|
@@ -419,7 +430,7 @@ export function isArrowProperty(item: unknown): item is ArrowProperty {
|
|
|
419
430
|
}
|
|
420
431
|
|
|
421
432
|
export interface BorderProperty extends AstNode {
|
|
422
|
-
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
433
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleGroup | ViewRuleStyle;
|
|
423
434
|
readonly $type: 'BorderProperty';
|
|
424
435
|
key: 'border';
|
|
425
436
|
value: BorderStyleValue;
|
|
@@ -432,7 +443,7 @@ export function isBorderProperty(item: unknown): item is BorderProperty {
|
|
|
432
443
|
}
|
|
433
444
|
|
|
434
445
|
export interface ColorProperty extends AstNode {
|
|
435
|
-
readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleStyle;
|
|
446
|
+
readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | GlobalStyle | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleGroup | ViewRuleStyle;
|
|
436
447
|
readonly $type: 'ColorProperty';
|
|
437
448
|
customColor?: Reference<CustomColor>;
|
|
438
449
|
key: 'color';
|
|
@@ -630,7 +641,7 @@ export function isElementDescedantsExpression(item: unknown): item is ElementDes
|
|
|
630
641
|
}
|
|
631
642
|
|
|
632
643
|
export interface ElementExpressionsIterator extends AstNode {
|
|
633
|
-
readonly $container: ElementExpressionsIterator | ViewRuleStyle;
|
|
644
|
+
readonly $container: ElementExpressionsIterator | GlobalStyle | ViewRuleStyle;
|
|
634
645
|
readonly $type: 'ElementExpressionsIterator';
|
|
635
646
|
prev?: ElementExpressionsIterator;
|
|
636
647
|
value: ElementExpression;
|
|
@@ -787,7 +798,7 @@ export function isElementViewRef(item: unknown): item is ElementViewRef {
|
|
|
787
798
|
}
|
|
788
799
|
|
|
789
800
|
export interface ExcludePredicate extends AstNode {
|
|
790
|
-
readonly $container: ElementViewBody;
|
|
801
|
+
readonly $container: ElementViewBody | ViewRuleGroup;
|
|
791
802
|
readonly $type: 'ExcludePredicate';
|
|
792
803
|
predicates: Predicates;
|
|
793
804
|
}
|
|
@@ -848,8 +859,60 @@ export function isFqnElementRef(item: unknown): item is FqnElementRef {
|
|
|
848
859
|
return reflection.isInstance(item, FqnElementRef);
|
|
849
860
|
}
|
|
850
861
|
|
|
862
|
+
export interface Globals extends AstNode {
|
|
863
|
+
readonly $container: LikeC4Grammar;
|
|
864
|
+
readonly $type: 'Globals';
|
|
865
|
+
name: 'global';
|
|
866
|
+
styles: Array<GlobalStyle | GlobalStyleGroup>;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export const Globals = 'Globals';
|
|
870
|
+
|
|
871
|
+
export function isGlobals(item: unknown): item is Globals {
|
|
872
|
+
return reflection.isInstance(item, Globals);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export interface GlobalStyle extends AstNode {
|
|
876
|
+
readonly $container: Globals;
|
|
877
|
+
readonly $type: 'GlobalStyle';
|
|
878
|
+
id: GlobalStyleId;
|
|
879
|
+
props: Array<NotationProperty | StyleProperty>;
|
|
880
|
+
target: ElementExpressionsIterator;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export const GlobalStyle = 'GlobalStyle';
|
|
884
|
+
|
|
885
|
+
export function isGlobalStyle(item: unknown): item is GlobalStyle {
|
|
886
|
+
return reflection.isInstance(item, GlobalStyle);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
export interface GlobalStyleGroup extends AstNode {
|
|
890
|
+
readonly $container: Globals;
|
|
891
|
+
readonly $type: 'GlobalStyleGroup';
|
|
892
|
+
id: GlobalStyleId;
|
|
893
|
+
styles: Array<ViewRuleStyle>;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
export const GlobalStyleGroup = 'GlobalStyleGroup';
|
|
897
|
+
|
|
898
|
+
export function isGlobalStyleGroup(item: unknown): item is GlobalStyleGroup {
|
|
899
|
+
return reflection.isInstance(item, GlobalStyleGroup);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
export interface GlobalStyleId extends AstNode {
|
|
903
|
+
readonly $container: GlobalStyle | GlobalStyleGroup;
|
|
904
|
+
readonly $type: 'GlobalStyleId';
|
|
905
|
+
name: string;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export const GlobalStyleId = 'GlobalStyleId';
|
|
909
|
+
|
|
910
|
+
export function isGlobalStyleId(item: unknown): item is GlobalStyleId {
|
|
911
|
+
return reflection.isInstance(item, GlobalStyleId);
|
|
912
|
+
}
|
|
913
|
+
|
|
851
914
|
export interface IconProperty extends AstNode {
|
|
852
|
-
readonly $container: CustomElementProperties | ElementBody | ElementStyleProperty | ViewRuleStyle;
|
|
915
|
+
readonly $container: CustomElementProperties | ElementBody | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
|
|
853
916
|
readonly $type: 'IconProperty';
|
|
854
917
|
key: 'icon';
|
|
855
918
|
libicon?: Reference<LibIcon>;
|
|
@@ -863,7 +926,7 @@ export function isIconProperty(item: unknown): item is IconProperty {
|
|
|
863
926
|
}
|
|
864
927
|
|
|
865
928
|
export interface IncludePredicate extends AstNode {
|
|
866
|
-
readonly $container: ElementViewBody;
|
|
929
|
+
readonly $container: ElementViewBody | ViewRuleGroup;
|
|
867
930
|
readonly $type: 'IncludePredicate';
|
|
868
931
|
predicates: Predicates;
|
|
869
932
|
}
|
|
@@ -912,6 +975,7 @@ export function isLibIcon(item: unknown): item is LibIcon {
|
|
|
912
975
|
|
|
913
976
|
export interface LikeC4Grammar extends AstNode {
|
|
914
977
|
readonly $type: 'LikeC4Grammar';
|
|
978
|
+
globals: Array<Globals>;
|
|
915
979
|
likec4lib: Array<LikeC4Lib>;
|
|
916
980
|
models: Array<Model>;
|
|
917
981
|
specifications: Array<SpecificationRule>;
|
|
@@ -1005,7 +1069,7 @@ export interface ModelViews extends AstNode {
|
|
|
1005
1069
|
readonly $container: LikeC4Grammar;
|
|
1006
1070
|
readonly $type: 'ModelViews';
|
|
1007
1071
|
name: 'views';
|
|
1008
|
-
styles: Array<
|
|
1072
|
+
styles: Array<ViewRuleStyleOrGlobalRef>;
|
|
1009
1073
|
views: Array<LikeC4View>;
|
|
1010
1074
|
}
|
|
1011
1075
|
|
|
@@ -1029,7 +1093,7 @@ export function isNavigateToProperty(item: unknown): item is NavigateToProperty
|
|
|
1029
1093
|
}
|
|
1030
1094
|
|
|
1031
1095
|
export interface NotationProperty extends AstNode {
|
|
1032
|
-
readonly $container: CustomElementProperties | CustomRelationProperties | ViewRuleStyle;
|
|
1096
|
+
readonly $container: CustomElementProperties | CustomRelationProperties | GlobalStyle | ViewRuleStyle;
|
|
1033
1097
|
readonly $type: 'NotationProperty';
|
|
1034
1098
|
key: 'notation';
|
|
1035
1099
|
value: string;
|
|
@@ -1055,7 +1119,7 @@ export function isNotesProperty(item: unknown): item is NotesProperty {
|
|
|
1055
1119
|
}
|
|
1056
1120
|
|
|
1057
1121
|
export interface OpacityProperty extends AstNode {
|
|
1058
|
-
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
1122
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleGroup | ViewRuleStyle;
|
|
1059
1123
|
readonly $type: 'OpacityProperty';
|
|
1060
1124
|
key: 'opacity';
|
|
1061
1125
|
value: string;
|
|
@@ -1203,7 +1267,7 @@ export function isRelationStyleProperty(item: unknown): item is RelationStylePro
|
|
|
1203
1267
|
}
|
|
1204
1268
|
|
|
1205
1269
|
export interface ShapeProperty extends AstNode {
|
|
1206
|
-
readonly $container: CustomElementProperties | ElementStyleProperty | ViewRuleStyle;
|
|
1270
|
+
readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
|
|
1207
1271
|
readonly $type: 'ShapeProperty';
|
|
1208
1272
|
key: 'shape';
|
|
1209
1273
|
value: ElementShape;
|
|
@@ -1359,8 +1423,34 @@ export function isViewRuleAutoLayout(item: unknown): item is ViewRuleAutoLayout
|
|
|
1359
1423
|
return reflection.isInstance(item, ViewRuleAutoLayout);
|
|
1360
1424
|
}
|
|
1361
1425
|
|
|
1362
|
-
export interface
|
|
1426
|
+
export interface ViewRuleGlobalStyle extends AstNode {
|
|
1363
1427
|
readonly $container: DynamicViewBody | ElementViewBody | ModelViews;
|
|
1428
|
+
readonly $type: 'ViewRuleGlobalStyle';
|
|
1429
|
+
style: Reference<GlobalStyleId>;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
export const ViewRuleGlobalStyle = 'ViewRuleGlobalStyle';
|
|
1433
|
+
|
|
1434
|
+
export function isViewRuleGlobalStyle(item: unknown): item is ViewRuleGlobalStyle {
|
|
1435
|
+
return reflection.isInstance(item, ViewRuleGlobalStyle);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
export interface ViewRuleGroup extends AstNode {
|
|
1439
|
+
readonly $container: ElementViewBody | ViewRuleGroup;
|
|
1440
|
+
readonly $type: 'ViewRuleGroup';
|
|
1441
|
+
groupRules: Array<ViewRuleGroup | ViewRulePredicate>;
|
|
1442
|
+
props: Array<BorderProperty | ColorProperty | OpacityProperty>;
|
|
1443
|
+
title?: string;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
export const ViewRuleGroup = 'ViewRuleGroup';
|
|
1447
|
+
|
|
1448
|
+
export function isViewRuleGroup(item: unknown): item is ViewRuleGroup {
|
|
1449
|
+
return reflection.isInstance(item, ViewRuleGroup);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
export interface ViewRuleStyle extends AstNode {
|
|
1453
|
+
readonly $container: DynamicViewBody | ElementViewBody | GlobalStyleGroup | ModelViews;
|
|
1364
1454
|
readonly $type: 'ViewRuleStyle';
|
|
1365
1455
|
props: Array<NotationProperty | StyleProperty>;
|
|
1366
1456
|
target: ElementExpressionsIterator;
|
|
@@ -1531,6 +1621,10 @@ export type LikeC4AstType = {
|
|
|
1531
1621
|
ExtendElement: ExtendElement
|
|
1532
1622
|
ExtendElementBody: ExtendElementBody
|
|
1533
1623
|
FqnElementRef: FqnElementRef
|
|
1624
|
+
GlobalStyle: GlobalStyle
|
|
1625
|
+
GlobalStyleGroup: GlobalStyleGroup
|
|
1626
|
+
GlobalStyleId: GlobalStyleId
|
|
1627
|
+
Globals: Globals
|
|
1534
1628
|
IconProperty: IconProperty
|
|
1535
1629
|
InOutRelationExpression: InOutRelationExpression
|
|
1536
1630
|
IncludePredicate: IncludePredicate
|
|
@@ -1582,8 +1676,11 @@ export type LikeC4AstType = {
|
|
|
1582
1676
|
ViewRef: ViewRef
|
|
1583
1677
|
ViewRule: ViewRule
|
|
1584
1678
|
ViewRuleAutoLayout: ViewRuleAutoLayout
|
|
1679
|
+
ViewRuleGlobalStyle: ViewRuleGlobalStyle
|
|
1680
|
+
ViewRuleGroup: ViewRuleGroup
|
|
1585
1681
|
ViewRulePredicate: ViewRulePredicate
|
|
1586
1682
|
ViewRuleStyle: ViewRuleStyle
|
|
1683
|
+
ViewRuleStyleOrGlobalRef: ViewRuleStyleOrGlobalRef
|
|
1587
1684
|
ViewStringProperty: ViewStringProperty
|
|
1588
1685
|
WhereBinaryExpression: WhereBinaryExpression
|
|
1589
1686
|
WhereElement: WhereElement
|
|
@@ -1605,7 +1702,7 @@ export type LikeC4AstType = {
|
|
|
1605
1702
|
export class LikeC4AstReflection extends AbstractAstReflection {
|
|
1606
1703
|
|
|
1607
1704
|
getAllTypes(): string[] {
|
|
1608
|
-
return [ArrowProperty, BorderProperty, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewPredicateIterator, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExtendElement, ExtendElementBody, FqnElementRef, IconProperty, InOutRelationExpression, IncludePredicate, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelViews, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpression, Predicate, Predicates, Relation, RelationBody, RelationExpression, RelationNavigateToProperty, RelationPredicate, RelationPredicateOrWhere, RelationPredicateWhere, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationColor, 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];
|
|
1705
|
+
return [ArrowProperty, BorderProperty, ColorProperty, CustomColor, CustomElementProperties, CustomRelationProperties, DirectedRelationExpression, DynamicView, DynamicViewBody, DynamicViewIncludePredicate, DynamicViewParallelSteps, DynamicViewPredicateIterator, DynamicViewRef, DynamicViewRule, DynamicViewStep, Element, ElementBody, ElementDescedantsExpression, ElementExpression, ElementExpressionsIterator, ElementKind, ElementKindExpression, ElementPredicate, ElementPredicateOrWhere, ElementPredicateWhere, ElementPredicateWith, ElementProperty, ElementRef, ElementStringProperty, ElementStyleProperty, ElementTagExpression, ElementView, ElementViewBody, ElementViewRef, ExcludePredicate, ExpandElementExpression, ExtendElement, ExtendElementBody, FqnElementRef, GlobalStyle, GlobalStyleGroup, GlobalStyleId, Globals, IconProperty, InOutRelationExpression, IncludePredicate, IncomingRelationExpression, LibIcon, LikeC4Grammar, LikeC4Lib, LikeC4View, LineProperty, LinkProperty, MetadataAttribute, MetadataBody, MetadataProperty, Model, ModelViews, NavigateToProperty, NotationProperty, NotesProperty, OpacityProperty, OutgoingRelationExpression, Predicate, Predicates, Relation, RelationBody, RelationExpression, RelationNavigateToProperty, RelationPredicate, RelationPredicateOrWhere, RelationPredicateWhere, RelationPredicateWith, RelationProperty, RelationStringProperty, RelationStyleProperty, RelationshipKind, RelationshipStyleProperty, ShapeProperty, SpecificationColor, SpecificationElementKind, SpecificationElementStringProperty, SpecificationRelationshipKind, SpecificationRelationshipStringProperty, SpecificationRule, SpecificationTag, StringProperty, StyleProperty, Tag, Tags, ViewProperty, ViewRef, ViewRule, ViewRuleAutoLayout, ViewRuleGlobalStyle, ViewRuleGroup, ViewRulePredicate, ViewRuleStyle, ViewRuleStyleOrGlobalRef, ViewStringProperty, WhereBinaryExpression, WhereElement, WhereElementExpression, WhereElementKind, WhereElementNegation, WhereElementTag, WhereExpression, WhereKindEqual, WhereRelation, WhereRelationExpression, WhereRelationKind, WhereRelationNegation, WhereRelationTag, WhereTagEqual, WildcardExpression];
|
|
1609
1706
|
}
|
|
1610
1707
|
|
|
1611
1708
|
protected override computeIsSubtype(subtype: string, supertype: string): boolean {
|
|
@@ -1700,9 +1797,14 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1700
1797
|
return this.isSubtype(RelationProperty, supertype) || this.isSubtype(StringProperty, supertype);
|
|
1701
1798
|
}
|
|
1702
1799
|
case ViewRuleAutoLayout:
|
|
1703
|
-
case
|
|
1800
|
+
case ViewRuleStyleOrGlobalRef: {
|
|
1704
1801
|
return this.isSubtype(DynamicViewRule, supertype) || this.isSubtype(ViewRule, supertype);
|
|
1705
1802
|
}
|
|
1803
|
+
case ViewRuleGlobalStyle:
|
|
1804
|
+
case ViewRuleStyle: {
|
|
1805
|
+
return this.isSubtype(ViewRuleStyleOrGlobalRef, supertype);
|
|
1806
|
+
}
|
|
1807
|
+
case ViewRuleGroup:
|
|
1706
1808
|
case ViewRulePredicate: {
|
|
1707
1809
|
return this.isSubtype(ViewRule, supertype);
|
|
1708
1810
|
}
|
|
@@ -1781,6 +1883,9 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
1781
1883
|
case 'ViewRef:view': {
|
|
1782
1884
|
return LikeC4View;
|
|
1783
1885
|
}
|
|
1886
|
+
case 'ViewRuleGlobalStyle:style': {
|
|
1887
|
+
return GlobalStyleId;
|
|
1888
|
+
}
|
|
1784
1889
|
default: {
|
|
1785
1890
|
throw new Error(`${referenceId} is not a valid reference id.`);
|
|
1786
1891
|
}
|
|
@@ -2096,6 +2201,42 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2096
2201
|
]
|
|
2097
2202
|
};
|
|
2098
2203
|
}
|
|
2204
|
+
case Globals: {
|
|
2205
|
+
return {
|
|
2206
|
+
name: Globals,
|
|
2207
|
+
properties: [
|
|
2208
|
+
{ name: 'name' },
|
|
2209
|
+
{ name: 'styles', defaultValue: [] }
|
|
2210
|
+
]
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
case GlobalStyle: {
|
|
2214
|
+
return {
|
|
2215
|
+
name: GlobalStyle,
|
|
2216
|
+
properties: [
|
|
2217
|
+
{ name: 'id' },
|
|
2218
|
+
{ name: 'props', defaultValue: [] },
|
|
2219
|
+
{ name: 'target' }
|
|
2220
|
+
]
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
case GlobalStyleGroup: {
|
|
2224
|
+
return {
|
|
2225
|
+
name: GlobalStyleGroup,
|
|
2226
|
+
properties: [
|
|
2227
|
+
{ name: 'id' },
|
|
2228
|
+
{ name: 'styles', defaultValue: [] }
|
|
2229
|
+
]
|
|
2230
|
+
};
|
|
2231
|
+
}
|
|
2232
|
+
case GlobalStyleId: {
|
|
2233
|
+
return {
|
|
2234
|
+
name: GlobalStyleId,
|
|
2235
|
+
properties: [
|
|
2236
|
+
{ name: 'name' }
|
|
2237
|
+
]
|
|
2238
|
+
};
|
|
2239
|
+
}
|
|
2099
2240
|
case IconProperty: {
|
|
2100
2241
|
return {
|
|
2101
2242
|
name: IconProperty,
|
|
@@ -2142,6 +2283,7 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2142
2283
|
return {
|
|
2143
2284
|
name: LikeC4Grammar,
|
|
2144
2285
|
properties: [
|
|
2286
|
+
{ name: 'globals', defaultValue: [] },
|
|
2145
2287
|
{ name: 'likec4lib', defaultValue: [] },
|
|
2146
2288
|
{ name: 'models', defaultValue: [] },
|
|
2147
2289
|
{ name: 'specifications', defaultValue: [] },
|
|
@@ -2452,6 +2594,24 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
2452
2594
|
]
|
|
2453
2595
|
};
|
|
2454
2596
|
}
|
|
2597
|
+
case ViewRuleGlobalStyle: {
|
|
2598
|
+
return {
|
|
2599
|
+
name: ViewRuleGlobalStyle,
|
|
2600
|
+
properties: [
|
|
2601
|
+
{ name: 'style' }
|
|
2602
|
+
]
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2605
|
+
case ViewRuleGroup: {
|
|
2606
|
+
return {
|
|
2607
|
+
name: ViewRuleGroup,
|
|
2608
|
+
properties: [
|
|
2609
|
+
{ name: 'groupRules', defaultValue: [] },
|
|
2610
|
+
{ name: 'props', defaultValue: [] },
|
|
2611
|
+
{ name: 'title' }
|
|
2612
|
+
]
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2455
2615
|
case ViewRuleStyle: {
|
|
2456
2616
|
return {
|
|
2457
2617
|
name: ViewRuleStyle,
|