{"version":3,"file":"theme-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/theme-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,UAAU,EAAgC,MAAM,wBAAwB,CAAC;AAS9G;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAA8B;IAE/C,YACC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EACrC,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EAyCtC;IAED,aAAa,IAAI,UAAU,CAE1B;CACD","sourcesContent":["import { Container, type SelectItem, SelectList, type SelectListLayoutOptions } from \"@earendil-works/pi-tui\";\nimport { getAvailableThemes, getSelectListTheme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\n\nconst THEME_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\n\n/**\n * Component that renders a theme selector\n */\nexport class ThemeSelectorComponent extends Container {\n\tprivate selectList: SelectList;\n\tprivate onPreview: (themeName: string) => void;\n\n\tconstructor(\n\t\tcurrentTheme: string,\n\t\tonSelect: (themeName: string) => void,\n\t\tonCancel: () => void,\n\t\tonPreview: (themeName: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.onPreview = onPreview;\n\n\t\t// Get available themes and create select items\n\t\tconst themes = getAvailableThemes();\n\t\tconst themeItems: SelectItem[] = themes.map((name) => ({\n\t\t\tvalue: name,\n\t\t\tlabel: name,\n\t\t\tdescription: name === currentTheme ? \"(current)\" : undefined,\n\t\t}));\n\n\t\t// Add top border\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Create selector\n\t\tthis.selectList = new SelectList(themeItems, 10, getSelectListTheme(), THEME_SELECT_LIST_LAYOUT);\n\n\t\t// Preselect current theme\n\t\tconst currentIndex = themes.indexOf(currentTheme);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\n\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\tthis.onPreview(item.value);\n\t\t};\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Add bottom border\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}