vue 3.5.40 → 3.5.41

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.40
2
+ * vue v3.5.41
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.40
2
+ * vue v3.5.41
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.40
2
+ * vue v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -267,7 +267,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
267
267
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
268
268
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
269
269
  const isBooleanAttr = /* @__PURE__ */ makeMap(
270
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
270
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
271
271
  );
272
272
  function includeBooleanAttr(value) {
273
273
  return !!value || value === "";
@@ -2670,7 +2670,9 @@ function queuePostFlushCb(cb) {
2670
2670
  cb.flags |= 1;
2671
2671
  }
2672
2672
  } else {
2673
- pendingPostFlushCbs.push(...cb);
2673
+ for (let i = 0; i < cb.length; i++) {
2674
+ pendingPostFlushCbs.push(cb[i]);
2675
+ }
2674
2676
  }
2675
2677
  queueFlush();
2676
2678
  }
@@ -2706,7 +2708,9 @@ function flushPostFlushCbs(seen) {
2706
2708
  );
2707
2709
  pendingPostFlushCbs.length = 0;
2708
2710
  if (activePostFlushCbs) {
2709
- activePostFlushCbs.push(...deduped);
2711
+ for (let i = 0; i < deduped.length; i++) {
2712
+ activePostFlushCbs.push(deduped[i]);
2713
+ }
2710
2714
  return;
2711
2715
  }
2712
2716
  activePostFlushCbs = deduped;
@@ -3995,7 +3999,11 @@ function getInnerChild$1(vnode) {
3995
3999
  function setTransitionHooks(vnode, hooks) {
3996
4000
  if (vnode.shapeFlag & 6 && vnode.component) {
3997
4001
  vnode.transition = hooks;
3998
- setTransitionHooks(vnode.component.subTree, hooks);
4002
+ const subTree = vnode.component.subTree;
4003
+ setTransitionHooks(
4004
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4005
+ hooks
4006
+ );
3999
4007
  } else if (vnode.shapeFlag & 128) {
4000
4008
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4001
4009
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4535,6 +4543,9 @@ Server rendered element contains more child nodes than client vdom.`
4535
4543
  }
4536
4544
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4537
4545
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
4546
+ if (isUnchangedResourceProp(el, key, props[key])) {
4547
+ continue;
4548
+ }
4538
4549
  patchProp(el, key, null, props[key], namespace, parentComponent);
4539
4550
  }
4540
4551
  }
@@ -4717,6 +4728,13 @@ Server rendered element contains fewer child nodes than client vdom.`
4717
4728
  };
4718
4729
  return [hydrate, hydrateNode];
4719
4730
  }
4731
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
4732
+ function isUnchangedResourceProp(el, key, clientValue) {
4733
+ if (!resourceProps.has(key)) {
4734
+ return false;
4735
+ }
4736
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
4737
+ }
4720
4738
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4721
4739
  let mismatchType;
4722
4740
  let mismatchKey;
@@ -4754,7 +4772,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4754
4772
  mismatchKey = "style";
4755
4773
  }
4756
4774
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4757
- if (isBooleanAttr(key)) {
4775
+ if (key === "hidden") {
4776
+ actual = normalizeHiddenValue(el.getAttribute(key));
4777
+ expected = normalizeHiddenValue(clientValue);
4778
+ } else if (isBooleanAttr(key)) {
4758
4779
  actual = el.hasAttribute(key);
4759
4780
  expected = includeBooleanAttr(clientValue);
4760
4781
  } else if (clientValue == null) {
@@ -4790,6 +4811,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4790
4811
  }
4791
4812
  return false;
4792
4813
  }
4814
+ function normalizeHiddenValue(value) {
4815
+ if (!isRenderableAttrValue(value)) {
4816
+ return false;
4817
+ }
4818
+ if (isString(value)) {
4819
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
4820
+ }
4821
+ return includeBooleanAttr(value) ? "" : false;
4822
+ }
4793
4823
  function toClassSet(str) {
4794
4824
  return new Set(str.trim().split(/\s+/));
4795
4825
  }
@@ -5609,7 +5639,8 @@ function createSlots(slots, dynamicSlots) {
5609
5639
  return slots;
5610
5640
  }
5611
5641
 
