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:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-17 01:37:54 -04:00
1 parent bc716d27be
commit bcce34cda1
603 files changed
+1366 -1277

No files matched your search

+5 -5
View File
@@ -135,7 +135,7 @@ func (g *gallery) formFields(c *ui.Context, f *input.FormScope, log func(string)
s.checks <- formAsync{version, msg}
c.Invalidate()
}()
}}, func() *ui.Element {
}}, func() ui.Element {
return input.TextInput(c, &s.name, input.TextInputOptions{}).Input
})
input.FormItem(c, f, "password", &s.password, input.FormItemOptions[string]{Label: g.t("Password", "密码"), Required: true,
@@ -144,14 +144,14 @@ func (g *gallery) formFields(c *ui.Context, f *input.FormScope, log func(string)
return g.t("Use at least 8 characters.", "至少 8 个字符。")
}
return ""
}}, func() *ui.Element {
}}, func() ui.Element {
r := input.PasswordInput(c, &s.password, input.PasswordInputOptions{})
if r.Submitted() {
s.st.Submit()
}
return r.Input
})
input.FormItem(c, f, "debut", &s.debut, input.FormItemOptions[core.Date]{Label: g.t("Debut date", "首演日期"), Required: true}, func() *ui.Element {
input.FormItem(c, f, "debut", &s.debut, input.FormItemOptions[core.Date]{Label: g.t("Debut date", "首演日期"), Required: true}, func() ui.Element {
r := datetime.DatePicker(c, &s.debut, datetime.DatePickerOptions{Clearable: true})
if r.Changed() {
log("debut " + s.debut.Format("2006-01-02"))
@@ -159,7 +159,7 @@ func (g *gallery) formFields(c *ui.Context, f *input.FormScope, log func(string)
return r.Input
})
input.FormItem(c, f, "roles", &s.tags, input.FormItemOptions[[]string]{Label: g.t("Roles", "担当"), Required: true,
Description: g.t("Up to 4; press Enter after each.", "最多 4 个;每个后按 Enter。")}, func() *ui.Element {
Description: g.t("Up to 4; press Enter after each.", "最多 4 个;每个后按 Enter。")}, func() ui.Element {
r := input.TagsInput(c, &s.tags, input.TagsInputOptions{Max: 4, Invalid: s.st.Error("roles") != "", Placeholder: g.t("keyboard, bass…", "键盘、贝斯…")})
if r.Changed() {
log(fmt.Sprintf("roles %q", s.tags))
@@ -172,7 +172,7 @@ func (g *gallery) formFields(c *ui.Context, f *input.FormScope, log func(string)
return g.t("Accept the terms to continue.", "请先同意条款。")
}
return ""
}}, func() *ui.Element {
}}, func() ui.Element {
e := input.Checkbox(c, &s.terms, g.t("I accept the covenant of the masquerade", "我接受假面舞会的盟约"), input.CheckboxOptions{})
if e.Changed() {
log(fmt.Sprintf("terms %v", s.terms))