vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.4
2
+ * vue v3.5.6
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.4
2
+ * vue v3.5.6
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.4
2
+ * vue 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) {
@@ -3036,6 +3041,9 @@ const TeleportImpl = {
3036
3041
  insert(mainAnchor, container, anchor);
3037
3042
  const mount = (container2, anchor2) => {
3038
3043
  if (shapeFlag & 16) {
3044
+ if (parentComponent && parentComponent.isCE) {
3045
+ parentComponent.ce._teleportTarget = container2;
3046
+ }
3039
3047
  mountChildren(
3040
3048
  children,
3041
3049
  container2,
@@ -4066,7 +4074,11 @@ Server rendered element contains more child nodes than client vdom.`
4066
4074
  remove(cur);
4067
4075
  }
4068
4076
  } else if (shapeFlag & 8) {
4069
- if (el.textContent !== vnode.children) {
4077
+ let clientText = vnode.children;
4078
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4079
+ clientText = clientText.slice(1);
4080
+ }
4081
+ if (el.textContent !== clientText) {
4070
4082
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4071
4083
  warn$1(
4072
4084
  `Hydration text content mismatch on`,
@@ -4265,7 +4277,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4265
4277
  }
4266
4278
  };
4267
4279
  const isTemplateNode = (node) => {
4268
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4280
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4269
4281
  };
4270
4282
  return [hydrate, hydrateNode];
4271
4283
  }
@@ -4617,7 +4629,7 @@ function defineAsyncComponent(source) {
4617
4629
  load().then(() => {
4618
4630
  loaded.value = true;
4619
4631
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4620
- queueJob(instance.parent.update);
4632
+ instance.parent.update();
4621
4633
  }
4622
4634
  }).catch((err) => {
4623
4635
  onError(err);
@@ -7299,6 +7311,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7299
7311
  }
7300
7312
  }
7301
7313
  if (instance.asyncDep) {
7314
+ if (isHmrUpdating) initialVNode.el = null;
7302
7315
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
7303
7316
  if (!initialVNode.el) {
7304
7317
  const placeholder = instance.subTree = createVNode(Comment);
@@ -8261,11 +8274,12 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
8261
8274
  } else if (!cb || immediate) {
8262
8275
  baseWatchOptions.once = true;
8263
8276
  } else {
8264
- return {
8265
- stop: NOOP,
8266
- resume: NOOP,
8267
- pause: NOOP
8277
+ const watchStopHandle = () => {
8268
8278
  };
8279
+ watchStopHandle.stop = NOOP;
8280
+ watchStopHandle.resume = NOOP;
8281
+ watchStopHandle.pause = NOOP;
8282
+ return watchStopHandle;
8269
8283
  }
8270
8284
  }
8271
8285
  const instance = currentInstance;
@@ -10450,7 +10464,7 @@ function isMemoSame(cached, memo) {
10450
10464
  return true;
10451
10465
  }
10452
10466
 
10453
- const version = "3.5.4";
10467
+ const version = "3.5.6";
10454
10468
  const warn = warn$1 ;
10455
10469
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10456
10470
  const devtools = devtools$1 ;
@@ -11350,6 +11364,7 @@ class VueElement extends BaseClass {
11350
11364
  }
11351
11365
  }
11352
11366
  connectedCallback() {
11367
+ if (!this.isConnected) return;
11353
11368
  if (!this.shadowRoot) {
11354
11369
  this._parseSlots();
11355
11370
  }
@@ -11392,7 +11407,7 @@ class VueElement extends BaseClass {
11392
11407
  this._ob = null;
11393
11408
  }
11394
11409
  this._app && this._app.unmount();
11395
- this._instance.ce = void 0;
11410
+ if (this._instance) this._instance.ce = void 0;
11396
11411
  this._app = this._instance = null;
11397
11412
  }
11398
11413
  });
@@ -11611,7 +11626,7 @@ class VueElement extends BaseClass {
11611
11626
  }
11612
11627
  }
11613
11628
  /**
11614
- * Only called when shaddowRoot is false
11629
+ * Only called when shadowRoot is false
11615
11630
  */
11616
11631
  _parseSlots() {
11617
11632
  const slots = this._slots = {};
@@ -11623,10 +11638,10 @@ class VueElement extends BaseClass {
11623
11638
  }
11624
11639
  }
11625
11640
  /**
11626
- * Only called when shaddowRoot is false
11641
+ * Only called when shadowRoot is false
11627
11642
  */
11628
11643
  _renderSlots() {
11629
- const outlets = this.querySelectorAll("slot");
11644
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11630
11645
  const scopeId = this._instance.type.__scopeId;
11631
11646
  for (let i = 0; i < outlets.length; i++) {
11632
11647
  const o = outlets[i];
@@ -11805,7 +11820,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11805
11820
  child,
11806
11821
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
11807
11822
  );
11808
- } else {
11823
+ } else if (child.type !== Text) {
11809
11824
  warn(`<TransitionGroup> children must be keyed.`);
11810
11825
  }
11811
11826
  }
@@ -12979,7 +12994,7 @@ class Tokenizer {
12979
12994
  this.sequenceIndex += 1;
12980
12995
  } else if (this.sequenceIndex === 0) {
12981
12996
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
12982
- if (c === this.delimiterOpen[0]) {
12997
+ if (!this.inVPre && c === this.delimiterOpen[0]) {
12983
12998
  this.state = 2;
12984
12999
  this.delimiterIndex = 0;
12985
13000
  this.stateInterpolationOpen(c);
@@ -13882,6 +13897,7 @@ const defaultParserOptions = {
13882
13897
  getNamespace: () => 0,
13883
13898
  isVoidTag: NO,
13884
13899
  isPreTag: NO,
13900
+ isIgnoreNewlineTag: NO,
13885
13901
  isCustomElement: NO,
13886
13902
  onError: defaultOnError,
13887
13903
  onWarn: defaultOnWarn,
@@ -14312,7 +14328,7 @@ function onCloseTag(el, end, isImplied = false) {
14312
14328
  el.innerLoc.end.offset
14313
14329
  );
14314
14330
  }
14315
- const { tag, ns } = el;
14331
+ const { tag, ns, children } = el;
14316
14332
  if (!inVPre) {
14317
14333
  if (tag === "slot") {
14318
14334
  el.tagType = 2;
@@ -14323,7 +14339,13 @@ function onCloseTag(el, end, isImplied = false) {
14323
14339
  }
14324
14340
  }
14325
14341
  if (!tokenizer.inRCDATA) {
14326
- el.children = condenseWhitespace(el.children, el.tag);
14342
+ el.children = condenseWhitespace(children);
14343
+ }
14344
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14345
+ const first = children[0];
14346
+ if (first && first.type === 2) {
14347
+ first.content = first.content.replace(/^\r?\n/, "");
14348
+ }
14327
14349
  }
14328
14350
  if (ns === 0 && currentOptions.isPreTag(tag)) {
14329
14351
  inPre--;
@@ -14404,12 +14426,6 @@ function condenseWhitespace(nodes, tag) {
14404
14426
  }
14405
14427
  }
14406
14428
  }
14407
- if (inPre && tag && currentOptions.isPreTag(tag)) {
14408
- const first = nodes[0];
14409
- if (first && first.type === 2) {
14410
- first.content = first.content.replace(/^\r?\n/, "");
14411
- }
14412
- }
14413
14429
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
14414
14430
  }
14415
14431
  function isAllWhitespace(str) {
@@ -17470,6 +17486,7 @@ const parserOptions = {
17470
17486
  isVoidTag,
17471
17487
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17472
17488
  isPreTag: (tag) => tag === "pre",
17489
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17473
17490
  decodeEntities: decodeHtmlBrowser ,
17474
17491
  isBuiltInComponent: (tag) => {
17475
17492
  if (tag === "Transition" || tag === "transition") {