@vue/compat 3.6.0-rc.2 → 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.2
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
  **/
@@ -318,7 +318,7 @@ const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
318
318
  /**
319
319
  * The full list is needed during SSR to produce the correct initial markup.
320
320
  */
321
- const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
321
+ const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
322
322
  /**
323
323
  * Boolean attributes should be included if the value is truthy or ''.
324
324
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
@@ -2600,7 +2600,7 @@ function queueFlush() {
2600
2600
  function queuePostFlushCb(jobs, id = Infinity) {
2601
2601
  if (!isArray(jobs)) if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
2602
2602
  else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
2603
- else for (const job of jobs) queueJobWorker(job, id, postJobs, postJobs.length, 0);
2603
+ else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
2604
2604
  queueFlush();
2605
2605
  }
2606
2606
  function flushPreFlushCbs(instance, seen) {
@@ -2621,7 +2621,7 @@ function flushPreFlushCbs(instance, seen) {
2621
2621
  function flushPostFlushCbs(seen) {
2622
2622
  if (postJobs.length) {
2623
2623
  if (activePostJobs) {
2624
- activePostJobs.push(...postJobs);
2624
+ for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
2625
2625
  postJobs.length = 0;
2626
2626
  return;
2627
2627
  }
@@ -3785,49 +3785,16 @@ const BaseTransitionImpl = {
3785
3785
  setup(props, { slots }) {
3786
3786
  const instance = getCurrentInstance();
3787
3787
  const state = useTransitionState();
3788
+ let resumeAfterLeave;
3788
3789
  return () => {
3789
- const children = slots.default && getTransitionRawChildren(slots.default(), true);
3790
- const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3790
+ const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
3791
3791
  if (!child) return;
3792
3792
  const rawProps = /* @__PURE__ */ toRaw(props);
3793
3793
  const { mode } = rawProps;
3794
3794
  checkTransitionMode(mode);
3795
- if (state.isLeaving) return emptyPlaceholder(child);
3796
- const innerChild = getInnerChild$1(child);
3797
- if (!innerChild) return emptyPlaceholder(child);
3798
- let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
3799
- if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
3800
- let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3801
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3802
- let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
3803
- setTransitionHooks(oldInnerChild, leavingHooks);
3804
- if (mode === "out-in" && innerChild.type !== Comment) {
3805
- state.isLeaving = true;
3806
- leavingHooks.afterLeave = () => {
3807
- state.isLeaving = false;
3808
- if (!(instance.job.flags & 4)) instance.update();
3809
- delete leavingHooks.afterLeave;
3810
- oldInnerChild = void 0;
3811
- };
3812
- return emptyPlaceholder(child);
3813
- } else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3814
- const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
3815
- leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
3816
- el[leaveCbKey] = () => {
3817
- earlyRemove();
3818
- el[leaveCbKey] = void 0;
3819
- delete enterHooks.delayedLeave;
3820
- oldInnerChild = void 0;
3821
- };
3822
- enterHooks.delayedLeave = () => {
3823
- delayedLeave();
3824
- delete enterHooks.delayedLeave;
3825
- oldInnerChild = void 0;
3826
- };
3827
- };
3828
- else oldInnerChild = void 0;
3829
- } else if (oldInnerChild) oldInnerChild = void 0;
3830
- return child;
3795
+ return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
3796
+ if (!(instance.job.flags & 4)) instance.update();
3797
+ }) : NOOP);
3831
3798
  };
3832
3799
  }
3833
3800
  };
@@ -3970,15 +3937,91 @@ function getInnerChild$1(vnode) {
3970
3937
  if (shapeFlag & 32 && isFunction(children.default)) return children.default();
3971
3938
  }
3972
3939
  }
