@vue/compat 3.6.0-rc.1 → 3.6.0-rc.3

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-rc.1
2
+ * @vue/compat v3.6.0-rc.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -255,7 +255,7 @@ const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
255
255
  /**
256
256
  * The full list is needed during SSR to produce the correct initial markup.
257
257
  */
258
- const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
258
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
259
259
  /**
260
260
  * Boolean attributes should be included if the value is truthy or ''.
261
261
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
@@ -2335,7 +2335,7 @@ function queueFlush() {
2335
2335
  function queuePostFlushCb(jobs, id = Infinity) {
2336
2336
  if (!isArray(jobs)) if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
2337
2337
  else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
2338
- else for (const job of jobs) queueJobWorker(job, id, postJobs, postJobs.length, 0);
2338
+ else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
2339
2339
  queueFlush();
2340
2340
  }
2341
2341
  function flushPreFlushCbs(instance, seen) {
@@ -2354,7 +2354,7 @@ function flushPreFlushCbs(instance, seen) {
2354
2354
  function flushPostFlushCbs(seen) {
2355
2355
  if (postJobs.length) {
2356
2356
  if (activePostJobs) {
2357
- activePostJobs.push(...postJobs);
2357
+ for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
2358
2358
  postJobs.length = 0;
2359
2359
  return;
2360
2360
  }
@@ -2815,7 +2815,7 @@ function instanceWatch(source, value, options) {
2815
2815
  }
2816
2816
  const prev = setCurrentInstance(this);
2817
2817
  const res = doWatch(getter, cb.bind(publicThis), options);
2818
- setCurrentInstance(...prev);
2818
+ restoreCurrentInstance(prev);
2819
2819
  return res;
2820
2820
  }
2821
2821
  function createPathGetter(ctx, path) {
@@ -3075,48 +3075,15 @@ const BaseTransitionImpl = {
3075
3075
  setup(props, { slots }) {
3076
3076
  const instance = getCurrentInstance();
3077
3077
  const state = useTransitionState();
3078
+ let resumeAfterLeave;
3078
3079
  return () => {
3079
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
3080
- const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3080
+ const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
3081
3081
  if (!child) return;
3082
3082
  const rawProps = /* @__PURE__ */ toRaw(props);
3083
3083
  const { mode } = rawProps;
3084
- if (state.isLeaving) return emptyPlaceholder(child);
3085
- const innerChild = getInnerChild$1(child);
3086
- if (!innerChild) return emptyPlaceholder(child);
3087
- let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
3088
- if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
3089
- let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3090
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3091
- let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
3092
- setTransitionHooks(oldInnerChild, leavingHooks);
3093
- if (mode === "out-in" && innerChild.type !== Comment) {
3094
- state.isLeaving = true;
3095
- leavingHooks.afterLeave = () => {
3096
- state.isLeaving = false;
3097
- if (!(instance.job.flags & 4)) instance.update();
3098
- delete leavingHooks.afterLeave;
3099
- oldInnerChild = void 0;
3100
- };
3101
- return emptyPlaceholder(child);
3102
- } else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3103
- const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
3104
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3105
- el[leaveCbKey] = () => {
3106
- earlyRemove();
3107
- el[leaveCbKey] = void 0;
3108
- delete enterHooks.delayedLeave;
3109
- oldInnerChild = void 0;
3110
- };
3111
- enterHooks.delayedLeave = () => {
3112
- delayedLeave();
3113
- delete enterHooks.delayedLeave;
3114
- oldInnerChild = void 0;
3115
- };
3116
- };
3117
- else oldInnerChild = void 0;
3118
- } else if (oldInnerChild) oldInnerChild = void 0;
3119
- return child;
3084
+ return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
3085
+ if (!(instance.job.flags & 4)) instance.update();
3086
+ }) : NOOP);
3120
3087
  };
3121
3088
  }
3122
3089
  };
@@ -3254,16 +3221,91 @@ function getInnerChild$1(vnode) {
3254
3221
  if (shapeFlag & 32 && isFunction(children.default)) return children.default();
3255
3222
  }
3256
3223
  }
