@vue/compiler-vapor 3.6.0-beta.14 → 3.6.0-beta.15

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-vapor v3.6.0-beta.14
2
+ * @vue/compiler-vapor v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -193,6 +193,13 @@ function getLiteralExpressionValue(exp, excludeNumber) {
193
193
  }
194
194
  return exp.isStatic ? exp.content : null;
195
195
  }
196
+ function isInTransition(context) {
197
+ const parentNode = context.parent && context.parent.node;
198
+ return !!(parentNode && isTransitionNode(parentNode));
199
+ }
200
+ function isTransitionNode(node) {
201
+ return node.type === 1 && isTransitionTag(node.tag);
202
+ }
196
203
  function isTransitionTag(tag) {
197
204
  tag = tag.toLowerCase();
198
205
  return tag === "transition" || tag === "vaportransition";
@@ -424,6 +431,7 @@ const defaultOptions = {
424
431
  bindingMetadata: _vue_shared.EMPTY_OBJ,
425
432
  inline: false,
426
433
  isTS: false,
434
+ eventDelegation: true,
427
435
  onError: _vue_compiler_dom.defaultOnError,
428
436
  onWarn: _vue_compiler_dom.defaultOnWarn
429
437
  };
@@ -2977,7 +2985,6 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
2977
2985
  let template = "";
2978
2986
  template += `<${tag}`;
2979
2987
  if (scopeId) template += ` ${scopeId}`;
2980
- const dynamicProps = [];
2981
2988
  if (propsResult[0]) {
2982
2989
  const [, dynamicArgs, expressions] = propsResult;
2983
2990
  context.registerEffect(expressions, {
@@ -2998,54 +3005,24 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
2998
3005
  };
2999
3006
  for (const prop of propsResult[1]) {
3000
3007
  const { key, values } = prop;
3008
+ let foldedValue;
3001
3009
  if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
3002
3010
  if (!prevWasQuoted) template += ` `;
3003
3011
  template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
3004
3012
  prevWasQuoted = true;
3005
- } else if (key.isStatic && !prop.modifier && (0, _vue_shared.isBooleanAttr)(key.content)) if (values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
3006
- const value = values[0].content === "''" ? "" : values[0].content;
3007
- appendTemplateProp(key.content, value);
3008
- } else {
3009
- const include = foldBooleanAttrValue(values);
3010
- if (include != null) {
3011
- if (include) appendTemplateProp(key.content);
3012
- } else {
3013
- dynamicProps.push(key.content);
3014
- context.registerEffect(values, {
3015
- type: 3,
3016
- element: context.reference(),
3017
- prop,
3018
- tag
3019
- }, getEffectIndex);
3020
- }
3021
- }
3022
- else if (key.isStatic && !prop.modifier && hasBoundValue(values)) {
3023
- let foldedValue;
3024
- if (key.content === "class") foldedValue = foldClassValues(values);
3025
- else if (key.content === "style") foldedValue = foldStyleValues(values);
3026
- if (foldedValue != null) {
3027
- if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
3028
- } else {
3029
- dynamicProps.push(key.content);
3030
- context.registerEffect(values, {
3031
- type: 3,
3032
- element: context.reference(),
3033
- prop,
3034
- tag
3035
- }, getEffectIndex);
3036
- }
3037
3013
  } else if (key.isStatic && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
3038
3014
  const value = values[0].content === "''" ? "" : values[0].content;
3039
3015
  appendTemplateProp(key.content, value);
3040
- } else {
3041
- dynamicProps.push(key.content);
3042
- context.registerEffect(values, {
3043
- type: 3,
3044
- element: context.reference(),
3045
- prop,
3046
- tag
3047
- }, getEffectIndex);
3048
- }
3016
+ } else if (key.isStatic && !prop.modifier && (0, _vue_shared.isBooleanAttr)(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
3017
+ if (foldedValue) appendTemplateProp(key.content);
3018
+ } else if (key.isStatic && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
3019
+ if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
3020
+ } else context.registerEffect(values, {
3021
+ type: 3,
3022
+ element: context.reference(),
3023
+ prop,
3024
+ tag
3025
+ }, getEffectIndex);
3049
3026
  }
3050
3027
  }
3051
3028
  template += `>` + context.childrenTemplate.join("");
@@ -3794,12 +3771,10 @@ const transformVOn = (dir, node, context) => {
3794
3771
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = (0, _vue_compiler_dom.resolveModifiers)(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
3795
3772
  let keyOverride;
3796
3773
  const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
3797
- if (nonKeyModifiers.includes("middle")) {
3798
- if (keyOverride) {}
3799
- if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
3800
- }
3801
3774
  if (nonKeyModifiers.includes("right")) {
3802
3775
  if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "contextmenu"];
3776
+ } else if (nonKeyModifiers.includes("middle")) {
3777
+ if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
3803
3778
  }
3804
3779
  arg = normalizeStaticEventArg(arg, nonKeyModifiers);
3805
3780
  if (keyModifiers.length && (0, _vue_compiler_dom.isStaticExp)(arg) && !(0, _vue_compiler_dom.isKeyboardEvent)(`on${arg.content.toLowerCase()}`)) keyModifiers.length = 0;
@@ -3813,7 +3788,7 @@ const transformVOn = (dir, node, context) => {
3813
3788
  options: eventOptionModifiers
3814
3789
  }
3815
3790
  };
3816
- const delegate = arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
3791
+ const delegate = context.options.eventDelegation && arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
3817
3792
  const operation = {
3818
3793
  type: 6,
3819
3794
  element: context.reference(),
@@ -3834,8 +3809,8 @@ function normalizeStaticEventArg(arg, nonKeyModifiers) {
3834
3809
  if (!arg.isStatic) return arg;
3835
3810
  let normalized = arg;
3836
3811
  const isStaticClick = arg.content.toLowerCase() === "click";
3837
- if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "mouseup" });
3838
3812
  if (nonKeyModifiers.includes("right") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "contextmenu" });
