@thi.ng/rdom 0.6.9 → 0.7.4
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 +50 -32
- package/README.md +16 -7
- package/checks.d.ts +3 -0
- package/checks.js +2 -0
- package/compile.d.ts +1 -1
- package/compile.js +8 -6
- package/component.d.ts +1 -1
- package/component.js +2 -2
- package/dom.d.ts +2 -2
- package/dom.js +15 -7
- package/event.js +1 -1
- package/index.d.ts +15 -14
- package/index.js +15 -14
- package/klist.d.ts +2 -2
- package/klist.js +4 -4
- package/list.d.ts +2 -2
- package/list.js +3 -3
- package/object.d.ts +3 -3
- package/object.js +3 -3
- package/package.json +80 -29
- package/promise.d.ts +2 -2
- package/promise.js +1 -1
- package/replace.d.ts +45 -0
- package/replace.js +62 -0
- package/scheduler.d.ts +1 -1
- package/sub.d.ts +3 -2
- package/sub.js +9 -8
- package/switch.d.ts +3 -3
- package/switch.js +5 -5
- package/wrap.d.ts +1 -1
- package/wrap.js +2 -2
- package/lib/index.js +0 -753
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
- package/utils.d.ts +0 -5
- package/utils.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.
|
|
6
|
+
## [0.7.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.7.3...@thi.ng/rdom@0.7.4) (2021-10-25)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @thi.ng/rdom
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
## [0.
|
|
14
|
+
## [0.7.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.7.2...@thi.ng/rdom@0.7.3) (2021-10-15)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @thi.ng/rdom
|
|
17
17
|
|
|
@@ -19,84 +19,102 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* **rdom:** add $inputFile/Files() handlers ([7f8888b](https://github.com/thi-ng/umbrella/commit/7f8888b0f0857aa9abde8ca6ea666a6f37bb64f2))
|
|
28
|
-
|
|
22
|
+
## [0.7.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.7.1...@thi.ng/rdom@0.7.2) (2021-10-15)
|
|
29
23
|
|
|
24
|
+
**Note:** Version bump only for package @thi.ng/rdom
|
|
30
25
|
|
|
31
26
|
|
|
32
27
|
|
|
33
|
-
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.4.17...@thi.ng/rdom@0.5.0) (2021-07-27)
|
|
34
28
|
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
## [0.7.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.7.0...@thi.ng/rdom@0.7.1) (2021-10-13)
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
**Note:** Version bump only for package @thi.ng/rdom
|
|
39
33
|
|
|
40
34
|
|
|
41
|
-
### Features
|
|
42
35
|
|
|
43
|
-
* **rdom:** relax return types for $switch() ([71c334b](https://github.com/thi-ng/umbrella/commit/71c334bfc5715e58296750e9d118927dce53406a))
|
|
44
36
|
|
|
45
37
|
|
|
38
|
+
# [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.6.9...@thi.ng/rdom@0.7.0) (2021-10-12)
|
|
46
39
|
|
|
47
40
|
|
|
41
|
+
### Build System
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
50
44
|
|
|
51
45
|
|
|
52
46
|
### Features
|
|
53
47
|
|
|
54
|
-
* **rdom:** add $
|
|
48
|
+
* **rdom:** add $replace() control/wrapper ([6096357](https://github.com/thi-ng/umbrella/commit/609635729a7d92d087a59684e00d19e609c5927f))
|
|
55
49
|
|
|
56
50
|
|
|
51
|
+
### BREAKING CHANGES
|
|
57
52
|
|
|
53
|
+
* discontinue CommonJS & UMD versions
|
|
58
54
|
|
|
55
|
+
- only ESM modules will be published from now on
|
|
56
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
57
|
+
- i.e. launch NodeJS via:
|
|
58
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
59
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
60
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
Also:
|
|
63
|
+
- normalize/restructure/reorg all package.json files
|
|
64
|
+
- cleanup all build scripts, remove obsolete
|
|
65
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
61
66
|
|
|
62
67
|
|
|
63
|
-
### Bug Fixes
|
|
64
68
|
|
|
65
|
-
* **rdom:** add stream IDs for $Sub/$SubA ([e8b8fd4](https://github.com/thi-ng/umbrella/commit/e8b8fd4785f9836f0270bbc01dc216c2c87d2e8d))
|
|
66
69
|
|
|
67
70
|
|
|
68
71
|
|
|
72
|
+
# [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.5.0...@thi.ng/rdom@0.6.0) (2021-08-04)
|
|
69
73
|
|
|
74
|
+
### Features
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
- **rdom:** add $inputFile/Files() handlers ([7f8888b](https://github.com/thi-ng/umbrella/commit/7f8888b0f0857aa9abde8ca6ea666a6f37bb64f2))
|
|
72
77
|
|
|
78
|
+
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.4.17...@thi.ng/rdom@0.5.0) (2021-07-27)
|
|
73
79
|
|
|
74
|
-
###
|
|
80
|
+
### Bug Fixes
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
- **rdom:** fix [#304](https://github.com/thi-ng/umbrella/issues/304), update Switch.update() ([a2899c0](https://github.com/thi-ng/umbrella/commit/a2899c09b62458edd75dd785b64db0519b85eb6d))
|
|
77
83
|
|
|
84
|
+
### Features
|
|
78
85
|
|
|
86
|
+
- **rdom:** relax return types for $switch() ([71c334b](https://github.com/thi-ng/umbrella/commit/71c334bfc5715e58296750e9d118927dce53406a))
|
|
79
87
|
|
|
88
|
+
# [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.3.9...@thi.ng/rdom@0.4.0) (2021-02-24)
|
|
80
89
|
|
|
90
|
+
### Features
|
|
81
91
|
|
|
82
|
-
|
|
92
|
+
- **rdom:** add $inputCheckbox, $inputTrigger ([99c569e](https://github.com/thi-ng/umbrella/commit/99c569e629018d679bae0f9d07fbde8ddd4f16cc))
|
|
83
93
|
|
|
94
|
+
## [0.3.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.3.8...@thi.ng/rdom@0.3.9) (2021-02-22)
|
|
84
95
|
|
|
85
|
-
###
|
|
96
|
+
### Bug Fixes
|
|
86
97
|
|
|
87
|
-
|
|
88
|
-
* **rdom:** add $promise() wrapper ([53f9688](https://github.com/thi-ng/umbrella/commit/53f96881094603b885a409b8965b491468a3c247))
|
|
98
|
+
- **rdom:** add stream IDs for $Sub/$SubA ([e8b8fd4](https://github.com/thi-ng/umbrella/commit/e8b8fd4785f9836f0270bbc01dc216c2c87d2e8d))
|
|
89
99
|
|
|
100
|
+
# [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.2.16...@thi.ng/rdom@0.3.0) (2020-12-07)
|
|
90
101
|
|
|
102
|
+
### Features
|
|
91
103
|
|
|
104
|
+
- **rdom:** add $subObject() wrapper, add docs ([cd5cf08](https://github.com/thi-ng/umbrella/commit/cd5cf08d6ae0ffb5ff8a89a19918a563fb889cbd))
|
|
92
105
|
|
|
106
|
+
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rdom@0.1.2...@thi.ng/rdom@0.2.0) (2020-07-08)
|
|
93
107
|
|
|
94
|
-
|
|
108
|
+
### Features
|
|
95
109
|
|
|
110
|
+
- **rdom:** add $input, $inputNum event listeners ([c29fb49](https://github.com/thi-ng/umbrella/commit/c29fb49824429ba1175deca30fbfe693d6fd689d))
|
|
111
|
+
- **rdom:** add $promise() wrapper ([53f9688](https://github.com/thi-ng/umbrella/commit/53f96881094603b885a409b8965b491468a3c247))
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
# 0.1.0 (2020-07-02)
|
|
114
|
+
|
|
115
|
+
### Features
|
|
98
116
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
117
|
+
- **rdom:** add RDFa `prefix` attrib support, update prefix handling ([b589da5](https://github.com/thi-ng/umbrella/commit/b589da51385957a5defffb66307bd3d750814e4c))
|
|
118
|
+
- **rdom:** add support for namespaced el/attribs ([9d16ef0](https://github.com/thi-ng/umbrella/commit/9d16ef0a2f6d6a062bf164ca38813290d7660149))
|
|
119
|
+
- **rdom:** rename hdom2020 => rdom, update pkg ([1224706](https://github.com/thi-ng/umbrella/commit/1224706fa2fbca82afb73afeda3c3075c9b35f91))
|
|
120
|
+
- **rdom:** update $tree() span handling, update $moveTo() ([6d90187](https://github.com/thi-ng/umbrella/commit/6d9018763af7f0f2096cdc1d79889791193a01e0))
|
package/README.md
CHANGED
|
@@ -134,8 +134,8 @@ integration has been removed in favor of using relevant
|
|
|
134
134
|
[@thi.ng/rstream](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream)
|
|
135
135
|
constructs, which can be used as lightweight adapters, i.e.:
|
|
136
136
|
|
|
137
|
-
- [`fromAtom()`](https://
|
|
138
|
-
- [`fromView()`](https://
|
|
137
|
+
- [`fromAtom()`](https://docs.thi.ng/umbrella/rstream/modules.html#fromAtom)
|
|
138
|
+
- [`fromView()`](https://docs.thi.ng/umbrella/rstream/modules.html#fromView)
|
|
139
139
|
|
|
140
140
|
### Support packages
|
|
141
141
|
|
|
@@ -156,15 +156,24 @@ constructs, which can be used as lightweight adapters, i.e.:
|
|
|
156
156
|
yarn add @thi.ng/rdom
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
ES module import:
|
|
160
|
+
|
|
159
161
|
```html
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/rdom"></script>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
166
|
+
|
|
167
|
+
For Node.js REPL:
|
|
168
|
+
|
|
169
|
+
```text
|
|
170
|
+
# with flag only for < v16
|
|
171
|
+
node --experimental-repl-await
|
|
162
172
|
|
|
163
|
-
|
|
164
|
-
<script src="https://unpkg.com/@thi.ng/rdom/lib/index.umd.js" crossorigin></script>
|
|
173
|
+
> const rdom = await import("@thi.ng/rdom");
|
|
165
174
|
```
|
|
166
175
|
|
|
167
|
-
Package sizes (gzipped, pre-treeshake): ESM: 3.
|
|
176
|
+
Package sizes (gzipped, pre-treeshake): ESM: 3.98 KB
|
|
168
177
|
|
|
169
178
|
## Dependencies
|
|
170
179
|
|
package/checks.d.ts
ADDED
package/checks.js
ADDED
package/compile.d.ts
CHANGED
package/compile.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { isArray
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
|
+
import { isPlainObject } from "@thi.ng/checks/is-plain-object";
|
|
3
|
+
import { isSubscribable } from "@thi.ng/rstream/checks";
|
|
4
|
+
import { isComponent } from "./checks.js";
|
|
5
|
+
import { $el, $remove, $tree } from "./dom.js";
|
|
6
|
+
import { SCHEDULER } from "./scheduler.js";
|
|
7
|
+
import { $sub, $SubA } from "./sub.js";
|
|
8
|
+
import { $wrapText } from "./wrap.js";
|
|
7
9
|
/**
|
|
8
10
|
* Compiles a tree of components given in any supported format incl.
|
|
9
11
|
* reactive state values into a single, nested {@link IComponent}.
|
package/component.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MaybeDeref } from "@thi.ng/api";
|
|
2
|
-
import type { IComponent, NumOrElement } from "./api";
|
|
2
|
+
import type { IComponent, NumOrElement } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class / {@link IComponent} implementation. Provides
|
|
5
5
|
* additional convenience methods for DOM element creation &
|
package/component.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $compile } from "./compile";
|
|
2
|
-
import { $attribs, $clear, $el, $html, $moveTo, $remove, $style, $text, $tree, } from "./dom";
|
|
1
|
+
import { $compile } from "./compile.js";
|
|
2
|
+
import { $attribs, $clear, $el, $html, $moveTo, $remove, $style, $text, $tree, } from "./dom.js";
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class / {@link IComponent} implementation. Provides
|
|
5
5
|
* additional convenience methods for DOM element creation &
|
package/dom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MaybeDeref } from "@thi.ng/api";
|
|
2
|
-
import type { NumOrElement } from "./api";
|
|
1
|
+
import { MaybeDeref } from "@thi.ng/api/deref";
|
|
2
|
+
import type { NumOrElement } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* hdom-style DOM tree creation from hiccup format. Returns DOM element
|
|
5
5
|
* of `tree` root. See {@link $el} for further details.
|
package/dom.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { implementsFunction
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { deref, isDeref } from "@thi.ng/api/deref";
|
|
2
|
+
import { implementsFunction } from "@thi.ng/checks/implements-function";
|
|
3
|
+
import { isArray } from "@thi.ng/checks/is-array";
|
|
4
|
+
import { isFunction } from "@thi.ng/checks/is-function";
|
|
5
|
+
import { isNotStringAndIterable } from "@thi.ng/checks/is-not-string-iterable";
|
|
6
|
+
import { isNumber } from "@thi.ng/checks/is-number";
|
|
7
|
+
import { isString } from "@thi.ng/checks/is-string";
|
|
8
|
+
import { assert } from "@thi.ng/errors/assert";
|
|
9
|
+
import { unsupported } from "@thi.ng/errors/unsupported";
|
|
10
|
+
import { ATTRIB_JOIN_DELIMS, NO_SPANS, RE_TAG, SVG_TAGS, } from "@thi.ng/hiccup/api";
|
|
11
|
+
import { mergeClasses, mergeEmmetAttribs } from "@thi.ng/hiccup/attribs";
|
|
12
|
+
import { formatPrefixes } from "@thi.ng/hiccup/prefix";
|
|
13
|
+
import { XML_SVG, XML_XLINK, XML_XMLNS } from "@thi.ng/prefixes/xml";
|
|
14
|
+
import { isComponent } from "./checks.js";
|
|
7
15
|
/**
|
|
8
16
|
* hdom-style DOM tree creation from hiccup format. Returns DOM element
|
|
9
17
|
* of `tree` root. See {@link $el} for further details.
|
|
@@ -95,7 +103,7 @@ const $treeIter = (tree, parent) => {
|
|
|
95
103
|
export const $el = (tag, attribs, body, parent, idx = -1) => {
|
|
96
104
|
const match = RE_TAG.exec(tag);
|
|
97
105
|
if (match) {
|
|
98
|
-
attribs = mergeEmmetAttribs(
|
|
106
|
+
attribs = mergeEmmetAttribs({ ...attribs }, match[2], match[3]);
|
|
99
107
|
tag = match[1];
|
|
100
108
|
}
|
|
101
109
|
let el;
|
package/event.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./checks.js";
|
|
3
|
+
export * from "./compile.js";
|
|
4
|
+
export * from "./component.js";
|
|
5
|
+
export * from "./dom.js";
|
|
6
|
+
export * from "./event.js";
|
|
7
|
+
export * from "./klist.js";
|
|
8
|
+
export * from "./list.js";
|
|
9
|
+
export * from "./object.js";
|
|
10
|
+
export * from "./promise.js";
|
|
11
|
+
export * from "./replace.js";
|
|
12
|
+
export * from "./scheduler.js";
|
|
13
|
+
export * from "./sub.js";
|
|
14
|
+
export * from "./switch.js";
|
|
15
|
+
export * from "./wrap.js";
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./checks.js";
|
|
3
|
+
export * from "./compile.js";
|
|
4
|
+
export * from "./component.js";
|
|
5
|
+
export * from "./dom.js";
|
|
6
|
+
export * from "./event.js";
|
|
7
|
+
export * from "./klist.js";
|
|
8
|
+
export * from "./list.js";
|
|
9
|
+
export * from "./object.js";
|
|
10
|
+
export * from "./promise.js";
|
|
11
|
+
export * from "./replace.js";
|
|
12
|
+
export * from "./scheduler.js";
|
|
13
|
+
export * from "./sub.js";
|
|
14
|
+
export * from "./switch.js";
|
|
15
|
+
export * from "./wrap.js";
|
package/klist.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Fn, Fn2, NumOrString } from "@thi.ng/api";
|
|
2
2
|
import type { ISubscribable } from "@thi.ng/rstream";
|
|
3
|
-
import type { IComponent, IMountWithState, NumOrElement } from "./api";
|
|
4
|
-
import { Component } from "./component";
|
|
3
|
+
import type { IComponent, IMountWithState, NumOrElement } from "./api.js";
|
|
4
|
+
import { Component } from "./component.js";
|
|
5
5
|
interface KListItem {
|
|
6
6
|
k: NumOrString;
|
|
7
7
|
v: IComponent;
|
package/klist.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $compile } from "./compile";
|
|
2
|
-
import { Component } from "./component";
|
|
3
|
-
import { $moveTo } from "./dom";
|
|
4
|
-
import { $sub } from "./sub";
|
|
1
|
+
import { $compile } from "./compile.js";
|
|
2
|
+
import { Component } from "./component.js";
|
|
3
|
+
import { $moveTo } from "./dom.js";
|
|
4
|
+
import { $sub } from "./sub.js";
|
|
5
5
|
/**
|
|
6
6
|
* Similar to {@link $list}, however additionally uses keying to establish list
|
|
7
7
|
* item identities and uses them in a more complex diffing algorithm to avoid
|
package/list.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Fn, Predicate2 } from "@thi.ng/api";
|
|
2
2
|
import type { ISubscribable } from "@thi.ng/rstream";
|
|
3
|
-
import type { IComponent, IMountWithState, NumOrElement } from "./api";
|
|
4
|
-
import { Component } from "./component";
|
|
3
|
+
import type { IComponent, IMountWithState, NumOrElement } from "./api.js";
|
|
4
|
+
import { Component } from "./component.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a generalized and dynamically updating list component from items of
|
|
7
7
|
* the given `src` stream.
|
package/list.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $compile } from "./compile";
|
|
2
|
-
import { Component } from "./component";
|
|
3
|
-
import { $sub } from "./sub";
|
|
1
|
+
import { $compile } from "./compile.js";
|
|
2
|
+
import { Component } from "./component.js";
|
|
3
|
+
import { $sub } from "./sub.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a generalized and dynamically updating list component from items of
|
|
6
6
|
* the given `src` stream.
|
package/object.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Fn, Keys } from "@thi.ng/api";
|
|
2
|
-
import { ISubscribable, StreamObj, StreamObjOpts } from "@thi.ng/rstream";
|
|
3
|
-
import type { ComponentLike, IComponent, IMountWithState, NumOrElement } from "./api";
|
|
4
|
-
import { Component } from "./component";
|
|
2
|
+
import type { ISubscribable, StreamObj, StreamObjOpts } from "@thi.ng/rstream";
|
|
3
|
+
import type { ComponentLike, IComponent, IMountWithState, NumOrElement } from "./api.js";
|
|
4
|
+
import { Component } from "./component.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a control component wrapper with an internal stream setup for user
|
|
7
7
|
* defined keys in the given object. When this component is mounted, it will
|
package/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fromObject
|
|
2
|
-
import { Component } from "./component";
|
|
3
|
-
import { $sub } from "./sub";
|
|
1
|
+
import { fromObject } from "@thi.ng/rstream/object";
|
|
2
|
+
import { Component } from "./component.js";
|
|
3
|
+
import { $sub } from "./sub.js";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a control component wrapper with an internal stream setup for user
|
|
6
6
|
* defined keys in the given object. When this component is mounted, it will
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rdom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Lightweight, reactive, VDOM-less UI/DOM components with async lifecycle and @thi.ng/hiccup compatible",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"module": "./index.js",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"umd:main": "./lib/index.umd.js",
|
|
8
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
@@ -24,34 +24,29 @@
|
|
|
24
24
|
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn clean &&
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"build:test": "rimraf build && tsc -p test/tsconfig.json",
|
|
31
|
-
"test": "mocha test",
|
|
32
|
-
"cover": "nyc mocha test && nyc report --reporter=lcov",
|
|
33
|
-
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
|
|
34
|
-
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf *.js *.d.ts *.map doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
35
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
|
|
36
|
-
"doc": "
|
|
37
|
-
"
|
|
38
|
-
"pub
|
|
31
|
+
"doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
|
|
32
|
+
"doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
|
|
33
|
+
"pub": "yarn build && yarn publish --access public",
|
|
34
|
+
"pub:wip": "yarn publish --access public --no-git-tag-version",
|
|
35
|
+
"test": "testament test"
|
|
39
36
|
},
|
|
40
37
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^
|
|
42
|
-
"@thi.ng/checks": "^
|
|
43
|
-
"@thi.ng/errors": "^
|
|
44
|
-
"@thi.ng/hiccup": "^
|
|
45
|
-
"@thi.ng/paths": "^
|
|
46
|
-
"@thi.ng/prefixes": "^
|
|
47
|
-
"@thi.ng/rstream": "^
|
|
48
|
-
"@thi.ng/strings": "^
|
|
38
|
+
"@thi.ng/api": "^8.0.4",
|
|
39
|
+
"@thi.ng/checks": "^3.0.4",
|
|
40
|
+
"@thi.ng/errors": "^2.0.4",
|
|
41
|
+
"@thi.ng/hiccup": "^4.1.0",
|
|
42
|
+
"@thi.ng/paths": "^5.0.4",
|
|
43
|
+
"@thi.ng/prefixes": "^2.0.4",
|
|
44
|
+
"@thi.ng/rstream": "^7.0.4",
|
|
45
|
+
"@thi.ng/strings": "^3.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@thi.ng/testament": "^0.1.4"
|
|
49
49
|
},
|
|
50
|
-
"files": [
|
|
51
|
-
"*.js",
|
|
52
|
-
"*.d.ts",
|
|
53
|
-
"lib"
|
|
54
|
-
],
|
|
55
50
|
"keywords": [
|
|
56
51
|
"async",
|
|
57
52
|
"browser",
|
|
@@ -72,7 +67,63 @@
|
|
|
72
67
|
"publishConfig": {
|
|
73
68
|
"access": "public"
|
|
74
69
|
},
|
|
75
|
-
"
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=12.7"
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"*.js",
|
|
75
|
+
"*.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"exports": {
|
|
78
|
+
".": {
|
|
79
|
+
"import": "./index.js"
|
|
80
|
+
},
|
|
81
|
+
"./api": {
|
|
82
|
+
"import": "./api.js"
|
|
83
|
+
},
|
|
84
|
+
"./checks": {
|
|
85
|
+
"import": "./checks.js"
|
|
86
|
+
},
|
|
87
|
+
"./compile": {
|
|
88
|
+
"import": "./compile.js"
|
|
89
|
+
},
|
|
90
|
+
"./component": {
|
|
91
|
+
"import": "./component.js"
|
|
92
|
+
},
|
|
93
|
+
"./dom": {
|
|
94
|
+
"import": "./dom.js"
|
|
95
|
+
},
|
|
96
|
+
"./event": {
|
|
97
|
+
"import": "./event.js"
|
|
98
|
+
},
|
|
99
|
+
"./klist": {
|
|
100
|
+
"import": "./klist.js"
|
|
101
|
+
},
|
|
102
|
+
"./list": {
|
|
103
|
+
"import": "./list.js"
|
|
104
|
+
},
|
|
105
|
+
"./object": {
|
|
106
|
+
"import": "./object.js"
|
|
107
|
+
},
|
|
108
|
+
"./promise": {
|
|
109
|
+
"import": "./promise.js"
|
|
110
|
+
},
|
|
111
|
+
"./replace": {
|
|
112
|
+
"import": "./replace.js"
|
|
113
|
+
},
|
|
114
|
+
"./scheduler": {
|
|
115
|
+
"import": "./scheduler.js"
|
|
116
|
+
},
|
|
117
|
+
"./sub": {
|
|
118
|
+
"import": "./sub.js"
|
|
119
|
+
},
|
|
120
|
+
"./switch": {
|
|
121
|
+
"import": "./switch.js"
|
|
122
|
+
},
|
|
123
|
+
"./wrap": {
|
|
124
|
+
"import": "./wrap.js"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
76
127
|
"thi.ng": {
|
|
77
128
|
"related": [
|
|
78
129
|
"hdom",
|
|
@@ -84,5 +135,5 @@
|
|
|
84
135
|
"status": "beta",
|
|
85
136
|
"year": 2020
|
|
86
137
|
},
|
|
87
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "9ff00a103f76cc4917ef3f244132e218f2300a05"
|
|
88
139
|
}
|
package/promise.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
|
-
import type { ComponentLike, IComponent, NumOrElement } from "./api";
|
|
3
|
-
import { Component } from "./component";
|
|
2
|
+
import type { ComponentLike, IComponent, NumOrElement } from "./api.js";
|
|
3
|
+
import { Component } from "./component.js";
|
|
4
4
|
/**
|
|
5
5
|
* Simple component wrapper for {@link ComponentLike} promises. When this
|
|
6
6
|
* component mounts it will `await` the given promise or if it fails, compile
|
package/promise.js
CHANGED
package/replace.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ISubscribable } from "@thi.ng/rstream";
|
|
2
|
+
import type { IComponent, IMountWithState, NumOrElement } from "./api.js";
|
|
3
|
+
import { Component } from "./component.js";
|
|
4
|
+
/**
|
|
5
|
+
* Similar to {@link $refresh}, but more basic/simple. Takes a reactive value
|
|
6
|
+
* `src` and wraps it in a {@link $sub} component using an inner
|
|
7
|
+
* {@link Replace}, which then passes the value to {@link $compile} for each
|
|
8
|
+
* change and replaces the result in the target DOM. If the value evaluates to
|
|
9
|
+
* `null`ish, the previously mounted component will be unmounted and stays so
|
|
10
|
+
* until the value becomes non-null again.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* If the reactive value is null-ish when the wrapper component is first
|
|
14
|
+
* mounted, a hidden dummy `<span>` element will be created instead. This is to
|
|
15
|
+
* ensure the general {@link IComponent.mount} contract will not be broken. The
|
|
16
|
+
* dummy element will later be removed/replaced as soon as the reactive value
|
|
17
|
+
* becomes non-null.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { $compile, $replace } from "@thi.ng/rdom";
|
|
22
|
+
* import { fromInterval } from "@thi.ng/rstream";
|
|
23
|
+
*
|
|
24
|
+
* // reactive counter component
|
|
25
|
+
* const counter = fromInterval(16).map((x) => [
|
|
26
|
+
* "div",
|
|
27
|
+
* { style: { "font-size": `${(x % 100) + 10}px` } },
|
|
28
|
+
* x,
|
|
29
|
+
* ]);
|
|
30
|
+
*
|
|
31
|
+
* $compile($replace(counter)).mount(document.body);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param src
|
|
35
|
+
*/
|
|
36
|
+
export declare const $replace: <T>(src: ISubscribable<T>) => IComponent<T>;
|
|
37
|
+
export declare class Replace<T> extends Component implements IMountWithState<T> {
|
|
38
|
+
protected parent?: Element;
|
|
39
|
+
protected inner?: IComponent<T>;
|
|
40
|
+
protected index?: NumOrElement;
|
|
41
|
+
mount(parent: Element, index: NumOrElement, val: T): Promise<Element>;
|
|
42
|
+
unmount(): Promise<void>;
|
|
43
|
+
update(val: T): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=replace.d.ts.map
|