Add chat components 321-345; named List rows, inert scroll views

Speech bubbles, a chat log that follows its end, a composer that sends
on Enter, typing dots, chat and channel lists, read receipts,
reactions, emoji and sticker pickers, mentions, date and unread rules,
system lines, member lists, user cards, a mailbox, mail reader and
letter, a notification bell, call controls, a voice meter, attachment
chips, link previews and polls.

pixel's editor takes EnterSends; display's Bubble takes a Fill and
exports EmojiSprite. data.List names its rows, which also lets typing
choose one. layout.ScrollArea and input.TextArea hold still under
Inert, and an inert scroll view leaves the Tab order until it wakes.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-12 05:02:36 -04:00
1 parent 8be66c09f2
commit 455f5f2a05
50 files changed
+2697 -34

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package input_test
import (
"bytes"
"testing"
"github.com/egoist/mygo/ui"
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/input"
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
)
func TestTextAreaHoldsStillWhenInert(t *testing.T) {
v, inert := "1\n2\n3\n4\n5\n6\n7\n8", false
tt := ui.NewTester(func(c *ui.Context) {
pixel.Use(c, pixel.Settings{Palette: pixel.SpringDay, Inert: inert})
input.TextArea(c, "Notes", &v, input.TextAreaOptions{Lines: 2})
}, 400, 200)
r, ok := tt.Find("Notes")
if !ok {
t.Fatal("no Notes")
}
inert = true
tt.Frame()
before := tt.Image()
// The caret keeps the view at the end; wheel upward.
tt.Move(r.X+10, r.Y+10)
tt.Scroll(r.X+10, r.Y+10, 0, -80)
tt.Frame()
if !bytes.Equal(before.Pix, tt.Image().Pix) {
t.Fatal("the wheel scrolled an inert text area")
}
}
+5 -2
View File
@@ -16,6 +16,8 @@ type TextAreaOptions struct {
// Width is zero for 160 dots, Lines zero for 4.
Width, Lines int
Disabled bool
// EnterSends submits on Enter; Shift+Enter breaks lines.
EnterSends bool
}
type areaKey struct{}
@@ -36,7 +38,8 @@ func TextArea(c *ui.Context, text string, value *string, o TextAreaOptions) Text
lines := pixel.Or("TextArea Lines", o.Lines, 4)
col := ui.Column(c).Width(k.D(pixel.Or("TextArea Width", o.Width, 160))).Gap(k.D(2))
st := ui.Local(col, areaKey{}, func() areaState { return areaState{line: -1} })
if o.Disabled {
// Disabled or inert, the view holds still.
if o.Disabled || pixel.Current(c).Inert {
st.scroll.Y = st.held
}
var ed pixel.Edit
@@ -46,7 +49,7 @@ func TextArea(c *ui.Context, text string, value *string, o TextAreaOptions) Text
g := k.Canvas(p, r)
g.Frame(0, 0, g.W, g.H, pixel.Sunken, pixel.Well)
}).Children(func() {
ed = pixel.Editor(c, value, pixel.EditorOptions{Multiline: true, Label: text, Placeholder: o.Placeholder, MaxLength: o.MaxLength, Disabled: o.Disabled})
ed = pixel.Editor(c, value, pixel.EditorOptions{Multiline: true, Label: text, Placeholder: o.Placeholder, MaxLength: o.MaxLength, Disabled: o.Disabled, EnterSends: o.EnterSends})
})
// Keep the caret's line in view after it moves.
if ed.Line != st.line || *value != st.text {