3813
+ else if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = (0, _vue_shared.extend)({}, normalized, { content: "mouseup" });
3839
3814
  return normalized;
3840
3815
  }
3841
3816
  function hasStopHandlerForStaticEvent(node, eventName) {
@@ -4035,11 +4010,14 @@ function processIf(node, dir, context) {
4035
4010
  }
4036
4011
  while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
4037
4012
  if (dir.name === "else-if" && lastIfNode.negative) context.options.onError((0, _vue_compiler_dom.createCompilerError)(30, node.loc));
4038
- if (context.root.comment.length) {
4039
- node = wrapTemplate(node, ["else-if", "else"]);
4040
- context.node = node = (0, _vue_shared.extend)({}, node, { children: [...context.comment, ...node.children] });
4013
+ const comments = context.comment;
4014
+ if (comments.length) {
4015
+ if (!isInTransition(context)) {
4016
+ node = wrapTemplate(node, ["else-if", "else"]);
4017
+ context.node = node = (0, _vue_shared.extend)({}, node, { children: [...comments, ...node.children] });
4018
+ }
4019
+ comments.length = 0;
4041
4020
  }
4042
- context.root.comment = [];
4043
4021
  const [branch, onExit] = createIfBranch(node, context);
4044
4022
  if (dir.name === "else") lastIfNode.negative = branch;
4045
4023
  else lastIfNode.negative = {
@@ -3072,7 +3072,7 @@ type AsyncComponentContext<T, C = ConcreteComponent> = {
3072
3072
  setPendingRequest: (request: Promise<C> | null) => void;
3073
3073
  };
3074
3074
  declare function createAsyncComponentContext<T, C = ConcreteComponent>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): AsyncComponentContext<T, C>;
3075
- declare const useAsyncComponentState: (delay: number | undefined, timeout: number | undefined, onError: (err: Error) => void) => {
3075
+ declare const useAsyncComponentState: (delay: number | undefined, timeout: number | undefined, onError: (err: Error) => void, instance?: GenericComponentInstance | null) => {
3076
3076
  loaded: Ref<boolean>;
3077
3077
  error: Ref<Error | undefined>;
3078
3078
  delayed: Ref<boolean>;
@@ -25301,12 +25301,16 @@ interface VaporKeepAliveContext {
25301
25301
  //#endregion
25302
25302
  //#region packages/runtime-vapor/src/fragment.d.ts
25303
25303
  declare class VaporFragment<T extends Block$1 = Block$1> implements TransitionOptions {
25304
+ /**
25305
+ * @internal marker for duck typing to avoid direct instanceof check
25306
+ * which prevents tree-shaking of VaporFragment
25307
+ */
25308
+ readonly __vf = true;
25304
25309
  $key?: any;
25305
25310
  $transition?: VaporTransitionHooks | undefined;
25306
25311
  nodes: T;
25307
25312
  vnode?: VNode | null;
25308
25313
  anchor?: Node;
25309
- parentComponent?: GenericComponentInstance | null;
25310
25314
  validityPending?: boolean;
25311
25315
  isBlockValid?: () => boolean;
25312
25316
  insert?: (parent: ParentNode, anchor: Node | null, transitionHooks?: TransitionHooks) => void;
@@ -25330,6 +25334,11 @@ declare class ForFragment extends VaporFragment<Block$1[]> {
25330
25334
  onReset(fn: () => void): void;
25331
25335
  }
25332
25336
  declare class DynamicFragment extends VaporFragment {
25337
+ /**
25338
+ * @internal marker for duck typing to avoid direct instanceof check
25339
+ * which prevents tree-shaking of DynamicFragment
25340
+ */
25341
+ readonly __df = true;
25333
25342
  anchor: Node;
25334
25343
  scope: EffectScope | undefined;
25335
25344
  current?: BlockFn;
@@ -25355,7 +25364,7 @@ interface SlotBoundaryContext {
25355
25364
  markDirty: () => void;
25356
25365
  redirected?: SlotBoundaryContext;
25357
25366
  }
25358
- declare function isFragment(val: NonNullable<unknown>): val is VaporFragment;
25367
+ declare function isFragment(val: unknown): val is VaporFragment;
25359
25368
  //#endregion
25360
25369
  //#region packages/runtime-vapor/src/block.d.ts
25361
25370
  interface VaporTransitionHooks extends TransitionHooks {
@@ -26166,7 +26175,7 @@ interface ImportItem {
26166
26175
  //#region packages/compiler-core/src/transforms/transformElement.d.ts
26167
26176
  type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
26168
26177
  //#endregion
26169
- //#region node_modules/.pnpm/@babel+types@7.29.0/node_modules/@babel/types/lib/index-legacy.d.ts
26178
+ //#region node_modules/.pnpm/@babel+types@7.29.7/node_modules/@babel/types/lib/index-legacy.d.ts
26170
26179
  // NOTE: This file is autogenerated. Do not modify.
26171
26180
  // See packages/babel-types/scripts/generators/typescript-legacy.ts for script used.
26172
26181
  interface BaseComment {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-vapor v3.6.0-beta.14
2
+ * @vue/compiler-vapor v3.6.0-beta.15
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -16248,7 +16248,7 @@ const tokenizer = new Tokenizer(stack, {
16248
16248
  }
16249
16249
  },
16250
16250
  oncdata(start, end) {
16251
- if (stack[0].ns !== 0) onText(getSlice(start, end), start, end);
16251
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) onText(getSlice(start, end), start, end);
16252
16252
  else emitError(1, start - 9);
16253
16253
  },
16254
16254
  onprocessinginstruction(start) {
@@ -19134,6 +19134,13 @@ function getLiteralExpressionValue(exp, excludeNumber) {
19134
19134
  }
19135
19135
  return exp.isStatic ? exp.content : null;
19136
19136
  }
19137
+ function isInTransition(context) {
19138
+ const parentNode = context.parent && context.parent.node;
19139
+ return !!(parentNode && isTransitionNode(parentNode));
19140
+ }
19141
+ function isTransitionNode(node) {
19142
+ return node.type === 1 && isTransitionTag(node.tag);
19143
+ }
19137
19144
  function isTransitionTag(tag) {
19138
19145
  tag = tag.toLowerCase();
19139
19146
  return tag === "transition" || tag === "vaportransition";
@@ -19365,6 +19372,7 @@ const defaultOptions = {
19365
19372
  bindingMetadata: EMPTY_OBJ,
19366
19373
  inline: false,
19367
19374
  isTS: false,
19375
+ eventDelegation: true,
19368
19376
  onError: defaultOnError,
19369
19377
  onWarn: defaultOnWarn
19370
19378
  };
@@ -21977,7 +21985,6 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
21977
21985
  let template = "";
21978
21986
  template += `<${tag}`;
21979
21987
  if (scopeId) template += ` ${scopeId}`;
21980
- const dynamicProps = [];
21981
21988
  if (propsResult[0]) {
21982
21989
  const [, dynamicArgs, expressions] = propsResult;
21983
21990
  context.registerEffect(expressions, {
@@ -21998,54 +22005,24 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
21998
22005
  };
21999
22006
  for (const prop of propsResult[1]) {
22000
22007
  const { key, values } = prop;
22008
+ let foldedValue;
22001
22009
  if (context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
22002
22010
  if (!prevWasQuoted) template += ` `;
22003
22011
  template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
22004
22012
  prevWasQuoted = true;
22005
- } else if (key.isStatic && !prop.modifier && isBooleanAttr(key.content)) if (values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
22006
- const value = values[0].content === "''" ? "" : values[0].content;
22007
- appendTemplateProp(key.content, value);
22008
- } else {
22009
- const include = foldBooleanAttrValue(values);
22010
- if (include != null) {
22011
- if (include) appendTemplateProp(key.content);
22012
- } else {
22013
- dynamicProps.push(key.content);
22014
- context.registerEffect(values, {
22015
- type: 3,
22016
- element: context.reference(),
22017
- prop,
22018
- tag
22019
- }, getEffectIndex);
22020
- }
22021
- }
22022
- else if (key.isStatic && !prop.modifier && hasBoundValue(values)) {
22023
- let foldedValue;
22024
- if (key.content === "class") foldedValue = foldClassValues(values);
22025
- else if (key.content === "style") foldedValue = foldStyleValues(values);
22026
- if (foldedValue != null) {
22027
- if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
22028
- } else {
22029
- dynamicProps.push(key.content);
22030
- context.registerEffect(values, {
22031
- type: 3,
22032
- element: context.reference(),
22033
- prop,
22034
- tag
22035
- }, getEffectIndex);
22036
- }
22037
22013
  } else if (key.isStatic && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
22038
22014
  const value = values[0].content === "''" ? "" : values[0].content;
22039
22015
  appendTemplateProp(key.content, value);
22040
- } else {
22041
- dynamicProps.push(key.content);
22042
- context.registerEffect(values, {
22043
- type: 3,
22044
- element: context.reference(),
22045
- prop,
22046
- tag
22047
- }, getEffectIndex);
22048
- }
22016
+ } else if (key.isStatic && !prop.modifier && isBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
22017
+ if (foldedValue) appendTemplateProp(key.content);
22018
+ } else if (key.isStatic && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
22019
+ if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
22020
+ } else context.registerEffect(values, {
22021
+ type: 3,
22022
+ element: context.reference(),
22023
+ prop,
22024
+ tag
22025
+ }, getEffectIndex);
22049
22026
  }
22050
22027
  }
22051
22028
  template += `>` + context.childrenTemplate.join("");
@@ -22774,12 +22751,10 @@ const transformVOn = (dir, node, context) => {
22774
22751
  const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
22775
22752
  let keyOverride;
22776
22753
  const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
22777
- if (nonKeyModifiers.includes("middle")) {
22778
- if (keyOverride) {}
22779
- if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
22780
- }
22781
22754
  if (nonKeyModifiers.includes("right")) {
22782
22755
  if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "contextmenu"];
22756
+ } else if (nonKeyModifiers.includes("middle")) {
22757
+ if (!isStaticClick && !arg.isStatic) keyOverride = ["click", "mouseup"];
22783
22758
  }
22784
22759
  arg = normalizeStaticEventArg(arg, nonKeyModifiers);
22785
22760
  if (keyModifiers.length && isStaticExp(arg) && !isKeyboardEvent(`on${arg.content.toLowerCase()}`)) keyModifiers.length = 0;
@@ -22793,7 +22768,7 @@ const transformVOn = (dir, node, context) => {
22793
22768
  options: eventOptionModifiers
22794
22769
  }
22795
22770
  };
22796
- const delegate = arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
22771
+ const delegate = context.options.eventDelegation && arg.isStatic && !eventOptionModifiers.length && !hasStopHandlerForStaticEvent(node, arg.content) && delegatedEvents(arg.content);
22797
22772
  const operation = {
22798
22773
  type: 6,
22799
22774
  element: context.reference(),
@@ -22814,8 +22789,8 @@ function normalizeStaticEventArg(arg, nonKeyModifiers) {
22814
22789
  if (!arg.isStatic) return arg;
22815
22790
  let normalized = arg;
22816
22791
  const isStaticClick = arg.content.toLowerCase() === "click";
22817
- if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = extend({}, normalized, { content: "mouseup" });
22818
22792
  if (nonKeyModifiers.includes("right") && isStaticClick) normalized = extend({}, normalized, { content: "contextmenu" });
22793
+ else if (nonKeyModifiers.includes("middle") && isStaticClick) normalized = extend({}, normalized, { content: "mouseup" });
22819
22794
  return normalized;
22820
22795
  }
22821
22796
  function hasStopHandlerForStaticEvent(node, eventName) {
@@ -23015,11 +22990,14 @@ function processIf(node, dir, context) {
23015
22990
  }
23016
22991
  while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
23017
22992
  if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
23018
- if (context.root.comment.length) {
23019
- node = wrapTemplate(node, ["else-if", "else"]);
23020
- context.node = node = extend({}, node, { children: [...context.comment, ...node.children] });
22993
+ const comments = context.comment;
22994
+ if (comments.length) {
22995
+ if (!isInTransition(context)) {
22996
+ node = wrapTemplate(node, ["else-if", "else"]);
22997
+ context.node = node = extend({}, node, { children: [...comments, ...node.children] });
22998
+ }
22999
+ comments.length = 0;
23021
23000
  }
23022
- context.root.comment = [];
23023
23001
  const [branch, onExit] = createIfBranch(node, context);
23024
23002
  if (dir.name === "else") lastIfNode.negative = branch;
23025
23003
  else lastIfNode.negative = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-vapor",
3
- "version": "3.6.0-beta.14",
3
+ "version": "3.6.0-beta.15",
4
4
  "description": "@vue/compiler-vapor",
5
5
  "main": "dist/compiler-vapor.cjs.js",
6
6
  "module": "dist/compiler-vapor.esm-browser.js",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-vapor#readme",
44
44
  "dependencies": {
45
- "@babel/parser": "^7.29.3",
45
+ "@babel/parser": "^7.29.7",
46
46
  "estree-walker": "^2.0.2",
47
47
  "source-map-js": "^1.2.1",
48
- "@vue/compiler-dom": "3.6.0-beta.14",
49
- "@vue/shared": "3.6.0-beta.14"
48
+ "@vue/shared": "3.6.0-beta.15",
49
+ "@vue/compiler-dom": "3.6.0-beta.15"
50
50
  }
51
51
  }