/** * Loading Spinner Utilities * * Wraps ora spinner with consistent styling and error handling. */ import { Ora } from 'ora'; /** * Spinner instance type */ export type Spinner = Ora; /** * Create a new spinner with consistent styling * * @param text - Initial spinner text * @returns Spinner instance * * @example * ```typescript * const spinner = createSpinner('Loading...'); * spinner.start(); * * try { * await doAsyncWork(); * spinner.succeed('Done!'); * } catch (error) { * spinner.fail('Failed'); * } * ``` */ export declare function createSpinner(text: string): Spinner; /** * Run an async function with a spinner * * Automatically handles success/failure states. * * @param text - Spinner text while running * @param fn - Async function to run * @param successText - Text to show on success (optional) * @returns Result of the async function * * @example * ```typescript * const data = await withSpinner( * 'Fetching tickets...', * async () => await api.getTickets(), * 'Tickets loaded' * ); * ``` */ export declare function withSpinner(text: string, fn: () => Promise, successText?: string): Promise; /** * Run multiple async operations with progress * * @param operations - Array of operations with labels * @returns Array of results * * @example * ```typescript * const results = await withProgress([ * { label: 'Loading config', fn: loadConfig }, * { label: 'Fetching data', fn: fetchData }, * { label: 'Processing', fn: process }, * ]); * ``` */ export declare function withProgress(operations: Array<{ label: string; fn: () => Promise; }>): Promise; /** * Create a manual spinner for custom control * * @param text - Initial text * @returns Object with spinner control methods * * @example * ```typescript * const { start, update, succeed, fail } = manualSpinner('Loading'); * * start(); * update('Loading step 1...'); * update('Loading step 2...'); * succeed('All loaded'); * ``` */ export declare function manualSpinner(text: string): { start: () => Ora; stop: () => Ora; update: (newText: string) => void; succeed: (finalText?: string) => void; fail: (finalText?: string) => void; warn: (finalText?: string) => void; info: (finalText?: string) => void; }; /** * Check if spinners should be disabled (non-TTY) */ export declare function shouldDisableSpinner(): boolean; /** * Simple progress indicator for non-TTY environments * * @param text - Progress text */ export declare function progressLog(text: string): void; //# sourceMappingURL=spinner.d.ts.map