marko 6.4.0 → 6.4.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.
Files changed (123) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/constants/accessor-prefix.d.ts +1 -0
  3. package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
  4. package/dist/common/constants/reserved-id.d.ts +5 -0
  5. package/dist/common/errors.d.ts +1 -1
  6. package/dist/common/types.d.ts +3 -0
  7. package/dist/debug/dom/catch.feat.js +1 -1
  8. package/dist/debug/dom/catch.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-input.feat.js +1 -1
  10. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-open.feat.js +1 -1
  12. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-select.feat.js +1 -1
  14. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  16. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  17. package/dist/debug/dom/controllable.feat.js +1 -1
  18. package/dist/debug/dom/controllable.feat.mjs +1 -1
  19. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  20. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  21. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  22. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  23. package/dist/debug/dom/lazy.feat.js +1 -1
  24. package/dist/debug/dom/lazy.feat.mjs +1 -1
  25. package/dist/debug/dom/placeholder.feat.js +1 -1
  26. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  27. package/dist/debug/{dom-BRO5aArp.js → dom-ClV4kVOO.js} +32 -16
  28. package/dist/debug/{dom-Btj2QJhk.mjs → dom-LFrKxOk5.mjs} +32 -16
  29. package/dist/debug/dom.js +1 -1
  30. package/dist/debug/dom.mjs +1 -1
  31. package/dist/debug/html.js +277 -222
  32. package/dist/debug/html.mjs +275 -220
  33. package/dist/dom/catch.feat.js +1 -1
  34. package/dist/dom/catch.feat.mjs +1 -1
  35. package/dist/dom/controllable-input.feat.js +1 -1
  36. package/dist/dom/controllable-input.feat.mjs +1 -1
  37. package/dist/dom/controllable-open.feat.js +1 -1
  38. package/dist/dom/controllable-open.feat.mjs +1 -1
  39. package/dist/dom/controllable-select.feat.js +1 -1
  40. package/dist/dom/controllable-select.feat.mjs +1 -1
  41. package/dist/dom/controllable-textarea.feat.js +1 -1
  42. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  43. package/dist/dom/controllable.feat.js +1 -1
  44. package/dist/dom/controllable.feat.mjs +1 -1
  45. package/dist/dom/dynamic-tag-script.feat.js +1 -1
  46. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  47. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  48. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  49. package/dist/dom/lazy.feat.js +1 -1
  50. package/dist/dom/lazy.feat.mjs +1 -1
  51. package/dist/dom/placeholder.feat.js +1 -1
  52. package/dist/dom/placeholder.feat.mjs +1 -1
  53. package/dist/dom/signals.d.ts +3 -2
  54. package/dist/{dom-BSsI9OPC.js → dom-CNglVi8P.js} +13 -4
  55. package/dist/{dom-B-v8Gw6T.mjs → dom-DfP3MCo0.mjs} +13 -4
  56. package/dist/dom.js +1 -1
  57. package/dist/dom.mjs +1 -1
  58. package/dist/html/attrs.d.ts +2 -2
  59. package/dist/html/dynamic-tag.d.ts +1 -1
  60. package/dist/html/inlined-runtimes.d.ts +1 -1
  61. package/dist/html/inlined-runtimes.debug.d.ts +1 -1
  62. package/dist/html/serializer.d.ts +1 -1
  63. package/dist/html/writer.d.ts +34 -22
  64. package/dist/html.d.ts +1 -1
  65. package/dist/html.js +224 -167
  66. package/dist/html.mjs +224 -167
  67. package/dist/translator/core/html-comment.d.ts +0 -7
  68. package/dist/translator/core/let.d.ts +0 -5
  69. package/dist/translator/core/show.d.ts +2 -5
  70. package/dist/translator/core/style.d.ts +6 -8
  71. package/dist/translator/index.d.ts +9 -0
  72. package/dist/translator/index.js +8573 -8458
  73. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  74. package/dist/translator/util/binding-prop-tree.d.ts +4 -4
  75. package/dist/translator/util/bindings.d.ts +127 -0
  76. package/dist/translator/util/body-to-text-literal.d.ts +1 -2
  77. package/dist/translator/util/branch-tag.d.ts +7 -7
  78. package/dist/translator/util/constants/binding-type.d.ts +5 -6
  79. package/dist/translator/util/constants/slot-kind.d.ts +14 -0
  80. package/dist/translator/util/constants/structure-kind.d.ts +1 -1
  81. package/dist/translator/util/evaluate.d.ts +11 -10
  82. package/dist/translator/util/finalize-references.d.ts +4 -0
  83. package/dist/translator/util/for-selector.d.ts +1 -1
  84. package/dist/translator/util/generate-uid.d.ts +3 -1
  85. package/dist/translator/util/get-declared-binding-expression.d.ts +2 -2
  86. package/dist/translator/util/is-core-tag.d.ts +0 -3
  87. package/dist/translator/util/is-only-child-in-parent.d.ts +2 -7
  88. package/dist/translator/util/known-tag.d.ts +8 -7
  89. package/dist/translator/util/read-replacement.d.ts +3 -0
  90. package/dist/translator/util/reasons.d.ts +32 -0
  91. package/dist/translator/util/references.d.ts +67 -166
  92. package/dist/translator/util/scope-accessor.d.ts +14 -0
  93. package/dist/translator/util/scope-read.d.ts +1 -1
  94. package/dist/translator/util/sections.d.ts +48 -48
  95. package/dist/translator/util/set-tag-derived-from.d.ts +7 -0
  96. package/dist/translator/util/setup-work.d.ts +1 -2
  97. package/dist/translator/util/signals.d.ts +3 -5
  98. package/dist/translator/util/slots.d.ts +50 -0
  99. package/dist/translator/util/solve-reasons.d.ts +10 -0
  100. package/dist/translator/util/sources.d.ts +21 -0
  101. package/dist/translator/util/structure.d.ts +5 -2
  102. package/dist/translator/util/tag-facts.d.ts +21 -0
  103. package/dist/translator/util/tag-name-type.d.ts +4 -1
  104. package/dist/translator/util/translate-attrs.d.ts +2 -0
  105. package/dist/translator/util/translate-var.d.ts +3 -0
  106. package/dist/translator/util/write-guard.d.ts +12 -0
  107. package/dist/translator/util/writer.d.ts +3 -3
  108. package/dist/translator/visitors/export-declaration.d.ts +9 -0
  109. package/dist/translator/visitors/function.d.ts +5 -4
  110. package/dist/translator/visitors/import-declaration.d.ts +2 -2
  111. package/dist/translator/visitors/placeholder.d.ts +0 -3
  112. package/dist/translator/visitors/program/index.d.ts +13 -3
  113. package/dist/translator/visitors/referenced-identifier.d.ts +2 -1
  114. package/dist/translator/visitors/tag/custom-tag.d.ts +1 -1
  115. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -3
  116. package/dist/translator/visitors/tag/index.d.ts +2 -1
  117. package/dist/translator/visitors/tag/native-tag.d.ts +26 -12
  118. package/package.json +2 -2
  119. package/dist/translator/util/insertion-context.d.ts +0 -1
  120. package/dist/translator/util/is-non-html-text.d.ts +0 -3
  121. package/dist/translator/util/serialize-guard.d.ts +0 -11
  122. package/dist/translator/util/serialize-reasons.d.ts +0 -37
  123. package/dist/translator/util/set-tag-sections-downstream.d.ts +0 -6
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js"), handlePendingTry = (fn, scope, branch) => {
2
+ let require_control_flow = require("../dom-CNglVi8P.js"), handlePendingTry = (fn, scope, branch) => {
3
3
  for (; branch;) {
4
4
  if (branch.O?.i) return (scope.J ||= ((branch.JS ||= (branch.O.m && ((complete) => branch.O.c = () => complete() || require_control_flow.an(branch, require_control_flow.on, require_control_flow.b))(branch.O.c), [])).push(scope), /* @__PURE__ */ new Set())).add(fn);
5
5
  branch = branch.N;
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { an as queueAsyncRender, b as runPendingEffects, on as queueEffect, rn as installCatch, y as renderCatch } from "../dom-B-v8Gw6T.mjs";
7
+ import { an as queueAsyncRender, b as runPendingEffects, on as queueEffect, rn as installCatch, y as renderCatch } from "../dom-DfP3MCo0.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((effects) => {
10
10
  let i = 0, fn, scope, branch;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  require_control_flow.U[0] = require_control_flow.k, require_control_flow.U[1] = require_control_flow.D, require_control_flow.U[2] = require_control_flow.P;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- import { D as _attr_input_checkedValue_script, P as _attr_input_value_script, U as controllableScripts, k as _attr_input_checked_script } from "../dom-B-v8Gw6T.mjs";
1
+ import { D as _attr_input_checkedValue_script, P as _attr_input_value_script, U as controllableScripts, k as _attr_input_checked_script } from "../dom-DfP3MCo0.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  //#region src/dom/controllable-open.feat.ts
4
4
  require_control_flow.U[4] = require_control_flow.C;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { C as _attr_details_or_dialog_open_script, U as controllableScripts } from "../dom-B-v8Gw6T.mjs";
1
+ import { C as _attr_details_or_dialog_open_script, U as controllableScripts } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  //#region src/dom/controllable-select.feat.ts
4
4
  require_control_flow.U[3] = require_control_flow.L;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { L as _attr_select_value_script, U as controllableScripts } from "../dom-B-v8Gw6T.mjs";
1
+ import { L as _attr_select_value_script, U as controllableScripts } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  //#region src/dom/controllable-textarea.feat.ts
4
4
  require_control_flow.U[2] = require_control_flow.P;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { P as _attr_input_value_script, U as controllableScripts } from "../dom-B-v8Gw6T.mjs";
1
+ import { P as _attr_input_value_script, U as controllableScripts } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.H.INPUT = require_control_flow.R, require_control_flow.H.TEXTAREA = require_control_flow.V, require_control_flow.H.SELECT = require_control_flow.B, require_control_flow.H.DETAILS = require_control_flow.H.DIALOG = require_control_flow.z;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { B as _controllable_select, H as controllableRenders, R as _controllable_input, V as _controllable_textarea, z as _controllable_open } from "../dom-B-v8Gw6T.mjs";
1
+ import { B as _controllable_select, H as controllableRenders, R as _controllable_input, V as _controllable_textarea, z as _controllable_open } from "../dom-DfP3MCo0.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  //#region src/dom/dynamic-tag-script.feat.ts
4
4
  require_control_flow.xt._d = require_control_flow.yn(require_control_flow.g);
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { g as dynamicTagScript, xt as _resumed, yn as withBranches } from "../dom-B-v8Gw6T.mjs";
1
+ import { g as dynamicTagScript, xt as _resumed, yn as withBranches } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/dynamic-tag-script.feat.ts
3
3
  _resumed._d = withBranches(dynamicTagScript);
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  //#region src/dom/dynamic-tag-var.feat.ts
3
- require("../dom-BSsI9OPC.js")._((branch) => branch.T(() => branch.S));
3
+ require("../dom-CNglVi8P.js")._((branch) => branch.T(() => branch.S));
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { _ as installDynamicTagVar } from "../dom-B-v8Gw6T.mjs";
1
+ import { _ as installDynamicTagVar } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/dynamic-tag-var.feat.ts
3
3
  installDynamicTagVar((branch) => branch.T(() => branch.S));
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  //#region src/dom/lazy.feat.ts
3
- require("../dom-BSsI9OPC.js").Ot();
3
+ require("../dom-CNglVi8P.js").Ot();
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Ot as withLazy } from "../dom-B-v8Gw6T.mjs";
1
+ import { Ot as withLazy } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/lazy.feat.ts
3
3
  withLazy();
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-BSsI9OPC.js");
2
+ let require_control_flow = require("../dom-CNglVi8P.js");
3
3
  //#region src/dom/placeholder.feat.ts
4
4
  require_control_flow.xt._f = (tryBranch) => {
5
5
  tryBranch.P &&= (require_control_flow.Xt(tryBranch.P), 0);
@@ -1,4 +1,4 @@
1
- import { Xt as destroyBranch, xt as _resumed } from "../dom-B-v8Gw6T.mjs";
1
+ import { Xt as destroyBranch, xt as _resumed } from "../dom-DfP3MCo0.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  _resumed._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
@@ -30,6 +30,7 @@ export declare function _global_read($global: Record<string, unknown>, key: stri
30
30
  export declare function _el_read<T>(value: T): T;
31
31
  type Hoistable<T> = (...args: unknown[]) => T;
32
32
  type Hoisted<T> = Hoistable<T> & Iterable<T>;
33
- export declare function _hoist<T>(...path: Accessor[]): (scope: Scope) => Hoisted<T>;
34
- export declare function _hoist_resume<T>(id: string, ...path: Accessor[]): (scope: Scope) => Hoisted<T>;
33
+ type HoistStep = Accessor | [Accessor, Accessor, number];
34
+ export declare function _hoist<T>(...path: HoistStep[]): (scope: Scope) => Hoisted<T>;
35
+ export declare function _hoist_resume<T>(id: string, ...path: HoistStep[]): (scope: Scope) => Hoisted<T>;
35
36
  export {};
@@ -30,8 +30,17 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
30
30
  for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
31
31
  walkNextSibling();
32
32
  }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
33
- let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(_to_text(value), parentNode.namespaceURI), newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
34
- branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
33
+ let prevValue = scope["R" + accessor];
34
+ if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
35
+ let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
36
+ if (prevValue === void 0 && lastChild !== firstChild) {
37
+ let node = firstChild, newNode = newContent.firstChild;
38
+ for (; (node = node.nextSibling) !== lastChild && node.isEqualNode(newNode);) newNode = newNode.nextSibling;
39
+ if (node === lastChild && !newNode) return;
40
+ }
41
+ let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
42
+ branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
43
+ }
35
44
  }), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
