@likec4/core 1.48.0 → 1.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/THIRD-PARTY-LICENSES.md +1034 -0
  2. package/dist/_chunks/Builder.view-element.mjs +2 -3284
  3. package/dist/_chunks/LikeC4Model.d.mts +21 -25
  4. package/dist/_chunks/_types.d.mts +1 -5
  5. package/dist/_chunks/_types2.d.mts +2 -4
  6. package/dist/_chunks/assignTagColors.mjs +1 -24
  7. package/dist/_chunks/geometry.mjs +1 -335
  8. package/dist/_chunks/index.d.mts +1995 -131
  9. package/dist/_chunks/index2.d.mts +153 -892
  10. package/dist/_chunks/index3.d.mts +15 -13
  11. package/dist/_chunks/index4.d.mts +229 -3
  12. package/dist/_chunks/index5.d.mts +392 -30
  13. package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
  14. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
  15. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
  16. package/dist/_chunks/libs/bail.mjs +1 -14
  17. package/dist/_chunks/libs/ccount.mjs +1 -25
  18. package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
  19. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
  20. package/dist/_chunks/libs/character-entities.mjs +2 -2136
  21. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
  22. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
  23. package/dist/_chunks/libs/defu.mjs +1 -42
  24. package/dist/_chunks/libs/devlop.mjs +1 -5
  25. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
  26. package/dist/_chunks/libs/extend.mjs +1 -77
  27. package/dist/_chunks/libs/graphology-dag.mjs +1 -703
  28. package/dist/_chunks/libs/graphology.mjs +1 -4565
  29. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
  30. package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
  31. package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
  32. package/dist/_chunks/libs/longest-streak.mjs +1 -30
  33. package/dist/_chunks/libs/markdown-table.mjs +2 -290
  34. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
  35. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
  36. package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
  37. package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
  38. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
  39. package/dist/_chunks/libs/mnemonist.d.mts +1 -91
  40. package/dist/_chunks/libs/mnemonist.mjs +1 -1978
  41. package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
  42. package/dist/_chunks/libs/ohash.mjs +1 -0
  43. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
  44. package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
  45. package/dist/_chunks/libs/remark-gfm.mjs +1 -36
  46. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
  47. package/dist/_chunks/libs/remark-parse.mjs +1 -39
  48. package/dist/_chunks/libs/remark-rehype.mjs +1 -171
  49. package/dist/_chunks/libs/remeda.mjs +2 -702
  50. package/dist/_chunks/libs/trough.mjs +1 -158
  51. package/dist/_chunks/libs/unified.mjs +1 -2212
  52. package/dist/_chunks/manual-layout.mjs +1 -0
  53. package/dist/_chunks/model.mjs +4 -1898
  54. package/dist/_chunks/rolldown-runtime.mjs +1 -42
  55. package/dist/_chunks/types.mjs +1 -0
  56. package/dist/_chunks/utils.mjs +1 -483
  57. package/dist/builder/index.d.mts +3 -6
  58. package/dist/builder/index.mjs +1 -662
  59. package/dist/compute-view/index.d.mts +85 -13
  60. package/dist/compute-view/index.mjs +2 -262
  61. package/dist/geometry/index.d.mts +2 -2
  62. package/dist/geometry/index.mjs +1 -3
  63. package/dist/index.d.mts +7 -13
  64. package/dist/index.mjs +1 -27
  65. package/dist/model/index.d.mts +4 -11
  66. package/dist/model/index.mjs +1 -11
  67. package/dist/styles/index.d.mts +2 -7
  68. package/dist/styles/index.mjs +1 -30
  69. package/dist/types/index.d.mts +3 -9
  70. package/dist/types/index.mjs +1 -15
  71. package/dist/utils/graphology/index.d.mts +1 -1
  72. package/dist/utils/graphology/index.mjs +1 -3
  73. package/dist/utils/index.d.mts +5 -10
  74. package/dist/utils/index.mjs +1 -17
  75. package/package.json +14 -13
  76. package/dist/_chunks/LikeC4Styles.mjs +0 -691
  77. package/dist/_chunks/RichText.d.mts +0 -84
  78. package/dist/_chunks/RichText.mjs +0 -148
  79. package/dist/_chunks/_aux.d.mts +0 -289
  80. package/dist/_chunks/_aux.mjs +0 -18
  81. package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
  82. package/dist/_chunks/connection.mjs +0 -0
  83. package/dist/_chunks/const.d.mts +0 -43
  84. package/dist/_chunks/const.mjs +0 -33
  85. package/dist/_chunks/expression-model.d.mts +0 -192
  86. package/dist/_chunks/expression-model.mjs +0 -103
  87. package/dist/_chunks/expression.d.mts +0 -347
  88. package/dist/_chunks/expression.mjs +0 -107
  89. package/dist/_chunks/find.d.mts +0 -82
  90. package/dist/_chunks/find.mjs +0 -646
  91. package/dist/_chunks/find2.d.mts +0 -78
  92. package/dist/_chunks/find2.mjs +0 -287
  93. package/dist/_chunks/fqnRef.d.mts +0 -58
  94. package/dist/_chunks/fqnRef.mjs +0 -41
  95. package/dist/_chunks/index6.d.mts +0 -43
  96. package/dist/_chunks/index7.d.mts +0 -268
  97. package/dist/_chunks/index8.d.mts +0 -144
  98. package/dist/_chunks/invariant.mjs +0 -18
  99. package/dist/_chunks/iterable.mjs +0 -146
  100. package/dist/_chunks/libs/graphology-types.d.mts +0 -601
  101. package/dist/_chunks/libs/graphology.d.mts +0 -6
  102. package/dist/_chunks/mnemonist.mjs +0 -0
  103. package/dist/_chunks/model2.mjs +0 -0
  104. package/dist/_chunks/relationships-view.mjs +0 -132
  105. package/dist/_chunks/scalar.d.mts +0 -109
  106. package/dist/_chunks/scalar.mjs +0 -84
  107. package/dist/compute-view/relationships-view/index.d.mts +0 -16
  108. package/dist/compute-view/relationships-view/index.mjs +0 -7
  109. package/dist/model/connection/deployment/index.d.mts +0 -12
  110. package/dist/model/connection/deployment/index.mjs +0 -9
  111. package/dist/model/connection/index.d.mts +0 -14
  112. package/dist/model/connection/index.mjs +0 -10
  113. package/dist/model/connection/model/index.d.mts +0 -12
  114. package/dist/model/connection/model/index.mjs +0 -8
  115. package/dist/types/RichText.d.mts +0 -3
  116. package/dist/types/RichText.mjs +0 -7
  117. package/dist/types/_aux.d.mts +0 -3
  118. package/dist/types/_aux.mjs +0 -3
  119. package/dist/types/expression-model.d.mts +0 -6
  120. package/dist/types/expression-model.mjs +0 -7
  121. package/dist/types/expression.d.mts +0 -5
  122. package/dist/types/expression.mjs +0 -7
  123. package/dist/types/fqnRef.d.mts +0 -4
  124. package/dist/types/fqnRef.mjs +0 -7
  125. package/dist/types/scalar.d.mts +0 -2
  126. package/dist/types/scalar.mjs +0 -7
  127. package/dist/utils/iterable/index.d.mts +0 -9
  128. package/dist/utils/iterable/index.mjs +0 -3
  129. package/dist/utils/mnemonist.d.mts +0 -2
  130. package/dist/utils/mnemonist.mjs +0 -12
@@ -1,84 +0,0 @@
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 };
@@ -1,148 +0,0 @@
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 };
@@ -1,289 +0,0 @@
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 };
@@ -1,18 +0,0 @@
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 };