tui

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DialogBoxStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(lipgloss.Color("#25A065")).
					Padding(1, 0).
					BorderTop(true).
					BorderLeft(true).
					BorderRight(true).
					BorderBottom(true)

	HelpStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))
	SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).Bold(true)
	InfoStyle    = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).Bold(true)

	H1Style = lipgloss.NewStyle().
			Foreground(lipgloss.Color("42")).
			Bold(true).
			Align(lipgloss.Center)

	H2Style = lipgloss.NewStyle().
			Foreground(lipgloss.Color("42")).
			Bold(false).
			Align(lipgloss.Center)

	BodyStyle = lipgloss.NewStyle().
				Bold(true) // A bit bold
)
View Source
var DocStyle = lipgloss.NewStyle().Margin(1, 2)

Functions

This section is empty.

Types

type AccountAddedMsg added in v0.8.0

type AccountAddedMsg struct {
	AccountID string
	Err       error
}

AccountAddedMsg signals that an account was successfully added.

type AccountDeletedMsg added in v0.8.0

type AccountDeletedMsg struct {
	AccountID string
	Err       error
}

AccountDeletedMsg signals that an account was successfully deleted.

type AccountTab added in v0.8.0

type AccountTab struct {
	ID    string
	Label string
	Email string
}

AccountTab represents a tab for an account

type AddAccountMsg added in v0.8.0

type AddAccountMsg struct {
	Credentials Credentials
}

AddAccountMsg signals that a new account should be added.

type AllEmailsFetchedMsg added in v0.8.0

type AllEmailsFetchedMsg struct {
	EmailsByAccount map[string][]fetcher.Email
	Mailbox         MailboxKind
}

AllEmailsFetchedMsg signals that emails from all accounts have been fetched.

type ArchiveEmailMsg

type ArchiveEmailMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

type AttachmentDownloadedMsg

type AttachmentDownloadedMsg struct {
	Path string
	Err  error
}

type BackToInboxMsg

type BackToInboxMsg struct{}

type BackToMailboxMsg added in v0.10.0

type BackToMailboxMsg struct {
	Mailbox MailboxKind
}

type CachedEmailsLoadedMsg added in v0.8.0

type CachedEmailsLoadedMsg struct {
	Cache *config.EmailCache
}

CachedEmailsLoadedMsg signals that cached emails were loaded from disk.

type CancelFilePickerMsg

type CancelFilePickerMsg struct{}

type Choice

type Choice struct {
	UpdateAvailable bool
	LatestVersion   string
	CurrentVersion  string
	// contains filtered or unexported fields
}

func NewChoice

func NewChoice() Choice

func (Choice) Init

func (m Choice) Init() tea.Cmd

func (Choice) Update

func (m Choice) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Choice) View

func (m Choice) View() string

type ChooseServiceMsg

type ChooseServiceMsg struct {
	Service string
}

type ClearStatusMsg

type ClearStatusMsg struct{}

type Composer

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

Composer model holds the state of the email composition UI.

func NewComposer

func NewComposer(from, to, subject, body string) *Composer

NewComposer initializes a new composer model.

func NewComposerFromDraft added in v0.8.0

func NewComposerFromDraft(draft config.Draft, accounts []config.Account) *Composer

NewComposerFromDraft creates a composer from an existing draft.

func NewComposerWithAccounts added in v0.8.0

func NewComposerWithAccounts(accounts []config.Account, selectedAccountID string, to, subject, body string) *Composer

NewComposerWithAccounts initializes a composer with multiple account support.

func (*Composer) GetAttachmentPath added in v0.8.0

func (m *Composer) GetAttachmentPath() string

GetAttachmentPath returns the current attachment path.

func (*Composer) GetBody added in v0.8.0

func (m *Composer) GetBody() string

GetBody returns the current Body field value.

func (*Composer) GetDraftID added in v0.8.0

func (m *Composer) GetDraftID() string

GetDraftID returns the draft ID for this composer.

func (*Composer) GetInReplyTo added in v0.8.0

func (m *Composer) GetInReplyTo() string

GetInReplyTo returns the In-Reply-To header value.

func (*Composer) GetReferences added in v0.8.0

func (m *Composer) GetReferences() []string

GetReferences returns the References header values.

