@likec4/core 1.47.0 → 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 -775
  86. package/dist/builder/index.mjs +631 -1022
  87. package/dist/compute-view/index.d.mts +85 -56
  88. package/dist/compute-view/index.mjs +247 -214
  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 +17 -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.BNN-3vPH.mjs +0 -1255
  135. package/dist/shared/core.BPGOjone.d.mts +0 -46
  136. package/dist/shared/core.BP_QHEXs.mjs +0 -785
  137. package/dist/shared/core.BbE4y-yl.mjs +0 -177
  138. package/dist/shared/core.Bdy3hhTc.mjs +0 -28382
  139. package/dist/shared/core.BfCKSW-g.d.mts +0 -1266
  140. package/dist/shared/core.BhNcrwzK.mjs +0 -7
  141. package/dist/shared/core.BkVA6gjl.mjs +0 -5
  142. package/dist/shared/core.BoYfZOBm.mjs +0 -3
  143. package/dist/shared/core.BsSXS-_R.mjs +0 -7
  144. package/dist/shared/core.C3JowhaZ.mjs +0 -32
  145. package/dist/shared/core.C4x8aaWa.mjs +0 -27
  146. package/dist/shared/core.CAgYpDtM.d.mts +0 -98
  147. package/dist/shared/core.CHf8VEa3.mjs +0 -1206
  148. package/dist/shared/core.CLSZtnFh.mjs +0 -69
  149. package/dist/shared/core.CbT8JVYL.mjs +0 -5
  150. package/dist/shared/core.CdNCAwq7.mjs +0 -176
  151. package/dist/shared/core.CmGY9blO.mjs +0 -6717
  152. package/dist/shared/core.CmPXpJ8l.mjs +0 -21
  153. package/dist/shared/core.Coi_LOUZ.mjs +0 -7
  154. package/dist/shared/core.CqAJJpK_.mjs +0 -3
  155. package/dist/shared/core.CywrQs86.d.mts +0 -31
  156. package/dist/shared/core.D00YbOhQ.d.mts +0 -300
  157. package/dist/shared/core.D0WZutNd.mjs +0 -94
  158. package/dist/shared/core.D4npX2q8.mjs +0 -18
  159. package/dist/shared/core.DB0Ue5Wx.d.mts +0 -70
  160. package/dist/shared/core.DC5IAaDT.d.mts +0 -334
  161. package/dist/shared/core.DE9qzhn8.d.mts +0 -83
  162. package/dist/shared/core.DGcIbsj4.mjs +0 -3946
  163. package/dist/shared/core.DH7TXqXf.mjs +0 -136
  164. package/dist/shared/core.DKhRkHRN.d.mts +0 -41
  165. package/dist/shared/core.DRJma0Ol.mjs +0 -22
  166. package/dist/shared/core.DU5SRqNF.mjs +0 -2209
  167. package/dist/shared/core.DXhDWKFZ.d.mts +0 -3
  168. package/dist/shared/core.DbfO90vF.mjs +0 -434
  169. package/dist/shared/core.DcS-0zys.mjs +0 -10
  170. package/dist/shared/core.Dh119QSP.mjs +0 -4995
  171. package/dist/shared/core.DjcWextK.mjs +0 -1371
  172. package/dist/shared/core.Dojz4bvg.d.mts +0 -504
  173. package/dist/shared/core.FZ305VYd.mjs +0 -21
  174. package/dist/shared/core.RfnaEmgA.mjs +0 -7
  175. package/dist/shared/core.btEq3i3f.mjs +0 -300
  176. package/dist/shared/core.oSV6SRfk.mjs +0 -13
  177. package/dist/shared/core.om36dXXW.mjs +0 -41
  178. package/dist/shared/core.osFs8tU7.d.mts +0 -466
  179. package/dist/shared/core.q10OP9oJ.mjs +0 -5
  180. package/dist/shared/core.tpvDGvdC.d.mts +0 -87
  181. package/dist/shared/core.uFk_o9X6.mjs +0 -13
