@vue/compiler-dom 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/compiler-dom v3.5.40
2
+ * @vue/compiler-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -623,12 +623,15 @@ function stringifyElement(node, context) {
623
623
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
624
624
  continue;
625
625
  }
626
- if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
626
+ if ((shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
627
627
  continue;
628
628
  }
629
629
  let evaluated = evaluateConstant(exp);
630
630
  if (evaluated != null) {
631
631
  const arg = p.arg && p.arg.content;
632
+ if (arg === "hidden" && typeof evaluated === "number" && !shared.includeBooleanAttr(evaluated)) {
633
+ continue;
634
+ }
632
635
  if (arg === "class") {
633
636
  evaluated = shared.normalizeClass(evaluated);
634
637
  } else if (arg === "style") {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.40
2
+ * @vue/compiler-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -559,12 +559,15 @@ function stringifyElement(node, context) {
559
559
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
560
560
  continue;
561
561
  }
562
- if (shared.isBooleanAttr(p.arg.content) && exp.content === "false") {
562
+ if ((shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
563
563
  continue;
564
564
  }
565
565
  let evaluated = evaluateConstant(exp);
566
566
  if (evaluated != null) {
567
567
  const arg = p.arg && p.arg.content;
568
+ if (arg === "hidden" && typeof evaluated === "number" && !shared.includeBooleanAttr(evaluated)) {
569
+ continue;
570
+ }
568
571
  if (arg === "class") {
569
572
  evaluated = shared.normalizeClass(evaluated);
570
573
  } else if (arg === "style") {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.40
2
+ * @vue/compiler-dom v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -4345,6 +4345,7 @@ const transformFor = createStructuralDirectiveTransform(
4345
4345
  node.loc
4346
4346
  );
4347
4347
  return () => {
4348
+ var _a;
4348
4349
  let childBlock;
4349
4350
  const { children } = forNode;
4350
4351
  if (isTemplate) {
@@ -4388,7 +4389,8 @@ const transformFor = createStructuralDirectiveTransform(
4388
4389
  if (isTemplate && keyProperty) {
4389
4390
  injectProp(childBlock, keyProperty, context);
4390
4391
  }
4391
- if (childBlock.isBlock !== !isStableFragment) {
4392
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
4393
+ if (childBlock.isBlock !== shouldUseBlock) {
4392
4394
  if (childBlock.isBlock) {
4393
4395
  removeHelper(OPEN_BLOCK);
4394
4396
  removeHelper(
@@ -4400,12 +4402,15 @@ const transformFor = createStructuralDirectiveTransform(
4400
4402
  );
4401
4403
  }
4402
4404
  }
4403
- childBlock.isBlock = !isStableFragment;
4405
+ childBlock.isBlock = shouldUseBlock;
4404
4406
  if (childBlock.isBlock) {
4405
4407
  helper(OPEN_BLOCK);
4406
4408
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4407
4409
  } else {
4408
4410
  helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
4411
+ if (childBlock.needsPatch) {
4412
+ childBlock.patchFlag = ((_a = childBlock.patchFlag) != null ? _a : 0) | 512;
4413
+ }
4409
4414
  }
4410
4415
  }
4411
4416
  if (memo) {
@@ -4803,6 +4808,8 @@ const transformElement = (node, context) => {
4803
4808
  let vnodeDynamicProps;
4804
4809
  let dynamicPropNames;
4805
4810
  let vnodeDirectives;
4811
+ let needsPatch = false;
4812
+ let isBlockRequired = false;
4806
4813
  let shouldUseBlock = (
4807
4814
  // dynamic component may resolve to plain elements
4808
4815
  isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && // <svg> and <foreignObject> must be forced into blocks so that block
@@ -4822,6 +4829,8 @@ const transformElement = (node, context) => {
4822
4829
  vnodeProps = propsBuildResult.props;
4823
4830
  patchFlag = propsBuildResult.patchFlag;
4824
4831
  dynamicPropNames = propsBuildResult.dynamicPropNames;
4832
+ needsPatch = propsBuildResult.needsPatch;
4833
+ isBlockRequired = propsBuildResult.isBlockRequired;
4825
4834
  const directives = propsBuildResult.directives;
4826
4835
  vnodeDirectives = directives && directives.length ? createArrayExpression(
4827
4836
  directives.map((dir) => buildDirectiveArgs(dir, context))
@@ -4872,7 +4881,7 @@ const transformElement = (node, context) => {
4872
4881
  if (dynamicPropNames && dynamicPropNames.length) {
4873
4882
  vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4874
4883
  }
4875
- node.codegenNode = createVNodeCall(
4884
+ const vnodeCall = node.codegenNode = createVNodeCall(
4876
4885
  context,
4877
4886
  vnodeTag,
4878
4887
  vnodeProps,
@@ -4885,6 +4894,13 @@ const transformElement = (node, context) => {
4885
4894
  isComponent,
4886
4895
  node.loc
4887
4896
  );
4897
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
4898
+ if (needsPatch) {
4899
+ vnodeCall.needsPatch = true;
4900
+ }
4901
+ if (isBlockRequired) {
4902
+ vnodeCall.isBlockRequired = true;
4903
+ }
4888
4904
  };
4889
4905
  };
4890
4906
  function resolveComponentType(node, context, ssr = false) {
@@ -4936,6 +4952,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4936
4952
  const runtimeDirectives = [];
4937
4953
  const hasChildren = children.length > 0;
4938
4954
  let shouldUseBlock = false;
4955
+ let isBlockRequired = false;
4939
4956
  let patchFlag = 0;
4940
4957
  let hasRef = false;
4941
4958
  let hasClassBinding = false;
@@ -4977,19 +4994,20 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4977
4994
  if (isEventHandler && isReservedProp(name)) {
4978
4995
  hasVnodeHook = true;
4979
4996
  }
4997
+ if (name === "ref") {
4998
+ hasRef = true;
4999
+ }
4980
5000
  if (isEventHandler && value.type === 14) {
4981
5001
  value = value.arguments[0];
4982
5002
  }
4983
5003
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
4984
5004
  return;
4985
5005
  }
4986
- if (name === "ref") {
4987
- hasRef = true;
4988
- } else if (name === "class") {
5006
+ if (name === "class") {
4989
5007
  hasClassBinding = true;
4990
5008
  } else if (name === "style") {
4991
5009
  hasStyleBinding = true;
4992
- } else if (name !== "key" && !dynamicPropNames.includes(name)) {
5010
+ } else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) {
4993
5011
  dynamicPropNames.push(name);
4994
5012
  }
4995
5013
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) {
@@ -5048,13 +5066,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5048
5066
  if (isVOn && ssr) {
5049
5067
  continue;
5050
5068
  }
5051
- if (
5052
- // #938: elements with dynamic keys should be forced into blocks
5053
- isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked
5054
- // before children
5055
- isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")
5056
- ) {
5069
+ if (isVBind && isStaticArgOf(arg, "key")) {
5070
+ shouldUseBlock = true;
5071
+ }
5072
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
5057
5073
  shouldUseBlock = true;
5074
+ isBlockRequired = true;
5058
5075
  }
5059
5076
  if (isVBind && isStaticArgOf(arg, "ref")) {
5060
5077
  pushRefVForMarker();
@@ -5137,6 +5154,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5137
5154
  runtimeDirectives.push(prop);
5138
5155
  if (hasChildren) {
5139
5156
  shouldUseBlock = true;
5157
+ isBlockRequired = true;
5140
5158
  }
5141
5159
  }
5142
5160
  }
@@ -5175,7 +5193,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5175
5193
  patchFlag |= 32;
5176
5194
  }
5177
5195
  }
5178
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
5196
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
5197
+ if (!shouldUseBlock && needsPatch) {
5179
5198
  patchFlag |= 512;
5180
5199
  }
5181
5200
  if (!context.inSSR && propsExpression) {
@@ -5241,7 +5260,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
5241
5260
  directives: runtimeDirectives,
5242
5261
  patchFlag,
5243
5262
  dynamicPropNames,
5244
- shouldUseBlock
5263
+ shouldUseBlock,
5264
+ needsPatch,
5265
+ isBlockRequired
5245
5266
  };
5246
5267
  }
5247
5268
  function dedupeProperties(properties) {