vue 3.5.3 → 3.5.5

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.3
2
+ * vue v3.5.5
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.3
2
+ * vue v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,13 +1,14 @@
1
1
  /**
2
- * vue v3.5.3
2
+ * vue v3.5.5
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
6
  /*! #__NO_SIDE_EFFECTS__ */
7
7
  // @__NO_SIDE_EFFECTS__
8
- function makeMap(str, expectsLowerCase) {
9
- const set = new Set(str.split(","));
10
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
8
+ function makeMap(str) {
9
+ const map = /* @__PURE__ */ Object.create(null);
10
+ for (const key of str.split(",")) map[key] = 1;
11
+ return (val) => val in map;
11
12
  }
12
13
 
13
14
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -662,9 +663,11 @@ function prepareDeps(sub) {
662
663
  function cleanupDeps(sub) {
663
664
  let head;
664
665
  let tail = sub.depsTail;
665
- for (let link = tail; link; link = link.prevDep) {
666
+ let link = tail;
667
+ while (link) {
668
+ const prev = link.prevDep;
666
669
  if (link.version === -1) {
667
- if (link === tail) tail = link.prevDep;
670
+ if (link === tail) tail = prev;
668
671
  removeSub(link);
669
672
  removeDep(link);
670
673
  } else {
@@ -672,13 +675,14 @@ function cleanupDeps(sub) {
672
675
  }
673
676
  link.dep.activeLink = link.prevActiveLink;
674
677
  link.prevActiveLink = void 0;
678
+ link = prev;
675
679
  }
676
680
  sub.deps = head;
677
681
  sub.depsTail = tail;
678
682
  }
679
683
  function isDirty(sub) {
680
684
  for (let link = sub.deps; link; link = link.nextDep) {
681
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
685
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
682
686
  return true;
683
687
  }
684
688
  }
@@ -688,9 +692,6 @@ function isDirty(sub) {
688
692
  return false;
689
693
  }
690
694
  function refreshComputed(computed) {
691
- if (computed.flags & 2) {
692
- return false;
693
- }
694
695
  if (computed.flags & 4 && !(computed.flags & 16)) {
695
696
  return;
696
697
  }
@@ -803,6 +804,14 @@ function cleanupEffect(e) {
803
804
  }
804
805
 
805
806
  let globalVersion = 0;
807
+ class Link {
808
+ constructor(sub, dep) {
809
+ this.sub = sub;
810
+ this.dep = dep;
811
+ this.version = dep.version;
812
+ this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
813
+ }
814
+ }
806
815
  class Dep {
807
816
  constructor(computed) {
808
817
  this.computed = computed;
@@ -825,16 +834,7 @@ class Dep {
825
834
  }
826
835
  let link = this.activeLink;
827
836
  if (link === void 0 || link.sub !== activeSub) {
828
- link = this.activeLink = {
829
- dep: this,
830
- sub: activeSub,
831
- version: this.version,
832
- nextDep: void 0,
833
- prevDep: void 0,
834
- nextSub: void 0,
835
- prevSub: void 0,
836
- prevActiveLink: void 0
837
- };
837
+ link = this.activeLink = new Link(activeSub, this);
838
838
  if (!activeSub.deps) {
839
839
  activeSub.deps = activeSub.depsTail = link;
840
840
  } else {
@@ -957,9 +957,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
957
957
  globalVersion++;
958
958
  return;
959
959
  }
960
- let deps = [];
960
+ const run = (dep) => {
961
+ if (dep) {
962
+ {
963
+ dep.trigger({
964
+ target,
965
+ type,
966
+ key,
967
+ newValue,
968
+ oldValue,
969
+ oldTarget
970
+ });
971
+ }
972
+ }
973
+ };
974
+ startBatch();
961
975
  if (type === "clear") {
962
- deps = [...depsMap.values()];
976
+ depsMap.forEach(run);
963
977
  } else {
964
978
  const targetIsArray = isArray(target);
965
979
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -967,57 +981,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
967
981
  const newLength = Number(newValue);
968
982
  depsMap.forEach((dep, key2) => {
969
983
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
970
- deps.push(dep);
984
+ run(dep);
971
985
  }
972
986
  });
973
987
  } else {
974
- const push = (dep) => dep && deps.push(dep);
975
988
  if (key !== void 0) {
976
- push(depsMap.get(key));
989
+ run(depsMap.get(key));
977
990
  }
978
991
  if (isArrayIndex) {
979
- push(depsMap.get(ARRAY_ITERATE_KEY));
992
+ run(depsMap.get(ARRAY_ITERATE_KEY));
980
993
  }
981
994
  switch (type) {
982
995
  case "add":
983
996
  if (!targetIsArray) {
984
- push(depsMap.get(ITERATE_KEY));
997
+ run(depsMap.get(ITERATE_KEY));
985
998
  if (isMap(target)) {
986
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
999
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
987
1000
  }
988
1001
  } else if (isArrayIndex) {
989
- push(depsMap.get("length"));
1002
+ run(depsMap.get("length"));
990
1003
  }
991
1004
  break;
992
1005
  case "delete":
993
1006
  if (!targetIsArray) {
994
- push(depsMap.get(ITERATE_KEY));
1007
+ run(depsMap.get(ITERATE_KEY));
995
1008
  if (isMap(target)) {
996
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1009
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
997
1010
  }
998
1011
  }
999
1012
  break;
1000
1013
  case "set":
1001
1014
  if (isMap(target)) {
1002
- push(depsMap.get(ITERATE_KEY));
1015
+ run(depsMap.get(ITERATE_KEY));
1003
1016
  }
1004
1017
  break;
1005
1018
  }
1006
1019
  }
1007
1020
  }
1008
- startBatch();
1009
- for (const dep of deps) {
1010
- {
1011
- dep.trigger({
1012
- target,
1013
- type,
1014
- key,
1015
- newValue,
1016
- oldValue,
1017
- oldTarget
1018
- });
1019
- }
1020
- }
1021
1021
  endBatch();
1022
1022
  }
1023
1023
  function getDepFromReactive(object, key) {
@@ -1755,7 +1755,7 @@ function toRaw(observed) {
1755
1755
  return raw ? toRaw(raw) : observed;
1756
1756
  }
1757
1757
  function markRaw(value) {
1758
- if (Object.isExtensible(value)) {
1758
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1759
1759
  def(value, "__v_skip", true);
1760
1760
  }
1761
1761
  return value;
@@ -1965,8 +1965,8 @@ class ComputedRefImpl {
1965
1965
  * @internal
1966
1966
  */
1967
1967
  notify() {
1968
+ this.flags |= 16;
1968
1969
  if (activeSub !== this) {
1969
- this.flags |= 16;
1970
1970
  this.dep.notify();
1971
1971
  }
1972
1972
  }
@@ -2654,23 +2654,19 @@ function flushJobs(seen) {
2654
2654
  }
2655
2655
  }
2656
2656
  function checkRecursiveUpdates(seen, fn) {
2657
- if (!seen.has(fn)) {
2658
- seen.set(fn, 1);
2659
- } else {
2660
- const count = seen.get(fn);
2661
- if (count > RECURSION_LIMIT) {
2662
- const instance = fn.i;
2663
- const componentName = instance && getComponentName(instance.type);
2664
- handleError(
2665
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2666
- null,
2667
- 10
2668
- );
2669
- return true;
2670
- } else {
2671
- seen.set(fn, count + 1);
2672
- }
2657
+ const count = seen.get(fn) || 0;
2658
+ if (count > RECURSION_LIMIT) {
2659
+ const instance = fn.i;
2660
+ const componentName = instance && getComponentName(instance.type);
2661
+ handleError(
2662
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2663
+ null,
2664
+ 10
2665
+ );
2666
+ return true;
2673
2667
  }
2668
+ seen.set(fn, count + 1);
2669
+ return false;
2674
2670
  }
2675
2671
 
2676
2672
  let isHmrUpdating = false;
@@ -2751,7 +2747,9 @@ function reload(id, newComp) {
2751
2747
  dirtyInstances.delete(instance);
2752
2748
  } else if (instance.parent) {
2753
2749
  queueJob(() => {
2750
+ isHmrUpdating = true;
2754
2751
  instance.parent.update();
2752
+ isHmrUpdating = false;
2755
2753
  dirtyInstances.delete(instance);
2756
2754
  });
2757
2755
  } else if (instance.appContext.reload) {
@@ -3042,6 +3040,9 @@ const TeleportImpl = {
3042
3040
  insert(mainAnchor, container, anchor);
3043
3041
  const mount = (container2, anchor2) => {
3044
3042
  if (shapeFlag & 16) {
3043
+ if (parentComponent && parentComponent.isCE) {
3044
+ parentComponent.ce._teleportTarget = container2;
3045
+ }
3045
3046
  mountChildren(
3046
3047
  children,
3047
3048
  container2,
@@ -4072,7 +4073,11 @@ Server rendered element contains more child nodes than client vdom.`
4072
4073
  remove(cur);
4073
4074
  }
4074
4075
  } else if (shapeFlag & 8) {
4075
- if (el.textContent !== vnode.children) {
4076
+ let clientText = vnode.children;
4077
+ if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4078
+ clientText = clientText.slice(1);
4079
+ }
4080
+ if (el.textContent !== clientText) {
4076
4081
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4077
4082
  warn$1(
4078
4083
  `Hydration text content mismatch on`,
@@ -4271,7 +4276,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4271
4276
  }
4272
4277
  };
4273
4278
  const isTemplateNode = (node) => {
4274
- return node.nodeType === 1 && node.tagName.toLowerCase() === "template";
4279
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4275
4280
  };
4276
4281
  return [hydrate, hydrateNode];
4277
4282
  }
@@ -4623,7 +4628,7 @@ function defineAsyncComponent(source) {
4623
4628
  load().then(() => {
4624
4629
  loaded.value = true;
4625
4630
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4626
- queueJob(instance.parent.update);
4631
+ instance.parent.update();
4627
4632
  }
4628
4633
  }).catch((err) => {
4629
4634
  onError(err);
@@ -5024,13 +5029,15 @@ function renderList(source, renderItem, cache, index) {
5024
5029
  const sourceIsArray = isArray(source);
5025
5030
  if (sourceIsArray || isString(source)) {
5026
5031
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5032
+ let needsWrap = false;
5027
5033
  if (sourceIsReactiveArray) {
5034
+ needsWrap = !isShallow(source);
5028
5035
  source = shallowReadArray(source);
5029
5036
  }
5030
5037
  ret = new Array(source.length);
5031
5038
  for (let i = 0, l = source.length; i < l; i++) {
5032
5039
  ret[i] = renderItem(
5033
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5040
+ needsWrap ? toReactive(source[i]) : source[i],
5034
5041
  i,
5035
5042
  void 0,
5036
5043
  cached && cached[i]
@@ -7303,6 +7310,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7303
7310
  }
7304
7311
  }
7305
7312
  if (instance.asyncDep) {
7313
+ if (isHmrUpdating) initialVNode.el = null;
7306
7314
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
7307
7315
  if (!initialVNode.el) {
7308
7316
  const placeholder = instance.subTree = createVNode(Comment);
@@ -10454,7 +10462,7 @@ function isMemoSame(cached, memo) {
10454
10462
  return true;
10455
10463
  }
10456
10464
 
10457
- const version = "3.5.3";
10465
+ const version = "3.5.5";
10458
10466
  const warn = warn$1 ;
10459
10467
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10460
10468
  const devtools = devtools$1 ;
@@ -11354,6 +11362,7 @@ class VueElement extends BaseClass {
11354
11362
  }
11355
11363
  }
11356
11364
  connectedCallback() {
11365
+ if (!this.isConnected) return;
11357
11366
  if (!this.shadowRoot) {
11358
11367
  this._parseSlots();
11359
11368
  }
@@ -11396,7 +11405,7 @@ class VueElement extends BaseClass {
11396
11405
  this._ob = null;
11397
11406
  }
11398
11407
  this._app && this._app.unmount();
11399
- this._instance.ce = void 0;
11408
+ if (this._instance) this._instance.ce = void 0;
11400
11409
  this._app = this._instance = null;
11401
11410
  }
11402
11411
  });
@@ -11615,7 +11624,7 @@ class VueElement extends BaseClass {
11615
11624
  }
11616
11625
  }
11617
11626
  /**
11618
- * Only called when shaddowRoot is false
11627
+ * Only called when shadowRoot is false
11619
11628
  */
11620
11629
  _parseSlots() {
11621
11630
  const slots = this._slots = {};
@@ -11627,10 +11636,10 @@ class VueElement extends BaseClass {
11627
11636
  }
11628
11637
  }
11629
11638
  /**
11630
- * Only called when shaddowRoot is false
11639
+ * Only called when shadowRoot is false
11631
11640
  */
11632
11641
  _renderSlots() {
11633
- const outlets = this.querySelectorAll("slot");
11642
+ const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11634
11643
  const scopeId = this._instance.type.__scopeId;
11635
11644
  for (let i = 0; i < outlets.length; i++) {
11636
11645
  const o = outlets[i];
@@ -11809,7 +11818,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11809
11818
  child,
11810
11819
  resolveTransitionHooks(child, cssTransitionProps, state, instance)
11811
11820
  );
11812
- } else {
11821
+ } else if (child.type !== Text) {
11813
11822
  warn(`<TransitionGroup> children must be keyed.`);
11814
11823
  }
11815
11824
  }
@@ -12983,7 +12992,7 @@ class Tokenizer {
12983
12992
  this.sequenceIndex += 1;
12984
12993
  } else if (this.sequenceIndex === 0) {
12985
12994
  if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
12986
- if (c === this.delimiterOpen[0]) {
12995
+ if (!this.inVPre && c === this.delimiterOpen[0]) {
12987
12996
  this.state = 2;
12988
12997
  this.delimiterIndex = 0;
12989
12998
  this.stateInterpolationOpen(c);
@@ -13886,6 +13895,7 @@ const defaultParserOptions = {
13886
13895
  getNamespace: () => 0,
13887
13896
  isVoidTag: NO,
13888
13897
  isPreTag: NO,
13898
+ isIgnoreNewlineTag: NO,
13889
13899
  isCustomElement: NO,
13890
13900
  onError: defaultOnError,
13891
13901
  onWarn: defaultOnWarn,
@@ -14316,7 +14326,7 @@ function onCloseTag(el, end, isImplied = false) {
14316
14326
  el.innerLoc.end.offset
14317
14327
  );
14318
14328
  }
14319
- const { tag, ns } = el;
14329
+ const { tag, ns, children } = el;
14320
14330
  if (!inVPre) {
14321
14331
  if (tag === "slot") {
14322
14332
  el.tagType = 2;
@@ -14327,7 +14337,13 @@ function onCloseTag(el, end, isImplied = false) {
14327
14337
  }
14328
14338
  }
14329
14339
  if (!tokenizer.inRCDATA) {
14330
- el.children = condenseWhitespace(el.children, el.tag);
14340
+ el.children = condenseWhitespace(children);
14341
+ }
14342
+ if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) {
14343
+ const first = children[0];
14344
+ if (first && first.type === 2) {
14345
+ first.content = first.content.replace(/^\r?\n/, "");
14346
+ }
14331
14347
  }
14332
14348
  if (ns === 0 && currentOptions.isPreTag(tag)) {
14333
14349
  inPre--;
@@ -14408,12 +14424,6 @@ function condenseWhitespace(nodes, tag) {
14408
14424
  }
14409
14425
  }
14410
14426
  }
14411
- if (inPre && tag && currentOptions.isPreTag(tag)) {
14412
- const first = nodes[0];
14413
- if (first && first.type === 2) {
14414
- first.content = first.content.replace(/^\r?\n/, "");
14415
- }
14416
- }
14417
14427
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
14418
14428
  }
14419
14429
  function isAllWhitespace(str) {
@@ -15015,10 +15025,8 @@ function createRootCodegen(root, context) {
15015
15025
  }
15016
15026
  } else if (children.length > 1) {
15017
15027
  let patchFlag = 64;
15018
- let patchFlagText = PatchFlagNames[64];
15019
15028
  if (children.filter((c) => c.type !== 3).length === 1) {
15020
15029
  patchFlag |= 2048;
15021
- patchFlagText += `, ${PatchFlagNames[2048]}`;
15022
15030
  }
15023
15031
  root.codegenNode = createVNodeCall(
15024
15032
  context,
@@ -15918,10 +15926,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
15918
15926
  return vnodeCall;
15919
15927
  } else {
15920
15928
  let patchFlag = 64;
15921
- let patchFlagText = PatchFlagNames[64];
15922
15929
  if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
15923
15930
  patchFlag |= 2048;
15924
- patchFlagText += `, ${PatchFlagNames[2048]}`;
15925
15931
  }
15926
15932
  return createVNodeCall(
15927
15933
  context,
@@ -17478,6 +17484,7 @@ const parserOptions = {
17478
17484
  isVoidTag,
17479
17485
  isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
17480
17486
  isPreTag: (tag) => tag === "pre",
17487
+ isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
17481
17488
  decodeEntities: decodeHtmlBrowser ,
17482
17489
  isBuiltInComponent: (tag) => {
17483
17490
  if (tag === "Transition" || tag === "transition") {
@@ -17705,10 +17712,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
17705
17712
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
17706
17713
  );
17707
17714
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
17708
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
17709
- `onkeyup,onkeydown,onkeypress`,
17710
- true
17711
- );
17715
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
17712
17716
  const resolveModifiers = (key, modifiers, context, loc) => {
17713
17717
  const keyModifiers = [];
17714
17718
  const nonKeyModifiers = [];
@@ -17720,7 +17724,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
17720
17724
  } else {
17721
17725
  if (maybeKeyModifier(modifier)) {
17722
17726
  if (isStaticExp(key)) {
17723
- if (isKeyboardEvent(key.content)) {
17727
+ if (isKeyboardEvent(key.content.toLowerCase())) {
17724
17728
  keyModifiers.push(modifier);
17725
17729
  } else {
17726
17730
  nonKeyModifiers.push(modifier);
@@ -17773,7 +17777,7 @@ const transformOn = (dir, node, context) => {
17773
17777
  ]);
17774
17778
  }
17775
17779
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
17776
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
17780
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
17777
17781
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
17778
17782
  handlerExp,
17779
17783
  JSON.stringify(keyModifiers)