vue 3.5.5 → 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 v3.5.5
2
+ * vue v3.5.7
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.5
2
+ * vue v3.5.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -535,7 +535,7 @@ var Vue = (function (exports) {
535
535
  /**
536
536
  * @internal
537
537
  */
538
- this.nextEffect = void 0;
538
+ this.next = void 0;
539
539
  /**
540
540
  * @internal
541
541
  */
@@ -565,9 +565,7 @@ var Vue = (function (exports) {
565
565
  return;
566
566
  }
567
567
  if (!(this.flags & 8)) {
568
- this.flags |= 8;
569
- this.nextEffect = batchedEffect;
570
- batchedEffect = this;
568
+ batch(this);
571
569
  }
572
570
  }
573
571
  run() {
@@ -628,7 +626,12 @@ var Vue = (function (exports) {
628
626
  }
629
627
  }
630
628
  let batchDepth = 0;
631
- let batchedEffect;
629
+ let batchedSub;
630
+ function batch(sub) {
631
+ sub.flags |= 8;
632
+ sub.next = batchedSub;
633
+ batchedSub = sub;
634
+ }
632
635
  function startBatch() {
633
636
  batchDepth++;
634
637
  }
@@ -637,15 +640,16 @@ var Vue = (function (exports) {
637
640
  return;
638
641
  }
639
642
  let error;
640
- while (batchedEffect) {
641
- let e = batchedEffect;
642
- batchedEffect = void 0;
643
+ while (batchedSub) {
644
+ let e = batchedSub;
645
+ batchedSub = void 0;
643
646
  while (e) {
644
- const next = e.nextEffect;
645
- e.nextEffect = void 0;
647
+ const next = e.next;
648
+ e.next = void 0;
646
649
  e.flags &= ~8;
647
650
  if (e.flags & 1) {
648
651
  try {
652
+ ;
649
653
  e.trigger();
650
654
  } catch (err) {
651
655
  if (!error) error = err;
@@ -685,7 +689,7 @@ var Vue = (function (exports) {
685
689
  }
686
690
  function isDirty(sub) {
687
691
  for (let link = sub.deps; link; link = link.nextDep) {
688
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
692
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
689
693
  return true;
690
694
  }
691
695
  }
@@ -705,7 +709,7 @@ var Vue = (function (exports) {
705
709
  computed.globalVersion = globalVersion;
706
710
  const dep = computed.dep;
707
711
  computed.flags |= 2;
708
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
712
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
709
713
  computed.flags &= ~2;
710
714
  return;
711
715
  }
@@ -730,7 +734,7 @@ var Vue = (function (exports) {
730
734
  computed.flags &= ~2;
731
735
  }
732
736
  }
733
- function removeSub(link) {
737
+ function removeSub(link, fromComputed = false) {
734
738
  const { dep, prevSub, nextSub } = link;
735
739
  if (prevSub) {
736
740
  prevSub.nextSub = nextSub;
@@ -743,10 +747,18 @@ var Vue = (function (exports) {
743
747
  if (dep.subs === link) {
744
748
  dep.subs = prevSub;
745
749
  }
746
- if (!dep.subs && dep.computed) {
747
- dep.computed.flags &= ~4;
748
- for (let l = dep.computed.deps; l; l = l.nextDep) {
749
- 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);
750
762
  }
751
763
  }
752
764
  }
@@ -827,6 +839,12 @@ var Vue = (function (exports) {
827
839
  * Doubly linked list representing the subscribing effects (tail)
828
840
  */
829
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;
830
848
  {
831
849
  this.subsHead = void 0;
832
850
  }
@@ -900,7 +918,10 @@ var Vue = (function (exports) {
900
918
  }
901
919
  }
902
920
  for (let link = this.subs; link; link = link.prevSub) {
903
- link.sub.notify();
921
+ if (link.sub.notify()) {
922
+ ;
923
+ link.sub.dep.notify();
924
+ }
904
925
  }
905
926
  } finally {
906
927
  endBatch();
@@ -944,6 +965,9 @@ var Vue = (function (exports) {
944
965
  let dep = depsMap.get(key);
945
966
  if (!dep) {
946
967
  depsMap.set(key, dep = new Dep());
968
+ dep.target = target;
969
+ dep.map = depsMap;
970
+ dep.key = key;
947
971
  }
948
972
  {
949
973
  dep.track({
@@ -1820,13 +1844,15 @@ var Vue = (function (exports) {
1820
1844
  }
1821
1845
  }
1822
1846
  function triggerRef(ref2) {
1823
- {
1824
- ref2.dep.trigger({
1825
- target: ref2,
1826
- type: "set",
1827
- key: "value",
1828
- newValue: ref2._value
1829
- });
1847
+ if (ref2.dep) {
1848
+ {
1849
+ ref2.dep.trigger({
1850
+ target: ref2,
1851
+ type: "set",
1852
+ key: "value",
1853
+ newValue: ref2._value
1854
+ });
1855
+ }
1830
1856
  }
1831
1857
  }
1832
1858
  function unref(ref2) {
@@ -1969,8 +1995,10 @@ var Vue = (function (exports) {
1969
1995
  */
1970
1996
  notify() {
1971
1997
  this.flags |= 16;
1972
- if (activeSub !== this) {
1973
- this.dep.notify();
1998
+ if (!(this.flags & 8) && // avoid infinite self recursion
1999
+ activeSub !== this) {
2000
+ batch(this);
2001
+ return true;
1974
2002
  }
1975
2003
  }
1976
2004
  get value() {
@@ -2118,20 +2146,12 @@ var Vue = (function (exports) {
2118
2146
  remove(scope.effects, effect);
2119
2147
  }
2120
2148
  };
2121
- if (once) {
2122
- if (cb) {
2123
- const _cb = cb;
2124
- cb = (...args) => {
2125
- _cb(...args);
2126
- watchHandle();
2127
- };
2128
- } else {
2129
- const _getter = getter;
2130
- getter = () => {
2131
- _getter();
2132
- watchHandle();
2133
- };
2134
- }
2149
+ if (once && cb) {
2150
+ const _cb = cb;
2151
+ cb = (...args) => {
2152
+ _cb(...args);
2153
+ watchHandle();
2154
+ };
2135
2155
  }
2136
2156
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2137
2157
  const job = (immediateFirstRun) => {
@@ -2580,7 +2600,9 @@ var Vue = (function (exports) {
2580
2600
  cb.flags &= ~1;
2581
2601
  }
2582
2602
  cb();
2583
- cb.flags &= ~1;
2603
+ if (!(cb.flags & 4)) {
2604
+ cb.flags &= ~1;
2605
+ }
2584
2606
  }
2585
2607
  }
2586
2608
  }
@@ -2636,7 +2658,9 @@ var Vue = (function (exports) {
2636
2658
  job.i,
2637
2659
  job.i ? 15 : 14
2638
2660
  );
2639
- job.flags &= ~1;
2661
+ if (!(job.flags & 4)) {
2662
+ job.flags &= ~1;
2663
+ }
2640
2664
  }
2641
2665
  }
2642
2666
  } finally {
@@ -4435,6 +4459,11 @@ Server rendered element contains fewer child nodes than client vdom.`
4435
4459
  const id = requestIdleCallback(hydrate, { timeout });
4436
4460
  return () => cancelIdleCallback(id);
4437
4461
  };
4462
+ function elementIsVisibleInViewport(el) {
4463
+ const { top, left, bottom, right } = el.getBoundingClientRect();
4464
+ const { innerHeight, innerWidth } = window;
4465
+ return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
4466
+ }
4438
4467
  const hydrateOnVisible = (opts) => (hydrate, forEach) => {
4439
4468
  const ob = new IntersectionObserver((entries) => {
4440
4469
  for (const e of entries) {
@@ -4444,7 +4473,15 @@ Server rendered element contains fewer child nodes than client vdom.`
4444
4473
  break;
4445
4474
  }
4446
4475
  }, opts);
4447
- forEach((el) => ob.observe(el));
4476
+ forEach((el) => {
4477
+ if (!(el instanceof Element)) return;
4478
+ if (elementIsVisibleInViewport(el)) {
4479
+ hydrate();
4480
+ ob.disconnect();
4481
+ return false;
4482
+ }
4483
+ ob.observe(el);
4484
+ });
4448
4485
  return () => ob.disconnect();
4449
4486
  };
4450
4487
  const hydrateOnMediaQuery = (query) => (hydrate) => {
@@ -4489,7 +4526,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4489
4526
  let next = node.nextSibling;
4490
4527
  while (next) {
4491
4528
  if (next.nodeType === 1) {
4492
- cb(next);
4529
+ const result = cb(next);
4530
+ if (result === false) {
4531
+ break;
4532
+ }
4493
4533
  } else if (isComment(next)) {
4494
4534
  if (next.data === "]") {
4495
4535
  if (--depth === 0) break;
@@ -10420,7 +10460,7 @@ Component that was made reactive: `,
10420
10460
  return true;
10421
10461
  }
10422
10462
 
10423
- const version = "3.5.5";
10463
+ const version = "3.5.7";
10424
10464
  const warn = warn$1 ;
10425
10465
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10426
10466
  const devtools = devtools$1 ;
@@ -10707,7 +10747,7 @@ Component that was made reactive: `,
10707
10747
  resolve();
10708
10748
  }
10709
10749
  };
10710
- if (explicitTimeout) {
10750
+ if (explicitTimeout != null) {
10711
10751
  return setTimeout(resolveIfNotStale, explicitTimeout);
10712
10752
  }
10713
10753
  const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
@@ -17002,7 +17042,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17002
17042
  );
17003
17043
  return createTransformProps();
17004
17044
  }
17005
- const rawExp = exp.loc.source;
17045
+ const rawExp = exp.loc.source.trim();
17006
17046
  const expString = exp.type === 4 ? exp.content : rawExp;
17007
17047
  const bindingType = context.bindingMetadata[rawExp];
17008
17048
  if (bindingType === "props" || bindingType === "props-aliased") {