marko 6.3.50 → 6.3.52

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 (67) hide show
  1. package/dist/debug/dom/catch.feat.js +1 -1
  2. package/dist/debug/dom/catch.feat.mjs +1 -1
  3. package/dist/debug/dom/controllable-input.feat.js +1 -1
  4. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-open.feat.js +1 -1
  6. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-select.feat.js +1 -1
  8. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable.feat.js +1 -1
  12. package/dist/debug/dom/controllable.feat.mjs +1 -1
  13. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  14. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  15. package/dist/debug/dom/placeholder.feat.js +2 -2
  16. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  17. package/dist/debug/{dom-BAGeiafn.js → dom-BJKb8-wr.js} +22 -27
  18. package/dist/debug/{dom-C55iHvof.mjs → dom-Dq_Yu7MS.mjs} +19 -18
  19. package/dist/debug/dom.js +10 -10
  20. package/dist/debug/dom.mjs +10 -10
  21. package/dist/debug/html.js +56 -40
  22. package/dist/debug/html.mjs +56 -40
  23. package/dist/dom/catch.feat.js +3 -3
  24. package/dist/dom/catch.feat.mjs +1 -1
  25. package/dist/dom/controllable-input.feat.js +1 -1
  26. package/dist/dom/controllable-input.feat.mjs +1 -1
  27. package/dist/dom/controllable-open.feat.js +1 -1
  28. package/dist/dom/controllable-open.feat.mjs +1 -1
  29. package/dist/dom/controllable-select.feat.js +1 -1
  30. package/dist/dom/controllable-select.feat.mjs +1 -1
  31. package/dist/dom/controllable-textarea.feat.js +1 -1
  32. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  33. package/dist/dom/controllable.feat.js +1 -1
  34. package/dist/dom/controllable.feat.mjs +1 -1
  35. package/dist/dom/dynamic-tag-var.feat.js +3 -2
  36. package/dist/dom/dynamic-tag-var.feat.mjs +4 -3
  37. package/dist/dom/placeholder.feat.js +3 -3
  38. package/dist/dom/placeholder.feat.mjs +2 -2
  39. package/dist/dom/resume.d.ts +1 -2
  40. package/dist/{dom-BNmfm4st.js → dom-CzGPOsST.js} +62 -71
  41. package/dist/{dom-BsAS26Ze.mjs → dom-CzfddxCE.mjs} +15 -19
  42. package/dist/dom.d.ts +1 -1
  43. package/dist/dom.js +30 -30
  44. package/dist/dom.mjs +10 -10
  45. package/dist/html/template.d.ts +3 -1
  46. package/dist/html/writer.d.ts +6 -1
  47. package/dist/html.js +40 -25
  48. package/dist/html.mjs +40 -25
  49. package/dist/translator/core/await.d.ts +0 -7
  50. package/dist/translator/core/try.d.ts +0 -7
  51. package/dist/translator/index.d.ts +1 -1
  52. package/dist/translator/index.js +1893 -1658
  53. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  54. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  55. package/dist/translator/util/evaluate.d.ts +2 -0
  56. package/dist/translator/util/optional.d.ts +21 -7
  57. package/dist/translator/util/references.d.ts +53 -21
  58. package/dist/translator/util/runtime.d.ts +3 -1
  59. package/dist/translator/util/sections.d.ts +10 -11
  60. package/dist/translator/util/serialize-guard.d.ts +10 -0
  61. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  62. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  63. package/dist/translator/util/tag-name-type.d.ts +8 -3
  64. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  65. package/index.d.ts +0 -5
  66. package/package.json +3 -3
  67. package/tags-html.d.ts +2 -0
