@likec4/core 1.46.4 → 1.48.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 (181) hide show
  1. package/LICENSE +1 -1
  2. package/dist/_chunks/Builder.view-element.mjs +3284 -0
  3. package/dist/_chunks/LikeC4Model.d.mts +1287 -0
  4. package/dist/_chunks/LikeC4Styles.mjs +691 -0
  5. package/dist/_chunks/RichText.d.mts +84 -0
  6. package/dist/_chunks/RichText.mjs +148 -0
  7. package/dist/_chunks/_aux.d.mts +289 -0
  8. package/dist/_chunks/_aux.mjs +18 -0
  9. package/dist/_chunks/_types.d.mts +781 -0
  10. package/dist/_chunks/_types2.d.mts +38 -0
  11. package/dist/_chunks/assignTagColors.mjs +24 -0
  12. package/dist/_chunks/calcDriftsFromSnapshot.mjs +379 -0
  13. package/dist/_chunks/connection.mjs +0 -0
  14. package/dist/_chunks/const.d.mts +43 -0
  15. package/dist/_chunks/const.mjs +33 -0
  16. package/dist/_chunks/expression-model.d.mts +192 -0
  17. package/dist/_chunks/expression-model.mjs +103 -0
  18. package/dist/_chunks/expression.d.mts +347 -0
  19. package/dist/_chunks/expression.mjs +107 -0
  20. package/dist/_chunks/find.d.mts +82 -0
  21. package/dist/_chunks/find.mjs +646 -0
  22. package/dist/_chunks/find2.d.mts +78 -0
  23. package/dist/_chunks/find2.mjs +287 -0
  24. package/dist/_chunks/fqnRef.d.mts +58 -0
  25. package/dist/_chunks/fqnRef.mjs +41 -0
  26. package/dist/_chunks/geometry.mjs +335 -0
  27. package/dist/_chunks/index.d.mts +169 -0
  28. package/dist/_chunks/index2.d.mts +937 -0
  29. package/dist/_chunks/index3.d.mts +146 -0
  30. package/dist/_chunks/index4.d.mts +62 -0
  31. package/dist/_chunks/index5.d.mts +42 -0
  32. package/dist/_chunks/index6.d.mts +43 -0
  33. package/dist/{shared/core.OtRNdMxy.d.mts → _chunks/index7.d.mts} +113 -197
  34. package/dist/_chunks/index8.d.mts +144 -0
  35. package/dist/_chunks/invariant.mjs +18 -0
  36. package/dist/_chunks/iterable.mjs +146 -0
  37. package/dist/_chunks/libs/@mantine/colors-generator.mjs +3416 -0
  38. package/dist/_chunks/libs/@ungap/structured-clone.mjs +213 -0
  39. package/dist/_chunks/libs/bail.mjs +14 -0
  40. package/dist/_chunks/libs/ccount.mjs +25 -0
  41. package/dist/_chunks/libs/character-entities-html4.mjs +263 -0
  42. package/dist/_chunks/libs/character-entities-legacy.mjs +117 -0
  43. package/dist/_chunks/libs/character-entities.mjs +2136 -0
  44. package/dist/_chunks/libs/comma-separated-tokens.mjs +18 -0
  45. package/dist/_chunks/libs/decode-named-character-reference.mjs +21 -0
  46. package/dist/_chunks/libs/defu.mjs +42 -0
  47. package/dist/_chunks/libs/devlop.mjs +5 -0
  48. package/dist/_chunks/libs/escape-string-regexp.mjs +8 -0
  49. package/dist/_chunks/libs/extend.mjs +77 -0
  50. package/dist/_chunks/libs/graphology-dag.mjs +703 -0
  51. package/dist/_chunks/libs/graphology-types.d.mts +601 -0
  52. package/dist/_chunks/libs/graphology.d.mts +6 -0
  53. package/dist/_chunks/libs/graphology.mjs +4565 -0
  54. package/dist/_chunks/libs/hast-util-sanitize.mjs +863 -0
  55. package/dist/_chunks/libs/hast-util-to-html.mjs +2696 -0
  56. package/dist/_chunks/libs/is-plain-obj.mjs +9 -0
  57. package/dist/_chunks/libs/longest-streak.mjs +30 -0
  58. package/dist/_chunks/libs/markdown-table.mjs +290 -0
  59. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +653 -0
  60. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +8522 -0
  61. package/dist/_chunks/libs/mdast-util-gfm.mjs +2393 -0
  62. package/dist/_chunks/libs/mdast-util-to-hast.mjs +1803 -0
  63. package/dist/_chunks/libs/micromark-extension-gfm.mjs +2243 -0
  64. package/dist/_chunks/libs/mnemonist.d.mts +254 -0
  65. package/dist/_chunks/libs/mnemonist.mjs +1978 -0
  66. package/dist/_chunks/libs/natural-compare-lite.mjs +42 -0
  67. package/dist/_chunks/libs/rehype-sanitize.mjs +29 -0
  68. package/dist/_chunks/libs/rehype-stringify.mjs +34 -0
  69. package/dist/_chunks/libs/remark-gfm.mjs +36 -0
  70. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +100 -0
  71. package/dist/_chunks/libs/remark-parse.mjs +39 -0
  72. package/dist/_chunks/libs/remark-rehype.mjs +171 -0
  73. package/dist/_chunks/libs/remeda.mjs +702 -0
  74. package/dist/_chunks/libs/trough.mjs +158 -0
  75. package/dist/_chunks/libs/unified.mjs +2212 -0
  76. package/dist/_chunks/mnemonist.d.mts +1 -0
  77. package/dist/_chunks/mnemonist.mjs +0 -0
  78. package/dist/_chunks/model.mjs +1898 -0
  79. package/dist/_chunks/model2.mjs +0 -0
  80. package/dist/_chunks/relationships-view.mjs +132 -0
  81. package/dist/_chunks/rolldown-runtime.mjs +42 -0
  82. package/dist/{shared/core.C_3y3eqV.d.mts → _chunks/scalar.d.mts} +13 -43
  83. package/dist/_chunks/scalar.mjs +84 -0
  84. package/dist/_chunks/utils.mjs +483 -0
  85. package/dist/builder/index.d.mts +11 -773
  86. package/dist/builder/index.mjs +631 -978
  87. package/dist/compute-view/index.d.mts +90 -27
  88. package/dist/compute-view/index.mjs +253 -83
  89. package/dist/compute-view/relationships-view/index.d.mts +16 -51
  90. package/dist/compute-view/relationships-view/index.mjs +6 -184
  91. package/dist/geometry/index.d.mts +2 -109
  92. package/dist/geometry/index.mjs +2 -327
  93. package/dist/index.d.mts +18 -20
  94. package/dist/index.mjs +27 -18
  95. package/dist/model/connection/deployment/index.d.mts +12 -15
  96. package/dist/model/connection/deployment/index.mjs +9 -2
  97. package/dist/model/connection/index.d.mts +14 -75
  98. package/dist/model/connection/index.mjs +10 -3
  99. package/dist/model/connection/model/index.d.mts +12 -15
  100. package/dist/model/connection/model/index.mjs +8 -2
  101. package/dist/model/index.d.mts +15 -57
  102. package/dist/model/index.mjs +11 -4
  103. package/dist/styles/index.d.mts +9 -117
  104. package/dist/styles/index.mjs +26 -59
  105. package/dist/types/RichText.d.mts +3 -0
  106. package/dist/types/RichText.mjs +7 -0
  107. package/dist/types/_aux.d.mts +3 -4
  108. package/dist/types/_aux.mjs +2 -7
  109. package/dist/types/expression-model.d.mts +6 -190
  110. package/dist/types/expression-model.mjs +6 -108
  111. package/dist/types/expression.d.mts +5 -6
  112. package/dist/types/expression.mjs +6 -112
  113. package/dist/types/fqnRef.d.mts +4 -60
  114. package/dist/types/fqnRef.mjs +6 -44
  115. package/dist/types/index.d.mts +9 -47
  116. package/dist/types/index.mjs +14 -16
  117. package/dist/types/scalar.d.mts +2 -2
  118. package/dist/types/scalar.mjs +7 -4
  119. package/dist/utils/graphology/index.d.mts +2 -1864
  120. package/dist/utils/graphology/index.mjs +3 -1
  121. package/dist/utils/index.d.mts +11 -124
  122. package/dist/utils/index.mjs +16 -43
  123. package/dist/utils/iterable/index.d.mts +9 -132
  124. package/dist/utils/iterable/index.mjs +2 -61
  125. package/dist/utils/mnemonist.d.mts +2 -0
  126. package/dist/utils/mnemonist.mjs +12 -0
  127. package/package.json +18 -22
  128. package/compute-view/relationships/package.json +0 -4
  129. package/dist/shared/core.3ZhnKAlZ.mjs +0 -106
  130. package/dist/shared/core.78IWAHAE.mjs +0 -332
  131. package/dist/shared/core.B85MJLTf.mjs +0 -5
  132. package/dist/shared/core.BFd1lU9R.mjs +0 -29
  133. package/dist/shared/core.BKlholso.mjs +0 -3
  134. package/dist/shared/core.BPGOjone.d.mts +0 -46
  135. package/dist/shared/core.BYdtmqY5.mjs +0 -1255
  136. package/dist/shared/core.BZCgljZd.d.mts +0 -83
  137. package/dist/shared/core.BbE4y-yl.mjs +0 -177
  138. package/dist/shared/core.BhNcrwzK.mjs +0 -7
  139. package/dist/shared/core.BkVA6gjl.mjs +0 -5
  140. package/dist/shared/core.BoYfZOBm.mjs +0 -3
  141. package/dist/shared/core.BsSXS-_R.mjs +0 -7
  142. package/dist/shared/core.BspBF3SJ.mjs +0 -3944
  143. package/dist/shared/core.BvPm_-u3.d.mts +0 -334
  144. package/dist/shared/core.C-Jdx7xo.d.mts +0 -1263
  145. package/dist/shared/core.C3JowhaZ.mjs +0 -32
  146. package/dist/shared/core.C4x8aaWa.mjs +0 -27
  147. package/dist/shared/core.CBLX4mT8.mjs +0 -28411
  148. package/dist/shared/core.CLSZtnFh.mjs +0 -69
  149. package/dist/shared/core.CRhT4Iio.mjs +0 -785
  150. package/dist/shared/core.CbT8JVYL.mjs +0 -5
  151. package/dist/shared/core.CdNCAwq7.mjs +0 -176
  152. package/dist/shared/core.ClTP6-TN.d.mts +0 -87
  153. package/dist/shared/core.CmGY9blO.mjs +0 -6717
  154. package/dist/shared/core.CmPXpJ8l.mjs +0 -21
  155. package/dist/shared/core.Coi_LOUZ.mjs +0 -7
  156. package/dist/shared/core.CqAJJpK_.mjs +0 -3
  157. package/dist/shared/core.Ctj2S3bD.d.mts +0 -466
  158. package/dist/shared/core.CywrQs86.d.mts +0 -31
  159. package/dist/shared/core.D00YbOhQ.d.mts +0 -300
  160. package/dist/shared/core.D0WZutNd.mjs +0 -94
  161. package/dist/shared/core.D4npX2q8.mjs +0 -18
  162. package/dist/shared/core.DB0Ue5Wx.d.mts +0 -70
  163. package/dist/shared/core.DEK-BO3_.mjs +0 -1206
  164. package/dist/shared/core.DH7TXqXf.mjs +0 -136
  165. package/dist/shared/core.DRJma0Ol.mjs +0 -22
  166. package/dist/shared/core.DSalPD6v.mjs +0 -1352
  167. package/dist/shared/core.DVfPJPJj.mjs +0 -2200
  168. package/dist/shared/core.DXhDWKFZ.d.mts +0 -3
  169. package/dist/shared/core.DbfO90vF.mjs +0 -434
  170. package/dist/shared/core.DcS-0zys.mjs +0 -10
  171. package/dist/shared/core.DeDCYTDR.d.mts +0 -98
  172. package/dist/shared/core.DpKY_3NF.d.mts +0 -504
  173. package/dist/shared/core.Dt0v3djy.d.mts +0 -41
  174. package/dist/shared/core.FZ305VYd.mjs +0 -21
  175. package/dist/shared/core.RfnaEmgA.mjs +0 -7
  176. package/dist/shared/core.oSV6SRfk.mjs +0 -13
  177. package/dist/shared/core.om36dXXW.mjs +0 -41
  178. package/dist/shared/core.q10OP9oJ.mjs +0 -5
  179. package/dist/shared/core.uFk_o9X6.mjs +0 -13
  180. package/dist/shared/core.xeuDd__E.mjs +0 -300
  181. package/dist/shared/core.xgoPk2RG.mjs +0 -4989
