likec4 1.36.0 → 1.37.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/react/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { CSSProperties, ComponentType, HTMLAttributes, JSX, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode, WheelEvent as WheelEvent$1 } from 'react';
3
+ import { AriaRole, CSSProperties, ComponentType, DOMAttributes, FunctionComponent, HTMLAttributes, JSX, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode, SVGAttributes, WheelEvent as WheelEvent$1 } from 'react';
4
4
 
5
5
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
6
6
  type UnionToIntersection<Union> = (
@@ -111,6 +111,14 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
111
111
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
112
112
  [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
113
113
  } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : {});
114
+ type NonEmptyTuple<T = unknown> = readonly [
115
+ T,
116
+ ...T[]
117
+ ];
118
+ type Without<FirstType, SecondType> = {
119
+ [KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never;
120
+ };
121
+ type MergeExclusive<FirstType, SecondType> = (FirstType | SecondType) extends object ? (Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) : FirstType | SecondType;
114
122
  declare const tag: unique symbol;
115
123
  type TagContainer<Token> = {
116
124
  readonly [tag]: Token;
@@ -157,6 +165,16 @@ type NonEmptyArray<T> = [
157
165
  T,
158
166
  ...T[]
159
167
  ];
168
+ type KeysOf<T> = keyof T extends infer K extends string ? K : never;
169
+ type AllNever<Expressions> = UnionToIntersection<{
170
+ [Name in keyof Expressions]: {
171
+ -readonly [Key in keyof Expressions[Name]]?: never;
172
+ };
173
+ }[keyof Expressions]>;
174
+ type ExclusiveUnion<Expressions, All = AllNever<Expressions>> = Expressions extends object ? {
175
+ [Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]>;
176
+ }[keyof Expressions] : never;
177
+ type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
160
178
  interface Link {
161
179
  title?: string;
162
180
  url: string;
@@ -164,6 +182,7 @@ interface Link {
164
182
  }
165
183
  type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
166
184
  type ProjectId<T = string> = Tagged<T, "ProjectID">;
185
+ declare function ProjectId(name: string): ProjectId;
167
186
  type MarkdownOrString = {
168
187
  txt: string;
169
188
  md?: never;
@@ -177,6 +196,8 @@ type IconUrl = Icon;
177
196
  type Fqn<Id = string> = Tagged<Id, "Fqn">;
178
197
  declare function Fqn(name: string, parent?: Fqn | null): Fqn;
179
198
  type ElementKind<Kinds = string> = Tagged<Kinds, "ElementKind">;
199
+ declare const GroupElementKind: ElementKind<"@group">;
200
+ type GroupElementKind = typeof GroupElementKind;
180
201
  type DeploymentFqn<T = string> = Tagged<T, "DeploymentFqn">;
181
202
  declare function DeploymentFqn(name: string, parent?: DeploymentFqn | null): DeploymentFqn;
182
203
  type DeploymentKind<Kinds = string> = Tagged<Kinds, "DeploymentKind">;
@@ -190,8 +211,13 @@ type NodeId = Tagged<string, "NodeId" | "Fqn" | "DeploymentFqn">;
190
211
  declare function NodeId(id: string): NodeId;
191
212
  type EdgeId = Tagged<string, "EdgeId">;
192
213
  declare function EdgeId(id: string): EdgeId;
214
+ type StepEdgeIdLiteral = `step-${number}` | `step-${number}.${number}`;
215
+ type StepEdgeId = Tagged<StepEdgeIdLiteral, "EdgeId">;
193
216
  declare const StepEdgeKind = "@step";
194
217
  type ModelStage = "parsed" | "computed" | "layouted";
218
+ type ExtractOnStage<T, S extends ModelStage> = Extract<T, {
219
+ [_stage]: S;
220
+ }>;
195
221
  declare const _stage = "_stage";
196
222
  type _stage = typeof _stage;
197
223
  declare const _type = "_type";
@@ -362,6 +388,9 @@ declare const ElementShapes: readonly [
362
388
  type ElementShape = TupleToUnion<typeof ElementShapes>;
363
389
  type HexColor = `#${string}`;
364
390
  type ColorLiteral = HexColor | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`;
391
+ type CustomColorDefinitions = {
392
+ [key: string]: ThemeColorValues;
393
+ };
365
394
  type RelationshipLineType = "dashed" | "solid" | "dotted";
366
395
  type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
367
396
  declare const ThemeColors: readonly [
@@ -379,6 +408,73 @@ declare const ThemeColors: readonly [
379
408
  ];
380
409
  type ThemeColor = typeof ThemeColors[number];
381
410
  type Color = ThemeColor | ColorLiteral;
411
+ interface ElementThemeColorValues {
412
+ fill: ColorLiteral;
413
+ stroke: ColorLiteral;
414
+ hiContrast: ColorLiteral;
415
+ loContrast: ColorLiteral;
416
+ }
417
+ interface RelationshipThemeColorValues {
418
+ lineColor: ColorLiteral;
419
+ labelBgColor: ColorLiteral;
420
+ labelColor: ColorLiteral;
421
+ }
422
+ interface ThemeColorValues {
423
+ elements: ElementThemeColorValues;
424
+ relationships: RelationshipThemeColorValues;
425
+ }
426
+ declare namespace FqnRef {
427
+ /**
428
+ * Reference to logical model element
429
+ */
430
+ interface ElementRef<A extends Any = Unknown> {
431
+ project?: never;
432
+ model: ElementId<A>;
433
+ }
434
+ function isElementRef<A extends Any>(ref: FqnRef<A>): ref is ElementRef<A>;
435
+ /**
436
+ * Reference to imported logical model element
437
+ */
438
+ interface ImportRef<A extends Any = Unknown> {
439
+ project: ProjectId$1<A>;
440
+ model: ElementId<A>;
441
+ }
442
+ function isImportRef<A extends Any>(ref: FqnRef<A>): ref is ImportRef<A>;
443
+ function flatten<A extends Any>(ref: FqnRef<A>): Fqn$1<A>;
444
+ type ModelRef<A extends Any = Unknown> = ImportRef<A> | ElementRef<A>;
445
+ function isModelRef<A extends Any>(ref: FqnRef<A>): ref is ModelRef<A>;
446
+ /**
447
+ * Represents a reference to an instance within a deployment.
448
+ *
449
+ * @template D - The type representing the deployment fqn. Defaults to `Fqn`.
450
+ * @template M - The type representing the model fqn. Defaults to `Fqn`.
451
+ *
452
+ * @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
453
+ * @property {M} element - The element reference within the deployment.
454
+ */
455
+ interface InsideInstanceRef<A extends Any = Unknown> {
456
+ deployment: DeploymentId<A>;
457
+ element: ElementId<A>;
458
+ }
459
+ function isInsideInstanceRef<A extends Any>(ref: FqnRef<A>): ref is InsideInstanceRef<A>;
460
+ /**
461
+ * Represents a reference to a deployment element.
462
+ *
463
+ * @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
464
+ * @property {F} deployment - The fully qualified name (FQN) of the deployment element.
465
+ */
466
+ interface DeploymentElementRef<A extends Any> {
467
+ deployment: DeploymentId<A>;
468
+ element?: never;
469
+ }
470
+ function isDeploymentElementRef<A extends Any>(ref: FqnRef<A>): ref is DeploymentElementRef<A>;
471
+ type DeploymentRef<A extends Any> = DeploymentElementRef<A> | InsideInstanceRef<A>;
472
+ function isDeploymentRef<A extends Any>(ref: FqnRef<A>): ref is DeploymentRef<A>;
473
+ }
474
+ type FqnRef<A extends Any = Unknown> = ExclusiveUnion<{
475
+ DeploymentRef: FqnRef.DeploymentRef<A>;
476
+ ModelRef: FqnRef.ModelRef<A>;
477
+ }>;
382
478
  type EqualOperator<V> = {
383
479
  eq: V;
384
480
  neq?: never;
@@ -386,7 +482,7 @@ type EqualOperator<V> = {
386
482
  eq?: never;
387
483
  neq: V;
388
484
  };
389
- type AllNever = {
485
+ type AllNever$1 = {
390
486
  not?: never;
391
487
  and?: never;
392
488
  or?: never;
@@ -395,27 +491,387 @@ type AllNever = {
395
491
  participant?: never;
396
492
  operator?: never;
397
493
  };
398
- type TagEqual<A extends Any> = Omit<AllNever, "tag"> & {
494
+ type TagEqual<A extends Any> = Omit<AllNever$1, "tag"> & {
399
495
  tag: EqualOperator<Tag$2<A>> | Tag$2<A>;
400
496
  };
401
- type KindEqual<A extends Any> = Omit<AllNever, "kind"> & {
497
+ type KindEqual<A extends Any> = Omit<AllNever$1, "kind"> & {
402
498
  kind: EqualOperator<AllKinds<A>> | AllKinds<A>;
403
499
  };
404
500
  type Participant = "source" | "target";
405
- type ParticipantOperator<A extends Any> = Omit<AllNever, "participant" | "operator"> & {
501
+ type ParticipantOperator<A extends Any> = Omit<AllNever$1, "participant" | "operator"> & {
406
502
  participant: Participant;
407
503
  operator: KindEqual<A> | TagEqual<A>;
408
504
  };
409
- type NotOperator<A extends Any> = Omit<AllNever, "not"> & {
505
+ type NotOperator<A extends Any> = Omit<AllNever$1, "not"> & {
410
506
  not: WhereOperator<A>;
411
507
  };
412
- type AndOperator<A extends Any> = Omit<AllNever, "and"> & {
508
+ type AndOperator<A extends Any> = Omit<AllNever$1, "and"> & {
413
509
  and: NonEmptyArray<WhereOperator<A>>;
414
510
  };
415
- type OrOperator<A extends Any> = Omit<AllNever, "or"> & {
511
+ type OrOperator<A extends Any> = Omit<AllNever$1, "or"> & {
416
512
  or: NonEmptyArray<WhereOperator<A>>;
417
513
  };
418
- type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
514
+ export type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
515
+ type PredicateSelector = "children" | "expanded" | "descendants";
516
+ declare namespace FqnExpr {
517
+ type Wildcard = {
518
+ wildcard: true;
519
+ };
520
+ function isWildcard<A extends Any>(expr: Expression<A>): expr is FqnExpr.Wildcard;
521
+ interface ModelRef<M extends Any = Any> {
522
+ ref: FqnRef.ModelRef<M>;
523
+ selector?: PredicateSelector;
524
+ }
525
+ function isModelRef<A extends Any>(ref: Expression<A>): ref is FqnExpr.ModelRef<A>;
526
+ interface DeploymentRef<A extends Any = Any> {
527
+ ref: FqnRef.DeploymentRef<A>;
528
+ selector?: PredicateSelector;
529
+ }
530
+ function isDeploymentRef<A extends Any>(expr: Expression<A>): expr is FqnExpr.DeploymentRef<A>;
531
+ interface ElementKindExpr<A extends Any = Any> {
532
+ elementKind: ElementKind$1<A>;
533
+ isEqual: boolean;
534
+ }
535
+ function isElementKindExpr<A extends Any>(expr: Expression<A>): expr is ElementKindExpr<A>;
536
+ interface ElementTagExpr<A extends Any = Any> {
537
+ elementTag: Tag$2<A>;
538
+ isEqual: boolean;
539
+ }
540
+ function isElementTagExpr<A extends Any>(expr: Expression<A>): expr is ElementTagExpr<A>;
541
+ type NonWildcard<A extends Any = Any> = ExclusiveUnion<{
542
+ ModelRef: ModelRef<A>;
543
+ DeploymentRef: DeploymentRef<A>;
544
+ ElementKind: ElementKindExpr<A>;
545
+ ElementTag: ElementTagExpr<A>;
546
+ }>;
547
+ interface Where<A extends Any = Any> {
548
+ where: {
549
+ expr: ExclusiveUnion<{
550
+ Wildcard: Wildcard;
551
+ ModelRef: ModelRef<A>;
552
+ DeploymentRef: DeploymentRef<A>;
553
+ ElementKind: ElementKindExpr<A>;
554
+ ElementTag: ElementTagExpr<A>;
555
+ }>;
556
+ condition: WhereOperator<A>;
557
+ };
558
+ }
559
+ function isWhere<A extends Any>(expr: Expression<A>): expr is FqnExpr.Where<A>;
560
+ interface Custom<A extends Any = Any> {
561
+ custom: {
562
+ expr: OrWhere<A>;
563
+ title?: string;
564
+ description?: MarkdownOrString;
565
+ technology?: string;
566
+ notation?: string;
567
+ shape?: ElementShape;
568
+ color?: Color;
569
+ icon?: Icon;
570
+ border?: BorderStyle;
571
+ opacity?: number;
572
+ navigateTo?: StrictViewId<A>;
573
+ multiple?: boolean;
574
+ size?: ShapeSize;
575
+ padding?: ShapeSize;
576
+ textSize?: ShapeSize;
577
+ };
578
+ }
579
+ function isCustom<A extends Any>(expr: Expression<A>): expr is Custom<A>;
580
+ function is<A extends Any>(expr: Expression<A>): expr is FqnExpr<A>;
581
+ type OrWhere<A extends Any = Any> = ExclusiveUnion<{
582
+ Wildcard: FqnExpr.Wildcard;
583
+ ModelRef: FqnExpr.ModelRef<A>;
584
+ DeploymentRef: FqnExpr.DeploymentRef<A>;
585
+ ElementKind: ElementKindExpr<A>;
586
+ ElementTag: ElementTagExpr<A>;
587
+ Where: FqnExpr.Where<A>;
588
+ }>;
589
+ type Any<A extends Any = Any> = ExclusiveUnion<{
590
+ Wildcard: Wildcard;
591
+ ModelRef: ModelRef<A>;
592
+ DeploymentRef: DeploymentRef<A>;
593
+ ElementKind: ElementKindExpr<A>;
594
+ ElementTag: ElementTagExpr<A>;
595
+ Where: Where<A>;
596
+ Custom: Custom<A>;
597
+ }>;
598
+ function unwrap<A extends Any>(expr: FqnExpr.Any<A>): Wildcard | ModelRef<A> | DeploymentRef<A> | ElementKindExpr<A> | ElementTagExpr<A>;
599
+ }
600
+ type FqnExpr<A extends Any = Any> = ExclusiveUnion<{
601
+ Wildcard: FqnExpr.Wildcard;
602
+ ModelRef: FqnExpr.ModelRef<A>;
603
+ DeploymentRef: FqnExpr.DeploymentRef<A>;
604
+ ElementKind: FqnExpr.ElementKindExpr<A>;
605
+ ElementTag: FqnExpr.ElementTagExpr<A>;
606
+ }>;
607
+ declare namespace RelationExpr {
608
+ type Endpoint<A extends Any = Any> = FqnExpr.Where<A>["where"]["expr"];
609
+ interface Direct<A extends Any = Any> {
610
+ source: Endpoint<A>;
611
+ target: Endpoint<A>;
612
+ isBidirectional?: boolean;
613
+ }
614
+ function isDirect<A extends Any>(expr: Expression<A>): expr is RelationExpr.Direct<A>;
615
+ interface Incoming<A extends Any = Any> {
616
+ incoming: Endpoint<A>;
617
+ }
618
+ function isIncoming<A extends Any>(expr: Expression<A>): expr is RelationExpr.Incoming<A>;
619
+ interface Outgoing<A extends Any = Any> {
620
+ outgoing: Endpoint<A>;
621
+ }
622
+ function isOutgoing<A extends Any>(expr: Expression<A>): expr is RelationExpr.Outgoing<A>;
623
+ interface InOut<A extends Any = Any> {
624
+ inout: Endpoint<A>;
625
+ }
626
+ function isInOut<A extends Any>(expr: Expression<A>): expr is RelationExpr.InOut<A>;
627
+ interface Where<A extends Any = Any> {
628
+ where: {
629
+ expr: ExclusiveUnion<{
630
+ Direct: RelationExpr.Direct<A>;
631
+ Incoming: RelationExpr.Incoming<A>;
632
+ Outgoing: RelationExpr.Outgoing<A>;
633
+ InOut: RelationExpr.InOut<A>;
634
+ }>;
635
+ condition: WhereOperator<A>;
636
+ };
637
+ }
638
+ function isWhere<A extends Any>(expr: Expression<A>): expr is RelationExpr.Where<A>;
639
+ interface Custom<A extends Any = Any> {
640
+ customRelation: {
641
+ expr: OrWhere<A>;
642
+ title?: string;
643
+ description?: string;
644
+ technology?: string;
645
+ notation?: string;
646
+ navigateTo?: StrictViewId<A>;
647
+ notes?: string;
648
+ color?: Color;
649
+ line?: RelationshipLineType;
650
+ head?: RelationshipArrowType;
651
+ tail?: RelationshipArrowType;
652
+ };
653
+ }
654
+ function isCustom<A extends Any>(expr: Expression<A>): expr is Custom<A>;
655
+ function is<A extends Any>(expr: Expression<A>): expr is RelationExpr<A>;
656
+ type OrWhere<A extends Any = Any> = ExclusiveUnion<{
657
+ Direct: Direct<A>;
658
+ Incoming: Incoming<A>;
659
+ Outgoing: Outgoing<A>;
660
+ InOut: InOut<A>;
661
+ Where: Where<A>;
662
+ }>;
663
+ type Any<A extends Any = Any> = ExclusiveUnion<{
664
+ Direct: Direct<A>;
665
+ Incoming: Incoming<A>;
666
+ Outgoing: Outgoing<A>;
667
+ InOut: InOut<A>;
668
+ Where: Where<A>;
669
+ Custom: Custom<A>;
670
+ }>;
671
+ function unwrap<A extends Any>(expr: RelationExpr.Any<A>): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A>;
672
+ }
673
+ type RelationExpr<A extends Any = Any> = ExclusiveUnion<{
674
+ Direct: RelationExpr.Direct<A>;
675
+ Incoming: RelationExpr.Incoming<A>;
676
+ Outgoing: RelationExpr.Outgoing<A>;
677
+ InOut: RelationExpr.InOut<A>;
678
+ }>;
679
+ type Expression<A extends Any = Any> = ExclusiveUnion<{
680
+ Wildcard: FqnExpr.Wildcard;
681
+ ModelRef: FqnExpr.ModelRef<A>;
682
+ DeploymentRef: FqnExpr.DeploymentRef<A>;
683
+ ElementKind: FqnExpr.ElementKindExpr<A>;
684
+ ElementTag: FqnExpr.ElementTagExpr<A>;
685
+ Custom: FqnExpr.Custom<A>;
686
+ Direct: RelationExpr.Direct<A>;
687
+ Incoming: RelationExpr.Incoming<A>;
688
+ Outgoing: RelationExpr.Outgoing<A>;
689
+ InOut: RelationExpr.InOut<A>;
690
+ Where: Expression.Where<A>;
691
+ CustomRelation: RelationExpr.Custom<A>;
692
+ }>;
693
+ declare namespace Expression {
694
+ type Where<A extends Any = Any> = FqnExpr.Where<A> | RelationExpr.Where<A>;
695
+ function isWhere<A extends Any>(expr: Expression<A>): expr is Expression.Where<A>;
696
+ function isRelationWhere<A extends Any>(expr: Expression<A>): expr is RelationExpr.Where<A>;
697
+ function isFqnExprWhere<A extends Any>(expr: Expression<A>): expr is FqnExpr.Where<A>;
698
+ function isFqnExpr<A extends Any>(expr: Expression<A>): expr is FqnExpr.Any<A>;
699
+ function isRelation<A extends Any>(expr: Expression<A>): expr is RelationExpr.Any<A>;
700
+ }
701
+ declare namespace ModelFqnExpr {
702
+ type Wildcard = {
703
+ wildcard: true;
704
+ };
705
+ function isWildcard<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Wildcard;
706
+ interface Ref<M extends Any> {
707
+ ref: FqnRef.ModelRef<M>;
708
+ selector?: PredicateSelector;
709
+ }
710
+ function isModelRef<A extends Any>(ref: ModelExpression<A>): ref is ModelFqnExpr.Ref<A>;
711
+ interface ElementKindExpr<A extends Any = Any> {
712
+ elementKind: ElementKind$1<A>;
713
+ isEqual: boolean;
714
+ }
715
+ function isElementKindExpr<A extends Any>(expr: ModelExpression<A>): expr is ElementKindExpr<A>;
716
+ interface ElementTagExpr<A extends Any> {
717
+ elementTag: Tag$2<A>;
718
+ isEqual: boolean;
719
+ }
720
+ function isElementTagExpr<A extends Any>(expr: ModelExpression<A>): expr is ElementTagExpr<A>;
721
+ type NonWildcard<A extends Any = Any> = ExclusiveUnion<{
722
+ Ref: Ref<A>;
723
+ ElementKind: ElementKindExpr<A>;
724
+ ElementTag: ElementTagExpr<A>;
725
+ }>;
726
+ interface Where<A extends Any = Any> {
727
+ where: {
728
+ expr: ExclusiveUnion<{
729
+ Wildcard: Wildcard;
730
+ Ref: Ref<A>;
731
+ ElementKind: ElementKindExpr<A>;
732
+ ElementTag: ElementTagExpr<A>;
733
+ }>;
734
+ condition: WhereOperator<A>;
735
+ };
736
+ }
737
+ function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A>;
738
+ interface Custom<A extends Any = Any> {
739
+ custom: {
740
+ expr: OrWhere<A>;
741
+ title?: string;
742
+ description?: MarkdownOrString;
743
+ technology?: string;
744
+ notation?: string;
745
+ shape?: ElementShape;
746
+ color?: Color;
747
+ icon?: Icon;
748
+ border?: BorderStyle;
749
+ opacity?: number;
750
+ navigateTo?: StrictViewId<A>;
751
+ multiple?: boolean;
752
+ size?: ShapeSize;
753
+ padding?: ShapeSize;
754
+ textSize?: ShapeSize;
755
+ };
756
+ }
757
+ function isCustom<A extends Any>(expr: ModelExpression<A>): expr is Custom<A>;
758
+ function is<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr<A>;
759
+ type OrWhere<A extends Any = Any> = ExclusiveUnion<{
760
+ Wildcard: ModelFqnExpr.Wildcard;
761
+ Ref: ModelFqnExpr.Ref<A>;
762
+ ElementKind: ElementKindExpr<A>;
763
+ ElementTag: ElementTagExpr<A>;
764
+ Where: ModelFqnExpr.Where<A>;
765
+ }>;
766
+ type Any<A extends Any = Any> = ExclusiveUnion<{
767
+ Wildcard: Wildcard;
768
+ Ref: Ref<A>;
769
+ ElementKind: ElementKindExpr<A>;
770
+ ElementTag: ElementTagExpr<A>;
771
+ Where: Where<A>;
772
+ Custom: Custom<A>;
773
+ }>;
774
+ function unwrap<A extends Any>(expr: ModelFqnExpr.Any<A>): Wildcard | Ref<A> | ElementKindExpr<A> | ElementTagExpr<A>;
775
+ }
776
+ type ModelFqnExpr<A extends Any = Any> = ExclusiveUnion<{
777
+ Wildcard: ModelFqnExpr.Wildcard;
778
+ Ref: ModelFqnExpr.Ref<A>;
779
+ ElementKind: ModelFqnExpr.ElementKindExpr<A>;
780
+ ElementTag: ModelFqnExpr.ElementTagExpr<A>;
781
+ }>;
782
+ declare namespace ModelRelationExpr {
783
+ type Endpoint<A extends Any = Any> = ModelFqnExpr.Where<A>["where"]["expr"];
784
+ interface Direct<A extends Any = Any> {
785
+ source: Endpoint<A>;
786
+ target: Endpoint<A>;
787
+ isBidirectional?: boolean;
788
+ }
789
+ function isDirect<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Direct<A>;
790
+ interface Incoming<A extends Any = Any> {
791
+ incoming: Endpoint<A>;
792
+ }
793
+ function isIncoming<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Incoming<A>;
794
+ interface Outgoing<A extends Any = Any> {
795
+ outgoing: Endpoint<A>;
796
+ }
797
+ function isOutgoing<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Outgoing<A>;
798
+ interface InOut<A extends Any = Any> {
799
+ inout: Endpoint<A>;
800
+ }
801
+ function isInOut<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.InOut<A>;
802
+ interface Where<A extends Any = Any> {
803
+ where: {
804
+ expr: ExclusiveUnion<{
805
+ Direct: ModelRelationExpr.Direct<A>;
806
+ Incoming: ModelRelationExpr.Incoming<A>;
807
+ Outgoing: ModelRelationExpr.Outgoing<A>;
808
+ InOut: ModelRelationExpr.InOut<A>;
809
+ }>;
810
+ condition: WhereOperator<A>;
811
+ };
812
+ }
813
+ function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A>;
814
+ interface Custom<A extends Any = Any> {
815
+ customRelation: {
816
+ expr: OrWhere<A>;
817
+ title?: string;
818
+ description?: string;
819
+ technology?: string;
820
+ notation?: string;
821
+ navigateTo?: StrictViewId<A>;
822
+ notes?: string;
823
+ color?: Color;
824
+ line?: RelationshipLineType;
825
+ head?: RelationshipArrowType;
826
+ tail?: RelationshipArrowType;
827
+ };
828
+ }
829
+ function isCustom<A extends Any>(expr: ModelExpression<A>): expr is Custom<A>;
830
+ function is<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr<A>;
831
+ type OrWhere<A extends Any = Any> = ExclusiveUnion<{
832
+ Direct: Direct<A>;
833
+ Incoming: Incoming<A>;
834
+ Outgoing: Outgoing<A>;
835
+ InOut: InOut<A>;
836
+ Where: Where<A>;
837
+ }>;
838
+ type Any<A extends Any = Any> = ExclusiveUnion<{
839
+ Direct: Direct<A>;
840
+ Incoming: Incoming<A>;
841
+ Outgoing: Outgoing<A>;
842
+ InOut: InOut<A>;
843
+ Where: Where<A>;
844
+ Custom: Custom<A>;
845
+ }>;
846
+ function unwrap<A extends Any>(expr: ModelRelationExpr.Any<A>): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A>;
847
+ }
848
+ type ModelRelationExpr<A extends Any = Any> = ExclusiveUnion<{
849
+ Direct: ModelRelationExpr.Direct<A>;
850
+ Incoming: ModelRelationExpr.Incoming<A>;
851
+ Outgoing: ModelRelationExpr.Outgoing<A>;
852
+ InOut: ModelRelationExpr.InOut<A>;
853
+ }>;
854
+ type ModelExpression<A extends Any = Any> = ExclusiveUnion<{
855
+ Wildcard: ModelFqnExpr.Wildcard;
856
+ Ref: ModelFqnExpr.Ref<A>;
857
+ ElementKind: ModelFqnExpr.ElementKindExpr<A>;
858
+ ElementTag: ModelFqnExpr.ElementTagExpr<A>;
859
+ Custom: ModelFqnExpr.Custom<A>;
860
+ Direct: ModelRelationExpr.Direct<A>;
861
+ Incoming: ModelRelationExpr.Incoming<A>;
862
+ Outgoing: ModelRelationExpr.Outgoing<A>;
863
+ InOut: ModelRelationExpr.InOut<A>;
864
+ Where: ModelExpression.Where<A>;
865
+ CustomRelation: ModelRelationExpr.Custom<A>;
866
+ }>;
867
+ declare namespace ModelExpression {
868
+ type Where<A extends Any = Any> = ModelFqnExpr.Where<A> | ModelRelationExpr.Where<A>;
869
+ function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelExpression.Where<A>;
870
+ function isRelationWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A>;
871
+ function isFqnExprWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A>;
872
+ function isFqnExpr<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Any<A>;
873
+ function isRelationExpr<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Any<A>;
874
+ }
419
875
  type Point = readonly [
420
876
  x: number,
421
877
  y: number
@@ -448,6 +904,35 @@ declare namespace RectBox {
448
904
  function merge(...boxes: RectBox[]): RectBox;
449
905
  function toBBox(box: RectBox): BBox;
450
906
  }
907
+ interface AnyIncludePredicate<Expr> {
908
+ include: Expr[];
909
+ exclude?: never;
910
+ }
911
+ interface AnyExcludePredicate<Expr> {
912
+ include?: never;
913
+ exclude: Expr[];
914
+ }
915
+ interface AnyViewRuleStyle<Expr> {
916
+ targets: Expr[];
917
+ notation?: string;
918
+ style: {
919
+ border?: BorderStyle;
920
+ opacity?: number;
921
+ multiple?: boolean;
922
+ size?: ShapeSize;
923
+ padding?: SpacingSize;
924
+ textSize?: TextSize;
925
+ color?: Color;
926
+ shape?: ElementShape;
927
+ icon?: Icon;
928
+ };
929
+ }
930
+ interface ViewRuleGlobalStyle {
931
+ styleId: GlobalStyleID;
932
+ }
933
+ interface ViewRuleGlobalPredicateRef {
934
+ predicateId: GlobalPredicateId;
935
+ }
451
936
  type AutoLayoutDirection = "TB" | "BT" | "LR" | "RL";
452
937
  interface ViewRuleAutoLayout {
453
938
  direction: AutoLayoutDirection;
@@ -480,6 +965,7 @@ type ViewManualLayout = {
480
965
  labelBBox?: BBox;
481
966
  }>;
482
967
  };
968
+ type ViewType = "element" | "dynamic" | "deployment";
483
969
  interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
484
970
  readonly id: StrictViewId<A>;
485
971
  readonly title: string | null;
@@ -494,6 +980,22 @@ interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOpt
494
980
  */
495
981
  readonly relativePath?: string | undefined;
496
982
  }
983
+ interface BaseParsedViewProperties<A extends Any> extends BaseViewProperties<A> {
984
+ /**
985
+ * Internal field to identify the stage of the view.
986
+ * This is used to create the correct type of the view.
987
+ */
988
+ readonly [_stage]: "parsed";
989
+ /**
990
+ * URI to the source file of this view.
991
+ * Undefined if the view is auto-generated.
992
+ */
993
+ readonly docUri?: string | undefined;
994
+ /**
995
+ * If the view is changed manually this field contains the layout data.
996
+ */
997
+ readonly manualLayout?: ViewManualLayout | undefined;
998
+ }
497
999
  type NodeNotation = {
498
1000
  kinds: string[];
499
1001
  shape: ElementShape;
@@ -512,6 +1014,83 @@ interface ViewWithHash {
512
1014
  */
513
1015
  hash: string;
514
1016
  }
1017
+ interface ElementViewIncludePredicate<A extends Any = Any> extends AnyIncludePredicate<ModelExpression<A>> {
1018
+ }
1019
+ interface ElementViewExcludePredicate<A extends Any = Any> extends AnyExcludePredicate<ModelExpression<A>> {
1020
+ }
1021
+ type ElementViewPredicate<A extends Any = Any> = ElementViewIncludePredicate<A> | ElementViewExcludePredicate<A>;
1022
+ interface ElementViewRuleGroup<A extends Any = Any> {
1023
+ groupRules: Array<ElementViewPredicate<A> | ElementViewRuleGroup<A>>;
1024
+ title: string | null;
1025
+ color?: Color;
1026
+ border?: BorderStyle;
1027
+ opacity?: number;
1028
+ multiple?: boolean;
1029
+ size?: ShapeSize;
1030
+ padding?: SpacingSize;
1031
+ textSize?: TextSize;
1032
+ }
1033
+ interface ElementViewRuleStyle<A extends Any = Any> extends AnyViewRuleStyle<ModelFqnExpr<A>> {
1034
+ }
1035
+ type ElementViewRule<A extends Any = Any> = ExclusiveUnion<{
1036
+ IncludePredicate: ElementViewIncludePredicate<A>;
1037
+ ExcludePredicate: ElementViewExcludePredicate<A>;
1038
+ Group: ElementViewRuleGroup<A>;
1039
+ Style: ElementViewRuleStyle<A>;
1040
+ GlobalStyle: ViewRuleGlobalStyle;
1041
+ GlobalPredicateRef: ViewRuleGlobalPredicateRef;
1042
+ AutoLayout: ViewRuleAutoLayout;
1043
+ }>;
1044
+ interface ParsedElementView<A extends Any = Any> extends BaseParsedViewProperties<A> {
1045
+ [_type]: "element";
1046
+ readonly rules: ElementViewRule<A>[];
1047
+ readonly viewOf?: Fqn$1<A>;
1048
+ readonly extends?: StrictViewId<A>;
1049
+ }
1050
+ interface DynamicViewStep<A extends Any = Any> {
1051
+ readonly source: Fqn$1<A>;
1052
+ readonly target: Fqn$1<A>;
1053
+ readonly title: string | null;
1054
+ readonly description?: string;
1055
+ readonly technology?: string;
1056
+ readonly notation?: string;
1057
+ readonly notes?: MarkdownOrString;
1058
+ readonly color?: Color;
1059
+ readonly line?: RelationshipLineType;
1060
+ readonly head?: RelationshipArrowType;
1061
+ readonly tail?: RelationshipArrowType;
1062
+ readonly isBackward?: boolean;
1063
+ readonly navigateTo?: StrictViewId<A>;
1064
+ }
1065
+ interface DynamicViewParallelSteps<A extends Any = Any> {
1066
+ readonly __parallel: DynamicViewStep<A>[];
1067
+ }
1068
+ type DynamicViewStepOrParallel<A extends Any = Any> = Simplify<MergeExclusive<DynamicViewStep<A>, DynamicViewParallelSteps<A>>>;
1069
+ interface DynamicViewIncludeRule<A extends Any = Any> {
1070
+ include: ModelFqnExpr.Any<A>[];
1071
+ }
1072
+ type DynamicViewRule<A extends Any = Any> = ExclusiveUnion<{
1073
+ Include: DynamicViewIncludeRule<A>;
1074
+ GlobalPredicateRef: ViewRuleGlobalPredicateRef;
1075
+ ElementViewRuleStyle: ElementViewRuleStyle<A>;
1076
+ GlobalStyle: ViewRuleGlobalStyle;
1077
+ AutoLayout: ViewRuleAutoLayout;
1078
+ }>;
1079
+ interface ParsedDynamicView<A extends Any = Any> extends BaseParsedViewProperties<A> {
1080
+ [_type]: "dynamic";
1081
+ readonly steps: DynamicViewStepOrParallel<A>[];
1082
+ readonly rules: DynamicViewRule<A>[];
1083
+ }
1084
+ type GlobalPredicateId = Tagged<string, "GlobalPredicateId">;
1085
+ type GlobalPredicates<A extends Any = Any> = NonEmptyArray<ElementViewPredicate<A>>;
1086
+ type GlobalDynamicPredicates<A extends Any = Any> = NonEmptyArray<DynamicViewIncludeRule<A>>;
1087
+ type GlobalStyleID = Tagged<string, "GlobalStyleID">;
1088
+ type GlobalStyles<A extends Any = Any> = NonEmptyTuple<ElementViewRuleStyle<A>>;
1089
+ interface ModelGlobals<A extends Any = Any> {
1090
+ readonly predicates: Record<GlobalPredicateId, GlobalPredicates<A>>;
1091
+ readonly dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates<A>>;
1092
+ readonly styles: Record<GlobalStyleID, GlobalStyles<A>>;
1093
+ }
515
1094
  interface ElementStyle {
516
1095
  readonly border?: BorderStyle;
517
1096
  /**
@@ -534,6 +1113,133 @@ interface ElementStyle {
534
1113
  readonly padding?: SpacingSize;
535
1114
  readonly textSize?: TextSize;
536
1115
  }
1116
+ interface Element$1<A extends Any = Any> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
1117
+ readonly id: Fqn$1<A>;
1118
+ readonly kind: ElementKind$1<A>;
1119
+ readonly title: string;
1120
+ readonly description?: MarkdownOrString | null;
1121
+ readonly technology?: string | null;
1122
+ readonly tags?: Tags<A> | null;
1123
+ readonly links?: readonly Link[] | null;
1124
+ readonly icon?: Icon;
1125
+ readonly shape?: ElementShape;
1126
+ readonly color?: Color;
1127
+ readonly style?: ElementStyle;
1128
+ readonly notation?: string | null;
1129
+ readonly metadata?: Metadata<A>;
1130
+ }
1131
+ interface AbstractRelationship<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
1132
+ readonly id: RelationId;
1133
+ readonly title?: string | null;
1134
+ readonly description?: MarkdownOrString | null;
1135
+ readonly technology?: string | null;
1136
+ readonly kind?: RelationKind<A>;
1137
+ readonly color?: Color;
1138
+ readonly line?: RelationshipLineType;
1139
+ readonly head?: RelationshipArrowType;
1140
+ readonly tail?: RelationshipArrowType;
1141
+ readonly tags?: Tags<A> | null;
1142
+ readonly links?: readonly Link[] | null;
1143
+ readonly navigateTo?: ViewId$1<A>;
1144
+ readonly metadata?: Metadata<A>;
1145
+ }
1146
+ interface Relationship<A extends Any = Any> extends AbstractRelationship<A> {
1147
+ readonly source: FqnRef.ModelRef<A>;
1148
+ readonly target: FqnRef.ModelRef<A>;
1149
+ }
1150
+ interface DeploymentElementStyle extends ElementStyle {
1151
+ readonly icon?: Icon;
1152
+ readonly shape?: ElementShape;
1153
+ readonly color?: Color;
1154
+ }
1155
+ interface DeploymentNode<A extends Any = Unknown> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
1156
+ element?: never;
1157
+ readonly id: DeploymentFqn$1<A>;
1158
+ readonly kind: DeploymentKind$1<A>;
1159
+ readonly title: string;
1160
+ readonly description?: MarkdownOrString | null;
1161
+ readonly technology?: string | null;
1162
+ readonly tags?: Tags<A> | null;
1163
+ readonly links?: readonly Link[] | null;
1164
+ readonly style: DeploymentElementStyle;
1165
+ readonly notation?: string | null;
1166
+ readonly metadata?: Metadata<A>;
1167
+ }
1168
+ interface DeployedInstance<A extends Any = Unknown> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
1169
+ kind?: never;
1170
+ /**
1171
+ * Format: `<DeploymentNode Fqn>.<Instance Id>`
1172
+ * i.e parent fqn is deployment target
1173
+ */
1174
+ readonly id: DeploymentFqn$1<A>;
1175
+ readonly element: Fqn$1<A>;
1176
+ readonly title?: string;
1177
+ readonly description?: MarkdownOrString | null;
1178
+ readonly technology?: string | null;
1179
+ readonly tags?: Tags<A> | null;
1180
+ readonly links?: readonly Link[] | null;
1181
+ readonly style?: DeploymentElementStyle;
1182
+ readonly notation?: string;
1183
+ readonly metadata?: Metadata<A>;
1184
+ }
1185
+ type DeploymentElement<A extends Any = Unknown> = DeploymentNode<A> | DeployedInstance<A>;
1186
+ interface DeploymentRelationship<A extends Any = Unknown> extends AbstractRelationship<A> {
1187
+ readonly source: FqnRef.DeploymentRef<A>;
1188
+ readonly target: FqnRef.DeploymentRef<A>;
1189
+ }
1190
+ interface ElementSpecification {
1191
+ tags?: Tag$1[];
1192
+ title?: string;
1193
+ description?: MarkdownOrString;
1194
+ technology?: string;
1195
+ notation?: string;
1196
+ links?: NonEmptyArray<Link>;
1197
+ style: {
1198
+ shape?: ElementShape;
1199
+ icon?: Icon;
1200
+ color?: Color;
1201
+ border?: BorderStyle;
1202
+ opacity?: number;
1203
+ size?: ShapeSize;
1204
+ padding?: SpacingSize;
1205
+ textSize?: TextSize;
1206
+ multiple?: boolean;
1207
+ };
1208
+ }
1209
+ interface TagSpecification {
1210
+ color: ThemeColor | ColorLiteral;
1211
+ }
1212
+ interface RelationshipSpecification {
1213
+ technology?: string;
1214
+ notation?: string;
1215
+ color?: Color;
1216
+ line?: RelationshipLineType;
1217
+ head?: RelationshipArrowType;
1218
+ tail?: RelationshipArrowType;
1219
+ }
1220
+ type Specification<A> = A extends Any ? {
1221
+ tags: {
1222
+ [key in Tag$2<A>]: TagSpecification;
1223
+ };
1224
+ elements: {
1225
+ [key in ElementKind$1<A>]: Partial<ElementSpecification>;
1226
+ };
1227
+ deployments: {
1228
+ [key in DeploymentKind$1<A>]: Partial<ElementSpecification>;
1229
+ };
1230
+ relationships: {
1231
+ [key in RelationKind<A>]: Partial<RelationshipSpecification>;
1232
+ };
1233
+ metadataKeys?: IsNever<MetadataKey<A>> extends true ? never : MetadataKey<A>[];
1234
+ customColors?: CustomColorDefinitions;
1235
+ } : never;
1236
+ interface LikeC4Project {
1237
+ /**
1238
+ * ID of the project, casted to {@link scalar.ProjectId}
1239
+ */
1240
+ readonly id: ProjectId;
1241
+ title?: string;
1242
+ }
537
1243
  interface ComputedNode<A extends Any = Any> extends WithOptionalLinks {
538
1244
  id: NodeId;
539
1245
  kind: ElementKind$1<A> | DeploymentKind$1<A> | "@group";
@@ -593,6 +1299,27 @@ interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
593
1299
  */
594
1300
  dir?: "forward" | "back" | "both";
595
1301
  }
1302
+ interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
1303
+ readonly [_stage]: "computed";
1304
+ readonly autoLayout: ViewAutoLayout;
1305
+ readonly nodes: ComputedNode<A>[];
1306
+ readonly edges: ComputedEdge<A>[];
1307
+ /**
1308
+ * If the view is changed manually this field contains the layout data.
1309
+ */
1310
+ readonly manualLayout?: ViewManualLayout | undefined;
1311
+ }
1312
+ interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
1313
+ readonly [_type]: "element";
1314
+ readonly viewOf?: Fqn$1<A>;
1315
+ readonly extends?: StrictViewId<A>;
1316
+ }
1317
+ interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
1318
+ readonly [_type]: "deployment";
1319
+ }
1320
+ interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
1321
+ readonly [_type]: "dynamic";
1322
+ }
596
1323
  interface DiagramNode<A extends Any = Any> extends ComputedNode<A>, BBox {
597
1324
  x: number;
598
1325
  y: number;
@@ -656,7 +1383,107 @@ interface LayoutedDeploymentView<A extends Any = Any> extends BaseLayoutedViewPr
656
1383
  interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
657
1384
  readonly [_type]: "dynamic";
658
1385
  }
1386
+ interface DeploymentViewIncludePredicate<A extends Any = Unknown> extends AnyIncludePredicate<Expression<A>> {
1387
+ }
1388
+ interface DeploymentViewExcludePredicate<A extends Any = Unknown> extends AnyExcludePredicate<Expression<A>> {
1389
+ }
1390
+ interface DeploymentViewRuleStyle<A extends Any = Unknown> extends AnyViewRuleStyle<FqnExpr<A>> {
1391
+ }
1392
+ type DeploymentViewRule<A extends Any = Unknown> = ExclusiveUnion<{
1393
+ Include: DeploymentViewIncludePredicate<A>;
1394
+ Exclude: DeploymentViewExcludePredicate<A>;
1395
+ Style: DeploymentViewRuleStyle<A>;
1396
+ AutoLayout: ViewRuleAutoLayout;
1397
+ }>;
1398
+ interface ParsedDeploymentView<A extends Any = Unknown> extends BaseParsedViewProperties<A> {
1399
+ [_type]: "deployment";
1400
+ readonly rules: DeploymentViewRule<A>[];
1401
+ }
1402
+ type ParsedView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A>;
1403
+ type ComputedView<A extends Any = Any> = ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A>;
659
1404
  type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
1405
+ type AnyView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A> | ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A> | LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
1406
+ type ViewWithType<V extends AnyView<Any>, T extends ViewType> = Extract<V, {
1407
+ [_type]: T;
1408
+ }>;
1409
+ interface BaseLikeC4ModelData<A extends Any> {
1410
+ projectId: ProjectId$1<A>;
1411
+ project: LikeC4Project;
1412
+ specification: Specification<A>;
1413
+ elements: Record<ElementId<A>, Element$1<A>>;
1414
+ deployments: {
1415
+ elements: Record<DeploymentId<A>, DeploymentElement<A>>;
1416
+ relations: Record<RelationId, DeploymentRelationship<A>>;
1417
+ };
1418
+ relations: Record<RelationId, Relationship<A>>;
1419
+ globals: ModelGlobals;
1420
+ imports: Record<string, NonEmptyArray<Element$1<A>>>;
1421
+ }
1422
+ interface ParsedLikeC4ModelData<A extends Any = UnknownParsed> extends BaseLikeC4ModelData<A> {
1423
+ [_stage]: "parsed";
1424
+ views: Record<ViewId$1<A>, ParsedView<A>>;
1425
+ }
1426
+ interface ComputedLikeC4ModelData<A extends Any = UnknownComputed> extends BaseLikeC4ModelData<A> {
1427
+ [_stage]: "computed";
1428
+ views: Record<ViewId$1<A>, ComputedView<A>>;
1429
+ }
1430
+ interface LayoutedLikeC4ModelData<A extends Any = UnknownLayouted> extends BaseLikeC4ModelData<A> {
1431
+ [_stage]: "layouted";
1432
+ views: Record<ViewId$1<A>, LayoutedView<A>>;
1433
+ }
1434
+ interface SpecificationDump {
1435
+ elements: {
1436
+ [kind: string]: object;
1437
+ };
1438
+ tags?: {
1439
+ [tag: string]: object;
1440
+ };
1441
+ deployments?: {
1442
+ [kind: string]: object;
1443
+ };
1444
+ relationships?: {
1445
+ [kind: string]: object;
1446
+ };
1447
+ metadataKeys?: string[];
1448
+ customColors?: {
1449
+ [kind: string]: object;
1450
+ };
1451
+ }
1452
+ type SpecTypesFromDump<J> = J extends SpecificationDump ? SpecAux<KeysOf<J["elements"]>, KeysOf<J["deployments"]>, KeysOf<J["relationships"]>, KeysOf<J["tags"]>, J["metadataKeys"] extends readonly [
1453
+ string,
1454
+ ...string[]
1455
+ ] ? J["metadataKeys"][number] : never> : SpecAux<never, never, never, never, never>;
1456
+ type LikeC4ModelDump = {
1457
+ [_stage]?: "computed" | "layouted";
1458
+ projectId?: string;
1459
+ project?: ProjectDump;
1460
+ specification: SpecificationDump;
1461
+ elements?: {
1462
+ [kind: string]: object;
1463
+ };
1464
+ deployments: {
1465
+ elements?: {
1466
+ [kind: string]: object;
1467
+ };
1468
+ relations?: {};
1469
+ };
1470
+ views?: {
1471
+ [kind: string]: object;
1472
+ };
1473
+ relations?: {};
1474
+ globals?: {
1475
+ predicates?: {};
1476
+ dynamicPredicates?: {};
1477
+ styles?: {};
1478
+ };
1479
+ imports?: {};
1480
+ };
1481
+ type ProjectDump = {
1482
+ id: string;
1483
+ name?: string;
1484
+ title?: string | undefined;
1485
+ };
1486
+ type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends infer S extends string & "computed" | "layouted" ? S : "computed" | "layouted" | "parsed", KeysOf<D["elements"]>, KeysOf<D["deployments"]["elements"]>, KeysOf<D["views"]>, D["projectId"] extends infer PID extends string ? PID : never, SpecTypesFromDump<D["specification"]>> : Never;
660
1487
  interface RichTextEmpty {
661
1488
  readonly isEmpty: true;
662
1489
  readonly isMarkdown: false;
@@ -776,7 +1603,7 @@ type CoordinateExtent = [
776
1603
  ]
777
1604
  ];
778
1605
  type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
779
- type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = {
1606
+ type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = {
780
1607
  /** Unique id of a node. */
781
1608
  id: string;
782
1609
  /**
@@ -786,8 +1613,6 @@ type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>
786
1613
  position: XYPosition;
787
1614
  /** Arbitrary data passed to a node. */
788
1615
  data: NodeData;
789
- /** Type of node defined in `nodeTypes`. */
790
- type?: NodeType;
791
1616
  /**
792
1617
  * Only relevant for default, source, target nodeType. Controls source position.
793
1618
  * @example 'right', 'left', 'top', 'bottom'
@@ -844,7 +1669,13 @@ type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>
844
1669
  width?: number;
845
1670
  height?: number;
846
1671
  };
847
- };
1672
+ } & (undefined extends NodeType ? {
1673
+ /** Type of node defined in nodeTypes */
1674
+ type?: string | undefined;
1675
+ } : {
1676
+ /** Type of node defined in nodeTypes */
1677
+ type: NodeType;
1678
+ });
848
1679
  type InternalNodeBase<NodeType extends NodeBase = NodeBase> = Omit<NodeType, "measured"> & {
849
1680
  measured: {
850
1681
  width?: number;
@@ -949,6 +1780,8 @@ type FitViewOptionsBase<NodeType extends NodeBase = NodeBase> = {
949
1780
  minZoom?: number;
950
1781
  maxZoom?: number;
951
1782
  duration?: number;
1783
+ ease?: (t: number) => number;
1784
+ interpolate?: "smooth" | "linear";
952
1785
  nodes?: (NodeType | {
953
1786
  id: string;
954
1787
  })[];
@@ -970,6 +1803,8 @@ declare enum PanOnScrollMode {
970
1803
  }
971
1804
  type ViewportHelperFunctionOptions = {
972
1805
  duration?: number;
1806
+ ease?: (t: number) => number;
1807
+ interpolate?: "smooth" | "linear";
973
1808
  };
974
1809
  type SetCenterOptions = ViewportHelperFunctionOptions & {
975
1810
  zoom?: number;
@@ -1082,8 +1917,8 @@ declare enum ConnectionLineType {
1082
1917
  SimpleBezier = "simplebezier"
1083
1918
  }
1084
1919
  type EdgeMarker = {
1085
- type: MarkerType;
1086
- color?: string;
1920
+ type: MarkerType | `${MarkerType}`;
1921
+ color?: string | null;
1087
1922
  width?: number;
1088
1923
  height?: number;
1089
1924
  markerUnits?: string;
@@ -1103,6 +1938,24 @@ type EdgePosition = {
1103
1938
  sourcePosition: Position;
1104
1939
  targetPosition: Position;
1105
1940
  };
1941
+ declare const defaultAriaLabelConfig: {
1942
+ "node.a11yDescription.default": string;
1943
+ "node.a11yDescription.keyboardDisabled": string;
1944
+ "node.a11yDescription.ariaLiveMessage": ({ direction, x, y }: {
1945
+ direction: string;
1946
+ x: number;
1947
+ y: number;
1948
+ }) => string;
1949
+ "edge.a11yDescription.default": string;
1950
+ "controls.ariaLabel": string;
1951
+ "controls.zoomIn.ariaLabel": string;
1952
+ "controls.zoomOut.ariaLabel": string;
1953
+ "controls.fitView.ariaLabel": string;
1954
+ "controls.interactive.ariaLabel": string;
1955
+ "minimap.ariaLabel": string;
1956
+ "handle.ariaLabel": string;
1957
+ };
1958
+ type AriaLabelConfig = typeof defaultAriaLabelConfig;
1106
1959
  type OnNodesChange<NodeType extends Node$1 = Node$1> = (changes: NodeChange<NodeType>[]) => void;
1107
1960
  type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChange<EdgeType>[]) => void;
1108
1961
  type OnNodesDelete<NodeType extends Node$1 = Node$1> = (nodes: NodeType[]) => void;
@@ -1159,6 +2012,7 @@ type ViewportHelperFunctions = {
1159
2012
  *
1160
2013
  * @param viewport - the viewport to set
1161
2014
  * @param options.duration - optional duration. If set, a transition will be applied
2015
+ * @param options.ease - optional ease function.
1162
2016
  */
1163
2017
  setViewport: SetViewport;
1164
2018
  /**
@@ -1174,6 +2028,8 @@ type ViewportHelperFunctions = {
1174
2028
  * @param x - x position
1175
2029
  * @param y - y position
1176
2030
  * @param options.zoom - optional zoom
2031
+ * @param options.duration - optional duration. If set, a transition will be applied
2032
+ * @param options.ease - optional ease function.
1177
2033
  */
1178
2034
  setCenter: SetCenter;
1179
2035
  /**
@@ -1183,6 +2039,8 @@ type ViewportHelperFunctions = {
1183
2039
  *
1184
2040
  * @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
1185
2041
  * @param options.padding - optional padding
2042
+ * @param options.duration - optional duration. If set, a transition will be applied
2043
+ * @param options.ease - optional ease function.
1186
2044
  */
1187
2045
  fitBounds: FitBounds;
1188
2046
  /**
@@ -1212,11 +2070,20 @@ type ViewportHelperFunctions = {
1212
2070
  };
1213
2071
  type OnBeforeDelete<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Edge> = OnBeforeDeleteBase<NodeType, EdgeType>;
1214
2072
  type IsValidConnection<EdgeType extends Edge = Edge> = (edge: EdgeType | Connection) => boolean;
1215
- type Node$1<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = NodeBase<NodeData, NodeType> & {
2073
+ type Node$1<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = NodeBase<NodeData, NodeType> & {
1216
2074
  style?: CSSProperties;
1217
2075
  className?: string;
1218
2076
  resizing?: boolean;
1219
2077
  focusable?: boolean;
2078
+ /**
2079
+ * The ARIA role attribute for the node element, used for accessibility.
2080
+ * @default "group"
2081
+ */
2082
+ ariaRole?: AriaRole;
2083
+ /**
2084
+ * General escape hatch for adding custom attributes to the node's DOM element.
2085
+ */
2086
+ domAttributes?: Omit<HTMLAttributes<HTMLDivElement>, "id" | "style" | "className" | "draggable" | "role" | "aria-label" | "defaultValue" | keyof DOMAttributes<HTMLDivElement>>;
1220
2087
  };
1221
2088
  type InternalNode<NodeType extends Node$1 = Node$1> = InternalNodeBase<NodeType>;
1222
2089
  type NodeMouseHandler<NodeType extends Node$1 = Node$1> = (event: ReactMouseEvent, node: NodeType) => void;
@@ -1251,6 +2118,15 @@ type Edge<EdgeData extends Record<string, unknown> = Record<string, unknown>, Ed
1251
2118
  */
1252
2119
  reconnectable?: boolean | HandleType;
1253
2120
  focusable?: boolean;
2121
+ /**
2122
+ * The ARIA role attribute for the edge, used for accessibility.
2123
+ * @default "group"
2124
+ */
2125
+ ariaRole?: AriaRole;
2126
+ /**
2127
+ * General escape hatch for adding custom attributes to the edge's DOM element.
2128
+ */
2129
+ domAttributes?: Omit<SVGAttributes<SVGGElement>, "id" | "style" | "className" | "role" | "aria-label">;
1254
2130
  };
1255
2131
  type EdgeMouseHandler<EdgeType extends Edge = Edge> = (event: ReactMouseEvent, edge: EdgeType) => void;
1256
2132
  type DefaultEdgeOptions = DefaultEdgeOptionsBase<Edge>;
@@ -1370,7 +2246,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1370
2246
  * This event fires when the user releases the source or target of an editable edge. It is called
1371
2247
  * even if an edge update does not occur.
1372
2248
  */
1373
- onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
2249
+ onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType, connectionState: FinalConnectionState) => void;
1374
2250
  /**
1375
2251
  * Use this event handler to add interactivity to a controlled flow.
1376
2252
  * It is called on node drag, select, and move.
@@ -1615,6 +2491,11 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1615
2491
  * @default true
1616
2492
  */
1617
2493
  nodesDraggable?: boolean;
2494
+ /**
2495
+ * When `true`, the viewport will pan when a node is focused.
2496
+ * @default true
2497
+ */
2498
+ autoPanOnNodeFocus?: boolean;
1618
2499
  /**
1619
2500
  * Controls whether all nodes should be connectable or not. Individual nodes can override this
1620
2501
  * setting by setting their `connectable` prop.
@@ -1720,9 +2601,10 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1720
2601
  nodeExtent?: CoordinateExtent;
1721
2602
  /**
1722
2603
  * Color of edge markers.
2604
+ * You can pass `null` to use the CSS variable `--xy-edge-stroke` for the marker color.
1723
2605
  * @default '#b1b1b7'
1724
2606
  */
1725
- defaultMarkerColor?: string;
2607
+ defaultMarkerColor?: string | null;
1726
2608
  /**
1727
2609
  * Controls if the viewport should zoom by scrolling inside the container.
1728
2610
  * @default true
@@ -1771,7 +2653,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1771
2653
  noDragClassName?: string;
1772
2654
  /**
1773
2655
  * Typically, scrolling the mouse wheel when the mouse is over the canvas will zoom the viewport.
1774
- * Adding the `"nowheel"` class to an element n the canvas will prevent this behavior and this prop
2656
+ * Adding the `"nowheel"` class to an element in the canvas will prevent this behavior and this prop
1775
2657
  * allows you to change the name of that class.
1776
2658
  * @default "nowheel"
1777
2659
  */
@@ -1884,6 +2766,12 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1884
2766
  * @default 1
1885
2767
  */
1886
2768
  nodeDragThreshold?: number;
2769
+ /**
2770
+ * The threshold in pixels that the mouse must move before a connection line starts to drag.
2771
+ * This is useful to prevent accidental connections when clicking on a handle.
2772
+ * @default 1
2773
+ */
2774
+ connectionDragThreshold?: number;
1887
2775
  /** Sets a fixed width for the flow. */
1888
2776
  width?: number;
1889
2777
  /** Sets a fixed height for the flow. */
@@ -1899,6 +2787,11 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1899
2787
  * @default false
1900
2788
  */
1901
2789
  debug?: boolean;
2790
+ /**
2791
+ * Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
2792
+ * Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
2793
+ */
2794
+ ariaLabelConfig?: Partial<AriaLabelConfig>;
1902
2795
  }
1903
2796
  type ReactFlowJsonObject<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Edge> = {
1904
2797
  nodes: NodeType[];
@@ -2002,7 +2895,7 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
2002
2895
  * parameter can be set to `true` to include nodes that are only partially intersecting.
2003
2896
  *
2004
2897
  * @param node - the node or rect to check for intersections
2005
- * @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
2898
+ * @param partially - true by default, if set to false, only nodes that are fully intersecting will be returned
2006
2899
  * @param nodes - optional nodes array to check for intersections
2007
2900
  *
2008
2901
  * @returns an array of intersecting nodes
@@ -2125,46 +3018,1167 @@ type ControlsCustomLayoutProps = {
2125
3018
  actionsGroup: ReactNode;
2126
3019
  };
2127
3020
  type ControlsCustomLayout = (props: ControlsCustomLayoutProps) => ReactNode;
2128
- type Dimmed = "immediate" | boolean;
2129
- type NodeData = {
3021
+ declare class DefaultMap<K, V> implements Iterable<[
3022
+ K,
3023
+ V
3024
+ ]> {
3025
+ // Members
3026
+ size: number;
3027
+ // Constructor
3028
+ constructor(factory: (key: K, index: number) => V);
3029
+ // Methods
3030
+ clear(): void;
3031
+ set(key: K, value: V): this;
3032
+ delete(key: K): boolean;
3033
+ has(key: K): boolean;
3034
+ get(key: K): V;
3035
+ peek(key: K): V | undefined;
3036
+ forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
3037
+ keys(): IterableIterator<K>;
3038
+ values(): IterableIterator<V>;
3039
+ entries(): IterableIterator<[
3040
+ K,
3041
+ V
3042
+ ]>;
3043
+ [Symbol.iterator](): IterableIterator<[
3044
+ K,
3045
+ V
3046
+ ]>;
3047
+ inspect(): any;
3048
+ // Statics
3049
+ static autoIncrement(): number;
3050
+ }
3051
+ type RelationshipsIterator<A extends Any> = IteratorLike<RelationshipModel<A>>;
3052
+ interface AnyRelationshipModel<A extends Any> extends WithTags$1<A>, WithMetadata$1<A> {
3053
+ readonly id: RelationId;
3054
+ readonly expression: string;
3055
+ readonly title: string | null;
3056
+ readonly technology: string | null;
3057
+ readonly description: RichTextOrEmpty;
3058
+ readonly navigateTo: LikeC4ViewModel<A> | null;
3059
+ readonly kind: RelationKind<A> | null;
3060
+ readonly links: ReadonlyArray<Link>;
3061
+ readonly color: Color;
3062
+ readonly line: RelationshipLineType;
3063
+ isDeploymentRelation(): this is DeploymentRelationModel<A>;
3064
+ isModelRelation(): this is RelationshipModel<A>;
3065
+ views(): ViewsIterator<A>;
3066
+ }
3067
+ declare class RelationshipModel<A extends Any = Any> implements AnyRelationshipModel<A> {
3068
+ readonly model: LikeC4Model<A>;
3069
+ readonly $relationship: Relationship<A>;
3070
+ readonly source: ElementModel<A>;
3071
+ readonly target: ElementModel<A>;
3072
+ /**
3073
+ * Common ancestor of the source and target elements.
3074
+ * Represents the boundary of the Relation.
3075
+ */
3076
+ readonly boundary: ElementModel<A> | null;
3077
+ constructor(model: LikeC4Model<A>, $relationship: Relationship<A>);
3078
+ get id(): RelationId;
3079
+ get expression(): string;
3080
+ get title(): string | null;
3081
+ get technology(): string | null;
3082
+ get description(): RichTextOrEmpty;
3083
+ get navigateTo(): LikeC4ViewModel<A> | null;
3084
+ get tags(): Tags<A>;
3085
+ get kind(): RelationKind<A> | null;
3086
+ get links(): ReadonlyArray<Link>;
3087
+ get color(): Color;
3088
+ get line(): RelationshipLineType;
3089
+ /**
3090
+ * Iterate over all views that include this relationship.
3091
+ */
3092
+ views(): ViewsIterator<A>;
3093
+ isDeploymentRelation(): this is DeploymentRelationModel<A>;
3094
+ isModelRelation(): this is RelationshipModel<A>;
3095
+ hasMetadata(): boolean;
3096
+ getMetadata(): Metadata<A>;
3097
+ getMetadata(field: MetadataKey<A>): string | undefined;
3098
+ /**
3099
+ * Checks if the relationship has the given tag.
3100
+ */
3101
+ isTagged(tag: LooseTag<A>): boolean;
3102
+ }
3103
+ type ElementsIterator<M extends Any> = IteratorLike<ElementModel<M>>;
3104
+ declare class ElementModel<A extends Any = Any> implements WithTags$1<A>, WithMetadata$1<A> {
3105
+ readonly $model: LikeC4Model<A>;
3106
+ readonly $element: Element$1<A>;
3107
+ readonly id: Fqn$1<A>;
3108
+ readonly _literalId: ElementId<A>;
3109
+ readonly hierarchyLevel: number;
3110
+ readonly imported: null | {
3111
+ from: ProjectId;
3112
+ fqn: Fqn$1<A>;
3113
+ };
3114
+ constructor($model: LikeC4Model<A>, $element: Element$1<A>);
3115
+ get name(): string;
3116
+ get parent(): ElementModel<A> | null;
3117
+ get kind(): ElementKind$1<A>;
3118
+ get shape(): ElementShape;
3119
+ get color(): Color;
3120
+ get icon(): IconUrl | null;
2130
3121
  /**
2131
- * Whether the cursor is hovering over the node
3122
+ * Returns all tags of the element.
3123
+ * It includes tags from the element and its kind.
2132
3124
  */
2133
- hovered?: boolean;
3125
+ get tags(): Tags<A>;
3126
+ get title(): string;
3127
+ get description(): RichTextOrEmpty;
3128
+ get technology(): string | null;
3129
+ get links(): ReadonlyArray<Link>;
3130
+ get defaultView(): LikeC4ViewModel.ScopedElementView<A> | null;
3131
+ get isRoot(): boolean;
3132
+ get style(): SetRequired<ElementStyle, "size">;
3133
+ isAncestorOf(another: ElementModel<A>): boolean;
3134
+ isDescendantOf(another: ElementModel<A>): boolean;
2134
3135
  /**
2135
- * Whether the node is dimmed
2136
- * 'immediate' means that the node is dimmed without delay
3136
+ * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
3137
+ * (from closest to root)
2137
3138
  */
2138
- dimmed?: Dimmed;
2139
- };
2140
- type Node$1 = Node$1<NodeData>;
2141
- type NodeProps$2 = NodeProps$1<Node$1<NodeData, any>>;
2142
- type EdgeData = {
3139
+ ancestors(): ElementsIterator<A>;
2143
3140
  /**
2144
- * Whether the cursor is hovering over the edge
3141
+ * Returns the common ancestor of this element and another element.
2145
3142
  */
2146
- hovered?: boolean;
3143
+ commonAncestor(another: ElementModel<A>): ElementModel<A> | null;
3144
+ children(): ReadonlySet<ElementModel<A>>;
2147
3145
  /**
2148
- * Whether the edge is active (animated and highlighted)
3146
+ * Get all descendant elements (i.e. children, children’s children, etc.)
2149
3147
  */
2150
- active?: boolean;
3148
+ descendants(sort?: "asc" | "desc"): ElementsIterator<A>;
2151
3149
  /**
2152
- * Whether the edge is dimmed
2153
- * 'immediate' means that the edge is dimmed without delay
3150
+ * Get all sibling (i.e. same parent)
2154
3151
  */
2155
- dimmed?: Dimmed;
2156
- };
2157
- type Edge$1 = Simplify<Omit<Edge, "data"> & {
2158
- data: EdgeData;
2159
- }>;
2160
- type WithDimmed = {
2161
- data: {
2162
- dimmed?: Dimmed;
2163
- };
2164
- };
2165
- type WithHovered = {
2166
- data: {
2167
- hovered?: boolean;
3152
+ siblings(): ElementsIterator<A>;
3153
+ /**
3154
+ * Resolve siblings of the element and its ancestors
3155
+ * (from closest parent to root)
3156
+ */
3157
+ ascendingSiblings(): ElementsIterator<A>;
3158
+ /**
3159
+ * Resolve siblings of the element and its ancestors
3160
+ * (from root to closest)
3161
+ */
3162
+ descendingSiblings(): ElementsIterator<A>;
3163
+ incoming(filter?: IncomingFilter): RelationshipsIterator<A>;
3164
+ incomers(filter?: IncomingFilter): ElementsIterator<A>;
3165
+ outgoing(filter?: OutgoingFilter): RelationshipsIterator<A>;
3166
+ outgoers(filter?: OutgoingFilter): ElementsIterator<A>;
3167
+ get allOutgoing(): ReadonlySet<RelationshipModel<A>>;
3168
+ get allIncoming(): ReadonlySet<RelationshipModel<A>>;
3169
+ /**
3170
+ * Iterate over all views that include this element.
3171
+ */
3172
+ views(): ReadonlySet<LikeC4ViewModel<A>>;
3173
+ /**
3174
+ * Iterate over all views that scope this element.
3175
+ * It is possible that element is not included in the view.
3176
+ */
3177
+ scopedViews(): ReadonlySet<LikeC4ViewModel.ScopedElementView<A>>;
3178
+ /**
3179
+ * @returns true if the element is deployed
3180
+ */
3181
+ isDeployed(): boolean;
3182
+ deployments(): DeployedInstancesIterator<A>;
3183
+ hasMetadata(): boolean;
3184
+ getMetadata(): Metadata<A>;
3185
+ getMetadata(field: MetadataKey<A>): string | undefined;
3186
+ /**
3187
+ * Checks if the element has the given tag.
3188
+ */
3189
+ isTagged(tag: LooseTag<A>): boolean;
3190
+ }
3191
+ type NodesIterator<M extends Any, V extends $View<M>> = IteratorLike<NodeModel<M, V>>;
3192
+ declare class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags$1<A> {
3193
+ #private;
3194
+ readonly $view: LikeC4ViewModel<A, V>;
3195
+ readonly $node: V["nodes"][number];
3196
+ constructor($view: LikeC4ViewModel<A, V>, $node: V["nodes"][number]);
3197
+ get id(): NodeId;
3198
+ get title(): string;
3199
+ get kind(): ElementKind$1<A> | DeploymentKind$1<A> | typeof GroupElementKind | "instance";
3200
+ get description(): RichTextOrEmpty;
3201
+ get technology(): string | null;
3202
+ get parent(): NodeModel<A, V> | null;
3203
+ get element(): ElementModel<A> | null;
3204
+ get deployment(): DeploymentElementModel<A> | null;
3205
+ get shape(): ElementShape;
3206
+ get color(): Color;
3207
+ get icon(): IconUrl | null;
3208
+ get tags(): Tags<A>;
3209
+ get links(): ReadonlyArray<Link>;
3210
+ get navigateTo(): LikeC4ViewModel<A> | null;
3211
+ get style(): ElementStyle;
3212
+ children(): ReadonlySet<NodeModel<A, V>>;
3213
+ /**
3214
+ * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
3215
+ * (from closest to root)
3216
+ */
3217
+ ancestors(): NodesIterator<A, V>;
3218
+ siblings(): NodesIterator<A, V>;
3219
+ incoming(filter?: IncomingFilter): EdgesIterator<A, V>;
3220
+ incomers(filter?: IncomingFilter): NodesIterator<A, V>;
3221
+ outgoing(filter?: OutgoingFilter): EdgesIterator<A, V>;
3222
+ outgoers(filter?: OutgoingFilter): NodesIterator<A, V>;
3223
+ isDiagramNode(this: NodeModel<any, any>): this is NodeModel<A, ExtractOnStage<V, "layouted">>;
3224
+ hasChildren(): boolean;
3225
+ hasParent(): this is NodeModel.WithParent<A, V>;
3226
+ /**
3227
+ * Check if this node references to logical model element.
3228
+ */
3229
+ hasElement(): this is NodeModel.WithElement<A, V>;
3230
+ /**
3231
+ * Check if this node references to deployment element (Node or Instance).
3232
+ */
3233
+ hasDeployment(): this is NodeModel.WithDeploymentElement<A, V>;
3234
+ /**
3235
+ * Check if this node references to deployed instance
3236
+ * Deployed instance always references to element and deployment element.
3237
+ */
3238
+ hasDeployedInstance(): this is NodeModel.WithDeployedInstance<A, V>;
3239
+ isGroup(): this is NodeModel.IsGroup<A, V>;
3240
+ /**
3241
+ * Checks if the node has the given tag.
3242
+ */
3243
+ isTagged(tag: LooseTag<A>): boolean;
3244
+ }
3245
+ declare namespace NodeModel {
3246
+ interface WithParent<A extends Any = Any, V extends $View<A> = $View<A>> extends NodeModel<A, V> {
3247
+ parent: NodeModel<A, V>;
3248
+ }
3249
+ interface WithElement<A extends Any = Any, V extends $View<A> = $View<A>> extends NodeModel<A, V> {
3250
+ kind: ElementKind$1<A>;
3251
+ element: ElementModel<A>;
3252
+ }
3253
+ interface WithDeploymentElement<A extends Any = Any, V extends $View<A> = $View<A>> extends NodeModel<A, V> {
3254
+ kind: DeploymentKind$1<A>;
3255
+ deployment: DeploymentElementModel<A>;
3256
+ }
3257
+ interface WithDeployedInstance<A extends Any = Any, V extends $View<A> = $View<A>> extends NodeModel<A, V> {
3258
+ kind: "instance";
3259
+ element: ElementModel<A>;
3260
+ deployment: DeployedInstanceModel<A>;
3261
+ }
3262
+ interface IsGroup<A extends Any = Any, V extends $View<A> = $View<A>> extends NodeModel<A, V> {
3263
+ kind: typeof GroupElementKind;
3264
+ element: null;
3265
+ deployment: null;
3266
+ }
3267
+ }
3268
+ type EdgesIterator<A extends Any, V extends $View<A>> = IteratorLike<EdgeModel<A, V>>;
3269
+ declare class EdgeModel<A extends Any = Any, View extends $View<A> = $View<A>> implements WithTags$1<A> {
3270
+ #private;
3271
+ readonly view: LikeC4ViewModel<A, View>;
3272
+ readonly $edge: View["edges"][number];
3273
+ readonly source: NodeModel<A, View>;
3274
+ readonly target: NodeModel<A, View>;
3275
+ constructor(view: LikeC4ViewModel<A, View>, $edge: View["edges"][number], source: NodeModel<A, View>, target: NodeModel<A, View>);
3276
+ get id(): EdgeId;
3277
+ get parent(): NodeModel<A, View> | null;
3278
+ get label(): string | null;
3279
+ get description(): RichTextOrEmpty;
3280
+ get technology(): string | null;
3281
+ hasParent(): this is EdgeModel.WithParent<A, View>;
3282
+ get tags(): Tags<A>;
3283
+ get stepNumber(): number | null;
3284
+ get navigateTo(): LikeC4ViewModel<A> | null;
3285
+ get color(): Color;
3286
+ get line(): RelationshipLineType;
3287
+ isStep(): this is EdgeModel.StepEdge<A, View>;
3288
+ relationships(type: "model"): IteratorLike<RelationshipModel<A>>;
3289
+ relationships(type: "deployment"): IteratorLike<DeploymentRelationModel<A>>;
3290
+ relationships(type?: "model" | "deployment"): IteratorLike<RelationshipModel<A> | DeploymentRelationModel<A>>;
3291
+ includesRelation(rel: RelationId$1 | {
3292
+ id: RelationId$1;
3293
+ }): boolean;
3294
+ isTagged(tag: LooseTag<A>): boolean;
3295
+ }
3296
+ declare namespace EdgeModel {
3297
+ interface StepEdge<A extends Any, V extends $View<A>> extends EdgeModel<A, V> {
3298
+ id: StepEdgeId;
3299
+ stepNumber: number;
3300
+ }
3301
+ interface WithParent<A extends Any, V extends $View<A>> extends EdgeModel<A, V> {
3302
+ parent: NodeModel<A, V>;
3303
+ }
3304
+ }
3305
+ declare class LikeC4ViewsFolder<A extends Any = Any> {
3306
+ readonly $model: LikeC4Model<A>;
3307
+ /**
3308
+ * Path to this view folder, processed by {@link normalizeViewPath}
3309
+ *
3310
+ * @example
3311
+ * "Folder 1/Folder 2/Folder 3"
3312
+ */
3313
+ readonly path: string;
3314
+ /**
3315
+ * Title of this view folder.
3316
+ *
3317
+ * @example
3318
+ * // title is the last segment of the path
3319
+ * path = "Folder 1/Folder 2/Folder 3"
3320
+ * title = "Folder 3"
3321
+ */
3322
+ readonly title: string;
3323
+ /**
3324
+ * Whether this is the root view folder.
3325
+ *
3326
+ * !NOTE
3327
+ * Root folder is special folder with an empty path and used only for internal purposes. \
3328
+ * It is not visible to the user and should not be used in the code.
3329
+ */
3330
+ readonly isRoot: boolean;
3331
+ protected readonly parentPath: string | undefined;
3332
+ protected readonly defaultViewId: StrictViewId<A> | undefined;
3333
+ constructor($model: LikeC4Model<A>, path: NonEmptyArray<string>, defaultViewId: StrictViewId<A> | undefined);
3334
+ /**
3335
+ * Default view of this view folder.\
3336
+ * It is for the case when there is a view at the same path as this folder.\
3337
+ * (if there are multiple views at the same path, the first one is chosen)
3338
+ *
3339
+ * @example
3340
+ * ```
3341
+ * // Assume the following views exist:
3342
+ * const views = [
3343
+ * "Folder 1/ Folder 2 / View",
3344
+ * "Folder 1/ Folder 2 / View / Subview",
3345
+ * ]
3346
+ * ```
3347
+ * Group with path `Folder 1/ Folder 2 / View`\
3348
+ * will have default view `Folder 1/ Folder 2 / View`
3349
+ */
3350
+ get defaultView(): LikeC4ViewModel<A> | null;
3351
+ /**
3352
+ * Returns path to this view folder as an array of ancestors (excluding root) and this view folder as the last element
3353
+ *
3354
+ * @throws Error if this is the root folder.
3355
+ */
3356
+ get breadcrumbs(): [
3357
+ ...LikeC4ViewsFolder<A>[],
3358
+ this
3359
+ ];
3360
+ /**
3361
+ * Returns parent folder
3362
+ *
3363
+ * @throws Error if this is the root folder.
3364
+ */
3365
+ get parent(): LikeC4ViewsFolder<A> | null;
3366
+ /**
3367
+ * Returns sorted set of children
3368
+ * - First folders
3369
+ * - Then views
3370
+ */
3371
+ get children(): ReadonlySet<LikeC4ViewsFolder<A> | LikeC4ViewModel<A>>;
3372
+ /**
3373
+ * Returns sorted array of children folders
3374
+ */
3375
+ get folders(): ReadonlyArray<LikeC4ViewsFolder<A>>;
3376
+ /**
3377
+ * Returns all views in this view folder.
3378
+ */
3379
+ get views(): ReadonlyArray<LikeC4ViewModel<A>>;
3380
+ }
3381
+ type ViewsIterator<A extends Any, V extends $View<A> = $View<A>> = IteratorLike<LikeC4ViewModel<A, V>>;
3382
+ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags$1<A> {
3383
+ #private;
3384
+ /**
3385
+ * Don't use in runtime, only for type inference
3386
+ */
3387
+ readonly Aux: A;
3388
+ readonly $view: V;
3389
+ readonly $model: LikeC4Model<A>;
3390
+ readonly title: string | null;
3391
+ /**
3392
+ * View folder this view belongs to.
3393
+ * If view is top-level, this is the root folder.
3394
+ */
3395
+ readonly folder: LikeC4ViewsFolder<A>;
3396
+ /**
3397
+ * Path to this view, processed by {@link normalizeViewPath}
3398
+ *
3399
+ * @example
3400
+ * "Group 1/Group 2/View"
3401
+ */
3402
+ readonly viewPath: string;
3403
+ constructor(model: LikeC4Model<A>, view: V, folder: LikeC4ViewsFolder<A>);
3404
+ get _type(): V[_type];
3405
+ get id(): StrictViewId<A>;
3406
+ /**
3407
+ * Returns title if defined, otherwise returns its {@link id}
3408
+ */
3409
+ get titleOrId(): string;
3410
+ /**
3411
+ * Returns title if defined, otherwise returns `Untitled`.
3412
+ */
3413
+ get titleOrUntitled(): string;
3414
+ /**
3415
+ * Returns path to this view as an array of groups and this view as the last element
3416
+ * If view is top-level, returns only this view.
3417
+ *
3418
+ * @example
3419
+ * viewPath = "Group 1/Group 2/View"
3420
+ *
3421
+ * breadcrumbs = [
3422
+ * "Group 1", // folder
3423
+ * "Group 1/Group 2", // folder
3424
+ * "Group 1/Group 2/View" // view
3425
+ * ]
3426
+ */
3427
+ get breadcrumbs(): [
3428
+ ...LikeC4ViewsFolder<A>[],
3429
+ this
3430
+ ];
3431
+ get description(): RichTextOrEmpty;
3432
+ get tags(): Tags<A>;
3433
+ get links(): ReadonlyArray<Link>;
3434
+ get viewOf(): ElementModel<A> | null;
3435
+ /**
3436
+ * All tags from nodes and edges.
3437
+ */
3438
+ get includedTags(): Tags<A>;
3439
+ roots(): NodesIterator<A, V>;
3440
+ /**
3441
+ * Iterate over all nodes that have children.
3442
+ */
3443
+ compounds(): NodesIterator<A, V>;
3444
+ /**
3445
+ * Get node by id.
3446
+ * @throws Error if node is not found.
3447
+ */
3448
+ node(node: NodeOrId): NodeModel<A, V>;
3449
+ /**
3450
+ * Find node by id.
3451
+ */
3452
+ findNode(node: NodeOrId): NodeModel<A, V> | null;
3453
+ findNodeWithElement(element: LooseElementId<A> | {
3454
+ id: Fqn$1<A>;
3455
+ }): NodeModel.WithElement<A, V> | null;
3456
+ /**
3457
+ * Iterate over all nodes.
3458
+ */
3459
+ nodes(): NodesIterator<A, V>;
3460
+ /**
3461
+ * Find edge by id.
3462
+ * @param edge Edge or id
3463
+ * @returns EdgeModel
3464
+ */
3465
+ edge(edge: EdgeOrId): EdgeModel<A, V>;
3466
+ findEdge(edge: EdgeOrId): EdgeModel<A, V> | null;
3467
+ /**
3468
+ * Iterate over all edges.
3469
+ */
3470
+ edges(): EdgesIterator<A, V>;
3471
+ /**
3472
+ * Iterate over all edges.
3473
+ */
3474
+ edgesWithRelation(relation: RelationId$1): EdgesIterator<A, V>;
3475
+ /**
3476
+ * Nodes that have references to elements from logical model.
3477
+ */
3478
+ elements(): IteratorLike<NodeModel.WithElement<A, V>>;
3479
+ /**
3480
+ * Checks if the view has the given tag.
3481
+ */
3482
+ isTagged(tag: LooseTag<A>): boolean;
3483
+ includesElement(element: LooseElementId<A> | {
3484
+ id: Fqn$1<A>;
3485
+ }): boolean;
3486
+ includesDeployment(deployment: LooseDeploymentId<A> | {
3487
+ id: DeploymentFqn$1<A>;
3488
+ }): boolean;
3489
+ includesRelation(relation: RelationId | {
3490
+ id: RelationId;
3491
+ }): boolean;
3492
+ /**
3493
+ * Below are type guards.
3494
+ */
3495
+ isComputed(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel<toComputed<A>>;
3496
+ isDiagram(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel<toLayouted<A>>;
3497
+ isElementView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.ElementView<A, V>;
3498
+ isScopedElementView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.ScopedElementView<A>;
3499
+ isDeploymentView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.DeploymentView<A, V>;
3500
+ isDynamicView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.DynamicView<A, V>;
3501
+ }
3502
+ declare namespace LikeC4ViewModel {
3503
+ interface ElementView<A extends Any, V extends $View<A> = $View<A>> extends LikeC4ViewModel<A, ViewWithType<V, "element">> {
3504
+ }
3505
+ interface ScopedElementView<A extends Any> extends LikeC4ViewModel<A, ViewWithType<$View<A>, "element"> & {
3506
+ viewOf: Fqn$1<A>;
3507
+ }> {
3508
+ viewOf: ElementModel<A>;
3509
+ }
3510
+ interface DeploymentView<A extends Any, V extends $View<A> = $View<A>> extends LikeC4ViewModel<A, ViewWithType<V, "deployment">> {
3511
+ }
3512
+ interface DynamicView<A extends Any, V extends $View<A> = $View<A>> extends LikeC4ViewModel<A, ViewWithType<V, "dynamic">> {
3513
+ }
3514
+ }
3515
+ type IncomingFilter = "all" | "direct" | "to-descendants";
3516
+ type OutgoingFilter = "all" | "direct" | "from-descendants";
3517
+ type ElementOrFqn<A extends Any> = ElementId<A> | {
3518
+ id: Fqn$1<A>;
3519
+ };
3520
+ type DeploymentOrFqn<A extends Any> = DeploymentId<A> | {
3521
+ id: DeploymentFqn$1<A>;
3522
+ };
3523
+ type NodeOrId = string | {
3524
+ id: NodeId;
3525
+ };
3526
+ type EdgeOrId = string | {
3527
+ id: EdgeId;
3528
+ };
3529
+ type RelationOrId = string | {
3530
+ id: RelationId;
3531
+ };
3532
+ type $View<A extends Any> = {
3533
+ parsed: never;
3534
+ computed: ComputedView<A>;
3535
+ layouted: LayoutedView<A>;
3536
+ }[Stage<A>];
3537
+ type $ViewModel<A extends Any> = {
3538
+ parsed: never;
3539
+ computed: LikeC4ViewModel<A>;
3540
+ layouted: LikeC4ViewModel<A>;
3541
+ }[Stage<A>];
3542
+ type $ModelData<A extends Any> = {
3543
+ parsed: ParsedLikeC4ModelData<A>;
3544
+ computed: ComputedLikeC4ModelData<A>;
3545
+ layouted: LayoutedLikeC4ModelData<A>;
3546
+ }[Stage<A>];
3547
+ interface WithTags$1<A extends Any> {
3548
+ get tags(): Tags<A>;
3549
+ isTagged(tag: LooseTag<A>): boolean;
3550
+ }
3551
+ interface WithMetadata$1<A extends Any> {
3552
+ hasMetadata(): boolean;
3553
+ getMetadata(): Metadata<A>;
3554
+ getMetadata(field: MetadataKey<A>): string | undefined;
3555
+ }
3556
+ declare class LikeC4DeploymentModel<A extends Any = Any> {
3557
+ #private;
3558
+ readonly $model: LikeC4Model<A>;
3559
+ readonly $deployments: $ModelData<A>["deployments"];
3560
+ constructor($model: LikeC4Model<A>);
3561
+ element(el: DeploymentOrFqn<A>): DeploymentElementModel<A>;
3562
+ findElement(el: LooseDeploymentId<A>): DeploymentElementModel<A> | null;
3563
+ node(el: DeploymentOrFqn<A>): DeploymentNodeModel<A>;
3564
+ findNode(el: LooseDeploymentId<A>): DeploymentNodeModel<A> | null;
3565
+ instance(el: DeploymentOrFqn<A>): DeployedInstanceModel<A>;
3566
+ findInstance(el: LooseDeploymentId<A>): DeployedInstanceModel<A> | null;
3567
+ /**
3568
+ * Returns the root elements of the model.
3569
+ */
3570
+ roots(): DeploymentNodesIterator<A>;
3571
+ /**
3572
+ * Returns all elements in the model.
3573
+ */
3574
+ elements(): DeploymentElementsIterator<A>;
3575
+ /**
3576
+ * Returns all elements in the model.
3577
+ */
3578
+ nodes(): DeploymentNodesIterator<A>;
3579
+ nodesOfKind(kind: DeploymentKind$1<A>): DeploymentNodesIterator<A>;
3580
+ instances(): DeployedInstancesIterator<A>;
3581
+ /**
3582
+ * Iterate over all instances of the given logical element.
3583
+ */
3584
+ instancesOf(element: ElementOrFqn<A>): DeployedInstancesIterator<A>;
3585
+ deploymentRef(ref: FqnRef.DeploymentRef<A>): DeploymentElementModel<A> | NestedElementOfDeployedInstanceModel<A>;
3586
+ /**
3587
+ * Returns all relationships in the model.
3588
+ */
3589
+ relationships(): IteratorLike<DeploymentRelationModel<A>>;
3590
+ /**
3591
+ * Returns a specific relationship by its ID.
3592
+ */
3593
+ relationship(id: RelationOrId): DeploymentRelationModel<A>;
3594
+ findRelationship(id: string): DeploymentRelationModel<A> | null;
3595
+ /**
3596
+ * Returns all deployment views in the model.
3597
+ */
3598
+ views(): IteratorLike<LikeC4ViewModel.DeploymentView<A>>;
3599
+ /**
3600
+ * Returns the parent element of given element.
3601
+ * @see ancestors
3602
+ */
3603
+ parent(element: DeploymentOrFqn<A>): DeploymentNodeModel<A> | null;
3604
+ /**
3605
+ * Get all children of the element (only direct children),
3606
+ * @see descendants
3607
+ */
3608
+ children(element: DeploymentOrFqn<A>): ReadonlySet<DeploymentElementModel<A>>;
3609
+ /**
3610
+ * Get all sibling (i.e. same parent)
3611
+ */
3612
+ siblings(element: DeploymentOrFqn<A>): DeploymentElementsIterator<A>;
3613
+ /**
3614
+ * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
3615
+ * (from closest to root)
3616
+ */
3617
+ ancestors(element: DeploymentOrFqn<A>): DeploymentNodesIterator<A>;
3618
+ /**
3619
+ * Get all descendant elements (i.e. children, children’s children, etc.)
3620
+ */
3621
+ descendants(element: DeploymentOrFqn<A>, sort?: "asc" | "desc"): DeploymentElementsIterator<A>;
3622
+ /**
3623
+ * Incoming relationships to the element and its descendants
3624
+ * @see incomers
3625
+ */
3626
+ incoming(element: DeploymentOrFqn<A>, filter?: IncomingFilter): IteratorLike<DeploymentRelationModel<A>>;
3627
+ /**
3628
+ * Outgoing relationships from the element and its descendants
3629
+ * @see outgoers
3630
+ */
3631
+ outgoing(element: DeploymentOrFqn<A>, filter?: OutgoingFilter): IteratorLike<DeploymentRelationModel<A>>;
3632
+ private addElement;
3633
+ private addRelation;
3634
+ }
3635
+ type DeploymentElementsIterator<A extends Any> = IteratorLike<DeploymentElementModel<A>>;
3636
+ type DeployedInstancesIterator<A extends Any> = IteratorLike<DeployedInstanceModel<A>>;
3637
+ type DeploymentNodesIterator<A extends Any> = IteratorLike<DeploymentNodeModel<A>>;
3638
+ type DeploymentElementModel<A extends Any = Any> = DeploymentNodeModel<A> | DeployedInstanceModel<A>;
3639
+ declare abstract class AbstractDeploymentElementModel<A extends Any> implements WithTags$1<A>, WithMetadata$1<A> {
3640
+ abstract readonly id: DeploymentFqn$1<A>;
3641
+ abstract readonly _literalId: DeploymentId<A>;
3642
+ abstract readonly parent: DeploymentNodeModel<A> | null;
3643
+ abstract readonly title: string;
3644
+ abstract readonly hierarchyLevel: number;
3645
+ abstract readonly $model: LikeC4DeploymentModel<A>;
3646
+ abstract readonly $node: DeploymentElement<A>;
3647
+ abstract readonly tags: Tags<A>;
3648
+ get style(): SetRequired<DeploymentElementStyle, "shape" | "color" | "size">;
3649
+ get shape(): ElementShape;
3650
+ get color(): Color;
3651
+ get description(): RichTextOrEmpty;
3652
+ get technology(): string | null;
3653
+ get links(): ReadonlyArray<Link>;
3654
+ /**
3655
+ * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
3656
+ * (from closest to root)
3657
+ */
3658
+ ancestors(): DeploymentNodesIterator<A>;
3659
+ /**
3660
+ * Returns the common ancestor of this element and another element.
3661
+ */
3662
+ commonAncestor(another: DeploymentElementModel<A>): DeploymentNodeModel<A> | null;
3663
+ /**
3664
+ * Get all sibling (i.e. same parent)
3665
+ */
3666
+ siblings(): DeploymentElementsIterator<A>;
3667
+ /**
3668
+ * Check if the element is a sibling of another element
3669
+ */
3670
+ isSibling(other: DeploymentElementModel<A>): boolean;
3671
+ /**
3672
+ * Resolve siblings of the element and its ancestors
3673
+ * (from closest to root)
3674
+ */
3675
+ ascendingSiblings(): DeploymentElementsIterator<A>;
3676
+ /**
3677
+ * Resolve siblings of the element and its ancestors
3678
+ * (from root to closest)
3679
+ */
3680
+ descendingSiblings(): DeploymentElementsIterator<A>;
3681
+ incoming(filter?: IncomingFilter): IteratorLike<DeploymentRelationModel<A>>;
3682
+ outgoing(filter?: OutgoingFilter): IteratorLike<DeploymentRelationModel<A>>;
3683
+ incomers(filter?: IncomingFilter): IteratorLike<DeploymentRelationEndpoint<A>>;
3684
+ outgoers(filter?: OutgoingFilter): IteratorLike<DeploymentRelationEndpoint<A>>;
3685
+ /**
3686
+ * Iterate over all views that include this deployment element.
3687
+ */
3688
+ views(): IteratorLike<LikeC4ViewModel.DeploymentView<A>>;
3689
+ isDeploymentNode(): this is DeploymentNodeModel<A>;
3690
+ isInstance(): this is DeployedInstanceModel<A>;
3691
+ abstract outgoingModelRelationships(): RelationshipsIterator<A>;
3692
+ abstract incomingModelRelationships(): RelationshipsIterator<A>;
3693
+ get allOutgoing(): RelationshipsAccum<A>;
3694
+ get allIncoming(): RelationshipsAccum<A>;
3695
+ hasMetadata(): boolean;
3696
+ getMetadata(): Metadata<A>;
3697
+ getMetadata(field: MetadataKey<A>): string | undefined;
3698
+ /**
3699
+ * Checks if the deployment element has the given tag.
3700
+ */
3701
+ isTagged(tag: LooseTag<A>): boolean;
3702
+ }
3703
+ declare class DeploymentNodeModel<A extends Any = Any> extends AbstractDeploymentElementModel<A> {
3704
+ readonly $model: LikeC4DeploymentModel<A>;
3705
+ readonly $node: DeploymentNode<A>;
3706
+ id: DeploymentFqn$1<A>;
3707
+ _literalId: DeploymentId<A>;
3708
+ title: string;
3709
+ hierarchyLevel: number;
3710
+ constructor($model: LikeC4DeploymentModel<A>, $node: DeploymentNode<A>);
3711
+ get parent(): DeploymentNodeModel<A> | null;
3712
+ get kind(): DeploymentKind$1<A>;
3713
+ get tags(): Tags<A>;
3714
+ children(): ReadonlySet<DeploymentElementModel<A>>;
3715
+ descendants(sort?: "asc" | "desc"): DeploymentElementsIterator<A>;
3716
+ isDeploymentNode(): this is DeploymentNodeModel<A>;
3717
+ /**
3718
+ * Iterate over all instances nested in this deployment node.
3719
+ */
3720
+ instances(): DeployedInstancesIterator<A>;
3721
+ /**
3722
+ * Returns deployed instance inside this deployment node
3723
+ * if only there are no more instances
3724
+ */
3725
+ onlyOneInstance(): DeployedInstanceModel<A> | null;
3726
+ /**
3727
+ * Cached result of relationships from instances
3728
+ */
3729
+ private _relationshipsFromInstances;
3730
+ private relationshipsFromInstances;
3731
+ /**
3732
+ * We return only relationships that are not already present in nested instances
3733
+ */
3734
+ outgoingModelRelationships(): RelationshipsIterator<A>;
3735
+ /**
3736
+ * We return only relationships that are not already present in nested instances
3737
+ */
3738
+ incomingModelRelationships(): RelationshipsIterator<A>;
3739
+ /**
3740
+ * Returns an iterator of relationships between nested instances
3741
+ */
3742
+ internalModelRelationships(): ReadonlySet<RelationshipModel<A>>;
3743
+ }
3744
+ declare class DeployedInstanceModel<A extends Any = Any> extends AbstractDeploymentElementModel<A> {
3745
+ readonly $model: LikeC4DeploymentModel<A>;
3746
+ readonly $instance: DeployedInstance<A>;
3747
+ readonly element: ElementModel<A>;
3748
+ readonly id: DeploymentFqn$1<A>;
3749
+ readonly _literalId: DeploymentId<A>;
3750
+ readonly title: string;
3751
+ readonly hierarchyLevel: number;
3752
+ constructor($model: LikeC4DeploymentModel<A>, $instance: DeployedInstance<A>, element: ElementModel<A>);
3753
+ get $node(): DeployedInstance<A>;
3754
+ get parent(): DeploymentNodeModel<A>;
3755
+ get style(): SetRequired<DeploymentElementStyle, "shape" | "color" | "size">;
3756
+ get shape(): ElementShape;
3757
+ get color(): Color;
3758
+ get tags(): Tags<A>;
3759
+ get kind(): ElementKind$1<A>;
3760
+ get description(): RichTextOrEmpty;
3761
+ get technology(): string | null;
3762
+ get links(): ReadonlyArray<Link>;
3763
+ isInstance(): this is DeployedInstanceModel<A>;
3764
+ outgoingModelRelationships(): RelationshipsIterator<A>;
3765
+ incomingModelRelationships(): RelationshipsIterator<A>;
3766
+ /**
3767
+ * Iterate over all views that include this instance.
3768
+ * (Some views may include the parent deployment node instead of the instance.)
3769
+ */
3770
+ views(): IteratorLike<LikeC4ViewModel.DeploymentView<A>>;
3771
+ }
3772
+ declare class NestedElementOfDeployedInstanceModel<A extends Any = Any> {
3773
+ readonly instance: DeployedInstanceModel<A>;
3774
+ readonly element: ElementModel<A>;
3775
+ constructor(instance: DeployedInstanceModel<A>, element: ElementModel<A>);
3776
+ get id(): DeploymentFqn$1<A>;
3777
+ get _literalId(): DeploymentId<A>;
3778
+ get style(): SetRequired<DeploymentElementStyle, "shape" | "color">;
3779
+ get shape(): ElementShape;
3780
+ get color(): Color;
3781
+ get title(): string;
3782
+ get description(): RichTextOrEmpty;
3783
+ get technology(): string | null;
3784
+ isDeploymentNode(): this is DeploymentNodeModel<A>;
3785
+ isInstance(): this is DeployedInstanceModel<A>;
3786
+ }
3787
+ type DeploymentRelationEndpoint<A extends Any = Any> = DeploymentElementModel<A> | NestedElementOfDeployedInstanceModel<A>;
3788
+ declare class DeploymentRelationModel<A extends Any = Any> implements AnyRelationshipModel<A> {
3789
+ readonly $model: LikeC4DeploymentModel<A>;
3790
+ readonly $relationship: DeploymentRelationship<A>;
3791
+ boundary: DeploymentNodeModel<A> | null;
3792
+ source: DeploymentRelationEndpoint<A>;
3793
+ target: DeploymentRelationEndpoint<A>;
3794
+ constructor($model: LikeC4DeploymentModel<A>, $relationship: DeploymentRelationship<A>);
3795
+ get id(): RelationId;
3796
+ get expression(): string;
3797
+ get title(): string | null;
3798
+ get technology(): string | null;
3799
+ get description(): RichTextOrEmpty;
3800
+ get tags(): Tags<A>;
3801
+ get kind(): RelationKind<A> | null;
3802
+ get navigateTo(): LikeC4ViewModel<A> | null;
3803
+ get links(): ReadonlyArray<Link>;
3804
+ get color(): Color;
3805
+ get line(): RelationshipLineType;
3806
+ views(): IteratorLike<LikeC4ViewModel.DeploymentView<A>>;
3807
+ isDeploymentRelation(): this is DeploymentRelationModel<A>;
3808
+ isModelRelation(): this is RelationshipModel<A>;
3809
+ hasMetadata(): boolean;
3810
+ getMetadata(): Metadata<A>;
3811
+ getMetadata(field: MetadataKey<A>): string | undefined;
3812
+ /**
3813
+ * Checks if the relationship has the given tag.
3814
+ */
3815
+ isTagged(tag: LooseTag<A>): boolean;
3816
+ }
3817
+ declare class RelationshipsAccum<A extends Any = Any> {
3818
+ readonly model: ReadonlySet<RelationshipModel<A>>;
3819
+ readonly deployment: ReadonlySet<DeploymentRelationModel<A>>;
3820
+ static empty<A extends Any>(): RelationshipsAccum<A>;
3821
+ static from<A extends Any>(model: Iterable<RelationshipModel<A>> | undefined, deployment?: Iterable<DeploymentRelationModel<A>>): RelationshipsAccum<A>;
3822
+ /**
3823
+ * @param model relationships from logical model
3824
+ * @param deployment relationships from deployment model
3825
+ */
3826
+ constructor(model?: ReadonlySet<RelationshipModel<A>>, deployment?: ReadonlySet<DeploymentRelationModel<A>>);
3827
+ get isEmpty(): boolean;
3828
+ get nonEmpty(): boolean;
3829
+ get size(): number;
3830
+ /**
3831
+ * Returns new Accum containing all the elements which are both in this and otherAccum
3832
+ */
3833
+ intersect(otherAccum: RelationshipsAccum<A>): RelationshipsAccum<A>;
3834
+ /**
3835
+ * Returns new Accum containing all the elements which are both in this and otherAccum
3836
+ */
3837
+ difference(otherAccum: RelationshipsAccum<A>): RelationshipsAccum<A>;
3838
+ /**
3839
+ * Returns new Accum containing all the elements from both
3840
+ */
3841
+ union(otherAccum: RelationshipsAccum<A>): RelationshipsAccum<A>;
3842
+ }
3843
+ declare class LikeC4Model<A extends Any = Unknown> {
3844
+ /**
3845
+ * Don't use in runtime, only for type inference
3846
+ */
3847
+ readonly Aux: A;
3848
+ protected readonly _elements: Map<Fqn$1<A>, ElementModel<A>>;
3849
+ protected readonly _parents: Map<Fqn$1<A>, ElementModel<A>>;
3850
+ protected readonly _children: DefaultMap<Fqn$1<A>, Set<ElementModel<A>>>;
3851
+ protected readonly _rootElements: Set<ElementModel<A>>;
3852
+ protected readonly _relations: Map<RelationId<string>, RelationshipModel<A>>;
3853
+ protected readonly _incoming: DefaultMap<Fqn$1<A>, Set<RelationshipModel<A>>>;
3854
+ protected readonly _outgoing: DefaultMap<Fqn$1<A>, Set<RelationshipModel<A>>>;
3855
+ protected readonly _internal: DefaultMap<Fqn$1<A>, Set<RelationshipModel<A>>>;
3856
+ protected readonly _views: Map<ViewId$1<A>, LikeC4ViewModel<A, $View<A>>>;
3857
+ protected readonly _rootViewFolder: LikeC4ViewsFolder<A>;
3858
+ protected readonly _viewFolders: Map<string, LikeC4ViewsFolder<A>>;
3859
+ protected readonly _viewFolderItems: DefaultMap<string, Set<LikeC4ViewModel<A, $View<A>> | LikeC4ViewsFolder<A>>>;
3860
+ protected readonly _allTags: DefaultMap<Tag$2<A>, Set<LikeC4ViewModel<A, $View<A>> | ElementModel<A> | RelationshipModel<A>>>;
3861
+ static fromParsed<T extends Any>(model: ParsedLikeC4ModelData<T>): LikeC4Model.Parsed<T>;
3862
+ /**
3863
+ * Creates a new LikeC4Model instance from the provided model data.
3864
+ * Model with parsed data will not have views, as they must be computed
3865
+ * (this model is used for computing views)
3866
+ *
3867
+ * @typeParam M - Type parameter constrained to AnyLikeC4Model
3868
+ * @param model - The model data to create a LikeC4Model from
3869
+ * @returns A new LikeC4Model instance with the type derived from the input model
3870
+ */
3871
+ static create<T extends Any>(model: ParsedLikeC4ModelData<T>): LikeC4Model.Parsed<T>;
3872
+ static create<T extends Any>(model: LayoutedLikeC4ModelData<T>): LikeC4Model.Layouted<T>;
3873
+ static create<T extends Any>(model: ComputedLikeC4ModelData<T>): LikeC4Model.Computed<T>;
3874
+ /**
3875
+ * Creates a new LikeC4Model instance and infers types from a model dump.\
3876
+ * Model dump expected to be computed or layouted.
3877
+ *
3878
+ * @typeParam D - A constant type parameter extending LikeC4ModelDump
3879
+ * @param dump - The model dump to create the instance from
3880
+ * @returns A new LikeC4Model instance with types inferred from the dump
3881
+ */
3882
+ static fromDump<const D extends LikeC4ModelDump>(dump: D): LikeC4Model<AuxFromDump<D>>;
3883
+ readonly deployment: LikeC4DeploymentModel<A>;
3884
+ readonly $data: $ModelData<A>;
3885
+ constructor($data: $ModelData<A>);
3886
+ /**
3887
+ * Type narrows the model to the parsed stage.
3888
+ * This is useful for tests
3889
+ */
3890
+ get asParsed(): LikeC4Model.Parsed<A>;
3891
+ /**
3892
+ * Type narrows the model to the layouted stage.
3893
+ * This is useful for tests
3894
+ */
3895
+ get asComputed(): LikeC4Model.Computed<A>;
3896
+ /**
3897
+ * Type narrows the model to the layouted stage.
3898
+ * This is useful for tests
3899
+ */
3900
+ get asLayouted(): LikeC4Model.Layouted<A>;
3901
+ /**
3902
+ * Type guard the model to the parsed stage.
3903
+ */
3904
+ isParsed(this: LikeC4Model<any>): this is LikeC4Model<toParsed<A>>;
3905
+ /**
3906
+ * Type guard the model to the layouted stage.
3907
+ */
3908
+ isLayouted(this: LikeC4Model<any>): this is LikeC4Model<toLayouted<A>>;
3909
+ /**
3910
+ * Type guard the model to the computed stage.
3911
+ */
3912
+ isComputed(this: LikeC4Model<any>): this is LikeC4Model<toComputed<A>>;
3913
+ /**
3914
+ * Keeping here for backward compatibility
3915
+ * @deprecated use {@link $data}
3916
+ */
3917
+ get $model(): $ModelData<A>;
3918
+ get stage(): Stage<A>;
3919
+ /**
3920
+ * Returns the Project ID associated with the model.
3921
+ * If the project ID is not defined in the model, it returns "default".
3922
+ */
3923
+ get projectId(): ProjectId$1<A>;
3924
+ /**
3925
+ * Returns the project associated with the model.
3926
+ * If the project is not defined in the model, it returns a default project with the ID "default".
3927
+ */
3928
+ get project(): LikeC4Project;
3929
+ get specification(): Specification<A>;
3930
+ get globals(): ModelGlobals;
3931
+ /**
3932
+ * Returns the element with the given FQN.
3933
+ *
3934
+ * @throws Error if element is not found\
3935
+ * Use {@link findElement} if you don't want to throw an error
3936
+ *
3937
+ * @note Method is type-safe for typed model
3938
+
3939
+ * @example
3940
+ * model.element('cloud.frontend')
3941
+ * // or object with id property of scalar.Fqn
3942
+ * model.element({
3943
+ * id: 'dashboard',
3944
+ * })
3945
+ */
3946
+ element(el: ElementOrFqn<A>): ElementModel<A>;
3947
+ /**
3948
+ * Returns the element with the given FQN.
3949
+ *
3950
+ * @returns Element if found, null otherwise
3951
+ * @note Method is not type-safe as {@link element}
3952
+ *
3953
+ * @example
3954
+ * model.findElement('cloud.frontend')
3955
+ */
3956
+ findElement(el: LooseElementId<A>): ElementModel<A> | null;
3957
+ /**
3958
+ * Returns the root elements of the model.
3959
+ */
3960
+ roots(): ElementsIterator<A>;
3961
+ /**
3962
+ * Returns all elements in the model.
3963
+ */
3964
+ elements(): ElementsIterator<A>;
3965
+ /**
3966
+ * Returns all relationships in the model.
3967
+ */
3968
+ relationships(): RelationshipsIterator<A>;
3969
+ /**
3970
+ * Returns a specific relationship by its ID.
3971
+ * If the relationship is not found in the model, it will be searched in the deployment model.
3972
+ * Search can be limited to the model or deployment model only.
3973
+ */
3974
+ relationship(rel: RelationOrId, type: "model"): RelationshipModel<A>;
3975
+ relationship(rel: RelationOrId, type: "deployment"): DeploymentRelationModel<A>;
3976
+ relationship(rel: RelationId, type?: "model" | "deployment"): RelationshipModel<A> | DeploymentRelationModel<A>;
3977
+ findRelationship(id: string, type: "model"): RelationshipModel<A> | null;
3978
+ findRelationship(id: string, type: "deployment"): DeploymentRelationModel<A> | null;
3979
+ findRelationship(id: string, type?: "model" | "deployment"): RelationshipModel<A> | DeploymentRelationModel<A> | null;
3980
+ /**
3981
+ * Returns all views in the model.
3982
+ */
3983
+ views(): IteratorLike<LikeC4ViewModel<A, $View<A>>>;
3984
+ /**
3985
+ * Returns a specific view by its ID.
3986
+ * @note Method is type-safe for typed model
3987
+ * @throws Error if view is not found\
3988
+ * Use {@link findView} if you don't want to throw an error
3989
+ *
3990
+ * @example
3991
+ * model.view('index')
3992
+ * // or object with id property of scalar.ViewId
3993
+ * model.view({
3994
+ * id: 'index',
3995
+ * })
3996
+ */
3997
+ view(viewId: ViewId$1<A> | {
3998
+ id: ViewId<ViewId$1<A>>;
3999
+ }): LikeC4ViewModel<A, $View<A>>;
4000
+ /**
4001
+ * Returns a specific view by its ID.
4002
+ * @note Method is not type-safe as {@link view}
4003
+ *
4004
+ * @example
4005
+ * model.findView('index')
4006
+ */
4007
+ findView(viewId: LooseViewId<A>): LikeC4ViewModel<A, $View<A>> | null;
4008
+ /**
4009
+ * Returns a view folder by its path.
4010
+ * Path is extracted from the view title, e.g. "Group 1/Group 2/View" -> "Group 1/Group 2"
4011
+ * @throws Error if view folder is not found.
4012
+ */
4013
+ viewFolder(path: string): LikeC4ViewsFolder<A>;
4014
+ /**
4015
+ * Root folder is a special one with an empty path and used only for internal purposes.
4016
+ * It is not visible to the user and should be used only to get top-level folders and views.
4017
+ */
4018
+ get rootViewFolder(): LikeC4ViewsFolder<A>;
4019
+ /**
4020
+ * Whether the model has any view folders.
4021
+ */
4022
+ get hasViewFolders(): boolean;
4023
+ /**
4024
+ * Returns all children of a view folder.
4025
+ * Path is extracted from the view title, e.g. "Group 1/Group 2/View" -> "Group 1/Group 2"
4026
+ *
4027
+ * @throws Error if view folder is not found.
4028
+ */
4029
+ viewFolderItems(path: string): ReadonlySet<LikeC4ViewsFolder<A> | LikeC4ViewModel<A>>;
4030
+ /**
4031
+ * Returns the parent element of given element.
4032
+ * @see ancestors
4033
+ */
4034
+ parent(element: ElementOrFqn<A>): ElementModel<A> | null;
4035
+ /**
4036
+ * Get all children of the element (only direct children),
4037
+ * @see descendants
4038
+ */
4039
+ children(element: ElementOrFqn<A>): ReadonlySet<ElementModel<A>>;
4040
+ /**
4041
+ * Get all sibling (i.e. same parent)
4042
+ */
4043
+ siblings(element: ElementOrFqn<A>): ElementsIterator<A>;
4044
+ /**
4045
+ * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
4046
+ * (from closest to root)
4047
+ */
4048
+ ancestors(element: ElementOrFqn<A>): ElementsIterator<A>;
4049
+ /**
4050
+ * Get all descendant elements (i.e. children, children’s children, etc.)
4051
+ */
4052
+ descendants(element: ElementOrFqn<A>): ElementsIterator<A>;
4053
+ /**
4054
+ * Incoming relationships to the element and its descendants
4055
+ * @see incomers
4056
+ */
4057
+ incoming(element: ElementOrFqn<A>, filter?: IncomingFilter): RelationshipsIterator<A>;
4058
+ /**
4059
+ * Outgoing relationships from the element and its descendants
4060
+ * @see outgoers
4061
+ */
4062
+ outgoing(element: ElementOrFqn<A>, filter?: OutgoingFilter): RelationshipsIterator<A>;
4063
+ /**
4064
+ * Returns array of all tags used in the model, sorted naturally.\
4065
+ * Use {@link specification.tags} to get all defined tags
4066
+ */
4067
+ get tags(): Tags<A>;
4068
+ /**
4069
+ * Returns all tags used in the model, sorted by usage count (descending).
4070
+ */
4071
+ get tagsSortedByUsage(): ReadonlyArray<{
4072
+ tag: Tag$2<A>;
4073
+ count: number;
4074
+ tagged: ReadonlySet<ElementModel<A> | RelationshipModel<A> | LikeC4ViewModel<A>>;
4075
+ }>;
4076
+ /**
4077
+ * Returns all elements, relationships and views marked with the given tag.
4078
+ */
4079
+ findByTag(tag: Tag$2<A>): IteratorLike<ElementModel<A> | RelationshipModel<A> | LikeC4ViewModel<A>>;
4080
+ findByTag(tag: Tag$2<A>, type: "elements"): IteratorLike<ElementModel<A>>;
4081
+ findByTag(tag: Tag$2<A>, type: "views"): IteratorLike<LikeC4ViewModel<A>>;
4082
+ findByTag(tag: Tag$2<A>, type: "relationships"): IteratorLike<RelationshipModel<A>>;
4083
+ /**
4084
+ * Returns all elements of the given kind.
4085
+ */
4086
+ elementsOfKind(kind: ElementKind$1<A>): IteratorLike<ElementModel<A>>;
4087
+ /**
4088
+ * Returns all elements that match the given where operator.
4089
+ *
4090
+ * @example
4091
+ * ```ts
4092
+ * model.where({
4093
+ * and: [
4094
+ * { kind: 'component' },
4095
+ * {
4096
+ * or: [
4097
+ * { tag: 'old' },
4098
+ * { tag: { neq: 'new' } },
4099
+ * ],
4100
+ * },
4101
+ * ],
4102
+ * })
4103
+ * ```
4104
+ */
4105
+ elementsWhere(where: WhereOperator<A>): IteratorLike<ElementModel<A>>;
4106
+ /**
4107
+ * Returns all **model** relationships that match the given where operator.
4108
+ *
4109
+ * @example
4110
+ * ```ts
4111
+ * model.relationshipsWhere({
4112
+ * and: [
4113
+ * { kind: 'uses' },
4114
+ * {
4115
+ * or: [
4116
+ * { tag: 'old' },
4117
+ * { tag: { neq: 'new' } },
4118
+ * ],
4119
+ * },
4120
+ * ],
4121
+ * })
4122
+ * ```
4123
+ */
4124
+ relationshipsWhere(where: WhereOperator<A>): IteratorLike<RelationshipModel<A>>;
4125
+ private addElement;
4126
+ private addImportedElement;
4127
+ private addRelation;
4128
+ }
4129
+ declare namespace LikeC4Model {
4130
+ const EMPTY: LikeC4Model<Aux<"computed", string, string, string, string, SpecAux<string, string, string, string, string>>>;
4131
+ type Parsed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownParsed> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<"parsed", E, D, V, PID, Spec>> : never;
4132
+ type Computed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownComputed> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<"computed", E, D, V, PID, Spec>> : never;
4133
+ type Layouted<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownLayouted> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<"layouted", E, D, V, PID, Spec>> : never;
4134
+ type Node<A = Unknown> = A extends Any ? NodeModel<A> : never;
4135
+ type Element<A = Unknown> = A extends Any ? ElementModel<A> : never;
4136
+ type Relationship<A = Unknown> = A extends Any ? RelationshipModel<A> : never;
4137
+ type View<A = Unknown> = A extends Any ? $ViewModel<A> : never;
4138
+ type DeploymentNode<A = Unknown> = A extends Any ? DeploymentNodeModel<A> : never;
4139
+ type DeployedInstance<A = Unknown> = A extends Any ? DeployedInstanceModel<A> : never;
4140
+ type AnyRelation<M = Unknown> = M extends Any ? RelationshipModel<M> | DeploymentRelationModel<M> : never;
4141
+ }
4142
+ type Dimmed = "immediate" | boolean;
4143
+ type NodeData = {
4144
+ /**
4145
+ * Whether the cursor is hovering over the node
4146
+ */
4147
+ hovered?: boolean;
4148
+ /**
4149
+ * Whether the node is dimmed
4150
+ * 'immediate' means that the node is dimmed without delay
4151
+ */
4152
+ dimmed?: Dimmed;
4153
+ };
4154
+ type Node$1 = Node$1<NodeData>;
4155
+ type NodeProps$2 = NodeProps$1<Node$1<NodeData, any>>;
4156
+ type EdgeData = {
4157
+ /**
4158
+ * Whether the cursor is hovering over the edge
4159
+ */
4160
+ hovered?: boolean;
4161
+ /**
4162
+ * Whether the edge is active (animated and highlighted)
4163
+ */
4164
+ active?: boolean;
4165
+ /**
4166
+ * Whether the edge is dimmed
4167
+ * 'immediate' means that the edge is dimmed without delay
4168
+ */
4169
+ dimmed?: Dimmed;
4170
+ };
4171
+ type Edge$1 = Simplify<Omit<Edge, "data"> & {
4172
+ data: EdgeData;
4173
+ }>;
4174
+ type WithDimmed = {
4175
+ data: {
4176
+ dimmed?: Dimmed;
4177
+ };
4178
+ };
4179
+ type WithHovered = {
4180
+ data: {
4181
+ hovered?: boolean;
2168
4182
  };
2169
4183
  };
2170
4184
  declare function setDimmed<T extends WithDimmed>(value: T, dimmed: "immediate" | boolean): T;
@@ -2176,7 +4190,7 @@ type WithData<D> = {
2176
4190
  };
2177
4191
  declare function setData<E extends WithData<any>>(value: E, state: Partial<E["data"]>): E;
2178
4192
  declare function setData<E extends WithData<any>>(state: Partial<E["data"]>): (value: E) => E;
2179
- type NodeProps$3<T extends Record<string, unknown> = {}, NodeType extends string = string> = NodeProps$1<Node$1<Base.NodeData & T, NodeType>>;
4193
+ type NodeProps$3<T extends Record<string, unknown> = {}, NodeType extends string = string> = Simplify<NodeProps$1<Node$1<Base.NodeData & T, NodeType>>>;
2180
4194
  type ReactFlowNode<Data extends Record<string, unknown>, NodeType extends string> = SetRequired<Node$1<Data, NodeType>, "type" | "initialWidth" | "initialHeight">;
2181
4195
  type ReactFlowEdge<Data extends Record<string, unknown>, EdgeType extends string> = SetRequired<Edge<Data, EdgeType>, "type" | "data">;
2182
4196
  type NonOptional<T extends object> = Simplify<{
@@ -2258,12 +4272,12 @@ declare namespace Types {
2258
4272
  type Edge = RelationshipEdge;
2259
4273
  type EdgeData = RelationshipEdgeData;
2260
4274
  }
2261
- interface CustomNodes {
2262
- element?: undefined | ((props: NodeProps$3<Types.ElementNodeData, "element">) => ReactNode);
2263
- deployment?: undefined | ((props: NodeProps$3<Types.DeploymentElementNodeData, "deployment">) => ReactNode);
2264
- compoundElement?: undefined | ((props: NodeProps$3<Types.CompoundElementNodeData, "compound-element">) => ReactNode);
2265
- compoundDeployment?: undefined | ((props: NodeProps$3<Types.CompoundDeploymentNodeData, "compound-deployment">) => ReactNode);
2266
- viewGroup?: undefined | ((props: NodeProps$3<Types.ViewGroupNodeData, "view-group">) => ReactNode);
4275
+ export interface CustomNodes {
4276
+ element?: FunctionComponent<NodeProps$3<Types.ElementNodeData, "element">>;
4277
+ deployment?: FunctionComponent<NodeProps$3<Types.DeploymentElementNodeData, "deployment">>;
4278
+ compoundElement?: FunctionComponent<NodeProps$3<Types.CompoundElementNodeData, "compound-element">>;
4279
+ compoundDeployment?: FunctionComponent<NodeProps$3<Types.CompoundDeploymentNodeData, "compound-deployment">>;
4280
+ viewGroup?: FunctionComponent<NodeProps$3<Types.ViewGroupNodeData, "view-group">>;
2267
4281
  }
2268
4282
  type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, "navigateTo">;
2269
4283
  type ElementIconRendererProps = {
@@ -2275,14 +4289,18 @@ type ElementIconRendererProps = {
2275
4289
  className?: string;
2276
4290
  };
2277
4291
  export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
2278
- type OnNavigateTo<A extends Any> = (to: _aux.ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
2279
- type OnNodeClick<A extends Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
2280
- type OnEdgeClick<A extends Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
2281
- type OnCanvasClick = (event: ReactMouseEvent) => void;
2282
- type ChangeEvent = {
4292
+ export type OnNavigateTo<A extends Any = Any> = (to: _aux.ViewId<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
4293
+ export type OnNodeClick<A extends Any = Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
4294
+ export type OnEdgeClick<A extends Any = Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
4295
+ /**
4296
+ * On pane/canvas click (not on any node or edge)
4297
+ */
4298
+ export type OnCanvasClick = (event: ReactMouseEvent) => void;
4299
+ export type ChangeEvent = {
2283
4300
  change: ViewChange;
2284
4301
  };
2285
- type OnChange = (event: ChangeEvent) => void;
4302
+ export type OnChange = (event: ChangeEvent) => void;
4303
+ export type LikeC4ColorScheme = "light" | "dark";
2286
4304
  type OverrideReactFlowProps = Pick<ReactFlowProps, "paneClickDistance" | "nodeClickDistance" | "selectionKeyCode" | "panActivationKeyCode" | "multiSelectionKeyCode" | "zoomActivationKeyCode" | "snapToGrid" | "snapGrid" | "onlyRenderVisibleElements" | "nodesDraggable" | "nodesFocusable" | "elementsSelectable" | "selectNodesOnDrag" | "panOnDrag" | "preventScrolling" | "zoomOnScroll" | "zoomOnPinch" | "panOnScroll" | "panOnScrollSpeed" | "panOnScrollMode" | "zoomOnDoubleClick" | "nodeDragThreshold">;
2287
4305
  type PaddingUnit$1 = "px" | "%";
2288
4306
  type PaddingWithUnit$1 = `${number}${PaddingUnit$1}` | number;
@@ -2294,7 +4312,7 @@ type ViewPadding = PaddingWithUnit$1 | {
2294
4312
  x?: PaddingWithUnit$1;
2295
4313
  y?: PaddingWithUnit$1;
2296
4314
  };
2297
- interface LikeC4DiagramProperties<A extends _aux.Any> {
4315
+ interface LikeC4DiagramProperties<A extends Any = Any> {
2298
4316
  view: LayoutedView<A>;
2299
4317
  className?: string | undefined;
2300
4318
  /**
@@ -2466,7 +4484,7 @@ interface LikeC4DiagramProperties<A extends _aux.Any> {
2466
4484
  */
2467
4485
  reactFlowProps?: OverrideReactFlowProps | undefined;
2468
4486
  }
2469
- type OpenSourceParams<A extends _aux.Any = _aux.Any> = {
4487
+ export type OpenSourceParams<A extends _aux.Any = _aux.Any> = {
2470
4488
  element: _aux.Fqn<A>;
2471
4489
  property?: string;
2472
4490
  } | {
@@ -2477,7 +4495,7 @@ type OpenSourceParams<A extends _aux.Any = _aux.Any> = {
2477
4495
  } | {
2478
4496
  view: _aux.StrictViewId<A>;
2479
4497
  };
2480
- interface LikeC4DiagramEventHandlers<A extends _aux.Any = _aux.Any> {
4498
+ export interface LikeC4DiagramEventHandlers<A extends _aux.Any = _aux.Any> {
2481
4499
  onChange?: OnChange | null | undefined;
2482
4500
  onNavigateTo?: OnNavigateTo<A> | null | undefined;
2483
4501
  onNodeClick?: OnNodeClick<A> | null | undefined;
@@ -2490,7 +4508,7 @@ interface LikeC4DiagramEventHandlers<A extends _aux.Any = _aux.Any> {
2490
4508
  onBurgerMenuClick?: null | undefined | (() => void);
2491
4509
  onOpenSource?: null | undefined | ((params: OpenSourceParams<A>) => void);
2492
4510
  }
2493
- export interface LikeC4ViewProps<A extends _aux.Any> {
4511
+ export interface LikeC4ViewProps<A extends Any> {
2494
4512
  /**
2495
4513
  * View to display.
2496
4514
  */
@@ -2628,7 +4646,7 @@ export interface LikeC4ViewProps<A extends _aux.Any> {
2628
4646
  */
2629
4647
  renderIcon?: ElementIconRenderer | undefined;
2630
4648
  }
2631
- interface LikeC4BrowserProps {
4649
+ export interface LikeC4BrowserProps {
2632
4650
  /**
2633
4651
  * Background pattern for the browser view.
2634
4652
  * @default 'dots'
@@ -2712,9 +4730,9 @@ interface LikeC4BrowserProps {
2712
4730
  */
2713
4731
  reactFlowProps?: OverrideReactFlowProps | undefined;
2714
4732
  }
2715
- export declare function LikeC4View<A extends _aux.Any = _aux.UnknownLayouted>({ viewId, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
4733
+ export declare function LikeC4View<A extends Any = UnknownLayouted>({ viewId, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
2716
4734
  type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4DiagramProperties<A> & LikeC4DiagramEventHandlers<A>>;
2717
- export type ReactLikeC4Props<A extends _aux.Any> = Omit<LikeC4DiagramProps<A>, "view"> & {
4735
+ export type ReactLikeC4Props<A extends Any> = Omit<LikeC4DiagramProps<A>, "view"> & {
2718
4736
  viewId: _aux.ViewId<A>;
2719
4737
  /**
2720
4738
  * Keep aspect ratio of the diagram
@@ -2740,11 +4758,26 @@ export type ReactLikeC4Props<A extends _aux.Any> = Omit<LikeC4DiagramProps<A>, "
2740
4758
  /** Function to generate nonce attribute added to all generated `<style />` tags */
2741
4759
  styleNonce?: string | (() => string) | undefined;
2742
4760
  };
2743
- export declare function ReactLikeC4<A extends _aux.Any = _aux.UnknownLayouted>({ viewId, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
4761
+ export declare function ReactLikeC4<A extends Any = UnknownLayouted>({ viewId, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
2744
4762
  export declare namespace ReactLikeC4 {
2745
4763
  var displayName: string;
2746
4764
  }
2747
- type LikeC4ModelProviderProps = PropsWithChildren<{
4765
+ export interface LikeC4ProjectsProviderProps {
4766
+ /**
4767
+ * Projects to be used in the navigation panel.
4768
+ * Current project is taken from the LikeC4Model
4769
+ */
4770
+ projects: ReadonlyArray<LikeC4Project>;
4771
+ /**
4772
+ * Optional callback when another project is selected.
4773
+ */
4774
+ onProjectChange?: (id: ProjectId) => void;
4775
+ }
4776
+ /**
4777
+ * Ensures LikeC4Projects context
4778
+ */
4779
+ export declare function LikeC4ProjectsProvider({ children, projects, onProjectChange: _onProjectChange, }: PropsWithChildren<LikeC4ProjectsProviderProps>): import("react/jsx-runtime").JSX.Element;
4780
+ export type LikeC4ModelProviderProps = PropsWithChildren<{
2748
4781
  /**
2749
4782
  * The LikeC4 model to be provided to the context.
2750
4783
  * TODO: refer to 'likec4/model'
@@ -2755,9 +4788,49 @@ export declare const LikeC4ModelProvider: (props: LikeC4ModelProviderProps) => J
2755
4788
  export declare const ViewNotFound: ({ viewId }: {
2756
4789
  viewId: string;
2757
4790
  }) => import("react/jsx-runtime").JSX.Element;
4791
+ declare const FeatureNames: readonly [
4792
+ "Controls",
4793
+ "ReadOnly",
4794
+ "FocusMode",
4795
+ "NavigateTo",
4796
+ "ElementDetails",
4797
+ "RelationshipDetails",
4798
+ "RelationshipBrowser",
4799
+ "Search",
4800
+ "NavigationButtons",
4801
+ "Notations",
4802
+ "DynamicViewWalkthrough",
4803
+ "EdgeEditing",
4804
+ "ViewTitle",
4805
+ "FitView",
4806
+ "Vscode",
4807
+ "ElementTags"
4808
+ ];
4809
+ type FeatureName = typeof FeatureNames[number];
4810
+ type CustomFeatures = {
4811
+ enableControls: "next" | boolean;
4812
+ };
4813
+ export type EnabledFeatures = {
4814
+ [P in `enable${FeatureName}`]: P extends keyof CustomFeatures ? CustomFeatures[P] : boolean;
4815
+ };
4816
+ export declare function useEnabledFeatures(): EnabledFeatures;
4817
+ /**
4818
+ * Returns current view id
4819
+ * Should be used only inside LikeC4Diagram
4820
+ */
4821
+ export declare function useCurrentViewId(): ViewId;
4822
+ type CurrentViewModel = LikeC4ViewModel<_aux.UnknownLayouted, LayoutedView<_aux.UnknownLayouted>>;
4823
+ export declare function useCurrentViewModel(): CurrentViewModel;
4824
+ export declare function useLikeC4Model<A extends _aux.Any = _aux.UnknownLayouted>(): LikeC4Model<A>;
4825
+ export declare function useLikeC4ViewModel<A extends _aux.Any = _aux.UnknownLayouted>(viewId: _aux.ViewId<A>): LikeC4ViewModel<A>;
2758
4826
 
2759
4827
  declare namespace Base {
2760
4828
  export { Dimmed, Edge$1 as Edge, EdgeData, Node$1 as Node, NodeData, NodeProps$2 as NodeProps, setData, setDimmed, setHovered };
2761
4829
  }
2762
4830
 
4831
+ export {
4832
+ PaddingUnit$1 as PaddingUnit,
4833
+ PaddingWithUnit$1 as PaddingWithUnit,
4834
+ };
4835
+
2763
4836
  export {};