{"version":3,"file":"todo-list.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/todo-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,wBAAwB,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CACf;AAOD;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAClD,OAAO,CAAC,KAAK,CAAwB;IAErC,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAEpC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA4D9B;IAED,UAAU,IAAI,IAAI,CAEjB;CACD;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import { type Component, truncateToWidth } from \"@apholdings/jensen-tui\";\nimport { theme } from \"../theme/theme.js\";\n\n/**\n * Todo item as emitted in the todo_update event.\n */\nexport interface TodoUpdateItem {\n\tcontent: string;\n\tactiveForm: string;\n\tstatus: string;\n}\n\n/**\n * Compact threshold for showing expandable details vs just the status line.\n */\nconst EXPAND_THRESHOLD = 80;\n\n/**\n * Component that renders the todo list as a compact status bar.\n * Shows a summary line and optional expandable task details.\n */\nexport class TodoListComponent implements Component {\n\tprivate todos: TodoUpdateItem[] = [];\n\n\tupdate(todos: TodoUpdateItem[]): void {\n\t\tthis.todos = todos;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.todos.length === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst completed = this.todos.filter((t) => t.status === \"completed\").length;\n\t\tconst inProgress = this.todos.find((t) => t.status === \"in_progress\");\n\t\tconst total = this.todos.length;\n\n\t\t// Build the status line\n\t\tconst statusParts: string[] = [];\n\t\tstatusParts.push(theme.fg(\"muted\", \"Tasks:\"));\n\t\tstatusParts.push(`${completed}/${total}`);\n\t\tstatusParts.push(theme.fg(\"success\", \"done\"));\n\n\t\tif (inProgress) {\n\t\t\tstatusParts.push(theme.fg(\"muted\", \"|\"));\n\t\t\tstatusParts.push(theme.fg(\"muted\", \"Working:\"));\n\t\t\tstatusParts.push(theme.fg(\"warning\", truncateToWidth(inProgress.activeForm, 40)));\n\t\t}\n\n\t\tconst statusLine = statusParts.join(\" \");\n\n\t\t// If narrow width, just show the status line\n\t\tif (width < EXPAND_THRESHOLD) {\n\t\t\treturn [truncateToWidth(statusLine, width)];\n\t\t}\n\n\t\t// Show status line plus one line per task\n\t\tconst lines: string[] = [statusLine];\n\n\t\t// Render each task\n\t\tfor (const todo of this.todos) {\n\t\t\tlet icon: string;\n\t\t\tlet text: string;\n\t\t\tlet colorFn: (text: string) => string;\n\n\t\t\tswitch (todo.status) {\n\t\t\t\tcase \"completed\":\n\t\t\t\t\ticon = theme.fg(\"success\", \"✓\");\n\t\t\t\t\ttext = todo.content;\n\t\t\t\t\tcolorFn = (t) => theme.fg(\"dim\", t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"in_progress\":\n\t\t\t\t\ticon = theme.fg(\"warning\", \"◉\");\n\t\t\t\t\ttext = todo.activeForm;\n\t\t\t\t\tcolorFn = (t) => theme.fg(\"warning\", theme.bold(t));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\ticon = theme.fg(\"muted\", \"○\");\n\t\t\t\t\ttext = todo.content;\n\t\t\t\t\tcolorFn = (t) => theme.fg(\"text\", t);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst taskLine = `  ${icon} ${colorFn(text)}`;\n\t\t\tlines.push(truncateToWidth(taskLine, width));\n\t\t}\n\n\t\treturn lines;\n\t}\n\n\tinvalidate(): void {\n\t\t// No-op: we don't cache anything\n\t}\n}\n\nexport default TodoListComponent;\n"]}