@vue/compiler-dom 3.6.0-beta.9 → 3.6.0-rc.10

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.6.0-beta.9
2
+ * @vue/compiler-dom v3.6.0-rc.10
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -13,7 +13,7 @@ var VueCompilerDOM = (function(exports) {
13
13
  * \/\*#\_\_PURE\_\_\*\/
14
14
  * So that they can be tree-shaken if necessary.
15
15
  */
16
- /* @__NO_SIDE_EFFECTS__ */
16
+ /*@__NO_SIDE_EFFECTS__*/
17
17
  function makeMap(str) {
18
18
  const map = Object.create(null);
19
19
  for (const key of str.split(",")) map[key] = 1;
@@ -34,8 +34,8 @@ var VueCompilerDOM = (function(exports) {
34
34
  const isString = (val) => typeof val === "string";
35
35
  const isSymbol = (val) => typeof val === "symbol";
36
36
  const isObject = (val) => val !== null && typeof val === "object";
37
- const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
38
- const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
37
+ const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
38
+ const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
39
39
  const cacheStringFunction = (fn) => {
40
40
  const cache = Object.create(null);
41
41
  return ((str) => {
@@ -48,8 +48,6 @@ var VueCompilerDOM = (function(exports) {
48
48
  * @private
49
49
  */
50
50
  const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
51
- const hyphenateRE = /\B([A-Z])/g;
52
- cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
53
51
  /**
54
52
  * @private
55
53
  */
@@ -144,10 +142,10 @@ var VueCompilerDOM = (function(exports) {
144
142
  //#region packages/shared/src/normalizeProp.ts
145
143
  const listDelimiterRE = /;(?![^(]*\))/g;
146
144
  const propertyDelimiterRE = /:([^]+)/;
147
- const styleCommentRE = /\/\*[^]*?\*\//g;
145
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
148
146
  function parseStringStyle(cssText) {
149
147
  const ret = {};
150
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
148
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
151
149
  if (item) {
152
150
  const tmp = item.split(propertyDelimiterRE);
153
151
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -165,22 +163,22 @@ var VueCompilerDOM = (function(exports) {
165
163
  * Compiler only.
166
164
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
167
165
  */
168
- const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
166
+ const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
169
167
  /**
170
168
  * Compiler only.
171
169
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
172
170
  */
173
- const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
171
+ const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
174
172
  /**
175
173
  * Compiler only.
176
174
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
177
175
  */
178
- const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
176
+ const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
179
177
  /**
180
178
  * Compiler only.
181
179
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
182
180
  */
183
- const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
181
+ const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
184
182
  //#endregion
185
183
  //#region packages/compiler-core/src/runtimeHelpers.ts
186
184
  const FRAGMENT = Symbol(`Fragment`);
@@ -725,13 +723,14 @@ var VueCompilerDOM = (function(exports) {
725
723
  }
726
724
  }
727
725
  stateInterpolationOpen(c) {
728
- if (c === this.delimiterOpen[this.delimiterIndex]) if (this.delimiterIndex === this.delimiterOpen.length - 1) {
729
- const start = this.index + 1 - this.delimiterOpen.length;
730
- if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
731
- this.state = 3;
732
- this.sectionStart = start;
733
- } else this.delimiterIndex++;
734
- else if (this.inRCDATA) {
726
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
727
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
728
+ const start = this.index + 1 - this.delimiterOpen.length;
729
+ if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
730
+ this.state = 3;
731
+ this.sectionStart = start;
732
+ } else this.delimiterIndex++;
733
+ } else if (this.inRCDATA) {
735
734
  this.state = 32;
736
735
  this.stateInRCDATA(c);
737
736
  } else {
@@ -747,13 +746,14 @@ var VueCompilerDOM = (function(exports) {
747
746
  }
748
747
  }
749
748
  stateInterpolationClose(c) {
750
- if (c === this.delimiterClose[this.delimiterIndex]) if (this.delimiterIndex === this.delimiterClose.length - 1) {
751
- this.cbs.oninterpolation(this.sectionStart, this.index + 1);
752
- if (this.inRCDATA) this.state = 32;
753
- else this.state = 1;
754
- this.sectionStart = this.index + 1;
755
- } else this.delimiterIndex++;
756
- else {
749
+ if (c === this.delimiterClose[this.delimiterIndex]) {
750
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
751
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
752
+ if (this.inRCDATA) this.state = 32;
753
+ else this.state = 1;
754
+ this.sectionStart = this.index + 1;
755
+ } else this.delimiterIndex++;
756
+ } else {
757
757
  this.state = 3;
758
758
  this.stateInterpolation(c);
759
759
  }
@@ -868,9 +868,10 @@ var VueCompilerDOM = (function(exports) {
868
868
  this.sectionStart = this.index;
869
869
  if (this.mode === 0) this.state = 6;
870
870
  else if (this.inSFCRoot) this.state = 34;
871
- else if (!this.inXML) if (c === 116) this.state = 30;
872
- else this.state = c === 115 ? 29 : 6;
873
- else this.state = 6;
871
+ else if (!this.inXML) {
872
+ if (c === 116) this.state = 30;
873
+ else this.state = c === 115 ? 29 : 6;
874
+ } else this.state = 6;
874
875
  } else if (c === 47) this.state = 8;
875
876
  else {
876
877
  this.state = 1;
@@ -1223,9 +1224,7 @@ var VueCompilerDOM = (function(exports) {
1223
1224
  case 24:
1224
1225
  this.stateInProcessingInstruction(c);
1225
1226
  break;
1226
- case 33:
1227
- this.stateInEntity();
1228
- break;
1227
+ case 33: this.stateInEntity();
1229
1228
  }
1230
1229
  this.index++;
1231
1230
  }
@@ -1254,9 +1253,10 @@ var VueCompilerDOM = (function(exports) {
1254
1253
  handleTrailingData() {
1255
1254
  const endIndex = this.buffer.length;
1256
1255
  if (this.sectionStart >= endIndex) return;
1257
- if (this.state === 28) if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
1258
- else this.cbs.oncomment(this.sectionStart, endIndex);
1259
- else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) {} else this.cbs.ontext(this.sectionStart, endIndex);
1256
+ if (this.state === 28) {
1257
+ if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
1258
+ else this.cbs.oncomment(this.sectionStart, endIndex);
1259
+ } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) {} else this.cbs.ontext(this.sectionStart, endIndex);
1260
1260
  }
1261
1261
  emitCodePoint(cp, consumed) {}
1262
1262
  };
@@ -1589,9 +1589,7 @@ var VueCompilerDOM = (function(exports) {
1589
1589
  case "RestElement":
1590
1590
  extractIdentifiers(param.argument, nodes);
1591
1591
  break;
1592
- case "AssignmentPattern":
1593
- extractIdentifiers(param.left, nodes);
1594
- break;
1592
+ case "AssignmentPattern": extractIdentifiers(param.left, nodes);
1595
1593
  }
1596
1594
  return nodes;
1597
1595
  }
@@ -1727,12 +1725,10 @@ var VueCompilerDOM = (function(exports) {
1727
1725
  if (!--currentOpenParensCount) state = stateStack.pop();
1728
1726
  }
1729
1727
  break;
1730
- case 3:
1731
- if (char === currentStringType) {
1732
- state = stateStack.pop();
1733
- currentStringType = null;
1734
- }
1735
- break;
1728
+ case 3: if (char === currentStringType) {
1729
+ state = stateStack.pop();
1730
+ currentStringType = null;
1731
+ }
1736
1732
  }
1737
1733
  }
1738
1734
  return !currentOpenBracketCount && !currentOpenParensCount;
@@ -1803,7 +1799,7 @@ var VueCompilerDOM = (function(exports) {
1803
1799
  function isSlotOutlet(node) {
1804
1800
  return node.type === 1 && node.tagType === 2;
1805
1801
  }
1806
- const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
1802
+ const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
1807
1803
  function getUnnormalizedProps(props, callPath = []) {
1808
1804
  if (props && !isString(props) && props.type === 14) {
1809
1805
  const callee = props.callee;
@@ -1812,6 +1808,7 @@ var VueCompilerDOM = (function(exports) {
1812
1808
  return [props, callPath];
1813
1809
  }
1814
1810
  function injectProp(node, prop, context) {
1811
+ if (node.type !== 13 && injectSlotKey(node, prop)) return;
1815
1812
  let propsWithInjection;
1816
1813
  /**
1817
1814
  * 1. mergeProps(...)
@@ -1845,11 +1842,26 @@ var VueCompilerDOM = (function(exports) {
1845
1842
  propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [createObjectExpression([prop]), props]);
1846
1843
  if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) parentCall = callPath[callPath.length - 2];
1847
1844
  }
1848
- if (node.type === 13) if (parentCall) parentCall.arguments[0] = propsWithInjection;
1849
- else node.props = propsWithInjection;
1850
- else if (parentCall) parentCall.arguments[0] = propsWithInjection;
1845
+ if (node.type === 13) {
1846
+ if (parentCall) parentCall.arguments[0] = propsWithInjection;
1847
+ else node.props = propsWithInjection;
1848
+ } else if (parentCall) parentCall.arguments[0] = propsWithInjection;
1851
1849
  else node.arguments[2] = propsWithInjection;
1852
1850
  }
1851
+ function injectSlotKey(node, prop) {
1852
+ var _node$arguments, _node$arguments2, _node$arguments3;
1853
+ if (prop.key.type !== 4 || prop.key.content !== "key") return false;
1854
+ const props = node.arguments[2];
1855
+ if (props && !isString(props)) {
1856
+ const [unnormalizedProps] = getUnnormalizedProps(props);
1857
+ if (unnormalizedProps && !isString(unnormalizedProps) && unnormalizedProps.type === 15 && hasProp(prop, unnormalizedProps)) return true;
1858
+ }
1859
+ (_node$arguments = node.arguments)[2] || (_node$arguments[2] = "{}");
1860
+ (_node$arguments2 = node.arguments)[3] || (_node$arguments2[3] = "undefined");
1861
+ (_node$arguments3 = node.arguments)[4] || (_node$arguments3[4] = "undefined");
1862
+ node.arguments[5] = prop.value;
1863
+ return true;
1864
+ }
1853
1865
  function hasProp(prop, props) {
1854
1866
  let result = false;
1855
1867
  if (prop.key.type === 4) {
@@ -2148,10 +2160,7 @@ var VueCompilerDOM = (function(exports) {
2148
2160
  case 18:
2149
2161
  case 19:
2150
2162
  case 20:
2151
- case 21:
2152
- emitError(9, end);
2153
- break;
2154
- default: break;
2163
+ case 21: emitError(9, end);
2155
2164
  }
2156
2165
  for (let index = 0; index < stack.length; index++) {
2157
2166
  onCloseTag(stack[index], end - 1);
@@ -2159,7 +2168,7 @@ var VueCompilerDOM = (function(exports) {
2159
2168
  }
2160
2169
  },
2161
2170
  oncdata(start, end) {
2162
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
2171
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
2163
2172
  else emitError(1, start - 9);
2164
2173
  },
2165
2174
  onprocessinginstruction(start) {
@@ -2301,7 +2310,7 @@ var VueCompilerDOM = (function(exports) {
2301
2310
  while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
2302
2311
  return i;
2303
2312
  }
2304
- const specialTemplateDir = new Set([
2313
+ const specialTemplateDir = /* @__PURE__ */ new Set([
2305
2314
  "if",
2306
2315
  "else",
2307
2316
  "else-if",
@@ -2337,16 +2346,18 @@ var VueCompilerDOM = (function(exports) {
2337
2346
  let removedWhitespace = false;
2338
2347
  for (let i = 0; i < nodes.length; i++) {
2339
2348
  const node = nodes[i];
2340
- if (node.type === 2) if (!inPre) {
2341
- if (isAllWhitespace(node.content)) {
2342
- const prev = nodes[i - 1] && nodes[i - 1].type;
2343
- const next = nodes[i + 1] && nodes[i + 1].type;
2344
- if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2345
- removedWhitespace = true;
2346
- nodes[i] = null;
2347
- } else node.content = " ";
2348
- } else if (shouldCondense) node.content = condense(node.content);
2349
- } else node.content = node.content.replace(windowsNewlineRE, "\n");
2349
+ if (node.type === 2) {
2350
+ if (!inPre) {
2351
+ if (isAllWhitespace(node.content)) {
2352
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2353
+ const next = nodes[i + 1] && nodes[i + 1].type;
2354
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2355
+ removedWhitespace = true;
2356
+ nodes[i] = null;
2357
+ } else node.content = " ";
2358
+ } else if (shouldCondense) node.content = condense(node.content);
2359
+ } else node.content = node.content.replace(windowsNewlineRE, "\n");
2360
+ }
2350
2361
  }
2351
2362
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
2352
2363
  }
@@ -2607,7 +2618,7 @@ var VueCompilerDOM = (function(exports) {
2607
2618
  default: return 0;
2608
2619
  }
2609
2620
  }
2610
- const allowHoistedHelperSet = new Set([
2621
+ const allowHoistedHelperSet = /* @__PURE__ */ new Set([
2611
2622
  NORMALIZE_CLASS,
2612
2623
  NORMALIZE_STYLE,
2613
2624
  NORMALIZE_PROPS,
@@ -2684,8 +2695,10 @@ var VueCompilerDOM = (function(exports) {
2684
2695
  imports: [],
2685
2696
  cached: [],
2686
2697
  constantCache: /* @__PURE__ */ new WeakMap(),
2698
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
2687
2699
  temps: 0,
2688
2700
  identifiers: Object.create(null),
2701
+ identifierScopes: Object.create(null),
2689
2702
  scopes: {
2690
2703
  vFor: 0,
2691
2704
  vSlot: 0,
@@ -2736,8 +2749,12 @@ var VueCompilerDOM = (function(exports) {
2736
2749
  context.parent.children.splice(removalIndex, 1);
2737
2750
  },
2738
2751
  onNodeRemoved: NOOP,
2739
- addIdentifiers(exp) {},
2752
+ addIdentifiers(exp, type = "local") {},
2740
2753
  removeIdentifiers(exp) {},
2754
+ isSlotScopeIdentifier(name) {
2755
+ const scopes = context.identifierScopes[name];
2756
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
2757
+ },
2741
2758
  hoist(exp) {
2742
2759
  if (isString(exp)) exp = createSimpleExpression(exp);
2743
2760
  context.hoists.push(exp);
@@ -2759,7 +2776,7 @@ var VueCompilerDOM = (function(exports) {
2759
2776
  traverseNode(root, context);
2760
2777
  if (options.hoistStatic) cacheStatic(root, context);
2761
2778
  if (!options.ssr) createRootCodegen(root, context);
2762
- root.helpers = new Set([...context.helpers.keys()]);
2779
+ root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
2763
2780
  root.components = [...context.components];
2764
2781
  root.directives = [...context.directives];
2765
2782
  root.imports = context.imports;
@@ -2806,8 +2823,10 @@ var VueCompilerDOM = (function(exports) {
2806
2823
  const exitFns = [];
2807
2824
  for (let i = 0; i < nodeTransforms.length; i++) {
2808
2825
  const onExit = nodeTransforms[i](node, context);
2809
- if (onExit) if (isArray(onExit)) exitFns.push(...onExit);
2810
- else exitFns.push(onExit);
2826
+ if (onExit) {
2827
+ if (isArray(onExit)) exitFns.push(...onExit);
2828
+ else exitFns.push(onExit);
2829
+ }
2811
2830
  if (!context.currentNode) return;
2812
2831
  else node = context.currentNode;
2813
2832
  }
@@ -2824,9 +2843,7 @@ var VueCompilerDOM = (function(exports) {
2824
2843
  case 10:
2825
2844
  case 11:
2826
2845
  case 1:
2827
- case 0:
2828
- traverseChildren(node, context);
2829
- break;
2846
+ case 0: traverseChildren(node, context);
2830
2847
  }
2831
2848
  context.currentNode = node;
2832
2849
  let i = exitFns.length;
@@ -3032,10 +3049,12 @@ var VueCompilerDOM = (function(exports) {
3032
3049
  if (isString(node)) push(node, -3);
3033
3050
  else if (isArray(node)) genNodeListAsArray(node, context);
3034
3051
  else genNode(node, context);
3035
- if (i < nodes.length - 1) if (multilines) {
3036
- comma && push(",");
3037
- newline();
3038
- } else comma && push(", ");
3052
+ if (i < nodes.length - 1) {
3053
+ if (multilines) {
3054
+ comma && push(",");
3055
+ newline();
3056
+ } else comma && push(", ");
3057
+ }
3039
3058
  }
3040
3059
  }
3041
3060
  function genNode(node, context) {
@@ -3101,6 +3120,7 @@ var VueCompilerDOM = (function(exports) {
3101
3120
  case 24: break;
3102
3121
  case 25: break;
3103
3122
  case 26: break;
3123
+ /* v8 ignore start */
3104
3124
  case 10: break;
3105
3125
  default:
3106
3126
  assert(false, `unhandled codegen node type: ${node.type}`);
@@ -3146,8 +3166,10 @@ var VueCompilerDOM = (function(exports) {
3146
3166
  const { push, helper, pure } = context;
3147
3167
  const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
3148
3168
  let patchFlagString;
3149
- if (patchFlag) if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
3150
- else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
3169
+ if (patchFlag) {
3170
+ if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
3171
+ else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
3172
+ }
3151
3173
  if (directives) push(helper(WITH_DIRECTIVES) + `(`);
3152
3174
  if (isBlock) push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
3153
3175
  if (pure) push(PURE_ANNOTATION);
@@ -3309,7 +3331,7 @@ var VueCompilerDOM = (function(exports) {
3309
3331
  }
3310
3332
  //#endregion
3311
3333
  //#region packages/compiler-core/src/transforms/transformExpression.ts
3312
- const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
3334
+ const isLiteralWhitelisted = /*@__PURE__*/ makeMap("true,false,null,this");
3313
3335
  const transformExpression = (node, context) => {
3314
3336
  if (node.type === 5) node.content = processExpression(node.content, context);
3315
3337
  else if (node.type === 1) {
@@ -3319,7 +3341,7 @@ var VueCompilerDOM = (function(exports) {
3319
3341
  if (dir.type === 7 && dir.name !== "for") {
3320
3342
  const exp = dir.exp;
3321
3343
  const arg = dir.arg;
3322
- if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
3344
+ if (exp && exp.type === 4 && !(dir.name === "on" && arg) && !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) dir.exp = processExpression(exp, context, dir.name === "slot");
3323
3345
  if (arg && arg.type === 4 && !arg.isStatic) dir.arg = processExpression(arg, context);
3324
3346
  }
3325
3347
  }
@@ -3422,16 +3444,17 @@ var VueCompilerDOM = (function(exports) {
3422
3444
  const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2));
3423
3445
  const { children } = branch;
3424
3446
  const firstChild = children[0];
3425
- if (children.length !== 1 || firstChild.type !== 1) if (children.length === 1 && firstChild.type === 11) {
3426
- const vnodeCall = firstChild.codegenNode;
3427
- injectProp(vnodeCall, keyProperty, context);
3428
- return vnodeCall;
3447
+ if (children.length !== 1 || firstChild.type !== 1) {
3448
+ if (children.length === 1 && firstChild.type === 11) {
3449
+ const vnodeCall = firstChild.codegenNode;
3450
+ injectProp(vnodeCall, keyProperty, context);
3451
+ return vnodeCall;
3452
+ } else {
3453
+ let patchFlag = 64;
3454
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
3455
+ return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
3456
+ }
3429
3457
  } else {
3430
- let patchFlag = 64;
3431
- if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
3432
- return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
3433
- }
3434
- else {
3435
3458
  const ret = firstChild.codegenNode;
3436
3459
  const vnodeCall = getMemoedVNodeCall(ret);
3437
3460
  if (vnodeCall.type === 13) convertToBlock(vnodeCall, context);
@@ -3452,9 +3475,10 @@ var VueCompilerDOM = (function(exports) {
3452
3475
  return true;
3453
3476
  }
3454
3477
  function getParentCondition(node) {
3455
- while (true) if (node.type === 19) if (node.alternate.type === 19) node = node.alternate;
3456
- else return node;
3457
- else if (node.type === 20) node = node.value;
3478
+ while (true) if (node.type === 19) {
3479
+ if (node.alternate.type === 19) node = node.alternate;
3480
+ else return node;
3481
+ } else if (node.type === 20) node = node.value;
3458
3482
  }
3459
3483
  //#endregion
3460
3484
  //#region packages/compiler-core/src/transforms/vFor.ts
@@ -3465,10 +3489,9 @@ var VueCompilerDOM = (function(exports) {
3465
3489
  const isTemplate = isTemplateNode(node);
3466
3490
  const memo = findDir(node, "memo");
3467
3491
  const keyProp = findProp(node, `key`, false, true);
3468
- const isDirKey = keyProp && keyProp.type === 7;
3492
+ keyProp && keyProp.type;
3469
3493
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
3470
- if (memo && keyExp && isDirKey) {}
3471
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
3494
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
3472
3495
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
3473
3496
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
3474
3497
  forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), void 0, renderExp, fragmentFlag, void 0, void 0, true, !isStableFragment, false, node.loc);
@@ -3493,15 +3516,24 @@ var VueCompilerDOM = (function(exports) {
3493
3516
  else {
3494
3517
  childBlock = children[0].codegenNode;
3495
3518
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
3496
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
3497
- removeHelper(OPEN_BLOCK);
3498
- removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3499
- } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3500
- childBlock.isBlock = !isStableFragment;
3519
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
3520
+ if (childBlock.isBlock !== shouldUseBlock) {
3521
+ if (childBlock.isBlock) {
3522
+ removeHelper(OPEN_BLOCK);
3523
+ removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3524
+ } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3525
+ }
3526
+ childBlock.isBlock = shouldUseBlock;
3501
3527
  if (childBlock.isBlock) {
3502
3528
  helper(OPEN_BLOCK);
3503
3529
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3504
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3530
+ } else {
3531
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3532
+ if (childBlock.needsPatch) {
3533
+ var _childBlock$patchFlag;
3534
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
3535
+ }
3536
+ }
3505
3537
  }
3506
3538
  if (memo) {
3507
3539
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -3692,8 +3724,10 @@ var VueCompilerDOM = (function(exports) {
3692
3724
  return createObjectProperty(`default`, fn);
3693
3725
  };
3694
3726
  if (!hasTemplateSlots) slotsProperties.push(buildDefaultSlotProperty(void 0, children));
3695
- else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
3696
- else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
3727
+ else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) {
3728
+ if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
3729
+ else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
3730
+ }
3697
3731
  }
3698
3732
  const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
3699
3733
  let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`, createSimpleExpression(slotFlag + ` /* ${slotFlagsText[slotFlag]} */`, false))), loc);
@@ -3719,10 +3753,7 @@ var VueCompilerDOM = (function(exports) {
3719
3753
  if (hasForwardedSlots(child.branches)) return true;
3720
3754
  break;
3721
3755
  case 10:
3722
- case 11:
3723
- if (hasForwardedSlots(child.children)) return true;
3724
- break;
3725
- default: break;
3756
+ case 11: if (hasForwardedSlots(child.children)) return true;
3726
3757
  }
3727
3758
  }
3728
3759
  return false;
@@ -3744,12 +3775,16 @@ var VueCompilerDOM = (function(exports) {
3744
3775
  let vnodeDynamicProps;
3745
3776
  let dynamicPropNames;
3746
3777
  let vnodeDirectives;
3778
+ let needsPatch = false;
3779
+ let isBlockRequired = false;
3747
3780
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
3748
3781
  if (props.length > 0) {
3749
3782
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
3750
3783
  vnodeProps = propsBuildResult.props;
3751
3784
  patchFlag = propsBuildResult.patchFlag;
3752
3785
  dynamicPropNames = propsBuildResult.dynamicPropNames;
3786
+ needsPatch = propsBuildResult.needsPatch;
3787
+ isBlockRequired = propsBuildResult.isBlockRequired;
3753
3788
  const directives = propsBuildResult.directives;
3754
3789
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
3755
3790
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -3778,7 +3813,10 @@ var VueCompilerDOM = (function(exports) {
3778
3813
  } else vnodeChildren = node.children;
3779
3814
  }
3780
3815
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
3781
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
3816
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
3817
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
3818
+ if (needsPatch) vnodeCall.needsPatch = true;
3819
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
3782
3820
  };
3783
3821
  };
3784
3822
  function resolveComponentType(node, context, ssr = false) {
@@ -3812,6 +3850,7 @@ var VueCompilerDOM = (function(exports) {
3812
3850
  const runtimeDirectives = [];
3813
3851
  const hasChildren = children.length > 0;
3814
3852
  let shouldUseBlock = false;
3853
+ let isBlockRequired = false;
3815
3854
  let patchFlag = 0;
3816
3855
  let hasRef = false;
3817
3856
  let hasClassBinding = false;
@@ -3836,12 +3875,12 @@ var VueCompilerDOM = (function(exports) {
3836
3875
  const isEventHandler = isOn(name);
3837
3876
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
3838
3877
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
3878
+ if (name === "ref") hasRef = true;
3839
3879
  if (isEventHandler && value.type === 14) value = value.arguments[0];
3840
3880
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
3841
- if (name === "ref") hasRef = true;
3842
- else if (name === "class") hasClassBinding = true;
3881
+ if (name === "class") hasClassBinding = true;
3843
3882
  else if (name === "style") hasStyleBinding = true;
3844
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3883
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3845
3884
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3846
3885
  } else hasDynamicKeys = true;
3847
3886
  };
@@ -3867,33 +3906,38 @@ var VueCompilerDOM = (function(exports) {
3867
3906
  if (name === "once" || name === "memo") continue;
3868
3907
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
3869
3908
  if (isVOn && ssr) continue;
3870
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
3909
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
3910
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
3911
+ shouldUseBlock = true;
3912
+ isBlockRequired = true;
3913
+ }
3871
3914
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
3872
3915
  if (!arg && (isVBind || isVOn)) {
3873
3916
  hasDynamicKeys = true;
3874
- if (exp) if (isVBind) {
3875
- pushMergeArg();
3876
- if (mergeArgs.some((arg) => {
3877
- if (arg.type === 15) return arg.properties.some(({ key }) => {
3878
- if (key.type !== 4 || !key.isStatic) return true;
3879
- return key.content !== "class" && key.content !== "style" && !isOn(key.content);
3880
- });
3881
- else return true;
3882
- })) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
3883
- if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
3884
- mergeArgs.unshift(exp);
3885
- continue;
3886
- }
3887
- pushRefVForMarker();
3888
- pushMergeArg();
3889
- mergeArgs.push(exp);
3890
- } else pushMergeArg({
3891
- type: 14,
3892
- loc,
3893
- callee: context.helper(TO_HANDLERS),
3894
- arguments: isComponent ? [exp] : [exp, `true`]
3895
- });
3896
- else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
3917
+ if (exp) {
3918
+ if (isVBind) {
3919
+ pushMergeArg();
3920
+ if (mergeArgs.some((arg) => {
3921
+ if (arg.type === 15) return arg.properties.some(({ key }) => {
3922
+ if (key.type !== 4 || !key.isStatic) return true;
3923
+ return key.content !== "class" && key.content !== "style" && !isOn(key.content);
3924
+ });
3925
+ else return true;
3926
+ })) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
3927
+ if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
3928
+ mergeArgs.unshift(exp);
3929
+ continue;
3930
+ }
3931
+ pushRefVForMarker();
3932
+ pushMergeArg();
3933
+ mergeArgs.push(exp);
3934
+ } else pushMergeArg({
3935
+ type: 14,
3936
+ loc,
3937
+ callee: context.helper(TO_HANDLERS),
3938
+ arguments: isComponent ? [exp] : [exp, `true`]
3939
+ });
3940
+ } else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
3897
3941
  continue;
3898
3942
  }
3899
3943
  if (isVBind && modifiers.some((mod) => mod.content === "prop")) patchFlag |= 32;
@@ -3909,7 +3953,10 @@ var VueCompilerDOM = (function(exports) {
3909
3953
  }
3910
3954
  } else if (!isBuiltInDirective(name)) {
3911
3955
  runtimeDirectives.push(prop);
3912
- if (hasChildren) shouldUseBlock = true;
3956
+ if (hasChildren) {
3957
+ shouldUseBlock = true;
3958
+ isBlockRequired = true;
3959
+ }
3913
3960
  }
3914
3961
  }
3915
3962
  }
@@ -3926,7 +3973,8 @@ var VueCompilerDOM = (function(exports) {
3926
3973
  if (dynamicPropNames.length) patchFlag |= 8;
3927
3974
  if (hasHydrationEventBinding) patchFlag |= 32;
3928
3975
  }
3929
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
3976
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
3977
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
3930
3978
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
3931
3979
  case 15:
3932
3980
  let classKeyIndex = -1;
@@ -3947,16 +3995,16 @@ var VueCompilerDOM = (function(exports) {
3947
3995
  } else propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
3948
3996
  break;
3949
3997
  case 14: break;
3950
- default:
3951
- propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
3952
- break;
3998
+ default: propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
3953
3999
  }
3954
4000
  return {
3955
4001
  props: propsExpression,
3956
4002
  directives: runtimeDirectives,
3957
4003
  patchFlag,
3958
4004
  dynamicPropNames,
3959
- shouldUseBlock
4005
+ shouldUseBlock,
4006
+ needsPatch,
4007
+ isBlockRequired
3960
4008
  };
3961
4009
  }
3962
4010
  function dedupeProperties(properties) {
@@ -4053,10 +4101,12 @@ var VueCompilerDOM = (function(exports) {
4053
4101
  for (let i = 0; i < node.props.length; i++) {
4054
4102
  const p = node.props[i];
4055
4103
  if (p.type === 6) {
4056
- if (p.value) if (p.name === "name") slotName = JSON.stringify(p.value.content);
4057
- else {
4058
- p.name = camelize(p.name);
4059
- nonNameProps.push(p);
4104
+ if (p.value) {
4105
+ if (p.name === "name") slotName = JSON.stringify(p.value.content);
4106
+ else {
4107
+ p.name = camelize(p.name);
4108
+ nonNameProps.push(p);
4109
+ }
4060
4110
  }
4061
4111
  } else if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
4062
4112
  if (p.exp) slotName = p.exp;
@@ -4082,17 +4132,18 @@ var VueCompilerDOM = (function(exports) {
4082
4132
  const { loc, modifiers, arg } = dir;
4083
4133
  if (!dir.exp && !modifiers.length) context.onError(createCompilerError(35, loc));
4084
4134
  let eventName;
4085
- if (arg.type === 4) if (arg.isStatic) {
4086
- let rawName = arg.content;
4087
- if (rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
4088
- if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
4089
- eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
4090
- } else eventName = createCompoundExpression([
4091
- `${context.helperString(TO_HANDLER_KEY)}(`,
4092
- arg,
4093
- `)`
4094
- ]);
4095
- else {
4135
+ if (arg.type === 4) {
4136
+ if (arg.isStatic) {
4137
+ let rawName = arg.content;
4138
+ if (rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
4139
+ if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
4140
+ eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
4141
+ } else eventName = createCompoundExpression([
4142
+ `${context.helperString(TO_HANDLER_KEY)}(`,
4143
+ arg,
4144
+ `)`
4145
+ ]);
4146
+ } else {
4096
4147
  eventName = arg;
4097
4148
  eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
4098
4149
  eventName.children.push(`)`);
@@ -4128,11 +4179,14 @@ var VueCompilerDOM = (function(exports) {
4128
4179
  arg.children.unshift(`(`);
4129
4180
  arg.children.push(`) || ""`);
4130
4181
  } else if (!arg.isStatic) arg.content = arg.content ? `${arg.content} || ""` : `""`;
4131
- if (modifiers.some((mod) => mod.content === "camel")) if (arg.type === 4) if (arg.isStatic) arg.content = camelize(arg.content);
4132
- else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4133
- else {
4134
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4135
- arg.children.push(`)`);
4182
+ if (modifiers.some((mod) => mod.content === "camel")) {
4183
+ if (arg.type === 4) {
4184
+ if (arg.isStatic) arg.content = camelize(arg.content);
4185
+ else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4186
+ } else {
4187
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4188
+ arg.children.push(`)`);
4189
+ }
4136
4190
  }
4137
4191
  if (!context.inSSR) {
4138
4192
  if (modifiers.some((mod) => mod.content === "prop")) injectPrefix(arg, ".");
@@ -4141,9 +4195,10 @@ var VueCompilerDOM = (function(exports) {
4141
4195
  return { props: [createObjectProperty(arg, exp)] };
4142
4196
  };
4143
4197
  const injectPrefix = (arg, prefix) => {
4144
- if (arg.type === 4) if (arg.isStatic) arg.content = prefix + arg.content;
4145
- else arg.content = `\`${prefix}\${${arg.content}}\``;
4146
- else {
4198
+ if (arg.type === 4) {
4199
+ if (arg.isStatic) arg.content = prefix + arg.content;
4200
+ else arg.content = `\`${prefix}\${${arg.content}}\``;
4201
+ } else {
4147
4202
  arg.children.unshift(`'${prefix}' + (`);
4148
4203
  arg.children.push(`)`);
4149
4204
  }
@@ -4264,7 +4319,7 @@ var VueCompilerDOM = (function(exports) {
4264
4319
  const child = node.children[i];
4265
4320
  if (typeof child !== "object") continue;
4266
4321
  if (child.type === 4) parseFilter(child, context);
4267
- else if (child.type === 8) rewriteFilter(node, context);
4322
+ else if (child.type === 8) rewriteFilter(child, context);
4268
4323
  else if (child.type === 5) rewriteFilter(child.content, context);
4269
4324
  }
4270
4325
  }
@@ -4290,11 +4345,12 @@ var VueCompilerDOM = (function(exports) {
4290
4345
  if (c === 96 && prev !== 92) inTemplateString = false;
4291
4346
  } else if (inRegex) {
4292
4347
  if (c === 47 && prev !== 92) inRegex = false;
4293
- } else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) if (expression === void 0) {
4294
- lastFilterIndex = i + 1;
4295
- expression = exp.slice(0, i).trim();
4296
- } else pushFilter();
4297
- else {
4348
+ } else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
4349
+ if (expression === void 0) {
4350
+ lastFilterIndex = i + 1;
4351
+ expression = exp.slice(0, i).trim();
4352
+ } else pushFilter();
4353
+ } else {
4298
4354
  switch (c) {
4299
4355
  case 34:
4300
4356
  inDouble = true;
@@ -4320,9 +4376,7 @@ var VueCompilerDOM = (function(exports) {
4320
4376
  case 123:
4321
4377
  curly++;
4322
4378
  break;
4323
- case 125:
4324
- curly--;
4325
- break;
4379
+ case 125: curly--;
4326
4380
  }
4327
4381
  if (c === 47) {
4328
4382
  let j = i - 1;
@@ -4638,9 +4692,7 @@ var VueCompilerDOM = (function(exports) {
4638
4692
  isInvalidType = true;
4639
4693
  context.onError(createDOMCompilerError(60, dir.loc));
4640
4694
  break;
4641
- default:
4642
- checkDuplicatedValue();
4643
- break;
4695
+ default: checkDuplicatedValue();
4644
4696
  }
4645
4697
  } else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
4646
4698
  else checkDuplicatedValue();
@@ -4653,27 +4705,37 @@ var VueCompilerDOM = (function(exports) {
4653
4705
  };
4654
4706
  //#endregion
4655
4707
  //#region packages/compiler-dom/src/transforms/vOn.ts
4656
- const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
4657
- const isNonKeyModifier = /* @__PURE__ */ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
4658
- const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
4659
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
4708
+ const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
4709
+ const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
4710
+ const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
4711
+ const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
4660
4712
  const resolveModifiers = (key, modifiers, context, loc) => {
4661
4713
  const keyModifiers = [];
4662
4714
  const nonKeyModifiers = [];
4663
4715
  const eventOptionModifiers = [];
4664
4716
  for (let i = 0; i < modifiers.length; i++) {
4665
4717
  const modifier = modifiers[i].content;
4718
+ if (modifier === "delegate") {
4719
+ if (context) {
4720
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
4721
+ error.loc = modifiers[i].loc;
4722
+ context.onWarn(error);
4723
+ }
4724
+ continue;
4725
+ }
4666
4726
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
4667
4727
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
4668
4728
  else {
4669
4729
  const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
4670
- if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
4671
- else nonKeyModifiers.push(modifier);
4672
- else {
4673
- keyModifiers.push(modifier);
4674
- nonKeyModifiers.push(modifier);
4675
- }
4676
- else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
4730
+ if (maybeKeyModifier(modifier)) {
4731
+ if (keyString) {
4732
+ if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
4733
+ else nonKeyModifiers.push(modifier);
4734
+ } else {
4735
+ keyModifiers.push(modifier);
4736
+ nonKeyModifiers.push(modifier);
4737
+ }
4738
+ } else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
4677
4739
  else keyModifiers.push(modifier);
4678
4740
  }
4679
4741
  }
@@ -4739,7 +4801,7 @@ var VueCompilerDOM = (function(exports) {
4739
4801
  source: ""
4740
4802
  }));
4741
4803
  const child = node.children[0];
4742
- if (child.type === 1) {
4804
+ if (child.type === 1 && !findDir(child, "if")) {
4743
4805
  for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
4744
4806
  type: 6,
4745
4807
  name: "persisted",
@@ -4788,7 +4850,7 @@ var VueCompilerDOM = (function(exports) {
4788
4850
  }
4789
4851
  return true;
4790
4852
  }
4791
- const headings = new Set([
4853
+ const headings = /* @__PURE__ */ new Set([
4792
4854
  "h1",
4793
4855
  "h2",
4794
4856
  "h3",
@@ -4800,7 +4862,7 @@ var VueCompilerDOM = (function(exports) {
4800
4862
  /**
4801
4863
  * maps element to set of elements that can be it's children, no other */
4802
4864
  const onlyValidChildren = {
4803
- head: new Set([
4865
+ head: /* @__PURE__ */ new Set([
4804
4866
  "base",
4805
4867
  "basefront",
4806
4868
  "bgsound",
@@ -4813,24 +4875,24 @@ var VueCompilerDOM = (function(exports) {
4813
4875
  "script",
4814
4876
  "template"
4815
4877
  ]),
4816
- optgroup: new Set(["option"]),
4817
- select: new Set([
4878
+ optgroup: /* @__PURE__ */ new Set(["option"]),
4879
+ select: /* @__PURE__ */ new Set([
4818
4880
  "optgroup",
4819
4881
  "option",
4820
4882
  "hr"
4821
4883
  ]),
4822
- table: new Set([
4884
+ table: /* @__PURE__ */ new Set([
4823
4885
  "caption",
4824
4886
  "colgroup",
4825
4887
  "tbody",
4826
4888
  "tfoot",
4827
4889
  "thead"
4828
4890
  ]),
4829
- tr: new Set(["td", "th"]),
4830
- colgroup: new Set(["col"]),
4831
- tbody: new Set(["tr"]),
4832
- thead: new Set(["tr"]),
4833
- tfoot: new Set(["tr"]),
4891
+ tr: /* @__PURE__ */ new Set(["td", "th"]),
4892
+ colgroup: /* @__PURE__ */ new Set(["col"]),
4893
+ tbody: /* @__PURE__ */ new Set(["tr"]),
4894
+ thead: /* @__PURE__ */ new Set(["tr"]),
4895
+ tfoot: /* @__PURE__ */ new Set(["tr"]),
4834
4896
  script: emptySet,
4835
4897
  iframe: emptySet,
4836
4898
  option: emptySet,
@@ -4841,30 +4903,30 @@ var VueCompilerDOM = (function(exports) {
4841
4903
  /** maps elements to set of elements which can be it's parent, no other */
4842
4904
  const onlyValidParents = {
4843
4905
  html: emptySet,
4844
- body: new Set(["html"]),
4845
- head: new Set(["html"]),
4846
- td: new Set(["tr"]),
4847
- colgroup: new Set(["table"]),
4848
- caption: new Set(["table"]),
4849
- tbody: new Set(["table"]),
4850
- tfoot: new Set(["table"]),
4851
- col: new Set(["colgroup"]),
4852
- th: new Set(["tr"]),
4853
- thead: new Set(["table"]),
4854
- tr: new Set([
4906
+ body: /* @__PURE__ */ new Set(["html"]),
4907
+ head: /* @__PURE__ */ new Set(["html"]),
4908
+ td: /* @__PURE__ */ new Set(["tr"]),
4909
+ colgroup: /* @__PURE__ */ new Set(["table"]),
4910
+ caption: /* @__PURE__ */ new Set(["table"]),
4911
+ tbody: /* @__PURE__ */ new Set(["table"]),
4912
+ tfoot: /* @__PURE__ */ new Set(["table"]),
4913
+ col: /* @__PURE__ */ new Set(["colgroup"]),
4914
+ th: /* @__PURE__ */ new Set(["tr"]),
4915
+ thead: /* @__PURE__ */ new Set(["table"]),
4916
+ tr: /* @__PURE__ */ new Set([
4855
4917
  "tbody",
4856
4918
  "thead",
4857
4919
  "tfoot"
4858
4920
  ]),
4859
- dd: new Set(["dl", "div"]),
4860
- dt: new Set(["dl", "div"]),
4861
- figcaption: new Set(["figure"]),
4862
- summary: new Set(["details"]),
4863
- area: new Set(["map"])
4921
+ dd: /* @__PURE__ */ new Set(["dl", "div"]),
4922
+ dt: /* @__PURE__ */ new Set(["dl", "div"]),
4923
+ figcaption: /* @__PURE__ */ new Set(["figure"]),
4924
+ summary: /* @__PURE__ */ new Set(["details"]),
4925
+ area: /* @__PURE__ */ new Set(["map"])
4864
4926
  };
4865
4927
  /** maps element to set of elements that can not be it's children, others can */
4866
4928
  const knownInvalidChildren = {
4867
- p: new Set([
4929
+ p: /* @__PURE__ */ new Set([
4868
4930
  "address",
4869
4931
  "article",
4870
4932
  "aside",
@@ -4899,7 +4961,7 @@ var VueCompilerDOM = (function(exports) {
4899
4961
  "table",
4900
4962
  "ul"
4901
4963
  ]),
4902
- svg: new Set([
4964
+ svg: /* @__PURE__ */ new Set([
4903
4965
  "b",
4904
4966
  "blockquote",
4905
4967
  "br",
@@ -4940,12 +5002,12 @@ var VueCompilerDOM = (function(exports) {
4940
5002
  };
4941
5003
  /** maps element to set of elements that can not be it's parent, others can */
4942
5004
  const knownInvalidParents = {
4943
- a: new Set(["a"]),
4944
- button: new Set(["button"]),
4945
- dd: new Set(["dd", "dt"]),
4946
- dt: new Set(["dd", "dt"]),
4947
- form: new Set(["form"]),
4948
- li: new Set(["li"]),
5005
+ a: /* @__PURE__ */ new Set(["a"]),
5006
+ button: /* @__PURE__ */ new Set(["button"]),
5007
+ dd: /* @__PURE__ */ new Set(["dd", "dt"]),
5008
+ dt: /* @__PURE__ */ new Set(["dd", "dt"]),
5009
+ form: /* @__PURE__ */ new Set(["form"]),
5010
+ li: /* @__PURE__ */ new Set(["li"]),
4949
5011
  h1: headings,
4950
5012
  h2: headings,
4951
5013
  h3: headings,