@vue/compat 3.4.14 → 3.4.15

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.4.14
2
+ * @vue/compat v3.4.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -265,6 +265,13 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
265
265
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
266
266
  `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
267
267
  );
268
+ function isRenderableAttrValue(value) {
269
+ if (value == null) {
270
+ return false;
271
+ }
272
+ const type = typeof value;
273
+ return type === "string" || type === "number" || type === "boolean";
274
+ }
268
275
 
269
276
  function looseCompareArrays(a, b) {
270
277
  if (a.length !== b.length)
@@ -627,10 +634,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
627
634
  var _a;
628
635
  pauseScheduling();
629
636
  for (const effect2 of dep.keys()) {
630
- if (dep.get(effect2) !== effect2._trackId) {
631
- continue;
632
- }
633
- if (effect2._dirtyLevel < dirtyLevel && !(effect2._runnings && !effect2.allowRecurse)) {
637
+ if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
634
638
  const lastDirtyLevel = effect2._dirtyLevel;
635
639
  effect2._dirtyLevel = dirtyLevel;
636
640
  if (lastDirtyLevel === 0) {
@@ -641,12 +645,17 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
641
645
  effect2.trigger();
642
646
  }
643
647
  }
644
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
648
+ }
649
+ scheduleEffects(dep);
650
+ resetScheduling();
651
+ }
652
+ function scheduleEffects(dep) {
653
+ for (const effect2 of dep.keys()) {
654
+ if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
645
655
  effect2._shouldSchedule = false;
646
656
  queueEffectSchedulers.push(effect2.scheduler);
647
657
  }
648
658
  }
649
- resetScheduling();
650
659
  }
651
660
 
652
661
  const createDep = (cleanup, computed) => {
@@ -1329,7 +1338,8 @@ class ComputedRefImpl {
1329
1338
  this["__v_isReadonly"] = false;
1330
1339
  this.effect = new ReactiveEffect(
1331
1340
  () => getter(this._value),
1332
- () => triggerRefValue(this, 1)
1341
+ () => triggerRefValue(this, 1),
1342
+ () => this.dep && scheduleEffects(this.dep)
1333
1343
  );
1334
1344
  this.effect.computed = this;
1335
1345
  this.effect.active = this._cacheable = !isSSR;
@@ -1343,6 +1353,9 @@ class ComputedRefImpl {
1343
1353
  }
1344
1354
  }
1345
1355
  trackRefValue(self);
1356
+ if (self.effect._dirtyLevel >= 1) {
1357
+ triggerRefValue(self, 1);
1358
+ }
1346
1359
  return self._value;
1347
1360
  }
1348
1361
  set value(newValue) {
@@ -1768,7 +1781,7 @@ function handleError(err, instance, type, throwInDev = true) {
1768
1781
  if (instance) {
1769
1782
  let cur = instance.parent;
1770
1783
  const exposedInstance = instance.proxy;
1771
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/errors/#runtime-${type}`;
1784
+ const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
1772
1785
  while (cur) {
1773
1786
  const errorCapturedHooks = cur.ec;
1774
1787
  if (errorCapturedHooks) {
@@ -6526,7 +6539,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6526
6539
  return vm;
6527
6540
  }
6528
6541
  }
6529
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
6542
+ Vue.version = `2.6.14-compat:${"3.4.15"}`;
6530
6543
  Vue.config = singletonApp.config;
