@vue/runtime-core 3.6.0-rc.13 → 3.6.0-rc.15

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,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-rc.13
2
+ * @vue/runtime-core v3.6.0-rc.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -104,7 +104,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
104
104
  if ((0, _vue_shared.isFunction)(fn)) {
105
105
  const res = callWithErrorHandling(fn, instance, type, args);
106
106
  if (res && (0, _vue_shared.isPromise)(res)) res.catch((err) => {
107
- handleError(err, instance, type);
107
+ handleError(err, instance, type, void 0, true);
108
108
  });
109
109
  return res;
110
110
  }
@@ -114,7 +114,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
114
114
  return values;
115
115
  }
116
116
  }
117
- function handleError(err, instance, type, throwInDev = true) {
117
+ function handleError(err, instance, type, throwInDev = true, isAsyncError = false) {
118
118
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || _vue_shared.EMPTY_OBJ;
119
119
  if (instance) {
120
120
  let cur = instance.parent;
@@ -122,7 +122,7 @@ function handleError(err, instance, type, throwInDev = true) {
122
122
  const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
123
123
  while (cur) {
124
124
  const errorCapturedHooks = cur.ec;
125
- if (errorCapturedHooks) {
125
+ if (errorCapturedHooks && !cur.isUnmounted && (!isAsyncError || cur.scope.active)) {
126
126
  for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;
127
127
  }
128
128
  cur = cur.parent;
@@ -411,18 +411,35 @@ function withDirectives(vnode, directives) {
411
411
  return vnode;
412
412
  }
413
413
  function invokeDirectiveHook(vnode, prevVNode, instance, name) {
414
- const bindings = vnode.dirs;
414
+ let hookVNode = vnode;
415
+ if (name === "beforeMount") vnode._mount = vnode;
416
+ else if (name === "beforeUpdate") {
417
+ const mount = prevVNode && prevVNode._mount;
418
+ if (mount) {
419
+ mount._latest = vnode;
420
+ vnode._mount = mount;
421
+ }
422
+ } else if (name === "mounted") {
423
+ const latest = vnode._latest;
424
+ vnode._mount = vnode._latest = void 0;
425
+ if (latest) {
426
+ hookVNode = latest;
427
+ latest._mount = void 0;
428
+ }
429
+ }
430
+ const bindings = hookVNode.dirs;
415
431
  const oldBindings = prevVNode && prevVNode.dirs;
416
432
  for (let i = 0; i < bindings.length; i++) {
417
- const binding = bindings[i];
433
+ let binding = bindings[i];
418
434
  if (oldBindings) binding.oldValue = oldBindings[i].value;
435
+ else if (name === "mounted" && binding.oldValue !== void 0) binding = (0, _vue_shared.extend)({}, binding, { oldValue: void 0 });
419
436
  let hook = binding.dir[name];
420
437
  if (hook) {
421
438
  const prevSub = (0, _vue_reactivity.setActiveSub)();
422
439
  callWithAsyncErrorHandling(hook, instance, 8, [
423
440
  vnode.el,
424
441
  binding,
425
- vnode,
442
+ hookVNode,
426
443
  prevVNode
427
444
  ]);
428
445
  (0, _vue_reactivity.setActiveSub)(prevSub);
@@ -842,7 +859,15 @@ const BaseTransitionImpl = {
842
859
  const rawProps = (0, _vue_reactivity.toRaw)(props);
843
860
  const { mode } = rawProps;
844
861
  return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
845
- if (!(instance.effect.flags & 1024)) instance.update();
862
+ if (!(instance.effect.flags & 1024)) {
863
+ if (instance.effect.running) {
864
+ const job = () => {
865
+ if (!(instance.effect.flags & 1024)) instance.update();
866
+ };
867
+ job.i = instance;
868
+ queueJob(job);
869
+ } else instance.update();
870
+ }
846
871
  }) : _vue_shared.NOOP);
847
872
  };
848
873
  }
@@ -867,7 +892,7 @@ function getLeavingNodesForType(state, vnode) {
867
892
  }
868
893
  return leavingVNodesCache;
869
894
  }
870
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
895
+ function resolveTransitionHooks(vnode, props, state, instance) {
871
896
  const key = String(vnode.key);
872
897
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
873
898
  const hooks = baseResolveTransitionHooks({
@@ -890,9 +915,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
890
915
  }
891
916
  },
892
917
  cloneHooks: (vnode) => {
893
- const hooks = resolveTransitionHooks(vnode, props, state, instance, postClone);
894
- if (postClone) postClone(hooks);
895
- return hooks;
918
+ return resolveTransitionHooks(vnode, props, state, instance);
896
919
  }
897
920
  }, props, state, instance);
898
921
  if (isVaporInteropEnabled && vnode.type === VaporSlot) (0, _vue_shared.extend)(hooks, {
@@ -930,7 +953,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
930
953
  callHook(hook, [el]);
931
954
  },
932
955
  enter(el) {
933
- if (isLeaving()) return;
956
+ if (isLeaving(el)) return;
934
957
  let hook = onEnter;
935
958
  let afterHook = onAfterEnter;
936
959
  let cancelHook = onEnterCancelled;
@@ -974,7 +997,19 @@ function baseResolveTransitionHooks(context, props, state, instance) {
974
997
  else done();
975
998
  },
976
999
  clone(node) {
977
- return cloneHooks ? cloneHooks(node) : hooks;
1000
+ if (!cloneHooks) return hooks;
1001
+ const cloned = cloneHooks(node);
1002
+ cloned.afterLeave = () => {
1003
+ if (hooks.afterLeave) hooks.afterLeave();
1004
+ };
1005
+ cloned.delayLeave = (el, earlyRemove, delayedLeave) => {
1006
+ if (hooks.delayLeave) hooks.delayLeave(el, earlyRemove, delayedLeave);
1007
+ else delayedLeave();
1008
+ };
1009
+ cloned.delayedLeave = () => {
1010
+ if (hooks.delayedLeave) hooks.delayedLeave();
1011
+ };
1012
+ return cloned;
978
1013
  }
979
1014
  };
980
1015
  return hooks;
@@ -1009,10 +1044,7 @@ function prepareTransitionSwitch(previous, next, props, state, instance, resumeA
1009
1044
  if (state.isLeaving) return emptyPlaceholder(next);
1010
1045
  const nextInner = getInnerChild$1(next);
1011
1046
  if (!nextInner) return emptyPlaceholder(next);
1012
- let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
1013
- if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
1014
- enterHooks = hooks;
1015
- });
1047
+ const enterHooks = resolveTransitionHooks(nextInner, props, state, instance);
1016
1048
  if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
1017
1049
  if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
1018
1050
  const mode = props.mode;
@@ -1078,9 +1110,14 @@ function setTransitionHooks(vnode, hooks) {
1078
1110
  return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
1079
1111
  }
1080
1112
  } else if (vnode.shapeFlag & 128) {
1081
- const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1082
- const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1083
- return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
1113
+ const suspense = vnode.suspense;
1114
+ if (suspense) {
1115
+ const branch = suspense.isHydrating ? suspense.pendingBranch : suspense.activeBranch;
1116
+ if (branch) return setTransitionHooks(branch, hooks.clone(branch));
1117
+ } else {
1118
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1119
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1120
+ }
1084
1121
  } else {
1085
1122
  vnode.transition = hooks;
1086
1123
  if (vnode.type === Fragment && (0, _vue_shared.isArray)(vnode.children)) {
@@ -1280,6 +1317,8 @@ const getContainerType = (container) => {
1280
1317
  if (isMathMLContainer(container)) return "mathml";
1281
1318
  };
1282
1319
  const isComment = (node) => node.nodeType === 8;
1320
+ /** The data of a comment opening a range a hydration steps over as one. */
1321
+ const isRangeStart = (data) => data === "[" || data === "(" || (0, _vue_shared.isVaporRangeStart)(data);
1283
1322
  function createHydrationFunctions(rendererInternals) {
1284
1323
  const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
1285
1324
  const hydrate = (vnode, container) => {
@@ -1296,7 +1335,7 @@ function createHydrationFunctions(rendererInternals) {
1296
1335
  };
1297
1336
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1298
1337
  optimized = optimized || !!vnode.dynamicChildren;
1299
- const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(");
1338
+ const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && (0, _vue_shared.isVaporRangeStart)(node.data));
1300
1339
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
1301
1340
  const { type, ref, shapeFlag, patchFlag } = vnode;
1302
1341
  let domType = node.nodeType;
@@ -1473,10 +1512,11 @@ function createHydrationFunctions(rendererInternals) {
1473
1512
  const container = parentNode(node);
1474
1513
  const first = nextSibling(node);
1475
1514
  const next = isVaporInteropEnabled && vnode.vo && node.data === "(" ? getVaporInterface(parentComponent, vnode).hydrateSlotOutlet(vnode, node, parentComponent, parentSuspense, slotScopeIds) : hydrateChildren(first, vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
1476
- if (next && isComment(next) && next.data === (node.data === "(" ? ")" : "]")) return nextSibling(vnode.anchor = next);
1515
+ const close = isVaporInteropEnabled ? (0, _vue_shared.rangeCloseOf)(node.data) : node.data === "(" ? ")" : "]";
1516
+ if (next && isComment(next) && next.data === close) return nextSibling(vnode.anchor = next);
1477
1517
  else {
1478
1518
  logMismatchError();
1479
- insert(vnode.anchor = createComment(`]`), container, next);
1519
+ insert(vnode.anchor = createComment(close), container, next);
1480
1520
  return next;
1481
1521
  }
1482
1522
  };
@@ -1495,18 +1535,18 @@ function createHydrationFunctions(rendererInternals) {
1495
1535
  const container = parentNode(node);
1496
1536
  remove(node);
1497
1537
  patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1498
- if (parentComponent && parentComponent.vnode) {
1538
+ if (parentComponent && parentComponent.vnode && parentComponent.vnode.el === node) {
1499
1539
  parentComponent.vnode.el = vnode.el;
1500
1540
  updateHOCHostEl(parentComponent, vnode.el);
1501
1541
  }
1502
1542
  return next;
1503
1543
  };
1504
- const locateClosingAnchor = (node, open = node && isComment(node) && node.data === "(" ? "(" : "[", close = open === "(" ? ")" : "]") => {
1544
+ const locateClosingAnchor = (node, open = node && isComment(node) && (node.data === "(" || isVaporInteropEnabled && node.data === "{") ? node.data : "[", close = isVaporInteropEnabled ? (0, _vue_shared.rangeCloseOf)(open) : open === "(" ? ")" : "]") => {
1505
1545
  let match = 0;
1506
1546
  while (node) {
1507
1547
  node = nextSibling(node);
1508
1548
  if (node && isComment(node)) {
1509
- if (node.data === open) match++;
1549
+ if (node.data === open || isVaporInteropEnabled && open === "[" && (0, _vue_shared.isVaporBranchStart)(node.data)) match++;
1510
1550
  if (node.data === close) {
1511
1551
  if (match === 0) return nextSibling(node);
1512
1552
  else match--;
@@ -1649,9 +1689,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
1649
1689
  return teardown;
1650
1690
  };
1651
1691
  function forEachElement(node, cb) {
1652
- if (isComment(node) && (node.data === "[" || node.data === "(")) {
1692
+ if (isComment(node) && isRangeStart(node.data)) {
1653
1693
  const open = node.data;
1654
- const close = open === "[" ? "]" : ")";
1694
+ const close = (0, _vue_shared.rangeCloseOf)(open);
1655
1695
  let depth = 1;
1656
1696
  let next = node.nextSibling;
1657
1697
  while (next) {
@@ -1660,7 +1700,7 @@ function forEachElement(node, cb) {
1660
1700
  } else if (isComment(next)) {
1661
1701
  if (next.data === close) {
1662
1702
  if (--depth === 0) break;
1663
- } else if (next.data === open) depth++;
1703
+ } else if (close === "]" ? next.data === "[" || (0, _vue_shared.isVaporBranchStart)(next.data) : next.data === open) depth++;
1664
1704
  }
1665
1705
  next = next.nextSibling;
1666
1706
  }
@@ -1688,7 +1728,7 @@ function defineAsyncComponent(source) {
1688
1728
  if (resolvedComp) return () => createInnerComp(resolvedComp, instance);
1689
1729
  const onError = (err) => {
1690
1730
  setPendingRequest(null);
1691
- handleError(err, instance, 13, !errorComponent);
1731
+ handleError(err, instance, 13, !errorComponent, true);
1692
1732
  };
1693
1733
  if (suspensible && instance.suspense || isInSSRComponentSetup) return load().then((comp) => {
1694
1734
  return () => createInnerComp(comp, instance);
@@ -1767,10 +1807,12 @@ const useAsyncComponentState = (delay = 200, timeout, onError, instance = curren
1767
1807
  const delayed = (0, _vue_reactivity.ref)(!!delay);
1768
1808
  let timeoutTimer;
1769
1809
  let delayTimer;
1770
- if (instance) onUnmounted(() => {
1771
- if (timeoutTimer != null) clearTimeout(timeoutTimer);
1772
- if (delayTimer != null) clearTimeout(delayTimer);
1773
- }, instance);
1810
+ if (instance) instance.scope.run(() => {
1811
+ (0, _vue_reactivity.onScopeDispose)(() => {
1812
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
1813
+ if (delayTimer != null) clearTimeout(delayTimer);
1814
+ });
1815
+ });
1774
1816
  if (delay) delayTimer = setTimeout(() => {
1775
1817
  if (instance && instance.isUnmounted) return;
1776
1818
  delayed.value = false;
@@ -1799,7 +1841,12 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
1799
1841
  if (skipIfUpdated) (instance.bu || (instance.bu = [])).push(() => patched = true);
1800
1842
  const performHydrate = () => {
1801
1843
  if (patched) return;
1802
- if (!el.parentNode || wasConnected && !el.isConnected) return;
1844
+ if (!el.parentNode) return;
1845
+ if (wasConnected && !el.isConnected) {
1846
+ let current = instance;
1847
+ while (current && !current.isDeactivated) current = current.parent;
1848
+ if (!current) return;
1849
+ }
1803
1850
  hydrate();
1804
1851
  };
1805
1852
  const doHydrate = hydrateStrategy ? () => {
@@ -1856,7 +1903,11 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
1856
1903
  activate(vnode, container, anchor, renderer, keepAliveInstance, parentSuspense, namespace, optimized);
1857
1904
  };
1858
1905
  sharedContext.deactivate = (vnode) => {
1859
- deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
1906
+ const cached = sharedContext.getCachedComponent(vnode);
1907
+ if (!cached || cached.component !== vnode.component) return false;
1908
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(keepAliveInstance, vnode).deactivate(vnode, storageContainer, parentSuspense);
1909
+ else deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
1910
+ return true;
1860
1911
  };
1861
1912
  function unmount(vnode) {
1862
1913
  resetShapeFlag(vnode);
@@ -1888,11 +1939,15 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
1888
1939
  let pendingCacheKey = null;
1889
1940
  const cacheSubtree = () => {
1890
1941
  if (pendingCacheKey != null) {
1891
- if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
1892
- const vnode = getInnerChild(keepAliveInstance.subTree);
1893
- if (vnode.component) cache.set(pendingCacheKey, vnode);
1894
- }, void 0, keepAliveInstance.subTree.suspense);
1895
- else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
1942
+ if (isSuspense(keepAliveInstance.subTree.type)) {
1943
+ const cacheInnerChild = () => {
1944
+ const vnode = getInnerChild(keepAliveInstance.subTree);
1945
+ if (vnode.component) cache.set(pendingCacheKey, vnode);
1946
+ };
1947
+ const suspense = keepAliveInstance.subTree.suspense;
1948
+ if (suspense.pendingBranch) queuePostRenderEffect(cacheInnerChild, void 0, suspense);
1949
+ else cacheInnerChild();
1950
+ } else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
1896
1951
  }
1897
1952
  };
1898
1953
  onMounted(cacheSubtree);
@@ -1996,9 +2051,8 @@ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance())
1996
2051
  }
1997
2052
  function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
1998
2053
  const injected = injectHook(type, hook, keepAliveRoot, true);
1999
- onUnmounted(() => {
2000
- (0, _vue_shared.remove)(keepAliveRoot[type], injected);
2001
- }, target);
2054
+ const removal = injectHook("um", () => (0, _vue_shared.remove)(keepAliveRoot[type], injected), target);
2055
+ removal.flags = 8;
2002
2056
  }
2003
2057
  function resetShapeFlag(vnode) {
2004
2058
  vnode.shapeFlag &= -257;
@@ -2215,6 +2269,11 @@ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
2215
2269
  ret.props = (0, _vue_shared.extend)({}, ret.props, { key: branchKey });
2216
2270
  ret.key = branchKey;
2217
2271
  }
2272
+ if (isBlockTreeEnabled <= 0) {
2273
+ if (!ret.vs.props) ret.vs.props = ret.props;
2274
+ ret.props = ret.key != null ? { key: ret.key } : null;
2275
+ ret.vs.attrs = _vue_shared.EMPTY_OBJ;
2276
+ }
2218
2277
  if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2219
2278
  return ret;
2220
2279
  }
@@ -3553,8 +3612,10 @@ function baseCreateRenderer(options, createHydrationFns) {
3553
3612
  if (vnodeHook = props.onVnodeBeforeMount) invokeVNodeHook(vnodeHook, parentComponent, vnode);
3554
3613
  }
3555
3614
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3556
- if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
3557
- else hostInsert(el, container, anchor);
3615
+ if (transition) {
3616
+ if (!needTransition(parentSuspense, transition) && !transition.persisted) el[deferredEnterKey] = true;
3617
+ performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
3618
+ } else hostInsert(el, container, anchor);
3558
3619
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
3559
3620
  try {
3560
3621
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -3773,16 +3834,20 @@ function baseCreateRenderer(options, createHydrationFns) {
3773
3834
  } else {
3774
3835
  let { next, bu, u, parent, vnode } = instance;
3775
3836
  {
3776
- const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
3777
- if (nonHydratedAsyncRoot) {
3837
+ const unresolvedAsyncRoot = locateUnresolvedAsyncRoot(instance);
3838
+ if (unresolvedAsyncRoot) {
3778
3839
  if (next) {
3779
3840
  next.el = vnode.el;
3780
3841
  updateComponentPreRender(instance, next, optimized);
3781
3842
  }
3782
- nonHydratedAsyncRoot.asyncDep.then(() => {
3783
- queuePostRenderEffect(() => {
3784
- if (!instance.isUnmounted) instance.update();
3785
- }, void 0, parentSuspense);
3843
+ unresolvedAsyncRoot.asyncDep.then(() => {
3844
+ const retry = () => {
3845
+ if (instance.effect.flags & 1024) return;
3846
+ if (parentSuspense && parentSuspense.pendingBranch) queuePostRenderEffect(retry, void 0, parentSuspense);
3847
+ else instance.update();
3848
+ };
3849
+ retry.flags = 24;
3850
+ queuePostRenderEffect(retry, void 0, parentSuspense);
3786
3851
  });
3787
3852
  return;
3788
3853
  }
@@ -3801,7 +3866,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3801
3866
  const nextTree = renderComponentRoot(instance);
3802
3867
  const prevTree = instance.subTree;
3803
3868
  instance.subTree = nextTree;
3804
- patch(prevTree, nextTree, hostParentNode(prevTree.el), getNextHostNode(prevTree), instance, parentSuspense, namespace);
3869
+ patch(prevTree, nextTree, hostParentNode(prevTree.el || resolveAsyncComponentPlaceholder(prevTree)), getNextHostNode(prevTree), instance, parentSuspense, namespace);
3805
3870
  next.el = nextTree.el;
3806
3871
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
3807
3872
  if (u) queuePostRenderEffect(u, void 0, parentSuspense);
@@ -3998,9 +4063,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3998
4063
  }
3999
4064
  if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
4000
4065
  if (shapeFlag & 256) {
4001
- if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
4002
- else parentComponent.ctx.deactivate(vnode);
4003
- return;
4066
+ if (parentComponent.ctx.deactivate(vnode)) return;
4004
4067
  }
4005
4068
  if (isVaporInteropEnabled && shapeFlag & 6 && isVaporComponent(type)) {
4006
4069
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
@@ -4079,12 +4142,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4079
4142
  if (effect) {
4080
4143
  effect.stop();
4081
4144
  unmount(subTree, instance, parentSuspense, doRemove);
4082
- } else if (instance.vnode.el && subTree) {
4145
+ } else if (subTree) {
4083
4146
  subTree.transition = instance.vnode.transition;
4084
4147
  unmount(subTree, instance, parentSuspense, doRemove);
4085
4148
  }
4086
4149
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4087
- queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4150
+ const markUnmounted = () => instance.isUnmounted = true;
4151
+ markUnmounted.flags = 8;
4152
+ queuePostRenderEffect(markUnmounted, void 0, parentSuspense);
4088
4153
  };
4089
4154
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
4090
4155
  for (let i = start; i < children.length; i++) unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
@@ -4191,11 +4256,11 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4191
4256
  if (c2.type === Comment && !c2.el) c2.el = c1.el;
4192
4257
  }
4193
4258
  }
4194
- function locateNonHydratedAsyncRoot(instance) {
4259
+ function locateUnresolvedAsyncRoot(instance) {
4195
4260
  const subComponent = instance.subTree && instance.subTree.component;
4196
4261
  if (subComponent) {
4197
4262
  if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
4198
- else return locateNonHydratedAsyncRoot(subComponent);
4263
+ else return locateUnresolvedAsyncRoot(subComponent);
4199
4264
  }
4200
4265
  }
4201
4266
  function invalidateMount(hooks) {
@@ -4261,7 +4326,9 @@ function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true
4261
4326
  function resolveAsyncComponentPlaceholder(anchorVnode) {
4262
4327
  if (anchorVnode.placeholder) return anchorVnode.placeholder;
4263
4328
  const instance = anchorVnode.component;
4264
- if (instance) return resolveAsyncComponentPlaceholder(instance.subTree);
4329
+ if (instance && instance.subTree) return resolveAsyncComponentPlaceholder(instance.subTree);
4330
+ const suspense = anchorVnode.suspense;
4331
+ if (suspense && suspense.activeBranch) return resolveAsyncComponentPlaceholder(suspense.activeBranch);
4265
4332
  return null;
4266
4333
  }
4267
4334
  //#endregion
@@ -4273,17 +4340,22 @@ function withSuspenseEnabled(value) {
4273
4340
  return value;
4274
4341
  }
4275
4342
  let suspenseId = 0;
4343
+ const deferredEnterKey = Symbol("_deferredEnter");
4276
4344
  const Suspense = /*@__PURE__*/ withSuspenseEnabled({
4277
4345
  name: "Suspense",
4278
4346
  __isSuspense: true,
4279
4347
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
4280
4348
  if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
4281
4349
  else {
4282
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
4283
- n2.suspense = n1.suspense;
4284
- n2.suspense.vnode = n2;
4285
- n2.el = n1.el;
4286
- return;
4350
+ const suspense = n1.suspense;
4351
+ if (parentSuspense && parentSuspense.deps > 0 && !parentSuspense.isHydrating) {
4352
+ const owner = suspense.parentComponent;
4353
+ if (!!owner && owner.suspense === parentSuspense && owner.suspenseId !== parentSuspense.pendingId ? parentSuspense.pendingBranch && !isSameVNodeType(n2.ssContent, suspense.pendingBranch || suspense.activeBranch) : !suspense.isInFallback) {
4354
+ n2.suspense = suspense;
4355
+ suspense.vnode = n2;
4356
+ n2.el = n1.el;
4357
+ return;
4358
+ }
4287
4359
  }
4288
4360
  patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, rendererInternals);
4289
4361
  }
@@ -4295,6 +4367,36 @@ function triggerEvent(vnode, name) {
4295
4367
  const eventListener = vnode.props && vnode.props[name];
4296
4368
  if ((0, _vue_shared.isFunction)(eventListener)) eventListener();
4297
4369
  }
4370
+ function enterDeferred(suspense, branch) {
4371
+ const enters = [];
4372
+ collectDeferredEnters(branch, enters, true);
4373
+ if (isVaporInteropEnabled) {
4374
+ const { parentComponent } = suspense;
4375
+ const vapor = parentComponent && parentComponent.appContext.vapor;
4376
+ if (vapor) vapor.enterDeferred(suspense, enters);
4377
+ }
4378
+ if (enters.length) queuePostFlushCb(enters);
4379
+ }
4380
+ function collectDeferredEnters(vnode, enters, isRoot) {
4381
+ const { el, transition, children, shapeFlag } = vnode;
4382
+ if (shapeFlag & 6) {
4383
+ const subTree = vnode.component.subTree;
4384
+ if (subTree) collectDeferredEnters(subTree, enters, isRoot);
4385
+ return;
4386
+ }
4387
+ if (shapeFlag & 192) return;
4388
+ if (shapeFlag & 1) {
4389
+ if (!isRoot && el && el[deferredEnterKey]) {
4390
+ el[deferredEnterKey] = void 0;
4391
+ if (transition && !transition.persisted) {
4392
+ transition.beforeEnter(el);
4393
+ enters.push(() => transition.enter(el));
4394
+ }
4395
+ }
4396
+ isRoot = false;
4397
+ }
4398
+ if (shapeFlag & 16) for (let i = 0; i < children.length; i++) collectDeferredEnters(children[i], enters, isRoot);
4399
+ }
4298
4400
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
4299
4401
  const { p: patch, o: { createElement } } = rendererInternals;
4300
4402
  const hiddenContainer = createElement("div");
@@ -4334,11 +4436,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
4334
4436
  suspense.activeBranch = pendingBranch;
4335
4437
  } else unmount(pendingBranch, parentComponent, suspense);
4336
4438
  suspense.deps = 0;
4337
- for (let i = 0; i < suspense.effects.length; i++) {
4338
- const effect = suspense.effects[i];
4339
- if (effect.flags & 8) queuePostFlushCb(effect);
4340
- }
4341
- suspense.effects.length = 0;
4439
+ discardEffects(suspense);
4342
4440
  suspense.hiddenContainer = createElement("div");
4343
4441
  if (isInFallback) {
4344
4442
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
@@ -4361,14 +4459,14 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
4361
4459
  } else {
4362
4460
  triggerEvent(n2, "onPending");
4363
4461
  suspense.pendingBranch = newBranch;
4364
- if (newBranch.shapeFlag & 512) suspense.pendingId = newBranch.component.suspenseId;
4365
- else suspense.pendingId = suspenseId++;
4462
+ suspense.pendingId = suspenseId++;
4366
4463
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
4367
4464
  if (suspense.deps <= 0) suspense.resolve();
4368
4465
  else {
4369
- const { timeout, pendingId } = suspense;
4370
- if (timeout > 0) setTimeout(() => {
4371
- if (suspense.pendingId === pendingId) suspense.fallback(newFallback);
4466
+ const { timeout } = suspense;
4467
+ if (timeout > 0) suspense.timeoutTimer = setTimeout(() => {
4468
+ suspense.timeoutTimer = void 0;
4469
+ suspense.fallback(suspense.vnode.ssFallback);
4372
4470
  }, timeout);
4373
4471
  else if (timeout === 0) suspense.fallback(newFallback);
4374
4472
  }
@@ -4397,6 +4495,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4397
4495
  deps: 0,
4398
4496
  pendingId: suspenseId++,
4399
4497
  timeout: typeof timeout === "number" ? timeout : -1,
4498
+ timeoutTimer: void 0,
4400
4499
  activeBranch: null,
4401
4500
  isFallbackMountPending: false,
4402
4501
  pendingBranch: null,
@@ -4412,26 +4511,39 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4412
4511
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
4413
4512
  let hasUpdatedAnchor = false;
4414
4513
  if (delayEnter) activeBranch.transition.afterLeave = () => {
4415
- if (pendingId === suspense.pendingId) {
4514
+ if (pendingId === suspense.pendingId && !suspense.isUnmounted) {
4515
+ enterDeferred(suspense, pendingBranch);
4416
4516
  move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
4417
4517
  queuePostFlushCb(effects);
4418
4518
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
4419
4519
  }
4420
4520
  };
4421
4521
  if (activeBranch && !suspense.isFallbackMountPending) {
4422
- if (parentNode(activeBranch.el) === container) {
4522
+ if (parentNode(activeBranch.el || resolveAsyncComponentPlaceholder(activeBranch)) === container) {
4423
4523
  anchor = next(activeBranch);
4424
4524
  hasUpdatedAnchor = true;
4425
4525
  }
4426
4526
  unmount(activeBranch, parentComponent, suspense, true);
4427
4527
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
4428
4528
  }
4429
- if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
4529
+ if (!delayEnter) {
4530
+ enterDeferred(suspense, pendingBranch);
4531
+ move(pendingBranch, container, anchor, 0, parentComponent);
4532
+ }
4430
4533
  }
4534
+ clearTimeout(suspense.timeoutTimer);
4535
+ suspense.timeoutTimer = void 0;
4431
4536
  suspense.isFallbackMountPending = false;
4432
4537
  setActiveBranch(suspense, pendingBranch);
4433
4538
  suspense.pendingBranch = null;
4434
4539
  suspense.isInFallback = false;
4540
+ let kept = 0;
4541
+ for (let i = 0; i < effects.length; i++) {
4542
+ const effect = effects[i];
4543
+ if (effect.flags & 16) queuePostFlushCb(effect);
4544
+ else effects[kept++] = effect;
4545
+ }
4546
+ effects.length = kept;
4435
4547
  let parent = suspense.parent;
4436
4548
  let hasUnresolvedAncestor = false;
4437
4549
  while (parent) {
@@ -4454,13 +4566,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4454
4566
  triggerEvent(vnode, "onResolve");
4455
4567
  },
4456
4568
  fallback(fallbackVNode) {
4457
- if (!suspense.pendingBranch) return;
4569
+ if (suspense.isUnmounted || !suspense.pendingBranch) return;
4458
4570
  const { vnode, activeBranch, parentComponent, container, namespace } = suspense;
4459
4571
  triggerEvent(vnode, "onFallback");
4460
4572
  const anchor = next(activeBranch);
4461
4573
  const mountFallback = () => {
4462
4574
  suspense.isFallbackMountPending = false;
4463
- if (!suspense.isInFallback) return;
4575
+ if (suspense.isUnmounted || !suspense.isInFallback) return;
4464
4576
  const latestFallback = suspense.vnode.ssFallback;
4465
4577
  patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
4466
4578
  setActiveBranch(suspense, latestFallback);
@@ -4484,24 +4596,52 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4484
4596
  registerDep(instance, onResolve) {
4485
4597
  const isInPendingSuspense = !!suspense.pendingBranch;
4486
4598
  if (isInPendingSuspense) suspense.deps++;
4599
+ const render = (setupResult) => {
4600
+ instance.asyncResolved = true;
4601
+ onResolve(setupResult);
4602
+ };
4487
4603
  instance.asyncDep.catch((err) => {
4488
- handleError(err, instance, 0);
4604
+ handleError(err, instance, 0, false, true);
4605
+ return () => null;
4489
4606
  }).then((asyncSetupResult) => {
4490
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
4607
+ if (instance.isUnmounted || suspense.isUnmounted) return;
4608
+ const isPendingDep = isInPendingSuspense && suspense.pendingId === instance.suspenseId;
4491
4609
  setCurrentInstance(null, void 0);
4492
4610
  if (!instance.scope.active) {
4493
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
4611
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
4494
4612
  return;
4495
4613
  }
4496
- instance.asyncResolved = true;
4497
- onResolve(asyncSetupResult);
4498
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
4614
+ if (!isPendingDep && suspense.pendingBranch) {
4615
+ const job = () => {
4616
+ if (instance.isUnmounted || suspense.isUnmounted || !instance.scope.active) return;
4617
+ if (suspense.pendingBranch) queueEffectWithSuspense(job, void 0, suspense);
4618
+ else render(asyncSetupResult);
4619
+ };
4620
+ job.flags = 24;
4621
+ queueEffectWithSuspense(job, void 0, suspense);
4622
+ return;
4623
+ }
4624
+ render(asyncSetupResult);
4625
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
4499
4626
  });
4500
4627
  },
4501
4628
  unmount(parentSuspense, doRemove) {
4502
4629
  suspense.isUnmounted = true;
4630
+ clearTimeout(suspense.timeoutTimer);
4631
+ suspense.timeoutTimer = void 0;
4632
+ if (parentSuspenseId !== void 0) {
4633
+ const parent = suspense.parent;
4634
+ const pendingId = parentSuspenseId;
4635
+ parentSuspenseId = void 0;
4636
+ queuePostFlushCb(() => {
4637
+ if (parent.pendingId === pendingId && !parent.isUnmounted && --parent.deps === 0) parent.resolve();
4638
+ });
4639
+ }
4503
4640
  if (suspense.activeBranch) unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
4504
- if (suspense.pendingBranch) unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
4641
+ if (suspense.pendingBranch) {
4642
+ unmount(suspense.pendingBranch, parentComponent, suspense, doRemove);
4643
+ discardEffects(suspense);
4644
+ }
4505
4645
  }
4506
4646
  };
4507
4647
  return suspense;
@@ -4538,6 +4678,14 @@ function normalizeSuspenseSlot(s) {
4538
4678
  if (block && !s.dynamicChildren) s.dynamicChildren = block.filter((c) => c !== s);
4539
4679
  return s;
4540
4680
  }
4681
+ function discardEffects(suspense) {
4682
+ const { effects } = suspense;
4683
+ for (let i = 0; i < effects.length; i++) {
4684
+ const effect = effects[i];
4685
+ if (effect.flags & 8) queuePostFlushCb(effect);
4686
+ }
4687
+ effects.length = 0;
4688
+ }
4541
4689
  function queueEffectWithSuspense(fn, id, suspense) {
4542
4690
  if (suspense && suspense.pendingBranch) {
4543
4691
  if ((0, _vue_shared.isArray)(fn)) suspense.effects.push(...fn);
@@ -4725,7 +4873,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
4725
4873
  }
4726
4874
  function guardReactiveProps(props) {
4727
4875
  if (!props) return null;
4728
- return (0, _vue_reactivity.isProxy)(props) || isInternalObject(props) ? (0, _vue_shared.extend)({}, props) : props;
4876
+ if ((0, _vue_reactivity.isProxy)(props)) return (0, _vue_shared.extend)({}, props);
4877
+ return isInternalObject(props) ? (0, _vue_shared.extend)({}, props[rawAttrsKey] || props) : props;
4729
4878
  }
4730
4879
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
4731
4880
  const { props, ref, patchFlag, children, transition } = vnode;
@@ -4829,6 +4978,17 @@ function normalizeVNode(child) {
4829
4978
  function cloneIfMounted(child) {
4830
4979
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
4831
4980
  }
4981
+ let deferElementSlots = false;
4982
+ /**
4983
+ * While enabled, compiled default slots passed as children of plain elements
4984
+ * are kept on the vnode so the server renderer can render them in push mode.
4985
+ * @internal
4986
+ */
4987
+ function setDeferElementSlots(value) {
4988
+ const prev = deferElementSlots;
4989
+ deferElementSlots = value;
4990
+ return prev;
4991
+ }
4832
4992
  function normalizeChildren(vnode, children) {
4833
4993
  let type = 0;
4834
4994
  const { shapeFlag } = vnode;
@@ -4837,6 +4997,11 @@ function normalizeChildren(vnode, children) {
4837
4997
  else if (typeof children === "object") {
4838
4998
  if (shapeFlag & 65) {
4839
4999
  const slot = children.default;
5000
+ if (deferElementSlots && slot && slot._c && shapeFlag & 1) {
5001
+ vnode.children = children;
5002
+ vnode.shapeFlag |= 32;
5003
+ return;
5004
+ }
4840
5005
  if (slot) {
4841
5006
  slot._c && (slot._d = false);
4842
5007
  normalizeChildren(vnode, slot());
@@ -5088,7 +5253,8 @@ function setupStatefulComponent(instance, isSSR) {
5088
5253
  setInSSRSetupState(false);
5089
5254
  }
5090
5255
  }).catch((e) => {
5091
- handleError(e, instance, 0);
5256
+ handleError(e, instance, 0, void 0, true);
5257
+ instance.ssrRender = (_, push) => push("<!---->");
5092
5258
  });
5093
5259
  else instance.asyncDep = setupResult;
5094
5260
  } else handleSetupResult(instance, setupResult, isSSR);
@@ -5143,9 +5309,14 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5143
5309
  }
5144
5310
  }
5145
5311
  }
5312
+ /**
5313
+ * Read through the setup context `attrs` proxy to get the raw attrs object.
5314
+ * @internal
5315
+ */
5316
+ const rawAttrsKey = Symbol();
5146
5317
  const attrsProxyHandlers = { get(target, key) {
5147
5318
  (0, _vue_reactivity.track)(target, "get", "");
5148
- return target[key];
5319
+ return key === rawAttrsKey ? target : target[key];
5149
5320
  } };
5150
5321
  function createSetupContext(instance) {
5151
5322
  return {
@@ -5229,7 +5400,7 @@ function isMemoSame(cached, memo) {
5229
5400
  }
5230
5401
  //#endregion
5231
5402
  //#region packages/runtime-core/src/index.ts
5232
- const version = "3.6.0-rc.13";
5403
+ const version = "3.6.0-rc.15";
5233
5404
  const warn = _vue_shared.NOOP;
5234
5405
  /**
5235
5406
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -5255,7 +5426,8 @@ const ssrUtils = {
5255
5426
  popWarningContext,
5256
5427
  VaporSlot,
5257
5428
  rawVaporSlotKey,
5258
- invokeSlotFallback
5429
+ invokeSlotFallback,
5430
+ setDeferElementSlots
5259
5431
  };
5260
5432
  /**
5261
5433
  * @internal only exposed in compat builds