@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
  !!(process.env.NODE_ENV !== "production") ? {
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, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1495
+ triggerRefValue(ref2, 5, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
1478
1496
  }
1479
1497
  function unref(ref2) {
1480
1498
  return isRef(ref2) ? ref2.value : ref2;
@@ -3327,7 +3345,6 @@ const SuspenseImpl = {
3327
3345
  }
3328
3346
  },
3329
3347
  hydrate: hydrateSuspense,
3330
- create: createSuspenseBoundary,
3331
3348
  normalize: normalizeSuspenseChildren
3332
3349
  };
3333
3350
  const Suspense = SuspenseImpl ;
@@ -5685,7 +5702,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5685
5702
  return vm;
5686
5703
  }
5687
5704
  }
5688
- Vue.version = `2.6.14-compat:${"3.4.28"}`;
5705
+ Vue.version = `2.6.14-compat:${"3.4.30"}`;
5689
5706
  Vue.config = singletonApp.config;
5690
5707
  Vue.use = (plugin, ...options) => {
5691
5708
  if (plugin && isFunction(plugin.install)) {
@@ -6996,18 +7013,8 @@ function createHydrationFunctions(rendererInternals) {
6996
7013
  let domType = node.nodeType;
6997
7014
  vnode.el = node;
6998
7015
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
6999
- if (!("__vnode" in node)) {
7000
- Object.defineProperty(node, "__vnode", {
7001
- value: vnode,
7002
- enumerable: false
7003
- });
7004
- }
7005
- if (!("__vueParentComponent" in node)) {
7006
- Object.defineProperty(node, "__vueParentComponent", {
7007
- value: parentComponent,
7008
- enumerable: false
7009
- });
7010
- }
7016
+ def(node, "__vnode", vnode, true);
7017
+ def(node, "__vueParentComponent", parentComponent, true);
7011
7018
  }
7012
7019
  if (patchFlag === -2) {
7013
7020
  optimized = false;
@@ -7230,7 +7237,9 @@ Server rendered element contains more child nodes than client vdom.`
7230
7237
  if (props) {
7231
7238
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
7232
7239
  for (const key in props) {
7233
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7240
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
7241
+ // as it could have mutated the DOM in any possible way
7242
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7234
7243
  logMismatchError();
7235
7244
  }
7236
7245
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7415,7 +7424,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7415
7424
  return [hydrate, hydrateNode];
7416
7425
  }
7417
7426
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7418
- var _a;
7419
7427
  let mismatchType;
7420
7428
  let mismatchKey;
7421
7429
  let actual;
@@ -7438,13 +7446,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7438
7446
  }
7439
7447
  }
7440
7448
  }
7441
- const root = instance == null ? void 0 : instance.subTree;
7442
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7443
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7444
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7445
- for (const key2 in cssVars) {
7446
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7447
- }
7449
+ if (instance) {
7450
+ resolveCssVars(instance, vnode, expectedMap);
7448
7451
  }
7449
7452
  if (!isMapEqual(actualMap, expectedMap)) {
7450
7453
  mismatchType = mismatchKey = "style";
@@ -7504,8 +7507,8 @@ function toStyleMap(str) {
7504
7507
  const styleMap = /* @__PURE__ */ new Map();
7505
7508
  for (const item of str.split(";")) {
7506
7509
  let [key, value] = item.split(":");
7507
- key = key == null ? void 0 : key.trim();
7508
- value = value == null ? void 0 : value.trim();
7510
+ key = key.trim();
7511
+ value = value && value.trim();
7509
7512
  if (key && value) {
7510
7513
  styleMap.set(key, value);
7511
7514
  }
@@ -7523,6 +7526,18 @@ function isMapEqual(a, b) {
7523
7526
  }
7524
7527
  return true;
7525
7528
  }
7529
+ function resolveCssVars(instance, vnode, expectedMap) {
7530
+ const root = instance.subTree;
7531
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7532
+ const cssVars = instance.getCssVars();
7533
+ for (const key in cssVars) {
7534
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7535
+ }
7536
+ }
7537
+ if (vnode === root && instance.parent) {
7538
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7539
+ }
7540
+ }
7526
7541
 
7527
7542
  let supported;
7528
7543
  let perf;
@@ -7867,14 +7882,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7867
7882
  }
7868
7883
  }
7869
7884
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7870
- Object.defineProperty(el, "__vnode", {
7871
- value: vnode,
7872
- enumerable: false
7873
- });
7874
- Object.defineProperty(el, "__vueParentComponent", {
7875
- value: parentComponent,
7876
- enumerable: false
7877
- });
7885
+ def(el, "__vnode", vnode, true);
7886
+ def(el, "__vueParentComponent", parentComponent, true);
7878
7887
  }
7879
7888
  if (dirs) {
7880
7889
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7936,6 +7945,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7936
7945
  };
7937
7946
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7938
7947
  const el = n2.el = n1.el;
7948
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7949
+ el.__vnode = n2;
7950
+ }
7939
7951
  let { patchFlag, dynamicChildren, dirs } = n2;
7940
7952
  patchFlag |= n1.patchFlag & 16;
7941
7953
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8866,6 +8878,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8866
8878
  dirs,
8867
8879
  memoIndex
8868
8880
  } = vnode;
8881
+ if (patchFlag === -2) {
8882
+ optimized = false;
8883
+ }
8869
8884
  if (ref != null) {
8870
8885
  setRef(ref, null, parentSuspense, vnode, true);
8871
8886
  }
@@ -8897,7 +8912,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8897
8912
  vnode,
8898
8913
  parentComponent,
8899
8914
  parentSuspense,
8900
- optimized,
8901
8915
  internals,
8902
8916
  doRemove
8903
8917
  );
@@ -10225,7 +10239,7 @@ const TeleportImpl = {
10225
10239
  }
10226
10240
  updateCssVars(n2);
10227
10241
  },
10228
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10242
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10229
10243
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10230
10244
  if (target) {
10231
10245
  hostRemove(targetAnchor);
@@ -11504,7 +11518,7 @@ function isMemoSame(cached, memo) {
11504
11518
  return true;
11505
11519
  }
11506
11520
 
11507
- const version = "3.4.28";
11521
+ const version = "3.4.30";
11508
11522
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11509
11523
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11510
11524
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12147,7 +12161,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
12147
12161
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
12148
12162
  el.removeAttribute(key);
12149
12163
  } else {
12150
- el.setAttribute(key, isBoolean ? "" : String(value));
12164
+ el.setAttribute(
12165
+ key,
12166
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
12167
+ );
12151
12168
  }
12152
12169
  }
12153
12170
  }
@@ -12349,7 +12366,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12349
12366
  parentSuspense,
12350
12367
  unmountChildren
12351
12368
  );
12352
- if (key === "value" || key === "checked" || key === "selected") {
12369
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12353
12370
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12354
12371
  }
12355
12372
  } else {
@@ -12397,8 +12414,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
12397
12414
 
12398
12415
  /*! #__NO_SIDE_EFFECTS__ */
12399
12416
  // @__NO_SIDE_EFFECTS__
12400
- function defineCustomElement(options, hydrate2) {
12401
- const Comp = defineComponent(options);
12417
+ function defineCustomElement(options, extraOptions, hydrate2) {
12418
+ const Comp = defineComponent(options, extraOptions);
12402
12419
  class VueCustomElement extends VueElement {
12403
12420
  constructor(initialProps) {
12404
12421
  super(Comp, initialProps, hydrate2);
@@ -12408,8 +12425,8 @@ function defineCustomElement(options, hydrate2) {
12408
12425
  return VueCustomElement;
12409
12426
  }
12410
12427
  /*! #__NO_SIDE_EFFECTS__ */
12411
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
12412
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
12428
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12429
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12413
12430
  };
12414
12431
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12415
12432
  };
@@ -17381,9 +17398,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17381
17398
  break;
17382
17399
  }
17383
17400
  }
17384
- if (prev && isTemplateNode(prev) && findDir(prev, "if")) {
17385
- children.splice(i, 1);
17386
- i--;
17401
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17387
17402
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17388
17403
  while (conditional.alternate.type === 19) {
17389
17404
  conditional = conditional.alternate;
@@ -18419,8 +18434,7 @@ const transformFilter = (node, context) => {
18419
18434
  }
18420
18435
  if (node.type === 5) {
18421
18436
  rewriteFilter(node.content, context);
18422
- }
18423
- if (node.type === 1) {
18437
+ } else if (node.type === 1) {
18424
18438
  node.props.forEach((prop) => {
18425
18439
  if (prop.type === 7 && prop.name !== "for" && prop.exp) {
18426
18440
  rewriteFilter(prop.exp, context);