ripple 0.2.70 → 0.2.72

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/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.2.70",
6
+ "version": "0.2.72",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index.js",
9
9
  "main": "src/runtime/index.js",
@@ -680,7 +680,7 @@ const visitors = {
680
680
  const update = [];
681
681
 
682
682
  if (!is_void) {
683
- transform_children(node.children, {
683
+ transform_children(node.children, node, {
684
684
  visit,
685
685
  state: { ...state, init, update, namespace: child_namespace },
686
686
  root: false,
@@ -1454,7 +1454,7 @@ function transform_ts_child(node, context) {
1454
1454
  }
1455
1455
  }
1456
1456
 
1457
- function transform_children(children, context) {
1457
+ function transform_children(children, element, context) {
1458
1458
  const { visit, state, root } = context;
1459
1459
  const normalized = [];
1460
1460
 
@@ -1576,6 +1576,8 @@ function transform_children(children, context) {
1576
1576
 
1577
1577
  prev = flush_node;
1578
1578
 
1579
+ const is_controlled = normalized.length === 1 && element !== null;
1580
+
1579
1581
  if (node.type === 'Element') {
1580
1582
  visit(node, { ...state, flush_node, namespace: state.namespace });
1581
1583
  } else if (node.type === 'Text') {
@@ -1608,15 +1610,12 @@ function transform_children(children, context) {
1608
1610
  }
1609
1611
  }
1610
1612
  } else if (node.type === 'ForOfStatement') {
1611
- const is_controlled = normalized.length === 1;
1612
1613
  node.is_controlled = is_controlled;
1613
1614
  visit(node, { ...state, flush_node, namespace: state.namespace });
1614
1615
  } else if (node.type === 'IfStatement') {
1615
- const is_controlled = normalized.length === 1;
1616
1616
  node.is_controlled = is_controlled;
1617
1617
  visit(node, { ...state, flush_node, namespace: state.namespace });
1618
1618
  } else if (node.type === 'TryStatement') {
1619
- const is_controlled = normalized.length === 1;
1620
1619
  node.is_controlled = is_controlled;
1621
1620
  visit(node, { ...state, flush_node, namespace: state.namespace });
1622
1621
  } else {
@@ -1653,7 +1652,7 @@ function transform_body(body, { visit, state }) {
1653
1652
  namespace: state.namespace || 'html', // Preserve namespace context
1654
1653
  };
1655
1654
 
1656
- transform_children(body, { visit, state: body_state, root: true });
1655
+ transform_children(body, null, { visit, state: body_state, root: true });
1657
1656
 
1658
1657
  if (body_state.update.length > 0) {
1659
1658
  body_state.init.push(b.stmt(b.call('_$_.render', b.thunk(b.block(body_state.update)))));