Elements are now pass-scoped value handles: tests that read bounds after a frame bind a ui.Handle. pixel tells frames apart by the build pass's root, since the Tester clock no longer moves on its own. Fix the regressions the upgrade brought: - Clipboard reads in input handlers go through c.Services(). - MyGo notes an overlay's opener after building it, so AutoFocus inside lost it; pixel.AutoFocus focuses through a Handle, and archtest bans the raw call. Dialogs hand the focus back again. - Elements around a press stay hovered: Tooltip tells a press-given focus by focus arriving under the pointer. - The web host moves the Tester clock with real time, at most 500 ms a call, and gives components the real clock. The gallery's source index also accepts CRLF checkouts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package data
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/text"
|
|
)
|
|
|
|
// Activity is one entry of a feed.
|
|
type Activity struct {
|
|
Icon *pixel.Sprite
|
|
Text, Time string
|
|
}
|
|
|
|
type FeedOptions struct{}
|
|
|
|
// Feed lists activity: icon, text and time, dotted apart.
|
|
func Feed(c *ui.Context, entries []Activity, o FeedOptions) ui.Element {
|
|
k := pixel.K(c)
|
|
return ui.Column(c).FillWidth().Children(func() {
|
|
for i, a := range entries {
|
|
last := i == len(entries)-1
|
|
ui.Row(c).FillWidth().Gap(k.D(6)).Padding(k.D(4), 0).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
if !last {
|
|
g := k.Canvas(p, r)
|
|
g.Checker(0, g.H-1, g.W, 1, pixel.Edge)
|
|
}
|
|
}).Children(func() {
|
|
ui.Box(c).Size(k.D(12), k.D(12)).Shrink(0).Role(ui.RoleNone).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
if a.Icon != nil {
|
|
k.Canvas(p, r).Sprite(0, 0, a.Icon, 0, pixel.Accent, 1)
|
|
}
|
|
})
|
|
ui.Column(c).Grow(1).Children(func() {
|
|
text.Paragraph(c, a.Text, text.ParagraphOptions{})
|
|
pixel.Text(c, a.Time, pixel.TextOptions{Slot: pixel.Faint})
|
|
})
|
|
})
|
|
}
|
|
})
|
|
}
|