@vue/compiler-dom 3.5.39 → 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/compiler-dom v3.5.39
2
+ * @vue/compiler-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1955,6 +1955,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1955
1955
  return [props, callPath];
1956
1956
  }
1957
1957
  function injectProp(node, prop, context) {
1958
+ if (node.type !== 13 && injectSlotKey(node, prop)) {
1959
+ return;
1960
+ }
1958
1961
  let propsWithInjection;
1959
1962
  let props = node.type === 13 ? node.props : node.arguments[2];
1960
1963
  let callPath = [];
@@ -2012,6 +2015,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
2012
2015
  }
2013
2016
  }
2014
2017
  }
2018
+ function injectSlotKey(node, prop) {
2019
+ var _a, _b, _c;
2020
+ if (prop.key.type !== 4 || prop.key.content !== "key") {
2021
+ return false;
2022
+ }
2023
+ const props = node.arguments[2];
2024
+ if (props && !isString(props)) {
2025
+ const [unnormalizedProps] = getUnnormalizedProps(props);
2026
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) {
2027
+ return true;
2028
+ }
2029
+ }
2030
+ (_a = node.arguments)[2] || (_a[2] = "{}");
2031
+ (_b = node.arguments)[3] || (_b[3] = "undefined");
2032
+ (_c = node.arguments)[4] || (_c[4] = "undefined");
2033
+ node.arguments[5] = prop.value;
2034
+ return true;
2035
+ }
2015
2036
  function hasProp(prop, props) {
2016
2037
  let result = false;
2017
2038
  if (prop.key.type === 4) {
@@ -4327,6 +4348,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4327
4348
  node.loc
4328
4349
  );
4329
4350
  return () => {
4351
+ var _a;
4330
4352
  let childBlock;
4331
4353
  const { children } = forNode;
4332
4354
  if (isTemplate) {
@@ -4370,7 +4392,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4370
4392
  if (isTemplate && keyProperty) {
4371
4393
  injectProp(childBlock, keyProperty, context);
4372
4394
  }
4373
- if (childBlock.isBlock !== !isStableFragment) {
4395
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
4396
+ if (childBlock.isBlock !== shouldUseBlock) {
4374
4397
  if (childBlock.isBlock) {
4375
4398
  removeHelper(OPEN_BLOCK);
4376
4399
  removeHelper(
@@ -4382,12 +4405,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4382
4405
  );
4383
4406
  }
4384
4407
  }
4385
- childBlock.isBlock = !isStableFragment;
4408
+ childBlock.isBlock = shouldUseBlock;
4386
4409
  if (childBlock.isBlock) {
4387
4410
  helper(OPEN_BLOCK);
4388
4411
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4389
4412
  } else {
4390
4413
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
4414
+ if (childBlock.needsPatch) {
4415
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
4416
+ }
4391
4417
  }
4392
4418
  }
4393
4419
  if (memo) {
@@ -4785,6 +4811,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4785
4811
  let vnodeDynamicProps;
4786
4812
  let dynamicPropNames;
4787
4813
  let vnodeDirectives;
4814
+ let needsPatch = false;
4815
+ let isBlockRequired = false;
4788
4816
  let shouldUseBlock = (
4789
4817
  // dynamic component may resolve to plain elements
4790
4818
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -4804,6 +4832,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4804
4832
  vnodeProps = propsBuildResult.props;
4805
4833
  patchFlag = propsBuildResult.patchFlag;
4806
4834
  dynamicPropNames = propsBuildResult.dynamicPropNames;
4835
+ needsPatch = propsBuildResult.needsPatch;
4836
+ isBlockRequired = propsBuildResult.isBlockRequired;
4807
4837
  const directives = propsBuildResult.directives;
4808
4838
  vnodeDirectives = directives && directives.length ? createArrayExpression(
4809
4839
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -4854,7 +4884,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4854
4884
  if (dynamicPropNames && dynamicPropNames.length) {
4855
4885
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4856
4886
  }
4857
- node.codegenNode = createVNodeCall(
4887
+ const vnodeCall = node.codegenNode = createVNodeCall(
4858
4888
  context,
4859
4889
  vnodeTag,
4860
4890
  vnodeProps,
@@ -4867,6 +4897,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4867
4897
  isComponent,
4868
4898
  node.loc
4869
4899
  );
4900
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
4901
+ if (needsPatch) {
4902
+ vnodeCall.needsPatch = true;
4903
+ }
4904
+ if (isBlockRequired) {
4905
+ vnodeCall.isBlockRequired = true;
4906
+ }
4870
4907
  };
4871
4908
  };
4872
4909
  function resolveComponentType(node, context, ssr = false) {
@@ -4918,6 +4955,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4918
4955
  const runtimeDirectives = [];
4919
4956
  const hasChildren = children.length > 0;
4920
4957
  let shouldUseBlock = false;
4958
+ let isBlockRequired = false;
4921
4959
  let patchFlag = 0;
4922
4960
  let hasRef = false;
4923
4961
  let hasClassBinding = false;
@@ -4959,19 +4997,20 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4959
4997
  if (isEventHandler && isReservedProp(name)) {
4960
4998
  hasVnodeHook = true;
4961
4999
  }
5000
+ if (name === "ref") {
5001
+ hasRef = true;
5002
+ }
4962
5003
  if (isEventHandler && value.type === 14) {
4963
5004
  value = value.arguments[0];
4964
5005
  }
4965
5006
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4966
5007
  return;
4967
5008
  }
4968
- if (name === "ref") {
4969
- hasRef = true;
4970
- } else if (name === "class") {
5009
+ if (name === "class") {
4971
5010
  hasClassBinding = true;
4972
5011
  } else if (name === "style") {
4973
5012
  hasStyleBinding = true;
4974
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
5013
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
4975
5014
  dynamicPropNames.push(name);
4976
5015
  }
4977
5016
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -5030,13 +5069,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5030
5069
  if (isVOn && ssr) {
5031
5070
  continue;
5032
5071
  }
5033
- if (
5034
- // #938: elements with dynamic keys should be forced into blocks
5035
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
5036
- // before children
5037
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
5038
- ) {
5072
+ if (isVBind && isStaticArgOf(arg, "key")) {
5073
+ shouldUseBlock = true;
5074
+ }
5075
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
5039
5076
  shouldUseBlock = true;
5077
+ isBlockRequired = true;
5040
5078
  }
5041
5079
  if (isVBind && isStaticArgOf(arg, "ref")) {
5042
5080
  pushRefVForMarker();
@@ -5119,6 +5157,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5119
5157
  runtimeDirectives.push(prop);
5120
5158
  if (hasChildren) {
5121
5159
  shouldUseBlock = true;
5160
+ isBlockRequired = true;
5122
5161
  }
5123
5162
  }
5124
5163
  }
@@ -5157,7 +5196,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5157
5196
  patchFlag |= 32;
5158
5197
  }
5159
5198
  }
5160
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
5199
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
5200
+ if (!shouldUseBlock && needsPatch) {
5161
5201
  patchFlag |= 512;
5162
5202
  }
5163
5203
  if (!context.inSSR && propsExpression) {
@@ -5223,7 +5263,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5223
5263
  directives: runtimeDirectives,
5224
5264
  patchFlag,
5225
5265
  dynamicPropNames,
5226
- shouldUseBlock
5266
+ shouldUseBlock,
5267
+ needsPatch,
5268
+ isBlockRequired
5227
5269
  };
5228
5270
  }
5229
5271
  function dedupeProperties(properties) {