package/dist/dom.js CHANGED
@@ -1,23 +1,23 @@
1
- let require_control_flow = require("./dom-BNmfm4st.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
1
+ let require_control_flow = require("./dom-CzGPOsST.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
2
  require_control_flow.yt($global.runtimeId);
3
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
4
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
5
5
  }, compat = {
6
6
  patchDynamicTag: require_control_flow.h,
7
- queueEffect: require_control_flow.in,
7
+ queueEffect: require_control_flow.rn,
8
8
  init(warp10Noop) {
9
- require_control_flow.gt("$C_s", (scope) => {
9
+ require_control_flow.gt.$C_s = (scope) => {
10
10
  if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
11
11
  let resolved = classEventResolver(scope[key], scope);
12
12
  resolved !== scope[key] && (scope[key] = resolved);
13
13
  }
14
- }), require_control_flow.gt("$C_b", warp10Noop);
14
+ }, require_control_flow.gt.$C_b = warp10Noop;
15
15
  },
16
16
  setClassEventResolver(fn) {
17
17
  classEventResolver = fn;
18
18
  },
19
19
  resumeClassFunction(id, build) {
20
- require_control_flow.gt(id, build);
20
+ require_control_flow.gt[id] = build;
21
21
  },
22
22
  getScope($global, scopeId) {
23
23
  return getRenderScopes($global)?.[scopeId];
@@ -38,10 +38,10 @@ let require_control_flow = require("./dom-BNmfm4st.js"), empty = [], rest = Symb
38
38
  branch.S = startNode, branch.K = endNode;
39
39
  },
40
40
  runComponentEffects() {
41
- this.effects && require_control_flow.sn(this.effects);
41
+ this.effects && require_control_flow.on(this.effects);
42
42
  },
43
43
  runComponentDestroy() {
44
- this.scope && require_control_flow.Kt(this.scope);
44
+ this.scope && require_control_flow.Gt(this.scope);
45
45
  },
46
46
  resolveRegistered(value, $global) {
47
47
  return Array.isArray(value) && typeof value[0] == "string" ? require_control_flow.vt(value[0], getRenderScopes($global)?.[value[1]]) : value;
@@ -60,37 +60,37 @@ let require_control_flow = require("./dom-BNmfm4st.js"), empty = [], rest = Symb
60
60
  let input = args[0], normalizedInput = args[0] = {};
61
61
  for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
62
62
  }
63
- if (component.effects = require_control_flow.nn(() => {
63
+ if (component.effects = require_control_flow.tn(() => {
64
64
  branch ||= (created = 1, component.scope = require_control_flow.ft(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
65
65
  }), created) return require_control_flow.ct(branch.S, branch.K);
66
66
  }
67
67
  }, _template = (id, template, walks, setup, inputSignal) => {
68
68
  let renderer = require_control_flow.lt(id, template, walks, setup, inputSignal)();
69
- return renderer.mount = mount, renderer._ = renderer, require_control_flow.gt(id, renderer);
70
- }, _load_template = /*@__PURE__*/ require_control_flow.wt((id, load) => {
69
+ return renderer.mount = mount, renderer._ = renderer, require_control_flow.gt[id] = renderer;
70
+ }, noop = (_) => 0, _load_template = /*@__PURE__*/ require_control_flow.Ct((id, load) => {
71
71
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
72
72
  let awaitCounter = require_control_flow.p(branch);
73
73
  branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
74
- Object.assign(lazyTemplate, renderer), require_control_flow.rn(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
74
+ Object.assign(lazyTemplate, renderer), require_control_flow.nn(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
75
75
  }, loadFailed(branch, awaitCounter));
76
- }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
76
+ }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
77
77
  return lazyTemplate;
78
- }), _load_setup = /*@__PURE__*/ require_control_flow.wt((nodeAccessor, childScopeAccessor, load) => {
79
- nodeAccessor = require_control_flow.gn(nodeAccessor), childScopeAccessor = require_control_flow.gn(childScopeAccessor);
78
+ }), _load_setup = /*@__PURE__*/ require_control_flow.Ct((nodeAccessor, childScopeAccessor, load) => {
79
+ nodeAccessor = require_control_flow.hn(nodeAccessor), childScopeAccessor = require_control_flow.hn(childScopeAccessor);
80
80
  let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
81
81
  return (owner) => {
82
82
  let child = owner[childScopeAccessor];
83
- if (renderer) require_control_flow.an(child, insertCached, -1, owner[nodeAccessor]);
83
+ if (renderer) require_control_flow.in(child, insertCached, -1, owner[nodeAccessor]);
84
84
  else {
85
85
  let awaitCounter = require_control_flow.p(owner);
86
86
  child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
87
- renderer = require_control_flow.lt("", ...mod._)(), require_control_flow.rn(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
87
+ renderer = require_control_flow.lt("", ...mod._)(), require_control_flow.nn(child, (child) => insertLoaded(renderer, child, owner[nodeAccessor], awaitCounter));
88
88
  }, loadFailed(child, awaitCounter));
89
89
  }
90
90
  };
91
- }), _load_signal = /*@__PURE__*/ require_control_flow.wt((load) => {
91
+ }), _load_signal = /*@__PURE__*/ require_control_flow.Ct((load) => {
92
92
  let pending, apply = (scope, value) => {
93
- pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.cn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.rn(scope, apply._ = mod._, value), () => 0);
93
+ pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.sn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.nn(scope, apply._ = mod._, value), noop);
94
94
  };
95
95
  return apply;
96
96
  });
@@ -131,25 +131,25 @@ function mount(input = {}, reference, position) {
131
131
  parentNode = reference.parentNode, nextSibling = reference.nextSibling;
132
132
  break;
133
133
  }
