semantic-typescript 0.7.0 → 0.8.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/semantic.d.ts +4 -0
- package/dist/asynchronous/semantic.js +3 -0
- package/dist/factory.d.ts +24 -71
- package/dist/factory.js +161 -648
- package/dist/guard.d.ts +0 -3
- package/dist/guard.js +0 -19
- package/dist/hash.js +3 -0
- package/dist/synchronous/semantic.d.ts +4 -0
- package/dist/synchronous/semantic.js +26 -7
- package/package.json +2 -2
- package/readme.cn.md +185 -131
- package/readme.de.md +186 -132
- package/readme.es.md +186 -132
- package/readme.fr.md +188 -134
- package/readme.jp.md +185 -140
- package/readme.kr.md +184 -139
- package/readme.md +187 -130
- package/readme.ru.md +186 -143
- package/readme.tw.md +190 -146
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -6
|
@@ -24,10 +24,14 @@ export declare class AsynchronousSemantic<E> {
|
|
|
24
24
|
flatMap<R>(mapper: BiFunctional<E, bigint, AsynchronousSemantic<R>>): AsynchronousSemantic<R>;
|
|
25
25
|
limit(count: number): AsynchronousSemantic<E>;
|
|
26
26
|
limit(count: bigint): AsynchronousSemantic<E>;
|
|
27
|
+
map(mapper: Functional<E, E>): AsynchronousSemantic<E>;
|
|
28
|
+
map(mapper: BiFunctional<E, bigint, E>): AsynchronousSemantic<E>;
|
|
27
29
|
map<R>(mapper: Functional<E, R>): AsynchronousSemantic<R>;
|
|
28
30
|
map<R>(mapper: BiFunctional<E, bigint, R>): AsynchronousSemantic<R>;
|
|
29
31
|
peek(consumer: Consumer<E>): AsynchronousSemantic<E>;
|
|
30
32
|
peek(consumer: BiConsumer<E, bigint>): AsynchronousSemantic<E>;
|
|
33
|
+
pipe(conversion: Functional<AsynchronousGenerator<E>, AsynchronousSemantic<E>>): AsynchronousSemantic<E>;
|
|
34
|
+
pipe<R>(conversion: Functional<AsynchronousGenerator<E>, AsynchronousSemantic<R>>): AsynchronousSemantic<R>;
|
|
31
35
|
redirect(redirector: BiFunctional<E, bigint, bigint>): AsynchronousSemantic<E>;
|
|
32
36
|
reverse(): AsynchronousSemantic<E>;
|
|
33
37
|
shuffle(): AsynchronousSemantic<E>;
|
|
@@ -285,6 +285,9 @@ export class AsynchronousSemantic {
|
|
|
285
285
|
}
|
|
286
286
|
throw new TypeError("Invalid arguments.");
|
|
287
287
|
}
|
|
288
|
+
pipe(conversion) {
|
|
289
|
+
return conversion(this.source());
|
|
290
|
+
}
|
|
288
291
|
redirect(redirector) {
|
|
289
292
|
if (isFunction(redirector)) {
|
|
290
293
|
return new AsynchronousSemantic(async (accept, interrupt) => {
|
package/dist/factory.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { AsynchronousSemantic } from "./asynchronous/semantic";
|
|
2
|
-
import { Optional } from "./optional";
|
|
3
2
|
import { SynchronousSemantic } from "./synchronous/semantic";
|
|
4
|
-
import type { BiPredicate, Predicate, Supplier,
|
|
5
|
-
interface UseAnimationFrame {
|
|
6
|
-
(period: number): SynchronousSemantic<number>;
|
|
7
|
-
(period: number, delay: number): SynchronousSemantic<number>;
|
|
8
|
-
}
|
|
9
|
-
export declare let useAnimationFrame: UseAnimationFrame;
|
|
3
|
+
import type { BiPredicate, Predicate, Supplier, Consumer } from "./utility";
|
|
10
4
|
interface Attribute<T> {
|
|
11
5
|
key: keyof T;
|
|
12
6
|
value: T[keyof T];
|
|
@@ -17,42 +11,6 @@ interface UseBlob {
|
|
|
17
11
|
(blob: Blob, chunk: bigint): SynchronousSemantic<Uint8Array>;
|
|
18
12
|
}
|
|
19
13
|
export declare let useBlob: UseBlob;
|
|
20
|
-
interface UseDocument {
|
|
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>;
|
|
23
|
-
}
|
|
24
|
-
export declare let useDocument: UseDocument;
|
|
25
|
-
interface UseHTMLElementOptions {
|
|
26
|
-
throttle?: number;
|
|
27
|
-
debounce?: number;
|
|
28
|
-
}
|
|
29
|
-
interface UseHTMLElement {
|
|
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>;
|
|
54
|
-
}
|
|
55
|
-
export declare let useHTMLElement: UseHTMLElement;
|
|
56
14
|
export declare let useEmpty: <E>() => SynchronousSemantic<E>;
|
|
57
15
|
interface UseFill {
|
|
58
16
|
<E>(element: E, count: bigint): SynchronousSemantic<E>;
|
|
@@ -74,8 +32,28 @@ interface UseInterval {
|
|
|
74
32
|
(period: number, delay: number): SynchronousSemantic<number>;
|
|
75
33
|
}
|
|
76
34
|
export declare let useInterval: UseInterval;
|
|
77
|
-
|
|
78
|
-
|
|
35
|
+
interface UseIterate {
|
|
36
|
+
<E>(iterable: Iterable<E>): SynchronousSemantic<E>;
|
|
37
|
+
<E>(iterable: AsyncIterable<E>): AsynchronousSemantic<E>;
|
|
38
|
+
}
|
|
39
|
+
export declare let useIterate: UseIterate;
|
|
40
|
+
interface UsePromise {
|
|
41
|
+
<T>(promise: Promise<T>): AsynchronousSemantic<T>;
|
|
42
|
+
}
|
|
43
|
+
export declare let usePromise: UsePromise;
|
|
44
|
+
export type KeyOfEventMap<EventMap> = keyof EventMap;
|
|
45
|
+
export type EventOfEventMap<EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>> = EventMap[K];
|
|
46
|
+
export interface Subscriber<T, EventMap> {
|
|
47
|
+
mount(target: T): void;
|
|
48
|
+
subscribe<K extends KeyOfEventMap<EventMap>>(key: K, accept: Consumer<EventOfEventMap<EventMap, K>>): void;
|
|
49
|
+
unsubscribe<K extends KeyOfEventMap<EventMap>>(key: K, accept: Consumer<EventOfEventMap<EventMap, K>>): void;
|
|
50
|
+
unmount(): void;
|
|
51
|
+
}
|
|
52
|
+
interface UseSubscription {
|
|
53
|
+
<T, EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>>(target: T, subscriber: Supplier<Subscriber<T, EventMap>>, subscription: K): AsynchronousSemantic<EventOfEventMap<EventMap, K>>;
|
|
54
|
+
<T, EventMap, K extends KeyOfEventMap<EventMap> = KeyOfEventMap<EventMap>>(target: T, subscriber: Supplier<Subscriber<T, EventMap>>, subscription: Iterable<K>): AsynchronousSemantic<EventOfEventMap<EventMap, K>>;
|
|
55
|
+
}
|
|
56
|
+
export declare let useSubscription: UseSubscription;
|
|
79
57
|
interface UseOf {
|
|
80
58
|
<E>(target: E): SynchronousSemantic<E>;
|
|
81
59
|
<E>(target: Iterable<E>): SynchronousSemantic<E>;
|
|
@@ -88,36 +66,11 @@ interface UseRange {
|
|
|
88
66
|
export declare let useRange: UseRange;
|
|
89
67
|
interface UseText {
|
|
90
68
|
(text: string): SynchronousSemantic<string>;
|
|
69
|
+
(text: string, delimeter: string): SynchronousSemantic<string>;
|
|
91
70
|
(text: string, start: number): SynchronousSemantic<string>;
|
|
92
71
|
(text: string, start: number, end: number): SynchronousSemantic<string>;
|
|
93
72
|
(text: string, start: bigint): SynchronousSemantic<string>;
|
|
94
73
|
(text: string, start: bigint, end: bigint): SynchronousSemantic<string>;
|
|
95
74
|
}
|
|
96
75
|
export declare let useText: UseText;
|
|
97
|
-
interface UseWebSocketOptions {
|
|
98
|
-
throttle?: number;
|
|
99
|
-
debounce?: number;
|
|
100
|
-
}
|
|
101
|
-
interface UseWebSocket {
|
|
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>;
|
|
108
|
-
}
|
|
109
|
-
export declare let useWebSocket: UseWebSocket;
|
|
110
|
-
interface UseWindowOptions {
|
|
111
|
-
throttle?: number;
|
|
112
|
-
debounce?: number;
|
|
113
|
-
}
|
|
114
|
-
interface UseWindow {
|
|
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>;
|
|
119
|
-
}
|
|
120
|
-
export declare let useWindow: UseWindow;
|
|
121
|
-
export declare let useNullable: <T>(target: MaybeInvalid<T>) => Optional<T>;
|
|
122
|
-
export declare let useNonNull: <T>(target: T) => Optional<T>;
|
|
123
76
|
export {};
|