@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.
@@ -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
  **/
@@ -472,7 +472,7 @@ class ReactiveEffect {
472
472
  /**
473
473
  * @internal
474
474
  */
475
- this._dirtyLevel = 2;
475
+ this._dirtyLevel = 4;
476
476
  /**
477
477
  * @internal
478
478
  */
@@ -492,26 +492,27 @@ class ReactiveEffect {
492
492
  recordEffectScope(this, scope);
493
493
  }
494
494
  get dirty() {
495
- if (this._dirtyLevel === 1) {
495
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
496
+ this._dirtyLevel = 1;
496
497
  pauseTracking();
497
498
  for (let i = 0; i < this._depsLength; i++) {
498
499
  const dep = this.deps[i];
499
500
  if (dep.computed) {
500
501
  triggerComputed(dep.computed);
501
- if (this._dirtyLevel >= 2) {
502
+ if (this._dirtyLevel >= 4) {
502
503
  break;
503
504
  }
504
505
  }
505
506
  }
506
- if (this._dirtyLevel < 2) {
507
+ if (this._dirtyLevel === 1) {
507
508
  this._dirtyLevel = 0;
508
509
  }
509
510
  resetTracking();
510
511
  }
511
- return this._dirtyLevel >= 2;
512
+ return this._dirtyLevel >= 4;
512
513
  }
513
514
  set dirty(v) {
514
- this._dirtyLevel = v ? 2 : 0;
515
+ this._dirtyLevel = v ? 4 : 0;
515
516
  }
516
517
  run() {
517
518
  this._dirtyLevel = 0;
@@ -551,7 +552,7 @@ function preCleanupEffect(effect2) {
551
552
  effect2._depsLength = 0;
552
553
  }
553
554
  function postCleanupEffect(effect2) {
554
- if (effect2.deps && effect2.deps.length > effect2._depsLength) {
555
+ if (effect2.deps.length > effect2._depsLength) {
555
556
  for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
556
557
  cleanupDepEffect(effect2.deps[i], effect2);
557
558
  }
@@ -634,29 +635,26 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
634
635
  var _a;
635
636
  pauseScheduling();
636
637
  for (const effect2 of dep.keys()) {
637
- if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
638
- const lastDirtyLevel = effect2._dirtyLevel;
638
+ let tracking;
639
+ if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
640
+ effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
639
641
  effect2._dirtyLevel = dirtyLevel;
640
- if (lastDirtyLevel === 0) {
641
- effect2._shouldSchedule = true;
642
- if (!!(process.env.NODE_ENV !== "production")) {
643
- (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
642
+ }
643
+ if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
644
+ if (!!(process.env.NODE_ENV !== "production")) {
645
+ (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
646
+ }
647
+ effect2.trigger();
648
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
649
+ effect2._shouldSchedule = false;
650
+ if (effect2.scheduler) {
651
+ queueEffectSchedulers.push(effect2.scheduler);
644
652
  }
645
- effect2.trigger();
646
653
  }
647
654
  }
648
655
  }
649
- scheduleEffects(dep);
650
656
  resetScheduling();
651
657
  }
652
- function scheduleEffects(dep) {
653
- for (const effect2 of dep.keys()) {
654
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
655
- effect2._shouldSchedule = false;
656
- queueEffectSchedulers.push(effect2.scheduler);
657
- }
658
- }
659
- }
660
658
 
661
659
  const createDep = (cleanup, computed) => {
662
660
  const dep = /* @__PURE__ */ new Map();
@@ -739,7 +737,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
739
737
  if (dep) {
740
738
  triggerEffects(
741
739
  dep,
742
- 2,
740
+ 4,
743
741
  !!(process.env.NODE_ENV !== "production") ? {
744
742
  target,
745
743
  type,
@@ -1324,7 +1322,9 @@ function toRaw(observed) {
1324
1322
  return raw ? toRaw(raw) : observed;
1325
1323
  }
1326
1324
  function markRaw(value) {
1327
- def(value, "__v_skip", true);
1325
+ if (Object.isExtensible(value)) {
1326
+ def(value, "__v_skip", true);
1327
+ }
1328
1328
  return value;
1329
1329
  }
1330
1330
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1338,8 +1338,10 @@ class ComputedRefImpl {
1338
1338
  this["__v_isReadonly"] = false;
1339
1339
  this.effect = new ReactiveEffect(
1340
1340
  () => getter(this._value),
1341
- () => triggerRefValue(this, 1),
1342
- () => this.dep && scheduleEffects(this.dep)
1341
+ () => triggerRefValue(
1342
+ this,
1343
+ this.effect._dirtyLevel === 2 ? 2 : 3
1344
+ )
1343
1345
  );
1344
1346
  this.effect.computed = this;
1345
1347
  this.effect.active = this._cacheable = !isSSR;
@@ -1347,14 +1349,12 @@ class ComputedRefImpl {
1347
1349
  }
1348
1350
  get value() {
1349
1351
  const self = toRaw(this);
1350
- if (!self._cacheable || self.effect.dirty) {
1351
- if (hasChanged(self._value, self._value = self.effect.run())) {
1352
- triggerRefValue(self, 2);
1353
- }
1352
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1353
+ triggerRefValue(self, 4);
1354
1354
  }
1355
1355
  trackRefValue(self);
1356
- if (self.effect._dirtyLevel >= 1) {
1357
- triggerRefValue(self, 1);
1356
+ if (self.effect._dirtyLevel >= 2) {
1357
+ triggerRefValue(self, 2);
1358
1358
  }
1359
1359
  return self._value;
1360
1360
  }
@@ -1392,14 +1392,15 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1392
1392
  }
1393
1393
 
1394
1394
  function trackRefValue(ref2) {
1395
+ var _a;
1395
1396
  if (shouldTrack && activeEffect) {
1396
1397
  ref2 = toRaw(ref2);
1397
1398
  trackEffect(
1398
1399
  activeEffect,
1399
- ref2.dep || (ref2.dep = createDep(
1400
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1400
1401
  () => ref2.dep = void 0,
1401
1402
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1402
- )),
1403
+ ),
1403
1404
  !!(process.env.NODE_ENV !== "production") ? {
1404
1405
  target: ref2,
1405
1406
  type: "get",
@@ -1408,7 +1409,7 @@ function trackRefValue(ref2) {
1408
1409
  );
1409
1410
  }
1410
1411
  }
1411
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1412
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1412
1413
  ref2 = toRaw(ref2);
1413
1414
  const dep = ref2.dep;
1414
1415
  if (dep) {
@@ -1457,12 +1458,12 @@ class RefImpl {
1457
1458
  if (hasChanged(newVal, this._rawValue)) {
1458
1459
  this._rawValue = newVal;
1459
1460
  this._value = useDirectValue ? newVal : toReactive(newVal);
1460
- triggerRefValue(this, 2, newVal);
1461
+ triggerRefValue(this, 4, newVal);
1461
1462
  }
1462
1463
  }
1463
1464
  }
1464
1465
  function triggerRef(ref2) {
1465
- triggerRefValue(ref2, 2, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1466
+ triggerRefValue(ref2, 4, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1466
1467
  }
1467
1468
  function unref(ref2) {
1468
1469
  return isRef(ref2) ? ref2.value : ref2;
@@ -6539,7 +6540,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6539
6540
  return vm;
6540
6541
  }
6541
6542
  }
6542
- Vue.version = `2.6.14-compat:${"3.4.15"}`;
6543
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6543
6544
  Vue.config = singletonApp.config;
6544
6545
  Vue.use = (p, ...options) => {
6545
6546
  if (p && isFunction(p.install)) {
@@ -7087,11 +7088,12 @@ If you want to remount the same app, move your app creation logic into a factory
7087
7088
  return app;
7088
7089
  },
7089
7090
  runWithContext(fn) {
7091
+ const lastApp = currentApp;
7090
7092
  currentApp = app;
7091
7093
  try {
7092
7094
  return fn();
7093
7095
  } finally {
7094
- currentApp = null;
7096
+ currentApp = lastApp;
7095
7097
  }
7096
7098
  }
7097
7099
  };
@@ -7749,10 +7751,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7749
7751
  } else {
7750
7752
  const _isString = isString(ref);
7751
7753
  const _isRef = isRef(ref);
7752
- const isVFor = rawRef.f;
7753
7754
  if (_isString || _isRef) {
7754
7755
  const doSet = () => {
7755
- if (isVFor) {
7756
+ if (rawRef.f) {
7756
7757
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
7757
7758
  if (isUnmount) {
7758
7759
  isArray(existing) && remove(existing, refValue);
@@ -7785,11 +7786,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7785
7786
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
7786
7787
  }
7787
7788
  };
7788
- if (isUnmount || isVFor) {
7789
- doSet();
7790
- } else {
7789
+ if (value) {
7791
7790
  doSet.id = -1;
7792
7791
  queuePostRenderEffect(doSet, parentSuspense);
7792
+ } else {
7793
+ doSet();
7793
7794
  }
7794
7795
  } else if (!!(process.env.NODE_ENV !== "production")) {
7795
7796
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -8088,7 +8089,7 @@ Server rendered element contains more child nodes than client vdom.`
8088
8089
  if (props) {
8089
8090
  if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
8090
8091
  for (const key in props) {
8091
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode)) {
8092
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8092
8093
  hasMismatch = true;
8093
8094
  }
8094
8095
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8273,7 +8274,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8273
8274
  };
8274
8275
  return [hydrate, hydrateNode];
8275
8276
  }
8276
- function propHasMismatch(el, key, clientValue, vnode) {
8277
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8278
+ var _a;
8277
8279
  let mismatchType;
8278
8280
  let mismatchKey;
8279
8281
  let actual;
@@ -8296,6 +8298,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8296
8298
  }
8297
8299
  }
8298
8300
  }
8301
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8302
+ for (const key2 in cssVars) {
8303
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8304
+ }
8299
8305
  if (!isMapEqual(actualMap, expectedMap)) {
8300
8306
  mismatchType = mismatchKey = "style";
8301
8307
  }
@@ -11440,7 +11446,7 @@ function isMemoSame(cached, memo) {
11440
11446
  return true;
11441
11447
  }
11442
11448
 
11443
- const version = "3.4.15";
11449
+ const version = "3.4.16";
11444
11450
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11445
11451
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11446
11452
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11869,7 +11875,7 @@ const vShow = {
11869
11875
  }
11870
11876
  },
11871
11877
  updated(el, { value, oldValue }, { transition }) {
11872
- if (!value === !oldValue)
11878
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11873
11879
  return;
11874
11880
  if (transition) {
11875
11881
  if (value) {
@@ -11915,6 +11921,9 @@ function useCssVars(getter) {
11915
11921
  document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11916
11922
  ).forEach((node) => setVarsOnNode(node, vars));
11917
11923
  };
11924
+ if (!!(process.env.NODE_ENV !== "production")) {
11925
+ instance.getCssVars = () => getter(instance.proxy);
11926
+ }
11918
11927
  const setVars = () => {
11919
11928
  const vars = getter(instance.proxy);
11920
11929
  setVarsOnVNode(instance.subTree, vars);
@@ -11995,6 +12004,7 @@ function patchStyle(el, prev, next) {
11995
12004
  }
11996
12005
  }
11997
12006
  if (vShowOldKey in el) {
12007
+ el[vShowOldKey] = style.display;
11998
12008
  style.display = currentDisplay;
11999
12009
  }
12000
12010
  }
@@ -12844,9 +12854,6 @@ function setSelected(el, value, oldValue, number) {
12844
12854
  );
12845
12855
  return;
12846
12856
  }
12847
- if (isArrayValue && looseEqual(value, oldValue)) {
12848
- return;
12849
- }
12850
12857
  for (let i = 0, l = el.options.length; i < l; i++) {
12851
12858
  const option = el.options[i];
12852
12859
  const optionValue = getValue(option);
@@ -14526,6 +14533,7 @@ const errorMessages = {
14526
14533
  [32]: `v-for has invalid expression.`,
14527
14534
  [33]: `<template v-for> key should be placed on the <template> tag.`,
14528
14535
  [34]: `v-bind is missing expression.`,
14536
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
14529
14537
  [35]: `v-on is missing expression.`,
14530
14538
  [36]: `Unexpected custom directive on <slot> outlet.`,
14531
14539
  [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.`,
@@ -14546,7 +14554,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14546
14554
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14547
14555
  [50]: `"scopeId" option is only supported in module mode.`,
14548
14556
  // just to fulfill types
14549
- [52]: ``
14557
+ [53]: ``
14550
14558
  };
14551
14559
 
14552
14560
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -16142,8 +16150,7 @@ function generate(ast, options = {}) {
16142
16150
  const helpers = Array.from(ast.helpers);
16143
16151
  const hasHelpers = helpers.length > 0;
16144
16152
  const useWithBlock = !prefixIdentifiers && mode !== "module";
16145
- const isSetupInlined = false;
16146
- const preambleContext = isSetupInlined ? createCodegenContext(ast, options) : context;
16153
+ const preambleContext = context;
16147
16154
  {
16148
16155
  genFunctionPreamble(ast, preambleContext);
16149
16156
  }
@@ -16211,7 +16218,7 @@ function generate(ast, options = {}) {
16211
16218
  return {
16212
16219
  ast,
16213
16220
  code: context.code,
16214
- preamble: isSetupInlined ? preambleContext.code : ``,
16221
+ preamble: ``,
16215
16222
  map: context.map ? context.map.toJSON() : void 0
16216
16223
  };
16217
16224
  }
@@ -17971,8 +17978,12 @@ function processSlotOutlet(node, context) {
17971
17978
  }
17972
17979
  } else {
17973
17980
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
17974
- if (p.exp)
17981
+ if (p.exp) {
17975
17982
  slotName = p.exp;
17983
+ } else if (p.arg && p.arg.type === 4) {
17984
+ const name = camelize(p.arg.content);
17985
+ slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
17986
+ }
17976
17987
  } else {
17977
17988
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
17978
17989
  p.arg.content = camelize(p.arg.content);
@@ -18090,7 +18101,25 @@ const transformBind = (dir, _node, context) => {
18090
18101
  const { modifiers, loc } = dir;
18091
18102
  const arg = dir.arg;
18092
18103
  let { exp } = dir;
18093
- if (!exp && arg.type === 4) {
18104
+ if (exp && exp.type === 4 && !exp.content.trim()) {
18105
+ {
18106
+ exp = void 0;
18107
+ }
18108
+ }
18109
+ if (!exp) {
18110
+ if (arg.type !== 4 || !arg.isStatic) {
18111
+ context.onError(
18112
+ createCompilerError(
18113
+ 52,
18114
+ arg.loc
18115
+ )
18116
+ );
18117
+ return {
18118
+ props: [
18119
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
18120
+ ]
18121
+ };
18122
+ }
18094
18123
  const propName = camelize(arg.content);
18095
18124
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
18096
18125
  }
@@ -18120,12 +18149,6 @@ const transformBind = (dir, _node, context) => {
18120
18149
  injectPrefix(arg, "^");
18121
18150
  }
18122
18151
  }
18123
- if (!exp || exp.type === 4 && !exp.content.trim()) {
18124
- context.onError(createCompilerError(34, loc));
18125
- return {
18126
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
18127
- };
18128
- }
18129
18152
  return {
18130
18153
  props: [createObjectProperty(arg, exp)]
18131
18154
  };