@ersbeth/picoflow 0.2.1 → 0.2.3

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 (41) hide show
  1. package/api/doc/picoflow.from.md +55 -0
  2. package/api/doc/picoflow.from_1.md +55 -0
  3. package/api/doc/picoflow.from_2.md +55 -0
  4. package/api/doc/picoflow.from_3.md +55 -0
  5. package/api/doc/picoflow.from_4.md +55 -0
  6. package/api/doc/picoflow.from_5.md +55 -0
  7. package/api/doc/picoflow.md +121 -0
  8. package/api/doc/picoflow.solidderivation._constructor_.md +49 -0
  9. package/api/doc/picoflow.solidderivation.get.md +13 -0
  10. package/api/doc/picoflow.solidderivation.md +94 -0
  11. package/api/doc/picoflow.solidgetter.md +13 -0
  12. package/api/doc/picoflow.solidobservable.get.md +13 -0
  13. package/api/doc/picoflow.solidobservable.md +57 -0
  14. package/api/doc/picoflow.solidresource._constructor_.md +49 -0
  15. package/api/doc/picoflow.solidresource.get.md +13 -0
  16. package/api/doc/picoflow.solidresource.latest.md +13 -0
  17. package/api/doc/picoflow.solidresource.md +157 -0
  18. package/api/doc/picoflow.solidresource.refetch.md +13 -0
  19. package/api/doc/picoflow.solidresource.state.md +13 -0
  20. package/api/doc/picoflow.solidstate._constructor_.md +49 -0
  21. package/api/doc/picoflow.solidstate.get.md +13 -0
  22. package/api/doc/picoflow.solidstate.md +115 -0
  23. package/api/doc/picoflow.solidstate.set.md +13 -0
  24. package/api/picoflow.public.api.md +52 -0
  25. package/dist/picoflow.js +844 -2
  26. package/dist/types/basic/derivation.d.ts.map +1 -1
  27. package/dist/types/index.d.ts +3 -5
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/solid/converters.d.ts +64 -0
  30. package/dist/types/solid/converters.d.ts.map +1 -0
  31. package/dist/types/solid/index.d.ts +3 -0
  32. package/dist/types/solid/index.d.ts.map +1 -0
  33. package/dist/types/solid/primitives.d.ts +88 -0
  34. package/dist/types/solid/primitives.d.ts.map +1 -0
  35. package/package.json +4 -1
  36. package/src/basic/derivation.ts +18 -1
  37. package/src/index.ts +18 -12
  38. package/src/solid/converters.ts +159 -0
  39. package/src/solid/index.ts +2 -0
  40. package/src/solid/primitives.ts +109 -0
  41. package/test/derivation.test.ts +98 -0
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a FlowObservable of a Promise value into a SolidResource.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: FlowObservable<Promise<NotPromise<T>>>): SolidResource<NotPromise<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ [FlowObservable](./picoflow.flowobservable.md)<!-- -->&lt;Promise&lt;NotPromise&lt;T&gt;&gt;&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The FlowObservable to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidResource](./picoflow.solidresource.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
53
+
54
+ A SolidResource wrapping the observable.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from_1.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a FlowObservable of a non-Promise value into a SolidDerivation.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: FlowObservable<NotPromise<T>>): SolidDerivation<NotPromise<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ [FlowObservable](./picoflow.flowobservable.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The FlowObservable to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidDerivation](./picoflow.solidderivation.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
53
+
54
+ A SolidDerivation wrapping the observable.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from_2.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a FlowObservable into a Solid derivation or resource, depending on whether the value is synchronous or asynchronous.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: FlowObservable<Promise<NotPromise<T>>> | FlowObservable<NotPromise<T>>): SolidDerivation<NotPromise<T>> | SolidResource<NotPromise<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ [FlowObservable](./picoflow.flowobservable.md)<!-- -->&lt;Promise&lt;NotPromise&lt;T&gt;&gt;&gt; \| [FlowObservable](./picoflow.flowobservable.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The FlowObservable to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidDerivation](./picoflow.solidderivation.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt; \| [SolidResource](./picoflow.solidresource.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
53
+
54
+ A SolidDerivation or SolidResource, depending on the input type.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from_3.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a getter function returning a non-Promise value into a SolidDerivation.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: (get: FlowGetter) => NotPromise<T>): SolidDerivation<NotPromise<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ (get: [FlowGetter](./picoflow.flowgetter.md)<!-- -->) =&gt; NotPromise&lt;T&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The getter function to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidDerivation](./picoflow.solidderivation.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
53
+
54
+ A SolidDerivation wrapping the getter.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from_4.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a getter function returning a Promise into a SolidResource.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: (get: FlowGetter) => Promise<NotPromise<T>>): SolidResource<NotPromise<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ (get: [FlowGetter](./picoflow.flowgetter.md)<!-- -->) =&gt; Promise&lt;NotPromise&lt;T&gt;&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The getter function to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidResource](./picoflow.solidresource.md)<!-- -->&lt;NotPromise&lt;T&gt;&gt;
53
+
54
+ A SolidResource wrapping the getter.
55
+
@@ -0,0 +1,55 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [from](./picoflow.from_5.md)
4
+
5
+ ## from() function
6
+
7
+ Converts a getter function into a Solid derivation or resource, depending on whether the returned value is synchronous or asynchronous.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function from<T>(flow: ((get: FlowGetter) => NotPromise<T>) | ((get: FlowGetter) => Promise<NotPromise<T>>)): SolidDerivation<T> | SolidResource<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
+ flow
36
+
37
+
38
+ </td><td>
39
+
40
+ ((get: [FlowGetter](./picoflow.flowgetter.md)<!-- -->) =&gt; NotPromise&lt;T&gt;) \| ((get: [FlowGetter](./picoflow.flowgetter.md)<!-- -->) =&gt; Promise&lt;NotPromise&lt;T&gt;&gt;)
41
+
42
+
43
+ </td><td>
44
+
45
+ The getter function to convert.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+ **Returns:**
51
+
52
+ [SolidDerivation](./picoflow.solidderivation.md)<!-- -->&lt;T&gt; \| [SolidResource](./picoflow.solidresource.md)<!-- -->&lt;T&gt;
53
+
54
+ A SolidDerivation or SolidResource, depending on the input type.
55
+
@@ -139,6 +139,39 @@ Represents a reactive stream that updates its value based on an updater function
139
139
  Represents an asynchronous reactive stream that updates its value based on an updater function.
