@estjs/template 0.0.17-beta.2 → 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,4 +1,4 @@
1
- import { getActiveScope, runWithScope, onCleanup, __objRest, createScope, disposeScope, __async } from './chunk-R6JICOKI.dev.js';
1
+ import { getActiveScope, runWithScope, onCleanup, __objRest, createScope, disposeScope, __async } from './chunk-PYFF2HI3.dev.js';
2
2
  import { normalizeClassName, SPREAD_NAME, isObject, warn, startsWith, isSpecialBooleanAttr, isBooleanAttr, includeBooleanAttr, isSymbol, isString, isArray, kebabCase, camelCase, capitalize, HYDRATION_ANCHOR_ATTR, isBrowser, error, isPromise, isFunction, isOn, coerceArray } from '@estjs/shared';
3
3
  import { effect, shallowReactive, isSignal, isComputed, isReactive, signal } from '@estjs/signals';
4
4
 
@@ -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 (!_isHydrating || !parent || index < 0) return null;
374
- const key = parent instanceof Element ? resolveHydrationKey(parent) : null;
375
- const expected = key ? `${key}-${index}` : String(index);
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 && cursor.data === expected) {
379
- return cursor;
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 (!_isHydrating || !(parent instanceof Element) || index < 0) return null;
387
- const key = resolveHydrationKey(parent);
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) {
@@ -930,6 +938,7 @@ var Component = class {
930
938
  for (const key of Object.getOwnPropertyNames(this.reactiveProps)) {
931
939
  delete this.reactiveProps[key];
932
940
  }
941
+ this.state = 0 /* INITIAL */;
933
942
  }
934
943
  /**
935
944
  * Apply props that bind to the root DOM element rather than flowing into
@@ -1067,8 +1076,8 @@ function createApp(component, target) {
1067
1076
  return {
1068
1077
  root: rootNode,
1069
1078
  unmount: () => {
1070
- disposeScope(scope);
1071
1079
  rootNode == null ? void 0 : rootNode.destroy();
1080
+ disposeScope(scope);
1072
1081
  }
1073
1082
  };
1074
1083
  }
@@ -1100,8 +1109,8 @@ function hydrate(component, target) {
1100
1109
  return {
1101
1110
  root: rootNode,
1102
1111
  unmount: () => {
1103
- disposeScope(scope);
1104
1112
  rootNode == null ? void 0 : rootNode.destroy();
1113
+ disposeScope(scope);
1105
1114
  }
1106
1115
  };
1107
1116
  }
@@ -1815,6 +1824,7 @@ function defineClientAsyncComponent(loader, options) {
1815
1824
  };
1816
1825
  const render = (fn, fnProps) => {
1817
1826
  if (!alive) return;
1827
+ if (owner && owner.isDestroyed) return;
1818
1828
  if (viewScope) {
1819
1829
  disposeScope(viewScope);
1820
1830
  viewScope = null;
@@ -1930,9 +1940,7 @@ function For(props) {
1930
1940
  };
1931
1941
  const clearFallback = () => {
1932
1942
  for (const node of fallbackNodes) {
1933
- if (node.parentNode) {
1934
- node.parentNode.removeChild(node);
1935
- }
1943
+ removeNode(node);
1936
1944
  }
1937
1945
  fallbackNodes = [];
1938
1946
  };