revojs 0.0.40 → 0.0.41
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/dist/index.js +19 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -275,22 +275,25 @@ const hydrate = async (scope, parentNode, slot, index, previous) => {
|
|
|
275
275
|
if (items.length) hydration = items;
|
|
276
276
|
else if (previous || !(hydration instanceof Comment)) hydration = document.createComment("");
|
|
277
277
|
}
|
|
278
|
-
if (typeof slot === "function")
|
|
279
|
-
let
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
278
|
+
if (typeof slot === "function") {
|
|
279
|
+
let previous$1;
|
|
280
|
+
await createCompute(scope, async (scope$1) => {
|
|
281
|
+
let input = slot;
|
|
282
|
+
while (typeof input === "function") input = await input();
|
|
283
|
+
hydration = await hydrate(scope$1, parentNode, input, index, previous$1);
|
|
284
|
+
if (previous$1 && hydration !== previous$1) if (Array.isArray(hydration)) if (Array.isArray(previous$1)) {
|
|
285
|
+
const range = toRange(previous$1);
|
|
286
|
+
range.deleteContents();
|
|
287
|
+
for (const childNode of toArray(hydration)) range.insertNode(childNode);
|
|
288
|
+
} else parentNode.replaceChild(toFragment(hydration), previous$1);
|
|
289
|
+
else if (Array.isArray(previous$1)) {
|
|
290
|
+
const range = toRange(previous$1);
|
|
291
|
+
range.deleteContents();
|
|
292
|
+
range.insertNode(hydration);
|
|
293
|
+
} else parentNode.replaceChild(hydration, previous$1);
|
|
294
|
+
previous$1 = hydration;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
294
297
|
if ((slot === null || slot === void 0) && (previous || !(hydration instanceof Comment))) hydration = document.createComment("");
|
|
295
298
|
if (typeof slot === "number" || typeof slot === "bigint" || typeof slot === "boolean" || typeof slot === "string" || typeof slot === "symbol") {
|
|
296
299
|
const textContent = slot.toString();
|