@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
  **/
@@ -201,7 +201,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
201
201
  if ((0, _vue_shared.isFunction)(fn)) {
202
202
  const res = callWithErrorHandling(fn, instance, type, args);
203
203
  if (res && (0, _vue_shared.isPromise)(res)) res.catch((err) => {
204
- handleError(err, instance, type);
204
+ handleError(err, instance, type, void 0, true);
205
205
  });
206
206
  return res;
207
207
  }
@@ -211,7 +211,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
211
211
  return values;
212
212
  } else warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);
213
213
  }
214
- function handleError(err, instance, type, throwInDev = true) {
214
+ function handleError(err, instance, type, throwInDev = true, isAsyncError = false) {
215
215
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || _vue_shared.EMPTY_OBJ;
216
216
  if (instance) {
217
217
  let cur = instance.parent;
@@ -219,7 +219,7 @@ function handleError(err, instance, type, throwInDev = true) {
219
219
  const errorInfo = ErrorTypeStrings$1[type];
220
220
  while (cur) {
221
221
  const errorCapturedHooks = cur.ec;
222
- if (errorCapturedHooks) {
222
+ if (errorCapturedHooks && !cur.isUnmounted && (!isAsyncError || cur.scope.active)) {
223
223
  for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;
224
224
  }
225
225
  cur = cur.parent;
@@ -524,7 +524,11 @@ function reload(id, newComp) {
524
524
  updateComponentDef(record.initialDef, newComp);
525
525
  const instances = [...record.instances];
526
526
  if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
527
- for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
527
+ for (const instance of instances) {
528
+ if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
529
+ const oldComp = normalizeClassComponent(instance.type);
530
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
531
+ }
528
532
  const dirtyInstances = new Set(instances);
529
533
  const rerenderedParents = /* @__PURE__ */ new Set();
530
534
  runWithHmrUpdating(() => {
@@ -565,7 +569,25 @@ function reload(id, newComp) {
565
569
  if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
566
570
  }
567
571
  parents.forEach((parent) => {
568
- queueJob(() => {
572
+ const children = instances.filter((instance) => instance.parent === parent);
573
+ const update = () => {
574
+ if (!parent.scope.active) return;
575
+ const activeChildren = children.filter((instance) => instance.scope.active);
576
+ if (!activeChildren.length) return;
577
+ const pending = activeChildren.find((instance) => instance.asyncDep && !instance.asyncResolved) || locateUnresolvedAsyncRoot(parent);
578
+ if (pending) {
579
+ pending.asyncDep.catch(_vue_shared.NOOP).then(() => {
580
+ if (parent.scope.active && (pending.asyncResolved || !pending.scope.active)) queueJob(update);
581
+ });
582
+ return;
583
+ }
584
+ for (const instance of activeChildren) {
585
+ const oldComp = normalizeClassComponent(instance.type);
586
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
587
+ if (!dirtyInstances) hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
588
+ dirtyInstances.add(instance);
589
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
590
+ }
569
591
  runWithHmrUpdating(() => {
570
592
  if (parent.vapor) parent.hmrRerender();
571
593
  else {
@@ -576,7 +598,12 @@ function reload(id, newComp) {
576
598
  }
577
599
  }
578
600
  });
579
- });
601
+ queuePostFlushCb(() => {
602
+ hmrDirtyComponents.clear();
603
+ hmrDirtyComponentsMode.clear();
604
+ });
605
+ };
606
+ queueJob(update);
580
607
  });
581
608
  }
582
609
  queuePostFlushCb(() => {
@@ -773,18 +800,35 @@ function withDirectives(vnode, directives) {
773
800
  return vnode;
774
801
  }
775
802
  function invokeDirectiveHook(vnode, prevVNode, instance, name) {
776
- const bindings = vnode.dirs;
803
+ let hookVNode = vnode;
804
+ if (name === "beforeMount") vnode._mount = vnode;
805
+ else if (name === "beforeUpdate") {
806
+ const mount = prevVNode && prevVNode._mount;
807
+ if (mount) {
808
+ mount._latest = vnode;
809
+ vnode._mount = mount;
810
+ }
811
+ } else if (name === "mounted") {
812
+ const latest = vnode._latest;
813
+ vnode._mount = vnode._latest = void 0;
814
+ if (latest) {
815
+ hookVNode = latest;
816
+ latest._mount = void 0;
817
+ }
818
+ }
819
+ const bindings = hookVNode.dirs;
777
820
  const oldBindings = prevVNode && prevVNode.dirs;
778
821
  for (let i = 0; i < bindings.length; i++) {
779
- const binding = bindings[i];
822
+ let binding = bindings[i];
780
823
  if (oldBindings) binding.oldValue = oldBindings[i].value;
824
+ else if (name === "mounted" && binding.oldValue !== void 0) binding = (0, _vue_shared.extend)({}, binding, { oldValue: void 0 });
781
825
  let hook = binding.dir[name];
782
826
  if (hook) {
783
827
  const prevSub = (0, _vue_reactivity.setActiveSub)();
784
828
  callWithAsyncErrorHandling(hook, instance, 8, [
785
829
  vnode.el,
786
830
  binding,
787
- vnode,
831
+ hookVNode,
788
832
  prevVNode
789
833
  ]);
790
834
  (0, _vue_reactivity.setActiveSub)(prevSub);
@@ -1227,7 +1271,15 @@ const BaseTransitionImpl = {
1227
1271
  const { mode } = rawProps;
1228
1272
  checkTransitionMode(mode);
1229
1273
  return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
1230
- if (!(instance.effect.flags & 1024)) instance.update();
1274
+ if (!(instance.effect.flags & 1024)) {
1275
+ if (instance.effect.running) {
1276
+ const job = () => {
1277
+ if (!(instance.effect.flags & 1024)) instance.update();
1278
+ };
1279
+ job.i = instance;
1280
+ queueJob(job);
1281
+ } else instance.update();
1282
+ }
1231
1283
  }) : _vue_shared.NOOP);
1232
1284
  };
1233
1285
  }
@@ -1257,7 +1309,7 @@ function getLeavingNodesForType(state, vnode) {
1257
1309
  }
1258
1310
  return leavingVNodesCache;
1259
1311
  }
1260
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1312
+ function resolveTransitionHooks(vnode, props, state, instance) {
1261
1313
  const key = String(vnode.key);
1262
1314
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1263
1315
  const hooks = baseResolveTransitionHooks({
@@ -1280,9 +1332,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1280
1332
  }
1281
1333
  },
1282
1334
  cloneHooks: (vnode) => {
1283
- const hooks = resolveTransitionHooks(vnode, props, state, instance, postClone);
1284
- if (postClone) postClone(hooks);
1285
- return hooks;
1335
+ return resolveTransitionHooks(vnode, props, state, instance);
1286
1336
  }
1287
1337
  }, props, state, instance);
1288
1338
  if (isVaporInteropEnabled && vnode.type === VaporSlot) (0, _vue_shared.extend)(hooks, {
@@ -1320,7 +1370,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1320
1370
  callHook(hook, [el]);
1321
1371
  },
1322
1372
  enter(el) {
1323
- if (!isHmrUpdating && isLeaving()) return;
1373
+ if (!isHmrUpdating && isLeaving(el)) return;
1324
1374
  let hook = onEnter;
1325
1375
  let afterHook = onAfterEnter;
1326
1376
  let cancelHook = onEnterCancelled;
@@ -1364,7 +1414,19 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1364
1414
  else done();
1365
1415
  },
1366
1416
  clone(node) {
1367
- return cloneHooks ? cloneHooks(node) : hooks;
1417
+ if (!cloneHooks) return hooks;
1418
+ const cloned = cloneHooks(node);
1419
+ cloned.afterLeave = () => {
1420
+ if (hooks.afterLeave) hooks.afterLeave();
1421
+ };
1422
+ cloned.delayLeave = (el, earlyRemove, delayedLeave) => {
1423
+ if (hooks.delayLeave) hooks.delayLeave(el, earlyRemove, delayedLeave);
1424
+ else delayedLeave();
1425
+ };
1426
+ cloned.delayedLeave = () => {
1427
+ if (hooks.delayedLeave) hooks.delayedLeave();
1428
+ };
1429
+ return cloned;
1368
1430
  }
1369
1431
  };
1370
1432
  return hooks;
@@ -1399,10 +1461,7 @@ function prepareTransitionSwitch(previous, next, props, state, instance, resumeA
1399
1461
  if (state.isLeaving) return emptyPlaceholder(next);
1400
1462
  const nextInner = getInnerChild$1(next);
1401
1463
  if (!nextInner) return emptyPlaceholder(next);
1402
- let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
1403
- if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
1404
- enterHooks = hooks;
1405
- });
1464
+ const enterHooks = resolveTransitionHooks(nextInner, props, state, instance);
1406
1465
  if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
1407
1466
  if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
1408
1467
  const mode = props.mode;
@@ -1468,9 +1527,14 @@ function setTransitionHooks(vnode, hooks) {
1468
1527
  return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
1469
1528
  }
1470
1529
  } else if (vnode.shapeFlag & 128) {
1471
- const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1472
- const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1473
- return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
1530
+ const suspense = vnode.suspense;
1531
+ if (suspense) {
1532
+ const branch = suspense.isHydrating ? suspense.pendingBranch : suspense.activeBranch;
1533
+ if (branch) return setTransitionHooks(branch, hooks.clone(branch));
1534
+ } else {
1535
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1536
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1537
+ }
1474
1538
  } else {
1475
1539
  vnode.transition = hooks;
1476
1540
  if (vnode.type === Fragment && (0, _vue_shared.isArray)(vnode.children)) {
@@ -1689,7 +1753,7 @@ const getContainerType = (container) => {
1689
1753
  };
1690
1754
  const isComment = (node) => node.nodeType === 8;
1691
1755
  /** The data of a comment opening a range a hydration steps over as one. */
1692
- const isRangeStart = (data) => data === "[" || data === "(" || (0, _vue_shared.isVaporBranchStart)(data);
1756
+ const isRangeStart = (data) => data === "[" || data === "(" || (0, _vue_shared.isVaporRangeStart)(data);
1693
1757
  function createHydrationFunctions(rendererInternals) {
1694
1758
  const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
1695
1759
  const hydrate = (vnode, container) => {
@@ -1707,7 +1771,7 @@ function createHydrationFunctions(rendererInternals) {
1707
1771
  };
1708
1772
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1709
1773
  optimized = optimized || !!vnode.dynamicChildren;
1710
- const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && (0, _vue_shared.isVaporBranchStart)(node.data));
1774
+ const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && (0, _vue_shared.isVaporRangeStart)(node.data));
1711
1775
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
1712
1776
  const { type, ref, shapeFlag, patchFlag } = vnode;
1713
1777
  let domType = node.nodeType;
@@ -1896,10 +1960,11 @@ function createHydrationFunctions(rendererInternals) {
1896
1960
  const container = parentNode(node);
1897
1961
  const first = nextSibling(node);
1898
1962
  const next = isVaporInteropEnabled && vnode.vo && node.data === "(" ? getVaporInterface(parentComponent, vnode).hydrateSlotOutlet(vnode, node, parentComponent, parentSuspense, slotScopeIds) : hydrateChildren(first, vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
1899
- if (next && isComment(next) && next.data === (node.data === "(" ? ")" : "]")) return nextSibling(vnode.anchor = next);
1963
+ const close = isVaporInteropEnabled ? (0, _vue_shared.rangeCloseOf)(node.data) : node.data === "(" ? ")" : "]";
1964
+ if (next && isComment(next) && next.data === close) return nextSibling(vnode.anchor = next);
1900
1965
  else {
1901
1966
  logMismatchError();
1902
- insert(vnode.anchor = createComment(`]`), container, next);
1967
+ insert(vnode.anchor = createComment(close), container, next);
1903
1968
  return next;
1904
1969
  }
1905
1970
  };
@@ -1921,13 +1986,13 @@ function createHydrationFunctions(rendererInternals) {
1921
1986
  const container = parentNode(node);
1922
1987
  remove(node);
1923
1988
  patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1924
- if (parentComponent && parentComponent.vnode) {
1989
+ if (parentComponent && parentComponent.vnode && parentComponent.vnode.el === node) {
1925
1990
  parentComponent.vnode.el = vnode.el;
1926
1991
  updateHOCHostEl(parentComponent, vnode.el);
1927
1992
  }
1928
1993
  return next;
1929
1994
  };
1930
- const locateClosingAnchor = (node, open = node && isComment(node) && node.data === "(" ? "(" : "[", close = open === "(" ? ")" : "]") => {
1995
+ const locateClosingAnchor = (node, open = node && isComment(node) && (node.data === "(" || isVaporInteropEnabled && node.data === "{") ? node.data : "[", close = isVaporInteropEnabled ? (0, _vue_shared.rangeCloseOf)(open) : open === "(" ? ")" : "]") => {
1931
1996
  let match = 0;
1932
1997
  while (node) {
1933
1998
  node = nextSibling(node);
@@ -2190,7 +2255,7 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
2190
2255
  function forEachElement(node, cb) {
2191
2256
  if (isComment(node) && isRangeStart(node.data)) {
2192
2257
  const open = node.data;
2193
- const close = open === "(" ? ")" : "]";
2258
+ const close = (0, _vue_shared.rangeCloseOf)(open);
2194
2259
  let depth = 1;
2195
2260
  let next = node.nextSibling;
2196
2261
  while (next) {
@@ -2227,7 +2292,7 @@ function defineAsyncComponent(source) {
2227
2292
  if (resolvedComp) return () => createInnerComp(resolvedComp, instance);
2228
2293
  const onError = (err) => {
2229
2294
  setPendingRequest(null);
2230
- handleError(err, instance, 13, !errorComponent);
2295
+ handleError(err, instance, 13, !errorComponent, true);
2231
2296
  };
2232
2297
  if (suspensible && instance.suspense || isInSSRComponentSetup) return load().then((comp) => {
2233
2298
  return () => createInnerComp(comp, instance);
@@ -2308,10 +2373,12 @@ const useAsyncComponentState = (delay = 200, timeout, onError, instance = curren
2308
2373
  const delayed = (0, _vue_reactivity.ref)(!!delay);
2309
2374
  let timeoutTimer;
2310
2375
  let delayTimer;
2311
- if (instance) onUnmounted(() => {
2312
- if (timeoutTimer != null) clearTimeout(timeoutTimer);
2313
- if (delayTimer != null) clearTimeout(delayTimer);
2314
- }, instance);
2376
+ if (instance) instance.scope.run(() => {
2377
+ (0, _vue_reactivity.onScopeDispose)(() => {
2378
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
2379
+ if (delayTimer != null) clearTimeout(delayTimer);
2380
+ });
2381
+ });
2315
2382
  if (delay) delayTimer = setTimeout(() => {
2316
2383
  if (instance && instance.isUnmounted) return;
2317
2384
  delayed.value = false;
@@ -2346,7 +2413,12 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
2346
2413
  }
2347
2414
  return;
2348
2415
  }
2349
- if (!el.parentNode || wasConnected && !el.isConnected) return;
2416
+ if (!el.parentNode) return;
2417
+ if (wasConnected && !el.isConnected) {
2418
+ let current = instance;
2419
+ while (current && !current.isDeactivated) current = current.parent;
2420
+ if (!current) return;
2421
+ }
2350
2422
  hydrate();
2351
2423
  };
2352
2424
  const doHydrate = hydrateStrategy ? () => {
@@ -2404,7 +2476,11 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
2404
2476
  activate(vnode, container, anchor, renderer, keepAliveInstance, parentSuspense, namespace, optimized);
2405
2477
  };
2406
2478
  sharedContext.deactivate = (vnode) => {
2407
- deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
2479
+ const cached = sharedContext.getCachedComponent(vnode);
2480
+ if (!cached || cached.component !== vnode.component) return false;
2481
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(keepAliveInstance, vnode).deactivate(vnode, storageContainer, parentSuspense);
2482
+ else deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
2483
+ return true;
2408
2484
  };
2409
2485
  function unmount(vnode) {
2410
2486
  resetShapeFlag(vnode);
@@ -2436,11 +2512,15 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
2436
2512
  let pendingCacheKey = null;
2437
2513
  const cacheSubtree = () => {
2438
2514
  if (pendingCacheKey != null) {
2439
- if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
2440
- const vnode = getInnerChild(keepAliveInstance.subTree);
2441
- if (vnode.component) cache.set(pendingCacheKey, vnode);
2442
- }, void 0, keepAliveInstance.subTree.suspense);
2443
- else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
2515
+ if (isSuspense(keepAliveInstance.subTree.type)) {
2516
+ const cacheInnerChild = () => {
2517
+ const vnode = getInnerChild(keepAliveInstance.subTree);
2518
+ if (vnode.component) cache.set(pendingCacheKey, vnode);
2519
+ };
2520
+ const suspense = keepAliveInstance.subTree.suspense;
2521
+ if (suspense.pendingBranch) queuePostRenderEffect(cacheInnerChild, void 0, suspense);
2522
+ else cacheInnerChild();
2523
+ } else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
2444
2524
  }
2445
2525
  };
2446
2526
  onMounted(cacheSubtree);
@@ -2545,9 +2625,8 @@ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance())
2545
2625
  }
2546
2626
  function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2547
2627
  const injected = injectHook(type, hook, keepAliveRoot, true);
2548
- onUnmounted(() => {
2549
- (0, _vue_shared.remove)(keepAliveRoot[type], injected);
2550
- }, target);
2628
+ const removal = injectHook("um", () => (0, _vue_shared.remove)(keepAliveRoot[type], injected), target);
2629
+ removal.flags = 8;
2551
2630
  }
2552
2631
  function resetShapeFlag(vnode) {
2553
2632
  vnode.shapeFlag &= -257;
@@ -2772,6 +2851,11 @@ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
2772
2851
  ret.props = (0, _vue_shared.extend)({}, ret.props, { key: branchKey });
2773
2852
  ret.key = branchKey;
2774
2853
  }
2854
+ if (isBlockTreeEnabled <= 0) {
2855
+ if (!ret.vs.props) ret.vs.props = ret.props;
2856
+ ret.props = ret.key != null ? { key: ret.key } : null;
2857
+ ret.vs.attrs = _vue_shared.EMPTY_OBJ;
2858
+ }
2775
2859
  if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2776
2860
  return ret;
2777
2861
  }
@@ -4573,8 +4657,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4573
4657
  (0, _vue_shared.def)(el, "__vnode", vnode, true);
4574
4658
  (0, _vue_shared.def)(el, "__vueParentComponent", parentComponent, true);
4575
4659
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4576
- if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4577
- else hostInsert(el, container, anchor);
4660
+ if (transition) {
4661
+ if (!needTransition(parentSuspense, transition) && !transition.persisted) el[deferredEnterKey] = true;
4662
+ performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4663
+ } else hostInsert(el, container, anchor);
4578
4664
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4579
4665
  const isHmr = isHmrUpdating;
4580
4666
  queuePostRenderEffect(() => {
@@ -4831,16 +4917,20 @@ function baseCreateRenderer(options, createHydrationFns) {
4831
4917
  } else {
4832
4918
  let { next, bu, u, parent, vnode } = instance;
4833
4919
  {
4834
- const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
4835
- if (nonHydratedAsyncRoot) {
4920
+ const unresolvedAsyncRoot = locateUnresolvedAsyncRoot(instance);
4921
+ if (unresolvedAsyncRoot) {
4836
4922
  if (next) {
4837
4923
  next.el = vnode.el;
4838
4924
  updateComponentPreRender(instance, next, optimized);
4839
4925
  }
4840
- nonHydratedAsyncRoot.asyncDep.then(() => {
4841
- queuePostRenderEffect(() => {
4842
- if (!instance.isUnmounted) instance.update();
4843
- }, void 0, parentSuspense);
4926
+ unresolvedAsyncRoot.asyncDep.then(() => {
4927
+ const retry = () => {
4928
+ if (instance.effect.flags & 1024) return;
4929
+ if (parentSuspense && parentSuspense.pendingBranch) queuePostRenderEffect(retry, void 0, parentSuspense);
4930
+ else instance.update();
4931
+ };
4932
+ retry.flags = 24;
4933
+ queuePostRenderEffect(retry, void 0, parentSuspense);
4844
4934
  });
4845
4935
  return;
4846
4936
  }
@@ -4863,7 +4953,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4863
4953
  const prevTree = instance.subTree;
4864
4954
  instance.subTree = nextTree;
4865
4955
  startMeasure(instance, `patch`);
4866
- patch(prevTree, nextTree, hostParentNode(prevTree.el), getNextHostNode(prevTree), instance, parentSuspense, namespace);
4956
+ patch(prevTree, nextTree, hostParentNode(prevTree.el || resolveAsyncComponentPlaceholder(prevTree)), getNextHostNode(prevTree), instance, parentSuspense, namespace);
4867
4957
  endMeasure(instance, `patch`);
4868
4958
  next.el = nextTree.el;
4869
4959
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
@@ -5066,9 +5156,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5066
5156
  }
5067
5157
  if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
5068
5158
  if (shapeFlag & 256) {
5069
- if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
5070
- else parentComponent.ctx.deactivate(vnode);
5071
- return;
5159
+ if (parentComponent.ctx.deactivate(vnode)) return;
5072
5160
  }
5073
5161
  if (isVaporInteropEnabled && shapeFlag & 6 && isVaporComponent(type)) {
5074
5162
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
@@ -5148,12 +5236,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5148
5236
  if (effect) {
5149
5237
  effect.stop();
5150
5238
  unmount(subTree, instance, parentSuspense, doRemove);
5151
- } else if (instance.vnode.el && subTree) {
5239
+ } else if (subTree) {
5152
5240
  subTree.transition = instance.vnode.transition;
5153
5241
  unmount(subTree, instance, parentSuspense, doRemove);
5154
5242
  }
5155
5243
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
5156
- queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
5244
+ const markUnmounted = () => instance.isUnmounted = true;
5245
+ markUnmounted.flags = 8;
5246
+ queuePostRenderEffect(markUnmounted, void 0, parentSuspense);
5157
5247
  devtoolsComponentRemoved(instance);
5158
5248
  };
5159
5249
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
@@ -5267,11 +5357,11 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5267
5357
  c2.el && (c2.el.__vnode = c2);
5268
5358
  }
5269
5359
  }
5270
- function locateNonHydratedAsyncRoot(instance) {
5360
+ function locateUnresolvedAsyncRoot(instance) {
5271
5361
  const subComponent = instance.subTree && instance.subTree.component;
5272
5362
  if (subComponent) {
5273
5363
  if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
5274
- else return locateNonHydratedAsyncRoot(subComponent);
5364
+ else return locateUnresolvedAsyncRoot(subComponent);
5275
5365
  }
5276
5366
  }
5277
5367
  function invalidateMount(hooks) {
@@ -5341,7 +5431,9 @@ function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true
5341
5431
  function resolveAsyncComponentPlaceholder(anchorVnode) {
5342
5432
  if (anchorVnode.placeholder) return anchorVnode.placeholder;
5343
5433
  const instance = anchorVnode.component;
5344
- if (instance) return resolveAsyncComponentPlaceholder(instance.subTree);
5434
+ if (instance && instance.subTree) return resolveAsyncComponentPlaceholder(instance.subTree);
5435
+ const suspense = anchorVnode.suspense;
5436
+ if (suspense && suspense.activeBranch) return resolveAsyncComponentPlaceholder(suspense.activeBranch);
5345
5437
  return null;
5346
5438
  }
5347
5439
  //#endregion
@@ -5353,17 +5445,22 @@ function withSuspenseEnabled(value) {
5353
5445
  return value;
5354
5446
  }
5355
5447
  let suspenseId = 0;
5448
+ const deferredEnterKey = Symbol("_deferredEnter");
5356
5449
  const Suspense = /*@__PURE__*/ withSuspenseEnabled({
5357
5450
  name: "Suspense",
5358
5451
  __isSuspense: true,
5359
5452
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
5360
5453
  if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
5361
5454
  else {
5362
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
5363
- n2.suspense = n1.suspense;
5364
- n2.suspense.vnode = n2;
5365
- n2.el = n1.el;
5366
- return;
5455
+ const suspense = n1.suspense;
5456
+ if (parentSuspense && parentSuspense.deps > 0 && !parentSuspense.isHydrating) {
5457
+ const owner = suspense.parentComponent;
5458
+ if (!!owner && owner.suspense === parentSuspense && owner.suspenseId !== parentSuspense.pendingId ? parentSuspense.pendingBranch && !isSameVNodeType(n2.ssContent, suspense.pendingBranch || suspense.activeBranch) : !suspense.isInFallback) {
5459
+ n2.suspense = suspense;
5460
+ suspense.vnode = n2;
5461
+ n2.el = n1.el;
5462
+ return;
5463
+ }
5367
5464
  }
5368
5465
  patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, rendererInternals);
5369
5466
  }
@@ -5375,6 +5472,36 @@ function triggerEvent(vnode, name) {
5375
5472
  const eventListener = vnode.props && vnode.props[name];
5376
5473
  if ((0, _vue_shared.isFunction)(eventListener)) eventListener();
5377
5474
  }
5475
+ function enterDeferred(suspense, branch) {
5476
+ const enters = [];
5477
+ collectDeferredEnters(branch, enters, true);
5478
+ if (isVaporInteropEnabled) {
5479
+ const { parentComponent } = suspense;
5480
+ const vapor = parentComponent && parentComponent.appContext.vapor;
5481
+ if (vapor) vapor.enterDeferred(suspense, enters);
5482
+ }
5483
+ if (enters.length) queuePostFlushCb(enters);
5484
+ }
5485
+ function collectDeferredEnters(vnode, enters, isRoot) {
5486
+ const { el, transition, children, shapeFlag } = vnode;
5487
+ if (shapeFlag & 6) {
5488
+ const subTree = vnode.component.subTree;
5489
+ if (subTree) collectDeferredEnters(subTree, enters, isRoot);
5490
+ return;
5491
+ }
5492
+ if (shapeFlag & 192) return;
5493
+ if (shapeFlag & 1) {
5494
+ if (!isRoot && el && el[deferredEnterKey]) {
5495
+ el[deferredEnterKey] = void 0;
5496
+ if (transition && !transition.persisted) {
5497
+ transition.beforeEnter(el);
5498
+ enters.push(() => transition.enter(el));
5499
+ }
5500
+ }
5501
+ isRoot = false;
5502
+ }
5503
+ if (shapeFlag & 16) for (let i = 0; i < children.length; i++) collectDeferredEnters(children[i], enters, isRoot);
5504
+ }
5378
5505
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
5379
5506
  const { p: patch, o: { createElement } } = rendererInternals;
5380
5507
  const hiddenContainer = createElement("div");
@@ -5414,11 +5541,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5414
5541
  suspense.activeBranch = pendingBranch;
5415
5542
  } else unmount(pendingBranch, parentComponent, suspense);
5416
5543
  suspense.deps = 0;
5417
- for (let i = 0; i < suspense.effects.length; i++) {
5418
- const effect = suspense.effects[i];
5419
- if (effect.flags & 8) queuePostFlushCb(effect);
5420
- }
5421
- suspense.effects.length = 0;
5544
+ discardEffects(suspense);
5422
5545
  suspense.hiddenContainer = createElement("div");
5423
5546
  if (isInFallback) {
5424
5547
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
@@ -5441,14 +5564,14 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5441
5564
  } else {
5442
5565
  triggerEvent(n2, "onPending");
5443
5566
  suspense.pendingBranch = newBranch;
5444
- if (newBranch.shapeFlag & 512) suspense.pendingId = newBranch.component.suspenseId;
5445
- else suspense.pendingId = suspenseId++;
5567
+ suspense.pendingId = suspenseId++;
5446
5568
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
5447
5569
  if (suspense.deps <= 0) suspense.resolve();
5448
5570
  else {
5449
- const { timeout, pendingId } = suspense;
5450
- if (timeout > 0) setTimeout(() => {
5451
- if (suspense.pendingId === pendingId) suspense.fallback(newFallback);
5571
+ const { timeout } = suspense;
5572
+ if (timeout > 0) suspense.timeoutTimer = setTimeout(() => {
5573
+ suspense.timeoutTimer = void 0;
5574
+ suspense.fallback(suspense.vnode.ssFallback);
5452
5575
  }, timeout);
5453
5576
  else if (timeout === 0) suspense.fallback(newFallback);
5454
5577
  }
@@ -5484,6 +5607,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5484
5607
  deps: 0,
5485
5608
  pendingId: suspenseId++,
5486
5609
  timeout: typeof timeout === "number" ? timeout : -1,
5610
+ timeoutTimer: void 0,
5487
5611
  activeBranch: null,
5488
5612
  isFallbackMountPending: false,
5489
5613
  pendingBranch: null,
@@ -5501,26 +5625,39 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5501
5625
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
5502
5626
  let hasUpdatedAnchor = false;
5503
5627
  if (delayEnter) activeBranch.transition.afterLeave = () => {
5504
- if (pendingId === suspense.pendingId) {
5628
+ if (pendingId === suspense.pendingId && !suspense.isUnmounted) {
5629
+ enterDeferred(suspense, pendingBranch);
5505
5630
  move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5506
5631
  queuePostFlushCb(effects);
5507
5632
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5508
5633
  }
5509
5634
  };
5510
5635
  if (activeBranch && !suspense.isFallbackMountPending) {
5511
- if (parentNode(activeBranch.el) === container) {
5636
+ if (parentNode(activeBranch.el || resolveAsyncComponentPlaceholder(activeBranch)) === container) {
5512
5637
  anchor = next(activeBranch);
5513
5638
  hasUpdatedAnchor = true;
5514
5639
  }
5515
5640
  unmount(activeBranch, parentComponent, suspense, true);
5516
5641
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5517
5642
  }
5518
- if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
5643
+ if (!delayEnter) {
5644
+ enterDeferred(suspense, pendingBranch);
5645
+ move(pendingBranch, container, anchor, 0, parentComponent);
5646
+ }
5519
5647
  }
5648
+ clearTimeout(suspense.timeoutTimer);
5649
+ suspense.timeoutTimer = void 0;
5520
5650
  suspense.isFallbackMountPending = false;
5521
5651
  setActiveBranch(suspense, pendingBranch);
5522
5652
  suspense.pendingBranch = null;
5523
5653
  suspense.isInFallback = false;
5654
+ let kept = 0;
5655
+ for (let i = 0; i < effects.length; i++) {
5656
+ const effect = effects[i];
5657
+ if (effect.flags & 16) queuePostFlushCb(effect);
5658
+ else effects[kept++] = effect;
5659
+ }
5660
+ effects.length = kept;
5524
5661
  let parent = suspense.parent;
5525
5662
  let hasUnresolvedAncestor = false;
5526
5663
  while (parent) {
@@ -5543,13 +5680,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5543
5680
  triggerEvent(vnode, "onResolve");
5544
5681
  },
5545
5682
  fallback(fallbackVNode) {
5546
- if (!suspense.pendingBranch) return;
5683
+ if (suspense.isUnmounted || !suspense.pendingBranch) return;
5547
5684
  const { vnode, activeBranch, parentComponent, container, namespace } = suspense;
5548
5685
  triggerEvent(vnode, "onFallback");
5549
5686
  const anchor = next(activeBranch);
5550
5687
  const mountFallback = () => {
5551
5688
  suspense.isFallbackMountPending = false;
5552
- if (!suspense.isInFallback) return;
5689
+ if (suspense.isUnmounted || !suspense.isInFallback) return;
5553
5690
  const latestFallback = suspense.vnode.ssFallback;
5554
5691
  patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
5555
5692
  setActiveBranch(suspense, latestFallback);
@@ -5573,24 +5710,52 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5573
5710
  registerDep(instance, onResolve) {
5574
5711
  const isInPendingSuspense = !!suspense.pendingBranch;
5575
5712
  if (isInPendingSuspense) suspense.deps++;
5713
+ const render = (setupResult) => {
5714
+ instance.asyncResolved = true;
5715
+ onResolve(setupResult);
5716
+ };
5576
5717
  instance.asyncDep.catch((err) => {
5577
- handleError(err, instance, 0);
5718
+ handleError(err, instance, 0, false, true);
5719
+ return () => null;
5578
5720
  }).then((asyncSetupResult) => {
5579
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
5721
+ if (instance.isUnmounted || suspense.isUnmounted) return;
5722
+ const isPendingDep = isInPendingSuspense && suspense.pendingId === instance.suspenseId;
5580
5723
  setCurrentInstance(null, void 0);
5581
5724
  if (!instance.scope.active) {
5582
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
5725
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
5583
5726
  return;
5584
5727
  }
5585
- instance.asyncResolved = true;
5586
- onResolve(asyncSetupResult);
5587
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
5728
+ if (!isPendingDep && suspense.pendingBranch) {
5729
+ const job = () => {
5730
+ if (instance.isUnmounted || suspense.isUnmounted || !instance.scope.active) return;
5731
+ if (suspense.pendingBranch) queueEffectWithSuspense(job, void 0, suspense);
5732
+ else render(asyncSetupResult);
5733
+ };
5734
+ job.flags = 24;
5735
+ queueEffectWithSuspense(job, void 0, suspense);
5736
+ return;
5737
+ }
5738
+ render(asyncSetupResult);
5739
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
5588
5740
  });
5589
5741
  },
5590
5742
  unmount(parentSuspense, doRemove) {
5591
5743
  suspense.isUnmounted = true;
5744
+ clearTimeout(suspense.timeoutTimer);
5745
+ suspense.timeoutTimer = void 0;
5746
+ if (parentSuspenseId !== void 0) {
5747
+ const parent = suspense.parent;
5748
+ const pendingId = parentSuspenseId;
5749
+ parentSuspenseId = void 0;
5750
+ queuePostFlushCb(() => {
5751
+ if (parent.pendingId === pendingId && !parent.isUnmounted && --parent.deps === 0) parent.resolve();
5752
+ });
5753
+ }
5592
5754
  if (suspense.activeBranch) unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
5593
- if (suspense.pendingBranch) unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
5755
+ if (suspense.pendingBranch) {
5756
+ unmount(suspense.pendingBranch, parentComponent, suspense, doRemove);
5757
+ discardEffects(suspense);
5758
+ }
5594
5759
  }
5595
5760
  };
5596
5761
  return suspense;
@@ -5631,6 +5796,14 @@ function normalizeSuspenseSlot(s) {
5631
5796
  if (block && !s.dynamicChildren) s.dynamicChildren = block.filter((c) => c !== s);
5632
5797
  return s;
5633
5798
  }
5799
+ function discardEffects(suspense) {
5800
+ const { effects } = suspense;
5801
+ for (let i = 0; i < effects.length; i++) {
5802
+ const effect = effects[i];
5803
+ if (effect.flags & 8) queuePostFlushCb(effect);
5804
+ }
5805
+ effects.length = 0;
5806
+ }
5634
5807
  function queueEffectWithSuspense(fn, id, suspense) {
5635
5808
  if (suspense && suspense.pendingBranch) {
5636
5809
  if ((0, _vue_shared.isArray)(fn)) suspense.effects.push(...fn);
@@ -5855,7 +6028,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5855
6028
  }
5856
6029
  function guardReactiveProps(props) {
5857
6030
  if (!props) return null;
5858
- return (0, _vue_reactivity.isProxy)(props) || isInternalObject(props) ? (0, _vue_shared.extend)({}, props) : props;
6031
+ if ((0, _vue_reactivity.isProxy)(props)) return (0, _vue_shared.extend)({}, props);
6032
+ return isInternalObject(props) ? (0, _vue_shared.extend)({}, props[rawAttrsKey] || props) : props;
5859
6033
  }
5860
6034
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
5861
6035
  const { props, ref, patchFlag, children, transition } = vnode;
@@ -5968,6 +6142,17 @@ function normalizeVNode(child) {
5968
6142
  function cloneIfMounted(child) {
5969
6143
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
5970
6144
  }
6145
+ let deferElementSlots = false;
6146
+ /**
6147
+ * While enabled, compiled default slots passed as children of plain elements
6148
+ * are kept on the vnode so the server renderer can render them in push mode.
6149
+ * @internal
6150
+ */
6151
+ function setDeferElementSlots(value) {
6152
+ const prev = deferElementSlots;
6153
+ deferElementSlots = value;
6154
+ return prev;
6155
+ }
5971
6156
  function normalizeChildren(vnode, children) {
5972
6157
  let type = 0;
5973
6158
  const { shapeFlag } = vnode;
@@ -5976,6 +6161,11 @@ function normalizeChildren(vnode, children) {
5976
6161
  else if (typeof children === "object") {
5977
6162
  if (shapeFlag & 65) {
5978
6163
  const slot = children.default;
6164
+ if (deferElementSlots && slot && slot._c && shapeFlag & 1) {
6165
+ vnode.children = children;
6166
+ vnode.shapeFlag |= 32;
6167
+ return;
6168
+ }
5979
6169
  if (slot) {
5980
6170
  slot._c && (slot._d = false);
5981
6171
  normalizeChildren(vnode, slot());
@@ -6250,7 +6440,8 @@ function setupStatefulComponent(instance, isSSR) {
6250
6440
  setInSSRSetupState(false);
6251
6441
  }
6252
6442
  }).catch((e) => {
6253
- handleError(e, instance, 0);
6443
+ handleError(e, instance, 0, void 0, true);
6444
+ instance.ssrRender = (_, push) => push("<!---->");
6254
6445
  });
6255
6446
  else {
6256
6447
  instance.asyncDep = setupResult;
@@ -6321,11 +6512,16 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6321
6512
  else warn$1(`Component is missing template or render function: `, Component);
6322
6513
  }
6323
6514
  }
6515
+ /**
6516
+ * Read through the setup context `attrs` proxy to get the raw attrs object.
6517
+ * @internal
6518
+ */
6519
+ const rawAttrsKey = Symbol();
6324
6520
  const attrsProxyHandlers = {
6325
6521
  get(target, key) {
6326
6522
  markAttrsAccessed();
6327
6523
  (0, _vue_reactivity.track)(target, "get", "");
6328
- return target[key];
6524
+ return key === rawAttrsKey ? target : target[key];
6329
6525
  },
6330
6526
  set() {
6331
6527
  warn$1(`setupContext.attrs is readonly.`);
@@ -6623,7 +6819,7 @@ function isMemoSame(cached, memo) {
6623
6819
  }
6624
6820
  //#endregion
6625
6821
  //#region packages/runtime-core/src/index.ts
6626
- const version = "3.6.0-rc.14";
6822
+ const version = "3.6.0-rc.15";
6627
6823
  const warn = warn$1;
6628
6824
  /**
6629
6825
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6649,7 +6845,8 @@ const ssrUtils = {
6649
6845
  popWarningContext,
6650
6846
  VaporSlot,
6651
6847
  rawVaporSlotKey,
6652
- invokeSlotFallback
6848
+ invokeSlotFallback,
6849
+ setDeferElementSlots
6653
6850
  };
6654
6851
  /**
6655
6852
  * @internal only exposed in compat builds