@vue/compat 3.4.14 → 3.4.16

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.16
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)
@@ -400,7 +407,7 @@ class ReactiveEffect {
400
407
  /**
401
408
  * @internal
402
409
  */
403
- this._dirtyLevel = 2;
410
+ this._dirtyLevel = 4;
404
411
  /**
405
412
  * @internal
406
413
  */
@@ -420,26 +427,27 @@ class ReactiveEffect {
420
427
  recordEffectScope(this, scope);
421
428
  }
422
429
  get dirty() {
423
- if (this._dirtyLevel === 1) {
430
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
431
+ this._dirtyLevel = 1;
424
432
  pauseTracking();
425
433
  for (let i = 0; i < this._depsLength; i++) {
426
434
  const dep = this.deps[i];
427
435
  if (dep.computed) {
428
436
  triggerComputed(dep.computed);
429
- if (this._dirtyLevel >= 2) {
437
+ if (this._dirtyLevel >= 4) {
430
438
  break;
431
439
  }
432
440
  }
433
441
  }
434
- if (this._dirtyLevel < 2) {
442
+ if (this._dirtyLevel === 1) {
435
443
  this._dirtyLevel = 0;
436
444
  }
437
445
  resetTracking();
438
446
  }
439
- return this._dirtyLevel >= 2;
447
+ return this._dirtyLevel >= 4;
440
448
  }
441
449
  set dirty(v) {
442
- this._dirtyLevel = v ? 2 : 0;
450
+ this._dirtyLevel = v ? 4 : 0;
443
451
  }
444
452
  run() {
445
453
  this._dirtyLevel = 0;
@@ -479,7 +487,7 @@ function preCleanupEffect(effect2) {
479
487
  effect2._depsLength = 0;
480
488
  }
481
489
  function postCleanupEffect(effect2) {
482
- if (effect2.deps && effect2.deps.length > effect2._depsLength) {
490
+ if (effect2.deps.length > effect2._depsLength) {
483
491
  for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
484
492
  cleanupDepEffect(effect2.deps[i], effect2);
485
493
  }
@@ -562,24 +570,23 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
562
570
  var _a;
563
571
  pauseScheduling();
564
572
  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)) {
569
- const lastDirtyLevel = effect2._dirtyLevel;
573
+ let tracking;
574
+ if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
575
+ effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
570
576
  effect2._dirtyLevel = dirtyLevel;
571
- if (lastDirtyLevel === 0) {
572
- effect2._shouldSchedule = true;
573
- if (!!(process.env.NODE_ENV !== "production")) {
574
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
577
+ }
578
+ if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
579
+ if (!!(process.env.NODE_ENV !== "production")) {
580
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
581
+ }
582
+ effect2.trigger();
583
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
584
+ effect2._shouldSchedule = false;
585
+ if (effect2.scheduler) {
586
+ queueEffectSchedulers.push(effect2.scheduler);
575
587
  }
576
- effect2.trigger();
577
588
  }
578
589
  }
579
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
580
- effect2._shouldSchedule = false;
581
- queueEffectSchedulers.push(effect2.scheduler);
582
- }
583
590
  }
584
591
  resetScheduling();
585
592
  }
@@ -665,7 +672,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
665
672
  if (dep) {
666
673
  triggerEffects(
667
674
  dep,
668
- 2,
675
+ 4,
669
676
  !!(process.env.NODE_ENV !== "production") ? {
670
677
  target,
671
678
  type,
@@ -1250,7 +1257,9 @@ function toRaw(observed) {
1250
1257
  return raw ? toRaw(raw) : observed;
1251
1258
  }
1252
1259
  function markRaw(value) {
1253
- def(value, "__v_skip", true);
1260
+ if (Object.isExtensible(value)) {
1261
+ def(value, "__v_skip", true);
1262
+ }
1254
1263
  return value;
1255
1264
  }
1256
1265
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1264,7 +1273,10 @@ 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(
1277
+ this,
1278
+ this.effect._dirtyLevel === 2 ? 2 : 3
1279
+ )
1268
1280
  );
1269
1281
  this.effect.computed = this;
1270
1282
  this.effect.active = this._cacheable = !isSSR;
@@ -1272,12 +1284,13 @@ class ComputedRefImpl {
1272
1284
  }
1273
1285
  get value() {
1274
1286
  const self = toRaw(this);
1275
- if (!self._cacheable || self.effect.dirty) {
1276
- if (hasChanged(self._value, self._value = self.effect.run())) {
1277
- triggerRefValue(self, 2);
1278
- }
1287
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1288
+ triggerRefValue(self, 4);
1279
1289
  }
1280
1290
  trackRefValue(self);
1291
+ if (self.effect._dirtyLevel >= 2) {
1292
+ triggerRefValue(self, 2);
1293
+ }
1281
1294
  return self._value;
1282
1295
  }
1283
1296
  set value(newValue) {
@@ -1314,14 +1327,15 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1314
1327
  }
1315
1328
 
1316
1329
  function trackRefValue(ref2) {
1330
+ var _a;
1317
1331
  if (shouldTrack && activeEffect) {
1318
1332
  ref2 = toRaw(ref2);
1319
1333
  trackEffect(
1320
1334
  activeEffect,
1321
- ref2.dep || (ref2.dep = createDep(
1335
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1322
1336
  () => ref2.dep = void 0,
1323
1337
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1324
- )),
1338
+ ),
1325
1339
  !!(process.env.NODE_ENV !== "production") ? {
1326
1340
  target: ref2,
1327
1341
  type: "get",
@@ -1330,7 +1344,7 @@ function trackRefValue(ref2) {
1330
1344
  );
1331
1345
  }
1332
1346
  }
1333
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1347
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1334
1348
  ref2 = toRaw(ref2);
1335
1349
  const dep = ref2.dep;
1336
1350
  if (dep) {
@@ -1379,12 +1393,12 @@ class RefImpl {
1379
1393
  if (hasChanged(newVal, this._rawValue)) {
1380
1394
  this._rawValue = newVal;
1381
1395
  this._value = useDirectValue ? newVal : toReactive(newVal);
1382
- triggerRefValue(this, 2, newVal);
1396
+ triggerRefValue(this, 4, newVal);
1383
1397
  }
1384
1398
  }
1385
1399
  }
1386
1400
  function triggerRef(ref2) {
1387
- triggerRefValue(ref2, 2, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1401
+ triggerRefValue(ref2, 4, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1388
1402
  }
1389
1403
  function unref(ref2) {
1390
1404
  return isRef(ref2) ? ref2.value : ref2;
@@ -1703,7 +1717,7 @@ function handleError(err, instance, type, throwInDev = true) {
1703
1717
  if (instance) {
1704
1718
  let cur = instance.parent;
1705
1719
  const exposedInstance = instance.proxy;
1706
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/errors/#runtime-${type}`;
1720
+ const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
1707
1721
  while (cur) {
1708
1722
  const errorCapturedHooks = cur.ec;
1709
1723
  if (errorCapturedHooks) {
@@ -6461,7 +6475,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6461
6475
  return vm;
6462
6476
  }
6463
6477
  }
6464
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
6478
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6465
6479
  Vue.config = singletonApp.config;
6466
6480
  Vue.use = (p, ...options) => {
6467
6481
  if (p && isFunction(p.install)) {
@@ -7009,11 +7023,12 @@ If you want to remount the same app, move your app creation logic into a factory
7009
7023
  return app;
7010
7024
  },
7011
7025
  runWithContext(fn) {
7026
+ const lastApp = currentApp;
7012
7027
  currentApp = app;
7013
7028
  try {
7014
7029
  return fn();
7015
7030
  } finally {
7016
- currentApp = null;
7031
+ currentApp = lastApp;
7017
7032
  }
7018
7033
  }
7019
7034
  };
@@ -7533,7 +7548,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
7533
7548
  return rawSlot;
7534
7549
  }
7535
7550
  const normalized = withCtx((...args) => {
7536
- if (!!(process.env.NODE_ENV !== "production") && currentInstance) {
7551
+ if (!!(process.env.NODE_ENV !== "production") && currentInstance && (!ctx || ctx.root === currentInstance.root)) {
7537
7552
  warn$1(
7538
7553
  `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.`
7539
7554
  );
@@ -8009,7 +8024,7 @@ Server rendered element contains more child nodes than client vdom.`
8009
8024
  if (props) {
8010
8025
  if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
8011
8026
  for (const key in props) {
8012
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode)) {
8027
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8013
8028
  hasMismatch = true;
8014
8029
  }
8015
8030
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8194,7 +8209,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8194
8209
  };
8195
8210
  return [hydrate, hydrateNode];
8196
8211
  }
8197
- function propHasMismatch(el, key, clientValue, vnode) {
8212
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8213
+ var _a;
8198
8214
  let mismatchType;
8199
8215
  let mismatchKey;
8200
8216
  let actual;
@@ -8217,6 +8233,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8217
8233
  }
8218
8234
  }
8219
8235
  }
8236
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8237
+ for (const key2 in cssVars) {
8238
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8239
+ }
8220
8240
  if (!isMapEqual(actualMap, expectedMap)) {
8221
8241
  mismatchType = mismatchKey = "style";
8222
8242
  }
@@ -8230,11 +8250,12 @@ function propHasMismatch(el, key, clientValue, vnode) {
8230
8250
  } else {
8231
8251
  if (el.hasAttribute(key)) {
8232
8252
  actual = el.getAttribute(key);
8253
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
8254
+ actual = el.value;
8233
8255
  } else {
8234
- const serverValue = el[key];
8235
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
8256
+ actual = false;
8236
8257
  }
8237
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
8258
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
8238
8259
  }
8239
8260
  if (actual !== expected) {
8240
8261
  mismatchType = `attribute`;
@@ -11360,7 +11381,7 @@ function isMemoSame(cached, memo) {
11360
11381
  return true;
11361
11382
  }
11362
11383
 
11363
- const version = "3.4.14";
11384
+ const version = "3.4.16";
11364
11385
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11365
11386
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11366
11387
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11789,7 +11810,7 @@ const vShow = {
11789
11810
  }
11790
11811
  },
11791
11812
  updated(el, { value, oldValue }, { transition }) {
11792
- if (!value === !oldValue)
11813
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11793
11814
  return;
11794
11815
  if (transition) {
11795
11816
  if (value) {
@@ -11835,6 +11856,9 @@ function useCssVars(getter) {
11835
11856
  document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11836
11857
  ).forEach((node) => setVarsOnNode(node, vars));
11837
11858
  };
11859
+ if (!!(process.env.NODE_ENV !== "production")) {
11860
+ instance.getCssVars = () => getter(instance.proxy);
11861
+ }
11838
11862
  const setVars = () => {
11839
11863
  const vars = getter(instance.proxy);
11840
11864
  setVarsOnVNode(instance.subTree, vars);
@@ -11915,6 +11939,7 @@ function patchStyle(el, prev, next) {
11915
11939
  }
11916
11940
  }
11917
11941
  if (vShowOldKey in el) {
11942
+ el[vShowOldKey] = style.display;
11918
11943
  style.display = currentDisplay;
11919
11944
  }
11920
11945
  }
@@ -12734,24 +12759,31 @@ const vModelSelect = {
12734
12759
  el[assignKey](
12735
12760
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12736
12761
  );
12762
+ el._assigning = true;
12763
+ nextTick(() => {
12764
+ el._assigning = false;
12765
+ });
12737
12766
  });
12738
12767
  el[assignKey] = getModelAssigner(vnode);
12739
12768
  },
12740
12769
  // set value in mounted & updated because <select> relies on its children
12741
12770
  // <option>s.
12742
- mounted(el, { value }) {
12743
- setSelected(el, value);
12771
+ mounted(el, { value, oldValue, modifiers: { number } }) {
12772
+ setSelected(el, value, oldValue, number);
12744
12773
  },
12745
12774
  beforeUpdate(el, _binding, vnode) {
12746
12775
  el[assignKey] = getModelAssigner(vnode);
12747
12776
  },
12748
- updated(el, { value }) {
12749
- setSelected(el, value);
12777
+ updated(el, { value, oldValue, modifiers: { number } }) {
12778
+ if (!el._assigning) {
12779
+ setSelected(el, value, oldValue, number);
12780
+ }
12750
12781
  }
12751
12782
  };
12752
- function setSelected(el, value) {
12783
+ function setSelected(el, value, oldValue, number) {
12753
12784
  const isMultiple = el.multiple;
12754
- if (isMultiple && !isArray(value) && !isSet(value)) {
12785
+ const isArrayValue = isArray(value);
12786
+ if (isMultiple && !isArrayValue && !isSet(value)) {
12755
12787
  !!(process.env.NODE_ENV !== "production") && warn(
12756
12788
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12757
12789
  );
@@ -12761,8 +12793,15 @@ function setSelected(el, value) {
12761
12793
  const option = el.options[i];
12762
12794
  const optionValue = getValue(option);
12763
12795
  if (isMultiple) {
12764
- if (isArray(value)) {
12765
- option.selected = looseIndexOf(value, optionValue) > -1;
12796
+ if (isArrayValue) {
12797
+ const optionType = typeof optionValue;
12798
+ if (optionType === "string" || optionType === "number") {
12799
+ option.selected = value.includes(
12800
+ number ? looseToNumber(optionValue) : optionValue
12801
+ );
12802
+ } else {
12803
+ option.selected = looseIndexOf(value, optionValue) > -1;
12804
+ }
12766
12805
  } else {
12767
12806
  option.selected = value.has(optionValue);
12768
12807
  }