@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
  **/
@@ -664,7 +664,7 @@ function prepareDeps(sub) {
664
664
  link.dep.activeLink = link;
665
665
  }
666
666
  }
667
- function cleanupDeps(sub) {
667
+ function cleanupDeps(sub, fromComputed = false) {
668
668
  let head;
669
669
  let tail = sub.depsTail;
670
670
  let link = tail;
@@ -672,7 +672,7 @@ function cleanupDeps(sub) {
672
672
  const prev = link.prevDep;
673
673
  if (link.version === -1) {
674
674
  if (link === tail) tail = prev;
675
- removeSub(link);
675
+ removeSub(link, fromComputed);
676
676
  removeDep(link);
677
677
  } else {
678
678
  head = link;
@@ -727,11 +727,11 @@ function refreshComputed(computed) {
727
727
  } finally {
728
728
  activeSub = prevSub;
729
729
  shouldTrack = prevShouldTrack;
730
- cleanupDeps(computed);
730
+ cleanupDeps(computed, true);
731
731
  computed.flags &= ~2;
732
732
  }
733
733
  }
734
- function removeSub(link) {
734
+ function removeSub(link, fromComputed = false) {
735
735
  const { dep, prevSub, nextSub } = link;
736
736
  if (prevSub) {
737
737
  prevSub.nextSub = nextSub;
@@ -744,10 +744,18 @@ function removeSub(link) {
744
744
  if (dep.subs === link) {
745
745
  dep.subs = prevSub;
746
746
  }
747
- if (!dep.subs && dep.computed) {
748
- dep.computed.flags &= ~4;
749
- for (let l = dep.computed.deps; l; l = l.nextDep) {
750
- removeSub(l);
747
+ if (!!(process.env.NODE_ENV !== "production") && dep.subsHead === link) {
748
+ dep.subsHead = nextSub;
749
+ }
750
+ if (!dep.subs) {
751
+ if (dep.computed) {
752
+ dep.computed.flags &= ~4;
753
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
754
+ removeSub(l, true);
755
+ }
756
+ } else if (dep.map && !fromComputed) {
757
+ dep.map.delete(dep.key);
758
+ if (!dep.map.size) targetMap.delete(dep.target);
751
759
  }
752
760
  }
753
761
  }
@@ -828,6 +836,12 @@ class Dep {
828
836
  * Doubly linked list representing the subscribing effects (tail)
829
837
  */
830
838
  this.subs = void 0;
839
+ /**
840
+ * For object property deps cleanup
841
+ */
842
+ this.target = void 0;
843
+ this.map = void 0;
844
+ this.key = void 0;
831
845
  if (!!(process.env.NODE_ENV !== "production")) {
832
846
  this.subsHead = void 0;
833
847
  }
@@ -948,6 +962,9 @@ function track(target, type, key) {
948
962
  let dep = depsMap.get(key);
949
963
  if (!dep) {
950
964
  depsMap.set(key, dep = new Dep());
965
+ dep.target = target;
966
+ dep.map = depsMap;
967
+ dep.key = key;
951
968
  }
952
969
  if (!!(process.env.NODE_ENV !== "production")) {
953
970
  dep.track({
@@ -1832,15 +1849,17 @@ class RefImpl {
1832
1849
  }
1833
1850
  }
1834
1851
  function triggerRef(ref2) {
1835
- if (!!(process.env.NODE_ENV !== "production")) {
1836
- ref2.dep.trigger({
1837
- target: ref2,
1838
- type: "set",
1839
- key: "value",
1840
- newValue: ref2._value
1841
- });
1842
- } else {
1843
- ref2.dep.trigger();
1852
+ if (ref2.dep) {
1853
+ if (!!(process.env.NODE_ENV !== "production")) {
1854
+ ref2.dep.trigger({
1855
+ target: ref2,
1856
+ type: "set",
1857
+ key: "value",
1858
+ newValue: ref2._value
1859
+ });
1860
+ } else {
1861
+ ref2.dep.trigger();
1862
+ }
1844
1863
  }
1845
1864
  }
1846
1865
  function unref(ref2) {
@@ -2593,7 +2612,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2593
2612
  cb.flags &= ~1;
2594
2613
  }
2595
2614
  cb();
2596
- cb.flags &= ~1;
2615
+ if (!(cb.flags & 4)) {
2616
+ cb.flags &= ~1;
2617
+ }
2597
2618
  }
2598
2619
  }
2599
2620
  }
@@ -2649,7 +2670,9 @@ function flushJobs(seen) {
2649
2670
  job.i,
2650
2671
  job.i ? 15 : 14
2651
2672
  );
2652
- job.flags &= ~1;
2673
+ if (!(job.flags & 4)) {
2674
+ job.flags &= ~1;
2675
+ }
2653
2676
  }
2654
2677
  }
2655
2678
  } finally {
@@ -4994,6 +5017,11 @@ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4994
5017
  const id = requestIdleCallback(hydrate, { timeout });
4995
5018
  return () => cancelIdleCallback(id);
4996
5019
  };
5020
+ function elementIsVisibleInViewport(el) {
5021
+ const { top, left, bottom, right } = el.getBoundingClientRect();
5022
+ const { innerHeight, innerWidth } = window;
5023
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
5024
+ }
4997
5025
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4998
5026
  const ob = new IntersectionObserver((entries) => {
4999
5027
  for (const e of entries) {
@@ -5003,7 +5031,15 @@ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
5003
5031
  break;
5004
5032
  }
5005
5033
  }, opts);
5006
- forEach((el) => ob.observe(el));
5034
+ forEach((el) => {
5035
+ if (!(el instanceof Element)) return;
5036
+ if (elementIsVisibleInViewport(el)) {
5037
+ hydrate();
5038
+ ob.disconnect();
5039
+ return false;
5040
+ }
5041
+ ob.observe(el);
5042
+ });
5007
5043
  return () => ob.disconnect();
5008
5044
  };
5009
5045
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -5048,7 +5084,10 @@ function forEachElement(node, cb) {
5048
5084
  let next = node.nextSibling;
5049
5085
  while (next) {
5050
5086
  if (next.nodeType === 1) {
5051
- cb(next);
5087
+ const result = cb(next);
5088
+ if (result === false) {
5089
+ break;
5090
+ }
5052
5091
  } else if (isComment(next)) {
5053
5092
  if (next.data === "]") {
5054
5093
  if (--depth === 0) break;
@@ -7143,7 +7182,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7143
7182
  return vm;
7144
7183
  }
7145
7184
  }
7146
- Vue.version = `2.6.14-compat:${"3.5.6"}`;
7185
+ Vue.version = `2.6.14-compat:${"3.5.8"}`;
7147
7186
  Vue.config = singletonApp.config;
7148
7187
  Vue.use = (plugin, ...options) => {
7149
7188
  if (plugin && isFunction(plugin.install)) {
@@ -12312,7 +12351,7 @@ function isMemoSame(cached, memo) {
12312
12351
  return true;
12313
12352
  }
12314
12353
 
12315
- const version = "3.5.6";
12354
+ const version = "3.5.8";
12316
12355
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12317
12356
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12318
12357
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12655,7 +12694,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
12655
12694
  resolve();
12656
12695
  }
12657
12696
  };
12658
- if (explicitTimeout) {
12697
+ if (explicitTimeout != null) {
12659
12698
  return setTimeout(resolveIfNotStale, explicitTimeout);
12660
12699
  }
12661
12700
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -19506,7 +19545,7 @@ const transformModel$1 = (dir, node, context) => {
19506
19545
  );
19507
19546
  return createTransformProps();
19508
19547
  }
19509
- const rawExp = exp.loc.source;
19548
+ const rawExp = exp.loc.source.trim();
19510
19549
  const expString = exp.type === 4 ? exp.content : rawExp;
19511
19550
  const bindingType = context.bindingMetadata[rawExp];
19512
19551
  if (bindingType === "props" || bindingType === "props-aliased") {
@@ -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
  **/
@@ -667,7 +667,7 @@ var Vue = (function () {
667
667
  link.dep.activeLink = link;
668
668
  }
669
669
  }
670
- function cleanupDeps(sub) {
670
+ function cleanupDeps(sub, fromComputed = false) {
671
671
  let head;
672
672
  let tail = sub.depsTail;
673
673
  let link = tail;
@@ -675,7 +675,7 @@ var Vue = (function () {
675
675
  const prev = link.prevDep;
676
676
  if (link.version === -1) {
677
677
  if (link === tail) tail = prev;
678
- removeSub(link);
678
+ removeSub(link, fromComputed);
679
679
  removeDep(link);
680
680
  } else {
681
681
  head = link;
@@ -730,11 +730,11 @@ var Vue = (function () {
730
730
  } finally {
731
731
  activeSub = prevSub;
732
732
  shouldTrack = prevShouldTrack;
733
- cleanupDeps(computed);
733
+ cleanupDeps(computed, true);
734
734
  computed.flags &= ~2;
735
735
  }
736
736
  }
737
- function removeSub(link) {
737
+ function removeSub(link, fromComputed = false) {
738
738
  const { dep, prevSub, nextSub } = link;
739
739
  if (prevSub) {
740
740
  prevSub.nextSub = nextSub;
@@ -747,10 +747,18 @@ var Vue = (function () {
747
747
  if (dep.subs === link) {
748
748
  dep.subs = prevSub;
749
749
  }
750
- if (!dep.subs && dep.computed) {
751
- dep.computed.flags &= ~4;
752
- for (let l = dep.computed.deps; l; l = l.nextDep) {
753
- removeSub(l);
750
+ if (dep.subsHead === link) {
751
+ dep.subsHead = nextSub;
752
+ }
753
+ if (!dep.subs) {
754
+ if (dep.computed) {
755
+ dep.computed.flags &= ~4;
756
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
757
+ removeSub(l, true);
758
+ }
759
+ } else if (dep.map && !fromComputed) {
760
+ dep.map.delete(dep.key);
761
+ if (!dep.map.size) targetMap.delete(dep.target);
754
762
  }
755
763
  }
756
764
  }
@@ -831,6 +839,12 @@ var Vue = (function () {
831
839
  * Doubly linked list representing the subscribing effects (tail)
832
840
  */
833
841
  this.subs = void 0;
842
+ /**
843
+ * For object property deps cleanup
844
+ */
845
+ this.target = void 0;
846
+ this.map = void 0;
847
+ this.key = void 0;
834
848
  {
835
849
  this.subsHead = void 0;
836
850
  }
@@ -951,6 +965,9 @@ var Vue = (function () {
951
965
  let dep = depsMap.get(key);
952
966
  if (!dep) {
953
967
  depsMap.set(key, dep = new Dep());
968
+ dep.target = target;
969
+ dep.map = depsMap;
970
+ dep.key = key;
954
971
  }
955
972
  {
956
973
  dep.track({
@@ -1827,13 +1844,15 @@ var Vue = (function () {
1827
1844
  }
1828
1845
  }
1829
1846
  function triggerRef(ref2) {
1830
- {
1831
- ref2.dep.trigger({
1832
- target: ref2,
1833
- type: "set",
1834
- key: "value",
1835
- newValue: ref2._value
1836
- });
1847
+ if (ref2.dep) {
1848
+ {
1849
+ ref2.dep.trigger({
1850
+ target: ref2,
1851
+ type: "set",
1852
+ key: "value",
1853
+ newValue: ref2._value
1854
+ });
1855
+ }
1837
1856
  }
1838
1857
  }
1839
1858
  function unref(ref2) {
@@ -2581,7 +2600,9 @@ var Vue = (function () {
2581
2600
  cb.flags &= ~1;
2582
2601
  }
2583
2602
  cb();
2584
- cb.flags &= ~1;
2603
+ if (!(cb.flags & 4)) {
2604
+ cb.flags &= ~1;
2605
+ }
2585
2606
  }
2586
2607
  }
2587
2608
  }
@@ -2637,7 +2658,9 @@ var Vue = (function () {
2637
2658
  job.i,
2638
2659
  job.i ? 15 : 14
2639
2660
  );
2640
- job.flags &= ~1;
2661
+ if (!(job.flags & 4)) {
2662
+ job.flags &= ~1;
2663
+ }
2641
2664
  }
2642
2665
  }
2643
2666
  } finally {
@@ -4967,6 +4990,11 @@ Server rendered element contains fewer child nodes than client vdom.`
4967
4990
  const id = requestIdleCallback(hydrate, { timeout });
4968
4991
  return () => cancelIdleCallback(id);
4969
4992
  };
4993
+ function elementIsVisibleInViewport(el) {
4994
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4995
+ const { innerHeight, innerWidth } = window;
4996
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4997
+ }
4970
4998
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4971
4999
  const ob = new IntersectionObserver((entries) => {
4972
5000
  for (const e of entries) {
@@ -4976,7 +5004,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4976
5004
  break;
4977
5005
  }
4978
5006
  }, opts);
4979
- forEach((el) => ob.observe(el));
5007
+ forEach((el) => {
5008
+ if (!(el instanceof Element)) return;
5009
+ if (elementIsVisibleInViewport(el)) {
5010
+ hydrate();
5011
+ ob.disconnect();
5012
+ return false;
5013
+ }
5014
+ ob.observe(el);
5015
+ });
4980
5016
  return () => ob.disconnect();
4981
5017
  };
4982
5018
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -5021,7 +5057,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5021
5057
  let next = node.nextSibling;
5022
5058
  while (next) {
5023
5059
  if (next.nodeType === 1) {
5024
- cb(next);
5060
+ const result = cb(next);
5061
+ if (result === false) {
5062
+ break;
5063
+ }
5025
5064
  } else if (isComment(next)) {
5026
5065
  if (next.data === "]") {
5027
5066
  if (--depth === 0) break;
@@ -7105,7 +7144,7 @@ If this is a native custom element, make sure to exclude it from component resol
7105
7144
  return vm;
7106
7145
  }
7107
7146
  }
7108
- Vue.version = `2.6.14-compat:${"3.5.6"}`;
7147
+ Vue.version = `2.6.14-compat:${"3.5.8"}`;
7109
7148
  Vue.config = singletonApp.config;
7110
7149
  Vue.use = (plugin, ...options) => {
7111
7150
  if (plugin && isFunction(plugin.install)) {
@@ -12183,7 +12222,7 @@ Component that was made reactive: `,
12183
12222
  return true;
12184
12223
  }
12185
12224
 
12186
- const version = "3.5.6";
12225
+ const version = "3.5.8";
12187
12226
  const warn = warn$1 ;
12188
12227
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12189
12228
  const devtools = devtools$1 ;
@@ -12514,7 +12553,7 @@ Component that was made reactive: `,
12514
12553
  resolve();
12515
12554
  }
12516
12555
  };
12517
- if (explicitTimeout) {
12556
+ if (explicitTimeout != null) {
12518
12557
  return setTimeout(resolveIfNotStale, explicitTimeout);
12519
12558
  }
12520
12559
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -19308,7 +19347,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19308
19347
  );
19309
19348
  return createTransformProps();
19310
19349
  }
19311
- const rawExp = exp.loc.source;
19350
+ const rawExp = exp.loc.source.trim();
19312
19351
  const expString = exp.type === 4 ? exp.content : rawExp;
19313
19352
  const bindingType = context.bindingMetadata[rawExp];
19314
19353
  if (bindingType === "props" || bindingType === "props-aliased") {