36
45
  nodeAccessor = decodeAccessor(nodeAccessor);
37
46
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
@@ -494,13 +503,13 @@ function* traverse(scope, path, args, i = path.length - 1) {
494
503
  if (scope) {
495
504
  if (Symbol.iterator in scope) for (let childScope of scope.values()) childScope.H !== 0 && (yield* traverse(childScope, path, args, i));
496
505
  else {
497
- let item = scope[path[i]];
506
+ let step = path[i], item = Array.isArray(step) ? (scope[step[1]] || 0) === step[2] && scope[step[0]] : scope[step];
498
507
  i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
499
508
  }
500
509
  }
501
510
  }
502
511
  function _hoist(...path) {
503
- return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
512
+ return path = path.map((p) => typeof p == "number" ? decodeAccessor(p) : p), (scope) => {
504
513
  let fn = (...args) => traverse(scope, path, args).next().value;
505
514
  return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
506
515
  };
@@ -29,8 +29,17 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
29
29
  for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
30
30
  walkNextSibling();
31
31
  }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
32
- let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(_to_text(value), parentNode.namespaceURI), newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
33
- branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
32
+ let prevValue = scope["R" + accessor];
33
+ if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
34
+ let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
35
+ if (prevValue === void 0 && lastChild !== firstChild) {
36
+ let node = firstChild, newNode = newContent.firstChild;
37
+ for (; (node = node.nextSibling) !== lastChild && node.isEqualNode(newNode);) newNode = newNode.nextSibling;
38
+ if (node === lastChild && !newNode) return;
39
+ }
40
+ let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
41
+ branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
42
+ }
34
43
  }), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
