ui

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteThemePreviews

func WriteThemePreviews(output io.Writer, themes []theme.Theme, version string)

Types

type Client

type Client interface {
	LatestTopics() (discourse.JSON, error)
	ListTopics(filter, period, username string, params url.Values) (discourse.JSON, error)
	Search(query string) (discourse.JSON, error)
	Notifications(offset, limit int, filter string) (discourse.JSON, error)
	MarkNotificationRead(id int) (discourse.JSON, error)
	NotificationTotals() (discourse.JSON, error)
	Topic(id int, nearPost int) (discourse.JSON, error)
	TopicPosts(topicID int, postIDs []int, includeRaw bool) (discourse.JSON, error)
	Post(id int) (discourse.JSON, error)
	LikePost(id int) (discourse.JSON, error)
	UnlikePost(id int) (discourse.JSON, error)
	CreatePost(topicID int, raw string, replyToPostNumber int) (discourse.JSON, error)
	CreateTopic(title, raw string, category *int) (discourse.JSON, error)
	SiteInfo() (discourse.JSON, error)
	UpdateTopicReadState(topicID, postNumber, topicTimeMS int) bool
	CurrentUser() (discourse.JSON, error)
	MessageBusHeaders() http.Header
	GetURL(pathOrURL string) (discourse.JSON, error)
	GetBytes(pathOrURL string, maxBytes int) ([]byte, error)
}

type Options

type Options struct {
	BaseURL                     string
	Username                    string
	CurrentUserID               int
	NotificationChannelPosition *int
	Theme                       theme.Theme
	Themes                      []theme.Theme
	Locale                      string
	Version                     string
	EnableLiveUpdates           bool
	Input                       *os.File
	Output                      io.Writer
}

type ScreenRenderer

type ScreenRenderer struct {
	// contains filtered or unexported fields
}

ScreenRenderer prepares complete terminal frames. Bubble Tea v2 owns the actual diffing, synchronized output, cursor lifecycle, and resize repaint.

func NewScreenRenderer

func NewScreenRenderer(terminal *Terminal) *ScreenRenderer

func (*ScreenRenderer) Clear

func (r *ScreenRenderer) Clear()

func (*ScreenRenderer) Render

func (r *ScreenRenderer) Render(lines []string, width, height int, viewKey string, cursorX, cursorY int, force bool)

func (*ScreenRenderer) Reset

func (r *ScreenRenderer) Reset()

func (*ScreenRenderer) SetProgress

func (r *ScreenRenderer) SetProgress(current, total int)

type Style

type Style struct {
	Theme     theme.Theme
	ColorMode string
	// contains filtered or unexported fields
}

func NewStyle

func NewStyle(value theme.Theme, output io.Writer) *Style

func (*Style) AppHeader

func (s *Style) AppHeader(section, host, version string, lines []string, width, height int) []string

func (*Style) AppTitle

func (s *Style) AppTitle(host, version string, width, height int) []string

func (*Style) BarBox

func (s *Style) BarBox(title string, lines []string, width int) []string

func (*Style) Box

func (s *Style) Box(lines []string, width int) []string

func (*Style) HeaderBox

func (s *Style) HeaderBox(title string, lines []string, width int) []string

func (*Style) Liked

func (s *Style) Liked(value string) string

func (*Style) ProgressBox

func (s *Style) ProgressBox(title string, current, total, width int, hovered ...bool) []string

func (*Style) Selected

func (s *Style) Selected(value string) string

func (*Style) Text

func (s *Style) Text(value string, role textRole) string

type Terminal

type Terminal struct {
	In  *os.File
	Out io.Writer
	// contains filtered or unexported fields
}

func NewTerminal

func NewTerminal(in *os.File, out io.Writer) *Terminal

func (*Terminal) EnterRaw

func (t *Terminal) EnterRaw() error

func (*Terminal) Query

func (t *Terminal) Query(sequence string, accept func(any) bool, timeout time.Duration) (any, error)

func (*Terminal) Raw

func (t *Terminal) Raw(sequence string)

func (*Terminal) ReadMsg

func (t *Terminal) ReadMsg(timeout time.Duration) (tea.Msg, error)

func (*Terminal) Restore

func (t *Terminal) Restore()

func (*Terminal) Run

func (t *Terminal) Run(cmd tea.Cmd)

func (*Terminal) SetMouseEnabled

func (t *Terminal) SetMouseEnabled(enabled bool)

func (*Terminal) Size

func (t *Terminal) Size() (int, int)

type UI

type UI struct {
	// contains filtered or unexported fields
}

func New

func New(client Client, options Options) *UI

func (*UI) Run

func (u *UI) Run() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL