@vue/compat 3.4.15 → 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.15
2
+ * @vue/compat v3.4.16
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -523,7 +523,7 @@ class ReactiveEffect {
523
523
  /**
524
524
  * @internal
525
525
  */
526
- this._dirtyLevel = 2;
526
+ this._dirtyLevel = 4;
527
527
  /**
528
528
  * @internal
529
529
  */
@@ -543,26 +543,27 @@ class ReactiveEffect {
543
543
  recordEffectScope(this, scope);
544
544
  }
545
545
  get dirty() {
546
- if (this._dirtyLevel === 1) {
546
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
547
+ this._dirtyLevel = 1;
547
548
  pauseTracking();
548
549
  for (let i = 0; i < this._depsLength; i++) {
549
550
  const dep = this.deps[i];
550
551
  if (dep.computed) {
551
552
  triggerComputed(dep.computed);
552
- if (this._dirtyLevel >= 2) {
553
+ if (this._dirtyLevel >= 4) {
553
554
  break;
554
555
  }
555
556
  }
556
557
  }
557
- if (this._dirtyLevel < 2) {
558
+ if (this._dirtyLevel === 1) {
558
559
  this._dirtyLevel = 0;
559
560
  }
560
561
  resetTracking();
561
562
  }
562
- return this._dirtyLevel >= 2;
563
+ return this._dirtyLevel >= 4;
563
564
  }
564
565
  set dirty(v) {
565
- this._dirtyLevel = v ? 2 : 0;
566
+ this._dirtyLevel = v ? 4 : 0;
566
567
  }
567
568
  run() {
568
569
  this._dirtyLevel = 0;
@@ -602,7 +603,7 @@ function preCleanupEffect(effect2) {
602
603
  effect2._depsLength = 0;
603
604
  }
604
605
  function postCleanupEffect(effect2) {
605
- if (effect2.deps && effect2.deps.length > effect2._depsLength) {
606
+ if (effect2.deps.length > effect2._depsLength) {
606
607
  for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
607
608
  cleanupDepEffect(effect2.deps[i], effect2);
608
609
  }
@@ -685,29 +686,26 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
685
686
  var _a;
686
687
  pauseScheduling();
687
688
  for (const effect2 of dep.keys()) {
688
- if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
689
- 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);
690
692
  effect2._dirtyLevel = dirtyLevel;
691
- if (lastDirtyLevel === 0) {
692
- effect2._shouldSchedule = true;
693
- {
694
- (_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);
695
703
  }
696
- effect2.trigger();
697
704
  }
698
705
  }
699
706
  }
700
- scheduleEffects(dep);
701
707
  resetScheduling();
702
708
  }
703
- function scheduleEffects(dep) {
704
- for (const effect2 of dep.keys()) {
705
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
706
- effect2._shouldSchedule = false;
707
- queueEffectSchedulers.push(effect2.scheduler);
708
- }
709
- }
710
- }
711
709
 
712
710
  const createDep = (cleanup, computed) => {
713
711
  const dep = /* @__PURE__ */ new Map();
@@ -790,7 +788,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
790
788
  if (dep) {
791
789
  triggerEffects(
792
790
  dep,
793
- 2,
791
+ 4,
794
792
  {
795
793
  target,
796
794
  type,
@@ -1375,7 +1373,9 @@ function toRaw(observed) {
1375
1373
  return raw ? toRaw(raw) : observed;
1376
1374
  }
1377
1375
  function markRaw(value) {
1378
- def(value, "__v_skip", true);
1376
+ if (Object.isExtensible(value)) {
1377
+ def(value, "__v_skip", true);
1378
+ }
1379
1379
  return value;
1380
1380
  }
1381
1381
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1389,8 +1389,10 @@ class ComputedRefImpl {
1389
1389
  this["__v_isReadonly"] = false;
1390
1390
  this.effect = new ReactiveEffect(
1391
1391
  () => getter(this._value),
1392
- () => triggerRefValue(this, 1),
1393
- () => this.dep && scheduleEffects(this.dep)
1392
+ () => triggerRefValue(
1393
+ this,
1394
+ this.effect._dirtyLevel === 2 ? 2 : 3
1395
+ )
1394
1396
  );
1395
1397
  this.effect.computed = this;
1396
1398
  this.effect.active = this._cacheable = !isSSR;
@@ -1398,14 +1400,12 @@ class ComputedRefImpl {
1398
1400
  }
1399
1401
  get value() {
1400
1402
  const self = toRaw(this);
1401
- if (!self._cacheable || self.effect.dirty) {
1402
- if (hasChanged(self._value, self._value = self.effect.run())) {
1403
- triggerRefValue(self, 2);
1404
- }
1403
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1404
+ triggerRefValue(self, 4);
1405
1405
  }
1406
1406
  trackRefValue(self);
1407
- if (self.effect._dirtyLevel >= 1) {
1408
- triggerRefValue(self, 1);
1407
+ if (self.effect._dirtyLevel >= 2) {
1408
+ triggerRefValue(self, 2);
1409
1409
  }
1410
1410
  return self._value;
1411
1411
  }
@@ -1443,14 +1443,15 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1443
1443
  }
1444
1444
 
1445
1445
  function trackRefValue(ref2) {
1446
+ var _a;
1446
1447
  if (shouldTrack && activeEffect) {
1447
1448
  ref2 = toRaw(ref2);
1448
1449
  trackEffect(
1449
1450
  activeEffect,
1450
- ref2.dep || (ref2.dep = createDep(
1451
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1451
1452
  () => ref2.dep = void 0,
1452
1453
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1453
- )),
1454
+ ),
1454
1455
  {
1455
1456
  target: ref2,
1456
1457
  type: "get",
@@ -1459,7 +1460,7 @@ function trackRefValue(ref2) {
1459
1460
  );
1460
1461
  }
1461
1462
  }
1462
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1463
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1463
1464
  ref2 = toRaw(ref2);
1464
1465
  const dep = ref2.dep;
1465
1466
  if (dep) {
@@ -1508,12 +1509,12 @@ class RefImpl {
1508
1509
  if (hasChanged(newVal, this._rawValue)) {
1509
1510
  this._rawValue = newVal;
1510
1511
  this._value = useDirectValue ? newVal : toReactive(newVal);
1511
- triggerRefValue(this, 2, newVal);
1512
+ triggerRefValue(this, 4, newVal);
1512
1513
  }
1513
1514
  }
1514
1515
  }
1515
1516
  function triggerRef(ref2) {
1516
- triggerRefValue(ref2, 2, ref2.value );
1517
+ triggerRefValue(ref2, 4, ref2.value );
1517
1518
  }
1518
1519
  function unref(ref2) {
1519
1520
  return isRef(ref2) ? ref2.value : ref2;
@@ -6579,7 +6580,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6579
6580
  return vm;
6580
6581
  }
6581
6582
  }
6582
- Vue.version = `2.6.14-compat:${"3.4.15"}`;
6583
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6583
6584
  Vue.config = singletonApp.config;
6584
6585
  Vue.use = (p, ...options) => {
6585
6586
  if (p && isFunction(p.install)) {
@@ -7124,11 +7125,12 @@ If you want to remount the same app, move your app creation logic into a factory
7124
7125
  return app;
7125
7126
  },
7126
7127
  runWithContext(fn) {
7128
+ const lastApp = currentApp;
7127
7129
  currentApp = app;
7128
7130
  try {
7129
7131
  return fn();
7130
7132
  } finally {
7131
- currentApp = null;
7133
+ currentApp = lastApp;
7132
7134
  }
7133
7135
  }
7134
7136
  };
@@ -7786,10 +7788,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7786
7788
  } else {
7787
7789
  const _isString = isString(ref);
7788
7790
  const _isRef = isRef(ref);
7789
- const isVFor = rawRef.f;
7790
7791
  if (_isString || _isRef) {
7791
7792
  const doSet = () => {
7792
- if (isVFor) {
7793
+ if (rawRef.f) {
7793
7794
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
7794
7795
  if (isUnmount) {
7795
7796
  isArray(existing) && remove(existing, refValue);
@@ -7822,11 +7823,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7822
7823
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
7823
7824
  }
7824
7825
  };
7825
- if (isUnmount || isVFor) {
7826
- doSet();
7827
- } else {
7826
+ if (value) {
7828
7827
  doSet.id = -1;
7829
7828
  queuePostRenderEffect(doSet, parentSuspense);
7829
+ } else {
7830
+ doSet();
7830
7831
  }
7831
7832
  } else {
7832
7833
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -8125,7 +8126,7 @@ Server rendered element contains more child nodes than client vdom.`
8125
8126
  if (props) {
8126
8127
  {
8127
8128
  for (const key in props) {
8128
- if (propHasMismatch(el, key, props[key], vnode)) {
8129
+ if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8129
8130
  hasMismatch = true;
8130
8131
  }
8131
8132
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8300,7 +8301,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8300
8301
  };
8301
8302
  return [hydrate, hydrateNode];
8302
8303
  }
8303
- function propHasMismatch(el, key, clientValue, vnode) {
8304
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8305
+ var _a;
8304
8306
  let mismatchType;
8305
8307
  let mismatchKey;
8306
8308
  let actual;
@@ -8323,6 +8325,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8323
8325
  }
8324
8326
  }
8325
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
+ }
8326
8332
  if (!isMapEqual(actualMap, expectedMap)) {
8327
8333
  mismatchType = mismatchKey = "style";
8328
8334
  }
@@ -11413,7 +11419,7 @@ function isMemoSame(cached, memo) {
11413
11419
  return true;
11414
11420
  }
11415
11421
 
11416
- const version = "3.4.15";
11422
+ const version = "3.4.16";
11417
11423
  const warn = warn$1 ;
11418
11424
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11419
11425
  const devtools = devtools$1 ;
@@ -11842,7 +11848,7 @@ const vShow = {
11842
11848
  }
11843
11849
  },
11844
11850
  updated(el, { value, oldValue }, { transition }) {
11845
- if (!value === !oldValue)
11851
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11846
11852
  return;
11847
11853
  if (transition) {
11848
11854
  if (value) {
@@ -11910,6 +11916,7 @@ function patchStyle(el, prev, next) {
11910
11916
  }
11911
11917
  }
11912
11918
  if (vShowOldKey in el) {
11919
+ el[vShowOldKey] = style.display;
11913
11920
  style.display = currentDisplay;
11914
11921
  }
11915
11922
  }
@@ -12759,9 +12766,6 @@ function setSelected(el, value, oldValue, number) {
12759
12766
  );
12760
12767
  return;
12761
12768
  }
12762
- if (isArrayValue && looseEqual(value, oldValue)) {
12763
- return;
12764
- }
12765
12769
  for (let i = 0, l = el.options.length; i < l; i++) {
12766
12770
  const option = el.options[i];
12767
12771
  const optionValue = getValue(option);
@@ -14494,6 +14498,7 @@ const errorMessages = {
14494
14498
  [32]: `v-for has invalid expression.`,
14495
14499
  [33]: `<template v-for> key should be placed on the <template> tag.`,
14496
14500
  [34]: `v-bind is missing expression.`,
14501
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
14497
14502
  [35]: `v-on is missing expression.`,
14498
14503
  [36]: `Unexpected custom directive on <slot> outlet.`,
14499
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.`,
@@ -14514,7 +14519,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14514
14519
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14515
14520
  [50]: `"scopeId" option is only supported in module mode.`,
14516
14521
  // just to fulfill types
14517
- [52]: ``
14522
+ [53]: ``
14518
14523
  };
14519
14524
 
14520
14525
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
@@ -18783,8 +18788,15 @@ function processSlotOutlet(node, context) {
18783
18788
  }
18784
18789
  } else {
18785
18790
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
18786
- if (p.exp)
18791
+ if (p.exp) {
18787
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
+ }
18788
18800
  } else {
18789
18801
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
18790
18802
  p.arg.content = camelize(p.arg.content);
@@ -18924,7 +18936,32 @@ const transformBind = (dir, _node, context) => {
18924
18936
  const { modifiers, loc } = dir;
18925
18937
  const arg = dir.arg;
18926
18938
  let { exp } = dir;
18927
- 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
+ }
18928
18965
  const propName = camelize(arg.content);
18929
18966
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
18930
18967
  {
@@ -18957,12 +18994,6 @@ const transformBind = (dir, _node, context) => {
18957
18994
  injectPrefix(arg, "^");
18958
18995
  }
18959
18996
  }
18960
- if (!exp || exp.type === 4 && !exp.content.trim()) {
18961
- context.onError(createCompilerError(34, loc));
18962
- return {
18963
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
18964
- };
18965
- }
18966
18997
  return {
18967
18998
  props: [createObjectProperty(arg, exp)]
18968
18999
  };