@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.
- package/dist/THIRD-PARTY-LICENSES.md +1034 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/geometry.mjs +1 -335
- package/dist/_chunks/index.d.mts +1995 -131
- package/dist/_chunks/index2.d.mts +153 -892
- package/dist/_chunks/index3.d.mts +15 -13
- package/dist/_chunks/index4.d.mts +229 -3
- package/dist/_chunks/index5.d.mts +392 -30
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +2 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/manual-layout.mjs +1 -0
- package/dist/_chunks/model.mjs +4 -1898
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/types.mjs +1 -0
- package/dist/_chunks/utils.mjs +1 -483
- package/dist/builder/index.d.mts +3 -6
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +85 -13
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +7 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -11
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -7
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +5 -10
- package/dist/utils/index.mjs +1 -17
- package/package.json +14 -13
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/RichText.mjs +0 -148
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index7.d.mts +0 -268
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
|
@@ -1,42 +1,404 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
1
|
+
import { $i as IterableContainer, bi as Fqn, ea as IteratorLike, ia as NonEmptyArray, sa as ReorderedArray } from "./index.mjs";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
5
|
-
|
|
6
|
-
declare function
|
|
7
|
-
declare function
|
|
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>;
|
|
3
|
+
//#region src/utils/invariant.d.ts
|
|
4
|
+
declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
|
|
5
|
+
declare function invariant(condition: any, message?: string): asserts condition;
|
|
6
|
+
declare function nonexhaustive(value: never): never;
|
|
16
7
|
//#endregion
|
|
17
|
-
//#region src/
|
|
18
|
-
declare const VIEW_FOLDERS_SEPARATOR = "/";
|
|
8
|
+
//#region src/utils/common-head.d.ts
|
|
19
9
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
10
|
+
* Common head of two arrays
|
|
11
|
+
*
|
|
12
|
+
* @param equals - Equality function, defaults to `Object.is`
|
|
13
|
+
*/
|
|
14
|
+
declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/utils/compare-natural.d.ts
|
|
17
|
+
declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
|
|
18
|
+
declare function sortNatural(): <T extends IterableContainer<string>>(elements: T) => ReorderedArray<T>;
|
|
19
|
+
declare function sortNatural<T extends IterableContainer<string>>(elements: T): ReorderedArray<T>;
|
|
20
|
+
/**
|
|
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
|
+
* // ]
|
|
36
|
+
*/
|
|
37
|
+
declare function compareNaturalHierarchically(separator?: string, deepestFirst?: boolean): (a: string | undefined, b: string | undefined) => number;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/utils/fqn.d.ts
|
|
40
|
+
declare function parentFqn<E extends string>(fqn: E): E | null;
|
|
41
|
+
declare function nameFromFqn<E extends string>(fqn: E): string;
|
|
42
|
+
/**
|
|
43
|
+
* Check if one element is an ancestor of another
|
|
44
|
+
* Composable version
|
|
45
|
+
* @signature
|
|
46
|
+
* isAncestor(another)(ancestor)
|
|
47
|
+
*/
|
|
48
|
+
declare function isAncestor<A extends string | {
|
|
49
|
+
id: string;
|
|
50
|
+
}>(another: NoInfer<A>): (ancestor: A) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Check if one element is an ancestor of another
|
|
53
|
+
* @signature
|
|
54
|
+
* isAncestor(ancestor, another)
|
|
55
|
+
*/
|
|
56
|
+
declare function isAncestor<A extends string | {
|
|
57
|
+
id: string;
|
|
58
|
+
}>(ancestor: A, another: A): boolean;
|
|
59
|
+
declare function isSameHierarchy<T extends string>(one: NoInfer<T> | WithId<NoInfer<T>>): (another: T | WithId<T>) => boolean;
|
|
60
|
+
declare function isSameHierarchy<T extends string>(one: T | WithId<T>, another: T | WithId<T>): boolean;
|
|
61
|
+
type WithId<T = string> = {
|
|
62
|
+
id: T;
|
|
63
|
+
};
|
|
64
|
+
declare function isDescendantOf<T extends string>(ancestor: WithId<T>): (descedant: WithId<T>) => boolean;
|
|
65
|
+
declare function isDescendantOf<T extends string>(descedant: WithId<T>, ancestor: WithId<T>): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* How deep in the hierarchy the element is.
|
|
68
|
+
* Root element has depth 1
|
|
69
|
+
*/
|
|
70
|
+
declare function hierarchyLevel<E extends string | {
|
|
71
|
+
id: Fqn;
|
|
72
|
+
}>(elementOfFqn: E): number;
|
|
73
|
+
/**
|
|
74
|
+
* Calculate the distance as number of steps from one element to another, i.e.
|
|
75
|
+
* going up to the common ancestor, then going down to the other element.
|
|
76
|
+
* Sibling distance is always 1
|
|
77
|
+
*
|
|
78
|
+
* Can be used for hierarchical clustering
|
|
79
|
+
*/
|
|
80
|
+
declare function hierarchyDistance<E extends string | {
|
|
81
|
+
id: Fqn;
|
|
82
|
+
}>(one: E, another: E): number;
|
|
83
|
+
declare function commonAncestor<E extends string>(first: E, second: E): E | null;
|
|
84
|
+
/**
|
|
85
|
+
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
86
|
+
* going up from parent to the root
|
|
22
87
|
* @example
|
|
23
|
-
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* ancestorsFqn('a.b.c.d')
|
|
90
|
+
* // ['a.b.c', 'a.b', 'a']
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare function ancestorsFqn<Id extends string>(fqn: Id): Id[];
|
|
94
|
+
/**
|
|
95
|
+
* Compares two fully qualified names (fqns) hierarchically based on their depth.
|
|
96
|
+
* From parent nodes to leaves
|
|
97
|
+
*
|
|
98
|
+
* @param {string} a - The first fqn to compare.
|
|
99
|
+
* @param {string} b - The second fqn to compare.
|
|
100
|
+
* @returns {number} - 0 if the fqns have the same depth.
|
|
101
|
+
* - Positive number if a is deeper than b.
|
|
102
|
+
* - Negative number if b is deeper than a.
|
|
24
103
|
*/
|
|
25
|
-
declare
|
|
104
|
+
declare function compareFqnHierarchically<T extends string = string>(a: T, b: T): -1 | 0 | 1;
|
|
105
|
+
declare function compareByFqnHierarchically<T extends {
|
|
106
|
+
id: string;
|
|
107
|
+
}>(a: T, b: T): -1 | 0 | 1;
|
|
26
108
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
109
|
+
* Sorts an array of objects hierarchically based on their fully qualified names (FQN).
|
|
110
|
+
* Objects are sorted by the number of segments in their FQN (defined by dot-separated ID).
|
|
111
|
+
*
|
|
112
|
+
* @typeParam T - Object type that contains an 'id' string property
|
|
113
|
+
* @typeParam A - Type extending IterableContainer of T
|
|
114
|
+
*
|
|
115
|
+
* @param array - Array of objects to be sorted
|
|
116
|
+
* @returns A new array with items sorted by their FQN hierarchy depth (number of segments)
|
|
117
|
+
*
|
|
29
118
|
* @example
|
|
30
|
-
*
|
|
31
|
-
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* const items = [
|
|
121
|
+
* { id: "a.b.c" },
|
|
122
|
+
* { id: "a" },
|
|
123
|
+
* { id: "a.b" }
|
|
124
|
+
* ];
|
|
125
|
+
* sortByFqnHierarchically(items);
|
|
126
|
+
* // Result: [
|
|
127
|
+
* // { id: "a" },
|
|
128
|
+
* // { id: "a.b" },
|
|
129
|
+
* // { id: "a.b.c" }
|
|
130
|
+
* // ]
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
declare function sortByFqnHierarchically<T extends {
|
|
134
|
+
id: string;
|
|
135
|
+
}, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
136
|
+
/**
|
|
137
|
+
* Keeps initial order of the elements, but ensures that parents are before children
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const items = [
|
|
142
|
+
* {id: 'a.c'},
|
|
143
|
+
* {id: 'a'},
|
|
144
|
+
* {id: 'a.b.c'},
|
|
145
|
+
* {id: 'a.b'},
|
|
146
|
+
* ];
|
|
147
|
+
* sortParentsFirst(items);
|
|
148
|
+
* // Result: [
|
|
149
|
+
* // { id: "a" },
|
|
150
|
+
* // { id: "a.c" }, // because of initial order
|
|
151
|
+
* // { id: "a.b" },
|
|
152
|
+
* // { id: "a.b.c" },
|
|
153
|
+
* // ]
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
declare function sortParentsFirst<T extends WithId<string>, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
157
|
+
/**
|
|
158
|
+
* Sorts an array of objects naturally by their fully qualified name (FQN) identifier.
|
|
159
|
+
*
|
|
160
|
+
* @template T - Type of objects containing an 'id' string property
|
|
161
|
+
* @template A - Type extending IterableContainer of T
|
|
162
|
+
*
|
|
163
|
+
* @param first - Optional. Either the array to sort or the sort direction ('asc'|'desc')
|
|
164
|
+
* @param sort - Optional. The sort direction ('asc'|'desc'). Defaults to 'asc' if not specified
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* // As a function that returns a sorting function
|
|
168
|
+
* const sorted = sortNaturalByFqn('desc')(myArray);
|
|
169
|
+
*
|
|
170
|
+
* // Direct array sorting
|
|
171
|
+
* const sorted = sortNaturalByFqn(myArray, 'desc');
|
|
172
|
+
*/
|
|
173
|
+
declare function sortNaturalByFqn(sort?: 'asc' | 'desc'): <I extends WithId<string>, A extends IterableContainer<I>>(array: A) => ReorderedArray<A>;
|
|
174
|
+
declare function sortNaturalByFqn<A extends IterableContainer<WithId>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/utils/getOrCreate.d.ts
|
|
177
|
+
declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
|
|
178
|
+
declare function getOrCreate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, create: (key: K) => V): V;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/utils/iterable/_types.d.ts
|
|
181
|
+
declare function isIterable<T, I extends Iterable<T>>(something: I | unknown): something is Iterable<T>;
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/utils/iterable/filter.d.ts
|
|
184
|
+
/**
|
|
185
|
+
* Filters an iterable based on a predicate.
|
|
186
|
+
* Composabel first version of `ifilter`.
|
|
187
|
+
* @signature
|
|
188
|
+
* ifilter(predicate)(data)
|
|
189
|
+
*/
|
|
190
|
+
declare function ifilter<T, S extends T>(predicate: (v: T) => v is S): (iterable: Iterable<T>) => IteratorLike<S>;
|
|
191
|
+
declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T>) => IteratorLike<T>;
|
|
192
|
+
/**
|
|
193
|
+
* Filters an iterable based on a predicate.
|
|
194
|
+
* Data first version of `ifilter`.
|
|
195
|
+
* @signature
|
|
196
|
+
* ifilter(data, predicate)
|
|
197
|
+
* @example
|
|
198
|
+
* ifilter(new Set([1, 2, 3]), x => x % 2 === 1) // => Iterable<[1, 3]>
|
|
199
|
+
*/
|
|
200
|
+
declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
|
|
201
|
+
declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/utils/iterable/find.d.ts
|
|
204
|
+
/**
|
|
205
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
206
|
+
* Composable first version of `find`.
|
|
207
|
+
* @signature
|
|
208
|
+
* ifind(predicate)(data)
|
|
209
|
+
*/
|
|
210
|
+
declare function ifind<T, S extends T>(predicate: (item: T) => item is S): (iterable: Iterable<T>) => S | undefined;
|
|
211
|
+
declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
214
|
+
* Data first version of `find`.
|
|
215
|
+
* @signature
|
|
216
|
+
* ifind(data, predicate)
|
|
217
|
+
*/
|
|
218
|
+
declare function ifind<T, S extends T>(iterable: Iterable<T>, predicate: (item: T) => item is S): S | undefined;
|
|
219
|
+
declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/utils/iterable/first.d.ts
|
|
222
|
+
/**
|
|
223
|
+
* Takes the first N elements from an iterable.
|
|
224
|
+
* Composable first version of `ifirst`.
|
|
225
|
+
* @signature
|
|
226
|
+
* ifirst(count)(data)
|
|
227
|
+
*/
|
|
228
|
+
declare function ifirst<T>(count: number): (iterable: Iterable<T>) => IteratorLike<T>;
|
|
229
|
+
/**
|
|
230
|
+
* Takes the first N elements from an iterable.
|
|
231
|
+
* Data first version of `ifirst`.
|
|
232
|
+
* @signature
|
|
233
|
+
* ifirst(data, count)
|
|
234
|
+
* @example
|
|
235
|
+
* ifirst([1, 2, 3, 4, 5], 3) // => Iterable<[1, 2, 3]>
|
|
236
|
+
*/
|
|
237
|
+
declare function ifirst<T>(iterable: Iterable<T>, count: number): IteratorLike<T>;
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/utils/iterable/flat.d.ts
|
|
240
|
+
declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
|
|
241
|
+
declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/utils/iterable/flatMap.d.ts
|
|
244
|
+
type FlatMapFunction<T, S> = (item: T) => Iterable<S>;
|
|
245
|
+
/**
|
|
246
|
+
* Maps an iterable using a mapper function and flattens the result by one level.
|
|
247
|
+
* Composable first version of `iflatMap`.
|
|
248
|
+
* @signature
|
|
249
|
+
* iflatMap(mapper)(data)
|
|
250
|
+
*/
|
|
251
|
+
declare function iflatMap<T, S>(mapper: FlatMapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
|
|
252
|
+
/**
|
|
253
|
+
* Maps an iterable using a mapper function and flattens the result by one level.
|
|
254
|
+
* Data first version of `iflatMap`.
|
|
255
|
+
* @signature
|
|
256
|
+
* iflatMap(data, mapper)
|
|
257
|
+
*/
|
|
258
|
+
declare function iflatMap<T, S>(iterable: Iterable<T>, mapper: FlatMapFunction<T, S>): IteratorLike<S>;
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/utils/iterable/head.d.ts
|
|
261
|
+
declare function ihead<T>(): (iterable: Iterable<T>) => T | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* Finds the first element in the iterable that satisfies the predicate.
|
|
264
|
+
* Data first version of `find`.
|
|
265
|
+
* @signature
|
|
266
|
+
* ifind(data, predicate)
|
|
267
|
+
*/
|
|
268
|
+
declare function ihead<T>(iterable: Iterable<T>): T | undefined;
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/utils/iterable/map.d.ts
|
|
271
|
+
type MapFunction<T, S> = (item: T) => S;
|
|
272
|
+
/**
|
|
273
|
+
* Maps an iterable using a mapper function.
|
|
274
|
+
* Composable first version of `imap`.
|
|
275
|
+
* @signature
|
|
276
|
+
* imap(mapper)(data)
|
|
32
277
|
*/
|
|
33
|
-
declare
|
|
278
|
+
declare function imap<T, S>(mapper: MapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
|
|
34
279
|
/**
|
|
35
|
-
*
|
|
280
|
+
* Maps an iterable using a mapper function.
|
|
281
|
+
* Data first version of `imap`.
|
|
282
|
+
* @signature
|
|
283
|
+
* imap(data, mapper)
|
|
284
|
+
*/
|
|
285
|
+
declare function imap<T, S>(iterable: Iterable<T>, mapper: MapFunction<T, S>): IteratorLike<S>;
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/utils/iterable/reduce.d.ts
|
|
288
|
+
declare function ireduce<T, R>(reducer: (acc: R, item: T) => R, initialValue: R): (iterable: Iterable<T>) => R;
|
|
289
|
+
declare function ireduce<T, R>(iterable: Iterable<T>, reducer: (acc: R, item: T) => R, initialValue: R): R;
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/utils/iterable/some.d.ts
|
|
292
|
+
/**
|
|
293
|
+
* Checks if at least one element in the iterable satisfies the predicate.
|
|
294
|
+
* Composable first version of `some`.
|
|
295
|
+
* @signature
|
|
296
|
+
* isome(predicate)(data)
|
|
297
|
+
*/
|
|
298
|
+
declare function isome<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Checks if at least one element in the iterable satisfies the predicate.
|
|
301
|
+
* Data first version of `some`.
|
|
302
|
+
* @signature
|
|
303
|
+
* isome(data, predicate)
|
|
304
|
+
*/
|
|
305
|
+
declare function isome<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): boolean;
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/utils/iterable/to.d.ts
|
|
308
|
+
declare function toArray(): <T>(iterable: Iterable<T> | ArrayLike<T>) => T[];
|
|
309
|
+
declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
310
|
+
declare function toSet(): <T>(iterable: Iterable<T>) => Set<T>;
|
|
311
|
+
declare function toSet<T>(iterable: Iterable<T>): Set<T>;
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/utils/iterable/unique.d.ts
|
|
314
|
+
/**
|
|
315
|
+
* Returns an iterable that yields only unique values.
|
|
316
|
+
* It uses a Set to keep track of the values.
|
|
317
|
+
*/
|
|
318
|
+
declare function iunique(): <T>(iterable: Iterable<T>) => IteratorLike<T>;
|
|
319
|
+
declare function iunique<T>(iterable: Iterable<T>): IteratorLike<T>;
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/utils/memoize-prop.d.ts
|
|
322
|
+
/**
|
|
323
|
+
* Saves the value returned by fn() in a hidden property tag of obj object, so next time memoizeProp() is called,
|
|
324
|
+
* that value will be returned, and fn won't be called.
|
|
325
|
+
*
|
|
36
326
|
* @example
|
|
37
|
-
*
|
|
38
|
-
*
|
|
327
|
+
* ```ts
|
|
328
|
+
* class Model {
|
|
329
|
+
* // using same Symbol
|
|
330
|
+
* get computed1() {
|
|
331
|
+
* return memoizeProp(this, Symbol.for('computed1'), () => doOnce())
|
|
332
|
+
* }
|
|
333
|
+
* // using string
|
|
334
|
+
* get computed2() {
|
|
335
|
+
* return memoizeProp(this, 'computed2', () => doOnce())
|
|
336
|
+
* }
|
|
337
|
+
*
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag: Tag, fn: () => Res): Res;
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/utils/promises.d.ts
|
|
344
|
+
declare function delay(): Promise<string>;
|
|
345
|
+
declare function delay(ms: number): Promise<string>;
|
|
346
|
+
declare function delay(randomFrom: number, randomTo: number): Promise<string>;
|
|
347
|
+
declare function promiseNextTick(): Promise<void>;
|
|
348
|
+
declare function onNextTick(fn: () => Promise<void> | void): void;
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/utils/relations.d.ts
|
|
351
|
+
type RelationshipLike = {
|
|
352
|
+
source: {
|
|
353
|
+
id: string;
|
|
354
|
+
};
|
|
355
|
+
target: {
|
|
356
|
+
id: string;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Compares two relations hierarchically.
|
|
361
|
+
* From the most general (implicit) to the most specific (deepest in the tree)
|
|
362
|
+
*/
|
|
363
|
+
declare const compareRelations: <T extends RelationshipLike>(a: T, b: T) => number;
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/utils/set.d.ts
|
|
366
|
+
/**
|
|
367
|
+
* Returns new set as a union of given sets
|
|
368
|
+
* Keeps order of elements
|
|
369
|
+
*/
|
|
370
|
+
declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
|
|
371
|
+
/**
|
|
372
|
+
* Returns new set as an intersection of all sets
|
|
373
|
+
* Keeps order from the first set
|
|
374
|
+
*/
|
|
375
|
+
declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
|
|
376
|
+
/**
|
|
377
|
+
* Returns new set as a difference of two sets (A-B)
|
|
378
|
+
* Keeps order from the first set
|
|
379
|
+
*/
|
|
380
|
+
declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
|
|
381
|
+
declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
|
|
382
|
+
declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/utils/object-hash.d.ts
|
|
385
|
+
declare function objectHash(value: any): string;
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/utils/string-hash.d.ts
|
|
388
|
+
/**
|
|
389
|
+
* @see https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf
|
|
390
|
+
*/
|
|
391
|
+
declare function stringHash(str: string): string;
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/utils/markdown/to-html.d.ts
|
|
394
|
+
declare function markdownToHtml(markdown: string): string;
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/utils/markdown/to-text.d.ts
|
|
397
|
+
/**
|
|
398
|
+
* Converts markdown to plain text, removing any markdown formatting.
|
|
399
|
+
* @param markdown - The markdown to convert.
|
|
400
|
+
* @returns The plain text.
|
|
39
401
|
*/
|
|
40
|
-
declare
|
|
402
|
+
declare function markdownToText(markdown: string): string;
|
|
41
403
|
//#endregion
|
|
42
|
-
export {
|
|
404
|
+
export { commonAncestor as A, sortByFqnHierarchically as B, iflat as C, isIterable as D, ifilter as E, isAncestor as F, sortNatural as G, sortParentsFirst as H, isDescendantOf as I, nonNullable as J, commonHead as K, isSameHierarchy as L, compareFqnHierarchically as M, hierarchyDistance as N, getOrCreate as O, hierarchyLevel as P, nameFromFqn as R, iflatMap as S, ifind as T, compareNatural as U, sortNaturalByFqn as V, compareNaturalHierarchically as W, nonexhaustive as Y, toSet as _, difference as a, imap as b, symmetricDifference as c, delay as d, onNextTick as f, toArray as g, iunique as h, objectHash as i, compareByFqnHierarchically as j, ancestorsFqn as k, union as l, memoizeProp as m, markdownToHtml as n, equals as o, promiseNextTick as p, invariant as q, stringHash as r, intersection as s, markdownToText as t, compareRelations as u, isome as v, ifirst as w, ihead as x, ireduce as y, parentFqn as z };
|