@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -276,6 +276,13 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
276
276
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
277
277
  `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`
278
278
  );
279
+ function isRenderableAttrValue(value) {
280
+ if (value == null) {
281
+ return false;
282
+ }
283
+ const type = typeof value;
284
+ return type === "string" || type === "number" || type === "boolean";
285
+ }
279
286
 
280
287
  const escapeRE = /["'&<>]/;
281
288
  function escapeHtml(string) {
@@ -516,7 +523,7 @@ class ReactiveEffect {
516
523
  /**
517
524
  * @internal
518
525
  */
519
- this._dirtyLevel = 2;
526
+ this._dirtyLevel = 4;
520
527
  /**
521
528
  * @internal
522
529
  */
@@ -536,26 +543,27 @@ class ReactiveEffect {
536
543
  recordEffectScope(this, scope);
537
544
  }
538
545
  get dirty() {
539
- if (this._dirtyLevel === 1) {
546
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
547
+ this._dirtyLevel = 1;
540
548
  pauseTracking();
541
549
  for (let i = 0; i < this._depsLength; i++) {
542
550
  const dep = this.deps[i];
543
551
  if (dep.computed) {
544
552
  triggerComputed(dep.computed);
545
- if (this._dirtyLevel >= 2) {
553
+ if (this._dirtyLevel >= 4) {
546
554
  break;
547
555
  }
548
556
  }
549
557
  }
550
- if (this._dirtyLevel < 2) {
558
+ if (this._dirtyLevel === 1) {
551
559
  this._dirtyLevel = 0;
552
560
  }
553
561
  resetTracking();
554
562
  }
555
- return this._dirtyLevel >= 2;
563
+ return this._dirtyLevel >= 4;
556
564
  }
557
565
  set dirty(v) {
558
- this._dirtyLevel = v ? 2 : 0;
566
+ this._dirtyLevel = v ? 4 : 0;
559
567
  }
560
568
  run() {
561
569
  this._dirtyLevel = 0;
@@ -595,7 +603,7 @@ function preCleanupEffect(effect2) {
595
603
  effect2._depsLength = 0;
596
604
  }
597
605
  function postCleanupEffect(effect2) {
598
- if (effect2.deps && effect2.deps.length > effect2._depsLength) {
606
+ if (effect2.deps.length > effect2._depsLength) {
599
607
  for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
600
608
  cleanupDepEffect(effect2.deps[i], effect2);
601
609
  }
@@ -678,24 +686,23 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
678
686
  var _a;
679
687
  pauseScheduling();
680
688
  for (const effect2 of dep.keys()) {
681
- if (dep.get(effect2) !== effect2._trackId) {
682
- continue;
683
- }
684
- if (effect2._dirtyLevel < dirtyLevel && !(effect2._runnings && !effect2.allowRecurse)) {
685
- const lastDirtyLevel = effect2._dirtyLevel;
689
+ let tracking;
690
+ if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
691
+ effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
686
692
  effect2._dirtyLevel = dirtyLevel;
687
- if (lastDirtyLevel === 0) {
688
- effect2._shouldSchedule = true;
689
- {
690
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
693
+ }
694
+ if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
695
+ {
696
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
697
+ }
698
+ effect2.trigger();
699
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
700
+ effect2._shouldSchedule = false;
701
+ if (effect2.scheduler) {
702
+ queueEffectSchedulers.push(effect2.scheduler);
691
703
  }
692
- effect2.trigger();
693
704
  }
694
705
  }
695
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
696
- effect2._shouldSchedule = false;
697
- queueEffectSchedulers.push(effect2.scheduler);
698
- }
699
706
  }
700
707
  resetScheduling();
701
708
  }
@@ -781,7 +788,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
781
788
  if (dep) {
782
789
  triggerEffects(
783
790
  dep,
784
- 2,
791
+ 4,
785
792
  {
786
793
  target,
787
794
  type,
@@ -1366,7 +1373,9 @@ function toRaw(observed) {
1366
1373
  return raw ? toRaw(raw) : observed;
1367
1374
  }
1368
1375
  function markRaw(value) {
1369
- def(value, "__v_skip", true);
1376
+ if (Object.isExtensible(value)) {
1377
+ def(value, "__v_skip", true);
1378
+ }
1370
1379
  return value;
1371
1380
  }
1372
1381
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1380,7 +1389,10 @@ class ComputedRefImpl {
1380
1389
  this["__v_isReadonly"] = false;
1381
1390
  this.effect = new ReactiveEffect(
1382
1391
  () => getter(this._value),
1383
- () => triggerRefValue(this, 1)
1392
+ () => triggerRefValue(
1393
+ this,
1394
+ this.effect._dirtyLevel === 2 ? 2 : 3
1395
+ )
1384
1396
  );
1385
1397
  this.effect.computed = this;
1386
1398
  this.effect.active = this._cacheable = !isSSR;
@@ -1388,12 +1400,13 @@ class ComputedRefImpl {
1388
1400
  }
1389
1401
  get value() {
1390
1402
  const self = toRaw(this);
1391
- if (!self._cacheable || self.effect.dirty) {
1392
- if (hasChanged(self._value, self._value = self.effect.run())) {
1393
- triggerRefValue(self, 2);
1394
- }
1403
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1404
+ triggerRefValue(self, 4);
1395
1405
  }
1396
1406
  trackRefValue(self);
1407
+ if (self.effect._dirtyLevel >= 2) {
1408
+ triggerRefValue(self, 2);
1409
+ }
1397
1410
  return self._value;
1398
1411
  }
1399
1412
  set value(newValue) {
@@ -1430,14 +1443,15 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1430
1443
  }
1431
1444
 
1432
1445
  function trackRefValue(ref2) {
1446
+ var _a;
1433
1447
  if (shouldTrack && activeEffect) {
1434
1448
  ref2 = toRaw(ref2);
1435
1449
  trackEffect(
1436
1450
  activeEffect,
1437
- ref2.dep || (ref2.dep = createDep(
1451
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1438
1452
  () => ref2.dep = void 0,
1439
1453
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1440
- )),
1454
+ ),
1441
1455
  {
1442
1456
  target: ref2,
1443
1457
  type: "get",
@@ -1446,7 +1460,7 @@ function trackRefValue(ref2) {
1446
1460
  );
1447
1461
  }
1448
1462
  }
1449
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1463
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1450
1464
  ref2 = toRaw(ref2);
1451
1465
  const dep = ref2.dep;
1452
1466
  if (dep) {
@@ -1495,12 +1509,12 @@ class RefImpl {
1495
1509
  if (hasChanged(newVal, this._rawValue)) {
1496
1510
  this._rawValue = newVal;
1497
1511
  this._value = useDirectValue ? newVal : toReactive(newVal);
1498
- triggerRefValue(this, 2, newVal);
1512
+ triggerRefValue(this, 4, newVal);
1499
1513
  }
1500
1514
  }
1501
1515
  }
1502
1516
  function triggerRef(ref2) {
1503
- triggerRefValue(ref2, 2, ref2.value );
1517
+ triggerRefValue(ref2, 4, ref2.value );
1504
1518
  }
1505
1519
  function unref(ref2) {
1506
1520
  return isRef(ref2) ? ref2.value : ref2;
@@ -6566,7 +6580,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6566
6580
  return vm;
6567
6581
  }
6568
6582
  }
6569
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
6583
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6570
6584
  Vue.config = singletonApp.config;
6571
6585
  Vue.use = (p, ...options) => {
6572
6586
  if (p && isFunction(p.install)) {
@@ -7111,11 +7125,12 @@ If you want to remount the same app, move your app creation logic into a factory
7111
7125
  return app;
7112
7126
  },
7113
7127
  runWithContext(fn) {
7128
+ const lastApp = currentApp;
7114
7129
  currentApp = app;
7115
7130
  try {
7116
7131
  return fn();
7117
7132
  } finally {
7118
- currentApp = null;
7133
+ currentApp = lastApp;
7119
7134
  }
7120
7135
  }
7121
7136
  };
@@ -7635,7 +7650,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
7635
7650
  return rawSlot;
7636
7651
  }
7637
7652
  const normalized = withCtx((...args) => {
7638
- if (currentInstance) {
7653
+ if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
7639
7654
  warn$1(
7640
7655
  `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.`
7641
7656
  );
@@ -8111,7 +8126,7 @@ Server rendered element contains more child nodes than client vdom.`
8111
8126
  if (props) {
8112
8127
  {
8113
8128
  for (const key in props) {
8114
- if (propHasMismatch(el, key, props[key], vnode)) {
8129
+ if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8115
8130
  hasMismatch = true;
8116
8131
  }
8117
8132
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8286,7 +8301,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8286
8301
  };
8287
8302
  return [hydrate, hydrateNode];
8288
8303
  }
8289
- function propHasMismatch(el, key, clientValue, vnode) {
8304
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8305
+ var _a;
8290
8306
  let mismatchType;
8291
8307
  let mismatchKey;
8292
8308
  let actual;
@@ -8309,6 +8325,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8309
8325
  }
8310
8326
  }
8311
8327
  }
8328
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8329
+ for (const key2 in cssVars) {
8330
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8331
+ }
8312
8332
  if (!isMapEqual(actualMap, expectedMap)) {
8313
8333
  mismatchType = mismatchKey = "style";
8314
8334
  }
@@ -8322,11 +8342,12 @@ function propHasMismatch(el, key, clientValue, vnode) {
8322
8342
  } else {
8323
8343
  if (el.hasAttribute(key)) {
8324
8344
  actual = el.getAttribute(key);
8345
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
8346
+ actual = el.value;
8325
8347
  } else {
8326
- const serverValue = el[key];
8327
- actual = isObject(serverValue) || serverValue == null ? "" : String(serverValue);
8348
+ actual = false;
8328
8349
  }
8329
- expected = isObject(clientValue) || clientValue == null ? "" : String(clientValue);
8350
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
8330
8351
  }
8331
8352
  if (actual !== expected) {
8332
8353
  mismatchType = `attribute`;
@@ -11398,7 +11419,7 @@ function isMemoSame(cached, memo) {
11398
11419
  return true;
11399
11420
  }
11400
11421
 
11401
- const version = "3.4.14";
11422
+ const version = "3.4.16";
11402
11423
  const warn = warn$1 ;
11403
11424
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11404
11425
  const devtools = devtools$1 ;
@@ -11827,7 +11848,7 @@ const vShow = {
11827
11848
  }
11828
11849
  },
11829
11850
  updated(el, { value, oldValue }, { transition }) {
11830
- if (!value === !oldValue)
11851
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11831
11852
  return;
11832
11853
  if (transition) {
11833
11854
  if (value) {
@@ -11895,6 +11916,7 @@ function patchStyle(el, prev, next) {
11895
11916
  }
11896
11917
  }
11897
11918
  if (vShowOldKey in el) {
11919
+ el[vShowOldKey] = style.display;
11898
11920
  style.display = currentDisplay;
11899
11921
  }
11900
11922
  }
@@ -12714,24 +12736,31 @@ const vModelSelect = {
12714
12736
  el[assignKey](
12715
12737
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
12716
12738
  );
12739
+ el._assigning = true;
12740
+ nextTick(() => {
12741
+ el._assigning = false;
12742
+ });
12717
12743
  });
12718
12744
  el[assignKey] = getModelAssigner(vnode);
12719
12745
  },
12720
12746
  // set value in mounted & updated because <select> relies on its children
12721
12747
  // <option>s.
12722
- mounted(el, { value }) {
12723
- setSelected(el, value);
12748
+ mounted(el, { value, oldValue, modifiers: { number } }) {
12749
+ setSelected(el, value, oldValue, number);
12724
12750
  },
12725
12751
  beforeUpdate(el, _binding, vnode) {
12726
12752
  el[assignKey] = getModelAssigner(vnode);
12727
12753
  },
12728
- updated(el, { value }) {
12729
- setSelected(el, value);
12754
+ updated(el, { value, oldValue, modifiers: { number } }) {
12755
+ if (!el._assigning) {
12756
+ setSelected(el, value, oldValue, number);
12757
+ }
12730
12758
  }
12731
12759
  };
12732
- function setSelected(el, value) {
12760
+ function setSelected(el, value, oldValue, number) {
12733
12761
  const isMultiple = el.multiple;
12734
- if (isMultiple && !isArray(value) && !isSet(value)) {
12762
+ const isArrayValue = isArray(value);
12763
+ if (isMultiple && !isArrayValue && !isSet(value)) {
12735
12764
  warn(
12736
12765
  `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
12737
12766
  );
@@ -12741,8 +12770,15 @@ function setSelected(el, value) {
12741
12770
  const option = el.options[i];
12742
12771
  const optionValue = getValue(option);
12743
12772
  if (isMultiple) {
12744
- if (isArray(value)) {
12745
- option.selected = looseIndexOf(value, optionValue) > -1;
12773
+ if (isArrayValue) {
12774
+ const optionType = typeof optionValue;
12775
+ if (optionType === "string" || optionType === "number") {
12776
+ option.selected = value.includes(
12777
+ number ? looseToNumber(optionValue) : optionValue
12778
+ );
12779
+ } else {
12780
+ option.selected = looseIndexOf(value, optionValue) > -1;
12781
+ }
12746
12782
  } else {
12747
12783
  option.selected = value.has(optionValue);
12748
12784
  }
@@ -14462,6 +14498,7 @@ const errorMessages = {
14462
14498
  [32]: `v-for has invalid expression.`,
14463
14499
  [33]: `<template v-for> key should be placed on the <template> tag.`,
14464
14500
  [34]: `v-bind is missing expression.`,
14501
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
14465
14502
  [35]: `v-on is missing expression.`,
14466
14503
  [36]: `Unexpected custom directive on <slot> outlet.`,
14467
14504
  [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
@@ -14482,7 +14519,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14482
14519
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14483
14520
  [50]: `"scopeId" option is only supported in module mode.`,
14484
14521
  // just to fulfill types
14485
- [52]: ``
14522
+ [53]: ``
14486
14523
  };
14487
14524
 
14488
14525
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
@@ -18751,8 +18788,15 @@ function processSlotOutlet(node, context) {
18751
18788
  }
18752
18789
  } else {
18753
18790
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
18754
- if (p.exp)
18791
+ if (p.exp) {
18755
18792
  slotName = p.exp;
18793
+ } else if (p.arg && p.arg.type === 4) {
18794
+ const name = camelize(p.arg.content);
18795
+ slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
18796
+ {
18797
+ slotName = p.exp = processExpression(p.exp, context);
18798
+ }
18799
+ }
18756
18800
  } else {
18757
18801
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
18758
18802
  p.arg.content = camelize(p.arg.content);
@@ -18892,7 +18936,32 @@ const transformBind = (dir, _node, context) => {
18892
18936
  const { modifiers, loc } = dir;
18893
18937
  const arg = dir.arg;
18894
18938
  let { exp } = dir;
18895
- if (!exp && arg.type === 4) {
18939
+ if (exp && exp.type === 4 && !exp.content.trim()) {
18940
+ {
18941
+ context.onError(
18942
+ createCompilerError(34, loc)
18943
+ );
18944
+ return {
18945
+ props: [
18946
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
18947
+ ]
18948
+ };
18949
+ }
18950
+ }
18951
+ if (!exp) {
18952
+ if (arg.type !== 4 || !arg.isStatic) {
18953
+ context.onError(
18954
+ createCompilerError(
18955
+ 52,
18956
+ arg.loc
18957
+ )
18958
+ );
18959
+ return {
18960
+ props: [
18961
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
18962
+ ]
18963
+ };
18964
+ }
18896
18965
  const propName = camelize(arg.content);
18897
18966
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
18898
18967
  {
@@ -18925,12 +18994,6 @@ const transformBind = (dir, _node, context) => {
18925
18994
  injectPrefix(arg, "^");
18926
18995
  }
18927
18996
  }
18928
- if (!exp || exp.type === 4 && !exp.content.trim()) {
18929
- context.onError(createCompilerError(34, loc));
18930
- return {
18931
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
18932
- };
18933
- }
18934
18997
  return {
18935
18998
  props: [createObjectProperty(arg, exp)]
18936
18999
  };