(t0)
| 64 | * <Divider title="3 new messages" /> |
| 65 | */ |
| 66 | export function Divider(t0) { |
| 67 | const $ = _c(21); |
| 68 | const { |
| 69 | width, |
| 70 | color, |
| 71 | char: t1, |
| 72 | padding: t2, |
| 73 | title |
| 74 | } = t0; |
| 75 | const char = t1 === undefined ? "\u2500" : t1; |
| 76 | const padding = t2 === undefined ? 0 : t2; |
| 77 | const { |
| 78 | columns: terminalWidth |
| 79 | } = useTerminalSize(); |
| 80 | const effectiveWidth = Math.max(0, (width ?? terminalWidth) - padding); |
| 81 | if (title) { |
| 82 | const titleWidth = stringWidth(title) + 2; |
| 83 | const sideWidth = Math.max(0, effectiveWidth - titleWidth); |
| 84 | const leftWidth = Math.floor(sideWidth / 2); |
| 85 | const rightWidth = sideWidth - leftWidth; |
| 86 | const t3 = !color; |
| 87 | let t4; |
| 88 | if ($[0] !== char || $[1] !== leftWidth) { |
| 89 | t4 = char.repeat(leftWidth); |
| 90 | $[0] = char; |
| 91 | $[1] = leftWidth; |
| 92 | $[2] = t4; |
| 93 | } else { |
| 94 | t4 = $[2]; |
| 95 | } |
| 96 | let t5; |
| 97 | if ($[3] !== title) { |
| 98 | t5 = <Text dimColor={true}><Ansi>{title}</Ansi></Text>; |
| 99 | $[3] = title; |
| 100 | $[4] = t5; |
| 101 | } else { |
| 102 | t5 = $[4]; |
| 103 | } |
| 104 | let t6; |
| 105 | if ($[5] !== char || $[6] !== rightWidth) { |
| 106 | t6 = char.repeat(rightWidth); |
| 107 | $[5] = char; |
| 108 | $[6] = rightWidth; |
| 109 | $[7] = t6; |
| 110 | } else { |
| 111 | t6 = $[7]; |
| 112 | } |
| 113 | let t7; |
| 114 | if ($[8] !== color || $[9] !== t3 || $[10] !== t4 || $[11] !== t5 || $[12] !== t6) { |
| 115 | t7 = <Text color={color} dimColor={t3}>{t4}{" "}{t5}{" "}{t6}</Text>; |
| 116 | $[8] = color; |
| 117 | $[9] = t3; |
| 118 | $[10] = t4; |
| 119 | $[11] = t5; |
| 120 | $[12] = t6; |
| 121 | $[13] = t7; |
| 122 | } else { |
| 123 | t7 = $[13]; |
nothing calls this directly
no test coverage detected