@vue/compat 3.6.0-beta.10 → 3.6.0-beta.11

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.10
2
+ * @vue/compat v3.6.0-beta.11
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -3506,7 +3506,7 @@ const TeleportImpl = {
3506
3506
  name: "Teleport",
3507
3507
  __isTeleport: true,
3508
3508
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3509
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3509
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3510
3510
  const disabled = isTeleportDisabled(n2.props);
3511
3511
  let { dynamicChildren } = n2;
3512
3512
  if (isHmrUpdating) {
@@ -3535,7 +3535,7 @@ const TeleportImpl = {
3535
3535
  if (pendingMounts.get(vnode) !== mountJob) return;
3536
3536
  pendingMounts.delete(vnode);
3537
3537
  if (isTeleportDisabled(vnode.props)) {
3538
- mount(vnode, container, vnode.anchor);
3538
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3539
3539
  updateCssVars(vnode, true);
3540
3540
  }
3541
3541
  mountToTarget(vnode);
@@ -3615,7 +3615,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3615
3615
  const { el, anchor, shapeFlag, children, props } = vnode;
3616
3616
  const isReorder = moveType === 2;
3617
3617
  if (isReorder) insert(el, container, parentAnchor);
3618
- if (!isReorder || isTeleportDisabled(props)) {
3618
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3619
3619
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3620
3620
  }
3621
3621
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3740,8 +3740,8 @@ const BaseTransitionImpl = {
3740
3740
  const state = useTransitionState();
3741
3741
  return () => {
3742
3742
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3743
- if (!children || !children.length) return;
3744
- const child = findNonCommentChild(children);
3743
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3744
+ if (!child) return;
3745
3745
  const rawProps = /* @__PURE__ */ toRaw(props);
3746
3746
  const { mode } = rawProps;
3747
3747
  checkTransitionMode(mode);
@@ -5311,6 +5311,7 @@ function createSlots(slots, dynamicSlots) {
5311
5311
  */
5312
5312
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5313
5313
  let slot = slots[name];
5314
+ if (fallback) fallback.__vdom = true;
5314
5315
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
5315
5316
  if (vaporSlot) {
5316
5317
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -5349,9 +5350,7 @@ function ensureValidVNode(vnodes) {
5349
5350
  }
5350
5351
  function ensureVaporSlotFallback(vnodes, fallback) {
5351
5352
  let vaporSlot;
5352
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5353
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
5354
- }
5353
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
5355
5354
  }
5356
5355
  //#endregion
5357
5356
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5912,9 +5911,14 @@ function withAsyncContext(getAwaitable) {
5912
5911
  setCurrentInstance(null, void 0);
5913
5912
  if (inSSRSetup) setInSSRSetupState(false);
5914
5913
  const restore = () => {
5914
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5915
5915
  setCurrentInstance(ctx);
5916
5916
  if (inSSRSetup) setInSSRSetupState(true);
5917
- return restoreAsyncContext && restoreAsyncContext();
5917
+ const reset = restoreAsyncContext && restoreAsyncContext();
5918
+ return () => {
5919
+ if (reset) reset();
5920
+ if (resetStoppedScope) resetStoppedScope.reset();
5921
+ };
5918
5922
  };
5919
5923
  const cleanup = () => {
5920
5924
  setCurrentInstance(null, void 0);
@@ -6251,7 +6255,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6251
6255
  if (options.el) return vm.$mount(options.el);
6252
6256
  else return vm;
6253
6257
  }
6254
- Vue.version = `2.6.14-compat:3.6.0-beta.10`;
6258
+ Vue.version = `2.6.14-compat:3.6.0-beta.11`;
6255
6259
  Vue.config = singletonApp.config;
6256
6260
  Vue.use = (plugin, ...options) => {
6257
6261
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -7387,7 +7391,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7387
7391
  const receivedType = toRawType(value);
7388
7392
  const expectedValue = styleValue(value, expectedType);
7389
7393
  const receivedValue = styleValue(value, receivedType);
7390
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7394
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
7391
7395
  message += `, got ${receivedType} `;
7392
7396
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
7393
7397
  return message;
@@ -7396,7 +7400,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7396
7400
  * dev only
7397
7401
  */
7398
7402
  function styleValue(value, type) {
7399
- if (type === "String") return `"${value}"`;
7403
+ if (isSymbol(value)) return value.toString();
7404
+ else if (type === "String") return `"${value}"`;
7400
7405
  else if (type === "Number") return `${Number(value)}`;
7401
7406
  else return `${value}`;
7402
7407
  }
@@ -7413,8 +7418,11 @@ function isExplicable(type) {
7413
7418
  /**
7414
7419
  * dev only
7415
7420
  */
7416
- function isBoolean(...args) {
7417
- return args.some((elem) => elem.toLowerCase() === "boolean");
7421
+ function isCoercible(...args) {
7422
+ return args.every((elem) => {
7423
+ const value = elem.toLowerCase();
7424
+ return value !== "boolean" && value !== "symbol";
7425
+ });
7418
7426
  }
7419
7427
  //#endregion
7420
7428
  //#region packages/runtime-core/src/componentSlots.ts
@@ -8609,15 +8617,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
8609
8617
  if (suspense.isHydrating) suspense.isHydrating = false;
8610
8618
  else if (!resume) {
8611
8619
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
8620
+ let hasUpdatedAnchor = false;
8612
8621
  if (delayEnter) activeBranch.transition.afterLeave = () => {
8613
8622
  if (pendingId === suspense.pendingId) {
8614
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8623
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
8615
8624
  queuePostFlushCb(effects);
8616
8625
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
8617
8626
  }
8618
8627
  };
8619
8628
  if (activeBranch && !suspense.isFallbackMountPending) {
8620
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
8629
+ if (parentNode(activeBranch.el) === container) {
8630
+ anchor = next(activeBranch);
8631
+ hasUpdatedAnchor = true;
8632
+ }
8621
8633
  unmount(activeBranch, parentComponent, suspense, true);
8622
8634
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
8623
8635
  }
@@ -9014,12 +9026,30 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9014
9026
  el: vnode.el,
9015
9027
  anchor: vnode.anchor,
9016
9028
  ctx: vnode.ctx,
9017
- ce: vnode.ce
9029
+ ce: vnode.ce,
9030
+ vi: vnode.vi,
9031
+ vs: cloneVaporSlotMeta(vnode),
9032
+ vb: vnode.vb
9018
9033
  };
9019
9034
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
9020
9035
  defineLegacyVNodeProperties(cloned);
9021
9036
  return cloned;
9022
9037
  }
9038
+ function cloneVaporSlotMeta(vnode) {
9039
+ const vaporSlot = vnode.vs;
9040
+ if (!vaporSlot) return vaporSlot;
9041
+ const cloned = {
9042
+ slot: vaporSlot.slot,
9043
+ fallback: vaporSlot.fallback,
9044
+ outletFallback: vaporSlot.outletFallback
9045
+ };
9046
+ if (vnode.el) {
9047
+ cloned.state = vaporSlot.state;
9048
+ cloned.ref = vaporSlot.ref;
9049
+ cloned.scope = vaporSlot.scope;
9050
+ }
9051
+ return cloned;
9052
+ }
9023
9053
  /**
9024
9054
  * Dev only, for HMR of hoisted vnodes reused in v-for
9025
9055
  * https://github.com/vitejs/vite/issues/2022
@@ -9679,7 +9709,7 @@ function isMemoSame(cached, memo) {
9679
9709
  }
9680
9710
  //#endregion
9681
9711
  //#region packages/runtime-core/src/index.ts
9682
- const version = "3.6.0-beta.10";
9712
+ const version = "3.6.0-beta.11";
9683
9713
  const warn = warn$1;
9684
9714
  /**
9685
9715
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10167,7 +10197,10 @@ function patchStyle(el, prev, next) {
10167
10197
  }
10168
10198
  for (const key in next) {
10169
10199
  if (key === "display") hasControlledDisplay = true;
10170
- setStyle(style, key, next[key]);
10200
+ const value = next[key];
10201
+ if (value != null) {
10202
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
10203
+ } else setStyle(style, key, "");
10171
10204
  }
10172
10205
  } else if (isCssString) {
10173
10206
  if (prev !== next) {
@@ -10215,6 +10248,14 @@ function autoPrefix(style, rawName) {
10215
10248
  }
10216
10249
  return rawName;
10217
10250
  }
10251
+ /**
10252
+ * Browsers update textarea width/height directly during native resize.
10253
+ * Only special-case this common textarea path for now; other resize scenarios
10254
+ * still follow normal vnode style patching.
10255
+ */
10256
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
10257
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
10258
+ }
10218
10259
  //#endregion
10219
10260
  //#region packages/runtime-dom/src/modules/attrs.ts
10220
10261
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -10674,7 +10715,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
10674
10715
  replacementNodes.push(child);
10675
10716
  }
10676
10717
  parent.removeChild(o);
10677
- slotReplacements.set(o, replacementNodes);
10718
+ slotReplacements.set(o, {
10719
+ nodes: replacementNodes,
10720
+ usedFallback: !content
10721
+ });
10678
10722
  }
10679
10723
  this._updateSlotNodes(slotReplacements);
10680
10724
  }
@@ -13612,6 +13656,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13612
13656
  constantCache: /* @__PURE__ */ new WeakMap(),
13613
13657
  temps: 0,
13614
13658
  identifiers: Object.create(null),
13659
+ identifierScopes: Object.create(null),
13615
13660
  scopes: {
13616
13661
  vFor: 0,
13617
13662
  vSlot: 0,
@@ -13662,8 +13707,12 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
13662
13707
  context.parent.children.splice(removalIndex, 1);
13663
13708
  },
13664
13709
  onNodeRemoved: NOOP,
13665
- addIdentifiers(exp) {},
13710
+ addIdentifiers(exp, type = "local") {},
13666
13711
  removeIdentifiers(exp) {},
13712
+ isSlotScopeIdentifier(name) {
13713
+ const scopes = context.identifierScopes[name];
13714
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
13715
+ },
13667
13716
  hoist(exp) {
13668
13717
  if (isString(exp)) exp = createSimpleExpression(exp);
13669
13718
  context.hoists.push(exp);