marko 6.4.4 → 6.4.6

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 (133) hide show
  1. package/dist/common/errors.d.ts +2 -1
  2. package/dist/common/helpers.d.ts +7 -7
  3. package/dist/debug/dom/catch.feat.js +3 -3
  4. package/dist/debug/dom/catch.feat.mjs +3 -3
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +5 -5
  14. package/dist/debug/dom/controllable.feat.mjs +5 -5
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-CUxvM4i9.js → dom-CNgQ6lj9.js} +52 -52
  24. package/dist/debug/{dom-BeY1nGUb.mjs → dom-o9jQjchF.mjs} +43 -43
  25. package/dist/debug/dom.js +4 -4
  26. package/dist/debug/dom.mjs +4 -4
  27. package/dist/debug/html.js +721 -654
  28. package/dist/debug/html.mjs +721 -654
  29. package/dist/dom/catch.feat.js +4 -4
  30. package/dist/dom/catch.feat.mjs +3 -3
  31. package/dist/dom/control-flow.d.ts +2 -2
  32. package/dist/dom/controllable-input.feat.js +2 -2
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +2 -2
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +2 -2
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +2 -2
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.d.ts +4 -4
  41. package/dist/dom/controllable.feat.js +2 -2
  42. package/dist/dom/controllable.feat.mjs +2 -2
  43. package/dist/dom/dom.d.ts +5 -5
  44. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  45. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  46. package/dist/dom/dynamic-tag-var.feat.js +2 -2
  47. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  48. package/dist/dom/lazy.feat.js +1 -1
  49. package/dist/dom/lazy.feat.mjs +1 -1
  50. package/dist/dom/placeholder.feat.js +1 -1
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/signals.d.ts +4 -1
  53. package/dist/{dom-Diu8MpmL.js → dom-60R4bRWD.js} +40 -40
  54. package/dist/{dom-DefWmvQB.mjs → dom-Ci2W4l1P.mjs} +33 -33
  55. package/dist/dom.js +6 -6
  56. package/dist/dom.mjs +4 -4
  57. package/dist/html/assets.d.ts +1 -1
  58. package/dist/html/compat.d.ts +2 -1
  59. package/dist/html/control-flow.d.ts +20 -0
  60. package/dist/html/serializer.d.ts +63 -16
  61. package/dist/html/writer.d.ts +47 -35
  62. package/dist/html.d.ts +2 -1
  63. package/dist/html.js +517 -466
  64. package/dist/html.mjs +517 -466
  65. package/dist/translator/core/for.d.ts +0 -4
  66. package/dist/translator/core/return.d.ts +0 -3
  67. package/dist/translator/core/style.d.ts +2 -2
  68. package/dist/translator/index.js +8104 -8108
  69. package/dist/translator/util/analyze-errors.d.ts +2 -1
  70. package/dist/translator/util/assert.d.ts +8 -1
  71. package/dist/translator/util/bindings.d.ts +13 -9
  72. package/dist/translator/util/body-to-text.d.ts +9 -0
  73. package/dist/translator/util/branch-tag.d.ts +10 -3
  74. package/dist/translator/util/build-string-expression.d.ts +4 -0
  75. package/dist/translator/util/content-derives.d.ts +7 -0
  76. package/dist/translator/util/entry-builder.d.ts +16 -5
  77. package/dist/translator/util/finalize-references.d.ts +3 -2
  78. package/dist/translator/util/generate-uid.d.ts +3 -2
  79. package/dist/translator/util/get-root.d.ts +3 -3
  80. package/dist/translator/util/get-tag-name.d.ts +1 -1
  81. package/dist/translator/util/known-tag.d.ts +10 -8
  82. package/dist/translator/util/module-read.d.ts +0 -3
  83. package/dist/translator/util/module-registrations.d.ts +44 -0
  84. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  85. package/dist/translator/util/optional.d.ts +6 -1
  86. package/dist/translator/util/params-tree.d.ts +18 -0
  87. package/dist/translator/util/reasons.d.ts +10 -8
  88. package/dist/translator/util/references.d.ts +23 -28
  89. package/dist/translator/util/runtime.d.ts +0 -12
  90. package/dist/translator/util/scope-accessor.d.ts +0 -1
  91. package/dist/translator/util/scope-read.d.ts +3 -0
  92. package/dist/translator/util/section-renderer.d.ts +4 -0
  93. package/dist/translator/util/sections.d.ts +16 -16
  94. package/dist/translator/util/setup-work.d.ts +2 -1
  95. package/dist/translator/util/signals.d.ts +22 -11
  96. package/dist/translator/util/simplify-fn.d.ts +1 -0
  97. package/dist/translator/util/slots.d.ts +2 -2
  98. package/dist/translator/util/solve-reasons.d.ts +1 -3
  99. package/dist/translator/util/sources.d.ts +2 -1
  100. package/dist/translator/util/statement-tag.d.ts +2 -0
  101. package/dist/translator/util/static-text.d.ts +2 -1
  102. package/dist/translator/util/structure.d.ts +0 -10
  103. package/dist/translator/util/tag-facts.d.ts +8 -1
  104. package/dist/translator/util/tag-import.d.ts +20 -0
  105. package/dist/translator/util/tag-name-type.d.ts +9 -2
  106. package/dist/translator/util/to-only-or-block.d.ts +3 -0
  107. package/dist/translator/util/to-property-name.d.ts +2 -0
  108. package/dist/translator/util/translate-attrs.d.ts +7 -5
  109. package/dist/translator/util/translate-var.d.ts +2 -0
  110. package/dist/translator/util/traverse.d.ts +1 -2
  111. package/dist/translator/util/visitors.d.ts +4 -1
  112. package/dist/translator/util/with-previous-location.d.ts +1 -1
  113. package/dist/translator/util/write-guard.d.ts +6 -2
  114. package/dist/translator/util/writer.d.ts +1 -2
  115. package/dist/translator/visitors/export-declaration.d.ts +2 -3
  116. package/dist/translator/visitors/function.d.ts +0 -35
  117. package/dist/translator/visitors/import-declaration.d.ts +0 -16
  118. package/dist/translator/visitors/placeholder.d.ts +2 -1
  119. package/dist/translator/visitors/program/html.d.ts +0 -1
  120. package/dist/translator/visitors/program/index.d.ts +4 -5
  121. package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
  122. package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
  123. package/package.json +4 -4
  124. package/dist/translator/util/binding-has-prop.d.ts +0 -8
  125. package/dist/translator/util/binding-prop-tree.d.ts +0 -18
  126. package/dist/translator/util/body-to-text-literal.d.ts +0 -9
  127. package/dist/translator/util/import-reference.d.ts +0 -3
  128. package/dist/translator/util/normalize-string-expression.d.ts +0 -4
  129. package/dist/translator/util/plugin-hooks.d.ts +0 -4
  130. package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
  131. package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
  132. package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
  133. package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
