/** * Terminal pane manager hook. * * Tracks reactive pane state (count, active pane) from ResttyTerminal * lifecycle callbacks. Works from OUTSIDE ResttyTerminal via ref + callback * handlers — unlike `useResttyPanes` which requires ResttyProvider context * from inside the component tree. * * @module @mks2508/mks-ui/react/blocks/Terminal/hooks/useTerminalPaneManager * * @example * ```tsx * const resttyRef = useRef(null); * const panes = useTerminalPaneManager({ ref: resttyRef }); * * * {panes.paneCount} panes * * ``` */ import type { IResttyTerminalRef, ResttyPaneSplitDirection } from '../restty/ResttyTerminal.types'; /** * Options for useTerminalPaneManager. */ export interface IUseTerminalPaneManagerOptions { /** Restty terminal ref for imperative pane operations. */ ref: React.RefObject; /** Called when a new pane is created. */ onPaneCreated?: (paneId: number) => void; /** Called when a pane is closed. */ onPaneClosed?: (paneId: number) => void; /** Called when a pane is split. */ onPaneSplit?: (sourceId: number, createdId: number, direction: string) => void; /** Called when the active pane changes. */ onActivePaneChange?: (paneId: number | null) => void; } /** * Return type for useTerminalPaneManager. */ export interface IUseTerminalPaneManagerReturn { /** Current number of panes. */ paneCount: number; /** Active pane ID (null if no panes). */ activePaneId: number | null; /** Split the active pane in the given direction. */ splitActive: (direction: 'horizontal' | 'vertical') => void; /** Split a specific pane by ID. */ splitPane: (paneId: number, direction: 'horizontal' | 'vertical') => void; /** Close a specific pane by ID. */ closePane: (paneId: number) => void; /** Set the active pane by ID. */ setActivePane: (paneId: number) => void; /** Handlers to spread onto ResttyTerminal props. */ handlers: { onPaneCreated: (paneId: number) => void; onPaneClosed: (paneId: number) => void; onPaneSplit: (sourceId: number, createdId: number, direction: ResttyPaneSplitDirection) => void; onActivePaneChange: (paneId: number | null) => void; }; } /** * Terminal pane manager. * * Provides reactive pane state and imperative pane operations for * ResttyTerminal. State is tracked via lifecycle callback handlers * that consumers spread onto the terminal component. * * For xterm.js (which doesn't support panes), this hook returns * `paneCount: 1` and no-ops for all split/close operations. * * @param options - Pane manager configuration * @returns Pane state, operations, and callback handlers * * @example * ```tsx * const panes = useTerminalPaneManager({ ref: resttyRef }); * * // Wire up callbacks * * * // Control panes * * * {panes.paneCount} pane{panes.paneCount !== 1 ? 's' : ''} * ``` */ export declare function useTerminalPaneManager(options: IUseTerminalPaneManagerOptions): IUseTerminalPaneManagerReturn; //# sourceMappingURL=useTerminalPaneManager.d.ts.map