134
- let curValue, args = this.d, effects = require_control_flow.nn(() => {
134
+ let curValue, args = this.d, effects = require_control_flow.tn(() => {
135
135
  branch = require_control_flow.pt($global, this, void 0, parentNode), branch.T = (newValue) => {
136
136
  curValue = newValue;
137
137
  }, this.c?.(branch), args?.(branch, input);
138
138
  });
139
- return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.sn(effects), {
139
+ return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.on(effects), {
140
140
  get value() {
141
141
  return curValue;
142
142
  },
143
143
  set value(newValue) {
144
- require_control_flow.Wt(branch, newValue);
144
+ require_control_flow.Ut(branch, newValue);
145
145
  },
146
146
  update(newInput = {}) {
147
- args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.sn(require_control_flow.nn(() => {
147
+ args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.on(require_control_flow.tn(() => {
148
148
  args(branch, newInput);
149
149
  })));
150
150
  },
151
151
  destroy() {
152
- require_control_flow.Jt(branch);
152
+ require_control_flow.qt(branch);
153
153
  }
154
154
  };
155
155
  }
@@ -157,20 +157,20 @@ function mount(input = {}, reference, position) {
157
157
  //#region src/dom/load.ts
158
158
  function insertLoaded(renderer, branch, marker, awaitCounter) {
159
159
  let parent = marker.parentNode, values = branch.X, clone = () => {
160
- require_control_flow.Yt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0;
160
+ require_control_flow.Jt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0;
161
161
  }, insert = () => {
162
- require_control_flow.qt(branch, parent, marker), marker.remove(), awaitCounter?.c();
162
+ require_control_flow.Kt(branch, parent, marker), marker.remove(), awaitCounter?.c();
163
163
  }, remaining;
164
164
  if (remaining = values?.size) {
165
165
  let fail = loadFailed(branch, awaitCounter);
166
- values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.rn(branch, (branch) => {
166
+ values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.nn(branch, (branch) => {
167
167
  clone(), renderer.c?.(branch), values.forEach(([value, apply]) => apply(branch, value)), insert();
168
168
  }), (error) => remaining > 0 && (remaining = 0, fail(error))));
169
169
  } else clone(), require_control_flow.mt(renderer, branch), insert();
170
170
  }
171
171
  function loadFailed(scope, awaitCounter) {
172
172
  return (error) => {
173
- awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.rn(scope, require_control_flow.g, error);
173
+ awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), require_control_flow.nn(scope, require_control_flow.g, error);
174
174
  };
175
175
  }
176
176
  function _load_visible_trigger(selector, options) {
@@ -190,15 +190,15 @@ function _load_media_trigger(query) {
190
190
  return (load) => () => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
191
191
  }
192
192
  function _load_race_trigger(...triggers) {
193
- let noop = () => Promise.resolve(), pending;
193
+ let pending;
194
194
  return (load) => () => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
195
195
  }
196
196
  function getSelectorOrResolve(selector, resolve) {
197
197
  return document.querySelector(selector) || resolve();
198
198
  }
199
- exports.$signal = require_control_flow.Zt, exports.$signalReset = require_control_flow.Qt, exports._assert_hoist = require_control_flow.pn, exports._assert_init = require_control_flow.Gt, exports._attr = require_control_flow.B, exports._attr_class = require_control_flow.V, exports._attr_class_item = require_control_flow.H, exports._attr_class_items = require_control_flow.U, exports._attr_content = require_control_flow.W, exports._attr_details_open = require_control_flow._, exports._attr_dialog_open = require_control_flow._, exports._attr_details_open_default = require_control_flow.v, exports._attr_dialog_open_default = require_control_flow.v, exports._attr_details_open_script = require_control_flow.y, exports._attr_dialog_open_script = require_control_flow.y, exports._attr_input_checked = require_control_flow.b, exports._attr_input_checkedValue = require_control_flow.x, exports._attr_input_checkedValue_default = require_control_flow.S, exports._attr_input_checkedValue_script = require_control_flow.C, exports._attr_input_checked_default = require_control_flow.w, exports._attr_input_checked_script = require_control_flow.T, exports._attr_input_value = require_control_flow.E, exports._attr_textarea_value = require_control_flow.E, exports._attr_input_value_attribute_default = require_control_flow.D, exports._attr_input_value_default = require_control_flow.O, exports._attr_textarea_value_default = require_control_flow.O, exports._attr_input_value_dynamic_default = require_control_flow.k, exports._attr_input_value_script = require_control_flow.A, exports._attr_textarea_value_script = require_control_flow.A, exports._attr_nonce = require_control_flow.G, exports._attr_select_value = require_control_flow.j, exports._attr_select_value_default = require_control_flow.M, exports._attr_select_value_script = require_control_flow.N, exports._attr_style = require_control_flow.K, exports._attr_style_item = require_control_flow.q, exports._attr_style_items = require_control_flow.J, exports._attrs = require_control_flow.Y, exports._attrs_content = require_control_flow.X, exports._attrs_partial = require_control_flow.Z, exports._attrs_partial_content = require_control_flow.Q, exports._attrs_script = require_control_flow.$, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.hn, exports._child_setup = require_control_flow.Tt, exports._closure = require_control_flow.Et, exports._closure_get = require_control_flow.Dt, exports._const = require_control_flow.Ot, exports._content = require_control_flow.lt, exports._content_closures = require_control_flow.ut, exports._content_resume = require_control_flow.dt, exports._controllable_input = require_control_flow.P, exports._controllable_open = require_control_flow.F, exports._controllable_select = require_control_flow.I, exports._controllable_textarea = require_control_flow.L, Object.defineProperty(exports, "_dynamic_tag", {
199
+ exports.$signal = require_control_flow.Xt, exports.$signalReset = require_control_flow.Zt, exports._assert_hoist = require_control_flow.fn, exports._assert_init = require_control_flow.Wt, exports._attr = require_control_flow.B, exports._attr_class = require_control_flow.V, exports._attr_class_item = require_control_flow.H, exports._attr_class_items = require_control_flow.U, exports._attr_content = require_control_flow.W, exports._attr_details_open = require_control_flow._, exports._attr_dialog_open = require_control_flow._, exports._attr_details_open_default = require_control_flow.v, exports._attr_dialog_open_default = require_control_flow.v, exports._attr_details_open_script = require_control_flow.y, exports._attr_dialog_open_script = require_control_flow.y, exports._attr_input_checked = require_control_flow.b, exports._attr_input_checkedValue = require_control_flow.x, exports._attr_input_checkedValue_default = require_control_flow.S, exports._attr_input_checkedValue_script = require_control_flow.C, exports._attr_input_checked_default = require_control_flow.w, exports._attr_input_checked_script = require_control_flow.T, exports._attr_input_value = require_control_flow.E, exports._attr_textarea_value = require_control_flow.E, exports._attr_input_value_attribute_default = require_control_flow.D, exports._attr_input_value_default = require_control_flow.O, exports._attr_textarea_value_default = require_control_flow.O, exports._attr_input_value_dynamic_default = require_control_flow.k, exports._attr_input_value_script = require_control_flow.A, exports._attr_textarea_value_script = require_control_flow.A, exports._attr_nonce = require_control_flow.G, exports._attr_select_value = require_control_flow.j, exports._attr_select_value_default = require_control_flow.M, exports._attr_select_value_script = require_control_flow.N, exports._attr_style = require_control_flow.K, exports._attr_style_item = require_control_flow.q, exports._attr_style_items = require_control_flow.J, exports._attrs = require_control_flow.Y, exports._attrs_content = require_control_flow.X, exports._attrs_partial = require_control_flow.Z, exports._attrs_partial_content = require_control_flow.Q, exports._attrs_script = require_control_flow.$, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.mn, exports._child_setup = require_control_flow.wt, exports._closure = require_control_flow.Tt, exports._closure_get = require_control_flow.Et, exports._const = require_control_flow.Dt, exports._content = require_control_flow.lt, exports._content_closures = require_control_flow.ut, exports._content_resume = require_control_flow.dt, exports._controllable_input = require_control_flow.P, exports._controllable_open = require_control_flow.F, exports._controllable_select = require_control_flow.I, exports._controllable_textarea = require_control_flow.L, Object.defineProperty(exports, "_dynamic_tag", {
200
200
  enumerable: !0,
201
201
  get: function() {
202
202
  return require_control_flow.r;
203
203
  }
204
- }), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.kt, exports._for_closure = require_control_flow.At, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.jt, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._global_read = require_control_flow.Mt, exports._hoist = require_control_flow.Nt, exports._hoist_read_error = require_control_flow.mn, exports._hoist_resume = require_control_flow.Pt, exports._html = require_control_flow.et, exports._id = require_control_flow.Ft, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.It, exports._let = require_control_flow.Lt, exports._let_change = require_control_flow.Rt, exports._lifecycle = require_control_flow.tt, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.Xt, exports._or = require_control_flow.zt, exports._resume = require_control_flow.gt, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.Bt, exports._return_change = require_control_flow.Vt, exports._script = require_control_flow.Ht, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.nt, exports._style_shell = require_control_flow.rt, exports._template = _template, exports._text = require_control_flow.it, exports._text_content = require_control_flow.at, exports._to_text = require_control_flow.ot, exports._try = require_control_flow.f, exports._var = require_control_flow.Ut, exports._var_change = require_control_flow.Wt, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.ln, exports.forOf = require_control_flow.un, exports.forTo = require_control_flow.dn, exports.forUntil = require_control_flow.fn, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.readyFailed = require_control_flow.St, exports.run = require_control_flow.on;
204
+ }), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.Ot, exports._for_closure = require_control_flow.kt, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.At, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._global_read = require_control_flow.jt, exports._hoist = require_control_flow.Mt, exports._hoist_read_error = require_control_flow.pn, exports._hoist_resume = require_control_flow.Nt, exports._html = require_control_flow.et, exports._id = require_control_flow.Pt, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.Ft, exports._let = require_control_flow.It, exports._let_change = require_control_flow.Lt, exports._lifecycle = require_control_flow.tt, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.Yt, exports._or = require_control_flow.Rt, exports._resume_dynamic_tag = require_control_flow.u, exports._resumed = require_control_flow.gt, exports._return = require_control_flow.zt, exports._return_change = require_control_flow.Bt, exports._script = require_control_flow.Vt, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.nt, exports._style_shell = require_control_flow.rt, exports._template = _template, exports._text = require_control_flow.it, exports._text_content = require_control_flow.at, exports._to_text = require_control_flow.ot, exports._try = require_control_flow.f, exports._var = require_control_flow.Ht, exports._var_change = require_control_flow.Ut, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.cn, exports.forOf = require_control_flow.ln, exports.forTo = require_control_flow.un, exports.forUntil = require_control_flow.dn, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.readyFailed = require_control_flow.St, exports.run = require_control_flow.an;
package/dist/dom.mjs CHANGED
@@ -6,18 +6,18 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
6
6
  patchDynamicTag,
7
7
  queueEffect,
8
8
  init(warp10Noop) {
9
- _resume("$C_s", (scope) => {
9
+ _resumed.$C_s = (scope) => {
10
10
  if (getRenderScopes(scope.$)[scope.L] = scope, scope.m5c && classIdToBranch.set(scope.m5c, scope), classEventResolver) for (let key in scope) {
11
11
  let resolved = classEventResolver(scope[key], scope);
12
12
  resolved !== scope[key] && (scope[key] = resolved);
13
13
  }
14
- }), _resume("$C_b", warp10Noop);
14
+ }, _resumed.$C_b = warp10Noop;
15
15
  },
16
16
  setClassEventResolver(fn) {
17
17
  classEventResolver = fn;
18
18
  },
19
19
  resumeClassFunction(id, build) {
20
- _resume(id, build);
20
+ _resumed[id] = build;
21
21
  },
22
22
  getScope($global, scopeId) {
23
23
  return getRenderScopes($global)?.[scopeId];
@@ -66,14 +66,14 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
66
66
  }
67
67
  }, _template = (id, template, walks, setup, inputSignal) => {
68
68
  let renderer = _content(id, template, walks, setup, inputSignal)();
69
- return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
70
- }, _load_template = /*@__PURE__*/ withLazy((id, load) => {
69
+ return renderer.mount = mount, renderer._ = renderer, _resumed[id] = renderer;
70
+ }, noop = (_) => 0, _load_template = /*@__PURE__*/ withLazy((id, load) => {
71
71
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
72
72
  let awaitCounter = addAwaitCounter(branch);
73
73
  branch.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((renderer) => {
74
74
  Object.assign(lazyTemplate, renderer), queueAsyncRender(branch, (branch) => insertLoaded(renderer, branch, branch.S, awaitCounter));
75
75
  }, loadFailed(branch, awaitCounter));
76
- }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
76
+ }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d || noop }))));
77
77
  return lazyTemplate;