5612
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
5642
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
5643
+ if (props == null) props = {};
5613
5644
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5614
5645
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
5615
5646
  const hasProps = Object.keys(slotProps).length > 0;
@@ -7033,12 +7064,13 @@ function renderComponentRoot(instance) {
7033
7064
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
7034
7065
  }
7035
7066
  if (vnode.transition) {
7036
- if (!isElementRoot(root)) {
7067
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
7068
+ if (!isElementRoot(child)) {
7037
7069
  warn$1(
7038
7070
  `Component inside <Transition> renders non-element root node that cannot be animated.`
7039
7071
  );
7040
7072
  }
7041
- setTransitionHooks(root, vnode.transition);
7073
+ setTransitionHooks(child, vnode.transition);
7042
7074
  }
7043
7075
  if (setRoot) {
7044
7076
  setRoot(root);
@@ -9686,7 +9718,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9686
9718
  let hasUnresolvedAncestor = false;
9687
9719
  while (parent) {
9688
9720
  if (parent.pendingBranch) {
9689
- parent.effects.push(...effects);
9721
+ for (let i = 0; i < effects.length; i++) {
9722
+ parent.effects.push(effects[i]);
9723
+ }
9690
9724
  hasUnresolvedAncestor = true;
9691
9725
  break;
9692
9726
  }
@@ -10051,6 +10085,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10051
10085
  if (vnode.key !== vnode.key) {
10052
10086
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
10053
10087
  }
10088
+ if (props && vnode.shapeFlag & 1) {
10089
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
10090
+ if (overwritingProp && hasContentChildren(vnode.children)) {
10091
+ warn$1(
10092
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
10093
+ );
10094
+ }
10095
+ }
10054
10096
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
10055
10097
  !isBlockNode && // has current parent block
10056
10098
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -10064,6 +10106,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10064
10106
  }
10065
10107
  return vnode;
10066
10108
  }
10109
+ function hasContentChildren(children) {
10110
+ if (isString(children)) return children !== "";
10111
+ if (isArray(children)) return children.length > 0;
10112
+ return false;
10113
+ }
10067
10114
  const createVNode = createVNodeWithArgsTransform ;
10068
10115
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
10069
10116
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -10512,7 +10559,12 @@ function setupStatefulComponent(instance, isSSR) {
10512
10559
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10513
10560
  if (isSSR) {
10514
10561
  return setupResult.then((resolvedResult) => {
10515
- handleSetupResult(instance, resolvedResult, isSSR);
10562
+ setInSSRSetupState(true);
10563
+ try {
10564
+ handleSetupResult(instance, resolvedResult, isSSR);
10565
+ } finally {
10566
+ setInSSRSetupState(false);
10567
+ }
10516
10568
  }).catch((e) => {
10517
10569
  handleError(e, instance, 0);
10518
10570
  });
@@ -10978,7 +11030,7 @@ function isMemoSame(cached, memo) {
10978
11030
  return true;
10979
11031
  }
10980
11032
 
10981
- const version = "3.5.40";
11033
+ const version = "3.5.41";
10982
11034
  const warn = warn$1 ;
10983
11035
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10984
11036
  const devtools = devtools$1 ;
@@ -11948,7 +12000,9 @@ class VueElement extends BaseClass {
11948
12000
  if (parent && parent._pendingResolve) {
11949
12001
  this._pendingResolve = parent._pendingResolve.then(() => {
11950
12002
  this._pendingResolve = void 0;
11951
- this._resolveDef();
12003
+ if (this.isConnected) {
12004
+ return this._resolveDef();
12005
+ }
11952
12006
  });
11953
12007
  } else {
11954
12008
  this._resolveDef();
@@ -11998,7 +12052,7 @@ class VueElement extends BaseClass {
11998
12052
  */
11999
12053
  _resolveDef() {
12000
12054
  if (this._pendingResolve) {
12001
- return;
12055
+ return this._pendingResolve;
12002
12056
  }
12003
12057
  for (let i = 0; i < this.attributes.length; i++) {
12004
12058
  this._setAttr(this.attributes[i].name);
@@ -12038,6 +12092,7 @@ class VueElement extends BaseClass {
12038
12092
  def.configureApp = this._def.configureApp;
12039
12093
  resolve(this._def = def, true);
12040
12094
  });
12095
+ return this._pendingResolve;
12041
12096
  } else {
12042
12097
  resolve(this._def);
12043
12098
  }
@@ -12075,6 +12130,11 @@ class VueElement extends BaseClass {
12075
12130
  }
12076
12131
  }
12077
12132
  for (const key of declaredPropKeys.map(camelize)) {
12133
+ if (key in Object.getPrototypeOf(this)) {
12134
+ warn(
12135
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
12136
+ );
12137
+ }
12078
12138
  Object.defineProperty(this, key, {
12079
12139
  get() {
12080
12140
  return this._getProp(key);
@@ -12559,6 +12619,7 @@ function onCompositionEnd(e) {
12559
12619
  }
12560
12620
  }
12561
12621
  const assignKey = /* @__PURE__ */ Symbol("_assign");
12622
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
12562
12623
  function castValue(value, trim, number) {
12563
12624
  if (trim) value = value.trim();
12564
12625
  if (number) value = looseToNumber(value);
@@ -12566,6 +12627,13 @@ function castValue(value, trim, number) {
12566
12627
  }
12567
12628
  const vModelText = {
12568
12629
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12630
+ if (el.parentNode) {
12631
+ if (el.type === "text") {
12632
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
12633
+ } else if (el.type === "textarea") {
12634
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
12635
+ }
12636
+ }
12569
12637
  el[assignKey] = getModelAssigner(vnode);
12570
12638
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12571
12639
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -12584,8 +12652,15 @@ const vModelText = {
12584
12652
  }
12585
12653
  },
12586
12654
  // set value on mounted so it's after min/max for type="range"
12587
- mounted(el, { value }) {
12588
- el.value = value == null ? "" : value;
12655
+ mounted(el, { value, modifiers: { trim, number } }) {
12656
+ const newValue = value == null ? "" : value;
12657
+ const initialValue = el[initialValueKey];
12658
+ delete el[initialValueKey];
12659
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
12660
+ el[assignKey](castValue(el.value, trim, number));
12661
+ } else {
12662
+ el.value = newValue;
12663
+ }
12589
12664
  },
12590
12665
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
12591
12666
  el[assignKey] = getModelAssigner(vnode);
@@ -16753,6 +16828,7 @@ const transformFor = createStructuralDirectiveTransform(
16753
16828
  node.loc
16754
16829
  );
16755
16830
  return () => {
16831
+ var _a;
16756
16832
  let childBlock;
16757
16833
  const { children } = forNode;
16758
16834
  if (isTemplate) {
@@ -16796,7 +16872,8 @@ const transformFor = createStructuralDirectiveTransform(
16796
16872
  if (isTemplate && keyProperty) {
16797
16873
  injectProp(childBlock, keyProperty, context);
16798
16874
  }
16799
- if (childBlock.isBlock !== !isStableFragment) {
16875
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
16876
+ if (childBlock.isBlock !== shouldUseBlock) {
16800
16877
  if (childBlock.isBlock) {
16801
16878
  removeHelper(OPEN_BLOCK);
16802
16879
  removeHelper(
@@ -16808,12 +16885,15 @@ const transformFor = createStructuralDirectiveTransform(
16808
16885
  );
16809
16886
  }
16810
16887
  }
16811
- childBlock.isBlock = !isStableFragment;
16888
+ childBlock.isBlock = shouldUseBlock;
16812
16889
  if (childBlock.isBlock) {
16813
16890
  helper(OPEN_BLOCK);
16814
16891
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
16815
16892
  } else {
16816
16893
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
16894
+ if (childBlock.needsPatch) {
16895
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
16896
+ }
16817
16897
  }
16818
16898
  }
16819
16899
  if (memo) {
@@ -17189,6 +17269,8 @@ const transformElement = (node, context) => {
17189
17269
  let vnodeDynamicProps;
17190
17270
  let dynamicPropNames;
17191
17271
  let vnodeDirectives;
17272
+ let needsPatch = false;
17273
+ let isBlockRequired = false;
17192
17274
  let shouldUseBlock = (
17193
17275
  // dynamic component may resolve to plain elements
17194
17276
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -17208,6 +17290,8 @@ const transformElement = (node, context) => {
17208
17290
  vnodeProps = propsBuildResult.props;
17209
17291
  patchFlag = propsBuildResult.patchFlag;
17210
17292
  dynamicPropNames = propsBuildResult.dynamicPropNames;
17293
+ needsPatch = propsBuildResult.needsPatch;
17294
+ isBlockRequired = propsBuildResult.isBlockRequired;
17211
17295
  const directives = propsBuildResult.directives;
17212
17296
  vnodeDirectives = directives && directives.length ? createArrayExpression(
17213
17297
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -17258,7 +17342,7 @@ const transformElement = (node, context) => {
17258
17342
  if (dynamicPropNames && dynamicPropNames.length) {
17259
17343
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
17260
17344
  }
17261
- node.codegenNode = createVNodeCall(
17345
+ const vnodeCall = node.codegenNode = createVNodeCall(
17262
17346
  context,
17263
17347
  vnodeTag,
17264
17348
  vnodeProps,
@@ -17271,6 +17355,13 @@ const transformElement = (node, context) => {
17271
17355
  isComponent,
17272
17356
  node.loc
17273
17357
  );
17358
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
17359
+ if (needsPatch) {
17360
+ vnodeCall.needsPatch = true;
17361
+ }
17362
+ if (isBlockRequired) {
17363
+ vnodeCall.isBlockRequired = true;
17364
+ }
17274
17365
  };
17275
17366
  };
17276
17367
  function resolveComponentType(node, context, ssr = false) {
@@ -17319,6 +17410,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17319
17410
  const runtimeDirectives = [];
17320
17411
  const hasChildren = children.length > 0;
17321
17412
  let shouldUseBlock = false;
17413
+ let isBlockRequired = false;
17322
17414
  let patchFlag = 0;
17323
17415
  let hasRef = false;
17324
17416
  let hasClassBinding = false;
@@ -17360,19 +17452,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17360
17452
  if (isEventHandler && isReservedProp(name)) {
17361
17453
  hasVnodeHook = true;
17362
17454
  }
17455
+ if (name === "ref") {
17456
+ hasRef = true;
17457
+ }
17363
17458
  if (isEventHandler && value.type === 14) {
17364
17459
  value = value.arguments[0];
17365
17460
  }
17366
17461
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
17367
17462
  return;
17368
17463
  }
17369
- if (name === "ref") {
17370
- hasRef = true;
17371
- } else if (name === "class") {
17464
+ if (name === "class") {
17372
17465
  hasClassBinding = true;
17373
17466
  } else if (name === "style") {
17374
17467
  hasStyleBinding = true;
17375
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
17468
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
17376
17469
  dynamicPropNames.push(name);
17377
17470
  }
17378
17471
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -17425,13 +17518,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17425
17518
  if (isVOn && ssr) {
17426
17519
  continue;
17427
17520
  }
17428
- if (
17429
- // #938: elements with dynamic keys should be forced into blocks
17430
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
17431
- // before children
17432
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
17433
- ) {
17521
+ if (isVBind && isStaticArgOf(arg, "key")) {
17522
+ shouldUseBlock = true;
17523
+ }
17524
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
17434
17525
  shouldUseBlock = true;
17526
+ isBlockRequired = true;
17435
17527
  }
17436
17528
  if (isVBind && isStaticArgOf(arg, "ref")) {
17437
17529
  pushRefVForMarker();
@@ -17483,6 +17575,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17483
17575
  runtimeDirectives.push(prop);
17484
17576
  if (hasChildren) {
17485
17577
  shouldUseBlock = true;
17578
+ isBlockRequired = true;
17486
17579
  }
17487
17580
  }
17488
17581
  }
@@ -17521,7 +17614,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17521
17614
  patchFlag |= 32;
17522
17615
  }
17523
17616
  }
17524
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
17617
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
17618
+ if (!shouldUseBlock && needsPatch) {
17525
17619
  patchFlag |= 512;
17526
17620
  }
17527
17621
  if (!context.inSSR && propsExpression) {
@@ -17587,7 +17681,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17587
17681
  directives: runtimeDirectives,
17588
17682
  patchFlag,
17589
17683
  dynamicPropNames,
17590
- shouldUseBlock
17684
+ shouldUseBlock,
17685
+ needsPatch,
17686
+ isBlockRequired
17591
17687
  };
17592
17688
  }
17593
17689
  function dedupeProperties(properties) {