@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.
@@ -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
  **/
@@ -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;
@@ -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
  }
@@ -2805,7 +2815,7 @@ function instanceWatch(source, value, options) {
2805
2815
  }
2806
2816
  const prev = setCurrentInstance(this);
2807
2817
  const res = doWatch(getter, cb.bind(publicThis), options);
2808
- setCurrentInstance(...prev);
2818
+ restoreCurrentInstance(prev);
2809
2819
  return res;
2810
2820
  }
2811
2821
  function createPathGetter(ctx, path) {
@@ -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,54 +2845,66 @@ 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) || parentSuspense && parentSuspense.pendingBranch) {
2866
- n2.el.__isMounted = false;
2867
- queuePostRenderEffect(() => {
2868
- if (n2.el.__isMounted !== false) return;
2869
- mountToTarget();
2870
- delete n2.el.__isMounted;
2871
- }, void 0, parentSuspense);
2872
- } else mountToTarget();
2894
+ mountToTarget();
2873
2895
  } else {
2874
2896
  n2.el = n1.el;
2875
- n2.targetStart = n1.targetStart;
2876
2897
  const mainAnchor = n2.anchor = n1.anchor;
2877
- const target = n2.target = n1.target;
2878
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
2879
- if (n1.el.__isMounted === false) {
2880
- queuePostRenderEffect(() => {
2881
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
2882
- }, void 0, parentSuspense);
2898
+ const pendingMount = pendingMounts.get(n1);
2899
+ if (pendingMount) {
2900
+ pendingMount.flags |= 4;
2901
+ pendingMounts.delete(n1);
2902
+ queuePendingMount(n2);
2883
2903
  return;
2884
2904
  }
2905
+ n2.targetStart = n1.targetStart;
2906
+ const target = n2.target = n1.target;
2907
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
2885
2908
  const wasDisabled = isTeleportDisabled(n1.props);
2886
2909
  const currentContainer = wasDisabled ? container : target;
2887
2910
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -2895,23 +2918,30 @@ const TeleportImpl = {
2895
2918
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
2896
2919
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
2897
2920
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
2898
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
2899
- 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
+ }
2900
2926
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
2901
2927
  updateCssVars(n2, disabled);
2902
2928
  }
2903
2929
  },
2904
2930
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
2905
- const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
2931
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
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
+ }
2906
2939
  if (targetStart) hostRemove(targetStart);
2907
2940
  if (targetAnchor) hostRemove(targetAnchor);
2908
2941
  doRemove && hostRemove(anchor);
2909
- if (shapeFlag & 16) {
2910
- const shouldRemove = doRemove || !isTeleportDisabled(props);
2911
- for (let i = 0; i < children.length; i++) {
2912
- const child = children[i];
2913
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
2914
- }
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);
2915
2945
  }
2916
2946
  },
2917
2947
  move: moveTeleport,
@@ -2922,7 +2952,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
2922
2952
  const { el, anchor, shapeFlag, children, props } = vnode;
2923
2953
  const isReorder = moveType === 2;
2924
2954
  if (isReorder) insert(el, container, parentAnchor);
2925
- if (!isReorder || isTeleportDisabled(props)) {
2955
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
2926
2956
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
2927
2957
  }
