@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
- {
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
+ {
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
  {
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
  {
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, ref2.value );
1466
+ triggerRefValue(ref2, 4, ref2.value );
1466
1467
  }
1467
1468
  function unref(ref2) {
1468
1469
  return isRef(ref2) ? ref2.value : ref2;
@@ -6501,7 +6502,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6501
6502
  return vm;
6502
6503
  }
6503
6504
  }
6504
- Vue.version = `2.6.14-compat:${"3.4.15"}`;
6505
+ Vue.version = `2.6.14-compat:${"3.4.16"}`;
6505
6506
  Vue.config = singletonApp.config;
6506
6507
  Vue.use = (p, ...options) => {
6507
6508
  if (p && isFunction(p.install)) {
@@ -7046,11 +7047,12 @@ If you want to remount the same app, move your app creation logic into a factory
7046
7047
  return app;
7047
7048
  },
7048
7049
  runWithContext(fn) {
7050
+ const lastApp = currentApp;
7049
7051
  currentApp = app;
7050
7052
  try {
7051
7053
  return fn();
7052
7054
  } finally {
7053
- currentApp = null;
7055
+ currentApp = lastApp;
7054
7056
  }
7055
7057
  }
7056
7058
  };
@@ -7708,10 +7710,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7708
7710
  } else {
7709
7711
  const _isString = isString(ref);
7710
7712
  const _isRef = isRef(ref);
7711
- const isVFor = rawRef.f;
7712
7713
  if (_isString || _isRef) {
7713
7714
  const doSet = () => {
7714
- if (isVFor) {
7715
+ if (rawRef.f) {
7715
7716
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
7716
7717
  if (isUnmount) {
7717
7718
  isArray(existing) && remove(existing, refValue);
@@ -7744,11 +7745,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7744
7745
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
7745
7746
  }
7746
7747
  };
7747
- if (isUnmount || isVFor) {
7748
- doSet();
7749
- } else {
7748
+ if (value) {
7750
7749
  doSet.id = -1;
7751
7750
  queuePostRenderEffect(doSet, parentSuspense);
7751
+ } else {
7752
+ doSet();
7752
7753
  }
7753
7754
  } else {
7754
7755
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -8047,7 +8048,7 @@ Server rendered element contains more child nodes than client vdom.`
8047
8048
  if (props) {
8048
8049
  {
8049
8050
  for (const key in props) {
8050
- if (propHasMismatch(el, key, props[key], vnode)) {
8051
+ if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8051
8052
  hasMismatch = true;
8052
8053
  }
8053
8054
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8222,7 +8223,8 @@ Server rendered element contains fewer child nodes than client vdom.`
8222
8223
  };
8223
8224
  return [hydrate, hydrateNode];
8224
8225
  }
8225
- function propHasMismatch(el, key, clientValue, vnode) {
8226
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
8227
+ var _a;
8226
8228
  let mismatchType;
8227
8229
  let mismatchKey;
8228
8230
  let actual;
@@ -8245,6 +8247,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
8245
8247
  }
8246
8248
  }
8247
8249
  }
8250
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8251
+ for (const key2 in cssVars) {
8252
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8253
+ }
8248
8254
  if (!isMapEqual(actualMap, expectedMap)) {
8249
8255
  mismatchType = mismatchKey = "style";
8250
8256
  }
@@ -11318,7 +11324,7 @@ function isMemoSame(cached, memo) {
11318
11324
  return true;
11319
11325
  }
11320
11326
 
11321
- const version = "3.4.15";
11327
+ const version = "3.4.16";
11322
11328
  const warn = warn$1 ;
11323
11329
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11324
11330
  const devtools = devtools$1 ;
@@ -11739,7 +11745,7 @@ const vShow = {
11739
11745
  }
11740
11746
  },
11741
11747
  updated(el, { value, oldValue }, { transition }) {
11742
- if (!value === !oldValue)
11748
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
11743
11749
  return;
11744
11750
  if (transition) {
11745
11751
  if (value) {
@@ -11778,6 +11784,9 @@ function useCssVars(getter) {
11778
11784
  document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
11779
11785
  ).forEach((node) => setVarsOnNode(node, vars));
11780
11786
  };
11787
+ {
11788
+ instance.getCssVars = () => getter(instance.proxy);
11789
+ }
11781
11790
  const setVars = () => {
11782
11791
  const vars = getter(instance.proxy);
11783
11792
  setVarsOnVNode(instance.subTree, vars);
@@ -11858,6 +11867,7 @@ function patchStyle(el, prev, next) {
11858
11867
  }
11859
11868
  }
11860
11869
  if (vShowOldKey in el) {
11870
+ el[vShowOldKey] = style.display;
11861
11871
  style.display = currentDisplay;
11862
11872
  }
11863
11873
  }
@@ -12707,9 +12717,6 @@ function setSelected(el, value, oldValue, number) {
12707
12717
  );
12708
12718
  return;
12709
12719
  }
