@vue/compat 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/compat v3.5.40
2
+ * @vue/compat v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -278,7 +278,7 @@ const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
278
278
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
279
279
  const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
280
280
  const isBooleanAttr = /* @__PURE__ */ makeMap(
281
- specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
281
+ specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
282
282
  );
283
283
  function includeBooleanAttr(value) {
284
284
  return !!value || value === "";
@@ -2723,7 +2723,9 @@ function queuePostFlushCb(cb) {
2723
2723
  cb.flags |= 1;
2724
2724
  }
2725
2725
  } else {
2726
- pendingPostFlushCbs.push(...cb);
2726
+ for (let i = 0; i < cb.length; i++) {
2727
+ pendingPostFlushCbs.push(cb[i]);
2728
+ }
2727
2729
  }
2728
2730
  queueFlush();
2729
2731
  }
@@ -2759,7 +2761,9 @@ function flushPostFlushCbs(seen) {
2759
2761
  );
2760
2762
  pendingPostFlushCbs.length = 0;
2761
2763
  if (activePostFlushCbs) {
2762
- activePostFlushCbs.push(...deduped);
2764
+ for (let i = 0; i < deduped.length; i++) {
2765
+ activePostFlushCbs.push(deduped[i]);
2766
+ }
2763
2767
  return;
2764
2768
  }
2765
2769
  activePostFlushCbs = deduped;
