import { IfAny } from '@vue/shared'; declare type BaseTypes = string | number | boolean; declare type Builtin = Primitive | Function | Date | Error | RegExp; declare type CollectionTypes = IterableCollections | WeakCollections; export declare function computed(getter: ComputedGetter, debugOptions?: DebuggerOptions): ComputedRef; export declare function computed(options: WritableComputedOptions, debugOptions?: DebuggerOptions): WritableComputedRef; export declare type ComputedGetter = (...args: any[]) => T; export declare interface ComputedRef extends WritableComputedRef { readonly value: T; [ComputedRefSymbol]: true; } declare class ComputedRefImpl { private readonly _setter; dep?: Dep; private _value; readonly effect: ReactiveEffect; readonly __v_isRef = true; readonly [ReactiveFlags.IS_READONLY]: boolean; _dirty: boolean; _cacheable: boolean; constructor(getter: ComputedGetter, _setter: ComputedSetter, isReadonly: boolean, isSSR: boolean); get value(): T; set value(newValue: T); } declare const ComputedRefSymbol: unique symbol; export declare type ComputedSetter = (v: T) => void; export declare function customRef(factory: CustomRefFactory): Ref; export declare type CustomRefFactory = (track: () => void, trigger: () => void) => { get: () => T; set: (value: T) => void; }; export declare type DebuggerEvent = { effect: ReactiveEffect; } & DebuggerEventExtraInfo; export declare type DebuggerEventExtraInfo = { target: object; type: TrackOpTypes | TriggerOpTypes; key: any; newValue?: any; oldValue?: any; oldTarget?: Map | Set; }; export declare interface DebuggerOptions { onTrack?: (event: DebuggerEvent) => void; onTrigger?: (event: DebuggerEvent) => void; } export 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 Ref ? Readonly>> : T extends {} ? { readonly [K in keyof T]: DeepReadonly; } : Readonly; export declare function deferredComputed(getter: () => T): ComputedRef; declare type Dep = Set & TrackedMarkers; export declare function effect(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner; export declare type EffectScheduler = (...args: any[]) => any; export declare class EffectScope { detached: boolean; /* Excluded from this release type: active */ /* Excluded from this release type: effects */ /* Excluded from this release type: cleanups */ /* Excluded from this release type: parent */ /* Excluded from this release type: scopes */ /* Excluded from this release type: index */ constructor(detached?: boolean); run(fn: () => T): T | undefined; /* Excluded from this release type: on */ /* Excluded from this release type: off */ stop(fromParent?: boolean): void; } export declare function effectScope(detached?: boolean): EffectScope; export declare function enableTracking(): void; export declare function getCurrentScope(): EffectScope | undefined; export declare function isProxy(value: unknown): boolean; export declare function isReactive(value: unknown): boolean; export declare function isReadonly(value: unknown): boolean; export declare function isRef(r: Ref | unknown): r is Ref; export declare function isShallow(value: unknown): boolean; declare type IterableCollections = Map | Set; export declare const ITERATE_KEY: unique symbol; export declare function markRaw(value: T): Raw; export declare function onScopeDispose(fn: () => void): void; export declare function pauseTracking(): void; declare type Primitive = string | number | boolean | bigint | symbol | undefined | null; export declare function proxyRefs(objectWithRefs: T): ShallowUnwrapRef; export declare type Raw = T & { [RawSymbol]?: true; }; declare const RawSymbol: unique symbol; /** * Creates a reactive copy of the original object. * * The reactive conversion is "deep"—it affects all nested properties. In the * ES2015 Proxy based implementation, the returned proxy is **not** equal to the * original object. It is recommended to work exclusively with the reactive * proxy and avoid relying on the original object. * * A reactive object also automatically unwraps refs contained in it, so you * don't need to use `.value` when accessing and mutating their value: * * ```js * const count = ref(0) * const obj = reactive({ * count * }) * * obj.count++ * obj.count // -> 1 * count.value // -> 1 * ``` */ export declare function reactive(target: T): UnwrapNestedRefs; export declare class ReactiveEffect { fn: () => T; scheduler: EffectScheduler | null; active: boolean; deps: Dep[]; parent: ReactiveEffect | undefined; /* Excluded from this release type: computed */ /* Excluded from this release type: allowRecurse */ /* Excluded from this release type: deferStop */ onStop?: () => void; onTrack?: (event: DebuggerEvent) => void; onTrigger?: (event: DebuggerEvent) => void; constructor(fn: () => T, scheduler?: EffectScheduler | null, scope?: EffectScope); run(): T | undefined; stop(): void; } export declare interface ReactiveEffectOptions extends DebuggerOptions { lazy?: boolean; scheduler?: EffectScheduler; scope?: EffectScope; allowRecurse?: boolean; onStop?: () => void; } export declare interface ReactiveEffectRunner { (): T; effect: ReactiveEffect; } export declare const enum ReactiveFlags { SKIP = "__v_skip", IS_REACTIVE = "__v_isReactive", IS_READONLY = "__v_isReadonly", IS_SHALLOW = "__v_isShallow", RAW = "__v_raw" } /** * 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. */ export declare function readonly(target: T): DeepReadonly>; export declare interface Ref { value: T; /** * Type differentiator only. * We need this to be in public d.ts but don't want it to show up in IDE * autocomplete, so we use a private Symbol instead. */ [RefSymbol]: true; } export declare function ref(value: T): [T] extends [Ref] ? T : Ref>; export declare function ref(value: T): Ref>; export declare function ref(): Ref; declare const RefSymbol: unique symbol; /** * This is a special exported interface for other packages to declare * additional types that should bail out for ref unwrapping. For example * \@vue/runtime-dom can declare it like so in its d.ts: * * ``` ts * declare module '@vue/reactivity' { * export interface RefUnwrapBailTypes { * runtimeDOMBailTypes: Node | Window * } * } * ``` * * Note that api-extractor somehow refuses to include `declare module` * augmentations in its generated d.ts, so we have to manually append them * to the final generated d.ts in our build process. */ export declare interface RefUnwrapBailTypes { } export declare function resetTracking(): void; export declare type ShallowReactive = T & { [ShallowReactiveMarker]?: true; }; /** * Return a shallowly-reactive copy of the original object, where only the root * level properties are reactive. It also does not auto-unwrap refs (even at the * root level). */ export declare function shallowReactive(target: T): ShallowReactive; declare const ShallowReactiveMarker: unique symbol; /** * Returns a reactive-copy of the original object, where only the root level * properties are readonly, and does NOT unwrap refs nor recursively convert * returned properties. * This is used for creating the props proxy object for stateful components. */ export declare function shallowReadonly(target: T): Readonly; export declare type ShallowRef = Ref & { [ShallowRefMarker]?: true; }; export declare function shallowRef(value: T): T extends Ref ? T : ShallowRef; export declare function shallowRef(value: T): ShallowRef; export declare function shallowRef(): ShallowRef; declare const ShallowRefMarker: unique symbol; export declare type ShallowUnwrapRef = { [K in keyof T]: T[K] extends Ref ? V : T[K] extends Ref | undefined ? unknown extends V ? undefined : V | undefined : T[K]; }; declare function stop_2(runner: ReactiveEffectRunner): void; export { stop_2 as stop } export declare function toRaw(observed: T): T; export declare type ToRef = IfAny, [T] extends [Ref] ? T : Ref>; export declare function toRef(object: T, key: K): ToRef; export declare function toRef(object: T, key: K, defaultValue: T[K]): ToRef>; export declare type ToRefs = { [K in keyof T]: ToRef; }; export declare function toRefs(object: T): ToRefs; export declare function track(target: object, type: TrackOpTypes, key: unknown): void; /** * wasTracked and newTracked maintain the status for several levels of effect * tracking recursion. One bit per level is used to define whether the dependency * was/is tracked. */ declare type TrackedMarkers = { /** * wasTracked */ w: number; /** * newTracked */ n: number; }; export declare const enum TrackOpTypes { GET = "get", HAS = "has", ITERATE = "iterate" } export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map | Set): void; export declare const enum TriggerOpTypes { SET = "set", ADD = "add", DELETE = "delete", CLEAR = "clear" } export declare function triggerRef(ref: Ref): void; export declare function unref(ref: T | Ref): T; export declare type UnwrapNestedRefs = T extends Ref ? T : UnwrapRefSimple; export declare type UnwrapRef = T extends ShallowRef ? V : T extends Ref ? UnwrapRefSimple : UnwrapRefSimple; declare type UnwrapRefSimple = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | { [RawSymbol]?: true; } ? T : T extends ReadonlyArray ? { [K in keyof T]: UnwrapRefSimple; } : T extends object & { [ShallowReactiveMarker]?: never; } ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef; } : T; declare type WeakCollections = WeakMap | WeakSet; export declare interface WritableComputedOptions { get: ComputedGetter; set: ComputedSetter; } export declare interface WritableComputedRef extends Ref { readonly effect: ReactiveEffect; } export { }