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

+2 -2
View File
@@ -4,8 +4,8 @@
| 项 | 值 |
| --- | --- |
| Go | 1.27.1 及以上(MyGo v0.2.10 的 go.mod 要求) |
| MyGo | v0.2.10,commit 459b512,固定在 go.mod 与 go.sum |
| Go | 1.27.1 及以上(MyGo v0.5.5 的 go.mod 要求) |
| MyGo | v0.5.5,commit 4d8673c,固定在 go.mod 与 go.sum |
| 运行时依赖 | macOS:系统框架。Windows:无需 WebView2。Linux:GTK 3(MyGo 通过 GtkGLArea 绘制) |
## 已实测环境
+1 -1
View File
@@ -12,7 +12,7 @@ layout.TitleBar(c, "Court Records", layout.TitleBarOptions{
})
```
签名:`func TitleBar(c *ui.Context, title string, opts TitleBarOptions) *ui.Element`
签名:`func TitleBar(c *ui.Context, title string, opts TitleBarOptions) ui.Element`
## 参数
+1 -1
View File
@@ -12,7 +12,7 @@ layout.Container(c, layout.ContainerOptions{MaxWidth: 320, Center: true}, func()
})
```
签名:`func Container(c *ui.Context, opts ContainerOptions, children func()) *ui.Element`
签名:`func Container(c *ui.Context, opts ContainerOptions, children func()) ui.Element`
## 参数
+1 -1
View File
@@ -18,7 +18,7 @@ layout.Stack(c, layout.StackOptions{Horizontal: true, Gap: layout.SpaceM}, func(
签名:
- `func Stack(c *ui.Context, opts StackOptions, children func()) *ui.Element`
- `func Stack(c *ui.Context, opts StackOptions, children func()) ui.Element`
## 参数
+2 -2
View File
@@ -16,8 +16,8 @@ layout.Grid(c, layout.GridOptions{Columns: []ui.Track{ui.Fixed(96), ui.Fr(1)}},
签名:
- `func Grid(c *ui.Context, opts GridOptions, children func()) *ui.Element`
- `func GridCell(c *ui.Context, opts GridCellOptions, build func()) *ui.Element`
- `func Grid(c *ui.Context, opts GridOptions, children func()) ui.Element`
- `func GridCell(c *ui.Context, opts GridCellOptions, build func()) ui.Element`
## 参数
+1 -1
View File
@@ -15,7 +15,7 @@ layout.ScrollArea(c, &offset, layout.ScrollAreaOptions{Label: "Log"}, func() {
}).Height(200)
```
签名:`func ScrollArea(c *ui.Context, state *ui.ScrollState, opts ScrollAreaOptions, children func()) *ui.Element`
签名:`func ScrollArea(c *ui.Context, state *ui.ScrollState, opts ScrollAreaOptions, children func()) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ ui.Box(c).Size(320, 240).Children(func() {
})
```
签名:`func AspectRatio(c *ui.Context, opts AspectRatioOptions, child func()) *ui.Element`
签名:`func AspectRatio(c *ui.Context, opts AspectRatioOptions, child func()) ui.Element`
## 参数
+1 -1
View File
@@ -13,7 +13,7 @@ ui.Column(c).Padding(16).Gap(12).Children(func() {
})
```
签名:`func Divider(c *ui.Context, opts DividerOptions) *ui.Element`
签名:`func Divider(c *ui.Context, opts DividerOptions) ui.Element`
## 参数
+1 -1
View File
@@ -21,7 +21,7 @@ view := func(c *ui.Context) {
## 参数
`func Text(c *ui.Context, s string, opts TextOptions) *ui.Element`
`func Text(c *ui.Context, s string, opts TextOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -16,7 +16,7 @@ view := func(c *ui.Context) {
## 参数
`func Heading(c *ui.Context, title string, opts HeadingOptions) *ui.Element`
`func Heading(c *ui.Context, title string, opts HeadingOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -18,7 +18,7 @@ view := func(c *ui.Context) {
## 参数
`func Icon(c *ui.Context, name string, opts IconOptions) *ui.Element`
`func Icon(c *ui.Context, name string, opts IconOptions) ui.Element`
`name` 必填,空字符串 panic。可用名称见 `icons.Names()`。
+1 -1
View File
@@ -18,7 +18,7 @@ view := func(c *ui.Context) {
## 参数
`func Avatar(c *ui.Context, name string, opts AvatarOptions) *ui.Element`
`func Avatar(c *ui.Context, name string, opts AvatarOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -19,7 +19,7 @@ view := func(c *ui.Context) {
## 参数
`func Badge(c *ui.Context, opts BadgeOptions, content func()) *ui.Element`
`func Badge(c *ui.Context, opts BadgeOptions, content func()) ui.Element`
`Position` 为 `BadgeInline` 时 `content` 必须为 `nil`;为角落位置时 `content` 必须不为 `nil`。否则 panic。
+1 -1
View File
@@ -19,7 +19,7 @@ view := func(c *ui.Context) {
## 参数
`func Link(c *ui.Context, label string, opts LinkOptions) *ui.Element`
`func Link(c *ui.Context, label string, opts LinkOptions) ui.Element`
`label` 必填,空字符串 panic。
+1 -1
View File
@@ -18,7 +18,7 @@ view := func(c *ui.Context) {
## 参数
`func Kbd(c *ui.Context, keys ...string) *ui.Element`
`func Kbd(c *ui.Context, keys ...string) ui.Element`
至少要传一个键,键名不能为空,否则 panic。键名不区分大小写:
+1 -1
View File
@@ -12,7 +12,7 @@ if input.Button(c, "Save", input.ButtonOptions{Icon: icons.Must("check")}).Click
}
```
签名:`func Button(c *ui.Context, label string, opts ButtonOptions) *ui.Element`
签名:`func Button(c *ui.Context, label string, opts ButtonOptions) ui.Element`
## 参数
+1 -1
View File
@@ -12,7 +12,7 @@ if input.IconButton(c, icons.Must("settings"), "Settings", input.IconButtonOptio
}
```
签名:`func IconButton(c *ui.Context, icon *ui.SVG, label string, opts IconButtonOptions) *ui.Element`
签名:`func IconButton(c *ui.Context, icon *ui.SVG, label string, opts IconButtonOptions) ui.Element`
## 参数
+1 -1
View File
@@ -16,7 +16,7 @@ input.CheckboxGroup(c, "Notifications", []input.CheckboxItem{
签名:
```go
func Checkbox(c *ui.Context, value *bool, label string, opts CheckboxOptions) *ui.Element
func Checkbox(c *ui.Context, value *bool, label string, opts CheckboxOptions) ui.Element
func CheckboxGroup(c *ui.Context, label string, items []CheckboxItem, opts CheckboxGroupOptions) ChoiceResult
```
+1 -1
View File
@@ -19,7 +19,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Switch(c *ui.Context, on *bool, label string, opts SwitchOptions) *ui.Element`。`label` 为空时请在返回值上调用 `Label` 命名。
`func Switch(c *ui.Context, on *bool, label string, opts SwitchOptions) ui.Element`。`label` 为空时请在返回值上调用 `Label` 命名。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -17,7 +17,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Toggle(c *ui.Context, on *bool, label string, opts ToggleOptions) *ui.Element`。`label` 与 `opts.Label` 至少提供一个,否则 panic。
`func Toggle(c *ui.Context, on *bool, label string, opts ToggleOptions) ui.Element`。`label` 与 `opts.Label` 至少提供一个,否则 panic。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -14,7 +14,7 @@ name := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
res := input.Form(c, &state, input.FormOptions{}, func(f *input.FormScope) {
input.FormItem(c, f, "name", &name, input.FormItemOptions[string]{Label: "Name", Required: true}, func() *ui.Element {
input.FormItem(c, f, "name", &name, input.FormItemOptions[string]{Label: "Name", Required: true}, func() ui.Element {
return input.InputGroup(c, &name, input.InputGroupOptions{Invalid: state.Error("name") != ""}).Input
})
})
+2 -2
View File
@@ -12,7 +12,7 @@
email := ""
view := func(c *ui.Context) {
core.Use(c, core.Settings{})
input.FormField(c, "Email", input.FormFieldOptions{Required: true, Description: "For receipts."}, func() *ui.Element {
input.FormField(c, "Email", input.FormFieldOptions{Required: true, Description: "For receipts."}, func() ui.Element {
return input.InputGroup(c, &email, input.InputGroupOptions{}).Input
})
}
@@ -28,7 +28,7 @@ ui.Render(view, 400, 300, 1)
| `FormFieldOptions.Description` | `string` | "" | 控件下方的说明。 |
| `FormFieldOptions.Error` | `string` | "" | 控件下方的错误,并把控件标记为无效。 |
| `FormFieldOptions.Horizontal` | `bool` | false | 标签在左、控件在右。 |
| `control` | `func() *ui.Element` | 必填 | 构建控件并返回要关联的可聚焦元素(如 `InputGroupParts.Input`);返回 nil 时 panic。 |
| `control` | `func() ui.Element` | 必填 | 构建控件并返回要关联的可聚焦元素(如 `InputGroupParts.Input`);返回零值 `ui.Element{}` 时 panic。 |
## 状态
+1 -1
View File
@@ -15,7 +15,7 @@ if navigation.SegmentedControl(c, &view, []navigation.Segment{
}
```
签名:`func SegmentedControl(c *ui.Context, selected *int, segments []Segment, opts SegmentedControlOptions) *ui.Element`
签名:`func SegmentedControl(c *ui.Context, selected *int, segments []Segment, opts SegmentedControlOptions) ui.Element`
## 参数
+1 -1
View File
@@ -16,7 +16,7 @@ navigation.NavigationMenu(c, router, []navigation.NavigationLink{
router.View(c, func(r *ui.Route) { ui.Text(c, r.Path()) })
```
签名:`func NavigationMenu(c *ui.Context, router *ui.Router, links []NavigationLink, opts NavigationMenuOptions) *ui.Element`
签名:`func NavigationMenu(c *ui.Context, router *ui.Router, links []NavigationLink, opts NavigationMenuOptions) ui.Element`
## 参数
+3 -3
View File
@@ -21,9 +21,9 @@ navigation.Toolbar(c, navigation.ToolbarOptions{Label: "Format"}, func() {
签名:
- `func Toolbar(c *ui.Context, opts ToolbarOptions, fn func()) *ui.Element`
- `func ToolbarButton(c *ui.Context, label string, opts ToolbarButtonOptions) *ui.Element`
- `func ToolbarGroup(c *ui.Context, fn func()) *ui.Element`
- `func Toolbar(c *ui.Context, opts ToolbarOptions, fn func()) ui.Element`
- `func ToolbarButton(c *ui.Context, label string, opts ToolbarButtonOptions) ui.Element`
- `func ToolbarGroup(c *ui.Context, fn func()) ui.Element`
- `func ToolbarSeparator(c *ui.Context)`
## 参数
+1 -1
View File
@@ -20,7 +20,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Card(c *ui.Context, opts CardOptions, body func()) *ui.Element`,`body` 构建内容插槽。
`func Card(c *ui.Context, opts CardOptions, body func()) ui.Element`,`body` 构建内容插槽。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -20,7 +20,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Timeline(c *ui.Context, items []TimelineItem) *ui.Element`。`TimelineItem` 字段:`Time`、`Title`、`Content`、`Status`。
`func Timeline(c *ui.Context, items []TimelineItem) ui.Element`。`TimelineItem` 字段:`Time`、`Title`、`Content`、`Status`。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -20,7 +20,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Statistic(c *ui.Context, value float64, opts StatisticOptions) *ui.Element`。
`func Statistic(c *ui.Context, value float64, opts StatisticOptions) ui.Element`。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -33,7 +33,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Dialog(c *ui.Context, open *bool, opts DialogOptions, content func()) *ui.Element`,关闭时返回 nil。
签名:`func Dialog(c *ui.Context, open *bool, opts DialogOptions, content func()) ui.Element`,关闭时返回 nil。
## 参数
+1 -1
View File
@@ -20,7 +20,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Drawer(c *ui.Context, open *bool, opts DrawerOptions, content func()) *ui.Element`。
签名:`func Drawer(c *ui.Context, open *bool, opts DrawerOptions, content func()) ui.Element`。
## 参数
+1 -1
View File
@@ -21,7 +21,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Popover(c *ui.Context, anchor *ui.Element, open *bool, opts PopoverOptions, content func()) *ui.Element`。`anchor` 必须是本帧已构建的元素,nil 时 panic。
签名:`func Popover(c *ui.Context, anchor ui.Element, open *bool, opts PopoverOptions, content func()) ui.Element`。`anchor` 必须是本帧已构建的元素,nil 时 panic。
## 参数
+1 -1
View File
@@ -15,7 +15,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Tooltip(c *ui.Context, anchor *ui.Element, text string, opts TooltipOptions) *ui.Element`,返回 `anchor`。`anchor` 为 nil 时 panic;`text` 为空时什么也不做。
签名:`func Tooltip(c *ui.Context, anchor ui.Element, text string, opts TooltipOptions) ui.Element`,返回 `anchor`。`anchor` 为 nil 时 panic;`text` 为空时什么也不做。
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func HoverCard(c *ui.Context, anchor *ui.Element, opts HoverCardOptions, content func()) *ui.Element`,返回卡片,未显示时为 nil。
签名:`func HoverCard(c *ui.Context, anchor ui.Element, opts HoverCardOptions, content func()) ui.Element`,返回卡片,未显示时为 nil。
## 参数
+1 -1
View File
@@ -27,7 +27,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func DropdownMenu(c *ui.Context, label string, opts DropdownMenuOptions, build func(m *PopupMenu)) *ui.Element`,返回触发按钮。`build` 为 nil、或 `label` 与 `opts.Label` 都为空时 panic。
签名:`func DropdownMenu(c *ui.Context, label string, opts DropdownMenuOptions, build func(m *PopupMenu)) ui.Element`,返回触发按钮。`build` 为 nil、或 `label` 与 `opts.Label` 都为空时 panic。
## 参数
+1 -1
View File
@@ -22,7 +22,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func ContextMenu(c *ui.Context, target *ui.Element, opts ContextMenuOptions, build func(m *PopupMenu)) *ui.Element`,返回 `target`。`target` 或 `build` 为 nil 时 panic。
签名:`func ContextMenu(c *ui.Context, target ui.Element, opts ContextMenuOptions, build func(m *PopupMenu)) ui.Element`,返回 `target`。`target` 或 `build` 为 nil 时 panic。
## 参数
+1 -1
View File
@@ -21,7 +21,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Popconfirm(c *ui.Context, anchor *ui.Element, open *bool, opts PopconfirmOptions) PopconfirmResult`。`anchor` 为 nil 或 `Title` 为空时 panic。
签名:`func Popconfirm(c *ui.Context, anchor ui.Element, open *bool, opts PopconfirmOptions) PopconfirmResult`。`anchor` 为 nil 或 `Title` 为空时 panic。
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Overlay(c *ui.Context, open *bool, opts OverlayOptions, content func()) *ui.Element`。
签名:`func Overlay(c *ui.Context, open *bool, opts OverlayOptions, content func()) ui.Element`。
## 参数
+2 -2
View File
@@ -17,8 +17,8 @@ feedback.Meter(c, 93, feedback.MeterOptions{
签名:
- `func Progress(c *ui.Context, value float64, opts ProgressOptions) *ui.Element`
- `func Meter(c *ui.Context, value float64, opts MeterOptions) *ui.Element`
- `func Progress(c *ui.Context, value float64, opts ProgressOptions) ui.Element`
- `func Meter(c *ui.Context, value float64, opts MeterOptions) ui.Element`
## 参数
+1 -1
View File
@@ -10,7 +10,7 @@
core.Spinner(c, core.SpinnerOptions{Size: 20, Label: "Syncing", ShowLabel: true})
```
签名:`func Spinner(c *ui.Context, opts SpinnerOptions) *ui.Element`
签名:`func Spinner(c *ui.Context, opts SpinnerOptions) ui.Element`
## 参数
+1 -1
View File
@@ -15,7 +15,7 @@ ui.Row(c).Padding(16).Gap(12).Children(func() {
})
```
签名:`func Skeleton(c *ui.Context, opts SkeletonOptions) *ui.Element`
签名:`func Skeleton(c *ui.Context, opts SkeletonOptions) ui.Element`
## 参数
+1 -1
View File
@@ -11,7 +11,7 @@ feedback.StatusIndicator(c, feedback.StatusSuccess, feedback.StatusIndicatorOpti
feedback.StatusIndicator(c, feedback.StatusOffline, feedback.StatusIndicatorOptions{})
```
签名:`func StatusIndicator(c *ui.Context, status Status, opts StatusIndicatorOptions) *ui.Element`
签名:`func StatusIndicator(c *ui.Context, status Status, opts StatusIndicatorOptions) ui.Element`
## 参数
+1 -1
View File
@@ -25,7 +25,7 @@ ui.Render(view, 400, 200, 1)
## 事件
返回浮层 `*ui.Element`;读数事件由所属 Chart 提供。
返回浮层 `ui.Element`;读数事件由所属 Chart 提供。
## 键盘操作
+1 -1
View File
@@ -24,7 +24,7 @@ ui.Render(view, 400, 100, 1)
## 事件
返回 `*ui.Element`,展示调用方提供的变化值。
返回 `ui.Element`,展示调用方提供的变化值。
## 键盘操作
+1 -1
View File
@@ -12,7 +12,7 @@ chat.MessageBubble(c, chat.MessageAssistant, chat.MessageBubbleOptions{Name: "He
})
```
签名:`func MessageBubble(c *ui.Context, role MessageRole, opts MessageBubbleOptions, content func()) *ui.Element`
签名:`func MessageBubble(c *ui.Context, role MessageRole, opts MessageBubbleOptions, content func()) ui.Element`
## 参数
+1 -1
View File
@@ -10,7 +10,7 @@
chat.MessageHeader(c, chat.MessageHeaderOptions{Model: "herald-2", Time: time.Now(), Status: chat.MessageSent})
```
签名:`func MessageHeader(c *ui.Context, opts MessageHeaderOptions) *ui.Element`
签名:`func MessageHeader(c *ui.Context, opts MessageHeaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -10,7 +10,7 @@
chat.StreamingText(c, reply, chat.StreamingTextOptions{Streaming: true, Smooth: true})
```
签名:`func StreamingText(c *ui.Context, text string, opts StreamingTextOptions) *ui.Element`
签名:`func StreamingText(c *ui.Context, text string, opts StreamingTextOptions) ui.Element`
## 参数
+1 -1
View File
@@ -13,7 +13,7 @@ if chat.LinkPreviewCard(c, p).Clicked() {
}
```
签名:`func LinkPreviewCard(c *ui.Context, p LinkPreview) *ui.Element`
签名:`func LinkPreviewCard(c *ui.Context, p LinkPreview) ui.Element`
## 参数
+1 -1
View File
@@ -12,7 +12,7 @@ if chat.QuoteReply(c, "Marie", "Let them eat cake.").Clicked() {
}
```
签名:`func QuoteReply(c *ui.Context, author, excerpt string) *ui.Element`
签名:`func QuoteReply(c *ui.Context, author, excerpt string) ui.Element`
## 参数
@@ -14,7 +14,7 @@ ui.Box(c).Fill().Children(func() {
})
```
签名:`func ScrollToBottomButton(c *ui.Context, away bool, unread int) *ui.Element`
签名:`func ScrollToBottomButton(c *ui.Context, away bool, unread int) ui.Element`
## 参数
+1 -1
View File
@@ -10,7 +10,7 @@
chat.TypingIndicator(c, "Herald")
```
签名:`func TypingIndicator(c *ui.Context, name string) *ui.Element`
签名:`func TypingIndicator(c *ui.Context, name string) ui.Element`
## 参数
+1 -1
View File
@@ -16,7 +16,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func DateSeparator(c *ui.Context, day Date, opts DateSeparatorOptions) *ui.Element`。`day` 必须是有效日期。
`func DateSeparator(c *ui.Context, day Date, opts DateSeparatorOptions) ui.Element`。`day` 必须是有效日期。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -16,7 +16,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func ThinkingIndicator(c *ui.Context, opts ThinkingIndicatorOptions) *ui.Element`。
`func ThinkingIndicator(c *ui.Context, opts ThinkingIndicatorOptions) ui.Element`。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -16,7 +16,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func CostEstimator(c *ui.Context, opts CostEstimatorOptions) *ui.Element`。另有 `EstimateCost(inputTokens, outputTokens, inputPrice, outputPrice) CostEstimate`。
`func CostEstimator(c *ui.Context, opts CostEstimatorOptions) ui.Element`。另有 `EstimateCost(inputTokens, outputTokens, inputPrice, outputPrice) CostEstimate`。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func AgentStatus(c *ui.Context, state AgentState, opts AgentStatusOptions) *ui.Element`。未知状态 panic。
签名:`func AgentStatus(c *ui.Context, state AgentState, opts AgentStatusOptions) ui.Element`。未知状态 panic。
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func AgentProgress(c *ui.Context, value float64, opts AgentProgressOptions) *ui.Element`。确定模式下 `value` 不在 0 到 1 时 panic。
签名:`func AgentProgress(c *ui.Context, value float64, opts AgentProgressOptions) ui.Element`。确定模式下 `value` 不在 0 到 1 时 panic。
## 参数
+1 -1
View File
@@ -16,7 +16,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func SandboxStatus(c *ui.Context, info SandboxInfo, opts SandboxStatusOptions) *ui.Element`。状态未知、资源名为空、`Limit` 不大于 0 或 `Used` 不在 0 到 `Limit` 之间时 panic。
签名:`func SandboxStatus(c *ui.Context, info SandboxInfo, opts SandboxStatusOptions) ui.Element`。状态未知、资源名为空、`Limit` 不大于 0 或 `Used` 不在 0 到 `Limit` 之间时 panic。
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func DotsLoader(c *ui.Context, opts LoaderOptions) *ui.Element`
签名:`func DotsLoader(c *ui.Context, opts LoaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func BarsLoader(c *ui.Context, opts LoaderOptions) *ui.Element`
签名:`func BarsLoader(c *ui.Context, opts LoaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func PulseLoader(c *ui.Context, opts LoaderOptions) *ui.Element`
签名:`func PulseLoader(c *ui.Context, opts LoaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func OrbitLoader(c *ui.Context, opts LoaderOptions) *ui.Element`
签名:`func OrbitLoader(c *ui.Context, opts LoaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func WaveLoader(c *ui.Context, opts LoaderOptions) *ui.Element`
签名:`func WaveLoader(c *ui.Context, opts LoaderOptions) ui.Element`
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Shimmer(c *ui.Context, loading bool, opts ShimmerOptions, content func()) *ui.Element`
签名:`func Shimmer(c *ui.Context, loading bool, opts ShimmerOptions, content func()) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func CountUp(c *ui.Context, value float64, opts CountUpOptions) *ui.Element`
签名:`func CountUp(c *ui.Context, value float64, opts CountUpOptions) ui.Element`
## 参数
+1 -1
View File
@@ -15,7 +15,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func ShimmerText(c *ui.Context, text string, opts ShimmerTextOptions) *ui.Element`
签名:`func ShimmerText(c *ui.Context, text string, opts ShimmerTextOptions) ui.Element`
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Stagger(c *ui.Context, n int, opts StaggerOptions, item func(i int)) *ui.Element`
签名:`func Stagger(c *ui.Context, n int, opts StaggerOptions, item func(i int)) ui.Element`
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func ReorderTransition[K comparable](c *ui.Context, keys []K, opts ReorderTransitionOptions, item func(key K)) *ui.Element`
签名:`func ReorderTransition[K comparable](c *ui.Context, keys []K, opts ReorderTransitionOptions, item func(key K)) ui.Element`
## 参数
+1 -1
View File
@@ -20,7 +20,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func LayoutTransition(c *ui.Context, opts LayoutTransitionOptions, content func()) *ui.Element`
签名:`func LayoutTransition(c *ui.Context, opts LayoutTransitionOptions, content func()) ui.Element`
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func Presence(c *ui.Context, show bool, opts PresenceOptions, content func()) *ui.Element`
签名:`func Presence(c *ui.Context, show bool, opts PresenceOptions, content func()) ui.Element`
## 参数
+1 -1
View File
@@ -15,7 +15,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func BlinkHighlight(c *ui.Context, value float64, opts BlinkHighlightOptions) *ui.Element`
签名:`func BlinkHighlight(c *ui.Context, value float64, opts BlinkHighlightOptions) ui.Element`
## 参数
+1 -1
View File
@@ -17,7 +17,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func DiffViewer(c *ui.Context, s *DiffViewerState, from, to string, opts DiffViewerOptions) *ui.Element`
签名:`func DiffViewer(c *ui.Context, s *DiffViewerState, from, to string, opts DiffViewerOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func InlineDiff(c *ui.Context, from, to string, opts InlineDiffOptions) *ui.Element`
签名:`func InlineDiff(c *ui.Context, from, to string, opts InlineDiffOptions) ui.Element`
## 参数
+1 -1
View File
@@ -19,7 +19,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func BlameView(c *ui.Context, s *BlameViewState, lines []BlameLine, opts BlameViewOptions) *ui.Element`
签名:`func BlameView(c *ui.Context, s *BlameViewState, lines []BlameLine, opts BlameViewOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func DiffStat(c *ui.Context, added, deleted int, opts DiffStatOptions) *ui.Element`
签名:`func DiffStat(c *ui.Context, added, deleted int, opts DiffStatOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func GitStatusBadge(c *ui.Context, status GitStatus, opts GitStatusBadgeOptions) *ui.Element`
签名:`func GitStatusBadge(c *ui.Context, status GitStatus, opts GitStatusBadgeOptions) ui.Element`
## 参数
+1 -1
View File
@@ -14,7 +14,7 @@ view := func(c *ui.Context) {
ui.Render(view, 400, 300, 1)
```
签名:`func AnsiText(c *ui.Context, text string, opts AnsiTextOptions) *ui.Element`
签名:`func AnsiText(c *ui.Context, text string, opts AnsiTextOptions) ui.Element`
## 参数
+1 -1
View File
@@ -21,7 +21,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func Terminal(c *ui.Context, s *TerminalState, opts TerminalOptions) *ui.Element`。`TerminalState` 零值是 80×24 空屏,由调用方持有;`Write(data)` 写入输出(须在界面线程,例如经 `Window.Update`),`Resize(cols, rows)`、`Lines()`、`LineText(i)`、`Select(a, b)`、`Selection()`、`ScrollBack(n)`、`Offset()`、`Cursor()`、`Size()` 供程序读取与控制。
`func Terminal(c *ui.Context, s *TerminalState, opts TerminalOptions) ui.Element`。`TerminalState` 零值是 80×24 空屏,由调用方持有;`Write(data)` 写入输出(须在界面线程,例如经 `Window.Update`),`Resize(cols, rows)`、`Lines()`、`LineText(i)`、`Select(a, b)`、`Selection()`、`ScrollBack(n)`、`Offset()`、`Cursor()`、`Size()` 供程序读取与控制。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -23,7 +23,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func CompletionMenu(c *ui.Context, anchor *ui.Element, open *bool, items []Completion, s *CompletionMenuState, opts CompletionMenuOptions) CompletionMenuResult`。`anchor` 是编辑器元素(如 `InputResult.Input`);打开期间组件替换它的 `HandleInput` 以先拿到菜单按键。候选为空、禁用或编辑器禁用时自动关闭。列表虚拟化,最多显示 8 行后滚动;窗口下方空间不足时在上方弹出。
`func CompletionMenu(c *ui.Context, anchor ui.Element, open *bool, items []Completion, s *CompletionMenuState, opts CompletionMenuOptions) CompletionMenuResult`。`anchor` 是编辑器元素(如 `InputResult.Input`);打开期间组件替换它的 `HandleInput` 以先拿到菜单按键。候选为空、禁用或编辑器禁用时自动关闭。列表虚拟化,最多显示 8 行后滚动;窗口下方空间不足时在上方弹出。
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -22,7 +22,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func VideoPlayer(c *ui.Context, st VideoState, opts VideoPlayerOptions) *ui.Element`
`func VideoPlayer(c *ui.Context, st VideoState, opts VideoPlayerOptions) ui.Element`
`VideoState`:`Frame`(当前画面,nil 显示“暂无视频”)、`Position`、`Duration`、`Buffered`、`Playing`、`Rate`、`Subtitle`、`SubtitlesOn`、`Fullscreen`、`PiP`。
+1 -1
View File
@@ -21,7 +21,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func AudioPlayer(c *ui.Context, st AudioState, opts AudioPlayerOptions) *ui.Element`
`func AudioPlayer(c *ui.Context, st AudioState, opts AudioPlayerOptions) ui.Element`
`AudioState`:`Title`、`Position`、`Duration`、`Playing`。
+1 -1
View File
@@ -17,7 +17,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func AudioSpectrum(c *ui.Context, bands []float32, opts AudioSpectrumOptions) *ui.Element`
`func AudioSpectrum(c *ui.Context, bands []float32, opts AudioSpectrumOptions) ui.Element`
每个频带取 0 到 1,超出范围 panic。
+1 -1
View File
@@ -21,7 +21,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func MediaControls(c *ui.Context, st MediaControlsState, opts MediaControlsOptions) *ui.Element`
`func MediaControls(c *ui.Context, st MediaControlsState, opts MediaControlsOptions) ui.Element`
`MediaControlsState`:`Playing`、`Loop`(`LoopOff`、`LoopAll`、`LoopOne`)、`Shuffle`、`NoPrevious`、`NoNext`。
@@ -22,7 +22,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func ScreenRecorderControls(c *ui.Context, st RecorderState, opts ScreenRecorderControlsOptions) *ui.Element`
`func ScreenRecorderControls(c *ui.Context, st RecorderState, opts ScreenRecorderControlsOptions) ui.Element`
`RecorderState`:`Status`(`RecorderIdle`、`RecorderRecording`、`RecorderPaused`)、`Elapsed`。
+1 -1
View File
@@ -17,7 +17,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func MicLevelMeter(c *ui.Context, level float32, opts MicLevelMeterOptions) *ui.Element`
`func MicLevelMeter(c *ui.Context, level float32, opts MicLevelMeterOptions) ui.Element`
`level` 为满刻度的 0 到 1,超出 panic。
+1 -1
View File
@@ -20,7 +20,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func EventChip(c *ui.Context, ev CalendarEvent, opts EventChipOptions) *ui.Element`
`func EventChip(c *ui.Context, ev CalendarEvent, opts EventChipOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -26,7 +26,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func EventPopover(c *ui.Context, anchor *ui.Element, open *bool, ev CalendarEvent, opts EventPopoverOptions) EventPopoverResult`
`func EventPopover(c *ui.Context, anchor ui.Element, open *bool, ev CalendarEvent, opts EventPopoverOptions) EventPopoverResult`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
@@ -18,7 +18,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func CurrentTimeIndicator(c *ui.Context, opts CurrentTimeIndicatorOptions) *ui.Element`
`func CurrentTimeIndicator(c *ui.Context, opts CurrentTimeIndicatorOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+1 -1
View File
@@ -17,7 +17,7 @@ ui.Render(view, 400, 300, 1)
## 参数
`func RelativeTime(c *ui.Context, t time.Time, opts RelativeTimeOptions) *ui.Element`
`func RelativeTime(c *ui.Context, t time.Time, opts RelativeTimeOptions) ui.Element`
| 字段 | 类型 | 默认值 | 含义 |
| --- | --- | --- | --- |
+2 -2
View File
@@ -16,7 +16,7 @@ view := func(c *ui.Context) {
core.Use(c, core.Settings{})
account.SettingsLayout(c, &page, pages, account.SettingsLayoutOptions{}, func(id string) {
account.SettingsSection(c, "Notifications", func() {
account.SettingsRow(c, "Sound", account.SettingsRowOptions{ID: "sound"}, func() *ui.Element {
account.SettingsRow(c, "Sound", account.SettingsRowOptions{ID: "sound"}, func() ui.Element {
return input.Switch(c, &sound, "", input.SwitchOptions{})
})
})
@@ -33,7 +33,7 @@ ui.Render(view, 400, 300, 1)
| `pages` | `[]SettingsPage` | 必填 | ID、Label、Icon。 |
| `Title` | `string` | 内置“Settings” | 导航标题。 |
| `content` | `func(id string)` | 必填 | 构建分区内容。 |
| `SettingsRow control` | `func() *ui.Element` | 必填 | 返回控件;行标签与说明关联到它。 |
| `SettingsRow control` | `func() ui.Element` | 必填 | 返回控件;行标签与说明关联到它。 |
| `SettingsRowOptions.ID` | `string` | "" | 供 SettingsSearch 跳转定位。 |
## 状态
+1 -1
View File
@@ -18,7 +18,7 @@ view := func(c *ui.Context) {
}
```
签名:`func Masonry(c *ui.Context, n int, opts MasonryOptions, item func(i int)) *ui.Element`
签名:`func Masonry(c *ui.Context, n int, opts MasonryOptions, item func(i int)) ui.Element`
## 参数
+1 -1
View File
@@ -13,7 +13,7 @@ view := func(c *ui.Context) {
}
```
签名:`func QRCode(c *ui.Context, text string, opts QRCodeOptions) *ui.Element`
签名:`func QRCode(c *ui.Context, text string, opts QRCodeOptions) ui.Element`
## 参数
+1 -1
View File
@@ -16,7 +16,7 @@ view := func(c *ui.Context) {
}
```
签名:`func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) *ui.Element`
签名:`func ActivityFeed(c *ui.Context, items []Activity, opts ActivityFeedOptions) ui.Element`
## 参数