semantic-typescript 0.5.0 → 0.6.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.
Files changed (47) hide show
  1. package/dist/asynchronous/collector.d.ts +231 -0
  2. package/dist/asynchronous/collector.js +800 -0
  3. package/dist/asynchronous/semantic.d.ts +257 -0
  4. package/dist/asynchronous/semantic.js +1853 -0
  5. package/dist/factory.d.ts +110 -32
  6. package/dist/factory.js +582 -189
  7. package/dist/guard.d.ts +24 -27
  8. package/dist/guard.js +37 -43
  9. package/dist/hook.d.ts +11 -7
  10. package/dist/hook.js +74 -21
  11. package/dist/index.d.ts +2 -3
  12. package/dist/index.js +2 -3
  13. package/dist/optional.d.ts +5 -5
  14. package/dist/optional.js +14 -10
  15. package/dist/symbol.d.ts +19 -23
  16. package/dist/symbol.js +19 -23
  17. package/dist/synchronous/collector.d.ts +232 -0
  18. package/dist/{collector.js → synchronous/collector.js} +160 -170
  19. package/dist/{collectable.d.ts → synchronous/semantic.d.ts} +114 -71
  20. package/dist/{collectable.js → synchronous/semantic.js} +761 -294
  21. package/dist/utility.d.ts +8 -2
  22. package/dist/utility.js +1 -0
  23. package/package.json +1 -1
  24. package/readme.cn.md +158 -697
  25. package/readme.de.md +163 -432
  26. package/readme.es.md +163 -433
  27. package/readme.fr.md +162 -444
  28. package/readme.jp.md +162 -442
  29. package/readme.kr.md +161 -430
  30. package/readme.md +157 -799
  31. package/readme.ru.md +161 -426
  32. package/readme.tw.md +161 -436
  33. package/dist/collector.d.ts +0 -245
  34. package/dist/map.d.ts +0 -76
  35. package/dist/map.js +0 -253
  36. package/dist/node.d.ts +0 -182
  37. package/dist/node.js +0 -918
  38. package/dist/semantic.d.ts +0 -52
  39. package/dist/semantic.js +0 -504
  40. package/dist/set.d.ts +0 -19
  41. package/dist/set.js +0 -65
  42. package/dist/statistics.d.ts +0 -97
  43. package/dist/statistics.js +0 -483
  44. package/dist/tree.d.ts +0 -82
  45. package/dist/tree.js +0 -257
  46. package/dist/window.d.ts +0 -12
  47. package/dist/window.js +0 -72
package/dist/factory.d.ts CHANGED
@@ -1,37 +1,115 @@
1
- import { Semantic } from "./semantic";
2
- import type { BiFunctional, BiPredicate, Functional, Predicate, Supplier, TriFunctional, Generator } from "./utility";
3
- export declare let animationFrame: Functional<number, Semantic<number>> & BiFunctional<number, number, Semantic<number>>;
1
+ import { AsynchronousSemantic } from "./asynchronous/semantic";
2
+ import { Optional } from "./optional";
3
+ import { SynchronousSemantic } from "./synchronous/semantic";
4
+ import type { BiPredicate, Predicate, Supplier, MaybeInvalid, SynchronousGenerator } from "./utility";
5
+ interface UseAnimationFrame {
6
+ (period: number): SynchronousSemantic<number>;
7
+ (period: number, delay: number): SynchronousSemantic<number>;
8
+ }
9
+ export declare let useAnimationFrame: UseAnimationFrame;
4
10
  interface Attribute<T> {
5
11
  key: keyof T;
6
12
  value: T[keyof T];
7
13
  }
