likec4 1.31.0 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/react/index.d.mts CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { CSSProperties, ComponentType, DependencyList, HTMLAttributes, JSX, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode, WheelEvent as WheelEvent$1 } from 'react';
4
4
 
5
- type Primitive = null | undefined | string | number | boolean | symbol | bigint;
6
5
  type UnionToIntersection<Union> = (
7
6
  // `extends unknown` is always going to be the case and is used to convert the
8
7
  // `Union` into a [distributive conditional
@@ -69,7 +68,6 @@ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends Excep
69
68
  type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
70
69
  [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
71
70
  } & (Options["requireExactProps"] extends true ? Partial<Record<KeysType, never>> : {});
72
- type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
73
71
  declare const tag: unique symbol;
74
72
  type TagContainer<Token> = {
75
73
  readonly [tag]: Token;
@@ -116,109 +114,73 @@ type NonEmptyArray<T> = [
116
114
  T,
117
115
  ...T[]
118
116
  ];
119
- type Point = readonly [
120
- x: number,
121
- y: number
122
- ];
123
- interface XYPoint {
124
- x: number;
125
- y: number;
126
- }
127
- type AllNever<Expressions> = UnionToIntersection<{
128
- [Name in keyof Expressions]: {
129
- -readonly [Key in keyof Expressions[Name]]?: never;
130
- };
131
- }[keyof Expressions]>;
132
- type ExclusiveUnion<Expressions> = Expressions extends object ? {
133
- [Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
134
- }[keyof Expressions] : Expressions;
135
- type ProjectId = Tagged<string, "ProjectID">;
136
- type IconUrl = Tagged<string, "IconUrl"> | "none";
137
- type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
138
- type Tag$1<Tags extends string = string> = Tagged<Tags, "Tag">;
139
- declare const ThemeColors: readonly [
140
- "amber",
141
- "blue",
142
- "gray",
143
- "slate",
144
- "green",
145
- "indigo",
146
- "muted",
147
- "primary",
148
- "red",
149
- "secondary",
150
- "sky"
151
- ];
152
- type ThemeColor = typeof ThemeColors[number];
153
- type HexColorLiteral = `#${string}`;
154
- type ColorLiteral = HexColorLiteral;
155
- type Color = LiteralUnion<ThemeColor, string>;
156
- type ShapeSize = "xs" | "sm" | "md" | "lg" | "xl";
157
- type SpacingSize = "xs" | "sm" | "md" | "lg" | "xl";
158
- type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
159
- interface ElementThemeColorValues {
160
- fill: ColorLiteral;
161
- stroke: ColorLiteral;
162
- hiContrast: ColorLiteral;
163
- loContrast: ColorLiteral;
164
- }
165
- interface RelationshipThemeColorValues {
166
- lineColor: ColorLiteral;
167
- labelBgColor: ColorLiteral;
168
- labelColor: ColorLiteral;
169
- }
170
- interface ThemeColorValues {
171
- elements: ElementThemeColorValues;
172
- relationships: RelationshipThemeColorValues;
173
- }
174
- declare const BorderStyles: readonly [
175
- "solid",
176
- "dashed",
177
- "dotted",
178
- "none"
179
- ];
180
- type BorderStyle = TupleToUnion<typeof BorderStyles>;
181
- type ElementKind<Kinds extends string = string> = Tagged<Kinds, "ElementKind">;
182
- declare namespace ElementKind {
183
- const Group: ElementKind;
184
- }
185
- declare const ElementShapes: readonly [
186
- "rectangle",
187
- "person",
188
- "browser",
189
- "mobile",
190
- "cylinder",
191
- "storage",
192
- "queue"
193
- ];
194
- type ElementShape = TupleToUnion<typeof ElementShapes>;
195
- interface ElementStyle {
196
- readonly border?: BorderStyle;
197
- /**
198
- * In percentage 0-100, 0 is fully transparent
199
- *
200
- * @default 100
201
- */
202
- readonly opacity?: number;
203
- /**
204
- * If true, the element is rendered as multiple shapes
205
- * @default false
206
- */
207
- readonly multiple?: boolean;
208
- /**
209
- * Shape size
210
- *
211
- * @default 'md'
212
- */
213
- readonly size?: ShapeSize;
214
- readonly padding?: SpacingSize;
215
- readonly textSize?: TextSize;
216
- }
217
117
  interface Link {
218
- readonly title?: string;
219
- readonly url: string;
220
- readonly relative?: string;
221
- }
118
+ title?: string;
119
+ url: string;
120
+ relative?: string;
121
+ }
122
+ type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
123
+ type BuiltInIcon = "none" | `${"aws" | "azure" | "gcp" | "tech"}:${string}`;
124
+ type Icon = Tagged<string, "Icon"> | BuiltInIcon;
125
+ type IconUrl = Icon;
126
+ type Fqn<Id = string> = Tagged<Id, "Fqn">;
127
+ declare function Fqn(name: string, parent?: Fqn | null): Fqn;
128
+ type DeploymentFqn<T = string> = Tagged<T, "DeploymentFqn">;
129
+ declare function DeploymentFqn(name: string, parent?: DeploymentFqn | null): DeploymentFqn;
130
+ type ViewId<Id = string> = Tagged<Id, "ViewId">;
131
+ declare function ViewId(id: string): ViewId;
132
+ type RelationId<Id = string> = Tagged<Id, "RelationId">;
133
+ declare function RelationId(id: string): RelationId;
134
+ type NodeId = Tagged<string, "NodeId" | "Fqn" | "DeploymentFqn">;
135
+ declare function NodeId(id: string): NodeId;
136
+ type EdgeId = Tagged<string, "EdgeId">;
137
+ declare function EdgeId(id: string): EdgeId;
138
+ declare const StepEdgeKind = "@step";
139
+ type ModelStage = "parsed" | "computed" | "layouted";
140
+ declare const _stage = "_stage";
141
+ type _stage = typeof _stage;
142
+ declare const _type = "_type";
143
+ type _type = typeof _type;
144
+ interface SpecAux<ElementKind extends string, DeploymentKind extends string, RelationKind extends string, Tag extends string, MetadataKey extends string> {
145
+ ElementKind: ElementKind;
146
+ DeploymentKind: DeploymentKind;
147
+ RelationKind: RelationKind;
148
+ Tag: Tag;
149
+ MetadataKey: MetadataKey;
150
+ }
151
+ interface Aux<Stage extends ModelStage, Element extends string, Deployment extends string, View extends string, Project extends string, Spec extends SpecAux<string, string, string, string, string>> {
152
+ Stage: Stage;
153
+ ProjectId: Project;
154
+ ElementId: Element;
155
+ DeploymentId: Deployment;
156
+ ViewId: View;
157
+ ElementKind: Spec["ElementKind"];
158
+ DeploymentKind: Spec["DeploymentKind"];
159
+ RelationKind: Spec["RelationKind"];
160
+ Tag: Spec["Tag"];
161
+ MetadataKey: Spec["MetadataKey"];
162
+ }
163
+ type Any = Aux<any, any, any, any, any, SpecAux<any, any, any, any, any>>;
164
+ type UnknownLayouted = Aux<"layouted", string, string, string, string, SpecAux<string, string, string, string, string>>;
165
+ type Fqn$1<A> = A extends infer T extends Any ? Fqn<ElementId<T>> : never;
166
+ type ElementId<A> = A extends infer T extends Any ? Coalesce<T["ElementId"]> : never;
167
+ type DeploymentFqn$1<A> = A extends infer T extends Any ? DeploymentFqn<DeploymentId<T>> : never;
168
+ type DeploymentId<A> = A extends infer T extends Any ? Coalesce<T["DeploymentId"]> : never;
169
+ type ViewId$1<A> = A extends infer T extends Any ? Coalesce<T["ViewId"]> : never;
170
+ type RelationId$1 = RelationId;
171
+ type ElementKind<A> = A extends infer T extends Any ? Coalesce<T["ElementKind"]> : never;
172
+ type DeploymentKind<A> = A extends infer T extends Any ? Coalesce<T["DeploymentKind"]> : never;
173
+ type RelationKind<A> = A extends infer T extends Any ? Coalesce<T["RelationKind"]> : never;
174
+ type Tag$1<A> = A extends infer T extends Any ? Coalesce<T["Tag"]> : never;
175
+ type Tags<A extends Any> = readonly Tag$1<A>[];
176
+ type AllKinds<A> = ElementKind<A> | DeploymentKind<A> | RelationKind<A>;
177
+ type StrictViewId<A> = A extends infer T extends Any ? ViewId<ViewId$1<T>> : never;
178
+ type WithOptionalTags<A extends Any> = {
179
+ readonly tags?: Tags<A> | null;
180
+ };
181
+ type WithOptionalLinks = {
182
+ readonly links?: readonly Link[] | null;
183
+ };
222
184
  type EqualOperator<V> = {
223
185
  eq: V;
224
186
  neq?: never;
@@ -226,504 +188,105 @@ type EqualOperator<V> = {
226
188
  eq?: never;
227
189
  neq: V;
228
190
  };
229
- type AllNever$1 = {
191
+ type AllNever = {
230
192
  not?: never;
231
193
  and?: never;
232
194
  or?: never;
233
195
  tag?: never;
234
196
  kind?: never;
235
197
  participant?: never;
198
+ operator?: never;
236
199
  };
237
- type TagEqual<Tag> = Omit<AllNever$1, "tag"> & {
238
- tag: EqualOperator<Tag>;
200
+ type TagEqual<A extends Any> = Omit<AllNever, "tag"> & {
201
+ tag: EqualOperator<Tag$1<A>> | Tag$1<A>;
239
202
  };
240
- type KindEqual<Kind> = Omit<AllNever$1, "kind"> & {
241
- kind: EqualOperator<Kind>;
203
+ type KindEqual<A extends Any> = Omit<AllNever, "kind"> & {
204
+ kind: EqualOperator<AllKinds<A>> | AllKinds<A>;
242
205
  };
243
206
  type Participant = "source" | "target";
244
- type ParticipantOperator<Tag, Kind> = Omit<AllNever$1, "participant"> & {
207
+ type ParticipantOperator<A extends Any> = Omit<AllNever, "participant" | "operator"> & {
245
208
  participant: Participant;
246
- operator: KindEqual<Kind> | TagEqual<Tag>;
209
+ operator: KindEqual<A> | TagEqual<A>;
247
210
  };
248
- type NotOperator<Tag, Kind> = Omit<AllNever$1, "not"> & {
249
- not: WhereOperator<Tag, Kind>;
211
+ type NotOperator<A extends Any> = Omit<AllNever, "not"> & {
212
+ not: WhereOperator<A>;
250
213
  };
251
- type AndOperator<Tag, Kind> = Omit<AllNever$1, "and"> & {
252
- and: NonEmptyArray<WhereOperator<Tag, Kind>>;
214
+ type AndOperator<A extends Any> = Omit<AllNever, "and"> & {
215
+ and: NonEmptyArray<WhereOperator<A>>;
253
216
  };
254
- type OrOperator<Tag, Kind> = Omit<AllNever$1, "or"> & {
255
- or: NonEmptyArray<WhereOperator<Tag, Kind>>;
217
+ type OrOperator<A extends Any> = Omit<AllNever, "or"> & {
218
+ or: NonEmptyArray<WhereOperator<A>>;
256
219
  };
257
- type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
258
- declare namespace FqnRef {
259
- /**
260
- * Represents a reference to an instance within a deployment.
261
- *
262
- * @template D - The type representing the deployment fqn. Defaults to `Fqn`.
263
- * @template M - The type representing the model fqn. Defaults to `Fqn`.
264
- *
265
- * @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
266
- * @property {M} element - The element reference within the deployment.
267
- */
268
- type InsideInstanceRef<D = Fqn, M = Fqn> = {
269
- deployment: D;
270
- element: M;
271
- };
272
- const isInsideInstanceRef: (ref: FqnRef) => ref is InsideInstanceRef;
273
- /**
274
- * Represents a reference to a deployment element.
275
- *
276
- * @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
277
- * @property {F} deployment - The fully qualified name (FQN) of the deployment element.
278
- */
279
- type DeploymentElementRef<F = Fqn> = {
280
- deployment: F;
281
- };
282
- const isDeploymentElementRef: (ref: FqnRef) => ref is DeploymentElementRef;
283
- type DeploymentRef<D = Fqn, M = Fqn> = DeploymentElementRef<D> | InsideInstanceRef<D, M>;
284
- const isDeploymentRef: (ref: FqnRef) => ref is DeploymentRef;
285
- /**
286
- * Reference to logical model element
287
- */
288
- type ModelRef<F = Fqn> = {
289
- model: F;
290
- };
291
- const isModelRef: (ref: FqnRef) => ref is ModelRef;
292
- /**
293
- * Reference to imported logical model element
294
- */
295
- type ImportRef<F = Fqn> = {
296
- project: ProjectId;
297
- model: F;
298
- };
299
- const isImportRef: (ref: FqnRef) => ref is ImportRef;
300
- const toDeploymentRef: (ref: FqnRef) => DeploymentRef;
301
- const toModelFqn: (ref: FqnRef) => Fqn;
302
- }
303
- type FqnRef<D = Fqn, M = Fqn> = ExclusiveUnion<{
304
- InsideInstanceRef: FqnRef.InsideInstanceRef<D, M>;
305
- DeploymentRef: FqnRef.DeploymentRef<D>;
306
- ModelRef: FqnRef.ModelRef<M>;
307
- ImportRef: FqnRef.ImportRef<M>;
308
- }>;
309
- declare namespace FqnExpr {
310
- type Wildcard = {
311
- wildcard: true;
312
- };
313
- const isWildcard: (expr: ExpressionV2) => expr is FqnExpr.Wildcard;
314
- type ModelRef<M = Fqn> = {
315
- ref: FqnRef.ModelRef<M> | FqnRef.ImportRef<M>;
316
- selector?: PredicateSelector;
317
- };
318
- const isModelRef: (ref: ExpressionV2) => ref is FqnExpr.ModelRef;
319
- type DeploymentRef<D = Fqn, M = Fqn> = {
320
- ref: FqnRef.DeploymentRef<D> | FqnRef.InsideInstanceRef<D, M>;
321
- selector?: PredicateSelector;
322
- };
323
- const isDeploymentRef: (ref: ExpressionV2) => ref is FqnExpr.DeploymentRef;
324
- type ElementKindExpr = {
325
- elementKind: ElementKind;
326
- isEqual: boolean;
327
- };
328
- function isElementKindExpr(expr: ExpressionV2): expr is ElementKindExpr;
329
- type ElementTagExpr = {
330
- elementTag: Tag$1;
331
- isEqual: boolean;
332
- };
333
- function isElementTagExpr(expr: ExpressionV2): expr is ElementTagExpr;
334
- type NonWildcard<D = Fqn, M = Fqn> = ExclusiveUnion<{
335
- ModelRef: ModelRef<M>;
336
- DeploymentRef: DeploymentRef<D, M>;
337
- ElementKind: ElementKindExpr;
338
- ElementTag: ElementTagExpr;
339
- }>;
340
- type Where<D = Fqn, M = Fqn> = {
341
- where: {
342
- expr: ExclusiveUnion<{
343
- Wildcard: Wildcard;
344
- ModelRef: ModelRef<M>;
345
- DeploymentRef: DeploymentRef<D, M>;
346
- ElementKind: ElementKindExpr;
347
- ElementTag: ElementTagExpr;
348
- }>;
349
- condition: WhereOperator<string, string>;
350
- };
351
- };
352
- const isWhere: (expr: ExpressionV2) => expr is FqnExpr.Where;
353
- type Custom<D = Fqn, M = Fqn> = {
354
- custom: {
355
- expr: OrWhere<D, M>;
356
- title?: string;
357
- description?: string;
358
- technology?: string;
359
- notation?: string;
360
- shape?: ElementShape;
361
- color?: Color;
362
- icon?: IconUrl;
363
- border?: BorderStyle;
364
- opacity?: number;
365
- navigateTo?: ViewId;
366
- multiple?: boolean;
367
- size?: ShapeSize;
368
- padding?: ShapeSize;
369
- textSize?: ShapeSize;
370
- };
371
- };
372
- const isCustom: (expr: ExpressionV2) => expr is Custom;
373
- const is: (expr: ExpressionV2) => expr is FqnExpr;
374
- type OrWhere<D = Fqn, M = Fqn> = ExclusiveUnion<{
375
- Wildcard: FqnExpr.Wildcard;
376
- ModelRef: FqnExpr.ModelRef<M>;
377
- DeploymentRef: FqnExpr.DeploymentRef<D, M>;
378
- ElementKind: ElementKindExpr;
379
- ElementTag: ElementTagExpr;
380
- Where: FqnExpr.Where<D, M>;
381
- }>;
382
- type Any<D = Fqn, M = Fqn> = ExclusiveUnion<{
383
- Wildcard: Wildcard;
384
- ModelRef: ModelRef<M>;
385
- DeploymentRef: DeploymentRef<D, M>;
386
- ElementKind: ElementKindExpr;
387
- ElementTag: ElementTagExpr;
388
- Where: Where<D, M>;
389
- Custom: Custom<D, M>;
390
- }>;
391
- const unwrap: (expr: FqnExpr) => Wildcard | ModelRef | DeploymentRef | ElementKindExpr | ElementTagExpr;
392
- }
393
- type FqnExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
394
- Wildcard: FqnExpr.Wildcard;
395
- ModelRef: FqnExpr.ModelRef<M>;
396
- DeploymentRef: FqnExpr.DeploymentRef<D, M>;
397
- ElementKind: FqnExpr.ElementKindExpr;
398
- ElementTag: FqnExpr.ElementTagExpr;
399
- }>;
400
- declare namespace RelationExpr {
401
- type Endpoint<D = Fqn, M = Fqn> = FqnExpr.Where<D, M>["where"]["expr"];
402
- type Direct<D = Fqn, M = Fqn> = {
403
- source: Endpoint<D, M>;
404
- target: Endpoint<D, M>;
405
- isBidirectional?: boolean;
406
- };
407
- const isDirect: (expr: ExpressionV2) => expr is RelationExpr.Direct;
408
- type Incoming<D = Fqn, M = Fqn> = {
409
- incoming: Endpoint<D, M>;
410
- };
411
- const isIncoming: (expr: ExpressionV2) => expr is RelationExpr.Incoming;
412
- type Outgoing<D = Fqn, M = Fqn> = {
413
- outgoing: Endpoint<D, M>;
414
- };
415
- const isOutgoing: (expr: ExpressionV2) => expr is RelationExpr.Outgoing;
416
- type InOut<D = Fqn, M = Fqn> = {
417
- inout: Endpoint<D, M>;
418
- };
419
- const isInOut: (expr: ExpressionV2) => expr is RelationExpr.InOut;
420
- type Where<D = Fqn, M = Fqn> = {
421
- where: {
422
- expr: ExclusiveUnion<{
423
- Direct: RelationExpr.Direct<D, M>;
424
- Incoming: RelationExpr.Incoming<D, M>;
425
- Outgoing: RelationExpr.Outgoing<D, M>;
426
- InOut: RelationExpr.InOut<D, M>;
427
- }>;
428
- condition: WhereOperator<string, string>;
429
- };
430
- };
431
- const isWhere: (expr: ExpressionV2) => expr is RelationExpr.Where;
432
- type Custom<D = Fqn, M = Fqn> = {
433
- customRelation: {
434
- expr: OrWhere<D, M>;
435
- title?: string;
436
- description?: string;
437
- technology?: string;
438
- notation?: string;
439
- navigateTo?: ViewId;
440
- notes?: string;
441
- color?: Color;
442
- line?: RelationshipLineType;
443
- head?: RelationshipArrowType;
444
- tail?: RelationshipArrowType;
445
- };
446
- };
447
- const isCustom: (expr: ExpressionV2) => expr is Custom;
448
- const is: (expr: ExpressionV2) => expr is RelationExpr;
449
- type OrWhere<D = Fqn, M = Fqn> = ExclusiveUnion<{
450
- Direct: Direct<D, M>;
451
- Incoming: Incoming<D, M>;
452
- Outgoing: Outgoing<D, M>;
453
- InOut: InOut<D, M>;
454
- Where: Where<D, M>;
455
- }>;
456
- type Any<D = Fqn, M = Fqn> = ExclusiveUnion<{
457
- Direct: Direct<D, M>;
458
- Incoming: Incoming<D, M>;
459
- Outgoing: Outgoing<D, M>;
460
- InOut: InOut<D, M>;
461
- Where: Where<D, M>;
462
- Custom: Custom<D, M>;
463
- }>;
464
- const unwrap: (expr: RelationExpr) => Direct | Incoming | Outgoing | InOut;
465
- }
466
- type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
467
- Direct: RelationExpr.Direct<D, M>;
468
- Incoming: RelationExpr.Incoming<D, M>;
469
- Outgoing: RelationExpr.Outgoing<D, M>;
470
- InOut: RelationExpr.InOut<D, M>;
471
- }>;
472
- type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
473
- Wildcard: FqnExpr.Wildcard;
474
- ModelRef: FqnExpr.ModelRef<M>;
475
- DeploymentRef: FqnExpr.DeploymentRef<D, M>;
476
- ElementKind: FqnExpr.ElementKindExpr;
477
- ElementTag: FqnExpr.ElementTagExpr;
478
- Custom: FqnExpr.Custom<D, M>;
479
- Direct: RelationExpr.Direct<D, M>;
480
- Incoming: RelationExpr.Incoming<D, M>;
481
- Outgoing: RelationExpr.Outgoing<D, M>;
482
- InOut: RelationExpr.InOut<D, M>;
483
- Where: ExpressionV2.Where<D, M>;
484
- CustomRelation: RelationExpr.Custom<D, M>;
485
- }>;
486
- declare namespace ExpressionV2 {
487
- type Where<D = Fqn, M = Fqn> = FqnExpr.Where<D, M> | RelationExpr.Where<D, M>;
488
- const isWhere: (expr: ExpressionV2) => expr is ExpressionV2.Where;
489
- const isRelationWhere: (expr: ExpressionV2) => expr is RelationExpr.Where;
490
- const isFqnExprWhere: (expr: ExpressionV2) => expr is FqnExpr.Where;
491
- const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr.Any;
492
- const isRelation: (expr: ExpressionV2) => expr is RelationExpr.Any;
220
+ type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
221
+ type SpacingSize = "xs" | "sm" | "md" | "lg" | "xl";
222
+ type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
223
+ type ShapeSize = "xs" | "sm" | "md" | "lg" | "xl";
224
+ declare const BorderStyles: readonly [
225
+ "solid",
226
+ "dashed",
227
+ "dotted",
228
+ "none"
229
+ ];
230
+ type BorderStyle = TupleToUnion<typeof BorderStyles>;
231
+ declare const ElementShapes: readonly [
232
+ "rectangle",
233
+ "person",
234
+ "browser",
235
+ "mobile",
236
+ "cylinder",
237
+ "storage",
238
+ "queue"
239
+ ];
240
+ type ElementShape = TupleToUnion<typeof ElementShapes>;
241
+ type HexColor = `#${string}`;
242
+ type RelationshipLineType = "dashed" | "solid" | "dotted";
243
+ type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
244
+ declare const ThemeColors: readonly [
245
+ "amber",
246
+ "blue",
247
+ "gray",
248
+ "slate",
249
+ "green",
250
+ "indigo",
251
+ "muted",
252
+ "primary",
253
+ "red",
254
+ "secondary",
255
+ "sky"
256
+ ];
257
+ type ThemeColor = typeof ThemeColors[number];
258
+ type Color = ThemeColor | HexColor;
259
+ type Point = readonly [
260
+ x: number,
261
+ y: number
262
+ ];
263
+ interface XYPoint {
264
+ x: number;
265
+ y: number;
493
266
  }
494
- declare namespace ModelLayer {
495
- namespace FqnRef {
496
- /**
497
- * Reference to logical model element
498
- */
499
- type ModelRef<F = Fqn> = {
500
- model: F;
501
- };
502
- const isModelRef: (ref: FqnRef) => ref is ModelRef;
503
- /**
504
- * Reference to imported logical model element
505
- */
506
- type ImportRef<F = Fqn> = {
507
- project: ProjectId;
508
- model: F;
509
- };
510
- const isImportRef: (ref: FqnRef) => ref is ImportRef;
511
- const toFqn: (ref: FqnRef) => Fqn;
512
- }
513
- type FqnRef<M = Fqn> = ExclusiveUnion<{
514
- ModelRef: FqnRef.ModelRef<M>;
515
- ImportRef: FqnRef.ImportRef<M>;
516
- }>;
517
- namespace FqnExpr {
518
- type Wildcard = {
519
- wildcard: true;
520
- };
521
- const isWildcard: (expr: Expression) => expr is FqnExpr.Wildcard;
522
- type ModelRef<M = Fqn> = {
523
- ref: FqnRef.ModelRef<M> | FqnRef.ImportRef<M>;
524
- selector?: PredicateSelector;
525
- };
526
- const isModelRef: (ref: Expression) => ref is FqnExpr.ModelRef;
527
- type ElementKindExpr = {
528
- elementKind: ElementKind;
529
- isEqual: boolean;
530
- };
531
- function isElementKindExpr(expr: Expression): expr is ElementKindExpr;
532
- type ElementTagExpr = {
533
- elementTag: Tag$1;
534
- isEqual: boolean;
535
- };
536
- function isElementTagExpr(expr: Expression): expr is ElementTagExpr;
537
- type NonWildcard<M = Fqn> = ExclusiveUnion<{
538
- ModelRef: ModelRef<M>;
539
- ElementKind: ElementKindExpr;
540
- ElementTag: ElementTagExpr;
541
- }>;
542
- type Where<M = Fqn> = {
543
- where: {
544
- expr: ExclusiveUnion<{
545
- Wildcard: Wildcard;
546
- ModelRef: ModelRef<M>;
547
- ElementKind: ElementKindExpr;
548
- ElementTag: ElementTagExpr;
549
- }>;
550
- condition: WhereOperator<string, string>;
551
- };
552
- };
553
- const isWhere: (expr: Expression) => expr is FqnExpr.Where;
554
- type Custom<M = Fqn> = {
555
- custom: {
556
- expr: FqnExprOrWhere<M>;
557
- title?: string;
558
- description?: string;
559
- technology?: string;
560
- notation?: string;
561
- shape?: ElementShape;
562
- color?: Color;
563
- icon?: IconUrl;
564
- border?: BorderStyle;
565
- opacity?: number;
566
- navigateTo?: ViewId;
567
- multiple?: boolean;
568
- size?: ShapeSize;
569
- padding?: ShapeSize;
570
- textSize?: ShapeSize;
571
- };
572
- };
573
- const isCustom: (expr: Expression) => expr is FqnExpr.Custom;
574
- const is: (expr: Expression) => expr is FqnExpr;
575
- }
576
- type FqnExpr<M = Fqn> = ExclusiveUnion<{
577
- Wildcard: FqnExpr.Wildcard;
578
- ModelRef: FqnExpr.ModelRef<M>;
579
- ElementKind: FqnExpr.ElementKindExpr;
580
- ElementTag: FqnExpr.ElementTagExpr;
581
- }>;
582
- type FqnExprOrWhere<M = Fqn> = ExclusiveUnion<{
583
- Wildcard: FqnExpr.Wildcard;
584
- ModelRef: FqnExpr.ModelRef<M>;
585
- ElementKind: FqnExpr.ElementKindExpr;
586
- ElementTag: FqnExpr.ElementTagExpr;
587
- Where: FqnExpr.Where<M>;
588
- }>;
589
- type AnyFqnExpr<M = Fqn> = ExclusiveUnion<{
590
- Wildcard: FqnExpr.Wildcard;
591
- ModelRef: FqnExpr.ModelRef<M>;
592
- ElementKind: FqnExpr.ElementKindExpr;
593
- ElementTag: FqnExpr.ElementTagExpr;
594
- Where: FqnExpr.Where<M>;
595
- Custom: FqnExpr.Custom<M>;
596
- }>;
597
- function isAnyFqnExpr(expr: Expression): expr is AnyFqnExpr;
598
- namespace RelationExpr {
599
- type Direct<M = Fqn> = {
600
- source: FqnExpr<M>;
601
- target: FqnExpr<M>;
602
- isBidirectional?: boolean;
603
- };
604
- const isDirect: (expr: Expression) => expr is RelationExpr.Direct;
605
- type Incoming<M = Fqn> = {
606
- incoming: FqnExpr<M>;
607
- };
608
- const isIncoming: (expr: Expression) => expr is RelationExpr.Incoming;
609
- type Outgoing<M = Fqn> = {
610
- outgoing: FqnExpr<M>;
611
- };
612
- const isOutgoing: (expr: Expression) => expr is RelationExpr.Outgoing;
613
- type InOut<M = Fqn> = {
614
- inout: FqnExpr<M>;
615
- };
616
- const isInOut: (expr: Expression) => expr is RelationExpr.InOut;
617
- type Where<M = Fqn> = {
618
- where: {
619
- expr: ExclusiveUnion<{
620
- Direct: RelationExpr.Direct<M>;
621
- Incoming: RelationExpr.Incoming<M>;
622
- Outgoing: RelationExpr.Outgoing<M>;
623
- InOut: RelationExpr.InOut<M>;
624
- }>;
625
- condition: WhereOperator<string, string>;
626
- };
627
- };
628
- const isWhere: (expr: Expression) => expr is RelationExpr.Where;
629
- type Custom<M = Fqn> = {
630
- customRelation: {
631
- expr: RelationExprOrWhere<M>;
632
- title?: string;
633
- description?: string;
634
- technology?: string;
635
- notation?: string;
636
- navigateTo?: ViewId;
637
- notes?: string;
638
- color?: Color;
639
- line?: RelationshipLineType;
640
- head?: RelationshipArrowType;
641
- tail?: RelationshipArrowType;
642
- };
643
- };
644
- const isCustom: (expr: Expression) => expr is Custom;
645
- const is: (expr: Expression) => expr is RelationExpr;
646
- }
647
- type RelationExpr<M = Fqn> = ExclusiveUnion<{
648
- Direct: RelationExpr.Direct<M>;
649
- Incoming: RelationExpr.Incoming<M>;
650
- Outgoing: RelationExpr.Outgoing<M>;
651
- InOut: RelationExpr.InOut<M>;
652
- }>;
653
- type RelationExprOrWhere<M = Fqn> = ExclusiveUnion<{
654
- Direct: RelationExpr.Direct<M>;
655
- Incoming: RelationExpr.Incoming<M>;
656
- Outgoing: RelationExpr.Outgoing<M>;
657
- InOut: RelationExpr.InOut<M>;
658
- Where: RelationExpr.Where<M>;
659
- }>;
660
- type AnyRelationExpr<M = Fqn> = ExclusiveUnion<{
661
- Direct: RelationExpr.Direct<M>;
662
- Incoming: RelationExpr.Incoming<M>;
663
- Outgoing: RelationExpr.Outgoing<M>;
664
- InOut: RelationExpr.InOut<M>;
665
- Where: RelationExpr.Where<M>;
666
- CustomRelation: RelationExpr.Custom<M>;
667
- }>;
668
- function isAnyRelationExpr(expr: Expression): expr is AnyRelationExpr;
669
- /**
670
- * Represents a version 2 expression which can be one of several types.
671
- *
672
- * @template M - The type for the model FQN, defaults to `Fqn`.
673
- */
674
- type Expression<M = Fqn> = ExclusiveUnion<{
675
- Wildcard: FqnExpr.Wildcard;
676
- ModelRef: FqnExpr.ModelRef<M>;
677
- ElementKind: FqnExpr.ElementKindExpr;
678
- ElementTag: FqnExpr.ElementTagExpr;
679
- Custom: FqnExpr.Custom<M>;
680
- Direct: RelationExpr.Direct<M>;
681
- Incoming: RelationExpr.Incoming<M>;
682
- Outgoing: RelationExpr.Outgoing<M>;
683
- InOut: RelationExpr.InOut<M>;
684
- CustomRelation: RelationExpr.Custom<M>;
685
- Where: Expression.Where<M>;
686
- }>;
687
- function isExpression(expr: any): expr is Expression;
688
- namespace Expression {
689
- type Where<M = Fqn> = FqnExpr.Where<M> | RelationExpr.Where<M>;
690
- const isWhere: (expr: Expression) => expr is Expression.Where;
691
- const isCustomFqnExpr: (expr: Expression) => expr is FqnExpr.Custom;
692
- const isCustomRelationExpr: (expr: Expression) => expr is RelationExpr.Custom;
693
- const isFqnExpr: (expr: Expression) => expr is FqnExpr;
694
- const isRelation: (expr: Expression) => expr is RelationExpr;
695
- }
267
+ interface BBox {
268
+ x: number;
269
+ y: number;
270
+ width: number;
271
+ height: number;
696
272
  }
697
- type GlobalPredicateId = Tagged<string, "GlobalPredicateId">;
698
- type GlobalStyleID = Tagged<string, "GlobalStyleID">;
699
- type ElementNotation = {
700
- kinds: string[];
701
- shape: ElementShape;
702
- color: Color;
703
- title: string;
704
- };
705
- type ViewId<Id extends string = string> = Tagged<Id, "ViewID">;
706
- type ViewRulePredicate = {
707
- include: ModelLayer.Expression[];
708
- exclude?: never;
709
- } | {
710
- include?: never;
711
- exclude: ModelLayer.Expression[];
712
- };
713
- interface ViewRuleGlobalPredicateRef {
714
- predicateId: GlobalPredicateId;
273
+ declare namespace BBox {
274
+ function center({ x, y, width, height }: BBox): XYPoint;
275
+ function fromPoints(points: Point[]): BBox;
276
+ function merge(...boxes: BBox[]): BBox;
277
+ function toRectBox(box: BBox): RectBox;
715
278
  }
716
- interface ViewRuleStyle {
717
- targets: ModelLayer.FqnExpr[];
718
- notation?: string;
719
- style: ElementStyle & {
720
- color?: Color;
721
- shape?: ElementShape;
722
- icon?: IconUrl;
723
- };
279
+ interface RectBox {
280
+ x1: number;
281
+ y1: number;
282
+ x2: number;
283
+ y2: number;
724
284
  }
725
- interface ViewRuleGlobalStyle {
726
- styleId: GlobalStyleID;
285
+ declare namespace RectBox {
286
+ function center({ x1, y1, x2, y2 }: RectBox): XYPoint;
287
+ function fromPoints(points: Point[]): RectBox;
288
+ function merge(...boxes: RectBox[]): RectBox;
289
+ function toBBox(box: RectBox): BBox;
727
290
  }
728
291
  type AutoLayoutDirection = "TB" | "BT" | "LR" | "RL";
729
292
  interface ViewRuleAutoLayout {
@@ -731,30 +294,36 @@ interface ViewRuleAutoLayout {
731
294
  nodeSep?: number;
732
295
  rankSep?: number;
733
296
  }
734
- interface ViewRuleGroup {
735
- groupRules: Array<ViewRulePredicate | ViewRuleGroup>;
736
- title: string | null;
737
- color?: Color;
738
- border?: BorderStyle;
739
- opacity?: number;
740
- multiple?: boolean;
741
- size?: ShapeSize;
742
- padding?: SpacingSize;
743
- textSize?: TextSize;
297
+ interface ViewAutoLayout {
298
+ direction: ViewRuleAutoLayout["direction"];
299
+ rankSep?: number;
300
+ nodeSep?: number;
744
301
  }
745
- type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
746
- interface BasicView<ViewType extends "element" | "dynamic" | "deployment", ViewIDs extends string, Tags extends string> {
747
- readonly __?: ViewType;
748
- readonly id: ViewId<ViewIDs>;
302
+ type ViewManualLayout = {
303
+ readonly hash: string;
304
+ readonly x: number;
305
+ readonly y: number;
306
+ readonly width: number;
307
+ readonly height: number;
308
+ readonly autoLayout: ViewAutoLayout;
309
+ readonly nodes: Record<string, {
310
+ isCompound: boolean;
311
+ x: number;
312
+ y: number;
313
+ width: number;
314
+ height: number;
315
+ }>;
316
+ readonly edges: Record<string, {
317
+ dotpos?: string;
318
+ points: NonEmptyArray<Point>;
319
+ controlPoints?: NonEmptyArray<XYPoint>;
320
+ labelBBox?: BBox;
321
+ }>;
322
+ };
323
+ interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
324
+ readonly id: StrictViewId<A>;
749
325
  readonly title: string | null;
750
326
  readonly description: string | null;
751
- readonly tags: NonEmptyArray<Tag$1<Tags>> | null;
752
- readonly links: NonEmptyArray<Link> | null;
753
- /**
754
- * URI to the source file of this view.
755
- * Undefined if the view is auto-generated.
756
- */
757
- readonly docUri?: string;
758
327
  /**
759
328
  * For all views we find common ancestor path.
760
329
  * This is used to generate relative paths, i.e.:
@@ -763,110 +332,75 @@ interface BasicView<ViewType extends "element" | "dynamic" | "deployment", ViewI
763
332
  *
764
333
  * Undefined if the view is auto-generated.
765
334
  */
766
- readonly relativePath?: string;
767
- /**
768
- * If the view is changed manually this field contains the layout data.
769
- */
770
- readonly manualLayout?: ViewManualLayout | undefined;
771
- readonly customColorDefinitions: CustomColorDefinitions;
772
- }
773
- interface BasicElementView<ViewIDs extends string, Tags extends string> extends BasicView<"element", ViewIDs, Tags> {
774
- readonly viewOf?: Fqn;
775
- readonly rules: ViewRule[];
776
- }
777
- interface ScopedElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
778
- readonly viewOf: Fqn;
335
+ readonly relativePath?: string | undefined;
779
336
  }
780
- interface ExtendsElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
781
- readonly extends: ViewId<ViewIDs>;
782
- }
783
- type ElementView<ViewIDs extends string = string, Tags extends string = string> = ScopedElementView<ViewIDs, Tags> | ExtendsElementView<ViewIDs, Tags> | BasicElementView<ViewIDs, Tags>;
784
- interface DynamicViewStep {
785
- readonly source: Fqn;
786
- readonly target: Fqn;
787
- readonly title: string | null;
788
- readonly description?: string;
789
- readonly technology?: string;
790
- readonly notation?: string;
791
- readonly notes?: string;
792
- readonly color?: Color;
793
- readonly line?: RelationshipLineType;
794
- readonly head?: RelationshipArrowType;
795
- readonly tail?: RelationshipArrowType;
796
- readonly isBackward?: boolean;
797
- readonly navigateTo?: ViewId;
798
- __parallel?: never;
799
- }
800
- interface DynamicViewParallelSteps {
801
- readonly __parallel: DynamicViewStep[];
802
- }
803
- type DynamicViewStepOrParallel = DynamicViewStep | DynamicViewParallelSteps;
804
- type DynamicViewIncludeRule = {
805
- include: ModelLayer.AnyFqnExpr[];
806
- };
807
- type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
808
- interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"dynamic", ViewIDs, Tags> {
809
- readonly __: "dynamic";
810
- readonly steps: DynamicViewStepOrParallel[];
811
- readonly rules: DynamicViewRule[];
812
- }
813
- type CustomColorDefinitions = {
814
- [key: string]: ThemeColorValues;
815
- };
816
- type DeploymentViewRulePredicate = {
817
- include: ExpressionV2[];
818
- exclude?: never;
819
- } | {
820
- include?: never;
821
- exclude: ExpressionV2[];
337
+ type NodeNotation = {
338
+ kinds: string[];
339
+ shape: ElementShape;
340
+ color: Color;
341
+ title: string;
822
342
  };
823
- type DeploymentViewRuleStyle = {
824
- targets: FqnExpr[];
825
- notation?: string;
826
- style: ElementStyle & {
827
- color?: Color;
828
- shape?: ElementShape;
829
- icon?: IconUrl;
343
+ interface ViewWithNotation {
344
+ notation?: {
345
+ nodes: NodeNotation[];
830
346
  };
831
- };
832
- type DeploymentViewRule = DeploymentViewRulePredicate | ViewRuleAutoLayout | DeploymentViewRuleStyle;
833
- interface DeploymentView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"deployment", ViewIDs, Tags> {
834
- readonly __: "deployment";
835
- readonly rules: DeploymentViewRule[];
836
347
  }
837
- type NodeId<IDs extends string = string> = Tagged<IDs, "Fqn">;
838
- type EdgeId = Tagged<string, "EdgeId">;
839
- interface ComputedNode {
348
+ interface ViewWithHash {
349
+ /**
350
+ * Hash of the view object.
351
+ * This is used to detect changes in layout
352
+ */
353
+ hash: string;
354
+ }
355
+ interface ElementStyle {
356
+ readonly border?: BorderStyle;
357
+ /**
358
+ * In percentage 0-100, 0 is fully transparent
359
+ *
360
+ * @default 100
361
+ */
362
+ readonly opacity?: number;
363
+ /**
364
+ * If true, the element is rendered as multiple shapes
365
+ * @default false
366
+ */
367
+ readonly multiple?: boolean;
368
+ /**
369
+ * Shape size
370
+ *
371
+ * @default 'md'
372
+ */
373
+ readonly size?: ShapeSize;
374
+ readonly padding?: SpacingSize;
375
+ readonly textSize?: TextSize;
376
+ }
377
+ interface ComputedNode<A extends Any = Any> extends WithOptionalLinks {
840
378
  id: NodeId;
841
- kind: string;
379
+ kind: ElementKind<A> | DeploymentKind<A> | "@group";
842
380
  parent: NodeId | null;
843
381
  /**
844
382
  * Reference to model element
845
383
  * If 1 - node id is a reference
846
384
  */
847
- modelRef?: 1 | Fqn;
385
+ modelRef?: Fqn$1<A> | undefined;
848
386
  /**
849
387
  * Reference to deployment element
850
388
  * If 1 - node id is a reference
851
389
  */
852
- deploymentRef?: 1 | Fqn;
390
+ deploymentRef?: DeploymentFqn$1<A> | undefined;
853
391
  title: string;
854
- description: string | null;
855
- technology: string | null;
392
+ description?: string | null;
393
+ technology?: string | null;
856
394
  notation?: string;
857
- tags: NonEmptyArray<Tag$1> | null;
858
- links: NonEmptyArray<Link> | null;
859
395
  children: NodeId[];
860
396
  inEdges: EdgeId[];
861
397
  outEdges: EdgeId[];
398
+ tags: Tags<A>;
862
399
  shape: ElementShape;
863
400
  color: Color;
864
- /**
865
- * @deprecated Use `style` instead
866
- */
867
- icon?: IconUrl;
401
+ icon?: Icon;
868
402
  style: ElementStyle;
869
- navigateTo?: ViewId | null;
403
+ navigateTo?: StrictViewId<A> | null;
870
404
  level: number;
871
405
  depth?: number;
872
406
  /**
@@ -874,15 +408,7 @@ interface ComputedNode {
874
408
  */
875
409
  isCustomized?: boolean;
876
410
  }
877
- declare namespace ComputedNode {
878
- function modelRef(node: ComputedNode): Fqn | null;
879
- function deploymentRef(node: ComputedNode): Fqn | null;
880
- /**
881
- * Nodes group is a special kind of node, exisiting only in view
882
- */
883
- function isNodesGroup(node: ComputedNode): boolean;
884
- }
885
- interface ComputedEdge {
411
+ interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
886
412
  id: EdgeId;
887
413
  parent: NodeId | null;
888
414
  source: NodeId;
@@ -891,15 +417,14 @@ interface ComputedEdge {
891
417
  description?: string;
892
418
  technology?: string;
893
419
  relations: RelationId[];
894
- kind?: RelationshipKind;
420
+ kind?: RelationKind<A> | typeof StepEdgeKind;
895
421
  notation?: string;
896
422
  notes?: string;
897
423
  color?: Color;
898
424
  line?: RelationshipLineType;
899
425
  head?: RelationshipArrowType;
900
426
  tail?: RelationshipArrowType;
901
- tags?: NonEmptyArray<Tag$1>;
902
- navigateTo?: ViewId;
427
+ navigateTo?: StrictViewId<A> | null;
903
428
  /**
904
429
  * If this edge is derived from custom relationship predicate
905
430
  */
@@ -910,115 +435,70 @@ interface ComputedEdge {
910
435
  */
911
436
  dir?: "forward" | "back" | "both";
912
437
  }
913
- interface ViewWithHash {
914
- /**
915
- * Hash of the view object.
916
- * This is used to detect changes in layout
917
- */
918
- hash: string;
919
- }
920
- interface ViewWithNotation {
921
- notation?: {
922
- elements: ElementNotation[];
923
- };
924
- }
925
- interface ViewAutoLayout {
926
- direction: ViewRuleAutoLayout["direction"];
927
- rankSep?: number;
928
- nodeSep?: number;
929
- }
930
- interface ComputedElementView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ElementView<ViewIDs, Tags>, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
931
- readonly extends?: ViewId<ViewIDs>;
932
- readonly autoLayout: ViewAutoLayout;
933
- readonly nodes: ComputedNode[];
934
- readonly edges: ComputedEdge[];
935
- rules?: never;
936
- docUri?: never;
937
- }
938
- interface ComputedDynamicView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DynamicView<ViewIDs, Tags>, "rules" | "steps" | "docUri">, ViewWithHash, ViewWithNotation {
939
- readonly autoLayout: ViewAutoLayout;
940
- readonly nodes: ComputedNode[];
941
- readonly edges: ComputedEdge[];
942
- steps?: never;
943
- rules?: never;
944
- docUri?: never;
945
- }
946
- interface ComputedDeploymentView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DeploymentView<ViewIDs, Tags>, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
947
- readonly autoLayout: ViewAutoLayout;
948
- readonly nodes: ComputedNode[];
949
- readonly edges: ComputedEdge[];
950
- rules?: never;
951
- docUri?: never;
952
- }
953
- type ComputedView<ViewIDs extends string = string, Tags extends string = string> = ComputedElementView<ViewIDs, Tags> | ComputedDynamicView<ViewIDs, Tags> | ComputedDeploymentView<ViewIDs, Tags>;
954
- declare namespace ComputedView {
955
- function isDeployment(view: ComputedView): view is ComputedDeploymentView;
956
- function isDynamic(view: ComputedView): view is ComputedDynamicView;
957
- function isElement(view: ComputedView): view is ComputedElementView;
958
- }
959
- type BBox = {
438
+ interface DiagramNode<A extends Any = Any> extends ComputedNode<A>, BBox {
960
439
  x: number;
961
440
  y: number;
962
441
  width: number;
963
442
  height: number;
964
- };
965
- interface DiagramNode extends ComputedNode {
966
- width: number;
967
- height: number;
443
+ /**
444
+ * Absolute position, top left
445
+ * @deprecated Use `x` and `y` instead
446
+ */
968
447
  position: Point;
448
+ /**
449
+ * Bounding box of label
450
+ * (Absolute coordinates)
451
+ */
969
452
  labelBBox: BBox;
970
453
  }
971
- declare namespace DiagramNode {
972
- function modelRef(node: Pick<DiagramNode, "id" | "modelRef">): Fqn | null;
973
- function deploymentRef(node: Pick<DiagramNode, "id" | "deploymentRef">): Fqn | null;
454
+ interface DiagramEdge<A extends Any = Any> extends ComputedEdge<A> {
974
455
  /**
975
- * Nodes group is a special kind of node, exisiting only in view
456
+ * Bezier points
457
+ * (Absolute coordinates)
976
458
  */
977
- function isNodesGroup(node: Pick<DiagramNode, "kind">): boolean;
978
- }
979
- interface DiagramEdge extends ComputedEdge {
980
459
  points: NonEmptyArray<Point>;
460
+ /**
461
+ * Control points to adjust the edge
462
+ * (Absolute coordinates)
463
+ */
981
464
  controlPoints?: NonEmptyArray<XYPoint>;
465
+ /**
466
+ * Bounding box of label
467
+ * (Absolute coordinates)
468
+ */
982
469
  labelBBox?: BBox | null;
470
+ /**
471
+ * Graphviz edge POS
472
+ *
473
+ * TODO: temporary solution, should be moved out
474
+ * @deprecated
475
+ */
983
476
  dotpos?: string;
984
477
  }
985
- interface DiagramView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ComputedView<ViewIDs, Tags>, "nodes" | "edges" | "manualLayout"> {
986
- readonly nodes: DiagramNode[];
987
- readonly edges: DiagramEdge[];
478
+ interface BaseLayoutedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
479
+ readonly [_stage]: "layouted";
480
+ readonly autoLayout: ViewAutoLayout;
481
+ readonly nodes: DiagramNode<A>[];
482
+ readonly edges: DiagramEdge<A>[];
988
483
  readonly bounds: BBox;
989
484
  /**
990
485
  * If diagram has manual layout
991
486
  * But was changed and layout should be recalculated
992
487
  */
993
488
  hasLayoutDrift?: boolean;
994
- manualLayout?: never;
995
489
  }
996
- type ViewManualLayout = {
997
- readonly hash: string;
998
- readonly x: number;
999
- readonly y: number;
1000
- readonly width: number;
1001
- readonly height: number;
1002
- readonly autoLayout: ViewAutoLayout;
1003
- readonly nodes: Record<string, {
1004
- isCompound: boolean;
1005
- x: number;
1006
- y: number;
1007
- width: number;
1008
- height: number;
1009
- }>;
1010
- readonly edges: Record<string, {
1011
- dotpos?: string;
1012
- points: NonEmptyArray<Point>;
1013
- controlPoints?: NonEmptyArray<XYPoint>;
1014
- labelBBox?: BBox;
1015
- }>;
1016
- };
1017
- type RelationId = Tagged<string, "RelationID">;
1018
- type RelationshipKind<Kinds extends string = string> = Tagged<Kinds, "RelationshipKind">;
1019
- type RelationshipLineType = "dashed" | "solid" | "dotted";
1020
- type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
1021
- type PredicateSelector = "children" | "expanded" | "descendants";
490
+ interface LayoutedElementView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
491
+ readonly [_type]: "element";
492
+ readonly viewOf?: Fqn$1<A>;
493
+ readonly extends?: StrictViewId<A>;
494
+ }
495
+ interface LayoutedDeploymentView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
496
+ readonly [_type]: "deployment";
497
+ }
498
+ interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
499
+ readonly [_type]: "dynamic";
500
+ }
501
+ type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
1022
502
  declare namespace ViewChange {
1023
503
  interface ChangeElementStyle {
1024
504
  op: "change-element-style";
@@ -1028,7 +508,7 @@ declare namespace ViewChange {
1028
508
  shape?: ElementShape;
1029
509
  color?: ThemeColor;
1030
510
  };
1031
- targets: NonEmptyArray<Fqn>;
511
+ targets: NonEmptyArray<Fqn | DeploymentFqn>;
1032
512
  }
1033
513
  interface SaveManualLayout {
1034
514
  op: "save-manual-layout";
@@ -1273,6 +753,7 @@ type OnConnectStartParams = {
1273
753
  type OnConnectStart = (event: MouseEvent | TouchEvent, params: OnConnectStartParams) => void;
1274
754
  type OnConnect = (connection: Connection) => void;
1275
755
  type OnConnectEnd = (event: MouseEvent | TouchEvent, connectionState: FinalConnectionState) => void;
756
+ type OnReconnect<EdgeType extends EdgeBase = EdgeBase> = (oldEdge: EdgeType, newConnection: Connection) => void;
1276
757
  type PaddingUnit = "px" | "%";
1277
758
  type PaddingWithUnit = `${number}${PaddingUnit}` | number;
1278
759
  type Padding = PaddingWithUnit | {
@@ -1602,7 +1083,6 @@ type EdgeProps<EdgeType extends Edge = Edge> = Pick<EdgeType, "id" | "animated"
1602
1083
  pathOptions?: any;
1603
1084
  interactionWidth?: number;
1604
1085
  };
1605
- type OnReconnect<EdgeType extends Edge = Edge> = (oldEdge: EdgeType, newConnection: Connection) => void;
1606
1086
  type ConnectionLineComponentProps<NodeType extends Node$1 = Node$1> = {
1607
1087
  connectionLineStyle?: CSSProperties;
1608
1088
  connectionLineType: ConnectionLineType;
@@ -1659,22 +1139,11 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1659
1139
  defaultEdges?: EdgeType[];
1660
1140
  /**
1661
1141
  * Defaults to be applied to all new edges that are added to the flow.
1662
- *
1663
1142
  * Properties on a new edge will override these defaults if they exist.
1664
1143
  * @example
1665
1144
  * const defaultEdgeOptions = {
1666
1145
  * type: 'customEdgeType',
1667
- * animated: true,
1668
- * interactionWidth: 10,
1669
- * data: { label: 'custom label' },
1670
- * hidden: false,
1671
- * deletable: true,
1672
- * selected: false,
1673
- * focusable: true,
1674
- * markerStart: EdgeMarker.ArrowClosed,
1675
- * markerEnd: EdgeMarker.ArrowClosed,
1676
- * zIndex: 12,
1677
- * ariaLabel: 'custom aria label'
1146
+ * animated: true
1678
1147
  * }
1679
1148
  */
1680
1149
  defaultEdgeOptions?: DefaultEdgeOptions;
@@ -1711,7 +1180,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1711
1180
  /**
1712
1181
  * This handler is called when the source or target of a reconnectable edge is dragged from the
1713
1182
  * current node. It will fire even if the edge's source or target do not end up changing.
1714
- *
1715
1183
  * You can use the `reconnectEdge` utility to convert the connection to a new edge.
1716
1184
  */
1717
1185
  onReconnect?: OnReconnect<EdgeType>;
@@ -1722,7 +1190,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1722
1190
  /**
1723
1191
  * This event fires when the user releases the source or target of an editable edge. It is called
1724
1192
  * even if an edge update does not occur.
1725
- *
1726
1193
  */
1727
1194
  onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
1728
1195
  /**
@@ -1783,7 +1250,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1783
1250
  onSelectionContextMenu?: (event: ReactMouseEvent, nodes: NodeType[]) => void;
1784
1251
  /**
1785
1252
  * When a connection line is completed and two nodes are connected by the user, this event fires with the new connection.
1786
- *
1787
1253
  * You can use the `addEdge` utility to convert the connection to a complete edge.
1788
1254
  * @example // Use helper function to update edges onConnect
1789
1255
  * import ReactFlow, { addEdge } from '@xyflow/react';
@@ -1851,9 +1317,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1851
1317
  onBeforeDelete?: OnBeforeDelete<NodeType, EdgeType>;
1852
1318
  /**
1853
1319
  * Custom node types to be available in a flow.
1854
- *
1855
1320
  * React Flow matches a node's type to a component in the `nodeTypes` object.
1856
- * @TODO check if @default is correct
1857
1321
  * @default {
1858
1322
  * input: InputNode,
1859
1323
  * default: DefaultNode,
@@ -1868,9 +1332,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1868
1332
  nodeTypes?: NodeTypes;
1869
1333
  /**
1870
1334
  * Custom edge types to be available in a flow.
1871
- *
1872
1335
  * React Flow matches an edge's type to a component in the `edgeTypes` object.
1873
- * @TODO check if @default is correct
1874
1336
  * @default {
1875
1337
  * default: BezierEdge,
1876
1338
  * straight: StraightEdge,
@@ -1886,7 +1348,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1886
1348
  edgeTypes?: EdgeTypes;
1887
1349
  /**
1888
1350
  * The type of edge path to use for connection lines.
1889
- *
1890
1351
  * Although created edges can be of any type, React Flow needs to know what type of path to render for the connection line before the edge is created!
1891
1352
  * @default ConnectionLineType.Bezier
1892
1353
  */
@@ -1907,7 +1368,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1907
1368
  /**
1908
1369
  * If set, pressing the key or chord will delete any selected nodes and edges. Passing an array
1909
1370
  * represents multiple keys that can be pressed.
1910
- *
1371
+
1911
1372
  * For example, `["Delete", "Backspace"]` will delete selected elements when either key is pressed.
1912
1373
  * @default 'Backspace'
1913
1374
  */
@@ -2024,7 +1485,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2024
1485
  selectNodesOnDrag?: boolean;
2025
1486
  /**
2026
1487
  * Enabling this prop allows users to pan the viewport by clicking and dragging.
2027
- *
2028
1488
  * You can also set this prop to an array of numbers to limit which mouse buttons can activate panning.
2029
1489
  * @default true
2030
1490
  * @example [0, 2] // allows panning with the left and right mouse buttons
@@ -2063,7 +1523,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2063
1523
  onViewportChange?: (viewport: Viewport) => void;
2064
1524
  /**
2065
1525
  * By default, the viewport extends infinitely. You can use this prop to set a boundary.
2066
- *
2067
1526
  * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
2068
1527
  * @default [[-∞, -∞], [+∞, +∞]]
2069
1528
  * @example [[-1000, -10000], [1000, 1000]]
@@ -2076,7 +1535,6 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2076
1535
  preventScrolling?: boolean;
2077
1536
  /**
2078
1537
  * By default, nodes can be placed on an infinite flow. You can use this prop to set a boundary.
2079
- *
2080
1538
  * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
2081
1539
  * @example [[-1000, -10000], [1000, 1000]]
2082
1540
  */
@@ -2098,21 +1556,18 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2098
1556
  zoomOnPinch?: boolean;
2099
1557
  /**
2100
1558
  * Controls if the viewport should pan by scrolling inside the container.
2101
- *
2102
1559
  * Can be limited to a specific direction with `panOnScrollMode`.
2103
1560
  * @default false
2104
1561
  */
2105
1562
  panOnScroll?: boolean;
2106
1563
  /**
2107
1564
  * Controls how fast viewport should be panned on scroll.
2108
- *
2109
1565
  * Use together with `panOnScroll` prop.
2110
1566
  * @default 0.5
2111
1567
  */
2112
1568
  panOnScrollSpeed?: number;
2113
1569
  /**
2114
1570
  * This prop is used to limit the direction of panning when `panOnScroll` is enabled.
2115
- *
2116
1571
  * The `"free"` option allows panning in any direction.
2117
1572
  * @default "free"
2118
1573
  * @example "horizontal" | "vertical"
@@ -2245,10 +1700,8 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2245
1700
  isValidConnection?: IsValidConnection<EdgeType>;
2246
1701
  /**
2247
1702
  * With a threshold greater than zero you can delay node drag events.
2248
- *
2249
1703
  * If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired.
2250
- *
2251
- * 1 is the default value, so clicks don't trigger drag events.
1704
+ * 1 is the default value, so that clicks don't trigger drag events.
2252
1705
  * @default 1
2253
1706
  */
2254
1707
  nodeDragThreshold?: number;
@@ -2494,68 +1947,67 @@ type ControlsCustomLayoutProps = {
2494
1947
  syncInProgressBadge: ReactNode;
2495
1948
  };
2496
1949
  type ControlsCustomLayout = (props: ControlsCustomLayoutProps) => ReactNode;
2497
- type NodeProps$2<T extends Record<string, unknown> = {}, NodeType extends string = string> = NodeProps$1<Node$1<Base.NodeData & T, NodeType>>;
2498
- type ReactFlowNode<Data extends Record<string, unknown>, NodeType extends string> = SetRequired<Node$1<Data, NodeType>, "type" | "initialWidth" | "initialHeight">;
2499
- type ReactFlowEdge<Data extends Record<string, unknown>, EdgeType extends string> = SetRequired<Edge<Data, EdgeType>, "type" | "data">;
2500
- declare namespace Base {
2501
- export type Dimmed = "immediate" | boolean;
2502
- export type NodeData = {
2503
- /**
2504
- * Whether the cursor is hovering over the node
2505
- */
2506
- hovered?: boolean;
2507
- /**
2508
- * Whether the node is dimmed
2509
- * 'immediate' means that the node is dimmed without delay
2510
- */
1950
+ type Dimmed = "immediate" | boolean;
1951
+ type NodeData = {
1952
+ /**
1953
+ * Whether the cursor is hovering over the node
1954
+ */
1955
+ hovered?: boolean;
1956
+ /**
1957
+ * Whether the node is dimmed
1958
+ * 'immediate' means that the node is dimmed without delay
1959
+ */
1960
+ dimmed?: Dimmed;
1961
+ };
1962
+ type Node$1 = Node$1<NodeData>;
1963
+ type NodeProps$2 = NodeProps$1<Node$1<NodeData, any>>;
1964
+ type EdgeData = {
1965
+ /**
1966
+ * Whether the cursor is hovering over the edge
1967
+ */
1968
+ hovered?: boolean;
1969
+ /**
1970
+ * Whether the edge is active (animated and highlighted)
1971
+ */
1972
+ active?: boolean;
1973
+ /**
1974
+ * Whether the edge is dimmed
1975
+ * 'immediate' means that the edge is dimmed without delay
1976
+ */
1977
+ dimmed?: Dimmed;
1978
+ };
1979
+ type Edge$1 = Simplify<Omit<Edge, "data"> & {
1980
+ data: EdgeData;
1981
+ }>;
1982
+ type WithDimmed = {
1983
+ data: {
2511
1984
  dimmed?: Dimmed;
2512
1985
  };
2513
- export type Node = Node$1<NodeData>;
2514
- export type NodeProps = NodeProps$1<Node$1<Base.NodeData, any>>;
2515
- export type EdgeData = {
2516
- /**
2517
- * Whether the cursor is hovering over the edge
2518
- */
1986
+ };
1987
+ type WithHovered = {
1988
+ data: {
2519
1989
  hovered?: boolean;
2520
- /**
2521
- * Whether the edge is active (animated and highlighted)
2522
- */
2523
- active?: boolean;
2524
- /**
2525
- * Whether the edge is dimmed
2526
- * 'immediate' means that the edge is dimmed without delay
2527
- */
2528
- dimmed?: Dimmed;
2529
- };
2530
- export type Edge = SetRequired<Edge<EdgeData>, "data">;
2531
- type WithDimmed = {
2532
- data: {
2533
- dimmed?: Dimmed;
2534
- };
2535
- };
2536
- type WithHovered = {
2537
- data: {
2538
- hovered?: boolean;
2539
- };
2540
1990
  };
2541
- export function setDimmed<T extends WithDimmed>(value: T, dimmed: "immediate" | boolean): T;
2542
- export function setDimmed(dimmed: "immediate" | boolean): <T extends WithDimmed>(value: T) => T;
2543
- export function setHovered<T extends WithHovered>(value: T, hovered: boolean): T;
2544
- export function setHovered(hovered: boolean): <T extends WithHovered>(value: T) => T;
2545
- type WithData<D> = {
2546
- data: D;
2547
- };
2548
- export function setData<E extends WithData<any>>(value: E, state: Partial<E["data"]>): E;
2549
- export function setData<E extends WithData<any>>(state: Partial<E["data"]>): (value: E) => E;
2550
- export {};
2551
- }
1991
+ };
1992
+ declare function setDimmed<T extends WithDimmed>(value: T, dimmed: "immediate" | boolean): T;
1993
+ declare function setDimmed(dimmed: "immediate" | boolean): <T extends WithDimmed>(value: T) => T;
1994
+ declare function setHovered<T extends WithHovered>(value: T, hovered: boolean): T;
1995
+ declare function setHovered(hovered: boolean): <T extends WithHovered>(value: T) => T;
1996
+ type WithData<D> = {
1997
+ data: D;
1998
+ };
1999
+ declare function setData<E extends WithData<any>>(value: E, state: Partial<E["data"]>): E;
2000
+ declare function setData<E extends WithData<any>>(state: Partial<E["data"]>): (value: E) => E;
2001
+ type NodeProps$3<T extends Record<string, unknown> = {}, NodeType extends string = string> = NodeProps$1<Node$1<Base.NodeData & T, NodeType>>;
2002
+ type ReactFlowNode<Data extends Record<string, unknown>, NodeType extends string> = SetRequired<Node$1<Data, NodeType>, "type" | "initialWidth" | "initialHeight">;
2003
+ type ReactFlowEdge<Data extends Record<string, unknown>, EdgeType extends string> = SetRequired<Edge<Data, EdgeType>, "type" | "data">;
2552
2004
  type NonOptional<T extends object> = Simplify<{
2553
2005
  [P in Exclude<keyof T, OptionalKeysOf<T>>]: T[P];
2554
2006
  } & {
2555
2007
  [P in OptionalKeysOf<T>]-?: T[P] | undefined;
2556
2008
  }>;
2557
2009
  declare namespace Types {
2558
- type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "technology" | "description" | "color" | "shape" | "width" | "level" | "height" | "style" | "position">> & {
2010
+ type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "technology" | "description" | "color" | "shape" | "width" | "level" | "height" | "style" | "tags" | "position">> & {
2559
2011
  /**
2560
2012
  * View this node belongs to
2561
2013
  */
@@ -2579,10 +2031,10 @@ declare namespace Types {
2579
2031
  */
2580
2032
  type DeploymentElementNodeData = LeafNodeData & {
2581
2033
  navigateTo: ViewId | null;
2582
- deploymentFqn: Fqn;
2034
+ deploymentFqn: DeploymentFqn;
2583
2035
  modelFqn: Fqn | null;
2584
2036
  };
2585
- type CompoundNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "color" | "shape" | "style" | "position">> & {
2037
+ type CompoundNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "color" | "shape" | "style" | "tags" | "position">> & {
2586
2038
  /**
2587
2039
  * View this node belongs to
2588
2040
  */
@@ -2599,7 +2051,7 @@ declare namespace Types {
2599
2051
  navigateTo: ViewId | null;
2600
2052
  };
2601
2053
  type CompoundDeploymentNodeData = CompoundNodeData & {
2602
- deploymentFqn: Fqn;
2054
+ deploymentFqn: DeploymentFqn;
2603
2055
  /**
2604
2056
  * If set - this node refers to a model element
2605
2057
  */
@@ -2628,26 +2080,25 @@ declare namespace Types {
2628
2080
  type EdgeData = RelationshipEdgeData;
2629
2081
  }
2630
2082
  interface CustomNodes {
2631
- element?: undefined | ((props: NodeProps$2<Types.ElementNodeData, "element">) => ReactNode);
2632
- deployment?: undefined | ((props: NodeProps$2<Types.DeploymentElementNodeData, "deployment">) => ReactNode);
2633
- compoundElement?: undefined | ((props: NodeProps$2<Types.CompoundElementNodeData, "compound-element">) => ReactNode);
2634
- compoundDeployment?: undefined | ((props: NodeProps$2<Types.CompoundDeploymentNodeData, "compound-deployment">) => ReactNode);
2635
- viewGroup?: undefined | ((props: NodeProps$2<Types.ViewGroupNodeData, "view-group">) => ReactNode);
2083
+ element?: undefined | ((props: NodeProps$3<Types.ElementNodeData, "element">) => ReactNode);
2084
+ deployment?: undefined | ((props: NodeProps$3<Types.DeploymentElementNodeData, "deployment">) => ReactNode);
2085
+ compoundElement?: undefined | ((props: NodeProps$3<Types.CompoundElementNodeData, "compound-element">) => ReactNode);
2086
+ compoundDeployment?: undefined | ((props: NodeProps$3<Types.CompoundDeploymentNodeData, "compound-deployment">) => ReactNode);
2087
+ viewGroup?: undefined | ((props: NodeProps$3<Types.ViewGroupNodeData, "view-group">) => ReactNode);
2636
2088
  }
2637
- type DiagramNodeWithNavigate<ID = ViewId> = Omit<DiagramNode, "navigateTo"> & {
2638
- navigateTo: ID;
2639
- };
2089
+ type DiagramNodeWithNavigate<A extends Any> = SetRequired<DiagramNode<A>, "navigateTo">;
2640
2090
  type ElementIconRendererProps = {
2641
2091
  node: {
2642
2092
  id: string;
2643
2093
  title: string;
2644
2094
  icon?: string | null | undefined;
2645
2095
  };
2096
+ className?: string;
2646
2097
  };
2647
2098
  export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
2648
- type OnNavigateTo<ID = ViewId> = (to: ID, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<ID>) => void;
2649
- type OnNodeClick = (node: DiagramNode, event: ReactMouseEvent) => void;
2650
- type OnEdgeClick = (edge: DiagramEdge, event: ReactMouseEvent) => void;
2099
+ type OnNavigateTo<A extends Any> = (to: ViewId$1<A>, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<A>) => void;
2100
+ type OnNodeClick<A extends Any> = (node: DiagramNode<A>, event: ReactMouseEvent) => void;
2101
+ type OnEdgeClick<A extends Any> = (edge: DiagramEdge<A>, event: ReactMouseEvent) => void;
2651
2102
  type OnCanvasClick = (event: ReactMouseEvent) => void;
2652
2103
  type ChangeEvent = {
2653
2104
  change: ViewChange;
@@ -2656,8 +2107,8 @@ type OnChange = (event: ChangeEvent) => void;
2656
2107
  type OverrideReactFlowProps = Pick<ReactFlowProps, "paneClickDistance" | "nodeClickDistance" | "selectionKeyCode" | "panActivationKeyCode" | "multiSelectionKeyCode" | "zoomActivationKeyCode" | "snapToGrid" | "snapGrid" | "onlyRenderVisibleElements" | "nodesDraggable" | "nodesFocusable" | "elementsSelectable" | "selectNodesOnDrag" | "panOnDrag" | "preventScrolling" | "zoomOnScroll" | "zoomOnPinch" | "panOnScroll" | "panOnScrollSpeed" | "panOnScrollMode" | "zoomOnDoubleClick" | "nodeDragThreshold">;
2657
2108
  type PaddingUnit$1 = "px" | "%";
2658
2109
  type PaddingWithUnit$1 = `${number}${PaddingUnit$1}` | number;
2659
- interface LikeC4DiagramProperties {
2660
- view: DiagramView;
2110
+ interface LikeC4DiagramProperties<A extends Any> {
2111
+ view: LayoutedView<A>;
2661
2112
  className?: string | undefined;
2662
2113
  /**
2663
2114
  * Enable/disable panning
@@ -2751,6 +2202,11 @@ interface LikeC4DiagramProperties {
2751
2202
  * @default false
2752
2203
  */
2753
2204
  enableDynamicViewWalkthrough?: boolean | undefined;
2205
+ /**
2206
+ * Display element tags in the bottom left corner
2207
+ * @default true
2208
+ */
2209
+ enableElementTags?: boolean | undefined;
2754
2210
  /**
2755
2211
  * Experimental feature to enable edge editing
2756
2212
  * @default false
@@ -2778,41 +2234,41 @@ interface LikeC4DiagramProperties {
2778
2234
  /**
2779
2235
  * Dynamic filter, applies both to nodes and edges
2780
2236
  */
2781
- where?: WhereOperator<string, string> | undefined;
2237
+ where?: WhereOperator<A> | undefined;
2782
2238
  /**
2783
2239
  * Override ReactFlow props
2784
2240
  */
2785
2241
  reactFlowProps?: OverrideReactFlowProps | undefined;
2786
2242
  }
2787
- type OpenSourceParams = {
2788
- element: Fqn;
2243
+ type OpenSourceParams<A extends Any = Any> = {
2244
+ element: Fqn$1<A>;
2789
2245
  property?: string;
2790
2246
  } | {
2791
- relation: RelationId;
2247
+ relation: RelationId$1;
2792
2248
  } | {
2793
- deployment: Fqn;
2249
+ deployment: DeploymentFqn$1<A>;
2794
2250
  property?: string;
2795
2251
  } | {
2796
- view: ViewId;
2252
+ view: StrictViewId<A>;
2797
2253
  };
2798
- interface LikeC4DiagramEventHandlers {
2254
+ interface LikeC4DiagramEventHandlers<A extends Any> {
2799
2255
  onChange?: OnChange | null | undefined;
2800
- onNavigateTo?: OnNavigateTo | null | undefined;
2801
- onNodeClick?: OnNodeClick | null | undefined;
2802
- onNodeContextMenu?: OnNodeClick | null | undefined;
2256
+ onNavigateTo?: OnNavigateTo<A> | null | undefined;
2257
+ onNodeClick?: OnNodeClick<A> | null | undefined;
2258
+ onNodeContextMenu?: OnNodeClick<A> | null | undefined;
2803
2259
  onCanvasContextMenu?: OnCanvasClick | null | undefined;
2804
- onEdgeClick?: OnEdgeClick | null | undefined;
2805
- onEdgeContextMenu?: OnEdgeClick | null | undefined;
2260
+ onEdgeClick?: OnEdgeClick<A> | null | undefined;
2261
+ onEdgeContextMenu?: OnEdgeClick<A> | null | undefined;
2806
2262
  onCanvasClick?: OnCanvasClick | null | undefined;
2807
2263
  onCanvasDblClick?: OnCanvasClick | null | undefined;
2808
2264
  onBurgerMenuClick?: null | undefined | (() => void);
2809
- onOpenSource?: null | undefined | ((params: OpenSourceParams) => void);
2265
+ onOpenSource?: null | undefined | ((params: OpenSourceParams<A>) => void);
2810
2266
  }
2811
- export interface LikeC4ViewProps<ViewId = string, Tag = string, Kind = string> {
2267
+ export interface LikeC4ViewProps<A extends Any> {
2812
2268
  /**
2813
2269
  * View to display.
2814
2270
  */
2815
- viewId: ViewId;
2271
+ viewId: ViewId$1<A>;
2816
2272
  /**
2817
2273
  * Enable/disable panning
2818
2274
  * @default false
@@ -2899,6 +2355,11 @@ export interface LikeC4ViewProps<ViewId = string, Tag = string, Kind = string> {
2899
2355
  * @default false
2900
2356
  */
2901
2357
  enableElementDetails?: boolean | undefined;
2358
+ /**
2359
+ * Display element tags in the bottom left corner
2360
+ * @default false
2361
+ */
2362
+ enableElementTags?: boolean | undefined;
2902
2363
  /**
2903
2364
  * Experimental feature to browse relationships
2904
2365
  *
@@ -2916,7 +2377,7 @@ export interface LikeC4ViewProps<ViewId = string, Tag = string, Kind = string> {
2916
2377
  * @default 'auto' - will be set to true if view is pannable and has more than 3000 * 2000 pixels
2917
2378
  */
2918
2379
  reduceGraphics?: "auto" | boolean | undefined;
2919
- where?: WhereOperator<Tag, Kind> | undefined;
2380
+ where?: WhereOperator<A> | undefined;
2920
2381
  /**
2921
2382
  * Override some react flow props
2922
2383
  */
@@ -2998,6 +2459,11 @@ interface LikeC4BrowserProps {
2998
2459
  * @default enableRelationshipBrowser
2999
2460
  */
3000
2461
  enableRelationshipDetails?: boolean | undefined;
2462
+ /**
2463
+ * Display element tags in the bottom left corner
2464
+ * @default true
2465
+ */
2466
+ enableElementTags?: boolean | undefined;
3001
2467
  /**
3002
2468
  * Display notations of the view
3003
2469
  * @default true
@@ -3016,10 +2482,10 @@ interface LikeC4BrowserProps {
3016
2482
  */
3017
2483
  reactFlowProps?: OverrideReactFlowProps | undefined;
3018
2484
  }
3019
- export declare function LikeC4View<ViewId extends string = string, Tag = string, Kind = string>({ viewId, ...props }: LikeC4ViewProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
3020
- type LikeC4DiagramProps = PropsWithChildren<LikeC4DiagramProperties & LikeC4DiagramEventHandlers>;
3021
- export type ReactLikeC4Props<ViewId = string, Tag = string, Kind = string> = Omit<LikeC4DiagramProps, "view" | "where" | "onNavigateTo"> & {
3022
- viewId: ViewId;
2485
+ export declare function LikeC4View<A extends Any = UnknownLayouted>({ viewId, ...props }: LikeC4ViewProps<A>): import("react/jsx-runtime").JSX.Element;
2486
+ type LikeC4DiagramProps<A extends Any = Any> = PropsWithChildren<LikeC4DiagramProperties<A> & LikeC4DiagramEventHandlers<A>>;
2487
+ export type ReactLikeC4Props<A extends Any> = Omit<LikeC4DiagramProps<A>, "view"> & {
2488
+ viewId: ViewId$1<A>;
3023
2489
  /**
3024
2490
  * Keep aspect ratio of the diagram
3025
2491
  * Disable if you need to manage the viewport (use className)
@@ -3040,13 +2506,11 @@ export type ReactLikeC4Props<ViewId = string, Tag = string, Kind = string> = Omi
3040
2506
  */
3041
2507
  injectFontCss?: boolean | undefined;
3042
2508
  style?: CSSProperties | undefined;
3043
- where?: WhereOperator<Tag, Kind> | undefined;
3044
- onNavigateTo?: OnNavigateTo<ViewId> | undefined;
3045
2509
  mantineTheme?: any;
3046
2510
  /** Function to generate nonce attribute added to all generated `<style />` tags */
3047
2511
  styleNonce?: string | (() => string) | undefined;
3048
2512
  };
3049
- export declare function ReactLikeC4<ViewId extends string = string, Tag = string, Kind = string>({ viewId, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
2513
+ export declare function ReactLikeC4<A extends Any = UnknownLayouted>({ viewId, ...props }: ReactLikeC4Props<A>): import("react/jsx-runtime").JSX.Element;
3050
2514
  export declare namespace ReactLikeC4 {
3051
2515
  var displayName: string;
3052
2516
  }
@@ -3062,8 +2526,8 @@ export declare const ViewNotFound: ({ viewId }: {
3062
2526
  viewId: string;
3063
2527
  }) => import("react/jsx-runtime").JSX.Element;
3064
2528
  type AllKeys<T> = T extends any ? keyof T : never;
3065
- type Primitive$1 = boolean | number | string;
3066
- type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends (...args: any) => any ? Value : Value extends Primitive$1 ? Value : Value extends object ? Readonly<Value> : Value;
2529
+ type Primitive = boolean | number | string;
2530
+ type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends (...args: any) => any ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
3067
2531
  interface ReadableAtom<Value = any> {
3068
2532
  /**
3069
2533
  * Get store value.
@@ -3318,8 +2782,11 @@ interface UseStoreOptions<SomeStore> {
3318
2782
  declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
3319
2783
  export declare const createHooksForModel: ($atom: WritableAtom) => any;
3320
2784
 
2785
+ declare namespace Base {
2786
+ export { Dimmed, Edge$1 as Edge, EdgeData, Node$1 as Node, NodeData, NodeProps$2 as NodeProps, setData, setDimmed, setHovered };
2787
+ }
3321
2788
  declare namespace nano {
3322
- export { Atom, WritableAtom, atom, batched, computed, map, useStore };
2789
+ export { Atom, ReadableAtom, WritableAtom, atom, batched, computed, map, useStore };
3323
2790
  }
3324
2791
 
3325
2792
  export {