140
140
 
141
141
 
142
+ </td></tr>
143
+ <tr><td>
144
+
145
+ [SolidDerivation](./picoflow.solidderivation.md)
146
+
147
+
148
+ </td><td>
149
+
150
+ Solid-style derivation, similar to a computed/memoized value.
151
+
152
+
153
+ </td></tr>
154
+ <tr><td>
155
+
156
+ [SolidResource](./picoflow.solidresource.md)
157
+
158
+
159
+ </td><td>
160
+
161
+ Solid-style resource, similar to an async resource or data loader.
162
+
163
+
164
+ </td></tr>
165
+ <tr><td>
166
+
167
+ [SolidState](./picoflow.solidstate.md)
168
+
169
+
170
+ </td><td>
171
+
172
+ Solid-style state container, similar to a writable signal.
173
+
174
+
142
175
  </td></tr>
143
176
  </tbody></table>
144
177
 
@@ -224,6 +257,72 @@ Creates a new reactive derivation whose value is computed based on other reactiv
224
257
  Creates a new reactive effect that executes a side-effect function based on its dependencies.
225
258
 
226
259
 
260
+ </td></tr>
261
+ <tr><td>
262
+
263
+ [from(flow)](./picoflow.from.md)
264
+
265
+
266
+ </td><td>
267
+
268
+ Converts a FlowObservable of a Promise value into a SolidResource.
269
+
270
+
271
+ </td></tr>
272
+ <tr><td>
273
+
274
+ [from(flow)](./picoflow.from_1.md)
275
+
276
+
277
+ </td><td>
278
+
279
+ Converts a FlowObservable of a non-Promise value into a SolidDerivation.
280
+
281
+
282
+ </td></tr>
283
+ <tr><td>
284
+
285
+ [from(flow)](./picoflow.from_2.md)
286
+
287
+
288
+ </td><td>
289
+
290
+ Converts a FlowObservable into a Solid derivation or resource, depending on whether the value is synchronous or asynchronous.
291
+
292
+
293
+ </td></tr>
294
+ <tr><td>
295
+
296
+ [from(flow)](./picoflow.from_3.md)
297
+
298
+
299
+ </td><td>
300
+
301
+ Converts a getter function returning a non-Promise value into a SolidDerivation.
302
+
303
+
304
+ </td></tr>
305
+ <tr><td>
306
+
307
+ [from(flow)](./picoflow.from_4.md)
308
+
309
+
310
+ </td><td>
311
+
312
+ Converts a getter function returning a Promise into a SolidResource.
313
+
314
+
315
+ </td></tr>
316
+ <tr><td>
317
+
318
+ [from(flow)](./picoflow.from_5.md)
319
+
320
+
321
+ </td><td>
322
+
323
+ Converts a getter function into a Solid derivation or resource, depending on whether the returned value is synchronous or asynchronous.
324
+
325
+
227
326
  </td></tr>
