fix(git): finalize reviewed SCM groups and scope-safe actions

This commit is contained in:
hairyf committed 2026-10-13 22:42:16 +08:00
1 parent 0f9472b57f
commit 228b753ad2
9 files changed
+408 -309

No files matched your search

+5 -16
View File
@@ -2,8 +2,8 @@
* The unified changes tab: one tab, two lenses on "what changed?" — Git
* (repository truth: staged/unstaged files, commit box, history) and the
* session round (agent truth: every file the model read, wrote, or edited).
* A 36px header carries the host {@link SegmentedControl} and the current
* lens's refresh action; both lenses preview their selections in a shared
* A 36px header carries the host {@link SegmentedControl} and the session
* lens's refresh action (Git refresh lives in Changes); both lenses share a
* resizable bottom pane ({@link DiffPane}), and git targets expand into the
* dedicated diff tab docked in the workbench's diff pane. The active lens and
* the pane height persist in the tab's meta, so the tab reopens exactly where
@@ -72,8 +72,6 @@ export function ChangesTab({ ctx, store, scope, tab, visible, onOpenFile, onOpen
const [paneHeight, setPaneHeight] = useState<number>(() => clampPaneHeight(
typeof meta.previewH === 'number' ? meta.previewH : PANE_HEIGHT_DEFAULT,
))
/** The header refresh action for the Git lens (the lens owns its own queue). */
const [gitRefresh, setGitRefresh] = useState(0)
// ── Session-event accumulation: one catch-up pull when the tab becomes
// visible, then a 2.5s delta poll while the SESSION lens is on screen.
@@ -171,14 +169,6 @@ export function ChangesTab({ ctx, store, scope, tab, visible, onOpenFile, onOpen
patchMeta({ lens: next })
}
/** The header's refresh action: the Git lens reloads through its own queue
* (a click while a refresh is in flight is queued, not dropped), the
* session lens re-pulls its event delta. */
const refreshCurrent = (): void => {
if (lens === 'git') setGitRefresh(value => value + 1)
else void pull()
}
/** Preview one git change (worktree file or commit) from the Git lens. */
const previewGit = (ref: SidebarDiffRef): void => {
setSelection({ kind: 'git', ref })
@@ -215,12 +205,12 @@ export function ChangesTab({ ctx, store, scope, tab, visible, onOpenFile, onOpen
onChange={chooseLens}
label={t('changes')}
/>
<IconButton
{lens === 'session' && <IconButton
className={css.headAction}
icon={<IconRefreshOutlineRegular />}
label={t('refresh')}
onClick={refreshCurrent}
/>
onClick={() => { void pull() }}
/>}
</div>
{lens === 'git'
? (
@@ -229,7 +219,6 @@ export function ChangesTab({ ctx, store, scope, tab, visible, onOpenFile, onOpen
scope={scope}
store={store}
visible={visible}
refreshTick={gitRefresh}
onOpenFile={onOpenFile ?? (() => { /* no-op */ })}
onPreview={previewGit}
selectedRef={previewTarget !== null && previewTarget.kind === 'git' ? previewTarget.ref : null}
+86 -102
View File
@@ -24,7 +24,7 @@ import { isZh, t } from '../locales.ts'
import { GitGraph } from './GitGraph.tsx'
import type { SidebarDiffRef, SidebarStore } from '../state.ts'
import {
ConfirmDialog, IconButton, Notice, SectionHeader, StatusBadge, invalidateGitStatus, statusOfXY,
ConfirmDialog, IconButton, Notice, StatusBadge, invalidateGitStatus, statusOfXY,
useGitStatus, type GitFileStatus, type GitTone, type StatusTone,
} from '../ui/index.ts'
import { buildChangeTree, sumLineCounts, type ChangeDir, type ChangeFile, type ChangeNode } from './change-tree.ts'
@@ -93,16 +93,19 @@ const LOG_BATCH = 20
* within ~30s, without a second git process per status tick. */
const WORKTREE_POLL_MS = 30_000
/** Commit-box growth contract: one line is 18px with 6px of padding above and
* below (mirrored by `changes.module.css`), and it scrolls past six lines. */
const COMMIT_BOX_LINE_HEIGHT = 18
const COMMIT_BOX_PADDING_Y = 6
/** Desktop's official Input typography, with a six-line SCM cap. */
const COMMIT_BOX_LINE_HEIGHT = 22
const COMMIT_BOX_MAX_ROWS = 6
/** A stable empty entry list: the tree memo must not rebuild on every render
* just because `snapshot?.entries ?? []` minted a new array. */
const NO_ENTRIES: readonly GitStatusEntry[] = []
// The horizontal half of the host's Plus artwork (no public Minus icon).
const MINUS_ICON = <svg width={12} height={12} viewBox="0 0 16 16" fill="none" aria-hidden="true">
<path d="M2 8H14" stroke="currentColor" strokeWidth={1} />
</svg>
/**
* A CONTENT key for one status answer. The shared store mints a brand-new
* entries array for every poll — idle polls with byte-identical content
@@ -176,6 +179,7 @@ function worktreeRefOf(
* specs use — an idle poll must not resolve a single icon. */
const FileRow = memo(function FileRow(props: {
row: ChangeFile
depth: number
glyph: (path: string) => ReactNode
staged: boolean
busy: boolean
@@ -187,7 +191,7 @@ const FileRow = memo(function FileRow(props: {
const { row: node, staged, busy, selected } = props
const action = staged ? t('unstage') : t('stage')
return (
<div className={css.row} data-row={node.path} data-selected={selected ? 'true' : undefined}>
<div className={css.row} style={{ paddingLeft: props.depth * 12 + 8 }} data-row={node.path} data-selected={selected ? 'true' : undefined}>
<button
type="button"
className={css.rowMain}
@@ -209,7 +213,7 @@ const FileRow = memo(function FileRow(props: {
className={css.rowAction}
disabled={busy}
label={action}
icon={staged ? <IconTrashOutlineRegular size={14} /> : <IconPlusOutlineRegular size={14} />}
icon={MINUS_ICON}
onClick={() => { props.onToggleStage(node.path, staged) }}
/>
</div>
@@ -219,24 +223,25 @@ const FileRow = memo(function FileRow(props: {
/** One directory row: the disclosure chevron + folder artwork + the label
* (a compressed chain reads as one 'a/b/c' line) + how much changed below,
* plus the SAME trailing action a file row carries — applied to the whole
* subtree (`git add -A -- <dir>` / `git reset -q -- <dir>`, both of which
* take a directory pathspec). The action is a sibling of the disclosure
* button, so a click can never fold the row; it stops propagation anyway so
* subtree (only this group's paths when conflicts exist). The action is a
* sibling of the disclosure button, so a click can never fold the row; it stops propagation anyway so
* the intent survives a future nesting change. Memoized like {@link FileRow}. */
const DirRow = memo(function DirRow(props: {
row: ChangeDir
depth: number
folderGlyph: (path: string, open: boolean) => ReactNode
staged: boolean
open: boolean
busy: boolean
merge: boolean
onToggle: (key: string) => void
onToggleStage: (path: string, staged: boolean) => void
onToggleStage: (path: string, staged: boolean, merge?: boolean) => void
}): ReactNode {
const { row: node, staged, open, busy } = props
const key = `${staged ? 's' : 'u'}:${node.path}`
const { row: node, staged, open, busy, merge } = props
const key = `${merge ? 'm' : staged ? 's' : 'u'}:${node.path}`
const action = staged ? t('unstageAll') : t('stageAll')
return (
<div className={css.row} data-row={node.path}>
<div className={css.row} style={{ paddingLeft: props.depth * 12 + 8 }} data-row={node.path}>
<button
type="button"
className={css.dirRow}
@@ -250,17 +255,16 @@ const DirRow = memo(function DirRow(props: {
</span>
<span className={css.rowIcon} aria-hidden="true">{props.folderGlyph(node.path, open)}</span>
<span className={css.dirName}>{node.name}</span>
<span className={css.countPill} data-count={node.changes}>{node.changes}</span>
</button>
<IconButton
size="sm"
className={css.rowAction}
disabled={busy}
label={action}
icon={staged ? <IconTrashOutlineRegular size={14} /> : <IconPlusOutlineRegular size={14} />}
icon={MINUS_ICON}
onClick={(event) => {
event.stopPropagation()
props.onToggleStage(node.path, staged)
props.onToggleStage(node.path, staged, merge)
}}
/>
</div>
@@ -279,15 +283,13 @@ export interface GitLensProps {
selectedRef: SidebarDiffRef | null
/** Poll the inventory only while the tab is actually visible. */
visible: boolean
/** Bumped by the tab header's refresh action (0 = never asked). */
refreshTick?: number
/** The tab's context, for the registered file/folder icon chain (absent →
* the host's built-in artwork, exactly like the file tree falls back). */
ctx?: Context
}
export function GitLens(props: GitLensProps) {
const { scope, onOpenFile, onPreview, selectedRef, visible, refreshTick = 0, ctx } = props
const { scope, onOpenFile, onPreview, selectedRef, visible, ctx } = props
const service = ctx?.get('betterSidebar')
/** The file row's artwork: a registered icon wins, else the host's own
@@ -349,7 +351,7 @@ export function GitLens(props: GitLensProps) {
const box = commitBoxRef.current
// A layout-less environment (tests) reports 0: leave the CSS height alone.
if (box === null || box.scrollHeight === 0) return
const max = COMMIT_BOX_LINE_HEIGHT * COMMIT_BOX_MAX_ROWS + COMMIT_BOX_PADDING_Y * 2
const max = COMMIT_BOX_LINE_HEIGHT * COMMIT_BOX_MAX_ROWS
// Reset first: a scrollHeight measured against the current height can only
// ever grow, so a deleted line would leave the box too tall.
box.style.height = 'auto'
@@ -518,8 +520,10 @@ export function GitLens(props: GitLensProps) {
}
const targetChanged = target !== chosenPathRef.current
if (targetChanged) {
const checkoutChanged = chosenPathRef.current !== undefined || target !== current?.path
selectWorktree(target)
clearDerived()
// First inventory merely names the already-active primary checkout.
if (checkoutChanged) clearDerived()
}
// A silent tick only keeps the inventory (and its change counts) fresh.
if (silent && !targetChanged) return
@@ -594,16 +598,6 @@ export function GitLens(props: GitLensProps) {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visible])
// The header's refresh action: re-read the inventory and derived surfaces,
// and force the SHARED status of this session (the file tree's colors too).
useEffect(() => {
if (refreshTick === 0) return
void refresh(false)
invalidateGitStatus(scope.sessionId)
// Only the tick drives this effect.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [refreshTick])
/** The inventory poll: a linked checkout created mid-session shows up
* without a manual refresh (the status poll itself belongs to the store). */
const pollInventory = useCallback((signal: AbortSignal): Promise<void> => refresh(true, signal), [refresh])
@@ -624,7 +618,7 @@ export function GitLens(props: GitLensProps) {
setActionError(null)
try {
await action()
onSuccess?.()
if (generation === scopeGen.current) onSuccess?.()
} catch (reason) {
if (generation === scopeGen.current) setActionError(failure(reason))
} finally {
@@ -646,25 +640,25 @@ export function GitLens(props: GitLensProps) {
const pushError = (reason: unknown): string => `${t('pushError')}: ${errorMessage(reason)}`
const pullError = (reason: unknown): string => `${t('pullError')}: ${errorMessage(reason)}`
const stageEntry = (path: string, staged: boolean): void => {
void runAction(
() => (staged ? api.gitUnstage(gitScopeNow(), path, selectedWorktree) : api.gitStage(gitScopeNow(), path, selectedWorktree)),
stageError,
)
}
const stageAll = (staged: boolean, merge = false): void => {
const stageEntry = (path: string | undefined, staged: boolean, merge = false): void => {
const gitScope = gitScopeNow()
const target = selectedWorktree
// With conflicts, directory/all actions must only touch their own group:
// git add/reset on the whole directory would silently resolve/reset Merge.
const rows = staged ? stagedEntries : merge || mergeEntries.some(entry => entry.path === path) ? mergeEntries : unstagedEntries
const paths = mergeEntries.length === 0 ? [path] : rows
.filter(entry => path === undefined || entry.path === path || entry.path.startsWith(`${path}/`))
.map(entry => entry.path)
void runAction(async () => {
if (!staged && mergeEntries.length > 0) {
// Separate Merge/Changes groups must not stage each other's files.
for (const entry of merge ? mergeEntries : unstagedEntries) await api.gitStage(gitScope, entry.path, target)
} else if (staged) await api.gitUnstage(gitScope, undefined, target)
else await api.gitStage(gitScope, undefined, target)
for (const selectedPath of paths) {
if (staged) await api.gitUnstage(gitScope, selectedPath, target)
else await api.gitStage(gitScope, selectedPath, target)
}
}, stageError)
}
const stageAll = (staged: boolean, merge = false): void => { stageEntry(undefined, staged, merge) }
const commit = (): void => {
const message = commitMsg.trim()
if (!canCommit || actionLock.current) return
@@ -727,8 +721,8 @@ export function GitLens(props: GitLensProps) {
const gitScope = gitScopeNow()
const target = selectedWorktree
void runAction(async () => {
try { await api.gitPull(gitScope, target) } catch (reason) { throw new Error(pullError(reason)) }
try { await api.gitPush(gitScope, target) } catch (reason) { throw new Error(pushError(reason)) }
try { await api.gitPull(gitScope, target) } catch (reason) { throw new Error(pullError(reason), { cause: reason }) }
try { await api.gitPush(gitScope, target) } catch (reason) { throw new Error(pushError(reason), { cause: reason }) }
})
}
@@ -906,14 +900,14 @@ export function GitLens(props: GitLensProps) {
* current closures through the ref instead of closing over them. */
const rowActions = useRef({
preview: (_node: ChangeFile, _staged: boolean): void => { /* replaced below */ },
stage: (_path: string, _staged: boolean): void => { /* replaced below */ },
stage: (_path: string, _staged: boolean, _merge?: boolean): void => { /* replaced below */ },
})
useEffect(() => {
rowActions.current = {
preview: (node, staged) => {
onPreview(worktreeRefOf(node.path, isUntrackedStatus(node.status), staged, chosenPathRef.current, repoRootRef.current))
},
stage: (path, staged) => { stageEntry(path, staged) },
stage: (path, staged, merge) => { stageEntry(path, staged, merge) },
}
})
@@ -921,8 +915,8 @@ export function GitLens(props: GitLensProps) {
const previewFile = useCallback((node: ChangeFile, staged: boolean): void => {
rowActions.current.preview(node, staged)
}, [])
const stagePath = useCallback((path: string, staged: boolean): void => {
rowActions.current.stage(path, staged)
const stagePath = useCallback((path: string, staged: boolean, merge = false): void => {
rowActions.current.stage(path, staged, merge)
}, [])
const openRowMenu = useCallback((event: MouseEvent, node: ChangeFile, staged: boolean): void => {
event.preventDefault()
@@ -930,11 +924,12 @@ export function GitLens(props: GitLensProps) {
setFileMenu({ path: node.path, staged, untracked: isUntrackedStatus(node.status), x: event.clientX, y: event.clientY })
}, [])
/** One file row of a group's tree (the single file-row renderer). */
const renderFile = (node: ChangeFile, staged: boolean): ReactNode => (
/** Indent the content, not its container: hover and selection stay full-width. */
const renderFile = (node: ChangeFile, staged: boolean, depth = 0): ReactNode => (
<FileRow
key={`file:${staged ? 's' : 'u'}:${node.path}`}
row={node}
depth={depth}
glyph={fileGlyph}
staged={staged}
busy={busy || suggesting}
@@ -945,37 +940,49 @@ export function GitLens(props: GitLensProps) {
/>
)
/** One directory row plus its (default-expanded) subtree. */
const renderDir = (node: ChangeDir, staged: boolean): ReactNode => {
const key = `${staged ? 's' : 'u'}:${node.path}`
const renderDir = (node: ChangeDir, staged: boolean, merge: boolean, depth = 0): ReactNode => {
const key = `${merge ? 'm' : staged ? 's' : 'u'}:${node.path}`
const open = !collapsed.has(key)
return (
<div key={`dir:${key}`}>
<DirRow
row={node}
folderGlyph={folderGlyph}
staged={staged}
open={open}
busy={busy || suggesting}
onToggle={toggleDir}
onToggleStage={stagePath}
/>
{open && (
<div className={css.treeChildren}>
{node.children.map(child => (child.kind === 'dir' ? renderDir(child, staged) : renderFile(child, staged)))}
</div>
)}
<DirRow row={node} depth={depth} folderGlyph={folderGlyph} staged={staged}
open={open} busy={busy || suggesting} merge={merge} onToggle={toggleDir} onToggleStage={stagePath} />
{open && node.children.map(child => child.kind === 'dir'
? renderDir(child, staged, merge, depth + 1) : renderFile(child, staged, depth + 1))}
</div>
)
}
/** One group's whole tree. */
const renderTree = (nodes: readonly ChangeNode[], staged: boolean): ReactNode => (
const renderTree = (nodes: readonly ChangeNode[], staged: boolean, merge = false): ReactNode => (
<div className={css.tree}>
{nodes.map(node => (node.kind === 'dir' ? renderDir(node, staged) : renderFile(node, staged)))}
{nodes.map(node => (node.kind === 'dir' ? renderDir(node, staged, merge) : renderFile(node, staged)))}
</div>
)
const renderGroup = (id: string, label: string, rows: readonly GitStatusEntry[], nodes: readonly ChangeNode[], staged: boolean, merge = false): ReactNode => {
if (rows.length === 0) return null
const key = `group:${id}`
const open = !collapsed.has(key)
const totals = staged ? stagedTotal : merge ? undefined : unstagedTotal
return (
<div className={css.group} data-group={id}>
<div className={`${css.scmHeader} ${css.groupHeader}`}>
<button type="button" className={css.scmDisclosure} aria-expanded={open} aria-label={`${label} (${rows.length})`} onClick={() => { toggleDir(key) }}>
<span className={css.chevron} data-open={open ? 'true' : undefined} aria-hidden="true"><IconChevronRightOutlineRegular size={12} /></span>
{label}
{totals !== undefined && totals.files > 0 && <PlusMinus additions={totals.additions} deletions={totals.deletions} note="group" />}
</button>
<IconButton className={css.headerAction} size="sm" disabled={busy || suggesting}
label={staged ? t('unstageAll') : t('stageAll')}
icon={staged ? MINUS_ICON : <IconPlusOutlineRegular size={12} />}
onClick={() => { stageAll(staged, merge) }} />
<span className={css.countPill} data-count={rows.length}>{rows.length}</span>
</div>
{open && renderTree(nodes, staged, merge)}
</div>
)
}
return (
<div className={css.git} data-git-root>
{/* Changes and Graph scroll together; only the branch/sync footer docks. */}
@@ -1006,8 +1013,8 @@ export function GitLens(props: GitLensProps) {
anchor={<IconButton size="sm" icon={<IconEllipsisOutlineRegular size={14} />} label={t('gitMoreActions')}
active={moreOpen} onClick={() => { setMoreOpen(open => !open) }} />}
items={[
{ id: 'push', label: t('push'), disabled: busy || suggesting || snapshot?.detached === true },
{ id: 'pull', label: t('pull'), disabled: busy || suggesting || snapshot?.detached === true },
{ id: 'push', label: t('push'), disabled: busy || suggesting || snapshot?.detached === true },
...(repoChoices.length > 1 ? [{ id: 'repos', label: t('gitRepository'),
submenu: repoChoices.map(root => ({ id: `repo:${root}`, label: baseName(root), disabled: busy || suggesting })),
}] : []),
@@ -1053,32 +1060,9 @@ export function GitLens(props: GitLensProps) {
</span>
</div>
{clean && <Notice kind="empty">{t('changesClean')}</Notice>}
{mergeEntries.length > 0 && <div className={css.group} data-group="merge">
<SectionHeader className={css.groupHeader} label={t('gitMergeChanges')}
action={<IconButton className={css.headerAction} size="sm" disabled={busy || suggesting}
label={t('stageAll')} icon={<IconPlusOutlineRegular size={14} />} onClick={() => { stageAll(false, true) }} />}>
<span className={css.countPill} data-count={mergeEntries.length}>{mergeEntries.length}</span>
</SectionHeader>
{renderTree(mergeTree, false)}
</div>}
{stagedEntries.length > 0 && <div className={css.group} data-group="staged">
<SectionHeader className={css.groupHeader} label={t('gitStagedChanges')}
action={<IconButton className={css.headerAction} size="sm" disabled={busy || suggesting}
label={t('unstageAll')} icon={<IconTrashOutlineRegular size={14} />} onClick={() => { stageAll(true) }} />}>
<span className={css.countPill} data-count={stagedEntries.length}>{stagedEntries.length}</span>
{stagedTotal.files > 0 && <PlusMinus additions={stagedTotal.additions} deletions={stagedTotal.deletions} note="group" />}
</SectionHeader>
{renderTree(stagedTree, true)}
</div>}
{unstagedEntries.length > 0 && <div className={css.group} data-group="unstaged">
<SectionHeader className={css.groupHeader} label={t('gitChanges')}
action={<IconButton className={css.headerAction} size="sm" disabled={busy || suggesting}
label={t('stageAll')} icon={<IconPlusOutlineRegular size={14} />} onClick={() => { stageAll(false) }} />}>
<span className={css.countPill} data-count={unstagedEntries.length}>{unstagedEntries.length}</span>
{unstagedTotal.files > 0 && <PlusMinus additions={unstagedTotal.additions} deletions={unstagedTotal.deletions} note="group" />}
</SectionHeader>
{renderTree(unstagedTree, false)}
</div>}
{renderGroup('merge', t('gitMergeChanges'), mergeEntries, mergeTree, false, true)}
{renderGroup('staged', t('gitStagedChanges'), stagedEntries, stagedTree, true)}
{renderGroup('unstaged', t('gitChanges'), unstagedEntries, unstagedTree, false)}
</div>}
</section>
)}
@@ -1126,7 +1110,7 @@ export function GitLens(props: GitLensProps) {
onSelect={name => { setBranchOpen(false); void checkout(name) }} />
<button type="button" className={css.syncButton} aria-label={syncLabel} title={syncLabel}
disabled={!canSync} onClick={sync}>
<IconRefreshOutlineRegular size={14} />
<IconRefreshOutlineRegular size={11} />
<span>{snapshot?.upstream !== undefined && snapshot.ahead !== undefined && snapshot.behind !== undefined
? `${snapshot.behind}↓ ${snapshot.ahead}↑` : syncLabel}</span>
</button>
+44 -52
View File
@@ -25,6 +25,7 @@
min-width: 0;
display: flex;
flex-direction: column;
padding-top: 6px;
}
/* The inner scroll body: the change groups + the history. It owns both scroll
@@ -67,24 +68,25 @@
class keeps the opaque fill above the kit's transparent band no matter which
sheet lands first in the bundle. */
.group .groupHeader {
gap: 4px;
position: sticky;
top: 0;
z-index: 2;
background: var(--dsw-alias-bg-base);
}
/* The group's change count, as a small capsule on the label's baseline. */
/* Group counts match the action height; directory rows need no badge. */
.countPill {
flex: none;
min-width: 16px;
height: 16px;
padding: 0 5px;
border-radius: 999px;
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--dsw-alias-interactive-bg-hover);
color: var(--dsw-alias-label-secondary);
font: var(--dsw-font-xxxs-strong-11);
line-height: 16px;
line-height: 20px;
text-align: center;
font-size: 10px;
font-variant-numeric: tabular-nums;
}
@@ -98,17 +100,8 @@
.group .headerAction { opacity: 1; }
}
/* The tree body: rows are flush bands, the gutter lives here. */
.tree { display: flex; flex-direction: column; padding: 0 6px; }
/* One nesting level: 12px of indent, with the guide line drawn at its edge so
the depth stays readable without a second colour. */
.treeChildren {
display: flex;
flex-direction: column;
margin-left: 11px;
border-left: 1px solid var(--dsw-alias-border-l1);
}
/* Indent row contents only; hover bands span the full panel. */
.tree { display: flex; flex-direction: column; }
/* A directory row's disclosure button. It shares the `.row` band with a file
row (the band owns the hover/selected fill and the trailing action), so this
@@ -142,8 +135,7 @@
gap: 6px;
position: relative;
min-height: 28px;
padding: 0 2px;
border-radius: 4px;
padding: 0 6px;
animation: dsh-row-in 150ms var(--ds-ease-in-out);
}
.row:hover { background: var(--dsw-alias-interactive-bg-hover); }
@@ -215,6 +207,9 @@
white-space: nowrap;
}
/* Match both glyphs and keep their hover boxes smaller than the 28px row. */
.row .rowAction, .group .headerAction { width: 20px; height: 20px; }
/* The row action is invisible until its row is hovered or holds focus (a
keyboard tab lands on it and reveals it). The three-class form outranks the
kit's own disabled rule, which would otherwise pin every button to a dim but
@@ -228,42 +223,39 @@
.messageBox { display: flex; padding: 4px 8px 8px; }
/* The commit-message box and its busy overlay: the input keeps its own
flex sizing through a wrapper so the overlay can sit exactly on top of it
while the host generates or commits. */
/* Desktop's official Input frame, with a growing textarea instead of input. */
.commitInputWrap {
position: relative;
display: flex;
align-items: center;
gap: 6px;
flex: 1;
min-width: 0;
min-height: 32px;
box-sizing: border-box;
padding: 0 4px 0 8px;
border: 0.5px solid var(--dsw-alias-border-l4);
border-radius: var(--dsw-radius-md);
background: var(--dsw-alias-bg-layer-1);
}
.commitInputWrap:focus-within { border-color: var(--dsw-alias-state-business-primary); }
/* The multiline commit box: a native textarea styled to match the primitives
Input (layer fill, hairline border, brand focus ring). Flex sizing keeps it
inside the row — `width: 100%` would overflow its own padding/border. */
.commitInput {
flex: 1;
min-width: 0;
box-sizing: border-box;
/* One line by default; GitLens grows it with the text (18px per line,
6px vertical padding, six lines before it scrolls). The bounds here are
the stylesheet's half of that contract. */
min-height: 30px;
max-height: 120px;
padding: 6px 32px 6px 8px;
border: 0.5px solid var(--dsw-alias-border-l4);
border-radius: 3px;
background: var(--dsw-alias-bg-layer-1);
height: 22px;
min-height: 22px;
max-height: 132px;
padding: 0;
margin: 4px 0;
border: none;
background: transparent;
color: var(--dsw-alias-label-primary);
font: var(--dsw-font-s-13);
line-height: 18px;
font: var(--dsw-font-s-14);
line-height: 22px;
resize: none;
overflow-y: hidden;
}
.commitInput:focus {
outline: none;
border-color: var(--dsw-alias-brand-primary);
}
.commitInput::placeholder {
@@ -280,13 +272,14 @@
is cleared while busy, so the two never overlap. */
.commitBusyText {
position: absolute;
inset: 0;
inset: 0 38px 0 0;
display: flex;
align-items: center;
/* Matches the textarea's own padding so the label sits where the text would. */
padding: 6px 8px;
/* Match the frame's inset while keeping the generate button unobscured. */
padding: 0 8px;
pointer-events: none;
font: var(--dsw-font-xxs-12);
font: var(--dsw-font-s-14);
line-height: 22px;
background-image: linear-gradient(
90deg,
var(--dsw-alias-label-tertiary) 0%,
@@ -311,20 +304,19 @@
/* Generate fills the draft only. Inline on the input's right edge. */
.suggestButton {
position: absolute;
top: 2px;
right: 2px;
flex: none;
align-self: flex-start;
margin-top: 3px;
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
width: 24px;
height: 24px;
padding: 0;
border: none;
border-radius: 3px;
border-radius: 8px;
background: transparent;
color: var(--dsw-alias-label-secondary);
color: var(--dsw-alias-label-tertiary);
cursor: pointer;
}