@vue/compat 3.5.6 → 3.5.7

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.5.6
2
+ * @vue/compat v3.5.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -664,7 +664,7 @@ function refreshComputed(computed) {
664
664
  computed.flags &= ~2;
665
665
  }
666
666
  }
667
- function removeSub(link) {
667
+ function removeSub(link, fromComputed = false) {
668
668
  const { dep, prevSub, nextSub } = link;
669
669
  if (prevSub) {
670
670
  prevSub.nextSub = nextSub;
@@ -677,10 +677,18 @@ function removeSub(link) {
677
677
  if (dep.subs === link) {
678
678
  dep.subs = prevSub;
679
679
  }
680
- if (!dep.subs && dep.computed) {
681
- dep.computed.flags &= ~4;
682
- for (let l = dep.computed.deps; l; l = l.nextDep) {
683
- removeSub(l);
680
+ if (dep.subsHead === link) {
681
+ dep.subsHead = nextSub;
682
+ }
683
+ if (!dep.subs) {
684
+ if (dep.computed) {
685
+ dep.computed.flags &= ~4;
686
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
687
+ removeSub(l, true);
688
+ }
689
+ } else if (dep.map && !fromComputed) {
690
+ dep.map.delete(dep.key);
691
+ if (!dep.map.size) targetMap.delete(dep.target);
684
692
  }
685
693
  }
686
694
  }
@@ -761,6 +769,12 @@ class Dep {
761
769
  * Doubly linked list representing the subscribing effects (tail)
762
770
  */
763
771
  this.subs = void 0;
772
+ /**
773
+ * For object property deps cleanup
774
+ */
775
+ this.target = void 0;
776
+ this.map = void 0;
777
+ this.key = void 0;
764
778
  {
765
779
  this.subsHead = void 0;
766
780
  }
@@ -881,6 +895,9 @@ function track(target, type, key) {
881
895
  let dep = depsMap.get(key);
882
896
  if (!dep) {
883
897
  depsMap.set(key, dep = new Dep());
898
+ dep.target = target;
899
+ dep.map = depsMap;
900
+ dep.key = key;
884
901
  }
885
902
  {
886
903
  dep.track({
@@ -1757,13 +1774,15 @@ class RefImpl {
1757
1774
  }
1758
1775
  }
1759
1776
  function triggerRef(ref2) {
1760
- {
1761
- ref2.dep.trigger({
1762
- target: ref2,
1763
- type: "set",
1764
- key: "value",
1765
- newValue: ref2._value
1766
- });
1777
+ if (ref2.dep) {
1778
+ {
1779
+ ref2.dep.trigger({
1780
+ target: ref2,
1781
+ type: "set",
1782
+ key: "value",
1783
+ newValue: ref2._value
1784
+ });
1785
+ }
1767
1786
  }
1768
1787
  }
1769
1788
  function unref(ref2) {
@@ -2511,7 +2530,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2511
2530
  cb.flags &= ~1;
2512
2531
  }
2513
2532
  cb();
2514
- cb.flags &= ~1;
2533
+ if (!(cb.flags & 4)) {
2534
+ cb.flags &= ~1;
2535
+ }
2515
2536
  }
2516
2537
  }
2517
2538
  }
@@ -2567,7 +2588,9 @@ function flushJobs(seen) {
2567
2588
  job.i,
2568
2589
  job.i ? 15 : 14
2569
2590
  );
2570
- job.flags &= ~1;
2591
+ if (!(job.flags & 4)) {
2592
+ job.flags &= ~1;
2593
+ }
2571
2594
  }
2572
2595
  }
2573
2596
  } finally {
@@ -4897,6 +4920,11 @@ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4897
4920
  const id = requestIdleCallback(hydrate, { timeout });
4898
4921
  return () => cancelIdleCallback(id);
4899
4922
  };
4923
+ function elementIsVisibleInViewport(el) {
4924
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4925
+ const { innerHeight, innerWidth } = window;
4926
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4927
+ }
4900
4928
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4901
4929
  const ob = new IntersectionObserver((entries) => {
4902
4930
  for (const e of entries) {
@@ -4906,7 +4934,15 @@ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4906
4934
  break;
4907
4935
  }
4908
4936
  }, opts);
4909
- forEach((el) => ob.observe(el));
4937
+ forEach((el) => {
4938
+ if (!(el instanceof Element)) return;
4939
+ if (elementIsVisibleInViewport(el)) {
4940
+ hydrate();
4941
+ ob.disconnect();
4942
+ return false;
4943
+ }
4944
+ ob.observe(el);
4945
+ });
4910
4946
  return () => ob.disconnect();
4911
4947
  };
4912
4948
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4951,7 +4987,10 @@ function forEachElement(node, cb) {
4951
4987
  let next = node.nextSibling;
4952
4988
  while (next) {
4953
4989
  if (next.nodeType === 1) {
4954
- cb(next);
4990
+ const result = cb(next);
4991
+ if (result === false) {
4992
+ break;
4993
+ }
4955
4994
  } else if (isComment(next)) {
4956
4995
  if (next.data === "]") {
4957
4996
  if (--depth === 0) break;
@@ -7044,7 +7083,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7044
7083
  return vm;
7045
7084
  }
7046
7085
  }
7047
- Vue.version = `2.6.14-compat:${"3.5.6"}`;
7086
+ Vue.version = `2.6.14-compat:${"3.5.7"}`;
7048
7087
  Vue.config = singletonApp.config;
7049
7088
  Vue.use = (plugin, ...options) => {
7050
7089
  if (plugin && isFunction(plugin.install)) {
@@ -12159,7 +12198,7 @@ function isMemoSame(cached, memo) {
12159
12198
  return true;
12160
12199
  }
12161
12200
 
12162
- const version = "3.5.6";
12201
+ const version = "3.5.7";
12163
12202
  const warn = warn$1 ;
12164
12203
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12165
12204
  const devtools = devtools$1 ;
@@ -12502,7 +12541,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
12502
12541
  resolve();
12503
12542
  }
12504
12543
  };
12505
- if (explicitTimeout) {
12544
+ if (explicitTimeout != null) {
12506
12545
  return setTimeout(resolveIfNotStale, explicitTimeout);
12507
12546
  }
12508
12547
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);