tutuca 0.9.67 → 0.9.69

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.
@@ -1173,10 +1173,18 @@ class RequestHandler {
1173
1173
 
1174
1174
  // src/vdom.js
1175
1175
  var HTML_NS = "http://www.w3.org/1999/xhtml";
1176
+ var SVG_NS = "http://www.w3.org/2000/svg";
1177
+ var MATH_NS = "http://www.w3.org/1998/Math/MathML";
1176
1178
  var isNamespaced = (node) => {
1177
1179
  const ns = node.namespaceURI;
1178
1180
  return ns !== null && ns !== HTML_NS;
1179
1181
  };
1182
+ var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
1183
+ var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
1184
+ function childOpts(vnode, ns, opts) {
1185
+ const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
1186
+ return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
1187
+ }
1180
1188
  var NEVER_ASSIGN = new Set([
1181
1189
  "width",
1182
1190
  "height",
@@ -1190,7 +1198,7 @@ var NEVER_ASSIGN = new Set([
1190
1198
  "role",
1191
1199
  "popover"
1192
1200
  ]);
1193
- function applyProperties(node, props, _previous) {
1201
+ function applyProperties(node, props) {
1194
1202
  const namespaced = isNamespaced(node);
1195
1203
  for (const name in props)
1196
1204
  setProp(node, name, props[name], namespaced);
@@ -1199,8 +1207,11 @@ function setProp(node, name, value, namespaced) {
1199
1207
  if (name === "dangerouslySetInnerHTML") {
1200
1208
  if (value === undefined)
1201
1209
  node.replaceChildren();
1202
- else
1203
- node.innerHTML = value.__html ?? "";
1210
+ else {
1211
+ const html = value.__html ?? "";
1212
+ if (html !== node.innerHTML)
1213
+ node.innerHTML = html;
1214
+ }
1204
1215
  return;
1205
1216
  }
1206
1217
  if (typeof value === "function")
@@ -1216,6 +1227,13 @@ function setProp(node, name, value, namespaced) {
1216
1227
  else
1217
1228
  node.setAttribute(name, value);
1218
1229
  }
1230
+ function applyValueLast(node, value) {
1231
+ if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
1232
+ node.removeAttribute("value");
1233
+ } else {
1234
+ setProp(node, "value", value, isNamespaced(node));
1235
+ }
1236
+ }
1219
1237
 
1220
1238
  class VBase {
1221
1239
  }
@@ -1334,15 +1352,23 @@ class VNode extends VBase {
1334
1352
  }
1335
1353
  toDom(opts) {
1336
1354
  const doc = opts.document;
1337
- const node = this.namespace === null ? doc.createElement(this.tag) : doc.createElementNS(this.namespace, this.tag);
1338
- if (this.tag === "SELECT" && "value" in this.attrs) {
1339
- const { value, ...rest } = this.attrs;
1340
- applyProperties(node, rest, {});
1341
- appendChildNodes(node, this.childs, opts);
1342
- applyProperties(node, { value }, {});
1355
+ const ns = effectiveNs(this, opts);
1356
+ const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
1357
+ const attrs = this.attrs;
1358
+ const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
1359
+ const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
1360
+ const cOpts = childOpts(this, ns, opts);
1361
+ if ("value" in attrs || "checked" in attrs) {
1362
+ const { value, checked, ...rest } = attrs;
1363
+ applyProperties(node, rest);
1364
+ appendChildNodes(node, this.childs, cOpts);
1365
+ if (value !== undefined)
1366
+ applyValueLast(node, value);
1367
+ if (checked !== undefined)
1368
+ setProp(node, "checked", checked, false);
1343
1369
  } else {
1344
- applyProperties(node, this.attrs, {});
1345
- appendChildNodes(node, this.childs, opts);
1370
+ applyProperties(node, attrs);
1371
+ appendChildNodes(node, this.childs, cOpts);
1346
1372
  }
1347
1373
  return node;
1348
1374
  }
@@ -1379,18 +1405,37 @@ function morphNode(domNode, source, target, opts) {
1379
1405
  }
1380
1406
  if (type === 1 && source.isSameKind(target)) {
1381
1407
  const propsDiff = diffProps(source.attrs, target.attrs);
1382
- const isSelect = source.tag === "SELECT";
1408
+ let pendingValue;
1409
+ let pendingChecked;
1410
+ let applyValue = false;
1411
+ let applyChecked = false;
1383
1412
  if (propsDiff) {
1384
- if (isSelect && "value" in propsDiff) {
1385
- const { value: _v, ...rest } = propsDiff;
1386
- applyProperties(domNode, rest, source.attrs);
1413
+ if ("value" in propsDiff || "checked" in propsDiff) {
1414
+ const { value, checked, ...rest } = propsDiff;
1415
+ applyProperties(domNode, rest);
1416
+ if ("value" in propsDiff) {
1417
+ pendingValue = value;
1418
+ applyValue = true;
1419
+ }
1420
+ if ("checked" in propsDiff) {
1421
+ pendingChecked = checked;
1422
+ applyChecked = true;
1423
+ }
1387
1424
  } else
1388
- applyProperties(domNode, propsDiff, source.attrs);
1425
+ applyProperties(domNode, propsDiff);
1426
+ }
1427
+ if (!target.attrs.dangerouslySetInnerHTML) {
1428
+ const ns = effectiveNs(target, opts);
1429
+ morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
1389
1430
  }
1390
- if (!target.attrs.dangerouslySetInnerHTML)
1391
- morphChildren(domNode, source.childs, target.childs, opts);
1392
- if (isSelect && target.attrs.value !== undefined)
1393
- applyProperties(domNode, { value: target.attrs.value }, source.attrs);
1431
+ if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
1432
+ pendingValue = target.attrs.value;
1433
+ applyValue = true;
1434
+ }
1435
+ if (applyValue)
1436
+ applyValueLast(domNode, pendingValue);
1437
+ if (applyChecked)
1438
+ setProp(domNode, "checked", pendingChecked, false);
1394
1439
  return domNode;
1395
1440
  }
1396
1441
  if (type === 11) {
@@ -1494,8 +1539,18 @@ function h(tagName, properties, children, namespace) {
1494
1539
  props[propName] = propVal;
1495
1540
  }
1496
1541
  }
1542
+ if (namespace == null) {
1543
+ const lower = tagName.toLowerCase();
1544
+ if (lower === "svg") {
1545
+ namespace = SVG_NS;
1546
+ tagName = "svg";
1547
+ } else if (lower === "math") {
1548
+ namespace = MATH_NS;
1549
+ tagName = "math";
1550
+ }
1551
+ }
1497
1552
  const c = tagName.charCodeAt(0);
1498
- const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
1553
+ const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
1499
1554
  const normalizedChildren = [];
1500
1555
  addChild(normalizedChildren, children);
1501
1556
  return new VNode(tag, props, normalizedChildren, key, namespace);
@@ -1747,16 +1802,16 @@ function parseXOpVal(opName, value, px, parserFn) {
1747
1802
  return val;
1748
1803
  }
1749
1804
  function processXExtras(node, attrs, opName, startIdx, px) {
1750
- const consumed = X_OP_CONSUMED[opName];
1751
- const wrappable = X_OP_WRAPPABLE.has(opName);
1805
+ const { consumed, wrappable } = X_OPS[opName];
1752
1806
  const wrappers = [];
1753
1807
  for (let i = startIdx;i < attrs.length; i++) {
1754
1808
  const a = attrs[i];
1755
1809
  const aName = a.name;
1756
1810
  if (consumed.has(aName))
1757
1811
  continue;
1758
- if (wrappable && X_ATTR_WRAPPERS[aName]) {
1759
- wrappers.push([X_ATTR_WRAPPERS[aName], vp.parseBool(a.value, px)]);
1812
+ const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
1813
+ if (wrapper) {
1814
+ wrappers.push([wrapper, vp.parseBool(a.value, px)]);
1760
1815
  continue;
1761
1816
  }
1762
1817
  const issueInfo = { op: opName, name: aName, value: a.value };
@@ -1848,6 +1903,12 @@ class RenderViewId extends ANode {
1848
1903
  }
1849
1904
  setDataAttr(_key, _val) {}
1850
1905
  }
1906
+ function dynRenderStep(comp, name, key) {
1907
+ const p = resolveDynProducer(comp, name);
1908
+ if (!p)
1909
+ return null;
1910
+ return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
1911
+ }
1851
1912
 
1852
1913
  class RenderNode extends RenderViewId {
1853
1914
  render(stack, rx) {
@@ -1855,10 +1916,8 @@ class RenderNode extends RenderViewId {
1855
1916
  return rx.renderIt(newStack, this, "", this.viewId);
1856
1917
  }
1857
1918
  toPathStep(ctx) {
1858
- if (this.val instanceof DynVal) {
1859
- const p = resolveDynProducer(ctx.comp, this.val.name);
1860
- return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
1861
- }
1919
+ if (this.val instanceof DynVal)
1920
+ return dynRenderStep(ctx.comp, this.val.name);
1862
1921
  return super.toPathStep(ctx);
1863
1922
  }
1864
1923
  }
@@ -1874,10 +1933,8 @@ class RenderItNode extends RenderViewId {
1874
1933
  return null;
1875
1934
  const nextNode = next.resolveNode();
1876
1935
  if (nextNode instanceof EachNode && next.hasKey) {
1877
- if (nextNode.val instanceof DynVal) {
1878
- const p = resolveDynProducer(ctx.comp, nextNode.val.name);
1879
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
1880
- }
1936
+ if (nextNode.val instanceof DynVal)
1937
+ return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
1881
1938
  return new EachRenderItStep(nextNode.val.name, next.key);
1882
1939
  }
1883
1940
  return null;
@@ -1893,12 +1950,8 @@ class RenderEachNode extends RenderViewId {
1893
1950
  return rx.renderEach(stack, this.iterInfo, this, this.viewId);
1894
1951
  }
1895
1952
  toPathStep(ctx) {
1896
- if (this.val instanceof DynVal) {
1897
- if (!ctx.hasKey)
1898
- return null;
1899
- const p = resolveDynProducer(ctx.comp, this.val.name);
1900
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
1901
- }
1953
+ if (this.val instanceof DynVal)
1954
+ return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
1902
1955
  return super.toPathStep(ctx);
1903
1956
  }
1904
1957
  static parse(px, vp2, s, as, attrs) {
@@ -2028,17 +2081,18 @@ class IterInfo {
2028
2081
  }
2029
2082
  var filterAlwaysTrue = (_v, _k, _seq) => true;
2030
2083
  var nullLoopWith = (seq) => ({ iterData: { seq } });
2031
- var X_OP_CONSUMED = {
2032
- slot: new Set,
2033
- text: new Set,
2034
- render: new Set(["as"]),
2035
- "render-it": new Set(["as"]),
2036
- "render-each": new Set(["as", "when", "loop-with"]),
2037
- show: new Set,
2038
- hide: new Set
2084
+ function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
2085
+ return { consumed: new Set(consumed), wrappable, wrapper };
2086
+ }
2087
+ var X_OPS = {
2088
+ slot: xOp(),
2089
+ text: xOp([], { wrappable: true }),
2090
+ render: xOp(["as"], { wrappable: true }),
2091
+ "render-it": xOp(["as"], { wrappable: true }),
2092
+ "render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
2093
+ show: xOp([], { wrapper: ShowNode }),
2094
+ hide: xOp([], { wrapper: HideNode })
2039
2095
  };
2040
- var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
2041
- var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
2042
2096
  var WRAPPER_NODES = {
2043
2097
  slot: SlotNode,
2044
2098
  show: ShowNode,
@@ -2126,29 +2180,30 @@ var isBlockDomNode = (n) => {
2126
2180
  const node = n instanceof FragmentNode ? n.childs[0] : n;
2127
2181
  return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
2128
2182
  };
2183
+ var isEmptyText = (c) => c instanceof TextNode && c.val === "";
2184
+ function trimEdgeWhite(node) {
2185
+ if (!node.isWhiteSpace?.())
2186
+ return false;
2187
+ node.condenseWhiteSpace();
2188
+ return true;
2189
+ }
2129
2190
  function condenseChildsWhites(childs) {
2130
2191
  if (childs.length === 0)
2131
2192
  return childs;
2132
- let changed = false;
2133
- if (childs[0].isWhiteSpace?.()) {
2134
- childs[0].condenseWhiteSpace();
2135
- changed = true;
2136
- }
2137
2193
  const last = childs.length - 1;
2138
- if (last > 0 && childs[last].isWhiteSpace?.()) {
2139
- childs[last].condenseWhiteSpace();
2140
- changed = true;
2141
- }
2194
+ let emptied = trimEdgeWhite(childs[0]);
2195
+ if (last > 0 && trimEdgeWhite(childs[last]))
2196
+ emptied = true;
2142
2197
  for (let i = 1;i < last; i++) {
2143
2198
  const cur = childs[i];
2144
- if (cur.isWhiteSpace?.() && cur.hasNewLine()) {
2145
- const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
2146
- cur.condenseWhiteSpace(bothBlock ? "" : " ");
2147
- if (bothBlock)
2148
- changed = true;
2149
- }
2199
+ if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
2200
+ continue;
2201
+ const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
2202
+ cur.condenseWhiteSpace(bothBlock ? "" : " ");
2203
+ if (bothBlock)
2204
+ emptied = true;
2150
2205
  }
2151
- return changed ? childs.filter((c) => !(c instanceof TextNode && c.val === "")) : childs;
2206
+ return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
2152
2207
  }
2153
2208
 
2154
2209
  class View {
package/dist/tutuca.js CHANGED
@@ -5546,10 +5546,18 @@ class RequestHandler {
5546
5546
 
5547
5547
  // src/vdom.js
5548
5548
  var HTML_NS = "http://www.w3.org/1999/xhtml";
5549
+ var SVG_NS = "http://www.w3.org/2000/svg";
5550
+ var MATH_NS = "http://www.w3.org/1998/Math/MathML";
5549
5551
  var isNamespaced = (node) => {
5550
5552
  const ns = node.namespaceURI;
5551
5553
  return ns !== null && ns !== HTML_NS;
5552
5554
  };
5555
+ var isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
5556
+ var effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
5557
+ function childOpts(vnode, ns, opts) {
5558
+ const target = ns === SVG_NS && isForeignObject(vnode.tag) ? null : ns;
5559
+ return target === (opts.namespace ?? null) ? opts : { ...opts, namespace: target };
5560
+ }
5553
5561
  var NEVER_ASSIGN = new Set([
5554
5562
  "width",
5555
5563
  "height",
@@ -5563,7 +5571,7 @@ var NEVER_ASSIGN = new Set([
5563
5571
  "role",
5564
5572
  "popover"
5565
5573
  ]);
5566
- function applyProperties(node, props, _previous) {
5574
+ function applyProperties(node, props) {
5567
5575
  const namespaced = isNamespaced(node);
5568
5576
  for (const name in props)
5569
5577
  setProp2(node, name, props[name], namespaced);
@@ -5572,8 +5580,11 @@ function setProp2(node, name, value, namespaced) {
5572
5580
  if (name === "dangerouslySetInnerHTML") {
5573
5581
  if (value === undefined)
5574
5582
  node.replaceChildren();
5575
- else
5576
- node.innerHTML = value.__html ?? "";
5583
+ else {
5584
+ const html = value.__html ?? "";
5585
+ if (html !== node.innerHTML)
5586
+ node.innerHTML = html;
5587
+ }
5577
5588
  return;
5578
5589
  }
5579
5590
  if (typeof value === "function")
@@ -5589,6 +5600,13 @@ function setProp2(node, name, value, namespaced) {
5589
5600
  else
5590
5601
  node.setAttribute(name, value);
5591
5602
  }
5603
+ function applyValueLast(node, value) {
5604
+ if (node.tagName === "PROGRESS" && (value == null || value === 0)) {
5605
+ node.removeAttribute("value");
5606
+ } else {
5607
+ setProp2(node, "value", value, isNamespaced(node));
5608
+ }
5609
+ }
5592
5610
 
5593
5611
  class VBase {
5594
5612
  }
@@ -5707,15 +5725,23 @@ class VNode2 extends VBase {
5707
5725
  }
5708
5726
  toDom(opts) {
5709
5727
  const doc = opts.document;
5710
- const node = this.namespace === null ? doc.createElement(this.tag) : doc.createElementNS(this.namespace, this.tag);
5711
- if (this.tag === "SELECT" && "value" in this.attrs) {
5712
- const { value, ...rest } = this.attrs;
5713
- applyProperties(node, rest, {});
5714
- appendChildNodes(node, this.childs, opts);
5715
- applyProperties(node, { value }, {});
5728
+ const ns = effectiveNs(this, opts);
5729
+ const tag = ns !== null && this.tag === this.tag.toUpperCase() ? this.tag.toLowerCase() : this.tag;
5730
+ const attrs = this.attrs;
5731
+ const createOpts = attrs.is != null ? { is: attrs.is } : undefined;
5732
+ const node = ns === null ? doc.createElement(tag, createOpts) : doc.createElementNS(ns, tag, createOpts);
5733
+ const cOpts = childOpts(this, ns, opts);
5734
+ if ("value" in attrs || "checked" in attrs) {
5735
+ const { value, checked, ...rest } = attrs;
5736
+ applyProperties(node, rest);
5737
+ appendChildNodes(node, this.childs, cOpts);
5738
+ if (value !== undefined)
5739
+ applyValueLast(node, value);
5740
+ if (checked !== undefined)
5741
+ setProp2(node, "checked", checked, false);
5716
5742
  } else {
5717
- applyProperties(node, this.attrs, {});
5718
- appendChildNodes(node, this.childs, opts);
5743
+ applyProperties(node, attrs);
5744
+ appendChildNodes(node, this.childs, cOpts);
5719
5745
  }
5720
5746
  return node;
5721
5747
  }
@@ -5752,18 +5778,37 @@ function morphNode(domNode, source, target, opts) {
5752
5778
  }
5753
5779
  if (type === 1 && source.isSameKind(target)) {
5754
5780
  const propsDiff = diffProps(source.attrs, target.attrs);
5755
- const isSelect = source.tag === "SELECT";
5781
+ let pendingValue;
5782
+ let pendingChecked;
5783
+ let applyValue = false;
5784
+ let applyChecked = false;
5756
5785
  if (propsDiff) {
5757
- if (isSelect && "value" in propsDiff) {
5758
- const { value: _v, ...rest } = propsDiff;
5759
- applyProperties(domNode, rest, source.attrs);
5786
+ if ("value" in propsDiff || "checked" in propsDiff) {
5787
+ const { value, checked, ...rest } = propsDiff;
5788
+ applyProperties(domNode, rest);
5789
+ if ("value" in propsDiff) {
5790
+ pendingValue = value;
5791
+ applyValue = true;
5792
+ }
5793
+ if ("checked" in propsDiff) {
5794
+ pendingChecked = checked;
5795
+ applyChecked = true;
5796
+ }
5760
5797
  } else
5761
- applyProperties(domNode, propsDiff, source.attrs);
5798
+ applyProperties(domNode, propsDiff);
5799
+ }
5800
+ if (!target.attrs.dangerouslySetInnerHTML) {
5801
+ const ns = effectiveNs(target, opts);
5802
+ morphChildren(domNode, source.childs, target.childs, childOpts(target, ns, opts));
5762
5803
  }
5763
- if (!target.attrs.dangerouslySetInnerHTML)
5764
- morphChildren(domNode, source.childs, target.childs, opts);
5765
- if (isSelect && target.attrs.value !== undefined)
5766
- applyProperties(domNode, { value: target.attrs.value }, source.attrs);
5804
+ if (!applyValue && source.tag === "SELECT" && target.attrs.value !== undefined) {
5805
+ pendingValue = target.attrs.value;
5806
+ applyValue = true;
5807
+ }
5808
+ if (applyValue)
5809
+ applyValueLast(domNode, pendingValue);
5810
+ if (applyChecked)
5811
+ setProp2(domNode, "checked", pendingChecked, false);
5767
5812
  return domNode;
5768
5813
  }
5769
5814
  if (type === 11) {
@@ -5867,8 +5912,18 @@ function h(tagName, properties, children, namespace) {
5867
5912
  props[propName] = propVal;
5868
5913
  }
5869
5914
  }
5915
+ if (namespace == null) {
5916
+ const lower = tagName.toLowerCase();
5917
+ if (lower === "svg") {
5918
+ namespace = SVG_NS;
5919
+ tagName = "svg";
5920
+ } else if (lower === "math") {
5921
+ namespace = MATH_NS;
5922
+ tagName = "math";
5923
+ }
5924
+ }
5870
5925
  const c = tagName.charCodeAt(0);
5871
- const tag = namespace == null && c >= 97 && c <= 122 ? tagName.toUpperCase() : tagName;
5926
+ const tag = namespace == null && c >= 97 && c <= 122 && tagName === tagName.toLowerCase() ? tagName.toUpperCase() : tagName;
5872
5927
  const normalizedChildren = [];
5873
5928
  addChild(normalizedChildren, children);
5874
5929
  return new VNode2(tag, props, normalizedChildren, key, namespace);
@@ -6120,16 +6175,16 @@ function parseXOpVal(opName, value, px, parserFn) {
6120
6175
  return val;
6121
6176
  }
6122
6177
  function processXExtras(node, attrs, opName, startIdx, px) {
6123
- const consumed = X_OP_CONSUMED[opName];
6124
- const wrappable = X_OP_WRAPPABLE.has(opName);
6178
+ const { consumed, wrappable } = X_OPS[opName];
6125
6179
  const wrappers = [];
6126
6180
  for (let i = startIdx;i < attrs.length; i++) {
6127
6181
  const a = attrs[i];
6128
6182
  const aName = a.name;
6129
6183
  if (consumed.has(aName))
6130
6184
  continue;
6131
- if (wrappable && X_ATTR_WRAPPERS[aName]) {
6132
- wrappers.push([X_ATTR_WRAPPERS[aName], vp.parseBool(a.value, px)]);
6185
+ const wrapper = wrappable ? X_OPS[aName]?.wrapper : null;
6186
+ if (wrapper) {
6187
+ wrappers.push([wrapper, vp.parseBool(a.value, px)]);
6133
6188
  continue;
6134
6189
  }
6135
6190
  const issueInfo = { op: opName, name: aName, value: a.value };
@@ -6221,6 +6276,12 @@ class RenderViewId extends ANode {
6221
6276
  }
6222
6277
  setDataAttr(_key, _val) {}
6223
6278
  }
6279
+ function dynRenderStep(comp, name, key) {
6280
+ const p = resolveDynProducer(comp, name);
6281
+ if (!p)
6282
+ return null;
6283
+ return key === undefined ? new DynStep(p.producerCompId, p.producerSteps) : new DynEachStep(p.producerCompId, p.producerSteps, key);
6284
+ }
6224
6285
 
6225
6286
  class RenderNode extends RenderViewId {
6226
6287
  render(stack, rx) {
@@ -6228,10 +6289,8 @@ class RenderNode extends RenderViewId {
6228
6289
  return rx.renderIt(newStack, this, "", this.viewId);
6229
6290
  }
6230
6291
  toPathStep(ctx) {
6231
- if (this.val instanceof DynVal) {
6232
- const p = resolveDynProducer(ctx.comp, this.val.name);
6233
- return p ? new DynStep(p.producerCompId, p.producerSteps) : null;
6234
- }
6292
+ if (this.val instanceof DynVal)
6293
+ return dynRenderStep(ctx.comp, this.val.name);
6235
6294
  return super.toPathStep(ctx);
6236
6295
  }
6237
6296
  }
@@ -6247,10 +6306,8 @@ class RenderItNode extends RenderViewId {
6247
6306
  return null;
6248
6307
  const nextNode = next.resolveNode();
6249
6308
  if (nextNode instanceof EachNode && next.hasKey) {
6250
- if (nextNode.val instanceof DynVal) {
6251
- const p = resolveDynProducer(ctx.comp, nextNode.val.name);
6252
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, next.key) : null;
6253
- }
6309
+ if (nextNode.val instanceof DynVal)
6310
+ return dynRenderStep(ctx.comp, nextNode.val.name, next.key);
6254
6311
  return new EachRenderItStep(nextNode.val.name, next.key);
6255
6312
  }
6256
6313
  return null;
@@ -6266,12 +6323,8 @@ class RenderEachNode extends RenderViewId {
6266
6323
  return rx.renderEach(stack, this.iterInfo, this, this.viewId);
6267
6324
  }
6268
6325
  toPathStep(ctx) {
6269
- if (this.val instanceof DynVal) {
6270
- if (!ctx.hasKey)
6271
- return null;
6272
- const p = resolveDynProducer(ctx.comp, this.val.name);
6273
- return p ? new DynEachStep(p.producerCompId, p.producerSteps, ctx.key) : null;
6274
- }
6326
+ if (this.val instanceof DynVal)
6327
+ return ctx.hasKey ? dynRenderStep(ctx.comp, this.val.name, ctx.key) : null;
6275
6328
  return super.toPathStep(ctx);
6276
6329
  }
6277
6330
  static parse(px, vp2, s, as, attrs) {
@@ -6401,17 +6454,18 @@ class IterInfo {
6401
6454
  }
6402
6455
  var filterAlwaysTrue = (_v, _k, _seq) => true;
6403
6456
  var nullLoopWith = (seq) => ({ iterData: { seq } });
6404
- var X_OP_CONSUMED = {
6405
- slot: new Set,
6406
- text: new Set,
6407
- render: new Set(["as"]),
6408
- "render-it": new Set(["as"]),
6409
- "render-each": new Set(["as", "when", "loop-with"]),
6410
- show: new Set,
6411
- hide: new Set
6457
+ function xOp(consumed = [], { wrappable = false, wrapper = null } = {}) {
6458
+ return { consumed: new Set(consumed), wrappable, wrapper };
6459
+ }
6460
+ var X_OPS = {
6461
+ slot: xOp(),
6462
+ text: xOp([], { wrappable: true }),
6463
+ render: xOp(["as"], { wrappable: true }),
6464
+ "render-it": xOp(["as"], { wrappable: true }),
6465
+ "render-each": xOp(["as", "when", "loop-with"], { wrappable: true }),
6466
+ show: xOp([], { wrapper: ShowNode }),
6467
+ hide: xOp([], { wrapper: HideNode })
6412
6468
  };
6413
- var X_OP_WRAPPABLE = new Set(["text", "render", "render-it", "render-each"]);
6414
- var X_ATTR_WRAPPERS = { show: ShowNode, hide: HideNode };
6415
6469
  var WRAPPER_NODES = {
6416
6470
  slot: SlotNode,
6417
6471
  show: ShowNode,
@@ -6499,29 +6553,30 @@ var isBlockDomNode = (n) => {
6499
6553
  const node = n instanceof FragmentNode ? n.childs[0] : n;
6500
6554
  return node instanceof DomNode && HTML_BLOCK_TAGS.has(node.tagName);
6501
6555
  };
6556
+ var isEmptyText = (c) => c instanceof TextNode && c.val === "";
6557
+ function trimEdgeWhite(node) {
6558
+ if (!node.isWhiteSpace?.())
6559
+ return false;
6560
+ node.condenseWhiteSpace();
6561
+ return true;
6562
+ }
6502
6563
  function condenseChildsWhites(childs) {
6503
6564
  if (childs.length === 0)
6504
6565
  return childs;
6505
- let changed = false;
6506
- if (childs[0].isWhiteSpace?.()) {
6507
- childs[0].condenseWhiteSpace();
6508
- changed = true;
6509
- }
6510
6566
  const last = childs.length - 1;
6511
- if (last > 0 && childs[last].isWhiteSpace?.()) {
6512
- childs[last].condenseWhiteSpace();
6513
- changed = true;
6514
- }
6567
+ let emptied = trimEdgeWhite(childs[0]);
6568
+ if (last > 0 && trimEdgeWhite(childs[last]))
6569
+ emptied = true;
6515
6570
  for (let i = 1;i < last; i++) {
6516
6571
  const cur = childs[i];
6517
- if (cur.isWhiteSpace?.() && cur.hasNewLine()) {
6518
- const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
6519
- cur.condenseWhiteSpace(bothBlock ? "" : " ");
6520
- if (bothBlock)
6521
- changed = true;
6522
- }
6572
+ if (!(cur.isWhiteSpace?.() && cur.hasNewLine()))
6573
+ continue;
6574
+ const bothBlock = isBlockDomNode(childs[i - 1]) && isBlockDomNode(childs[i + 1]);
6575
+ cur.condenseWhiteSpace(bothBlock ? "" : " ");
6576
+ if (bothBlock)
6577
+ emptied = true;
6523
6578
  }
6524
- return changed ? childs.filter((c) => !(c instanceof TextNode && c.val === "")) : childs;
6579
+ return emptied ? childs.filter((c) => !isEmptyText(c)) : childs;
6525
6580
  }
6526
6581
 
6527
6582
  class View {