chore: generate

This commit is contained in:
opencode-agent[bot]
2026-05-21 22:36:00 +00:00
parent ee008923f3
commit 87d4cb07b0
4 changed files with 49 additions and 30 deletions

View File

@@ -82,12 +82,12 @@ export function DiffViewerFileTree(props: DiffViewerFileTreeProps) {
Math.max(1, props.width - FILE_TREE_HORIZONTAL_PADDING - prefix().length - status().length), Math.max(1, props.width - FILE_TREE_HORIZONTAL_PADDING - prefix().length - status().length),
) )
return ( return (
<box flexDirection="row" width="100%" backgroundColor={highlighted() ? props.theme.primary : undefined}> <box
<text flexDirection="row"
fg={highlighted() ? props.theme.background : fadedColor()} width="100%"
wrapMode="none" backgroundColor={highlighted() ? props.theme.primary : undefined}
flexShrink={0} >
> <text fg={highlighted() ? props.theme.background : fadedColor()} wrapMode="none" flexShrink={0}>
{prefix()} {prefix()}
</text> </text>
<box flexGrow={1} minWidth={0}> <box flexGrow={1} minWidth={0}>
@@ -108,7 +108,11 @@ export function DiffViewerFileTree(props: DiffViewerFileTreeProps) {
{name()} {name()}
</text> </text>
</box> </box>
<text fg={highlighted() ? props.theme.background : props.theme.textMuted} wrapMode="none" flexShrink={0}> <text
fg={highlighted() ? props.theme.background : props.theme.textMuted}
wrapMode="none"
flexShrink={0}
>
{status()} {status()}
</text> </text>
</box> </box>

View File

@@ -33,12 +33,13 @@ export function Panel(props: Omit<JSX.IntrinsicElements["box"], "border"> & { bo
const { theme } = useTheme() const { theme } = useTheme()
const [local, boxProps] = splitProps(props, ["border"]) const [local, boxProps] = splitProps(props, ["border"])
const border = local.border ?? "start" const border = local.border ?? "start"
const borderProps = border === "none" const borderProps =
? {} border === "none"
: { ? {}
border: panelBorderSides(group?.axis ?? "y", border), : {
borderColor: theme.border, border: panelBorderSides(group?.axis ?? "y", border),
} borderColor: theme.border,
}
return ( return (
<box <box

View File

@@ -192,10 +192,7 @@ describe("diff viewer file tree utilities", () => {
test("moves collapsed chain selection to first visible child", () => { test("moves collapsed chain selection to first visible child", () => {
const rows = flattenFileTree( const rows = flattenFileTree(
buildFileTree([ buildFileTree([{ file: "packages/opencode/src/cli/app.ts" }, { file: "packages/opencode/src/server/server.ts" }]),
{ file: "packages/opencode/src/cli/app.ts" },
{ file: "packages/opencode/src/server/server.ts" },
]),
) )
const packages = rows.find((row) => row.kind === "directory" && row.name === "packages/opencode/src")! const packages = rows.find((row) => row.kind === "directory" && row.name === "packages/opencode/src")!
const cli = rows.find((row) => row.kind === "directory" && row.name === "cli")! const cli = rows.find((row) => row.kind === "directory" && row.name === "cli")!
@@ -205,10 +202,7 @@ describe("diff viewer file tree utilities", () => {
test("moves file and collapsed directory selection to visible parent", () => { test("moves file and collapsed directory selection to visible parent", () => {
const rows = flattenFileTree( const rows = flattenFileTree(
buildFileTree([ buildFileTree([{ file: "packages/opencode/src/cli/app.ts" }, { file: "packages/opencode/src/server/server.ts" }]),
{ file: "packages/opencode/src/cli/app.ts" },
{ file: "packages/opencode/src/server/server.ts" },
]),
) )
const root = rows.find((row) => row.kind === "directory" && row.name === "packages/opencode/src")! const root = rows.find((row) => row.kind === "directory" && row.name === "packages/opencode/src")!
const cli = rows.find((row) => row.kind === "directory" && row.name === "cli")! const cli = rows.find((row) => row.kind === "directory" && row.name === "cli")!

View File

@@ -28,8 +28,8 @@ const theme = {
describe("DiffViewerFileTree", () => { describe("DiffViewerFileTree", () => {
test("renders sorted hierarchical file rows", async () => { test("renders sorted hierarchical file rows", async () => {
const app = await testRender( const app = await testRender(
() => withTheme( () =>
() => ( withTheme(() => (
<DiffViewerFileTree <DiffViewerFileTree
width={32} width={32}
files={[ files={[
@@ -44,8 +44,7 @@ describe("DiffViewerFileTree", () => {
theme={theme} theme={theme}
focused={true} focused={true}
/> />
), )),
),
{ width: 40, height: 20 }, { width: 40, height: 20 },
) )
@@ -67,11 +66,15 @@ describe("DiffViewerFileTree", () => {
}) })
test("keeps loading and error quiet while rendering an empty settled state", async () => { test("keeps loading and error quiet while rendering an empty settled state", async () => {
const loading = await renderFrame(() => <DiffViewerFileTree width={32} files={[]} loading={true} error={undefined} theme={theme} />) const loading = await renderFrame(() => (
<DiffViewerFileTree width={32} files={[]} loading={true} error={undefined} theme={theme} />
))
const failed = await renderFrame(() => ( const failed = await renderFrame(() => (
<DiffViewerFileTree width={32} files={[]} loading={false} error={new Error("nope")} theme={theme} /> <DiffViewerFileTree width={32} files={[]} loading={false} error={new Error("nope")} theme={theme} />
)) ))
const empty = await renderFrame(() => <DiffViewerFileTree width={32} files={[]} loading={false} error={undefined} theme={theme} />) const empty = await renderFrame(() => (
<DiffViewerFileTree width={32} files={[]} loading={false} error={undefined} theme={theme} />
))
expect(loading).not.toContain("Loading diff...") expect(loading).not.toContain("Loading diff...")
expect(loading).not.toContain("No files") expect(loading).not.toContain("No files")
@@ -86,11 +89,21 @@ describe("DiffViewerFileTree", () => {
const focused = visibleLines( const focused = visibleLines(
await renderFrame(() => ( await renderFrame(() => (
<DiffViewerFileTree width={32} files={files} loading={false} error={undefined} theme={theme} focused highlightedNode={src.id} /> <DiffViewerFileTree
width={32}
files={files}
loading={false}
error={undefined}
theme={theme}
focused
highlightedNode={src.id}
/>
)), )),
) )
const unfocused = visibleLines( const unfocused = visibleLines(
await renderFrame(() => <DiffViewerFileTree width={32} files={files} loading={false} error={undefined} theme={theme} />), await renderFrame(() => (
<DiffViewerFileTree width={32} files={files} loading={false} error={undefined} theme={theme} />
)),
) )
expect(focused).toContain("▾ src/config") expect(focused).toContain("▾ src/config")
@@ -109,7 +122,14 @@ describe("DiffViewerFileTree", () => {
expect( expect(
visibleLines( visibleLines(
await renderFrame(() => ( await renderFrame(() => (
<DiffViewerFileTree width={32} files={files} loading={false} error={undefined} theme={theme} expandedNodes={collapsed} /> <DiffViewerFileTree
width={32}
files={files}
loading={false}
error={undefined}
theme={theme}
expandedNodes={collapsed}
/>
)), )),
), ),
).toEqual(["▸ src/config"]) ).toEqual(["▸ src/config"])