import { z } from "zod"; declare const persistenceKeySchema: z.ZodString; export type PersistenceKey = z.infer; /** Zod schema describing the persisted subset of table state (column order, sizing, visibility, sorting, pinning, and expanded). */ declare const tableStateSchema: z.ZodObject<{ columnOrder: z.ZodOptional>; sorting: z.ZodOptional, "many">>; columnVisibility: z.ZodOptional>; columnSizing: z.ZodOptional>; columnPinning: z.ZodOptional>; right: z.ZodOptional>; }, "strip", z.ZodTypeAny, { right?: string[] | undefined; left?: string[] | undefined; }, { right?: string[] | undefined; left?: string[] | undefined; }>>; expanded: z.ZodOptional, z.ZodRecord]>>; }, "strip", z.ZodTypeAny, { columnOrder?: string[] | undefined; columnVisibility?: Record | undefined; sorting?: { id: string; desc: boolean; }[] | undefined; columnPinning?: { right?: string[] | undefined; left?: string[] | undefined; } | undefined; columnSizing?: Record | undefined; expanded?: true | Record | undefined; }, { columnOrder?: string[] | undefined; columnVisibility?: Record | undefined; sorting?: { id: string; desc: boolean; }[] | undefined; columnPinning?: { right?: string[] | undefined; left?: string[] | undefined; } | undefined; columnSizing?: Record | undefined; expanded?: true | Record | undefined; }>; export type TableColumnOptions = z.infer; type UseTablePersistenceResult = { readonly onTableStateChange: (newTableState: Partial | null) => void; readonly initialState: TableColumnOptions | undefined; }; /** * Persists and restores table column state (order, sizing, visibility, sorting, pinning, expanded) using * the URL **hash fragment** and localStorage. * * Storage scope: * - URL hash (shareable): `columnOrder`, `columnVisibility`, `sorting`, `columnPinning`, `columnSizing`. * - localStorage: everything above plus `expanded`. * * The hash slot is used instead of search params because some deployments * route through AWS WAF, whose `SizeRestrictions_QUERYSTRING` managed rule * caps the query string at ~5000 bytes — easily breached by wide tables. * The fragment is client-only and bypasses that cap entirely (subject to a * 64 KiB soft limit enforced by `useHashParamSync`). * * Legacy compatibility: shared links that still use `?Tp=` * search params from before the hash migration are decoded on first load * and the search param is stripped via a `replace` navigation so old * bookmarks and forwarded URLs continue to restore state without polluting * browser history. * * On mount, state is loaded from the hash (or legacy search param as a * one-shot fallback) and merged with localStorage so fields omitted from * the URL, such as `expanded`, still survive reloads. Changes are * debounced (300 ms) and synced to both the hash and localStorage. * * `onTableStateChange` takes a *partial* state and merges it into whatever * was reported earlier in the session, so a consumer can report a single * slice (e.g. only `expanded`) without the omitted fields falling back to * their mount-time values. A field reported empty is dropped from the stored * state, and once every field is empty the entry is removed altogether. * * @param persistenceKey - Unique key used to store and retrieve the table state. * Must be camelCase and at most 15 characters (e.g. "userTable", "assetList"). * @returns {UseTablePersistenceResult} An object containing: * - `onTableStateChange` — callback to invoke when the table state changes. * - `initialState` — the previously persisted {@link TableColumnOptions}, or `undefined` if none exists. * @throws {Error} If persistenceKey is not camelCase or exceeds 15 characters. */ export declare const useTablePersistence: (persistenceKey: PersistenceKey) => UseTablePersistenceResult; export {};