78
78
  }), _load_setup = /*@__PURE__*/ withLazy((nodeAccessor, childScopeAccessor, load) => {
79
79
  nodeAccessor = decodeAccessor(nodeAccessor), childScopeAccessor = decodeAccessor(childScopeAccessor);
@@ -90,11 +90,11 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
90
90
  };
91
91
  }), _load_signal = /*@__PURE__*/ withLazy((load) => {
92
92
  let pending, apply = (scope, value) => {
93
- pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => queueAsyncRender(scope, apply._ = mod._, value), () => 0);
93
+ pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => queueAsyncRender(scope, apply._ = mod._, value), noop);
94
94
  };
95
95
  return apply;
96
96
  });
97
- import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as queueRender, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as runId, ct as toInsertNode, d as _show, dn as forTo, dt as _content_resume, et as _html, f as _try, fn as forUntil, ft as createAndSetupBranch, g as renderCatch, gn as decodeAccessor, gt as _resume, h as patchDynamicTag, hn as _call, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forIn, lt as _content, mn as _hoist_read_error, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as run, ot as _to_text, p as addAwaitCounter, pn as _assert_hoist, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runEffects, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forOf, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-BsAS26Ze.mjs";
97
+ import { $ as _attrs_script, A as _attr_input_value_script, At as _for_selector, B as _attr, Bt as _return_change, C as _attr_input_checkedValue_script, Ct as withLazy, D as _attr_input_value_attribute_default, Dt as _const, E as _attr_input_value, Et as _closure_get, F as _controllable_open, Ft as _if_closure, G as _attr_nonce, Gt as destroyBranch, H as _attr_class_item, Ht as _var, I as _controllable_select, It as _let, J as _attr_style_items, Jt as syncGen, K as _attr_style, Kt as insertBranchBefore, L as _controllable_textarea, Lt as _let_change, M as _attr_select_value_default, Mt as _hoist, N as _attr_select_value_script, Nt as _hoist_resume, O as _attr_input_value_default, Ot as _el_read, P as _controllable_input, Pt as _id, Q as _attrs_partial_content, Rt as _or, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _closure, U as _attr_class_items, Ut as _var_change, V as _attr_class, Vt as _script, W as _attr_content, Wt as _assert_init, X as _attrs_content, Xt as $signal, Y as _attrs, Yt as _on, Z as _attrs_partial, Zt as $signalReset, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as run, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as forIn, ct as toInsertNode, d as _show, dn as forUntil, dt as _content_resume, et as _html, f as _try, fn as _assert_hoist, ft as createAndSetupBranch, g as renderCatch, gt as _resumed, h as patchDynamicTag, hn as decodeAccessor, ht as _el, i as _dynamic_tag_content, in as queueRender, it as _text, j as _attr_select_value, jt as _global_read, k as _attr_input_value_dynamic_default, kt as _for_closure, l as _if, ln as forOf, lt as _content, mn as _call, mt as setupBranch, n as _await_promise, nn as queueAsyncRender, nt as _style_rule_item, o as _for_of, on as runEffects, ot as _to_text, p as addAwaitCounter, pn as _hoist_read_error, pt as createBranch, q as _attr_style_item, qt as removeAndDestroyBranch, r as _dynamic_tag, rn as queueEffect, rt as _style_shell, s as _for_to, sn as runId, st as insertChildNodes, t as _await_content, tn as prepareEffects, tt as _lifecycle, u as _resume_dynamic_tag, un as forTo, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as _child_setup, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _return } from "./dom-CzfddxCE.mjs";
98
98
  //#region src/common/attr-tag.ts
