likec4 1.12.2 → 1.13.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.ts CHANGED
@@ -1,8 +1,21 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import { CSSProperties, DependencyList, HTMLAttributes, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode } from 'react';
4
- import { LiteralUnion, OverrideProperties, PartialDeep, Tagged, UnwrapTagged } from 'type-fest';
4
+ import { Class, LiteralUnion, OverrideProperties, PartialDeep, Tagged, TupleToUnion } from 'type-fest';
5
5
 
6
+ type NonEmptyArray<T> = [
7
+ T,
8
+ ...T[]
9
+ ];
10
+ type IconUrl = Tagged<string, "IconUrl">;
11
+ type Point = readonly [
12
+ x: number,
13
+ y: number
14
+ ];
15
+ interface XYPoint {
16
+ x: number;
17
+ y: number;
18
+ }
6
19
  declare const ThemeColors: readonly [
7
20
  "amber",
8
21
  "blue",
@@ -35,28 +48,15 @@ interface ThemeColorValues {
35
48
  elements: ElementThemeColorValues;
36
49
  relationships: RelationshipThemeColorValues;
37
50
  }
38
- type NonEmptyArray<T> = [
39
- T,
40
- ...T[]
41
- ];
42
- type IconUrl = Tagged<string, "IconUrl">;
43
- type Point = readonly [
44
- x: number,
45
- y: number
46
- ];
47
- interface XYPoint {
48
- x: number;
49
- y: number;
50
- }
51
- type Fqn = Tagged<string, "Fqn">;
51
+ type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
52
52
  declare const BorderStyles: readonly [
53
53
  "solid",
54
54
  "dashed",
55
55
  "dotted",
56
56
  "none"
57
57
  ];
58
- type BorderStyle = typeof BorderStyles[number];
59
- type ElementKind = Tagged<string, "ElementKind">;
58
+ type BorderStyle = TupleToUnion<typeof BorderStyles>;
59
+ type ElementKind<Kinds extends string = string> = Tagged<Kinds, "ElementKind">;
60
60
  declare const ElementShapes: readonly [
61
61
  "rectangle",
62
62
  "person",
@@ -66,33 +66,33 @@ declare const ElementShapes: readonly [
66
66
  "storage",
67
67
  "queue"
68
68
  ];
69
- type ElementShape = typeof ElementShapes[number];
69
+ type ElementShape = TupleToUnion<typeof ElementShapes>;
70
70
  interface ElementStyle {
71
71
  border?: BorderStyle;
72
72
  opacity?: number;
73
73
  }
74
- type Tag = Tagged<string, "Tag">;
74
+ type Tag<Tags extends string = string> = Tagged<Tags, "Tag">;
75
75
  interface Link {
76
76
  readonly title?: string;
77
77
  readonly url: string;
78
78
  readonly relative?: string;
79
79
  }
80
- interface Element$1 {
81
- readonly id: Fqn;
82
- readonly kind: ElementKind;
80
+ interface TypedElement<Ids extends string, Kinds extends string, Tags extends string, MetadataKeys extends string = never> {
81
+ readonly id: Fqn<Ids>;
82
+ readonly kind: ElementKind<Kinds>;
83
83
  readonly title: string;
84
84
  readonly description: string | null;
85
85
  readonly technology: string | null;
86
- readonly tags: NonEmptyArray<Tag> | null;
86
+ readonly tags: NonEmptyArray<Tag<Tags>> | null;
87
87
  readonly links: NonEmptyArray<Link> | null;
88
88
  readonly icon?: IconUrl;
89
89
  readonly shape?: ElementShape;
90
90
  readonly color?: Color;
91
91
  readonly style?: ElementStyle;
92
92
  readonly notation?: string;
93
- readonly metadata?: {
94
- [key: string]: string;
95
- };
93
+ readonly metadata?: Record<MetadataKeys, string>;
94
+ }
95
+ interface Element$1 extends TypedElement<string, string, string, string> {
96
96
  }
97
97
  interface ElementKindSpecificationStyle {
98
98
  shape?: ElementShape;
@@ -136,140 +136,13 @@ type OrOperator<Tag, Kind> = Omit<AllNever, "or"> & {
136
136
  or: NonEmptyArray<WhereOperator<Tag, Kind>>;
137
137
  };
138
138
  type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
139
- type RelationID = Tagged<string, "RelationID">;
140
- type RelationshipKind = Tagged<string, "RelationshipKind">;
141
- type RelationshipLineType = "dashed" | "solid" | "dotted";
142
- type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
143
- interface Relation {
144
- readonly id: RelationID;
145
- readonly source: Fqn;
146
- readonly target: Fqn;
147
- readonly title: string;
148
- readonly description?: string;
149
- readonly technology?: string;
150
- readonly tags?: NonEmptyArray<Tag>;
151
- readonly kind?: RelationshipKind;
152
- readonly color?: Color;
153
- readonly line?: RelationshipLineType;
154
- readonly head?: RelationshipArrowType;
155
- readonly tail?: RelationshipArrowType;
156
- readonly links?: NonEmptyArray<Link>;
157
- readonly navigateTo?: ViewID;
158
- readonly metadata?: {
159
- [key: string]: string;
160
- };
161
- }
162
- interface RelationshipKindSpecification {
163
- readonly technology?: string;
164
- readonly notation?: string;
165
- readonly color?: Color;
166
- readonly line?: RelationshipLineType;
167
- readonly head?: RelationshipArrowType;
168
- readonly tail?: RelationshipArrowType;
169
- }
170
- interface BaseExpr {
171
- where?: never;
172
- element?: never;
173
- custom?: never;
174
- expanded?: never;
175
- elementKind?: never;
176
- elementTag?: never;
177
- isEqual?: never;
178
- isDescedants?: never;
179
- wildcard?: never;
180
- source?: never;
181
- target?: never;
182
- inout?: never;
183
- incoming?: never;
184
- outgoing?: never;
185
- customRelation?: never;
186
- }
187
- interface ElementRefExpr extends Omit<BaseExpr, "element" | "isDescedants"> {
188
- element: Fqn;
189
- isDescedants?: boolean;
190
- }
191
- interface ExpandedElementExpr extends Omit<BaseExpr, "expanded"> {
192
- expanded: Fqn;
193
- }
194
- interface CustomElementExpr extends Omit<BaseExpr, "custom"> {
195
- custom: {
196
- expr: ElementExpression | ElementWhereExpr;
197
- title?: string;
198
- description?: string;
199
- technology?: string;
200
- notation?: string;
201
- shape?: ElementShape;
202
- color?: Color;
203
- icon?: IconUrl;
204
- border?: BorderStyle;
205
- opacity?: number;
206
- navigateTo?: ViewID;
207
- };
208
- }
209
- interface WildcardExpr extends Omit<BaseExpr, "wildcard"> {
210
- wildcard: true;
211
- }
212
- interface ElementKindExpr extends Omit<BaseExpr, "elementKind" | "isEqual"> {
213
- elementKind: ElementKind;
214
- isEqual: boolean;
215
- }
216
- interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
217
- elementTag: Tag;
218
- isEqual: boolean;
219
- }
220
- type ElementExpression = ElementRefExpr | WildcardExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
221
- interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
222
- where: {
223
- expr: ElementExpression;
224
- condition: WhereOperator<string, string>;
225
- };
226
- }
227
- type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
228
- interface RelationExpr extends Omit<BaseExpr, "source" | "target"> {
229
- source: ElementExpression;
230
- target: ElementExpression;
231
- isBidirectional?: boolean;
232
- }
233
- interface InOutExpr extends Omit<BaseExpr, "inout"> {
234
- inout: ElementExpression;
235
- }
236
- interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
237
- incoming: ElementExpression;
238
- }
239
- interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
240
- outgoing: ElementExpression;
241
- }
242
- type RelationExpression = RelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
243
- interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
244
- where: {
245
- expr: RelationExpression;
246
- condition: WhereOperator<string, string>;
247
- };
248
- }
249
- interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
250
- customRelation: {
251
- relation: RelationExpression | RelationWhereExpr;
252
- title?: string;
253
- description?: string;
254
- technology?: string;
255
- notation?: string;
256
- navigateTo?: ViewID;
257
- notes?: string;
258
- color?: Color;
259
- line?: RelationshipLineType;
260
- head?: RelationshipArrowType;
261
- tail?: RelationshipArrowType;
262
- };
263
- }
264
- type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
265
- type Expression = ElementPredicateExpression | RelationPredicateExpression;
266
139
  type ElementNotation = {
267
140
  kinds: ElementKind[];
268
141
  shape: ElementShape;
269
142
  color: Color;
270
143
  title: string;
271
144
  };
