/** * @module prompt */ export interface InputFilterMeta { input: string; original: string; type: "line" | "char"; userAction: boolean; silent: boolean; } export declare type InputFilter = (input: string, meta: InputFilterMeta) => boolean; /** * Registers a new input filter. * * @see https://vorple-if.com/docs/filters.html#input-filters * @since 3.2.0 * * @param filter The input filter to register * @returns Returns a function that can be called to remove the filter. */ export declare function addInputFilter(filter: InputFilter): () => void; /** * Runs input through all input filters. * * @since 3.2.0 * @internal * @param originalInput The original input * @param meta Associated input meta */ export declare function applyInputFilters(originalInput: string, meta: InputFilterMeta): Promise; /** * Clear the command queue. * * @since 3.2.0 */ export declare function clearCommandQueue(): void; /** * Clear the keypress queue. * * @since 3.2.0 */ export declare function clearKeyQueue(): void; /** * Manually hide the prompt. It won't be shown until unhide() is called. */ export declare function hide(): void; /** * Haven's history API. */ export { history } from "../haven/prompt"; /** * Hook into Haven's input listeners. */ export declare function init(): void; /** * Add a command to the command queue. If the line input is ready, execute * the command immediately. * * @param cmd Command to add * @param silent If true, the command isn't shown on the screen. * The result of the command will still print normally. */ export declare function queueCommand(cmd: string, silent?: boolean): void; /** * Add a keypress to the command queue. If the engine is waiting for a keypress, * send it immediately. * * @param key A one-character string containing the pressed character * @since 3.2.0 */ export declare function queueKeypress(key: string): void; /** * Removes a filter from registered input filters. * * @param filter The filter to remove * @returns Returns true if the filter was removed, false if the filter wasn't registered. * @since 3.2.0 */ export declare function removeInputFilter(filter: InputFilter): boolean; /** * Set the prefix of the command prompt. The prefix is usually a greater-than * character (>) at the start of the command prompt. * * The currently active command prompt is changed, and the new prefix is used * for all future command prompts until changed again. * * Note that calling this function directly with JavaScript changes the prompt * in the interpreter, but doesn't pass the information to the story file. * Therefore checking what the prefix is in the Inform story might not return * correct values because the variable that the story uses to track the prefix * content hasn't been changed. In most cases it's recommended to use the Vorple * extensions/libraries in Inform to change the prefix. * * @param prefix The new prefix * @param isHtml If true, the prefix is inserted into the DOM as HTML. * Otherwise HTML is escaped and shown as-is. * * @returns Returns the new prefix. */ export declare function setPrefix(prefix: string, isHtml?: boolean): string; /** * Set the lineinput's value. * * @param value The new value */ export declare function setValue(value: string): void; /** * Trigger the submit event of the lineinput. * * @param command The command to send, if null or left out the lineinput field's current value is used. * @param silent If true, the command isn't shown on the screen. * The result of the command will still print normally. */ export declare function submit(command?: string | null, silent?: boolean): void; /** * Remove manual hiding of the prompt. It's called rather clumsily "unhide" * instead of "show" to stress that it only undoes what the [[hide]] method did, * and it doesn't force the prompt to appear if it has been hidden or removed * by some other means. */ export declare function unhide(): void;