@vue/runtime-dom 3.2.34-beta.1 → 3.2.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.
@@ -3869,11 +3869,6 @@ var VueRuntimeDOM = (function (exports) {
3869
3869
  // The whole point of this is to avoid importing KeepAlive directly in the
3870
3870
  // renderer to facilitate tree-shaking.
3871
3871
  const sharedContext = instance.ctx;
3872
- // if the internal renderer is not registered, it indicates that this is server-side rendering,
3873
- // for KeepAlive, we just need to render its children
3874
- if (!sharedContext.renderer) {
3875
- return slots.default;
3876
- }
3877
3872
  const cache = new Map();
3878
3873
  const keys = new Set();
3879
3874
  let current = null;
@@ -6001,7 +5996,7 @@ var VueRuntimeDOM = (function (exports) {
6001
5996
  // Hydration also depends on some renderer internal logic which needs to be
6002
5997
  // passed in via arguments.
6003
5998
  function createHydrationFunctions(rendererInternals) {
6004
- const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
5999
+ const { mt: mountComponent, p: patch, o: { patchProp, createText, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
6005
6000
  const hydrate = (vnode, container) => {
6006
6001
  if (!container.hasChildNodes()) {
6007
6002
  warn$1(`Attempting to hydrate existing markup but container is empty. ` +
@@ -6032,7 +6027,15 @@ var VueRuntimeDOM = (function (exports) {
6032
6027
  switch (type) {
6033
6028
  case Text:
6034
6029
  if (domType !== 3 /* TEXT */) {
6035
- nextNode = onMismatch();
6030
+ // #5728 empty text node inside a slot can cause hydration failure
6031
+ // because the server rendered HTML won't contain a text node
6032
+ if (vnode.children === '') {
6033
+ insert((vnode.el = createText('')), parentNode(node), node);
6034
+ nextNode = node;
6035
+ }
6036
+ else {
6037
+ nextNode = onMismatch();
6038
+ }
6036
6039
  }
6037
6040
  else {
6038
6041
  if (node.data !== vnode.children) {
@@ -6106,6 +6109,12 @@ var VueRuntimeDOM = (function (exports) {
6106
6109
  nextNode = isFragmentStart
6107
6110
  ? locateClosingAsyncAnchor(node)
6108
6111
  : nextSibling(node);
6112
+ // #4293 teleport as component root
6113
+ if (nextNode &&
6114
+ isComment(nextNode) &&
6115
+ nextNode.data === 'teleport end') {
6116
+ nextNode = nextSibling(nextNode);
6117
+ }
6109
6118
  // #3787
6110
6119
  // if component is async, it may get moved / unmounted before its
6111
6120
  // inner component is loaded, so we need to give it a placeholder
@@ -6769,8 +6778,9 @@ var VueRuntimeDOM = (function (exports) {
6769
6778
  const fragmentStartAnchor = (n2.el = n1 ? n1.el : hostCreateText(''));
6770
6779
  const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
6771
6780
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
6772
- if (isHmrUpdating) {
6773
- // HMR updated, force full diff
6781
+ if (// #5523 dev root fragment may inherit directives
6782
+ (isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
6783
+ // HMR updated / Dev root fragment (w/ comments), force full diff
6774
6784
  patchFlag = 0;
6775
6785
  optimized = false;
6776
6786
  dynamicChildren = null;
@@ -6792,8 +6802,6 @@ var VueRuntimeDOM = (function (exports) {
6792
6802
  else {
6793
6803
  if (patchFlag > 0 &&
6794
6804
  patchFlag & 64 /* STABLE_FRAGMENT */ &&
6795
- // #5523 dev root fragment may inherit directives so always force update
6796
- !(patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) &&
6797
6805
  dynamicChildren &&
6798
6806
  // #2715 the previous fragment could've been a BAILed one as a result
6799
6807
  // of renderSlot() with no valid children
@@ -7879,10 +7887,23 @@ var VueRuntimeDOM = (function (exports) {
7879
7887
  }
7880
7888
  else {
7881
7889
  vnode.anchor = nextSibling(node);
7882
- vnode.targetAnchor = hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
7890
+ // lookahead until we find the target anchor
7891
+ // we cannot rely on return value of hydrateChildren() because there
7892
+ // could be nested teleports
7893
+ let targetAnchor = targetNode;
7894
+ while (targetAnchor) {
7895
+ targetAnchor = nextSibling(targetAnchor);
7896
+ if (targetAnchor &&
7897
+ targetAnchor.nodeType === 8 &&
7898
+ targetAnchor.data === 'teleport anchor') {
7899
+ vnode.targetAnchor = targetAnchor;
7900
+ target._lpa =
7901
+ vnode.targetAnchor && nextSibling(vnode.targetAnchor);
7902
+ break;
7903
+ }
7904
+ }
7905
+ hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
7883
7906
  }
7884
- target._lpa =
7885
- vnode.targetAnchor && nextSibling(vnode.targetAnchor);
7886
7907
  }
7887
7908
  }
7888
7909
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -9162,7 +9183,7 @@ var VueRuntimeDOM = (function (exports) {
9162
9183
  }
9163
9184
 
9164
9185
  // Core API ------------------------------------------------------------------
9165
- const version = "3.2.34-beta.1";
9186
+ const version = "3.2.36";
9166
9187
  /**
9167
9188
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9168
9189
  * @internal
@@ -9473,7 +9494,7 @@ var VueRuntimeDOM = (function (exports) {
9473
9494
  // if the low-res timestamp which is bigger than the event timestamp
9474
9495
  // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9475
9496
  // and we need to use the hi-res version for event listeners as well.
9476
- _getNow = () => performance.now();
9497
+ _getNow = performance.now.bind(performance);
9477
9498
  }
9478
9499
  // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9479
9500
  // and does not fire microtasks in between event propagation, so safe to exclude.
@@ -9991,9 +10012,8 @@ var VueRuntimeDOM = (function (exports) {
9991
10012
  removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
9992
10013
  done && done();
9993
10014
  };
9994
- let isLeaving = false;
9995
10015
  const finishLeave = (el, done) => {
9996
- isLeaving = false;
10016
+ el._isLeaving = false;
9997
10017
  removeTransitionClass(el, leaveFromClass);
9998
10018
  removeTransitionClass(el, leaveToClass);
9999
10019
  removeTransitionClass(el, leaveActiveClass);
@@ -10027,14 +10047,14 @@ var VueRuntimeDOM = (function (exports) {
10027
10047
  onEnter: makeEnterHook(false),
10028
10048
  onAppear: makeEnterHook(true),
10029
10049
  onLeave(el, done) {
10030
- isLeaving = true;
10050
+ el._isLeaving = true;
10031
10051
  const resolve = () => finishLeave(el, done);
10032
10052
  addTransitionClass(el, leaveFromClass);
10033
10053
  // force reflow so *-leave-from classes immediately take effect (#2593)
10034
10054
  forceReflow();
10035
10055
  addTransitionClass(el, leaveActiveClass);
10036
10056
  nextFrame(() => {
10037
- if (!isLeaving) {
10057
+ if (!el._isLeaving) {
10038
10058
  // cancelled
10039
10059
  return;
10040
10060
  }
@@ -10555,27 +10575,25 @@ var VueRuntimeDOM = (function (exports) {
10555
10575
  callModelHook(el, binding, vnode, prevVNode, 'updated');
10556
10576
  }
10557
10577
  };
10558
- function callModelHook(el, binding, vnode, prevVNode, hook) {
10559
- let modelToUse;
10560
- switch (el.tagName) {
10578
+ function resolveDynamicModel(tagName, type) {
10579
+ switch (tagName) {
10561
10580
  case 'SELECT':
10562
- modelToUse = vModelSelect;
10563
- break;
10581
+ return vModelSelect;
10564
10582
  case 'TEXTAREA':
10565
- modelToUse = vModelText;
10566
- break;
10583
+ return vModelText;
10567
10584
  default:
10568
- switch (vnode.props && vnode.props.type) {
10585
+ switch (type) {
10569
10586
  case 'checkbox':
10570
- modelToUse = vModelCheckbox;
10571
- break;
10587
+ return vModelCheckbox;
10572
10588
  case 'radio':
10573
- modelToUse = vModelRadio;
10574
- break;
10589
+ return vModelRadio;
10575
10590
  default:
10576
- modelToUse = vModelText;
10591
+ return vModelText;
10577
10592
  }
10578
10593
  }
10594
+ }
10595
+ function callModelHook(el, binding, vnode, prevVNode, hook) {
10596
+ const modelToUse = resolveDynamicModel(el.tagName, vnode.props && vnode.props.type);
10579
10597
  const fn = modelToUse[hook];
10580
10598
  fn && fn(el, binding, vnode, prevVNode);
10581
10599
  }