@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
package/api/doc/picoflow.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [picoflow](./picoflow.md)
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md)
|
|
4
4
|
|
|
5
5
|
## picoflow package
|
|
6
6
|
|
|
@@ -21,6 +21,28 @@ Description
|
|
|
21
21
|
</th></tr></thead>
|
|
22
22
|
<tbody><tr><td>
|
|
23
23
|
|
|
24
|
+
[FlowArray](./picoflow.flowarray.md)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</td><td>
|
|
28
|
+
|
|
29
|
+
Represents a reactive array.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</td></tr>
|
|
33
|
+
<tr><td>
|
|
34
|
+
|
|
35
|
+
[FlowConstant](./picoflow.flowconstant.md)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
Represents a reactive and immutable constant value computed lazily upon first access.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td></tr>
|
|
44
|
+
<tr><td>
|
|
45
|
+
|
|
24
46
|
[FlowDerivation](./picoflow.flowderivation.md)
|
|
25
47
|
|
|
26
48
|
|
|
@@ -37,7 +59,7 @@ Represents a reactive derivation whose value is computed based on other reactive
|
|
|
37
59
|
|
|
38
60
|
</td><td>
|
|
39
61
|
|
|
40
|
-
Represents a reactive effect that executes
|
|
62
|
+
Represents a reactive effect that executes side-effect functions based on its tracked dependencies.
|
|
41
63
|
|
|
42
64
|
|
|
43
65
|
</td></tr>
|
|
@@ -48,7 +70,7 @@ Represents a reactive effect that executes a side‐effect function based on its
|
|
|
48
70
|
|
|
49
71
|
</td><td>
|
|
50
72
|
|
|
51
|
-
Represents a reactive map of states
|
|
73
|
+
Represents a reactive map of states extending [FlowState](./picoflow.flowstate.md) for a Map of key/value pairs.
|
|
52
74
|
|
|
53
75
|
|
|
54
76
|
</td></tr>
|
|
@@ -62,6 +84,17 @@ Represents a reactive map of states that extends [FlowState](./picoflow.flowstat
|
|
|
62
84
|
Represents a reactive resource that asynchronously fetches its value.
|
|
63
85
|
|
|
64
86
|
|
|
87
|
+
</td></tr>
|
|
88
|
+
<tr><td>
|
|
89
|
+
|
|
90
|
+
[FlowResourceAsync](./picoflow.flowresourceasync.md)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</td><td>
|
|
94
|
+
|
|
95
|
+
Represents a reactive resource that asynchronously fetches its value.
|
|
96
|
+
|
|
97
|
+
|
|
65
98
|
</td></tr>
|
|
66
99
|
<tr><td>
|
|
67
100
|
|
|
@@ -95,6 +128,17 @@ Represents a reactive state that holds a mutable value.
|
|
|
95
128
|
Represents a reactive stream that updates its value based on an updater function.
|
|
96
129
|
|
|
97
130
|
|
|
131
|
+
</td></tr>
|
|
132
|
+
<tr><td>
|
|
133
|
+
|
|
134
|
+
[FlowStreamAsync](./picoflow.flowstreamasync.md)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
</td><td>
|
|
138
|
+
|
|
139
|
+
Represents an asynchronous reactive stream that updates its value based on an updater function.
|
|
140
|
+
|
|
141
|
+
|
|
98
142
|
</td></tr>
|
|
99
143
|
</tbody></table>
|
|
100
144
|
|
|
@@ -118,7 +162,7 @@ Description
|
|
|
118
162
|
|
|
119
163
|
</td><td>
|
|
120
164
|
|
|
121
|
-
Represents a reactive observable that
|
|
165
|
+
Represents a reactive observable that holds and tracks a value.
|
|
122
166
|
|
|
123
167
|
|
|
124
168
|
</td></tr>
|
|
@@ -139,6 +183,28 @@ Description
|
|
|
139
183
|
</th></tr></thead>
|
|
140
184
|
<tbody><tr><td>
|
|
141
185
|
|
|
186
|
+
[array(initial)](./picoflow.array.md)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
</td><td>
|
|
190
|
+
|
|
191
|
+
Creates a new reactive array.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
</td></tr>
|
|
195
|
+
<tr><td>
|
|
196
|
+
|
|
197
|
+
[constant(value)](./picoflow.constant.md)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
</td><td>
|
|
201
|
+
|
|
202
|
+
Creates a new reactive constant.
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
</td></tr>
|
|
206
|
+
<tr><td>
|
|
207
|
+
|
|
142
208
|
[derivation(fn)](./picoflow.derivation.md)
|
|
143
209
|
|
|
144
210
|
|
|
@@ -158,6 +224,17 @@ Creates a new reactive derivation whose value is computed based on other reactiv
|
|
|
158
224
|
Creates a new reactive effect that executes a side-effect function based on its dependencies.
|
|
159
225
|
|
|
160
226
|
|
|
227
|
+
</td></tr>
|
|
228
|
+
<tr><td>
|
|
229
|
+
|
|
230
|
+
[isDisposable(obj)](./picoflow.isdisposable.md)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
</td><td>
|
|
234
|
+
|
|
235
|
+
Checks whether an object implements the FlowDisposable interface.
|
|
236
|
+
|
|
237
|
+
|
|
161
238
|
</td></tr>
|
|
162
239
|
<tr><td>
|
|
163
240
|
|
|
@@ -172,7 +249,7 @@ Creates a new reactive map state.
|
|
|
172
249
|
</td></tr>
|
|
173
250
|
<tr><td>
|
|
174
251
|
|
|
175
|
-
[resource(fn
|
|
252
|
+
[resource(fn)](./picoflow.resource.md)
|
|
176
253
|
|
|
177
254
|
|
|
178
255
|
</td><td>
|
|
@@ -180,6 +257,17 @@ Creates a new reactive map state.
|
|
|
180
257
|
Creates a new reactive resource that asynchronously fetches its value.
|
|
181
258
|
|
|
182
259
|
|
|
260
|
+
</td></tr>
|
|
261
|
+
<tr><td>
|
|
262
|
+
|
|
263
|
+
[resourceAsync(fn)](./picoflow.resourceasync.md)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
</td><td>
|
|
267
|
+
|
|
268
|
+
Creates a new reactive asynchronous resource that fetches its value.
|
|
269
|
+
|
|
270
|
+
|
|
183
271
|
</td></tr>
|
|
184
272
|
<tr><td>
|
|
185
273
|
|
|
@@ -205,7 +293,7 @@ Creates a new reactive state holding a value.
|
|
|
205
293
|
</td></tr>
|
|
206
294
|
<tr><td>
|
|
207
295
|
|
|
208
|
-
[stream(updater
|
|
296
|
+
[stream(updater)](./picoflow.stream.md)
|
|
209
297
|
|
|
210
298
|
|
|
211
299
|
</td><td>
|
|
@@ -213,6 +301,43 @@ Creates a new reactive state holding a value.
|
|
|
213
301
|
Creates a new reactive stream.
|
|
214
302
|
|
|
215
303
|
|
|
304
|
+
</td></tr>
|
|
305
|
+
<tr><td>
|
|
306
|
+
|
|
307
|
+
[streamAsync(updater)](./picoflow.streamasync.md)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
</td><td>
|
|
311
|
+
|
|
312
|
+
Creates a new reactive asynchronous stream.
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
</td></tr>
|
|
316
|
+
</tbody></table>
|
|
317
|
+
|
|
318
|
+
## Interfaces
|
|
319
|
+
|
|
320
|
+
<table><thead><tr><th>
|
|
321
|
+
|
|
322
|
+
Interface
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
</th><th>
|
|
326
|
+
|
|
327
|
+
Description
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
</th></tr></thead>
|
|
331
|
+
<tbody><tr><td>
|
|
332
|
+
|
|
333
|
+
[FlowDisposable](./picoflow.flowdisposable.md)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
</td><td>
|
|
337
|
+
|
|
338
|
+
Represents an object with a disposable lifecycle.
|
|
339
|
+
|
|
340
|
+
|
|
216
341
|
</td></tr>
|
|
217
342
|
</tbody></table>
|
|
218
343
|
|
|
@@ -231,12 +356,12 @@ Description
|
|
|
231
356
|
</th></tr></thead>
|
|
232
357
|
<tbody><tr><td>
|
|
233
358
|
|
|
234
|
-
[
|
|
359
|
+
[FlowArrayAction](./picoflow.flowarrayaction.md)
|
|
235
360
|
|
|
236
361
|
|
|
237
362
|
</td><td>
|
|
238
363
|
|
|
239
|
-
|
|
364
|
+
Represents the actions that can be performed on a FlowArray.
|
|
240
365
|
|
|
241
366
|
|
|
242
367
|
</td></tr>
|
|
@@ -247,29 +372,40 @@ A function that disposes of a resource.
|
|
|
247
372
|
|
|
248
373
|
</td><td>
|
|
249
374
|
|
|
250
|
-
A function
|
|
375
|
+
A function that retrieves the current value from a FlowObservable.
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
</td></tr>
|
|
379
|
+
<tr><td>
|
|
380
|
+
|
|
381
|
+
[FlowStreamDisposer](./picoflow.flowstreamdisposer.md)
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
</td><td>
|
|
385
|
+
|
|
386
|
+
A function type that disposes of a resource.
|
|
251
387
|
|
|
252
388
|
|
|
253
389
|
</td></tr>
|
|
254
390
|
<tr><td>
|
|
255
391
|
|
|
256
|
-
[
|
|
392
|
+
[FlowStreamSetter](./picoflow.flowstreamsetter.md)
|
|
257
393
|
|
|
258
394
|
|
|
259
395
|
</td><td>
|
|
260
396
|
|
|
261
|
-
A function that sets a new value.
|
|
397
|
+
A function type that sets a new value for the reactive stream.
|
|
262
398
|
|
|
263
399
|
|
|
264
400
|
</td></tr>
|
|
265
401
|
<tr><td>
|
|
266
402
|
|
|
267
|
-
[
|
|
403
|
+
[FlowStreamUpdater](./picoflow.flowstreamupdater.md)
|
|
268
404
|
|
|
269
405
|
|
|
270
406
|
</td><td>
|
|
271
407
|
|
|
272
|
-
A function that
|
|
408
|
+
A function type that updates a stream and returns a disposer for cleanup.
|
|
273
409
|
|
|
274
410
|
|
|
275
411
|
</td></tr>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [picoflow](./picoflow.md) > [resource](./picoflow.resource.md)
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [resource](./picoflow.resource.md)
|
|
4
4
|
|
|
5
5
|
## resource() function
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Creates a new reactive resource that asynchronously fetches its value.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export declare function resource<T>(fn: () => Promise<T
|
|
12
|
+
export declare function resource<T>(fn: () => Promise<T>): FlowResource<T>;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
@@ -45,22 +45,6 @@ fn
|
|
|
45
45
|
An asynchronous function that fetches the resource value.
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
</td></tr>
|
|
49
|
-
<tr><td>
|
|
50
|
-
|
|
51
|
-
initial
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</td><td>
|
|
55
|
-
|
|
56
|
-
T
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</td><td>
|
|
60
|
-
|
|
61
|
-
The initial value of the resource.
|
|
62
|
-
|
|
63
|
-
|
|
64
48
|
</td></tr>
|
|
65
49
|
</tbody></table>
|
|
66
50
|
**Returns:**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [resourceAsync](./picoflow.resourceasync.md)
|
|
4
|
+
|
|
5
|
+
## resourceAsync() function
|
|
6
|
+
|
|
7
|
+
Creates a new reactive asynchronous resource that fetches its value.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function resourceAsync<T>(fn: () => Promise<T>): FlowResourceAsync<T>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
fn
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
() => Promise<T>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
An asynchronous function that fetches the resource value.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
**Returns:**
|
|
51
|
+
|
|
52
|
+
[FlowResourceAsync](./picoflow.flowresourceasync.md)<!-- --><T>
|
|
53
|
+
|
|
54
|
+
A new instance of [FlowResourceAsync](./picoflow.flowresourceasync.md)<!-- -->.
|
|
55
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [picoflow](./picoflow.md) > [signal](./picoflow.signal.md)
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [signal](./picoflow.signal.md)
|
|
4
4
|
|
|
5
5
|
## signal() function
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [picoflow](./picoflow.md) > [state](./picoflow.state.md)
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [state](./picoflow.state.md)
|
|
4
4
|
|
|
5
5
|
## state() function
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Creates a new reactive state holding a value.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export declare function state<T>(value: T): FlowState<T>;
|
|
12
|
+
export declare function state<T>(value: T | (() => T)): FlowState<T>;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
@@ -37,7 +37,7 @@ value
|
|
|
37
37
|
|
|
38
38
|
</td><td>
|
|
39
39
|
|
|
40
|
-
T
|
|
40
|
+
T \| (() => T)
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
</td><td>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [picoflow](./picoflow.md) > [stream](./picoflow.stream.md)
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [stream](./picoflow.stream.md)
|
|
4
4
|
|
|
5
5
|
## stream() function
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Creates a new reactive stream.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export declare function stream<T>(updater: (set: (value: T) => void) => () => void
|
|
12
|
+
export declare function stream<T>(updater: (set: (value: T) => void) => () => void): FlowStream<T>;
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
@@ -45,22 +45,6 @@ updater
|
|
|
45
45
|
A function that receives a setter to update the stream's value. It should return a disposer function to clean up resources.
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
</td></tr>
|
|
49
|
-
<tr><td>
|
|
50
|
-
|
|
51
|
-
initial
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</td><td>
|
|
55
|
-
|
|
56
|
-
T
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</td><td>
|
|
60
|
-
|
|
61
|
-
The initial value of the stream.
|
|
62
|
-
|
|
63
|
-
|
|
64
48
|
</td></tr>
|
|
65
49
|
</tbody></table>
|
|
66
50
|
**Returns:**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@ersbeth/picoflow](./picoflow.md) > [streamAsync](./picoflow.streamasync.md)
|
|
4
|
+
|
|
5
|
+
## streamAsync() function
|
|
6
|
+
|
|
7
|
+
Creates a new reactive asynchronous stream.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare function streamAsync<T>(updater: (set: (value: T) => void) => () => void): FlowStreamAsync<T>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
updater
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
(set: (value: T) => void) => () => void
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
A function that receives a setter to update the stream's value. It should return a disposer function to clean up resources.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
**Returns:**
|
|
51
|
+
|
|
52
|
+
[FlowStreamAsync](./picoflow.flowstreamasync.md)<!-- --><T>
|
|
53
|
+
|
|
54
|
+
A new instance of [FlowStreamAsync](./picoflow.flowstreamasync.md)<!-- -->.
|
|
55
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
## Public API Report File for "@ersbeth/picoflow"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
// @public
|
|
8
|
+
export function array<T>(initial?: T[]): FlowArray<T>;
|
|
9
|
+
|
|
10
|
+
// @public
|
|
11
|
+
export function constant<T>(value: T | (() => T)): FlowConstant<T>;
|
|
12
|
+
|
|
13
|
+
// @public
|
|
14
|
+
export function derivation<T>(fn: (get: FlowGetter, watch: FlowWatcher) => T): FlowDerivation<T>;
|
|
15
|
+
|
|
16
|
+
// @public
|
|
17
|
+
export function effect(fn: (get: FlowGetter, watch: FlowWatcher) => void): FlowEffect;
|
|
18
|
+
|
|
19
|
+
// @public
|
|
20
|
+
export class FlowArray<T> extends FlowObservable<T[]> {
|
|
21
|
+
$lastAction: FlowState<FlowArrayAction<T>>;
|
|
22
|
+
constructor(value?: T[]);
|
|
23
|
+
clear(): void;
|
|
24
|
+
dispose(options?: {
|
|
25
|
+
self: boolean;
|
|
26
|
+
}): void;
|
|
27
|
+
get(): T[];
|
|
28
|
+
get length(): number;
|
|
29
|
+
pop(): void;
|
|
30
|
+
push(item: T): void;
|
|
31
|
+
set(items: T[]): void;
|
|
32
|
+
setItem(index: number, item: T): void;
|
|
33
|
+
shift(): void;
|
|
34
|
+
splice(start: number, deleteCount: number, ...newItems: T[]): void;
|
|
35
|
+
unshift(item: T): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// @public
|
|
39
|
+
export type FlowArrayAction<T> = {
|
|
40
|
+
type: "set";
|
|
41
|
+
items: T[];
|
|
42
|
+
} | {
|
|
43
|
+
type: "setItem";
|
|
44
|
+
index: number;
|
|
45
|
+
item: T;
|
|
46
|
+
} | {
|
|
47
|
+
type: "push";
|
|
48
|
+
item: T;
|
|
49
|
+
} | {
|
|
50
|
+
type: "pop";
|
|
51
|
+
} | {
|
|
52
|
+
type: "unshift";
|
|
53
|
+
item: T;
|
|
54
|
+
} | {
|
|
55
|
+
type: "shift";
|
|
56
|
+
} | {
|
|
57
|
+
type: "splice";
|
|
58
|
+
start: number;
|
|
59
|
+
deleteCount: number;
|
|
60
|
+
items: T[];
|
|
61
|
+
} | {
|
|
62
|
+
type: "clear";
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// @public
|
|
66
|
+
export class FlowConstant<T> extends FlowObservable<T> {
|
|
67
|
+
constructor(value: T | (() => T));
|
|
68
|
+
get(): T;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// @public
|
|
72
|
+
export class FlowDerivation<T> extends FlowObservable<T> {
|
|
73
|
+
constructor(compute: (get: FlowGetter, watch: FlowWatcher) => T);
|
|
74
|
+
get(): T;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// @public
|
|
78
|
+
export interface FlowDisposable {
|
|
79
|
+
dispose(options?: {
|
|
80
|
+
self: boolean;
|
|
81
|
+
}): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// @public
|
|
85
|
+
export class FlowEffect {
|
|
86
|
+
constructor(apply: (get: FlowGetter, watch: FlowWatcher) => void);
|
|
87
|
+
dispose(): void;
|
|
88
|
+
get disposed(): boolean;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// @public
|
|
92
|
+
export type FlowGetter = <T>(observable: FlowObservable<T>) => T;
|
|
93
|
+
|
|
94
|
+
// @public
|
|
95
|
+
export class FlowMap<K, V> extends FlowState<Map<K, V>> {
|
|
96
|
+
$lastDeleted: FlowState<{
|
|
97
|
+
key?: K;
|
|
98
|
+
value?: V;
|
|
99
|
+
}>;
|
|
100
|
+
$lastSet: FlowState<{
|
|
101
|
+
key?: K;
|
|
102
|
+
value?: V;
|
|
103
|
+
}>;
|
|
104
|
+
delete(key: K): void;
|
|
105
|
+
setAt(key: K, value: V): void;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// @public
|
|
109
|
+
export abstract class FlowObservable<T> extends FlowSignal {
|
|
110
|
+
abstract get(): T;
|
|
111
|
+
subscribe(listener: (value: T) => void): () => void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// @public
|
|
115
|
+
export class FlowResource<T> extends FlowObservable<T | undefined> {
|
|
116
|
+
constructor(fetch: () => Promise<T>);
|
|
117
|
+
fetch(): Promise<void>;
|
|
118
|
+
get(): T | undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// @public
|
|
122
|
+
export class FlowResourceAsync<T> extends FlowObservable<Promise<T>> {
|
|
123
|
+
constructor(fetch: () => Promise<T>);
|
|
124
|
+
fetch(): Promise<void>;
|
|
125
|
+
get(): Promise<T>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// @public
|
|
129
|
+
export class FlowSignal implements FlowDisposable {
|
|
130
|
+
dispose(options?: {
|
|
131
|
+
self: boolean;
|
|
132
|
+
}): void;
|
|
133
|
+
get disposed(): boolean;
|
|
134
|
+
trigger(): void;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// @public
|
|
138
|
+
export class FlowState<T> extends FlowConstant<T> {
|
|
139
|
+
set(value: T | ((current: T) => T)): void;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// @public
|
|
143
|
+
export class FlowStream<T> extends FlowObservable<T | undefined> {
|
|
144
|
+
constructor(updater: FlowStreamUpdater<T>);
|
|
145
|
+
dispose(): void;
|
|
146
|
+
get(): T | undefined;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// @public
|
|
150
|
+
export class FlowStreamAsync<T> extends FlowObservable<Promise<T>> {
|
|
151
|
+
constructor(updater: FlowStreamUpdater<T>);
|
|
152
|
+
dispose(): void;
|
|
153
|
+
get(): Promise<T>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// @public
|
|
157
|
+
export type FlowStreamDisposer = () => void;
|
|
158
|
+
|
|
159
|
+
// @public
|
|
160
|
+
export type FlowStreamSetter<T> = (value: T) => void;
|
|
161
|
+
|
|
162
|
+
// @public
|
|
163
|
+
export type FlowStreamUpdater<T> = (set: FlowStreamSetter<T>) => FlowStreamDisposer;
|
|
164
|
+
|
|
165
|
+
// @public
|
|
166
|
+
export type FlowWatcher = (signal: FlowSignal) => void;
|
|
167
|
+
|
|
168
|
+
// @public
|
|
169
|
+
export function isDisposable(obj: unknown): obj is FlowDisposable;
|
|
170
|
+
|
|
171
|
+
// @public
|
|
172
|
+
export function map<K extends string | number | symbol, V>(initial?: Record<K, V>): FlowMap<K, V>;
|
|
173
|
+
|
|
174
|
+
// @public
|
|
175
|
+
export function resource<T>(fn: () => Promise<T>): FlowResource<T>;
|
|
176
|
+
|
|
177
|
+
// @public
|
|
178
|
+
export function resourceAsync<T>(fn: () => Promise<T>): FlowResourceAsync<T>;
|
|
179
|
+
|
|
180
|
+
// @public
|
|
181
|
+
export function signal(): FlowSignal;
|
|
182
|
+
|
|
183
|
+
// @public
|
|
184
|
+
export function state<T>(value: T | (() => T)): FlowState<T>;
|
|
185
|
+
|
|
186
|
+
// @public
|
|
187
|
+
export function stream<T>(updater: (set: (value: T) => void) => () => void): FlowStream<T>;
|
|
188
|
+
|
|
189
|
+
// @public
|
|
190
|
+
export function streamAsync<T>(updater: (set: (value: T) => void) => () => void): FlowStreamAsync<T>;
|
|
191
|
+
|
|
192
|
+
```
|
package/api-extractor.json
CHANGED