@vue/runtime-dom 3.6.0-beta.8 → 3.6.0-beta.9

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/runtime-dom v3.6.0-beta.8
2
+ * @vue/runtime-dom v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1188,7 +1188,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
1188
1188
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? (0, _vue_shared.looseToNumber)(el.value) : el.value;
1189
1189
  const newValue = value == null ? "" : value;
1190
1190
  if (elValue === newValue) return;
1191
- if (document.activeElement === el && el.type !== "range") {
1191
+ const rootNode = el.getRootNode();
1192
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
1192
1193
  if (lazy && value === oldValue) return;
1193
1194
  if (trim && el.value.trim() === newValue) return;
1194
1195
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-beta.8
2
+ * @vue/runtime-dom v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1131,7 +1131,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
1131
1131
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? (0, _vue_shared.looseToNumber)(el.value) : el.value;
1132
1132
  const newValue = value == null ? "" : value;
1133
1133
  if (elValue === newValue) return;
1134
- if (document.activeElement === el && el.type !== "range") {
1134
+ const rootNode = el.getRootNode();
1135
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
1135
1136
  if (lazy && value === oldValue) return;
1136
1137
  if (trim && el.value.trim() === newValue) return;
1137
1138
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-beta.8
2
+ * @vue/runtime-dom v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1682,16 +1682,16 @@ function toRefs(object) {
1682
1682
  return ret;
1683
1683
  }
1684
1684
  var ObjectRefImpl = class {
1685
- constructor(_object, _key, _defaultValue) {
1685
+ constructor(_object, key, _defaultValue) {
1686
1686
  this._object = _object;
1687
- this._key = _key;
1688
1687
  this._defaultValue = _defaultValue;
1689
1688
  this["__v_isRef"] = true;
1690
1689
  this._value = void 0;
1690
+ this._key = isSymbol(key) ? key : String(key);
1691
1691
  this._raw = /* @__PURE__ */ toRaw(_object);
1692
1692
  let shallow = true;
1693
1693
  let obj = _object;
1694
- if (!isArray(_object) || !isIntegerKey(String(_key))) do
1694
+ if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
1695
1695
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1696
1696
  while (shallow && (obj = obj["__v_raw"]));
1697
1697
  this._shallow = shallow;
@@ -2601,6 +2601,13 @@ function checkRecursiveUpdates(seen, fn) {
2601
2601
  //#endregion
2602
2602
  //#region packages/runtime-core/src/hmr.ts
2603
2603
  let isHmrUpdating = false;
2604
+ const setHmrUpdating = (v) => {
2605
+ try {
2606
+ return isHmrUpdating;
2607
+ } finally {
2608
+ isHmrUpdating = v;
2609
+ }
2610
+ };
2604
2611
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2605
2612
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2606
2613
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -3089,25 +3096,26 @@ const TeleportImpl = {
3089
3096
  mount(container, mainAnchor);
3090
3097
  updateCssVars(n2, true);
3091
3098
  }
3092
- if (isTeleportDeferred(n2.props)) {
3099
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3093
3100
  n2.el.__isMounted = false;
3094
3101
  queuePostRenderEffect(() => {
3102
+ if (n2.el.__isMounted !== false) return;
3095
3103
  mountToTarget();
3096
3104
  delete n2.el.__isMounted;
3097
3105
  }, void 0, parentSuspense);
3098
3106
  } else mountToTarget();
3099
3107
  } else {
3100
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
3101
- queuePostRenderEffect(() => {
3102
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3103
- }, void 0, parentSuspense);
3104
- return;
3105
- }
3106
3108
  n2.el = n1.el;
3107
3109
  n2.targetStart = n1.targetStart;
3108
3110
  const mainAnchor = n2.anchor = n1.anchor;
3109
3111
  const target = n2.target = n1.target;
3110
3112
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3113
+ if (n1.el.__isMounted === false) {
3114
+ queuePostRenderEffect(() => {
3115
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3116
+ }, void 0, parentSuspense);
3117
+ return;
3118
+ }
3111
3119
  const wasDisabled = isTeleportDisabled(n1.props);
3112
3120
  const currentContainer = wasDisabled ? container : target;
3113
3121
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -3129,11 +3137,9 @@ const TeleportImpl = {
3129
3137
  }
3130
3138
  },
3131
3139
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3132
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
3133
- if (target) {
3134
- hostRemove(targetStart);
3135
- hostRemove(targetAnchor);
3136
- }
3140
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3141
+ if (targetStart) hostRemove(targetStart);
3142
+ if (targetAnchor) hostRemove(targetAnchor);
3137
3143
  doRemove && hostRemove(anchor);
3138
3144
  if (shapeFlag & 16) {
3139
3145
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -3392,7 +3398,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
3392
3398
  callHook(hook, [el]);
3393
3399
  },
3394
3400
  enter(el) {
3395
- if (isLeaving()) return;
3401
+ if (!isHmrUpdating && isLeaving()) return;
3396
3402
  let hook = onEnter;
3397
3403
  let afterHook = onAfterEnter;
3398
3404
  let cancelHook = onEnterCancelled;
@@ -5764,15 +5770,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
5764
5770
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
5765
5771
  return nextProp !== prevProp;
5766
5772
  }
5767
- function updateHOCHostEl({ vnode, parent }, el) {
5773
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
5768
5774
  while (parent && !parent.vapor) {
5769
5775
  const root = parent.subTree;
5770
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
5776
+ if (root.suspense && root.suspense.activeBranch === vnode) {
5777
+ root.suspense.vnode.el = root.el = el;
5778
+ vnode = root;
5779
+ }
5771
5780
  if (root === vnode) {
5772
5781
  (vnode = parent.vnode).el = el;
5773
5782
  parent = parent.parent;
5774
5783
  } else break;
5775
5784
  }
5785
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
5776
5786
  }
5777
5787
  //#endregion
5778
5788
  //#region packages/runtime-core/src/internalObject.ts
@@ -6348,10 +6358,19 @@ function baseCreateRenderer(options, createHydrationFns) {
6348
6358
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6349
6359
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
6350
6360
  else hostInsert(el, container, anchor);
6351
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
6352
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6353
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6354
- }, void 0, parentSuspense);
6361
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
6362
+ const isHmr = isHmrUpdating;
6363
+ queuePostRenderEffect(() => {
6364
+ let prev;
6365
+ prev = setHmrUpdating(isHmr);
6366
+ try {
6367
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6368
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6369
+ } finally {
6370
+ setHmrUpdating(prev);
6371
+ }
6372
+ }, void 0, parentSuspense);
6373
+ }
6355
6374
  };
6356
6375
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
6357
6376
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -6824,7 +6843,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6824
6843
  else hostInsert(el, container, anchor);
6825
6844
  };
