mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
feat(tui): add inline home footer slot (#48798)
This commit is contained in:
committed by
GitHub
Unverified
parent
f1149efee7
commit
55e1b3eb17
@@ -191,6 +191,7 @@ export interface PanelInput {
|
||||
export interface SlotMap {
|
||||
readonly app: Readonly<Record<string, never>>
|
||||
readonly "home.footer": Readonly<Record<string, never>>
|
||||
readonly "home.footer.status": Readonly<Record<string, never>>
|
||||
readonly "prompt.footer": PromptFooterInput
|
||||
readonly "prompt.footer.status": PromptFooterInput
|
||||
readonly "prompt.footer.file": PromptFooterInput
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Plugin } from "@opencode/plugin/tui"
|
||||
import { createMemo, Match, Show, Switch } from "solid-js"
|
||||
import { useTerminalDimensions } from "@opentui/solid"
|
||||
import { usePlugin } from "../../plugin/context"
|
||||
import { Slot } from "../../plugin/render"
|
||||
|
||||
export function homeFooterVisibility(width: number) {
|
||||
return {
|
||||
@@ -91,6 +92,7 @@ function View(props: { context: Plugin.Context }) {
|
||||
>
|
||||
<Mcp context={props.context} />
|
||||
<Plugins context={props.context} />
|
||||
<Slot path="home.footer.status" />
|
||||
<box flexGrow={1} />
|
||||
<Show when={visibility().version}>
|
||||
<box flexShrink={0}>
|
||||
|
||||
@@ -27,7 +27,6 @@ import { useTuiLifecycle } from "../context/runtime"
|
||||
import { useClient } from "../context/client"
|
||||
import { useData } from "../context/data"
|
||||
import { errorMessage } from "../util/error"
|
||||
import { builtins } from "./builtins"
|
||||
import { createPluginContext, usePluginHost, type Dispose, type RegisteredSlot, type SlotRender } from "./api"
|
||||
import { createSourceWatcher } from "./watch"
|
||||
import { discoverPluginTargets, localSource } from "./discovery"
|
||||
@@ -306,6 +305,7 @@ export function PluginProvider(props: ParentProps<{ packages: PackageSource; dir
|
||||
|
||||
// Resolve: fold entries into one desired generation. A source that fails
|
||||
// to import keeps its running previous version and only reports failure.
|
||||
const { builtins } = await import("./builtins")
|
||||
const desired = new Map<string, Desired>()
|
||||
for (const plugin of builtins)
|
||||
desired.set(plugin.id, { plugin, source: "builtin", version: "builtin", enabled: true })
|
||||
|
||||
@@ -391,8 +391,8 @@ if (context.ui.tabs.enabled()) {
|
||||
|
||||
## Slots
|
||||
|
||||
Slots insert or replace JSX at `app`, `home.footer`, `prompt.footer`, `prompt.footer.status`, `prompt.footer.file`,
|
||||
`session.composer.top`, `sidebar.content`, or `sidebar.footer`.
|
||||
Slots insert or replace JSX at `app`, `home.footer`, `home.footer.status`, `prompt.footer`, `prompt.footer.status`,
|
||||
`prompt.footer.file`, `session.composer.top`, `sidebar.content`, or `sidebar.footer`.
|
||||
|
||||
```tsx
|
||||
return context.ui.slot({
|
||||
@@ -411,6 +411,13 @@ context.ui.slot({ after: "home.footer", render: () => <text>After footer slot</t
|
||||
context.ui.slot({ replace: "home.footer", render: () => <text>New footer</text> })
|
||||
```
|
||||
|
||||
Use `home.footer.status` to add content to the built-in footer row without replacing it. Status contributions appear
|
||||
after OpenCode's health indicators and before the version.
|
||||
|
||||
```tsx
|
||||
context.ui.slot({ append: "home.footer.status", render: () => <text>SYNCED</text> })
|
||||
```
|
||||
|
||||
### Session panels
|
||||
|
||||
Register a contribution to `session.panel`, then open the panel from a command. The host owns sizing, focus, and
|
||||
|
||||
Reference in New Issue
Block a user