2928
2958
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3047,8 +3077,8 @@ const BaseTransitionImpl = {
3047
3077
  const state = useTransitionState();
3048
3078
  return () => {
3049
3079
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3050
- if (!children || !children.length) return;
3051
- const child = findNonCommentChild(children);
3080
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3081
+ if (!child) return;
3052
3082
  const rawProps = /* @__PURE__ */ toRaw(props);
3053
3083
  const { mode } = rawProps;
3054
3084
  if (state.isLeaving) return emptyPlaceholder(child);
@@ -3225,12 +3255,11 @@ function getInnerChild$1(vnode) {
3225
3255
  }
3226
3256
  }
3227
3257
  function setTransitionHooks(vnode, hooks) {
3228
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3229
- else {
3258
+ if (vnode.shapeFlag & 6 && vnode.component) {
3230
3259
  vnode.transition = hooks;
3231
- setTransitionHooks(vnode.component.subTree, hooks);
3232
- }
3233
- else if (vnode.shapeFlag & 128) {
3260
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3261
+ else setTransitionHooks(vnode.component.subTree, hooks);
3262
+ } else if (vnode.shapeFlag & 128) {
3234
3263
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3235
3264
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3236
3265
  } else vnode.transition = hooks;
@@ -3473,7 +3502,7 @@ function createHydrationFunctions(rendererInternals) {
3473
3502
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3474
3503
  break;
3475
3504
  case VaporSlot:
3476
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
3505
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
3477
3506
  break;
3478
3507
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) nextNode = onMismatch();
3479
3508
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -3483,16 +3512,31 @@ function createHydrationFunctions(rendererInternals) {
3483
3512
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
3484
3513
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
3485
3514
  else nextNode = nextSibling(node);
3486
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
3487
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3488
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3489
- let subTree;
3490
- if (isFragmentStart) {
3491
- subTree = createVNode(Fragment);
3492
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3493
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3494
- subTree.el = node;
3495
- vnode.component.subTree = subTree;
3515
+ if (vnode.type.__vapor) {
3516
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
3517
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
3518
+ if (vnode.dirs) {
3519
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
3520
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3521
+ }
3522
+ }, () => {
3523
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
3524
+ });
3525
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
3526
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
3527
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
3528
+ } else {
3529
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
3530
+ const component = vnode.component;
3531
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
3532
+ let subTree;
3533
+ if (isFragmentStart) {
3534
+ subTree = createVNode(Fragment);
3535
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
3536
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
3537
+ subTree.el = node;
3538
+ component.subTree = subTree;
3539
+ }
3496
3540
  }
3497
3541
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
3498
3542
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -3503,9 +3547,10 @@ function createHydrationFunctions(rendererInternals) {
3503
3547
  };
3504
3548
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
3505
3549
  optimized = optimized || !!vnode.dynamicChildren;
3506
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3550
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
3507
3551
  const forcePatch = type === "input" || type === "option";
3508
- if (forcePatch || patchFlag !== -1) {
3552
+ const hasDynamicProps = !!dynamicProps;
3553
+ if (forcePatch || hasDynamicProps || patchFlag !== -1) {
3509
3554
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
3510
3555
  let needCallTransitionHooks = false;
3511
3556
  if (isTemplateNode$1(el)) {
@@ -3521,8 +3566,8 @@ function createHydrationFunctions(rendererInternals) {
3521
3566
  }
3522
3567
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
3523
3568
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
3569
+ if (next && !isMismatchAllowed(el, 1)) logMismatchError();
3524
3570
  while (next) {
3525
- if (!isMismatchAllowed(el, 1)) logMismatchError();
3526
3571
  const cur = next;
3527
3572
  next = next.nextSibling;
3528
3573
  remove(cur);
@@ -3537,9 +3582,10 @@ function createHydrationFunctions(rendererInternals) {
3537
3582
  }
3538
3583
  }
3539
3584
  if (props) {
3540
- if (forcePatch || !optimized || patchFlag & 48) {
3585
+ if (forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
3541
3586
  const isCustomElement = el.tagName.includes("-");
3542
- 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);
3587
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
3588
+ 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);
3543
3589
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
3544
3590
  else if (patchFlag & 4 && /* @__PURE__ */ isReactive(props.style)) for (const key in props.style) props.style[key];
3545
3591
  }
@@ -3558,6 +3604,7 @@ function createHydrationFunctions(rendererInternals) {
3558
3604
  optimized = optimized || !!parentVNode.dynamicChildren;
3559
3605
  const children = parentVNode.children;
3560
3606
  const l = children.length;
3607
+ let hasCheckedMismatch = false;
3561
3608
  for (let i = 0; i < l; i++) {
3562
3609
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3563
3610
  const isText = vnode.type === Text;
@@ -3571,7 +3618,10 @@ function createHydrationFunctions(rendererInternals) {
3571
3618
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3572
3619
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
3573
3620
  else {
3574
- if (!isMismatchAllowed(container, 1)) logMismatchError();
3621
+ if (!hasCheckedMismatch) {
3622
+ hasCheckedMismatch = true;
3623
+ if (!isMismatchAllowed(container, 1)) logMismatchError();
3624
+ }
3575
3625
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
3576
3626
  }
3577
3627
  }
@@ -3590,7 +3640,7 @@ function createHydrationFunctions(rendererInternals) {
3590
3640
  }
3591
3641
  };
3592
3642
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3593
- if (!isMismatchAllowed(node.parentElement, 1)) logMismatchError();
3643
+ if (!isNodeMismatchAllowed(node, vnode)) logMismatchError();
3594
3644
  vnode.el = null;
3595
3645
  if (isFragment) {
3596
3646
  const end = locateClosingAnchor(node);
@@ -3646,7 +3696,9 @@ const MismatchTypeString = {
3646
3696
  };
3647
3697
  function isMismatchAllowed(el, allowedType) {
3648
3698
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
3649
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
3699
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
3700
+ }
3701
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
3650
3702
  if (allowedAttr == null) return false;
3651
3703
  else if (allowedAttr === "") return true;
3652
3704
  else {
@@ -3655,6 +3707,16 @@ function isMismatchAllowed(el, allowedType) {
3655
3707
  return list.includes(MismatchTypeString[allowedType]);
3656
3708
  }
3657
3709
  }
3710
+ function isNodeMismatchAllowed(node, vnode) {
3711
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
3712
+ }
3713
+ function isMismatchAllowedByNode(node) {
3714
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
3715
+ }
3716
+ function isMismatchAllowedByVNode({ props }) {
3717
+ const allowedAttr = props && props[allowMismatchAttr];
3718
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
3719
+ }
3658
3720
  //#endregion
3659
3721
  //#region packages/runtime-core/src/hydrationStrategies.ts
3660
3722
  let requestIdleCallback;
@@ -3773,11 +3835,16 @@ function defineAsyncComponent(source) {
3773
3835
  onError(err);
3774
3836
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
3775
3837
  });
3776
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
3838
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
3777
3839
  load().then(() => {
3840
+ if (instance.isUnmounted) return;
3778
3841
  loaded.value = true;
3779
3842
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
3780
3843
  }).catch((err) => {
3844
+ if (instance.isUnmounted) {
3845
+ setPendingRequest(null);
3846
+ return;
3847
+ }
3781
3848
  onError(err);
3782
3849
  error.value = err;
3783
3850
  });
@@ -3833,14 +3900,22 @@ function createAsyncComponentContext(source) {
3833
3900
  setPendingRequest: (request) => pendingRequest = request
3834
3901
  };
3835
3902
  }
3836
- const useAsyncComponentState = (delay, timeout, onError) => {
3903
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
3837
3904
  const loaded = /* @__PURE__ */ ref(false);
3838
3905
  const error = /* @__PURE__ */ ref();
3839
3906
  const delayed = /* @__PURE__ */ ref(!!delay);
3840
- if (delay) setTimeout(() => {
3907
+ let timeoutTimer;
3908
+ let delayTimer;
3909
+ if (instance) onUnmounted(() => {
3910
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
3911
+ if (delayTimer != null) clearTimeout(delayTimer);
3912
+ }, instance);
3913
+ if (delay) delayTimer = setTimeout(() => {
3914
+ if (instance && instance.isUnmounted) return;
3841
3915
  delayed.value = false;
3842
3916
  }, delay);
3843
- if (timeout != null) setTimeout(() => {
3917
+ if (timeout != null) timeoutTimer = setTimeout(() => {
3918
+ if (instance && instance.isUnmounted) return;
3844
3919
  if (!loaded.value && !error.value) {
3845
3920
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
3846
3921
  onError(err);
@@ -3858,10 +3933,12 @@ const useAsyncComponentState = (delay, timeout, onError) => {
3858
3933
  * @internal
3859
3934
  */
3860
3935
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
3936
+ const wasConnected = el.isConnected;
3861
3937
  let patched = false;
3862
3938
  (instance.bu || (instance.bu = [])).push(() => patched = true);
3863
3939
  const performHydrate = () => {
3864
3940
  if (patched) return;
3941
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
3865
3942
  hydrate();
3866
3943
  };
3867
3944
  const doHydrate = hydrateStrategy ? () => {
@@ -4103,7 +4180,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4103
4180
  try {
4104
4181
  return callWithAsyncErrorHandling(hook, target, type, args);
4105
4182
  } finally {
4106
- setCurrentInstance(...prev);
4183
+ restoreCurrentInstance(prev);
4107
4184
  setActiveSub(prevSub);
4108
4185
  }
4109
4186
  });
@@ -4434,8 +4511,9 @@ function createSlots(slots, dynamicSlots) {
4434
4511
  * Compiler runtime helper for rendering `<slot/>`
4435
4512
  * @private
4436
4513
  */
4437
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4514
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
4438
4515
  let slot = slots[name];
4516
+ if (fallback) fallback.__vdom = true;
4439
4517
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
4440
4518
  if (vaporSlot) {
4441
4519
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -4443,21 +4521,31 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4443
4521
  slot: vaporSlot,
4444
4522
  fallback
4445
4523
  };
4524
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4446
4525
  return ret;
4447
4526
  }
4448
4527
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
4449
- const hasProps = Object.keys(props).length > 0;
4450
- if (name !== "default") props.name = name;
4451
- return openBlock(), createBlock(Fragment, null, [createVNode("slot", props, fallback && fallback())], hasProps ? -2 : 64);
4528
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
4529
+ const hasProps = Object.keys(slotProps).length > 0;
4530
+ if (name !== "default") slotProps.name = name;
4531
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
4452
4532
  }
4453
4533
  if (slot && slot._c) slot._d = false;
4534
+ const prevStackSize = blockStack.length;
4454
4535
  openBlock();
4455
- const validSlotContent = slot && ensureValidVNode(slot(props));
4456
- ensureVaporSlotFallback(validSlotContent, fallback);
4457
- const slotKey = props.key || validSlotContent && validSlotContent.key;
4458
- const rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4536
+ let rendered;
4537
+ try {
4538
+ const validSlotContent = slot && ensureValidVNode(slot(props));
4539
+ ensureVaporSlotFallback(validSlotContent, fallback);
4540
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
4541
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
4542
+ } catch (err) {
4543
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
4544
+ throw err;
4545
+ } finally {
4546
+ if (slot && slot._c) slot._d = true;
4547
+ }
4459
4548
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
4460
- if (slot && slot._c) slot._d = true;
4461
4549
  return rendered;
4462
4550
  }
4463
4551
  function ensureValidVNode(vnodes) {
@@ -4470,9 +4558,7 @@ function ensureValidVNode(vnodes) {
4470
4558
  }
4471
4559
  function ensureVaporSlotFallback(vnodes, fallback) {
4472
4560
  let vaporSlot;
4473
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
4474
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
4475
- }
4561
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
4476
4562
  }
4477
4563
  //#endregion
4478
4564
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -4934,25 +5020,38 @@ function createPropsRestProxy(props, excludedKeys) {
4934
5020
  function withAsyncContext(getAwaitable) {
4935
5021
  const ctx = getCurrentGenericInstance();
4936
5022
  const inSSRSetup = isInSSRComponentSetup;
5023
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
4937
5024
  let awaitable = getAwaitable();
4938
5025
  setCurrentInstance(null, void 0);
4939
5026
  if (inSSRSetup) setInSSRSetupState(false);
4940
5027
  const restore = () => {
5028
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
4941
5029
  setCurrentInstance(ctx);
4942
5030
  if (inSSRSetup) setInSSRSetupState(true);
5031
+ const reset = restoreAsyncContext && restoreAsyncContext();
5032
+ return () => {
5033
+ if (reset) reset();
5034
+ if (resetStoppedScope) resetStoppedScope.reset();
5035
+ };
4943
5036
  };
4944
5037
  const cleanup = () => {
4945
5038
  setCurrentInstance(null, void 0);
4946
5039
  if (inSSRSetup) setInSSRSetupState(false);
4947
5040
  };
4948
5041
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
4949
- restore();
4950
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
5042
+ const reset = restore();
5043
+ Promise.resolve().then(() => Promise.resolve().then(() => {
5044
+ if (reset) reset();
5045
+ cleanup();
5046
+ }));
4951
5047
  throw e;
4952
5048
  });
4953
5049
  return [awaitable, () => {
4954
- restore();
4955
- Promise.resolve().then(cleanup);
5050
+ const reset = restore();
5051
+ Promise.resolve().then(() => {
5052
+ if (reset) reset();
5053
+ cleanup();
5054
+ });
4956
5055
  }];
4957
5056
  }
4958
5057
  //#endregion
@@ -5203,7 +5302,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5203
5302
  if (options.el) return vm.$mount(options.el);
5204
5303
  else return vm;
5205
5304
  }
5206
- Vue.version = `2.6.14-compat:3.6.0-beta.9`;
5305
+ Vue.version = `2.6.14-compat:3.6.0-rc.2`;
5207
5306
  Vue.config = singletonApp.config;
5208
5307
  Vue.use = (plugin, ...options) => {
5209
5308
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -5638,12 +5737,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
5638
5737
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
5639
5738
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
5640
5739
  }
5641
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
5740
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
5741
+ if (!hasVModel) {
5642
5742
  localValue = value;
5643
5743
  trigger();
5644
5744
  }
5645
5745
  i.emit(`update:${name}`, emittedValue);
5646
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
5746
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
5647
5747
  prevSetValue = value;
5648
5748
  prevEmittedValue = emittedValue;
5649
5749
  }
@@ -5740,7 +5840,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
5740
5840
  function isEmitListener(options, key) {
5741
5841
  if (!options || !isOn(key)) return false;
5742
5842
  if (key.startsWith(compatModelEventPrefix)) return true;
5743
- key = key.slice(2).replace(/Once$/, "");
5843
+ key = key.slice(2);
5844
+ key = key === "Once" ? key : key.replace(/Once$/, "");
5744
5845
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
5745
5846
  }
5746
5847
  //#endregion
@@ -6029,7 +6130,7 @@ function baseResolveDefault(factory, instance, key) {
6029
6130
  const prev = setCurrentInstance(instance);
6030
6131
  const props = /* @__PURE__ */ toRaw(instance.props);
6031
6132
  value = factory.call(isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null, props);
6032
- setCurrentInstance(...prev);
6133
+ restoreCurrentInstance(prev);
6033
6134
  return value;
6034
6135
  }
6035
6136
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -6330,6 +6431,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6330
6431
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6331
6432
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6332
6433
  parentComponent && toggleRecurse(parentComponent, true);
6434
+ if (dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
6435
+ patchFlag = 0;
6436
+ optimized = false;
6437
+ dynamicChildren = null;
6438
+ }
6333
6439
  if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) hostSetElementText(el, "");
6334
6440
  if (dynamicChildren) patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds);
6335
6441
  else if (!optimized) patchChildren(n1, n2, el, null, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds, false);
@@ -6396,21 +6502,37 @@ function baseCreateRenderer(options, createHydrationFns) {
6396
6502
  };
6397
6503
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6398
6504
  n2.slotScopeIds = slotScopeIds;
6399
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
6505
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
6400
6506
  else {
6507
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
6401
6508
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
6402
6509
  if (n2.dirs) {
6403
6510
  invokeDirectiveHook(n2, null, parentComponent, "created");
6404
6511
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
6405
6512
  }
6513
+ }, () => {
6514
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
6406
6515
  });
6407
6516
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
6517
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
6518
+ if (vnodeMountedHook) {
6519
+ const scopedVNode = n2;
6520
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
6521
+ }
6408
6522
  }
6409
6523
  else {
6410
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
6524
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
6525
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
6411
6526
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
6527
+ }, () => {
6528
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
6529
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
6412
6530
  });
6413
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
6531
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
6532
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
6533
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
6534
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
6535
+ }, void 0, parentSuspense);
6414
6536
  }
6415
6537
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
6416
6538
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -6698,7 +6820,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6698
6820
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
6699
6821
  const { el, type, transition, children, shapeFlag } = vnode;
6700
6822
  if (isVaporComponent(type) || type === VaporSlot) {
6701
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
6823
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
6702
6824
  return;
6703
6825
  }
6704
6826
  if (shapeFlag & 6) {
@@ -6731,8 +6853,10 @@ function baseCreateRenderer(options, createHydrationFns) {
6731
6853
  else hostInsert(el, container, anchor);
6732
6854
  };
6733
6855
  const performLeave = () => {
6856
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
6734
6857
  if (el._isLeaving) el[leaveCbKey](true);
6735
- leave(el, () => {
6858
+ if (transition.persisted && !wasLeaving) remove();
6859
+ else leave(el, () => {
6736
6860
  remove();
6737
6861
  afterLeave && afterLeave();
6738
6862
  });
@@ -6752,7 +6876,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6752
6876
  }
6753
6877
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
6754
6878
  if (shapeFlag & 256) {
6755
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
6879
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
6756
6880
  else parentComponent.ctx.deactivate(vnode);
6757
6881
  return;
6758
6882
  }
@@ -6762,8 +6886,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6762
6886
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
6763
6887
  if (shapeFlag & 6) if (isVaporComponent(type)) {
6764
6888
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6765
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6766
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
6889
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
6890
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
6891
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6892
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6893
+ }, void 0, parentSuspense);
6767
6894
  return;
6768
6895
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
6769
6896
  else {
@@ -6776,7 +6903,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6776
6903
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
6777
6904
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
6778
6905
  if (type === VaporSlot) {
6779
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6906
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
6780
6907
  return;
6781
6908
  }
6782
6909
  if (doRemove) remove(vnode);
@@ -6820,7 +6947,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6820
6947
  if (effect) {
6821
6948
  effect.stop();
6822
6949
  unmount(subTree, instance, parentSuspense, doRemove);
6823
- }
6950
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
6824
6951
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
6825
6952
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) queuePostRenderEffect(() => instance.emit("hook:destroyed"), void 0, parentSuspense);
6826
6953
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
@@ -6940,6 +7067,10 @@ function invalidateMount(hooks) {
6940
7067
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
6941
7068
  }
6942
7069
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
7070
+ if (force && transition.persisted && !el[leaveCbKey]) {
7071
+ insert();
7072
+ return;
7073
+ }
6943
7074
  if (force || needTransition(parentSuspense, transition)) {
6944
7075
  transition.beforeEnter(el);
6945
7076
  insert();
@@ -7129,15 +7260,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7129
7260
  if (suspense.isHydrating) suspense.isHydrating = false;
7130
7261
  else if (!resume) {
7131
7262
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
7263
+ let hasUpdatedAnchor = false;
7132
7264
  if (delayEnter) activeBranch.transition.afterLeave = () => {
7133
7265
  if (pendingId === suspense.pendingId) {
7134
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7266
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7135
7267
  queuePostFlushCb(effects);
7136
7268
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7137
7269
  }
7138
7270
  };
7139
7271
  if (activeBranch && !suspense.isFallbackMountPending) {
7140
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7272
+ if (parentNode(activeBranch.el) === container) {
7273
+ anchor = next(activeBranch);
7274
+ hasUpdatedAnchor = true;
7275
+ }
7141
7276
  unmount(activeBranch, parentComponent, suspense, true);
7142
7277
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7143
7278
  }
@@ -7201,6 +7336,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7201
7336
  handleError(err, instance, 0);
7202
7337
  }).then((asyncSetupResult) => {
7203
7338
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
7339
+ setCurrentInstance(null, void 0);
7204
7340
  instance.asyncResolved = true;
7205
7341
  onResolve(asyncSetupResult);
7206
7342
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -7507,12 +7643,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7507
7643
  el: vnode.el,
7508
7644
  anchor: vnode.anchor,
7509
7645
  ctx: vnode.ctx,
7510
- ce: vnode.ce
7646
+ ce: vnode.ce,
7647
+ vi: vnode.vi,
7648
+ vs: cloneVaporSlotMeta(vnode),
7649
+ vb: vnode.vb
7511
7650
  };
7512
7651
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
7513
7652
  defineLegacyVNodeProperties(cloned);
7514
7653
  return cloned;
7515
7654
  }
7655
+ function cloneVaporSlotMeta(vnode) {
7656
+ const vaporSlot = vnode.vs;
7657
+ if (!vaporSlot) return vaporSlot;
7658
+ const cloned = {
7659
+ slot: vaporSlot.slot,
7660
+ fallback: vaporSlot.fallback,
7661
+ outletFallback: vaporSlot.outletFallback
7662
+ };
7663
+ if (vnode.el) {
7664
+ cloned.state = vaporSlot.state;
7665
+ cloned.ref = vaporSlot.ref;
7666
+ cloned.scope = vaporSlot.scope;
7667
+ }
7668
+ return cloned;
7669
+ }
7516
7670
  /**
7517
7671
  * @private
7518
7672
  */
@@ -7566,6 +7720,10 @@ function normalizeChildren(vnode, children) {
7566
7720
  }
7567
7721
  }
7568
7722
  else if (isFunction(children)) {
7723
+ if (shapeFlag & 65) {
7724
+ normalizeChildren(vnode, { default: children });
7725
+ return;
7726
+ }
7569
7727
  children = {
7570
7728
  default: children,
7571
7729
  _ctx: currentRenderingInstance
@@ -7638,6 +7796,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
7638
7796
  simpleSetCurrentInstance(instance);
7639
7797
  }
7640
7798
  };
7799
+ /**
7800
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
7801
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
7802
+ * verbatim instead of re-triggering the `instance.scope` default.
7803
+ * @internal
7804
+ */
7805
+ const restoreCurrentInstance = (prev) => {
7806
+ setCurrentScope(prev[1]);
7807
+ simpleSetCurrentInstance(prev[0]);
7808
+ };
7641
7809
  const internalOptions = [
7642
7810
  "ce",
7643
7811
  "type",
@@ -7766,7 +7934,7 @@ function setupStatefulComponent(instance, isSSR) {
7766
7934
  const setupResult = callWithErrorHandling(setup, instance, 0, [instance.props, setupContext]);
7767
7935
  const isAsyncSetup = isPromise(setupResult);
7768
7936
  setActiveSub(prevSub);
7769
- setCurrentInstance(...prev);
7937
+ restoreCurrentInstance(prev);
7770
7938
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
7771
7939
  if (isAsyncSetup) {
7772
7940
  const unsetCurrentInstance = () => {
@@ -7829,7 +7997,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7829
7997
  applyOptions(instance);
7830
7998
  } finally {
7831
7999
  setActiveSub(prevSub);
7832
- setCurrentInstance(...prevInstance);
8000
+ restoreCurrentInstance(prevInstance);
7833
8001
  }
7834
8002
  }
7835
8003
  }
@@ -7927,7 +8095,7 @@ function isMemoSame(cached, memo) {
7927
8095
  }
7928
8096
  //#endregion
7929
8097
  //#region packages/runtime-core/src/index.ts
7930
- const version = "3.6.0-beta.9";
8098
+ const version = "3.6.0-rc.2";
7931
8099
  const warn = NOOP;
7932
8100
  /**
7933
8101
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8350,7 +8518,10 @@ function patchStyle(el, prev, next) {
8350
8518
  }
8351
8519
  for (const key in next) {
8352
8520
  if (key === "display") hasControlledDisplay = true;
8353
- setStyle(style, key, next[key]);
8521
+ const value = next[key];
8522
+ if (value != null) {
8523
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
8524
+ } else setStyle(style, key, "");
8354
8525
  }
8355
8526
  } else if (isCssString) {
8356
8527
  if (prev !== next) {
@@ -8396,6 +8567,14 @@ function autoPrefix(style, rawName) {
8396
8567
  }
8397
8568
  return rawName;
8398
8569
  }
8570
+ /**
8571
+ * Browsers update textarea width/height directly during native resize.
8572
+ * Only special-case this common textarea path for now; other resize scenarios
8573
+ * still follow normal vnode style patching.
8574
+ */
8575
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
8576
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
8577
+ }
8399
8578
  //#endregion
8400
8579
  //#region packages/runtime-dom/src/modules/attrs.ts
8401
8580
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -8476,7 +8655,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8476
8655
  const existingInvoker = invokers[rawName];
8477
8656
  if (nextValue && existingInvoker) existingInvoker.value = nextValue;
8478
8657
  else {
8479
- const [name, options] = parseName(rawName);
8658
+ const [name, options] = parseEventName(rawName);
8480
8659
  if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(nextValue, instance), options);
8481
8660
  else if (existingInvoker) {
8482
8661
  removeEventListener(el, name, existingInvoker, options);
@@ -8484,16 +8663,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
8484
8663
  }
8485
8664
  }
8486
8665
  }
