vue 3.4.28 → 3.4.30

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.28
2
+ * vue v3.4.30
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.28
2
+ * vue v3.4.30
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.28
2
+ * vue v3.4.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -478,7 +478,7 @@ class ReactiveEffect {
478
478
  /**
479
479
  * @internal
480
480
  */
481
- this._dirtyLevel = 4;
481
+ this._dirtyLevel = 5;
482
482
  /**
483
483
  * @internal
484
484
  */
@@ -498,14 +498,20 @@ class ReactiveEffect {
498
498
  recordEffectScope(this, scope);
499
499
  }
500
500
  get dirty() {
501
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
501
+ if (this._dirtyLevel === 2)
502
+ return false;
503
+ if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
502
504
  this._dirtyLevel = 1;
503
505
  pauseTracking();
504
506
  for (let i = 0; i < this._depsLength; i++) {
505
507
  const dep = this.deps[i];
506
508
  if (dep.computed) {
509
+ if (dep.computed.effect._dirtyLevel === 2) {
510
+ resetTracking();
511
+ return true;
512
+ }
507
513
  triggerComputed(dep.computed);
508
- if (this._dirtyLevel >= 4) {
514
+ if (this._dirtyLevel >= 5) {
509
515
  break;
510
516
  }
511
517
  }
@@ -515,10 +521,10 @@ class ReactiveEffect {
515
521
  }
516
522
  resetTracking();
517
523
  }
518
- return this._dirtyLevel >= 4;
524
+ return this._dirtyLevel >= 5;
519
525
  }
520
526
  set dirty(v) {
521
- this._dirtyLevel = v ? 4 : 0;
527
+ this._dirtyLevel = v ? 5 : 0;
522
528
  }
523
529
  run() {
524
530
  this._dirtyLevel = 0;
@@ -640,8 +646,17 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
640
646
  pauseScheduling();
641
647
  for (const effect2 of dep.keys()) {
642
648
  let tracking;
649
+ if (!dep.computed && effect2.computed) {
650
+ if (effect2._runnings > 0 && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
651
+ effect2._dirtyLevel = 2;
652
+ continue;
653
+ }
654
+ }
643
655
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
644
656
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
657
+ if (effect2.computed && effect2._dirtyLevel === 2) {
658
+ effect2._shouldSchedule = true;
659
+ }
645
660
  effect2._dirtyLevel = dirtyLevel;
646
661
  }
647
662
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -649,7 +664,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
649
664
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
650
665
  }
651
666
  effect2.trigger();
652
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
667
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
653
668
  effect2._shouldSchedule = false;
654
669
  if (effect2.scheduler) {
655
670
  queueEffectSchedulers.push(effect2.scheduler);
@@ -741,7 +756,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
741
756
  if (dep) {
742
757
  triggerEffects(
743
758
  dep,
744
- 4,
759
+ 5,
745
760
  {
746
761
  target,
747
762
  type,
@@ -1344,7 +1359,7 @@ class ComputedRefImpl {
1344
1359
  () => getter(this._value),
1345
1360
  () => triggerRefValue(
1346
1361
  this,
1347
- this.effect._dirtyLevel === 2 ? 2 : 3
1362
+ this.effect._dirtyLevel === 3 ? 3 : 4
1348
1363
  )
1349
1364
  );
1350
1365
  this.effect.computed = this;
@@ -1353,8 +1368,11 @@ class ComputedRefImpl {
1353
1368
  }
1354
1369
  get value() {
1355
1370
  const self = toRaw(this);
1371
+ const lastDirtyLevel = self.effect._dirtyLevel;
1356
1372
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1357
- triggerRefValue(self, 4);
1373
+ if (lastDirtyLevel !== 3) {
1374
+ triggerRefValue(self, 5);
1375
+ }
1358
1376
  }
1359
1377
  trackRefValue(self);
1360
1378
  if (self.effect._dirtyLevel >= 2) {
@@ -1363,7 +1381,7 @@ class ComputedRefImpl {
1363
1381
 
1364
1382
  getter: `, this.getter);
1365
1383
  }
1366
- triggerRefValue(self, 2);
1384
+ triggerRefValue(self, 3);
1367
1385
  }
1368
1386
  return self._value;
1369
1387
  }
@@ -1418,7 +1436,7 @@ function trackRefValue(ref2) {
1418
1436
  );
1419
1437
  }
1420
1438
  }
1421
- function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1439
+ function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1422
1440
  ref2 = toRaw(ref2);
1423
1441
  const dep = ref2.dep;
1424
1442
  if (dep) {
@@ -1469,12 +1487,12 @@ class RefImpl {
1469
1487
  const oldVal = this._rawValue;
1470
1488
  this._rawValue = newVal;
1471
1489
  this._value = useDirectValue ? newVal : toReactive(newVal);
1472
- triggerRefValue(this, 4, newVal, oldVal);
1490
+ triggerRefValue(this, 5, newVal, oldVal);
1473
1491
  }
1474
1492
  }
1475
1493
  }
1476
1494
  function triggerRef(ref2) {
1477
- triggerRefValue(ref2, 4, ref2.value );
1495
+ triggerRefValue(ref2, 5, ref2.value );
1478
1496
  }
1479
1497
  function unref(ref2) {
1480
1498
  return isRef(ref2) ? ref2.value : ref2;
@@ -2802,7 +2820,6 @@ const SuspenseImpl = {
2802
2820
  }
2803
2821
  },
2804
2822
  hydrate: hydrateSuspense,
2805
- create: createSuspenseBoundary,
2806
2823
  normalize: normalizeSuspenseChildren
2807
2824
  };
2808
2825
  const Suspense = SuspenseImpl ;
@@ -5360,18 +5377,8 @@ function createHydrationFunctions(rendererInternals) {
5360
5377
  let domType = node.nodeType;
5361
5378
  vnode.el = node;
5362
5379
  {
5363
- if (!("__vnode" in node)) {
5364
- Object.defineProperty(node, "__vnode", {
5365
- value: vnode,
5366
- enumerable: false
5367
- });
5368
- }
5369
- if (!("__vueParentComponent" in node)) {
5370
- Object.defineProperty(node, "__vueParentComponent", {
5371
- value: parentComponent,
5372
- enumerable: false
5373
- });
5374
- }
5380
+ def(node, "__vnode", vnode, true);
5381
+ def(node, "__vueParentComponent", parentComponent, true);
5375
5382
  }
5376
5383
  if (patchFlag === -2) {
5377
5384
  optimized = false;
@@ -5594,7 +5601,9 @@ Server rendered element contains more child nodes than client vdom.`
5594
5601
  if (props) {
5595
5602
  {
5596
5603
  for (const key in props) {
5597
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5604
+ if (// #11189 skip if this node has directives that have created hooks
5605
+ // as it could have mutated the DOM in any possible way
5606
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
5598
5607
  logMismatchError();
5599
5608
  }
5600
5609
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -5769,7 +5778,6 @@ Server rendered element contains fewer child nodes than client vdom.`
5769
5778
  return [hydrate, hydrateNode];
5770
5779
  }
5771
5780
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5772
- var _a;
5773
5781
  let mismatchType;
5774
5782
  let mismatchKey;
5775
5783
  let actual;
@@ -5792,13 +5800,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5792
5800
  }
5793
5801
  }
5794
5802
  }
5795
- const root = instance == null ? void 0 : instance.subTree;
5796
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
5797
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
5798
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
5799
- for (const key2 in cssVars) {
5800
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
5801
- }
5803
+ if (instance) {
5804
+ resolveCssVars(instance, vnode, expectedMap);
5802
5805
  }
5803
5806
  if (!isMapEqual(actualMap, expectedMap)) {
5804
5807
  mismatchType = mismatchKey = "style";
@@ -5858,8 +5861,8 @@ function toStyleMap(str) {
5858
5861
  const styleMap = /* @__PURE__ */ new Map();
5859
5862
  for (const item of str.split(";")) {
5860
5863
  let [key, value] = item.split(":");
5861
- key = key == null ? void 0 : key.trim();
5862
- value = value == null ? void 0 : value.trim();
5864
+ key = key.trim();
5865
+ value = value && value.trim();
5863
5866
  if (key && value) {
5864
5867
  styleMap.set(key, value);
5865
5868
  }
@@ -5877,6 +5880,18 @@ function isMapEqual(a, b) {
5877
5880
  }
5878
5881
  return true;
5879
5882
  }
5883
+ function resolveCssVars(instance, vnode, expectedMap) {
5884
+ const root = instance.subTree;
5885
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
5886
+ const cssVars = instance.getCssVars();
5887
+ for (const key in cssVars) {
5888
+ expectedMap.set(`--${key}`, String(cssVars[key]));
5889
+ }
5890
+ }
5891
+ if (vnode === root && instance.parent) {
5892
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
5893
+ }
5894
+ }
5880
5895
 
5881
5896
  let supported;
5882
5897
  let perf;
@@ -6194,14 +6209,8 @@ function baseCreateRenderer(options, createHydrationFns) {
6194
6209
  }
6195
6210
  }
6196
6211
  {
6197
- Object.defineProperty(el, "__vnode", {
6198
- value: vnode,
6199
- enumerable: false
6200
- });
6201
- Object.defineProperty(el, "__vueParentComponent", {
6202
- value: parentComponent,
6203
- enumerable: false
6204
- });
6212
+ def(el, "__vnode", vnode, true);
6213
+ def(el, "__vueParentComponent", parentComponent, true);
6205
6214
  }
6206
6215
  if (dirs) {
6207
6216
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -6263,6 +6272,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6263
6272
  };
6264
6273
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6265
6274
  const el = n2.el = n1.el;
6275
+ {
6276
+ el.__vnode = n2;
6277
+ }
6266
6278
  let { patchFlag, dynamicChildren, dirs } = n2;
6267
6279
  patchFlag |= n1.patchFlag & 16;
6268
6280
  const oldProps = n1.props || EMPTY_OBJ;
@@ -7157,6 +7169,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7157
7169
  dirs,
7158
7170
  memoIndex
7159
7171
  } = vnode;
7172
+ if (patchFlag === -2) {
7173
+ optimized = false;
7174
+ }
7160
7175
  if (ref != null) {
7161
7176
  setRef(ref, null, parentSuspense, vnode, true);
7162
7177
  }
@@ -7188,7 +7203,6 @@ function baseCreateRenderer(options, createHydrationFns) {
7188
7203
  vnode,
7189
7204
  parentComponent,
7190
7205
  parentSuspense,
7191
- optimized,
7192
7206
  internals,
7193
7207
  doRemove
7194
7208
  );
@@ -8464,7 +8478,7 @@ const TeleportImpl = {
8464
8478
  }
8465
8479
  updateCssVars(n2);
8466
8480
  },
8467
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8481
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
8468
8482
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
8469
8483
  if (target) {
8470
8484
  hostRemove(targetAnchor);
@@ -9636,7 +9650,7 @@ function isMemoSame(cached, memo) {
9636
9650
  return true;
9637
9651
  }
9638
9652
 
9639
- const version = "3.4.28";
9653
+ const version = "3.4.30";
9640
9654
  const warn = warn$1 ;
9641
9655
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9642
9656
  const devtools = devtools$1 ;
@@ -10216,7 +10230,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
10216
10230
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
10217
10231
  el.removeAttribute(key);
10218
10232
  } else {
10219
- el.setAttribute(key, isBoolean ? "" : String(value));
10233
+ el.setAttribute(
10234
+ key,
10235
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
10236
+ );
10220
10237
  }
10221
10238
  }
10222
10239
  }
@@ -10377,7 +10394,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
10377
10394
  parentSuspense,
10378
10395
  unmountChildren
10379
10396
  );
10380
- if (key === "value" || key === "checked" || key === "selected") {
10397
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
10381
10398
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
10382
10399
  }
10383
10400
  } else {
@@ -10425,8 +10442,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
10425
10442
 
10426
10443
  /*! #__NO_SIDE_EFFECTS__ */
10427
10444
  // @__NO_SIDE_EFFECTS__
10428
- function defineCustomElement(options, hydrate2) {
10429
- const Comp = defineComponent(options);
10445
+ function defineCustomElement(options, extraOptions, hydrate2) {
10446
+ const Comp = defineComponent(options, extraOptions);
10430
10447
  class VueCustomElement extends VueElement {
10431
10448
  constructor(initialProps) {
10432
10449
  super(Comp, initialProps, hydrate2);
@@ -10436,8 +10453,8 @@ function defineCustomElement(options, hydrate2) {
10436
10453
  return VueCustomElement;
10437
10454
  }
10438
10455
  /*! #__NO_SIDE_EFFECTS__ */
10439
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
10440
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
10456
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10457
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
10441
10458
  };
10442
10459
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10443
10460
  };
@@ -15134,9 +15151,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15134
15151
  break;
15135
15152
  }
15136
15153
  }
15137
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
15138
- children.splice(i, 1);
15139
- i--;
15154
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
15140
15155
  let conditional = dynamicSlots[dynamicSlots.length - 1];
15141
15156
  while (conditional.alternate.type === 19) {
15142
15157
  conditional = conditional.alternate;