import { RefObject } from 'react'; /** * Minimal shape every `@42/core` controller satisfies. Mirrors * `HeadlessController` from the core package: it is constructed against an * existing DOM root and tears every side effect down on `destroy()`. `update()` * is optional — adapters call it to sync reactive options without re-creating * the instance and otherwise re-create. */ export interface C42Controller { /** Remove every listener / side effect. Must be idempotent. */ destroy(): void; /** Optional: sync reactive options without re-creating the instance. */ update?(options: unknown): void; } /** Constructor shape for a headless controller. * * `options` is declared as required so controllers with mandatory options * (e.g. pagination's `total`) are assignable; controllers with optional * options remain assignable too (an optional parameter satisfies a required * one). The hook itself tolerates a missing options object at runtime. */ export type C42ControllerClass = new (root: E, options: O) => C42Controller; /** A DOM CustomEvent handler that receives the already-unwrapped `detail`. */ export type C42EventHandler = (detail: any, event: CustomEvent) => void; /** * Bridge a vanilla-TS `@42/core` controller into React. * * On mount it instantiates `new ControllerClass(el, options)` against the * returned ref. On cleanup it calls `destroy()`. When any value in `deps` * changes it re-syncs the controller: if the instance exposes `update()` that * is called with the latest options; otherwise the instance is destroyed and * re-created. * * SSR-safe: the DOM is only touched inside `useEffect`, never during render. * * @param ControllerClass the headless controller constructor. * @param options options forwarded to the constructor / `update()`. * @param deps values that should trigger an options re-sync. * @returns a ref to attach to the controller's root element. */ export declare function useC42(ControllerClass: C42ControllerClass, options?: O, deps?: unknown[]): RefObject; /** * Attach `data-c42-*` DOM CustomEvent listeners to a controller root. * * Listeners are bound once per mount (event names are static for a given * component); the latest handler functions are read through a ref so passing * fresh callbacks every render does not re-bind. Each handler receives the * unwrapped `event.detail` plus the original `CustomEvent`. */ export declare function useC42Events(ref: RefObject, handlers: Record): void;