@vue/runtime-dom 3.2.39 → 3.2.40

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.
@@ -4172,7 +4172,7 @@ var VueRuntimeDOM = (function (exports) {
4172
4172
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
4173
4173
  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4174
4174
  (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
4175
- injectHook(lifecycle, hook, target);
4175
+ injectHook(lifecycle, (...args) => hook(...args), target);
4176
4176
  const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
4177
4177
  const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
4178
4178
  const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
@@ -4395,7 +4395,10 @@ var VueRuntimeDOM = (function (exports) {
4395
4395
  slots[slot.name] = slot.key
4396
4396
  ? (...args) => {
4397
4397
  const res = slot.fn(...args);
4398
- res.key = slot.key;
4398
+ // attach branch key so each conditional branch is considered a
4399
+ // different fragment
4400
+ if (res)
4401
+ res.key = slot.key;
4399
4402
  return res;
4400
4403
  }
4401
4404
  : slot.fn;
@@ -6047,7 +6050,7 @@ var VueRuntimeDOM = (function (exports) {
6047
6050
  const isFragmentStart = isComment(node) && node.data === '[';
6048
6051
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
6049
6052
  const { type, ref, shapeFlag, patchFlag } = vnode;
6050
- const domType = node.nodeType;
6053
+ let domType = node.nodeType;
6051
6054
  vnode.el = node;
6052
6055
  if (patchFlag === -2 /* PatchFlags.BAIL */) {
6053
6056
  optimized = false;
@@ -6087,10 +6090,12 @@ var VueRuntimeDOM = (function (exports) {
6087
6090
  }
6088
6091
  break;
6089
6092
  case Static:
6090
- if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
6091
- nextNode = onMismatch();
6093
+ if (isFragmentStart) {
6094
+ // entire template is static but SSRed as a fragment
6095
+ node = nextSibling(node);
6096
+ domType = node.nodeType;
6092
6097
  }
6093
- else {
6098
+ if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
6094
6099
  // determine anchor, adopt content
6095
6100
  nextNode = node;
6096
6101
  // if the static vnode has its content stripped during build,
@@ -6107,7 +6112,10 @@ var VueRuntimeDOM = (function (exports) {
6107
6112
  }
6108
6113
  nextNode = nextSibling(nextNode);
6109
6114
  }
6110
- return nextNode;
6115
+ return isFragmentStart ? nextSibling(nextNode) : nextNode;
6116
+ }
6117
+ else {
6118
+ onMismatch();
6111
6119
  }
6112
6120
  break;
6113
6121
  case Fragment:
@@ -6432,7 +6440,7 @@ var VueRuntimeDOM = (function (exports) {
6432
6440
  {
6433
6441
  setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6434
6442
  }
6435
- const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
6443
+ const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, insertStaticContent: hostInsertStaticContent } = options;
6436
6444
  // Note: functions inside this closure should use `const xxx = () => {}`
6437
6445
  // style in order to prevent being inlined by minifiers.
6438
6446
  const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
@@ -6559,46 +6567,44 @@ var VueRuntimeDOM = (function (exports) {
6559
6567
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6560
6568
  let el;
6561
6569
  let vnodeHook;
6562
- const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
6563
- {
6564
- el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
6565
- // mount children first, since some props may rely on child content
6566
- // being already rendered, e.g. `<select value>`
6567
- if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
6568
- hostSetElementText(el, vnode.children);
6569
- }
6570
- else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
6571
- mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
6570
+ const { type, props, shapeFlag, transition, dirs } = vnode;
6571
+ el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
6572
+ // mount children first, since some props may rely on child content
6573
+ // being already rendered, e.g. `<select value>`
6574
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
6575
+ hostSetElementText(el, vnode.children);
6576
+ }
6577
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
6578
+ mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
6579
+ }
6580
+ if (dirs) {
6581
+ invokeDirectiveHook(vnode, null, parentComponent, 'created');
6582
+ }
6583
+ // props
6584
+ if (props) {
6585
+ for (const key in props) {
6586
+ if (key !== 'value' && !isReservedProp(key)) {
6587
+ hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6588
+ }
6572
6589
  }
6573
- if (dirs) {
6574
- invokeDirectiveHook(vnode, null, parentComponent, 'created');
6590
+ /**
6591
+ * Special case for setting value on DOM elements:
6592
+ * - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
6593
+ * - it needs to be forced (#1471)
6594
+ * #2353 proposes adding another renderer option to configure this, but
6595
+ * the properties affects are so finite it is worth special casing it
6596
+ * here to reduce the complexity. (Special casing it also should not
6597
+ * affect non-DOM renderers)
6598
+ */
6599
+ if ('value' in props) {
6600
+ hostPatchProp(el, 'value', null, props.value);
6575
6601
  }
6576
- // props
6577
- if (props) {
6578
- for (const key in props) {
6579
- if (key !== 'value' && !isReservedProp(key)) {
6580
- hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6581
- }
6582
- }
6583
- /**
6584
- * Special case for setting value on DOM elements:
6585
- * - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
6586
- * - it needs to be forced (#1471)
6587
- * #2353 proposes adding another renderer option to configure this, but
6588
- * the properties affects are so finite it is worth special casing it
6589
- * here to reduce the complexity. (Special casing it also should not
6590
- * affect non-DOM renderers)
6591
- */
6592
- if ('value' in props) {
6593
- hostPatchProp(el, 'value', null, props.value);
6594
- }
6595
- if ((vnodeHook = props.onVnodeBeforeMount)) {
6596
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
6597
- }
6602
+ if ((vnodeHook = props.onVnodeBeforeMount)) {
6603
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
6598
6604
  }
6599
- // scopeId
6600
- setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
6601
6605
  }
6606
+ // scopeId
6607
+ setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
6602
6608
  {
6603
6609
  Object.defineProperty(el, '__vnode', {
6604
6610
  value: vnode,
@@ -6784,6 +6790,13 @@ var VueRuntimeDOM = (function (exports) {
6784
6790
  };
6785
6791
  const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
6786
6792
  if (oldProps !== newProps) {
6793
+ if (oldProps !== EMPTY_OBJ) {
6794
+ for (const key in oldProps) {
6795
+ if (!isReservedProp(key) && !(key in newProps)) {
6796
+ hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6797
+ }
6798
+ }
6799
+ }
6787
6800
  for (const key in newProps) {
6788
6801
  // empty string is not valid prop
6789
6802
  if (isReservedProp(key))
@@ -6795,13 +6808,6 @@ var VueRuntimeDOM = (function (exports) {
6795
6808
  hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6796
6809
  }
6797
6810
  }
6798
- if (oldProps !== EMPTY_OBJ) {
6799
- for (const key in oldProps) {
6800
- if (!isReservedProp(key) && !(key in newProps)) {
6801
- hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6802
- }
6803
- }
6804
- }
6805
6811
  if ('value' in newProps) {
6806
6812
  hostPatchProp(el, 'value', oldProps.value, newProps.value);
6807
6813
  }
@@ -8325,7 +8331,10 @@ var VueRuntimeDOM = (function (exports) {
8325
8331
  }
8326
8332
  // optimized normalization for template-compiled render fns
8327
8333
  function cloneIfMounted(child) {
8328
- return child.el === null || child.memo ? child : cloneVNode(child);
8334
+ return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
8335
+ child.memo
8336
+ ? child
8337
+ : cloneVNode(child);
8329
8338
  }
8330
8339
  function normalizeChildren(vnode, children) {
8331
8340
  let type = 0;
@@ -9218,7 +9227,7 @@ var VueRuntimeDOM = (function (exports) {
9218
9227
  }
9219
9228
 
9220
9229
  // Core API ------------------------------------------------------------------
9221
- const version = "3.2.39";
9230
+ const version = "3.2.40";
9222
9231
  /**
9223
9232
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9224
9233
  * @internal
@@ -9269,22 +9278,6 @@ var VueRuntimeDOM = (function (exports) {
9269
9278
  setScopeId(el, id) {
9270
9279
  el.setAttribute(id, '');
9271
9280
  },
9272
- cloneNode(el) {
9273
- const cloned = el.cloneNode(true);
9274
- // #3072
9275
- // - in `patchDOMProp`, we store the actual value in the `el._value` property.
9276
- // - normally, elements using `:value` bindings will not be hoisted, but if
9277
- // the bound value is a constant, e.g. `:value="true"` - they do get
9278
- // hoisted.
9279
- // - in production, hoisted nodes are cloned when subsequent inserts, but
9280
- // cloneNode() does not copy the custom property we attached.
9281
- // - This may need to account for other custom DOM properties we attach to
9282
- // elements in addition to `_value` in the future.
9283
- if (`_value` in el) {
9284
- cloned._value = el._value;
9285
- }
9286
- return cloned;
9287
- },
9288
9281
  // __UNSAFE__
9289
9282
  // Reason: innerHTML.
9290
9283
  // Static content here can only come from compiled templates.
@@ -9496,7 +9489,6 @@ var VueRuntimeDOM = (function (exports) {
9496
9489
  }
9497
9490
  else if (type === 'number') {
9498
9491
  // e.g. <img :width="null">
9499
- // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9500
9492
  value = 0;
9501
9493
  needRemove = true;
9502
9494
  }
@@ -9508,7 +9500,8 @@ var VueRuntimeDOM = (function (exports) {
9508
9500
  el[key] = value;
9509
9501
  }
9510
9502
  catch (e) {
9511
- {
9503
+ // do not warn if value is auto-coerced from nullish values
9504
+ if (!needRemove) {
9512
9505
  warn$1(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
9513
9506
  `value ${value} is invalid.`, e);
9514
9507
  }