35
44
  nodeAccessor = decodeAccessor(nodeAccessor);
36
45
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
@@ -493,13 +502,13 @@ function* traverse(scope, path, args, i = path.length - 1) {
493
502
  if (scope) {
494
503
  if (Symbol.iterator in scope) for (let childScope of scope.values()) childScope.H !== 0 && (yield* traverse(childScope, path, args, i));
495
504
  else {
496
- let item = scope[path[i]];
505
+ let step = path[i], item = Array.isArray(step) ? (scope[step[1]] || 0) === step[2] && scope[step[0]] : scope[step];
497
506
  i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
498
507
  }
499
508
  }
500
509
  }
501
510
  function _hoist(...path) {
502
- return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
511
+ return path = path.map((p) => typeof p == "number" ? decodeAccessor(p) : p), (scope) => {
503
512
  let fn = (...args) => traverse(scope, path, args).next().value;
504
513
  return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
505
514
  };
package/dist/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("./dom-BSsI9OPC.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
+ let require_control_flow = require("./dom-CNglVi8P.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
3
3
  require_control_flow.wt($global.runtimeId);
4
4
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
5
5
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
package/dist/dom.mjs CHANGED
@@ -69,7 +69,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
69
69
  let renderer = _content(id, template, walks, setup, inputSignal)();
70
70
  return renderer.mount = mount, renderer._ = renderer, _resumed[id] = renderer;
71
71
  }, noop = (_) => 0;
72
- import { $ as _attrs, $t as syncGen, A as _attr_input_value, At as _closure, B as _controllable_select, Bt as _if_closure, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _for_selector, G as _attr_class, Gt as _return_change, Ht as _let_change, I as _attr_select_value_default, It as _global_read, J as _attr_content, Jt as _var_change, K as _attr_class_item, Kt as _script, L as _attr_select_value_script, Lt as _hoist, M as _attr_input_value_default, Mt as _const, N as _attr_input_value_dynamic_default, Nt as _el_read, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_closure, Q as _attr_style_items, Qt as removeAndDestroyBranch, R as _controllable_input, Rt as _hoist_resume, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _or, V as _controllable_textarea, Vt as _let, W as _attr, Wt as _return, X as _attr_style, Xt as destroyBranch, Y as _attr_nonce, Yt as _assert_init, Z as _attr_style_item, Zt as insertBranchBefore, _n as _hoist_read_error, _t as createBranch, a as _for_in, an as queueAsyncRender, at as _lifecycle, bt as _el, c as _for_to, cn as rendering, ct as _text, d as _for_until_unkeyed, dn as runId, dt as insertChildNodes, en as _on, et as _attrs_content, f as _if, fn as forIn, ft as toInsertNode, gn as _assert_hoist, gt as createAndSetupBranch, h as addAwaitCounter, hn as forUntil, ht as _content_resume, i as _dynamic_tag_content, in as prepareEffects, it as _html, j as _attr_input_value_attribute_default, jt as _closure_get, k as _attr_input_checked_script, kt as _child_setup, l as _for_to_unkeyed, ln as run, lt as _text_content, m as _try, mn as forTo, mt as _content_closures, n as _await_promise, nn as $signalReset, nt as _attrs_partial_content, o as _for_of, on as queueEffect, ot as _style_rule_item, p as _show, pn as forOf, pt as _content, q as _attr_class_items, qt as _var, r as _dynamic_tag, rt as _attrs_script, s as _for_of_unkeyed, sn as queueRender, st as _style_shell, t as _await_content, tn as $signal, tt as _attrs_partial, u as _for_until, un as runEffects, ut as _to_text, v as patchDynamicTag, vn as _call, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xt as _resumed, y as renderCatch, yt as _dynamic_tag_var_resume, z as _controllable_open, zt as _id } from "./dom-B-v8Gw6T.mjs";
72
+ import { $ as _attrs, $t as syncGen, A as _attr_input_value, At as _closure, B as _controllable_select, Bt as _if_closure, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _for_selector, G as _attr_class, Gt as _return_change, Ht as _let_change, I as _attr_select_value_default, It as _global_read, J as _attr_content, Jt as _var_change, K as _attr_class_item, Kt as _script, L as _attr_select_value_script, Lt as _hoist, M as _attr_input_value_default, Mt as _const, N as _attr_input_value_dynamic_default, Nt as _el_read, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_closure, Q as _attr_style_items, Qt as removeAndDestroyBranch, R as _controllable_input, Rt as _hoist_resume, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _or, V as _controllable_textarea, Vt as _let, W as _attr, Wt as _return, X as _attr_style, Xt as destroyBranch, Y as _attr_nonce, Yt as _assert_init, Z as _attr_style_item, Zt as insertBranchBefore, _n as _hoist_read_error, _t as createBranch, a as _for_in, an as queueAsyncRender, at as _lifecycle, bt as _el, c as _for_to, cn as rendering, ct as _text, d as _for_until_unkeyed, dn as runId, dt as insertChildNodes, en as _on, et as _attrs_content, f as _if, fn as forIn, ft as toInsertNode, gn as _assert_hoist, gt as createAndSetupBranch, h as addAwaitCounter, hn as forUntil, ht as _content_resume, i as _dynamic_tag_content, in as prepareEffects, it as _html, j as _attr_input_value_attribute_default, jt as _closure_get, k as _attr_input_checked_script, kt as _child_setup, l as _for_to_unkeyed, ln as run, lt as _text_content, m as _try, mn as forTo, mt as _content_closures, n as _await_promise, nn as $signalReset, nt as _attrs_partial_content, o as _for_of, on as queueEffect, ot as _style_rule_item, p as _show, pn as forOf, pt as _content, q as _attr_class_items, qt as _var, r as _dynamic_tag, rt as _attrs_script, s as _for_of_unkeyed, sn as queueRender, st as _style_shell, t as _await_content, tn as $signal, tt as _attrs_partial, u as _for_until, un as runEffects, ut as _to_text, v as patchDynamicTag, vn as _call, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xt as _resumed, y as renderCatch, yt as _dynamic_tag_var_resume, z as _controllable_open, zt as _id } from "./dom-DfP3MCo0.mjs";
73
73
  //#region src/common/attr-tag.ts
74
74
  function attrTag(attrs) {
75
75
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
@@ -18,7 +18,7 @@ export declare function _attr_and(name: string, value: unknown, attr: string): s
18
18
  export declare function _attr_or(name: string, value: unknown, attr: string): string;
19
19
  export declare function _attr_nullish(name: string, value: unknown, attr: string): string;
20
20
  export declare function _attrs(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string): string;
21
- export declare function _attrs_content(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string, serializeReason?: 1 | 0): void;
21
+ export declare function _attrs_content(data: Record<string, unknown>, nodeAccessor: Accessor, scopeId: number, tagName: string, markerGuard?: 1 | 0): void;
22
22
  export declare function _attrs_partial(data: Record<string, unknown>, skip: Record<string, 1>, nodeAccessor: Accessor, scopeId: number, tagName: string): string;
23
- export declare function _attrs_partial_content(data: Record<string, unknown>, skip: Record<string, 1>, nodeAccessor: Accessor, scopeId: number, tagName: string, serializeReason?: 1 | 0): void;
23
+ export declare function _attrs_partial_content(data: Record<string, unknown>, skip: Record<string, 1>, nodeAccessor: Accessor, scopeId: number, tagName: string, markerGuard?: 1 | 0): void;
24
24
  export declare function attrAssignment(value: string): string;
@@ -5,7 +5,7 @@ interface BodyContentObject {
5
5
  [x: PropertyKey]: unknown;
6
6
  content: ServerRenderer;
7
7
  }
8
- export declare let _dynamic_tag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, serializeReason?: 1 | 0) => unknown;
8
+ export declare let _dynamic_tag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, markerGuard?: 1 | 0) => unknown;
9
9
  export declare function _content(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
10
10
  export declare function _content_resume(id: string, fn: ServerRenderer, scopeId?: number, locals?: Locals): ServerRenderer;
11
11
  export declare const patchDynamicTag: (patch: (tag: unknown, scopeId: number, accessor: Accessor) => unknown) => void;
@@ -1,2 +1,2 @@
1
1
  export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
- export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
2
+ export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
@@ -1,2 +1,2 @@
1
1
  export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n // Only reorder markers (\"#\", \"!\") are ever looked up, so only they are\n // kept: the lookup lives as long as the page, and every node marker\n // would otherwise stay referenced in it after resume consumed it.\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((id = op.slice(prefixLen + 1)),\n (op = op[prefixLen]) > \"#\" || (lookup[id] = node),\n op)),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
- export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
2
+ export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n // The writer streams a reorder only after its markers.\n i: 1,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
@@ -1,6 +1,6 @@
1
1
  import type { Boundary, PartialScope } from "./writer";
2
2
  export declare const K_SCOPE_ID: unique symbol;
3
- export type Locals = (scope: (scopeId: number) => PartialScope) => (PartialScope | 0)[];
3
+ export type Locals = (scope: (scopeId: number) => PartialScope) => PartialScope[];
4
4
  export type ScopeFlush = [scopeId: number, scope: object, props: object];
5
5
  export interface SerializeChannel {
6
6
  readyId?: string;
@@ -38,7 +38,7 @@ export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
38
  export declare function withBranchId<T, U>(branchId: number, cb: (value: U) => T, cbValue: U): T;
39
39
  export declare function _html(html: string): void;
40
40
  export declare function writeScript(script: string): void;
41
- export declare function _script(scopeId: number, registryId: string, serializeMarker?: number): void;
41
+ export declare function _script(scopeId: number, registryId: string, markerGuard?: number): void;
42
42
  export declare function _trailers(html: string): void;
43
43
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number, locals?: Locals): T;
44
44
  export declare function _resume_locals<T extends WeakKey>(val: T, id: string, locals: Record<string, unknown>, ownerScopeId?: number): T;
@@ -51,31 +51,31 @@ export declare function _el_resume(scopeId: number, accessor: Accessor, shouldRe
51
51
  export declare function _text_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
52
52
  export declare function _html_resume(scopeId: number, accessor: Accessor, val: unknown, shouldResume?: number): string;
53
53
  export declare function _resume_branch(scopeId: number): void;
54
- export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: number): void;
54
+ export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, markerGuard?: number): void;
55
55
  export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
56
- export declare function _show_start(display: unknown, mark?: unknown): void;
57
- export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
58
- 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;
59
- 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;
60
- 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;
61
- 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;
62
- export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, serializeBranch?: number, serializeMarker?: number, serializeStateful?: number, parentEndTag?: string | 0, singleNode?: 1): void;
56
+ export declare function _show_start(display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0): void;
57
+ export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
58
+ 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, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
59
+ export declare function _for_in(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown), scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
60
+ 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, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
61
+ 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, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
62
+ export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
63
63
  export declare function deferBranchStart(chunk: Chunk): string;
