@thi.ng/rstream 8.1.10 → 8.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 +7 -1
- package/README.md +3 -1
- package/event.d.ts +10 -2
- package/event.js +9 -5
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-10-
|
|
3
|
+
- **Last updated**: 2023-10-23T07:37:37Z
|
|
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,12 @@ 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.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.2.0) (2023-10-18)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add EventOpts, update fromEvent()/fromDOMEvent() ([49e5143](https://github.com/thi-ng/umbrella/commit/49e5143))
|
|
17
|
+
|
|
12
18
|
## [8.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rstream@8.1.0) (2023-08-22)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -198,7 +198,7 @@ For Node.js REPL:
|
|
|
198
198
|
const rstream = await import("@thi.ng/rstream");
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
201
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.86 KB
|
|
202
202
|
|
|
203
203
|
## Dependencies
|
|
204
204
|
|
|
@@ -248,6 +248,7 @@ A selection:
|
|
|
248
248
|
| <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) |
|
|
249
249
|
| | 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) |
|
|
250
250
|
| <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) |
|
|
251
|
+
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/related-images.jpg" width="240"/> | Responsive image gallery with tag-based Jaccard similarity ranking | [Demo](https://demo.thi.ng/umbrella/related-images/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/related-images) |
|
|
251
252
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/render-audio.png" width="240"/> | Generative audio synth offline renderer and WAV file export | [Demo](https://demo.thi.ng/umbrella/render-audio/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/render-audio) |
|
|
252
253
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rotating-voronoi.jpg" width="240"/> | Animated Voronoi diagram, cubic splines & SVG download | [Demo](https://demo.thi.ng/umbrella/rotating-voronoi/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rotating-voronoi) |
|
|
253
254
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-event-loop.png" width="240"/> | Minimal demo of using rstream constructs to form an interceptor-style event loop | [Demo](https://demo.thi.ng/umbrella/rstream-event-loop/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-event-loop) |
|
|
@@ -256,6 +257,7 @@ A selection:
|
|
|
256
257
|
| <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) |
|
|
257
258
|
| <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) |
|
|
258
259
|
| <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) |
|
|
260
|
+
| <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) |
|
|
259
261
|
| <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) |
|
|
260
262
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/svg-resample.png" width="240"/> | SVG path parsing & dynamic resampling | [Demo](https://demo.thi.ng/umbrella/svg-resample/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/svg-resample) |
|
|
261
263
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/talk-slides.png" width="240"/> | hdom based slide deck viewer & slides from my ClojureX 2018 keynote | [Demo](http://media.thi.ng/2018/talks/clojurex/index.html) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/talk-slides) |
|
package/event.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { CommonOpts } from "./api.js";
|
|
2
2
|
import { Stream } from "./stream.js";
|
|
3
|
+
interface EventOpts<T extends Event = Event> extends CommonOpts {
|
|
4
|
+
/**
|
|
5
|
+
* If given, the event stream will be seeded with this (presumably
|
|
6
|
+
* compatible event-like) value.
|
|
7
|
+
*/
|
|
8
|
+
init: T;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Creates a {@link Stream} of events attached to given element / event
|
|
5
12
|
* target and using given event listener options (same as supported by
|
|
@@ -10,7 +17,7 @@ import { Stream } from "./stream.js";
|
|
|
10
17
|
* @param listenerOpts - listener opts
|
|
11
18
|
* @param streamOpts - stream opts
|
|
12
19
|
*/
|
|
13
|
-
export declare const fromEvent: (src: EventTarget, name: string, listenerOpts?: boolean | AddEventListenerOptions, streamOpts?: Partial<
|
|
20
|
+
export declare const fromEvent: (src: EventTarget, name: string, listenerOpts?: boolean | AddEventListenerOptions, streamOpts?: Partial<EventOpts>) => Stream<Event>;
|
|
14
21
|
/**
|
|
15
22
|
* Same as {@link fromEvent}, however only supports well-known DOM event
|
|
16
23
|
* names. Returned stream instance will use corresponding concrete event
|
|
@@ -30,5 +37,6 @@ export declare const fromEvent: (src: EventTarget, name: string, listenerOpts?:
|
|
|
30
37
|
* @param listenerOpts -
|
|
31
38
|
* @param streamOpts -
|
|
32
39
|
*/
|
|
33
|
-
export declare const fromDOMEvent: <K extends keyof GlobalEventHandlersEventMap>(src: EventTarget, name: K, listenerOpts?: boolean | AddEventListenerOptions, streamOpts?: Partial<
|
|
40
|
+
export declare const fromDOMEvent: <K extends keyof GlobalEventHandlersEventMap>(src: EventTarget, name: K, listenerOpts?: boolean | AddEventListenerOptions, streamOpts?: Partial<EventOpts<GlobalEventHandlersEventMap[K]>> | undefined) => Stream<GlobalEventHandlersEventMap[K]>;
|
|
41
|
+
export {};
|
|
34
42
|
//# sourceMappingURL=event.d.ts.map
|
package/event.js
CHANGED
|
@@ -10,11 +10,15 @@ import { stream, Stream } from "./stream.js";
|
|
|
10
10
|
* @param listenerOpts - listener opts
|
|
11
11
|
* @param streamOpts - stream opts
|
|
12
12
|
*/
|
|
13
|
-
export const fromEvent = (src, name, listenerOpts = false, streamOpts) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export const fromEvent = (src, name, listenerOpts = false, streamOpts) => {
|
|
14
|
+
const result = stream((stream) => {
|
|
15
|
+
let listener = (e) => stream.next(e);
|
|
16
|
+
src.addEventListener(name, listener, listenerOpts);
|
|
17
|
+
return () => src.removeEventListener(name, listener, listenerOpts);
|
|
18
|
+
}, __optsWithID(`event-${name}`, streamOpts));
|
|
19
|
+
streamOpts?.init !== undefined && result.next(streamOpts.init);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
18
22
|
/**
|
|
19
23
|
* Same as {@link fromEvent}, however only supports well-known DOM event
|
|
20
24
|
* names. Returned stream instance will use corresponding concrete event
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "8.1
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"test": "testament test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.9.
|
|
42
|
-
"@thi.ng/arrays": "^2.6.
|
|
43
|
-
"@thi.ng/associative": "^6.3.
|
|
44
|
-
"@thi.ng/atom": "^5.2.
|
|
45
|
-
"@thi.ng/checks": "^3.4.
|
|
46
|
-
"@thi.ng/errors": "^2.3.
|
|
47
|
-
"@thi.ng/logger": "^1.4.
|
|
48
|
-
"@thi.ng/transducers": "^8.8.
|
|
41
|
+
"@thi.ng/api": "^8.9.6",
|
|
42
|
+
"@thi.ng/arrays": "^2.6.4",
|
|
43
|
+
"@thi.ng/associative": "^6.3.12",
|
|
44
|
+
"@thi.ng/atom": "^5.2.10",
|
|
45
|
+
"@thi.ng/checks": "^3.4.6",
|
|
46
|
+
"@thi.ng/errors": "^2.3.6",
|
|
47
|
+
"@thi.ng/logger": "^1.4.22",
|
|
48
|
+
"@thi.ng/transducers": "^8.8.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@microsoft/api-extractor": "^7.
|
|
52
|
-
"@thi.ng/testament": "^0.3.
|
|
53
|
-
"rimraf": "^5.0.
|
|
51
|
+
"@microsoft/api-extractor": "^7.38.0",
|
|
52
|
+
"@thi.ng/testament": "^0.3.24",
|
|
53
|
+
"rimraf": "^5.0.5",
|
|
54
54
|
"tools": "^0.0.1",
|
|
55
|
-
"typedoc": "^0.25.
|
|
55
|
+
"typedoc": "^0.25.2",
|
|
56
56
|
"typescript": "^5.2.2"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
@@ -214,5 +214,5 @@
|
|
|
214
214
|
],
|
|
215
215
|
"year": 2017
|
|
216
216
|
},
|
|
217
|
-
"gitHead": "
|
|
217
|
+
"gitHead": "8d46d9326a9f9b81d65e7e274446f5964f9942ac\n"
|
|
218
218
|
}
|