@thi.ng/rdom 0.8.5 → 0.8.8
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 +2 -2
- package/api.d.ts +7 -7
- package/compile.d.ts +1 -1
- package/compile.js +1 -1
- package/dom.d.ts +18 -18
- package/dom.js +21 -21
- package/event.d.ts +4 -4
- package/event.js +4 -4
- package/klist.d.ts +5 -5
- package/klist.js +5 -5
- package/list.d.ts +5 -5
- package/list.js +5 -5
- package/object.d.ts +5 -5
- package/object.js +5 -5
- package/package.json +30 -30
- package/promise.d.ts +2 -2
- package/promise.js +2 -2
- package/replace.d.ts +1 -1
- package/replace.js +1 -1
- package/scheduler.d.ts +1 -2
- package/scheduler.js +1 -2
- package/sub.d.ts +2 -2
- package/switch.d.ts +9 -9
- package/switch.js +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**:
|
|
3
|
+
- **Last updated**: 2022-05-07T11:33:36Z
|
|
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
|
+
### [0.8.7](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@0.8.7) (2022-04-07)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- replace deprecated .substr() w/ .substring() ([0710509](https://github.com/thi-ng/umbrella/commit/0710509))
|
|
17
|
+
|
|
12
18
|
### [0.8.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom@0.8.1) (2021-11-19)
|
|
13
19
|
|
|
14
20
|
#### 🩹 Bug fixes
|
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ node --experimental-repl-await
|
|
|
173
173
|
> const rdom = await import("@thi.ng/rdom");
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
Package sizes (gzipped, pre-treeshake): ESM: 4.
|
|
176
|
+
Package sizes (gzipped, pre-treeshake): ESM: 4.08 KB
|
|
177
177
|
|
|
178
178
|
## Dependencies
|
|
179
179
|
|
|
@@ -274,4 +274,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
274
274
|
|
|
275
275
|
## License
|
|
276
276
|
|
|
277
|
-
© 2020 -
|
|
277
|
+
© 2020 - 2022 Karsten Schmidt // Apache Software License 2.0
|
package/api.d.ts
CHANGED
|
@@ -61,16 +61,16 @@ export interface IMountWith<T, M> extends IComponent<T> {
|
|
|
61
61
|
* Component mount lifecycle method which also receives initial
|
|
62
62
|
* state value, presumably meant for populating component.
|
|
63
63
|
*
|
|
64
|
-
* @param parent
|
|
65
|
-
* @param index
|
|
66
|
-
* @param state
|
|
64
|
+
* @param parent -
|
|
65
|
+
* @param index -
|
|
66
|
+
* @param state -
|
|
67
67
|
*/
|
|
68
68
|
mount(parent: Element, index: NumOrElement, state: M): Promise<Element>;
|
|
69
69
|
/**
|
|
70
70
|
* Same like {@link IComponent.update}, but new `state` value arg is
|
|
71
71
|
* mandatory.
|
|
72
72
|
*
|
|
73
|
-
* @param state
|
|
73
|
+
* @param state -
|
|
74
74
|
*/
|
|
75
75
|
update(state: T): void;
|
|
76
76
|
}
|
|
@@ -101,15 +101,15 @@ export interface IScheduler {
|
|
|
101
101
|
* Registers a new task for processing. The `scope` arg is used to uniquely
|
|
102
102
|
* associate the task with a given component.
|
|
103
103
|
*
|
|
104
|
-
* @param scope
|
|
105
|
-
* @param task
|
|
104
|
+
* @param scope -
|
|
105
|
+
* @param task -
|
|
106
106
|
*/
|
|
107
107
|
add(scope: any, task: Task): void;
|
|
108
108
|
/**
|
|
109
109
|
* Attempts to cancel all tasks for given `scope`. Depending on
|
|
110
110
|
* implementation and timing this might not be possible (anymore).
|
|
111
111
|
*
|
|
112
|
-
* @param scope
|
|
112
|
+
* @param scope -
|
|
113
113
|
*/
|
|
114
114
|
cancel(scope: any): void;
|
|
115
115
|
}
|
package/compile.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { IComponent } from "./api.js";
|
|
|
18
18
|
* will be wrapped using a {@link $sub} `<span>` with the value as its
|
|
19
19
|
* reactive body.
|
|
20
20
|
*
|
|
21
|
-
* @param tree
|
|
21
|
+
* @param tree -
|
|
22
22
|
*/
|
|
23
23
|
export declare const $compile: (tree: any) => IComponent;
|
|
24
24
|
//# sourceMappingURL=compile.d.ts.map
|
package/compile.js
CHANGED
package/dom.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ import type { NumOrElement } from "./api.js";
|
|
|
18
18
|
* Any other values will be cast to strings and added as spans to
|
|
19
19
|
* current `parent`.
|
|
20
20
|
*
|
|
21
|
-
* @param tree
|
|
22
|
-
* @param parent
|
|
23
|
-
* @param idx
|
|
21
|
+
* @param tree -
|
|
22
|
+
* @param parent -
|
|
23
|
+
* @param idx -
|
|
24
24
|
*/
|
|
25
25
|
export declare const $tree: (tree: any, parent: Element, idx?: NumOrElement) => Promise<any>;
|
|
26
26
|
/**
|
|
@@ -34,11 +34,11 @@ export declare const $tree: (tree: any, parent: Element, idx?: NumOrElement) =>
|
|
|
34
34
|
* If `parent` is given, but no `idx` arg, the new element will be
|
|
35
35
|
* appended as child.
|
|
36
36
|
*
|
|
37
|
-
* @param tag
|
|
38
|
-
* @param attribs
|
|
39
|
-
* @param body
|
|
40
|
-
* @param parent
|
|
41
|
-
* @param idx
|
|
37
|
+
* @param tag -
|
|
38
|
+
* @param attribs -
|
|
39
|
+
* @param body -
|
|
40
|
+
* @param parent -
|
|
41
|
+
* @param idx -
|
|
42
42
|
*/
|
|
43
43
|
export declare const $el: (tag: string, attribs: any, body?: any, parent?: Element | undefined, idx?: NumOrElement) => Element;
|
|
44
44
|
export declare const $addChild: (parent: Element, child: Element, idx?: NumOrElement) => void;
|
|
@@ -50,16 +50,16 @@ export declare const $clear: (el: Element) => Element;
|
|
|
50
50
|
* {@link @thi.ng/api#IDeref} it'll be automatically deref'd. For SVG elements a
|
|
51
51
|
* new child text DOM node will be created.
|
|
52
52
|
*
|
|
53
|
-
* @param el
|
|
54
|
-
* @param body
|
|
53
|
+
* @param el -
|
|
54
|
+
* @param body -
|
|
55
55
|
*/
|
|
56
56
|
export declare const $text: (el: HTMLElement, body: any) => void;
|
|
57
57
|
/**
|
|
58
58
|
* Same as `el.innerHtml = body`, use with caution! If `body` is an
|
|
59
59
|
* {@link @thi.ng/api#IDeref} it'll be automatically deref'd.
|
|
60
60
|
*
|
|
61
|
-
* @param el
|
|
62
|
-
* @param body
|
|
61
|
+
* @param el -
|
|
62
|
+
* @param body -
|
|
63
63
|
*/
|
|
64
64
|
export declare const $html: (el: HTMLElement, body: MaybeDeref<string>) => void;
|
|
65
65
|
/**
|
|
@@ -91,8 +91,8 @@ export declare const $html: (el: HTMLElement, body: MaybeDeref<string>) => void;
|
|
|
91
91
|
* Depending on element type the `value` attribute will be updated
|
|
92
92
|
* keeping the current cursor position / selection intact.
|
|
93
93
|
*
|
|
94
|
-
* @param el
|
|
95
|
-
* @param attribs
|
|
94
|
+
* @param el -
|
|
95
|
+
* @param attribs -
|
|
96
96
|
*/
|
|
97
97
|
export declare const $attribs: (el: Element, attribs: any) => void;
|
|
98
98
|
/**
|
|
@@ -106,16 +106,16 @@ export declare const $attribs: (el: Element, attribs: any) => void;
|
|
|
106
106
|
* function, it will be called with the entire `rules` object as arg and
|
|
107
107
|
* the return value used.
|
|
108
108
|
*
|
|
109
|
-
* @param el
|
|
110
|
-
* @param rules
|
|
109
|
+
* @param el -
|
|
110
|
+
* @param rules -
|
|
111
111
|
*/
|
|
112
112
|
export declare const $style: (el: Element, rules: string | any) => void;
|
|
113
113
|
/**
|
|
114
114
|
* Registers an XML namespace prefix and its URL for later use, e.g. to
|
|
115
115
|
* define namespaced elements/attributes.
|
|
116
116
|
*
|
|
117
|
-
* @param prefix
|
|
118
|
-
* @param url
|
|
117
|
+
* @param prefix -
|
|
118
|
+
* @param url -
|
|
119
119
|
*/
|
|
120
120
|
export declare const registerPrefix: (prefix: string, url: string) => void;
|
|
121
121
|
//# sourceMappingURL=dom.d.ts.map
|
package/dom.js
CHANGED
|
@@ -30,9 +30,9 @@ import { isComponent } from "./checks.js";
|
|
|
30
30
|
* Any other values will be cast to strings and added as spans to
|
|
31
31
|
* current `parent`.
|
|
32
32
|
*
|
|
33
|
-
* @param tree
|
|
34
|
-
* @param parent
|
|
35
|
-
* @param idx
|
|
33
|
+
* @param tree -
|
|
34
|
+
* @param parent -
|
|
35
|
+
* @param idx -
|
|
36
36
|
*/
|
|
37
37
|
export const $tree = async (tree, parent, idx = -1) => isArray(tree)
|
|
38
38
|
? $treeElem(tree, parent, idx)
|
|
@@ -94,11 +94,11 @@ const $treeIter = (tree, parent) => {
|
|
|
94
94
|
* If `parent` is given, but no `idx` arg, the new element will be
|
|
95
95
|
* appended as child.
|
|
96
96
|
*
|
|
97
|
-
* @param tag
|
|
98
|
-
* @param attribs
|
|
99
|
-
* @param body
|
|
100
|
-
* @param parent
|
|
101
|
-
* @param idx
|
|
97
|
+
* @param tag -
|
|
98
|
+
* @param attribs -
|
|
99
|
+
* @param body -
|
|
100
|
+
* @param parent -
|
|
101
|
+
* @param idx -
|
|
102
102
|
*/
|
|
103
103
|
export const $el = (tag, attribs, body, parent, idx = -1) => {
|
|
104
104
|
const match = RE_TAG.exec(tag);
|
|
@@ -114,7 +114,7 @@ export const $el = (tag, attribs, body, parent, idx = -1) => {
|
|
|
114
114
|
: document.createElement(tag);
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
|
-
el = document.createElementNS(PREFIXES[tag.
|
|
117
|
+
el = document.createElementNS(PREFIXES[tag.substring(0, qidx)], tag);
|
|
118
118
|
}
|
|
119
119
|
attribs && $attribs(el, attribs);
|
|
120
120
|
body != null && $text(el, body);
|
|
@@ -139,8 +139,8 @@ export const $clear = (el) => ((el.innerHTML = ""), el);
|
|
|
139
139
|
* {@link @thi.ng/api#IDeref} it'll be automatically deref'd. For SVG elements a
|
|
140
140
|
* new child text DOM node will be created.
|
|
141
141
|
*
|
|
142
|
-
* @param el
|
|
143
|
-
* @param body
|
|
142
|
+
* @param el -
|
|
143
|
+
* @param body -
|
|
144
144
|
*/
|
|
145
145
|
export const $text = (el, body) => {
|
|
146
146
|
body = String(deref(body));
|
|
@@ -155,8 +155,8 @@ export const $text = (el, body) => {
|
|
|
155
155
|
* Same as `el.innerHtml = body`, use with caution! If `body` is an
|
|
156
156
|
* {@link @thi.ng/api#IDeref} it'll be automatically deref'd.
|
|
157
157
|
*
|
|
158
|
-
* @param el
|
|
159
|
-
* @param body
|
|
158
|
+
* @param el -
|
|
159
|
+
* @param body -
|
|
160
160
|
*/
|
|
161
161
|
export const $html = (el, body) => {
|
|
162
162
|
el.innerHTML = String(deref(body));
|
|
@@ -190,8 +190,8 @@ export const $html = (el, body) => {
|
|
|
190
190
|
* Depending on element type the `value` attribute will be updated
|
|
191
191
|
* keeping the current cursor position / selection intact.
|
|
192
192
|
*
|
|
193
|
-
* @param el
|
|
194
|
-
* @param attribs
|
|
193
|
+
* @param el -
|
|
194
|
+
* @param attribs -
|
|
195
195
|
*/
|
|
196
196
|
export const $attribs = (el, attribs) => {
|
|
197
197
|
for (let id in attribs) {
|
|
@@ -206,7 +206,7 @@ const setAttrib = (el, id, val, attribs) => {
|
|
|
206
206
|
el.setAttribute(id, val);
|
|
207
207
|
}
|
|
208
208
|
else {
|
|
209
|
-
id = id.
|
|
209
|
+
id = id.substring(2);
|
|
210
210
|
isArray(val)
|
|
211
211
|
? el.addEventListener(id, val[0], val[1])
|
|
212
212
|
: el.addEventListener(id, val);
|
|
@@ -261,7 +261,7 @@ const setAttrib = (el, id, val, attribs) => {
|
|
|
261
261
|
: el.setAttribute(id, val);
|
|
262
262
|
}
|
|
263
263
|
else {
|
|
264
|
-
const ns = PREFIXES[id.
|
|
264
|
+
const ns = PREFIXES[id.substring(0, idx)];
|
|
265
265
|
val === false || val == null
|
|
266
266
|
? el.removeAttributeNS(ns, id)
|
|
267
267
|
: el.setAttributeNS(ns, id, val);
|
|
@@ -313,8 +313,8 @@ const updateDataAttribs = (el, attribs) => {
|
|
|
313
313
|
* function, it will be called with the entire `rules` object as arg and
|
|
314
314
|
* the return value used.
|
|
315
315
|
*
|
|
316
|
-
* @param el
|
|
317
|
-
* @param rules
|
|
316
|
+
* @param el -
|
|
317
|
+
* @param rules -
|
|
318
318
|
*/
|
|
319
319
|
export const $style = (el, rules) => {
|
|
320
320
|
if (isString(rules)) {
|
|
@@ -341,8 +341,8 @@ const PREFIXES = {
|
|
|
341
341
|
* Registers an XML namespace prefix and its URL for later use, e.g. to
|
|
342
342
|
* define namespaced elements/attributes.
|
|
343
343
|
*
|
|
344
|
-
* @param prefix
|
|
345
|
-
* @param url
|
|
344
|
+
* @param prefix -
|
|
345
|
+
* @param url -
|
|
346
346
|
*/
|
|
347
347
|
export const registerPrefix = (prefix, url) => {
|
|
348
348
|
assert(!PREFIXES[prefix], `${prefix} already registered: ${PREFIXES[prefix]}`);
|
package/event.d.ts
CHANGED
|
@@ -26,28 +26,28 @@ export declare const $inputNum: (stream: ISubscriber<number>, fallback?: number)
|
|
|
26
26
|
/**
|
|
27
27
|
* HOF DOM event listener to emit a checkbox input's value on given stream.
|
|
28
28
|
*
|
|
29
|
-
* @param stream
|
|
29
|
+
* @param stream -
|
|
30
30
|
*/
|
|
31
31
|
export declare const $inputCheckbox: (stream: ISubscriber<boolean>) => (e: Event) => void;
|
|
32
32
|
/**
|
|
33
33
|
* HOF DOM event listener to emit `true` on given stream when event is
|
|
34
34
|
* triggered.
|
|
35
35
|
*
|
|
36
|
-
* @param stream
|
|
36
|
+
* @param stream -
|
|
37
37
|
*/
|
|
38
38
|
export declare const $inputTrigger: (stream: ISubscriber<boolean>) => () => void;
|
|
39
39
|
/**
|
|
40
40
|
* HOF DOM event listener to emit a file input's first selected file on given
|
|
41
41
|
* stream.
|
|
42
42
|
*
|
|
43
|
-
* @param stream
|
|
43
|
+
* @param stream -
|
|
44
44
|
*/
|
|
45
45
|
export declare const $inputFile: (stream: ISubscriber<File>) => (e: Event) => void;
|
|
46
46
|
/**
|
|
47
47
|
* HOF DOM event listener to emit a file input's entire selected list of files
|
|
48
48
|
* on given stream.
|
|
49
49
|
*
|
|
50
|
-
* @param stream
|
|
50
|
+
* @param stream -
|
|
51
51
|
*/
|
|
52
52
|
export declare const $inputFiles: (stream: ISubscriber<FileList>) => (e: Event) => void;
|
|
53
53
|
//# sourceMappingURL=event.d.ts.map
|
package/event.js
CHANGED
|
@@ -26,27 +26,27 @@ export const $inputNum = (stream, fallback = 0) => (e) => stream.next(maybeParse
|
|
|
26
26
|
/**
|
|
27
27
|
* HOF DOM event listener to emit a checkbox input's value on given stream.
|
|
28
28
|
*
|
|
29
|
-
* @param stream
|
|
29
|
+
* @param stream -
|
|
30
30
|
*/
|
|
31
31
|
export const $inputCheckbox = (stream) => (e) => stream.next(e.target.checked);
|
|
32
32
|
/**
|
|
33
33
|
* HOF DOM event listener to emit `true` on given stream when event is
|
|
34
34
|
* triggered.
|
|
35
35
|
*
|
|
36
|
-
* @param stream
|
|
36
|
+
* @param stream -
|
|
37
37
|
*/
|
|
38
38
|
export const $inputTrigger = (stream) => () => stream.next(true);
|
|
39
39
|
/**
|
|
40
40
|
* HOF DOM event listener to emit a file input's first selected file on given
|
|
41
41
|
* stream.
|
|
42
42
|
*
|
|
43
|
-
* @param stream
|
|
43
|
+
* @param stream -
|
|
44
44
|
*/
|
|
45
45
|
export const $inputFile = (stream) => (e) => stream.next(e.target.files[0]);
|
|
46
46
|
/**
|
|
47
47
|
* HOF DOM event listener to emit a file input's entire selected list of files
|
|
48
48
|
* on given stream.
|
|
49
49
|
*
|
|
50
|
-
* @param stream
|
|
50
|
+
* @param stream -
|
|
51
51
|
*/
|
|
52
52
|
export const $inputFiles = (stream) => (e) => stream.next(e.target.files);
|
package/klist.d.ts
CHANGED
|
@@ -36,11 +36,11 @@ interface KListItem {
|
|
|
36
36
|
* items.next([{id: "b"}, {id: "d"}, {id: "c"}]);
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* @param src
|
|
40
|
-
* @param tag
|
|
41
|
-
* @param attribs
|
|
42
|
-
* @param childCtor
|
|
43
|
-
* @param keyFn
|
|
39
|
+
* @param src -
|
|
40
|
+
* @param tag -
|
|
41
|
+
* @param attribs -
|
|
42
|
+
* @param childCtor -
|
|
43
|
+
* @param keyFn -
|
|
44
44
|
*/
|
|
45
45
|
export declare const $klist: <T>(src: ISubscribable<T[]>, tag: string, attribs: any, childCtor: Fn<T, any>, keyFn?: Fn2<T, number, NumOrString> | undefined) => IComponent<T[]>;
|
|
46
46
|
export declare class KList<T> extends Component<T[]> implements IMountWithState<T[]> {
|
package/klist.js
CHANGED
|
@@ -32,11 +32,11 @@ import { $sub } from "./sub.js";
|
|
|
32
32
|
* items.next([{id: "b"}, {id: "d"}, {id: "c"}]);
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
* @param src
|
|
36
|
-
* @param tag
|
|
37
|
-
* @param attribs
|
|
38
|
-
* @param childCtor
|
|
39
|
-
* @param keyFn
|
|
35
|
+
* @param src -
|
|
36
|
+
* @param tag -
|
|
37
|
+
* @param attribs -
|
|
38
|
+
* @param childCtor -
|
|
39
|
+
* @param keyFn -
|
|
40
40
|
*/
|
|
41
41
|
export const $klist = (src, tag, attribs, childCtor, keyFn) => $sub(src, new KList(tag, attribs, childCtor, keyFn));
|
|
42
42
|
export class KList extends Component {
|
package/list.d.ts
CHANGED
|
@@ -43,11 +43,11 @@ import { Component } from "./component.js";
|
|
|
43
43
|
* ```
|
|
44
44
|
*
|
|
45
45
|
*
|
|
46
|
-
* @param src
|
|
47
|
-
* @param tag
|
|
48
|
-
* @param attribs
|
|
49
|
-
* @param ctor
|
|
50
|
-
* @param equiv
|
|
46
|
+
* @param src -
|
|
47
|
+
* @param tag -
|
|
48
|
+
* @param attribs -
|
|
49
|
+
* @param ctor -
|
|
50
|
+
* @param equiv -
|
|
51
51
|
*/
|
|
52
52
|
export declare const $list: <T>(src: ISubscribable<T[]>, tag: string, attribs: any, ctor: Fn<T, any>, equiv?: Predicate2<T> | undefined) => IComponent<T[]>;
|
|
53
53
|
export declare class List<T> extends Component implements IMountWithState<T[]> {
|
package/list.js
CHANGED
|
@@ -42,11 +42,11 @@ import { $sub } from "./sub.js";
|
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
*
|
|
45
|
-
* @param src
|
|
46
|
-
* @param tag
|
|
47
|
-
* @param attribs
|
|
48
|
-
* @param ctor
|
|
49
|
-
* @param equiv
|
|
45
|
+
* @param src -
|
|
46
|
+
* @param tag -
|
|
47
|
+
* @param attribs -
|
|
48
|
+
* @param ctor -
|
|
49
|
+
* @param equiv -
|
|
50
50
|
*/
|
|
51
51
|
export const $list = (src, tag, attribs, ctor, equiv) => $sub(src, new List(tag, attribs, ctor, equiv));
|
|
52
52
|
export class List extends Component {
|
package/object.d.ts
CHANGED
|
@@ -37,9 +37,9 @@ import { Component } from "./component.js";
|
|
|
37
37
|
* obj.update({ id: "b", name: "bar" });
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
-
* @param src
|
|
40
|
+
* @param src -
|
|
41
41
|
* @param opts - options for `fromObject()` stream setup
|
|
42
|
-
* @param inner
|
|
42
|
+
* @param inner -
|
|
43
43
|
*/
|
|
44
44
|
export declare const $object: <T, K extends keyof T>(src: T, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<import("@thi.ng/rstream").KeyStreams<T, K>, Promise<ComponentLike>>) => $Object<T, K>;
|
|
45
45
|
/**
|
|
@@ -67,9 +67,9 @@ export declare const $object: <T, K extends keyof T>(src: T, opts: Partial<Strea
|
|
|
67
67
|
* state.next({ id: "b", name: "bar" });
|
|
68
68
|
* ```
|
|
69
69
|
*
|
|
70
|
-
* @param src
|
|
71
|
-
* @param opts
|
|
72
|
-
* @param inner
|
|
70
|
+
* @param src -
|
|
71
|
+
* @param opts -
|
|
72
|
+
* @param inner -
|
|
73
73
|
*/
|
|
74
74
|
export declare const $subObject: <T, K extends keyof T>(src: ISubscribable<T>, opts: Partial<StreamObjOpts<T, K>>, inner: Fn<import("@thi.ng/rstream").KeyStreams<T, K>, Promise<ComponentLike>>) => IComponent<T>;
|
|
75
75
|
export declare class $Object<T, K extends Keys<T>> extends Component implements IMountWithState<T> {
|
package/object.js
CHANGED
|
@@ -36,9 +36,9 @@ import { $sub } from "./sub.js";
|
|
|
36
36
|
* obj.update({ id: "b", name: "bar" });
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* @param src
|
|
39
|
+
* @param src -
|
|
40
40
|
* @param opts - options for `fromObject()` stream setup
|
|
41
|
-
* @param inner
|
|
41
|
+
* @param inner -
|
|
42
42
|
*/
|
|
43
43
|
export const $object = (src, opts, inner) => new $Object(src, opts, inner);
|
|
44
44
|
/**
|
|
@@ -66,9 +66,9 @@ export const $object = (src, opts, inner) => new $Object(src, opts, inner);
|
|
|
66
66
|
* state.next({ id: "b", name: "bar" });
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
|
-
* @param src
|
|
70
|
-
* @param opts
|
|
71
|
-
* @param inner
|
|
69
|
+
* @param src -
|
|
70
|
+
* @param opts -
|
|
71
|
+
* @param inner -
|
|
72
72
|
*/
|
|
73
73
|
export const $subObject = (src, opts, inner) => $sub(src, $object(src.deref() || {}, opts, inner));
|
|
74
74
|
export class $Object extends Component {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rdom",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"test": "testament test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.3.
|
|
39
|
-
"@thi.ng/checks": "^3.1.
|
|
40
|
-
"@thi.ng/errors": "^2.1.
|
|
41
|
-
"@thi.ng/hiccup": "^4.2.
|
|
42
|
-
"@thi.ng/paths": "^5.1.
|
|
43
|
-
"@thi.ng/prefixes": "^2.1.
|
|
44
|
-
"@thi.ng/rstream": "^7.2.
|
|
45
|
-
"@thi.ng/strings": "^3.3.
|
|
38
|
+
"@thi.ng/api": "^8.3.6",
|
|
39
|
+
"@thi.ng/checks": "^3.1.6",
|
|
40
|
+
"@thi.ng/errors": "^2.1.6",
|
|
41
|
+
"@thi.ng/hiccup": "^4.2.7",
|
|
42
|
+
"@thi.ng/paths": "^5.1.6",
|
|
43
|
+
"@thi.ng/prefixes": "^2.1.6",
|
|
44
|
+
"@thi.ng/rstream": "^7.2.5",
|
|
45
|
+
"@thi.ng/strings": "^3.3.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@microsoft/api-extractor": "^7.
|
|
49
|
-
"@thi.ng/testament": "^0.2.
|
|
48
|
+
"@microsoft/api-extractor": "^7.23.1",
|
|
49
|
+
"@thi.ng/testament": "^0.2.6",
|
|
50
50
|
"rimraf": "^3.0.2",
|
|
51
51
|
"tools": "^0.0.1",
|
|
52
|
-
"typedoc": "^0.22.
|
|
53
|
-
"typescript": "^4.
|
|
52
|
+
"typedoc": "^0.22.15",
|
|
53
|
+
"typescript": "^4.6.4"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|
|
56
56
|
"async",
|
|
@@ -81,52 +81,52 @@
|
|
|
81
81
|
],
|
|
82
82
|
"exports": {
|
|
83
83
|
".": {
|
|
84
|
-
"
|
|
84
|
+
"default": "./index.js"
|
|
85
85
|
},
|
|
86
86
|
"./api": {
|
|
87
|
-
"
|
|
87
|
+
"default": "./api.js"
|
|
88
88
|
},
|
|
89
89
|
"./checks": {
|
|
90
|
-
"
|
|
90
|
+
"default": "./checks.js"
|
|
91
91
|
},
|
|
92
92
|
"./compile": {
|
|
93
|
-
"
|
|
93
|
+
"default": "./compile.js"
|
|
94
94
|
},
|
|
95
95
|
"./component": {
|
|
96
|
-
"
|
|
96
|
+
"default": "./component.js"
|
|
97
97
|
},
|
|
98
98
|
"./dom": {
|
|
99
|
-
"
|
|
99
|
+
"default": "./dom.js"
|
|
100
100
|
},
|
|
101
101
|
"./event": {
|
|
102
|
-
"
|
|
102
|
+
"default": "./event.js"
|
|
103
103
|
},
|
|
104
104
|
"./klist": {
|
|
105
|
-
"
|
|
105
|
+
"default": "./klist.js"
|
|
106
106
|
},
|
|
107
107
|
"./list": {
|
|
108
|
-
"
|
|
108
|
+
"default": "./list.js"
|
|
109
109
|
},
|
|
110
110
|
"./object": {
|
|
111
|
-
"
|
|
111
|
+
"default": "./object.js"
|
|
112
112
|
},
|
|
113
113
|
"./promise": {
|
|
114
|
-
"
|
|
114
|
+
"default": "./promise.js"
|
|
115
115
|
},
|
|
116
116
|
"./replace": {
|
|
117
|
-
"
|
|
117
|
+
"default": "./replace.js"
|
|
118
118
|
},
|
|
119
119
|
"./scheduler": {
|
|
120
|
-
"
|
|
120
|
+
"default": "./scheduler.js"
|
|
121
121
|
},
|
|
122
122
|
"./sub": {
|
|
123
|
-
"
|
|
123
|
+
"default": "./sub.js"
|
|
124
124
|
},
|
|
125
125
|
"./switch": {
|
|
126
|
-
"
|
|
126
|
+
"default": "./switch.js"
|
|
127
127
|
},
|
|
128
128
|
"./wrap": {
|
|
129
|
-
"
|
|
129
|
+
"default": "./wrap.js"
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
"thi.ng": {
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"status": "beta",
|
|
141
141
|
"year": 2020
|
|
142
142
|
},
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "cf084be5fd5932226054d2dd32bad35481379f5d\n"
|
|
144
144
|
}
|
package/promise.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ import { Component } from "./component.js";
|
|
|
15
15
|
* $promise(prom).mount(document.body);
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
-
* @param prom
|
|
19
|
-
* @param error
|
|
18
|
+
* @param prom -
|
|
19
|
+
* @param error -
|
|
20
20
|
*/
|
|
21
21
|
export declare const $promise: (prom: Promise<ComponentLike>, error?: Fn<Error, any> | undefined) => $Promise;
|
|
22
22
|
export declare class $Promise extends Component {
|
package/promise.js
CHANGED
|
@@ -13,8 +13,8 @@ import { Component } from "./component.js";
|
|
|
13
13
|
* $promise(prom).mount(document.body);
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* @param prom
|
|
17
|
-
* @param error
|
|
16
|
+
* @param prom -
|
|
17
|
+
* @param error -
|
|
18
18
|
*/
|
|
19
19
|
export const $promise = (prom, error) => new $Promise(prom, error);
|
|
20
20
|
export class $Promise extends Component {
|
package/replace.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ import { Component } from "./component.js";
|
|
|
31
31
|
* $compile($replace(counter)).mount(document.body);
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
|
-
* @param src
|
|
34
|
+
* @param src -
|
|
35
35
|
*/
|
|
36
36
|
export declare const $replace: <T>(src: ISubscribable<T>) => IComponent<T>;
|
|
37
37
|
export declare class Replace<T> extends Component implements IMountWithState<T> {
|
package/replace.js
CHANGED
package/scheduler.d.ts
CHANGED
|
@@ -30,8 +30,7 @@ export declare let SCHEDULER: IScheduler;
|
|
|
30
30
|
/**
|
|
31
31
|
* Sets rdom-global scheduler for component updates (and other tasks).
|
|
32
32
|
*
|
|
33
|
-
* @param s
|
|
34
|
-
* @returns
|
|
33
|
+
* @param s -
|
|
35
34
|
*/
|
|
36
35
|
export declare const setScheduler: (s: IScheduler) => IScheduler;
|
|
37
36
|
//# sourceMappingURL=scheduler.d.ts.map
|
package/scheduler.js
CHANGED
package/sub.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ import type { IComponent, IMountWithState, NumOrElement } from "./api.js";
|
|
|
22
22
|
* src.next(43);
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* @param src
|
|
26
|
-
* @param inner
|
|
25
|
+
* @param src -
|
|
26
|
+
* @param inner -
|
|
27
27
|
*/
|
|
28
28
|
export declare function $sub<T>(src: ISubscribable<T>, inner: IMountWithState<T>): IComponent<T>;
|
|
29
29
|
export declare function $sub(src: ISubscribable<any>, tag: string, attribs?: any): IComponent;
|
package/switch.d.ts
CHANGED
|
@@ -48,11 +48,11 @@ import { Component } from "./component.js";
|
|
|
48
48
|
* components, however only two are defined, causing the last option to
|
|
49
49
|
* throw an error and so trigger/use the error component.
|
|
50
50
|
*
|
|
51
|
-
* @param src
|
|
52
|
-
* @param keyFn
|
|
53
|
-
* @param ctors
|
|
54
|
-
* @param error
|
|
55
|
-
* @param loader
|
|
51
|
+
* @param src -
|
|
52
|
+
* @param keyFn -
|
|
53
|
+
* @param ctors -
|
|
54
|
+
* @param error -
|
|
55
|
+
* @param loader -
|
|
56
56
|
*/
|
|
57
57
|
export declare const $switch: <T>(src: ISubscribable<T>, keyFn: Fn<T, NumOrString>, ctors: Record<NumOrString, Fn<T, Promise<any>>>, error?: Fn<Error, Promise<any>> | undefined, loader?: Fn<T, Promise<any>> | undefined) => IComponent<T>;
|
|
58
58
|
/**
|
|
@@ -72,10 +72,10 @@ export declare const $switch: <T>(src: ISubscribable<T>, keyFn: Fn<T, NumOrStrin
|
|
|
72
72
|
* $refresh(fromInterval(1000), async (x) => ["div", {}, x])
|
|
73
73
|
* ```
|
|
74
74
|
*
|
|
75
|
-
* @param src
|
|
76
|
-
* @param ctor
|
|
77
|
-
* @param error
|
|
78
|
-
* @param loader
|
|
75
|
+
* @param src -
|
|
76
|
+
* @param ctor -
|
|
77
|
+
* @param error -
|
|
78
|
+
* @param loader -
|
|
79
79
|
*/
|
|
80
80
|
export declare const $refresh: <T>(src: ISubscribable<T>, ctor: Fn<T, Promise<any>>, error?: Fn<Error, Promise<any>> | undefined, loader?: Fn<T, Promise<any>> | undefined) => IComponent<T>;
|
|
81
81
|
export declare class Switch<T> extends Component implements IMountWithState<T> {
|
package/switch.js
CHANGED
|
@@ -49,11 +49,11 @@ import { $wrapText } from "./wrap.js";
|
|
|
49
49
|
* components, however only two are defined, causing the last option to
|
|
50
50
|
* throw an error and so trigger/use the error component.
|
|
51
51
|
*
|
|
52
|
-
* @param src
|
|
53
|
-
* @param keyFn
|
|
54
|
-
* @param ctors
|
|
55
|
-
* @param error
|
|
56
|
-
* @param loader
|
|
52
|
+
* @param src -
|
|
53
|
+
* @param keyFn -
|
|
54
|
+
* @param ctors -
|
|
55
|
+
* @param error -
|
|
56
|
+
* @param loader -
|
|
57
57
|
*/
|
|
58
58
|
export const $switch = (src, keyFn, ctors, error, loader) => $sub(src, new Switch(keyFn, ctors, error, loader));
|
|
59
59
|
/**
|
|
@@ -73,10 +73,10 @@ export const $switch = (src, keyFn, ctors, error, loader) => $sub(src, new Switc
|
|
|
73
73
|
* $refresh(fromInterval(1000), async (x) => ["div", {}, x])
|
|
74
74
|
* ```
|
|
75
75
|
*
|
|
76
|
-
* @param src
|
|
77
|
-
* @param ctor
|
|
78
|
-
* @param error
|
|
79
|
-
* @param loader
|
|
76
|
+
* @param src -
|
|
77
|
+
* @param ctor -
|
|
78
|
+
* @param error -
|
|
79
|
+
* @param loader -
|
|
80
80
|
*/
|
|
81
81
|
export const $refresh = (src, ctor, error, loader) => $switch(src, () => 0, { 0: ctor }, error, loader);
|
|
82
82
|
export class Switch extends Component {
|