@vue/compat 3.5.4 → 3.5.6

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.4
2
+ * @vue/compat v3.5.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -465,7 +465,7 @@ class ReactiveEffect {
465
465
  /**
466
466
  * @internal
467
467
  */
468
- this.nextEffect = void 0;
468
+ this.next = void 0;
469
469
  /**
470
470
  * @internal
471
471
  */
@@ -495,9 +495,7 @@ class ReactiveEffect {
495
495
  return;
496
496
  }
497
497
  if (!(this.flags & 8)) {
498
- this.flags |= 8;
499
- this.nextEffect = batchedEffect;
500
- batchedEffect = this;
498
+ batch(this);
501
499
  }
502
500
  }
503
501
  run() {
@@ -558,7 +556,12 @@ class ReactiveEffect {
558
556
  }
559
557
  }
560
558
  let batchDepth = 0;
561
- let batchedEffect;
559
+ let batchedSub;
560
+ function batch(sub) {
561
+ sub.flags |= 8;
562
+ sub.next = batchedSub;
563
+ batchedSub = sub;
564
+ }
562
565
  function startBatch() {
563
566
  batchDepth++;
564
567
  }
@@ -567,15 +570,16 @@ function endBatch() {
567
570
  return;
568
571
  }
569
572
  let error;
570
- while (batchedEffect) {
571
- let e = batchedEffect;
572
- batchedEffect = void 0;
573
+ while (batchedSub) {
574
+ let e = batchedSub;
575
+ batchedSub = void 0;
573
576
  while (e) {
574
- const next = e.nextEffect;
575
- e.nextEffect = void 0;
577
+ const next = e.next;
578
+ e.next = void 0;
576
579
  e.flags &= ~8;
577
580
  if (e.flags & 1) {
578
581
  try {
582
+ ;
579
583
  e.trigger();
580
584
  } catch (err) {
581
585
  if (!error) error = err;
@@ -596,9 +600,11 @@ function prepareDeps(sub) {
596
600
  function cleanupDeps(sub) {
597
601
  let head;
598
602
  let tail = sub.depsTail;
599
- for (let link = tail; link; link = link.prevDep) {
603
+ let link = tail;
604
+ while (link) {
605
+ const prev = link.prevDep;
600
606
  if (link.version === -1) {
601
- if (link === tail) tail = link.prevDep;
607
+ if (link === tail) tail = prev;
602
608
  removeSub(link);
603
609
  removeDep(link);
604
610
  } else {
@@ -606,13 +612,14 @@ function cleanupDeps(sub) {
606
612
  }
607
613
  link.dep.activeLink = link.prevActiveLink;
608
614
  link.prevActiveLink = void 0;
615
+ link = prev;
609
616
  }
610
617
  sub.deps = head;
611
618
  sub.depsTail = tail;
612
619
  }
613
620
  function isDirty(sub) {
614
621
  for (let link = sub.deps; link; link = link.nextDep) {
615
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
622
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
616
623
  return true;
617
624
  }
618
625
  }
@@ -632,7 +639,7 @@ function refreshComputed(computed) {
632
639
  computed.globalVersion = globalVersion;
633
640
  const dep = computed.dep;
634
641
  computed.flags |= 2;
635
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
642
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
636
643
  computed.flags &= ~2;
637
644
  return;
638
645
  }
@@ -734,6 +741,14 @@ function cleanupEffect(e) {
734
741
  }
735
742
 
736
743
  let globalVersion = 0;
744
+ class Link {
745
+ constructor(sub, dep) {
746
+ this.sub = sub;
747
+ this.dep = dep;
748
+ this.version = dep.version;
749
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
750
+ }
751
+ }
737
752
  class Dep {
738
753
  constructor(computed) {
739
754
  this.computed = computed;
@@ -756,16 +771,7 @@ class Dep {
756
771
  }
757
772
  let link = this.activeLink;
758
773
  if (link === void 0 || link.sub !== activeSub) {
759
- link = this.activeLink = {
760
- dep: this,
761
- sub: activeSub,
762
- version: this.version,
763
- nextDep: void 0,
764
- prevDep: void 0,
765
- nextSub: void 0,
766
- prevSub: void 0,
767
- prevActiveLink: void 0
768
- };
774
+ link = this.activeLink = new Link(activeSub, this);
769
775
  if (!activeSub.deps) {
770
776
  activeSub.deps = activeSub.depsTail = link;
771
777
  } else {
@@ -828,7 +834,10 @@ class Dep {
828
834
  }
829
835
  }
830
836
  for (let link = this.subs; link; link = link.prevSub) {
831
- link.sub.notify();
837
+ if (link.sub.notify()) {
838
+ ;
839
+ link.sub.dep.notify();
840
+ }
832
841
  }
833
842
  } finally {
834
843
  endBatch();
@@ -1897,8 +1906,10 @@ class ComputedRefImpl {
1897
1906
  */
1898
1907
  notify() {
1899
1908
  this.flags |= 16;
1900
- if (activeSub !== this) {
1901
- this.dep.notify();
1909
+ if (!(this.flags & 8) && // avoid infinite self recursion
1910
+ activeSub !== this) {
1911
+ batch(this);
1912
+ return true;
1902
1913
  }
1903
1914
  }
1904
1915
  get value() {
@@ -2046,20 +2057,12 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2046
2057
  remove(scope.effects, effect);
2047
2058
  }
2048
2059
  };
2049
- if (once) {
2050
- if (cb) {
2051
- const _cb = cb;
2052
- cb = (...args) => {
2053
- _cb(...args);
2054
- watchHandle();
2055
- };
2056
- } else {
2057
- const _getter = getter;
2058
- getter = () => {
2059
- _getter();
2060
- watchHandle();
2061
- };
2062
- }
2060
+ if (once && cb) {
2061
+ const _cb = cb;
2062
+ cb = (...args) => {
2063
+ _cb(...args);
2064
+ watchHandle();
2065
+ };
2063
2066
  }
2064
2067
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2065
2068
  const job = (immediateFirstRun) => {
@@ -2678,7 +2681,9 @@ function reload(id, newComp) {
2678
2681
  dirtyInstances.delete(instance);
2679
2682
  } else if (instance.parent) {
2680
2683
  queueJob(() => {
2684
+ isHmrUpdating = true;
2681
2685
  instance.parent.update();
2686
+ isHmrUpdating = false;
2682
2687
  dirtyInstances.delete(instance);
2683
2688
  });
2684
2689
  } else if (instance.appContext.reload) {
@@ -3497,6 +3502,9 @@ const TeleportImpl = {
3497
3502
  insert(mainAnchor, container, anchor);
3498
3503
  const mount = (container2, anchor2) => {
3499
3504
  if (shapeFlag & 16) {
3505
+ if (parentComponent && parentComponent.isCE) {
3506
+ parentComponent.ce._teleportTarget = container2;
3507
+ }
3500
3508
  mountChildren(
3501
3509
  children,
3502
3510
  container2,
@@ -4530,7 +4538,11 @@ Server rendered element contains more child nodes than client vdom.`
4530
4538
  remove(cur);
4531
4539
  }
4532
4540
  } else if (shapeFlag & 8) {
4533
- if (el.textContent !== vnode.children) {
4541
+ let clientText = vnode.children;
4542
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4543
+ clientText = clientText.slice(1);
4544
+ }
4545
+ if (el.textContent !== clientText) {
4534
4546
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4535
4547
  warn$1(
4536
4548
  `Hydration text content mismatch on`,
@@ -4729,7 +4741,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4729
4741
  }
4730
4742
  };
4731
4743
  const isTemplateNode = (node) => {
4732
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4744
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4733
4745
  };
4734
4746
  return [hydrate, hydrateNode];
4735
4747
  }
@@ -5081,7 +5093,7 @@ function defineAsyncComponent(source) {
5081
5093
  load().then(() => {
5082
5094
  loaded.value = true;
5083
5095
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5084
- queueJob(instance.parent.update);
5096
+ instance.parent.update();
5085
5097
  }
5086
5098
  }).catch((err) => {
5087
5099
  onError(err);
@@ -7032,7 +7044,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7032
7044
  return vm;
7033
7045
  }
7034
7046
  }
7035
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
7047
+ Vue.version = `2.6.14-compat:${"3.5.6"}`;
7036
7048
  Vue.config = singletonApp.config;
7037
7049
  Vue.use = (plugin, ...options) => {
7038
7050
  if (plugin && isFunction(plugin.install)) {
@@ -8854,6 +8866,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8854
8866
  }
8855
8867
  }
8856
8868
  if (instance.asyncDep) {
8869
+ if (isHmrUpdating) initialVNode.el = null;
8857
8870
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8858
8871
  if (!initialVNode.el) {
8859
8872
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9849,11 +9862,12 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
9849
9862
  } else if (!cb || immediate) {
9850
9863
  baseWatchOptions.once = true;
9851
9864
  } else {
9852
- return {
9853
- stop: NOOP,
9854
- resume: NOOP,
9855
- pause: NOOP
9865
+ const watchStopHandle = () => {
9856
9866
  };
9867
+ watchStopHandle.stop = NOOP;
9868
+ watchStopHandle.resume = NOOP;
9869
+ watchStopHandle.pause = NOOP;
9870
+ return watchStopHandle;
9857
9871
  }
9858
9872
  }
9859
9873
  const instance = currentInstance;
@@ -12145,7 +12159,7 @@ function isMemoSame(cached, memo) {
12145
12159
  return true;
12146
12160
  }
12147
12161
 
12148
- const version = "3.5.4";
12162
+ const version = "3.5.6";
12149
12163
  const warn = warn$1 ;
12150
12164
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12151
12165
  const devtools = devtools$1 ;
@@ -13133,6 +13147,7 @@ class VueElement extends BaseClass {
13133
13147
  }
13134
13148
  }
13135
13149
  connectedCallback() {
13150
+ if (!this.isConnected) return;
13136
13151
  if (!this.shadowRoot) {
13137
13152
  this._parseSlots();
13138
13153
  }
@@ -13175,7 +13190,7 @@ class VueElement extends BaseClass {
13175
13190
  this._ob = null;
13176
13191
  }
13177
13192
  this._app && this._app.unmount();
13178
- this._instance.ce = void 0;
13193
+ if (this._instance) this._instance.ce = void 0;
13179
13194
  this._app = this._instance = null;
13180
13195
  }
13181
13196
  });
@@ -13394,7 +13409,7 @@ class VueElement extends BaseClass {
13394
13409
  }
13395
13410
  }
13396
13411
  /**
13397
- * Only called when shaddowRoot is false
13412
+ * Only called when shadowRoot is false
13398
13413
  */
13399
13414
  _parseSlots() {
13400
13415
  const slots = this._slots = {};
@@ -13406,10 +13421,10 @@ class VueElement extends BaseClass {
13406
13421
  }
13407
13422
  }
13408
13423
  /**
13409
- * Only called when shaddowRoot is false
13424
+ * Only called when shadowRoot is false
13410
13425
  */
13411
13426
  _renderSlots() {
13412
- const outlets = this.querySelectorAll("slot");
13427
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13413
13428
  const scopeId = this._instance.type.__scopeId;
13414
13429
  for (let i = 0; i < outlets.length; i++) {
13415
13430
  const o = outlets[i];
@@ -13597,7 +13612,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13597
13612
  child,
13598
13613
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13599
13614
  );
13600
- } else {
13615
+ } else if (child.type !== Text) {
13601
13616
  warn(`<TransitionGroup> children must be keyed.`);
13602
13617
  }
13603
13618
  }