@vue/runtime-core 3.6.0-rc.14 → 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.14
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)) {
@@ -1281,7 +1318,7 @@ const getContainerType = (container) => {
1281
1318
  };
1282
1319
  const isComment = (node) => node.nodeType === 8;
1283
1320
  /** The data of a comment opening a range a hydration steps over as one. */
1284
- const isRangeStart = (data) => data === "[" || data === "(" || (0, _vue_shared.isVaporBranchStart)(data);
1321
+ const isRangeStart = (data) => data === "[" || data === "(" || (0, _vue_shared.isVaporRangeStart)(data);
1285
1322
  function createHydrationFunctions(rendererInternals) {
1286
1323
  const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
1287
1324
  const hydrate = (vnode, container) => {
@@ -1298,7 +1335,7 @@ function createHydrationFunctions(rendererInternals) {
1298
1335
  };
1299
1336
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1300
1337
  optimized = optimized || !!vnode.dynamicChildren;
1301
- const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && (0, _vue_shared.isVaporBranchStart)(node.data));
1338
+ const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && (0, _vue_shared.isVaporRangeStart)(node.data));
1302
1339
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
1303
1340
  const { type, ref, shapeFlag, patchFlag } = vnode;
1304
1341
  let domType = node.nodeType;
@@ -1475,10 +1512,11 @@ function createHydrationFunctions(rendererInternals) {
1475
1512
  const container = parentNode(node);
1476
1513
  const first = nextSibling(node);
1477
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);
1478
- 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);
1479
1517
  else {
1480
1518
  logMismatchError();
1481
- insert(vnode.anchor = createComment(`]`), container, next);
1519
+ insert(vnode.anchor = createComment(close), container, next);
1482
1520
  return next;
1483
1521
  }
1484
1522
  };
