@vue/runtime-dom 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/runtime-dom v3.4.14
2
+ * @vue/runtime-dom v3.4.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1212,35 +1212,52 @@ const vModelSelect = {
1212
1212
  el[assignKey](
1213
1213
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
1214
1214
  );
1215
+ el._assigning = true;
1216
+ runtimeCore.nextTick(() => {
1217
+ el._assigning = false;
1218
+ });
1215
1219
  });
1216
1220
  el[assignKey] = getModelAssigner(vnode);
1217
1221
  },
1218
1222
  // set value in mounted & updated because <select> relies on its children
1219
1223
  // <option>s.
1220
- mounted(el, { value }) {
1221
- setSelected(el, value);
1224
+ mounted(el, { value, oldValue, modifiers: { number } }) {
1225
+ setSelected(el, value, oldValue, number);
1222
1226
  },
1223
1227
  beforeUpdate(el, _binding, vnode) {
1224
1228
  el[assignKey] = getModelAssigner(vnode);
1225
1229
  },
1226
- updated(el, { value }) {
1227
- setSelected(el, value);
1230
+ updated(el, { value, oldValue, modifiers: { number } }) {
1231
+ if (!el._assigning) {
1232
+ setSelected(el, value, oldValue, number);
1233
+ }
1228
1234
  }
1229
1235
  };
1230
- function setSelected(el, value) {
1236
+ function setSelected(el, value, oldValue, number) {
1231
1237
  const isMultiple = el.multiple;
1232
- if (isMultiple && !shared.isArray(value) && !shared.isSet(value)) {
1238
+ const isArrayValue = shared.isArray(value);
1239
+ if (isMultiple && !isArrayValue && !shared.isSet(value)) {
1233
1240
  runtimeCore.warn(
1234
1241
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
1235
1242
  );
1236
1243
  return;
1237
1244
  }
1245
+ if (isArrayValue && shared.looseEqual(value, oldValue)) {
1246
+ return;
1247
+ }
1238
1248
  for (let i = 0, l = el.options.length; i < l; i++) {
1239
1249
  const option = el.options[i];
1240
1250
  const optionValue = getValue(option);
1241
1251
  if (isMultiple) {
1242
- if (shared.isArray(value)) {
1243
- option.selected = shared.looseIndexOf(value, optionValue) > -1;
1252
+ if (isArrayValue) {
1253
+ const optionType = typeof optionValue;
1254
+ if (optionType === "string" || optionType === "number") {
1255
+ option.selected = value.includes(
1256
+ number ? shared.looseToNumber(optionValue) : optionValue
1257
+ );
1258
+ } else {
1259
+ option.selected = shared.looseIndexOf(value, optionValue) > -1;
1260
+ }
1244
1261
  } else {
1245
1262
  option.selected = value.has(optionValue);
1246
1263
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.14
2
+ * @vue/runtime-dom v3.4.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1168,32 +1168,49 @@ const vModelSelect = {
1168
1168
  el[assignKey](
1169
1169
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
1170
1170
  );
1171
+ el._assigning = true;
1172
+ runtimeCore.nextTick(() => {
1173
+ el._assigning = false;
1174
+ });
1171
1175
  });
1172
1176
  el[assignKey] = getModelAssigner(vnode);
1173
1177
  },
1174
1178
  // set value in mounted & updated because <select> relies on its children
1175
1179
  // <option>s.
1176
- mounted(el, { value }) {
1177
- setSelected(el, value);
1180
+ mounted(el, { value, oldValue, modifiers: { number } }) {
1181
+ setSelected(el, value, oldValue, number);
1178
1182
  },
1179
1183
  beforeUpdate(el, _binding, vnode) {
1180
1184
  el[assignKey] = getModelAssigner(vnode);
1181
1185
  },
1182
- updated(el, { value }) {
1183
- setSelected(el, value);
1186
+ updated(el, { value, oldValue, modifiers: { number } }) {
1187
+ if (!el._assigning) {
1188
+ setSelected(el, value, oldValue, number);
1189
+ }
1184
1190
  }
1185
1191
  };
1186
- function setSelected(el, value) {
1192
+ function setSelected(el, value, oldValue, number) {
1187
1193
  const isMultiple = el.multiple;
1188
- if (isMultiple && !shared.isArray(value) && !shared.isSet(value)) {
1194
+ const isArrayValue = shared.isArray(value);
1195
+ if (isMultiple && !isArrayValue && !shared.isSet(value)) {
1196
+ return;
1197
+ }
1198
+ if (isArrayValue && shared.looseEqual(value, oldValue)) {
1189
1199
  return;
1190
1200
  }
1191
1201
  for (let i = 0, l = el.options.length; i < l; i++) {
1192
1202
  const option = el.options[i];
1193
1203
  const optionValue = getValue(option);
1194
1204
  if (isMultiple) {
1195
- if (shared.isArray(value)) {
1196
- option.selected = shared.looseIndexOf(value, optionValue) > -1;
1205
+ if (isArrayValue) {
1206
+ const optionType = typeof optionValue;
1207
+ if (optionType === "string" || optionType === "number") {
1208
+ option.selected = value.includes(
1209
+ number ? shared.looseToNumber(optionValue) : optionValue
1210
+ );
1211
+ } else {
1212
+ option.selected = shared.looseIndexOf(value, optionValue) > -1;
1213
+ }
1197
1214
  } else {
1198
1215
  option.selected = value.has(optionValue);
1199
1216
  }
@@ -92,6 +92,7 @@ type AssignerFn = (value: any) => void;
92
92
  declare const assignKey: unique symbol;
93
93
  type ModelDirective<T> = ObjectDirective<T & {
94
94
  [assignKey]: AssignerFn;
95
+ _assigning?: boolean;
95
96
  }>;
96
97
  export declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement>;
97
98
  export declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.14
2
+ * @vue/runtime-dom v3.4.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -200,6 +200,13 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
200
200
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
201
201
  `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`
202
202
  );
203
+ function isRenderableAttrValue(value) {
204
+ if (value == null) {
205
+ return false;
206
+ }
207
+ const type = typeof value;
208
+ return type === "string" || type === "number" || type === "boolean";
209
+ }
203
210
 
204
211
  function looseCompareArrays(a, b) {
205
212
  if (a.length !== b.length)
@@ -562,10 +569,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
562
569
  var _a;
563
570
  pauseScheduling();
564
571
  for (const effect2 of dep.keys()) {
565
- if (dep.get(effect2) !== effect2._trackId) {
566
- continue;
567
- }
568
- if (effect2._dirtyLevel < dirtyLevel && !(effect2._runnings && !effect2.allowRecurse)) {
572
+ if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
569
573
  const lastDirtyLevel = effect2._dirtyLevel;
570
574
  effect2._dirtyLevel = dirtyLevel;
571
575
  if (lastDirtyLevel === 0) {
@@ -576,12 +580,17 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
576
580
  effect2.trigger();
577
581
  }
578
582
  }
579
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
583
+ }
584
+ scheduleEffects(dep);
585
+ resetScheduling();
586
+ }
587
+ function scheduleEffects(dep) {
588
+ for (const effect2 of dep.keys()) {
589
+ if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
580
590
  effect2._shouldSchedule = false;
581
591
  queueEffectSchedulers.push(effect2.scheduler);
582
592
  }
583
593
  }
584
- resetScheduling();
585
594
  }
586
595
 
587
596
  const createDep = (cleanup, computed) => {
@@ -1264,7 +1273,8 @@ class ComputedRefImpl {
1264
1273
  this["__v_isReadonly"] = false;
1265
1274
  this.effect = new ReactiveEffect(
1266
1275
  () => getter(this._value),
1267
- () => triggerRefValue(this, 1)
1276
+ () => triggerRefValue(this, 1),
1277
+ () => this.dep && scheduleEffects(this.dep)
1268
1278
  );
1269
1279
  this.effect.computed = this;
1270
1280
  this.effect.active = this._cacheable = !isSSR;
@@ -1278,6 +1288,9 @@ class ComputedRefImpl {
1278
1288
  }
1279
1289
  }
1280
1290
  trackRefValue(self);
1291
+ if (self.effect._dirtyLevel >= 1) {
1292
+ triggerRefValue(self, 1);
1293
+ }
1281
1294
  return self._value;
1282
1295
  }
1283
1296
  set value(newValue) {
@@ -5864,7 +5877,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
5864
5877
  return rawSlot;
5865
5878
  }
5866
5879
  const normalized = withCtx((...args) => {
5867
- if (currentInstance) {
5880
+ if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
5868
5881
  warn$1(
5869
5882
  `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.`
5870
5883
  );
@@ -6000,9 +6013,10 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6000
6013
  } else {
6001
6014
  const _isString = isString(ref);
6002
6015
  const _isRef = isRef(ref);
6016
+ const isVFor = rawRef.f;
6003
6017
  if (_isString || _isRef) {
6004
6018
  const doSet = () => {
6005
- if (rawRef.f) {
6019
+ if (isVFor) {
6006
6020
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
6007
6021
  if (isUnmount) {
6008
6022
  isArray(existing) && remove(existing, refValue);
@@ -6035,11 +6049,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6035
6049
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6036
6050
  }
6037
6051
  };
6038
- if (value) {
6052
+ if (isUnmount || isVFor) {
6053
+ doSet();
6054
+ } else {
6039
6055
  doSet.id = -1;
6040
6056
  queuePostRenderEffect(doSet, parentSuspense);
6041
- } else {
6042
- doSet();
6043
6057
  }
6044
6058
  } else {
6045
6059
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6549,11 +6563,12 @@ function propHasMismatch(el, key, clientValue, vnode) {
6549
6563
  } else {
6550
6564
  if (el.hasAttribute(key)) {
6551
6565
  actual = el.getAttribute(key);
6566
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
6567
+ actual = el.value;
6552
6568
  } else {
6553
- const serverValue = el[key];
6554
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
6569
+ actual = false;
6555
6570
  }
6556
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
6571
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
6557
6572
  }
6558
6573
  if (actual !== expected) {
6559
6574
  mismatchType = `attribute`;
@@ -9501,7 +9516,7 @@ function isMemoSame(cached, memo) {
9501
9516
  return true;
9502
9517
  }
9503
9518
 
9504
- const version = "3.4.14";
9519
+ const version = "3.4.15";
9505
9520
  const warn = warn$1 ;
9506
9521
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9507
9522
  const devtools = devtools$1 ;
@@ -10764,35 +10779,52 @@ const vModelSelect = {
10764
10779
  el[assignKey](
10765
10780
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
10766
10781
  );
10782
+ el._assigning = true;
10783
+ nextTick(() => {
10784
+ el._assigning = false;
10785
+ });
10767
10786
  });
10768
10787
  el[assignKey] = getModelAssigner(vnode);
10769
10788
  },
10770
10789
  // set value in mounted & updated because <select> relies on its children
10771
10790
  // <option>s.
10772
- mounted(el, { value }) {
10773
- setSelected(el, value);
10791
+ mounted(el, { value, oldValue, modifiers: { number } }) {
10792
+ setSelected(el, value, oldValue, number);
10774
10793
  },
10775
10794
  beforeUpdate(el, _binding, vnode) {
10776
10795
  el[assignKey] = getModelAssigner(vnode);
10777
10796
  },
10778
- updated(el, { value }) {
10779
- setSelected(el, value);
10797
+ updated(el, { value, oldValue, modifiers: { number } }) {
10798
+ if (!el._assigning) {
10799
+ setSelected(el, value, oldValue, number);
10800
+ }
10780
10801
  }
10781
10802
  };
10782
- function setSelected(el, value) {
10803
+ function setSelected(el, value, oldValue, number) {
10783
10804
  const isMultiple = el.multiple;
10784
- if (isMultiple && !isArray(value) && !isSet(value)) {
10805
+ const isArrayValue = isArray(value);
10806
+ if (isMultiple && !isArrayValue && !isSet(value)) {
10785
10807
  warn(
10786
10808
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
10787
10809
  );
10788
10810
  return;
10789
10811
  }
10812
+ if (isArrayValue && looseEqual(value, oldValue)) {
10813
+ return;
10814
+ }
10790
10815
  for (let i = 0, l = el.options.length; i < l; i++) {
10791
10816
  const option = el.options[i];
10792
10817
  const optionValue = getValue(option);
10793
10818
  if (isMultiple) {
10794
- if (isArray(value)) {
10795
- option.selected = looseIndexOf(value, optionValue) > -1;
10819
+ if (isArrayValue) {
10820
+ const optionType = typeof optionValue;
10821
+ if (optionType === "string" || optionType === "number") {
10822
+ option.selected = value.includes(
10823
+ number ? looseToNumber(optionValue) : optionValue
10824
+ );
10825
+ } else {
10826
+ option.selected = looseIndexOf(value, optionValue) > -1;
10827
+ }
10796
10828
  } else {
10797
10829
  option.selected = value.has(optionValue);
10798
10830
  }