likec4 1.18.0 → 1.19.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.
Files changed (39) hide show
  1. package/LICENSE +1 -1
  2. package/__app__/index.html +0 -1
  3. package/__app__/react/likec4.tsx +11 -8
  4. package/__app__/src/chunks/-index-overview-C9eO_hFX.js +309 -0
  5. package/__app__/src/chunks/-view-lazy-data-CI4xD57c.js +9 -0
  6. package/__app__/src/chunks/index-KI-kE60c.js +465 -0
  7. package/__app__/src/chunks/likec4-CusAw_j6.js +6106 -0
  8. package/__app__/src/chunks/main-DY2KbFcO.js +24136 -0
  9. package/__app__/src/chunks/mantine-B_6mKFFA.js +13671 -0
  10. package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +2373 -0
  11. package/__app__/src/icons.js +6 -6
  12. package/__app__/src/main.js +1 -1
  13. package/__app__/src/style.css +1 -1
  14. package/__app__/webcomponent/webcomponent.js +21699 -21851
  15. package/dist/chunks/prompt.mjs +35 -35
  16. package/dist/cli/index.mjs +91 -88
  17. package/dist/index.d.mts +410 -2388
  18. package/dist/index.d.ts +410 -2388
  19. package/dist/index.mjs +1 -1
  20. package/dist/model/index.d.mts +258 -0
  21. package/dist/model/index.d.ts +258 -0
  22. package/dist/model/index.mjs +1 -0
  23. package/dist/shared/likec4.CbSUX9bc.mjs +1853 -0
  24. package/dist/shared/likec4.DCwaTTuF.d.mts +1625 -0
  25. package/dist/shared/likec4.DCwaTTuF.d.ts +1625 -0
  26. package/dist/shared/likec4.LktBLTET.mjs +9 -0
  27. package/package.json +65 -62
  28. package/react/index.d.ts +150 -918
  29. package/react/index.js +39830 -0
  30. package/react/style.css +1 -1
  31. package/__app__/src/chunks/-index-overview-CBnvpD1d.js +0 -309
  32. package/__app__/src/chunks/-view-lazy-data-WZmbIsHq.js +0 -9
  33. package/__app__/src/chunks/index-CIsxIzOH.js +0 -465
  34. package/__app__/src/chunks/likec4-DslTxitT.js +0 -6109
  35. package/__app__/src/chunks/main-ByUdz_Be.js +0 -24285
  36. package/__app__/src/chunks/mantine-oFa3ZrEq.js +0 -13658
  37. package/__app__/src/chunks/tanstack-router-BWjXKr0n.js +0 -2373
  38. package/dist/shared/likec4.lgHXhASw.mjs +0 -1832
  39. package/react/index.mjs +0 -41515
package/react/index.d.ts CHANGED
@@ -1,22 +1,8 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { CSSProperties, DependencyList, HTMLAttributes, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode } from 'react';
4
- import { IsLiteral, LiteralUnion, MergeExclusive, NonEmptyTuple, OverrideProperties, PartialDeep, SetRequired, Simplify, Tagged, TupleToUnion, UnionToIntersection } from 'type-fest';
3
+ import { CSSProperties, DependencyList, HTMLAttributes, JSX as JSX$1, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode } from 'react';
4
+ import { LiteralUnion, OverrideProperties, PartialDeep, Simplify, Tagged, TupleToUnion, UnionToIntersection } from 'type-fest';
5
5
 
