@vue/runtime-dom 3.2.38 → 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.
@@ -1800,7 +1800,9 @@ var VueRuntimeDOM = (function (exports) {
1800
1800
  }
1801
1801
  queueFlush();
1802
1802
  }
1803
- function flushPreFlushCbs(seen, i = flushIndex) {
1803
+ function flushPreFlushCbs(seen,
1804
+ // if currently flushing, skip the current job itself
1805
+ i = isFlushing ? flushIndex + 1 : 0) {
1804
1806
  {
1805
1807
  seen = seen || new Map();
1806
1808
  }
@@ -4170,7 +4172,7 @@ var VueRuntimeDOM = (function (exports) {
4170
4172
  const createHook = (lifecycle) => (hook, target = currentInstance) =>
4171
4173
  // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
4172
4174
  (!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
4173
- injectHook(lifecycle, hook, target);
4175
+ injectHook(lifecycle, (...args) => hook(...args), target);
4174
4176
  const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
4175
4177
  const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
4176
4178
  const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
@@ -4393,7 +4395,10 @@ var VueRuntimeDOM = (function (exports) {
4393
4395
  slots[slot.name] = slot.key
4394
4396
  ? (...args) => {
4395
4397
  const res = slot.fn(...args);
4396
- 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;
4397
4402
  return res;
4398
4403
  }
4399
4404
  : slot.fn;
@@ -6045,7 +6050,7 @@ var VueRuntimeDOM = (function (exports) {
6045
6050
  const isFragmentStart = isComment(node) && node.data === '[';
6046
6051
  const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
6047
6052
  const { type, ref, shapeFlag, patchFlag } = vnode;
6048
- const domType = node.nodeType;
6053
+ let domType = node.nodeType;
6049
6054
  vnode.el = node;
6050
6055
  if (patchFlag === -2 /* PatchFlags.BAIL */) {
6051
6056
  optimized = false;
@@ -6085,10 +6090,12 @@ var VueRuntimeDOM = (function (exports) {
6085
6090
  }
6086
6091
  break;
6087
6092
  case Static:
6088
- if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
6089
- nextNode = onMismatch();
6093
+ if (isFragmentStart) {
6094
+ // entire template is static but SSRed as a fragment
6095
+ node = nextSibling(node);
6096
+ domType = node.nodeType;
6090
6097
  }
6091
- else {
6098
+ if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
6092
6099
  // determine anchor, adopt content
6093
6100
  nextNode = node;
6094
6101
  // if the static vnode has its content stripped during build,
@@ -6105,7 +6112,10 @@ var VueRuntimeDOM = (function (exports) {
6105
6112
  }
6106
6113
  nextNode = nextSibling(nextNode);
6107
6114
  }
6108
- return nextNode;
6115
+ return isFragmentStart ? nextSibling(nextNode) : nextNode;
6116
+ }
6117
+ else {
6118
+ onMismatch();
6109
6119
  }
6110
6120
  break;
6111
6121
  case Fragment:
@@ -6430,7 +6440,7 @@ var VueRuntimeDOM = (function (exports) {
6430
6440
  {
6431
6441
  setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6432
6442
  }
6433
- 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;
6434
6444
  // Note: functions inside this closure should use `const xxx = () => {}`
6435
6445
  // style in order to prevent being inlined by minifiers.
6436
6446
  const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
@@ -6557,46 +6567,44 @@ var VueRuntimeDOM = (function (exports) {
6557
6567
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6558
6568
  let el;
6559
6569
  let vnodeHook;
6560
- const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
6561
- {
6562
- el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
6563
- // mount children first, since some props may rely on child content
6564
- // being already rendered, e.g. `<select value>`
6565
- if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
6566
- hostSetElementText(el, vnode.children);
6567
- }
6568
- else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
6569
- 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
+ }
6570
6589
  }
6571
- if (dirs) {
6572
- 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);
6573
6601
  }
6574
- // props
6575
- if (props) {
6576
- for (const key in props) {
6577
- if (key !== 'value' && !isReservedProp(key)) {
6578
- hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6579
- }
6580
- }
6581
- /**
6582
- * Special case for setting value on DOM elements:
6583
- * - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
6584
- * - it needs to be forced (#1471)
6585
- * #2353 proposes adding another renderer option to configure this, but
6586
- * the properties affects are so finite it is worth special casing it
6587
- * here to reduce the complexity. (Special casing it also should not
6588
- * affect non-DOM renderers)
6589
- */
6590
- if ('value' in props) {
6591
- hostPatchProp(el, 'value', null, props.value);
6592
- }
6593
- if ((vnodeHook = props.onVnodeBeforeMount)) {
6594
- invokeVNodeHook(vnodeHook, parentComponent, vnode);
6595
- }
6602
+ if ((vnodeHook = props.onVnodeBeforeMount)) {
6603
+ invokeVNodeHook(vnodeHook, parentComponent, vnode);
6596
6604
  }
6597
- // scopeId
6598
- setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
6599
6605
  }
6606
+ // scopeId
6607
+ setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
6600
6608
  {
6601
6609
  Object.defineProperty(el, '__vnode', {
6602
6610
  value: vnode,
@@ -6782,6 +6790,13 @@ var VueRuntimeDOM = (function (exports) {
6782
6790
  };
6783
6791
  const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
6784
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
+ }
6785
6800
  for (const key in newProps) {
6786
6801
  // empty string is not valid prop
6787
6802
  if (isReservedProp(key))
@@ -6793,13 +6808,6 @@ var VueRuntimeDOM = (function (exports) {
6793
6808
  hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6794
6809
  }
6795
6810
  }
6796
- if (oldProps !== EMPTY_OBJ) {
6797
- for (const key in oldProps) {
6798
- if (!isReservedProp(key) && !(key in newProps)) {
6799
- hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
6800
- }
6801
- }
6802
- }
6803
6811
  if ('value' in newProps) {
6804
6812
  hostPatchProp(el, 'value', oldProps.value, newProps.value);
6805
6813
  }
@@ -8323,7 +8331,10 @@ var VueRuntimeDOM = (function (exports) {
8323
8331
  }
8324
8332
  // optimized normalization for template-compiled render fns
8325
8333
  function cloneIfMounted(child) {
8326
- 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);
8327
8338
  }
8328
8339
  function normalizeChildren(vnode, children) {
8329
8340
  let type = 0;
@@ -8665,7 +8676,8 @@ var VueRuntimeDOM = (function (exports) {
8665
8676
  // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
8666
8677
  // is done by server-renderer
8667
8678
  if (!isSSR && compile && !Component.render) {
8668
- const template = Component.template;
8679
+ const template = Component.template ||
8680
+ resolveMergedOptions(instance).template;
8669
8681
  if (template) {
8670
8682
  {
8671
8683
  startMeasure(instance, `compile`);
@@ -9215,7 +9227,7 @@ var VueRuntimeDOM = (function (exports) {
9215
9227
  }
9216
9228
 
9217
9229
  // Core API ------------------------------------------------------------------
9218
- const version = "3.2.38";
9230
+ const version = "3.2.40";
9219
9231
  /**
9220
9232
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9221
9233
  * @internal
@@ -9266,22 +9278,6 @@ var VueRuntimeDOM = (function (exports) {
9266
9278
  setScopeId(el, id) {
9267
9279
  el.setAttribute(id, '');
9268
9280
  },
9269
- cloneNode(el) {
9270
- const cloned = el.cloneNode(true);
9271
- // #3072
9272
- // - in `patchDOMProp`, we store the actual value in the `el._value` property.
9273
- // - normally, elements using `:value` bindings will not be hoisted, but if
9274
- // the bound value is a constant, e.g. `:value="true"` - they do get
9275
- // hoisted.
9276
- // - in production, hoisted nodes are cloned when subsequent inserts, but
9277
- // cloneNode() does not copy the custom property we attached.
9278
- // - This may need to account for other custom DOM properties we attach to
9279
- // elements in addition to `_value` in the future.
9280
- if (`_value` in el) {
9281
- cloned._value = el._value;
9282
- }
9283
- return cloned;
9284
- },
9285
9281
  // __UNSAFE__
9286
9282
  // Reason: innerHTML.
9287
9283
  // Static content here can only come from compiled templates.
@@ -9493,7 +9489,6 @@ var VueRuntimeDOM = (function (exports) {
9493
9489
  }
9494
9490
  else if (type === 'number') {
9495
9491
  // e.g. <img :width="null">
9496
- // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9497
9492
  value = 0;
9498
9493
  needRemove = true;
9499
9494
  }
@@ -9505,7 +9500,8 @@ var VueRuntimeDOM = (function (exports) {
9505
9500
  el[key] = value;
9506
9501
  }
9507
9502
  catch (e) {
9508
- {
9503
+ // do not warn if value is auto-coerced from nullish values
9504
+ if (!needRemove) {
9509
9505
  warn$1(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
9510
9506
  `value ${value} is invalid.`, e);
9511
9507
  }