@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
  **/
@@ -411,7 +411,7 @@ class ReactiveEffect {
411
411
  /**
412
412
  * @internal
413
413
  */
414
- this._dirtyLevel = 4;
414
+ this._dirtyLevel = 5;
415
415
  /**
416
416
  * @internal
417
417
  */
@@ -431,14 +431,20 @@ class ReactiveEffect {
431
431
  recordEffectScope(this, scope);
432
432
  }
433
433
  get dirty() {
434
- if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
434
+ if (this._dirtyLevel === 2)
435
+ return false;
436
+ if (this._dirtyLevel === 3 || this._dirtyLevel === 4) {
435
437
  this._dirtyLevel = 1;
436
438
  pauseTracking();
437
439
  for (let i = 0; i < this._depsLength; i++) {
438
440
  const dep = this.deps[i];
439
441
  if (dep.computed) {
442
+ if (dep.computed.effect._dirtyLevel === 2) {
443
+ resetTracking();
444
+ return true;
445
+ }
440
446
  triggerComputed(dep.computed);
441
- if (this._dirtyLevel >= 4) {
447
+ if (this._dirtyLevel >= 5) {
442
448
  break;
443
449
  }
444
450
  }
@@ -448,10 +454,10 @@ class ReactiveEffect {
448
454
  }
449
455
  resetTracking();
450
456
  }
451
- return this._dirtyLevel >= 4;
457
+ return this._dirtyLevel >= 5;
452
458
  }
453
459
  set dirty(v) {
454
- this._dirtyLevel = v ? 4 : 0;
460
+ this._dirtyLevel = v ? 5 : 0;
455
461
  }
456
462
  run() {
457
463
  this._dirtyLevel = 0;
@@ -573,8 +579,17 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
573
579
  pauseScheduling();
574
580
  for (const effect2 of dep.keys()) {
575
581
  let tracking;
582
+ if (!dep.computed && effect2.computed) {
583
+ if (effect2._runnings > 0 && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
584
+ effect2._dirtyLevel = 2;
585
+ continue;
586
+ }
587
+ }
576
588
  if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
577
589
  effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
590
+ if (effect2.computed && effect2._dirtyLevel === 2) {
591
+ effect2._shouldSchedule = true;
592
+ }
578
593
  effect2._dirtyLevel = dirtyLevel;
579
594
  }
580
595
  if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
@@ -582,7 +597,7 @@ function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
582
597
  (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
583
598
  }
584
599
  effect2.trigger();
585
- if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
600
+ if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 3) {
586
601
  effect2._shouldSchedule = false;
587
602
  if (effect2.scheduler) {
588
603
  queueEffectSchedulers.push(effect2.scheduler);
@@ -674,7 +689,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
674
689
  if (dep) {
675
690
  triggerEffects(
676
691
  dep,
677
- 4,
692
+ 5,
678
693
  {
679
694
  target,
680
695
  type,
@@ -1277,7 +1292,7 @@ class ComputedRefImpl {
1277
1292
  () => getter(this._value),
1278
1293
  () => triggerRefValue(
1279
1294
  this,
1280
- this.effect._dirtyLevel === 2 ? 2 : 3
1295
+ this.effect._dirtyLevel === 3 ? 3 : 4
1281
1296
  )
1282
1297
  );
1283
1298
  this.effect.computed = this;
@@ -1286,8 +1301,11 @@ class ComputedRefImpl {
1286
1301
  }
1287
1302
  get value() {
1288
1303
  const self = toRaw(this);
1304
+ const lastDirtyLevel = self.effect._dirtyLevel;
1289
1305
  if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
1290
- triggerRefValue(self, 4);
1306
+ if (lastDirtyLevel !== 3) {
1307
+ triggerRefValue(self, 5);
1308
+ }
1291
1309
  }
1292
1310
  trackRefValue(self);
1293
1311
  if (self.effect._dirtyLevel >= 2) {
@@ -1296,7 +1314,7 @@ class ComputedRefImpl {
1296
1314
 
1297
1315
  getter: `, this.getter);
1298
1316
  }
1299
- triggerRefValue(self, 2);
1317
+ triggerRefValue(self, 3);
1300
1318
  }
1301
1319
  return self._value;
1302
1320
  }
@@ -1351,7 +1369,7 @@ function trackRefValue(ref2) {
1351
1369
  );
1352
1370
  }
1353
1371
  }
1354
- function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) {
1372
+ function triggerRefValue(ref2, dirtyLevel = 5, newVal, oldVal) {
1355
1373
  ref2 = toRaw(ref2);
1356
1374
  const dep = ref2.dep;
1357
1375
  if (dep) {
@@ -1402,12 +1420,12 @@ class RefImpl {
1402
1420
  const oldVal = this._rawValue;
1403
1421
  this._rawValue = newVal;
1404
1422
  this._value = useDirectValue ? newVal : toReactive(newVal);
1405
- triggerRefValue(this, 4, newVal, oldVal);
1423
+ triggerRefValue(this, 5, newVal, oldVal);
1406
1424
  }
1407
1425
  }
1408
1426
  }
1409
1427
  function triggerRef(ref2) {
1410
- triggerRefValue(ref2, 4, ref2.value );
1428
+ triggerRefValue(ref2, 5, ref2.value );
1411
1429
  }
1412
1430
  function unref(ref2) {
1413
1431
  return isRef(ref2) ? ref2.value : ref2;
@@ -3254,7 +3272,6 @@ const SuspenseImpl = {
3254
3272
  }
3255
3273
  },
3256
3274
  hydrate: hydrateSuspense,
3257
- create: createSuspenseBoundary,
3258
3275
  normalize: normalizeSuspenseChildren
3259
3276
  };
3260
3277
  const Suspense = SuspenseImpl ;
@@ -5610,7 +5627,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5610
5627
  return vm;
5611
5628
  }
5612
5629
  }
5613
- Vue.version = `2.6.14-compat:${"3.4.28"}`;
5630
+ Vue.version = `2.6.14-compat:${"3.4.30"}`;
5614
5631
  Vue.config = singletonApp.config;
5615
5632
  Vue.use = (plugin, ...options) => {
5616
5633
  if (plugin && isFunction(plugin.install)) {
@@ -6919,18 +6936,8 @@ function createHydrationFunctions(rendererInternals) {
6919
6936
  let domType = node.nodeType;
6920
6937
  vnode.el = node;
6921
6938
  {
6922
- if (!("__vnode" in node)) {
6923
- Object.defineProperty(node, "__vnode", {
6924
- value: vnode,
6925
- enumerable: false
6926
- });
6927
- }
6928
- if (!("__vueParentComponent" in node)) {
6929
- Object.defineProperty(node, "__vueParentComponent", {
6930
- value: parentComponent,
6931
- enumerable: false
6932
- });
6933
- }
6939
+ def(node, "__vnode", vnode, true);
6940
+ def(node, "__vueParentComponent", parentComponent, true);
6934
6941
  }
6935
6942
  if (patchFlag === -2) {
6936
6943
  optimized = false;
@@ -7153,7 +7160,9 @@ Server rendered element contains more child nodes than client vdom.`
7153
7160
  if (props) {
7154
7161
  {
7155
7162
  for (const key in props) {
7156
- if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7163
+ if (// #11189 skip if this node has directives that have created hooks
7164
+ // as it could have mutated the DOM in any possible way
7165
+ !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
7157
7166
  logMismatchError();
7158
7167
  }
7159
7168
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -7328,7 +7337,6 @@ Server rendered element contains fewer child nodes than client vdom.`
7328
7337
  return [hydrate, hydrateNode];
7329
7338
  }
7330
7339
  function propHasMismatch(el, key, clientValue, vnode, instance) {
7331
- var _a;
7332
7340
  let mismatchType;
7333
7341
  let mismatchKey;
7334
7342
  let actual;
@@ -7351,13 +7359,8 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
7351
7359
  }
7352
7360
  }
7353
7361
  }
7354
- const root = instance == null ? void 0 : instance.subTree;
7355
- if (vnode === root || // eslint-disable-next-line no-restricted-syntax
7356
- (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
7357
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
7358
- for (const key2 in cssVars) {
7359
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
7360
- }
7362
+ if (instance) {
7363
+ resolveCssVars(instance, vnode, expectedMap);
7361
7364
  }
7362
7365
  if (!isMapEqual(actualMap, expectedMap)) {
7363
7366
  mismatchType = mismatchKey = "style";
@@ -7417,8 +7420,8 @@ function toStyleMap(str) {
7417
7420
  const styleMap = /* @__PURE__ */ new Map();
7418
7421
  for (const item of str.split(";")) {
7419
7422
  let [key, value] = item.split(":");
7420
- key = key == null ? void 0 : key.trim();
7421
- value = value == null ? void 0 : value.trim();
7423
+ key = key.trim();
7424
+ value = value && value.trim();
7422
7425
  if (key && value) {
7423
7426
  styleMap.set(key, value);
7424
7427
  }
@@ -7436,6 +7439,18 @@ function isMapEqual(a, b) {
7436
7439
  }
7437
7440
  return true;
7438
7441
  }
7442
+ function resolveCssVars(instance, vnode, expectedMap) {
7443
+ const root = instance.subTree;
7444
+ if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
7445
+ const cssVars = instance.getCssVars();
7446
+ for (const key in cssVars) {
7447
+ expectedMap.set(`--${key}`, String(cssVars[key]));
7448
+ }
7449
+ }
7450
+ if (vnode === root && instance.parent) {
7451
+ resolveCssVars(instance.parent, instance.vnode, expectedMap);
7452
+ }
7453
+ }
7439
7454
 
7440
7455
  let supported;
7441
7456
  let perf;
@@ -7753,14 +7768,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7753
7768
  }
7754
7769
  }
7755
7770
  {
7756
- Object.defineProperty(el, "__vnode", {
7757
- value: vnode,
7758
- enumerable: false
7759
- });
7760
- Object.defineProperty(el, "__vueParentComponent", {
7761
- value: parentComponent,
7762
- enumerable: false
7763
- });
7771
+ def(el, "__vnode", vnode, true);
7772
+ def(el, "__vueParentComponent", parentComponent, true);
7764
7773
  }
7765
7774
  if (dirs) {
7766
7775
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
@@ -7822,6 +7831,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7822
7831
  };
7823
7832
  const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
7824
7833
  const el = n2.el = n1.el;
7834
+ {
7835
+ el.__vnode = n2;
7836
+ }
7825
7837
  let { patchFlag, dynamicChildren, dirs } = n2;
7826
7838
  patchFlag |= n1.patchFlag & 16;
7827
7839
  const oldProps = n1.props || EMPTY_OBJ;
@@ -8741,6 +8753,9 @@ function baseCreateRenderer(options, createHydrationFns) {
8741
8753
  dirs,
8742
8754
  memoIndex
8743
8755
  } = vnode;
8756
+ if (patchFlag === -2) {
8757
+ optimized = false;
8758
+ }
8744
8759
  if (ref != null) {
8745
8760
  setRef(ref, null, parentSuspense, vnode, true);
8746
8761
  }
@@ -8772,7 +8787,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8772
8787
  vnode,
8773
8788
  parentComponent,
8774
8789
  parentSuspense,
8775
- optimized,
8776
8790
  internals,
8777
8791
  doRemove
8778
8792
  );
@@ -10073,7 +10087,7 @@ const TeleportImpl = {
10073
10087
  }
10074
10088
  updateCssVars(n2);
10075
10089
  },
10076
- remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10090
+ remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
10077
10091
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
10078
10092
  if (target) {
10079
10093
  hostRemove(targetAnchor);
@@ -11324,7 +11338,7 @@ function isMemoSame(cached, memo) {
11324
11338
  return true;
11325
11339
  }
11326
11340
 
11327
- const version = "3.4.28";
11341
+ const version = "3.4.30";
11328
11342
  const warn = warn$1 ;
11329
11343
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11330
11344
  const devtools = devtools$1 ;
@@ -11951,7 +11965,10 @@ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBoolean
11951
11965
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
11952
11966
  el.removeAttribute(key);
11953
11967
  } else {
11954
- el.setAttribute(key, isBoolean ? "" : String(value));
11968
+ el.setAttribute(
11969
+ key,
11970
+ isBoolean ? "" : isSymbol(value) ? String(value) : value
11971
+ );
11955
11972
  }
11956
11973
  }
11957
11974
  }
@@ -12153,7 +12170,7 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
12153
12170
  parentSuspense,
12154
12171
  unmountChildren
12155
12172
  );
12156
- if (key === "value" || key === "checked" || key === "selected") {
12173
+ if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
12157
12174
  patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
12158
12175
  }
12159
12176
  } else {
@@ -12201,8 +12218,8 @@ function shouldSetAsProp(el, key, value, isSVG) {
12201
12218
 
12202
12219
  /*! #__NO_SIDE_EFFECTS__ */
12203
12220
  // @__NO_SIDE_EFFECTS__
12204
- function defineCustomElement(options, hydrate2) {
12205
- const Comp = defineComponent(options);
12221
+ function defineCustomElement(options, extraOptions, hydrate2) {
12222
+ const Comp = defineComponent(options, extraOptions);
12206
12223
  class VueCustomElement extends VueElement {
12207
12224
  constructor(initialProps) {
12208
12225
  super(Comp, initialProps, hydrate2);
@@ -12212,8 +12229,8 @@ function defineCustomElement(options, hydrate2) {
12212
12229
  return VueCustomElement;
12213
12230
  }
12214
12231
  /*! #__NO_SIDE_EFFECTS__ */
12215
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options) => {
12216
- return /* @__PURE__ */ defineCustomElement(options, hydrate);
12232
+ const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12233
+ return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
12217
12234
  };
12218
12235
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
12219
12236
  };