3224
+ function resolveTransitionChild(children, renderEmpty = false) {
3225
+ const branches = children && getTransitionRawChildren(children, true);
3226
+ return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
3227
+ }
3228
+ /**
3229
+ * @internal
3230
+ */
3231
+ function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
3232
+ if (state.isLeaving) return emptyPlaceholder(next);
3233
+ const nextInner = getInnerChild$1(next);
3234
+ if (!nextInner) return emptyPlaceholder(next);
3235
+ let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
3236
+ if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
3237
+ enterHooks = hooks;
3238
+ });
3239
+ if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
3240
+ if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
3241
+ const mode = props.mode;
3242
+ const previousInner = previous && getInnerChild$1(previous);
3243
+ if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
3244
+ const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
3245
+ if (nextInner.type !== Comment && (mode === "out-in" || mode === "in-out") && applyTransitionModeSwitch(previousInner, leavingHooks, mode === "in-out" ? () => enterHooks : void 0, props, state, resumeAfterLeave)) return emptyPlaceholder(next);
3246
+ }
3247
+ return next;
3248
+ }
3249
+ function forwardDelayedLeave(hooks, source) {
3250
+ const delayedLeave = source && source.delayedLeave;
3251
+ if (!delayedLeave) return;
3252
+ hooks.delayedLeave = () => {
3253
+ if (source.delayedLeave === delayedLeave) delayedLeave();
3254
+ delete hooks.delayedLeave;
3255
+ };
3256
+ }
3257
+ function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
3258
+ return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
3259
+ }
3260
+ function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
3261
+ if (props.mode === "out-in") {
3262
+ state.isLeaving = true;
3263
+ leavingHooks.afterLeave = () => {
3264
+ state.isLeaving = false;
3265
+ resumeAfterLeave();
3266
+ delete leavingHooks.afterLeave;
3267
+ };
3268
+ return true;
3269
+ } else if (props.mode === "in-out" && getEnterHooks) {
3270
+ let delayedLeavingVNode = leavingVNode;
3271
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3272
+ const enterHooks = getEnterHooks();
3273
+ if (!enterHooks) {
3274
+ delayedLeave();
3275
+ return;
3276
+ }
3277
+ const vnode = delayedLeavingVNode;
3278
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3279
+ leavingVNodesCache[String(vnode.key)] = vnode;
3280
+ el[leaveCbKey] = () => {
3281
+ earlyRemove();
3282
+ el[leaveCbKey] = void 0;
3283
+ delete enterHooks.delayedLeave;
3284
+ delayedLeavingVNode = void 0;
3285
+ };
3286
+ enterHooks.delayedLeave = () => {
3287
+ delayedLeave();
3288
+ delete enterHooks.delayedLeave;
3289
+ delayedLeavingVNode = void 0;
3290
+ };
3291
+ };
3292
+ }
3293
+ return false;
3294
+ }
3257
3295
  function setTransitionHooks(vnode, hooks) {
3258
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3259
- else {
3296
+ if (vnode.shapeFlag & 6 && vnode.component) {
3260
3297
  vnode.transition = hooks;
3261
- setTransitionHooks(vnode.component.subTree, hooks);
3262
- }
3263
- else if (vnode.shapeFlag & 128) {
3264
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3265
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3298
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3299
+ else {
3300
+ const subTree = vnode.component.subTree;
3301
+ return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
3302
+ }
3303
+ } else if (vnode.shapeFlag & 128) {
3304
+ const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3305
+ const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
3306
+ return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
3266
3307
  } else vnode.transition = hooks;
3308
+ return hooks;
3267
3309
  }
3268
3310
  function getTransitionRawChildren(children, keepComment = false, parentKey) {
3269
3311
  let ret = [];
@@ -3586,7 +3628,10 @@ function createHydrationFunctions(rendererInternals) {
3586
3628
  if (forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
3587
3629
  const isCustomElement = el.tagName.includes("-");
3588
3630
  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);
3631
+ 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)) {
3632
+ if (isUnchangedResourceProp(el, key, props[key])) continue;
3633
+ patchProp(el, key, null, props[key], namespace, parentComponent);
3634
+ }
3590
3635
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
3591
3636
  else if (patchFlag & 4 && /* @__PURE__ */ isReactive(props.style)) for (const key in props.style) props.style[key];
3592
3637
  }
@@ -3687,6 +3732,19 @@ function createHydrationFunctions(rendererInternals) {
3687
3732
  const isTemplateNode$1 = (node) => {
3688
3733
  return node.nodeType === 1 && node.tagName === "TEMPLATE";
3689
3734
  };
3735
+ /**
3736
+ * Dev only
3737
+ */
3738
+ const resourceProps = /* @__PURE__ */ new Set([
3739
+ "src",
3740
+ "srcset",
3741
+ "href",
3742
+ "poster"
3743
+ ]);
3744
+ function isUnchangedResourceProp(el, key, clientValue) {
3745
+ if (!resourceProps.has(key)) return false;
3746
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
3747
+ }
3690
3748
  const allowMismatchAttr = "data-allow-mismatch";
3691
3749
  const MismatchTypeString = {
3692
3750
  [0]: "text",
@@ -4181,7 +4239,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4181
4239
  try {
4182
4240
  return callWithAsyncErrorHandling(hook, target, type, args);
4183
4241
  } finally {
4184
- setCurrentInstance(...prev);
4242
+ restoreCurrentInstance(prev);
4185
4243
  setActiveSub(prevSub);
4186
4244
  }
4187
4245
  });
@@ -4512,7 +4570,8 @@ function createSlots(slots, dynamicSlots) {
4512
4570
  * Compiler runtime helper for rendering `<slot/>`
4513
4571
  * @private
4514
4572
  */
4515
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
4573
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
4574
+ if (props == null) props = {};
4516
4575
  let slot = slots[name];
4517
4576
  if (fallback) fallback.__vdom = true;
4518
4577
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
@@ -5303,7 +5362,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5303
5362
  if (options.el) return vm.$mount(options.el);
5304
5363
  else return vm;
5305
5364
  }
5306
- Vue.version = `2.6.14-compat:3.6.0-rc.1`;
5365
+ Vue.version = `2.6.14-compat:3.6.0-rc.3`;
5307
5366
  Vue.config = singletonApp.config;
5308
5367
  Vue.use = (plugin, ...options) => {
5309
5368
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -5894,7 +5953,7 @@ function renderComponentRoot(instance) {
5894
5953
  root = cloneVNode(root, null, false, true);
5895
5954
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
5896
5955
  }
5897
- if (vnode.transition) setTransitionHooks(root, vnode.transition);
5956
+ if (vnode.transition) setTransitionHooks(isTeleport(root.type) ? getInnerChild$1(root) || root : root, vnode.transition);
5898
5957
  result = root;
5899
5958
  setCurrentRenderingInstance(prev);
5900
5959
  return result;
@@ -5910,9 +5969,10 @@ function filterSingleRoot(children, recurse = true) {
5910
5969
  }
5911
5970
  return singleRoot;
5912
5971
  }
5972
+ const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
5913
5973
  const getFunctionalFallthrough = (attrs) => {
5914
5974
  let res;
5915
- for (const key in attrs) if (key === "class" || key === "style" || isOn(key)) (res || (res = {}))[key] = attrs[key];
5975
+ for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
5916
5976
  return res;
5917
5977
  };
5918
5978
  const filterModelListeners = (attrs, props) => {
@@ -6131,7 +6191,7 @@ function baseResolveDefault(factory, instance, key) {
6131
6191
  const prev = setCurrentInstance(instance);
6132
6192
  const props = /* @__PURE__ */ toRaw(instance.props);
6133
6193
  value = factory.call(isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null, props);
6134
- setCurrentInstance(...prev);
6194
+ restoreCurrentInstance(prev);
6135
6195
  return value;
6136
6196
  }
6137
6197
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -6503,7 +6563,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6503
6563
  };
6504
6564
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6505
6565
  n2.slotScopeIds = slotScopeIds;
