@likec4/core 1.58.0 → 1.59.1
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/dist/builder/index.d.mts +2 -2
- package/dist/builder/index.mjs +2 -1
- package/dist/chunks/Builder.view-element.mjs +2 -0
- package/dist/{_chunks → chunks}/LikeC4Model.d.mts +24 -26
- package/dist/{_chunks → chunks}/_types.d.mts +302 -57
- package/dist/{_chunks → chunks}/_types2.d.mts +2 -2
- package/dist/chunks/assignTagColors.mjs +1 -0
- package/dist/chunks/calcDriftsFromSnapshot.mjs +1 -0
- package/dist/chunks/default-map.d.mts +29 -0
- package/dist/{_chunks → chunks}/index.d.mts +933 -194
- package/dist/{_chunks → chunks}/index2.d.mts +21 -19
- package/dist/{_chunks → chunks}/index3.d.mts +2 -2
- package/dist/{_chunks/index5.d.mts → chunks/index4.d.mts} +153 -4
- package/dist/{_chunks/index4.d.mts → chunks/index5.d.mts} +2 -2
- package/dist/chunks/libs/chroma-js.mjs +15 -0
- package/dist/chunks/libs/graphology-dag.mjs +1 -0
- package/dist/chunks/libs/graphology.mjs +1 -0
- package/dist/chunks/libs/hast-util-sanitize.mjs +1 -0
- package/dist/chunks/libs/hast-util-to-html.mjs +9 -0
- package/dist/chunks/libs/mdast.mjs +29 -0
- package/dist/chunks/libs/mnemonist.mjs +1 -0
- package/dist/chunks/libs/ohash.mjs +1 -0
- package/dist/chunks/libs/remark.mjs +3 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/unified.mjs +1 -0
- package/dist/chunks/model.mjs +4 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/types.mjs +9 -0
- package/dist/compute-view/index.d.mts +56 -18
- package/dist/compute-view/index.mjs +2 -2
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -1
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +3 -3
- package/dist/model/index.mjs +1 -1
- package/dist/styles/index.d.mts +3 -3
- package/dist/styles/index.mjs +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.mjs +1 -1
- package/dist/utils/graphology/index.d.mts +618 -1
- package/dist/utils/graphology/index.mjs +1 -1
- package/dist/utils/index.d.mts +4 -4
- package/dist/utils/index.mjs +1 -1
- package/package.json +13 -14
- package/dist/THIRD-PARTY-LICENSES.md +0 -1034
- package/dist/_chunks/Builder.view-element.mjs +0 -2
- package/dist/_chunks/assignTagColors.mjs +0 -1
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +0 -1
- package/dist/_chunks/libs/bail.mjs +0 -1
- package/dist/_chunks/libs/ccount.mjs +0 -1
- package/dist/_chunks/libs/character-entities-html4.mjs +0 -1
- package/dist/_chunks/libs/character-entities-legacy.mjs +0 -1
- package/dist/_chunks/libs/character-entities.mjs +0 -2
- package/dist/_chunks/libs/chroma-js.mjs +0 -15
- package/dist/_chunks/libs/comma-separated-tokens.mjs +0 -1
- package/dist/_chunks/libs/decode-named-character-reference.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/devlop.mjs +0 -1
- package/dist/_chunks/libs/escape-string-regexp.mjs +0 -1
- package/dist/_chunks/libs/extend.mjs +0 -1
- package/dist/_chunks/libs/graphology-dag.d.mts +0 -607
- package/dist/_chunks/libs/graphology-dag.mjs +0 -1
- package/dist/_chunks/libs/graphology.mjs +0 -1
- package/dist/_chunks/libs/hast-util-sanitize.mjs +0 -1
- package/dist/_chunks/libs/hast-util-to-html.mjs +0 -9
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/longest-streak.mjs +0 -1
- package/dist/_chunks/libs/markdown-table.mjs +0 -2
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +0 -1
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +0 -3
- package/dist/_chunks/libs/mdast-util-gfm.mjs +0 -15
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +0 -11
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +0 -1
- package/dist/_chunks/libs/mnemonist.d.mts +0 -164
- package/dist/_chunks/libs/mnemonist.mjs +0 -1
- package/dist/_chunks/libs/natural-compare-lite.mjs +0 -9
- package/dist/_chunks/libs/ohash.mjs +0 -1
- package/dist/_chunks/libs/rehype-sanitize.mjs +0 -1
- package/dist/_chunks/libs/rehype-stringify.mjs +0 -1
- package/dist/_chunks/libs/remark-gfm.mjs +0 -1
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +0 -3
- package/dist/_chunks/libs/remark-parse.mjs +0 -1
- package/dist/_chunks/libs/remark-rehype.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/trough.mjs +0 -1
- package/dist/_chunks/libs/unified.mjs +0 -1
- package/dist/_chunks/manual-layout.mjs +0 -1
- package/dist/_chunks/mnemonist.d.mts +0 -1
- package/dist/_chunks/model.mjs +0 -4
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/types.mjs +0 -1
- /package/dist/{_chunks → chunks}/libs/@radix-ui/colors.mjs +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { n as __exportAll, r as __name } from "./rolldown-runtime.mjs";
|
|
1
2
|
import { c as XYPoint, i as BBox, s as Point } from "./index2.mjs";
|
|
2
|
-
import { IfNever, IsAny, IsLiteral, IsNever, IsUnknown, KeysOfUnion, Or, PartialDeep, SetNonNullable, SetRequired, Simplify, Tagged, TupleToUnion, UnionToIntersection, WritableDeep } from "type-fest";
|
|
3
|
-
|
|
3
|
+
import { IfNever, IsAny, IsEqual, IsLiteral, IsNever, IsUnknown, KeysOfUnion, Or, PartialDeep, SetNonNullable, SetRequired, Simplify, Tagged, TupleToUnion, UnionToIntersection, WritableDeep } from "type-fest";
|
|
4
4
|
//#region src/types/_common.d.ts
|
|
5
5
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
6
6
|
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
7
7
|
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
8
|
-
type ReorderedArray<T extends IterableContainer> = { -readonly [P in keyof T]: T[number] };
|
|
9
|
-
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
10
|
-
type AllNever$1<Expressions> = UnionToIntersection<{ [Name in keyof Expressions]: { -readonly [Key in keyof Expressions[Name]]?: never } }[keyof Expressions]>;
|
|
8
|
+
type ReorderedArray<T extends IterableContainer> = { -readonly [P in keyof T]: T[number]; };
|
|
9
|
+
type KeysOf<T> = keyof T extends (infer K extends string) ? K : never;
|
|
10
|
+
type AllNever$1<Expressions> = UnionToIntersection<{ [Name in keyof Expressions]: { -readonly [Key in keyof Expressions[Name]]?: never; }; }[keyof Expressions]>;
|
|
11
11
|
/**
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
@@ -30,7 +30,7 @@ type AllNever$1<Expressions> = UnionToIntersection<{ [Name in keyof Expressions]
|
|
|
30
30
|
* }
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
type ExclusiveUnion<Expressions, All = AllNever$1<Expressions>> = Expressions extends object ? { [Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]
|
|
33
|
+
type ExclusiveUnion<Expressions, All = AllNever$1<Expressions>> = Expressions extends object ? { [Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]>; }[keyof Expressions] : never;
|
|
34
34
|
/**
|
|
35
35
|
* Copy from https://github.com/remeda/remeda/blob/main/packages/remeda/src/internal/types/NTuple.ts
|
|
36
36
|
* An array with *exactly* N elements in it.
|
|
@@ -47,17 +47,22 @@ interface Link {
|
|
|
47
47
|
url: string;
|
|
48
48
|
relative?: string;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @see {@link LiteralUnion} from type-fest (https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts)
|
|
52
|
+
*/
|
|
53
|
+
type OrString = string & Record<never, never>;
|
|
50
54
|
/**
|
|
51
55
|
* Coalesce `V` to a string if it is `any`
|
|
52
56
|
*/
|
|
53
57
|
type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
|
|
54
|
-
type ExactObject<T, InputType = unknown> = { [KeyType in keyof T]: undefined extends T[KeyType] ? T[KeyType] | undefined : T[KeyType] } & Record<Exclude<keyof InputType, KeysOfUnion<T>>, never>;
|
|
58
|
+
type ExactObject<T, InputType = unknown> = { [KeyType in keyof T]: undefined extends T[KeyType] ? T[KeyType] | undefined : T[KeyType]; } & Record<Exclude<keyof InputType, KeysOfUnion<T>>, never>;
|
|
55
59
|
/**
|
|
56
60
|
* Allows only exact properties of `U` to be present in `T` and omits undefined values
|
|
57
61
|
*
|
|
58
62
|
* See {@link Exact} for more details (this version is non-deep)
|
|
59
63
|
*/
|
|
60
64
|
declare function exact<Expected, T extends ExactObject<Expected, T>>(a: T): Expected;
|
|
65
|
+
type IsAnyOrNever<T> = Or<IsAny<T>, IsNever<T>>;
|
|
61
66
|
//#endregion
|
|
62
67
|
//#region src/types/const.d.ts
|
|
63
68
|
/**
|
|
@@ -82,21 +87,34 @@ declare function isOnStage<T extends {
|
|
|
82
87
|
*/
|
|
83
88
|
declare const _stage = "_stage";
|
|
84
89
|
type _stage = typeof _stage;
|
|
90
|
+
type inferStage<A> = A extends {
|
|
91
|
+
['_stage']: infer S extends ModelStage;
|
|
92
|
+
} ? IsAnyOrNever<S> extends true ? never : S : never;
|
|
85
93
|
/**
|
|
86
|
-
* Property name to store type information, used to identify the type
|
|
94
|
+
* Property name to store type information, used to identify the type
|
|
95
|
+
* (of the view or view element)
|
|
87
96
|
*
|
|
88
97
|
* @internal
|
|
89
98
|
*/
|
|
90
99
|
declare const _type = "_type";
|
|
91
100
|
type _type = typeof _type;
|
|
101
|
+
type inferType<A> = A extends {
|
|
102
|
+
['_type']: infer T;
|
|
103
|
+
} ? IsAnyOrNever<T> extends true ? never : T : never;
|
|
92
104
|
/**
|
|
93
105
|
* Property name to store layout type information, used to identify the type of the layout*
|
|
94
106
|
* @internal
|
|
95
107
|
*/
|
|
96
108
|
declare const _layout = "_layout";
|
|
97
109
|
type _layout = typeof _layout;
|
|
110
|
+
/**
|
|
111
|
+
* Property name to store version information (for migration purposes)
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
declare const _v = "_v";
|
|
115
|
+
type _v = typeof _v;
|
|
98
116
|
declare namespace scalar_d_exports {
|
|
99
|
-
export { AnyFqn, BuiltInIcon, DeploymentFqn$1 as DeploymentFqn, DeploymentKind$1 as DeploymentKind, EdgeId$1 as EdgeId, ElementKind$1 as ElementKind, Fqn$1 as Fqn, GlobalFqn, GroupElementKind, Icon, IconUrl, MarkdownOrString, NodeId$1 as NodeId, NoneIcon, ProjectId$1 as ProjectId, RelationId$1 as RelationId, RelationKind$1 as RelationKind, RelationshipKind,
|
|
117
|
+
export { AnyFqn, BuiltInIcon, DeploymentFqn$1 as DeploymentFqn, DeploymentKind$1 as DeploymentKind, EdgeId$1 as EdgeId, ElementKind$1 as ElementKind, Fqn$1 as Fqn, GlobalFqn, GroupElementKind, Icon, IconUrl, MarkdownOrString, NodeId$1 as NodeId, NoneIcon, ProjectId$1 as ProjectId, RelationId$1 as RelationId, RelationKind$1 as RelationKind, RelationshipKind, StepEdgeKind, StepPath, Tag$1 as Tag, ViewId$1 as ViewId, flattenMarkdownOrString, isGlobalFqn, isGroupElementKind, isStepPath, splitGlobalFqn };
|
|
100
118
|
}
|
|
101
119
|
type ProjectId$1<T = string> = Tagged<T, 'ProjectID'>;
|
|
102
120
|
declare function ProjectId$1(name: string): ProjectId$1;
|
|
@@ -191,14 +209,42 @@ type NodeId$1 = Tagged<string, 'NodeId' | 'Fqn' | 'DeploymentFqn'>;
|
|
|
191
209
|
declare function NodeId$1(id: string): NodeId$1;
|
|
192
210
|
type EdgeId$1 = Tagged<string, 'EdgeId'>;
|
|
193
211
|
declare function EdgeId$1(id: string): EdgeId$1;
|
|
194
|
-
type StepEdgeIdLiteral = `step-${number}` | `step-${number}.${number}`;
|
|
195
|
-
type StepEdgeId = Tagged<StepEdgeIdLiteral, 'EdgeId'>;
|
|
196
|
-
declare function stepEdgeId(step: number, parallelStep?: number): StepEdgeId;
|
|
197
212
|
declare const StepEdgeKind = "@step";
|
|
198
|
-
|
|
199
|
-
declare function
|
|
213
|
+
type StepPath = Tagged<Tagged<`step-${string}`, 'EdgeId'>, 'StepPath'>;
|
|
214
|
+
declare function isStepPath(id: unknown): id is StepPath;
|
|
215
|
+
/**
|
|
216
|
+
* Path to a step, also acting as EdgeId
|
|
217
|
+
*
|
|
218
|
+
* Format: step-{segment1}.{segment2}...{segmentN}
|
|
219
|
+
* Where segment can be:
|
|
220
|
+
* - {index} (index in array, 1-based, represents A -> B)
|
|
221
|
+
* - {index}:{kind} (subflow of a kind, 1-based, i.e. "03:loop" - 3rd step starts a loop)
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```
|
|
225
|
+
* dynamic view {
|
|
226
|
+
* A -> B // step-01
|
|
227
|
+
* alt { // step-02:alt - step 2 is alt subflow
|
|
228
|
+
* when { // step-02:alt.01:when - step 1 in alt is when subflow
|
|
229
|
+
* try { // step-02:alt.01:when.01:try - step 1 in when is try subflow
|
|
230
|
+
* B -> C // step-02:alt.01:when.01:try.01:block.01 - step 1 in try block
|
|
231
|
+
* } catch {
|
|
232
|
+
* B -> D // step-02:alt.01:when.01:try.02:catch.01
|
|
233
|
+
* }
|
|
234
|
+
* }
|
|
235
|
+
* }
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* @param segments - Array of segments, where each segment can be:
|
|
240
|
+
* - string: literal segment
|
|
241
|
+
* - number: index segment (will be padded to 2 digits)
|
|
242
|
+
* - [number, string]: index:kind segment (will be padded to 2 digits)
|
|
243
|
+
* - undefined: will be filtered out
|
|
244
|
+
*/
|
|
245
|
+
declare function StepPath(...segments: Array<string | number | [number, string] | undefined>): StepPath;
|
|
200
246
|
declare namespace _aux_d_exports {
|
|
201
|
-
export { AllKinds, Any, Any as AnyAux, AnyComputed, AnyLayouted, AnyOnStage, AnyParsed, AnySpec, Aux, DeploymentFqn, DeploymentId, DeploymentKind, EdgeId, ElementId, ElementKind, Fqn, LooseDeploymentId, LooseDeploymentKind, LooseElementId, LooseElementKind, LooseLiteral, LooseRelationKind, LooseTag, LooseTags, LooseViewId, Metadata, MetadataKey, Never, NodeId,
|
|
247
|
+
export { AllKinds, Any, Any as AnyAux, AnyComputed, AnyLayouted, AnyOnStage, AnyParsed, AnySpec, Aux, DeploymentFqn, DeploymentId, DeploymentKind, EdgeId, ElementId, ElementKind, Fqn, LooseDeploymentId, LooseDeploymentKind, LooseElementId, LooseElementKind, LooseLiteral, LooseRelationKind, LooseTag, LooseTags, LooseViewId, Metadata, MetadataKey, Never, NodeId, PickByStage, ProjectId, RelationId, RelationKind, Spec, SpecAux, Stage, DeploymentFqn as StrictDeploymentFqn, StrictDeploymentKind, StrictElementKind, Fqn as StrictFqn, StrictProjectId, StrictRelationKind, StrictTag, StrictViewId, Tag, Tags, Unknown, UnknownComputed, UnknownLayouted, UnknownParsed, ViewId, WithDescriptionAndTech, WithLinks, WithMetadata, WithNotation, WithOptionalLinks, WithOptionalTags, WithTags, preferDescription, preferSummary, setProject, setStage, toComputed, toLayouted, toParsed };
|
|
202
248
|
}
|
|
203
249
|
/**
|
|
204
250
|
* Specification types (kinds, tags, metadata keys)
|
|
@@ -325,7 +371,7 @@ type MetadataKey<A> = A extends Any ? Coalesce<A['MetadataKey']> : never;
|
|
|
325
371
|
/**
|
|
326
372
|
* Metadata object from Aux
|
|
327
373
|
*/
|
|
328
|
-
type Metadata<A extends Any> = IsNever<A['MetadataKey']> extends true ? never : IsLiteral<A['MetadataKey']> extends true ? { [key in A['MetadataKey']]?: string | string[] } : Record<string, string | string[]>;
|
|
374
|
+
type Metadata<A extends Any> = IsNever<A['MetadataKey']> extends true ? never : IsLiteral<A['MetadataKey']> extends true ? { [key in A['MetadataKey']]?: string | string[]; } : Record<string, string | string[]>;
|
|
329
375
|
/**
|
|
330
376
|
* All known kinds from Aux as a literal union.
|
|
331
377
|
*/
|
|
@@ -334,12 +380,12 @@ type AllKinds<A> = ElementKind<A> | DeploymentKind<A> | RelationKind<A>;
|
|
|
334
380
|
* Specification from Aux
|
|
335
381
|
*/
|
|
336
382
|
type Spec<A> = A extends Aux<any, any, any, any, any, SpecAux<infer E, infer D, infer R, infer T, infer M>> ? SpecAux<E, D, R, T, M> : never;
|
|
337
|
-
type StrictProjectId<A> = A extends infer T extends Any ? ProjectId$1<ProjectId<T>> : never;
|
|
338
|
-
type StrictViewId<A> = A extends infer T extends Any ? ViewId$1<ViewId<T>> : never;
|
|
339
|
-
type StrictTag<A> = A extends infer T extends Any ? Tag$1<Tag<T>> : never;
|
|
340
|
-
type StrictElementKind<A> = A extends infer T extends Any ? ElementKind$1<ElementKind<T>> : never;
|
|
341
|
-
type StrictDeploymentKind<A> = A extends infer T extends Any ? DeploymentKind$1<DeploymentKind<T>> : never;
|
|
342
|
-
type StrictRelationKind<A> = A extends infer T extends Any ? RelationshipKind<RelationKind<T>> : never;
|
|
383
|
+
type StrictProjectId<A> = A extends (infer T extends Any) ? ProjectId$1<ProjectId<T>> : never;
|
|
384
|
+
type StrictViewId<A> = A extends (infer T extends Any) ? ViewId$1<ViewId<T>> : never;
|
|
385
|
+
type StrictTag<A> = A extends (infer T extends Any) ? Tag$1<Tag<T>> : never;
|
|
386
|
+
type StrictElementKind<A> = A extends (infer T extends Any) ? ElementKind$1<ElementKind<T>> : never;
|
|
387
|
+
type StrictDeploymentKind<A> = A extends (infer T extends Any) ? DeploymentKind$1<DeploymentKind<T>> : never;
|
|
388
|
+
type StrictRelationKind<A> = A extends (infer T extends Any) ? RelationshipKind<RelationKind<T>> : never;
|
|
343
389
|
type WithDescriptionAndTech = {
|
|
344
390
|
readonly summary?: MarkdownOrString | null;
|
|
345
391
|
readonly description?: MarkdownOrString | null;
|
|
@@ -371,10 +417,6 @@ type WithMetadata<A extends Any> = {
|
|
|
371
417
|
type WithNotation = {
|
|
372
418
|
readonly notation?: string | null;
|
|
373
419
|
};
|
|
374
|
-
/**
|
|
375
|
-
* @see {@link LiteralUnion} from type-fest (https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts)
|
|
376
|
-
*/
|
|
377
|
-
type OrString = string & Record<never, never>;
|
|
378
420
|
/**
|
|
379
421
|
* Allows any string value, but still auto-completes to the possible values in IDE
|
|
380
422
|
*/
|
|
@@ -388,7 +430,7 @@ type LooseElementKind<A> = A extends Any ? LooseLiteral<A['ElementKind']> : stri
|
|
|
388
430
|
type LooseDeploymentKind<A> = A extends Any ? LooseLiteral<A['DeploymentKind']> : string;
|
|
389
431
|
type LooseRelationKind<A> = A extends Any ? LooseLiteral<A['RelationKind']> : string;
|
|
390
432
|
//#endregion
|
|
391
|
-
//#region ../../styled-system/preset/dist/defaults/
|
|
433
|
+
//#region ../../styled-system/preset/dist/defaults/types.d.mts
|
|
392
434
|
//#region src/defaults/types.d.ts
|
|
393
435
|
declare const Sizes: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
394
436
|
declare const IconPositions: readonly ["left", "right", "top", "bottom"];
|
|
@@ -396,6 +438,7 @@ declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
|
|
|
396
438
|
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue", "bucket", "document", "component"];
|
|
397
439
|
declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
|
|
398
440
|
declare const DefaultTagColors: readonly ["tomato", "grass", "blue", "ruby", "orange", "indigo", "pink", "teal", "purple", "amber", "crimson", "red", "lime", "yellow", "violet"];
|
|
441
|
+
type DefaultTagColors = typeof DefaultTagColors[number];
|
|
399
442
|
//#endregion
|
|
400
443
|
//#region src/styles/types.d.ts
|
|
401
444
|
/**
|
|
@@ -411,7 +454,8 @@ type BorderStyle = typeof BorderStyles[number];
|
|
|
411
454
|
type ElementShape = typeof ElementShapes[number];
|
|
412
455
|
type HexColor = `#${string}`;
|
|
413
456
|
type ColorLiteral = HexColor | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`;
|
|
414
|
-
|
|
457
|
+
declare const RelationshipLineTypes: readonly ["dashed", "solid", "dotted"];
|
|
458
|
+
type RelationshipLineType = TupleToUnion<typeof RelationshipLineTypes>;
|
|
415
459
|
declare const RelationshipArrowTypes: readonly ["none", "normal", "onormal", "dot", "odot", "diamond", "odiamond", "crow", "open", "vee"];
|
|
416
460
|
type RelationshipArrowType = TupleToUnion<typeof RelationshipArrowTypes>;
|
|
417
461
|
type ThemeColor = typeof ThemeColors[number];
|
|
@@ -562,7 +606,7 @@ type KindEqual<A extends Any> = Omit<AllNever, 'kind'> & {
|
|
|
562
606
|
declare function isKindEqual<A extends Any>(operator: WhereOperator<A>): operator is KindEqual<A>;
|
|
563
607
|
type MetadataEqual<A extends Any> = Omit<AllNever, 'metadata'> & {
|
|
564
608
|
metadata: {
|
|
565
|
-
key:
|
|
609
|
+
key: MetadataKey<A>;
|
|
566
610
|
value?: EqualOperator<string> | string;
|
|
567
611
|
};
|
|
568
612
|
};
|
|
@@ -1143,7 +1187,7 @@ interface ParsedElementView<A extends Any = Any> extends BaseParsedViewPropertie
|
|
|
1143
1187
|
}
|
|
1144
1188
|
//#endregion
|
|
1145
1189
|
//#region src/types/view-parsed.dynamic.d.ts
|
|
1146
|
-
interface
|
|
1190
|
+
interface Step$1<A extends Any = Any> {
|
|
1147
1191
|
readonly source: Fqn<A>;
|
|
1148
1192
|
readonly target: Fqn<A>;
|
|
1149
1193
|
readonly title?: string | null;
|
|
@@ -1164,23 +1208,106 @@ interface DynamicStep<A extends Any = Any> {
|
|
|
1164
1208
|
*/
|
|
1165
1209
|
readonly astPath: string;
|
|
1166
1210
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1211
|
+
type AnyStep<A extends Any = Any> = ExclusiveUnion<{
|
|
1212
|
+
Step: Step$1<A>;
|
|
1213
|
+
Series: Step$1.Series<A>;
|
|
1214
|
+
Parallel: Step$1.Parallel<A>;
|
|
1215
|
+
Opt: Step$1.Opt<A>;
|
|
1216
|
+
Loop: Step$1.Loop<A>;
|
|
1217
|
+
Try: Step$1.Try<A>;
|
|
1218
|
+
Alt: Step$1.Alt<A>;
|
|
1219
|
+
Break: Step$1.Break<A>;
|
|
1220
|
+
}>;
|
|
1221
|
+
declare const stepGuards: {
|
|
1222
|
+
isStep: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1<A>;
|
|
1223
|
+
isSeries: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Series<A>;
|
|
1224
|
+
isParallel: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Parallel<A>;
|
|
1225
|
+
isOpt: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Opt<A>;
|
|
1226
|
+
isLoop: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Loop<A>;
|
|
1227
|
+
isTry: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Try<A>;
|
|
1228
|
+
isAlt: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Alt<A>;
|
|
1229
|
+
isBreak: <A extends Any>(step: AnyStep<A> | undefined | null) => step is Step$1.Break<A>;
|
|
1230
|
+
};
|
|
1231
|
+
interface WithSteps<A extends Any> {
|
|
1232
|
+
readonly steps: NonEmptyReadonlyArray<AnyStep<A>>;
|
|
1170
1233
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1234
|
+
declare namespace Step$1 {
|
|
1235
|
+
type Any<A extends Any = Any> = AnyStep<A>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Chain of steps (used for sequential execution)
|
|
1238
|
+
*/
|
|
1239
|
+
interface Series<A extends Any = Any> {
|
|
1240
|
+
readonly [_type]: 'series';
|
|
1241
|
+
readonly steps: NonEmptyReadonlyArray<Step$1<A>>;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Block of parallel steps
|
|
1245
|
+
*/
|
|
1246
|
+
interface Parallel<A extends Any = Any> extends WithSteps<A> {
|
|
1247
|
+
readonly [_type]: 'par';
|
|
1248
|
+
readonly title?: string;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Try-catch-finally block
|
|
1252
|
+
*/
|
|
1253
|
+
interface Try<A extends Any = Any> {
|
|
1254
|
+
readonly [_type]: 'try';
|
|
1255
|
+
/**
|
|
1256
|
+
* Try section
|
|
1257
|
+
*/
|
|
1258
|
+
readonly try: WithSteps<A> & {
|
|
1259
|
+
readonly title?: string;
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* Catch section (optional)
|
|
1263
|
+
*/
|
|
1264
|
+
readonly catch?: WithSteps<A> & {
|
|
1265
|
+
readonly title?: string;
|
|
1266
|
+
};
|
|
1267
|
+
/**
|
|
1268
|
+
* Finally section (optional)
|
|
1269
|
+
*/
|
|
1270
|
+
readonly finally?: WithSteps<A> & {
|
|
1271
|
+
readonly title?: string;
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Opt block (opt)
|
|
1276
|
+
*/
|
|
1277
|
+
interface Opt<A extends Any = Any> extends WithSteps<A> {
|
|
1278
|
+
readonly [_type]: 'opt';
|
|
1279
|
+
readonly title?: string;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Break block
|
|
1283
|
+
*/
|
|
1284
|
+
interface Break<A extends Any = Any> extends WithSteps<A> {
|
|
1285
|
+
readonly [_type]: 'break';
|
|
1286
|
+
readonly title?: string;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Loop block (loop)
|
|
1290
|
+
*/
|
|
1291
|
+
interface Loop<A extends Any = Any> extends WithSteps<A> {
|
|
1292
|
+
readonly [_type]: 'loop';
|
|
1293
|
+
readonly title?: string;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Group of alternative branches (alt)
|
|
1297
|
+
*/
|
|
1298
|
+
interface Alt<A extends Any = Any> {
|
|
1299
|
+
readonly [_type]: 'alt';
|
|
1300
|
+
readonly title?: string;
|
|
1301
|
+
readonly branches: NonEmptyReadonlyArray<AltBranch<A>>;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Branch block (if/else/if, when, opt)
|
|
1305
|
+
*/
|
|
1306
|
+
interface AltBranch<A extends Any = Any> extends WithSteps<A> {
|
|
1307
|
+
readonly [_type]: 'when' | 'if' | 'else';
|
|
1308
|
+
readonly title?: string;
|
|
1309
|
+
}
|
|
1174
1310
|
}
|
|
1175
|
-
declare function getParallelStepsPrefix(id: string): string | null;
|
|
1176
|
-
type DynamicViewStep<A extends Any = Any> = ExclusiveUnion<{
|
|
1177
|
-
Step: DynamicStep<A>;
|
|
1178
|
-
Series: DynamicStepsSeries<A>;
|
|
1179
|
-
Parallel: DynamicStepsParallel<A>;
|
|
1180
|
-
}>;
|
|
1181
|
-
declare function isDynamicStep<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStep<A>;
|
|
1182
|
-
declare function isDynamicStepsParallel<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsParallel<A>;
|
|
1183
|
-
declare function isDynamicStepsSeries<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsSeries<A>;
|
|
1184
1311
|
interface DynamicViewIncludeRule<A extends Any = Any> {
|
|
1185
1312
|
include: ModelFqnExpr.Any<A>[];
|
|
1186
1313
|
}
|
|
@@ -1202,7 +1329,7 @@ interface ParsedDynamicView<A extends Any = Any> extends BaseParsedViewPropertie
|
|
|
1202
1329
|
* @default 'diagram'
|
|
1203
1330
|
*/
|
|
1204
1331
|
readonly variant?: DynamicViewDisplayVariant;
|
|
1205
|
-
readonly steps:
|
|
1332
|
+
readonly steps: Step$1.Any<A>[];
|
|
1206
1333
|
readonly rules: DynamicViewRule<A>[];
|
|
1207
1334
|
}
|
|
1208
1335
|
//#endregion
|
|
@@ -1251,13 +1378,7 @@ type WithSizes = Pick<ElementStyle, 'size' | 'padding' | 'textSize' | 'iconSize'
|
|
|
1251
1378
|
/**
|
|
1252
1379
|
* Ensures that the sizes are set to default values if they are not set
|
|
1253
1380
|
*/
|
|
1254
|
-
declare function ensureSizes<S extends WithSizes>({
|
|
1255
|
-
size,
|
|
1256
|
-
padding,
|
|
1257
|
-
textSize,
|
|
1258
|
-
iconSize,
|
|
1259
|
-
...rest
|
|
1260
|
-
}: S, defaultSize?: "xs" | "sm" | "md" | "lg" | "xl"): Omit<S, keyof WithSizes> & Required<WithSizes>;
|
|
1381
|
+
declare function ensureSizes<S extends WithSizes>({ size, padding, textSize, iconSize, ...rest }: S, defaultSize?: "xs" | "sm" | "md" | "lg" | "xl"): Omit<S, keyof WithSizes> & Required<WithSizes>;
|
|
1261
1382
|
interface Element<A extends Any = Any> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A>, WithNotation {
|
|
1262
1383
|
readonly id: Fqn<A>;
|
|
1263
1384
|
readonly kind: ElementKind<A>;
|
|
@@ -1368,8 +1489,12 @@ declare function isTagColorSpecified(spec: string | TagSpecification): spec is {
|
|
|
1368
1489
|
color: ColorLiteral;
|
|
1369
1490
|
};
|
|
1370
1491
|
interface RelationshipSpecification {
|
|
1492
|
+
tags?: Tag$1[];
|
|
1493
|
+
title?: string;
|
|
1494
|
+
description?: MarkdownOrString;
|
|
1371
1495
|
technology?: string;
|
|
1372
1496
|
notation?: string;
|
|
1497
|
+
links?: NonEmptyArray<Link>;
|
|
1373
1498
|
color?: Color;
|
|
1374
1499
|
line?: RelationshipLineType;
|
|
1375
1500
|
head?: RelationshipArrowType;
|
|
@@ -1382,10 +1507,10 @@ interface RelationshipSpecification {
|
|
|
1382
1507
|
multiple?: boolean;
|
|
1383
1508
|
}
|
|
1384
1509
|
type Specification<A> = A extends Any ? {
|
|
1385
|
-
tags: { [key in Tag<A>]: TagSpecification };
|
|
1386
|
-
elements: { [key in ElementKind<A>]: Partial<ElementSpecification
|
|
1387
|
-
deployments: { [key in DeploymentKind<A>]: Partial<ElementSpecification
|
|
1388
|
-
relationships: { [key in RelationKind<A>]: Partial<RelationshipSpecification
|
|
1510
|
+
tags: { [key in Tag<A>]: TagSpecification; };
|
|
1511
|
+
elements: { [key in ElementKind<A>]: Partial<ElementSpecification>; };
|
|
1512
|
+
deployments: { [key in DeploymentKind<A>]: Partial<ElementSpecification>; };
|
|
1513
|
+
relationships: { [key in RelationKind<A>]: Partial<RelationshipSpecification>; };
|
|
1389
1514
|
metadataKeys?: IsNever<MetadataKey<A>> extends true ? never : MetadataKey<A>[];
|
|
1390
1515
|
customColors?: CustomColorDefinitions;
|
|
1391
1516
|
} : never;
|
|
@@ -1448,146 +1573,40 @@ interface LikeC4Project {
|
|
|
1448
1573
|
inferTechnologyFromIcon?: boolean | undefined;
|
|
1449
1574
|
}
|
|
1450
1575
|
//#endregion
|
|
1451
|
-
//#region src/types/view-computed.d.ts
|
|
1452
|
-
type ComputedNodeStyle = Simplify<ElementStyle & {
|
|
1453
|
-
icon?: never;
|
|
1454
|
-
shape?: never;
|
|
1455
|
-
color?: never;
|
|
1456
|
-
}>;
|
|
1457
|
-
interface ComputedNode<A extends Any = Any> extends WithTags<A>, WithOptionalLinks {
|
|
1458
|
-
/**
|
|
1459
|
-
* Element metadata, propagated from the model.
|
|
1460
|
-
* Uses a loose record type (instead of aux.WithMetadata<A>) to avoid
|
|
1461
|
-
* exactOptionalPropertyTypes conflicts when MetadataKey is a literal union.
|
|
1462
|
-
*/
|
|
1463
|
-
readonly metadata?: Readonly<Record<string, string | string[] | undefined>> | null;
|
|
1464
|
-
id: NodeId$1;
|
|
1465
|
-
kind: ElementKind<A> | DeploymentKind<A> | '@group';
|
|
1466
|
-
parent: NodeId$1 | null;
|
|
1467
|
-
/**
|
|
1468
|
-
* Reference to model element
|
|
1469
|
-
*/
|
|
1470
|
-
modelRef?: Fqn<A>;
|
|
1471
|
-
/**
|
|
1472
|
-
* Reference to deployment element
|
|
1473
|
-
*/
|
|
1474
|
-
deploymentRef?: DeploymentFqn<A>;
|
|
1475
|
-
title: string;
|
|
1476
|
-
/**
|
|
1477
|
-
* Description of the node
|
|
1478
|
-
* either summary or description
|
|
1479
|
-
*/
|
|
1480
|
-
description?: MarkdownOrString | null;
|
|
1481
|
-
technology?: string | null;
|
|
1482
|
-
children: NodeId$1[];
|
|
1483
|
-
inEdges: EdgeId$1[];
|
|
1484
|
-
outEdges: EdgeId$1[];
|
|
1485
|
-
shape: ElementShape;
|
|
1486
|
-
color: Color;
|
|
1487
|
-
icon?: Icon | null;
|
|
1488
|
-
style: ComputedNodeStyle;
|
|
1489
|
-
navigateTo?: StrictViewId<A> | null;
|
|
1490
|
-
level: number;
|
|
1491
|
-
depth?: number | null;
|
|
1492
|
-
/**
|
|
1493
|
-
* If this node was customized in the view
|
|
1494
|
-
*/
|
|
1495
|
-
isCustomized?: boolean;
|
|
1496
|
-
notation?: string | null;
|
|
1497
|
-
notes?: MarkdownOrString | undefined;
|
|
1498
|
-
}
|
|
1499
|
-
interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
|
|
1500
|
-
id: EdgeId$1;
|
|
1501
|
-
parent: NodeId$1 | null;
|
|
1502
|
-
source: NodeId$1;
|
|
1503
|
-
target: NodeId$1;
|
|
1504
|
-
label: string | null;
|
|
1505
|
-
description?: MarkdownOrString | null;
|
|
1506
|
-
technology?: string | null;
|
|
1507
|
-
relations: RelationId$1[];
|
|
1508
|
-
kind?: RelationKind<A> | typeof StepEdgeKind;
|
|
1509
|
-
notation?: string;
|
|
1510
|
-
notes?: MarkdownOrString;
|
|
1511
|
-
color: Color;
|
|
1512
|
-
line: RelationshipLineType;
|
|
1513
|
-
head?: RelationshipArrowType;
|
|
1514
|
-
tail?: RelationshipArrowType;
|
|
1515
|
-
navigateTo?: StrictViewId<A> | null;
|
|
1516
|
-
/**
|
|
1517
|
-
* If this edge is derived from custom relationship predicate
|
|
1518
|
-
*/
|
|
1519
|
-
isCustomized?: boolean;
|
|
1520
|
-
/**
|
|
1521
|
-
* Path to the AST node relative to the view body ast
|
|
1522
|
-
* Available only in dynamic views
|
|
1523
|
-
* @internal
|
|
1524
|
-
*/
|
|
1525
|
-
astPath?: string;
|
|
1526
|
-
/**
|
|
1527
|
-
* For layouting purposes
|
|
1528
|
-
* @default 'forward'
|
|
1529
|
-
*/
|
|
1530
|
-
dir?: 'forward' | 'back' | 'both';
|
|
1531
|
-
}
|
|
1532
|
-
interface ComputedRankConstraint {
|
|
1533
|
-
type: RankValue;
|
|
1534
|
-
nodes: NodeId$1[];
|
|
1535
|
-
}
|
|
1536
|
-
interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
1537
|
-
readonly [_stage]: 'computed';
|
|
1538
|
-
readonly autoLayout: ViewAutoLayout;
|
|
1539
|
-
readonly nodes: ReadonlyArray<ComputedNode<A>>;
|
|
1540
|
-
readonly edges: ReadonlyArray<ComputedEdge<A>>;
|
|
1541
|
-
/**
|
|
1542
|
-
* If the view has manual layout (v2)
|
|
1543
|
-
*/
|
|
1544
|
-
readonly hasManualLayout?: boolean;
|
|
1545
|
-
}
|
|
1546
|
-
interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1547
|
-
readonly [_type]: 'element';
|
|
1548
|
-
readonly viewOf?: Fqn<A>;
|
|
1549
|
-
readonly extends?: StrictViewId<A>;
|
|
1550
|
-
readonly ranks?: ComputedRankConstraint[];
|
|
1551
|
-
}
|
|
1552
|
-
interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1553
|
-
readonly [_type]: 'deployment';
|
|
1554
|
-
}
|
|
1555
|
-
interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1556
|
-
readonly [_type]: 'dynamic';
|
|
1557
|
-
/**
|
|
1558
|
-
* How to display the dynamic view
|
|
1559
|
-
* - `diagram`: display as a regular likec4 view
|
|
1560
|
-
* - `sequence`: display as a sequence diagram
|
|
1561
|
-
*/
|
|
1562
|
-
readonly variant: DynamicViewDisplayVariant;
|
|
1563
|
-
}
|
|
1564
|
-
//#endregion
|
|
1565
1576
|
//#region src/types/view-manual-layout.d.ts
|
|
1566
1577
|
type LayoutedViewDriftReason = 'not-exists' | 'type-changed' | 'nodes-added' | 'nodes-removed' | 'nodes-drift' | 'edges-added' | 'edges-removed' | 'edges-drift';
|
|
1567
1578
|
type DiagramNodeDriftReason = 'removed' | 'added' | 'label-changed' | 'modelRef-changed' | 'parent-changed' | 'children-changed' | 'became-compound' | 'became-leaf' | 'shape-changed';
|
|
1568
1579
|
type DiagramEdgeDriftReason = 'removed' | 'added' | 'label-added' | 'label-removed' | 'label-changed' | 'notes-changed' | 'direction-changed' | 'source-changed' | 'target-changed';
|
|
1569
|
-
type ViewManualLayoutSnapshotPerType = {
|
|
1570
|
-
readonly [_type]: 'element';
|
|
1571
|
-
readonly viewOf?: Fqn$1;
|
|
1572
|
-
readonly extends?: ViewId$1;
|
|
1573
|
-
} | {
|
|
1574
|
-
readonly [_type]: 'deployment';
|
|
1575
|
-
} | {
|
|
1576
|
-
readonly [_type]: 'dynamic';
|
|
1577
|
-
readonly sequenceLayout: LayoutedDynamicView.Sequence.Layout;
|
|
1578
|
-
};
|
|
1579
|
-
type ViewManualLayoutSnapshot<Type extends ViewType = ViewType> = Simplify<ViewManualLayoutSnapshotPerType & {
|
|
1580
|
+
type ViewManualLayoutSnapshotPerType = Simplify<{
|
|
1580
1581
|
readonly id: ViewId$1;
|
|
1581
1582
|
readonly title: string | null;
|
|
1582
1583
|
readonly description: MarkdownOrString | null;
|
|
1583
|
-
readonly [_type]: Type;
|
|
1584
1584
|
readonly [_stage]: 'layouted';
|
|
1585
1585
|
readonly hash: string;
|
|
1586
1586
|
readonly nodes: ReadonlyArray<DiagramNode>;
|
|
1587
1587
|
readonly edges: ReadonlyArray<DiagramEdge>;
|
|
1588
1588
|
readonly bounds: BBox;
|
|
1589
1589
|
readonly autoLayout: ViewAutoLayout;
|
|
1590
|
-
} & ViewWithNotation
|
|
1590
|
+
} & ViewWithNotation & ({
|
|
1591
|
+
readonly [_type]: 'element';
|
|
1592
|
+
readonly viewOf?: Fqn$1;
|
|
1593
|
+
readonly extends?: ViewId$1;
|
|
1594
|
+
} | {
|
|
1595
|
+
readonly [_type]: 'deployment';
|
|
1596
|
+
} | {
|
|
1597
|
+
readonly [_type]: 'dynamic';
|
|
1598
|
+
readonly flow?: DynamicViewFlowData;
|
|
1599
|
+
readonly sequenceLayout: LayoutedDynamicView.Sequence.Layout;
|
|
1600
|
+
})>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Snapshot of a view's manual layout.
|
|
1603
|
+
*
|
|
1604
|
+
* When Type is `any`, returns the union of all possible snapshot types.
|
|
1605
|
+
* When Type is a specific view type, returns the corresponding snapshot type.
|
|
1606
|
+
*/
|
|
1607
|
+
type ViewManualLayoutSnapshot<Type extends ViewType = ViewType> = IsAnyOrNever<Type> extends true ? never : Type extends (infer T extends string) ? Extract<ViewManualLayoutSnapshotPerType, {
|
|
1608
|
+
[_type]: T;
|
|
1609
|
+
}> : ViewManualLayoutSnapshotPerType;
|
|
1591
1610
|
//#endregion
|
|
1592
1611
|
//#region src/types/view-layouted.d.ts
|
|
1593
1612
|
interface DiagramNode<A extends Any = Any> extends ComputedNode<A>, BBox {
|
|
@@ -1681,6 +1700,13 @@ interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewPrope
|
|
|
1681
1700
|
* - `sequence`: display as a sequence diagram
|
|
1682
1701
|
*/
|
|
1683
1702
|
readonly variant: DynamicViewDisplayVariant;
|
|
1703
|
+
/**
|
|
1704
|
+
* Represents the complete flow structure for dynamic views, as a sequence of steps.
|
|
1705
|
+
* Can include nested flows, branches, loops, and conditional statements.
|
|
1706
|
+
*
|
|
1707
|
+
* (this can be undefined if read from manual snapshot)
|
|
1708
|
+
*/
|
|
1709
|
+
readonly flow?: DynamicViewFlowSteps;
|
|
1684
1710
|
/**
|
|
1685
1711
|
* Sequence layout of this dynamic view
|
|
1686
1712
|
*/
|
|
@@ -1697,7 +1723,7 @@ declare namespace LayoutedDynamicView {
|
|
|
1697
1723
|
readonly position: 'left' | 'right' | 'top' | 'bottom';
|
|
1698
1724
|
}
|
|
1699
1725
|
interface Actor {
|
|
1700
|
-
readonly id: NodeId;
|
|
1726
|
+
readonly id: NodeId$1;
|
|
1701
1727
|
readonly x: number;
|
|
1702
1728
|
readonly y: number;
|
|
1703
1729
|
readonly width: number;
|
|
@@ -1705,17 +1731,20 @@ declare namespace LayoutedDynamicView {
|
|
|
1705
1731
|
readonly ports: ReadonlyArray<ActorPort>;
|
|
1706
1732
|
}
|
|
1707
1733
|
interface Compound {
|
|
1708
|
-
readonly id: NodeId;
|
|
1734
|
+
readonly id: NodeId$1;
|
|
1709
1735
|
/**
|
|
1710
1736
|
* Original node id, since multiple compound nodes can be built from one node
|
|
1711
1737
|
*/
|
|
1712
|
-
readonly origin: NodeId;
|
|
1738
|
+
readonly origin: NodeId$1;
|
|
1713
1739
|
readonly x: number;
|
|
1714
1740
|
readonly y: number;
|
|
1715
1741
|
readonly width: number;
|
|
1716
1742
|
readonly height: number;
|
|
1717
1743
|
readonly depth: number;
|
|
1718
1744
|
}
|
|
1745
|
+
/**
|
|
1746
|
+
* @deprecated Use SubflowArea instead
|
|
1747
|
+
*/
|
|
1719
1748
|
interface ParallelArea {
|
|
1720
1749
|
readonly parallelPrefix: string;
|
|
1721
1750
|
readonly x: number;
|
|
@@ -1723,14 +1752,29 @@ declare namespace LayoutedDynamicView {
|
|
|
1723
1752
|
readonly width: number;
|
|
1724
1753
|
readonly height: number;
|
|
1725
1754
|
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Represents an area around some flow control block
|
|
1757
|
+
* (the rest my be read from `view.flow`)
|
|
1758
|
+
*/
|
|
1759
|
+
interface SubflowArea {
|
|
1760
|
+
readonly id: StepPath;
|
|
1761
|
+
readonly x: number;
|
|
1762
|
+
readonly y: number;
|
|
1763
|
+
readonly width: number;
|
|
1764
|
+
readonly height: number;
|
|
1765
|
+
}
|
|
1726
1766
|
interface Step {
|
|
1727
|
-
readonly id:
|
|
1767
|
+
readonly id: StepPath;
|
|
1728
1768
|
readonly labelBBox?: {
|
|
1729
1769
|
width: number;
|
|
1730
1770
|
height: number;
|
|
1731
1771
|
} | undefined;
|
|
1732
1772
|
readonly sourceHandle: string;
|
|
1733
1773
|
readonly targetHandle: string;
|
|
1774
|
+
/**
|
|
1775
|
+
* Step is hidden if it is inside a collapsed subflow
|
|
1776
|
+
*/
|
|
1777
|
+
readonly hidden?: boolean;
|
|
1734
1778
|
}
|
|
1735
1779
|
interface Layout {
|
|
1736
1780
|
readonly actors: ReadonlyArray<Actor>;
|
|
@@ -1739,12 +1783,700 @@ declare namespace LayoutedDynamicView {
|
|
|
1739
1783
|
*/
|
|
1740
1784
|
readonly steps: ReadonlyArray<Step>;
|
|
1741
1785
|
readonly compounds: ReadonlyArray<Compound>;
|
|
1786
|
+
/**
|
|
1787
|
+
* @deprecated Use subflows instead
|
|
1788
|
+
*/
|
|
1742
1789
|
readonly parallelAreas: ReadonlyArray<ParallelArea>;
|
|
1790
|
+
readonly subflows: ReadonlyArray<SubflowArea>;
|
|
1743
1791
|
readonly bounds: BBox;
|
|
1744
1792
|
}
|
|
1745
1793
|
}
|
|
1746
1794
|
}
|
|
1747
1795
|
//#endregion
|
|
1796
|
+
//#region src/types/view-dynamic-flow.d.ts
|
|
1797
|
+
type WithFlowBase<Dict extends {}> = { [T in keyof Dict]: Simplify<{
|
|
1798
|
+
readonly '_type': T;
|
|
1799
|
+
/**
|
|
1800
|
+
* Prefix for step IDs in this flow (undefined for top-level flow)
|
|
1801
|
+
*/
|
|
1802
|
+
readonly id: StepPath;
|
|
1803
|
+
readonly title?: string | undefined;
|
|
1804
|
+
} & Dict[T]>; };
|
|
1805
|
+
/**
|
|
1806
|
+
* All possible sub-flow types
|
|
1807
|
+
*/
|
|
1808
|
+
type SubFlows = WithFlowBase<{ [T in 'loop' | 'opt' | 'par' | 'break']: {
|
|
1809
|
+
readonly flow: DynamicViewFlowSteps;
|
|
1810
|
+
}; } & { [B in `try-${'block' | 'catch' | 'finally'}` | `alt-${'when' | 'else' | 'if'}`]: {
|
|
1811
|
+
readonly flow: DynamicViewFlowSteps;
|
|
1812
|
+
}; } & {
|
|
1813
|
+
'try': {
|
|
1814
|
+
/**
|
|
1815
|
+
* Allowed flows:
|
|
1816
|
+
* try, try-catch, try-finally, try-catch-finally,
|
|
1817
|
+
*/
|
|
1818
|
+
readonly flow: readonly [Subflow<'try-block'>] | readonly [Subflow<'try-block'>, Subflow<'try-catch' | 'try-finally'>] | readonly [Subflow<'try-block'>, Subflow<'try-catch'>, Subflow<'try-finally'>];
|
|
1819
|
+
};
|
|
1820
|
+
'alt': {
|
|
1821
|
+
/**
|
|
1822
|
+
* Allowed branch flows:
|
|
1823
|
+
* when, else, if
|
|
1824
|
+
*/
|
|
1825
|
+
readonly flow: readonly Subflow<'alt-when' | 'alt-else' | 'alt-if'>[];
|
|
1826
|
+
};
|
|
1827
|
+
}>;
|
|
1828
|
+
type SubflowType = keyof SubFlows;
|
|
1829
|
+
type Subflow<T extends SubflowType> = SubFlows[T];
|
|
1830
|
+
type AnySubflow = SubFlows[SubflowType];
|
|
1831
|
+
type NestedOf<T extends SubflowType> = SubFlows[T] extends {
|
|
1832
|
+
flow: IterableContainer<infer F>;
|
|
1833
|
+
} ? F : never;
|
|
1834
|
+
type ParentOf<T extends SubflowType> = IsAnyOrNever<T> extends true ? never : IsEqual<SubflowType, T> extends true ? SubflowType : T extends `try-${string}` ? 'try' : T extends `alt-${string}` ? 'alt' : Exclude<SubflowType, 'alt' | 'try'>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Sub-flows that can be used in dynamic view flows: `alt`, `try`, `loop`, `opt`, `par`, `break`
|
|
1837
|
+
*
|
|
1838
|
+
* (excluding branch flows like `try-block`, `alt-when`, etc. - as they exist only within their parent)
|
|
1839
|
+
*/
|
|
1840
|
+
type DynamicViewSubFlow = Subflow<'alt' | 'try' | 'loop' | 'opt' | 'par' | 'break'>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Generic step in a dynamic view flow
|
|
1843
|
+
* Either a String, meaning it is relation `A -> B`, lookup in edges) or a sub-flow
|
|
1844
|
+
*
|
|
1845
|
+
* @see DynamicViewSubFlow
|
|
1846
|
+
*/
|
|
1847
|
+
type DynamicViewFlowStep = StepPath | DynamicViewSubFlow;
|
|
1848
|
+
/**
|
|
1849
|
+
* Generic steps in a dynamic view flow
|
|
1850
|
+
* @see DynamicViewFlowStep
|
|
1851
|
+
*/
|
|
1852
|
+
type DynamicViewFlowSteps = ReadonlyArray<DynamicViewFlowStep>;
|
|
1853
|
+
/**
|
|
1854
|
+
* Represents the complete flow structure for dynamic views, as a sequence of steps.
|
|
1855
|
+
* Can include nested flows, branches, loops, and conditional statements.
|
|
1856
|
+
*/
|
|
1857
|
+
type DynamicViewFlowData = DynamicViewFlowSteps;
|
|
1858
|
+
declare namespace DynamicViewFlow {
|
|
1859
|
+
type SubFlowType = SubflowType;
|
|
1860
|
+
/**
|
|
1861
|
+
* Sub-flow types that can be used in dynamic view flows (excluding nested blocks like try-block, alt-when, etc.)
|
|
1862
|
+
* alt, try, loop, opt, par
|
|
1863
|
+
*/
|
|
1864
|
+
type SubFlow = DynamicViewSubFlow;
|
|
1865
|
+
type Step = DynamicViewFlowStep;
|
|
1866
|
+
type Steps = DynamicViewFlowSteps;
|
|
1867
|
+
type AnyStep = StepPath | AnySubflow;
|
|
1868
|
+
namespace SubFlow {
|
|
1869
|
+
/**
|
|
1870
|
+
* Any subflow type, including nested branches (alt-when, alt-else, alt-if, try-catch, try-finally)
|
|
1871
|
+
*/
|
|
1872
|
+
type Any = AnySubflow;
|
|
1873
|
+
/**
|
|
1874
|
+
* Generic subflow type for a given subflow type
|
|
1875
|
+
* @example
|
|
1876
|
+
* ```ts
|
|
1877
|
+
* type AltOrTry = DynamicViewFlow.SubFlow.Of<'alt' | 'try'>
|
|
1878
|
+
* ```
|
|
1879
|
+
*/
|
|
1880
|
+
type Of<T extends SubflowType> = Subflow<T>;
|
|
1881
|
+
type Alt = Subflow<'alt'>;
|
|
1882
|
+
namespace Alt {
|
|
1883
|
+
type Branch = Subflow<'alt-when' | 'alt-else' | 'alt-if'>;
|
|
1884
|
+
}
|
|
1885
|
+
type Try = Subflow<'try'>;
|
|
1886
|
+
namespace Try {
|
|
1887
|
+
type Block = Subflow<'try-block'>;
|
|
1888
|
+
type Catch = Subflow<'try-catch'>;
|
|
1889
|
+
type Finally = Subflow<'try-finally'>;
|
|
1890
|
+
type Any = Block | Catch | Finally;
|
|
1891
|
+
}
|
|
1892
|
+
type Loop = Subflow<'loop'>;
|
|
1893
|
+
type Opt = Subflow<'opt'>;
|
|
1894
|
+
type Par = Subflow<'par'>;
|
|
1895
|
+
type Break = Subflow<'break'>;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
type StepPathOrFlow = StepPath | {
|
|
1899
|
+
readonly id: StepPath;
|
|
1900
|
+
};
|
|
1901
|
+
declare function isSubFlow<T extends AnyStep>(step: T): step is Exclude<T, string>;
|
|
1902
|
+
declare function isSubFlow(step: unknown): step is AnySubflow;
|
|
1903
|
+
declare const flowGuards: {
|
|
1904
|
+
isStepPath: typeof isStepPath;
|
|
1905
|
+
isSubFlow: typeof isSubFlow;
|
|
1906
|
+
isTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try;
|
|
1907
|
+
isTryBlock: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Block;
|
|
1908
|
+
isAlt: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt;
|
|
1909
|
+
isAltBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt.Branch;
|
|
1910
|
+
isTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any;
|
|
1911
|
+
isAltOrTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try | DynamicViewFlow.SubFlow.Alt;
|
|
1912
|
+
isAltOrTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any | DynamicViewFlow.SubFlow.Alt.Branch;
|
|
1913
|
+
type: {
|
|
1914
|
+
isAltOrTry: (value: unknown) => value is "alt" | "try";
|
|
1915
|
+
isAltBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Alt.Branch["_type"];
|
|
1916
|
+
isTryBlock: (value: unknown) => value is "try-block";
|
|
1917
|
+
isTryBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Try.Any["_type"];
|
|
1918
|
+
isAltOrTryBranch: <V>(value: V) => value is Extract<V, `${"alt" | "try"}-${string}`>;
|
|
1919
|
+
};
|
|
1920
|
+
};
|
|
1921
|
+
/**
|
|
1922
|
+
* Returns a function that checks if flow has a step (either directly or as a subflow)
|
|
1923
|
+
*/
|
|
1924
|
+
declare function includes(step: StepPathOrFlow): (flow: StepPathOrFlow) => boolean;
|
|
1925
|
+
/**
|
|
1926
|
+
* Checks if flow has a step (either directly or as a subflow)
|
|
1927
|
+
* @example
|
|
1928
|
+
* ```ts
|
|
1929
|
+
* includes(flow, 'step-path')
|
|
1930
|
+
* includes(flow, anotherFlow)
|
|
1931
|
+
* ```
|
|
1932
|
+
*/
|
|
1933
|
+
declare function includes(flow: StepPathOrFlow, step: StepPathOrFlow): boolean;
|
|
1934
|
+
/**
|
|
1935
|
+
* Returns a function that checks if a step is before other step,
|
|
1936
|
+
*/
|
|
1937
|
+
declare function isBefore(other: StepPathOrFlow): (step: StepPathOrFlow) => boolean;
|
|
1938
|
+
/**
|
|
1939
|
+
* Checks if a step is before another step
|
|
1940
|
+
*/
|
|
1941
|
+
declare function isBefore(step: StepPathOrFlow, other: StepPathOrFlow): boolean;
|
|
1942
|
+
declare const flowHelpers: {
|
|
1943
|
+
unwindTry: (step: {
|
|
1944
|
+
flow: DynamicViewFlow.SubFlow.Try["flow"];
|
|
1945
|
+
}) => {
|
|
1946
|
+
tryBlock: DynamicViewFlow.SubFlow.Try.Block;
|
|
1947
|
+
catchBlock: DynamicViewFlow.SubFlow.Try.Catch | null;
|
|
1948
|
+
finallyBlock: DynamicViewFlow.SubFlow.Try.Finally | null;
|
|
1949
|
+
};
|
|
1950
|
+
/**
|
|
1951
|
+
* Returns first step in flow
|
|
1952
|
+
*/
|
|
1953
|
+
firstStep: (anystepOrFlow: DynamicViewFlow.AnyStep | readonly DynamicViewFlow.AnyStep[]) => StepPath | null;
|
|
1954
|
+
hasSteps: <F extends AnySubflow>(subflow: F) => boolean;
|
|
1955
|
+
/**
|
|
1956
|
+
* Returns steps of the subflow (excluding nested subflows) (non-recursive)
|
|
1957
|
+
*/
|
|
1958
|
+
steps: (subflow: {
|
|
1959
|
+
flow: IterableContainer<StepPath>;
|
|
1960
|
+
}) => StepPath[];
|
|
1961
|
+
/**
|
|
1962
|
+
* Returns nested subflows (excluding steps) (non-recursive)
|
|
1963
|
+
*/
|
|
1964
|
+
subflows: <N extends {
|
|
1965
|
+
_type: string;
|
|
1966
|
+
}>(subflow: {
|
|
1967
|
+
flow: IterableContainer<StepPath | N>;
|
|
1968
|
+
}) => N[];
|
|
1969
|
+
/**
|
|
1970
|
+
* Returns true if the subflow has nested subflows
|
|
1971
|
+
*/
|
|
1972
|
+
hasSubflows: (subflow: {
|
|
1973
|
+
flow: IterableContainer<StepPath | AnySubflow>;
|
|
1974
|
+
}) => boolean;
|
|
1975
|
+
isBefore: typeof isBefore;
|
|
1976
|
+
includes: typeof includes;
|
|
1977
|
+
};
|
|
1978
|
+
/**
|
|
1979
|
+
* Returns the ids of all ancestor subflows that enclose the given step path,
|
|
1980
|
+
* ordered from the outermost flow to the innermost (closest) one.
|
|
1981
|
+
*
|
|
1982
|
+
* A {@link scalar.StepPath} is a `.`-joined chain of segments where every
|
|
1983
|
+
* subflow segment carries a `NN:type` suffix (e.g. `02:opt`, `03:try`,
|
|
1984
|
+
* `01:block`), while a plain step segment is just its number (`NN`). Every
|
|
1985
|
+
* prefix that ends in such a `:`-bearing segment is therefore an ancestor flow.
|
|
1986
|
+
*
|
|
1987
|
+
* The path itself is never included — a flow is not its own ancestor — so
|
|
1988
|
+
* passing a flow id returns only the flows above it.
|
|
1989
|
+
*
|
|
1990
|
+
* @example
|
|
1991
|
+
* flowAncestors('step-01.02:opt.03:try.04' as StepPath)
|
|
1992
|
+
* // => ['step-01.02:opt', 'step-01.02:opt.03:try']
|
|
1993
|
+
*/
|
|
1994
|
+
declare function flowAncestors(path: EdgeId$1 | StepPath): StepPath[];
|
|
1995
|
+
/**
|
|
1996
|
+
* Returns the id of the immediate parent flow that directly encloses the given
|
|
1997
|
+
* step path, or `null` when the path lives at the top level.
|
|
1998
|
+
*
|
|
1999
|
+
* The parent is the innermost of {@link flowAncestors} — the longest prefix that
|
|
2000
|
+
* ends in a `:`-bearing subflow segment, excluding the path itself.
|
|
2001
|
+
*
|
|
2002
|
+
* @example
|
|
2003
|
+
* parentFlow('step-02:opt.03:try.04' as StepPath) // => 'step-02:opt.03:try'
|
|
2004
|
+
* parentFlow('step-02:opt.03:try' as StepPath) // => 'step-02:opt'
|
|
2005
|
+
* parentFlow('step-04' as StepPath) // => null
|
|
2006
|
+
*/
|
|
2007
|
+
declare function parentFlow(path: EdgeId$1 | StepPath | undefined | null): StepPath | null;
|
|
2008
|
+
type StepCtx<V extends ProcessedDynamicView<any>, R = DynamicViewFlow.AnyStep> = {
|
|
2009
|
+
readonly step: StepPath;
|
|
2010
|
+
readonly edge: V['edges'][number];
|
|
2011
|
+
readonly source: V['nodes'][number];
|
|
2012
|
+
readonly target: V['nodes'][number];
|
|
2013
|
+
readonly stepnum: {
|
|
2014
|
+
/**
|
|
2015
|
+
* Step number within current flow (1-based)
|
|
2016
|
+
*/
|
|
2017
|
+
readonly index: number;
|
|
2018
|
+
/**
|
|
2019
|
+
* Global step number across all flows (1-based)
|
|
2020
|
+
*/
|
|
2021
|
+
readonly global: number;
|
|
2022
|
+
};
|
|
2023
|
+
readonly level: number;
|
|
2024
|
+
readonly parent: SubflowHookCtx | null;
|
|
2025
|
+
readonly stopAndReturn: (step?: R | undefined) => never;
|
|
2026
|
+
};
|
|
2027
|
+
type SubflowHookCtx<T extends SubflowType = SubflowType, R = DynamicViewFlow.AnyStep> = {
|
|
2028
|
+
readonly id: StepPath;
|
|
2029
|
+
readonly type: T;
|
|
2030
|
+
readonly subflow: Subflow<T>;
|
|
2031
|
+
readonly previous: SubFlows[ParentOf<T>]['flow'][number] | null;
|
|
2032
|
+
readonly parent: SubflowHookCtx<ParentOf<T>> | null;
|
|
2033
|
+
readonly level: number;
|
|
2034
|
+
readonly stopAndReturn: (step?: R | undefined) => never;
|
|
2035
|
+
};
|
|
2036
|
+
type OnLeave<T extends SubflowType = SubflowType> = (onleave: {
|
|
2037
|
+
visited: Array<NestedOf<T>>;
|
|
2038
|
+
lastVisited: NestedOf<T> | null;
|
|
2039
|
+
}) => void;
|
|
2040
|
+
type SubflowHookResult<T extends SubflowType = SubflowType> = {
|
|
2041
|
+
/**
|
|
2042
|
+
* Next subflow(s) to visit, or undefined to continue with the default behavior
|
|
2043
|
+
*
|
|
2044
|
+
* @example
|
|
2045
|
+
* { next: 'step-02:opt.03:try' } // Single subflow
|
|
2046
|
+
* { next: ['step-02:opt.03:try', 'step-02:opt.04:catch'] } // Multiple subflows
|
|
2047
|
+
* { next: undefined } // Continue with default behavior
|
|
2048
|
+
*/
|
|
2049
|
+
next?: undefined | NestedOf<T> | ArrayLike<NestedOf<T> | undefined>;
|
|
2050
|
+
/**
|
|
2051
|
+
* Callback function that is called when leaving the subflow
|
|
2052
|
+
*/
|
|
2053
|
+
onLeave?: OnLeave<T>;
|
|
2054
|
+
};
|
|
2055
|
+
interface SubflowHook<T extends SubflowType = SubflowType, R = DynamicViewFlow.AnyStep> {
|
|
2056
|
+
/**
|
|
2057
|
+
* Callback function that is called on entry to each subflow.
|
|
2058
|
+
*
|
|
2059
|
+
* @param ctx - The context of the subflow
|
|
2060
|
+
* @returns {true} - Continue walking
|
|
2061
|
+
* @returns {void} - Continue walking
|
|
2062
|
+
* @returns {false} - Stop walking
|
|
2063
|
+
* @returns {OnLeave} - Continue walking with onLeave callback
|
|
2064
|
+
* @returns {SubflowHookResult<T>} - Continue walking with custom configuration
|
|
2065
|
+
*/
|
|
2066
|
+
(ctx: SubflowHookCtx<T, R>): boolean | void | OnLeave<T> | SubflowHookResult<T>;
|
|
2067
|
+
}
|
|
2068
|
+
type SubflowHookPerType<R> = Partial<Simplify<{ [K in SubflowType]: SubflowHook<K, R> | boolean; } & {
|
|
2069
|
+
default: SubflowHook<SubflowType, R>;
|
|
2070
|
+
}>>;
|
|
2071
|
+
type WalkCallback<V extends ProcessedDynamicView<any>, R = DynamicViewFlow.AnyStep> = {
|
|
2072
|
+
step?: (ctx: StepCtx<V, R>) => void;
|
|
2073
|
+
subflow?: SubflowHook<SubflowType, R> | SubflowHookPerType<R>;
|
|
2074
|
+
};
|
|
2075
|
+
/**
|
|
2076
|
+
* Walks through the dynamic view flow and calls the callback for each step and subflow.
|
|
2077
|
+
* (Tree walker)
|
|
2078
|
+
*
|
|
2079
|
+
* @param view - The dynamic view to walk through
|
|
2080
|
+
* @param callback - The callback to call for each step and subflow
|
|
2081
|
+
*
|
|
2082
|
+
* @example
|
|
2083
|
+
* ```ts
|
|
2084
|
+
* walkthroughFlow(view, {
|
|
2085
|
+
* step: ({step, stepnum}) => {
|
|
2086
|
+
* console.log(`Step ${stepnum.global}: ${step}`)
|
|
2087
|
+
* },
|
|
2088
|
+
* subflow: ({subflow}) => {
|
|
2089
|
+
* console.log(`Subflow ${subflow._type}: ${subflow.id}`)
|
|
2090
|
+
* return {
|
|
2091
|
+
* next: subflow.flow,
|
|
2092
|
+
* onLeave: () => {
|
|
2093
|
+
* console.log(`Left subflow ${subflow._type}`)
|
|
2094
|
+
* }
|
|
2095
|
+
* }
|
|
2096
|
+
* }
|
|
2097
|
+
* })
|
|
2098
|
+
* ```
|
|
2099
|
+
*/
|
|
2100
|
+
declare function walkthroughFlow<R extends DynamicViewFlow.AnyStep = DynamicViewFlow.AnyStep>(callback: WalkCallback<ProcessedDynamicView<any>, R>): (view: ProcessedDynamicView<any>) => R | undefined;
|
|
2101
|
+
declare function walkthroughFlow<V extends ProcessedDynamicView<any> = ProcessedDynamicView<any>, R extends DynamicViewFlow.AnyStep = DynamicViewFlow.AnyStep>(view: V, callback: WalkCallback<V, R>): R | undefined;
|
|
2102
|
+
declare namespace walkthroughFlow {
|
|
2103
|
+
var onSubflows: {
|
|
2104
|
+
<const T extends SubflowType & string, R = DynamicViewFlow.AnyStep>(types: T, callback: SubflowHook<NoInfer<T>, NoInfer<R>>): { [K in T]: SubflowHook<K, R>; };
|
|
2105
|
+
<const T extends readonly [SubflowType, ...SubflowType[]], R = DynamicViewFlow.AnyStep>(types: T, callback: SubflowHook<NoInfer<T>[number], NoInfer<R>>): { [K in T[number]]: SubflowHook<K, R>; };
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Creates a map of hooks for the given subflow types.
|
|
2110
|
+
* Each hook will be called when the corresponding subflow is entered.
|
|
2111
|
+
* @example
|
|
2112
|
+
* ```ts
|
|
2113
|
+
* walkthrough({
|
|
2114
|
+
* view,
|
|
2115
|
+
* subflow: {
|
|
2116
|
+
* ...walkthrough.onSubflows(['try', 'alt'], ({subflow}) => {
|
|
2117
|
+
* // ...
|
|
2118
|
+
* // subflow is typed
|
|
2119
|
+
* }),
|
|
2120
|
+
* },
|
|
2121
|
+
* })
|
|
2122
|
+
* ```
|
|
2123
|
+
*/
|
|
2124
|
+
declare function onSubflows<const T extends SubflowType & string, R = DynamicViewFlow.AnyStep>(types: T, callback: SubflowHook<NoInfer<T>, NoInfer<R>>): { [K in T]: SubflowHook<K, R>; };
|
|
2125
|
+
declare function onSubflows<const T extends readonly [SubflowType, ...SubflowType[]], R = DynamicViewFlow.AnyStep>(types: T, callback: SubflowHook<NoInfer<T>[number], NoInfer<R>>): { [K in T[number]]: SubflowHook<K, R>; };
|
|
2126
|
+
/**
|
|
2127
|
+
* Creates a DynamicViewFlow instance from a dynamic view.
|
|
2128
|
+
* This is a convenience function that wraps DynamicViewFlowOps.from().
|
|
2129
|
+
*/
|
|
2130
|
+
declare function dynamicViewFlow<V extends ProcessedDynamicView<any>>(view: V): DynamicViewFlow<V>;
|
|
2131
|
+
declare class DynamicViewFlow<V extends ProcessedDynamicView<any> = LayoutedDynamicView> {
|
|
2132
|
+
private static cache;
|
|
2133
|
+
static from<V extends ProcessedDynamicView<any>>(view: V): DynamicViewFlow<V>;
|
|
2134
|
+
static readonly guards: {
|
|
2135
|
+
isStepPath: typeof isStepPath;
|
|
2136
|
+
isSubFlow: typeof isSubFlow;
|
|
2137
|
+
isTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try;
|
|
2138
|
+
isTryBlock: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Block;
|
|
2139
|
+
isAlt: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt;
|
|
2140
|
+
isAltBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt.Branch;
|
|
2141
|
+
isTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any;
|
|
2142
|
+
isAltOrTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try | DynamicViewFlow.SubFlow.Alt;
|
|
2143
|
+
isAltOrTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any | DynamicViewFlow.SubFlow.Alt.Branch;
|
|
2144
|
+
type: {
|
|
2145
|
+
isAltOrTry: (value: unknown) => value is "alt" | "try";
|
|
2146
|
+
isAltBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Alt.Branch["_type"];
|
|
2147
|
+
isTryBlock: (value: unknown) => value is "try-block";
|
|
2148
|
+
isTryBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Try.Any["_type"];
|
|
2149
|
+
isAltOrTryBranch: <V_1>(value: V_1) => value is Extract<V_1, `${"alt" | "try"}-${string}`>;
|
|
2150
|
+
};
|
|
2151
|
+
};
|
|
2152
|
+
static readonly helpers: {
|
|
2153
|
+
unwindTry: (step: {
|
|
2154
|
+
flow: DynamicViewFlow.SubFlow.Try["flow"];
|
|
2155
|
+
}) => {
|
|
2156
|
+
tryBlock: DynamicViewFlow.SubFlow.Try.Block;
|
|
2157
|
+
catchBlock: DynamicViewFlow.SubFlow.Try.Catch | null;
|
|
2158
|
+
finallyBlock: DynamicViewFlow.SubFlow.Try.Finally | null;
|
|
2159
|
+
};
|
|
2160
|
+
/**
|
|
2161
|
+
* Returns first step in flow
|
|
2162
|
+
*/
|
|
2163
|
+
firstStep: (anystepOrFlow: DynamicViewFlow.AnyStep | readonly DynamicViewFlow.AnyStep[]) => StepPath | null;
|
|
2164
|
+
hasSteps: <F extends AnySubflow>(subflow: F) => boolean;
|
|
2165
|
+
/**
|
|
2166
|
+
* Returns steps of the subflow (excluding nested subflows) (non-recursive)
|
|
2167
|
+
*/
|
|
2168
|
+
steps: (subflow: {
|
|
2169
|
+
flow: IterableContainer<StepPath>;
|
|
2170
|
+
}) => StepPath[];
|
|
2171
|
+
/**
|
|
2172
|
+
* Returns nested subflows (excluding steps) (non-recursive)
|
|
2173
|
+
*/
|
|
2174
|
+
subflows: <N extends {
|
|
2175
|
+
_type: string;
|
|
2176
|
+
}>(subflow: {
|
|
2177
|
+
flow: IterableContainer<StepPath | N>;
|
|
2178
|
+
}) => N[];
|
|
2179
|
+
/**
|
|
2180
|
+
* Returns true if the subflow has nested subflows
|
|
2181
|
+
*/
|
|
2182
|
+
hasSubflows: (subflow: {
|
|
2183
|
+
flow: IterableContainer<StepPath | AnySubflow>;
|
|
2184
|
+
}) => boolean;
|
|
2185
|
+
isBefore: typeof isBefore;
|
|
2186
|
+
includes: typeof includes;
|
|
2187
|
+
};
|
|
2188
|
+
readonly unwindTry: (step: {
|
|
2189
|
+
flow: DynamicViewFlow.SubFlow.Try["flow"];
|
|
2190
|
+
}) => {
|
|
2191
|
+
tryBlock: DynamicViewFlow.SubFlow.Try.Block;
|
|
2192
|
+
catchBlock: DynamicViewFlow.SubFlow.Try.Catch | null;
|
|
2193
|
+
finallyBlock: DynamicViewFlow.SubFlow.Try.Finally | null;
|
|
2194
|
+
};
|
|
2195
|
+
readonly isBefore: typeof isBefore;
|
|
2196
|
+
readonly includes: typeof includes;
|
|
2197
|
+
readonly onSubflows: typeof onSubflows;
|
|
2198
|
+
readonly guards: {
|
|
2199
|
+
isStepPath: typeof isStepPath;
|
|
2200
|
+
isSubFlow: typeof isSubFlow;
|
|
2201
|
+
isTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try;
|
|
2202
|
+
isTryBlock: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Block;
|
|
2203
|
+
isAlt: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt;
|
|
2204
|
+
isAltBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Alt.Branch;
|
|
2205
|
+
isTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any;
|
|
2206
|
+
isAltOrTry: (step: unknown) => step is DynamicViewFlow.SubFlow.Try | DynamicViewFlow.SubFlow.Alt;
|
|
2207
|
+
isAltOrTryBranch: (step: unknown) => step is DynamicViewFlow.SubFlow.Try.Any | DynamicViewFlow.SubFlow.Alt.Branch;
|
|
2208
|
+
type: {
|
|
2209
|
+
isAltOrTry: (value: unknown) => value is "alt" | "try";
|
|
2210
|
+
isAltBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Alt.Branch["_type"];
|
|
2211
|
+
isTryBlock: (value: unknown) => value is "try-block";
|
|
2212
|
+
isTryBranch: (value: unknown) => value is DynamicViewFlow.SubFlow.Try.Any["_type"];
|
|
2213
|
+
isAltOrTryBranch: <V_1>(value: V_1) => value is Extract<V_1, `${"alt" | "try"}-${string}`>;
|
|
2214
|
+
};
|
|
2215
|
+
};
|
|
2216
|
+
readonly helpers: {
|
|
2217
|
+
unwindTry: (step: {
|
|
2218
|
+
flow: DynamicViewFlow.SubFlow.Try["flow"];
|
|
2219
|
+
}) => {
|
|
2220
|
+
tryBlock: DynamicViewFlow.SubFlow.Try.Block;
|
|
2221
|
+
catchBlock: DynamicViewFlow.SubFlow.Try.Catch | null;
|
|
2222
|
+
finallyBlock: DynamicViewFlow.SubFlow.Try.Finally | null;
|
|
2223
|
+
};
|
|
2224
|
+
/**
|
|
2225
|
+
* Returns first step in flow
|
|
2226
|
+
*/
|
|
2227
|
+
firstStep: (anystepOrFlow: DynamicViewFlow.AnyStep | readonly DynamicViewFlow.AnyStep[]) => StepPath | null;
|
|
2228
|
+
hasSteps: <F extends AnySubflow>(subflow: F) => boolean;
|
|
2229
|
+
/**
|
|
2230
|
+
* Returns steps of the subflow (excluding nested subflows) (non-recursive)
|
|
2231
|
+
*/
|
|
2232
|
+
steps: (subflow: {
|
|
2233
|
+
flow: IterableContainer<StepPath>;
|
|
2234
|
+
}) => StepPath[];
|
|
2235
|
+
/**
|
|
2236
|
+
* Returns nested subflows (excluding steps) (non-recursive)
|
|
2237
|
+
*/
|
|
2238
|
+
subflows: <N extends {
|
|
2239
|
+
_type: string;
|
|
2240
|
+
}>(subflow: {
|
|
2241
|
+
flow: IterableContainer<StepPath | N>;
|
|
2242
|
+
}) => N[];
|
|
2243
|
+
/**
|
|
2244
|
+
* Returns true if the subflow has nested subflows
|
|
2245
|
+
*/
|
|
2246
|
+
hasSubflows: (subflow: {
|
|
2247
|
+
flow: IterableContainer<StepPath | AnySubflow>;
|
|
2248
|
+
}) => boolean;
|
|
2249
|
+
isBefore: typeof isBefore;
|
|
2250
|
+
includes: typeof includes;
|
|
2251
|
+
};
|
|
2252
|
+
/**
|
|
2253
|
+
* View (flow is defined)
|
|
2254
|
+
*/
|
|
2255
|
+
readonly view: V & {
|
|
2256
|
+
flow: DynamicViewFlowData;
|
|
2257
|
+
};
|
|
2258
|
+
private levelById;
|
|
2259
|
+
private byId;
|
|
2260
|
+
readonly stepsCount: number;
|
|
2261
|
+
private constructor();
|
|
2262
|
+
/**
|
|
2263
|
+
* Returns all known step paths in the flow
|
|
2264
|
+
*/
|
|
2265
|
+
get paths(): readonly StepPath[];
|
|
2266
|
+
/**
|
|
2267
|
+
* Returns level in hierarchy (for z-indexes)
|
|
2268
|
+
*/
|
|
2269
|
+
level(step: StepPath | {
|
|
2270
|
+
id: StepPath;
|
|
2271
|
+
}): number;
|
|
2272
|
+
/**
|
|
2273
|
+
* Returns the parent subflow of the given step path, or undefined if the step is not nested.
|
|
2274
|
+
* @param step The step path to find the parent for.
|
|
2275
|
+
* @returns The parent subflow, or undefined if the step is not nested.
|
|
2276
|
+
*/
|
|
2277
|
+
parent<N extends AnySubflow>(subflow: N): Subflow<ParentOf<N['_type']>> | undefined;
|
|
2278
|
+
parent(step: StepPath | EdgeId$1 | {
|
|
2279
|
+
id: StepPath;
|
|
2280
|
+
}): DynamicViewFlow.SubFlow.Any | undefined;
|
|
2281
|
+
/**
|
|
2282
|
+
* Returns very first step in dynamic view
|
|
2283
|
+
*/
|
|
2284
|
+
firstStep(): StepPath;
|
|
2285
|
+
/**
|
|
2286
|
+
* Returns very first step in subflow
|
|
2287
|
+
*/
|
|
2288
|
+
firstStep(subflow: StepPath | {
|
|
2289
|
+
id: StepPath;
|
|
2290
|
+
}): StepPath | null;
|
|
2291
|
+
/**
|
|
2292
|
+
* Checks if the given path is a step (i.e `A -> B>)
|
|
2293
|
+
*/
|
|
2294
|
+
isStep(path: StepPath): boolean;
|
|
2295
|
+
/**
|
|
2296
|
+
* Checks if the given path is a flow
|
|
2297
|
+
*/
|
|
2298
|
+
isSubflow(path: StepPath): boolean;
|
|
2299
|
+
/**
|
|
2300
|
+
* Returns top level steps
|
|
2301
|
+
*/
|
|
2302
|
+
steps(): readonly StepPath[];
|
|
2303
|
+
/**
|
|
2304
|
+
* Returns steps in subflow
|
|
2305
|
+
*/
|
|
2306
|
+
steps(subflow: StepPath | {
|
|
2307
|
+
id: StepPath;
|
|
2308
|
+
}): readonly StepPath[];
|
|
2309
|
+
/**
|
|
2310
|
+
* Returns previous and next steps for the given step
|
|
2311
|
+
* (only steps are considered, subflows are excluded)
|
|
2312
|
+
*/
|
|
2313
|
+
prevAndNext(targetStep: StepPath, skipFlow?: (flowId: StepPath) => boolean): {
|
|
2314
|
+
prev: StepPath | null;
|
|
2315
|
+
next: StepPath | null;
|
|
2316
|
+
};
|
|
2317
|
+
/**
|
|
2318
|
+
* Lookup a subflow by its path.
|
|
2319
|
+
* @param id The path of the subflow to lookup.
|
|
2320
|
+
* @param assertType Optional type to assert the subflow type. If provided, throws if the subflow is not of the given type.
|
|
2321
|
+
* @returns The subflow with the given path, or throws if not found.
|
|
2322
|
+
*/
|
|
2323
|
+
lookup<T extends SubflowType = SubflowType>(id: StepPath, assertType?: T): DynamicViewFlow.SubFlow.Of<T>;
|
|
2324
|
+
/**
|
|
2325
|
+
* Returns top level subflows in the view
|
|
2326
|
+
*/
|
|
2327
|
+
subflows(): DynamicViewFlow.SubFlow[];
|
|
2328
|
+
/**
|
|
2329
|
+
* Returns nested subflows of a given subflow.
|
|
2330
|
+
* @param id The path of the subflow to lookup.
|
|
2331
|
+
* @returns The subflow with the given path, or throws if not found.
|
|
2332
|
+
*/
|
|
2333
|
+
subflows<N extends AnySubflow>(subflow: N): NestedOf<N['_type']>[];
|
|
2334
|
+
subflows(id: StepPath): DynamicViewFlow.SubFlow.Any[];
|
|
2335
|
+
/**
|
|
2336
|
+
* Checks if has nested subflows
|
|
2337
|
+
*/
|
|
2338
|
+
hasSubflows(check: AnySubflow | StepPath): boolean;
|
|
2339
|
+
/**
|
|
2340
|
+
* @see Sequence Layout
|
|
2341
|
+
*/
|
|
2342
|
+
walk<R extends DynamicViewFlow.AnyStep = DynamicViewFlow.AnyStep>(callback: WalkCallback<V, R>): R | undefined;
|
|
2343
|
+
/**
|
|
2344
|
+
* Returns all steps that come before the given step in the flow.
|
|
2345
|
+
* @param step The step to find predecessors for.
|
|
2346
|
+
* @returns An array of step paths that come before the given step.
|
|
2347
|
+
*/
|
|
2348
|
+
stepsBefore(step: StepPath): DynamicViewFlow.AnyStep[];
|
|
2349
|
+
/**
|
|
2350
|
+
* Returns all step paths that come before the given step in the flow.
|
|
2351
|
+
* @param step The step to find predecessors for.
|
|
2352
|
+
* @returns An array of step paths that come before the given step.
|
|
2353
|
+
*/
|
|
2354
|
+
stepPathsBefore(step: StepPath): StepPath[];
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Returns all steps that come before the given step in the flow.
|
|
2358
|
+
*/
|
|
2359
|
+
declare function stepsBefore(view: ProcessedDynamicView<any>, _step: StepPath): DynamicViewFlow.AnyStep[];
|
|
2360
|
+
//#endregion
|
|
2361
|
+
//#region src/types/view-computed.d.ts
|
|
2362
|
+
type ComputedNodeStyle = Simplify<ElementStyle & {
|
|
2363
|
+
icon?: never;
|
|
2364
|
+
shape?: never;
|
|
2365
|
+
color?: never;
|
|
2366
|
+
}>;
|
|
2367
|
+
interface ComputedNode<A extends Any = Any> extends WithTags<A>, WithOptionalLinks {
|
|
2368
|
+
/**
|
|
2369
|
+
* Element metadata, propagated from the model.
|
|
2370
|
+
* Uses a loose record type (instead of aux.WithMetadata<A>) to avoid
|
|
2371
|
+
* exactOptionalPropertyTypes conflicts when MetadataKey is a literal union.
|
|
2372
|
+
*/
|
|
2373
|
+
readonly metadata?: Readonly<Record<string, string | string[] | undefined>> | null;
|
|
2374
|
+
id: NodeId$1;
|
|
2375
|
+
kind: ElementKind<A> | DeploymentKind<A> | '@group';
|
|
2376
|
+
parent: NodeId$1 | null;
|
|
2377
|
+
/**
|
|
2378
|
+
* Reference to model element
|
|
2379
|
+
*/
|
|
2380
|
+
modelRef?: Fqn<A>;
|
|
2381
|
+
/**
|
|
2382
|
+
* Reference to deployment element
|
|
2383
|
+
*/
|
|
2384
|
+
deploymentRef?: DeploymentFqn<A>;
|
|
2385
|
+
title: string;
|
|
2386
|
+
/**
|
|
2387
|
+
* Description of the node
|
|
2388
|
+
* either summary or description
|
|
2389
|
+
*/
|
|
2390
|
+
description?: MarkdownOrString | null;
|
|
2391
|
+
technology?: string | null;
|
|
2392
|
+
children: NodeId$1[];
|
|
2393
|
+
inEdges: EdgeId$1[];
|
|
2394
|
+
outEdges: EdgeId$1[];
|
|
2395
|
+
shape: ElementShape;
|
|
2396
|
+
color: Color;
|
|
2397
|
+
icon?: Icon | null;
|
|
2398
|
+
style: ComputedNodeStyle;
|
|
2399
|
+
navigateTo?: StrictViewId<A> | null;
|
|
2400
|
+
level: number;
|
|
2401
|
+
depth?: number | null;
|
|
2402
|
+
/**
|
|
2403
|
+
* If this node was customized in the view
|
|
2404
|
+
*/
|
|
2405
|
+
isCustomized?: boolean;
|
|
2406
|
+
notation?: string | null;
|
|
2407
|
+
notes?: MarkdownOrString | undefined;
|
|
2408
|
+
}
|
|
2409
|
+
interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
|
|
2410
|
+
id: EdgeId$1;
|
|
2411
|
+
parent: NodeId$1 | null;
|
|
2412
|
+
source: NodeId$1;
|
|
2413
|
+
target: NodeId$1;
|
|
2414
|
+
label: string | null;
|
|
2415
|
+
description?: MarkdownOrString | null;
|
|
2416
|
+
technology?: string | null;
|
|
2417
|
+
relations: RelationId$1[];
|
|
2418
|
+
kind?: RelationKind<A> | typeof StepEdgeKind;
|
|
2419
|
+
notation?: string;
|
|
2420
|
+
notes?: MarkdownOrString;
|
|
2421
|
+
color: Color;
|
|
2422
|
+
line: RelationshipLineType;
|
|
2423
|
+
head?: RelationshipArrowType;
|
|
2424
|
+
tail?: RelationshipArrowType;
|
|
2425
|
+
navigateTo?: StrictViewId<A> | null;
|
|
2426
|
+
/**
|
|
2427
|
+
* If this edge is derived from custom relationship predicate
|
|
2428
|
+
*/
|
|
2429
|
+
isCustomized?: boolean;
|
|
2430
|
+
/**
|
|
2431
|
+
* Path to the AST node relative to the view body ast
|
|
2432
|
+
* Available only in dynamic views
|
|
2433
|
+
* @internal
|
|
2434
|
+
*/
|
|
2435
|
+
astPath?: string;
|
|
2436
|
+
/**
|
|
2437
|
+
* For layouting purposes
|
|
2438
|
+
* @default 'forward'
|
|
2439
|
+
*/
|
|
2440
|
+
dir?: 'forward' | 'back' | 'both';
|
|
2441
|
+
}
|
|
2442
|
+
interface ComputedRankConstraint {
|
|
2443
|
+
type: RankValue;
|
|
2444
|
+
nodes: NodeId$1[];
|
|
2445
|
+
}
|
|
2446
|
+
interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
2447
|
+
readonly [_stage]: 'computed';
|
|
2448
|
+
readonly autoLayout: ViewAutoLayout;
|
|
2449
|
+
readonly nodes: ReadonlyArray<ComputedNode<A>>;
|
|
2450
|
+
readonly edges: ReadonlyArray<ComputedEdge<A>>;
|
|
2451
|
+
/**
|
|
2452
|
+
* If the view has manual layout (v2)
|
|
2453
|
+
*/
|
|
2454
|
+
readonly hasManualLayout?: boolean;
|
|
2455
|
+
}
|
|
2456
|
+
interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
2457
|
+
readonly [_type]: 'element';
|
|
2458
|
+
readonly viewOf?: Fqn<A>;
|
|
2459
|
+
readonly extends?: StrictViewId<A>;
|
|
2460
|
+
readonly ranks?: ComputedRankConstraint[];
|
|
2461
|
+
}
|
|
2462
|
+
interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
2463
|
+
readonly [_type]: 'deployment';
|
|
2464
|
+
}
|
|
2465
|
+
interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
2466
|
+
readonly [_type]: 'dynamic';
|
|
2467
|
+
/**
|
|
2468
|
+
* How to display the dynamic view
|
|
2469
|
+
* - `diagram`: display as a regular likec4 view
|
|
2470
|
+
* - `sequence`: display as a sequence diagram
|
|
2471
|
+
*/
|
|
2472
|
+
readonly variant: DynamicViewDisplayVariant;
|
|
2473
|
+
/**
|
|
2474
|
+
* Represents the complete flow structure for dynamic views, as a sequence of steps.
|
|
2475
|
+
* Can include nested flows, branches, loops, and conditional statements.
|
|
2476
|
+
*/
|
|
2477
|
+
readonly flow: DynamicViewFlowSteps;
|
|
2478
|
+
}
|
|
2479
|
+
//#endregion
|
|
1748
2480
|
//#region src/types/view-parsed.deployment.d.ts
|
|
1749
2481
|
/**
|
|
1750
2482
|
* Predicates scoped to deployment model
|
|
@@ -1760,7 +2492,7 @@ type DeploymentViewRule<A extends Any = Unknown> = ExclusiveUnion<{
|
|
|
1760
2492
|
AutoLayout: ViewRuleAutoLayout;
|
|
1761
2493
|
IncludeAncestors: ParsedViewRuleAncestors;
|
|
1762
2494
|
}>;
|
|
1763
|
-
interface ParsedViewRuleAncestors
|
|
2495
|
+
interface ParsedViewRuleAncestors {
|
|
1764
2496
|
/**
|
|
1765
2497
|
* When true, ancestor elements of included deployment nodes are also included in the view.
|
|
1766
2498
|
* @default false (ancestors are not included)
|
|
@@ -1777,13 +2509,15 @@ type ParsedView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentVi
|
|
|
1777
2509
|
type ComputedView<A extends Any = Any> = ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A>;
|
|
1778
2510
|
type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
1779
2511
|
type ProcessedView<A extends Any = Any> = ComputedView<A> | LayoutedView<A>;
|
|
2512
|
+
type ProcessedDynamicView<A extends Any = Any> = ComputedDynamicView<A> | LayoutedDynamicView<A>;
|
|
1780
2513
|
type AnyView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A> | ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A> | LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
1781
2514
|
type ViewOnStage<V extends AnyView<Any>, T extends ModelStage> = Extract<V, {
|
|
1782
2515
|
[_stage]: T;
|
|
1783
2516
|
}>;
|
|
1784
|
-
type ViewWithType<V extends AnyView<
|
|
2517
|
+
type ViewWithType<V extends AnyView<any>, T extends ViewType> = Extract<V, {
|
|
1785
2518
|
[_type]: T;
|
|
1786
2519
|
}>;
|
|
2520
|
+
type InferViewAux<V> = V extends AnyView<infer A extends Any> ? Or<IsAny<A>, IsNever<A>> extends true ? never : A : never;
|
|
1787
2521
|
type ViewRule<A extends Any = Any> = ParsedView<A>['rules'][number];
|
|
1788
2522
|
type ViewRulePredicate<A extends Any = Any> = Extract<ViewRule<A>, {
|
|
1789
2523
|
include: any[];
|
|
@@ -1834,7 +2568,7 @@ interface BaseLikeC4ModelData<A extends Any> {
|
|
|
1834
2568
|
globals: ModelGlobals;
|
|
1835
2569
|
imports: Record<string, NonEmptyArray<Element<A>>>;
|
|
1836
2570
|
}
|
|
1837
|
-
type AuxFromLikeC4ModelData<D> = D extends BaseLikeC4ModelData<infer A extends Any> ?
|
|
2571
|
+
type AuxFromLikeC4ModelData<D> = D extends BaseLikeC4ModelData<infer A extends Any> ? IsAnyOrNever<A> extends true ? never : A : never;
|
|
1838
2572
|
interface ParsedLikeC4ModelData<A extends AnyParsed = UnknownParsed> extends BaseLikeC4ModelData<A> {
|
|
1839
2573
|
[_stage]: 'parsed';
|
|
1840
2574
|
views: Record<ViewId<A>, ParsedView<A>>;
|
|
@@ -1913,7 +2647,7 @@ type ProjectDump = {
|
|
|
1913
2647
|
name?: string;
|
|
1914
2648
|
title?: string | undefined;
|
|
1915
2649
|
};
|
|
1916
|
-
type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends infer S extends 'computed' | 'layouted' ? S : 'computed' | 'layouted' | 'parsed', KeysOf<D['elements']>, KeysOf<D['deployments']['elements']>, KeysOf<D['views']>, D['projectId'] extends infer PID extends string ? PID : never, SpecTypesFromDump<D['specification']>> : Never;
|
|
2650
|
+
type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends (infer S extends 'computed' | 'layouted') ? S : 'computed' | 'layouted' | 'parsed', KeysOf<D['elements']>, KeysOf<D['deployments']['elements']>, KeysOf<D['views']>, D['projectId'] extends (infer PID extends string) ? PID : never, SpecTypesFromDump<D['specification']>> : Never;
|
|
1917
2651
|
//#endregion
|
|
1918
2652
|
//#region src/types/view-changes.d.ts
|
|
1919
2653
|
declare namespace ViewChange {
|
|
@@ -2062,7 +2796,7 @@ type Guard<To = unknown> = (value: any) => value is To;
|
|
|
2062
2796
|
* GuardedBy<typeof isString>; // string
|
|
2063
2797
|
* ```
|
|
2064
2798
|
*/
|
|
2065
|
-
type GuardedBy<G> = G extends Guard<infer To> ? Or<IsAny<To>, IsUnknown<To>> extends true ? never : To : never;
|
|
2799
|
+
type GuardedBy<G extends Function> = G extends Guard<infer To> ? Or<IsAny<To>, IsUnknown<To>> extends true ? never : To : never;
|
|
2066
2800
|
/**
|
|
2067
2801
|
* Creates a type guard that checks if a value matches any of the provided predicates.
|
|
2068
2802
|
*
|
|
@@ -2081,5 +2815,10 @@ type GuardedBy<G> = G extends Guard<infer To> ? Or<IsAny<To>, IsUnknown<To>> ext
|
|
|
2081
2815
|
* ```
|
|
2082
2816
|
*/
|
|
2083
2817
|
declare function isAnyOf<const Predicates extends NonEmptyArray<Guard<any>>>(...predicates: Predicates): <T>(value: T) => value is T & GuardedBy<Predicates[number]>;
|
|
2818
|
+
declare function hasChildren<C, A extends {
|
|
2819
|
+
children: C[];
|
|
2820
|
+
}>(value: A): value is A & {
|
|
2821
|
+
children: NonEmptyArray<C>;
|
|
2822
|
+
};
|
|
2084
2823
|
//#endregion
|
|
2085
|
-
export {
|
|
2824
|
+
export { ComputedNode as $, isStepPath as $i, OrOperator as $n, EdgeId as $r, GlobalStyles as $t, ViewRule as A, DeploymentFqn$1 as Ai, ViewRuleGlobalStyle as An, RelationshipLineTypes as Ar, ElementSpecification as At, isViewRulePredicate as B, NodeId$1 as Bi, ModelFqnExpr as Bn, DefaultTagColors as Br, DeploymentRelationship as Bt, ComputedView as C, ReorderedArray as Ca, _aux_d_exports as Ci, BaseParsedViewProperties as Cn, LikeC4StyleDefaults as Cr, ViewManualLayoutSnapshot as Ct, ProcessedDynamicView as D, toComputed as Di, ViewAutoLayout as Dn, RelationshipArrowTypes as Dr, LikeC4ProjectStylesConfig as Dt, ParsedView as E, setProject as Ei, RankValue as En, RelationshipArrowType as Er, LikeC4ProjectStyleDefaults as Et, isDiagramView as F, GlobalFqn as Fi, isAutoLayoutDirection as Fn, ThemeColor as Fr, DeployedInstance as Ft, DeploymentViewRule as G, RelationshipKind as Gi, RelationExpr as Gn, Any as Gr, ElementStyle as Gt, DeploymentViewExcludePredicate as H, ProjectId$1 as Hi, Expression as Hn, IconPositions as Hr, isDeploymentNode as Ht, isDynamicView as I, GroupElementKind as Ii, isViewRuleAutoLayout as In, ThemeColorValues as Ir, DeploymentElement as It, ParsedViewRuleAncestors as J, Tag$1 as Ji, Filterable as Jn, AnyParsed as Jr, ensureSizes as Jt, DeploymentViewRuleStyle as K, StepEdgeKind as Ki, AndOperator as Kn, AnyComputed as Kr, ModelRelation as Kt, isElementView as L, Icon as Li, isViewRuleGlobalPredicateRef as Ln, isCustomColor as Lr, DeploymentElementRef$1 as Lt, ViewWithType as M, EdgeId$1 as Mi, ViewType as Mn, Size as Mr, Specification as Mt, isComputedView as N, ElementKind$1 as Ni, ViewWithHash as Nn, SpacingSize as Nr, TagSpecification as Nt, ProcessedView as O, AnyFqn as Oi, ViewRuleAutoLayout as On, RelationshipColorValues as Or, LikeC4ProjectStylesCustomStylesheets as Ot, isDeploymentView as P, Fqn$1 as Pi, ViewWithNotation as Pn, TextSize as Pr, isTagColorSpecified as Pt, ComputedElementView as Q, isGroupElementKind as Qi, OperatorPredicate as Qn, DeploymentKind as Qr, GlobalStyleID as Qt, isExtendsElementView as R, IconUrl as Ri, isViewRuleGlobalStyle as Rn, isThemeColor as Rr, DeploymentNode as Rt, AnyView as S, Predicate as Sa, ViewId as Si, AutoLayoutDirection as Sn, IconSize as Sr, LayoutedViewDriftReason as St, LayoutedView as T, preferSummary as Ti, NodeNotation as Tn, LikeC4Theme as Tr, LikeC4ProjectManualLayoutsConfig as Tt, DeploymentViewIncludePredicate as U, RelationId$1 as Ui, FqnExpr as Un, Sizes as Ur, AbstractRelationship as Ut, isViewRuleStyle as V, NoneIcon as Vi, ModelRelationExpr as Vn, ElementShapes as Vr, isDeployedInstance as Vt, DeploymentViewPredicate as W, RelationKind$1 as Wi, PredicateSelector as Wn, ThemeColors as Wr, Element as Wt, ComputedDynamicView as X, flattenMarkdownOrString as Xi, MetadataEqual as Xn, DeploymentFqn as Xr, GlobalPredicateId as Xt, ComputedDeploymentView as Y, ViewId$1 as Yi, KindEqual as Yn, Aux as Yr, GlobalDynamicPredicates as Yt, ComputedEdge as Z, isGlobalFqn as Zi, NotOperator as Zn, DeploymentId as Zr, GlobalPredicates as Zt, AuxFromLikeC4ModelData as _, Link as _a, Tags as _i, isViewRuleGroup as _n, CustomColorDefinitions as _r, LayoutedDeploymentView as _t, isAnyOf as a, _stage as aa, LooseLiteral as ai, ParsedDynamicView as an, isKindEqual as ar, DynamicViewFlowSteps as at, LikeC4ModelData as b, NonEmptyReadonlyArray as ba, UnknownLayouted as bi, AnyIncludePredicate as bn, HexColor as br, DiagramEdgeDriftReason as bt, RichText as c, inferStage as ca, Metadata as ci, stepGuards as cn, isOrOperator as cr, flowAncestors as ct, ViewChange as d, Coalesce as da, RelationId as di, ElementViewPredicate as dn, whereOperatorAsPredicate as dr, parentFlow as dt, scalar_d_exports as ea, ElementId as ei, ModelGlobals as en, Participant as er, ComputedNodeStyle as et, AuxFromDump as f, ExclusiveUnion as fa, RelationKind as fi, ElementViewRule as fn, FqnRef as fr, stepsBefore as ft, SpecificationDump as g, KeysOf as ga, Tag as gi, ParsedElementView as gn, CustomColor as gr, LayoutType as gt, SpecTypesFromDump as h, IteratorLike as ha, StrictViewId as hi, ElementViewRuleStyle as hn, ColorLiteral as hr, DiagramNode as ht, hasProp as i, _layout as ia, LooseElementId as ii, DynamicViewRule as in, isAndOperator as ir, DynamicViewFlowStep as it, ViewRulePredicate as j, DeploymentKind$1 as ji, ViewRuleRank as jn, ShapeSize as jr, RelationshipSpecification as jt, ViewOnStage as k, BuiltInIcon as ki, ViewRuleGlobalPredicateRef as kn, RelationshipLineType as kr, LikeC4ProjectTheme as kt, RichTextEmpty as l, inferType as la, MetadataKey as li, ElementViewExcludePredicate as ln, isParticipantOperator as lr, flowGuards as lt, ProjectDump as m, IterableContainer as ma, Stage as mi, ElementViewRuleRank as mn, Color as mr, DiagramEdge as mt, GuardedBy as n, ExtractOnStage as na, Fqn as ni, DynamicViewDisplayVariant as nn, TagEqual as nr, DynamicViewFlow as nt, isNonEmptyArray as o, _type as oa, LooseTag as oi, Step$1 as on, isMetadataEqual as or, DynamicViewSubFlow as ot, LikeC4ModelDump as p, IsAnyOrNever as pa, SpecAux as pi, ElementViewRuleGroup as pn, BorderStyle as pr, walkthroughFlow as pt, ParsedDeploymentView as q, StepPath as qi, EqualOperator as qn, AnyLayouted as qr, Relationship as qt, hasChildren as r, ModelStage as ra, LooseDeploymentId as ri, DynamicViewIncludeRule as rn, WhereOperator as rr, DynamicViewFlowData as rt, isString as s, _v as sa, LooseViewId as si, WithSteps as sn, isNotOperator as sr, dynamicViewFlow as st, Guard as t, splitGlobalFqn as ta, ElementKind as ti, AnyStep as tn, ParticipantOperator as tr, ComputedRankConstraint as tt, RichTextOrEmpty as u, isOnStage as ua, ProjectId as ui, ElementViewIncludePredicate as un, isTagEqual as ur, flowHelpers as ut, ComputedLikeC4ModelData as v, NTuple as va, Unknown as vi, isViewRuleRank as vn, ElementColorValues as vr, LayoutedDynamicView as vt, InferViewAux as w, exact as wa, preferDescription as wi, BaseViewProperties as wn, LikeC4StylesConfig as wr, LikeC4Project as wt, ParsedLikeC4ModelData as x, OrString as xa, UnknownParsed as xi, AnyViewRuleStyle as xn, IconPosition as xr, DiagramNodeDriftReason as xt, LayoutedLikeC4ModelData as y, NonEmptyArray as ya, UnknownComputed as yi, AnyExcludePredicate as yn, ElementShape as yr, LayoutedElementView as yt, isScopedElementView as z, MarkdownOrString as zi, ModelExpression as zn, BorderStyles as zr, DeploymentRelation as zt };
|