Upgrade MyGo to v0.5.5
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>
This commit is contained in:
1 parent
1f3d38110e
commit
03e1f91706
532 files changed
+828
-735
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ type AboutOptions struct {
|
||||
}
|
||||
|
||||
// About shows the title as a logo, version, then credits.
|
||||
func About(c *ui.Context, title, version string, o AboutOptions) *ui.Element {
|
||||
func About(c *ui.Context, title, version string, o AboutOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if version == "" {
|
||||
panic("account: About needs a version")
|
||||
|
||||
@@ -22,7 +22,7 @@ type AccessibilityOptionsOptions struct {
|
||||
}
|
||||
|
||||
type AccessibilityOptionsResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,14 +24,14 @@ func choice(name string, i *int, n int) {
|
||||
func words(k pixel.Kit, key string) []string { return strings.Fields(k.Msg(key)) }
|
||||
|
||||
// caption is a line of micro text named for readers.
|
||||
func caption(c *ui.Context, k pixel.Kit, s string, slot pixel.Slot) *ui.Element {
|
||||
func caption(c *ui.Context, k pixel.Kit, s string, slot pixel.Slot) ui.Element {
|
||||
return ui.Box(c).Size(k.D(pixel.MicroWidth(s)), k.D(5)).Role(ui.RoleText).Label(s).Draw(func(p *ui.Painter, r ui.Rect) {
|
||||
k.Canvas(p, r).Micro(0, 0, s, slot, 1)
|
||||
})
|
||||
}
|
||||
|
||||
// mark draws s unnamed, beside the control that names it.
|
||||
func mark(c *ui.Context, k pixel.Kit, s string, slot pixel.Slot, w int) *ui.Element {
|
||||
func mark(c *ui.Context, k pixel.Kit, s string, slot pixel.Slot, w int) ui.Element {
|
||||
return ui.Box(c).Size(k.D(max(w, pixel.Measure(s))), k.D(pixel.LineHeight)).Draw(func(p *ui.Painter, r ui.Rect) {
|
||||
k.Canvas(p, r).Text(0, 0, s, slot, 1)
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@ type AccountSwitcherOptions struct {
|
||||
}
|
||||
|
||||
type AccountSwitcherResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func AccountSwitcher(c *ui.Context, text string, names [4]string, current *int,
|
||||
label += ", " + k.Msg("in_use")
|
||||
}
|
||||
// The shell draws the card; the base stays bare.
|
||||
shell, base, st := pixel.Shell(c, func() *ui.Element {
|
||||
shell, base, st := pixel.Shell(c, func() ui.Element {
|
||||
return ui.ButtonBase(c).Role(ui.RoleRadio).Label(label).Disabled(o.Disabled)
|
||||
})
|
||||
if base.Clicked() && *current != i {
|
||||
|
||||
@@ -113,7 +113,7 @@ type CharacterCreatorOptions struct {
|
||||
}
|
||||
|
||||
type CharacterCreatorResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ var pad = []struct {
|
||||
type ControllerMapOptions struct{}
|
||||
|
||||
// ControllerMap draws a pad; labels say what each button does.
|
||||
func ControllerMap(c *ui.Context, text string, labels map[PadButton]string, o ControllerMapOptions) *ui.Element {
|
||||
func ControllerMap(c *ui.Context, text string, labels map[PadButton]string, o ControllerMapOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
var said []string
|
||||
for b := DPad; b <= Select; b++ {
|
||||
|
||||
@@ -15,7 +15,7 @@ type DifficultySelectOptions struct {
|
||||
}
|
||||
|
||||
type DifficultySelectResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ type FeedbackFormOptions struct {
|
||||
}
|
||||
|
||||
type FeedbackFormResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Sent bool
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ type KeyBindingsOptions struct {
|
||||
}
|
||||
|
||||
type KeyBindingsResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func KeyBindings(c *ui.Context, text string, binds []Binding, o KeyBindingsOptio
|
||||
panic("account: KeyBindings has no bindings")
|
||||
}
|
||||
w, rh := pixel.Or("KeyBindings Width", o.Width, 200), pixel.LineHeight+4
|
||||
shell, base, st := pixel.Shell(c, func() *ui.Element {
|
||||
shell, base, st := pixel.Shell(c, func() ui.Element {
|
||||
return ui.Box(c).Focusable().Role(ui.RoleList).Label(text).Disabled(o.Disabled)
|
||||
})
|
||||
kb := ui.Local(base, bindKey{}, func() capture { return capture{} })
|
||||
|
||||
@@ -19,7 +19,7 @@ type LoginFormOptions struct {
|
||||
}
|
||||
|
||||
type LoginFormResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Submitted bool
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type OptionCyclerOptions struct {
|
||||
}
|
||||
|
||||
type OptionCyclerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func OptionCycler(c *ui.Context, text string, options []string, selected *int, o
|
||||
longest = max(longest, pixel.Measure(s))
|
||||
}
|
||||
w := pixel.Or("OptionCycler Width", o.Width, longest)
|
||||
shell, base, st := pixel.Shell(c, func() *ui.Element {
|
||||
shell, base, st := pixel.Shell(c, func() ui.Element {
|
||||
return ui.Box(c).Focusable().Role(ui.RoleStepper).Label(text).Disabled(o.Disabled)
|
||||
})
|
||||
n, old := len(options), *selected
|
||||
|
||||
@@ -13,7 +13,7 @@ type PalettePickerOptions struct {
|
||||
}
|
||||
|
||||
type PalettePickerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ type PasswordGridOptions struct {
|
||||
}
|
||||
|
||||
type PasswordGridResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Submitted is END on a full password.
|
||||
Changed, Submitted bool
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ type PatchNotesOptions struct {
|
||||
}
|
||||
|
||||
// PatchNotes lists versions, each line tagged ADDED, FIXED or CHANGED.
|
||||
func PatchNotes(c *ui.Context, title string, patches []Patch, o PatchNotesOptions) *ui.Element {
|
||||
func PatchNotes(c *ui.Context, title string, patches []Patch, o PatchNotesOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
w := pixel.Or("PatchNotes Width", o.Width, 240)
|
||||
// Tags draw in the main font, so any locale reads.
|
||||
|
||||
@@ -14,7 +14,7 @@ type PlayerSelectOptions struct {
|
||||
}
|
||||
|
||||
type PlayerSelectResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Chosen is Enter, Space or a click on a row.
|
||||
Changed, Chosen bool
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type ProfileCardOptions struct {
|
||||
}
|
||||
|
||||
// ProfileCard shows a player: face, name, level, title and stats.
|
||||
func ProfileCard(c *ui.Context, p Profile, o ProfileCardOptions) *ui.Element {
|
||||
func ProfileCard(c *ui.Context, p Profile, o ProfileCardOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if p.Level < 1 {
|
||||
panic(fmt.Sprintf("account: ProfileCard level %d", p.Level))
|
||||
|
||||
@@ -27,7 +27,7 @@ type SessionListOptions struct {
|
||||
}
|
||||
|
||||
type SessionListResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// SignedOut is the session signed out this frame, else -1.
|
||||
SignedOut int
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type SettingsListOptions struct {
|
||||
}
|
||||
|
||||
// SettingsList sets controls beside labels under section titles.
|
||||
func SettingsList(c *ui.Context, text string, sections []SettingsSection, o SettingsListOptions) *ui.Element {
|
||||
func SettingsList(c *ui.Context, text string, sections []SettingsSection, o SettingsListOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
return ui.Column(c).Width(k.D(pixel.Or("SettingsList Width", o.Width, 240))).Gap(k.D(2)).Role(ui.RoleGroup).Label(text).Children(func() {
|
||||
for i, s := range sections {
|
||||
|
||||
@@ -19,7 +19,7 @@ type TwoFactorOptions struct {
|
||||
}
|
||||
|
||||
type TwoFactorResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Submitted is the sixth box filled.
|
||||
Changed, Submitted bool
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ type VolumeMixerOptions struct {
|
||||
}
|
||||
|
||||
type VolumeMixerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user