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:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-17 01:31:08 -04:00
1 parent 1f3d38110e
commit 03e1f91706
532 files changed
+828 -735

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ type BlinkTextOptions struct {
}
// BlinkText blinks; under Reduce Motion it stays shown.
func BlinkText(c *ui.Context, s string, o BlinkTextOptions) *ui.Element {
func BlinkText(c *ui.Context, s string, o BlinkTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
fps := pixel.Or("BlinkText FPS", o.FPS, 4)
return block(c, k, s, pixel.Measure(s)*sc, pixel.LineHeight*sc, func(g pixel.Canvas) {
+1 -1
View File
@@ -11,7 +11,7 @@ type CodeOptions struct {
}
// Code is an inline chip on Well, bordered in Edge.
func Code(c *ui.Context, s string, o CodeOptions) *ui.Element {
func Code(c *ui.Context, s string, o CodeOptions) ui.Element {
k := pixel.K(c)
return block(c, k, s, pixel.Measure(s)+6, pixel.LineHeight+2, func(g pixel.Canvas) {
g.Frame(0, 0, g.W, g.H, pixel.Flat, pixel.Well)
+1 -1
View File
@@ -13,7 +13,7 @@ type GradientTextOptions struct {
}
// GradientText dithers glyph dots from Top down to Bottom.
func GradientText(c *ui.Context, s string, o GradientTextOptions) *ui.Element {
func GradientText(c *ui.Context, s string, o GradientTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
top, bottom := slotOr(o.Top, pixel.AccentLit), slotOr(o.Bottom, pixel.Accent)
return block(c, k, s, pixel.Measure(s)*sc, pixel.LineHeight*sc, func(g pixel.Canvas) {
+1 -1
View File
@@ -15,7 +15,7 @@ type HeadingOptions struct {
}
// Heading is a title with a 1-dot Shade shadow.
func Heading(c *ui.Context, s string, o HeadingOptions) *ui.Element {
func Heading(c *ui.Context, s string, o HeadingOptions) ui.Element {
level := pixel.Or("Heading Level", o.Level, 1)
if level > 3 {
panic(fmt.Sprintf("text: Heading Level %d outside 1–3", level))
+1 -1
View File
@@ -15,7 +15,7 @@ type HighlightOptions struct {
}
// Highlight marks each match of query in s, ignoring case.
func Highlight(c *ui.Context, s, query string, o HighlightOptions) *ui.Element {
func Highlight(c *ui.Context, s, query string, o HighlightOptions) ui.Element {
k := pixel.K(c)
mark := slotOr(o.Mark, pixel.Warn)
rs := []rune(s)
+1 -1
View File
@@ -11,7 +11,7 @@ type KbdOptions struct {
}
// Kbd is a keycap with depth; Pressed sinks it.
func Kbd(c *ui.Context, label string, o KbdOptions) *ui.Element {
func Kbd(c *ui.Context, label string, o KbdOptions) ui.Element {
k := pixel.K(c)
face := pixel.LineHeight + 2
return block(c, k, label, pixel.Measure(label)+10, face+3, func(g pixel.Canvas) {
+2 -2
View File
@@ -13,14 +13,14 @@ type LinkOptions struct {
}
type LinkResult struct {
Element *ui.Element
Element ui.Element
Clicked bool
}
// Link is underlined text opening url on click or Enter.
func Link(c *ui.Context, label, url string, o LinkOptions) LinkResult {
k := pixel.K(c)
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.RoleLink).Label(label).Description(url).Disabled(o.Disabled).Cursor(ui.CursorPointer)
})
w := pixel.Measure(label)
+1 -1
View File
@@ -17,7 +17,7 @@ type marqueeKey struct{}
type marqueeState struct{ offset, last int }
// Marquee scrolls s a dot a step; hover pauses it.
func Marquee(c *ui.Context, s string, o MarqueeOptions) *ui.Element {
func Marquee(c *ui.Context, s string, o MarqueeOptions) ui.Element {
k := pixel.K(c)
w := pixel.Or("Marquee Width", o.Width, 120)
e := ui.Box(c).Size(k.D(w), k.D(pixel.LineHeight)).Clip().Label(s).Role(ui.RoleText)
+1 -1
View File
@@ -14,7 +14,7 @@ type MicroTextOptions struct {
}
// MicroText draws s upper-cased in micro font; unknown runes panic.
func MicroText(c *ui.Context, s string, o MicroTextOptions) *ui.Element {
func MicroText(c *ui.Context, s string, o MicroTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
up := strings.ToUpper(s)
return block(c, k, s, pixel.MicroWidth(up)*sc, pixel.MicroHeight*sc, func(g pixel.Canvas) {
+1 -1
View File
@@ -26,7 +26,7 @@ type odoState struct {
const odoCell = 10
// Odometer rolls its digits toward value, step by step.
func Odometer(c *ui.Context, value int, o OdometerOptions) *ui.Element {
func Odometer(c *ui.Context, value int, o OdometerOptions) ui.Element {
if value < 0 {
panic(fmt.Sprintf("text: Odometer value %d is negative", value))
}
+1 -1
View File
@@ -13,7 +13,7 @@ type OutlineTextOptions struct {
}
// OutlineText rings every glyph dot of s with Edge.
func OutlineText(c *ui.Context, s string, o OutlineTextOptions) *ui.Element {
func OutlineText(c *ui.Context, s string, o OutlineTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
fill := slotOr(o.Slot, pixel.Lit)
return block(c, k, s, pixel.Measure(s)*sc+2, pixel.LineHeight*sc+2, func(g pixel.Canvas) {
+1 -1
View File
@@ -25,7 +25,7 @@ type ParagraphOptions struct {
}
// Paragraph wraps s at the width it had last frame.
func Paragraph(c *ui.Context, s string, o ParagraphOptions) *ui.Element {
func Paragraph(c *ui.Context, s string, o ParagraphOptions) ui.Element {
k := pixel.K(c)
gap := pixel.Or("Paragraph Gap", o.Gap, 0)
if o.Align > Right {
+1 -1
View File
@@ -18,7 +18,7 @@ type QuoteOptions struct {
}
// Quote is a block quote with bar, mark and cite.
func Quote(c *ui.Context, s string, o QuoteOptions) *ui.Element {
func Quote(c *ui.Context, s string, o QuoteOptions) ui.Element {
k := pixel.K(c)
return ui.Row(c).Gap(k.D(6)).AlignItems(ui.Stretch).Role(ui.RoleGroup).Children(func() {
ui.Box(c).Width(k.D(2)).Draw(func(p *ui.Painter, r ui.Rect) {
+1 -1
View File
@@ -15,7 +15,7 @@ type RainbowTextOptions struct {
}
// RainbowText gives each character the next slot of a band.
func RainbowText(c *ui.Context, s string, o RainbowTextOptions) *ui.Element {
func RainbowText(c *ui.Context, s string, o RainbowTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
band := o.Band
if len(band) == 0 {
+1 -1
View File
@@ -23,7 +23,7 @@ type scrambleState struct {
}
// ScrambleText settles from random glyphs to s, left to right.
func ScrambleText(c *ui.Context, s string, o ScrambleTextOptions) *ui.Element {
func ScrambleText(c *ui.Context, s string, o ScrambleTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
fps := pixel.Or("ScrambleText FPS", o.FPS, 15)
rs := []rune(s)
+1 -1
View File
@@ -24,7 +24,7 @@ type SevenSegmentOptions struct {
}
// SevenSegment shows digits, minus and colon with ghost segments.
func SevenSegment(c *ui.Context, s string, o SevenSegmentOptions) *ui.Element {
func SevenSegment(c *ui.Context, s string, o SevenSegmentOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
ink := slotOr(o.Slot, pixel.Bad)
w := 0
+1 -1
View File
@@ -12,7 +12,7 @@ type ShadowTextOptions struct {
}
// ShadowText drops a 1-dot Shade shadow behind s.
func ShadowText(c *ui.Context, s string, o ShadowTextOptions) *ui.Element {
func ShadowText(c *ui.Context, s string, o ShadowTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
return block(c, k, s, pixel.Measure(s)*sc+1, pixel.LineHeight*sc+1, func(g pixel.Canvas) {
g.Text(1, 1, s, pixel.Shade, sc)
+1 -1
View File
@@ -13,7 +13,7 @@ type ShakeTextOptions struct {
}
// ShakeText jitters each character a dot, seeded, at 12 fps.
func ShakeText(c *ui.Context, s string, o ShakeTextOptions) *ui.Element {
func ShakeText(c *ui.Context, s string, o ShakeTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
return block(c, k, s, pixel.Measure(s)*sc+2, pixel.LineHeight*sc+2, func(g pixel.Canvas) {
step := g.Step(12)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
)
// block is a w×h dot text box that fn draws.
func block(c *ui.Context, k pixel.Kit, s string, w, h int, fn func(g pixel.Canvas)) *ui.Element {
func block(c *ui.Context, k pixel.Kit, s string, w, h int, fn func(g pixel.Canvas)) ui.Element {
return ui.Box(c).Size(k.D(w), k.D(h)).Label(s).Role(ui.RoleText).Draw(func(p *ui.Painter, r ui.Rect) {
fn(k.Canvas(p, r))
})
+2 -2
View File
@@ -23,7 +23,7 @@ type TypewriterOptions struct {
}
type TypewriterResult struct {
Element *ui.Element
Element ui.Element
// Done is true in the frame the whole text shows.
Done bool
}
@@ -45,7 +45,7 @@ func Typewriter(c *ui.Context, s string, o TypewriterOptions) TypewriterResult {
}
// S5 steps at 4–15 fps; fast typing shows more.
fps := max(4, min(cps, 15))
shell, base, st := pixel.Shell(c, func() *ui.Element {
shell, base, st := pixel.Shell(c, func() ui.Element {
e := ui.Box(c).Role(ui.RoleText).Label(s).Disabled(o.Disabled)
if !o.Disabled {
e.Focusable()
+1 -1
View File
@@ -16,7 +16,7 @@ type WaveTextOptions struct {
}
// WaveText bobs characters on a sine wave at 10 fps.
func WaveText(c *ui.Context, s string, o WaveTextOptions) *ui.Element {
func WaveText(c *ui.Context, s string, o WaveTextOptions) ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
amp := pixel.Or("WaveText Amp", o.Amp, 2)
return block(c, k, s, pixel.Measure(s)*sc, pixel.LineHeight*sc+2*amp, func(g pixel.Canvas) {