3940
+ function resolveTransitionChild(children, renderEmpty = false) {
3941
+ const branches = children && getTransitionRawChildren(children, true);
3942
+ return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
3943
+ }
3944
+ /**
3945
+ * @internal
3946
+ */
3947
+ function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
3948
+ if (state.isLeaving) return emptyPlaceholder(next);
3949
+ const nextInner = getInnerChild$1(next);
3950
+ if (!nextInner) return emptyPlaceholder(next);
3951
+ let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
3952
+ if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
3953
+ enterHooks = hooks;
3954
+ });
3955
+ if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
3956
+ if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
3957
+ const mode = props.mode;
3958
+ const previousInner = previous && getInnerChild$1(previous);
3959
+ if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
3960
+ const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
3961
+ 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);
3962
+ }
3963
+ return next;
3964
+ }
3965
+ function forwardDelayedLeave(hooks, source) {
3966
+ const delayedLeave = source && source.delayedLeave;
3967
+ if (!delayedLeave) return;
3968
+ hooks.delayedLeave = () => {
3969
+ if (source.delayedLeave === delayedLeave) delayedLeave();
3970
+ delete hooks.delayedLeave;
3971
+ };
3972
+ }
3973
+ function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
3974
+ return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
3975
+ }
3976
+ function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
3977
+ if (props.mode === "out-in") {
3978
+ state.isLeaving = true;
3979
+ leavingHooks.afterLeave = () => {
3980
+ state.isLeaving = false;
3981
+ resumeAfterLeave();
3982
+ delete leavingHooks.afterLeave;
3983
+ };
3984
+ return true;
3985
+ } else if (props.mode === "in-out" && getEnterHooks) {
3986
+ let delayedLeavingVNode = leavingVNode;
3987
+ leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
3988
+ const enterHooks = getEnterHooks();
3989
+ if (!enterHooks) {
3990
+ delayedLeave();
3991
+ return;
3992
+ }
3993
+ const vnode = delayedLeavingVNode;
3994
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3995
+ leavingVNodesCache[String(vnode.key)] = vnode;
3996
+ el[leaveCbKey] = () => {
3997
+ earlyRemove();
3998
+ el[leaveCbKey] = void 0;
3999
+ delete enterHooks.delayedLeave;
4000
+ delayedLeavingVNode = void 0;
4001
+ };
4002
+ enterHooks.delayedLeave = () => {
4003
+ delayedLeave();
4004
+ delete enterHooks.delayedLeave;
4005
+ delayedLeavingVNode = void 0;
4006
+ };
4007
+ };
4008
+ }
4009
+ return false;
4010
+ }
3973
4011
  function setTransitionHooks(vnode, hooks) {
3974
4012
  if (vnode.shapeFlag & 6 && vnode.component) {
3975
4013
  vnode.transition = hooks;
3976
4014
  if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
3977
- else setTransitionHooks(vnode.component.subTree, hooks);
4015
+ else {
4016
+ const subTree = vnode.component.subTree;
4017
+ return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
4018
+ }
3978
4019
  } else if (vnode.shapeFlag & 128) {
3979
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3980
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4020
+ const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4021
+ const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
4022
+ return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
3981
4023
  } else vnode.transition = hooks;
4024
+ return hooks;
3982
4025
  }
3983
4026
  function getTransitionRawChildren(children, keepComment = false, parentKey) {
3984
4027
  let ret = [];
@@ -4330,7 +4373,10 @@ function createHydrationFunctions(rendererInternals) {
4330
4373
  const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
4331
4374
  for (const key in props) {
4332
4375
  if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
4333
- 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);
4376
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4377
+ if (isUnchangedResourceProp(el, key, props[key])) continue;
4378
+ patchProp(el, key, null, props[key], namespace, parentComponent);
4379
+ }
4334
4380
  }
4335
4381
  }
4336
4382
  let vnodeHooks;
