@vue/compat 3.5.6 → 3.5.8

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.8
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -597,7 +597,7 @@ function prepareDeps(sub) {
597
597
  link.dep.activeLink = link;
598
598
  }
599
599
  }
600
- function cleanupDeps(sub) {
600
+ function cleanupDeps(sub, fromComputed = false) {
601
601
  let head;
602
602
  let tail = sub.depsTail;
603
603
  let link = tail;
@@ -605,7 +605,7 @@ function cleanupDeps(sub) {
605
605
  const prev = link.prevDep;
606
606
  if (link.version === -1) {
607
607
  if (link === tail) tail = prev;
608
- removeSub(link);
608
+ removeSub(link, fromComputed);
609
609
  removeDep(link);
610
610
  } else {
611
611
  head = link;
@@ -660,11 +660,11 @@ function refreshComputed(computed) {
660
660
  } finally {
661
661
  activeSub = prevSub;
662
662
  shouldTrack = prevShouldTrack;
663
- cleanupDeps(computed);
663
+ cleanupDeps(computed, true);
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 (!!(process.env.NODE_ENV !== "production") && 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
  if (!!(process.env.NODE_ENV !== "production")) {
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
  if (!!(process.env.NODE_ENV !== "production")) {
886
903
  dep.track({
@@ -1765,15 +1782,17 @@ class RefImpl {
1765
1782
  }
1766
1783
  }
1767
1784
  function triggerRef(ref2) {
1768
- if (!!(process.env.NODE_ENV !== "production")) {
1769
- ref2.dep.trigger({
1770
- target: ref2,
1771
- type: "set",
1772
- key: "value",
1773
- newValue: ref2._value
1774
- });
1775
- } else {
1776
- ref2.dep.trigger();
1785
+ if (ref2.dep) {
1786
+ if (!!(process.env.NODE_ENV !== "production")) {
1787
+ ref2.dep.trigger({
1788
+ target: ref2,
1789
+ type: "set",
1790
+ key: "value",
1791
+ newValue: ref2._value
1792
+ });
1793
+ } else {
1794
+ ref2.dep.trigger();
1795
+ }
1777
1796
  }
1778
1797
  }
1779
1798
  function unref(ref2) {
@@ -2526,7 +2545,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2526
2545
  cb.flags &= ~1;
2527
2546
  }
2528
2547
  cb();
2529
- cb.flags &= ~1;
2548
+ if (!(cb.flags & 4)) {
2549
+ cb.flags &= ~1;
2550
+ }
2530
2551
  }
2531
2552
  }
2532
2553
  }
@@ -2582,7 +2603,9 @@ function flushJobs(seen) {
2582
2603
  job.i,
2583
2604
  job.i ? 15 : 14
2584
2605
  );
2585
- job.flags &= ~1;
2606
+ if (!(job.flags & 4)) {
2607
+ job.flags &= ~1;
2608
+ }
2586
2609
  }
2587
2610
  }
2588
2611
  } finally {
@@ -4927,6 +4950,11 @@ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4927
4950
  const id = requestIdleCallback(hydrate, { timeout });
4928
4951
  return () => cancelIdleCallback(id);
4929
4952
  };
4953
+ function elementIsVisibleInViewport(el) {
4954
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4955
+ const { innerHeight, innerWidth } = window;
4956
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4957
+ }
4930
4958
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4931
4959
  const ob = new IntersectionObserver((entries) => {
4932
4960
  for (const e of entries) {
@@ -4936,7 +4964,15 @@ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4936
4964
  break;
4937
4965
  }
4938
4966
  }, opts);
4939
- forEach((el) => ob.observe(el));
4967
+ forEach((el) => {
4968
+ if (!(el instanceof Element)) return;
4969
+ if (elementIsVisibleInViewport(el)) {
4970
+ hydrate();
4971
+ ob.disconnect();
4972
+ return false;
4973
+ }
4974
+ ob.observe(el);
4975
+ });
4940
4976
  return () => ob.disconnect();
4941
4977
  };
4942
4978
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4981,7 +5017,10 @@ function forEachElement(node, cb) {
4981
5017
  let next = node.nextSibling;
4982
5018
  while (next) {
4983
5019
  if (next.nodeType === 1) {
4984
- cb(next);
5020
+ const result = cb(next);
5021
+ if (result === false) {
5022
+ break;
5023
+ }
4985
5024
  } else if (isComment(next)) {
4986
5025
  if (next.data === "]") {
4987
5026
  if (--depth === 0) break;
@@ -7076,7 +7115,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7076
7115
  return vm;
7077
7116
  }
7078
7117
  }
7079
- Vue.version = `2.6.14-compat:${"3.5.6"}`;
7118
+ Vue.version = `2.6.14-compat:${"3.5.8"}`;
7080
7119
  Vue.config = singletonApp.config;
7081
7120
  Vue.use = (plugin, ...options) => {
7082
7121
  if (plugin && isFunction(plugin.install)) {
@@ -12245,7 +12284,7 @@ function isMemoSame(cached, memo) {
12245
12284
  return true;
12246
12285
  }
12247
12286
 
12248
- const version = "3.5.6";
12287
+ const version = "3.5.8";
12249
12288
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12250
12289
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12251
12290
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12588,7 +12627,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
12588
12627
  resolve();
12589
12628
  }
12590
12629
  };
12591
- if (explicitTimeout) {
12630
+ if (explicitTimeout != null) {
12592
12631
  return setTimeout(resolveIfNotStale, explicitTimeout);
12593
12632
  }
12594
12633
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.6
2
+ * @vue/compat v3.5.8
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -600,7 +600,7 @@ var Vue = (function () {
600
600
  link.dep.activeLink = link;
601
601
  }
602
602
  }
603
- function cleanupDeps(sub) {
603
+ function cleanupDeps(sub, fromComputed = false) {
604
604
  let head;
605
605
  let tail = sub.depsTail;
606
606
  let link = tail;
@@ -608,7 +608,7 @@ var Vue = (function () {
608
608
  const prev = link.prevDep;
609
609
  if (link.version === -1) {
610
610
  if (link === tail) tail = prev;
611
- removeSub(link);
611
+ removeSub(link, fromComputed);
612
612
  removeDep(link);
613
613
  } else {
614
614
  head = link;
@@ -663,11 +663,11 @@ var Vue = (function () {
663
663
  } finally {
664
664
  activeSub = prevSub;
665
665
  shouldTrack = prevShouldTrack;
666
- cleanupDeps(computed);
666
+ cleanupDeps(computed, true);
667
667
  computed.flags &= ~2;
668
668
  }
669
669
  }
670
- function removeSub(link) {
670
+ function removeSub(link, fromComputed = false) {
671
671
  const { dep, prevSub, nextSub } = link;
672
672
  if (prevSub) {
673
673
  prevSub.nextSub = nextSub;
@@ -680,10 +680,18 @@ var Vue = (function () {
680
680
  if (dep.subs === link) {
681
681
  dep.subs = prevSub;
682
682
  }
683
- if (!dep.subs && dep.computed) {
684
- dep.computed.flags &= ~4;
685
- for (let l = dep.computed.deps; l; l = l.nextDep) {
686
- removeSub(l);
683
+ if (dep.subsHead === link) {
684
+ dep.subsHead = nextSub;
685
+ }
686
+ if (!dep.subs) {
687
+ if (dep.computed) {
688
+ dep.computed.flags &= ~4;
689
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
690
+ removeSub(l, true);
691
+ }
692
+ } else if (dep.map && !fromComputed) {
693
+ dep.map.delete(dep.key);
694
+ if (!dep.map.size) targetMap.delete(dep.target);
687
695
  }
688
696
  }
689
697
  }
@@ -764,6 +772,12 @@ var Vue = (function () {
764
772
  * Doubly linked list representing the subscribing effects (tail)
765
773
  */
766
774
  this.subs = void 0;
775
+ /**
776
+ * For object property deps cleanup
777
+ */
778
+ this.target = void 0;
779
+ this.map = void 0;
780
+ this.key = void 0;
767
781
  {
768
782
  this.subsHead = void 0;
769
783
  }
@@ -884,6 +898,9 @@ var Vue = (function () {
884
898
  let dep = depsMap.get(key);
885
899
  if (!dep) {
886
900
  depsMap.set(key, dep = new Dep());
901
+ dep.target = target;
902
+ dep.map = depsMap;
903
+ dep.key = key;
887
904
  }
888
905
  {
889
906
  dep.track({
@@ -1760,13 +1777,15 @@ var Vue = (function () {
1760
1777
  }
1761
1778
  }
1762
1779
  function triggerRef(ref2) {
1763
- {
1764
- ref2.dep.trigger({
1765
- target: ref2,
1766
- type: "set",
1767
- key: "value",
1768
- newValue: ref2._value
1769
- });
1780
+ if (ref2.dep) {
1781
+ {
1782
+ ref2.dep.trigger({
1783
+ target: ref2,
1784
+ type: "set",
1785
+ key: "value",
1786
+ newValue: ref2._value
1787
+ });
1788
+ }
1770
1789
  }
1771
1790
  }
1772
1791
  function unref(ref2) {
@@ -2514,7 +2533,9 @@ var Vue = (function () {
2514
2533
  cb.flags &= ~1;
2515
2534
  }
2516
2535
  cb();
2517
- cb.flags &= ~1;
2536
+ if (!(cb.flags & 4)) {
2537
+ cb.flags &= ~1;
2538
+ }
2518
2539
  }
2519
2540
  }
2520
2541
  }
@@ -2570,7 +2591,9 @@ var Vue = (function () {
2570
2591
  job.i,
2571
2592
  job.i ? 15 : 14
2572
2593
  );
2573
- job.flags &= ~1;
2594
+ if (!(job.flags & 4)) {
2595
+ job.flags &= ~1;
2596
+ }
2574
2597
  }
2575
2598
  }
2576
2599
  } finally {
@@ -4900,6 +4923,11 @@ Server rendered element contains fewer child nodes than client vdom.`
4900
4923
  const id = requestIdleCallback(hydrate, { timeout });
4901
4924
  return () => cancelIdleCallback(id);
4902
4925
  };
4926
+ function elementIsVisibleInViewport(el) {
4927
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4928
+ const { innerHeight, innerWidth } = window;
4929
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4930
+ }
4903
4931
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4904
4932
  const ob = new IntersectionObserver((entries) => {
4905
4933
  for (const e of entries) {
@@ -4909,7 +4937,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4909
4937
  break;
4910
4938
  }
4911
4939
  }, opts);
4912
- forEach((el) => ob.observe(el));
4940
+ forEach((el) => {
4941
+ if (!(el instanceof Element)) return;
4942
+ if (elementIsVisibleInViewport(el)) {
4943
+ hydrate();
4944
+ ob.disconnect();
4945
+ return false;
4946
+ }
4947
+ ob.observe(el);
4948
+ });
4913
4949
  return () => ob.disconnect();
4914
4950
  };
4915
4951
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4954,7 +4990,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4954
4990
  let next = node.nextSibling;
4955
4991
  while (next) {
4956
4992
  if (next.nodeType === 1) {
4957
- cb(next);
4993
+ const result = cb(next);
4994
+ if (result === false) {
4995
+ break;
4996
+ }
4958
4997
  } else if (isComment(next)) {
4959
4998
  if (next.data === "]") {
4960
4999
  if (--depth === 0) break;
@@ -7038,7 +7077,7 @@ If this is a native custom element, make sure to exclude it from component resol
7038
7077
  return vm;
7039
7078
  }
7040
7079
  }
7041
- Vue.version = `2.6.14-compat:${"3.5.6"}`;
7080
+ Vue.version = `2.6.14-compat:${"3.5.8"}`;
7042
7081
  Vue.config = singletonApp.config;
7043
7082
  Vue.use = (plugin, ...options) => {
7044
7083
  if (plugin && isFunction(plugin.install)) {
@@ -12116,7 +12155,7 @@ Component that was made reactive: `,
12116
12155
  return true;
12117
12156
  }
12118
12157
 
12119
- const version = "3.5.6";
12158
+ const version = "3.5.8";
12120
12159
  const warn = warn$1 ;
12121
12160
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12122
12161
  const devtools = devtools$1 ;
@@ -12447,7 +12486,7 @@ Component that was made reactive: `,
12447
12486
  resolve();
12448
12487
  }
12449
12488
  };
12450
- if (explicitTimeout) {
12489
+ if (explicitTimeout != null) {
12451
12490
  return setTimeout(resolveIfNotStale, explicitTimeout);
12452
12491
  }
12453
12492
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);