@bobfrankston/cmsgbox
Version:
Cross-platform dialog utility for Node.js using Python and tkinter
68 lines • 2.65 kB
TypeScript
#!/usr/bin/env node
/**
* Options for the message box dialog.
*/
export interface MessageBoxOptions {
/** The message text to display in the dialog. */
message: string;
/** The title of the dialog window. Defaults to "Message". */
title?: string;
/** Whether to show an input dialog instead of a message dialog. */
input?: boolean;
/** The default text to pre-fill in the input field (only used if input is true). */
defaultText?: string;
}
/**
* Displays a message dialog with the specified message and title.
* @param message The message text to display.
* @param title The title of the dialog window.
*/
export declare function showMessage(message: string, title?: string): Promise<void>;
/**
* Displays an input dialog and returns the user's input.
* @param message The prompt message for the input dialog.
* @param title The title of the dialog window.
* @param defaultText The default text to pre-fill in the input field.
* @returns The user's input string, or undefined if canceled.
*/
/**
* Displays an input dialog and returns the user's input.
* @param message The prompt message for the input dialog.
* @param title The title of the dialog window.
* @param defaultText The default text to pre-fill in the input field.
* @returns The user's input string, or undefined if canceled.
*/
export declare function showInput(message?: string, title?: string, defaultText?: string): Promise<string | undefined>;
/**
* Unified function to display either a message or input dialog based on options.
* @param options The options for the dialog.
* @returns For input dialogs, returns the user's input string or undefined. For message dialogs, returns undefined.
*/
export declare function messageBox(options: MessageBoxOptions): Promise<string | void>;
/**
* Class for creating message box instances (alternative API).
*/
export declare class MessageBox {
/**
* Displays a message dialog.
* @param message The message text.
* @param title The dialog title.
*/
show(message: string, title?: string): Promise<void>;
/**
* Displays an input dialog.
* @param message The prompt message.
* @param title The dialog title.
* @param defaultText The default input text.
* @returns The user's input or undefined.
*/
input(message?: string, title?: string, defaultText?: string): Promise<string | undefined>;
}
declare const _default: {
showMessage: typeof showMessage;
showInput: typeof showInput;
messageBox: typeof messageBox;
MessageBox: typeof MessageBox;
};
export default _default;
//# sourceMappingURL=index.d.ts.map