Upgrade MyGo to v0.5.5
MyGo v0.5.5 returns ui.Element as a checked value handle instead of a
pointer. Migrated with `mygo migrate-ui`, then fixed what the codemod
leaves to review:
- Element nil checks become .Valid(); absent elements are ui.Element{}.
- Input handlers and paint callbacks run outside the build pass, where
elements expire and Context methods are inert: read IsDisabled into a
local during the build, keep a ui.Handle for Focus, use c.Services()
for clipboard access, create ui.Local state during the build.
- Add core.AutoFocus: v0.5.5 records an overlay's opener after its
content builds, so same-frame autofocus lost focus restore on close.
It focuses one frame later; cascader rows defer their focus likewise.
- core.OverlayLayer identifies build passes by the root element, not
c.Now(), which repeats across passes and under the Tester clock.
- Context menus survive the opening press counted as PressedOutside;
split button tooltip no longer reorders its open menu; disabled
menubar rows pass presses to the panel; Form defers blur-started
async checks so the growing message no longer moves Submit away
from the release; Combobox drops its disabled copy now that MyGo
blocks typing under a disabled wrapper (canary flipped to a guard).
- The Tester clock is virtual: tests use Advance/Now instead of
time.Sleep/time.Now and read element state inside the view. The web
mirror advances the clock to wall time before each frame and input.
- AGENTS.md and docs describe the value Element API and the new pin.
Snapshot goldens are darwin-only and were not re-verified here.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bc716d27be
commit
bcce34cda1
603 files changed
+1366
-1277
No files matched your search
@@ -47,7 +47,7 @@ type activityFeedCache struct {
|
||||
}
|
||||
|
||||
// ActivityFeed lists events grouped by day, newest first as given, building only the rows in view.
|
||||
func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) *ui.Element {
|
||||
func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) ui.Element {
|
||||
loc := cmp.Or(opts.Location, time.Local)
|
||||
for _, a := range items {
|
||||
if a.ID == "" || a.Actor == "" || a.Action == "" || a.Time.IsZero() {
|
||||
@@ -92,7 +92,7 @@ func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) *ui
|
||||
ui.Box(c).FillWidth().Height(rowH * float32(len(cache.rows))).Children(func() {
|
||||
for r := first; r < last; r++ {
|
||||
row := cache.rows[r]
|
||||
box := ui.Row(c).Key(r).Absolute().Left(0).Right(0).Top(rowH*float32(r)).Height(rowH).
|
||||
box := ui.Row(c.Key(r)).Absolute().Left(0).Right(0).Top(rowH*float32(r)).Height(rowH).
|
||||
AlignItems(ui.Center).Gap(d.Unit()*3).Padding(0, d.Unit()*3)
|
||||
if row.item < 0 {
|
||||
activityFeedHeader(c, k, box, row.day, today)
|
||||
@@ -106,7 +106,7 @@ func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) *ui
|
||||
}
|
||||
|
||||
// activityFeedHeader is a day's title: Today, Yesterday or the date, over an ornament rule.
|
||||
func activityFeedHeader(c *ui.Context, k theme.Tokens, box *ui.Element, day, today core.Date) {
|
||||
func activityFeedHeader(c *ui.Context, k theme.Tokens, box ui.Element, day, today core.Date) {
|
||||
label := core.DatetimeDayLabel(c, day)
|
||||
switch day {
|
||||
case today:
|
||||
@@ -122,7 +122,7 @@ func activityFeedHeader(c *ui.Context, k theme.Tokens, box *ui.Element, day, tod
|
||||
}
|
||||
|
||||
// activityFeedEvent is one event: avatar, "Actor action Object", and the time.
|
||||
func activityFeedEvent(c *ui.Context, k theme.Tokens, box *ui.Element, a Activity, loc *time.Location) {
|
||||
func activityFeedEvent(c *ui.Context, k theme.Tokens, box ui.Element, a Activity, loc *time.Location) {
|
||||
when := a.Time.In(loc).Format("15:04")
|
||||
box.Role(ui.RoleListItem).Label(a.Actor + " " + a.Action + " " + a.Object + ", " + when)
|
||||
box.Children(func() {
|
||||
|
||||
Reference in new issue
Block a user