@@ -48,12 +48,12 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
48
48
  let newFirstChild = scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), newLastChild = scope["H" + accessor] = newContent.lastChild, branch = scope.F;
49
49
  branch?.S === firstChild && (branch.S = newFirstChild), branch?.K === lastChild && (branch.K = newLastChild), insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild), removeChildNodes(firstChild, lastChild);
50
50
  }
51
- }), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
51
+ }), R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableSpreadHelpers = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
52
52
  nodeAccessor = decodeAccessor(nodeAccessor);
53
53
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
54
54
  for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
55
55
  return (scope, newBranch) => {
56
- newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
56
+ newBranch !== (scope[branchAccessor] ?? (scope["A" + nodeAccessor] && 0)) && setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
57
57
  };
58
58
  }), _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
59
59
  nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor)), endNodeAccessor !== void 0 && (endNodeAccessor = decodeAccessor(endNodeAccessor));
@@ -77,16 +77,16 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
77
77
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
78
78
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
79
79
  let renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
80
- if (setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer), getTagVar && (normalizedRenderer ? (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value), bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer)) : getTagVar()(scope)), typeof renderer == "string") {
80
+ if (setBranch(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer), getTagVar && (normalizedRenderer ? (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value), bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer)) : getTagVar()(scope)), typeof renderer == "string") {
81
81
  if (getContent) {
82
82
  let content = getContent(scope);
83
- setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
83
+ setBranch(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
84
84
  }
85
85
  } else renderer && (setupBranch(renderer, scope[childScopeAccessor]), renderer.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor]));
86
86
  }
87
87
  if (normalizedRenderer) {
88
88
  let childScope = scope[childScopeAccessor], args = getInput?.();
89
- if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
89
+ if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
90
90
  else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d) {
91
91
  if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
92
92
  else {
@@ -103,7 +103,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
103
103
  nodeAccessor = decodeAccessor(nodeAccessor);
104
104
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
105
105
  return (scope, renderer) => {
106
- scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer?.g?.(scope[childScopeAccessor]);
106
+ scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setBranch(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer?.g?.(scope[childScopeAccessor]);
107
107
  };
108
108
  }), bindTagVar, loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, template, walks, setup, params) => {
109
109
  nodeAccessor = decodeAccessor(nodeAccessor);
@@ -144,10 +144,10 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
144
144
  function _call(fn, v) {
145
145
  return fn(v), v;
146
146
  }
147
- function stringifyClassObject(name, value) {
147
+ function stringifyClassEntry(name, value) {
148
148
  return value ? name : "";
149
149
  }
150
- function stringifyStyleObject(name, value) {
150
+ function stringifyStyleEntry(name, value) {
151
151
  return value || value === 0 ? escapeStyleAttr(name) + ":" + escapeStyleAttr(value + "") : "";
152
152
  }
153
153
  function escapeStyleAttr(str) {
@@ -161,10 +161,10 @@ function escapeStyleValue(str) {
161
161
  function isEventHandler(name) {
162
162
  return /^on[A-Z-]/.test(name);
163
163
  }
164
- function getEventHandlerName(name) {
164
+ function getEventType(name) {
165
165
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
166
166
  }
167
- function isNotVoid(value) {
167
+ function isNotNullishOrFalse(value) {
168
168
  return value != null && value !== !1;
169
169
  }
170
170
  function isPromise(value) {
@@ -740,7 +740,7 @@ function setAttribute(element, name, value) {
740
740
  element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
741
741
  }
742
742
  function _attr_class(element, value) {
743
- setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
743
+ setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassEntry) || void 0);
744
744
  }
745
745
  function _attr_class_items(element, items) {
746
746
  for (let key in items) _attr_class_item(element, key, items[key]);
@@ -755,7 +755,7 @@ function _attr_class_names(element, names, value) {
755
755
  while (start = end + 1);
756
756
  }
757
757
  function _attr_style(element, value) {
758
- setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
758
+ setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleEntry) || void 0);
759
759
  }
760
760
  function _attr_style_items(element, items) {
761
761
  for (let key in items) _attr_style_item(element, key, items[key]);
@@ -803,7 +803,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
803
803
  !skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs))) && el.removeAttribute(name);
804
804
  }
805
805
  for (let name in nextAttrs) {
806
- let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
806
+ let key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
807
807
  skip[key] || (partial[key] = nextAttrs[name]);
808
808
  }
809
809
  attrsInternal(scope, nodeAccessor, partial, controllable);
@@ -824,13 +824,13 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
824
824
  case "style":
825
825
  _attr_style(el, value);
826
826
  break;
827
- default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
827
+ default: isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventType(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
828
828
  }
829
829
  }
830
830
  }