func (*Composer) GetSelectedAccountID added in v0.8.0

func (m *Composer) GetSelectedAccountID() string

GetSelectedAccountID returns the ID of the currently selected account.

func (*Composer) GetSubject added in v0.8.0

func (m *Composer) GetSubject() string

GetSubject returns the current Subject field value.

func (*Composer) GetTo added in v0.8.0

func (m *Composer) GetTo() string

GetTo returns the current To field value.

func (*Composer) Init

func (m *Composer) Init() tea.Cmd

func (*Composer) ResetConfirmation

func (m *Composer) ResetConfirmation()

ResetConfirmation ensures a restored draft isn't stuck in the exit prompt.

func (*Composer) SetAccounts added in v0.8.0

func (m *Composer) SetAccounts(accounts []config.Account)

SetAccounts sets the available accounts for sending.

func (*Composer) SetDraftID added in v0.8.0

func (m *Composer) SetDraftID(id string)

SetDraftID sets the draft ID (for loading existing drafts).

func (*Composer) SetReplyContext added in v0.8.0

func (m *Composer) SetReplyContext(inReplyTo string, references []string)

SetReplyContext sets the reply context for the draft.

func (*Composer) SetSelectedAccount added in v0.8.0

func (m *Composer) SetSelectedAccount(accountID string)

SetSelectedAccount sets the selected account by ID.

func (*Composer) ToDraft added in v0.8.0

func (m *Composer) ToDraft() config.Draft

ToDraft converts the composer state to a Draft for saving.

func (*Composer) Update

func (m *Composer) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Composer) View

func (m *Composer) View() string

type Credentials

type Credentials struct {
	Provider   string
	Name       string
	Host       string // Host (this was the previous \"Email Address\" field in the UI)
	FetchEmail string // Single email address to fetch messages for. If empty, code should default this to Host when creating the account.
	Password   string
	IMAPServer string
	IMAPPort   int
	SMTPServer string
	SMTPPort   int
}

type DeleteAccountMsg added in v0.8.0

type DeleteAccountMsg struct {
	AccountID string
}

DeleteAccountMsg signals that an account should be deleted.

type DeleteEmailMsg

type DeleteEmailMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

type DeleteSavedDraftMsg added in v0.8.0

type DeleteSavedDraftMsg struct {
	DraftID string
}

DeleteDraftMsg signals that a draft should be deleted.

type DiscardDraftMsg

type DiscardDraftMsg struct {
	ComposerState *Composer
}

DiscardDraftMsg signals that a draft should be cached.

type DownloadAttachmentMsg

type DownloadAttachmentMsg struct {
	Index     int
	Filename  string
	PartID    string
	Data      []byte
	AccountID string
	Encoding  string
	Mailbox   MailboxKind
}

type DraftDeletedMsg added in v0.8.0

type DraftDeletedMsg struct {
	DraftID string
	Err     error
}

DraftDeletedMsg signals that a draft was deleted.

type DraftSavedMsg added in v0.8.0

type DraftSavedMsg struct {
	DraftID string
	Err     error
}

DraftSavedMsg signals that a draft was saved successfully.

type Drafts added in v0.8.0

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

Drafts is the model for the drafts list view

func NewDrafts added in v0.8.0

func NewDrafts(drafts []config.Draft) *Drafts

NewDrafts creates a new drafts list view

func (*Drafts) Init added in v0.8.0

func (m *Drafts) Init() tea.Cmd

func (*Drafts) SetDrafts added in v0.8.0

func (m *Drafts) SetDrafts(drafts []config.Draft)

SetDrafts updates the drafts list

func (*Drafts) Update added in v0.8.0

func (m *Drafts) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Drafts) View added in v0.8.0

func (m *Drafts) View() string

type DraftsLoadedMsg added in v0.8.0

type DraftsLoadedMsg struct {
	Drafts []config.Draft
}

DraftsLoadedMsg signals that drafts were loaded from disk.

type EmailActionDoneMsg

type EmailActionDoneMsg struct {
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
	Err       error
}

type EmailBodyFetchedMsg

type EmailBodyFetchedMsg struct {
	UID         uint32
	Body        string
	Attachments []fetcher.Attachment
	Err         error
	AccountID   string
	Mailbox     MailboxKind
}

