Skip to content

Commit

Permalink
refactor!: remove deprecated references
Browse files Browse the repository at this point in the history
This removes all the `NewModel` functions from all the bubbles and any
deprecated fields and types.
  • Loading branch information
aymanbagabas committed Sep 19, 2024
1 parent 95541c2 commit 09242fd
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 84 deletions.
5 changes: 0 additions & 5 deletions help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ func New() 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(_ tea.Msg) (Model, tea.Cmd) {
return m, nil
Expand Down
5 changes: 0 additions & 5 deletions list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@ func New(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) {
Expand Down
16 changes: 0 additions & 16 deletions paginator/paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ type Model struct {

// KeyMap encodes the keybindings recognized by the widget.
KeyMap KeyMap

// Deprecated: customize [KeyMap] instead.
UsePgUpPgDownKeys bool
// Deprecated: customize [KeyMap] instead.
UseLeftRightKeys bool
// Deprecated: customize [KeyMap] instead.
UseUpDownKeys bool
// Deprecated: customize [KeyMap] instead.
UseHLKeys bool
// Deprecated: customize [KeyMap] instead.
UseJKKeys bool
}

// SetTotalPages is a helper function for calculating the total number of pages
Expand Down Expand Up @@ -153,11 +142,6 @@ func New(opts ...Option) Model {
return m
}

// NewModel creates a new model with defaults.
//
// Deprecated: use [New] instead.
var NewModel = New

// WithTotalPages sets the total pages.
func WithTotalPages(totalPages int) Option {
return func(m *Model) {
Expand Down
5 changes: 0 additions & 5 deletions progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ func New(opts ...Option) Model {
return m
}

// NewModel returns a model with default values.
//
// Deprecated: use [New] instead.
var NewModel = New

// Init exists to satisfy the tea.Model interface.
func (m Model) Init() (tea.Model, tea.Cmd) {
return m, nil
Expand Down
13 changes: 0 additions & 13 deletions spinner/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ func New(opts ...Option) Model {
return m
}

// 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
Expand Down Expand Up @@ -202,14 +197,6 @@ func (m Model) tick(id, tag int) tea.Cmd {
})
}

// Tick is the command used to advance the spinner one frame. Use this command
// to effectively start the spinner.
//
// Deprecated: Use [Model.Tick] instead.
func Tick() tea.Msg {
return TickMsg{Time: time.Now()}
}

// Option is used to set options in New. For example:
//
// spinner := New(WithSpinner(Dot))
Expand Down
40 changes: 0 additions & 40 deletions textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package textinput
import (
"reflect"
"strings"
"time"
"unicode"

"github.com/atotto/clipboard"
Expand Down Expand Up @@ -93,9 +92,6 @@ type Model struct {
EchoCharacter rune
Cursor cursor.Model

// Deprecated: use [cursor.BlinkSpeed] instead.
BlinkSpeed time.Duration

// Styles. These will be applied as inline styles.
//
// For an introduction to styling with Lip Gloss see:
Expand All @@ -105,9 +101,6 @@ type Model struct {
PlaceholderStyle lipgloss.Style
CompletionStyle lipgloss.Style

// Deprecated: use Cursor.Style instead.
CursorStyle lipgloss.Style

// CharLimit is the maximum amount of characters this input element will
// accept. If 0 or less, there's no limit.
CharLimit int
Expand Down Expand Up @@ -173,11 +166,6 @@ func New() 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) {
// Clean up any special characters in the input provided by the
Expand Down Expand Up @@ -773,34 +761,6 @@ func max(a, b int) int {
return b
}

// Deprecated.

// Deprecated: use cursor.Mode.
type CursorMode int

const (
// Deprecated: use cursor.CursorBlink.
CursorBlink = CursorMode(cursor.CursorBlink)
// Deprecated: use cursor.CursorStatic.
CursorStatic = CursorMode(cursor.CursorStatic)
// Deprecated: use cursor.CursorHide.
CursorHide = CursorMode(cursor.CursorHide)
)

func (c CursorMode) String() string {
return cursor.Mode(c).String()
}

// Deprecated: use cursor.Mode().
func (m Model) CursorMode() CursorMode {
return CursorMode(m.Cursor.Mode())
}

// Deprecated: use cursor.SetMode().
func (m *Model) SetCursorMode(mode CursorMode) tea.Cmd {
return m.Cursor.SetMode(cursor.Mode(mode))
}

func (m Model) completionView(offset int) string {
var (
value = m.value
Expand Down

0 comments on commit 09242fd

Please sign in to comment.