@vue/runtime-core 3.5.0-alpha.2 → 3.5.0-alpha.4
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 +5943 -5860
- package/dist/runtime-core.cjs.prod.js +4925 -4856
- package/dist/runtime-core.d.ts +79 -55
- package/dist/runtime-core.esm-bundler.js +5979 -5897
- 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')
|
|
@@ -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;
|
|
@@ -484,7 +483,7 @@ type ExposedKeys<T, Exposed extends string & keyof T> = '' extends Exposed ? T :
|
|
|
484
483
|
export type ComponentPublicInstance<P = {}, // props type extracted from props option
|
|
485
484
|
B = {}, // raw bindings returned from setup()
|
|
486
485
|
D = {}, // return from data()
|
|
487
|
-
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 = ''> = {
|
|
488
487
|
$: ComponentInternalInstance;
|
|
489
488
|
$data: D;
|
|
490
489
|
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<Prettify<P> & PublicProps, keyof Defaults> : Prettify<P> & PublicProps;
|
|
@@ -498,8 +497,8 @@ C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOpt
|
|
|
498
497
|
$options: Options & MergedComponentOptionsOverride;
|
|
499
498
|
$forceUpdate: () => void;
|
|
500
499
|
$nextTick: typeof nextTick;
|
|
501
|
-
$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;
|
|
502
|
-
} & 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>;
|
|
503
502
|
|
|
504
503
|
declare enum LifecycleHooks {
|
|
505
504
|
BEFORE_CREATE = "bc",
|
|
@@ -535,7 +534,6 @@ declare const SuspenseImpl: {
|
|
|
535
534
|
__isSuspense: boolean;
|
|
536
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;
|
|
537
536
|
hydrate: typeof hydrateSuspense;
|
|
538
|
-
create: typeof createSuspenseBoundary;
|
|
539
537
|
normalize: typeof normalizeSuspenseChildren;
|
|
540
538
|
};
|
|
541
539
|
export declare const Suspense: {
|
|
@@ -568,10 +566,9 @@ export interface SuspenseBoundary {
|
|
|
568
566
|
fallback(fallbackVNode: VNode): void;
|
|
569
567
|
move(container: RendererElement, anchor: RendererNode | null, type: MoveType): void;
|
|
570
568
|
next(): RendererNode | null;
|
|
571
|
-
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn): void;
|
|
569
|
+
registerDep(instance: ComponentInternalInstance, setupRenderEffect: SetupRenderEffectFn, optimized: boolean): void;
|
|
572
570
|
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void;
|
|
573
571
|
}
|
|
574
|
-
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;
|
|
575
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;
|
|
576
573
|
declare function normalizeSuspenseChildren(vnode: VNode): void;
|
|
577
574
|
|
|
@@ -638,7 +635,7 @@ export declare const BaseTransition: new () => {
|
|
|
638
635
|
default(): VNode[];
|
|
639
636
|
};
|
|
640
637
|
};
|
|
641
|
-
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;
|
|
642
639
|
export declare function setTransitionHooks(vnode: VNode, hooks: TransitionHooks): void;
|
|
643
640
|
export declare function getTransitionRawChildren(children: VNode[], keepComment?: boolean, parentKey?: VNode['key']): VNode[];
|
|
644
641
|
|
|
@@ -652,7 +649,7 @@ export interface HydrationRenderer extends Renderer<Element | ShadowRoot> {
|
|
|
652
649
|
export type ElementNamespace = 'svg' | 'mathml' | undefined;
|
|
653
650
|
export type RootRenderFunction<HostElement = RendererElement> = (vnode: VNode | null, container: HostElement, namespace?: ElementNamespace) => void;
|
|
654
651
|
export interface RendererOptions<HostNode = RendererNode, HostElement = RendererElement> {
|
|
655
|
-
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;
|
|
656
653
|
insert(el: HostNode, parent: HostElement, anchor?: HostNode | null): void;
|
|
657
654
|
remove(el: HostNode): void;
|
|
658
655
|
createElement(type: string, namespace?: ElementNamespace, isCustomizedBuiltIn?: string, vnodeProps?: (VNodeProps & {
|
|
@@ -670,7 +667,7 @@ export interface RendererOptions<HostNode = RendererNode, HostElement = Renderer
|
|
|
670
667
|
insertStaticContent?(content: string, parent: HostElement, anchor: HostNode | null, namespace: ElementNamespace, start?: HostNode | null, end?: HostNode | null): [HostNode, HostNode];
|
|
671
668
|
}
|
|
672
669
|
export interface RendererNode {
|
|
673
|
-
[key: string]: any;
|
|
670
|
+
[key: string | symbol]: any;
|
|
674
671
|
}
|
|
675
672
|
export interface RendererElement extends RendererNode {
|
|
676
673
|
}
|
|
@@ -695,7 +692,6 @@ type MoveFn = (vnode: VNode, container: RendererElement, anchor: RendererNode |
|
|
|
695
692
|
type NextFn = (vnode: VNode) => RendererNode | null;
|
|
696
693
|
type UnmountFn = (vnode: VNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean) => void;
|
|
697
694
|
type RemoveFn = (vnode: VNode) => void;
|
|
698
|
-
type UnmountChildrenFn = (children: VNode[], parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, doRemove?: boolean, optimized?: boolean, start?: number) => void;
|
|
699
695
|
type MountComponentFn = (initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
700
696
|
type SetupRenderEffectFn = (instance: ComponentInternalInstance, initialVNode: VNode, container: RendererElement, anchor: RendererNode | null, parentSuspense: SuspenseBoundary | null, namespace: ElementNamespace, optimized: boolean) => void;
|
|
701
697
|
declare enum MoveType {
|
|
@@ -739,16 +735,16 @@ export declare const KeepAlive: {
|
|
|
739
735
|
export declare function onActivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
740
736
|
export declare function onDeactivated(hook: Function, target?: ComponentInternalInstance | null): void;
|
|
741
737
|
|
|
742
|
-
export declare const onBeforeMount: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
743
|
-
export declare const onMounted: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
744
|
-
export declare const onBeforeUpdate: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
745
|
-
export declare const onUpdated: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
746
|
-
export declare const onBeforeUnmount: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
747
|
-
export declare const onUnmounted: (hook: () => any, target?: ComponentInternalInstance | null) =>
|
|
748
|
-
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;
|
|
749
745
|
type DebuggerHook = (e: DebuggerEvent) => void;
|
|
750
|
-
export declare const onRenderTriggered: (hook: DebuggerHook, target?: ComponentInternalInstance | null) =>
|
|
751
|
-
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;
|
|
752
748
|
type ErrorCapturedHook<TError = unknown> = (err: TError, instance: ComponentPublicInstance | null, info: string) => boolean | void;
|
|
753
749
|
export declare function onErrorCaptured<TError = Error>(hook: ErrorCapturedHook<TError>, target?: ComponentInternalInstance | null): void;
|
|
754
750
|
|
|
@@ -1034,7 +1030,7 @@ export interface App<HostElement = any> {
|
|
|
1034
1030
|
mount(rootContainer: HostElement | string, isHydrate?: boolean, namespace?: boolean | ElementNamespace): ComponentPublicInstance;
|
|
1035
1031
|
unmount(): void;
|
|
1036
1032
|
onUnmount(cb: () => void): void;
|
|
1037
|
-
provide<T
|
|
1033
|
+
provide<T, K = InjectionKey<T> | string | number>(key: K, value: K extends InjectionKey<infer V> ? V : T): this;
|
|
1038
1034
|
/**
|
|
1039
1035
|
* Runs a function with the app as active instance. This allows using of `inject()` within the function to get access
|
|
1040
1036
|
* to variables provided via `app.provide()`.
|
|
@@ -1076,6 +1072,16 @@ export interface AppConfig {
|
|
|
1076
1072
|
* Enable warnings for computed getters that recursively trigger itself.
|
|
1077
1073
|
*/
|
|
1078
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;
|
|
1079
1085
|
}
|
|
1080
1086
|
export interface AppContext {
|
|
1081
1087
|
app: App;
|
|
@@ -1097,12 +1103,13 @@ type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>;
|
|
|
1097
1103
|
export interface TeleportProps {
|
|
1098
1104
|
to: string | RendererElement | null | undefined;
|
|
1099
1105
|
disabled?: boolean;
|
|
1106
|
+
defer?: boolean;
|
|
1100
1107
|
}
|
|
1101
1108
|
declare const TeleportImpl: {
|
|
1102
1109
|
name: string;
|
|
1103
1110
|
__isTeleport: boolean;
|
|
1104
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;
|
|
1105
|
-
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;
|
|
1106
1113
|
move: typeof moveTeleport;
|
|
1107
1114
|
hydrate: typeof hydrateTeleport;
|
|
1108
1115
|
};
|
|
@@ -1149,16 +1156,28 @@ export declare const Static: unique symbol;
|
|
|
1149
1156
|
export type VNodeTypes = string | VNode | Component | typeof Text | typeof Static | typeof Comment | typeof Fragment | typeof Teleport | typeof TeleportImpl | typeof Suspense | typeof SuspenseImpl;
|
|
1150
1157
|
export type VNodeRef = string | Ref | ((ref: Element | ComponentPublicInstance | null, refs: Record<string, any>) => void);
|
|
1151
1158
|
type VNodeNormalizedRefAtom = {
|
|
1159
|
+
/**
|
|
1160
|
+
* component instance
|
|
1161
|
+
*/
|
|
1152
1162
|
i: ComponentInternalInstance;
|
|
1163
|
+
/**
|
|
1164
|
+
* Actual ref
|
|
1165
|
+
*/
|
|
1153
1166
|
r: VNodeRef;
|
|
1167
|
+
/**
|
|
1168
|
+
* setup ref key
|
|
1169
|
+
*/
|
|
1154
1170
|
k?: string;
|
|
1171
|
+
/**
|
|
1172
|
+
* refInFor marker
|
|
1173
|
+
*/
|
|
1155
1174
|
f?: boolean;
|
|
1156
1175
|
};
|
|
1157
1176
|
type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAtom[];
|
|
1158
1177
|
type VNodeMountHook = (vnode: VNode) => void;
|
|
1159
1178
|
type VNodeUpdateHook = (vnode: VNode, oldVNode: VNode) => void;
|
|
1160
1179
|
export type VNodeProps = {
|
|
1161
|
-
key?:
|
|
1180
|
+
key?: PropertyKey;
|
|
1162
1181
|
ref?: VNodeRef;
|
|
1163
1182
|
ref_for?: boolean;
|
|
1164
1183
|
ref_key?: string;
|
|
@@ -1178,7 +1197,7 @@ export interface VNode<HostNode = RendererNode, HostElement = RendererElement, E
|
|
|
1178
1197
|
}> {
|
|
1179
1198
|
type: VNodeTypes;
|
|
1180
1199
|
props: (VNodeProps & ExtraProps) | null;
|
|
1181
|
-
key:
|
|
1200
|
+
key: PropertyKey | null;
|
|
1182
1201
|
ref: VNodeNormalizedRef | null;
|
|
1183
1202
|
/**
|
|
1184
1203
|
* SFC only. This is assigned on vnode creation using currentScopeId
|
|
@@ -1192,6 +1211,7 @@ export interface VNode<HostNode = RendererNode, HostElement = RendererElement, E
|
|
|
1192
1211
|
el: HostNode | null;
|
|
1193
1212
|
anchor: HostNode | null;
|
|
1194
1213
|
target: HostElement | null;
|
|
1214
|
+
targetStart: HostNode | null;
|
|
1195
1215
|
targetAnchor: HostNode | null;
|
|
1196
1216
|
suspense: SuspenseBoundary | null;
|
|
1197
1217
|
shapeFlag: number;
|
|
@@ -1284,7 +1304,7 @@ type Data = Record<string, unknown>;
|
|
|
1284
1304
|
* the usage of `InstanceType<typeof Comp>` which only works for
|
|
1285
1305
|
* constructor-based component definition types.
|
|
1286
1306
|
*
|
|
1287
|
-
*
|
|
1307
|
+
* @example
|
|
1288
1308
|
* ```ts
|
|
1289
1309
|
* const MyComp = { ... }
|
|
1290
1310
|
* declare const instance: ComponentInstance<typeof MyComp>
|
|
@@ -1387,7 +1407,7 @@ export type SetupContext<E = EmitsOptions, S extends SlotsType = {}> = E extends
|
|
|
1387
1407
|
attrs: Data;
|
|
1388
1408
|
slots: UnwrapSlotsType<S>;
|
|
1389
1409
|
emit: EmitFn<E>;
|
|
1390
|
-
expose:
|
|
1410
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
1391
1411
|
} : never;
|
|
1392
1412
|
/**
|
|
1393
1413
|
* We expose a subset of properties on the internal instance as they are
|
|
@@ -1428,8 +1448,6 @@ export interface ComponentInternalInstance {
|
|
|
1428
1448
|
slots: InternalSlots;
|
|
1429
1449
|
refs: Data;
|
|
1430
1450
|
emit: EmitFn;
|
|
1431
|
-
attrsProxy: Data | null;
|
|
1432
|
-
slotsProxy: Slots | null;
|
|
1433
1451
|
isMounted: boolean;
|
|
1434
1452
|
isUnmounted: boolean;
|
|
1435
1453
|
isDeactivated: boolean;
|
|
@@ -1445,8 +1463,9 @@ export declare const isRuntimeOnly: () => boolean;
|
|
|
1445
1463
|
export type WatchEffect = (onCleanup: OnCleanup) => void;
|
|
1446
1464
|
export type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
|
|
1447
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;
|
|
1448
1467
|
type MapSources<T, Immediate> = {
|
|
1449
|
-
[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;
|
|
1450
1469
|
};
|
|
1451
1470
|
type OnCleanup = (cleanupFn: () => void) => void;
|
|
1452
1471
|
export interface WatchOptionsBase extends DebuggerOptions {
|
|
@@ -1462,10 +1481,10 @@ export declare function watchEffect(effect: WatchEffect, options?: WatchOptionsB
|
|
|
1462
1481
|
export declare function watchPostEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
|
|
1463
1482
|
export declare function watchSyncEffect(effect: WatchEffect, options?: DebuggerOptions): WatchStopHandle;
|
|
1464
1483
|
type MultiWatchSources = (WatchSource<unknown> | object)[];
|
|
1465
|
-
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;
|
|
1466
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;
|
|
1467
|
-
export declare function watch<T extends
|
|
1468
|
-
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;
|
|
1469
1488
|
|
|
1470
1489
|
type AsyncComponentResolveResult<T = Component> = T | {
|
|
1471
1490
|
default: T;
|
|
@@ -1485,7 +1504,11 @@ export declare function defineAsyncComponent<T extends Component = {
|
|
|
1485
1504
|
new (): ComponentPublicInstance;
|
|
1486
1505
|
}>(source: AsyncComponentLoader<T> | AsyncComponentOptions<T>): T;
|
|
1487
1506
|
|
|
1488
|
-
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;
|
|
1489
1512
|
|
|
1490
1513
|
type RawProps = VNodeProps & {
|
|
1491
1514
|
__v_isVNode?: never;
|
|
@@ -1548,12 +1571,13 @@ export declare enum ErrorCodes {
|
|
|
1548
1571
|
FUNCTION_REF = 12,
|
|
1549
1572
|
ASYNC_COMPONENT_LOADER = 13,
|
|
1550
1573
|
SCHEDULER = 14,
|
|
1551
|
-
|
|
1574
|
+
COMPONENT_UPDATE = 15,
|
|
1575
|
+
APP_UNMOUNT_CLEANUP = 16
|
|
1552
1576
|
}
|
|
1553
1577
|
type ErrorTypes = LifecycleHooks | ErrorCodes;
|
|
1554
|
-
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;
|
|
1555
1579
|
export declare function callWithAsyncErrorHandling(fn: Function | Function[], instance: ComponentInternalInstance | null, type: ErrorTypes, args?: unknown[]): any;
|
|
1556
|
-
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;
|
|
1557
1581
|
|
|
1558
1582
|
export declare function initCustomFormatter(): void;
|
|
1559
1583
|
|
|
@@ -1630,7 +1654,7 @@ export declare function renderList<T>(source: Iterable<T>, renderItem: (value: T
|
|
|
1630
1654
|
/**
|
|
1631
1655
|
* v-for object
|
|
1632
1656
|
*/
|
|
1633
|
-
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[];
|
|
1634
1658
|
|
|
1635
1659
|
/**
|
|
1636
1660
|
* For prefixing keys in v-on="obj" with "on"
|
|
@@ -1690,8 +1714,8 @@ export type LegacyConfig = {
|
|
|
1690
1714
|
|
|
1691
1715
|
type LegacyPublicInstance = ComponentPublicInstance & LegacyPublicProperties;
|
|
1692
1716
|
interface LegacyPublicProperties {
|
|
1693
|
-
$set(target:
|
|
1694
|
-
$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;
|
|
1695
1719
|
$mount(el?: string | Element): this;
|
|
1696
1720
|
$destroy(): void;
|
|
1697
1721
|
$scopedSlots: Slots;
|
|
@@ -1728,11 +1752,11 @@ export type CompatVue = Pick<App, 'version' | 'component' | 'directive'> & {
|
|
|
1728
1752
|
/**
|
|
1729
1753
|
* @deprecated Vue 3 no longer needs set() for adding new properties.
|
|
1730
1754
|
*/
|
|
1731
|
-
set(target: any, key:
|
|
1755
|
+
set(target: any, key: PropertyKey, value: any): void;
|
|
1732
1756
|
/**
|
|
1733
1757
|
* @deprecated Vue 3 no longer needs delete() for property deletions.
|
|
1734
1758
|
*/
|
|
1735
|
-
delete(target: any, key:
|
|
1759
|
+
delete(target: any, key: PropertyKey): void;
|
|
1736
1760
|
/**
|
|
1737
1761
|
* @deprecated use `reactive` instead.
|
|
1738
1762
|
*/
|