semantic-typescript 0.5.3 → 0.7.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/asynchronous/collector.d.ts +235 -0
- package/dist/asynchronous/collector.js +811 -0
- package/dist/asynchronous/semantic.d.ts +257 -0
- package/dist/asynchronous/semantic.js +1863 -0
- package/dist/factory.d.ts +79 -37
- package/dist/factory.js +534 -277
- package/dist/guard.d.ts +24 -14
- package/dist/guard.js +73 -19
- package/dist/hook.d.ts +11 -6
- package/dist/hook.js +22 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/main.js +6 -4
- package/dist/optional.d.ts +2 -2
- package/dist/symbol.d.ts +19 -10
- package/dist/symbol.js +19 -10
- package/dist/synchronous/collector.d.ts +236 -0
- package/dist/{collector.js → synchronous/collector.js} +217 -193
- package/dist/{semantic.d.ts → synchronous/semantic.d.ts} +125 -130
- package/dist/{semantic.js → synchronous/semantic.js} +465 -574
- package/dist/utility.d.ts +7 -1
- package/dist/utility.js +1 -0
- package/package.json +3 -2
- package/readme.cn.md +213 -753
- package/readme.de.md +171 -441
- package/readme.es.md +171 -436
- package/readme.fr.md +170 -443
- package/readme.jp.md +177 -439
- package/readme.kr.md +177 -433
- package/readme.md +213 -1066
- package/readme.ru.md +174 -420
- package/readme.tw.md +175 -441
- package/dist/collector.d.ts +0 -236
- package/dist/map.d.ts +0 -76
- package/dist/map.js +0 -245
- package/dist/node.d.ts +0 -182
- package/dist/node.js +0 -918
- package/dist/set.d.ts +0 -19
- package/dist/set.js +0 -65
- package/dist/tree.d.ts +0 -82
- package/dist/tree.js +0 -257
package/dist/factory.d.ts
CHANGED
|
@@ -1,79 +1,121 @@
|
|
|
1
|
+
import { AsynchronousSemantic } from "./asynchronous/semantic";
|
|
1
2
|
import { Optional } from "./optional";
|
|
2
|
-
import {
|
|
3
|
-
import type { BiPredicate, Predicate, Supplier,
|
|
3
|
+
import { SynchronousSemantic } from "./synchronous/semantic";
|
|
4
|
+
import type { BiPredicate, Predicate, Supplier, MaybeInvalid, SynchronousGenerator } from "./utility";
|
|
4
5
|
interface UseAnimationFrame {
|
|
5
|
-
(period: number):
|
|
6
|
-
(period: number, delay: number):
|
|
6
|
+
(period: number): SynchronousSemantic<number>;
|
|
7
|
+
(period: number, delay: number): SynchronousSemantic<number>;
|
|
7
8
|
}
|
|
8
9
|
export declare let useAnimationFrame: UseAnimationFrame;
|
|
9
10
|
interface Attribute<T> {
|
|
10
11
|
key: keyof T;
|
|
11
12
|
value: T[keyof T];
|
|
12
13
|
}
|
|
13
|
-
export declare let useAttribute: <T extends object>(target: T) =>
|
|
14
|
+
export declare let useAttribute: <T extends object>(target: T) => SynchronousSemantic<Attribute<T>>;
|
|
14
15
|
interface UseBlob {
|
|
15
|
-
(blob: Blob):
|
|
16
|
-
(blob: Blob, chunk: bigint):
|
|
16
|
+
(blob: Blob): SynchronousSemantic<Uint8Array>;
|
|
17
|
+
(blob: Blob, chunk: bigint): SynchronousSemantic<Uint8Array>;
|
|
17
18
|
}
|
|
18
19
|
export declare let useBlob: UseBlob;
|
|
19
20
|
interface UseDocument {
|
|
20
|
-
<K extends keyof DocumentEventMap>(key: K):
|
|
21
|
-
<K extends keyof DocumentEventMap>(key: Iterable<K>):
|
|
21
|
+
<K extends keyof DocumentEventMap, V extends DocumentEventMap[K]>(key: K): AsynchronousSemantic<V>;
|
|
22
|
+
<K extends keyof DocumentEventMap, V extends DocumentEventMap[K]>(key: Iterable<K>): AsynchronousSemantic<V>;
|
|
22
23
|
}
|
|
23
24
|
export declare let useDocument: UseDocument;
|
|
25
|
+
interface UseHTMLElementOptions {
|
|
26
|
+
throttle?: number;
|
|
27
|
+
debounce?: number;
|
|
28
|
+
}
|
|
24
29
|
interface UseHTMLElement {
|
|
25
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap>(element: E, key: K):
|
|
26
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap>(element: E,
|
|
27
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap>(
|
|
28
|
-
<E extends HTMLElement, K extends keyof HTMLElementEventMap>(
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
30
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, key: K): AsynchronousSemantic<V>;
|
|
31
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
32
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
33
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(element: E, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
34
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, key: K): AsynchronousSemantic<V>;
|
|
35
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
36
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
37
|
+
<E extends HTMLElement, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(elements: Iterable<E>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
38
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, key: K): AsynchronousSemantic<V>;
|
|
39
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
40
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, key: K): AsynchronousSemantic<V>;
|
|
41
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
42
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
43
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: string, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
44
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
45
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selector: S, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
46
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, key: K): AsynchronousSemantic<V>;
|
|
47
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
48
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, key: K): AsynchronousSemantic<V>;
|
|
49
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, key: K, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
50
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
51
|
+
<K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<string>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
52
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
53
|
+
<S extends keyof HTMLElementTagNameMap, K extends keyof HTMLElementEventMap, V extends HTMLElementEventMap[K]>(selectors: Iterable<S>, keys: Iterable<K>, options: UseHTMLElementOptions): AsynchronousSemantic<V>;
|
|
33
54
|
}
|
|
34
55
|
export declare let useHTMLElement: UseHTMLElement;
|
|
35
|
-
export declare let useEmpty: <E>() =>
|
|
56
|
+
export declare let useEmpty: <E>() => SynchronousSemantic<E>;
|
|
36
57
|
interface UseFill {
|
|
37
|
-
<E>(element: E, count: bigint):
|
|
38
|
-
<E>(supplier: Supplier<E>, count: bigint):
|
|
58
|
+
<E>(element: E, count: bigint): SynchronousSemantic<E>;
|
|
59
|
+
<E>(supplier: Supplier<E>, count: bigint): SynchronousSemantic<E>;
|
|
39
60
|
}
|
|
40
61
|
export declare let useFill: UseFill;
|
|
41
62
|
export interface UseFrom {
|
|
42
|
-
<E>(iterable: Iterable<E>):
|
|
43
|
-
<E>(iterable: AsyncIterable<E>):
|
|
63
|
+
<E>(iterable: Iterable<E>): SynchronousSemantic<E>;
|
|
64
|
+
<E>(iterable: AsyncIterable<E>): SynchronousSemantic<E>;
|
|
44
65
|
}
|
|
45
66
|
export declare let useFrom: UseFrom;
|
|
46
67
|
interface UseGenerate {
|
|
47
|
-
<E>(supplier: Supplier<E>, interrupt: Predicate<E>):
|
|
48
|
-
<E>(supplier: Supplier<E>, interrupt: BiPredicate<E, bigint>):
|
|
68
|
+
<E>(supplier: Supplier<E>, interrupt: Predicate<E>): SynchronousSemantic<E>;
|
|
69
|
+
<E>(supplier: Supplier<E>, interrupt: BiPredicate<E, bigint>): SynchronousSemantic<E>;
|
|
49
70
|
}
|
|
50
71
|
export declare let useGenerate: UseGenerate;
|
|
51
72
|
interface UseInterval {
|
|
52
|
-
(period: number):
|
|
53
|
-
(period: number, delay: number):
|
|
73
|
+
(period: number): SynchronousSemantic<number>;
|
|
74
|
+
(period: number, delay: number): SynchronousSemantic<number>;
|
|
54
75
|
}
|
|
55
76
|
export declare let useInterval: UseInterval;
|
|
56
|
-
export declare let useIterate: <E>(generator:
|
|
57
|
-
export declare let usePromise: (<T>(promise: Promise<T>) =>
|
|
77
|
+
export declare let useIterate: <E>(generator: SynchronousGenerator<E>) => SynchronousSemantic<E>;
|
|
78
|
+
export declare let usePromise: (<T>(promise: Promise<T>) => SynchronousSemantic<T>);
|
|
58
79
|
interface UseOf {
|
|
59
|
-
<E>(target: E):
|
|
60
|
-
<E>(target: Iterable<E>):
|
|
80
|
+
<E>(target: E): SynchronousSemantic<E>;
|
|
81
|
+
<E>(target: Iterable<E>): SynchronousSemantic<E>;
|
|
61
82
|
}
|
|
62
83
|
export declare let useOf: UseOf;
|
|
63
84
|
interface UseRange {
|
|
64
|
-
<N extends number | bigint>(start: N, end: N):
|
|
65
|
-
<N extends number | bigint>(start: N, end: N, step: N):
|
|
85
|
+
<N extends number | bigint>(start: N, end: N): SynchronousSemantic<N extends number ? number : (N extends bigint ? bigint : never)>;
|
|
86
|
+
<N extends number | bigint>(start: N, end: N, step: N): SynchronousSemantic<N extends number ? number : (N extends bigint ? bigint : never)>;
|
|
66
87
|
}
|
|
67
88
|
export declare let useRange: UseRange;
|
|
89
|
+
interface UseText {
|
|
90
|
+
(text: string): SynchronousSemantic<string>;
|
|
91
|
+
(text: string, start: number): SynchronousSemantic<string>;
|
|
92
|
+
(text: string, start: number, end: number): SynchronousSemantic<string>;
|
|
93
|
+
(text: string, start: bigint): SynchronousSemantic<string>;
|
|
94
|
+
(text: string, start: bigint, end: bigint): SynchronousSemantic<string>;
|
|
95
|
+
}
|
|
96
|
+
export declare let useText: UseText;
|
|
97
|
+
interface UseWebSocketOptions {
|
|
98
|
+
throttle?: number;
|
|
99
|
+
debounce?: number;
|
|
100
|
+
}
|
|
68
101
|
interface UseWebSocket {
|
|
69
|
-
(websocket: WebSocket):
|
|
70
|
-
|
|
71
|
-
<K extends keyof WebSocketEventMap>(websocket: WebSocket,
|
|
102
|
+
(websocket: WebSocket): AsynchronousSemantic<WebSocketEventMap[keyof WebSocketEventMap]>;
|
|
103
|
+
(websocket: WebSocket, options: UseWebSocketOptions): AsynchronousSemantic<WebSocketEventMap[keyof WebSocketEventMap]>;
|
|
104
|
+
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, key: K): AsynchronousSemantic<V>;
|
|
105
|
+
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, key: K, options: UseWebSocketOptions): AsynchronousSemantic<V>;
|
|
106
|
+
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
107
|
+
<K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>, options: UseWebSocketOptions): AsynchronousSemantic<V>;
|
|
72
108
|
}
|
|
73
109
|
export declare let useWebSocket: UseWebSocket;
|
|
110
|
+
interface UseWindowOptions {
|
|
111
|
+
throttle?: number;
|
|
112
|
+
debounce?: number;
|
|
113
|
+
}
|
|
74
114
|
interface UseWindow {
|
|
75
|
-
<K extends keyof WindowEventMap>(key: K):
|
|
76
|
-
<K extends keyof WindowEventMap>(key:
|
|
115
|
+
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K): AsynchronousSemantic<V>;
|
|
116
|
+
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K, options: UseWindowOptions): AsynchronousSemantic<V>;
|
|
117
|
+
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>): AsynchronousSemantic<V>;
|
|
118
|
+
<K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>, options: UseWindowOptions): AsynchronousSemantic<V>;
|
|
77
119
|
}
|
|
78
120
|
export declare let useWindow: UseWindow;
|
|
79
121
|
export declare let useNullable: <T>(target: MaybeInvalid<T>) => Optional<T>;
|