6531
6544
  Vue.use = (p, ...options) => {
6532
6545
  if (p && isFunction(p.install)) {
@@ -7598,7 +7611,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
7598
7611
  return rawSlot;
7599
7612
  }
7600
7613
  const normalized = withCtx((...args) => {
7601
- if (!!(process.env.NODE_ENV !== "production") && currentInstance) {
7614
+ if (!!(process.env.NODE_ENV !== "production") && currentInstance && (!ctx || ctx.root === currentInstance.root)) {
7602
7615
  warn$1(
7603
7616
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
7604
7617
  );
@@ -7736,9 +7749,10 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7736
7749
  } else {
7737
7750
  const _isString = isString(ref);
7738
7751
  const _isRef = isRef(ref);
7752
+ const isVFor = rawRef.f;
7739
7753
  if (_isString || _isRef) {
7740
7754
  const doSet = () => {
7741
- if (rawRef.f) {
7755
+ if (isVFor) {
7742
7756
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
7743
7757
  if (isUnmount) {
7744
7758
  isArray(existing) && remove(existing, refValue);
@@ -7771,11 +7785,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7771
7785
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
7772
7786
  }
7773
7787
  };
7774
- if (value) {
7788
+ if (isUnmount || isVFor) {
7789
+ doSet();
7790
+ } else {
7775
7791
  doSet.id = -1;
7776
7792
  queuePostRenderEffect(doSet, parentSuspense);
7777
- } else {
7778
- doSet();
7779
7793
  }
7780
7794
  } else if (!!(process.env.NODE_ENV !== "production")) {
7781
7795
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -8295,11 +8309,12 @@ function propHasMismatch(el, key, clientValue, vnode) {
8295
8309
  } else {
8296
8310
  if (el.hasAttribute(key)) {
8297
8311
  actual = el.getAttribute(key);
8312
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
8313
+ actual = el.value;
8298
8314
  } else {
8299
- const serverValue = el[key];
8300
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
8315
+ actual = false;
8301
8316
  }
8302
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
8317
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
8303
8318
  }
8304
8319
  if (actual !== expected) {
8305
8320
  mismatchType = `attribute`;
@@ -11425,7 +11440,7 @@ function isMemoSame(cached, memo) {
11425
11440
  return true;
11426
11441
  }
11427
11442
 
11428
- const version = "3.4.14";
11443
+ const version = "3.4.15";
11429
11444
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11430
11445
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11431
11446
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12799,35 +12814,52 @@ const vModelSelect = {
12799
12814
  el[assignKey](
12800
12815
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12801
12816
  );
12817
+ el._assigning = true;
12818
+ nextTick(() => {
12819
+ el._assigning = false;
12820
+ });
12802
12821
  });
12803
12822
  el[assignKey] = getModelAssigner(vnode);
12804
12823
  },
12805
12824
  // set value in mounted & updated because <select> relies on its children
12806
12825
  // <option>s.
12807
- mounted(el, { value }) {
12808
- setSelected(el, value);
12826
+ mounted(el, { value, oldValue, modifiers: { number } }) {
12827
+ setSelected(el, value, oldValue, number);
12809
12828
  },
12810
12829
  beforeUpdate(el, _binding, vnode) {
12811
12830
  el[assignKey] = getModelAssigner(vnode);
12812
12831
  },
12813
- updated(el, { value }) {
12814
- setSelected(el, value);
12832
+ updated(el, { value, oldValue, modifiers: { number } }) {
12833
+ if (!el._assigning) {
12834
+ setSelected(el, value, oldValue, number);
12835
+ }
12815
12836
  }
12816
12837
  };
12817
- function setSelected(el, value) {
12838
+ function setSelected(el, value, oldValue, number) {
12818
12839
  const isMultiple = el.multiple;
12819
- if (isMultiple && !isArray(value) && !isSet(value)) {
12840
+ const isArrayValue = isArray(value);
12841
+ if (isMultiple && !isArrayValue && !isSet(value)) {
12820
12842
  !!(process.env.NODE_ENV !== "production") && warn(
12821
12843
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12822
12844
  );
12823
12845
  return;
12824
12846
  }
12847
+ if (isArrayValue && looseEqual(value, oldValue)) {
12848
+ return;
12849
+ }
12825
12850
  for (let i = 0, l = el.options.length; i < l; i++) {
12826
12851
  const option = el.options[i];
12827
12852
  const optionValue = getValue(option);
12828
12853
  if (isMultiple) {
12829
- if (isArray(value)) {
12830
- option.selected = looseIndexOf(value, optionValue) > -1;
12854
+ if (isArrayValue) {
12855
+ const optionType = typeof optionValue;
12856
+ if (optionType === "string" || optionType === "number") {
12857
+ option.selected = value.includes(
12858
+ number ? looseToNumber(optionValue) : optionValue
12859
+ );
12860
+ } else {
12861
+ option.selected = looseIndexOf(value, optionValue) > -1;
12862
+ }
12831
12863
  } else {
12832
12864
  option.selected = value.has(optionValue);
12833
12865
  }
@@ -14449,7 +14481,7 @@ function defaultOnWarn(msg) {
14449
14481
  !!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
14450
14482
  }
14451
14483
  function createCompilerError(code, loc, messages, additionalMessage) {
14452
- const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : `https://vuejs.org/errors/#compiler-${code}`;
14484
+ const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : `https://vuejs.org/error-reference/#compiler-${code}`;
14453
14485
  const error = new SyntaxError(String(msg));
14454
14486
  error.code = code;
14455
14487
  error.loc = loc;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.14
2
+ * @vue/compat v3.4.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -268,6 +268,13 @@ var Vue = (function () {
268
268
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
269
269
  `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
270
270
  );
271
+ function isRenderableAttrValue(value) {
272
+ if (value == null) {
273
+ return false;
274
+ }
275
+ const type = typeof value;
276
+ return type === "string" || type === "number" || type === "boolean";
277
+ }
271
278
 
272
279
  function looseCompareArrays(a, b) {
273
280
  if (a.length !== b.length)
@@ -630,10 +637,7 @@ var Vue = (function () {
630
637
  var _a;
631
638
  pauseScheduling();
632
639
  for (const effect2 of dep.keys()) {
633
- if (dep.get(effect2) !== effect2._trackId) {
634
- continue;
635
- }
636
- if (effect2._dirtyLevel < dirtyLevel && !(effect2._runnings && !effect2.allowRecurse)) {
640
+ if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
637
641
  const lastDirtyLevel = effect2._dirtyLevel;
638
642
  effect2._dirtyLevel = dirtyLevel;
639
643
  if (lastDirtyLevel === 0) {
@@ -644,12 +648,17 @@ var Vue = (function () {
644
648
  effect2.trigger();
645
649
  }
646
650
  }
647
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
651
+ }
652
+ scheduleEffects(dep);
653
+ resetScheduling();
654
+ }
655
+ function scheduleEffects(dep) {
656
+ for (const effect2 of dep.keys()) {
657
+ if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
648
658
  effect2._shouldSchedule = false;
649
659
  queueEffectSchedulers.push(effect2.scheduler);
650
660
  }
651
661
  }
652
- resetScheduling();
653
662
  }
654
663
 
655
664
  const createDep = (cleanup, computed) => {
@@ -1332,7 +1341,8 @@ var Vue = (function () {
1332
1341
  this["__v_isReadonly"] = false;
1333
1342
  this.effect = new ReactiveEffect(
1334
1343
  () => getter(this._value),
1335
- () => triggerRefValue(this, 1)
1344
+ () => triggerRefValue(this, 1),
1345
+ () => this.dep && scheduleEffects(this.dep)
1336
1346
  );
1337
1347
  this.effect.computed = this;
1338
1348
  this.effect.active = this._cacheable = !isSSR;
@@ -1346,6 +1356,9 @@ var Vue = (function () {
1346
1356
  }
1347
1357
  }
1348
1358
  trackRefValue(self);
1359
+ if (self.effect._dirtyLevel >= 1) {
1360
+ triggerRefValue(self, 1);
1361
+ }
1349
1362
  return self._value;
1350
1363
  }
1351
1364
  set value(newValue) {
@@ -6485,7 +6498,7 @@ If this is a native custom element, make sure to exclude it from component resol
6485
6498
  return vm;
6486
6499
  }
6487
6500
  }
6488
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
6501
+ Vue.version = `2.6.14-compat:${"3.4.15"}`;
6489
6502
  Vue.config = singletonApp.config;
6490
6503
  Vue.use = (p, ...options) => {
6491
6504
  if (p && isFunction(p.install)) {
@@ -7554,7 +7567,7 @@ If you want to remount the same app, move your app creation logic into a factory
7554
7567
  return rawSlot;
7555
7568
  }
7556
7569
  const normalized = withCtx((...args) => {
7557
- if (currentInstance) {
7570
+ if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
7558
7571
  warn$1(
7559
7572
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
7560
7573
  );
@@ -7692,9 +7705,10 @@ If you want to remount the same app, move your app creation logic into a factory
7692
7705
  } else {
7693
7706
  const _isString = isString(ref);
7694
7707
  const _isRef = isRef(ref);
7708
+ const isVFor = rawRef.f;
7695
7709
  if (_isString || _isRef) {
7696
7710
  const doSet = () => {
7697
- if (rawRef.f) {
7711
+ if (isVFor) {
7698
7712
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
7699
7713
  if (isUnmount) {
7700
7714
  isArray(existing) && remove(existing, refValue);
@@ -7727,11 +7741,11 @@ If you want to remount the same app, move your app creation logic into a factory
7727
7741
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
7728
7742
  }
7729
7743
  };
7730
- if (value) {
7744
+ if (isUnmount || isVFor) {
7745
+ doSet();
7746
+ } else {
7731
7747
  doSet.id = -1;
7732
7748
  queuePostRenderEffect(doSet, parentSuspense);
7733
- } else {
7734
- doSet();
7735
7749
  }
7736
7750
  } else {
7737
7751
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -8241,11 +8255,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8241
8255
  } else {
8242
8256
  if (el.hasAttribute(key)) {
8243
8257
  actual = el.getAttribute(key);
8258
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
8259
+ actual = el.value;
8244
8260
  } else {
8245
- const serverValue = el[key];
8246
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
8261
+ actual = false;
8247
8262
  }
8248
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
8263
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
8249
8264
  }
8250
8265
  if (actual !== expected) {
8251
8266
  mismatchType = `attribute`;
@@ -11300,7 +11315,7 @@ Component that was made reactive: `,
11300
11315
  return true;
11301
11316
  }
11302
11317
 
11303
- const version = "3.4.14";
11318
+ const version = "3.4.15";
11304
11319
  const warn = warn$1 ;
11305
11320
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11306
11321
  const devtools = devtools$1 ;
@@ -12647,35 +12662,52 @@ Component that was made reactive: `,
12647
12662
  el[assignKey](
12648
12663
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12649
12664
  );
12665
+ el._assigning = true;
12666
+ nextTick(() => {
12667
+ el._assigning = false;
12668
+ });
12650
12669
  });
12651
12670
  el[assignKey] = getModelAssigner(vnode);
12652
12671
  },
12653
12672
  // set value in mounted & updated because <select> relies on its children
12654
12673
  // <option>s.
12655
- mounted(el, { value }) {
12656
- setSelected(el, value);
12674
+ mounted(el, { value, oldValue, modifiers: { number } }) {
12675
+ setSelected(el, value, oldValue, number);
12657
12676
  },
12658
12677
  beforeUpdate(el, _binding, vnode) {
12659
12678
  el[assignKey] = getModelAssigner(vnode);
12660
12679
  },
12661
- updated(el, { value }) {
12662
- setSelected(el, value);
12680
+ updated(el, { value, oldValue, modifiers: { number } }) {
12681
+ if (!el._assigning) {
12682
+ setSelected(el, value, oldValue, number);
12683
+ }
12663
12684
  }
12664
12685
  };
12665
- function setSelected(el, value) {
12686
+ function setSelected(el, value, oldValue, number) {
12666
12687
  const isMultiple = el.multiple;
12667
- if (isMultiple && !isArray(value) && !isSet(value)) {
12688
+ const isArrayValue = isArray(value);
12689
+ if (isMultiple && !isArrayValue && !isSet(value)) {
12668
12690
  warn(
12669
12691
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12670
12692
  );
12671
12693
  return;
12672
12694
  }
12695
+ if (isArrayValue && looseEqual(value, oldValue)) {
12696
+ return;
12697
+ }
12673
12698
  for (let i = 0, l = el.options.length; i < l; i++) {
12674
12699
  const option = el.options[i];
12675
12700
  const optionValue = getValue(option);
12676
12701
  if (isMultiple) {
12677
- if (isArray(value)) {
12678
- option.selected = looseIndexOf(value, optionValue) > -1;
12702
+ if (isArrayValue) {
12703
+ const optionType = typeof optionValue;
12704
+ if (optionType === "string" || optionType === "number") {
12705
+ option.selected = value.includes(
12706
+ number ? looseToNumber(optionValue) : optionValue
12707
+ );
12708
+ } else {
12709
+ option.selected = looseIndexOf(value, optionValue) > -1;
12710
+ }
12679
12711
  } else {
12680
12712
  option.selected = value.has(optionValue);
12681
12713
  }