@vue/runtime-dom 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/runtime-dom v3.5.6
2
+ * @vue/runtime-dom v3.5.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -287,7 +287,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
287
287
  resolve();
288
288
  }
289
289
  };
290
- if (explicitTimeout) {
290
+ if (explicitTimeout != null) {
291
291
  return setTimeout(resolveIfNotStale, explicitTimeout);
292
292
  }
293
293
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.6
2
+ * @vue/runtime-dom v3.5.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -283,7 +283,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
283
283
  resolve();
284
284
  }
285
285
  };
286
- if (explicitTimeout) {
286
+ if (explicitTimeout != null) {
287
287
  return setTimeout(resolveIfNotStale, explicitTimeout);
288
288
  }
289
289
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.6
2
+ * @vue/runtime-dom 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 {
@@ -4366,6 +4389,11 @@ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
4366
4389
  const id = requestIdleCallback(hydrate, { timeout });
4367
4390
  return () => cancelIdleCallback(id);
4368
4391
  };
4392
+ function elementIsVisibleInViewport(el) {
4393
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4394
+ const { innerHeight, innerWidth } = window;
4395
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4396
+ }
4369
4397
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4370
4398
  const ob = new IntersectionObserver((entries) => {
4371
4399
  for (const e of entries) {
@@ -4375,7 +4403,15 @@ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4375
4403
  break;
4376
4404
  }
4377
4405
  }, opts);
4378
- forEach((el) => ob.observe(el));
4406
+ forEach((el) => {
4407
+ if (!(el instanceof Element)) return;
4408
+ if (elementIsVisibleInViewport(el)) {
4409
+ hydrate();
4410
+ ob.disconnect();
4411
+ return false;
4412
+ }
4413
+ ob.observe(el);
4414
+ });
4379
4415
  return () => ob.disconnect();
4380
4416
  };
4381
4417
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4420,7 +4456,10 @@ function forEachElement(node, cb) {
4420
4456
  let next = node.nextSibling;
4421
4457
  while (next) {
4422
4458
  if (next.nodeType === 1) {
4423
- cb(next);
4459
+ const result = cb(next);
4460
+ if (result === false) {
4461
+ break;
4462
+ }
4424
4463
  } else if (isComment(next)) {
4425
4464
  if (next.data === "]") {
4426
4465
  if (--depth === 0) break;
@@ -10397,7 +10436,7 @@ function isMemoSame(cached, memo) {
10397
10436
  return true;
10398
10437
  }
10399
10438
 
10400
- const version = "3.5.6";
10439
+ const version = "3.5.7";
10401
10440
  const warn = warn$1 ;
10402
10441
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10403
10442
  const devtools = devtools$1 ;
@@ -10696,7 +10735,7 @@ function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
10696
10735
  resolve();
10697
10736
  }
10698
10737
  };
10699
- if (explicitTimeout) {
10738
+ if (explicitTimeout != null) {
10700
10739
  return setTimeout(resolveIfNotStale, explicitTimeout);
10701
10740
  }
10702
10741
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);