(t0)
| 15 | emptyMessage?: string; |
| 16 | }; |
| 17 | export function Commands(t0) { |
| 18 | const $ = _c(14); |
| 19 | const { |
| 20 | commands, |
| 21 | maxHeight, |
| 22 | columns, |
| 23 | title, |
| 24 | onCancel, |
| 25 | emptyMessage |
| 26 | } = t0; |
| 27 | const { |
| 28 | headerFocused, |
| 29 | focusHeader |
| 30 | } = useTabHeaderFocus(); |
| 31 | const maxWidth = Math.max(1, columns - 10); |
| 32 | const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2)); |
| 33 | let t1; |
| 34 | if ($[0] !== commands || $[1] !== maxWidth) { |
| 35 | const seen = new Set(); |
| 36 | let t2; |
| 37 | if ($[3] !== maxWidth) { |
| 38 | t2 = cmd_0 => ({ |
| 39 | label: `/${cmd_0.name}`, |
| 40 | value: cmd_0.name, |
| 41 | description: truncate(formatDescriptionWithSource(cmd_0), maxWidth, true) |
| 42 | }); |
| 43 | $[3] = maxWidth; |
| 44 | $[4] = t2; |
| 45 | } else { |
| 46 | t2 = $[4]; |
| 47 | } |
| 48 | t1 = commands.filter(cmd => { |
| 49 | if (seen.has(cmd.name)) { |
| 50 | return false; |
| 51 | } |
| 52 | seen.add(cmd.name); |
| 53 | return true; |
| 54 | }).sort(_temp).map(t2); |
| 55 | $[0] = commands; |
| 56 | $[1] = maxWidth; |
| 57 | $[2] = t1; |
| 58 | } else { |
| 59 | t1 = $[2]; |
| 60 | } |
| 61 | const options = t1; |
| 62 | let t2; |
| 63 | if ($[5] !== commands.length || $[6] !== emptyMessage || $[7] !== focusHeader || $[8] !== headerFocused || $[9] !== onCancel || $[10] !== options || $[11] !== title || $[12] !== visibleCount) { |
| 64 | t2 = <Box flexDirection="column" paddingY={1}>{commands.length === 0 && emptyMessage ? <Text dimColor={true}>{emptyMessage}</Text> : <><Text>{title}</Text><Box marginTop={1}><Select options={options} visibleOptionCount={visibleCount} onCancel={onCancel} disableSelection={true} hideIndexes={true} layout="compact-vertical" onUpFromFirstItem={focusHeader} isDisabled={headerFocused} /></Box></>}</Box>; |
| 65 | $[5] = commands.length; |
| 66 | $[6] = emptyMessage; |
| 67 | $[7] = focusHeader; |
| 68 | $[8] = headerFocused; |
| 69 | $[9] = onCancel; |
| 70 | $[10] = options; |
| 71 | $[11] = title; |
| 72 | $[12] = visibleCount; |
| 73 | $[13] = t2; |
| 74 | } else { |
nothing calls this directly
no test coverage detected