@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,10 +1,10 @@
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
  **/
6
- import { EffectScope, EffectScope as EffectScope$1, ReactiveEffect, ReactiveEffect as ReactiveEffect$1, TrackOpTypes, TriggerOpTypes, WatcherEffect, computed as computed$1, customRef, customRef as customRef$1, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isProxy as isProxy$1, isReactive, isReactive as isReactive$1, isReadonly, isReadonly as isReadonly$1, isRef, isRef as isRef$1, isShallow, isShallow as isShallow$1, markRaw, markRaw as markRaw$1, onScopeDispose, onWatcherCleanup, proxyRefs, proxyRefs as proxyRefs$1, reactive, reactive as reactive$1, readonly, readonly as readonly$1, ref, ref as ref$1, setActiveSub, setCurrentScope, shallowReactive, shallowReactive as shallowReactive$1, shallowReadArray, shallowReadonly, shallowReadonly as shallowReadonly$1, shallowRef, shallowRef as shallowRef$1, stop, toRaw, toRaw as toRaw$1, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref } from "@vue/reactivity";
7
- import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, camelize as camelize$1, capitalize, capitalize as capitalize$1, def, extend, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isFunction, isGloballyAllowed, isKnownHtmlAttr, isKnownSvgAttr, isModelListener, isObject, isOn, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isString, isSymbol, looseEqual, looseToNumber, makeMap, normalizeClass, normalizeClass as normalizeClass$1, normalizeCssVarValue, normalizeProps, normalizeStyle, normalizeStyle as normalizeStyle$1, remove, stringifyStyle, toDisplayString, toHandlerKey, toHandlerKey as toHandlerKey$1, toNumber, toRawType } from "@vue/shared";
6
+ import { EffectScope, EffectScope as EffectScope$1, ReactiveEffect, ReactiveEffect as ReactiveEffect$1, TrackOpTypes, TriggerOpTypes, WatcherEffect, computed as computed$1, customRef, customRef as customRef$1, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isProxy as isProxy$1, isReactive, isReactive as isReactive$1, isReadonly, isReadonly as isReadonly$1, isRef, isRef as isRef$1, isShallow, isShallow as isShallow$1, markRaw, markRaw as markRaw$1, onScopeDispose, onScopeDispose as onScopeDispose$1, onWatcherCleanup, proxyRefs, proxyRefs as proxyRefs$1, reactive, reactive as reactive$1, readonly, readonly as readonly$1, ref, ref as ref$1, setActiveSub, setCurrentScope, shallowReactive, shallowReactive as shallowReactive$1, shallowReadArray, shallowReadonly, shallowReadonly as shallowReadonly$1, shallowRef, shallowRef as shallowRef$1, stop, toRaw, toRaw as toRaw$1, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref } from "@vue/reactivity";
7
+ import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, camelize as camelize$1, capitalize, capitalize as capitalize$1, def, extend, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isFunction, isGloballyAllowed, isKnownHtmlAttr, isKnownSvgAttr, isModelListener, isObject, isOn, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isString, isSymbol, isVaporBranchStart, isVaporRangeStart, looseEqual, looseToNumber, makeMap, normalizeClass, normalizeClass as normalizeClass$1, normalizeCssVarValue, normalizeProps, normalizeStyle, normalizeStyle as normalizeStyle$1, rangeCloseOf, remove, stringifyStyle, toDisplayString, toHandlerKey, toHandlerKey as toHandlerKey$1, toNumber, toRawType } from "@vue/shared";
8
8
  //#region packages/runtime-core/src/warning.ts
9
9
  const stack = [];
10
10
  /**
@@ -198,7 +198,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
198
198
  if (isFunction(fn)) {
199
199
  const res = callWithErrorHandling(fn, instance, type, args);
200
200
  if (res && isPromise(res)) res.catch((err) => {
201
- handleError(err, instance, type);
201
+ handleError(err, instance, type, void 0, true);
202
202
  });
203
203
  return res;
204
204
  }
@@ -208,7 +208,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
208
208
  return values;
209
209
  } else if (!!(process.env.NODE_ENV !== "production")) warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);
210
210
  }
211
- function handleError(err, instance, type, throwInDev = true) {
211
+ function handleError(err, instance, type, throwInDev = true, isAsyncError = false) {
212
212
  const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
213
213
  if (instance) {
214
214
  let cur = instance.parent;
@@ -216,7 +216,7 @@ function handleError(err, instance, type, throwInDev = true) {
216
216
  const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
217
217
  while (cur) {
218
218
  const errorCapturedHooks = cur.ec;
219
- if (errorCapturedHooks) {
219
+ if (errorCapturedHooks && !cur.isUnmounted && (!isAsyncError || cur.scope.active)) {
220
220
  for (let i = 0; i < errorCapturedHooks.length; i++) if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) return;
221
221
  }
222
222
  cur = cur.parent;
@@ -255,7 +255,9 @@ const SchedulerJobFlags = {
255
255
  "DISPOSED": 4,
256
256
  "4": "DISPOSED",
257
257
  "REQUEUE_ON_SUSPENSE_DISCARD": 8,
258
- "8": "REQUEUE_ON_SUSPENSE_DISCARD"
258
+ "8": "REQUEUE_ON_SUSPENSE_DISCARD",
259
+ "FLUSH_ON_SUSPENSE_RESOLVE": 16,
260
+ "16": "FLUSH_ON_SUSPENSE_RESOLVE"
259
261
  };
260
262
  const jobs = [];
261
263
  let postJobs = [];
@@ -532,7 +534,11 @@ function reload(id, newComp) {
532
534
  updateComponentDef(record.initialDef, newComp);
533
535
  const instances = [...record.instances];
534
536
  if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
535
- for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
537
+ for (const instance of instances) {
538
+ if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
539
+ const oldComp = normalizeClassComponent(instance.type);
540
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
541
+ }
536
542
  const dirtyInstances = new Set(instances);
537
543
  const rerenderedParents = /* @__PURE__ */ new Set();