8487
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
8488
- function parseName(name) {
8666
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
8667
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
8668
+ function parseEventName(name) {
8489
8669
  let options;
8490
- if (optionsModifierRE.test(name)) {
8491
- options = {};
8492
- let m;
8493
- while (m = name.match(optionsModifierRE)) {
8494
- name = name.slice(0, name.length - m[0].length);
8495
- options[m[0].toLowerCase()] = true;
8496
- }
8670
+ let m;
8671
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
8672
+ if (!options) options = {};
8673
+ name = name.slice(0, name.length - m[1].length);
8674
+ options[m[1].toLowerCase()] = true;
8497
8675
  }
8498
8676
  return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
8499
8677
  }
@@ -8504,22 +8682,26 @@ function createInvoker(initialValue, instance) {
8504
8682
  const invoker = (e) => {
8505
8683
  if (!e._vts) e._vts = Date.now();
8506
8684
  else if (e._vts <= invoker.attached) return;
8507
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
8685
+ const value = invoker.value;
8686
+ if (isArray(value)) {
8687
+ const originalStop = e.stopImmediatePropagation;
8688
+ e.stopImmediatePropagation = () => {
8689
+ originalStop.call(e);
8690
+ e._stopped = true;
8691
+ };
8692
+ const handlers = value.slice();
8693
+ const args = [e];
8694
+ for (let i = 0; i < handlers.length; i++) {
8695
+ if (e._stopped) break;
8696
+ const handler = handlers[i];
8697
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
8698
+ }
8699
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
8508
8700
  };
8509
8701
  invoker.value = initialValue;
8510
8702
  invoker.attached = getNow();
8511
8703
  return invoker;
8512
8704
  }
8513
- function patchStopImmediatePropagation(e, value) {
8514
- if (isArray(value)) {
8515
- const originalStop = e.stopImmediatePropagation;
8516
- e.stopImmediatePropagation = () => {
8517
- originalStop.call(e);
8518
- e._stopped = true;
8519
- };
8520
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
8521
- } else return value;
8522
- }
8523
8705
  //#endregion
8524
8706
  //#region packages/runtime-dom/src/patchProp.ts
8525
8707
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -8827,7 +9009,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
8827
9009
  replacementNodes.push(child);
8828
9010
  }
8829
9011
  parent.removeChild(o);
8830
- slotReplacements.set(o, replacementNodes);
9012
+ slotReplacements.set(o, {
9013
+ nodes: replacementNodes,
9014
+ usedFallback: !content
9015
+ });
8831
9016
  }
