Add data components 151-175; clear MyGo row highlights

Lists, tables, trees, grids, inventories and records in data/.
Outline and GridView build on ui.List: ui.Outline strokes its arrows
and ui.GridView spaces and tints items. The pixel theme keeps MyGo's
row highlights clear so scrolled rows stay on whole dots; off lists
take a veil against the wheel. Adds Canvas.Silhouette, SwitchOptions
Label and exports Rarity.Slot.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 22:29:07 -04:00
1 parent f587d25a5a
commit 03680980da
47 files changed
+3379 -17

No files matched your search

+11
View File
@@ -221,3 +221,14 @@ func TestGridCopyFollowsTheLocale(t *testing.T) {
t.Fatal("END or the unlock banner ignores the locale")
}
}
func TestSwitchLabelNamesABarePlate(t *testing.T) {
lever := false
tt := view(300, 100, nil, func(c *ui.Context) {
input.Switch(c, "", &lever, input.SwitchOptions{Label: "Fly"})
})
click(t, tt, "Fly")
if !lever || len(tt.Texts()) != 1 {
t.Fatalf("switch %v, texts %q", lever, tt.Texts())
}
}
+3 -1
View File
@@ -10,6 +10,8 @@ import (
type SwitchOptions struct {
Disabled bool
// Label names it for assistive technology; zero uses text.
Label string
}
type SwitchResult struct {
@@ -20,7 +22,7 @@ type SwitchResult struct {
// Switch is a lever on an OFF/ON plate.
func Switch(c *ui.Context, text string, on *bool, o SwitchOptions) SwitchResult {
k := pixel.K(c)
shell, base, st := pixel.Shell(c, func() *ui.Element { return ui.SwitchBase(c, on).Label(text).Disabled(o.Disabled) })
shell, base, st := pixel.Shell(c, func() *ui.Element { return ui.SwitchBase(c, on).Label(label(o.Label, text)).Disabled(o.Disabled) })
shell.Size(k.D(32+pixel.Measure(text)), k.D(pixel.LineHeight)).Draw(func(p *ui.Painter, r ui.Rect) {
g := k.Canvas(p, r)
g.Frame(0, 1, 27, 14, pixel.Raised, pixel.Shade)