@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.
@@ -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
  **/
@@ -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 === "";
@@ -2685,7 +2685,9 @@ function queuePostFlushCb(cb) {
2685
2685
  cb.flags |= 1;
2686
2686
  }
2687
2687
  } else {
2688
- pendingPostFlushCbs.push(...cb);
2688
+ for (let i = 0; i < cb.length; i++) {
2689
+ pendingPostFlushCbs.push(cb[i]);
2690
+ }
2689
2691
  }
2690
2692
  queueFlush();
2691
2693
  }
@@ -2721,7 +2723,9 @@ function flushPostFlushCbs(seen) {
2721
2723
  );
2722
2724
  pendingPostFlushCbs.length = 0;
2723
2725
  if (activePostFlushCbs) {
2724
- activePostFlushCbs.push(...deduped);
2726
+ for (let i = 0; i < deduped.length; i++) {
2727
+ activePostFlushCbs.push(deduped[i]);
2728
+ }
2725
2729
  return;
2726
2730
  }
2727
2731
  activePostFlushCbs = deduped;
@@ -4486,7 +4490,11 @@ function getInnerChild$1(vnode) {
4486
4490
  function setTransitionHooks(vnode, hooks) {
4487
4491
  if (vnode.shapeFlag & 6 && vnode.component) {
4488
4492
  vnode.transition = hooks;
4489
- setTransitionHooks(vnode.component.subTree, hooks);
4493
+ const subTree = vnode.component.subTree;
4494
+ setTransitionHooks(
4495
+ isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
4496
+ hooks
4497
+ );
4490
4498
  } else if (vnode.shapeFlag & 128) {
4491
4499
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4492
4500
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -5027,6 +5035,9 @@ Server rendered element contains more child nodes than client vdom.`
5027
5035
  }
5028
5036
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5029
5037
  key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
5038
+ if (isUnchangedResourceProp(el, key, props[key])) {
5039
+ continue;
5040
+ }
5030
5041
  patchProp(el, key, null, props[key], namespace, parentComponent);
5031
5042
  }
5032
5043
  }
@@ -5220,6 +5231,13 @@ Server rendered element contains fewer child nodes than client vdom.`
5220
5231
  };
5221
5232
  return [hydrate, hydrateNode];
5222
5233
  }
5234
+ const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
5235
+ function isUnchangedResourceProp(el, key, clientValue) {
5236
+ if (!resourceProps.has(key)) {
5237
+ return false;
5238
+ }
5239
+ return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
5240
+ }
5223
5241
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5224
5242
  let mismatchType;
5225
5243
  let mismatchKey;
@@ -5257,7 +5275,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5257
5275
  mismatchKey = "style";
5258
5276
  }
5259
5277
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5260
- if (isBooleanAttr(key)) {
5278
+ if (key === "hidden") {
5279
+ actual = normalizeHiddenValue(el.getAttribute(key));
5280
+ expected = normalizeHiddenValue(clientValue);
5281
+ } else if (isBooleanAttr(key)) {
5261
5282
  actual = el.hasAttribute(key);
5262
5283
  expected = includeBooleanAttr(clientValue);
5263
5284
  } else if (clientValue == null) {
@@ -5293,6 +5314,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5293
5314
  }
5294
5315
  return false;
5295
5316
  }
5317
+ function normalizeHiddenValue(value) {
5318
+ if (!isRenderableAttrValue(value)) {
5319
+ return false;
5320
+ }
5321
+ if (isString(value)) {
5322
+ return value.toLowerCase() === "until-found" ? "until-found" : "";
5323
+ }
5324
+ return includeBooleanAttr(value) ? "" : false;
5325
+ }
5296
5326
  function toClassSet(str) {
5297
5327
  return new Set(str.trim().split(/\s+/));
5298
5328
  }
@@ -6403,7 +6433,8 @@ function createSlots(slots, dynamicSlots) {
6403
6433
  return slots;
6404
6434
  }
6405
6435
 
6406
- function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
6436
+ function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
6437
+ if (props == null) props = {};
6407
6438
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6408
6439
  const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
6409
6440
  const hasProps = Object.keys(slotProps).length > 0;
@@ -7632,7 +7663,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7632
7663
  return vm;
7633
7664
  }
7634
7665
  }
7635
- Vue.version = `2.6.14-compat:${"3.5.40"}`;
7666
+ Vue.version = `2.6.14-compat:${"3.5.41"}`;
7636
7667
  Vue.config = singletonApp.config;