8832
9017
  this._updateSlotNodes(slotReplacements);
8833
9018
  }
@@ -8994,7 +9179,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
8994
9179
  prevChildren = [];
8995
9180
  if (children) for (let i = 0; i < children.length; i++) {
8996
9181
  const child = children[i];
8997
- if (child.el && child.el instanceof Element) {
9182
+ if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
8998
9183
  prevChildren.push(child);
8999
9184
  setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
9000
9185
  positionMap.set(child, getPosition(child.el));
@@ -9217,7 +9402,8 @@ const vModelSelect = {
9217
9402
  mounted(el, { value }) {
9218
9403
  vModelSetSelected(el, value);
9219
9404
  },
9220
- beforeUpdate(el, _binding, vnode) {
9405
+ beforeUpdate(el, { value }, vnode) {
9406
+ el._modelValue = value;
9221
9407
  el[assignKey] = getModelAssigner(vnode);
9222
9408
  },
9223
9409
  updated(el, { value }) {
@@ -9228,10 +9414,10 @@ const vModelSelect = {
9228
9414
  * @internal
9229
9415
  */
9230
9416
  const vModelSelectInit = (el, value, number, set) => {
9231
- const isSetModel = isSet(value);
9417
+ el._modelValue = value;
9232
9418
  addEventListener(el, "change", () => {
9233
9419
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
9234
- (set || el[assignKey])(el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9420
+ (set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
9235
9421
  el._assigning = true;
9236
9422
  nextTick(() => {
9237
9423
  el._assigning = false;
@@ -9242,6 +9428,7 @@ const vModelSelectInit = (el, value, number, set) => {
9242
9428
  * @internal
9243
9429
  */
9244
9430
  const vModelSetSelected = (el, value) => {
9431
+ el._modelValue = value;
9245
9432
  if (el._assigning) return;
9246
9433
  const isMultiple = el.multiple;
9247
9434
  const isArrayValue = isArray(value);
@@ -11531,6 +11718,7 @@ function getUnnormalizedProps(props, callPath = []) {
11531
11718
  return [props, callPath];
11532
11719
  }
11533
11720
  function injectProp(node, prop, context) {
11721
+ if (node.type !== 13 && injectSlotKey(node, prop)) return;
11534
11722
  let propsWithInjection;
11535
11723
  /**
11536
11724
  * 1. mergeProps(...)
@@ -11569,6 +11757,20 @@ function injectProp(node, prop, context) {
11569
11757
  else if (parentCall) parentCall.arguments[0] = propsWithInjection;
11570
11758
  else node.arguments[2] = propsWithInjection;
11571
11759
  }
11760
+ function injectSlotKey(node, prop) {
11761
+ var _node$arguments, _node$arguments2, _node$arguments3;
11762
+ if (prop.key.type !== 4 || prop.key.content !== "key") return false;
11763
+ const props = node.arguments[2];
11764
+ if (props && !isString(props)) {
11765
+ const [unnormalizedProps] = getUnnormalizedProps(props);
11766
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) return true;
11767
+ }
11768
+ (_node$arguments = node.arguments)[2] || (_node$arguments[2] = "{}");
11769
+ (_node$arguments2 = node.arguments)[3] || (_node$arguments2[3] = "undefined");
11770
+ (_node$arguments3 = node.arguments)[4] || (_node$arguments3[4] = "undefined");
11771
+ node.arguments[5] = prop.value;
11772
+ return true;
11773
+ }
11572
11774
  function hasProp(prop, props) {
11573
11775
  let result = false;
11574
11776
  if (prop.key.type === 4) {
@@ -11865,7 +12067,7 @@ const tokenizer = new Tokenizer(stack, {
11865
12067
  }
11866
12068
  },
11867
12069
  oncdata(start, end) {
11868
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
12070
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
11869
12071
  else emitError(1, start - 9);
11870
12072
  },
11871
12073
  onprocessinginstruction(start) {
@@ -12386,8 +12588,10 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12386
12588
  imports: [],
12387
12589
  cached: [],
12388
12590
  constantCache: /* @__PURE__ */ new WeakMap(),
12591
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
12389
12592
  temps: 0,
12390
12593
  identifiers: Object.create(null),
12594
+ identifierScopes: Object.create(null),
12391
12595
  scopes: {
12392
12596
  vFor: 0,
12393
12597
  vSlot: 0,
@@ -12432,16 +12636,20 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12432
12636
  context.parent.children.splice(removalIndex, 1);
12433
12637
  },
12434
12638
  onNodeRemoved: NOOP,
12435
- addIdentifiers(exp) {
12436
- if (isString(exp)) addId(exp);
12437
- else if (exp.identifiers) exp.identifiers.forEach(addId);
12438
- else if (exp.type === 4) addId(exp.content);
12639
+ addIdentifiers(exp, type = "local") {
12640
+ if (isString(exp)) addId(exp, type);
12641
+ else if (exp.identifiers) exp.identifiers.forEach((id) => addId(id, type));
12642
+ else if (exp.type === 4) addId(exp.content, type);
12439
12643
  },
12440
12644
  removeIdentifiers(exp) {
12441
12645
  if (isString(exp)) removeId(exp);
12442
12646
  else if (exp.identifiers) exp.identifiers.forEach(removeId);
12443
12647
  else if (exp.type === 4) removeId(exp.content);
12444
12648
  },
12649
+ isSlotScopeIdentifier(name) {
12650
+ const scopes = context.identifierScopes[name];
12651
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
12652
+ },
12445
12653
  hoist(exp) {
12446
12654
  if (isString(exp)) exp = createSimpleExpression(exp);
12447
12655
  context.hoists.push(exp);
@@ -12456,13 +12664,16 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12456
12664
  }
12457
12665
  };
12458
12666
  context.filters = /* @__PURE__ */ new Set();
12459
- function addId(id) {
12460
- const { identifiers } = context;
12667
+ function addId(id, type) {
12668
+ const { identifiers, identifierScopes } = context;
12461
12669
  if (identifiers[id] === void 0) identifiers[id] = 0;
12462
12670
  identifiers[id]++;
12671
+ (identifierScopes[id] || (identifierScopes[id] = [])).push(type);
12463
12672
  }
12464
12673
  function removeId(id) {
12465
12674
  context.identifiers[id]--;
12675
+ const scopes = context.identifierScopes[id];
12676
+ if (scopes) scopes.pop();
12466
12677
  }
12467
12678
  return context;
12468
12679
  }
@@ -12884,6 +13095,7 @@ function genNode(node, context) {
12884
13095
  case 26:
12885
13096
  genReturnStatement(node, context);
12886
13097
  break;
13098
+ /* v8 ignore start */
12887
13099
  case 10: break;
12888
13100
  default:
12889
13101
  }
@@ -13133,7 +13345,7 @@ const transformExpression = (node, context) => {
13133
13345
  if (dir.type === 7 && dir.name !== "for") {
13134
13346
  const exp = dir.exp;
13135
13347
  const arg = dir.arg;
13136
- 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");
13348
+ 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");
13137
13349
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
13138
13350
  }
13139
13351
  }
@@ -13384,11 +13596,11 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
13384
13596
  const keyProp = findProp(node, `key`, false, true);
13385
13597
  const isDirKey = keyProp && keyProp.type === 7;
13386
13598
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
13387
- if (memo && keyExp && isDirKey) keyProp.exp = keyExp = processExpression(keyExp, context);
13388
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
13389
- if (isTemplate) {
13390
- if (memo) memo.exp = processExpression(memo.exp, context);
13391
- if (keyProperty && keyProp.type !== 6) keyProperty.value = processExpression(keyProperty.value, context);
13599
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
13600
+ if (isTemplate && memo) memo.exp = processExpression(memo.exp, context);
13601
+ if ((isTemplate || memo) && keyProperty && isDirKey) {
13602
+ keyExp = keyProp.exp = keyProperty.value = processExpression(keyProperty.value, context);
13603
+ if (memo) context.vForMemoKeyedNodes.add(node);
13392
13604
  }
13393
13605
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
13394
13606
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
@@ -13519,7 +13731,7 @@ const trackSlotScopes = (node, context) => {
13519
13731
  const vSlot = findDir(node, "slot");
13520
13732
  if (vSlot) {
13521
13733
  const slotProps = vSlot.exp;
13522
- if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps);
13734
+ if (context.prefixIdentifiers) slotProps && context.addIdentifiers(slotProps, "slot");
13523
13735
  context.scopes.vSlot++;
13524
13736
  return () => {
13525
13737
  if (context.prefixIdentifiers) slotProps && context.removeIdentifiers(slotProps);
@@ -13735,6 +13947,15 @@ function resolveComponentType(node, context, ssr = false) {
13735
13947
  if (!ssr) context.helper(builtIn);
13736
13948
  return builtIn;
13737
13949
  }
13950
+ {
13951
+ const fromScope = resolveSlotScopeReference(tag, context);
13952
+ if (fromScope) return fromScope;
13953
+ const dotIndex = tag.indexOf(".");
13954
+ if (dotIndex > 0) {
13955
+ const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
13956
+ if (ns) return ns + tag.slice(dotIndex);
13957
+ }
13958
+ }
13738
13959
  {
13739
13960
  const fromSetup = resolveSetupReference(tag, context);
13740
13961
  if (fromSetup) return fromSetup;
@@ -13753,6 +13974,14 @@ function resolveComponentType(node, context, ssr = false) {
13753
13974
  context.components.add(tag);
13754
13975
  return toValidAssetId(tag, `component`);
13755
13976
  }
13977
+ function resolveSlotScopeReference(name, context) {
13978
+ const camelName = camelize(name);
13979
+ const PascalName = capitalize(camelName);
13980
+ const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
13981
+ if (isInSlotScope(name)) return name;
13982
+ if (isInSlotScope(camelName)) return camelName;
13983
+ if (isInSlotScope(PascalName)) return PascalName;
13984
+ }
13756
13985
  function resolveSetupReference(name, context) {
13757
13986
  const bindings = context.bindingMetadata;
13758
13987
  if (!bindings || bindings.__isScriptSetup === false) return;
@@ -14270,7 +14499,7 @@ function rewriteFilter(node, context) {
14270
14499
  const child = node.children[i];
14271
14500
  if (typeof child !== "object") continue;
14272
14501
  if (child.type === 4) parseFilter(child, context);
14273
- else if (child.type === 8) rewriteFilter(node, context);
14502
+ else if (child.type === 8) rewriteFilter(child, context);
14274
14503
  else if (child.type === 5) rewriteFilter(child.content, context);
14275
14504
  }
14276
14505
  }
@@ -14609,6 +14838,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
14609
14838
  const eventOptionModifiers = [];
14610
14839
  for (let i = 0; i < modifiers.length; i++) {
14611
14840
  const modifier = modifiers[i].content;
14841
+ if (modifier === "delegate") {
14842
+ if (context) {
14843
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
14844
+ error.loc = modifiers[i].loc;
14845
+ context.onWarn(error);
14846
+ }
14847
+ continue;
14848
+ }
14612
14849
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
14613
14850
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
14614
14851
  else {