@likec4/core 1.47.0 → 1.49.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/LICENSE +1 -1
- package/dist/THIRD-PARTY-LICENSES.md +1012 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -0
- package/dist/_chunks/LikeC4Model.d.mts +1283 -0
- package/dist/_chunks/RichText.mjs +1 -0
- package/dist/_chunks/_types.d.mts +777 -0
- package/dist/_chunks/_types2.d.mts +36 -0
- package/dist/_chunks/assignTagColors.mjs +1 -0
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -0
- package/dist/_chunks/guards.d.mts +2026 -0
- package/dist/_chunks/guards.mjs +4 -0
- package/dist/_chunks/index.d.mts +288 -0
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +15 -0
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -0
- package/dist/_chunks/libs/bail.mjs +1 -0
- package/dist/_chunks/libs/ccount.mjs +1 -0
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -0
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -0
- package/dist/_chunks/libs/character-entities.mjs +2 -0
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -0
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -0
- package/dist/_chunks/libs/defu.mjs +1 -0
- package/dist/_chunks/libs/devlop.mjs +1 -0
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -0
- package/dist/_chunks/libs/extend.mjs +1 -0
- package/dist/_chunks/libs/graphology-dag.mjs +1 -0
- package/dist/_chunks/libs/graphology.mjs +1 -0
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -0
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -0
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/_chunks/libs/longest-streak.mjs +1 -0
- package/dist/_chunks/libs/markdown-table.mjs +2 -0
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -0
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -0
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -0
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -0
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -0
- package/dist/_chunks/libs/mnemonist.d.mts +164 -0
- package/dist/_chunks/libs/mnemonist.mjs +1 -0
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -0
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -0
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -0
- package/dist/_chunks/libs/remark-gfm.mjs +1 -0
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -0
- package/dist/_chunks/libs/remark-parse.mjs +1 -0
- package/dist/_chunks/libs/remark-rehype.mjs +1 -0
- package/dist/_chunks/libs/remeda.mjs +1 -0
- package/dist/_chunks/libs/trough.mjs +1 -0
- package/dist/_chunks/libs/unified.mjs +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +1 -0
- package/dist/_chunks/theme.d.mts +148 -0
- package/dist/_chunks/to-text.d.mts +404 -0
- package/dist/_chunks/to-text.mjs +1 -0
- package/dist/_chunks/vector.d.mts +198 -0
- package/dist/_chunks/vector.mjs +1 -0
- package/dist/builder/index.d.mts +5 -775
- package/dist/builder/index.mjs +1 -1053
- package/dist/compute-view/index.d.mts +156 -56
- package/dist/compute-view/index.mjs +2 -229
- package/dist/geometry/index.d.mts +2 -109
- package/dist/geometry/index.mjs +1 -328
- package/dist/index.d.mts +14 -20
- package/dist/index.mjs +1 -18
- package/dist/model/index.d.mts +5 -57
- package/dist/model/index.mjs +1 -4
- package/dist/styles/index.d.mts +3 -117
- package/dist/styles/index.mjs +1 -63
- package/dist/types/index.d.mts +3 -47
- package/dist/types/index.mjs +1 -17
- package/dist/utils/graphology/index.d.mts +2 -1864
- package/dist/utils/graphology/index.mjs +1 -1
- package/dist/utils/index.d.mts +4 -124
- package/dist/utils/index.mjs +1 -44
- package/package.json +20 -24
- package/compute-view/relationships/package.json +0 -4
- package/dist/compute-view/relationships-view/index.d.mts +0 -51
- package/dist/compute-view/relationships-view/index.mjs +0 -185
- package/dist/model/connection/deployment/index.d.mts +0 -15
- package/dist/model/connection/deployment/index.mjs +0 -2
- package/dist/model/connection/index.d.mts +0 -75
- package/dist/model/connection/index.mjs +0 -3
- package/dist/model/connection/model/index.d.mts +0 -15
- package/dist/model/connection/model/index.mjs +0 -2
- package/dist/shared/core.3ZhnKAlZ.mjs +0 -106
- package/dist/shared/core.78IWAHAE.mjs +0 -332
- package/dist/shared/core.B85MJLTf.mjs +0 -5
- package/dist/shared/core.BFd1lU9R.mjs +0 -29
- package/dist/shared/core.BKlholso.mjs +0 -3
- package/dist/shared/core.BNN-3vPH.mjs +0 -1255
- package/dist/shared/core.BPGOjone.d.mts +0 -46
- package/dist/shared/core.BP_QHEXs.mjs +0 -785
- package/dist/shared/core.BbE4y-yl.mjs +0 -177
- package/dist/shared/core.Bdy3hhTc.mjs +0 -28382
- package/dist/shared/core.BfCKSW-g.d.mts +0 -1266
- package/dist/shared/core.BhNcrwzK.mjs +0 -7
- package/dist/shared/core.BkVA6gjl.mjs +0 -5
- package/dist/shared/core.BoYfZOBm.mjs +0 -3
- package/dist/shared/core.BsSXS-_R.mjs +0 -7
- package/dist/shared/core.C3JowhaZ.mjs +0 -32
- package/dist/shared/core.C4x8aaWa.mjs +0 -27
- package/dist/shared/core.CAgYpDtM.d.mts +0 -98
- package/dist/shared/core.CHf8VEa3.mjs +0 -1206
- package/dist/shared/core.CLSZtnFh.mjs +0 -69
- package/dist/shared/core.C_3y3eqV.d.mts +0 -139
- package/dist/shared/core.CbT8JVYL.mjs +0 -5
- package/dist/shared/core.CdNCAwq7.mjs +0 -176
- package/dist/shared/core.CmGY9blO.mjs +0 -6717
- package/dist/shared/core.CmPXpJ8l.mjs +0 -21
- package/dist/shared/core.Coi_LOUZ.mjs +0 -7
- package/dist/shared/core.CqAJJpK_.mjs +0 -3
- package/dist/shared/core.CywrQs86.d.mts +0 -31
- package/dist/shared/core.D00YbOhQ.d.mts +0 -300
- package/dist/shared/core.D0WZutNd.mjs +0 -94
- package/dist/shared/core.D4npX2q8.mjs +0 -18
- package/dist/shared/core.DB0Ue5Wx.d.mts +0 -70
- package/dist/shared/core.DC5IAaDT.d.mts +0 -334
- package/dist/shared/core.DE9qzhn8.d.mts +0 -83
- package/dist/shared/core.DGcIbsj4.mjs +0 -3946
- package/dist/shared/core.DH7TXqXf.mjs +0 -136
- package/dist/shared/core.DKhRkHRN.d.mts +0 -41
- package/dist/shared/core.DRJma0Ol.mjs +0 -22
- package/dist/shared/core.DU5SRqNF.mjs +0 -2209
- package/dist/shared/core.DXhDWKFZ.d.mts +0 -3
- package/dist/shared/core.DbfO90vF.mjs +0 -434
- package/dist/shared/core.DcS-0zys.mjs +0 -10
- package/dist/shared/core.Dh119QSP.mjs +0 -4995
- package/dist/shared/core.DjcWextK.mjs +0 -1371
- package/dist/shared/core.Dojz4bvg.d.mts +0 -504
- package/dist/shared/core.FZ305VYd.mjs +0 -21
- package/dist/shared/core.OtRNdMxy.d.mts +0 -352
- package/dist/shared/core.RfnaEmgA.mjs +0 -7
- package/dist/shared/core.btEq3i3f.mjs +0 -300
- package/dist/shared/core.oSV6SRfk.mjs +0 -13
- package/dist/shared/core.om36dXXW.mjs +0 -41
- package/dist/shared/core.osFs8tU7.d.mts +0 -466
- package/dist/shared/core.q10OP9oJ.mjs +0 -5
- package/dist/shared/core.tpvDGvdC.d.mts +0 -87
- package/dist/shared/core.uFk_o9X6.mjs +0 -13
- package/dist/types/_aux.d.mts +0 -4
- package/dist/types/_aux.mjs +0 -8
- package/dist/types/expression-model.d.mts +0 -190
- package/dist/types/expression-model.mjs +0 -109
- package/dist/types/expression.d.mts +0 -6
- package/dist/types/expression.mjs +0 -113
- package/dist/types/fqnRef.d.mts +0 -60
- package/dist/types/fqnRef.mjs +0 -45
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -4
- package/dist/utils/iterable/index.d.mts +0 -132
- package/dist/utils/iterable/index.mjs +0 -62
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import { I as IterableContainer, R as ReorderedArray, N as NonEmptyArray } from './core.DB0Ue5Wx.mjs';
|
|
2
|
-
import { F as Fqn } from './core.C_3y3eqV.mjs';
|
|
3
|
-
import { SetRequired, SetNonNullable } from 'type-fest';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Mnemonist DefaultWeakMap Typings
|
|
7
|
-
* ================================
|
|
8
|
-
*/
|
|
9
|
-
declare class DefaultWeakMap<K extends object, V> {
|
|
10
|
-
|
|
11
|
-
// Constructor
|
|
12
|
-
constructor(factory: (key: K) => V);
|
|
13
|
-
|
|
14
|
-
// Methods
|
|
15
|
-
clear(): void;
|
|
16
|
-
set(key: K, value: V): this;
|
|
17
|
-
delete(key: K): boolean;
|
|
18
|
-
has(key: K): boolean;
|
|
19
|
-
get(key: K): V;
|
|
20
|
-
peek(key: K): V | undefined;
|
|
21
|
-
inspect(): any;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Mnemonist LinkedList Typings
|
|
26
|
-
* =============================
|
|
27
|
-
*/
|
|
28
|
-
declare class LinkedList<T> implements Iterable<T> {
|
|
29
|
-
|
|
30
|
-
// Members
|
|
31
|
-
size: number;
|
|
32
|
-
|
|
33
|
-
// Constructor
|
|
34
|
-
constructor();
|
|
35
|
-
|
|
36
|
-
// Methods
|
|
37
|
-
clear(): void;
|
|
38
|
-
first(): T | undefined;
|
|
39
|
-
last(): T | undefined;
|
|
40
|
-
peek(): T | undefined;
|
|
41
|
-
push(value: T): number;
|
|
42
|
-
shift(): T | undefined;
|
|
43
|
-
unshift(value: T): number;
|
|
44
|
-
forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
|
|
45
|
-
toArray(): Array<T>;
|
|
46
|
-
values(): IterableIterator<T>;
|
|
47
|
-
entries(): IterableIterator<[number, T]>;
|
|
48
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
49
|
-
toString(): string;
|
|
50
|
-
toJSON(): Array<T>;
|
|
51
|
-
inspect(): any;
|
|
52
|
-
|
|
53
|
-
// Statics
|
|
54
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Mnemonist Queue Typings
|
|
59
|
-
* ========================
|
|
60
|
-
*/
|
|
61
|
-
declare class Queue<T> implements Iterable<T> {
|
|
62
|
-
|
|
63
|
-
// Members
|
|
64
|
-
size: number;
|
|
65
|
-
|
|
66
|
-
// Constructor
|
|
67
|
-
constructor();
|
|
68
|
-
|
|
69
|
-
// Methods
|
|
70
|
-
clear(): void;
|
|
71
|
-
enqueue(item: T): number;
|
|
72
|
-
dequeue(): T | undefined;
|
|
73
|
-
peek(): T | undefined;
|
|
74
|
-
forEach(callback: (item: T, index: number, queue: this) => void, scope?: any): void;
|
|
75
|
-
toArray(): Array<T>;
|
|
76
|
-
values(): IterableIterator<T>;
|
|
77
|
-
entries(): IterableIterator<[number, T]>;
|
|
78
|
-
[Symbol.iterator](): IterableIterator<T>;
|
|
79
|
-
toString(): string;
|
|
80
|
-
toJSON(): Array<T>;
|
|
81
|
-
inspect(): any;
|
|
82
|
-
|
|
83
|
-
// Statics
|
|
84
|
-
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>;
|
|
85
|
-
static of<I>(...items: Array<I>): Queue<I>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
interface MultiMapConstructor {
|
|
89
|
-
new <K, V>(container: SetConstructor): MultiMap<K, V, Set<V>>;
|
|
90
|
-
new <K, V>(container?: ArrayConstructor): MultiMap<K, V, V[]>;
|
|
91
|
-
|
|
92
|
-
from<K, V>(
|
|
93
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
94
|
-
Container: SetConstructor
|
|
95
|
-
): MultiMap<K, V, Set<V>>;
|
|
96
|
-
from<K, V>(
|
|
97
|
-
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
98
|
-
Container?: ArrayConstructor
|
|
99
|
-
): MultiMap<K, V, V[]>;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Mnemonist MultiMap Typings
|
|
103
|
-
* ===========================
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
interface MultiMap<K, V, C extends V[] | Set<V> = V[]> extends Iterable<[K, V]> {
|
|
107
|
-
|
|
108
|
-
// Members
|
|
109
|
-
dimension: number;
|
|
110
|
-
size: number;
|
|
111
|
-
|
|
112
|
-
// Methods
|
|
113
|
-
clear(): void;
|
|
114
|
-
set(key: K, value: V): this;
|
|
115
|
-
delete(key: K): boolean;
|
|
116
|
-
remove(key: K, value: V): boolean;
|
|
117
|
-
has(key: K): boolean;
|
|
118
|
-
get(key: K): C | undefined;
|
|
119
|
-
multiplicity(key: K): number;
|
|
120
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
121
|
-
forEachAssociation(callback: (value: C, key: K, map: this) => void, scope?: any): void;
|
|
122
|
-
keys(): IterableIterator<K>;
|
|
123
|
-
values(): IterableIterator<V>;
|
|
124
|
-
entries(): IterableIterator<[K, V]>;
|
|
125
|
-
containers(): IterableIterator<C>;
|
|
126
|
-
associations(): IterableIterator<[K, C]>;
|
|
127
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
128
|
-
inspect(): any;
|
|
129
|
-
toJSON(): any;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
declare const MultiMap: MultiMapConstructor;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Mnemonist BiMap Typings
|
|
136
|
-
* ========================
|
|
137
|
-
*/
|
|
138
|
-
declare class InverseMap<K, V> implements Iterable<[K, V]> {
|
|
139
|
-
|
|
140
|
-
// Members
|
|
141
|
-
size: number;
|
|
142
|
-
inverse: BiMap<V, K>;
|
|
143
|
-
|
|
144
|
-
// Constructor
|
|
145
|
-
constructor(original: BiMap<K, V>);
|
|
146
|
-
|
|
147
|
-
// Methods
|
|
148
|
-
clear(): void;
|
|
149
|
-
set(key: K, value: V): this;
|
|
150
|
-
delete(key: K): boolean;
|
|
151
|
-
has(key: K): boolean;
|
|
152
|
-
get(key: K): V | undefined;
|
|
153
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
154
|
-
keys(): IterableIterator<K>;
|
|
155
|
-
values(): IterableIterator<V>;
|
|
156
|
-
entries(): IterableIterator<[K, V]>;
|
|
157
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
158
|
-
inspect(): any;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
declare class BiMap<K, V> implements Iterable<[K, V]> {
|
|
162
|
-
|
|
163
|
-
// Members
|
|
164
|
-
size: number;
|
|
165
|
-
inverse: InverseMap<V, K>;
|
|
166
|
-
|
|
167
|
-
// Constructor
|
|
168
|
-
constructor();
|
|
169
|
-
|
|
170
|
-
// Methods
|
|
171
|
-
clear(): void;
|
|
172
|
-
set(key: K, value: V): this;
|
|
173
|
-
delete(key: K): boolean;
|
|
174
|
-
has(key: K): boolean;
|
|
175
|
-
get(key: K): V | undefined;
|
|
176
|
-
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
177
|
-
keys(): IterableIterator<K>;
|
|
178
|
-
values(): IterableIterator<V>;
|
|
179
|
-
entries(): IterableIterator<[K, V]>;
|
|
180
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
181
|
-
inspect(): any;
|
|
182
|
-
|
|
183
|
-
// Statics
|
|
184
|
-
static from<I, J>(iterable: Iterable<[I, J]> | {[key: string]: J}): BiMap<I, J>;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
|
|
188
|
-
declare function invariant(condition: any, message?: string): asserts condition;
|
|
189
|
-
declare function nonexhaustive(value: never): never;
|
|
190
|
-
|
|
191
|
-
declare function parentFqn<E extends string>(fqn: E): E | null;
|
|
192
|
-
declare function nameFromFqn<E extends string>(fqn: E): string;
|
|
193
|
-
/**
|
|
194
|
-
* Check if one element is an ancestor of another
|
|
195
|
-
* Composable version
|
|
196
|
-
* @signature
|
|
197
|
-
* isAncestor(another)(ancestor)
|
|
198
|
-
*/
|
|
199
|
-
declare function isAncestor<A extends string | {
|
|
200
|
-
id: string;
|
|
201
|
-
}>(another: NoInfer<A>): (ancestor: A) => boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Check if one element is an ancestor of another
|
|
204
|
-
* @signature
|
|
205
|
-
* isAncestor(ancestor, another)
|
|
206
|
-
*/
|
|
207
|
-
declare function isAncestor<A extends string | {
|
|
208
|
-
id: string;
|
|
209
|
-
}>(ancestor: A, another: A): boolean;
|
|
210
|
-
declare function isSameHierarchy<T extends string>(one: NoInfer<T> | WithId<NoInfer<T>>): (another: T | WithId<T>) => boolean;
|
|
211
|
-
declare function isSameHierarchy<T extends string>(one: T | WithId<T>, another: T | WithId<T>): boolean;
|
|
212
|
-
type WithId<T = string> = {
|
|
213
|
-
id: T;
|
|
214
|
-
};
|
|
215
|
-
declare function isDescendantOf<T extends string>(ancestor: WithId<T>): (descedant: WithId<T>) => boolean;
|
|
216
|
-
declare function isDescendantOf<T extends string>(descedant: WithId<T>, ancestor: WithId<T>): boolean;
|
|
217
|
-
/**
|
|
218
|
-
* How deep in the hierarchy the element is.
|
|
219
|
-
* Root element has depth 1
|
|
220
|
-
*/
|
|
221
|
-
declare function hierarchyLevel<E extends string | {
|
|
222
|
-
id: Fqn;
|
|
223
|
-
}>(elementOfFqn: E): number;
|
|
224
|
-
/**
|
|
225
|
-
* Calculate the distance as number of steps from one element to another, i.e.
|
|
226
|
-
* going up to the common ancestor, then going down to the other element.
|
|
227
|
-
* Sibling distance is always 1
|
|
228
|
-
*
|
|
229
|
-
* Can be used for hierarchical clustering
|
|
230
|
-
*/
|
|
231
|
-
declare function hierarchyDistance<E extends string | {
|
|
232
|
-
id: Fqn;
|
|
233
|
-
}>(one: E, another: E): number;
|
|
234
|
-
declare function commonAncestor<E extends string>(first: E, second: E): E | null;
|
|
235
|
-
/**
|
|
236
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
237
|
-
* going up from parent to the root
|
|
238
|
-
*/
|
|
239
|
-
declare function ancestorsFqn<Id extends string>(fqn: Id): Id[];
|
|
240
|
-
/**
|
|
241
|
-
* Compares two fully qualified names (fqns) hierarchically based on their depth.
|
|
242
|
-
* From parent nodes to leaves
|
|
243
|
-
*
|
|
244
|
-
* @param {string} a - The first fqn to compare.
|
|
245
|
-
* @param {string} b - The second fqn to compare.
|
|
246
|
-
* @returns {number} - 0 if the fqns have the same depth.
|
|
247
|
-
* - Positive number if a is deeper than b.
|
|
248
|
-
* - Negative number if b is deeper than a.
|
|
249
|
-
*/
|
|
250
|
-
declare function compareFqnHierarchically<T extends string = string>(a: T, b: T): -1 | 0 | 1;
|
|
251
|
-
declare function compareByFqnHierarchically<T extends {
|
|
252
|
-
id: string;
|
|
253
|
-
}>(a: T, b: T): -1 | 0 | 1;
|
|
254
|
-
/**
|
|
255
|
-
* Sorts an array of objects hierarchically based on their fully qualified names (FQN).
|
|
256
|
-
* Objects are sorted by the number of segments in their FQN (defined by dot-separated ID).
|
|
257
|
-
*
|
|
258
|
-
* @typeParam T - Object type that contains an 'id' string property
|
|
259
|
-
* @typeParam A - Type extending IterableContainer of T
|
|
260
|
-
*
|
|
261
|
-
* @param array - Array of objects to be sorted
|
|
262
|
-
* @returns A new array with items sorted by their FQN hierarchy depth (number of segments)
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```ts
|
|
266
|
-
* const items = [
|
|
267
|
-
* { id: "a.b.c" },
|
|
268
|
-
* { id: "a" },
|
|
269
|
-
* { id: "a.b" }
|
|
270
|
-
* ];
|
|
271
|
-
* sortByFqnHierarchically(items);
|
|
272
|
-
* // Result: [
|
|
273
|
-
* // { id: "a" },
|
|
274
|
-
* // { id: "a.b" },
|
|
275
|
-
* // { id: "a.b.c" }
|
|
276
|
-
* // ]
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
declare function sortByFqnHierarchically<T extends {
|
|
280
|
-
id: string;
|
|
281
|
-
}, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
282
|
-
/**
|
|
283
|
-
* Keeps initial order of the elements, but ensures that parents are before children
|
|
284
|
-
*/
|
|
285
|
-
declare function sortParentsFirst<T extends {
|
|
286
|
-
id: string;
|
|
287
|
-
}, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
288
|
-
/**
|
|
289
|
-
* Sorts an array of objects naturally by their fully qualified name (FQN) identifier.
|
|
290
|
-
*
|
|
291
|
-
* @template T - Type of objects containing an 'id' string property
|
|
292
|
-
* @template A - Type extending IterableContainer of T
|
|
293
|
-
*
|
|
294
|
-
* @param first - Optional. Either the array to sort or the sort direction ('asc'|'desc')
|
|
295
|
-
* @param sort - Optional. The sort direction ('asc'|'desc'). Defaults to 'asc' if not specified
|
|
296
|
-
*
|
|
297
|
-
* @example
|
|
298
|
-
* // As a function that returns a sorting function
|
|
299
|
-
* const sorted = sortNaturalByFqn('desc')(myArray);
|
|
300
|
-
*
|
|
301
|
-
* // Direct array sorting
|
|
302
|
-
* const sorted = sortNaturalByFqn(myArray, 'desc');
|
|
303
|
-
*/
|
|
304
|
-
declare function sortNaturalByFqn(sort?: 'asc' | 'desc'): <I extends WithId<string>, A extends IterableContainer<I>>(array: A) => ReorderedArray<A>;
|
|
305
|
-
declare function sortNaturalByFqn<A extends IterableContainer<WithId>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
|
|
306
|
-
|
|
307
|
-
declare function isString(value: unknown): value is string;
|
|
308
|
-
declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
|
|
309
|
-
declare function hasProp<T extends object, P extends keyof T & string>(value: T, path: P): value is SetRequired<SetNonNullable<T, P>, P>;
|
|
310
|
-
type Guard<N = unknown> = (n: unknown) => n is N;
|
|
311
|
-
type Guarded<G> = G extends Guard<infer N> ? N : never;
|
|
312
|
-
/**
|
|
313
|
-
* Creates a type guard that checks if a value matches any of the provided predicates.
|
|
314
|
-
*
|
|
315
|
-
* @template Predicates - A non-empty array of guard functions
|
|
316
|
-
* @param predicates - The guard functions to test against
|
|
317
|
-
* @returns A type guard function that returns true if the value matches any of the predicates
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* ```typescript
|
|
321
|
-
* const isStringOrNumber = isAnyOf(isString, isNumber);
|
|
322
|
-
*
|
|
323
|
-
* if (isStringOrNumber(value)) {
|
|
324
|
-
* // value is now typed as string | number
|
|
325
|
-
* console.log(value);
|
|
326
|
-
* }
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
declare function isAnyOf<const Predicates extends NonEmptyArray<Guard>>(...predicates: Predicates): (value: unknown) => value is Guarded<Predicates[number]>;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Saves the value returned by fn() in a hidden property tag of obj object, so next time memoizeProp() is called,
|
|
333
|
-
* that value will be returned, and fn won't be called.
|
|
334
|
-
*
|
|
335
|
-
* @example
|
|
336
|
-
* ```ts
|
|
337
|
-
* class Model {
|
|
338
|
-
* // using same Symbol
|
|
339
|
-
* get computed1() {
|
|
340
|
-
* return memoizeProp(this, Symbol.for('computed1'), () => doOnce())
|
|
341
|
-
* }
|
|
342
|
-
* // using string
|
|
343
|
-
* get computed2() {
|
|
344
|
-
* return memoizeProp(this, 'computed2', () => doOnce())
|
|
345
|
-
* }
|
|
346
|
-
*
|
|
347
|
-
* }
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
350
|
-
declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag: Tag, fn: () => Res): Res;
|
|
351
|
-
|
|
352
|
-
export { BiMap as B, DefaultWeakMap as D, LinkedList as L, MultiMap as M, Queue as Q, ancestorsFqn as a, isAncestor as b, isDescendantOf as c, isNonEmptyArray as d, isSameHierarchy as e, isString as f, nonexhaustive as g, hasProp as h, invariant as i, nonNullable as j, sortParentsFirst as k, commonAncestor as l, memoizeProp as m, nameFromFqn as n, compareByFqnHierarchically as o, parentFqn as p, compareFqnHierarchically as q, hierarchyDistance as r, sortNaturalByFqn as s, hierarchyLevel as t, sortByFqnHierarchically as u, isAnyOf as v };
|