@torpor/view 0.1.0 → 0.1.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 +8 -0
- package/dist/compile.cjs +10 -3
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.js +10 -3
- package/dist/compile.js.map +1 -1
- package/dist/index.cjs +15 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +3 -3
- package/src/compile/build/client/buildElementNode.ts +15 -4
- package/src/motion/animate.ts +10 -6
- package/src/render/addFragment.ts +12 -7
- package/src/render/hydrate.ts +7 -0
- package/test/props/reactive.test.ts +5 -16
package/dist/compile.js
CHANGED
|
@@ -1524,8 +1524,17 @@ function buildHeadNode(node, status, b) {
|
|
|
1524
1524
|
});`);
|
|
1525
1525
|
}
|
|
1526
1526
|
function buildElementAttributes(node, varName, status, b) {
|
|
1527
|
+
const refAttribute = node.attributes.find((a) => a.name === "&ref");
|
|
1528
|
+
if (refAttribute) {
|
|
1529
|
+
let value = refAttribute.value;
|
|
1530
|
+
if (value != null && isFullyReactive(value)) {
|
|
1531
|
+
value = value.substring(1, value.length - 1);
|
|
1532
|
+
b.append(`${value} = ${varName};`);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1527
1535
|
for (let { name, value } of node.attributes) {
|
|
1528
1536
|
if (name === "self" && node.tagName === ":element") {
|
|
1537
|
+
} else if (name === "&ref") {
|
|
1529
1538
|
} else if (name.startsWith("{") && name.endsWith("}")) {
|
|
1530
1539
|
name = name.substring(1, name.length - 1);
|
|
1531
1540
|
const propName = name.split(".").at(-1);
|
|
@@ -1536,9 +1545,7 @@ function buildElementAttributes(node, varName, status, b) {
|
|
|
1536
1545
|
} else {
|
|
1537
1546
|
value = `\`${trimQuotes(value).replaceAll("{", "${")}\``;
|
|
1538
1547
|
}
|
|
1539
|
-
if (name === "&
|
|
1540
|
-
b.append(`${value} = ${varName};`);
|
|
1541
|
-
} else if (name === "&group") {
|
|
1548
|
+
if (name === "&group") {
|
|
1542
1549
|
buildBindGroupAttribute(node, varName, value, status, b);
|
|
1543
1550
|
} else if (name === "&value" || name === "&checked") {
|
|
1544
1551
|
buildBindAttribute(node, varName, name, value, status, b);
|