import * as Vue$1 from 'vue';
import Vue__default, { VNode, VueConstructor, ComponentOptions as ComponentOptions$1, AsyncComponent } from 'vue';
import { VueConstructor as VueConstructor$1 } from 'vue/types/umd';
declare type Data = {
[key: string]: unknown;
};
declare type ComponentPropsOptions
= ComponentObjectPropsOptions
| string[];
declare type ComponentObjectPropsOptions
= {
[K in keyof P]: Prop
| null;
};
declare type Prop = PropOptions | PropType;
declare type DefaultFactory = () => T | null | undefined;
interface PropOptions {
type?: PropType | true | null;
required?: boolean;
default?: D | DefaultFactory | null | undefined | object;
validator?(value: unknown): boolean;
}
declare type PropType = PropConstructor | PropConstructor[];
declare type PropConstructor = {
new (...args: any[]): T & object;
} | {
(): T;
} | {
new (...args: string[]): Function;
};
declare type RequiredKeys = {
[K in keyof T]: T[K] extends {
required: true;
} | {
default: any;
} | BooleanConstructor | {
type: BooleanConstructor;
} ? K : never;
}[keyof T];
declare type OptionalKeys = Exclude>;
declare type ExtractFunctionPropType = any[], TResult = any> = T extends (...args: TArgs) => TResult ? T : never;
declare type ExtractCorrectPropType = T extends Function ? ExtractFunctionPropType : Exclude;
declare type InferPropType = T extends null ? any : T extends {
type: null | true;
} ? any : T extends ObjectConstructor | {
type: ObjectConstructor;
} ? Record : T extends BooleanConstructor | {
type: BooleanConstructor;
} ? boolean : T extends DateConstructor | {
type: DateConstructor;
} ? Date : T extends FunctionConstructor ? Function : T extends Prop ? unknown extends V ? D extends null | undefined ? V : D : ExtractCorrectPropType : T;
declare type ExtractPropTypes = O extends object ? {
[K in RequiredKeys]: InferPropType;
} & {
[K in OptionalKeys]?: InferPropType;
} : {
[K in string]: any;
};
declare type DefaultKeys = {
[K in keyof T]: T[K] extends {
default: any;
} ? K : never;
}[keyof T];
declare type ExtractDefaultPropTypes = O extends object ? {
[K in DefaultKeys]: InferPropType;
} : {};
declare type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
declare type Slot = (...args: any[]) => VNode[];
declare type InternalSlots = {
[name: string]: Slot | undefined;
};
declare type ObjectEmitsOptions$1 = Record any) | null>;
declare type EmitsOptions$1 = ObjectEmitsOptions$1 | string[];
declare type EmitFn = Options extends Array ? (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 : (event: key, ...args: any[]) => void;
}[Event]>;
declare type Slots = Readonly;
interface SetupContext {
attrs: Data;
slots: Slots;
emit: EmitFn;
/**
* @deprecated not available in Vue 2
*/
expose: (exposed?: Record) => void;
/**
* @deprecated not available in Vue 3
*/
readonly parent: ComponentInstance | null;
/**
* @deprecated not available in Vue 3
*/
readonly root: ComponentInstance;
/**
* @deprecated not available in Vue 3
*/
readonly listeners: {
[key in string]?: Function;
};
/**
* @deprecated not available in Vue 3
*/
readonly refs: {
[key: string]: Vue | Element | Vue[] | Element[];
};
}
/**
* We expose a subset of properties on the internal instance as they are
* useful for advanced external libraries and tools.
*/
declare interface ComponentInternalInstance {
uid: number;
type: Record;
parent: ComponentInternalInstance | null;
root: ComponentInternalInstance;
/**
* Vnode representing this component in its parent's vdom tree
*/
vnode: VNode;
/**
* Root vnode of this component's own vdom tree
*/
/**
* The reactive effect for rendering and patching the component. Callable.
*/
update: Function;
data: Data;
props: Data;
attrs: Data;
refs: Data;
emit: EmitFn;
slots: InternalSlots;
emitted: Record | null;
proxy: ComponentInstance;
isMounted: boolean;
isUnmounted: boolean;
isDeactivated: boolean;
}
declare function getCurrentInstance(): ComponentInternalInstance | null;
declare type ComponentInstance = InstanceType;
declare type ComponentRenderProxy = {
$data: D;
$props: Readonly & Omit : P & PublicProps>;
$attrs: Data;
} & Readonly
& ShallowUnwrapRef & D & M & ExtractComputedReturns & Omit;
declare type VueConstructorProxy = VueConstructor & {
new (...args: any[]): ComponentRenderProxy, ShallowUnwrapRef, Data, Computed, Methods, ExtractPropTypes, ExtractDefaultPropTypes, true>;
};
declare type DefaultData = object | ((this: V) => object);
declare type DefaultMethods = {
[key: string]: (this: V, ...args: any[]) => any;
};
declare type DefaultComputed = {
[key: string]: any;
};
declare type VueProxy, Computed extends ComputedOptions = DefaultComputed, Methods extends MethodOptions = DefaultMethods> = ComponentOptions$1 & Data, Methods, Computed, PropsOptions, ExtractPropTypes> & VueConstructorProxy;
declare type ComponentPublicInstance = {
$: ComponentInternalInstance;
$data: D;
$props: MakeDefaultsOptional extends true ? Partial & Omit : P & PublicProps;
$attrs: Data;
$refs: Data;
$slots: Slots;
$root: ComponentPublicInstance | null;
$parent: ComponentPublicInstance | null;
$emit: EmitFn;
$el: any;
$forceUpdate: () => void;
$nextTick: typeof nextTick;
$watch(source: string | Function, cb: Function, options?: WatchOptions): WatchStopHandle;
} & P & ShallowUnwrapRef & UnwrapNestedRefs & ExtractComputedReturns & M;
declare type ComputedGetter$1 = (ctx?: any) => T;
declare type ComputedSetter$1 = (v: T) => void;
declare type ObjectEmitsOptions = Record any) | null>;
declare type EmitsOptions = ObjectEmitsOptions | string[];
interface WritableComputedOptions$1 {
get: ComputedGetter$1;
set: ComputedSetter$1;
}
declare type ComputedOptions = Record | WritableComputedOptions$1>;
interface MethodOptions {
[key: string]: Function;
}
declare type SetupFunction = (this: void, props: Props, ctx: SetupContext) => RawBindings | (() => VNode | null) | void;
interface ComponentOptionsBase extends Omit, 'data' | 'computed' | 'method' | 'setup' | 'props'> {
[key: string]: any;
data?: (this: Props & Vue__default, vm: Props) => D;
computed?: C;
methods?: M;
}
declare type ExtractComputedReturns = {
[key in keyof T]: T[key] extends {
get: (...args: any[]) => infer TReturn;
} ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
};
declare type ComponentOptionsWithProps> = ComponentOptionsBase & {
props?: PropsOptions;
emits?: (EmitsOptions | string[]) & ThisType;
setup?: SetupFunction;
} & ThisType>;
declare type ComponentOptionsWithArrayProps> = ComponentOptionsBase & {
props?: PropNames[];
emits?: (EmitsOptions | string[]) & ThisType;
setup?: SetupFunction;
} & ThisType>;
declare type ComponentOptionsWithoutProps = ComponentOptionsBase & {
props?: undefined;
emits?: (EmitsOptions | string[]) & ThisType;
setup?: SetupFunction;
} & ThisType>;
declare type AnyObject = Record;
declare type Equal = (() => U extends Left ? 1 : 0) extends (() => U extends Right ? 1 : 0) ? true : false;
declare type HasDefined = Equal extends true ? false : true;
declare function defineComponent(options: ComponentOptionsWithoutProps): VueProxy;
declare function defineComponent(options: ComponentOptionsWithArrayProps): VueProxy, RawBindings, D, C, M>;
declare function defineComponent(options: HasDefined extends true ? ComponentOptionsWithProps : ComponentOptionsWithProps): VueProxy;
declare type ComponentOptions = ComponentOptionsWithoutProps | ComponentOptionsWithArrayProps | ComponentOptionsWithProps;
declare type Component = VueProxy;
declare type ComponentOrComponentOptions = ComponentOptions | Component;
declare type AsyncComponentResolveResult = T | {
default: T;
};
declare type AsyncComponentLoader = () => Promise;
interface AsyncComponentOptions {
loader: AsyncComponentLoader;
loadingComponent?: ComponentOrComponentOptions;
errorComponent?: ComponentOrComponentOptions;
delay?: number;
timeout?: number;
suspensible?: boolean;
onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
}
declare function defineAsyncComponent(source: AsyncComponentLoader | AsyncComponentOptions): AsyncComponent;
declare const Plugin: {
install: (Vue: VueConstructor) => void;
};
declare const _refBrand: unique symbol;
interface Ref {
readonly [_refBrand]: true;
value: T;
}
interface WritableComputedRef extends Ref {
/**
* `effect` is added to be able to differentiate refs from computed properties.
* **Differently from Vue 3, it's just `true`**. This is because there is no equivalent
* of `ReactiveEffect` in `@vue/composition-api`.
*/
effect: true;
}
interface ComputedRef extends WritableComputedRef {
readonly value: T;
}
declare type ToRefs = {
[K in keyof T]: Ref;
};
declare type CollectionTypes = IterableCollections | WeakCollections;
declare type IterableCollections = Map | Set;
declare type WeakCollections = WeakMap | WeakSet;
declare type BaseTypes = string | number | boolean | Node | Window;
declare type ShallowUnwrapRef = {
[K in keyof T]: T[K] extends Ref ? V : T[K];
};
declare type UnwrapRef = T extends Ref ? UnwrapRefSimple : UnwrapRefSimple;
declare type UnwrapRefSimple = T extends Function | CollectionTypes | BaseTypes | Ref ? T : T extends Array ? {
[K in keyof T]: UnwrapRefSimple;
} : T extends object ? {
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef;
} : T;
interface RefOption {
get(): T;
set?(x: T): void;
}
declare class RefImpl implements Ref {
readonly [_refBrand]: true;
value: T;
constructor({ get, set }: RefOption);
}
declare function createRef(options: RefOption, isReadonly?: boolean, isComputed?: boolean): RefImpl;
declare function ref(raw: T): T extends Ref ? T : Ref>;
declare function ref(raw: T): Ref>;
declare function ref(): Ref;
declare function isRef(value: any): value is Ref;
declare function unref(ref: T): T extends Ref ? V : T;
declare function toRefs(obj: T): ToRefs;
declare type CustomRefFactory = (track: () => void, trigger: () => void) => {
get: () => T;
set: (value: T) => void;
};
declare function customRef(factory: CustomRefFactory): Ref;
declare function toRef(object: T, key: K): Ref;
declare function shallowRef(value: T): T extends Ref ? T : Ref;
declare function shallowRef(value: T): Ref;
declare function shallowRef(): Ref;
declare function triggerRef(value: any): void;
declare function proxyRefs(objectWithRefs: T): ShallowUnwrapRef;
declare function isRaw(obj: any): boolean;
declare function isReactive(obj: any): boolean;
declare function shallowReactive(obj: T): T;
/**
* Make obj reactivity
*/
declare function reactive(obj: T): UnwrapRef;
/**
* Make sure obj can't be a reactive
*/
declare function markRaw(obj: T): T;
declare function toRaw(observed: T): T;
declare function isReadonly(obj: any): boolean;
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
declare type Builtin = Primitive | Function | Date | Error | RegExp;
declare type DeepReadonly = T extends Builtin ? T : T extends Map ? ReadonlyMap, DeepReadonly> : T extends ReadonlyMap ? ReadonlyMap, DeepReadonly> : T extends WeakMap ? WeakMap, DeepReadonly> : T extends Set ? ReadonlySet> : T extends ReadonlySet ? ReadonlySet> : T extends WeakSet ? WeakSet> : T extends Promise ? Promise> : T extends {} ? {
readonly [K in keyof T]: DeepReadonly;
} : Readonly;
declare type UnwrapNestedRefs = T extends Ref ? T : UnwrapRefSimple;
/**
* **In @vue/composition-api, `reactive` only provides type-level readonly check**
*
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
declare function readonly(target: T): DeepReadonly>;
declare function shallowReadonly(obj: T): Readonly;
/**
* Set a property on an object. Adds the new property, triggers change
* notification and intercept it's subsequent access if the property doesn't
* already exist.
*/
declare function set(target: AnyObject, key: any, val: T): T;
/**
* Delete a property and trigger change if necessary.
*/
declare function del(target: AnyObject, key: any): void;
declare const onBeforeMount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onMounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onBeforeUpdate: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onUpdated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onBeforeUnmount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onUnmounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onErrorCaptured: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onActivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onDeactivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onServerPrefetch: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare type WatchEffect = (onInvalidate: InvalidateCbRegistrator) => void;
declare type WatchSource = Ref | ComputedRef | (() => T);
declare type WatchCallback = (value: V, oldValue: OV, onInvalidate: InvalidateCbRegistrator) => any;
declare type MapSources = {
[K in keyof T]: T[K] extends WatchSource ? V : never;
};
declare type MapOldSources = {
[K in keyof T]: T[K] extends WatchSource ? Immediate extends true ? V | undefined : V : never;
};
interface WatchOptionsBase {
flush?: FlushMode;
}
declare type InvalidateCbRegistrator = (cb: () => void) => void;
declare type FlushMode = 'pre' | 'post' | 'sync';
interface WatchOptions extends WatchOptionsBase {
immediate?: Immediate;
deep?: boolean;
}
interface VueWatcher {
lazy: boolean;
get(): any;
teardown(): void;
run(): void;
value: any;
}
declare type WatchStopHandle = () => void;
declare function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle;
declare function watchPostEffect(effect: WatchEffect): WatchStopHandle;
declare function watchSyncEffect(effect: WatchEffect): WatchStopHandle;
declare function watch[]>, Immediate extends Readonly = false>(sources: T, cb: WatchCallback, MapOldSources>, options?: WatchOptions): WatchStopHandle;
declare function watch = false>(source: WatchSource, cb: WatchCallback, options?: WatchOptions): WatchStopHandle;
declare function watch = false>(source: T, cb: WatchCallback, options?: WatchOptions): WatchStopHandle;
declare type ComputedGetter = (ctx?: any) => T;
declare type ComputedSetter = (v: T) => void;
interface WritableComputedOptions {
get: ComputedGetter;
set: ComputedSetter;
}
declare function computed(getter: ComputedGetter): ComputedRef;
declare function computed(options: WritableComputedOptions): WritableComputedRef;
interface InjectionKey extends Symbol {
}
declare function provide(key: InjectionKey | string, value: T): void;
declare function inject(key: InjectionKey | string): T | undefined;
declare function inject(key: InjectionKey | string, defaultValue: T, treatDefaultAsFactory?: boolean): T;
declare const useCssModule: (name?: string) => Record;
/**
* @deprecated use `useCssModule` instead.
*/
declare const useCSSModule: (name?: string) => Record;
interface App {
config: VueConstructor$1['config'];
use: VueConstructor$1['use'];
mixin: VueConstructor$1['mixin'];
component: VueConstructor$1['component'];
directive: VueConstructor$1['directive'];
mount: Vue__default['$mount'];
unmount: Vue__default['$destroy'];
}
declare function createApp(rootComponent: any, rootProps?: any): App;
declare type NextTick = Vue__default['$nextTick'];
declare const nextTick: NextTick;
declare const createElement: Vue$1.CreateElement;
/**
* Displays a warning message (using console.error) with a stack trace if the
* function is called inside of active component.
*
* @param message warning message to be displayed
*/
declare function warn(message: string): void;
declare class EffectScopeImpl {
active: boolean;
effects: EffectScope[];
cleanups: (() => void)[];
constructor(vm: Vue);
run(fn: () => T): T | undefined;
on(): void;
off(): void;
stop(): void;
}
declare class EffectScope extends EffectScopeImpl {
constructor(detached?: boolean);
}
declare function effectScope(detached?: boolean): EffectScope;
declare function getCurrentScope(): EffectScope | undefined;
declare function onScopeDispose(fn: () => void): void;
declare function useSlots(): SetupContext['slots'];
declare function useAttrs(): SetupContext['attrs'];
declare const version: string;
declare module 'vue/types/options' {
interface ComponentOptions {
setup?: SetupFunction;
}
}
export default Plugin;
export { App, ComponentInstance, ComponentInternalInstance, ComponentPropsOptions, ComponentPublicInstance, ComponentRenderProxy, ComputedGetter, ComputedOptions, ComputedRef, ComputedSetter, Data, DeepReadonly, EffectScope, ExtractDefaultPropTypes, ExtractPropTypes, FlushMode, InjectionKey, MethodOptions, PropOptions, PropType, Ref, SetupContext, SetupFunction, ShallowUnwrapRef, ToRefs, UnwrapNestedRefs, UnwrapRef, UnwrapRefSimple, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, computed, createApp, createRef, customRef, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, createElement as h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCSSModule, useCssModule, useSlots, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect };