@estjs/template 0.0.17-beta.3 → 0.0.17-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/dist/template.cjs +2 -2
- package/dist/template.dev.cjs +16 -8
- package/dist/template.dev.cjs.map +1 -1
- package/dist/template.dev.js +16 -8
- package/dist/template.dev.js.map +1 -1
- package/dist/template.js +2 -2
- package/package.json +4 -4
package/dist/template.dev.js
CHANGED
|
@@ -369,23 +369,31 @@ function resolveHydrationKey(parent) {
|
|
|
369
369
|
const el = parent;
|
|
370
370
|
return (_c = (_b = el.dataset.hk) != null ? _b : (_a2 = parent.closest("[data-hk]")) == null ? void 0 : _a2.dataset.hk) != null ? _c : null;
|
|
371
371
|
}
|
|
372
|
+
function expectedHydrationSlot(parent, index) {
|
|
373
|
+
if (_isHydrating && parent) {
|
|
374
|
+
const key = resolveHydrationKey(parent);
|
|
375
|
+
if (key) return `${key}-${index}`;
|
|
376
|
+
}
|
|
377
|
+
return String(index);
|
|
378
|
+
}
|
|
372
379
|
function hydrationMarker(parent, index) {
|
|
373
|
-
if (!
|
|
374
|
-
const
|
|
375
|
-
|
|
380
|
+
if (!parent || index < 0) return null;
|
|
381
|
+
const expected = expectedHydrationSlot(parent instanceof Element ? parent : null, index);
|
|
382
|
+
let fallbackIndex = 0;
|
|
376
383
|
let cursor = parent.firstChild;
|
|
377
384
|
while (cursor) {
|
|
378
|
-
if (cursor.nodeType === Node.COMMENT_NODE
|
|
379
|
-
|
|
385
|
+
if (cursor.nodeType === Node.COMMENT_NODE) {
|
|
386
|
+
const comment = cursor;
|
|
387
|
+
if (comment.data === expected) return comment;
|
|
388
|
+
if (!_isHydrating && comment.data === "" && fallbackIndex++ === index) return comment;
|
|
380
389
|
}
|
|
381
390
|
cursor = cursor.nextSibling;
|
|
382
391
|
}
|
|
383
392
|
return null;
|
|
384
393
|
}
|
|
385
394
|
function hydrationAnchor(parent, index) {
|
|
386
|
-
if (!
|
|
387
|
-
const
|
|
388
|
-
const expected = key ? `${key}-${index}` : String(index);
|
|
395
|
+
if (!(parent instanceof Element) || index < 0) return null;
|
|
396
|
+
const expected = expectedHydrationSlot(parent, index);
|
|
389
397
|
let cursor = parent.firstChild;
|
|
390
398
|
while (cursor) {
|
|
391
399
|
if (cursor instanceof Element && cursor.getAttribute(HYDRATION_ANCHOR_ATTR) === expected) {
|