@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.
Files changed (130) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +1034 -0
  2. package/dist/_chunks/Builder.view-element.mjs +2 -3284
  3. package/dist/_chunks/LikeC4Model.d.mts +21 -25
  4. package/dist/_chunks/_types.d.mts +1 -5
  5. package/dist/_chunks/_types2.d.mts +2 -4
  6. package/dist/_chunks/assignTagColors.mjs +1 -24
  7. package/dist/_chunks/geometry.mjs +1 -335
  8. package/dist/_chunks/index.d.mts +1995 -131
  9. package/dist/_chunks/index2.d.mts +153 -892
  10. package/dist/_chunks/index3.d.mts +15 -13
  11. package/dist/_chunks/index4.d.mts +229 -3
  12. package/dist/_chunks/index5.d.mts +392 -30
  13. package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
  14. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
  15. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
  16. package/dist/_chunks/libs/bail.mjs +1 -14
  17. package/dist/_chunks/libs/ccount.mjs +1 -25
  18. package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
  19. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
  20. package/dist/_chunks/libs/character-entities.mjs +2 -2136
  21. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
  22. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
  23. package/dist/_chunks/libs/defu.mjs +1 -42
  24. package/dist/_chunks/libs/devlop.mjs +1 -5
  25. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
  26. package/dist/_chunks/libs/extend.mjs +1 -77
  27. package/dist/_chunks/libs/graphology-dag.mjs +1 -703
  28. package/dist/_chunks/libs/graphology.mjs +1 -4565
  29. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
  30. package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
  31. package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
  32. package/dist/_chunks/libs/longest-streak.mjs +1 -30
  33. package/dist/_chunks/libs/markdown-table.mjs +2 -290
  34. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
  35. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
  36. package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
  37. package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
  38. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
  39. package/dist/_chunks/libs/mnemonist.d.mts +1 -91
  40. package/dist/_chunks/libs/mnemonist.mjs +1 -1978
  41. package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
  42. package/dist/_chunks/libs/ohash.mjs +1 -0
  43. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
  44. package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
  45. package/dist/_chunks/libs/remark-gfm.mjs +1 -36
  46. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
  47. package/dist/_chunks/libs/remark-parse.mjs +1 -39
  48. package/dist/_chunks/libs/remark-rehype.mjs +1 -171
  49. package/dist/_chunks/libs/remeda.mjs +2 -702
  50. package/dist/_chunks/libs/trough.mjs +1 -158
  51. package/dist/_chunks/libs/unified.mjs +1 -2212
  52. package/dist/_chunks/manual-layout.mjs +1 -0
  53. package/dist/_chunks/model.mjs +4 -1898
  54. package/dist/_chunks/rolldown-runtime.mjs +1 -42
  55. package/dist/_chunks/types.mjs +1 -0
  56. package/dist/_chunks/utils.mjs +1 -483
  57. package/dist/builder/index.d.mts +3 -6
  58. package/dist/builder/index.mjs +1 -662
  59. package/dist/compute-view/index.d.mts +85 -13
  60. package/dist/compute-view/index.mjs +2 -262
  61. package/dist/geometry/index.d.mts +2 -2
  62. package/dist/geometry/index.mjs +1 -3
  63. package/dist/index.d.mts +7 -13
  64. package/dist/index.mjs +1 -27
  65. package/dist/model/index.d.mts +4 -11
  66. package/dist/model/index.mjs +1 -11
  67. package/dist/styles/index.d.mts +2 -7
  68. package/dist/styles/index.mjs +1 -30
  69. package/dist/types/index.d.mts +3 -9
  70. package/dist/types/index.mjs +1 -15
  71. package/dist/utils/graphology/index.d.mts +1 -1
  72. package/dist/utils/graphology/index.mjs +1 -3
  73. package/dist/utils/index.d.mts +5 -10
  74. package/dist/utils/index.mjs +1 -17
  75. package/package.json +14 -13
  76. package/dist/_chunks/LikeC4Styles.mjs +0 -691
  77. package/dist/_chunks/RichText.d.mts +0 -84
  78. package/dist/_chunks/RichText.mjs +0 -148
  79. package/dist/_chunks/_aux.d.mts +0 -289
  80. package/dist/_chunks/_aux.mjs +0 -18
  81. package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
  82. package/dist/_chunks/connection.mjs +0 -0
  83. package/dist/_chunks/const.d.mts +0 -43
  84. package/dist/_chunks/const.mjs +0 -33
  85. package/dist/_chunks/expression-model.d.mts +0 -192
  86. package/dist/_chunks/expression-model.mjs +0 -103
  87. package/dist/_chunks/expression.d.mts +0 -347
  88. package/dist/_chunks/expression.mjs +0 -107
  89. package/dist/_chunks/find.d.mts +0 -82
  90. package/dist/_chunks/find.mjs +0 -646
  91. package/dist/_chunks/find2.d.mts +0 -78
  92. package/dist/_chunks/find2.mjs +0 -287
  93. package/dist/_chunks/fqnRef.d.mts +0 -58
  94. package/dist/_chunks/fqnRef.mjs +0 -41
  95. package/dist/_chunks/index6.d.mts +0 -43
  96. package/dist/_chunks/index7.d.mts +0 -268
  97. package/dist/_chunks/index8.d.mts +0 -144
  98. package/dist/_chunks/invariant.mjs +0 -18
  99. package/dist/_chunks/iterable.mjs +0 -146
  100. package/dist/_chunks/libs/graphology-types.d.mts +0 -601
  101. package/dist/_chunks/libs/graphology.d.mts +0 -6
  102. package/dist/_chunks/mnemonist.mjs +0 -0
  103. package/dist/_chunks/model2.mjs +0 -0
  104. package/dist/_chunks/relationships-view.mjs +0 -132
  105. package/dist/_chunks/scalar.d.mts +0 -109
  106. package/dist/_chunks/scalar.mjs +0 -84
  107. package/dist/compute-view/relationships-view/index.d.mts +0 -16
  108. package/dist/compute-view/relationships-view/index.mjs +0 -7
  109. package/dist/model/connection/deployment/index.d.mts +0 -12
  110. package/dist/model/connection/deployment/index.mjs +0 -9
  111. package/dist/model/connection/index.d.mts +0 -14
  112. package/dist/model/connection/index.mjs +0 -10
  113. package/dist/model/connection/model/index.d.mts +0 -12
  114. package/dist/model/connection/model/index.mjs +0 -8
  115. package/dist/types/RichText.d.mts +0 -3
  116. package/dist/types/RichText.mjs +0 -7
  117. package/dist/types/_aux.d.mts +0 -3
  118. package/dist/types/_aux.mjs +0 -3
  119. package/dist/types/expression-model.d.mts +0 -6
  120. package/dist/types/expression-model.mjs +0 -7
  121. package/dist/types/expression.d.mts +0 -5
  122. package/dist/types/expression.mjs +0 -7
  123. package/dist/types/fqnRef.d.mts +0 -4
  124. package/dist/types/fqnRef.mjs +0 -7
  125. package/dist/types/scalar.d.mts +0 -2
  126. package/dist/types/scalar.mjs +0 -7
  127. package/dist/utils/iterable/index.d.mts +0 -9
  128. package/dist/utils/iterable/index.mjs +0 -3
  129. package/dist/utils/mnemonist.d.mts +0 -2
  130. package/dist/utils/mnemonist.mjs +0 -12
