@vue/runtime-core 3.5.0-alpha.1 → 3.5.0-alpha.3
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/runtime-core.cjs.js +5477 -5378
- package/dist/runtime-core.cjs.prod.js +4956 -4876
- package/dist/runtime-core.d.ts +134 -67
- package/dist/runtime-core.esm-bundler.js +5982 -5884
- package/package.json +3 -3
package/dist/runtime-core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed as computed$1, Ref, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, ReactiveEffect, ComputedRef, DebuggerOptions, reactive } from '@vue/reactivity';
|
|
2
|
-
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
1
|
+
import { computed as computed$1, Ref, ShallowUnwrapRef, UnwrapNestedRefs, DebuggerEvent, ComputedGetter, WritableComputedOptions, ReactiveEffect, ComputedRef, DebuggerOptions, ReactiveMarker, ShallowRef, reactive } from '@vue/reactivity';
|
|
2
|
+
export { ComputedGetter, ComputedRef, ComputedSetter, CustomRefFactory, DebuggerEvent, DebuggerEventExtraInfo, DebuggerOptions, DeepReadonly, EffectScheduler, EffectScope, MaybeRef, MaybeRefOrGetter, Raw, Reactive, ReactiveEffect, ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Ref, ShallowReactive, ShallowRef, ShallowUnwrapRef, ToRef, ToRefs, TrackOpTypes, TriggerOpTypes, UnwrapNestedRefs, UnwrapRef, WritableComputedOptions, WritableComputedRef, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
3
3
|
import { IfAny, Prettify, Awaited, LooseRequired, UnionToIntersection, OverloadParameters } from '@vue/shared';
|
|
4
4
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
5
5
|
|
|
@@ -54,9 +54,8 @@ interface SchedulerJob extends Function {
|
|
|
54
54
|
/**
|
|
55
55
|
* Attached by renderer.ts when setting up a component's render effect
|
|
56
56
|
* Used to obtain component information when reporting max recursive updates.
|
|
57
|
-
* dev only.
|
|
58
57
|
*/
|
|
59
|
-
|
|
58
|
+
i?: ComponentInternalInstance;
|
|
60
59
|
}
|
|
61
60
|
type SchedulerJobs = SchedulerJob | SchedulerJob[];
|
|
62
61
|
export declare function nextTick<T = void, R = void>(this: T, fn?: (this: T) => R): Promise<Awaited<R>>;
|
|
@@ -209,7 +208,7 @@ type BooleanKey<T, K extends keyof T = keyof T> = K extends any ? [T[K]] extends
|
|
|
209
208
|
* const emit = defineEmits<{
|
|
210
209
|
* // <eventName>: <expected arguments>
|
|
211
210
|
* change: []
|
|
212
|
-
* update: [value:
|
|
211
|
+
* update: [value: number] // named tuple syntax
|
|
213
212
|
* }>()
|
|
214
213
|
*
|
|
215
214
|
* emit('change')
|
|
@@ -255,7 +254,7 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
|
|
|
255
254
|
/**
|
|
256
255
|
* props should be defined via defineProps().
|
|
257
256
|
*/
|
|
258
|
-
props
|
|
257
|
+
props?: never;
|
|
259
258
|
/**
|
|
260
259
|
* emits should be defined via defineEmits().
|
|
261
260
|
*/
|
|
@@ -270,7 +269,7 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
|
|
|
270
269
|
slots?: never;
|
|
271
270
|
}): void;
|
|
272
271
|
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
273
|
-
export type ModelRef<T, M extends
|
|
272
|
+
export type ModelRef<T, M extends PropertyKey = string> = Ref<T> & [
|
|
274
273
|
ModelRef<T, M>,
|
|
275
274
|
Record<M, true | undefined>
|
|
276
275
|
];
|
|
@@ -311,20 +310,20 @@ type DefineModelOptions<T = any> = {
|
|
|
311
310
|
* const count = defineModel<number>('count', { default: 0 })
|
|
312
311
|
* ```
|
|
313
312
|
*/
|
|
314
|
-
export declare function defineModel<T, M extends
|
|
313
|
+
export declare function defineModel<T, M extends PropertyKey = string>(options: {
|
|
315
314
|
required: true;
|
|
316
315
|
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
317
|
-
export declare function defineModel<T, M extends
|
|
316
|
+
export declare function defineModel<T, M extends PropertyKey = string>(options: {
|
|
318
317
|
default: any;
|
|
319
318
|
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
320
|
-
export declare function defineModel<T, M extends
|
|
321
|
-
export declare function defineModel<T, M extends
|
|
319
|
+
export declare function defineModel<T, M extends PropertyKey = string>(options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
320
|
+
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options: {
|
|
322
321
|
required: true;
|
|
323
322
|
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
324
|
-
export declare function defineModel<T, M extends
|
|
323
|
+
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options: {
|
|
325
324
|
default: any;
|
|
326
325
|
} & PropOptions<T> & DefineModelOptions<T>): ModelRef<T, M>;
|
|
327
|
-
export declare function defineModel<T, M extends
|
|
326
|
+
export declare function defineModel<T, M extends PropertyKey = string>(name: string, options?: PropOptions<T> & DefineModelOptions<T>): ModelRef<T | undefined, M>;
|
|
328
327
|
type NotUndefined<T> = T extends undefined ? never : T;
|
|
329
328
|
type MappedOmit<T, K extends keyof any> = {
|
|
330
329
|
[P in keyof T as P extends K ? never : P]: T[P];
|
|
@@ -376,10 +375,10 @@ type TypeEmitsToOptions<T extends ComponentTypeEmits> = T extends Record<string,
|
|
|
376
375
|
type ParametersToFns<T extends any[]> = {
|
|
377
376
|
[K in T[0]]: K extends `${infer C}` ? (...args: T extends [C, ...infer Args] ? Args : never) => any : never;
|
|
378
377
|
};
|
|
379
|
-
type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
378
|
+
export type ShortEmitsToObject<E> = E extends Record<string, any[]> ? {
|
|
380
379
|
[K in keyof E]: (...args: E[K]) => any;
|
|
381
380
|
} : E;
|
|
382
|
-
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<{
|
|
381
|
+
export 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<{
|
|
383
382
|
[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;
|
|
384
383
|
}[Event]>;
|
|
385
384
|
|
|
@@ -397,7 +396,7 @@ return withDirectives(h(comp), [
|
|
|
397
396
|
*/
|
|
398
397
|
|
|
399
398
|
export interface DirectiveBinding<Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
400
|
-
instance: ComponentPublicInstance | null;
|
|
399
|
+
instance: ComponentPublicInstance | Record<string, any> | null;
|
|
401
400
|
value: Value;
|
|
402
401
|
oldValue: Value | null;
|
|
403
402
|
arg?: Arg;
|
|
@@ -405,7 +404,7 @@ export interface DirectiveBinding<Value = any, Modifiers extends string = string
|
|
|
405
404
|
dir: ObjectDirective<any, Value>;
|
|
406
405
|
}
|
|
407
406
|
export type DirectiveHook<HostElement = any, Prev = VNode<any, HostElement> | null, Value = any, Modifiers extends string = string, Arg extends string = string> = (el: HostElement, binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode<any, HostElement>, prevVNode: Prev) => void;
|
|
408
|
-
type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
407
|
+
type SSRDirectiveHook<Value = any, Modifiers extends string = string, Arg extends string = string> = (binding: DirectiveBinding<Value, Modifiers, Arg>, vnode: VNode) => Data | undefined;
|
|
409
408
|
export interface ObjectDirective<HostElement = any, Value = any, Modifiers extends string = string, Arg extends string = string> {
|
|
410
409
|
created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
411
410
|
beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
@@ -414,7 +413,7 @@ export interface ObjectDirective<HostElement = any, Value = any, Modifiers exten
|
|
|
414
413
|
updated?: DirectiveHook<HostElement, VNode<any, HostElement>, Value, Modifiers, Arg>;
|
|
415
414
|
beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
416
415
|
unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>;
|
|
417
|
-
getSSRProps?: SSRDirectiveHook
|
|
416
|
+
getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>;
|
|
418
417
|
deep?: boolean;
|
|
419
418
|
}
|
|
420
419
|
export type FunctionDirective<HostElement = any, V = any, Modifiers extends string = string, Arg extends string = string> = DirectiveHook<HostElement, any, V, Modifiers, Arg>;
|
|
@@ -467,12 +466,24 @@ type ComponentPublicInstanceConstructor<T extends ComponentPublicInstance<Props,
|
|
|
467
466
|
__isSuspense?: never;
|
|
468
467
|
new (...args: any[]): T;
|
|
469
468
|
};
|
|
470
|
-
|
|
469
|
+
/**
|
|
470
|
+
* @deprecated This is no longer used internally, but exported and relied on by
|
|
471
|
+
* existing library types generated by vue-tsc.
|
|
472
|
+
*/
|
|
473
|
+
export type CreateComponentPublicInstance<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 = {}, 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>, I, S>;
|
|
474
|
+
/**
|
|
475
|
+
* This is the same as `CreateComponentPublicInstance` but adds local components,
|
|
476
|
+
* global directives, exposed, and provide inference.
|
|
477
|
+
* It changes the arguments order so that we don't need to repeat mixin
|
|
478
|
+
* inference everywhere internally, but it has to be a new type to avoid
|
|
479
|
+
* breaking types that relies on previous arguments order (#10842)
|
|
480
|
+
*/
|
|
481
|
+
export 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, 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>;
|
|
471
482
|
type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T : Pick<T, Exposed>;
|
|
472
483
|
export type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
473
484
|
B = {}, // raw bindings returned from setup()
|
|
474
485
|
D = {}, // return from data()
|
|
475
|
-
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps =
|
|
486
|
+
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 = ''> = {
|
|
476
487
|
$: ComponentInternalInstance;
|
|
477
488
|
$data: D;
|
|
478
489
|
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
@@ -486,8 +497,8 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
|
|
|
486
497
|
$options: Options & MergedComponentOptionsOverride;
|
|
487
498
|
$forceUpdate: () => void;
|
|
488
499
|
$nextTick: typeof nextTick;
|
|
489
|
-
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R]) => any : (...args: any) => any, options?: WatchOptions): WatchStopHandle;
|
|
490
|
-
} & ExposedKeys<IfAny<P, P, Omit<P, keyof ShallowUnwrapRef<B
|
|
500
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
|
|
501
|
+
} & ExposedKeys<IfAny<P, P, Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>> & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M & ComponentCustomProperties & InjectToObject<I>, Exposed>;
|
|
491
502
|
|
|
492
503
|
declare enum LifecycleHooks {
|
|
493
504
|
BEFORE_CREATE = "bc",
|
|
@@ -523,7 +534,6 @@ declare const SuspenseImpl: {
|
|
|
523
534
|
__isSuspense: boolean;
|
|
524
535
|
process(n1: VNode | null, n2: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals): void;
|
|
525
536
|
hydrate: typeof hydrateSuspense;
|
|
526
|
-
create: typeof createSuspenseBoundary;
|
|
527
537
|
normalize: typeof normalizeSuspenseChildren;
|
|
528
538
|
};
|
|
529
539
|
export declare const Suspense: {
|
|
@@ -556,10 +566,9 @@ export interface SuspenseBoundary {
|
|
|
556
566
|
fallback(fallbackVNode: VNode): void;
|
|
557
567
|
move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
|
|
558
568
|
next(): RendererNode | null;
|
|
559
|
-
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void;
|
|
569
|
+
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
|
|
560
570
|
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
|
|
561
571
|
}
|
|
562
|
-
declare function createSuspenseBoundary(vnode: VNode, parentSuspense: SuspenseBoundary | null, parentComponent: ComponentInternalInstance | null, container: RendererElement, hiddenContainer: RendererElement, anchor: RendererNode | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, isHydrating?: boolean): SuspenseBoundary;
|
|
563
572
|
declare function hydrateSuspense(node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, rendererInternals: RendererInternals, hydrateNode: (node: Node, vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
564
573
|
declare function normalizeSuspenseChildren(vnode: VNode): void;
|
|
565
574
|
|
|
@@ -626,7 +635,7 @@ export declare const BaseTransition: new () => {
|
|
|
626
635
|
default(): VNode[];
|
|
627
636
|
};
|
|
628
637
|
};
|
|
629
|
-
export declare function resolveTransitionHooks(vnode: VNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance): TransitionHooks;
|
|
638
|
+
export declare function resolveTransitionHooks(vnode: VNode, props: BaseTransitionProps<any>, state: TransitionState, instance: ComponentInternalInstance, postClone?: (hooks: TransitionHooks) => void): TransitionHooks;
|
|
630
639
|
export declare function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void;
|
|
631
640
|
export declare function getTransitionRawChildren(children: VNode[], keepComment?: boolean, parentKey?: VNode['key']): VNode[];
|
|
632
641
|
|
|
@@ -640,7 +649,7 @@ export interface HydrationRenderer extends Renderer<Element | ShadowRoot> {
|
|
|
640
649
|
export type ElementNamespace = 'svg' | 'mathml' | undefined;
|
|
641
650
|
export type RootRenderFunction<HostElement = RendererElement> = (vnode: VNode | null, container: HostElement, namespace?: ElementNamespace) => void;
|
|
642
651
|
export interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
|
|
643
|
-
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace,
|
|
652
|
+
patchProp(el: HostElement, key: string, prevValue: any, nextValue: any, namespace?: ElementNamespace, parentComponent?: ComponentInternalInstance | null): void;
|
|
644
653
|
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
645
654
|
remove(el: HostNode): void;
|
|
646
655
|
createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
|
|
@@ -658,7 +667,7 @@ export interface RendererOptions<HostNode = RendererNode, HostElement = Renderer
|
|
|
658
667
|
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
659
668
|
}
|
|
660
669
|
export interface RendererNode {
|
|
661
|
-
[key: string]: any;
|
|
670
|
+
[key: string | symbol]: any;
|
|
662
671
|
}
|
|
663
672
|
export interface RendererElement extends RendererNode {
|
|
664
673
|
}
|
|
@@ -683,7 +692,6 @@ type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode |
|
|
|
683
692
|
type NextFn = (vnode: VNode) => RendererNode | null;
|
|
684
693
|
type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
|
|
685
694
|
type RemoveFn = (vnode: VNode) => void;
|
|
686
|
-
type UnmountChildrenFn = (children: VNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void;
|
|
687
695
|
type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
688
696
|
type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
689
697
|
declare enum MoveType {
|
|
@@ -727,16 +735,16 @@ export declare const KeepAlive: {
|
|
|
727
735
|
export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
728
736
|
export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
729
737
|
|
|
730
|
-
export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
731
|
-
export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
732
|
-
export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
733
|
-
export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
734
|
-
export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
735
|
-
export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
736
|
-
export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
738
|
+
export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
739
|
+
export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
740
|
+
export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
741
|
+
export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
742
|
+
export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
743
|
+
export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
744
|
+
export declare const onServerPrefetch: (hook: () => any, target?: ComponentInternalInstance | null) => void;
|
|
737
745
|
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
738
|
-
export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) =>
|
|
739
|
-
export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) =>
|
|
746
|
+
export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => void;
|
|
747
|
+
export declare const onRenderTracked: (hook: DebuggerHook, target?: ComponentInternalInstance | null) => void;
|
|
740
748
|
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
741
749
|
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
742
750
|
|
|
@@ -836,7 +844,7 @@ export interface RuntimeCompilerOptions {
|
|
|
836
844
|
comments?: boolean;
|
|
837
845
|
delimiters?: [string, string];
|
|
838
846
|
}
|
|
839
|
-
export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<
|
|
847
|
+
export type ComponentOptions<Props = {}, RawBindings = any, D = any, C extends ComputedOptions = any, M extends MethodOptions = any, Mixin extends ComponentOptionsMixin = any, Extends extends ComponentOptionsMixin = any, E extends EmitsOptions = any, EE extends string = string, Defaults = {}, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<{}, RawBindings, D, C, M, Mixin, Extends, E, Readonly<Props>, Defaults, false, I, S, LC, Directives>>;
|
|
840
848
|
export type ComponentOptionsMixin = ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
841
849
|
export type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
842
850
|
export interface MethodOptions {
|
|
@@ -868,7 +876,7 @@ type InjectToObject<T extends ComponentInjectOptions> = T extends string[] ? {
|
|
|
868
876
|
interface LegacyOptions<Props, D, C extends ComputedOptions, M extends MethodOptions, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, I extends ComponentInjectOptions, II extends string, Provide extends ComponentProvideOptions = ComponentProvideOptions> {
|
|
869
877
|
compatConfig?: CompatConfig;
|
|
870
878
|
[key: string]: any;
|
|
871
|
-
data?: (this:
|
|
879
|
+
data?: (this: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>, vm: CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, MethodOptions, Mixin, Extends>) => D;
|
|
872
880
|
computed?: C;
|
|
873
881
|
methods?: M;
|
|
874
882
|
watch?: ComponentWatchOptions;
|
|
@@ -938,6 +946,34 @@ type OptionTypesType<P = {}, B = {}, D = {}, C extends ComputedOptions = {}, M e
|
|
|
938
946
|
M: M;
|
|
939
947
|
Defaults: Defaults;
|
|
940
948
|
};
|
|
949
|
+
/**
|
|
950
|
+
* @deprecated
|
|
951
|
+
*/
|
|
952
|
+
export type ComponentOptionsWithoutProps<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = {}, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, TE extends ComponentTypeEmits = {}, ResolvedEmits extends EmitsOptions = {} extends E ? TypeEmitsToOptions<TE> : E, PE = Props & EmitsToProps<ResolvedEmits>> = ComponentOptionsBase<PE, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
953
|
+
props?: never;
|
|
954
|
+
/**
|
|
955
|
+
* @private for language-tools use only
|
|
956
|
+
*/
|
|
957
|
+
__typeProps?: Props;
|
|
958
|
+
/**
|
|
959
|
+
* @private for language-tools use only
|
|
960
|
+
*/
|
|
961
|
+
__typeEmits?: TE;
|
|
962
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<PE, RawBindings, D, C, M, Mixin, Extends, ResolvedEmits, EE, {}, false, I, S, LC, Directives, Exposed>>;
|
|
963
|
+
/**
|
|
964
|
+
* @deprecated
|
|
965
|
+
*/
|
|
966
|
+
export type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<{
|
|
967
|
+
[key in PropNames]?: any;
|
|
968
|
+
} & EmitsToProps<E>>>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, {}, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
969
|
+
props: PropNames[];
|
|
970
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, {}, false, I, S, LC, Directives, Exposed>>;
|
|
971
|
+
/**
|
|
972
|
+
* @deprecated
|
|
973
|
+
*/
|
|
974
|
+
export type ComponentOptionsWithObjectProps<PropsOptions = ComponentObjectPropsOptions, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}, LC extends Record<string, Component> = {}, Directives extends Record<string, Directive> = {}, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, Props = Prettify<Readonly<ExtractPropTypes<PropsOptions> & EmitsToProps<E>>>, Defaults = ExtractDefaultPropTypes<PropsOptions>> = ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, I, II, S, LC, Directives, Exposed, Provide> & {
|
|
975
|
+
props: PropsOptions & ThisType<void>;
|
|
976
|
+
} & ThisType<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, Props, Defaults, false, I, S, LC, Directives>>;
|
|
941
977
|
|
|
942
978
|
export interface InjectionKey<T> extends Symbol {
|
|
943
979
|
}
|
|
@@ -954,8 +990,8 @@ export declare function hasInjectionContext(): boolean;
|
|
|
954
990
|
|
|
955
991
|
export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
956
992
|
type ResolveProps<PropsOrPropOptions, E extends EmitsOptions> = Readonly<PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes<PropsOrPropOptions> : PropsOrPropOptions> & ({} extends E ? {} : EmitsToProps<E>);
|
|
957
|
-
export 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> = ComponentPublicInstanceConstructor<
|
|
958
|
-
export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) =>
|
|
993
|
+
export 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> = ComponentPublicInstanceConstructor<CreateComponentPublicInstanceWithMixins<Props, RawBindings, D, C, M, Mixin, Extends, E, PP & Props, Defaults, MakeDefaultsOptional, {}, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed>> & ComponentOptionsBase<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, Defaults, {}, string, S, LC & GlobalComponents, Directives & GlobalDirectives, Exposed, Provide> & PP;
|
|
994
|
+
export type DefineSetupFnComponent<P extends Record<string, any>, E extends EmitsOptions = {}, S extends SlotsType = SlotsType, Props = P & EmitsToProps<E>, PP = PublicProps> = new (props: Props & PP) => CreateComponentPublicInstanceWithMixins<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, E, PP, {}, false, {}, S>;
|
|
959
995
|
export declare function defineComponent<Props extends Record<string, any>, E extends EmitsOptions = {}, EE extends string = string, S extends SlotsType = {}>(setup: (props: Props, ctx: SetupContext<E, S>) => RenderFunction | Promise<RenderFunction>, options?: Pick<ComponentOptions, 'name' | 'inheritAttrs'> & {
|
|
960
996
|
props?: (keyof Props)[];
|
|
961
997
|
emits?: E | EE[];
|
|
@@ -979,7 +1015,7 @@ export declare function defineComponent<TypeProps, RuntimePropsOptions extends C
|
|
|
979
1015
|
*/
|
|
980
1016
|
__typeEmits?: TypeEmits;
|
|
981
1017
|
} & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, RuntimeEmitsKeys, {}, // Defaults
|
|
982
|
-
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<
|
|
1018
|
+
InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): DefineComponent<InferredProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, ResolvedEmits, RuntimeEmitsKeys, PublicProps, ResolvedProps, ExtractDefaultPropTypes<RuntimePropsOptions>, Slots, LocalComponents, Directives, Exposed, Provide, unknown extends TypeProps ? true : false>;
|
|
983
1019
|
|
|
984
1020
|
export interface App<HostElement = any> {
|
|
985
1021
|
version: string;
|
|
@@ -988,12 +1024,13 @@ export interface App<HostElement = any> {
|
|
|
988
1024
|
use<Options>(plugin: Plugin<Options>, options: Options): this;
|
|
989
1025
|
mixin(mixin: ComponentOptions): this;
|
|
990
1026
|
component(name: string): Component | undefined;
|
|
991
|
-
component(name: string, component:
|
|
1027
|
+
component<T extends Component | DefineComponent>(name: string, component: T): this;
|
|
992
1028
|
directive<T = any, V = any>(name: string): Directive<T, V> | undefined;
|
|
993
1029
|
directive<T = any, V = any>(name: string, directive: Directive<T, V>): this;
|
|
994
1030
|
mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
|
|
995
1031
|
unmount(): void;
|
|
996
|
-
|
|
1032
|
+
onUnmount(cb: () => void): void;
|
|
1033
|
+
provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
|
|
997
1034
|
/**
|
|
998
1035
|
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
999
1036
|
* to variables provided via `app.provide()`.
|
|
@@ -1035,6 +1072,16 @@ export interface AppConfig {
|
|
|
1035
1072
|
* Enable warnings for computed getters that recursively trigger itself.
|
|
1036
1073
|
*/
|
|
1037
1074
|
warnRecursiveComputed?: boolean;
|
|
1075
|
+
/**
|
|
1076
|
+
* Whether to throw unhandled errors in production.
|
|
1077
|
+
* Default is `false` to avoid crashing on any error (and only logs it)
|
|
1078
|
+
* But in some cases, e.g. SSR, throwing might be more desirable.
|
|
1079
|
+
*/
|
|
1080
|
+
throwUnhandledErrorInProduction?: boolean;
|
|
1081
|
+
/**
|
|
1082
|
+
* Prefix for all useId() calls within this app
|
|
1083
|
+
*/
|
|
1084
|
+
idPrefix?: string;
|
|
1038
1085
|
}
|
|
1039
1086
|
export interface AppContext {
|
|
1040
1087
|
app: App;
|
|
@@ -1056,12 +1103,13 @@ type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
|
1056
1103
|
export interface TeleportProps {
|
|
1057
1104
|
to: string | RendererElement | null | undefined;
|
|
1058
1105
|
disabled?: boolean;
|
|
1106
|
+
defer?: boolean;
|
|
1059
1107
|
}
|
|
1060
1108
|
declare const TeleportImpl: {
|
|
1061
1109
|
name: string;
|
|
1062
1110
|
__isTeleport: boolean;
|
|
1063
1111
|
process(n1: TeleportVNode | null, n2: TeleportVNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, slotScopeIds: string[] | null, optimized: boolean, internals: RendererInternals): void;
|
|
1064
|
-
remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null,
|
|
1112
|
+
remove(vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, { um: unmount, o: { remove: hostRemove } }: RendererInternals, doRemove: boolean): void;
|
|
1065
1113
|
move: typeof moveTeleport;
|
|
1066
1114
|
hydrate: typeof hydrateTeleport;
|
|
1067
1115
|
};
|
|
@@ -1108,16 +1156,28 @@ export declare const Static: unique symbol;
|
|
|
1108
1156
|
export type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
|
|
1109
1157
|
export type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
|
|
1110
1158
|
type VNodeNormalizedRefAtom = {
|
|
1159
|
+
/**
|
|
1160
|
+
* component instance
|
|
1161
|
+
*/
|
|
1111
1162
|
i: ComponentInternalInstance;
|
|
1163
|
+
/**
|
|
1164
|
+
* Actual ref
|
|
1165
|
+
*/
|
|
1112
1166
|
r: VNodeRef;
|
|
1167
|
+
/**
|
|
1168
|
+
* setup ref key
|
|
1169
|
+
*/
|
|
1113
1170
|
k?: string;
|
|
1171
|
+
/**
|
|
1172
|
+
* refInFor marker
|
|
1173
|
+
*/
|
|
1114
1174
|
f?: boolean;
|
|
1115
1175
|
};
|
|
1116
1176
|
type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
|
|
1117
1177
|
type VNodeMountHook = (vnode: VNode) => void;
|
|
1118
1178
|
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
|
|
1119
1179
|
export type VNodeProps = {
|
|
1120
|
-
key?:
|
|
1180
|
+
key?: PropertyKey;
|
|
1121
1181
|
ref?: VNodeRef;
|
|
1122
1182
|
ref_for?: boolean;
|
|
1123
1183
|
ref_key?: string;
|
|
@@ -1137,7 +1197,7 @@ export interface VNode<HostNode = RendererNode, HostElement = RendererElement, E
|
|
|
1137
1197
|
}> {
|
|
1138
1198
|
type: VNodeTypes;
|
|
1139
1199
|
props: (VNodeProps & ExtraProps) | null;
|
|
1140
|
-
key:
|
|
1200
|
+
key: PropertyKey | null;
|
|
1141
1201
|
ref: VNodeNormalizedRef | null;
|
|
1142
1202
|
/**
|
|
1143
1203
|
* SFC only. This is assigned on vnode creation using currentScopeId
|
|
@@ -1151,6 +1211,7 @@ export interface VNode<HostNode = RendererNode, HostElement = RendererElement, E
|
|
|
1151
1211
|
el: HostNode | null;
|
|
1152
1212
|
anchor: HostNode | null;
|
|
1153
1213
|
target: HostElement | null;
|
|
1214
|
+
targetStart: HostNode | null;
|
|
1154
1215
|
targetAnchor: HostNode | null;
|
|
1155
1216
|
suspense: SuspenseBoundary | null;
|
|
1156
1217
|
shapeFlag: number;
|
|
@@ -1221,7 +1282,7 @@ export declare function createBaseVNode(type: VNodeTypes | ClassComponent | type
|
|
|
1221
1282
|
export declare const createVNode: typeof _createVNode;
|
|
1222
1283
|
declare function _createVNode(type: VNodeTypes | ClassComponent | typeof NULL_DYNAMIC_COMPONENT, props?: (Data & VNodeProps) | null, children?: unknown, patchFlag?: number, dynamicProps?: string[] | null, isBlockNode?: boolean): VNode;
|
|
1223
1284
|
export declare function guardReactiveProps(props: (Data & VNodeProps) | null): (Data & VNodeProps) | null;
|
|
1224
|
-
export declare function cloneVNode<T, U>(vnode: VNode<T, U>, extraProps?: (Data & VNodeProps) | null, mergeRef?: boolean): VNode<T, U>;
|
|
1285
|
+
export declare function cloneVNode<T, U>(vnode: VNode<T, U>, extraProps?: (Data & VNodeProps) | null, mergeRef?: boolean, cloneTransition?: boolean): VNode<T, U>;
|
|
1225
1286
|
/**
|
|
1226
1287
|
* @private
|
|
1227
1288
|
*/
|
|
@@ -1243,7 +1304,7 @@ type Data = Record<string, unknown>;
|
|
|
1243
1304
|
* the usage of `InstanceType<typeof Comp>` which only works for
|
|
1244
1305
|
* constructor-based component definition types.
|
|
1245
1306
|
*
|
|
1246
|
-
*
|
|
1307
|
+
* @example
|
|
1247
1308
|
* ```ts
|
|
1248
1309
|
* const MyComp = { ... }
|
|
1249
1310
|
* declare const instance: ComponentInstance<typeof MyComp>
|
|
@@ -1346,7 +1407,7 @@ export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends
|
|
|
1346
1407
|
attrs: Data;
|
|
1347
1408
|
slots: UnwrapSlotsType<S>;
|
|
1348
1409
|
emit: EmitFn<E>;
|
|
1349
|
-
expose:
|
|
1410
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
1350
1411
|
} : never;
|
|
1351
1412
|
/**
|
|
1352
1413
|
* We expose a subset of properties on the internal instance as they are
|
|
@@ -1387,8 +1448,6 @@ export interface ComponentInternalInstance {
|
|
|
1387
1448
|
slots: InternalSlots;
|
|
1388
1449
|
refs: Data;
|
|
1389
1450
|
emit: EmitFn;
|
|
1390
|
-
attrsProxy: Data | null;
|
|
1391
|
-
slotsProxy: Slots | null;
|
|
1392
1451
|
isMounted: boolean;
|
|
1393
1452
|
isUnmounted: boolean;
|
|
1394
1453
|
isDeactivated: boolean;
|
|
@@ -1404,8 +1463,9 @@ export declare const isRuntimeOnly: () => boolean;
|
|
|
1404
1463
|
export type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
1405
1464
|
export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
|
|
1406
1465
|
export type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onCleanup: OnCleanup) => any;
|
|
1466
|
+
type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
|
|
1407
1467
|
type MapSources<T, Immediate> = {
|
|
1408
|
-
[K in keyof T]: T[K] extends WatchSource<infer V> ?
|
|
1468
|
+
[K in keyof T]: T[K] extends WatchSource<infer V> ? MaybeUndefined<V, Immediate> : T[K] extends object ? MaybeUndefined<T[K], Immediate> : never;
|
|
1409
1469
|
};
|
|
1410
1470
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1411
1471
|
export interface WatchOptionsBase extends DebuggerOptions {
|
|
@@ -1421,10 +1481,10 @@ export declare function watchEffect(effect: WatchEffect, options?: WatchOptionsB
|
|
|
1421
1481
|
export declare function watchPostEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
|
|
1422
1482
|
export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
|
|
1423
1483
|
type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
1424
|
-
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T,
|
|
1484
|
+
export declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1485
|
+
export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: readonly [...T] | T, cb: [T] extends [ReactiveMarker] ? WatchCallback<T, MaybeUndefined<T, Immediate>> : WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1425
1486
|
export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1426
|
-
export declare function watch<T extends
|
|
1427
|
-
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1487
|
+
export declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
|
|
1428
1488
|
|
|
1429
1489
|
type AsyncComponentResolveResult<T = Component> = T | {
|
|
1430
1490
|
default: T;
|
|
@@ -1444,7 +1504,11 @@ export declare function defineAsyncComponent<T extends Component = {
|
|
|
1444
1504
|
new (): ComponentPublicInstance;
|
|
1445
1505
|
}>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
|
|
1446
1506
|
|
|
1447
|
-
export declare function useModel<M extends
|
|
1507
|
+
export declare function useModel<M extends PropertyKey, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: DefineModelOptions<T[K]>): ModelRef<T[K], M>;
|
|
1508
|
+
|
|
1509
|
+
export declare function useTemplateRef<T = unknown>(key: string): Readonly<ShallowRef<T | null>>;
|
|
1510
|
+
|
|
1511
|
+
export declare function useId(): string | undefined;
|
|
1448
1512
|
|
|
1449
1513
|
type RawProps = VNodeProps & {
|
|
1450
1514
|
__v_isVNode?: never;
|
|
@@ -1506,12 +1570,14 @@ export declare enum ErrorCodes {
|
|
|
1506
1570
|
APP_WARN_HANDLER = 11,
|
|
1507
1571
|
FUNCTION_REF = 12,
|
|
1508
1572
|
ASYNC_COMPONENT_LOADER = 13,
|
|
1509
|
-
SCHEDULER = 14
|
|
1573
|
+
SCHEDULER = 14,
|
|
1574
|
+
COMPONENT_UPDATE = 15,
|
|
1575
|
+
APP_UNMOUNT_CLEANUP = 16
|
|
1510
1576
|
}
|
|
1511
1577
|
type ErrorTypes = LifecycleHooks | ErrorCodes;
|
|
1512
|
-
export declare function callWithErrorHandling(fn: Function, instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
|
|
1578
|
+
export declare function callWithErrorHandling(fn: Function, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, args?: unknown[]): any;
|
|
1513
1579
|
export declare function callWithAsyncErrorHandling(fn: Function | Function[], instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
|
|
1514
|
-
export declare function handleError(err: unknown, instance: ComponentInternalInstance | null, type: ErrorTypes, throwInDev?: boolean): void;
|
|
1580
|
+
export declare function handleError(err: unknown, instance: ComponentInternalInstance | null | undefined, type: ErrorTypes, throwInDev?: boolean): void;
|
|
1515
1581
|
|
|
1516
1582
|
export declare function initCustomFormatter(): void;
|
|
1517
1583
|
|
|
@@ -1588,7 +1654,7 @@ export declare function renderList<T>(source: Iterable<T>, renderItem: (value: T
|
|
|
1588
1654
|
/**
|
|
1589
1655
|
* v-for object
|
|
1590
1656
|
*/
|
|
1591
|
-
export declare function renderList<T>(source: T, renderItem: <K extends keyof T>(value: T[K], key:
|
|
1657
|
+
export declare function renderList<T>(source: T, renderItem: <K extends keyof T>(value: T[K], key: string, index: number) => VNodeChild): VNodeChild[];
|
|
1592
1658
|
|
|
1593
1659
|
/**
|
|
1594
1660
|
* For prefixing keys in v-on="obj" with "on"
|
|
@@ -1648,8 +1714,8 @@ export type LegacyConfig = {
|
|
|
1648
1714
|
|
|
1649
1715
|
type LegacyPublicInstance = ComponentPublicInstance & LegacyPublicProperties;
|
|
1650
1716
|
interface LegacyPublicProperties {
|
|
1651
|
-
$set(target:
|
|
1652
|
-
$delete(target:
|
|
1717
|
+
$set<T extends Record<keyof any, any>, K extends keyof T>(target: T, key: K, value: T[K]): void;
|
|
1718
|
+
$delete<T extends Record<keyof any, any>, K extends keyof T>(target: T, key: K): void;
|
|
1653
1719
|
$mount(el?: string | Element): this;
|
|
1654
1720
|
$destroy(): void;
|
|
1655
1721
|
$scopedSlots: Slots;
|
|
@@ -1671,7 +1737,8 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
|
|
|
1671
1737
|
version: string;
|
|
1672
1738
|
config: AppConfig & LegacyConfig;
|
|
1673
1739
|
nextTick: typeof nextTick;
|
|
1674
|
-
use(plugin: Plugin
|
|
1740
|
+
use<Options extends unknown[]>(plugin: Plugin<Options>, ...options: Options): CompatVue;
|
|
1741
|
+
use<Options>(plugin: Plugin<Options>, options: Options): CompatVue;
|
|
1675
1742
|
mixin(mixin: ComponentOptions): CompatVue;
|
|
1676
1743
|
component(name: string): Component | undefined;
|
|
1677
1744
|
component(name: string, component: Component): CompatVue;
|
|
@@ -1685,11 +1752,11 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
|
|
|
1685
1752
|
/**
|
|
1686
1753
|
* @deprecated Vue 3 no longer needs set() for adding new properties.
|
|
1687
1754
|
*/
|
|
1688
|
-
set(target: any, key:
|
|
1755
|
+
set(target: any, key: PropertyKey, value: any): void;
|
|
1689
1756
|
/**
|
|
1690
1757
|
* @deprecated Vue 3 no longer needs delete() for property deletions.
|
|
1691
1758
|
*/
|
|
1692
|
-
delete(target: any, key:
|
|
1759
|
+
delete(target: any, key: PropertyKey): void;
|
|
1693
1760
|
/**
|
|
1694
1761
|
* @deprecated use `reactive` instead.
|
|
1695
1762
|
*/
|