ripple 0.3.81 → 0.3.82
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 +17 -0
- package/package.json +3 -3
- package/src/runtime/index-client.js +19 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# ripple
|
|
2
2
|
|
|
3
|
+
## 0.3.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`67f3794`](https://github.com/Ripple-TS/ripple/commit/67f3794d2f1ffd55dd23a47327d925d9a76a4171)
|
|
8
|
+
Thanks [@leonidaz](https://github.com/leonidaz)! - Accept a component function
|
|
9
|
+
as the `children` prop in `mount()` and `hydrate()`. Compiled component call
|
|
10
|
+
sites normalize `children` via `normalize_children`, but props passed through
|
|
11
|
+
the mount options skipped that step, so a plain component function would be
|
|
12
|
+
rendered as text. The same normalization is now applied to `options.props`,
|
|
13
|
+
which lets bootstrap code hydrate a layout with its page as `children` without
|
|
14
|
+
reaching into runtime internals.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
[[`b104604`](https://github.com/Ripple-TS/ripple/commit/b10460473fec0ee68b4963cbc2a3d9d5bb3bc633)]:
|
|
17
|
+
- @tsrx/core@0.1.30
|
|
18
|
+
- @tsrx/ripple@0.1.30
|
|
19
|
+
|
|
3
20
|
## 0.3.81
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ripple is an elegant TypeScript UI framework",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.82",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/runtime/index-client.js",
|
|
9
9
|
"main": "src/runtime/index-client.js",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"clsx": "^2.1.1",
|
|
74
74
|
"devalue": "^5.8.1",
|
|
75
75
|
"esm-env": "^1.2.2",
|
|
76
|
-
"@tsrx/core": "0.1.
|
|
77
|
-
"@tsrx/ripple": "0.1.
|
|
76
|
+
"@tsrx/core": "0.1.30",
|
|
77
|
+
"@tsrx/ripple": "0.1.30"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/estree": "^1.0.8",
|
|
@@ -11,6 +11,7 @@ import { render_component } from './internal/client/component.js';
|
|
|
11
11
|
import { create_anchor } from './internal/client/utils.js';
|
|
12
12
|
import { try_block } from './internal/client/try.js';
|
|
13
13
|
import { remove_ssr_css } from './internal/client/css.js';
|
|
14
|
+
import { normalize_children } from './element.js';
|
|
14
15
|
import {
|
|
15
16
|
clear_track_hash_reference,
|
|
16
17
|
hydrate_node,
|
|
@@ -57,6 +58,22 @@ function render_root_boundary(anchor, render_content, boundary) {
|
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Apply the same children normalization that compiled component call sites
|
|
63
|
+
* get, so `mount`/`hydrate` accept a component function as the `children`
|
|
64
|
+
* prop.
|
|
65
|
+
*
|
|
66
|
+
* @param {Record<string, any> | undefined} props
|
|
67
|
+
* @returns {Record<string, any>}
|
|
68
|
+
*/
|
|
69
|
+
function normalize_props(props) {
|
|
70
|
+
if (props?.children != null) {
|
|
71
|
+
return { ...props, children: normalize_children(props.children) };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return props || {};
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
/**
|
|
61
78
|
* @param {Function} component
|
|
62
79
|
* @param {{ props?: Record<string, any>, target: HTMLElement, rootBoundary?: RootBoundaryOptions }} options
|
|
@@ -66,7 +83,7 @@ export function mount(component, options) {
|
|
|
66
83
|
init_operations();
|
|
67
84
|
remove_ssr_css();
|
|
68
85
|
|
|
69
|
-
const props = options.props
|
|
86
|
+
const props = normalize_props(options.props);
|
|
70
87
|
const target = options.target;
|
|
71
88
|
const anchor = create_anchor();
|
|
72
89
|
|
|
@@ -104,7 +121,7 @@ export function hydrate(component, options) {
|
|
|
104
121
|
init_operations();
|
|
105
122
|
remove_ssr_css();
|
|
106
123
|
|
|
107
|
-
const props = options.props
|
|
124
|
+
const props = normalize_props(options.props);
|
|
108
125
|
const target = options.target;
|
|
109
126
|
const was_hydrating = hydrating;
|
|
110
127
|
const previous_hydrate_node = hydrate_node;
|