@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
  **/
@@ -443,7 +443,7 @@ class ReactiveEffect {
443
443
  /**
444
444
  * @internal
445
445
  */
446
- this._dirtyLevel = 2;
446
+ this._dirtyLevel = 4;
447
447
  /**
448
448
  * @internal
449
449
  */
@@ -463,26 +463,27 @@ class ReactiveEffect {
463
463
  recordEffectScope(this, scope);
464
464
  }
465
465
  get dirty() {
466
- if (this._dirtyLevel === 1) {
466
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
467
+ this._dirtyLevel = 1;
467
468
  pauseTracking();
468
469
  for (let i = 0; i < this._depsLength; i++) {
469
470
  const dep = this.deps[i];
470
471
  if (dep.computed) {
471
472
  triggerComputed(dep.computed);
472
- if (this._dirtyLevel >= 2) {
473
+ if (this._dirtyLevel >= 4) {
473
474
  break;
474
475
  }
475
476
  }
476
477
  }
477
- if (this._dirtyLevel < 2) {
478
+ if (this._dirtyLevel === 1) {
478
479
  this._dirtyLevel = 0;
479
480
  }
480
481
  resetTracking();
481
482
  }
482
- return this._dirtyLevel >= 2;
483
+ return this._dirtyLevel >= 4;
483
484
  }
484
485
  set dirty(v) {
485
- this._dirtyLevel = v ? 2 : 0;
486
+ this._dirtyLevel = v ? 4 : 0;
486
487
  }
487
488
  run() {
488
489
  this._dirtyLevel = 0;
@@ -522,7 +523,7 @@ function preCleanupEffect(effect2) {
522
523
  effect2._depsLength = 0;
523
524
  }
524
525
  function postCleanupEffect(effect2) {
525
- if (effect2.deps && effect2.deps.length > effect2._depsLength) {
526
+ if (effect2.deps.length > effect2._depsLength) {
526
527
  for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
527
528
  cleanupDepEffect(effect2.deps[i], effect2);
528
529
  }
@@ -600,26 +601,23 @@ const queueEffectSchedulers = [];
600
601
  function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
601
602
  pauseScheduling();
602
603
  for (const effect2 of dep.keys()) {
603
- if (effect2._dirtyLevel < dirtyLevel && dep.get(effect2) === effect2._trackId) {
604
- const lastDirtyLevel = effect2._dirtyLevel;
604
+ let tracking;
605
+ if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
606
+ effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
605
607
  effect2._dirtyLevel = dirtyLevel;
606
- if (lastDirtyLevel === 0) {
607
- effect2._shouldSchedule = true;
608
- effect2.trigger();
608
+ }
609
+ if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
610
+ effect2.trigger();
611
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
612
+ effect2._shouldSchedule = false;
613
+ if (effect2.scheduler) {
614
+ queueEffectSchedulers.push(effect2.scheduler);
615
+ }
609
616
  }
610
617
  }
611
618
  }
612
- scheduleEffects(dep);
613
619
  resetScheduling();
614
620
  }
615
- function scheduleEffects(dep) {
616
- for (const effect2 of dep.keys()) {
617
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse) && dep.get(effect2) === effect2._trackId) {
618
- effect2._shouldSchedule = false;
619
- queueEffectSchedulers.push(effect2.scheduler);
620
- }
621
- }
622
- }
623
621
 
624
622
  const createDep = (cleanup, computed) => {
625
623
  const dep = /* @__PURE__ */ new Map();
@@ -696,7 +694,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
696
694
  if (dep) {
697
695
  triggerEffects(
698
696
  dep,
699
- 2);
697
+ 4);
700
698
  }
701
699
  }
702
700
  resetScheduling();
@@ -1236,7 +1234,9 @@ function toRaw(observed) {
1236
1234
  return raw ? toRaw(raw) : observed;
1237
1235
  }
1238
1236
  function markRaw(value) {
1239
- def(value, "__v_skip", true);
1237
+ if (Object.isExtensible(value)) {
1238
+ def(value, "__v_skip", true);
1239
+ }
1240
1240
  return value;
1241
1241
  }
1242
1242
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1250,8 +1250,10 @@ class ComputedRefImpl {
1250
1250
  this["__v_isReadonly"] = false;
1251
1251
  this.effect = new ReactiveEffect(
1252
1252
  () => getter(this._value),
1253
- () => triggerRefValue(this, 1),
1254
- () => this.dep && scheduleEffects(this.dep)
1253
+ () => triggerRefValue(
1254
+ this,
1255
+ this.effect._dirtyLevel === 2 ? 2 : 3
1256
+ )
1255
1257
  );
1256
1258
  this.effect.computed = this;
1257
1259
  this.effect.active = this._cacheable = !isSSR;
@@ -1259,14 +1261,12 @@ class ComputedRefImpl {
1259
1261
  }
1260
1262
  get value() {
1261
1263
  const self = toRaw(this);
1262
- if (!self._cacheable || self.effect.dirty) {
1263
- if (hasChanged(self._value, self._value = self.effect.run())) {
1264
- triggerRefValue(self, 2);
1265
- }
1264
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1265
+ triggerRefValue(self, 4);
1266
1266
  }
1267
1267
  trackRefValue(self);
1268
- if (self.effect._dirtyLevel >= 1) {
1269
- triggerRefValue(self, 1);
1268
+ if (self.effect._dirtyLevel >= 2) {
1269
+ triggerRefValue(self, 2);
1270
1270
  }
1271
1271
  return self._value;
1272
1272
  }
@@ -1298,17 +1298,18 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1298
1298
  }
1299
1299
 
1300
1300
  function trackRefValue(ref2) {
1301
+ var _a;
1301
1302
  if (shouldTrack && activeEffect) {
1302
1303
  ref2 = toRaw(ref2);
1303
1304
  trackEffect(
1304
1305
  activeEffect,
1305
- ref2.dep || (ref2.dep = createDep(
1306
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1306
1307
  () => ref2.dep = void 0,
1307
1308
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1308
- )));
1309
+ ));
1309
1310
  }
1310
1311
  }
1311
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1312
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1312
1313
  ref2 = toRaw(ref2);
1313
1314
  const dep = ref2.dep;
1314
1315
  if (dep) {
@@ -1350,12 +1351,12 @@ class RefImpl {
1350
1351
  if (hasChanged(newVal, this._rawValue)) {
1351
1352
  this._rawValue = newVal;
1352
1353
  this._value = useDirectValue ? newVal : toReactive(newVal);
1353
- triggerRefValue(this, 2);
1354
+ triggerRefValue(this, 4);
1354
1355
  }
1355
1356
  }
1356
1357
  }
1357
1358
  function triggerRef(ref2) {
1358
- triggerRefValue(ref2, 2);
1359
+ triggerRefValue(ref2, 4);
1359
1360
  }
1360
1361
  function unref(ref2) {
1361
1362
  return isRef(ref2) ? ref2.value : ref2;
@@ -5256,7 +5257,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5256
5257
  return vm;
5257
5258
  }
5258
5259
  }
5259
- Vue.version = `2.6.14-compat:${"3.4.15"}`;
5260
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
5260
5261
  Vue.config = singletonApp.config;
5261
5262
  Vue.use = (p, ...options) => {
5262
5263
  if (p && isFunction(p.install)) {
@@ -5700,11 +5701,12 @@ function createAppAPI(render, hydrate) {
5700
5701
  return app;
5701
5702
  },
5702
5703
  runWithContext(fn) {
5704
+ const lastApp = currentApp;
5703
5705
  currentApp = app;
5704
5706
  try {
5705
5707
  return fn();
5706
5708
  } finally {
5707
- currentApp = null;
5709
+ currentApp = lastApp;
5708
5710
  }
5709
5711
  }
5710
5712
  };
@@ -6204,10 +6206,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6204
6206
  } else {
6205
6207
  const _isString = isString(ref);
6206
6208
  const _isRef = isRef(ref);
6207
- const isVFor = rawRef.f;
6208
6209
  if (_isString || _isRef) {
6209
6210
  const doSet = () => {
6210
- if (isVFor) {
6211
+ if (rawRef.f) {
6211
6212
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
6212
6213
  if (isUnmount) {
6213
6214
  isArray(existing) && remove(existing, refValue);
@@ -6238,11 +6239,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6238
6239
  refs[rawRef.k] = value;
6239
6240
  } else ;
6240
6241
  };
6241
- if (isUnmount || isVFor) {
6242
- doSet();
6243
- } else {
6242
+ if (value) {
6244
6243
  doSet.id = -1;
6245
6244
  queuePostRenderEffect(doSet, parentSuspense);
6245
+ } else {
6246
+ doSet();
6246
6247
  }
6247
6248
  }
6248
6249
  }
@@ -9116,7 +9117,7 @@ function isMemoSame(cached, memo) {
9116
9117
  return true;
9117
9118
  }
9118
9119
 
9119
- const version = "3.4.15";
9120
+ const version = "3.4.16";
9120
9121
  const warn$1 = NOOP;
9121
9122
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9122
9123
  const devtools = void 0;
@@ -9542,7 +9543,7 @@ const vShow = {
9542
9543
  }
9543
9544
  },
9544
9545
  updated(el, { value, oldValue }, { transition }) {
9545
- if (!value === !oldValue)
9546
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
9546
9547
  return;
9547
9548
  if (transition) {
9548
9549
  if (value) {
@@ -9607,6 +9608,7 @@ function patchStyle(el, prev, next) {
9607
9608
  }
9608
9609
  }
9609
9610
  if (vShowOldKey in el) {
9611
+ el[vShowOldKey] = style.display;
9610
9612
  style.display = currentDisplay;
9611
9613
  }
9612
9614
  }
@@ -10410,9 +10412,6 @@ function setSelected(el, value, oldValue, number) {
10410
10412
  if (isMultiple && !isArrayValue && !isSet(value)) {
10411
10413
  return;
10412
10414
  }
10413
- if (isArrayValue && looseEqual(value, oldValue)) {
10414
- return;
10415
- }
10416
10415
  for (let i = 0, l = el.options.length; i < l; i++) {
10417
10416
  const option = el.options[i];
10418
10417
  const optionValue = getValue(option);
@@ -12023,6 +12022,7 @@ const errorMessages = {
12023
12022
  [32]: `v-for has invalid expression.`,
12024
12023
  [33]: `<template v-for> key should be placed on the <template> tag.`,
12025
12024
  [34]: `v-bind is missing expression.`,
12025
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
12026
12026
  [35]: `v-on is missing expression.`,
12027
12027
  [36]: `Unexpected custom directive on <slot> outlet.`,
12028
12028
  [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.`,
@@ -12043,7 +12043,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12043
12043
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12044
12044
  [50]: `"scopeId" option is only supported in module mode.`,
12045
12045
  // just to fulfill types
12046
- [52]: ``
12046
+ [53]: ``
12047
12047
  };
12048
12048
 
12049
12049
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
@@ -16193,8 +16193,15 @@ function processSlotOutlet(node, context) {
16193
16193
  }
16194
16194
  } else {
16195
16195
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
16196
- if (p.exp)
16196
+ if (p.exp) {
16197
16197
  slotName = p.exp;
16198
+ } else if (p.arg && p.arg.type === 4) {
16199
+ const name = camelize(p.arg.content);
16200
+ slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
16201
+ {
16202
+ slotName = p.exp = processExpression(p.exp, context);
16203
+ }
16204
+ }
16198
16205
  } else {
16199
16206
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
16200
16207
  p.arg.content = camelize(p.arg.content);
@@ -16331,7 +16338,32 @@ const transformBind = (dir, _node, context) => {
16331
16338
  const { modifiers, loc } = dir;
16332
16339
  const arg = dir.arg;
16333
16340
  let { exp } = dir;
16334
- if (!exp && arg.type === 4) {
16341
+ if (exp && exp.type === 4 && !exp.content.trim()) {
16342
+ {
16343
+ context.onError(
16344
+ createCompilerError(34, loc)
16345
+ );
16346
+ return {
16347
+ props: [
16348
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
16349
+ ]
16350
+ };
16351
+ }
16352
+ }
16353
+ if (!exp) {
16354
+ if (arg.type !== 4 || !arg.isStatic) {
16355
+ context.onError(
16356
+ createCompilerError(
16357
+ 52,
16358
+ arg.loc
16359
+ )
16360
+ );
16361
+ return {
16362
+ props: [
16363
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
16364
+ ]
16365
+ };
16366
+ }
16335
16367
  const propName = camelize(arg.content);
16336
16368
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
16337
16369
  {
@@ -16364,12 +16396,6 @@ const transformBind = (dir, _node, context) => {
16364
16396
  injectPrefix(arg, "^");
16365
16397
  }
16366
16398
  }
16367
- if (!exp || exp.type === 4 && !exp.content.trim()) {
16368
- context.onError(createCompilerError(34, loc));
16369
- return {
16370
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
16371
- };
16372
- }
16373
16399
  return {
16374
16400
  props: [createObjectProperty(arg, exp)]
16375
16401
  };