@tspro/ts-utils-lib 2.2.1 → 3.0.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/index.d.mts DELETED
@@ -1,1541 +0,0 @@
1
- type EnumObject = Record<string, string | number>;
2
- type EnumKey<E extends EnumObject> = keyof E;
3
- type EnumValue<E extends EnumObject> = E[EnumKey<E>];
4
- declare function getEnumKeys<E extends EnumObject>(e: E): EnumKey<E>[];
5
- declare function getEnumValues<E extends EnumObject>(e: E): EnumValue<E>[];
6
- declare function getEnumEntries<E extends EnumObject>(e: E): [keyof E, EnumValue<E>][];
7
- declare function getEnumKey<E extends EnumObject>(e: E, value: EnumValue<E>): keyof E | undefined;
8
- declare function forEachEnum<E extends EnumObject>(e: E, callback: (key: keyof E, value: E[keyof E]) => void): void;
9
-
10
- type index$8_EnumKey<E extends EnumObject> = EnumKey<E>;
11
- type index$8_EnumObject = EnumObject;
12
- type index$8_EnumValue<E extends EnumObject> = EnumValue<E>;
13
- declare const index$8_forEachEnum: typeof forEachEnum;
14
- declare const index$8_getEnumEntries: typeof getEnumEntries;
15
- declare const index$8_getEnumKey: typeof getEnumKey;
16
- declare const index$8_getEnumKeys: typeof getEnumKeys;
17
- declare const index$8_getEnumValues: typeof getEnumValues;
18
- declare namespace index$8 {
19
- export { type index$8_EnumKey as EnumKey, type index$8_EnumObject as EnumObject, type index$8_EnumValue as EnumValue, index$8_forEachEnum as forEachEnum, index$8_getEnumEntries as getEnumEntries, index$8_getEnumKey as getEnumKey, index$8_getEnumKeys as getEnumKeys, index$8_getEnumValues as getEnumValues };
20
- }
21
-
22
- type ErrorConstructor = new (msg: string) => Error;
23
- declare function setErrorClass(errorClass?: ErrorConstructor): void;
24
- declare function assert<T>(condition: T, msg?: string): void;
25
- declare function require<T>(val: T | null | undefined, msg?: string): T;
26
- declare function requireDefined<T>(val: T | undefined, msg?: string): T;
27
- declare function requireElement<E>(index: unknown, array: ReadonlyArray<E>, msg?: string): E;
28
- declare function fail(msg?: string): never;
29
- declare function isStrictEqual$1<T = any>(val1: T, val2: unknown, msg?: string): T;
30
- declare function isDeepEqual$1<T = any>(val1: T, val2: unknown, msg?: string): T;
31
- declare function isUndefined$1(val: unknown, msg?: string): undefined;
32
- declare function isNull$1(val: unknown, msg?: string): null;
33
- declare function isNullish$1(val: unknown, msg?: string): null | undefined;
34
- declare function isDefined$1<T>(val: T, msg?: string): Exclude<T, undefined>;
35
- declare function isNonNull$1<T>(val: T, msg?: string): Exclude<T, null>;
36
- declare function isObject$1(val: unknown, msg?: string): Record<string, unknown>;
37
- declare function isEmptyObject$1(val: unknown, msg?: string): Record<string, unknown>;
38
- declare function isPlainObject$1(val: unknown, msg?: string): Record<string, unknown>;
39
- declare function isObjectOrUndefined$1(val: unknown, msg?: string): Record<string, unknown> | undefined;
40
- declare function isTypedObject$1<T extends object>(val: unknown, keys: (keyof T)[], msg?: string): HasProps<T>;
41
- declare function isArray$1<T>(val: unknown, msg?: string): T[];
42
- declare function isArrayOrUndefined$1(val: unknown, msg?: string): val is unknown[] | undefined;
43
- declare function isEmptyArray$1<T = any>(val: T[], msg?: string): asserts val is T[];
44
- declare function isNonEmptyArray$1<T = any>(val: T[], msg?: string): asserts val is T[];
45
- declare function isEmptyArrayOrUndefined$1<T = any>(val: unknown, msg?: string): asserts val is T[] | undefined;
46
- declare function isNonEmptyArrayOrUndefined$1<T = any>(val: unknown, msg?: string): asserts val is T[] | undefined;
47
- declare function isString$1(val: unknown, msg?: string): string;
48
- declare function isEmptyString$1(val: unknown, msg?: string): "";
49
- declare function isNonEmptyString$1(val: unknown, msg?: string): string;
50
- declare function isStringOrUndefined$1(val: unknown, msg?: string): string | undefined;
51
- declare function isEmptyStringOrUndefined$1(val: unknown, msg?: string): "" | undefined;
52
- declare function isNonEmptyStringOrUndefined$1(val: unknown, msg?: string): string | undefined;
53
- declare function isBoolean$1(val: unknown, msg?: string): boolean;
54
- declare function isBooleanOrUndefined$1(val: unknown, msg?: string): boolean | undefined;
55
- declare function isTrue$1(val: unknown, msg?: string): true;
56
- declare function isTrueOrUndefined$1(val: unknown, msg?: string): true | undefined;
57
- declare function isFalse$1(val: unknown, msg?: string): false;
58
- declare function isFalseOrUndefined$1(val: unknown, msg?: string): false | undefined;
59
- declare function isFunction$1<T extends (...args: any[]) => any>(val: unknown, msg?: string): T;
60
- declare function isFunctionOrUndefined$1<T extends (...args: any[]) => any>(val: unknown, msg?: string): T | undefined;
61
- declare function isEnumValue$1<E extends EnumObject>(val: unknown, enumObject: E, msg?: string): E[keyof E];
62
- declare function isEnumValueOrUndefined$1<E extends EnumObject>(val: unknown, enumObject: E, msg?: string): E[keyof E] | undefined;
63
- declare function isNumericString$1(val: unknown, msg?: string): string;
64
- declare function isBigInt$1(val: unknown, msg?: string): BigInt;
65
- declare function isNumber$1(val: unknown, msg?: string): number;
66
- declare function isSafeNumber$1(val: unknown, msg?: string): number;
67
- declare function isNumberOrUndefined$1(val: unknown, msg?: string): number | undefined;
68
- declare function isNumberEq$1(val: unknown, ref: unknown, msg?: string): number;
69
- declare function isNumberGt$1(val: unknown, ref: unknown, msg?: string): number;
70
- declare function isNumberGte$1(val: unknown, ref: unknown, msg?: string): number;
71
- declare function isNumberLt$1(val: unknown, ref: unknown, msg?: string): number;
72
- declare function isNumberLte$1(val: unknown, ref: unknown, msg?: string): number;
73
- declare function isNumberBetween$1(val: unknown, min: unknown, max: unknown, msg?: string): number;
74
- declare function isNumberBetweenExclusive$1(val: unknown, min: unknown, max: unknown, msg?: string): number;
75
- declare function isFinite$1(val: unknown, msg?: string): number;
76
- declare function isFloat$1(val: unknown, msg?: string): number;
77
- declare function isInteger$1(val: unknown, msg?: string): number;
78
- declare function isSafeInteger$1(val: unknown, msg?: string): number;
79
- declare function isIntegerOrUndefined$1(val: unknown, msg?: string): number | undefined;
80
- declare function isIntegerEq$1(val: unknown, ref: unknown, msg?: string): number;
81
- declare function isIntegerGt$1(val: unknown, ref: unknown, msg?: string): number;
82
- declare function isIntegerGte$1(val: unknown, ref: unknown, msg?: string): number;
83
- declare function isIntegerLt$1(val: unknown, ref: unknown, msg?: string): number;
84
- declare function isIntegerLte$1(val: unknown, ref: unknown, msg?: string): number;
85
- declare function isIntegerBetween$1(val: unknown, min: unknown, max: unknown, msg?: string): number;
86
- declare function isIntegerBetweenExclusive$1(val: unknown, min: unknown, max: unknown, msg?: string): number;
87
- declare function isNaNValue$1(val: unknown, msg?: string): number;
88
- declare function isInfinity$1(val: unknown, msg?: string): number;
89
- declare function isPosInfinity$1(val: unknown, msg?: string): number;
90
- declare function isNegInfinity$1(val: unknown, msg?: string): number;
91
- declare function isPos$1(val: unknown, msg?: string): number;
92
- declare function isNeg$1(val: unknown, msg?: string): number;
93
- declare function isNonPos$1(val: unknown, msg?: string): number;
94
- declare function isNonNeg$1(val: unknown, msg?: string): number;
95
- declare function isZero$1(val: unknown, msg?: string): number;
96
- declare function isPosZero$1(val: unknown, msg?: string): number;
97
- declare function isNegZero$1(val: unknown, msg?: string): number;
98
- declare function isOdd$1(val: unknown, msg?: string): number;
99
- declare function isEven$1(val: unknown, msg?: string): number;
100
- declare function isMultipleOf$1(val: unknown, base: unknown, msg?: string): number;
101
- declare function isPowerOfTwo$1(val: unknown, msg?: string): number;
102
- declare function isIncluded$1<T>(val: unknown, arr: ReadonlyArray<T> | Set<T>, msg?: string): T;
103
- declare function isIndex$1<T>(index: unknown, msg?: string): number;
104
- declare function isIndex$1<T>(index: unknown, arr: ReadonlyArray<T>, msg?: string): number;
105
- declare function doesThrow$1(throwTestFn: () => void, msg?: string): true;
106
- declare function doesNotThrow$1(throwTestFn: () => void, msg?: string): true;
107
-
108
- type index$7_ErrorConstructor = ErrorConstructor;
109
- declare const index$7_assert: typeof assert;
110
- declare const index$7_fail: typeof fail;
111
- declare const index$7_require: typeof require;
112
- declare const index$7_requireDefined: typeof requireDefined;
113
- declare const index$7_requireElement: typeof requireElement;
114
- declare const index$7_setErrorClass: typeof setErrorClass;
115
- declare namespace index$7 {
116
- export { type index$7_ErrorConstructor as ErrorConstructor, index$7_assert as assert, doesNotThrow$1 as doesNotThrow, doesThrow$1 as doesThrow, index$7_fail as fail, isArray$1 as isArray, isArrayOrUndefined$1 as isArrayOrUndefined, isBigInt$1 as isBigInt, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isDefined$1 as isDefined, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyObject$1 as isEmptyObject, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEven$1 as isEven, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFloat$1 as isFloat, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isIndex$1 as isIndex, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isMultipleOf$1 as isMultipleOf, isNaNValue$1 as isNaNValue, isNeg$1 as isNeg, isNegInfinity$1 as isNegInfinity, isNegZero$1 as isNegZero, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNonNeg$1 as isNonNeg, isNonNull$1 as isNonNull, isNonPos$1 as isNonPos, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberEq$1 as isNumberEq, isNumberGt$1 as isNumberGt, isNumberGte$1 as isNumberGte, isNumberLt$1 as isNumberLt, isNumberLte$1 as isNumberLte, isNumberOrUndefined$1 as isNumberOrUndefined, isNumericString$1 as isNumericString, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOdd$1 as isOdd, isPlainObject$1 as isPlainObject, isPos$1 as isPos, isPosInfinity$1 as isPosInfinity, isPosZero$1 as isPosZero, isPowerOfTwo$1 as isPowerOfTwo, isSafeInteger$1 as isSafeInteger, isSafeNumber$1 as isSafeNumber, isStrictEqual$1 as isStrictEqual, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, isZero$1 as isZero, index$7_require as require, index$7_requireDefined as requireDefined, index$7_requireElement as requireElement, index$7_setErrorClass as setErrorClass };
117
- }
118
-
119
- /**
120
- * Set expiration time for cookies.
121
- * @param days - Number of days until cookies expire.
122
- */
123
- declare function setExpireDays(days: number): void;
124
- /**
125
- * Is consent pending (cookies not yet accepted)?
126
- * @returns
127
- */
128
- declare function isConsentPending(): boolean;
129
- /**
130
- * Consent cookies.
131
- */
132
- declare function accept(): void;
133
- /**
134
- * Decline cookies. This will reject all cookies than a single flags that cookies have been declined.
135
- */
136
- declare function decline(): void;
137
- /**
138
- * Save a cookie.
139
- * @param name - Cookie name.
140
- * @param value - Cookie value, can be string, number or boolean.
141
- * @returns - Returns given value.
142
- */
143
- declare function save<T extends string | number | boolean>(name: string, value: T): T;
144
- /**
145
- * Read a string cookie.
146
- * @param name - Cookie name.
147
- * @param defaultValue - Default value returned when cookie with given name was not found.
148
- * @returns - String cookie value.
149
- */
150
- declare function read(name: string, defaultValue: string): string;
151
- /**
152
- * Read an integer cookie.
153
- * @param name - Cookie name.
154
- * @param defaultValue - Default value returned when cookie with given name was not found.
155
- * @returns - Integer cookie valus.
156
- */
157
- declare function readInt(name: string, defaultValue: number): number;
158
- /**
159
- * Read a boolean cookie.
160
- * @param name - Cookie name.
161
- * @param defaultValue - Default value returned when cookie with given name was not found.
162
- * @returns - Boolean cookie value.
163
- */
164
- declare function readBool(name: string, defaultValue: boolean): boolean;
165
- /**
166
- * Erase cookie.
167
- * @param name - Name of cookie to be erased.
168
- */
169
- declare function erase(name: string): void;
170
- /**
171
- * Erase all cookies.
172
- */
173
- declare function eraseAll(): void;
174
-
175
- declare const cookies_accept: typeof accept;
176
- declare const cookies_decline: typeof decline;
177
- declare const cookies_erase: typeof erase;
178
- declare const cookies_eraseAll: typeof eraseAll;
179
- declare const cookies_isConsentPending: typeof isConsentPending;
180
- declare const cookies_read: typeof read;
181
- declare const cookies_readBool: typeof readBool;
182
- declare const cookies_readInt: typeof readInt;
183
- declare const cookies_save: typeof save;
184
- declare const cookies_setExpireDays: typeof setExpireDays;
185
- declare namespace cookies {
186
- export { cookies_accept as accept, cookies_decline as decline, cookies_erase as erase, cookies_eraseAll as eraseAll, cookies_isConsentPending as isConsentPending, cookies_read as read, cookies_readBool as readBool, cookies_readInt as readInt, cookies_save as save, cookies_setExpireDays as setExpireDays };
187
- }
188
-
189
- /** Devices dots per inch. */
190
- declare const DPI: number;
191
- /** Devices pixels per millimeter. */
192
- declare const PxPerMm: number;
193
- /** Browsers scroll bar width. */
194
- declare const ScrollbarWidth: number;
195
- /** Browsers system font size. */
196
- declare const FontSize: number;
197
- /** Is touch device? */
198
- declare const IsTouchDevice: boolean;
199
- /** Is mobile device? */
200
- declare const IsMobileDevice: boolean;
201
- /** Host address. */
202
- declare const HostAddress: string;
203
- /**
204
- * Convert pixels to millimeters on a device.
205
- * @param px - Pixels.
206
- * @returns - Millimeters.
207
- */
208
- declare function pxToMm(px: number): number;
209
- /**
210
- * Convert millimeters to pixels on a device.
211
- * @param mm - Millimeters.
212
- * @returns - Pixels.
213
- */
214
- declare function mmToPx(mm: number): number;
215
- /**
216
- * Convert input to pixels on a device. Input value is in html style form containing number
217
- * followed by unit (e.g. "10px"). Supported units are "mm", "cm", "in", "inch", "em" and "px".
218
- *
219
- * @param input - Input value.
220
- * @returns - Pixels.
221
- */
222
- declare function toPx(input: string | number): number;
223
-
224
- declare const device_DPI: typeof DPI;
225
- declare const device_FontSize: typeof FontSize;
226
- declare const device_HostAddress: typeof HostAddress;
227
- declare const device_IsMobileDevice: typeof IsMobileDevice;
228
- declare const device_IsTouchDevice: typeof IsTouchDevice;
229
- declare const device_PxPerMm: typeof PxPerMm;
230
- declare const device_ScrollbarWidth: typeof ScrollbarWidth;
231
- declare const device_mmToPx: typeof mmToPx;
232
- declare const device_pxToMm: typeof pxToMm;
233
- declare const device_toPx: typeof toPx;
234
- declare namespace device {
235
- export { device_DPI as DPI, device_FontSize as FontSize, device_HostAddress as HostAddress, device_IsMobileDevice as IsMobileDevice, device_IsTouchDevice as IsTouchDevice, device_PxPerMm as PxPerMm, device_ScrollbarWidth as ScrollbarWidth, device_mmToPx as mmToPx, device_pxToMm as pxToMm, device_toPx as toPx };
236
- }
237
-
238
- type HasProps<T extends object> = T extends Record<string, unknown> ? T : never;
239
- declare function isStrictEqual(val1: unknown, val2: unknown): boolean;
240
- declare function isDeepEqual(val1: unknown, val2: unknown): boolean;
241
- declare function isUndefined(val: unknown): val is undefined;
242
- declare function isNull(val: unknown): val is null;
243
- declare function isNullish(val: unknown): val is null | undefined;
244
- declare function isDefined<T>(val: T): val is Exclude<T, undefined>;
245
- declare function isNonNull<T>(val: T): val is Exclude<T, null>;
246
- declare function isObject(val: unknown): val is Record<string, unknown>;
247
- declare function isEmptyObject(val: unknown): val is Record<string, never>;
248
- declare function isObjectOrUndefined(val: unknown): val is Record<string, unknown> | undefined;
249
- declare function isPlainObject(val: unknown): val is Record<string, unknown>;
250
- declare function isTypedObject<T extends object>(val: unknown, keys: (keyof T)[]): val is HasProps<T>;
251
- declare function isArray<T>(arr: T[] | unknown): arr is T[];
252
- declare function isArrayOrUndefined(arr: unknown): arr is unknown[] | undefined;
253
- declare function isEmptyArray<T>(arr: T[] | unknown): arr is T[] & {
254
- length: 0;
255
- };
256
- declare function isNonEmptyArray<T>(arr: T[] | unknown): arr is T[];
257
- declare function isEmptyArrayOrUndefined<T>(arr: T[] | unknown): arr is T[] | undefined;
258
- declare function isNonEmptyArrayOrUndefined<T>(arr: T[] | unknown): arr is T[] | undefined;
259
- declare function isString(val: unknown): val is string;
260
- declare function isEmptyString(val: unknown): val is "";
261
- declare function isNonEmptyString(val: unknown): val is string;
262
- declare function isStringOrUndefined(val: unknown): val is string | undefined;
263
- declare function isEmptyStringOrUndefined(val: unknown): val is "" | undefined;
264
- declare function isNonEmptyStringOrUndefined(val: unknown): val is string | undefined;
265
- declare function isBoolean(val: unknown): val is boolean;
266
- declare function isBooleanOrUndefined(val: unknown): val is boolean | undefined;
267
- declare function isTrue(val: unknown): val is true;
268
- declare function isTrueOrUndefined(val: unknown): val is true | undefined;
269
- declare function isFalse(val: unknown): val is false;
270
- declare function isFalseOrUndefined(val: unknown): val is false | undefined;
271
- declare function isFunction<T extends (...args: any[]) => any>(val: unknown): val is T;
272
- declare function isFunctionOrUndefined(val: unknown): val is ((...args: any[]) => any) | undefined;
273
- declare function isEnumValue<E extends EnumObject>(val: unknown, enumObj: E): val is E[keyof E];
274
- declare function isEnumValueOrUndefined<E extends EnumObject>(val: unknown, enumObj: E): val is E[keyof E] | undefined;
275
- declare function isNumericString(val: unknown): val is string;
276
- declare function isBigInt(val: unknown): val is BigInt;
277
- declare function isNumber(val: unknown): val is number;
278
- declare function isSafeNumber(val: unknown): val is number;
279
- declare function isNumberOrUndefined(val: unknown): val is number | undefined;
280
- declare function isNumberEq(val: unknown, ref: unknown): val is number;
281
- declare function isNumberGt(val: unknown, ref: unknown): val is number;
282
- declare function isNumberGte(val: unknown, ref: unknown): val is number;
283
- declare function isNumberLt(val: unknown, ref: unknown): val is number;
284
- declare function isNumberLte(val: unknown, ref: unknown): val is number;
285
- declare function isNumberBetween(val: unknown, min: unknown, max: unknown): val is number;
286
- declare function isNumberBetweenExclusive(val: unknown, min: unknown, max: unknown): val is number;
287
- declare function isFinite(val: unknown): val is number;
288
- declare function isFloat(val: unknown): val is number;
289
- declare function isInteger(val: unknown): val is number;
290
- declare function isSafeInteger(val: unknown): val is number;
291
- declare function isIntegerOrUndefined(val: unknown): val is number | undefined;
292
- declare function isIntegerEq(val: unknown, ref: unknown): val is number;
293
- declare function isIntegerGt(val: unknown, ref: unknown): val is number;
294
- declare function isIntegerGte(val: unknown, ref: unknown): val is number;
295
- declare function isIntegerLt(val: unknown, ref: unknown): val is number;
296
- declare function isIntegerLte(val: unknown, ref: unknown): val is number;
297
- declare function isIntegerBetween(val: unknown, min: unknown, max: unknown): val is number;
298
- declare function isIntegerBetweenExclusive(val: unknown, min: unknown, max: unknown): val is number;
299
- declare function isNaNValue(val: unknown): val is number;
300
- declare function isInfinity(val: unknown): val is number;
301
- declare function isPosInfinity(val: unknown): val is number;
302
- declare function isNegInfinity(val: unknown): val is number;
303
- declare function isPos(val: unknown): val is number;
304
- declare function isNeg(val: unknown): val is number;
305
- declare function isNonPos(val: unknown): val is number;
306
- declare function isNonNeg(val: unknown): val is number;
307
- declare function isZero(val: unknown): val is number;
308
- declare function isPosZero(val: unknown): val is number;
309
- declare function isNegZero(val: unknown): val is number;
310
- declare function isOdd(val: unknown): val is number;
311
- declare function isEven(val: unknown): val is number;
312
- declare function isMultipleOf(val: unknown, base: unknown): val is number;
313
- declare function isPowerOfTwo(val: unknown): val is number;
314
- declare function isIncluded<T>(val: unknown, container: ReadonlyArray<T> | Set<T>): val is T;
315
- declare function isIndex<T>(index: unknown, array?: ReadonlyArray<T>): index is number;
316
- declare function doesThrow(throwTestFn: () => void): boolean;
317
- declare function doesNotThrow(throwTestFn: () => void): boolean;
318
- declare function tryOr<TRY_RVAL, OR_RVAL>(tryFn: () => TRY_RVAL, orVal: OR_RVAL | (() => OR_RVAL)): TRY_RVAL | OR_RVAL;
319
-
320
- type index$6_HasProps<T extends object> = HasProps<T>;
321
- declare const index$6_doesNotThrow: typeof doesNotThrow;
322
- declare const index$6_doesThrow: typeof doesThrow;
323
- declare const index$6_isArray: typeof isArray;
324
- declare const index$6_isArrayOrUndefined: typeof isArrayOrUndefined;
325
- declare const index$6_isBigInt: typeof isBigInt;
326
- declare const index$6_isBoolean: typeof isBoolean;
327
- declare const index$6_isBooleanOrUndefined: typeof isBooleanOrUndefined;
328
- declare const index$6_isDeepEqual: typeof isDeepEqual;
329
- declare const index$6_isDefined: typeof isDefined;
330
- declare const index$6_isEmptyArray: typeof isEmptyArray;
331
- declare const index$6_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
332
- declare const index$6_isEmptyObject: typeof isEmptyObject;
333
- declare const index$6_isEmptyString: typeof isEmptyString;
334
- declare const index$6_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
335
- declare const index$6_isEnumValue: typeof isEnumValue;
336
- declare const index$6_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
337
- declare const index$6_isEven: typeof isEven;
338
- declare const index$6_isFalse: typeof isFalse;
339
- declare const index$6_isFalseOrUndefined: typeof isFalseOrUndefined;
340
- declare const index$6_isFinite: typeof isFinite;
341
- declare const index$6_isFloat: typeof isFloat;
342
- declare const index$6_isFunction: typeof isFunction;
343
- declare const index$6_isFunctionOrUndefined: typeof isFunctionOrUndefined;
344
- declare const index$6_isIncluded: typeof isIncluded;
345
- declare const index$6_isIndex: typeof isIndex;
346
- declare const index$6_isInfinity: typeof isInfinity;
347
- declare const index$6_isInteger: typeof isInteger;
348
- declare const index$6_isIntegerBetween: typeof isIntegerBetween;
349
- declare const index$6_isIntegerBetweenExclusive: typeof isIntegerBetweenExclusive;
350
- declare const index$6_isIntegerEq: typeof isIntegerEq;
351
- declare const index$6_isIntegerGt: typeof isIntegerGt;
352
- declare const index$6_isIntegerGte: typeof isIntegerGte;
353
- declare const index$6_isIntegerLt: typeof isIntegerLt;
354
- declare const index$6_isIntegerLte: typeof isIntegerLte;
355
- declare const index$6_isIntegerOrUndefined: typeof isIntegerOrUndefined;
356
- declare const index$6_isMultipleOf: typeof isMultipleOf;
357
- declare const index$6_isNaNValue: typeof isNaNValue;
358
- declare const index$6_isNeg: typeof isNeg;
359
- declare const index$6_isNegInfinity: typeof isNegInfinity;
360
- declare const index$6_isNegZero: typeof isNegZero;
361
- declare const index$6_isNonEmptyArray: typeof isNonEmptyArray;
362
- declare const index$6_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
363
- declare const index$6_isNonEmptyString: typeof isNonEmptyString;
364
- declare const index$6_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
365
- declare const index$6_isNonNeg: typeof isNonNeg;
366
- declare const index$6_isNonNull: typeof isNonNull;
367
- declare const index$6_isNonPos: typeof isNonPos;
368
- declare const index$6_isNull: typeof isNull;
369
- declare const index$6_isNullish: typeof isNullish;
370
- declare const index$6_isNumber: typeof isNumber;
371
- declare const index$6_isNumberBetween: typeof isNumberBetween;
372
- declare const index$6_isNumberBetweenExclusive: typeof isNumberBetweenExclusive;
373
- declare const index$6_isNumberEq: typeof isNumberEq;
374
- declare const index$6_isNumberGt: typeof isNumberGt;
375
- declare const index$6_isNumberGte: typeof isNumberGte;
376
- declare const index$6_isNumberLt: typeof isNumberLt;
377
- declare const index$6_isNumberLte: typeof isNumberLte;
378
- declare const index$6_isNumberOrUndefined: typeof isNumberOrUndefined;
379
- declare const index$6_isNumericString: typeof isNumericString;
380
- declare const index$6_isObject: typeof isObject;
381
- declare const index$6_isObjectOrUndefined: typeof isObjectOrUndefined;
382
- declare const index$6_isOdd: typeof isOdd;
383
- declare const index$6_isPlainObject: typeof isPlainObject;
384
- declare const index$6_isPos: typeof isPos;
385
- declare const index$6_isPosInfinity: typeof isPosInfinity;
386
- declare const index$6_isPosZero: typeof isPosZero;
387
- declare const index$6_isPowerOfTwo: typeof isPowerOfTwo;
388
- declare const index$6_isSafeInteger: typeof isSafeInteger;
389
- declare const index$6_isSafeNumber: typeof isSafeNumber;
390
- declare const index$6_isStrictEqual: typeof isStrictEqual;
391
- declare const index$6_isString: typeof isString;
392
- declare const index$6_isStringOrUndefined: typeof isStringOrUndefined;
393
- declare const index$6_isTrue: typeof isTrue;
394
- declare const index$6_isTrueOrUndefined: typeof isTrueOrUndefined;
395
- declare const index$6_isTypedObject: typeof isTypedObject;
396
- declare const index$6_isUndefined: typeof isUndefined;
397
- declare const index$6_isZero: typeof isZero;
398
- declare const index$6_tryOr: typeof tryOr;
399
- declare namespace index$6 {
400
- export { type index$6_HasProps as HasProps, index$6_doesNotThrow as doesNotThrow, index$6_doesThrow as doesThrow, index$6_isArray as isArray, index$6_isArrayOrUndefined as isArrayOrUndefined, index$6_isBigInt as isBigInt, index$6_isBoolean as isBoolean, index$6_isBooleanOrUndefined as isBooleanOrUndefined, index$6_isDeepEqual as isDeepEqual, index$6_isDefined as isDefined, index$6_isEmptyArray as isEmptyArray, index$6_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, index$6_isEmptyObject as isEmptyObject, index$6_isEmptyString as isEmptyString, index$6_isEmptyStringOrUndefined as isEmptyStringOrUndefined, index$6_isEnumValue as isEnumValue, index$6_isEnumValueOrUndefined as isEnumValueOrUndefined, index$6_isEven as isEven, index$6_isFalse as isFalse, index$6_isFalseOrUndefined as isFalseOrUndefined, index$6_isFinite as isFinite, index$6_isFloat as isFloat, index$6_isFunction as isFunction, index$6_isFunctionOrUndefined as isFunctionOrUndefined, index$6_isIncluded as isIncluded, index$6_isIndex as isIndex, index$6_isInfinity as isInfinity, index$6_isInteger as isInteger, index$6_isIntegerBetween as isIntegerBetween, index$6_isIntegerBetweenExclusive as isIntegerBetweenExclusive, index$6_isIntegerEq as isIntegerEq, index$6_isIntegerGt as isIntegerGt, index$6_isIntegerGte as isIntegerGte, index$6_isIntegerLt as isIntegerLt, index$6_isIntegerLte as isIntegerLte, index$6_isIntegerOrUndefined as isIntegerOrUndefined, index$6_isMultipleOf as isMultipleOf, index$6_isNaNValue as isNaNValue, index$6_isNeg as isNeg, index$6_isNegInfinity as isNegInfinity, index$6_isNegZero as isNegZero, index$6_isNonEmptyArray as isNonEmptyArray, index$6_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, index$6_isNonEmptyString as isNonEmptyString, index$6_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, index$6_isNonNeg as isNonNeg, index$6_isNonNull as isNonNull, index$6_isNonPos as isNonPos, index$6_isNull as isNull, index$6_isNullish as isNullish, index$6_isNumber as isNumber, index$6_isNumberBetween as isNumberBetween, index$6_isNumberBetweenExclusive as isNumberBetweenExclusive, index$6_isNumberEq as isNumberEq, index$6_isNumberGt as isNumberGt, index$6_isNumberGte as isNumberGte, index$6_isNumberLt as isNumberLt, index$6_isNumberLte as isNumberLte, index$6_isNumberOrUndefined as isNumberOrUndefined, index$6_isNumericString as isNumericString, index$6_isObject as isObject, index$6_isObjectOrUndefined as isObjectOrUndefined, index$6_isOdd as isOdd, index$6_isPlainObject as isPlainObject, index$6_isPos as isPos, index$6_isPosInfinity as isPosInfinity, index$6_isPosZero as isPosZero, index$6_isPowerOfTwo as isPowerOfTwo, index$6_isSafeInteger as isSafeInteger, index$6_isSafeNumber as isSafeNumber, index$6_isStrictEqual as isStrictEqual, index$6_isString as isString, index$6_isStringOrUndefined as isStringOrUndefined, index$6_isTrue as isTrue, index$6_isTrueOrUndefined as isTrueOrUndefined, index$6_isTypedObject as isTypedObject, index$6_isUndefined as isUndefined, index$6_isZero as isZero, index$6_tryOr as tryOr };
401
- }
402
-
403
- declare function toArray<T>(a: T | T[]): T[];
404
- declare function duplicate<T>(a: ReadonlyArray<T> | undefined): T[];
405
- declare function removeDuplicates<T>(arr: ReadonlyArray<T>, compareFn?: (a: T, b: T) => boolean): Array<T>;
406
- declare function fillArray<T>(fillValue: T, fillCount: number): T[];
407
- declare function mapSequenceArray<T>(len: number, fn: (i: number) => T): T[];
408
- declare function getSequenceArray(len: number): number[];
409
- declare function mapRangeArray<T>(start: number, end: number, fn: (i: number) => T): T[];
410
- declare function getRangeArray(start: number, end: number): number[];
411
- declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
412
- declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
413
-
414
- declare const index$5_arrayContains: typeof arrayContains;
415
- declare const index$5_chunckArray: typeof chunckArray;
416
- declare const index$5_duplicate: typeof duplicate;
417
- declare const index$5_fillArray: typeof fillArray;
418
- declare const index$5_getRangeArray: typeof getRangeArray;
419
- declare const index$5_getSequenceArray: typeof getSequenceArray;
420
- declare const index$5_isArray: typeof isArray;
421
- declare const index$5_mapRangeArray: typeof mapRangeArray;
422
- declare const index$5_mapSequenceArray: typeof mapSequenceArray;
423
- declare const index$5_removeDuplicates: typeof removeDuplicates;
424
- declare const index$5_toArray: typeof toArray;
425
- declare namespace index$5 {
426
- export { index$5_arrayContains as arrayContains, index$5_chunckArray as chunckArray, index$5_duplicate as duplicate, index$5_fillArray as fillArray, index$5_getRangeArray as getRangeArray, index$5_getSequenceArray as getSequenceArray, index$5_isArray as isArray, index$5_mapRangeArray as mapRangeArray, index$5_mapSequenceArray as mapSequenceArray, index$5_removeDuplicates as removeDuplicates, index$5_toArray as toArray };
427
- }
428
-
429
- interface CSSProperties {
430
- padding?: string | number;
431
- paddingLeft?: string | number;
432
- paddingRight?: string | number;
433
- paddingTop?: string | number;
434
- paddingBottom?: string | number;
435
- left?: string | number;
436
- right?: string | number;
437
- top?: string | number;
438
- bottom?: string | number;
439
- width?: string | number;
440
- height?: string | number;
441
- }
442
- declare function hasClass(el: HTMLElement, className: string): boolean;
443
- declare function addClass(el: HTMLElement, className: string): void;
444
- declare function removeClass(el: HTMLElement, className: string): void;
445
- declare function setOffset(el: HTMLElement, left: number, top: number, unit?: string): void;
446
- declare function getOffset(el: HTMLElement): {
447
- left: number;
448
- top: number;
449
- };
450
- declare function getWidth(el: HTMLElement | Window): number;
451
- declare function setWidth(el: HTMLElement, val: number): void;
452
- declare function getHeight(el: HTMLElement | Window): number;
453
- declare function setHeight(el: HTMLElement, val: number): void;
454
- declare function appendTo(el: HTMLElement | SVGElement, to: HTMLElement | SVGElement): void;
455
- declare function removeFromParent(el: HTMLElement | SVGElement): void;
456
- declare function setVisibility(el: HTMLElement | SVGElement, visible: boolean): void;
457
- declare function setRect(el: HTMLElement, left: number, top: number, width: number, height: number, unit?: string): void;
458
- declare function getButton(btn: HTMLElement | string): HTMLButtonElement | undefined;
459
- declare function getCanvas(canvas: HTMLElement | string): HTMLCanvasElement | undefined;
460
- declare function getPadding(style?: CSSProperties): {
461
- top: number;
462
- right: number;
463
- bottom: number;
464
- left: number;
465
- };
466
- declare function getDimension(style?: CSSProperties): {
467
- left: number | undefined;
468
- top: number | undefined;
469
- width: number | undefined;
470
- height: number | undefined;
471
- };
472
- declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
473
- declare function getCanvasTextWidth(text: string, font: string): number;
474
-
475
- type index$4_CSSProperties = CSSProperties;
476
- declare const index$4_addClass: typeof addClass;
477
- declare const index$4_appendTo: typeof appendTo;
478
- declare const index$4_getButton: typeof getButton;
479
- declare const index$4_getCanvas: typeof getCanvas;
480
- declare const index$4_getCanvasTextWidth: typeof getCanvasTextWidth;
481
- declare const index$4_getDimension: typeof getDimension;
482
- declare const index$4_getHeight: typeof getHeight;
483
- declare const index$4_getOffset: typeof getOffset;
484
- declare const index$4_getPadding: typeof getPadding;
485
- declare const index$4_getWidth: typeof getWidth;
486
- declare const index$4_hasClass: typeof hasClass;
487
- declare const index$4_removeClass: typeof removeClass;
488
- declare const index$4_removeFromParent: typeof removeFromParent;
489
- declare const index$4_setHeight: typeof setHeight;
490
- declare const index$4_setOffset: typeof setOffset;
491
- declare const index$4_setRect: typeof setRect;
492
- declare const index$4_setVisibility: typeof setVisibility;
493
- declare const index$4_setWidth: typeof setWidth;
494
- declare const index$4_styleLayoutChanged: typeof styleLayoutChanged;
495
- declare namespace index$4 {
496
- export { type index$4_CSSProperties as CSSProperties, index$4_addClass as addClass, index$4_appendTo as appendTo, index$4_getButton as getButton, index$4_getCanvas as getCanvas, index$4_getCanvasTextWidth as getCanvasTextWidth, index$4_getDimension as getDimension, index$4_getHeight as getHeight, index$4_getOffset as getOffset, index$4_getPadding as getPadding, index$4_getWidth as getWidth, index$4_hasClass as hasClass, index$4_removeClass as removeClass, index$4_removeFromParent as removeFromParent, index$4_setHeight as setHeight, index$4_setOffset as setOffset, index$4_setRect as setRect, index$4_setVisibility as setVisibility, index$4_setWidth as setWidth, index$4_styleLayoutChanged as styleLayoutChanged };
497
- }
498
-
499
- declare function linearToDecibels(linearVolume: number): number;
500
- declare function mod(m: number, n: number): number;
501
- /**
502
- * Convert number to roman number.
503
- * https://blog.stevenlevithan.com/archives/javascript-roman-numeral-converter
504
- */
505
- declare function romanize(n: number): string;
506
- declare function toOrdinalNumber(n: number): string;
507
- declare function interpolateCoord(startX: number, startY: number, endX: number, endY: number, t: number): {
508
- x: number;
509
- y: number;
510
- };
511
- declare function interpolateY(startX: number, startY: number, endX: number, endY: number, x: number): number;
512
- declare function clamp(num: number, min: number, max: number): number;
513
- declare function calcNormal(x1: number, y1: number, x2: number, y2: number): {
514
- nx: number;
515
- ny: number;
516
- };
517
- declare function sum(arr: number[]): number;
518
- declare function avg(...values: number[]): number;
519
- declare function cmp(a: number, b: number): -1 | 0 | 1;
520
-
521
- declare const index$3_avg: typeof avg;
522
- declare const index$3_calcNormal: typeof calcNormal;
523
- declare const index$3_clamp: typeof clamp;
524
- declare const index$3_cmp: typeof cmp;
525
- declare const index$3_interpolateCoord: typeof interpolateCoord;
526
- declare const index$3_interpolateY: typeof interpolateY;
527
- declare const index$3_isInteger: typeof isInteger;
528
- declare const index$3_isNumber: typeof isNumber;
529
- declare const index$3_linearToDecibels: typeof linearToDecibels;
530
- declare const index$3_mod: typeof mod;
531
- declare const index$3_romanize: typeof romanize;
532
- declare const index$3_sum: typeof sum;
533
- declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
534
- declare namespace index$3 {
535
- export { index$3_avg as avg, index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_cmp as cmp, index$3_interpolateCoord as interpolateCoord, index$3_interpolateY as interpolateY, index$3_isInteger as isInteger, index$3_isNumber as isNumber, index$3_linearToDecibels as linearToDecibels, index$3_mod as mod, index$3_romanize as romanize, index$3_sum as sum, index$3_toOrdinalNumber as toOrdinalNumber };
536
- }
537
-
538
- /**
539
- * ```ts
540
- * // Gives type Record<string, unknown>
541
- * hasProperties(obj, ["a", "b"]);
542
- *
543
- * // Gives type Record<"a" | "b", unknown>
544
- * hasProperties(obj, ["a", "b"] as const);
545
- * ```
546
- */
547
- declare function hasProperties<T extends readonly string[]>(obj: unknown, props: T | string[]): obj is Record<T[number], unknown>;
548
- declare function deepEqual<T>(a: T, b: T): boolean;
549
- declare function getCtorName(obj: any): string;
550
-
551
- declare const index$2_deepEqual: typeof deepEqual;
552
- declare const index$2_getCtorName: typeof getCtorName;
553
- declare const index$2_hasProperties: typeof hasProperties;
554
- declare const index$2_isObject: typeof isObject;
555
- declare namespace index$2 {
556
- export { index$2_deepEqual as deepEqual, index$2_getCtorName as getCtorName, index$2_hasProperties as hasProperties, index$2_isObject as isObject };
557
- }
558
-
559
- /**
560
- * toCharArray("abc") => ["a", "b", "c"].
561
- * @param str
562
- */
563
- declare function toCharArray(str: string): string[];
564
- /**
565
- * repeat("abc", 3) => "abcabcabc".
566
- * repeat("abc", 0) => "".
567
- * @param repeatString
568
- * @param repeatCount
569
- */
570
- declare function repeatString(repeatString: string, repeatCount: number): string;
571
- /**
572
- * "abcdefgh":chunkSize = 3 => ["abc", "def", "gh"]
573
- * @param str
574
- * @param chunkSize
575
- */
576
- declare function chunkString(str: string, chunkSize: number): string[];
577
- /**
578
- * Replaces part of string.
579
- * @param str
580
- * @param pos
581
- * @param removeCount
582
- * @param insert
583
- */
584
- declare function replaceAt(str: string, pos: number, removeCount: number, insert: string): string;
585
- /**
586
- * Insert string to another.
587
- * @param str
588
- * @param pos
589
- * @param insertStr
590
- */
591
- declare function insertAt(str: string, pos: number, insertStr: string): string;
592
- /**
593
- * Remove part of string.
594
- * @param str
595
- * @param pos
596
- * @param removeCount
597
- */
598
- declare function removeAt(str: string, pos: number, removeCount: number): string;
599
- /**
600
- * Count number of char in string.
601
- * @param str
602
- * @param ch - must be single char.
603
- * @returns number of chars in string.
604
- */
605
- declare function charCount(str: string, ch: string): number;
606
- /**
607
- * "UndeclaredVariable" => "Undeclared variable"
608
- * @param PascalString
609
- */
610
- declare function makeSentenceFromPascal(PascalString: string): string;
611
- declare function stringify(value: any, maxDepth?: number, seen?: WeakSet<WeakKey>): string;
612
- /**
613
- * Splits a string into words by capital letters (A–Z).
614
- *
615
- * Example:
616
- * ```ts
617
- * splitByCaps("HelloWorld"); // ["Hello", "World"]
618
- * splitByCaps("XMLHttpRequest"); // ["XML", "Http", "Request"]
619
- * ```
620
- *
621
- * @param str - The input string to split.
622
- * @returns An array of string segments split at capital letters.
623
- */
624
- declare function splitByCaps(str: string): string[];
625
- /**
626
- * Splits a string by any of the given substrings.
627
- * Each splitter is treated literally (special regex characters are escaped).
628
- *
629
- * Example:
630
- * ```ts
631
- * splitByStrings("one--two__three", "--", "__");
632
- * // ["one", "two", "three"]
633
- * ```
634
- *
635
- * @param str - The input string to split.
636
- * @param splitters - One or more substrings to split by.
637
- * @returns An array of string segments split at any of the given substrings.
638
- */
639
- declare function splitByStrings(str: string, ...splitters: string[]): string[];
640
- /**
641
- * Splits a string by any of the given characters.
642
- *
643
- * Example:
644
- * ```ts
645
- * splitByChars("a,b;c", ",;");
646
- * // ["a", "b", "c"]
647
- * ```
648
- *
649
- * @param str - The input string to split.
650
- * @param splitters - A string containing one or more characters to split by.
651
- * @returns An array of string segments split at any of the given characters.
652
- */
653
- declare function splitByChars(str: string, splitters: string): string[];
654
-
655
- declare const index$1_charCount: typeof charCount;
656
- declare const index$1_chunkString: typeof chunkString;
657
- declare const index$1_insertAt: typeof insertAt;
658
- declare const index$1_isString: typeof isString;
659
- declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
660
- declare const index$1_removeAt: typeof removeAt;
661
- declare const index$1_repeatString: typeof repeatString;
662
- declare const index$1_replaceAt: typeof replaceAt;
663
- declare const index$1_splitByCaps: typeof splitByCaps;
664
- declare const index$1_splitByChars: typeof splitByChars;
665
- declare const index$1_splitByStrings: typeof splitByStrings;
666
- declare const index$1_stringify: typeof stringify;
667
- declare const index$1_toCharArray: typeof toCharArray;
668
- declare namespace index$1 {
669
- export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_splitByCaps as splitByCaps, index$1_splitByChars as splitByChars, index$1_splitByStrings as splitByStrings, index$1_stringify as stringify, index$1_toCharArray as toCharArray };
670
- }
671
-
672
- declare namespace index {
673
- export { index$5 as Arr, index$4 as Dom, index$8 as Enum, index$3 as Math, index$2 as Obj, index$1 as Str };
674
- }
675
-
676
- type EqualityFn<V> = (a: V, b: V) => boolean;
677
- declare const DefaultEqualityFn: EqualityFn<any>;
678
- interface KVComponent<K extends any[], VALUE> {
679
- get size(): number;
680
- isEmpty(): boolean;
681
- has(...keys: K): boolean;
682
- get(...keys: K): VALUE | undefined;
683
- getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
684
- getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
685
- set(...keysAndValue: [...K, VALUE]): void;
686
- delete(...keys: K): boolean;
687
- clear?(): void;
688
- toString(): string;
689
- kvValues(): IterableIterator<VALUE>;
690
- kvKeys(): IterableIterator<K>;
691
- kvEntries(): IterableIterator<[K, VALUE]>;
692
- }
693
- declare abstract class BaseContainer {
694
- abstract toString(): string;
695
- }
696
-
697
- /**
698
- * This is a stack data structure.
699
- */
700
- declare class Stack<T> extends BaseContainer {
701
- private readonly data;
702
- constructor();
703
- private assertId;
704
- get length(): number;
705
- push(el: T): T;
706
- pop(): T;
707
- popOrUndef(): T | undefined;
708
- popOr(defaultValueOrCreator: T | (() => T)): T;
709
- top(): T;
710
- topOrUndef(): T | undefined;
711
- topOr(defaultValueOrCreator: T | (() => T)): T;
712
- peek(depth?: number): T;
713
- peekOrUndef(depth?: number): T | undefined;
714
- peekOr(depth: number | undefined, defaultValueOrCreator: T | (() => T)): T;
715
- values(): IterableIterator<T>;
716
- [Symbol.iterator](): IterableIterator<T>;
717
- toArray(): T[];
718
- isEmpty(): boolean;
719
- clear(): void;
720
- toString(): string;
721
- }
722
-
723
- /**
724
- * `Vec` is a generic vector class with two or more coordinates.
725
- *
726
- * ```ts
727
- * // Example usage:
728
- * const a = new Vec(1, 2);
729
- * const b = new Vec(3, 4);
730
- *
731
- * console.log(a.add(b).toString()); // Vec(4, 6)
732
- * console.log(a.add(3, 3).toString()); // Vec(4, 5)
733
- * console.log(a.mul(2).toString()); // Vec(2, 4)
734
- * console.log(a.equals(b)); // false
735
- * console.log(a.clone().equals(a)); // true
736
- * ```
737
- */
738
- declare class Vec extends BaseContainer {
739
- readonly coords: number[];
740
- constructor(...coords: number[]);
741
- static vec2(x: number, y: number): Vec;
742
- static vec3(x: number, y: number, z: number): Vec;
743
- static zero(dim: number): Vec;
744
- get dim(): number;
745
- get length(): number;
746
- magnitude(): number;
747
- get x(): number;
748
- get y(): number;
749
- get z(): number;
750
- add(other: Vec): Vec;
751
- add(...coords: number[]): Vec;
752
- sub(other: Vec): Vec;
753
- sub(...coords: number[]): Vec;
754
- mul(scalar: number): Vec;
755
- div(scalar: number): Vec;
756
- dot(other: Vec): number;
757
- distance(other: Vec): number;
758
- normalize(): Vec;
759
- static lerp(a: Vec, b: Vec, t: number): Vec;
760
- toLength(len: number): Vec;
761
- clamp(minLength?: number, maxLength?: number, defaultDir?: Vec): Vec;
762
- equals(other: Vec): boolean;
763
- clone(): Vec;
764
- toObject(): {
765
- x: number;
766
- y: number;
767
- z: number;
768
- };
769
- [Symbol.iterator](): ArrayIterator<number>;
770
- toString(): string;
771
- }
772
-
773
- /**
774
- * An immutable 2D rectangle defined by its top-left corner (x, y) and size (width, height).
775
- * Provides geometric utilities like intersection, containment, scaling, etc.
776
- */
777
- declare class Rect {
778
- x: number;
779
- y: number;
780
- width: number;
781
- height: number;
782
- constructor();
783
- constructor(width: number, height: number);
784
- constructor(x: number, y: number, width: number, height: number);
785
- set(): Rect;
786
- set(width: number, height: number): Rect;
787
- set(x: number, y: number, width: number, height: number): Rect;
788
- static fromPoints(p1: {
789
- x: number;
790
- y: number;
791
- }, p2: {
792
- x: number;
793
- y: number;
794
- }): Rect;
795
- static fromCenter(cx: number, cy: number, width: number, height: number): Rect;
796
- get left(): number;
797
- get top(): number;
798
- get right(): number;
799
- get bottom(): number;
800
- get centerX(): number;
801
- get centerY(): number;
802
- get center(): {
803
- x: number;
804
- y: number;
805
- };
806
- get area(): number;
807
- get isEmpty(): boolean;
808
- containsPoint(px: number, py: number): boolean;
809
- containsRect(other: Rect): boolean;
810
- intersects(other: Rect): boolean;
811
- intersectionCopy(other: Rect): Rect;
812
- unionCopy(other: Rect): Rect;
813
- insetCopy(dx: number, dy: number): Rect;
814
- inflateCopy(dx: number, dy: number): Rect;
815
- offsetInPlace(dx: number, dy: number): Rect;
816
- offsetCopy(dx: number, dy: number): Rect;
817
- scaleInPlace(scaleX: number, scaleY?: number): Rect;
818
- scaleCopy(scaleX: number, scaleY?: number): Rect;
819
- roundCopy(): Rect;
820
- floorCopy(): Rect;
821
- ceilCopy(): Rect;
822
- expandCopy(px: number, py: number): Rect;
823
- equals(other: Rect): boolean;
824
- clone(): Rect;
825
- toString(): string;
826
- toAnchoredRect(): AnchoredRect;
827
- }
828
-
829
- /**
830
- * A mutable AnchoredRect class is a rectangle (left, top, right, bottom) with an anchor point (anchorX, anchorY).
831
- */
832
- declare class AnchoredRect {
833
- left: number;
834
- anchorX: number;
835
- right: number;
836
- top: number;
837
- anchorY: number;
838
- bottom: number;
839
- /**
840
- * Create rectangle with all zero values.
841
- */
842
- constructor();
843
- /**
844
- * Create rectangle with left, right, top, bottom.
845
- * Properties anchorX and anchorY will be centered in the middle.
846
- *
847
- * @param left - Left coordinate.
848
- * @param right - Right coordinate.
849
- * @param top - Top coordinate.
850
- * @param bottom - Bottom coordinate.
851
- */
852
- constructor(left: number, right: number, top: number, bottom: number);
853
- /**
854
- * Create rectangle with full arguments.
855
- *
856
- * @param left - Left coordinate.
857
- * @param anchorX - Center x-coordinate.
858
- * @param right - Right coordinate.
859
- * @param top - Top coordinate.
860
- * @param anchorY - Center y-coordinate.
861
- * @param bottom - Bottom coordinate.
862
- */
863
- constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
864
- /**
865
- * Set rectangle with all zero values.
866
- */
867
- set(): AnchoredRect;
868
- /**
869
- * Set rectangle with left, right, top, bottom.
870
- * Properties anchorX and anchorY will be centered in the middle.
871
- *
872
- * @param left - Left coordinate.
873
- * @param right - Right coordinate.
874
- * @param top - Top coordinate.
875
- * @param bottom - Bottom coordinate.
876
- */
877
- set(left: number, right: number, top: number, bottom: number): AnchoredRect;
878
- /**
879
- * Set rectangle with full arguments.
880
- *
881
- * @param left - Left coordinate.
882
- * @param anchorX - Center x-coordinate.
883
- * @param right - Right coordinate.
884
- * @param top - Top coordinate.
885
- * @param anchorY - Center y-coordinate.
886
- * @param bottom - Bottom coordinate.
887
- */
888
- set(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number): AnchoredRect;
889
- /**
890
- * Create rect from basic left, top, width and height arguments.
891
- *
892
- * @param left - Left coordinate.
893
- * @param top - Top coordinate.
894
- * @param width - Width.
895
- * @param height - Height.
896
- * @returns - AnchoredRect.
897
- */
898
- static create(left: number, top: number, width: number, height: number): AnchoredRect;
899
- /**
900
- * Create rect from anchorX, anchorY, width, height arguments.
901
- *
902
- * @param centerX - Center x-coordinate.
903
- * @param centerY - Center y-coordinate.
904
- * @param width - Width.
905
- * @param height - Height.
906
- * @returns - AnchoredRect.
907
- */
908
- static createCentered(centerX: number, centerY: number, width: number, height: number): AnchoredRect;
909
- /**
910
- * Create rect from sections.
911
- *
912
- * @param leftw - Left section width.
913
- * @param rightw - Right section width.
914
- * @param toph - Top section height.
915
- * @param bottomh - Bottomsection height.
916
- * @returns - AnchoredRect.
917
- */
918
- static createSections(leftw: number, rightw: number, toph: number, bottomh: number): AnchoredRect;
919
- /**
920
- * Get center x-coordinate.
921
- */
922
- get centerX(): number;
923
- /**
924
- * Get center ycoordinate.
925
- */
926
- get centerY(): number;
927
- /**
928
- * Width getter.
929
- */
930
- get width(): number;
931
- /**
932
- * Height getter.
933
- */
934
- get height(): number;
935
- /**
936
- * Left section width getter.
937
- */
938
- get leftw(): number;
939
- /**
940
- * Right section width getter.
941
- */
942
- get rightw(): number;
943
- /**
944
- * Top section height getter.
945
- */
946
- get toph(): number;
947
- /**
948
- * Bottom section height getter.
949
- */
950
- get bottomh(): number;
951
- /**
952
- * Does this Rect contain given (x, y)-point?
953
- *
954
- * @param x - X-coordinate.
955
- * @param y - Y-coordinate.
956
- * @returns - True/false.
957
- */
958
- contains(x: number, y: number): boolean;
959
- /**
960
- * Do a and b rects overlap?
961
- *
962
- * @param a - AnchoredRect a.
963
- * @param b - AnchoredRect b.
964
- * @returns - True/false.
965
- */
966
- static overlap(a: AnchoredRect, b: AnchoredRect): boolean;
967
- /**
968
- * Do horizontal measures of a and b rects overlap?
969
- *
970
- * @param a - AnchoredRect a.
971
- * @param b - AnchoredRect b.
972
- * @returns - True/false.
973
- */
974
- static overlapX(a: AnchoredRect, b: AnchoredRect): boolean;
975
- /**
976
- * Check if given rects are equal.
977
- * @param a - AnchoredRect a.
978
- * @param b - AnchoredRect b.
979
- * @returns - True/false.
980
- */
981
- static equals(a: AnchoredRect | null | undefined, b: AnchoredRect | null | undefined): boolean;
982
- /**
983
- * Check if this rect equals with another rect.
984
- * @param other - The other rect.
985
- * @returns - True/false.
986
- */
987
- equals(other: AnchoredRect): boolean;
988
- /**
989
- * Check if edges of given rects are equal, ignoring anchorX and anchorY.
990
- *
991
- * @param a - AnchoredRect a.
992
- * @param b - AnchoredRect b.
993
- * @returns - True/false.
994
- */
995
- static equalsEdges(a: AnchoredRect | null | undefined, b: AnchoredRect | null | undefined): boolean;
996
- /**
997
- * Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
998
- *
999
- * @param other - The other AnchoredRect.
1000
- * @returns - True/false.
1001
- */
1002
- equalsEdges(other: AnchoredRect): boolean;
1003
- /**
1004
- * Created duplicate of this Rect.
1005
- * @returns - Duplicate.
1006
- */
1007
- clone(): AnchoredRect;
1008
- /**
1009
- * Move this rect by (dx, dy). Modifies this Rect.
1010
- *
1011
- * @param dx - Offset amount in x-direction.
1012
- * @param dy - Offset amount in y-direction.
1013
- * @returns - This AnchoredRect instance.
1014
- */
1015
- offsetInPlace(dx: number, dy: number): AnchoredRect;
1016
- /**
1017
- * Move this rect by (dx, dy). Immutable, returns modified copy.
1018
- *
1019
- * @param dx - Offset amount in x-direction.
1020
- * @param dy - Offset amount in y-direction.
1021
- * @returns - AnchoredRect copy with applied offset.
1022
- */
1023
- offsetCopy(dx: number, dy: number): AnchoredRect;
1024
- /**
1025
- * Expand this Rect by given Rect. Modifies this Rect.
1026
- *
1027
- * @param rect - AnchoredRect to expand this instance with.
1028
- * @returns - This AnchoredRect instance.
1029
- */
1030
- expandInPlace(rect: AnchoredRect): AnchoredRect;
1031
- /**
1032
- * Expand this Rect by given Rect. Immutable, returns modified copy.
1033
- *
1034
- * @param rect - AnchoredRect to expand this instance with.
1035
- * @returns - Expanded copy of this AnchoredRect.
1036
- */
1037
- expandCopy(rect: AnchoredRect): AnchoredRect;
1038
- /**
1039
- * Clip this Rect by given Rect. Mmodifies this Rect.
1040
- *
1041
- * @param clipRect - AnchoredRect to clip this instance with.
1042
- * @returns - This AnchoredRect instance.
1043
- */
1044
- clipInPlace(clipRect: AnchoredRect): AnchoredRect;
1045
- /**
1046
- * Clip this Rect by given Rect. Immutable, return modified copy.
1047
- *
1048
- * @param clipRect - AnchoredRecto to clip this instance with.
1049
- * @returns - Clipped AnchoredRect copy.
1050
- */
1051
- clipCopy(clipRect: AnchoredRect): AnchoredRect;
1052
- /**
1053
- * Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
1054
- *
1055
- * @param scaleX - Scale x-amount.
1056
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
1057
- * @returns This AnchoredRect instance.
1058
- */
1059
- scaleInPlace(scaleX: number, scaleY?: number): AnchoredRect;
1060
- /**
1061
- * Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
1062
- *
1063
- * @param scaleX - Scale x-amount.
1064
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
1065
- * @returns Scaled copy of this AnchoredRect.
1066
- */
1067
- scaleCopy(scaleX: number, scaleY?: number): AnchoredRect;
1068
- /**
1069
- * Get this AnchoredRect instance.
1070
- * @returns - This AnchoredRect instance.
1071
- */
1072
- getRect(): AnchoredRect;
1073
- toRect(): Rect;
1074
- toString(): string;
1075
- }
1076
-
1077
- /**
1078
- * LRUCache is an implementation of least recently used cache with a fixed capacity.
1079
- */
1080
- declare class LRUCache<K extends string, V> extends BaseContainer {
1081
- private cache;
1082
- private next;
1083
- private prev;
1084
- private head;
1085
- private tail;
1086
- private capacity;
1087
- private size;
1088
- private maxKeyLength;
1089
- constructor(maxSize: number, maxKeyLength?: number);
1090
- get(key: K): V | undefined;
1091
- set(key: K, value: V): void;
1092
- private touch;
1093
- private evict;
1094
- private removeKey;
1095
- private addToTail;
1096
- keys(): IterableIterator<K>;
1097
- values(): IterableIterator<V>;
1098
- entries(): IterableIterator<[K, V]>;
1099
- [Symbol.iterator](): IterableIterator<[K, V]>;
1100
- toString(): string;
1101
- }
1102
-
1103
- /**
1104
- * `IndexArray` is a sparse array with non-negative indexes. It stores values
1105
- * to indexes, and each index also has flag telling it has a value.
1106
- */
1107
- declare class IndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
1108
- private static validateIndex;
1109
- private posVal;
1110
- private hasPos;
1111
- private valCount;
1112
- constructor();
1113
- constructor(arr: IndexArray<VALUE>);
1114
- constructor(entries: Iterable<[number, VALUE]>);
1115
- private get posLen();
1116
- get size(): number;
1117
- get length(): number;
1118
- private trimRight;
1119
- isEmpty(): boolean;
1120
- has(id: number): boolean;
1121
- set(id: number, value: VALUE): void;
1122
- get(id: number): VALUE | undefined;
1123
- getOrDefault(id: number, defaultValue: VALUE): VALUE;
1124
- getOrCreate(id: number, value: VALUE): VALUE;
1125
- getOrCreate(id: number, creator: () => VALUE): VALUE;
1126
- delete(id: number): boolean;
1127
- clear(): void;
1128
- forEach(callbackfn: (value: VALUE, id: number, arr: IndexArray<VALUE>) => void, thisArg?: any): void;
1129
- indices(): IterableIterator<number>;
1130
- values(): IterableIterator<VALUE>;
1131
- entries(): IterableIterator<[number, VALUE]>;
1132
- indicesArray(): number[];
1133
- valuesArray(): VALUE[];
1134
- entriesArray(): [number, VALUE][];
1135
- kvKeys(): IterableIterator<[number]>;
1136
- kvValues(): IterableIterator<VALUE>;
1137
- kvEntries(): IterableIterator<[[number], VALUE]>;
1138
- [Symbol.iterator](): IterableIterator<[number, VALUE]>;
1139
- clone(): IndexArray<VALUE>;
1140
- merge(other: IndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
1141
- some(fn: (value: VALUE, id: number) => boolean): boolean;
1142
- every(fn: (value: VALUE, key1: number) => boolean): boolean;
1143
- filter<S extends VALUE>(predicate: (value: VALUE, index: number, array: IndexArray<VALUE>) => value is S): IndexArray<S>;
1144
- filter(predicate: (value: VALUE, index: number, array: IndexArray<VALUE>) => unknown): IndexArray<VALUE>;
1145
- reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
1146
- reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
1147
- mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
1148
- map<R = VALUE>(fn: (value: VALUE, key1: number) => R): IndexArray<R>;
1149
- equals(other: IndexArray<VALUE>): boolean;
1150
- equals(other: IndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
1151
- toArray(): VALUE[];
1152
- toString(): string;
1153
- }
1154
-
1155
- /**
1156
- * `IndexArray` is a sparse array with positive and negative indexes. It stores
1157
- * values to indexes, and each index also has flag telling it has a value.
1158
- */
1159
- declare class SignedIndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
1160
- private static toNegIndex;
1161
- private static validateIndex;
1162
- private posVal;
1163
- private hasPos;
1164
- private negVal;
1165
- private hasNeg;
1166
- private valCount;
1167
- constructor();
1168
- constructor(arr: SignedIndexArray<VALUE>);
1169
- constructor(entries: Iterable<[number, VALUE]>);
1170
- get size(): number;
1171
- isEmpty(): boolean;
1172
- private get posLen();
1173
- private get negLen();
1174
- has(id: number): boolean;
1175
- set(id: number, value: VALUE): void;
1176
- get(id: number): VALUE | undefined;
1177
- getOrDefault(id: number, defaultValue: VALUE): VALUE;
1178
- getOrCreate(id: number, value: VALUE): VALUE;
1179
- getOrCreate(id: number, creator: () => VALUE): VALUE;
1180
- delete(id: number): boolean;
1181
- clear(): void;
1182
- forEach(callbackfn: (value: VALUE, id: number, arr: SignedIndexArray<VALUE>) => void, thisArg?: any): void;
1183
- indices(): IterableIterator<number>;
1184
- values(): IterableIterator<VALUE>;
1185
- entries(): IterableIterator<[number, VALUE]>;
1186
- indicesArray(): number[];
1187
- valuesArray(): VALUE[];
1188
- entriesArray(): [number, VALUE][];
1189
- kvKeys(): IterableIterator<[number]>;
1190
- kvValues(): IterableIterator<VALUE>;
1191
- kvEntries(): IterableIterator<[[number], VALUE]>;
1192
- [Symbol.iterator](): IterableIterator<[number, VALUE]>;
1193
- clone(): SignedIndexArray<VALUE>;
1194
- merge(other: SignedIndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
1195
- some(fn: (value: VALUE, id: number) => boolean): boolean;
1196
- every(fn: (value: VALUE, key1: number) => boolean): boolean;
1197
- filter<S extends VALUE>(predicate: (value: VALUE, index: number, array: SignedIndexArray<VALUE>) => value is S): SignedIndexArray<S>;
1198
- filter(predicate: (value: VALUE, index: number, array: SignedIndexArray<VALUE>) => unknown): SignedIndexArray<VALUE>;
1199
- reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
1200
- reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
1201
- mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
1202
- map<R = VALUE>(fn: (value: VALUE, key1: number) => R): SignedIndexArray<R>;
1203
- equals(other: SignedIndexArray<VALUE>): boolean;
1204
- equals(other: SignedIndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
1205
- toArray(): VALUE[];
1206
- toString(): string;
1207
- }
1208
-
1209
- /**
1210
- * `DefaultArray` is an array list where every index is guaranteed to have a value.
1211
- * There are no undefineds unless that is part of the value type.
1212
- * When you create `DefaultArray` you give a default value. For example if you
1213
- * delete an index then that index is set to the default value.
1214
- */
1215
- declare class DefaultArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
1216
- private readonly defaultValue;
1217
- private data;
1218
- constructor(defaultValue: VALUE);
1219
- constructor(length: number, defaultValue: VALUE);
1220
- constructor(values: Iterable<VALUE>, defaultValue: VALUE);
1221
- get size(): number;
1222
- get length(): number;
1223
- private assertId;
1224
- isEmpty(): boolean;
1225
- isDefault(id: number): boolean;
1226
- isSet(id: number): boolean;
1227
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1228
- has(id: number): boolean;
1229
- set(id: number, value: VALUE): VALUE;
1230
- get(id: number): VALUE;
1231
- getOrDefault(id: number, defaultValue: VALUE): VALUE;
1232
- getOrCreate(id: number, value: VALUE): VALUE;
1233
- getOrCreate(id: number, creator: () => VALUE): VALUE;
1234
- delete(id: number): boolean;
1235
- clear(empty?: boolean): void;
1236
- forEach(callbackfn: (value: VALUE, id: number, arr: DefaultArray<VALUE>) => void, thisArg?: any): void;
1237
- indices(): IterableIterator<number>;
1238
- values(): IterableIterator<VALUE>;
1239
- entries(): IterableIterator<[number, VALUE]>;
1240
- indicesArray(): number[];
1241
- valuesArray(): VALUE[];
1242
- entriesArray(): [number, VALUE][];
1243
- kvKeys(): IterableIterator<[number]>;
1244
- kvValues(): IterableIterator<VALUE>;
1245
- kvEntries(): IterableIterator<[[number], VALUE]>;
1246
- [Symbol.iterator](): IterableIterator<[number, VALUE]>;
1247
- clone(): DefaultArray<VALUE>;
1248
- merge(other: DefaultArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
1249
- some(fn: (value: VALUE, id: number) => boolean): boolean;
1250
- every(fn: (value: VALUE, key1: number) => boolean): boolean;
1251
- filter<S extends VALUE>(predicate: (value: VALUE, id: number, array: DefaultArray<VALUE>) => value is S): DefaultArray<S>;
1252
- filter(predicate: (value: VALUE, id: number, array: DefaultArray<VALUE>) => unknown): DefaultArray<VALUE>;
1253
- reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
1254
- reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
1255
- mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
1256
- map<R = VALUE>(fn: (value: VALUE, key1: number) => R, defaultValue: R): DefaultArray<R>;
1257
- equals(other: DefaultArray<VALUE>): boolean;
1258
- equals(other: DefaultArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
1259
- toArray(): VALUE[];
1260
- toString(): string;
1261
- }
1262
-
1263
- /**
1264
- * A Map implementation mapping a single key to a value.
1265
- */
1266
- declare class UniMap<KEY, VALUE> extends BaseContainer implements KVComponent<[KEY], VALUE> {
1267
- private map;
1268
- private keyEquals;
1269
- constructor();
1270
- constructor(equals?: EqualityFn<KEY>);
1271
- constructor(list: UniMap<KEY, VALUE> | Iterable<[KEY, VALUE]>, equals?: EqualityFn<KEY>);
1272
- static createDeep<KEY1, VALUE>(): UniMap<KEY1, VALUE>;
1273
- static createDeep<KEY1, VALUE>(set: UniMap<KEY1, VALUE>): UniMap<KEY1, VALUE>;
1274
- static createDeep<KEY1, VALUE>(entries: Iterable<[KEY1, VALUE]>): UniMap<KEY1, VALUE>;
1275
- has(key: KEY): boolean;
1276
- set(key: KEY, value: VALUE): VALUE;
1277
- get(key: KEY): VALUE | undefined;
1278
- delete(key: KEY): boolean;
1279
- getOrDefault(key: KEY, defaultValue: VALUE): VALUE;
1280
- getOrCreate(key: KEY, value: VALUE): VALUE;
1281
- getOrCreate(key: KEY, creator: () => VALUE): VALUE;
1282
- clear(): void;
1283
- get size(): number;
1284
- isEmpty(): boolean;
1285
- forEach(callbackfn: (value: VALUE, key: KEY, map1: UniMap<KEY, VALUE>) => void, thisArg?: any): void;
1286
- keys(): IterableIterator<KEY>;
1287
- values(): IterableIterator<VALUE>;
1288
- entries(): IterableIterator<[KEY, VALUE]>;
1289
- keysArray(): KEY[];
1290
- valuesArray(): VALUE[];
1291
- entriesArray(): [KEY, VALUE][];
1292
- kvKeys(): IterableIterator<[KEY]>;
1293
- kvValues(): IterableIterator<VALUE>;
1294
- kvEntries(): IterableIterator<[[KEY], VALUE]>;
1295
- [Symbol.iterator](): IterableIterator<[KEY, VALUE]>;
1296
- clone(): UniMap<KEY, VALUE>;
1297
- merge(other: UniMap<KEY, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key: KEY) => VALUE): this;
1298
- some(fn: (value: VALUE, key: KEY) => boolean): boolean;
1299
- every(fn: (value: VALUE, key: KEY) => boolean): boolean;
1300
- filter<S extends VALUE>(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => value is S): UniMap<KEY, S>;
1301
- filter(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => unknown): UniMap<KEY, VALUE>;
1302
- reduce(fn: (acc: VALUE, value: VALUE, key: KEY) => VALUE): VALUE;
1303
- reduce<R>(fn: (acc: R, value: VALUE, key: KEY) => R, init: R): R;
1304
- mapEntries<R>(fn: (value: VALUE, key: KEY) => R): R[];
1305
- mapValues<R = VALUE>(fn: (value: VALUE, key: KEY) => R): UniMap<KEY, R>;
1306
- toMap(): Map<KEY, VALUE>;
1307
- toString(): string;
1308
- }
1309
-
1310
- /**
1311
- * A Map implementation mapping a double key to a value.
1312
- */
1313
- declare class BiMap<KEY1, KEY2, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2], VALUE> {
1314
- private map1;
1315
- private key1Equals;
1316
- private key2Equals;
1317
- constructor();
1318
- constructor(biMap: BiMap<KEY1, KEY2, VALUE>);
1319
- constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
1320
- has(key1: KEY1, key2: KEY2): boolean;
1321
- set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
1322
- get(key1: KEY1, key2: KEY2): VALUE | undefined;
1323
- getOrDefault(key1: KEY1, key2: KEY2, defaultValue: VALUE): VALUE;
1324
- getOrCreate(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
1325
- getOrCreate(key1: KEY1, key2: KEY2, creator: () => VALUE): VALUE;
1326
- delete(key1: KEY1): boolean;
1327
- delete(key1: KEY1, key2: KEY2): boolean;
1328
- clear(): void;
1329
- get size(): number;
1330
- isEmpty(): boolean;
1331
- forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: BiMap<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
1332
- keys(): IterableIterator<[KEY1, KEY2]>;
1333
- values(): IterableIterator<VALUE>;
1334
- entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
1335
- keysArray(): [KEY1, KEY2][];
1336
- valuesArray(): VALUE[];
1337
- entriesArray(): [KEY1, KEY2, VALUE][];
1338
- kvKeys(): IterableIterator<[KEY1, KEY2]>;
1339
- kvValues(): IterableIterator<VALUE>;
1340
- kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
1341
- [Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
1342
- clone(): BiMap<KEY1, KEY2, VALUE>;
1343
- merge(other: BiMap<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
1344
- some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
1345
- every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
1346
- filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => value is S): BiMap<KEY1, KEY2, S>;
1347
- filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => unknown): BiMap<KEY1, KEY2, VALUE>;
1348
- reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
1349
- reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
1350
- mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
1351
- mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): BiMap<KEY1, KEY2, R>;
1352
- toMap(): Map<[KEY1, KEY2], VALUE>;
1353
- toString(): string;
1354
- }
1355
-
1356
- /**
1357
- * A Map implementation mapping a triple key to a value.
1358
- */
1359
- declare class TriMap<KEY1, KEY2, KEY3, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
1360
- private map1;
1361
- private key1Equals;
1362
- private key2Equals;
1363
- private key3Equals;
1364
- constructor();
1365
- constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
1366
- constructor(triMap: TriMap<KEY1, KEY2, KEY3, VALUE>);
1367
- has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
1368
- set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
1369
- get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
1370
- getOrDefault(key1: KEY1, key2: KEY2, key3: KEY3, defaultValue: VALUE): VALUE;
1371
- getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
1372
- getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, creator: () => VALUE): VALUE;
1373
- delete(key1: KEY1): boolean;
1374
- delete(key1: KEY1, key2: KEY2): boolean;
1375
- delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
1376
- clear(): void;
1377
- get size(): number;
1378
- isEmpty(): boolean;
1379
- forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: TriMap<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
1380
- keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
1381
- values(): IterableIterator<VALUE>;
1382
- entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
1383
- keysArray(): [KEY1, KEY2, KEY3][];
1384
- valuesArray(): VALUE[];
1385
- entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
1386
- kvKeys(): IterableIterator<[KEY1, KEY2, KEY3]>;
1387
- kvValues(): IterableIterator<VALUE>;
1388
- kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
1389
- [Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
1390
- clone(): TriMap<KEY1, KEY2, KEY3, VALUE>;
1391
- merge(other: TriMap<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
1392
- some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
1393
- every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
1394
- filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: TriMap<KEY1, KEY2, KEY3, VALUE>) => value is S): TriMap<KEY1, KEY2, KEY3, S>;
1395
- filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: TriMap<KEY1, KEY2, KEY3, VALUE>) => unknown): TriMap<KEY1, KEY2, KEY3, VALUE>;
1396
- reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
1397
- reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
1398
- mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
1399
- mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): TriMap<KEY1, KEY2, KEY3, R>;
1400
- toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
1401
- toString(): string;
1402
- }
1403
-
1404
- /**
1405
- * An implementation of a Set data structure.
1406
- */
1407
- declare class ValueSet<VALUE> extends BaseContainer implements KVComponent<[VALUE], VALUE> {
1408
- private data;
1409
- private equals;
1410
- constructor();
1411
- constructor(equals?: EqualityFn<VALUE>);
1412
- constructor(list: ValueSet<VALUE> | Iterable<VALUE>, equals?: EqualityFn<VALUE>);
1413
- static createDeep<VALUE>(): ValueSet<VALUE>;
1414
- static createDeep<VALUE>(set: ValueSet<VALUE>): ValueSet<VALUE>;
1415
- static createDeep<VALUE>(entries: Iterable<VALUE>): ValueSet<VALUE>;
1416
- has(value: VALUE): boolean;
1417
- add(value: VALUE): VALUE;
1418
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1419
- set(key: VALUE, value: VALUE): void;
1420
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1421
- get(key: VALUE): VALUE | undefined;
1422
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1423
- getOrDefault(key: VALUE, defaultValue: VALUE): VALUE;
1424
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1425
- getOrCreate(key: VALUE, value: VALUE): VALUE;
1426
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
1427
- getOrCreate(key: VALUE, creator: () => VALUE): VALUE;
1428
- delete(value: VALUE): boolean;
1429
- clear(): void;
1430
- get size(): number;
1431
- isEmpty(): boolean;
1432
- forEach(callbackfn: (value: VALUE, set: ValueSet<VALUE>) => void, thisArg?: any): void;
1433
- keys(): IterableIterator<VALUE>;
1434
- values(): IterableIterator<VALUE>;
1435
- entries(): IterableIterator<[VALUE, VALUE]>;
1436
- kvKeys(): IterableIterator<[VALUE]>;
1437
- kvValues(): IterableIterator<VALUE>;
1438
- kvEntries(): IterableIterator<[[VALUE], VALUE]>;
1439
- [Symbol.iterator](): IterableIterator<VALUE>;
1440
- clone(): ValueSet<VALUE>;
1441
- merge(other: ValueSet<VALUE>): this;
1442
- some(fn: (value: VALUE) => boolean): boolean;
1443
- every(fn: (value: VALUE) => boolean): boolean;
1444
- filter<R extends VALUE>(predicate: (value: VALUE, set: ValueSet<VALUE>) => value is R): ValueSet<R>;
1445
- filter(predicate: (value: VALUE, set1: ValueSet<VALUE>) => unknown): ValueSet<VALUE>;
1446
- reduce(fn: (acc: VALUE, value: VALUE) => VALUE): VALUE;
1447
- reduce<R = VALUE>(fn: (acc: R, value: VALUE) => R, init: R): R;
1448
- mapValues<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
1449
- mapToArray<R = VALUE>(fn: (value: VALUE) => R): R[];
1450
- map<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
1451
- toSet(): Set<VALUE>;
1452
- toArray(): VALUE[];
1453
- toString(): string;
1454
- }
1455
-
1456
- /**
1457
- * Wrapper class of a key-value container that contain array values.
1458
- */
1459
- declare class MultiContainer<K extends any[], V> extends BaseContainer {
1460
- private readonly base;
1461
- constructor(base: KVComponent<K, V[]>);
1462
- isEmpty(): boolean;
1463
- clear(): void;
1464
- add(...keysAndValue: [...K, V]): V;
1465
- remove(...keysAndValue: [...K, V]): boolean;
1466
- getAll(...keys: K): V[];
1467
- iterAll(...keys: K): IterableIterator<V>;
1468
- values(): IterableIterator<V>;
1469
- keys(): IterableIterator<K>;
1470
- entries(): IterableIterator<[K, V[]]>;
1471
- [Symbol.iterator](): IterableIterator<[K, V[]]>;
1472
- toString(): string;
1473
- }
1474
- /**
1475
- * Create a multi-container.
1476
- *
1477
- * ```ts
1478
- * // Usage:
1479
- * const multi = asMulti(new BiMap<string, string, number[]>());
1480
- * multi.add("a", "b", 5);
1481
- * multi.add("a", "b", 10);
1482
- * multi.add("a", "c", 15);
1483
- * ```
1484
- * @param base
1485
- * @returns
1486
- */
1487
- declare function asMulti<K extends any[], VALUE>(base: KVComponent<K, VALUE[]>): MultiContainer<K, VALUE>;
1488
-
1489
- declare class LinkedList<V> extends BaseContainer implements Iterable<V> {
1490
- private _head;
1491
- private _tail;
1492
- private _size;
1493
- private readonly equals;
1494
- constructor();
1495
- constructor(equals?: EqualityFn<V>);
1496
- constructor(list: LinkedList<V> | Iterable<V>, equals?: EqualityFn<V>);
1497
- static createDeep<V>(): LinkedList<V>;
1498
- static createDeep<V>(list: LinkedList<V>): LinkedList<V>;
1499
- static createDeep<V>(entries: Iterable<V>): LinkedList<V>;
1500
- get length(): number;
1501
- get first(): V | undefined;
1502
- get last(): V | undefined;
1503
- /** Add item to the end of the list */
1504
- push(value: V): void;
1505
- /** Remove item from the end of the list */
1506
- pop(): V | undefined;
1507
- /** Add item to the beginning of the list */
1508
- unshift(value: V): void;
1509
- /** Remove item from the beginning of the list */
1510
- shift(): V | undefined;
1511
- /** Check if value exists in the list */
1512
- has(value: V): boolean;
1513
- /** Get value at index (O(n/2)) */
1514
- get(index: number): V | undefined;
1515
- /** Set value at index (O(n/2)) */
1516
- set(index: number, value: V): boolean;
1517
- /** Insert value at index (O(n/2)) */
1518
- insertAt(index: number, value: V): boolean;
1519
- /** Remove value at index (O(n/2)) */
1520
- removeAt(index: number): V | undefined;
1521
- /** Remove first matching value (O(n)) */
1522
- remove(value: V): boolean;
1523
- /** Convert to array */
1524
- toArray(): V[];
1525
- /** Replace contents from array */
1526
- fromArray(values: Iterable<V>): void;
1527
- /** Clear all nodes */
1528
- clear(): void;
1529
- /** Iterator support */
1530
- [Symbol.iterator](): Iterator<V>;
1531
- keys(): IterableIterator<number>;
1532
- values(): IterableIterator<V>;
1533
- entries(): IterableIterator<[number, V]>;
1534
- toString(): string;
1535
- private nodeAt;
1536
- clone(): LinkedList<V>;
1537
- }
1538
-
1539
- declare function getLibInfo(): string;
1540
-
1541
- export { AnchoredRect, index$7 as Assert, BaseContainer, BiMap, cookies as Cookies, DefaultArray, DefaultEqualityFn, device as Device, type EqualityFn, index$6 as Guard, IndexArray, type KVComponent, LRUCache, LinkedList, MultiContainer, Rect, SignedIndexArray, Stack, TriMap, UniMap, index as Utils, ValueSet, Vec, asMulti, getLibInfo };