7637
7668
  Vue.use = (plugin, ...options) => {
7638
7669
  if (plugin && isFunction(plugin.install)) {
@@ -8656,12 +8687,13 @@ function renderComponentRoot(instance) {
8656
8687
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
8657
8688
  }
8658
8689
  if (vnode.transition) {
8659
- if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(root)) {
8690
+ const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
8691
+ if (!!(process.env.NODE_ENV !== "production") && !isElementRoot(child)) {
8660
8692
  warn$1(
8661
8693
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8662
8694
  );
8663
8695
  }
8664
- setTransitionHooks(root, vnode.transition);
8696
+ setTransitionHooks(child, vnode.transition);
8665
8697
  }
8666
8698
  if (!!(process.env.NODE_ENV !== "production") && setRoot) {
8667
8699
  setRoot(root);
@@ -11453,7 +11485,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11453
11485
  let hasUnresolvedAncestor = false;
11454
11486
  while (parent) {
11455
11487
  if (parent.pendingBranch) {
11456
- parent.effects.push(...effects);
11488
+ for (let i = 0; i < effects.length; i++) {
11489
+ parent.effects.push(effects[i]);
11490
+ }
11457
11491
  hasUnresolvedAncestor = true;
11458
11492
  break;
11459
11493
  }
@@ -11875,6 +11909,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11875
11909
  if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
11876
11910
  warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
11877
11911
  }
11912
+ if (!!(process.env.NODE_ENV !== "production") && props && vnode.shapeFlag & 1) {
11913
+ const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
11914
+ if (overwritingProp && hasContentChildren(vnode.children)) {
11915
+ warn$1(
11916
+ `The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
11917
+ );
11918
+ }
11919
+ }
11878
11920
  if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
11879
11921
  !isBlockNode && // has current parent block
11880
11922
  currentBlock && // presence of a patch flag indicates this node needs patching on updates.
@@ -11892,6 +11934,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
11892
11934
  }
11893
11935
  return vnode;
11894
11936
  }
11937
+ function hasContentChildren(children) {
11938
+ if (isString(children)) return children !== "";
11939
+ if (isArray(children)) return children.length > 0;
11940
+ return false;
11941
+ }
11895
11942
  const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
11896
11943
  function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
11897
11944
  if (!type || type === NULL_DYNAMIC_COMPONENT) {
@@ -12348,7 +12395,12 @@ function setupStatefulComponent(instance, isSSR) {
12348
12395
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
12349
12396
  if (isSSR) {
12350
12397
  return setupResult.then((resolvedResult) => {
12351
- handleSetupResult(instance, resolvedResult, isSSR);
12398
+ setInSSRSetupState(true);
12399
+ try {
12400
+ handleSetupResult(instance, resolvedResult, isSSR);
12401
+ } finally {
12402
+ setInSSRSetupState(false);
12403
+ }
12352
12404
  }).catch((e) => {
12353
12405
  handleError(e, instance, 0);
12354
12406
  });
@@ -12838,7 +12890,7 @@ function isMemoSame(cached, memo) {
12838
12890
  return true;
12839
12891
  }
12840
12892
 
12841
- const version = "3.5.40";
12893
+ const version = "3.5.41";
12842
12894
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12843
12895
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12844
12896
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13896,7 +13948,9 @@ class VueElement extends BaseClass {
13896
13948
  if (parent && parent._pendingResolve) {
13897
13949
  this._pendingResolve = parent._pendingResolve.then(() => {
13898
13950
  this._pendingResolve = void 0;
13899
- this._resolveDef();
13951
+ if (this.isConnected) {
13952
+ return this._resolveDef();
13953
+ }
13900
13954
  });
13901
13955
  } else {
13902
13956
  this._resolveDef();
@@ -13946,7 +14000,7 @@ class VueElement extends BaseClass {
13946
14000
  */
13947
14001
  _resolveDef() {
13948
14002
  if (this._pendingResolve) {
13949
- return;
14003
+ return this._pendingResolve;
13950
14004
  }
13951
14005
  for (let i = 0; i < this.attributes.length; i++) {
13952
14006
  this._setAttr(this.attributes[i].name);
@@ -13986,6 +14040,7 @@ class VueElement extends BaseClass {
13986
14040
  def.configureApp = this._def.configureApp;
13987
14041
  resolve(this._def = def, true);
13988
14042
  });
14043
+ return this._pendingResolve;
13989
14044
  } else {
13990
14045
  resolve(this._def);
13991
14046
  }
@@ -14023,6 +14078,11 @@ class VueElement extends BaseClass {
14023
14078
  }
14024
14079
  }
14025
14080
  for (const key of declaredPropKeys.map(camelize)) {
14081
+ if (!!(process.env.NODE_ENV !== "production") && key in Object.getPrototypeOf(this)) {
14082
+ warn(
14083
+ `Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
14084
+ );
14085
+ }
14026
14086
  Object.defineProperty(this, key, {
14027
14087
  get() {
14028
14088
  return this._getProp(key);
@@ -14516,6 +14576,7 @@ function onCompositionEnd(e) {
14516
14576
  }
14517
14577
  }
14518
14578
  const assignKey = /* @__PURE__ */ Symbol("_assign");
14579
+ const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
14519
14580
  function castValue(value, trim, number) {
14520
14581
  if (trim) value = value.trim();
14521
14582
  if (number) value = looseToNumber(value);
@@ -14523,6 +14584,13 @@ function castValue(value, trim, number) {
14523
14584
  }
14524
14585
  const vModelText = {
14525
14586
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
14587
+ if (el.parentNode) {
14588
+ if (el.type === "text") {
14589
+ el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
14590
+ } else if (el.type === "textarea") {
14591
+ el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
14592
+ }
14593
+ }
14526
14594
  el[assignKey] = getModelAssigner(vnode);
14527
14595
  const castToNumber = number || vnode.props && vnode.props.type === "number";
14528
14596
  addEventListener(el, lazy ? "change" : "input", (e) => {
@@ -14541,8 +14609,15 @@ const vModelText = {
14541
14609
  }
14542
14610
  },
14543
14611
  // set value on mounted so it's after min/max for type="range"
14544
- mounted(el, { value }) {
14545
- el.value = value == null ? "" : value;
14612
+ mounted(el, { value, modifiers: { trim, number } }) {
14613
+ const newValue = value == null ? "" : value;
14614
+ const initialValue = el[initialValueKey];
14615
+ delete el[initialValueKey];
14616
+ if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
14617
+ el[assignKey](castValue(el.value, trim, number));
14618
+ } else {
14619
+ el.value = newValue;
14620
+ }
14546
14621
  },
14547
14622
  beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
14548
14623
  el[assignKey] = getModelAssigner(vnode);
@@ -18939,6 +19014,7 @@ const transformFor = createStructuralDirectiveTransform(
18939
19014
  node.loc
18940
19015
  );
18941
19016
  return () => {
19017
+ var _a;
18942
19018
  let childBlock;
18943
19019
  const { children } = forNode;
18944
19020
  if ((!!(process.env.NODE_ENV !== "production") || false) && isTemplate) {
@@ -18982,7 +19058,8 @@ const transformFor = createStructuralDirectiveTransform(
18982
19058
  if (isTemplate && keyProperty) {
18983
19059
  injectProp(childBlock, keyProperty, context);
18984
19060
  }
18985
- if (childBlock.isBlock !== !isStableFragment) {
19061
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
19062
+ if (childBlock.isBlock !== shouldUseBlock) {
18986
19063
  if (childBlock.isBlock) {
18987
19064
  removeHelper(OPEN_BLOCK);
18988
19065
  removeHelper(
@@ -18994,12 +19071,15 @@ const transformFor = createStructuralDirectiveTransform(
18994
19071
  );
18995
19072
  }
18996
19073
  }
18997
- childBlock.isBlock = !isStableFragment;
19074
+ childBlock.isBlock = shouldUseBlock;
18998
19075
  if (childBlock.isBlock) {
18999
19076
  helper(OPEN_BLOCK);
19000
19077
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
19001
19078
  } else {
19002
19079
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
19080
+ if (childBlock.needsPatch) {
19081
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
19082
+ }
19003
19083
  }
19004
19084
  }
19005
19085
  if (memo) {
@@ -19378,6 +19458,8 @@ const transformElement = (node, context) => {
19378
19458
  let vnodeDynamicProps;
19379
19459
  let dynamicPropNames;
19380
19460
  let vnodeDirectives;
19461
+ let needsPatch = false;
19462
+ let isBlockRequired = false;
19381
19463
  let shouldUseBlock = (
19382
19464
  // dynamic component may resolve to plain elements
19383
19465
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -19397,6 +19479,8 @@ const transformElement = (node, context) => {
19397
19479
  vnodeProps = propsBuildResult.props;
19398
19480
  patchFlag = propsBuildResult.patchFlag;
19399
19481
  dynamicPropNames = propsBuildResult.dynamicPropNames;
19482
+ needsPatch = propsBuildResult.needsPatch;
19483
+ isBlockRequired = propsBuildResult.isBlockRequired;
19400
19484
  const directives = propsBuildResult.directives;
19401
19485
  vnodeDirectives = directives && directives.length ? createArrayExpression(
19402
19486
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -19447,7 +19531,7 @@ const transformElement = (node, context) => {
19447
19531
  if (dynamicPropNames && dynamicPropNames.length) {
19448
19532
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
19449
19533
  }
19450
- node.codegenNode = createVNodeCall(
19534
+ const vnodeCall = node.codegenNode = createVNodeCall(
19451
19535
  context,
19452
19536
  vnodeTag,
19453
19537
  vnodeProps,
@@ -19460,6 +19544,13 @@ const transformElement = (node, context) => {
19460
19544
  isComponent,
19461
19545
  node.loc
19462
19546
  );
19547
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
19548
+ if (needsPatch) {
19549
+ vnodeCall.needsPatch = true;
19550
+ }
19551
+ if (isBlockRequired) {
19552
+ vnodeCall.isBlockRequired = true;
19553
+ }
19463
19554
  };
19464
19555
  };
19465
19556
  function resolveComponentType(node, context, ssr = false) {
@@ -19511,6 +19602,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19511
19602
  const runtimeDirectives = [];
19512
19603
  const hasChildren = children.length > 0;
19513
19604
  let shouldUseBlock = false;
19605
+ let isBlockRequired = false;
19514
19606
  let patchFlag = 0;
19515
19607
  let hasRef = false;
19516
19608
  let hasClassBinding = false;
@@ -19552,19 +19644,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19552
19644
  if (isEventHandler && isReservedProp(name)) {
19553
19645
  hasVnodeHook = true;
19554
19646
  }
19647
+ if (name === "ref") {
19648
+ hasRef = true;
19649
+ }
19555
19650
  if (isEventHandler && value.type === 14) {
19556
19651
  value = value.arguments[0];
19557
19652
  }
19558
19653
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
19559
19654
  return;
19560
19655
  }
19561
- if (name === "ref") {
19562
- hasRef = true;
19563
- } else if (name === "class") {
19656
+ if (name === "class") {
19564
19657
  hasClassBinding = true;
19565
19658
  } else if (name === "style") {
19566
19659
  hasStyleBinding = true;
19567
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
19660
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
19568
19661
  dynamicPropNames.push(name);
19569
19662
  }
19570
19663
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -19623,13 +19716,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19623
19716
  if (isVOn && ssr) {
19624
19717
  continue;
19625
19718
  }
19626
- if (
19627
- // #938: elements with dynamic keys should be forced into blocks
19628
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
19629
- // before children
19630
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
19631
- ) {
19719
+ if (isVBind && isStaticArgOf(arg, "key")) {
19720
+ shouldUseBlock = true;
19721
+ }
19722
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
19632
19723
  shouldUseBlock = true;
19724
+ isBlockRequired = true;
19633
19725
  }
19634
19726
  if (isVBind && isStaticArgOf(arg, "ref")) {
19635
19727
  pushRefVForMarker();
@@ -19712,6 +19804,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19712
19804
  runtimeDirectives.push(prop);
19713
19805
  if (hasChildren) {
19714
19806
  shouldUseBlock = true;
19807
+ isBlockRequired = true;
19715
19808
  }
19716
19809
  }
19717
19810
  }
@@ -19750,7 +19843,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19750
19843
  patchFlag |= 32;
19751
19844
  }
19752
19845
  }
19753
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
19846
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
19847
+ if (!shouldUseBlock && needsPatch) {
19754
19848
  patchFlag |= 512;
19755
19849
  }
19756
19850
  if (!context.inSSR && propsExpression) {
@@ -19816,7 +19910,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19816
19910
  directives: runtimeDirectives,
19817
19911
  patchFlag,
19818
19912
  dynamicPropNames,
19819
- shouldUseBlock
19913
+ shouldUseBlock,
19914
+ needsPatch,
19915
+ isBlockRequired
19820
19916
  };
19821
19917
  }
19822
19918
  function dedupeProperties(properties) {