marko 6.4.11 → 6.4.13

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 (108) hide show
  1. package/dist/common/attr-tag.d.ts +1 -0
  2. package/dist/common/errors.d.ts +2 -0
  3. package/dist/common/helpers.d.ts +2 -0
  4. package/dist/debug/dom/catch.feat.js +1 -1
  5. package/dist/debug/dom/catch.feat.mjs +1 -1
  6. package/dist/debug/dom/compat.feat.js +143 -0
  7. package/dist/debug/dom/compat.feat.mjs +141 -0
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  19. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  21. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  22. package/dist/debug/dom/lazy.feat.js +1 -1
  23. package/dist/debug/dom/lazy.feat.mjs +1 -1
  24. package/dist/debug/dom/placeholder.feat.js +1 -1
  25. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  26. package/dist/debug/{dom-DjUZd-9y.mjs → dom-BORByF2b.mjs} +54 -27
  27. package/dist/debug/{dom-mQ5mPBTF.js → dom-sfzdCRAg.js} +71 -38
  28. package/dist/debug/dom.js +4 -127
  29. package/dist/debug/dom.mjs +2 -119
  30. package/dist/debug/html/compat.feat.js +222 -0
  31. package/dist/debug/html/compat.feat.mjs +220 -0
  32. package/dist/debug/html-DMo6pc_h.mjs +3931 -0
  33. package/dist/debug/html-DfZjMkhx.js +4513 -0
  34. package/dist/debug/html.js +83 -4220
  35. package/dist/debug/html.mjs +1 -4133
  36. package/dist/dom/catch.feat.js +4 -4
  37. package/dist/dom/catch.feat.mjs +1 -1
  38. package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
  39. package/dist/dom/compat.feat.js +101 -0
  40. package/dist/dom/compat.feat.mjs +100 -0
  41. package/dist/dom/control-flow.d.ts +0 -1
  42. package/dist/dom/controllable-input.feat.js +2 -2
  43. package/dist/dom/controllable-input.feat.mjs +1 -1
  44. package/dist/dom/controllable-open.feat.js +2 -2
  45. package/dist/dom/controllable-open.feat.mjs +1 -1
  46. package/dist/dom/controllable-select.feat.js +2 -2
  47. package/dist/dom/controllable-select.feat.mjs +1 -1
  48. package/dist/dom/controllable-textarea.feat.js +2 -2
  49. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  50. package/dist/dom/controllable.feat.js +2 -2
  51. package/dist/dom/controllable.feat.mjs +1 -1
  52. package/dist/dom/dom.d.ts +2 -1
  53. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  54. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  55. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  56. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  57. package/dist/dom/lazy.feat.js +1 -1
  58. package/dist/dom/lazy.feat.mjs +1 -1
  59. package/dist/dom/placeholder.feat.js +3 -3
  60. package/dist/dom/placeholder.feat.mjs +1 -1
  61. package/dist/dom/resume.d.ts +3 -1
  62. package/dist/{dom-HEWdZCCb.mjs → dom-DKn1bCPC.mjs} +15 -19
  63. package/dist/{dom-B8j2453O.js → dom-DRiewpRL.js} +127 -136
  64. package/dist/dom.d.ts +0 -1
  65. package/dist/dom.js +21 -95
  66. package/dist/dom.mjs +3 -72
  67. package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
  68. package/dist/html/compat.feat.js +165 -0
  69. package/dist/html/compat.feat.mjs +164 -0
  70. package/dist/html/dynamic-tag.d.ts +1 -2
  71. package/dist/html/writer.d.ts +2 -1
  72. package/dist/html-DMDc0zKs.mjs +2404 -0
  73. package/dist/html-DrHsybFm.js +2880 -0
  74. package/dist/html.d.ts +0 -1
  75. package/dist/html.js +2 -2566
  76. package/dist/html.mjs +3 -2561
  77. package/dist/translator/core/if.d.ts +0 -85
  78. package/dist/translator/core/index.d.ts +2 -85
  79. package/dist/translator/index.d.ts +2 -85
  80. package/dist/translator/index.js +332 -476
  81. package/dist/translator/interop/index.d.ts +2 -0
  82. package/dist/translator/util/assert.d.ts +2 -0
  83. package/dist/translator/util/branch-tag.d.ts +1 -1
  84. package/dist/translator/util/known-tag.d.ts +4 -1
  85. package/dist/translator/util/optional.d.ts +0 -1
  86. package/dist/translator/util/reasons.d.ts +0 -1
  87. package/dist/translator/util/references.d.ts +1 -0
  88. package/dist/translator/util/sections.d.ts +5 -1
  89. package/dist/translator/util/tag-facts.d.ts +2 -0
  90. package/dist/translator/util/translate-attrs.d.ts +1 -4
  91. package/dist/translator/visitors/program/index.d.ts +2 -2
  92. package/index.d.ts +2 -7
  93. package/package.json +4 -4
  94. package/tags/await.d.marko +9 -1
  95. package/tags/const.d.marko +7 -1
  96. package/tags/debug.d.marko +7 -1
  97. package/tags/define.d.marko +7 -1
  98. package/tags/effect.d.marko +6 -1
  99. package/tags/html-comment.d.marko +6 -0
  100. package/tags/html-script.d.marko +5 -0
  101. package/tags/html-style.d.marko +5 -0
  102. package/tags/id.d.marko +11 -1
  103. package/tags/let.d.marko +8 -1
  104. package/tags/lifecycle.d.marko +11 -1
  105. package/tags/log.d.marko +7 -1
  106. package/tags/script.d.marko +9 -1
  107. package/tags/show.d.marko +7 -1
  108. package/tags/try.d.marko +9 -1
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_control_flow = require("../html-DfZjMkhx.js");
4
+ // src/common/compat-meta.ts
5
+ const SET_SCOPE_REGISTER_ID = "$compat_setScope";
6
+ const RENDER_BODY_ID = "$compat_renderBody";
7
+ // src/html/compat.feat.ts
8
+ const K_TAGS_API_STATE = Symbol();
9
+ const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
10
+ const compat = {
11
+ $global: require_control_flow.$global,
12
+ writeLoadAsset: require_control_flow.writeLoadAsset,
13
+ fork(scopeId, promise, content) {
14
+ require_control_flow._await(scopeId, "#text/0", promise, (value) => {
15
+ const branchId = require_control_flow._peek_scope_id();
16
+ content(value);
17
+ if (require_control_flow._peek_scope_id() === branchId) require_control_flow._scope_id();
18
+ });
19
+ },
20
+ write: require_control_flow._html,
21
+ writeScript: require_control_flow.writeScript,
22
+ nextScopeId: require_control_flow._scope_id,
23
+ peekNextScopeId: require_control_flow._peek_scope_id,
24
+ isInResumedBranch: require_control_flow.isInResumedBranch,
25
+ withChunk: require_control_flow.withChunk,
26
+ getChunk: require_control_flow.getChunk,
27
+ ensureState($global) {
28
+ let state = $global[K_TAGS_API_STATE] ||= require_control_flow.getChunk()?.boundary.state;
29
+ if (!state) {
30
+ $global.runtimeId ||= "M";
31
+ $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_";
32
+ $global[K_TAGS_API_STATE] = state = new require_control_flow.State($global);
33
+ }
34
+ return state;
35
+ },
36
+ isRenderer(value) {
37
+ return typeof value === "function" && "id" in value;
38
+ },
39
+ setRendererId(renderer, id) {
40
+ renderer["id"] = id;
41
+ },
42
+ onFlush(fn) {
43
+ const { flushHTML } = require_control_flow.Chunk.prototype;
44
+ require_control_flow.Chunk.prototype.flushHTML = function(boundary) {
45
+ const { state } = boundary;
46
+ const reorders = swapReorders(state, null);
47
+ fn(this);
48
+ swapReorders(state, reorders);
49
+ return flushHTML.call(this, boundary);
50
+ };
51
+ },
52
+ setClassAPIRenderer: require_control_flow.setClassAPIRenderer,
53
+ writeSetScopeForComponent(branchId, m5c, m5i) {
54
+ require_control_flow.writeScope(branchId, {
55
+ m5c,
56
+ m5i
57
+ });
58
+ require_control_flow._script(branchId, SET_SCOPE_REGISTER_ID);
59
+ },
60
+ toJSON() {
61
+ return function toJSON() {
62
+ let compatRegistered = COMPAT_REGISTRY.get(this);
63
+ if (!compatRegistered) {
64
+ const registered = require_control_flow.REGISTRY.get(this);
65
+ if (registered) {
66
+ const scopeId = registered.scope ? require_control_flow.getScopeId(registered.scope) : void 0;
67
+ if (scopeId !== void 0) require_control_flow._script(scopeId, SET_SCOPE_REGISTER_ID);
68
+ COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
69
+ }
70
+ }
71
+ return compatRegistered;
72
+ };
73
+ },
74
+ joinChunks(chunks) {
75
+ let joined;
76
+ for (const chunk of chunks) {
77
+ if (chunk.boundary.aborted) continue;
78
+ if (joined) joined.append(chunk);
79
+ else joined = chunk;
80
+ }
81
+ return joined;
82
+ },
83
+ appendChunks(chunks) {
84
+ const chunk = require_control_flow.$chunk;
85
+ for (const part of chunks) {
86
+ chunk.append(part);
87
+ if (part.effects) chunk.lastEffect = part.lastEffect;
88
+ }
89
+ },
90
+ deferReorders(reorders) {
91
+ const chunk = require_control_flow.$chunk;
92
+ for (let i = reorders.length; i--;) {
93
+ const carrier = chunk.fork(chunk.boundary, chunk.next);
94
+ carrier.deferredReorder = reorders[i];
95
+ chunk.next = carrier;
96
+ }
97
+ },
98
+ createChunk($global) {
99
+ const state = this.ensureState($global);
100
+ return new require_control_flow.Chunk(new require_control_flow.Boundary(state), null, null, state);
101
+ },
102
+ flushScript(chunk, reorders) {
103
+ const { boundary } = chunk;
104
+ const { state } = boundary;
105
+ let html = "";
106
+ let scripts = "";
107
+ if (reorders) for (const reorder of reorders) state.reorder(reorder);
108
+ if (boundary.flush() === 0) ({html, scripts} = chunk.flush(boundary));
109
+ if (boundary.aborted) throw boundary.reason;
110
+ if (boundary.count) throw /* @__PURE__ */ new Error("Cannot serialize promise across tags/class compat layer.");
111
+ return {
112
+ html,
113
+ scripts
114
+ };
115
+ },
116
+ render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
117
+ if (parentChunk?.boundary.aborted) return;
118
+ const state = this.ensureState(classAPIOut.global);
119
+ const boundary = new require_control_flow.Boundary(state, void 0, parentChunk?.boundary);
120
+ const context = require_control_flow.getChunk()?.context ?? null;
121
+ let head = new require_control_flow.Chunk(boundary, new require_control_flow.Chunk(boundary, null, context, state), context, state);
122
+ let normalizedInput = input;
123
+ if ("renderBody" in input) {
124
+ normalizedInput = {};
125
+ for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
126
+ }
127
+ const componentScope = new require_control_flow.Chunk(boundary, null, context, state);
128
+ componentScope.render(() => {
129
+ if (this.hasPendingClassFunctions(classAPIOut.global)) drainClassFunctions(classAPIOut.global, (hostId) => {
130
+ const fnScopeId = require_control_flow._scope_id();
131
+ const scope = require_control_flow.writeScope(fnScopeId, {
132
+ m5c: component.id,
133
+ m5h: hostId
134
+ });
135
+ require_control_flow._script(fnScopeId, SET_SCOPE_REGISTER_ID);
136
+ return scope;
137
+ });
138
+ if (willRerender || registerChildScope) {
139
+ const scopeId = require_control_flow._peek_scope_id();
140
+ require_control_flow.writeScope(scopeId, { m5c: component.id });
141
+ require_control_flow._script(scopeId, SET_SCOPE_REGISTER_ID);
142
+ }
143
+ });
144
+ head.render(() => {
145
+ require_control_flow._set_scope_reason(willRerender ? require_control_flow.ALL_GROUPS : 0);
146
+ try {
147
+ renderer(normalizedInput);
148
+ } finally {
149
+ require_control_flow._set_scope_reason(void 0);
150
+ }
151
+ const asyncOut = classAPIOut.beginAsync({
152
+ last: true,
153
+ timeout: -1
154
+ });
155
+ classAPIOut.onLast((next) => {
156
+ (boundary.onNext = () => {
157
+ if (boundary.aborted) {
158
+ boundary.onNext = require_control_flow.NOOP;
159
+ if (parentChunk?.boundary.aborted) {
160
+ asyncOut.end();
161
+ next();
162
+ } else asyncOut.error(boundary.reason);
163
+ } else if (!boundary.count) {
164
+ boundary.onNext = require_control_flow.NOOP;
165
+ const queued = swapReorders(state, null);
166
+ head = head.consume(boundary);
167
+ const reorders = swapReorders(state, queued);
168
+ if (reorders) asyncOut.writer.get("reorders").push(...reorders);
169
+ const heldEffects = head.takeHeldEffects();
170
+ if (heldEffects) {
171
+ head.effects = require_control_flow.joinHeldEffects(heldEffects, head.effects);
172
+ head.lastEffect = "";
173
+ }
174
+ asyncOut.write(head.html);
175
+ asyncOut.script(head.scripts);
176
+ head.html = head.scripts = "";
177
+ asyncOut.writer.get("chunks").push(head);
178
+ asyncOut.end();
179
+ componentScopes.push(componentScope);
180
+ next();
181
+ }
182
+ })();
183
+ });
184
+ });
185
+ },
186
+ register: require_control_flow.register,
187
+ registerRenderBody(fn) {
188
+ require_control_flow.register(RENDER_BODY_ID, fn);
189
+ },
190
+ registerClassFunctions(input) {
191
+ for (const key in input) {
192
+ const value = input[key];
193
+ if (typeof value === "function" && !require_control_flow.REGISTRY.has(value)) require_control_flow.register(RENDER_BODY_ID, value);
194
+ }
195
+ },
196
+ registerClassFunction($global, id, fn, hostId) {
197
+ let pending = pendingClassFunctions.get($global);
198
+ if (!pending) pendingClassFunctions.set($global, pending = []);
199
+ pending.push([
200
+ id,
201
+ fn,
202
+ hostId
203
+ ]);
204
+ return fn;
205
+ },
206
+ hasPendingClassFunctions($global) {
207
+ return !!pendingClassFunctions.get($global)?.length;
208
+ }
209
+ };
210
+ const pendingClassFunctions = /* @__PURE__ */ new WeakMap();
211
+ function drainClassFunctions($global, writeScope) {
212
+ const pending = pendingClassFunctions.get($global);
213
+ const scopeByHost = {};
214
+ for (const [id, fn, hostId] of pending) require_control_flow.register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
215
+ pending.length = 0;
216
+ }
217
+ function swapReorders(state, reorders) {
218
+ const { writeReorders } = state;
219
+ state.writeReorders = reorders;
220
+ return writeReorders;
221
+ }
222
+ exports.compat = compat;
@@ -0,0 +1,220 @@
1
+ import { A as $global, F as State, Ft as register, J as _scope_id, M as Boundary, N as Chunk, P as NOOP, Pt as REGISTRY, Q as _set_scope_reason, V as _html, Vt as setClassAPIRenderer, W as _peek_scope_id, Z as _script, _ as writeLoadAsset, at as getChunk, ct as joinHeldEffects, dt as writeScript, j as ALL_GROUPS, k as $chunk, lt as withChunk, ot as getScopeId, st as isInResumedBranch, t as _await, ut as writeScope } from "../html-DMo6pc_h.mjs";
2
+ // src/common/compat-meta.ts
3
+ const SET_SCOPE_REGISTER_ID = "$compat_setScope";
4
+ const RENDER_BODY_ID = "$compat_renderBody";
5
+ // src/html/compat.feat.ts
6
+ const K_TAGS_API_STATE = Symbol();
7
+ const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
8
+ const compat = {
9
+ $global,
10
+ writeLoadAsset,
11
+ fork(scopeId, promise, content) {
12
+ _await(scopeId, "#text/0", promise, (value) => {
13
+ const branchId = _peek_scope_id();
14
+ content(value);
15
+ if (_peek_scope_id() === branchId) _scope_id();
16
+ });
17
+ },
18
+ write: _html,
19
+ writeScript,
20
+ nextScopeId: _scope_id,
21
+ peekNextScopeId: _peek_scope_id,
22
+ isInResumedBranch,
23
+ withChunk,
24
+ getChunk,
25
+ ensureState($global) {
26
+ let state = $global[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
27
+ if (!state) {
28
+ $global.runtimeId ||= "M";
29
+ $global.renderId ||= $global.componentIdPrefix || $global.widgetIdPrefix || "_";
30
+ $global[K_TAGS_API_STATE] = state = new State($global);
31
+ }
32
+ return state;
33
+ },
34
+ isRenderer(value) {
35
+ return typeof value === "function" && "id" in value;
36
+ },
37
+ setRendererId(renderer, id) {
38
+ renderer["id"] = id;
39
+ },
40
+ onFlush(fn) {
41
+ const { flushHTML } = Chunk.prototype;
42
+ Chunk.prototype.flushHTML = function(boundary) {
43
+ const { state } = boundary;
44
+ const reorders = swapReorders(state, null);
45
+ fn(this);
46
+ swapReorders(state, reorders);
47
+ return flushHTML.call(this, boundary);
48
+ };
49
+ },
50
+ setClassAPIRenderer,
51
+ writeSetScopeForComponent(branchId, m5c, m5i) {
52
+ writeScope(branchId, {
53
+ m5c,
54
+ m5i
55
+ });
56
+ _script(branchId, SET_SCOPE_REGISTER_ID);
57
+ },
58
+ toJSON() {
59
+ return function toJSON() {
60
+ let compatRegistered = COMPAT_REGISTRY.get(this);
61
+ if (!compatRegistered) {
62
+ const registered = REGISTRY.get(this);
63
+ if (registered) {
64
+ const scopeId = registered.scope ? getScopeId(registered.scope) : void 0;
65
+ if (scopeId !== void 0) _script(scopeId, SET_SCOPE_REGISTER_ID);
66
+ COMPAT_REGISTRY.set(this, compatRegistered = [registered.id, scopeId]);
67
+ }
68
+ }
69
+ return compatRegistered;
70
+ };
71
+ },
72
+ joinChunks(chunks) {
73
+ let joined;
74
+ for (const chunk of chunks) {
75
+ if (chunk.boundary.aborted) continue;
76
+ if (joined) joined.append(chunk);
77
+ else joined = chunk;
78
+ }
79
+ return joined;
80
+ },
81
+ appendChunks(chunks) {
82
+ const chunk = $chunk;
83
+ for (const part of chunks) {
84
+ chunk.append(part);
85
+ if (part.effects) chunk.lastEffect = part.lastEffect;
86
+ }
87
+ },
88
+ deferReorders(reorders) {
89
+ const chunk = $chunk;
90
+ for (let i = reorders.length; i--;) {
91
+ const carrier = chunk.fork(chunk.boundary, chunk.next);
92
+ carrier.deferredReorder = reorders[i];
93
+ chunk.next = carrier;
94
+ }
95
+ },
96
+ createChunk($global) {
97
+ const state = this.ensureState($global);
98
+ return new Chunk(new Boundary(state), null, null, state);
99
+ },
100
+ flushScript(chunk, reorders) {
101
+ const { boundary } = chunk;
102
+ const { state } = boundary;
103
+ let html = "";
104
+ let scripts = "";
105
+ if (reorders) for (const reorder of reorders) state.reorder(reorder);
106
+ if (boundary.flush() === 0) ({html, scripts} = chunk.flush(boundary));
107
+ if (boundary.aborted) throw boundary.reason;
108
+ if (boundary.count) throw /* @__PURE__ */ new Error("Cannot serialize promise across tags/class compat layer.");
109
+ return {
110
+ html,
111
+ scripts
112
+ };
113
+ },
114
+ render(renderer, willRerender, classAPIOut, component, input, componentScopes, registerChildScope, parentChunk) {
115
+ if (parentChunk?.boundary.aborted) return;
116
+ const state = this.ensureState(classAPIOut.global);
117
+ const boundary = new Boundary(state, void 0, parentChunk?.boundary);
118
+ const context = getChunk()?.context ?? null;
119
+ let head = new Chunk(boundary, new Chunk(boundary, null, context, state), context, state);
120
+ let normalizedInput = input;
121
+ if ("renderBody" in input) {
122
+ normalizedInput = {};
123
+ for (const key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
124
+ }
125
+ const componentScope = new Chunk(boundary, null, context, state);
126
+ componentScope.render(() => {
127
+ if (this.hasPendingClassFunctions(classAPIOut.global)) drainClassFunctions(classAPIOut.global, (hostId) => {
128
+ const fnScopeId = _scope_id();
129
+ const scope = writeScope(fnScopeId, {
130
+ m5c: component.id,
131
+ m5h: hostId
132
+ });
133
+ _script(fnScopeId, SET_SCOPE_REGISTER_ID);
134
+ return scope;
135
+ });
136
+ if (willRerender || registerChildScope) {
137
+ const scopeId = _peek_scope_id();
138
+ writeScope(scopeId, { m5c: component.id });
139
+ _script(scopeId, SET_SCOPE_REGISTER_ID);
140
+ }
141
+ });
142
+ head.render(() => {
143
+ _set_scope_reason(willRerender ? ALL_GROUPS : 0);
144
+ try {
145
+ renderer(normalizedInput);
146
+ } finally {
147
+ _set_scope_reason(void 0);
148
+ }
149
+ const asyncOut = classAPIOut.beginAsync({
150
+ last: true,
151
+ timeout: -1
152
+ });
153
+ classAPIOut.onLast((next) => {
154
+ (boundary.onNext = () => {
155
+ if (boundary.aborted) {
156
+ boundary.onNext = NOOP;
157
+ if (parentChunk?.boundary.aborted) {
158
+ asyncOut.end();
159
+ next();
160
+ } else asyncOut.error(boundary.reason);
161
+ } else if (!boundary.count) {
162
+ boundary.onNext = NOOP;
163
+ const queued = swapReorders(state, null);
164
+ head = head.consume(boundary);
165
+ const reorders = swapReorders(state, queued);
166
+ if (reorders) asyncOut.writer.get("reorders").push(...reorders);
167
+ const heldEffects = head.takeHeldEffects();
168
+ if (heldEffects) {
169
+ head.effects = joinHeldEffects(heldEffects, head.effects);
170
+ head.lastEffect = "";
171
+ }
172
+ asyncOut.write(head.html);
173
+ asyncOut.script(head.scripts);
174
+ head.html = head.scripts = "";
175
+ asyncOut.writer.get("chunks").push(head);
176
+ asyncOut.end();
177
+ componentScopes.push(componentScope);
178
+ next();
179
+ }
180
+ })();
181
+ });
182
+ });
183
+ },
184
+ register,
185
+ registerRenderBody(fn) {
186
+ register(RENDER_BODY_ID, fn);
187
+ },
188
+ registerClassFunctions(input) {
189
+ for (const key in input) {
190
+ const value = input[key];
191
+ if (typeof value === "function" && !REGISTRY.has(value)) register(RENDER_BODY_ID, value);
192
+ }
193
+ },
194
+ registerClassFunction($global, id, fn, hostId) {
195
+ let pending = pendingClassFunctions.get($global);
196
+ if (!pending) pendingClassFunctions.set($global, pending = []);
197
+ pending.push([
198
+ id,
199
+ fn,
200
+ hostId
201
+ ]);
202
+ return fn;
203
+ },
204
+ hasPendingClassFunctions($global) {
205
+ return !!pendingClassFunctions.get($global)?.length;
206
+ }
207
+ };
208
+ const pendingClassFunctions = /* @__PURE__ */ new WeakMap();
209
+ function drainClassFunctions($global, writeScope) {
210
+ const pending = pendingClassFunctions.get($global);
211
+ const scopeByHost = {};
212
+ for (const [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));
213
+ pending.length = 0;
214
+ }
215
+ function swapReorders(state, reorders) {
216
+ const { writeReorders } = state;
217
+ state.writeReorders = reorders;
218
+ return writeReorders;
219
+ }
220
+ export { compat };