@@ -1,937 +1,198 @@
1
- import { $ as WithNotation, D as Never, E as MetadataKey, F as SpecAux, G as Unknown, H as StrictViewId, J as UnknownParsed, K as UnknownComputed, N as RelationKind, O as NodeId, Q as WithMetadata, St as Link, Tt as NonEmptyReadonlyArray, U as Tag, X as WithDescriptionAndTech, Y as ViewId, c as Aux, d as DeploymentKind, dt as ExtractOnStage, et as WithOptionalLinks, f as EdgeId, ft as ModelStage, h as Fqn, ht as _type, i as AnyLayouted, j as ProjectId, l as DeploymentFqn, m as ElementKind, mt as _stage, n as Any, nt as WithTags, o as AnyParsed, p as ElementId, pt as _layout, q as UnknownLayouted, r as AnyComputed, tt as WithOptionalTags, u as DeploymentId, vt as ExclusiveUnion, wt as NonEmptyArray, xt as KeysOf } from "./_aux.mjs";
2
- import { C as ViewId$1, S as Tag$1, a as EdgeId$1, f as MarkdownOrString, g as RelationId, h as ProjectId$1, p as NodeId$1, r as DeploymentFqn$1, s as Fqn$1, u as Icon, x as StepEdgeKind } from "./scalar.mjs";
3
- import { a as Point, i as BBox, s as XYPoint } from "./index.mjs";
4
- import { B as ShapeSize, C as BorderStyle, D as CustomColorDefinitions, F as LikeC4Theme, H as SpacingSize, I as RelationshipArrowType, M as IconSize, N as LikeC4StyleDefaults, T as ColorLiteral, U as TextSize, W as ThemeColor, j as IconPosition, k as ElementShape, n as FqnExpr, t as Expression, w as Color, z as RelationshipLineType } from "./expression.mjs";
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
- declare function isViewRuleAutoLayout(rule: object): rule is ViewRuleAutoLayout;
57
- interface ViewAutoLayout {
58
- direction: ViewRuleAutoLayout['direction'];
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
- * v1 Manual layout of a view, stored in the block comment to the view definition.
64
- * Keeping this type for backward compatibility and migration purposes.
13
+ * Converts between Point (tuple) and XYPoint (object) representations.
65
14
  *
66
- * @deprecated Use {@link ViewManualLayoutSnapshot} instead
67
- */
68
- type ViewManualLayout = {
69
- readonly hash: string;
70
- readonly x: number;
71
- readonly y: number;
72
- readonly width: number;
73
- readonly height: number;
74
- readonly autoLayout: ViewAutoLayout;
75
- readonly nodes: Record<string, {
76
- isCompound: boolean;
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
- type ModelRelation<A extends Any = Any> = Relationship<A>;
27
+ declare function convertPoint(point: Point): XYPoint;
28
+ declare function convertPoint(point: XYPoint): Point;
313
29
  //#endregion
314
- //#region src/types/model-deployment.d.ts
315
- interface DeploymentNode<A extends Any = Unknown> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A>, WithNotation {
316
- element?: never;
317
- readonly id: DeploymentFqn<A>;
318
- readonly kind: DeploymentKind<A>;
319
- readonly title: string;
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
- type DeploymentElement<A extends Any = Unknown> = DeploymentNode<A> | DeployedInstance<A>;
334
- type DeploymentElementRef<A extends Any = Unknown> = {
335
- readonly id: DeploymentFqn<A>;
336
- readonly element?: Fqn<A>;
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
- declare function isDeploymentNode<A extends Any>(el: DeploymentElement<A>): el is DeploymentNode<A>;
339
- declare function isDeployedInstance<A extends Any>(el: DeploymentElement<A>): el is DeployedInstance<A>;
340
- /**
341
- * Relationship in deployment model
342
- */
343
- interface DeploymentRelationship<A extends Any = Unknown> extends AbstractRelationship<A> {
344
- readonly source: FqnRef.DeploymentRef<A>;
345
- readonly target: FqnRef.DeploymentRef<A>;
346
- }
347
- /**
348
- * Backward compatibility alias
349
- * @deprecated Use {@link DeploymentRelationship} instead
350
- */
351
- type DeploymentRelation<A extends Any = Unknown> = DeploymentRelationship<A>;
352
- //#endregion
353
- //#region src/types/model-spec.d.ts
354
- /**
355
- * Element and deployment kind specification
356
- */
357
- interface ElementSpecification {
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/types/project.d.ts
408
- type LikeC4ProjectTheme = PartialDeep<WritableDeep<LikeC4Theme>, {
409
- recurseIntoArrays: false;
410
- allowUndefinedInNonTupleArrays: false;
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
- //#endregion
455
- //#region src/types/view-computed.d.ts
456
- type ComputedNodeStyle = Simplify<ElementStyle & {
457
- icon?: never;
458
- shape?: never;
459
- color?: never;
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
- * If this node was customized in the view
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
- isCustomized?: boolean;
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
- * If this edge is derived from custom relationship predicate
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
- isCustomized?: boolean;
110
+ static subtract(a: VectorValue, b: VectorValue): VectorValue;
517
111
  /**
518
- * Path to the AST node relative to the view body ast
519
- * Available only in dynamic views
520
- * @internal
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
- astPath?: string;
117
+ static multiply(a: VectorValue, b: number): VectorValue;
523
118
  /**
524
- * For layouting purposes
525
- * @default 'forward'
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
- dir?: 'forward' | 'back' | 'both';
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
- * If the view has manual layout (v2)
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
- readonly hasManualLayout?: boolean;
131
+ static dot(a: VectorValue, b: VectorValue): number;
542
132
  /**
543
- * Manual layout data (v1), for compatibility during migration
544
- * @deprecated
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
- readonly manualLayout?: ViewManualLayout | undefined;
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
- * How to display the dynamic view
561
- * - `diagram`: display as a regular likec4 view
562
- * - `sequence`: display as a sequence diagram
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
- readonly variant: DynamicViewDisplayVariant;
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
- * Absolute X coordinate
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
- x: number;
149
+ multiply(b: number): Vector;
600
150
  /**
601
- * Absolute Y coordinate
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
- y: number;
604
- width: number;
605
- height: number;
155
+ divide(b: number): Vector;
606
156
  /**
607
- * Bounding box of label
608
- * (Absolute coordinates)
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
- labelBBox: BBox;
161
+ dot(b: VectorValue): number;
611
162
  /**
612
- * List of reasons causing node drift
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
- drifts?: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
615
- }
616
- interface DiagramEdge<A extends Any = Any> extends ComputedEdge<A> {
168
+ cross(b: VectorValue): number;
617
169
  /**
618
- * Bezier points
619
- * (Absolute coordinates)
170
+ * Calculates the length (magnitude) of this vector.
171
+ * @returns The length of the vector.
620
172
  */
621
- points: NonEmptyArray<Point>;
173
+ length(): number;
622
174
  /**
623
- * Control points to adjust the edge
624
- * (Absolute coordinates)
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
- controlPoints?: NonEmptyArray<XYPoint> | null;
178
+ normalize(): Vector;
627
179
  /**
628
- * Bounding box of label
629
- * (Absolute coordinates)
180
+ * Rounds the components of the vector to the nearest integers.
181
+ * @returns A new vector with rounded components.
630
182
  */
631
- labelBBox?: BBox | null;
183
+ round(): Vector;
632
184
  /**
633
- * List of reasons causing edge drift
185
+ * Truncates the components of the vector (removes the decimal part).
186
+ * @returns A new vector with truncated components.
634
187
  */
635
- drifts?: NonEmptyReadonlyArray<DiagramEdgeDriftReason> | null;
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
- * If undefined, view does not have any manual layouts, and is auto-layouted
190
+ * Converts the vector to a plain object.
191
+ * @returns An object with x and y properties.
647
192
  */
648
- readonly [_layout]?: LayoutType;
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
- type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveViewSnapshot | ViewChange.ResetManualLayout | ViewChange.ChangeAutoLayout;
195
+ declare function vector(source: VectorValue | Vector): Vector;
196
+ declare function vector(x: number, y: number): Vector;
936
197
  //#endregion
937
- export { LikeC4Project as $, AnyIncludePredicate as $t, DeploymentViewExcludePredicate as A, DynamicStep as At, LayoutedDynamicView as B, isDynamicStepsParallel as Bt, isDiagramView as C, ensureSizes as Ct, isScopedElementView as D, GlobalStyleID as Dt, isExtendsElementView as E, GlobalPredicates as Et, ParsedDeploymentView as F, DynamicViewRule as Ft, ViewManualLayoutSnapshot as G, ElementViewRule as Gt, DiagramEdgeDriftReason as H, ElementViewExcludePredicate as Ht, DiagramEdge as I, DynamicViewStep as It, ComputedEdge as J, ElementViewRuleStyle as Jt, ComputedDeploymentView as K, ElementViewRuleGroup as Kt, DiagramNode as L, ParsedDynamicView as Lt, DeploymentViewPredicate as M, DynamicStepsSeries as Mt, DeploymentViewRule as N, DynamicViewDisplayVariant as Nt, isViewRulePredicate as O, GlobalStyles as Ot, DeploymentViewRuleStyle as P, DynamicViewIncludeRule as Pt, ComputedRankConstraint as Q, AnyExcludePredicate as Qt, LayoutType as R, getParallelStepsPrefix as Rt, isDeploymentView as S, Relationship as St, isElementView as T, GlobalPredicateId as Tt, DiagramNodeDriftReason as U, ElementViewIncludePredicate as Ut, LayoutedElementView as V, isDynamicStepsSeries as Vt, LayoutedViewDriftReason as W, ElementViewPredicate as Wt, ComputedNode as X, isViewRuleGroup as Xt, ComputedElementView as Y, ParsedElementView as Yt, ComputedNodeStyle as Z, isViewRuleRank as Zt, ViewOnStage as _, isViewRuleGlobalPredicateRef as _n, isDeploymentNode as _t, SpecTypesFromDump as a, RankValue as an, ElementSpecification as at, ViewWithType as b, ElementStyle as bt, ComputedLikeC4ModelData as c, ViewRuleAutoLayout as cn, TagSpecification as ct, ParsedLikeC4ModelData as d, ViewRuleRank as dn, DeploymentElement as dt, AnyViewRuleStyle as en, LikeC4ProjectManualLayoutsConfig as et, AnyView as f, ViewType as fn, DeploymentElementRef as ft, ProcessedView as g, isViewRuleAutoLayout as gn, isDeployedInstance as gt, ParsedView as h, isAutoLayoutDirection as hn, DeploymentRelationship as ht, ProjectDump as i, NodeNotation as in, LikeC4ProjectTheme as it, DeploymentViewIncludePredicate as j, DynamicStepsParallel as jt, isViewRuleStyle as k, ModelGlobals as kt, LayoutedLikeC4ModelData as l, ViewRuleGlobalPredicateRef as ln, isTagColorSpecified as lt, LayoutedView as m, ViewWithNotation as mn, DeploymentRelation as mt, AuxFromDump as n, BaseParsedViewProperties as nn, LikeC4ProjectStylesConfig as nt, SpecificationDump as o, ViewAutoLayout as on, RelationshipSpecification as ot, ComputedView as p, ViewWithHash as pn, DeploymentNode as pt, ComputedDynamicView as q, ElementViewRuleRank as qt, LikeC4ModelDump as r, BaseViewProperties as rn, LikeC4ProjectStylesCustomStylesheets as rt, AuxFromLikeC4ModelData as s, ViewManualLayout as sn, Specification as st, ViewChange as t, AutoLayoutDirection as tn, LikeC4ProjectStyleDefaults as tt, LikeC4ModelData as u, ViewRuleGlobalStyle as un, DeployedInstance as ut, ViewRule as v, isViewRuleGlobalStyle as vn, AbstractRelationship as vt, isDynamicView as w, GlobalDynamicPredicates as wt, isComputedView as x, ModelRelation as xt, ViewRulePredicate as y, Element as yt, LayoutedDeploymentView as z, isDynamicStep as zt };
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 };