@thi.ng/api 8.5.1 → 8.6.1
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 +7 -1
- package/README.md +8 -18
- package/assoc.d.ts +1 -1
- package/compare.d.ts +1 -1
- package/deref.d.ts +3 -3
- package/event.d.ts +1 -1
- package/fn.d.ts +43 -43
- package/hiccup.d.ts +4 -4
- package/keyval.d.ts +50 -45
- package/mixin.d.ts +5 -3
- package/mixin.js +5 -3
- package/mixins/ienable.d.ts +4 -5
- package/mixins/ienable.js +4 -5
- package/null.d.ts +2 -2
- package/package.json +10 -7
- package/path.d.ts +17 -17
- package/predicate.d.ts +4 -4
- package/prim.d.ts +3 -3
- package/range.d.ts +24 -24
- package/select.d.ts +3 -3
- package/tuple.d.ts +12 -12
- package/typedarray.d.ts +17 -17
- package/watch.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-
|
|
3
|
+
- **Last updated**: 2022-12-20T16:33:11Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [8.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.6.0) (2022-12-16)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add SomeRequired type alias ([ff28e71](https://github.com/thi-ng/umbrella/commit/ff28e71))
|
|
17
|
+
|
|
12
18
|
## [8.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.5.0) (2022-11-28)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/api)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -15,13 +15,11 @@ This project is part of the
|
|
|
15
15
|
- [Dependencies](#dependencies)
|
|
16
16
|
- [API](#api)
|
|
17
17
|
- [Authors](#authors)
|
|
18
|
-
- [Maintainer](#maintainer)
|
|
19
|
-
- [Contributors](#contributors)
|
|
20
18
|
- [License](#license)
|
|
21
19
|
|
|
22
20
|
## About
|
|
23
21
|
|
|
24
|
-
Common, generic types, interfaces & mixins
|
|
22
|
+
Common, generic types, interfaces & mixins
|
|
25
23
|
|
|
26
24
|
This package is implicitly used by most other projects in this repository. It
|
|
27
25
|
defines:
|
|
@@ -53,11 +51,8 @@ ES module import:
|
|
|
53
51
|
|
|
54
52
|
For Node.js REPL:
|
|
55
53
|
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
node --experimental-repl-await
|
|
59
|
-
|
|
60
|
-
> const api = await import("@thi.ng/api");
|
|
54
|
+
```js
|
|
55
|
+
const api = await import("@thi.ng/api");
|
|
61
56
|
```
|
|
62
57
|
|
|
63
58
|
Package sizes (brotli'd, pre-treeshake): ESM: 2.15 KB
|
|
@@ -72,13 +67,8 @@ None
|
|
|
72
67
|
|
|
73
68
|
## Authors
|
|
74
69
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- Karsten Schmidt ([@postspectacular](https://github.com/postspectacular))
|
|
78
|
-
|
|
79
|
-
### Contributors
|
|
80
|
-
|
|
81
|
-
- Matei Adriel ([@Mateiadrielrafael](https://github.com/Mateiadrielrafael))
|
|
70
|
+
- [Karsten Schmidt](https://thi.ng) (Main author)
|
|
71
|
+
- [Matei Adriel](https://github.com/Mateiadrielrafael)
|
|
82
72
|
|
|
83
73
|
If this project contributes to an academic publication, please cite it as:
|
|
84
74
|
|
|
@@ -93,4 +83,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
93
83
|
|
|
94
84
|
## License
|
|
95
85
|
|
|
96
|
-
© 2016 - 2022 Karsten Schmidt // Apache
|
|
86
|
+
© 2016 - 2022 Karsten Schmidt // Apache License 2.0
|
package/assoc.d.ts
CHANGED
package/compare.d.ts
CHANGED
package/deref.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ export interface IDeref<T> {
|
|
|
8
8
|
*/
|
|
9
9
|
deref(): T;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type MaybeDeref<T> = IDeref<T> | T;
|
|
12
12
|
/**
|
|
13
13
|
* If `T` is a {@link IDeref}, returns its value type or else `T`.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type Derefed<T> = T extends IDeref<any> ? ReturnType<T["deref"]> : T;
|
|
16
16
|
/**
|
|
17
17
|
* Constructs a type with a set of properties `K` of type `T` and
|
|
18
18
|
* attempts to resolve each given key via {@link Derefed}.
|
|
@@ -32,7 +32,7 @@ export declare type Derefed<T> = T extends IDeref<any> ? ReturnType<T["deref"]>
|
|
|
32
32
|
* // { b: number; }
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type DerefedKeys<T extends IObjectOf<any>, K extends keyof T = keyof T> = {
|
|
36
36
|
[P in K]: Derefed<T[P]>;
|
|
37
37
|
};
|
|
38
38
|
/**
|
package/event.d.ts
CHANGED
package/fn.d.ts
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A no-arg function, returning T.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Fn0<T> = () => T;
|
|
5
5
|
/**
|
|
6
6
|
* A single arg function from A to B.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type Fn<A, B> = (a: A) => B;
|
|
9
9
|
/**
|
|
10
10
|
* A 2-arg function from A,B to C.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type Fn2<A, B, C> = (a: A, b: B) => C;
|
|
13
13
|
/**
|
|
14
14
|
* A 3-arg function from A,B,C to D.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type Fn3<A, B, C, D> = (a: A, b: B, c: C) => D;
|
|
17
17
|
/**
|
|
18
18
|
* A 4-arg function from A,B,C,D to E.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type Fn4<A, B, C, D, E> = (a: A, b: B, c: C, d: D) => E;
|
|
21
21
|
/**
|
|
22
22
|
* A 5-arg function from A,B,C,D,E to F.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type Fn5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E) => F;
|
|
25
25
|
/**
|
|
26
26
|
* A 6-arg function from A,B,C,D,E,F to G.
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type Fn6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F) => G;
|
|
29
29
|
/**
|
|
30
30
|
* A 7-arg function from A,B,C,D,E,F,G to H.
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type Fn7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => H;
|
|
33
33
|
/**
|
|
34
34
|
* A 8-arg function from A,B,C,D,E,F,G,H to I.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type Fn8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => I;
|
|
37
37
|
/**
|
|
38
38
|
* A 9-arg function from A,B,C,D,E,F,G,H,I to J.
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type Fn9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) => J;
|
|
41
41
|
/**
|
|
42
42
|
* A 10-arg function from A,B,C,D,E,F,G,H,I,J to K.
|
|
43
43
|
*/
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
44
|
+
export type Fn10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K;
|
|
45
|
+
export type FnO<A, B> = (a: A, ...xs: any[]) => B;
|
|
46
|
+
export type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C;
|
|
47
|
+
export type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D;
|
|
48
|
+
export type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E;
|
|
49
|
+
export type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F;
|
|
50
|
+
export type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...xs: any[]) => G;
|
|
51
|
+
export type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...xs: any[]) => H;
|
|
52
|
+
export type FnO8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...xs: any[]) => I;
|
|
53
|
+
export type FnO9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...xs: any[]) => J;
|
|
54
|
+
export type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...xs: any[]) => K;
|
|
55
55
|
/**
|
|
56
56
|
* An untyped vararg arg function to type T.
|
|
57
57
|
*/
|
|
58
|
-
export
|
|
58
|
+
export type FnAny<T> = (...xs: any[]) => T;
|
|
59
59
|
/**
|
|
60
60
|
* A typed vararg arg function from A to B.
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type FnAnyT<A, B> = (...xs: A[]) => B;
|
|
63
63
|
/**
|
|
64
64
|
* 1-arg function with arg of type A and return type B (defaults
|
|
65
65
|
* to A)
|
|
66
66
|
*/
|
|
67
|
-
export
|
|
67
|
+
export type FnU<A, B = A> = Fn<A, B>;
|
|
68
68
|
/**
|
|
69
69
|
* 2-arg function with all args uniformly of type A and return type B (defaults
|
|
70
70
|
* to A)
|
|
71
71
|
*/
|
|
72
|
-
export
|
|
72
|
+
export type FnU2<A, B = A> = Fn2<A, A, B>;
|
|
73
73
|
/**
|
|
74
74
|
* 3-arg function with all args uniformly of type A and return type B (defaults
|
|
75
75
|
* to A)
|
|
76
76
|
*/
|
|
77
|
-
export
|
|
77
|
+
export type FnU3<A, B = A> = Fn3<A, A, A, B>;
|
|
78
78
|
/**
|
|
79
79
|
* 4-arg function with all args uniformly of type A and return type B (defaults
|
|
80
80
|
* to A)
|
|
81
81
|
*/
|
|
82
|
-
export
|
|
82
|
+
export type FnU4<A, B = A> = Fn4<A, A, A, A, B>;
|
|
83
83
|
/**
|
|
84
84
|
* 5-arg function with all args uniformly of type A and return type B (defaults
|
|
85
85
|
* to A)
|
|
86
86
|
*/
|
|
87
|
-
export
|
|
87
|
+
export type FnU5<A, B = A> = Fn5<A, A, A, A, A, B>;
|
|
88
88
|
/**
|
|
89
89
|
* 6-arg function with all args uniformly of type A and return type B (defaults
|
|
90
90
|
* to A)
|
|
91
91
|
*/
|
|
92
|
-
export
|
|
92
|
+
export type FnU6<A, B = A> = Fn6<A, A, A, A, A, A, B>;
|
|
93
93
|
/**
|
|
94
94
|
* 7-arg function with all args uniformly of type A and return type B (defaults
|
|
95
95
|
* to A)
|
|
96
96
|
*/
|
|
97
|
-
export
|
|
97
|
+
export type FnU7<A, B = A> = Fn7<A, A, A, A, A, A, A, B>;
|
|
98
98
|
/**
|
|
99
99
|
* 8-arg function with all args uniformly of type A and return type B (defaults
|
|
100
100
|
* to A)
|
|
101
101
|
*/
|
|
102
|
-
export
|
|
102
|
+
export type FnU8<A, B = A> = Fn8<A, A, A, A, A, A, A, A, B>;
|
|
103
103
|
/**
|
|
104
104
|
* 9-arg function with all args uniformly of type A and return type B (defaults
|
|
105
105
|
* to A)
|
|
106
106
|
*/
|
|
107
|
-
export
|
|
107
|
+
export type FnU9<A, B = A> = Fn9<A, A, A, A, A, A, A, A, A, B>;
|
|
108
108
|
/**
|
|
109
109
|
* 10-arg function with all args uniformly of type A and return type B (defaults
|
|
110
110
|
* to A)
|
|
111
111
|
*/
|
|
112
|
-
export
|
|
113
|
-
export
|
|
114
|
-
export
|
|
115
|
-
export
|
|
116
|
-
export
|
|
117
|
-
export
|
|
118
|
-
export
|
|
119
|
-
export
|
|
120
|
-
export
|
|
121
|
-
export
|
|
122
|
-
export
|
|
112
|
+
export type FnU10<A, B = A> = Fn10<A, A, A, A, A, A, A, A, A, A, B>;
|
|
113
|
+
export type FnN = FnU<number>;
|
|
114
|
+
export type FnN2 = FnU2<number>;
|
|
115
|
+
export type FnN3 = FnU3<number>;
|
|
116
|
+
export type FnN4 = FnU4<number>;
|
|
117
|
+
export type FnN5 = FnU5<number>;
|
|
118
|
+
export type FnN6 = FnU6<number>;
|
|
119
|
+
export type FnN7 = FnU7<number>;
|
|
120
|
+
export type FnN8 = FnU8<number>;
|
|
121
|
+
export type FnN9 = FnU9<number>;
|
|
122
|
+
export type FnN10 = FnU10<number>;
|
|
123
123
|
//# sourceMappingURL=fn.d.ts.map
|
package/hiccup.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface IToHiccup {
|
|
2
2
|
/**
|
|
3
|
-
* Returns a
|
|
4
|
-
* `ctx` arg is an arbitrary user context
|
|
5
|
-
* hiccup components during serialization (or during
|
|
6
|
-
* update if used with
|
|
3
|
+
* Returns a [thi.ng/hiccup](https://thi.ng/hiccup) compatible
|
|
4
|
+
* representation. The optional `ctx` arg is an arbitrary user context
|
|
5
|
+
* object passed to all hiccup components during serialization (or during
|
|
6
|
+
* DOM creation / update if used with [thi.ng/hdom](https://thi.ng/hdom)).
|
|
7
7
|
*
|
|
8
8
|
* @param ctx - user context object
|
|
9
9
|
* @param attribs - user attribs
|
package/keyval.d.ts
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import type { Head, Tail } from "./tuple.js";
|
|
2
|
+
/**
|
|
3
|
+
* A version of `T` in which only keys in K are mandatory and the rest are
|
|
4
|
+
* considered optional.
|
|
5
|
+
*/
|
|
6
|
+
export type SomeRequired<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
2
7
|
/**
|
|
3
8
|
* Extracts from A all keys which have values assignable to type B.
|
|
4
9
|
*/
|
|
5
|
-
export
|
|
10
|
+
export type TypedKeys<A, B> = {
|
|
6
11
|
[P in Keys<A>]: B extends A[P] ? P : never;
|
|
7
12
|
}[keyof A];
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
13
|
+
export type NumericKeys<T> = TypedKeys<T, number>;
|
|
14
|
+
export type StringKeys<T> = TypedKeys<T, string>;
|
|
15
|
+
export type DeepPartial<T> = Partial<{
|
|
11
16
|
[k in keyof T]: DeepPartial<T[k]>;
|
|
12
17
|
}>;
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
18
|
+
export type Keys<T> = keyof Required<T>;
|
|
19
|
+
export type Keys1<T, A extends Keys<T>> = Keys<Required<T>[A]>;
|
|
20
|
+
export type Keys2<T, A extends Keys<T>, B extends Keys1<T, A>> = Keys1<Required<T>[A], B>;
|
|
21
|
+
export type Keys3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Keys2<Required<T>[A], B, C>;
|
|
22
|
+
export type Keys4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Keys3<Required<T>[A], B, C, D>;
|
|
23
|
+
export type Keys5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Keys4<Required<T>[A], B, C, D, E>;
|
|
24
|
+
export type Keys6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Keys5<Required<T>[A], B, C, D, E, F>;
|
|
25
|
+
export type Keys7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Keys6<Required<T>[A], B, C, D, E, F, G>;
|
|
26
|
+
export type Keys8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Keys7<Required<T>[A], B, C, D, E, F, G, H>;
|
|
22
27
|
/**
|
|
23
28
|
* Internal type used as a reducer for the KeyN type.
|
|
24
29
|
*
|
|
@@ -28,22 +33,22 @@ export declare type Keys8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends
|
|
|
28
33
|
* @param L - Current value.
|
|
29
34
|
* @param R - Remaining values.
|
|
30
35
|
*/
|
|
31
|
-
|
|
36
|
+
type KeysNReducer<T, L, R extends unknown[]> = L extends keyof T ? {
|
|
32
37
|
0: keyof Required<T>[L];
|
|
33
38
|
1: KeysNReducer<Required<T>[L], Head<R>, Tail<R>>;
|
|
34
39
|
}[R extends [] ? 0 : 1] : never;
|
|
35
40
|
/**
|
|
36
41
|
* Generalised version of Keys0 - Keys7.
|
|
37
42
|
*/
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
export
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
43
|
+
export type KeysN<T, L extends unknown[]> = L extends [] ? Keys<T> : KeysNReducer<T, Head<L>, Tail<L>>;
|
|
44
|
+
export type Val1<T, A extends Keys<T>> = T[A];
|
|
45
|
+
export type Val2<T, A extends Keys<T>, B extends Keys1<T, A>> = ValN<T, [A, B]>;
|
|
46
|
+
export type Val3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = ValN<T, [A, B, C]>;
|
|
47
|
+
export type Val4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = ValN<T, [A, B, C, D]>;
|
|
48
|
+
export type Val5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = ValN<T, [A, B, C, D, E]>;
|
|
49
|
+
export type Val6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = ValN<T, [A, B, C, D, E, F]>;
|
|
50
|
+
export type Val7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = ValN<T, [A, B, C, D, E, F, G]>;
|
|
51
|
+
export type Val8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = ValN<T, [A, B, C, D, E, F, G, H]>;
|
|
47
52
|
/**
|
|
48
53
|
* Internal reducer for ValN.
|
|
49
54
|
*
|
|
@@ -53,37 +58,37 @@ export declare type Val8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends
|
|
|
53
58
|
* @param C - he current key.
|
|
54
59
|
* @param R - he remaining keys
|
|
55
60
|
*/
|
|
56
|
-
|
|
61
|
+
type ValNReducer<T, C, R extends unknown[]> = C extends keyof T ? {
|
|
57
62
|
0: T[C];
|
|
58
63
|
1: ValNReducer<Required<T>[C], Head<R>, Tail<R>>;
|
|
59
64
|
}[R extends [] ? 0 : 1] : never;
|
|
60
65
|
/**
|
|
61
66
|
* Generalised version of Val1-Val7
|
|
62
67
|
*/
|
|
63
|
-
export
|
|
68
|
+
export type ValN<T, L extends unknown[]> = L extends [] ? T : ValNReducer<T, Head<L>, Tail<L>>;
|
|
64
69
|
/**
|
|
65
70
|
* Utilities for constructing types with nested keys removed.
|
|
66
71
|
*/
|
|
67
|
-
export
|
|
68
|
-
export
|
|
72
|
+
export type Without<T, A extends Keys<T>> = Omit<T, A>;
|
|
73
|
+
export type Without2<T, A extends Keys<T>, B extends Keys1<T, A>> = Without<T, A> & {
|
|
69
74
|
[id in A]: Without<Val1<T, A>, B>;
|
|
70
75
|
};
|
|
71
|
-
export
|
|
76
|
+
export type Without3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>> = Without<T, A> & {
|
|
72
77
|
[id in A]: Without2<Val1<T, A>, B, C>;
|
|
73
78
|
};
|
|
74
|
-
export
|
|
79
|
+
export type Without4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>> = Without<T, A> & {
|
|
75
80
|
[id in A]: Without3<Val1<T, A>, B, C, D>;
|
|
76
81
|
};
|
|
77
|
-
export
|
|
82
|
+
export type Without5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>> = Without<T, A> & {
|
|
78
83
|
[id in A]: Without4<Val1<T, A>, B, C, D, E>;
|
|
79
84
|
};
|
|
80
|
-
export
|
|
85
|
+
export type Without6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>> = Without<T, A> & {
|
|
81
86
|
[id in A]: Without5<Val1<T, A>, B, C, D, E, F>;
|
|
82
87
|
};
|
|
83
|
-
export
|
|
88
|
+
export type Without7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>> = Without<T, A> & {
|
|
84
89
|
[id in A]: Without6<Val1<T, A>, B, C, D, E, F, G>;
|
|
85
90
|
};
|
|
86
|
-
export
|
|
91
|
+
export type Without8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>> = Without<T, A> & {
|
|
87
92
|
[id in A]: Without7<Val1<T, A>, B, C, D, E, F, G, H>;
|
|
88
93
|
};
|
|
89
94
|
/**
|
|
@@ -95,39 +100,39 @@ export declare type Without8<T, A extends Keys<T>, B extends Keys1<T, A>, C exte
|
|
|
95
100
|
* @param C - he current key.
|
|
96
101
|
* @param R - he remaining keys.
|
|
97
102
|
*/
|
|
98
|
-
|
|
103
|
+
type WithoutNReducer<T, C, R extends unknown[]> = C extends keyof T ? {
|
|
99
104
|
0: Without<T, C>;
|
|
100
105
|
1: Without<T, C> & Record<C, WithoutNReducer<T[C], Head<R>, Tail<R>>>;
|
|
101
106
|
}[R extends [] ? 0 : 1] : never;
|
|
102
107
|
/**
|
|
103
108
|
* Generalised version of Without0-Without8.
|
|
104
109
|
*/
|
|
105
|
-
export
|
|
110
|
+
export type WithoutN<T, P extends unknown[]> = WithoutNReducer<T, Head<P>, Tail<P>>;
|
|
106
111
|
/**
|
|
107
112
|
* Utilities for replacing types of nested keys.
|
|
108
113
|
*/
|
|
109
|
-
export
|
|
114
|
+
export type Replace<T, A extends Keys<T>, V> = Without<T, A> & {
|
|
110
115
|
[id in A]: V;
|
|
111
116
|
};
|
|
112
|
-
export
|
|
117
|
+
export type Replace2<T, A extends Keys<T>, B extends Keys1<T, A>, V> = Without<T, A> & {
|
|
113
118
|
[id in A]: Replace<Val1<T, A>, B, V>;
|
|
114
119
|
};
|
|
115
|
-
export
|
|
120
|
+
export type Replace3<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, V> = Without<T, A> & {
|
|
116
121
|
[id in A]: Replace2<Val1<T, A>, B, C, V>;
|
|
117
122
|
};
|
|
118
|
-
export
|
|
123
|
+
export type Replace4<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, V> = Without<T, A> & {
|
|
119
124
|
[id in A]: Replace3<Val1<T, A>, B, C, D, V>;
|
|
120
125
|
};
|
|
121
|
-
export
|
|
126
|
+
export type Replace5<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, V> = Without<T, A> & {
|
|
122
127
|
[id in A]: Replace4<Val1<T, A>, B, C, D, E, V>;
|
|
123
128
|
};
|
|
124
|
-
export
|
|
129
|
+
export type Replace6<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, V> = Without<T, A> & {
|
|
125
130
|
[id in A]: Replace5<Val1<T, A>, B, C, D, E, F, V>;
|
|
126
131
|
};
|
|
127
|
-
export
|
|
132
|
+
export type Replace7<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, V> = Without<T, A> & {
|
|
128
133
|
[id in A]: Replace6<Val1<T, A>, B, C, D, E, F, G, V>;
|
|
129
134
|
};
|
|
130
|
-
export
|
|
135
|
+
export type Replace8<T, A extends Keys<T>, B extends Keys1<T, A>, C extends Keys2<T, A, B>, D extends Keys3<T, A, B, C>, E extends Keys4<T, A, B, C, D>, F extends Keys5<T, A, B, C, D, E>, G extends Keys6<T, A, B, C, D, E, F>, H extends Keys7<T, A, B, C, D, E, F, G>, V> = Without<T, A> & {
|
|
131
136
|
[id in A]: Replace7<Val1<T, A>, B, C, D, E, F, G, H, V>;
|
|
132
137
|
};
|
|
133
138
|
/**
|
|
@@ -140,13 +145,13 @@ export declare type Replace8<T, A extends Keys<T>, B extends Keys1<T, A>, C exte
|
|
|
140
145
|
* @param R - he remaining keys.
|
|
141
146
|
* @param V - he type to use for the replacement.
|
|
142
147
|
*/
|
|
143
|
-
|
|
148
|
+
type ReplaceNReducer<T, C, R extends unknown[], V> = C extends keyof T ? {
|
|
144
149
|
0: Replace<T, C, V>;
|
|
145
150
|
1: Without<T, C> & Record<C, ReplaceNReducer<T[C], Head<R>, Tail<R>, V>>;
|
|
146
151
|
}[R extends [] ? 0 : 1] : never;
|
|
147
152
|
/**
|
|
148
153
|
* Generalised version of Replace0-Replace8.
|
|
149
154
|
*/
|
|
150
|
-
export
|
|
155
|
+
export type ReplaceN<T, P extends unknown[], V> = ReplaceNReducer<T, Head<P>, Tail<P>, V>;
|
|
151
156
|
export {};
|
|
152
157
|
//# sourceMappingURL=keyval.d.ts.map
|
package/mixin.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class behavior mixin based on:
|
|
3
|
-
*
|
|
3
|
+
* - http://raganwald.com/2015/06/26/decorators-in-es7.html
|
|
4
4
|
*
|
|
5
5
|
* Additionally only injects/overwrites properties in target, which are NOT
|
|
6
|
-
* marked with
|
|
7
|
-
*
|
|
6
|
+
* marked with
|
|
7
|
+
* [`@nomixin`](https://docs.thi.ng/umbrella/api/functions/nomixin.html) (i.e.
|
|
8
|
+
* those which haven't set their `configurable` property descriptor flag to
|
|
9
|
+
* `false`)
|
|
8
10
|
*
|
|
9
11
|
* @param behaviour - to mixin
|
|
10
12
|
* @param sharedBehaviour -
|
package/mixin.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class behavior mixin based on:
|
|
3
|
-
*
|
|
3
|
+
* - http://raganwald.com/2015/06/26/decorators-in-es7.html
|
|
4
4
|
*
|
|
5
5
|
* Additionally only injects/overwrites properties in target, which are NOT
|
|
6
|
-
* marked with
|
|
7
|
-
*
|
|
6
|
+
* marked with
|
|
7
|
+
* [`@nomixin`](https://docs.thi.ng/umbrella/api/functions/nomixin.html) (i.e.
|
|
8
|
+
* those which haven't set their `configurable` property descriptor flag to
|
|
9
|
+
* `false`)
|
|
8
10
|
*
|
|
9
11
|
* @param behaviour - to mixin
|
|
10
12
|
* @param sharedBehaviour -
|
package/mixins/ienable.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mixin class decorator, injects IEnable default implementation, incl.
|
|
3
|
-
*
|
|
4
|
-
* {@link
|
|
5
|
-
*
|
|
6
|
-
* events.
|
|
2
|
+
* Mixin class decorator, injects IEnable default implementation, incl. a
|
|
3
|
+
* `_enabled` property. If the target also implements the {@link INotify}
|
|
4
|
+
* interface, {@link IEnable.enable} and {@link IEnable.disable} will
|
|
5
|
+
* automatically emit the respective events.
|
|
7
6
|
*/
|
|
8
7
|
export declare const IEnableMixin: (clazz: any) => any;
|
|
9
8
|
//# sourceMappingURL=ienable.d.ts.map
|
package/mixins/ienable.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { EVENT_DISABLE, EVENT_ENABLE } from "../api.js";
|
|
2
2
|
import { mixin } from "../mixin.js";
|
|
3
3
|
/**
|
|
4
|
-
* Mixin class decorator, injects IEnable default implementation, incl.
|
|
5
|
-
*
|
|
6
|
-
* {@link
|
|
7
|
-
*
|
|
8
|
-
* events.
|
|
4
|
+
* Mixin class decorator, injects IEnable default implementation, incl. a
|
|
5
|
+
* `_enabled` property. If the target also implements the {@link INotify}
|
|
6
|
+
* interface, {@link IEnable.enable} and {@link IEnable.disable} will
|
|
7
|
+
* automatically emit the respective events.
|
|
9
8
|
*/
|
|
10
9
|
export const IEnableMixin = mixin({
|
|
11
10
|
_enabled: true,
|
package/null.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Nullable<T> = T | null | undefined;
|
|
2
2
|
/**
|
|
3
3
|
* Similar to `NonNullable`, but only excludes `undefined`.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type Always<T> = T extends undefined ? never : T;
|
|
6
6
|
//# sourceMappingURL=null.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.1",
|
|
4
4
|
"description": "Common, generic types, interfaces & mixins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Matei Adriel (https://github.com/Mateiadrielrafael)"
|
|
27
|
+
],
|
|
25
28
|
"license": "Apache-2.0",
|
|
26
29
|
"scripts": {
|
|
27
30
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,12 +37,12 @@
|
|
|
34
37
|
"test": "testament test"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
37
|
-
"@microsoft/api-extractor": "^7.33.
|
|
38
|
-
"@thi.ng/testament": "^0.3.
|
|
40
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
41
|
+
"@thi.ng/testament": "^0.3.7",
|
|
39
42
|
"rimraf": "^3.0.2",
|
|
40
43
|
"tools": "^0.0.1",
|
|
41
|
-
"typedoc": "^0.23.
|
|
42
|
-
"typescript": "^4.
|
|
44
|
+
"typedoc": "^0.23.22",
|
|
45
|
+
"typescript": "^4.9.4"
|
|
43
46
|
},
|
|
44
47
|
"keywords": [
|
|
45
48
|
"assert",
|
|
@@ -222,5 +225,5 @@
|
|
|
222
225
|
"default": "./watch.js"
|
|
223
226
|
}
|
|
224
227
|
},
|
|
225
|
-
"gitHead": "
|
|
228
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
226
229
|
}
|
package/path.d.ts
CHANGED
|
@@ -4,60 +4,60 @@ import type { Head, Tail, IsEmpty } from "./tuple.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Unchecked lookup path for nested data structures.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type Path = readonly NumOrString[] | NumOrString;
|
|
8
8
|
/**
|
|
9
9
|
* Empty lookup path.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type Path0 = readonly [];
|
|
12
12
|
/**
|
|
13
13
|
* Type checked lookup path (depth 1)
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type Path1<T, A> = A extends Keys<T> ? readonly [A] : never;
|
|
16
16
|
/**
|
|
17
17
|
* Type checked lookup path (depth 2)
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type Path2<T, A, B> = A extends Keys<T> ? B extends Keys1<T, A> ? readonly [A, B] : never : never;
|
|
20
20
|
/**
|
|
21
21
|
* Type checked lookup path (depth 3)
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type Path3<T, A, B, C> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? readonly [A, B, C] : never : never : never;
|
|
24
24
|
/**
|
|
25
25
|
* Type checked lookup path (depth 4)
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export type Path4<T, A, B, C, D> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? readonly [A, B, C, D] : never : never : never : never;
|
|
28
28
|
/**
|
|
29
29
|
* Type checked lookup path (depth 5)
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type Path5<T, A, B, C, D, E> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? readonly [A, B, C, D, E] : never : never : never : never : never;
|
|
32
32
|
/**
|
|
33
33
|
* Type checked lookup path (depth 6)
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type Path6<T, A, B, C, D, E, F> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? readonly [A, B, C, D, E, F] : never : never : never : never : never : never;
|
|
36
36
|
/**
|
|
37
37
|
* Type checked lookup path (depth 7)
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export type Path7<T, A, B, C, D, E, F, G> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? readonly [A, B, C, D, E, F, G] : never : never : never : never : never : never : never;
|
|
40
40
|
/**
|
|
41
41
|
* Type checked lookup path (depth 8)
|
|
42
42
|
*/
|
|
43
|
-
export
|
|
43
|
+
export type Path8<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H] : never : never : never : never : never : never : never : never;
|
|
44
44
|
/**
|
|
45
45
|
* Semi-typechecked lookup path (depth > 8). Only the first 8 levels are
|
|
46
46
|
* checked.
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export type DeepPath<T, A, B, C, D, E, F, G, H> = A extends Keys<T> ? B extends Keys1<T, A> ? C extends Keys2<T, A, B> ? D extends Keys3<T, A, B, C> ? E extends Keys4<T, A, B, C, D> ? F extends Keys5<T, A, B, C, D, E> ? G extends Keys6<T, A, B, C, D, E, F> ? H extends Keys7<T, A, B, C, D, E, F, G> ? readonly [A, B, C, D, E, F, G, H, ...NumOrString[]] : never : never : never : never : never : never : never : never;
|
|
49
49
|
/**
|
|
50
50
|
* Returns `RES` if `PRED` is `never`, else `RES | undefined`
|
|
51
51
|
*/
|
|
52
|
-
export
|
|
52
|
+
export type OptVal<PRED, RES> = [PRED] extends [never] ? RES : RES | undefined;
|
|
53
53
|
/**
|
|
54
54
|
* Returns true if `T` includes undefined.
|
|
55
55
|
*/
|
|
56
|
-
export
|
|
56
|
+
export type IsOpt<T> = T extends undefined ? true : never;
|
|
57
57
|
/**
|
|
58
58
|
* Internal recursive helper type for {@link IsOptPath}.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
type IsOptR<T, K, P extends unknown[]> = K extends Keys<T> ? [true] extends [IsOpt<T[K]>] ? true : {
|
|
61
61
|
0: IsOptR<Required<T>[K], Head<P>, Tail<P>>;
|
|
62
62
|
1: never;
|
|
63
63
|
}[IsEmpty<P>] : never;
|
|
@@ -68,7 +68,7 @@ declare type IsOptR<T, K, P extends unknown[]> = K extends Keys<T> ? [true] exte
|
|
|
68
68
|
* Reference:
|
|
69
69
|
* https://stackoverflow.com/q/60869412/294515
|
|
70
70
|
*/
|
|
71
|
-
export
|
|
71
|
+
export type IsOptPath<T, P extends unknown[]> = P extends [] ? never : IsOptR<T, Head<P>, Tail<P>>;
|
|
72
72
|
/**
|
|
73
73
|
* Similar to {@link PathVal}, but also takes into account if given path
|
|
74
74
|
* contains any intermediate properties declared as optional in type
|
|
@@ -77,11 +77,11 @@ export declare type IsOptPath<T, P extends unknown[]> = P extends [] ? never : I
|
|
|
77
77
|
*
|
|
78
78
|
* Context & reference: https://stackoverflow.com/q/60869412/294515
|
|
79
79
|
*/
|
|
80
|
-
export
|
|
80
|
+
export type OptPathVal<T, P extends unknown[]> = OptVal<IsOptPath<T, P>, ValN<T, P>>;
|
|
81
81
|
/**
|
|
82
82
|
* Returns nested value type for given path into `T` or `never` if path
|
|
83
83
|
* is incompatible with `T`.
|
|
84
84
|
*/
|
|
85
|
-
export
|
|
85
|
+
export type PathVal<T, P extends unknown[]> = ValN<T, P>;
|
|
86
86
|
export {};
|
|
87
87
|
//# sourceMappingURL=path.d.ts.map
|
package/predicate.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import type { Fn, Fn0, Fn2 } from "./fn.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Predicate function mapping given value to true/false.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type Predicate<T> = Fn<T, boolean>;
|
|
6
6
|
/**
|
|
7
7
|
* Predicate function mapping given args to true/false.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type Predicate2<T> = Fn2<T, T, boolean>;
|
|
10
10
|
/**
|
|
11
11
|
* Higher order {@link Predicate} builder. Possibly stateful.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type StatefulPredicate<T> = Fn0<Predicate<T>>;
|
|
14
14
|
/**
|
|
15
15
|
* Higher order {@link Predicate2} builder. Possibly stateful.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type StatefulPredicate2<T> = Fn0<Predicate2<T>>;
|
|
18
18
|
//# sourceMappingURL=predicate.d.ts.map
|
package/prim.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type NumOrString = number | string;
|
|
2
|
+
export type StringOrSym = string | symbol;
|
|
3
|
+
export type Primitive = NumOrString | boolean | symbol;
|
|
4
4
|
//# sourceMappingURL=prim.d.ts.map
|
package/range.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
1
|
+
export type Range = [number, number];
|
|
2
|
+
export type Range0_1 = 0 | 1;
|
|
3
|
+
export type Range0_3 = Range0_1 | 2 | 3;
|
|
4
|
+
export type Range0_7 = Range0_3 | Range4_7;
|
|
5
|
+
export type Range0_15 = Range0_7 | Range8_15;
|
|
6
|
+
export type Range0_23 = Range0_15 | Range16_23;
|
|
7
|
+
export type Range0_31 = Range0_15 | Range16_31;
|
|
8
|
+
export type Range0_47 = Range0_31 | Range32_47;
|
|
9
|
+
export type Range0_63 = Range0_31 | Range32_63;
|
|
10
|
+
export type Range1_2 = 1 | 2;
|
|
11
|
+
export type Range1_4 = Range1_2 | 3 | 4;
|
|
12
|
+
export type Range1_8 = Range1_4 | Range4_7 | 8;
|
|
13
|
+
export type Range1_16 = Range1_8 | Range8_15 | 16;
|
|
14
|
+
export type Range1_24 = Range1_16 | Range16_23 | 24;
|
|
15
|
+
export type Range1_32 = Range1_16 | Range16_31 | 32;
|
|
16
|
+
export type Range1_48 = Range1_32 | Range32_47 | 48;
|
|
17
|
+
export type Range1_64 = Range1_32 | Range32_63 | 64;
|
|
18
|
+
export type Range4_7 = 4 | 5 | 6 | 7;
|
|
19
|
+
export type Range8_15 = 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
20
|
+
export type Range16_23 = 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
|
|
21
|
+
export type Range16_31 = Range16_23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
|
|
22
|
+
export type Range32_47 = 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47;
|
|
23
|
+
export type Range48_63 = 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63;
|
|
24
|
+
export type Range32_63 = Range32_47 | Range48_63;
|
|
25
25
|
/**
|
|
26
26
|
* Type LUT of allowed range values `[0..n)` for given range size `n`.
|
|
27
27
|
*
|
package/select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type Select2<T, Q, A, B> = T extends Q ? A : B;
|
|
2
|
+
export type Select3<T, Q1, Q2, A, B, C> = T extends Q1 ? A : T extends Q2 ? B : C;
|
|
3
|
+
export type Select4<T, Q1, Q2, Q3, A, B, C, D> = T extends Q1 ? A : T extends Q2 ? B : T extends Q3 ? C : D;
|
|
4
4
|
//# sourceMappingURL=select.d.ts.map
|
package/tuple.d.ts
CHANGED
|
@@ -3,46 +3,46 @@ import type { TypedArray } from "./typedarray.js";
|
|
|
3
3
|
* Returns an array's value type. Assumes array is homogeneous (only type of
|
|
4
4
|
* first element will be considered).
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type ArrayValue<T extends unknown[]> = T[0];
|
|
7
7
|
/**
|
|
8
8
|
* Somewhat similar, but recursive version of {@link ArrayValue}. If `T` is an
|
|
9
9
|
* array/typedarray recursively descends into it or (if not an array) returns
|
|
10
10
|
* `T`. Assumes arrays at each level are homogeneous (only type of first
|
|
11
11
|
* elements will be considered).
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type DeepArrayValue<T> = T extends unknown[] ? DeepArrayValue<T[0]> : T extends TypedArray ? number : T;
|
|
14
14
|
/**
|
|
15
15
|
* Defines a fixed sized, iterable tuple with elements of type `T` and
|
|
16
16
|
* length `N`.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export type Tuple<T, N extends number> = [T, ...T[]] & {
|
|
19
19
|
length: N;
|
|
20
20
|
} & Iterable<T>;
|
|
21
21
|
/**
|
|
22
22
|
* Extracts a tuple's length / size.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type TupleLength<T extends unknown[]> = T["length"];
|
|
25
25
|
/**
|
|
26
26
|
* Returns 1 if T is empty tuple, else 0
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type IsEmpty<T extends unknown[]> = T extends [] ? 1 : 0;
|
|
29
29
|
/**
|
|
30
30
|
* Extracts the first element of a tuple.
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type Head<T extends unknown[]> = T extends [infer A, ...unknown[]] ? A : never;
|
|
33
33
|
/**
|
|
34
34
|
* Extracts everything except the first element from a tuple.
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type Tail<T extends unknown[]> = T extends [unknown, ...infer A] ? A : never;
|
|
37
37
|
/**
|
|
38
38
|
* Adds an element at the start of an tuple.
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export type Prepend<T, U extends unknown[]> = [T, ...U];
|
|
41
41
|
/**
|
|
42
42
|
* Internal version of {@link Reverse} accepting 1 extra argument for
|
|
43
43
|
* the accumulated value.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
type ReverseReducer<T extends unknown[], C extends unknown[]> = {
|
|
46
46
|
0: C;
|
|
47
47
|
1: Prepend<Head<T>, C>;
|
|
48
48
|
2: ReverseReducer<Tail<T>, Prepend<Head<T>, C>>;
|
|
@@ -50,18 +50,18 @@ declare type ReverseReducer<T extends unknown[], C extends unknown[]> = {
|
|
|
50
50
|
/**
|
|
51
51
|
* Reverses the order of elements from a tuple.
|
|
52
52
|
*/
|
|
53
|
-
export
|
|
53
|
+
export type Reverse<T extends unknown[]> = ReverseReducer<T, []>;
|
|
54
54
|
/**
|
|
55
55
|
* Extracts the last element from a tuple.
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export type Last<T extends unknown[]> = {
|
|
58
58
|
0: Last<Tail<T>>;
|
|
59
59
|
1: Head<T>;
|
|
60
60
|
}[IsEmpty<Tail<T>>];
|
|
61
61
|
/**
|
|
62
62
|
* Extracts everything except the last element from a tuple.
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export type ButLast<T extends unknown[], C extends unknown[] = []> = {
|
|
65
65
|
0: ButLast<Tail<T>, Prepend<Head<T>, C>>;
|
|
66
66
|
1: Reverse<C>;
|
|
67
67
|
}[IsEmpty<Tail<T>>];
|
package/typedarray.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
1
|
+
export type ArrayLikeIterable<T> = ArrayLike<T> & Iterable<T>;
|
|
2
|
+
export type NumericArray = number[] | TypedArray;
|
|
3
|
+
export type TypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
4
|
+
export type BigTypedArray = BigInt64Array | BigUint64Array;
|
|
5
|
+
export type FloatArray = Float32Array | Float64Array;
|
|
6
|
+
export type IntArray = Int8Array | Int16Array | Int32Array;
|
|
7
|
+
export type UIntArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
8
|
+
export type FloatArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor;
|
|
9
|
+
export type IntArrayConstructor = Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
|
|
10
|
+
export type UIntArrayConstructor = Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor;
|
|
11
|
+
export type BigIntArrayConstructor = BigInt64ArrayConstructor | BigUint64ArrayConstructor;
|
|
12
|
+
export type TypedArrayConstructor = FloatArrayConstructor | IntArrayConstructor | UIntArrayConstructor;
|
|
13
13
|
/**
|
|
14
14
|
* Type IDs for typed array backed buffers and generally describing binary data
|
|
15
15
|
* values.
|
|
16
16
|
*
|
|
17
17
|
* {@link GLType} {@link GL2TYPE} {@link TYPE2GL}
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
19
|
+
export type Type = "u8" | "u8c" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "f64";
|
|
20
|
+
export type BigType = "i64" | "u64";
|
|
21
|
+
export type UintType = "u8" | "u8c" | "u16" | "u32";
|
|
22
|
+
export type IntType = "i8" | "i16" | "i32";
|
|
23
|
+
export type FloatType = "f32" | "f64";
|
|
24
24
|
/**
|
|
25
25
|
* WebGL numeric type constants. Use {@link GL2TYPE} to convert, if needed.
|
|
26
26
|
*
|
package/watch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Observer function for {@link IWatch} implementations.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type Watch<T> = (id: string, oldState: T, newState: T) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Interface for types offering observers of internal value changes.
|
|
7
7
|
* Also see `@IWatch` decorator mixin.
|