From b9750cd06593ce66b300d0f4d99914ef2463a3a5 Mon Sep 17 00:00:00 2001 From: Ilya Savitsky Date: Fri, 15 Nov 2024 11:00:02 +0000 Subject: [PATCH] Update to bubbletea v2, lipgloss v2 and bubbles v2 Signed-off-by: Ilya Savitsky --- bubble/bubble.go | 8 +++---- bubble/list/defaultitem.go | 6 ++--- bubble/list/list.go | 29 ++++++++++-------------- bubble/list/style.go | 13 ++++++----- bubble/ranking/ranking.go | 2 +- go.mod | 21 ++++++++++-------- go.sum | 45 ++++++++++++++++++++++---------------- header/header.go | 7 +++--- help/help.go | 2 +- keymaps/keymaps.go | 2 +- meta/meta.go | 2 +- syntax/syntax.go | 11 +++++----- tree/tree.go | 2 +- tree/tree_test.go | 2 +- 14 files changed, 79 insertions(+), 73 deletions(-) diff --git a/bubble/bubble.go b/bubble/bubble.go index 66a9f60b..f4f3e0e6 100644 --- a/bubble/bubble.go +++ b/bubble/bubble.go @@ -10,8 +10,8 @@ import ( "clx/favorites" "clx/settings" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" ) var docStyle = lipgloss.NewStyle() @@ -20,8 +20,8 @@ type model struct { list *list.Model } -func (m model) Init() tea.Cmd { - return nil +func (m model) Init() (tea.Model, tea.Cmd) { + return m, nil } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { diff --git a/bubble/list/defaultitem.go b/bubble/list/defaultitem.go index 1eedd32d..d94b3389 100644 --- a/bubble/list/defaultitem.go +++ b/bubble/list/defaultitem.go @@ -13,9 +13,9 @@ import ( "github.com/nleeper/goment" - "github.com/charmbracelet/bubbles/key" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/key" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" "github.com/muesli/reflow/truncate" ) diff --git a/bubble/list/list.go b/bubble/list/list.go index 16296228..3d0afddb 100644 --- a/bubble/list/list.go +++ b/bubble/list/list.go @@ -11,7 +11,7 @@ import ( "clx/app" - "github.com/charmbracelet/bubbles/viewport" + "github.com/charmbracelet/bubbles/v2/viewport" "clx/reader" @@ -33,10 +33,10 @@ import ( "clx/tree" "clx/validator" - "github.com/charmbracelet/bubbles/paginator" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/paginator" + "github.com/charmbracelet/bubbles/v2/spinner" + tea "github.com/charmbracelet/bubbletea/v2" + "github.com/charmbracelet/lipgloss/v2" ) const ( @@ -153,11 +153,6 @@ func New(delegate ItemDelegate, config *settings.Config, cat *categories.Categor p.Type = paginator.Dots p.ActiveDot = styles.ActivePaginationDot.String() p.InactiveDot = styles.InactivePaginationDot.String() - p.UseHLKeys = false - p.UseJKKeys = false - p.UseLeftRightKeys = false - p.UsePgUpPgDownKeys = false - p.UseUpDownKeys = false bufferCategory := 1 items := make([][]*item.Item, numberOfCategories+bufferCategory) @@ -449,9 +444,7 @@ func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd) { heightOfHeaderAndStatusLine := 4 - m.viewport = viewport.New(windowSizeMsg.Width, windowSizeMsg.Height-heightOfHeaderAndStatusLine) - m.viewport.YPosition = 2 - m.viewport.HighPerformanceRendering = false + m.viewport = viewport.New(viewport.WithWidth(windowSizeMsg.Width), viewport.WithHeight(windowSizeMsg.Height-heightOfHeaderAndStatusLine)) content := lipgloss.NewStyle(). Width(windowSizeMsg.Width). @@ -502,8 +495,8 @@ func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd) { footerHeight := 2 verticalMarginHeight := headerHeight + footerHeight - m.viewport.Width = msg.Width - m.viewport.Height = msg.Height - verticalMarginHeight + m.viewport.SetWidth(msg.Width) + m.viewport.SetHeight(msg.Height - verticalMarginHeight) m.width = msg.Width m.height = msg.Height @@ -648,8 +641,8 @@ func (m *Model) updateHelpScreen(msg tea.Msg) (*Model, tea.Cmd) { footerHeight := lipgloss.Height("") verticalMarginHeight := headerHeight + footerHeight - m.viewport.Width = msg.Width - m.viewport.Height = msg.Height - verticalMarginHeight + m.viewport.SetWidth(msg.Width) + m.viewport.SetHeight(msg.Height - verticalMarginHeight) m.width = msg.Width m.height = msg.Height @@ -661,7 +654,7 @@ func (m *Model) updateHelpScreen(msg tea.Msg) (*Model, tea.Cmd) { m.viewport.SetContent(content.String()) - return m, viewport.Sync(m.viewport) + return m, nil } diff --git a/bubble/list/style.go b/bubble/list/style.go index cccaf420..5ebd0127 100644 --- a/bubble/list/style.go +++ b/bubble/list/style.go @@ -3,8 +3,9 @@ package list import ( "time" - "github.com/charmbracelet/bubbles/spinner" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/bubbles/v2/spinner" + "github.com/charmbracelet/lipgloss/v2" + "github.com/charmbracelet/lipgloss/v2/compat" ) const ( @@ -61,10 +62,10 @@ func DefaultStyles() (s Styles) { // Faint(true) s.FilterPrompt = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"}) + Foreground(compat.AdaptiveColor{Light: "#04B575", Dark: "#ECFD65"}) s.FilterCursor = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}) + Foreground(compat.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}) s.DefaultFilterCharacterMatch = lipgloss.NewStyle().Underline(true) @@ -75,12 +76,12 @@ func DefaultStyles() (s Styles) { s.StatusEmpty = lipgloss.NewStyle() s.StatusBarActiveFilter = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}) + Foreground(compat.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}) s.StatusBarFilterCount = lipgloss.NewStyle() s.NoItems = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#909090", Dark: "#626262"}) + Foreground(compat.AdaptiveColor{Light: "#909090", Dark: "#626262"}) s.ArabicPagination = lipgloss.NewStyle() diff --git a/bubble/ranking/ranking.go b/bubble/ranking/ranking.go index 10ee58f9..b8443795 100644 --- a/bubble/ranking/ranking.go +++ b/bubble/ranking/ranking.go @@ -4,7 +4,7 @@ import ( "strconv" "strings" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" "github.com/logrusorgru/aurora/v3" ) diff --git a/go.mod b/go.mod index dfca8c9a..218988cd 100644 --- a/go.mod +++ b/go.mod @@ -7,10 +7,10 @@ require ( github.com/MichaelMure/go-term-text v0.3.1 github.com/PuerkitoBio/goquery v1.10.0 github.com/bobesa/go-domain-util v0.0.0-20190911083921-4033b5f7dd89 - github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.2.1 + github.com/charmbracelet/bubbles/v2 v2.0.0-alpha.2 + github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2 github.com/charmbracelet/glamour v0.8.0 - github.com/charmbracelet/lipgloss v1.0.0 + github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2 github.com/go-resty/resty/v2 v2.16.0 github.com/go-shiori/go-readability v0.0.0-20241012063810-92284fa8a71f github.com/jedib0t/go-pretty/v6 v6.6.1 @@ -29,31 +29,34 @@ require ( github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect + github.com/charmbracelet/colorprofile v0.1.6 // indirect + github.com/charmbracelet/lipgloss v1.0.0 // indirect github.com/charmbracelet/x/ansi v0.4.5 // indirect - github.com/charmbracelet/x/term v0.2.0 // indirect + github.com/charmbracelet/x/cellbuf v0.0.3 // indirect + github.com/charmbracelet/x/term v0.2.1 // indirect + github.com/charmbracelet/x/wcwidth v0.0.0-20241011142426-46044092ad91 // indirect + github.com/charmbracelet/x/windows v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect - github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect github.com/gorilla/css v1.0.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tkuchiki/go-timezone v0.2.3 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yuin/goldmark v1.7.6 // indirect github.com/yuin/goldmark-emoji v1.0.4 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index e50d5b64..9469db9c 100644 --- a/go.sum +++ b/go.sum @@ -23,28 +23,36 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/bobesa/go-domain-util v0.0.0-20190911083921-4033b5f7dd89 h1:2pkAuIM8OF1fy4ToFpMnI4oE+VeUNRbGrpSLKshK0oQ= github.com/bobesa/go-domain-util v0.0.0-20190911083921-4033b5f7dd89/go.mod h1:/09nEjna1UMoasyyQDhOrIn8hi2v2kiJglPWed1idck= -github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= -github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.2.1 h1:J041h57zculJKEKf/O2pS4edXGIz+V0YvojvfGXePIk= -github.com/charmbracelet/bubbletea v1.2.1/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI= +github.com/charmbracelet/bubbles/v2 v2.0.0-alpha.2 h1:Oevn3XNNcccbI8m6cOI6rAMsY1niKsDMv55qtejWRXE= +github.com/charmbracelet/bubbles/v2 v2.0.0-alpha.2/go.mod h1:BWGE1i9NQA60C720gn2FYOyRyJp2BVtQNVfai7wcMoM= +github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2 h1:NkQFWhCii9NtL7Q0L/4mNKtZFgrDpfPSVZAzTwEJdGg= +github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2/go.mod h1:24niqT9RbtXhWg8zLRU/v/xTixlo1+DUsHQZ3+kez5Y= +github.com/charmbracelet/colorprofile v0.1.6 h1:nMMqCns0c0DfCwNGdagBh6SxutFqkltSxxKk5S9kt+Y= +github.com/charmbracelet/colorprofile v0.1.6/go.mod h1:3EMXDxwRDJl0c17eJ1jX99MhtlP9OxE/9Qw0C5lvyUg= github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= +github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2 h1:Gp+S9hMymU6HmxD1dihbnoMOGwt6wDMMvf0jyw3gEc0= +github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2/go.mod h1:72/7KVsLdRldv/CeBjZx6igXIZ9CFtBzQUmDEbhXZ3w= github.com/charmbracelet/x/ansi v0.4.5 h1:LqK4vwBNaXw2AyGIICa5/29Sbdq58GbGdFngSexTdRM= github.com/charmbracelet/x/ansi v0.4.5/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= -github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q= -github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= -github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= -github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= +github.com/charmbracelet/x/cellbuf v0.0.3 h1:HapUUjlo0pZ7iGijrTer1f4X8Uvq17l0zR+80Oh+iJg= +github.com/charmbracelet/x/cellbuf v0.0.3/go.mod h1:SF8R3AqchNzYKKJCFT7co8wt1HgQDfAitQ+SBoxWLNc= +github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= +github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= +github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= +github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= +github.com/charmbracelet/x/wcwidth v0.0.0-20241011142426-46044092ad91 h1:D5OO0lVavz7A+Swdhp62F9gbkibxmz9B2hZ/jVdMPf0= +github.com/charmbracelet/x/wcwidth v0.0.0-20241011142426-46044092ad91/go.mod h1:Ey8PFmYwH+/td9bpiEx07Fdx9ZVkxfIjWXxBluxF4Nw= +github.com/charmbracelet/x/windows v0.2.0 h1:ilXA1GJjTNkgOm94CLPeSz7rar54jtFatdmoiONPuEw= +github.com/charmbracelet/x/windows v0.2.0/go.mod h1:ZibNFR49ZFqCXgP76sYanisxRyC+EYrBE7TTknD8s1s= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/go-resty/resty/v2 v2.16.0 h1:qpKalHWI2bpp9BIKlyT8TYWEJXOk1NuKbfiT3RRnzWc= github.com/go-resty/resty/v2 v2.16.0/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU= github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c h1:wpkoddUomPfHiOziHZixGO5ZBS73cKqVzZipfrLmO1w= @@ -72,16 +80,12 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= @@ -120,6 +124,8 @@ github.com/tkuchiki/go-timezone v0.2.3 h1:D3TVdIPrFsu9lxGxqNX2wsZwn1MZtTqTW0mdev github.com/tkuchiki/go-timezone v0.2.3/go.mod h1:oFweWxYl35C/s7HMVZXiA19Jr9Y0qJHMaG/J2TES4LY= github.com/wayneashleyberry/terminal-dimensions v1.1.0 h1:EB7cIzBdsOzAgmhTUtTTQXBByuPheP/Zv1zL2BRPY6g= github.com/wayneashleyberry/terminal-dimensions v1.1.0/go.mod h1:2lc/0eWCObmhRczn2SdGSQtgBooLUzIotkkEGXqghyg= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.6 h1:cZgJxVh5mL5cu8KOnwxvFJy5TFB0BHUskZZyq7TYbDg= @@ -131,6 +137,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -148,12 +156,11 @@ golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -163,8 +170,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= diff --git a/header/header.go b/header/header.go index ecb3ab64..57e5003f 100644 --- a/header/header.go +++ b/header/header.go @@ -4,8 +4,9 @@ import ( "clx/categories" "fmt" "strings" + "image/color" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" ) func GetHeader(allCategories []int, hasFavorites bool, selectedSubHeader int, width int) string { @@ -94,7 +95,7 @@ func removeFirstElement(list []string) []string { return list[1:] } -func getColor(i int, selectedSubHeader int, numCategories int, hasFavorites bool) (color lipgloss.TerminalColor, isSelected bool) { +func getColor(i int, selectedSubHeader int, numCategories int, hasFavorites bool) (color color.Color, isSelected bool) { if i+1 == selectedSubHeader { return getSelectedCategoryColor(i+1, numCategories, hasFavorites) } @@ -102,7 +103,7 @@ func getColor(i int, selectedSubHeader int, numCategories int, hasFavorites bool return lipgloss.NoColor{}, false } -func getSelectedCategoryColor(selectedSubHeader int, numCategories int, hasFavorites bool) (color lipgloss.TerminalColor, +func getSelectedCategoryColor(selectedSubHeader int, numCategories int, hasFavorites bool) (color color.Color, isSelected bool) { magenta := lipgloss.Color("5") yellow := lipgloss.Color("3") diff --git a/help/help.go b/help/help.go index 47e121f7..1f4ed8d8 100644 --- a/help/help.go +++ b/help/help.go @@ -5,7 +5,7 @@ import ( "clx/constants/unicode" "clx/info" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" ) const ( diff --git a/keymaps/keymaps.go b/keymaps/keymaps.go index 5f46aad5..70baf828 100644 --- a/keymaps/keymaps.go +++ b/keymaps/keymaps.go @@ -3,7 +3,7 @@ package keymaps import ( "strings" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" termText "github.com/MichaelMure/go-term-text" "github.com/jedib0t/go-pretty/v6/text" diff --git a/meta/meta.go b/meta/meta.go index 9235edd1..afcc4c9b 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -16,7 +16,7 @@ import ( . "github.com/logrusorgru/aurora/v3" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" ) const ( diff --git a/syntax/syntax.go b/syntax/syntax.go index 67876b89..c7de0d2b 100644 --- a/syntax/syntax.go +++ b/syntax/syntax.go @@ -4,11 +4,12 @@ import ( "github.com/logrusorgru/aurora/v3" "regexp" "strings" + "image/color" "clx/constants/nerdfonts" "clx/constants/unicode" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" ) const ( @@ -95,7 +96,7 @@ func getYear(text string, highlightType int) string { } } -func label(text string, fg lipgloss.TerminalColor, bg lipgloss.TerminalColor, highlightType int, enableNerdFonts bool) string { +func label(text string, fg color.Color, bg color.Color, highlightType int, enableNerdFonts bool) string { content := lipgloss.NewStyle(). Foreground(fg). Background(bg) @@ -126,7 +127,7 @@ func label(text string, fg lipgloss.TerminalColor, bg lipgloss.TerminalColor, hi getRightBorder(bg, highlightType, enableNerdFonts) } -func getLeftBorder(bg lipgloss.TerminalColor, highlightType int, enableNerdFonts bool) string { +func getLeftBorder(bg color.Color, highlightType int, enableNerdFonts bool) string { if enableNerdFonts { borderStyle := getBorderStyle(bg, highlightType, enableNerdFonts) return borderStyle.Render(nerdfonts.LeftSeparator) @@ -136,7 +137,7 @@ func getLeftBorder(bg lipgloss.TerminalColor, highlightType int, enableNerdFonts return borderStyle.Render(" ") } -func getRightBorder(bg lipgloss.TerminalColor, highlightType int, enableNerdFonts bool) string { +func getRightBorder(bg color.Color, highlightType int, enableNerdFonts bool) string { if enableNerdFonts { borderStyle := getBorderStyle(bg, highlightType, enableNerdFonts) return borderStyle.Render(nerdfonts.RightSeparator) @@ -146,7 +147,7 @@ func getRightBorder(bg lipgloss.TerminalColor, highlightType int, enableNerdFont return borderStyle.Render(" ") } -func getBorderStyle(bg lipgloss.TerminalColor, highlightType int, enableNerdFonts bool) lipgloss.Style { +func getBorderStyle(bg color.Color, highlightType int, enableNerdFonts bool) lipgloss.Style { if !enableNerdFonts { return lipgloss.NewStyle(). Background(bg) diff --git a/tree/tree.go b/tree/tree.go index 6ed007ba..832e6ffd 100644 --- a/tree/tree.go +++ b/tree/tree.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" "clx/constants/nerdfonts" diff --git a/tree/tree_test.go b/tree/tree_test.go index 9ad1d2f9..d77514a6 100644 --- a/tree/tree_test.go +++ b/tree/tree_test.go @@ -2,7 +2,7 @@ package tree_test import ( "encoding/json" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" "github.com/muesli/termenv" "os" "testing"