@@ -1497,13 +1535,13 @@ function createHydrationFunctions(rendererInternals) {
1497
1535
  const container = parentNode(node);
1498
1536
  remove(node);
1499
1537
  patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1500
- if (parentComponent && parentComponent.vnode) {
1538
+ if (parentComponent && parentComponent.vnode && parentComponent.vnode.el === node) {
1501
1539
  parentComponent.vnode.el = vnode.el;
1502
1540
  updateHOCHostEl(parentComponent, vnode.el);
1503
1541
  }
1504
1542
  return next;
1505
1543
  };
1506
- 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 === "(" ? ")" : "]") => {
1507
1545
  let match = 0;
1508
1546
  while (node) {
1509
1547
  node = nextSibling(node);
@@ -1653,7 +1691,7 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
1653
1691
  function forEachElement(node, cb) {
1654
1692
  if (isComment(node) && isRangeStart(node.data)) {
1655
1693
  const open = node.data;
1656
- const close = open === "(" ? ")" : "]";
1694
+ const close = (0, _vue_shared.rangeCloseOf)(open);
1657
1695
  let depth = 1;
1658
1696
  let next = node.nextSibling;
1659
1697
  while (next) {
@@ -1690,7 +1728,7 @@ function defineAsyncComponent(source) {
1690
1728
  if (resolvedComp) return () => createInnerComp(resolvedComp, instance);
1691
1729
  const onError = (err) => {
1692
1730
  setPendingRequest(null);
1693
- handleError(err, instance, 13, !errorComponent);
1731
+ handleError(err, instance, 13, !errorComponent, true);
1694
1732
  };
1695
1733
  if (suspensible && instance.suspense || isInSSRComponentSetup) return load().then((comp) => {
1696
1734
  return () => createInnerComp(comp, instance);
@@ -1769,10 +1807,12 @@ const useAsyncComponentState = (delay = 200, timeout, onError, instance = curren
1769
1807
  const delayed = (0, _vue_reactivity.ref)(!!delay);
1770
1808
  let timeoutTimer;
1771
1809
  let delayTimer;
1772
- if (instance) onUnmounted(() => {
1773
- if (timeoutTimer != null) clearTimeout(timeoutTimer);
1774
- if (delayTimer != null) clearTimeout(delayTimer);
1775
- }, 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
+ });
1776
1816
  if (delay) delayTimer = setTimeout(() => {
1777
1817
  if (instance && instance.isUnmounted) return;
1778
1818
  delayed.value = false;
@@ -1801,7 +1841,12 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
1801
1841
  if (skipIfUpdated) (instance.bu || (instance.bu = [])).push(() => patched = true);
1802
1842
  const performHydrate = () => {
1803
1843
  if (patched) return;
1804
- 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
+ }
1805
1850
  hydrate();
1806
1851
  };
1807
1852
  const doHydrate = hydrateStrategy ? () => {
@@ -1858,7 +1903,11 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
1858
1903
  activate(vnode, container, anchor, renderer, keepAliveInstance, parentSuspense, namespace, optimized);
1859
1904
  };
1860
1905
  sharedContext.deactivate = (vnode) => {
1861
- 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;
1862
1911
  };
1863
1912
  function unmount(vnode) {
1864
1913
  resetShapeFlag(vnode);
@@ -1890,11 +1939,15 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
1890
1939
  let pendingCacheKey = null;
1891
1940
  const cacheSubtree = () => {
1892
1941
  if (pendingCacheKey != null) {
1893
- if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
1894
- const vnode = getInnerChild(keepAliveInstance.subTree);
1895
- if (vnode.component) cache.set(pendingCacheKey, vnode);
1896
- }, void 0, keepAliveInstance.subTree.suspense);
1897
- 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));
1898
1951
  }
1899
1952
  };
1900
1953
  onMounted(cacheSubtree);
@@ -1998,9 +2051,8 @@ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance())
1998
2051
  }
1999
2052
  function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2000
2053
  const injected = injectHook(type, hook, keepAliveRoot, true);
2001
- onUnmounted(() => {
2002
- (0, _vue_shared.remove)(keepAliveRoot[type], injected);
2003
- }, target);
2054
+ const removal = injectHook("um", () => (0, _vue_shared.remove)(keepAliveRoot[type], injected), target);
2055
+ removal.flags = 8;
2004
2056
  }
2005
2057
  function resetShapeFlag(vnode) {
2006
2058
  vnode.shapeFlag &= -257;
@@ -2217,6 +2269,11 @@ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
2217
2269
  ret.props = (0, _vue_shared.extend)({}, ret.props, { key: branchKey });
2218
2270
  ret.key = branchKey;
2219
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
+ }
2220
2277
  if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2221
2278
  return ret;
2222
2279
  }
@@ -3555,8 +3612,10 @@ function baseCreateRenderer(options, createHydrationFns) {
3555
3612
  if (vnodeHook = props.onVnodeBeforeMount) invokeVNodeHook(vnodeHook, parentComponent, vnode);
3556
3613
  }
3557
3614
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3558
- if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
3559
- 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);
3560
3619
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
3561
3620
  try {
3562
3621
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -3775,16 +3834,20 @@ function baseCreateRenderer(options, createHydrationFns) {
3775
3834
  } else {
3776
3835
  let { next, bu, u, parent, vnode } = instance;
3777
3836
  {
3778
- const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
3779
- if (nonHydratedAsyncRoot) {
3837
+ const unresolvedAsyncRoot = locateUnresolvedAsyncRoot(instance);
3838
+ if (unresolvedAsyncRoot) {
3780
3839
  if (next) {
3781
3840
  next.el = vnode.el;
3782
3841
  updateComponentPreRender(instance, next, optimized);
3783
3842
  }
3784
- nonHydratedAsyncRoot.asyncDep.then(() => {
3785
- queuePostRenderEffect(() => {
3786
- if (!instance.isUnmounted) instance.update();
3787
- }, 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);
3788
3851
  });
3789
3852
  return;
3790
3853
  }
@@ -3803,7 +3866,7 @@ function baseCreateRenderer(options, createHydrationFns) {
3803
3866
  const nextTree = renderComponentRoot(instance);
3804
3867
  const prevTree = instance.subTree;
3805
3868
  instance.subTree = nextTree;
3806
- 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);
3807
3870
  next.el = nextTree.el;
3808
3871
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
3809
3872
  if (u) queuePostRenderEffect(u, void 0, parentSuspense);
@@ -4000,9 +4063,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4000
4063
  }
4001
4064
  if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
4002
4065
  if (shapeFlag & 256) {
4003
- if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
4004
- else parentComponent.ctx.deactivate(vnode);
4005
- return;
4066
+ if (parentComponent.ctx.deactivate(vnode)) return;
4006
4067
  }
4007
4068
  if (isVaporInteropEnabled && shapeFlag & 6 && isVaporComponent(type)) {
4008
4069
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
@@ -4081,12 +4142,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4081
4142
  if (effect) {
4082
4143
  effect.stop();
4083
4144
  unmount(subTree, instance, parentSuspense, doRemove);
4084
- } else if (instance.vnode.el && subTree) {
4145
+ } else if (subTree) {
4085
4146
  subTree.transition = instance.vnode.transition;
4086
4147
  unmount(subTree, instance, parentSuspense, doRemove);
4087
4148
  }
4088
4149
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4089
- queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4150
+ const markUnmounted = () => instance.isUnmounted = true;
4151
+ markUnmounted.flags = 8;
4152
+ queuePostRenderEffect(markUnmounted, void 0, parentSuspense);
4090
4153
  };
4091
4154
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
4092
4155
  for (let i = start; i < children.length; i++) unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
@@ -4193,11 +4256,11 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4193
4256
  if (c2.type === Comment && !c2.el) c2.el = c1.el;
4194
4257
  }
4195
4258
  }
4196
- function locateNonHydratedAsyncRoot(instance) {
4259
+ function locateUnresolvedAsyncRoot(instance) {
4197
4260
  const subComponent = instance.subTree && instance.subTree.component;
4198
4261
  if (subComponent) {
4199
4262
  if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
4200
- else return locateNonHydratedAsyncRoot(subComponent);
4263
+ else return locateUnresolvedAsyncRoot(subComponent);
4201
4264
  }
4202
4265
  }
4203
4266
  function invalidateMount(hooks) {
@@ -4263,7 +4326,9 @@ function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true
4263
4326
  function resolveAsyncComponentPlaceholder(anchorVnode) {
4264
4327
  if (anchorVnode.placeholder) return anchorVnode.placeholder;
4265
4328
  const instance = anchorVnode.component;
4266
- 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);
4267
4332
  return null;
4268
4333
  }
4269
4334
  //#endregion
@@ -4275,17 +4340,22 @@ function withSuspenseEnabled(value) {
4275
4340
  return value;
4276
4341
  }
4277
4342
  let suspenseId = 0;
4343
+ const deferredEnterKey = Symbol("_deferredEnter");
4278
4344
  const Suspense = /*@__PURE__*/ withSuspenseEnabled({
4279
4345
  name: "Suspense",
4280
4346
  __isSuspense: true,
4281
4347
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
4282
4348
  if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
4283
4349
  else {
4284
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
4285
- n2.suspense = n1.suspense;
4286
- n2.suspense.vnode = n2;
4287
- n2.el = n1.el;
4288
- 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
+ }
4289
4359
  }
4290
4360
  patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, rendererInternals);
4291
4361
  }
@@ -4297,6 +4367,36 @@ function triggerEvent(vnode, name) {
4297
4367
  const eventListener = vnode.props && vnode.props[name];
4298
4368
  if ((0, _vue_shared.isFunction)(eventListener)) eventListener();
4299
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
+ }
4300
4400
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
4301
4401
  const { p: patch, o: { createElement } } = rendererInternals;
4302
4402
  const hiddenContainer = createElement("div");
@@ -4336,11 +4436,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
4336
4436
  suspense.activeBranch = pendingBranch;
4337
4437
  } else unmount(pendingBranch, parentComponent, suspense);
4338
4438
  suspense.deps = 0;
4339
- for (let i = 0; i < suspense.effects.length; i++) {
4340
- const effect = suspense.effects[i];
4341
- if (effect.flags & 8) queuePostFlushCb(effect);
4342
- }
4343
- suspense.effects.length = 0;
4439
+ discardEffects(suspense);
4344
4440
  suspense.hiddenContainer = createElement("div");
4345
4441
  if (isInFallback) {
4346
4442
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
@@ -4363,14 +4459,14 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
4363
4459
  } else {
4364
4460
  triggerEvent(n2, "onPending");
4365
4461
  suspense.pendingBranch = newBranch;
4366
- if (newBranch.shapeFlag & 512) suspense.pendingId = newBranch.component.suspenseId;
4367
- else suspense.pendingId = suspenseId++;
4462
+ suspense.pendingId = suspenseId++;
4368
4463
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
4369
4464
  if (suspense.deps <= 0) suspense.resolve();
4370
4465
  else {
4371
- const { timeout, pendingId } = suspense;
4372
- if (timeout > 0) setTimeout(() => {
4373
- 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);
4374
4470
  }, timeout);
4375
4471
  else if (timeout === 0) suspense.fallback(newFallback);
4376
4472
  }
@@ -4399,6 +4495,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4399
4495
  deps: 0,
4400
4496
  pendingId: suspenseId++,
4401
4497
  timeout: typeof timeout === "number" ? timeout : -1,
4498
+ timeoutTimer: void 0,
4402
4499
  activeBranch: null,
4403
4500
  isFallbackMountPending: false,
4404
4501
  pendingBranch: null,
@@ -4414,26 +4511,39 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4414
4511
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
4415
4512
  let hasUpdatedAnchor = false;
4416
4513
  if (delayEnter) activeBranch.transition.afterLeave = () => {
4417
- if (pendingId === suspense.pendingId) {
4514
+ if (pendingId === suspense.pendingId && !suspense.isUnmounted) {
4515
+ enterDeferred(suspense, pendingBranch);
4418
4516
  move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
4419
4517
  queuePostFlushCb(effects);
4420
4518
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
4421
4519
  }
4422
4520
  };
4423
4521
  if (activeBranch && !suspense.isFallbackMountPending) {
4424
- if (parentNode(activeBranch.el) === container) {
4522
+ if (parentNode(activeBranch.el || resolveAsyncComponentPlaceholder(activeBranch)) === container) {
4425
4523
  anchor = next(activeBranch);
4426
4524
  hasUpdatedAnchor = true;
4427
4525
  }
4428
4526
  unmount(activeBranch, parentComponent, suspense, true);
4429
4527
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
4430
4528
  }
4431
- if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
4529
+ if (!delayEnter) {
4530
+ enterDeferred(suspense, pendingBranch);
4531
+ move(pendingBranch, container, anchor, 0, parentComponent);
4532
+ }
4432
4533
  }
4534
+ clearTimeout(suspense.timeoutTimer);
4535
+ suspense.timeoutTimer = void 0;
4433
4536
  suspense.isFallbackMountPending = false;
4434
4537
  setActiveBranch(suspense, pendingBranch);
4435
4538
  suspense.pendingBranch = null;
4436
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;
4437
4547
  let parent = suspense.parent;
4438
4548
  let hasUnresolvedAncestor = false;
4439
4549
  while (parent) {
@@ -4456,13 +4566,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4456
4566
  triggerEvent(vnode, "onResolve");
4457
4567
  },
4458
4568
  fallback(fallbackVNode) {
4459
- if (!suspense.pendingBranch) return;
4569
+ if (suspense.isUnmounted || !suspense.pendingBranch) return;
4460
4570
  const { vnode, activeBranch, parentComponent, container, namespace } = suspense;
4461
4571
  triggerEvent(vnode, "onFallback");
4462
4572
  const anchor = next(activeBranch);
4463
4573
  const mountFallback = () => {
4464
4574
  suspense.isFallbackMountPending = false;
4465
- if (!suspense.isInFallback) return;
4575
+ if (suspense.isUnmounted || !suspense.isInFallback) return;
4466
4576
  const latestFallback = suspense.vnode.ssFallback;
4467
4577
  patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
4468
4578
  setActiveBranch(suspense, latestFallback);
@@ -4486,24 +4596,52 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
4486
4596
  registerDep(instance, onResolve) {
4487
4597
  const isInPendingSuspense = !!suspense.pendingBranch;
4488
4598
  if (isInPendingSuspense) suspense.deps++;
4599
+ const render = (setupResult) => {
4600
+ instance.asyncResolved = true;
4601
+ onResolve(setupResult);
4602
+ };
4489
4603
  instance.asyncDep.catch((err) => {
4490
- handleError(err, instance, 0);
4604
+ handleError(err, instance, 0, false, true);
4605
+ return () => null;
4491
4606
  }).then((asyncSetupResult) => {
4492
- 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;
4493
4609
  setCurrentInstance(null, void 0);
4494
4610
  if (!instance.scope.active) {
4495
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
4611
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
4496
4612
  return;
4497
4613
  }
4498
- instance.asyncResolved = true;
4499
- onResolve(asyncSetupResult);
4500
- 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();
4501
4626
  });
4502
4627
  },
4503
4628
  unmount(parentSuspense, doRemove) {
4504
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
+ }
4505
4640
  if (suspense.activeBranch) unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
4506
- if (suspense.pendingBranch) unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
4641
+ if (suspense.pendingBranch) {
4642
+ unmount(suspense.pendingBranch, parentComponent, suspense, doRemove);
4643
+ discardEffects(suspense);
4644
+ }
4507
4645
  }
4508
4646
  };
4509
4647
  return suspense;
@@ -4540,6 +4678,14 @@ function normalizeSuspenseSlot(s) {
4540
4678
  if (block && !s.dynamicChildren) s.dynamicChildren = block.filter((c) => c !== s);
4541
4679
  return s;
4542
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
+ }
4543
4689
  function queueEffectWithSuspense(fn, id, suspense) {
4544
4690
  if (suspense && suspense.pendingBranch) {
4545
4691
  if ((0, _vue_shared.isArray)(fn)) suspense.effects.push(...fn);
@@ -4727,7 +4873,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
4727
4873
  }
4728
4874
  function guardReactiveProps(props) {
4729
4875
  if (!props) return null;
4730
- 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;
4731
4878
  }
4732
4879
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
4733
4880
  const { props, ref, patchFlag, children, transition } = vnode;
@@ -4831,6 +4978,17 @@ function normalizeVNode(child) {
4831
4978
  function cloneIfMounted(child) {
4832
4979
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
4833
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
+ }
4834
4992
  function normalizeChildren(vnode, children) {
4835
4993
  let type = 0;
4836
4994
  const { shapeFlag } = vnode;
@@ -4839,6 +4997,11 @@ function normalizeChildren(vnode, children) {
4839
4997
  else if (typeof children === "object") {
4840
4998
  if (shapeFlag & 65) {
4841
4999
  const slot = children.default;
5000
+ if (deferElementSlots && slot && slot._c && shapeFlag & 1) {
5001
+ vnode.children = children;
5002
+ vnode.shapeFlag |= 32;
5003
+ return;
5004
+ }
4842
5005
  if (slot) {
4843
5006
  slot._c && (slot._d = false);
4844
5007
  normalizeChildren(vnode, slot());
@@ -5090,7 +5253,8 @@ function setupStatefulComponent(instance, isSSR) {
5090
5253
  setInSSRSetupState(false);
5091
5254
  }
5092
5255
  }).catch((e) => {
5093
- handleError(e, instance, 0);
5256
+ handleError(e, instance, 0, void 0, true);
5257
+ instance.ssrRender = (_, push) => push("<!---->");
5094
5258
  });
5095
5259
  else instance.asyncDep = setupResult;
5096
5260
  } else handleSetupResult(instance, setupResult, isSSR);
@@ -5145,9 +5309,14 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5145
5309
  }
5146
5310
  }
5147
5311
  }
5312
+ /**
5313
+ * Read through the setup context `attrs` proxy to get the raw attrs object.
5314
+ * @internal
5315
+ */
5316
+ const rawAttrsKey = Symbol();
5148
5317
  const attrsProxyHandlers = { get(target, key) {
5149
5318
  (0, _vue_reactivity.track)(target, "get", "");
5150
- return target[key];
5319
+ return key === rawAttrsKey ? target : target[key];
5151
5320
  } };
5152
5321
  function createSetupContext(instance) {
5153
5322
  return {
@@ -5231,7 +5400,7 @@ function isMemoSame(cached, memo) {
5231
5400
  }
5232
5401
  //#endregion
5233
5402
  //#region packages/runtime-core/src/index.ts
5234
- const version = "3.6.0-rc.14";
5403
+ const version = "3.6.0-rc.15";
5235
5404
  const warn = _vue_shared.NOOP;
5236
5405
  /**
5237
5406
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -5257,7 +5426,8 @@ const ssrUtils = {
5257
5426
  popWarningContext,
5258
5427
  VaporSlot,
5259
5428
  rawVaporSlotKey,
5260
- invokeSlotFallback
5429
+ invokeSlotFallback,
5430
+ setDeferElementSlots
5261
5431
  };
5262
5432
  /**
5263
5433
  * @internal only exposed in compat builds