Documentation ¶
Overview ¶
modified from https://github.com/mistakenelf/teacup/blob/main/image/image.go
Index ¶
- Variables
- func CastContent(cast *api.Cast, maxHeight int, imgs ...ImageModel) string
- func CastStats(cast *api.Cast, margin int) string
- func GetHeight() int
- func GetWidth() int
- func NewStyle() lipgloss.Style
- func OpenURL(url string) tea.Cmd
- func SetHeight(h int)
- func SetWidth(w int)
- func ToString(width int, img image.Image) string
- func UserBio(user *api.User) string
- func UsernameHeader(user *api.User, img *ImageModel) string
- type App
- func (a *App) FocusCast() tea.Cmd
- func (a *App) FocusChannel() tea.Cmd
- func (a *App) FocusFeed() tea.Cmd
- func (a *App) FocusHelp()
- func (a *App) FocusNotifications() tea.Cmd
- func (a *App) FocusPrev() tea.Cmd
- func (a *App) FocusProfile() tea.Cmd
- func (a *App) FocusPublish()
- func (a *App) FocusQuickSelect()
- func (a *App) GetFocused() tea.Model
- func (a *App) GoToCast(hash string) tea.Cmd
- func (a *App) Init() tea.Cmd
- func (a *App) PublicKey() string
- func (a *App) SetNavName(name string)
- func (a *App) ToggleHelp()
- func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (a *App) View() string
- type AppContext
- type CastFeedItem
- func (m *CastFeedItem) AsRow(ch, stats bool) []string
- func (i *CastFeedItem) Description() string
- func (i *CastFeedItem) FilterValue() string
- func (m *CastFeedItem) Init() tea.Cmd
- func (i *CastFeedItem) Title() string
- func (m *CastFeedItem) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *CastFeedItem) View() string
- type CastView
- func (m *CastView) Clear()
- func (m *CastView) Init() tea.Cmd
- func (m *CastView) LikeCast() tea.Cmd
- func (m *CastView) OpenCast() tea.Cmd
- func (m *CastView) Reply()
- func (m *CastView) SetCast(cast *api.Cast) tea.Cmd
- func (m *CastView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *CastView) View() string
- func (m *CastView) ViewChannel() tea.Cmd
- func (m *CastView) ViewParent() tea.Cmd
- func (m *CastView) ViewProfile() tea.Cmd
- type FallbackModel
- type FeedView
- func (m *FeedView) Clear()
- func (m *FeedView) Init() tea.Cmd
- func (m *FeedView) LikeCurrentItem() tea.Cmd
- func (m *FeedView) OpenCurrentItem() tea.Cmd
- func (m *FeedView) SelectCurrentItem() tea.Cmd
- func (m *FeedView) SetDefaultParams() tea.Cmd
- func (m *FeedView) SetDescription(desc string)
- func (m *FeedView) SetParams(req *api.FeedRequest) tea.Cmd
- func (m *FeedView) SetShowChannel(show bool)
- func (m *FeedView) SetShowStats(show bool)
- func (m *FeedView) SetSize(w, h int)
- func (m *FeedView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *FeedView) View() string
- func (m *FeedView) ViewCurrentChannel() tea.Cmd
- func (m *FeedView) ViewCurrentProfile() tea.Cmd
- type HelpView
- type ImageModel
- func (m *ImageModel) Clear()
- func (m *ImageModel) GotoTop()
- func (m ImageModel) Init() tea.Cmd
- func (m *ImageModel) Matches(msg tea.Msg) bool
- func (m *ImageModel) Render() tea.Cmd
- func (m *ImageModel) SetBorderColor(color lipgloss.AdaptiveColor)
- func (m *ImageModel) SetBorderless(borderless bool)
- func (m *ImageModel) SetIsActive(active bool)
- func (m *ImageModel) SetSize(w, h int)
- func (m *ImageModel) SetURL(url string, embed bool)
- func (m *ImageModel) Update(msg tea.Msg) (*ImageModel, tea.Cmd)
- func (m ImageModel) View() string
- type Loading
- type NotificationsView
- type Profile
- type ProfileMsg
- type PublishInput
- func (m *PublishInput) Active() bool
- func (m *PublishInput) Clear()
- func (m *PublishInput) Init() tea.Cmd
- func (m *PublishInput) SetActive(active bool)
- func (m *PublishInput) SetContext(parent, channelParentUrl string, parentAuthor uint64) tea.Cmd
- func (m *PublishInput) SetFocus(focus bool)
- func (m *PublishInput) SetSize(w, h int)
- func (m *PublishInput) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *PublishInput) View() string
- type QuickSelect
- func (m *QuickSelect) Active() bool
- func (m *QuickSelect) Init() tea.Cmd
- func (m *QuickSelect) SetActive(active bool)
- func (m *QuickSelect) SetOnSelect(f func(i *selectItem) tea.Cmd)
- func (m *QuickSelect) SetSize(w, h int)
- func (m *QuickSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *QuickSelect) View() string
- type RepliesView
- type SelectCastMsg
- type SelectProfileMsg
- type Sidebar
- type SplashView
- func (m *SplashView) Active() bool
- func (m *SplashView) Init() tea.Cmd
- func (m *SplashView) SetActive(active bool)
- func (m *SplashView) SetInfo(content string)
- func (m *SplashView) SetSize(w, h int)
- func (m *SplashView) ShowSignin(v bool)
- func (m *SplashView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *SplashView) View() string
- type StatusLine
- type UpdateSignerMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmojiLike = "❤️" EmojiEmptyLike = "🤍" EmojiRecyle = "♻️" EmojiComment = "💬" EmojiPerson = "👤" )
View Source
var ( Height atomic.Int32 Width atomic.Int32 )
View Source
var CastViewKeyMap = casetViewKeymap{ LikeCast: key.NewBinding( key.WithKeys("l"), key.WithHelp("l", "like cast"), ), ViewProfile: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "view profile"), ), ViewChannel: key.NewBinding( key.WithKeys("c"), key.WithHelp("c", "view channel"), ), ViewParent: key.NewBinding( key.WithKeys("t"), key.WithHelp("t", "view parent"), ), Comment: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "reply"), ), OpenCast: key.NewBinding( key.WithKeys("o"), key.WithHelp("o", "open in browser"), ), }
View Source
var Fallback = FallbackModel{}
View Source
var FeedKeyMap = feedKeymap{ ViewCast: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "view cast"), ), LikeCast: key.NewBinding( key.WithKeys("l"), key.WithHelp("l", "like cast"), ), ViewProfile: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "view profile"), ), ViewChannel: key.NewBinding( key.WithKeys("c"), key.WithHelp("c", "view channel"), ), OpenCast: key.NewBinding( key.WithKeys("o"), key.WithHelp("o", "open in browser "), ), }
View Source
var GlobalKeyMap = kmap{ // contains filtered or unexported fields }
View Source
key.NewBinding( key.WithKeys("F", "1"), key.WithHelp("F/1", "feed"), ), Publish: key.NewBinding( key.WithKeys("P"), key.WithHelp("P", "publish cast"), ), QuickSelect: key.NewBinding( key.WithKeys("ctrl+k"), key.WithHelp("ctrl+k", "quick select"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "help"), ), ToggleSidebarFocus: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "toggle sidebar focus"), ), ToggleSidebarVisibility: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "toggle sidebar focus"), ), Previous: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "focus previous"), ), ViewNotifications: key.NewBinding( key.WithKeys("N"), key.WithHelp("N", "view notifications"), ), }Feed:
Functions ¶
func CastContent ¶
func CastContent(cast *api.Cast, maxHeight int, imgs ...ImageModel) string
func UsernameHeader ¶
func UsernameHeader(user *api.User, img *ImageModel) string
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) FocusChannel ¶
func (*App) FocusNotifications ¶ added in v0.1.4
func (*App) FocusProfile ¶
func (*App) FocusPublish ¶ added in v0.1.4
func (a *App) FocusPublish()
func (*App) FocusQuickSelect ¶ added in v0.1.4
func (a *App) FocusQuickSelect()
func (*App) GetFocused ¶
func (*App) SetNavName ¶
func (*App) ToggleHelp ¶ added in v0.1.4
func (a *App) ToggleHelp()
type AppContext ¶
type AppContext struct {
// contains filtered or unexported fields
}
type CastFeedItem ¶
type CastFeedItem struct {
// contains filtered or unexported fields
}
func NewCastFeedItem ¶
NewCastFeedItem displays a cast in compact form within a list implements list.Item (and tea.Model only for updating image)
func (*CastFeedItem) AsRow ¶
func (m *CastFeedItem) AsRow(ch, stats bool) []string
func (*CastFeedItem) Description ¶
func (i *CastFeedItem) Description() string
func (*CastFeedItem) FilterValue ¶
func (i *CastFeedItem) FilterValue() string
func (*CastFeedItem) Init ¶
func (m *CastFeedItem) Init() tea.Cmd
func (*CastFeedItem) Title ¶
func (i *CastFeedItem) Title() string
func (*CastFeedItem) View ¶
func (m *CastFeedItem) View() string
type CastView ¶
type CastView struct {
// contains filtered or unexported fields
}
func (*CastView) ViewChannel ¶ added in v0.1.4
func (*CastView) ViewParent ¶ added in v0.1.4
func (*CastView) ViewProfile ¶ added in v0.1.4
type FallbackModel ¶
type FallbackModel struct{}
func (FallbackModel) Init ¶
func (m FallbackModel) Init() tea.Cmd
func (FallbackModel) View ¶
func (m FallbackModel) View() string
type FeedView ¶
type FeedView struct {
// contains filtered or unexported fields
}
func NewFeedView ¶
func (*FeedView) LikeCurrentItem ¶
func (*FeedView) OpenCurrentItem ¶
func (*FeedView) SelectCurrentItem ¶
func (*FeedView) SetDefaultParams ¶
func (*FeedView) SetDescription ¶
func (*FeedView) SetShowChannel ¶
func (*FeedView) SetShowStats ¶
func (*FeedView) ViewCurrentChannel ¶
func (*FeedView) ViewCurrentProfile ¶
type HelpView ¶
type HelpView struct {
// contains filtered or unexported fields
}
func NewHelpView ¶
type ImageModel ¶
type ImageModel struct { Viewport *viewport.Model BorderColor lipgloss.AdaptiveColor Active bool Borderless bool URL string ImageString string // contains filtered or unexported fields }
ImageModel represents the properties of a code bubble.
func NewImage ¶
func NewImage(active, borderless bool, borderColor lipgloss.AdaptiveColor) *ImageModel
New creates a new instance of code.
func (*ImageModel) Clear ¶
func (m *ImageModel) Clear()
func (*ImageModel) GotoTop ¶
func (m *ImageModel) GotoTop()
GotoTop jumps to the top of the viewport.
func (*ImageModel) Render ¶ added in v0.1.4
func (m *ImageModel) Render() tea.Cmd
func (*ImageModel) SetBorderColor ¶
func (m *ImageModel) SetBorderColor(color lipgloss.AdaptiveColor)
SetBorderColor sets the current color of the border.
func (*ImageModel) SetBorderless ¶
func (m *ImageModel) SetBorderless(borderless bool)
SetBorderless sets weather or not to show the border.
func (*ImageModel) SetIsActive ¶
func (m *ImageModel) SetIsActive(active bool)
SetIsActive sets if the bubble is currently active
func (*ImageModel) SetSize ¶
func (m *ImageModel) SetSize(w, h int)
func (*ImageModel) SetURL ¶
func (m *ImageModel) SetURL(url string, embed bool)
func (*ImageModel) Update ¶
func (m *ImageModel) Update(msg tea.Msg) (*ImageModel, tea.Cmd)
Update handles updating the UI of a code bubble.
func (ImageModel) View ¶
func (m ImageModel) View() string
View returns a string representation of the code bubble.
type Loading ¶
type Loading struct {
// contains filtered or unexported fields
}
func NewLoading ¶
func NewLoading() *Loading
type NotificationsView ¶ added in v0.1.4
type NotificationsView struct {
// contains filtered or unexported fields
}
func NewNotificationsView ¶ added in v0.1.4
func NewNotificationsView(app *App) *NotificationsView
func (*NotificationsView) Active ¶ added in v0.1.4
func (m *NotificationsView) Active() bool
func (*NotificationsView) Init ¶ added in v0.1.4
func (m *NotificationsView) Init() tea.Cmd
func (*NotificationsView) SetActive ¶ added in v0.1.4
func (m *NotificationsView) SetActive(active bool)
func (*NotificationsView) SetSize ¶ added in v0.1.4
func (m *NotificationsView) SetSize(w, h int)
func (*NotificationsView) View ¶ added in v0.1.4
func (m *NotificationsView) View() string
type ProfileMsg ¶
type ProfileMsg struct {
// contains filtered or unexported fields
}
type PublishInput ¶
type PublishInput struct {
// contains filtered or unexported fields
}
func NewPublishInput ¶
func NewPublishInput(app *App) *PublishInput
func (*PublishInput) Active ¶
func (m *PublishInput) Active() bool
func (*PublishInput) Clear ¶
func (m *PublishInput) Clear()
func (*PublishInput) Init ¶
func (m *PublishInput) Init() tea.Cmd
func (*PublishInput) SetActive ¶
func (m *PublishInput) SetActive(active bool)
func (*PublishInput) SetContext ¶
func (m *PublishInput) SetContext(parent, channelParentUrl string, parentAuthor uint64) tea.Cmd
func (*PublishInput) SetFocus ¶
func (m *PublishInput) SetFocus(focus bool)
func (*PublishInput) SetSize ¶
func (m *PublishInput) SetSize(w, h int)
func (*PublishInput) View ¶
func (m *PublishInput) View() string
type QuickSelect ¶
type QuickSelect struct {
// contains filtered or unexported fields
}
func NewQuickSelect ¶
func NewQuickSelect(app *App) *QuickSelect
func (*QuickSelect) Active ¶
func (m *QuickSelect) Active() bool
func (*QuickSelect) Init ¶
func (m *QuickSelect) Init() tea.Cmd
func (*QuickSelect) SetActive ¶
func (m *QuickSelect) SetActive(active bool)
func (*QuickSelect) SetOnSelect ¶
func (m *QuickSelect) SetOnSelect(f func(i *selectItem) tea.Cmd)
func (*QuickSelect) SetSize ¶
func (m *QuickSelect) SetSize(w, h int)
func (*QuickSelect) View ¶
func (m *QuickSelect) View() string
type RepliesView ¶
type RepliesView struct {
// contains filtered or unexported fields
}
func NewRepliesView ¶
func NewRepliesView(app *App) *RepliesView
func (*RepliesView) Clear ¶
func (m *RepliesView) Clear()
func (*RepliesView) Init ¶
func (m *RepliesView) Init() tea.Cmd
func (*RepliesView) SetSize ¶
func (m *RepliesView) SetSize(w, h int)
func (*RepliesView) View ¶
func (m *RepliesView) View() string
type SelectCastMsg ¶
type SelectCastMsg struct {
// contains filtered or unexported fields
}
type SelectProfileMsg ¶
type SelectProfileMsg struct {
// contains filtered or unexported fields
}
type SplashView ¶
type SplashView struct {
// contains filtered or unexported fields
}
func NewSplashView ¶
func NewSplashView(app *App) *SplashView
func (*SplashView) Active ¶
func (m *SplashView) Active() bool
func (*SplashView) Init ¶
func (m *SplashView) Init() tea.Cmd
func (*SplashView) SetActive ¶
func (m *SplashView) SetActive(active bool)
func (*SplashView) SetInfo ¶
func (m *SplashView) SetInfo(content string)
func (*SplashView) SetSize ¶
func (m *SplashView) SetSize(w, h int)
func (*SplashView) ShowSignin ¶
func (m *SplashView) ShowSignin(v bool)
func (*SplashView) View ¶
func (m *SplashView) View() string
type StatusLine ¶
type StatusLine struct {
// contains filtered or unexported fields
}
func NewStatusLine ¶
func NewStatusLine(app *App) *StatusLine
func (*StatusLine) Init ¶
func (m *StatusLine) Init() tea.Cmd
func (*StatusLine) SetSize ¶
func (m *StatusLine) SetSize(width, height int)
func (*StatusLine) View ¶
func (m *StatusLine) View() string
type UpdateSignerMsg ¶
Click to show internal directories.
Click to hide internal directories.