@vue/compat 3.6.0-beta.8 → 3.6.0-rc.1

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/README.md CHANGED
@@ -18,7 +18,7 @@ While we've tried hard to make the migration build mimic Vue 2 behavior as much
18
18
 
19
19
  - Internet Explorer 11 support: [Vue 3 has officially dropped the plan for IE11 support](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0038-vue3-ie11-support.md). If you still need to support IE11 or below, you will have to stay on Vue 2.
20
20
 
21
- - Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/core/tree/main/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://vitejs.dev/guide/ssr.html). If you are using [Nuxt.js](https://nuxtjs.org/), it is probably better to wait for Nuxt 3.
21
+ - Server-side rendering: the migration build can be used for SSR, but migrating a custom SSR setup is much more involved. The general idea is replacing `vue-server-renderer` with [`@vue/server-renderer`](https://github.com/vuejs/core/tree/main/packages/server-renderer). Vue 3 no longer provides a bundle renderer and it is recommended to use Vue 3 SSR with [Vite](https://vite.dev/guide/ssr). If you are using [Nuxt.js](https://nuxtjs.org/), it is probably better to wait for Nuxt 3.
22
22
 
23
23
  ### Expectations
24
24
 
@@ -43,7 +43,7 @@ The following workflow walks through the steps of migrating an actual Vue 2 app
43
43
  1. Upgrade tooling if applicable.
44
44
  - If using custom webpack setup: Upgrade `vue-loader` to `^16.0.0`.
45
45
  - If using `vue-cli`: upgrade to the latest `@vue/cli-service` with `vue upgrade`
46
- - (Alternative) migrate to [Vite](https://vitejs.dev/) + [vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2). [[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/565b948919eb58f22a32afca7e321b490cb3b074)]
46
+ - (Alternative) migrate to [Vite](https://vite.dev/) + [vite-plugin-vue2](https://github.com/underfin/vite-plugin-vue2). [[Example commit](https://github.com/vuejs/vue-hackernews-2.0/commit/565b948919eb58f22a32afca7e321b490cb3b074)]
47
47
 
48
48
  2. In `package.json`, update `vue` to 3.1, install `@vue/compat` of the same version, and replace `vue-template-compiler` (if present) with `@vue/compiler-sfc`:
49
49
 
@@ -227,7 +227,10 @@ type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? ReactiveMar
227
227
  * @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
228
228
  */
229
229
  declare function reactive<T extends object>(target: T): Reactive<T>;
230
- declare const ShallowReactiveMarker: unique symbol;
230
+ declare class ShallowReactiveBrandClass {
231
+ private __shallowReactiveBrand?;
232
+ }
233
+ type ShallowReactiveBrand = ShallowReactiveBrandClass;
231
234
  type Primitive = string | number | boolean | bigint | symbol | undefined | null;
232
235
  type Builtin = Primitive | Function | Date | Error | RegExp;
233
236
  //#endregion
@@ -262,14 +265,12 @@ type ShallowRef<T = any, S = T> = Ref<T, S> & {
262
265
  * ```
263
266
  */
264
267
  interface RefUnwrapBailTypes {}
265
- type ShallowUnwrapRef<T> = { [K in keyof T]: DistributeRef<T[K]> };
268
+ type ShallowUnwrapRef<T> = T extends ShallowReactiveBrand ? T : { [K in keyof T]: DistributeRef<T[K]> };
266
269
  type DistributeRef<T> = T extends Ref<infer V, unknown> ? V : T;
267
270
  type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extends Ref<infer V, unknown> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
268
271
  type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
269
272
  [RawSymbol]?: true;
270
- } ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object & {
271
- [ShallowReactiveMarker]?: never;
272
- } ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
273
+ } ? T : T extends ShallowReactiveBrand ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
273
274
  //#endregion
274
275
  //#region packages/reactivity/src/watch.d.ts
275
276
  type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
@@ -435,9 +436,9 @@ type NormalizedPropsOptions = [NormalizedProps, string[]] | [];
435
436
  type ComponentTypeEmits = ((...args: any[]) => any) | Record<string, any>;
436
437
  //#endregion
437
438
  //#region packages/runtime-core/src/componentEmits.d.ts
438
- type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
439
+ type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null | any[]>;
439
440
  type EmitsOptions = ObjectEmitsOptions | string[];
440
- type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any } : T extends ObjectEmitsOptions ? { [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends ((...args: infer P) => any) ? P : T[K] extends null ? any[] : never) => any } : {};
441
+ type EmitsToProps<T extends EmitsOptions | ComponentTypeEmits> = T extends string[] ? { [K in `on${Capitalize<T[number]>}`]?: (...args: any[]) => any } : T extends ObjectEmitsOptions ? { [K in string & keyof T as `on${Capitalize<K>}`]?: (...args: T[K] extends ((...args: infer P) => any) ? P : T[K] extends null ? any[] : T[K] extends any[] ? T[K] : never) => any } : {};
441
442
  type ShortEmitsToObject<E> = E extends Record<string, any[]> ? { [K in keyof E]: (...args: E[K]) => any } : E;
442
443
  type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{ [key in Event]: Options[key] extends ((...args: infer Args) => any) ? (event: key, ...args: Args) => void : Options[key] extends any[] ? (event: key, ...args: Options[key]) => void : (event: key, ...args: any[]) => void }[Event]>;
443
444
  //#endregion
@@ -521,9 +522,9 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
521
522
  * inference everywhere internally, but it has to be a new type to avoid
522
523
  * breaking types that relies on previous arguments order (#10842)
523
524
  */
524
- type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl extends Element = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, "P"> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, "B"> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, "D"> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, "C"> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, "M"> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, "Defaults"> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
525
+ type CreateComponentPublicInstanceWithMixins<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, TypeRefs extends Data = {}, TypeEl = any, Provide extends ComponentProvideOptions = ComponentProvideOptions, PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>, PublicP = UnwrapMixinsType<PublicMixin, "P"> & EnsureNonVoid<P>, PublicB = UnwrapMixinsType<PublicMixin, "B"> & EnsureNonVoid<B>, PublicD = UnwrapMixinsType<PublicMixin, "D"> & EnsureNonVoid<D>, PublicC extends ComputedOptions = UnwrapMixinsType<PublicMixin, "C"> & EnsureNonVoid<C>, PublicM extends MethodOptions = UnwrapMixinsType<PublicMixin, "M"> & EnsureNonVoid<M>, PublicDefaults = UnwrapMixinsType<PublicMixin, "Defaults"> & EnsureNonVoid<Defaults>> = ComponentPublicInstance<PublicP, PublicB, PublicD, PublicC, PublicM, E, PublicProps, PublicDefaults, MakeDefaultsOptional, ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, Defaults, {}, string, S, LC, Directives, Exposed, Provide>, I, S, Exposed, TypeRefs, TypeEl>;
525
526
  type ExposedKeys<T, Exposed extends string & keyof T> = "" extends Exposed ? T : Pick<T, Exposed>;
526
- type ComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = "", TypeRefs extends Data = {}, TypeEl extends Element = any> = {
527
+ type ComponentPublicInstance<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = {}, Defaults = {}, MakeDefaultsOptional extends boolean = false, Options = ComponentOptionsBase<any, any, any, any, any, any, any, any, any>, I extends ComponentInjectOptions = {}, S extends SlotsType = {}, Exposed extends string = "", TypeRefs extends Data = {}, TypeEl = any> = {
527
528
  $: ComponentInternalInstance;
528
529
  $data: D;
529
530
  $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
@@ -564,6 +565,10 @@ interface SuspenseProps {
564
565
  onResolve?: () => void;
565
566
  onPending?: () => void;
566
567
  onFallback?: () => void;
568
+ /**
569
+ * Switch to fallback content if it takes longer than `timeout` milliseconds to render the new default content.
570
+ * A `timeout` value of `0` will cause the fallback content to be displayed immediately when default content is replaced.
571
+ */
567
572
  timeout?: string | number;
568
573
  /**
569
574
  * Allow suspense to be captured by parent suspense
@@ -597,6 +602,7 @@ interface SuspenseBoundary {
597
602
  container: RendererElement;
598
603
  hiddenContainer: RendererElement;
599
604
  activeBranch: VNode | null;
605
+ isFallbackMountPending: boolean;
600
606
  pendingBranch: VNode | null;
601
607
  deps: number;
602
608
  pendingId: number;
@@ -923,7 +929,7 @@ type InjectionKey<T> = symbol & InjectionConstraint<T>;
923
929
  //#region packages/runtime-core/src/apiDefineComponent.d.ts
924
930
  type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
925
931
  type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
926
- type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl extends Element = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
932
+ type DefineComponent<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = {}, TypeEl = any> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, TypeRefs, TypeEl>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
927
933
  //#endregion
928
934
  //#region packages/runtime-core/src/apiCreateApp.d.ts
929
935
  interface App<HostElement = any> {
@@ -1009,19 +1015,19 @@ interface AppConfig extends GenericAppConfig {
1009
1015
  * The vapor in vdom implementation is in runtime-vapor/src/vdomInterop.ts
1010
1016
  */
1011
1017
  interface VaporInteropInterface {
1012
- mount(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void): GenericComponentInstance;
1013
- update(n1: VNode, n2: VNode, shouldUpdate: boolean, onBeforeUpdate?: () => void): void;
1018
+ mount(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void, onVnodeBeforeMount?: () => void): GenericComponentInstance;
1019
+ update(n1: VNode, n2: VNode, shouldUpdate: boolean, onBeforeUpdate?: () => void, onVnodeBeforeUpdate?: () => void): void;
1014
1020
  unmount(vnode: VNode, doRemove?: boolean): void;
1015
1021
  move(vnode: VNode, container: any, anchor: any, moveType: MoveType): void;
1016
1022
  slot(n1: VNode | null, n2: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): void;
1017
- hydrate(vnode: VNode, node: any, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): Node;
1018
- hydrateSlot(vnode: VNode, node: any): Node;
1023
+ hydrate(vnode: VNode, node: any, container: any, anchor: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, onBeforeMount?: () => void, onVnodeBeforeMount?: () => void): Node;
1024
+ hydrateSlot(vnode: VNode, node: any, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null): Node;
1019
1025
  activate(vnode: VNode, container: any, anchor: any, parentComponent: ComponentInternalInstance): void;
1020
1026
  deactivate(vnode: VNode, container: any): void;
1021
1027
  setTransitionHooks(component: ComponentInternalInstance, transition: TransitionHooks): void;
1022
- vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any) => any;
1028
+ vdomMount: (component: ConcreteComponent, parentComponent: any, props?: any, slots?: any, once?: boolean) => any;
1023
1029
  vdomUnmount: UnmountComponentFn;
1024
- vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any) => any;
1030
+ vdomSlot: (slots: any, name: string | (() => string), props: Record<string, any>, parentComponent: any, fallback?: any, once?: boolean, slotRoot?: boolean) => any;
1025
1031
  vdomMountVNode: (vnode: VNode, parentComponent: any) => any;
1026
1032
  }
1027
1033
  /**
@@ -1273,7 +1279,10 @@ interface VNode<HostNode = RendererNode, HostElement = RendererElement, ExtraPro
1273
1279
  vs?: {
1274
1280
  slot: (props: any) => any;
1275
1281
  fallback: (() => VNodeArrayChildren) | undefined;
1282
+ outletFallback?: (() => VNodeArrayChildren) | undefined;
1283
+ state?: unknown;
1276
1284
  ref?: ShallowRef<any>;
1285
+ scope?: EffectScope;
1277
1286
  };
1278
1287
  /**
1279
1288
  * @internal Vapor slot Block
@@ -1544,6 +1553,11 @@ interface GenericComponentInstance {
1544
1553
  */
1545
1554
  asyncResolved: boolean;
1546
1555
  /**
1556
+ * restore renderer-specific async context after `withAsyncContext()`
1557
+ * @internal
1558
+ */
1559
+ restoreAsyncContext?: () => void | (() => void);
1560
+ /**
1547
1561
  * `updateTeleportCssVars`
1548
1562
  * For updating css vars on contained teleports
1549
1563
  * @internal
@@ -22159,7 +22173,7 @@ declare namespace DataType {
22159
22173
  type SingleAnimationTimeline = "auto" | "none" | (string & {});
22160
22174
  type SingleTransition<TTime> = EasingFunction | TTime | "all" | "allow-discrete" | "none" | "normal" | (string & {});
22161
22175
  type StepEasingFunction = "step-end" | "step-start" | (string & {});
22162
- type SystemCexport olor = "AccentColor" | "AccentColorText" | "ActiveText" | "ButtonBorder" | "ButtonFace" | "ButtonText" | "Canvas" | "CanvasText" | "Field" | "FieldText" | "GrayText" | "Highlight" | "HighlightText" | "LinkText" | "Mark" | "MarkText" | "SelectedItem" | "SelectedItemText" | "VisitedText";
22176
+ type SystemColor = "AccentColor" | "AccentColorText" | "ActiveText" | "ButtonBorder" | "ButtonFace" | "ButtonText" | "Canvas" | "CanvasText" | "Field" | "FieldText" | "GrayText" | "Highlight" | "HighlightText" | "LinkText" | "Mark" | "MarkText" | "SelectedItem" | "SelectedItemText" | "VisitedText";
22163
22177
  type SystemFamilyName = "caption" | "icon" | "menu" | "message-box" | "small-caption" | "status-bar";
22164
22178
  type TextEdge = "cap" | "ex" | "ideographic" | "ideographic-ink" | "text" | (string & {});
22165
22179
  type TimelineRangeName = "contain" | "cover" | "entry" | "entry-crossing" | "exit" | "exit-crossing";
@@ -22218,6 +22232,6 @@ declare module "@vue/runtime-core" {
22218
22232
  }
22219
22233
  //#endregion
22220
22234
  //#region temp/packages/vue-compat/src/index.d.ts
22221
- declare const Vue: CompatVue;
22235
+ export declare const Vue: CompatVue;
22222
22236
  //#endregion
22223
22237
  export { Vue as default };