type EmailResultMsg

type EmailResultMsg struct {
	Err error
}

type EmailView

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

func NewEmailView

func NewEmailView(email fetcher.Email, emailIndex, width, height int, mailbox MailboxKind) *EmailView

func (*EmailView) GetAccountID added in v0.8.0

func (m *EmailView) GetAccountID() string

GetAccountID returns the account ID for this email

func (*EmailView) GetEmail added in v0.8.0

func (m *EmailView) GetEmail() fetcher.Email

GetEmail returns the email being viewed

func (*EmailView) Init

func (m *EmailView) Init() tea.Cmd

func (*EmailView) Update

func (m *EmailView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*EmailView) View

func (m *EmailView) View() string

type EmailsAppendedMsg

type EmailsAppendedMsg struct {
	Emails    []fetcher.Email
	AccountID string
	Mailbox   MailboxKind
}

type EmailsFetchedMsg

type EmailsFetchedMsg struct {
	Emails    []fetcher.Email
	AccountID string
	Mailbox   MailboxKind
}

type EmailsRefreshedMsg added in v0.8.0

type EmailsRefreshedMsg struct {
	EmailsByAccount map[string][]fetcher.Email
	Mailbox         MailboxKind
}

EmailsRefreshedMsg signals that fresh emails have been fetched in the background.

type FetchErr

type FetchErr error

type FetchMoreEmailsMsg

type FetchMoreEmailsMsg struct {
	Offset    uint32
	AccountID string
	Mailbox   MailboxKind
}

type FetchingMoreEmailsMsg

type FetchingMoreEmailsMsg struct{}

type FilePicker

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

func NewFilePicker

func NewFilePicker(startPath string) *FilePicker

func (*FilePicker) Init

func (m *FilePicker) Init() tea.Cmd

func (*FilePicker) Update

func (m *FilePicker) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FilePicker) View

func (m *FilePicker) View() string

type FileSelectedMsg

type FileSelectedMsg struct {
	Path string
}

type GoToAccountListMsg added in v0.8.0

type GoToAccountListMsg struct{}

GoToAccountListMsg signals navigation to the account list in settings.

type GoToAddAccountMsg added in v0.8.0

type GoToAddAccountMsg struct{}

GoToAddAccountMsg signals navigation to the add account screen.

type GoToChoiceMenuMsg

type GoToChoiceMenuMsg struct{}

type GoToDraftsMsg added in v0.8.0

type GoToDraftsMsg struct{}

GoToDraftsMsg signals navigation to the drafts list.

type GoToFilePickerMsg

type GoToFilePickerMsg struct{}

type GoToInboxMsg

type GoToInboxMsg struct{}

type GoToSendMsg

type GoToSendMsg struct {
	To      string
	Subject string
	Body    string
}

type GoToSentInboxMsg added in v0.10.0

type GoToSentInboxMsg struct{}

type GoToSettingsMsg

type GoToSettingsMsg struct{}

type Inbox

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

func NewInbox

func NewInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func NewInboxSingleAccount added in v0.8.0

func NewInboxSingleAccount(emails []fetcher.Email) *Inbox

NewInboxSingleAccount creates an inbox for a single account (legacy support)

func NewInboxWithMailbox added in v0.10.0

func NewInboxWithMailbox(emails []fetcher.Email, accounts []config.Account, mailbox MailboxKind) *Inbox

func NewSentInbox added in v0.10.0

func NewSentInbox(emails []fetcher.Email, accounts []config.Account) *Inbox

func (*Inbox) GetCurrentAccountID added in v0.8.0

func (m *Inbox) GetCurrentAccountID() string

GetCurrentAccountID returns the currently selected account ID

func (*Inbox) GetEmailAtIndex added in v0.8.0

func (m *Inbox) GetEmailAtIndex(index int) *fetcher.Email

GetEmailAtIndex returns the email at the given index for the current view

func (*Inbox) GetMailbox added in v0.10.0

func (m *Inbox) GetMailbox() MailboxKind

func (*Inbox) Init

func (m *Inbox) Init() tea.Cmd

func (*Inbox) RemoveEmail added in v0.8.0

func (m *Inbox) RemoveEmail(uid uint32, accountID string)

RemoveEmail removes an email by UID and account ID

