Documentation
¶
Index ¶
- type Field
- type FieldType
- type OpenModelFieldDialogMsg
- type SaveFieldMsg
- type Section
- func (s *Section) ActiveField() *Field
- func (s *Section) ActiveFieldIdx() int
- func (s *Section) FieldAtLine(width, line int) int
- func (s *Section) FieldHeights(width int) []int
- func (s *Section) FieldLineOffset(width, idx int) int
- func (s *Section) IsEditing() bool
- func (s *Section) SetActiveFieldIdx(idx int)
- func (s *Section) SetWidth(width int)
- func (s *Section) Update(msg tea.Msg) tea.Cmd
- func (s *Section) View(width int, active bool) string
- type SelectFieldCmp
- type SettingsCmp
- func (m *SettingsCmp) ActiveSection() *Section
- func (m SettingsCmp) Init() tea.Cmd
- func (m *SettingsCmp) Sections() []Section
- func (m *SettingsCmp) SetActiveField(sectionTitle, fieldKey string)
- func (m *SettingsCmp) SetSections(sections []Section)
- func (m *SettingsCmp) SetSize(width, height int)
- func (m SettingsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m SettingsCmp) View() string
- type TextFieldCmp
- type ToggleFieldCmp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Label string
Key string
Value string
Type FieldType
Options []string
Masked bool
ReadOnly bool
Disabled bool
UseModelDialog bool
ModelDialogTitle string
// Hint is optional helper text shown below the field row (e.g. recommended default).
Hint string
}
func (Field) DisplayValue ¶
func (*Field) SetBoolValue ¶
type OpenModelFieldDialogMsg ¶ added in v0.308.0
type SaveFieldMsg ¶
type Section ¶
type Section struct {
Title string
Group string // optional group label shown as header in sidebar
Fields []Field
// contains filtered or unexported fields
}
func (*Section) ActiveField ¶
func (*Section) ActiveFieldIdx ¶ added in v0.624.0
ActiveFieldIdx returns the index of the currently active field.
func (*Section) FieldAtLine ¶ added in v0.624.0
FieldAtLine maps a content line to the field index that occupies it, or -1.
func (*Section) FieldHeights ¶ added in v0.624.0
FieldHeights returns the rendered line height of every field at the given width, matching exactly what View draws. Callers use the cumulative sums to map content lines to fields and back.
func (*Section) FieldLineOffset ¶ added in v0.624.0
FieldLineOffset returns the first content line (0-indexed) of field idx.
func (*Section) SetActiveFieldIdx ¶ added in v0.624.0
SetActiveFieldIdx sets the active field, clamped to the valid range.
type SelectFieldCmp ¶
type SelectFieldCmp struct {
// contains filtered or unexported fields
}
func NewSelectFieldCmp ¶
func NewSelectFieldCmp(field Field, width int) SelectFieldCmp
func (*SelectFieldCmp) SetWidth ¶
func (c *SelectFieldCmp) SetWidth(width int)
func (SelectFieldCmp) Value ¶
func (c SelectFieldCmp) Value() string
func (SelectFieldCmp) View ¶
func (c SelectFieldCmp) View() string
type SettingsCmp ¶
type SettingsCmp struct {
// contains filtered or unexported fields
}
func NewSettingsCmp ¶
func NewSettingsCmp() SettingsCmp
func (*SettingsCmp) ActiveSection ¶
func (m *SettingsCmp) ActiveSection() *Section
func (SettingsCmp) Init ¶
func (m SettingsCmp) Init() tea.Cmd
func (*SettingsCmp) Sections ¶
func (m *SettingsCmp) Sections() []Section
func (*SettingsCmp) SetActiveField ¶
func (m *SettingsCmp) SetActiveField(sectionTitle, fieldKey string)
func (*SettingsCmp) SetSections ¶
func (m *SettingsCmp) SetSections(sections []Section)
SetSections replaces the sections, preserving the active section, the active field of every section and the scroll position across the rebuild.
Callers pass freshly built sections whose activeFieldIdx is always 0, so without this remapping any rebuild not followed by an explicit SetActiveField would snap focus and the viewport back to the top. That is what happened after saving a field: persisting writes the config file, the config watcher picks the write up and publishes a change event, and the resulting rebuild reset focus to the first field of the section.
func (*SettingsCmp) SetSize ¶
func (m *SettingsCmp) SetSize(width, height int)
func (SettingsCmp) View ¶
func (m SettingsCmp) View() string
type TextFieldCmp ¶
type TextFieldCmp struct {
// contains filtered or unexported fields
}
func NewTextFieldCmp ¶
func NewTextFieldCmp(field Field, width int) TextFieldCmp
func (*TextFieldCmp) SetWidth ¶
func (c *TextFieldCmp) SetWidth(width int)
func (TextFieldCmp) Value ¶
func (c TextFieldCmp) Value() string
func (TextFieldCmp) View ¶
func (c TextFieldCmp) View() string
type ToggleFieldCmp ¶
type ToggleFieldCmp struct {
// contains filtered or unexported fields
}
func NewToggleFieldCmp ¶
func NewToggleFieldCmp(field Field) ToggleFieldCmp
func (*ToggleFieldCmp) SetWidth ¶
func (c *ToggleFieldCmp) SetWidth(width int)
func (ToggleFieldCmp) Value ¶
func (c ToggleFieldCmp) Value() string
func (ToggleFieldCmp) View ¶
func (c ToggleFieldCmp) View() string