@likec4/core 1.48.0 → 1.50.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/dist/THIRD-PARTY-LICENSES.md +1034 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/geometry.mjs +1 -335
- package/dist/_chunks/index.d.mts +1995 -131
- package/dist/_chunks/index2.d.mts +153 -892
- package/dist/_chunks/index3.d.mts +15 -13
- package/dist/_chunks/index4.d.mts +229 -3
- package/dist/_chunks/index5.d.mts +392 -30
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +2 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/manual-layout.mjs +1 -0
- package/dist/_chunks/model.mjs +4 -1898
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/types.mjs +1 -0
- package/dist/_chunks/utils.mjs +1 -483
- package/dist/builder/index.d.mts +3 -6
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +85 -13
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +7 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -11
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -7
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +5 -10
- package/dist/utils/index.mjs +1 -17
- package/package.json +14 -13
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/RichText.mjs +0 -148
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index7.d.mts +0 -268
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
|
@@ -1,937 +1,198 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { t as FqnRef } from "./fqnRef.mjs";
|
|
6
|
-
import { n as ModelFqnExpr, t as ModelExpression } from "./expression-model.mjs";
|
|
7
|
-
import { IsAny, IsNever, NonEmptyTuple, PartialDeep, Simplify, Tagged, WritableDeep } from "type-fest";
|
|
8
|
-
|
|
9
|
-
//#region src/types/view-common.d.ts
|
|
10
|
-
interface AnyIncludePredicate<Expr> {
|
|
11
|
-
include: Expr[];
|
|
12
|
-
exclude?: never;
|
|
13
|
-
}
|
|
14
|
-
interface AnyExcludePredicate<Expr> {
|
|
15
|
-
include?: never;
|
|
16
|
-
exclude: Expr[];
|
|
17
|
-
}
|
|
18
|
-
interface AnyViewRuleStyle<Expr> {
|
|
19
|
-
targets: Expr[];
|
|
20
|
-
notation?: string;
|
|
21
|
-
style: {
|
|
22
|
-
border?: BorderStyle;
|
|
23
|
-
opacity?: number;
|
|
24
|
-
multiple?: boolean;
|
|
25
|
-
size?: ShapeSize;
|
|
26
|
-
padding?: SpacingSize;
|
|
27
|
-
textSize?: TextSize;
|
|
28
|
-
color?: Color;
|
|
29
|
-
shape?: ElementShape;
|
|
30
|
-
icon?: Icon;
|
|
31
|
-
iconColor?: Color;
|
|
32
|
-
iconSize?: IconSize;
|
|
33
|
-
iconPosition?: IconPosition;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
interface ViewRuleGlobalStyle {
|
|
37
|
-
styleId: GlobalStyleID;
|
|
38
|
-
}
|
|
39
|
-
declare function isViewRuleGlobalStyle(rule: object): rule is ViewRuleGlobalStyle;
|
|
40
|
-
interface ViewRuleGlobalPredicateRef {
|
|
41
|
-
predicateId: GlobalPredicateId;
|
|
42
|
-
}
|
|
43
|
-
declare function isViewRuleGlobalPredicateRef(rule: object): rule is ViewRuleGlobalPredicateRef;
|
|
44
|
-
type RankValue = 'max' | 'min' | 'same' | 'sink' | 'source';
|
|
45
|
-
interface ViewRuleRank<Expr> {
|
|
46
|
-
targets: Expr[];
|
|
47
|
-
rank: RankValue;
|
|
48
|
-
}
|
|
49
|
-
type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
50
|
-
declare function isAutoLayoutDirection(autoLayout: unknown): autoLayout is AutoLayoutDirection;
|
|
51
|
-
interface ViewRuleAutoLayout {
|
|
52
|
-
direction: AutoLayoutDirection;
|
|
53
|
-
nodeSep?: number;
|
|
54
|
-
rankSep?: number;
|
|
1
|
+
//#region src/geometry/types.d.ts
|
|
2
|
+
interface XYPoint {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
55
5
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
rankSep?: number;
|
|
60
|
-
nodeSep?: number;
|
|
6
|
+
interface Dimensions {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
61
9
|
}
|
|
10
|
+
type Point = readonly [x: number, y: number];
|
|
11
|
+
declare function isPoint(point: unknown): point is Point;
|
|
62
12
|
/**
|
|
63
|
-
*
|
|
64
|
-
* Keeping this type for backward compatibility and migration purposes.
|
|
13
|
+
* Converts between Point (tuple) and XYPoint (object) representations.
|
|
65
14
|
*
|
|
66
|
-
* @
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
width: number;
|
|
80
|
-
height: number;
|
|
81
|
-
}>;
|
|
82
|
-
readonly edges: Record<string, {
|
|
83
|
-
points: NonEmptyArray<Point>;
|
|
84
|
-
controlPoints?: NonEmptyArray<XYPoint>;
|
|
85
|
-
labelBBox?: BBox;
|
|
86
|
-
}>;
|
|
87
|
-
};
|
|
88
|
-
type ViewType = 'element' | 'dynamic' | 'deployment';
|
|
89
|
-
interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
|
|
90
|
-
readonly id: StrictViewId<A>;
|
|
91
|
-
readonly title: string | null;
|
|
92
|
-
readonly description: MarkdownOrString | null;
|
|
93
|
-
/**
|
|
94
|
-
* Source file containing this view, relative to the project root.
|
|
95
|
-
* Undefined if the view is auto-generated.
|
|
96
|
-
*/
|
|
97
|
-
readonly sourcePath?: string | undefined;
|
|
98
|
-
}
|
|
99
|
-
interface BaseParsedViewProperties<A extends Any> extends BaseViewProperties<A> {
|
|
100
|
-
/**
|
|
101
|
-
* Internal field to identify the stage of the view.
|
|
102
|
-
* This is used to create the correct type of the view.
|
|
103
|
-
*/
|
|
104
|
-
readonly [_stage]: 'parsed';
|
|
105
|
-
/**
|
|
106
|
-
* URI to the source file of this view.
|
|
107
|
-
* Undefined if the view is auto-generated.
|
|
108
|
-
*/
|
|
109
|
-
readonly docUri?: string | undefined;
|
|
110
|
-
}
|
|
111
|
-
type NodeNotation = {
|
|
112
|
-
kinds: string[];
|
|
113
|
-
shape: ElementShape;
|
|
114
|
-
color: Color;
|
|
115
|
-
title: string;
|
|
116
|
-
};
|
|
117
|
-
interface ViewWithNotation {
|
|
118
|
-
notation?: {
|
|
119
|
-
nodes: NodeNotation[];
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
interface ViewWithHash {
|
|
123
|
-
/**
|
|
124
|
-
* Hash of the view object.
|
|
125
|
-
* This is used to detect changes in layout
|
|
126
|
-
*/
|
|
127
|
-
hash: string;
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/types/view-parsed.element.d.ts
|
|
131
|
-
/**
|
|
132
|
-
* Predicates scoped to logical model
|
|
133
|
-
*/
|
|
134
|
-
interface ElementViewIncludePredicate<A extends Any = Any> extends AnyIncludePredicate<ModelExpression<A>> {}
|
|
135
|
-
interface ElementViewExcludePredicate<A extends Any = Any> extends AnyExcludePredicate<ModelExpression<A>> {}
|
|
136
|
-
type ElementViewPredicate<A extends Any = Any> = ElementViewIncludePredicate<A> | ElementViewExcludePredicate<A>;
|
|
137
|
-
interface ElementViewRuleGroup<A extends Any = Any> {
|
|
138
|
-
groupRules: Array<ElementViewPredicate<A> | ElementViewRuleGroup<A>>;
|
|
139
|
-
title: string | null;
|
|
140
|
-
color?: Color;
|
|
141
|
-
border?: BorderStyle;
|
|
142
|
-
opacity?: number;
|
|
143
|
-
multiple?: boolean;
|
|
144
|
-
size?: ShapeSize;
|
|
145
|
-
padding?: SpacingSize;
|
|
146
|
-
textSize?: TextSize;
|
|
147
|
-
}
|
|
148
|
-
declare function isViewRuleGroup<A extends Any>(rule: ElementViewRule<A>): rule is ElementViewRuleGroup<A>;
|
|
149
|
-
interface ElementViewRuleStyle<A extends Any = Any> extends AnyViewRuleStyle<ModelFqnExpr<A>> {}
|
|
150
|
-
interface ElementViewRuleRank<A extends Any = Any> extends ViewRuleRank<ModelFqnExpr<A>> {}
|
|
151
|
-
declare function isViewRuleRank<A extends Any>(rule: ElementViewRule<A>): rule is ElementViewRuleRank<A>;
|
|
152
|
-
type ElementViewRule<A extends Any = Any> = ExclusiveUnion<{
|
|
153
|
-
IncludePredicate: ElementViewIncludePredicate<A>;
|
|
154
|
-
ExcludePredicate: ElementViewExcludePredicate<A>;
|
|
155
|
-
Group: ElementViewRuleGroup<A>;
|
|
156
|
-
Style: ElementViewRuleStyle<A>;
|
|
157
|
-
GlobalStyle: ViewRuleGlobalStyle;
|
|
158
|
-
GlobalPredicateRef: ViewRuleGlobalPredicateRef;
|
|
159
|
-
AutoLayout: ViewRuleAutoLayout;
|
|
160
|
-
Rank: ElementViewRuleRank<A>;
|
|
161
|
-
}>;
|
|
162
|
-
interface ParsedElementView<A extends Any = Any> extends BaseParsedViewProperties<A> {
|
|
163
|
-
[_type]: 'element';
|
|
164
|
-
readonly rules: ElementViewRule<A>[];
|
|
165
|
-
readonly viewOf?: Fqn<A>;
|
|
166
|
-
readonly extends?: StrictViewId<A>;
|
|
167
|
-
}
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region src/types/view-parsed.dynamic.d.ts
|
|
170
|
-
interface DynamicStep<A extends Any = Any> {
|
|
171
|
-
readonly source: Fqn<A>;
|
|
172
|
-
readonly target: Fqn<A>;
|
|
173
|
-
readonly title?: string | null;
|
|
174
|
-
readonly kind?: RelationKind<A>;
|
|
175
|
-
readonly description?: MarkdownOrString;
|
|
176
|
-
readonly technology?: string;
|
|
177
|
-
readonly notation?: string;
|
|
178
|
-
readonly notes?: MarkdownOrString;
|
|
179
|
-
readonly color?: Color;
|
|
180
|
-
readonly line?: RelationshipLineType;
|
|
181
|
-
readonly head?: RelationshipArrowType;
|
|
182
|
-
readonly tail?: RelationshipArrowType;
|
|
183
|
-
readonly isBackward?: boolean;
|
|
184
|
-
readonly navigateTo?: StrictViewId<A>;
|
|
185
|
-
/**
|
|
186
|
-
* Path to the AST node relative to the view body ast
|
|
187
|
-
* Used to locate the step in the source code
|
|
188
|
-
*/
|
|
189
|
-
readonly astPath: string;
|
|
190
|
-
}
|
|
191
|
-
interface DynamicStepsSeries<A extends Any = Any> {
|
|
192
|
-
readonly seriesId: string;
|
|
193
|
-
readonly __series: NonEmptyReadonlyArray<DynamicStep<A>>;
|
|
194
|
-
}
|
|
195
|
-
interface DynamicStepsParallel<A extends Any = Any> {
|
|
196
|
-
readonly parallelId: string;
|
|
197
|
-
readonly __parallel: NonEmptyReadonlyArray<DynamicStep<A> | DynamicStepsSeries<A>>;
|
|
198
|
-
}
|
|
199
|
-
declare function getParallelStepsPrefix(id: string): string | null;
|
|
200
|
-
type DynamicViewStep<A extends Any = Any> = ExclusiveUnion<{
|
|
201
|
-
Step: DynamicStep<A>;
|
|
202
|
-
Series: DynamicStepsSeries<A>;
|
|
203
|
-
Parallel: DynamicStepsParallel<A>;
|
|
204
|
-
}>;
|
|
205
|
-
declare function isDynamicStep<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStep<A>;
|
|
206
|
-
declare function isDynamicStepsParallel<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsParallel<A>;
|
|
207
|
-
declare function isDynamicStepsSeries<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsSeries<A>;
|
|
208
|
-
interface DynamicViewIncludeRule<A extends Any = Any> {
|
|
209
|
-
include: ModelFqnExpr.Any<A>[];
|
|
210
|
-
}
|
|
211
|
-
type DynamicViewRule<A extends Any = Any> = ExclusiveUnion<{
|
|
212
|
-
Include: DynamicViewIncludeRule<A>;
|
|
213
|
-
GlobalPredicateRef: ViewRuleGlobalPredicateRef;
|
|
214
|
-
ElementViewRuleStyle: ElementViewRuleStyle<A>;
|
|
215
|
-
GlobalStyle: ViewRuleGlobalStyle;
|
|
216
|
-
AutoLayout: ViewRuleAutoLayout;
|
|
217
|
-
}>;
|
|
218
|
-
type DynamicViewDisplayVariant = 'diagram' | 'sequence';
|
|
219
|
-
interface ParsedDynamicView<A extends Any = Any> extends BaseParsedViewProperties<A> {
|
|
220
|
-
[_type]: 'dynamic';
|
|
221
|
-
/**
|
|
222
|
-
* How to display the dynamic view
|
|
223
|
-
* - `diagram`: display as a regular likec4 view
|
|
224
|
-
* - `sequence`: display as a sequence diagram
|
|
225
|
-
*
|
|
226
|
-
* @default 'diagram'
|
|
227
|
-
*/
|
|
228
|
-
readonly variant?: DynamicViewDisplayVariant;
|
|
229
|
-
readonly steps: DynamicViewStep<A>[];
|
|
230
|
-
readonly rules: DynamicViewRule<A>[];
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/types/global.d.ts
|
|
234
|
-
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
235
|
-
type GlobalPredicates<A extends Any = Any> = NonEmptyArray<ElementViewPredicate<A>>;
|
|
236
|
-
type GlobalDynamicPredicates<A extends Any = Any> = NonEmptyArray<DynamicViewIncludeRule<A>>;
|
|
237
|
-
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
238
|
-
type GlobalStyles<A extends Any = Any> = NonEmptyTuple<ElementViewRuleStyle<A>>;
|
|
239
|
-
interface ModelGlobals<A extends Any = Any> {
|
|
240
|
-
readonly predicates: Record<GlobalPredicateId, GlobalPredicates<A>>;
|
|
241
|
-
readonly dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates<A>>;
|
|
242
|
-
readonly styles: Record<GlobalStyleID, GlobalStyles<A>>;
|
|
243
|
-
}
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region src/types/model-logical.d.ts
|
|
246
|
-
interface ElementStyle {
|
|
247
|
-
readonly icon?: Icon;
|
|
248
|
-
readonly iconColor?: Color;
|
|
249
|
-
readonly iconSize?: IconSize;
|
|
250
|
-
readonly iconPosition?: IconPosition;
|
|
251
|
-
readonly shape?: ElementShape;
|
|
252
|
-
readonly color?: Color;
|
|
253
|
-
readonly border?: BorderStyle;
|
|
254
|
-
/**
|
|
255
|
-
* In percentage 0-100, 0 is fully transparent
|
|
256
|
-
*
|
|
257
|
-
* @default 100
|
|
258
|
-
*/
|
|
259
|
-
readonly opacity?: number;
|
|
260
|
-
/**
|
|
261
|
-
* If true, the element is rendered as multiple shapes
|
|
262
|
-
* @default false
|
|
263
|
-
*/
|
|
264
|
-
readonly multiple?: boolean;
|
|
265
|
-
/**
|
|
266
|
-
* Shape size
|
|
267
|
-
*
|
|
268
|
-
* @default 'md'
|
|
269
|
-
*/
|
|
270
|
-
readonly size?: ShapeSize;
|
|
271
|
-
readonly padding?: SpacingSize;
|
|
272
|
-
readonly textSize?: TextSize;
|
|
273
|
-
}
|
|
274
|
-
type WithSizes = Pick<ElementStyle, 'size' | 'padding' | 'textSize' | 'iconSize'>;
|
|
275
|
-
/**
|
|
276
|
-
* Ensures that the sizes are set to default values if they are not set
|
|
277
|
-
*/
|
|
278
|
-
declare function ensureSizes<S extends WithSizes>({
|
|
279
|
-
size,
|
|
280
|
-
padding,
|
|
281
|
-
textSize,
|
|
282
|
-
iconSize,
|
|
283
|
-
...rest
|
|
284
|
-
}: S, defaultSize?: "xs" | "sm" | "md" | "lg" | "xl"): Omit<S, keyof WithSizes> & Required<WithSizes>;
|
|
285
|
-
interface Element<A extends Any = Any> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A>, WithNotation {
|
|
286
|
-
readonly id: Fqn<A>;
|
|
287
|
-
readonly kind: ElementKind<A>;
|
|
288
|
-
readonly title: string;
|
|
289
|
-
readonly style: ElementStyle;
|
|
290
|
-
}
|
|
291
|
-
interface AbstractRelationship<A extends Any> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
|
|
292
|
-
readonly id: RelationId;
|
|
293
|
-
readonly title?: string | null;
|
|
294
|
-
readonly kind?: RelationKind<A>;
|
|
295
|
-
readonly color?: Color;
|
|
296
|
-
readonly line?: RelationshipLineType;
|
|
297
|
-
readonly head?: RelationshipArrowType;
|
|
298
|
-
readonly tail?: RelationshipArrowType;
|
|
299
|
-
readonly navigateTo?: StrictViewId<A>;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Relationship between two model elements
|
|
303
|
-
*/
|
|
304
|
-
interface Relationship<A extends Any = Any> extends AbstractRelationship<A> {
|
|
305
|
-
readonly source: FqnRef.ModelRef<A>;
|
|
306
|
-
readonly target: FqnRef.ModelRef<A>;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Backward compatibility alias
|
|
310
|
-
* @deprecated Use {@link Relationship} instead
|
|
15
|
+
* @param point - The point to convert (either XYPoint or Point tuple)
|
|
16
|
+
* @returns The converted point in the alternate format
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Convert tuple to object
|
|
21
|
+
* convertPoint([10, 20]) // returns { x: 10, y: 20 }
|
|
22
|
+
*
|
|
23
|
+
* // Convert object to tuple
|
|
24
|
+
* convertPoint({ x: 10, y: 20 }) // returns [10, 20]
|
|
25
|
+
* ```
|
|
311
26
|
*/
|
|
312
|
-
|
|
27
|
+
declare function convertPoint(point: Point): XYPoint;
|
|
28
|
+
declare function convertPoint(point: XYPoint): Point;
|
|
313
29
|
//#endregion
|
|
314
|
-
//#region src/
|
|
315
|
-
interface
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
readonly style: ElementStyle;
|
|
321
|
-
}
|
|
322
|
-
interface DeployedInstance<A extends Any = Unknown> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A>, WithNotation {
|
|
323
|
-
kind?: never;
|
|
324
|
-
/**
|
|
325
|
-
* Format: `<DeploymentNode Fqn>.<Instance Id>`
|
|
326
|
-
* i.e parent fqn is deployment target
|
|
327
|
-
*/
|
|
328
|
-
readonly id: DeploymentFqn<A>;
|
|
329
|
-
readonly element: Fqn<A>;
|
|
330
|
-
readonly title?: string;
|
|
331
|
-
readonly style: ElementStyle;
|
|
30
|
+
//#region src/geometry/bbox.d.ts
|
|
31
|
+
interface BBox {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
332
36
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
37
|
+
declare const BBox: {
|
|
38
|
+
center({
|
|
39
|
+
x,
|
|
40
|
+
y,
|
|
41
|
+
width,
|
|
42
|
+
height
|
|
43
|
+
}: BBox): XYPoint;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the four corner points of the box in clockwise order starting from top-left
|
|
46
|
+
*/
|
|
47
|
+
toPoints({
|
|
48
|
+
x,
|
|
49
|
+
y,
|
|
50
|
+
width,
|
|
51
|
+
height
|
|
52
|
+
}: BBox): [XYPoint, XYPoint, XYPoint, XYPoint];
|
|
53
|
+
fromPoints(points: Point[]): BBox;
|
|
54
|
+
merge(...boxes: BBox[]): BBox;
|
|
55
|
+
fromRectBox(rect: RectBox): BBox;
|
|
56
|
+
toRectBox(box: BBox): RectBox;
|
|
57
|
+
expand(box: BBox, plus: number): BBox;
|
|
58
|
+
shrink(box: BBox, minus: number): BBox;
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if `a` includes `b` (i.e. `b` is inside `a`)
|
|
61
|
+
*/
|
|
62
|
+
includes(a: BBox, b: BBox): boolean;
|
|
337
63
|
};
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
tags?: Tag$1[];
|
|
359
|
-
title?: string;
|
|
360
|
-
summary?: MarkdownOrString;
|
|
361
|
-
description?: MarkdownOrString;
|
|
362
|
-
technology?: string;
|
|
363
|
-
notation?: string;
|
|
364
|
-
links?: NonEmptyArray<Link>;
|
|
365
|
-
style: {
|
|
366
|
-
shape?: ElementShape;
|
|
367
|
-
icon?: Icon;
|
|
368
|
-
iconColor?: Color;
|
|
369
|
-
iconSize?: ShapeSize;
|
|
370
|
-
iconPosition?: IconPosition;
|
|
371
|
-
color?: Color;
|
|
372
|
-
border?: BorderStyle;
|
|
373
|
-
opacity?: number;
|
|
374
|
-
size?: ShapeSize;
|
|
375
|
-
padding?: SpacingSize;
|
|
376
|
-
textSize?: TextSize;
|
|
377
|
-
multiple?: boolean;
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
interface TagSpecification {
|
|
381
|
-
color: ThemeColor | ColorLiteral;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Checks if tag color is defined in the specification
|
|
385
|
-
* Expects HEX, `rgb(...)` or `rgba(...)` color
|
|
386
|
-
*/
|
|
387
|
-
declare function isTagColorSpecified(spec: string | TagSpecification): spec is {
|
|
388
|
-
color: ColorLiteral;
|
|
64
|
+
interface RectBox {
|
|
65
|
+
x1: number;
|
|
66
|
+
y1: number;
|
|
67
|
+
x2: number;
|
|
68
|
+
y2: number;
|
|
69
|
+
}
|
|
70
|
+
declare const RectBox: {
|
|
71
|
+
center({
|
|
72
|
+
x1,
|
|
73
|
+
y1,
|
|
74
|
+
x2,
|
|
75
|
+
y2
|
|
76
|
+
}: RectBox): XYPoint;
|
|
77
|
+
fromPoints(points: Point[]): RectBox;
|
|
78
|
+
merge(...boxes: RectBox[]): RectBox;
|
|
79
|
+
toBBox(box: RectBox): BBox;
|
|
80
|
+
/**
|
|
81
|
+
* Returns true if `a` includes `b` (i.e. `b` is inside `a`)
|
|
82
|
+
*/
|
|
83
|
+
includes(a: RectBox, b: RectBox): boolean;
|
|
389
84
|
};
|
|
390
|
-
interface RelationshipSpecification {
|
|
391
|
-
technology?: string;
|
|
392
|
-
notation?: string;
|
|
393
|
-
color?: Color;
|
|
394
|
-
line?: RelationshipLineType;
|
|
395
|
-
head?: RelationshipArrowType;
|
|
396
|
-
tail?: RelationshipArrowType;
|
|
397
|
-
}
|
|
398
|
-
type Specification<A> = A extends Any ? {
|
|
399
|
-
tags: { [key in Tag<A>]: TagSpecification };
|
|
400
|
-
elements: { [key in ElementKind<A>]: Partial<ElementSpecification> };
|
|
401
|
-
deployments: { [key in DeploymentKind<A>]: Partial<ElementSpecification> };
|
|
402
|
-
relationships: { [key in RelationKind<A>]: Partial<RelationshipSpecification> };
|
|
403
|
-
metadataKeys?: IsNever<MetadataKey<A>> extends true ? never : MetadataKey<A>[];
|
|
404
|
-
customColors?: CustomColorDefinitions;
|
|
405
|
-
} : never;
|
|
406
85
|
//#endregion
|
|
407
|
-
//#region src/
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}>;
|
|
412
|
-
type LikeC4ProjectStyleDefaults = PartialDeep<WritableDeep<LikeC4StyleDefaults>, {
|
|
413
|
-
recurseIntoArrays: false;
|
|
414
|
-
allowUndefinedInNonTupleArrays: false;
|
|
415
|
-
}>;
|
|
416
|
-
interface LikeC4ProjectStylesCustomStylesheets {
|
|
417
|
-
/**
|
|
418
|
-
* List of paths to CSS files, relative to the project root
|
|
419
|
-
* (available in LSP, but not in dumped JSON)
|
|
420
|
-
*/
|
|
421
|
-
paths?: string[];
|
|
422
|
-
/**
|
|
423
|
-
* Merged CSS
|
|
424
|
-
*/
|
|
425
|
-
content: string;
|
|
426
|
-
}
|
|
427
|
-
interface LikeC4ProjectStylesConfig {
|
|
428
|
-
theme?: LikeC4ProjectTheme;
|
|
429
|
-
defaults?: LikeC4ProjectStyleDefaults;
|
|
430
|
-
customCss?: LikeC4ProjectStylesCustomStylesheets;
|
|
431
|
-
}
|
|
432
|
-
interface LikeC4ProjectManualLayoutsConfig {
|
|
433
|
-
outDir: string;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Configuration of the project, as read from the config file.
|
|
437
|
-
* LikeC4 projects encapsulate models, and can import from each other
|
|
438
|
-
*/
|
|
439
|
-
interface LikeC4Project {
|
|
440
|
-
/**
|
|
441
|
-
* ID of the project, casted to {@link ProjectId}
|
|
442
|
-
*/
|
|
443
|
-
readonly id: ProjectId$1;
|
|
444
|
-
title?: string;
|
|
445
|
-
/**
|
|
446
|
-
* Custom styles
|
|
447
|
-
*/
|
|
448
|
-
styles?: LikeC4ProjectStylesConfig | undefined;
|
|
449
|
-
/**
|
|
450
|
-
* Configuration for manual layouts snapshots
|
|
451
|
-
*/
|
|
452
|
-
manualLayouts?: LikeC4ProjectManualLayoutsConfig | undefined;
|
|
86
|
+
//#region src/geometry/vector.d.ts
|
|
87
|
+
interface VectorValue {
|
|
88
|
+
readonly x: number;
|
|
89
|
+
readonly y: number;
|
|
453
90
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}>;
|
|
461
|
-
interface ComputedNode<A extends Any = Any> extends WithTags<A>, WithOptionalLinks {
|
|
462
|
-
id: NodeId$1;
|
|
463
|
-
kind: ElementKind<A> | DeploymentKind<A> | '@group';
|
|
464
|
-
parent: NodeId$1 | null;
|
|
465
|
-
/**
|
|
466
|
-
* Reference to model element
|
|
467
|
-
*/
|
|
468
|
-
modelRef?: Fqn<A>;
|
|
469
|
-
/**
|
|
470
|
-
* Reference to deployment element
|
|
471
|
-
*/
|
|
472
|
-
deploymentRef?: DeploymentFqn<A>;
|
|
473
|
-
title: string;
|
|
474
|
-
/**
|
|
475
|
-
* Description of the node
|
|
476
|
-
* either summary or description
|
|
477
|
-
*/
|
|
478
|
-
description?: MarkdownOrString | null;
|
|
479
|
-
technology?: string | null;
|
|
480
|
-
children: NodeId$1[];
|
|
481
|
-
inEdges: EdgeId$1[];
|
|
482
|
-
outEdges: EdgeId$1[];
|
|
483
|
-
shape: ElementShape;
|
|
484
|
-
color: Color;
|
|
485
|
-
icon?: Icon | null;
|
|
486
|
-
style: ComputedNodeStyle;
|
|
487
|
-
navigateTo?: StrictViewId<A> | null;
|
|
488
|
-
level: number;
|
|
489
|
-
depth?: number | null;
|
|
91
|
+
declare class Vector implements VectorValue {
|
|
92
|
+
readonly x: number;
|
|
93
|
+
readonly y: number;
|
|
94
|
+
constructor(x: number, y: number);
|
|
95
|
+
static create(position: VectorValue): Vector;
|
|
96
|
+
static create(x: number, y: number): Vector;
|
|
490
97
|
/**
|
|
491
|
-
*
|
|
98
|
+
* Adds two vectors.
|
|
99
|
+
* @param a The first vector.
|
|
100
|
+
* @param b The second vector.
|
|
101
|
+
* @returns The sum of the two vectors.
|
|
492
102
|
*/
|
|
493
|
-
|
|
494
|
-
notation?: string | null;
|
|
495
|
-
}
|
|
496
|
-
interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
|
|
497
|
-
id: EdgeId$1;
|
|
498
|
-
parent: NodeId$1 | null;
|
|
499
|
-
source: NodeId$1;
|
|
500
|
-
target: NodeId$1;
|
|
501
|
-
label: string | null;
|
|
502
|
-
description?: MarkdownOrString | null;
|
|
503
|
-
technology?: string | null;
|
|
504
|
-
relations: RelationId[];
|
|
505
|
-
kind?: RelationKind<A> | typeof StepEdgeKind;
|
|
506
|
-
notation?: string;
|
|
507
|
-
notes?: MarkdownOrString;
|
|
508
|
-
color: Color;
|
|
509
|
-
line: RelationshipLineType;
|
|
510
|
-
head?: RelationshipArrowType;
|
|
511
|
-
tail?: RelationshipArrowType;
|
|
512
|
-
navigateTo?: StrictViewId<A> | null;
|
|
103
|
+
static add(a: VectorValue, b: VectorValue): VectorValue;
|
|
513
104
|
/**
|
|
514
|
-
*
|
|
105
|
+
* Subtracts two vectors.
|
|
106
|
+
* @param a The first vector.
|
|
107
|
+
* @param b The second vector.
|
|
108
|
+
* @returns The difference of the two vectors.
|
|
515
109
|
*/
|
|
516
|
-
|
|
110
|
+
static subtract(a: VectorValue, b: VectorValue): VectorValue;
|
|
517
111
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
* @
|
|
112
|
+
* Multiplies a vector by a scalar.
|
|
113
|
+
* @param a The vector.
|
|
114
|
+
* @param b The scalar.
|
|
115
|
+
* @returns The scaled vector.
|
|
521
116
|
*/
|
|
522
|
-
|
|
117
|
+
static multiply(a: VectorValue, b: number): VectorValue;
|
|
523
118
|
/**
|
|
524
|
-
*
|
|
525
|
-
* @
|
|
119
|
+
* Divides a vector by a scalar.
|
|
120
|
+
* @param a The vector.
|
|
121
|
+
* @param b The scalar.
|
|
122
|
+
* @returns The scaled vector.
|
|
526
123
|
*/
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
interface ComputedRankConstraint {
|
|
530
|
-
type: RankValue;
|
|
531
|
-
nodes: NodeId$1[];
|
|
532
|
-
}
|
|
533
|
-
interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
534
|
-
readonly [_stage]: 'computed';
|
|
535
|
-
readonly autoLayout: ViewAutoLayout;
|
|
536
|
-
readonly nodes: ReadonlyArray<ComputedNode<A>>;
|
|
537
|
-
readonly edges: ReadonlyArray<ComputedEdge<A>>;
|
|
124
|
+
static divide(a: VectorValue, b: number): VectorValue;
|
|
538
125
|
/**
|
|
539
|
-
*
|
|
126
|
+
* Calculates the dot product of the vectors.
|
|
127
|
+
* @param a The first vector.
|
|
128
|
+
* @param b The second vector.
|
|
129
|
+
* @returns The dot product.
|
|
540
130
|
*/
|
|
541
|
-
|
|
131
|
+
static dot(a: VectorValue, b: VectorValue): number;
|
|
542
132
|
/**
|
|
543
|
-
*
|
|
544
|
-
* @
|
|
133
|
+
* Adds the given vector to this vector.
|
|
134
|
+
* @param b The vector to add.
|
|
135
|
+
* @returns A new vector that is the sum of this vector and the given vector.
|
|
545
136
|
*/
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
549
|
-
readonly [_type]: 'element';
|
|
550
|
-
readonly viewOf?: Fqn<A>;
|
|
551
|
-
readonly extends?: StrictViewId<A>;
|
|
552
|
-
readonly ranks?: ComputedRankConstraint[];
|
|
553
|
-
}
|
|
554
|
-
interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
555
|
-
readonly [_type]: 'deployment';
|
|
556
|
-
}
|
|
557
|
-
interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
558
|
-
readonly [_type]: 'dynamic';
|
|
137
|
+
add(b: VectorValue): Vector;
|
|
559
138
|
/**
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
139
|
+
* Subtracts the given vector from this vector.
|
|
140
|
+
* @param b The vector to subtract.
|
|
141
|
+
* @returns A new vector that is the difference of this vector and the given vector.
|
|
563
142
|
*/
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
//#endregion
|
|
567
|
-
//#region src/types/view-manual-layout.d.ts
|
|
568
|
-
type LayoutedViewDriftReason = 'not-exists' | 'type-changed' | 'nodes-added' | 'nodes-removed' | 'nodes-drift' | 'edges-added' | 'edges-removed' | 'edges-drift';
|
|
569
|
-
type DiagramNodeDriftReason = 'removed' | 'added' | 'label-changed' | 'modelRef-changed' | 'parent-changed' | 'children-changed' | 'became-compound' | 'became-leaf' | 'shape-changed';
|
|
570
|
-
type DiagramEdgeDriftReason = 'removed' | 'added' | 'label-added' | 'label-removed' | 'label-changed' | 'notes-changed' | 'direction-changed' | 'source-changed' | 'target-changed';
|
|
571
|
-
type ViewManualLayoutSnapshotPerType = {
|
|
572
|
-
readonly [_type]: 'element';
|
|
573
|
-
readonly viewOf?: Fqn$1;
|
|
574
|
-
readonly extends?: ViewId$1;
|
|
575
|
-
} | {
|
|
576
|
-
readonly [_type]: 'deployment';
|
|
577
|
-
} | {
|
|
578
|
-
readonly [_type]: 'dynamic';
|
|
579
|
-
readonly sequenceLayout: LayoutedDynamicView.Sequence.Layout;
|
|
580
|
-
};
|
|
581
|
-
type ViewManualLayoutSnapshot<Type extends ViewType = ViewType> = Simplify<ViewManualLayoutSnapshotPerType & {
|
|
582
|
-
readonly id: ViewId$1;
|
|
583
|
-
readonly title: string | null;
|
|
584
|
-
readonly description: MarkdownOrString | null;
|
|
585
|
-
readonly [_type]: Type;
|
|
586
|
-
readonly [_stage]: 'layouted';
|
|
587
|
-
readonly hash: string;
|
|
588
|
-
readonly nodes: ReadonlyArray<DiagramNode>;
|
|
589
|
-
readonly edges: ReadonlyArray<DiagramEdge>;
|
|
590
|
-
readonly bounds: BBox;
|
|
591
|
-
readonly autoLayout: ViewAutoLayout;
|
|
592
|
-
} & ViewWithNotation>;
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/types/view-layouted.d.ts
|
|
595
|
-
interface DiagramNode<A extends Any = Any> extends ComputedNode<A>, BBox {
|
|
143
|
+
subtract(b: VectorValue): Vector;
|
|
596
144
|
/**
|
|
597
|
-
*
|
|
145
|
+
* Multiplies this vector by a scalar.
|
|
146
|
+
* @param b The scalar to multiply by.
|
|
147
|
+
* @returns A new vector that is the product of this vector and the given scalar.
|
|
598
148
|
*/
|
|
599
|
-
|
|
149
|
+
multiply(b: number): Vector;
|
|
600
150
|
/**
|
|
601
|
-
*
|
|
151
|
+
* Divides this vector by a scalar.
|
|
152
|
+
* @param b The scalar to divide by.
|
|
153
|
+
* @returns A new vector that is the quotient of this vector and the given scalar.
|
|
602
154
|
*/
|
|
603
|
-
|
|
604
|
-
width: number;
|
|
605
|
-
height: number;
|
|
155
|
+
divide(b: number): Vector;
|
|
606
156
|
/**
|
|
607
|
-
*
|
|
608
|
-
*
|
|
157
|
+
* Calculates the dot product of this vector and another vector.
|
|
158
|
+
* @param b The other vector.
|
|
159
|
+
* @returns The dot product.
|
|
609
160
|
*/
|
|
610
|
-
|
|
161
|
+
dot(b: VectorValue): number;
|
|
611
162
|
/**
|
|
612
|
-
*
|
|
163
|
+
* Calculates the cross product of this vector and another vector.
|
|
164
|
+
* The cross product of two 2D vectors is a scalar value: a.x * b.y - a.y * b.x
|
|
165
|
+
* @param b The other vector.
|
|
166
|
+
* @returns The cross product as a scalar.
|
|
613
167
|
*/
|
|
614
|
-
|
|
615
|
-
}
|
|
616
|
-
interface DiagramEdge<A extends Any = Any> extends ComputedEdge<A> {
|
|
168
|
+
cross(b: VectorValue): number;
|
|
617
169
|
/**
|
|
618
|
-
*
|
|
619
|
-
*
|
|
170
|
+
* Calculates the length (magnitude) of this vector.
|
|
171
|
+
* @returns The length of the vector.
|
|
620
172
|
*/
|
|
621
|
-
|
|
173
|
+
length(): number;
|
|
622
174
|
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
175
|
+
* Normalizes the vector (makes it unit length, i.e., has a length of 1).
|
|
176
|
+
* @returns A new vector that is the normalized version of this vector.
|
|
625
177
|
*/
|
|
626
|
-
|
|
178
|
+
normalize(): Vector;
|
|
627
179
|
/**
|
|
628
|
-
*
|
|
629
|
-
*
|
|
180
|
+
* Rounds the components of the vector to the nearest integers.
|
|
181
|
+
* @returns A new vector with rounded components.
|
|
630
182
|
*/
|
|
631
|
-
|
|
183
|
+
round(): Vector;
|
|
632
184
|
/**
|
|
633
|
-
*
|
|
185
|
+
* Truncates the components of the vector (removes the decimal part).
|
|
186
|
+
* @returns A new vector with truncated components.
|
|
634
187
|
*/
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Type of the layout
|
|
639
|
-
* - `auto`: auto-layouted from the current sources
|
|
640
|
-
* - `manual`: read from the manually layouted snapshot
|
|
641
|
-
*/
|
|
642
|
-
type LayoutType = 'auto' | 'manual';
|
|
643
|
-
interface BaseLayoutedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
644
|
-
readonly [_stage]: 'layouted';
|
|
188
|
+
trunc(): Vector;
|
|
645
189
|
/**
|
|
646
|
-
*
|
|
190
|
+
* Converts the vector to a plain object.
|
|
191
|
+
* @returns An object with x and y properties.
|
|
647
192
|
*/
|
|
648
|
-
|
|
649
|
-
readonly autoLayout: ViewAutoLayout;
|
|
650
|
-
readonly nodes: ReadonlyArray<DiagramNode<A>>;
|
|
651
|
-
readonly edges: ReadonlyArray<DiagramEdge<A>>;
|
|
652
|
-
readonly bounds: BBox;
|
|
653
|
-
/**
|
|
654
|
-
* If diagram has manual layout
|
|
655
|
-
* But was changed and layout should be recalculated
|
|
656
|
-
* @deprecated manual layout v2 uses {@link drifts}
|
|
657
|
-
*/
|
|
658
|
-
readonly hasLayoutDrift?: boolean;
|
|
659
|
-
/**
|
|
660
|
-
* List of reasons causing layout drift
|
|
661
|
-
* If undefined or null, there is no layout drift or view is auto-layouted
|
|
662
|
-
*/
|
|
663
|
-
readonly drifts?: NonEmptyReadonlyArray<LayoutedViewDriftReason> | null;
|
|
664
|
-
}
|
|
665
|
-
interface LayoutedElementView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
666
|
-
readonly [_type]: 'element';
|
|
667
|
-
readonly viewOf?: Fqn<A>;
|
|
668
|
-
readonly extends?: StrictViewId<A>;
|
|
669
|
-
}
|
|
670
|
-
interface LayoutedDeploymentView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
671
|
-
readonly [_type]: 'deployment';
|
|
672
|
-
}
|
|
673
|
-
interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
674
|
-
readonly [_type]: 'dynamic';
|
|
675
|
-
/**
|
|
676
|
-
* Default variant of this dynamic view
|
|
677
|
-
* - `diagram`: display as a regular likec4 view (default if not specified)
|
|
678
|
-
* - `sequence`: display as a sequence diagram
|
|
679
|
-
*/
|
|
680
|
-
readonly variant: DynamicViewDisplayVariant;
|
|
681
|
-
/**
|
|
682
|
-
* Sequence layout of this dynamic view
|
|
683
|
-
*/
|
|
684
|
-
readonly sequenceLayout: LayoutedDynamicView.Sequence.Layout;
|
|
685
|
-
}
|
|
686
|
-
declare namespace LayoutedDynamicView {
|
|
687
|
-
namespace Sequence {
|
|
688
|
-
interface ActorPort {
|
|
689
|
-
readonly id: string;
|
|
690
|
-
readonly cx: number;
|
|
691
|
-
readonly cy: number;
|
|
692
|
-
readonly height: number;
|
|
693
|
-
readonly type: 'target' | 'source';
|
|
694
|
-
readonly position: 'left' | 'right' | 'top' | 'bottom';
|
|
695
|
-
}
|
|
696
|
-
interface Actor {
|
|
697
|
-
readonly id: NodeId;
|
|
698
|
-
readonly x: number;
|
|
699
|
-
readonly y: number;
|
|
700
|
-
readonly width: number;
|
|
701
|
-
readonly height: number;
|
|
702
|
-
readonly ports: ReadonlyArray<ActorPort>;
|
|
703
|
-
}
|
|
704
|
-
interface Compound {
|
|
705
|
-
readonly id: NodeId;
|
|
706
|
-
/**
|
|
707
|
-
* Original node id, since multiple compound nodes can be built from one node
|
|
708
|
-
*/
|
|
709
|
-
readonly origin: NodeId;
|
|
710
|
-
readonly x: number;
|
|
711
|
-
readonly y: number;
|
|
712
|
-
readonly width: number;
|
|
713
|
-
readonly height: number;
|
|
714
|
-
readonly depth: number;
|
|
715
|
-
}
|
|
716
|
-
interface ParallelArea {
|
|
717
|
-
readonly parallelPrefix: string;
|
|
718
|
-
readonly x: number;
|
|
719
|
-
readonly y: number;
|
|
720
|
-
readonly width: number;
|
|
721
|
-
readonly height: number;
|
|
722
|
-
}
|
|
723
|
-
interface Step {
|
|
724
|
-
readonly id: EdgeId;
|
|
725
|
-
readonly labelBBox?: {
|
|
726
|
-
width: number;
|
|
727
|
-
height: number;
|
|
728
|
-
} | undefined;
|
|
729
|
-
readonly sourceHandle: string;
|
|
730
|
-
readonly targetHandle: string;
|
|
731
|
-
}
|
|
732
|
-
interface Layout {
|
|
733
|
-
readonly actors: ReadonlyArray<Actor>;
|
|
734
|
-
/**
|
|
735
|
-
* Steps in the sequence diagram (filtered edges with compound nodes)
|
|
736
|
-
*/
|
|
737
|
-
readonly steps: ReadonlyArray<Step>;
|
|
738
|
-
readonly compounds: ReadonlyArray<Compound>;
|
|
739
|
-
readonly parallelAreas: ReadonlyArray<ParallelArea>;
|
|
740
|
-
readonly bounds: BBox;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
//#endregion
|
|
745
|
-
//#region src/types/view-parsed.deployment.d.ts
|
|
746
|
-
/**
|
|
747
|
-
* Predicates scoped to deployment model
|
|
748
|
-
*/
|
|
749
|
-
interface DeploymentViewIncludePredicate<A extends Any = Unknown> extends AnyIncludePredicate<Expression<A>> {}
|
|
750
|
-
interface DeploymentViewExcludePredicate<A extends Any = Unknown> extends AnyExcludePredicate<Expression<A>> {}
|
|
751
|
-
type DeploymentViewPredicate<A extends Any = Unknown> = DeploymentViewIncludePredicate<A> | DeploymentViewExcludePredicate<A>;
|
|
752
|
-
interface DeploymentViewRuleStyle<A extends Any = Unknown> extends AnyViewRuleStyle<FqnExpr<A>> {}
|
|
753
|
-
type DeploymentViewRule<A extends Any = Unknown> = ExclusiveUnion<{
|
|
754
|
-
Include: DeploymentViewIncludePredicate<A>;
|
|
755
|
-
Exclude: DeploymentViewExcludePredicate<A>;
|
|
756
|
-
Style: DeploymentViewRuleStyle<A>;
|
|
757
|
-
AutoLayout: ViewRuleAutoLayout;
|
|
758
|
-
}>;
|
|
759
|
-
interface ParsedDeploymentView<A extends Any = Unknown> extends BaseParsedViewProperties<A> {
|
|
760
|
-
[_type]: 'deployment';
|
|
761
|
-
readonly rules: DeploymentViewRule<A>[];
|
|
762
|
-
}
|
|
763
|
-
//#endregion
|
|
764
|
-
//#region src/types/view.d.ts
|
|
765
|
-
type ParsedView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A>;
|
|
766
|
-
type ComputedView<A extends Any = Any> = ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A>;
|
|
767
|
-
type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
768
|
-
type ProcessedView<A extends Any = Any> = ComputedView<A> | LayoutedView<A>;
|
|
769
|
-
type AnyView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A> | ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A> | LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
770
|
-
type ViewOnStage<V extends AnyView<Any>, T extends ModelStage> = Extract<V, {
|
|
771
|
-
[_stage]: T;
|
|
772
|
-
}>;
|
|
773
|
-
type ViewWithType<V extends AnyView<Any>, T extends ViewType> = Extract<V, {
|
|
774
|
-
[_type]: T;
|
|
775
|
-
}>;
|
|
776
|
-
type ViewRule<A extends Any = Any> = ParsedView<A>['rules'][number];
|
|
777
|
-
type ViewRulePredicate<A extends Any = Any> = Extract<ViewRule<A>, {
|
|
778
|
-
include: any[];
|
|
779
|
-
} | {
|
|
780
|
-
exclude: any[];
|
|
781
|
-
}>;
|
|
782
|
-
declare function isViewRulePredicate<V extends ViewRule<any>>(rule: V): rule is Extract<V, {
|
|
783
|
-
include: any[];
|
|
784
|
-
} | {
|
|
785
|
-
exclude: any[];
|
|
786
|
-
}>;
|
|
787
|
-
declare function isViewRuleStyle<V extends ViewRule<any>>(rule: V): rule is Extract<V, {
|
|
788
|
-
targets: any[];
|
|
789
|
-
style: {};
|
|
790
|
-
}>;
|
|
791
|
-
declare function isComputedView<V extends AnyView<any>>(view: V): view is ExtractOnStage<V, 'computed'>;
|
|
792
|
-
declare function isDiagramView<V extends AnyView<any>>(view: V): view is ExtractOnStage<V, 'layouted'>;
|
|
793
|
-
declare function isElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'>;
|
|
794
|
-
declare function isScopedElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'> & {
|
|
795
|
-
viewOf: Fqn<Any>;
|
|
796
|
-
};
|
|
797
|
-
declare function isExtendsElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'> & {
|
|
798
|
-
extends: StrictViewId<Any>;
|
|
799
|
-
};
|
|
800
|
-
declare function isDeploymentView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'deployment'>;
|
|
801
|
-
declare function isDynamicView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'dynamic'>;
|
|
802
|
-
//#endregion
|
|
803
|
-
//#region src/types/model-data.d.ts
|
|
804
|
-
/**
|
|
805
|
-
* Represents a LikeC4 model data, in different stages of processing
|
|
806
|
-
* - {@link ParsedLikeC4ModelData} - parsed from DSL or result from Builder
|
|
807
|
-
* - {@link ComputedLikeC4ModelData} - computed from parsed model
|
|
808
|
-
* - {@link LayoutedLikeC4ModelData} - layouted from computed model
|
|
809
|
-
*
|
|
810
|
-
* !IMPORTANT: This is a low-level type, use `LikeC4Model` instead.
|
|
811
|
-
*/
|
|
812
|
-
interface BaseLikeC4ModelData<A extends Any> {
|
|
813
|
-
[_stage]: A['Stage'];
|
|
814
|
-
projectId: ProjectId<A>;
|
|
815
|
-
project: LikeC4Project;
|
|
816
|
-
specification: Specification<A>;
|
|
817
|
-
elements: Record<ElementId<A>, Element<A>>;
|
|
818
|
-
deployments: {
|
|
819
|
-
elements: Record<DeploymentId<A>, DeploymentElement<A>>;
|
|
820
|
-
relations: Record<RelationId, DeploymentRelationship<A>>;
|
|
821
|
-
};
|
|
822
|
-
relations: Record<RelationId, Relationship<A>>;
|
|
823
|
-
globals: ModelGlobals;
|
|
824
|
-
imports: Record<string, NonEmptyArray<Element<A>>>;
|
|
825
|
-
}
|
|
826
|
-
type AuxFromLikeC4ModelData<D> = D extends BaseLikeC4ModelData<infer A extends Any> ? IsAny<A> extends true ? never : A : never;
|
|
827
|
-
interface ParsedLikeC4ModelData<A extends AnyParsed = UnknownParsed> extends BaseLikeC4ModelData<A> {
|
|
828
|
-
[_stage]: 'parsed';
|
|
829
|
-
views: Record<ViewId<A>, ParsedView<A>>;
|
|
830
|
-
}
|
|
831
|
-
interface ComputedLikeC4ModelData<A extends AnyComputed = UnknownComputed> extends BaseLikeC4ModelData<A> {
|
|
832
|
-
[_stage]: 'computed';
|
|
833
|
-
views: Record<ViewId<A>, ComputedView<A>>;
|
|
834
|
-
/**
|
|
835
|
-
* If project contains saved manual layouts
|
|
836
|
-
*/
|
|
837
|
-
manualLayouts?: Record<ViewId$1, ViewManualLayoutSnapshot>;
|
|
838
|
-
}
|
|
839
|
-
interface LayoutedLikeC4ModelData<A extends AnyLayouted = UnknownLayouted> extends BaseLikeC4ModelData<A> {
|
|
840
|
-
[_stage]: 'layouted';
|
|
841
|
-
views: Record<ViewId<A>, LayoutedView<A>>;
|
|
842
|
-
/**
|
|
843
|
-
* If this model contains saved manual layouts
|
|
844
|
-
*/
|
|
845
|
-
manualLayouts?: Record<ViewId$1, ViewManualLayoutSnapshot>;
|
|
846
|
-
}
|
|
847
|
-
type LikeC4ModelData<A extends Any> = ParsedLikeC4ModelData<A> | ComputedLikeC4ModelData<A> | LayoutedLikeC4ModelData<A>;
|
|
848
|
-
//#endregion
|
|
849
|
-
//#region src/types/model-dump.d.ts
|
|
850
|
-
/**
|
|
851
|
-
* JSON representation of {@link Specification}
|
|
852
|
-
*/
|
|
853
|
-
interface SpecificationDump {
|
|
854
|
-
elements: {
|
|
855
|
-
[kind: string]: object;
|
|
856
|
-
};
|
|
857
|
-
tags?: {
|
|
858
|
-
[tag: string]: object;
|
|
859
|
-
};
|
|
860
|
-
deployments?: {
|
|
861
|
-
[kind: string]: object;
|
|
862
|
-
};
|
|
863
|
-
relationships?: {
|
|
864
|
-
[kind: string]: object;
|
|
865
|
-
};
|
|
866
|
-
metadataKeys?: string[];
|
|
867
|
-
customColors?: {
|
|
868
|
-
[kind: string]: object;
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
type SpecTypesFromDump<J> = J extends SpecificationDump ? SpecAux<KeysOf<J['elements']>, KeysOf<J['deployments']>, KeysOf<J['relationships']>, KeysOf<J['tags']>, J['metadataKeys'] extends readonly [string, ...string[]] ? J['metadataKeys'][number] : never> : SpecAux<never, never, never, never, never>;
|
|
872
|
-
/**
|
|
873
|
-
* Dump differs from {@link ParsedLikeC4ModelData} by the fact that it is computed or layouted
|
|
874
|
-
*/
|
|
875
|
-
type LikeC4ModelDump = {
|
|
876
|
-
[_stage]?: 'computed' | 'layouted';
|
|
877
|
-
projectId?: string;
|
|
878
|
-
project?: ProjectDump;
|
|
879
|
-
specification: SpecificationDump;
|
|
880
|
-
elements?: {
|
|
881
|
-
[kind: string]: object;
|
|
882
|
-
};
|
|
883
|
-
deployments: {
|
|
884
|
-
elements?: {
|
|
885
|
-
[kind: string]: object;
|
|
886
|
-
};
|
|
887
|
-
relations?: {};
|
|
888
|
-
};
|
|
889
|
-
views?: {
|
|
890
|
-
[kind: string]: object;
|
|
891
|
-
};
|
|
892
|
-
relations?: {};
|
|
893
|
-
globals?: {
|
|
894
|
-
predicates?: {};
|
|
895
|
-
dynamicPredicates?: {};
|
|
896
|
-
styles?: {};
|
|
897
|
-
};
|
|
898
|
-
imports?: {};
|
|
899
|
-
};
|
|
900
|
-
type ProjectDump = {
|
|
901
|
-
id: string;
|
|
902
|
-
name?: string;
|
|
903
|
-
title?: string | undefined;
|
|
904
|
-
};
|
|
905
|
-
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;
|
|
906
|
-
//#endregion
|
|
907
|
-
//#region src/types/view-changes.d.ts
|
|
908
|
-
declare namespace ViewChange {
|
|
909
|
-
interface ChangeElementStyle {
|
|
910
|
-
op: 'change-element-style';
|
|
911
|
-
style: {
|
|
912
|
-
border?: BorderStyle;
|
|
913
|
-
opacity?: number;
|
|
914
|
-
shape?: ElementShape;
|
|
915
|
-
color?: ThemeColor;
|
|
916
|
-
};
|
|
917
|
-
targets: NonEmptyArray<Fqn$1 | DeploymentFqn$1>;
|
|
918
|
-
}
|
|
919
|
-
interface SaveViewSnapshot {
|
|
920
|
-
op: 'save-view-snapshot';
|
|
921
|
-
layout: LayoutedView;
|
|
922
|
-
}
|
|
923
|
-
interface ResetManualLayout {
|
|
924
|
-
op: 'reset-manual-layout';
|
|
925
|
-
}
|
|
926
|
-
interface ChangeAutoLayout {
|
|
927
|
-
op: 'change-autolayout';
|
|
928
|
-
layout: {
|
|
929
|
-
direction: AutoLayoutDirection;
|
|
930
|
-
nodeSep?: number | null;
|
|
931
|
-
rankSep?: number | null;
|
|
932
|
-
};
|
|
933
|
-
}
|
|
193
|
+
toObject(): VectorValue;
|
|
934
194
|
}
|
|
935
|
-
|
|
195
|
+
declare function vector(source: VectorValue | Vector): Vector;
|
|
196
|
+
declare function vector(x: number, y: number): Vector;
|
|
936
197
|
//#endregion
|
|
937
|
-
export {
|
|
198
|
+
export { RectBox as a, XYPoint as c, BBox as i, convertPoint as l, VectorValue as n, Dimensions as o, vector as r, Point as s, Vector as t, isPoint as u };
|