vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.6
2
+ * vue v3.5.8
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.6
2
+ * vue v3.5.8
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.6
2
+ * vue 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 (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
  {
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
  {
953
970
  dep.track({
@@ -1824,13 +1841,15 @@ class RefImpl {
1824
1841
  }
1825
1842
  }
1826
1843
  function triggerRef(ref2) {
1827
- {
1828
- ref2.dep.trigger({
1829
- target: ref2,
1830
- type: "set",
1831
- key: "value",
1832
- newValue: ref2._value
1833
- });
1844
+ if (ref2.dep) {
1845
+ {
1846
+ ref2.dep.trigger({
1847
+ target: ref2,
1848
+ type: "set",
1849
+ key: "value",
1850
+ newValue: ref2._value
1851
+ });
1852
+ }
1834
1853
  }
1835
1854
  }
1836
1855
  function unref(ref2) {
@@ -2578,7 +2597,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2578
2597
  cb.flags &= ~1;
2579
2598
  }
2580
2599
  cb();
2581
- cb.flags &= ~1;
2600
+ if (!(cb.flags & 4)) {
2601
+ cb.flags &= ~1;
2602
+ }
2582
2603
  }
2583
2604
  }
2584
2605
  }
@@ -2634,7 +2655,9 @@ function flushJobs(seen) {
2634
2655
  job.i,
2635
2656
  job.i ? 15 : 14
2636
2657
  );
2637
- job.flags &= ~1;
2658
+ if (!(job.flags & 4)) {
2659
+ job.flags &= ~1;
2660
+ }
2638
2661
  }
2639
2662
  }
2640
2663
  } finally {
@@ -4433,6 +4456,11 @@ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4433
4456
  const id = requestIdleCallback(hydrate, { timeout });
4434
4457
  return () => cancelIdleCallback(id);
4435
4458
  };
4459
+ function elementIsVisibleInViewport(el) {
4460
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4461
+ const { innerHeight, innerWidth } = window;
4462
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4463
+ }
4436
4464
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4437
4465
  const ob = new IntersectionObserver((entries) => {
4438
4466
  for (const e of entries) {
@@ -4442,7 +4470,15 @@ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4442
4470
  break;
4443
4471
  }
4444
4472
  }, opts);
4445
- forEach((el) => ob.observe(el));
4473
+ forEach((el) => {
4474
+ if (!(el instanceof Element)) return;
4475
+ if (elementIsVisibleInViewport(el)) {
4476
+ hydrate();
4477
+ ob.disconnect();
4478
+ return false;
4479
+ }
4480
+ ob.observe(el);
4481
+ });
4446
4482
  return () => ob.disconnect();
4447
4483
  };
4448
4484
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4487,7 +4523,10 @@ function forEachElement(node, cb) {
4487
4523
  let next = node.nextSibling;
4488
4524
  while (next) {
4489
4525
  if (next.nodeType === 1) {
4490
- cb(next);
4526
+ const result = cb(next);
4527
+ if (result === false) {
4528
+ break;
4529
+ }
4491
4530
  } else if (isComment(next)) {
4492
4531
  if (next.data === "]") {
4493
4532
  if (--depth === 0) break;
@@ -10464,7 +10503,7 @@ function isMemoSame(cached, memo) {
10464
10503
  return true;
10465
10504
  }
10466
10505
 
10467
- const version = "3.5.6";
10506
+ const version = "3.5.8";
10468
10507
  const warn = warn$1 ;
10469
10508
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10470
10509
  const devtools = devtools$1 ;
@@ -10763,7 +10802,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
10763
10802
  resolve();
10764
10803
  }
10765
10804
  };
10766
- if (explicitTimeout) {
10805
+ if (explicitTimeout != null) {
10767
10806
  return setTimeout(resolveIfNotStale, explicitTimeout);
10768
10807
  }
10769
10808
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -17290,7 +17329,7 @@ const transformModel$1 = (dir, node, context) => {
17290
17329
  );
17291
17330
  return createTransformProps();
17292
17331
  }
17293
- const rawExp = exp.loc.source;
17332
+ const rawExp = exp.loc.source.trim();
17294
17333
  const expString = exp.type === 4 ? exp.content : rawExp;
17295
17334
  const bindingType = context.bindingMetadata[rawExp];
17296
17335
  if (bindingType === "props" || bindingType === "props-aliased") {