vue 3.4.29 → 3.4.31

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.29
2
+ * vue v3.4.31
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.29
2
+ * vue v3.4.31
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.29
2
+ * vue v3.4.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -327,11 +327,14 @@ function looseIndexOf(arr, val) {
327
327
  return arr.findIndex((item) => looseEqual(item, val));
328
328
  }
329
329
 
330
+ const isRef$1 = (val) => {
331
+ return !!(val && val.__v_isRef === true);
332
+ };
330
333
  const toDisplayString = (val) => {
331
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
334
+ return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
332
335
  };
333
336
  const replacer = (_key, val) => {
334
- if (val && val.__v_isRef) {
337
+ if (isRef$1(val)) {
335
338
  return replacer(_key, val.value);
336
339
  } else if (isMap(val)) {
337
340
  return {
@@ -478,7 +481,7 @@ class ReactiveEffect {
478
481
  /**
479
482
  * @internal
480
483
  */
481
- this._dirtyLevel = 5;
484
+ this._dirtyLevel = 4;
482
485
  /**
483
486
  * @internal
484
487
  */
@@ -498,18 +501,14 @@ class ReactiveEffect {
498
501
  recordEffectScope(this, scope);
499
502
  }
500
503
  get dirty() {
501
- if (this._dirtyLevel === 2)
502
- return false;
503
- if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
504
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
504
505
  this._dirtyLevel = 1;
505
506
  pauseTracking();
506
507
  for (let i = 0; i < this._depsLength; i++) {
507
508
  const dep = this.deps[i];
508
509
  if (dep.computed) {
509
- if (dep.computed.effect._dirtyLevel === 2)
510
- return true;
511
510
  triggerComputed(dep.computed);
512
- if (this._dirtyLevel >= 5) {
511
+ if (this._dirtyLevel >= 4) {
513
512
  break;
514
513
  }
515
514
  }
@@ -519,10 +518,10 @@ class ReactiveEffect {
519
518
  }
520
519
  resetTracking();
521
520
  }
522
- return this._dirtyLevel >= 5;
521
+ return this._dirtyLevel >= 4;
523
522
  }
524
523
  set dirty(v) {
525
- this._dirtyLevel = v ? 5 : 0;
524
+ this._dirtyLevel = v ? 4 : 0;
526
525
  }
527
526
  run() {
528
527
  this._dirtyLevel = 0;
@@ -643,18 +642,9 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
643
642
  var _a;
644
643
  pauseScheduling();
645
644
  for (const effect2 of dep.keys()) {
646
- if (!dep.computed && effect2.computed) {
647
- if (dep.get(effect2) === effect2._trackId && effect2._runnings > 0) {
648
- effect2._dirtyLevel = 2;
649
- continue;
650
- }
651
- }
652
645
  let tracking;
653
646
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
654
647
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
655
- if (effect2.computed && effect2._dirtyLevel === 2) {
656
- effect2._shouldSchedule = true;
657
- }
658
648
  effect2._dirtyLevel = dirtyLevel;
659
649
  }
660
650
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -662,7 +652,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
662
652
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
663
653
  }
664
654
  effect2.trigger();
665
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
655
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
666
656
  effect2._shouldSchedule = false;
667
657
  if (effect2.scheduler) {
668
658
  queueEffectSchedulers.push(effect2.scheduler);
@@ -754,7 +744,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
754
744
  if (dep) {
755
745
  triggerEffects(
756
746
  dep,
757
- 5,
747
+ 4,
758
748
  {
759
749
  target,
760
750
  type,
@@ -1357,7 +1347,7 @@ class ComputedRefImpl {
1357
1347
  () => getter(this._value),
1358
1348
  () => triggerRefValue(
1359
1349
  this,
1360
- this.effect._dirtyLevel === 3 ? 3 : 4
1350
+ this.effect._dirtyLevel === 2 ? 2 : 3
1361
1351
  )
1362
1352
  );
1363
1353
  this.effect.computed = this;
@@ -1367,7 +1357,7 @@ class ComputedRefImpl {
1367
1357
  get value() {
1368
1358
  const self = toRaw(this);
1369
1359
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1370
- triggerRefValue(self, 5);
1360
+ triggerRefValue(self, 4);
1371
1361
  }
1372
1362
  trackRefValue(self);
1373
1363
  if (self.effect._dirtyLevel >= 2) {
@@ -1376,7 +1366,7 @@ class ComputedRefImpl {
1376
1366
 
1377
1367
  getter: `, this.getter);
1378
1368
  }
1379
- triggerRefValue(self, 3);
1369
+ triggerRefValue(self, 2);
1380
1370
  }
1381
1371
  return self._value;
1382
1372
  }
@@ -1431,7 +1421,7 @@ function trackRefValue(ref2) {
1431
1421
  );
1432
1422
  }
1433
1423
  }
1434
- function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1424
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1435
1425
  ref2 = toRaw(ref2);
1436
1426
  const dep = ref2.dep;
1437
1427
  if (dep) {
@@ -1482,12 +1472,12 @@ class RefImpl {
1482
1472
  const oldVal = this._rawValue;
1483
1473
  this._rawValue = newVal;
1484
1474
  this._value = useDirectValue ? newVal : toReactive(newVal);
1485
- triggerRefValue(this, 5, newVal, oldVal);
1475
+ triggerRefValue(this, 4, newVal, oldVal);
1486
1476
  }
1487
1477
  }
1488
1478
  }
1489
1479
  function triggerRef(ref2) {
1490
- triggerRefValue(ref2, 5, ref2.value );
1480
+ triggerRefValue(ref2, 4, ref2.value );
1491
1481
  }
1492
1482
  function unref(ref2) {
1493
1483
  return isRef(ref2) ? ref2.value : ref2;
@@ -2815,7 +2805,6 @@ const SuspenseImpl = {
2815
2805
  }
2816
2806
  },
2817
2807
  hydrate: hydrateSuspense,
2818
- create: createSuspenseBoundary,
2819
2808
  normalize: normalizeSuspenseChildren
2820
2809
  };
2821
2810
  const Suspense = SuspenseImpl ;
@@ -5373,18 +5362,8 @@ function createHydrationFunctions(rendererInternals) {
5373
5362
  let domType = node.nodeType;
5374
5363
  vnode.el = node;
5375
5364
  {
5376
- if (!("__vnode" in node)) {
5377
- Object.defineProperty(node, "__vnode", {
5378
- value: vnode,
5379
- enumerable: false
5380
- });
5381
- }
5382
- if (!("__vueParentComponent" in node)) {
5383
- Object.defineProperty(node, "__vueParentComponent", {
5384
- value: parentComponent,
5385
- enumerable: false
5386
- });
5387
- }
5365
+ def(node, "__vnode", vnode, true);
5366
+ def(node, "__vueParentComponent", parentComponent, true);
5388
5367
  }
5389
5368
  if (patchFlag === -2) {
5390
5369
  optimized = false;
@@ -5607,7 +5586,9 @@ Server rendered element contains more child nodes than client vdom.`
5607
5586
  if (props) {
5608
5587
  {
5609
5588
  for (const key in props) {
5610
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5589
+ if (// #11189 skip if this node has directives that have created hooks
5590
+ // as it could have mutated the DOM in any possible way
5591
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5611
5592
  logMismatchError();
5612
5593
  }
5613
5594
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -5782,7 +5763,6 @@ Server rendered element contains fewer child nodes than client vdom.`
5782
5763
  return [hydrate, hydrateNode];
5783
5764
  }
5784
5765
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5785
- var _a;
5786
5766
  let mismatchType;
5787
5767
  let mismatchKey;
5788
5768
  let actual;
@@ -5805,13 +5785,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5805
5785
  }
5806
5786
  }
5807
5787
  }
5808
- const root = instance == null ? void 0 : instance.subTree;
5809
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
5810
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
5811
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
5812
- for (const key2 in cssVars) {
5813
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
5814
- }
5788
+ if (instance) {
5789
+ resolveCssVars(instance, vnode, expectedMap);
5815
5790
  }
5816
5791
  if (!isMapEqual(actualMap, expectedMap)) {
5817
5792
  mismatchType = mismatchKey = "style";
@@ -5871,8 +5846,8 @@ function toStyleMap(str) {
5871
5846
  const styleMap = /* @__PURE__ */ new Map();
5872
5847
  for (const item of str.split(";")) {
5873
5848
  let [key, value] = item.split(":");
5874
- key = key == null ? void 0 : key.trim();
5875
- value = value == null ? void 0 : value.trim();
5849
+ key = key.trim();
5850
+ value = value && value.trim();
5876
5851
  if (key && value) {
5877
5852
  styleMap.set(key, value);
5878
5853
  }
@@ -5890,6 +5865,18 @@ function isMapEqual(a, b) {
5890
5865
  }
5891
5866
  return true;
5892
5867
  }
5868
+ function resolveCssVars(instance, vnode, expectedMap) {
5869
+ const root = instance.subTree;
5870
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
5871
+ const cssVars = instance.getCssVars();
5872
+ for (const key in cssVars) {
5873
+ expectedMap.set(`--${key}`, String(cssVars[key]));
5874
+ }
5875
+ }
5876
+ if (vnode === root && instance.parent) {
5877
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
5878
+ }
5879
+ }
5893
5880
 
5894
5881
  let supported;
5895
5882
  let perf;
@@ -6207,14 +6194,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6207
6194
  }
6208
6195
  }
6209
6196
  {
6210
- Object.defineProperty(el, "__vnode", {
6211
- value: vnode,
6212
- enumerable: false
6213
- });
6214
- Object.defineProperty(el, "__vueParentComponent", {
6215
- value: parentComponent,
6216
- enumerable: false
6217
- });
6197
+ def(el, "__vnode", vnode, true);
6198
+ def(el, "__vueParentComponent", parentComponent, true);
6218
6199
  }
6219
6200
  if (dirs) {
6220
6201
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -6276,6 +6257,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6276
6257
  };
6277
6258
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6278
6259
  const el = n2.el = n1.el;
6260
+ {
6261
+ el.__vnode = n2;
6262
+ }
6279
6263
  let { patchFlag, dynamicChildren, dirs } = n2;
6280
6264
  patchFlag |= n1.patchFlag & 16;
6281
6265
  const oldProps = n1.props || EMPTY_OBJ;
@@ -7170,6 +7154,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7170
7154
  dirs,
7171
7155
  memoIndex
7172
7156
  } = vnode;
7157
+ if (patchFlag === -2) {
7158
+ optimized = false;
7159
+ }
7173
7160
  if (ref != null) {
7174
7161
  setRef(ref, null, parentSuspense, vnode, true);
7175
7162
  }
@@ -7201,7 +7188,6 @@ function baseCreateRenderer(options, createHydrationFns) {
7201
7188
  vnode,
7202
7189
  parentComponent,
7203
7190
  parentSuspense,
7204
- optimized,
7205
7191
  internals,
7206
7192
  doRemove
7207
7193
  );
@@ -8477,7 +8463,7 @@ const TeleportImpl = {
8477
8463
  }
8478
8464
  updateCssVars(n2);
8479
8465
  },
8480
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8466
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8481
8467
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8482
8468
  if (target) {
8483
8469
  hostRemove(targetAnchor);
@@ -9649,7 +9635,7 @@ function isMemoSame(cached, memo) {
9649
9635
  return true;
9650
9636
  }
9651
9637
 
9652
- const version = "3.4.29";
9638
+ const version = "3.4.31";
9653
9639
  const warn = warn$1 ;
9654
9640
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9655
9641
  const devtools = devtools$1 ;
@@ -10229,7 +10215,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
10229
10215
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
10230
10216
  el.removeAttribute(key);
10231
10217
  } else {
10232
- el.setAttribute(key, isBoolean ? "" : String(value));
10218
+ el.setAttribute(
10219
+ key,
10220
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
10221
+ );
10233
10222
  }
10234
10223
  }
10235
10224
  }
@@ -10390,7 +10379,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
10390
10379
  parentSuspense,
10391
10380
  unmountChildren
10392
10381
  );
10393
- if (key === "value" || key === "checked" || key === "selected") {
10382
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
10394
10383
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
10395
10384
  }
10396
10385
  } else {
@@ -15147,9 +15136,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15147
15136
  break;
15148
15137
  }
15149
15138
  }
15150
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
15151
- children.splice(i, 1);
15152
- i--;
15139
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
15153
15140
  let conditional = dynamicSlots[dynamicSlots.length - 1];
15154
15141
  while (conditional.alternate.type === 19) {
15155
15142
  conditional = conditional.alternate;