@solidjs/html 2.0.0-rc.8 → 2.0.0-rc.9
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/dist/html.js +11 -6
- package/package.json +2 -2
package/dist/html.js
CHANGED
|
@@ -490,32 +490,37 @@ function createHtml() {
|
|
|
490
490
|
return element;
|
|
491
491
|
};
|
|
492
492
|
const gatherProps = (node, values, components, props = {}) => {
|
|
493
|
+
const sources = [];
|
|
494
|
+
let own = props;
|
|
493
495
|
for (const prop of node.props) {
|
|
494
496
|
switch (prop.type) {
|
|
495
497
|
case BOOLEAN_PROP:
|
|
496
|
-
|
|
498
|
+
own[prop.name] = true;
|
|
497
499
|
break;
|
|
498
500
|
case STATIC_PROP:
|
|
499
|
-
|
|
501
|
+
own[prop.name] = prop.value;
|
|
500
502
|
break;
|
|
501
503
|
case EXPRESSION_PROP:
|
|
502
|
-
applyGetter(
|
|
504
|
+
applyGetter(own, prop.name, values[prop.value]);
|
|
503
505
|
break;
|
|
504
506
|
case SPREAD_PROP:
|
|
505
507
|
const spreadValue = values[prop.value];
|
|
506
508
|
if (!spreadValue || typeof spreadValue !== "object") throw new Error("Can only spread objects");
|
|
507
|
-
|
|
509
|
+
sources.push(own, spreadValue);
|
|
510
|
+
own = {};
|
|
508
511
|
break;
|
|
509
512
|
}
|
|
510
513
|
}
|
|
511
514
|
if (node.type === COMPONENT_NODE && node.children.length) {
|
|
512
|
-
Object.defineProperty(
|
|
515
|
+
Object.defineProperty(own, "children", {
|
|
513
516
|
get() {
|
|
514
517
|
return renderChildren(node, values, components);
|
|
515
518
|
}
|
|
516
519
|
});
|
|
517
520
|
}
|
|
518
|
-
return
|
|
521
|
+
if (sources.length === 0) return own;
|
|
522
|
+
sources.push(own);
|
|
523
|
+
return mergeProps(...sources);
|
|
519
524
|
};
|
|
520
525
|
const applyGetter = (props, name, value) => {
|
|
521
526
|
if (typeof value === "function" && value.length === 0 && name !== "ref" && !name.startsWith("on")) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/html",
|
|
3
3
|
"description": "Tagged-template-literal templating for Solid — write components with no build step.",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.9",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test": "vitest run"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@solidjs/web": "^2.0.0-rc.
|
|
45
|
+
"@solidjs/web": "^2.0.0-rc.9"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@solidjs/web": "workspace:*",
|