538
544
  runWithHmrUpdating(() => {
@@ -573,7 +579,25 @@ function reload(id, newComp) {
573
579
  if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
574
580
  }
575
581
  parents.forEach((parent) => {
576
- queueJob(() => {
582
+ const children = instances.filter((instance) => instance.parent === parent);
583
+ const update = () => {
584
+ if (!parent.scope.active) return;
585
+ const activeChildren = children.filter((instance) => instance.scope.active);
586
+ if (!activeChildren.length) return;
587
+ const pending = activeChildren.find((instance) => instance.asyncDep && !instance.asyncResolved) || locateUnresolvedAsyncRoot(parent);
588
+ if (pending) {
589
+ pending.asyncDep.catch(NOOP).then(() => {
590
+ if (parent.scope.active && (pending.asyncResolved || !pending.scope.active)) queueJob(update);
591
+ });
592
+ return;
593
+ }
594
+ for (const instance of activeChildren) {
595
+ const oldComp = normalizeClassComponent(instance.type);
596
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
597
+ if (!dirtyInstances) hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
598
+ dirtyInstances.add(instance);
599
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
600
+ }
577
601
  runWithHmrUpdating(() => {
578
602
  if (parent.vapor) parent.hmrRerender();
579
603
  else {
@@ -584,7 +608,12 @@ function reload(id, newComp) {
584
608
  }
585
609
  }
586
610
  });
587
- });
611
+ queuePostFlushCb(() => {
612
+ hmrDirtyComponents.clear();
613
+ hmrDirtyComponentsMode.clear();
614
+ });
615
+ };
616
+ queueJob(update);
588
617
  });
589
618
  }
590
619
  queuePostFlushCb(() => {
@@ -781,18 +810,35 @@ function withDirectives(vnode, directives) {
781
810
  return vnode;
782
811
  }
783
812
  function invokeDirectiveHook(vnode, prevVNode, instance, name) {
784
- const bindings = vnode.dirs;
813
+ let hookVNode = vnode;
814
+ if (name === "beforeMount") vnode._mount = vnode;
815
+ else if (name === "beforeUpdate") {
816
+ const mount = prevVNode && prevVNode._mount;
817
+ if (mount) {
818
+ mount._latest = vnode;
819
+ vnode._mount = mount;
820
+ }
821
+ } else if (name === "mounted") {
822
+ const latest = vnode._latest;
823
+ vnode._mount = vnode._latest = void 0;
824
+ if (latest) {
825
+ hookVNode = latest;
826
+ latest._mount = void 0;
827
+ }
828
+ }
829
+ const bindings = hookVNode.dirs;
785
830
  const oldBindings = prevVNode && prevVNode.dirs;
786
831
  for (let i = 0; i < bindings.length; i++) {
787
- const binding = bindings[i];
832
+ let binding = bindings[i];
788
833
  if (oldBindings) binding.oldValue = oldBindings[i].value;
834
+ else if (name === "mounted" && binding.oldValue !== void 0) binding = extend({}, binding, { oldValue: void 0 });
789
835
  let hook = binding.dir[name];
790
836
  if (hook) {
791
837
  const prevSub = setActiveSub();
792
838
  callWithAsyncErrorHandling(hook, instance, 8, [
793
839
  vnode.el,
794
840
  binding,
795
- vnode,
841
+ hookVNode,
796
842
  prevVNode
797
843
  ]);
798
844
  setActiveSub(prevSub);
@@ -1237,7 +1283,15 @@ const BaseTransitionImpl = {
1237
1283
  const { mode } = rawProps;
1238
1284
  checkTransitionMode(mode);
1239
1285
  return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
1240
- if (!(instance.effect.flags & 1024)) instance.update();
1286
+ if (!(instance.effect.flags & 1024)) {
1287
+ if (instance.effect.running) {
1288
+ const job = () => {
1289
+ if (!(instance.effect.flags & 1024)) instance.update();
1290
+ };
1291
+ job.i = instance;
1292
+ queueJob(job);
1293
+ } else instance.update();
1294
+ }
1241
1295
  }) : NOOP);
1242
1296
  };
1243
1297
  }
@@ -1268,7 +1322,7 @@ function getLeavingNodesForType(state, vnode) {
1268
1322
  }
1269
1323
  return leavingVNodesCache;
1270
1324
  }
1271
- function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1325
+ function resolveTransitionHooks(vnode, props, state, instance) {
1272
1326
  const key = String(vnode.key);
1273
1327
  const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1274
1328
  const hooks = baseResolveTransitionHooks({
@@ -1291,9 +1345,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1291
1345
  }
1292
1346
  },
1293
1347
  cloneHooks: (vnode) => {
1294
- const hooks = resolveTransitionHooks(vnode, props, state, instance, postClone);
1295
- if (postClone) postClone(hooks);
1296
- return hooks;
1348
+ return resolveTransitionHooks(vnode, props, state, instance);
1297
1349
  }
1298
1350
  }, props, state, instance);
1299
1351
  if (isVaporInteropEnabled && vnode.type === VaporSlot) extend(hooks, {
@@ -1331,7 +1383,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1331
1383
  callHook(hook, [el]);
1332
1384
  },
1333
1385
  enter(el) {
1334
- if (!isHmrUpdating && isLeaving()) return;
1386
+ if (!isHmrUpdating && isLeaving(el)) return;
1335
1387
  let hook = onEnter;
1336
1388
  let afterHook = onAfterEnter;
1337
1389
  let cancelHook = onEnterCancelled;
@@ -1375,7 +1427,19 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1375
1427
  else done();
1376
1428
  },
1377
1429
  clone(node) {
1378
- return cloneHooks ? cloneHooks(node) : hooks;
1430
+ if (!cloneHooks) return hooks;
1431
+ const cloned = cloneHooks(node);
1432
+ cloned.afterLeave = () => {
1433
+ if (hooks.afterLeave) hooks.afterLeave();
1434
+ };
1435
+ cloned.delayLeave = (el, earlyRemove, delayedLeave) => {
1436
+ if (hooks.delayLeave) hooks.delayLeave(el, earlyRemove, delayedLeave);
1437
+ else delayedLeave();
1438
+ };
1439
+ cloned.delayedLeave = () => {
1440
+ if (hooks.delayedLeave) hooks.delayedLeave();
1441
+ };
1442
+ return cloned;
1379
1443
  }
1380
1444
  };
