@vue/compat 3.6.0-beta.9 → 3.6.0-rc.2

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-beta.9
2
+ * @vue/compat v3.6.0-rc.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -566,6 +566,13 @@ function warn$2(msg, ...args) {
566
566
  const notifyBuffer = [];
567
567
  let batchDepth = 0;
568
568
  let activeSub = void 0;
569
+ let runDepth = 0;
570
+ function incRunDepth() {
571
+ ++runDepth;
572
+ }
573
+ function decRunDepth() {
574
+ --runDepth;
575
+ }
569
576
  let globalVersion = 0;
570
577
  let notifyIndex = 0;
571
578
  let notifyBufferLength = 0;
@@ -639,8 +646,10 @@ function propagate(link) {
639
646
  const sub = link.sub;
640
647
  let flags = sub.flags;
641
648
  if (flags & 3) {
642
- if (!(flags & 60)) sub.flags = flags | 32;
643
- else if (!(flags & 12)) flags = 0;
649
+ if (!(flags & 60)) {
650
+ sub.flags = flags | 32;
651
+ if (runDepth) sub.flags |= 8;
652
+ } else if (!(flags & 12)) flags = 0;
644
653
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
645
654
  else if (!(flags & 48) && isValidLink(link, sub)) {
646
655
  sub.flags = flags | 40;
@@ -709,13 +718,13 @@ function checkDirty(link, sub) {
709
718
  let dirty = false;
710
719
  if (sub.flags & 16) dirty = true;
711
720
  else if ((depFlags & 17) === 17) {
721
+ const subs = dep.subs;
712
722
  if (dep.update()) {
713
- const subs = dep.subs;
714
723
  if (subs.nextSub !== void 0) shallowPropagate(subs);
715
724
  dirty = true;
716
725
  }
717
726
  } else if ((depFlags & 33) === 33) {
718
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
727
+ stack = {
719
728
  value: link,
720
729
  prev: stack
721
730
  };
@@ -730,15 +739,12 @@ function checkDirty(link, sub) {
730
739
  }
731
740
  while (checkDepth) {
732
741
  --checkDepth;
733
- const firstSub = sub.subs;
734
- const hasMultipleSubs = firstSub.nextSub !== void 0;
735
- if (hasMultipleSubs) {
736
- link = stack.value;
737
- stack = stack.prev;
738
- } else link = firstSub;
742
+ link = stack.value;
743
+ stack = stack.prev;
739
744
  if (dirty) {
745
+ const subs = sub.subs;
740
746
  if (sub.update()) {
741
- if (hasMultipleSubs) shallowPropagate(firstSub);
747
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
742
748
  sub = link.sub;
743
749
  continue;
744
750
  }
@@ -750,7 +756,7 @@ function checkDirty(link, sub) {
750
756
  }
751
757
  dirty = false;
752
758
  }
753
- return dirty;
759
+ return dirty && !!sub.flags;
754
760
  } while (true);
755
761
  }
756
762
  function shallowPropagate(link) {
@@ -1133,7 +1139,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
1133
1139
  }
1134
1140
  const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
1135
1141
  const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
1136
- if (target === /* @__PURE__ */ toRaw(receiver)) {
1142
+ if (target === /* @__PURE__ */ toRaw(receiver) && result) {
1137
1143
  if (!hadKey) trigger(target, "add", key, value);
1138
1144
  else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
1139
1145
  }
@@ -1351,9 +1357,6 @@ function targetTypeMap(rawType) {
1351
1357
  default: return 0;
1352
1358
  }
1353
1359
  }
1354
- function getTargetType(value) {
1355
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1356
- }
1357
1360
  /* @__NO_SIDE_EFFECTS__ */
1358
1361
  function reactive(target) {
1359
1362
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1466,10 +1469,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1466
1469
  return target;
1467
1470
  }
1468
1471
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1469
- const targetType = getTargetType(target);
1470
- if (targetType === 0) return target;
1472
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1471
1473
  const existingProxy = proxyMap.get(target);
1472
1474
  if (existingProxy) return existingProxy;
1475
+ const targetType = targetTypeMap(toRawType(target));
1476
+ if (targetType === 0) return target;
1473
1477
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1474
1478
  proxyMap.set(target, proxy);
1475
1479
  return proxy;
@@ -1902,9 +1906,11 @@ var ReactiveEffect = class {
1902
1906
  if (!this.active) return this.fn();
1903
1907
  cleanup(this);
1904
1908
  const prevSub = startTracking(this);
1909
+ incRunDepth();
1905
1910
  try {
1906
1911
  return this.fn();
1907
1912
  } finally {
1913
+ decRunDepth();
1908
1914
  endTracking(this, prevSub);
1909
1915
  const flags = this.flags;
1910
1916
  if ((flags & 136) === 136) {
@@ -2285,8 +2291,9 @@ var WatcherEffect = class extends ReactiveEffect {
2285
2291
  if (once && cb) {
2286
2292
  const _cb = cb;
2287
2293
  cb = (...args) => {
2288
- _cb(...args);
2294
+ const res = _cb(...args);
2289
2295
  this.stop();
2296
+ return res;
2290
2297
  };
2291
2298
  }
2292
2299
  this.cb = cb;
@@ -2300,7 +2307,7 @@ var WatcherEffect = class extends ReactiveEffect {
2300
2307
  if (!this.cb) return;
2301
2308
  const { immediate, deep, call } = this.options;
2302
2309
  if (initialRun && !immediate) return;
2303
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2310
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2304
2311
  cleanup(this);
2305
2312
  const currentWatcher = activeWatcher;
2306
2313
  activeWatcher = this;
@@ -2607,8 +2614,8 @@ function findInsertionIndex(order, queue, start, end) {
2607
2614
  /**
2608
2615
  * @internal for runtime-vapor only
2609
2616
  */
2610
- function queueJob(job, id, isPre = false) {
2611
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2617
+ function queueJob(job, id, isPre = false, order = 0) {
2618
+ 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)) {
2612
2619
  jobsLength++;
2613
2620
  queueFlush();
2614
2621
  }
@@ -2717,6 +2724,7 @@ function flushJobs(seen) {
2717
2724
  }
2718
2725
  flushIndex = 0;
2719
2726
  jobsLength = 0;
2727
+ jobs.length = 0;
2720
2728
  flushPostFlushCbs(seen);
2721
2729
  currentFlushPromise = null;
2722
2730
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2774,6 +2782,14 @@ function createRecord(id, initialDef) {
2774
2782
  function normalizeClassComponent(component) {
2775
2783
  return isClassComponent(component) ? component.__vccOpts : component;
2776
2784
  }
2785
+ function hasDirtyAncestor(instance, dirtyInstances) {
2786
+ let parent = instance.parent;
2787
+ while (parent) {
2788
+ if (dirtyInstances.has(parent)) return true;
2789
+ parent = parent.parent;
2790
+ }
2791
+ return false;
2792
+ }
2777
2793
  function rerender(id, newRender) {
2778
2794
  const record = map.get(id);
2779
2795
  if (!record) return;
@@ -2805,42 +2821,69 @@ function reload(id, newComp) {
2805
2821
  const isVapor = record.initialDef.__vapor;
2806
2822
  updateComponentDef(record.initialDef, newComp);
2807
2823
  const instances = [...record.instances];
2808
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2824
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2809
2825
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2810
- for (const instance of instances) instance.hmrReload(newComp);
2811
- } else for (const instance of instances) {
2812
- const oldComp = normalizeClassComponent(instance.type);
2813
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2814
- if (!dirtyInstances) {
2815
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2816
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2817
- }
2818
- dirtyInstances.add(instance);
2819
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2820
- instance.appContext.propsCache.delete(instance.type);
2821
- instance.appContext.emitsCache.delete(instance.type);
2822
- instance.appContext.optionsCache.delete(instance.type);
2823
- if (instance.ceReload) {
2824
- dirtyInstances.add(instance);
2825
- instance.ceReload(newComp.styles);
2826
- dirtyInstances.delete(instance);
2827
- } else if (instance.parent) queueJob(() => {
2828
- isHmrUpdating = true;
2826
+ const dirtyInstances = new Set(instances);
2827
+ const rerenderedParents = /* @__PURE__ */ new Set();
2828
+ for (const instance of instances) {
2829
2829
  const parent = instance.parent;
2830
- if (parent.vapor) parent.hmrRerender();
2831
- else if (!(parent.effect.flags & 1024)) {
2832
- parent.renderCache = [];
2833
- parent.effect.run();
2830
+ if (parent) {
2831
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2832
+ rerenderedParents.add(parent);
2833
+ parent.hmrRerender();
2834
+ }
2835
+ } else instance.hmrReload(newComp);
2836
+ }
2837
+ } else {
2838
+ const parentUpdates = /* @__PURE__ */ new Map();
2839
+ const dirtyInstanceSet = new Set(instances);
2840
+ for (const instance of instances) {
2841
+ const oldComp = normalizeClassComponent(instance.type);
2842
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2843
+ if (!dirtyInstances) {
2844
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2845
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2834
2846
  }
2835
- nextTick(() => {
2836
- isHmrUpdating = false;
2847
+ dirtyInstances.add(instance);
2848
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2849
+ instance.appContext.propsCache.delete(instance.type);
2850
+ instance.appContext.emitsCache.delete(instance.type);
2851
+ instance.appContext.optionsCache.delete(instance.type);
2852
+ if (instance.ceReload) {
2853
+ dirtyInstances.add(instance);
2854
+ instance.ceReload(newComp.styles);
2855
+ dirtyInstances.delete(instance);
2856
+ } else if (instance.parent) {
2857
+ const parent = instance.parent;
2858
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2859
+ let updates = parentUpdates.get(parent);
2860
+ if (!updates) parentUpdates.set(parent, updates = []);
2861
+ updates.push([instance, dirtyInstances]);
2862
+ }
2863
+ } else if (instance.appContext.reload) instance.appContext.reload();
2864
+ else if (typeof window !== "undefined") window.location.reload();
2865
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2866
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2867
+ }
2868
+ parentUpdates.forEach((updates, parent) => {
2869
+ queueJob(() => {
2870
+ isHmrUpdating = true;
2871
+ if (parent.vapor) parent.hmrRerender();
2872
+ else {
2873
+ const i = parent;
2874
+ if (!(i.effect.flags & 1024)) {
2875
+ i.renderCache = [];
2876
+ i.effect.run();
2877
+ }
2878
+ }
2879
+ nextTick(() => {
2880
+ isHmrUpdating = false;
2881
+ });
2882
+ updates.forEach(([instance, dirtyInstances]) => {
2883
+ dirtyInstances.delete(instance);
2884
+ });
2837
2885
  });
2838
- dirtyInstances.delete(instance);
2839
2886
  });
2840
- else if (instance.appContext.reload) instance.appContext.reload();
2841
- else if (typeof window !== "undefined") window.location.reload();
2842
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2843
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2844
2887
  }
2845
2888
  queuePostFlushCb(() => {
2846
2889
  hmrDirtyComponents.clear();
@@ -3307,10 +3350,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
3307
3350
  const renderFnWithContext = (...args) => {
3308
3351
  if (renderFnWithContext._d) setBlockTracking(-1);
3309
3352
  const prevInstance = setCurrentRenderingInstance(ctx);
3353
+ const prevStackSize = blockStack.length;
3310
3354
  let res;
3311
3355
  try {
3312
3356
  res = fn(...args);
3313
3357
  } finally {
3358
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
3314
3359
  setCurrentRenderingInstance(prevInstance);
3315
3360
  if (renderFnWithContext._d) setBlockTracking(1);
3316
3361
  }
@@ -3530,7 +3575,7 @@ function instanceWatch(source, value, options) {
3530
3575
  }
3531
3576
  const prev = setCurrentInstance(this);
3532
3577
  const res = doWatch(getter, cb.bind(publicThis), options);
3533
- setCurrentInstance(...prev);
3578
+ restoreCurrentInstance(prev);
3534
3579
  return res;
3535
3580
  }
3536
3581
  function createPathGetter(ctx, path) {
@@ -3543,6 +3588,7 @@ function createPathGetter(ctx, path) {
3543
3588
  }
3544
3589
  //#endregion
3545
3590
  //#region packages/runtime-core/src/components/Teleport.ts
3591
+ const pendingMounts = /* @__PURE__ */ new WeakMap();
3546
3592
  const TeleportEndKey = Symbol("_vte");
3547
3593
  const isTeleport = (type) => type.__isTeleport;
3548
3594
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
@@ -3568,58 +3614,70 @@ const TeleportImpl = {
3568
3614
  name: "Teleport",
3569
3615
  __isTeleport: true,
3570
3616
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3571
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3617
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3572
3618
  const disabled = isTeleportDisabled(n2.props);
3573
- let { shapeFlag, children, dynamicChildren } = n2;
3619
+ let { dynamicChildren } = n2;
3574
3620
  if (isHmrUpdating) {
3575
3621
  optimized = false;
3576
3622
  dynamicChildren = null;
3577
3623
  }
3624
+ const mount = (vnode, container, anchor) => {
3625
+ if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
3626
+ };
3627
+ const mountToTarget = (vnode = n2) => {
3628
+ const disabled = isTeleportDisabled(vnode.props);
3629
+ const target = vnode.target = resolveTarget(vnode.props, querySelector);
3630
+ const targetAnchor = prepareAnchor(target, vnode, createText, insert);
3631
+ if (target) {
3632
+ if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
3633
+ else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
3634
+ if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3635
+ if (!disabled) {
3636
+ mount(vnode, target, targetAnchor);
3637
+ updateCssVars(vnode, false);
3638
+ }
3639
+ } else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
3640
+ };
3641
+ const queuePendingMount = (vnode) => {
3642
+ const mountJob = () => {
3643
+ if (pendingMounts.get(vnode) !== mountJob) return;
3644
+ pendingMounts.delete(vnode);
3645
+ if (isTeleportDisabled(vnode.props)) {
3646
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3647
+ updateCssVars(vnode, true);
3648
+ }
3649
+ mountToTarget(vnode);
3650
+ };
3651
+ pendingMounts.set(vnode, mountJob);
3652
+ queuePostRenderEffect(mountJob, void 0, parentSuspense);
3653
+ };
3578
3654
  if (n1 == null) {
3579
3655
  const placeholder = n2.el = createComment("teleport start");
3580
3656
  const mainAnchor = n2.anchor = createComment("teleport end");
3581
3657
  insert(placeholder, container, anchor);
3582
3658
  insert(mainAnchor, container, anchor);
3583
- const mount = (container, anchor) => {
3584
- if (shapeFlag & 16) mountChildren(children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
3585
- };
3586
- const mountToTarget = () => {
3587
- const target = n2.target = resolveTarget(n2.props, querySelector);
3588
- const targetAnchor = prepareAnchor(target, n2, createText, insert);
3589
- if (target) {
3590
- if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
3591
- else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
3592
- if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3593
- if (!disabled) {
3594
- mount(target, targetAnchor);
3595
- updateCssVars(n2, false);
3596
- }
3597
- } else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
3598
- };
3659
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3660
+ queuePendingMount(n2);
3661
+ return;
3662
+ }
3599
3663
  if (disabled) {
3600
- mount(container, mainAnchor);
3664
+ mount(n2, container, mainAnchor);
3601
3665
  updateCssVars(n2, true);
3602
3666
  }
3603
- if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3604
- n2.el.__isMounted = false;
3605
- queuePostRenderEffect(() => {
3606
- if (n2.el.__isMounted !== false) return;
3607
- mountToTarget();
3608
- delete n2.el.__isMounted;
3609
- }, void 0, parentSuspense);
3610
- } else mountToTarget();
3667
+ mountToTarget();
3611
3668
  } else {
3612
3669
  n2.el = n1.el;
3613
- n2.targetStart = n1.targetStart;
3614
3670
  const mainAnchor = n2.anchor = n1.anchor;
3615
- const target = n2.target = n1.target;
3616
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3617
- if (n1.el.__isMounted === false) {
3618
- queuePostRenderEffect(() => {
3619
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3620
- }, void 0, parentSuspense);
3671
+ const pendingMount = pendingMounts.get(n1);
3672
+ if (pendingMount) {
3673
+ pendingMount.flags |= 4;
3674
+ pendingMounts.delete(n1);
3675
+ queuePendingMount(n2);
3621
3676
  return;
3622
3677
  }
3678
+ n2.targetStart = n1.targetStart;
3679
+ const target = n2.target = n1.target;
3680
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3623
3681
  const wasDisabled = isTeleportDisabled(n1.props);
3624
3682
  const currentContainer = wasDisabled ? container : target;
3625
3683
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -3633,24 +3691,30 @@ const TeleportImpl = {
3633
3691
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
3634
3692
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
3635
3693
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
3636
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
3637
- if (nextTarget) moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
3638
- else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
3694
+ const nextTarget = resolveTarget(n2.props, querySelector);
3695
+ if (nextTarget) {
3696
+ n2.target = nextTarget;
3697
+ moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
3698
+ } else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
3639
3699
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
3640
3700
  updateCssVars(n2, disabled);
3641
3701
  }
3642
3702
  },
3643
3703
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3644
- const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3704
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
3705
+ const disabled = isTeleportDisabled(props);
3706
+ const shouldRemove = doRemove || !disabled;
3707
+ const pendingMount = pendingMounts.get(vnode);
3708
+ if (pendingMount) {
3709
+ pendingMount.flags |= 4;
3710
+ pendingMounts.delete(vnode);
3711
+ }
3645
3712
  if (targetStart) hostRemove(targetStart);
3646
3713
  if (targetAnchor) hostRemove(targetAnchor);
3647
3714
  doRemove && hostRemove(anchor);
3648
- if (shapeFlag & 16) {
3649
- const shouldRemove = doRemove || !isTeleportDisabled(props);
3650
- for (let i = 0; i < children.length; i++) {
3651
- const child = children[i];
3652
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3653
- }
3715
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3716
+ const child = children[i];
3717
+ unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3654
3718
  }
3655
3719
  },
3656
3720
  move: moveTeleport,
@@ -3661,7 +3725,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3661
3725
  const { el, anchor, shapeFlag, children, props } = vnode;
3662
3726
  const isReorder = moveType === 2;
3663
3727
  if (isReorder) insert(el, container, parentAnchor);
3664
- if (!isReorder || isTeleportDisabled(props)) {
3728
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3665
3729
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3666
3730
  }
3667
3731
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3786,8 +3850,8 @@ const BaseTransitionImpl = {
3786
3850
  const state = useTransitionState();
3787
3851
  return () => {
3788
3852
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3789
- if (!children || !children.length) return;
3790
- const child = findNonCommentChild(children);
3853
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3854
+ if (!child) return;
3791
3855
  const rawProps = /* @__PURE__ */ toRaw(props);
3792
3856
  const { mode } = rawProps;
3793
3857
  checkTransitionMode(mode);
@@ -3970,12 +4034,11 @@ function getInnerChild$1(vnode) {
3970
4034
  }
3971
4035
  }
3972
4036
  function setTransitionHooks(vnode, hooks) {
3973
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3974
- else {
4037
+ if (vnode.shapeFlag & 6 && vnode.component) {
3975
4038
  vnode.transition = hooks;
3976
- setTransitionHooks(vnode.component.subTree, hooks);
3977
- }
3978
- else if (vnode.shapeFlag & 128) {
4039
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
4040
+ else setTransitionHooks(vnode.component.subTree, hooks);
4041
+ } else if (vnode.shapeFlag & 128) {
3979
4042
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3980
4043
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3981
4044
  } else vnode.transition = hooks;
@@ -4240,7 +4303,7 @@ function createHydrationFunctions(rendererInternals) {
4240
4303
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
4241
4304
  break;
4242
4305
  case VaporSlot:
4243
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
4306
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
4244
4307
  break;
4245
4308
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) nextNode = onMismatch();
4246
4309
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -4250,16 +4313,31 @@ function createHydrationFunctions(rendererInternals) {
4250
4313
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
4251
4314
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
4252
4315
  else nextNode = nextSibling(node);
4253
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
4254
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
4255
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4256
- let subTree;
4257
- if (isFragmentStart) {
4258
- subTree = createVNode(Fragment);
4259
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4260
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4261
- subTree.el = node;
4262
- vnode.component.subTree = subTree;
4316
+ if (vnode.type.__vapor) {
4317
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
4318
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
4319
+ if (vnode.dirs) {
4320
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
4321
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4322
+ }
4323
+ }, () => {
4324
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
4325
+ });
4326
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
4327
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
4328
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
4329
+ } else {
4330
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
4331
+ const component = vnode.component;
4332
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
4333
+ let subTree;
4334
+ if (isFragmentStart) {
4335
+ subTree = createVNode(Fragment);
4336
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
4337
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
4338
+ subTree.el = node;
4339
+ component.subTree = subTree;
4340
+ }
4263
4341
  }
4264
4342
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
4265
4343
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -4271,7 +4349,7 @@ function createHydrationFunctions(rendererInternals) {
4271
4349
  };
4272
4350
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4273
4351
  optimized = optimized || !!vnode.dynamicChildren;
4274
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4352
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
4275
4353
  const forcePatch = type === "input" || type === "option";
4276
4354
  {
4277
4355
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
@@ -4289,15 +4367,11 @@ function createHydrationFunctions(rendererInternals) {
4289
4367
  }
4290
4368
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
4291
4369
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
4292
- let hasWarned = false;
4370
+ if (next && !isMismatchAllowed(el, 1)) {
4371
+ warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4372
+ logMismatchError();
4373
+ }
4293
4374
  while (next) {
4294
- if (!isMismatchAllowed(el, 1)) {
4295
- if (!hasWarned) {
4296
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4297
- hasWarned = true;
4298
- }
4299
- logMismatchError();
4300
- }
4301
4375
  const cur = next;
4302
4376
  next = next.nextSibling;
4303
4377
  remove(cur);
@@ -4316,9 +4390,10 @@ function createHydrationFunctions(rendererInternals) {
4316
4390
  }
4317
4391
  if (props) {
4318
4392
  const isCustomElement = el.tagName.includes("-");
4393
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4319
4394
  for (const key in props) {
4320
4395
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
4321
- 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);
4396
+ 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);
4322
4397
  }
4323
4398
  }
4324
4399
  let vnodeHooks;
@@ -4336,7 +4411,7 @@ function createHydrationFunctions(rendererInternals) {
4336
4411
  optimized = optimized || !!parentVNode.dynamicChildren;
4337
4412
  const children = parentVNode.children;
4338
4413
  const l = children.length;
4339
- let hasWarned = false;
4414
+ let hasCheckedMismatch = false;
4340
4415
  for (let i = 0; i < l; i++) {
4341
4416
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4342
4417
  const isText = vnode.type === Text;
@@ -4350,12 +4425,12 @@ function createHydrationFunctions(rendererInternals) {
4350
4425
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
4351
4426
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
4352
4427
  else {
4353
- if (!isMismatchAllowed(container, 1)) {
4354
- if (!hasWarned) {
4428
+ if (!hasCheckedMismatch) {
4429
+ hasCheckedMismatch = true;
4430
+ if (!isMismatchAllowed(container, 1)) {
4355
4431
  warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
4356
- hasWarned = true;
4432
+ logMismatchError();
4357
4433
  }
4358
- logMismatchError();
4359
4434
  }
4360
4435
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
4361
4436
  }
@@ -4375,7 +4450,7 @@ function createHydrationFunctions(rendererInternals) {
4375
4450
  }
4376
4451
  };
4377
4452
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4378
- if (!isMismatchAllowed(node.parentElement, 1)) {
4453
+ if (!isNodeMismatchAllowed(node, vnode)) {
4379
4454
  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);
4380
4455
  logMismatchError();
4381
4456
  }
@@ -4539,7 +4614,9 @@ const MismatchTypeString = {
4539
4614
  };
4540
4615
  function isMismatchAllowed(el, allowedType) {
4541
4616
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
4542
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
4617
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
4618
+ }
4619
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
4543
4620
  if (allowedAttr == null) return false;
4544
4621
  else if (allowedAttr === "") return true;
4545
4622
  else {
@@ -4548,6 +4625,16 @@ function isMismatchAllowed(el, allowedType) {
4548
4625
  return list.includes(MismatchTypeString[allowedType]);
4549
4626
  }
4550
4627
  }
4628
+ function isNodeMismatchAllowed(node, vnode) {
4629
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
4630
+ }
4631
+ function isMismatchAllowedByNode(node) {
4632
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
4633
+ }
4634
+ function isMismatchAllowedByVNode({ props }) {
4635
+ const allowedAttr = props && props[allowMismatchAttr];
4636
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
4637
+ }
4551
4638
  //#endregion
4552
4639
  //#region packages/runtime-core/src/hydrationStrategies.ts
4553
4640
  let requestIdleCallback;
@@ -4666,11 +4753,16 @@ function defineAsyncComponent(source) {
4666
4753
  onError(err);
4667
4754
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
4668
4755
  });
4669
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
4756
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
4670
4757
  load().then(() => {
4758
+ if (instance.isUnmounted) return;
4671
4759
  loaded.value = true;
4672
4760
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
4673
4761
  }).catch((err) => {
4762
+ if (instance.isUnmounted) {
4763
+ setPendingRequest(null);
4764
+ return;
4765
+ }
4674
4766
  onError(err);
4675
4767
  error.value = err;
4676
4768
  });
@@ -4728,14 +4820,22 @@ function createAsyncComponentContext(source) {
4728
4820
  setPendingRequest: (request) => pendingRequest = request
4729
4821
  };
4730
4822
  }
4731
- const useAsyncComponentState = (delay, timeout, onError) => {
4823
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
4732
4824
  const loaded = /* @__PURE__ */ ref(false);
4733
4825
  const error = /* @__PURE__ */ ref();
4734
4826
  const delayed = /* @__PURE__ */ ref(!!delay);
4735
- if (delay) setTimeout(() => {
4827
+ let timeoutTimer;
4828
+ let delayTimer;
4829
+ if (instance) onUnmounted(() => {
4830
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4831
+ if (delayTimer != null) clearTimeout(delayTimer);
4832
+ }, instance);
4833
+ if (delay) delayTimer = setTimeout(() => {
4834
+ if (instance && instance.isUnmounted) return;
4736
4835
  delayed.value = false;
4737
4836
  }, delay);
4738
- if (timeout != null) setTimeout(() => {
4837
+ if (timeout != null) timeoutTimer = setTimeout(() => {
4838
+ if (instance && instance.isUnmounted) return;
4739
4839
  if (!loaded.value && !error.value) {
4740
4840
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
4741
4841
  onError(err);
@@ -4753,6 +4853,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
4753
4853
  * @internal
4754
4854
  */
4755
4855
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
4856
+ const wasConnected = el.isConnected;
4756
4857
  let patched = false;
4757
4858
  (instance.bu || (instance.bu = [])).push(() => patched = true);
4758
4859
  const performHydrate = () => {
@@ -4763,6 +4864,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
4763
4864
  }
4764
4865
  return;
4765
4866
  }
4867
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
4766
4868
  hydrate();
4767
4869
  };
4768
4870
  const doHydrate = hydrateStrategy ? () => {
@@ -5008,7 +5110,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
5008
5110
  try {
5009
5111
  return callWithAsyncErrorHandling(hook, target, type, args);
5010
5112
  } finally {
5011
- setCurrentInstance(...prev);
5113
+ restoreCurrentInstance(prev);
5012
5114
  setActiveSub(prevSub);
5013
5115
  }
5014
5116
  });
@@ -5347,8 +5449,9 @@ function createSlots(slots, dynamicSlots) {
5347
5449
  * Compiler runtime helper for rendering `<slot/>`
5348
5450
  * @private
5349
5451
  */
5350
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5452
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5351
5453
  let slot = slots[name];
5454
+ if (fallback) fallback.__vdom = true;
5352
5455
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
5353
5456
  if (vaporSlot) {
5354
5457
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -5356,25 +5459,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5356
5459
  slot: vaporSlot,
5357
5460
  fallback
5358
5461
  };
5462
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
5359
5463
  return ret;
5360
5464
  }
5361
5465
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
5362
- const hasProps = Object.keys(props).length > 0;
5363
- if (name !== "default") props.name = name;
5364
- return openBlock(), createBlock(Fragment, null, [createVNode("slot", props, fallback && fallback())], hasProps ? -2 : 64);
5466
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5467
+ const hasProps = Object.keys(slotProps).length > 0;
5468
+ if (name !== "default") slotProps.name = name;
5469
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
5365
5470
  }
5366
5471
  if (slot && slot.length > 1) {
5367
5472
  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.");
5368
5473
  slot = () => [];
5369
5474
  }
5370
5475
  if (slot && slot._c) slot._d = false;
5476
+ const prevStackSize = blockStack.length;
5371
5477
  openBlock();
5372
- const validSlotContent = slot && ensureValidVNode(slot(props));
5373
- ensureVaporSlotFallback(validSlotContent, fallback);
5374
- const slotKey = props.key || validSlotContent && validSlotContent.key;
5375
- const rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
5478
+ let rendered;
5479
+ try {
5480
+ const validSlotContent = slot && ensureValidVNode(slot(props));
5481
+ ensureVaporSlotFallback(validSlotContent, fallback);
5482
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
5483
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
5484
+ } catch (err) {
5485
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
5486
+ throw err;
5487
+ } finally {
5488
+ if (slot && slot._c) slot._d = true;
5489
+ }
5376
5490
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
5377
- if (slot && slot._c) slot._d = true;
5378
5491
  return rendered;
5379
5492
  }
5380
5493
  function ensureValidVNode(vnodes) {
@@ -5387,9 +5500,7 @@ function ensureValidVNode(vnodes) {
5387
5500
  }
5388
5501
  function ensureVaporSlotFallback(vnodes, fallback) {
5389
5502
  let vaporSlot;
5390
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5391
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
5392
- }
5503
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
5393
5504
  }
5394
5505
  //#endregion
5395
5506
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5944,26 +6055,39 @@ function createPropsRestProxy(props, excludedKeys) {
5944
6055
  function withAsyncContext(getAwaitable) {
5945
6056
  const ctx = getCurrentGenericInstance();
5946
6057
  const inSSRSetup = isInSSRComponentSetup;
6058
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
5947
6059
  if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
5948
6060
  let awaitable = getAwaitable();
5949
6061
  setCurrentInstance(null, void 0);
5950
6062
  if (inSSRSetup) setInSSRSetupState(false);
5951
6063
  const restore = () => {
6064
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5952
6065
  setCurrentInstance(ctx);
5953
6066
  if (inSSRSetup) setInSSRSetupState(true);
6067
+ const reset = restoreAsyncContext && restoreAsyncContext();
6068
+ return () => {
6069
+ if (reset) reset();
6070
+ if (resetStoppedScope) resetStoppedScope.reset();
6071
+ };
5954
6072
  };
5955
6073
  const cleanup = () => {
5956
6074
  setCurrentInstance(null, void 0);
5957
6075
  if (inSSRSetup) setInSSRSetupState(false);
5958
6076
  };
5959
6077
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
5960
- restore();
5961
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
6078
+ const reset = restore();
6079
+ Promise.resolve().then(() => Promise.resolve().then(() => {
6080
+ if (reset) reset();
6081
+ cleanup();
6082
+ }));
5962
6083
  throw e;
5963
6084
  });
5964
6085
  return [awaitable, () => {
5965
- restore();
5966
- Promise.resolve().then(cleanup);
6086
+ const reset = restore();
6087
+ Promise.resolve().then(() => {
6088
+ if (reset) reset();
6089
+ cleanup();
6090
+ });
5967
6091
  }];
5968
6092
  }
5969
6093
  //#endregion
@@ -6282,7 +6406,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6282
6406
  if (options.el) return vm.$mount(options.el);
6283
6407
  else return vm;
6284
6408
  }
6285
- Vue.version = `2.6.14-compat:3.6.0-beta.9`;
6409
+ Vue.version = `2.6.14-compat:3.6.0-rc.2`;
6286
6410
  Vue.config = singletonApp.config;
6287
6411
  Vue.use = (plugin, ...options) => {
6288
6412
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -6537,7 +6661,9 @@ function defineReactive(obj, key, val) {
6537
6661
  else Object.keys(val).forEach((key) => {
6538
6662
  try {
6539
6663
  defineReactiveSimple(val, key, val[key]);
6540
- } catch (e) {}
6664
+ } catch (e) {
6665
+ warn$1(`Failed making property "${key}" reactive:`, e);
6666
+ }
6541
6667
  });
6542
6668
  }
6543
6669
  const i = obj.$;
@@ -6782,12 +6908,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
6782
6908
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
6783
6909
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
6784
6910
  }
6785
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
6911
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
6912
+ if (!hasVModel) {
6786
6913
  localValue = value;
6787
6914
  trigger();
6788
6915
  }
6789
6916
  i.emit(`update:${name}`, emittedValue);
6790
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
6917
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
6791
6918
  prevSetValue = value;
6792
6919
  prevEmittedValue = emittedValue;
6793
6920
  }
@@ -6900,7 +7027,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6900
7027
  function isEmitListener(options, key) {
6901
7028
  if (!options || !isOn(key)) return false;
6902
7029
  if (key.startsWith(compatModelEventPrefix)) return true;
6903
- key = key.slice(2).replace(/Once$/, "");
7030
+ key = key.slice(2);
7031
+ key = key === "Once" ? key : key.replace(/Once$/, "");
6904
7032
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
6905
7033
  }
6906
7034
  //#endregion
@@ -7271,7 +7399,7 @@ function baseResolveDefault(factory, instance, key) {
7271
7399
  const prev = setCurrentInstance(instance);
7272
7400
  const props = /* @__PURE__ */ toRaw(instance.props);
7273
7401
  value = factory.call(isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null, props);
7274
- setCurrentInstance(...prev);
7402
+ restoreCurrentInstance(prev);
7275
7403
  return value;
7276
7404
  }
7277
7405
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -7418,7 +7546,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7418
7546
  const receivedType = toRawType(value);
7419
7547
  const expectedValue = styleValue(value, expectedType);
7420
7548
  const receivedValue = styleValue(value, receivedType);
7421
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7549
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7422
7550
  message += `, got ${receivedType} `;
7423
7551
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
7424
7552
  return message;
@@ -7427,7 +7555,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7427
7555
  * dev only
7428
7556
  */
7429
7557
  function styleValue(value, type) {
7430
- if (type === "String") return `"${value}"`;
7558
+ if (isSymbol(value)) return value.toString();
7559
+ else if (type === "String") return `"${value}"`;
7431
7560
  else if (type === "Number") return `${Number(value)}`;
7432
7561
  else return `${value}`;
7433
7562
  }
@@ -7444,8 +7573,11 @@ function isExplicable(type) {
7444
7573
  /**
7445
7574
  * dev only
7446
7575
  */
7447
- function isBoolean(...args) {
7448
- return args.some((elem) => elem.toLowerCase() === "boolean");
7576
+ function isCoercible(...args) {
7577
+ return args.every((elem) => {
7578
+ const value = elem.toLowerCase();
7579
+ return value !== "boolean" && value !== "symbol";
7580
+ });
7449
7581
  }
7450
7582
  //#endregion
7451
7583
  //#region packages/runtime-core/src/componentSlots.ts
@@ -7750,7 +7882,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7750
7882
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
7751
7883
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7752
7884
  parentComponent && toggleRecurse(parentComponent, true);
7753
- if (isHmrUpdating) {
7885
+ if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
7754
7886
  patchFlag = 0;
7755
7887
  optimized = false;
7756
7888
  dynamicChildren = null;
@@ -7828,21 +7960,37 @@ function baseCreateRenderer(options, createHydrationFns) {
7828
7960
  };
7829
7961
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7830
7962
  n2.slotScopeIds = slotScopeIds;
7831
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
7963
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
7832
7964
  else {
7965
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
7833
7966
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
7834
7967
  if (n2.dirs) {
7835
7968
  invokeDirectiveHook(n2, null, parentComponent, "created");
7836
7969
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
7837
7970
  }
7971
+ }, () => {
7972
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
7838
7973
  });
7839
7974
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
7975
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
7976
+ if (vnodeMountedHook) {
7977
+ const scopedVNode = n2;
7978
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
7979
+ }
7840
7980
  }
7841
7981
  else {
7842
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
7982
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
7983
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
7843
7984
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
7985
+ }, () => {
7986
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
7987
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
7844
7988
  });
7845
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
7989
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
7990
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
7991
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
7992
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
7993
+ }, void 0, parentSuspense);
7846
7994
  }
7847
7995
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
7848
7996
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -8165,7 +8313,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8165
8313
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
8166
8314
  const { el, type, transition, children, shapeFlag } = vnode;
8167
8315
  if (isVaporComponent(type) || type === VaporSlot) {
8168
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
8316
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
8169
8317
  return;
8170
8318
  }
8171
8319
  if (shapeFlag & 6) {
@@ -8198,8 +8346,10 @@ function baseCreateRenderer(options, createHydrationFns) {
8198
8346
  else hostInsert(el, container, anchor);
8199
8347
  };
8200
8348
  const performLeave = () => {
8349
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8201
8350
  if (el._isLeaving) el[leaveCbKey](true);
8202
- leave(el, () => {
8351
+ if (transition.persisted && !wasLeaving) remove();
8352
+ else leave(el, () => {
8203
8353
  remove();
8204
8354
  afterLeave && afterLeave();
8205
8355
  });
@@ -8219,7 +8369,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8219
8369
  }
8220
8370
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
8221
8371
  if (shapeFlag & 256) {
8222
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
8372
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
8223
8373
  else parentComponent.ctx.deactivate(vnode);
8224
8374
  return;
8225
8375
  }
@@ -8229,8 +8379,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8229
8379
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
8230
8380
  if (shapeFlag & 6) if (isVaporComponent(type)) {
8231
8381
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
8232
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8233
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
8382
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8383
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
8384
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8385
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8386
+ }, void 0, parentSuspense);
8234
8387
  return;
8235
8388
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
8236
8389
  else {
@@ -8243,7 +8396,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8243
8396
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
8244
8397
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
8245
8398
  if (type === VaporSlot) {
8246
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
8399
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
8247
8400
  return;
8248
8401
  }
8249
8402
  if (doRemove) remove(vnode);
@@ -8292,7 +8445,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8292
8445
  if (effect) {
8293
8446
  effect.stop();
8294
8447
  unmount(subTree, instance, parentSuspense, doRemove);
8295
- }
8448
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
8296
8449
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
8297
8450
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) queuePostRenderEffect(() => instance.emit("hook:destroyed"), void 0, parentSuspense);
8298
8451
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
@@ -8419,6 +8572,10 @@ function invalidateMount(hooks) {
8419
8572
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
8420
8573
  }
8421
8574
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
8575
+ if (force && transition.persisted && !el[leaveCbKey]) {
8576
+ insert();
8577
+ return;
8578
+ }
8422
8579
  if (force || needTransition(parentSuspense, transition)) {
8423
8580
  transition.beforeEnter(el);
8424
8581
  insert();
@@ -8621,15 +8778,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8621
8778
  if (suspense.isHydrating) suspense.isHydrating = false;
8622
8779
  else if (!resume) {
8623
8780
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8781
+ let hasUpdatedAnchor = false;
8624
8782
  if (delayEnter) activeBranch.transition.afterLeave = () => {
8625
8783
  if (pendingId === suspense.pendingId) {
8626
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8784
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8627
8785
  queuePostFlushCb(effects);
8628
8786
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
8629
8787
  }
8630
8788
  };
8631
8789
  if (activeBranch && !suspense.isFallbackMountPending) {
8632
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
8790
+ if (parentNode(activeBranch.el) === container) {
8791
+ anchor = next(activeBranch);
8792
+ hasUpdatedAnchor = true;
8793
+ }
8633
8794
  unmount(activeBranch, parentComponent, suspense, true);
8634
8795
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
8635
8796
  }
@@ -8693,6 +8854,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8693
8854
  handleError(err, instance, 0);
8694
8855
  }).then((asyncSetupResult) => {
8695
8856
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
8857
+ setCurrentInstance(null, void 0);
8696
8858
  instance.asyncResolved = true;
8697
8859
  onResolve(asyncSetupResult);
8698
8860
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -9025,12 +9187,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9025
9187
  el: vnode.el,
9026
9188
  anchor: vnode.anchor,
9027
9189
  ctx: vnode.ctx,
9028
- ce: vnode.ce
9190
+ ce: vnode.ce,
9191
+ vi: vnode.vi,
9192
+ vs: cloneVaporSlotMeta(vnode),
9193
+ vb: vnode.vb
9029
9194
  };
9030
9195
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
9031
9196
  defineLegacyVNodeProperties(cloned);
9032
9197
  return cloned;
9033
9198
  }
9199
+ function cloneVaporSlotMeta(vnode) {
9200
+ const vaporSlot = vnode.vs;
9201
+ if (!vaporSlot) return vaporSlot;
9202
+ const cloned = {
9203
+ slot: vaporSlot.slot,
9204
+ fallback: vaporSlot.fallback,
9205
+ outletFallback: vaporSlot.outletFallback
9206
+ };
9207
+ if (vnode.el) {
9208
+ cloned.state = vaporSlot.state;
9209
+ cloned.ref = vaporSlot.ref;
9210
+ cloned.scope = vaporSlot.scope;
9211
+ }
9212
+ return cloned;
9213
+ }
9034
9214
  /**
9035
9215
  * Dev only, for HMR of hoisted vnodes reused in v-for
9036
9216
  * https://github.com/vitejs/vite/issues/2022
@@ -9093,6 +9273,10 @@ function normalizeChildren(vnode, children) {
9093
9273
  }
9094
9274
  }
9095
9275
  else if (isFunction(children)) {
9276
+ if (shapeFlag & 65) {
9277
+ normalizeChildren(vnode, { default: children });
9278
+ return;
9279
+ }
9096
9280
  children = {
9097
9281
  default: children,
9098
9282
  _ctx: currentRenderingInstance
@@ -9165,6 +9349,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
9165
9349
  simpleSetCurrentInstance(instance);
9166
9350
  }
9167
9351
  };
9352
+ /**
9353
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
9354
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
9355
+ * verbatim instead of re-triggering the `instance.scope` default.
9356
+ * @internal
9357
+ */
9358
+ const restoreCurrentInstance = (prev) => {
9359
+ setCurrentScope(prev[1]);
9360
+ simpleSetCurrentInstance(prev[0]);
9361
+ };
9168
9362
  const internalOptions = [
9169
9363
  "ce",
9170
9364
  "type",
@@ -9316,7 +9510,7 @@ function setupStatefulComponent(instance, isSSR) {
9316
9510
  const setupResult = callWithErrorHandling(setup, instance, 0, [/* @__PURE__ */ shallowReadonly(instance.props), setupContext]);
9317
9511
  const isAsyncSetup = isPromise(setupResult);
9318
9512
  setActiveSub(prevSub);
9319
- setCurrentInstance(...prev);
9513
+ restoreCurrentInstance(prev);
9320
9514
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
9321
9515
  if (isAsyncSetup) {
9322
9516
  const unsetCurrentInstance = () => {
@@ -9390,7 +9584,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9390
9584
  applyOptions(instance);
9391
9585
  } finally {
9392
9586
  setActiveSub(prevSub);
9393
- setCurrentInstance(...prevInstance);
9587
+ restoreCurrentInstance(prevInstance);
9394
9588
  }
9395
9589
  }
9396
9590
  if (!Component.render && instance.render === NOOP && !isSSR) if (!compile$1 && Component.template)
@@ -9700,7 +9894,7 @@ function isMemoSame(cached, memo) {
9700
9894
  }
9701
9895
  //#endregion
9702
9896
  //#region packages/runtime-core/src/index.ts
9703
- const version = "3.6.0-beta.9";
9897
+ const version = "3.6.0-rc.2";
9704
9898
  const warn = warn$1;
9705
9899
  /**
9706
9900
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10128,7 +10322,10 @@ function patchStyle(el, prev, next) {
10128
10322
  }
10129
10323
  for (const key in next) {
10130
10324
  if (key === "display") hasControlledDisplay = true;
10131
- setStyle(style, key, next[key]);
10325
+ const value = next[key];
10326
+ if (value != null) {
10327
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
10328
+ } else setStyle(style, key, "");
10132
10329
  }
10133
10330
  } else if (isCssString) {
10134
10331
  if (prev !== next) {
@@ -10176,6 +10373,14 @@ function autoPrefix(style, rawName) {
10176
10373
  }
10177
10374
  return rawName;
10178
10375
  }
10376
+ /**
10377
+ * Browsers update textarea width/height directly during native resize.
10378
+ * Only special-case this common textarea path for now; other resize scenarios
10379
+ * still follow normal vnode style patching.
10380
+ */
10381
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
10382
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
10383
+ }
10179
10384
  //#endregion
10180
10385
  //#region packages/runtime-dom/src/modules/attrs.ts
10181
10386
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -10259,7 +10464,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10259
10464
  const existingInvoker = invokers[rawName];
10260
10465
  if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
10261
10466
  else {
10262
- const [name, options] = parseName(rawName);
10467
+ const [name, options] = parseEventName(rawName);
10263
10468
  if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
10264
10469
  else if (existingInvoker) {
10265
10470
  removeEventListener(el, name, existingInvoker, options);
@@ -10267,16 +10472,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10267
10472
  }
10268
10473
  }
10269
10474
  }
10270
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
10271
- function parseName(name) {
10475
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
10476
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
10477
+ function parseEventName(name) {
10272
10478
  let options;
10273
- if (optionsModifierRE.test(name)) {
10274
- options = {};
10275
- let m;
10276
- while (m = name.match(optionsModifierRE)) {
10277
- name = name.slice(0, name.length - m[0].length);
10278
- options[m[0].toLowerCase()] = true;
10279
- }
10479
+ let m;
10480
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
10481
+ if (!options) options = {};
10482
+ name = name.slice(0, name.length - m[1].length);
10483
+ options[m[1].toLowerCase()] = true;
10280
10484
  }
10281
10485
  return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
10282
10486
  }
@@ -10287,7 +10491,21 @@ function createInvoker(initialValue, instance) {
10287
10491
  const invoker = (e) => {
10288
10492
  if (!e._vts) e._vts = Date.now();
10289
10493
  else if (e._vts <= invoker.attached) return;
10290
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
10494
+ const value = invoker.value;
10495
+ if (isArray(value)) {
10496
+ const originalStop = e.stopImmediatePropagation;
10497
+ e.stopImmediatePropagation = () => {
10498
+ originalStop.call(e);
10499
+ e._stopped = true;
10500
+ };
10501
+ const handlers = value.slice();
10502
+ const args = [e];
10503
+ for (let i = 0; i < handlers.length; i++) {
10504
+ if (e._stopped) break;
10505
+ const handler = handlers[i];
10506
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
10507
+ }
10508
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
10291
10509
  };
10292
10510
  invoker.value = initialValue;
10293
10511
  invoker.attached = getNow();
@@ -10298,16 +10516,6 @@ function sanitizeEventValue(value, propName) {
10298
10516
  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}.`);
10299
10517
  return NOOP;
10300
10518
  }
10301
- function patchStopImmediatePropagation(e, value) {
10302
- if (isArray(value)) {
10303
- const originalStop = e.stopImmediatePropagation;
10304
- e.stopImmediatePropagation = () => {
10305
- originalStop.call(e);
10306
- e._stopped = true;
10307
- };
10308
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
10309
- } else return value;
10310
- }
10311
10519
  //#endregion
10312
10520
  //#region packages/runtime-dom/src/patchProp.ts
10313
10521
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -10635,7 +10843,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
10635
10843
  replacementNodes.push(child);
10636
10844
  }
10637
10845
  parent.removeChild(o);
10638
- slotReplacements.set(o, replacementNodes);
10846
+ slotReplacements.set(o, {
10847
+ nodes: replacementNodes,
10848
+ usedFallback: !content
10849
+ });
10639
10850
  }
10640
10851
  this._updateSlotNodes(slotReplacements);
10641
10852
  }
@@ -10825,7 +11036,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
10825
11036
  prevChildren = [];
10826
11037
  if (children) for (let i = 0; i < children.length; i++) {
10827
11038
  const child = children[i];
10828
- if (child.el && child.el instanceof Element) {
11039
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
10829
11040
  prevChildren.push(child);
10830
11041
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
10831
11042
  positionMap.set(child, getPosition(child.el));
@@ -11049,7 +11260,8 @@ const vModelSelect = {
11049
11260
  mounted(el, { value }) {
11050
11261
  vModelSetSelected(el, value);
11051
11262
  },
11052
- beforeUpdate(el, _binding, vnode) {
11263
+ beforeUpdate(el, { value }, vnode) {
11264
+ el._modelValue = value;
11053
11265
  el[assignKey] = getModelAssigner(vnode);
11054
11266
  },
11055
11267
  updated(el, { value }) {
@@ -11060,10 +11272,10 @@ const vModelSelect = {
11060
11272
  * @internal
11061
11273
  */
11062
11274
  const vModelSelectInit = (el, value, number, set) => {
11063
- const isSetModel = isSet(value);
11275
+ el._modelValue = value;
11064
11276
  addEventListener(el, "change", () => {
11065
11277
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
11066
- (set || el[assignKey])(el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]);
11278
+ (set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
11067
11279
  el._assigning = true;
11068
11280
  nextTick(() => {
11069
11281
  el._assigning = false;
@@ -11074,6 +11286,7 @@ const vModelSelectInit = (el, value, number, set) => {
11074
11286
  * @internal
11075
11287
  */
11076
11288
  const vModelSetSelected = (el, value) => {
11289
+ el._modelValue = value;
11077
11290
  if (el._assigning) return;
11078
11291
  const isMultiple = el.multiple;
11079
11292
  const isArrayValue = isArray(value);
@@ -13463,6 +13676,7 @@ function getUnnormalizedProps(props, callPath = []) {
13463
13676
  return [props, callPath];
13464
13677
  }
13465
13678
  function injectProp(node, prop, context) {
13679
+ if (node.type !== 13 && injectSlotKey(node, prop)) return;
13466
13680
  let propsWithInjection;
13467
13681
  /**
13468
13682
  * 1. mergeProps(...)
@@ -13501,6 +13715,20 @@ function injectProp(node, prop, context) {
13501
13715
  else if (parentCall) parentCall.arguments[0] = propsWithInjection;
13502
13716
  else node.arguments[2] = propsWithInjection;
13503
13717
  }
13718
+ function injectSlotKey(node, prop) {
13719
+ var _node$arguments, _node$arguments2, _node$arguments3;
13720
+ if (prop.key.type !== 4 || prop.key.content !== "key") return false;
13721
+ const props = node.arguments[2];
13722
+ if (props && !isString(props)) {
13723
+ const [unnormalizedProps] = getUnnormalizedProps(props);
13724
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) return true;
13725
+ }
13726
+ (_node$arguments = node.arguments)[2] || (_node$arguments[2] = "{}");
13727
+ (_node$arguments2 = node.arguments)[3] || (_node$arguments2[3] = "undefined");
13728
+ (_node$arguments3 = node.arguments)[4] || (_node$arguments3[4] = "undefined");
13729
+ node.arguments[5] = prop.value;
13730
+ return true;
13731
+ }
13504
13732
  function hasProp(prop, props) {
13505
13733
  let result = false;
13506
13734
  if (prop.key.type === 4) {
@@ -13797,7 +14025,7 @@ const tokenizer = new Tokenizer(stack, {
13797
14025
  }
13798
14026
  },
13799
14027
  oncdata(start, end) {
13800
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
14028
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
13801
14029
  else emitError(1, start - 9);
13802
14030
  },
13803
14031
  onprocessinginstruction(start) {
@@ -14335,8 +14563,10 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14335
14563
  imports: [],
14336
14564
  cached: [],
14337
14565
  constantCache: /* @__PURE__ */ new WeakMap(),
14566
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
14338
14567
  temps: 0,
14339
14568
  identifiers: Object.create(null),
14569
+ identifierScopes: Object.create(null),
14340
14570
  scopes: {
14341
14571
  vFor: 0,
14342
14572
  vSlot: 0,
@@ -14387,16 +14617,20 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14387
14617
  context.parent.children.splice(removalIndex, 1);
14388
14618
  },
14389
14619
  onNodeRemoved: NOOP,
14390
- addIdentifiers(exp) {
14391
- if (isString(exp)) addId(exp);
14392
- else if (exp.identifiers) exp.identifiers.forEach(addId);
14393
- else if (exp.type === 4) addId(exp.content);
14620
+ addIdentifiers(exp, type = "local") {
14621
+ if (isString(exp)) addId(exp, type);
14622
+ else if (exp.identifiers) exp.identifiers.forEach((id) => addId(id, type));
14623
+ else if (exp.type === 4) addId(exp.content, type);
14394
14624
  },
14395
14625
  removeIdentifiers(exp) {
14396
14626
  if (isString(exp)) removeId(exp);
14397
14627
  else if (exp.identifiers) exp.identifiers.forEach(removeId);
14398
14628
  else if (exp.type === 4) removeId(exp.content);
14399
14629
  },
14630
+ isSlotScopeIdentifier(name) {
14631
+ const scopes = context.identifierScopes[name];
14632
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
14633
+ },
14400
14634
  hoist(exp) {
14401
14635
  if (isString(exp)) exp = createSimpleExpression(exp);
14402
14636
  context.hoists.push(exp);
@@ -14411,13 +14645,16 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
14411
14645
  }
14412
14646
  };
14413
14647
  context.filters = /* @__PURE__ */ new Set();
14414
- function addId(id) {
14415
- const { identifiers } = context;
14648
+ function addId(id, type) {
14649
+ const { identifiers, identifierScopes } = context;
14416
14650
  if (identifiers[id] === void 0) identifiers[id] = 0;
14417
14651
  identifiers[id]++;
14652
+ (identifierScopes[id] || (identifierScopes[id] = [])).push(type);
14418
14653
  }
14419
14654
  function removeId(id) {
14420
14655
  context.identifiers[id]--;
14656
+ const scopes = context.identifierScopes[id];
14657
+ if (scopes) scopes.pop();
14421
14658
  }
14422
14659
  return context;
14423
14660
  }
@@ -14844,6 +15081,7 @@ function genNode(node, context) {
14844
15081
  case 26:
14845
15082
  genReturnStatement(node, context);
14846
15083
  break;
15084
+ /* v8 ignore start */
14847
15085
  case 10: break;
14848
15086
  default:
14849
15087
  assert(false, `unhandled codegen node type: ${node.type}`);
@@ -15096,7 +15334,7 @@ const transformExpression = (node, context) => {
15096
15334
  if (dir.type === 7 && dir.name !== "for") {
15097
15335
  const exp = dir.exp;
15098
15336
  const arg = dir.arg;
15099
- if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
15337
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
15100
15338
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
15101
15339
  }
15102
15340
  }
@@ -15354,11 +15592,11 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
15354
15592
  const keyProp = findProp(node, `key`, false, true);
15355
15593
  const isDirKey = keyProp && keyProp.type === 7;
15356
15594
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
15357
- if (memo && keyExp && isDirKey) keyProp.exp = keyExp = processExpression(keyExp, context);
15358
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
15359
- if (isTemplate) {
15360
- if (memo) memo.exp = processExpression(memo.exp, context);
15361
- if (keyProperty && keyProp.type !== 6) keyProperty.value = processExpression(keyProperty.value, context);
15595
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
15596
+ if (isTemplate && memo) memo.exp = processExpression(memo.exp, context);
15597
+ if ((isTemplate || memo) && keyProperty && isDirKey) {
15598
+ keyExp = keyProp.exp = keyProperty.value = processExpression(keyProperty.value, context);
15599
+ if (memo) context.vForMemoKeyedNodes.add(node);
15362
15600
  }
15363
15601
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
15364
15602
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -15489,7 +15727,7 @@ const trackSlotScopes = (node, context) => {
15489
15727
  const vSlot = findDir(node, "slot");
15490
15728
  if (vSlot) {
15491
15729
  const slotProps = vSlot.exp;
15492
- if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps);
15730
+ if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps, "slot");
15493
15731
  context.scopes.vSlot++;
15494
15732
  return () => {
15495
15733
  if (context.prefixIdentifiers) slotProps && context.removeIdentifiers(slotProps);
@@ -15710,6 +15948,15 @@ function resolveComponentType(node, context, ssr = false) {
15710
15948
  if (!ssr) context.helper(builtIn);
15711
15949
  return builtIn;
15712
15950
  }
15951
+ {
15952
+ const fromScope = resolveSlotScopeReference(tag, context);
15953
+ if (fromScope) return fromScope;
15954
+ const dotIndex = tag.indexOf(".");
15955
+ if (dotIndex > 0) {
15956
+ const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
15957
+ if (ns) return ns + tag.slice(dotIndex);
15958
+ }
15959
+ }
15713
15960
  {
15714
15961
  const fromSetup = resolveSetupReference(tag, context);
15715
15962
  if (fromSetup) return fromSetup;
@@ -15728,6 +15975,14 @@ function resolveComponentType(node, context, ssr = false) {
15728
15975
  context.components.add(tag);
15729
15976
  return toValidAssetId(tag, `component`);
15730
15977
  }
15978
+ function resolveSlotScopeReference(name, context) {
15979
+ const camelName = camelize(name);
15980
+ const PascalName = capitalize(camelName);
15981
+ const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
15982
+ if (isInSlotScope(name)) return name;
15983
+ if (isInSlotScope(camelName)) return camelName;
15984
+ if (isInSlotScope(PascalName)) return PascalName;
15985
+ }
15731
15986
  function resolveSetupReference(name, context) {
15732
15987
  const bindings = context.bindingMetadata;
15733
15988
  if (!bindings || bindings.__isScriptSetup === false) return;
@@ -16253,7 +16508,7 @@ function rewriteFilter(node, context) {
16253
16508
  const child = node.children[i];
16254
16509
  if (typeof child !== "object") continue;
16255
16510
  if (child.type === 4) parseFilter(child, context);
16256
- else if (child.type === 8) rewriteFilter(node, context);
16511
+ else if (child.type === 8) rewriteFilter(child, context);
16257
16512
  else if (child.type === 5) rewriteFilter(child.content, context);
16258
16513
  }
16259
16514
  }
@@ -16601,6 +16856,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
16601
16856
  const eventOptionModifiers = [];
16602
16857
  for (let i = 0; i < modifiers.length; i++) {
16603
16858
  const modifier = modifiers[i].content;
16859
+ if (modifier === "delegate") {
16860
+ if (context) {
16861
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
16862
+ error.loc = modifiers[i].loc;
16863
+ context.onWarn(error);
16864
+ }
16865
+ continue;
16866
+ }
16604
16867
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
16605
16868
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
16606
16869
  else {
@@ -16677,7 +16940,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
16677
16940
  source: ""
16678
16941
  }));
16679
16942
  const child = node.children[0];
16680
- if (child.type === 1) {
16943
+ if (child.type === 1 && !findDir(child, "if")) {
16681
16944
  for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
16682
16945
  type: 6,
16683
16946
  name: "persisted",