@@ -4439,6 +4485,16 @@ const isTemplateNode$1 = (node) => {
4439
4485
  /**
4440
4486
  * Dev only
4441
4487
  */
4488
+ const resourceProps = /* @__PURE__ */ new Set([
4489
+ "src",
4490
+ "srcset",
4491
+ "href",
4492
+ "poster"
4493
+ ]);
4494
+ function isUnchangedResourceProp(el, key, clientValue) {
4495
+ if (!resourceProps.has(key)) return false;
4496
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4497
+ }
4442
4498
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4443
4499
  let mismatchType;
4444
4500
  let mismatchKey;
@@ -4479,7 +4535,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4479
4535
  function getAttributeMismatch(el, key, clientValue) {
4480
4536
  let actual;
4481
4537
  let expected;
4482
- if (isBooleanAttr(key)) {
4538
+ if (key === "hidden") {
4539
+ actual = normalizeHiddenValue(el.getAttribute(key));
4540
+ expected = normalizeHiddenValue(clientValue);
4541
+ } else if (isBooleanAttr(key)) {
4483
4542
  actual = el.hasAttribute(key);
4484
4543
  expected = includeBooleanAttr(clientValue);
4485
4544
  } else if (clientValue == null) {
@@ -4507,6 +4566,11 @@ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
4507
4566
  }
4508
4567
  return false;
4509
4568
  }
4569
+ function normalizeHiddenValue(value) {
4570
+ if (!isRenderableAttrValue(value)) return false;
4571
+ if (isString(value)) return value.toLowerCase() === "until-found" ? "until-found" : "";
4572
+ return includeBooleanAttr(value) ? "" : false;
4573
+ }
4510
4574
  function toClassSet(str) {
4511
4575
  return new Set(str.trim().split(/\s+/));
4512
4576
  }
@@ -5382,7 +5446,8 @@ function createSlots(slots, dynamicSlots) {
5382
5446
  * Compiler runtime helper for rendering `<slot/>`
5383
5447
  * @private
5384
5448
  */
5385
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5449
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5450
+ if (props == null) props = {};
5386
5451
  let slot = slots[name];
5387
5452
  if (fallback) fallback.__vdom = true;
5388
5453
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
@@ -6338,7 +6403,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6338
6403
  if (options.el) return vm.$mount(options.el);
6339
6404
  else return vm;
6340
6405
  }
6341
- Vue.version = `2.6.14-compat:3.6.0-rc.2`;
6406
+ Vue.version = `2.6.14-compat:3.6.0-rc.3`;
6342
6407
  Vue.config = singletonApp.config;
6343
6408
  Vue.use = (plugin, ...options) => {
6344
6409
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7036,8 +7101,9 @@ function renderComponentRoot(instance) {
7036
7101
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7037
7102
  }
7038
7103
  if (vnode.transition) {
7039
- if (!isElementRoot(root)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7040
- setTransitionHooks(root, vnode.transition);
7104
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7105
+ if (!isElementRoot(child)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
7106
+ setTransitionHooks(child, vnode.transition);
7041
7107
  }
7042
7108
  if (setRoot) setRoot(root);
7043
7109
  else result = root;
@@ -7097,9 +7163,10 @@ function filterSingleRoot(children, recurse = true) {
7097
7163
  }
7098
7164
  return singleRoot;
7099
7165
  }
7166
+ const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
7100
7167
  const getFunctionalFallthrough = (attrs) => {
7101
7168
  let res;
7102
- for (const key in attrs) if (key === "class" || key === "style" || isOn(key)) (res || (res = {}))[key] = attrs[key];
7169
+ for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
7103
7170
  return res;
7104
7171
  };
7105
7172
  const filterModelListeners = (attrs, props) => {
@@ -8629,6 +8696,10 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8629
8696
  suspense.activeBranch = pendingBranch;
8630
8697
  } else unmount(pendingBranch, parentComponent, suspense);
8631
8698
  suspense.deps = 0;
8699
+ for (let i = 0; i < suspense.effects.length; i++) {
8700
+ const effect = suspense.effects[i];
8701
+ if (effect.flags & 8) queuePostFlushCb(effect);
8702
+ }
8632
8703
  suspense.effects.length = 0;
8633
8704
  suspense.hiddenContainer = createElement("div");
8634
8705
  if (isInFallback) {
@@ -8736,7 +8807,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8736
8807
  let hasUnresolvedAncestor = false;
8737
8808
  while (parent) {
8738
8809
  if (parent.pendingBranch) {
8739
- parent.effects.push(...effects);
8810
+ for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
8740
8811
  hasUnresolvedAncestor = true;
8741
8812
  break;
8742
8813
  }
@@ -9046,11 +9117,26 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
9046
9117
  if (shapeFlag & 128) type.normalize(vnode);
9047
9118
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
9048
9119
  if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
9120
+ if (props && vnode.shapeFlag & 1) {
9121
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
9122
+ if (overwritingProp && hasContentChildren(vnode.children)) warn$1(`The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`);
9123
+ }
9049
9124
  if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
9050
9125
  convertLegacyVModelProps(vnode);
9051
9126
  defineLegacyVNodeProperties(vnode);
9052
9127
  return vnode;
9053
9128
  }
9129
+ /**
9130
+ * dev only
9131
+ * Whether children would actually render something. Empty text and empty
9132
+ * arrays are ignored, mirroring the compiler's `node.children.length` check
9133
+ * for `v-html` / `v-text`.
9134
+ */
9135
+ function hasContentChildren(children) {
9136
+ if (isString(children)) return children !== "";
9137
+ if (isArray(children)) return children.length > 0;
9138
+ return false;
9139
+ }
9054
9140
  const createVNode = createVNodeWithArgsTransform;
9055
9141
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
9056
9142
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -9441,7 +9527,12 @@ function setupStatefulComponent(instance, isSSR) {
9441
9527
  };
9442
9528
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9443
9529
  if (isSSR) return setupResult.then((resolvedResult) => {
9444
- handleSetupResult(instance, resolvedResult, isSSR);
9530
+ setInSSRSetupState(true);
9531
+ try {
9532
+ handleSetupResult(instance, resolvedResult, isSSR);
9533
+ } finally {
9534
+ setInSSRSetupState(false);
9535
+ }
9445
9536
  }).catch((e) => {
9446
9537
  handleError(e, instance, 0);
9447
9538
  });
@@ -9816,7 +9907,7 @@ function isMemoSame(cached, memo) {
9816
9907
  }
9817
9908
  //#endregion
9818
9909
  //#region packages/runtime-core/src/index.ts
9819
- const version = "3.6.0-rc.2";
9910
+ const version = "3.6.0-rc.3";
9820
9911
  const warn = warn$1;
9821
9912
  /**
9822
9913
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10587,7 +10678,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10587
10678
  if (!this._instance) if (this._resolved) this._mountComponent(this._def);
10588
10679
  else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
10589
10680
  this._pendingResolve = void 0;
10590
- this._resolveDef();
10681
+ if (this.isConnected) return this._resolveDef();
10591
10682
  });
10592
10683
  else this._resolveDef();
10593
10684
  }
@@ -10623,7 +10714,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10623
10714
  * resolve inner component definition (handle possible async component)
10624
10715
  */
10625
10716
  _resolveDef() {
10626
- if (this._pendingResolve) return;
10717
+ if (this._pendingResolve) return this._pendingResolve;
10627
10718
  for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
10628
10719
  this._ob = new MutationObserver(this._processMutations.bind(this));
10629
10720
  this._ob.observe(this, { attributes: true });
@@ -10653,6 +10744,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
10653
10744
  this._def = def;
10654
10745
  resolve(def);
10655
10746
  });
10747
+ return this._pendingResolve;
10656
10748
  } else resolve(this._def);
10657
10749
  }
10658
10750
  _mountComponent(def) {
@@ -10691,14 +10783,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
10691
10783
  const { props } = def;
10692
10784
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
10693
10785
  for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
10694
- for (const key of declaredPropKeys.map(camelize)) Object.defineProperty(this, key, {
10695
- get() {
10696
- return this._getProp(key);
10697
- },
10698
- set(val) {
10699
- this._setProp(key, val, true, !this._patching);
10700
- }
10701
- });
10786
+ for (const key of declaredPropKeys.map(camelize)) {
10787
+ if (key in Object.getPrototypeOf(this)) warn(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
10788
+ Object.defineProperty(this, key, {
10789
+ get() {
10790
+ return this._getProp(key);
10791
+ },
10792
+ set(val) {
10793
+ this._setProp(key, val, true, !this._patching);
10794
+ }
10795
+ });
10796
+ }
10702
10797
  }
10703
10798
  _setAttr(key) {
10704
10799
  if (key.startsWith("data-v-")) return;
@@ -11116,13 +11211,22 @@ function onCompositionEnd(e) {
11116
11211
  }
11117
11212
  }
11118
11213
  const assignKey = Symbol("_assign");
11214
+ const initialValueKey = Symbol("_initialValue");
11119
11215
  const vModelText = {
11120
11216
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11217
+ if (el.parentNode) {
11218
+ if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
11219
+ else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
11220
+ }
11121
11221
  el[assignKey] = getModelAssigner(vnode);
11122
11222
  vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
11123
11223
  },
11124
- mounted(el, { value }) {
11125
- el.value = value == null ? "" : value;
11224
+ mounted(el, { value, modifiers: { trim, number } }) {
11225
+ const newValue = value == null ? "" : value;
11226
+ const initialValue = el[initialValueKey];
11227
+ delete el[initialValueKey];
11228
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
11229
+ else el.value = newValue;
11126
11230
  },
11127
11231
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
11128
11232
  el[assignKey] = getModelAssigner(vnode);
@@ -14580,15 +14684,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
14580
14684
  else {
14581
14685
  childBlock = children[0].codegenNode;
14582
14686
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
14583
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
14687
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
14688
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
14584
14689
  removeHelper(OPEN_BLOCK);
14585
14690
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14586
14691
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14587
- childBlock.isBlock = !isStableFragment;
14692
+ childBlock.isBlock = shouldUseBlock;
14588
14693
  if (childBlock.isBlock) {
14589
14694
  helper(OPEN_BLOCK);
14590
14695
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
14591
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14696
+ } else {
14697
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
14698
+ if (childBlock.needsPatch) {
14699
+ var _childBlock$patchFlag;
14700
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
14701
+ }
14702
+ }
14592
14703
  }
14593
14704
  if (memo) {
14594
14705
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -14812,12 +14923,16 @@ const transformElement = (node, context) => {
14812
14923
  let vnodeDynamicProps;
14813
14924
  let dynamicPropNames;
14814
14925
  let vnodeDirectives;
14926
+ let needsPatch = false;
14927
+ let isBlockRequired = false;
14815
14928
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
14816
14929
  if (props.length > 0) {
14817
14930
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
14818
14931
  vnodeProps = propsBuildResult.props;
14819
14932
  patchFlag = propsBuildResult.patchFlag;
14820
14933
  dynamicPropNames = propsBuildResult.dynamicPropNames;
14934
+ needsPatch = propsBuildResult.needsPatch;
14935
+ isBlockRequired = propsBuildResult.isBlockRequired;
14821
14936
  const directives = propsBuildResult.directives;
14822
14937
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
14823
14938
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -14846,7 +14961,10 @@ const transformElement = (node, context) => {
14846
14961
  } else vnodeChildren = node.children;
14847
14962
  }
14848
14963
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
14849
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14964
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
14965
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
14966
+ if (needsPatch) vnodeCall.needsPatch = true;
14967
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
14850
14968
  };
14851
14969
  };
14852
14970
  function resolveComponentType(node, context, ssr = false) {
@@ -14880,6 +14998,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14880
14998
  const runtimeDirectives = [];
14881
14999
  const hasChildren = children.length > 0;
14882
15000
  let shouldUseBlock = false;
15001
+ let isBlockRequired = false;
14883
15002
  let patchFlag = 0;
14884
15003
  let hasRef = false;
14885
15004
  let hasClassBinding = false;
@@ -14904,12 +15023,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14904
15023
  const isEventHandler = isOn(name);
14905
15024
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
14906
15025
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
15026
+ if (name === "ref") hasRef = true;
14907
15027
  if (isEventHandler && value.type === 14) value = value.arguments[0];
14908
15028
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
14909
- if (name === "ref") hasRef = true;
14910
- else if (name === "class") hasClassBinding = true;
15029
+ if (name === "class") hasClassBinding = true;
14911
15030
  else if (name === "style") hasStyleBinding = true;
14912
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
15031
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14913
15032
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
14914
15033
  } else hasDynamicKeys = true;
14915
15034
  };
@@ -14935,7 +15054,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14935
15054
  if (name === "once" || name === "memo") continue;
14936
15055
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
14937
15056
  if (isVOn && ssr) continue;
14938
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
15057
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
15058
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
15059
+ shouldUseBlock = true;
15060
+ isBlockRequired = true;
15061
+ }
14939
15062
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
14940
15063
  if (!arg && (isVBind || isVOn)) {
14941
15064
  hasDynamicKeys = true;
@@ -14977,7 +15100,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14977
15100
  }
14978
15101
  } else if (!isBuiltInDirective(name)) {
14979
15102
  runtimeDirectives.push(prop);
14980
- if (hasChildren) shouldUseBlock = true;
15103
+ if (hasChildren) {
15104
+ shouldUseBlock = true;
15105
+ isBlockRequired = true;
15106
+ }
14981
15107
  }
14982
15108
  }
14983
15109
  }
@@ -14994,7 +15120,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14994
15120
  if (dynamicPropNames.length) patchFlag |= 8;
14995
15121
  if (hasHydrationEventBinding) patchFlag |= 32;
14996
15122
  }
14997
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
15123
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
15124
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
14998
15125
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
14999
15126
  case 15:
15000
15127
  let classKeyIndex = -1;
@@ -15024,7 +15151,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
15024
15151
  directives: runtimeDirectives,
15025
15152
  patchFlag,
15026
15153
  dynamicPropNames,
15027
- shouldUseBlock
15154
+ shouldUseBlock,
15155
+ needsPatch,
15156
+ isBlockRequired
15028
15157
  };
15029
15158
  }
15030
15159
  function dedupeProperties(properties) {