@marko/runtime-tags 6.3.13 → 6.3.15

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.
@@ -856,13 +856,15 @@ function writeUnknownObject(state, val, ref) {
856
856
  case Int32Array:
857
857
  case Uint32Array:
858
858
  case Float32Array:
859
- case Float64Array: return writeTypedArray(state, val, ref);
859
+ case Float64Array:
860
+ case BigInt64Array:
861
+ case BigUint64Array: return writeTypedArray(state, val, ref);
860
862
  case WeakSet: return writeWeakSet(state);
861
863
  case WeakMap: return writeWeakMap(state);
862
864
  case globalThis.URL: return writeURL(state, val);
863
865
  case globalThis.URLSearchParams: return writeURLSearchParams(state, val);
864
866
  case globalThis.Headers: return writeHeaders(state, val);
865
- case globalThis.FormData: return writeFormData(state, val);
867
+ case globalThis.FormData: return writeFormData(state, val, ref);
866
868
  case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
867
869
  case globalThis.Request: return writeRequest(state, val, ref);
868
870
  case globalThis.Response: return writeResponse(state, val, ref);
@@ -1054,14 +1056,18 @@ function writeURLSearchParams(state, val) {
1054
1056
  return true;
1055
1057
  }
1056
1058
  function writeHeaders(state, val) {
1057
- const headers = stringEntriesToProps(val);
1058
- state.buf.push("new Headers" + (headers ? "({" + headers + "})" : ""));
1059
+ const headers = stringEntriesToHeadersInit(val);
1060
+ state.buf.push("new Headers" + (headers ? "(" + headers + ")" : ""));
1059
1061
  return true;
1060
1062
  }
1061
- function writeFormData(state, val) {
1063
+ function writeFormData(state, val, ref) {
1062
1064
  let sep = "[";
1063
1065
  let valStr = "";
1064
- for (const [key, value] of val) if (typeof value === "string") {
1066
+ for (const [key, value] of val) {
1067
+ if (typeof value !== "string") {
1068
+ throwUnserializable(state, value, ref, key);
1069
+ return false;
1070
+ }
1065
1071
  valStr += sep + quote(key, 0) + "," + quote(value, 0);
1066
1072
  sep = ",";
1067
1073
  }
@@ -1091,10 +1097,10 @@ function writeRequest(state, val, ref) {
1091
1097
  options += sep + "credentials:" + quote(val.credentials, 0);
1092
1098
  sep = ",";
1093
1099
  }
1094
- const headers = stringEntriesToProps(val.headers);
1100
+ const headers = stringEntriesToHeadersInit(val.headers);
1095
1101
  state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1096
1102
  if (headers) {
1097
- options += sep + "headers:{" + headers + "}";
1103
+ options += sep + "headers:" + headers;
1098
1104
  sep = ",";
1099
1105
  }
1100
1106
  if (val.integrity) {
@@ -1136,9 +1142,9 @@ function writeResponse(state, val, ref) {
1136
1142
  options += sep + "statusText:" + quote(val.statusText, 0);
1137
1143
  sep = ",";
1138
1144
  }
1139
- const headers = stringEntriesToProps(val.headers);
1145
+ const headers = stringEntriesToHeadersInit(val.headers);
1140
1146
  state.refs.set(val.headers, new Reference(ref, "headers", state.flush, null));
1141
- if (headers) options += sep + "headers:{" + headers + "}";
1147
+ if (headers) options += sep + "headers:" + headers;
1142
1148
  if (!val.body || val.bodyUsed) state.buf.push("new Response" + (options ? "(null,{" + options + "})" : ""));
1143
1149
  else {
1144
1150
  state.buf.push("new Response(");
@@ -1471,27 +1477,40 @@ function nextId(state) {
1471
1477
  function hasSymbolIterator(value) {
1472
1478
  return Symbol.iterator in value;
1473
1479
  }
1474
- function stringEntriesToProps(entries) {
1480
+ function stringEntriesToHeadersInit(entries) {
1481
+ const list = [...entries];
1482
+ if (!list.length) return "";
1483
+ let duplicate = false;
1484
+ const seen = /* @__PURE__ */ new Set();
1485
+ for (const [key] of list) {
1486
+ if (seen.has(key)) {
1487
+ duplicate = true;
1488
+ break;
1489
+ }
1490
+ seen.add(key);
1491
+ }
1475
1492
  let result = "";
1476
1493
  let sep = "";
1477
- for (const [key, value] of entries) {
1478
- result += sep + toObjectKey(key) + ":" + quote(value, 0);
1494
+ for (const [key, value] of list) {
1495
+ result += duplicate ? sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]" : sep + toObjectKey(key) + ":" + quote(value, 0);
1479
1496
  sep = ",";
1480
1497
  }
1481
- return result;
1498
+ return duplicate ? "[" + result + "]" : "{" + result + "}";
1482
1499
  }
1483
1500
  function typedArrayToInitString(view) {
1501
+ const suffix = typeof view[0] === "bigint" ? "n" : "";
1484
1502
  let result = "[";
1485
1503
  let sep = "";
1486
1504
  for (let i = 0; i < view.length; i++) {
1487
- result += sep + view[i];
1505
+ result += sep + view[i] + suffix;
1488
1506
  sep = ",";
1489
1507
  }
1490
1508
  result += "]";
1491
1509
  return result;
1492
1510
  }
1493
1511
  function hasOnlyZeros(typedArray) {
1494
- for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== 0) return false;
1512
+ const zero = typeof typedArray[0] === "bigint" ? 0n : 0;
1513
+ for (let i = 0; i < typedArray.length; i++) if (typedArray[i] !== zero) return false;
1495
1514
  return true;
1496
1515
  }
1497
1516
  function patchIteratorNext(proto) {
@@ -1647,7 +1666,6 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1647
1666
  //#endregion
1648
1667
  //#region src/html/writer.ts
1649
1668
  let $chunk;
1650
- const NOOP$2 = () => {};
1651
1669
  function getChunk() {
1652
1670
  return $chunk;
1653
1671
  }
@@ -1660,54 +1678,22 @@ function getState() {
1660
1678
  function getScopeId(scope) {
1661
1679
  return scope[K_SCOPE_ID];
1662
1680
  }
1663
- function _html(html) {
1664
- $chunk.writeHTML(html);
1665
- }
1666
- function writeScript(script) {
1667
- $chunk.writeScript(script);
1681
+ function getScopeById(scopeId) {
1682
+ if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
1668
1683
  }
1669
- function writeWaitReady(readyId, renderer, input) {
1670
- const chunk = $chunk;
1671
- const { boundary } = chunk;
1672
- const body = new Chunk(boundary, null, chunk.context, {
1673
- readyId,
1674
- parent: chunk.serializeState,
1675
- resumes: "",
1676
- writeScopes: {},
1677
- flushScopes: false
1678
- });
1679
- const bodyEnd = body.render(renderer, input);
1680
- if (body === bodyEnd) {
1681
- chunk.writeHTML(body.html);
1682
- body.deferOwnReady();
1683
- chunk.deferredReady = push(chunk.deferredReady, body);
1684
- } else {
1685
- bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
1686
- chunk.next = body;
1687
- }
1684
+ function $global() {
1685
+ return $chunk.boundary.state.$global;
1688
1686
  }
1689
- function _script(scopeId, registryId) {
1690
- if ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) _resume_branch(scopeId);
1691
- $chunk.boundary.state.needsMainRuntime = true;
1692
- $chunk.writeEffect(scopeId, registryId);
1687
+ function _id() {
1688
+ const state = $chunk.boundary.state;
1689
+ const { $global } = state;
1690
+ return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
1693
1691
  }
1694
- function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1695
- const shouldResume = serializeReason !== 0;
1696
- const render = normalizeServerRender(content);
1697
- const branchId = _peek_scope_id();
1698
- if (render) if (shouldResume) withBranchId(branchId, render);
1699
- else render();
1700
- if (_peek_scope_id() !== branchId) {
1701
- if (shouldResume) writeScope(scopeId, {
1702
- ["BranchScopes:" + nodeAccessor]: writeScope(branchId, {}),
1703
- ["ConditionalRenderer:" + nodeAccessor]: render?.["id"]
1704
- });
1705
- } else _scope_id();
1692
+ function _scope_id() {
1693
+ return $chunk.boundary.state.scopeId++;
1706
1694
  }
1707
- function normalizeServerRender(value) {
1708
- const renderer = normalizeDynamicRenderer(value);
1709
- if (renderer) if (typeof renderer === "function") return renderer;
1710
- else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1695
+ function _peek_scope_id() {
1696
+ return $chunk.boundary.state.scopeId;
1711
1697
  }
1712
1698
  const kPendingContexts = Symbol("Pending Contexts");
1713
1699
  function withContext(key, value, cb, cbValue) {
@@ -1722,49 +1708,41 @@ function withContext(key, value, cb, cbValue) {
1722
1708
  ctx[key] = prev;
1723
1709
  }
1724
1710
  }
1725
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1726
- writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
1727
- const childScope = writeScopePassive(childScopeId, { ["#TagVariable"]: _resume({}, registryId, parentScopeId) });
1728
- if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1729
- }
1730
- function writeScopePassive(scopeId, partialScope) {
1731
- const target = $chunk.serializeState;
1732
- const scope = _scope_with_id(scopeId);
1733
- const passive = target.passiveScopes ||= {};
1734
- Object.assign(scope, partialScope);
1735
- passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
1736
- return scope;
1711
+ const kBranchId = Symbol("Branch Id");
1712
+ const kIsAsync = Symbol("Is Async");
1713
+ function isInResumedBranch() {
1714
+ return $chunk?.context?.[kBranchId] !== void 0;
1737
1715
  }
1738
- function _resume(val, id, scopeId) {
1739
- return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1716
+ function withBranchId(branchId, cb) {
1717
+ return withContext(kBranchId, branchId, cb);
1740
1718
  }
1741
- function _id() {
1742
- const state = $chunk.boundary.state;
1743
- const { $global } = state;
1744
- return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
1719
+ function withIsAsync(cb, value) {
1720
+ return withContext(kIsAsync, true, cb, value);
1745
1721
  }
1746
- function _scope_id() {
1747
- return $chunk.boundary.state.scopeId++;
1722
+ function _html(html) {
1723
+ $chunk.writeHTML(html);
1748
1724
  }
1749
- function _peek_scope_id() {
1750
- return $chunk.boundary.state.scopeId;
1725
+ function writeScript(script) {
1726
+ $chunk.writeScript(script);
1751
1727
  }
1752
- function getScopeById(scopeId) {
1753
- if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
1728
+ function _script(scopeId, registryId) {
1729
+ if ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) _resume_branch(scopeId);
1730
+ $chunk.boundary.state.needsMainRuntime = true;
1731
+ $chunk.writeEffect(scopeId, registryId);
1754
1732
  }
1755
- function _set_serialize_reason(reason) {
1756
- $chunk.boundary.state.serializeReason = reason;
1733
+ function _trailers(html) {
1734
+ $chunk.boundary.state.trailerHTML += html;
1757
1735
  }
1758
- function _scope_reason() {
1759
- const reason = $chunk.boundary.state.serializeReason;
1760
- $chunk.boundary.state.serializeReason = void 0;
1761
- return reason;
1736
+ function _resume(val, id, scopeId) {
1737
+ return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1762
1738
  }
1763
- function _serialize_if(condition, key) {
1764
- return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1739
+ function _el(scopeId, id) {
1740
+ return _resume(() => _el_read_error(), id, scopeId);
1765
1741
  }
1766
- function _serialize_guard(condition, key) {
1767
- return _serialize_if(condition, key) || 0;
1742
+ function _hoist(scopeId, id) {
1743
+ const getter = () => _hoist_read_error();
1744
+ getter[Symbol.iterator] = _hoist_read_error;
1745
+ return _resume(getter, id, scopeId);
1768
1746
  }
1769
1747
  function _el_resume(scopeId, accessor, shouldResume) {
1770
1748
  if (shouldResume === 0) return "";
@@ -1775,28 +1753,51 @@ function _el_resume(scopeId, accessor, shouldResume) {
1775
1753
  function _sep(shouldResume) {
1776
1754
  return shouldResume === 0 ? "" : "<!>";
1777
1755
  }
1778
- function _el(scopeId, id) {
1779
- return _resume(() => _el_read_error(), id, scopeId);
1780
- }
1781
- function _hoist(scopeId, id) {
1782
- const getter = () => _hoist_read_error();
1783
- getter[Symbol.iterator] = _hoist_read_error;
1784
- return _resume(getter, id, scopeId);
1785
- }
1786
1756
  function _resume_branch(scopeId) {
1787
1757
  const branchId = $chunk.context?.[kBranchId];
1788
1758
  if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { ["#ClosestBranchId"]: branchId });
1789
1759
  }
1790
- const kBranchId = Symbol("Branch Id");
1791
- const kIsAsync = Symbol("Is Async");
1792
- function isInResumedBranch() {
1793
- return $chunk?.context?.[kBranchId] !== void 0;
1760
+ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1761
+ const shouldResume = serializeReason !== 0;
1762
+ const render = normalizeServerRender(content);
1763
+ const branchId = _peek_scope_id();
1764
+ if (render) if (shouldResume) withBranchId(branchId, render);
1765
+ else render();
1766
+ if (_peek_scope_id() !== branchId) {
1767
+ if (shouldResume) writeScope(scopeId, {
1768
+ ["BranchScopes:" + nodeAccessor]: writeScope(branchId, {}),
1769
+ ["ConditionalRenderer:" + nodeAccessor]: render?.["id"]
1770
+ });
1771
+ } else _scope_id();
1794
1772
  }
1795
- function withBranchId(branchId, cb) {
1796
- return withContext(kBranchId, branchId, cb);
1773
+ function normalizeServerRender(value) {
1774
+ const renderer = normalizeDynamicRenderer(value);
1775
+ if (renderer) if (typeof renderer === "function") return renderer;
1776
+ else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1797
1777
  }
1798
- function withIsAsync(cb, value) {
1799
- return withContext(kIsAsync, true, cb, value);
1778
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1779
+ writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
1780
+ const childScope = writeScopePassive(childScopeId, { ["#TagVariable"]: _resume({}, registryId, parentScopeId) });
1781
+ if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1782
+ }
1783
+ function writeScopePassive(scopeId, partialScope) {
1784
+ const target = $chunk.serializeState;
1785
+ const scope = _scope_with_id(scopeId);
1786
+ const passive = target.passiveScopes ||= {};
1787
+ Object.assign(scope, partialScope);
1788
+ passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
1789
+ return scope;
1790
+ }
1791
+ function _show_start(display, mark) {
1792
+ if (display) {
1793
+ if (mark) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
1794
+ } else $chunk.writeHTML("<t hidden>");
1795
+ }
1796
+ function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1797
+ const branchId = _scope_id();
1798
+ const wrap = !display;
1799
+ if (wrap) $chunk.writeHTML("</t>");
1800
+ writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
1800
1801
  }
1801
1802
  function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1802
1803
  forBranches(by, (each) => each ? forOf(list, (item, index) => {
@@ -1883,17 +1884,6 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
1883
1884
  } else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
1884
1885
  else $chunk.writeHTML(endTag);
1885
1886
  }
1886
- function _show_start(display, mark) {
1887
- if (display) {
1888
- if (mark) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
1889
- } else $chunk.writeHTML("<t hidden>");
1890
- }
1891
- function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1892
- const branchId = _scope_id();
1893
- const wrap = !display;
1894
- if (wrap) $chunk.writeHTML("</t>");
1895
- writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
1896
- }
1897
1887
  let writeScope = (scopeId, partialScope) => {
1898
1888
  const { state } = $chunk.boundary;
1899
1889
  const target = $chunk.serializeState;
@@ -1923,8 +1913,47 @@ function scopeWithId(state, scopeId) {
1923
1913
  if (!scope) scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId });
1924
1914
  return scope;
1925
1915
  }
1926
- function $global() {
1927
- return $chunk.boundary.state.$global;
1916
+ function _subscribe(subscribers, scope) {
1917
+ if (subscribers) {
1918
+ const { serializer } = $chunk.boundary.state;
1919
+ if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
1920
+ else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
1921
+ }
1922
+ return scope;
1923
+ }
1924
+ function _set_serialize_reason(reason) {
1925
+ $chunk.boundary.state.serializeReason = reason;
1926
+ }
1927
+ function _scope_reason() {
1928
+ const reason = $chunk.boundary.state.serializeReason;
1929
+ $chunk.boundary.state.serializeReason = void 0;
1930
+ return reason;
1931
+ }
1932
+ function _serialize_if(condition, key) {
1933
+ return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1934
+ }
1935
+ function _serialize_guard(condition, key) {
1936
+ return _serialize_if(condition, key) || 0;
1937
+ }
1938
+ function writeWaitReady(readyId, renderer, input) {
1939
+ const chunk = $chunk;
1940
+ const { boundary } = chunk;
1941
+ const body = new Chunk(boundary, null, chunk.context, {
1942
+ readyId,
1943
+ parent: chunk.serializeState,
1944
+ resumes: "",
1945
+ writeScopes: {},
1946
+ flushScopes: false
1947
+ });
1948
+ const bodyEnd = body.render(renderer, input);
1949
+ if (body === bodyEnd) {
1950
+ chunk.writeHTML(body.html);
1951
+ body.deferOwnReady();
1952
+ chunk.deferredReady = push(chunk.deferredReady, body);
1953
+ } else {
1954
+ bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
1955
+ chunk.next = body;
1956
+ }
1928
1957
  }
1929
1958
  function _await(scopeId, accessor, promise, content, serializeMarker) {
1930
1959
  const resumeMarker = serializeMarker !== 0;
@@ -2048,6 +2077,7 @@ function tryCatch(content, catchContent) {
2048
2077
  else boundary.onNext();
2049
2078
  };
2050
2079
  }
2080
+ const NOOP$2 = () => {};
2051
2081
  var State = class {
2052
2082
  $global;
2053
2083
  tagId = 1;
@@ -2473,8 +2503,22 @@ function depsMarker(deps) {
2473
2503
  }
2474
2504
  return marker;
2475
2505
  }
2476
- function _trailers(html) {
2477
- $chunk.boundary.state.trailerHTML += html;
2506
+ function getFilteredGlobals($global) {
2507
+ if (!$global) return 0;
2508
+ const serializedGlobals = $global.serializedGlobals;
2509
+ if (!serializedGlobals) return 0;
2510
+ let filtered = 0;
2511
+ if (Array.isArray(serializedGlobals)) for (const key of serializedGlobals) {
2512
+ const value = $global[key];
2513
+ if (value !== void 0) if (filtered) filtered[key] = value;
2514
+ else filtered = { [key]: value };
2515
+ }
2516
+ else for (const key in serializedGlobals) if (serializedGlobals[key]) {
2517
+ const value = $global[key];
2518
+ if (value !== void 0) if (filtered) filtered[key] = value;
2519
+ else filtered = { [key]: value };
2520
+ }
2521
+ return filtered;
2478
2522
  }
2479
2523
  function concatEffects(a, b) {
2480
2524
  return a ? b ? a + " " + b : a : b;
@@ -2502,31 +2546,6 @@ function flushTickQueue() {
2502
2546
  tickQueue = void 0;
2503
2547
  for (const cb of queue) cb(true);
2504
2548
  }
2505
- function getFilteredGlobals($global) {
2506
- if (!$global) return 0;
2507
- const serializedGlobals = $global.serializedGlobals;
2508
- if (!serializedGlobals) return 0;
2509
- let filtered = 0;
2510
- if (Array.isArray(serializedGlobals)) for (const key of serializedGlobals) {
2511
- const value = $global[key];
2512
- if (value !== void 0) if (filtered) filtered[key] = value;
2513
- else filtered = { [key]: value };
2514
- }
2515
- else for (const key in serializedGlobals) if (serializedGlobals[key]) {
2516
- const value = $global[key];
2517
- if (value !== void 0) if (filtered) filtered[key] = value;
2518
- else filtered = { [key]: value };
2519
- }
2520
- return filtered;
2521
- }
2522
- function _subscribe(subscribers, scope) {
2523
- if (subscribers) {
2524
- const { serializer } = $chunk.boundary.state;
2525
- if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
2526
- else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
2527
- }
2528
- return scope;
2529
- }
2530
2549
  //#endregion
2531
2550
  //#region src/html/attrs.ts
2532
2551
  function _attr_class(value) {
@@ -2751,27 +2770,30 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2751
2770
  assertValidTagName(renderer);
2752
2771
  const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
2753
2772
  rendered = true;
2754
- _scope_id();
2755
- _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
2756
- if (!voidElementsReg.test(renderer)) {
2757
- const renderContent = content || normalizeDynamicRenderer(input.content);
2758
- if (renderer === "textarea") {
2759
- if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2760
- _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
2761
- } else if (renderContent) {
2762
- if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2763
- if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2764
- else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
2773
+ const renderNative = () => {
2774
+ _scope_id();
2775
+ _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
2776
+ if (!voidElementsReg.test(renderer)) {
2777
+ const renderContent = content || normalizeDynamicRenderer(input.content);
2778
+ if (renderer === "textarea") {
2779
+ if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2780
+ _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
2781
+ } else if (renderContent) {
2782
+ if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2783
+ if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2784
+ else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
2785
+ }
2786
+ _html(`</${renderer}>`);
2787
+ } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2788
+ const childScope = getScopeById(branchId);
2789
+ const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
2790
+ if (needsScript) {
2791
+ writeScope(branchId, { ["#Renderer"]: renderer });
2792
+ _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2765
2793
  }
2766
- _html(`</${renderer}>`);
2767
- } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2768
- const childScope = getScopeById(branchId);
2769
- const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
2770
- if (needsScript) {
2771
- writeScope(branchId, { ["#Renderer"]: renderer });
2772
- _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2773
- }
2774
- if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
2794
+ if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
2795
+ };
2796
+ renderNative();
2775
2797
  } else {
2776
2798
  if (shouldResume) _html(state.mark("[", ""));
2777
2799
  const render = () => {
@@ -2981,9 +3003,11 @@ var ServerRendered = class {
2981
3003
  boundary.onNext = NOOP$1;
2982
3004
  reject(boundary.signal.reason);
2983
3005
  break;
2984
- case 0:
2985
- resolve(head.consume().flushHTML());
3006
+ case 0: {
3007
+ const consumed = head.consume();
3008
+ if (!boundary.signal.aborted) resolve(consumed.flushHTML());
2986
3009
  break;
3010
+ }
2987
3011
  }
2988
3012
  })();
2989
3013
  });