@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
  **/
@@ -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,20 +601,19 @@ const queueEffectSchedulers = [];
600
601
  function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
601
602
  pauseScheduling();
602
603
  for (const effect2 of dep.keys()) {
603
- if (dep.get(effect2) !== effect2._trackId) {
604
- continue;
605
- }
606
- if (effect2._dirtyLevel < dirtyLevel && !(effect2._runnings && !effect2.allowRecurse)) {
607
- 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);
608
607
  effect2._dirtyLevel = dirtyLevel;
609
- if (lastDirtyLevel === 0) {
610
- effect2._shouldSchedule = true;
611
- effect2.trigger();
612
- }
613
608
  }
614
- if (effect2.scheduler && effect2._shouldSchedule && (!effect2._runnings || effect2.allowRecurse)) {
615
- effect2._shouldSchedule = false;
616
- queueEffectSchedulers.push(effect2.scheduler);
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
+ }
616
+ }
617
617
  }
618
618
  }
619
619
  resetScheduling();
@@ -694,7 +694,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
694
694
  if (dep) {
695
695
  triggerEffects(
696
696
  dep,
697
- 2);
697
+ 4);
698
698
  }
699
699
  }
700
700
  resetScheduling();
@@ -1234,7 +1234,9 @@ function toRaw(observed) {
1234
1234
  return raw ? toRaw(raw) : observed;
1235
1235
  }
1236
1236
  function markRaw(value) {
1237
- def(value, "__v_skip", true);
1237
+ if (Object.isExtensible(value)) {
1238
+ def(value, "__v_skip", true);
1239
+ }
1238
1240
  return value;
1239
1241
  }
1240
1242
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
@@ -1248,7 +1250,10 @@ class ComputedRefImpl {
1248
1250
  this["__v_isReadonly"] = false;
1249
1251
  this.effect = new ReactiveEffect(
1250
1252
  () => getter(this._value),
1251
- () => triggerRefValue(this, 1)
1253
+ () => triggerRefValue(
1254
+ this,
1255
+ this.effect._dirtyLevel === 2 ? 2 : 3
1256
+ )
1252
1257
  );
1253
1258
  this.effect.computed = this;
1254
1259
  this.effect.active = this._cacheable = !isSSR;
@@ -1256,12 +1261,13 @@ class ComputedRefImpl {
1256
1261
  }
1257
1262
  get value() {
1258
1263
  const self = toRaw(this);
1259
- if (!self._cacheable || self.effect.dirty) {
1260
- if (hasChanged(self._value, self._value = self.effect.run())) {
1261
- triggerRefValue(self, 2);
1262
- }
1264
+ if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1265
+ triggerRefValue(self, 4);
1263
1266
  }
1264
1267
  trackRefValue(self);
1268
+ if (self.effect._dirtyLevel >= 2) {
1269
+ triggerRefValue(self, 2);
1270
+ }
1265
1271
  return self._value;
1266
1272
  }
1267
1273
  set value(newValue) {
@@ -1292,17 +1298,18 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1292
1298
  }
1293
1299
 
1294
1300
  function trackRefValue(ref2) {
1301
+ var _a;
1295
1302
  if (shouldTrack && activeEffect) {
1296
1303
  ref2 = toRaw(ref2);
1297
1304
  trackEffect(
1298
1305
  activeEffect,
1299
- ref2.dep || (ref2.dep = createDep(
1306
+ (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
1300
1307
  () => ref2.dep = void 0,
1301
1308
  ref2 instanceof ComputedRefImpl ? ref2 : void 0
1302
- )));
1309
+ ));
1303
1310
  }
1304
1311
  }
1305
- function triggerRefValue(ref2, dirtyLevel = 2, newVal) {
1312
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
1306
1313
  ref2 = toRaw(ref2);
1307
1314
  const dep = ref2.dep;
1308
1315
  if (dep) {
@@ -1344,12 +1351,12 @@ class RefImpl {
1344
1351
  if (hasChanged(newVal, this._rawValue)) {
1345
1352
  this._rawValue = newVal;
1346
1353
  this._value = useDirectValue ? newVal : toReactive(newVal);
1347
- triggerRefValue(this, 2);
1354
+ triggerRefValue(this, 4);
1348
1355
  }
1349
1356
  }
1350
1357
  }
1351
1358
  function triggerRef(ref2) {
1352
- triggerRefValue(ref2, 2);
1359
+ triggerRefValue(ref2, 4);
1353
1360
  }
1354
1361
  function unref(ref2) {
1355
1362
  return isRef(ref2) ? ref2.value : ref2;
@@ -1553,7 +1560,7 @@ function handleError(err, instance, type, throwInDev = true) {
1553
1560
  if (instance) {
1554
1561
  let cur = instance.parent;
1555
1562
  const exposedInstance = instance.proxy;
1556
- const errorInfo = `https://vuejs.org/errors/#runtime-${type}`;
1563
+ const errorInfo = `https://vuejs.org/error-reference/#runtime-${type}`;
1557
1564
  while (cur) {
1558
1565
  const errorCapturedHooks = cur.ec;
1559
1566
  if (errorCapturedHooks) {
@@ -5250,7 +5257,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5250
5257
  return vm;
5251
5258
  }
5252
5259
  }
5253
- Vue.version = `2.6.14-compat:${"3.4.14"}`;
5260
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
5254
5261
  Vue.config = singletonApp.config;
5255
5262
  Vue.use = (p, ...options) => {
5256
5263
  if (p && isFunction(p.install)) {
@@ -5694,11 +5701,12 @@ function createAppAPI(render, hydrate) {
5694
5701
  return app;
5695
5702
  },
5696
5703
  runWithContext(fn) {
5704
+ const lastApp = currentApp;
5697
5705
  currentApp = app;
5698
5706
  try {
5699
5707
  return fn();
5700
5708
  } finally {
5701
- currentApp = null;
5709
+ currentApp = lastApp;
5702
5710
  }
5703
5711
  }
5704
5712
  };
@@ -9109,7 +9117,7 @@ function isMemoSame(cached, memo) {
9109
9117
  return true;
9110
9118
  }
9111
9119
 
9112
- const version = "3.4.14";
9120
+ const version = "3.4.16";
9113
9121
  const warn$1 = NOOP;
9114
9122
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9115
9123
  const devtools = void 0;
@@ -9535,7 +9543,7 @@ const vShow = {
9535
9543
  }
9536
9544
  },
9537
9545
  updated(el, { value, oldValue }, { transition }) {
9538
- if (!value === !oldValue)
9546
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
9539
9547
  return;
9540
9548
  if (transition) {
9541
9549
  if (value) {
@@ -9600,6 +9608,7 @@ function patchStyle(el, prev, next) {
9600
9608
  }
9601
9609
  }
9602
9610
  if (vShowOldKey in el) {
9611
+ el[vShowOldKey] = style.display;
9603
9612
  style.display = currentDisplay;
9604
9613
  }
9605
9614
  }
@@ -10376,32 +10385,46 @@ const vModelSelect = {
10376
10385
  el[assignKey](
10377
10386
  el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
10378
10387
  );
10388
+ el._assigning = true;
10389
+ nextTick(() => {
10390
+ el._assigning = false;
10391
+ });
10379
10392
  });
10380
10393
  el[assignKey] = getModelAssigner(vnode);
10381
10394
  },
10382
10395
  // set value in mounted & updated because <select> relies on its children
10383
10396
  // <option>s.
10384
- mounted(el, { value }) {
10385
- setSelected(el, value);
10397
+ mounted(el, { value, oldValue, modifiers: { number } }) {
10398
+ setSelected(el, value, oldValue, number);
10386
10399
  },
10387
10400
  beforeUpdate(el, _binding, vnode) {
10388
10401
  el[assignKey] = getModelAssigner(vnode);
10389
10402
  },
10390
- updated(el, { value }) {
10391
- setSelected(el, value);
10403
+ updated(el, { value, oldValue, modifiers: { number } }) {
10404
+ if (!el._assigning) {
10405
+ setSelected(el, value, oldValue, number);
10406
+ }
10392
10407
  }
10393
10408
  };
10394
- function setSelected(el, value) {
10409
+ function setSelected(el, value, oldValue, number) {
10395
10410
  const isMultiple = el.multiple;
10396
- if (isMultiple && !isArray(value) && !isSet(value)) {
10411
+ const isArrayValue = isArray(value);
10412
+ if (isMultiple && !isArrayValue && !isSet(value)) {
10397
10413
  return;
10398
10414
  }
10399
10415
  for (let i = 0, l = el.options.length; i < l; i++) {
10400
10416
  const option = el.options[i];
10401
10417
  const optionValue = getValue(option);
10402
10418
  if (isMultiple) {
10403
- if (isArray(value)) {
10404
- option.selected = looseIndexOf(value, optionValue) > -1;
10419
+ if (isArrayValue) {
10420
+ const optionType = typeof optionValue;
10421
+ if (optionType === "string" || optionType === "number") {
10422
+ option.selected = value.includes(
10423
+ number ? looseToNumber(optionValue) : optionValue
10424
+ );
10425
+ } else {
10426
+ option.selected = looseIndexOf(value, optionValue) > -1;
10427
+ }
10405
10428
  } else {
10406
10429
  option.selected = value.has(optionValue);
10407
10430
  }
@@ -11999,6 +12022,7 @@ const errorMessages = {
11999
12022
  [32]: `v-for has invalid expression.`,
12000
12023
  [33]: `<template v-for> key should be placed on the <template> tag.`,
12001
12024
  [34]: `v-bind is missing expression.`,
12025
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
12002
12026
  [35]: `v-on is missing expression.`,
12003
12027
  [36]: `Unexpected custom directive on <slot> outlet.`,
12004
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.`,
@@ -12019,7 +12043,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12019
12043
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12020
12044
  [50]: `"scopeId" option is only supported in module mode.`,
12021
12045
  // just to fulfill types
12022
- [52]: ``
12046
+ [53]: ``
12023
12047
  };
12024
12048
 
12025
12049
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
@@ -16169,8 +16193,15 @@ function processSlotOutlet(node, context) {
16169
16193
  }
16170
16194
  } else {
16171
16195
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
16172
- if (p.exp)
16196
+ if (p.exp) {
16173
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
+ }
16174
16205
  } else {
16175
16206
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
16176
16207
  p.arg.content = camelize(p.arg.content);
@@ -16307,7 +16338,32 @@ const transformBind = (dir, _node, context) => {
16307
16338
  const { modifiers, loc } = dir;
16308
16339
  const arg = dir.arg;
16309
16340
  let { exp } = dir;
16310
- 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
+ }
16311
16367
  const propName = camelize(arg.content);
16312
16368
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
16313
16369
  {
@@ -16340,12 +16396,6 @@ const transformBind = (dir, _node, context) => {
16340
16396
  injectPrefix(arg, "^");
16341
16397
  }
16342
16398
  }
16343
- if (!exp || exp.type === 4 && !exp.content.trim()) {
16344
- context.onError(createCompilerError(34, loc));
16345
- return {
16346
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
16347
- };
16348
- }
16349
16399
  return {
16350
16400
  props: [createObjectProperty(arg, exp)]
16351
16401
  };