/** * Shared location state utilities - works in both RSC and client contexts * No "use client" directive so it can be imported from RSC */ /** * Internal entry representing a state value with its unique key */ export interface LocationStateEntry { readonly __rsc_ls_key: string; readonly __rsc_ls_value: unknown; } /** * Type-safe location state definition * * Created via createLocationState(), used with Link's state prop * and useLocationState() hook. */ export interface LocationStateDefinition { (...args: TArgs): LocationStateEntry; readonly __rsc_ls_key: string; } /** * Create a type-safe location state definition * * The key is auto-generated by the Vite exposeInternalIds plugin based on * file path and export name. No manual key required. * * @param key Auto-injected by Vite plugin, do not provide manually * @returns A typed state definition for use with Link and useLocationState * * @example * ```typescript * // Define typed state (key auto-generated from file + export) * export const ProductState = createLocationState<{ name: string; price: number }>(); * * // Use in Link - state is captured at click time * * View Product * * * // Multiple states * * Checkout * * * // For lazy evaluation (click-time), pass a getter * ({ name: product.name }))]}> * * // Read with type safety * const productState = useLocationState(ProductState); * // productState: { name: string; price: number } | undefined * ``` */ export declare function createLocationState(key?: string): LocationStateDefinition<[TState | (() => TState)], TState>; /** * Check if a value is a LocationStateEntry */ export declare function isLocationStateEntry(value: unknown): value is LocationStateEntry; /** * Resolve state entries into a flat object for history.state */ export declare function resolveLocationStateEntries(entries: LocationStateEntry[]): Record; //# sourceMappingURL=location-state-shared.d.ts.map