marko 6.3.14 → 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.
@@ -1664,7 +1664,6 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1664
1664
  //#endregion
1665
1665
  //#region src/html/writer.ts
1666
1666
  let $chunk;
1667
- const NOOP$2 = () => {};
1668
1667
  function getChunk() {
1669
1668
  return $chunk;
1670
1669
  }
@@ -1677,54 +1676,22 @@ function getState() {
1677
1676
  function getScopeId(scope) {
1678
1677
  return scope[K_SCOPE_ID];
1679
1678
  }
1680
- function _html(html) {
1681
- $chunk.writeHTML(html);
1682
- }
1683
- function writeScript(script) {
1684
- $chunk.writeScript(script);
1679
+ function getScopeById(scopeId) {
1680
+ if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
1685
1681
  }
1686
- function writeWaitReady(readyId, renderer, input) {
1687
- const chunk = $chunk;
1688
- const { boundary } = chunk;
1689
- const body = new Chunk(boundary, null, chunk.context, {
1690
- readyId,
1691
- parent: chunk.serializeState,
1692
- resumes: "",
1693
- writeScopes: {},
1694
- flushScopes: false
1695
- });
1696
- const bodyEnd = body.render(renderer, input);
1697
- if (body === bodyEnd) {
1698
- chunk.writeHTML(body.html);
1699
- body.deferOwnReady();
1700
- chunk.deferredReady = push(chunk.deferredReady, body);
1701
- } else {
1702
- bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
1703
- chunk.next = body;
1704
- }
1682
+ function $global() {
1683
+ return $chunk.boundary.state.$global;
1705
1684
  }
1706
- function _script(scopeId, registryId) {
1707
- if ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) _resume_branch(scopeId);
1708
- $chunk.boundary.state.needsMainRuntime = true;
1709
- $chunk.writeEffect(scopeId, registryId);
1685
+ function _id() {
1686
+ const state = $chunk.boundary.state;
1687
+ const { $global } = state;
1688
+ return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
1710
1689
  }
1711
- function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1712
- const shouldResume = serializeReason !== 0;
1713
- const render = normalizeServerRender(content);
1714
- const branchId = _peek_scope_id();
1715
- if (render) if (shouldResume) withBranchId(branchId, render);
1716
- else render();
1717
- if (_peek_scope_id() !== branchId) {
1718
- if (shouldResume) writeScope(scopeId, {
1719
- ["BranchScopes:" + nodeAccessor]: writeScope(branchId, {}),
1720
- ["ConditionalRenderer:" + nodeAccessor]: render?.["id"]
1721
- });
1722
- } else _scope_id();
1690
+ function _scope_id() {
1691
+ return $chunk.boundary.state.scopeId++;
1723
1692
  }
1724
- function normalizeServerRender(value) {
1725
- const renderer = normalizeDynamicRenderer(value);
1726
- if (renderer) if (typeof renderer === "function") return renderer;
1727
- else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1693
+ function _peek_scope_id() {
1694
+ return $chunk.boundary.state.scopeId;
1728
1695
  }
1729
1696
  const kPendingContexts = Symbol("Pending Contexts");
1730
1697
  function withContext(key, value, cb, cbValue) {
@@ -1739,49 +1706,41 @@ function withContext(key, value, cb, cbValue) {
1739
1706
  ctx[key] = prev;
1740
1707
  }
1741
1708
  }
1742
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1743
- writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
1744
- const childScope = writeScopePassive(childScopeId, { ["#TagVariable"]: _resume({}, registryId, parentScopeId) });
1745
- if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1746
- }
1747
- function writeScopePassive(scopeId, partialScope) {
1748
- const target = $chunk.serializeState;
1749
- const scope = _scope_with_id(scopeId);
1750
- const passive = target.passiveScopes ||= {};
1751
- Object.assign(scope, partialScope);
1752
- passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
1753
- return scope;
1709
+ const kBranchId = Symbol("Branch Id");
1710
+ const kIsAsync = Symbol("Is Async");
1711
+ function isInResumedBranch() {
1712
+ return $chunk?.context?.[kBranchId] !== void 0;
1754
1713
  }
1755
- function _resume(val, id, scopeId) {
1756
- return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1714
+ function withBranchId(branchId, cb) {
1715
+ return withContext(kBranchId, branchId, cb);
1757
1716
  }
1758
- function _id() {
1759
- const state = $chunk.boundary.state;
1760
- const { $global } = state;
1761
- return "s" + $global.runtimeId + $global.renderId + (state.tagId++).toString(36);
1717
+ function withIsAsync(cb, value) {
1718
+ return withContext(kIsAsync, true, cb, value);
1762
1719
  }
1763
- function _scope_id() {
1764
- return $chunk.boundary.state.scopeId++;
1720
+ function _html(html) {
1721
+ $chunk.writeHTML(html);
1765
1722
  }
1766
- function _peek_scope_id() {
1767
- return $chunk.boundary.state.scopeId;
1723
+ function writeScript(script) {
1724
+ $chunk.writeScript(script);
1768
1725
  }
1769
- function getScopeById(scopeId) {
1770
- if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
1726
+ function _script(scopeId, registryId) {
1727
+ if ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) _resume_branch(scopeId);
1728
+ $chunk.boundary.state.needsMainRuntime = true;
1729
+ $chunk.writeEffect(scopeId, registryId);
1771
1730
  }
1772
- function _set_serialize_reason(reason) {
1773
- $chunk.boundary.state.serializeReason = reason;
1731
+ function _trailers(html) {
1732
+ $chunk.boundary.state.trailerHTML += html;
1774
1733
  }
1775
- function _scope_reason() {
1776
- const reason = $chunk.boundary.state.serializeReason;
1777
- $chunk.boundary.state.serializeReason = void 0;
1778
- return reason;
1734
+ function _resume(val, id, scopeId) {
1735
+ return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1779
1736
  }
1780
- function _serialize_if(condition, key) {
1781
- return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1737
+ function _el(scopeId, id) {
1738
+ return _resume(() => _el_read_error(), id, scopeId);
1782
1739
  }
1783
- function _serialize_guard(condition, key) {
1784
- return _serialize_if(condition, key) || 0;
1740
+ function _hoist(scopeId, id) {
1741
+ const getter = () => _hoist_read_error();
1742
+ getter[Symbol.iterator] = _hoist_read_error;
1743
+ return _resume(getter, id, scopeId);
1785
1744
  }
1786
1745
  function _el_resume(scopeId, accessor, shouldResume) {
1787
1746
  if (shouldResume === 0) return "";
@@ -1792,28 +1751,51 @@ function _el_resume(scopeId, accessor, shouldResume) {
1792
1751
  function _sep(shouldResume) {
1793
1752
  return shouldResume === 0 ? "" : "<!>";
1794
1753
  }
1795
- function _el(scopeId, id) {
1796
- return _resume(() => _el_read_error(), id, scopeId);
1797
- }
1798
- function _hoist(scopeId, id) {
1799
- const getter = () => _hoist_read_error();
1800
- getter[Symbol.iterator] = _hoist_read_error;
1801
- return _resume(getter, id, scopeId);
1802
- }
1803
1754
  function _resume_branch(scopeId) {
1804
1755
  const branchId = $chunk.context?.[kBranchId];
1805
1756
  if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { ["#ClosestBranchId"]: branchId });
1806
1757
  }
1807
- const kBranchId = Symbol("Branch Id");
1808
- const kIsAsync = Symbol("Is Async");
1809
- function isInResumedBranch() {
1810
- return $chunk?.context?.[kBranchId] !== void 0;
1758
+ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1759
+ const shouldResume = serializeReason !== 0;
1760
+ const render = normalizeServerRender(content);
1761
+ const branchId = _peek_scope_id();
1762
+ if (render) if (shouldResume) withBranchId(branchId, render);
1763
+ else render();
1764
+ if (_peek_scope_id() !== branchId) {
1765
+ if (shouldResume) writeScope(scopeId, {
1766
+ ["BranchScopes:" + nodeAccessor]: writeScope(branchId, {}),
1767
+ ["ConditionalRenderer:" + nodeAccessor]: render?.["id"]
1768
+ });
1769
+ } else _scope_id();
1811
1770
  }
1812
- function withBranchId(branchId, cb) {
1813
- return withContext(kBranchId, branchId, cb);
1771
+ function normalizeServerRender(value) {
1772
+ const renderer = normalizeDynamicRenderer(value);
1773
+ if (renderer) if (typeof renderer === "function") return renderer;
1774
+ else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1814
1775
  }
1815
- function withIsAsync(cb, value) {
1816
- return withContext(kIsAsync, true, cb, value);
1776
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1777
+ writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
1778
+ const childScope = writeScopePassive(childScopeId, { ["#TagVariable"]: _resume({}, registryId, parentScopeId) });
1779
+ if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1780
+ }
1781
+ function writeScopePassive(scopeId, partialScope) {
1782
+ const target = $chunk.serializeState;
1783
+ const scope = _scope_with_id(scopeId);
1784
+ const passive = target.passiveScopes ||= {};
1785
+ Object.assign(scope, partialScope);
1786
+ passive[scopeId] = Object.assign(passive[scopeId] || {}, partialScope);
1787
+ return scope;
1788
+ }
1789
+ function _show_start(display, mark) {
1790
+ if (display) {
1791
+ if (mark) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
1792
+ } else $chunk.writeHTML("<t hidden>");
1793
+ }
1794
+ function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1795
+ const branchId = _scope_id();
1796
+ const wrap = !display;
1797
+ if (wrap) $chunk.writeHTML("</t>");
1798
+ writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
1817
1799
  }
1818
1800
  function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1819
1801
  forBranches(by, (each) => each ? forOf(list, (item, index) => {
@@ -1900,17 +1882,6 @@ function writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, p
1900
1882
  } else $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
1901
1883
  else $chunk.writeHTML(endTag);
1902
1884
  }
1903
- function _show_start(display, mark) {
1904
- if (display) {
1905
- if (mark) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
1906
- } else $chunk.writeHTML("<t hidden>");
1907
- }
1908
- function _show_end(scopeId, accessor, display, serializeMarker, serializeStateful, parentEndTag, singleNode) {
1909
- const branchId = _scope_id();
1910
- const wrap = !display;
1911
- if (wrap) $chunk.writeHTML("</t>");
1912
- writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, wrap || singleNode ? 1 : void 0, " " + branchId);
1913
- }
1914
1885
  let writeScope = (scopeId, partialScope) => {
1915
1886
  const { state } = $chunk.boundary;
1916
1887
  const target = $chunk.serializeState;
@@ -1940,8 +1911,47 @@ function scopeWithId(state, scopeId) {
1940
1911
  if (!scope) scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId });
1941
1912
  return scope;
1942
1913
  }
1943
- function $global() {
1944
- return $chunk.boundary.state.$global;
1914
+ function _subscribe(subscribers, scope) {
1915
+ if (subscribers) {
1916
+ const { serializer } = $chunk.boundary.state;
1917
+ if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
1918
+ else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
1919
+ }
1920
+ return scope;
1921
+ }
1922
+ function _set_serialize_reason(reason) {
1923
+ $chunk.boundary.state.serializeReason = reason;
1924
+ }
1925
+ function _scope_reason() {
1926
+ const reason = $chunk.boundary.state.serializeReason;
1927
+ $chunk.boundary.state.serializeReason = void 0;
1928
+ return reason;
1929
+ }
1930
+ function _serialize_if(condition, key) {
1931
+ return condition && (condition === 1 || (typeof condition === "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1932
+ }
1933
+ function _serialize_guard(condition, key) {
1934
+ return _serialize_if(condition, key) || 0;
1935
+ }
1936
+ function writeWaitReady(readyId, renderer, input) {
1937
+ const chunk = $chunk;
1938
+ const { boundary } = chunk;
1939
+ const body = new Chunk(boundary, null, chunk.context, {
1940
+ readyId,
1941
+ parent: chunk.serializeState,
1942
+ resumes: "",
1943
+ writeScopes: {},
1944
+ flushScopes: false
1945
+ });
1946
+ const bodyEnd = body.render(renderer, input);
1947
+ if (body === bodyEnd) {
1948
+ chunk.writeHTML(body.html);
1949
+ body.deferOwnReady();
1950
+ chunk.deferredReady = push(chunk.deferredReady, body);
1951
+ } else {
1952
+ bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
1953
+ chunk.next = body;
1954
+ }
1945
1955
  }
1946
1956
  function _await(scopeId, accessor, promise, content, serializeMarker) {
1947
1957
  const resumeMarker = serializeMarker !== 0;
@@ -2065,6 +2075,7 @@ function tryCatch(content, catchContent) {
2065
2075
  else boundary.onNext();
2066
2076
  };
2067
2077
  }
2078
+ const NOOP$2 = () => {};
2068
2079
  var State = class {
2069
2080
  $global;
2070
2081
  tagId = 1;
@@ -2490,8 +2501,22 @@ function depsMarker(deps) {
2490
2501
  }
2491
2502
  return marker;
2492
2503
  }
2493
- function _trailers(html) {
2494
- $chunk.boundary.state.trailerHTML += html;
2504
+ function getFilteredGlobals($global) {
2505
+ if (!$global) return 0;
2506
+ const serializedGlobals = $global.serializedGlobals;
2507
+ if (!serializedGlobals) return 0;
2508
+ let filtered = 0;
2509
+ if (Array.isArray(serializedGlobals)) for (const key of serializedGlobals) {
2510
+ const value = $global[key];
2511
+ if (value !== void 0) if (filtered) filtered[key] = value;
2512
+ else filtered = { [key]: value };
2513
+ }
2514
+ else for (const key in serializedGlobals) if (serializedGlobals[key]) {
2515
+ const value = $global[key];
2516
+ if (value !== void 0) if (filtered) filtered[key] = value;
2517
+ else filtered = { [key]: value };
2518
+ }
2519
+ return filtered;
2495
2520
  }
2496
2521
  function concatEffects(a, b) {
2497
2522
  return a ? b ? a + " " + b : a : b;
@@ -2519,31 +2544,6 @@ function flushTickQueue() {
2519
2544
  tickQueue = void 0;
2520
2545
  for (const cb of queue) cb(true);
2521
2546
  }
2522
- function getFilteredGlobals($global) {
2523
- if (!$global) return 0;
2524
- const serializedGlobals = $global.serializedGlobals;
2525
- if (!serializedGlobals) return 0;
2526
- let filtered = 0;
2527
- if (Array.isArray(serializedGlobals)) for (const key of serializedGlobals) {
2528
- const value = $global[key];
2529
- if (value !== void 0) if (filtered) filtered[key] = value;
2530
- else filtered = { [key]: value };
2531
- }
2532
- else for (const key in serializedGlobals) if (serializedGlobals[key]) {
2533
- const value = $global[key];
2534
- if (value !== void 0) if (filtered) filtered[key] = value;
2535
- else filtered = { [key]: value };
2536
- }
2537
- return filtered;
2538
- }
2539
- function _subscribe(subscribers, scope) {
2540
- if (subscribers) {
2541
- const { serializer } = $chunk.boundary.state;
2542
- if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
2543
- else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
2544
- }
2545
- return scope;
2546
- }
2547
2547
  //#endregion
2548
2548
  //#region src/html/attrs.ts
2549
2549
  function _attr_class(value) {
@@ -2768,27 +2768,30 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2768
2768
  assertValidTagName(renderer);
2769
2769
  const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
2770
2770
  rendered = true;
2771
- _scope_id();
2772
- _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
2773
- if (!voidElementsReg.test(renderer)) {
2774
- const renderContent = content || normalizeDynamicRenderer(input.content);
2775
- if (renderer === "textarea") {
2776
- if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2777
- _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
2778
- } else if (renderContent) {
2779
- if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2780
- if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2781
- else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
2771
+ const renderNative = () => {
2772
+ _scope_id();
2773
+ _html(`<${renderer}${_attrs(input, `#${renderer}/0`, branchId, renderer)}>`);
2774
+ if (!voidElementsReg.test(renderer)) {
2775
+ const renderContent = content || normalizeDynamicRenderer(input.content);
2776
+ if (renderer === "textarea") {
2777
+ if (renderContent) throw new Error("A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead.");
2778
+ _html(_attr_textarea_value(branchId, `#${renderer}/0`, input.value, input.valueChange, 1));
2779
+ } else if (renderContent) {
2780
+ if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2781
+ if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, `#${renderer}/0`, input.value, input.valueChange, renderContent, 1);
2782
+ else _dynamic_tag(branchId, `#${renderer}/0`, renderContent, void 0, 0, void 0, serializeReason);
2783
+ }
2784
+ _html(`</${renderer}>`);
2785
+ } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2786
+ const childScope = getScopeById(branchId);
2787
+ const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
2788
+ if (needsScript) {
2789
+ writeScope(branchId, { ["#Renderer"]: renderer });
2790
+ _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2782
2791
  }
2783
- _html(`</${renderer}>`);
2784
- } else if (content) throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
2785
- const childScope = getScopeById(branchId);
2786
- const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
2787
- if (needsScript) {
2788
- writeScope(branchId, { ["#Renderer"]: renderer });
2789
- _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2790
- }
2791
- if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
2792
+ if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
2793
+ };
2794
+ renderNative();
2792
2795
  } else {
2793
2796
  if (shouldResume) _html(state.mark("[", ""));
2794
2797
  const render = () => {
@@ -2998,9 +3001,11 @@ var ServerRendered = class {
2998
3001
  boundary.onNext = NOOP$1;
2999
3002
  reject(boundary.signal.reason);
3000
3003
  break;
3001
- case 0:
3002
- resolve(head.consume().flushHTML());
3004
+ case 0: {
3005
+ const consumed = head.consume();
3006
+ if (!boundary.signal.aborted) resolve(consumed.flushHTML());
3003
3007
  break;
3008
+ }
3004
3009
  }
3005
3010
  })();
3006
3011
  });
@@ -15,59 +15,56 @@ interface SerializeState {
15
15
  type ScopeInternals = PartialScope & {
16
16
  [K_SCOPE_ID]?: number;
17
17
  };
18
- declare enum Mark {
19
- Placeholder = "!^",
20
- PlaceholderEnd = "!",
21
- ReorderMarker = "#"
22
- }
23
18
  export declare function getChunk(): Chunk | undefined;
24
19
  export declare function getContext(key: keyof NonNullable<Chunk["context"]>): unknown;
25
20
  export declare function getState(): State;
26
21
  export declare function getScopeId(scope: unknown): number | undefined;
22
+ export declare function getScopeById(scopeId: number | undefined): ScopeInternals | undefined;
23
+ export declare function $global(): $Global & {
24
+ renderId: string;
25
+ runtimeId: string;
26
+ };
27
+ export declare function _id(): string;
28
+ export declare function _scope_id(): number;
29
+ export declare function _peek_scope_id(): number;
30
+ export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
31
+ export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
32
+ export declare function isInResumedBranch(): boolean;
33
+ export declare function withBranchId<T>(branchId: number, cb: () => T): T;
27
34
  export declare function _html(html: string): void;
28
35
  export declare function writeScript(script: string): void;
29
- export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
30
36
  export declare function _script(scopeId: number, registryId: string): void;
31
- export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: 1 | 0): void;
32
- export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
33
- export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
34
- export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
37
+ export declare function _trailers(html: string): void;
35
38
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
36
- export declare function _id(): string;
37
- export declare function _scope_id(): number;
38
- export declare function _peek_scope_id(): number;
39
- export declare function getScopeById(scopeId: number | undefined): ScopeInternals | undefined;
40
- export type SerializeReasonValue = undefined | number | Partial<Record<string, 0 | 1>>;
41
- export declare function _set_serialize_reason(reason: SerializeReasonValue): void;
42
- export declare function _scope_reason(): SerializeReasonValue;
43
- export declare function _serialize_if(condition: SerializeReasonValue, key: number): 1 | undefined;
44
- export declare function _serialize_guard(condition: SerializeReasonValue, key: number): 0 | 1;
45
- export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: 0 | 1): string;
46
- export declare function _sep(shouldResume: 0 | 1): "" | "<!>";
47
39
  export declare function _el(scopeId: number, id: string): () => void;
48
40
  export declare function _hoist(scopeId: number, id: string): {
49
41
  (): void;
50
42
  [Symbol.iterator]: typeof _hoist_read_error;
51
43
  };
44
+ export declare function _el_resume(scopeId: number, accessor: Accessor, shouldResume?: number): string;
45
+ export declare function _sep(shouldResume: number): "" | "<!>";
52
46
  export declare function _resume_branch(scopeId: number): void;
53
- export declare function isInResumedBranch(): boolean;
54
- export declare function withBranchId<T>(branchId: number, cb: () => T): T;
55
- export declare function _for_of(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
56
- export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
57
- export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
58
- export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
59
- export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: 0 | 1, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1): void;
47
+ export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: number): void;
48
+ export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
60
49
  export declare function _show_start(display: unknown, mark?: unknown): void;
61
- export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, serializeMarker?: 0 | 1, serializeStateful?: 0 | 1, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
50
+ export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
51
+ export declare function _for_of(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
52
+ export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
53
+ export declare function _for_to(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
54
+ export declare function _for_until(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown), scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
55
+ export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
62
56
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
63
57
  export { writeScope as _scope };
64
58
  export declare function _existing_scope(scopeId: number): ScopeInternals;
65
59
  export declare function _scope_with_id(scopeId: number): ScopeInternals;
66
- export declare function $global(): $Global & {
67
- renderId: string;
68
- runtimeId: string;
69
- };
70
- export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, serializeMarker?: 0 | 1): void;
60
+ export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;
61
+ export type SerializeReasonValue = undefined | number | Partial<Record<string, 0 | 1>>;
62
+ export declare function _set_serialize_reason(reason: SerializeReasonValue): void;
63
+ export declare function _scope_reason(): SerializeReasonValue;
64
+ export declare function _serialize_if(condition: SerializeReasonValue, key: number): 1 | undefined;
65
+ export declare function _serialize_guard(condition: SerializeReasonValue, key: number): 0 | 1;
66
+ export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
67
+ export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, serializeMarker?: number): void;
71
68
  export declare function _try(scopeId: number, accessor: Accessor, content: () => void, input: {
72
69
  placeholder?: {
73
70
  content?(): void;
@@ -76,6 +73,11 @@ export declare function _try(scopeId: number, accessor: Accessor, content: () =>
76
73
  content?(err: unknown): void;
77
74
  };
78
75
  }): void;
76
+ declare enum Mark {
77
+ Placeholder = "!^",
78
+ PlaceholderEnd = "!",
79
+ ReorderMarker = "#"
80
+ }
79
81
  export declare class State implements SerializeState {
80
82
  $global: $Global & {
81
83
  renderId: string;
@@ -164,8 +166,6 @@ export declare class Chunk {
164
166
  flushScript(): this;
165
167
  flushHTML(): string;
166
168
  }
167
- export declare function _trailers(html: string): void;
168
169
  type QueueCallback = (ticked: true) => void;
169
170
  export declare function queueTick(cb: QueueCallback): void;
170
171
  export declare function offTick(cb: QueueCallback): void;
171
- export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;