Conversation
- ref: #50 Signed-off-by: Liam Stanley <liam@liam.sh>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 94.07% 93.19% -0.89%
==========================================
Files 5 5
Lines 270 235 -35
==========================================
- Hits 254 219 -35
Misses 15 15
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
|
Hey @lrstanley, just want to drop this in and let you know that we're using this branch and patches in Soft Serve v2 https://github.com/aymanbagabas/bubblezone/tree/v2-exp. Please let me know if you have any comments or concerns 🙂 |
Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
…ound color message Signed-off-by: Liam Stanley <liam@liam.sh>
* chore: bump dependencies to charm.land modules * fix: update examples and tests with new bubbletea v2 logic Signed-off-by: Liam Stanley <liam@liam.sh> * feat: update readme for v2 Signed-off-by: Liam Stanley <liam@liam.sh> --------- Signed-off-by: Liam Stanley <liam@liam.sh> Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
|
ok, I am really lost now. I migrated to v2-exp but no matter what I seem to do Just to that I'm not going insane: v2-exp should work right? all the checklists I saw in this repo regarding v2 were checked off, that's what I based my conclusion on. package main
import (
"time"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
zone "github.com/lrstanley/bubblezone/v2"
)
func main() {
zone.NewGlobal()
tea.NewProgram(model{}).Run()
}
// Just a generic tea.Model to demo terminal information of ssh.
type model struct {
width int
height int
message string
}
func (m model) Init() tea.Cmd {
return nil
}
type resetMessage struct{}
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case resetMessage:
m.message = ""
case tea.MouseReleaseMsg:
if msg.Button == tea.MouseLeft && zone.Get("button").InBounds(msg) {
m.message = "Clicked"
return m, tea.Tick(time.Millisecond*500, func(t time.Time) tea.Msg {
return resetMessage{}
})
}
case tea.KeyPressMsg:
if msg.Text == "q" {
return m, tea.Quit
}
case tea.WindowSizeMsg:
m.height = msg.Height
m.width = msg.Width
}
return m, nil
}
func (m model) View() tea.View {
button := lipgloss.NewLayer(zone.Mark("button", lipgloss.NewStyle().Background(lipgloss.Blue).Render("Click me!")))
message := lipgloss.NewLayer(m.message)
quit := lipgloss.NewLayer(lipgloss.NewStyle().Foreground(lipgloss.Color("8")).Render("Press 'q' to quit\n"))
c := lipgloss.NewCanvas(
button,
message.Y(button.GetHeight()+1),
quit.Y(m.height-1),
)
v := tea.NewView(c.Render())
v.AltScreen = true
v.MouseMode = tea.MouseModeAllMotion
return v
} |
You're missing the main bubblezone/examples/full-lipgloss/main.go Line 98 in 7266b25 That said, I will say that using layers and more complex compositing, which is available with lipgloss/bubbletea v2, you may encounter issues with bubblezone v2 -- zone markers may get cut when other layers are on top of another layer. Specifically, when you use multiple z-indexed layers. There is a more native approach to mouse event tracking with layers/compositing, but I have yet to work through the support for it yet in bubblezone. However, I have been experimenting. |
|
I'm such an idiot sometimes. I had commented out the zone.Scan line in my code for some reason. Works like a charm now. Sorry to waste your time like this... edit: ok, so not a complete idiot after all, I forgot it in my repro. but zone.Get does return nil when using the new canvas and layers |
Warning
THIS SHOULD NOT BE MERGED UNTIL the Charm team has fully released all of the associated charm libraries.
This PR is currently tagged as
github.com/lrstanley/bubblezone/v2@v2.0.0-alpha.3. Use with:You can find the API for v2 here: https://pkg.go.dev/github.com/lrstanley/bubblezone/v2@v2.0.0-alpha.3
🚀 Changes proposed by this PR
charm.land/bubbletea/v2charm.land/lipgloss/v2charm.land/bubbles/v2TODO
compatfor v2, and switch examples away from adaptive.tea.Modelandtea.ViewModel-- everything I have now is just temporary for now I think.github.com/muesli/ansiv2of this library.v2of this library.🔗 Related bug reports/feature requests
🧰 Type of change
🤝 Requirements