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
@@ -16,7 +16,7 @@ type BingoCardOptions struct {
|
||||
}
|
||||
|
||||
type BingoCardResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Bingo is the first full line, this frame.
|
||||
Changed, Bingo bool
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type CardHandOptions struct {
|
||||
}
|
||||
|
||||
type CardHandResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Played is the card played this frame, else -1.
|
||||
Played int
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func CardHand(c *ui.Context, text string, cards []Card, o CardHandOptions) CardH
|
||||
n := len(cards)
|
||||
w := max(cardW, fan*(n-1)+cardW)
|
||||
res.Element = col.Children(func() {
|
||||
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.RoleGroup).Label(text).Disabled(o.Disabled)
|
||||
})
|
||||
*cur = max(0, min(*cur, n-1))
|
||||
|
||||
@@ -39,7 +39,7 @@ type ChessboardOptions struct {
|
||||
}
|
||||
|
||||
type ChessboardResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Moved is this frame's move, From one square To another.
|
||||
Moved bool
|
||||
From, To int
|
||||
|
||||
@@ -23,7 +23,7 @@ var (
|
||||
const coinUp = 18
|
||||
|
||||
// CoinFlip tosses a coin on a new Cue.
|
||||
func CoinFlip(c *ui.Context, text string, heads bool, o CoinFlipOptions) *ui.Element {
|
||||
func CoinFlip(c *ui.Context, text string, heads bool, o CoinFlipOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
word := k.Msg("tails")
|
||||
if heads {
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ type DeckOptions struct {
|
||||
}
|
||||
|
||||
type DeckResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Drawn is a card taken this frame.
|
||||
Drawn bool
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func Deck(c *ui.Context, text string, count int, o DeckOptions) DeckResult {
|
||||
panic(fmt.Sprintf("tabletop: Deck of %d", count))
|
||||
}
|
||||
left := fmt.Sprintf(k.Msg("cards_left"), count)
|
||||
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.RoleButton).Label(text).Description(left).Disabled(o.Disabled || count == 0)
|
||||
})
|
||||
res := DeckResult{Element: shell, Drawn: !base.IsDisabled() && base.Clicked()}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ type DiceOptions struct {
|
||||
var hop = [...]int{0, 3, 5, 6, 6, 5, 3, 1}
|
||||
|
||||
// Dice is a d6 showing value; new Cues tumble it.
|
||||
func Dice(c *ui.Context, text string, value int, o DiceOptions) *ui.Element {
|
||||
func Dice(c *ui.Context, text string, value int, o DiceOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if value < 1 || value > 6 {
|
||||
panic(fmt.Sprintf("tabletop: Dice value %d", value))
|
||||
|
||||
@@ -14,7 +14,7 @@ type DiceTrayOptions struct {
|
||||
}
|
||||
|
||||
// DiceTray holds several dice on felt, and their total.
|
||||
func DiceTray(c *ui.Context, text string, values []int, o DiceTrayOptions) *ui.Element {
|
||||
func DiceTray(c *ui.Context, text string, values []int, o DiceTrayOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if len(values) == 0 {
|
||||
panic("tabletop: DiceTray has no dice")
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ type DominoOptions struct {
|
||||
}
|
||||
|
||||
// Domino is a tile of two halves of 0–6 pips.
|
||||
func Domino(c *ui.Context, a, b int, o DominoOptions) *ui.Element {
|
||||
func Domino(c *ui.Context, a, b int, o DominoOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if a < 0 || a > 6 || b < 0 || b > 6 {
|
||||
panic(fmt.Sprintf("tabletop: Domino %d|%d", a, b))
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ type GoBoardOptions struct {
|
||||
}
|
||||
|
||||
type GoBoardResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Placed is the point played this frame, else -1.
|
||||
Placed int
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ var (
|
||||
const tileW, tileH = 26, 34
|
||||
|
||||
// MahjongTile is a suit or honor tile, or its back.
|
||||
func MahjongTile(c *ui.Context, t Tile, o MahjongTileOptions) *ui.Element {
|
||||
func MahjongTile(c *ui.Context, t Tile, o MahjongTileOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if t.Family < Dots || t.Family > Dragons || t.Rank < 1 || t.Rank > families[t.Family].ranks {
|
||||
panic(fmt.Sprintf("tabletop: MahjongTile %+v", t))
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ type MeepleOptions struct {
|
||||
}
|
||||
|
||||
// Meeple is a player's token, standing in its slot.
|
||||
func Meeple(c *ui.Context, text string, o MeepleOptions) *ui.Element {
|
||||
func Meeple(c *ui.Context, text string, o MeepleOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if o.Player < 0 || o.Player >= len(players) {
|
||||
panic(fmt.Sprintf("tabletop: Meeple player %d", o.Player))
|
||||
|
||||
@@ -12,7 +12,7 @@ type PlayingCardOptions struct {
|
||||
}
|
||||
|
||||
// PlayingCard is a card: rank and suit, or its back.
|
||||
func PlayingCard(c *ui.Context, cd Card, o PlayingCardOptions) *ui.Element {
|
||||
func PlayingCard(c *ui.Context, cd Card, o PlayingCardOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
cd.check("PlayingCard")
|
||||
name := cd.name(k)
|
||||
|
||||
@@ -18,7 +18,7 @@ type RouletteOptions struct {
|
||||
const wheel = 28
|
||||
|
||||
// Roulette spins its wheel, on a new Cue, to result.
|
||||
func Roulette(c *ui.Context, text string, segments []string, result int, o RouletteOptions) *ui.Element {
|
||||
func Roulette(c *ui.Context, text string, segments []string, result int, o RouletteOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
n := len(segments)
|
||||
if n < 2 || n > 64 || result < 0 || result >= n || slices.Contains(segments, "") {
|
||||
|
||||
@@ -19,7 +19,7 @@ type ScoreTrackOptions struct {
|
||||
const space = 20
|
||||
|
||||
// ScoreTrack winds a path; player meeples mark their scores.
|
||||
func ScoreTrack(c *ui.Context, text string, scores []int, o ScoreTrackOptions) *ui.Element {
|
||||
func ScoreTrack(c *ui.Context, text string, scores []int, o ScoreTrackOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
n := pixel.Or("ScoreTrack Spaces", o.Spaces, 30)
|
||||
// A space prints three digits at most.
|
||||
|
||||
@@ -13,7 +13,7 @@ type TicTacToeOptions struct {
|
||||
}
|
||||
|
||||
type TicTacToeResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Played is the cell you took this frame, else -1.
|
||||
Played int
|
||||
// Over is the game ending this frame; Restarted, the CONTINUE.
|
||||
|
||||
Reference in new issue
Block a user