diff --git a/help/help.go b/help/help.go index ad6ffd5..04ad4c6 100644 --- a/help/help.go +++ b/help/help.go @@ -57,8 +57,8 @@ type Model struct { Styles Styles } -// NewModel creates a new help view with some useful defaults. -func NewModel() Model { +// New creates a new help view with some useful defaults. +func New() Model { keyStyle := lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "#909090", Dark: "#626262", @@ -90,6 +90,11 @@ func NewModel() Model { } } +// NewModel creates a new help view with some useful defaults. +// +// Deprecated. Use New instead. +var NewModel = New + // Update helps satisfy the Bubble Tea Model interface. It's a no-op. func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { return m, nil diff --git a/list/list.go b/list/list.go index 181c707..5f89504 100644 --- a/list/list.go +++ b/list/list.go @@ -149,8 +149,8 @@ type Model struct { delegate ItemDelegate } -// NewModel returns a new model with sensible defaults. -func NewModel(items []Item, delegate ItemDelegate, width, height int) Model { +// New returns a new model with sensible defaults. +func New(items []Item, delegate ItemDelegate, width, height int) Model { styles := DefaultStyles() sp := spinner.NewModel() @@ -196,6 +196,11 @@ func NewModel(items []Item, delegate ItemDelegate, width, height int) Model { return m } +// NewModel returns a new model with sensible defaults. +// +// Deprecated. Use New instead. +var NewModel = New + // SetFilteringEnabled enables or disables filtering. Note that this is different // from ShowFilter, which merely hides or shows the input view. func (m *Model) SetFilteringEnabled(v bool) { diff --git a/paginator/paginator.go b/paginator/paginator.go index e825582..a84819a 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -96,8 +96,8 @@ func (m Model) OnLastPage() bool { return m.Page == m.TotalPages-1 } -// NewModel creates a new model with defaults. -func NewModel() Model { +// New creates a new model with defaults. +func New() Model { return Model{ Type: Arabic, Page: 0, @@ -114,6 +114,11 @@ func NewModel() Model { } } +// NewModel creates a new model with defaults. +// +// Deprecated. Use New instead. +var NewModel = New + // Update is the Tea update function which binds keystrokes to pagination. func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { switch msg := msg.(type) { diff --git a/progress/progress.go b/progress/progress.go index 4b13910..038e7b2 100644 --- a/progress/progress.go +++ b/progress/progress.go @@ -154,8 +154,8 @@ type Model struct { scaleRamp bool } -// NewModel returns a model with default values. -func NewModel(opts ...Option) Model { +// New returns a model with default values. +func New(opts ...Option) Model { m := Model{ id: nextID(), Width: defaultWidth, @@ -176,6 +176,11 @@ func NewModel(opts ...Option) Model { return m } +// NewModel returns a model with default values. +// +// Deprecated. Use New instead. +var NewModel = New + // Init exists satisfy the tea.Model interface. func (m Model) Init() tea.Cmd { return nil diff --git a/spinner/spinner.go b/spinner/spinner.go index da492fc..5b6860d 100644 --- a/spinner/spinner.go +++ b/spinner/spinner.go @@ -193,14 +193,19 @@ func (m Model) Visible() bool { return !m.hidden() && !m.finished() } -// NewModel returns a model with default values. -func NewModel() Model { +// New returns a model with default values. +func New() Model { return Model{ Spinner: Line, id: nextID(), } } +// NewModel returns a model with default values. +// +// Deprecated. Use New instead. +var NewModel = New + // TickMsg indicates that the timer has ticked and we should render a frame. type TickMsg struct { Time time.Time diff --git a/textinput/textinput.go b/textinput/textinput.go index f355bba..ba5c772 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -153,7 +153,7 @@ type Model struct { } // NewModel creates a new model with default settings. -func NewModel() Model { +func New() Model { return Model{ Prompt: "> ", BlinkSpeed: defaultBlinkSpeed, @@ -174,6 +174,11 @@ func NewModel() Model { } } +// NewModel creates a new model with default settings. +// +// Deprecated. Use New instead. +var NewModel = New + // SetValue sets the value of the text input. func (m *Model) SetValue(s string) { runes := []rune(s)