99
99
  function attrTag(attrs) {
100
100
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
@@ -190,11 +190,11 @@ function _load_media_trigger(query) {
190
190
  return (load) => () => (pending ||= new Promise((resolve) => (mql = matchMedia(query)).matches ? resolve() : mql.addEventListener("change", resolve, { once: !0 }))).then(load);
191
191
  }
192
192
  function _load_race_trigger(...triggers) {
193
- let noop = () => Promise.resolve(), pending;
193
+ let pending;
194
194
  return (load) => () => (pending ||= Promise.race(triggers.map((t) => t(noop)()))).then(load);
195
195
  }
196
196
  function getSelectorOrResolve(selector, resolve) {
197
197
  return document.querySelector(selector) || resolve();
198
198
  }
199
199
  //#endregion
200
- export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume, _resume_dynamic_tag, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, readyFailed, run };
200
+ export { $signal, $signalReset, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _child_setup, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _el, _el_read, _for_closure, _for_in, _for_of, _for_selector, _for_to, _for_until, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resume_dynamic_tag, _resumed, _return, _return_change, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, readyFailed, run };
@@ -1,7 +1,9 @@
1
- import { RendererProp, type Template } from "../common/types";
1
+ import { type RenderedTemplate, RendererProp, type Template, type TemplateInput } from "../common/types";
2
+ import { State } from "./writer";
2
3
  export type ServerRenderer = ((...args: unknown[]) => unknown) & {
3
4
  [RendererProp.Id]?: string;
4
5
  [RendererProp.Owner]?: number;
5
6
  [RendererProp.Embed]?: boolean;
6
7
  };
