export declare enum SilkeCommandType { ACTION = "/", MENTION = "@" } export type SilkeCommand = { partialMatch?: boolean; type: SilkeCommandType; value: string; }; export type SilkeTextValue = { type: 'text'; value: string; }; export type SilkeImageValue = { type: 'image'; /** Base64-encoded image data */ data: string; /** MIME type (e.g., 'image/png', 'image/jpeg') */ mimeType: string; /** Optional filename */ name?: string; }; export type SilkeFileValue = { type: 'file'; /** Base64-encoded file data */ data: string; /** MIME type (e.g., 'text/csv', 'application/vnd.ms-excel') */ mimeType: string; /** Filename */ name: string; }; export type SilkeCommandTextFieldValue = SilkeCommand | SilkeTextValue | SilkeImageValue | SilkeFileValue; /** Key direction mappings for navigation and editing */ export declare const KEY_DIRECTION: Record; /** Get the caret offset within a contentEditable element */ export declare function getCaretOffset(element: HTMLDivElement | null): number; /** Check if there is a text selection with length > 0 */ export declare function hasSelectionLength(): boolean; /** Set the caret to a specific character offset within a contentEditable element */ export declare function setCaretOffset(element: HTMLDivElement | null, offset: number): void; /** Escape HTML special characters to prevent XSS */ export declare function escapeHtml(text: string): string; /** Get the index of the command at a given caret position */ export declare function getActiveCommandIndex(caretPos: number, value: SilkeCommandTextFieldValue[]): number; /** Calculate total text length up to a given index */ export declare function getTextLength(value: SilkeCommandTextFieldValue[], index?: number): number; /** Get the rendered length of a single command/text value */ export declare function getItemLength(item: SilkeCommandTextFieldValue): number; /** Convert command values to HTML for rendering (excludes images) */ export declare function valueToHtml(value: SilkeCommandTextFieldValue[], styles: Record): string; /** Convert command values to plain string (excludes images) */ export declare function convertSilkeCommandsToString(value: SilkeCommandTextFieldValue[]): string; /** Check if a command value is a non-text, non-image command */ export declare function isSilkeCommand(value: SilkeCommandTextFieldValue | undefined): value is SilkeCommand; /** Check if a command value is a text segment */ export declare function isText(value: SilkeCommandTextFieldValue | undefined): value is SilkeTextValue; /** Check if a command value is an image */ export declare function isImage(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue; /** Check if a command value is a non-image file attachment */ export declare function isFile(value: SilkeCommandTextFieldValue | undefined): value is SilkeFileValue; /** Check if a command value is any attachment (image or file) */ export declare function isAttachment(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue | SilkeFileValue; /** * Calculate a match score for a command against a search query. * Higher scores indicate better matches. * Returns -1 if there's no match. */ export declare function getCommandMatchScore(command: SilkeCommand, query: string): number; /** * Filter and sort commands based on partial matching against a query. * Returns commands sorted by match quality (best matches first). * If query is empty, returns all commands of the given type sorted alphabetically. */ export declare function filterAndSortCommands(commands: SilkeCommand[], query: string, type: SilkeCommandType): SilkeCommand[];