{"version":3,"file":"selected-row-list.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/selected-row-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,0BAA0B,CAAC;AAG3E,MAAM,WAAW,aAAa;IAC7B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAChD,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,YAAY,IAAI,GAAE,aAAa,EAAO,EAAE,OAAO,GAAE,MAAU,EAG1D;IAED,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAEnC;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAM9B;CACD","sourcesContent":["import { type Component, truncateToWidth } from \"@kolisachint/hoocode-tui\";\nimport { paintSelectedRow } from \"../theme/theme.js\";\n\nexport interface SelectableRow {\n\t/** The row's already-styled content, without any left margin. */\n\ttext: string;\n\tselected?: boolean;\n}\n\n/**\n * A block of picker rows rendered at terminal width, so the selected one can be\n * filled edge to edge.\n *\n * Pickers used to add one `Text` child per row from an update method that never\n * sees the width — width only arrives later, when the container renders each\n * child — which left no point at which a row could be padded before being\n * painted. Holding the rows and rendering them lazily puts the width back in\n * reach.\n *\n * The left margin is part of the row rather than component padding, so the\n * highlight starts at column 0 like the session picker's does.\n */\nexport class SelectedRowList implements Component {\n\tprivate rows: SelectableRow[];\n\tprivate readonly marginX: number;\n\n\tconstructor(rows: SelectableRow[] = [], marginX: number = 0) {\n\t\tthis.rows = rows;\n\t\tthis.marginX = marginX;\n\t}\n\n\tsetRows(rows: SelectableRow[]): void {\n\t\tthis.rows = rows;\n\t}\n\n\tinvalidate(): void {\n\t\t// No cached state to invalidate currently\n\t}\n\n\trender(width: number): string[] {\n\t\tconst margin = \" \".repeat(this.marginX);\n\t\treturn this.rows.map((row) => {\n\t\t\tconst line = truncateToWidth(margin + row.text, width);\n\t\t\treturn row.selected ? paintSelectedRow(line, width) : line;\n\t\t});\n\t}\n}\n"]}