@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
  !!(process.env.NODE_ENV !== "production") ? {
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, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1480
+ triggerRefValue(ref2, 4, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1491
1481
  }
1492
1482
  function unref(ref2) {
1493
1483
  return isRef(ref2) ? ref2.value : ref2;
@@ -3340,7 +3330,6 @@ const SuspenseImpl = {
3340
3330
  }
3341
3331
  },
3342
3332
  hydrate: hydrateSuspense,
3343
- create: createSuspenseBoundary,
3344
3333
  normalize: normalizeSuspenseChildren
3345
3334
  };
3346
3335
  const Suspense = SuspenseImpl ;
@@ -5698,7 +5687,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5698
5687
  return vm;
5699
5688
  }
5700
5689
  }
5701
- Vue.version = `2.6.14-compat:${"3.4.29"}`;
5690
+ Vue.version = `2.6.14-compat:${"3.4.31"}`;
5702
5691
  Vue.config = singletonApp.config;
5703
5692
  Vue.use = (plugin, ...options) => {
5704
5693
  if (plugin && isFunction(plugin.install)) {
@@ -7009,18 +6998,8 @@ function createHydrationFunctions(rendererInternals) {
7009
6998
  let domType = node.nodeType;
7010
6999
  vnode.el = node;
7011
7000
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7012
- if (!("__vnode" in node)) {
7013
- Object.defineProperty(node, "__vnode", {
7014
- value: vnode,
7015
- enumerable: false
7016
- });
7017
- }
7018
- if (!("__vueParentComponent" in node)) {
7019
- Object.defineProperty(node, "__vueParentComponent", {
7020
- value: parentComponent,
7021
- enumerable: false
7022
- });
7023
- }
7001
+ def(node, "__vnode", vnode, true);
7002
+ def(node, "__vueParentComponent", parentComponent, true);
7024
7003
  }
7025
7004
  if (patchFlag === -2) {
7026
7005
  optimized = false;
@@ -7243,7 +7222,9 @@ Server rendered element contains more child nodes than client vdom.`
7243
7222
  if (props) {
7244
7223
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
7245
7224
  for (const key in props) {
7246
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7225
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
7226
+ // as it could have mutated the DOM in any possible way
7227
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7247
7228
  logMismatchError();
7248
7229
  }
7249
7230
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7428,7 +7409,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7428
7409
  return [hydrate, hydrateNode];
7429
7410
  }
7430
7411
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7431
- var _a;
7432
7412
  let mismatchType;
7433
7413
  let mismatchKey;
7434
7414
  let actual;
@@ -7451,13 +7431,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7451
7431
  }
7452
7432
  }
7453
7433
  }
7454
- const root = instance == null ? void 0 : instance.subTree;
7455
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7456
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7457
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7458
- for (const key2 in cssVars) {
7459
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7460
- }
7434
+ if (instance) {
7435
+ resolveCssVars(instance, vnode, expectedMap);
7461
7436
  }
7462
7437
  if (!isMapEqual(actualMap, expectedMap)) {
7463
7438
  mismatchType = mismatchKey = "style";
@@ -7517,8 +7492,8 @@ function toStyleMap(str) {
7517
7492
  const styleMap = /* @__PURE__ */ new Map();
7518
7493
  for (const item of str.split(";")) {
7519
7494
  let [key, value] = item.split(":");
7520
- key = key == null ? void 0 : key.trim();
7521
- value = value == null ? void 0 : value.trim();
7495
+ key = key.trim();
7496
+ value = value && value.trim();
7522
7497
  if (key && value) {
7523
7498
  styleMap.set(key, value);
7524
7499
  }
@@ -7536,6 +7511,18 @@ function isMapEqual(a, b) {
7536
7511
  }
7537
7512
  return true;
7538
7513
  }
7514
+ function resolveCssVars(instance, vnode, expectedMap) {
7515
+ const root = instance.subTree;
7516
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7517
+ const cssVars = instance.getCssVars();
7518
+ for (const key in cssVars) {
7519
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7520
+ }
7521
+ }
7522
+ if (vnode === root && instance.parent) {
7523
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7524
+ }
7525
+ }
7539
7526
 
7540
7527
  let supported;
7541
7528
  let perf;
@@ -7880,14 +7867,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7880
7867
  }
7881
7868
  }
7882
7869
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7883
- Object.defineProperty(el, "__vnode", {
7884
- value: vnode,
7885
- enumerable: false
7886
- });
7887
- Object.defineProperty(el, "__vueParentComponent", {
7888
- value: parentComponent,
7889
- enumerable: false
7890
- });
7870
+ def(el, "__vnode", vnode, true);
7871
+ def(el, "__vueParentComponent", parentComponent, true);
7891
7872
  }
7892
7873
  if (dirs) {
7893
7874
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7949,6 +7930,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7949
7930
  };
7950
7931
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7951
7932
  const el = n2.el = n1.el;
7933
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7934
+ el.__vnode = n2;
7935
+ }
7952
7936
  let { patchFlag, dynamicChildren, dirs } = n2;
7953
7937
  patchFlag |= n1.patchFlag & 16;
7954
7938
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8879,6 +8863,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8879
8863
  dirs,
8880
8864
  memoIndex
8881
8865
  } = vnode;
8866
+ if (patchFlag === -2) {
8867
+ optimized = false;
8868
+ }
8882
8869
  if (ref != null) {
8883
8870
  setRef(ref, null, parentSuspense, vnode, true);
8884
8871
  }
@@ -8910,7 +8897,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8910
8897
  vnode,
8911
8898
  parentComponent,
8912
8899
  parentSuspense,
8913
- optimized,
8914
8900
  internals,
8915
8901
  doRemove
8916
8902
  );
@@ -10238,7 +10224,7 @@ const TeleportImpl = {
10238
10224
  }
10239
10225
  updateCssVars(n2);
10240
10226
  },
10241
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10227
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10242
10228
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10243
10229
  if (target) {
10244
10230
  hostRemove(targetAnchor);
@@ -11517,7 +11503,7 @@ function isMemoSame(cached, memo) {
11517
11503
  return true;
11518
11504
  }
11519
11505
 
11520
- const version = "3.4.29";
11506
+ const version = "3.4.31";
11521
11507
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11522
11508
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11523
11509
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12160,7 +12146,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
12160
12146
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
12161
12147
  el.removeAttribute(key);
12162
12148
  } else {
12163
- el.setAttribute(key, isBoolean ? "" : String(value));
12149
+ el.setAttribute(
12150
+ key,
12151
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
12152
+ );
12164
12153
  }
12165
12154
  }
12166
12155
  }
@@ -12362,7 +12351,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12362
12351
  parentSuspense,
12363
12352
  unmountChildren
12364
12353
  );
12365
- if (key === "value" || key === "checked" || key === "selected") {
12354
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12366
12355
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12367
12356
  }
12368
12357
  } else {
@@ -17394,9 +17383,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17394
17383
  break;
17395
17384
  }
17396
17385
  }
17397
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
17398
- children.splice(i, 1);
17399
- i--;
17386
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17400
17387
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17401
17388
  while (conditional.alternate.type === 19) {
17402
17389
  conditional = conditional.alternate;
@@ -18432,8 +18419,7 @@ const transformFilter = (node, context) => {
18432
18419
  }
18433
18420
  if (node.type === 5) {
18434
18421
  rewriteFilter(node.content, context);
18435
- }
18436
- if (node.type === 1) {
18422
+ } else if (node.type === 1) {
18437
18423
  node.props.forEach((prop) => {
18438
18424
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
18439
18425
  rewriteFilter(prop.exp, context);