Skip to content

vito/tuist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

235 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

A high-performance TUI framework for Go.

go get github.com/vito/tuist@latest

demos

# interactive selector
$ go run github.com/vito/tuist/demos@latest

# or run one directly
$ go run github.com/vito/tuist/demos@latest keygen   # mandelbrot fractal, inline editors
$ go run github.com/vito/tuist/demos@latest grid     # mouse hover/click grid, keyboard nav
$ go run github.com/vito/tuist/demos@latest logs     # scrollback stress test, overlays, spinner

the idea

  • Everything is a component, embedding tui.Compo
  • Components have lifecycle hooks (OnMount, OnDismount)
  • Components can be hovered and focused (SetHovered, SetFocused)
  • Components are fully interactive (HandleKeyPress, HandlePaste, HandleMouse)
  • Components render to lines of text and can optionally control the cursor position
  • Component renders are cached, and only re-render when Compo.Update is called
  • Output is diffed against previous frame and only changed lines are repainted
  • If content changes off-screen, a full (synchronized) repaint is required (trade-off)

inspiration

  • Go-app - component system, lifecycle hooks, UI goroutine model
  • pi-tui - the approach for repaintable scrollback; this project started as a straight-up conversion.
  • BubbleZone - for the mouse region markers trick
  • Bubbletea - a great TUI framework, I just needed a different model. This project leverages various components from its ecosystem (Lipgloss, Ultraviolet).

ai usage

Used LLMs heavily. It wrote the commits, I write the docs.

About

Component-based line-diffing TUI framework

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors