@vue/compat 3.6.0-beta.8 → 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/compat v3.6.0-beta.8
2
+ * @vue/compat v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -432,6 +432,13 @@ function getSequence(arr) {
432
432
  const notifyBuffer = [];
433
433
  let batchDepth = 0;
434
434
  let activeSub = void 0;
435
+ let runDepth = 0;
436
+ function incRunDepth() {
437
+ ++runDepth;
438
+ }
439
+ function decRunDepth() {
440
+ --runDepth;
441
+ }
435
442
  let globalVersion = 0;
436
443
  let notifyIndex = 0;
437
444
  let notifyBufferLength = 0;
@@ -505,8 +512,10 @@ function propagate(link) {
505
512
  const sub = link.sub;
506
513
  let flags = sub.flags;
507
514
  if (flags & 3) {
508
- if (!(flags & 60)) sub.flags = flags | 32;
509
- else if (!(flags & 12)) flags = 0;
515
+ if (!(flags & 60)) {
516
+ sub.flags = flags | 32;
517
+ if (runDepth) sub.flags |= 8;
518
+ } else if (!(flags & 12)) flags = 0;
510
519
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
511
520
  else if (!(flags & 48) && isValidLink(link, sub)) {
512
521
  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) {
@@ -982,7 +988,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
982
988
  }
983
989
  const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
984
990
  const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
985
- if (target === /* @__PURE__ */ toRaw(receiver)) {
991
+ if (target === /* @__PURE__ */ toRaw(receiver) && result) {
986
992
  if (!hadKey) trigger(target, "add", key, value);
987
993
  else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
988
994
  }
@@ -1187,9 +1193,6 @@ function targetTypeMap(rawType) {
1187
1193
  default: return 0;
1188
1194
  }
1189
1195
  }
1190
- function getTargetType(value) {
1191
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1192
- }
1193
1196
  /* @__NO_SIDE_EFFECTS__ */
1194
1197
  function reactive(target) {
1195
1198
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1299,10 +1302,11 @@ function shallowReadonly(target) {
1299
1302
  function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
1300
1303
  if (!isObject(target)) return target;
1301
1304
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1302
- const targetType = getTargetType(target);
1303
- if (targetType === 0) return target;
1305
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1304
1306
  const existingProxy = proxyMap.get(target);
1305
1307
  if (existingProxy) return existingProxy;
1308
+ const targetType = targetTypeMap(toRawType(target));
1309
+ if (targetType === 0) return target;
1306
1310
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1307
1311
  proxyMap.set(target, proxy);
1308
1312
  return proxy;
@@ -1635,16 +1639,16 @@ function toRefs(object) {
1635
1639
  return ret;
1636
1640
  }
1637
1641
  var ObjectRefImpl = class {
1638
- constructor(_object, _key, _defaultValue) {
1642
+ constructor(_object, key, _defaultValue) {
1639
1643
  this._object = _object;
1640
- this._key = _key;
1641
1644
  this._defaultValue = _defaultValue;
1642
1645
  this["__v_isRef"] = true;
1643
1646
  this._value = void 0;
1647
+ this._key = isSymbol(key) ? key : String(key);
1644
1648
  this._raw = /* @__PURE__ */ toRaw(_object);
1645
1649
  let shallow = true;
1646
1650
  let obj = _object;
1647
- if (!isArray(_object) || !isIntegerKey(String(_key))) do
1651
+ if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
1648
1652
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1649
1653
  while (shallow && (obj = obj["__v_raw"]));
1650
1654
  this._shallow = shallow;
@@ -1720,9 +1724,11 @@ var ReactiveEffect = class {
1720
1724
  if (!this.active) return this.fn();
1721
1725
  cleanup(this);
1722
1726
  const prevSub = startTracking(this);
1727
+ incRunDepth();
1723
1728
  try {
1724
1729
  return this.fn();
1725
1730
  } finally {
1731
+ decRunDepth();
1726
1732
  endTracking(this, prevSub);
1727
1733
  const flags = this.flags;
1728
1734
  if ((flags & 136) === 136) {
@@ -2084,8 +2090,9 @@ var WatcherEffect = class extends ReactiveEffect {
2084
2090
  if (once && cb) {
2085
2091
  const _cb = cb;
2086
2092
  cb = (...args) => {
2087
- _cb(...args);
2093
+ const res = _cb(...args);
2088
2094
  this.stop();
2095
+ return res;
2089
2096
  };
2090
2097
  }
2091
2098
  this.cb = cb;
@@ -2097,7 +2104,7 @@ var WatcherEffect = class extends ReactiveEffect {
2097
2104
  if (!this.cb) return;
2098
2105
  const { immediate, deep, call } = this.options;
2099
2106
  if (initialRun && !immediate) return;
2100
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2107
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2101
2108
  cleanup(this);
2102
2109
  const currentWatcher = activeWatcher;
2103
2110
  activeWatcher = this;
@@ -2297,8 +2304,8 @@ function findInsertionIndex(order, queue, start, end) {
2297
2304
  /**
2298
2305
  * @internal for runtime-vapor only
2299
2306
  */
2300
- function queueJob(job, id, isPre = false) {
2301
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2307
+ function queueJob(job, id, isPre = false, order = 0) {
2308
+ 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)) {
2302
2309
  jobsLength++;
2303
2310
  queueFlush();
2304
2311
  }
@@ -2401,6 +2408,7 @@ function flushJobs(seen) {
2401
2408
  }
2402
2409
  flushIndex = 0;
2403
2410
  jobsLength = 0;
2411
+ jobs.length = 0;
2404
2412
  flushPostFlushCbs(seen);
2405
2413
  currentFlushPromise = null;
2406
2414
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2598,10 +2606,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2598
2606
  const renderFnWithContext = (...args) => {
2599
2607
  if (renderFnWithContext._d) setBlockTracking(-1);
2600
2608
  const prevInstance = setCurrentRenderingInstance(ctx);
2609
+ const prevStackSize = blockStack.length;
2601
2610
  let res;
2602
2611
  try {
2603
2612
  res = fn(...args);
2604
2613
  } finally {
2614
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2605
2615
  setCurrentRenderingInstance(prevInstance);
2606
2616
  if (renderFnWithContext._d) setBlockTracking(1);
2607
2617
  }
@@ -2818,6 +2828,7 @@ function createPathGetter(ctx, path) {
2818
2828
  }
2819
2829
  //#endregion
2820
2830
  //#region packages/runtime-core/src/components/Teleport.ts
2831
+ const pendingMounts = /* @__PURE__ */ new WeakMap();
2821
2832
  const TeleportEndKey = Symbol("_vte");
2822
2833
  const isTeleport = (type) => type.__isTeleport;
2823
2834
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
@@ -2834,51 +2845,64 @@ const TeleportImpl = {
2834
2845
  name: "Teleport",
2835
2846
  __isTeleport: true,
2836
2847
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
2837
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
2848
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
2838
2849
  const disabled = isTeleportDisabled(n2.props);
2839
- let { shapeFlag, children, dynamicChildren } = n2;
2850
+ let { dynamicChildren } = n2;
2851
+ const mount = (vnode, container, anchor) => {
2852
+ if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
2853
+ };
2854
+ const mountToTarget = (vnode = n2) => {
2855
+ const disabled = isTeleportDisabled(vnode.props);
2856
+ const target = vnode.target = resolveTarget(vnode.props, querySelector);
2857
+ const targetAnchor = prepareAnchor(target, vnode, createText, insert);
2858
+ if (target) {
2859
+ if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
2860
+ else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
2861
+ if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2862
+ if (!disabled) {
2863
+ mount(vnode, target, targetAnchor);
2864
+ updateCssVars(vnode, false);
2865
+ }
2866
+ }
2867
+ };
2868
+ const queuePendingMount = (vnode) => {
2869
+ const mountJob = () => {
2870
+ if (pendingMounts.get(vnode) !== mountJob) return;
2871
+ pendingMounts.delete(vnode);
2872
+ if (isTeleportDisabled(vnode.props)) {
2873
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
2874
+ updateCssVars(vnode, true);
2875
+ }
2876
+ mountToTarget(vnode);
2877
+ };
2878
+ pendingMounts.set(vnode, mountJob);
2879
+ queuePostRenderEffect(mountJob, void 0, parentSuspense);
2880
+ };
2840
2881
  if (n1 == null) {
2841
2882
  const placeholder = n2.el = createText("");
2842
2883
  const mainAnchor = n2.anchor = createText("");
2843
2884
  insert(placeholder, container, anchor);
2844
2885
  insert(mainAnchor, container, anchor);
2845
- const mount = (container, anchor) => {
2846
- if (shapeFlag & 16) mountChildren(children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
2847
- };
2848
- const mountToTarget = () => {
2849
- const target = n2.target = resolveTarget(n2.props, querySelector);
2850
- const targetAnchor = prepareAnchor(target, n2, createText, insert);
2851
- if (target) {
2852
- if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
2853
- else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
2854
- if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2855
- if (!disabled) {
2856
- mount(target, targetAnchor);
2857
- updateCssVars(n2, false);
2858
- }
2859
- }
2860
- };
2886
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
2887
+ queuePendingMount(n2);
2888
+ return;
2889
+ }
2861
2890
  if (disabled) {
2862
- mount(container, mainAnchor);
2891
+ mount(n2, container, mainAnchor);
2863
2892
  updateCssVars(n2, true);
2864
2893
  }
2865
- if (isTeleportDeferred(n2.props)) {
2866
- n2.el.__isMounted = false;
2867
- queuePostRenderEffect(() => {
2868
- mountToTarget();
2869
- delete n2.el.__isMounted;
2870
- }, void 0, parentSuspense);
2871
- } else mountToTarget();
2894
+ mountToTarget();
2872
2895
  } else {
2873
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
2874
- queuePostRenderEffect(() => {
2875
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
2876
- }, void 0, parentSuspense);
2896
+ n2.el = n1.el;
2897
+ const mainAnchor = n2.anchor = n1.anchor;
2898
+ const pendingMount = pendingMounts.get(n1);
2899
+ if (pendingMount) {
2900
+ pendingMount.flags |= 4;
2901
+ pendingMounts.delete(n1);
2902
+ queuePendingMount(n2);
2877
2903
  return;
2878
2904
  }
2879
- n2.el = n1.el;
2880
2905
  n2.targetStart = n1.targetStart;
2881
- const mainAnchor = n2.anchor = n1.anchor;
2882
2906
  const target = n2.target = n1.target;
2883
2907
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
2884
2908
  const wasDisabled = isTeleportDisabled(n1.props);
@@ -2894,25 +2918,30 @@ const TeleportImpl = {
2894
2918
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
2895
2919
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
2896
2920
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
2897
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
2898
- if (nextTarget) moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
2921
+ const nextTarget = resolveTarget(n2.props, querySelector);
2922
+ if (nextTarget) {
2923
+ n2.target = nextTarget;
2924
+ moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
2925
+ }
2899
2926
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
2900
2927
  updateCssVars(n2, disabled);
2901
2928
  }
2902
2929
  },
2903
2930
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
2904
2931
  const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
2905
- if (target) {
2906
- hostRemove(targetStart);
2907
- hostRemove(targetAnchor);
2908
- }
2932
+ const disabled = isTeleportDisabled(props);
2933
+ const shouldRemove = doRemove || !disabled;
2934
+ const pendingMount = pendingMounts.get(vnode);
2935
+ if (pendingMount) {
2936
+ pendingMount.flags |= 4;
2937
+ pendingMounts.delete(vnode);
2938
+ }
2939
+ if (targetStart) hostRemove(targetStart);
2940
+ if (targetAnchor) hostRemove(targetAnchor);
2909
2941
  doRemove && hostRemove(anchor);
2910
- if (shapeFlag & 16) {
2911
- const shouldRemove = doRemove || !isTeleportDisabled(props);
2912
- for (let i = 0; i < children.length; i++) {
2913
- const child = children[i];
2914
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
2915
- }
2942
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
2943
+ const child = children[i];
2944
+ unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
2916
2945
  }
2917
2946
  },
2918
2947
  move: moveTeleport,
@@ -2923,7 +2952,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
2923
2952
  const { el, anchor, shapeFlag, children, props } = vnode;
2924
2953
  const isReorder = moveType === 2;
2925
2954
  if (isReorder) insert(el, container, parentAnchor);
2926
- if (!isReorder || isTeleportDisabled(props)) {
2955
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
2927
2956
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
2928
2957
  }
2929
2958
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3048,8 +3077,8 @@ const BaseTransitionImpl = {
3048
3077
  const state = useTransitionState();
3049
3078
  return () => {
3050
3079
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3051
- if (!children || !children.length) return;
3052
- const child = findNonCommentChild(children);
3080
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3081
+ if (!child) return;
3053
3082
  const rawProps = /* @__PURE__ */ toRaw(props);
3054
3083
  const { mode } = rawProps;
3055
3084
  if (state.isLeaving) return emptyPlaceholder(child);
@@ -3474,7 +3503,7 @@ function createHydrationFunctions(rendererInternals) {
3474
3503
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3475
3504
  break;
3476
3505
  case VaporSlot:
3477
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
3506
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
3478
3507
  break;
3479
3508
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) nextNode = onMismatch();
3480
3509
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -3484,16 +3513,31 @@ function createHydrationFunctions(rendererInternals) {
3484
3513
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
3485
3514
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
3486
3515
  else nextNode = nextSibling(node);
3487
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
3488
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3489
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3490
- let subTree;
3491
- if (isFragmentStart) {
3492
- subTree = createVNode(Fragment);
3493
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3494
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3495
- subTree.el = node;
3496
- vnode.component.subTree = subTree;
3516
+ if (vnode.type.__vapor) {
3517
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
3518
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
3519
+ if (vnode.dirs) {
3520
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
3521
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3522
+ }
3523
+ }, () => {
3524
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
3525
+ });
3526
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
3527
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
3528
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
3529
+ } else {
3530
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3531
+ const component = vnode.component;
3532
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
3533
+ let subTree;
3534
+ if (isFragmentStart) {
3535
+ subTree = createVNode(Fragment);
3536
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3537
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3538
+ subTree.el = node;
3539
+ component.subTree = subTree;
3540
+ }
3497
3541
  }
3498
3542
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
3499
3543
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -3504,9 +3548,10 @@ function createHydrationFunctions(rendererInternals) {
3504
3548
  };
3505
3549
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3506
3550
  optimized = optimized || !!vnode.dynamicChildren;
3507
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3551
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3508
3552
  const forcePatch = type === "input" || type === "option";
3509
- if (forcePatch || patchFlag !== -1) {
3553
+ const hasDynamicProps = !!dynamicProps;
3554
+ if (forcePatch || hasDynamicProps || patchFlag !== -1) {
3510
3555
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
3511
3556
  let needCallTransitionHooks = false;
3512
3557
  if (isTemplateNode$1(el)) {
@@ -3522,8 +3567,8 @@ function createHydrationFunctions(rendererInternals) {
3522
3567
  }
3523
3568
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
3524
3569
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
3570
+ if (next && !isMismatchAllowed(el, 1)) logMismatchError();
3525
3571
  while (next) {
3526
- if (!isMismatchAllowed(el, 1)) logMismatchError();
3527
3572
  const cur = next;
3528
3573
  next = next.nextSibling;
3529
3574
  remove(cur);
@@ -3538,9 +3583,10 @@ function createHydrationFunctions(rendererInternals) {
3538
3583
  }
3539
3584
  }
3540
3585
  if (props) {
3541
- if (forcePatch || !optimized || patchFlag & 48) {
3586
+ if (forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
3542
3587
  const isCustomElement = el.tagName.includes("-");
3543
- for (const key in props) 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);
3588
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
3589
+ for (const key in props) 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);
3544
3590
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
3545
3591
  else if (patchFlag & 4 && /* @__PURE__ */ isReactive(props.style)) for (const key in props.style) props.style[key];
3546
3592
  }
@@ -3559,6 +3605,7 @@ function createHydrationFunctions(rendererInternals) {
3559
3605
  optimized = optimized || !!parentVNode.dynamicChildren;
3560
3606
  const children = parentVNode.children;
3561
3607
  const l = children.length;
3608
+ let hasCheckedMismatch = false;
3562
3609
  for (let i = 0; i < l; i++) {
3563
3610
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3564
3611
  const isText = vnode.type === Text;
@@ -3572,7 +3619,10 @@ function createHydrationFunctions(rendererInternals) {
3572
3619
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3573
3620
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
3574
3621
  else {
3575
- if (!isMismatchAllowed(container, 1)) logMismatchError();
3622
+ if (!hasCheckedMismatch) {
3623
+ hasCheckedMismatch = true;
3624
+ if (!isMismatchAllowed(container, 1)) logMismatchError();
3625
+ }
3576
3626
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
3577
3627
  }
3578
3628
  }
@@ -3591,7 +3641,7 @@ function createHydrationFunctions(rendererInternals) {
3591
3641
  }
3592
3642
  };
3593
3643
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3594
- if (!isMismatchAllowed(node.parentElement, 1)) logMismatchError();
3644
+ if (!isNodeMismatchAllowed(node, vnode)) logMismatchError();
3595
3645
  vnode.el = null;
3596
3646
  if (isFragment) {
3597
3647
  const end = locateClosingAnchor(node);
@@ -3647,7 +3697,9 @@ const MismatchTypeString = {
3647
3697
  };
3648
3698
  function isMismatchAllowed(el, allowedType) {
3649
3699
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
3650
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
3700
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
3701
+ }
3702
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
3651
3703
  if (allowedAttr == null) return false;
3652
3704
  else if (allowedAttr === "") return true;
3653
3705
  else {
@@ -3656,6 +3708,16 @@ function isMismatchAllowed(el, allowedType) {
3656
3708
  return list.includes(MismatchTypeString[allowedType]);
3657
3709
  }
3658
3710
  }
3711
+ function isNodeMismatchAllowed(node, vnode) {
3712
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
3713
+ }
3714
+ function isMismatchAllowedByNode(node) {
3715
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
3716
+ }
3717
+ function isMismatchAllowedByVNode({ props }) {
3718
+ const allowedAttr = props && props[allowMismatchAttr];
3719
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
3720
+ }
3659
3721
  //#endregion
3660
3722
  //#region packages/runtime-core/src/hydrationStrategies.ts
3661
3723
  let requestIdleCallback;
@@ -3774,11 +3836,16 @@ function defineAsyncComponent(source) {
3774
3836
  onError(err);
3775
3837
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
3776
3838
  });
3777
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
3839
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
3778
3840
  load().then(() => {
3841
+ if (instance.isUnmounted) return;
3779
3842
  loaded.value = true;
3780
3843
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
3781
3844
  }).catch((err) => {
3845
+ if (instance.isUnmounted) {
3846
+ setPendingRequest(null);
3847
+ return;
3848
+ }
3782
3849
  onError(err);
3783
3850
  error.value = err;
3784
3851
  });
@@ -3834,14 +3901,22 @@ function createAsyncComponentContext(source) {
3834
3901
  setPendingRequest: (request) => pendingRequest = request
3835
3902
  };
3836
3903
  }
3837
- const useAsyncComponentState = (delay, timeout, onError) => {
3904
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
3838
3905
  const loaded = /* @__PURE__ */ ref(false);
3839
3906
  const error = /* @__PURE__ */ ref();
3840
3907
  const delayed = /* @__PURE__ */ ref(!!delay);
3841
- if (delay) setTimeout(() => {
3908
+ let timeoutTimer;
3909
+ let delayTimer;
3910
+ if (instance) onUnmounted(() => {
3911
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
3912
+ if (delayTimer != null) clearTimeout(delayTimer);
3913
+ }, instance);
3914
+ if (delay) delayTimer = setTimeout(() => {
3915
+ if (instance && instance.isUnmounted) return;
3842
3916
  delayed.value = false;
3843
3917
  }, delay);
3844
- if (timeout != null) setTimeout(() => {
3918
+ if (timeout != null) timeoutTimer = setTimeout(() => {
3919
+ if (instance && instance.isUnmounted) return;
3845
3920
  if (!loaded.value && !error.value) {
3846
3921
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
3847
3922
  onError(err);
@@ -3859,10 +3934,12 @@ const useAsyncComponentState = (delay, timeout, onError) => {
3859
3934
  * @internal
3860
3935
  */
3861
3936
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
3937
+ const wasConnected = el.isConnected;
3862
3938
  let patched = false;
3863
3939
  (instance.bu || (instance.bu = [])).push(() => patched = true);
3864
3940
  const performHydrate = () => {
3865
3941
  if (patched) return;
3942
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
3866
3943
  hydrate();
3867
3944
  };
3868
3945
  const doHydrate = hydrateStrategy ? () => {
@@ -4435,8 +4512,9 @@ function createSlots(slots, dynamicSlots) {
4435
4512
  * Compiler runtime helper for rendering `<slot/>`
4436
4513
  * @private
4437
4514
  */
4438
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4515
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
4439
4516
  let slot = slots[name];
4517
+ if (fallback) fallback.__vdom = true;
4440
4518
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
4441
4519
  if (vaporSlot) {
4442
4520
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -4444,21 +4522,31 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4444
4522
  slot: vaporSlot,
4445
4523
  fallback
4446
4524
  };
4525
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4447
4526
  return ret;
4448
4527
  }
4449
4528
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
4450
- const hasProps = Object.keys(props).length > 0;
4451
- if (name !== "default") props.name = name;
4452
- return openBlock(), createBlock(Fragment, null, [createVNode("slot", props, fallback && fallback())], hasProps ? -2 : 64);
4529
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
4530
+ const hasProps = Object.keys(slotProps).length > 0;
4531
+ if (name !== "default") slotProps.name = name;
4532
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
4453
4533
  }
4454
4534
  if (slot && slot._c) slot._d = false;
4535
+ const prevStackSize = blockStack.length;
4455
4536
  openBlock();
4456
- const validSlotContent = slot && ensureValidVNode(slot(props));
4457
- ensureVaporSlotFallback(validSlotContent, fallback);
4458
- const slotKey = props.key || validSlotContent && validSlotContent.key;
4459
- const rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4537
+ let rendered;
4538
+ try {
4539
+ const validSlotContent = slot && ensureValidVNode(slot(props));
4540
+ ensureVaporSlotFallback(validSlotContent, fallback);
4541
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
4542
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4543
+ } catch (err) {
4544
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
4545
+ throw err;
4546
+ } finally {
4547
+ if (slot && slot._c) slot._d = true;
4548
+ }
4460
4549
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
4461
- if (slot && slot._c) slot._d = true;
4462
4550
  return rendered;
4463
4551
  }
4464
4552
  function ensureValidVNode(vnodes) {
@@ -4471,9 +4559,7 @@ function ensureValidVNode(vnodes) {
4471
4559
  }
4472
4560
  function ensureVaporSlotFallback(vnodes, fallback) {
4473
4561
  let vaporSlot;
4474
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
4475
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
4476
- }
4562
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
4477
4563
  }
4478
4564
  //#endregion
4479
4565
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -4935,25 +5021,38 @@ function createPropsRestProxy(props, excludedKeys) {
4935
5021
  function withAsyncContext(getAwaitable) {
4936
5022
  const ctx = getCurrentGenericInstance();
4937
5023
  const inSSRSetup = isInSSRComponentSetup;
5024
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
4938
5025
  let awaitable = getAwaitable();
4939
5026
  setCurrentInstance(null, void 0);
4940
5027
  if (inSSRSetup) setInSSRSetupState(false);
4941
5028
  const restore = () => {
5029
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
4942
5030
  setCurrentInstance(ctx);
4943
5031
  if (inSSRSetup) setInSSRSetupState(true);
5032
+ const reset = restoreAsyncContext && restoreAsyncContext();
5033
+ return () => {
5034
+ if (reset) reset();
5035
+ if (resetStoppedScope) resetStoppedScope.reset();
5036
+ };
4944
5037
  };
4945
5038
  const cleanup = () => {
4946
5039
  setCurrentInstance(null, void 0);
4947
5040
  if (inSSRSetup) setInSSRSetupState(false);
4948
5041
  };
4949
5042
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
4950
- restore();
4951
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
5043
+ const reset = restore();
5044
+ Promise.resolve().then(() => Promise.resolve().then(() => {
5045
+ if (reset) reset();
5046
+ cleanup();
5047
+ }));
4952
5048
  throw e;
4953
5049
  });
4954
5050
  return [awaitable, () => {
4955
- restore();
4956
- Promise.resolve().then(cleanup);
5051
+ const reset = restore();
5052
+ Promise.resolve().then(() => {
5053
+ if (reset) reset();
5054
+ cleanup();
5055
+ });
4957
5056
  }];
4958
5057
  }
4959
5058
  //#endregion
@@ -5204,7 +5303,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5204
5303
  if (options.el) return vm.$mount(options.el);
5205
5304
  else return vm;
5206
5305
  }
5207
- Vue.version = `2.6.14-compat:3.6.0-beta.8`;
5306
+ Vue.version = `2.6.14-compat:3.6.0-rc.1`;
5208
5307
  Vue.config = singletonApp.config;
5209
5308
  Vue.use = (plugin, ...options) => {
5210
5309
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -5639,12 +5738,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
5639
5738
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5640
5739
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5641
5740
  }
5642
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5741
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5742
+ if (!hasVModel) {
5643
5743
  localValue = value;
5644
5744
  trigger();
5645
5745
  }
5646
5746
  i.emit(`update:${name}`, emittedValue);
5647
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5747
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5648
5748
  prevSetValue = value;
5649
5749
  prevEmittedValue = emittedValue;
5650
5750
  }
@@ -5741,7 +5841,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
5741
5841
  function isEmitListener(options, key) {
5742
5842
  if (!options || !isOn(key)) return false;
5743
5843
  if (key.startsWith(compatModelEventPrefix)) return true;
5744
- key = key.slice(2).replace(/Once$/, "");
5844
+ key = key.slice(2);
5845
+ key = key === "Once" ? key : key.replace(/Once$/, "");
5745
5846
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
5746
5847
  }
5747
5848
  //#endregion
@@ -5862,15 +5963,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
5862
5963
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
5863
5964
  return nextProp !== prevProp;
5864
5965
  }
5865
- function updateHOCHostEl({ vnode, parent }, el) {
5966
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
5866
5967
  while (parent && !parent.vapor) {
5867
5968
  const root = parent.subTree;
5868
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
5969
+ if (root.suspense && root.suspense.activeBranch === vnode) {
5970
+ root.suspense.vnode.el = root.el = el;
5971
+ vnode = root;
5972
+ }
5869
5973
  if (root === vnode) {
5870
5974
  (vnode = parent.vnode).el = el;
5871
5975
  parent = parent.parent;
5872
5976
  } else break;
5873
5977
  }
5978
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
5874
5979
  }
5875
5980
  //#endregion
5876
5981
  //#region packages/runtime-core/src/compat/props.ts
@@ -6301,8 +6406,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6301
6406
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
6302
6407
  else hostInsert(el, container, anchor);
6303
6408
  if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
6304
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6305
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6409
+ try {
6410
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6411
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6412
+ } finally {}
6306
6413
  }, void 0, parentSuspense);
6307
6414
  };
6308
6415
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
@@ -6325,6 +6432,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6325
6432
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6326
6433
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6327
6434
  parentComponent && toggleRecurse(parentComponent, true);
6435
+ if (dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
6436
+ patchFlag = 0;
6437
+ optimized = false;
6438
+ dynamicChildren = null;
6439
+ }
6328
6440
  if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) hostSetElementText(el, "");
6329
6441
  if (dynamicChildren) patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds);
6330
6442
  else if (!optimized) patchChildren(n1, n2, el, null, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds, false);
@@ -6393,19 +6505,35 @@ function baseCreateRenderer(options, createHydrationFns) {
6393
6505
  n2.slotScopeIds = slotScopeIds;
6394
6506
  if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
6395
6507
  else {
6508
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
6396
6509
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
6397
6510
  if (n2.dirs) {
6398
6511
  invokeDirectiveHook(n2, null, parentComponent, "created");
6399
6512
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
6400
6513
  }
6514
+ }, () => {
6515
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
6401
6516
  });
6402
6517
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
6518
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
6519
+ if (vnodeMountedHook) {
6520
+ const scopedVNode = n2;
6521
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
6522
+ }
6403
6523
  }
6404
6524
  else {
6405
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
6525
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
6526
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
6406
6527
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6528
+ }, () => {
6529
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
6530
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
6407
6531
  });
6408
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
6532
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
6533
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
6534
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
6535
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
6536
+ }, void 0, parentSuspense);
6409
6537
  }
6410
6538
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
6411
6539
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -6726,8 +6854,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6726
6854
  else hostInsert(el, container, anchor);
6727
6855
  };
6728
6856
  const performLeave = () => {
6857
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
6729
6858
  if (el._isLeaving) el[leaveCbKey](true);
6730
- leave(el, () => {
6859
+ if (transition.persisted && !wasLeaving) remove();
6860
+ else leave(el, () => {
6731
6861
  remove();
6732
6862
  afterLeave && afterLeave();
6733
6863
  });
@@ -6738,7 +6868,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6738
6868
  else hostInsert(el, container, anchor);
6739
6869
  };
6740
6870
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6741
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
6871
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
6742
6872
  if (patchFlag === -2) optimized = false;
6743
6873
  if (ref != null) {
6744
6874
  const prevSub = setActiveSub();
@@ -6758,7 +6888,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6758
6888
  if (shapeFlag & 6) if (isVaporComponent(type)) {
6759
6889
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6760
6890
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6761
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
6891
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
6892
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6893
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6894
+ }, void 0, parentSuspense);
6762
6895
  return;
6763
6896
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
6764
6897
  else {
@@ -6776,9 +6909,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6776
6909
  }
6777
6910
  if (doRemove) remove(vnode);
6778
6911
  }
6779
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
6912
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
6913
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
6780
6914
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6781
6915
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6916
+ if (shouldInvalidateMemo) vnode.el = null;
6782
6917
  }, void 0, parentSuspense);
6783
6918
  };
6784
6919
  const remove = (vnode) => {
@@ -6813,7 +6948,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6813
6948
  if (effect) {
6814
6949
  effect.stop();
6815
6950
  unmount(subTree, instance, parentSuspense, doRemove);
6816
- }
6951
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
6817
6952
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
6818
6953
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) queuePostRenderEffect(() => instance.emit("hook:destroyed"), void 0, parentSuspense);
6819
6954
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
@@ -6933,6 +7068,10 @@ function invalidateMount(hooks) {
6933
7068
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
6934
7069
  }
6935
7070
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
7071
+ if (force && transition.persisted && !el[leaveCbKey]) {
7072
+ insert();
7073
+ return;
7074
+ }
6936
7075
  if (force || needTransition(parentSuspense, transition)) {
6937
7076
  transition.beforeEnter(el);
6938
7077
  insert();
@@ -7110,6 +7249,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7110
7249
  pendingId: suspenseId++,
7111
7250
  timeout: typeof timeout === "number" ? timeout : -1,
7112
7251
  activeBranch: null,
7252
+ isFallbackMountPending: false,
7113
7253
  pendingBranch: null,
7114
7254
  isInFallback: !isHydrating,
7115
7255
  isHydrating,
@@ -7121,20 +7261,25 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7121
7261
  if (suspense.isHydrating) suspense.isHydrating = false;
7122
7262
  else if (!resume) {
7123
7263
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
7264
+ let hasUpdatedAnchor = false;
7124
7265
  if (delayEnter) activeBranch.transition.afterLeave = () => {
7125
7266
  if (pendingId === suspense.pendingId) {
7126
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7267
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7127
7268
  queuePostFlushCb(effects);
7128
7269
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7129
7270
  }
7130
7271
  };
7131
- if (activeBranch) {
7132
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7272
+ if (activeBranch && !suspense.isFallbackMountPending) {
7273
+ if (parentNode(activeBranch.el) === container) {
7274
+ anchor = next(activeBranch);
7275
+ hasUpdatedAnchor = true;
7276
+ }
7133
7277
  unmount(activeBranch, parentComponent, suspense, true);
7134
7278
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7135
7279
  }
7136
7280
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
7137
7281
  }
7282
+ suspense.isFallbackMountPending = false;
7138
7283
  setActiveBranch(suspense, pendingBranch);
7139
7284
  suspense.pendingBranch = null;
7140
7285
  suspense.isInFallback = false;
@@ -7164,12 +7309,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7164
7309
  triggerEvent(vnode, "onFallback");
7165
7310
  const anchor = next(activeBranch);
7166
7311
  const mountFallback = () => {
7312
+ suspense.isFallbackMountPending = false;
7167
7313
  if (!suspense.isInFallback) return;
7168
7314
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
7169
7315
  setActiveBranch(suspense, fallbackVNode);
7170
7316
  };
7171
7317
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
7172
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
7318
+ if (delayEnter) {
7319
+ suspense.isFallbackMountPending = true;
7320
+ activeBranch.transition.afterLeave = mountFallback;
7321
+ }
7173
7322
  suspense.isInFallback = true;
7174
7323
  unmount(activeBranch, parentComponent, null, true);
7175
7324
  if (!delayEnter) mountFallback();
@@ -7188,6 +7337,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7188
7337
  handleError(err, instance, 0);
7189
7338
  }).then((asyncSetupResult) => {
7190
7339
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
7340
+ setCurrentInstance(null, void 0);
7191
7341
  instance.asyncResolved = true;
7192
7342
  onResolve(asyncSetupResult);
7193
7343
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -7494,12 +7644,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7494
7644
  el: vnode.el,
7495
7645
  anchor: vnode.anchor,
7496
7646
  ctx: vnode.ctx,
7497
- ce: vnode.ce
7647
+ ce: vnode.ce,
7648
+ vi: vnode.vi,
7649
+ vs: cloneVaporSlotMeta(vnode),
7650
+ vb: vnode.vb
7498
7651
  };
7499
7652
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
7500
7653
  defineLegacyVNodeProperties(cloned);
7501
7654
  return cloned;
7502
7655
  }
7656
+ function cloneVaporSlotMeta(vnode) {
7657
+ const vaporSlot = vnode.vs;
7658
+ if (!vaporSlot) return vaporSlot;
7659
+ const cloned = {
7660
+ slot: vaporSlot.slot,
7661
+ fallback: vaporSlot.fallback,
7662
+ outletFallback: vaporSlot.outletFallback
7663
+ };
7664
+ if (vnode.el) {
7665
+ cloned.state = vaporSlot.state;
7666
+ cloned.ref = vaporSlot.ref;
7667
+ cloned.scope = vaporSlot.scope;
7668
+ }
7669
+ return cloned;
7670
+ }
7503
7671
  /**
7504
7672
  * @private
7505
7673
  */
@@ -7553,6 +7721,10 @@ function normalizeChildren(vnode, children) {
7553
7721
  }
7554
7722
  }
7555
7723
  else if (isFunction(children)) {
7724
+ if (shapeFlag & 65) {
7725
+ normalizeChildren(vnode, { default: children });
7726
+ return;
7727
+ }
7556
7728
  children = {
7557
7729
  default: children,
7558
7730
  _ctx: currentRenderingInstance
@@ -7579,6 +7751,7 @@ function mergeProps(...args) {
7579
7751
  const existing = ret[key];
7580
7752
  const incoming = toMerge[key];
7581
7753
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
7754
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
7582
7755
  } else if (key !== "") ret[key] = toMerge[key];
7583
7756
  }
7584
7757
  return ret;
@@ -7913,7 +8086,7 @@ function isMemoSame(cached, memo) {
7913
8086
  }
7914
8087
  //#endregion
7915
8088
  //#region packages/runtime-core/src/index.ts
7916
- const version = "3.6.0-beta.8";
8089
+ const version = "3.6.0-rc.1";
7917
8090
  const warn = NOOP;
7918
8091
  /**
7919
8092
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8336,7 +8509,10 @@ function patchStyle(el, prev, next) {
8336
8509
  }
8337
8510
  for (const key in next) {
8338
8511
  if (key === "display") hasControlledDisplay = true;
8339
- setStyle(style, key, next[key]);
8512
+ const value = next[key];
8513
+ if (value != null) {
8514
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
8515
+ } else setStyle(style, key, "");
8340
8516
  }
8341
8517
  } else if (isCssString) {
8342
8518
  if (prev !== next) {
@@ -8382,6 +8558,14 @@ function autoPrefix(style, rawName) {
8382
8558
  }
8383
8559
  return rawName;
8384
8560
  }
8561
+ /**
8562
+ * Browsers update textarea width/height directly during native resize.
8563
+ * Only special-case this common textarea path for now; other resize scenarios
8564
+ * still follow normal vnode style patching.
8565
+ */
8566
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
8567
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
8568
+ }
8385
8569
  //#endregion
8386
8570
  //#region packages/runtime-dom/src/modules/attrs.ts
8387
8571
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -8462,7 +8646,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8462
8646
  const existingInvoker = invokers[rawName];
8463
8647
  if (nextValue && existingInvoker) existingInvoker.value = nextValue;
8464
8648
  else {
8465
- const [name, options] = parseName(rawName);
8649
+ const [name, options] = parseEventName(rawName);
8466
8650
  if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(nextValue, instance), options);
8467
8651
  else if (existingInvoker) {
8468
8652
  removeEventListener(el, name, existingInvoker, options);
@@ -8470,16 +8654,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8470
8654
  }
8471
8655
  }
8472
8656
  }
8473
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
8474
- function parseName(name) {
8657
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
8658
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
8659
+ function parseEventName(name) {
8475
8660
  let options;
8476
- if (optionsModifierRE.test(name)) {
8477
- options = {};
8478
- let m;
8479
- while (m = name.match(optionsModifierRE)) {
8480
- name = name.slice(0, name.length - m[0].length);
8481
- options[m[0].toLowerCase()] = true;
8482
- }
8661
+ let m;
8662
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
8663
+ if (!options) options = {};
8664
+ name = name.slice(0, name.length - m[1].length);
8665
+ options[m[1].toLowerCase()] = true;
8483
8666
  }
8484
8667
  return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
8485
8668
  }
@@ -8490,22 +8673,26 @@ function createInvoker(initialValue, instance) {
8490
8673
  const invoker = (e) => {
8491
8674
  if (!e._vts) e._vts = Date.now();
8492
8675
  else if (e._vts <= invoker.attached) return;
8493
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
8676
+ const value = invoker.value;
8677
+ if (isArray(value)) {
8678
+ const originalStop = e.stopImmediatePropagation;
8679
+ e.stopImmediatePropagation = () => {
8680
+ originalStop.call(e);
8681
+ e._stopped = true;
8682
+ };
8683
+ const handlers = value.slice();
8684
+ const args = [e];
8685
+ for (let i = 0; i < handlers.length; i++) {
8686
+ if (e._stopped) break;
8687
+ const handler = handlers[i];
8688
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
8689
+ }
8690
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
8494
8691
  };
8495
8692
  invoker.value = initialValue;
8496
8693
  invoker.attached = getNow();
8497
8694
  return invoker;
8498
8695
  }
8499
- function patchStopImmediatePropagation(e, value) {
8500
- if (isArray(value)) {
8501
- const originalStop = e.stopImmediatePropagation;
8502
- e.stopImmediatePropagation = () => {
8503
- originalStop.call(e);
8504
- e._stopped = true;
8505
- };
8506
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
8507
- } else return value;
8508
- }
8509
8696
  //#endregion
8510
8697
  //#region packages/runtime-dom/src/patchProp.ts
8511
8698
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -8813,7 +9000,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
8813
9000
  replacementNodes.push(child);
8814
9001
  }
8815
9002
  parent.removeChild(o);
8816
- slotReplacements.set(o, replacementNodes);
9003
+ slotReplacements.set(o, {
9004
+ nodes: replacementNodes,
9005
+ usedFallback: !content
9006
+ });
8817
9007
  }
8818
9008
  this._updateSlotNodes(slotReplacements);
8819
9009
  }
@@ -8980,7 +9170,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
8980
9170
  prevChildren = [];
8981
9171
  if (children) for (let i = 0; i < children.length; i++) {
8982
9172
  const child = children[i];
8983
- if (child.el && child.el instanceof Element) {
9173
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
8984
9174
  prevChildren.push(child);
8985
9175
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
8986
9176
  positionMap.set(child, getPosition(child.el));
@@ -9120,7 +9310,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
9120
9310
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
9121
9311
  const newValue = value == null ? "" : value;
9122
9312
  if (elValue === newValue) return;
9123
- if (document.activeElement === el && el.type !== "range") {
9313
+ const rootNode = el.getRootNode();
9314
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
9124
9315
  if (lazy && value === oldValue) return;
9125
9316
  if (trim && el.value.trim() === newValue) return;
9126
9317
  }
@@ -9202,7 +9393,8 @@ const vModelSelect = {
9202
9393
  mounted(el, { value }) {
9203
9394
  vModelSetSelected(el, value);
9204
9395
  },
9205
- beforeUpdate(el, _binding, vnode) {
9396
+ beforeUpdate(el, { value }, vnode) {
9397
+ el._modelValue = value;
9206
9398
  el[assignKey] = getModelAssigner(vnode);
9207
9399
  },
9208
9400
  updated(el, { value }) {
@@ -9213,10 +9405,10 @@ const vModelSelect = {
9213
9405
  * @internal
9214
9406
  */
9215
9407
  const vModelSelectInit = (el, value, number, set) => {
9216
- const isSetModel = isSet(value);
9408
+ el._modelValue = value;
9217
9409
  addEventListener(el, "change", () => {
9218
9410
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
9219
- (set || el[assignKey])(el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9411
+ (set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9220
9412
  el._assigning = true;
9221
9413
  nextTick(() => {
9222
9414
  el._assigning = false;
@@ -9227,6 +9419,7 @@ const vModelSelectInit = (el, value, number, set) => {
9227
9419
  * @internal
9228
9420
  */
9229
9421
  const vModelSetSelected = (el, value) => {
9422
+ el._modelValue = value;
9230
9423
  if (el._assigning) return;
9231
9424
  const isMultiple = el.multiple;
9232
9425
  const isArrayValue = isArray(value);
@@ -11516,6 +11709,7 @@ function getUnnormalizedProps(props, callPath = []) {
11516
11709
  return [props, callPath];
11517
11710
  }
11518
11711
  function injectProp(node, prop, context) {
11712
+ if (node.type !== 13 && injectSlotKey(node, prop)) return;
11519
11713
  let propsWithInjection;
11520
11714
  /**
11521
11715
  * 1. mergeProps(...)
@@ -11554,6 +11748,20 @@ function injectProp(node, prop, context) {
11554
11748
  else if (parentCall) parentCall.arguments[0] = propsWithInjection;
11555
11749
  else node.arguments[2] = propsWithInjection;
11556
11750
  }
11751
+ function injectSlotKey(node, prop) {
11752
+ var _node$arguments, _node$arguments2, _node$arguments3;
11753
+ if (prop.key.type !== 4 || prop.key.content !== "key") return false;
11754
+ const props = node.arguments[2];
11755
+ if (props && !isString(props)) {
11756
+ const [unnormalizedProps] = getUnnormalizedProps(props);
11757
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) return true;
11758
+ }
11759
+ (_node$arguments = node.arguments)[2] || (_node$arguments[2] = "{}");
11760
+ (_node$arguments2 = node.arguments)[3] || (_node$arguments2[3] = "undefined");
11761
+ (_node$arguments3 = node.arguments)[4] || (_node$arguments3[4] = "undefined");
11762
+ node.arguments[5] = prop.value;
11763
+ return true;
11764
+ }
11557
11765
  function hasProp(prop, props) {
11558
11766
  let result = false;
11559
11767
  if (prop.key.type === 4) {
@@ -11850,7 +12058,7 @@ const tokenizer = new Tokenizer(stack, {
11850
12058
  }
11851
12059
  },
11852
12060
  oncdata(start, end) {
11853
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
12061
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
11854
12062
  else emitError(1, start - 9);
11855
12063
  },
11856
12064
  onprocessinginstruction(start) {
@@ -12338,7 +12546,7 @@ function getSelfName(filename) {
12338
12546
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
12339
12547
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
12340
12548
  }
12341
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
12549
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
12342
12550
  const context = {
12343
12551
  filename,
12344
12552
  selfName: getSelfName(filename),
@@ -12360,6 +12568,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12360
12568
  bindingMetadata,
12361
12569
  inline,
12362
12570
  isTS,
12571
+ eventDelegation,
12363
12572
  onError,
12364
12573
  onWarn,
12365
12574
  compatConfig,
@@ -12371,8 +12580,10 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12371
12580
  imports: [],
12372
12581
  cached: [],
12373
12582
  constantCache: /* @__PURE__ */ new WeakMap(),
12583
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
12374
12584
  temps: 0,
12375
12585
  identifiers: Object.create(null),
12586
+ identifierScopes: Object.create(null),
12376
12587
  scopes: {
12377
12588
  vFor: 0,
12378
12589
  vSlot: 0,
@@ -12417,16 +12628,20 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12417
12628
  context.parent.children.splice(removalIndex, 1);
12418
12629
  },
12419
12630
  onNodeRemoved: NOOP,
12420
- addIdentifiers(exp) {
12421
- if (isString(exp)) addId(exp);
12422
- else if (exp.identifiers) exp.identifiers.forEach(addId);
12423
- else if (exp.type === 4) addId(exp.content);
12631
+ addIdentifiers(exp, type = "local") {
12632
+ if (isString(exp)) addId(exp, type);
12633
+ else if (exp.identifiers) exp.identifiers.forEach((id) => addId(id, type));
12634
+ else if (exp.type === 4) addId(exp.content, type);
12424
12635
  },
12425
12636
  removeIdentifiers(exp) {
12426
12637
  if (isString(exp)) removeId(exp);
12427
12638
  else if (exp.identifiers) exp.identifiers.forEach(removeId);
12428
12639
  else if (exp.type === 4) removeId(exp.content);
12429
12640
  },
12641
+ isSlotScopeIdentifier(name) {
12642
+ const scopes = context.identifierScopes[name];
12643
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
12644
+ },
12430
12645
  hoist(exp) {
12431
12646
  if (isString(exp)) exp = createSimpleExpression(exp);
12432
12647
  context.hoists.push(exp);
@@ -12441,13 +12656,16 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12441
12656
  }
12442
12657
  };
12443
12658
  context.filters = /* @__PURE__ */ new Set();
12444
- function addId(id) {
12445
- const { identifiers } = context;
12659
+ function addId(id, type) {
12660
+ const { identifiers, identifierScopes } = context;
12446
12661
  if (identifiers[id] === void 0) identifiers[id] = 0;
12447
12662
  identifiers[id]++;
12663
+ (identifierScopes[id] || (identifierScopes[id] = [])).push(type);
12448
12664
  }
12449
12665
  function removeId(id) {
12450
12666
  context.identifiers[id]--;
12667
+ const scopes = context.identifierScopes[id];
12668
+ if (scopes) scopes.pop();
12451
12669
  }
12452
12670
  return context;
12453
12671
  }
@@ -12869,6 +13087,7 @@ function genNode(node, context) {
12869
13087
  case 26:
12870
13088
  genReturnStatement(node, context);
12871
13089
  break;
13090
+ /* v8 ignore start */
12872
13091
  case 10: break;
12873
13092
  default:
12874
13093
  }
@@ -13118,7 +13337,7 @@ const transformExpression = (node, context) => {
13118
13337
  if (dir.type === 7 && dir.name !== "for") {
13119
13338
  const exp = dir.exp;
13120
13339
  const arg = dir.arg;
13121
- 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");
13340
+ 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");
13122
13341
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
13123
13342
  }
13124
13343
  }
@@ -13369,11 +13588,11 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
13369
13588
  const keyProp = findProp(node, `key`, false, true);
13370
13589
  const isDirKey = keyProp && keyProp.type === 7;
13371
13590
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
13372
- if (memo && keyExp && isDirKey) keyProp.exp = keyExp = processExpression(keyExp, context);
13373
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
13374
- if (isTemplate) {
13375
- if (memo) memo.exp = processExpression(memo.exp, context);
13376
- if (keyProperty && keyProp.type !== 6) keyProperty.value = processExpression(keyProperty.value, context);
13591
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
13592
+ if (isTemplate && memo) memo.exp = processExpression(memo.exp, context);
13593
+ if ((isTemplate || memo) && keyProperty && isDirKey) {
13594
+ keyExp = keyProp.exp = keyProperty.value = processExpression(keyProperty.value, context);
13595
+ if (memo) context.vForMemoKeyedNodes.add(node);
13377
13596
  }
13378
13597
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
13379
13598
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -13418,7 +13637,7 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
13418
13637
  `)`
13419
13638
  ]),
13420
13639
  createCompoundExpression([
13421
- `if (_cached`,
13640
+ `if (_cached && _cached.el`,
13422
13641
  ...keyExp ? [` && _cached.key === `, keyExp] : [],
13423
13642
  ` && ${context.helperString(IS_MEMO_SAME)}(_cached, _memo)) return _cached`
13424
13643
  ]),
@@ -13504,7 +13723,7 @@ const trackSlotScopes = (node, context) => {
13504
13723
  const vSlot = findDir(node, "slot");
13505
13724
  if (vSlot) {
13506
13725
  const slotProps = vSlot.exp;
13507
- if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps);
13726
+ if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps, "slot");
13508
13727
  context.scopes.vSlot++;
13509
13728
  return () => {
13510
13729
  if (context.prefixIdentifiers) slotProps && context.removeIdentifiers(slotProps);
@@ -13720,6 +13939,15 @@ function resolveComponentType(node, context, ssr = false) {
13720
13939
  if (!ssr) context.helper(builtIn);
13721
13940
  return builtIn;
13722
13941
  }
13942
+ {
13943
+ const fromScope = resolveSlotScopeReference(tag, context);
13944
+ if (fromScope) return fromScope;
13945
+ const dotIndex = tag.indexOf(".");
13946
+ if (dotIndex > 0) {
13947
+ const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
13948
+ if (ns) return ns + tag.slice(dotIndex);
13949
+ }
13950
+ }
13723
13951
  {
13724
13952
  const fromSetup = resolveSetupReference(tag, context);
13725
13953
  if (fromSetup) return fromSetup;
@@ -13738,6 +13966,14 @@ function resolveComponentType(node, context, ssr = false) {
13738
13966
  context.components.add(tag);
13739
13967
  return toValidAssetId(tag, `component`);
13740
13968
  }
13969
+ function resolveSlotScopeReference(name, context) {
13970
+ const camelName = camelize(name);
13971
+ const PascalName = capitalize(camelName);
13972
+ const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
13973
+ if (isInSlotScope(name)) return name;
13974
+ if (isInSlotScope(camelName)) return camelName;
13975
+ if (isInSlotScope(PascalName)) return PascalName;
13976
+ }
13741
13977
  function resolveSetupReference(name, context) {
13742
13978
  const bindings = context.bindingMetadata;
13743
13979
  if (!bindings || bindings.__isScriptSetup === false) return;
@@ -14255,7 +14491,7 @@ function rewriteFilter(node, context) {
14255
14491
  const child = node.children[i];
14256
14492
  if (typeof child !== "object") continue;
14257
14493
  if (child.type === 4) parseFilter(child, context);
14258
- else if (child.type === 8) rewriteFilter(node, context);
14494
+ else if (child.type === 8) rewriteFilter(child, context);
14259
14495
  else if (child.type === 5) rewriteFilter(child.content, context);
14260
14496
  }
14261
14497
  }