src/UI/Frame.ps1
|
# Frame — Window chrome del TUI (TuiFrame del diseño). # Title bar con "traffic lights" minimalistas + brand + meta a la derecha. class Frame { [object] $Theme # ThemeService [object] $Renderer # Renderer Frame($theme, $renderer) { $this.Theme = $theme $this.Renderer = $renderer } # Devuelve el string completo del titlebar para el ancho actual. # No traffic lights: estamos DENTRO de una terminal, esos íconos serían decoración pura. # NO aplicamos bg explícito — respetamos el fondo del terminal del user. # Antes el ${reset} adentro del brand rompía el ${bg} aplicado al inicio, # haciendo que solo "repo" quedara con un fondo distinto al resto. [string] TitleBar([string]$title, [string]$meta, [string]$version) { $reset = [AnsiService]::Reset $fg3 = $this.Theme.Fg('fg3') $fg0 = $this.Theme.Fg('fg0') $acc = $this.Theme.Fg('acc') $brand = "${acc}repo${reset}${fg0}—${reset}${acc}nav${reset}" if ($version) { $brand += " ${fg3}v${version}${reset}" } $left = " $brand ${fg3}— ${title}${reset}" $right = "${fg3}${meta}${reset}" $width = $this.Renderer.Width() $leftLen = [Renderer]::VisibleLength($left) $rightLen = [Renderer]::VisibleLength($right) $padCount = [Math]::Max(1, $width - $leftLen - $rightLen) $pad = ' ' * $padCount return "${left}${pad}${right}" } } |