vue 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 v3.4.15
2
+ * vue v3.4.16
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.4.15
2
+ * vue v3.4.16
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.4.15
2
+ * vue 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;
@@ -5493,11 +5494,12 @@ If you want to remount the same app, move your app creation logic into a factory
5493
5494
  return app;
5494
5495
  },
5495
5496
  runWithContext(fn) {
5497
+ const lastApp = currentApp;
5496
5498
  currentApp = app;
5497
5499
  try {
5498
5500
  return fn();
5499
5501
  } finally {
5500
- currentApp = null;
5502
+ currentApp = lastApp;
5501
5503
  }
5502
5504
  }
5503
5505
  };
@@ -6078,10 +6080,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6078
6080
  } else {
6079
6081
  const _isString = isString(ref);
6080
6082
  const _isRef = isRef(ref);
6081
- const isVFor = rawRef.f;
6082
6083
  if (_isString || _isRef) {
6083
6084
  const doSet = () => {
6084
- if (isVFor) {
6085
+ if (rawRef.f) {
6085
6086
  const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
6086
6087
  if (isUnmount) {
6087
6088
  isArray(existing) && remove(existing, refValue);
@@ -6114,11 +6115,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6114
6115
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
6115
6116
  }
6116
6117
  };
6117
- if (isUnmount || isVFor) {
6118
- doSet();
6119
- } else {
6118
+ if (value) {
6120
6119
  doSet.id = -1;
6121
6120
  queuePostRenderEffect(doSet, parentSuspense);
6121
+ } else {
6122
+ doSet();
6122
6123
  }
6123
6124
  } else {
6124
6125
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6417,7 +6418,7 @@ Server rendered element contains more child nodes than client vdom.`
6417
6418
  if (props) {
6418
6419
  {
6419
6420
  for (const key in props) {
6420
- if (propHasMismatch(el, key, props[key], vnode)) {
6421
+ if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
6421
6422
  hasMismatch = true;
6422
6423
  }
6423
6424
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6592,7 +6593,8 @@ Server rendered element contains fewer child nodes than client vdom.`
6592
6593
  };
6593
6594
  return [hydrate, hydrateNode];
6594
6595
  }
6595
- function propHasMismatch(el, key, clientValue, vnode) {
6596
+ function propHasMismatch(el, key, clientValue, vnode, instance) {
6597
+ var _a;
6596
6598
  let mismatchType;
6597
6599
  let mismatchKey;
6598
6600
  let actual;
@@ -6615,6 +6617,10 @@ function propHasMismatch(el, key, clientValue, vnode) {
6615
6617
  }
6616
6618
  }
6617
6619
  }
6620
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
6621
+ for (const key2 in cssVars) {
6622
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
6623
+ }
6618
6624
  if (!isMapEqual(actualMap, expectedMap)) {
6619
6625
  mismatchType = mismatchKey = "style";
6620
6626
  }
@@ -9581,7 +9587,7 @@ function isMemoSame(cached, memo) {
9581
9587
  return true;
9582
9588
  }
9583
9589
 
9584
- const version = "3.4.15";
9590
+ const version = "3.4.16";
9585
9591
  const warn = warn$1 ;
9586
9592
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9587
9593
  const devtools = devtools$1 ;
@@ -9958,7 +9964,7 @@ const vShow = {
9958
9964
  }
9959
9965
  },
9960
9966
  updated(el, { value, oldValue }, { transition }) {
9961
- if (!value === !oldValue)
9967
+ if (!value === !oldValue && el.style.display === el[vShowOldKey])
9962
9968
  return;
9963
9969
  if (transition) {
9964
9970
  if (value) {
@@ -9997,6 +10003,9 @@ function useCssVars(getter) {
9997
10003
  document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
9998
10004
  ).forEach((node) => setVarsOnNode(node, vars));
9999
10005
  };
10006
+ {
10007
+ instance.getCssVars = () => getter(instance.proxy);
10008
+ }
10000
10009
  const setVars = () => {
10001
10010
  const vars = getter(instance.proxy);
10002
10011
  setVarsOnVNode(instance.subTree, vars);
@@ -10077,6 +10086,7 @@ function patchStyle(el, prev, next) {
10077
10086
  }
10078
10087
  }
10079
10088
  if (vShowOldKey in el) {
10089
+ el[vShowOldKey] = style.display;
10080
10090
  style.display = currentDisplay;
10081
10091
  }
10082
10092
  }
@@ -10874,9 +10884,6 @@ function setSelected(el, value, oldValue, number) {
10874
10884
  );
10875
10885
  return;
10876
10886
  }
10877
- if (isArrayValue && looseEqual(value, oldValue)) {
10878
- return;
10879
- }
10880
10887
  for (let i = 0, l = el.options.length; i < l; i++) {
10881
10888
  const option = el.options[i];
10882
10889
  const optionValue = getValue(option);
@@ -12385,6 +12392,7 @@ const errorMessages = {
12385
12392
  [32]: `v-for has invalid expression.`,
12386
12393
  [33]: `<template v-for> key should be placed on the <template> tag.`,
12387
12394
  [34]: `v-bind is missing expression.`,
12395
+ [52]: `v-bind with same-name shorthand only allows static argument.`,
12388
12396
  [35]: `v-on is missing expression.`,
12389
12397
  [36]: `Unexpected custom directive on <slot> outlet.`,
12390
12398
  [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.`,
@@ -12405,7 +12413,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12405
12413
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12406
12414
  [50]: `"scopeId" option is only supported in module mode.`,
12407
12415
  // just to fulfill types
12408
- [52]: ``
12416
+ [53]: ``
12409
12417
  };
12410
12418
 
12411
12419
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -13913,8 +13921,7 @@ function generate(ast, options = {}) {
13913
13921
  const helpers = Array.from(ast.helpers);
13914
13922
  const hasHelpers = helpers.length > 0;
13915
13923
  const useWithBlock = !prefixIdentifiers && mode !== "module";
13916
- const isSetupInlined = false;
13917
- const preambleContext = isSetupInlined ? createCodegenContext(ast, options) : context;
13924
+ const preambleContext = context;
13918
13925
  {
13919
13926
  genFunctionPreamble(ast, preambleContext);
13920
13927
  }
@@ -13977,7 +13984,7 @@ function generate(ast, options = {}) {
13977
13984
  return {
13978
13985
  ast,
13979
13986
  code: context.code,
13980
- preamble: isSetupInlined ? preambleContext.code : ``,
13987
+ preamble: ``,
13981
13988
  map: context.map ? context.map.toJSON() : void 0
13982
13989
  };
13983
13990
  }
@@ -15690,8 +15697,12 @@ function processSlotOutlet(node, context) {
15690
15697
  }
15691
15698
  } else {
15692
15699
  if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
15693
- if (p.exp)
15700
+ if (p.exp) {
15694
15701
  slotName = p.exp;
15702
+ } else if (p.arg && p.arg.type === 4) {
15703
+ const name = camelize(p.arg.content);
15704
+ slotName = p.exp = createSimpleExpression(name, false, p.arg.loc);
15705
+ }
15695
15706
  } else {
15696
15707
  if (p.name === "bind" && p.arg && isStaticExp(p.arg)) {
15697
15708
  p.arg.content = camelize(p.arg.content);
@@ -15809,7 +15820,25 @@ const transformBind = (dir, _node, context) => {
15809
15820
  const { modifiers, loc } = dir;
15810
15821
  const arg = dir.arg;
15811
15822
  let { exp } = dir;
15812
- if (!exp && arg.type === 4) {
15823
+ if (exp && exp.type === 4 && !exp.content.trim()) {
15824
+ {
15825
+ exp = void 0;
15826
+ }
15827
+ }
15828
+ if (!exp) {
15829
+ if (arg.type !== 4 || !arg.isStatic) {
15830
+ context.onError(
15831
+ createCompilerError(
15832
+ 52,
15833
+ arg.loc
15834
+ )
15835
+ );
15836
+ return {
15837
+ props: [
15838
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
15839
+ ]
15840
+ };
15841
+ }
15813
15842
  const propName = camelize(arg.content);
15814
15843
  exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
15815
15844
  }
@@ -15839,12 +15868,6 @@ const transformBind = (dir, _node, context) => {
15839
15868
  injectPrefix(arg, "^");
15840
15869
  }
15841
15870
  }
15842
- if (!exp || exp.type === 4 && !exp.content.trim()) {
15843
- context.onError(createCompilerError(34, loc));
15844
- return {
15845
- props: [createObjectProperty(arg, createSimpleExpression("", true, loc))]
15846
- };
15847
- }
15848
15871
  return {
15849
15872
  props: [createObjectProperty(arg, exp)]
15850
15873
  };