@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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @torpor/view
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f9fd76d: Fix: make sure an animated element has been added
8
+ - 1ddc240: Fix: delay $mount effects until after hydrating
9
+ - 7b9dc31: Fix: bind refs first, so they can be used in attributes
10
+
3
11
  ## 0.1.0
4
12
 
5
13
  ### Minor Changes
package/dist/compile.cjs CHANGED
@@ -1550,8 +1550,17 @@ function buildHeadNode(node, status, b) {
1550
1550
  });`);
1551
1551
  }
1552
1552
  function buildElementAttributes(node, varName, status, b) {
1553
+ const refAttribute = node.attributes.find((a) => a.name === "&ref");
1554
+ if (refAttribute) {
1555
+ let value = refAttribute.value;
1556
+ if (value != null && isFullyReactive(value)) {
1557
+ value = value.substring(1, value.length - 1);
1558
+ b.append(`${value} = ${varName};`);
1559
+ }
1560
+ }
1553
1561
  for (let { name, value } of node.attributes) {
1554
1562
  if (name === "self" && node.tagName === ":element") {
1563
+ } else if (name === "&ref") {
1555
1564
  } else if (name.startsWith("{") && name.endsWith("}")) {
1556
1565
  name = name.substring(1, name.length - 1);
1557
1566
  const propName = name.split(".").at(-1);
@@ -1562,9 +1571,7 @@ function buildElementAttributes(node, varName, status, b) {
1562
1571
  } else {
1563
1572
  value = `\`${trimQuotes(value).replaceAll("{", "${")}\``;
1564
1573
  }
1565
- if (name === "&ref") {
1566
- b.append(`${value} = ${varName};`);
1567
- } else if (name === "&group") {
1574
+ if (name === "&group") {
1568
1575
  buildBindGroupAttribute(node, varName, value, status, b);
1569
1576
  } else if (name === "&value" || name === "&checked") {
1570
1577
  buildBindAttribute(node, varName, name, value, status, b);