import { type WritableDraft } from "immer"; import { JSX } from "react"; /** * Generates a UUID (Universally Unique Identifier). * * @remarks * Uses `crypto.randomUUID` if available, otherwise falls back to a polyfill. * * @returns A string representation of a UUID. */ export declare function uuid(): string; /** * Converts a number or string to a CSS length string. * * @param value - The value to convert. Numbers are treated as pixels. * @returns A CSS length string (e.g., "10px", "50%"). */ export declare function getLength(value?: number | string): string; /** * Combines class names conditionally. * * @remarks * Accepts strings or objects where keys are class names and values are booleans. * * @param args - Class names or condition objects. * @returns A single class string. * * @example * ```ts * cx("btn", { "btn-active": isActive }); * ``` */ export declare function cx(...args: Array>): string; export type IntrinsicElement = keyof JSX.IntrinsicElements; type CancelIdleCallback = (id: number) => void; type IdleCallback = (fn: IdleRequestCallback) => number; export type IdleCallbacks = { requestIdleCallback: IdleCallback; cancelIdleCallback: CancelIdleCallback; }; /** * Returns `requestIdleCallback` and `cancelIdleCallback` or their polyfills. * * @returns An object containing the idle callback functions. */ export declare function getRequestIdleCallback(): IdleCallbacks; export declare let idleCallbacks: IdleCallbacks; type StateReducer = (state: WritableDraft, payload: A) => S | void; export type ReducerMap = Record>; type ReducerConfig = { initialState: S; reducers: R; }; export type Action

= { type: string; payload: P; }; type Actions = { [Key in keyof C]: C[Key] extends (state: any) => any ? () => void : C[Key] extends (state: any, payload: infer Payload) => any ? (payload: Payload) => void : never; }; /** * Creates a custom hook for managing state with reducers (similar to Redux Toolkit). * * @remarks * Uses Immer for immutable state updates. * Returns a hook that provides the state and action dispatchers. * * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param config - The reducer configuration (initialState, reducers). * @returns A custom hook. * * @example * ```tsx * const useCounter = createReducerHook({ * initialState: { count: 0 }, * reducers: { * increment: (state) => { state.count += 1; } * } * }); * * const [state, { increment }] = useCounter(); * ``` */ export declare function createReducerHook>(config: ReducerConfig): (init?: (i: S) => S) => readonly [S, Actions]; export {};