@tspro/ts-utils-lib 1.19.1 → 1.21.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/CHANGELOG.md +20 -0
- package/dist/index.d.mts +868 -191
- package/dist/index.d.ts +868 -191
- package/dist/index.js +1999 -294
- package/dist/index.mjs +1990 -294
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,39 +24,90 @@ declare namespace index$8 {
|
|
|
24
24
|
|
|
25
25
|
type ErrorConstructor = new (msg: string) => Error;
|
|
26
26
|
declare function setErrorClass(errorClass?: ErrorConstructor): void;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
28
31
|
declare function interrupt(msg?: string): never;
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
30
36
|
declare function assertEnum<E extends EnumObject>(enumVal: unknown, enumObj: E, name?: string): asserts enumVal is E[keyof E];
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
32
41
|
declare function int(value: unknown, msg?: string): number;
|
|
33
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
34
46
|
declare function eq<T>(value1: T, value2: T, msg?: string): T;
|
|
35
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
36
51
|
declare function int_eq(value: unknown, compareTo: unknown, msg?: string): number;
|
|
37
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
38
56
|
declare function int_lt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
39
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
40
61
|
declare function int_lte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
41
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
42
66
|
declare function int_gt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
43
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
44
71
|
declare function int_gte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
45
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
46
76
|
declare function int_between(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
47
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
48
81
|
declare function int_between_exclusive(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
49
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
50
86
|
declare function odd(value: unknown, msg?: string): number;
|
|
51
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
52
91
|
declare function even(value: unknown, msg?: string): number;
|
|
53
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
54
96
|
declare function in_group<T>(value: T, group: ReadonlyArray<T>, msg?: string): T;
|
|
55
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
56
101
|
declare function finite(value: unknown, msg?: string): number;
|
|
57
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
58
106
|
declare function array_id<T>(array: Readonly<T[]>, index: unknown, msg?: string): number;
|
|
59
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
60
111
|
declare function array_elem<T>(array: Readonly<T[]>, index: number, msg?: string): T;
|
|
61
112
|
declare function assert<T>(condition: T, msg?: string): void;
|
|
62
113
|
declare function require<T>(value: T | null | undefined, msg?: string): T;
|
|
@@ -115,6 +166,7 @@ declare function isEvenNumber$1(value: unknown, msg?: string): value is number;
|
|
|
115
166
|
declare function isIncluded$1<T>(value: T, array: ReadonlyArray<T>, msg?: string): value is T;
|
|
116
167
|
declare function isArrayIndex$1<T>(index: unknown, array: ReadonlyArray<T>, msg?: string): index is number;
|
|
117
168
|
declare function isThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
169
|
+
declare function isNotThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
118
170
|
|
|
119
171
|
type index$7_ErrorConstructor = ErrorConstructor;
|
|
120
172
|
declare const index$7_array_elem: typeof array_elem;
|
|
@@ -140,7 +192,7 @@ declare const index$7_require: typeof require;
|
|
|
140
192
|
declare const index$7_requireDefined: typeof requireDefined;
|
|
141
193
|
declare const index$7_setErrorClass: typeof setErrorClass;
|
|
142
194
|
declare namespace index$7 {
|
|
143
|
-
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_array_elem as array_elem, index$7_array_id as array_id, index$7_assert as assert, index$7_assertEnum as assertEnum, index$7_eq as eq, index$7_even as even, index$7_fail as fail, index$7_finite as finite, index$7_in_group as in_group, index$7_int as int, index$7_int_between as int_between, index$7_int_between_exclusive as int_between_exclusive, index$7_int_eq as int_eq, index$7_int_gt as int_gt, index$7_int_gte as int_gte, index$7_int_lt as int_lt, index$7_int_lte as int_lte, index$7_interrupt as interrupt, isArray$1 as isArray, isArrayIndex$1 as isArrayIndex, isArrayOrUndefined$1 as isArrayOrUndefined, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEqual$1 as isEqual, isEvenNumber$1 as isEvenNumber, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, 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, isNaNValue$1 as isNaNValue, isNegInfinity$1 as isNegInfinity, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberOrUndefined$1 as isNumberOrUndefined, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOddNumber$1 as isOddNumber, isPosInfinity$1 as isPosInfinity, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isThrowing$1 as isThrowing, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, index$7_odd as odd, index$7_require as require, index$7_requireDefined as requireDefined, index$7_setErrorClass as setErrorClass };
|
|
195
|
+
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_array_elem as array_elem, index$7_array_id as array_id, index$7_assert as assert, index$7_assertEnum as assertEnum, index$7_eq as eq, index$7_even as even, index$7_fail as fail, index$7_finite as finite, index$7_in_group as in_group, index$7_int as int, index$7_int_between as int_between, index$7_int_between_exclusive as int_between_exclusive, index$7_int_eq as int_eq, index$7_int_gt as int_gt, index$7_int_gte as int_gte, index$7_int_lt as int_lt, index$7_int_lte as int_lte, index$7_interrupt as interrupt, isArray$1 as isArray, isArrayIndex$1 as isArrayIndex, isArrayOrUndefined$1 as isArrayOrUndefined, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEqual$1 as isEqual, isEvenNumber$1 as isEvenNumber, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, 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, isNaNValue$1 as isNaNValue, isNegInfinity$1 as isNegInfinity, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNotThrowing$1 as isNotThrowing, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberOrUndefined$1 as isNumberOrUndefined, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOddNumber$1 as isOddNumber, isPosInfinity$1 as isPosInfinity, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isThrowing$1 as isThrowing, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, index$7_odd as odd, index$7_require as require, index$7_requireDefined as requireDefined, index$7_setErrorClass as setErrorClass };
|
|
144
196
|
}
|
|
145
197
|
|
|
146
198
|
/**
|
|
@@ -316,6 +368,7 @@ declare function isEvenNumber(value: unknown): value is number;
|
|
|
316
368
|
declare function isIncluded<T>(value: T, array: ReadonlyArray<T>): value is T;
|
|
317
369
|
declare function isArrayIndex<T>(index: unknown, array: ReadonlyArray<T>): index is number;
|
|
318
370
|
declare function isThrowing(throwTestFn: () => void): boolean;
|
|
371
|
+
declare function isNotThrowing(throwTestFn: () => void): boolean;
|
|
319
372
|
declare function tryOr<TRY_RVAL, OR_RVAL>(tryFn: () => TRY_RVAL, orVal: OR_RVAL | (() => OR_RVAL)): TRY_RVAL | OR_RVAL;
|
|
320
373
|
|
|
321
374
|
type Guard_HasProps<T extends object> = HasProps<T>;
|
|
@@ -355,6 +408,7 @@ declare const Guard_isNonEmptyArray: typeof isNonEmptyArray;
|
|
|
355
408
|
declare const Guard_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
356
409
|
declare const Guard_isNonEmptyString: typeof isNonEmptyString;
|
|
357
410
|
declare const Guard_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
411
|
+
declare const Guard_isNotThrowing: typeof isNotThrowing;
|
|
358
412
|
declare const Guard_isNull: typeof isNull;
|
|
359
413
|
declare const Guard_isNullish: typeof isNullish;
|
|
360
414
|
declare const Guard_isNumber: typeof isNumber;
|
|
@@ -374,13 +428,16 @@ declare const Guard_isTypedObject: typeof isTypedObject;
|
|
|
374
428
|
declare const Guard_isUndefined: typeof isUndefined;
|
|
375
429
|
declare const Guard_tryOr: typeof tryOr;
|
|
376
430
|
declare namespace Guard {
|
|
377
|
-
export { type Guard_HasProps as HasProps, Guard_isArray as isArray, Guard_isArrayIndex as isArrayIndex, Guard_isArrayOrUndefined as isArrayOrUndefined, Guard_isBoolean as isBoolean, Guard_isBooleanOrUndefined as isBooleanOrUndefined, Guard_isDeepEqual as isDeepEqual, Guard_isEmptyArray as isEmptyArray, Guard_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, Guard_isEmptyString as isEmptyString, Guard_isEmptyStringOrUndefined as isEmptyStringOrUndefined, Guard_isEnumValue as isEnumValue, Guard_isEnumValueOrUndefined as isEnumValueOrUndefined, Guard_isEqual as isEqual, Guard_isEvenNumber as isEvenNumber, Guard_isFalse as isFalse, Guard_isFalseOrUndefined as isFalseOrUndefined, Guard_isFinite as isFinite, Guard_isFunction as isFunction, Guard_isFunctionOrUndefined as isFunctionOrUndefined, Guard_isIncluded as isIncluded, Guard_isInfinity as isInfinity, Guard_isInteger as isInteger, Guard_isIntegerBetween as isIntegerBetween, Guard_isIntegerBetweenExclusive as isIntegerBetweenExclusive, Guard_isIntegerEq as isIntegerEq, Guard_isIntegerGt as isIntegerGt, Guard_isIntegerGte as isIntegerGte, Guard_isIntegerLt as isIntegerLt, Guard_isIntegerLte as isIntegerLte, Guard_isIntegerOrUndefined as isIntegerOrUndefined, Guard_isNaNValue as isNaNValue, Guard_isNegInfinity as isNegInfinity, Guard_isNonEmptyArray as isNonEmptyArray, Guard_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, Guard_isNonEmptyString as isNonEmptyString, Guard_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, Guard_isNull as isNull, Guard_isNullish as isNullish, Guard_isNumber as isNumber, Guard_isNumberBetween as isNumberBetween, Guard_isNumberBetweenExclusive as isNumberBetweenExclusive, Guard_isNumberOrUndefined as isNumberOrUndefined, Guard_isObject as isObject, Guard_isObjectOrUndefined as isObjectOrUndefined, Guard_isOddNumber as isOddNumber, Guard_isPosInfinity as isPosInfinity, Guard_isString as isString, Guard_isStringOrUndefined as isStringOrUndefined, Guard_isThrowing as isThrowing, Guard_isTrue as isTrue, Guard_isTrueOrUndefined as isTrueOrUndefined, Guard_isTypedObject as isTypedObject, Guard_isUndefined as isUndefined, Guard_tryOr as tryOr };
|
|
431
|
+
export { type Guard_HasProps as HasProps, Guard_isArray as isArray, Guard_isArrayIndex as isArrayIndex, Guard_isArrayOrUndefined as isArrayOrUndefined, Guard_isBoolean as isBoolean, Guard_isBooleanOrUndefined as isBooleanOrUndefined, Guard_isDeepEqual as isDeepEqual, Guard_isEmptyArray as isEmptyArray, Guard_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, Guard_isEmptyString as isEmptyString, Guard_isEmptyStringOrUndefined as isEmptyStringOrUndefined, Guard_isEnumValue as isEnumValue, Guard_isEnumValueOrUndefined as isEnumValueOrUndefined, Guard_isEqual as isEqual, Guard_isEvenNumber as isEvenNumber, Guard_isFalse as isFalse, Guard_isFalseOrUndefined as isFalseOrUndefined, Guard_isFinite as isFinite, Guard_isFunction as isFunction, Guard_isFunctionOrUndefined as isFunctionOrUndefined, Guard_isIncluded as isIncluded, Guard_isInfinity as isInfinity, Guard_isInteger as isInteger, Guard_isIntegerBetween as isIntegerBetween, Guard_isIntegerBetweenExclusive as isIntegerBetweenExclusive, Guard_isIntegerEq as isIntegerEq, Guard_isIntegerGt as isIntegerGt, Guard_isIntegerGte as isIntegerGte, Guard_isIntegerLt as isIntegerLt, Guard_isIntegerLte as isIntegerLte, Guard_isIntegerOrUndefined as isIntegerOrUndefined, Guard_isNaNValue as isNaNValue, Guard_isNegInfinity as isNegInfinity, Guard_isNonEmptyArray as isNonEmptyArray, Guard_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, Guard_isNonEmptyString as isNonEmptyString, Guard_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, Guard_isNotThrowing as isNotThrowing, Guard_isNull as isNull, Guard_isNullish as isNullish, Guard_isNumber as isNumber, Guard_isNumberBetween as isNumberBetween, Guard_isNumberBetweenExclusive as isNumberBetweenExclusive, Guard_isNumberOrUndefined as isNumberOrUndefined, Guard_isObject as isObject, Guard_isObjectOrUndefined as isObjectOrUndefined, Guard_isOddNumber as isOddNumber, Guard_isPosInfinity as isPosInfinity, Guard_isString as isString, Guard_isStringOrUndefined as isStringOrUndefined, Guard_isThrowing as isThrowing, Guard_isTrue as isTrue, Guard_isTrueOrUndefined as isTrueOrUndefined, Guard_isTypedObject as isTypedObject, Guard_isUndefined as isUndefined, Guard_tryOr as tryOr };
|
|
378
432
|
}
|
|
379
433
|
|
|
380
434
|
declare function toArray<T>(a: T | T[]): Array<T>;
|
|
381
435
|
declare function duplicate<T>(a: T[] | undefined): T[] | undefined;
|
|
382
436
|
declare function removeDuplicates<T>(arr: T[], compareFn?: (a: T, b: T) => boolean): T[];
|
|
383
|
-
/**
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated - Use {@link removeDuplicates} with compareFn instead. Will be removed in v2.0.0.
|
|
439
|
+
* @private
|
|
440
|
+
*/
|
|
384
441
|
declare function removeDuplicatesCmp<T>(arr: ReadonlyArray<T>, compareFn: (t1: T, t2: T) => boolean): T[];
|
|
385
442
|
declare function fillArray<T>(fillValue: T, fillCount: number): T[];
|
|
386
443
|
declare function mapSequenceArray<T>(len: number, fn: (i: number) => T): T[];
|
|
@@ -591,6 +648,7 @@ declare function charCount(str: string, ch: string): number;
|
|
|
591
648
|
* @param PascalString
|
|
592
649
|
*/
|
|
593
650
|
declare function makeSentenceFromPascal(PascalString: string): string;
|
|
651
|
+
declare function stringify(value: any, maxDepth?: number, seen?: WeakSet<WeakKey>): string;
|
|
594
652
|
|
|
595
653
|
declare const index$1_charCount: typeof charCount;
|
|
596
654
|
declare const index$1_chunkString: typeof chunkString;
|
|
@@ -600,13 +658,15 @@ declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
|
|
|
600
658
|
declare const index$1_removeAt: typeof removeAt;
|
|
601
659
|
declare const index$1_repeatString: typeof repeatString;
|
|
602
660
|
declare const index$1_replaceAt: typeof replaceAt;
|
|
661
|
+
declare const index$1_stringify: typeof stringify;
|
|
603
662
|
declare const index$1_toCharArray: typeof toCharArray;
|
|
604
663
|
declare namespace index$1 {
|
|
605
|
-
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_toCharArray as toCharArray };
|
|
664
|
+
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_stringify as stringify, index$1_toCharArray as toCharArray };
|
|
606
665
|
}
|
|
607
666
|
|
|
608
667
|
/**
|
|
609
|
-
* @deprecated Use {@link Guard} instead.
|
|
668
|
+
* @deprecated Use {@link Guard} instead. Will be removed in v2.0.0.
|
|
669
|
+
* @private
|
|
610
670
|
*/
|
|
611
671
|
declare const Is: typeof Guard;
|
|
612
672
|
|
|
@@ -615,11 +675,33 @@ declare namespace index {
|
|
|
615
675
|
export { index$6 as Arr, index$5 as Dom, index$8 as Enum, index_Is as Is, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
616
676
|
}
|
|
617
677
|
|
|
678
|
+
type EqualityFn<V> = (a: V, b: V) => boolean;
|
|
679
|
+
declare const DefaultEqualityFn: EqualityFn<any>;
|
|
680
|
+
interface KVComponent<K extends any[], VALUE> {
|
|
681
|
+
get size(): number;
|
|
682
|
+
isEmpty(): boolean;
|
|
683
|
+
has(...keys: K): boolean;
|
|
684
|
+
get(...keys: K): VALUE | undefined;
|
|
685
|
+
getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
|
|
686
|
+
getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
|
|
687
|
+
set(...keysAndValue: [...K, VALUE]): void;
|
|
688
|
+
delete(...keys: K): boolean;
|
|
689
|
+
clear?(): void;
|
|
690
|
+
toString(): string;
|
|
691
|
+
kvValues(): IterableIterator<VALUE>;
|
|
692
|
+
kvKeys(): IterableIterator<K>;
|
|
693
|
+
kvEntries(): IterableIterator<[K, VALUE]>;
|
|
694
|
+
}
|
|
695
|
+
declare abstract class BaseContainer {
|
|
696
|
+
abstract toString(): string;
|
|
697
|
+
}
|
|
698
|
+
|
|
618
699
|
/**
|
|
619
700
|
* This is a stack data structure.
|
|
620
701
|
*/
|
|
621
|
-
declare class Stack<T> {
|
|
702
|
+
declare class Stack<T> extends BaseContainer {
|
|
622
703
|
private readonly data;
|
|
704
|
+
constructor();
|
|
623
705
|
private assertId;
|
|
624
706
|
get length(): number;
|
|
625
707
|
push(el: T): T;
|
|
@@ -655,7 +737,7 @@ declare class Stack<T> {
|
|
|
655
737
|
* console.log(a.clone().equals(a)); // true
|
|
656
738
|
* ```
|
|
657
739
|
*/
|
|
658
|
-
declare class Vec {
|
|
740
|
+
declare class Vec extends BaseContainer {
|
|
659
741
|
readonly coords: number[];
|
|
660
742
|
constructor(...coords: number[]);
|
|
661
743
|
static vec2(x: number, y: number): Vec;
|
|
@@ -691,9 +773,65 @@ declare class Vec {
|
|
|
691
773
|
}
|
|
692
774
|
|
|
693
775
|
/**
|
|
694
|
-
*
|
|
776
|
+
* An immutable 2D rectangle defined by its top-left corner (x, y) and size (width, height).
|
|
777
|
+
* Provides geometric utilities like intersection, containment, scaling, etc.
|
|
695
778
|
*/
|
|
696
|
-
declare class
|
|
779
|
+
declare class Rect {
|
|
780
|
+
x: number;
|
|
781
|
+
y: number;
|
|
782
|
+
width: number;
|
|
783
|
+
height: number;
|
|
784
|
+
constructor();
|
|
785
|
+
constructor(width: number, height: number);
|
|
786
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
787
|
+
set(): Rect;
|
|
788
|
+
set(width: number, height: number): Rect;
|
|
789
|
+
set(x: number, y: number, width: number, height: number): Rect;
|
|
790
|
+
static fromPoints(p1: {
|
|
791
|
+
x: number;
|
|
792
|
+
y: number;
|
|
793
|
+
}, p2: {
|
|
794
|
+
x: number;
|
|
795
|
+
y: number;
|
|
796
|
+
}): Rect;
|
|
797
|
+
static fromCenter(cx: number, cy: number, width: number, height: number): Rect;
|
|
798
|
+
get left(): number;
|
|
799
|
+
get top(): number;
|
|
800
|
+
get right(): number;
|
|
801
|
+
get bottom(): number;
|
|
802
|
+
get centerX(): number;
|
|
803
|
+
get centerY(): number;
|
|
804
|
+
get center(): {
|
|
805
|
+
x: number;
|
|
806
|
+
y: number;
|
|
807
|
+
};
|
|
808
|
+
get area(): number;
|
|
809
|
+
get isEmpty(): boolean;
|
|
810
|
+
containsPoint(px: number, py: number): boolean;
|
|
811
|
+
containsRect(other: Rect): boolean;
|
|
812
|
+
intersects(other: Rect): boolean;
|
|
813
|
+
intersectionCopy(other: Rect): Rect;
|
|
814
|
+
unionCopy(other: Rect): Rect;
|
|
815
|
+
insetCopy(dx: number, dy: number): Rect;
|
|
816
|
+
inflateCopy(dx: number, dy: number): Rect;
|
|
817
|
+
offsetInPlace(dx: number, dy: number): Rect;
|
|
818
|
+
offsetCopy(dx: number, dy: number): Rect;
|
|
819
|
+
scaleInPlace(scaleX: number, scaleY?: number): Rect;
|
|
820
|
+
scaleCopy(scaleX: number, scaleY?: number): Rect;
|
|
821
|
+
roundCopy(): Rect;
|
|
822
|
+
floorCopy(): Rect;
|
|
823
|
+
ceilCopy(): Rect;
|
|
824
|
+
expandCopy(px: number, py: number): Rect;
|
|
825
|
+
equals(other: Rect): boolean;
|
|
826
|
+
clone(): Rect;
|
|
827
|
+
toString(): string;
|
|
828
|
+
toAnchoredRect(): AnchoredRect;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* A mutable AnchoredRect class is a rectangle (left, top, right, bottom) with an anchor point (anchorX, anchorY).
|
|
833
|
+
*/
|
|
834
|
+
declare class AnchoredRect {
|
|
697
835
|
left: number;
|
|
698
836
|
anchorX: number;
|
|
699
837
|
right: number;
|
|
@@ -725,6 +863,31 @@ declare class DivRect {
|
|
|
725
863
|
* @param bottom - Bottom coordinate.
|
|
726
864
|
*/
|
|
727
865
|
constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
|
|
866
|
+
/**
|
|
867
|
+
* Set rectangle with all zero values.
|
|
868
|
+
*/
|
|
869
|
+
set(): AnchoredRect;
|
|
870
|
+
/**
|
|
871
|
+
* Set rectangle with left, right, top, bottom.
|
|
872
|
+
* Properties anchorX and anchorY will be centered in the middle.
|
|
873
|
+
*
|
|
874
|
+
* @param left - Left coordinate.
|
|
875
|
+
* @param right - Right coordinate.
|
|
876
|
+
* @param top - Top coordinate.
|
|
877
|
+
* @param bottom - Bottom coordinate.
|
|
878
|
+
*/
|
|
879
|
+
set(left: number, right: number, top: number, bottom: number): AnchoredRect;
|
|
880
|
+
/**
|
|
881
|
+
* Set rectangle with full arguments.
|
|
882
|
+
*
|
|
883
|
+
* @param left - Left coordinate.
|
|
884
|
+
* @param anchorX - Center x-coordinate.
|
|
885
|
+
* @param right - Right coordinate.
|
|
886
|
+
* @param top - Top coordinate.
|
|
887
|
+
* @param anchorY - Center y-coordinate.
|
|
888
|
+
* @param bottom - Bottom coordinate.
|
|
889
|
+
*/
|
|
890
|
+
set(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number): AnchoredRect;
|
|
728
891
|
/**
|
|
729
892
|
* Create rect from basic left, top, width and height arguments.
|
|
730
893
|
*
|
|
@@ -732,9 +895,9 @@ declare class DivRect {
|
|
|
732
895
|
* @param top - Top coordinate.
|
|
733
896
|
* @param width - Width.
|
|
734
897
|
* @param height - Height.
|
|
735
|
-
* @returns -
|
|
898
|
+
* @returns - AnchoredRect.
|
|
736
899
|
*/
|
|
737
|
-
static create(left: number, top: number, width: number, height: number):
|
|
900
|
+
static create(left: number, top: number, width: number, height: number): AnchoredRect;
|
|
738
901
|
/**
|
|
739
902
|
* Create rect from anchorX, anchorY, width, height arguments.
|
|
740
903
|
*
|
|
@@ -742,9 +905,9 @@ declare class DivRect {
|
|
|
742
905
|
* @param centerY - Center y-coordinate.
|
|
743
906
|
* @param width - Width.
|
|
744
907
|
* @param height - Height.
|
|
745
|
-
* @returns -
|
|
908
|
+
* @returns - AnchoredRect.
|
|
746
909
|
*/
|
|
747
|
-
static createCentered(centerX: number, centerY: number, width: number, height: number):
|
|
910
|
+
static createCentered(centerX: number, centerY: number, width: number, height: number): AnchoredRect;
|
|
748
911
|
/**
|
|
749
912
|
* Create rect from sections.
|
|
750
913
|
*
|
|
@@ -752,17 +915,17 @@ declare class DivRect {
|
|
|
752
915
|
* @param rightw - Right section width.
|
|
753
916
|
* @param toph - Top section height.
|
|
754
917
|
* @param bottomh - Bottomsection height.
|
|
755
|
-
* @returns -
|
|
918
|
+
* @returns - AnchoredRect.
|
|
919
|
+
*/
|
|
920
|
+
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): AnchoredRect;
|
|
921
|
+
/**
|
|
922
|
+
* Get center x-coordinate.
|
|
756
923
|
*/
|
|
757
|
-
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
758
|
-
/** @deprecated - Renamed to anchorX. */
|
|
759
924
|
get centerX(): number;
|
|
760
|
-
/**
|
|
761
|
-
|
|
762
|
-
|
|
925
|
+
/**
|
|
926
|
+
* Get center ycoordinate.
|
|
927
|
+
*/
|
|
763
928
|
get centerY(): number;
|
|
764
|
-
/** @deprecated - Renamed to anchorY. */
|
|
765
|
-
set centerY(y: number);
|
|
766
929
|
/**
|
|
767
930
|
* Width getter.
|
|
768
931
|
*/
|
|
@@ -798,126 +961,124 @@ declare class DivRect {
|
|
|
798
961
|
/**
|
|
799
962
|
* Do a and b rects overlap?
|
|
800
963
|
*
|
|
801
|
-
* @param a -
|
|
802
|
-
* @param b -
|
|
964
|
+
* @param a - AnchoredRect a.
|
|
965
|
+
* @param b - AnchoredRect b.
|
|
803
966
|
* @returns - True/false.
|
|
804
967
|
*/
|
|
805
|
-
static overlap(a:
|
|
968
|
+
static overlap(a: AnchoredRect, b: AnchoredRect): boolean;
|
|
806
969
|
/**
|
|
807
970
|
* Do horizontal measures of a and b rects overlap?
|
|
808
971
|
*
|
|
809
|
-
* @param a -
|
|
810
|
-
* @param b -
|
|
972
|
+
* @param a - AnchoredRect a.
|
|
973
|
+
* @param b - AnchoredRect b.
|
|
811
974
|
* @returns - True/false.
|
|
812
975
|
*/
|
|
813
|
-
static overlapX(a:
|
|
976
|
+
static overlapX(a: AnchoredRect, b: AnchoredRect): boolean;
|
|
814
977
|
/**
|
|
815
978
|
* Check if given rects are equal.
|
|
816
|
-
* @param a -
|
|
817
|
-
* @param b -
|
|
979
|
+
* @param a - AnchoredRect a.
|
|
980
|
+
* @param b - AnchoredRect b.
|
|
818
981
|
* @returns - True/false.
|
|
819
982
|
*/
|
|
820
|
-
static equals(a:
|
|
983
|
+
static equals(a: AnchoredRect | null | undefined, b: AnchoredRect | null | undefined): boolean;
|
|
821
984
|
/**
|
|
822
985
|
* Check if this rect equals with another rect.
|
|
823
986
|
* @param other - The other rect.
|
|
824
987
|
* @returns - True/false.
|
|
825
988
|
*/
|
|
826
|
-
equals(other:
|
|
989
|
+
equals(other: AnchoredRect): boolean;
|
|
827
990
|
/**
|
|
828
991
|
* Check if edges of given rects are equal, ignoring anchorX and anchorY.
|
|
829
992
|
*
|
|
830
|
-
* @param a -
|
|
831
|
-
* @param b -
|
|
993
|
+
* @param a - AnchoredRect a.
|
|
994
|
+
* @param b - AnchoredRect b.
|
|
832
995
|
* @returns - True/false.
|
|
833
996
|
*/
|
|
834
|
-
static equalsEdges(a:
|
|
997
|
+
static equalsEdges(a: AnchoredRect | null | undefined, b: AnchoredRect | null | undefined): boolean;
|
|
835
998
|
/**
|
|
836
999
|
* Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
|
|
837
1000
|
*
|
|
838
|
-
* @param other - The other
|
|
1001
|
+
* @param other - The other AnchoredRect.
|
|
839
1002
|
* @returns - True/false.
|
|
840
1003
|
*/
|
|
841
|
-
equalsEdges(other:
|
|
842
|
-
/** @deprecated - Use `DivRect.equalsEdges()` instead. */
|
|
843
|
-
static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
1004
|
+
equalsEdges(other: AnchoredRect): boolean;
|
|
844
1005
|
/**
|
|
845
1006
|
* Created duplicate of this Rect.
|
|
846
|
-
*
|
|
847
1007
|
* @returns - Duplicate.
|
|
848
1008
|
*/
|
|
849
|
-
|
|
1009
|
+
clone(): AnchoredRect;
|
|
850
1010
|
/**
|
|
851
1011
|
* Move this rect by (dx, dy). Modifies this Rect.
|
|
852
1012
|
*
|
|
853
1013
|
* @param dx - Offset amount in x-direction.
|
|
854
1014
|
* @param dy - Offset amount in y-direction.
|
|
855
|
-
* @returns - This
|
|
1015
|
+
* @returns - This AnchoredRect instance.
|
|
856
1016
|
*/
|
|
857
|
-
offsetInPlace(dx: number, dy: number):
|
|
1017
|
+
offsetInPlace(dx: number, dy: number): AnchoredRect;
|
|
858
1018
|
/**
|
|
859
1019
|
* Move this rect by (dx, dy). Immutable, returns modified copy.
|
|
860
1020
|
*
|
|
861
1021
|
* @param dx - Offset amount in x-direction.
|
|
862
1022
|
* @param dy - Offset amount in y-direction.
|
|
863
|
-
* @returns -
|
|
1023
|
+
* @returns - AnchoredRect copy with applied offset.
|
|
864
1024
|
*/
|
|
865
|
-
offsetCopy(dx: number, dy: number):
|
|
1025
|
+
offsetCopy(dx: number, dy: number): AnchoredRect;
|
|
866
1026
|
/**
|
|
867
1027
|
* Expand this Rect by given Rect. Modifies this Rect.
|
|
868
1028
|
*
|
|
869
|
-
* @param rect -
|
|
870
|
-
* @returns - This
|
|
1029
|
+
* @param rect - AnchoredRect to expand this instance with.
|
|
1030
|
+
* @returns - This AnchoredRect instance.
|
|
871
1031
|
*/
|
|
872
|
-
expandInPlace(rect:
|
|
1032
|
+
expandInPlace(rect: AnchoredRect): AnchoredRect;
|
|
873
1033
|
/**
|
|
874
1034
|
* Expand this Rect by given Rect. Immutable, returns modified copy.
|
|
875
1035
|
*
|
|
876
|
-
* @param rect -
|
|
877
|
-
* @returns - Expanded copy of this
|
|
1036
|
+
* @param rect - AnchoredRect to expand this instance with.
|
|
1037
|
+
* @returns - Expanded copy of this AnchoredRect.
|
|
878
1038
|
*/
|
|
879
|
-
expandCopy(rect:
|
|
1039
|
+
expandCopy(rect: AnchoredRect): AnchoredRect;
|
|
880
1040
|
/**
|
|
881
1041
|
* Clip this Rect by given Rect. Mmodifies this Rect.
|
|
882
1042
|
*
|
|
883
|
-
* @param clipRect -
|
|
884
|
-
* @returns - This
|
|
1043
|
+
* @param clipRect - AnchoredRect to clip this instance with.
|
|
1044
|
+
* @returns - This AnchoredRect instance.
|
|
885
1045
|
*/
|
|
886
|
-
clipInPlace(clipRect:
|
|
1046
|
+
clipInPlace(clipRect: AnchoredRect): AnchoredRect;
|
|
887
1047
|
/**
|
|
888
1048
|
* Clip this Rect by given Rect. Immutable, return modified copy.
|
|
889
1049
|
*
|
|
890
|
-
* @param clipRect -
|
|
891
|
-
* @returns - Clipped
|
|
1050
|
+
* @param clipRect - AnchoredRecto to clip this instance with.
|
|
1051
|
+
* @returns - Clipped AnchoredRect copy.
|
|
892
1052
|
*/
|
|
893
|
-
clipCopy(clipRect:
|
|
1053
|
+
clipCopy(clipRect: AnchoredRect): AnchoredRect;
|
|
894
1054
|
/**
|
|
895
1055
|
* Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
|
|
896
1056
|
*
|
|
897
1057
|
* @param scaleX - Scale x-amount.
|
|
898
1058
|
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
899
|
-
* @returns This
|
|
1059
|
+
* @returns This AnchoredRect instance.
|
|
900
1060
|
*/
|
|
901
|
-
scaleInPlace(scaleX: number, scaleY?: number):
|
|
1061
|
+
scaleInPlace(scaleX: number, scaleY?: number): AnchoredRect;
|
|
902
1062
|
/**
|
|
903
1063
|
* Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
|
|
904
1064
|
*
|
|
905
1065
|
* @param scaleX - Scale x-amount.
|
|
906
1066
|
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
907
|
-
* @returns Scaled copy of this
|
|
1067
|
+
* @returns Scaled copy of this AnchoredRect.
|
|
908
1068
|
*/
|
|
909
|
-
scaleCopy(scaleX: number, scaleY?: number):
|
|
1069
|
+
scaleCopy(scaleX: number, scaleY?: number): AnchoredRect;
|
|
910
1070
|
/**
|
|
911
|
-
* Get this
|
|
912
|
-
* @returns - This
|
|
1071
|
+
* Get this AnchoredRect instance.
|
|
1072
|
+
* @returns - This AnchoredRect instance.
|
|
913
1073
|
*/
|
|
914
|
-
getRect():
|
|
1074
|
+
getRect(): AnchoredRect;
|
|
1075
|
+
toRect(): Rect;
|
|
915
1076
|
}
|
|
916
1077
|
|
|
917
1078
|
/**
|
|
918
1079
|
* LRUCache is an implementation of least recently used cache with a fixed capacity.
|
|
919
1080
|
*/
|
|
920
|
-
declare class LRUCache<K extends string, V> {
|
|
1081
|
+
declare class LRUCache<K extends string, V> extends BaseContainer {
|
|
921
1082
|
private cache;
|
|
922
1083
|
private next;
|
|
923
1084
|
private prev;
|
|
@@ -933,29 +1094,18 @@ declare class LRUCache<K extends string, V> {
|
|
|
933
1094
|
private evict;
|
|
934
1095
|
private removeKey;
|
|
935
1096
|
private addToTail;
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
isEmpty(): boolean;
|
|
941
|
-
has(...keys: K): boolean;
|
|
942
|
-
get(...keys: K): VALUE | undefined;
|
|
943
|
-
getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
|
|
944
|
-
getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
|
|
945
|
-
set(...keysAndValue: [...K, VALUE]): void;
|
|
946
|
-
delete(...keys: K): boolean;
|
|
947
|
-
clear?(): void;
|
|
1097
|
+
keys(): IterableIterator<K>;
|
|
1098
|
+
values(): IterableIterator<V>;
|
|
1099
|
+
entries(): IterableIterator<[K, V]>;
|
|
1100
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
948
1101
|
toString(): string;
|
|
949
|
-
kvValues(): IterableIterator<VALUE>;
|
|
950
|
-
kvKeys(): IterableIterator<K>;
|
|
951
|
-
kvEntries(): IterableIterator<[K, VALUE]>;
|
|
952
1102
|
}
|
|
953
1103
|
|
|
954
1104
|
/**
|
|
955
1105
|
* `IndexArray` is a sparse array with non-negative indexes. It stores values
|
|
956
1106
|
* to indexes, and each index also has flag telling it has a value.
|
|
957
1107
|
*/
|
|
958
|
-
declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
1108
|
+
declare class IndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
959
1109
|
private static validateIndex;
|
|
960
1110
|
private posVal;
|
|
961
1111
|
private hasPos;
|
|
@@ -1007,7 +1157,7 @@ declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1007
1157
|
* `IndexArray` is a sparse array with positive and negative indexes. It stores
|
|
1008
1158
|
* values to indexes, and each index also has flag telling it has a value.
|
|
1009
1159
|
*/
|
|
1010
|
-
declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
1160
|
+
declare class SignedIndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
1011
1161
|
private static toNegIndex;
|
|
1012
1162
|
private static validateIndex;
|
|
1013
1163
|
private posVal;
|
|
@@ -1063,11 +1213,12 @@ declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1063
1213
|
* When you create `DefaultArray` you give a default value. For example if you
|
|
1064
1214
|
* delete an index then that index is set to the default value.
|
|
1065
1215
|
*/
|
|
1066
|
-
declare class DefaultArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
1067
|
-
readonly defaultValue
|
|
1216
|
+
declare class DefaultArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
1217
|
+
private readonly defaultValue;
|
|
1068
1218
|
private data;
|
|
1069
|
-
constructor(
|
|
1219
|
+
constructor(defaultValue: VALUE);
|
|
1070
1220
|
constructor(length: number, defaultValue: VALUE);
|
|
1221
|
+
constructor(values: Iterable<VALUE>, defaultValue: VALUE);
|
|
1071
1222
|
get size(): number;
|
|
1072
1223
|
get length(): number;
|
|
1073
1224
|
private assertId;
|
|
@@ -1094,7 +1245,7 @@ declare class DefaultArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1094
1245
|
kvValues(): IterableIterator<VALUE>;
|
|
1095
1246
|
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
1096
1247
|
[Symbol.iterator](): IterableIterator<[number, VALUE]>;
|
|
1097
|
-
clone():
|
|
1248
|
+
clone(): DefaultArray<VALUE>;
|
|
1098
1249
|
merge(other: DefaultArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
1099
1250
|
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
1100
1251
|
every(fn: (value: VALUE, key1: number) => boolean): boolean;
|
|
@@ -1113,53 +1264,59 @@ declare class DefaultArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1113
1264
|
/**
|
|
1114
1265
|
* A Map implementation mapping a single key to a value.
|
|
1115
1266
|
*/
|
|
1116
|
-
declare class
|
|
1117
|
-
private
|
|
1267
|
+
declare class UniMap<KEY, VALUE> extends BaseContainer implements KVComponent<[KEY], VALUE> {
|
|
1268
|
+
private map;
|
|
1269
|
+
private keyEquals;
|
|
1118
1270
|
constructor();
|
|
1119
|
-
constructor(
|
|
1120
|
-
constructor(
|
|
1121
|
-
|
|
1122
|
-
set
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
delete(
|
|
1271
|
+
constructor(equals?: EqualityFn<KEY>);
|
|
1272
|
+
constructor(list: UniMap<KEY, VALUE> | Iterable<[KEY, VALUE]>, equals?: EqualityFn<KEY>);
|
|
1273
|
+
static createDeep<KEY1, VALUE>(): UniMap<KEY1, VALUE>;
|
|
1274
|
+
static createDeep<KEY1, VALUE>(set: UniMap<KEY1, VALUE>): UniMap<KEY1, VALUE>;
|
|
1275
|
+
static createDeep<KEY1, VALUE>(entries: Iterable<[KEY1, VALUE]>): UniMap<KEY1, VALUE>;
|
|
1276
|
+
has(key: KEY): boolean;
|
|
1277
|
+
set(key: KEY, value: VALUE): VALUE;
|
|
1278
|
+
get(key: KEY): VALUE | undefined;
|
|
1279
|
+
delete(key: KEY): boolean;
|
|
1280
|
+
getOrDefault(key: KEY, defaultValue: VALUE): VALUE;
|
|
1281
|
+
getOrCreate(key: KEY, value: VALUE): VALUE;
|
|
1282
|
+
getOrCreate(key: KEY, creator: () => VALUE): VALUE;
|
|
1128
1283
|
clear(): void;
|
|
1129
1284
|
get size(): number;
|
|
1130
1285
|
isEmpty(): boolean;
|
|
1131
|
-
forEach(callbackfn: (value: VALUE,
|
|
1132
|
-
keys(): IterableIterator<
|
|
1286
|
+
forEach(callbackfn: (value: VALUE, key: KEY, map1: UniMap<KEY, VALUE>) => void, thisArg?: any): void;
|
|
1287
|
+
keys(): IterableIterator<KEY>;
|
|
1133
1288
|
values(): IterableIterator<VALUE>;
|
|
1134
|
-
entries(): IterableIterator<[
|
|
1135
|
-
keysArray():
|
|
1289
|
+
entries(): IterableIterator<[KEY, VALUE]>;
|
|
1290
|
+
keysArray(): KEY[];
|
|
1136
1291
|
valuesArray(): VALUE[];
|
|
1137
|
-
entriesArray(): [
|
|
1138
|
-
kvKeys(): IterableIterator<[
|
|
1292
|
+
entriesArray(): [KEY, VALUE][];
|
|
1293
|
+
kvKeys(): IterableIterator<[KEY]>;
|
|
1139
1294
|
kvValues(): IterableIterator<VALUE>;
|
|
1140
|
-
kvEntries(): IterableIterator<[[
|
|
1141
|
-
[Symbol.iterator](): IterableIterator<[
|
|
1142
|
-
clone():
|
|
1143
|
-
merge(other:
|
|
1144
|
-
some(fn: (value: VALUE,
|
|
1145
|
-
every(fn: (value: VALUE,
|
|
1146
|
-
filter<S extends VALUE>(predicate: (value: VALUE,
|
|
1147
|
-
filter(predicate: (value: VALUE,
|
|
1148
|
-
reduce(fn: (acc: VALUE, value: VALUE,
|
|
1149
|
-
reduce<R>(fn: (acc: R, value: VALUE,
|
|
1150
|
-
mapEntries<R>(fn: (value: VALUE,
|
|
1151
|
-
mapValues<R = VALUE>(fn: (value: VALUE,
|
|
1152
|
-
toMap(): Map<
|
|
1295
|
+
kvEntries(): IterableIterator<[[KEY], VALUE]>;
|
|
1296
|
+
[Symbol.iterator](): IterableIterator<[KEY, VALUE]>;
|
|
1297
|
+
clone(): UniMap<KEY, VALUE>;
|
|
1298
|
+
merge(other: UniMap<KEY, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key: KEY) => VALUE): this;
|
|
1299
|
+
some(fn: (value: VALUE, key: KEY) => boolean): boolean;
|
|
1300
|
+
every(fn: (value: VALUE, key: KEY) => boolean): boolean;
|
|
1301
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => value is S): UniMap<KEY, S>;
|
|
1302
|
+
filter(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => unknown): UniMap<KEY, VALUE>;
|
|
1303
|
+
reduce(fn: (acc: VALUE, value: VALUE, key: KEY) => VALUE): VALUE;
|
|
1304
|
+
reduce<R>(fn: (acc: R, value: VALUE, key: KEY) => R, init: R): R;
|
|
1305
|
+
mapEntries<R>(fn: (value: VALUE, key: KEY) => R): R[];
|
|
1306
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key: KEY) => R): UniMap<KEY, R>;
|
|
1307
|
+
toMap(): Map<KEY, VALUE>;
|
|
1153
1308
|
toString(): string;
|
|
1154
1309
|
}
|
|
1155
1310
|
|
|
1156
1311
|
/**
|
|
1157
1312
|
* A Map implementation mapping a double key to a value.
|
|
1158
1313
|
*/
|
|
1159
|
-
declare class
|
|
1314
|
+
declare class BiMap<KEY1, KEY2, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
1160
1315
|
private map1;
|
|
1316
|
+
private key1Equals;
|
|
1317
|
+
private key2Equals;
|
|
1161
1318
|
constructor();
|
|
1162
|
-
constructor(
|
|
1319
|
+
constructor(biMap: BiMap<KEY1, KEY2, VALUE>);
|
|
1163
1320
|
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
1164
1321
|
has(key1: KEY1, key2: KEY2): boolean;
|
|
1165
1322
|
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
@@ -1172,7 +1329,7 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1172
1329
|
clear(): void;
|
|
1173
1330
|
get size(): number;
|
|
1174
1331
|
isEmpty(): boolean;
|
|
1175
|
-
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2:
|
|
1332
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: BiMap<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
1176
1333
|
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
1177
1334
|
values(): IterableIterator<VALUE>;
|
|
1178
1335
|
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
@@ -1183,16 +1340,16 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1183
1340
|
kvValues(): IterableIterator<VALUE>;
|
|
1184
1341
|
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
1185
1342
|
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1186
|
-
clone():
|
|
1187
|
-
merge(other:
|
|
1343
|
+
clone(): BiMap<KEY1, KEY2, VALUE>;
|
|
1344
|
+
merge(other: BiMap<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
1188
1345
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1189
1346
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1190
|
-
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array:
|
|
1191
|
-
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array:
|
|
1347
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => value is S): BiMap<KEY1, KEY2, S>;
|
|
1348
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => unknown): BiMap<KEY1, KEY2, VALUE>;
|
|
1192
1349
|
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
|
|
1193
1350
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
1194
1351
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
1195
|
-
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R):
|
|
1352
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): BiMap<KEY1, KEY2, R>;
|
|
1196
1353
|
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
1197
1354
|
toString(): string;
|
|
1198
1355
|
}
|
|
@@ -1200,11 +1357,14 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1200
1357
|
/**
|
|
1201
1358
|
* A Map implementation mapping a triple key to a value.
|
|
1202
1359
|
*/
|
|
1203
|
-
declare class
|
|
1360
|
+
declare class TriMap<KEY1, KEY2, KEY3, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
1204
1361
|
private map1;
|
|
1362
|
+
private key1Equals;
|
|
1363
|
+
private key2Equals;
|
|
1364
|
+
private key3Equals;
|
|
1205
1365
|
constructor();
|
|
1206
1366
|
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
1207
|
-
constructor(
|
|
1367
|
+
constructor(triMap: TriMap<KEY1, KEY2, KEY3, VALUE>);
|
|
1208
1368
|
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1209
1369
|
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1210
1370
|
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
@@ -1217,7 +1377,7 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
1217
1377
|
clear(): void;
|
|
1218
1378
|
get size(): number;
|
|
1219
1379
|
isEmpty(): boolean;
|
|
1220
|
-
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2:
|
|
1380
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: TriMap<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
1221
1381
|
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1222
1382
|
values(): IterableIterator<VALUE>;
|
|
1223
1383
|
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
@@ -1228,29 +1388,32 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
1228
1388
|
kvValues(): IterableIterator<VALUE>;
|
|
1229
1389
|
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
1230
1390
|
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1231
|
-
clone():
|
|
1232
|
-
merge(other:
|
|
1391
|
+
clone(): TriMap<KEY1, KEY2, KEY3, VALUE>;
|
|
1392
|
+
merge(other: TriMap<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
1233
1393
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1234
1394
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1235
|
-
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array:
|
|
1236
|
-
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array:
|
|
1395
|
+
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>;
|
|
1396
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: TriMap<KEY1, KEY2, KEY3, VALUE>) => unknown): TriMap<KEY1, KEY2, KEY3, VALUE>;
|
|
1237
1397
|
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
|
|
1238
1398
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
1239
1399
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
1240
|
-
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R):
|
|
1400
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): TriMap<KEY1, KEY2, KEY3, R>;
|
|
1241
1401
|
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
1242
1402
|
toString(): string;
|
|
1243
1403
|
}
|
|
1244
1404
|
|
|
1245
1405
|
/**
|
|
1246
|
-
* An
|
|
1406
|
+
* An implementation of a Set data structure.
|
|
1247
1407
|
*/
|
|
1248
|
-
declare
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1408
|
+
declare class ValueSet<VALUE> extends BaseContainer implements KVComponent<[VALUE], VALUE> {
|
|
1409
|
+
private data;
|
|
1410
|
+
private equals;
|
|
1411
|
+
constructor();
|
|
1412
|
+
constructor(equals?: EqualityFn<VALUE>);
|
|
1413
|
+
constructor(list: ValueSet<VALUE> | Iterable<VALUE>, equals?: EqualityFn<VALUE>);
|
|
1414
|
+
static createDeep<VALUE>(): ValueSet<VALUE>;
|
|
1415
|
+
static createDeep<VALUE>(set: ValueSet<VALUE>): ValueSet<VALUE>;
|
|
1416
|
+
static createDeep<VALUE>(entries: Iterable<VALUE>): ValueSet<VALUE>;
|
|
1254
1417
|
has(value: VALUE): boolean;
|
|
1255
1418
|
add(value: VALUE): VALUE;
|
|
1256
1419
|
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
@@ -1267,7 +1430,7 @@ declare abstract class SetBase<VALUE, CLS extends SetBase<VALUE, CLS> = any> imp
|
|
|
1267
1430
|
clear(): void;
|
|
1268
1431
|
get size(): number;
|
|
1269
1432
|
isEmpty(): boolean;
|
|
1270
|
-
forEach(callbackfn: (value: VALUE,
|
|
1433
|
+
forEach(callbackfn: (value: VALUE, set: ValueSet<VALUE>) => void, thisArg?: any): void;
|
|
1271
1434
|
keys(): IterableIterator<VALUE>;
|
|
1272
1435
|
values(): IterableIterator<VALUE>;
|
|
1273
1436
|
entries(): IterableIterator<[VALUE, VALUE]>;
|
|
@@ -1275,50 +1438,26 @@ declare abstract class SetBase<VALUE, CLS extends SetBase<VALUE, CLS> = any> imp
|
|
|
1275
1438
|
kvValues(): IterableIterator<VALUE>;
|
|
1276
1439
|
kvEntries(): IterableIterator<[[VALUE], VALUE]>;
|
|
1277
1440
|
[Symbol.iterator](): IterableIterator<VALUE>;
|
|
1278
|
-
clone():
|
|
1279
|
-
merge(other:
|
|
1441
|
+
clone(): ValueSet<VALUE>;
|
|
1442
|
+
merge(other: ValueSet<VALUE>): this;
|
|
1280
1443
|
some(fn: (value: VALUE) => boolean): boolean;
|
|
1281
1444
|
every(fn: (value: VALUE) => boolean): boolean;
|
|
1282
|
-
filter<R extends VALUE>(predicate: (value: VALUE,
|
|
1283
|
-
filter(predicate: (value: VALUE, set1:
|
|
1445
|
+
filter<R extends VALUE>(predicate: (value: VALUE, set: ValueSet<VALUE>) => value is R): ValueSet<R>;
|
|
1446
|
+
filter(predicate: (value: VALUE, set1: ValueSet<VALUE>) => unknown): ValueSet<VALUE>;
|
|
1284
1447
|
reduce(fn: (acc: VALUE, value: VALUE) => VALUE): VALUE;
|
|
1285
1448
|
reduce<R = VALUE>(fn: (acc: R, value: VALUE) => R, init: R): R;
|
|
1286
|
-
mapValues<R = VALUE>(fn: (value: VALUE) => R):
|
|
1449
|
+
mapValues<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
|
|
1287
1450
|
mapToArray<R = VALUE>(fn: (value: VALUE) => R): R[];
|
|
1288
|
-
map<R = VALUE>(fn: (value: VALUE) => R):
|
|
1451
|
+
map<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
|
|
1289
1452
|
toSet(): Set<VALUE>;
|
|
1290
1453
|
toArray(): VALUE[];
|
|
1291
1454
|
toString(): string;
|
|
1292
1455
|
}
|
|
1293
|
-
/**
|
|
1294
|
-
* A simple Set data structure. Comparison of values is done
|
|
1295
|
-
* using === operator (e.g. "a" === "a", but [1, 2] !== [1, 2]).
|
|
1296
|
-
*/
|
|
1297
|
-
declare class Set1<VALUE> extends SetBase<VALUE, Set1<VALUE>> {
|
|
1298
|
-
constructor();
|
|
1299
|
-
constructor(set: SetBase<VALUE>);
|
|
1300
|
-
constructor(entries: Iterable<VALUE>);
|
|
1301
|
-
protected createEmpty<R = VALUE>(): Set1<R>;
|
|
1302
|
-
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1303
|
-
protected getName(): string;
|
|
1304
|
-
}
|
|
1305
|
-
/**
|
|
1306
|
-
* A simple Set data structure, where comparison of values is done
|
|
1307
|
-
* using deep equality (e.g. "a" === "a" and also [1, 2] === [1, 2]).
|
|
1308
|
-
*/
|
|
1309
|
-
declare class DeepSet<VALUE> extends SetBase<VALUE, DeepSet<VALUE>> {
|
|
1310
|
-
constructor();
|
|
1311
|
-
constructor(set: SetBase<VALUE>);
|
|
1312
|
-
constructor(entries: Iterable<VALUE>);
|
|
1313
|
-
protected createEmpty<R = VALUE>(): DeepSet<R>;
|
|
1314
|
-
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1315
|
-
protected getName(): string;
|
|
1316
|
-
}
|
|
1317
1456
|
|
|
1318
1457
|
/**
|
|
1319
1458
|
* Wrapper class of a key-value container that contain array values.
|
|
1320
1459
|
*/
|
|
1321
|
-
declare class MultiContainer<K extends any[], V> {
|
|
1460
|
+
declare class MultiContainer<K extends any[], V> extends BaseContainer {
|
|
1322
1461
|
private readonly base;
|
|
1323
1462
|
constructor(base: KVComponent<K, V[]>);
|
|
1324
1463
|
isEmpty(): boolean;
|
|
@@ -1348,10 +1487,61 @@ declare class MultiContainer<K extends any[], V> {
|
|
|
1348
1487
|
*/
|
|
1349
1488
|
declare function asMulti<K extends any[], VALUE>(base: KVComponent<K, VALUE[]>): MultiContainer<K, VALUE>;
|
|
1350
1489
|
|
|
1490
|
+
declare class LinkedList<V> extends BaseContainer implements Iterable<V> {
|
|
1491
|
+
private _head;
|
|
1492
|
+
private _tail;
|
|
1493
|
+
private _size;
|
|
1494
|
+
private readonly equals;
|
|
1495
|
+
constructor();
|
|
1496
|
+
constructor(equals?: EqualityFn<V>);
|
|
1497
|
+
constructor(list: LinkedList<V> | Iterable<V>, equals?: EqualityFn<V>);
|
|
1498
|
+
static createDeep<V>(): LinkedList<V>;
|
|
1499
|
+
static createDeep<V>(list: LinkedList<V>): LinkedList<V>;
|
|
1500
|
+
static createDeep<V>(entries: Iterable<V>): LinkedList<V>;
|
|
1501
|
+
get length(): number;
|
|
1502
|
+
get first(): V | undefined;
|
|
1503
|
+
get last(): V | undefined;
|
|
1504
|
+
/** Add item to the end of the list */
|
|
1505
|
+
push(value: V): void;
|
|
1506
|
+
/** Remove item from the end of the list */
|
|
1507
|
+
pop(): V | undefined;
|
|
1508
|
+
/** Add item to the beginning of the list */
|
|
1509
|
+
unshift(value: V): void;
|
|
1510
|
+
/** Remove item from the beginning of the list */
|
|
1511
|
+
shift(): V | undefined;
|
|
1512
|
+
/** Check if value exists in the list */
|
|
1513
|
+
has(value: V): boolean;
|
|
1514
|
+
/** Get value at index (O(n/2)) */
|
|
1515
|
+
get(index: number): V | undefined;
|
|
1516
|
+
/** Set value at index (O(n/2)) */
|
|
1517
|
+
set(index: number, value: V): boolean;
|
|
1518
|
+
/** Insert value at index (O(n/2)) */
|
|
1519
|
+
insertAt(index: number, value: V): boolean;
|
|
1520
|
+
/** Remove value at index (O(n/2)) */
|
|
1521
|
+
removeAt(index: number): V | undefined;
|
|
1522
|
+
/** Remove first matching value (O(n)) */
|
|
1523
|
+
remove(value: V): boolean;
|
|
1524
|
+
/** Convert to array */
|
|
1525
|
+
toArray(): V[];
|
|
1526
|
+
/** Replace contents from array */
|
|
1527
|
+
fromArray(values: Iterable<V>): void;
|
|
1528
|
+
/** Clear all nodes */
|
|
1529
|
+
clear(): void;
|
|
1530
|
+
/** Iterator support */
|
|
1531
|
+
[Symbol.iterator](): Iterator<V>;
|
|
1532
|
+
keys(): IterableIterator<number>;
|
|
1533
|
+
values(): IterableIterator<V>;
|
|
1534
|
+
entries(): IterableIterator<[number, V]>;
|
|
1535
|
+
toString(): string;
|
|
1536
|
+
private nodeAt;
|
|
1537
|
+
clone(): LinkedList<V>;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1351
1540
|
/**
|
|
1352
|
-
*
|
|
1541
|
+
* @deprecated - Use {@link Vec} instead. Will be removed in v2.0.0.
|
|
1542
|
+
* @private
|
|
1353
1543
|
*
|
|
1354
|
-
*
|
|
1544
|
+
* Vec2 class.
|
|
1355
1545
|
*/
|
|
1356
1546
|
declare class Vec2 {
|
|
1357
1547
|
readonly x: number;
|
|
@@ -1365,7 +1555,8 @@ declare class Vec2 {
|
|
|
1365
1555
|
}
|
|
1366
1556
|
|
|
1367
1557
|
/**
|
|
1368
|
-
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions.
|
|
1558
|
+
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions. Will be removed in v2.0.0.
|
|
1559
|
+
* @private
|
|
1369
1560
|
*
|
|
1370
1561
|
* A cache-like structure optimized for small-range integer keys, including negatives.
|
|
1371
1562
|
*
|
|
@@ -1396,4 +1587,490 @@ declare class SmallIntCache<VALUE> {
|
|
|
1396
1587
|
clear(): void;
|
|
1397
1588
|
}
|
|
1398
1589
|
|
|
1399
|
-
|
|
1590
|
+
/**
|
|
1591
|
+
* @deprecated - Use {@link UniMap} instead. Will be removed in v2.0.0.
|
|
1592
|
+
* @private
|
|
1593
|
+
* A Map implementation mapping a single key to a value.
|
|
1594
|
+
*/
|
|
1595
|
+
declare class Map1<KEY1, VALUE> extends BaseContainer implements KVComponent<[KEY1], VALUE> {
|
|
1596
|
+
private map1;
|
|
1597
|
+
constructor();
|
|
1598
|
+
constructor(map1: Map1<KEY1, VALUE>);
|
|
1599
|
+
constructor(entries: Iterable<[KEY1, VALUE]>);
|
|
1600
|
+
has(key1: KEY1): boolean;
|
|
1601
|
+
set(key1: KEY1, value: VALUE): VALUE;
|
|
1602
|
+
get(key1: KEY1): VALUE | undefined;
|
|
1603
|
+
getOrDefault(key1: KEY1, defaultValue: VALUE): VALUE;
|
|
1604
|
+
getOrCreate(key1: KEY1, value: VALUE): VALUE;
|
|
1605
|
+
getOrCreate(key1: KEY1, creator: () => VALUE): VALUE;
|
|
1606
|
+
delete(key1: KEY1): boolean;
|
|
1607
|
+
clear(): void;
|
|
1608
|
+
get size(): number;
|
|
1609
|
+
isEmpty(): boolean;
|
|
1610
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
|
|
1611
|
+
keys(): IterableIterator<KEY1>;
|
|
1612
|
+
values(): IterableIterator<VALUE>;
|
|
1613
|
+
entries(): IterableIterator<[KEY1, VALUE]>;
|
|
1614
|
+
keysArray(): KEY1[];
|
|
1615
|
+
valuesArray(): VALUE[];
|
|
1616
|
+
entriesArray(): [KEY1, VALUE][];
|
|
1617
|
+
kvKeys(): IterableIterator<[KEY1]>;
|
|
1618
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1619
|
+
kvEntries(): IterableIterator<[[KEY1], VALUE]>;
|
|
1620
|
+
[Symbol.iterator](): IterableIterator<[KEY1, VALUE]>;
|
|
1621
|
+
clone(): Map1<KEY1, VALUE>;
|
|
1622
|
+
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
1623
|
+
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
1624
|
+
every(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
1625
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => value is S): Map1<KEY1, S>;
|
|
1626
|
+
filter(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => unknown): Map1<KEY1, VALUE>;
|
|
1627
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1) => VALUE): VALUE;
|
|
1628
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1) => R, init: R): R;
|
|
1629
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1) => R): R[];
|
|
1630
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1) => R): Map1<KEY1, R>;
|
|
1631
|
+
toMap(): Map<KEY1, VALUE>;
|
|
1632
|
+
toString(): string;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* @deprecated - Use {@link BiMap} instead. Will be removed in v2.0.0.
|
|
1637
|
+
* @private
|
|
1638
|
+
* A Map implementation mapping a double key to a value.
|
|
1639
|
+
*/
|
|
1640
|
+
declare class Map2<KEY1, KEY2, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
1641
|
+
private map1;
|
|
1642
|
+
constructor();
|
|
1643
|
+
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
1644
|
+
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
1645
|
+
has(key1: KEY1, key2: KEY2): boolean;
|
|
1646
|
+
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
1647
|
+
get(key1: KEY1, key2: KEY2): VALUE | undefined;
|
|
1648
|
+
getOrDefault(key1: KEY1, key2: KEY2, defaultValue: VALUE): VALUE;
|
|
1649
|
+
getOrCreate(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
1650
|
+
getOrCreate(key1: KEY1, key2: KEY2, creator: () => VALUE): VALUE;
|
|
1651
|
+
delete(key1: KEY1): boolean;
|
|
1652
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
1653
|
+
clear(): void;
|
|
1654
|
+
get size(): number;
|
|
1655
|
+
isEmpty(): boolean;
|
|
1656
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
1657
|
+
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
1658
|
+
values(): IterableIterator<VALUE>;
|
|
1659
|
+
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1660
|
+
keysArray(): [KEY1, KEY2][];
|
|
1661
|
+
valuesArray(): VALUE[];
|
|
1662
|
+
entriesArray(): [KEY1, KEY2, VALUE][];
|
|
1663
|
+
kvKeys(): IterableIterator<[KEY1, KEY2]>;
|
|
1664
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1665
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
1666
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1667
|
+
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
1668
|
+
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
1669
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1670
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1671
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => value is S): Map2<KEY1, KEY2, S>;
|
|
1672
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => unknown): Map2<KEY1, KEY2, VALUE>;
|
|
1673
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
|
|
1674
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
1675
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
1676
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): Map2<KEY1, KEY2, R>;
|
|
1677
|
+
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
1678
|
+
toString(): string;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* @deprecated - Use {@link TriMap} instead. Will be removed in v2.0.0.
|
|
1683
|
+
* @private
|
|
1684
|
+
* A Map implementation mapping a triple key to a value.
|
|
1685
|
+
*/
|
|
1686
|
+
declare class Map3<KEY1, KEY2, KEY3, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
1687
|
+
private map1;
|
|
1688
|
+
constructor();
|
|
1689
|
+
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
1690
|
+
constructor(map3: Map3<KEY1, KEY2, KEY3, VALUE>);
|
|
1691
|
+
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1692
|
+
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1693
|
+
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
1694
|
+
getOrDefault(key1: KEY1, key2: KEY2, key3: KEY3, defaultValue: VALUE): VALUE;
|
|
1695
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1696
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, creator: () => VALUE): VALUE;
|
|
1697
|
+
delete(key1: KEY1): boolean;
|
|
1698
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
1699
|
+
delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1700
|
+
clear(): void;
|
|
1701
|
+
get size(): number;
|
|
1702
|
+
isEmpty(): boolean;
|
|
1703
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
1704
|
+
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1705
|
+
values(): IterableIterator<VALUE>;
|
|
1706
|
+
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1707
|
+
keysArray(): [KEY1, KEY2, KEY3][];
|
|
1708
|
+
valuesArray(): VALUE[];
|
|
1709
|
+
entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
|
|
1710
|
+
kvKeys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1711
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1712
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
1713
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1714
|
+
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
1715
|
+
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
1716
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1717
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1718
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: Map3<KEY1, KEY2, KEY3, VALUE>) => value is S): Map3<KEY1, KEY2, KEY3, S>;
|
|
1719
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: Map3<KEY1, KEY2, KEY3, VALUE>) => unknown): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
1720
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
|
|
1721
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
1722
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
1723
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): Map3<KEY1, KEY2, KEY3, R>;
|
|
1724
|
+
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
1725
|
+
toString(): string;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* @deprecated - Use {@link ValueSet} instead. Will be removed in v2.0.0.
|
|
1730
|
+
* @private
|
|
1731
|
+
* An abstract base class implementation of a Set data structure.
|
|
1732
|
+
*/
|
|
1733
|
+
declare abstract class SetBase<VALUE, CLS extends SetBase<VALUE, CLS> = any> extends BaseContainer implements KVComponent<[VALUE], VALUE> {
|
|
1734
|
+
protected data: Set<VALUE>;
|
|
1735
|
+
constructor(entries?: Iterable<VALUE>);
|
|
1736
|
+
protected abstract valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1737
|
+
protected abstract createEmpty<R = VALUE>(): SetBase<R, any>;
|
|
1738
|
+
has(value: VALUE): boolean;
|
|
1739
|
+
add(value: VALUE): VALUE;
|
|
1740
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1741
|
+
set(key: VALUE, value: VALUE): void;
|
|
1742
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1743
|
+
get(key: VALUE): VALUE | undefined;
|
|
1744
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1745
|
+
getOrDefault(key: VALUE, defaultValue: VALUE): VALUE;
|
|
1746
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1747
|
+
getOrCreate(key: VALUE, value: VALUE): VALUE;
|
|
1748
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1749
|
+
getOrCreate(key: VALUE, creator: () => VALUE): VALUE;
|
|
1750
|
+
delete(value: VALUE): boolean;
|
|
1751
|
+
clear(): void;
|
|
1752
|
+
get size(): number;
|
|
1753
|
+
isEmpty(): boolean;
|
|
1754
|
+
forEach(callbackfn: (value: VALUE, set1: SetBase<VALUE>) => void, thisArg?: any): void;
|
|
1755
|
+
keys(): IterableIterator<VALUE>;
|
|
1756
|
+
values(): IterableIterator<VALUE>;
|
|
1757
|
+
entries(): IterableIterator<[VALUE, VALUE]>;
|
|
1758
|
+
kvKeys(): IterableIterator<[VALUE]>;
|
|
1759
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1760
|
+
kvEntries(): IterableIterator<[[VALUE], VALUE]>;
|
|
1761
|
+
[Symbol.iterator](): IterableIterator<VALUE>;
|
|
1762
|
+
clone(): SetBase<VALUE>;
|
|
1763
|
+
merge(other: SetBase<VALUE>): this;
|
|
1764
|
+
some(fn: (value: VALUE) => boolean): boolean;
|
|
1765
|
+
every(fn: (value: VALUE) => boolean): boolean;
|
|
1766
|
+
filter<R extends VALUE>(predicate: (value: VALUE, set1: SetBase<VALUE, any>) => value is R): SetBase<R, any>;
|
|
1767
|
+
filter(predicate: (value: VALUE, set1: SetBase<VALUE>) => unknown): SetBase<VALUE, any>;
|
|
1768
|
+
reduce(fn: (acc: VALUE, value: VALUE) => VALUE): VALUE;
|
|
1769
|
+
reduce<R = VALUE>(fn: (acc: R, value: VALUE) => R, init: R): R;
|
|
1770
|
+
mapValues<R = VALUE>(fn: (value: VALUE) => R): SetBase<R, any>;
|
|
1771
|
+
mapToArray<R = VALUE>(fn: (value: VALUE) => R): R[];
|
|
1772
|
+
map<R = VALUE>(fn: (value: VALUE) => R): SetBase<R, any>;
|
|
1773
|
+
toSet(): Set<VALUE>;
|
|
1774
|
+
toArray(): VALUE[];
|
|
1775
|
+
toString(): string;
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* @deprecated - Use {@link ValueSet} instead. Will be removed in v2.0.0.
|
|
1779
|
+
* @private
|
|
1780
|
+
* A simple Set data structure. Comparison of values is done
|
|
1781
|
+
* using === operator (e.g. "a" === "a", but [1, 2] !== [1, 2]).
|
|
1782
|
+
*/
|
|
1783
|
+
declare class Set1<VALUE> extends SetBase<VALUE, Set1<VALUE>> {
|
|
1784
|
+
constructor();
|
|
1785
|
+
constructor(set: SetBase<VALUE>);
|
|
1786
|
+
constructor(entries: Iterable<VALUE>);
|
|
1787
|
+
protected createEmpty<R = VALUE>(): Set1<R>;
|
|
1788
|
+
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* @deprecated - Use {@link ValueSet}.createDeep() instead. Will be removed in v2.0.0.
|
|
1792
|
+
* @private
|
|
1793
|
+
* A simple Set data structure, where comparison of values is done
|
|
1794
|
+
* using deep equality (e.g. "a" === "a" and also [1, 2] === [1, 2]).
|
|
1795
|
+
*/
|
|
1796
|
+
declare class DeepSet<VALUE> extends SetBase<VALUE, DeepSet<VALUE>> {
|
|
1797
|
+
constructor();
|
|
1798
|
+
constructor(set: SetBase<VALUE>);
|
|
1799
|
+
constructor(entries: Iterable<VALUE>);
|
|
1800
|
+
protected createEmpty<R = VALUE>(): DeepSet<R>;
|
|
1801
|
+
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* @deprecated - Use {@link AnchoredRect} instead. Will be removed in v2.0.0.
|
|
1806
|
+
* @private
|
|
1807
|
+
*
|
|
1808
|
+
* A mutable DivRect class is a rectangle (left, top, right, bottom) with an anchor point (anchorX, anchorY).
|
|
1809
|
+
*/
|
|
1810
|
+
declare class DivRect {
|
|
1811
|
+
left: number;
|
|
1812
|
+
anchorX: number;
|
|
1813
|
+
right: number;
|
|
1814
|
+
top: number;
|
|
1815
|
+
anchorY: number;
|
|
1816
|
+
bottom: number;
|
|
1817
|
+
/**
|
|
1818
|
+
* Create rectangle with all zero values.
|
|
1819
|
+
*/
|
|
1820
|
+
constructor();
|
|
1821
|
+
/**
|
|
1822
|
+
* Create rectangle with left, right, top, bottom.
|
|
1823
|
+
* Properties anchorX and anchorY will be centered in the middle.
|
|
1824
|
+
*
|
|
1825
|
+
* @param left - Left coordinate.
|
|
1826
|
+
* @param right - Right coordinate.
|
|
1827
|
+
* @param top - Top coordinate.
|
|
1828
|
+
* @param bottom - Bottom coordinate.
|
|
1829
|
+
*/
|
|
1830
|
+
constructor(left: number, right: number, top: number, bottom: number);
|
|
1831
|
+
/**
|
|
1832
|
+
* Create rectangle with full arguments.
|
|
1833
|
+
*
|
|
1834
|
+
* @param left - Left coordinate.
|
|
1835
|
+
* @param anchorX - Center x-coordinate.
|
|
1836
|
+
* @param right - Right coordinate.
|
|
1837
|
+
* @param top - Top coordinate.
|
|
1838
|
+
* @param anchorY - Center y-coordinate.
|
|
1839
|
+
* @param bottom - Bottom coordinate.
|
|
1840
|
+
*/
|
|
1841
|
+
constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
|
|
1842
|
+
/**
|
|
1843
|
+
* Set rectangle with all zero values.
|
|
1844
|
+
*/
|
|
1845
|
+
set(): DivRect;
|
|
1846
|
+
/**
|
|
1847
|
+
* Set rectangle with left, right, top, bottom.
|
|
1848
|
+
* Properties anchorX and anchorY will be centered in the middle.
|
|
1849
|
+
*
|
|
1850
|
+
* @param left - Left coordinate.
|
|
1851
|
+
* @param right - Right coordinate.
|
|
1852
|
+
* @param top - Top coordinate.
|
|
1853
|
+
* @param bottom - Bottom coordinate.
|
|
1854
|
+
*/
|
|
1855
|
+
set(left: number, right: number, top: number, bottom: number): DivRect;
|
|
1856
|
+
/**
|
|
1857
|
+
* Set rectangle with full arguments.
|
|
1858
|
+
*
|
|
1859
|
+
* @param left - Left coordinate.
|
|
1860
|
+
* @param anchorX - Center x-coordinate.
|
|
1861
|
+
* @param right - Right coordinate.
|
|
1862
|
+
* @param top - Top coordinate.
|
|
1863
|
+
* @param anchorY - Center y-coordinate.
|
|
1864
|
+
* @param bottom - Bottom coordinate.
|
|
1865
|
+
*/
|
|
1866
|
+
set(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number): DivRect;
|
|
1867
|
+
/**
|
|
1868
|
+
* Create rect from basic left, top, width and height arguments.
|
|
1869
|
+
*
|
|
1870
|
+
* @param left - Left coordinate.
|
|
1871
|
+
* @param top - Top coordinate.
|
|
1872
|
+
* @param width - Width.
|
|
1873
|
+
* @param height - Height.
|
|
1874
|
+
* @returns - DivRect.
|
|
1875
|
+
*/
|
|
1876
|
+
static create(left: number, top: number, width: number, height: number): DivRect;
|
|
1877
|
+
/**
|
|
1878
|
+
* Create rect from anchorX, anchorY, width, height arguments.
|
|
1879
|
+
*
|
|
1880
|
+
* @param centerX - Center x-coordinate.
|
|
1881
|
+
* @param centerY - Center y-coordinate.
|
|
1882
|
+
* @param width - Width.
|
|
1883
|
+
* @param height - Height.
|
|
1884
|
+
* @returns - DivRect.
|
|
1885
|
+
*/
|
|
1886
|
+
static createCentered(centerX: number, centerY: number, width: number, height: number): DivRect;
|
|
1887
|
+
/**
|
|
1888
|
+
* Create rect from sections.
|
|
1889
|
+
*
|
|
1890
|
+
* @param leftw - Left section width.
|
|
1891
|
+
* @param rightw - Right section width.
|
|
1892
|
+
* @param toph - Top section height.
|
|
1893
|
+
* @param bottomh - Bottomsection height.
|
|
1894
|
+
* @returns - DivRect.
|
|
1895
|
+
*/
|
|
1896
|
+
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
1897
|
+
/**
|
|
1898
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
1899
|
+
* @private
|
|
1900
|
+
* */
|
|
1901
|
+
get centerX(): number;
|
|
1902
|
+
/**
|
|
1903
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
1904
|
+
* @private
|
|
1905
|
+
* */
|
|
1906
|
+
set centerX(x: number);
|
|
1907
|
+
/**
|
|
1908
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
1909
|
+
* @private
|
|
1910
|
+
* */
|
|
1911
|
+
get centerY(): number;
|
|
1912
|
+
/**
|
|
1913
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
1914
|
+
* @private
|
|
1915
|
+
* */
|
|
1916
|
+
set centerY(y: number);
|
|
1917
|
+
/**
|
|
1918
|
+
* Width getter.
|
|
1919
|
+
*/
|
|
1920
|
+
get width(): number;
|
|
1921
|
+
/**
|
|
1922
|
+
* Height getter.
|
|
1923
|
+
*/
|
|
1924
|
+
get height(): number;
|
|
1925
|
+
/**
|
|
1926
|
+
* Left section width getter.
|
|
1927
|
+
*/
|
|
1928
|
+
get leftw(): number;
|
|
1929
|
+
/**
|
|
1930
|
+
* Right section width getter.
|
|
1931
|
+
*/
|
|
1932
|
+
get rightw(): number;
|
|
1933
|
+
/**
|
|
1934
|
+
* Top section height getter.
|
|
1935
|
+
*/
|
|
1936
|
+
get toph(): number;
|
|
1937
|
+
/**
|
|
1938
|
+
* Bottom section height getter.
|
|
1939
|
+
*/
|
|
1940
|
+
get bottomh(): number;
|
|
1941
|
+
/**
|
|
1942
|
+
* Does this Rect contain given (x, y)-point?
|
|
1943
|
+
*
|
|
1944
|
+
* @param x - X-coordinate.
|
|
1945
|
+
* @param y - Y-coordinate.
|
|
1946
|
+
* @returns - True/false.
|
|
1947
|
+
*/
|
|
1948
|
+
contains(x: number, y: number): boolean;
|
|
1949
|
+
/**
|
|
1950
|
+
* Do a and b rects overlap?
|
|
1951
|
+
*
|
|
1952
|
+
* @param a - DivRect a.
|
|
1953
|
+
* @param b - DivRect b.
|
|
1954
|
+
* @returns - True/false.
|
|
1955
|
+
*/
|
|
1956
|
+
static overlap(a: DivRect, b: DivRect): boolean;
|
|
1957
|
+
/**
|
|
1958
|
+
* Do horizontal measures of a and b rects overlap?
|
|
1959
|
+
*
|
|
1960
|
+
* @param a - DivRect a.
|
|
1961
|
+
* @param b - DivRect b.
|
|
1962
|
+
* @returns - True/false.
|
|
1963
|
+
*/
|
|
1964
|
+
static overlapX(a: DivRect, b: DivRect): boolean;
|
|
1965
|
+
/**
|
|
1966
|
+
* Check if given rects are equal.
|
|
1967
|
+
* @param a - DivRect a.
|
|
1968
|
+
* @param b - DivRect b.
|
|
1969
|
+
* @returns - True/false.
|
|
1970
|
+
*/
|
|
1971
|
+
static equals(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
1972
|
+
/**
|
|
1973
|
+
* Check if this rect equals with another rect.
|
|
1974
|
+
* @param other - The other rect.
|
|
1975
|
+
* @returns - True/false.
|
|
1976
|
+
*/
|
|
1977
|
+
equals(other: DivRect): boolean;
|
|
1978
|
+
/**
|
|
1979
|
+
* Check if edges of given rects are equal, ignoring anchorX and anchorY.
|
|
1980
|
+
*
|
|
1981
|
+
* @param a - DivRect a.
|
|
1982
|
+
* @param b - DivRect b.
|
|
1983
|
+
* @returns - True/false.
|
|
1984
|
+
*/
|
|
1985
|
+
static equalsEdges(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
1986
|
+
/**
|
|
1987
|
+
* Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
|
|
1988
|
+
*
|
|
1989
|
+
* @param other - The other DivRect.
|
|
1990
|
+
* @returns - True/false.
|
|
1991
|
+
*/
|
|
1992
|
+
equalsEdges(other: DivRect): boolean;
|
|
1993
|
+
/**
|
|
1994
|
+
* @deprecated - Use {@link equalsEdges()} instead. Will be removed in v2.0.0.
|
|
1995
|
+
* @private
|
|
1996
|
+
*/
|
|
1997
|
+
static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
1998
|
+
/**
|
|
1999
|
+
* @deprecated - Use {@link clone()} instead. Will be removed in v2.0.0.
|
|
2000
|
+
* @private
|
|
2001
|
+
*/
|
|
2002
|
+
copy(): DivRect;
|
|
2003
|
+
/**
|
|
2004
|
+
* Created duplicate of this Rect.
|
|
2005
|
+
* @returns - Duplicate.
|
|
2006
|
+
*/
|
|
2007
|
+
clone(): DivRect;
|
|
2008
|
+
/**
|
|
2009
|
+
* Move this rect by (dx, dy). Modifies this Rect.
|
|
2010
|
+
*
|
|
2011
|
+
* @param dx - Offset amount in x-direction.
|
|
2012
|
+
* @param dy - Offset amount in y-direction.
|
|
2013
|
+
* @returns - This DivRect instance.
|
|
2014
|
+
*/
|
|
2015
|
+
offsetInPlace(dx: number, dy: number): DivRect;
|
|
2016
|
+
/**
|
|
2017
|
+
* Move this rect by (dx, dy). Immutable, returns modified copy.
|
|
2018
|
+
*
|
|
2019
|
+
* @param dx - Offset amount in x-direction.
|
|
2020
|
+
* @param dy - Offset amount in y-direction.
|
|
2021
|
+
* @returns - DivRect copy with applied offset.
|
|
2022
|
+
*/
|
|
2023
|
+
offsetCopy(dx: number, dy: number): DivRect;
|
|
2024
|
+
/**
|
|
2025
|
+
* Expand this Rect by given Rect. Modifies this Rect.
|
|
2026
|
+
*
|
|
2027
|
+
* @param rect - DivRect to expand this instance with.
|
|
2028
|
+
* @returns - This DivRect instance.
|
|
2029
|
+
*/
|
|
2030
|
+
expandInPlace(rect: DivRect): DivRect;
|
|
2031
|
+
/**
|
|
2032
|
+
* Expand this Rect by given Rect. Immutable, returns modified copy.
|
|
2033
|
+
*
|
|
2034
|
+
* @param rect - DivRect to expand this instance with.
|
|
2035
|
+
* @returns - Expanded copy of this DivRect.
|
|
2036
|
+
*/
|
|
2037
|
+
expandCopy(rect: DivRect): DivRect;
|
|
2038
|
+
/**
|
|
2039
|
+
* Clip this Rect by given Rect. Mmodifies this Rect.
|
|
2040
|
+
*
|
|
2041
|
+
* @param clipRect - DivRect to clip this instance with.
|
|
2042
|
+
* @returns - This DivRect instance.
|
|
2043
|
+
*/
|
|
2044
|
+
clipInPlace(clipRect: DivRect): DivRect;
|
|
2045
|
+
/**
|
|
2046
|
+
* Clip this Rect by given Rect. Immutable, return modified copy.
|
|
2047
|
+
*
|
|
2048
|
+
* @param clipRect - DivRecto to clip this instance with.
|
|
2049
|
+
* @returns - Clipped DivRect copy.
|
|
2050
|
+
*/
|
|
2051
|
+
clipCopy(clipRect: DivRect): DivRect;
|
|
2052
|
+
/**
|
|
2053
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
|
|
2054
|
+
*
|
|
2055
|
+
* @param scaleX - Scale x-amount.
|
|
2056
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
2057
|
+
* @returns This DivRect instance.
|
|
2058
|
+
*/
|
|
2059
|
+
scaleInPlace(scaleX: number, scaleY?: number): DivRect;
|
|
2060
|
+
/**
|
|
2061
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
|
|
2062
|
+
*
|
|
2063
|
+
* @param scaleX - Scale x-amount.
|
|
2064
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
2065
|
+
* @returns Scaled copy of this DivRect.
|
|
2066
|
+
*/
|
|
2067
|
+
scaleCopy(scaleX: number, scaleY?: number): DivRect;
|
|
2068
|
+
/**
|
|
2069
|
+
* Get this DivRect instance.
|
|
2070
|
+
* @returns - This DivRect instance.
|
|
2071
|
+
*/
|
|
2072
|
+
getRect(): DivRect;
|
|
2073
|
+
toRect(): Rect;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
export { AnchoredRect, index$7 as Assert, BaseContainer, BiMap, cookies as Cookies, DeepSet, DefaultArray, DefaultEqualityFn, device as Device, DivRect, type EqualityFn, Guard, IndexArray, type KVComponent, LRUCache, LinkedList, Map1, Map2, Map3, MultiContainer, Rect, Set1, SetBase, SignedIndexArray, SmallIntCache, Stack, TriMap, UniMap, index as Utils, ValueSet, Vec, Vec2, asMulti };
|