@vue/compiler-dom 3.5.43 → 3.5.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.43
2
+ * @vue/compiler-dom v3.5.45
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -412,7 +412,8 @@ const transformTransition = (node, context) => {
412
412
  if (!node.children.length) {
413
413
  return;
414
414
  }
415
- if (hasMultipleChildren(node)) {
415
+ const multipleChildren = hasMultipleChildren(node);
416
+ if (multipleChildren) {
416
417
  context.onError(
417
418
  createDOMCompilerError(
418
419
  63,
@@ -502,7 +503,7 @@ const stringifyStatic = (children, context, parent) => {
502
503
  const child = children[i];
503
504
  const isCached = isParentCached || getCachedNode(child);
504
505
  if (isCached) {
505
- const result = analyzeNode(child);
506
+ const result = analyzeNode(child, context);
506
507
  if (result) {
507
508
  nc += result[0];
508
509
  ec += result[1];
@@ -529,7 +530,7 @@ const isStringifiableAttr = (name, ns) => {
529
530
  const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
530
531
  `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
531
532
  );
532
- function analyzeNode(node) {
533
+ function analyzeNode(node, context) {
533
534
  if (node.type === 1 && isNonStringifiable(node.tag)) {
534
535
  return false;
535
536
  }
@@ -560,6 +561,9 @@ function analyzeNode(node) {
560
561
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
561
562
  return bail();
562
563
  }
564
+ if (p.arg && p.arg.isStatic && (shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && context.isCustomElement(node2.tag)) {
565
+ return bail();
566
+ }
563
567
  if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
564
568
  return bail();
565
569
  }
@@ -607,8 +611,9 @@ function stringifyNode(node, context) {
607
611
  }
608
612
  }
609
613
  function stringifyElement(node, context) {
614
+ var _a;
610
615
  let res = `<${node.tag}`;
611
- let innerHTML = "";
616
+ let innerHTML = void 0;
612
617
  for (let i = 0; i < node.props.length; i++) {
613
618
  const p = node.props[i];
614
619
  if (p.type === 6) {
@@ -623,13 +628,10 @@ function stringifyElement(node, context) {
623
628
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
624
629
  continue;
625
630
  }
626
- if ((shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
627
- continue;
628
- }
629
631
  let evaluated = evaluateConstant(exp);
630
632
  if (evaluated != null) {
631
- const arg = p.arg && p.arg.content;
632
- if (arg === "hidden" && typeof evaluated === "number" && !shared.includeBooleanAttr(evaluated)) {
633
+ const arg = p.arg.content;
634
+ if ((shared.isBooleanAttr(arg) || arg === "hidden") && !shared.includeBooleanAttr(evaluated)) {
633
635
  continue;
634
636
  }
635
637
  if (arg === "class") {
@@ -642,7 +644,7 @@ function stringifyElement(node, context) {
642
644
  )}"`;
643
645
  }
644
646
  } else if (p.name === "html") {
645
- innerHTML = evaluateConstant(p.exp);
647
+ innerHTML = (_a = evaluateConstant(p.exp)) != null ? _a : "";
646
648
  } else if (p.name === "text") {
647
649
  innerHTML = shared.escapeHtml(
648
650
  shared.toDisplayString(evaluateConstant(p.exp))
@@ -654,7 +656,7 @@ function stringifyElement(node, context) {
654
656
  res += ` ${context.scopeId}`;
655
657
  }
656
658
  res += `>`;
657
- if (innerHTML) {
659
+ if (innerHTML !== void 0) {
658
660
  res += innerHTML;
659
661
  } else {
660
662
  for (let i = 0; i < node.children.length; i++) {
@@ -876,7 +878,8 @@ const validateHtmlNesting = (node, context) => {
876
878
 
877
879
  const DOMNodeTransforms = [
878
880
  transformStyle,
879
- ...[transformTransition, validateHtmlNesting]
881
+ transformTransition,
882
+ ...[validateHtmlNesting]
880
883
  ];
881
884
  const DOMDirectiveTransforms = {
882
885
  cloak: compilerCore.noopDirectiveTransform,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.43
2
+ * @vue/compiler-dom v3.5.45
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -386,6 +386,41 @@ const transformShow = (dir, node, context) => {
386
386
  };
387
387
  };
388
388
 
389
+ const transformTransition = (node, context) => {
390
+ if (node.type === 1 && node.tagType === 1) {
391
+ const component = context.isBuiltInComponent(node.tag);
392
+ if (component === TRANSITION) {
393
+ return () => {
394
+ if (!node.children.length) {
395
+ return;
396
+ }
397
+ hasMultipleChildren(node);
398
+ const child = node.children[0];
399
+ if (child.type === 1) {
400
+ for (const p of child.props) {
401
+ if (p.type === 7 && p.name === "show") {
402
+ node.props.push({
403
+ type: 6,
404
+ name: "persisted",
405
+ nameLoc: node.loc,
406
+ value: void 0,
407
+ loc: node.loc
408
+ });
409
+ }
410
+ }
411
+ }
412
+ };
413
+ }
414
+ }
415
+ };
416
+ function hasMultipleChildren(node) {
417
+ const children = node.children = node.children.filter(
418
+ (c) => !compilerCore.isCommentOrWhitespace(c)
419
+ );
420
+ const child = children[0];
421
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
422
+ }
423
+
389
424
  const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
390
425
  const stringifyStatic = (children, context, parent) => {
391
426
  if (context.scopes.vSlot > 0) {
@@ -438,7 +473,7 @@ const stringifyStatic = (children, context, parent) => {
438
473
  const child = children[i];
439
474
  const isCached = isParentCached || getCachedNode(child);
440
475
  if (isCached) {
441
- const result = analyzeNode(child);
476
+ const result = analyzeNode(child, context);
442
477
  if (result) {
443
478
  nc += result[0];
444
479
  ec += result[1];
@@ -465,7 +500,7 @@ const isStringifiableAttr = (name, ns) => {
465
500
  const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
466
501
  `caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
467
502
  );
468
- function analyzeNode(node) {
503
+ function analyzeNode(node, context) {
469
504
  if (node.type === 1 && isNonStringifiable(node.tag)) {
470
505
  return false;
471
506
  }
@@ -496,6 +531,9 @@ function analyzeNode(node) {
496
531
  if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
497
532
  return bail();
498
533
  }
534
+ if (p.arg && p.arg.isStatic && (shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && context.isCustomElement(node2.tag)) {
535
+ return bail();
536
+ }
499
537
  if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
500
538
  return bail();
501
539
  }
@@ -543,8 +581,9 @@ function stringifyNode(node, context) {
543
581
  }
544
582
  }
545
583
  function stringifyElement(node, context) {
584
+ var _a;
546
585
  let res = `<${node.tag}`;
547
- let innerHTML = "";
586
+ let innerHTML = void 0;
548
587
  for (let i = 0; i < node.props.length; i++) {
549
588
  const p = node.props[i];
550
589
  if (p.type === 6) {
@@ -559,13 +598,10 @@ function stringifyElement(node, context) {
559
598
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
560
599
  continue;
561
600
  }
562
- if ((shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
563
- continue;
564
- }
565
601
  let evaluated = evaluateConstant(exp);
566
602
  if (evaluated != null) {
567
- const arg = p.arg && p.arg.content;
568
- if (arg === "hidden" && typeof evaluated === "number" && !shared.includeBooleanAttr(evaluated)) {
603
+ const arg = p.arg.content;
604
+ if ((shared.isBooleanAttr(arg) || arg === "hidden") && !shared.includeBooleanAttr(evaluated)) {
569
605
  continue;
570
606
  }
571
607
  if (arg === "class") {
@@ -578,7 +614,7 @@ function stringifyElement(node, context) {
578
614
  )}"`;
579
615
  }
580
616
  } else if (p.name === "html") {
581
- innerHTML = evaluateConstant(p.exp);
617
+ innerHTML = (_a = evaluateConstant(p.exp)) != null ? _a : "";
582
618
  } else if (p.name === "text") {
583
619
  innerHTML = shared.escapeHtml(
584
620
  shared.toDisplayString(evaluateConstant(p.exp))
@@ -590,7 +626,7 @@ function stringifyElement(node, context) {
590
626
  res += ` ${context.scopeId}`;
591
627
  }
592
628
  res += `>`;
593
- if (innerHTML) {
629
+ if (innerHTML !== void 0) {
594
630
  res += innerHTML;
595
631
  } else {
596
632
  for (let i = 0; i < node.children.length; i++) {
@@ -631,6 +667,7 @@ const ignoreSideEffectTags = (node, context) => {
631
667
 
632
668
  const DOMNodeTransforms = [
633
669
  transformStyle,
670
+ transformTransition,
634
671
  ...[]
635
672
  ];
636
673
  const DOMDirectiveTransforms = {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.43
2
+ * @vue/compiler-dom v3.5.45
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -36,20 +36,16 @@ const cacheStringFunction = (fn) => {
36
36
  });
37
37
  };
38
38
  const camelizeRE = /-\w/g;
39
- const camelize = cacheStringFunction(
40
- (str) => {
41
- return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
42
- }
43
- );
44
- const capitalize = cacheStringFunction((str) => {
39
+ const camelize = /* @__PURE__ */ cacheStringFunction((str) => {
40
+ return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
41
+ });
42
+ const capitalize = /* @__PURE__ */ cacheStringFunction((str) => {
45
43
  return str.charAt(0).toUpperCase() + str.slice(1);
46
44
  });
47
- const toHandlerKey = cacheStringFunction(
48
- (str) => {
49
- const s = str ? `on${capitalize(str)}` : ``;
50
- return s;
51
- }
52
- );
45
+ const toHandlerKey = /* @__PURE__ */ cacheStringFunction((str) => {
46
+ const s = str ? `on${capitalize(str)}` : ``;
47
+ return s;
48
+ });
53
49
 
54
50
  const PatchFlagNames = {
55
51
  [1]: `TEXT`,
@@ -1606,7 +1602,8 @@ const errorMessages = {
1606
1602
  [42]: `v-model value must be a valid JavaScript member expression.`,
1607
1603
  [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
1608
1604
  [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
1609
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1605
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.
1606
+ For props declared with defineModel(), assign the returned ref to a variable and use v-model on that variable.`,
1610
1607
  [45]: `v-model cannot be used on a const binding because it is not writable.`,
1611
1608
  [46]: `Error parsing JavaScript expression: `,
1612
1609
  [47]: `<KeepAlive> expects exactly one child component.`,
@@ -2767,7 +2764,11 @@ function getLoc(start, end) {
2767
2764
  };
2768
2765
  }
2769
2766
  function cloneLoc(loc) {
2770
- return getLoc(loc.start.offset, loc.end.offset);
2767
+ return {
2768
+ start: extend({}, loc.start),
2769
+ end: extend({}, loc.end),
2770
+ source: loc.source
2771
+ };
2771
2772
  }
2772
2773
  function setLocEnd(loc, end) {
2773
2774
  loc.end = tokenizer.getPos(end);
@@ -4423,7 +4424,7 @@ const transformFor = createStructuralDirectiveTransform(
4423
4424
  createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
4424
4425
  createCompoundExpression([
4425
4426
  `if (_cached && _cached.el`,
4426
- ...keyExp ? [` && _cached.key === `, keyExp] : [],
4427
+ ...keyExp ? [` && _cached.key === (`, keyExp, `)`] : [],
4427
4428
  ` && ${context.helperString(
4428
4429
  IS_MEMO_SAME
4429
4430
  )}(_cached, _memo)) return _cached`
@@ -6420,7 +6421,8 @@ const transformTransition = (node, context) => {
6420
6421
  if (!node.children.length) {
6421
6422
  return;
6422
6423
  }
6423
- if (hasMultipleChildren(node)) {
6424
+ const multipleChildren = hasMultipleChildren(node);
6425
+ if (multipleChildren) {
6424
6426
  context.onError(
6425
6427
  createDOMCompilerError(
6426
6428
  63,
@@ -6647,7 +6649,8 @@ const validateHtmlNesting = (node, context) => {
6647
6649
 
6648
6650
  const DOMNodeTransforms = [
6649
6651
  transformStyle,
6650
- ...[transformTransition, validateHtmlNesting]
6652
+ transformTransition,
6653
+ ...[validateHtmlNesting]
6651
6654
  ];
6652
6655
  const DOMDirectiveTransforms = {
6653
6656
  cloak: noopDirectiveTransform,