@vue/runtime-dom 3.6.0-beta.9 → 3.6.0-rc.1

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-dom v3.6.0-beta.9
2
+ * @vue/runtime-dom v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -431,6 +431,13 @@ function warn$2(msg, ...args) {
431
431
  const notifyBuffer = [];
432
432
  let batchDepth = 0;
433
433
  let activeSub = void 0;
434
+ let runDepth = 0;
435
+ function incRunDepth() {
436
+ ++runDepth;
437
+ }
438
+ function decRunDepth() {
439
+ --runDepth;
440
+ }
434
441
  let globalVersion = 0;
435
442
  let notifyIndex = 0;
436
443
  let notifyBufferLength = 0;
@@ -504,8 +511,10 @@ function propagate(link) {
504
511
  const sub = link.sub;
505
512
  let flags = sub.flags;
506
513
  if (flags & 3) {
507
- if (!(flags & 60)) sub.flags = flags | 32;
508
- else if (!(flags & 12)) flags = 0;
514
+ if (!(flags & 60)) {
515
+ sub.flags = flags | 32;
516
+ if (runDepth) sub.flags |= 8;
517
+ } else if (!(flags & 12)) flags = 0;
509
518
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
510
519
  else if (!(flags & 48) && isValidLink(link, sub)) {
511
520
  sub.flags = flags | 40;
@@ -574,13 +583,13 @@ function checkDirty(link, sub) {
574
583
  let dirty = false;
575
584
  if (sub.flags & 16) dirty = true;
576
585
  else if ((depFlags & 17) === 17) {
586
+ const subs = dep.subs;
577
587
  if (dep.update()) {
578
- const subs = dep.subs;
579
588
  if (subs.nextSub !== void 0) shallowPropagate(subs);
580
589
  dirty = true;
581
590
  }
582
591
  } else if ((depFlags & 33) === 33) {
583
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
592
+ stack = {
584
593
  value: link,
585
594
  prev: stack
586
595
  };
@@ -595,15 +604,12 @@ function checkDirty(link, sub) {
595
604
  }
596
605
  while (checkDepth) {
597
606
  --checkDepth;
598
- const firstSub = sub.subs;
599
- const hasMultipleSubs = firstSub.nextSub !== void 0;
600
- if (hasMultipleSubs) {
601
- link = stack.value;
602
- stack = stack.prev;
603
- } else link = firstSub;
607
+ link = stack.value;
608
+ stack = stack.prev;
604
609
  if (dirty) {
610
+ const subs = sub.subs;
605
611
  if (sub.update()) {
606
- if (hasMultipleSubs) shallowPropagate(firstSub);
612
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
607
613
  sub = link.sub;
608
614
  continue;
609
615
  }
@@ -615,7 +621,7 @@ function checkDirty(link, sub) {
615
621
  }
616
622
  dirty = false;
617
623
  }
618
- return dirty;
624
+ return dirty && !!sub.flags;
619
625
  } while (true);
620
626
  }
621
627
  function shallowPropagate(link) {
@@ -998,7 +1004,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
998
1004
  }
999
1005
  const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
1000
1006
  const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
1001
- if (target === /* @__PURE__ */ toRaw(receiver)) {
1007
+ if (target === /* @__PURE__ */ toRaw(receiver) && result) {
1002
1008
  if (!hadKey) trigger(target, "add", key, value);
1003
1009
  else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
1004
1010
  }
@@ -1216,9 +1222,6 @@ function targetTypeMap(rawType) {
1216
1222
  default: return 0;
1217
1223
  }
1218
1224
  }
1219
- function getTargetType(value) {
1220
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1221
- }
1222
1225
  /* @__NO_SIDE_EFFECTS__ */
1223
1226
  function reactive(target) {
1224
1227
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1331,10 +1334,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1331
1334
  return target;
1332
1335
  }
1333
1336
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1334
- const targetType = getTargetType(target);
1335
- if (targetType === 0) return target;
1337
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1336
1338
  const existingProxy = proxyMap.get(target);
1337
1339
  if (existingProxy) return existingProxy;
1340
+ const targetType = targetTypeMap(toRawType(target));
1341
+ if (targetType === 0) return target;
1338
1342
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1339
1343
  proxyMap.set(target, proxy);
1340
1344
  return proxy;
@@ -1767,9 +1771,11 @@ var ReactiveEffect = class {
1767
1771
  if (!this.active) return this.fn();
1768
1772
  cleanup(this);
1769
1773
  const prevSub = startTracking(this);
1774
+ incRunDepth();
1770
1775
  try {
1771
1776
  return this.fn();
1772
1777
  } finally {
1778
+ decRunDepth();
1773
1779
  endTracking(this, prevSub);
1774
1780
  const flags = this.flags;
1775
1781
  if ((flags & 136) === 136) {
@@ -2150,8 +2156,9 @@ var WatcherEffect = class extends ReactiveEffect {
2150
2156
  if (once && cb) {
2151
2157
  const _cb = cb;
2152
2158
  cb = (...args) => {
2153
- _cb(...args);
2159
+ const res = _cb(...args);
2154
2160
  this.stop();
2161
+ return res;
2155
2162
  };
2156
2163
  }
2157
2164
  this.cb = cb;
@@ -2165,7 +2172,7 @@ var WatcherEffect = class extends ReactiveEffect {
2165
2172
  if (!this.cb) return;
2166
2173
  const { immediate, deep, call } = this.options;
2167
2174
  if (initialRun && !immediate) return;
2168
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2175
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2169
2176
  cleanup(this);
2170
2177
  const currentWatcher = activeWatcher;
2171
2178
  activeWatcher = this;
@@ -2472,8 +2479,8 @@ function findInsertionIndex(order, queue, start, end) {
2472
2479
  /**
2473
2480
  * @internal for runtime-vapor only
2474
2481
  */
2475
- function queueJob(job, id, isPre = false) {
2476
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2482
+ function queueJob(job, id, isPre = false, order = 0) {
2483
+ if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2477
2484
  jobsLength++;
2478
2485
  queueFlush();
2479
2486
  }
@@ -2582,6 +2589,7 @@ function flushJobs(seen) {
2582
2589
  }
2583
2590
  flushIndex = 0;
2584
2591
  jobsLength = 0;
2592
+ jobs.length = 0;
2585
2593
  flushPostFlushCbs(seen);
2586
2594
  currentFlushPromise = null;
2587
2595
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2639,6 +2647,14 @@ function createRecord(id, initialDef) {
2639
2647
  function normalizeClassComponent(component) {
2640
2648
  return isClassComponent(component) ? component.__vccOpts : component;
2641
2649
  }
2650
+ function hasDirtyAncestor(instance, dirtyInstances) {
2651
+ let parent = instance.parent;
2652
+ while (parent) {
2653
+ if (dirtyInstances.has(parent)) return true;
2654
+ parent = parent.parent;
2655
+ }
2656
+ return false;
2657
+ }
2642
2658
  function rerender(id, newRender) {
2643
2659
  const record = map.get(id);
2644
2660
  if (!record) return;
@@ -2670,42 +2686,69 @@ function reload(id, newComp) {
2670
2686
  const isVapor = record.initialDef.__vapor;
2671
2687
  updateComponentDef(record.initialDef, newComp);
2672
2688
  const instances = [...record.instances];
2673
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2689
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2674
2690
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2675
- for (const instance of instances) instance.hmrReload(newComp);
2676
- } else for (const instance of instances) {
2677
- const oldComp = normalizeClassComponent(instance.type);
2678
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2679
- if (!dirtyInstances) {
2680
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2681
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2682
- }
2683
- dirtyInstances.add(instance);
2684
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2685
- instance.appContext.propsCache.delete(instance.type);
2686
- instance.appContext.emitsCache.delete(instance.type);
2687
- instance.appContext.optionsCache.delete(instance.type);
2688
- if (instance.ceReload) {
2689
- dirtyInstances.add(instance);
2690
- instance.ceReload(newComp.styles);
2691
- dirtyInstances.delete(instance);
2692
- } else if (instance.parent) queueJob(() => {
2693
- isHmrUpdating = true;
2691
+ const dirtyInstances = new Set(instances);
2692
+ const rerenderedParents = /* @__PURE__ */ new Set();
2693
+ for (const instance of instances) {
2694
2694
  const parent = instance.parent;
2695
- if (parent.vapor) parent.hmrRerender();
2696
- else if (!(parent.effect.flags & 1024)) {
2697
- parent.renderCache = [];
2698
- parent.effect.run();
2695
+ if (parent) {
2696
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2697
+ rerenderedParents.add(parent);
2698
+ parent.hmrRerender();
2699
+ }
2700
+ } else instance.hmrReload(newComp);
2701
+ }
2702
+ } else {
2703
+ const parentUpdates = /* @__PURE__ */ new Map();
2704
+ const dirtyInstanceSet = new Set(instances);
2705
+ for (const instance of instances) {
2706
+ const oldComp = normalizeClassComponent(instance.type);
2707
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2708
+ if (!dirtyInstances) {
2709
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2710
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2699
2711
  }
2700
- nextTick(() => {
2701
- isHmrUpdating = false;
2712
+ dirtyInstances.add(instance);
2713
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2714
+ instance.appContext.propsCache.delete(instance.type);
2715
+ instance.appContext.emitsCache.delete(instance.type);
2716
+ instance.appContext.optionsCache.delete(instance.type);
2717
+ if (instance.ceReload) {
2718
+ dirtyInstances.add(instance);
2719
+ instance.ceReload(newComp.styles);
2720
+ dirtyInstances.delete(instance);
2721
+ } else if (instance.parent) {
2722
+ const parent = instance.parent;
2723
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2724
+ let updates = parentUpdates.get(parent);
2725
+ if (!updates) parentUpdates.set(parent, updates = []);
2726
+ updates.push([instance, dirtyInstances]);
2727
+ }
2728
+ } else if (instance.appContext.reload) instance.appContext.reload();
2729
+ else if (typeof window !== "undefined") window.location.reload();
2730
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2731
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2732
+ }
2733
+ parentUpdates.forEach((updates, parent) => {
2734
+ queueJob(() => {
2735
+ isHmrUpdating = true;
2736
+ if (parent.vapor) parent.hmrRerender();
2737
+ else {
2738
+ const i = parent;
2739
+ if (!(i.effect.flags & 1024)) {
2740
+ i.renderCache = [];
2741
+ i.effect.run();
2742
+ }
2743
+ }
2744
+ nextTick(() => {
2745
+ isHmrUpdating = false;
2746
+ });
2747
+ updates.forEach(([instance, dirtyInstances]) => {
2748
+ dirtyInstances.delete(instance);
2749
+ });
2702
2750
  });
2703
- dirtyInstances.delete(instance);
2704
2751
  });
2705
- else if (instance.appContext.reload) instance.appContext.reload();
2706
- else if (typeof window !== "undefined") window.location.reload();
2707
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2708
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2709
2752
  }
2710
2753
  queuePostFlushCb(() => {
2711
2754
  hmrDirtyComponents.clear();
@@ -2848,10 +2891,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2848
2891
  const renderFnWithContext = (...args) => {
2849
2892
  if (renderFnWithContext._d) setBlockTracking(-1);
2850
2893
  const prevInstance = setCurrentRenderingInstance(ctx);
2894
+ const prevStackSize = blockStack.length;
2851
2895
  let res;
2852
2896
  try {
2853
2897
  res = fn(...args);
2854
2898
  } finally {
2899
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2855
2900
  setCurrentRenderingInstance(prevInstance);
2856
2901
  if (renderFnWithContext._d) setBlockTracking(1);
2857
2902
  }
@@ -3039,6 +3084,7 @@ function createPathGetter(ctx, path) {
3039
3084
  }
3040
3085
  //#endregion
3041
3086
  //#region packages/runtime-core/src/components/Teleport.ts
3087
+ const pendingMounts = /* @__PURE__ */ new WeakMap();
3042
3088
  const TeleportEndKey = Symbol("_vte");
3043
3089
  const isTeleport = (type) => type.__isTeleport;
3044
3090
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
@@ -3064,58 +3110,70 @@ const TeleportImpl = {
3064
3110
  name: "Teleport",
3065
3111
  __isTeleport: true,
3066
3112
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3067
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3113
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3068
3114
  const disabled = isTeleportDisabled(n2.props);
3069
- let { shapeFlag, children, dynamicChildren } = n2;
3115
+ let { dynamicChildren } = n2;
3070
3116
  if (isHmrUpdating) {
3071
3117
  optimized = false;
3072
3118
  dynamicChildren = null;
3073
3119
  }
3120
+ const mount = (vnode, container, anchor) => {
3121
+ if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
3122
+ };
3123
+ const mountToTarget = (vnode = n2) => {
3124
+ const disabled = isTeleportDisabled(vnode.props);
3125
+ const target = vnode.target = resolveTarget(vnode.props, querySelector);
3126
+ const targetAnchor = prepareAnchor(target, vnode, createText, insert);
3127
+ if (target) {
3128
+ if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
3129
+ else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
3130
+ if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3131
+ if (!disabled) {
3132
+ mount(vnode, target, targetAnchor);
3133
+ updateCssVars(vnode, false);
3134
+ }
3135
+ } else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
3136
+ };
3137
+ const queuePendingMount = (vnode) => {
3138
+ const mountJob = () => {
3139
+ if (pendingMounts.get(vnode) !== mountJob) return;
3140
+ pendingMounts.delete(vnode);
3141
+ if (isTeleportDisabled(vnode.props)) {
3142
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3143
+ updateCssVars(vnode, true);
3144
+ }
3145
+ mountToTarget(vnode);
3146
+ };
3147
+ pendingMounts.set(vnode, mountJob);
3148
+ queuePostRenderEffect(mountJob, void 0, parentSuspense);
3149
+ };
3074
3150
  if (n1 == null) {
3075
3151
  const placeholder = n2.el = createComment("teleport start");
3076
3152
  const mainAnchor = n2.anchor = createComment("teleport end");
3077
3153
  insert(placeholder, container, anchor);
3078
3154
  insert(mainAnchor, container, anchor);
3079
- const mount = (container, anchor) => {
3080
- if (shapeFlag & 16) mountChildren(children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
3081
- };
3082
- const mountToTarget = () => {
3083
- const target = n2.target = resolveTarget(n2.props, querySelector);
3084
- const targetAnchor = prepareAnchor(target, n2, createText, insert);
3085
- if (target) {
3086
- if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
3087
- else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
3088
- if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3089
- if (!disabled) {
3090
- mount(target, targetAnchor);
3091
- updateCssVars(n2, false);
3092
- }
3093
- } else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
3094
- };
3155
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3156
+ queuePendingMount(n2);
3157
+ return;
3158
+ }
3095
3159
  if (disabled) {
3096
- mount(container, mainAnchor);
3160
+ mount(n2, container, mainAnchor);
3097
3161
  updateCssVars(n2, true);
3098
3162
  }
3099
- if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3100
- n2.el.__isMounted = false;
3101
- queuePostRenderEffect(() => {
3102
- if (n2.el.__isMounted !== false) return;
3103
- mountToTarget();
3104
- delete n2.el.__isMounted;
3105
- }, void 0, parentSuspense);
3106
- } else mountToTarget();
3163
+ mountToTarget();
3107
3164
  } else {
3108
3165
  n2.el = n1.el;
3109
- n2.targetStart = n1.targetStart;
3110
3166
  const mainAnchor = n2.anchor = n1.anchor;
3111
- const target = n2.target = n1.target;
3112
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3113
- if (n1.el.__isMounted === false) {
3114
- queuePostRenderEffect(() => {
3115
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3116
- }, void 0, parentSuspense);
3167
+ const pendingMount = pendingMounts.get(n1);
3168
+ if (pendingMount) {
3169
+ pendingMount.flags |= 4;
3170
+ pendingMounts.delete(n1);
3171
+ queuePendingMount(n2);
3117
3172
  return;
3118
3173
  }
3174
+ n2.targetStart = n1.targetStart;
3175
+ const target = n2.target = n1.target;
3176
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3119
3177
  const wasDisabled = isTeleportDisabled(n1.props);
3120
3178
  const currentContainer = wasDisabled ? container : target;
3121
3179
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -3129,24 +3187,30 @@ const TeleportImpl = {
3129
3187
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
3130
3188
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
3131
3189
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3132
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
3133
- if (nextTarget) moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
3134
- else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
3190
+ const nextTarget = resolveTarget(n2.props, querySelector);
3191
+ if (nextTarget) {
3192
+ n2.target = nextTarget;
3193
+ moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
3194
+ } else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
3135
3195
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
3136
3196
  updateCssVars(n2, disabled);
3137
3197
  }
3138
3198
  },
3139
3199
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3140
- const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3200
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
3201
+ const disabled = isTeleportDisabled(props);
3202
+ const shouldRemove = doRemove || !disabled;
3203
+ const pendingMount = pendingMounts.get(vnode);
3204
+ if (pendingMount) {
3205
+ pendingMount.flags |= 4;
3206
+ pendingMounts.delete(vnode);
3207
+ }
3141
3208
  if (targetStart) hostRemove(targetStart);
3142
3209
  if (targetAnchor) hostRemove(targetAnchor);
3143
3210
  doRemove && hostRemove(anchor);
3144
- if (shapeFlag & 16) {
3145
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3146
- for (let i = 0; i < children.length; i++) {
3147
- const child = children[i];
3148
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3149
- }
3211
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3212
+ const child = children[i];
3213
+ unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3150
3214
  }
3151
3215
  },
3152
3216
  move: moveTeleport,
@@ -3157,7 +3221,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3157
3221
  const { el, anchor, shapeFlag, children, props } = vnode;
3158
3222
  const isReorder = moveType === 2;
3159
3223
  if (isReorder) insert(el, container, parentAnchor);
3160
- if (!isReorder || isTeleportDisabled(props)) {
3224
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3161
3225
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3162
3226
  }
3163
3227
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3282,8 +3346,8 @@ const BaseTransitionImpl = {
3282
3346
  const state = useTransitionState();
3283
3347
  return () => {
3284
3348
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3285
- if (!children || !children.length) return;
3286
- const child = findNonCommentChild(children);
3349
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3350
+ if (!child) return;
3287
3351
  const rawProps = /* @__PURE__ */ toRaw(props);
3288
3352
  const { mode } = rawProps;
3289
3353
  checkTransitionMode(mode);
@@ -3735,7 +3799,7 @@ function createHydrationFunctions(rendererInternals) {
3735
3799
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3736
3800
  break;
3737
3801
  case VaporSlot:
3738
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
3802
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
3739
3803
  break;
3740
3804
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
3741
3805
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -3745,16 +3809,31 @@ function createHydrationFunctions(rendererInternals) {
3745
3809
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
3746
3810
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
3747
3811
  else nextNode = nextSibling(node);
3748
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
3749
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3750
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3751
- let subTree;
3752
- if (isFragmentStart) {
3753
- subTree = createVNode(Fragment);
3754
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3755
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3756
- subTree.el = node;
3757
- vnode.component.subTree = subTree;
3812
+ if (vnode.type.__vapor) {
3813
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
3814
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
3815
+ if (vnode.dirs) {
3816
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
3817
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3818
+ }
3819
+ }, () => {
3820
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
3821
+ });
3822
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
3823
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
3824
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
3825
+ } else {
3826
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3827
+ const component = vnode.component;
3828
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
3829
+ let subTree;
3830
+ if (isFragmentStart) {
3831
+ subTree = createVNode(Fragment);
3832
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3833
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3834
+ subTree.el = node;
3835
+ component.subTree = subTree;
3836
+ }
3758
3837
  }
3759
3838
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
3760
3839
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -3766,7 +3845,7 @@ function createHydrationFunctions(rendererInternals) {
3766
3845
  };
3767
3846
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3768
3847
  optimized = optimized || !!vnode.dynamicChildren;
3769
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3848
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3770
3849
  const forcePatch = type === "input" || type === "option";
3771
3850
  {
3772
3851
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
@@ -3784,15 +3863,11 @@ function createHydrationFunctions(rendererInternals) {
3784
3863
  }
3785
3864
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
3786
3865
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
3787
- let hasWarned = false;
3866
+ if (next && !isMismatchAllowed(el, 1)) {
3867
+ warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
3868
+ logMismatchError();
3869
+ }
3788
3870
  while (next) {
3789
- if (!isMismatchAllowed(el, 1)) {
3790
- if (!hasWarned) {
3791
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
3792
- hasWarned = true;
3793
- }
3794
- logMismatchError();
3795
- }
3796
3871
  const cur = next;
3797
3872
  next = next.nextSibling;
3798
3873
  remove(cur);
@@ -3811,9 +3886,10 @@ function createHydrationFunctions(rendererInternals) {
3811
3886
  }
3812
3887
  if (props) {
3813
3888
  const isCustomElement = el.tagName.includes("-");
3889
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
3814
3890
  for (const key in props) {
3815
3891
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
3816
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key)) patchProp(el, key, null, props[key], void 0, parentComponent);
3892
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) patchProp(el, key, null, props[key], namespace, parentComponent);
3817
3893
  }
3818
3894
  }
3819
3895
  let vnodeHooks;
@@ -3831,7 +3907,7 @@ function createHydrationFunctions(rendererInternals) {
3831
3907
  optimized = optimized || !!parentVNode.dynamicChildren;
3832
3908
  const children = parentVNode.children;
3833
3909
  const l = children.length;
3834
- let hasWarned = false;
3910
+ let hasCheckedMismatch = false;
3835
3911
  for (let i = 0; i < l; i++) {
3836
3912
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3837
3913
  const isText = vnode.type === Text;
@@ -3845,12 +3921,12 @@ function createHydrationFunctions(rendererInternals) {
3845
3921
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3846
3922
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
3847
3923
  else {
3848
- if (!isMismatchAllowed(container, 1)) {
3849
- if (!hasWarned) {
3924
+ if (!hasCheckedMismatch) {
3925
+ hasCheckedMismatch = true;
3926
+ if (!isMismatchAllowed(container, 1)) {
3850
3927
  warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
3851
- hasWarned = true;
3928
+ logMismatchError();
3852
3929
  }
3853
- logMismatchError();
3854
3930
  }
3855
3931
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
3856
3932
  }
@@ -3870,7 +3946,7 @@ function createHydrationFunctions(rendererInternals) {
3870
3946
  }
3871
3947
  };
3872
3948
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3873
- if (!isMismatchAllowed(node.parentElement, 1)) {
3949
+ if (!isNodeMismatchAllowed(node, vnode)) {
3874
3950
  warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
3875
3951
  logMismatchError();
3876
3952
  }
@@ -4034,7 +4110,9 @@ const MismatchTypeString = {
4034
4110
  };
4035
4111
  function isMismatchAllowed(el, allowedType) {
4036
4112
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
4037
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4113
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
4114
+ }
4115
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4038
4116
  if (allowedAttr == null) return false;
4039
4117
  else if (allowedAttr === "") return true;
4040
4118
  else {
@@ -4043,6 +4121,16 @@ function isMismatchAllowed(el, allowedType) {
4043
4121
  return list.includes(MismatchTypeString[allowedType]);
4044
4122
  }
4045
4123
  }
4124
+ function isNodeMismatchAllowed(node, vnode) {
4125
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4126
+ }
4127
+ function isMismatchAllowedByNode(node) {
4128
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
4129
+ }
4130
+ function isMismatchAllowedByVNode({ props }) {
4131
+ const allowedAttr = props && props[allowMismatchAttr];
4132
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
4133
+ }
4046
4134
  //#endregion
4047
4135
  //#region packages/runtime-core/src/hydrationStrategies.ts
4048
4136
  let requestIdleCallback;
@@ -4161,11 +4249,16 @@ function defineAsyncComponent(source) {
4161
4249
  onError(err);
4162
4250
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4163
4251
  });
4164
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4252
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4165
4253
  load().then(() => {
4254
+ if (instance.isUnmounted) return;
4166
4255
  loaded.value = true;
4167
4256
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4168
4257
  }).catch((err) => {
4258
+ if (instance.isUnmounted) {
4259
+ setPendingRequest(null);
4260
+ return;
4261
+ }
4169
4262
  onError(err);
4170
4263
  error.value = err;
4171
4264
  });
@@ -4223,14 +4316,22 @@ function createAsyncComponentContext(source) {
4223
4316
  setPendingRequest: (request) => pendingRequest = request
4224
4317
  };
4225
4318
  }
4226
- const useAsyncComponentState = (delay, timeout, onError) => {
4319
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4227
4320
  const loaded = /* @__PURE__ */ ref(false);
4228
4321
  const error = /* @__PURE__ */ ref();
4229
4322
  const delayed = /* @__PURE__ */ ref(!!delay);
4230
- if (delay) setTimeout(() => {
4323
+ let timeoutTimer;
4324
+ let delayTimer;
4325
+ if (instance) onUnmounted(() => {
4326
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4327
+ if (delayTimer != null) clearTimeout(delayTimer);
4328
+ }, instance);
4329
+ if (delay) delayTimer = setTimeout(() => {
4330
+ if (instance && instance.isUnmounted) return;
4231
4331
  delayed.value = false;
4232
4332
  }, delay);
4233
- if (timeout != null) setTimeout(() => {
4333
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4334
+ if (instance && instance.isUnmounted) return;
4234
4335
  if (!loaded.value && !error.value) {
4235
4336
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4236
4337
  onError(err);
@@ -4248,6 +4349,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
4248
4349
  * @internal
4249
4350
  */
4250
4351
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
4352
+ const wasConnected = el.isConnected;
4251
4353
  let patched = false;
4252
4354
  (instance.bu || (instance.bu = [])).push(() => patched = true);
4253
4355
  const performHydrate = () => {
@@ -4258,6 +4360,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
4258
4360
  }
4259
4361
  return;
4260
4362
  }
4363
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
4261
4364
  hydrate();
4262
4365
  };
4263
4366
  const doHydrate = hydrateStrategy ? () => {
@@ -4623,8 +4726,9 @@ function createSlots(slots, dynamicSlots) {
4623
4726
  * Compiler runtime helper for rendering `<slot/>`
4624
4727
  * @private
4625
4728
  */
4626
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4729
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
4627
4730
  let slot = slots[name];
4731
+ if (fallback) fallback.__vdom = true;
4628
4732
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
4629
4733
  if (vaporSlot) {
4630
4734
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -4632,25 +4736,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4632
4736
  slot: vaporSlot,
4633
4737
  fallback
4634
4738
  };
4739
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4635
4740
  return ret;
4636
4741
  }
4637
4742
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
4638
- const hasProps = Object.keys(props).length > 0;
4639
- if (name !== "default") props.name = name;
4640
- return openBlock(), createBlock(Fragment, null, [createVNode("slot", props, fallback && fallback())], hasProps ? -2 : 64);
4743
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
4744
+ const hasProps = Object.keys(slotProps).length > 0;
4745
+ if (name !== "default") slotProps.name = name;
4746
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
4641
4747
  }
4642
4748
  if (slot && slot.length > 1) {
4643
4749
  warn$1("SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.");
4644
4750
  slot = () => [];
4645
4751
  }
4646
4752
  if (slot && slot._c) slot._d = false;
4753
+ const prevStackSize = blockStack.length;
4647
4754
  openBlock();
4648
- const validSlotContent = slot && ensureValidVNode(slot(props));
4649
- ensureVaporSlotFallback(validSlotContent, fallback);
4650
- const slotKey = props.key || validSlotContent && validSlotContent.key;
4651
- const rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4755
+ let rendered;
4756
+ try {
4757
+ const validSlotContent = slot && ensureValidVNode(slot(props));
4758
+ ensureVaporSlotFallback(validSlotContent, fallback);
4759
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
4760
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4761
+ } catch (err) {
4762
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
4763
+ throw err;
4764
+ } finally {
4765
+ if (slot && slot._c) slot._d = true;
4766
+ }
4652
4767
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
4653
- if (slot && slot._c) slot._d = true;
4654
4768
  return rendered;
4655
4769
  }
4656
4770
  function ensureValidVNode(vnodes) {
@@ -4663,9 +4777,7 @@ function ensureValidVNode(vnodes) {
4663
4777
  }
4664
4778
  function ensureVaporSlotFallback(vnodes, fallback) {
4665
4779
  let vaporSlot;
4666
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
4667
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
4668
- }
4780
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
4669
4781
  }
4670
4782
  //#endregion
4671
4783
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5031,26 +5143,39 @@ function createPropsRestProxy(props, excludedKeys) {
5031
5143
  function withAsyncContext(getAwaitable) {
5032
5144
  const ctx = getCurrentGenericInstance();
5033
5145
  const inSSRSetup = isInSSRComponentSetup;
5146
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
5034
5147
  if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
5035
5148
  let awaitable = getAwaitable();
5036
5149
  setCurrentInstance(null, void 0);
5037
5150
  if (inSSRSetup) setInSSRSetupState(false);
5038
5151
  const restore = () => {
5152
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5039
5153
  setCurrentInstance(ctx);
5040
5154
  if (inSSRSetup) setInSSRSetupState(true);
5155
+ const reset = restoreAsyncContext && restoreAsyncContext();
5156
+ return () => {
5157
+ if (reset) reset();
5158
+ if (resetStoppedScope) resetStoppedScope.reset();
5159
+ };
5041
5160
  };
5042
5161
  const cleanup = () => {
5043
5162
  setCurrentInstance(null, void 0);
5044
5163
  if (inSSRSetup) setInSSRSetupState(false);
5045
5164
  };
5046
5165
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
5047
- restore();
5048
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
5166
+ const reset = restore();
5167
+ Promise.resolve().then(() => Promise.resolve().then(() => {
5168
+ if (reset) reset();
5169
+ cleanup();
5170
+ }));
5049
5171
  throw e;
5050
5172
  });
5051
5173
  return [awaitable, () => {
5052
- restore();
5053
- Promise.resolve().then(cleanup);
5174
+ const reset = restore();
5175
+ Promise.resolve().then(() => {
5176
+ if (reset) reset();
5177
+ cleanup();
5178
+ });
5054
5179
  }];
5055
5180
  }
5056
5181
  //#endregion
@@ -5474,12 +5599,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
5474
5599
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5475
5600
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5476
5601
  }
5477
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5602
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5603
+ if (!hasVModel) {
5478
5604
  localValue = value;
5479
5605
  trigger();
5480
5606
  }
5481
5607
  i.emit(`update:${name}`, emittedValue);
5482
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5608
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5483
5609
  prevSetValue = value;
5484
5610
  prevEmittedValue = emittedValue;
5485
5611
  }
@@ -5586,7 +5712,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
5586
5712
  */
5587
5713
  function isEmitListener(options, key) {
5588
5714
  if (!options || !isOn(key)) return false;
5589
- key = key.slice(2).replace(/Once$/, "");
5715
+ key = key.slice(2);
5716
+ key = key === "Once" ? key : key.replace(/Once$/, "");
5590
5717
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
5591
5718
  }
5592
5719
  //#endregion
@@ -6061,7 +6188,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
6061
6188
  const receivedType = toRawType(value);
6062
6189
  const expectedValue = styleValue(value, expectedType);
6063
6190
  const receivedValue = styleValue(value, receivedType);
6064
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
6191
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
6065
6192
  message += `, got ${receivedType} `;
6066
6193
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
6067
6194
  return message;
@@ -6070,7 +6197,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
6070
6197
  * dev only
6071
6198
  */
6072
6199
  function styleValue(value, type) {
6073
- if (type === "String") return `"${value}"`;
6200
+ if (isSymbol(value)) return value.toString();
6201
+ else if (type === "String") return `"${value}"`;
6074
6202
  else if (type === "Number") return `${Number(value)}`;
6075
6203
  else return `${value}`;
6076
6204
  }
@@ -6087,8 +6215,11 @@ function isExplicable(type) {
6087
6215
  /**
6088
6216
  * dev only
6089
6217
  */
6090
- function isBoolean(...args) {
6091
- return args.some((elem) => elem.toLowerCase() === "boolean");
6218
+ function isCoercible(...args) {
6219
+ return args.every((elem) => {
6220
+ const value = elem.toLowerCase();
6221
+ return value !== "boolean" && value !== "symbol";
6222
+ });
6092
6223
  }
6093
6224
  //#endregion
6094
6225
  //#region packages/runtime-core/src/componentSlots.ts
@@ -6393,7 +6524,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6393
6524
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6394
6525
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6395
6526
  parentComponent && toggleRecurse(parentComponent, true);
6396
- if (isHmrUpdating) {
6527
+ if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
6397
6528
  patchFlag = 0;
6398
6529
  optimized = false;
6399
6530
  dynamicChildren = null;
@@ -6473,19 +6604,35 @@ function baseCreateRenderer(options, createHydrationFns) {
6473
6604
  n2.slotScopeIds = slotScopeIds;
6474
6605
  if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
6475
6606
  else {
6607
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
6476
6608
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
6477
6609
  if (n2.dirs) {
6478
6610
  invokeDirectiveHook(n2, null, parentComponent, "created");
6479
6611
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
6480
6612
  }
6613
+ }, () => {
6614
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
6481
6615
  });
6482
6616
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
6617
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
6618
+ if (vnodeMountedHook) {
6619
+ const scopedVNode = n2;
6620
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
6621
+ }
6483
6622
  }
6484
6623
  else {
6485
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
6624
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
6625
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
6486
6626
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6627
+ }, () => {
6628
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
6629
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
6487
6630
  });
6488
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
6631
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
6632
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
6633
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
6634
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
6635
+ }, void 0, parentSuspense);
6489
6636
  }
6490
6637
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
6491
6638
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -6831,8 +6978,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6831
6978
  else hostInsert(el, container, anchor);
6832
6979
  };
6833
6980
  const performLeave = () => {
6981
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
6834
6982
  if (el._isLeaving) el[leaveCbKey](true);
6835
- leave(el, () => {
6983
+ if (transition.persisted && !wasLeaving) remove();
6984
+ else leave(el, () => {
6836
6985
  remove();
6837
6986
  afterLeave && afterLeave();
6838
6987
  });
@@ -6863,7 +7012,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6863
7012
  if (shapeFlag & 6) if (isVaporComponent(type)) {
6864
7013
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6865
7014
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6866
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
7015
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
7016
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
7017
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7018
+ }, void 0, parentSuspense);
6867
7019
  return;
6868
7020
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
6869
7021
  else {
@@ -6924,7 +7076,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6924
7076
  if (effect) {
6925
7077
  effect.stop();
6926
7078
  unmount(subTree, instance, parentSuspense, doRemove);
6927
- }
7079
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
6928
7080
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
6929
7081
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
6930
7082
  devtoolsComponentRemoved(instance);
@@ -7050,6 +7202,10 @@ function invalidateMount(hooks) {
7050
7202
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
7051
7203
  }
7052
7204
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
7205
+ if (force && transition.persisted && !el[leaveCbKey]) {
7206
+ insert();
7207
+ return;
7208
+ }
7053
7209
  if (force || needTransition(parentSuspense, transition)) {
7054
7210
  transition.beforeEnter(el);
7055
7211
  insert();
@@ -7252,15 +7408,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7252
7408
  if (suspense.isHydrating) suspense.isHydrating = false;
7253
7409
  else if (!resume) {
7254
7410
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
7411
+ let hasUpdatedAnchor = false;
7255
7412
  if (delayEnter) activeBranch.transition.afterLeave = () => {
7256
7413
  if (pendingId === suspense.pendingId) {
7257
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7414
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7258
7415
  queuePostFlushCb(effects);
7259
7416
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7260
7417
  }
7261
7418
  };
7262
7419
  if (activeBranch && !suspense.isFallbackMountPending) {
7263
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7420
+ if (parentNode(activeBranch.el) === container) {
7421
+ anchor = next(activeBranch);
7422
+ hasUpdatedAnchor = true;
7423
+ }
7264
7424
  unmount(activeBranch, parentComponent, suspense, true);
7265
7425
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7266
7426
  }
@@ -7324,6 +7484,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7324
7484
  handleError(err, instance, 0);
7325
7485
  }).then((asyncSetupResult) => {
7326
7486
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
7487
+ setCurrentInstance(null, void 0);
7327
7488
  instance.asyncResolved = true;
7328
7489
  onResolve(asyncSetupResult);
7329
7490
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -7613,11 +7774,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7613
7774
  el: vnode.el,
7614
7775
  anchor: vnode.anchor,
7615
7776
  ctx: vnode.ctx,
7616
- ce: vnode.ce
7777
+ ce: vnode.ce,
7778
+ vi: vnode.vi,
7779
+ vs: cloneVaporSlotMeta(vnode),
7780
+ vb: vnode.vb
7617
7781
  };
7618
7782
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
7619
7783
  return cloned;
7620
7784
  }
7785
+ function cloneVaporSlotMeta(vnode) {
7786
+ const vaporSlot = vnode.vs;
7787
+ if (!vaporSlot) return vaporSlot;
7788
+ const cloned = {
7789
+ slot: vaporSlot.slot,
7790
+ fallback: vaporSlot.fallback,
7791
+ outletFallback: vaporSlot.outletFallback
7792
+ };
7793
+ if (vnode.el) {
7794
+ cloned.state = vaporSlot.state;
7795
+ cloned.ref = vaporSlot.ref;
7796
+ cloned.scope = vaporSlot.scope;
7797
+ }
7798
+ return cloned;
7799
+ }
7621
7800
  /**
7622
7801
  * Dev only, for HMR of hoisted vnodes reused in v-for
7623
7802
  * https://github.com/vitejs/vite/issues/2022
@@ -7680,6 +7859,10 @@ function normalizeChildren(vnode, children) {
7680
7859
  }
7681
7860
  }
7682
7861
  else if (isFunction(children)) {
7862
+ if (shapeFlag & 65) {
7863
+ normalizeChildren(vnode, { default: children });
7864
+ return;
7865
+ }
7683
7866
  children = {
7684
7867
  default: children,
7685
7868
  _ctx: currentRenderingInstance
@@ -8273,7 +8456,7 @@ function isMemoSame(cached, memo) {
8273
8456
  }
8274
8457
  //#endregion
8275
8458
  //#region packages/runtime-core/src/index.ts
8276
- const version = "3.6.0-beta.9";
8459
+ const version = "3.6.0-rc.1";
8277
8460
  const warn = warn$1;
8278
8461
  /**
8279
8462
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8736,7 +8919,10 @@ function patchStyle(el, prev, next) {
8736
8919
  }
8737
8920
  for (const key in next) {
8738
8921
  if (key === "display") hasControlledDisplay = true;
8739
- setStyle(style, key, next[key]);
8922
+ const value = next[key];
8923
+ if (value != null) {
8924
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
8925
+ } else setStyle(style, key, "");
8740
8926
  }
8741
8927
  } else if (isCssString) {
8742
8928
  if (prev !== next) {
@@ -8784,6 +8970,14 @@ function autoPrefix(style, rawName) {
8784
8970
  }
8785
8971
  return rawName;
8786
8972
  }
8973
+ /**
8974
+ * Browsers update textarea width/height directly during native resize.
8975
+ * Only special-case this common textarea path for now; other resize scenarios
8976
+ * still follow normal vnode style patching.
8977
+ */
8978
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
8979
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
8980
+ }
8787
8981
  //#endregion
8788
8982
  //#region packages/runtime-dom/src/modules/attrs.ts
8789
8983
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -8842,7 +9036,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8842
9036
  const existingInvoker = invokers[rawName];
8843
9037
  if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
8844
9038
  else {
8845
- const [name, options] = parseName(rawName);
9039
+ const [name, options] = parseEventName(rawName);
8846
9040
  if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
8847
9041
  else if (existingInvoker) {
8848
9042
  removeEventListener(el, name, existingInvoker, options);
@@ -8850,16 +9044,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8850
9044
  }
8851
9045
  }
8852
9046
  }
8853
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
8854
- function parseName(name) {
9047
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
9048
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
9049
+ function parseEventName(name) {
8855
9050
  let options;
8856
- if (optionsModifierRE.test(name)) {
8857
- options = {};
8858
- let m;
8859
- while (m = name.match(optionsModifierRE)) {
8860
- name = name.slice(0, name.length - m[0].length);
8861
- options[m[0].toLowerCase()] = true;
8862
- }
9051
+ let m;
9052
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
9053
+ if (!options) options = {};
9054
+ name = name.slice(0, name.length - m[1].length);
9055
+ options[m[1].toLowerCase()] = true;
8863
9056
  }
8864
9057
  return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
8865
9058
  }
@@ -8870,7 +9063,21 @@ function createInvoker(initialValue, instance) {
8870
9063
  const invoker = (e) => {
8871
9064
  if (!e._vts) e._vts = Date.now();
8872
9065
  else if (e._vts <= invoker.attached) return;
8873
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
9066
+ const value = invoker.value;
9067
+ if (isArray(value)) {
9068
+ const originalStop = e.stopImmediatePropagation;
9069
+ e.stopImmediatePropagation = () => {
9070
+ originalStop.call(e);
9071
+ e._stopped = true;
9072
+ };
9073
+ const handlers = value.slice();
9074
+ const args = [e];
9075
+ for (let i = 0; i < handlers.length; i++) {
9076
+ if (e._stopped) break;
9077
+ const handler = handlers[i];
9078
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
9079
+ }
9080
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
8874
9081
  };
8875
9082
  invoker.value = initialValue;
8876
9083
  invoker.attached = getNow();
@@ -8881,16 +9088,6 @@ function sanitizeEventValue(value, propName) {
8881
9088
  warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
8882
9089
  return NOOP;
8883
9090
  }
8884
- function patchStopImmediatePropagation(e, value) {
8885
- if (isArray(value)) {
8886
- const originalStop = e.stopImmediatePropagation;
8887
- e.stopImmediatePropagation = () => {
8888
- originalStop.call(e);
8889
- e._stopped = true;
8890
- };
8891
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
8892
- } else return value;
8893
- }
8894
9091
  //#endregion
8895
9092
  //#region packages/runtime-dom/src/patchProp.ts
8896
9093
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -9218,7 +9415,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
9218
9415
  replacementNodes.push(child);
9219
9416
  }
9220
9417
  parent.removeChild(o);
9221
- slotReplacements.set(o, replacementNodes);
9418
+ slotReplacements.set(o, {
9419
+ nodes: replacementNodes,
9420
+ usedFallback: !content
9421
+ });
9222
9422
  }
9223
9423
  this._updateSlotNodes(slotReplacements);
9224
9424
  }
@@ -9406,7 +9606,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
9406
9606
  prevChildren = [];
9407
9607
  if (children) for (let i = 0; i < children.length; i++) {
9408
9608
  const child = children[i];
9409
- if (child.el && child.el instanceof Element) {
9609
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
9410
9610
  prevChildren.push(child);
9411
9611
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9412
9612
  positionMap.set(child, getPosition(child.el));
@@ -9630,7 +9830,8 @@ const vModelSelect = {
9630
9830
  mounted(el, { value }) {
9631
9831
  vModelSetSelected(el, value);
9632
9832
  },
9633
- beforeUpdate(el, _binding, vnode) {
9833
+ beforeUpdate(el, { value }, vnode) {
9834
+ el._modelValue = value;
9634
9835
  el[assignKey] = getModelAssigner(vnode);
9635
9836
  },
9636
9837
  updated(el, { value }) {
@@ -9641,10 +9842,10 @@ const vModelSelect = {
9641
9842
  * @internal
9642
9843
  */
9643
9844
  const vModelSelectInit = (el, value, number, set) => {
9644
- const isSetModel = isSet(value);
9845
+ el._modelValue = value;
9645
9846
  addEventListener(el, "change", () => {
9646
9847
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
9647
- (set || el[assignKey])(el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9848
+ (set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9648
9849
  el._assigning = true;
9649
9850
  nextTick(() => {
9650
9851
  el._assigning = false;
@@ -9655,6 +9856,7 @@ const vModelSelectInit = (el, value, number, set) => {
9655
9856
  * @internal
9656
9857
  */
9657
9858
  const vModelSetSelected = (el, value) => {
9859
+ el._modelValue = value;
9658
9860
  if (el._assigning) return;
9659
9861
  const isMultiple = el.multiple;
9660
9862
  const isArrayValue = isArray(value);