@@ -0,0 +1,146 @@
1
+ import { Ct as NTuple } from "./_aux.mjs";
2
+ import { S as Tag } from "./scalar.mjs";
3
+ import { B as ShapeSize, C as BorderStyle, F as LikeC4Theme, G as ThemeColorValues, H as SpacingSize, M as IconSize, N as LikeC4StyleDefaults, O as ElementColorValues, P as LikeC4StylesConfig, R as RelationshipColorValues, T as ColorLiteral, U as TextSize, W as ThemeColor, j as IconPosition, w as Color } from "./expression.mjs";
4
+ import { Z as ComputedNodeStyle, ct as TagSpecification, nt as LikeC4ProjectStylesConfig } from "./index2.mjs";
5
+ import { LiteralUnion } from "type-fest";
6
+
7
+ //#region src/styles/LikeC4Styles.d.ts
8
+ /**
9
+ * Styles of a LikeC4 project
10
+ *
11
+ * Accepts an array of LikeC4ProjectStylesConfig objects as a parameter
12
+ * and constructs a LikeC4Styles merged with the default styles.
13
+ *
14
+ * The class provides methods to get the default element colors, relationship
15
+ * colors, group colors, font size in pixels, padding in pixels, and to compute
16
+ * the ThemeColorValues from a given color.
17
+ */
18
+ declare class LikeC4Styles {
19
+ protected config: LikeC4StylesConfig;
20
+ readonly theme: LikeC4Theme;
21
+ readonly defaults: LikeC4StyleDefaults;
22
+ static readonly DEFAULT: LikeC4Styles;
23
+ static from(...configs: Array<LikeC4ProjectStylesConfig | undefined | null>): LikeC4Styles;
24
+ private constructor();
25
+ /**
26
+ * Default element colors
27
+ */
28
+ get elementColors(): ElementColorValues;
29
+ /**
30
+ * Default relationship colors
31
+ */
32
+ get relationshipColors(): RelationshipColorValues;
33
+ /**
34
+ * Default group colors
35
+ */
36
+ get groupColors(): ElementColorValues;
37
+ isDefaultColor(color: LiteralUnion<ThemeColor, string>): color is ThemeColor;
38
+ /**
39
+ * Get color values
40
+ *
41
+ * @param color - The color to use
42
+ * @default color From the defaults
43
+ */
44
+ colors(color?: LiteralUnion<ThemeColor, string>): ThemeColorValues;
45
+ private compoundColorsCache;
46
+ /**
47
+ * Get colors for compound nodes
48
+ *
49
+ * @param baseElementColors - The base element colors to compute from
50
+ */
51
+ colorsForCompounds<Depth extends number = 6>(baseElementColors: ElementColorValues, depth?: Depth): NTuple<ElementColorValues, Depth>;
52
+ /**
53
+ * Get font size in pixels
54
+ *
55
+ * @param textSize - The text size to use
56
+ * @default textSize From the defaults
57
+ */
58
+ fontSize(textSize?: TextSize): number;
59
+ /**
60
+ * Get padding in pixels
61
+ *
62
+ * @param paddingSize - The padding size to use
63
+ * @default paddingSize From the defaults
64
+ */
65
+ padding(paddingSize?: SpacingSize): number;
66
+ /**
67
+ * Get icon size in pixels
68
+ *
69
+ * @param iconSize - The icon size to use
70
+ * @default iconSize From the defaults
71
+ */
72
+ iconSize(iconSize?: IconSize): number;
73
+ isThemeColor(color: string): color is ThemeColor;
74
+ /**
75
+ * Calculate sizes and values based on the node styles
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const { sizes, values } = styles.nodeSizes(node.style)
80
+ *
81
+ * // sizes
82
+ * sizes.size // enum Size
83
+ * sizes.padding // enum SpacingSize
84
+ * sizes.textSize // enum TextSize
85
+ * sizes.iconSize // enum ShapeSize
86
+ *
87
+ * // values
88
+ * values.sizes // { width: number, height: number }
89
+ * values.padding // number
90
+ * values.textSize // number
91
+ * values.iconSize // number
92
+ * ```
93
+ */
94
+ nodeSizes(nodestyles: ComputedNodeStyle): {
95
+ sizes: Omit<{
96
+ icon?: never;
97
+ readonly iconColor?: Color;
98
+ readonly iconSize?: IconSize;
99
+ readonly iconPosition?: IconPosition;
100
+ shape?: never;
101
+ color?: never;
102
+ readonly border?: BorderStyle;
103
+ readonly opacity?: number;
104
+ readonly multiple?: boolean;
105
+ readonly size?: ShapeSize;
106
+ readonly padding?: SpacingSize;
107
+ readonly textSize?: TextSize;
108
+ }, "iconSize" | "size" | "padding" | "textSize"> & Required<{
109
+ readonly iconSize?: IconSize;
110
+ readonly size?: ShapeSize;
111
+ readonly padding?: SpacingSize;
112
+ readonly textSize?: TextSize;
113
+ }>;
114
+ values: {
115
+ sizes: {
116
+ readonly width: number;
117
+ readonly height: number;
118
+ };
119
+ padding: number;
120
+ textSize: number;
121
+ iconSize: number;
122
+ };
123
+ };
124
+ /**
125
+ * Compute ThemeColorValues from a given color
126
+ * @param color - HEX, RGB, RGBA, etc.
127
+ */
128
+ computeFrom(color: string): ThemeColorValues;
129
+ equals(other: LikeC4Styles): boolean;
130
+ }
131
+ //#endregion
132
+ //#region src/styles/assignTagColors.d.ts
133
+ declare function assignTagColors(tags: {
134
+ [kind: string]: Partial<TagSpecification>;
135
+ }): Record<Tag, TagSpecification>;
136
+ //#endregion
137
+ //#region src/styles/compute-color-values.d.ts
138
+ declare function computeColorValues(color: ColorLiteral): ThemeColorValues;
139
+ //#endregion
140
+ //#region src/styles/defaults.d.ts
141
+ declare const styleDefaults: LikeC4StyleDefaults;
142
+ //#endregion
143
+ //#region src/styles/theme.d.ts
144
+ declare const defaultTheme: LikeC4Theme;
145
+ //#endregion
146
+ export { LikeC4Styles as a, assignTagColors as i, styleDefaults as n, computeColorValues as r, defaultTheme as t };
@@ -0,0 +1,62 @@
1
+ import { Dt as ReorderedArray, yt as IterableContainer } from "./_aux.mjs";
2
+ import { n as Connection } from "./const.mjs";
3
+
4
+ //#region src/model/connection/ops.d.ts
5
+ /**
6
+ * Check if connection is nested inside another connection
7
+ * (i.e. between descendants)
8
+ */
9
+ declare function isNestedConnection<T extends {
10
+ id: string;
11
+ }>(parent: WithSourceTarget<NoInfer<T>>): (nested: WithSourceTarget<T>) => boolean;
12
+ declare function isNestedConnection<T extends {
13
+ id: string;
14
+ }>(nested: WithSourceTarget<T>, parent: WithSourceTarget<T>): boolean;
15
+ type ConnectionElemId = Connection<{
16
+ readonly id: string;
17
+ }, any>;
18
+ declare function findDeepestNestedConnection<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): C | null;
19
+ declare function sortDeepestFirst<C extends ConnectionElemId>(connections: ReadonlyArray<C>): C[];
20
+ type WithBoundary = {
21
+ id: string;
22
+ boundary: null | {
23
+ id: string;
24
+ };
25
+ };
26
+ declare function sortConnectionsByBoundaryHierarchy(sort?: 'asc' | 'desc'): <T extends WithBoundary, A extends IterableContainer<T>>(array: A) => ReorderedArray<A>;
27
+ declare function sortConnectionsByBoundaryHierarchy<T extends WithBoundary, A extends IterableContainer<T>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
28
+ /**
29
+ * Find connections that includes given connection (i.e between it's ancestors)
30
+ */
31
+ declare function findAscendingConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
32
+ /**
33
+ * Find connections that given connection includes (i.e between it's descendants)
34
+ */
35
+ declare function findDescendantConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
36
+ declare function mergeConnections<C extends IterableContainer<Connection<any, any>>>(connections: C): Array<C[number]>;
37
+ /**
38
+ * Excludes the values existing in `other` array.
39
+ * The output maintains the same order as the input.
40
+ */
41
+ declare function differenceConnections<C extends Connection<any, any>>(source: Iterable<C>, exclude: Iterable<C>): C[];
42
+ type WithSourceTarget<T = unknown> = {
43
+ source: T;
44
+ target: T;
45
+ };
46
+ declare function hasSameSourceTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
47
+ declare function hasSameSourceTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
48
+ declare function hasSameSource<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
49
+ declare function hasSameSource<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
50
+ declare function hasSameTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
51
+ declare function hasSameTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
52
+ type WithId<T> = {
53
+ id: T;
54
+ };
55
+ declare function isOutgoing<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
56
+ declare function isOutgoing<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
57
+ declare function isIncoming<T extends string>(target: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
58
+ declare function isIncoming<T extends string>(a: WithSourceTarget<WithId<T>>, target: WithId<T>): boolean;
59
+ declare function isAnyInOut<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
60
+ declare function isAnyInOut<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
61
+ //#endregion
62
+ export { hasSameSource as a, isAnyInOut as c, isOutgoing as d, mergeConnections as f, findDescendantConnections as i, isIncoming as l, sortDeepestFirst as m, findAscendingConnections as n, hasSameSourceTarget as o, sortConnectionsByBoundaryHierarchy as p, findDeepestNestedConnection as r, hasSameTarget as s, differenceConnections as t, isNestedConnection as u };
@@ -0,0 +1,42 @@
1
+ import { n as Any } from "./_aux.mjs";
2
+ import { C as ElementModel, S as NodeModel, T as RelationshipModel, a as DeploymentNodeModel, c as NestedElementOfDeployedInstanceModel, i as DeploymentElementModel, r as DeployedInstanceModel, s as DeploymentRelationModel, w as AnyRelationshipModel, x as EdgeModel, y as LikeC4ViewModel } from "./LikeC4Model.mjs";
3
+
4
+ //#region src/model/guards.d.ts
5
+ type AnyModel<A extends Any> = DeploymentNodeModel<A> | DeployedInstanceModel<A> | DeploymentRelationModel<A> | AnyRelationshipModel<A> | NestedElementOfDeployedInstanceModel<A> | ElementModel<A> | RelationshipModel<A> | LikeC4ViewModel<A> | NodeModel<A> | EdgeModel<A>;
6
+ declare function isDeploymentNodeModel<M extends Any>(model: AnyModel<M>): model is DeploymentNodeModel<M>;
7
+ declare function isDeployedInstanceModel<M extends Any>(model: AnyModel<M>): model is DeployedInstanceModel<M>;
8
+ declare function isDeploymentElementModel<M extends Any>(model: AnyModel<M>): model is DeploymentElementModel<M>;
9
+ declare function isNestedElementOfDeployedInstanceModel<M extends Any>(model: AnyModel<M>): model is NestedElementOfDeployedInstanceModel<M>;
10
+ declare function isDeploymentRelationModel<M extends Any>(x: AnyModel<M>): x is DeploymentRelationModel<M>;
11
+ declare function isRelationModel<M extends Any>(x: AnyModel<M>): x is RelationshipModel<M>;
12
+ declare function isElementModel<M extends Any>(element: AnyModel<M>): element is ElementModel<M>;
13
+ declare function isLikeC4ViewModel<M extends Any>(view: AnyModel<M>): view is LikeC4ViewModel<M>;
14
+ declare function isNodeModel<M extends Any>(node: AnyModel<M>): node is NodeModel<M>;
15
+ declare function isEdgeModel<M extends Any>(edge: AnyModel<M>): edge is EdgeModel<M>;
16
+ //#endregion
17
+ //#region src/model/utils/view-title-path.d.ts
18
+ declare const VIEW_FOLDERS_SEPARATOR = "/";
19
+ /**
20
+ * Normalizes view path by removing spaces from segments, removing empty segments,
21
+ * and removing leading/trailing slashes
22
+ * @example
23
+ * normalizeViewPath('One / Tw o / Thre e') === 'One/Tw o/Thre e'
24
+ */
25
+ declare const normalizeViewPath: (title: string) => string;
26
+ /**
27
+ * Returns view group path if it is used as a path
28
+ * Returns empty string if it is not a path
29
+ * @example
30
+ * getViewFolderPath('One / Tw o / Thre e') === 'One/Tw o'
31
+ * getViewFolderPath('One') === ''
32
+ */
33
+ declare const getViewFolderPath: (title: string) => string | null;
34
+ /**
35
+ * Returns view title if it is used as a path
36
+ * @example
37
+ * getViewTitleFromPath('One / Tw o / Thre e') === 'Thre e'
38
+ * getViewTitleFromPath('One') === 'One'
39
+ */
40
+ declare const extractViewTitleFromPath: (title: string) => string;
41
+ //#endregion
42
+ export { isDeployedInstanceModel as a, isDeploymentRelationModel as c, isLikeC4ViewModel as d, isNestedElementOfDeployedInstanceModel as f, normalizeViewPath as i, isEdgeModel as l, isRelationModel as m, extractViewTitleFromPath as n, isDeploymentElementModel as o, isNodeModel as p, getViewFolderPath as r, isDeploymentNodeModel as s, VIEW_FOLDERS_SEPARATOR as t, isElementModel as u };
@@ -0,0 +1,43 @@
1
+ import { G as Unknown, Y as ViewId, n as Any, p as ElementId } from "./_aux.mjs";
2
+ import { C as ElementModel, T as RelationshipModel, n as LikeC4Model } from "./LikeC4Model.mjs";
3
+
4
+ //#region src/compute-view/relationships-view/_types.d.ts
5
+ type RelationshipsViewData<M extends Any = Unknown> = {
6
+ incomers: ReadonlySet<ElementModel<M>>;
7
+ incoming: ReadonlySet<RelationshipModel<M>>;
8
+ subjects: ReadonlySet<ElementModel<M>>;
9
+ outgoing: ReadonlySet<RelationshipModel<M>>;
10
+ outgoers: ReadonlySet<ElementModel<M>>;
11
+ };
12
+ //#endregion
13
+ //#region src/compute-view/relationships-view/compute.d.ts
14
+ declare function computeRelationshipsView<M extends Any>(subjectId: ElementId<M>, likec4model: LikeC4Model<M>, scopeViewId: ViewId<M> | null, scope?: 'global' | 'view'): RelationshipsViewData<M>;
15
+ //#endregion
16
+ //#region src/compute-view/relationships-view/utils.d.ts
17
+ declare function treeFromElements<M extends Any>(elements: Iterable<ElementModel<M>>): {
18
+ sorted: readonly ElementModel<M>[];
19
+ byId: (id: ElementId<M>) => ElementModel<M>;
20
+ root: ReadonlySet<ElementModel<M>>;
21
+ parent: (el: ElementModel<M>) => ElementModel<M> | null;
22
+ children: (el: ElementModel<M>) => ReadonlyArray<ElementModel<M>>;
23
+ /**
24
+ * Flattens the tree structure by removing redundant hierarchy levels.
25
+ * @example
26
+ * A
27
+ * └── B
28
+ * ├── C
29
+ * │ └── D
30
+ * │ └── E
31
+ * └── F
32
+ * └── G
33
+ * becomes
34
+ * A
35
+ * ├── C
36
+ * │ └── E
37
+ * └── F
38
+ * └── G
39
+ */
40
+ flatten: () => Set<ElementModel<M>>;
41
+ };
42
+ //#endregion
43
+ export { computeRelationshipsView as n, RelationshipsViewData as r, treeFromElements as t };
@@ -1,193 +1,42 @@
1
- import { I as IterableContainer, R as ReorderedArray, N as NonEmptyArray } from './core.DB0Ue5Wx.mjs';
2
- import { F as Fqn } from './core.C_3y3eqV.mjs';
3
- import { SetRequired, SetNonNullable } from 'type-fest';
1
+ import { Dt as ReorderedArray, wt as NonEmptyArray, yt as IterableContainer } from "./_aux.mjs";
2
+ import { s as Fqn } from "./scalar.mjs";
3
+ import { SetNonNullable, SetRequired } from "type-fest";
4
4
 
5
+ //#region src/utils/invariant.d.ts
6
+ declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
7
+ declare function invariant(condition: any, message?: string): asserts condition;
8
+ declare function nonexhaustive(value: never): never;
9
+ //#endregion
10
+ //#region src/utils/common-head.d.ts
5
11
  /**
6
- * Mnemonist DefaultWeakMap Typings
7
- * ================================
8
- */
9
- declare class DefaultWeakMap<K extends object, V> {
10
-
11
- // Constructor
12
- constructor(factory: (key: K) => V);
13
-
14
- // Methods
15
- clear(): void;
16
- set(key: K, value: V): this;
17
- delete(key: K): boolean;
18
- has(key: K): boolean;
19
- get(key: K): V;
20
- peek(key: K): V | undefined;
21
- inspect(): any;
22
- }
23
-
24
- /**
25
- * Mnemonist LinkedList Typings
26
- * =============================
27
- */
28
- declare class LinkedList<T> implements Iterable<T> {
29
-
30
- // Members
31
- size: number;
32
-
33
- // Constructor
34
- constructor();
35
-
36
- // Methods
37
- clear(): void;
38
- first(): T | undefined;
39
- last(): T | undefined;
40
- peek(): T | undefined;
41
- push(value: T): number;
42
- shift(): T | undefined;
43
- unshift(value: T): number;
44
- forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
45
- toArray(): Array<T>;
46
- values(): IterableIterator<T>;
47
- entries(): IterableIterator<[number, T]>;
48
- [Symbol.iterator](): IterableIterator<T>;
49
- toString(): string;
50
- toJSON(): Array<T>;
51
- inspect(): any;
52
-
53
- // Statics
54
- static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
55
- }
56
-
57
- /**
58
- * Mnemonist Queue Typings
59
- * ========================
60
- */
61
- declare class Queue<T> implements Iterable<T> {
62
-
63
- // Members
64
- size: number;
65
-
66
- // Constructor
67
- constructor();
68
-
69
- // Methods
70
- clear(): void;
71
- enqueue(item: T): number;
72
- dequeue(): T | undefined;
73
- peek(): T | undefined;
74
- forEach(callback: (item: T, index: number, queue: this) => void, scope?: any): void;
75
- toArray(): Array<T>;
76
- values(): IterableIterator<T>;
77
- entries(): IterableIterator<[number, T]>;
78
- [Symbol.iterator](): IterableIterator<T>;
79
- toString(): string;
80
- toJSON(): Array<T>;
81
- inspect(): any;
82
-
83
- // Statics
84
- static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>;
85
- static of<I>(...items: Array<I>): Queue<I>;
86
- }
87
-
88
- interface MultiMapConstructor {
89
- new <K, V>(container: SetConstructor): MultiMap<K, V, Set<V>>;
90
- new <K, V>(container?: ArrayConstructor): MultiMap<K, V, V[]>;
91
-
92
- from<K, V>(
93
- iterable: Iterable<[K, V]> | {[key: string]: V},
94
- Container: SetConstructor
95
- ): MultiMap<K, V, Set<V>>;
96
- from<K, V>(
97
- iterable: Iterable<[K, V]> | {[key: string]: V},
98
- Container?: ArrayConstructor
99
- ): MultiMap<K, V, V[]>;
100
- }
101
- /**
102
- * Mnemonist MultiMap Typings
103
- * ===========================
12
+ * Common head of two arrays
13
+ *
14
+ * @param equals - Equality function, defaults to `Object.is`
104
15
  */
105
-
106
- interface MultiMap<K, V, C extends V[] | Set<V> = V[]> extends Iterable<[K, V]> {
107
-
108
- // Members
109
- dimension: number;
110
- size: number;
111
-
112
- // Methods
113
- clear(): void;
114
- set(key: K, value: V): this;
115
- delete(key: K): boolean;
116
- remove(key: K, value: V): boolean;
117
- has(key: K): boolean;
118
- get(key: K): C | undefined;
119
- multiplicity(key: K): number;
120
- forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
121
- forEachAssociation(callback: (value: C, key: K, map: this) => void, scope?: any): void;
122
- keys(): IterableIterator<K>;
123
- values(): IterableIterator<V>;
124
- entries(): IterableIterator<[K, V]>;
125
- containers(): IterableIterator<C>;
126
- associations(): IterableIterator<[K, C]>;
127
- [Symbol.iterator](): IterableIterator<[K, V]>;
128
- inspect(): any;
129
- toJSON(): any;
130
- }
131
-
132
- declare const MultiMap: MultiMapConstructor;
133
-
16
+ declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
17
+ //#endregion
18
+ //#region src/utils/compare-natural.d.ts
19
+ declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
134
20
  /**
135
- * Mnemonist BiMap Typings
136
- * ========================
21
+ * Compares two strings lexicographically first, then hierarchically based on their depth.\
22
+ * From parent nodes to leaves
23
+ *
24
+ * @example
25
+ * const lines = [
26
+ * 'b.c',
27
+ * 'b',
28
+ * 'a.b.c',
29
+ * ]
30
+ * lines.sort(compareNaturalHierarchically('.'))
31
+ * // [
32
+ * // 'a.b.c',
33
+ * // 'b',
34
+ * // 'b.c',
35
+ * // ]
137
36
  */
138
- declare class InverseMap<K, V> implements Iterable<[K, V]> {
139
-
140
- // Members
141
- size: number;
142
- inverse: BiMap<V, K>;
143
-
144
- // Constructor
145
- constructor(original: BiMap<K, V>);
146
-
147
- // Methods
148
- clear(): void;
149
- set(key: K, value: V): this;
150
- delete(key: K): boolean;
151
- has(key: K): boolean;
152
- get(key: K): V | undefined;
153
- forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
154
- keys(): IterableIterator<K>;
155
- values(): IterableIterator<V>;
156
- entries(): IterableIterator<[K, V]>;
157
- [Symbol.iterator](): IterableIterator<[K, V]>;
158
- inspect(): any;
159
- }
160
-
161
- declare class BiMap<K, V> implements Iterable<[K, V]> {
162
-
163
- // Members
164
- size: number;
165
- inverse: InverseMap<V, K>;
166
-
167
- // Constructor
168
- constructor();
169
-
170
- // Methods
171
- clear(): void;
172
- set(key: K, value: V): this;
173
- delete(key: K): boolean;
174
- has(key: K): boolean;
175
- get(key: K): V | undefined;
176
- forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
177
- keys(): IterableIterator<K>;
178
- values(): IterableIterator<V>;
179
- entries(): IterableIterator<[K, V]>;
180
- [Symbol.iterator](): IterableIterator<[K, V]>;
181
- inspect(): any;
182
-
183
- // Statics
184
- static from<I, J>(iterable: Iterable<[I, J]> | {[key: string]: J}): BiMap<I, J>;
185
- }
186
-
187
- declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
188
- declare function invariant(condition: any, message?: string): asserts condition;
189
- declare function nonexhaustive(value: never): never;
190
-
37
+ declare function compareNaturalHierarchically(separator?: string, deepestFirst?: boolean): (a: string | undefined, b: string | undefined) => number;
38
+ //#endregion
39
+ //#region src/utils/fqn.d.ts
191
40
  declare function parentFqn<E extends string>(fqn: E): E | null;
192
41
  declare function nameFromFqn<E extends string>(fqn: E): string;
193
42
  /**
@@ -197,7 +46,7 @@ declare function nameFromFqn<E extends string>(fqn: E): string;
197
46
  * isAncestor(another)(ancestor)
198
47
  */
199
48
  declare function isAncestor<A extends string | {
200
- id: string;
49
+ id: string;
201
50
  }>(another: NoInfer<A>): (ancestor: A) => boolean;
202
51
  /**
203
52
  * Check if one element is an ancestor of another
@@ -205,12 +54,12 @@ declare function isAncestor<A extends string | {
205
54
  * isAncestor(ancestor, another)
206
55
  */
207
56
  declare function isAncestor<A extends string | {
208
- id: string;
57
+ id: string;
209
58
  }>(ancestor: A, another: A): boolean;
210
59
  declare function isSameHierarchy<T extends string>(one: NoInfer<T> | WithId<NoInfer<T>>): (another: T | WithId<T>) => boolean;
211
60
  declare function isSameHierarchy<T extends string>(one: T | WithId<T>, another: T | WithId<T>): boolean;
212
61
  type WithId<T = string> = {
213
- id: T;
62
+ id: T;
214
63
  };
215
64
  declare function isDescendantOf<T extends string>(ancestor: WithId<T>): (descedant: WithId<T>) => boolean;
216
65
  declare function isDescendantOf<T extends string>(descedant: WithId<T>, ancestor: WithId<T>): boolean;
@@ -219,7 +68,7 @@ declare function isDescendantOf<T extends string>(descedant: WithId<T>, ancestor
219
68
  * Root element has depth 1
220
69
  */
221
70
  declare function hierarchyLevel<E extends string | {
222
- id: Fqn;
71
+ id: Fqn;
223
72
  }>(elementOfFqn: E): number;
224
73
  /**
225
74
  * Calculate the distance as number of steps from one element to another, i.e.
@@ -229,7 +78,7 @@ declare function hierarchyLevel<E extends string | {
229
78
  * Can be used for hierarchical clustering
230
79
  */
231
80
  declare function hierarchyDistance<E extends string | {
232
- id: Fqn;
81
+ id: Fqn;
233
82
  }>(one: E, another: E): number;
234
83
  declare function commonAncestor<E extends string>(first: E, second: E): E | null;
235
84
  /**
@@ -249,7 +98,7 @@ declare function ancestorsFqn<Id extends string>(fqn: Id): Id[];
249
98
  */
250
99
  declare function compareFqnHierarchically<T extends string = string>(a: T, b: T): -1 | 0 | 1;
251
100
  declare function compareByFqnHierarchically<T extends {
252
- id: string;
101
+ id: string;
253
102
  }>(a: T, b: T): -1 | 0 | 1;
254
103
  /**
255
104
  * Sorts an array of objects hierarchically based on their fully qualified names (FQN).
@@ -277,13 +126,13 @@ declare function compareByFqnHierarchically<T extends {
277
126
  * ```
278
127
  */
279
128
  declare function sortByFqnHierarchically<T extends {
280
- id: string;
129
+ id: string;
281
130
  }, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
282
131
  /**
283
132
  * Keeps initial order of the elements, but ensures that parents are before children
284
133
  */
285
134
  declare function sortParentsFirst<T extends {
286
- id: string;
135
+ id: string;
287
136
  }, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
288
137
  /**
289
138
  * Sorts an array of objects naturally by their fully qualified name (FQN) identifier.
@@ -303,7 +152,12 @@ declare function sortParentsFirst<T extends {
303
152
  */
304
153
  declare function sortNaturalByFqn(sort?: 'asc' | 'desc'): <I extends WithId<string>, A extends IterableContainer<I>>(array: A) => ReorderedArray<A>;
305
154
  declare function sortNaturalByFqn<A extends IterableContainer<WithId>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
306
-
155
+ //#endregion
156
+ //#region src/utils/getOrCreate.d.ts
157
+ declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
158
+ declare function getOrCreate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, create: (key: K) => V): V;
159
+ //#endregion
160
+ //#region src/utils/guards.d.ts
307
161
  declare function isString(value: unknown): value is string;
308
162
  declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
309
163
  declare function hasProp<T extends object, P extends keyof T & string>(value: T, path: P): value is SetRequired<SetNonNullable<T, P>, P>;
@@ -327,7 +181,8 @@ type Guarded<G> = G extends Guard<infer N> ? N : never;
327
181
  * ```
328
182
  */
329
183
  declare function isAnyOf<const Predicates extends NonEmptyArray<Guard>>(...predicates: Predicates): (value: unknown) => value is Guarded<Predicates[number]>;
330
-
184
+ //#endregion
185
+ //#region src/utils/memoize-prop.d.ts
331
186
  /**
332
187
  * Saves the value returned by fn() in a hidden property tag of obj object, so next time memoizeProp() is called,
333
188
  * that value will be returned, and fn won't be called.
@@ -348,5 +203,66 @@ declare function isAnyOf<const Predicates extends NonEmptyArray<Guard>>(...predi
348
203
  * ```
349
204
  */
350
205
  declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag: Tag, fn: () => Res): Res;
