@vertexvis/utils 0.24.5-canary.4 → 1.0.0-testing.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/async.d.ts +79 -79
- package/dist/binaryReader.d.ts +58 -58
- package/dist/browser.cjs.js +1202 -1351
- package/dist/browser.cjs.js.map +1 -1
- package/dist/browser.esm.js +1197 -1351
- package/dist/browser.esm.js.map +1 -1
- package/dist/bundle.cjs.js +1199 -1344
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +1197 -1343
- package/dist/bundle.esm.js.map +1 -1
- package/dist/color.d.ts +62 -62
- package/dist/disposable.d.ts +10 -10
- package/dist/eventDispatcher.d.ts +16 -16
- package/dist/eventTargets.d.ts +10 -10
- package/dist/index.d.ts +19 -19
- package/dist/mappedTypes.d.ts +49 -49
- package/dist/mapper.d.ts +270 -270
- package/dist/objects.d.ts +72 -72
- package/dist/predicate.d.ts +5 -5
- package/dist/range.d.ts +86 -86
- package/dist/sets.d.ts +1 -1
- package/dist/sort.d.ts +21 -21
- package/dist/strings.d.ts +3 -3
- package/dist/uri.d.ts +56 -56
- package/dist/uuid.d.ts +8 -8
- package/package.json +11 -11
package/dist/eventTargets.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds a listener to the given `target`, and returns a promise that
|
|
3
|
-
* resolves with the first event emitted of the given `type`.
|
|
4
|
-
*
|
|
5
|
-
* @param target The target to add an event listener to.
|
|
6
|
-
* @param type The event type to listen for.
|
|
7
|
-
* @param opts Options to pass to `addEventListener`.
|
|
8
|
-
* @returns A promise that resolves with the first event emitted of `type`.
|
|
9
|
-
*/
|
|
10
|
-
export declare function once<E extends Event>(target: EventTarget, type: string, opts?: boolean | AddEventListenerOptions): Promise<E>;
|
|
1
|
+
/**
|
|
2
|
+
* Adds a listener to the given `target`, and returns a promise that
|
|
3
|
+
* resolves with the first event emitted of the given `type`.
|
|
4
|
+
*
|
|
5
|
+
* @param target The target to add an event listener to.
|
|
6
|
+
* @param type The event type to listen for.
|
|
7
|
+
* @param opts Options to pass to `addEventListener`.
|
|
8
|
+
* @returns A promise that resolves with the first event emitted of `type`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function once<E extends Event>(target: EventTarget, type: string, opts?: boolean | AddEventListenerOptions): Promise<E>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Utils
|
|
3
|
-
*/
|
|
4
|
-
import * as Async from './async';
|
|
5
|
-
import * as BinaryReader from './binaryReader';
|
|
6
|
-
import * as Color from './color';
|
|
7
|
-
import * as EventTargets from './eventTargets';
|
|
8
|
-
import * as Mapper from './mapper';
|
|
9
|
-
import * as Objects from './objects';
|
|
10
|
-
import * as Range from './range';
|
|
11
|
-
import * as Sets from './sets';
|
|
12
|
-
import * as Strings from './strings';
|
|
13
|
-
import * as Uri from './uri';
|
|
14
|
-
import * as UUID from './uuid';
|
|
15
|
-
export * from './disposable';
|
|
16
|
-
export * from './eventDispatcher';
|
|
17
|
-
export * from './mappedTypes';
|
|
18
|
-
export * from './predicate';
|
|
19
|
-
export { Async, BinaryReader, Color, EventTargets, Mapper, Objects, Range, Sets, Strings, Uri, UUID, };
|
|
1
|
+
/**
|
|
2
|
+
* @module Utils
|
|
3
|
+
*/
|
|
4
|
+
import * as Async from './async';
|
|
5
|
+
import * as BinaryReader from './binaryReader';
|
|
6
|
+
import * as Color from './color';
|
|
7
|
+
import * as EventTargets from './eventTargets';
|
|
8
|
+
import * as Mapper from './mapper';
|
|
9
|
+
import * as Objects from './objects';
|
|
10
|
+
import * as Range from './range';
|
|
11
|
+
import * as Sets from './sets';
|
|
12
|
+
import * as Strings from './strings';
|
|
13
|
+
import * as Uri from './uri';
|
|
14
|
+
import * as UUID from './uuid';
|
|
15
|
+
export * from './disposable';
|
|
16
|
+
export * from './eventDispatcher';
|
|
17
|
+
export * from './mappedTypes';
|
|
18
|
+
export * from './predicate';
|
|
19
|
+
export { Async, BinaryReader, Color, EventTargets, Mapper, Objects, Range, Sets, Strings, Uri, UUID, };
|
package/dist/mappedTypes.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is only for mapped TypeScript types. It should NOT include
|
|
3
|
-
* constants classes or methods.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* A type that recursively makes each property of `T` optional.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```
|
|
10
|
-
* type Foo = { a: number };
|
|
11
|
-
* type Bar = { foo: Foo };
|
|
12
|
-
* type Baz = DeepPartial<Bar>; // { foo?: { a?: number } }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export
|
|
16
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
17
|
-
} : T;
|
|
18
|
-
/**
|
|
19
|
-
* A type that recursively makes each property of `T` required.
|
|
20
|
-
* Optionally excluding a nested path specified by a list of keys.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```
|
|
24
|
-
* type Foo = { a?: { c?: number }, b?: string };
|
|
25
|
-
* type Bar = { foo: Foo };
|
|
26
|
-
* type Baz = DeepRequired<Bar, []>; // { foo: { a: { c: number }, b: string } }
|
|
27
|
-
* type Baz = DeepRequired<Bar, ['a', 'c']>; // { foo: { a: { c?: number }, b: string } }
|
|
28
|
-
* type Baz = DeepRequired<Bar, ['a'] | ['b']>; // { foo: { a: { c?: number }, b?: string } }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export
|
|
32
|
-
[K in Exclude<keyof T, P[0]>]: NonNullable<DeepRequired<T[K], ShiftUnion<K, P>>>;
|
|
33
|
-
}> : T;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A type that extends `Required` that in addition to making fields
|
|
38
|
-
* not undefined, also makes them not nullable.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```
|
|
42
|
-
* type Foo = { a?: number | null };
|
|
43
|
-
* type Bar = RequiredAndNonNullable<Bar>; // { a: number }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export
|
|
47
|
-
[P in keyof T]: NonNullable<T[P]>;
|
|
48
|
-
}>;
|
|
49
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* This file is only for mapped TypeScript types. It should NOT include
|
|
3
|
+
* constants classes or methods.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A type that recursively makes each property of `T` optional.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* type Foo = { a: number };
|
|
11
|
+
* type Bar = { foo: Foo };
|
|
12
|
+
* type Baz = DeepPartial<Bar>; // { foo?: { a?: number } }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type DeepPartial<T> = T extends Record<string, unknown> ? {
|
|
16
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
17
|
+
} : T;
|
|
18
|
+
/**
|
|
19
|
+
* A type that recursively makes each property of `T` required.
|
|
20
|
+
* Optionally excluding a nested path specified by a list of keys.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* type Foo = { a?: { c?: number }, b?: string };
|
|
25
|
+
* type Bar = { foo: Foo };
|
|
26
|
+
* type Baz = DeepRequired<Bar, []>; // { foo: { a: { c: number }, b: string } }
|
|
27
|
+
* type Baz = DeepRequired<Bar, ['a', 'c']>; // { foo: { a: { c?: number }, b: string } }
|
|
28
|
+
* type Baz = DeepRequired<Bar, ['a'] | ['b']>; // { foo: { a: { c?: number }, b?: string } }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type DeepRequired<T, P extends string[]> = T extends unknown[] ? T : T extends Record<string, unknown> ? Pick<T, Extract<keyof T, P[0]>> & Required<{
|
|
32
|
+
[K in Exclude<keyof T, P[0]>]: NonNullable<DeepRequired<T[K], ShiftUnion<K, P>>>;
|
|
33
|
+
}> : T;
|
|
34
|
+
type Shift<T extends unknown[]> = ((...t: T) => unknown) extends (first: unknown, ...rest: infer Rest) => unknown ? Rest : never;
|
|
35
|
+
type ShiftUnion<P extends PropertyKey, T extends unknown[]> = T extends unknown[] ? (T[0] extends P ? Shift<T> : never) : never;
|
|
36
|
+
/**
|
|
37
|
+
* A type that extends `Required` that in addition to making fields
|
|
38
|
+
* not undefined, also makes them not nullable.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```
|
|
42
|
+
* type Foo = { a?: number | null };
|
|
43
|
+
* type Bar = RequiredAndNonNullable<Bar>; // { a: number }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export type RequiredAndNonNullable<T> = Required<{
|
|
47
|
+
[P in keyof T]: NonNullable<T[P]>;
|
|
48
|
+
}>;
|
|
49
|
+
export {};
|