@thi.ng/rstream 9.2.0 → 9.2.1
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/CHANGELOG.md +1 -1
- package/object.d.ts +22 -5
- package/object.js +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
package/object.d.ts
CHANGED
|
@@ -43,8 +43,8 @@ export interface StreamObjOpts<T, K extends Keys<T>> extends CommonOpts {
|
|
|
43
43
|
* Returns new {@link StreamObj}.
|
|
44
44
|
*
|
|
45
45
|
* @remarks
|
|
46
|
-
* The
|
|
47
|
-
*
|
|
46
|
+
* The options arg is used to customize overall behavior of `fromObject` and
|
|
47
|
+
* specify shared options for *all* created streams.
|
|
48
48
|
*
|
|
49
49
|
* A {@link StreamObj} is a full {@link Subscription}, in which additionally all
|
|
50
50
|
* configured key streams are exposed under `streams`. The
|
|
@@ -89,7 +89,7 @@ export interface StreamObjOpts<T, K extends Keys<T>> extends CommonOpts {
|
|
|
89
89
|
* obj.streams.b.subscribe(trace("b"));
|
|
90
90
|
*
|
|
91
91
|
* const src = subscription<Foo, Foo>();
|
|
92
|
-
* // use `obj` as
|
|
92
|
+
* // use `obj` as subscriber itself
|
|
93
93
|
* src.subscribe(obj);
|
|
94
94
|
*
|
|
95
95
|
* src.next({ a: 1, b: "foo" });
|
|
@@ -104,17 +104,34 @@ export declare const fromObject: <T extends object, K extends Keys<T>>(src: T, o
|
|
|
104
104
|
/**
|
|
105
105
|
* Syntax sugar for {@link fromObject} for tuple/arrays. Returns a
|
|
106
106
|
* {@link StreamObj} which provides individual subscriptions for each tuple
|
|
107
|
-
* element, i.e. 1:N fanout.
|
|
107
|
+
* element, i.e. for 1:N fanout.
|
|
108
108
|
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* This construct is very useful for UI purposes, helping to provide both
|
|
111
|
+
* finegrained and tuple-based reactive state for UI components used to edit
|
|
112
|
+
* tuple/vector values (e.g. via individual per-tuple-element input
|
|
113
|
+
* fields/controls).
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
109
116
|
* ```ts tangle:../export/from-tuple.ts
|
|
110
117
|
* import { fromTuple, subscription, trace } from "@thi.ng/rstream";
|
|
111
118
|
*
|
|
112
|
-
* const tup = fromTuple([
|
|
119
|
+
* const tup = fromTuple([10, 20, 30]);
|
|
113
120
|
*
|
|
114
121
|
* tup.streams[0].subscribe(trace("[0]:"));
|
|
115
122
|
* tup.streams[1].subscribe(trace("[1]:"));
|
|
116
123
|
* tup.streams[2].subscribe(trace("[2]:"));
|
|
124
|
+
*
|
|
125
|
+
* // [0]: 10
|
|
126
|
+
* // [1]: 20
|
|
127
|
+
* // [2]: 30
|
|
128
|
+
*
|
|
129
|
+
* tup.next([100,20,30]);
|
|
130
|
+
*
|
|
131
|
+
* // [0]: 100
|
|
132
|
+
* // (the two other streams didn't update since their values haven't changed)
|
|
117
133
|
* ```
|
|
134
|
+
*
|
|
118
135
|
* @param src
|
|
119
136
|
* @param opts
|
|
120
137
|
*/
|
package/object.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dedupe } from "@thi.ng/transducers/dedupe";
|
|
2
|
+
import { range } from "@thi.ng/transducers/range";
|
|
2
3
|
import { __optsWithID } from "./idgen.js";
|
|
3
4
|
import { Subscription, subscription } from "./subscription.js";
|
|
4
|
-
import { range } from "@thi.ng/transducers";
|
|
5
5
|
const fromObject = (src, opts = {}) => new StreamObj(src, opts);
|
|
6
6
|
const fromTuple = (src, opts) => new StreamObj(src, { keys: [...range(src.length)], ...opts });
|
|
7
7
|
class StreamObj extends Subscription {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.1",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.11.
|
|
44
|
-
"@thi.ng/arrays": "^2.10.
|
|
45
|
-
"@thi.ng/associative": "^7.0.
|
|
46
|
-
"@thi.ng/atom": "^5.3.
|
|
47
|
-
"@thi.ng/checks": "^3.6.
|
|
48
|
-
"@thi.ng/errors": "^2.5.
|
|
49
|
-
"@thi.ng/logger": "^3.0.
|
|
50
|
-
"@thi.ng/transducers": "^9.2.
|
|
43
|
+
"@thi.ng/api": "^8.11.14",
|
|
44
|
+
"@thi.ng/arrays": "^2.10.7",
|
|
45
|
+
"@thi.ng/associative": "^7.0.16",
|
|
46
|
+
"@thi.ng/atom": "^5.3.14",
|
|
47
|
+
"@thi.ng/checks": "^3.6.16",
|
|
48
|
+
"@thi.ng/errors": "^2.5.20",
|
|
49
|
+
"@thi.ng/logger": "^3.0.24",
|
|
50
|
+
"@thi.ng/transducers": "^9.2.10"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@microsoft/api-extractor": "^7.48.0",
|
|
54
54
|
"esbuild": "^0.24.0",
|
|
55
|
-
"typedoc": "^0.
|
|
55
|
+
"typedoc": "^0.27.4",
|
|
56
56
|
"typescript": "^5.7.2"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
@@ -219,5 +219,5 @@
|
|
|
219
219
|
],
|
|
220
220
|
"year": 2017
|
|
221
221
|
},
|
|
222
|
-
"gitHead": "
|
|
222
|
+
"gitHead": "34ac95538d96f046090fef5fd3a1dc36d54663d5\n"
|
|
223
223
|
}
|