@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
  **/
@@ -1684,16 +1684,16 @@ var VueRuntimeDOM = (function(exports) {
1684
1684
  return ret;
1685
1685
  }
1686
1686
  var ObjectRefImpl = class {
1687
- constructor(_object, _key, _defaultValue) {
1687
+ constructor(_object, key, _defaultValue) {
1688
1688
  this._object = _object;
1689
- this._key = _key;
1690
1689
  this._defaultValue = _defaultValue;
1691
1690
  this["__v_isRef"] = true;
1692
1691
  this._value = void 0;
1692
+ this._key = isSymbol(key) ? key : String(key);
1693
1693
  this._raw = /* @__PURE__ */ toRaw(_object);
1694
1694
  let shallow = true;
1695
1695
  let obj = _object;
1696
- if (!isArray(_object) || !isIntegerKey(String(_key))) do
1696
+ if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
1697
1697
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1698
1698
  while (shallow && (obj = obj["__v_raw"]));
1699
1699
  this._shallow = shallow;
@@ -2603,6 +2603,13 @@ var VueRuntimeDOM = (function(exports) {
2603
2603
  //#endregion
2604
2604
  //#region packages/runtime-core/src/hmr.ts
2605
2605
  let isHmrUpdating = false;
2606
+ const setHmrUpdating = (v) => {
2607
+ try {
2608
+ return isHmrUpdating;
2609
+ } finally {
2610
+ isHmrUpdating = v;
2611
+ }
2612
+ };
2606
2613
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2607
2614
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2608
2615
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -3087,25 +3094,26 @@ var VueRuntimeDOM = (function(exports) {
3087
3094
  mount(container, mainAnchor);
3088
3095
  updateCssVars(n2, true);
3089
3096
  }
3090
- if (isTeleportDeferred(n2.props)) {
3097
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3091
3098
  n2.el.__isMounted = false;
3092
3099
  queuePostRenderEffect(() => {
3100
+ if (n2.el.__isMounted !== false) return;
3093
3101
  mountToTarget();
3094
3102
  delete n2.el.__isMounted;
3095
3103
  }, void 0, parentSuspense);
3096
3104
  } else mountToTarget();
3097
3105
  } else {
3098
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
3099
- queuePostRenderEffect(() => {
3100
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3101
- }, void 0, parentSuspense);
3102
- return;
3103
- }
3104
3106
  n2.el = n1.el;
3105
3107
  n2.targetStart = n1.targetStart;
3106
3108
  const mainAnchor = n2.anchor = n1.anchor;
3107
3109
  const target = n2.target = n1.target;
3108
3110
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3111
+ if (n1.el.__isMounted === false) {
3112
+ queuePostRenderEffect(() => {
3113
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3114
+ }, void 0, parentSuspense);
3115
+ return;
3116
+ }
3109
3117
  const wasDisabled = isTeleportDisabled(n1.props);
3110
3118
  const currentContainer = wasDisabled ? container : target;
3111
3119
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -3127,11 +3135,9 @@ var VueRuntimeDOM = (function(exports) {
3127
3135
  }
3128
3136
  },
3129
3137
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3130
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
3131
- if (target) {
3132
- hostRemove(targetStart);
3133
- hostRemove(targetAnchor);
3134
- }
3138
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3139
+ if (targetStart) hostRemove(targetStart);
3140
+ if (targetAnchor) hostRemove(targetAnchor);
3135
3141
  doRemove && hostRemove(anchor);
3136
3142
  if (shapeFlag & 16) {
3137
3143
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -3390,7 +3396,7 @@ var VueRuntimeDOM = (function(exports) {
3390
3396
  callHook(hook, [el]);
3391
3397
  },
3392
3398
  enter(el) {
3393
- if (isLeaving()) return;
3399
+ if (!isHmrUpdating && isLeaving()) return;
3394
3400
  let hook = onEnter;
3395
3401
  let afterHook = onAfterEnter;
3396
3402
  let cancelHook = onEnterCancelled;
@@ -5762,15 +5768,19 @@ var VueRuntimeDOM = (function(exports) {
5762
5768
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
5763
5769
  return nextProp !== prevProp;
5764
5770
  }
5765
- function updateHOCHostEl({ vnode, parent }, el) {
5771
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
5766
5772
  while (parent && !parent.vapor) {
5767
5773
  const root = parent.subTree;
5768
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
5774
+ if (root.suspense && root.suspense.activeBranch === vnode) {
5775
+ root.suspense.vnode.el = root.el = el;
5776
+ vnode = root;
5777
+ }
5769
5778
  if (root === vnode) {
5770
5779
  (vnode = parent.vnode).el = el;
5771
5780
  parent = parent.parent;
5772
5781
  } else break;
5773
5782
  }
5783
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
5774
5784
  }
5775
5785
  //#endregion
5776
5786
  //#region packages/runtime-core/src/internalObject.ts
@@ -6346,10 +6356,19 @@ var VueRuntimeDOM = (function(exports) {
6346
6356
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
6347
6357
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
6348
6358
  else hostInsert(el, container, anchor);
6349
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
6350
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6351
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6352
- }, void 0, parentSuspense);
6359
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
6360
+ const isHmr = isHmrUpdating;
6361
+ queuePostRenderEffect(() => {
6362
+ let prev;
6363
+ prev = setHmrUpdating(isHmr);
6364
+ try {
6365
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6366
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
6367
+ } finally {
6368
+ setHmrUpdating(prev);
6369
+ }
6370
+ }, void 0, parentSuspense);
6371
+ }
6353
6372
  };
6354
6373
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
6355
6374
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -6822,7 +6841,7 @@ var VueRuntimeDOM = (function(exports) {
6822
6841
  else hostInsert(el, container, anchor);
6823
6842
  };
6824
6843
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
6825
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
6844
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
6826
6845
  if (patchFlag === -2) optimized = false;
6827
6846
  if (ref != null) {
6828
6847
  const prevSub = setActiveSub();
@@ -6860,9 +6879,11 @@ var VueRuntimeDOM = (function(exports) {
6860
6879
  }
6861
6880
  if (doRemove) remove(vnode);
6862
6881
  }
6863
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
6882
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
6883
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
6864
6884
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
6865
6885
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
6886
+ if (shouldInvalidateMemo) vnode.el = null;
6866
6887
  }, void 0, parentSuspense);
6867
6888
  };
6868
6889
  const remove = (vnode) => {
@@ -7215,6 +7236,7 @@ var VueRuntimeDOM = (function(exports) {
7215
7236
  pendingId: suspenseId++,
7216
7237
  timeout: typeof timeout === "number" ? timeout : -1,
7217
7238
  activeBranch: null,
7239
+ isFallbackMountPending: false,
7218
7240
  pendingBranch: null,
7219
7241
  isInFallback: !isHydrating,
7220
7242
  isHydrating,
@@ -7235,13 +7257,14 @@ var VueRuntimeDOM = (function(exports) {
7235
7257
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7236
7258
  }
7237
7259
  };
7238
- if (activeBranch) {
7260
+ if (activeBranch && !suspense.isFallbackMountPending) {
7239
7261
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7240
7262
  unmount(activeBranch, parentComponent, suspense, true);
7241
7263
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7242
7264
  }
7243
7265
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
7244
7266
  }
7267
+ suspense.isFallbackMountPending = false;
7245
7268
  setActiveBranch(suspense, pendingBranch);
7246
7269
  suspense.pendingBranch = null;
7247
7270
  suspense.isInFallback = false;
@@ -7271,12 +7294,16 @@ var VueRuntimeDOM = (function(exports) {
7271
7294
  triggerEvent(vnode, "onFallback");
7272
7295
  const anchor = next(activeBranch);
7273
7296
  const mountFallback = () => {
7297
+ suspense.isFallbackMountPending = false;
7274
7298
  if (!suspense.isInFallback) return;
7275
7299
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
7276
7300
  setActiveBranch(suspense, fallbackVNode);
7277
7301
  };
7278
7302
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
7279
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
7303
+ if (delayEnter) {
7304
+ suspense.isFallbackMountPending = true;
7305
+ activeBranch.transition.afterLeave = mountFallback;
7306
+ }
7280
7307
  suspense.isInFallback = true;
7281
7308
  unmount(activeBranch, parentComponent, null, true);
7282
7309
  if (!delayEnter) mountFallback();
@@ -7677,6 +7704,7 @@ var VueRuntimeDOM = (function(exports) {
7677
7704
  const existing = ret[key];
7678
7705
  const incoming = toMerge[key];
7679
7706
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
7707
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
7680
7708
  } else if (key !== "") ret[key] = toMerge[key];
7681
7709
  }
7682
7710
  return ret;
@@ -8243,7 +8271,7 @@ var VueRuntimeDOM = (function(exports) {
8243
8271
  }
8244
8272
  //#endregion
8245
8273
  //#region packages/runtime-core/src/index.ts
8246
- const version = "3.6.0-beta.8";
8274
+ const version = "3.6.0-beta.9";
8247
8275
  const warn = warn$1;
8248
8276
  /**
8249
8277
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -9501,7 +9529,8 @@ var VueRuntimeDOM = (function(exports) {
9501
9529
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
9502
9530
  const newValue = value == null ? "" : value;
9503
9531
  if (elValue === newValue) return;
9504
- if (document.activeElement === el && el.type !== "range") {
9532
+ const rootNode = el.getRootNode();
9533
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
9505
9534
  if (lazy && value === oldValue) return;
9506
9535
  if (trim && el.value.trim() === newValue) return;
9507
9536
  }