831
831
  function _attr_content(scope, nodeAccessor, value) {
832
832
  let content = normalizeClientRender(value);
833
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
833
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
834
834
  }
835
835
  function _attrs_script(scope, nodeAccessor) {
836
836
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
@@ -842,7 +842,7 @@ function normalizeClientRender(value) {
842
842
  if (renderer && renderer.a) return renderer;
843
843
  }
844
844
  function normalizeAttrValue(value) {
845
- if (isNotVoid(value)) return value === !0 ? "" : value + "";
845
+ if (isNotNullishOrFalse(value)) return value === !0 ? "" : value + "";
846
846
  }
847
847
  function _lifecycle(scope, thisObj, index = 0) {
848
848
  let accessor = "K" + index, instance = scope[accessor];
@@ -885,7 +885,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
885
885
  //#endregion
886
886
  //#region src/dom/controllable.ts
887
887
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
888
- let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
888
+ let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
889
889
  if (el.defaultChecked !== normalizedChecked) {
890
890
  let restoreValue = scope.H < runId ? el.checked : normalizedChecked;
891
891
  el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
@@ -895,9 +895,9 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
895
895
  * page carries only the control kinds its tags can be (`_attrs_script`
896
896
  * resolves the kind at run time). */
897
897
  /** The render pass equivalent, for a tag whose name is only known at run time;
898
- * a statically named tag passes its claim to `_attrs` instead. */
898
+ * a statically named tag passes its helper to `_attrs` instead. */
899
899
  function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
900
- let el = scope[nodeAccessor], normalizedChecked = isNotVoid(checked);
900
+ let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
901
901
  scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && scope.H < runId ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
902
902
  }
903
903
  function _attr_input_checked_script(scope, nodeAccessor) {
@@ -995,7 +995,7 @@ function _attr_select_value_script(scope, nodeAccessor) {
995
995
  }
996
996
  }
997
997
  }
998
- syncControllableFormInput(el, hasSelectChanged, onChange), observeOnce(scope, nodeAccessor, {
998
+ syncControllableFormInput(el, hasSelectChanged, onChange), observeControlled(scope, nodeAccessor, {
999
999
  childList: !0,
1000
1000
  subtree: !0
1001
1001
  }, () => {
@@ -1011,15 +1011,15 @@ function getSelectValue(el, multiple) {
1011
1011
  return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
1012
1012
  }
1013
1013
  function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
1014
- scope.H === runId && (scope[nodeAccessor].open = isNotVoid(open));
1014
+ scope.H === runId && (scope[nodeAccessor].open = isNotNullishOrFalse(open));
1015
1015
  }
1016
1016
  function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
1017
- let normalizedOpen = scope["G" + nodeAccessor] = isNotVoid(open);
1017
+ let normalizedOpen = scope["G" + nodeAccessor] = isNotNullishOrFalse(open);
1018
1018
  scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange && scope.H < runId ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
1019
1019
  }
1020
1020
  function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1021
1021
  let el = scope[nodeAccessor];
1022
- observeOnce(scope, nodeAccessor, {
1022
+ observeControlled(scope, nodeAccessor, {
1023
1023
  attributes: !0,
1024
1024
  attributeFilter: ["open"]
1025
1025
  }, () => {
@@ -1030,7 +1030,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1030
1030
  }
1031
1031
  });
1032
1032
  }
1033
- function observeOnce(scope, nodeAccessor, init, callback) {
1033
+ function observeControlled(scope, nodeAccessor, init, callback) {
1034
1034
  (scope["N" + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
1035
1035
  }
1036
1036
  function syncControllableFormInput(el, hasChanged, onChange) {
@@ -1104,9 +1104,9 @@ function _await_promise(nodeAccessor, params) {
1104
1104
  detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
1105
1105
  }
1106
1106
  }
1107
- })), scheduleAwaitFrame(awaitCounter, scope, () => {
1107
+ })), countAwait(awaitCounter, scope, () => {
1108
1108
  awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
1109
- })) : awaitCounter = addAwaitCounter(scope, tryBranch));
1109
+ })) : awaitCounter = startAwait(scope, tryBranch));
1110
1110
  let thisPromise = scope[promiseAccessor] = promise.then((data) => {
1111
1111
  if (thisPromise === scope[promiseAccessor]) {
1112
1112
  let referenceNode = scope[nodeAccessor];
@@ -1132,14 +1132,14 @@ function _await_content(nodeAccessor, template, walks, setup) {
1132
1132
  scope[branchAccessor].Y = pendingScopes, typeof scope[promiseAccessor] == "function" && scope[promiseAccessor]();
1133
1133
  };
1134
1134
  }
1135
- function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
1135
+ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1136
1136
  if (!tryBranch) return;
1137
1137
  let awaitCounter = tryBranch.O;
1138
- return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1138
+ return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), countAwait(awaitCounter, tryBranch, () => {
1139
1139
  (tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q(), tryBranch._, tryBranch.S.parentNode)).PT = tryBranch, insertBranchBefore(tryBranch.P, tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
1140
1140
  }), awaitCounter;
1141
1141
  }
