@thi.ng/rstream 8.2.25 → 8.3.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 +8 -1
- package/README.md +12 -1
- package/metastream.d.ts +1 -1
- package/package.json +13 -13
- package/raf.d.ts +8 -0
- package/raf.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-02-10T08:59:57Z
|
|
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.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.3.0) (2024-02-06)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update fromRAF() & opts ([27f4cde](https://github.com/thi-ng/umbrella/commit/27f4cde))
|
|
17
|
+
- update timestamp handling/opts
|
|
18
|
+
|
|
12
19
|
### [8.2.8](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.2.8) (2023-11-09)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
<!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> ‼️ Announcing the thi.ng user survey 2024 📋
|
|
5
|
+
>
|
|
6
|
+
> [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
|
|
7
|
+
> (open until end of February)
|
|
8
|
+
>
|
|
9
|
+
> **To achieve a better sample size, I'd highly appreciate if you could
|
|
10
|
+
> circulate the link to this survey in your own networks.**
|
|
11
|
+
>
|
|
12
|
+
> [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
|
|
3
13
|
|
|
4
14
|
# 
|
|
5
15
|
|
|
@@ -203,7 +213,7 @@ For Node.js REPL:
|
|
|
203
213
|
const rstream = await import("@thi.ng/rstream");
|
|
204
214
|
```
|
|
205
215
|
|
|
206
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 6.
|
|
216
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 6.15 KB
|
|
207
217
|
|
|
208
218
|
## Dependencies
|
|
209
219
|
|
|
@@ -264,6 +274,7 @@ directory are using this package:
|
|
|
264
274
|
| | rstream based UI updates & state handling | [Demo](https://demo.thi.ng/umbrella/rstream-hdom/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-hdom) |
|
|
265
275
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-spreadsheet.png" width="240"/> | rstream based spreadsheet w/ S-expression formula DSL | [Demo](https://demo.thi.ng/umbrella/rstream-spreadsheet/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-spreadsheet) |
|
|
266
276
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-sync.png" width="240"/> | Minimal rstream sync() example using rdom | [Demo](https://demo.thi.ng/umbrella/rstream-sync/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-sync) |
|
|
277
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-system-bus.png" width="240"/> | Declarative component-based system with central rstream-based pubsub event bus | [Demo](https://demo.thi.ng/umbrella/rstream-system-bus/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-system-bus) |
|
|
267
278
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/shader-ast-workers.jpg" width="240"/> | Fork-join worker-based raymarch renderer (JS/CPU only) | [Demo](https://demo.thi.ng/umbrella/shader-ast-workers/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/shader-ast-workers) |
|
|
268
279
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/simd-plot.png" width="240"/> | Fitting, transforming & plotting 10k data points per frame using SIMD | [Demo](https://demo.thi.ng/umbrella/simd-plot/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/simd-plot) |
|
|
269
280
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/stacked-layout.png" width="240"/> | Responsive & reactively computed stacked column layout | [Demo](https://demo.thi.ng/umbrella/stacked-layout/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/stacked-layout) |
|
package/metastream.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface MetaStreamOpts extends CommonOpts {
|
|
|
40
40
|
* // transform each received odd number into a stream
|
|
41
41
|
* // producing 3 copies of that number in the metastream
|
|
42
42
|
* // even numbers are ignored
|
|
43
|
-
* a =
|
|
43
|
+
* a = metaStream(
|
|
44
44
|
* (x) => (x & 1)
|
|
45
45
|
* ? fromIterable(tx.repeat(x, 3), { delay: 100 })
|
|
46
46
|
* : null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"test": "bun test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.9.
|
|
43
|
-
"@thi.ng/arrays": "^2.7.
|
|
44
|
-
"@thi.ng/associative": "^6.3.
|
|
45
|
-
"@thi.ng/atom": "^5.2.
|
|
46
|
-
"@thi.ng/checks": "^3.4.
|
|
47
|
-
"@thi.ng/errors": "^2.4.
|
|
48
|
-
"@thi.ng/logger": "^2.1.
|
|
49
|
-
"@thi.ng/transducers": "^8.
|
|
42
|
+
"@thi.ng/api": "^8.9.23",
|
|
43
|
+
"@thi.ng/arrays": "^2.7.20",
|
|
44
|
+
"@thi.ng/associative": "^6.3.37",
|
|
45
|
+
"@thi.ng/atom": "^5.2.30",
|
|
46
|
+
"@thi.ng/checks": "^3.4.23",
|
|
47
|
+
"@thi.ng/errors": "^2.4.16",
|
|
48
|
+
"@thi.ng/logger": "^2.1.10",
|
|
49
|
+
"@thi.ng/transducers": "^8.9.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@microsoft/api-extractor": "^7.
|
|
53
|
-
"esbuild": "^0.
|
|
52
|
+
"@microsoft/api-extractor": "^7.40.1",
|
|
53
|
+
"esbuild": "^0.20.0",
|
|
54
54
|
"rimraf": "^5.0.5",
|
|
55
|
-
"typedoc": "^0.25.
|
|
55
|
+
"typedoc": "^0.25.7",
|
|
56
56
|
"typescript": "^5.3.3"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
@@ -214,5 +214,5 @@
|
|
|
214
214
|
],
|
|
215
215
|
"year": 2017
|
|
216
216
|
},
|
|
217
|
-
"gitHead": "
|
|
217
|
+
"gitHead": "e5e7d5c6ed2eadee7a91d59cbd0c86ce880ab1c5\n"
|
|
218
218
|
}
|
package/raf.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export interface FromRAFOpts extends CommonOpts {
|
|
|
8
8
|
* @defaultValue false
|
|
9
9
|
*/
|
|
10
10
|
timestamp: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Only used if {@link FromRAFOpts.timestamp} is enabled. If given as
|
|
13
|
+
* number, the value will be subtracted from all emitted timestamps. If this
|
|
14
|
+
* option is set to true, the timestamps will be automatically zero-adjusted
|
|
15
|
+
* such that the first emitted value will be zero. If undefined (default),
|
|
16
|
+
* the browser supplied timestamps will be used as is.
|
|
17
|
+
*/
|
|
18
|
+
t0: number | boolean;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
* Yields {@link Stream} of a monotonically increasing counter (or timestamps),
|
package/raf.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { isNode } from "@thi.ng/checks/is-node";
|
|
2
|
+
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
3
|
import { __optsWithID } from "./idgen.js";
|
|
3
4
|
import { fromInterval } from "./interval.js";
|
|
4
5
|
import { stream } from "./stream.js";
|
|
5
6
|
const fromRAF = (opts = {}) => isNode() ? fromInterval(16, opts) : stream((stream2) => {
|
|
6
7
|
let i = 0;
|
|
7
8
|
let isActive = true;
|
|
9
|
+
let t0 = isNumber(opts.t0) ? opts.t0 : void 0;
|
|
8
10
|
const loop = (time) => {
|
|
11
|
+
if (opts.timestamp && opts.t0) {
|
|
12
|
+
if (t0 === void 0)
|
|
13
|
+
t0 = time;
|
|
14
|
+
time -= t0;
|
|
15
|
+
}
|
|
9
16
|
isActive && stream2.next(opts.timestamp ? time : i++);
|
|
10
17
|
isActive && (id = requestAnimationFrame(loop));
|
|
11
18
|
};
|