6506
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
6566
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
6507
6567
  else {
6508
6568
  const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
6509
6569
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
@@ -6821,7 +6881,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6821
6881
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
6822
6882
  const { el, type, transition, children, shapeFlag } = vnode;
6823
6883
  if (isVaporComponent(type) || type === VaporSlot) {
6824
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
6884
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
6825
6885
  return;
6826
6886
  }
6827
6887
  if (shapeFlag & 6) {
@@ -6877,7 +6937,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6877
6937
  }
6878
6938
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
6879
6939
  if (shapeFlag & 256) {
6880
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
6940
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
6881
6941
  else parentComponent.ctx.deactivate(vnode);
6882
6942
  return;
6883
6943
  }
@@ -6887,7 +6947,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6887
6947
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
6888
6948
  if (shapeFlag & 6) if (isVaporComponent(type)) {
6889
6949
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
6890
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6950
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
6891
6951
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
6892
6952
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6893
6953
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -6904,7 +6964,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6904
6964
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
6905
6965
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
6906
6966
  if (type === VaporSlot) {
6907
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
6967
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
6908
6968
  return;
6909
6969
  }
6910
6970
  if (doRemove) remove(vnode);
@@ -7189,6 +7249,10 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
7189
7249
  suspense.activeBranch = pendingBranch;
7190
7250
  } else unmount(pendingBranch, parentComponent, suspense);
7191
7251
  suspense.deps = 0;
7252
+ for (let i = 0; i < suspense.effects.length; i++) {
7253
+ const effect = suspense.effects[i];
7254
+ if (effect.flags & 8) queuePostFlushCb(effect);
7255
+ }
7192
7256
  suspense.effects.length = 0;
7193
7257
  suspense.hiddenContainer = createElement("div");
7194
7258
  if (isInFallback) {
@@ -7287,7 +7351,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7287
7351
  let hasUnresolvedAncestor = false;
7288
7352
  while (parent) {
7289
7353
  if (parent.pendingBranch) {
7290
- parent.effects.push(...effects);
7354
+ for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
7291
7355
  hasUnresolvedAncestor = true;
7292
7356
  break;
7293
7357
  }
@@ -7797,6 +7861,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
7797
7861
  simpleSetCurrentInstance(instance);
7798
7862
  }
7799
7863
  };
7864
+ /**
7865
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
7866
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
7867
+ * verbatim instead of re-triggering the `instance.scope` default.
7868
+ * @internal
7869
+ */
7870
+ const restoreCurrentInstance = (prev) => {
7871
+ setCurrentScope(prev[1]);
7872
+ simpleSetCurrentInstance(prev[0]);
7873
+ };
7800
7874
  const internalOptions = [
7801
7875
  "ce",
7802
7876
  "type",
@@ -7925,7 +7999,7 @@ function setupStatefulComponent(instance, isSSR) {
7925
7999
  const setupResult = callWithErrorHandling(setup, instance, 0, [instance.props, setupContext]);
7926
8000
  const isAsyncSetup = isPromise(setupResult);
7927
8001
  setActiveSub(prevSub);
7928
- setCurrentInstance(...prev);
8002
+ restoreCurrentInstance(prev);
7929
8003
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
7930
8004
  if (isAsyncSetup) {
7931
8005
  const unsetCurrentInstance = () => {
@@ -7933,7 +8007,12 @@ function setupStatefulComponent(instance, isSSR) {
7933
8007
  };
7934
8008
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7935
8009
  if (isSSR) return setupResult.then((resolvedResult) => {
7936
- handleSetupResult(instance, resolvedResult, isSSR);
8010
+ setInSSRSetupState(true);
8011
+ try {
8012
+ handleSetupResult(instance, resolvedResult, isSSR);
8013
+ } finally {
8014
+ setInSSRSetupState(false);
8015
+ }
7937
8016
  }).catch((e) => {
7938
8017
  handleError(e, instance, 0);
7939
8018
  });
@@ -7988,7 +8067,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7988
8067
  applyOptions(instance);
7989
8068
  } finally {
7990
8069
  setActiveSub(prevSub);
7991
- setCurrentInstance(...prevInstance);
8070
+ restoreCurrentInstance(prevInstance);
7992
8071
  }
7993
8072
  }
7994
8073
  }
@@ -8086,7 +8165,7 @@ function isMemoSame(cached, memo) {
8086
8165
  }
8087
8166
  //#endregion
8088
8167
  //#region packages/runtime-core/src/index.ts
8089
- const version = "3.6.0-rc.1";
8168
+ const version = "3.6.0-rc.3";
8090
8169
  const warn = NOOP;
8091
8170
  /**
8092
8171
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8782,7 +8861,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
8782
8861
  if (!this._instance) if (this._resolved) this._mountComponent(this._def);
8783
8862
  else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
8784
8863
  this._pendingResolve = void 0;
8785
- this._resolveDef();
8864
+ if (this.isConnected) return this._resolveDef();
8786
8865
  });
8787
8866
  else this._resolveDef();
8788
8867
  }
@@ -8818,7 +8897,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
8818
8897
  * resolve inner component definition (handle possible async component)
8819
8898
  */
8820
8899
  _resolveDef() {
8821
- if (this._pendingResolve) return;
8900
+ if (this._pendingResolve) return this._pendingResolve;
8822
8901
  for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
8823
8902
  this._ob = new MutationObserver(this._processMutations.bind(this));
8824
8903
  this._ob.observe(this, { attributes: true });
@@ -8847,6 +8926,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
8847
8926
  this._def = def;
8848
8927
  resolve(def);
8849
8928
  });
8929
+ return this._pendingResolve;
8850
8930
  } else resolve(this._def);
