@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
- {
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
+ {
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
  {
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
  {
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, ref2.value );
1401
+ triggerRefValue(ref2, 4, ref2.value );
1388
1402
  }
1389
1403
  function unref(ref2) {
1390
1404
  return isRef(ref2) ? ref2.value : ref2;
@@ -6423,7 +6437,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6423
6437
  return vm;
6424
6438
  }
6425
6439
  }
6426
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
6440
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6427
6441
  Vue.config = singletonApp.config;
6428
6442
  Vue.use = (p, ...options) => {
6429
6443
  if (p && isFunction(p.install)) {
@@ -6968,11 +6982,12 @@ If you want to remount the same app, move your app creation logic into a factory
6968
6982
  return app;
6969
6983
  },
6970
6984
  runWithContext(fn) {
6985
+ const lastApp = currentApp;
6971
6986
  currentApp = app;
6972
6987
  try {
6973
6988
  return fn();
6974
6989
  } finally {
6975
- currentApp = null;
6990
+ currentApp = lastApp;
6976
6991
  }
6977
6992
  }
6978
6993
  };
@@ -7492,7 +7507,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
7492
7507
  return rawSlot;
7493
7508
  }
7494
7509
  const normalized = withCtx((...args) => {
7495
- if (currentInstance) {
7510
+ if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
7496
7511
  warn$1(
7497
7512
  `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.`
7498
7513
  );
@@ -7968,7 +7983,7 @@ Server rendered element contains more child nodes than client vdom.`
7968
7983
  if (props) {
7969
7984
  {
7970
7985
  for (const key in props) {
7971
- if (propHasMismatch(el, key, props[key], vnode)) {
7986
+ if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7972
7987
  hasMismatch = true;
7973
7988
  }
7974
7989
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8143,7 +8158,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8143
8158
  };
8144
8159
  return [hydrate, hydrateNode];
8145
8160
  }
8146
- function propHasMismatch(el, key, clientValue, vnode) {
8161
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8162
+ var _a;
8147
8163
  let mismatchType;
8148
8164
  let mismatchKey;
8149
8165
  let actual;
@@ -8166,6 +8182,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8166
8182
  }
8167
8183
  }
8168
8184
  }
8185
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8186
+ for (const key2 in cssVars) {
8187
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8188
+ }
8169
8189
  if (!isMapEqual(actualMap, expectedMap)) {
8170
8190
  mismatchType = mismatchKey = "style";
8171
8191
  }
@@ -8179,11 +8199,12 @@ function propHasMismatch(el, key, clientValue, vnode) {
8179
8199
  } else {
8180
8200
  if (el.hasAttribute(key)) {
8181
8201
  actual = el.getAttribute(key);
8202
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
8203
+ actual = el.value;
8182
8204
  } else {
8183
- const serverValue = el[key];
8184
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
8205
+ actual = false;
8185
8206
  }
8186
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
8207
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
8187
8208
  }
8188
8209
  if (actual !== expected) {
8189
8210
  mismatchType = `attribute`;
@@ -11238,7 +11259,7 @@ function isMemoSame(cached, memo) {
11238
11259
  return true;
11239
11260
  }
11240
11261
 
11241
- const version = "3.4.14";
11262
+ const version = "3.4.16";
11242
11263
  const warn = warn$1 ;
11243
11264
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11244
11265
  const devtools = devtools$1 ;
@@ -11659,7 +11680,7 @@ const vShow = {
11659
11680
  }
11660
11681
  },
11661
11682
  updated(el, { value, oldValue }, { transition }) {
11662
- if (!value === !oldValue)
11683
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11663
11684
  return;
11664
11685
  if (transition) {
11665
11686
  if (value) {
@@ -11698,6 +11719,9 @@ function useCssVars(getter) {
11698
11719
  document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11699
11720
  ).forEach((node) => setVarsOnNode(node, vars));
11700
11721
  };
11722
+ {
11723
+ instance.getCssVars = () => getter(instance.proxy);
11724
+ }
11701
11725
  const setVars = () => {
11702
11726
  const vars = getter(instance.proxy);
11703
11727
  setVarsOnVNode(instance.subTree, vars);
@@ -11778,6 +11802,7 @@ function patchStyle(el, prev, next) {
11778
11802
  }
11779
11803
  }
11780
11804
  if (vShowOldKey in el) {
11805
+ el[vShowOldKey] = style.display;
11781
11806
  style.display = currentDisplay;
11782
11807
  }
11783
11808
  }
@@ -12597,24 +12622,31 @@ const vModelSelect = {
12597
12622
  el[assignKey](
12598
12623
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12599
12624
  );
12625
+ el._assigning = true;
12626
+ nextTick(() => {
12627
+ el._assigning = false;
12628
+ });
12600
12629
  });
12601
12630
  el[assignKey] = getModelAssigner(vnode);
12602
12631
  },
12603
12632
  // set value in mounted & updated because <select> relies on its children
12604
12633
  // <option>s.
12605
- mounted(el, { value }) {
12606
- setSelected(el, value);
12634
+ mounted(el, { value, oldValue, modifiers: { number } }) {
12635
+ setSelected(el, value, oldValue, number);
12607
12636
  },
12608
12637
  beforeUpdate(el, _binding, vnode) {
12609
12638
  el[assignKey] = getModelAssigner(vnode);
12610
12639
  },
12611
- updated(el, { value }) {
12612
- setSelected(el, value);
12640
+ updated(el, { value, oldValue, modifiers: { number } }) {
12641
+ if (!el._assigning) {
12642
+ setSelected(el, value, oldValue, number);
12643
+ }
12613
12644
  }
12614
12645
  };
12615
- function setSelected(el, value) {
12646
+ function setSelected(el, value, oldValue, number) {
12616
12647
  const isMultiple = el.multiple;
12617
- if (isMultiple && !isArray(value) && !isSet(value)) {
12648
+ const isArrayValue = isArray(value);
12649
+ if (isMultiple && !isArrayValue && !isSet(value)) {
12618
12650
  warn(
12619
12651
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12620
12652
  );
@@ -12624,8 +12656,15 @@ function setSelected(el, value) {
12624
12656
  const option = el.options[i];
12625
12657
  const optionValue = getValue(option);
12626
12658
  if (isMultiple) {
12627
- if (isArray(value)) {
12628
- option.selected = looseIndexOf(value, optionValue) > -1;
12659
+ if (isArrayValue) {
12660
+ const optionType = typeof optionValue;
12661
+ if (optionType === "string" || optionType === "number") {
12662
+ option.selected = value.includes(
12663
+ number ? looseToNumber(optionValue) : optionValue
12664
+ );
12665
+ } else {
12666
+ option.selected = looseIndexOf(value, optionValue) > -1;
12667
+ }
12629
12668
  } else {
12630
12669
  option.selected = value.has(optionValue);
12631
12670
  }