@vue/compat 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/compat v3.6.0-beta.8
2
+ * @vue/compat v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1772,16 +1772,16 @@ function toRefs(object) {
1772
1772
  return ret;
1773
1773
  }
1774
1774
  var ObjectRefImpl = class {
1775
- constructor(_object, _key, _defaultValue) {
1775
+ constructor(_object, key, _defaultValue) {
1776
1776
  this._object = _object;
1777
- this._key = _key;
1778
1777
  this._defaultValue = _defaultValue;
1779
1778
  this["__v_isRef"] = true;
1780
1779
  this._value = void 0;
1780
+ this._key = isSymbol(key) ? key : String(key);
1781
1781
  this._raw = /* @__PURE__ */ toRaw(_object);
1782
1782
  let shallow = true;
1783
1783
  let obj = _object;
1784
- if (!isArray(_object) || !isIntegerKey(String(_key))) do
1784
+ if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
1785
1785
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1786
1786
  while (shallow && (obj = obj["__v_raw"]));
1787
1787
  this._shallow = shallow;
@@ -2691,6 +2691,13 @@ function checkRecursiveUpdates(seen, fn) {
2691
2691
  //#endregion
2692
2692
  //#region packages/runtime-core/src/hmr.ts
2693
2693
  let isHmrUpdating = false;
2694
+ const setHmrUpdating = (v) => {
2695
+ try {
2696
+ return isHmrUpdating;
2697
+ } finally {
2698
+ isHmrUpdating = v;
2699
+ }
2700
+ };
2694
2701
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2695
2702
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
2696
2703
  getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -3530,25 +3537,26 @@ const TeleportImpl = {
3530
3537
  mount(container, mainAnchor);
3531
3538
  updateCssVars(n2, true);
3532
3539
  }
3533
- if (isTeleportDeferred(n2.props)) {
3540
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
3534
3541
  n2.el.__isMounted = false;
3535
3542
  queuePostRenderEffect(() => {
3543
+ if (n2.el.__isMounted !== false) return;
3536
3544
  mountToTarget();
3537
3545
  delete n2.el.__isMounted;
3538
3546
  }, void 0, parentSuspense);
3539
3547
  } else mountToTarget();
3540
3548
  } else {
3541
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
3542
- queuePostRenderEffect(() => {
3543
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3544
- }, void 0, parentSuspense);
3545
- return;
3546
- }
3547
3549
  n2.el = n1.el;
3548
3550
  n2.targetStart = n1.targetStart;
3549
3551
  const mainAnchor = n2.anchor = n1.anchor;
3550
3552
  const target = n2.target = n1.target;
3551
3553
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
3554
+ if (n1.el.__isMounted === false) {
3555
+ queuePostRenderEffect(() => {
3556
+ TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
3557
+ }, void 0, parentSuspense);
3558
+ return;
3559
+ }
3552
3560
  const wasDisabled = isTeleportDisabled(n1.props);
3553
3561
  const currentContainer = wasDisabled ? container : target;
3554
3562
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -3570,11 +3578,9 @@ const TeleportImpl = {
3570
3578
  }
3571
3579
  },
3572
3580
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3573
- const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
3574
- if (target) {
3575
- hostRemove(targetStart);
3576
- hostRemove(targetAnchor);
3577
- }
3581
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3582
+ if (targetStart) hostRemove(targetStart);
3583
+ if (targetAnchor) hostRemove(targetAnchor);
3578
3584
  doRemove && hostRemove(anchor);
3579
3585
  if (shapeFlag & 16) {
3580
3586
  const shouldRemove = doRemove || !isTeleportDisabled(props);
@@ -3834,7 +3840,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
3834
3840
  callHook(hook, [el]);
3835
3841
  },
3836
3842
  enter(el) {
3837
- if (isLeaving()) return;
3843
+ if (!isHmrUpdating && isLeaving()) return;
3838
3844
  let hook = onEnter;
3839
3845
  let afterHook = onAfterEnter;
3840
3846
  let cancelHook = onEnterCancelled;
@@ -6208,7 +6214,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6208
6214
  if (options.el) return vm.$mount(options.el);
6209
6215
  else return vm;
6210
6216
  }
6211
- Vue.version = `2.6.14-compat:3.6.0-beta.8`;
6217
+ Vue.version = `2.6.14-compat:3.6.0-beta.9`;
6212
6218
  Vue.config = singletonApp.config;
6213
6219
  Vue.use = (plugin, ...options) => {
6214
6220
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7020,15 +7026,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
7020
7026
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
7021
7027
  return nextProp !== prevProp;
7022
7028
  }
7023
- function updateHOCHostEl({ vnode, parent }, el) {
7029
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
7024
7030
  while (parent && !parent.vapor) {
7025
7031
  const root = parent.subTree;
7026
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
7032
+ if (root.suspense && root.suspense.activeBranch === vnode) {
7033
+ root.suspense.vnode.el = root.el = el;
7034
+ vnode = root;
7035
+ }
7027
7036
  if (root === vnode) {
7028
7037
  (vnode = parent.vnode).el = el;
7029
7038
  parent = parent.parent;
7030
7039
  } else break;
7031
7040
  }
7041
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
7032
7042
  }
7033
7043
  //#endregion
7034
7044
  //#region packages/runtime-core/src/compat/props.ts
@@ -7637,10 +7647,19 @@ function baseCreateRenderer(options, createHydrationFns) {
7637
7647
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7638
7648
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
7639
7649
  else hostInsert(el, container, anchor);
7640
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
7641
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7642
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7643
- }, void 0, parentSuspense);
7650
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
7651
+ const isHmr = isHmrUpdating;
7652
+ queuePostRenderEffect(() => {
7653
+ let prev;
7654
+ prev = setHmrUpdating(isHmr);
7655
+ try {
7656
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7657
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7658
+ } finally {
7659
+ setHmrUpdating(prev);
7660
+ }
7661
+ }, void 0, parentSuspense);
7662
+ }
7644
7663
  };