8851
8931
  }
8852
8932
  _mountComponent(def) {
@@ -9267,13 +9347,22 @@ function onCompositionEnd(e) {
9267
9347
  }
9268
9348
  }
9269
9349
  const assignKey = Symbol("_assign");
9350
+ const initialValueKey = Symbol("_initialValue");
9270
9351
  const vModelText = {
9271
9352
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
9353
+ if (el.parentNode) {
9354
+ if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
9355
+ else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
9356
+ }
9272
9357
  el[assignKey] = getModelAssigner(vnode);
9273
9358
  vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
9274
9359
  },
9275
- mounted(el, { value }) {
9276
- el.value = value == null ? "" : value;
9360
+ mounted(el, { value, modifiers: { trim, number } }) {
9361
+ const newValue = value == null ? "" : value;
9362
+ const initialValue = el[initialValueKey];
9363
+ delete el[initialValueKey];
9364
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
9365
+ else el.value = newValue;
9277
9366
  },
9278
9367
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
9279
9368
  el[assignKey] = getModelAssigner(vnode);
@@ -12546,7 +12635,7 @@ function getSelfName(filename) {
12546
12635
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
12547
12636
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
12548
12637
  }
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 }) {
12638
+ 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 }) {
12550
12639
  const context = {
12551
12640
  filename,
12552
12641
  selfName: getSelfName(filename),
@@ -12568,7 +12657,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12568
12657
  bindingMetadata,
12569
12658
  inline,
12570
12659
  isTS,
12571
- eventDelegation,
12572
12660
  onError,
12573
12661
  onWarn,
12574
12662
  compatConfig,
@@ -13618,15 +13706,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
13618
13706
  else {
13619
13707
  childBlock = children[0].codegenNode;
13620
13708
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
13621
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
13709
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
13710
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
13622
13711
  removeHelper(OPEN_BLOCK);
13623
13712
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
13624
13713
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
13625
- childBlock.isBlock = !isStableFragment;
13714
+ childBlock.isBlock = shouldUseBlock;
13626
13715
  if (childBlock.isBlock) {
13627
13716
  helper(OPEN_BLOCK);
13628
13717
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
13629
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
13718
+ } else {
13719
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
13720
+ if (childBlock.needsPatch) {
13721
+ var _childBlock$patchFlag;
13722
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
13723
+ }
13724
+ }
13630
13725
  }
13631
13726
  if (memo) {
13632
13727
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -13884,12 +13979,16 @@ const transformElement = (node, context) => {
13884
13979
  let vnodeDynamicProps;
13885
13980
  let dynamicPropNames;
13886
13981
  let vnodeDirectives;
13982
+ let needsPatch = false;
13983
+ let isBlockRequired = false;
13887
13984
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
13888
13985
  if (props.length > 0) {
13889
13986
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
13890
13987
  vnodeProps = propsBuildResult.props;
13891
13988
  patchFlag = propsBuildResult.patchFlag;
13892
13989
  dynamicPropNames = propsBuildResult.dynamicPropNames;
13990
+ needsPatch = propsBuildResult.needsPatch;
13991
+ isBlockRequired = propsBuildResult.isBlockRequired;
13893
13992
  const directives = propsBuildResult.directives;
13894
13993
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
13895
13994
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -13913,7 +14012,10 @@ const transformElement = (node, context) => {
13913
14012
  } else vnodeChildren = node.children;
13914
14013
  }
13915
14014
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
13916
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14015
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14016
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
14017
+ if (needsPatch) vnodeCall.needsPatch = true;
14018
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
13917
14019
  };
13918
14020
  };
13919
14021
  function resolveComponentType(node, context, ssr = false) {
@@ -13998,6 +14100,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
13998
14100
  const runtimeDirectives = [];
13999
14101
  const hasChildren = children.length > 0;
14000
14102
  let shouldUseBlock = false;
14103
+ let isBlockRequired = false;
14001
14104
  let patchFlag = 0;
14002
14105
  let hasRef = false;
14003
14106
  let hasClassBinding = false;
@@ -14022,12 +14125,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14022
14125
  const isEventHandler = isOn(name);
14023
14126
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
14024
14127
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
14128
+ if (name === "ref") hasRef = true;
14025
14129
  if (isEventHandler && value.type === 14) value = value.arguments[0];
14026
14130
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
14027
- if (name === "ref") hasRef = true;
14028
- else if (name === "class") hasClassBinding = true;
14131
+ if (name === "class") hasClassBinding = true;
14029
14132
  else if (name === "style") hasStyleBinding = true;
14030
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14133
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14031
14134
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14032
14135
  } else hasDynamicKeys = true;
14033
14136
  };
@@ -14060,7 +14163,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14060
14163
  if (name === "once" || name === "memo") continue;
14061
14164
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
14062
14165
  if (isVOn && ssr) continue;
14063
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
14166
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
14167
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
14168
+ shouldUseBlock = true;
14169
+ isBlockRequired = true;
14170
+ }
14064
14171
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
14065
14172
  if (!arg && (isVBind || isVOn)) {
14066
14173
  hasDynamicKeys = true;
@@ -14095,7 +14202,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14095
14202
  }