1381
1445
  return hooks;
@@ -1410,10 +1474,7 @@ function prepareTransitionSwitch(previous, next, props, state, instance, resumeA
1410
1474
  if (state.isLeaving) return emptyPlaceholder(next);
1411
1475
  const nextInner = getInnerChild$1(next);
1412
1476
  if (!nextInner) return emptyPlaceholder(next);
1413
- let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
1414
- if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
1415
- enterHooks = hooks;
1416
- });
1477
+ const enterHooks = resolveTransitionHooks(nextInner, props, state, instance);
1417
1478
  if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
1418
1479
  if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
1419
1480
  const mode = props.mode;
@@ -1497,9 +1558,14 @@ function setTransitionHooks(vnode, hooks) {
1497
1558
  return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
1498
1559
  }
1499
1560
  } else if (vnode.shapeFlag & 128) {
1500
- const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1501
- const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1502
- return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
1561
+ const suspense = vnode.suspense;
1562
+ if (suspense) {
1563
+ const branch = suspense.isHydrating ? suspense.pendingBranch : suspense.activeBranch;
1564
+ if (branch) return setTransitionHooks(branch, hooks.clone(branch));
1565
+ } else {
1566
+ vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1567
+ vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1568
+ }
1503
1569
  } else {
1504
1570
  vnode.transition = hooks;
1505
1571
  if (vnode.type === Fragment && isArray(vnode.children)) {
@@ -1726,6 +1792,8 @@ const getContainerType = (container) => {
1726
1792
  if (isMathMLContainer(container)) return "mathml";
1727
1793
  };
1728
1794
  const isComment = (node) => node.nodeType === 8;
1795
+ /** The data of a comment opening a range a hydration steps over as one. */
1796
+ const isRangeStart = (data) => data === "[" || data === "(" || isVaporRangeStart(data);
1729
1797
  function createHydrationFunctions(rendererInternals) {
1730
1798
  const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
1731
1799
  const hydrate = (vnode, container) => {
@@ -1745,7 +1813,7 @@ function createHydrationFunctions(rendererInternals) {
1745
1813
  };
1746
1814
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
1747
1815
  optimized = optimized || !!vnode.dynamicChildren;
1748
- const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(");
1816
+ const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(" || isVaporInteropEnabled && isVaporRangeStart(node.data));
1749
1817
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
1750
1818
  const { type, ref, shapeFlag, patchFlag } = vnode;
1751
1819
  let domType = node.nodeType;
@@ -1940,16 +2008,17 @@ function createHydrationFunctions(rendererInternals) {
1940
2008
  const container = parentNode(node);
1941
2009
  const first = nextSibling(node);
1942
2010
  const next = isVaporInteropEnabled && vnode.vo && node.data === "(" ? getVaporInterface(parentComponent, vnode).hydrateSlotOutlet(vnode, node, parentComponent, parentSuspense, slotScopeIds) : hydrateChildren(first, vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
1943
- if (next && isComment(next) && next.data === (node.data === "(" ? ")" : "]")) return nextSibling(vnode.anchor = next);
2011
+ const close = isVaporInteropEnabled ? rangeCloseOf(node.data) : node.data === "(" ? ")" : "]";
2012
+ if (next && isComment(next) && next.data === close) return nextSibling(vnode.anchor = next);
1944
2013
  else {
1945
2014
  logMismatchError();
1946
- insert(vnode.anchor = createComment(`]`), container, next);
2015
+ insert(vnode.anchor = createComment(close), container, next);
1947
2016
  return next;
1948
2017
  }
1949
2018
  };
1950
2019
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1951
2020
  if (!isNodeMismatchAllowed(node, vnode)) {
1952
- (process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && (node.data === "[" || node.data === "(") ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
2021
+ (process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && isRangeStart(node.data) ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
1953
2022
  logMismatchError();
1954
2023
  }
1955
2024
  vnode.el = null;
@@ -1965,18 +2034,18 @@ function createHydrationFunctions(rendererInternals) {
1965
2034
  const container = parentNode(node);
1966
2035
  remove(node);
1967
2036
  patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1968
- if (parentComponent && parentComponent.vnode) {
2037
+ if (parentComponent && parentComponent.vnode && parentComponent.vnode.el === node) {
1969
2038
  parentComponent.vnode.el = vnode.el;
1970
2039
  updateHOCHostEl(parentComponent, vnode.el);
1971
2040
  }
1972
2041
  return next;
1973
2042
  };
1974
- const locateClosingAnchor = (node, open = node && isComment(node) && node.data === "(" ? "(" : "[", close = open === "(" ? ")" : "]") => {
2043
+ const locateClosingAnchor = (node, open = node && isComment(node) && (node.data === "(" || isVaporInteropEnabled && node.data === "{") ? node.data : "[", close = isVaporInteropEnabled ? rangeCloseOf(open) : open === "(" ? ")" : "]") => {
1975
2044
  let match = 0;
1976
2045
  while (node) {
1977
2046
  node = nextSibling(node);
1978
2047
  if (node && isComment(node)) {
1979
- if (node.data === open) match++;
2048
+ if (node.data === open || isVaporInteropEnabled && open === "[" && isVaporBranchStart(node.data)) match++;
1980
2049
  if (node.data === close) {
1981
2050
  if (match === 0) return nextSibling(node);
1982
2051
  else match--;
@@ -2244,9 +2313,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
2244
2313
  return teardown;
2245
2314
  };
2246
2315
  function forEachElement(node, cb) {
2247
- if (isComment(node) && (node.data === "[" || node.data === "(")) {
2316
+ if (isComment(node) && isRangeStart(node.data)) {
2248
2317
  const open = node.data;
2249
- const close = open === "[" ? "]" : ")";
2318
+ const close = rangeCloseOf(open);
2250
2319
  let depth = 1;
2251
2320
  let next = node.nextSibling;
2252
2321
  while (next) {
@@ -2255,7 +2324,7 @@ function forEachElement(node, cb) {
2255
2324
  } else if (isComment(next)) {
2256
2325
  if (next.data === close) {
2257
2326
  if (--depth === 0) break;
2258
- } else if (next.data === open) depth++;
2327
+ } else if (close === "]" ? next.data === "[" || isVaporBranchStart(next.data) : next.data === open) depth++;
2259
2328
  }
2260
2329
  next = next.nextSibling;
2261
2330
  }
@@ -2283,7 +2352,7 @@ function defineAsyncComponent(source) {
2283
2352
  if (resolvedComp) return () => createInnerComp(resolvedComp, instance);
2284
2353
  const onError = (err) => {
2285
2354
  setPendingRequest(null);
2286
- handleError(err, instance, 13, !errorComponent);
2355
+ handleError(err, instance, 13, !errorComponent, true);
2287
2356
  };
2288
2357
  if (suspensible && instance.suspense || isInSSRComponentSetup) return load().then((comp) => {
2289
2358
  return () => createInnerComp(comp, instance);
@@ -2364,10 +2433,12 @@ const useAsyncComponentState = (delay = 200, timeout, onError, instance = curren
2364
2433
  const delayed = ref$1(!!delay);
2365
2434
  let timeoutTimer;
2366
2435
  let delayTimer;
2367
- if (instance) onUnmounted(() => {
2368
- if (timeoutTimer != null) clearTimeout(timeoutTimer);
2369
- if (delayTimer != null) clearTimeout(delayTimer);
2370
- }, instance);
2436
+ if (instance) instance.scope.run(() => {
2437
+ onScopeDispose$1(() => {
2438
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
2439
+ if (delayTimer != null) clearTimeout(delayTimer);
2440
+ });
2441
+ });
2371
2442
  if (delay) delayTimer = setTimeout(() => {
2372
2443
  if (instance && instance.isUnmounted) return;
2373
2444
  delayed.value = false;
@@ -2402,7 +2473,12 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
2402
2473
  }
2403
2474
  return;
2404
2475
  }
2405
- if (!el.parentNode || wasConnected && !el.isConnected) return;
2476
+ if (!el.parentNode) return;
2477
+ if (wasConnected && !el.isConnected) {
2478
+ let current = instance;
2479
+ while (current && !current.isDeactivated) current = current.parent;
2480
+ if (!current) return;
2481
+ }
2406
2482
  hydrate();
2407
2483
  };
2408
2484
  const doHydrate = hydrateStrategy ? () => {
@@ -2460,7 +2536,11 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
2460
2536
  activate(vnode, container, anchor, renderer, keepAliveInstance, parentSuspense, namespace, optimized);
2461
2537
  };
2462
2538
  sharedContext.deactivate = (vnode) => {
2463
- deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
2539
+ const cached = sharedContext.getCachedComponent(vnode);
2540
+ if (!cached || cached.component !== vnode.component) return false;
2541
+ if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(keepAliveInstance, vnode).deactivate(vnode, storageContainer, parentSuspense);
2542
+ else deactivate(vnode, storageContainer, renderer, keepAliveInstance, parentSuspense);
2543
+ return true;
2464
2544
  };
2465
2545
  function unmount(vnode) {
2466
2546
  resetShapeFlag(vnode);
@@ -2492,11 +2572,15 @@ const KeepAlive = /*@__PURE__*/ withKeepAliveEnabled({
2492
2572
  let pendingCacheKey = null;
2493
2573
  const cacheSubtree = () => {
2494
2574
  if (pendingCacheKey != null) {
2495
- if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
2496
- const vnode = getInnerChild(keepAliveInstance.subTree);
2497
- if (vnode.component) cache.set(pendingCacheKey, vnode);
2498
- }, void 0, keepAliveInstance.subTree.suspense);
2499
- else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
2575
+ if (isSuspense(keepAliveInstance.subTree.type)) {
2576
+ const cacheInnerChild = () => {
2577
+ const vnode = getInnerChild(keepAliveInstance.subTree);
2578
+ if (vnode.component) cache.set(pendingCacheKey, vnode);
2579
+ };
2580
+ const suspense = keepAliveInstance.subTree.suspense;
2581
+ if (suspense.pendingBranch) queuePostRenderEffect(cacheInnerChild, void 0, suspense);
2582
+ else cacheInnerChild();
2583
+ } else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
2500
2584
  }
2501
2585
  };
2502
2586
  onMounted(cacheSubtree);
@@ -2601,9 +2685,8 @@ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance())
2601
2685
  }
2602
2686
  function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
2603
2687
  const injected = injectHook(type, hook, keepAliveRoot, true);
2604
- onUnmounted(() => {
2605
- remove(keepAliveRoot[type], injected);
2606
- }, target);
2688
+ const removal = injectHook("um", () => remove(keepAliveRoot[type], injected), target);
2689
+ removal.flags = 8;
2607
2690
  }
2608
2691
  function resetShapeFlag(vnode) {
2609
2692
  vnode.shapeFlag &= -257;
@@ -2828,6 +2911,11 @@ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
2828
2911
  ret.props = extend({}, ret.props, { key: branchKey });
2829
2912
  ret.key = branchKey;
2830
2913
  }
2914
+ if (isBlockTreeEnabled <= 0) {
2915
+ if (!ret.vs.props) ret.vs.props = ret.props;
2916
+ ret.props = ret.key != null ? { key: ret.key } : null;
2917
+ ret.vs.attrs = EMPTY_OBJ;
2918
+ }
2831
2919
  if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2832
2920
  return ret;
2833
2921
  }
@@ -4672,8 +4760,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4672
4760
  def(el, "__vueParentComponent", parentComponent, true);
4673
4761
  }
4674
4762
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4675
- if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4676
- else hostInsert(el, container, anchor);
4763
+ if (transition) {
4764
+ if (!needTransition(parentSuspense, transition) && !transition.persisted) el[deferredEnterKey] = true;
4765
+ performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4766
+ } else hostInsert(el, container, anchor);
4677
4767
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4678
4768
  const isHmr = !!(process.env.NODE_ENV !== "production") && isHmrUpdating;
4679
4769
  queuePostRenderEffect(() => {
@@ -4937,16 +5027,20 @@ function baseCreateRenderer(options, createHydrationFns) {
4937
5027
  } else {
4938
5028
  let { next, bu, u, parent, vnode } = instance;
4939
5029
  {
4940
- const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
4941
- if (nonHydratedAsyncRoot) {
5030
+ const unresolvedAsyncRoot = locateUnresolvedAsyncRoot(instance);
5031
+ if (unresolvedAsyncRoot) {
4942
5032
  if (next) {
4943
5033
  next.el = vnode.el;
4944
5034
  updateComponentPreRender(instance, next, optimized);
4945
5035
  }
4946
- nonHydratedAsyncRoot.asyncDep.then(() => {
4947
- queuePostRenderEffect(() => {
4948
- if (!instance.isUnmounted) instance.update();
4949
- }, void 0, parentSuspense);
5036
+ unresolvedAsyncRoot.asyncDep.then(() => {
5037
+ const retry = () => {
5038
+ if (instance.effect.flags & 1024) return;
5039
+ if (parentSuspense && parentSuspense.pendingBranch) queuePostRenderEffect(retry, void 0, parentSuspense);
5040
+ else instance.update();
5041
+ };
5042
+ retry.flags = 24;
5043
+ queuePostRenderEffect(retry, void 0, parentSuspense);
4950
5044
  });
4951
5045
  return;
4952
5046
  }
@@ -4969,7 +5063,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4969
5063
  const prevTree = instance.subTree;
4970
5064
  instance.subTree = nextTree;
4971
5065
  if (!!(process.env.NODE_ENV !== "production")) startMeasure(instance, `patch`);
4972
- patch(prevTree, nextTree, hostParentNode(prevTree.el), getNextHostNode(prevTree), instance, parentSuspense, namespace);
5066
+ patch(prevTree, nextTree, hostParentNode(prevTree.el || resolveAsyncComponentPlaceholder(prevTree)), getNextHostNode(prevTree), instance, parentSuspense, namespace);
4973
5067
  if (!!(process.env.NODE_ENV !== "production")) endMeasure(instance, `patch`);
4974
5068
  next.el = nextTree.el;
4975
5069
  if (originNext === null) updateHOCHostEl(instance, nextTree.el);
@@ -5172,9 +5266,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5172
5266
  }
5173
5267
  if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
5174
5268
  if (shapeFlag & 256) {
5175
- if (isVaporInteropEnabled && isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
5176
- else parentComponent.ctx.deactivate(vnode);
5177
- return;
5269
+ if (parentComponent.ctx.deactivate(vnode)) return;
5178
5270
  }
5179
5271
  if (isVaporInteropEnabled && shapeFlag & 6 && isVaporComponent(type)) {
5180
5272
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
@@ -5254,12 +5346,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5254
5346
  if (effect) {
5255
5347
  effect.stop();
5256
5348
  unmount(subTree, instance, parentSuspense, doRemove);
5257
- } else if (instance.vnode.el && subTree) {
5349
+ } else if (subTree) {
5258
5350
  subTree.transition = instance.vnode.transition;
5259
5351
  unmount(subTree, instance, parentSuspense, doRemove);
5260
5352
  }
5261
5353
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
5262
- queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
5354
+ const markUnmounted = () => instance.isUnmounted = true;
5355
+ markUnmounted.flags = 8;
5356
+ queuePostRenderEffect(markUnmounted, void 0, parentSuspense);
5263
5357
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentRemoved(instance);
5264
5358
  };
5265
5359
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
@@ -5373,11 +5467,11 @@ function traverseStaticChildren(n1, n2, shallow = false) {
5373
5467
  if (!!(process.env.NODE_ENV !== "production")) c2.el && (c2.el.__vnode = c2);
5374
5468
  }
5375
5469
  }
5376
- function locateNonHydratedAsyncRoot(instance) {
5470
+ function locateUnresolvedAsyncRoot(instance) {
5377
5471
  const subComponent = instance.subTree && instance.subTree.component;
5378
5472
  if (subComponent) {
5379
5473
  if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
5380
- else return locateNonHydratedAsyncRoot(subComponent);
5474
+ else return locateUnresolvedAsyncRoot(subComponent);
5381
5475
  }
5382
5476
  }
5383
5477
  function invalidateMount(hooks) {
@@ -5447,7 +5541,9 @@ function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true
5447
5541
  function resolveAsyncComponentPlaceholder(anchorVnode) {
5448
5542
  if (anchorVnode.placeholder) return anchorVnode.placeholder;
5449
5543
  const instance = anchorVnode.component;
5450
- if (instance) return resolveAsyncComponentPlaceholder(instance.subTree);
5544
+ if (instance && instance.subTree) return resolveAsyncComponentPlaceholder(instance.subTree);
5545
+ const suspense = anchorVnode.suspense;
5546
+ if (suspense && suspense.activeBranch) return resolveAsyncComponentPlaceholder(suspense.activeBranch);
5451
5547
  return null;
5452
5548
  }
5453
5549
  //#endregion
@@ -5459,17 +5555,22 @@ function withSuspenseEnabled(value) {
5459
5555
  return value;
5460
5556
  }
5461
5557
  let suspenseId = 0;
5558
+ const deferredEnterKey = Symbol("_deferredEnter");
5462
5559
  const Suspense = /*@__PURE__*/ withSuspenseEnabled({
5463
5560
  name: "Suspense",
5464
5561
  __isSuspense: true,
5465
5562
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
5466
5563
  if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
5467
5564
  else {
5468
- if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
5469
- n2.suspense = n1.suspense;
5470
- n2.suspense.vnode = n2;
5471
- n2.el = n1.el;
5472
- return;
5565
+ const suspense = n1.suspense;
5566
+ if (parentSuspense && parentSuspense.deps > 0 && !parentSuspense.isHydrating) {
5567
+ const owner = suspense.parentComponent;
5568
+ if (!!owner && owner.suspense === parentSuspense && owner.suspenseId !== parentSuspense.pendingId ? parentSuspense.pendingBranch && !isSameVNodeType(n2.ssContent, suspense.pendingBranch || suspense.activeBranch) : !suspense.isInFallback) {
5569
+ n2.suspense = suspense;
5570
+ suspense.vnode = n2;
5571
+ n2.el = n1.el;
5572
+ return;
5573
+ }
5473
5574
  }
5474
5575
  patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, rendererInternals);
5475
5576
  }
@@ -5481,6 +5582,36 @@ function triggerEvent(vnode, name) {
5481
5582
  const eventListener = vnode.props && vnode.props[name];
5482
5583
  if (isFunction(eventListener)) eventListener();
5483
5584
  }
5585
+ function enterDeferred(suspense, branch) {
5586
+ const enters = [];
5587
+ collectDeferredEnters(branch, enters, true);
5588
+ if (isVaporInteropEnabled) {
5589
+ const { parentComponent } = suspense;
5590
+ const vapor = parentComponent && parentComponent.appContext.vapor;
5591
+ if (vapor) vapor.enterDeferred(suspense, enters);
5592
+ }
5593
+ if (enters.length) queuePostFlushCb(enters);
5594
+ }
5595
+ function collectDeferredEnters(vnode, enters, isRoot) {
5596
+ const { el, transition, children, shapeFlag } = vnode;
5597
+ if (shapeFlag & 6) {
5598
+ const subTree = vnode.component.subTree;
5599
+ if (subTree) collectDeferredEnters(subTree, enters, isRoot);
5600
+ return;
5601
+ }
5602
+ if (shapeFlag & 192) return;
5603
+ if (shapeFlag & 1) {
5604
+ if (!isRoot && el && el[deferredEnterKey]) {
5605
+ el[deferredEnterKey] = void 0;
5606
+ if (transition && !transition.persisted) {
5607
+ transition.beforeEnter(el);
5608
+ enters.push(() => transition.enter(el));
5609
+ }
5610
+ }
5611
+ isRoot = false;
5612
+ }
5613
+ if (shapeFlag & 16) for (let i = 0; i < children.length; i++) collectDeferredEnters(children[i], enters, isRoot);
5614
+ }
5484
5615
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
5485
5616
  const { p: patch, o: { createElement } } = rendererInternals;
5486
5617
  const hiddenContainer = createElement("div");
@@ -5520,11 +5651,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5520
5651
  suspense.activeBranch = pendingBranch;
5521
5652
  } else unmount(pendingBranch, parentComponent, suspense);
5522
5653
  suspense.deps = 0;
5523
- for (let i = 0; i < suspense.effects.length; i++) {
5524
- const effect = suspense.effects[i];
5525
- if (effect.flags & 8) queuePostFlushCb(effect);
5526
- }
5527
- suspense.effects.length = 0;
5654
+ discardEffects(suspense);
5528
5655
  suspense.hiddenContainer = createElement("div");
5529
5656
  if (isInFallback) {
5530
5657
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
@@ -5547,14 +5674,14 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5547
5674
  } else {
5548
5675
  triggerEvent(n2, "onPending");
5549
5676
  suspense.pendingBranch = newBranch;
5550
- if (newBranch.shapeFlag & 512) suspense.pendingId = newBranch.component.suspenseId;
5551
- else suspense.pendingId = suspenseId++;
5677
+ suspense.pendingId = suspenseId++;
5552
5678
  patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
5553
5679
  if (suspense.deps <= 0) suspense.resolve();
5554
5680
  else {
5555
- const { timeout, pendingId } = suspense;
5556
- if (timeout > 0) setTimeout(() => {
5557
- if (suspense.pendingId === pendingId) suspense.fallback(newFallback);
5681
+ const { timeout } = suspense;
5682
+ if (timeout > 0) suspense.timeoutTimer = setTimeout(() => {
5683
+ suspense.timeoutTimer = void 0;
5684
+ suspense.fallback(suspense.vnode.ssFallback);
5558
5685
  }, timeout);
5559
5686
  else if (timeout === 0) suspense.fallback(newFallback);
5560
5687
  }
@@ -5590,6 +5717,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5590
5717
  deps: 0,
5591
5718
  pendingId: suspenseId++,
5592
5719
  timeout: typeof timeout === "number" ? timeout : -1,
5720
+ timeoutTimer: void 0,
5593
5721
  activeBranch: null,
5594
5722
  isFallbackMountPending: false,
5595
5723
  pendingBranch: null,
@@ -5609,26 +5737,39 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5609
5737
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
5610
5738
  let hasUpdatedAnchor = false;
5611
5739
  if (delayEnter) activeBranch.transition.afterLeave = () => {
5612
- if (pendingId === suspense.pendingId) {
5740
+ if (pendingId === suspense.pendingId && !suspense.isUnmounted) {
5741
+ enterDeferred(suspense, pendingBranch);
5613
5742
  move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5614
5743
  queuePostFlushCb(effects);
5615
5744
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5616
5745
  }
5617
5746
  };
5618
5747
  if (activeBranch && !suspense.isFallbackMountPending) {
5619
- if (parentNode(activeBranch.el) === container) {
5748
+ if (parentNode(activeBranch.el || resolveAsyncComponentPlaceholder(activeBranch)) === container) {
5620
5749
  anchor = next(activeBranch);
5621
5750
  hasUpdatedAnchor = true;
5622
5751
  }
5623
5752
  unmount(activeBranch, parentComponent, suspense, true);
5624
5753
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5625
5754
  }
5626
- if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
5755
+ if (!delayEnter) {
5756
+ enterDeferred(suspense, pendingBranch);
5757
+ move(pendingBranch, container, anchor, 0, parentComponent);
5758
+ }
5627
5759
  }
5760
+ clearTimeout(suspense.timeoutTimer);
5761
+ suspense.timeoutTimer = void 0;
5628
5762
  suspense.isFallbackMountPending = false;
5629
5763
  setActiveBranch(suspense, pendingBranch);
5630
5764
  suspense.pendingBranch = null;
5631
5765
  suspense.isInFallback = false;
5766
+ let kept = 0;
5767
+ for (let i = 0; i < effects.length; i++) {
5768
+ const effect = effects[i];
5769
+ if (effect.flags & 16) queuePostFlushCb(effect);
5770
+ else effects[kept++] = effect;
5771
+ }
5772
+ effects.length = kept;
5632
5773
  let parent = suspense.parent;
5633
5774
  let hasUnresolvedAncestor = false;
5634
5775
  while (parent) {
@@ -5651,13 +5792,13 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5651
5792
  triggerEvent(vnode, "onResolve");
5652
5793
  },
5653
5794
  fallback(fallbackVNode) {
5654
- if (!suspense.pendingBranch) return;
5795
+ if (suspense.isUnmounted || !suspense.pendingBranch) return;
5655
5796
  const { vnode, activeBranch, parentComponent, container, namespace } = suspense;
5656
5797
  triggerEvent(vnode, "onFallback");
5657
5798
  const anchor = next(activeBranch);
5658
5799
  const mountFallback = () => {
5659
5800
  suspense.isFallbackMountPending = false;
5660
- if (!suspense.isInFallback) return;
5801
+ if (suspense.isUnmounted || !suspense.isInFallback) return;
5661
5802
  const latestFallback = suspense.vnode.ssFallback;
5662
5803
  patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
5663
5804
  setActiveBranch(suspense, latestFallback);
@@ -5681,24 +5822,52 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5681
5822
  registerDep(instance, onResolve) {
5682
5823
  const isInPendingSuspense = !!suspense.pendingBranch;
5683
5824
  if (isInPendingSuspense) suspense.deps++;
5825
+ const render = (setupResult) => {
5826
+ instance.asyncResolved = true;
5827
+ onResolve(setupResult);
5828
+ };
5684
5829
  instance.asyncDep.catch((err) => {
5685
- handleError(err, instance, 0);
5830
+ handleError(err, instance, 0, false, true);
5831
+ return () => null;
5686
5832
  }).then((asyncSetupResult) => {
5687
- if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
5833
+ if (instance.isUnmounted || suspense.isUnmounted) return;
5834
+ const isPendingDep = isInPendingSuspense && suspense.pendingId === instance.suspenseId;
5688
5835
  setCurrentInstance(null, void 0);
5689
5836
  if (!instance.scope.active) {
5690
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
5837
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
5691
5838
  return;
5692
5839
  }
5693
- instance.asyncResolved = true;
5694
- onResolve(asyncSetupResult);
5695
- if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
5840
+ if (!isPendingDep && suspense.pendingBranch) {
5841
+ const job = () => {
5842
+ if (instance.isUnmounted || suspense.isUnmounted || !instance.scope.active) return;
5843
+ if (suspense.pendingBranch) queueEffectWithSuspense(job, void 0, suspense);
5844
+ else render(asyncSetupResult);
5845
+ };
5846
+ job.flags = 24;
5847
+ queueEffectWithSuspense(job, void 0, suspense);
5848
+ return;
5849
+ }
5850
+ render(asyncSetupResult);
5851
+ if (isPendingDep && --suspense.deps === 0) suspense.resolve();
5696
5852
  });
5697
5853
  },
5698
5854
  unmount(parentSuspense, doRemove) {
5699
5855
  suspense.isUnmounted = true;
5856
+ clearTimeout(suspense.timeoutTimer);
5857
+ suspense.timeoutTimer = void 0;
5858
+ if (parentSuspenseId !== void 0) {
5859
+ const parent = suspense.parent;
5860
+ const pendingId = parentSuspenseId;
5861
+ parentSuspenseId = void 0;
5862
+ queuePostFlushCb(() => {
5863
+ if (parent.pendingId === pendingId && !parent.isUnmounted && --parent.deps === 0) parent.resolve();
5864
+ });
5865
+ }
5700
5866
  if (suspense.activeBranch) unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove);
5701
- if (suspense.pendingBranch) unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove);
5867
+ if (suspense.pendingBranch) {
5868
+ unmount(suspense.pendingBranch, parentComponent, suspense, doRemove);
5869
+ discardEffects(suspense);
5870
+ }
5702
5871
  }
5703
5872
  };
5704
5873
  return suspense;
@@ -5739,6 +5908,14 @@ function normalizeSuspenseSlot(s) {
5739
5908
  if (block && !s.dynamicChildren) s.dynamicChildren = block.filter((c) => c !== s);
5740
5909
  return s;
5741
5910
  }
5911
+ function discardEffects(suspense) {
5912
+ const { effects } = suspense;
5913
+ for (let i = 0; i < effects.length; i++) {
5914
+ const effect = effects[i];
5915
+ if (effect.flags & 8) queuePostFlushCb(effect);
5916
+ }
5917
+ effects.length = 0;
5918
+ }
5742
5919
  function queueEffectWithSuspense(fn, id, suspense) {
5743
5920
  if (suspense && suspense.pendingBranch) {
5744
5921
  if (isArray(fn)) suspense.effects.push(...fn);
@@ -5963,7 +6140,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5963
6140
  }
5964
6141
  function guardReactiveProps(props) {
5965
6142
  if (!props) return null;
5966
- return isProxy$1(props) || isInternalObject(props) ? extend({}, props) : props;
6143
+ if (isProxy$1(props)) return extend({}, props);
6144
+ return isInternalObject(props) ? extend({}, props[rawAttrsKey] || props) : props;
5967
6145
  }
5968
6146
  function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
5969
6147
  const { props, ref, patchFlag, children, transition } = vnode;
@@ -6076,6 +6254,17 @@ function normalizeVNode(child) {
6076
6254
  function cloneIfMounted(child) {
6077
6255
  return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
6078
6256
  }
6257
+ let deferElementSlots = false;
6258
+ /**
6259
+ * While enabled, compiled default slots passed as children of plain elements
6260
+ * are kept on the vnode so the server renderer can render them in push mode.
6261
+ * @internal
6262
+ */
6263
+ function setDeferElementSlots(value) {
6264
+ const prev = deferElementSlots;
6265
+ deferElementSlots = value;
6266
+ return prev;
6267
+ }
6079
6268
  function normalizeChildren(vnode, children) {
6080
6269
  let type = 0;
6081
6270
  const { shapeFlag } = vnode;
@@ -6084,6 +6273,11 @@ function normalizeChildren(vnode, children) {
6084
6273
  else if (typeof children === "object") {
6085
6274
  if (shapeFlag & 65) {
6086
6275
  const slot = children.default;
6276
+ if (deferElementSlots && slot && slot._c && shapeFlag & 1) {
6277
+ vnode.children = children;
6278
+ vnode.shapeFlag |= 32;
6279
+ return;
6280
+ }
6087
6281
  if (slot) {
6088
6282
  slot._c && (slot._d = false);
6089
6283
  normalizeChildren(vnode, slot());
@@ -6367,7 +6561,8 @@ function setupStatefulComponent(instance, isSSR) {
6367
6561
  setInSSRSetupState(false);
6368
6562
  }
6369
6563
  }).catch((e) => {
6370
- handleError(e, instance, 0);
6564
+ handleError(e, instance, 0, void 0, true);
6565
+ instance.ssrRender = (_, push) => push("<!---->");
6371
6566
  });
6372
6567
  else {
6373
6568
  instance.asyncDep = setupResult;
@@ -6438,11 +6633,16 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6438
6633
  else warn$1(`Component is missing template or render function: `, Component);
6439
6634
  }
6440
6635
  }
6636
+ /**
6637
+ * Read through the setup context `attrs` proxy to get the raw attrs object.
6638
+ * @internal
6639
+ */
6640
+ const rawAttrsKey = Symbol();
6441
6641
  const attrsProxyHandlers = !!(process.env.NODE_ENV !== "production") ? {
6442
6642
  get(target, key) {
6443
6643
  markAttrsAccessed();
6444
6644
  track(target, "get", "");
6445
- return target[key];
6645
+ return key === rawAttrsKey ? target : target[key];
6446
6646
  },
6447
6647
  set() {
6448
6648
  warn$1(`setupContext.attrs is readonly.`);
@@ -6454,7 +6654,7 @@ const attrsProxyHandlers = !!(process.env.NODE_ENV !== "production") ? {
6454
6654
  }
6455
6655
  } : { get(target, key) {
6456
6656
  track(target, "get", "");
6457
- return target[key];
6657
+ return key === rawAttrsKey ? target : target[key];
6458
6658
  } };
6459
6659
  /**
6460
6660
  * Dev-only
@@ -6750,7 +6950,7 @@ function isMemoSame(cached, memo) {
6750
6950
  }
6751
6951
  //#endregion
6752
6952
  //#region packages/runtime-core/src/index.ts
6753
- const version = "3.6.0-rc.13";
6953
+ const version = "3.6.0-rc.15";
6754
6954
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
6755
6955
  /**
6756
6956
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6776,7 +6976,8 @@ const ssrUtils = {
6776
6976
  popWarningContext,
6777
6977
  VaporSlot,
6778
6978
  rawVaporSlotKey,
6779
- invokeSlotFallback
6979
+ invokeSlotFallback,
6980
+ setDeferElementSlots
6780
6981
  };
6781
6982
  /**
6782
6983
  * @internal only exposed in compat builds
@@ -6788,4 +6989,4 @@ const resolveFilter = null;
6788
6989
  const compatUtils = null;
6789
6990
  const DeprecationTypes = null;
6790
6991
  //#endregion
6791
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, VaporSlot, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defaultPropGetter, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureValidVNode, enterCbKey, expose, filterModelListeners, filterSingleRoot, flushOnAppMount, getAttributeMismatch, getComponentName, getContainerType, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getNextUid, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, invokeSlotFallback, invokeVNodeHook, isAsyncWrapper, isEmitListener, isFunctionalFallthroughKey, isHydrating, isHydratingEnabled, isKeepAlive, isKeepAliveEnabled, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isSuspenseEnabled, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isTransitionEnabled, isUnchangedResourceProp, isVNode, isValidHtmlOrSvgAttribute, isVaporInteropEnabled, knownTemplateRefs, leaveCbKey, logMismatchError, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, normalizeVNode, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, prepareTransitionLeave, prepareTransitionSwitch, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, queuePostRenderEffect, rawVaporSlotKey, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveCssVars, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionChild, resolveTransitionHooks, restoreCurrentInstance, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, setVaporInteropEnabled, shallowReactive, shallowReadonly, shallowRef, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeepAliveEnabled, withMemo, withScopeId, withSuspenseEnabled, withTransitionEnabled };
6992
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, VaporSlot, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, collectDeferredEnters, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defaultPropGetter, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, devtoolsComponentRemoved, effect, effectScope, endMeasure, ensureValidVNode, enterCbKey, expose, filterModelListeners, filterSingleRoot, flushOnAppMount, getAttributeMismatch, getComponentName, getContainerType, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getNextUid, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, invokeSlotFallback, invokeVNodeHook, isAsyncWrapper, isEmitListener, isFunctionalFallthroughKey, isHydrating, isHydratingEnabled, isKeepAlive, isKeepAliveEnabled, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isSuspenseEnabled, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isTransitionEnabled, isUnchangedResourceProp, isVNode, isValidHtmlOrSvgAttribute, isVaporInteropEnabled, knownTemplateRefs, leaveCbKey, logMismatchError, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, normalizeVNode, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, prepareTransitionLeave, prepareTransitionSwitch, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, queuePostRenderEffect, rawVaporSlotKey, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveCssVars, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionChild, resolveTransitionHooks, restoreCurrentInstance, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, setVaporInteropEnabled, shallowReactive, shallowReadonly, shallowRef, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeepAliveEnabled, withMemo, withScopeId, withSuspenseEnabled, withTransitionEnabled };