12710
- if (isArrayValue && looseEqual(value, oldValue)) {
12711
- return;
12712
- }
12713
12720
  for (let i = 0, l = el.options.length; i < l; i++) {
12714
12721
  const option = el.options[i];
12715
12722
  const optionValue = getValue(option);
@@ -14354,6 +14361,7 @@ const errorMessages = {
14354
14361
  [32]: `v-for has invalid expression.`,
14355
14362
  [33]: `<template v-for> key should be placed on the <template> tag.`,
14356
14363
  [34]: `v-bind is missing expression.`,
14364
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
14357
14365
  [35]: `v-on is missing expression.`,
14358
14366
  [36]: `Unexpected custom directive on <slot> outlet.`,
14359
14367
  [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.`,
@@ -14374,7 +14382,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14374
14382
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14375
14383
  [50]: `"scopeId" option is only supported in module mode.`,
14376
14384
  // just to fulfill types
14377
- [52]: ``
14385
+ [53]: ``
14378
14386
  };
14379
14387
 
14380
14388
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -15969,8 +15977,7 @@ function generate(ast, options = {}) {
15969
15977
  const helpers = Array.from(ast.helpers);
15970
15978
  const hasHelpers = helpers.length > 0;
15971
15979
  const useWithBlock = !prefixIdentifiers && mode !== "module";
15972
- const isSetupInlined = false;
15973
- const preambleContext = isSetupInlined ? createCodegenContext(ast, options) : context;
15980
+ const preambleContext = context;
15974
15981
  {
15975
15982
  genFunctionPreamble(ast, preambleContext);
15976
15983
  }
@@ -16038,7 +16045,7 @@ function generate(ast, options = {}) {
16038
16045
  return {
16039
16046
  ast,
16040
16047
  code: context.code,
16041
- preamble: isSetupInlined ? preambleContext.code : ``,
16048
+ preamble: ``,
16042
16049
  map: context.map ? context.map.toJSON() : void 0
16043
16050
  };
16044
16051
  }
@@ -17796,8 +17803,12 @@ function processSlotOutlet(node, context) {
17796
17803
  }
17797
17804
  } else {
17798
17805
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
17799
- if (p.exp)
17806
+ if (p.exp) {
17800
17807
  slotName = p.exp;
17808
+ } else if (p.arg && p.arg.type === 4) {
17809
+ const name = camelize(p.arg.content);
17810
+ slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
17811
+ }
17801
17812
  } else {
17802
17813
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
17803
17814
  p.arg.content = camelize(p.arg.content);
@@ -17915,7 +17926,25 @@ const transformBind = (dir, _node, context) => {
17915
17926
  const { modifiers, loc } = dir;
17916
17927
  const arg = dir.arg;
17917
17928
  let { exp } = dir;
17918
- if (!exp && arg.type === 4) {
17929
+ if (exp && exp.type === 4 && !exp.content.trim()) {
17930
+ {
17931
+ exp = void 0;
17932
+ }
17933
+ }
17934
+ if (!exp) {
17935
+ if (arg.type !== 4 || !arg.isStatic) {
17936
+ context.onError(
17937
+ createCompilerError(
17938
+ 52,
17939
+ arg.loc
17940
+ )
17941
+ );
17942
+ return {
17943
+ props: [
17944
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
17945
+ ]
17946
+ };
17947
+ }
17919
17948
  const propName = camelize(arg.content);
17920
17949
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
17921
17950
  }
@@ -17945,12 +17974,6 @@ const transformBind = (dir, _node, context) => {
17945
17974
  injectPrefix(arg, "^");
17946
17975
  }
17947
17976
  }
17948
- if (!exp || exp.type === 4 && !exp.content.trim()) {
17949
- context.onError(createCompilerError(34, loc));
17950
- return {
17951
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
17952
- };
17953
- }
17954
17977
  return {
17955
17978
  props: [createObjectProperty(arg, exp)]
17956
17979
  };