import { PromptInputProps } from '../interfaces'; import { EditableState } from '../tokens/use-token-mode'; import { CaretController } from './caret-controller'; import { MenuItemsHandlers, MenuItemsState } from './menu-state'; /** Configuration for the unified keyboard event handler. */ export interface KeyboardHandlerProps { editableElement: HTMLDivElement | null; editableState: EditableState; caretController: CaretController | null; tokens?: readonly PromptInputProps.InputToken[]; tokensToText?: (tokens: readonly PromptInputProps.InputToken[]) => string; disabled?: boolean; readOnly?: boolean; i18nStrings?: PromptInputProps.I18nStrings; announceTokenOperation?: (message: string) => void; getMenuOpen: () => boolean; getMenuItemsState: () => MenuItemsState | null; getMenuItemsHandlers: () => MenuItemsHandlers | null; getMenuStatusType?: () => PromptInputProps.MenuDefinition['statusType']; closeMenu: () => void; onAction?: (detail: PromptInputProps.ActionDetail) => void; onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[]; }) => void; markTokensAsSent: (tokens: readonly PromptInputProps.InputToken[]) => void; onKeyDown?: PromptInputProps['onKeyDown']; } /** Handles all keyboard events for the editable element. */ export declare function handleEditableKeyDown(event: React.KeyboardEvent, props: KeyboardHandlerProps): void; /** Splits the current paragraph at the caret position, creating a new paragraph below. */ export declare function splitParagraphAtCaret(editableElement: HTMLDivElement, caretController: CaretController | null, suppressInputEvent?: boolean): void; /** Handles Backspace/Delete when adjacent to a reference token. Returns true if handled. */ export declare function handleReferenceTokenDeletion(event: React.KeyboardEvent, isBackspace: boolean, editableElement: HTMLDivElement, state: EditableState, announceTokenOperation: ((message: string) => void) | undefined, i18nStrings: PromptInputProps.I18nStrings | undefined, caretController: CaretController | null, tokens?: readonly PromptInputProps.InputToken[], emitChange?: (newTokens: PromptInputProps.InputToken[], caretPosition: number) => void): boolean; /** Handles inline-start (backward) arrow key — plain navigation or shift+selection across references. */ export declare function handleInlineStart(event: React.KeyboardEvent, caretController: CaretController | null, announceTokenOperation?: (message: string) => void): void; /** Handles inline-end (forward) arrow key — plain navigation or shift+selection across references. */ export declare function handleInlineEnd(event: React.KeyboardEvent, caretController: CaretController | null, announceTokenOperation?: (message: string) => void): void; /** Handles space key after a closed trigger element, inserting the space outside the trigger. */ export declare function handleSpaceAfterClosedTrigger(event: React.KeyboardEvent, editableElement: HTMLDivElement, menuOpen: boolean, caretController: CaretController | null): boolean; export type MergeDirection = 'forward' | 'backward'; interface MergeParagraphsParams { direction: MergeDirection; editableElement: HTMLDivElement; tokens: readonly PromptInputProps.InputToken[]; currentParagraphIndex: number; tokensToText?: (tokens: readonly PromptInputProps.InputToken[]) => string; onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[]; }) => void; caretController?: CaretController | null; } /** Merges two adjacent paragraphs by removing the break token between them. */ export declare function mergeParagraphs(params: MergeParagraphsParams): boolean; /** Handles Backspace at the start of a paragraph by merging with the previous one. */ export declare function handleBackspaceAtParagraphStart(event: React.KeyboardEvent, editableElement: HTMLDivElement, tokens: readonly PromptInputProps.InputToken[], tokensToText: ((tokens: readonly PromptInputProps.InputToken[]) => string) | undefined, onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[]; }) => void, caretController: CaretController | null): boolean; /** Handles Delete at the end of a paragraph by merging with the next one. */ export declare function handleDeleteAtParagraphEnd(event: React.KeyboardEvent, editableElement: HTMLDivElement, tokens: readonly PromptInputProps.InputToken[], tokensToText: ((tokens: readonly PromptInputProps.InputToken[]) => string) | undefined, onChange: (detail: { value: string; tokens: PromptInputProps.InputToken[]; }) => void, caretController: CaretController | null): boolean; /** Handles copy/cut events on the contentEditable element. */ export declare function handleClipboardEvent(event: React.ClipboardEvent, editableElement: HTMLElement, isCut: boolean): void; export {};