6
- type NonEmptyArray<T> = [
7
- T,
8
- ...T[]
9
- ];
10
- type IconUrl = Tagged<string, "IconUrl"> | "none";
11
- type Point = readonly [
12
- x: number,
13
- y: number
14
- ];
15
- interface XYPoint {
16
- x: number;
17
- y: number;
18
- }
19
- type KeysOf<T> = keyof T extends infer K extends string ? K : never;
20
6
  declare const ThemeColors: readonly [
21
7
  "amber",
22
8
  "blue",
@@ -49,6 +35,27 @@ interface ThemeColorValues {
49
35
  elements: ElementThemeColorValues;
50
36
  relationships: RelationshipThemeColorValues;
51
37
  }
38
+ type NonEmptyArray<T> = [
39
+ T,
40
+ ...T[]
41
+ ];
42
+ type IconUrl = Tagged<string, "IconUrl"> | "none";
43
+ type Point = readonly [
44
+ x: number,
45
+ y: number
46
+ ];
47
+ interface XYPoint {
48
+ x: number;
49
+ y: number;
50
+ }
51
+ type AllNever<Expressions> = UnionToIntersection<{
52
+ [Name in keyof Expressions]: {
53
+ -readonly [Key in keyof Expressions[Name]]?: never;
54
+ };
55
+ }[keyof Expressions]>;
56
+ type ExclusiveUnion<Expressions> = Expressions extends object ? {
57
+ [Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
58
+ }[keyof Expressions] : Expressions;
52
59
  type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
53
60
  declare const BorderStyles: readonly [
54
61
  "solid",
@@ -86,35 +93,6 @@ interface Link {
86
93
  readonly url: string;
87
94
  readonly relative?: string;
88
95
  }
89
- interface TypedElement<Ids extends string, Kinds extends string, Tags extends string, MetadataKeys extends string = never> {
90
- readonly id: Fqn<Ids>;
91
- readonly kind: ElementKind<Kinds>;
92
- readonly title: string;
93
- readonly description: string | null;
94
- readonly technology: string | null;
95
- readonly tags: NonEmptyArray<Tag<Tags>> | null;
96
- readonly links: NonEmptyArray<Link> | null;
97
- readonly icon?: IconUrl;
98
- readonly shape?: ElementShape;
99
- readonly color?: Color;
100
- readonly style?: ElementStyle;
101
- readonly notation?: string;
102
- readonly metadata?: Record<MetadataKeys, string>;
103
- }
104
- interface Element$1 extends TypedElement<string, string, string, string> {
105
- }
106
- interface ElementKindSpecificationStyle {
107
- shape?: ElementShape;
108
- icon?: IconUrl;
109
- color?: Color;
110
- border?: BorderStyle;
111
- opacity?: number;
112
- }
113
- interface ElementKindSpecification {
114
- readonly technology?: string;
115
- readonly notation?: string;
116
- readonly style: ElementKindSpecificationStyle;
117
- }
118
96
  type EqualOperator<V> = {
119
97
  eq: V;
120
98
  neq?: never;
@@ -122,26 +100,26 @@ type EqualOperator<V> = {
122
100
  eq?: never;
123
101
  neq: V;
124
102
  };
125
- type AllNever = {
103
+ type AllNever$1 = {
126
104
  not?: never;
127
105
  and?: never;
128
106
  or?: never;
129
107
  tag?: never;
130
108
  kind?: never;
131
109
  };
132
- type TagEqual<Tag> = Omit<AllNever, "tag"> & {
110
+ type TagEqual<Tag> = Omit<AllNever$1, "tag"> & {
133
111
  tag: EqualOperator<Tag>;
134
112
  };
135
- type KindEqual<Kind> = Omit<AllNever, "kind"> & {
113
+ type KindEqual<Kind> = Omit<AllNever$1, "kind"> & {
136
114
  kind: EqualOperator<Kind>;
137
115
  };
138
- type NotOperator<Tag, Kind> = Omit<AllNever, "not"> & {
116
+ type NotOperator<Tag, Kind> = Omit<AllNever$1, "not"> & {
139
117
  not: WhereOperator<Tag, Kind>;
140
118
  };
141
- type AndOperator<Tag, Kind> = Omit<AllNever, "and"> & {
119
+ type AndOperator<Tag, Kind> = Omit<AllNever$1, "and"> & {
142
120
  and: NonEmptyArray<WhereOperator<Tag, Kind>>;
143
121
  };
144
- type OrOperator<Tag, Kind> = Omit<AllNever, "or"> & {
122
+ type OrOperator<Tag, Kind> = Omit<AllNever$1, "or"> & {
145
123
  or: NonEmptyArray<WhereOperator<Tag, Kind>>;
146
124
  };
147
125
  type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
@@ -197,7 +175,8 @@ interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
197
175
  elementTag: Tag;
198
176
  isEqual: boolean;
199
177
  }
200
- type ElementExpression = ElementRefExpr | WildcardExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
178
+ type NonWilcard = ElementRefExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
179
+ type ElementExpression = NonWilcard | WildcardExpr;
201
180
  interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
202
181
  where: {
203
182
  expr: ElementExpression;
@@ -205,7 +184,7 @@ interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
205
184
  };
206
185
  }
207
186
  type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
208
- interface RelationExpr extends Omit<BaseExpr, "source" | "target"> {
187
+ interface DirectRelationExpr extends Omit<BaseExpr, "source" | "target"> {
209
188
  source: ElementExpression;
210
189
  target: ElementExpression;
211
190
  isBidirectional?: boolean;
@@ -219,7 +198,7 @@ interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
219
198
  interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
220
199
  outgoing: ElementExpression;
221
200
  }
222
- type RelationExpression = RelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
201
+ type RelationExpression = DirectRelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
223
202
  interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
224
203
  where: {
225
204
  expr: RelationExpression;
@@ -243,16 +222,113 @@ interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
243
222
  }
244
223
  type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
245
224
  type Expression = ElementPredicateExpression | RelationPredicateExpression;
225
+ declare namespace FqnRef {
226
+ /**
227
+ * Represents a reference to an instance within a deployment.
228
+ *
229
+ * @template D - The type representing the deployment fqn. Defaults to `Fqn`.
230
+ * @template M - The type representing the model fqn. Defaults to `Fqn`.
231
+ *
232
+ * @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
233
+ * @property {M} element - The element reference within the deployment.
234
+ */
235
+ type InsideInstanceRef<D = Fqn, M = Fqn> = {
236
+ deployment: D;
237
+ element: M;
238
+ };
239
+ const isInsideInstanceRef: (ref: FqnRef) => ref is InsideInstanceRef;
240
+ /**
241
+ * Represents a reference to a deployment element.
242
+ *
243
+ * @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
244
+ * @property {F} deployment - The fully qualified name (FQN) of the deployment element.
245
+ */
246
+ type DeploymentElementRef<F = Fqn> = {
247
+ deployment: F;
248
+ };
249
+ const isDeploymentElementRef: (ref: FqnRef) => ref is DeploymentElementRef;
250
+ type DeploymentRef<D = Fqn, M = Fqn> = DeploymentElementRef<D> | InsideInstanceRef<D, M>;
251
+ const isDeploymentRef: (ref: FqnRef) => ref is DeploymentRef;
252
+ /**
253
+ * Reference to logical model element
254
+ */
255
+ type ModelRef<F = Fqn> = {
256
+ model: F;
257
+ };
258
+ const isModelRef: (ref: FqnRef) => ref is ModelRef;
259
+ const toDeploymentRef: (ref: FqnRef) => DeploymentRef;
260
+ }
261
+ type FqnRef<D = Fqn, M = Fqn> = ExclusiveUnion<{
262
+ InsideInstanceRef: FqnRef.InsideInstanceRef<D, M>;
263
+ DeploymentRef: FqnRef.DeploymentRef<D>;
264
+ ModelRef: FqnRef.ModelRef<M>;
265
+ }>;
266
+ declare namespace FqnExpr {
267
+ type Wildcard = {
268
+ wildcard: true;
269
+ };
270
+ const isWildcard: (expr: ExpressionV2) => expr is Wildcard;
271
+ type ModelRef<M = Fqn> = {
272
+ ref: FqnRef.ModelRef<M>;
273
+ selector?: PredicateSelector;
274
+ };
275
+ const isModelRef: (ref: ExpressionV2) => ref is ModelRef;
276
+ type DeploymentRef<D = Fqn, M = Fqn> = {
277
+ ref: FqnRef.DeploymentRef<D> | FqnRef.InsideInstanceRef<D, M>;
278
+ selector?: PredicateSelector;
279
+ };
280
+ const isDeploymentRef: (ref: ExpressionV2) => ref is FqnExpr.DeploymentRef;
281
+ type NonWildcard<D = Fqn, M = Fqn> = ExclusiveUnion<{
282
+ ModelRef: ModelRef<M>;
283
+ DeploymentRef: DeploymentRef<D, M>;
284
+ }>;
285
+ }
286
+ type FqnExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
287
+ Wildcard: FqnExpr.Wildcard;
288
+ ModelRef: FqnExpr.ModelRef<M>;
289
+ DeploymentRef: FqnExpr.DeploymentRef<D, M>;
290
+ }>;
291
+ declare namespace RelationExpr {
292
+ type Direct<D = Fqn, M = Fqn> = {
293
+ source: FqnExpr<D, M>;
294
+ target: FqnExpr<D, M>;
295
+ isBidirectional?: boolean;
296
+ };
297
+ const isDirect: (expr: ExpressionV2) => expr is Direct;
298
+ type Incoming<D = Fqn, M = Fqn> = {
299
+ incoming: FqnExpr<D, M>;
300
+ };
301
+ const isIncoming: (expr: ExpressionV2) => expr is Incoming;
302
+ type Outgoing<D = Fqn, M = Fqn> = {
303
+ outgoing: FqnExpr<D, M>;
304
+ };
305
+ const isOutgoing: (expr: ExpressionV2) => expr is Outgoing;
306
+ type InOut<D = Fqn, M = Fqn> = {
307
+ inout: FqnExpr<D, M>;
308
+ };
309
+ const isInOut: (expr: ExpressionV2) => expr is InOut;
310
+ }
311
+ type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
312
+ Direct: RelationExpr.Direct<D, M>;
313
+ Incoming: RelationExpr.Incoming<D, M>;
314
+ Outgoing: RelationExpr.Outgoing<D, M>;
315
+ InOut: RelationExpr.InOut<D, M>;
316
+ }>;
317
+ type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
318
+ Wildcard: FqnExpr.Wildcard;
319
+ ModelRef: FqnExpr.ModelRef<M>;
320
+ DeploymentRef: FqnExpr.DeploymentRef<D, M>;
321
+ Direct: RelationExpr.Direct<D, M>;
322
+ Incoming: RelationExpr.Incoming<D, M>;
323
+ Outgoing: RelationExpr.Outgoing<D, M>;
324
+ InOut: RelationExpr.InOut<D, M>;
325
+ }>;
326
+ declare namespace ExpressionV2 {
327
+ const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr;
328
+ const isRelation: (expr: ExpressionV2) => expr is RelationExpr;
329
+ }
246
330
  type GlobalPredicateId = Tagged<string, "GlobalPredicateId">;
247
- type GlobalPredicates = NonEmptyArray<ViewRulePredicate>;
248
- type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>;
249
331
  type GlobalStyleID = Tagged<string, "GlobalStyleID">;
250
- type GlobalStyles = NonEmptyTuple<ViewRuleStyle>;
251
- interface ModelGlobals {
252
- predicates: Record<GlobalPredicateId, GlobalPredicates>;
253
- dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>;
254
- styles: Record<GlobalStyleID, GlobalStyles>;
255
- }
256
332
  type ElementNotation = {
257
333
  kinds: string[];
258
334
  shape: ElementShape;
@@ -367,14 +443,14 @@ type CustomColorDefinitions = {
367
443
  [key: string]: ThemeColorValues;
368
444
  };
369
445
  type DeploymentViewRulePredicate = {
370
- include: DeploymentExpression[];
446
+ include: ExpressionV2[];
371
447
  exclude?: never;
372
448
  } | {
373
449
  include?: never;
374
- exclude: DeploymentExpression[];
450
+ exclude: ExpressionV2[];
375
451
  };
376
452
  type DeploymentViewRuleStyle = {
377
- targets: DeploymentExpression[];
453
+ targets: FqnExpr[];
378
454
  notation?: string;
379
455
  style: ElementStyle & {
380
456
  color?: Color;
@@ -387,11 +463,8 @@ interface DeploymentView<ViewIDs extends string = string, Tags extends string =
387
463
  readonly __: "deployment";
388
464
  readonly rules: DeploymentViewRule[];
389
465
  }
390
- type LikeC4View<ViewIDs extends string = string, Tags extends string = string> = ElementView<ViewIDs, Tags> | DynamicView<ViewIDs, Tags> | DeploymentView<ViewIDs, Tags>;
391
466
  type NodeId<IDs extends string = string> = Tagged<IDs, "Fqn">;
392
467
  type EdgeId = Tagged<string, "EdgeId">;
393
- type StepEdgeIdLiteral = `step-${number}` | `step-${number}.${number}`;
394
- type StepEdgeId = Tagged<StepEdgeIdLiteral, "EdgeId">;
395
468
  interface ComputedNode {
396
469
  id: NodeId;
397
470
  kind: string;
@@ -574,199 +647,7 @@ type RelationId = Tagged<string, "RelationID">;
574
647
  type RelationshipKind<Kinds extends string = string> = Tagged<Kinds, "RelationshipKind">;
575
648
  type RelationshipLineType = "dashed" | "solid" | "dotted";
576
649
  type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
577
- interface Relation {
578
- readonly id: RelationId;
579
- readonly source: Fqn;
580
- readonly target: Fqn;
581
- readonly title: string;
582
- readonly description?: string;
583
- readonly technology?: string;
584
- readonly tags?: NonEmptyArray<Tag>;
585
- readonly kind?: RelationshipKind;
586
- readonly color?: Color;
587
- readonly line?: RelationshipLineType;
588
- readonly head?: RelationshipArrowType;
589
- readonly tail?: RelationshipArrowType;
590
- readonly links?: NonEmptyArray<Link>;
591
- readonly navigateTo?: ViewId;
592
- readonly metadata?: {
593
- [key: string]: string;
594
- };
595
- }
596
- interface RelationshipKindSpecification {
597
- readonly technology?: string;
598
- readonly notation?: string;
599
- readonly color?: Color;
600
- readonly line?: RelationshipLineType;
601
- readonly head?: RelationshipArrowType;
602
- readonly tail?: RelationshipArrowType;
603
- }
604
- type DeploymentNodeKind<Kinds extends string = string> = Tagged<Kinds, "DeploymentNodeKind">;
605
- type PhysicalElementStyle = ElementStyle & {
606
- readonly icon?: IconUrl;
607
- readonly shape?: ElementShape;
608
- readonly color?: Color;
609
- };
610
- interface DeploymentNodeKindSpecification {
611
- readonly technology?: string;
612
- readonly notation?: string;
613
- readonly style: PhysicalElementStyle;
614
- }
615
- interface DeploymentNode {
616
- readonly id: Fqn;
617
- readonly kind: DeploymentNodeKind;
618
- readonly title: string;
619
- readonly description?: string | null;
620
- readonly technology?: string | null;
621
- readonly tags?: NonEmptyArray<Tag> | null;
622
- readonly links?: NonEmptyArray<Link> | null;
623
- readonly style?: PhysicalElementStyle;
624
- readonly notation?: string;
625
- readonly metadata?: Record<string, string>;
626
- }
627
- interface DeployedInstance {
628
- /**
629
- * Format: `<DeploymentNode Fqn>.<Instance Id>`
630
- * i.e parent fqn is deployment target
631
- */
632
- readonly id: Fqn;
633
- readonly element: Fqn;
634
- readonly title?: string;
635
- readonly description?: string | null;
636
- readonly technology?: string | null;
637
- readonly tags?: NonEmptyArray<Tag> | null;
638
- readonly links?: NonEmptyArray<Link> | null;
639
- readonly style?: PhysicalElementStyle;
640
- readonly notation?: string;
641
- readonly metadata?: Record<string, string>;
642
- }
643
- type DeploymentElement = Simplify<MergeExclusive<DeploymentNode, DeployedInstance>>;
644
- declare namespace DeploymentElement {
645
- const isDeploymentNode: (el: DeploymentElement) => el is DeploymentNode;
646
- const isInstance: (el: DeploymentElement) => el is DeployedInstance;
647
- }
648
- interface DeploymentRef {
649
- readonly id: Fqn;
650
- readonly element?: Fqn;
651
- }
652
- interface DeploymentRelation {
653
- readonly id: RelationId;
654
- readonly source: DeploymentRef;
655
- readonly target: DeploymentRef;
656
- readonly title?: string;
657
- readonly tags?: NonEmptyArray<Tag> | null;
658
- readonly description?: string;
659
- readonly technology?: string;
660
- readonly kind?: RelationshipKind;
661
- readonly color?: Color;
662
- readonly line?: RelationshipLineType;
663
- readonly head?: RelationshipArrowType;
664
- readonly tail?: RelationshipArrowType;
665
- readonly links?: NonEmptyArray<Link> | null;
666
- readonly navigateTo?: ViewId;
667
- readonly metadata?: {
668
- [key: string]: string;
669
- };
670
- }
671
- type AllNever$1<Expressions> = UnionToIntersection<{
672
- [Name in keyof Expressions]: {
673
- -readonly [Key in keyof Expressions[Name]]?: never;
674
- };
675
- }[keyof Expressions]>;
676
- type ExclusiveUnion<Expressions> = Expressions extends object ? {
677
- [Name in keyof Expressions]: Simplify<Omit<AllNever$1<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
678
- }[keyof Expressions] : Expressions;
679
- declare namespace DeploymentRelationExpression {
680
- type Direct = {
681
- source: DeploymentElementExpression;
682
- target: DeploymentElementExpression;
683
- isBidirectional?: boolean;
684
- };
685
- const isDirect: (expr: DeploymentExpression) => expr is Direct;
686
- type Incoming = {
687
- incoming: DeploymentElementExpression;
688
- };
689
- const isIncoming: (expr: DeploymentExpression) => expr is Incoming;
690
- type Outgoing = {
691
- outgoing: DeploymentElementExpression;
692
- };
693
- const isOutgoing: (expr: DeploymentExpression) => expr is Outgoing;
694
- type InOut = {
695
- inout: DeploymentElementExpression;
696
- };
697
- const isInOut: (expr: DeploymentExpression) => expr is InOut;
698
- }
699
- type DeploymentRelationExpression = ExclusiveUnion<{
700
- Direct: DeploymentRelationExpression.Direct;
701
- Incoming: DeploymentRelationExpression.Incoming;
702
- Outgoing: DeploymentRelationExpression.Outgoing;
703
- InOut: DeploymentRelationExpression.InOut;
704
- }>;
705
- declare namespace DeploymentElementExpression {
706
- type Ref = {
707
- ref: DeploymentRef;
708
- selector?: "children" | "expanded" | "descendants";
709
- };
710
- const isRef: (expr: DeploymentExpression) => expr is Ref;
711
- type Wildcard = {
712
- wildcard: true;
713
- };
714
- const isWildcard: (expr: DeploymentExpression) => expr is Wildcard;
715
- }
716
- type DeploymentElementExpression = ExclusiveUnion<{
717
- DeploymentRef: DeploymentElementExpression.Ref;
718
- Wildcard: DeploymentElementExpression.Wildcard;
719
- }>;
720
- type DeploymentExpression = ExclusiveUnion<{
721
- Element: DeploymentElementExpression;
722
- Relation: DeploymentRelationExpression;
723
- }>;
724
- declare namespace DeploymentExpression {
725
- type Element = DeploymentElementExpression;
726
- type Relation = DeploymentRelationExpression;
727
- const isElement: (expr: DeploymentExpression) => expr is DeploymentElementExpression;
728
- const isRelation: (expr: DeploymentExpression) => expr is DeploymentRelationExpression;
729
- }
730
- interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds extends string = string, Tags extends string = string, Fqns extends string = string, Views extends string = string, DeploymentFqns extends string = string> {
731
- specification: {
732
- tags: Tag<Tags>[];
733
- elements: Record<ElementKinds, ElementKindSpecification>;
734
- deployments: Record<DeploymentNodeKind, DeploymentNodeKindSpecification>;
735
- relationships: Record<RelationKinds, RelationshipKindSpecification>;
736
- };
737
- elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
738
- relations: Record<RelationId, Relation>;
739
- globals: ModelGlobals;
740
- views: Record<Views, LikeC4View<Views, Tags>>;
741
- /**
742
- * Deployment Model.
743
- */
744
- deployments: {
745
- elements: Record<DeploymentFqns, DeploymentElement>;
746
- relations: Record<RelationId, DeploymentRelation>;
747
- };
748
- }
749
- type ParsedLikeC4ModelDump = {
750
- elements: {
751
- [kind: string]: object;
752
- };
753
- deployments: {
754
- elements: {
755
- [kind: string]: object;
756
- };
757
- };
758
- views: {
759
- [kind: string]: object;
760
- };
761
- };
762
- interface AnyLikeC4Model<Fqns extends string = string, DeploymentFqns extends string = string, Views extends string = string, Tags extends string = string, T = "computed" | "layouted"> extends Omit<ParsedLikeC4Model<string, string, Tags, Fqns, Views, DeploymentFqns>, "views"> {
763
- __?: T;
764
- views: Record<Views, ComputedView | DiagramView>;
765
- }
766
- interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns extends string = string, Views extends string = string, Tags extends string = string> extends Omit<AnyLikeC4Model<Fqns, DeploymentFqns, Views, Tags, "layouted">, "views"> {
767
- __: "layouted";
768
- views: Record<Views, DiagramView<Views, Tags>>;
769
- }
650
+ type PredicateSelector = "children" | "expanded" | "descendants";
770
651
  declare namespace ViewChange {
771
652
  interface ChangeElementStyle {
772
653
  op: "change-element-style";
@@ -792,632 +673,6 @@ declare namespace ViewChange {
792
673
  }
793
674
  }
794
675
  type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
795
- type IncomingFilter = "all" | "direct" | "to-descendants";
796
- type OutgoingFilter = "all" | "direct" | "from-descendants";
797
- type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
798
- type WithId<Id> = {
799
- id: Id;
800
- };
801
- type WithViews<Id extends string, ViewType> = {
802
- views: Record<Id, ViewType>;
803
- };
804
- interface Aux<Element extends string, Deployment extends string, Views extends string, ViewType> {
805
- Fqn: IsLiteral<Element> extends true ? Fqn<Element> : Fqn;
806
- Element: Element;
807
- ElementOrFqn: Element | WithId<this["Fqn"]>;
808
- DeploymentFqn: IsLiteral<Deployment> extends true ? Fqn<Deployment> : Fqn;
809
- Deployment: Deployment;
810
- DeploymentOrFqn: Deployment | WithId<this["DeploymentFqn"]>;
811
- ViewId: IsLiteral<Views> extends true ? ViewId<Views> : ViewId;
812
- ViewIdLiteral: Views;
813
- ViewType: ViewType;
814
- RelationId: RelationId;
815
- NodeId: NodeId;
816
- NodeIdLiteral: string;
817
- EdgeId: EdgeId;
818
- EdgeIdLiteral: string;
819
- NodeOrId: LiteralUnion<this["NodeIdLiteral"], string> | WithId<this["NodeId"]>;
820
- EdgeOrId: LiteralUnion<this["EdgeIdLiteral"], string> | WithId<this["EdgeId"]>;
821
- Model: Simplify<Omit<AnyLikeC4Model, "views"> & WithViews<this["ViewId"], ViewType>>;
822
- }
823
- type AnyAux = Aux<string, string, string, any>;
824
- declare namespace Aux {
825
- type FromModel<M> = M extends AnyLikeC4Model ? Aux<KeysOf<M["elements"]>, KeysOf<M["deployments"]["elements"]>, KeysOf<M["views"]>, M extends LayoutedLikeC4Model ? DiagramView<ViewId<KeysOf<M["views"]>>, string> : ComputedView<ViewId<KeysOf<M["views"]>>, string>> : never;
826
- type FromDump<M> = M extends ParsedLikeC4ModelDump ? Aux<KeysOf<M["elements"]>, KeysOf<M["deployments"]["elements"]>, KeysOf<M["views"]>, DiagramView<ViewId<KeysOf<M["views"]>>, string>> : never;
827
- }
828
- type RelationshipsIterator<M extends AnyAux> = IteratorLike<RelationshipModel<M>>;
829
- declare class RelationshipModel<M extends AnyAux> {
830
- readonly model: LikeC4Model<M>;
831
- readonly $relationship: Relation;
832
- readonly source: ElementModel<M>;
833
- readonly target: ElementModel<M>;
834
- /**
835
- * Common ancestor of the source and target elements.
836
- * Represents the boundary of the Relation.
837
- */
838
- readonly boundary: ElementModel<M> | null;
839
- constructor(model: LikeC4Model<M>, $relationship: Relation);
840
- get id(): M["RelationId"];
841
- get expression(): string;
842
- get title(): string | null;
843
- get technology(): string | null;
844
- get description(): string | null;
845
- get navigateTo(): LikeC4ViewModel<M> | null;
846
- get tags(): ReadonlyArray<Tag>;
847
- get links(): ReadonlyArray<Link>;
848
- /**
849
- * Iterate over all views that include this relationship.
850
- */
851
- views(): ViewsIterator<M>;
852
- }
853
- type ElementsIterator<M extends AnyAux> = IteratorLike<ElementModel<M>>;
854
- declare class ElementModel<M extends AnyAux> {
855
- readonly model: LikeC4Model<M>;
856
- readonly $element: Element$1;
857
- constructor(model: LikeC4Model<M>, $element: Element$1);
858
- get id(): M["Fqn"];
859
- get kind(): ElementKind;
860
- get shape(): ElementShape;
861
- get color(): ThemeColor;
862
- get tags(): ReadonlyArray<Tag>;
863
- get title(): string;
864
- get description(): string | null;
865
- get technology(): string | null;
866
- get links(): ReadonlyArray<Link>;
867
- get parent(): ElementModel<M> | null;
868
- get defaultView(): LikeC4ViewModel<M> | null;
869
- /**
870
- * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
871
- * (from closest to root)
872
- */
873
- ancestors(): ElementsIterator<M>;
874
- /**
875
- * Returns the common ancestor of this element and another element.
876
- */
877
- commonAncestor(another: ElementModel<M>): ElementModel<M> | null;
878
- children(): ReadonlySet<ElementModel<M>>;
879
- /**
880
- * Get all descendant elements (i.e. children, children’s children, etc.)
881
- */
882
- descendants(): ElementsIterator<M>;
883
- /**
884
- * Get all sibling (i.e. same parent)
885
- */
886
- siblings(): ElementsIterator<M>;
887
- /**
888
- * Resolve siblings of the element and its ancestors
889
- * (from closest to root)
890
- */
891
- ascendingSiblings(): ElementsIterator<M>;
892
- incoming(filter?: IncomingFilter): RelationshipsIterator<M>;
893
- incomers(filter?: IncomingFilter): ElementsIterator<M>;
894
- outgoing(filter?: OutgoingFilter): RelationshipsIterator<M>;
895
- outgoers(filter?: OutgoingFilter): ElementsIterator<M>;
896
- protected cachedOutgoing: Set<RelationshipModel<M>> | null;
897
- protected cachedIncoming: Set<RelationshipModel<M>> | null;
898
- get allOutgoing(): ReadonlySet<RelationshipModel<M>>;
899
- get allIncoming(): ReadonlySet<RelationshipModel<M>>;
900
- /**
901
- * Iterate over all views that include this element.
902
- */
903
- views(): ViewsIterator<M>;
904
- /**
905
- * Iterate over all views that scope this element.
906
- * It is possible that element is not included in the view.
907
- */
908
- scopedViews(): ViewsIterator<M>;
909
- /**
910
- * @returns true if the element is deployed
911
- */
912
- isDeployed(): boolean;
913
- deployments(): DeployedInstancesIterator<M>;
914
- }
915
- type NodesIterator<M extends AnyAux, V extends ComputedView | DiagramView> = IteratorLike<NodeModel<M, V>>;
916
- declare namespace NodeModel {
917
- interface WithParent<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
918
- parent: NodeModel<M, V>;
919
- }
920
- interface WithElement<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
921
- kind: ElementKind;
922
- element: ElementModel<M>;
923
- }
924
- interface WithDeploymentElement<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
925
- kind: DeploymentNodeKind;
926
- deployment: DeploymentElementModel<M>;
927
- }
928
- interface WithDeployedInstance<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
929
- kind: "instance";
930
- element: ElementModel<M>;
931
- deployment: DeployedInstanceModel<M>;
932
- }
933
- interface IsGroup<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
934
- kind: typeof ElementKind.Group;
935
- element: null;
936
- deployment: null;
937
- }
938
- }
939
- declare class NodeModel<M extends AnyAux, V extends ComputedView | DiagramView = M["ViewType"]> {
940
- readonly $view: LikeC4ViewModel<M, V>;
941
- readonly $node: V["nodes"][number];
942
- constructor($view: LikeC4ViewModel<M, V>, $node: V["nodes"][number]);
943
- get id(): NodeId;
944
- get title(): string;
945
- get kind(): ElementKind | DeploymentNodeKind | typeof ElementKind.Group | "instance";
946
- get description(): string | null;
947
- get technology(): string | null;
948
- get parent(): NodeModel<M, V> | null;
949
- get element(): ElementModel<M> | null;
950
- get deployment(): DeploymentElementModel<M> | null;
951
- get shape(): ElementShape;
952
- get color(): Color;
953
- get tags(): ReadonlyArray<Tag>;
954
- get links(): ReadonlyArray<Link>;
955
- get navigateTo(): LikeC4ViewModel<M> | null;
956
- /**
957
- * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
958
- * (from closest to root)
959
- */
960
- ancestors(): NodesIterator<M, V>;
961
- children(): NodesIterator<M, V>;
962
- sublings(): NodesIterator<M, V>;
963
- incoming(filter?: IncomingFilter): EdgesIterator<M, V>;
964
- incomers(filter?: IncomingFilter): NodesIterator<M, V>;
965
- outgoing(filter?: OutgoingFilter): EdgesIterator<M, V>;
966
- outgoers(filter?: OutgoingFilter): NodesIterator<M, V>;
967
- isDiagramNode(): this is NodeModel<M, DiagramView>;
968
- hasChildren(): boolean;
969
- hasParent(): this is NodeModel.WithParent<M, V>;
970
- /**
971
- * Check if this node references to logical model element.
972
- */
973
- hasElement(): this is NodeModel.WithElement<M, V>;
974
- /**
975
- * Check if this node references to deployment element (Node or Instance).
976
- */
977
- hasDeployment(): this is NodeModel.WithDeploymentElement<M, V>;
978
- /**
979
- * Check if this node references to deployed instance
980
- * Deployed instance always references to element and deployment element.
981
- */
982
- hasDeployedInstance(): this is NodeModel.WithDeployedInstance<M, V>;
983
- isGroup(): this is NodeModel.IsGroup<M, V>;
984
- }
985
- type EdgesIterator<M extends AnyAux, V extends ComputedView | DiagramView> = IteratorLike<EdgeModel<M, V>>;
986
- declare class EdgeModel<M extends AnyAux, V extends ComputedView | DiagramView = M["ViewType"]> {
987
- readonly view: LikeC4ViewModel<M, V>;
988
- readonly $edge: V["edges"][number];
989
- readonly source: NodeModel<M, V>;
990
- readonly target: NodeModel<M, V>;
991
- constructor(view: LikeC4ViewModel<M, V>, $edge: V["edges"][number], source: NodeModel<M, V>, target: NodeModel<M, V>);
992
- get id(): M["EdgeId"];
993
- get parent(): NodeModel<M, V> | null;
994
- get label(): string | null;
995
- get description(): string | null;
996
- get technology(): string | null;
997
- hasParent(): this is EdgeModel$1.WithParent<M, V>;
998
- get tags(): ReadonlyArray<Tag>;
999
- get stepNumber(): number | null;
1000
- get navigateTo(): LikeC4ViewModel<M> | null;
1001
- isStep(): this is EdgeModel$1.StepEdge<M, ComputedDynamicView>;
1002
- relationships(type: "model"): IteratorLike<RelationshipModel<M>>;
1003
- relationships(type: "deployment"): IteratorLike<DeploymentRelationModel<M>>;
1004
- relationships(type?: "model" | "deployment"): IteratorLike<LikeC4Model.AnyRelation<M>>;
1005
- includesRelation(rel: M["RelationId"]): boolean;
1006
- }
1007
- declare namespace EdgeModel$1 {
1008
- interface StepEdge<M extends AnyAux, V extends ComputedView | DiagramView> extends EdgeModel<M, V> {
1009
- id: StepEdgeId;
1010
- stepNumber: number;
1011
- }
1012
- interface WithParent<M extends AnyAux, V extends ComputedView | DiagramView> extends EdgeModel<M, V> {
1013
- parent: NodeModel<M, V>;
1014
- }
1015
- }
1016
- type ViewsIterator<M extends AnyAux> = IteratorLike<LikeC4ViewModel<M>>;
1017
- declare class LikeC4ViewModel<M extends AnyAux, V extends ComputedView | DiagramView = M["ViewType"]> {
1018
- #private;
1019
- readonly $model: LikeC4Model<M>;
1020
- readonly $view: V;
1021
- constructor($model: LikeC4Model<M>, $view: V);
1022
- get __(): NonNullable<M["ViewType"]["__"]>;
1023
- get id(): M["ViewId"];
1024
- get title(): string | null;
1025
- get tags(): ReadonlyArray<Tag>;
1026
- get links(): ReadonlyArray<Link>;
1027
- get viewOf(): ElementModel<M> | null;
1028
- /**
1029
- * All tags from nodes and edges.
1030
- */
1031
- get includedTags(): ReadonlyArray<Tag>;
1032
- roots(): NodesIterator<M, V>;
1033
- /**
1034
- * Iterate over all nodes that have children.
1035
- */
1036
- compounds(): NodesIterator<M, V>;
1037
- /**
1038
- * Get node by id.
1039
- * @throws Error if node is not found.
1040
- */
1041
- node(node: M["NodeOrId"]): NodeModel<M, V>;
1042
- /**
1043
- * Find node by id.
1044
- */
1045
- findNode(node: M["NodeOrId"]): NodeModel<M, V> | null;
1046
- /**
1047
- * Iterate over all nodes.
1048
- */
1049
- nodes(): NodesIterator<M, V>;
1050
- /**
1051
- * Find edge by id.
1052
- * @param edge Edge or id
1053
- * @returns EdgeModel
1054
- */
1055
- edge(edge: M["EdgeOrId"]): EdgeModel<M, V>;
1056
- findEdge(edge: M["EdgeOrId"]): EdgeModel<M, V> | null;
1057
- /**
1058
- * Iterate over all edges.
1059
- */
1060
- edges(): EdgesIterator<M, V>;
1061
- /**
1062
- * Iterate over all edges.
1063
- */
1064
- edgesWithRelation(relation: M["RelationId"]): EdgesIterator<M, V>;
1065
- /**
1066
- * Nodes that have references to elements from logical model.
1067
- */
1068
- elements(): IteratorLike<NodeModel.WithElement<M, V>>;
1069
- includesElement(elementId: M["Element"]): boolean;
1070
- includesDeployment(deploymentId: M["Deployment"]): boolean;
1071
- includesRelation(relationId: M["RelationId"]): boolean;
1072
- /**
1073
- * Below are type guards.
1074
- */
1075
- isComputed(): this is LikeC4ViewModel<M, ComputedView>;
1076
- isDiagram(): this is LikeC4ViewModel<M, DiagramView>;
1077
- isElementView(): this is LikeC4ViewModel<M, ComputedElementView>;
1078
- isDeploymentView(): this is LikeC4ViewModel<M, ComputedDeploymentView>;
1079
- isDynamicView(): this is LikeC4ViewModel<M, ComputedDynamicView>;
1080
- }
1081
- declare class LikeC4DeploymentModel<M extends AnyAux = AnyAux> {
1082
- #private;
1083
- readonly $model: LikeC4Model<M>;
1084
- readonly $deployments: AnyLikeC4Model["deployments"];
1085
- constructor($model: LikeC4Model<M>, $deployments: AnyLikeC4Model["deployments"]);
1086
- element(el: M["DeploymentOrFqn"]): DeploymentElementModel<M>;
1087
- findElement(el: M["Deployment"]): DeploymentElementModel<M> | null;
1088
- node(el: M["DeploymentOrFqn"]): DeploymentNodeModel<M>;
1089
- findNode(el: M["Deployment"]): DeploymentNodeModel<M> | null;
1090
- instance(el: M["DeploymentOrFqn"]): DeployedInstanceModel<M>;
1091
- findInstance(el: M["Deployment"]): DeployedInstanceModel<M> | null;
1092
- /**
1093
- * Returns the root elements of the model.
1094
- */
1095
- roots(): DeploymentNodesIterator<M>;
1096
- /**
1097
- * Returns all elements in the model.
1098
- */
1099
- elements(): DeploymentElementsIterator<M>;
1100
- /**
1101
- * Returns all elements in the model.
1102
- */
1103
- nodes(): DeploymentNodesIterator<M>;
1104
- instances(): DeployedInstancesIterator<M>;
1105
- /**
1106
- * Iterate over all instances of the given logical element.
1107
- */
1108
- instancesOf(element: M["ElementOrFqn"]): DeployedInstancesIterator<M>;
1109
- deploymentRef(ref: DeploymentRef): DeploymentElementModel<M> | NestedElementOfDeployedInstanceModel<M>;
1110
- /**
1111
- * Returns all relationships in the model.
1112
- */
1113
- relationships(): IteratorLike<DeploymentRelationModel<M>>;
1114
- /**
1115
- * Returns a specific relationship by its ID.
1116
- */
1117
- relationship(id: M["RelationId"]): DeploymentRelationModel<M>;
1118
- findRelationship(id: LiteralUnion<M["RelationId"], string>): DeploymentRelationModel<M> | null;
1119
- /**
1120
- * Returns all deployment views in the model.
1121
- */
1122
- views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
1123
- /**
1124
- * Returns the parent element of given element.
1125
- * @see ancestors
1126
- */
1127
- parent(element: M["DeploymentOrFqn"]): DeploymentNodeModel<M> | null;
1128
- /**
1129
- * Get all children of the element (only direct children),
1130
- * @see descendants
1131
- */
1132
- children(element: M["DeploymentOrFqn"]): ReadonlySet<DeploymentElementModel<M>>;
1133
- /**
1134
- * Get all sibling (i.e. same parent)
1135
- */
1136
- siblings(element: M["DeploymentOrFqn"]): DeploymentElementsIterator<M>;
1137
- /**
1138
- * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
1139
- * (from closest to root)
1140
- */
1141
- ancestors(element: M["DeploymentOrFqn"]): DeploymentNodesIterator<M>;
1142
- /**
1143
- * Get all descendant elements (i.e. children, children’s children, etc.)
1144
- */
1145
- descendants(element: M["DeploymentOrFqn"]): DeploymentElementsIterator<M>;
1146
- /**
1147
- * Incoming relationships to the element and its descendants
1148
- * @see incomers
1149
- */
1150
- incoming(element: M["DeploymentOrFqn"], filter?: IncomingFilter): IteratorLike<DeploymentRelationModel<M>>;
1151
- /**
1152
- * Outgoing relationships from the element and its descendants
1153
- * @see outgoers
1154
- */
1155
- outgoing(element: M["DeploymentOrFqn"], filter?: OutgoingFilter): IteratorLike<DeploymentRelationModel<M>>;
1156
- private addElement;
1157
- private addRelation;
1158
- }
1159
- type DeploymentElementsIterator<M extends AnyAux> = IteratorLike<DeploymentElementModel<M>>;
1160
- type DeployedInstancesIterator<M extends AnyAux> = IteratorLike<DeployedInstanceModel<M>>;
1161
- type DeploymentNodesIterator<M extends AnyAux> = IteratorLike<DeploymentNodeModel<M>>;
1162
- declare abstract class DeploymentElementModel<M extends AnyAux = AnyAux> {
1163
- abstract readonly $model: LikeC4DeploymentModel<M>;
1164
- abstract readonly $node: DeploymentNode | DeployedInstance;
1165
- get id(): M["DeploymentFqn"];
1166
- get style(): SetRequired<PhysicalElementStyle, "shape" | "color">;
1167
- get shape(): ElementShape;
1168
- get color(): ThemeColor;
1169
- get tags(): ReadonlyArray<Tag>;
1170
- get title(): string;
1171
- get description(): string | null;
1172
- get technology(): string | null;
1173
- get parent(): DeploymentNodeModel<M> | null;
1174
- get links(): ReadonlyArray<Link>;
1175
- /**
1176
- * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
1177
- * (from closest to root)
1178
- */
1179
- ancestors(): DeploymentNodesIterator<M>;
1180
- /**
1181
- * Returns the common ancestor of this element and another element.
1182
- */
1183
- commonAncestor(another: DeploymentElementModel<M>): DeploymentNodeModel<M> | null;
1184
- /**
1185
- * Get all sibling (i.e. same parent)
1186
- */
1187
- siblings(): DeploymentElementsIterator<M>;
1188
- /**
1189
- * Check if the element is a sibling of another element
1190
- */
1191
- isSibling(other: DeploymentElementModel<M>): boolean;
1192
- /**
1193
- * Resolve siblings of the element and its ancestors
1194
- * (from closest to root)
1195
- */
1196
- ascendingSiblings(): DeploymentElementsIterator<M>;
1197
- incoming(filter?: IncomingFilter): IteratorLike<DeploymentRelationModel<M>>;
1198
- outgoing(filter?: OutgoingFilter): IteratorLike<DeploymentRelationModel<M>>;
1199
- incomers(filter?: IncomingFilter): IteratorLike<DeploymentRelationEndpoint<M>>;
1200
- outgoers(filter?: OutgoingFilter): IteratorLike<DeploymentRelationEndpoint<M>>;
1201
- /**
1202
- * Iterate over all views that include this deployment element.
1203
- */
1204
- views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
1205
- isDeploymentNode(): this is DeploymentNodeModel<M>;
1206
- isInstance(): this is DeployedInstanceModel<M>;
1207
- abstract outgoingFromModel(): RelationshipsIterator<M>;
1208
- abstract incomingFromModel(): RelationshipsIterator<M>;
1209
- protected cachedOutgoing: RelationshipsAccum<M> | null;
1210
- protected cachedIncoming: RelationshipsAccum<M> | null;
1211
- get allOutgoing(): RelationshipsAccum<M>;
1212
- get allIncoming(): RelationshipsAccum<M>;
1213
- }
1214
- declare class DeploymentNodeModel<M extends AnyAux = AnyAux> extends DeploymentElementModel<M> {
1215
- readonly $model: LikeC4DeploymentModel<M>;
1216
- readonly $node: DeploymentNode;
1217
- constructor($model: LikeC4DeploymentModel<M>, $node: DeploymentNode);
1218
- get kind(): DeploymentNodeKind;
1219
- children(): ReadonlySet<DeploymentElementModel<M>>;
1220
- descendants(): DeploymentElementsIterator<M>;
1221
- isDeploymentNode(): this is DeploymentNodeModel<M>;
1222
- /**
1223
- * Iterate over all instances nested in this deployment node.
1224
- */
1225
- instances(): DeployedInstancesIterator<M>;
1226
- /**
1227
- * Returns deployed instance inside this deployment node
1228
- * if only there are no more instances
1229
- */
1230
- onlyOneInstance(): DeployedInstanceModel<M> | null;
1231
- /**
1232
- * Cached result of relationships from instances
1233
- */
1234
- private _relationshipsFromInstances;
1235
- private relationshipsFromInstances;
1236
- /**
1237
- * We return only relationships that are not already present in nested instances
1238
- */
1239
- outgoingFromModel(): RelationshipsIterator<M>;
1240
- /**
1241
- * We return only relationships that are not already present in nested instances
1242
- */
1243
- incomingFromModel(): RelationshipsIterator<M>;
1244
- }
1245
- declare class DeployedInstanceModel<M extends AnyAux = AnyAux> extends DeploymentElementModel<M> {
1246
- readonly $model: LikeC4DeploymentModel<M>;
1247
- readonly $instance: DeployedInstance;
1248
- readonly $element: ElementModel<M>;
1249
- constructor($model: LikeC4DeploymentModel<M>, $instance: DeployedInstance, $element: ElementModel<M>);
1250
- get parent(): DeploymentNodeModel<M>;
1251
- get $node(): DeployedInstance;
1252
- get style(): SetRequired<PhysicalElementStyle, "shape" | "color">;
1253
- get shape(): ElementShape;
1254
- get color(): ThemeColor;
1255
- get tags(): ReadonlyArray<Tag>;
1256
- get title(): string;
1257
- get description(): string | null;
1258
- get technology(): string | null;
1259
- get links(): ReadonlyArray<Link>;
1260
- isInstance(): this is DeployedInstanceModel<M>;
1261
- outgoingFromModel(): RelationshipsIterator<M>;
1262
- incomingFromModel(): RelationshipsIterator<M>;
1263
- }
1264
- declare class NestedElementOfDeployedInstanceModel<M extends AnyAux> {
1265
- readonly instance: DeployedInstanceModel<M>;
1266
- readonly element: ElementModel<M>;
1267
- constructor(instance: DeployedInstanceModel<M>, element: ElementModel<M>);
1268
- get id(): M["DeploymentFqn"];
1269
- get style(): SetRequired<PhysicalElementStyle, "shape" | "color">;
1270
- get shape(): ElementShape;
1271
- get color(): ThemeColor;
1272
- get title(): string;
1273
- get description(): string | null;
1274
- get technology(): string | null;
1275
- isDeploymentNode(): this is DeploymentNodeModel<M>;
1276
- isInstance(): this is DeployedInstanceModel<M>;
1277
- }
1278
- type DeploymentRelationEndpoint<M extends AnyAux> = DeploymentElementModel<M> | NestedElementOfDeployedInstanceModel<M>;
1279
- declare class DeploymentRelationModel<M extends AnyAux> {
1280
- readonly $model: LikeC4DeploymentModel<M>;
1281
- readonly $relationship: DeploymentRelation;
1282
- boundary: DeploymentNodeModel<M> | null;
1283
- source: DeploymentRelationEndpoint<M>;
1284
- target: DeploymentRelationEndpoint<M>;
1285
- constructor($model: LikeC4DeploymentModel<M>, $relationship: DeploymentRelation);
1286
- get id(): M["RelationId"];
1287
- get expression(): string;
1288
- get title(): string | null;
1289
- get technology(): string | null;
1290
- get description(): string | null;
1291
- get tags(): ReadonlyArray<Tag>;
1292
- get navigateTo(): LikeC4ViewModel<M> | null;
1293
- get links(): ReadonlyArray<Link>;
1294
- views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
1295
- }
1296
- declare class RelationshipsAccum<M extends AnyAux> {
1297
- readonly model: ReadonlySet<RelationshipModel<M>>;
1298
- readonly deployment: ReadonlySet<DeploymentRelationModel<M>>;
1299
- /**
1300
- * @param model relationships from logical model
1301
- * @param deployment relationships from deployment model
1302
- */
1303
- constructor(model: ReadonlySet<RelationshipModel<M>>, deployment: ReadonlySet<DeploymentRelationModel<M>>);
1304
- get isEmpty(): boolean;
1305
- get nonEmpty(): boolean;
1306
- get size(): number;
1307
- /**
1308
- * Returns new Accum containing all the elements which are both in this and otherAccum
1309
- */
1310
- intersect(otherAccum: RelationshipsAccum<M>): RelationshipsAccum<M>;
1311
- /**
1312
- * Returns new Accum containing all the elements which are both in this and otherAccum
1313
- */
1314
- difference(otherAccum: RelationshipsAccum<M>): RelationshipsAccum<M>;
1315
- /**
1316
- * Returns new Accum containing all the elements from both
1317
- */
1318
- union(otherAccum: RelationshipsAccum<M>): RelationshipsAccum<M>;
1319
- }
1320
- export declare class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
1321
- #private;
1322
- readonly $model: M["Model"];
1323
- /**
1324
- * Only available in compile time
1325
- */
1326
- readonly Aux: M;
1327
- readonly deployment: LikeC4DeploymentModel<M>;
1328
- static create<const M extends AnyLikeC4Model>(model: M): LikeC4Model<Aux.FromModel<M>>;
1329
- /**
1330
- * This method is supposed to be used only in dumps
1331
- */
1332
- static fromDump<const M extends ParsedLikeC4ModelDump>(dump: M): LikeC4Model<Aux.FromDump<M>>;
1333
- private constructor();
1334
- get type(): "computed" | "layouted";
1335
- element(el: M["ElementOrFqn"]): ElementModel<M>;
1336
- findElement(el: LiteralUnion<M["Element"], string>): ElementModel<M> | null;
1337
- /**
1338
- * Returns the root elements of the model.
1339
- */
1340
- roots(): ElementsIterator<M>;
1341
- /**
1342
- * Returns all elements in the model.
1343
- */
1344
- elements(): ElementsIterator<M>;
1345
- /**
1346
- * Returns all relationships in the model.
1347
- */
1348
- relationships(): RelationshipsIterator<M>;
1349
- /**
1350
- * Returns a specific relationship by its ID.
1351
- * If the relationship is not found in the model, it will be searched in the deployment model.
1352
- * Search can be limited to the model or deployment model only.
1353
- */
1354
- relationship(id: M["RelationId"], type: "model"): RelationshipModel<M>;
1355
- relationship(id: M["RelationId"], type: "deployment"): DeploymentRelationModel<M>;
1356
- relationship(id: M["RelationId"], type?: "model" | "deployment"): RelationshipModel<M> | DeploymentRelationModel<M>;
1357
- findRelationship(id: LiteralUnion<M["RelationId"], string>, type: "model"): RelationshipModel<M> | null;
1358
- findRelationship(id: LiteralUnion<M["RelationId"], string>, type: "deployment"): DeploymentRelationModel<M> | null;
1359
- findRelationship(id: LiteralUnion<M["RelationId"], string>, type?: "model" | "deployment"): RelationshipModel<M> | DeploymentRelationModel<M> | null;
1360
- /**
1361
- * Returns all views in the model.
1362
- */
1363
- views(): MapIterator<LikeC4ViewModel<M, M["ViewType"]>>;
1364
- /**
1365
- * Returns a specific view by its ID.
1366
- */
1367
- view(viewId: M["ViewIdLiteral"]): LikeC4ViewModel<M>;
1368
- findView(viewId: LiteralUnion<M["ViewId"], string>): LikeC4ViewModel<M>;
1369
- /**
1370
- * Returns the parent element of given element.
1371
- * @see ancestors
1372
- */
1373
- parent(element: M["ElementOrFqn"]): ElementModel<M> | null;
1374
- /**
1375
- * Get all children of the element (only direct children),
1376
- * @see descendants
1377
- */
1378
- children(element: M["ElementOrFqn"]): ReadonlySet<ElementModel<M>>;
1379
- /**
1380
- * Get all sibling (i.e. same parent)
1381
- */
1382
- siblings(element: M["ElementOrFqn"]): ElementsIterator<M>;
1383
- /**
1384
- * Get all ancestor elements (i.e. parent, parent’s parent, etc.)
1385
- * (from closest to root)
1386
- */
1387
- ancestors(element: M["ElementOrFqn"]): ElementsIterator<M>;
1388
- /**
1389
- * Get all descendant elements (i.e. children, children’s children, etc.)
1390
- */
1391
- descendants(element: M["ElementOrFqn"]): ElementsIterator<M>;
1392
- /**
1393
- * Incoming relationships to the element and its descendants
1394
- * @see incomers
1395
- */
1396
- incoming(element: M["ElementOrFqn"], filter?: IncomingFilter): RelationshipsIterator<M>;
1397
- /**
1398
- * Outgoing relationships from the element and its descendants
1399
- * @see outgoers
1400
- */
1401
- outgoing(element: M["ElementOrFqn"], filter?: OutgoingFilter): RelationshipsIterator<M>;
1402
- private addElement;
1403
- private addRelation;
1404
- }
1405
- export declare namespace LikeC4Model {
1406
- type Any = Aux<string, string, string, ComputedView | DiagramView>;
1407
- type Element<M extends AnyAux = Any> = ElementModel<M>;
1408
- type Relation<M extends AnyAux = Any> = RelationshipModel<M>;
1409
- type AnyRelation<M extends AnyAux = Any> = RelationshipModel<M> | DeploymentRelationModel<M>;
1410
- type View<M extends AnyAux = Any, V extends ComputedView | DiagramView = M["ViewType"]> = LikeC4ViewModel<M, V>;
1411
- type Node<M extends AnyAux = Any, V extends ComputedView | DiagramView = M["ViewType"]> = NodeModel<M, V>;
1412
- type Edge<M extends AnyAux = Any, V extends ComputedView | DiagramView = M["ViewType"]> = EdgeModel<M, V>;
1413
- type DeploymentModel<M extends AnyAux = AnyAux> = LikeC4DeploymentModel<M>;
1414
- type Deployment<M extends AnyAux = AnyAux> = DeploymentElementModel<M>;
1415
- type DeploymentNode<M extends AnyAux = AnyAux> = DeploymentNodeModel<M>;
1416
- type DeployedInstance<M extends AnyAux = AnyAux> = DeployedInstanceModel<M>;
1417
- type Typed<Elements extends string = string, Deployments extends string = string, Views extends string = string, ViewType = DiagramView<Views> | ComputedView<Views>> = Aux<Elements, Deployments, Views, ViewType>;
1418
- type Computed<Elements extends string = string, Deployments extends string = string, Views extends string = string> = LikeC4Model<Typed<Elements, Deployments, Views, ComputedView<Views>>>;
1419
- type Layouted<Elements extends string = string, Deployments extends string = string, Views extends string = string> = LikeC4Model<Typed<Elements, Deployments, Views, DiagramView<Views>>>;
1420
- }
1421
676
  interface VariantColorsResolverInput {
1422
677
  color: MantineColor | undefined;
1423
678
  theme: MantineTheme;
@@ -1590,7 +845,7 @@ type MantineThemeColors = MantineThemeColorsOverride extends {
1590
845
  colors: Record<infer CustomColors, MantineColorsTuple>;
1591
846
  } ? Record<CustomColors, MantineColorsTuple> : Record<DefaultMantineColor, MantineColorsTuple>;
1592
847
  type MantineColor = keyof MantineThemeColors;
1593
- export type ViewData<Views extends string> = DiagramView<Views, string>;
848
+ export type ViewData<Views extends string, Tag extends string = string> = DiagramView<Views, Tag>;
1594
849
  type ElementIconRendererProps = {
1595
850
  node: {
1596
851
  id: string;
@@ -1726,7 +981,7 @@ export type LikeC4BrowserProps<ViewId extends string, Tag extends string, Kind e
1726
981
  */
1727
982
  enableRelationshipDetails?: boolean | undefined;
1728
983
  };
1729
- export declare function LikeC4Browser<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, colorScheme, view, injectFontCss, onNavigateTo, onClose, renderIcon, where, style, mantineTheme, background, styleNonce, enableElementDetails, enableRelationshipBrowser, enableRelationshipDetails }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
984
+ export declare function LikeC4Browser<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, colorScheme, view, injectFontCss, onNavigateTo, onClose, renderIcon, where, style, mantineTheme, background, styleNonce, enableElementDetails, enableRelationshipBrowser, enableRelationshipDetails, }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1730
985
  export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDivElement>, "style" | "className"> & {
1731
986
  view: ViewData<ViewId>;
1732
987
  /**
@@ -1793,7 +1048,7 @@ export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, K
1793
1048
  */
1794
1049
  enableRelationshipDetails?: boolean | undefined;
1795
1050
  };
1796
- export declare function LikeC4ViewEmbedded<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ onNavigateTo: _onNavigateTo, className, view, injectFontCss, colorScheme, background, renderIcon, showDiagramTitle, showNavigationButtons, enableFocusMode, showNotations, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, mantineTheme, where, style, styleNonce }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1051
+ export declare function LikeC4ViewEmbedded<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ onNavigateTo: _onNavigateTo, className, view, injectFontCss, colorScheme, background, renderIcon, showDiagramTitle, showNavigationButtons, enableFocusMode, showNotations, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, mantineTheme, where, style, styleNonce, }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1797
1052
  declare enum BackgroundVariant {
1798
1053
  Lines = "lines",
1799
1054
  Dots = "dots",
@@ -1994,29 +1249,6 @@ interface LikeC4DiagramEventHandlers {
1994
1249
  onOpenSource?: null | undefined | ((params: OpenSourceParams) => void);
1995
1250
  }
1996
1251
  type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
1997
- export declare function useLikeC4Model(): LikeC4Model | null;
1998
- export declare function useLikeC4Model(strict: true): LikeC4Model;
1999
- export declare function useLikeC4Model(strict: boolean): LikeC4Model | null;
2000
- export declare function useLikeC4Model(strict: true, type: "layouted"): LikeC4Model.Layouted;
2001
- export declare function useLikeC4Model(strict: true, type: "computed"): LikeC4Model.Computed;
2002
- export declare function useLikeC4Model(strict: true, type: "layouted" | "computed" | undefined): LikeC4Model;
2003
- export declare function useLikeC4Model(strict: boolean, type: "layouted"): LikeC4Model.Layouted | null;
2004
- export declare function useLikeC4Model(strict: boolean, type: "computed"): LikeC4Model.Computed | null;
2005
- export declare function useLikeC4Model(strict: boolean, type: "layouted" | "computed" | undefined): LikeC4Model | null;
2006
- export declare function useLikeC4Views(): Record<ViewId, ComputedView | DiagramView>;
2007
- export declare function useLikeC4ViewModel(viewId: LiteralUnion<ViewId, string>): LikeC4Model.View;
2008
- /**
2009
- * Parsed view, computed or layouted
2010
- */
2011
- export declare function useLikeC4View(viewId: LiteralUnion<ViewId, string>): ComputedView | DiagramView | null;
2012
- export declare function useLikeC4DiagramView(viewId: LiteralUnion<ViewId, string>): DiagramView | null;
2013
- type LikeC4ModelProviderProps = PropsWithChildren<{
2014
- likec4model: LikeC4Model;
2015
- }>;
2016
- /**
2017
- * Ensures LikeC4Model context
2018
- */
2019
- export declare function LikeC4ModelProvider({ children, likec4model }: LikeC4ModelProviderProps): import("react/jsx-runtime").JSX.Element;
2020
1252
  export type ReactLikeC4Props<ViewId extends string, Tag extends string, Kind extends string> = Omit<LikeC4DiagramProps, "view" | "where" | "onNavigateTo"> & {
2021
1253
  view: ViewData<ViewId>;
2022
1254
  /**
@@ -2280,6 +1512,7 @@ interface UseStoreOptions<SomeStore> {
2280
1512
  keys?: StoreKeys<SomeStore>[];
2281
1513
  }
2282
1514
  declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
1515
+ export declare const FontCss: string;
2283
1516
  export declare const DefaultTheme: MantineThemeOverride;
2284
1517
  export declare const BundledStyles: () => any;
2285
1518
  export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
@@ -2288,11 +1521,10 @@ export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
2288
1521
  export declare const ViewNotFound: ({ viewId }: {
2289
1522
  viewId: string;
2290
1523
  }) => import("react/jsx-runtime").JSX.Element;
2291
- /**
2292
- * We need this function to bundle LikeC4Model with `likec4/react'
2293
- * Used by vite plugin to generate `virtual:likec4/model`
2294
- */
2295
- export declare function createLikeC4Model(model: LayoutedLikeC4Model): LikeC4Model.Layouted;
1524
+ type LikeC4ModelProviderProps = PropsWithChildren<{
1525
+ likec4model: any;
1526
+ }>;
1527
+ export declare const LikeC4ModelProvider: (props: LikeC4ModelProviderProps) => JSX.Element;
2296
1528
 
2297
1529
  declare namespace nano {
2298
1530
  export { atom, computed, map, useStore };