64
64
  export declare function applyBranchStart(chunk: Chunk, beforeBranch: string, rendered: boolean): void;
65
65
  declare let writeScope: (scopeId: number, partialScope: PartialScope) => ScopeInternals;
66
66
  export { writeScope as _scope };
67
67
  export declare function _existing_scope(scopeId: number): ScopeInternals;
68
68
  export declare function _scope_with_id(scopeId: number): ScopeInternals;
69
- export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals, resumeId?: string, serializeMarker?: number): ScopeInternals;
70
- export type SerializeReasonValue = undefined | number | Partial<Record<string, number>>;
69
+ export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals, resumeId?: string, markerGuard?: number): ScopeInternals;
70
+ export type GroupMask = undefined | number | Partial<Record<string, number>>;
71
71
  export declare const CLIENT_ALL = 715827883;
72
- export declare function maskGroup(mask: SerializeReasonValue, group: number): number;
73
- export declare function _set_serialize_reason(reason: SerializeReasonValue): void;
74
- export declare function _scope_reason(): SerializeReasonValue;
75
- export declare function _serialize_if(condition: SerializeReasonValue, key: number): 1 | undefined;
76
- export declare function _serialize_guard(condition: SerializeReasonValue, key: number): 0 | 1;
72
+ export declare function maskGroup(mask: GroupMask, group: number): number;
73
+ export declare function _set_scope_reason(reason: GroupMask): void;
74
+ export declare function _scope_reason(): GroupMask;
75
+ export declare function _write_if(condition: GroupMask, key: number): 1 | undefined;
76
+ export declare function _write_guard(condition: GroupMask, key: number): 0 | 1;
77
77
  export declare function writeWaitReady(readyId: string, renderer: ServerRenderer, input: unknown): void;
