;
}
declare type ParamsType = P extends any[] ? any[] : any;
declare type Position = {
- left: number;
- top: number;
+ left: number;
+ top: number;
};
declare enum ReadyState_2 {
- Connecting = 0,
- Open = 1,
- Closing = 2,
- Closed = 3
+ Connecting = 0,
+ Open = 1,
+ Closing = 2,
+ Closed = 3
}
declare type Resolve = (value: any) => void;
declare type Size = {
- width: Readonly[>;
- height: Readonly][>;
+ width: Readonly][>;
+ height: Readonly][>;
};
declare type StorageStateResultHasDefaultValue = [
-Ref | Ref,
-(value?: T | IFuncUpdater | undefined) => void
+ Ref | Ref,
+ (value?: T | IFuncUpdater | undefined) => void
];
declare type Subscription = ({ params, event }: SubscriptionParams) => void;
declare type SubscriptionParams = {
- params: T;
- event: string | number;
+ params: T;
+ event: string | number;
};
declare type TargetType = HTMLElement | Element | Window | Document | ComponentPublicInstance;
@@ -166,62 +166,62 @@ declare type TargetType = HTMLElement | Element | Window | Document | ComponentP
declare type TargetValue = T | undefined | null;
declare interface UrlState {
- [key: string]: any;
+ [key: string]: any;
}
export declare function useAsyncOrder({ task, option }: UseAsyncOrderType): void;
declare type UseAsyncOrderType = {
- task: ((resolve?: Resolve, reject?: InterruptibleRejectType, index?: number) => void)[];
- option?: {
- /**
- * Delay execution
- */
- delay?: number;
- /**
- * Preparation phase callback
- * @returns void
- */
- onReady?: () => void;
- /**
- * Successful callback
- * @param result any
- * @returns void
- */
- onSuccess?: (result: unknown) => void;
- /**
- * Error callback
- * @param err unknown
- * @returns void
- */
- onError?: (err: unknown) => void;
- };
-};
-
-export declare function useBoolean(defaultValue?: boolean): UseBooleanResult;
-
-declare interface UseBooleanActions {
+ task: ((resolve?: Resolve, reject?: InterruptibleRejectType, index?: number) => void)[];
+ option?: {
/**
- * Set state to `true`
- * @returns void
+ * Delay execution
*/
- setTrue: () => void;
+ delay?: number;
/**
- * Set state to `false`
+ * Preparation phase callback
* @returns void
*/
- setFalse: () => void;
+ onReady?: () => void;
/**
- * Set state
- * @param value boolean
+ * Successful callback
+ * @param result any
* @returns void
*/
- set: (value: boolean) => void;
+ onSuccess?: (result: unknown) => void;
/**
- * Toggle state
+ * Error callback
+ * @param err unknown
* @returns void
*/
- toggle: () => void;
+ onError?: (err: unknown) => void;
+ };
+};
+
+export declare function useBoolean(defaultValue?: boolean): UseBooleanResult;
+
+declare interface UseBooleanActions {
+ /**
+ * Set state to `true`
+ * @returns void
+ */
+ setTrue: () => void;
+ /**
+ * Set state to `false`
+ * @returns void
+ */
+ setFalse: () => void;
+ /**
+ * Set state
+ * @param value boolean
+ * @returns void
+ */
+ set: (value: boolean) => void;
+ /**
+ * Toggle state
+ * @returns void
+ */
+ toggle: () => void;
}
declare type UseBooleanResult = [Readonly][>, UseBooleanActions];
@@ -229,7 +229,7 @@ declare type UseBooleanResult = [Readonly][>, UseBooleanActions];
export declare function useCookieState(cookieKey: string, options?: UseCookieStateOptions): readonly [Readonly][ UseCookieStateType)>>, (newValue: UseCookieStateType | ((prevState: UseCookieStateType) => UseCookieStateType), newOptions?: Cookies.CookieAttributes) => void];
declare interface UseCookieStateOptions extends Cookies.CookieAttributes {
- defaultValue?: UseCookieStateType | (() => UseCookieStateType);
+ defaultValue?: UseCookieStateType | (() => UseCookieStateType);
}
declare type UseCookieStateType = string | undefined;
@@ -237,40 +237,40 @@ declare type UseCookieStateType = string | undefined;
export declare function useCounter(initialValue?: number, options?: UseCounterOptions): [Ref, UseCounterActions];
declare interface UseCounterActions {
- /**
- * Increment, default delta is 1
- * @param delta number
- * @returns void
- */
- inc: (delta?: number) => void;
- /**
- * Decrement, default delta is 1
- * @param delta number
- * @returns void
- */
- dec: (delta?: number) => void;
- /**
- * Set current value
- * @param value number | ((c: number) => number)
- * @returns void
- */
- set: (value: number | ((c: number) => number)) => void;
- /**
- * Reset current value to initial value
- * @returns void
- */
- reset: () => void;
+ /**
+ * Increment, default delta is 1
+ * @param delta number
+ * @returns void
+ */
+ inc: (delta?: number) => void;
+ /**
+ * Decrement, default delta is 1
+ * @param delta number
+ * @returns void
+ */
+ dec: (delta?: number) => void;
+ /**
+ * Set current value
+ * @param value number | ((c: number) => number)
+ * @returns void
+ */
+ set: (value: number | ((c: number) => number)) => void;
+ /**
+ * Reset current value to initial value
+ * @returns void
+ */
+ reset: () => void;
}
declare interface UseCounterOptions {
- /**
- * Min count
- */
- min?: number;
- /**
- * Max count
- */
- max?: number;
+ /**
+ * Min count
+ */
+ min?: number;
+ /**
+ * Max count
+ */
+ max?: number;
}
export declare function useDarkMode(): [ComputedRef, (value?: unknown) => void];
@@ -278,109 +278,109 @@ export declare function useDarkMode(): [ComputedRef, (value?: unknown)
export declare function useDebounce(value: Ref, options?: DebounceOptions): Ref;
export declare function useDebounceFn(fn: T, options?: DebounceOptions): {
- /**
- * Invode and pass parameters to fn.
- * `(...args: any[]) => any`
- */
- run: DebouncedFunc;
- /**
- * Cancel the invocation of currently debounced function.
- * `() => void`
- */
- cancel: () => void;
- /**
- * Immediately invoke currently debounced function.
- * `() => void`
- */
- flush: () => ReturnType | undefined;
+ /**
+ * Invode and pass parameters to fn.
+ * `(...args: any[]) => any`
+ */
+ run: DebouncedFunc;
+ /**
+ * Cancel the invocation of currently debounced function.
+ * `() => void`
+ */
+ cancel: () => void;
+ /**
+ * Immediately invoke currently debounced function.
+ * `() => void`
+ */
+ flush: () => ReturnType | undefined;
};
export declare const useDrag: (data: T, target: BasicTarget, options?: UseDragOptions) => void;
declare interface UseDragOptions {
- draggable?: boolean;
- /**
- * On drag start callback
- * @param event DragEvent
- * @returns void
- */
- onDragStart?: (event: DragEvent) => void;
- /**
- * On drag end callback
- * @param event DragEvent
- * @returns void
- */
- onDragEnd?: (event: DragEvent) => void;
+ draggable?: boolean;
+ /**
+ * On drag start callback
+ * @param event DragEvent
+ * @returns void
+ */
+ onDragStart?: (event: DragEvent) => void;
+ /**
+ * On drag end callback
+ * @param event DragEvent
+ * @returns void
+ */
+ onDragEnd?: (event: DragEvent) => void;
}
export declare const useDrop: (target: BasicTarget, options?: UseDropOptions) => void;
declare interface UseDropOptions {
- /**
- * The callback when file is dropped or pasted
- * @param files File[]
- * @param event DragEvent
- * @returns void
- */
- onFiles?: (files: File[], event?: DragEvent) => void;
- /**
- * The callback when uri is dropped or pasted
- * @param url string
- * @param event DragEvent
- * @returns void
- */
- onUri?: (url: string, event?: DragEvent) => void;
- /**
- * The callback when DOM is dropped or pasted
- * @param content any
- * @param event DragEvent
- * @returns void
- */
- onDom?: (content: any, event?: DragEvent) => void;
- /**
- * The callback when text is dropped or pasted
- * @param text `string`
- * @param event `ClipboardEvent`
- * @returns `void`
- */
- onText?: (text: string, event?: ClipboardEvent) => void;
- /**
- * On drag enter callback
- * @param event `DragEvent`
- * @returns `void`
- */
- onDragEnter?: (event?: DragEvent) => void;
- /**
- * On drag over callback
- * @param event `DragEvent``
- * @returns `void`
- */
- onDragOver?: (event?: DragEvent) => void;
- /**
- * On drag leave callback
- * @param event `DragEvent`
- * @returns `void`
- */
- onDragLeave?: (event?: DragEvent) => void;
- /**
- * The callback when any is dropped
- * @param event DragEvent
- * @returns void
- */
- onDrop?: (event?: DragEvent) => void;
- /**
- * The callback when any is pasted
- * @param event ClipboardEvent
- * @returns void
- */
- onPaste?: (event?: ClipboardEvent) => void;
+ /**
+ * The callback when file is dropped or pasted
+ * @param files File[]
+ * @param event DragEvent
+ * @returns void
+ */
+ onFiles?: (files: File[], event?: DragEvent) => void;
+ /**
+ * The callback when uri is dropped or pasted
+ * @param url string
+ * @param event DragEvent
+ * @returns void
+ */
+ onUri?: (url: string, event?: DragEvent) => void;
+ /**
+ * The callback when DOM is dropped or pasted
+ * @param content any
+ * @param event DragEvent
+ * @returns void
+ */
+ onDom?: (content: any, event?: DragEvent) => void;
+ /**
+ * The callback when text is dropped or pasted
+ * @param text `string`
+ * @param event `ClipboardEvent`
+ * @returns `void`
+ */
+ onText?: (text: string, event?: ClipboardEvent) => void;
+ /**
+ * On drag enter callback
+ * @param event `DragEvent`
+ * @returns `void`
+ */
+ onDragEnter?: (event?: DragEvent) => void;
+ /**
+ * On drag over callback
+ * @param event `DragEvent``
+ * @returns `void`
+ */
+ onDragOver?: (event?: DragEvent) => void;
+ /**
+ * On drag leave callback
+ * @param event `DragEvent`
+ * @returns `void`
+ */
+ onDragLeave?: (event?: DragEvent) => void;
+ /**
+ * The callback when any is dropped
+ * @param event DragEvent
+ * @returns void
+ */
+ onDrop?: (event?: DragEvent) => void;
+ /**
+ * The callback when any is pasted
+ * @param event ClipboardEvent
+ * @returns void
+ */
+ onPaste?: (event?: ClipboardEvent) => void;
}
export declare function useEventEmitter(options?: {
- /**
- * Is it global
- */
- global?: boolean;
+ /**
+ * Is it global
+ */
+ global?: boolean;
}): UseEventEmitterType;
declare type UseEventEmitterType = EventEmitter | typeof eventEmitterOverall;
@@ -396,22 +396,22 @@ export declare function useEventListener(eventNa
export declare function useEventListener(eventName: string, handler: noop_2, options: UseEventListenerOptions): void;
declare type UseEventListenerOptions = {
- /**
- * DOM element or ref
- */
- target?: T;
- /**
- * Optional, a Boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree.
- */
- capture?: boolean;
- /**
- * Optional, A Boolean indicating that the listener should be invoked at most once after being added. If true, the listener would be automatically removed when invoked.
- */
- once?: boolean;
- /**
- * Optional, A Boolean which, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener does call preventDefault(), the user agent will do nothing other than generate a console warning.
- */
- passive?: boolean;
+ /**
+ * DOM element or ref
+ */
+ target?: T;
+ /**
+ * Optional, a Boolean indicating that events of this type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree.
+ */
+ capture?: boolean;
+ /**
+ * Optional, A Boolean indicating that the listener should be invoked at most once after being added. If true, the listener would be automatically removed when invoked.
+ */
+ once?: boolean;
+ /**
+ * Optional, A Boolean which, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener does call preventDefault(), the user agent will do nothing other than generate a console warning.
+ */
+ passive?: boolean;
};
declare type UseEventListenerTarget = BasicTarget;
@@ -419,18 +419,18 @@ declare type UseEventListenerTarget = BasicTarget, options?: UseExternalOptions): Readonly][>;
declare interface UseExternalOptions {
- /**
- * The type of extarnal resources which need to load, support `js`/`css`, if no type, it will deduced according to path
- */
- type?: 'js' | 'css';
- /**
- * Attributes supported by `script`
- */
- js?: Partial;
- /**
- * Attributes supported by `link`
- */
- css?: Partial;
+ /**
+ * The type of extarnal resources which need to load, support `js`/`css`, if no type, it will deduced according to path
+ */
+ type?: 'js' | 'css';
+ /**
+ * Attributes supported by `script`
+ */
+ js?: Partial;
+ /**
+ * Attributes supported by `link`
+ */
+ css?: Partial;
}
declare type UseExternalStatus = 'unset' | 'loading' | 'ready' | 'error';
@@ -438,198 +438,198 @@ declare type UseExternalStatus = 'unset' | 'loading' | 'ready' | 'error';
export declare function useFavicon(href?: string | Ref): void;
export declare function useFetchs(service: UseRequestService>, options: UseRequestOptions, any> & {
- manual: true;
+ manual: true;
}, self: {
- fetchKey?: (...args: ParamsType) => string;
+ fetchKey?: (...args: ParamsType) => string;
}): {
- fetchs: Readonly][ | undefined;
- readonly params: DeepReadonly;
- readonly loading: boolean;
- readonly key: string | number;
- };
- readonly [x: number]: {
- readonly data: DeepReadonly | undefined;
- readonly params: DeepReadonly;
- readonly loading: boolean;
- readonly key: string | number;
- };
- }>>;
- fetchRun: (...args: TParams extends any[] ? any[] : any) => void;
+ fetchs: Readonly][ | undefined;
+ readonly params: DeepReadonly;
+ readonly loading: boolean;
+ readonly key: string | number;
+ };
+ readonly [x: number]: {
+ readonly data: DeepReadonly | undefined;
+ readonly params: DeepReadonly;
+ readonly loading: boolean;
+ readonly key: string | number;
+ };
+ }>>;
+ fetchRun: (...args: TParams extends any[] ? any[] : any) => void;
};
export declare function useFocusWithin(
-/**
- * DOM element or ref
- */
-target: BasicTarget, options?: UseFocusWithinOptions): Readonly][>;
+ /**
+ * DOM element or ref
+ */
+ target: BasicTarget, options?: UseFocusWithinOptions): Readonly][>;
declare interface UseFocusWithinOptions {
- /**
- * Callback to be executed on focus
- * @param e FocusEvent
- * @returns void
- */
- onFocus?: (e: FocusEvent) => void;
- /**
- * Callback to be executed on blur
- * @param e FocusEvent
- * @returns void
- */
- onBlur?: (e: FocusEvent) => void;
- /**
- * Callback to be executed on focus change
- * @param isFocusWithin boolean
- * @returns void
- */
- onChange?: (isFocusWithin: boolean) => void;
+ /**
+ * Callback to be executed on focus
+ * @param e FocusEvent
+ * @returns void
+ */
+ onFocus?: (e: FocusEvent) => void;
+ /**
+ * Callback to be executed on blur
+ * @param e FocusEvent
+ * @returns void
+ */
+ onBlur?: (e: FocusEvent) => void;
+ /**
+ * Callback to be executed on focus change
+ * @param isFocusWithin boolean
+ * @returns void
+ */
+ onChange?: (isFocusWithin: boolean) => void;
}
export declare function useFormatResult(data: TData | Ref, formatResultCallback: (data: TData) => FData): ComputedRef;
export declare const useFullscreen: (target: BasicTarget, options?: UseFullscreenOptions) => readonly [Readonly][>, {
- readonly enterFullscreen: () => void;
- readonly exitFullscreen: () => void;
- readonly toggleFullscreen: () => void;
- readonly isEnabled: true;
+ readonly enterFullscreen: () => void;
+ readonly exitFullscreen: () => void;
+ readonly toggleFullscreen: () => void;
+ readonly isEnabled: true;
}];
declare interface UseFullscreenOptions {
- /**
- * Exit full screen trigger
- * @returns void
- */
- onExit?: () => void;
- /**
- * Enter full screen trigger
- * @returns void
- */
- onEnter?: () => void;
+ /**
+ * Exit full screen trigger
+ * @returns void
+ */
+ onExit?: () => void;
+ /**
+ * Enter full screen trigger
+ * @returns void
+ */
+ onEnter?: () => void;
}
export declare function useHover(target: BasicTarget, options?: UseHoverOptions): Ref;
declare interface UseHoverOptions {
- /**
- * Callback to be executed on mouse hover
- * @returns void
- */
- onEnter?: () => void;
- /**
- * Callback to be executed on mouse leave
- * @returns void
- */
- onLeave?: () => void;
- /**
- * Callback to be executed on hover change
- * @param isHovering boolean
- * @returns void
- */
- onChange?: (isHovering: boolean) => void;
+ /**
+ * Callback to be executed on mouse hover
+ * @returns void
+ */
+ onEnter?: () => void;
+ /**
+ * Callback to be executed on mouse leave
+ * @returns void
+ */
+ onLeave?: () => void;
+ /**
+ * Callback to be executed on hover change
+ * @param isHovering boolean
+ * @returns void
+ */
+ onChange?: (isHovering: boolean) => void;
}
declare type UseInfiniteData = {
- list: any[];
- [key: string]: any;
+ list: any[];
+ [key: string]: any;
};
export declare const useInfiniteScroll: (service: UseInfiniteService, options?: UseInfiniteScrollOptions) => {
- data: Readonly][>;
- loading: Readonly][>;
- loadingMore: Readonly][>;
- noMore: ComputedRef;
- loadMore: () => void;
- loadMoreAsync: () => Promise | undefined;
- reload: () => void;
- reloadAsync: () => Promise;
- mutate: (mutateData: any) => void;
- scrollMethod: () => void;
- cancel: () => void;
+ data: Readonly][>;
+ loading: Readonly][>;
+ loadingMore: Readonly][>;
+ noMore: ComputedRef;
+ loadMore: () => void;
+ loadMoreAsync: () => Promise | undefined;
+ reload: () => void;
+ reloadAsync: () => Promise;
+ mutate: (mutateData: any) => void;
+ scrollMethod: () => void;
+ cancel: () => void;
};
declare interface UseInfiniteScrollOptions {
- /**
- * specifies the parent element. If it exists, it will trigger the `loadMore` when scrolling to the bottom. Needs to work with `isNoMore` to know when there is no more data to load
- */
- target?: BasicTarget;
- /**
- * determines if there is no more data, the input parameter is the latest merged `data`
- * @param data TData
- * @returns boolean
- */
- isNoMore?: (data?: TData) => boolean;
- /**
- * The pixel threshold to the bottom for the scrolling to load
- */
- threshold?: number;
- /**
- * - The default is `false`. That is, the service is automatically executed during initialization.
- * - If set to `true`, you need to manually call `run` or `runAsync` to trigger execution.
- */
- manual?: boolean;
- /**
- * When the content of the array changes, `reload` will be triggered
- */
- reloadDeps?: DependencyList;
- /**
- * Triggered before service execution
- * @returns void
- */
- onBefore?: () => void;
- /**
- * Triggered when service resolve
- * @param data TData
- * @returns void
- */
- onSuccess?: (data: TData) => void;
- /**
- * Triggered when service reject
- * @param e Error
- * @returns void
- */
- onError?: (e: Error) => void;
- /**
- * Triggered when service execution is complete
- * @param data TData
- * @param e Error
- * @returns void
- */
- onFinally?: (data?: TData, e?: Error) => void;
+ /**
+ * specifies the parent element. If it exists, it will trigger the `loadMore` when scrolling to the bottom. Needs to work with `isNoMore` to know when there is no more data to load
+ */
+ target?: BasicTarget;
+ /**
+ * determines if there is no more data, the input parameter is the latest merged `data`
+ * @param data TData
+ * @returns boolean
+ */
+ isNoMore?: (data?: TData) => boolean;
+ /**
+ * The pixel threshold to the bottom for the scrolling to load
+ */
+ threshold?: number;
+ /**
+ * - The default is `false`. That is, the service is automatically executed during initialization.
+ * - If set to `true`, you need to manually call `run` or `runAsync` to trigger execution.
+ */
+ manual?: boolean;
+ /**
+ * When the content of the array changes, `reload` will be triggered
+ */
+ reloadDeps?: DependencyList;
+ /**
+ * Triggered before service execution
+ * @returns void
+ */
+ onBefore?: () => void;
+ /**
+ * Triggered when service resolve
+ * @param data TData
+ * @returns void
+ */
+ onSuccess?: (data: TData) => void;
+ /**
+ * Triggered when service reject
+ * @param e Error
+ * @returns void
+ */
+ onError?: (e: Error) => void;
+ /**
+ * Triggered when service execution is complete
+ * @param data TData
+ * @param e Error
+ * @returns void
+ */
+ onFinally?: (data?: TData, e?: Error) => void;
}
declare type UseInfiniteService = (currentData?: TData) => Promise;
export declare function useInterval(
-/**
- * The function to be executed every `delay` milliseconds.
- */
-fn: () => void,
-/**
- * The time in milliseconds, the timer should delay in between executions of the specified function. The timer will be cancelled if delay is set to `undefined`.
- */
-delay: Ref | number | undefined, options?: {
+ /**
+ * The function to be executed every `delay` milliseconds.
+ */
+ fn: () => void,
+ /**
+ * The time in milliseconds, the timer should delay in between executions of the specified function. The timer will be cancelled if delay is set to `undefined`.
+ */
+ delay: Ref | number | undefined, options?: {
/**
* Whether the function should be executed immediately on first execution.
*/
immediate?: boolean;
-}): void;
+ }): void;
export declare function useInViewport(target: BasicTarget, options?: UseInViewportOptions): readonly [Readonly][>, Readonly][>];
declare interface UseInViewportOptions {
- /**
- * Margin around the root
- */
- rootMargin?: string;
- /**
- * Either a single number or an array of numbers which indicate at what percentage of the target's visibility the ratio should be executed
- */
- threshold?: number | number[];
- /**
- * The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. Defaults to the browser viewport if not specified or if null.
- */
- root?: BasicTarget;
+ /**
+ * Margin around the root
+ */
+ rootMargin?: string;
+ /**
+ * Either a single number or an array of numbers which indicate at what percentage of the target's visibility the ratio should be executed
+ */
+ threshold?: number | number[];
+ /**
+ * The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. Defaults to the browser viewport if not specified or if null.
+ */
+ root?: BasicTarget;
}
export declare function useKeyPress(keyFilter: UseKeyPressKeyFilter, eventHandler: UseKeyPressEventHandler, option?: UseKeyPressOptions): void;
@@ -643,18 +643,18 @@ declare type UseKeyPressKeyFilter = UseKeyPressKeyType | UseKeyPressKeyType[] |
declare type UseKeyPressKeyType = number | string;
declare type UseKeyPressOptions = {
- /**
- * Trigger Events
- */
- events?: UseKeyPressKeyEvent[];
- /**
- * DOM element or ref
- */
- target?: UseKeyPressTarget;
- /**
- * Exact match. If set true, the event will only be trigger when the keys match exactly. For example, pressing [shif + c] will not trigger [c]
- */
- exactMatch?: boolean;
+ /**
+ * Trigger Events
+ */
+ events?: UseKeyPressKeyEvent[];
+ /**
+ * DOM element or ref
+ */
+ target?: UseKeyPressTarget;
+ /**
+ * Exact match. If set true, the event will only be trigger when the keys match exactly. For example, pressing [shif + c] will not trigger [c]
+ */
+ exactMatch?: boolean;
};
declare type UseKeyPressTarget = BasicTarget;
@@ -664,108 +664,108 @@ export declare const useLocalStorageState: (key: string | Ref, option
export declare function useLockFn](fn: (...args: P) => Promise): (...args: P) => Promise;
export declare const useLongPress: (target: BasicTarget, options?: UseLongPressOptions) => {
- pressingTime: DeepReadonly[>;
- isPressing: DeepReadonly][>;
+ pressingTime: DeepReadonly][>;
+ isPressing: DeepReadonly][>;
};
declare interface UseLongPressOptions {
- delay?: number;
- minUpdateTime?: number;
- cancelOnMove?: boolean;
- modifiers?: LongPressModifiers;
+ delay?: number;
+ minUpdateTime?: number;
+ cancelOnMove?: boolean;
+ modifiers?: LongPressModifiers;
}
export declare function useMap(initialValue?: UseMapValue): [Readonly][>>, UseMapActions];
declare type UseMapActions = {
- /**
- * Add item
- * @param key K
- * @param value T
- * @returns void
- */
- set: (key: K, value: T) => void;
- /**
- * Get item
- * @param key K
- * @param value T
- * @returns undefined
- */
- get: (key: K) => T | undefined;
- /**
- * Remove key
- * @param key K
- * @returns void
- */
- remove: (key: K) => void;
- /**
- * Add item
- * @param key K
- * @returns boolean
- */
- has: (key: K) => boolean;
- /**
- * clear
- * @returns void
- */
- clear: () => void;
- /**
- * Set a new Map
- * @param newMap UseMapValue
- * @returns void
- */
- setAll: (newMap: UseMapValue) => void;
- /**
- * Reset to default
- * @returns void
- */
- reset: () => void;
+ /**
+ * Add item
+ * @param key K
+ * @param value T
+ * @returns void
+ */
+ set: (key: K, value: T) => void;
+ /**
+ * Get item
+ * @param key K
+ * @param value T
+ * @returns undefined
+ */
+ get: (key: K) => T | undefined;
+ /**
+ * Remove key
+ * @param key K
+ * @returns void
+ */
+ remove: (key: K) => void;
+ /**
+ * Add item
+ * @param key K
+ * @returns boolean
+ */
+ has: (key: K) => boolean;
+ /**
+ * clear
+ * @returns void
+ */
+ clear: () => void;
+ /**
+ * Set a new Map
+ * @param newMap UseMapValue
+ * @returns void
+ */
+ setAll: (newMap: UseMapValue) => void;
+ /**
+ * Reset to default
+ * @returns void
+ */
+ reset: () => void;
};
declare type UseMapValue = Iterable;
export declare function useMedia(
-/**
- * Media to query for an array of objects
- */
-queries: any[],
-/**
- * The default value for each media query object
- */
-values: {
+ /**
+ * Media to query for an array of objects
+ */
+ queries: any[],
+ /**
+ * The default value for each media query object
+ */
+ values: {
[x: string]: any;
-},
-/**
- * DefaultValue
- */
-defaultValue: any): any;
+ },
+ /**
+ * DefaultValue
+ */
+ defaultValue: any): any;
export declare function useMouse(target?: BasicTarget): Readonly][>;
export declare function useNetwork(): Readonly][>;
declare interface UseNetworkState {
- since?: Date;
- online?: boolean;
- rtt?: number;
- type?: string;
- downlink?: number;
- saveData?: boolean;
- downlinkMax?: number;
- effectiveType?: string;
+ since?: Date;
+ online?: boolean;
+ rtt?: number;
+ type?: string;
+ downlink?: number;
+ saveData?: boolean;
+ downlinkMax?: number;
+ effectiveType?: string;
}
export declare function usePrevious(state: Ref | ComputedRef, shouldUpdate?: UsePreviousShouldUpdateFunc): Readonly][ | undefined>>;
@@ -775,236 +775,236 @@ declare type UsePreviousShouldUpdateFunc = (prev: T | undefined, next: T) =>
export declare function useRequest[] = UseRequestPlugin[]>(service: UseRequestService, options?: UseRequestOptions ? R : never : never>, plugins?: PluginsOptions): useRequestResult;
declare interface UseRequestBasicOptions {
- /**
- * Init data.
- */
- initialData?: TData;
- /**
- * - The default is `false.` That is, the service is automatically executed during initialization.
- * - f set to `true`, you need to manually call `run` or r`unAsync` to trigger execution.
- */
- manual?: boolean;
- /**
- * The parameters passed to the service at the first default execution
- */
- defaultParams?: TParams;
- /**
- * Triggered before service execution
- * @param params TParams
- * @returns void
- */
- onBefore?: (params: TParams) => void;
- /**
- * Triggered when service resolve.
- * @param data TData
- * @param params TParams
- * @returns void
- */
- onSuccess?: (data: TData, params: TParams) => void;
- /**
- * Triggered when service reject.
- * @param e Error
- * @param params TParams
- * @returns void
- */
- onError?: (e: Error, params: TParams) => void;
- /**
- * Triggered when service execution is complete.
- * @param params TParams
- * @param data TData
- * @param e Error
- * @returns void
- */
- onFinally?: (params: TParams, data?: TData, e?: Error) => void;
- /**
- * Is the current request ready
- */
- ready?: Ref | boolean;
- /**
- * Dependent on responsive objects, and the `watch` incoming listener object usage for `vue`.
- */
- refreshDeps?: WatchSource[] | boolean;
- refreshDepsAction?: () => void;
- /**
- * Set the delay time for `loading` to become `true`.
- *
- */
- loadingDelay?: number | Ref;
- devKey?: string;
- /**
- * Format the request results, which recommend to use `useFormatResult`
- * @param data TData
- * @returns unknown need cover TData
- */
- formatResult?: (data?: TData) => unknown;
- /**
- * Polling interval, in milliseconds. If the value is greater than 0, the polling mode is activated.
- */
- pollingInterval?: Ref | number;
- /**
- * Whether to continue polling when the page is hidden. If set to false, polling will be temporarily paused when the page is hidden, and resume when the page is visible again.
- */
- pollingWhenHidden?: boolean;
- /**
- * Number of polling error retries. If set to -1, `an infinite number of times`.
- */
- pollingErrorRetryCount?: number;
- /**
- * Whether to re-initiate the request when the screen refocus or revisible.
- */
- refreshOnWindowFocus?: Ref | boolean;
- /**
- * Re-request interval, in milliseconds.
- */
- focusTimespan?: Ref | number;
- /**
- * Debounce delay time, in milliseconds. After setting, enter the debounce mode.
- */
- debounceWait?: Ref | number;
- /**
- * Execute the request before the delay starts.
- */
- debounceLeading?: Ref | boolean;
- /**
- * Execute the request after the delay ends.
- */
- debounceTrailing?: Ref | boolean;
- /**
- * The maximum time request is allowed to be delayed before it’s executed.
- */
- debounceMaxWait?: Ref | number;
- /**
- * Throttle wait time, in milliseconds. After setting, enter the throttle mode.
- */
- throttleWait?: Ref | number;
- /**
- * Execute the request before throttling starts.
- */
- throttleLeading?: Ref | boolean;
- /**
- * Execute the request after throttling ends.
- */
- throttleTrailing?: Ref | boolean;
- /**
- * A unique ID of the request. If `cacheKey` is set, we will enable the caching mechanism. The data of the same `cacheKey` is globally synchronized.
- */
- cacheKey?: string;
- /**
- * - Set the cache time. By default, the cached data will be cleared after 5 minutes.
- * - If set to `-1`, the cached data will never expire.
- */
- cacheTime?: number;
- /**
- * - Time to consider the cached data is fresh. Within this time interval, the request will not be re-initiated.
- * - If set to `-1`, it means that the data is always fresh
- */
- staleTime?: number;
- /**
- * - Custom set cache.
- * - `setCache` and `getCache` need to be used together.
- * - In the custom cache mode, `cacheTime` and `clearCache` are useless, please implement it yourself according to the actual situation.
- * @param data CachedData
- * @returns void
- */
- setCache?: (data: CachedData) => void;
- /**
- * Custom get cache
- * @param params TParams
- * @returns CachedData
- */
- getCache?: (params: TParams) => CachedData | undefined;
- /**
- * The number of retries. If set to `-1`, it will try again indefinitely.
- */
- retryCount?: number;
- /**
- * - Retry interval in milliseconds.
- * If not set, the simple exponential backoff algorithm will be used by default, taking `1000 * 2 ** retryCount`, that is, waiting for 2s for the first retry, and 4s for the second retry. By analogy, if it is greater than 30s, take 30s.
- */
- retryInterval?: number;
+ /**
+ * Init data.
+ */
+ initialData?: TData;
+ /**
+ * - The default is `false.` That is, the service is automatically executed during initialization.
+ * - f set to `true`, you need to manually call `run` or r`unAsync` to trigger execution.
+ */
+ manual?: boolean;
+ /**
+ * The parameters passed to the service at the first default execution
+ */
+ defaultParams?: TParams;
+ /**
+ * Triggered before service execution
+ * @param params TParams
+ * @returns void
+ */
+ onBefore?: (params: TParams) => void;
+ /**
+ * Triggered when service resolve.
+ * @param data TData
+ * @param params TParams
+ * @returns void
+ */
+ onSuccess?: (data: TData, params: TParams) => void;
+ /**
+ * Triggered when service reject.
+ * @param e Error
+ * @param params TParams
+ * @returns void
+ */
+ onError?: (e: Error, params: TParams) => void;
+ /**
+ * Triggered when service execution is complete.
+ * @param params TParams
+ * @param data TData
+ * @param e Error
+ * @returns void
+ */
+ onFinally?: (params: TParams, data?: TData, e?: Error) => void;
+ /**
+ * Is the current request ready
+ */
+ ready?: Ref | boolean;
+ /**
+ * Dependent on responsive objects, and the `watch` incoming listener object usage for `vue`.
+ */
+ refreshDeps?: WatchSource[] | boolean;
+ refreshDepsAction?: () => void;
+ /**
+ * Set the delay time for `loading` to become `true`.
+ *
+ */
+ loadingDelay?: number | Ref;
+ debugKey?: string;
+ /**
+ * Format the request results, which recommend to use `useFormatResult`
+ * @param data TData
+ * @returns unknown need cover TData
+ */
+ formatResult?: (data?: TData) => unknown;
+ /**
+ * Polling interval, in milliseconds. If the value is greater than 0, the polling mode is activated.
+ */
+ pollingInterval?: Ref | number;
+ /**
+ * Whether to continue polling when the page is hidden. If set to false, polling will be temporarily paused when the page is hidden, and resume when the page is visible again.
+ */
+ pollingWhenHidden?: boolean;
+ /**
+ * Number of polling error retries. If set to -1, `an infinite number of times`.
+ */
+ pollingErrorRetryCount?: number;
+ /**
+ * Whether to re-initiate the request when the screen refocus or revisible.
+ */
+ refreshOnWindowFocus?: Ref | boolean;
+ /**
+ * Re-request interval, in milliseconds.
+ */
+ focusTimespan?: Ref | number;
+ /**
+ * Debounce delay time, in milliseconds. After setting, enter the debounce mode.
+ */
+ debounceWait?: Ref | number;
+ /**
+ * Execute the request before the delay starts.
+ */
+ debounceLeading?: Ref | boolean;
+ /**
+ * Execute the request after the delay ends.
+ */
+ debounceTrailing?: Ref | boolean;
+ /**
+ * The maximum time request is allowed to be delayed before it’s executed.
+ */
+ debounceMaxWait?: Ref | number;
+ /**
+ * Throttle wait time, in milliseconds. After setting, enter the throttle mode.
+ */
+ throttleWait?: Ref | number;
+ /**
+ * Execute the request before throttling starts.
+ */
+ throttleLeading?: Ref | boolean;
+ /**
+ * Execute the request after throttling ends.
+ */
+ throttleTrailing?: Ref | boolean;
+ /**
+ * A unique ID of the request. If `cacheKey` is set, we will enable the caching mechanism. The data of the same `cacheKey` is globally synchronized.
+ */
+ cacheKey?: string;
+ /**
+ * - Set the cache time. By default, the cached data will be cleared after 5 minutes.
+ * - If set to `-1`, the cached data will never expire.
+ */
+ cacheTime?: number;
+ /**
+ * - Time to consider the cached data is fresh. Within this time interval, the request will not be re-initiated.
+ * - If set to `-1`, it means that the data is always fresh
+ */
+ staleTime?: number;
+ /**
+ * - Custom set cache.
+ * - `setCache` and `getCache` need to be used together.
+ * - In the custom cache mode, `cacheTime` and `clearCache` are useless, please implement it yourself according to the actual situation.
+ * @param data CachedData
+ * @returns void
+ */
+ setCache?: (data: CachedData) => void;
+ /**
+ * Custom get cache
+ * @param params TParams
+ * @returns CachedData
+ */
+ getCache?: (params: TParams) => CachedData | undefined;
+ /**
+ * The number of retries. If set to `-1`, it will try again indefinitely.
+ */
+ retryCount?: number;
+ /**
+ * - Retry interval in milliseconds.
+ * If not set, the simple exponential backoff algorithm will be used by default, taking `1000 * 2 ** retryCount`, that is, waiting for 2s for the first retry, and 4s for the second retry. By analogy, if it is greater than 30s, take 30s.
+ */
+ retryInterval?: number;
}
export declare const useRequestDevToolsPlugin: {
- install(app: any): void;
+ install(app: any): void;
};
declare interface UseRequestFetchState {
- loading: boolean;
- params?: TParams;
- data?: TData;
- error?: Error | unknown;
+ loading: boolean;
+ params?: TParams;
+ data?: TData;
+ error?: Error | unknown;
}
declare type UseRequestOptions = {
- [K in keyof UseRequestBasicOptions]: UseRequestBasicOptions[K];
+ [K in keyof UseRequestBasicOptions]: UseRequestBasicOptions[K];
} & {
[K in keyof TPlugin]: TPlugin[K];
-};
+ };
declare interface UseRequestPlugin {
- (fetchInstance: Fetch, options: UseRequestOptions): UseRequestPluginReturn;
- onInit?: (options: UseRequestOptions) => Partial>;
+ (fetchInstance: Fetch, options: UseRequestOptions): UseRequestPluginReturn;
+ onInit?: (options: UseRequestOptions) => Partial>;
}
declare interface UseRequestPluginReturn {
- name?: string;
- onBefore?: (params: TParams) => ({
- stopNow?: boolean;
- returnNow?: boolean;
- } & Partial>) | void;
- onRequest?: (service: UseRequestService, params: TParams) => {
- servicePromise?: Promise;
- };
- onSuccess?: (data: TData, params: TParams) => void;
- onError?: (e: Error, params: TParams) => void;
- onFinally?: (params: TParams, data?: TData, e?: Error) => void;
- onCancel?: () => void;
- onMutate?: (data: TData) => void;
+ name?: string;
+ onBefore?: (params: TParams) => ({
+ stopNow?: boolean;
+ returnNow?: boolean;
+ } & Partial>) | void;
+ onRequest?: (service: UseRequestService, params: TParams) => {
+ servicePromise?: Promise;
+ };
+ onSuccess?: (data: TData, params: TParams) => void;
+ onError?: (e: Error, params: TParams) => void;
+ onFinally?: (params: TParams, data?: TData, e?: Error) => void;
+ onCancel?: () => void;
+ onMutate?: (data: TData) => void;
}
export declare function useRequestProvider(config: UseRequestOptions): void;
declare interface useRequestResult {
- /**
- * Is the service being executed.
- */
- loading: Readonly][>;
- /**
- * Data returned by service.
- */
- data: Readonly][>;
- /**
- * Exception thrown by service.
- */
- error: Readonly][>;
- /**
- * params An array of parameters for the service being executed. For example, you triggered `run(1, 2, 3)`, then params is equal to `[1, 2, 3]`.
- */
- params: Readonly][>;
- /**
- * Ignore the current promise response.
- */
- cancel: Fetch['cancel'];
- /**
- * Use the last params, call `run` again.
- */
- refresh: Fetch['refresh'];
- /**
- * Use the last params, call `runAsync` again.
- */
- refreshAsync: Fetch['refreshAsync'];
- /**
- * Manually trigger the execution of the service, and the parameters will be passed to the service.
- */
- run: Fetch['run'];
- /**
- * Automatic handling of exceptions, feedback through `onError`
- */
- runAsync: Fetch['runAsync'];
- /**
- * Mutate `data` directly
- */
- mutate: Fetch['mutate'];
+ /**
+ * Is the service being executed.
+ */
+ loading: Readonly][>;
+ /**
+ * Data returned by service.
+ */
+ data: Readonly][>;
+ /**
+ * Exception thrown by service.
+ */
+ error: Readonly]