Skip to content

Commit b99d82e

Browse files
committed
Update to bubbletea v2, lipgloss v2 and bubbles v2
Signed-off-by: Ilya Savitsky <[email protected]>
1 parent 9e511ea commit b99d82e

File tree

14 files changed

+69
-101
lines changed

14 files changed

+69
-101
lines changed

bubble/bubble.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"clx/favorites"
1111
"clx/settings"
1212

13-
tea "github.com/charmbracelet/bubbletea"
14-
"github.com/charmbracelet/lipgloss"
13+
tea "github.com/charmbracelet/bubbletea/v2"
14+
"github.com/charmbracelet/lipgloss/v2"
1515
)
1616

1717
var docStyle = lipgloss.NewStyle()

bubble/list/defaultitem.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313

1414
"github.com/nleeper/goment"
1515

16-
"github.com/charmbracelet/bubbles/key"
17-
tea "github.com/charmbracelet/bubbletea"
18-
"github.com/charmbracelet/lipgloss"
16+
"github.com/charmbracelet/bubbles/v2/key"
17+
tea "github.com/charmbracelet/bubbletea/v2"
18+
"github.com/charmbracelet/lipgloss/v2"
1919
"github.com/muesli/reflow/truncate"
2020
)
2121

bubble/list/list.go

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"clx/app"
1313

14-
"github.com/charmbracelet/bubbles/viewport"
14+
"github.com/charmbracelet/bubbles/v2/viewport"
1515

1616
"clx/reader"
1717

@@ -33,10 +33,10 @@ import (
3333
"clx/tree"
3434
"clx/validator"
3535

36-
"github.com/charmbracelet/bubbles/paginator"
37-
"github.com/charmbracelet/bubbles/spinner"
38-
tea "github.com/charmbracelet/bubbletea"
39-
"github.com/charmbracelet/lipgloss"
36+
"github.com/charmbracelet/bubbles/v2/paginator"
37+
"github.com/charmbracelet/bubbles/v2/spinner"
38+
tea "github.com/charmbracelet/bubbletea/v2"
39+
"github.com/charmbracelet/lipgloss/v2"
4040
)
4141

4242
const (
@@ -153,11 +153,6 @@ func New(delegate ItemDelegate, config *settings.Config, cat *categories.Categor
153153
p.Type = paginator.Dots
154154
p.ActiveDot = styles.ActivePaginationDot.String()
155155
p.InactiveDot = styles.InactivePaginationDot.String()
156-
p.UseHLKeys = false
157-
p.UseJKKeys = false
158-
p.UseLeftRightKeys = false
159-
p.UsePgUpPgDownKeys = false
160-
p.UseUpDownKeys = false
161156

162157
bufferCategory := 1
163158
items := make([][]*item.Item, numberOfCategories+bufferCategory)
@@ -449,9 +444,7 @@ func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd) {
449444

450445
heightOfHeaderAndStatusLine := 4
451446

452-
m.viewport = viewport.New(windowSizeMsg.Width, windowSizeMsg.Height-heightOfHeaderAndStatusLine)
453-
m.viewport.YPosition = 2
454-
m.viewport.HighPerformanceRendering = false
447+
m.viewport = viewport.New(viewport.WithWidth(windowSizeMsg.Width), viewport.WithHeight(windowSizeMsg.Height-heightOfHeaderAndStatusLine))
455448

456449
content := lipgloss.NewStyle().
457450
Width(windowSizeMsg.Width).
@@ -502,8 +495,8 @@ func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd) {
502495
footerHeight := 2
503496
verticalMarginHeight := headerHeight + footerHeight
504497

505-
m.viewport.Width = msg.Width
506-
m.viewport.Height = msg.Height - verticalMarginHeight
498+
m.viewport.SetWidth(msg.Width)
499+
m.viewport.SetHeight(msg.Height - verticalMarginHeight)
507500

508501
m.width = msg.Width
509502
m.height = msg.Height
@@ -648,8 +641,8 @@ func (m *Model) updateHelpScreen(msg tea.Msg) (*Model, tea.Cmd) {
648641
footerHeight := lipgloss.Height("")
649642
verticalMarginHeight := headerHeight + footerHeight
650643

651-
m.viewport.Width = msg.Width
652-
m.viewport.Height = msg.Height - verticalMarginHeight
644+
m.viewport.SetWidth(msg.Width)
645+
m.viewport.SetHeight(msg.Height - verticalMarginHeight)
653646

654647
m.width = msg.Width
655648
m.height = msg.Height
@@ -661,7 +654,7 @@ func (m *Model) updateHelpScreen(msg tea.Msg) (*Model, tea.Cmd) {
661654

662655
m.viewport.SetContent(content.String())
663656

664-
return m, viewport.Sync(m.viewport)
657+
return m, nil
665658

666659
}
667660

bubble/list/style.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package list
33
import (
44
"time"
55

6-
"github.com/charmbracelet/bubbles/spinner"
7-
"github.com/charmbracelet/lipgloss"
6+
"github.com/charmbracelet/bubbles/v2/spinner"
7+
"github.com/charmbracelet/lipgloss/v2"
8+
"github.com/charmbracelet/lipgloss/v2/compat"
89
)
910

1011
const (
@@ -61,10 +62,10 @@ func DefaultStyles() (s Styles) {
6162
// Faint(true)
6263

6364
s.FilterPrompt = lipgloss.NewStyle().
64-
Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"})
65+
Foreground(compat.AdaptiveColor{Light: lipgloss.Color("#04B575"), Dark: lipgloss.Color("#ECFD65")})
6566

6667
s.FilterCursor = lipgloss.NewStyle().
67-
Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"})
68+
Foreground(compat.AdaptiveColor{Light: lipgloss.Color("#EE6FF8"), Dark: lipgloss.Color("#EE6FF8")})
6869

6970
s.DefaultFilterCharacterMatch = lipgloss.NewStyle().Underline(true)
7071

@@ -75,12 +76,12 @@ func DefaultStyles() (s Styles) {
7576
s.StatusEmpty = lipgloss.NewStyle()
7677

7778
s.StatusBarActiveFilter = lipgloss.NewStyle().
78-
Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"})
79+
Foreground(compat.AdaptiveColor{Light: lipgloss.Color("#1a1a1a"), Dark: lipgloss.Color("#dddddd")})
7980

8081
s.StatusBarFilterCount = lipgloss.NewStyle()
8182

8283
s.NoItems = lipgloss.NewStyle().
83-
Foreground(lipgloss.AdaptiveColor{Light: "#909090", Dark: "#626262"})
84+
Foreground(compat.AdaptiveColor{Light: lipgloss.Color("#909090"), Dark: lipgloss.Color("#626262")})
8485

8586
s.ArabicPagination = lipgloss.NewStyle()
8687

bubble/ranking/ranking.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strconv"
55
"strings"
66

7-
"github.com/charmbracelet/lipgloss"
7+
"github.com/charmbracelet/lipgloss/v2"
88
"github.com/logrusorgru/aurora/v3"
99
)
1010

go.mod

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ require (
77
github.com/MichaelMure/go-term-text v0.3.1
88
github.com/PuerkitoBio/goquery v1.10.3
99
github.com/bobesa/go-domain-util v0.0.0-20190911083921-4033b5f7dd89
10-
github.com/charmbracelet/bubbles v0.21.0
11-
github.com/charmbracelet/bubbletea v1.3.5
10+
github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1
11+
github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.3
1212
github.com/charmbracelet/glamour v0.10.0
13-
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834
13+
github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1
1414
github.com/go-resty/resty/v2 v2.16.5
1515
github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612
1616
github.com/jedib0t/go-pretty/v6 v6.6.7
@@ -24,34 +24,32 @@ require (
2424
)
2525

2626
require (
27-
github.com/alecthomas/chroma/v2 v2.16.0 // indirect
27+
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
2828
github.com/andybalholm/cascadia v1.3.3 // indirect
2929
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
3030
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
3131
github.com/aymerick/douceur v0.2.0 // indirect
32-
github.com/charmbracelet/colorprofile v0.3.0 // indirect
32+
github.com/charmbracelet/colorprofile v0.3.1 // indirect
33+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
3334
github.com/charmbracelet/x/ansi v0.8.0 // indirect
34-
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
35+
github.com/charmbracelet/x/cellbuf v0.0.14-0.20250501183327-ad3bc78c6a81 // indirect
3536
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
37+
github.com/charmbracelet/x/input v0.3.5-0.20250424101541-abb4d9a9b197 // indirect
3638
github.com/charmbracelet/x/term v0.2.1 // indirect
37-
github.com/davecgh/go-spew v1.1.1 // indirect
38-
github.com/dlclark/regexp2 v1.11.5 // indirect
39-
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
39+
github.com/charmbracelet/x/windows v0.2.1 // indirect
40+
github.com/dlclark/regexp2 v1.11.0 // indirect
4041
github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect
4142
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
4243
github.com/gorilla/css v1.0.1 // indirect
4344
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4445
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
4546
github.com/mattn/go-isatty v0.0.20 // indirect
46-
github.com/mattn/go-localereader v0.0.1 // indirect
4747
github.com/mattn/go-runewidth v0.0.16 // indirect
4848
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
49-
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
5049
github.com/muesli/cancelreader v0.2.2 // indirect
51-
github.com/pmezard/go-difflib v1.0.0 // indirect
5250
github.com/rivo/uniseg v0.4.7 // indirect
5351
github.com/spf13/pflag v1.0.6 // indirect
54-
github.com/tkuchiki/go-timezone v0.2.3 // indirect
52+
github.com/tkuchiki/go-timezone v0.2.0 // indirect
5553
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
5654
github.com/yuin/goldmark v1.7.8 // indirect
5755
github.com/yuin/goldmark-emoji v1.0.5 // indirect
@@ -61,5 +59,4 @@ require (
6159
golang.org/x/term v0.31.0 // indirect
6260
golang.org/x/text v0.24.0 // indirect
6361
gopkg.in/yaml.v2 v2.4.0 // indirect
64-
gopkg.in/yaml.v3 v3.0.1 // indirect
6562
)

0 commit comments

Comments
 (0)