14096
14203
  } else if (!isBuiltInDirective(name)) {
14097
14204
  runtimeDirectives.push(prop);
14098
- if (hasChildren) shouldUseBlock = true;
14205
+ if (hasChildren) {
14206
+ shouldUseBlock = true;
14207
+ isBlockRequired = true;
14208
+ }
14099
14209
  }
14100
14210
  }
14101
14211
  }
@@ -14112,7 +14222,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14112
14222
  if (dynamicPropNames.length) patchFlag |= 8;
14113
14223
  if (hasHydrationEventBinding) patchFlag |= 32;
14114
14224
  }
14115
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
14225
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
14226
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
14116
14227
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
14117
14228
  case 15:
14118
14229
  let classKeyIndex = -1;
@@ -14142,7 +14253,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14142
14253
  directives: runtimeDirectives,
14143
14254
  patchFlag,
14144
14255
  dynamicPropNames,
14145
- shouldUseBlock
14256
+ shouldUseBlock,
14257
+ needsPatch,
14258
+ isBlockRequired
14146
14259
  };
14147
14260
  }
14148
14261
  function dedupeProperties(properties) {
@@ -14830,6 +14943,14 @@ const resolveModifiers = (key, modifiers, context, loc) => {
14830
14943
  const eventOptionModifiers = [];
14831
14944
  for (let i = 0; i < modifiers.length; i++) {
14832
14945
  const modifier = modifiers[i].content;
14946
+ if (modifier === "delegate") {
14947
+ if (context) {
14948
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
14949
+ error.loc = modifiers[i].loc;
14950
+ context.onWarn(error);
14951
+ }
14952
+ continue;
14953
+ }
14833
14954
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
14834
14955
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
14835
14956
  else {
@@ -15049,10 +15170,11 @@ function stringifyElement(node, context) {
15049
15170
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
15050
15171
  continue;
15051
15172
  }
15052
- if (isBooleanAttr(p.arg.content) && exp.content === "false") continue;
15173
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
15053
15174
  let evaluated = evaluateConstant(exp);
15054
15175
  if (evaluated != null) {
15055
15176
  const arg = p.arg && p.arg.content;
15177
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) continue;
15056
15178
  if (arg === "class") evaluated = normalizeClass(evaluated);
15057
15179
  else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
15058
15180
  res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;