351
-
352
- export { BiMap as B, DefaultWeakMap as D, LinkedList as L, MultiMap as M, Queue as Q, ancestorsFqn as a, isAncestor as b, isDescendantOf as c, isNonEmptyArray as d, isSameHierarchy as e, isString as f, nonexhaustive as g, hasProp as h, invariant as i, nonNullable as j, sortParentsFirst as k, commonAncestor as l, memoizeProp as m, nameFromFqn as n, compareByFqnHierarchically as o, parentFqn as p, compareFqnHierarchically as q, hierarchyDistance as r, sortNaturalByFqn as s, hierarchyLevel as t, sortByFqnHierarchically as u, isAnyOf as v };
206
+ //#endregion
207
+ //#region src/utils/promises.d.ts
208
+ declare function delay(): Promise<string>;
209
+ declare function delay(ms: number): Promise<string>;
210
+ declare function delay(randomFrom: number, randomTo: number): Promise<string>;
211
+ declare function promiseNextTick(): Promise<void>;
212
+ declare function onNextTick(fn: () => Promise<void> | void): void;
213
+ //#endregion
214
+ //#region src/utils/relations.d.ts
215
+ type RelationshipLike = {
216
+ source: {
217
+ id: string;
218
+ };
219
+ target: {
220
+ id: string;
221
+ };
222
+ };
223
+ /**
224
+ * Compares two relations hierarchically.
225
+ * From the most general (implicit) to the most specific (deepest in the tree)
226
+ */
227
+ declare const compareRelations: <T extends RelationshipLike>(a: T, b: T) => number;
228
+ //#endregion
229
+ //#region src/utils/set.d.ts
230
+ /**
231
+ * Returns new set as a union of given sets
232
+ * Keeps order of elements
233
+ */
234
+ declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
235
+ /**
236
+ * Returns new set as an intersection of all sets
237
+ * Keeps order from the first set
238
+ */
239
+ declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
240
+ /**
241
+ * Returns new set as a difference of two sets (A-B)
242
+ * Keeps order from the first set
243
+ */
244
+ declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
245
+ declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
246
+ declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
247
+ //#endregion
248
+ //#region src/utils/object-hash.d.ts
249
+ declare function objectHash(value: any): string;
250
+ //#endregion
251
+ //#region src/utils/string-hash.d.ts
252
+ /**
253
+ * @see https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf
254
+ */
255
+ declare function stringHash(str: string): string;
256
+ //#endregion
257
+ //#region src/utils/markdown/to-html.d.ts
258
+ declare function markdownToHtml(markdown: string): string;
259
+ //#endregion
260
+ //#region src/utils/markdown/to-text.d.ts
261
+ /**
262
+ * Converts markdown to plain text, removing any markdown formatting.
263
+ * @param markdown - The markdown to convert.
264
+ * @returns The plain text.
265
+ */
266
+ declare function markdownToText(markdown: string): string;
267
+ //#endregion
268
+ export { parentFqn as A, compareFqnHierarchically as C, isDescendantOf as D, isAncestor as E, compareNaturalHierarchically as F, commonHead as I, invariant as L, sortNaturalByFqn as M, sortParentsFirst as N, isSameHierarchy as O, compareNatural as P, nonNullable as R, compareByFqnHierarchically as S, hierarchyLevel as T, isNonEmptyArray as _, difference as a, ancestorsFqn as b, symmetricDifference as c, delay as d, onNextTick as f, isAnyOf as g, hasProp as h, objectHash as i, sortByFqnHierarchically as j, nameFromFqn as k, union as l, memoizeProp as m, markdownToHtml as n, equals as o, promiseNextTick as p, stringHash as r, intersection as s, markdownToText as t, compareRelations as u, isString as v, hierarchyDistance as w, commonAncestor as x, getOrCreate as y, nonexhaustive as z };