@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
  **/
@@ -532,7 +532,7 @@ class ReactiveEffect {
532
532
  /**
533
533
  * @internal
534
534
  */
535
- this.nextEffect = void 0;
535
+ this.next = void 0;
536
536
  /**
537
537
  * @internal
538
538
  */
@@ -562,9 +562,7 @@ class ReactiveEffect {
562
562
  return;
563
563
  }
564
564
  if (!(this.flags & 8)) {
565
- this.flags |= 8;
566
- this.nextEffect = batchedEffect;
567
- batchedEffect = this;
565
+ batch(this);
568
566
  }
569
567
  }
570
568
  run() {
@@ -625,7 +623,12 @@ class ReactiveEffect {
625
623
  }
626
624
  }
627
625
  let batchDepth = 0;
628
- let batchedEffect;
626
+ let batchedSub;
627
+ function batch(sub) {
628
+ sub.flags |= 8;
629
+ sub.next = batchedSub;
630
+ batchedSub = sub;
631
+ }
629
632
  function startBatch() {
630
633
  batchDepth++;
631
634
  }
@@ -634,15 +637,16 @@ function endBatch() {
634
637
  return;
635
638
  }
636
639
  let error;
637
- while (batchedEffect) {
638
- let e = batchedEffect;
639
- batchedEffect = void 0;
640
+ while (batchedSub) {
641
+ let e = batchedSub;
642
+ batchedSub = void 0;
640
643
  while (e) {
641
- const next = e.nextEffect;
642
- e.nextEffect = void 0;
644
+ const next = e.next;
645
+ e.next = void 0;
643
646
  e.flags &= ~8;
644
647
  if (e.flags & 1) {
645
648
  try {
649
+ ;
646
650
  e.trigger();
647
651
  } catch (err) {
648
652
  if (!error) error = err;
@@ -663,9 +667,11 @@ function prepareDeps(sub) {
663
667
  function cleanupDeps(sub) {
664
668
  let head;
665
669
  let tail = sub.depsTail;
666
- for (let link = tail; link; link = link.prevDep) {
670
+ let link = tail;
671
+ while (link) {
672
+ const prev = link.prevDep;
667
673
  if (link.version === -1) {
668
- if (link === tail) tail = link.prevDep;
674
+ if (link === tail) tail = prev;
669
675
  removeSub(link);
670
676
  removeDep(link);
671
677
  } else {
@@ -673,13 +679,14 @@ function cleanupDeps(sub) {
673
679
  }
674
680
  link.dep.activeLink = link.prevActiveLink;
675
681
  link.prevActiveLink = void 0;
682
+ link = prev;
676
683
  }
677
684
  sub.deps = head;
678
685
  sub.depsTail = tail;
679
686
  }
680
687
  function isDirty(sub) {
681
688
  for (let link = sub.deps; link; link = link.nextDep) {
682
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
689
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
683
690
  return true;
684
691
  }
685
692
  }
@@ -699,7 +706,7 @@ function refreshComputed(computed) {
699
706
  computed.globalVersion = globalVersion;
700
707
  const dep = computed.dep;
701
708
  computed.flags |= 2;
702
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
709
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
703
710
  computed.flags &= ~2;
704
711
  return;
705
712
  }
@@ -801,6 +808,14 @@ function cleanupEffect(e) {
801
808
  }
802
809
 
803
810
  let globalVersion = 0;
811
+ class Link {
812
+ constructor(sub, dep) {
813
+ this.sub = sub;
814
+ this.dep = dep;
815
+ this.version = dep.version;
816
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
817
+ }
818
+ }
804
819
  class Dep {
805
820
  constructor(computed) {
806
821
  this.computed = computed;
@@ -823,16 +838,7 @@ class Dep {
823
838
  }
824
839
  let link = this.activeLink;
825
840
  if (link === void 0 || link.sub !== activeSub) {
826
- link = this.activeLink = {
827
- dep: this,
828
- sub: activeSub,
829
- version: this.version,
830
- nextDep: void 0,
831
- prevDep: void 0,
832
- nextSub: void 0,
833
- prevSub: void 0,
834
- prevActiveLink: void 0
835
- };
841
+ link = this.activeLink = new Link(activeSub, this);
836
842
  if (!activeSub.deps) {
837
843
  activeSub.deps = activeSub.depsTail = link;
838
844
  } else {
@@ -895,7 +901,10 @@ class Dep {
895
901
  }
896
902
  }
897
903
  for (let link = this.subs; link; link = link.prevSub) {
898
- link.sub.notify();
904
+ if (link.sub.notify()) {
905
+ ;
906
+ link.sub.dep.notify();
907
+ }
899
908
  }
900
909
  } finally {
901
910
  endBatch();
@@ -1964,8 +1973,10 @@ class ComputedRefImpl {
1964
1973
  */
1965
1974
  notify() {
1966
1975
  this.flags |= 16;
1967
- if (activeSub !== this) {
1968
- this.dep.notify();
1976
+ if (!(this.flags & 8) && // avoid infinite self recursion
1977
+ activeSub !== this) {
1978
+ batch(this);
1979
+ return true;
1969
1980
  }
1970
1981
  }
1971
1982
  get value() {
@@ -2113,20 +2124,12 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2113
2124
  remove(scope.effects, effect);
2114
2125
  }
2115
2126
  };
2116
- if (once) {
2117
- if (cb) {
2118
- const _cb = cb;
2119
- cb = (...args) => {
2120
- _cb(...args);
2121
- watchHandle();
2122
- };
2123
- } else {
2124
- const _getter = getter;
2125
- getter = () => {
2126
- _getter();
2127
- watchHandle();
2128
- };
2129
- }
2127
+ if (once && cb) {
2128
+ const _cb = cb;
2129
+ cb = (...args) => {
2130
+ _cb(...args);
2131
+ watchHandle();
2132
+ };
2130
2133
  }
2131
2134
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2132
2135
  const job = (immediateFirstRun) => {
@@ -2745,7 +2748,9 @@ function reload(id, newComp) {
2745
2748
  dirtyInstances.delete(instance);
2746
2749
  } else if (instance.parent) {
2747
2750
  queueJob(() => {
2751
+ isHmrUpdating = true;
2748
2752
  instance.parent.update();
2753
+ isHmrUpdating = false;
2749
2754
  dirtyInstances.delete(instance);
2750
2755
  });
2751
2756
  } else if (instance.appContext.reload) {
@@ -3564,6 +3569,9 @@ const TeleportImpl = {
3564
3569
  insert(mainAnchor, container, anchor);
3565
3570
  const mount = (container2, anchor2) => {
3566
3571
  if (shapeFlag & 16) {
3572
+ if (parentComponent && parentComponent.isCE) {
3573
+ parentComponent.ce._teleportTarget = container2;
3574
+ }
3567
3575
  mountChildren(
3568
3576
  children,
3569
3577
  container2,
@@ -4597,7 +4605,11 @@ Server rendered element contains more child nodes than client vdom.`
4597
4605
  remove(cur);
4598
4606
  }
4599
4607
  } else if (shapeFlag & 8) {
4600
- if (el.textContent !== vnode.children) {
4608
+ let clientText = vnode.children;
4609
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4610
+ clientText = clientText.slice(1);
4611
+ }
4612
+ if (el.textContent !== clientText) {
4601
4613
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4602
4614
  warn$1(
4603
4615
  `Hydration text content mismatch on`,
@@ -4796,7 +4808,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4796
4808
  }
4797
4809
  };
4798
4810
  const isTemplateNode = (node) => {
4799
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4811
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4800
4812
  };
4801
4813
  return [hydrate, hydrateNode];
4802
4814
  }
@@ -5148,7 +5160,7 @@ function defineAsyncComponent(source) {
5148
5160
  load().then(() => {
5149
5161
  loaded.value = true;
5150
5162
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5151
- queueJob(instance.parent.update);
5163
+ instance.parent.update();
5152
5164
  }
5153
5165
  }).catch((err) => {
5154
5166
  onError(err);
@@ -7099,7 +7111,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7099
7111
  return vm;
7100
7112
  }
7101
7113
  }
7102
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
7114
+ Vue.version = `2.6.14-compat:${"3.5.6"}`;
7103
7115
  Vue.config = singletonApp.config;
7104
7116
  Vue.use = (plugin, ...options) => {
7105
7117
  if (plugin && isFunction(plugin.install)) {
@@ -8921,6 +8933,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8921
8933
  }
8922
8934
  }
8923
8935
  if (instance.asyncDep) {
8936
+ if (isHmrUpdating) initialVNode.el = null;
8924
8937
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8925
8938
  if (!initialVNode.el) {
8926
8939
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9916,11 +9929,12 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
9916
9929
  } else if (!cb || immediate) {
9917
9930
  baseWatchOptions.once = true;
9918
9931
  } else {
9919
- return {
9920
- stop: NOOP,
9921
- resume: NOOP,
9922
- pause: NOOP
9932
+ const watchStopHandle = () => {
9923
9933
  };
9934
+ watchStopHandle.stop = NOOP;
9935
+ watchStopHandle.resume = NOOP;
9936
+ watchStopHandle.pause = NOOP;
9937
+ return watchStopHandle;
9924
9938
  }
9925
9939
  }
9926
9940
  const instance = currentInstance;
@@ -12212,7 +12226,7 @@ function isMemoSame(cached, memo) {
12212
12226
  return true;
12213
12227
  }
12214
12228
 
12215
- const version = "3.5.4";
12229
+ const version = "3.5.6";
12216
12230
  const warn = warn$1 ;
12217
12231
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12218
12232
  const devtools = devtools$1 ;
@@ -13200,6 +13214,7 @@ class VueElement extends BaseClass {
13200
13214
  }
13201
13215
  }
13202
13216
  connectedCallback() {
13217
+ if (!this.isConnected) return;
13203
13218
  if (!this.shadowRoot) {
13204
13219
  this._parseSlots();
13205
13220
  }
@@ -13242,7 +13257,7 @@ class VueElement extends BaseClass {
13242
13257
  this._ob = null;
13243
13258
  }
13244
13259
  this._app && this._app.unmount();
13245
- this._instance.ce = void 0;
13260
+ if (this._instance) this._instance.ce = void 0;
13246
13261
  this._app = this._instance = null;
13247
13262
  }
13248
13263
  });
@@ -13461,7 +13476,7 @@ class VueElement extends BaseClass {
13461
13476
  }
13462
13477
  }
13463
13478
  /**
13464
- * Only called when shaddowRoot is false
13479
+ * Only called when shadowRoot is false
13465
13480
  */
13466
13481
  _parseSlots() {
13467
13482
  const slots = this._slots = {};
@@ -13473,10 +13488,10 @@ class VueElement extends BaseClass {
13473
13488
  }
13474
13489
  }
13475
13490
  /**
13476
- * Only called when shaddowRoot is false
13491
+ * Only called when shadowRoot is false
13477
13492
  */
13478
13493
  _renderSlots() {
13479
- const outlets = this.querySelectorAll("slot");
13494
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13480
13495
  const scopeId = this._instance.type.__scopeId;
13481
13496
  for (let i = 0; i < outlets.length; i++) {
13482
13497
  const o = outlets[i];
@@ -13664,7 +13679,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13664
13679
  child,
13665
13680
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13666
13681
  );
13667
- } else {
13682
+ } else if (child.type !== Text) {
13668
13683
  warn(`<TransitionGroup> children must be keyed.`);
13669
13684
  }
13670
13685
  }
@@ -14906,7 +14921,7 @@ class Tokenizer {
14906
14921
  this.sequenceIndex += 1;
14907
14922
  } else if (this.sequenceIndex === 0) {
14908
14923
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
14909
- if (c === this.delimiterOpen[0]) {
14924
+ if (!this.inVPre && c === this.delimiterOpen[0]) {
14910
14925
  this.state = 2;
14911
14926
  this.delimiterIndex = 0;
14912
14927
  this.stateInterpolationOpen(c);
@@ -15876,6 +15891,7 @@ const defaultParserOptions = {
15876
15891
  getNamespace: () => 0,
15877
15892
  isVoidTag: NO,
15878
15893
  isPreTag: NO,
15894
+ isIgnoreNewlineTag: NO,
15879
15895
  isCustomElement: NO,
15880
15896
  onError: defaultOnError,
15881
15897
  onWarn: defaultOnWarn,
@@ -16318,7 +16334,7 @@ function onCloseTag(el, end, isImplied = false) {
16318
16334
  el.innerLoc.end.offset
16319
16335
  );
16320
16336
  }
16321
- const { tag, ns } = el;
16337
+ const { tag, ns, children } = el;
16322
16338
  if (!inVPre) {
16323
16339
  if (tag === "slot") {
16324
16340
  el.tagType = 2;
@@ -16329,7 +16345,13 @@ function onCloseTag(el, end, isImplied = false) {
16329
16345
  }
16330
16346
  }
16331
16347
  if (!tokenizer.inRCDATA) {
16332
- el.children = condenseWhitespace(el.children, el.tag);
16348
+ el.children = condenseWhitespace(children);
16349
+ }
16350
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
16351
+ const first = children[0];
16352
+ if (first && first.type === 2) {
16353
+ first.content = first.content.replace(/^\r?\n/, "");
16354
+ }
16333
16355
  }
16334
16356
  if (ns === 0 && currentOptions.isPreTag(tag)) {
16335
16357
  inPre--;
@@ -16481,12 +16503,6 @@ function condenseWhitespace(nodes, tag) {
16481
16503
  }
16482
16504
  }
16483
16505
  }
16484
- if (inPre && tag && currentOptions.isPreTag(tag)) {
16485
- const first = nodes[0];
16486
- if (first && first.type === 2) {
16487
- first.content = first.content.replace(/^\r?\n/, "");
16488
- }
16489
- }
16490
16506
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16491
16507
  }
16492
16508
  function isAllWhitespace(str) {
@@ -19752,6 +19768,7 @@ const parserOptions = {
19752
19768
  isVoidTag,
19753
19769
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
19754
19770
  isPreTag: (tag) => tag === "pre",
19771
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
19755
19772
  decodeEntities: decodeHtmlBrowser ,
19756
19773
  isBuiltInComponent: (tag) => {
19757
19774
  if (tag === "Transition" || tag === "transition") {