@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -285,6 +285,9 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
285
285
  const isKnownSvgAttr = /* @__PURE__ */ makeMap(
286
286
  `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
287
287
  );
288
+ const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
289
+ `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
290
+ );
288
291
  function isRenderableAttrValue(value) {
289
292
  if (value == null) {
290
293
  return false;
@@ -582,7 +585,7 @@ class ReactiveEffect {
582
585
  /**
583
586
  * @internal
584
587
  */
585
- this.nextEffect = void 0;
588
+ this.next = void 0;
586
589
  /**
587
590
  * @internal
588
591
  */
@@ -612,9 +615,7 @@ class ReactiveEffect {
612
615
  return;
613
616
  }
614
617
  if (!(this.flags & 8)) {
615
- this.flags |= 8;
616
- this.nextEffect = batchedEffect;
617
- batchedEffect = this;
618
+ batch(this);
618
619
  }
619
620
  }
620
621
  run() {
@@ -675,7 +676,12 @@ class ReactiveEffect {
675
676
  }
676
677
  }
677
678
  let batchDepth = 0;
678
- let batchedEffect;
679
+ let batchedSub;
680
+ function batch(sub) {
681
+ sub.flags |= 8;
682
+ sub.next = batchedSub;
683
+ batchedSub = sub;
684
+ }
679
685
  function startBatch() {
680
686
  batchDepth++;
681
687
  }
@@ -684,15 +690,16 @@ function endBatch() {
684
690
  return;
685
691
  }
686
692
  let error;
687
- while (batchedEffect) {
688
- let e = batchedEffect;
689
- batchedEffect = void 0;
693
+ while (batchedSub) {
694
+ let e = batchedSub;
695
+ batchedSub = void 0;
690
696
  while (e) {
691
- const next = e.nextEffect;
692
- e.nextEffect = void 0;
697
+ const next = e.next;
698
+ e.next = void 0;
693
699
  e.flags &= ~8;
694
700
  if (e.flags & 1) {
695
701
  try {
702
+ ;
696
703
  e.trigger();
697
704
  } catch (err) {
698
705
  if (!error) error = err;
@@ -713,9 +720,11 @@ function prepareDeps(sub) {
713
720
  function cleanupDeps(sub) {
714
721
  let head;
715
722
  let tail = sub.depsTail;
716
- for (let link = tail; link; link = link.prevDep) {
723
+ let link = tail;
724
+ while (link) {
725
+ const prev = link.prevDep;
717
726
  if (link.version === -1) {
718
- if (link === tail) tail = link.prevDep;
727
+ if (link === tail) tail = prev;
719
728
  removeSub(link);
720
729
  removeDep(link);
721
730
  } else {
@@ -723,13 +732,14 @@ function cleanupDeps(sub) {
723
732
  }
724
733
  link.dep.activeLink = link.prevActiveLink;
725
734
  link.prevActiveLink = void 0;
735
+ link = prev;
726
736
  }
727
737
  sub.deps = head;
728
738
  sub.depsTail = tail;
729
739
  }
730
740
  function isDirty(sub) {
731
741
  for (let link = sub.deps; link; link = link.nextDep) {
732
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
742
+ if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
733
743
  return true;
734
744
  }
735
745
  }
@@ -749,7 +759,7 @@ function refreshComputed(computed) {
749
759
  computed.globalVersion = globalVersion;
750
760
  const dep = computed.dep;
751
761
  computed.flags |= 2;
752
- if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
762
+ if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
753
763
  computed.flags &= ~2;
754
764
  return;
755
765
  }
@@ -851,6 +861,14 @@ function cleanupEffect(e) {
851
861
  }
852
862
 
853
863
  let globalVersion = 0;
864
+ class Link {
865
+ constructor(sub, dep) {
866
+ this.sub = sub;
867
+ this.dep = dep;
868
+ this.version = dep.version;
869
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
870
+ }
871
+ }
854
872
  class Dep {
855
873
  constructor(computed) {
856
874
  this.computed = computed;
@@ -873,16 +891,7 @@ class Dep {
873
891
  }
874
892
  let link = this.activeLink;
875
893
  if (link === void 0 || link.sub !== activeSub) {
876
- link = this.activeLink = {
877
- dep: this,
878
- sub: activeSub,
879
- version: this.version,
880
- nextDep: void 0,
881
- prevDep: void 0,
882
- nextSub: void 0,
883
- prevSub: void 0,
884
- prevActiveLink: void 0
885
- };
894
+ link = this.activeLink = new Link(activeSub, this);
886
895
  if (!activeSub.deps) {
887
896
  activeSub.deps = activeSub.depsTail = link;
888
897
  } else {
@@ -945,7 +954,10 @@ class Dep {
945
954
  }
946
955
  }
947
956
  for (let link = this.subs; link; link = link.prevSub) {
948
- link.sub.notify();
957
+ if (link.sub.notify()) {
958
+ ;
959
+ link.sub.dep.notify();
960
+ }
949
961
  }
950
962
  } finally {
951
963
  endBatch();
@@ -2014,8 +2026,10 @@ class ComputedRefImpl {
2014
2026
  */
2015
2027
  notify() {
2016
2028
  this.flags |= 16;
2017
- if (activeSub !== this) {
2018
- this.dep.notify();
2029
+ if (!(this.flags & 8) && // avoid infinite self recursion
2030
+ activeSub !== this) {
2031
+ batch(this);
2032
+ return true;
2019
2033
  }
2020
2034
  }
2021
2035
  get value() {
@@ -2163,20 +2177,12 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2163
2177
  remove(scope.effects, effect);
2164
2178
  }
2165
2179
  };
2166
- if (once) {
2167
- if (cb) {
2168
- const _cb = cb;
2169
- cb = (...args) => {
2170
- _cb(...args);
2171
- watchHandle();
2172
- };
2173
- } else {
2174
- const _getter = getter;
2175
- getter = () => {
2176
- _getter();
2177
- watchHandle();
2178
- };
2179
- }
2180
+ if (once && cb) {
2181
+ const _cb = cb;
2182
+ cb = (...args) => {
2183
+ _cb(...args);
2184
+ watchHandle();
2185
+ };
2180
2186
  }
2181
2187
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
2182
2188
  const job = (immediateFirstRun) => {
@@ -2795,7 +2801,9 @@ function reload(id, newComp) {
2795
2801
  dirtyInstances.delete(instance);
2796
2802
  } else if (instance.parent) {
2797
2803
  queueJob(() => {
2804
+ isHmrUpdating = true;
2798
2805
  instance.parent.update();
2806
+ isHmrUpdating = false;
2799
2807
  dirtyInstances.delete(instance);
2800
2808
  });
2801
2809
  } else if (instance.appContext.reload) {
@@ -3614,6 +3622,9 @@ const TeleportImpl = {
3614
3622
  insert(mainAnchor, container, anchor);
3615
3623
  const mount = (container2, anchor2) => {
3616
3624
  if (shapeFlag & 16) {
3625
+ if (parentComponent && parentComponent.isCE) {
3626
+ parentComponent.ce._teleportTarget = container2;
3627
+ }
3617
3628
  mountChildren(
3618
3629
  children,
3619
3630
  container2,
@@ -4647,7 +4658,11 @@ Server rendered element contains more child nodes than client vdom.`
4647
4658
  remove(cur);
4648
4659
  }
4649
4660
  } else if (shapeFlag & 8) {
4650
- if (el.textContent !== vnode.children) {
4661
+ let clientText = vnode.children;
4662
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4663
+ clientText = clientText.slice(1);
4664
+ }
4665
+ if (el.textContent !== clientText) {
4651
4666
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4652
4667
  warn$1(
4653
4668
  `Hydration text content mismatch on`,
@@ -4846,7 +4861,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4846
4861
  }
4847
4862
  };
4848
4863
  const isTemplateNode = (node) => {
4849
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4864
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4850
4865
  };
4851
4866
  return [hydrate, hydrateNode];
4852
4867
  }
@@ -5198,7 +5213,7 @@ function defineAsyncComponent(source) {
5198
5213
  load().then(() => {
5199
5214
  loaded.value = true;
5200
5215
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5201
- queueJob(instance.parent.update);
5216
+ instance.parent.update();
5202
5217
  }
5203
5218
  }).catch((err) => {
5204
5219
  onError(err);
@@ -7149,7 +7164,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7149
7164
  return vm;
7150
7165
  }
7151
7166
  }
7152
- Vue.version = `2.6.14-compat:${"3.5.4"}`;
7167
+ Vue.version = `2.6.14-compat:${"3.5.6"}`;
7153
7168
  Vue.config = singletonApp.config;
7154
7169
  Vue.use = (plugin, ...options) => {
7155
7170
  if (plugin && isFunction(plugin.install)) {
@@ -8971,6 +8986,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8971
8986
  }
8972
8987
  }
8973
8988
  if (instance.asyncDep) {
8989
+ if (isHmrUpdating) initialVNode.el = null;
8974
8990
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8975
8991
  if (!initialVNode.el) {
8976
8992
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9966,11 +9982,12 @@ function doWatch(source, cb, options = EMPTY_OBJ) {
9966
9982
  } else if (!cb || immediate) {
9967
9983
  baseWatchOptions.once = true;
9968
9984
  } else {
9969
- return {
9970
- stop: NOOP,
9971
- resume: NOOP,
9972
- pause: NOOP
9985
+ const watchStopHandle = () => {
9973
9986
  };
9987
+ watchStopHandle.stop = NOOP;
9988
+ watchStopHandle.resume = NOOP;
9989
+ watchStopHandle.pause = NOOP;
9990
+ return watchStopHandle;
9974
9991
  }
9975
9992
  }
9976
9993
  const instance = currentInstance;
@@ -12262,7 +12279,7 @@ function isMemoSame(cached, memo) {
12262
12279
  return true;
12263
12280
  }
12264
12281
 
12265
- const version = "3.5.4";
12282
+ const version = "3.5.6";
12266
12283
  const warn = warn$1 ;
12267
12284
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12268
12285
  const devtools = devtools$1 ;
@@ -13184,6 +13201,7 @@ class VueElement extends BaseClass {
13184
13201
  }
13185
13202
  }
13186
13203
  connectedCallback() {
13204
+ if (!this.isConnected) return;
13187
13205
  if (!this.shadowRoot) {
13188
13206
  this._parseSlots();
13189
13207
  }
@@ -13226,7 +13244,7 @@ class VueElement extends BaseClass {
13226
13244
  this._ob = null;
13227
13245
  }
13228
13246
  this._app && this._app.unmount();
13229
- this._instance.ce = void 0;
13247
+ if (this._instance) this._instance.ce = void 0;
13230
13248
  this._app = this._instance = null;
13231
13249
  }
13232
13250
  });
@@ -13445,7 +13463,7 @@ class VueElement extends BaseClass {
13445
13463
  }
13446
13464
  }
13447
13465
  /**
13448
- * Only called when shaddowRoot is false
13466
+ * Only called when shadowRoot is false
13449
13467
  */
13450
13468
  _parseSlots() {
13451
13469
  const slots = this._slots = {};
@@ -13457,10 +13475,10 @@ class VueElement extends BaseClass {
13457
13475
  }
13458
13476
  }
13459
13477
  /**
13460
- * Only called when shaddowRoot is false
13478
+ * Only called when shadowRoot is false
13461
13479
  */
13462
13480
  _renderSlots() {
13463
- const outlets = this.querySelectorAll("slot");
13481
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13464
13482
  const scopeId = this._instance.type.__scopeId;
13465
13483
  for (let i = 0; i < outlets.length; i++) {
13466
13484
  const o = outlets[i];
@@ -13648,7 +13666,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13648
13666
  child,
13649
13667
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
13650
13668
  );
13651
- } else {
13669
+ } else if (child.type !== Text) {
13652
13670
  warn(`<TransitionGroup> children must be keyed.`);
13653
13671
  }
13654
13672
  }
@@ -14885,7 +14903,7 @@ class Tokenizer {
14885
14903
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
14886
14904
  if (c === 38) {
14887
14905
  this.startEntity();
14888
- } else if (c === this.delimiterOpen[0]) {
14906
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
14889
14907
  this.state = 2;
14890
14908
  this.delimiterIndex = 0;
14891
14909
  this.stateInterpolationOpen(c);
@@ -16289,6 +16307,7 @@ const defaultParserOptions = {
16289
16307
  getNamespace: () => 0,
16290
16308
  isVoidTag: NO,
16291
16309
  isPreTag: NO,
16310
+ isIgnoreNewlineTag: NO,
16292
16311
  isCustomElement: NO,
16293
16312
  onError: defaultOnError,
16294
16313
  onWarn: defaultOnWarn,
@@ -16728,7 +16747,7 @@ function onCloseTag(el, end, isImplied = false) {
16728
16747
  el.innerLoc.end.offset
16729
16748
  );
16730
16749
  }
16731
- const { tag, ns } = el;
16750
+ const { tag, ns, children } = el;
16732
16751
  if (!inVPre) {
16733
16752
  if (tag === "slot") {
16734
16753
  el.tagType = 2;
@@ -16739,7 +16758,13 @@ function onCloseTag(el, end, isImplied = false) {
16739
16758
  }
16740
16759
  }
16741
16760
  if (!tokenizer.inRCDATA) {
16742
- el.children = condenseWhitespace(el.children, el.tag);
16761
+ el.children = condenseWhitespace(children);
16762
+ }
16763
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
16764
+ const first = children[0];
16765
+ if (first && first.type === 2) {
16766
+ first.content = first.content.replace(/^\r?\n/, "");
16767
+ }
16743
16768
  }
16744
16769
  if (ns === 0 && currentOptions.isPreTag(tag)) {
16745
16770
  inPre--;
@@ -16891,12 +16916,6 @@ function condenseWhitespace(nodes, tag) {
16891
16916
  }
16892
16917
  }
16893
16918
  }
16894
- if (inPre && tag && currentOptions.isPreTag(tag)) {
16895
- const first = nodes[0];
16896
- if (first && first.type === 2) {
16897
- first.content = first.content.replace(/^\r?\n/, "");
16898
- }
16899
- }
16900
16919
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
16901
16920
  }
16902
16921
  function isAllWhitespace(str) {
@@ -20742,6 +20761,7 @@ const parserOptions = {
20742
20761
  isVoidTag,
20743
20762
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
20744
20763
  isPreTag: (tag) => tag === "pre",
20764
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
20745
20765
  decodeEntities: void 0,
20746
20766
  isBuiltInComponent: (tag) => {
20747
20767
  if (tag === "Transition" || tag === "transition") {
@@ -21134,12 +21154,17 @@ const stringifyStatic = (children, context, parent) => {
21134
21154
  // will insert / hydrate
21135
21155
  String(currentChunk.length)
21136
21156
  ]);
21157
+ const deleteCount = currentChunk.length - 1;
21137
21158
  if (isParentCached) {
21138
- parent.codegenNode.children.value = createArrayExpression([staticCall]);
21159
+ children.splice(
21160
+ currentIndex - currentChunk.length,
21161
+ currentChunk.length,
21162
+ // @ts-expect-error
21163
+ staticCall
21164
+ );
21139
21165
  } else {
21140
21166
  currentChunk[0].codegenNode.value = staticCall;
21141
21167
  if (currentChunk.length > 1) {
21142
- const deleteCount = currentChunk.length - 1;
21143
21168
  children.splice(currentIndex - currentChunk.length + 1, deleteCount);
21144
21169
  const cacheIndex = context.cached.indexOf(
21145
21170
  currentChunk[currentChunk.length - 1].codegenNode
@@ -21151,9 +21176,9 @@ const stringifyStatic = (children, context, parent) => {
21151
21176
  }
21152
21177
  context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
21153
21178
  }
21154
- return deleteCount;
21155
21179
  }
21156
21180
  }
21181
+ return deleteCount;
21157
21182
  }
21158
21183
  return 0;
21159
21184
  };
@@ -21184,7 +21209,7 @@ const getCachedNode = (node) => {
21184
21209
  };
21185
21210
  const dataAriaRE = /^(data|aria)-/;
21186
21211
  const isStringifiableAttr = (name, ns) => {
21187
- return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : false) || dataAriaRE.test(name);
21212
+ return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
21188
21213
  };
21189
21214
  const isNonStringifiable = /* @__PURE__ */ makeMap(
21190
21215
  `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`