@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
  **/
@@ -187,9 +187,7 @@ const transformModel$1 = (dir, node, context) => {
187
187
  isInvalidType = true;
188
188
  context.onError(createDOMCompilerError(60, dir.loc));
189
189
  break;
190
- default:
191
- process.env.NODE_ENV !== "production" && checkDuplicatedValue();
192
- break;
190
+ default: process.env.NODE_ENV !== "production" && checkDuplicatedValue();
193
191
  }
194
192
  } else if (hasDynamicKeyVBind(node)) directiveToUse = V_MODEL_DYNAMIC;
195
193
  else process.env.NODE_ENV !== "production" && checkDuplicatedValue();
@@ -202,27 +200,37 @@ const transformModel$1 = (dir, node, context) => {
202
200
  };
203
201
  //#endregion
204
202
  //#region packages/compiler-dom/src/transforms/vOn.ts
205
- const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
206
- const isNonKeyModifier = /* @__PURE__ */ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
207
- const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
208
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
203
+ const isEventOptionModifier = /*@__PURE__*/ makeMap(`passive,once,capture`);
204
+ const isNonKeyModifier = /*@__PURE__*/ makeMap("stop,prevent,self,ctrl,shift,alt,meta,exact,middle");
205
+ const maybeKeyModifier = /*@__PURE__*/ makeMap("left,right");
206
+ const isKeyboardEvent = /*@__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`);
209
207
  const resolveModifiers = (key, modifiers, context, loc) => {
210
208
  const keyModifiers = [];
211
209
  const nonKeyModifiers = [];
212
210
  const eventOptionModifiers = [];
213
211
  for (let i = 0; i < modifiers.length; i++) {
214
212
  const modifier = modifiers[i].content;
213
+ if (modifier === "delegate") {
214
+ if (context) {
215
+ const error = /* @__PURE__ */ new SyntaxError(`.delegate modifier is only supported in Vapor components.`);
216
+ error.loc = modifiers[i].loc;
217
+ context.onWarn(error);
218
+ }
219
+ continue;
220
+ }
215
221
  if (modifier === "native" && context && checkCompatEnabled("COMPILER_V_ON_NATIVE", context, loc)) eventOptionModifiers.push(modifier);
216
222
  else if (isEventOptionModifier(modifier)) eventOptionModifiers.push(modifier);
217
223
  else {
218
224
  const keyString = isString(key) ? key : isStaticExp(key) ? key.content : null;
219
- if (maybeKeyModifier(modifier)) if (keyString) if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
220
- else nonKeyModifiers.push(modifier);
221
- else {
222
- keyModifiers.push(modifier);
223
- nonKeyModifiers.push(modifier);
224
- }
225
- else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
225
+ if (maybeKeyModifier(modifier)) {
226
+ if (keyString) {
227
+ if (isKeyboardEvent(keyString.toLowerCase())) keyModifiers.push(modifier);
228
+ else nonKeyModifiers.push(modifier);
229
+ } else {
230
+ keyModifiers.push(modifier);
231
+ nonKeyModifiers.push(modifier);
232
+ }
233
+ } else if (isNonKeyModifier(modifier)) nonKeyModifiers.push(modifier);
226
234
  else keyModifiers.push(modifier);
227
235
  }
228
236
  }
@@ -288,7 +296,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
288
296
  source: ""
289
297
  }));
290
298
  const child = node.children[0];
