@vueuse/core
Version:
Collection of essential Vue Composition Utilities
1,545 lines (1,506 loc) • 233 kB
text/typescript
import * as _vueuse_shared from '@vueuse/shared';
import { Fn, ShallowOrDeepRef, Awaitable, ConfigurableEventFilter, ConfigurableFlush, RemovableRef, EventHookOn, Pausable, IsAny, Arrayable, ReadonlyRefOrGetter, UseIntervalFnOptions, UseTimeoutFnOptions } from '@vueuse/shared';
export * from '@vueuse/shared';
import * as vue from 'vue';
import { Ref, ComputedRef, InjectionKey, DefineComponent, Slot, ComponentObjectPropsOptions, TransitionGroupProps, MaybeRef, ComponentPublicInstance, MaybeRefOrGetter, WatchOptionsBase, Component, ShallowRef, WritableComputedRef, UnwrapRef, WatchOptions, WatchStopHandle, UnwrapNestedRefs, App, WatchSource, ToRefs, StyleValue } from 'vue';
/**
* Handle overlapping async evaluations.
*
* @param cancelCallback The provided callback is invoked when a re-evaluation of the computed value is triggered before the previous one finished
*/
type AsyncComputedOnCancel = (cancelCallback: Fn) => void;
interface AsyncComputedOptions<Lazy = boolean> {
/**
* Should value be evaluated lazily
*
* @default false
*/
lazy?: Lazy;
/**
* Ref passed to receive the updated of async evaluation
*/
evaluating?: Ref<boolean>;
/**
* Use shallowRef
*
* @default true
*/
shallow?: boolean;
/**
* The flush option allows for greater control over the timing of a history point, default to `pre`
*
* Possible values: `pre`, `post`, `sync`
*
* It works in the same way as the flush option in watch and watch effect in vue reactivity
* @default 'pre'
*/
flush?: 'pre' | 'post' | 'sync';
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
}
/**
* Create an asynchronous computed dependency.
*
* @see https://vueuse.org/computedAsync
* @param evaluationCallback The promise-returning callback which generates the computed value
* @param initialState The initial state, used until the first evaluation finishes
* @param optionsOrRef Additional options or a ref passed to receive the updates of the async evaluation
*/
declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState: T, optionsOrRef: AsyncComputedOptions<true>): ComputedRef<T>;
declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState: undefined, optionsOrRef: AsyncComputedOptions<true>): ComputedRef<T | undefined>;
declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState: T, optionsOrRef?: Ref<boolean> | AsyncComputedOptions): Ref<T>;
declare function computedAsync<T>(evaluationCallback: (onCancel: AsyncComputedOnCancel) => T | Promise<T>, initialState?: undefined, optionsOrRef?: Ref<boolean> | AsyncComputedOptions): Ref<T | undefined>;
type ComputedInjectGetter<T, K> = (source: T | undefined, oldValue?: K) => K;
type ComputedInjectGetterWithDefault<T, K> = (source: T, oldValue?: K) => K;
type ComputedInjectSetter<T> = (v: T) => void;
interface WritableComputedInjectOptions<T, K> {
get: ComputedInjectGetter<T, K>;
set: ComputedInjectSetter<K>;
}
interface WritableComputedInjectOptionsWithDefault<T, K> {
get: ComputedInjectGetterWithDefault<T, K>;
set: ComputedInjectSetter<K>;
}
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, getter: ComputedInjectGetter<T, K>): ComputedRef<K | undefined>;
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, options: WritableComputedInjectOptions<T, K>): ComputedRef<K | undefined>;
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, getter: ComputedInjectGetterWithDefault<T, K>, defaultSource: T, treatDefaultAsFactory?: false): ComputedRef<K>;
declare function computedInject<T, K = any>(key: InjectionKey<T> | string, options: WritableComputedInjectOptionsWithDefault<T, K>, defaultSource: T | (() => T), treatDefaultAsFactory: true): ComputedRef<K>;
type ObjectLiteralWithPotentialObjectLiterals = Record<string, Record<string, any> | undefined>;
type GenerateSlotsFromSlotMap<T extends ObjectLiteralWithPotentialObjectLiterals> = {
[K in keyof T]: Slot<T[K]>;
};
type DefineTemplateComponent<Bindings extends Record<string, any>, MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals> = DefineComponent & {
new (): {
$slots: {
default: (_: Bindings & {
$slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps>;
}) => any;
};
};
};
type ReuseTemplateComponent<Bindings extends Record<string, any>, MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals> = DefineComponent<Bindings> & {
new (): {
$slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps>;
};
};
type ReusableTemplatePair<Bindings extends Record<string, any>, MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals> = [
DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>,
ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>
] & {
define: DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>;
reuse: ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>;
};
interface CreateReusableTemplateOptions<Props extends Record<string, any>> {
/**
* Inherit attrs from reuse component.
*
* @default true
*/
inheritAttrs?: boolean;
/**
* Props definition for reuse component.
*/
props?: ComponentObjectPropsOptions<Props>;
}
/**
* This function creates `define` and `reuse` components in pair,
* It also allow to pass a generic to bind with type.
*
* @see https://vueuse.org/createReusableTemplate
*
* @__NO_SIDE_EFFECTS__
*/
declare function createReusableTemplate<Bindings extends Record<string, any>, MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals = Record<'default', undefined>>(options?: CreateReusableTemplateOptions<Bindings>): ReusableTemplatePair<Bindings, MapSlotNameToSlotProps>;
interface TemplatePromiseProps<Return, Args extends any[] = []> {
/**
* The promise instance.
*/
promise: Promise<Return> | undefined;
/**
* Resolve the promise.
*/
resolve: (v: Return | Promise<Return>) => void;
/**
* Reject the promise.
*/
reject: (v: any) => void;
/**
* Arguments passed to TemplatePromise.start()
*/
args: Args;
/**
* Indicates if the promise is resolving.
* When passing another promise to `resolve`, this will be set to `true` until the promise is resolved.
*/
isResolving: boolean;
/**
* Options passed to createTemplatePromise()
*/
options: TemplatePromiseOptions;
/**
* Unique key for list rendering.
*/
key: number;
}
interface TemplatePromiseOptions {
/**
* Determines if the promise can be called only once at a time.
*
* @default false
*/
singleton?: boolean;
/**
* Transition props for the promise.
*/
transition?: TransitionGroupProps;
}
type TemplatePromise<Return, Args extends any[] = []> = DefineComponent<object> & {
new (): {
$slots: {
default: (_: TemplatePromiseProps<Return, Args>) => any;
};
};
} & {
start: (...args: Args) => Promise<Return>;
};
/**
* Creates a template promise component.
*
* @see https://vueuse.org/createTemplatePromise
*
* @__NO_SIDE_EFFECTS__
*/
declare function createTemplatePromise<Return, Args extends any[] = []>(options?: TemplatePromiseOptions): TemplatePromise<Return, Args>;
type UnrefFn<T> = T extends (...args: infer A) => infer R ? (...args: {
[K in keyof A]: MaybeRef<A[K]>;
}) => R : never;
/**
* Make a plain function accepting ref and raw values as arguments.
* Returns the same value the unconverted function returns, with proper typing.
*
* @__NO_SIDE_EFFECTS__
*/
declare function createUnrefFn<T extends Function>(fn: T): UnrefFn<T>;
interface ConfigurableWindow {
window?: Window;
}
interface ConfigurableDocument {
document?: Document;
}
interface ConfigurableDocumentOrShadowRoot {
document?: DocumentOrShadowRoot;
}
interface ConfigurableNavigator {
navigator?: Navigator;
}
interface ConfigurableLocation {
location?: Location;
}
declare const defaultWindow: (Window & typeof globalThis) | undefined;
declare const defaultDocument: Document | undefined;
declare const defaultNavigator: Navigator | undefined;
declare const defaultLocation: Location | undefined;
interface ConfigurableDeepRefs<D extends boolean> {
/**
* Return deep refs instead of shallow refs.
*
* @default true - will be changed to `false` by default in the next major
*/
deepRefs?: D;
}
type VueInstance = ComponentPublicInstance;
type MaybeElementRef<T extends MaybeElement = MaybeElement> = MaybeRef<T>;
type MaybeComputedElementRef<T extends MaybeElement = MaybeElement> = MaybeRefOrGetter<T>;
type MaybeElement = HTMLElement | SVGElement | VueInstance | undefined | null;
type UnRefElementReturn<T extends MaybeElement = MaybeElement> = T extends VueInstance ? Exclude<MaybeElement, VueInstance> : T | undefined;
/**
* Get the dom element of a ref of element or Vue component instance
*
* @param elRef
*/
declare function unrefElement<T extends MaybeElement>(elRef: MaybeComputedElementRef<T>): UnRefElementReturn<T>;
interface OnClickOutsideOptions<Controls extends boolean = false> extends ConfigurableWindow {
/**
* List of elements that should not trigger the event,
* provided as Refs or CSS Selectors.
*/
ignore?: MaybeRefOrGetter<(MaybeElementRef | string)[]>;
/**
* Use capturing phase for internal event listener.
* @default true
*/
capture?: boolean;
/**
* Run handler function if focus moves to an iframe.
* @default false
*/
detectIframe?: boolean;
/**
* Use controls to cancel/trigger listener.
* @default false
*/
controls?: Controls;
}
type OnClickOutsideHandler<T extends OnClickOutsideOptions<boolean> = OnClickOutsideOptions> = (event: (T['detectIframe'] extends true ? FocusEvent : never) | (T['controls'] extends true ? Event : never) | PointerEvent) => void;
interface OnClickOutsideControlsReturn {
stop: Fn;
cancel: Fn;
trigger: (event: Event) => void;
}
/**
* Listen for clicks outside of an element.
*
* @see https://vueuse.org/onClickOutside
* @param target
* @param handler
* @param options
*/
declare function onClickOutside<T extends OnClickOutsideOptions>(target: MaybeElementRef, handler: OnClickOutsideHandler<T>, options?: T): Fn;
declare function onClickOutside<T extends OnClickOutsideOptions<true>>(target: MaybeElementRef, handler: OnClickOutsideHandler<T>, options: T): OnClickOutsideControlsReturn;
interface OnElementRemovalOptions extends ConfigurableWindow, ConfigurableDocumentOrShadowRoot, WatchOptionsBase {
}
/**
* Fires when the element or any element containing it is removed.
*
* @param target
* @param callback
* @param options
*/
declare function onElementRemoval(target: MaybeElementRef, callback: (mutationRecords: MutationRecord[]) => void, options?: OnElementRemovalOptions): Fn;
type KeyPredicate = (event: KeyboardEvent) => boolean;
type KeyFilter = true | string | string[] | KeyPredicate;
type KeyStrokeEventName = 'keydown' | 'keypress' | 'keyup';
interface OnKeyStrokeOptions {
eventName?: KeyStrokeEventName;
target?: MaybeRefOrGetter<EventTarget | null | undefined>;
passive?: boolean;
/**
* Set to `true` to ignore repeated events when the key is being held down.
*
* @default false
*/
dedupe?: MaybeRefOrGetter<boolean>;
}
/**
* Listen for keyboard keystrokes.
*
* @see https://vueuse.org/onKeyStroke
*/
declare function onKeyStroke(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
declare function onKeyStroke(handler: (event: KeyboardEvent) => void, options?: OnKeyStrokeOptions): () => void;
/**
* Listen to the keydown event of the given key.
*
* @see https://vueuse.org/onKeyStroke
* @param key
* @param handler
* @param options
*/
declare function onKeyDown(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
/**
* Listen to the keypress event of the given key.
*
* @see https://vueuse.org/onKeyStroke
* @param key
* @param handler
* @param options
*/
declare function onKeyPressed(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
/**
* Listen to the keyup event of the given key.
*
* @see https://vueuse.org/onKeyStroke
* @param key
* @param handler
* @param options
*/
declare function onKeyUp(key: KeyFilter, handler: (event: KeyboardEvent) => void, options?: Omit<OnKeyStrokeOptions, 'eventName'>): () => void;
interface OnLongPressOptions {
/**
* Time in ms till `longpress` gets called
*
* @default 500
*/
delay?: number | ((ev: PointerEvent) => number);
modifiers?: OnLongPressModifiers;
/**
* Allowance of moving distance in pixels,
* The action will get canceled When moving too far from the pointerdown position.
* @default 10
*/
distanceThreshold?: number | false;
/**
* Function called when the ref element is released.
* @param duration how long the element was pressed in ms
* @param distance distance from the pointerdown position
* @param isLongPress whether the action was a long press or not
*/
onMouseUp?: (duration: number, distance: number, isLongPress: boolean) => void;
}
interface OnLongPressModifiers {
stop?: boolean;
once?: boolean;
prevent?: boolean;
capture?: boolean;
self?: boolean;
}
declare function onLongPress(target: MaybeElementRef, handler: (evt: PointerEvent) => void, options?: OnLongPressOptions): () => void;
/**
* Fires when users start typing on non-editable elements.
*
* @see https://vueuse.org/onStartTyping
* @param callback
* @param options
*/
declare function onStartTyping(callback: (event: KeyboardEvent) => void, options?: ConfigurableDocument): void;
/**
* @deprecated Use Vue's built-in `useTemplateRef` instead.
*
* Shorthand for binding ref to template element.
*
* @see https://vueuse.org/templateRef
* @param key
* @param initialValue
*
* @__NO_SIDE_EFFECTS__
*/
declare function templateRef<T extends HTMLElement | SVGElement | Component | null, Keys extends string = string>(key: Keys, initialValue?: T | null): Readonly<Ref<T>>;
interface UseActiveElementOptions extends ConfigurableWindow, ConfigurableDocumentOrShadowRoot {
/**
* Search active element deeply inside shadow dom
*
* @default true
*/
deep?: boolean;
/**
* Track active element when it's removed from the DOM
* Using a MutationObserver under the hood
* @default false
*/
triggerOnRemoval?: boolean;
}
/**
* Reactive `document.activeElement`
*
* @see https://vueuse.org/useActiveElement
* @param options
*
* @__NO_SIDE_EFFECTS__
*/
declare function useActiveElement<T extends HTMLElement>(options?: UseActiveElementOptions): vue.ShallowRef<T | null | undefined, T | null | undefined>;
interface UseAnimateOptions extends KeyframeAnimationOptions, ConfigurableWindow {
/**
* Will automatically run play when `useAnimate` is used
*
* @default true
*/
immediate?: boolean;
/**
* Whether to commits the end styling state of an animation to the element being animated
* In general, you should use `fill` option with this.
*
* @default false
*/
commitStyles?: boolean;
/**
* Whether to persists the animation
*
* @default false
*/
persist?: boolean;
/**
* Executed after animation initialization
*/
onReady?: (animate: Animation) => void;
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
}
type UseAnimateKeyframes = MaybeRef<Keyframe[] | PropertyIndexedKeyframes | null>;
interface UseAnimateReturn {
isSupported: ComputedRef<boolean>;
animate: ShallowRef<Animation | undefined>;
play: () => void;
pause: () => void;
reverse: () => void;
finish: () => void;
cancel: () => void;
pending: ComputedRef<boolean>;
playState: ComputedRef<AnimationPlayState>;
replaceState: ComputedRef<AnimationReplaceState>;
startTime: WritableComputedRef<CSSNumberish | number | null>;
currentTime: WritableComputedRef<CSSNumberish | null>;
timeline: WritableComputedRef<AnimationTimeline | null>;
playbackRate: WritableComputedRef<number>;
}
/**
* Reactive Web Animations API
*
* @see https://vueuse.org/useAnimate
* @param target
* @param keyframes
* @param options
*/
declare function useAnimate(target: MaybeComputedElementRef, keyframes: UseAnimateKeyframes, options?: number | UseAnimateOptions): UseAnimateReturn;
type UseAsyncQueueTask<T> = (...args: any[]) => T | Promise<T>;
type MapQueueTask<T extends any[]> = {
[K in keyof T]: UseAsyncQueueTask<T[K]>;
};
interface UseAsyncQueueResult<T> {
state: 'aborted' | 'fulfilled' | 'pending' | 'rejected';
data: T | null;
}
interface UseAsyncQueueReturn<T> {
activeIndex: ShallowRef<number>;
result: T;
}
interface UseAsyncQueueOptions {
/**
* Interrupt tasks when current task fails.
*
* @default true
*/
interrupt?: boolean;
/**
* Trigger it when the tasks fails.
*
*/
onError?: () => void;
/**
* Trigger it when the tasks ends.
*
*/
onFinished?: () => void;
/**
* A AbortSignal that can be used to abort the task.
*/
signal?: AbortSignal;
}
/**
* Asynchronous queue task controller.
*
* @see https://vueuse.org/useAsyncQueue
* @param tasks
* @param options
*/
declare function useAsyncQueue<T extends any[], S = MapQueueTask<T>>(tasks: S & Array<UseAsyncQueueTask<any>>, options?: UseAsyncQueueOptions): UseAsyncQueueReturn<{
[P in keyof T]: UseAsyncQueueResult<T[P]>;
}>;
interface UseAsyncStateReturnBase<Data, Params extends any[], Shallow extends boolean> {
state: Shallow extends true ? Ref<Data> : Ref<UnwrapRef<Data>>;
isReady: Ref<boolean>;
isLoading: Ref<boolean>;
error: Ref<unknown>;
execute: (delay?: number, ...args: Params) => Promise<Data>;
executeImmediate: (...args: Params) => Promise<Data>;
}
type UseAsyncStateReturn<Data, Params extends any[], Shallow extends boolean> = UseAsyncStateReturnBase<Data, Params, Shallow> & PromiseLike<UseAsyncStateReturnBase<Data, Params, Shallow>>;
interface UseAsyncStateOptions<Shallow extends boolean, D = any> {
/**
* Delay for the first execution of the promise when "immediate" is true. In milliseconds.
*
* @default 0
*/
delay?: number;
/**
* Execute the promise right after the function is invoked.
* Will apply the delay if any.
*
* When set to false, you will need to execute it manually.
*
* @default true
*/
immediate?: boolean;
/**
* Callback when error is caught.
*/
onError?: (e: unknown) => void;
/**
* Callback when success is caught.
* @param {D} data
*/
onSuccess?: (data: D) => void;
/**
* Sets the state to initialState before executing the promise.
*
* This can be useful when calling the execute function more than once (for
* example, to refresh data). When set to false, the current state remains
* unchanged until the promise resolves.
*
* @default true
*/
resetOnExecute?: boolean;
/**
* Use shallowRef.
*
* @default true
*/
shallow?: Shallow;
/**
*
* An error is thrown when executing the execute function
*
* @default false
*/
throwError?: boolean;
}
/**
* Reactive async state. Will not block your setup function and will trigger changes once
* the promise is ready.
*
* @see https://vueuse.org/useAsyncState
* @param promise The promise / async function to be resolved
* @param initialState The initial state, used until the first evaluation finishes
* @param options
*/
declare function useAsyncState<Data, Params extends any[] = any[], Shallow extends boolean = true>(promise: Promise<Data> | ((...args: Params) => Promise<Data>), initialState: MaybeRef<Data>, options?: UseAsyncStateOptions<Shallow, Data>): UseAsyncStateReturn<Data, Params, Shallow>;
interface UseBase64Options {
/**
* Output as Data URL format
*
* @default true
*/
dataUrl?: boolean;
}
interface ToDataURLOptions extends UseBase64Options {
/**
* MIME type
*/
type?: string | undefined;
/**
* Image quality of jpeg or webp
*/
quality?: any;
}
interface UseBase64ObjectOptions<T> extends UseBase64Options {
serializer?: (v: T) => string;
}
interface UseBase64Return {
base64: ShallowRef<string>;
promise: ShallowRef<Promise<string>>;
execute: () => Promise<string>;
}
declare function useBase64(target: MaybeRefOrGetter<string | undefined>, options?: UseBase64Options): UseBase64Return;
declare function useBase64(target: MaybeRefOrGetter<Blob | undefined>, options?: UseBase64Options): UseBase64Return;
declare function useBase64(target: MaybeRefOrGetter<ArrayBuffer | undefined>, options?: UseBase64Options): UseBase64Return;
declare function useBase64(target: MaybeRefOrGetter<HTMLCanvasElement | undefined>, options?: ToDataURLOptions): UseBase64Return;
declare function useBase64(target: MaybeRefOrGetter<HTMLImageElement | undefined>, options?: ToDataURLOptions): UseBase64Return;
declare function useBase64<T extends Record<string, unknown>>(target: MaybeRefOrGetter<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
declare function useBase64<T extends Map<string, unknown>>(target: MaybeRefOrGetter<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
declare function useBase64<T extends Set<unknown>>(target: MaybeRefOrGetter<T>, options?: UseBase64ObjectOptions<T>): UseBase64Return;
declare function useBase64<T>(target: MaybeRefOrGetter<T[]>, options?: UseBase64ObjectOptions<T[]>): UseBase64Return;
interface BatteryManager extends EventTarget {
charging: boolean;
chargingTime: number;
dischargingTime: number;
level: number;
}
/**
* Reactive Battery Status API.
*
* @see https://vueuse.org/useBattery
*
* @__NO_SIDE_EFFECTS__
*/
declare function useBattery(options?: ConfigurableNavigator): {
isSupported: vue.ComputedRef<boolean>;
charging: vue.ShallowRef<boolean, boolean>;
chargingTime: vue.ShallowRef<number, number>;
dischargingTime: vue.ShallowRef<number, number>;
level: vue.ShallowRef<number, number>;
};
type UseBatteryReturn = ReturnType<typeof useBattery>;
interface UseBluetoothRequestDeviceOptions {
/**
*
* An array of BluetoothScanFilters. This filter consists of an array
* of BluetoothServiceUUIDs, a name parameter, and a namePrefix parameter.
*
*/
filters?: BluetoothLEScanFilter[] | undefined;
/**
*
* An array of BluetoothServiceUUIDs.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/BluetoothRemoteGATTService/uuid
*
*/
optionalServices?: BluetoothServiceUUID[] | undefined;
}
interface UseBluetoothOptions extends UseBluetoothRequestDeviceOptions, ConfigurableNavigator {
/**
*
* A boolean value indicating that the requesting script can accept all Bluetooth
* devices. The default is false.
*
* !! This may result in a bunch of unrelated devices being shown
* in the chooser and energy being wasted as there are no filters.
*
*
* Use it with caution.
*
* @default false
*
*/
acceptAllDevices?: boolean;
}
declare function useBluetooth(options?: UseBluetoothOptions): UseBluetoothReturn;
interface UseBluetoothReturn {
isSupported: ComputedRef<boolean>;
isConnected: Readonly<ShallowRef<boolean>>;
device: ShallowRef<BluetoothDevice | undefined>;
requestDevice: () => Promise<void>;
server: ShallowRef<BluetoothRemoteGATTServer | undefined>;
error: ShallowRef<unknown | null>;
}
/**
* Breakpoints from Tailwind V2
*
* @see https://tailwindcss.com/docs/breakpoints
*/
declare const breakpointsTailwind: {
sm: number;
md: number;
lg: number;
xl: number;
'2xl': number;
};
/**
* Breakpoints from Bootstrap V5
*
* @see https://getbootstrap.com/docs/5.0/layout/breakpoints
*/
declare const breakpointsBootstrapV5: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
xxl: number;
};
/**
* Breakpoints from Vuetify V2
*
* @see https://v2.vuetifyjs.com/en/features/breakpoints/
*/
declare const breakpointsVuetifyV2: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
/**
* Breakpoints from Vuetify V3
*
* @see https://vuetifyjs.com/en/styles/float/#overview
*/
declare const breakpointsVuetifyV3: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
xxl: number;
};
/**
* Alias to `breakpointsVuetifyV2`
*
* @deprecated explictly use `breakpointsVuetifyV2` or `breakpointsVuetifyV3` instead
*/
declare const breakpointsVuetify: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
/**
* Breakpoints from Ant Design
*
* @see https://ant.design/components/layout/#breakpoint-width
*/
declare const breakpointsAntDesign: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
xxl: number;
};
/**
* Breakpoints from Quasar V2
*
* @see https://quasar.dev/style/breakpoints
*/
declare const breakpointsQuasar: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
/**
* Sematic Breakpoints
*/
declare const breakpointsSematic: {
mobileS: number;
mobileM: number;
mobileL: number;
tablet: number;
laptop: number;
laptopL: number;
desktop4K: number;
};
/**
* Breakpoints from Master CSS
*
* @see https://docs.master.co/css/breakpoints
*/
declare const breakpointsMasterCss: {
'3xs': number;
'2xs': number;
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
'2xl': number;
'3xl': number;
'4xl': number;
};
/**
* Breakpoints from PrimeFlex
*
* @see https://primeflex.org/installation
*/
declare const breakpointsPrimeFlex: {
sm: number;
md: number;
lg: number;
xl: number;
};
/**
* Breakpoints from ElementUI/ElementPlus
*
* @see https://element.eleme.io/#/en-US/component/layout
* @see https://element-plus.org/en-US/component/layout.html
*/
declare const breakpointsElement: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
type Breakpoints<K extends string = string> = Record<K, MaybeRefOrGetter<number | string>>;
interface UseBreakpointsOptions extends ConfigurableWindow {
/**
* The query strategy to use for the generated shortcut methods like `.lg`
*
* 'min-width' - .lg will be true when the viewport is greater than or equal to the lg breakpoint (mobile-first)
* 'max-width' - .lg will be true when the viewport is smaller than the xl breakpoint (desktop-first)
*
* @default "min-width"
*/
strategy?: 'min-width' | 'max-width';
ssrWidth?: number;
}
/**
* Reactively viewport breakpoints
*
* @see https://vueuse.org/useBreakpoints
*
* @__NO_SIDE_EFFECTS__
*/
declare function useBreakpoints<K extends string>(breakpoints: Breakpoints<K>, options?: UseBreakpointsOptions): Record<K, vue.ComputedRef<boolean>> & {
greaterOrEqual: (k: MaybeRefOrGetter<K>) => vue.ComputedRef<boolean>;
smallerOrEqual: (k: MaybeRefOrGetter<K>) => vue.ComputedRef<boolean>;
greater(k: MaybeRefOrGetter<K>): vue.ComputedRef<boolean>;
smaller(k: MaybeRefOrGetter<K>): vue.ComputedRef<boolean>;
between(a: MaybeRefOrGetter<K>, b: MaybeRefOrGetter<K>): vue.ComputedRef<boolean>;
isGreater(k: MaybeRefOrGetter<K>): boolean;
isGreaterOrEqual(k: MaybeRefOrGetter<K>): boolean;
isSmaller(k: MaybeRefOrGetter<K>): boolean;
isSmallerOrEqual(k: MaybeRefOrGetter<K>): boolean;
isInBetween(a: MaybeRefOrGetter<K>, b: MaybeRefOrGetter<K>): boolean;
current: () => vue.ComputedRef<K[]>;
active(): vue.ComputedRef<"" | K>;
};
type UseBreakpointsReturn<K extends string = string> = ReturnType<typeof useBreakpoints<K>>;
interface UseBroadcastChannelOptions extends ConfigurableWindow {
/**
* The name of the channel.
*/
name: string;
}
/**
* Reactive BroadcastChannel
*
* @see https://vueuse.org/useBroadcastChannel
* @see https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
* @param options
*
*/
declare function useBroadcastChannel<D, P>(options: UseBroadcastChannelOptions): UseBroadcastChannelReturn<D, P>;
interface UseBroadcastChannelReturn<D, P> {
isSupported: ComputedRef<boolean>;
channel: Ref<BroadcastChannel | undefined>;
data: Ref<D>;
post: (data: P) => void;
close: () => void;
error: ShallowRef<Event | null>;
isClosed: ShallowRef<boolean>;
}
interface BrowserLocationState {
readonly trigger: string;
readonly state?: any;
readonly length?: number;
readonly origin?: string;
hash?: string;
host?: string;
hostname?: string;
href?: string;
pathname?: string;
port?: string;
protocol?: string;
search?: string;
}
/**
* Reactive browser location.
*
* @see https://vueuse.org/useBrowserLocation
*
* @__NO_SIDE_EFFECTS__
*/
declare function useBrowserLocation(options?: ConfigurableWindow): Ref<{
readonly trigger: string;
readonly state?: any;
readonly length?: number | undefined;
readonly origin?: string | undefined;
hash?: string | undefined;
host?: string | undefined;
hostname?: string | undefined;
href?: string | undefined;
pathname?: string | undefined;
port?: string | undefined;
protocol?: string | undefined;
search?: string | undefined;
}, BrowserLocationState | {
readonly trigger: string;
readonly state?: any;
readonly length?: number | undefined;
readonly origin?: string | undefined;
hash?: string | undefined;
host?: string | undefined;
hostname?: string | undefined;
href?: string | undefined;
pathname?: string | undefined;
port?: string | undefined;
protocol?: string | undefined;
search?: string | undefined;
}>;
type UseBrowserLocationReturn = ReturnType<typeof useBrowserLocation>;
interface UseCachedOptions<D extends boolean = true> extends ConfigurableDeepRefs<D>, WatchOptions {
}
declare function useCached<T, D extends boolean = true>(refValue: Ref<T>, comparator?: (a: T, b: T) => boolean, options?: UseCachedOptions<D>): UseCachedReturn<T, D>;
type UseCachedReturn<T = any, D extends boolean = true> = ShallowOrDeepRef<T, D>;
interface UseClipboardOptions<Source> extends ConfigurableNavigator {
/**
* Enabled reading for clipboard
*
* @default false
*/
read?: boolean;
/**
* Copy source
*/
source?: Source;
/**
* Milliseconds to reset state of `copied` ref
*
* @default 1500
*/
copiedDuring?: number;
/**
* Whether fallback to document.execCommand('copy') if clipboard is undefined.
*
* @default false
*/
legacy?: boolean;
}
interface UseClipboardReturn<Optional> {
isSupported: ComputedRef<boolean>;
text: ComputedRef<string>;
copied: ComputedRef<boolean>;
copy: Optional extends true ? (text?: string) => Promise<void> : (text: string) => Promise<void>;
}
/**
* Reactive Clipboard API.
*
* @see https://vueuse.org/useClipboard
* @param options
*
* @__NO_SIDE_EFFECTS__
*/
declare function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>;
declare function useClipboard(options: UseClipboardOptions<MaybeRefOrGetter<string>>): UseClipboardReturn<true>;
interface UseClipboardItemsOptions<Source> extends ConfigurableNavigator {
/**
* Enabled reading for clipboard
*
* @default false
*/
read?: boolean;
/**
* Copy source
*/
source?: Source;
/**
* Milliseconds to reset state of `copied` ref
*
* @default 1500
*/
copiedDuring?: number;
}
interface UseClipboardItemsReturn<Optional> {
isSupported: ComputedRef<boolean>;
content: Readonly<Ref<ClipboardItems>>;
copied: Readonly<ShallowRef<boolean>>;
copy: Optional extends true ? (content?: ClipboardItems) => Promise<void> : (text: ClipboardItems) => Promise<void>;
read: () => void;
}
/**
* Reactive Clipboard API.
*
* @see https://vueuse.org/useClipboardItems
* @param options
*
* @__NO_SIDE_EFFECTS__
*/
declare function useClipboardItems(options?: UseClipboardItemsOptions<undefined>): UseClipboardItemsReturn<false>;
declare function useClipboardItems(options: UseClipboardItemsOptions<MaybeRefOrGetter<ClipboardItems>>): UseClipboardItemsReturn<true>;
interface UseClonedOptions<T = any> extends WatchOptions {
/**
* Custom clone function.
*
* By default, it use `JSON.parse(JSON.stringify(value))` to clone.
*/
clone?: (source: T) => T;
/**
* Manually sync the ref
*
* @default false
*/
manual?: boolean;
}
interface UseClonedReturn<T> {
/**
* Cloned ref
*/
cloned: Ref<T>;
/**
* Ref indicates whether the cloned data is modified
*/
isModified: Ref<boolean>;
/**
* Sync cloned data with source manually
*/
sync: () => void;
}
type CloneFn<F, T = F> = (x: F) => T;
declare function cloneFnJSON<T>(source: T): T;
declare function useCloned<T>(source: MaybeRefOrGetter<T>, options?: UseClonedOptions): UseClonedReturn<T>;
interface StorageLikeAsync {
getItem: (key: string) => Awaitable<string | null>;
setItem: (key: string, value: string) => Awaitable<void>;
removeItem: (key: string) => Awaitable<void>;
}
interface StorageLike {
getItem: (key: string) => string | null;
setItem: (key: string, value: string) => void;
removeItem: (key: string) => void;
}
/**
* @experimental The API is not finalized yet. It might not follow semver.
*/
interface SSRHandlersMap {
getDefaultStorage: () => StorageLike | undefined;
getDefaultStorageAsync: () => StorageLikeAsync | undefined;
updateHTMLAttrs: (selector: string | MaybeElementRef, attribute: string, value: string) => void;
}
declare function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T]): SSRHandlersMap[T];
declare function getSSRHandler<T extends keyof SSRHandlersMap>(key: T, fallback: SSRHandlersMap[T] | undefined): SSRHandlersMap[T] | undefined;
declare function setSSRHandler<T extends keyof SSRHandlersMap>(key: T, fn: SSRHandlersMap[T]): void;
interface Serializer<T> {
read: (raw: string) => T;
write: (value: T) => string;
}
interface SerializerAsync<T> {
read: (raw: string) => Awaitable<T>;
write: (value: T) => Awaitable<string>;
}
declare const StorageSerializers: Record<'boolean' | 'object' | 'number' | 'any' | 'string' | 'map' | 'set' | 'date', Serializer<any>>;
declare const customStorageEventName = "vueuse-storage";
interface StorageEventLike {
storageArea: StorageLike | null;
key: StorageEvent['key'];
oldValue: StorageEvent['oldValue'];
newValue: StorageEvent['newValue'];
}
interface UseStorageOptions<T> extends ConfigurableEventFilter, ConfigurableWindow, ConfigurableFlush {
/**
* Watch for deep changes
*
* @default true
*/
deep?: boolean;
/**
* Listen to storage changes, useful for multiple tabs application
*
* @default true
*/
listenToStorageChanges?: boolean;
/**
* Write the default value to the storage when it does not exist
*
* @default true
*/
writeDefaults?: boolean;
/**
* Merge the default value with the value read from the storage.
*
* When setting it to true, it will perform a **shallow merge** for objects.
* You can pass a function to perform custom merge (e.g. deep merge), for example:
*
* @default false
*/
mergeDefaults?: boolean | ((storageValue: T, defaults: T) => T);
/**
* Custom data serialization
*/
serializer?: Serializer<T>;
/**
* On error callback
*
* Default log error to `console.error`
*/
onError?: (error: unknown) => void;
/**
* Use shallow ref as reference
*
* @default false
*/
shallow?: boolean;
/**
* Wait for the component to be mounted before reading the storage.
*
* @default false
*/
initOnMounted?: boolean;
}
declare function useStorage(key: MaybeRefOrGetter<string>, defaults: MaybeRefOrGetter<string>, storage?: StorageLike, options?: UseStorageOptions<string>): RemovableRef<string>;
declare function useStorage(key: MaybeRefOrGetter<string>, defaults: MaybeRefOrGetter<boolean>, storage?: StorageLike, options?: UseStorageOptions<boolean>): RemovableRef<boolean>;
declare function useStorage(key: MaybeRefOrGetter<string>, defaults: MaybeRefOrGetter<number>, storage?: StorageLike, options?: UseStorageOptions<number>): RemovableRef<number>;
declare function useStorage<T>(key: MaybeRefOrGetter<string>, defaults: MaybeRefOrGetter<T>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
declare function useStorage<T = unknown>(key: MaybeRefOrGetter<string>, defaults: MaybeRefOrGetter<null>, storage?: StorageLike, options?: UseStorageOptions<T>): RemovableRef<T>;
type BasicColorMode = 'light' | 'dark';
type BasicColorSchema = BasicColorMode | 'auto';
interface UseColorModeOptions<T extends string = BasicColorMode> extends UseStorageOptions<T | BasicColorMode> {
/**
* CSS Selector for the target element applying to
*
* @default 'html'
*/
selector?: string | MaybeElementRef;
/**
* HTML attribute applying the target element
*
* @default 'class'
*/
attribute?: string;
/**
* The initial color mode
*
* @default 'auto'
*/
initialValue?: MaybeRefOrGetter<T | BasicColorSchema>;
/**
* Prefix when adding value to the attribute
*/
modes?: Partial<Record<T | BasicColorSchema, string>>;
/**
* A custom handler for handle the updates.
* When specified, the default behavior will be overridden.
*
* @default undefined
*/
onChanged?: (mode: T | BasicColorMode, defaultHandler: ((mode: T | BasicColorMode) => void)) => void;
/**
* Custom storage ref
*
* When provided, `useStorage` will be skipped
*/
storageRef?: Ref<T | BasicColorSchema>;
/**
* Key to persist the data into localStorage/sessionStorage.
*
* Pass `null` to disable persistence
*
* @default 'vueuse-color-scheme'
*/
storageKey?: string | null;
/**
* Storage object, can be localStorage or sessionStorage
*
* @default localStorage
*/
storage?: StorageLike;
/**
* Emit `auto` mode from state
*
* When set to `true`, preferred mode won't be translated into `light` or `dark`.
* This is useful when the fact that `auto` mode was selected needs to be known.
*
* @default undefined
* @deprecated use `store.value` when `auto` mode needs to be known
* @see https://vueuse.org/core/useColorMode/#advanced-usage
*/
emitAuto?: boolean;
/**
* Disable transition on switch
*
* @see https://paco.me/writing/disable-theme-transitions
* @default true
*/
disableTransition?: boolean;
}
type UseColorModeReturn<T extends string = BasicColorMode> = Ref<T | BasicColorSchema> & {
store: Ref<T | BasicColorSchema>;
system: ComputedRef<BasicColorMode>;
state: ComputedRef<T | BasicColorMode>;
};
/**
* Reactive color mode with auto data persistence.
*
* @see https://vueuse.org/useColorMode
* @param options
*/
declare function useColorMode<T extends string = BasicColorMode>(options?: UseColorModeOptions<T>): UseColorModeReturn<T>;
type UseConfirmDialogRevealResult<C, D> = {
data?: C;
isCanceled: false;
} | {
data?: D;
isCanceled: true;
};
interface UseConfirmDialogReturn<RevealData, ConfirmData, CancelData> {
/**
* Revealing state
*/
isRevealed: ComputedRef<boolean>;
/**
* Opens the dialog.
* Create promise and return it. Triggers `onReveal` hook.
*/
reveal: (data?: RevealData) => Promise<UseConfirmDialogRevealResult<ConfirmData, CancelData>>;
/**
* Confirms and closes the dialog. Triggers a callback inside `onConfirm` hook.
* Resolves promise from `reveal()` with `data` and `isCanceled` ref with `false` value.
* Can accept any data and to pass it to `onConfirm` hook.
*/
confirm: (data?: ConfirmData) => void;
/**
* Cancels and closes the dialog. Triggers a callback inside `onCancel` hook.
* Resolves promise from `reveal()` with `data` and `isCanceled` ref with `true` value.
* Can accept any data and to pass it to `onCancel` hook.
*/
cancel: (data?: CancelData) => void;
/**
* Event Hook to be triggered right before dialog creating.
*/
onReveal: EventHookOn<RevealData>;
/**
* Event Hook to be called on `confirm()`.
* Gets data object from `confirm` function.
*/
onConfirm: EventHookOn<ConfirmData>;
/**
* Event Hook to be called on `cancel()`.
* Gets data object from `cancel` function.
*/
onCancel: EventHookOn<CancelData>;
}
/**
* Hooks for creating confirm dialogs. Useful for modal windows, popups and logins.
*
* @see https://vueuse.org/useConfirmDialog/
* @param revealed `boolean` `ref` that handles a modal window
*
* @__NO_SIDE_EFFECTS__
*/
declare function useConfirmDialog<RevealData = any, ConfirmData = any, CancelData = any>(revealed?: ShallowRef<boolean>): UseConfirmDialogReturn<RevealData, ConfirmData, CancelData>;
interface UseCountdownOptions {
/**
* Interval for the countdown in milliseconds. Default is 1000ms.
*/
interval?: MaybeRefOrGetter<number>;
/**
* Callback function called when the countdown reaches 0.
*/
onComplete?: () => void;
/**
* Callback function called on each tick of the countdown.
*/
onTick?: () => void;
/**
* Start the countdown immediately
*
* @default false
*/
immediate?: boolean;
}
interface UseCountdownReturn extends Pausable {
/**
* Current countdown value.
*/
remaining: ShallowRef<number>;
/**
* Resets the countdown and repeatsLeft to their initial values.
*/
reset: (countdown?: MaybeRefOrGetter<number>) => void;
/**
* Stops the countdown and resets its state.
*/
stop: () => void;
/**
* Reset the countdown and start it again.
*/
start: (countdown?: MaybeRefOrGetter<number>) => void;
}
/**
* Wrapper for `useIntervalFn` that provides a countdown timer in seconds.
*
* @param initialCountdown
* @param options
*
* @see https://vueuse.org/useCountdown
*/
declare function useCountdown(initialCountdown: MaybeRefOrGetter<number>, options?: UseCountdownOptions): UseCountdownReturn;
interface UseCssVarOptions extends ConfigurableWindow {
initialValue?: string;
/**
* Use MutationObserver to monitor variable changes
* @default false
*/
observe?: boolean;
}
/**
* Manipulate CSS variables.
*
* @see https://vueuse.org/useCssVar
* @param prop
* @param target
* @param options
*/
declare function useCssVar(prop: MaybeRefOrGetter<string | null | undefined>, target?: MaybeElementRef, options?: UseCssVarOptions): vue.ShallowRef<string | undefined, string | undefined>;
declare function useCurrentElement<T extends MaybeElement = MaybeElement, R extends VueInstance = VueInstance, E extends MaybeElement = MaybeElement extends T ? IsAny<R['$el']> extends false ? R['$el'] : T : T>(rootComponent?: MaybeElementRef<R>): _vueuse_shared.ComputedRefWithControl<E>;
interface UseCycleListOptions<T> {
/**
* The initial value of the state.
* A ref can be provided to reuse.
*/
initialValue?: MaybeRef<T>;
/**
* The default index when
*/
fallbackIndex?: number;
/**
* Custom function to get the index of the current value.
*/
getIndexOf?: (value: T, list: T[]) => number;
}
/**
* Cycle through a list of items
*
* @see https://vueuse.org/useCycleList
*/
declare function useCycleList<T>(list: MaybeRefOrGetter<T[]>, options?: UseCycleListOptions<T>): UseCycleListReturn<T>;
interface UseCycleListReturn<T> {
state: ShallowRef<T>;
index: WritableComputedRef<number>;
next: (n?: number) => T;
prev: (n?: number) => T;
/**
* Go to a specific index
*/
go: (i: number) => T;
}
interface UseDarkOptions extends Omit<UseColorModeOptions<BasicColorSchema>, 'modes' | 'onChanged'> {
/**
* Value applying to the target element when isDark=true
*
* @default 'dark'
*/
valueDark?: string;
/**
* Value applying to the target element when isDark=false
*
* @default ''
*/
valueLight?: string;
/**
* A custom handler for handle the updates.
* When specified, the default behavior will be overridden.
*
* @default undefined
*/
onChanged?: (isDark: boolean, defaultHandler: ((mode: BasicColorSchema) => void), mode: BasicColorSchema) => void;
}
/**
* Reactive dark mode with auto data persistence.
*
* @see https://vueuse.org/useDark
* @param options
*/
declare function useDark(options?: UseDarkOptions): vue.WritableComputedRef<boolean, boolean>;
interface UseRefHistoryRecord<T> {
snapshot: T;
timestamp: number;
}
interface UseManualRefHistoryOptions<Raw, Serialized = Raw> {
/**
* Maximum number of history to be kept. Default to unlimited.
*/
capacity?: number;
/**
* Clone when taking a snapshot, shortcut for dump: JSON.parse(JSON.stringify(value)).
* Default to false
*
* @default false
*/
clone?: boolean | CloneFn<Raw>;
/**
* Serialize data into the history
*/
dump?: (v: Raw) => Serialized;
/**
* Deserialize data from the history
*/
parse?: (v: Serialized) => Raw;
/**
* set data source
*/
setSource?: (source: Ref<Raw>, v: Raw) => void;
}
interface UseManualRefHistoryReturn<Raw, Serialized> {
/**
* Bypassed tracking ref from the argument
*/
source: Ref<Raw>;
/**
* An array of history records for undo, newest comes to first
*/
history: Ref<UseRefHistoryRecord<Serialized>[]>;
/**
* Last history point, source can be different if paused
*/
last: Ref<UseRefHistoryRecord<Serialized>>;
/**
* Same as {@link UseManualRefHistoryReturn.history | history}
*/
undoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
/**
* Records array for redo
*/
redoStack: Ref<UseRefHistoryRecord<Serialized>[]>;
/**
* A ref representing if undo is possible (non empty undoStack)
*/
canUndo: ComputedRef<boolean>;
/**
* A ref representing if redo is possible (non empty redoStack)
*/
canRedo: ComputedRef<boolean>;
/**
* Undo changes
*/
undo: () => void;
/**
* Redo changes
*/
redo: () => void;
/**
* Clear all the history
*/
clear: () => void;
/**
* Create a new history record
*/
commit: () => void;
/**
* Reset ref's value with latest history
*/
reset: () => void;
}
/**
* Track the change history of a ref, also provides undo and redo functionality.
*
* @see https://vueuse.org/useManualRefHistory
* @param source
* @param options
*/
declare function useManualRefHistory<Raw, Serialized = Raw>(source: Ref<Raw>, options?: UseManualRefHistoryOptions<Raw, Serialized>): UseManualRefHistoryReturn<Raw, Serialized>;
interface UseRefHistoryOptions<Raw, Serialized = Raw> extends ConfigurableEventFilter {
/**
* Watch for deep changes, default to false
*
* When set to true, it will also create clones for values store in the history
*
* @default false
*/
deep?: boolean;
/**
* The flush option allows for greater control over the timing of a history point, default to 'pre'
*
* Possible values: 'pre', 'post', 'sync'
* It works in the same way as the flush option in watch and watch effect in vue reactivity
*
* @default 'pre'
*/
flush?: 'pre' | 'post' | 'sync';
/**
* Maximum number of history to be kept. Default to unlimited.
*/
capacity?: number;
/**
* Clone when taking a snapshot, shortcut for dump: JSON.parse(JSON.stringify(value)).
* Default to false
*
* @default false
*/
clone?: boolean | CloneFn<Raw>;
/**
* Serialize data into the history
*/
dump?: (v: Raw) => Serialized;
/**
* Deserialize data from the history
*/
parse?: (v: Serialized) => Raw;
/**
* Function to determine if the commit should proceed
* @param oldValue Previous value
* @param newValue New value
* @returns boolean indicating if commit should proceed
*/
shouldCommit?: (oldValue: Raw | undefined, newValue: Raw) => boolean;
}
interface UseRefHistoryReturn<Raw, Serialized> extends UseManualRefHistoryReturn<Raw, Serialized> {
/**
* A ref representing if the tracking is enabled
*/
isTrack