7
8
  export declare const _template: (templateId: string, renderer: ServerRenderer, page?: 1) => Template;
9
+ export declare function startRender(template: Template & ServerRenderer, input: TemplateInput, StateClass: typeof State): RenderedTemplate;
@@ -67,7 +67,9 @@ 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
69
  export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;
70
- export type SerializeReasonValue = undefined | number | Partial<Record<string, 0 | 1>>;
70
+ export type SerializeReasonValue = undefined | number | Partial<Record<string, number>>;
71
+ export declare const CLIENT_ALL = 715827882;
72
+ export declare function maskGroup(mask: SerializeReasonValue, group: number): number;
71
73
  export declare function _set_serialize_reason(reason: SerializeReasonValue): void;
72
74
  export declare function _scope_reason(): SerializeReasonValue;
73
75
  export declare function _serialize_if(condition: SerializeReasonValue, key: number): 1 | undefined;
@@ -114,6 +116,9 @@ export declare class State implements SerializeState {
114
116
  renderId: string;
115
117
  runtimeId: string;
116
118
  });
119
+ flushChunk(html: string, scripts: string, pending: number): string;
120
+ walkScript(): string;
121
+ resumeScript(resumes: string): string;
117
122
  get runtimePrefix(): string;
118
123
  get commentPrefix(): string;
119
124
  reorder(chunk: Chunk): void;
package/dist/html.js CHANGED
@@ -247,7 +247,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
247
247
  }, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
248
248
  let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
249
249
  return state.needsMainRuntime = !0, countResumeWrite($chunk.boundary), Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
250
- }, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
250
+ }, CLIENT_ALL = 715827882, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
251
251
  let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
252
252
  if (typeof renderer == "string") {
253
253
  let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
@@ -267,7 +267,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
267
267
  } else {
268
268
  let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
269
269
  if (renderer) try {
270
- return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
270
+ return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
271
271
  ...inputOrArgs,
272
272
  content
273
273
  } : inputOrArgs);
@@ -357,7 +357,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
357
357
  let scopeId = _peek_scope_id();
358
358
  writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
359
359
  }
360
- _set_serialize_reason(+!!willRerender);
360
+ _set_serialize_reason(willRerender ? CLIENT_ALL : 0);
361
361
  try {
362
362
  renderer(normalizedInput);
363
363
  } finally {
@@ -496,6 +496,7 @@ var State$1 = class {
496
496
  flushId;
497
497
  pos;
498
498
  id;
499
+ path = null;
499
500
  constructor(parent, accessor, flushId, pos = null, id = null) {
500
501
  this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
501
502
  }
@@ -629,7 +630,7 @@ function writeProp(state, val, parent, accessor) {
629
630
  }
630
631
  function writeReferenceOr(state, write, val, parent, accessor) {
631
632
  let ref = state.refs.get(val);
632
- if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
633
+ if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (writeRef(state, ref), !0) : !1;
633
634
  let registered = REGISTRY.get(val);
634
635
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
635
636
  }
@@ -655,7 +656,7 @@ function writeString(state, val, parent, accessor) {
655
656
  if (val.length > 12) {
656
657
  let ref = state.strs.get(val);
657
658
  if (ref) {
658
- if (trackChannel(state, ref)) return state.buf.push(ensureId(state, ref)), !0;
659
+ if (trackChannel(state, ref)) return writeRef(state, ref), !0;
659
660
  } else {
660
661
  let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
661
662
  ref.channel = state.channel, state.strs.set(val, ref);
@@ -1134,6 +1135,9 @@ function quote(str, startPos) {
1134
1135
  }
1135
1136
  return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
1136
1137
  }
1138
+ function writeRef(state, ref) {
1139
+ ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, ref.channel = state.channel, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
1140
+ }
1137
1141
  function ensureId(state, ref) {
1138
1142
  return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
1139
1143
  }
@@ -1143,23 +1147,18 @@ function accessId(state, ref) {
1143
1147
  }
1144
1148
  function assignId(state, ref) {
1145
1149
  let { pos } = ref;
1146
- if (ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId) return pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id;
1147
- ref.channel = state.channel;
1150
+ return ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId ? (pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : (ref.channel = state.channel, ref.id + "=" + (ref.path || accessPath(state, ref)));
1151
+ }
1152
+ function accessPath(state, ref) {
1148
1153
  let cur = ref, accessPrevValue = "";
1149
1154
  do {
1150
1155
  accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
1151
1156
  let parent = cur.parent;
1152
- if (parent.id && (trackChannel(state, parent) || !parent.parent)) {
1153
- accessPrevValue = parent.id + accessPrevValue;
1154
- break;
1155
- }
1156
- if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1157
- accessPrevValue = accessId(state, parent) + accessPrevValue;
1158
- break;
1159
- }
1157
+ if (parent.id && (trackChannel(state, parent) || !parent.parent)) return parent.id + accessPrevValue;
1158
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
1160
1159
  cur = parent;
1161
1160
  } while (cur);
1162
- return ref.id + "=" + accessPrevValue;
1161
+ return accessPrevValue;
1163
1162
  }
1164
1163
  function assignmentsToString(assignments, value) {
1165
1164
  return assignments.length > 100 ? "($=>(" + assignments.join("=$,") + "=$))(" + value + ")" : assignments.join("=") + "=" + value;
@@ -1479,6 +1478,9 @@ function _subscribe(subscribers, scope) {
1479
1478
  }
1480
1479
  return scope;
1481
1480
  }
1481
+ function maskGroup(mask, group) {
1482
+ return mask === 715827882 ? 1 : typeof mask == "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
1483
+ }
1482
1484
  function _set_serialize_reason(reason) {
1483
1485
  $chunk.boundary.state.serializeReason = reason;
1484
1486
  }
@@ -1487,7 +1489,7 @@ function _scope_reason() {
1487
1489
  return $chunk.boundary.state.serializeReason = void 0, reason;
1488
1490
  }
1489
1491
  function _serialize_if(condition, key) {
1490
- return condition && (condition === 1 || (typeof condition == "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1492
+ return condition && maskGroup(condition, key) ? 1 : void 0;
1491
1493
  }
1492
1494
  function _serialize_guard(condition, key) {
1493
1495
  return _serialize_if(condition, key) || 0;
@@ -1606,6 +1608,16 @@ var State = class {
1606
1608
  constructor($global) {
1607
1609
  this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
1608
1610
  }
1611
+ flushChunk(html, scripts, pending) {
1612
+ let { $global, nonceAttr } = this, { __flush__ } = $global;
1613
+ return scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), pending ? html : html + this.trailerHTML;
1614
+ }
1615
+ walkScript() {
1616
+ return this.runtimePrefix + ".w()";
1617
+ }
1618
+ resumeScript(resumes) {
1619
+ return this.hasWrittenResume ? this.runtimePrefix + ".r.push(" + resumes + ")" : (this.hasWrittenResume = !0, this.runtimePrefix + ".r=[" + resumes + "]");
1620
+ }
1609
1621
  get runtimePrefix() {
1610
1622
  let { $global } = this;
1611
1623
  return $global.runtimeId + "." + $global.renderId;
@@ -1685,7 +1697,7 @@ var State = class {
1685
1697
  this.scripts = concatScripts(this.scripts, script);
1686
1698
  }
1687
1699
  append(chunk) {
1688
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1700
+ this.html += chunk.html, this.needsWalk ||= chunk.needsWalk, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1689
1701
  }
1690
1702
  takeDeferredReady() {
1691
1703
  let { deferredReady } = this;
@@ -1784,13 +1796,13 @@ var State = class {
1784
1796
  }
1785
1797
  state.writeReorders = carried;
1786
1798
  }
1787
- return flushSerializer(boundary, state), state.resumes ? state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]")) : needsResumeArray && !state.hasWrittenResume && (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1799
+ return flushSerializer(boundary, state), (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1788
1800
  }
1789
1801
  flushHTML() {
1790
1802
  let { boundary } = this, { state } = boundary;
1791
1803
  this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1792
- let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
1793
- return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
1804
+ let { html, scripts } = this;
1805
+ return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
1794
1806
  }
1795
1807
  };
1796
1808
  function flushSerializer(boundary, serializeState) {
@@ -2044,17 +2056,20 @@ function _content_resume(id, fn, scopeId) {
2044
2056
  //#endregion
2045
2057
  //#region src/html/template.ts
2046
2058
  function render(input = {}) {
2059
+ return startRender(this, input, State);
2060
+ }
2061
+ function startRender(template, input, StateClass) {
2047
2062
  let { $global } = input;
2048
2063
  $global ? ({$global, ...input} = input, $global = {
2049
2064
  runtimeId: "M",
2050
- renderId: getDefaultRenderId(this),
2065
+ renderId: getDefaultRenderId(template),
2051
2066
  ...$global
2052
2067
  }) : $global = {
2053
2068
  runtimeId: "M",
2054
- renderId: getDefaultRenderId(this)
2069
+ renderId: getDefaultRenderId(template)
2055
2070
  };
2056
- let state = new State($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2057
- return this.i ? head.render(() => writeWaitReady(this.a, this, input)) : head.render(this, input), new ServerRendered(head);
2071
+ let state = new StateClass($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2072
+ return template.i ? head.render(() => writeWaitReady(template.a, template, input)) : head.render(template, input), new ServerRendered(head);
2058
2073
  }
2059
2074
  function getDefaultRenderId(template) {
2060
2075
  if (template.i) {