291
- if (child.type === 1) {
299
+ if (child.type === 1 && !findDir(child, "if")) {
292
300
  for (const p of child.props) if (p.type === 7 && p.name === "show") node.props.push({
293
301
  type: 6,
294
302
  name: "persisted",
@@ -337,7 +345,7 @@ function isValidHTMLNesting(parent, child) {
337
345
  }
338
346
  return true;
339
347
  }
340
- const headings = new Set([
348
+ const headings = /* @__PURE__ */ new Set([
341
349
  "h1",
342
350
  "h2",
343
351
  "h3",
@@ -349,7 +357,7 @@ const emptySet = /* @__PURE__ */ new Set([]);
349
357
  /**
350
358
  * maps element to set of elements that can be it's children, no other */
351
359
  const onlyValidChildren = {
352
- head: new Set([
360
+ head: /* @__PURE__ */ new Set([
353
361
  "base",
354
362
  "basefront",
355
363
  "bgsound",
@@ -362,24 +370,24 @@ const onlyValidChildren = {
362
370
  "script",
363
371
  "template"
364
372
  ]),
365
- optgroup: new Set(["option"]),
366
- select: new Set([
373
+ optgroup: /* @__PURE__ */ new Set(["option"]),
374
+ select: /* @__PURE__ */ new Set([
367
375
  "optgroup",
368
376
  "option",
369
377
  "hr"
370
378
  ]),
371
- table: new Set([
379
+ table: /* @__PURE__ */ new Set([
372
380
  "caption",
373
381
  "colgroup",
374
382
  "tbody",
375
383
  "tfoot",
376
384
  "thead"
377
385
  ]),
378
- tr: new Set(["td", "th"]),
379
- colgroup: new Set(["col"]),
380
- tbody: new Set(["tr"]),
381
- thead: new Set(["tr"]),
382
- tfoot: new Set(["tr"]),
386
+ tr: /* @__PURE__ */ new Set(["td", "th"]),
387
+ colgroup: /* @__PURE__ */ new Set(["col"]),
388
+ tbody: /* @__PURE__ */ new Set(["tr"]),
389
+ thead: /* @__PURE__ */ new Set(["tr"]),
390
+ tfoot: /* @__PURE__ */ new Set(["tr"]),
383
391
  script: emptySet,
384
392
  iframe: emptySet,
385
393
  option: emptySet,
@@ -390,30 +398,30 @@ const onlyValidChildren = {
390
398
  /** maps elements to set of elements which can be it's parent, no other */
391
399
  const onlyValidParents = {
392
400
  html: emptySet,
393
- body: new Set(["html"]),
394
- head: new Set(["html"]),
395
- td: new Set(["tr"]),
396
- colgroup: new Set(["table"]),
397
- caption: new Set(["table"]),
398
- tbody: new Set(["table"]),
399
- tfoot: new Set(["table"]),
400
- col: new Set(["colgroup"]),
401
- th: new Set(["tr"]),
402
- thead: new Set(["table"]),
403
- tr: new Set([
401
+ body: /* @__PURE__ */ new Set(["html"]),
402
+ head: /* @__PURE__ */ new Set(["html"]),
403
+ td: /* @__PURE__ */ new Set(["tr"]),
404
+ colgroup: /* @__PURE__ */ new Set(["table"]),
405
+ caption: /* @__PURE__ */ new Set(["table"]),
406
+ tbody: /* @__PURE__ */ new Set(["table"]),
407
+ tfoot: /* @__PURE__ */ new Set(["table"]),
408
+ col: /* @__PURE__ */ new Set(["colgroup"]),
409
+ th: /* @__PURE__ */ new Set(["tr"]),
410
+ thead: /* @__PURE__ */ new Set(["table"]),
411
+ tr: /* @__PURE__ */ new Set([
404
412
  "tbody",
405
413
  "thead",
406
414
  "tfoot"
407
415
  ]),
408
- dd: new Set(["dl", "div"]),
409
- dt: new Set(["dl", "div"]),
410
- figcaption: new Set(["figure"]),
411
- summary: new Set(["details"]),
412
- area: new Set(["map"])
416
+ dd: /* @__PURE__ */ new Set(["dl", "div"]),
417
+ dt: /* @__PURE__ */ new Set(["dl", "div"]),
418
+ figcaption: /* @__PURE__ */ new Set(["figure"]),
419
+ summary: /* @__PURE__ */ new Set(["details"]),
420
+ area: /* @__PURE__ */ new Set(["map"])
413
421
  };
414
422
  /** maps element to set of elements that can not be it's children, others can */
415
423
  const knownInvalidChildren = {
416
- p: new Set([
424
+ p: /* @__PURE__ */ new Set([
417
425
  "address",
418
426
  "article",
419
427
  "aside",
@@ -448,7 +456,7 @@ const knownInvalidChildren = {
448
456
  "table",
449
457
  "ul"
450
458
  ]),
451
- svg: new Set([
459
+ svg: /* @__PURE__ */ new Set([
452
460
  "b",
453
461
  "blockquote",
454
462
  "br",
@@ -489,12 +497,12 @@ const knownInvalidChildren = {
489
497
  };
490
498
  /** maps element to set of elements that can not be it's parent, others can */
491
499
  const knownInvalidParents = {
492
- a: new Set(["a"]),
493
- button: new Set(["button"]),
494
- dd: new Set(["dd", "dt"]),
495
- dt: new Set(["dd", "dt"]),
496
- form: new Set(["form"]),
497
- li: new Set(["li"]),
500
+ a: /* @__PURE__ */ new Set(["a"]),
501
+ button: /* @__PURE__ */ new Set(["button"]),
502
+ dd: /* @__PURE__ */ new Set(["dd", "dt"]),
503
+ dt: /* @__PURE__ */ new Set(["dd", "dt"]),
504
+ form: /* @__PURE__ */ new Set(["form"]),
505
+ li: /* @__PURE__ */ new Set(["li"]),
498
506
  h1: headings,
499
507
  h2: headings,
500
508
  h3: headings,