import { NamedExoticComponent, ReactElement, ReactNode } from 'react'; type ElementsRegistryElementsMap = Map; type ElementsRegistrySlotsMap = Map; type ElementsRegistrySetMethod = (id: string, element: V, slot?: string) => void; type ElementsRegistryUnsetMethod = (id: string) => void; type ElementsRegistryMethods = readonly [ElementsRegistrySetMethod, ElementsRegistryUnsetMethod]; export interface ElementsRegistryProps { children: ReactNode; } export interface ElementsRegistryProviderProps extends ElementsRegistryProps { elements: ElementsRegistryElementsMap | null; methods: ElementsRegistryMethods; slots: ElementsRegistrySlotsMap; } interface RegistrySlotProps { name: Name; children?: (children: Array) => ReactNode; } type RegistryState = { elementsMap: ElementsRegistryElementsMap; slotsMap: ElementsRegistrySlotsMap; }; /** * Creates an ElementsRegistry factory with isolated context and hooks. * * This factory function creates a complete registry system for managing registered values * (React elements by default, or any data via the `V` type parameter), including a provider * component and custom hooks for accessing the registry. * * @param name - The name used for display purposes in React DevTools (e.g., "Navigation", "Form") * * @returns An object containing: * - `Registry`: A memoized self-contained provider that owns its own state * - `RegistryProvider`: A memoized provider that accepts externally-managed state (for advanced composition) * - `RegistrySlot`: A component that renders registered elements for a named slot * - `useRegistryElements`: Hook to read the elements map, optionally filtered by slot * - `useRegistryMethods`: Hook to get the `[set, unset]` registration methods * - `useRegistryState`: Hook that owns registry state and returns `[state, methods]` (used by `Registry` internally) * * @example * ```tsx * const { * Registry: NavigationRegistry, * RegistrySlot: NavigationSlot, * useRegistryElements: useNavElements, * useRegistryMethods: useNavMethods, * } = createElementsRegistry('Navigation'); * * function App() { * return ( * * * * * ); * } * * function NavigationContent() { * const [register, unregister] = useNavMethods(); * const elements = useNavElements('primary'); * } * ``` */ export declare function createElementsRegistry = ReactElement, SlotName extends string = string>(name: string): { readonly Registry: NamedExoticComponent; readonly RegistryProvider: NamedExoticComponent>; readonly RegistrySlot: ({ name, children, ...rest }: RegistrySlotProps) => ReactNode; readonly useRegistryElements: (slot?: SlotName) => ElementsRegistryElementsMap | null; readonly useRegistryMethods: () => ElementsRegistryMethods; readonly useRegistryState: () => readonly [RegistryState, ElementsRegistryMethods]; }; export {};