vue 3.4.34 → 3.4.36

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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.4.34
2
+ * vue v3.4.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.4.34
2
+ * vue v3.4.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.4.34
2
+ * vue v3.4.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -4559,14 +4559,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
4559
4559
  if (validatePropName(normalizedKey)) {
4560
4560
  const opt = raw[key];
4561
4561
  const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
4562
- if (prop) {
4563
- const booleanIndex = getTypeIndex(Boolean, prop.type);
4564
- const stringIndex = getTypeIndex(String, prop.type);
4565
- prop[0 /* shouldCast */] = booleanIndex > -1;
4566
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
4567
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
4568
- needCastKeys.push(normalizedKey);
4562
+ const propType = prop.type;
4563
+ let shouldCast = false;
4564
+ let shouldCastTrue = true;
4565
+ if (isArray(propType)) {
4566
+ for (let index = 0; index < propType.length; ++index) {
4567
+ const type = propType[index];
4568
+ const typeName = isFunction(type) && type.name;
4569
+ if (typeName === "Boolean") {
4570
+ shouldCast = true;
4571
+ break;
4572
+ } else if (typeName === "String") {
4573
+ shouldCastTrue = false;
4574
+ }
4569
4575
  }
4576
+ } else {
4577
+ shouldCast = isFunction(propType) && propType.name === "Boolean";
4578
+ }
4579
+ prop[0 /* shouldCast */] = shouldCast;
4580
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
4581
+ if (shouldCast || hasOwn(prop, "default")) {
4582
+ needCastKeys.push(normalizedKey);
4570
4583
  }
4571
4584
  }
4572
4585
  }
@@ -4597,17 +4610,6 @@ function getType(ctor) {
4597
4610
  }
4598
4611
  return "";
4599
4612
  }
4600
- function isSameType(a, b) {
4601
- return getType(a) === getType(b);
4602
- }
4603
- function getTypeIndex(type, expectedTypes) {
4604
- if (isArray(expectedTypes)) {
4605
- return expectedTypes.findIndex((t) => isSameType(t, type));
4606
- } else if (isFunction(expectedTypes)) {
4607
- return isSameType(expectedTypes, type) ? 0 : -1;
4608
- }
4609
- return -1;
4610
- }
4611
4613
  function validateProps(rawProps, props, instance) {
4612
4614
  const resolvedValues = toRaw(props);
4613
4615
  const options = instance.propsOptions[0];
@@ -4947,15 +4949,11 @@ const TeleportImpl = {
4947
4949
  if (n1 == null) {
4948
4950
  const placeholder = n2.el = createComment("teleport start") ;
4949
4951
  const mainAnchor = n2.anchor = createComment("teleport end") ;
4950
- const target = n2.target = resolveTarget(n2.props, querySelector);
4951
- const targetStart = n2.targetStart = createText("");
4952
- const targetAnchor = n2.targetAnchor = createText("");
4953
4952
  insert(placeholder, container, anchor);
4954
4953
  insert(mainAnchor, container, anchor);
4955
- targetStart[TeleportEndKey] = targetAnchor;
4954
+ const target = n2.target = resolveTarget(n2.props, querySelector);
4955
+ const targetAnchor = prepareAnchor(target, n2, createText, insert);
4956
4956
  if (target) {
4957
- insert(targetStart, target);
4958
- insert(targetAnchor, target);
4959
4957
  if (namespace === "svg" || isTargetSVG(target)) {
4960
4958
  namespace = "svg";
4961
4959
  } else if (namespace === "mathml" || isTargetMathML(target)) {
@@ -5127,7 +5125,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
5127
5125
  }
5128
5126
  }
5129
5127
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
5130
- o: { nextSibling, parentNode, querySelector }
5128
+ o: { nextSibling, parentNode, querySelector, insert, createText }
5131
5129
  }, hydrateChildren) {
5132
5130
  const target = vnode.target = resolveTarget(
5133
5131
  vnode.props,
@@ -5146,20 +5144,28 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
5146
5144
  slotScopeIds,
5147
5145
  optimized
5148
5146
  );
5149
- vnode.targetAnchor = targetNode;
5147
+ vnode.targetStart = targetNode;
5148
+ vnode.targetAnchor = targetNode && nextSibling(targetNode);
5150
5149
  } else {
5151
5150
  vnode.anchor = nextSibling(node);
5152
5151
  let targetAnchor = targetNode;
5153
5152
  while (targetAnchor) {
5154
- targetAnchor = nextSibling(targetAnchor);
5155
- if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
5156
- vnode.targetAnchor = targetAnchor;
5157
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5158
- break;
5153
+ if (targetAnchor && targetAnchor.nodeType === 8) {
5154
+ if (targetAnchor.data === "teleport start anchor") {
5155
+ vnode.targetStart = targetAnchor;
5156
+ } else if (targetAnchor.data === "teleport anchor") {
5157
+ vnode.targetAnchor = targetAnchor;
5158
+ target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
5159
+ break;
5160
+ }
5159
5161
  }
5162
+ targetAnchor = nextSibling(targetAnchor);
5163
+ }
5164
+ if (!vnode.targetAnchor) {
5165
+ prepareAnchor(target, vnode, createText, insert);
5160
5166
  }
5161
5167
  hydrateChildren(
5162
- targetNode,
5168
+ targetNode && nextSibling(targetNode),
5163
5169
  vnode,
5164
5170
  target,
5165
5171
  parentComponent,
@@ -5185,6 +5191,16 @@ function updateCssVars(vnode) {
5185
5191
  ctx.ut();
5186
5192
  }
5187
5193
  }
5194
+ function prepareAnchor(target, vnode, createText, insert) {
5195
+ const targetStart = vnode.targetStart = createText("");
5196
+ const targetAnchor = vnode.targetAnchor = createText("");
5197
+ targetStart[TeleportEndKey] = targetAnchor;
5198
+ if (target) {
5199
+ insert(targetStart, target);
5200
+ insert(targetAnchor, target);
5201
+ }
5202
+ return targetAnchor;
5203
+ }
5188
5204
 
5189
5205
  let hasLoggedMismatchError = false;
5190
5206
  const logMismatchError = () => {
@@ -5468,6 +5484,7 @@ Server rendered element contains more child nodes than client vdom.`
5468
5484
  }
5469
5485
  if (props) {
5470
5486
  {
5487
+ const isCustomElement = el.tagName.includes("-");
5471
5488
  for (const key in props) {
5472
5489
  if (// #11189 skip if this node has directives that have created hooks
5473
5490
  // as it could have mutated the DOM in any possible way
@@ -5475,7 +5492,7 @@ Server rendered element contains more child nodes than client vdom.`
5475
5492
  logMismatchError();
5476
5493
  }
5477
5494
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
5478
- key[0] === ".") {
5495
+ key[0] === "." || isCustomElement) {
5479
5496
  patchProp(el, key, null, props[key], void 0, parentComponent);
5480
5497
  }
5481
5498
  }
@@ -9662,7 +9679,7 @@ function isMemoSame(cached, memo) {
9662
9679
  return true;
9663
9680
  }
9664
9681
 
9665
- const version = "3.4.34";
9682
+ const version = "3.4.36";
9666
9683
  const warn = warn$1 ;
9667
9684
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9668
9685
  const devtools = devtools$1 ;