vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.10
2
+ * vue v3.6.0-beta.11
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.10
2
+ * vue v3.6.0-beta.11
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
package/dist/vue.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CompilerOptions } from "@vue/compiler-dom";
2
2
  import { RenderFunction } from "@vue/runtime-dom";
3
- import { withAsyncContext } from "@vue/runtime-vapor";
3
+ import { VaporSlot, withAsyncContext } from "@vue/runtime-vapor";
4
4
  export * from "@vue/runtime-dom";
5
5
  export * from "@vue/runtime-vapor";
6
6
 
@@ -9,4 +9,4 @@ export * from "@vue/runtime-vapor";
9
9
  //#region temp/packages/vue/src/index.d.ts
10
10
  export declare function compileToFunction(template: string | HTMLElement, options?: CompilerOptions): RenderFunction;
11
11
  //#endregion
12
- export { compileToFunction as compile, withAsyncContext };
12
+ export { type VaporSlot, compileToFunction as compile, withAsyncContext };
package/dist/vue.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CompilerOptions } from "@vue/compiler-dom";
2
2
  import { RenderFunction } from "@vue/runtime-dom";
3
- import { withAsyncContext } from "@vue/runtime-vapor";
3
+ import { VaporSlot, withAsyncContext } from "@vue/runtime-vapor";
4
4
  export * from "@vue/runtime-dom";
5
5
  export * from "@vue/runtime-vapor";
6
6
 
@@ -9,4 +9,4 @@ export * from "@vue/runtime-vapor";
9
9
  //#region temp/packages/vue/src/index.d.ts
10
10
  export declare function compileToFunction(template: string | HTMLElement, options?: CompilerOptions): RenderFunction;
11
11
  //#endregion
