@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.28
2
+ * @vue/compat 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;
@@ -3321,7 +3339,6 @@ const SuspenseImpl = {
3321
3339
  }
3322
3340
  },
3323
3341
  hydrate: hydrateSuspense,
3324
- create: createSuspenseBoundary,
3325
3342
  normalize: normalizeSuspenseChildren
3326
3343
  };
3327
3344
  const Suspense = SuspenseImpl ;
@@ -5677,7 +5694,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5677
5694
  return vm;
5678
5695
  }
5679
5696
  }
5680
- Vue.version = `2.6.14-compat:${"3.4.28"}`;
5697
+ Vue.version = `2.6.14-compat:${"3.4.30"}`;
5681
5698
  Vue.config = singletonApp.config;
5682
5699
  Vue.use = (plugin, ...options) => {
5683
5700
  if (plugin && isFunction(plugin.install)) {
@@ -6986,18 +7003,8 @@ function createHydrationFunctions(rendererInternals) {
6986
7003
  let domType = node.nodeType;
6987
7004
  vnode.el = node;
6988
7005
  {
6989
- if (!("__vnode" in node)) {
6990
- Object.defineProperty(node, "__vnode", {
6991
- value: vnode,
6992
- enumerable: false
6993
- });
6994
- }
6995
- if (!("__vueParentComponent" in node)) {
6996
- Object.defineProperty(node, "__vueParentComponent", {
6997
- value: parentComponent,
6998
- enumerable: false
6999
- });
7000
- }
7006
+ def(node, "__vnode", vnode, true);
7007
+ def(node, "__vueParentComponent", parentComponent, true);
7001
7008
  }
7002
7009
  if (patchFlag === -2) {
7003
7010
  optimized = false;
@@ -7220,7 +7227,9 @@ Server rendered element contains more child nodes than client vdom.`
7220
7227
  if (props) {
7221
7228
  {
7222
7229
  for (const key in props) {
7223
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7230
+ if (// #11189 skip if this node has directives that have created hooks
7231
+ // as it could have mutated the DOM in any possible way
7232
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7224
7233
  logMismatchError();
7225
7234
  }
7226
7235
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7395,7 +7404,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7395
7404
  return [hydrate, hydrateNode];
7396
7405
  }
7397
7406
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7398
- var _a;
7399
7407
  let mismatchType;
7400
7408
  let mismatchKey;
7401
7409
  let actual;
@@ -7418,13 +7426,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7418
7426
  }
7419
7427
  }
7420
7428
  }
7421
- const root = instance == null ? void 0 : instance.subTree;
7422
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7423
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7424
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7425
- for (const key2 in cssVars) {
7426
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7427
- }
7429
+ if (instance) {
7430
+ resolveCssVars(instance, vnode, expectedMap);
7428
7431
  }
7429
7432
  if (!isMapEqual(actualMap, expectedMap)) {
7430
7433
  mismatchType = mismatchKey = "style";
@@ -7484,8 +7487,8 @@ function toStyleMap(str) {
7484
7487
  const styleMap = /* @__PURE__ */ new Map();
7485
7488
  for (const item of str.split(";")) {
7486
7489
  let [key, value] = item.split(":");
7487
- key = key == null ? void 0 : key.trim();
7488
- value = value == null ? void 0 : value.trim();
7490
+ key = key.trim();
7491
+ value = value && value.trim();
7489
7492
  if (key && value) {
7490
7493
  styleMap.set(key, value);
7491
7494
  }
@@ -7503,6 +7506,18 @@ function isMapEqual(a, b) {
7503
7506
  }
7504
7507
  return true;
7505
7508
  }
7509
+ function resolveCssVars(instance, vnode, expectedMap) {
7510
+ const root = instance.subTree;
7511
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7512
+ const cssVars = instance.getCssVars();
7513
+ for (const key in cssVars) {
7514
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7515
+ }
7516
+ }
7517
+ if (vnode === root && instance.parent) {
7518
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7519
+ }
7520
+ }
7506
7521
 
7507
7522
  let supported;
7508
7523
  let perf;
@@ -7820,14 +7835,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7820
7835
  }
7821
7836
  }
7822
7837
  {
7823
- Object.defineProperty(el, "__vnode", {
7824
- value: vnode,
7825
- enumerable: false
7826
- });
7827
- Object.defineProperty(el, "__vueParentComponent", {
7828
- value: parentComponent,
7829
- enumerable: false
7830
- });
7838
+ def(el, "__vnode", vnode, true);
7839
+ def(el, "__vueParentComponent", parentComponent, true);
7831
7840
  }
7832
7841
  if (dirs) {
7833
7842
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7889,6 +7898,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7889
7898
  };
7890
7899
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7891
7900
  const el = n2.el = n1.el;
7901
+ {
7902
+ el.__vnode = n2;
7903
+ }
7892
7904
  let { patchFlag, dynamicChildren, dirs } = n2;
7893
7905
  patchFlag |= n1.patchFlag & 16;
7894
7906
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8808,6 +8820,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8808
8820
  dirs,
8809
8821
  memoIndex
8810
8822
  } = vnode;
8823
+ if (patchFlag === -2) {
8824
+ optimized = false;
8825
+ }
8811
8826
  if (ref != null) {
8812
8827
  setRef(ref, null, parentSuspense, vnode, true);
8813
8828
  }
@@ -8839,7 +8854,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8839
8854
  vnode,
8840
8855
  parentComponent,
8841
8856
  parentSuspense,
8842
- optimized,
8843
8857
  internals,
8844
8858
  doRemove
8845
8859
  );
@@ -10140,7 +10154,7 @@ const TeleportImpl = {
10140
10154
  }
10141
10155
  updateCssVars(n2);
10142
10156
  },
10143
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10157
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10144
10158
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10145
10159
  if (target) {
10146
10160
  hostRemove(targetAnchor);
@@ -11391,7 +11405,7 @@ function isMemoSame(cached, memo) {
11391
11405
  return true;
11392
11406
  }
11393
11407
 
11394
- const version = "3.4.28";
11408
+ const version = "3.4.30";
11395
11409
  const warn = warn$1 ;
11396
11410
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11397
11411
  const devtools = devtools$1 ;
@@ -12018,7 +12032,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
12018
12032
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
12019
12033
  el.removeAttribute(key);
12020
12034
  } else {
12021
- el.setAttribute(key, isBoolean ? "" : String(value));
12035
+ el.setAttribute(
12036
+ key,
12037
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
12038
+ );
12022
12039
  }
12023
12040
  }
12024
12041
  }
@@ -12220,7 +12237,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12220
12237
  parentSuspense,
12221
12238
  unmountChildren
12222
12239
  );
12223
- if (key === "value" || key === "checked" || key === "selected") {
12240
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12224
12241
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12225
12242
  }
12226
12243
  } else {
@@ -12268,8 +12285,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
12268
12285
 
12269
12286
  /*! #__NO_SIDE_EFFECTS__ */
12270
12287
  // @__NO_SIDE_EFFECTS__
12271
- function defineCustomElement(options, hydrate2) {
12272
- const Comp = defineComponent(options);
12288
+ function defineCustomElement(options, extraOptions, hydrate2) {
12289
+ const Comp = defineComponent(options, extraOptions);
12273
12290
  class VueCustomElement extends VueElement {
12274
12291
  constructor(initialProps) {
12275
12292
  super(Comp, initialProps, hydrate2);
@@ -12279,8 +12296,8 @@ function defineCustomElement(options, hydrate2) {
12279
12296
  return VueCustomElement;
12280
12297
  }
12281
12298
  /*! #__NO_SIDE_EFFECTS__ */
12282
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
12283
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
12299
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12300
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12284
12301
  };
12285
12302
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12286
12303
  };
@@ -17216,9 +17233,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17216
17233
  break;
17217
17234
  }
17218
17235
  }
17219
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
17220
- children.splice(i, 1);
17221
- i--;
17236
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17222
17237
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17223
17238
  while (conditional.alternate.type === 19) {
17224
17239
  conditional = conditional.alternate;
@@ -18252,8 +18267,7 @@ const transformFilter = (node, context) => {
18252
18267
  }
18253
18268
  if (node.type === 5) {
18254
18269
  rewriteFilter(node.content, context);
18255
- }
18256
- if (node.type === 1) {
18270
+ } else if (node.type === 1) {
18257
18271
  node.props.forEach((prop) => {
18258
18272
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
18259
18273
  rewriteFilter(prop.exp, context);