@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
  **/
@@ -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;
@@ -3334,7 +3324,6 @@ const SuspenseImpl = {
3334
3324
  }
3335
3325
  },
3336
3326
  hydrate: hydrateSuspense,
3337
- create: createSuspenseBoundary,
3338
3327
  normalize: normalizeSuspenseChildren
3339
3328
  };
3340
3329
  const Suspense = SuspenseImpl ;
@@ -5690,7 +5679,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5690
5679
  return vm;
5691
5680
  }
5692
5681
  }
5693
- Vue.version = `2.6.14-compat:${"3.4.29"}`;
5682
+ Vue.version = `2.6.14-compat:${"3.4.31"}`;
5694
5683
  Vue.config = singletonApp.config;
5695
5684
  Vue.use = (plugin, ...options) => {
5696
5685
  if (plugin && isFunction(plugin.install)) {
@@ -6999,18 +6988,8 @@ function createHydrationFunctions(rendererInternals) {
6999
6988
  let domType = node.nodeType;
7000
6989
  vnode.el = node;
7001
6990
  {
7002
- if (!("__vnode" in node)) {
7003
- Object.defineProperty(node, "__vnode", {
7004
- value: vnode,
7005
- enumerable: false
7006
- });
7007
- }
7008
- if (!("__vueParentComponent" in node)) {
7009
- Object.defineProperty(node, "__vueParentComponent", {
7010
- value: parentComponent,
7011
- enumerable: false
7012
- });
7013
- }
6991
+ def(node, "__vnode", vnode, true);
6992
+ def(node, "__vueParentComponent", parentComponent, true);
7014
6993
  }
7015
6994
  if (patchFlag === -2) {
7016
6995
  optimized = false;
@@ -7233,7 +7212,9 @@ Server rendered element contains more child nodes than client vdom.`
7233
7212
  if (props) {
7234
7213
  {
7235
7214
  for (const key in props) {
7236
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7215
+ if (// #11189 skip if this node has directives that have created hooks
7216
+ // as it could have mutated the DOM in any possible way
7217
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7237
7218
  logMismatchError();
7238
7219
  }
7239
7220
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7408,7 +7389,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7408
7389
  return [hydrate, hydrateNode];
7409
7390
  }
7410
7391
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7411
- var _a;
7412
7392
  let mismatchType;
7413
7393
  let mismatchKey;
7414
7394
  let actual;
@@ -7431,13 +7411,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7431
7411
  }
7432
7412
  }
7433
7413
  }
7434
- const root = instance == null ? void 0 : instance.subTree;
7435
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7436
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7437
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7438
- for (const key2 in cssVars) {
7439
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7440
- }
7414
+ if (instance) {
7415
+ resolveCssVars(instance, vnode, expectedMap);
7441
7416
  }
7442
7417
  if (!isMapEqual(actualMap, expectedMap)) {
7443
7418
  mismatchType = mismatchKey = "style";
@@ -7497,8 +7472,8 @@ function toStyleMap(str) {
7497
7472
  const styleMap = /* @__PURE__ */ new Map();
7498
7473
  for (const item of str.split(";")) {
7499
7474
  let [key, value] = item.split(":");
7500
- key = key == null ? void 0 : key.trim();
7501
- value = value == null ? void 0 : value.trim();
7475
+ key = key.trim();
7476
+ value = value && value.trim();
7502
7477
  if (key && value) {
7503
7478
  styleMap.set(key, value);
7504
7479
  }
@@ -7516,6 +7491,18 @@ function isMapEqual(a, b) {
7516
7491
  }
7517
7492
  return true;
7518
7493
  }
7494
+ function resolveCssVars(instance, vnode, expectedMap) {
7495
+ const root = instance.subTree;
7496
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7497
+ const cssVars = instance.getCssVars();
7498
+ for (const key in cssVars) {
7499
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7500
+ }
7501
+ }
7502
+ if (vnode === root && instance.parent) {
7503
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7504
+ }
7505
+ }
7519
7506
 
7520
7507
  let supported;
7521
7508
  let perf;
@@ -7833,14 +7820,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7833
7820
  }
7834
7821
  }
7835
7822
  {
7836
- Object.defineProperty(el, "__vnode", {
7837
- value: vnode,
7838
- enumerable: false
7839
- });
7840
- Object.defineProperty(el, "__vueParentComponent", {
7841
- value: parentComponent,
7842
- enumerable: false
7843
- });
7823
+ def(el, "__vnode", vnode, true);
7824
+ def(el, "__vueParentComponent", parentComponent, true);
7844
7825
  }
7845
7826
  if (dirs) {
7846
7827
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7902,6 +7883,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7902
7883
  };
7903
7884
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7904
7885
  const el = n2.el = n1.el;
7886
+ {
7887
+ el.__vnode = n2;
7888
+ }
7905
7889
  let { patchFlag, dynamicChildren, dirs } = n2;
7906
7890
  patchFlag |= n1.patchFlag & 16;
7907
7891
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8821,6 +8805,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8821
8805
  dirs,
8822
8806
  memoIndex
8823
8807
  } = vnode;
8808
+ if (patchFlag === -2) {
8809
+ optimized = false;
8810
+ }
8824
8811
  if (ref != null) {
8825
8812
  setRef(ref, null, parentSuspense, vnode, true);
8826
8813
  }
@@ -8852,7 +8839,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8852
8839
  vnode,
8853
8840
  parentComponent,
8854
8841
  parentSuspense,
8855
- optimized,
8856
8842
  internals,
8857
8843
  doRemove
8858
8844
  );
@@ -10153,7 +10139,7 @@ const TeleportImpl = {
10153
10139
  }
10154
10140
  updateCssVars(n2);
10155
10141
  },
10156
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10142
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10157
10143
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10158
10144
  if (target) {
10159
10145
  hostRemove(targetAnchor);
@@ -11404,7 +11390,7 @@ function isMemoSame(cached, memo) {
11404
11390
  return true;
11405
11391
  }
11406
11392
 
11407
- const version = "3.4.29";
11393
+ const version = "3.4.31";
11408
11394
  const warn = warn$1 ;
11409
11395
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11410
11396
  const devtools = devtools$1 ;
@@ -12031,7 +12017,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
12031
12017
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
12032
12018
  el.removeAttribute(key);
12033
12019
  } else {
12034
- el.setAttribute(key, isBoolean ? "" : String(value));
12020
+ el.setAttribute(
12021
+ key,
12022
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
12023
+ );
12035
12024
  }
12036
12025
  }
12037
12026
  }
@@ -12233,7 +12222,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12233
12222
  parentSuspense,
12234
12223
  unmountChildren
12235
12224
  );
12236
- if (key === "value" || key === "checked" || key === "selected") {
12225
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12237
12226
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12238
12227
  }
12239
12228
  } else {
@@ -17229,9 +17218,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17229
17218
  break;
17230
17219
  }
17231
17220
  }
17232
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
17233
- children.splice(i, 1);
17234
- i--;
17221
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17235
17222
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17236
17223
  while (conditional.alternate.type === 19) {
17237
17224
  conditional = conditional.alternate;
@@ -18265,8 +18252,7 @@ const transformFilter = (node, context) => {
18265
18252
  }
18266
18253
  if (node.type === 5) {
18267
18254
  rewriteFilter(node.content, context);
18268
- }
18269
- if (node.type === 1) {
18255
+ } else if (node.type === 1) {
18270
18256
  node.props.forEach((prop) => {
18271
18257
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
18272
18258
  rewriteFilter(prop.exp, context);