ui

package
v0.0.0-...-982f13e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeys = Keymap{
	Quit: key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "help"),
	),
	TogglePanel: key.NewBinding(
		key.WithKeys("tab"),
		key.WithHelp("tab", "toggle panel"),
	),
	ToggleHouses: key.NewBinding(
		key.WithKeys("h"),
		key.WithHelp("h", "change house system"),
	),
	Up: key.NewBinding(
		key.WithKeys("up"),
		key.WithHelp("↑", "up"),
	),
	Down: key.NewBinding(
		key.WithKeys("down"),
		key.WithHelp("↓", "down"),
	),
	Left: key.NewBinding(
		key.WithKeys("left"),
		key.WithHelp("←", "navigate panel"),
	),
	Right: key.NewBinding(
		key.WithKeys("right"),
		key.WithHelp("→", "navigate panel"),
	),
	Enter: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "select"),
	),
	Delete: key.NewBinding(
		key.WithKeys("backspace"),
		key.WithHelp("⌫", "delete"),
	),
}
View Source
var Themes = make(map[string]ThemeSpec)

Functions

func DrawChart

func DrawChart(c model.Chart, width, height int, st Styles) string

func GetHuhTheme

func GetHuhTheme(name string) *huh.Theme

func GetLayout

func GetLayout(totalW, totalH int, showPanel bool) (int, int)

func LoadThemes

func LoadThemes(path string) error

func RenderPanel

func RenderPanel(c model.Chart, w, h, offset int, tab PanelTab, st Styles) string

func ResolveChart

func ResolveChart(f InputFlags, saved []model.Chart, storagePath string, themeName string) (model.Chart, bool, error)

func RunWizard

func RunWizard(saved []model.Chart, storagePath, themeName string) (model.Chart, bool, error)

Types

type Canvas

type Canvas struct {
	W, H int
	Grid [][]string
}

func NewCanvas

func NewCanvas(w, h int, fill string) *Canvas

func (*Canvas) Render

func (c *Canvas) Render(points []PointRender)

func (*Canvas) String

func (c *Canvas) String() string

type ChartGeometry

type ChartGeometry struct {
	CX, CY, Radius float64
	StartAngle     engine.Degrees
}

func NewChartGeometry

func NewChartGeometry(w, h int, startAngle engine.Degrees) ChartGeometry

func (ChartGeometry) ToXY

func (g ChartGeometry) ToXY(zodiacAngle float64, r float64) (int, int)

type InputFlags

type InputFlags struct {
	Name, Date, Time, Load, Timezone string
	Lat, Lon                         float64
}

type Keymap

type Keymap struct {
	Quit         key.Binding
	Help         key.Binding
	TogglePanel  key.Binding
	ToggleHouses key.Binding
	Up           key.Binding
	Down         key.Binding
	Left         key.Binding
	Right        key.Binding
	Enter        key.Binding
	Delete       key.Binding
}

type PanelTab

type PanelTab int
const (
	TabPlacements PanelTab = iota
	TabAspects
	TabHelp
)

type PointRender

type PointRender struct {
	X, Y int
	Char string
}

type Styles

type Styles struct {
	Bg        lipgloss.Style
	Header    lipgloss.Style
	Text      lipgloss.Style
	Dim       lipgloss.Style
	Highlight lipgloss.Style
	Planet    lipgloss.Style
	House     lipgloss.Style
	Zodiac    [12]lipgloss.Style
}

func DefaultStyles

func DefaultStyles() Styles

func GetTheme

func GetTheme(name ThemeName) Styles

type ThemeColor

type ThemeColor struct {
	Light string `json:"light"`
	Dark  string `json:"dark"`
}

type ThemeName

type ThemeName string
const (
	ThemeTerminal ThemeName = "terminal"
	ThemeMeow     ThemeName = "meow"
)

type ThemeSpec

type ThemeSpec struct {
	Name    string       `json:"name"`
	Bg      ThemeColor   `json:"bg"`
	Fg      ThemeColor   `json:"fg"`
	Muted   ThemeColor   `json:"muted"`
	Border  ThemeColor   `json:"border"`
	Accent  ThemeColor   `json:"accent"`
	Accent2 ThemeColor   `json:"accent2"`
	Danger  ThemeColor   `json:"danger"`
	Planet  ThemeColor   `json:"planet"`
	Signs   []ThemeColor `json:"signs"`
}

func GetThemes

func GetThemes() []ThemeSpec

type ViewerModel

type ViewerModel struct {
	Chart        model.Chart
	Styles       Styles
	ActiveTab    PanelTab
	ScrollOffset int
	Width        int
	Height       int
	ShowPanel    bool

	Settings     model.Settings
	Ephe         *engine.Ephe
	SettingsPath string
}

func NewViewer

func NewViewer(c model.Chart, s model.Settings, e *engine.Ephe, path string) ViewerModel

func (ViewerModel) Init

func (m ViewerModel) Init() tea.Cmd

func (ViewerModel) Update

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

func (ViewerModel) View

func (m ViewerModel) View() string

type WizardModel

type WizardModel struct {
	SavedCharts []model.Chart
	StoragePath string
	ThemeName   string

	Mode        int
	ChartChoice int
	Name        string
	Date        string
	TimeStr     string
	Timezone    string
	LatStr      string
	LonStr      string

	Result    model.Chart
	Completed bool
	IsNew     bool
	// contains filtered or unexported fields
}

func NewWizardModel

func NewWizardModel(saved []model.Chart, path, themeName string) *WizardModel

func (*WizardModel) Init

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

func (*WizardModel) Update

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

func (*WizardModel) View

func (m *WizardModel) View() string

Jump to

Keyboard shortcuts

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