@@ -4520,7 +4524,11 @@ function getInnerChild$1(vnode) {
4520
4524
  function setTransitionHooks(vnode, hooks) {
4521
4525
  if (vnode.shapeFlag & 6 && vnode.component) {
4522
4526
  vnode.transition = hooks;
4523
- setTransitionHooks(vnode.component.subTree, hooks);
4527
+ const subTree = vnode.component.subTree;
4528
+ setTransitionHooks(
4529
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4530
+ hooks
4531
+ );
4524
4532
  } else if (vnode.shapeFlag & 128) {
4525
4533
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4526
4534
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -5060,6 +5068,9 @@ Server rendered element contains more child nodes than client vdom.`
5060
5068
  }
5061
5069
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5062
5070
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5071
+ if (isUnchangedResourceProp(el, key, props[key])) {
5072
+ continue;
5073
+ }
5063
5074
  patchProp(el, key, null, props[key], namespace, parentComponent);
5064
5075
  }
5065
5076
  }
@@ -5242,6 +5253,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5242
5253
  };
5243
5254
  return [hydrate, hydrateNode];
5244
5255
  }
5256
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5257
+ function isUnchangedResourceProp(el, key, clientValue) {
5258
+ if (!resourceProps.has(key)) {
5259
+ return false;
5260
+ }
5261
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5262
+ }
5245
5263
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5246
5264
  let mismatchType;
5247
5265
  let mismatchKey;
@@ -5279,7 +5297,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5279
5297
  mismatchKey = "style";
5280
5298
  }
5281
5299
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5282
- if (isBooleanAttr(key)) {
5300
+ if (key === "hidden") {
5301
+ actual = normalizeHiddenValue(el.getAttribute(key));
5302
+ expected = normalizeHiddenValue(clientValue);
5303
+ } else if (isBooleanAttr(key)) {
5283
5304
  actual = el.hasAttribute(key);
5284
5305
  expected = includeBooleanAttr(clientValue);
5285
5306
  } else if (clientValue == null) {
@@ -5315,6 +5336,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5315
5336
  }
5316
5337
  return false;
5317
5338
  }
5339
+ function normalizeHiddenValue(value) {
5340
+ if (!isRenderableAttrValue(value)) {
5341
+ return false;
5342
+ }
5343
+ if (isString(value)) {
5344
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5345
+ }
5346
+ return includeBooleanAttr(value) ? "" : false;
5347
+ }
5318
5348
  function toClassSet(str) {
5319
5349
  return new Set(str.trim().split(/\s+/));
5320
5350
  }
@@ -6422,7 +6452,8 @@ function createSlots(slots, dynamicSlots) {
6422
6452
  return slots;
6423
6453
  }
6424
6454
 
6425
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
6455
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6456
+ if (props == null) props = {};
6426
6457
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6427
6458
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6428
6459
  const hasProps = Object.keys(slotProps).length > 0;
@@ -7649,7 +7680,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7649
7680
  return vm;
7650
7681
  }
7651
7682
  }
7652
- Vue.version = `2.6.14-compat:${"3.5.40"}`;
7683
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7653
7684
  Vue.config = singletonApp.config;
7654
7685
  Vue.use = (plugin, ...options) => {
7655
7686
  if (plugin && isFunction(plugin.install)) {
@@ -8671,12 +8702,13 @@ function renderComponentRoot(instance) {
8671
8702
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8672
8703
  }
8673
8704
  if (vnode.transition) {
8674
- if (!isElementRoot(root)) {
8705
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8706
+ if (!isElementRoot(child)) {
8675
8707
  warn$1(
8676
8708
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8677
8709
  );
8678
8710
  }
8679
- setTransitionHooks(root, vnode.transition);
8711
+ setTransitionHooks(child, vnode.transition);
8680
8712
  }
8681
8713
  if (setRoot) {
8682
8714
  setRoot(root);
@@ -11430,7 +11462,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11430
11462
  let hasUnresolvedAncestor = false;
11431
11463
  while (parent) {
11432
11464
  if (parent.pendingBranch) {
11433
- parent.effects.push(...effects);
11465
+ for (let i = 0; i < effects.length; i++) {
11466
+ parent.effects.push(effects[i]);
11467
+ }
11434
11468
  hasUnresolvedAncestor = true;
11435
11469
  break;
11436
11470
  }
@@ -11852,6 +11886,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11852
11886
  if (vnode.key !== vnode.key) {
11853
11887
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11854
11888
  }
11889
+ if (props && vnode.shapeFlag & 1) {
11890
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11891
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11892
+ warn$1(
11893
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11894
+ );
11895
+ }
11896
+ }
11855
11897
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11856
11898
  !isBlockNode && // has current parent block
11857
11899
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11869,6 +11911,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11869
11911
  }
11870
11912
  return vnode;
11871
11913
  }
11914
+ function hasContentChildren(children) {
11915
+ if (isString(children)) return children !== "";
11916
+ if (isArray(children)) return children.length > 0;
11917
+ return false;
11918
+ }
11872
11919
  const createVNode = createVNodeWithArgsTransform ;
11873
11920
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11874
11921
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12323,7 +12370,12 @@ function setupStatefulComponent(instance, isSSR) {
12323
12370
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12324
12371
  if (isSSR) {
12325
12372
  return setupResult.then((resolvedResult) => {
12326
- handleSetupResult(instance, resolvedResult, isSSR);
12373
+ setInSSRSetupState(true);
12374
+ try {
12375
+ handleSetupResult(instance, resolvedResult, isSSR);
12376
+ } finally {
12377
+ setInSSRSetupState(false);
12378
+ }
12327
12379
  }).catch((e) => {
12328
12380
  handleError(e, instance, 0);
12329
12381
  });
@@ -12801,7 +12853,7 @@ function isMemoSame(cached, memo) {
12801
12853
  return true;
12802
12854
  }
12803
12855
 
12804
- const version = "3.5.40";
12856
+ const version = "3.5.41";
12805
12857
  const warn = warn$1 ;
12806
12858
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12807
12859
  const devtools = devtools$1 ;
@@ -13791,7 +13843,9 @@ class VueElement extends BaseClass {
13791
13843
  if (parent && parent._pendingResolve) {
13792
13844
  this._pendingResolve = parent._pendingResolve.then(() => {
13793
13845
  this._pendingResolve = void 0;
13794
- this._resolveDef();
13846
+ if (this.isConnected) {
13847
+ return this._resolveDef();
13848
+ }
13795
13849
  });
13796
13850
  } else {
13797
13851
  this._resolveDef();
@@ -13841,7 +13895,7 @@ class VueElement extends BaseClass {
13841
13895
  */
13842
13896
  _resolveDef() {
13843
13897
  if (this._pendingResolve) {
13844
- return;
13898
+ return this._pendingResolve;
13845
13899
  }
13846
13900
  for (let i = 0; i < this.attributes.length; i++) {
13847
13901
  this._setAttr(this.attributes[i].name);
@@ -13881,6 +13935,7 @@ class VueElement extends BaseClass {
13881
13935
  def.configureApp = this._def.configureApp;
13882
13936
  resolve(this._def = def, true);
13883
13937
  });
13938
+ return this._pendingResolve;
13884
13939
  } else {
13885
13940
  resolve(this._def);
13886
13941
  }
@@ -13918,6 +13973,11 @@ class VueElement extends BaseClass {
13918
13973
  }
13919
13974
  }
13920
13975
  for (const key of declaredPropKeys.map(camelize)) {
13976
+ if (key in Object.getPrototypeOf(this)) {
13977
+ warn(
13978
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
13979
+ );
13980
+ }
13921
13981
  Object.defineProperty(this, key, {
13922
13982
  get() {
13923
13983
  return this._getProp(key);
@@ -14411,6 +14471,7 @@ function onCompositionEnd(e) {
14411
14471
  }
14412
14472
  }
14413
14473
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14474
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14414
14475
  function castValue(value, trim, number) {
14415
14476
  if (trim) value = value.trim();
14416
14477
  if (number) value = looseToNumber(value);
@@ -14418,6 +14479,13 @@ function castValue(value, trim, number) {
14418
14479
  }
14419
14480
  const vModelText = {
14420
14481
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14482
+ if (el.parentNode) {
14483
+ if (el.type === "text") {
14484
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14485
+ } else if (el.type === "textarea") {
14486
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14487
+ }
14488
+ }
14421
14489
  el[assignKey] = getModelAssigner(vnode);
14422
14490
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14423
14491
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14436,8 +14504,15 @@ const vModelText = {
14436
14504
  }
14437
14505
  },
14438
14506
  // set value on mounted so it's after min/max for type="range"
14439
- mounted(el, { value }) {
14440
- el.value = value == null ? "" : value;
14507
+ mounted(el, { value, modifiers: { trim, number } }) {
14508
+ const newValue = value == null ? "" : value;
14509
+ const initialValue = el[initialValueKey];
14510
+ delete el[initialValueKey];
14511
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14512
+ el[assignKey](castValue(el.value, trim, number));
14513
+ } else {
14514
+ el.value = newValue;
14515
+ }
14441
14516
  },
14442
14517
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14443
14518
  el[assignKey] = getModelAssigner(vnode);
@@ -19726,6 +19801,7 @@ const transformFor = createStructuralDirectiveTransform(
19726
19801
  node.loc
19727
19802
  );
19728
19803
  return () => {
19804
+ var _a;
19729
19805
  let childBlock;
19730
19806
  const { children } = forNode;
19731
19807
  if (isTemplate) {
@@ -19769,7 +19845,8 @@ const transformFor = createStructuralDirectiveTransform(
19769
19845
  if (isTemplate && keyProperty) {
19770
19846
  injectProp(childBlock, keyProperty, context);
19771
19847
  }
19772
- if (childBlock.isBlock !== !isStableFragment) {
19848
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
19849
+ if (childBlock.isBlock !== shouldUseBlock) {
19773
19850
  if (childBlock.isBlock) {
19774
19851
  removeHelper(OPEN_BLOCK);
19775
19852
  removeHelper(
@@ -19781,12 +19858,15 @@ const transformFor = createStructuralDirectiveTransform(
19781
19858
  );
19782
19859
  }
19783
19860
  }
19784
- childBlock.isBlock = !isStableFragment;
19861
+ childBlock.isBlock = shouldUseBlock;
19785
19862
  if (childBlock.isBlock) {
19786
19863
  helper(OPEN_BLOCK);
19787
19864
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
19788
19865
  } else {
19789
19866
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
19867
+ if (childBlock.needsPatch) {
19868
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
19869
+ }
19790
19870
  }
19791
19871
  }
19792
19872
  if (memo) {
@@ -20208,6 +20288,8 @@ const transformElement = (node, context) => {
20208
20288
  let vnodeDynamicProps;
20209
20289
  let dynamicPropNames;
20210
20290
  let vnodeDirectives;
20291
+ let needsPatch = false;
20292
+ let isBlockRequired = false;
20211
20293
  let shouldUseBlock = (
20212
20294
  // dynamic component may resolve to plain elements
20213
20295
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -20227,6 +20309,8 @@ const transformElement = (node, context) => {
20227
20309
  vnodeProps = propsBuildResult.props;
20228
20310
  patchFlag = propsBuildResult.patchFlag;
20229
20311
  dynamicPropNames = propsBuildResult.dynamicPropNames;
20312
+ needsPatch = propsBuildResult.needsPatch;
20313
+ isBlockRequired = propsBuildResult.isBlockRequired;
20230
20314
  const directives = propsBuildResult.directives;
20231
20315
  vnodeDirectives = directives && directives.length ? createArrayExpression(
20232
20316
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -20277,7 +20361,7 @@ const transformElement = (node, context) => {
20277
20361
  if (dynamicPropNames && dynamicPropNames.length) {
20278
20362
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
20279
20363
  }
20280
- node.codegenNode = createVNodeCall(
20364
+ const vnodeCall = node.codegenNode = createVNodeCall(
20281
20365
  context,
20282
20366
  vnodeTag,
20283
20367
  vnodeProps,
@@ -20290,6 +20374,13 @@ const transformElement = (node, context) => {
20290
20374
  isComponent,
20291
20375
  node.loc
20292
20376
  );
20377
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
20378
+ if (needsPatch) {
20379
+ vnodeCall.needsPatch = true;
20380
+ }
20381
+ if (isBlockRequired) {
20382
+ vnodeCall.isBlockRequired = true;
20383
+ }
20293
20384
  };
20294
20385
  };
20295
20386
  function resolveComponentType(node, context, ssr = false) {
@@ -20399,6 +20490,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20399
20490
  const runtimeDirectives = [];
20400
20491
  const hasChildren = children.length > 0;
20401
20492
  let shouldUseBlock = false;
20493
+ let isBlockRequired = false;
20402
20494
  let patchFlag = 0;
20403
20495
  let hasRef = false;
20404
20496
  let hasClassBinding = false;
@@ -20440,19 +20532,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20440
20532
  if (isEventHandler && isReservedProp(name)) {
20441
20533
  hasVnodeHook = true;
20442
20534
  }
20535
+ if (name === "ref") {
20536
+ hasRef = true;
20537
+ }
20443
20538
  if (isEventHandler && value.type === 14) {
20444
20539
  value = value.arguments[0];
20445
20540
  }
20446
20541
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
20447
20542
  return;
20448
20543
  }
20449
- if (name === "ref") {
20450
- hasRef = true;
20451
- } else if (name === "class") {
20544
+ if (name === "class") {
20452
20545
  hasClassBinding = true;
20453
20546
  } else if (name === "style") {
20454
20547
  hasStyleBinding = true;
20455
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
20548
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
20456
20549
  dynamicPropNames.push(name);
20457
20550
  }
20458
20551
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -20523,13 +20616,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20523
20616
  if (isVOn && ssr) {
20524
20617
  continue;
20525
20618
  }
20526
- if (
20527
- // #938: elements with dynamic keys should be forced into blocks
20528
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
20529
- // before children
20530
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
20531
- ) {
20619
+ if (isVBind && isStaticArgOf(arg, "key")) {
20620
+ shouldUseBlock = true;
20621
+ }
20622
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
20532
20623
  shouldUseBlock = true;
20624
+ isBlockRequired = true;
20533
20625
  }
20534
20626
  if (isVBind && isStaticArgOf(arg, "ref")) {
20535
20627
  pushRefVForMarker();
@@ -20612,6 +20704,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20612
20704
  runtimeDirectives.push(prop);
20613
20705
  if (hasChildren) {
20614
20706
  shouldUseBlock = true;
20707
+ isBlockRequired = true;
20615
20708
  }
20616
20709
  }
20617
20710
  }
@@ -20650,7 +20743,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20650
20743
  patchFlag |= 32;
20651
20744
  }
20652
20745
  }
20653
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
20746
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
20747
+ if (!shouldUseBlock && needsPatch) {
20654
20748
  patchFlag |= 512;
20655
20749
  }
20656
20750
  if (!context.inSSR && propsExpression) {
@@ -20716,7 +20810,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
20716
20810
  directives: runtimeDirectives,
20717
20811
  patchFlag,
20718
20812
  dynamicPropNames,
20719
- shouldUseBlock
20813
+ shouldUseBlock,
20814
+ needsPatch,
20815
+ isBlockRequired
20720
20816
  };
20721
20817
  }
20722
20818
  function dedupeProperties(properties) {
@@ -22095,12 +22191,15 @@ function stringifyElement(node, context) {
22095
22191
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
22096
22192
  continue;
22097
22193
  }
22098
- if (isBooleanAttr(p.arg.content) && exp.content === "false") {
22194
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
22099
22195
  continue;
22100
22196
  }
22101
22197
  let evaluated = evaluateConstant(exp);
22102
22198
  if (evaluated != null) {
22103
22199
  const arg = p.arg && p.arg.content;
22200
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) {
22201
+ continue;
22202
+ }
22104
22203
  if (arg === "class") {
22105
22204
  evaluated = normalizeClass(evaluated);
22106
22205
  } else if (arg === "style") {