/* auto-generated by NAPI-RS */ /* eslint-disable */ /** Add child to parent node. */ export declare function addLayoutChild(parent: number, child: number): void /** Clear layout engine. */ export declare function clearLayout(): void /** Clear a rectangular area. */ export declare function clearRect(x: number, y: number, width: number, height: number): void /** Clear the screen. */ export declare function clearScreen(): void /** Compute layout. */ export declare function computeLayout(width: number, height: number): void /** Create a new leaf layout node with measured size. */ export declare function createLayoutLeaf(width: number, height: number, style?: FlexStyleNapi | undefined | null): number /** Create a new layout node. */ export declare function createLayoutNode(style?: FlexStyleNapi | undefined | null): number /** Disable IME. */ export declare function disableIme(): boolean /** Enable IME. */ export declare function enableIme(): boolean /** Fill a rectangle with a character. */ export declare function fillRect(x: number, y: number, width: number, height: number, char?: string | undefined | null, style?: StyleNapi | undefined | null): void /** * Flex style options for NAPI. * NAPI automatically converts JavaScript camelCase to Rust snake_case. */ export interface FlexStyleNapi { display?: string position?: string top?: string right?: string bottom?: string left?: string overflow?: string overflowX?: string overflowY?: string flexDirection?: string flexWrap?: string justifyContent?: string alignItems?: string alignSelf?: string alignContent?: string flexGrow?: number flexShrink?: number flexBasis?: string width?: string height?: string minWidth?: string minHeight?: string maxWidth?: string maxHeight?: string aspectRatio?: number padding?: number paddingTop?: number paddingRight?: number paddingBottom?: number paddingLeft?: number margin?: number marginTop?: number marginRight?: number marginBottom?: number marginLeft?: number gap?: number columnGap?: number rowGap?: number } /** Flush the terminal buffer. */ export declare function flushTerminal(): void /** Flush the terminal buffer and return exact presentation telemetry. */ export declare function flushTerminalMeasured(): FrameOutputTelemetryNapi /** Exact output cost of one NAPI-driven terminal frame. */ export interface FrameOutputTelemetryNapi { /** Cells differing from the previous frame, including wide continuations. */ changedCells: bigint /** Bytes accepted by the configured terminal writer. */ bytesWritten: bigint } /** Get all layout results. */ export declare function getAllLayouts(): Array /** Get current IME state. */ export declare function getImeState(): ImeStateNapi /** Get layout results from the most recent renderTree call. */ export declare function getLastRenderLayouts(): Array /** Get layout result for a node. */ export declare function getLayout(id: number): LayoutResultNapi | null /** * Resolve the complete standard-output capability profile. * * Size discovery falls back to positive `COLUMNS` and `LINES` values, then * 80x24. The result therefore remains available for redirected output. */ export declare function getTerminalInfo(): TerminalInfoNapi /** Hide cursor. */ export declare function hideCursor(): void /** IME state for NAPI. */ export interface ImeStateNapi { /** Whether IME is active */ active: boolean /** Current input mode */ mode: string /** Whether currently composing */ composing: boolean /** Preedit text */ preedit?: string /** Cursor position in preedit */ preeditCursor?: number /** Candidate list */ candidates?: Array /** Selected candidate index */ selected?: number } /** Initialize layout engine. */ export declare function initLayout(): void /** Initialize terminal for TUI mode. */ export declare function initTerminal(): void /** Initialize terminal with mouse capture. */ export declare function initTerminalWithMouse(): void /** Initialize terminal with explicit TUI mode options. */ export declare function initTerminalWithOptions(options: TerminalOptionsNapi): void /** Input event for NAPI. */ export interface InputEventNapi { /** Event type: "key" | "mouse" | "resize" | "focus" | "paste" */ eventType: "key" | "mouse" | "resize" | "focus" | "paste" | (string & {}) /** Key code (for key events) */ key?: string /** Character (for key events) */ char?: string /** Key event type: "press" | "repeat" | "release" */ keyEventType?: string /** Modifiers: { ctrl, alt, shift, meta } */ modifiers?: ModifiersNapi /** Mouse button (for mouse events) */ button?: string /** Mouse x position */ x?: number /** Mouse y position */ y?: number /** New width (for resize events) */ width?: number /** New height (for resize events) */ height?: number /** Pasted text (for paste events) */ text?: string /** Cursor position (for composition events) */ cursor?: number } /** Layout result for NAPI. */ export interface LayoutResultNapi { /** Node ID */ id: number /** X position */ x: number /** Y position */ y: number /** Width */ width: number /** Height */ height: number } /** Key modifiers for NAPI. */ export interface ModifiersNapi { ctrl: boolean alt: boolean shift: boolean meta: boolean super: boolean hyper: boolean capsLock: boolean numLock: boolean } /** * Poll for input events. * * Returns an event if available within the timeout, or null if no event. */ export declare function pollEvent(timeoutMs: number): InputEventNapi | null /** Poll for input events without blocking. */ export declare function pollEventNonBlocking(): InputEventNapi | null /** Read an input event, blocking until one is available. */ export declare function readEvent(): InputEventNapi /** Remove child from parent node. */ export declare function removeLayoutChild(parent: number, child: number): void /** Remove a node. */ export declare function removeLayoutNode(id: number): void /** Render a box (rectangle). */ export declare function renderBox(x: number, y: number, width: number, height: number, border?: string | undefined | null, style?: StyleNapi | undefined | null): void /** Render node for NAPI. */ export interface RenderNodeNapi { /** Node ID */ id: number /** Node type accepted by the native renderer. */ nodeType: "root" | "box" | "text" | "input" /** Text content (for text nodes) */ text?: string /** Whether text should wrap */ wrap?: boolean /** Ink-compatible text wrapping/truncation mode */ wrapMode?: string /** Input value (for input nodes) */ value?: string /** Placeholder text (for input nodes) */ placeholder?: string /** Whether input is focused */ focused?: boolean /** Cursor position in input */ cursor?: number /** Whether to mask input (password) */ mask?: boolean /** Mask character */ maskChar?: string /** Flex style */ style?: FlexStyleNapi /** Visual appearance */ appearance?: StyleNapi /** Border style: "none" | "single" | "double" | "rounded" | "heavy" */ border?: string /** Child node IDs */ children?: Array } /** Render text at position. */ export declare function renderText(x: number, y: number, text: string, style?: StyleNapi | undefined | null): void /** Render a tree of nodes. */ export declare function renderTree(nodes: Array): void /** Restore terminal to normal mode. */ export declare function restoreTerminal(): void /** Set cursor position. */ export declare function setCursor(x: number, y: number): void /** Set cursor shape. */ export declare function setCursorShape(shape: "block" | "underline" | "bar" | (string & {})): void /** Set IME input mode. */ export declare function setImeMode(mode: string): void /** Set layout root node. */ export declare function setLayoutRoot(id: number): void /** Update node style. */ export declare function setLayoutStyle(id: number, style: FlexStyleNapi): void /** Show cursor. */ export declare function showCursor(): void /** Style options for NAPI. */ export interface StyleNapi { /** Foreground color (hex or named) */ fg?: string /** Background color (hex or named) */ bg?: string /** Bold text */ bold?: boolean /** Dim text */ dim?: boolean /** Italic text */ italic?: boolean /** Underline text */ underline?: boolean /** Inverse background/foreground */ inverse?: boolean /** Blinking text */ blink?: boolean /** Hidden text */ hidden?: boolean /** Strikethrough text */ strikethrough?: boolean } /** Sync terminal size (call after resize events). */ export declare function syncTerminalSize(): boolean /** Terminal info for NAPI. */ export interface TerminalInfoNapi { /** Terminal width in columns */ width: number /** Terminal height in rows */ height: number /** Whether colors are supported */ colors: boolean /** Whether true color (24-bit) is supported */ trueColor: boolean /** Maximum color depth: monochrome, ansi-16, ansi-256, or true-color */ colorDepth: string /** Stable explanation for the selected color depth */ colorReason: string /** Whether Unicode presentation is enabled */ unicode: boolean /** Stable explanation for Unicode or ASCII presentation */ unicodeReason: string /** Whether interactive terminal modes are safe */ interactive: boolean /** Stable explanation for interactive-mode selection */ interactiveReason: string /** Whether standard output is redirected */ redirected: boolean /** Whether the current viewport selects the narrow layout */ narrow: boolean /** Width below which the narrow layout is selected */ narrowWidth: number } /** Terminal initialization options for NAPI. */ export interface TerminalOptionsNapi { /** Enable raw mode */ rawMode?: boolean /** Enable the alternate screen buffer */ alternateScreen?: boolean /** Enable mouse capture */ mouse?: boolean /** Enable bracketed paste mode */ bracketedPaste?: boolean /** Hide the terminal cursor */ hideCursor?: boolean }