import { ReactNode } from 'react'; import { PortalManagerHandle } from './portal-manager'; /** * Register (or unregister) a PortalManager for a specific grid element. * Called from DataGrid on mount/unmount. * * @param gridEl - The `` DOM element that owns the PortalManager. * @param pm - The PortalManager handle, or `null` to unregister. */ export declare function setPortalManager(gridEl: HTMLElement, pm: PortalManagerHandle | null): void; /** * Get the PortalManager handle for a specific grid element. * If no grid element is provided, returns the first available handle * (single-grid convenience). */ export declare function getPortalManager(gridEl?: HTMLElement): PortalManagerHandle | null; /** * Render a React element into a DOM container. * * - If a PortalManager is available for the owning grid, creates a portal * (context-preserving). * - Otherwise, falls back to `createRoot` (isolated tree, no context). * * @param container - The DOM element to render into. * @param element - The React element to render. * @param existingKey - Reuse a previously-returned key for updates. * @param gridEl - Explicit grid element (avoids DOM traversal). * @returns The portal key (for future updates or removal). */ export declare function renderToContainer(container: HTMLElement, element: ReactNode, existingKey?: string, gridEl?: HTMLElement): string; /** * Remove a portal (or fallback root) by key. * * @param options.sync - When true, flush the removal synchronously so the * caller can safely clear the container DOM immediately after (e.g., * tool panel accordion collapse sets `innerHTML = ''`). */ export declare function removeFromContainer(key: string, options?: { sync?: boolean; }): void; /** * Remove all portals and fallback roots for a specific grid. * Preferred over `clearAllContainers()` in multi-grid scenarios. */ export declare function clearContainersForGrid(gridEl: HTMLElement): void; /** * Open a teardown batch on every registered PortalManager. Used by the * adapter's `beginBatch()` hook so grid core's bulk teardown loops * (`_clearRowPool`, row-pool shrink, `renderInlineRow`) can release N * portals without N `flushSync` warnings (#330). * * Optional `gridEl` scopes the batch to a single grid; omit to batch * across all grids (the multi-grid case is rare but harmless). */ export declare function beginPortalBatch(gridEl?: HTMLElement): void; /** * Close a teardown batch opened by {@link beginPortalBatch}. Calls MUST * pair with `beginPortalBatch` (same grid scope or both global). */ export declare function endPortalBatch(gridEl?: HTMLElement): void; /** * Remove all portals and fallback roots across all grids. * Use `clearContainersForGrid()` in multi-grid scenarios instead. */ export declare function clearAllContainers(): void; /** * Wrap a React-returning render function as a vanilla `(ctx) => HTMLElement | null` * suitable for any grid renderer slot (cell renderer, group header, pinned-row * panel, etc.). Returns `null` when the React function returns `null` / * `undefined` / `false`, so built-in conditional renderers can opt out. * * The wrapper is a `
` so it imposes no layout. * Each call mounts a fresh portal — call sites that need to update the same * container instead should use `renderToContainer` directly with `existingKey`. */ export declare function createNodeBridge(reactFn: (ctx: TCtx) => ReactNode): (ctx: TCtx) => HTMLElement | null; /** * Reset the key counter. Only use in tests. * @internal */ export declare function resetKeyCounter(): void; /** * Reset all bridge state. Only use in tests. * Clears all PortalManager registrations, key mappings, and fallback roots. * @internal */ export declare function resetBridge(): void; //# sourceMappingURL=portal-bridge.d.ts.map