// dashboard/theme.ts — Themed helpers for the dashboard overlay.
//
// Every visible string in the dashboard routes through these helpers or
// through theme.fg()/bg()/bold() directly. No raw glyphs or colour strings
// should appear in component render methods.
import { truncateToWidth } from "@earendil-works/pi-tui";
// ── Inline style helpers ────────────────────────────────────────────────────
export function dim(text, theme) {
    return theme.fg("dim", text);
}
export function accent(text, theme) {
    return theme.fg("accent", text);
}
export function accentBold(text, theme) {
    return theme.fg("accent", theme.bold(text));
}
export function warn(text, theme) {
    return theme.fg("warning", text);
}
export function bold(text, theme) {
    return theme.bold(text);
}
/** Border characters — themed. */
export function border(text, theme) {
    return theme.fg("border", text);
}
// ── Themed glyphs ────────────────────────────────────────────────────────────
/** Cursor glyph — accent-coloured arrow when selected, space otherwise. */
export function cursor(isSelected, theme) {
    return isSelected ? theme.fg("accent", "❯") : " ";
}
/** Collapse indicator for orchestrator nodes (▸). */
export function collapseIndicator(theme) {
    return theme.fg("muted", "▸");
}
/** Prompt expand/collapse chevron. */
export function promptExpandIcon(isExpanded, theme) {
    return isExpanded ? theme.fg("muted", "▼") : theme.fg("muted", "▶");
}
/** Status glyph for a node — themed per status colour. */
export function nodeGlyph(status, theme) {
    switch (status) {
        case "completed":
            return theme.fg("success", "✔");
        case "running":
            return theme.fg("accent", "●");
        case "cancelling":
            return theme.fg("warning", "⏳");
        case "cancelled":
            return theme.fg("muted", "⊘");
        case "failed":
            return theme.fg("error", "✗");
        case "escalated":
            return theme.fg("error", "▲");
        case "pending":
        default:
            return theme.fg("dim", "○");
    }
}
/** Human-readable status label. */
export function statusLabel(status) {
    switch (status) {
        case "completed":
            return "Completed";
        case "running":
            return "Running";
        case "cancelling":
            return "Cancelling…";
        case "cancelled":
            return "Cancelled";
        case "failed":
            return "Failed";
        case "escalated":
            return "Escalated";
        case "pending":
            return "Pending";
    }
}
/** Cancel-confirmation prompt warning glyph. */
export function cancelWarningGlyph(theme) {
    return theme.fg("warning", "⚠");
}
// ── Width safety (ANSI-aware) ────────────────────────────────────────────────
/**
 * Truncate every line to the given visible width. Applied as a final
 * safety guard in every screen renderer so no line overflows the terminal.
 */
export function truncateLines(lines, width) {
    return lines.map((line) => truncateToWidth(line, width, ""));
}
//# sourceMappingURL=theme.js.map