@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.29
2
+ * @vue/compat v3.4.31
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -260,11 +260,14 @@ function looseIndexOf(arr, val) {
260
260
  return arr.findIndex((item) => looseEqual(item, val));
261
261
  }
262
262
 
263
+ const isRef$1 = (val) => {
264
+ return !!(val && val.__v_isRef === true);
265
+ };
263
266
  const toDisplayString = (val) => {
264
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
267
+ 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);
265
268
  };
266
269
  const replacer = (_key, val) => {
267
- if (val && val.__v_isRef) {
270
+ if (isRef$1(val)) {
268
271
  return replacer(_key, val.value);
269
272
  } else if (isMap(val)) {
270
273
  return {
@@ -411,7 +414,7 @@ class ReactiveEffect {
411
414
  /**
412
415
  * @internal
413
416
  */
414
- this._dirtyLevel = 5;
417
+ this._dirtyLevel = 4;
415
418
  /**
416
419
  * @internal
417
420
  */
@@ -431,18 +434,14 @@ class ReactiveEffect {
431
434
  recordEffectScope(this, scope);
432
435
  }
433
436
  get dirty() {
434
- if (this._dirtyLevel === 2)
435
- return false;
436
- if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
437
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
437
438
  this._dirtyLevel = 1;
438
439
  pauseTracking();
439
440
  for (let i = 0; i < this._depsLength; i++) {
440
441
  const dep = this.deps[i];
441
442
  if (dep.computed) {
442
- if (dep.computed.effect._dirtyLevel === 2)
443
- return true;
444
443
  triggerComputed(dep.computed);
445
- if (this._dirtyLevel >= 5) {
444
+ if (this._dirtyLevel >= 4) {
446
445
  break;
447
446
  }
448
447
  }
@@ -452,10 +451,10 @@ class ReactiveEffect {
452
451
  }
453
452
  resetTracking();
454
453
  }
455
- return this._dirtyLevel >= 5;
454
+ return this._dirtyLevel >= 4;
456
455
  }
457
456
  set dirty(v) {
458
- this._dirtyLevel = v ? 5 : 0;
457
+ this._dirtyLevel = v ? 4 : 0;
459
458
  }
460
459
  run() {
461
460
  this._dirtyLevel = 0;
@@ -576,18 +575,9 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
576
575
  var _a;
577
576
  pauseScheduling();
578
577
  for (const effect2 of dep.keys()) {
579
- if (!dep.computed && effect2.computed) {
580
- if (dep.get(effect2) === effect2._trackId && effect2._runnings > 0) {
581
- effect2._dirtyLevel = 2;
582
- continue;
583
- }
584
- }
585
578
  let tracking;
586
579
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
587
580
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
588
- if (effect2.computed && effect2._dirtyLevel === 2) {
589
- effect2._shouldSchedule = true;
590
- }
591
581
  effect2._dirtyLevel = dirtyLevel;
592
582
  }
593
583
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -595,7 +585,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
595
585
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
596
586
  }
597
587
  effect2.trigger();
598
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
588
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
599
589
  effect2._shouldSchedule = false;
600
590
  if (effect2.scheduler) {
601
591
  queueEffectSchedulers.push(effect2.scheduler);
@@ -687,7 +677,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
687
677
  if (dep) {
688
678
  triggerEffects(
689
679
  dep,
690
- 5,
680
+ 4,
691
681
  {
692
682
  target,
693
683
  type,
@@ -1290,7 +1280,7 @@ class ComputedRefImpl {
1290
1280
  () => getter(this._value),
1291
1281
  () => triggerRefValue(
1292
1282
  this,
1293
- this.effect._dirtyLevel === 3 ? 3 : 4
1283
+ this.effect._dirtyLevel === 2 ? 2 : 3
1294
1284
  )
1295
1285
  );
1296
1286
  this.effect.computed = this;
@@ -1300,7 +1290,7 @@ class ComputedRefImpl {
1300
1290
  get value() {
1301
1291
  const self = toRaw(this);
1302
1292
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1303
- triggerRefValue(self, 5);
1293
+ triggerRefValue(self, 4);
1304
1294
  }
1305
1295
  trackRefValue(self);
1306
1296
  if (self.effect._dirtyLevel >= 2) {
@@ -1309,7 +1299,7 @@ class ComputedRefImpl {
1309
1299
 
1310
1300
  getter: `, this.getter);
1311
1301
  }
1312
- triggerRefValue(self, 3);
1302
+ triggerRefValue(self, 2);
1313
1303
  }
1314
1304
  return self._value;
1315
1305
  }
@@ -1364,7 +1354,7 @@ function trackRefValue(ref2) {
1364
1354
  );
1365
1355
  }
1366
1356
  }
1367
- function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1357
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1368
1358
  ref2 = toRaw(ref2);
1369
1359
  const dep = ref2.dep;
1370
1360
  if (dep) {
@@ -1415,12 +1405,12 @@ class RefImpl {
1415
1405
  const oldVal = this._rawValue;
1416
1406
  this._rawValue = newVal;
1417
1407
  this._value = useDirectValue ? newVal : toReactive(newVal);
1418
- triggerRefValue(this, 5, newVal, oldVal);
1408
+ triggerRefValue(this, 4, newVal, oldVal);
1419
1409
  }
1420
1410
  }
1421
1411
  }
1422
1412
  function triggerRef(ref2) {
1423
- triggerRefValue(ref2, 5, ref2.value );
1413
+ triggerRefValue(ref2, 4, ref2.value );
1424
1414
  }
1425
1415
  function unref(ref2) {
1426
1416
  return isRef(ref2) ? ref2.value : ref2;
@@ -3267,7 +3257,6 @@ const SuspenseImpl = {
3267
3257
  }
3268
3258
  },
3269
3259
  hydrate: hydrateSuspense,
3270
- create: createSuspenseBoundary,
3271
3260
  normalize: normalizeSuspenseChildren
3272
3261
  };
3273
3262
  const Suspense = SuspenseImpl ;
@@ -5623,7 +5612,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5623
5612
  return vm;
5624
5613
  }
5625
5614
  }
5626
- Vue.version = `2.6.14-compat:${"3.4.29"}`;
5615
+ Vue.version = `2.6.14-compat:${"3.4.31"}`;
5627
5616
  Vue.config = singletonApp.config;
5628
5617
  Vue.use = (plugin, ...options) => {
5629
5618
  if (plugin && isFunction(plugin.install)) {
@@ -6932,18 +6921,8 @@ function createHydrationFunctions(rendererInternals) {
6932
6921
  let domType = node.nodeType;
6933
6922
  vnode.el = node;
6934
6923
  {
6935
- if (!("__vnode" in node)) {
6936
- Object.defineProperty(node, "__vnode", {
6937
- value: vnode,
6938
- enumerable: false
6939
- });
6940
- }
6941
- if (!("__vueParentComponent" in node)) {
6942
- Object.defineProperty(node, "__vueParentComponent", {
6943
- value: parentComponent,
6944
- enumerable: false
6945
- });
6946
- }
6924
+ def(node, "__vnode", vnode, true);
6925
+ def(node, "__vueParentComponent", parentComponent, true);
6947
6926
  }
6948
6927
  if (patchFlag === -2) {
6949
6928
  optimized = false;
@@ -7166,7 +7145,9 @@ Server rendered element contains more child nodes than client vdom.`
7166
7145
  if (props) {
7167
7146
  {
7168
7147
  for (const key in props) {
7169
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7148
+ if (// #11189 skip if this node has directives that have created hooks
7149
+ // as it could have mutated the DOM in any possible way
7150
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7170
7151
  logMismatchError();
7171
7152
  }
7172
7153
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7341,7 +7322,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7341
7322
  return [hydrate, hydrateNode];
7342
7323
  }
7343
7324
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7344
- var _a;
7345
7325
  let mismatchType;
7346
7326
  let mismatchKey;
7347
7327
  let actual;
@@ -7364,13 +7344,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7364
7344
  }
7365
7345
  }
7366
7346
  }
7367
- const root = instance == null ? void 0 : instance.subTree;
7368
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7369
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7370
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7371
- for (const key2 in cssVars) {
7372
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7373
- }
7347
+ if (instance) {
7348
+ resolveCssVars(instance, vnode, expectedMap);
7374
7349
  }
7375
7350
  if (!isMapEqual(actualMap, expectedMap)) {
7376
7351
  mismatchType = mismatchKey = "style";
@@ -7430,8 +7405,8 @@ function toStyleMap(str) {
7430
7405
  const styleMap = /* @__PURE__ */ new Map();
7431
7406
  for (const item of str.split(";")) {
7432
7407
  let [key, value] = item.split(":");
7433
- key = key == null ? void 0 : key.trim();
7434
- value = value == null ? void 0 : value.trim();
7408
+ key = key.trim();
7409
+ value = value && value.trim();
7435
7410
  if (key && value) {
7436
7411
  styleMap.set(key, value);
7437
7412
  }
@@ -7449,6 +7424,18 @@ function isMapEqual(a, b) {
7449
7424
  }
7450
7425
  return true;
7451
7426
  }
7427
+ function resolveCssVars(instance, vnode, expectedMap) {
7428
+ const root = instance.subTree;
7429
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7430
+ const cssVars = instance.getCssVars();
7431
+ for (const key in cssVars) {
7432
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7433
+ }
7434
+ }
7435
+ if (vnode === root && instance.parent) {
7436
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7437
+ }
7438
+ }
7452
7439
 
7453
7440
  let supported;
7454
7441
  let perf;
@@ -7766,14 +7753,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7766
7753
  }
7767
7754
  }
7768
7755
  {
7769
- Object.defineProperty(el, "__vnode", {
7770
- value: vnode,
7771
- enumerable: false
7772
- });
7773
- Object.defineProperty(el, "__vueParentComponent", {
7774
- value: parentComponent,
7775
- enumerable: false
7776
- });
7756
+ def(el, "__vnode", vnode, true);
7757
+ def(el, "__vueParentComponent", parentComponent, true);
7777
7758
  }
7778
7759
  if (dirs) {
7779
7760
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7835,6 +7816,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7835
7816
  };
7836
7817
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7837
7818
  const el = n2.el = n1.el;
7819
+ {
7820
+ el.__vnode = n2;
7821
+ }
7838
7822
  let { patchFlag, dynamicChildren, dirs } = n2;
7839
7823
  patchFlag |= n1.patchFlag & 16;
7840
7824
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8754,6 +8738,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8754
8738
  dirs,
8755
8739
  memoIndex
8756
8740
  } = vnode;
8741
+ if (patchFlag === -2) {
8742
+ optimized = false;
8743
+ }
8757
8744
  if (ref != null) {
8758
8745
  setRef(ref, null, parentSuspense, vnode, true);
8759
8746
  }
@@ -8785,7 +8772,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8785
8772
  vnode,
8786
8773
  parentComponent,
8787
8774
  parentSuspense,
8788
- optimized,
8789
8775
  internals,
8790
8776
  doRemove
8791
8777
  );
@@ -10086,7 +10072,7 @@ const TeleportImpl = {
10086
10072
  }
10087
10073
  updateCssVars(n2);
10088
10074
  },
10089
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10075
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10090
10076
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10091
10077
  if (target) {
10092
10078
  hostRemove(targetAnchor);
@@ -11337,7 +11323,7 @@ function isMemoSame(cached, memo) {
11337
11323
  return true;
11338
11324
  }
11339
11325
 
11340
- const version = "3.4.29";
11326
+ const version = "3.4.31";
11341
11327
  const warn = warn$1 ;
11342
11328
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11343
11329
  const devtools = devtools$1 ;
@@ -11964,7 +11950,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
11964
11950
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
11965
11951
  el.removeAttribute(key);
11966
11952
  } else {
11967
- el.setAttribute(key, isBoolean ? "" : String(value));
11953
+ el.setAttribute(
11954
+ key,
11955
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
11956
+ );
11968
11957
  }
11969
11958
  }
11970
11959
  }
@@ -12166,7 +12155,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12166
12155
  parentSuspense,
12167
12156
  unmountChildren
12168
12157
  );
12169
- if (key === "value" || key === "checked" || key === "selected") {
12158
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12170
12159
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12171
12160
  }
12172
12161
  } else {