272
- type ViewID = Tagged<string, "ViewID">;
145
+ type ViewID<Id extends string = string> = Tagged<Id, "ViewID">;
273
146
  type ViewRulePredicate = {
274
147
  include: Expression[];
275
148
  exclude?: never;
@@ -293,12 +166,12 @@ interface ViewRuleAutoLayout {
293
166
  rankSep?: number;
294
167
  }
295
168
  type ViewRule = ViewRulePredicate | ViewRuleStyle | ViewRuleAutoLayout;
296
- interface BasicView<ViewType extends "element" | "dynamic"> {
169
+ interface BasicView<ViewType extends "element" | "dynamic", ViewIDs extends string, Tags extends string> {
297
170
  readonly __?: ViewType;
298
- readonly id: ViewID;
171
+ readonly id: ViewID<ViewIDs>;
299
172
  readonly title: string | null;
300
173
  readonly description: string | null;
301
- readonly tags: NonEmptyArray<Tag> | null;
174
+ readonly tags: NonEmptyArray<Tag<Tags>> | null;
302
175
  readonly links: NonEmptyArray<Link> | null;
303
176
  /**
304
177
  * URI to the source file of this view.
@@ -320,17 +193,17 @@ interface BasicView<ViewType extends "element" | "dynamic"> {
320
193
  readonly manualLayout?: ViewManualLayout | undefined;
321
194
  readonly customColorDefinitions: CustomColorDefinitions;
322
195
  }
323
- interface BasicElementView extends BasicView<"element"> {
196
+ interface BasicElementView<ViewIDs extends string, Tags extends string> extends BasicView<"element", ViewIDs, Tags> {
324
197
  readonly viewOf?: Fqn;
325
198
  readonly rules: ViewRule[];
326
199
  }
327
- interface ScopedElementView extends BasicElementView {
200
+ interface ScopedElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
328
201
  readonly viewOf: Fqn;
329
202
  }
330
- interface ExtendsElementView extends BasicElementView {
331
- readonly extends: ViewID;
203
+ interface ExtendsElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
204
+ readonly extends: ViewID<ViewIDs>;
332
205
  }
333
- type ElementView = ScopedElementView | ExtendsElementView | BasicElementView;
206
+ type ElementView<ViewIDs extends string = string, Tags extends string = string> = ScopedElementView<ViewIDs, Tags> | ExtendsElementView<ViewIDs, Tags> | BasicElementView<ViewIDs, Tags>;
334
207
  interface DynamicViewStep {
335
208
  readonly source: Fqn;
336
209
  readonly target: Fqn;
@@ -355,7 +228,7 @@ type DynamicViewIncludeRule = {
355
228
  include: ElementPredicateExpression[];
356
229
  };
357
230
  type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleAutoLayout;
358
- interface DynamicView extends BasicView<"dynamic"> {
231
+ interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"dynamic", ViewIDs, Tags> {
359
232
  readonly __: "dynamic";
360
233
  readonly steps: DynamicViewStepOrParallel[];
361
234
  readonly rules: DynamicViewRule[];
@@ -363,8 +236,8 @@ interface DynamicView extends BasicView<"dynamic"> {
363
236
  type CustomColorDefinitions = {
364
237
  [key: string]: ThemeColorValues;
365
238
  };
366
- type LikeC4View = ElementView | DynamicView;
367
- type NodeId = Tagged<string, "Fqn">;
239
+ type LikeC4View<ViewIDs extends string = string, Tags extends string = string> = ElementView<ViewIDs, Tags> | DynamicView<ViewIDs, Tags>;
240
+ type NodeId<IDs extends string = string> = Tagged<IDs, "Fqn">;
368
241
  type EdgeId = Tagged<string, "EdgeId">;
369
242
  interface ComputedNode {
370
243
  id: NodeId;
@@ -442,15 +315,15 @@ interface ViewAutoLayout {
442
315
  rankSep?: number;
443
316
  nodeSep?: number;
444
317
  }
445
- interface ComputedElementView extends Omit<ElementView, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
446
- readonly extends?: ViewID;
318
+ interface ComputedElementView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ElementView<ViewIDs, Tags>, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
319
+ readonly extends?: ViewID<ViewIDs>;
447
320
  readonly autoLayout: ViewAutoLayout;
448
321
  readonly nodes: ComputedNode[];
449
322
  readonly edges: ComputedEdge[];
450
323
  rules?: never;
451
324
  docUri?: never;
452
325
  }
453
- interface ComputedDynamicView extends Omit<DynamicView, "rules" | "steps" | "docUri">, ViewWithHash, ViewWithNotation {
326
+ interface ComputedDynamicView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DynamicView<ViewIDs, Tags>, "rules" | "steps" | "docUri">, ViewWithHash, ViewWithNotation {
454
327
  readonly autoLayout: ViewAutoLayout;
455
328
  readonly nodes: ComputedNode[];
456
329
  readonly edges: ComputedEdge[];
@@ -458,7 +331,7 @@ interface ComputedDynamicView extends Omit<DynamicView, "rules" | "steps" | "doc
458
331
  rules?: never;
459
332
  docUri?: never;
460
333
  }
461
- type ComputedView = ComputedElementView | ComputedDynamicView;
334
+ type ComputedView<ViewIDs extends string = string, Tags extends string = string> = ComputedElementView<ViewIDs, Tags> | ComputedDynamicView<ViewIDs, Tags>;
462
335
  type BBox = {
463
336
  x: number;
464
337
  y: number;
@@ -477,7 +350,7 @@ interface DiagramEdge extends ComputedEdge {
477
350
  labelBBox?: BBox | null;
478
351
  dotpos?: string;
479
352
  }
480
- interface DiagramView extends Omit<ComputedView, "nodes" | "edges" | "manualLayout"> {
353
+ interface DiagramView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ComputedView<ViewIDs, Tags>, "nodes" | "edges" | "manualLayout"> {
481
354
  readonly nodes: DiagramNode[];
482
355
  readonly edges: DiagramEdge[];
483
356
  readonly bounds: BBox;
@@ -509,15 +382,142 @@ type ViewManualLayout = {
509
382
  labelBBox?: BBox;
510
383
  }>;
511
384
  };
512
- interface ParsedLikeC4Model {
385
+ type RelationID = Tagged<string, "RelationID">;
386
+ type RelationshipKind<Kinds extends string = string> = Tagged<Kinds, "RelationshipKind">;
387
+ type RelationshipLineType = "dashed" | "solid" | "dotted";
388
+ type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
389
+ interface Relation {
390
+ readonly id: RelationID;
391
+ readonly source: Fqn;
392
+ readonly target: Fqn;
393
+ readonly title: string;
394
+ readonly description?: string;
395
+ readonly technology?: string;
396
+ readonly tags?: NonEmptyArray<Tag>;
397
+ readonly kind?: RelationshipKind;
398
+ readonly color?: Color;
399
+ readonly line?: RelationshipLineType;
400
+ readonly head?: RelationshipArrowType;
401
+ readonly tail?: RelationshipArrowType;
402
+ readonly links?: NonEmptyArray<Link>;
403
+ readonly navigateTo?: ViewID;
404
+ readonly metadata?: {
405
+ [key: string]: string;
406
+ };
407
+ }
408
+ interface RelationshipKindSpecification {
409
+ readonly technology?: string;
410
+ readonly notation?: string;
411
+ readonly color?: Color;
412
+ readonly line?: RelationshipLineType;
413
+ readonly head?: RelationshipArrowType;
414
+ readonly tail?: RelationshipArrowType;
415
+ }
416
+ interface BaseExpr {
417
+ where?: never;
418
+ element?: never;
419
+ custom?: never;
420
+ expanded?: never;
421
+ elementKind?: never;
422
+ elementTag?: never;
423
+ isEqual?: never;
424
+ isDescedants?: never;
425
+ wildcard?: never;
426
+ source?: never;
427
+ target?: never;
428
+ inout?: never;
429
+ incoming?: never;
430
+ outgoing?: never;
431
+ customRelation?: never;
432
+ }
433
+ interface ElementRefExpr extends Omit<BaseExpr, "element" | "isDescedants"> {
434
+ element: Fqn;
435
+ isDescedants?: boolean;
436
+ }
437
+ interface ExpandedElementExpr extends Omit<BaseExpr, "expanded"> {
438
+ expanded: Fqn;
439
+ }
440
+ interface CustomElementExpr extends Omit<BaseExpr, "custom"> {
441
+ custom: {
442
+ expr: ElementExpression | ElementWhereExpr;
443
+ title?: string;
444
+ description?: string;
445
+ technology?: string;
446
+ notation?: string;
447
+ shape?: ElementShape;
448
+ color?: Color;
449
+ icon?: IconUrl;
450
+ border?: BorderStyle;
451
+ opacity?: number;
452
+ navigateTo?: ViewID;
453
+ };
454
+ }
455
+ interface WildcardExpr extends Omit<BaseExpr, "wildcard"> {
456
+ wildcard: true;
457
+ }
458
+ interface ElementKindExpr extends Omit<BaseExpr, "elementKind" | "isEqual"> {
459
+ elementKind: ElementKind;
460
+ isEqual: boolean;
461
+ }
462
+ interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
463
+ elementTag: Tag;
464
+ isEqual: boolean;
465
+ }
466
+ type ElementExpression = ElementRefExpr | WildcardExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
467
+ interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
468
+ where: {
469
+ expr: ElementExpression;
470
+ condition: WhereOperator<string, string>;
471
+ };
472
+ }
473
+ type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
474
+ interface RelationExpr extends Omit<BaseExpr, "source" | "target"> {
475
+ source: ElementExpression;
476
+ target: ElementExpression;
477
+ isBidirectional?: boolean;
478
+ }
479
+ interface InOutExpr extends Omit<BaseExpr, "inout"> {
480
+ inout: ElementExpression;
481
+ }
482
+ interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
483
+ incoming: ElementExpression;
484
+ }
485
+ interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
486
+ outgoing: ElementExpression;
487
+ }
488
+ type RelationExpression = RelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
489
+ interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
490
+ where: {
491
+ expr: RelationExpression;
492
+ condition: WhereOperator<string, string>;
493
+ };
494
+ }
495
+ interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
496
+ customRelation: {
497
+ relation: RelationExpression | RelationWhereExpr;
498
+ title?: string;
499
+ description?: string;
500
+ technology?: string;
501
+ notation?: string;
502
+ navigateTo?: ViewID;
503
+ notes?: string;
504
+ color?: Color;
505
+ line?: RelationshipLineType;
506
+ head?: RelationshipArrowType;
507
+ tail?: RelationshipArrowType;
508
+ };
509
+ }
510
+ type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
511
+ type Expression = ElementPredicateExpression | RelationPredicateExpression;
512
+ interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds extends string = string, Tags extends string = string, Fqns extends string = string, Views extends string = string> {
513
513
  specification: {
514
- tags: Tag[];
515
- elements: Record<UnwrapTagged<ElementKind>, ElementKindSpecification>;
516
- relationships: Record<UnwrapTagged<ElementKind>, RelationshipKindSpecification>;
514
+ tags: Tag<Tags>[];
515
+ elements: Record<ElementKinds, ElementKindSpecification>;
516
+ relationships: Record<RelationKinds, RelationshipKindSpecification>;
517
517
  };
518
- elements: Record<Fqn, Element$1>;
518
+ elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
519
519
  relations: Record<RelationID, Relation>;
520
- views: Record<ViewID, LikeC4View>;
520
+ views: Record<Views, LikeC4View<Views, Tags>>;
521
521
  }
522
522
  interface ComputedLikeC4Model extends Omit<ParsedLikeC4Model, "views"> {
523
523
  __?: never;
@@ -527,6 +527,31 @@ interface LayoutedLikeC4Model extends Omit<ParsedLikeC4Model, "views"> {
527
527
  __: "layouted";
528
528
  views: Record<ViewID, DiagramView>;
529
529
  }
530
+ declare namespace ViewChange {
531
+ interface ChangeElementStyle {
532
+ op: "change-element-style";
533
+ style: {
534
+ border?: BorderStyle;
535
+ opacity?: number;
536
+ shape?: ElementShape;
537
+ color?: ThemeColor;
538
+ };
539
+ targets: NonEmptyArray<Fqn>;
540
+ }
541
+ interface SaveManualLayout {
542
+ op: "save-manual-layout";
543
+ layout: ViewManualLayout;
544
+ }
545
+ interface ChangeAutoLayout {
546
+ op: "change-autolayout";
547
+ layout: {
548
+ direction: AutoLayoutDirection;
549
+ nodeSep?: number | null;
550
+ rankSep?: number | null;
551
+ };
552
+ }
553
+ }
554
+ type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
530
555
  type Fqn$1 = LiteralUnion<Fqn, string>;
531
556
  type RelationID$1 = LiteralUnion<RelationID, string>;
532
557
  type ViewID$1 = LiteralUnion<ViewID, string>;
@@ -539,11 +564,11 @@ type ElementOrFqn = Fqn$1 | {
539
564
  declare class LikeC4ViewModel {
540
565
  readonly view: ComputedView;
541
566
  readonly model: LikeC4Model<LikeC4ViewModel>;
542
- private _rootElements;
543
- private _elements;
544
- private _connections;
567
+ private readonly _rootElements;
568
+ private readonly _elements;
569
+ private readonly _connections;
545
570
  constructor(view: ComputedView, model: LikeC4Model<LikeC4ViewModel>);
546
- get id(): ViewID;
571
+ get id(): ViewID<string>;
547
572
  get title(): string;
548
573
  get viewOf(): LikeC4Model.ElementModel<LikeC4ViewModel>;
549
574
  get tags(): Tag[];
@@ -578,9 +603,9 @@ declare namespace LikeC4ViewModel {
578
603
  */
579
604
  class Element {
580
605
  readonly node: ComputedNode;
581
- private viewmodel;
606
+ private readonly viewmodel;
582
607
  constructor(node: ComputedNode, viewmodel: LikeC4ViewModel);
583
- get id(): NodeId;
608
+ get id(): NodeId<string>;
584
609
  get title(): string;
585
610
  get kind(): ElementKind;
586
611
  get isRoot(): boolean;
@@ -609,7 +634,7 @@ declare namespace LikeC4ViewModel {
609
634
  */
610
635
  class Connection {
611
636
  readonly edge: ComputedEdge;
612
- private viewmodel;
637
+ private readonly viewmodel;
613
638
  constructor(edge: ComputedEdge, viewmodel: LikeC4ViewModel);
614
639
  get id(): EdgeId;
615
640
  get source(): LikeC4ViewModel.Element;
@@ -635,10 +660,7 @@ export declare class LikeC4Model<M extends LikeC4Model.ViewModel = LikeC4Model.V
635
660
  private _internal;
636
661
  private _cacheAscendingSiblings;
637
662
  private _views;
638
- static create(source: LikeC4Model.SourceModel): PickBySource<typeof source>;
639
- static computed(source: ComputedLikeC4Model): LikeC4Model<LikeC4ViewModel>;
640
- static layouted(source: LayoutedLikeC4Model): LikeC4Model<LikeC4DiagramModel>;
641
- protected constructor(type: LikeC4Model.ModelType<M>, sourcemodel: LikeC4Model.SourceModel<M>, elements: Element$1[], relations: Relation[]);
663
+ constructor(type: LikeC4Model.ModelType<M>, sourcemodel: LikeC4Model.SourceModel<M>, elements: Element$1[], relations: Relation[], views: LikeC4Model.SourceModel<M>["views"], ViewModelClass: Class<M>);
642
664
  /**
643
665
  * Returns the root elements of the model.
644
666
  */
@@ -729,10 +751,14 @@ export declare class LikeC4Model<M extends LikeC4Model.ViewModel = LikeC4Model.V
729
751
  private _internalOf;
730
752
  }
731
753
  export declare namespace LikeC4Model {
754
+ function create(source: LikeC4Model.SourceModel): PickBySource<typeof source>;
755
+ function computed(source: ComputedLikeC4Model): LikeC4Model<LikeC4ViewModel>;
756
+ function layouted(source: LayoutedLikeC4Model): LikeC4Model<LikeC4DiagramModel>;
732
757
  function isModel(model: any): model is LikeC4Model;
733
758
  type SourceModel<M extends ViewModel = ViewModel> = M extends LikeC4DiagramModel ? LayoutedLikeC4Model : ComputedLikeC4Model;
734
759
  type ViewModel = LikeC4ViewModel | LikeC4DiagramModel;
735
760
  namespace ViewModel {
761
+ type ElementModel = LikeC4ViewModel.Element | LikeC4DiagramModel.Element;
736
762
  type Relationship = LikeC4Model.Relationship<ViewModel>;
737
763
  function isLayouted(model: ViewModel): model is LikeC4DiagramModel;
738
764
  }
@@ -748,13 +774,13 @@ export declare namespace LikeC4Model {
748
774
  }
749
775
  type ModelType<M extends ViewModel = ViewModel> = M extends LikeC4DiagramModel ? "layouted" : M extends LikeC4ViewModel ? "computed" : never;
750
776
  function isLayouted(model: LikeC4Model): model is Layouted;
751
- class Relationship<M extends ViewModel> {
777
+ class Relationship<M extends ViewModel = ViewModel> {
752
778
  readonly relationship: Relation;
753
- private model;
779
+ private readonly model;
754
780
  constructor(relationship: Relation, model: LikeC4Model<M>);
755
781
  get id(): RelationID;
756
782
  get title(): string;
757
- get kind(): RelationshipKind;
783
+ get kind(): RelationshipKind<string>;
758
784
  get tags(): Tag[];
759
785
  get source(): ElementModel<M>;
760
786
  get target(): ElementModel<M>;
@@ -762,11 +788,11 @@ export declare namespace LikeC4Model {
762
788
  metadata(key: string, defaultValue: string): string;
763
789
  hasMetadata(key: string): boolean;
764
790
  }
765
- class ElementModel<M extends ViewModel> {
791
+ class ElementModel<M extends ViewModel = ViewModel> {
766
792
  readonly element: Element$1;
767
- private model;
793
+ private readonly model;
768
794
  constructor(element: Element$1, model: LikeC4Model<M>);
769
- get id(): Fqn;
795
+ get id(): Fqn<string>;
770
796
  get title(): string;
771
797
  get kind(): ElementKind;
772
798
  get isRoot(): boolean;
@@ -782,6 +808,10 @@ export declare namespace LikeC4Model {
782
808
  siblings(): readonly ElementModel<M>[];
783
809
  descendants(): readonly ElementModel<M>[];
784
810
  children(): readonly ElementModel<M>[];
811
+ /**
812
+ * All views 'view of' current element
813
+ */
814
+ viewsOf(): M[];
785
815
  /**
786
816
  * Views that contain this element
787
817
  */
@@ -791,17 +821,22 @@ export declare namespace LikeC4Model {
791
821
  outgoing(filter?: OutgoingFilter): readonly Relationship<M>[];
792
822
  outgoers(filter?: OutgoingFilter): readonly ElementModel<M>[];
793
823
  internal(): readonly Relationship<M>[];
824
+ /**
825
+ * Resolve siblings of the element and siblings of ancestors
826
+ * (from closest to root)
827
+ */
828
+ ascendingSiblings(): readonly ElementModel<M>[];
794
829
  }
795
830
  }
796
831
  declare class LikeC4DiagramModel {
797
832
  readonly view: DiagramView;
798
833
  readonly model: LikeC4Model.Layouted;
799
- private _rootElements;
800
- private _elements;
801
- private _connections;
834
+ private readonly _rootElements;
835
+ private readonly _elements;
836
+ private readonly _connections;
802
837
  constructor(view: DiagramView, model: LikeC4Model.Layouted);
803
838
  get isDynamic(): boolean;
804
- get id(): ViewID;
839
+ get id(): ViewID<string>;
805
840
  get title(): string;
806
841
  get viewOf(): LikeC4Model.ElementModel<LikeC4DiagramModel>;
807
842
  get tags(): Tag[];
@@ -836,9 +871,9 @@ declare namespace LikeC4DiagramModel {
836
871
  */
837
872
  class Element {
838
873
  readonly node: DiagramNode;
839
- private view;
874
+ private readonly view;
840
875
  constructor(node: DiagramNode, view: LikeC4DiagramModel);
841
- get id(): NodeId;
876
+ get id(): NodeId<string>;
842
877
  get title(): string;
843
878
  get kind(): ElementKind;
844
879
  get isRoot(): boolean;
@@ -869,7 +904,7 @@ declare namespace LikeC4DiagramModel {
869
904
  */
870
905
  class Connection {
871
906
  readonly edge: DiagramEdge;
872
- private view;
907
+ private readonly view;
873
908
  constructor(edge: DiagramEdge, view: LikeC4DiagramModel);
874
909
  get id(): EdgeId;
875
910
  get source(): LikeC4DiagramModel.Element;
@@ -882,27 +917,6 @@ declare namespace LikeC4DiagramModel {
882
917
  relationships(): ReadonlyArray<LikeC4Model.Relationship<LikeC4DiagramModel>>;
883
918
  }
884
919
  }
885
- declare namespace ViewChange {
886
- interface ChangeElementStyle {
887
- op: "change-element-style";
888
- style: {
889
- border?: BorderStyle;
890
- opacity?: number;
891
- shape?: ElementShape;
892
- color?: ThemeColor;
893
- };
894
- targets: NonEmptyArray<Fqn>;
895
- }
896
- interface SaveManualLayout {
897
- op: "save-manual-layout";
898
- layout: ViewManualLayout;
899
- }
900
- interface ChangeAutoLayout {
901
- op: "change-autolayout";
902
- layout: ViewRuleAutoLayout;
903
- }
904
- }
905
- type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
906
920
  interface VariantColorsResolverInput {
907
921
  color: MantineColor | undefined;
908
922
  theme: MantineTheme;
@@ -1151,6 +1165,12 @@ export type LikeC4ViewProps<ViewId extends string, Tag extends string, Kind exte
1151
1165
  * @default false
1152
1166
  */
1153
1167
  enableFocusMode?: boolean | undefined;
1168
+ /**
1169
+ * Experimental feature to browse relationships
1170
+ *
1171
+ * @default false
1172
+ */
1173
+ enableRelationshipsBrowser?: boolean | undefined;
1154
1174
  where?: WhereOperator<Tag, Kind> | undefined;
1155
1175
  className?: string | undefined;
1156
1176
  style?: CSSProperties | undefined;
@@ -1190,8 +1210,14 @@ export type LikeC4BrowserProps<ViewId extends string, Tag extends string, Kind e
1190
1210
  mantineTheme?: MantineThemeOverride | undefined;
1191
1211
  /** Function to generate nonce attribute added to all generated `<style />` tags */
1192
1212
  styleNonce?: string | (() => string) | undefined;
1213
+ /**
1214
+ * Experimental feature to browse relationships
1215
+ *
1216
+ * @default false
1217
+ */
1218
+ enableRelationshipsBrowser?: boolean | undefined;
1193
1219
  };
1194
- 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 }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1220
+ 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, enableRelationshipsBrowser }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1195
1221
  export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDivElement>, "style" | "className"> & {
1196
1222
  view: ViewData<ViewId>;
1197
1223
  /**
@@ -1251,8 +1277,14 @@ export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, K
1251
1277
  mantineTheme?: MantineThemeOverride | undefined;
1252
1278
  /** Function to generate nonce attribute added to all generated `<style />` tags */
1253
1279
  styleNonce?: string | (() => string) | undefined;
1280
+ /**
1281
+ * Experimental feature to browse relationships
1282
+ *
1283
+ * @default false
1284
+ */
1285
+ enableRelationshipsBrowser?: boolean | undefined;
1254
1286
  };
1255
- 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, showElementLinks, showNavigationButtons, enableFocusMode, showNotations, showRelationshipDetails, mantineTheme, where, style, styleNonce }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1287
+ 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, showElementLinks, showNavigationButtons, enableFocusMode, showNotations, showRelationshipDetails, enableRelationshipsBrowser, mantineTheme, where, style, styleNonce }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1256
1288
  declare enum BackgroundVariant {
1257
1289
  Lines = "lines",
1258
1290
  Dots = "dots",
@@ -1316,11 +1348,6 @@ type OnChange = (event: ChangeEvent) => void;
1316
1348
  interface LikeC4DiagramProperties {
1317
1349
  view: DiagramView;
1318
1350
  className?: string | undefined;
1319
- /**
1320
- * Show/hide ReactFlow controls menu
1321
- * @default false
1322
- */
1323
- controls?: boolean | undefined;
1324
1351
  /**
1325
1352
  * Enable/disable panning
1326
1353
  * @default true
@@ -1336,6 +1363,12 @@ interface LikeC4DiagramProperties {
1336
1363
  * @default true
1337
1364
  */
1338
1365
  readonly?: boolean | undefined;
1366
+ /**
1367
+ * Show/hide panel with top left controls,
1368
+ *
1369
+ * @default true if not readonly
1370
+ */
1371
+ controls?: boolean | undefined;
1339
1372
  /**
1340
1373
  * If set, initial viewport will show all nodes & edges
1341
1374
  * @default true
@@ -1377,7 +1410,7 @@ interface LikeC4DiagramProperties {
1377
1410
  */
1378
1411
  showDiagramTitle?: boolean | undefined;
1379
1412
  /**
1380
- * Show back/forward navigation buttons
1413
+ * Show back/forward history navigation buttons
1381
1414
  * @default true if `onNavigateTo` is set
1382
1415
  */
1383
1416
  showNavigationButtons?: undefined | boolean;
@@ -1393,9 +1426,15 @@ interface LikeC4DiagramProperties {
1393
1426
  showRelationshipDetails?: boolean | undefined;
1394
1427
  /**
1395
1428
  * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
1396
- * @default true
1429
+ * @default false
1397
1430
  */
1398
1431
  enableFocusMode?: boolean | undefined;
1432
+ /**
1433
+ * Experimental feature to browse relationships
1434
+ *
1435
+ * @default false
1436
+ */
1437
+ enableRelationshipsBrowser?: boolean | undefined;
1399
1438
  /**
1400
1439
  * If Walkthrough for dynamic views should be enabled
1401
1440
  * @default false
@@ -1480,8 +1519,10 @@ export type ReactLikeC4Props<ViewId extends string, Tag extends string, Kind ext
1480
1519
  where?: WhereOperator<Tag, Kind> | undefined;
1481
1520
  onNavigateTo?: OnNavigateTo<ViewId> | undefined;
1482
1521
  mantineTheme?: MantineThemeOverride | undefined;
1522
+ /** Function to generate nonce attribute added to all generated `<style />` tags */
1523
+ styleNonce?: string | (() => string) | undefined;
1483
1524
  };
1484
- export declare function ReactLikeC4<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, view, colorScheme: explicitColorScheme, injectFontCss, keepAspectRatio, showNotations, onNavigateTo, background, style, mantineTheme, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1525
+ export declare function ReactLikeC4<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, view, colorScheme: explicitColorScheme, injectFontCss, keepAspectRatio, showNotations, onNavigateTo, background, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1485
1526
  export declare namespace ReactLikeC4 {
1486
1527
  var displayName: string;
1487
1528
  }
@@ -1718,7 +1759,7 @@ interface UseStoreOptions<SomeStore> {
1718
1759
  declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
1719
1760
  export declare const DefaultTheme: MantineThemeOverride;
1720
1761
  export declare const BundledStyles: () => any;
1721
- export declare function useBundledStyleSheet(injectFontCss?: boolean): CSSStyleSheet[];
1762
+ export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
1722
1763
  type ColorScheme = "light" | "dark";
1723
1764
  export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
1724
1765
  /**