UNPKG

malwoden

Version:

![alt text](./coverage/badge-lines.svg) ![alt text](./coverage/badge-statements.svg) ![alt text](./coverage/badge-functions.svg) ![alt text](./coverage/badge-branches.svg)

30 lines (29 loc) 1.11 kB
import { Glyph } from "../terminal"; import { Widget, WidgetConfig } from "./widget"; export declare type RoundMode = "up" | "down" | "default"; export interface BarWidgetState { /** The width of the bar */ width: number; /** The minimum value allowed. Default 0. */ minValue?: number; /** The maximum value allowed. */ maxValue: number; /** The current value. Default 0. */ currentValue?: number; /** The mode to use for rounding. up | down | default */ roundMode?: RoundMode; /** An optional glyph to use for each filled square. Default white square. */ foreGlyph?: Glyph; /** An optional glyph to use for each empty square. Default gray. */ backGlyph?: Glyph; } export declare function getRoundedPercent(percent: number, divisor: number, round: RoundMode): number; /** * Represents a bar, like in a loading/progress indicator * or hp bar. */ export declare class BarWidget extends Widget<BarWidgetState> { state: Required<BarWidgetState>; constructor(config: WidgetConfig<BarWidgetState>); onDraw(): void; }