import { S as RemoveQuery, T as SetQuery, n as AddQuery } from "../../index-l2pJm30F.js"; import { c as PageFetchingOptions } from "../../context-CIJX_XuL.js"; import "../../index-D9P9itFa-C0Jtggx-.js"; import { MouseEventHandler, TouchEventHandler } from "react"; //#region public/client/hooks.d.ts declare const useMutation: () => { set: DeepCallable; add: DeepCallable; remove: DeepCallable; batch: , ...Promise[]]>(operations: () => T, queryOptions?: Record) => Promise>; }; declare const useLinkEvents: (destination?: string) => { onClick: MouseEventHandler | undefined; onMouseEnter: MouseEventHandler | undefined; onTouchStart: TouchEventHandler | undefined; }; /** * Hook for paginating a list of records intelligently. * * @param moreAfter - The pagination identifier provided for a list of records by `use`. * In the case of `const accounts = use.accounts();`, for example, `accounts.moreAfter` * should be passed. * @param options - A list of options for customizing the pagination behavior. * @param options.updateAddressBar - By default, a `?page` parameter will be added to the * URL, which allows for sharing the current pagination status of the page with other * people. Setting this argument to `false` will avoid that. * * @returns A function that can be invoked to load the next page. */ declare const usePagination: (moreAfter: string | null, options?: Partial>) => { paginate: () => void; resetPagination: () => void; }; /** * Concatenates arrays based on pagination. Whenever the current paginated page changes, * the provided items will be concatenated with the previously provided list of items. * * @param items - An array of items (of any type) that should be accumulated. For example, * this could be a list of React children. * @param options.moreBefore - The `moreBefore` property of the record list that * should be paginated. * @param options.allowUpdates - Controls whether changes to the provided items should be * allowed, or if they should instead just be ignored. * * @returns The concatenated array of items, and a function for updating it. */ declare const usePaginationBuffer: (items: T[], options: { moreBefore?: string; allowUpdates?: boolean; }) => [T[], (factory: (prevState: T[]) => T[]) => void]; /** * A hook for search / query parameter state management. * * @param key - The key of the query parameter to manage. * @param options - Options for the query parameter. * * @returns A tuple containing the current value of the query parameter and a function to set it. * * @example * ```tsx * import { useQueryState } from 'blade/client/hooks'; * * export default () => { * const [hello, setHello] = useQueryState('hello'); * * return ( * <> * setHello(e.target.value)} * value={hello} * /> *

Hello, {hello || 'world'}!

* * ) * } * ``` */ declare const useQueryState: (key: string, options?: { defaultValue?: T; parse?: (ctx: { defaultValue: T | null; value: string; }) => T | null; }) => [T, (value: T | null) => void]; //#endregion export { useLinkEvents, useMutation, usePagination, usePaginationBuffer, useQueryState };