@@ -0,0 +1,937 @@
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;
55
+ }
56
+ declare function isViewRuleAutoLayout(rule: object): rule is ViewRuleAutoLayout;
57
+ interface ViewAutoLayout {
58
+ direction: ViewRuleAutoLayout['direction'];
59
+ rankSep?: number;
60
+ nodeSep?: number;
61
+ }
62
+ /**
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.
65
+ *
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
311
+ */
312
+ type ModelRelation<A extends Any = Any> = Relationship<A>;
313
+ //#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;
332
+ }
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>;
337
+ };
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;
389
+ };
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
+ //#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;
453
+ }
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;
490
+ /**
491
+ * If this node was customized in the view
492
+ */
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;
513
+ /**
514
+ * If this edge is derived from custom relationship predicate
515
+ */
516
+ isCustomized?: boolean;
517
+ /**
518
+ * Path to the AST node relative to the view body ast
519
+ * Available only in dynamic views
520
+ * @internal
521
+ */
522
+ astPath?: string;
523
+ /**
524
+ * For layouting purposes
525
+ * @default 'forward'
526
+ */
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>>;
538
+ /**
539
+ * If the view has manual layout (v2)
540
+ */
541
+ readonly hasManualLayout?: boolean;
542
+ /**
543
+ * Manual layout data (v1), for compatibility during migration
544
+ * @deprecated
545
+ */
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';
559
+ /**
560
+ * How to display the dynamic view
561
+ * - `diagram`: display as a regular likec4 view
562
+ * - `sequence`: display as a sequence diagram
563
+ */
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 {
596
+ /**
597
+ * Absolute X coordinate
598
+ */
599
+ x: number;
600
+ /**
601
+ * Absolute Y coordinate
602
+ */
603
+ y: number;
604
+ width: number;
605
+ height: number;
606
+ /**
607
+ * Bounding box of label
608
+ * (Absolute coordinates)
609
+ */
610
+ labelBBox: BBox;
611
+ /**
612
+ * List of reasons causing node drift
613
+ */
614
+ drifts?: NonEmptyReadonlyArray<DiagramNodeDriftReason> | null;
615
+ }
616
+ interface DiagramEdge<A extends Any = Any> extends ComputedEdge<A> {
617
+ /**
618
+ * Bezier points
619
+ * (Absolute coordinates)
620
+ */
621
+ points: NonEmptyArray<Point>;
622
+ /**
623
+ * Control points to adjust the edge
624
+ * (Absolute coordinates)
625
+ */
626
+ controlPoints?: NonEmptyArray<XYPoint> | null;
627
+ /**
628
+ * Bounding box of label
629
+ * (Absolute coordinates)
630
+ */
631
+ labelBBox?: BBox | null;
632
+ /**
633
+ * List of reasons causing edge drift
634
+ */
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';
645
+ /**
646
+ * If undefined, view does not have any manual layouts, and is auto-layouted
647
+ */
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
+ }
934
+ }
935
+ type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveViewSnapshot | ViewChange.ResetManualLayout | ViewChange.ChangeAutoLayout;
936
+ //#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 };