6826
6845
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6827
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
6846
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
6828
6847
  if (patchFlag === -2) optimized = false;
6829
6848
  if (ref != null) {
6830
6849
  const prevSub = setActiveSub();
@@ -6862,9 +6881,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6862
6881
  }
6863
6882
  if (doRemove) remove(vnode);
6864
6883
  }
6865
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
6884
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
6885
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
6866
6886
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6867
6887
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6888
+ if (shouldInvalidateMemo) vnode.el = null;
6868
6889
  }, void 0, parentSuspense);
6869
6890
  };
6870
6891
  const remove = (vnode) => {
@@ -7217,6 +7238,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7217
7238
  pendingId: suspenseId++,
7218
7239
  timeout: typeof timeout === "number" ? timeout : -1,
7219
7240
  activeBranch: null,
7241
+ isFallbackMountPending: false,
7220
7242
  pendingBranch: null,
7221
7243
  isInFallback: !isHydrating,
7222
7244
  isHydrating,
@@ -7237,13 +7259,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7237
7259
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7238
7260
  }
7239
7261
  };
7240
- if (activeBranch) {
7262
+ if (activeBranch && !suspense.isFallbackMountPending) {
7241
7263
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7242
7264
  unmount(activeBranch, parentComponent, suspense, true);
7243
7265
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7244
7266
  }
7245
7267
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
7246
7268
  }
7269
+ suspense.isFallbackMountPending = false;
7247
7270
  setActiveBranch(suspense, pendingBranch);
7248
7271
  suspense.pendingBranch = null;
7249
7272
  suspense.isInFallback = false;
@@ -7273,12 +7296,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7273
7296
  triggerEvent(vnode, "onFallback");
7274
7297
  const anchor = next(activeBranch);
7275
7298
  const mountFallback = () => {
7299
+ suspense.isFallbackMountPending = false;
7276
7300
  if (!suspense.isInFallback) return;
7277
7301
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
7278
7302
  setActiveBranch(suspense, fallbackVNode);
7279
7303
  };
7280
7304
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
7281
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
7305
+ if (delayEnter) {
7306
+ suspense.isFallbackMountPending = true;
7307
+ activeBranch.transition.afterLeave = mountFallback;
7308
+ }
7282
7309
  suspense.isInFallback = true;
7283
7310
  unmount(activeBranch, parentComponent, null, true);
7284
7311
  if (!delayEnter) mountFallback();
@@ -7679,6 +7706,7 @@ function mergeProps(...args) {
7679
7706
  const existing = ret[key];
7680
7707
  const incoming = toMerge[key];
7681
7708
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
7709
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
7682
7710
  } else if (key !== "") ret[key] = toMerge[key];
7683
7711
  }
7684
7712
  return ret;
@@ -8245,7 +8273,7 @@ function isMemoSame(cached, memo) {
8245
8273
  }
8246
8274
  //#endregion
8247
8275
  //#region packages/runtime-core/src/index.ts
8248
- const version = "3.6.0-beta.8";
8276
+ const version = "3.6.0-beta.9";
8249
8277
  const warn = warn$1;
8250
8278
  /**
8251
8279
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9519,7 +9547,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
9519
9547
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
9520
9548
  const newValue = value == null ? "" : value;
9521
9549
  if (elValue === newValue) return;
9522
- if (document.activeElement === el && el.type !== "range") {
9550
+ const rootNode = el.getRootNode();
9551
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
9523
9552
  if (lazy && value === oldValue) return;
9524
9553
  if (trim && el.value.trim() === newValue) return;
9525
9554
  }