{"version":3,"file":"session-color-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/session-color-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAgC,MAAM,0BAA0B,CAAC;AAGrG,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C;;;;;;GAMG;AACH,qBAAa,6BAA8B,SAAQ,UAAU;IAC5D,OAAO,CAAC,UAAU,CAAa;IAE/B,YACC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAChC,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAqClC;IAED,aAAa,IAAI,UAAU,CAE1B;CACD","sourcesContent":["import { type SelectItem, SelectList, type SelectListLayoutOptions } from \"@kolisachint/hoocode-tui\";\nimport { SESSION_COLOR_SLOTS, sessionColorName } from \"../../../core/session-identity.js\";\nimport { getSelectListTheme } from \"../theme/theme.js\";\nimport { InputFrame } from \"./input-frame.js\";\nimport { renderSessionChip } from \"./session-chip.js\";\n\nconst COLOR_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 26,\n\tmaxPrimaryColumnWidth: 40,\n};\n\n/**\n * Picker for the session's colour slot.\n *\n * Each row *is* the chip it would produce, in the session's current name, because\n * the slots have no useful names of their own: which of six hues reads best in\n * this theme on this terminal is a thing you look at, not a thing you can be told.\n */\nexport class SessionColorSelectorComponent extends InputFrame {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\tsessionName: string,\n\t\tcurrentSlot: number,\n\t\tonSelect: (slot: number) => void,\n\t\tonCancel: () => void,\n\t\tonPreview?: (slot: number) => void,\n\t) {\n\t\tsuper({ title: \"session colour\" });\n\n\t\tconst items: SelectItem[] = [];\n\t\tfor (let slot = 1; slot <= SESSION_COLOR_SLOTS; slot++) {\n\t\t\tconst chip = renderSessionChip(sessionName, slot);\n\t\t\t// The row carries its name as well as its swatch: the name is what\n\t\t\t// `/color <name>` takes, so the picker is also where you learn it.\n\t\t\tconst name = sessionColorName(slot) ?? String(slot);\n\t\t\titems.push({\n\t\t\t\tvalue: String(slot),\n\t\t\t\tlabel: chip?.styled ?? sessionName,\n\t\t\t\tdescription: slot === currentSlot ? `${name} · current` : name,\n\t\t\t});\n\t\t}\n\n\t\tthis.selectList = new SelectList(items, items.length, getSelectListTheme(), COLOR_SELECT_LIST_LAYOUT);\n\n\t\tconst currentIndex = items.findIndex((item) => item.value === String(currentSlot));\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(Number(item.value));\n\t\t};\n\t\tthis.selectList.onCancel = () => {\n\t\t\tonCancel();\n\t\t};\n\t\tif (onPreview) {\n\t\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\t\tonPreview(Number(item.value));\n\t\t\t};\n\t\t}\n\n\t\tthis.addChild(this.selectList);\n\t}\n\n\tgetSelectList(): SelectList {\n\t\treturn this.selectList;\n\t}\n}\n"]}