likec4 1.27.2 → 1.28.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/__app__/src/main.js +725 -626
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +548 -545
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/likec4.10Nsb-Q7.mjs +2192 -0
- package/dist/shared/{likec4.CfxVv3pJ.mjs → likec4.7Lz9HWDi.mjs} +1 -1
- package/dist/shared/{likec4.QmEWuoHf.d.mts → likec4.DwrogUe0.d.mts} +22 -22
- package/dist/vite-plugin/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +1 -1
- package/package.json +21 -21
- package/react/index.d.mts +473 -195
- package/react/index.mjs +27 -27
- package/dist/shared/likec4.D_S6au6n.mjs +0 -2199
package/react/index.d.mts
CHANGED
|
@@ -21,6 +21,30 @@ type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{
|
|
|
21
21
|
}>;
|
|
22
22
|
type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
|
|
23
23
|
type TupleToUnion<ArrayType> = ArrayType extends readonly unknown[] ? ArrayType[number] : never;
|
|
24
|
+
type NonEmptyArray<T> = [
|
|
25
|
+
T,
|
|
26
|
+
...T[]
|
|
27
|
+
];
|
|
28
|
+
type Point = readonly [
|
|
29
|
+
x: number,
|
|
30
|
+
y: number
|
|
31
|
+
];
|
|
32
|
+
interface XYPoint {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
}
|
|
36
|
+
type AllNever<Expressions> = UnionToIntersection<{
|
|
37
|
+
[Name in keyof Expressions]: {
|
|
38
|
+
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
39
|
+
};
|
|
40
|
+
}[keyof Expressions]>;
|
|
41
|
+
type ExclusiveUnion<Expressions> = Expressions extends object ? {
|
|
42
|
+
[Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
|
|
43
|
+
}[keyof Expressions] : Expressions;
|
|
44
|
+
type ProjectId = Tagged<string, "ProjectID">;
|
|
45
|
+
type IconUrl = Tagged<string, "IconUrl"> | "none";
|
|
46
|
+
type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
|
|
47
|
+
type Tag$1<Tags extends string = string> = Tagged<Tags, "Tag">;
|
|
24
48
|
declare const ThemeColors: readonly [
|
|
25
49
|
"amber",
|
|
26
50
|
"blue",
|
|
@@ -56,28 +80,6 @@ interface ThemeColorValues {
|
|
|
56
80
|
elements: ElementThemeColorValues;
|
|
57
81
|
relationships: RelationshipThemeColorValues;
|
|
58
82
|
}
|
|
59
|
-
type NonEmptyArray<T> = [
|
|
60
|
-
T,
|
|
61
|
-
...T[]
|
|
62
|
-
];
|
|
63
|
-
type IconUrl = Tagged<string, "IconUrl"> | "none";
|
|
64
|
-
type Point = readonly [
|
|
65
|
-
x: number,
|
|
66
|
-
y: number
|
|
67
|
-
];
|
|
68
|
-
interface XYPoint {
|
|
69
|
-
x: number;
|
|
70
|
-
y: number;
|
|
71
|
-
}
|
|
72
|
-
type AllNever<Expressions> = UnionToIntersection<{
|
|
73
|
-
[Name in keyof Expressions]: {
|
|
74
|
-
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
75
|
-
};
|
|
76
|
-
}[keyof Expressions]>;
|
|
77
|
-
type ExclusiveUnion<Expressions> = Expressions extends object ? {
|
|
78
|
-
[Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
|
|
79
|
-
}[keyof Expressions] : Expressions;
|
|
80
|
-
type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
|
|
81
83
|
declare const BorderStyles: readonly [
|
|
82
84
|
"solid",
|
|
83
85
|
"dashed",
|
|
@@ -121,7 +123,6 @@ interface ElementStyle {
|
|
|
121
123
|
readonly padding?: SpacingSize;
|
|
122
124
|
readonly textSize?: TextSize;
|
|
123
125
|
}
|
|
124
|
-
type Tag$1<Tags extends string = string> = Tagged<Tags, "Tag">;
|
|
125
126
|
interface Link {
|
|
126
127
|
readonly title?: string;
|
|
127
128
|
readonly url: string;
|
|
@@ -163,109 +164,6 @@ type OrOperator<Tag, Kind> = Omit<AllNever$1, "or"> & {
|
|
|
163
164
|
or: NonEmptyArray<WhereOperator<Tag, Kind>>;
|
|
164
165
|
};
|
|
165
166
|
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
166
|
-
interface BaseExpr {
|
|
167
|
-
where?: never;
|
|
168
|
-
element?: never;
|
|
169
|
-
custom?: never;
|
|
170
|
-
expanded?: never;
|
|
171
|
-
elementKind?: never;
|
|
172
|
-
elementTag?: never;
|
|
173
|
-
isEqual?: never;
|
|
174
|
-
isChildren?: never;
|
|
175
|
-
isDescendants?: never;
|
|
176
|
-
wildcard?: never;
|
|
177
|
-
source?: never;
|
|
178
|
-
target?: never;
|
|
179
|
-
inout?: never;
|
|
180
|
-
incoming?: never;
|
|
181
|
-
outgoing?: never;
|
|
182
|
-
customRelation?: never;
|
|
183
|
-
}
|
|
184
|
-
interface ElementRefExpr extends Omit<BaseExpr, "element" | "isChildren" | "isDescendants"> {
|
|
185
|
-
element: Fqn;
|
|
186
|
-
isChildren?: boolean;
|
|
187
|
-
isDescendants?: boolean;
|
|
188
|
-
}
|
|
189
|
-
interface ExpandedElementExpr extends Omit<BaseExpr, "expanded"> {
|
|
190
|
-
expanded: Fqn;
|
|
191
|
-
}
|
|
192
|
-
interface CustomElementExpr extends Omit<BaseExpr, "custom"> {
|
|
193
|
-
custom: {
|
|
194
|
-
expr: ElementExpression | ElementWhereExpr;
|
|
195
|
-
title?: string;
|
|
196
|
-
description?: string;
|
|
197
|
-
technology?: string;
|
|
198
|
-
notation?: string;
|
|
199
|
-
shape?: ElementShape;
|
|
200
|
-
color?: Color;
|
|
201
|
-
icon?: IconUrl;
|
|
202
|
-
border?: BorderStyle;
|
|
203
|
-
opacity?: number;
|
|
204
|
-
navigateTo?: ViewId;
|
|
205
|
-
multiple?: boolean;
|
|
206
|
-
size?: ShapeSize;
|
|
207
|
-
padding?: ShapeSize;
|
|
208
|
-
textSize?: ShapeSize;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
interface WildcardExpr extends Omit<BaseExpr, "wildcard"> {
|
|
212
|
-
wildcard: true;
|
|
213
|
-
}
|
|
214
|
-
interface ElementKindExpr extends Omit<BaseExpr, "elementKind" | "isEqual"> {
|
|
215
|
-
elementKind: ElementKind;
|
|
216
|
-
isEqual: boolean;
|
|
217
|
-
}
|
|
218
|
-
interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
|
|
219
|
-
elementTag: Tag$1;
|
|
220
|
-
isEqual: boolean;
|
|
221
|
-
}
|
|
222
|
-
type NonWilcard = ElementRefExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
|
|
223
|
-
type ElementExpression = NonWilcard | WildcardExpr;
|
|
224
|
-
interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
|
|
225
|
-
where: {
|
|
226
|
-
expr: ElementExpression;
|
|
227
|
-
condition: WhereOperator<string, string>;
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
|
|
231
|
-
interface DirectRelationExpr extends Omit<BaseExpr, "source" | "target"> {
|
|
232
|
-
source: ElementExpression;
|
|
233
|
-
target: ElementExpression;
|
|
234
|
-
isBidirectional?: boolean;
|
|
235
|
-
}
|
|
236
|
-
interface InOutExpr extends Omit<BaseExpr, "inout"> {
|
|
237
|
-
inout: ElementExpression;
|
|
238
|
-
}
|
|
239
|
-
interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
|
|
240
|
-
incoming: ElementExpression;
|
|
241
|
-
}
|
|
242
|
-
interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
|
|
243
|
-
outgoing: ElementExpression;
|
|
244
|
-
}
|
|
245
|
-
type RelationExpression = DirectRelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
|
|
246
|
-
interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
|
|
247
|
-
where: {
|
|
248
|
-
expr: RelationExpression;
|
|
249
|
-
condition: WhereOperator<string, string>;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
|
|
253
|
-
customRelation: {
|
|
254
|
-
relation: RelationExpression | RelationWhereExpr;
|
|
255
|
-
title?: string;
|
|
256
|
-
description?: string;
|
|
257
|
-
technology?: string;
|
|
258
|
-
notation?: string;
|
|
259
|
-
navigateTo?: ViewId;
|
|
260
|
-
notes?: string;
|
|
261
|
-
color?: Color;
|
|
262
|
-
line?: RelationshipLineType;
|
|
263
|
-
head?: RelationshipArrowType;
|
|
264
|
-
tail?: RelationshipArrowType;
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
|
|
268
|
-
type Expression = ElementPredicateExpression | RelationPredicateExpression;
|
|
269
167
|
declare namespace FqnRef {
|
|
270
168
|
/**
|
|
271
169
|
* Represents a reference to an instance within a deployment.
|
|
@@ -300,85 +198,410 @@ declare namespace FqnRef {
|
|
|
300
198
|
model: F;
|
|
301
199
|
};
|
|
302
200
|
const isModelRef: (ref: FqnRef) => ref is ModelRef;
|
|
201
|
+
/**
|
|
202
|
+
* Reference to imported logical model element
|
|
203
|
+
*/
|
|
204
|
+
type ImportRef<F = Fqn> = {
|
|
205
|
+
project: ProjectId;
|
|
206
|
+
model: F;
|
|
207
|
+
};
|
|
208
|
+
const isImportRef: (ref: FqnRef) => ref is ImportRef;
|
|
303
209
|
const toDeploymentRef: (ref: FqnRef) => DeploymentRef;
|
|
210
|
+
const toModelFqn: (ref: FqnRef) => Fqn;
|
|
304
211
|
}
|
|
305
212
|
type FqnRef<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
306
213
|
InsideInstanceRef: FqnRef.InsideInstanceRef<D, M>;
|
|
307
214
|
DeploymentRef: FqnRef.DeploymentRef<D>;
|
|
308
215
|
ModelRef: FqnRef.ModelRef<M>;
|
|
216
|
+
ImportRef: FqnRef.ImportRef<M>;
|
|
309
217
|
}>;
|
|
310
218
|
declare namespace FqnExpr {
|
|
311
219
|
type Wildcard = {
|
|
312
220
|
wildcard: true;
|
|
313
221
|
};
|
|
314
|
-
const isWildcard: (expr: ExpressionV2) => expr is Wildcard;
|
|
222
|
+
const isWildcard: (expr: ExpressionV2) => expr is FqnExpr.Wildcard;
|
|
315
223
|
type ModelRef<M = Fqn> = {
|
|
316
|
-
ref: FqnRef.ModelRef<M>;
|
|
224
|
+
ref: FqnRef.ModelRef<M> | FqnRef.ImportRef<M>;
|
|
317
225
|
selector?: PredicateSelector;
|
|
318
226
|
};
|
|
319
|
-
const isModelRef: (ref: ExpressionV2) => ref is ModelRef;
|
|
227
|
+
const isModelRef: (ref: ExpressionV2) => ref is FqnExpr.ModelRef;
|
|
320
228
|
type DeploymentRef<D = Fqn, M = Fqn> = {
|
|
321
229
|
ref: FqnRef.DeploymentRef<D> | FqnRef.InsideInstanceRef<D, M>;
|
|
322
230
|
selector?: PredicateSelector;
|
|
323
231
|
};
|
|
324
232
|
const isDeploymentRef: (ref: ExpressionV2) => ref is FqnExpr.DeploymentRef;
|
|
233
|
+
type ElementKindExpr = {
|
|
234
|
+
elementKind: ElementKind;
|
|
235
|
+
isEqual: boolean;
|
|
236
|
+
};
|
|
237
|
+
function isElementKindExpr(expr: ExpressionV2): expr is ElementKindExpr;
|
|
238
|
+
type ElementTagExpr = {
|
|
239
|
+
elementTag: Tag$1;
|
|
240
|
+
isEqual: boolean;
|
|
241
|
+
};
|
|
242
|
+
function isElementTagExpr(expr: ExpressionV2): expr is ElementTagExpr;
|
|
325
243
|
type NonWildcard<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
326
244
|
ModelRef: ModelRef<M>;
|
|
327
245
|
DeploymentRef: DeploymentRef<D, M>;
|
|
246
|
+
ElementKind: ElementKindExpr;
|
|
247
|
+
ElementTag: ElementTagExpr;
|
|
248
|
+
}>;
|
|
249
|
+
type Where<D = Fqn, M = Fqn> = {
|
|
250
|
+
where: {
|
|
251
|
+
expr: ExclusiveUnion<{
|
|
252
|
+
Wildcard: Wildcard;
|
|
253
|
+
ModelRef: ModelRef<M>;
|
|
254
|
+
DeploymentRef: DeploymentRef<D, M>;
|
|
255
|
+
ElementKind: ElementKindExpr;
|
|
256
|
+
ElementTag: ElementTagExpr;
|
|
257
|
+
}>;
|
|
258
|
+
condition: WhereOperator<string, string>;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
const isWhere: (expr: ExpressionV2) => expr is FqnExpr.Where;
|
|
262
|
+
type Custom<D = Fqn, M = Fqn> = {
|
|
263
|
+
custom: {
|
|
264
|
+
expr: OrWhere<D, M>;
|
|
265
|
+
title?: string;
|
|
266
|
+
description?: string;
|
|
267
|
+
technology?: string;
|
|
268
|
+
notation?: string;
|
|
269
|
+
shape?: ElementShape;
|
|
270
|
+
color?: Color;
|
|
271
|
+
icon?: IconUrl;
|
|
272
|
+
border?: BorderStyle;
|
|
273
|
+
opacity?: number;
|
|
274
|
+
navigateTo?: ViewId;
|
|
275
|
+
multiple?: boolean;
|
|
276
|
+
size?: ShapeSize;
|
|
277
|
+
padding?: ShapeSize;
|
|
278
|
+
textSize?: ShapeSize;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
const isCustom: (expr: ExpressionV2) => expr is Custom;
|
|
282
|
+
const is: (expr: ExpressionV2) => expr is FqnExpr;
|
|
283
|
+
type OrWhere<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
284
|
+
Wildcard: FqnExpr.Wildcard;
|
|
285
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
286
|
+
DeploymentRef: FqnExpr.DeploymentRef<D, M>;
|
|
287
|
+
ElementKind: ElementKindExpr;
|
|
288
|
+
ElementTag: ElementTagExpr;
|
|
289
|
+
Where: FqnExpr.Where<D, M>;
|
|
290
|
+
}>;
|
|
291
|
+
type Any<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
292
|
+
Wildcard: Wildcard;
|
|
293
|
+
ModelRef: ModelRef<M>;
|
|
294
|
+
DeploymentRef: DeploymentRef<D, M>;
|
|
295
|
+
ElementKind: ElementKindExpr;
|
|
296
|
+
ElementTag: ElementTagExpr;
|
|
297
|
+
Where: Where<D, M>;
|
|
298
|
+
Custom: Custom<D, M>;
|
|
328
299
|
}>;
|
|
300
|
+
const unwrap: (expr: FqnExpr) => Wildcard | ModelRef | DeploymentRef | ElementKindExpr | ElementTagExpr;
|
|
329
301
|
}
|
|
330
302
|
type FqnExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
331
303
|
Wildcard: FqnExpr.Wildcard;
|
|
332
304
|
ModelRef: FqnExpr.ModelRef<M>;
|
|
333
305
|
DeploymentRef: FqnExpr.DeploymentRef<D, M>;
|
|
306
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
307
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
334
308
|
}>;
|
|
335
309
|
declare namespace RelationExpr {
|
|
310
|
+
type Endpoint<D = Fqn, M = Fqn> = FqnExpr.Where<D, M>["where"]["expr"];
|
|
336
311
|
type Direct<D = Fqn, M = Fqn> = {
|
|
337
|
-
source:
|
|
338
|
-
target:
|
|
312
|
+
source: Endpoint<D, M>;
|
|
313
|
+
target: Endpoint<D, M>;
|
|
339
314
|
isBidirectional?: boolean;
|
|
340
315
|
};
|
|
341
|
-
const isDirect: (expr: ExpressionV2) => expr is Direct;
|
|
316
|
+
const isDirect: (expr: ExpressionV2) => expr is RelationExpr.Direct;
|
|
342
317
|
type Incoming<D = Fqn, M = Fqn> = {
|
|
343
|
-
incoming:
|
|
318
|
+
incoming: Endpoint<D, M>;
|
|
344
319
|
};
|
|
345
|
-
const isIncoming: (expr: ExpressionV2) => expr is Incoming;
|
|
320
|
+
const isIncoming: (expr: ExpressionV2) => expr is RelationExpr.Incoming;
|
|
346
321
|
type Outgoing<D = Fqn, M = Fqn> = {
|
|
347
|
-
outgoing:
|
|
322
|
+
outgoing: Endpoint<D, M>;
|
|
348
323
|
};
|
|
349
|
-
const isOutgoing: (expr: ExpressionV2) => expr is Outgoing;
|
|
324
|
+
const isOutgoing: (expr: ExpressionV2) => expr is RelationExpr.Outgoing;
|
|
350
325
|
type InOut<D = Fqn, M = Fqn> = {
|
|
351
|
-
inout:
|
|
326
|
+
inout: Endpoint<D, M>;
|
|
352
327
|
};
|
|
353
|
-
const isInOut: (expr: ExpressionV2) => expr is InOut;
|
|
328
|
+
const isInOut: (expr: ExpressionV2) => expr is RelationExpr.InOut;
|
|
354
329
|
type Where<D = Fqn, M = Fqn> = {
|
|
355
330
|
where: {
|
|
356
|
-
expr:
|
|
331
|
+
expr: ExclusiveUnion<{
|
|
332
|
+
Direct: RelationExpr.Direct<D, M>;
|
|
333
|
+
Incoming: RelationExpr.Incoming<D, M>;
|
|
334
|
+
Outgoing: RelationExpr.Outgoing<D, M>;
|
|
335
|
+
InOut: RelationExpr.InOut<D, M>;
|
|
336
|
+
}>;
|
|
357
337
|
condition: WhereOperator<string, string>;
|
|
358
338
|
};
|
|
359
339
|
};
|
|
360
|
-
const isWhere: (expr: ExpressionV2) => expr is Where;
|
|
340
|
+
const isWhere: (expr: ExpressionV2) => expr is RelationExpr.Where;
|
|
341
|
+
type Custom<D = Fqn, M = Fqn> = {
|
|
342
|
+
customRelation: {
|
|
343
|
+
expr: OrWhere<D, M>;
|
|
344
|
+
title?: string;
|
|
345
|
+
description?: string;
|
|
346
|
+
technology?: string;
|
|
347
|
+
notation?: string;
|
|
348
|
+
navigateTo?: ViewId;
|
|
349
|
+
notes?: string;
|
|
350
|
+
color?: Color;
|
|
351
|
+
line?: RelationshipLineType;
|
|
352
|
+
head?: RelationshipArrowType;
|
|
353
|
+
tail?: RelationshipArrowType;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
const isCustom: (expr: ExpressionV2) => expr is Custom;
|
|
357
|
+
const is: (expr: ExpressionV2) => expr is RelationExpr;
|
|
358
|
+
type OrWhere<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
359
|
+
Direct: Direct<D, M>;
|
|
360
|
+
Incoming: Incoming<D, M>;
|
|
361
|
+
Outgoing: Outgoing<D, M>;
|
|
362
|
+
InOut: InOut<D, M>;
|
|
363
|
+
Where: Where<D, M>;
|
|
364
|
+
}>;
|
|
365
|
+
type Any<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
366
|
+
Direct: Direct<D, M>;
|
|
367
|
+
Incoming: Incoming<D, M>;
|
|
368
|
+
Outgoing: Outgoing<D, M>;
|
|
369
|
+
InOut: InOut<D, M>;
|
|
370
|
+
Where: Where<D, M>;
|
|
371
|
+
Custom: Custom<D, M>;
|
|
372
|
+
}>;
|
|
373
|
+
const unwrap: (expr: RelationExpr) => Direct | Incoming | Outgoing | InOut;
|
|
361
374
|
}
|
|
362
375
|
type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
363
376
|
Direct: RelationExpr.Direct<D, M>;
|
|
364
377
|
Incoming: RelationExpr.Incoming<D, M>;
|
|
365
378
|
Outgoing: RelationExpr.Outgoing<D, M>;
|
|
366
379
|
InOut: RelationExpr.InOut<D, M>;
|
|
367
|
-
Where: RelationExpr.Where<D, M>;
|
|
368
380
|
}>;
|
|
369
381
|
type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
370
382
|
Wildcard: FqnExpr.Wildcard;
|
|
371
383
|
ModelRef: FqnExpr.ModelRef<M>;
|
|
372
384
|
DeploymentRef: FqnExpr.DeploymentRef<D, M>;
|
|
385
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
386
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
387
|
+
Custom: FqnExpr.Custom<D, M>;
|
|
373
388
|
Direct: RelationExpr.Direct<D, M>;
|
|
374
389
|
Incoming: RelationExpr.Incoming<D, M>;
|
|
375
390
|
Outgoing: RelationExpr.Outgoing<D, M>;
|
|
376
391
|
InOut: RelationExpr.InOut<D, M>;
|
|
377
|
-
|
|
392
|
+
Where: ExpressionV2.Where<D, M>;
|
|
393
|
+
CustomRelation: RelationExpr.Custom<D, M>;
|
|
378
394
|
}>;
|
|
379
395
|
declare namespace ExpressionV2 {
|
|
380
|
-
|
|
381
|
-
const
|
|
396
|
+
type Where<D = Fqn, M = Fqn> = FqnExpr.Where<D, M> | RelationExpr.Where<D, M>;
|
|
397
|
+
const isWhere: (expr: ExpressionV2) => expr is ExpressionV2.Where;
|
|
398
|
+
const isRelationWhere: (expr: ExpressionV2) => expr is RelationExpr.Where;
|
|
399
|
+
const isFqnExprWhere: (expr: ExpressionV2) => expr is FqnExpr.Where;
|
|
400
|
+
const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr.Any;
|
|
401
|
+
const isRelation: (expr: ExpressionV2) => expr is RelationExpr.Any;
|
|
402
|
+
}
|
|
403
|
+
declare namespace ModelLayer {
|
|
404
|
+
namespace FqnRef {
|
|
405
|
+
/**
|
|
406
|
+
* Reference to logical model element
|
|
407
|
+
*/
|
|
408
|
+
type ModelRef<F = Fqn> = {
|
|
409
|
+
model: F;
|
|
410
|
+
};
|
|
411
|
+
const isModelRef: (ref: FqnRef) => ref is ModelRef;
|
|
412
|
+
/**
|
|
413
|
+
* Reference to imported logical model element
|
|
414
|
+
*/
|
|
415
|
+
type ImportRef<F = Fqn> = {
|
|
416
|
+
project: ProjectId;
|
|
417
|
+
model: F;
|
|
418
|
+
};
|
|
419
|
+
const isImportRef: (ref: FqnRef) => ref is ImportRef;
|
|
420
|
+
const toFqn: (ref: FqnRef) => Fqn;
|
|
421
|
+
}
|
|
422
|
+
type FqnRef<M = Fqn> = ExclusiveUnion<{
|
|
423
|
+
ModelRef: FqnRef.ModelRef<M>;
|
|
424
|
+
ImportRef: FqnRef.ImportRef<M>;
|
|
425
|
+
}>;
|
|
426
|
+
namespace FqnExpr {
|
|
427
|
+
type Wildcard = {
|
|
428
|
+
wildcard: true;
|
|
429
|
+
};
|
|
430
|
+
const isWildcard: (expr: Expression) => expr is FqnExpr.Wildcard;
|
|
431
|
+
type ModelRef<M = Fqn> = {
|
|
432
|
+
ref: FqnRef.ModelRef<M> | FqnRef.ImportRef<M>;
|
|
433
|
+
selector?: PredicateSelector;
|
|
434
|
+
};
|
|
435
|
+
const isModelRef: (ref: Expression) => ref is FqnExpr.ModelRef;
|
|
436
|
+
type ElementKindExpr = {
|
|
437
|
+
elementKind: ElementKind;
|
|
438
|
+
isEqual: boolean;
|
|
439
|
+
};
|
|
440
|
+
function isElementKindExpr(expr: Expression): expr is ElementKindExpr;
|
|
441
|
+
type ElementTagExpr = {
|
|
442
|
+
elementTag: Tag$1;
|
|
443
|
+
isEqual: boolean;
|
|
444
|
+
};
|
|
445
|
+
function isElementTagExpr(expr: Expression): expr is ElementTagExpr;
|
|
446
|
+
type NonWildcard<M = Fqn> = ExclusiveUnion<{
|
|
447
|
+
ModelRef: ModelRef<M>;
|
|
448
|
+
ElementKind: ElementKindExpr;
|
|
449
|
+
ElementTag: ElementTagExpr;
|
|
450
|
+
}>;
|
|
451
|
+
type Where<M = Fqn> = {
|
|
452
|
+
where: {
|
|
453
|
+
expr: ExclusiveUnion<{
|
|
454
|
+
Wildcard: Wildcard;
|
|
455
|
+
ModelRef: ModelRef<M>;
|
|
456
|
+
ElementKind: ElementKindExpr;
|
|
457
|
+
ElementTag: ElementTagExpr;
|
|
458
|
+
}>;
|
|
459
|
+
condition: WhereOperator<string, string>;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
const isWhere: (expr: Expression) => expr is FqnExpr.Where;
|
|
463
|
+
type Custom<M = Fqn> = {
|
|
464
|
+
custom: {
|
|
465
|
+
expr: FqnExprOrWhere<M>;
|
|
466
|
+
title?: string;
|
|
467
|
+
description?: string;
|
|
468
|
+
technology?: string;
|
|
469
|
+
notation?: string;
|
|
470
|
+
shape?: ElementShape;
|
|
471
|
+
color?: Color;
|
|
472
|
+
icon?: IconUrl;
|
|
473
|
+
border?: BorderStyle;
|
|
474
|
+
opacity?: number;
|
|
475
|
+
navigateTo?: ViewId;
|
|
476
|
+
multiple?: boolean;
|
|
477
|
+
size?: ShapeSize;
|
|
478
|
+
padding?: ShapeSize;
|
|
479
|
+
textSize?: ShapeSize;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
const isCustom: (expr: Expression) => expr is FqnExpr.Custom;
|
|
483
|
+
const is: (expr: Expression) => expr is FqnExpr;
|
|
484
|
+
}
|
|
485
|
+
type FqnExpr<M = Fqn> = ExclusiveUnion<{
|
|
486
|
+
Wildcard: FqnExpr.Wildcard;
|
|
487
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
488
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
489
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
490
|
+
}>;
|
|
491
|
+
type FqnExprOrWhere<M = Fqn> = ExclusiveUnion<{
|
|
492
|
+
Wildcard: FqnExpr.Wildcard;
|
|
493
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
494
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
495
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
496
|
+
Where: FqnExpr.Where<M>;
|
|
497
|
+
}>;
|
|
498
|
+
type AnyFqnExpr<M = Fqn> = ExclusiveUnion<{
|
|
499
|
+
Wildcard: FqnExpr.Wildcard;
|
|
500
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
501
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
502
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
503
|
+
Where: FqnExpr.Where<M>;
|
|
504
|
+
Custom: FqnExpr.Custom<M>;
|
|
505
|
+
}>;
|
|
506
|
+
function isAnyFqnExpr(expr: Expression): expr is AnyFqnExpr;
|
|
507
|
+
namespace RelationExpr {
|
|
508
|
+
type Direct<M = Fqn> = {
|
|
509
|
+
source: FqnExpr<M>;
|
|
510
|
+
target: FqnExpr<M>;
|
|
511
|
+
isBidirectional?: boolean;
|
|
512
|
+
};
|
|
513
|
+
const isDirect: (expr: Expression) => expr is RelationExpr.Direct;
|
|
514
|
+
type Incoming<M = Fqn> = {
|
|
515
|
+
incoming: FqnExpr<M>;
|
|
516
|
+
};
|
|
517
|
+
const isIncoming: (expr: Expression) => expr is RelationExpr.Incoming;
|
|
518
|
+
type Outgoing<M = Fqn> = {
|
|
519
|
+
outgoing: FqnExpr<M>;
|
|
520
|
+
};
|
|
521
|
+
const isOutgoing: (expr: Expression) => expr is RelationExpr.Outgoing;
|
|
522
|
+
type InOut<M = Fqn> = {
|
|
523
|
+
inout: FqnExpr<M>;
|
|
524
|
+
};
|
|
525
|
+
const isInOut: (expr: Expression) => expr is RelationExpr.InOut;
|
|
526
|
+
type Where<M = Fqn> = {
|
|
527
|
+
where: {
|
|
528
|
+
expr: ExclusiveUnion<{
|
|
529
|
+
Direct: RelationExpr.Direct<M>;
|
|
530
|
+
Incoming: RelationExpr.Incoming<M>;
|
|
531
|
+
Outgoing: RelationExpr.Outgoing<M>;
|
|
532
|
+
InOut: RelationExpr.InOut<M>;
|
|
533
|
+
}>;
|
|
534
|
+
condition: WhereOperator<string, string>;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
const isWhere: (expr: Expression) => expr is RelationExpr.Where;
|
|
538
|
+
type Custom<M = Fqn> = {
|
|
539
|
+
customRelation: {
|
|
540
|
+
expr: RelationExprOrWhere<M>;
|
|
541
|
+
title?: string;
|
|
542
|
+
description?: string;
|
|
543
|
+
technology?: string;
|
|
544
|
+
notation?: string;
|
|
545
|
+
navigateTo?: ViewId;
|
|
546
|
+
notes?: string;
|
|
547
|
+
color?: Color;
|
|
548
|
+
line?: RelationshipLineType;
|
|
549
|
+
head?: RelationshipArrowType;
|
|
550
|
+
tail?: RelationshipArrowType;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
const isCustom: (expr: Expression) => expr is Custom;
|
|
554
|
+
const is: (expr: Expression) => expr is RelationExpr;
|
|
555
|
+
}
|
|
556
|
+
type RelationExpr<M = Fqn> = ExclusiveUnion<{
|
|
557
|
+
Direct: RelationExpr.Direct<M>;
|
|
558
|
+
Incoming: RelationExpr.Incoming<M>;
|
|
559
|
+
Outgoing: RelationExpr.Outgoing<M>;
|
|
560
|
+
InOut: RelationExpr.InOut<M>;
|
|
561
|
+
}>;
|
|
562
|
+
type RelationExprOrWhere<M = Fqn> = ExclusiveUnion<{
|
|
563
|
+
Direct: RelationExpr.Direct<M>;
|
|
564
|
+
Incoming: RelationExpr.Incoming<M>;
|
|
565
|
+
Outgoing: RelationExpr.Outgoing<M>;
|
|
566
|
+
InOut: RelationExpr.InOut<M>;
|
|
567
|
+
Where: RelationExpr.Where<M>;
|
|
568
|
+
}>;
|
|
569
|
+
type AnyRelationExpr<M = Fqn> = ExclusiveUnion<{
|
|
570
|
+
Direct: RelationExpr.Direct<M>;
|
|
571
|
+
Incoming: RelationExpr.Incoming<M>;
|
|
572
|
+
Outgoing: RelationExpr.Outgoing<M>;
|
|
573
|
+
InOut: RelationExpr.InOut<M>;
|
|
574
|
+
Where: RelationExpr.Where<M>;
|
|
575
|
+
CustomRelation: RelationExpr.Custom<M>;
|
|
576
|
+
}>;
|
|
577
|
+
function isAnyRelationExpr(expr: Expression): expr is AnyRelationExpr;
|
|
578
|
+
/**
|
|
579
|
+
* Represents a version 2 expression which can be one of several types.
|
|
580
|
+
*
|
|
581
|
+
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
582
|
+
*/
|
|
583
|
+
type Expression<M = Fqn> = ExclusiveUnion<{
|
|
584
|
+
Wildcard: FqnExpr.Wildcard;
|
|
585
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
586
|
+
ElementKind: FqnExpr.ElementKindExpr;
|
|
587
|
+
ElementTag: FqnExpr.ElementTagExpr;
|
|
588
|
+
Custom: FqnExpr.Custom<M>;
|
|
589
|
+
Direct: RelationExpr.Direct<M>;
|
|
590
|
+
Incoming: RelationExpr.Incoming<M>;
|
|
591
|
+
Outgoing: RelationExpr.Outgoing<M>;
|
|
592
|
+
InOut: RelationExpr.InOut<M>;
|
|
593
|
+
CustomRelation: RelationExpr.Custom<M>;
|
|
594
|
+
Where: Expression.Where<M>;
|
|
595
|
+
}>;
|
|
596
|
+
function isExpression(expr: any): expr is Expression;
|
|
597
|
+
namespace Expression {
|
|
598
|
+
type Where<M = Fqn> = FqnExpr.Where<M> | RelationExpr.Where<M>;
|
|
599
|
+
const isWhere: (expr: Expression) => expr is Expression.Where;
|
|
600
|
+
const isCustomFqnExpr: (expr: Expression) => expr is FqnExpr.Custom;
|
|
601
|
+
const isCustomRelationExpr: (expr: Expression) => expr is RelationExpr.Custom;
|
|
602
|
+
const isFqnExpr: (expr: Expression) => expr is FqnExpr;
|
|
603
|
+
const isRelation: (expr: Expression) => expr is RelationExpr;
|
|
604
|
+
}
|
|
382
605
|
}
|
|
383
606
|
type GlobalPredicateId = Tagged<string, "GlobalPredicateId">;
|
|
384
607
|
type GlobalStyleID = Tagged<string, "GlobalStyleID">;
|
|
@@ -390,17 +613,17 @@ type ElementNotation = {
|
|
|
390
613
|
};
|
|
391
614
|
type ViewId<Id extends string = string> = Tagged<Id, "ViewID">;
|
|
392
615
|
type ViewRulePredicate = {
|
|
393
|
-
include: Expression[];
|
|
616
|
+
include: ModelLayer.Expression[];
|
|
394
617
|
exclude?: never;
|
|
395
618
|
} | {
|
|
396
619
|
include?: never;
|
|
397
|
-
exclude: Expression[];
|
|
620
|
+
exclude: ModelLayer.Expression[];
|
|
398
621
|
};
|
|
399
622
|
interface ViewRuleGlobalPredicateRef {
|
|
400
623
|
predicateId: GlobalPredicateId;
|
|
401
624
|
}
|
|
402
625
|
interface ViewRuleStyle {
|
|
403
|
-
targets:
|
|
626
|
+
targets: ModelLayer.FqnExpr[];
|
|
404
627
|
notation?: string;
|
|
405
628
|
style: ElementStyle & {
|
|
406
629
|
color?: Color;
|
|
@@ -488,7 +711,7 @@ interface DynamicViewParallelSteps {
|
|
|
488
711
|
}
|
|
489
712
|
type DynamicViewStepOrParallel = DynamicViewStep | DynamicViewParallelSteps;
|
|
490
713
|
type DynamicViewIncludeRule = {
|
|
491
|
-
include:
|
|
714
|
+
include: ModelLayer.AnyFqnExpr[];
|
|
492
715
|
};
|
|
493
716
|
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
494
717
|
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"dynamic", ViewIDs, Tags> {
|
|
@@ -655,12 +878,12 @@ interface DiagramNode extends ComputedNode {
|
|
|
655
878
|
labelBBox: BBox;
|
|
656
879
|
}
|
|
657
880
|
declare namespace DiagramNode {
|
|
658
|
-
function modelRef(node: DiagramNode): Fqn | null;
|
|
659
|
-
function deploymentRef(node: DiagramNode): Fqn | null;
|
|
881
|
+
function modelRef(node: Pick<DiagramNode, "id" | "modelRef">): Fqn | null;
|
|
882
|
+
function deploymentRef(node: Pick<DiagramNode, "id" | "deploymentRef">): Fqn | null;
|
|
660
883
|
/**
|
|
661
884
|
* Nodes group is a special kind of node, exisiting only in view
|
|
662
885
|
*/
|
|
663
|
-
function isNodesGroup(node: DiagramNode): boolean;
|
|
886
|
+
function isNodesGroup(node: Pick<DiagramNode, "kind">): boolean;
|
|
664
887
|
}
|
|
665
888
|
interface DiagramEdge extends ComputedEdge {
|
|
666
889
|
points: NonEmptyArray<Point>;
|
|
@@ -804,52 +1027,62 @@ type CoordinateExtent = [
|
|
|
804
1027
|
];
|
|
805
1028
|
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
806
1029
|
type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = {
|
|
807
|
-
/** Unique id of a node */
|
|
1030
|
+
/** Unique id of a node. */
|
|
808
1031
|
id: string;
|
|
809
1032
|
/**
|
|
810
|
-
* Position of a node on the pane
|
|
1033
|
+
* Position of a node on the pane.
|
|
811
1034
|
* @example { x: 0, y: 0 }
|
|
812
1035
|
*/
|
|
813
1036
|
position: XYPosition;
|
|
814
|
-
/** Arbitrary data passed to a node */
|
|
1037
|
+
/** Arbitrary data passed to a node. */
|
|
815
1038
|
data: NodeData;
|
|
816
|
-
/** Type of node defined in nodeTypes */
|
|
1039
|
+
/** Type of node defined in `nodeTypes`. */
|
|
817
1040
|
type?: NodeType;
|
|
818
1041
|
/**
|
|
819
|
-
* Only relevant for default, source, target nodeType.
|
|
1042
|
+
* Only relevant for default, source, target nodeType. Controls source position.
|
|
820
1043
|
* @example 'right', 'left', 'top', 'bottom'
|
|
821
1044
|
*/
|
|
822
1045
|
sourcePosition?: Position;
|
|
823
1046
|
/**
|
|
824
|
-
* Only relevant for default, source, target nodeType.
|
|
1047
|
+
* Only relevant for default, source, target nodeType. Controls target position.
|
|
825
1048
|
* @example 'right', 'left', 'top', 'bottom'
|
|
826
1049
|
*/
|
|
827
1050
|
targetPosition?: Position;
|
|
1051
|
+
/** Whether or not the node should be visible on the canvas. */
|
|
828
1052
|
hidden?: boolean;
|
|
829
1053
|
selected?: boolean;
|
|
830
|
-
/**
|
|
1054
|
+
/** Whether or not the node is currently being dragged. */
|
|
831
1055
|
dragging?: boolean;
|
|
1056
|
+
/** Whether or not the node is able to be dragged. */
|
|
832
1057
|
draggable?: boolean;
|
|
833
1058
|
selectable?: boolean;
|
|
834
1059
|
connectable?: boolean;
|
|
835
1060
|
deletable?: boolean;
|
|
1061
|
+
/**
|
|
1062
|
+
* A class name that can be applied to elements inside the node that allows those elements to act
|
|
1063
|
+
* as drag handles, letting the user drag the node by clicking and dragging on those elements.
|
|
1064
|
+
*/
|
|
836
1065
|
dragHandle?: string;
|
|
837
1066
|
width?: number;
|
|
838
1067
|
height?: number;
|
|
839
1068
|
initialWidth?: number;
|
|
840
1069
|
initialHeight?: number;
|
|
841
|
-
/** Parent node id, used for creating sub-flows */
|
|
1070
|
+
/** Parent node id, used for creating sub-flows. */
|
|
842
1071
|
parentId?: string;
|
|
843
1072
|
zIndex?: number;
|
|
844
1073
|
/**
|
|
845
|
-
* Boundary a node can be moved in
|
|
1074
|
+
* Boundary a node can be moved in.
|
|
846
1075
|
* @example 'parent' or [[0, 0], [100, 100]]
|
|
847
1076
|
*/
|
|
848
1077
|
extent?: "parent" | CoordinateExtent;
|
|
1078
|
+
/**
|
|
1079
|
+
* When `true`, the parent node will automatically expand if this node is dragged to the edge of
|
|
1080
|
+
* the parent node's bounds.
|
|
1081
|
+
*/
|
|
849
1082
|
expandParent?: boolean;
|
|
850
1083
|
ariaLabel?: string;
|
|
851
1084
|
/**
|
|
852
|
-
* Origin of the node relative to
|
|
1085
|
+
* Origin of the node relative to its position.
|
|
853
1086
|
* @example
|
|
854
1087
|
* [0.5, 0.5] // centers the node
|
|
855
1088
|
* [0, 0] // top left
|
|
@@ -862,7 +1095,7 @@ type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>
|
|
|
862
1095
|
height?: number;
|
|
863
1096
|
};
|
|
864
1097
|
};
|
|
865
|
-
type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & {
|
|
1098
|
+
type InternalNodeBase<NodeType extends NodeBase = NodeBase> = Omit<NodeType, "measured"> & {
|
|
866
1099
|
measured: {
|
|
867
1100
|
width?: number;
|
|
868
1101
|
height?: number;
|
|
@@ -880,11 +1113,11 @@ type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & {
|
|
|
880
1113
|
};
|
|
881
1114
|
};
|
|
882
1115
|
type NodeProps<NodeType extends NodeBase> = Pick<NodeType, "id" | "data" | "width" | "height" | "sourcePosition" | "targetPosition" | "dragHandle" | "parentId"> & Required<Pick<NodeType, "type" | "dragging" | "zIndex" | "selectable" | "deletable" | "selected" | "draggable">> & {
|
|
883
|
-
/**
|
|
1116
|
+
/** Whether a node is connectable or not. */
|
|
884
1117
|
isConnectable: boolean;
|
|
885
|
-
/**
|
|
1118
|
+
/** Position absolute x value. */
|
|
886
1119
|
positionAbsoluteX: number;
|
|
887
|
-
/**
|
|
1120
|
+
/** Position absolute y value. */
|
|
888
1121
|
positionAbsoluteY: number;
|
|
889
1122
|
};
|
|
890
1123
|
type NodeHandleBounds = {
|
|
@@ -922,9 +1155,13 @@ type SetViewport = (viewport: Viewport, options?: ViewportHelperFunctionOptions)
|
|
|
922
1155
|
type SetCenter = (x: number, y: number, options?: SetCenterOptions) => Promise<boolean>;
|
|
923
1156
|
type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => Promise<boolean>;
|
|
924
1157
|
type Connection = {
|
|
1158
|
+
/** The id of the node this connection originates from. */
|
|
925
1159
|
source: string;
|
|
1160
|
+
/** The id of the node this connection terminates at. */
|
|
926
1161
|
target: string;
|
|
1162
|
+
/** When not `null`, the id of the handle on the source node that this connection originates from. */
|
|
927
1163
|
sourceHandle: string | null;
|
|
1164
|
+
/** When not `null`, the id of the handle on the target node that this connection terminates at. */
|
|
928
1165
|
targetHandle: string | null;
|
|
929
1166
|
};
|
|
930
1167
|
type HandleConnection = Connection & {
|
|
@@ -1012,15 +1249,28 @@ type NoConnection = {
|
|
|
1012
1249
|
toNode: null;
|
|
1013
1250
|
};
|
|
1014
1251
|
type ConnectionInProgress<NodeType extends InternalNodeBase = InternalNodeBase> = {
|
|
1252
|
+
/** Indicates whether a connection is currently in progress. */
|
|
1015
1253
|
inProgress: true;
|
|
1254
|
+
/**
|
|
1255
|
+
* If an ongoing connection is above a handle or inside the connection radius, this will be `true`
|
|
1256
|
+
* or `false`, otherwise `null`.
|
|
1257
|
+
*/
|
|
1016
1258
|
isValid: boolean | null;
|
|
1259
|
+
/** Returns the xy start position or `null` if no connection is in progress. */
|
|
1017
1260
|
from: XYPosition;
|
|
1261
|
+
/** Returns the start handle or `null` if no connection is in progress. */
|
|
1018
1262
|
fromHandle: Handle;
|
|
1263
|
+
/** Returns the side (called position) of the start handle or `null` if no connection is in progress. */
|
|
1019
1264
|
fromPosition: Position;
|
|
1265
|
+
/** Returns the start node or `null` if no connection is in progress. */
|
|
1020
1266
|
fromNode: NodeType;
|
|
1267
|
+
/** Returns the xy end position or `null` if no connection is in progress. */
|
|
1021
1268
|
to: XYPosition;
|
|
1269
|
+
/** Returns the end handle or `null` if no connection is in progress. */
|
|
1022
1270
|
toHandle: Handle | null;
|
|
1271
|
+
/** Returns the side (called position) of the end handle or `null` if no connection is in progress. */
|
|
1023
1272
|
toPosition: Position;
|
|
1273
|
+
/** Returns the end node or `null` if no connection is in progress. */
|
|
1024
1274
|
toNode: NodeType | null;
|
|
1025
1275
|
};
|
|
1026
1276
|
type ConnectionState<NodeType extends InternalNodeBase = InternalNodeBase> = ConnectionInProgress<NodeType> | NoConnection;
|
|
@@ -1035,44 +1285,41 @@ type OnBeforeDeleteBase<NodeType extends NodeBase = NodeBase, EdgeType extends E
|
|
|
1035
1285
|
edges: EdgeType[];
|
|
1036
1286
|
}>;
|
|
1037
1287
|
type EdgeBase<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = {
|
|
1038
|
-
/** Unique id of an edge */
|
|
1288
|
+
/** Unique id of an edge. */
|
|
1039
1289
|
id: string;
|
|
1040
|
-
/** Type of
|
|
1290
|
+
/** Type of edge defined in `edgeTypes`. */
|
|
1041
1291
|
type?: EdgeType;
|
|
1042
|
-
/** Id of source node */
|
|
1292
|
+
/** Id of source node. */
|
|
1043
1293
|
source: string;
|
|
1044
|
-
/** Id of target node */
|
|
1294
|
+
/** Id of target node. */
|
|
1045
1295
|
target: string;
|
|
1046
|
-
/**
|
|
1047
|
-
* Id of source handle
|
|
1048
|
-
* only needed if there are multiple handles per node
|
|
1049
|
-
*/
|
|
1296
|
+
/** Id of source handle, only needed if there are multiple handles per node. */
|
|
1050
1297
|
sourceHandle?: string | null;
|
|
1051
|
-
/**
|
|
1052
|
-
* Id of target handle
|
|
1053
|
-
* only needed if there are multiple handles per node
|
|
1054
|
-
*/
|
|
1298
|
+
/** Id of target handle, only needed if there are multiple handles per node. */
|
|
1055
1299
|
targetHandle?: string | null;
|
|
1056
1300
|
animated?: boolean;
|
|
1057
1301
|
hidden?: boolean;
|
|
1058
1302
|
deletable?: boolean;
|
|
1059
1303
|
selectable?: boolean;
|
|
1060
|
-
/** Arbitrary data passed to an edge */
|
|
1304
|
+
/** Arbitrary data passed to an edge. */
|
|
1061
1305
|
data?: EdgeData;
|
|
1062
1306
|
selected?: boolean;
|
|
1063
1307
|
/**
|
|
1064
|
-
* Set the marker on the beginning of an edge
|
|
1308
|
+
* Set the marker on the beginning of an edge.
|
|
1065
1309
|
* @example 'arrow', 'arrowclosed' or custom marker
|
|
1066
1310
|
*/
|
|
1067
1311
|
markerStart?: EdgeMarkerType;
|
|
1068
1312
|
/**
|
|
1069
|
-
* Set the marker on the end of an edge
|
|
1313
|
+
* Set the marker on the end of an edge.
|
|
1070
1314
|
* @example 'arrow', 'arrowclosed' or custom marker
|
|
1071
1315
|
*/
|
|
1072
1316
|
markerEnd?: EdgeMarkerType;
|
|
1073
1317
|
zIndex?: number;
|
|
1074
1318
|
ariaLabel?: string;
|
|
1075
|
-
/**
|
|
1319
|
+
/**
|
|
1320
|
+
* ReactFlow renders an invisible path around each edge to make them easier to click or tap on.
|
|
1321
|
+
* This property sets the width of that invisible path.
|
|
1322
|
+
*/
|
|
1076
1323
|
interactionWidth?: number;
|
|
1077
1324
|
};
|
|
1078
1325
|
type DefaultEdgeOptionsBase<EdgeType extends EdgeBase> = Omit<EdgeType, "id" | "source" | "target" | "sourceHandle" | "targetHandle" | "selected">;
|
|
@@ -1143,14 +1390,15 @@ type ViewportHelperFunctions = {
|
|
|
1143
1390
|
*/
|
|
1144
1391
|
zoomOut: ZoomInOut;
|
|
1145
1392
|
/**
|
|
1146
|
-
*
|
|
1393
|
+
* Zoom the viewport to a given zoom level. Passing in a `duration` will animate the viewport to
|
|
1394
|
+
* the new zoom level.
|
|
1147
1395
|
*
|
|
1148
1396
|
* @param zoomLevel - the zoom level to set
|
|
1149
1397
|
* @param options.duration - optional duration. If set, a transition will be applied
|
|
1150
1398
|
*/
|
|
1151
1399
|
zoomTo: ZoomTo;
|
|
1152
1400
|
/**
|
|
1153
|
-
*
|
|
1401
|
+
* Get the current zoom level of the viewport.
|
|
1154
1402
|
*
|
|
1155
1403
|
* @returns current zoom as a number
|
|
1156
1404
|
*/
|
|
@@ -1169,7 +1417,8 @@ type ViewportHelperFunctions = {
|
|
|
1169
1417
|
*/
|
|
1170
1418
|
getViewport: GetViewport;
|
|
1171
1419
|
/**
|
|
1172
|
-
*
|
|
1420
|
+
* Center the viewport on a given position. Passing in a `duration` will animate the viewport to
|
|
1421
|
+
* the new position.
|
|
1173
1422
|
*
|
|
1174
1423
|
* @param x - x position
|
|
1175
1424
|
* @param y - y position
|
|
@@ -1177,14 +1426,17 @@ type ViewportHelperFunctions = {
|
|
|
1177
1426
|
*/
|
|
1178
1427
|
setCenter: SetCenter;
|
|
1179
1428
|
/**
|
|
1180
|
-
*
|
|
1429
|
+
* A low-level utility function to fit the viewport to a given rectangle. By passing in a
|
|
1430
|
+
* `duration`, the viewport will animate from its current position to the new position. The
|
|
1431
|
+
* `padding` option can be used to add space around the bounds.
|
|
1181
1432
|
*
|
|
1182
1433
|
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
|
1183
1434
|
* @param options.padding - optional padding
|
|
1184
1435
|
*/
|
|
1185
1436
|
fitBounds: FitBounds;
|
|
1186
1437
|
/**
|
|
1187
|
-
*
|
|
1438
|
+
* With this function you can translate a screen pixel position to a flow position. It is useful
|
|
1439
|
+
* for implementing drag and drop from a sidebar for example.
|
|
1188
1440
|
*
|
|
1189
1441
|
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
1190
1442
|
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
|
@@ -1197,7 +1449,7 @@ type ViewportHelperFunctions = {
|
|
|
1197
1449
|
snapToGrid: boolean;
|
|
1198
1450
|
}) => XYPosition;
|
|
1199
1451
|
/**
|
|
1200
|
-
*
|
|
1452
|
+
* Translate a position inside the flow's canvas to a screen pixel position.
|
|
1201
1453
|
*
|
|
1202
1454
|
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
1203
1455
|
* @returns position as { x: number, y: number }
|
|
@@ -1241,6 +1493,11 @@ type EdgeLabelOptions = {
|
|
|
1241
1493
|
type Edge<EdgeData extends Record<string, unknown> = Record<string, unknown>, EdgeType extends string | undefined = string | undefined> = EdgeBase<EdgeData, EdgeType> & EdgeLabelOptions & {
|
|
1242
1494
|
style?: CSSProperties;
|
|
1243
1495
|
className?: string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Determines whether the edge can be updated by dragging the source or target to a new node.
|
|
1498
|
+
* This property will override the default set by the `edgesReconnectable` prop on the
|
|
1499
|
+
* `<ReactFlow />` component.
|
|
1500
|
+
*/
|
|
1244
1501
|
reconnectable?: boolean | HandleType;
|
|
1245
1502
|
focusable?: boolean;
|
|
1246
1503
|
};
|
|
@@ -1258,7 +1515,9 @@ type OnReconnect<EdgeType extends Edge = Edge> = (oldEdge: EdgeType, newConnecti
|
|
|
1258
1515
|
type ConnectionLineComponentProps<NodeType extends Node$1 = Node$1> = {
|
|
1259
1516
|
connectionLineStyle?: CSSProperties;
|
|
1260
1517
|
connectionLineType: ConnectionLineType;
|
|
1518
|
+
/** The node the connection line originates from. */
|
|
1261
1519
|
fromNode: InternalNode<NodeType>;
|
|
1520
|
+
/** The handle on the `fromNode` that the connection line originates from. */
|
|
1262
1521
|
fromHandle: Handle;
|
|
1263
1522
|
fromX: number;
|
|
1264
1523
|
fromY: number;
|
|
@@ -1266,6 +1525,10 @@ type ConnectionLineComponentProps<NodeType extends Node$1 = Node$1> = {
|
|
|
1266
1525
|
toY: number;
|
|
1267
1526
|
fromPosition: Position;
|
|
1268
1527
|
toPosition: Position;
|
|
1528
|
+
/**
|
|
1529
|
+
* If there is an `isValidConnection` callback, this prop will be set to `"valid"` or `"invalid"`
|
|
1530
|
+
* based on the return value of that callback. Otherwise, it will be `null`.
|
|
1531
|
+
*/
|
|
1269
1532
|
connectionStatus: "valid" | "invalid" | null;
|
|
1270
1533
|
toNode: InternalNode<NodeType> | null;
|
|
1271
1534
|
toHandle: Handle | null;
|
|
@@ -1817,13 +2080,17 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1817
2080
|
*/
|
|
1818
2081
|
getNodes: () => NodeType[];
|
|
1819
2082
|
/**
|
|
1820
|
-
*
|
|
2083
|
+
* Set your nodes array to something else by either overwriting it with a new array or by passing
|
|
2084
|
+
* in a function to update the existing array. If using a function, it is important to make sure a
|
|
2085
|
+
* new array is returned instead of mutating the existing array. Calling this function will
|
|
2086
|
+
* trigger the `onNodesChange` handler in a controlled flow.
|
|
1821
2087
|
*
|
|
1822
2088
|
* @param payload - the nodes to set or a function that receives the current nodes and returns the new nodes
|
|
1823
2089
|
*/
|
|
1824
2090
|
setNodes: (payload: NodeType[] | ((nodes: NodeType[]) => NodeType[])) => void;
|
|
1825
2091
|
/**
|
|
1826
|
-
*
|
|
2092
|
+
* Add one or many nodes to your existing nodes array. Calling this function will trigger the
|
|
2093
|
+
* `onNodesChange` handler in a controlled flow.
|
|
1827
2094
|
*
|
|
1828
2095
|
* @param payload - the nodes to add
|
|
1829
2096
|
*/
|
|
@@ -1849,13 +2116,17 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1849
2116
|
*/
|
|
1850
2117
|
getEdges: () => EdgeType[];
|
|
1851
2118
|
/**
|
|
1852
|
-
*
|
|
2119
|
+
* Set your edges array to something else by either overwriting it with a new array or by passing
|
|
2120
|
+
* in a function to update the existing array. If using a function, it is important to make sure a
|
|
2121
|
+
* new array is returned instead of mutating the existing array. Calling this function will
|
|
2122
|
+
* trigger the `onEdgesChange` handler in a controlled flow.
|
|
1853
2123
|
*
|
|
1854
2124
|
* @param payload - the edges to set or a function that receives the current edges and returns the new edges
|
|
1855
2125
|
*/
|
|
1856
2126
|
setEdges: (payload: EdgeType[] | ((edges: EdgeType[]) => EdgeType[])) => void;
|
|
1857
2127
|
/**
|
|
1858
|
-
*
|
|
2128
|
+
* Add one or many edges to your existing edges array. Calling this function will trigger the
|
|
2129
|
+
* `onEdgesChange` handler in a controlled flow.
|
|
1859
2130
|
*
|
|
1860
2131
|
* @param payload - the edges to add
|
|
1861
2132
|
*/
|
|
@@ -1886,7 +2157,8 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1886
2157
|
deletedEdges: Edge[];
|
|
1887
2158
|
}>;
|
|
1888
2159
|
/**
|
|
1889
|
-
*
|
|
2160
|
+
* Find all the nodes currently intersecting with a given node or rectangle. The `partially`
|
|
2161
|
+
* parameter can be set to `true` to include nodes that are only partially intersecting.
|
|
1890
2162
|
*
|
|
1891
2163
|
* @param node - the node or rect to check for intersections
|
|
1892
2164
|
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
|
|
@@ -1898,7 +2170,8 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1898
2170
|
id: Node$1["id"];
|
|
1899
2171
|
} | Rect, partially?: boolean, nodes?: NodeType[]) => NodeType[];
|
|
1900
2172
|
/**
|
|
1901
|
-
*
|
|
2173
|
+
* Determine if a given node or rectangle is intersecting with another rectangle. The `partially`
|
|
2174
|
+
* parameter can be set to true return `true` even if the node is only partially intersecting.
|
|
1902
2175
|
*
|
|
1903
2176
|
* @param node - the node or rect to check for intersections
|
|
1904
2177
|
* @param area - the rect to check for intersections
|
|
@@ -1970,7 +2243,8 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1970
2243
|
*/
|
|
1971
2244
|
getNodesBounds: (nodes: (NodeType | InternalNode | string)[]) => Rect;
|
|
1972
2245
|
/**
|
|
1973
|
-
*
|
|
2246
|
+
* Get all the connections of a handle belonging to a specific node. The type parameter be either
|
|
2247
|
+
* `'source'` or `'target'`.
|
|
1974
2248
|
* @deprecated
|
|
1975
2249
|
* @param type - handle type 'source' or 'target'
|
|
1976
2250
|
* @param id - the handle id (this is only needed if you have multiple handles of the same type, meaning you have to provide a unique id for each handle)
|
|
@@ -1996,7 +2270,11 @@ type GeneralHelpers<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Ed
|
|
|
1996
2270
|
}) => NodeConnection[];
|
|
1997
2271
|
fitView: FitView<NodeType>;
|
|
1998
2272
|
};
|
|
1999
|
-
type ReactFlowInstance<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Edge> = GeneralHelpers<NodeType, EdgeType> &
|
|
2273
|
+
type ReactFlowInstance<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Edge> = GeneralHelpers<NodeType, EdgeType> & ViewportHelperFunctions & {
|
|
2274
|
+
/**
|
|
2275
|
+
* React Flow needs to mount the viewport to the DOM and initialize its zoom and pan behavior.
|
|
2276
|
+
* This property tells you when viewport is initialized.
|
|
2277
|
+
*/
|
|
2000
2278
|
viewportInitialized: boolean;
|
|
2001
2279
|
};
|
|
2002
2280
|
type ControlsCustomLayoutProps = {
|