Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Unify file and terminal tab visuals (#4695)

sarah512e2143ec80
diff --git a/.changeset/unify-file-and-terminal-tab-visuals.md b/.changeset/unify-file-and-terminal-tab-visuals.md
new file mode 100644
index 000000000..4329a7407
--- /dev/null
+++ b/.changeset/unify-file-and-terminal-tab-visuals.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+File tabs and terminal tabs now share one look: a filled rounded tab with matching size, text size, and alignment across light and dark themes.
diff --git a/packages/app/src/components/EditorHeader.dom.test.tsx b/packages/app/src/components/EditorHeader.dom.test.tsx
index e9cb17cf5..6fa67f70e 100644
--- a/packages/app/src/components/EditorHeader.dom.test.tsx
+++ b/packages/app/src/components/EditorHeader.dom.test.tsx
@@ -283,6 +283,7 @@ describe('EditorHeader runtime behavior', () => {
'h-12',
'shrink-0',
'items-center',
+ 'bg-background',
'shadow-[inset_0_-1px_0_var(--border)]',
]);
expectVisualClassTokensAbsent(header.className, [
@@ -606,10 +607,7 @@ describe('EditorHeader runtime behavior', () => {
?.textContent,
).toBe('notes');
expectVisualClassTokens(header.className, ['bg-background']);
- expectVisualClassTokensAbsent(header.className, [
- 'bg-muted/35',
- 'shadow-[inset_0_-1px_0_var(--border)]',
- ]);
+ expectVisualClassTokensAbsent(header.className, ['shadow-[inset_0_-1px_0_var(--border)]']);
expectVisualClassTokens(leadingZone.className, [
'left-[var(--ok-titlebar-reserve-left,1rem)]',
]);
diff --git a/packages/app/src/components/EditorHeader.tsx b/packages/app/src/components/EditorHeader.tsx
index 6397fb7d0..5be162ac6 100644
--- a/packages/app/src/components/EditorHeader.tsx
+++ b/packages/app/src/components/EditorHeader.tsx
@@ -227,7 +227,8 @@ export function EditorHeader({
}}
className={cn(
'group/editor-header relative flex h-12 shrink-0 items-center',
- noteWindow ? 'bg-background' : 'bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]',
+ 'bg-background',
+ !noteWindow && 'shadow-[inset_0_-1px_0_var(--border)]',
isElectronHost && '[-webkit-app-region:drag]',
)}
>
diff --git a/packages/app/src/components/EditorTabs.dom.test.tsx b/packages/app/src/components/EditorTabs.dom.test.tsx
index eaaf5ee02..e1f4d2f87 100644
--- a/packages/app/src/components/EditorTabs.dom.test.tsx
+++ b/packages/app/src/components/EditorTabs.dom.test.tsx
@@ -633,11 +633,36 @@ describe('EditorTabs runtime behavior', () => {
}
});
- test('bolds the active tab only when its pane is focused', async () => {
+ test('pairs every tab surface with its own foreground token', async () => {
+ const { container } = await renderEditorTabs();
+
+ const inactiveShell = container.querySelector<HTMLElement>(
+ '[data-sortable-id]:not([data-active-tab])',
+ );
+ expectVisualClassTokens(inactiveShell?.className, [
+ 'hover:bg-sidebar-hover',
+ 'hover:text-sidebar-hover-foreground',
+ 'focus-visible:bg-sidebar-hover',
+ 'focus-visible:text-sidebar-hover-foreground',
+ ]);
+ expectVisualClassTokensAbsent(inactiveShell?.className, [
+ 'hover:text-foreground',
+ 'focus-visible:text-foreground',
+ ]);
+ });
+
+ test('keeps the active tab bold in an unfocused pane, and on its own surface', async () => {
focusedPaneId = 'pane-b';
- await renderEditorTabs();
+ const { container } = await renderEditorTabs();
- expectVisualClassTokensAbsent(tabButton('docs/team/spec.mdx').className, ['font-semibold']);
+ expectVisualClassTokens(tabButton('docs/team/spec.mdx').className, ['font-semibold']);
+
+ const shell = container.querySelector<HTMLElement>('[data-active-tab="true"]');
+ expectVisualClassTokens(shell?.className, [
+ 'bg-sidebar-hover',
+ 'text-sidebar-hover-muted-foreground',
+ ]);
+ expectVisualClassTokensAbsent(shell?.className, ['bg-sidebar-selected']);
});
test('keeps folder, asset, and new-tab branches closeable and independently activatable', async () => {
@@ -858,7 +883,7 @@ describe('EditorTabs runtime behavior', () => {
expect(overflowRoot.getAttribute('data-electron-drag')).toBe('');
expectVisualClassTokens(overflowRoot.className, [
'flex',
- 'items-end',
+ 'items-center',
'gap-px',
'min-w-0',
'flex-1',
@@ -1513,9 +1538,12 @@ describe('EditorTabs runtime behavior', () => {
.find((element) => element.tagName === 'BUTTON')
?.closest('[data-sortable-id]') as HTMLElement;
expectVisualClassTokens(activeSortable.className, [
+ 'rounded-md',
+ 'bg-sidebar-selected',
+ 'text-sidebar-selected-foreground',
+ ]);
+ expectVisualClassTokensAbsent(activeSortable.className, [
'rounded-t-lg',
- 'rounded-b-none',
- 'border-border',
'border-b-0',
'bg-background',
]);
diff --git a/packages/app/src/components/EditorTabs.tsx b/packages/app/src/components/EditorTabs.tsx
index edab307ec..34b29d2a8 100644
--- a/packages/app/src/components/EditorTabs.tsx
+++ b/packages/app/src/components/EditorTabs.tsx
@@ -73,29 +73,31 @@ import {
getSortableTabStyle,
getTabCloseButtonClass,
getTabCloseButtonTabIndex,
+ getTabTitleOverflowClassName,
shouldOpenTabContextMenu,
+ TAB_SELECTED_SURFACE_CLASS,
} from './editor-tabs-chrome';
import { usePageList } from './PageListContext';
import { scrollTabStripOnWheel } from './tab-strip-wheel';
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
const TAB_BASE_CLASS =
- 'group @container/tab relative -mb-px flex h-10 min-w-32 max-w-48 grow-0 basis-36 shrink cursor-grab items-center overflow-hidden border border-transparent font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset active:cursor-grabbing';
-const TAB_ACTIVE_CLASS =
- 'z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground';
+ 'group @container/tab relative flex h-7 min-w-32 max-w-48 grow-0 basis-36 shrink cursor-grab items-center overflow-hidden border border-transparent font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset active:cursor-grabbing';
+const TAB_ACTIVE_CLASS = `z-10 rounded-md ${TAB_SELECTED_SURFACE_CLASS}`;
+const TAB_ACTIVE_UNFOCUSED_CLASS =
+ 'z-10 rounded-md bg-sidebar-hover text-sidebar-hover-muted-foreground';
const TAB_INACTIVE_CLASS =
- 'rounded-t-md text-muted-foreground hover:border-border/70 hover:bg-muted/60 hover:text-foreground focus-visible:border-border focus-visible:bg-muted focus-visible:text-foreground';
+ 'rounded-md text-muted-foreground hover:bg-sidebar-hover hover:text-sidebar-hover-foreground focus-visible:bg-sidebar-hover focus-visible:text-sidebar-hover-foreground';
const TAB_BUTTON_CLASS =
- 'flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden pl-3 pr-1.5 text-left text-[13px] outline-none @max-[5rem]/tab:pl-2';
+ 'flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden pl-3 pr-1.5 text-left text-1sm outline-none @max-[5rem]/tab:pl-2';
-function tabTitleClassName(isFocusedActive: boolean, isPreview: boolean): string {
- return cn(TAB_BUTTON_CLASS, isFocusedActive && 'font-semibold', isPreview && 'italic');
+function tabShellClassName(isActive: boolean, isFocusedPane: boolean): string {
+ if (!isActive) return cn(TAB_BASE_CLASS, TAB_INACTIVE_CLASS);
+ return cn(TAB_BASE_CLASS, isFocusedPane ? TAB_ACTIVE_CLASS : TAB_ACTIVE_UNFOCUSED_CLASS);
}
-function tabTitleOverflowClassName(isActive: boolean): string {
- return isActive
- ? 'overflow-hidden whitespace-nowrap mask-r-from-[calc(100%-1.5rem)] mask-r-to-[100%]'
- : 'truncate group-hover:text-clip group-hover:mask-r-from-[calc(100%-3rem)] group-hover:mask-r-to-[calc(100%-1.5rem)]';
+function tabTitleClassName(isActive: boolean, isPreview: boolean): string {
+ return cn(TAB_BUTTON_CLASS, isActive && 'font-semibold', isPreview && 'italic');
}
function syncTabOverflowIndicators(scrollContainer: HTMLElement): void {
@@ -519,7 +521,6 @@ function DocumentTabButton({
extension,
hideDocExtension,
isActive,
- isFocusedPane,
isPreview,
promoteTab,
tabId,
@@ -531,7 +532,6 @@ function DocumentTabButton({
extension: string;
hideDocExtension: boolean;
isActive: boolean;
- isFocusedPane: boolean;
isPreview: boolean;
promoteTab: (tabId: string) => void;
tabId: string;
@@ -547,7 +547,7 @@ function DocumentTabButton({
type="button"
aria-label={buttonAccessibleLabel}
dir="auto"
- className={tabTitleClassName(isActive && isFocusedPane, isPreview)}
+ className={tabTitleClassName(isActive, isPreview)}
onClick={() => {
activateTab(tabId);
}}
@@ -562,7 +562,7 @@ function DocumentTabButton({
<span className="flex min-w-0 flex-1 items-center">
<span
data-editor-tab-title-overflow={isActive ? 'fade' : 'ellipsis'}
- className={cn('min-w-0 flex-1', tabTitleOverflowClassName(isActive))}
+ className={cn('min-w-0 flex-1', getTabTitleOverflowClassName(isActive))}
>
{baseName}
</span>
@@ -584,6 +584,7 @@ interface EditorTabFrameProps {
dropIndicatorSide?: 'before' | 'after';
forceCloseVisible: boolean;
isActive: boolean;
+ isFocusedPane: boolean;
isPinned: boolean;
isPreview: boolean;
openTabs: readonly string[];
@@ -611,6 +612,7 @@ function EditorTabFrame({
dropIndicatorSide,
forceCloseVisible,
isActive,
+ isFocusedPane,
isPinned,
isPreview,
openTabs,
@@ -655,7 +657,7 @@ function EditorTabFrame({
aria-keyshortcuts={ariaKeyShortcuts}
data-active-tab={isActive ? 'true' : undefined}
data-preview-tab={isPreview ? 'true' : undefined}
- className={cn(TAB_BASE_CLASS, isActive ? TAB_ACTIVE_CLASS : TAB_INACTIVE_CLASS)}
+ className={tabShellClassName(isActive, isFocusedPane)}
onAuxClick={(event) => {
if (event.button !== 1) return;
event.preventDefault();
@@ -952,7 +954,7 @@ export function EditorTabs({
data-editor-pane-tabs={resolvedPaneId}
data-electron-drag={isElectronHost ? '' : undefined}
className={cn(
- 'flex h-12 w-full min-w-0 touch-manipulation items-end overflow-hidden',
+ 'flex h-12 w-full min-w-0 touch-manipulation items-center overflow-hidden',
reserveLeadingChrome
? 'pl-[calc(var(--editor-header-leading-offset,0px)+var(--editor-header-leading-width,0px)+0.5rem)]'
: 'pl-2',
@@ -964,7 +966,7 @@ export function EditorTabs({
data-editor-tab-overflow-root=""
data-electron-drag={isElectronHost ? '' : undefined}
className={cn(
- 'group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-end gap-px overflow-hidden',
+ 'group/tab-overflow relative flex min-w-0 flex-1 self-stretch items-center gap-px overflow-hidden',
isElectronHost && '[-webkit-app-region:drag]',
)}
>
@@ -979,14 +981,14 @@ export function EditorTabs({
<SortableContext items={[...visibleTabIds]} strategy={horizontalListSortingStrategy}>
<div
className={cn(
- 'relative h-10 w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-end',
+ 'relative h-full w-fit max-w-[calc(100%-1.75rem)] min-w-0 flex-none self-center',
isElectronHost && '[-webkit-app-region:no-drag]',
)}
>
<div
ref={tabScrollRef}
data-editor-tab-scroll=""
- className="scrollbar-none flex h-10 w-fit max-w-full min-w-0 items-end gap-px overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-[overflow-left]/tab-overflow:mask-l-from-[calc(100%-4rem)] group-data-[overflow-right]/tab-overflow:mask-r-from-[calc(100%-4rem)]"
+ className="scrollbar-none flex h-full w-fit max-w-full min-w-0 items-center gap-px overflow-x-auto overflow-y-hidden overscroll-x-contain group-data-[overflow-left]/tab-overflow:mask-l-from-[calc(100%-4rem)] group-data-[overflow-right]/tab-overflow:mask-r-from-[calc(100%-4rem)]"
onScroll={(event) => syncTabOverflowIndicators(event.currentTarget)}
onWheel={(event) => {
scrollTabStripOnWheel(event);
@@ -1034,10 +1036,7 @@ export function EditorTabs({
aria-current={isActive ? 'page' : undefined}
aria-keyshortcuts={ariaKeyShortcuts}
data-active-tab={isActive ? 'true' : undefined}
- className={cn(
- TAB_BASE_CLASS,
- isActive ? TAB_ACTIVE_CLASS : TAB_INACTIVE_CLASS,
- )}
+ className={tabShellClassName(isActive, isFocusedPane)}
onAuxClick={(event) => {
if (event.button !== 1) return;
event.preventDefault();
@@ -1052,7 +1051,7 @@ export function EditorTabs({
type="button"
aria-label={t`Activate new tab`}
data-testid="editor-new-tab-placeholder-button"
- className={tabTitleClassName(isActive && isFocusedPane, false)}
+ className={tabTitleClassName(isActive, false)}
onClick={() => activateNewTab(tabId)}
tabIndex={-1}
>
@@ -1116,6 +1115,7 @@ export function EditorTabs({
closeTabs={closeVisibleTabs}
forceCloseVisible={forceTabCloseVisible}
isActive={isActive}
+ isFocusedPane={isFocusedPane}
isPinned={isPinned}
isPreview={isPreview}
pinTab={pinTab}
@@ -1130,7 +1130,7 @@ export function EditorTabs({
type="button"
aria-label={accessibleLabel}
dir="auto"
- className={tabTitleClassName(isActive && isFocusedPane, isPreview)}
+ className={tabTitleClassName(isActive, isPreview)}
onClick={() => activateTab(tabId)}
onDoubleClick={(event) => {
event.preventDefault();
@@ -1141,7 +1141,7 @@ export function EditorTabs({
>
<span
data-editor-tab-title-overflow={isActive ? 'fade' : 'ellipsis'}
- className={cn('min-w-0 flex-1', tabTitleOverflowClassName(isActive))}
+ className={cn('min-w-0 flex-1', getTabTitleOverflowClassName(isActive))}
>
{prefix && (
<span
@@ -1219,6 +1219,7 @@ export function EditorTabs({
closeTabs={closeVisibleTabs}
forceCloseVisible={forceTabCloseVisible}
isActive={isActive}
+ isFocusedPane={isFocusedPane}
isPinned={isPinned}
isPreview={isPreview}
pinTab={pinTab}
@@ -1243,7 +1244,7 @@ export function EditorTabs({
type="button"
aria-label={accessibleLabel}
dir="auto"
- className={tabTitleClassName(isActive && isFocusedPane, isPreview)}
+ className={tabTitleClassName(isActive, isPreview)}
onClick={() => activateTab(tabId)}
onDoubleClick={(event) => {
event.preventDefault();
@@ -1254,7 +1255,7 @@ export function EditorTabs({
>
<span
data-editor-tab-title-overflow={isActive ? 'fade' : 'ellipsis'}
- className={cn('min-w-0 flex-1', tabTitleOverflowClassName(isActive))}
+ className={cn('min-w-0 flex-1', getTabTitleOverflowClassName(isActive))}
>
{prefix ? (
<span
@@ -1305,6 +1306,7 @@ export function EditorTabs({
closeTabs={closeVisibleTabs}
forceCloseVisible={forceTabCloseVisible}
isActive={isActive}
+ isFocusedPane={isFocusedPane}
isPinned={isPinned}
isPreview={isPreview}
pinTab={pinTab}
@@ -1339,7 +1341,6 @@ export function EditorTabs({
extension={extension}
hideDocExtension={hideDocExtension}
isActive={isActive}
- isFocusedPane={isFocusedPane}
isPreview={isPreview}
promoteTab={promoteTab}
tabId={tabId}
@@ -1358,10 +1359,7 @@ export function EditorTabs({
variant="ghost"
aria-label={t`New tab`}
data-testid="editor-new-tab-button"
- className={cn(
- 'first:mb-3 mb-1.5 shrink-0',
- isElectronHost && '[-webkit-app-region:no-drag]',
- )}
+ className={cn('shrink-0', isElectronHost && '[-webkit-app-region:no-drag]')}
onClick={openNewTab}
>
<PlusIcon aria-hidden="true" />
diff --git a/packages/app/src/components/EditorWorkspace.dom.test.tsx b/packages/app/src/components/EditorWorkspace.dom.test.tsx
index b8da2c025..cbe42e78f 100644
--- a/packages/app/src/components/EditorWorkspace.dom.test.tsx
+++ b/packages/app/src/components/EditorWorkspace.dom.test.tsx
@@ -508,6 +508,11 @@ describe('EditorWorkspace', () => {
expect(overlay.textContent).toBe('docs/b');
expect(overlay.className).toContain('w-44');
expect(overlay.className).toContain('cursor-grabbing');
+ expectVisualClassTokens(overlay.className, [
+ 'bg-sidebar-selected',
+ 'text-sidebar-selected-foreground',
+ ]);
+ expectVisualClassTokensAbsent(overlay.className, ['text-foreground']);
expect(dragOverlayProps.dropAnimation).toBeNull();
expect(document.body.hasAttribute('data-editor-tab-dragging')).toBe(true);
diff --git a/packages/app/src/components/EditorWorkspace.tsx b/packages/app/src/components/EditorWorkspace.tsx
index ed6046d2e..964f970a8 100644
--- a/packages/app/src/components/EditorWorkspace.tsx
+++ b/packages/app/src/components/EditorWorkspace.tsx
@@ -44,6 +44,7 @@ import {
isEditorTabDragData,
isEditorTabDropData,
TAB_KEYBOARD_DRAG_CODES,
+ TAB_SELECTED_SURFACE_CLASS,
} from './editor-tabs-chrome';
import { NoteWindowDeletedState } from './NoteWindowDeletedState';
@@ -814,7 +815,10 @@ export function EditorWorkspace({
<div
aria-hidden="true"
data-testid="editor-tab-drag-overlay"
- className="pointer-events-none flex h-10 w-44 max-w-[calc(100vw-2rem)] cursor-grabbing items-center overflow-hidden rounded-md border border-border bg-background px-3 font-medium text-[13px] text-foreground shadow-lg"
+ className={cn(
+ 'pointer-events-none flex h-7 w-44 max-w-[calc(100vw-2rem)] cursor-grabbing items-center overflow-hidden rounded-md px-3 font-medium text-1sm shadow-lg',
+ TAB_SELECTED_SURFACE_CLASS,
+ )}
>
<span className="min-w-0 truncate">{drag.label}</span>
</div>
diff --git a/packages/app/src/components/TerminalTabStrip.dom.test.tsx b/packages/app/src/components/TerminalTabStrip.dom.test.tsx
index 1a7e3ac0c..13ddfc8d9 100644
--- a/packages/app/src/components/TerminalTabStrip.dom.test.tsx
+++ b/packages/app/src/components/TerminalTabStrip.dom.test.tsx
@@ -2,6 +2,10 @@ import { act, cleanup, fireEvent, render, screen, within } from '@testing-librar
import userEvent from '@testing-library/user-event';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { TooltipProvider } from '@/components/ui/tooltip';
+import {
+ expectVisualClassTokens,
+ expectVisualClassTokensAbsent,
+} from '@/test-utils/visual-contract';
import { type TerminalTabDescriptor, TerminalTabStrip } from './TerminalTabStrip';
const SESSIONS: readonly TerminalTabDescriptor[] = [
@@ -76,6 +80,25 @@ function renderStrip(props?: {
describe('TerminalTabStrip', () => {
afterEach(() => cleanup());
+ test('a hovered session tab pairs the hover fill with its own foreground', () => {
+ renderStrip({ activeSessionId: 's2' });
+
+ const tab = screen.getByRole('tab', { name: 'Terminal 1' });
+ fireEvent.mouseEnter(tab);
+
+ expectVisualClassTokens(tab.className, ['bg-sidebar-hover!', 'text-sidebar-hover-foreground!']);
+ expectVisualClassTokensAbsent(tab.className, ['text-foreground!']);
+ });
+
+ test('the active session tab keeps the important-modified selected surface', () => {
+ renderStrip({ activeSessionId: 's2' });
+
+ expectVisualClassTokens(screen.getByRole('tab', { name: 'Terminal 2' }).className, [
+ 'bg-sidebar-selected!',
+ 'text-sidebar-selected-foreground!',
+ ]);
+ });
+
test('renders one tab per session inside a labeled tablist', () => {
renderStrip();
const tablist = screen.getByRole('tablist', { name: 'Terminal sessions' });
diff --git a/packages/app/src/components/TerminalTabStrip.tsx b/packages/app/src/components/TerminalTabStrip.tsx
index 281673d3f..c7abc0dab 100644
--- a/packages/app/src/components/TerminalTabStrip.tsx
+++ b/packages/app/src/components/TerminalTabStrip.tsx
@@ -33,7 +33,11 @@ import {
getSortableTabStyle,
measureTabReorderBounds,
shouldOpenTabContextMenu,
+ TAB_CLOSE_BUTTON_CLASS,
+ TAB_HOVER_SURFACE_IMPORTANT_CLASS,
TAB_REORDER_AUTO_SCROLL,
+ TAB_SELECTED_SURFACE_IMPORTANT_CLASS,
+ TAB_TITLE_FADE_CLASS,
type TabReorderBounds,
tabRunCollisionDetection,
} from './editor-tabs-chrome';
@@ -298,7 +302,7 @@ export function TerminalTabStrip({
<div
onWheel={scrollTabStripOnWheel}
className={cn(
- 'grid h-auto w-fit max-w-full min-w-0 grid-flow-col items-center justify-start gap-0.5 overflow-x-auto overflow-y-hidden [grid-auto-columns:max-content] [scrollbar-width:none] scroll-fade-mask-x',
+ 'grid h-auto w-fit max-w-full min-w-0 grid-flow-col items-center justify-start gap-0.5 overflow-x-auto overflow-y-hidden [grid-auto-columns:minmax(8rem,9rem)] [scrollbar-width:none] scroll-fade-mask-x',
draggable && '[-webkit-app-region:no-drag]',
)}
>
@@ -310,6 +314,7 @@ export function TerminalTabStrip({
>
{sessions.map((session, index) => {
const isActive = session.id === activeSessionId;
+ const isHovered = hoveredId === session.id;
const isRenaming = renamingId === session.id;
return (
<SortableTerminalTab
@@ -341,14 +346,23 @@ export function TerminalTabStrip({
}
}}
className={cn(
- 'h-7 flex-none gap-1.5 rounded-md py-0 pr-7 pl-2 text-xs transition-colors motion-reduce:transition-none',
- isActive ? 'bg-muted' : 'hover:bg-muted/50',
- isRenaming && 'w-40 opacity-0',
+ 'h-7 flex-none justify-start gap-1.5 rounded-md py-0 pr-7 pl-2 text-left text-1sm transition-colors motion-reduce:transition-none',
+ isActive
+ ? TAB_SELECTED_SURFACE_IMPORTANT_CLASS
+ : isHovered && TAB_HOVER_SURFACE_IMPORTANT_CLASS,
+ isRenaming && 'w-full opacity-0',
draggable && '[-webkit-app-region:no-drag]',
)}
>
{session.icon}
- <span className="max-w-40 truncate">{session.label}</span>
+ <span
+ className={cn(
+ 'min-w-0 flex-1',
+ isActive || isHovered ? TAB_TITLE_FADE_CLASS : 'truncate',
+ )}
+ >
+ {session.label}
+ </span>
</TabsTrigger>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={8}>
@@ -369,7 +383,7 @@ export function TerminalTabStrip({
key={session.id}
style={{ gridColumn: index + 1, gridRow: 1 }}
className={cn(
- 'z-20 h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent',
+ 'z-20 h-7 w-full rounded-md border-0 bg-transparent dark:bg-transparent',
draggable && '[-webkit-app-region:no-drag]',
)}
>
@@ -378,7 +392,7 @@ export function TerminalTabStrip({
value={renameValue}
aria-label={t`Rename ${session.label}`}
data-testid="terminal-tab-rename-input"
- className="h-7 px-2 text-xs"
+ className="h-7 px-2 text-1sm"
onChange={(event) => setRenameValue(event.target.value)}
onKeyDown={(event) => {
if (event.key === 'Enter') {
@@ -405,7 +419,8 @@ export function TerminalTabStrip({
tabIndex={isActive ? 0 : -1}
style={{ gridColumn: index + 1, gridRow: 1 }}
className={cn(
- 'z-20 mr-0.5 justify-self-end text-muted-foreground opacity-0 transition-opacity hover:text-foreground hover:opacity-100 focus-visible:opacity-100',
+ TAB_CLOSE_BUTTON_CLASS,
+ 'z-20 mr-0.5 justify-self-end opacity-0 transition-opacity focus-visible:opacity-100',
(isActive || hoveredId === session.id) && 'opacity-100',
tabReorderBounds != null && 'pointer-events-none opacity-0',
draggable && '[-webkit-app-region:no-drag]',
diff --git a/packages/app/src/components/editor-tabs-chrome.test.ts b/packages/app/src/components/editor-tabs-chrome.test.ts
index 1c95d1cf9..9a58dadea 100644
--- a/packages/app/src/components/editor-tabs-chrome.test.ts
+++ b/packages/app/src/components/editor-tabs-chrome.test.ts
@@ -248,20 +248,16 @@ describe('editor tab chrome helpers', () => {
test('dragged tabs use active-tab colors even when the source tab was inactive', () => {
const className = getSortableTabClassName({
className:
- 'bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent text-muted-foreground',
+ 'rounded-md text-muted-foreground hover:bg-sidebar-hover hover:text-foreground focus-visible:bg-sidebar-hover focus-visible:text-foreground',
isDragging: true,
});
+ const tokens = className.split(/\s+/);
- expect(className).toContain('bg-background');
- expect(className).toContain('hover:bg-background');
- expect(className).toContain('focus-visible:bg-background');
- expect(className).toContain('border-border');
- expect(className).toContain('text-foreground');
- expect(className).not.toContain('bg-transparent');
- expect(className).not.toContain('hover:bg-muted');
- expect(className).not.toContain('focus-visible:bg-muted');
- expect(className).not.toContain('border-transparent');
- expect(className).not.toContain('text-muted-foreground');
+ expect(tokens).toContain('bg-sidebar-selected');
+ expect(tokens).toContain('text-sidebar-selected-foreground');
+ expect(tokens).not.toContain('text-muted-foreground');
+ expect(tokens).not.toContain('hover:bg-sidebar-hover');
+ expect(tokens).not.toContain('focus-visible:bg-sidebar-hover');
});
test('non-dragged tabs preserve caller classes', () => {
diff --git a/packages/app/src/components/editor-tabs-chrome.ts b/packages/app/src/components/editor-tabs-chrome.ts
index 0333ae39d..955819136 100644
--- a/packages/app/src/components/editor-tabs-chrome.ts
+++ b/packages/app/src/components/editor-tabs-chrome.ts
@@ -33,10 +33,13 @@ interface PaneStripDropData {
export type EditorTabDropData = PaneEdgeDropData | PaneStripDropData;
-const TAB_CLOSE_BUTTON_CLASS =
- 'flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50';
-const DRAGGING_TAB_ACTIVE_CLASS =
- 'border-border bg-background text-foreground hover:bg-background focus-visible:bg-background';
+export const TAB_CLOSE_BUTTON_CLASS =
+ 'flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none hover:bg-muted-foreground/20 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50';
+export const TAB_SELECTED_SURFACE_CLASS = 'bg-sidebar-selected text-sidebar-selected-foreground';
+export const TAB_SELECTED_SURFACE_IMPORTANT_CLASS =
+ 'bg-sidebar-selected! text-sidebar-selected-foreground!';
+export const TAB_HOVER_SURFACE_IMPORTANT_CLASS = 'bg-sidebar-hover! text-sidebar-hover-foreground!';
+const DRAGGING_TAB_ACTIVE_CLASS = `${TAB_SELECTED_SURFACE_CLASS} hover:bg-sidebar-selected focus-visible:bg-sidebar-selected`;
export const DRAGGING_TAB_Z_INDEX = 20;
export const TAB_REORDER_AUTO_SCROLL = false;
export const TAB_KEYBOARD_DRAG_CODES = {
@@ -59,6 +62,15 @@ export function getTabCloseButtonClass(isActive: boolean): string {
);
}
+export const TAB_TITLE_FADE_CLASS =
+ 'overflow-hidden whitespace-nowrap mask-r-from-[calc(100%-1.5rem)] mask-r-to-[100%]';
+
+export function getTabTitleOverflowClassName(isActive: boolean): string {
+ return isActive
+ ? TAB_TITLE_FADE_CLASS
+ : 'truncate group-hover:text-clip group-hover:mask-r-from-[calc(100%-3rem)] group-hover:mask-r-to-[calc(100%-1.5rem)]';
+}
+
export function getTabCloseButtonTabIndex(isActive: boolean): -1 | undefined {
return isActive ? undefined : -1;
}
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index 962d71b2b..b460c8ce5 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -3210,6 +3210,7 @@ button:active:not(:disabled) {
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-hover: var(--sidebar-hover);
--color-sidebar-hover-foreground: var(--sidebar-hover-foreground);
+ --color-sidebar-hover-muted-foreground: var(--sidebar-hover-muted-foreground);
--color-sidebar-selected: var(--sidebar-selected);
--color-sidebar-selected-foreground: var(--sidebar-selected-foreground);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
diff --git a/packages/app/src/globals.tab-surface-tokens.test.ts b/packages/app/src/globals.tab-surface-tokens.test.ts
new file mode 100644
index 000000000..b75d1ad56
--- /dev/null
+++ b/packages/app/src/globals.tab-surface-tokens.test.ts
@@ -0,0 +1,49 @@
+import { describe, expect, test } from 'vitest';
+import { readGlobalsCssWithoutComments } from './globals-css.test-helper';
+
+const CSS = readGlobalsCssWithoutComments();
+
+const TAB_SURFACE_UTILITIES = [
+ 'sidebar-hover',
+ 'sidebar-hover-foreground',
+ 'sidebar-hover-muted-foreground',
+ 'sidebar-selected',
+ 'sidebar-selected-foreground',
+] as const;
+
+function themeInlineBlock(): string {
+ const start = CSS.indexOf('@theme inline');
+ if (start === -1) return '';
+ let depth = 0;
+ for (let i = CSS.indexOf('{', start); i < CSS.length; i++) {
+ if (CSS[i] === '{') depth++;
+ else if (CSS[i] === '}' && --depth === 0) return CSS.slice(start, i);
+ }
+ return '';
+}
+
+const THEME_INLINE = themeInlineBlock();
+
+function themeAlias(token: string): string | null {
+ const match = THEME_INLINE.match(new RegExp(`--color-${token}\\s*:\\s*var\\(--${token}\\)`));
+ return match?.[0] ?? null;
+}
+
+describe('globals.css — tab surface tokens', () => {
+ test('the @theme inline block is found, so the assertions below are not vacuous', () => {
+ expect(THEME_INLINE.length, '@theme inline block not located in globals.css').toBeGreaterThan(
+ 0,
+ );
+ expect(THEME_INLINE).toMatch(/--color-sidebar\s*:\s*var\(--sidebar\)/);
+ });
+
+ test.each(TAB_SURFACE_UTILITIES)(
+ 'registers --color-%s, without which Tailwind emits no utility for it',
+ (token) => {
+ expect(
+ themeAlias(token),
+ `--color-${token} is unregistered, so text-/bg-${token} produces no CSS rule and the element falls back through the cascade`,
+ ).not.toBeNull();
+ },
+ );
+});