228
327
  <tr><td>
229
328
 
@@ -338,6 +437,17 @@ Description
338
437
  Represents an object with a disposable lifecycle.
339
438
 
340
439
 
440
+ </td></tr>
441
+ <tr><td>
442
+
443
+ [SolidObservable](./picoflow.solidobservable.md)
444
+
445
+
446
+ </td><td>
447
+
448
+ Interface for a Solid-style observable value.
449
+
450
+
341
451
  </td></tr>
342
452
  </tbody></table>
343
453
 
@@ -419,5 +529,16 @@ A function type that updates a stream and returns a disposer for cleanup.
419
529
  A function for watching a FlowSignal.
420
530
 
421
531
 
532
+ </td></tr>
533
+ <tr><td>
534
+
535
+ [SolidGetter](./picoflow.solidgetter.md)
536
+
537
+
538
+ </td><td>
539
+
540
+ A getter function or value for Solid state/derivation.
541
+
542
+
422
543
  </td></tr>
423
544
  </tbody></table>
@@ -0,0 +1,49 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [SolidDerivation](./picoflow.solidderivation.md) &gt; [(constructor)](./picoflow.solidderivation._constructor_.md)
4
+
5
+ ## SolidDerivation.(constructor)
6
+
7
+ Creates a new SolidDerivation from a getter function or value.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ constructor(calculator: SolidGetter<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
+ calculator
36
+
37
+
38
+ </td><td>
39
+
40
+ [SolidGetter](./picoflow.solidgetter.md)<!-- -->&lt;T&gt;
41
+
42
+
43
+ </td><td>
44
+
45
+ The getter function or value.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [SolidDerivation](./picoflow.solidderivation.md) &gt; [get](./picoflow.solidderivation.get.md)
4
+
5
+ ## SolidDerivation.get property
6
+
7
+ Returns the current derived value.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly get: () => T;
13
+ ```
@@ -0,0 +1,94 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [SolidDerivation](./picoflow.solidderivation.md)
4
+
5
+ ## SolidDerivation class
6
+
7
+ Solid-style derivation, similar to a computed/memoized value.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare class SolidDerivation<T> implements SolidObservable<T>
13
+ ```
14
+ **Implements:** [SolidObservable](./picoflow.solidobservable.md)<!-- -->&lt;T&gt;
15
+
16
+ ## Constructors
17
+
18
+ <table><thead><tr><th>
19
+
20
+ Constructor
21
+
22
+
23
+ </th><th>
24
+
25
+ Modifiers
26
+
27
+
28
+ </th><th>
29
+
30
+ Description
31
+
32
+
33
+ </th></tr></thead>
34
+ <tbody><tr><td>
35
+
36
+ [(constructor)(calculator)](./picoflow.solidderivation._constructor_.md)
37
+
38
+
39
+ </td><td>
40
+
41
+
42
+ </td><td>
43
+
44
+ Creates a new SolidDerivation from a getter function or value.
45
+
46
+
47
+ </td></tr>
48
+ </tbody></table>
49
+
50
+ ## Properties
51
+
52
+ <table><thead><tr><th>
53
+
54
+ Property
55
+
56
+
57
+ </th><th>
58
+
59
+ Modifiers
60
+
61
+
62
+ </th><th>
63
+
64
+ Type
65
+
66
+
67
+ </th><th>
68
+
69
+ Description
70
+
71
+
72
+ </th></tr></thead>
73
+ <tbody><tr><td>
74
+
75
+ [get](./picoflow.solidderivation.get.md)
76
+
77
+
78
+ </td><td>
79
+
80
+ `readonly`
81
+
82
+
83
+ </td><td>
84
+
85
+ () =&gt; T
86
+
87
+
88
+ </td><td>
89
+
90
+ Returns the current derived value.
91
+
92
+
93
+ </td></tr>
94
+ </tbody></table>
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [SolidGetter](./picoflow.solidgetter.md)
4
+
5
+ ## SolidGetter type
6
+
7
+ A getter function or value for Solid state/derivation.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export type SolidGetter<T> = ((previous: T) => T) | T;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ersbeth/picoflow](./picoflow.md) &gt; [SolidObservable](./picoflow.solidobservable.md) &gt; [get](./picoflow.solidobservable.get.md)
4
+
5
+ ## SolidObservable.get property
6
+
7
+ Returns the current value.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ get: () => T;
13
+ ```