@vidact/runtime 0.2.0-beta.0 → 0.2.0-beta.4
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.
- package/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/dist/actions.d.ts +32 -30
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +251 -266
- package/dist/actions.js.map +1 -1
- package/dist/async.d.ts +20 -17
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +18 -17
- package/dist/async.js.map +1 -1
- package/dist/compiled/async-resource.d.ts +9 -6
- package/dist/compiled/async-resource.d.ts.map +1 -1
- package/dist/compiled/async-resource.js +69 -77
- package/dist/compiled/async-resource.js.map +1 -1
- package/dist/compiled/core.d.ts +136 -147
- package/dist/compiled/core.d.ts.map +1 -1
- package/dist/compiled/core.js +2669 -2985
- package/dist/compiled/core.js.map +1 -1
- package/dist/compiled/types.d.ts +44 -56
- package/dist/compiled/types.d.ts.map +1 -1
- package/dist/compiled/types.js +10 -6
- package/dist/compiled/types.js.map +1 -1
- package/dist/compiled/validation.d.ts +4 -1
- package/dist/compiled/validation.d.ts.map +1 -1
- package/dist/compiled/validation.js +17 -20
- package/dist/compiled/validation.js.map +1 -1
- package/dist/component-spread.d.ts +5 -3
- package/dist/component-spread.d.ts.map +1 -1
- package/dist/component-spread.js +49 -67
- package/dist/component-spread.js.map +1 -1
- package/dist/concurrent.d.ts +20 -18
- package/dist/concurrent.d.ts.map +1 -1
- package/dist/concurrent.js +191 -210
- package/dist/concurrent.js.map +1 -1
- package/dist/direct-dom.d.ts +17 -12
- package/dist/direct-dom.d.ts.map +1 -1
- package/dist/direct-dom.js +187 -221
- package/dist/direct-dom.js.map +1 -1
- package/dist/dom/attributes.d.ts +9 -6
- package/dist/dom/attributes.d.ts.map +1 -1
- package/dist/dom/attributes.js +65 -47
- package/dist/dom/attributes.js.map +1 -1
- package/dist/dom/events.d.ts +5 -2
- package/dist/dom/events.d.ts.map +1 -1
- package/dist/dom/events.js +53 -65
- package/dist/dom/events.js.map +1 -1
- package/dist/dom/forms.d.ts +9 -6
- package/dist/dom/forms.d.ts.map +1 -1
- package/dist/dom/forms.js +152 -198
- package/dist/dom/forms.js.map +1 -1
- package/dist/dom/intrinsic.d.ts +17 -15
- package/dist/dom/intrinsic.d.ts.map +1 -1
- package/dist/dom/intrinsic.js +48 -50
- package/dist/dom/intrinsic.js.map +1 -1
- package/dist/dom/namespace.d.ts +4 -1
- package/dist/dom/namespace.d.ts.map +1 -1
- package/dist/dom/namespace.js +25 -28
- package/dist/dom/namespace.js.map +1 -1
- package/dist/dom/namespaces.d.ts +11 -8
- package/dist/dom/namespaces.d.ts.map +1 -1
- package/dist/dom/namespaces.js +14 -12
- package/dist/dom/namespaces.js.map +1 -1
- package/dist/dom/properties.d.ts +18 -16
- package/dist/dom/properties.d.ts.map +1 -1
- package/dist/dom/properties.js +273 -296
- package/dist/dom/properties.js.map +1 -1
- package/dist/dom/style-properties.d.ts +4 -1
- package/dist/dom/style-properties.d.ts.map +1 -1
- package/dist/dom/style-properties.js +49 -45
- package/dist/dom/style-properties.js.map +1 -1
- package/dist/dom/styles.d.ts +5 -2
- package/dist/dom/styles.d.ts.map +1 -1
- package/dist/dom/styles.js +47 -67
- package/dist/dom/styles.js.map +1 -1
- package/dist/dom-forms.d.ts +4 -1
- package/dist/dom-forms.d.ts.map +1 -1
- package/dist/dom-forms.js +16 -13
- package/dist/dom-forms.js.map +1 -1
- package/dist/dom-styles.d.ts +4 -1
- package/dist/dom-styles.d.ts.map +1 -1
- package/dist/dom-styles.js +10 -7
- package/dist/dom-styles.js.map +1 -1
- package/dist/framework-hydrate.d.ts +20 -17
- package/dist/framework-hydrate.d.ts.map +1 -1
- package/dist/framework-hydrate.js +128 -146
- package/dist/framework-hydrate.js.map +1 -1
- package/dist/framework-protocol.d.ts +27 -25
- package/dist/framework-protocol.d.ts.map +1 -1
- package/dist/framework-protocol.js +173 -211
- package/dist/framework-protocol.js.map +1 -1
- package/dist/framework.d.ts +34 -32
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +74 -93
- package/dist/framework.js.map +1 -1
- package/dist/hydrate.d.ts +11 -8
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +13 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/hydration-bridge.d.ts +61 -58
- package/dist/hydration-bridge.d.ts.map +1 -1
- package/dist/hydration-bridge.js +67 -66
- package/dist/hydration-bridge.js.map +1 -1
- package/dist/hydration.d.ts +31 -28
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +376 -462
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +11 -13
- package/dist/indexed-list.d.ts +8 -5
- package/dist/indexed-list.d.ts.map +1 -1
- package/dist/indexed-list.js +14 -7
- package/dist/indexed-list.js.map +1 -1
- package/dist/jsx-runtime.d.ts +10 -8
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +28 -23
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/keyed-list.d.ts +13 -14
- package/dist/keyed-list.d.ts.map +1 -1
- package/dist/keyed-list.js +132 -160
- package/dist/keyed-list.js.map +1 -1
- package/dist/metadata.d.ts +6 -3
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +131 -164
- package/dist/metadata.js.map +1 -1
- package/dist/nested-prop.d.ts +4 -2
- package/dist/nested-prop.d.ts.map +1 -1
- package/dist/nested-prop.js +17 -16
- package/dist/nested-prop.js.map +1 -1
- package/dist/profiling.d.ts +11 -8
- package/dist/profiling.d.ts.map +1 -1
- package/dist/profiling.js +17 -17
- package/dist/profiling.js.map +1 -1
- package/dist/protocol.d.ts +5 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +8 -5
- package/dist/protocol.js.map +1 -1
- package/dist/raw-html.d.ts +5 -2
- package/dist/raw-html.d.ts.map +1 -1
- package/dist/raw-html.js +86 -146
- package/dist/raw-html.js.map +1 -1
- package/dist/ref.d.ts +8 -3
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +10 -2
- package/dist/ref.js.map +1 -1
- package/dist/renderable-protocol.d.ts +26 -8
- package/dist/renderable-protocol.d.ts.map +1 -1
- package/dist/renderable-protocol.js +30 -9
- package/dist/renderable-protocol.js.map +1 -1
- package/dist/renderable.d.ts +27 -22
- package/dist/renderable.d.ts.map +1 -1
- package/dist/renderable.js +141 -133
- package/dist/renderable.js.map +1 -1
- package/dist/retained-ui.d.ts +9 -6
- package/dist/retained-ui.d.ts.map +1 -1
- package/dist/retained-ui.js +12 -10
- package/dist/retained-ui.js.map +1 -1
- package/dist/root.d.ts +18 -15
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +73 -85
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +10 -8
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +97 -105
- package/dist/scheduler.js.map +1 -1
- package/dist/server-framework.d.ts +45 -42
- package/dist/server-framework.d.ts.map +1 -1
- package/dist/server-framework.js +209 -217
- package/dist/server-framework.js.map +1 -1
- package/dist/server.d.ts +130 -128
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +592 -706
- package/dist/server.js.map +1 -1
- package/dist/shared/promise.d.ts +6 -3
- package/dist/shared/promise.d.ts.map +1 -1
- package/dist/shared/promise.js +21 -19
- package/dist/shared/promise.js.map +1 -1
- package/dist/source-mask.d.ts +9 -6
- package/dist/source-mask.d.ts.map +1 -1
- package/dist/source-mask.js +45 -63
- package/dist/source-mask.js.map +1 -1
- package/dist/spread.d.ts +5 -2
- package/dist/spread.d.ts.map +1 -1
- package/dist/spread.js +79 -99
- package/dist/spread.js.map +1 -1
- package/dist/state-slot.d.ts +18 -15
- package/dist/state-slot.d.ts.map +1 -1
- package/dist/state-slot.js +43 -42
- package/dist/state-slot.js.map +1 -1
- package/dist/testing.d.ts +9 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +16 -12
- package/dist/testing.js.map +1 -1
- package/package.json +8 -7
- package/src/actions.ts +415 -0
- package/src/async.ts +78 -0
- package/src/compiled/async-resource.ts +113 -0
- package/src/compiled/core.ts +4026 -0
- package/src/compiled/types.ts +96 -0
- package/src/compiled/validation.ts +23 -0
- package/src/component-spread.ts +86 -0
- package/src/concurrent.ts +310 -0
- package/src/direct-dom.ts +365 -0
- package/src/dom/attributes.ts +55 -0
- package/src/dom/events.ts +93 -0
- package/src/dom/forms.ts +220 -0
- package/src/dom/intrinsic.ts +94 -0
- package/src/dom/namespace.ts +30 -0
- package/src/dom/namespaces.ts +14 -0
- package/src/dom/properties.ts +355 -0
- package/src/dom/style-properties.ts +46 -0
- package/src/dom/styles.ts +86 -0
- package/src/dom-forms.ts +23 -0
- package/src/dom-styles.ts +11 -0
- package/src/env.d.ts +6 -0
- package/src/framework-hydrate.ts +224 -0
- package/src/framework-protocol.ts +335 -0
- package/src/framework.ts +161 -0
- package/src/hydrate.ts +38 -0
- package/src/hydration-bridge.ts +183 -0
- package/src/hydration.ts +556 -0
- package/src/index.ts +92 -0
- package/src/indexed-list.ts +20 -0
- package/src/jsx-runtime.ts +55 -0
- package/src/keyed-list.ts +233 -0
- package/src/metadata.ts +212 -0
- package/src/nested-prop.ts +27 -0
- package/src/profiling.ts +43 -0
- package/src/protocol.ts +8 -0
- package/src/raw-html.ts +206 -0
- package/src/ref.ts +13 -0
- package/src/renderable-protocol.ts +63 -0
- package/src/renderable.ts +283 -0
- package/src/retained-ui.ts +19 -0
- package/src/root.ts +122 -0
- package/src/scheduler.ts +136 -0
- package/src/server-framework.ts +397 -0
- package/src/server.ts +1143 -0
- package/src/shared/promise.ts +28 -0
- package/src/source-mask.ts +83 -0
- package/src/spread.ts +131 -0
- package/src/state-slot.ts +76 -0
- package/src/testing.ts +27 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/hydration.js
CHANGED
|
@@ -1,489 +1,403 @@
|
|
|
1
|
-
import { HydrationMismatch, installHydrationOperations
|
|
2
|
-
|
|
1
|
+
import { HydrationMismatch, installHydrationOperations } from "./hydration-bridge.js";
|
|
2
|
+
//#region src/hydration.ts
|
|
3
|
+
const HYDRATION_PREFIX = "vidact:v1";
|
|
3
4
|
let activeHydration;
|
|
4
5
|
let activeInsertionPoint;
|
|
5
|
-
const hydrationFragments = new WeakMap();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
throw mismatch(`expected a vidact:v1 child-slot marker in ${parent.nodeName}; found ${JSON.stringify(markerValue(start) ?? start?.nodeName ?? null)} after ${JSON.stringify(markerValue(start?.previousSibling) ?? start?.previousSibling?.nodeName ?? null)}; insertion=${JSON.stringify(markerValue(activeInsertionPoint?.[1]) ?? activeInsertionPoint?.[1]?.nodeName ?? null)}`);
|
|
225
|
-
}
|
|
226
|
-
const end = findClosingSibling(start, `${HYDRATION_PREFIX}:b`);
|
|
227
|
-
const slots = state.slots.get(parent) ?? [];
|
|
228
|
-
slots.push(end);
|
|
229
|
-
state.slots.set(parent, slots);
|
|
230
|
-
state.cursors.set(parent, start.nextSibling);
|
|
231
|
-
return [start, end];
|
|
232
|
-
}
|
|
233
|
-
export function borrowHydrationSlotRange(parent, current) {
|
|
234
|
-
const state = activeHydration;
|
|
235
|
-
if (state === undefined)
|
|
236
|
-
return undefined;
|
|
237
|
-
const start = (current ? cursor(state, parent) : cursor(state, parent)?.previousSibling);
|
|
238
|
-
if (!isMarker(start, `${HYDRATION_PREFIX}:b`))
|
|
239
|
-
return undefined;
|
|
240
|
-
if (!current &&
|
|
241
|
-
activeInsertionPoint?.[0] === parent &&
|
|
242
|
-
isMarker(activeInsertionPoint[1], `/${HYDRATION_PREFIX}:b`)) {
|
|
243
|
-
return [start, activeInsertionPoint[1]];
|
|
244
|
-
}
|
|
245
|
-
return [start, findClosingSibling(start, `${HYDRATION_PREFIX}:b`)];
|
|
246
|
-
}
|
|
247
|
-
export function claimHydrationSuspenseFallback(parent) {
|
|
248
|
-
const state = activeHydration;
|
|
249
|
-
if (state === undefined)
|
|
250
|
-
return undefined;
|
|
251
|
-
const marker = cursor(state, parent);
|
|
252
|
-
if (!isMarker(marker, `${HYDRATION_PREFIX}:p`))
|
|
253
|
-
return undefined;
|
|
254
|
-
setHydrationCursor(state, parent, marker.nextSibling);
|
|
255
|
-
return marker;
|
|
256
|
-
}
|
|
257
|
-
export function withoutHydration(operation) {
|
|
258
|
-
const previous = activeHydration;
|
|
259
|
-
activeHydration = undefined;
|
|
260
|
-
try {
|
|
261
|
-
return operation();
|
|
262
|
-
}
|
|
263
|
-
finally {
|
|
264
|
-
activeHydration = previous;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
export function withHydrationInsertion(parent, before, operation) {
|
|
268
|
-
if (activeHydration === undefined)
|
|
269
|
-
return operation();
|
|
270
|
-
const previous = activeInsertionPoint;
|
|
271
|
-
activeInsertionPoint = [parent, before];
|
|
272
|
-
try {
|
|
273
|
-
return operation();
|
|
274
|
-
}
|
|
275
|
-
finally {
|
|
276
|
-
activeInsertionPoint = previous;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
export function hydrationInsertionPoint() {
|
|
280
|
-
return activeInsertionPoint;
|
|
281
|
-
}
|
|
282
|
-
export function hydrationCursor(parent) {
|
|
283
|
-
const state = activeHydration;
|
|
284
|
-
return state === undefined ? undefined : cursor(state, parent);
|
|
285
|
-
}
|
|
286
|
-
export function hydrationRangeParent(start, end) {
|
|
287
|
-
if (activeHydration === undefined)
|
|
288
|
-
return undefined;
|
|
289
|
-
const parent = start.parentNode;
|
|
290
|
-
if (parent === null || end.parentNode !== parent)
|
|
291
|
-
throw mismatch('detached server marker range');
|
|
292
|
-
return parent;
|
|
6
|
+
const hydrationFragments = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function beginHydration(host) {
|
|
8
|
+
if (activeHydration !== void 0) throw new Error("a Vidact hydration is already active");
|
|
9
|
+
const ranges = scanRanges(host);
|
|
10
|
+
const root = ranges.roots[0];
|
|
11
|
+
if (root === void 0 || ranges.roots.length !== 1) throw mismatch("expected exactly one vidact:v1 root marker range");
|
|
12
|
+
activeHydration = {
|
|
13
|
+
host,
|
|
14
|
+
root,
|
|
15
|
+
components: ranges.components,
|
|
16
|
+
claimedElements: /* @__PURE__ */ new WeakSet(),
|
|
17
|
+
elementComponents: collectElementComponents(host),
|
|
18
|
+
elements: collectPostorderElements(root),
|
|
19
|
+
cursors: new WeakMap([[host, root[0].nextSibling]]),
|
|
20
|
+
slots: /* @__PURE__ */ new WeakMap(),
|
|
21
|
+
componentIndex: 0,
|
|
22
|
+
claimedElementCount: 0,
|
|
23
|
+
pendingStructuralParents: 0,
|
|
24
|
+
activeComponentStart: void 0
|
|
25
|
+
};
|
|
26
|
+
return () => {
|
|
27
|
+
activeHydration = void 0;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function finishHydration() {
|
|
31
|
+
const state = requireHydration();
|
|
32
|
+
if (state.componentIndex !== state.components.length) throw mismatch(`claimed ${state.componentIndex} of ${state.components.length} server component ranges`);
|
|
33
|
+
if (state.claimedElementCount !== state.elements.length) throw mismatch(`claimed ${state.claimedElementCount} of ${state.elements.length} server elements`);
|
|
34
|
+
const rootCursor = cursor(state, state.host);
|
|
35
|
+
if (rootCursor !== state.root[1]) throw mismatch(`compiled root did not consume the complete server root range; stopped at ${JSON.stringify(markerValue(rootCursor) ?? rootCursor?.nodeName ?? null)}`);
|
|
36
|
+
}
|
|
37
|
+
function hydrationRootMarkers() {
|
|
38
|
+
return requireHydration().root;
|
|
39
|
+
}
|
|
40
|
+
function isHydrating() {
|
|
41
|
+
return activeHydration !== void 0;
|
|
42
|
+
}
|
|
43
|
+
function createHydrationFragment(children) {
|
|
44
|
+
const fragment = document.createDocumentFragment();
|
|
45
|
+
hydrationFragments.set(fragment, children);
|
|
46
|
+
return fragment;
|
|
47
|
+
}
|
|
48
|
+
function hydrationFragmentChildren(fragment) {
|
|
49
|
+
return hydrationFragments.get(fragment);
|
|
50
|
+
}
|
|
51
|
+
function isHydrationMismatch(error) {
|
|
52
|
+
return error instanceof HydrationMismatch;
|
|
53
|
+
}
|
|
54
|
+
function claimHydrationElement(localName, namespace, matchesExpected) {
|
|
55
|
+
const state = activeHydration;
|
|
56
|
+
if (state === void 0) return void 0;
|
|
57
|
+
const candidates = state.elements.filter((candidate) => !state.claimedElements.has(candidate) && (state.activeComponentStart === void 0 || state.elementComponents.get(candidate) === state.activeComponentStart) && candidate.localName === localName && candidate.namespaceURI === namespace);
|
|
58
|
+
const expectedMatches = matchesExpected === void 0 ? candidates : candidates.filter(matchesExpected);
|
|
59
|
+
const matches = expectedMatches.length === 0 ? candidates : expectedMatches;
|
|
60
|
+
const element = state.pendingStructuralParents > 0 ? matches.find(containsArrayMarker) ?? matches[0] : matches[0];
|
|
61
|
+
if (element === void 0) throw mismatch(state.pendingStructuralParents > 0 ? `missing server structural parent <${localName}>` : `missing server element <${localName}>`);
|
|
62
|
+
if (state.pendingStructuralParents > 0) state.pendingStructuralParents = 0;
|
|
63
|
+
state.claimedElements.add(element);
|
|
64
|
+
state.claimedElementCount += 1;
|
|
65
|
+
state.cursors.set(element, element.firstChild);
|
|
66
|
+
return element;
|
|
67
|
+
}
|
|
68
|
+
function noteHydrationStructuralParent() {
|
|
69
|
+
if (activeHydration !== void 0) activeHydration.pendingStructuralParents += 1;
|
|
70
|
+
}
|
|
71
|
+
function claimHydrationComponentRange() {
|
|
72
|
+
const state = activeHydration;
|
|
73
|
+
if (state === void 0) return void 0;
|
|
74
|
+
const range = state.components[state.componentIndex];
|
|
75
|
+
if (range === void 0) throw mismatch("missing server component marker range");
|
|
76
|
+
state.componentIndex += 1;
|
|
77
|
+
const parent = range[0].parentNode;
|
|
78
|
+
if (parent === null || range[1].parentNode !== parent) throw mismatch("server component marker range is detached");
|
|
79
|
+
return range;
|
|
80
|
+
}
|
|
81
|
+
function withHydrationComponentRange(range, operation) {
|
|
82
|
+
const state = activeHydration;
|
|
83
|
+
if (state === void 0) return operation();
|
|
84
|
+
const previous = state.activeComponentStart;
|
|
85
|
+
state.activeComponentStart = range[0];
|
|
86
|
+
try {
|
|
87
|
+
return operation();
|
|
88
|
+
} finally {
|
|
89
|
+
state.activeComponentStart = previous;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function withHydrationCursor(parent, value, operation) {
|
|
93
|
+
const state = activeHydration;
|
|
94
|
+
if (state === void 0) return operation();
|
|
95
|
+
const hadCursor = state.cursors.has(parent);
|
|
96
|
+
const previous = state.cursors.get(parent) ?? null;
|
|
97
|
+
state.cursors.set(parent, value);
|
|
98
|
+
try {
|
|
99
|
+
return operation();
|
|
100
|
+
} finally {
|
|
101
|
+
if (hadCursor) state.cursors.set(parent, previous);
|
|
102
|
+
else state.cursors.delete(parent);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function claimHydrationNode(parent, node) {
|
|
106
|
+
const state = activeHydration;
|
|
107
|
+
if (state === void 0) return false;
|
|
108
|
+
enterHydrationSlot(state, parent);
|
|
109
|
+
const next = cursor(state, parent);
|
|
110
|
+
if (isMarker(next, `${HYDRATION_PREFIX}:s`)) {
|
|
111
|
+
const end = findClosingSibling(next, `${HYDRATION_PREFIX}:s`);
|
|
112
|
+
if (next.nextSibling !== node || node.nextSibling !== end) throw mismatch(`server node range does not contain exactly the expected ${node.nodeName}`);
|
|
113
|
+
setHydrationCursor(state, parent, end.nextSibling);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
if (next !== node) throw mismatch(`expected existing ${node.nodeName} at the current hydration position`);
|
|
117
|
+
setHydrationCursor(state, parent, node.nextSibling);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
function claimHydrationComponentMount(parent, start, end) {
|
|
121
|
+
const state = activeHydration;
|
|
122
|
+
if (state === void 0) return false;
|
|
123
|
+
enterHydrationSlot(state, parent);
|
|
124
|
+
const current = cursor(state, parent);
|
|
125
|
+
if (current !== start && current !== end || start.parentNode !== parent || end.parentNode !== parent) throw mismatch("server component range does not match the compiled child position");
|
|
126
|
+
setHydrationCursor(state, parent, end.nextSibling);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
function claimHydrationText(parent, expected) {
|
|
130
|
+
return claimHydrationTextRange(parent, expected)?.[2];
|
|
131
|
+
}
|
|
132
|
+
function claimHydrationTextRange(parent, expected) {
|
|
133
|
+
const state = activeHydration;
|
|
134
|
+
if (state === void 0) return void 0;
|
|
135
|
+
enterHydrationSlot(state, parent);
|
|
136
|
+
const start = cursor(state, parent);
|
|
137
|
+
if (!isMarker(start, `${HYDRATION_PREFIX}:t`)) throw mismatch("expected a vidact:v1 text marker");
|
|
138
|
+
const end = findClosingSibling(start, `${HYDRATION_PREFIX}:t`);
|
|
139
|
+
const nodes = [];
|
|
140
|
+
for (let node = start.nextSibling; node !== null && node !== end; node = node.nextSibling) nodes.push(node);
|
|
141
|
+
if (nodes.length > 1 || nodes.length === 1 && !(nodes[0] instanceof Text)) throw mismatch("server text marker must contain at most one text node");
|
|
142
|
+
const text = nodes[0] ?? null;
|
|
143
|
+
if ((text?.data ?? "") !== expected) throw mismatch(`server text ${JSON.stringify(text?.data ?? "")} does not match ${JSON.stringify(expected)}`);
|
|
144
|
+
setHydrationCursor(state, parent, end.nextSibling);
|
|
145
|
+
return [
|
|
146
|
+
start,
|
|
147
|
+
end,
|
|
148
|
+
text
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
function claimHydrationArrayRange(parent) {
|
|
152
|
+
const state = activeHydration;
|
|
153
|
+
if (state === void 0) return void 0;
|
|
154
|
+
enterHydrationSlot(state, parent);
|
|
155
|
+
const start = cursor(state, parent);
|
|
156
|
+
if (!isMarker(start, `${HYDRATION_PREFIX}:a`)) throw mismatch(`expected a vidact:v1 array marker in ${parent.nodeName}; found ${JSON.stringify(markerValue(start) ?? start?.nodeName ?? null)}`);
|
|
157
|
+
const end = findClosingSibling(start, `${HYDRATION_PREFIX}:a`);
|
|
158
|
+
state.cursors.set(parent, start.nextSibling);
|
|
159
|
+
return [start, end];
|
|
160
|
+
}
|
|
161
|
+
function finishHydrationArrayRange(parent, end) {
|
|
162
|
+
const state = requireHydration();
|
|
163
|
+
if (cursor(state, parent) !== end) throw mismatch("compiled collection did not consume its complete server array range");
|
|
164
|
+
setHydrationCursor(state, parent, end.nextSibling);
|
|
165
|
+
}
|
|
166
|
+
function claimHydrationSlotRange(parent) {
|
|
167
|
+
const state = activeHydration;
|
|
168
|
+
if (state === void 0) return void 0;
|
|
169
|
+
const start = cursor(state, parent);
|
|
170
|
+
if (!isMarker(start, `${HYDRATION_PREFIX}:b`)) throw mismatch(`expected a vidact:v1 child-slot marker in ${parent.nodeName}; found ${JSON.stringify(markerValue(start) ?? start?.nodeName ?? null)} after ${JSON.stringify(markerValue(start?.previousSibling) ?? start?.previousSibling?.nodeName ?? null)}; insertion=${JSON.stringify(markerValue(activeInsertionPoint?.[1]) ?? activeInsertionPoint?.[1]?.nodeName ?? null)}`);
|
|
171
|
+
const end = findClosingSibling(start, `${HYDRATION_PREFIX}:b`);
|
|
172
|
+
const slots = state.slots.get(parent) ?? [];
|
|
173
|
+
slots.push(end);
|
|
174
|
+
state.slots.set(parent, slots);
|
|
175
|
+
state.cursors.set(parent, start.nextSibling);
|
|
176
|
+
return [start, end];
|
|
177
|
+
}
|
|
178
|
+
function borrowHydrationSlotRange(parent, current) {
|
|
179
|
+
const state = activeHydration;
|
|
180
|
+
if (state === void 0) return void 0;
|
|
181
|
+
const start = current ? cursor(state, parent) : cursor(state, parent)?.previousSibling;
|
|
182
|
+
if (!isMarker(start, `${HYDRATION_PREFIX}:b`)) return void 0;
|
|
183
|
+
if (!current && activeInsertionPoint?.[0] === parent && isMarker(activeInsertionPoint[1], `/${HYDRATION_PREFIX}:b`)) return [start, activeInsertionPoint[1]];
|
|
184
|
+
return [start, findClosingSibling(start, `${HYDRATION_PREFIX}:b`)];
|
|
185
|
+
}
|
|
186
|
+
function claimHydrationSuspenseFallback(parent) {
|
|
187
|
+
const state = activeHydration;
|
|
188
|
+
if (state === void 0) return void 0;
|
|
189
|
+
const marker = cursor(state, parent);
|
|
190
|
+
if (!isMarker(marker, `${HYDRATION_PREFIX}:p`)) return void 0;
|
|
191
|
+
setHydrationCursor(state, parent, marker.nextSibling);
|
|
192
|
+
return marker;
|
|
193
|
+
}
|
|
194
|
+
function withoutHydration(operation) {
|
|
195
|
+
const previous = activeHydration;
|
|
196
|
+
activeHydration = void 0;
|
|
197
|
+
try {
|
|
198
|
+
return operation();
|
|
199
|
+
} finally {
|
|
200
|
+
activeHydration = previous;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function withHydrationInsertion(parent, before, operation) {
|
|
204
|
+
if (activeHydration === void 0) return operation();
|
|
205
|
+
const previous = activeInsertionPoint;
|
|
206
|
+
activeInsertionPoint = [parent, before];
|
|
207
|
+
try {
|
|
208
|
+
return operation();
|
|
209
|
+
} finally {
|
|
210
|
+
activeInsertionPoint = previous;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function hydrationInsertionPoint() {
|
|
214
|
+
return activeInsertionPoint;
|
|
215
|
+
}
|
|
216
|
+
function hydrationCursor(parent) {
|
|
217
|
+
const state = activeHydration;
|
|
218
|
+
return state === void 0 ? void 0 : cursor(state, parent);
|
|
219
|
+
}
|
|
220
|
+
function hydrationRangeParent(start, end) {
|
|
221
|
+
if (activeHydration === void 0) return void 0;
|
|
222
|
+
const parent = start.parentNode;
|
|
223
|
+
if (parent === null || end.parentNode !== parent) throw mismatch("detached server marker range");
|
|
224
|
+
return parent;
|
|
293
225
|
}
|
|
294
226
|
function requireHydration() {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return activeHydration;
|
|
227
|
+
if (activeHydration === void 0) throw new Error("no Vidact hydration is active");
|
|
228
|
+
return activeHydration;
|
|
298
229
|
}
|
|
299
230
|
function cursor(state, parent) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return state.cursors.get(parent) ?? null;
|
|
231
|
+
if (!state.cursors.has(parent)) state.cursors.set(parent, parent.firstChild);
|
|
232
|
+
return state.cursors.get(parent) ?? null;
|
|
303
233
|
}
|
|
304
234
|
function enterHydrationSlot(state, parent) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
state.cursors.set(parent, start);
|
|
235
|
+
const slots = state.slots.get(parent) ?? [];
|
|
236
|
+
let start = cursor(state, parent);
|
|
237
|
+
while (isMarker(start, `${HYDRATION_PREFIX}:b`)) {
|
|
238
|
+
slots.push(findClosingSibling(start, `${HYDRATION_PREFIX}:b`));
|
|
239
|
+
start = start.nextSibling;
|
|
240
|
+
}
|
|
241
|
+
if (slots.length !== 0) state.slots.set(parent, slots);
|
|
242
|
+
state.cursors.set(parent, start);
|
|
314
243
|
}
|
|
315
244
|
function setHydrationCursor(state, parent, value) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
state.cursors.set(parent, next);
|
|
245
|
+
const slots = state.slots.get(parent);
|
|
246
|
+
let next = value;
|
|
247
|
+
if (slots !== void 0) for (;;) {
|
|
248
|
+
const end = slots.at(-1);
|
|
249
|
+
if (end !== next) break;
|
|
250
|
+
slots.pop();
|
|
251
|
+
next = end.nextSibling;
|
|
252
|
+
}
|
|
253
|
+
state.cursors.set(parent, next);
|
|
328
254
|
}
|
|
329
255
|
function mismatch(message) {
|
|
330
|
-
|
|
256
|
+
return new HydrationMismatch(message);
|
|
331
257
|
}
|
|
332
258
|
function markerValue(node) {
|
|
333
|
-
|
|
259
|
+
return node instanceof Comment ? node.data : void 0;
|
|
334
260
|
}
|
|
335
261
|
function isMarker(node, value) {
|
|
336
|
-
|
|
262
|
+
return markerValue(node) === value;
|
|
337
263
|
}
|
|
338
264
|
function findClosingSibling(start, kind) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
throw mismatch(`missing closing ${kind} marker`);
|
|
265
|
+
let depth = 0;
|
|
266
|
+
for (let node = start.nextSibling; node !== null; node = node.nextSibling) {
|
|
267
|
+
if (isMarker(node, kind)) {
|
|
268
|
+
depth += 1;
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (!isMarker(node, `/${kind}`)) continue;
|
|
272
|
+
if (depth === 0) return node;
|
|
273
|
+
depth -= 1;
|
|
274
|
+
}
|
|
275
|
+
throw mismatch(`missing closing ${kind} marker`);
|
|
352
276
|
}
|
|
353
277
|
function scanRanges(host) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
if (position & Node.DOCUMENT_POSITION_PRECEDING)
|
|
386
|
-
return 1;
|
|
387
|
-
return 0;
|
|
388
|
-
});
|
|
389
|
-
return { roots, components };
|
|
278
|
+
const roots = [];
|
|
279
|
+
const components = [];
|
|
280
|
+
const stacks = /* @__PURE__ */ new Map();
|
|
281
|
+
const walker = document.createTreeWalker(host, NodeFilter.SHOW_COMMENT);
|
|
282
|
+
for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) {
|
|
283
|
+
const comment = node;
|
|
284
|
+
const match = comment.data.match(/^\/?vidact:v1:([abchrst])$/);
|
|
285
|
+
if (match === null) continue;
|
|
286
|
+
const kind = match[1];
|
|
287
|
+
if (!comment.data.startsWith("/")) {
|
|
288
|
+
const stack = stacks.get(kind) ?? [];
|
|
289
|
+
stack.push(comment);
|
|
290
|
+
stacks.set(kind, stack);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
const start = stacks.get(kind)?.pop();
|
|
294
|
+
if (start === void 0) throw mismatch(`orphan closing vidact:v1:${kind} marker`);
|
|
295
|
+
if (kind === "r") roots.push([start, comment]);
|
|
296
|
+
if (kind === "c") components.push([start, comment]);
|
|
297
|
+
}
|
|
298
|
+
if ([...stacks.values()].some((stack) => stack.length !== 0)) throw mismatch("unclosed vidact:v1 hydration marker");
|
|
299
|
+
components.sort(([left], [right]) => {
|
|
300
|
+
const position = left.compareDocumentPosition(right);
|
|
301
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
|
|
302
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
|
|
303
|
+
return 0;
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
roots,
|
|
307
|
+
components
|
|
308
|
+
};
|
|
390
309
|
}
|
|
391
310
|
function collectPostorderElements(root) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
if (opaqueDepth !== 0)
|
|
428
|
-
throw mismatch('unbalanced vidact:v1 raw HTML marker range');
|
|
429
|
-
return elements;
|
|
311
|
+
const elements = [];
|
|
312
|
+
const visit = (element) => {
|
|
313
|
+
visitChildren(element);
|
|
314
|
+
elements.push(element);
|
|
315
|
+
};
|
|
316
|
+
const visitChildren = (parent) => {
|
|
317
|
+
let opaqueDepth = 0;
|
|
318
|
+
for (const child of parent.childNodes) {
|
|
319
|
+
if (isMarker(child, `${HYDRATION_PREFIX}:h`)) {
|
|
320
|
+
opaqueDepth += 1;
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (isMarker(child, `/${HYDRATION_PREFIX}:h`)) {
|
|
324
|
+
opaqueDepth -= 1;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (opaqueDepth === 0 && child instanceof Element) visit(child);
|
|
328
|
+
}
|
|
329
|
+
if (opaqueDepth !== 0) throw mismatch("unbalanced vidact:v1 raw HTML marker range");
|
|
330
|
+
};
|
|
331
|
+
let opaqueDepth = 0;
|
|
332
|
+
for (let node = root[0].nextSibling; node !== null && node !== root[1]; node = node.nextSibling) {
|
|
333
|
+
if (isMarker(node, `${HYDRATION_PREFIX}:h`)) {
|
|
334
|
+
opaqueDepth += 1;
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (isMarker(node, `/${HYDRATION_PREFIX}:h`)) {
|
|
338
|
+
opaqueDepth -= 1;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
if (opaqueDepth === 0 && node instanceof Element) visit(node);
|
|
342
|
+
}
|
|
343
|
+
if (opaqueDepth !== 0) throw mismatch("unbalanced vidact:v1 raw HTML marker range");
|
|
344
|
+
return elements;
|
|
430
345
|
}
|
|
431
346
|
function collectElementComponents(host) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return owners;
|
|
347
|
+
const owners = /* @__PURE__ */ new WeakMap();
|
|
348
|
+
const components = [];
|
|
349
|
+
const walker = document.createTreeWalker(host, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT);
|
|
350
|
+
for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) {
|
|
351
|
+
if (isMarker(node, `${HYDRATION_PREFIX}:c`)) {
|
|
352
|
+
components.push(node);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (isMarker(node, `/${HYDRATION_PREFIX}:c`)) {
|
|
356
|
+
components.pop();
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (node instanceof Element) {
|
|
360
|
+
const owner = components.at(-1);
|
|
361
|
+
if (owner !== void 0) owners.set(node, owner);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return owners;
|
|
451
365
|
}
|
|
452
366
|
function containsArrayMarker(element) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
367
|
+
const walker = document.createTreeWalker(element, NodeFilter.SHOW_COMMENT);
|
|
368
|
+
for (let node = walker.nextNode(); node !== null; node = walker.nextNode()) if (isMarker(node, `${HYDRATION_PREFIX}:a`)) return true;
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
function installHydration() {
|
|
372
|
+
installHydrationOperations({
|
|
373
|
+
begin: beginHydration,
|
|
374
|
+
finish: finishHydration,
|
|
375
|
+
rootMarkers: hydrationRootMarkers,
|
|
376
|
+
active: isHydrating,
|
|
377
|
+
createFragment: createHydrationFragment,
|
|
378
|
+
fragmentChildren: hydrationFragmentChildren,
|
|
379
|
+
claimElement: claimHydrationElement,
|
|
380
|
+
noteStructuralParent: noteHydrationStructuralParent,
|
|
381
|
+
claimComponentRange: claimHydrationComponentRange,
|
|
382
|
+
withComponentRange: withHydrationComponentRange,
|
|
383
|
+
withCursor: withHydrationCursor,
|
|
384
|
+
claimNode: claimHydrationNode,
|
|
385
|
+
claimComponentMount: claimHydrationComponentMount,
|
|
386
|
+
claimText: claimHydrationText,
|
|
387
|
+
claimTextRange: claimHydrationTextRange,
|
|
388
|
+
claimArrayRange: claimHydrationArrayRange,
|
|
389
|
+
finishArrayRange: finishHydrationArrayRange,
|
|
390
|
+
claimSlotRange: claimHydrationSlotRange,
|
|
391
|
+
borrowSlotRange: borrowHydrationSlotRange,
|
|
392
|
+
claimSuspenseFallback: claimHydrationSuspenseFallback,
|
|
393
|
+
withoutHydration,
|
|
394
|
+
withInsertion: withHydrationInsertion,
|
|
395
|
+
insertionPoint: hydrationInsertionPoint,
|
|
396
|
+
cursor: hydrationCursor,
|
|
397
|
+
rangeParent: hydrationRangeParent
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
export { beginHydration, borrowHydrationSlotRange, claimHydrationArrayRange, claimHydrationComponentMount, claimHydrationComponentRange, claimHydrationElement, claimHydrationNode, claimHydrationSlotRange, claimHydrationSuspenseFallback, claimHydrationText, claimHydrationTextRange, createHydrationFragment, finishHydration, finishHydrationArrayRange, hydrationCursor, hydrationFragmentChildren, hydrationInsertionPoint, hydrationRangeParent, hydrationRootMarkers, installHydration, isHydrating, isHydrationMismatch, noteHydrationStructuralParent, withHydrationComponentRange, withHydrationCursor, withHydrationInsertion, withoutHydration };
|
|
402
|
+
|
|
489
403
|
//# sourceMappingURL=hydration.js.map
|