7645
7664
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
7646
7665
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -8123,7 +8142,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8123
8142
  else hostInsert(el, container, anchor);
8124
8143
  };
8125
8144
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
8126
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
8145
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
8127
8146
  if (patchFlag === -2) optimized = false;
8128
8147
  if (ref != null) {
8129
8148
  const prevSub = setActiveSub();
@@ -8161,9 +8180,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8161
8180
  }
8162
8181
  if (doRemove) remove(vnode);
8163
8182
  }
8164
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
8183
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
8184
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
8165
8185
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8166
8186
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
8187
+ if (shouldInvalidateMemo) vnode.el = null;
8167
8188
  }, void 0, parentSuspense);
8168
8189
  };
8169
8190
  const remove = (vnode) => {
@@ -8518,6 +8539,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8518
8539
  pendingId: suspenseId++,
8519
8540
  timeout: typeof timeout === "number" ? timeout : -1,
8520
8541
  activeBranch: null,
8542
+ isFallbackMountPending: false,
8521
8543
  pendingBranch: null,
8522
8544
  isInFallback: !isHydrating,
8523
8545
  isHydrating,
@@ -8538,13 +8560,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8538
8560
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
8539
8561
  }
8540
8562
  };
8541
- if (activeBranch) {
8563
+ if (activeBranch && !suspense.isFallbackMountPending) {
8542
8564
  if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
8543
8565
  unmount(activeBranch, parentComponent, suspense, true);
8544
8566
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
8545
8567
  }
8546
8568
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
8547
8569
  }
8570
+ suspense.isFallbackMountPending = false;
8548
8571
  setActiveBranch(suspense, pendingBranch);
8549
8572
  suspense.pendingBranch = null;
8550
8573
  suspense.isInFallback = false;
@@ -8574,12 +8597,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8574
8597
  triggerEvent(vnode, "onFallback");
8575
8598
  const anchor = next(activeBranch);
8576
8599
  const mountFallback = () => {
8600
+ suspense.isFallbackMountPending = false;
8577
8601
  if (!suspense.isInFallback) return;
8578
8602
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
8579
8603
  setActiveBranch(suspense, fallbackVNode);
8580
8604
  };
8581
8605
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
8582
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
8606
+ if (delayEnter) {
8607
+ suspense.isFallbackMountPending = true;
8608
+ activeBranch.transition.afterLeave = mountFallback;
8609
+ }
8583
8610
  suspense.isInFallback = true;
8584
8611
  unmount(activeBranch, parentComponent, null, true);
8585
8612
  if (!delayEnter) mountFallback();
@@ -9024,6 +9051,7 @@ function mergeProps(...args) {
9024
9051
  const existing = ret[key];
9025
9052
  const incoming = toMerge[key];
9026
9053
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
9054
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
9027
9055
  } else if (key !== "") ret[key] = toMerge[key];
9028
9056
  }
9029
9057
  return ret;
@@ -9594,7 +9622,7 @@ function isMemoSame(cached, memo) {
9594
9622
  }
9595
9623
  //#endregion
9596
9624
  //#region packages/runtime-core/src/index.ts
9597
- const version = "3.6.0-beta.8";
9625
+ const version = "3.6.0-beta.9";
9598
9626
  const warn = warn$1;
9599
9627
  /**
9600
9628
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10920,7 +10948,8 @@ const vModelTextUpdate = (el, oldValue, value, trim, number, lazy) => {
10920
10948
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10921
10949
  const newValue = value == null ? "" : value;
10922
10950
  if (elValue === newValue) return;
10923
- if (document.activeElement === el && el.type !== "range") {
10951
+ const rootNode = el.getRootNode();
10952
+ if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
10924
10953
  if (lazy && value === oldValue) return;
10925
10954
  if (trim && el.value.trim() === newValue) return;
10926
10955
  }
@@ -14336,7 +14365,7 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
14336
14365
  `)`
14337
14366
  ]),
14338
14367
  createCompoundExpression([
14339
- `if (_cached`,
14368
+ `if (_cached && _cached.el`,
14340
14369
  ...keyExp ? [` && _cached.key === `, keyExp] : [],
14341
14370
  ` && ${context.helperString(IS_MEMO_SAME)}(_cached, _memo)) return _cached`
14342
14371
  ]),