@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,84 @@
1
+ import { f as MarkdownOrString } from "./scalar.mjs";
2
+
3
+ //#region src/types/RichText.d.ts
4
+ interface RichTextEmpty {
5
+ readonly isEmpty: true;
6
+ readonly isMarkdown: false;
7
+ readonly nonEmpty: false;
8
+ readonly $source: null;
9
+ readonly text: null;
10
+ readonly md: null;
11
+ readonly html: null;
12
+ equals(other: unknown): boolean;
13
+ }
14
+ interface RichTextNonEmpty {
15
+ readonly isEmpty: false;
16
+ readonly nonEmpty: true;
17
+ readonly isMarkdown: boolean;
18
+ readonly $source: MarkdownOrString;
19
+ readonly text: string;
20
+ readonly md: string;
21
+ readonly html: string;
22
+ equals(other: unknown): boolean;
23
+ }
24
+ type RichTextOrEmpty = RichTextNonEmpty | RichTextEmpty;
25
+ /**
26
+ * RichText is a class that represents a potentially markdown string.
27
+ * It can be either a plain text or a markdown.
28
+ * It is used to represent the content of a node or a link.
29
+ */
30
+ declare class RichText {
31
+ private static mdcache;
32
+ private static txtcache;
33
+ private static getOrCreateFromText;
34
+ private static getOrCreateFromMarkdown;
35
+ /**
36
+ * Creates and memoizes a RichText instance.
37
+ * @see ElementModel.description
38
+ * @example
39
+ *
40
+ * get description(): RichTextOrEmpty {
41
+ * return RichText.memoize(this, 'description', this.$element.description)
42
+ * }
43
+ */
44
+ static memoize(obj: object, tag: symbol | string, source: MarkdownOrString | null | undefined): RichTextOrEmpty;
45
+ /**
46
+ * Creates a RichText instance from a source.
47
+ */
48
+ static from(source: RichTextOrEmpty | MarkdownOrString | string | null | undefined): RichTextOrEmpty;
49
+ /**
50
+ * This is a workaround for the fact that we need instance of RichText for `instanceof` checks
51
+ * It is invalid inheritance (returning `null` from getters), and we cast to @see RichTextEmpty
52
+ */
53
+ static EMPTY: RichTextEmpty;
54
+ readonly $source: Readonly<MarkdownOrString> | null;
55
+ readonly isEmpty: boolean;
56
+ readonly nonEmpty: boolean;
57
+ readonly isMarkdown: boolean;
58
+ /**
59
+ * Private constructor to prevent direct instantiation.
60
+ * Use {@link RichText.from} or {@link RichText.memoize} instead.
61
+ */
62
+ private constructor();
63
+ /**
64
+ * Returns the text content of the rich text.
65
+ * If the source is a string, it returns the string.
66
+ * If the source is a markdown, it returns the markdown.
67
+ */
68
+ get text(): string;
69
+ /**
70
+ * Returns the markdown content of the rich text.
71
+ * If the source is a string, it returns the string.
72
+ * If the source is a markdown, it returns the markdown.
73
+ */
74
+ get md(): string;
75
+ /**
76
+ * Returns the html content of the rich text.
77
+ * If the source is a string, it returns the string.
78
+ * If the source is a markdown, it returns the HTML.
79
+ */
80
+ get html(): string;
81
+ equals(other: unknown): boolean;
82
+ }
83
+ //#endregion
84
+ export { RichTextOrEmpty as i, RichTextEmpty as n, RichTextNonEmpty as r, RichText as t };
@@ -0,0 +1,148 @@
1
+ import { h as memoizeProp, n as markdownToHtml, t as markdownToText } from "./utils.mjs";
2
+ import { r as nonexhaustive } from "./invariant.mjs";
3
+ import { a as import_lru_map } from "./libs/mnemonist.mjs";
4
+
5
+ //#region src/types/RichText.ts
6
+ const symb_text = Symbol.for("text");
7
+ const symb_html = Symbol.for("html");
8
+ const emptyTxt = "";
9
+ /**
10
+ * RichText is a class that represents a potentially markdown string.
11
+ * It can be either a plain text or a markdown.
12
+ * It is used to represent the content of a node or a link.
13
+ */
14
+ var RichText = class RichText {
15
+ static mdcache = new import_lru_map.default(500);
16
+ static txtcache = new import_lru_map.default(500);
17
+ static getOrCreateFromText(txt) {
18
+ txt = txt.trimEnd();
19
+ if (txt === emptyTxt) return RichText.EMPTY;
20
+ let cached = RichText.txtcache.get(txt);
21
+ if (cached) return cached;
22
+ cached = new RichText({ txt });
23
+ RichText.txtcache.set(txt, cached);
24
+ return cached;
25
+ }
26
+ static getOrCreateFromMarkdown(md) {
27
+ md = md.trimEnd();
28
+ if (md === emptyTxt) return RichText.EMPTY;
29
+ let cached = RichText.mdcache.get(md);
30
+ if (cached) return cached;
31
+ cached = new RichText({ md });
32
+ RichText.mdcache.set(md, cached);
33
+ return cached;
34
+ }
35
+ /**
36
+ * Creates and memoizes a RichText instance.
37
+ * @see ElementModel.description
38
+ * @example
39
+ *
40
+ * get description(): RichTextOrEmpty {
41
+ * return RichText.memoize(this, 'description', this.$element.description)
42
+ * }
43
+ */
44
+ static memoize(obj, tag, source) {
45
+ return memoizeProp(obj, tag, () => RichText.from(source));
46
+ }
47
+ /**
48
+ * Creates a RichText instance from a source.
49
+ */
50
+ static from(source) {
51
+ if (source === null || source === void 0 || source === RichText.EMPTY) return RichText.EMPTY;
52
+ if (source instanceof RichText) return source;
53
+ if (typeof source === "string") return this.getOrCreateFromText(source);
54
+ if ("isEmpty" in source && source.isEmpty) return RichText.EMPTY;
55
+ if ("md" in source) return this.getOrCreateFromMarkdown(source.md);
56
+ return this.getOrCreateFromText(source.txt);
57
+ }
58
+ /**
59
+ * This is a workaround for the fact that we need instance of RichText for `instanceof` checks
60
+ * It is invalid inheritance (returning `null` from getters), and we cast to @see RichTextEmpty
61
+ */
62
+ static EMPTY = new class extends RichText {
63
+ isEmpty = true;
64
+ nonEmpty = false;
65
+ isMarkdown = false;
66
+ $source = null;
67
+ constructor() {
68
+ super({ txt: emptyTxt });
69
+ }
70
+ get text() {
71
+ return null;
72
+ }
73
+ get md() {
74
+ return null;
75
+ }
76
+ get html() {
77
+ return null;
78
+ }
79
+ }();
80
+ $source;
81
+ isEmpty;
82
+ nonEmpty;
83
+ isMarkdown;
84
+ /**
85
+ * Private constructor to prevent direct instantiation.
86
+ * Use {@link RichText.from} or {@link RichText.memoize} instead.
87
+ */
88
+ constructor(source) {
89
+ this.isMarkdown = false;
90
+ if (typeof source === "string") {
91
+ this.$source = { txt: source };
92
+ this.isEmpty = source.trim() === emptyTxt;
93
+ } else {
94
+ this.$source = source;
95
+ this.isEmpty = true;
96
+ if ("md" in source) {
97
+ this.isEmpty = source.md === emptyTxt;
98
+ this.isMarkdown = true;
99
+ } else this.isEmpty = source.txt === emptyTxt;
100
+ }
101
+ this.nonEmpty = !this.isEmpty;
102
+ }
103
+ /**
104
+ * Returns the text content of the rich text.
105
+ * If the source is a string, it returns the string.
106
+ * If the source is a markdown, it returns the markdown.
107
+ */
108
+ get text() {
109
+ if (this.isEmpty || this.$source === null) return emptyTxt;
110
+ const source = this.$source;
111
+ if ("txt" in source) return source.txt;
112
+ return memoizeProp(this, symb_text, () => markdownToText(source.md));
113
+ }
114
+ /**
115
+ * Returns the markdown content of the rich text.
116
+ * If the source is a string, it returns the string.
117
+ * If the source is a markdown, it returns the markdown.
118
+ */
119
+ get md() {
120
+ if (this.isEmpty || this.$source === null) return emptyTxt;
121
+ const source = this.$source;
122
+ if ("md" in source) return source.md;
123
+ if ("txt" in source) return source.txt;
124
+ nonexhaustive(source);
125
+ }
126
+ /**
127
+ * Returns the html content of the rich text.
128
+ * If the source is a string, it returns the string.
129
+ * If the source is a markdown, it returns the HTML.
130
+ */
131
+ get html() {
132
+ if (this.isEmpty || this.$source === null) return emptyTxt;
133
+ const source = this.$source;
134
+ if ("txt" in source) return source.txt;
135
+ return memoizeProp(this, symb_html, () => markdownToHtml(source.md));
136
+ }
137
+ equals(other) {
138
+ if (this === other) return true;
139
+ if (!(other instanceof RichText)) return false;
140
+ if (this.isEmpty && other.isEmpty) return true;
141
+ if (this.isEmpty !== other.isEmpty || this.isMarkdown !== other.isMarkdown) return false;
142
+ if (this.isMarkdown) return this.$source?.md === other.$source?.md;
143
+ return this.$source?.txt === other.$source?.txt;
144
+ }
145
+ };
146
+
147
+ //#endregion
148
+ export { RichText as t };
@@ -0,0 +1,289 @@
1
+ import { C as ViewId$1, S as Tag$1, a as EdgeId$1, f as MarkdownOrString, g as RelationId$1, h as ProjectId$1, i as DeploymentKind$1, o as ElementKind$1, p as NodeId$1, r as DeploymentFqn$1, s as Fqn$1, v as RelationshipKind } from "./scalar.mjs";
2
+ import { IfNever, IsAny, IsLiteral, IsNever, KeysOfUnion, Simplify, UnionToIntersection } from "type-fest";
3
+
4
+ //#region src/types/_common.d.ts
5
+ type NonEmptyArray<T> = [T, ...T[]];
6
+ type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
7
+ type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
8
+ type ReorderedArray<T extends IterableContainer> = { -readonly [P in keyof T]: T[number] };
9
+ type KeysOf<T> = keyof T extends infer K extends string ? K : never;
10
+ type AllNever<Expressions> = UnionToIntersection<{ [Name in keyof Expressions]: { -readonly [Key in keyof Expressions[Name]]?: never } }[keyof Expressions]>;
11
+ /**
12
+ * @example
13
+ * ```ts
14
+ * type Variant1 = {
15
+ * a: string
16
+ * }
17
+ * type Variant2 = {
18
+ * b: number
19
+ * }
20
+ *
21
+ * type Variants = ExclusiveUnion<{
22
+ * Variant1: Variant1,
23
+ * Variant2: Variant2
24
+ * }>
25
+ *
26
+ * // Fail here
27
+ * const variant1: Variants = {
28
+ * a: 'one',
29
+ * b: 1
30
+ * }
31
+ * ```
32
+ */
33
+ type ExclusiveUnion<Expressions, All = AllNever<Expressions>> = Expressions extends object ? { [Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]> }[keyof Expressions] : never;
34
+ /**
35
+ * Copy from https://github.com/remeda/remeda/blob/main/packages/remeda/src/internal/types/NTuple.ts
36
+ * An array with *exactly* N elements in it.
37
+ *
38
+ * Only literal N values are supported. For very large N the type might result
39
+ * in a recurse depth error. For negative N the type would result in an infinite
40
+ * recursion. None of these have protections because this is an internal type!
41
+ */
42
+ type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
43
+ type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn, unknown>;
44
+ type Predicate<T> = (x: T) => boolean;
45
+ interface Link {
46
+ title?: string;
47
+ url: string;
48
+ relative?: string;
49
+ }
50
+ /**
51
+ * Coalesce `V` to a string if it is `any`
52
+ */
53
+ type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
54
+ type ExactObject<T, InputType = unknown> = { [KeyType in keyof T]: undefined extends T[KeyType] ? T[KeyType] | undefined : T[KeyType] } & Record<Exclude<keyof InputType, KeysOfUnion<T>>, never>;
55
+ /**
56
+ * Allows only exact properties of `U` to be present in `T` and omits undefined values
57
+ *
58
+ * See {@link Exact} for more details (this version is non-deep)
59
+ */
60
+ declare function exact<Expected, T extends ExactObject<Expected, T>>(a: T): Expected;
61
+ //#endregion
62
+ //#region src/types/const.d.ts
63
+ /**
64
+ * Determines the stage of the model:
65
+ * 1. `parsed` - parsed from DSL or returned from Builder
66
+ * 2. `computed` - views are computed
67
+ * 3. `layouted` - views are layouted
68
+ *
69
+ * @internal
70
+ */
71
+ type ModelStage = 'parsed' | 'computed' | 'layouted';
72
+ type ExtractOnStage<T, S extends ModelStage> = Extract<T, {
73
+ [_stage]: S;
74
+ }>;
75
+ declare function isOnStage<T extends {
76
+ [_stage]: ModelStage;
77
+ }, S extends ModelStage>(value: T, stage: S): value is ExtractOnStage<T, S>;
78
+ /**
79
+ * Property name to store the stage of the model
80
+ *
81
+ * @internal
82
+ */
83
+ declare const _stage = "_stage";
84
+ type _stage = typeof _stage;
85
+ /**
86
+ * Property name to store type information, used to identify the type of the view
87
+ *
88
+ * @internal
89
+ */
90
+ declare const _type = "_type";
91
+ type _type = typeof _type;
92
+ /**
93
+ * Property name to store layout type information, used to identify the type of the layout*
94
+ * @internal
95
+ */
96
+ declare const _layout = "_layout";
97
+ type _layout = typeof _layout;
98
+ declare namespace _aux_d_exports {
99
+ export { AllKinds, Any, Any as AnyAux, AnyComputed, AnyLayouted, AnyOnStage, AnyParsed, AnySpec, Aux, DeploymentFqn, DeploymentId, DeploymentKind, EdgeId, ElementId, ElementKind, Fqn, LooseDeploymentId, LooseDeploymentKind, LooseElementId, LooseElementKind, LooseLiteral, LooseRelationKind, LooseTag, LooseTags, LooseViewId, Metadata, MetadataKey, Never, NodeId, OrString, PickByStage, ProjectId, RelationId, RelationKind, Spec, SpecAux, Stage, DeploymentFqn as StrictDeploymentFqn, StrictDeploymentKind, StrictElementKind, Fqn as StrictFqn, StrictProjectId, StrictRelationKind, StrictTag, StrictViewId, Tag, Tags, Unknown, UnknownComputed, UnknownLayouted, UnknownParsed, ViewId, WithDescriptionAndTech, WithLinks, WithMetadata, WithNotation, WithOptionalLinks, WithOptionalTags, WithTags, preferDescription, preferSummary, setProject, setStage, toComputed, toLayouted, toParsed };
100
+ }
101
+ /**
102
+ * Specification types (kinds, tags, metadata keys)
103
+ *
104
+ * @param ElementKind - Literal union of element kinds
105
+ * @param DeploymentKind - Literal union of deployment kinds
106
+ * @param RelationKind - Literal union of relationship kinds
107
+ * @param Tag - Literal union of tags
108
+ * @param MetadataKey - Literal union of metadata keys
109
+ */
110
+ interface SpecAux<ElementKind extends string, DeploymentKind extends string, RelationKind extends string, Tag extends string, MetadataKey extends string> {
111
+ ElementKind: ElementKind;
112
+ DeploymentKind: DeploymentKind;
113
+ RelationKind: RelationKind;
114
+ Tag: Tag;
115
+ MetadataKey: MetadataKey;
116
+ }
117
+ type AnySpec = SpecAux<any, any, any, any, any>;
118
+ /**
119
+ * Auxilary interface to keep inferred types
120
+ *
121
+ * @typeParam Stage - View stage
122
+ * @typeParam Element - Literal union of FQNs of model elements
123
+ * @typeParam Deployment - Literal union of FQNs of deployment elements
124
+ * @typeParam View - Literal union of view identifiers
125
+ * @typeParam Project - Project identifier type
126
+ * @typeParam Spec - Specification types (kinds, tags, metadata keys)
127
+ */
128
+ interface Aux<Stage extends ModelStage, Element extends string, Deployment extends string, View extends string, Project extends string, Spec extends AnySpec> {
129
+ Stage: Stage;
130
+ ProjectId: Project;
131
+ ElementId: Element;
132
+ DeploymentId: Deployment;
133
+ ViewId: View;
134
+ ElementKind: Spec['ElementKind'];
135
+ DeploymentKind: Spec['DeploymentKind'];
136
+ RelationKind: Spec['RelationKind'];
137
+ Tag: Spec['Tag'];
138
+ MetadataKey: Spec['MetadataKey'];
139
+ }
140
+ type AnyOnStage<Stage extends ModelStage> = Aux<Stage, any, any, any, any, any>;
141
+ type AnyParsed = AnyOnStage<'parsed'>;
142
+ type AnyComputed = AnyOnStage<'computed'>;
143
+ type AnyLayouted = AnyOnStage<'layouted'>;
144
+ type Any = Aux<any, any, any, any, any, any>;
145
+ type Never = Aux<never, never, never, never, never, SpecAux<never, never, never, never, never>>;
146
+ /**
147
+ * Fallback when {@link Aux} can't be inferred.
148
+ * By default assumes non parsed model
149
+ */
150
+ type Unknown = UnknownComputed | UnknownLayouted;
151
+ type UnknownParsed = Aux<'parsed', string, string, string, string, SpecAux<string, string, string, string, string>>;
152
+ type UnknownComputed = Aux<'computed', string, string, string, string, SpecAux<string, string, string, string, string>>;
153
+ type UnknownLayouted = Aux<'layouted', string, string, string, string, SpecAux<string, string, string, string, string>>;
154
+ /**
155
+ * Reads stage from Aux
156
+ */
157
+ type Stage<A> = A extends Aux<infer S, any, any, any, any, any> ? IfNever<S, never, Coalesce<S, ModelStage>> : never;
158
+ /**
159
+ * Picks type based on stage from Aux
160
+ */
161
+ type PickByStage<A extends Any, OnParsed, OnComputed, OnLayouted = OnComputed> = {
162
+ parsed: OnParsed;
163
+ computed: OnComputed;
164
+ layouted: OnLayouted;
165
+ }[A['Stage']];
166
+ type setStage<A, S extends ModelStage> = A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? Aux<S, E, D, V, P, Spec> : never;
167
+ type toParsed<A> = A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? Aux<'parsed', E, D, V, P, Spec> : never;
168
+ type toComputed<A> = A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? Aux<'computed', E, D, V, P, Spec> : never;
169
+ type toLayouted<A> = A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? Aux<'layouted', E, D, V, P, Spec> : never;
170
+ /**
171
+ * Project identifier from Aux
172
+ */
173
+ type ProjectId<A> = A extends Aux<any, any, any, any, infer P, any> ? Coalesce<P> : never;
174
+ type setProject<A, P extends string> = A extends Aux<infer S, infer E, infer D, infer V, any, infer Spec> ? Aux<S, E, D, V, P, Spec> : never;
175
+ /**
176
+ * Element FQN from Aux as branded type
177
+ */
178
+ type Fqn<A> = A extends Any ? Fqn$1<ElementId<A>> : never;
179
+ /**
180
+ * Element FQN from Aux as a literal union
181
+ */
182
+ type ElementId<A> = A extends Any ? Coalesce<A['ElementId']> : never;
183
+ /**
184
+ * Deployment FQN from Aux as branded type
185
+ */
186
+ type DeploymentFqn<A> = A extends Any ? DeploymentFqn$1<DeploymentId<A>> : never;
187
+ /**
188
+ * Deployment FQN from Aux as a literal union
189
+ * @alias {@link DeploymentFqn}
190
+ */
191
+ type DeploymentId<A> = A extends Any ? Coalesce<A['DeploymentId']> : never;
192
+ /**
193
+ * View identifier from Aux as a literal union
194
+ */
195
+ type ViewId<A> = A extends Any ? Coalesce<A['ViewId']> : never;
196
+ type RelationId = RelationId$1;
197
+ type NodeId = NodeId$1;
198
+ type EdgeId = EdgeId$1;
199
+ /**
200
+ * ElementKind from Aux as a literal union
201
+ */
202
+ type ElementKind<A> = A extends Any ? Coalesce<A['ElementKind']> : never;
203
+ /**
204
+ * DeploymentKind from Aux as a literal union
205
+ */
206
+ type DeploymentKind<A> = A extends Any ? Coalesce<A['DeploymentKind']> : never;
207
+ /**
208
+ * RelationKind from Aux as a literal union
209
+ */
210
+ type RelationKind<A> = A extends Any ? Coalesce<A['RelationKind']> : never;
211
+ /**
212
+ * Tags from Aux as a literal union
213
+ */
214
+ type Tag<A> = A extends Any ? Coalesce<A['Tag']> : never;
215
+ /**
216
+ * Array of tags from Aux
217
+ */
218
+ type Tags<A extends Any> = readonly Tag<A>[];
219
+ /**
220
+ * Metadata key from Aux
221
+ */
222
+ type MetadataKey<A> = A extends Any ? Coalesce<A['MetadataKey']> : never;
223
+ /**
224
+ * Metadata object from Aux
225
+ */
226
+ type Metadata<A extends Any> = IsNever<A['MetadataKey']> extends true ? never : IsLiteral<A['MetadataKey']> extends true ? { [key in A['MetadataKey']]?: string | string[] } : Record<string, string | string[]>;
227
+ /**
228
+ * All known kinds from Aux as a literal union.
229
+ */
230
+ type AllKinds<A> = ElementKind<A> | DeploymentKind<A> | RelationKind<A>;
231
+ /**
232
+ * Specification from Aux
233
+ */
234
+ type Spec<A> = A extends Aux<any, any, any, any, any, SpecAux<infer E, infer D, infer R, infer T, infer M>> ? SpecAux<E, D, R, T, M> : never;
235
+ type StrictProjectId<A> = A extends infer T extends Any ? ProjectId$1<ProjectId<T>> : never;
236
+ type StrictViewId<A> = A extends infer T extends Any ? ViewId$1<ViewId<T>> : never;
237
+ type StrictTag<A> = A extends infer T extends Any ? Tag$1<Tag<T>> : never;
238
+ type StrictElementKind<A> = A extends infer T extends Any ? ElementKind$1<ElementKind<T>> : never;
239
+ type StrictDeploymentKind<A> = A extends infer T extends Any ? DeploymentKind$1<DeploymentKind<T>> : never;
240
+ type StrictRelationKind<A> = A extends infer T extends Any ? RelationshipKind<RelationKind<T>> : never;
241
+ type WithDescriptionAndTech = {
242
+ readonly summary?: MarkdownOrString | null;
243
+ readonly description?: MarkdownOrString | null;
244
+ readonly technology?: string | null;
245
+ };
246
+ /**
247
+ * Returns summary if it is not null, otherwise returns description
248
+ */
249
+ declare function preferSummary(a: WithDescriptionAndTech): MarkdownOrString | null | undefined;
250
+ /**
251
+ * Returns description if it is not null, otherwise returns summary
252
+ */
253
+ declare function preferDescription(a: WithDescriptionAndTech): MarkdownOrString | null | undefined;
254
+ type WithTags<A extends Any> = {
255
+ readonly tags: Tags<A>;
256
+ };
257
+ type WithOptionalTags<A extends Any> = {
258
+ readonly tags?: Tags<A> | null;
259
+ };
260
+ type WithLinks = {
261
+ readonly links: readonly Link[];
262
+ };
263
+ type WithOptionalLinks = {
264
+ readonly links?: readonly Link[] | null;
265
+ };
266
+ type WithMetadata<A extends Any> = {
267
+ readonly metadata?: Metadata<A>;
268
+ };
269
+ type WithNotation = {
270
+ readonly notation?: string | null;
271
+ };
272
+ /**
273
+ * @see {@link LiteralUnion} from type-fest (https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts)
274
+ */
275
+ type OrString = string & Record<never, never>;
276
+ /**
277
+ * Allows any string value, but still auto-completes to the possible values in IDE
278
+ */
279
+ type LooseLiteral<V extends string> = Coalesce<V> | OrString;
280
+ type LooseElementId<A> = A extends Any ? LooseLiteral<A['ElementId']> : string;
281
+ type LooseDeploymentId<A> = A extends Any ? LooseLiteral<A['DeploymentId']> : string;
282
+ type LooseViewId<A> = A extends Any ? LooseLiteral<A['ViewId']> : string;
283
+ type LooseTag<A> = A extends Any ? LooseLiteral<A['Tag']> : string;
284
+ type LooseTags<A> = A extends Any ? readonly (LooseLiteral<A['Tag']>)[] : string[];
285
+ type LooseElementKind<A> = A extends Any ? LooseLiteral<A['ElementKind']> : string;
286
+ type LooseDeploymentKind<A> = A extends Any ? LooseLiteral<A['DeploymentKind']> : string;
287
+ type LooseRelationKind<A> = A extends Any ? LooseLiteral<A['RelationKind']> : string;
288
+ //#endregion
289
+ export { WithNotation as $, PickByStage as A, StrictRelationKind as B, LooseTags as C, NTuple as Ct, Never as D, ReorderedArray as Dt, MetadataKey as E, Predicate as Et, SpecAux as F, Unknown as G, StrictViewId as H, Stage as I, UnknownParsed as J, UnknownComputed as K, StrictDeploymentKind as L, RelationId as M, RelationKind as N, NodeId as O, exact as Ot, Spec as P, WithMetadata as Q, StrictElementKind as R, LooseTag as S, Link as St, Metadata as T, NonEmptyReadonlyArray as Tt, Tag as U, StrictTag as V, Tags as W, WithDescriptionAndTech as X, ViewId as Y, WithLinks as Z, LooseDeploymentKind as _, Coalesce as _t, AnyOnStage as a, preferSummary as at, LooseLiteral as b, IteratorLike as bt, Aux as c, toComputed as ct, DeploymentKind as d, ExtractOnStage as dt, WithOptionalLinks as et, EdgeId as f, ModelStage as ft, LooseDeploymentId as g, isOnStage as gt, Fqn as h, _type as ht, AnyLayouted as i, preferDescription as it, ProjectId as j, OrString as k, DeploymentFqn as l, toLayouted as lt, ElementKind as m, _stage as mt, Any as n, WithTags as nt, AnyParsed as o, setProject as ot, ElementId as p, _layout as pt, UnknownLayouted as q, AnyComputed as r, _aux_d_exports as rt, AnySpec as s, setStage as st, AllKinds as t, WithOptionalTags as tt, DeploymentId as u, toParsed as ut, LooseElementId as v, ExclusiveUnion as vt, LooseViewId as w, NonEmptyArray as wt, LooseRelationKind as x, KeysOf as xt, LooseElementKind as y, IterableContainer as yt, StrictProjectId as z };
@@ -0,0 +1,18 @@
1
+ //#region src/types/_aux.ts
2
+ /**
3
+ * Returns summary if it is not null, otherwise returns description
4
+ */
5
+ /* @__NO_SIDE_EFFECTS__ */
6
+ function preferSummary(a) {
7
+ return a.summary ?? a.description;
8
+ }
9
+ /**
10
+ * Returns description if it is not null, otherwise returns summary
11
+ */
12
+ /* @__NO_SIDE_EFFECTS__ */
13
+ function preferDescription(a) {
14
+ return a.description ?? a.summary;
15
+ }
16
+
17
+ //#endregion
18
+ export { preferSummary as n, preferDescription as t };