8
- export declare let attribute: <T extends object>(target: T) => Semantic<Attribute<T>>;
9
- export declare let blob: Functional<Blob, Semantic<Uint8Array>> & BiFunctional<Blob, bigint, Semantic<Uint8Array>>;
10
- export declare let empty: <E>() => Semantic<E>;
11
- type KeyOfEventMap<T extends Window | Document | HTMLElement> = T extends Window ? keyof WindowEventMap : (T extends Document ? keyof DocumentEventMap : (T extends HTMLElement ? keyof HTMLElementEventMap : never));
12
- type ValueOfEventMap<T extends Window | Document | HTMLElement, K extends KeyOfEventMap<T>> = T extends Window ? (K extends keyof WindowEventMap ? WindowEventMap[K] : never) : (T extends Document ? (K extends keyof DocumentEventMap ? DocumentEventMap[K] : never) : (T extends HTMLElement ? (K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : never) : never));
13
- interface EventFunction {
14
- <E extends Window, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: K): Semantic<V>;
15
- <E extends Window, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: Iterable<K>): Semantic<V>;
16
- <E extends Document, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: K): Semantic<V>;
17
- <E extends Document, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: Iterable<K>): Semantic<V>;
18
- <E extends Document, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: Iterable<K>): Semantic<V>;
19
- <E extends HTMLElement, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: K): Semantic<V>;
20
- <E extends HTMLElement, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: E, key: Iterable<K>): Semantic<V>;
21
- <E extends HTMLElement, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: Iterable<E>, key: K): Semantic<V>;
22
- <E extends HTMLElement, K extends KeyOfEventMap<E>, V = ValueOfEventMap<E, K>>(target: Iterable<E>, key: Iterable<K>): Semantic<V>;
23
- }
24
- export declare let event: EventFunction;
25
- export declare let fill: (<E>(element: E, count: bigint) => Semantic<E>) & (<E>(supplier: Supplier<E>, count: bigint) => Semantic<E>);
26
- export interface From {
27
- <E>(iterable: Iterable<E>): Semantic<E>;
28
- <E>(iterable: AsyncIterable<E>): Semantic<E>;
29
- }
30
- export declare let from: From;
31
- export declare let generate: (<E>(supplier: Supplier<E>, interrupt: Predicate<E>) => Semantic<E>) & (<E>(supplier: Supplier<E>, interrupt: BiPredicate<E, bigint>) => Semantic<E>);
32
- export declare let interval: Functional<number, Semantic<number>> & BiFunctional<number, number, Semantic<number>>;
33
- export declare let iterate: <E>(generator: Generator<E>) => Semantic<E>;
34
- export declare let promise: (<T>(promise: Promise<T>) => Semantic<T>);
35
- export declare let range: BiFunctional<number, number, Semantic<number>> & TriFunctional<number, number, number, Semantic<number>>;
36
- export declare let websocket: Functional<WebSocket, Semantic<MessageEvent | CloseEvent | Event>>;
14
+ export declare let useAttribute: <T extends object>(target: T) => SynchronousSemantic<Attribute<T>>;
15
+ interface UseBlob {
16
+ (blob: Blob): SynchronousSemantic<Uint8Array>;
17
+ (blob: Blob, chunk: bigint): SynchronousSemantic<Uint8Array>;
18
+ }
19
+ 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
+ export declare let useEmpty: <E>() => SynchronousSemantic<E>;
57
+ interface UseFill {
58
+ <E>(element: E, count: bigint): SynchronousSemantic<E>;
59
+ <E>(supplier: Supplier<E>, count: bigint): SynchronousSemantic<E>;
60
+ }
61
+ export declare let useFill: UseFill;
62
+ export interface UseFrom {
63
+ <E>(iterable: Iterable<E>): SynchronousSemantic<E>;
64
+ <E>(iterable: AsyncIterable<E>): SynchronousSemantic<E>;
65
+ }
66
+ export declare let useFrom: UseFrom;
67
+ interface UseGenerate {
68
+ <E>(supplier: Supplier<E>, interrupt: Predicate<E>): SynchronousSemantic<E>;
69
+ <E>(supplier: Supplier<E>, interrupt: BiPredicate<E, bigint>): SynchronousSemantic<E>;
70
+ }
71
+ export declare let useGenerate: UseGenerate;
72
+ interface UseInterval {
73
+ (period: number): SynchronousSemantic<number>;
74
+ (period: number, delay: number): SynchronousSemantic<number>;
75
+ }
76
+ export declare let useInterval: UseInterval;
77
+ export declare let useIterate: <E>(generator: SynchronousGenerator<E>) => SynchronousSemantic<E>;
78
+ export declare let usePromise: (<T>(promise: Promise<T>) => SynchronousSemantic<T>);
79
+ interface UseOf {
80
+ <E>(target: E): SynchronousSemantic<E>;
81
+ <E>(target: Iterable<E>): SynchronousSemantic<E>;
82
+ }
83
+ export declare let useOf: UseOf;
84
+ interface UseRange {
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)>;
87
+ }
88
+ export declare let useRange: UseRange;
89
+ interface UseWebSocketOptions {
90
+ throttle?: number;
91
+ debounce?: number;
92
+ }
93
+ interface UseWebSocket {
94
+ (websocket: WebSocket): AsynchronousSemantic<WebSocketEventMap[keyof WebSocketEventMap]>;
95
+ (websocket: WebSocket, options: UseWebSocketOptions): AsynchronousSemantic<WebSocketEventMap[keyof WebSocketEventMap]>;
96
+ <K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, key: K): AsynchronousSemantic<V>;
97
+ <K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, key: K, options: UseWebSocketOptions): AsynchronousSemantic<V>;
98
+ <K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>): AsynchronousSemantic<V>;
99
+ <K extends keyof WebSocketEventMap, V extends WebSocketEventMap[K]>(websocket: WebSocket, keys: Iterable<K>, options: UseWebSocketOptions): AsynchronousSemantic<V>;
100
+ }
101
+ export declare let useWebSocket: UseWebSocket;
102
+ interface UseWindowOptions {
103
+ throttle?: number;
104
+ debounce?: number;
105
+ }
106
+ interface UseWindow {
107
+ <K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K): AsynchronousSemantic<V>;
108
+ <K extends keyof WindowEventMap, V extends WindowEventMap[K]>(key: K, options: UseWindowOptions): AsynchronousSemantic<V>;
109
+ <K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>): AsynchronousSemantic<V>;
110
+ <K extends keyof WindowEventMap, V extends WindowEventMap[K]>(keys: Iterable<K>, options: UseWindowOptions): AsynchronousSemantic<V>;
111
+ }
112
+ export declare let useWindow: UseWindow;
113
+ export declare let useNullable: <T>(target: MaybeInvalid<T>) => Optional<T>;
114
+ export declare let useNonNull: <T>(target: T) => Optional<T>;
37
115
  export {};