@vue/compiler-dom 3.6.0-rc.5 → 3.6.0-rc.7

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-rc.5
2
+ * @vue/compiler-dom v3.6.0-rc.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -11,7 +11,7 @@
11
11
  * \/\*#\_\_PURE\_\_\*\/
12
12
  * So that they can be tree-shaken if necessary.
13
13
  */
14
- /* @__NO_SIDE_EFFECTS__ */
14
+ /*@__NO_SIDE_EFFECTS__*/
15
15
  function makeMap(str) {
16
16
  const map = Object.create(null);
17
17
  for (const key of str.split(",")) map[key] = 1;
@@ -32,8 +32,8 @@ const isArray = Array.isArray;
32
32
  const isString = (val) => typeof val === "string";
33
33
  const isSymbol = (val) => typeof val === "symbol";
34
34
  const isObject = (val) => val !== null && typeof val === "object";
35
- const isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
36
- const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
35
+ const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
36
+ const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
37
37
  const cacheStringFunction = (fn) => {
38
38
  const cache = Object.create(null);
39
39
  return ((str) => {
@@ -161,22 +161,22 @@ const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,tr
161
161
  * Compiler only.
162
162
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
163
163
  */
164
- const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
164
+ const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
165
165
  /**
166
166
  * Compiler only.
167
167
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
168
168
  */
169
- const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
169
+ const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
170
170
  /**
171
171
  * Compiler only.
172
172
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
173
173
  */
174
- const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
174
+ const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
175
175
  /**
176
176
  * Compiler only.
177
177
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
178
178
  */
179
- const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
179
+ const isVoidTag = /*@__PURE__*/ makeMap(VOID_TAGS);
180
180
  //#endregion
181
181
  //#region packages/compiler-core/src/runtimeHelpers.ts
182
182
  const FRAGMENT = Symbol(`Fragment`);
@@ -721,13 +721,14 @@ var Tokenizer = class {
721
721
  }
722
722
  }
723
723
  stateInterpolationOpen(c) {
724
- if (c === this.delimiterOpen[this.delimiterIndex]) if (this.delimiterIndex === this.delimiterOpen.length - 1) {
725
- const start = this.index + 1 - this.delimiterOpen.length;
726
- if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
727
- this.state = 3;
728
- this.sectionStart = start;
729
- } else this.delimiterIndex++;
730
- else if (this.inRCDATA) {
724
+ if (c === this.delimiterOpen[this.delimiterIndex]) {
725
+ if (this.delimiterIndex === this.delimiterOpen.length - 1) {
726
+ const start = this.index + 1 - this.delimiterOpen.length;
727
+ if (start > this.sectionStart) this.cbs.ontext(this.sectionStart, start);
728
+ this.state = 3;
729
+ this.sectionStart = start;
730
+ } else this.delimiterIndex++;
731
+ } else if (this.inRCDATA) {
731
732
  this.state = 32;
732
733
  this.stateInRCDATA(c);
733
734
  } else {
@@ -743,13 +744,14 @@ var Tokenizer = class {
743
744
  }
744
745
  }
745
746
  stateInterpolationClose(c) {
746
- if (c === this.delimiterClose[this.delimiterIndex]) if (this.delimiterIndex === this.delimiterClose.length - 1) {
747
- this.cbs.oninterpolation(this.sectionStart, this.index + 1);
748
- if (this.inRCDATA) this.state = 32;
749
- else this.state = 1;
750
- this.sectionStart = this.index + 1;
751
- } else this.delimiterIndex++;
752
- else {
747
+ if (c === this.delimiterClose[this.delimiterIndex]) {
748
+ if (this.delimiterIndex === this.delimiterClose.length - 1) {
749
+ this.cbs.oninterpolation(this.sectionStart, this.index + 1);
750
+ if (this.inRCDATA) this.state = 32;
751
+ else this.state = 1;
752
+ this.sectionStart = this.index + 1;
753
+ } else this.delimiterIndex++;
754
+ } else {
753
755
  this.state = 3;
754
756
  this.stateInterpolation(c);
755
757
  }
@@ -864,9 +866,10 @@ var Tokenizer = class {
864
866
  this.sectionStart = this.index;
865
867
  if (this.mode === 0) this.state = 6;
866
868
  else if (this.inSFCRoot) this.state = 34;
867
- else if (!this.inXML) if (c === 116) this.state = 30;
868
- else this.state = c === 115 ? 29 : 6;
869
- else this.state = 6;
869
+ else if (!this.inXML) {
870
+ if (c === 116) this.state = 30;
871
+ else this.state = c === 115 ? 29 : 6;
872
+ } else this.state = 6;
870
873
  } else if (c === 47) this.state = 8;
871
874
  else {
872
875
  this.state = 1;
@@ -1219,9 +1222,7 @@ var Tokenizer = class {
1219
1222
  case 24:
1220
1223
  this.stateInProcessingInstruction(c);
1221
1224
  break;
1222
- case 33:
1223
- this.stateInEntity();
1224
- break;
1225
+ case 33: this.stateInEntity();
1225
1226
  }
1226
1227
  this.index++;
1227
1228
  }
@@ -1250,9 +1251,10 @@ var Tokenizer = class {
1250
1251
  handleTrailingData() {
1251
1252
  const endIndex = this.buffer.length;
1252
1253
  if (this.sectionStart >= endIndex) return;
1253
- if (this.state === 28) if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
1254
- else this.cbs.oncomment(this.sectionStart, endIndex);
1255
- 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);
1254
+ if (this.state === 28) {
1255
+ if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex);
1256
+ else this.cbs.oncomment(this.sectionStart, endIndex);
1257
+ } 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
1258
  }
1257
1259
  emitCodePoint(cp, consumed) {}
1258
1260
  };
@@ -1585,9 +1587,7 @@ function extractIdentifiers(param, nodes = []) {
1585
1587
  case "RestElement":
1586
1588
  extractIdentifiers(param.argument, nodes);
1587
1589
  break;
1588
- case "AssignmentPattern":
1589
- extractIdentifiers(param.left, nodes);
1590
- break;
1590
+ case "AssignmentPattern": extractIdentifiers(param.left, nodes);
1591
1591
  }
1592
1592
  return nodes;
1593
1593
  }
@@ -1723,12 +1723,10 @@ const isMemberExpressionBrowser = (exp) => {
1723
1723
  if (!--currentOpenParensCount) state = stateStack.pop();
1724
1724
  }
1725
1725
  break;
1726
- case 3:
1727
- if (char === currentStringType) {
1728
- state = stateStack.pop();
1729
- currentStringType = null;
1730
- }
1731
- break;
1726
+ case 3: if (char === currentStringType) {
1727
+ state = stateStack.pop();
1728
+ currentStringType = null;
1729
+ }
1732
1730
  }
1733
1731
  }
1734
1732
  return !currentOpenBracketCount && !currentOpenParensCount;
@@ -1799,7 +1797,7 @@ function isTemplateNode(node) {
1799
1797
  function isSlotOutlet(node) {
1800
1798
  return node.type === 1 && node.tagType === 2;
1801
1799
  }
1802
- const propsHelperSet = new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
1800
+ const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
1803
1801
  function getUnnormalizedProps(props, callPath = []) {
1804
1802
  if (props && !isString(props) && props.type === 14) {
1805
1803
  const callee = props.callee;
@@ -1842,9 +1840,10 @@ function injectProp(node, prop, context) {
1842
1840
  propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [createObjectExpression([prop]), props]);
1843
1841
  if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) parentCall = callPath[callPath.length - 2];
1844
1842
  }
1845
- if (node.type === 13) if (parentCall) parentCall.arguments[0] = propsWithInjection;
1846
- else node.props = propsWithInjection;
1847
- else if (parentCall) parentCall.arguments[0] = propsWithInjection;
1843
+ if (node.type === 13) {
1844
+ if (parentCall) parentCall.arguments[0] = propsWithInjection;
1845
+ else node.props = propsWithInjection;
1846
+ } else if (parentCall) parentCall.arguments[0] = propsWithInjection;
1848
1847
  else node.arguments[2] = propsWithInjection;
1849
1848
  }
1850
1849
  function injectSlotKey(node, prop) {
@@ -2159,10 +2158,7 @@ const tokenizer = new Tokenizer(stack, {
2159
2158
  case 18:
2160
2159
  case 19:
2161
2160
  case 20:
2162
- case 21:
2163
- emitError(9, end);
2164
- break;
2165
- default: break;
2161
+ case 21: emitError(9, end);
2166
2162
  }
2167
2163
  for (let index = 0; index < stack.length; index++) {
2168
2164
  onCloseTag(stack[index], end - 1);
@@ -2312,7 +2308,7 @@ function backTrack(index, c) {
2312
2308
  while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
2313
2309
  return i;
2314
2310
  }
2315
- const specialTemplateDir = new Set([
2311
+ const specialTemplateDir = /* @__PURE__ */ new Set([
2316
2312
  "if",
2317
2313
  "else",
2318
2314
  "else-if",
@@ -2348,16 +2344,18 @@ function condenseWhitespace(nodes) {
2348
2344
  let removedWhitespace = false;
2349
2345
  for (let i = 0; i < nodes.length; i++) {
2350
2346
  const node = nodes[i];
2351
- if (node.type === 2) if (!inPre) {
2352
- if (isAllWhitespace(node.content)) {
2353
- const prev = nodes[i - 1] && nodes[i - 1].type;
2354
- const next = nodes[i + 1] && nodes[i + 1].type;
2355
- if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2356
- removedWhitespace = true;
2357
- nodes[i] = null;
2358
- } else node.content = " ";
2359
- } else if (shouldCondense) node.content = condense(node.content);
2360
- } else node.content = node.content.replace(windowsNewlineRE, "\n");
2347
+ if (node.type === 2) {
2348
+ if (!inPre) {
2349
+ if (isAllWhitespace(node.content)) {
2350
+ const prev = nodes[i - 1] && nodes[i - 1].type;
2351
+ const next = nodes[i + 1] && nodes[i + 1].type;
2352
+ if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
2353
+ removedWhitespace = true;
2354
+ nodes[i] = null;
2355
+ } else node.content = " ";
2356
+ } else if (shouldCondense) node.content = condense(node.content);
2357
+ } else node.content = node.content.replace(windowsNewlineRE, "\n");
2358
+ }
2361
2359
  }
2362
2360
  return removedWhitespace ? nodes.filter(Boolean) : nodes;
2363
2361
  }
@@ -2618,7 +2616,7 @@ function getConstantType(node, context) {
2618
2616
  default: return 0;
2619
2617
  }
2620
2618
  }
2621
- const allowHoistedHelperSet = new Set([
2619
+ const allowHoistedHelperSet = /* @__PURE__ */ new Set([
2622
2620
  NORMALIZE_CLASS,
2623
2621
  NORMALIZE_STYLE,
2624
2622
  NORMALIZE_PROPS,
@@ -2776,7 +2774,7 @@ function transform(root, options) {
2776
2774
  traverseNode(root, context);
2777
2775
  if (options.hoistStatic) cacheStatic(root, context);
2778
2776
  if (!options.ssr) createRootCodegen(root, context);
2779
- root.helpers = new Set([...context.helpers.keys()]);
2777
+ root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]);
2780
2778
  root.components = [...context.components];
2781
2779
  root.directives = [...context.directives];
2782
2780
  root.imports = context.imports;
@@ -2823,8 +2821,10 @@ function traverseNode(node, context) {
2823
2821
  const exitFns = [];
2824
2822
  for (let i = 0; i < nodeTransforms.length; i++) {
2825
2823
  const onExit = nodeTransforms[i](node, context);
2826
- if (onExit) if (isArray(onExit)) exitFns.push(...onExit);
2827
- else exitFns.push(onExit);
2824
+ if (onExit) {
2825
+ if (isArray(onExit)) exitFns.push(...onExit);
2826
+ else exitFns.push(onExit);
2827
+ }
2828
2828
  if (!context.currentNode) return;
2829
2829
  else node = context.currentNode;
2830
2830
  }
@@ -2841,9 +2841,7 @@ function traverseNode(node, context) {
2841
2841
  case 10:
2842
2842
  case 11:
2843
2843
  case 1:
2844
- case 0:
2845
- traverseChildren(node, context);
2846
- break;
2844
+ case 0: traverseChildren(node, context);
2847
2845
  }
2848
2846
  context.currentNode = node;
2849
2847
  let i = exitFns.length;
@@ -3049,10 +3047,12 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
3049
3047
  if (isString(node)) push(node, -3);
3050
3048
  else if (isArray(node)) genNodeListAsArray(node, context);
3051
3049
  else genNode(node, context);
3052
- if (i < nodes.length - 1) if (multilines) {
3053
- comma && push(",");
3054
- newline();
3055
- } else comma && push(", ");
3050
+ if (i < nodes.length - 1) {
3051
+ if (multilines) {
3052
+ comma && push(",");
3053
+ newline();
3054
+ } else comma && push(", ");
3055
+ }
3056
3056
  }
3057
3057
  }
3058
3058
  function genNode(node, context) {
@@ -3164,8 +3164,10 @@ function genVNodeCall(node, context) {
3164
3164
  const { push, helper, pure } = context;
3165
3165
  const { tag, props, children, patchFlag, dynamicProps, directives, isBlock, disableTracking, isComponent } = node;
3166
3166
  let patchFlagString;
3167
- if (patchFlag) if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
3168
- else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
3167
+ if (patchFlag) {
3168
+ if (patchFlag < 0) patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
3169
+ else patchFlagString = patchFlag + ` /* ${Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `)} */`;
3170
+ }
3169
3171
  if (directives) push(helper(WITH_DIRECTIVES) + `(`);
3170
3172
  if (isBlock) push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `);
3171
3173
  if (pure) push(PURE_ANNOTATION);
@@ -3327,7 +3329,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
3327
3329
  }
3328
3330
  //#endregion
3329
3331
  //#region packages/compiler-core/src/transforms/transformExpression.ts
3330
- const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
3332
+ const isLiteralWhitelisted = /*@__PURE__*/ makeMap("true,false,null,this");
3331
3333
  const transformExpression = (node, context) => {
3332
3334
  if (node.type === 5) node.content = processExpression(node.content, context);
3333
3335
  else if (node.type === 1) {
@@ -3440,16 +3442,17 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3440
3442
  const keyProperty = createObjectProperty(`key`, createSimpleExpression(`${keyIndex}`, false, locStub, 2));
3441
3443
  const { children } = branch;
3442
3444
  const firstChild = children[0];
3443
- if (children.length !== 1 || firstChild.type !== 1) if (children.length === 1 && firstChild.type === 11) {
3444
- const vnodeCall = firstChild.codegenNode;
3445
- injectProp(vnodeCall, keyProperty, context);
3446
- return vnodeCall;
3445
+ if (children.length !== 1 || firstChild.type !== 1) {
3446
+ if (children.length === 1 && firstChild.type === 11) {
3447
+ const vnodeCall = firstChild.codegenNode;
3448
+ injectProp(vnodeCall, keyProperty, context);
3449
+ return vnodeCall;
3450
+ } else {
3451
+ let patchFlag = 64;
3452
+ if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
3453
+ return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
3454
+ }
3447
3455
  } else {
3448
- let patchFlag = 64;
3449
- if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) patchFlag |= 2048;
3450
- return createVNodeCall(context, helper(FRAGMENT), createObjectExpression([keyProperty]), children, patchFlag, void 0, void 0, true, false, false, branch.loc);
3451
- }
3452
- else {
3453
3456
  const ret = firstChild.codegenNode;
3454
3457
  const vnodeCall = getMemoedVNodeCall(ret);
3455
3458
  if (vnodeCall.type === 13) convertToBlock(vnodeCall, context);
@@ -3470,9 +3473,10 @@ function isSameKey(a, b) {
3470
3473
  return true;
3471
3474
  }
3472
3475
  function getParentCondition(node) {
3473
- while (true) if (node.type === 19) if (node.alternate.type === 19) node = node.alternate;
3474
- else return node;
3475
- else if (node.type === 20) node = node.value;
3476
+ while (true) if (node.type === 19) {
3477
+ if (node.alternate.type === 19) node = node.alternate;
3478
+ else return node;
3479
+ } else if (node.type === 20) node = node.value;
3476
3480
  }
3477
3481
  //#endregion
3478
3482
  //#region packages/compiler-core/src/transforms/vFor.ts
@@ -3511,10 +3515,12 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
3511
3515
  childBlock = children[0].codegenNode;
3512
3516
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
3513
3517
  const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
3514
- if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
3515
- removeHelper(OPEN_BLOCK);
3516
- removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3517
- } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3518
+ if (childBlock.isBlock !== shouldUseBlock) {
3519
+ if (childBlock.isBlock) {
3520
+ removeHelper(OPEN_BLOCK);
3521
+ removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3522
+ } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3523
+ }
3518
3524
  childBlock.isBlock = shouldUseBlock;
3519
3525
  if (childBlock.isBlock) {
3520
3526
  helper(OPEN_BLOCK);
@@ -3716,8 +3722,10 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
3716
3722
  return createObjectProperty(`default`, fn);
3717
3723
  };
3718
3724
  if (!hasTemplateSlots) slotsProperties.push(buildDefaultSlotProperty(void 0, children));
3719
- else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
3720
- else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
3725
+ else if (implicitDefaultChildren.length && !implicitDefaultChildren.every(isWhitespaceText)) {
3726
+ if (hasNamedDefaultSlot) context.onError(createCompilerError(39, implicitDefaultChildren[0].loc));
3727
+ else slotsProperties.push(buildDefaultSlotProperty(void 0, implicitDefaultChildren));
3728
+ }
3721
3729
  }
3722
3730
  const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1;
3723
3731
  let slots = createObjectExpression(slotsProperties.concat(createObjectProperty(`_`, createSimpleExpression(slotFlag + ` /* ${slotFlagsText[slotFlag]} */`, false))), loc);
@@ -3743,10 +3751,7 @@ function hasForwardedSlots(children) {
3743
3751
  if (hasForwardedSlots(child.branches)) return true;
3744
3752
  break;
3745
3753
  case 10:
3746
- case 11:
3747
- if (hasForwardedSlots(child.children)) return true;
3748
- break;
3749
- default: break;
3754
+ case 11: if (hasForwardedSlots(child.children)) return true;
3750
3755
  }
3751
3756
  }
3752
3757
  return false;
@@ -3907,29 +3912,30 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3907
3912
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
3908
3913
  if (!arg && (isVBind || isVOn)) {
3909
3914
  hasDynamicKeys = true;
3910
- if (exp) if (isVBind) {
3911
- pushMergeArg();
3912
- if (mergeArgs.some((arg) => {
3913
- if (arg.type === 15) return arg.properties.some(({ key }) => {
3914
- if (key.type !== 4 || !key.isStatic) return true;
3915
- return key.content !== "class" && key.content !== "style" && !isOn(key.content);
3916
- });
3917
- else return true;
3918
- })) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
3919
- if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
3920
- mergeArgs.unshift(exp);
3921
- continue;
3922
- }
3923
- pushRefVForMarker();
3924
- pushMergeArg();
3925
- mergeArgs.push(exp);
3926
- } else pushMergeArg({
3927
- type: 14,
3928
- loc,
3929
- callee: context.helper(TO_HANDLERS),
3930
- arguments: isComponent ? [exp] : [exp, `true`]
3931
- });
3932
- else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
3915
+ if (exp) {
3916
+ if (isVBind) {
3917
+ pushMergeArg();
3918
+ if (mergeArgs.some((arg) => {
3919
+ if (arg.type === 15) return arg.properties.some(({ key }) => {
3920
+ if (key.type !== 4 || !key.isStatic) return true;
3921
+ return key.content !== "class" && key.content !== "style" && !isOn(key.content);
3922
+ });
3923
+ else return true;
3924
+ })) checkCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context, loc);
3925
+ if (isCompatEnabled("COMPILER_V_BIND_OBJECT_ORDER", context)) {
3926
+ mergeArgs.unshift(exp);
3927
+ continue;
3928
+ }
3929
+ pushRefVForMarker();
3930
+ pushMergeArg();
3931
+ mergeArgs.push(exp);
3932
+ } else pushMergeArg({
3933
+ type: 14,
3934
+ loc,
3935
+ callee: context.helper(TO_HANDLERS),
3936
+ arguments: isComponent ? [exp] : [exp, `true`]
3937
+ });
3938
+ } else context.onError(createCompilerError(isVBind ? 34 : 35, loc));
3933
3939
  continue;
3934
3940
  }
3935
3941
  if (isVBind && modifiers.some((mod) => mod.content === "prop")) patchFlag |= 32;
@@ -3987,9 +3993,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3987
3993
  } else propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [propsExpression]);
3988
3994
  break;
3989
3995
  case 14: break;
3990
- default:
3991
- propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
3992
- break;
3996
+ default: propsExpression = createCallExpression(context.helper(NORMALIZE_PROPS), [createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [propsExpression])]);
3993
3997
  }
3994
3998
  return {
3995
3999
  props: propsExpression,
@@ -4095,10 +4099,12 @@ function processSlotOutlet(node, context) {
4095
4099
  for (let i = 0; i < node.props.length; i++) {
4096
4100
  const p = node.props[i];
4097
4101
  if (p.type === 6) {
4098
- if (p.value) if (p.name === "name") slotName = JSON.stringify(p.value.content);
4099
- else {
4100
- p.name = camelize(p.name);
4101
- nonNameProps.push(p);
4102
+ if (p.value) {
4103
+ if (p.name === "name") slotName = JSON.stringify(p.value.content);
4104
+ else {
4105
+ p.name = camelize(p.name);
4106
+ nonNameProps.push(p);
4107
+ }
4102
4108
  }
4103
4109
  } else if (p.name === "bind" && isStaticArgOf(p.arg, "name")) {
4104
4110
  if (p.exp) slotName = p.exp;
@@ -4124,17 +4130,18 @@ const transformOn = (dir, node, context, augmentor) => {
4124
4130
  const { loc, modifiers, arg } = dir;
4125
4131
  if (!dir.exp && !modifiers.length) context.onError(createCompilerError(35, loc));
4126
4132
  let eventName;
4127
- if (arg.type === 4) if (arg.isStatic) {
4128
- let rawName = arg.content;
4129
- if (rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
4130
- if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
4131
- eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
4132
- } else eventName = createCompoundExpression([
4133
- `${context.helperString(TO_HANDLER_KEY)}(`,
4134
- arg,
4135
- `)`
4136
- ]);
4137
- else {
4133
+ if (arg.type === 4) {
4134
+ if (arg.isStatic) {
4135
+ let rawName = arg.content;
4136
+ if (rawName.startsWith("vnode")) context.onError(createCompilerError(52, arg.loc));
4137
+ if (rawName.startsWith("vue:")) rawName = `vnode-${rawName.slice(4)}`;
4138
+ eventName = createSimpleExpression(node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? toHandlerKey(camelize(rawName)) : `on:${rawName}`, true, arg.loc);
4139
+ } else eventName = createCompoundExpression([
4140
+ `${context.helperString(TO_HANDLER_KEY)}(`,
4141
+ arg,
4142
+ `)`
4143
+ ]);
4144
+ } else {
4138
4145
  eventName = arg;
4139
4146
  eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`);
4140
4147
  eventName.children.push(`)`);
@@ -4170,11 +4177,14 @@ const transformBind = (dir, _node, context) => {
4170
4177
  arg.children.unshift(`(`);
4171
4178
  arg.children.push(`) || ""`);
4172
4179
  } else if (!arg.isStatic) arg.content = arg.content ? `${arg.content} || ""` : `""`;
4173
- if (modifiers.some((mod) => mod.content === "camel")) if (arg.type === 4) if (arg.isStatic) arg.content = camelize(arg.content);
4174
- else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4175
- else {
4176
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4177
- arg.children.push(`)`);
4180
+ if (modifiers.some((mod) => mod.content === "camel")) {
4181
+ if (arg.type === 4) {
4182
+ if (arg.isStatic) arg.content = camelize(arg.content);
4183
+ else arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
4184
+ } else {
4185
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
4186
+ arg.children.push(`)`);
4187
+ }
4178
4188
  }
4179
4189
  if (!context.inSSR) {
4180
4190
  if (modifiers.some((mod) => mod.content === "prop")) injectPrefix(arg, ".");
@@ -4183,9 +4193,10 @@ const transformBind = (dir, _node, context) => {
4183
4193
  return { props: [createObjectProperty(arg, exp)] };
4184
4194
  };
4185
4195
  const injectPrefix = (arg, prefix) => {
4186
- if (arg.type === 4) if (arg.isStatic) arg.content = prefix + arg.content;
4187
- else arg.content = `\`${prefix}\${${arg.content}}\``;
4188
- else {
4196
+ if (arg.type === 4) {
4197
+ if (arg.isStatic) arg.content = prefix + arg.content;
4198
+ else arg.content = `\`${prefix}\${${arg.content}}\``;
4199
+ } else {
4189
4200
  arg.children.unshift(`'${prefix}' + (`);
4190
4201
  arg.children.push(`)`);
4191
4202
  }
@@ -4332,11 +4343,12 @@ function parseFilter(node, context) {
4332
4343
  if (c === 96 && prev !== 92) inTemplateString = false;
4333
4344
  } else if (inRegex) {
4334
4345
  if (c === 47 && prev !== 92) inRegex = false;
4335
- } else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) if (expression === void 0) {
4336
- lastFilterIndex = i + 1;
4337
- expression = exp.slice(0, i).trim();
4338
- } else pushFilter();
4339
- else {
4346
+ } else if (c === 124 && exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
4347
+ if (expression === void 0) {
4348
+ lastFilterIndex = i + 1;
4349
+ expression = exp.slice(0, i).trim();
4350
+ } else pushFilter();
4351
+ } else {
4340
4352
  switch (c) {
4341
4353
  case 34:
4342
4354
  inDouble = true;
@@ -4362,9 +4374,7 @@ function parseFilter(node, context) {
4362
4374
  case 123:
4363
4375
  curly++;
4364
4376
  break;
4365
- case 125:
4366
- curly--;
4367
- break;
4377
+ case 125: curly--;
4368
4378
  }
4369
4379
  if (c === 47) {
4370
4380
  let j = i - 1;
@@ -4680,9 +4690,7 @@ const transformModel$1 = (dir, node, context) => {
4680
4690
  isInvalidType = true;
4681
4691
  context.onError(createDOMCompilerError(60, dir.loc));
4682
4692
  break;
4683
- default:
4684
- checkDuplicatedValue();
4685
- break;
4693
+ default: checkDuplicatedValue();
4686
4694
  }
4687
4695
  } else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
4688
4696
  else checkDuplicatedValue();
@@ -4695,10 +4703,10 @@ const transformModel$1 = (dir, node, context) => {
4695
4703
  };
4696
4704
  //#endregion
4697
4705
  //#region packages/compiler-dom/src/transforms/vOn.ts
4698
- const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
4699
- const isNonKeyModifier = /* @__PURE__ */ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
4700
- const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
4701
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
4706
+ const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
4707
+ const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
4708
+ const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
4709
+ const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
4702
4710
  const resolveModifiers = (key, modifiers, context, loc) => {
4703
4711
  const keyModifiers = [];
4704
4712
  const nonKeyModifiers = [];
@@ -4717,13 +4725,15 @@ const resolveModifiers = (key, modifiers, context, loc) => {
4717
4725
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
4718
4726
  else {
4719
4727
  const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
4720
- if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
4721
- else nonKeyModifiers.push(modifier);
4722
- else {
4723
- keyModifiers.push(modifier);
4724
- nonKeyModifiers.push(modifier);
4725
- }
4726
- else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
4728
+ if (maybeKeyModifier(modifier)) {
4729
+ if (keyString) {
4730
+ if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
4731
+ else nonKeyModifiers.push(modifier);
4732
+ } else {
4733
+ keyModifiers.push(modifier);
4734
+ nonKeyModifiers.push(modifier);
4735
+ }
4736
+ } else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
4727
4737
  else keyModifiers.push(modifier);
4728
4738
  }
4729
4739
  }
@@ -4838,7 +4848,7 @@ function isValidHTMLNesting(parent, child) {
4838
4848
  }
4839
4849
  return true;
4840
4850
  }
4841
- const headings = new Set([
4851
+ const headings = /* @__PURE__ */ new Set([
4842
4852
  "h1",
4843
4853
  "h2",
4844
4854
  "h3",
@@ -4850,7 +4860,7 @@ const emptySet = /* @__PURE__ */ new Set([]);
4850
4860
  /**
4851
4861
  * maps element to set of elements that can be it's children, no other */
4852
4862
  const onlyValidChildren = {
4853
- head: new Set([
4863
+ head: /* @__PURE__ */ new Set([
4854
4864
  "base",
4855
4865
  "basefront",
4856
4866
  "bgsound",
@@ -4863,24 +4873,24 @@ const onlyValidChildren = {
4863
4873
  "script",
4864
4874
  "template"
4865
4875
  ]),
4866
- optgroup: new Set(["option"]),
4867
- select: new Set([
4876
+ optgroup: /* @__PURE__ */ new Set(["option"]),
4877
+ select: /* @__PURE__ */ new Set([
4868
4878
  "optgroup",
4869
4879
  "option",
4870
4880
  "hr"
4871
4881
  ]),
4872
- table: new Set([
4882
+ table: /* @__PURE__ */ new Set([
4873
4883
  "caption",
4874
4884
  "colgroup",
4875
4885
  "tbody",
4876
4886
  "tfoot",
4877
4887
  "thead"
4878
4888
  ]),
4879
- tr: new Set(["td", "th"]),
4880
- colgroup: new Set(["col"]),
4881
- tbody: new Set(["tr"]),
4882
- thead: new Set(["tr"]),
4883
- tfoot: new Set(["tr"]),
4889
+ tr: /* @__PURE__ */ new Set(["td", "th"]),
4890
+ colgroup: /* @__PURE__ */ new Set(["col"]),
4891
+ tbody: /* @__PURE__ */ new Set(["tr"]),
4892
+ thead: /* @__PURE__ */ new Set(["tr"]),
4893
+ tfoot: /* @__PURE__ */ new Set(["tr"]),
4884
4894
  script: emptySet,
4885
4895
  iframe: emptySet,
4886
4896
  option: emptySet,
@@ -4891,30 +4901,30 @@ const onlyValidChildren = {
4891
4901
  /** maps elements to set of elements which can be it's parent, no other */
4892
4902
  const onlyValidParents = {
4893
4903
  html: emptySet,
4894
- body: new Set(["html"]),
4895
- head: new Set(["html"]),
4896
- td: new Set(["tr"]),
4897
- colgroup: new Set(["table"]),
4898
- caption: new Set(["table"]),
4899
- tbody: new Set(["table"]),
4900
- tfoot: new Set(["table"]),
4901
- col: new Set(["colgroup"]),
4902
- th: new Set(["tr"]),
4903
- thead: new Set(["table"]),
4904
- tr: new Set([
4904
+ body: /* @__PURE__ */ new Set(["html"]),
4905
+ head: /* @__PURE__ */ new Set(["html"]),
4906
+ td: /* @__PURE__ */ new Set(["tr"]),
4907
+ colgroup: /* @__PURE__ */ new Set(["table"]),
4908
+ caption: /* @__PURE__ */ new Set(["table"]),
4909
+ tbody: /* @__PURE__ */ new Set(["table"]),
4910
+ tfoot: /* @__PURE__ */ new Set(["table"]),
4911
+ col: /* @__PURE__ */ new Set(["colgroup"]),
4912
+ th: /* @__PURE__ */ new Set(["tr"]),
4913
+ thead: /* @__PURE__ */ new Set(["table"]),
4914
+ tr: /* @__PURE__ */ new Set([
4905
4915
  "tbody",
4906
4916
  "thead",
4907
4917
  "tfoot"
4908
4918
  ]),
4909
- dd: new Set(["dl", "div"]),
4910
- dt: new Set(["dl", "div"]),
4911
- figcaption: new Set(["figure"]),
4912
- summary: new Set(["details"]),
4913
- area: new Set(["map"])
4919
+ dd: /* @__PURE__ */ new Set(["dl", "div"]),
4920
+ dt: /* @__PURE__ */ new Set(["dl", "div"]),
4921
+ figcaption: /* @__PURE__ */ new Set(["figure"]),
4922
+ summary: /* @__PURE__ */ new Set(["details"]),
4923
+ area: /* @__PURE__ */ new Set(["map"])
4914
4924
  };
4915
4925
  /** maps element to set of elements that can not be it's children, others can */
4916
4926
  const knownInvalidChildren = {
4917
- p: new Set([
4927
+ p: /* @__PURE__ */ new Set([
4918
4928
  "address",
4919
4929
  "article",
4920
4930
  "aside",
@@ -4949,7 +4959,7 @@ const knownInvalidChildren = {
4949
4959
  "table",
4950
4960
  "ul"
4951
4961
  ]),
4952
- svg: new Set([
4962
+ svg: /* @__PURE__ */ new Set([
4953
4963
  "b",
4954
4964
  "blockquote",
4955
4965
  "br",
@@ -4990,12 +5000,12 @@ const knownInvalidChildren = {
4990
5000
  };
4991
5001
  /** maps element to set of elements that can not be it's parent, others can */
4992
5002
  const knownInvalidParents = {
4993
- a: new Set(["a"]),
4994
- button: new Set(["button"]),
4995
- dd: new Set(["dd", "dt"]),
4996
- dt: new Set(["dd", "dt"]),
4997
- form: new Set(["form"]),
4998
- li: new Set(["li"]),
5003
+ a: /* @__PURE__ */ new Set(["a"]),
5004
+ button: /* @__PURE__ */ new Set(["button"]),
5005
+ dd: /* @__PURE__ */ new Set(["dd", "dt"]),
5006
+ dt: /* @__PURE__ */ new Set(["dd", "dt"]),
5007
+ form: /* @__PURE__ */ new Set(["form"]),
5008
+ li: /* @__PURE__ */ new Set(["li"]),
4999
5009
  h1: headings,
5000
5010
  h2: headings,
5001
5011
  h3: headings,