@thi.ng/rstream 8.4.2 → 8.5.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/CHANGELOG.md +8 -1
- package/README.md +2 -1
- package/async.js +5 -10
- package/package.json +14 -14
- package/raf.js +1 -2
- package/stream.js +1 -2
- package/subscription.js +4 -8
- package/sync-raf.js +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-05-08T18:24:31Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [8.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.5.0) (2024-05-08)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add rdom-klist example project, update readmes ([cd458ac](https://github.com/thi-ng/umbrella/commit/cd458ac))
|
|
17
|
+
- add rdom-klist example project, update readmes ([531437f](https://github.com/thi-ng/umbrella/commit/531437f))
|
|
18
|
+
|
|
12
19
|
### [8.4.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.4.1) (2024-04-20)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -214,7 +214,7 @@ For Node.js REPL:
|
|
|
214
214
|
const rs = await import("@thi.ng/rstream");
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 6.
|
|
217
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 6.33 KB
|
|
218
218
|
|
|
219
219
|
## Dependencies
|
|
220
220
|
|
|
@@ -265,6 +265,7 @@ directory are using this package:
|
|
|
265
265
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-delayed-update.jpg" width="240"/> | Dynamically loaded images w/ preloader state | [Demo](https://demo.thi.ng/umbrella/rdom-delayed-update/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-delayed-update) |
|
|
266
266
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-formgen.jpg" width="240"/> | Basic usage of the declarative rdom-forms generator | [Demo](https://demo.thi.ng/umbrella/rdom-formgen/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-formgen) |
|
|
267
267
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-key-sequences.jpg" width="240"/> | rstream & transducer-based FSM for converting key event sequences into high-level commands | [Demo](https://demo.thi.ng/umbrella/rdom-key-sequences/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-key-sequences) |
|
|
268
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-klist.png" width="240"/> | Basic usage of thi.ng/rdom keyed list component wrapper | [Demo](https://demo.thi.ng/umbrella/rdom-klist/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-klist) |
|
|
268
269
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-lissajous.png" width="240"/> | rdom & hiccup-canvas interop test | [Demo](https://demo.thi.ng/umbrella/rdom-lissajous/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-lissajous) |
|
|
269
270
|
| | Full umbrella repo doc string search w/ paginated results | [Demo](https://demo.thi.ng/umbrella/rdom-search-docs/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-search-docs) |
|
|
270
271
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rdom-svg-nodes.png" width="240"/> | rdom powered SVG graph with draggable nodes | [Demo](https://demo.thi.ng/umbrella/rdom-svg-nodes/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rdom-svg-nodes) |
|
package/async.js
CHANGED
|
@@ -6,8 +6,7 @@ const fromAsync = (src, opts) => stream(($stream) => {
|
|
|
6
6
|
(async () => {
|
|
7
7
|
try {
|
|
8
8
|
for await (let x of src) {
|
|
9
|
-
if (!active)
|
|
10
|
-
return;
|
|
9
|
+
if (!active) return;
|
|
11
10
|
$stream.next(x);
|
|
12
11
|
}
|
|
13
12
|
$stream.done();
|
|
@@ -31,23 +30,19 @@ async function* asAsync(src) {
|
|
|
31
30
|
if (initial) {
|
|
32
31
|
resolve(x);
|
|
33
32
|
initial = void 0;
|
|
34
|
-
} else
|
|
35
|
-
promises.push(Promise.resolve(x));
|
|
33
|
+
} else promises.push(Promise.resolve(x));
|
|
36
34
|
},
|
|
37
35
|
done() {
|
|
38
36
|
if (initial) {
|
|
39
37
|
resolve(SEMAPHORE);
|
|
40
38
|
initial = void 0;
|
|
41
|
-
} else
|
|
42
|
-
promises.push(Promise.resolve(SEMAPHORE));
|
|
39
|
+
} else promises.push(Promise.resolve(SEMAPHORE));
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
42
|
while (promises.length && src.getState() < State.ERROR) {
|
|
46
43
|
const res = await promises.shift();
|
|
47
|
-
if (res === SEMAPHORE)
|
|
48
|
-
|
|
49
|
-
if (!promises.length)
|
|
50
|
-
promises[0] = $newInitial();
|
|
44
|
+
if (res === SEMAPHORE) break;
|
|
45
|
+
if (!promises.length) promises[0] = $newInitial();
|
|
51
46
|
yield res;
|
|
52
47
|
}
|
|
53
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,20 +40,20 @@
|
|
|
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.9.
|
|
45
|
-
"@thi.ng/associative": "^6.3.
|
|
46
|
-
"@thi.ng/atom": "^5.
|
|
47
|
-
"@thi.ng/checks": "^3.6.
|
|
48
|
-
"@thi.ng/errors": "^2.5.
|
|
49
|
-
"@thi.ng/logger": "^3.0.
|
|
50
|
-
"@thi.ng/transducers": "^9.0.
|
|
43
|
+
"@thi.ng/api": "^8.11.2",
|
|
44
|
+
"@thi.ng/arrays": "^2.9.6",
|
|
45
|
+
"@thi.ng/associative": "^6.3.60",
|
|
46
|
+
"@thi.ng/atom": "^5.3.0",
|
|
47
|
+
"@thi.ng/checks": "^3.6.4",
|
|
48
|
+
"@thi.ng/errors": "^2.5.7",
|
|
49
|
+
"@thi.ng/logger": "^3.0.12",
|
|
50
|
+
"@thi.ng/transducers": "^9.0.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.43.
|
|
54
|
-
"esbuild": "^0.
|
|
55
|
-
"typedoc": "^0.25.
|
|
56
|
-
"typescript": "^5.4.
|
|
53
|
+
"@microsoft/api-extractor": "^7.43.2",
|
|
54
|
+
"esbuild": "^0.21.1",
|
|
55
|
+
"typedoc": "^0.25.13",
|
|
56
|
+
"typescript": "^5.4.5"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
59
59
|
"async",
|
|
@@ -218,5 +218,5 @@
|
|
|
218
218
|
],
|
|
219
219
|
"year": 2017
|
|
220
220
|
},
|
|
221
|
-
"gitHead": "
|
|
221
|
+
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
|
|
222
222
|
}
|
package/raf.js
CHANGED
|
@@ -9,8 +9,7 @@ const fromRAF = (opts = {}) => isNode() ? fromInterval(16, opts) : stream((strea
|
|
|
9
9
|
let t0 = isNumber(opts.t0) ? opts.t0 : void 0;
|
|
10
10
|
const loop = (time) => {
|
|
11
11
|
if (opts.timestamp && opts.t0) {
|
|
12
|
-
if (t0 === void 0)
|
|
13
|
-
t0 = time;
|
|
12
|
+
if (t0 === void 0) t0 = time;
|
|
14
13
|
time -= t0;
|
|
15
14
|
}
|
|
16
15
|
isActive && stream2.next(opts.timestamp ? time : i++);
|
package/stream.js
CHANGED
package/subscription.js
CHANGED
|
@@ -121,17 +121,14 @@ class Subscription {
|
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
123
|
next(x) {
|
|
124
|
-
if (this.state >= State.DONE)
|
|
125
|
-
return;
|
|
124
|
+
if (this.state >= State.DONE) return;
|
|
126
125
|
this.xform ? this.dispatchXform(x) : this.dispatch(x);
|
|
127
126
|
}
|
|
128
127
|
done() {
|
|
129
128
|
LOGGER.debug(this.id, "entering done()");
|
|
130
|
-
if (this.state >= State.DONE)
|
|
131
|
-
return;
|
|
129
|
+
if (this.state >= State.DONE) return;
|
|
132
130
|
if (this.xform) {
|
|
133
|
-
if (!this.dispatchXformDone())
|
|
134
|
-
return;
|
|
131
|
+
if (!this.dispatchXformDone()) return;
|
|
135
132
|
}
|
|
136
133
|
this.state = State.DONE;
|
|
137
134
|
if (this.dispatchTo("done")) {
|
|
@@ -161,8 +158,7 @@ class Subscription {
|
|
|
161
158
|
try {
|
|
162
159
|
s[type] && s[type](x);
|
|
163
160
|
} catch (e) {
|
|
164
|
-
if (!this.error(e))
|
|
165
|
-
return false;
|
|
161
|
+
if (!this.error(e)) return false;
|
|
166
162
|
}
|
|
167
163
|
}
|
|
168
164
|
const subs = type === "next" ? this.subs : [...this.subs];
|
package/sync-raf.js
CHANGED
|
@@ -10,13 +10,11 @@ class SyncRAF extends Subscription {
|
|
|
10
10
|
super(void 0, opts);
|
|
11
11
|
}
|
|
12
12
|
next(x) {
|
|
13
|
-
if (this.state >= State.DONE)
|
|
14
|
-
return;
|
|
13
|
+
if (this.state >= State.DONE) return;
|
|
15
14
|
this.queued = x;
|
|
16
15
|
if (!this.raf) {
|
|
17
16
|
const update = () => {
|
|
18
|
-
if (this.state < State.DONE)
|
|
19
|
-
super.next(this.queued);
|
|
17
|
+
if (this.state < State.DONE) super.next(this.queued);
|
|
20
18
|
this._clean();
|
|
21
19
|
};
|
|
22
20
|
this.raf = isNode() ? setTimeout(update, 16) : requestAnimationFrame(update);
|