@tspro/ts-utils-lib 1.16.0 → 1.18.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 +24 -0
- package/README.md +4 -4
- package/dist/index.d.mts +718 -261
- package/dist/index.d.ts +718 -261
- package/dist/index.js +1662 -748
- package/dist/index.mjs +1659 -748
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,207 @@
|
|
|
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
|
+
declare function isEnumValue$2<E extends EnumObject>(e: E, value: unknown): value is EnumValue<E>;
|
|
10
|
+
declare function assertEnumValue<E extends EnumObject>(e: E, value: unknown): asserts value is EnumValue<E>;
|
|
11
|
+
|
|
12
|
+
type index$8_EnumKey<E extends EnumObject> = EnumKey<E>;
|
|
13
|
+
type index$8_EnumObject = EnumObject;
|
|
14
|
+
type index$8_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
15
|
+
declare const index$8_assertEnumValue: typeof assertEnumValue;
|
|
16
|
+
declare const index$8_forEachEnum: typeof forEachEnum;
|
|
17
|
+
declare const index$8_getEnumEntries: typeof getEnumEntries;
|
|
18
|
+
declare const index$8_getEnumKey: typeof getEnumKey;
|
|
19
|
+
declare const index$8_getEnumKeys: typeof getEnumKeys;
|
|
20
|
+
declare const index$8_getEnumValues: typeof getEnumValues;
|
|
21
|
+
declare namespace index$8 {
|
|
22
|
+
export { type index$8_EnumKey as EnumKey, type index$8_EnumObject as EnumObject, type index$8_EnumValue as EnumValue, index$8_assertEnumValue as assertEnumValue, 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, isEnumValue$2 as isEnumValue };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type ErrorConstructor = new (msg: string) => Error;
|
|
26
|
+
declare function setErrorClass(errorClass?: ErrorConstructor): void;
|
|
27
|
+
/** @deprecated */
|
|
28
|
+
declare function interrupt(msg?: string): never;
|
|
29
|
+
/** @deprecated */
|
|
30
|
+
declare function assertEnum<E extends EnumObject>(enumVal: unknown, enumObj: E, name?: string): asserts enumVal is E[keyof E];
|
|
31
|
+
/** @deprecated */
|
|
32
|
+
declare function int(value: unknown, msg?: string): number;
|
|
33
|
+
/** @deprecated */
|
|
34
|
+
declare function eq<T>(value1: T, value2: T, msg?: string): T;
|
|
35
|
+
/** @deprecated */
|
|
36
|
+
declare function int_eq(value: unknown, compareTo: unknown, msg?: string): number;
|
|
37
|
+
/** @deprecated */
|
|
38
|
+
declare function int_lt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
39
|
+
/** @deprecated */
|
|
40
|
+
declare function int_lte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
41
|
+
/** @deprecated */
|
|
42
|
+
declare function int_gt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
43
|
+
/** @deprecated */
|
|
44
|
+
declare function int_gte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
45
|
+
/** @deprecated */
|
|
46
|
+
declare function int_between(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
47
|
+
/** @deprecated */
|
|
48
|
+
declare function int_between_exclusive(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
49
|
+
/** @deprecated */
|
|
50
|
+
declare function odd(value: unknown, msg?: string): number;
|
|
51
|
+
/** @deprecated */
|
|
52
|
+
declare function even(value: unknown, msg?: string): number;
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
declare function in_group<T>(value: T, group: ReadonlyArray<T>, msg?: string): T;
|
|
55
|
+
/** @deprecated */
|
|
56
|
+
declare function finite(value: unknown, msg?: string): number;
|
|
57
|
+
/** @deprecated */
|
|
58
|
+
declare function array_id<T>(array: Readonly<T[]>, index: unknown, msg?: string): number;
|
|
59
|
+
/** @deprecated */
|
|
60
|
+
declare function array_elem<T>(array: Readonly<T[]>, index: number, msg?: string): T;
|
|
61
|
+
declare function assert<T>(condition: T, msg?: string): void;
|
|
62
|
+
declare function require<T>(value: T | null | undefined, msg?: string): T;
|
|
63
|
+
declare function requireDefined<T>(value: T | undefined, msg?: string): T;
|
|
64
|
+
declare function fail(msg?: string): never;
|
|
65
|
+
declare function isEqual$1(value1: unknown, value2: unknown, msg?: string): boolean;
|
|
66
|
+
declare function isDeepEqual$1(value1: unknown, value2: unknown, msg?: string): boolean;
|
|
67
|
+
declare function isUndefined$1(value: unknown, msg?: string): value is undefined;
|
|
68
|
+
declare function isNull$1(value: unknown, msg?: string): value is null;
|
|
69
|
+
declare function isNullish$1(value: unknown, msg?: string): value is null | undefined;
|
|
70
|
+
declare function isObject$1(value: unknown, msg?: string): value is Record<string, unknown>;
|
|
71
|
+
declare function isObjectOrUndefined$1(value: unknown, msg?: string): value is Record<string, unknown> | undefined;
|
|
72
|
+
declare function isTypedObject$1<T extends object>(obj: unknown, keys: (keyof T)[], msg?: string): obj is HasProps<T>;
|
|
73
|
+
declare function isArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
74
|
+
declare function isArrayOrUndefined$1(value: unknown, msg?: string): value is unknown[] | undefined;
|
|
75
|
+
declare function isEmptyArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
76
|
+
declare function isNonEmptyArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
77
|
+
declare function isEmptyArrayOrUndefined$1<T>(value: T[] | unknown, msg?: string): value is T[] | undefined;
|
|
78
|
+
declare function isNonEmptyArrayOrUndefined$1<T>(value: T[] | unknown, msg?: string): value is T[] | undefined;
|
|
79
|
+
declare function isString$1(value: unknown, msg?: string): value is string;
|
|
80
|
+
declare function isEmptyString$1(value: unknown, msg?: string): value is "";
|
|
81
|
+
declare function isNonEmptyString$1(value: unknown, msg?: string): value is string;
|
|
82
|
+
declare function isStringOrUndefined$1(value: unknown, msg?: string): value is string | undefined;
|
|
83
|
+
declare function isEmptyStringOrUndefined$1(value: unknown, msg?: string): value is "" | undefined;
|
|
84
|
+
declare function isNonEmptyStringOrUndefined$1(value: unknown, msg?: string): value is string | undefined;
|
|
85
|
+
declare function isBoolean$1(value: unknown, msg?: string): value is boolean;
|
|
86
|
+
declare function isBooleanOrUndefined$1(value: unknown, msg?: string): value is boolean | undefined;
|
|
87
|
+
declare function isTrue$1(value: unknown, msg?: string): value is boolean;
|
|
88
|
+
declare function isTrueOrUndefined$1(value: unknown, msg?: string): value is boolean;
|
|
89
|
+
declare function isFalse$1(value: unknown, msg?: string): value is boolean;
|
|
90
|
+
declare function isFalseOrUndefined$1(value: unknown, msg?: string): value is boolean;
|
|
91
|
+
declare function isFunction$1(value: unknown, msg?: string): value is Function;
|
|
92
|
+
declare function isFunctionOrUndefined$1(value: unknown, msg?: string): value is Function | undefined;
|
|
93
|
+
declare function isEnumValue$1<E extends EnumObject>(enumValue: unknown, enumObject: E, msg?: string): enumValue is E[keyof E];
|
|
94
|
+
declare function isEnumValueOrUndefined$1<E extends EnumObject>(enumValue: unknown, enumObject: E, msg?: string): enumValue is E[keyof E];
|
|
95
|
+
declare function isNumber$1(value: unknown, msg?: string): value is number;
|
|
96
|
+
declare function isNumberOrUndefined$1(value: unknown, msg?: string): value is number | undefined;
|
|
97
|
+
declare function isFinite$1(value: unknown, msg?: string): value is number;
|
|
98
|
+
declare function isInteger$1(value: unknown, msg?: string): value is number;
|
|
99
|
+
declare function isIntegerOrUndefined$1(value: unknown, msg?: string): value is number | undefined;
|
|
100
|
+
declare function isIntegerEq$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
101
|
+
declare function isIntegerGt$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
102
|
+
declare function isIntegerGte$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
103
|
+
declare function isIntegerLt$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
104
|
+
declare function isIntegerLte$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
105
|
+
declare function isIntegerBetween$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
106
|
+
declare function isIntegerBetweenExclusive$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
107
|
+
declare function isNumberBetween$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
108
|
+
declare function isNumberBetweenExclusive$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
109
|
+
declare function isNaNValue$1(value: unknown, msg?: string): value is number;
|
|
110
|
+
declare function isInfinity$1(value: unknown, msg?: string): value is number;
|
|
111
|
+
declare function isPosInfinity$1(value: unknown, msg?: string): value is number;
|
|
112
|
+
declare function isNegInfinity$1(value: unknown, msg?: string): value is number;
|
|
113
|
+
declare function isOddNumber$1(value: unknown, msg?: string): value is number;
|
|
114
|
+
declare function isEvenNumber$1(value: unknown, msg?: string): value is number;
|
|
115
|
+
declare function isIncluded$1<T>(value: T, array: ReadonlyArray<T>, msg?: string): value is T;
|
|
116
|
+
declare function isArrayIndex$1<T>(index: unknown, array: ReadonlyArray<T>, msg?: string): index is number;
|
|
117
|
+
declare function isThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
118
|
+
|
|
119
|
+
type index$7_ErrorConstructor = ErrorConstructor;
|
|
120
|
+
declare const index$7_array_elem: typeof array_elem;
|
|
121
|
+
declare const index$7_array_id: typeof array_id;
|
|
122
|
+
declare const index$7_assert: typeof assert;
|
|
123
|
+
declare const index$7_assertEnum: typeof assertEnum;
|
|
124
|
+
declare const index$7_eq: typeof eq;
|
|
125
|
+
declare const index$7_even: typeof even;
|
|
126
|
+
declare const index$7_fail: typeof fail;
|
|
127
|
+
declare const index$7_finite: typeof finite;
|
|
128
|
+
declare const index$7_in_group: typeof in_group;
|
|
129
|
+
declare const index$7_int: typeof int;
|
|
130
|
+
declare const index$7_int_between: typeof int_between;
|
|
131
|
+
declare const index$7_int_between_exclusive: typeof int_between_exclusive;
|
|
132
|
+
declare const index$7_int_eq: typeof int_eq;
|
|
133
|
+
declare const index$7_int_gt: typeof int_gt;
|
|
134
|
+
declare const index$7_int_gte: typeof int_gte;
|
|
135
|
+
declare const index$7_int_lt: typeof int_lt;
|
|
136
|
+
declare const index$7_int_lte: typeof int_lte;
|
|
137
|
+
declare const index$7_interrupt: typeof interrupt;
|
|
138
|
+
declare const index$7_odd: typeof odd;
|
|
139
|
+
declare const index$7_require: typeof require;
|
|
140
|
+
declare const index$7_requireDefined: typeof requireDefined;
|
|
141
|
+
declare const index$7_setErrorClass: typeof setErrorClass;
|
|
142
|
+
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 };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare function setExpireDays(days: number): void;
|
|
147
|
+
declare function isConsentPending(): boolean;
|
|
148
|
+
declare function accept(): void;
|
|
149
|
+
declare function decline(): void;
|
|
150
|
+
declare function save<T extends string | number | boolean>(name: string, value: T): T;
|
|
151
|
+
declare function read(name: string, defaultValue: string): string;
|
|
152
|
+
declare function readInt(name: string, defaultValue: number): number;
|
|
153
|
+
declare function readBool(name: string, defaultValue: boolean): boolean;
|
|
154
|
+
declare function erase(name: string): void;
|
|
155
|
+
declare function eraseAll(): void;
|
|
156
|
+
|
|
157
|
+
declare const cookies_accept: typeof accept;
|
|
158
|
+
declare const cookies_decline: typeof decline;
|
|
159
|
+
declare const cookies_erase: typeof erase;
|
|
160
|
+
declare const cookies_eraseAll: typeof eraseAll;
|
|
161
|
+
declare const cookies_isConsentPending: typeof isConsentPending;
|
|
162
|
+
declare const cookies_read: typeof read;
|
|
163
|
+
declare const cookies_readBool: typeof readBool;
|
|
164
|
+
declare const cookies_readInt: typeof readInt;
|
|
165
|
+
declare const cookies_save: typeof save;
|
|
166
|
+
declare const cookies_setExpireDays: typeof setExpireDays;
|
|
167
|
+
declare namespace cookies {
|
|
168
|
+
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 };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const DPI: number;
|
|
172
|
+
declare const PxPerMm: number;
|
|
173
|
+
declare const ScrollbarWidth: number;
|
|
174
|
+
declare const FontSize: number;
|
|
175
|
+
declare const IsTouchDevice: boolean;
|
|
176
|
+
declare const IsMobileDevice: boolean;
|
|
177
|
+
declare const HostAddress: string;
|
|
178
|
+
declare function pxToMm(px: number): number;
|
|
179
|
+
declare function mmToPx(mm: number): number;
|
|
180
|
+
declare function toPx(input: string | number): number;
|
|
181
|
+
|
|
182
|
+
declare const device_DPI: typeof DPI;
|
|
183
|
+
declare const device_FontSize: typeof FontSize;
|
|
184
|
+
declare const device_HostAddress: typeof HostAddress;
|
|
185
|
+
declare const device_IsMobileDevice: typeof IsMobileDevice;
|
|
186
|
+
declare const device_IsTouchDevice: typeof IsTouchDevice;
|
|
187
|
+
declare const device_PxPerMm: typeof PxPerMm;
|
|
188
|
+
declare const device_ScrollbarWidth: typeof ScrollbarWidth;
|
|
189
|
+
declare const device_mmToPx: typeof mmToPx;
|
|
190
|
+
declare const device_pxToMm: typeof pxToMm;
|
|
191
|
+
declare const device_toPx: typeof toPx;
|
|
192
|
+
declare namespace device {
|
|
193
|
+
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 };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare function isEqual(value1: unknown, value2: unknown): boolean;
|
|
197
|
+
declare function isDeepEqual(value1: unknown, value2: unknown): boolean;
|
|
1
198
|
declare function isUndefined(value: unknown): value is undefined;
|
|
2
199
|
declare function isNull(value: unknown): value is null;
|
|
3
200
|
declare function isNullish(value: unknown): value is null | undefined;
|
|
4
201
|
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
5
202
|
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
203
|
+
type HasProps<T extends object> = T extends Record<string, unknown> ? T : never;
|
|
204
|
+
declare function isTypedObject<T extends object>(obj: unknown, keys: (keyof T)[]): obj is HasProps<T>;
|
|
6
205
|
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
7
206
|
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
8
207
|
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
@@ -17,6 +216,10 @@ declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefin
|
|
|
17
216
|
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
18
217
|
declare function isBoolean(value: unknown): value is boolean;
|
|
19
218
|
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
219
|
+
declare function isTrue(value: unknown): value is true;
|
|
220
|
+
declare function isTrueOrUndefined(value: unknown): value is true;
|
|
221
|
+
declare function isFalse(value: unknown): value is false;
|
|
222
|
+
declare function isFalseOrUndefined(value: unknown): value is false;
|
|
20
223
|
declare function isFunction(value: unknown): value is Function;
|
|
21
224
|
declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
|
|
22
225
|
declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
|
|
@@ -26,57 +229,83 @@ declare function isNumberOrUndefined(value: unknown): value is number | undefine
|
|
|
26
229
|
declare function isFinite(value: unknown): value is number;
|
|
27
230
|
declare function isInteger(n: unknown): n is number;
|
|
28
231
|
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
29
|
-
declare function isIntegerEq(value: unknown, compareTo:
|
|
30
|
-
declare function isIntegerGt(value: unknown, compareTo:
|
|
31
|
-
declare function isIntegerGte(value: unknown, compareTo:
|
|
32
|
-
declare function isIntegerLt(value: unknown, compareTo:
|
|
33
|
-
declare function isIntegerLte(value: unknown, compareTo:
|
|
34
|
-
declare function isIntegerBetween(value: unknown, min:
|
|
232
|
+
declare function isIntegerEq(value: unknown, compareTo: unknown): value is number;
|
|
233
|
+
declare function isIntegerGt(value: unknown, compareTo: unknown): value is number;
|
|
234
|
+
declare function isIntegerGte(value: unknown, compareTo: unknown): value is number;
|
|
235
|
+
declare function isIntegerLt(value: unknown, compareTo: unknown): value is number;
|
|
236
|
+
declare function isIntegerLte(value: unknown, compareTo: unknown): value is number;
|
|
237
|
+
declare function isIntegerBetween(value: unknown, min: unknown, max: unknown): value is number;
|
|
238
|
+
declare function isIntegerBetweenExclusive(value: unknown, min: unknown, max: unknown): value is number;
|
|
239
|
+
declare function isNumberBetween(value: unknown, min: unknown, max: unknown): value is number;
|
|
240
|
+
declare function isNumberBetweenExclusive(value: unknown, min: unknown, max: unknown): value is number;
|
|
35
241
|
declare function isNaNValue(value: unknown): value is number;
|
|
36
242
|
declare function isInfinity(value: unknown): value is number;
|
|
37
243
|
declare function isPosInfinity(value: unknown): value is number;
|
|
38
244
|
declare function isNegInfinity(value: unknown): value is number;
|
|
245
|
+
declare function isOddNumber(value: unknown): value is number;
|
|
246
|
+
declare function isEvenNumber(value: unknown): value is number;
|
|
247
|
+
declare function isIncluded<T>(value: T, array: ReadonlyArray<T>): value is T;
|
|
248
|
+
declare function isArrayIndex<T>(index: unknown, array: ReadonlyArray<T>): index is number;
|
|
249
|
+
declare function isThrowing(throwTestFn: () => void): boolean;
|
|
250
|
+
declare function tryOr<TRY_RVAL, OR_RVAL>(tryFn: () => TRY_RVAL, orVal: OR_RVAL | (() => OR_RVAL)): TRY_RVAL | OR_RVAL;
|
|
39
251
|
|
|
40
|
-
|
|
41
|
-
declare const
|
|
42
|
-
declare const
|
|
43
|
-
declare const
|
|
44
|
-
declare const
|
|
45
|
-
declare const
|
|
46
|
-
declare const
|
|
47
|
-
declare const
|
|
48
|
-
declare const
|
|
49
|
-
declare const
|
|
50
|
-
declare const
|
|
51
|
-
declare const
|
|
52
|
-
declare const
|
|
53
|
-
declare const
|
|
54
|
-
declare const
|
|
55
|
-
declare const
|
|
56
|
-
declare const
|
|
57
|
-
declare const
|
|
58
|
-
declare const
|
|
59
|
-
declare const
|
|
60
|
-
declare const
|
|
61
|
-
declare const
|
|
62
|
-
declare const
|
|
63
|
-
declare const
|
|
64
|
-
declare const
|
|
65
|
-
declare const
|
|
66
|
-
declare const
|
|
67
|
-
declare const
|
|
68
|
-
declare const
|
|
69
|
-
declare const
|
|
70
|
-
declare const
|
|
71
|
-
declare const
|
|
72
|
-
declare const
|
|
73
|
-
declare const
|
|
74
|
-
declare const
|
|
75
|
-
declare const
|
|
76
|
-
declare const
|
|
77
|
-
declare const
|
|
78
|
-
declare
|
|
79
|
-
|
|
252
|
+
type Guard_HasProps<T extends object> = HasProps<T>;
|
|
253
|
+
declare const Guard_isArray: typeof isArray;
|
|
254
|
+
declare const Guard_isArrayIndex: typeof isArrayIndex;
|
|
255
|
+
declare const Guard_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
256
|
+
declare const Guard_isBoolean: typeof isBoolean;
|
|
257
|
+
declare const Guard_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
258
|
+
declare const Guard_isDeepEqual: typeof isDeepEqual;
|
|
259
|
+
declare const Guard_isEmptyArray: typeof isEmptyArray;
|
|
260
|
+
declare const Guard_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
261
|
+
declare const Guard_isEmptyString: typeof isEmptyString;
|
|
262
|
+
declare const Guard_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
263
|
+
declare const Guard_isEnumValue: typeof isEnumValue;
|
|
264
|
+
declare const Guard_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
265
|
+
declare const Guard_isEqual: typeof isEqual;
|
|
266
|
+
declare const Guard_isEvenNumber: typeof isEvenNumber;
|
|
267
|
+
declare const Guard_isFalse: typeof isFalse;
|
|
268
|
+
declare const Guard_isFalseOrUndefined: typeof isFalseOrUndefined;
|
|
269
|
+
declare const Guard_isFinite: typeof isFinite;
|
|
270
|
+
declare const Guard_isFunction: typeof isFunction;
|
|
271
|
+
declare const Guard_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
272
|
+
declare const Guard_isIncluded: typeof isIncluded;
|
|
273
|
+
declare const Guard_isInfinity: typeof isInfinity;
|
|
274
|
+
declare const Guard_isInteger: typeof isInteger;
|
|
275
|
+
declare const Guard_isIntegerBetween: typeof isIntegerBetween;
|
|
276
|
+
declare const Guard_isIntegerBetweenExclusive: typeof isIntegerBetweenExclusive;
|
|
277
|
+
declare const Guard_isIntegerEq: typeof isIntegerEq;
|
|
278
|
+
declare const Guard_isIntegerGt: typeof isIntegerGt;
|
|
279
|
+
declare const Guard_isIntegerGte: typeof isIntegerGte;
|
|
280
|
+
declare const Guard_isIntegerLt: typeof isIntegerLt;
|
|
281
|
+
declare const Guard_isIntegerLte: typeof isIntegerLte;
|
|
282
|
+
declare const Guard_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
283
|
+
declare const Guard_isNaNValue: typeof isNaNValue;
|
|
284
|
+
declare const Guard_isNegInfinity: typeof isNegInfinity;
|
|
285
|
+
declare const Guard_isNonEmptyArray: typeof isNonEmptyArray;
|
|
286
|
+
declare const Guard_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
287
|
+
declare const Guard_isNonEmptyString: typeof isNonEmptyString;
|
|
288
|
+
declare const Guard_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
289
|
+
declare const Guard_isNull: typeof isNull;
|
|
290
|
+
declare const Guard_isNullish: typeof isNullish;
|
|
291
|
+
declare const Guard_isNumber: typeof isNumber;
|
|
292
|
+
declare const Guard_isNumberBetween: typeof isNumberBetween;
|
|
293
|
+
declare const Guard_isNumberBetweenExclusive: typeof isNumberBetweenExclusive;
|
|
294
|
+
declare const Guard_isNumberOrUndefined: typeof isNumberOrUndefined;
|
|
295
|
+
declare const Guard_isObject: typeof isObject;
|
|
296
|
+
declare const Guard_isObjectOrUndefined: typeof isObjectOrUndefined;
|
|
297
|
+
declare const Guard_isOddNumber: typeof isOddNumber;
|
|
298
|
+
declare const Guard_isPosInfinity: typeof isPosInfinity;
|
|
299
|
+
declare const Guard_isString: typeof isString;
|
|
300
|
+
declare const Guard_isStringOrUndefined: typeof isStringOrUndefined;
|
|
301
|
+
declare const Guard_isThrowing: typeof isThrowing;
|
|
302
|
+
declare const Guard_isTrue: typeof isTrue;
|
|
303
|
+
declare const Guard_isTrueOrUndefined: typeof isTrueOrUndefined;
|
|
304
|
+
declare const Guard_isTypedObject: typeof isTypedObject;
|
|
305
|
+
declare const Guard_isUndefined: typeof isUndefined;
|
|
306
|
+
declare const Guard_tryOr: typeof tryOr;
|
|
307
|
+
declare namespace Guard {
|
|
308
|
+
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 };
|
|
80
309
|
}
|
|
81
310
|
|
|
82
311
|
declare function toArray<T>(a: T | T[]): Array<T>;
|
|
@@ -91,20 +320,20 @@ declare function getRangeArray(start: number, end: number): number[];
|
|
|
91
320
|
declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
|
|
92
321
|
declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
|
|
93
322
|
|
|
94
|
-
declare const index$
|
|
95
|
-
declare const index$
|
|
96
|
-
declare const index$
|
|
97
|
-
declare const index$
|
|
98
|
-
declare const index$
|
|
99
|
-
declare const index$
|
|
100
|
-
declare const index$
|
|
101
|
-
declare const index$
|
|
102
|
-
declare const index$
|
|
103
|
-
declare const index$
|
|
104
|
-
declare const index$
|
|
105
|
-
declare const index$
|
|
106
|
-
declare namespace index$
|
|
107
|
-
export { index$
|
|
323
|
+
declare const index$6_arrayContains: typeof arrayContains;
|
|
324
|
+
declare const index$6_chunckArray: typeof chunckArray;
|
|
325
|
+
declare const index$6_duplicate: typeof duplicate;
|
|
326
|
+
declare const index$6_fillArray: typeof fillArray;
|
|
327
|
+
declare const index$6_getRangeArray: typeof getRangeArray;
|
|
328
|
+
declare const index$6_getSequenceArray: typeof getSequenceArray;
|
|
329
|
+
declare const index$6_isArray: typeof isArray;
|
|
330
|
+
declare const index$6_mapRangeArray: typeof mapRangeArray;
|
|
331
|
+
declare const index$6_mapSequenceArray: typeof mapSequenceArray;
|
|
332
|
+
declare const index$6_removeDuplicates: typeof removeDuplicates;
|
|
333
|
+
declare const index$6_removeDuplicatesCmp: typeof removeDuplicatesCmp;
|
|
334
|
+
declare const index$6_toArray: typeof toArray;
|
|
335
|
+
declare namespace index$6 {
|
|
336
|
+
export { index$6_arrayContains as arrayContains, index$6_chunckArray as chunckArray, index$6_duplicate as duplicate, index$6_fillArray as fillArray, index$6_getRangeArray as getRangeArray, index$6_getSequenceArray as getSequenceArray, index$6_isArray as isArray, index$6_mapRangeArray as mapRangeArray, index$6_mapSequenceArray as mapSequenceArray, index$6_removeDuplicates as removeDuplicates, index$6_removeDuplicatesCmp as removeDuplicatesCmp, index$6_toArray as toArray };
|
|
108
337
|
}
|
|
109
338
|
|
|
110
339
|
interface CSSProperties {
|
|
@@ -153,43 +382,28 @@ declare function getDimension(style?: CSSProperties): {
|
|
|
153
382
|
declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
|
|
154
383
|
declare function getCanvasTextWidth(text: string, font: string): number;
|
|
155
384
|
|
|
156
|
-
type index$
|
|
157
|
-
declare const index$
|
|
158
|
-
declare const index$
|
|
159
|
-
declare const index$
|
|
160
|
-
declare const index$
|
|
161
|
-
declare const index$
|
|
162
|
-
declare const index$
|
|
163
|
-
declare const index$
|
|
164
|
-
declare const index$
|
|
165
|
-
declare const index$
|
|
166
|
-
declare const index$
|
|
167
|
-
declare const index$
|
|
168
|
-
declare const index$
|
|
169
|
-
declare const index$
|
|
170
|
-
declare const index$
|
|
171
|
-
declare const index$
|
|
172
|
-
declare const index$
|
|
173
|
-
declare const index$
|
|
174
|
-
declare const index$
|
|
175
|
-
declare const index$
|
|
176
|
-
declare namespace index$6 {
|
|
177
|
-
export { type index$6_CSSProperties as CSSProperties, index$6_addClass as addClass, index$6_appendTo as appendTo, index$6_getButton as getButton, index$6_getCanvas as getCanvas, index$6_getCanvasTextWidth as getCanvasTextWidth, index$6_getDimension as getDimension, index$6_getHeight as getHeight, index$6_getOffset as getOffset, index$6_getPadding as getPadding, index$6_getWidth as getWidth, index$6_hasClass as hasClass, index$6_removeClass as removeClass, index$6_removeFromParent as removeFromParent, index$6_setHeight as setHeight, index$6_setOffset as setOffset, index$6_setRect as setRect, index$6_setVisibility as setVisibility, index$6_setWidth as setWidth, index$6_styleLayoutChanged as styleLayoutChanged };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
type EnumObject = {
|
|
181
|
-
[key: string]: string | number;
|
|
182
|
-
};
|
|
183
|
-
type EnumValue<E extends EnumObject> = E extends {
|
|
184
|
-
[key: string]: string | infer V;
|
|
185
|
-
} ? V : never;
|
|
186
|
-
declare function getEnumValues<E extends EnumObject>(e: E): Array<EnumValue<E>>;
|
|
187
|
-
|
|
188
|
-
type index$5_EnumObject = EnumObject;
|
|
189
|
-
type index$5_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
190
|
-
declare const index$5_getEnumValues: typeof getEnumValues;
|
|
385
|
+
type index$5_CSSProperties = CSSProperties;
|
|
386
|
+
declare const index$5_addClass: typeof addClass;
|
|
387
|
+
declare const index$5_appendTo: typeof appendTo;
|
|
388
|
+
declare const index$5_getButton: typeof getButton;
|
|
389
|
+
declare const index$5_getCanvas: typeof getCanvas;
|
|
390
|
+
declare const index$5_getCanvasTextWidth: typeof getCanvasTextWidth;
|
|
391
|
+
declare const index$5_getDimension: typeof getDimension;
|
|
392
|
+
declare const index$5_getHeight: typeof getHeight;
|
|
393
|
+
declare const index$5_getOffset: typeof getOffset;
|
|
394
|
+
declare const index$5_getPadding: typeof getPadding;
|
|
395
|
+
declare const index$5_getWidth: typeof getWidth;
|
|
396
|
+
declare const index$5_hasClass: typeof hasClass;
|
|
397
|
+
declare const index$5_removeClass: typeof removeClass;
|
|
398
|
+
declare const index$5_removeFromParent: typeof removeFromParent;
|
|
399
|
+
declare const index$5_setHeight: typeof setHeight;
|
|
400
|
+
declare const index$5_setOffset: typeof setOffset;
|
|
401
|
+
declare const index$5_setRect: typeof setRect;
|
|
402
|
+
declare const index$5_setVisibility: typeof setVisibility;
|
|
403
|
+
declare const index$5_setWidth: typeof setWidth;
|
|
404
|
+
declare const index$5_styleLayoutChanged: typeof styleLayoutChanged;
|
|
191
405
|
declare namespace index$5 {
|
|
192
|
-
export { type index$
|
|
406
|
+
export { type index$5_CSSProperties as CSSProperties, index$5_addClass as addClass, index$5_appendTo as appendTo, index$5_getButton as getButton, index$5_getCanvas as getCanvas, index$5_getCanvasTextWidth as getCanvasTextWidth, index$5_getDimension as getDimension, index$5_getHeight as getHeight, index$5_getOffset as getOffset, index$5_getPadding as getPadding, index$5_getWidth as getWidth, index$5_hasClass as hasClass, index$5_removeClass as removeClass, index$5_removeFromParent as removeFromParent, index$5_setHeight as setHeight, index$5_setOffset as setOffset, index$5_setRect as setRect, index$5_setVisibility as setVisibility, index$5_setWidth as setWidth, index$5_styleLayoutChanged as styleLayoutChanged };
|
|
193
407
|
}
|
|
194
408
|
|
|
195
409
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
@@ -321,57 +535,14 @@ declare namespace index$1 {
|
|
|
321
535
|
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 };
|
|
322
536
|
}
|
|
323
537
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
declare namespace Assert {
|
|
329
|
-
type ErrorConstructor = new (msg: string) => Error;
|
|
330
|
-
function setErrorClass(ec?: ErrorConstructor): void;
|
|
331
|
-
function assert<T>(a: T, userMsg?: string): void;
|
|
332
|
-
function assertEnum<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): asserts value is E[keyof E];
|
|
333
|
-
function interrupt(userMsg?: string): never;
|
|
334
|
-
function int(a: unknown, userMsg?: string): number;
|
|
335
|
-
function eq<T>(a: T, b: T, userMsg?: string): T;
|
|
336
|
-
function int_eq(a: unknown, b: unknown, userMsg?: string): number;
|
|
337
|
-
function int_lt(a: unknown, b: unknown, userMsg?: string): number;
|
|
338
|
-
function int_lte(a: unknown, b: unknown, userMsg?: string): number;
|
|
339
|
-
function int_gt(a: unknown, b: unknown, userMsg?: string): number;
|
|
340
|
-
function int_gte(a: unknown, b: unknown, userMsg?: string): number;
|
|
341
|
-
function int_between(a: unknown, min: unknown, max: unknown, userMsg?: string): number;
|
|
342
|
-
function odd(a: unknown, userMsg?: string): number;
|
|
343
|
-
function even(a: unknown, userMsg?: string): number;
|
|
344
|
-
function in_group<T>(a: T, group: ReadonlyArray<T>, userMsg?: string): T;
|
|
345
|
-
function finite(a: unknown, userMsg?: string): number;
|
|
346
|
-
function array_id<T>(arr: Readonly<T[]>, id: unknown, userMsg?: string): number;
|
|
347
|
-
function array_elem<T>(arr: Readonly<T[]>, id: number, userMsg?: string): T;
|
|
348
|
-
function require<T>(arg: T, userMsg?: string): NonNullable<T>;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
declare namespace Cookies {
|
|
352
|
-
function setExpireDays(days: number): void;
|
|
353
|
-
function isConsentPending(): boolean;
|
|
354
|
-
function accept(): void;
|
|
355
|
-
function decline(): void;
|
|
356
|
-
function save<T extends string | number | boolean>(name: string, value: T): T;
|
|
357
|
-
function read(name: string, defaultValue: string): string;
|
|
358
|
-
function readInt(name: string, defaultValue: number): number;
|
|
359
|
-
function readBool(name: string, defaultValue: boolean): boolean;
|
|
360
|
-
function erase(name: string): void;
|
|
361
|
-
function eraseAll(): void;
|
|
362
|
-
}
|
|
538
|
+
/**
|
|
539
|
+
* @deprecated Use {@link Guard} instead.
|
|
540
|
+
*/
|
|
541
|
+
declare const Is: typeof Guard;
|
|
363
542
|
|
|
364
|
-
declare
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const ScrollbarWidth: number;
|
|
368
|
-
const FontSize: number;
|
|
369
|
-
const IsTouchDevice: boolean;
|
|
370
|
-
const IsMobileDevice: boolean;
|
|
371
|
-
const HostAddress: string;
|
|
372
|
-
function pxToMm(px: number): number;
|
|
373
|
-
function mmToPx(mm: number): number;
|
|
374
|
-
function toPx(input: string | number): number;
|
|
543
|
+
declare const index_Is: typeof Is;
|
|
544
|
+
declare namespace index {
|
|
545
|
+
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 };
|
|
375
546
|
}
|
|
376
547
|
|
|
377
548
|
declare class Stack<T> {
|
|
@@ -384,21 +555,282 @@ declare class Stack<T> {
|
|
|
384
555
|
clear(): void;
|
|
385
556
|
}
|
|
386
557
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
558
|
+
/**
|
|
559
|
+
* Vector class.
|
|
560
|
+
*
|
|
561
|
+
* ```ts
|
|
562
|
+
* // Example usage:
|
|
563
|
+
* const a = new Vec(1, 2);
|
|
564
|
+
* const b = new Vec(3, 4);
|
|
565
|
+
*
|
|
566
|
+
* console.log(a.add(b).toString()); // Vec(4, 6)
|
|
567
|
+
* console.log(a.add(3, 3).toString()); // Vec(4, 5)
|
|
568
|
+
* console.log(a.mul(2).toString()); // Vec(2, 4)
|
|
569
|
+
* console.log(a.equals(b)); // false
|
|
570
|
+
* console.log(a.clone().equals(a)); // true
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
declare class Vec {
|
|
574
|
+
readonly coords: number[];
|
|
575
|
+
constructor(...coords: number[]);
|
|
576
|
+
static vec2(x: number, y: number): Vec;
|
|
577
|
+
static vec3(x: number, y: number, z: number): Vec;
|
|
578
|
+
static zero(dim: number): Vec;
|
|
579
|
+
get dim(): number;
|
|
580
|
+
get length(): number;
|
|
581
|
+
magnitude(): number;
|
|
582
|
+
get x(): number;
|
|
583
|
+
get y(): number;
|
|
584
|
+
get z(): number;
|
|
585
|
+
add(other: Vec): Vec;
|
|
586
|
+
add(...coords: number[]): Vec;
|
|
587
|
+
sub(other: Vec): Vec;
|
|
588
|
+
sub(...coords: number[]): Vec;
|
|
589
|
+
mul(scalar: number): Vec;
|
|
590
|
+
div(scalar: number): Vec;
|
|
591
|
+
dot(other: Vec): number;
|
|
592
|
+
distance(other: Vec): number;
|
|
593
|
+
normalize(): Vec;
|
|
594
|
+
static lerp(a: Vec, b: Vec, t: number): Vec;
|
|
595
|
+
toLength(len: number): Vec;
|
|
596
|
+
clamp(minLength?: number, maxLength?: number, defaultDir?: Vec): Vec;
|
|
597
|
+
equals(other: Vec): boolean;
|
|
598
|
+
clone(): Vec;
|
|
599
|
+
toObject(): {
|
|
600
|
+
x: number;
|
|
601
|
+
y: number;
|
|
602
|
+
z: number;
|
|
603
|
+
};
|
|
604
|
+
[Symbol.iterator](): ArrayIterator<number>;
|
|
605
|
+
toString(): string;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* DivRect class, left, top, right, bottom rectangle divided into four sections by anchorX, anchorY.
|
|
610
|
+
*/
|
|
611
|
+
declare class DivRect {
|
|
612
|
+
left: number;
|
|
613
|
+
anchorX: number;
|
|
614
|
+
right: number;
|
|
615
|
+
top: number;
|
|
616
|
+
anchorY: number;
|
|
617
|
+
bottom: number;
|
|
618
|
+
/**
|
|
619
|
+
* Create rectangle with all zero values.
|
|
620
|
+
*/
|
|
621
|
+
constructor();
|
|
622
|
+
/**
|
|
623
|
+
* Create rectangle with left, right, top, bottom.
|
|
624
|
+
* Properties anchorX and anchorY will be centered in the middle.
|
|
625
|
+
*
|
|
626
|
+
* @param left - Left coordinate.
|
|
627
|
+
* @param right - Right coordinate.
|
|
628
|
+
* @param top - Top coordinate.
|
|
629
|
+
* @param bottom - Bottom coordinate.
|
|
630
|
+
*/
|
|
631
|
+
constructor(left: number, right: number, top: number, bottom: number);
|
|
632
|
+
/**
|
|
633
|
+
* Create rectangle with full arguments.
|
|
634
|
+
*
|
|
635
|
+
* @param left - Left coordinate.
|
|
636
|
+
* @param anchorX - Center x-coordinate.
|
|
637
|
+
* @param right - Right coordinate.
|
|
638
|
+
* @param top - Top coordinate.
|
|
639
|
+
* @param anchorY - Center y-coordinate.
|
|
640
|
+
* @param bottom - Bottom coordinate.
|
|
641
|
+
*/
|
|
642
|
+
constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
|
|
643
|
+
/**
|
|
644
|
+
* Create rect from basic left, top, width and height arguments.
|
|
645
|
+
*
|
|
646
|
+
* @param left - Left coordinate.
|
|
647
|
+
* @param top - Top coordinate.
|
|
648
|
+
* @param width - Width.
|
|
649
|
+
* @param height - Height.
|
|
650
|
+
* @returns - DivRect.
|
|
651
|
+
*/
|
|
652
|
+
static create(left: number, top: number, width: number, height: number): DivRect;
|
|
653
|
+
/**
|
|
654
|
+
* Create rect from anchorX, anchorY, width, height arguments.
|
|
655
|
+
*
|
|
656
|
+
* @param centerX - Center x-coordinate.
|
|
657
|
+
* @param centerY - Center y-coordinate.
|
|
658
|
+
* @param width - Width.
|
|
659
|
+
* @param height - Height.
|
|
660
|
+
* @returns - DivRect.
|
|
661
|
+
*/
|
|
662
|
+
static createCentered(centerX: number, centerY: number, width: number, height: number): DivRect;
|
|
663
|
+
/**
|
|
664
|
+
* Create rect from sections.
|
|
665
|
+
*
|
|
666
|
+
* @param leftw - Left section width.
|
|
667
|
+
* @param rightw - Right section width.
|
|
668
|
+
* @param toph - Top section height.
|
|
669
|
+
* @param bottomh - Bottomsection height.
|
|
670
|
+
* @returns - DivRect.
|
|
671
|
+
*/
|
|
672
|
+
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
673
|
+
/** @deprecated - Renamed to anchorX. */
|
|
674
|
+
get centerX(): number;
|
|
675
|
+
/** @deprecated - Renamed to anchorX. */
|
|
676
|
+
set centerX(x: number);
|
|
677
|
+
/** @deprecated - Renamed to anchorY. */
|
|
678
|
+
get centerY(): number;
|
|
679
|
+
/** @deprecated - Renamed to anchorY. */
|
|
680
|
+
set centerY(y: number);
|
|
681
|
+
/**
|
|
682
|
+
* Width getter.
|
|
683
|
+
*/
|
|
684
|
+
get width(): number;
|
|
685
|
+
/**
|
|
686
|
+
* Height getter.
|
|
687
|
+
*/
|
|
688
|
+
get height(): number;
|
|
689
|
+
/**
|
|
690
|
+
* Left section width getter.
|
|
691
|
+
*/
|
|
692
|
+
get leftw(): number;
|
|
693
|
+
/**
|
|
694
|
+
* Right section width getter.
|
|
695
|
+
*/
|
|
696
|
+
get rightw(): number;
|
|
697
|
+
/**
|
|
698
|
+
* Top section height getter.
|
|
699
|
+
*/
|
|
700
|
+
get toph(): number;
|
|
701
|
+
/**
|
|
702
|
+
* Bottom section height getter.
|
|
703
|
+
*/
|
|
704
|
+
get bottomh(): number;
|
|
705
|
+
/**
|
|
706
|
+
* Does this Rect contain given (x, y)-point?
|
|
707
|
+
*
|
|
708
|
+
* @param x - X-coordinate.
|
|
709
|
+
* @param y - Y-coordinate.
|
|
710
|
+
* @returns - True/false.
|
|
711
|
+
*/
|
|
712
|
+
contains(x: number, y: number): boolean;
|
|
713
|
+
/**
|
|
714
|
+
* Do a and b rects overlap?
|
|
715
|
+
*
|
|
716
|
+
* @param a - DivRect a.
|
|
717
|
+
* @param b - DivRect b.
|
|
718
|
+
* @returns - True/false.
|
|
719
|
+
*/
|
|
720
|
+
static overlap(a: DivRect, b: DivRect): boolean;
|
|
721
|
+
/**
|
|
722
|
+
* Do horizontal measures of a and b rects overlap?
|
|
723
|
+
*
|
|
724
|
+
* @param a - DivRect a.
|
|
725
|
+
* @param b - DivRect b.
|
|
726
|
+
* @returns - True/false.
|
|
727
|
+
*/
|
|
728
|
+
static overlapX(a: DivRect, b: DivRect): boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Check if given rects are equal.
|
|
731
|
+
* @param a - DivRect a.
|
|
732
|
+
* @param b - DivRect b.
|
|
733
|
+
* @returns - True/false.
|
|
734
|
+
*/
|
|
735
|
+
static equals(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
736
|
+
/**
|
|
737
|
+
* Check if this rect equals with another rect.
|
|
738
|
+
* @param other - The other rect.
|
|
739
|
+
* @returns - True/false.
|
|
740
|
+
*/
|
|
741
|
+
equals(other: DivRect): boolean;
|
|
742
|
+
/**
|
|
743
|
+
* Check if edges of given rects are equal, ignoring anchorX and anchorY.
|
|
744
|
+
*
|
|
745
|
+
* @param a - DivRect a.
|
|
746
|
+
* @param b - DivRect b.
|
|
747
|
+
* @returns - True/false.
|
|
748
|
+
*/
|
|
749
|
+
static equalsEdges(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
|
|
752
|
+
*
|
|
753
|
+
* @param other - The other DivRect.
|
|
754
|
+
* @returns - True/false.
|
|
755
|
+
*/
|
|
756
|
+
equalsEdges(other: DivRect): boolean;
|
|
757
|
+
/** @deprecated - Use `DivRect.equalsEdges()` instead. */
|
|
758
|
+
static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
759
|
+
/**
|
|
760
|
+
* Created duplicate of this Rect.
|
|
761
|
+
*
|
|
762
|
+
* @returns - Duplicate.
|
|
763
|
+
*/
|
|
764
|
+
copy(): DivRect;
|
|
765
|
+
/**
|
|
766
|
+
* Move this rect by (dx, dy). Modifies this Rect.
|
|
767
|
+
*
|
|
768
|
+
* @param dx - Offset amount in x-direction.
|
|
769
|
+
* @param dy - Offset amount in y-direction.
|
|
770
|
+
* @returns - This DivRect instance.
|
|
771
|
+
*/
|
|
772
|
+
offsetInPlace(dx: number, dy: number): DivRect;
|
|
773
|
+
/**
|
|
774
|
+
* Move this rect by (dx, dy). Immutable, returns modified copy.
|
|
775
|
+
*
|
|
776
|
+
* @param dx - Offset amount in x-direction.
|
|
777
|
+
* @param dy - Offset amount in y-direction.
|
|
778
|
+
* @returns - DivRect copy with applied offset.
|
|
779
|
+
*/
|
|
780
|
+
offsetCopy(dx: number, dy: number): DivRect;
|
|
781
|
+
/**
|
|
782
|
+
* Expand this Rect by given Rect. Modifies this Rect.
|
|
783
|
+
*
|
|
784
|
+
* @param rect - DivRect to expand this instance with.
|
|
785
|
+
* @returns - This DivRect instance.
|
|
786
|
+
*/
|
|
787
|
+
expandInPlace(rect: DivRect): DivRect;
|
|
788
|
+
/**
|
|
789
|
+
* Expand this Rect by given Rect. Immutable, returns modified copy.
|
|
790
|
+
*
|
|
791
|
+
* @param rect - DivRect to expand this instance with.
|
|
792
|
+
* @returns - Expanded copy of this DivRect.
|
|
793
|
+
*/
|
|
794
|
+
expandCopy(rect: DivRect): DivRect;
|
|
795
|
+
/**
|
|
796
|
+
* Clip this Rect by given Rect. Mmodifies this Rect.
|
|
797
|
+
*
|
|
798
|
+
* @param clipRect - DivRect to clip this instance with.
|
|
799
|
+
* @returns - This DivRect instance.
|
|
800
|
+
*/
|
|
801
|
+
clipInPlace(clipRect: DivRect): DivRect;
|
|
802
|
+
/**
|
|
803
|
+
* Clip this Rect by given Rect. Immutable, return modified copy.
|
|
804
|
+
*
|
|
805
|
+
* @param clipRect - DivRecto to clip this instance with.
|
|
806
|
+
* @returns - Clipped DivRect copy.
|
|
807
|
+
*/
|
|
808
|
+
clipCopy(clipRect: DivRect): DivRect;
|
|
809
|
+
/**
|
|
810
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
|
|
811
|
+
*
|
|
812
|
+
* @param scaleX - Scale x-amount.
|
|
813
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
814
|
+
* @returns This DivRect instance.
|
|
815
|
+
*/
|
|
816
|
+
scaleInPlace(scaleX: number, scaleY?: number): DivRect;
|
|
817
|
+
/**
|
|
818
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
|
|
819
|
+
*
|
|
820
|
+
* @param scaleX - Scale x-amount.
|
|
821
|
+
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
822
|
+
* @returns Scaled copy of this DivRect.
|
|
823
|
+
*/
|
|
824
|
+
scaleCopy(scaleX: number, scaleY?: number): DivRect;
|
|
825
|
+
/**
|
|
826
|
+
* Get this DivRect instance.
|
|
827
|
+
* @returns - This DivRect instance.
|
|
828
|
+
*/
|
|
829
|
+
getRect(): DivRect;
|
|
396
830
|
}
|
|
397
831
|
|
|
398
832
|
/**
|
|
399
833
|
* LRUCache class: Least Recently Used cache with a fixed capacity
|
|
400
|
-
*
|
|
401
|
-
* Provided by ChatGPT.
|
|
402
834
|
*/
|
|
403
835
|
declare class LRUCache<K extends string, V> {
|
|
404
836
|
private cache;
|
|
@@ -418,150 +850,119 @@ declare class LRUCache<K extends string, V> {
|
|
|
418
850
|
private addToTail;
|
|
419
851
|
}
|
|
420
852
|
|
|
421
|
-
|
|
422
|
-
* A cache-like structure optimized for small-range integer keys, including negatives.
|
|
423
|
-
*
|
|
424
|
-
* Internally implemented using two sparse arrays: one for non-negative keys,
|
|
425
|
-
* and one for negative keys (stored by index `-key - 1`).
|
|
426
|
-
*
|
|
427
|
-
* @remarks
|
|
428
|
-
* - Fast access for small integer keys.
|
|
429
|
-
* - Not suitable for large or sparse key ranges — memory usage may grow significantly.
|
|
430
|
-
* - Supports `get`, `set`, `delete`, `has` and `clear`
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* ```ts
|
|
434
|
-
* const cache = new SmallIntCache<string>();
|
|
435
|
-
* cache.set(-2, 'A');
|
|
436
|
-
* cache.set(3, 'B');
|
|
437
|
-
* console.log(cache.get(-2)); // 'A'
|
|
438
|
-
* ```
|
|
439
|
-
*
|
|
440
|
-
* @deprecated - Same functionality an more is available now in SignedIndexArray<EL> and IndexArray<EL> containers.
|
|
441
|
-
*/
|
|
442
|
-
declare class SmallIntCache<V> {
|
|
443
|
-
private pos;
|
|
444
|
-
private neg;
|
|
445
|
-
constructor();
|
|
446
|
-
set(key: number, value: V): void;
|
|
447
|
-
get(key: number): V | undefined;
|
|
448
|
-
has(key: number): boolean;
|
|
449
|
-
delete(key: number): void;
|
|
450
|
-
clear(): void;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
interface KVComponent<K extends any[], EL> {
|
|
853
|
+
interface KVComponent<K extends any[], VALUE> {
|
|
454
854
|
get size(): number;
|
|
455
855
|
isEmpty(): boolean;
|
|
456
856
|
has(...keys: K): boolean;
|
|
457
|
-
get(...keys: K):
|
|
458
|
-
getOrDefault(...keysAndDefault: [...K,
|
|
459
|
-
getOrCreate(...keysAndCreator: [...K,
|
|
460
|
-
set(...keysAndValue: [...K,
|
|
857
|
+
get(...keys: K): VALUE | undefined;
|
|
858
|
+
getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
|
|
859
|
+
getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
|
|
860
|
+
set(...keysAndValue: [...K, VALUE]): void;
|
|
461
861
|
delete(...keys: K): boolean;
|
|
462
862
|
clear?(): void;
|
|
463
863
|
toString(): string;
|
|
464
|
-
kvValues(): IterableIterator<
|
|
864
|
+
kvValues(): IterableIterator<VALUE>;
|
|
465
865
|
kvKeys(): IterableIterator<K>;
|
|
466
|
-
kvEntries(): IterableIterator<[K,
|
|
866
|
+
kvEntries(): IterableIterator<[K, VALUE]>;
|
|
467
867
|
}
|
|
468
868
|
|
|
469
869
|
/**
|
|
470
870
|
* An array-like structure for non-negative indexes.
|
|
471
871
|
*/
|
|
472
|
-
declare class IndexArray<
|
|
473
|
-
private static toNegIndex;
|
|
872
|
+
declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
474
873
|
private static validateIndex;
|
|
475
|
-
private
|
|
874
|
+
private posVal;
|
|
476
875
|
private hasPos;
|
|
477
|
-
private
|
|
876
|
+
private valCount;
|
|
478
877
|
constructor();
|
|
479
|
-
constructor(arr: IndexArray<
|
|
480
|
-
constructor(entries: Iterable<[number,
|
|
878
|
+
constructor(arr: IndexArray<VALUE>);
|
|
879
|
+
constructor(entries: Iterable<[number, VALUE]>);
|
|
481
880
|
private get posLen();
|
|
482
881
|
get size(): number;
|
|
483
882
|
isEmpty(): boolean;
|
|
484
883
|
has(id: number): boolean;
|
|
485
|
-
set(id: number,
|
|
486
|
-
get(id: number):
|
|
487
|
-
getOrDefault(id: number, defaultValue:
|
|
488
|
-
getOrCreate(id: number, value:
|
|
489
|
-
getOrCreate(id: number, creator: () =>
|
|
884
|
+
set(id: number, value: VALUE): void;
|
|
885
|
+
get(id: number): VALUE | undefined;
|
|
886
|
+
getOrDefault(id: number, defaultValue: VALUE): VALUE;
|
|
887
|
+
getOrCreate(id: number, value: VALUE): VALUE;
|
|
888
|
+
getOrCreate(id: number, creator: () => VALUE): VALUE;
|
|
490
889
|
delete(id: number): boolean;
|
|
491
890
|
clear(): void;
|
|
492
|
-
forEach(callbackfn: (
|
|
891
|
+
forEach(callbackfn: (value: VALUE, id: number, arr: IndexArray<VALUE>) => void, thisArg?: any): void;
|
|
493
892
|
indices(): IterableIterator<number>;
|
|
494
|
-
values(): IterableIterator<
|
|
495
|
-
entries(): IterableIterator<[number,
|
|
893
|
+
values(): IterableIterator<VALUE>;
|
|
894
|
+
entries(): IterableIterator<[number, VALUE]>;
|
|
496
895
|
indicesArray(): number[];
|
|
497
|
-
valuesArray():
|
|
498
|
-
entriesArray(): [number,
|
|
896
|
+
valuesArray(): VALUE[];
|
|
897
|
+
entriesArray(): [number, VALUE][];
|
|
499
898
|
kvKeys(): IterableIterator<[number]>;
|
|
500
|
-
kvValues(): IterableIterator<
|
|
501
|
-
kvEntries(): IterableIterator<[[number],
|
|
502
|
-
[Symbol.iterator](): Generator<[number,
|
|
503
|
-
clone(): IndexArray<
|
|
504
|
-
merge(other: IndexArray<
|
|
505
|
-
some(fn: (
|
|
506
|
-
every(fn: (value:
|
|
507
|
-
filter(
|
|
508
|
-
|
|
509
|
-
reduce
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
equals(other: IndexArray<
|
|
899
|
+
kvValues(): IterableIterator<VALUE>;
|
|
900
|
+
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
901
|
+
[Symbol.iterator](): Generator<[number, VALUE], void, any>;
|
|
902
|
+
clone(): IndexArray<VALUE>;
|
|
903
|
+
merge(other: IndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
904
|
+
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
905
|
+
every(fn: (value: VALUE, key1: number) => boolean): boolean;
|
|
906
|
+
filter<S extends VALUE>(predicate: (value: VALUE, index: number, array: IndexArray<VALUE>) => value is S): IndexArray<S>;
|
|
907
|
+
filter(predicate: (value: VALUE, index: number, array: IndexArray<VALUE>) => unknown): IndexArray<VALUE>;
|
|
908
|
+
reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
|
|
909
|
+
reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
|
|
910
|
+
mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
|
|
911
|
+
map<R = VALUE>(fn: (value: VALUE, key1: number) => R): IndexArray<R>;
|
|
912
|
+
equals(other: IndexArray<VALUE>): boolean;
|
|
913
|
+
equals(other: IndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
|
|
514
914
|
toString(): string;
|
|
515
915
|
}
|
|
516
916
|
|
|
517
917
|
/**
|
|
518
918
|
* An array-like structure for signed indexes, including negatives.
|
|
519
919
|
*/
|
|
520
|
-
declare class SignedIndexArray<
|
|
920
|
+
declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
521
921
|
private static toNegIndex;
|
|
522
922
|
private static validateIndex;
|
|
523
|
-
private
|
|
923
|
+
private posVal;
|
|
524
924
|
private hasPos;
|
|
525
|
-
private
|
|
925
|
+
private negVal;
|
|
526
926
|
private hasNeg;
|
|
527
|
-
private
|
|
927
|
+
private valCount;
|
|
528
928
|
constructor();
|
|
529
|
-
constructor(arr: SignedIndexArray<
|
|
530
|
-
constructor(entries: Iterable<[number,
|
|
929
|
+
constructor(arr: SignedIndexArray<VALUE>);
|
|
930
|
+
constructor(entries: Iterable<[number, VALUE]>);
|
|
531
931
|
get size(): number;
|
|
532
932
|
isEmpty(): boolean;
|
|
533
933
|
private get posLen();
|
|
534
934
|
private get negLen();
|
|
535
935
|
has(id: number): boolean;
|
|
536
|
-
set(id: number,
|
|
537
|
-
get(id: number):
|
|
538
|
-
getOrDefault(id: number, defaultValue:
|
|
539
|
-
getOrCreate(id: number, value:
|
|
540
|
-
getOrCreate(id: number, creator: () =>
|
|
936
|
+
set(id: number, value: VALUE): void;
|
|
937
|
+
get(id: number): VALUE | undefined;
|
|
938
|
+
getOrDefault(id: number, defaultValue: VALUE): VALUE;
|
|
939
|
+
getOrCreate(id: number, value: VALUE): VALUE;
|
|
940
|
+
getOrCreate(id: number, creator: () => VALUE): VALUE;
|
|
541
941
|
delete(id: number): boolean;
|
|
542
942
|
clear(): void;
|
|
543
|
-
forEach(callbackfn: (
|
|
943
|
+
forEach(callbackfn: (value: VALUE, id: number, arr: SignedIndexArray<VALUE>) => void, thisArg?: any): void;
|
|
544
944
|
indices(): IterableIterator<number>;
|
|
545
|
-
values(): IterableIterator<
|
|
546
|
-
entries(): IterableIterator<[number,
|
|
945
|
+
values(): IterableIterator<VALUE>;
|
|
946
|
+
entries(): IterableIterator<[number, VALUE]>;
|
|
547
947
|
indicesArray(): number[];
|
|
548
|
-
valuesArray():
|
|
549
|
-
entriesArray(): [number,
|
|
948
|
+
valuesArray(): VALUE[];
|
|
949
|
+
entriesArray(): [number, VALUE][];
|
|
550
950
|
kvKeys(): IterableIterator<[number]>;
|
|
551
|
-
kvValues(): IterableIterator<
|
|
552
|
-
kvEntries(): IterableIterator<[[number],
|
|
553
|
-
[Symbol.iterator](): Generator<[number,
|
|
554
|
-
clone(): SignedIndexArray<
|
|
555
|
-
merge(other: SignedIndexArray<
|
|
556
|
-
some(fn: (
|
|
557
|
-
every(fn: (value:
|
|
558
|
-
filter(
|
|
559
|
-
|
|
560
|
-
reduce
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
equals(other: SignedIndexArray<
|
|
951
|
+
kvValues(): IterableIterator<VALUE>;
|
|
952
|
+
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
953
|
+
[Symbol.iterator](): Generator<[number, VALUE], void, any>;
|
|
954
|
+
clone(): SignedIndexArray<VALUE>;
|
|
955
|
+
merge(other: SignedIndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
956
|
+
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
957
|
+
every(fn: (value: VALUE, key1: number) => boolean): boolean;
|
|
958
|
+
filter<S extends VALUE>(predicate: (value: VALUE, index: number, array: SignedIndexArray<VALUE>) => value is S): SignedIndexArray<S>;
|
|
959
|
+
filter(predicate: (value: VALUE, index: number, array: SignedIndexArray<VALUE>) => unknown): SignedIndexArray<VALUE>;
|
|
960
|
+
reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
|
|
961
|
+
reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
|
|
962
|
+
mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
|
|
963
|
+
map<R = VALUE>(fn: (value: VALUE, key1: number) => R): SignedIndexArray<R>;
|
|
964
|
+
equals(other: SignedIndexArray<VALUE>): boolean;
|
|
965
|
+
equals(other: SignedIndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
|
|
565
966
|
toString(): string;
|
|
566
967
|
}
|
|
567
968
|
|
|
@@ -595,13 +996,16 @@ declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
|
595
996
|
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
596
997
|
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
597
998
|
every(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
598
|
-
filter(
|
|
999
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => value is S): Map1<KEY1, S>;
|
|
1000
|
+
filter(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => unknown): Map1<KEY1, VALUE>;
|
|
1001
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1) => VALUE): VALUE;
|
|
599
1002
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1) => R, init: R): R;
|
|
600
1003
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1) => R): R[];
|
|
601
1004
|
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1) => R): Map1<KEY1, R>;
|
|
602
1005
|
toMap(): Map<KEY1, VALUE>;
|
|
603
1006
|
toString(): string;
|
|
604
1007
|
}
|
|
1008
|
+
|
|
605
1009
|
declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
606
1010
|
private map1;
|
|
607
1011
|
constructor();
|
|
@@ -633,13 +1037,16 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
633
1037
|
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
634
1038
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
635
1039
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
636
|
-
filter(
|
|
1040
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => value is S): Map2<KEY1, KEY2, S>;
|
|
1041
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => unknown): Map2<KEY1, KEY2, VALUE>;
|
|
1042
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
|
|
637
1043
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
638
1044
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
639
1045
|
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): Map2<KEY1, KEY2, R>;
|
|
640
1046
|
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
641
1047
|
toString(): string;
|
|
642
1048
|
}
|
|
1049
|
+
|
|
643
1050
|
declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
644
1051
|
private map1;
|
|
645
1052
|
constructor();
|
|
@@ -672,7 +1079,9 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
672
1079
|
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
673
1080
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
674
1081
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
675
|
-
filter(
|
|
1082
|
+
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>;
|
|
1083
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: Map3<KEY1, KEY2, KEY3, VALUE>) => unknown): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
1084
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
|
|
676
1085
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
677
1086
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
678
1087
|
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): Map3<KEY1, KEY2, KEY3, R>;
|
|
@@ -704,6 +1113,54 @@ declare class MultiContainer<K extends any[], V> {
|
|
|
704
1113
|
* @param base
|
|
705
1114
|
* @returns
|
|
706
1115
|
*/
|
|
707
|
-
declare function asMulti<K extends any[],
|
|
1116
|
+
declare function asMulti<K extends any[], VALUE>(base: KVComponent<K, VALUE[]>): MultiContainer<K, VALUE>;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Vec2 class.
|
|
1120
|
+
*
|
|
1121
|
+
* @deprecated - Use {@link Vec} instead.
|
|
1122
|
+
*/
|
|
1123
|
+
declare class Vec2 {
|
|
1124
|
+
readonly x: number;
|
|
1125
|
+
readonly y: number;
|
|
1126
|
+
constructor(x?: number, y?: number);
|
|
1127
|
+
length(): number;
|
|
1128
|
+
add(a: Vec2): Vec2;
|
|
1129
|
+
sub(a: Vec2): Vec2;
|
|
1130
|
+
mul(a: number): Vec2;
|
|
1131
|
+
div(a: number): Vec2;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions.
|
|
1136
|
+
*
|
|
1137
|
+
* A cache-like structure optimized for small-range integer keys, including negatives.
|
|
1138
|
+
*
|
|
1139
|
+
* Internally implemented using two sparse arrays: one for non-negative keys,
|
|
1140
|
+
* and one for negative keys (stored by index `-key - 1`).
|
|
1141
|
+
*
|
|
1142
|
+
* @remarks
|
|
1143
|
+
* - Fast access for small integer keys.
|
|
1144
|
+
* - Not suitable for large or sparse key ranges — memory usage may grow significantly.
|
|
1145
|
+
* - Supports `get`, `set`, `delete`, `has` and `clear`
|
|
1146
|
+
*
|
|
1147
|
+
* @example
|
|
1148
|
+
* ```ts
|
|
1149
|
+
* const cache = new SmallIntCache<string>();
|
|
1150
|
+
* cache.set(-2, 'A');
|
|
1151
|
+
* cache.set(3, 'B');
|
|
1152
|
+
* console.log(cache.get(-2)); // 'A'
|
|
1153
|
+
* ```
|
|
1154
|
+
*/
|
|
1155
|
+
declare class SmallIntCache<VALUE> {
|
|
1156
|
+
private pos;
|
|
1157
|
+
private neg;
|
|
1158
|
+
constructor();
|
|
1159
|
+
set(key: number, value: VALUE): void;
|
|
1160
|
+
get(key: number): VALUE | undefined;
|
|
1161
|
+
has(key: number): boolean;
|
|
1162
|
+
delete(key: number): void;
|
|
1163
|
+
clear(): void;
|
|
1164
|
+
}
|
|
708
1165
|
|
|
709
|
-
export { Assert, Cookies, Device, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec2, asMulti };
|
|
1166
|
+
export { index$7 as Assert, cookies as Cookies, device as Device, DivRect, Guard, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec, Vec2, asMulti };
|