/** * One subscription point for terminal size. * * Eleven components and hooks each did this by hand: * * ```ts * const { stdout } = useStdout(); * const [w, setW] = useState(stdout?.columns ?? 90); * useEffect(() => { * const handleResize = () => setW(stdout?.columns ?? 90); * handleResize(); * process.stdout.on('resize', handleResize); * return () => process.stdout.off('resize', handleResize); * }, [stdout]); * ``` * * Three problems, all of them invisible until they aren't: * * - **Listener budget.** Every copy attaches its own listener to * `process.stdout`, and nothing raises the limit. Seven of these are * mounted for the whole session (status bar, history, input, * monitor-shell, sidebar frame, viewport sync, render lifecycle); open the * fleet, mailbox and enhance panels and Node prints * `MaxListenersExceededWarning` to stderr — straight through the middle of * a rendered frame. * - **Two different streams.** They SUBSCRIBE to `process.stdout` but READ * from Ink's `useStdout()`. Those are the same object in a normal run and * different objects under Ink's test renderer, where the listener then * fires for a stream nobody reads. * - **Three defaults.** `?? 90`, `?? 80` and `?? 24` all appear, so the same * non-TTY produces different layouts in different panels. * * Core already exports `onResize(cb, stream)` for this and had no callers. * This hook is the React shape of it: subscribe to the stream you read, with * the fallback stated once per call site rather than remembered. */ export interface TerminalSize { readonly columns: number; readonly rows: number; } export interface UseTerminalSizeOptions { /** * Upper bound applied to `columns`. Panels use this to stay inside a pinned * content width — see the bordered-box overflow rule. */ readonly maxWidth?: number | undefined; /** * Column count when the stream reports none (a pipe, a test renderer). * Deliberately explicit: the call sites this replaced disagreed (90 vs 80), * and quietly picking one would have moved layouts in non-TTY runs. */ readonly fallbackColumns?: number | undefined; /** Row count when the stream reports none. */ readonly fallbackRows?: number | undefined; } export declare function useTerminalSize(options?: UseTerminalSizeOptions): TerminalSize; //# sourceMappingURL=use-terminal-size.d.ts.map