essor 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.
@@ -1,12 +1,12 @@
1
1
  /**
2
- * essor v0.0.17-beta.3
3
- * build time 2026-06-13T06:38:24.171Z
2
+ * essor v0.0.17-beta.4
3
+ * build time 2026-06-16T06:43:56.275Z
4
4
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
5
5
  * @license MIT
6
6
  **/
7
7
 
8
8
  // src/version.ts
9
- var __version = "0.0.17-beta.3";
9
+ var __version = "0.0.17-beta.4";
10
10
 
11
11
  // ../shared/dist/shared.dev.js
12
12
  var isObject = (val) => val !== null && typeof val === "object";
@@ -2853,23 +2853,31 @@ function resolveHydrationKey(parent) {
2853
2853
  const el = parent;
2854
2854
  return (_c = (_b2 = el.dataset.hk) != null ? _b2 : (_a22 = parent.closest("[data-hk]")) == null ? void 0 : _a22.dataset.hk) != null ? _c : null;
2855
2855
  }
2856
+ function expectedHydrationSlot(parent, index) {
2857
+ if (_isHydrating && parent) {
2858
+ const key = resolveHydrationKey(parent);
2859
+ if (key) return `${key}-${index}`;
2860
+ }
2861
+ return String(index);
2862
+ }
2856
2863
  function hydrationMarker(parent, index) {
2857
- if (!_isHydrating || !parent || index < 0) return null;
2858
- const key = parent instanceof Element ? resolveHydrationKey(parent) : null;
2859
- const expected = key ? `${key}-${index}` : String(index);
2864
+ if (!parent || index < 0) return null;
2865
+ const expected = expectedHydrationSlot(parent instanceof Element ? parent : null, index);
2866
+ let fallbackIndex = 0;
2860
2867
  let cursor = parent.firstChild;
2861
2868
  while (cursor) {
2862
- if (cursor.nodeType === Node.COMMENT_NODE && cursor.data === expected) {
2863
- return cursor;
2869
+ if (cursor.nodeType === Node.COMMENT_NODE) {
2870
+ const comment = cursor;
2871
+ if (comment.data === expected) return comment;
2872
+ if (!_isHydrating && comment.data === "" && fallbackIndex++ === index) return comment;
2864
2873
  }
2865
2874
  cursor = cursor.nextSibling;
2866
2875
  }
2867
2876
  return null;
2868
2877
  }
2869
2878
  function hydrationAnchor(parent, index) {
2870
- if (!_isHydrating || !(parent instanceof Element) || index < 0) return null;
2871
- const key = resolveHydrationKey(parent);
2872
- const expected = key ? `${key}-${index}` : String(index);
2879
+ if (!(parent instanceof Element) || index < 0) return null;
2880
+ const expected = expectedHydrationSlot(parent, index);
2873
2881
  let cursor = parent.firstChild;
2874
2882
  while (cursor) {
2875
2883
  if (cursor instanceof Element && cursor.getAttribute(HYDRATION_ANCHOR_ATTR) === expected) {