{"version":3,"names":["Show","ProgressBar","props","width","value","Math","max","min","filled","round","color","fullChar","repeat","trackColor","emptyChar","showPercent"],"sources":["progress-bar.tsx"],"sourcesContent":["import type { ColorInput } from \"bun\";\nimport { Show } from \"solid-js\";\n\nexport type ProgressBarProps = {\n\t/** Progress fraction, 0–1. Clamped to that range. */\n\tvalue: number;\n\t/** Total width of the bar in cells. Default 20. */\n\twidth?: number;\n\t/** Color of the filled portion. Default `#d77757`. */\n\tcolor?: ColorInput;\n\t/** Color of the unfilled track. Default `#444`. */\n\ttrackColor?: ColorInput;\n\t/** Glyph for filled cells. Default `█`. */\n\tfullChar?: string;\n\t/** Glyph for empty cells. Default `░`. */\n\temptyChar?: string;\n\t/** Append a ` 42%` label after the bar. Default false. */\n\tshowPercent?: boolean;\n};\n\n/**\n * A determinate progress bar: a filled run of `fullChar` over a track of\n * `emptyChar`, sized to `width` cells. `value` is a 0–1 fraction (clamped).\n *\n * ```tsx\n * <ProgressBar value={done() / total} width={30} showPercent />\n * ```\n *\n * `value` is a plain reactive prop, so animating it (e.g. from a signal) repaints\n * the bar each frame. For an indeterminate \"busy\" state, use `<Spinner>` instead.\n */\nexport function ProgressBar(props: ProgressBarProps) {\n\tconst width = () => props.width ?? 20;\n\tconst value = () => Math.max(0, Math.min(1, props.value));\n\tconst filled = () => Math.round(value() * width());\n\n\treturn (\n\t\t<box flexDirection=\"row\">\n\t\t\t<text color={props.color ?? \"#d77757\"}>\n\t\t\t\t{(props.fullChar ?? \"█\").repeat(filled())}\n\t\t\t</text>\n\t\t\t<text color={props.trackColor ?? \"#444\"}>\n\t\t\t\t{(props.emptyChar ?? \"░\").repeat(width() - filled())}\n\t\t\t</text>\n\t\t\t<Show when={props.showPercent}>\n\t\t\t\t<text dim>{` ${Math.round(value() * 100)}%`}</text>\n\t\t\t</Show>\n\t\t</box>\n\t);\n}\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,UAAU;AAmB/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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