1142
- function scheduleAwaitFrame(awaitCounter, scope, render) {
1142
+ function countAwait(awaitCounter, scope, render) {
1143
1143
  awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1144
1144
  }
1145
1145
  function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
@@ -1179,7 +1179,7 @@ function _try(nodeAccessor, template, walks, setup, placeholderContent, catchCon
1179
1179
  nodeAccessor = decodeAccessor(nodeAccessor);
1180
1180
  let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
1181
1181
  return (scope) => {
1182
- setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1182
+ setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
1183
1183
  let branch = scope[branchAccessor];
1184
1184
  branch.C = nodeAccessor, branch.E = catchContent, branch.Q = placeholderContent || void 0;
1185
1185
  };
@@ -1190,7 +1190,7 @@ function renderCatch(scope, error) {
1190
1190
  let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
1191
1191
  placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch));
1192
1192
  let catchContent = tryWithCatch.E();
1193
- setConditionalRenderer(owner, tryWithCatch.C, catchContent, createAndSetupBranch), catchContent.d?.(owner["A" + tryWithCatch.C], [error]);
1193
+ setBranch(owner, tryWithCatch.C, catchContent, createAndSetupBranch), catchContent.d?.(owner["A" + tryWithCatch.C], [error]);
1194
1194
  } else throw error;
1195
1195
  }