12
- export { compileToFunction as compile, withAsyncContext };
12
+ export { type VaporSlot, compileToFunction as compile, withAsyncContext };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.10
2
+ * vue v3.6.0-beta.11
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -3155,7 +3155,7 @@ const TeleportImpl = {
3155
3155
  name: "Teleport",
3156
3156
  __isTeleport: true,
3157
3157
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
3158
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
3158
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
3159
3159
  const disabled = isTeleportDisabled(n2.props);
3160
3160
  let { dynamicChildren } = n2;
3161
3161
  if (isHmrUpdating) {
@@ -3184,7 +3184,7 @@ const TeleportImpl = {
3184
3184
  if (pendingMounts.get(vnode) !== mountJob) return;
3185
3185
  pendingMounts.delete(vnode);
3186
3186
  if (isTeleportDisabled(vnode.props)) {
3187
- mount(vnode, container, vnode.anchor);
3187
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
3188
3188
  updateCssVars(vnode, true);
3189
3189
  }
3190
3190
  mountToTarget(vnode);
@@ -3264,7 +3264,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3264
3264
  const { el, anchor, shapeFlag, children, props } = vnode;
3265
3265
  const isReorder = moveType === 2;
3266
3266
  if (isReorder) insert(el, container, parentAnchor);
3267
- if (!isReorder || isTeleportDisabled(props)) {
3267
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
3268
3268
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
3269
3269
  }
3270
3270
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -3389,8 +3389,8 @@ const BaseTransitionImpl = {
3389
3389
  const state = useTransitionState();
3390
3390
  return () => {
3391
3391
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
3392
- if (!children || !children.length) return;
3393
- const child = findNonCommentChild(children);
3392
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
3393
+ if (!child) return;
3394
3394
  const rawProps = /* @__PURE__ */ toRaw(props);
3395
3395
  const { mode } = rawProps;
3396
3396
  checkTransitionMode(mode);
@@ -4744,6 +4744,7 @@ function createSlots(slots, dynamicSlots) {
4744
4744
  */
4745
4745
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
4746
4746
  let slot = slots[name];
4747
+ if (fallback) fallback.__vdom = true;
4747
4748
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
4748
4749
  if (vaporSlot) {
4749
4750
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -4782,9 +4783,7 @@ function ensureValidVNode(vnodes) {
4782
4783
  }
4783
4784
  function ensureVaporSlotFallback(vnodes, fallback) {
4784
4785
  let vaporSlot;
4785
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
4786
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
4787
- }
4786
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
4788
4787
  }
4789
4788
  //#endregion
4790
4789
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -5156,9 +5155,14 @@ function withAsyncContext(getAwaitable) {
5156
5155
  setCurrentInstance(null, void 0);
5157
5156
  if (inSSRSetup) setInSSRSetupState(false);
5158
5157
  const restore = () => {
5158
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
5159
5159
  setCurrentInstance(ctx);
5160
5160
  if (inSSRSetup) setInSSRSetupState(true);
5161
- return restoreAsyncContext && restoreAsyncContext();
5161
+ const reset = restoreAsyncContext && restoreAsyncContext();
5162
+ return () => {
5163
+ if (reset) reset();
5164
+ if (resetStoppedScope) resetStoppedScope.reset();
5165
+ };
5162
5166
  };
5163
5167
  const cleanup = () => {
5164
5168
  setCurrentInstance(null, void 0);
@@ -6188,7 +6192,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
6188
6192
  const receivedType = toRawType(value);
6189
6193
  const expectedValue = styleValue(value, expectedType);
6190
6194
  const receivedValue = styleValue(value, receivedType);
6191
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
6195
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
6192
6196
  message += `, got ${receivedType} `;
6193
6197
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
6194
6198
  return message;
@@ -6197,7 +6201,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
6197
6201
  * dev only
6198
6202
  */
6199
6203
  function styleValue(value, type) {
6200
- if (type === "String") return `"${value}"`;
6204
+ if (isSymbol(value)) return value.toString();
6205
+ else if (type === "String") return `"${value}"`;
6201
6206
  else if (type === "Number") return `${Number(value)}`;
6202
6207
  else return `${value}`;
6203
6208
  }
@@ -6214,8 +6219,11 @@ function isExplicable(type) {
6214
6219
  /**
6215
6220
  * dev only
6216
6221
  */
6217
- function isBoolean(...args) {
6218
- return args.some((elem) => elem.toLowerCase() === "boolean");
6222
+ function isCoercible(...args) {
6223
+ return args.every((elem) => {
6224
+ const value = elem.toLowerCase();
6225
+ return value !== "boolean" && value !== "symbol";
6226
+ });
6219
6227
  }
6220
6228
  //#endregion
6221
6229
  //#region packages/runtime-core/src/componentSlots.ts
@@ -7398,15 +7406,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7398
7406
  if (suspense.isHydrating) suspense.isHydrating = false;
7399
7407
  else if (!resume) {
7400
7408
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
7409
+ let hasUpdatedAnchor = false;
7401
7410
  if (delayEnter) activeBranch.transition.afterLeave = () => {
7402
7411
  if (pendingId === suspense.pendingId) {
7403
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7412
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
7404
7413
  queuePostFlushCb(effects);
7405
7414
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
7406
7415
  }
7407
7416
  };
7408
7417
  if (activeBranch && !suspense.isFallbackMountPending) {
7409
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
7418
+ if (parentNode(activeBranch.el) === container) {
7419
+ anchor = next(activeBranch);
7420
+ hasUpdatedAnchor = true;
7421
+ }
7410
7422
  unmount(activeBranch, parentComponent, suspense, true);
7411
7423
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
7412
7424
  }
@@ -7760,11 +7772,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7760
7772
  el: vnode.el,
7761
7773
  anchor: vnode.anchor,
7762
7774
  ctx: vnode.ctx,
7763
- ce: vnode.ce
7775
+ ce: vnode.ce,
7776
+ vi: vnode.vi,
7777
+ vs: cloneVaporSlotMeta(vnode),
7778
+ vb: vnode.vb
7764
7779
  };
7765
7780
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
7766
7781
  return cloned;
7767
7782
  }
7783
+ function cloneVaporSlotMeta(vnode) {
7784
+ const vaporSlot = vnode.vs;
7785
+ if (!vaporSlot) return vaporSlot;
7786
+ const cloned = {
7787
+ slot: vaporSlot.slot,
7788
+ fallback: vaporSlot.fallback,
7789
+ outletFallback: vaporSlot.outletFallback
7790
+ };
7791
+ if (vnode.el) {
7792
+ cloned.state = vaporSlot.state;
7793
+ cloned.ref = vaporSlot.ref;
7794
+ cloned.scope = vaporSlot.scope;
7795
+ }
7796
+ return cloned;
7797
+ }
7768
7798
  /**
7769
7799
  * Dev only, for HMR of hoisted vnodes reused in v-for
7770
7800
  * https://github.com/vitejs/vite/issues/2022
@@ -8420,7 +8450,7 @@ function isMemoSame(cached, memo) {
8420
8450
  }
8421
8451
  //#endregion
8422
8452
  //#region packages/runtime-core/src/index.ts
8423
- const version = "3.6.0-beta.10";
8453
+ const version = "3.6.0-beta.11";
8424
8454
  const warn = warn$1;
8425
8455
  /**
8426
8456
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8883,7 +8913,10 @@ function patchStyle(el, prev, next) {
8883
8913
  }
8884
8914
  for (const key in next) {
8885
8915
  if (key === "display") hasControlledDisplay = true;
8886
- setStyle(style, key, next[key]);
8916
+ const value = next[key];
8917
+ if (value != null) {
8918
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
8919
+ } else setStyle(style, key, "");
8887
8920
  }
8888
8921
  } else if (isCssString) {
8889
8922
  if (prev !== next) {
@@ -8931,6 +8964,14 @@ function autoPrefix(style, rawName) {
8931
8964
  }
8932
8965
  return rawName;
8933
8966
  }
8967
+ /**
8968
+ * Browsers update textarea width/height directly during native resize.
8969
+ * Only special-case this common textarea path for now; other resize scenarios
8970
+ * still follow normal vnode style patching.
8971
+ */
8972
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
8973
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
8974
+ }
8934
8975
  //#endregion
8935
8976
  //#region packages/runtime-dom/src/modules/attrs.ts
8936
8977
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -9365,7 +9406,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
9365
9406
  replacementNodes.push(child);
9366
9407
  }
9367
9408
  parent.removeChild(o);
9368
- slotReplacements.set(o, replacementNodes);
9409
+ slotReplacements.set(o, {
9410
+ nodes: replacementNodes,
9411
+ usedFallback: !content
9412
+ });
9369
9413
  }
9370
9414
  this._updateSlotNodes(slotReplacements);
9371
9415
  }
@@ -12163,6 +12207,7 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12163
12207
  constantCache: /* @__PURE__ */ new WeakMap(),
12164
12208
  temps: 0,
12165
12209
  identifiers: Object.create(null),
12210
+ identifierScopes: Object.create(null),
12166
12211
  scopes: {
12167
12212
  vFor: 0,
12168
12213
  vSlot: 0,
@@ -12213,8 +12258,12 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
12213
12258
  context.parent.children.splice(removalIndex, 1);
12214
12259
  },
12215
12260
  onNodeRemoved: NOOP,
12216
- addIdentifiers(exp) {},
12261
+ addIdentifiers(exp, type = "local") {},
12217
12262
  removeIdentifiers(exp) {},
12263
+ isSlotScopeIdentifier(name) {
12264
+ const scopes = context.identifierScopes[name];
12265
+ return scopes ? scopes[scopes.length - 1] === "slot" : false;
12266
+ },
12218
12267
  hoist(exp) {
12219
12268
  if (isString(exp)) exp = createSimpleExpression(exp);
12220
12269
  context.hoists.push(exp);