@ersbeth/picoflow 0.0.1 → 0.2.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/api/doc/index.md +1 -1
- package/api/doc/picoflow.array.md +55 -0
- package/api/doc/picoflow.constant.md +55 -0
- package/api/doc/picoflow.derivation.md +1 -1
- package/api/doc/picoflow.effect.md +1 -1
- package/api/doc/picoflow.flowarray._constructor_.md +49 -0
- package/api/doc/picoflow.flowarray._lastaction.md +13 -0
- package/api/doc/picoflow.flowarray.clear.md +17 -0
- package/api/doc/picoflow.flowarray.dispose.md +55 -0
- package/api/doc/picoflow.flowarray.get.md +19 -0
- package/api/doc/picoflow.flowarray.length.md +13 -0
- package/api/doc/picoflow.flowarray.md +273 -0
- package/api/doc/picoflow.flowarray.pop.md +17 -0
- package/api/doc/picoflow.flowarray.push.md +53 -0
- package/api/doc/picoflow.flowarray.set.md +53 -0
- package/api/doc/picoflow.flowarray.setitem.md +69 -0
- package/api/doc/picoflow.flowarray.shift.md +17 -0
- package/api/doc/picoflow.flowarray.splice.md +85 -0
- package/api/doc/picoflow.flowarray.unshift.md +53 -0
- package/api/doc/picoflow.flowarrayaction.md +37 -0
- package/api/doc/picoflow.flowconstant._constructor_.md +49 -0
- package/api/doc/picoflow.flowconstant.get.md +25 -0
- package/api/doc/picoflow.flowconstant.md +88 -0
- package/api/doc/picoflow.flowderivation._constructor_.md +2 -2
- package/api/doc/picoflow.flowderivation.get.md +2 -2
- package/api/doc/picoflow.flowderivation.md +2 -2
- package/api/doc/picoflow.flowdisposable.dispose.md +55 -0
- package/api/doc/picoflow.flowdisposable.md +43 -0
- package/api/doc/picoflow.floweffect._constructor_.md +7 -2
- package/api/doc/picoflow.floweffect.dispose.md +3 -3
- package/api/doc/picoflow.floweffect.disposed.md +1 -1
- package/api/doc/picoflow.floweffect.md +4 -4
- package/api/doc/picoflow.flowgetter.md +2 -2
- package/api/doc/picoflow.flowmap._lastdeleted.md +1 -1
- package/api/doc/picoflow.flowmap._lastset.md +1 -1
- package/api/doc/picoflow.flowmap.delete.md +6 -2
- package/api/doc/picoflow.flowmap.md +5 -7
- package/api/doc/picoflow.flowmap.setat.md +6 -2
- package/api/doc/picoflow.flowobservable.get.md +3 -3
- package/api/doc/picoflow.flowobservable.md +18 -4
- package/api/doc/picoflow.flowobservable.subscribe.md +55 -0
- package/api/doc/picoflow.flowresource._constructor_.md +2 -18
- package/api/doc/picoflow.flowresource.fetch.md +1 -1
- package/api/doc/picoflow.flowresource.get.md +4 -4
- package/api/doc/picoflow.flowresource.md +4 -4
- package/api/doc/picoflow.flowresourceasync._constructor_.md +49 -0
- package/api/doc/picoflow.flowresourceasync.fetch.md +27 -0
- package/api/doc/picoflow.flowresourceasync.get.md +23 -0
- package/api/doc/picoflow.flowresourceasync.md +100 -0
- package/api/doc/picoflow.flowsignal.dispose.md +42 -8
- package/api/doc/picoflow.flowsignal.disposed.md +2 -2
- package/api/doc/picoflow.flowsignal.md +8 -7
- package/api/doc/picoflow.flowsignal.trigger.md +3 -7
- package/api/doc/picoflow.flowstate.md +4 -52
- package/api/doc/picoflow.flowstate.set.md +5 -5
- package/api/doc/picoflow.flowstream._constructor_.md +3 -19
- package/api/doc/picoflow.flowstream.dispose.md +1 -1
- package/api/doc/picoflow.flowstream.get.md +4 -4
- package/api/doc/picoflow.flowstream.md +5 -5
- package/api/doc/picoflow.flowstreamasync._constructor_.md +54 -0
- package/api/doc/picoflow.flowstreamasync.dispose.md +21 -0
- package/api/doc/picoflow.flowstreamasync.get.md +23 -0
- package/api/doc/picoflow.flowstreamasync.md +100 -0
- package/api/doc/picoflow.flowstreamdisposer.md +13 -0
- package/api/doc/picoflow.flowstreamsetter.md +13 -0
- package/api/doc/picoflow.flowstreamupdater.md +19 -0
- package/api/doc/picoflow.flowwatcher.md +1 -1
- package/api/doc/picoflow.isdisposable.md +55 -0
- package/api/doc/picoflow.map.md +1 -1
- package/api/doc/picoflow.md +149 -13
- package/api/doc/picoflow.resource.md +2 -18
- package/api/doc/picoflow.resourceasync.md +55 -0
- package/api/doc/picoflow.signal.md +1 -1
- package/api/doc/picoflow.state.md +3 -3
- package/api/doc/picoflow.stream.md +2 -18
- package/api/doc/picoflow.streamasync.md +55 -0
- package/api/picoflow.public.api.md +192 -0
- package/api-extractor.json +2 -1
- package/dist/picoflow.js +513 -305
- package/dist/types/advanced/array.d.ts +116 -0
- package/dist/types/advanced/array.d.ts.map +1 -0
- package/dist/types/advanced/index.d.ts +9 -0
- package/dist/types/advanced/index.d.ts.map +1 -0
- package/dist/types/{map.d.ts → advanced/map.d.ts} +12 -12
- package/dist/types/advanced/map.d.ts.map +1 -0
- package/dist/types/advanced/resource.d.ts +39 -0
- package/dist/types/advanced/resource.d.ts.map +1 -0
- package/dist/types/{resource.d.ts → advanced/resourceAsync.d.ts} +6 -11
- package/dist/types/advanced/resourceAsync.d.ts.map +1 -0
- package/dist/types/advanced/stream.d.ts +59 -0
- package/dist/types/advanced/stream.d.ts.map +1 -0
- package/dist/types/advanced/streamAsync.d.ts +43 -0
- package/dist/types/advanced/streamAsync.d.ts.map +1 -0
- package/dist/types/basic/constant.d.ts +32 -0
- package/dist/types/basic/constant.d.ts.map +1 -0
- package/dist/types/basic/derivation.d.ts +40 -0
- package/dist/types/basic/derivation.d.ts.map +1 -0
- package/dist/types/basic/disposable.d.ts +23 -0
- package/dist/types/basic/disposable.d.ts.map +1 -0
- package/dist/types/basic/effect.d.ts +56 -0
- package/dist/types/basic/effect.d.ts.map +1 -0
- package/dist/types/basic/index.d.ts +11 -0
- package/dist/types/basic/index.d.ts.map +1 -0
- package/dist/types/basic/observable.d.ts +34 -0
- package/dist/types/basic/observable.d.ts.map +1 -0
- package/dist/types/basic/signal.d.ts +40 -0
- package/dist/types/basic/signal.d.ts.map +1 -0
- package/dist/types/basic/state.d.ts +26 -0
- package/dist/types/basic/state.d.ts.map +1 -0
- package/dist/types/creators.d.ts +38 -13
- package/dist/types/creators.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -9
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/advanced/array.ts +224 -0
- package/src/advanced/index.ts +12 -0
- package/src/{map.ts → advanced/map.ts} +14 -14
- package/src/advanced/resource.ts +56 -0
- package/src/{resource.ts → advanced/resourceAsync.ts} +9 -16
- package/src/advanced/stream.ts +87 -0
- package/src/advanced/streamAsync.ts +82 -0
- package/src/basic/constant.ts +64 -0
- package/src/basic/derivation.ts +86 -0
- package/src/basic/disposable.ts +27 -0
- package/src/basic/effect.ts +96 -0
- package/src/basic/index.ts +10 -0
- package/src/basic/observable.ts +51 -0
- package/src/basic/signal.ts +117 -0
- package/src/basic/state.ts +39 -0
- package/src/creators.ts +66 -15
- package/src/index.ts +26 -11
- package/test/array.test.ts +620 -0
- package/test/constant.test.ts +46 -0
- package/test/derivation.test.ts +30 -6
- package/test/effect.test.ts +29 -0
- package/test/map.test.ts +38 -0
- package/test/resource.test.ts +18 -16
- package/test/resourceAsync.test.ts +108 -0
- package/test/signal.test.ts +18 -1
- package/test/state.test.ts +107 -2
- package/test/stream.test.ts +38 -13
- package/test/streamAsync.test.ts +194 -0
- package/tsconfig.json +3 -1
- package/api/doc/picoflow.flowdisposer.md +0 -13
- package/api/doc/picoflow.flowsetter.md +0 -13
- package/api/doc/picoflow.flowstate._constructor_.md +0 -49
- package/api/doc/picoflow.flowstate.get.md +0 -23
- package/api/doc/picoflow.flowupdater.md +0 -19
- package/api/picoflow.api.md +0 -145
- package/dist/types/derivation.d.ts +0 -58
- package/dist/types/derivation.d.ts.map +0 -1
- package/dist/types/effect.d.ts +0 -108
- package/dist/types/effect.d.ts.map +0 -1
- package/dist/types/map.d.ts.map +0 -1
- package/dist/types/observable.d.ts +0 -40
- package/dist/types/observable.d.ts.map +0 -1
- package/dist/types/resource.d.ts.map +0 -1
- package/dist/types/signal.d.ts +0 -111
- package/dist/types/signal.d.ts.map +0 -1
- package/dist/types/state.d.ts +0 -39
- package/dist/types/state.d.ts.map +0 -1
- package/dist/types/stream.d.ts +0 -71
- package/dist/types/stream.d.ts.map +0 -1
- package/src/derivation.ts +0 -96
- package/src/effect.ts +0 -152
- package/src/observable.ts +0 -50
- package/src/signal.ts +0 -166
- package/src/state.ts +0 -52
- package/src/stream.ts +0 -99
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { FlowObservable, FlowState } from '../basic';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the actions that can be performed on a FlowArray.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export type FlowArrayAction<T> = {
|
|
7
|
+
type: "set";
|
|
8
|
+
items: T[];
|
|
9
|
+
} | {
|
|
10
|
+
type: "setItem";
|
|
11
|
+
index: number;
|
|
12
|
+
item: T;
|
|
13
|
+
} | {
|
|
14
|
+
type: "push";
|
|
15
|
+
item: T;
|
|
16
|
+
} | {
|
|
17
|
+
type: "pop";
|
|
18
|
+
} | {
|
|
19
|
+
type: "unshift";
|
|
20
|
+
item: T;
|
|
21
|
+
} | {
|
|
22
|
+
type: "shift";
|
|
23
|
+
} | {
|
|
24
|
+
type: "splice";
|
|
25
|
+
start: number;
|
|
26
|
+
deleteCount: number;
|
|
27
|
+
items: T[];
|
|
28
|
+
} | {
|
|
29
|
+
type: "clear";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Represents a reactive array.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare class FlowArray<T> extends FlowObservable<T[]> {
|
|
36
|
+
/**
|
|
37
|
+
* Last action performed on the FlowArray.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
$lastAction: FlowState<FlowArrayAction<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of FlowArray.
|
|
43
|
+
* @param value - Initial array value.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
constructor(value?: T[]);
|
|
47
|
+
/**
|
|
48
|
+
* Gets the current length of the array.
|
|
49
|
+
* @returns The length of the array.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
get length(): number;
|
|
53
|
+
/**
|
|
54
|
+
* Returns a copy of the internal array.
|
|
55
|
+
* @returns A copy of the array.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
get(): T[];
|
|
59
|
+
/**
|
|
60
|
+
* Replaces the entire array with new items.
|
|
61
|
+
* @param items - The new array of items.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
set(items: T[]): void;
|
|
65
|
+
/**
|
|
66
|
+
* Replaces an item at a specific index.
|
|
67
|
+
* @param index - The index of the item to replace.
|
|
68
|
+
* @param item - The new item.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
setItem(index: number, item: T): void;
|
|
72
|
+
/**
|
|
73
|
+
* Appends an item to the end of the array.
|
|
74
|
+
* @param item - The item to append.
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
push(item: T): void;
|
|
78
|
+
/**
|
|
79
|
+
* Removes the last item from the array.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
pop(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Inserts an item at the beginning of the array.
|
|
85
|
+
* @param item - The item to insert.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
unshift(item: T): void;
|
|
89
|
+
/**
|
|
90
|
+
* Removes the first item from the array.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
shift(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Changes the content of the array.
|
|
96
|
+
* @param start - The starting index.
|
|
97
|
+
* @param deleteCount - Number of items to remove.
|
|
98
|
+
* @param newItems - New items to add.
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
splice(start: number, deleteCount: number, ...newItems: T[]): void;
|
|
102
|
+
/**
|
|
103
|
+
* Clears all items from the array.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
clear(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Disposes the FlowArray and its items.
|
|
109
|
+
* @param options - Disposal options.
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
dispose(options?: {
|
|
113
|
+
self: boolean;
|
|
114
|
+
}): void;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/advanced/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1D;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IACvB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,CAAC,EAAE,CAAC;CACd,GACC;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACX,GACC;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;CACX,GACC;IACE,IAAI,EAAE,KAAK,CAAC;CACf,GACC;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;CACX,GACC;IACE,IAAI,EAAE,OAAO,CAAC;CACjB,GACC;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,CAAC,EAAE,CAAC;CACd,GACC;IACE,IAAI,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN;;;GAGG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,EAAE,CAAC;IACjD;;;OAGG;IACH,WAAW,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3C;;;;OAIG;gBACS,KAAK,GAAE,CAAC,EAAO;IAS3B;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,CAGnB;IAED;;;;OAIG;IACH,GAAG,IAAI,CAAC,EAAE;IAKV;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI;IAUrB;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI;IAUrC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAOnB;;;OAGG;IACH,GAAG,IAAI,IAAI;IAUX;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAOtB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAUb;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI;IAelE;;;OAGG;IACH,KAAK,IAAI,IAAI;IAWb;;;;OAIG;IACM,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAWtD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { FlowMap } from './map';
|
|
2
|
+
export { FlowStream } from './stream';
|
|
3
|
+
export { FlowStreamAsync } from './streamAsync';
|
|
4
|
+
export { FlowResource } from './resource';
|
|
5
|
+
export { FlowResourceAsync } from './resourceAsync';
|
|
6
|
+
export type { FlowStreamUpdater, FlowStreamDisposer, FlowStreamSetter, } from './stream';
|
|
7
|
+
export { FlowArray } from './array';
|
|
8
|
+
export type { FlowArrayAction } from './array';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/advanced/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EACR,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { FlowState } from '
|
|
1
|
+
import { FlowState } from '../basic/';
|
|
2
2
|
/**
|
|
3
|
-
* Represents a reactive map of states
|
|
3
|
+
* Represents a reactive map of states extending {@link FlowState} for a Map of key/value pairs.
|
|
4
4
|
*
|
|
5
5
|
* @remarks
|
|
6
6
|
* FlowMap wraps a native Map and provides reactive signals for fine-grained tracking
|
|
7
7
|
* of updates to the map. In addition to the reactive capabilities inherited from FlowState,
|
|
8
|
-
* it exposes two
|
|
8
|
+
* it exposes two reactive signals:
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* • $lastSet: Holds the most recent key-value pair that was set.
|
|
11
|
+
* • $lastDeleted: Holds the most recent key-value pair that was deleted.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Use {@link FlowMap.setAt} to set a key-value pair and {@link FlowMap.delete} to remove a key.
|
|
13
|
+
* Use {@link FlowMap.setAt} to add or update a key-value pair and {@link FlowMap.delete} to remove a key.
|
|
15
14
|
*
|
|
16
15
|
* @typeparam K - The type of the map keys.
|
|
17
16
|
* @typeparam V - The type of the map values.
|
|
@@ -50,10 +49,11 @@ export declare class FlowMap<K, V> extends FlowState<Map<K, V>> {
|
|
|
50
49
|
*
|
|
51
50
|
* @param key - The key at which to set the value.
|
|
52
51
|
* @param value - The value to set.
|
|
52
|
+
* @throws If the FlowMap instance is disposed.
|
|
53
53
|
*
|
|
54
54
|
* @remarks
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* Updates the internal map, emits the key-value pair via {@link FlowMap.$lastSet},
|
|
56
|
+
* and notifies all subscribers of the change.
|
|
57
57
|
*
|
|
58
58
|
* @public
|
|
59
59
|
*/
|
|
@@ -62,11 +62,11 @@ export declare class FlowMap<K, V> extends FlowState<Map<K, V>> {
|
|
|
62
62
|
* Deletes the value at the specified key from the underlying map.
|
|
63
63
|
*
|
|
64
64
|
* @param key - The key to delete.
|
|
65
|
+
* @throws If the FlowMap instance is disposed.
|
|
65
66
|
*
|
|
66
67
|
* @remarks
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* of the change.
|
|
68
|
+
* Removes the key from the internal map, emits the deleted key and its value via {@link FlowMap.$lastDeleted},
|
|
69
|
+
* and notifies all subscribers of the change.
|
|
70
70
|
*
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/advanced/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,OAAO,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD;;;;;;;;OAQG;IACI,QAAQ,EAAE,SAAS,CAAC;QAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,CAAA;KAAE,CAAC,CAAqB;IAEvE;;;;;;;;OAQG;IACI,YAAY,EAAE,SAAS,CAAC;QAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,CAAC,CAAA;KAAE,CAAC,CAAqB;IAE3E;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAOpC;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI;CAO9B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FlowObservable } from '../basic';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a reactive resource that asynchronously fetches its value.
|
|
4
|
+
*
|
|
5
|
+
* @remarks A FlowResource extends FlowObservable and encapsulates an asynchronous fetch function.
|
|
6
|
+
* It is used to retrieve and update its value asynchronously. When the fetch is executed,
|
|
7
|
+
* if the new value differs from the current value, the resource is updated and its subscribers
|
|
8
|
+
* are notified.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class FlowResource<T> extends FlowObservable<T | undefined> {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new FlowResource.
|
|
15
|
+
* @param fetch - An asynchronous function that retrieves the resource's value.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
constructor(fetch: () => Promise<T>);
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the current resource value.
|
|
22
|
+
* @returns The current value, or undefined if the resource has not been fetched yet.
|
|
23
|
+
* @throws Error if the resource is disposed.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
get(): T | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Asynchronously fetches a new value for the resource.
|
|
29
|
+
* @remarks
|
|
30
|
+
* Executes the internal fetch function. If the fetched value differs from the current one,
|
|
31
|
+
* updates the resource's value and notifies subscribers.
|
|
32
|
+
* @returns A Promise that resolves when the fetch operation is complete.
|
|
33
|
+
* @throws Error if the resource is disposed.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
fetch(): Promise<void>;
|
|
37
|
+
private _fetch;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/advanced/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D;;;;;OAKG;gBACS,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAKnC;;;;;OAKG;IACI,GAAG,IAAI,CAAC,GAAG,SAAS;IAK3B;;;;;;;;OAQG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAUnC,OAAO,CAAC,MAAM,CAAmB;CACpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FlowObservable } from '
|
|
1
|
+
import { FlowObservable } from '../basic/';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a reactive resource that asynchronously fetches its value.
|
|
4
4
|
*
|
|
@@ -12,21 +12,20 @@ import { FlowObservable } from './observable';
|
|
|
12
12
|
*
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class FlowResourceAsync<T> extends FlowObservable<Promise<T>> {
|
|
16
16
|
/**
|
|
17
17
|
* Creates a new FlowResource.
|
|
18
18
|
* @param fetch - An asynchronous function that retrieves the resource's value.
|
|
19
|
-
* @param initial - The initial value of the resource.
|
|
20
19
|
* @public
|
|
21
20
|
*/
|
|
22
|
-
constructor(fetch: () => Promise<T
|
|
21
|
+
constructor(fetch: () => Promise<T>);
|
|
23
22
|
/**
|
|
24
23
|
* Retrieves the current resource value.
|
|
25
|
-
* @returns The current value.
|
|
24
|
+
* @returns The current value, or undefined if the resource has not been fetched yet.
|
|
26
25
|
* @throws Error if the resource is disposed.
|
|
27
26
|
* @public
|
|
28
27
|
*/
|
|
29
|
-
get(): T
|
|
28
|
+
get(): Promise<T>;
|
|
30
29
|
/**
|
|
31
30
|
* Asynchronously fetches a new value for the resource.
|
|
32
31
|
* @remarks
|
|
@@ -37,10 +36,6 @@ export declare class FlowResource<T> extends FlowObservable<T> {
|
|
|
37
36
|
* @public
|
|
38
37
|
*/
|
|
39
38
|
fetch(): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* @internal
|
|
42
|
-
* The asynchronous function used to fetch the resource value.
|
|
43
|
-
*/
|
|
44
39
|
private _fetch;
|
|
45
40
|
}
|
|
46
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=resourceAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceAsync.d.ts","sourceRoot":"","sources":["../../../src/advanced/resourceAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChE;;;;OAIG;gBACS,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAKnC;;;;;OAKG;IACI,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAMxB;;;;;;;;OAQG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQnC,OAAO,CAAC,MAAM,CAAmB;CACpC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FlowObservable } from '../basic/';
|
|
2
|
+
/**
|
|
3
|
+
* A function type that sets a new value for the reactive stream.
|
|
4
|
+
* @typeparam T - The type of the value.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type FlowStreamSetter<T> = (value: T) => void;
|
|
8
|
+
/**
|
|
9
|
+
* A function type that disposes of a resource.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type FlowStreamDisposer = () => void;
|
|
13
|
+
/**
|
|
14
|
+
* A function type that updates a stream and returns a disposer for cleanup.
|
|
15
|
+
* @remarks
|
|
16
|
+
* The updater receives a setter function to update the stream's value.
|
|
17
|
+
* It should return a disposer function to release any resources or subscriptions.
|
|
18
|
+
* @typeparam T - The type of the stream value.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type FlowStreamUpdater<T> = (set: FlowStreamSetter<T>) => FlowStreamDisposer;
|
|
22
|
+
/**
|
|
23
|
+
* Represents a reactive stream that updates its value based on an updater function.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* FlowStream extends FlowObservable to encapsulate an update mechanism provided by an external updater function.
|
|
27
|
+
* The updater is invoked during construction with a setter, and it returns a disposer to be called upon disposal.
|
|
28
|
+
* Note: The stream's current value may be undefined until explicitly set.
|
|
29
|
+
*
|
|
30
|
+
* @typeparam T - The type of the stream's value.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare class FlowStream<T> extends FlowObservable<T | undefined> {
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new FlowStream.
|
|
36
|
+
* @param updater - A function that receives a setter to update the stream's value.
|
|
37
|
+
* It should return a disposer function that will be called upon disposal.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
constructor(updater: FlowStreamUpdater<T>);
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves the current value of the stream.
|
|
43
|
+
* @returns The current value, or undefined if no value has been set yet.
|
|
44
|
+
* @throws Error if the stream is disposed.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
get(): T | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Disposes the stream, releasing all resources.
|
|
50
|
+
* @remarks
|
|
51
|
+
* In addition to disposing the underlying observable, this method calls the disposer
|
|
52
|
+
* returned by the updater.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
dispose(): void;
|
|
56
|
+
private _disposer;
|
|
57
|
+
private _set;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/advanced/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAC/B,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,KACvB,kBAAkB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC;IAC5D;;;;;OAKG;gBACS,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAOzC;;;;;OAKG;IACI,GAAG,IAAI,CAAC,GAAG,SAAS;IAK3B;;;;;;OAMG;IACa,OAAO,IAAI,IAAI;IAO/B,OAAO,CAAC,SAAS,CAAqB;IAEtC,OAAO,CAAC,IAAI;CAOf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FlowObservable } from '../basic';
|
|
2
|
+
import { FlowStreamUpdater } from './stream';
|
|
3
|
+
/**
|
|
4
|
+
* Represents an asynchronous reactive stream that updates its value based on an updater function.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* A FlowStreamAsync extends FlowObservable and encapsulates a mechanism for asynchronously updating its value.
|
|
8
|
+
* The updater is invoked during construction with a setter, and its returned disposer is called upon disposal.
|
|
9
|
+
* Note: The stream's current value may be undefined until it is set.
|
|
10
|
+
*
|
|
11
|
+
* @typeparam T - The type of the stream's value.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare class FlowStreamAsync<T> extends FlowObservable<Promise<T>> {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new asynchronous FlowStream.
|
|
17
|
+
* @param updater - A function that receives a setter to update the stream's value.
|
|
18
|
+
* It should return a disposer function that will be called upon disposal.
|
|
19
|
+
* @remarks The updater function can invoke the setter asynchronously to update the stream.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
constructor(updater: FlowStreamUpdater<T>);
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the current value of the stream as a Promise.
|
|
25
|
+
* @returns A Promise that resolves to the current value.
|
|
26
|
+
* @throws Error if the stream is disposed.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
get(): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Disposes the stream, releasing all resources.
|
|
32
|
+
* @remarks In addition to disposing the underlying observable, this method calls the disposer
|
|
33
|
+
* returned by the updater.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
dispose(): void;
|
|
37
|
+
private _initialized;
|
|
38
|
+
private _awaitedValue?;
|
|
39
|
+
private _resolve;
|
|
40
|
+
private _disposer;
|
|
41
|
+
private _set;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=streamAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamAsync.d.ts","sourceRoot":"","sources":["../../../src/advanced/streamAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9D;;;;;;OAMG;gBACS,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAWzC;;;;;OAKG;IACI,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAKxB;;;;;OAKG;IACa,OAAO,IAAI,IAAI;IAO/B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAC,CAAI;IAE1B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,SAAS,CAAqB;IAEtC,OAAO,CAAC,IAAI;CAkBf"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FlowObservable } from './observable';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a reactive and immutable constant value computed lazily upon first access.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This class extends FlowObservable and supports initializing the constant using either a direct value
|
|
6
|
+
* or a lazy initializer function. Once computed, the value is cached for all subsequent accesses.
|
|
7
|
+
*
|
|
8
|
+
* @typeparam T - The type of the constant value.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class FlowConstant<T> extends FlowObservable<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new FlowConstant instance.
|
|
15
|
+
*
|
|
16
|
+
* @param value - Either a direct value of type T or a function returning a value of type T for lazy initialization.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
constructor(value: T | (() => T));
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the constant value, computing it lazily if needed.
|
|
22
|
+
*
|
|
23
|
+
* Accessing this method will initialize the value if it has not been computed already.
|
|
24
|
+
* Throws an error if the instance has been disposed or if lazy initialization fails.
|
|
25
|
+
*
|
|
26
|
+
* @returns The cached constant value.
|
|
27
|
+
* @throws Error if the constant is disposed or cannot be initialized.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
get(): T;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/basic/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IAClD;;;;;OAKG;gBACS,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAKhC;;;;;;;;;OASG;IACH,GAAG,IAAI,CAAC;CA6BX"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FlowGetter, FlowObservable } from './observable';
|
|
2
|
+
import { FlowWatcher } from './signal';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a reactive derivation whose value is computed based on other reactive signals.
|
|
5
|
+
* @remarks
|
|
6
|
+
* It tracks dependencies automatically and recomputes its value when any dependency changes.
|
|
7
|
+
* Use FlowDerivation to create derived values in a reactive manner. It lazily initializes the computed value,
|
|
8
|
+
* ensuring that computations only occur when necessary.
|
|
9
|
+
* @typeparam T - The type of the computed value.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class FlowDerivation<T> extends FlowObservable<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new FlowDerivation.
|
|
15
|
+
* @param compute - A function that computes the derived value. It is provided with two parameters:
|
|
16
|
+
* a getter and a watcher that respect dependency tracking.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
constructor(compute: (get: FlowGetter, watch: FlowWatcher) => T);
|
|
20
|
+
/**
|
|
21
|
+
* Gets the current derived value.
|
|
22
|
+
* @returns The current computed value.
|
|
23
|
+
* @remarks
|
|
24
|
+
* This method lazily initializes and updates the derivation if it is marked as dirty. It throws an error
|
|
25
|
+
* if the derivation has been disposed.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
get(): T;
|
|
29
|
+
private _initialized;
|
|
30
|
+
private _dirty;
|
|
31
|
+
private _trackedGet;
|
|
32
|
+
private _trackedWatch;
|
|
33
|
+
private _untrackedGet;
|
|
34
|
+
private _untrackedWatch;
|
|
35
|
+
private _trackedCompute;
|
|
36
|
+
private _untrackedCompute;
|
|
37
|
+
private _initEager;
|
|
38
|
+
private _initLazy;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../../../src/basic/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;GAQG;AACH,qBAAa,cAAc,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACpD;;;;;OAKG;gBACS,OAAO,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,KAAK,CAAC;IAK/D;;;;;;;OAOG;IACI,GAAG,IAAI,CAAC;IASf,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,WAAW,CAAyD;IAC5E,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,aAAa,CAAgD;IACrE,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,eAAe,CAAW;IAClC,OAAO,CAAC,iBAAiB,CAAW;IAEpC,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,SAAS;CAyBpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an object with a disposable lifecycle.
|
|
3
|
+
* @remarks
|
|
4
|
+
* Objects implementing this interface require explicit resource disposal.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface FlowDisposable {
|
|
8
|
+
/**
|
|
9
|
+
* Disposes resources held by this object.
|
|
10
|
+
* @param options - Options to specify disposal behavior.
|
|
11
|
+
*/
|
|
12
|
+
dispose(options?: {
|
|
13
|
+
self: boolean;
|
|
14
|
+
}): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether an object implements the FlowDisposable interface.
|
|
18
|
+
* @param obj - The object to test.
|
|
19
|
+
* @returns True if the object has a dispose method, otherwise false.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare function isDisposable(obj: unknown): obj is FlowDisposable;
|
|
23
|
+
//# sourceMappingURL=disposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../../src/basic/disposable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC3B;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc,CAMhE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FlowGetter } from './observable';
|
|
2
|
+
import { FlowWatcher } from './signal';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a reactive effect that executes side-effect functions based
|
|
5
|
+
* on its tracked dependencies.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The FlowEffect executes an apply function that performs side effects,
|
|
9
|
+
* running initially in a tracked mode to register dependencies and then in
|
|
10
|
+
* an untracked mode to re-execute the effect on updates.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare class FlowEffect {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new FlowEffect.
|
|
17
|
+
*
|
|
18
|
+
* @param apply - A side-effect function that receives a getter and a watcher to
|
|
19
|
+
* access and register dependencies on reactive observables and signals.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* The provided function is executed immediately in a tracked mode to collect dependencies.
|
|
23
|
+
* On subsequent executions, it runs in an untracked mode.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
constructor(apply: (get: FlowGetter, watch: FlowWatcher) => void);
|
|
28
|
+
/**
|
|
29
|
+
* Disposes the effect, unregistering all its tracked dependencies.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Once disposed, the effect must no longer be used. Trying to dispose an effect
|
|
33
|
+
* that is already disposed will throw an error.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
dispose(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Indicates whether this effect has been disposed.
|
|
40
|
+
*
|
|
41
|
+
* @returns A boolean value that is true if the effect is disposed, false otherwise.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
get disposed(): boolean;
|
|
46
|
+
private _disposed;
|
|
47
|
+
private _initialized;
|
|
48
|
+
private _dependencies;
|
|
49
|
+
private _trackedGet;
|
|
50
|
+
private _trackedWatch;
|
|
51
|
+
private _untrackedGet;
|
|
52
|
+
private _untrackedWatch;
|
|
53
|
+
private _trackedExec;
|
|
54
|
+
private _untrackedExec;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../../../src/basic/effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACnB;;;;;;;;;;;OAWG;gBACS,KAAK,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI;IAOhE;;;;;;;;OAQG;IACI,OAAO,IAAI,IAAI;IAQtB;;;;;;OAMG;IACH,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAID,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAyB;IAE9C,OAAO,CAAC,WAAW,CAAyD;IAC5E,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,aAAa,CAAgD;IACrE,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,cAAc,CAAa;CAsBtC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { FlowSignal } from './signal';
|
|
2
|
+
export { FlowState } from './state';
|
|
3
|
+
export { FlowObservable } from './observable';
|
|
4
|
+
export { FlowDerivation } from './derivation';
|
|
5
|
+
export { FlowEffect } from './effect';
|
|
6
|
+
export { FlowConstant } from './constant';
|
|
7
|
+
export { isDisposable } from './disposable';
|
|
8
|
+
export type { FlowGetter } from './observable';
|
|
9
|
+
export type { FlowWatcher } from './signal';
|
|
10
|
+
export type { FlowDisposable } from './disposable';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/basic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FlowSignal } from './signal';
|
|
2
|
+
/**
|
|
3
|
+
* A function that retrieves the current value from a FlowObservable.
|
|
4
|
+
* @typeparam T - The type of the value held by the observable.
|
|
5
|
+
* @param observable - The FlowObservable instance to retrieve the value from.
|
|
6
|
+
* @returns The current value of the observable.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type FlowGetter = <T>(observable: FlowObservable<T>) => T;
|
|
10
|
+
/**
|
|
11
|
+
* Represents a reactive observable that holds and tracks a value.
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* @remarks Subclasses must implement the {@link FlowObservable.get} method to return the current value.
|
|
15
|
+
* @typeparam T - The type of the value held by the observable.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class FlowObservable<T> extends FlowSignal {
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the current value stored in the observable.
|
|
21
|
+
* Subclasses must override this method to provide the current value.
|
|
22
|
+
* @returns The current value of type T.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
abstract get(): T;
|
|
26
|
+
/**
|
|
27
|
+
* Subscribes a listener function to changes of the observable.
|
|
28
|
+
* The listener is executed immediately with the current value and on subsequent updates.
|
|
29
|
+
* @param listener - A callback function that receives the new value.
|
|
30
|
+
* @returns A disposer function to cancel the subscription.
|
|
31
|
+
*/
|
|
32
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=observable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["../../../src/basic/observable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,8BAAsB,cAAc,CAAC,CAAC,CAAE,SAAQ,UAAU;IACtD;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,IAAI,CAAC;IAWjB;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;CAMtD"}
|