78
- export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, serializeMarker?: number): void;
78
+ export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, markerGuard?: number): void;
79
79
  export declare function _try(scopeId: number, accessor: Accessor, content: () => void, placeholderContent?: ServerRenderer, catchContent?: ServerRenderer, placeholderId?: string, catchId?: string): void;
80
80
  declare const NOOP: () => void;
81
81
  type Mark = Mark.Value;
@@ -101,7 +101,7 @@ export declare class State implements SerializeState {
101
101
  flushScopes: boolean;
102
102
  writeScopes: Record<number, PartialScope>;
103
103
  readyIds: Set<string> | null;
104
- serializeReason: SerializeReasonValue;
104
+ scopeReason: GroupMask;
105
105
  $global: $Global & {
106
106
  renderId: string;
107
107
  runtimeId: string;
@@ -123,13 +123,18 @@ export declare class State implements SerializeState {
123
123
  }
124
124
  type FlushStatus = FlushStatus.Value;
125
125
  export { FlushStatus };
126
- export declare class Boundary extends AbortController {
126
+ export declare class Boundary {
127
127
  onNext: typeof NOOP;
128
128
  count: number;
129
129
  resumeWrites: number;
130
130
  state: State;
131
131
  parent?: Boundary;
132
+ aborted: boolean;
133
+ reason: unknown;
134
+ pendingReorders?: Set<Chunk>;
135
+ children?: Boundary[];
132
136
  constructor(state: State, signal?: AbortSignal, parent?: Boundary);
137
+ abort(reason: unknown): void;
133
138
  handleEvent(event: Event): void;
134
139
  flush(): 0 | 1 | 2;
135
140
  startAsync(): void;
@@ -142,9 +147,13 @@ export declare class Chunk {
142
147
  lastEffect: string;
143
148
  async: boolean;
144
149
  consumed: boolean;
145
- needsWalk: boolean;
146
150
  reorderId: string | null;
147
151
  deferredReady: Opt<Chunk>;
152
+ deferredReorder: Chunk | null;
153
+ catchRange: {
154
+ id: string;
155
+ end: Chunk;
156
+ } | null;
148
157
  placeholder: {
149
158
  body: Chunk;
150
159
  render: () => void;
@@ -164,8 +173,11 @@ export declare class Chunk {
164
173
  append(chunk: Chunk): void;
165
174
  takeDeferredReady(): Opt<Chunk>;
166
175
  deferOwnReady(): void;
167
- flushPlaceholder(): void;
168
- consume(): Chunk;
176
+ renderPlaceholders(boundary: Boundary): void;
177
+ renderPlaceholder(state: State): boolean;
178
+ markCatchRange(): void;
179
+ queueDeferredReorder(): void;
180
+ consume(boundary: Boundary): Chunk;
169
181
  render(content: () => void): Chunk;
170
182
  render<T>(content: (val: T) => void, val: T): Chunk;
171
183
  flushReadyScripts(boundary: Boundary, reservations?: string[], holdEffects?: boolean): string;
package/dist/html.d.ts CHANGED
@@ -7,4 +7,4 @@ export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_
7
7
  export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
8
8
  export { forIn, forOf, forTo, forUntil } from "./html/for";
9
9
  export { _template } from "./html/template";
10
- export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_resume, _scope_with_id, _script, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _text_resume, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";
10
+ export { _attr_content, _await, _el, _el_resume, _existing_scope, _for_in, _for_of, _for_to, _for_until, _hoist, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, _scope, _scope_id, _scope_reason, _html_resume, _scope_with_id, _script, _write_guard, _write_if, _set_scope_reason, _show_end, _show_start, _text_resume, _subscribe, _trailers, _try, _var, $global, } from "./html/writer";