/** * The one progress bar. Every surface that makes the user wait on measurable * work renders it through here. * * There used to be two, written months apart, and they had drifted in three * separate ways: the footer drew `▰▱` while the voice panel drew `·` over `·`, * the footer said `2.0 MB` while the voice panel said `2 MB`, and each carried * its own copy of the percent-and-detail layout. None of that is a decision * anyone made — it is just what happens when the same widget is written twice. * * Bar *width* is still the caller's, because that is a genuine property of the * surface: a footer line shares its row with other status, a panel has the room * to be finer-grained. Everything else — glyphs, colours, percent, separator, * byte formatting — is fixed here, so two bars on screen at once always agree. */ /** * Default cells in a bar. Compact enough that several stacked footer lines * still fit a narrow terminal. */ export declare const PROGRESS_BAR_CELLS = 12; /** * Megabytes, to one decimal. * * The decimal is the point: whole megabytes make a slow download look frozen * for tens of seconds at a time, which is precisely when the user is deciding * whether it has hung. */ export declare function formatMegabytes(bytes: number): string; export interface ProgressBarOptions { /** Track width. Defaults to {@link PROGRESS_BAR_CELLS}. */ cells?: number; } /** * A determinate bar: track, percent, and a trailing detail such as * `3/12 sessions` or `2.0 MB / 8.0 MB`. * * Returns a styled string with no leading or trailing space, so callers can * place it after their own label. Callers width-clamp. */ export declare function renderProgressBar(ratio: number, detail: string, options?: ProgressBarOptions): string; /** * A download's progress, determinate when the server sent a length and a * running byte count when it did not. * * The indeterminate case deliberately drops the bar rather than animating a * fake one: a moving byte count already says "still going", and a bar that * cannot reach the end is worse than no bar. */ export declare function renderDownloadProgress(receivedBytes: number, totalBytes: number | null, options?: ProgressBarOptions): string; //# sourceMappingURL=progress-bar.d.ts.map