1196
1196
  function findTryWithPlaceholder(scope) {
@@ -1215,7 +1215,7 @@ function installDynamicTagVar(bind) {
1215
1215
  function dynamicTagScript(branch) {
1216
1216
  _attrs_script(branch, "a");
1217
1217
  }
1218
- function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
1218
+ function setBranch(scope, nodeAccessor, newRenderer, createBranch) {
1219
1219
  let referenceNode = scope[nodeAccessor], prevBranch = scope["A" + nodeAccessor], parentNode = referenceNode.nodeType > 1 ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" + nodeAccessor] = newRenderer && createBranch(scope.$, newRenderer, scope, parentNode);
1220
1220
  referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.S) : parentNode.insertBefore(referenceNode, prevBranch.S), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
1221
1221
  }
@@ -1243,4 +1243,4 @@ function byFirstArg(name) {
1243
1243
  return name;
1244
1244
  }
1245
1245
  //#endregion
1246
- export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, withLazy as At, _controllable_select as B, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _call as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, initEmbedded as Dt, _attr_input_checkedValue_default as E, init as Et, _attr_select_value as F, _el_read as Ft, _attr_class as G, _or as Gt, controllableRenders as H, _if_closure as Ht, _attr_select_value_default as I, _for_closure as It, _attr_class_names as J, _script as Jt, _attr_class_item as K, _return as Kt, _attr_select_value_script as L, _for_selector as Lt, _attr_input_value_default as M, _closure as Mt, _attr_input_value_dynamic_default as N, _closure_get as Nt, _attr_input_checked_default as O, ready as Ot, _attr_input_value_script as P, _const as Pt, _attr_style_item as Q, destroyBranch as Qt, _controllable_input as R, _global_read as Rt, _attr_details_or_dialog_open_default as S, _hoist_read_error as Sn, _el as St, _attr_input_checkedValue as T, getRegisteredWithScope as Tt, controllableScripts as U, _let as Ut, _controllable_textarea as V, _id as Vt, _attr as W, _let_change as Wt, _attr_nonce as X, _var_change as Xt, _attr_content as Y, _var as Yt, _attr_style as Z, _assert_init as Zt, installDynamicTagVar as _, forOf as _n, _return_setup as _t, _for_in as a, createBranchRenders as an, _html as at, runPendingEffects as b, _assert_class_toggles as bn, setupBranch as bt, _for_to as c, prepareEffects as cn, _style_shell as ct, _for_until_unkeyed as d, queueRender as dn, _to_text as dt, removeAndDestroyBranch as en, _attrs as et, _if as f, rendering as fn, insertChildNodes as ft, dynamicTagScript as g, forIn as gn, _content_resume as gt, addAwaitCounter as h, runId as hn, _content_closures as ht, _dynamic_tag_content as i, $signalReset as in, _attrs_script as it, _attr_input_value_attribute_default as j, _child_setup as jt, _attr_input_checked_script as k, readyFailed as kt, _for_to_unkeyed as l, queueAsyncRender as ln, _text as lt, _try as m, runEffects as mn, _content as mt, _await_promise as n, _on as nn, _attrs_partial as nt, _for_of as o, installBranchRenders as on, _lifecycle as ot, _show as p, run as pn, toInsertNode as pt, _attr_class_items as q, _return_change as qt, _dynamic_tag as r, $signal as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, installCatch as sn, _style_rule_item as st, _await_content as t, syncGen as tn, _attrs_content as tt, _for_until as u, queueEffect as un, _text_content as ut, patchDynamicTag as v, forTo as vn, createAndSetupBranch as vt, _attr_input_checked as w, withBranches as wn, _var_resume as wt, _attr_details_or_dialog_open as x, _assert_hoist as xn, _dynamic_tag_var_resume as xt, renderCatch as y, forUntil as yn, createBranch as yt, _controllable_open as z, _hoist as zt };
1246
+ export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, withLazy as At, _controllable_select as B, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _call as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, initEmbedded as Dt, _attr_input_checkedValue_default as E, init as Et, _attr_select_value as F, _el_read as Ft, _attr_class as G, _or as Gt, controllableScripts as H, _if_closure as Ht, _attr_select_value_default as I, _for_closure as It, _attr_class_names as J, _script as Jt, _attr_class_item as K, _return as Kt, _attr_select_value_script as L, _for_selector as Lt, _attr_input_value_default as M, _closure as Mt, _attr_input_value_dynamic_default as N, _closure_get as Nt, _attr_input_checked_default as O, ready as Ot, _attr_input_value_script as P, _const as Pt, _attr_style_item as Q, destroyBranch as Qt, _controllable_input as R, _global_read as Rt, _attr_details_or_dialog_open_default as S, _hoist_read_error as Sn, _el as St, _attr_input_checkedValue as T, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, _let as Ut, _controllable_textarea as V, _id as Vt, _attr as W, _let_change as Wt, _attr_nonce as X, _var_change as Xt, _attr_content as Y, _var as Yt, _attr_style as Z, _assert_init as Zt, patchDynamicTag as _, forOf as _n, _return_setup as _t, _for_in as a, createBranchRenders as an, _html as at, startAwait as b, _assert_class_toggles as bn, setupBranch as bt, _for_to as c, prepareEffects as cn, _style_shell as ct, _for_until_unkeyed as d, queueRender as dn, _to_text as dt, removeAndDestroyBranch as en, _attrs as et, _if as f, rendering as fn, insertChildNodes as ft, installDynamicTagVar as g, forIn as gn, _content_resume as gt, dynamicTagScript as h, runId as hn, _content_closures as ht, _dynamic_tag_content as i, $signalReset as in, _attrs_script as it, _attr_input_value_attribute_default as j, _child_setup as jt, _attr_input_checked_script as k, readyFailed as kt, _for_to_unkeyed as l, queueAsyncRender as ln, _text as lt, _try as m, runEffects as mn, _content as mt, _await_promise as n, _on as nn, _attrs_partial as nt, _for_of as o, installBranchRenders as on, _lifecycle as ot, _show as p, run as pn, toInsertNode as pt, _attr_class_items as q, _return_change as qt, _dynamic_tag as r, $signal as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, installCatch as sn, _style_rule_item as st, _await_content as t, syncGen as tn, _attrs_content as tt, _for_until as u, queueEffect as un, _text_content as ut, renderCatch as v, forTo as vn, createAndSetupBranch as vt, _attr_input_checked as w, withBranches as wn, _var_resume as wt, _attr_details_or_dialog_open as x, _assert_hoist as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, forUntil as yn, createBranch as yt, _controllable_open as z, _hoist as zt };
package/dist/dom.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- let require_control_flow = require("./dom-Diu8MpmL.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
+ let require_control_flow = require("./dom-60R4bRWD.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
3
3
  require_control_flow.Et($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;
6
6
  }, compat = {
7
- patchDynamicTag: require_control_flow.v,
7
+ patchDynamicTag: require_control_flow._,
8
8
  queueEffect: require_control_flow.un,
9
9
  init(warp10Noop) {
10
10
  require_control_flow.Ct.$C_s = (scope) => {
@@ -131,7 +131,7 @@ function mount(input = {}, reference, position) {
131
131
  //#region src/dom/load.ts
132
132
  function _load_template(id, load) {
133
133
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
134
- let awaitCounter = require_control_flow.h(branch);
134
+ let awaitCounter = require_control_flow.b(branch);
135
135
  branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
136
136
  Object.assign(lazyTemplate, renderer), require_control_flow.ln(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
137
137
  }, loadFailed(branch, awaitCounter));
@@ -143,7 +143,7 @@ function _load_setup(load) {
143
143
  return (owner, child, marker) => {
144
144
  if (renderer) require_control_flow.dn(child, insertCached, -1, marker);
145
145
  else {
146
- let awaitCounter = require_control_flow.h(owner);
146
+ let awaitCounter = require_control_flow.b(owner);
147
147
  child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
148
148
  renderer ||= require_control_flow.mt("", ...mod._)(), require_control_flow.ln(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
149
149
  }, loadFailed(child, awaitCounter));
@@ -157,7 +157,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
157
157
  require_control_flow.$t(branch, parent(), marker), marker.remove(), awaitCounter?.c();
158
158
  }, remaining;
159
159
  if (remaining = values?.size) {
160
- awaitCounter ||= require_control_flow.h(branch);
160
+ awaitCounter ||= require_control_flow.b(branch);
161
161
  let fail = loadFailed(branch, awaitCounter);
162
162
  values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.ln(branch, (branch) => {
163
163
  clone(), renderer.c?.(branch), values.forEach(([value, apply]) => apply(branch, value)), insert();
@@ -166,7 +166,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
166
166
  }
167
167
  function loadFailed(scope, awaitCounter) {
168
168
  return (error) => {
169
- awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.ln(scope, require_control_flow.y, error);
169
+ awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.i && awaitCounter.c()), require_control_flow.ln(scope, require_control_flow.v, error);
170
170
  };
171
171
  }
172
172
  function _load_signal(load) {
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 _attr_style_items, $t as insertBranchBefore, A as _attr_input_value, B as _controllable_select, Bt as _hoist_resume, C as _attr_details_or_dialog_open_script, Cn as _call, Ct as _resumed, D as _attr_input_checkedValue_script, Dt as initEmbedded, E as _attr_input_checkedValue_default, Et as init, F as _attr_select_value, Ft as _el_read, G as _attr_class, Gt as _or, Ht as _if_closure, I as _attr_select_value_default, It as _for_closure, J as _attr_class_names, Jt as _script, K as _attr_class_item, Kt as _return, L as _attr_select_value_script, Lt as _for_selector, M as _attr_input_value_default, Mt as _closure, N as _attr_input_value_dynamic_default, Nt as _closure_get, O as _attr_input_checked_default, Ot as ready, P as _attr_input_value_script, Pt as _const, Q as _attr_style_item, Qt as destroyBranch, R as _controllable_input, Rt as _global_read, S as _attr_details_or_dialog_open_default, Sn as _hoist_read_error, St as _el, T as _attr_input_checkedValue, Tt as getRegisteredWithScope, Ut as _let, V as _controllable_textarea, Vt as _id, W as _attr, Wt as _let_change, X as _attr_nonce, Xt as _var_change, Y as _attr_content, Yt as _var, Z as _attr_style, Zt as _assert_init, _n as forOf, _t as _return_setup, a as _for_in, at as _html, bn as _assert_class_toggles, bt as setupBranch, c as _for_to, cn as prepareEffects, ct as _style_shell, d as _for_until_unkeyed, dn as queueRender, dt as _to_text, en as removeAndDestroyBranch, et as _attrs, f as _if, fn as rendering, ft as insertChildNodes, gn as forIn, gt as _content_resume, h as addAwaitCounter, hn as runId, ht as _content_closures, i as _dynamic_tag_content, in as $signalReset, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _child_setup, k as _attr_input_checked_script, kt as readyFailed, l as _for_to_unkeyed, ln as queueAsyncRender, lt as _text, m as _try, mn as runEffects, mt as _content, n as _await_promise, nn as _on, nt as _attrs_partial, o as _for_of, ot as _lifecycle, p as _show, pn as run, pt as toInsertNode, q as _attr_class_items, qt as _return_change, r as _dynamic_tag, rn as $signal, rt as _attrs_partial_content, s as _for_of_unkeyed, st as _style_rule_item, t as _await_content, tn as syncGen, tt as _attrs_content, u as _for_until, un as queueEffect, ut as _text_content, v as patchDynamicTag, vn as forTo, vt as createAndSetupBranch, w as _attr_input_checked, wt as _var_resume, x as _attr_details_or_dialog_open, xn as _assert_hoist, xt as _dynamic_tag_var_resume, y as renderCatch, yn as forUntil, yt as createBranch, z as _controllable_open, zt as _hoist } from "./dom-DefWmvQB.mjs";
72
+ import { $ as _attr_style_items, $t as insertBranchBefore, A as _attr_input_value, B as _controllable_select, Bt as _hoist_resume, C as _attr_details_or_dialog_open_script, Cn as _call, Ct as _resumed, D as _attr_input_checkedValue_script, Dt as initEmbedded, E as _attr_input_checkedValue_default, Et as init, F as _attr_select_value, Ft as _el_read, G as _attr_class, Gt as _or, Ht as _if_closure, I as _attr_select_value_default, It as _for_closure, J as _attr_class_names, Jt as _script, K as _attr_class_item, Kt as _return, L as _attr_select_value_script, Lt as _for_selector, M as _attr_input_value_default, Mt as _closure, N as _attr_input_value_dynamic_default, Nt as _closure_get, O as _attr_input_checked_default, Ot as ready, P as _attr_input_value_script, Pt as _const, Q as _attr_style_item, Qt as destroyBranch, R as _controllable_input, Rt as _global_read, S as _attr_details_or_dialog_open_default, Sn as _hoist_read_error, St as _el, T as _attr_input_checkedValue, Tt as getRegisteredWithScope, Ut as _let, V as _controllable_textarea, Vt as _id, W as _attr, Wt as _let_change, X as _attr_nonce, Xt as _var_change, Y as _attr_content, Yt as _var, Z as _attr_style, Zt as _assert_init, _ as patchDynamicTag, _n as forOf, _t as _return_setup, a as _for_in, at as _html, b as startAwait, bn as _assert_class_toggles, bt as setupBranch, c as _for_to, cn as prepareEffects, ct as _style_shell, d as _for_until_unkeyed, dn as queueRender, dt as _to_text, en as removeAndDestroyBranch, et as _attrs, f as _if, fn as rendering, ft as insertChildNodes, gn as forIn, gt as _content_resume, hn as runId, ht as _content_closures, i as _dynamic_tag_content, in as $signalReset, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _child_setup, k as _attr_input_checked_script, kt as readyFailed, l as _for_to_unkeyed, ln as queueAsyncRender, lt as _text, m as _try, mn as runEffects, mt as _content, n as _await_promise, nn as _on, nt as _attrs_partial, o as _for_of, ot as _lifecycle, p as _show, pn as run, pt as toInsertNode, q as _attr_class_items, qt as _return_change, r as _dynamic_tag, rn as $signal, rt as _attrs_partial_content, s as _for_of_unkeyed, st as _style_rule_item, t as _await_content, tn as syncGen, tt as _attrs_content, u as _for_until, un as queueEffect, ut as _text_content, v as renderCatch, vn as forTo, vt as createAndSetupBranch, w as _attr_input_checked, wt as _var_resume, x as _attr_details_or_dialog_open, xn as _assert_hoist, xt as _dynamic_tag_var_resume, yn as forUntil, yt as createBranch, z as _controllable_open, zt as _hoist } from "./dom-Ci2W4l1P.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;
@@ -130,7 +130,7 @@ function mount(input = {}, reference, position) {
130
130
  //#region src/dom/load.ts
131
131
  function _load_template(id, load) {
132
132
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
133
- let awaitCounter = addAwaitCounter(branch);
133
+ let awaitCounter = startAwait(branch);
134
134
  branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
135
135
  Object.assign(lazyTemplate, renderer), queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
136
136
  }, loadFailed(branch, awaitCounter));
@@ -142,7 +142,7 @@ function _load_setup(load) {
142
142
  return (owner, child, marker) => {
143
143
  if (renderer) queueRender(child, insertCached, -1, marker);
144
144
  else {
145
- let awaitCounter = addAwaitCounter(owner);
145
+ let awaitCounter = startAwait(owner);
146
146
  child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
147
147
  renderer ||= _content("", ...mod._)(), queueAsyncRender(child, (child) => insertLoaded(renderer, child, marker, awaitCounter));
148
148
  }, loadFailed(child, awaitCounter));
@@ -156,7 +156,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
156
156
  insertBranchBefore(branch, parent(), marker), marker.remove(), awaitCounter?.c();
157
157
  }, remaining;
158
158
  if (remaining = values?.size) {
159
- awaitCounter ||= addAwaitCounter(branch);
159
+ awaitCounter ||= startAwait(branch);
160
160
  let fail = loadFailed(branch, awaitCounter);
161
161
  values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
162
162
  clone(), renderer.c?.(branch), values.forEach(([value, apply]) => apply(branch, value)), insert();
@@ -48,6 +48,6 @@ declare module "../common/types" {
48
48
  type AssetFlush = (g: $Global, type: "block" | "defer", asset: string) => string;
49
49
  export declare function withLoadAssets(renderer: ServerRenderer, flush: AssetFlush, assetId: string, triggers?: Trigger[]): ServerRenderer;
50
50
  export declare function writeLoadAsset(assetId: string, flush: AssetFlush, triggers?: Trigger[]): void;
51
- export declare function withPageAssets(template: ServerRenderer & Template, runtime: AssetFlush, assetId: string, runtimeId?: string): Template;
51
+ export declare function withPageAssets(template: ServerRenderer & Template, flush: AssetFlush, assetId: string, runtimeId?: string): Template;
52
52
  export declare function _flush_head(): string;
53
53
  export {};
@@ -1,7 +1,8 @@
1
1
  import { writeLoadAsset } from "./assets";
2
+ import { _await } from "./control-flow";
2
3
  import { register } from "./serializer";
3
4
  import type { ServerRenderer } from "./template";
4
- import { _await, _html, _peek_scope_id, _scope_id, $global, Chunk, getChunk, isInResumedBranch, State, withChunk, writeScript } from "./writer";
5
+ import { _html, _peek_scope_id, _scope_id, $global, Chunk, getChunk, isInResumedBranch, State, withChunk, writeScript } from "./writer";
5
6
  export declare const compat: {
6
7
  $global: typeof $global;
7
8
  writeLoadAsset: typeof writeLoadAsset;
@@ -0,0 +1,20 @@
1
+ import { type Accessor, type Falsy } from "../common/types";
2
+ import type { ServerRenderer } from "./template";
3
+ export declare function _show_start(display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0): void;
4
+ export declare function _show_end(scopeId: number, accessor: Accessor, display: unknown, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1 | 0): void;
5
+ 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;
6
+ export declare function iterateForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, by: Falsy | ((item: unknown, index: number) => unknown)): LoopIterate<unknown, number>;
7
+ 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;
8
+ export declare function iterateForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, by: Falsy | ((key: string, v: unknown) => unknown)): LoopIterate<string, unknown>;
9
+ 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;
10
+ export declare function iterateForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown)): LoopIterate<number>;
11
+ export declare function _for_until(until: 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;
12
+ export declare function iterateForUntil(until: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, by: Falsy | ((v: number) => unknown)): LoopIterate<number>;
13
+ export type LoopIterate<A, B = void> = (each: 0 | ((itemKey: unknown, sameAsIndex: boolean, a: A, b: B) => void)) => void;
14
+ export declare function checkLoopKeys<A, B>(cb: (a: A, b: B) => void, iterate: LoopIterate<A, B>): LoopIterate<A, B>;
15
+ export declare function forBranches<A, B = void>(by: unknown, cb: (a: A, b: B) => void, iterate: LoopIterate<A, B>, scopeId: number, accessor: Accessor, branchGuard: undefined | number, markerGuard: undefined | number, branchExprGuard: undefined | number, parentEndTag: string | undefined | 0, singleNode?: 1): void;
16
+ export declare function _if(cb: () => void | number, scopeId: number, accessor: Accessor, branchGuard?: number, markerGuard?: number, branchExprGuard?: number, parentEndTag?: string | 0, singleNode?: 1): void;
17
+ export declare function _await<T>(scopeId: number, accessor: Accessor, promise: Promise<T> | T, content: (value: T) => void, markerGuard?: number): void;
18
+ export declare function _try(scopeId: number, accessor: Accessor, content: () => void, placeholderContent?: ServerRenderer, catchContent?: ServerRenderer, placeholderId?: string, catchId?: string): void;
19
+ export declare function tryBoundary(content: () => void, catchContent: ServerRenderer | undefined, branchId: number, renderers: () => void): boolean;
20
+ export declare function writeTryRenderers(branchId: number, catchContent: ServerRenderer | undefined, placeholderContent: ServerRenderer | undefined): void;
@@ -1,11 +1,64 @@
1
1
  import type { Boundary, PartialScope } from "./writer";
2
2
  export declare const K_SCOPE_ID: unique symbol;
3
+ export interface Registered {
4
+ id: string;
5
+ access: string;
6
+ scope: unknown;
7
+ locals: Locals | undefined;
8
+ }
3
9
  export type Locals = (scope: (scopeId: number) => PartialScope) => PartialScope[];
4
10
  export type ScopeFlush = [scopeId: number, scope: object, props: object];
5
11
  export interface SerializeChannel {
6
12
  readyId?: string;
7
13
  parent?: SerializeChannel;
8
14
  }
15
+ interface DeferredMembers {
16
+ collection: Map<unknown, unknown> | Set<unknown>;
17
+ first: unknown;
18
+ rest: Iterable<unknown>;
19
+ }
20
+ interface QueuedCall {
21
+ method: string;
22
+ value: unknown;
23
+ object: unknown;
24
+ channel: SerializeChannel | undefined;
25
+ valueId: string | null;
26
+ }
27
+ export declare const REGISTRY: WeakMap<WeakKey, Registered>;
28
+ declare class State {
29
+ ids: number;
30
+ flushId: number;
31
+ wroteUndefined: boolean;
32
+ buf: string[];
33
+ strs: Map<string, Reference>;
34
+ refs: WeakMap<WeakKey, Reference>;
35
+ deferredRefs: Set<Reference>;
36
+ boundary: Boundary;
37
+ channel: SerializeChannel | undefined;
38
+ channelDeps: Set<string> | null;
39
+ queuedCalls: QueuedCall[];
40
+ queuedReadyCalls: QueuedCall[];
41
+ scopeRef(scope: WeakKey, scopeId: number): Reference;
42
+ writeScopeProps(props: object, ref: Reference): string;
43
+ scopesCursor(scopeId: number): string;
44
+ writeTrailing(scopesIndex: number): string;
45
+ wrapPayload(result: string, extras: string): string;
46
+ writeScopedRegistration(val: WeakKey, parent: Reference | null, accessor: string, registered: Registered): void;
47
+ }
48
+ export declare class Reference {
49
+ debug?: Debug;
50
+ assignments: null | string[];
51
+ deferredMembers: null | DeferredMembers;
52
+ scopeId: number | undefined;
53
+ channel: SerializeChannel | undefined;
54
+ parent: Reference | null;
55
+ accessor: string | null;
56
+ flushId: number;
57
+ pos: number | null;
58
+ id: string | null;
59
+ path: string | null;
60
+ constructor(parent: Reference | null, accessor: string | null, flushId: number, pos?: number | null, id?: string | null);
61
+ }
9
62
  interface Debug {
10
63
  file: string;
11
64
  loc: string | 0;
@@ -14,22 +67,16 @@ interface Debug {
14
67
  }
15
68
  export declare function setDebugInfo(obj: WeakKey, file: string, loc: string | 0, vars?: Debug["vars"]): void;
16
69
  export declare function setDebugSlotName(obj: WeakKey, accessor: string, name: string): void;
17
- export declare class Serializer {
18
- #private;
19
- pending(channel?: SerializeChannel): boolean;
20
- pendingReadyChannel(): SerializeChannel | undefined;
21
- stringifyScopes(flushes: ScopeFlush[], boundary: Boundary, channel?: SerializeChannel): string;
22
- written(val: WeakKey): boolean;
23
- takeChannelDeps(): Set<string> | null;
24
- writeCall(value: unknown, object: unknown, property: string, channel?: SerializeChannel): void;
25
- dropCall(value: unknown, object: unknown, property: string): boolean;
26
- }
27
- export declare function register<T extends WeakKey>(id: string, val: T, scope?: unknown, locals?: Locals): T;
28
- export declare function getRegistered(val: WeakKey): {
29
- id: string;
30
- scope: unknown;
31
- } | undefined;
70
+ export { State as SerializerState };
71
+ export declare function stringifyScopes(state: State, flushes: ScopeFlush[], boundary: Boundary, channel?: SerializeChannel): string;
72
+ export declare function pendingReadyChannel(state: State): SerializeChannel | undefined;
73
+ export declare function takeChannelDeps(state: State): Set<string> | null;
74
+ export declare function queueCall(state: State, value: unknown, object: unknown, method: string, channel?: SerializeChannel): void;
75
+ export declare function dropQueuedCall(state: State, value: unknown, object: unknown, method: string, channel: SerializeChannel | undefined): boolean;
76
+ export declare function register<T extends WeakKey>(id: string, val: T, scope?: unknown, locals?: Locals, access?: string): T;
77
+ export declare function writeDeferred(state: State): void;
78
+ export declare function hasMatchingCalls(state: State, readyId: string | undefined): boolean;
79
+ export declare function quoteRegisterId(id: string): string;
32
80
  export declare function toObjectKey(name: string): string;
33
81
  export declare function toAccess(accessor: string): string;
34
82
  export declare function quote(str: string, startPos: number): string;
35
- export {};