func (*Inbox) SetEmails added in v0.8.0

func (m *Inbox) SetEmails(emails []fetcher.Email, accounts []config.Account)

SetEmails updates all emails (used after fetch)

func (*Inbox) Update

func (m *Inbox) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Inbox) View

func (m *Inbox) View() string

type LoadDraftsMsg added in v0.8.0

type LoadDraftsMsg struct{}

LoadDraftsMsg signals a request to load all saved drafts.

type Login

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

Login holds the state for the login/add account form.

func NewLogin

func NewLogin() *Login

NewLogin creates a new login model for adding accounts.

func (*Login) GetAccountID added in v0.8.0

func (m *Login) GetAccountID() string

GetAccountID returns the account ID being edited (if in edit mode).

func (*Login) Init

func (m *Login) Init() tea.Cmd

Init initializes the login model.

func (*Login) IsEditMode added in v0.8.0

func (m *Login) IsEditMode() bool

IsEditMode returns whether the form is in edit mode.

func (*Login) SetEditMode added in v0.8.0

func (m *Login) SetEditMode(accountID, provider, name, email, fetchEmail, imapServer string, imapPort int, smtpServer string, smtpPort int)

SetEditMode sets the login form to edit an existing account.

func (*Login) Update

func (m *Login) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the login model.

func (*Login) View

func (m *Login) View() string

View renders the login form.

type MailboxKind added in v0.10.0

type MailboxKind string
const (
	MailboxInbox MailboxKind = "inbox"
	MailboxSent  MailboxKind = "sent"
)

type OpenDraftMsg added in v0.8.0

type OpenDraftMsg struct {
	Draft config.Draft
}

OpenDraftMsg signals that a specific draft should be opened in the composer.

type RefreshingEmailsMsg added in v0.8.0

type RefreshingEmailsMsg struct {
	Mailbox MailboxKind
}

RefreshingEmailsMsg signals that a background refresh is in progress.

type ReplyToEmailMsg

type ReplyToEmailMsg struct {
	Email fetcher.Email
}

type RequestRefreshMsg added in v0.13.0

type RequestRefreshMsg struct {
	Mailbox MailboxKind
}

RequestRefreshMsg signals a request to refresh emails from the server.

type RestoreViewMsg

type RestoreViewMsg struct{}

type SaveDraftMsg added in v0.8.0

type SaveDraftMsg struct {
	Draft config.Draft
}

SaveDraftMsg signals that the current draft should be saved to disk.

type SendEmailMsg

type SendEmailMsg struct {
	To             string
	Subject        string
	Body           string
	AttachmentPath string
	InReplyTo      string
	References     []string
	AccountID      string // ID of the account to send from
}

type SetComposerCursorToStartMsg

type SetComposerCursorToStartMsg struct{}

type Settings added in v0.8.0

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

Settings displays the account management screen.

func NewSettings added in v0.8.0

func NewSettings(accounts []config.Account) *Settings

NewSettings creates a new settings model.

func (*Settings) Init added in v0.8.0

func (m *Settings) Init() tea.Cmd

Init initializes the settings model.

func (*Settings) Update added in v0.8.0

func (m *Settings) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the settings model.

func (*Settings) UpdateAccounts added in v0.8.0

func (m *Settings) UpdateAccounts(accounts []config.Account)

UpdateAccounts updates the list of accounts.

func (*Settings) View added in v0.8.0

func (m *Settings) View() string

View renders the settings screen.

type Status

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

A simple model for showing a status message

func NewStatus

func NewStatus(msg string) Status

func (Status) Init

func (m Status) Init() tea.Cmd

func (Status) Update

func (m Status) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Status) View

func (m Status) View() string

type SwitchAccountMsg added in v0.8.0

type SwitchAccountMsg struct {
	AccountID string // Empty string means "ALL" accounts
}

SwitchAccountMsg signals switching to view a specific account's inbox.

type SwitchFromAccountMsg added in v0.8.0

type SwitchFromAccountMsg struct {
	AccountID string
}

SwitchFromAccountMsg signals changing the "From" account in composer.

type ViewEmailMsg

type ViewEmailMsg struct {
	Index     int
	UID       uint32
	AccountID string
	Mailbox   MailboxKind
}

Jump to

Keyboard shortcuts

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