@likec4/language-server 1.14.0 → 1.15.1

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 (46) hide show
  1. package/contrib/likec4.tmLanguage.json +1 -1
  2. package/dist/browser.cjs +1 -1
  3. package/dist/browser.d.cts +2 -2
  4. package/dist/browser.d.mts +2 -2
  5. package/dist/browser.d.ts +2 -2
  6. package/dist/browser.mjs +2 -2
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.mts +2 -2
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.mjs +2 -2
  12. package/dist/likec4lib.cjs +0 -1
  13. package/dist/likec4lib.mjs +0 -1
  14. package/dist/model-graph/index.cjs +1 -1
  15. package/dist/model-graph/index.mjs +1 -1
  16. package/dist/shared/{language-server.CbDa016p.cjs → language-server.B8s2wfT_.cjs} +279 -68
  17. package/dist/shared/{language-server.DFLaUdYu.mjs → language-server.BT4WTbFI.mjs} +281 -70
  18. package/dist/shared/{language-server.DZYziEuF.mjs → language-server.BuChFlda.mjs} +231 -44
  19. package/dist/shared/{language-server.CO6aEDQm.d.mts → language-server.DfMwkd2l.d.mts} +46 -15
  20. package/dist/shared/{language-server.CITj0XN3.cjs → language-server.DfjkvknB.cjs} +230 -43
  21. package/dist/shared/{language-server.Cqyh6-9S.d.cts → language-server.U2piOAVt.d.cts} +46 -15
  22. package/dist/shared/{language-server.BI99piRy.d.ts → language-server.j-ShR6as.d.ts} +46 -15
  23. package/package.json +10 -10
  24. package/src/ast.ts +1 -0
  25. package/src/formatting/LikeC4Formatter.ts +44 -4
  26. package/src/generated/ast.ts +103 -19
  27. package/src/generated/grammar.ts +1 -1
  28. package/src/generated-lib/icons.ts +0 -1
  29. package/src/like-c4.langium +32 -9
  30. package/src/lsp/CompletionProvider.ts +70 -2
  31. package/src/lsp/SemanticTokenProvider.ts +3 -1
  32. package/src/model/model-builder.ts +13 -7
  33. package/src/model/model-parser.ts +71 -20
  34. package/src/model-graph/compute-view/__test__/fixture.ts +96 -29
  35. package/src/model-graph/compute-view/compute.ts +223 -40
  36. package/src/model-graph/compute-view/predicates.ts +12 -6
  37. package/src/model-graph/utils/applyCustomElementProperties.ts +18 -4
  38. package/src/model-graph/utils/applyCustomRelationProperties.ts +9 -39
  39. package/src/model-graph/utils/applyViewRuleStyles.ts +30 -25
  40. package/src/model-graph/utils/buildComputeNodes.ts +69 -17
  41. package/src/model-graph/utils/elementExpressionToPredicate.ts +3 -1
  42. package/src/model-graph/utils/relationExpressionToPredicates.ts +43 -0
  43. package/src/model-graph/utils/sortNodes.ts +11 -7
  44. package/src/references/scope-computation.ts +3 -2
  45. package/src/validation/index.ts +2 -2
  46. package/src/validation/specification.ts +4 -4
@@ -47,7 +47,7 @@ type ArrowType = 'crow' | 'diamond' | 'dot' | 'none' | 'normal' | 'odiamond' | '
47
47
  type BorderStyleValue = 'none' | LineOptions;
48
48
  type CustomColorId = 'element' | 'model' | ArrowType | ElementShape | LineOptions | string;
49
49
  type CustomColorValue = string;
50
- type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleGlobalStyle | ViewRuleStyle;
50
+ type DynamicViewRule = DynamicViewIncludePredicate | ViewRuleAutoLayout | ViewRuleStyleOrGlobalRef;
51
51
  declare const DynamicViewRule = "DynamicViewRule";
52
52
  declare function isDynamicViewRule(item: unknown): item is DynamicViewRule;
53
53
  type ElementExpression = ElementDescedantsExpression | ElementKindExpression | ElementRef | ElementTagExpression | ExpandElementExpression | WildcardExpression;
@@ -62,7 +62,7 @@ declare const ElementProperty = "ElementProperty";
62
62
  declare function isElementProperty(item: unknown): item is ElementProperty;
63
63
  type ElementShape = 'browser' | 'cylinder' | 'mobile' | 'person' | 'queue' | 'rectangle' | 'storage';
64
64
  type IconId = string;
65
- type Id = 'element' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
65
+ type Id = 'element' | 'group' | 'model' | ArrowType | ElementShape | LineOptions | ThemeColor | string;
66
66
  type LikeC4View = DynamicView | ElementView;
67
67
  declare const LikeC4View = "LikeC4View";
68
68
  declare function isLikeC4View(item: unknown): item is LikeC4View;
@@ -94,11 +94,13 @@ type ViewLayoutDirection = 'BottomTop' | 'LeftRight' | 'RightLeft' | 'TopBottom'
94
94
  type ViewProperty = LinkProperty | ViewStringProperty;
95
95
  declare const ViewProperty = "ViewProperty";
96
96
  declare function isViewProperty(item: unknown): item is ViewProperty;
97
- type ViewRule = ViewRuleAutoLayout | ViewRuleGlobalStyle | ViewRulePredicate | ViewRuleStyle;
97
+ type ViewRule = ViewRuleAutoLayout | ViewRuleGroup | ViewRulePredicate | ViewRuleStyleOrGlobalRef;
98
98
  declare const ViewRule = "ViewRule";
99
99
  declare function isViewRule(item: unknown): item is ViewRule;
100
100
  type ViewRulePredicate = ExcludePredicate | IncludePredicate;
101
101
  declare const ViewRulePredicate = "ViewRulePredicate";
102
+ type ViewRuleStyleOrGlobalRef = ViewRuleGlobalStyle | ViewRuleStyle;
103
+ declare const ViewRuleStyleOrGlobalRef = "ViewRuleStyleOrGlobalRef";
102
104
  type WhereElement = WhereElementKind | WhereElementTag;
103
105
  declare const WhereElement = "WhereElement";
104
106
  type WhereElementExpression = WhereBinaryExpression | WhereElement | WhereElementNegation;
@@ -121,14 +123,14 @@ interface ArrowProperty extends AstNode {
121
123
  }
122
124
  declare const ArrowProperty = "ArrowProperty";
123
125
  interface BorderProperty extends AstNode {
124
- readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
126
+ readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleGroup | ViewRuleStyle;
125
127
  readonly $type: 'BorderProperty';
126
128
  key: 'border';
127
129
  value: BorderStyleValue;
128
130
  }
129
131
  declare const BorderProperty = "BorderProperty";
130
132
  interface ColorProperty extends AstNode {
131
- readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | GlobalStyle | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleStyle;
133
+ readonly $container: CustomElementProperties | CustomRelationProperties | ElementStyleProperty | GlobalStyle | RelationStyleProperty | SpecificationRelationshipKind | ViewRuleGroup | ViewRuleStyle;
132
134
  readonly $type: 'ColorProperty';
133
135
  customColor?: Reference<CustomColor>;
134
136
  key: 'color';
@@ -329,7 +331,7 @@ interface ElementViewRef extends AstNode {
329
331
  }
330
332
  declare const ElementViewRef = "ElementViewRef";
331
333
  interface ExcludePredicate extends AstNode {
332
- readonly $container: ElementViewBody;
334
+ readonly $container: ElementViewBody | ViewRuleGroup;
333
335
  readonly $type: 'ExcludePredicate';
334
336
  predicates: Predicates;
335
337
  }
@@ -366,19 +368,33 @@ interface Globals extends AstNode {
366
368
  readonly $container: LikeC4Grammar;
367
369
  readonly $type: 'Globals';
368
370
  name: 'global';
369
- styles: Array<GlobalStyle>;
371
+ styles: Array<GlobalStyle | GlobalStyleGroup>;
370
372
  }
371
373
  declare const Globals = "Globals";
372
374
  declare function isGlobals(item: unknown): item is Globals;
373
375
  interface GlobalStyle extends AstNode {
374
376
  readonly $container: Globals;
375
377
  readonly $type: 'GlobalStyle';
376
- name: string;
378
+ id: GlobalStyleId;
377
379
  props: Array<NotationProperty | StyleProperty>;
378
380
  target: ElementExpressionsIterator;
379
381
  }
380
382
  declare const GlobalStyle = "GlobalStyle";
381
383
  declare function isGlobalStyle(item: unknown): item is GlobalStyle;
384
+ interface GlobalStyleGroup extends AstNode {
385
+ readonly $container: Globals;
386
+ readonly $type: 'GlobalStyleGroup';
387
+ id: GlobalStyleId;
388
+ styles: Array<ViewRuleStyle>;
389
+ }
390
+ declare const GlobalStyleGroup = "GlobalStyleGroup";
391
+ declare function isGlobalStyleGroup(item: unknown): item is GlobalStyleGroup;
392
+ interface GlobalStyleId extends AstNode {
393
+ readonly $container: GlobalStyle | GlobalStyleGroup;
394
+ readonly $type: 'GlobalStyleId';
395
+ name: string;
396
+ }
397
+ declare const GlobalStyleId = "GlobalStyleId";
382
398
  interface IconProperty extends AstNode {
383
399
  readonly $container: CustomElementProperties | ElementBody | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
384
400
  readonly $type: 'IconProperty';
@@ -388,7 +404,7 @@ interface IconProperty extends AstNode {
388
404
  }
389
405
  declare const IconProperty = "IconProperty";
390
406
  interface IncludePredicate extends AstNode {
391
- readonly $container: ElementViewBody;
407
+ readonly $container: ElementViewBody | ViewRuleGroup;
392
408
  readonly $type: 'IncludePredicate';
393
409
  predicates: Predicates;
394
410
  }
@@ -466,7 +482,7 @@ interface ModelViews extends AstNode {
466
482
  readonly $container: LikeC4Grammar;
467
483
  readonly $type: 'ModelViews';
468
484
  name: 'views';
469
- styles: Array<ViewRuleStyle>;
485
+ styles: Array<ViewRuleStyleOrGlobalRef>;
470
486
  views: Array<LikeC4View>;
471
487
  }
472
488
  declare const ModelViews = "ModelViews";
@@ -493,7 +509,7 @@ interface NotesProperty extends AstNode {
493
509
  }
494
510
  declare const NotesProperty = "NotesProperty";
495
511
  interface OpacityProperty extends AstNode {
496
- readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleStyle;
512
+ readonly $container: CustomElementProperties | ElementStyleProperty | GlobalStyle | ViewRuleGroup | ViewRuleStyle;
497
513
  readonly $type: 'OpacityProperty';
498
514
  key: 'opacity';
499
515
  value: string;
@@ -669,13 +685,21 @@ interface ViewRuleAutoLayout extends AstNode {
669
685
  }
670
686
  declare const ViewRuleAutoLayout = "ViewRuleAutoLayout";
671
687
  interface ViewRuleGlobalStyle extends AstNode {
672
- readonly $container: DynamicViewBody | ElementViewBody;
688
+ readonly $container: DynamicViewBody | ElementViewBody | ModelViews;
673
689
  readonly $type: 'ViewRuleGlobalStyle';
674
- style: Reference<GlobalStyle>;
690
+ style: Reference<GlobalStyleId>;
675
691
  }
676
692
  declare const ViewRuleGlobalStyle = "ViewRuleGlobalStyle";
693
+ interface ViewRuleGroup extends AstNode {
694
+ readonly $container: ElementViewBody | ViewRuleGroup;
695
+ readonly $type: 'ViewRuleGroup';
696
+ groupRules: Array<ViewRuleGroup | ViewRulePredicate>;
697
+ props: Array<BorderProperty | ColorProperty | OpacityProperty>;
698
+ title?: string;
699
+ }
700
+ declare const ViewRuleGroup = "ViewRuleGroup";
677
701
  interface ViewRuleStyle extends AstNode {
678
- readonly $container: DynamicViewBody | ElementViewBody | ModelViews;
702
+ readonly $container: DynamicViewBody | ElementViewBody | GlobalStyleGroup | ModelViews;
679
703
  readonly $type: 'ViewRuleStyle';
680
704
  props: Array<NotationProperty | StyleProperty>;
681
705
  target: ElementExpressionsIterator;
@@ -787,6 +811,8 @@ type LikeC4AstType = {
787
811
  ExtendElementBody: ExtendElementBody;
788
812
  FqnElementRef: FqnElementRef;
789
813
  GlobalStyle: GlobalStyle;
814
+ GlobalStyleGroup: GlobalStyleGroup;
815
+ GlobalStyleId: GlobalStyleId;
790
816
  Globals: Globals;
791
817
  IconProperty: IconProperty;
792
818
  InOutRelationExpression: InOutRelationExpression;
@@ -840,8 +866,10 @@ type LikeC4AstType = {
840
866
  ViewRule: ViewRule;
841
867
  ViewRuleAutoLayout: ViewRuleAutoLayout;
842
868
  ViewRuleGlobalStyle: ViewRuleGlobalStyle;
869
+ ViewRuleGroup: ViewRuleGroup;
843
870
  ViewRulePredicate: ViewRulePredicate;
844
871
  ViewRuleStyle: ViewRuleStyle;
872
+ ViewRuleStyleOrGlobalRef: ViewRuleStyleOrGlobalRef;
845
873
  ViewStringProperty: ViewStringProperty;
846
874
  WhereBinaryExpression: WhereBinaryExpression;
847
875
  WhereElement: WhereElement;
@@ -987,7 +1015,7 @@ interface ParsedLikeC4LangiumDocument extends Omit<LangiumDocument<LikeC4Grammar
987
1015
  }
988
1016
  type Guard<N extends AstNode> = (n: AstNode) => n is N;
989
1017
  type Guarded<G> = G extends Guard<infer N> ? N : never;
990
- declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | typeof isExtendElement | typeof isElement | typeof isGlobals | typeof isGlobalStyle | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
1018
+ declare const isValidatableAstNode: (n: AstNode) => n is Guarded<typeof isLikeC4View | typeof isRelation | typeof isExtendElement | typeof isElement | typeof isGlobals | typeof isGlobalStyle | typeof isGlobalStyleGroup | typeof isDynamicViewPredicateIterator | typeof isElementPredicateWith | typeof isRelationPredicateWith | typeof isElementExpression | typeof isRelationExpression | typeof isDynamicViewParallelSteps | typeof isDynamicViewStep | typeof isViewProperty | typeof isStyleProperty | typeof isTags | typeof isViewRule | typeof isDynamicViewRule | typeof isElementViewBody | typeof isDynamicViewBody | typeof isRelationProperty | typeof isRelationBody | typeof isElementProperty | typeof isElementBody | typeof isExtendElementBody | typeof isSpecificationElementKind | typeof isSpecificationRelationshipKind | typeof isSpecificationTag | typeof isSpecificationColor | typeof isSpecificationRule | typeof isModelViews | typeof isModel>;
991
1019
  type ValidatableAstNode = Guarded<typeof isValidatableAstNode>;
992
1020
  declare function checksFromDiagnostics(doc: LikeC4LangiumDocument): {
993
1021
  isValid: (n: ValidatableAstNode) => boolean;
@@ -1107,6 +1135,7 @@ declare class LikeC4ModelParser {
1107
1135
  private parseElement;
1108
1136
  private parseRelation;
1109
1137
  private parseGlobal;
1138
+ private parseGlobalStyleOrGroup;
1110
1139
  private parseGlobalStyle;
1111
1140
  private parseViews;
1112
1141
  private parseViewRulePredicate;
@@ -1121,7 +1150,9 @@ declare class LikeC4ModelParser {
1121
1150
  private parseRelationPredicateWith;
1122
1151
  private parseRelationExpr;
1123
1152
  private parseViewRule;
1153
+ private parseViewRuleStyleOrGlobalRef;
1124
1154
  private parseViewRuleStyle;
1155
+ private parseViewRuleGroup;
1125
1156
  private parseRuleStyle;
1126
1157
  private parseViewRuleGlobalStyle;
1127
1158
  private parseViewManualLaout;