@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
  **/
@@ -330,11 +330,14 @@ var Vue = (function () {
330
330
  return arr.findIndex((item) => looseEqual(item, val));
331
331
  }
332
332
 
333
+ const isRef$1 = (val) => {
334
+ return !!(val && val.__v_isRef === true);
335
+ };
333
336
  const toDisplayString = (val) => {
334
- return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
337
+ 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);
335
338
  };
336
339
  const replacer = (_key, val) => {
337
- if (val && val.__v_isRef) {
340
+ if (isRef$1(val)) {
338
341
  return replacer(_key, val.value);
339
342
  } else if (isMap(val)) {
340
343
  return {
@@ -481,7 +484,7 @@ var Vue = (function () {
481
484
  /**
482
485
  * @internal
483
486
  */
484
- this._dirtyLevel = 5;
487
+ this._dirtyLevel = 4;
485
488
  /**
486
489
  * @internal
487
490
  */
@@ -501,18 +504,14 @@ var Vue = (function () {
501
504
  recordEffectScope(this, scope);
502
505
  }
503
506
  get dirty() {
504
- if (this._dirtyLevel === 2)
505
- return false;
506
- if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
507
+ if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
507
508
  this._dirtyLevel = 1;
508
509
  pauseTracking();
509
510
  for (let i = 0; i < this._depsLength; i++) {
510
511
  const dep = this.deps[i];
511
512
  if (dep.computed) {
512
- if (dep.computed.effect._dirtyLevel === 2)
513
- return true;
514
513
  triggerComputed(dep.computed);
515
- if (this._dirtyLevel >= 5) {
514
+ if (this._dirtyLevel >= 4) {
516
515
  break;
517
516
  }
518
517
  }
@@ -522,10 +521,10 @@ var Vue = (function () {
522
521
  }
523
522
  resetTracking();
524
523
  }
525
- return this._dirtyLevel >= 5;
524
+ return this._dirtyLevel >= 4;
526
525
  }
527
526
  set dirty(v) {
528
- this._dirtyLevel = v ? 5 : 0;
527
+ this._dirtyLevel = v ? 4 : 0;
529
528
  }
530
529
  run() {
531
530
  this._dirtyLevel = 0;
@@ -646,18 +645,9 @@ var Vue = (function () {
646
645
  var _a;
647
646
  pauseScheduling();
648
647
  for (const effect2 of dep.keys()) {
649
- if (!dep.computed && effect2.computed) {
650
- if (dep.get(effect2) === effect2._trackId && effect2._runnings > 0) {
651
- effect2._dirtyLevel = 2;
652
- continue;
653
- }
654
- }
655
648
  let tracking;
656
649
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
657
650
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
658
- if (effect2.computed && effect2._dirtyLevel === 2) {
659
- effect2._shouldSchedule = true;
660
- }
661
651
  effect2._dirtyLevel = dirtyLevel;
662
652
  }
663
653
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -665,7 +655,7 @@ var Vue = (function () {
665
655
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
666
656
  }
667
657
  effect2.trigger();
668
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
658
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
669
659
  effect2._shouldSchedule = false;
670
660
  if (effect2.scheduler) {
671
661
  queueEffectSchedulers.push(effect2.scheduler);
@@ -757,7 +747,7 @@ var Vue = (function () {
757
747
  if (dep) {
758
748
  triggerEffects(
759
749
  dep,
760
- 5,
750
+ 4,
761
751
  {
762
752
  target,
763
753
  type,
@@ -1360,7 +1350,7 @@ var Vue = (function () {
1360
1350
  () => getter(this._value),
1361
1351
  () => triggerRefValue(
1362
1352
  this,
1363
- this.effect._dirtyLevel === 3 ? 3 : 4
1353
+ this.effect._dirtyLevel === 2 ? 2 : 3
1364
1354
  )
1365
1355
  );
1366
1356
  this.effect.computed = this;
@@ -1370,7 +1360,7 @@ var Vue = (function () {
1370
1360
  get value() {
1371
1361
  const self = toRaw(this);
1372
1362
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1373
- triggerRefValue(self, 5);
1363
+ triggerRefValue(self, 4);
1374
1364
  }
1375
1365
  trackRefValue(self);
1376
1366
  if (self.effect._dirtyLevel >= 2) {
@@ -1379,7 +1369,7 @@ var Vue = (function () {
1379
1369
 
1380
1370
  getter: `, this.getter);
1381
1371
  }
1382
- triggerRefValue(self, 3);
1372
+ triggerRefValue(self, 2);
1383
1373
  }
1384
1374
  return self._value;
1385
1375
  }
@@ -1434,7 +1424,7 @@ getter: `, this.getter);
1434
1424
  );
1435
1425
  }
1436
1426
  }
1437
- function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1427
+ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1438
1428
  ref2 = toRaw(ref2);
1439
1429
  const dep = ref2.dep;
1440
1430
  if (dep) {
@@ -1485,12 +1475,12 @@ getter: `, this.getter);
1485
1475
  const oldVal = this._rawValue;
1486
1476
  this._rawValue = newVal;
1487
1477
  this._value = useDirectValue ? newVal : toReactive(newVal);
1488
- triggerRefValue(this, 5, newVal, oldVal);
1478
+ triggerRefValue(this, 4, newVal, oldVal);
1489
1479
  }
1490
1480
  }
1491
1481
  }
1492
1482
  function triggerRef(ref2) {
1493
- triggerRefValue(ref2, 5, ref2.value );
1483
+ triggerRefValue(ref2, 4, ref2.value );
1494
1484
  }
1495
1485
  function unref(ref2) {
1496
1486
  return isRef(ref2) ? ref2.value : ref2;
@@ -3337,7 +3327,6 @@ If this is a native custom element, make sure to exclude it from component resol
3337
3327
  }
3338
3328
  },
3339
3329
  hydrate: hydrateSuspense,
3340
- create: createSuspenseBoundary,
3341
3330
  normalize: normalizeSuspenseChildren
3342
3331
  };
3343
3332
  const Suspense = SuspenseImpl ;
@@ -5693,7 +5682,7 @@ If this is a native custom element, make sure to exclude it from component resol
5693
5682
  return vm;
5694
5683
  }
5695
5684
  }
5696
- Vue.version = `2.6.14-compat:${"3.4.29"}`;
5685
+ Vue.version = `2.6.14-compat:${"3.4.31"}`;
5697
5686
  Vue.config = singletonApp.config;
5698
5687
  Vue.use = (plugin, ...options) => {
5699
5688
  if (plugin && isFunction(plugin.install)) {
@@ -7002,18 +6991,8 @@ If you want to remount the same app, move your app creation logic into a factory
7002
6991
  let domType = node.nodeType;
7003
6992
  vnode.el = node;
7004
6993
  {
7005
- if (!("__vnode" in node)) {
7006
- Object.defineProperty(node, "__vnode", {
7007
- value: vnode,
7008
- enumerable: false
7009
- });
7010
- }
7011
- if (!("__vueParentComponent" in node)) {
7012
- Object.defineProperty(node, "__vueParentComponent", {
7013
- value: parentComponent,
7014
- enumerable: false
7015
- });
7016
- }
6994
+ def(node, "__vnode", vnode, true);
6995
+ def(node, "__vueParentComponent", parentComponent, true);
7017
6996
  }
7018
6997
  if (patchFlag === -2) {
7019
6998
  optimized = false;
@@ -7236,7 +7215,9 @@ Server rendered element contains more child nodes than client vdom.`
7236
7215
  if (props) {
7237
7216
  {
7238
7217
  for (const key in props) {
7239
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7218
+ if (// #11189 skip if this node has directives that have created hooks
7219
+ // as it could have mutated the DOM in any possible way
7220
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7240
7221
  logMismatchError();
7241
7222
  }
7242
7223
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7411,7 +7392,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7411
7392
  return [hydrate, hydrateNode];
7412
7393
  }
7413
7394
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7414
- var _a;
7415
7395
  let mismatchType;
7416
7396
  let mismatchKey;
7417
7397
  let actual;
@@ -7434,13 +7414,8 @@ Server rendered element contains fewer child nodes than client vdom.`
7434
7414
  }
7435
7415
  }
7436
7416
  }
7437
- const root = instance == null ? void 0 : instance.subTree;
7438
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7439
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7440
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7441
- for (const key2 in cssVars) {
7442
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7443
- }
7417
+ if (instance) {
7418
+ resolveCssVars(instance, vnode, expectedMap);
7444
7419
  }
7445
7420
  if (!isMapEqual(actualMap, expectedMap)) {
7446
7421
  mismatchType = mismatchKey = "style";
@@ -7500,8 +7475,8 @@ Server rendered element contains fewer child nodes than client vdom.`
7500
7475
  const styleMap = /* @__PURE__ */ new Map();
7501
7476
  for (const item of str.split(";")) {
7502
7477
  let [key, value] = item.split(":");
7503
- key = key == null ? void 0 : key.trim();
7504
- value = value == null ? void 0 : value.trim();
7478
+ key = key.trim();
7479
+ value = value && value.trim();
7505
7480
  if (key && value) {
7506
7481
  styleMap.set(key, value);
7507
7482
  }
@@ -7519,6 +7494,18 @@ Server rendered element contains fewer child nodes than client vdom.`
7519
7494
  }
7520
7495
  return true;
7521
7496
  }
7497
+ function resolveCssVars(instance, vnode, expectedMap) {
7498
+ const root = instance.subTree;
7499
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7500
+ const cssVars = instance.getCssVars();
7501
+ for (const key in cssVars) {
7502
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7503
+ }
7504
+ }
7505
+ if (vnode === root && instance.parent) {
7506
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7507
+ }
7508
+ }
7522
7509
 
7523
7510
  let supported;
7524
7511
  let perf;
@@ -7836,14 +7823,8 @@ Server rendered element contains fewer child nodes than client vdom.`
7836
7823
  }
7837
7824
  }
7838
7825
  {
7839
- Object.defineProperty(el, "__vnode", {
7840
- value: vnode,
7841
- enumerable: false
7842
- });
7843
- Object.defineProperty(el, "__vueParentComponent", {
7844
- value: parentComponent,
7845
- enumerable: false
7846
- });
7826
+ def(el, "__vnode", vnode, true);
7827
+ def(el, "__vueParentComponent", parentComponent, true);
7847
7828
  }
7848
7829
  if (dirs) {
7849
7830
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7905,6 +7886,9 @@ Server rendered element contains fewer child nodes than client vdom.`
7905
7886
  };
7906
7887
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7907
7888
  const el = n2.el = n1.el;
7889
+ {
7890
+ el.__vnode = n2;
7891
+ }
7908
7892
  let { patchFlag, dynamicChildren, dirs } = n2;
7909
7893
  patchFlag |= n1.patchFlag & 16;
7910
7894
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8824,6 +8808,9 @@ Server rendered element contains fewer child nodes than client vdom.`
8824
8808
  dirs,
8825
8809
  memoIndex
8826
8810
  } = vnode;
8811
+ if (patchFlag === -2) {
8812
+ optimized = false;
8813
+ }
8827
8814
  if (ref != null) {
8828
8815
  setRef(ref, null, parentSuspense, vnode, true);
8829
8816
  }
@@ -8855,7 +8842,6 @@ Server rendered element contains fewer child nodes than client vdom.`
8855
8842
  vnode,
8856
8843
  parentComponent,
8857
8844
  parentSuspense,
8858
- optimized,
8859
8845
  internals,
8860
8846
  doRemove
8861
8847
  );
@@ -10150,7 +10136,7 @@ Server rendered element contains fewer child nodes than client vdom.`
10150
10136
  }
10151
10137
  updateCssVars(n2);
10152
10138
  },
10153
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10139
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10154
10140
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10155
10141
  if (target) {
10156
10142
  hostRemove(targetAnchor);
@@ -11401,7 +11387,7 @@ Component that was made reactive: `,
11401
11387
  return true;
11402
11388
  }
11403
11389
 
11404
- const version = "3.4.29";
11390
+ const version = "3.4.31";
11405
11391
  const warn = warn$1 ;
11406
11392
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11407
11393
  const devtools = devtools$1 ;
@@ -12028,7 +12014,10 @@ Component that was made reactive: `,
12028
12014
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
12029
12015
  el.removeAttribute(key);
12030
12016
  } else {
12031
- el.setAttribute(key, isBoolean ? "" : String(value));
12017
+ el.setAttribute(
12018
+ key,
12019
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
12020
+ );
12032
12021
  }
12033
12022
  }
12034
12023
  }
@@ -12230,7 +12219,7 @@ Expected function or array of functions, received type ${typeof value}.`
12230
12219
  parentSuspense,
12231
12220
  unmountChildren
12232
12221
  );
12233
- if (key === "value" || key === "checked" || key === "selected") {
12222
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12234
12223
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12235
12224
  }
12236
12225
  } else {
@@ -17214,9 +17203,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17214
17203
  break;
17215
17204
  }
17216
17205
  }
17217
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
17218
- children.splice(i, 1);
17219
- i--;
17206
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17220
17207
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17221
17208
  while (conditional.alternate.type === 19) {
17222
17209
  conditional = conditional.alternate;
@@ -18250,8 +18237,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18250
18237
  }
18251
18238
  if (node.type === 5) {
18252
18239
  rewriteFilter(node.content, context);
18253
- }
18254
- if (node.type === 1) {
18240
+ } else if (node.type === 1) {
18255
18241
  node.props.forEach((prop) => {
18256
18242
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
18257
18243
  rewriteFilter(prop.exp, context);