🧱 feat: Layered Surface Roles for the ClickHouse Theme (#16737)

* feat: Layered Surface Roles for the ClickHouse Theme

Adds purpose-named roles for the chat canvas, user message, cards, sidebar rows, settings tabs, menu panels, composer and search pill. Each follows the surface it painted before, so the default theme is unchanged; ClickHouse steps them apart with Click UI tokens.

* fix: Align Sticky Phase Headers, Boot Routes, and Row Fades With the Layer Roles

* fix: Cover Trailing Slash and Bare Dashboard Paths in the Boot Canvas Route

* fix: Match Boot Canvas Routes Case-Insensitively

* test: Expect the User Message Role on Other-Author Turns

* test: Expect the User Message Role on the Subagent Briefing
This commit is contained in:
Marco Beretta 2026-10-05 21:22:36 +02:00 • committed by GitHub
parent 34279ca333
commit 05e23c8a63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 616 additions and 80 deletions

View file

@ -105,9 +105,15 @@
try {
const cached = JSON.parse(localStorage.getItem('deployment-theme') || 'null');
const boot =
cached && cached.v === 1 && cached.modes && cached.modes[dark ? 'dark' : 'light'];
cached && cached.v === 2 && cached.modes && cached.modes[dark ? 'dark' : 'light'];
if (boot && Array.isArray(boot.properties)) {
let surface;
let canvas;
/* Only the conversation paints the canvas, and the redirects that land on it; other routes keep the split surface. */
const chatRoute =
path === '' ||
/^(?:c(?:\/|$)|prompts(?:\/new)?\/?$)/i.test(path) ||
(/^d(?:\/|$)/i.test(path) && !/^d\/prompts\/(?!new\/?$)[^/]/i.test(path));
boot.properties.forEach(function (entry) {
if (typeof entry[0] === 'string' && entry[0].indexOf('--') === 0) {
root.style.setProperty(entry[0], String(entry[1]));
@ -115,13 +121,19 @@
* whitespace between channels is accepted, as the theme validator does. */
const channels = String(entry[1]).trim().split(/\s+/);
if (
entry[0] === '--surface-primary-alt' &&
(entry[0] === '--surface-primary-alt' || entry[0] === '--surface-canvas') &&
channels.length === 3 &&
channels.every(function (channel) {
return /^\d{1,3}$/.test(channel);
})
) {
surface = channels.join(', ');
/* The conversation paints `surface-canvas`; a cache from before that role
* existed carries only the split surface it followed. */
if (entry[0] === '--surface-canvas') {
canvas = channels.join(', ');
} else {
surface = channels.join(', ');
}
}
}
});
@ -134,8 +146,8 @@
},
);
root.setAttribute('data-theme-boot', '');
if (surface) {
backgroundColor = 'rgb(' + surface + ')';
if ((chatRoute && canvas) || surface) {
backgroundColor = 'rgb(' + ((chatRoute && canvas) || surface) + ')';
}
}
} catch (e) {

View file

@ -137,7 +137,9 @@ describe('index.html deployment theme boot script', () => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-primary-alt' ? [name, '0 0 0;}</style><b>x'] : [name, value],
name === '--surface-primary-alt' || name === '--surface-canvas'
? [name, '0 0 0;}</style><b>x']
: [name, value],
);
writeThemeCache(entry);
boot();
@ -145,11 +147,71 @@ describe('index.html deployment theme boot script', () => {
expect(document.head.textContent).not.toContain('</style>');
});
it('paints the cached canvas over the split surface it follows by default', () => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-canvas' ? [name, '1 2 3'] : [name, value],
);
writeThemeCache(entry);
boot();
expect(document.head.textContent).toContain('background-color: rgb(1, 2, 3)');
});
it('keeps the split surface on routes that do not paint the canvas', () => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-canvas' ? [name, '1 2 3'] : [name, value],
);
writeThemeCache(entry);
window.history.pushState({}, '', '/agents');
boot();
expect(document.head.textContent).toContain('background-color: rgb(8, 10, 24)');
});
it('paints the canvas for the prompt redirect that lands on a new chat', () => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-canvas' ? [name, '1 2 3'] : [name, value],
);
writeThemeCache(entry);
window.history.pushState({}, '', '/prompts/new');
boot();
expect(document.head.textContent).toContain('background-color: rgb(1, 2, 3)');
});
it.each([
['/d', 'rgb(1, 2, 3)'],
['/d/', 'rgb(1, 2, 3)'],
['/d/prompts', 'rgb(1, 2, 3)'],
['/d/prompts/', 'rgb(1, 2, 3)'],
['/d/prompts/new', 'rgb(1, 2, 3)'],
['/d/anything', 'rgb(1, 2, 3)'],
['/d/prompts/abc123', 'rgb(8, 10, 24)'],
['/D/Prompts/abc123', 'rgb(8, 10, 24)'],
['/D/Prompts/New', 'rgb(1, 2, 3)'],
['/C/new', 'rgb(1, 2, 3)'],
])('classifies the legacy dashboard path %s by where it lands', (path, expected) => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-canvas' ? [name, '1 2 3'] : [name, value],
);
writeThemeCache(entry);
window.history.pushState({}, '', path);
boot();
expect(document.head.textContent).toContain(`background-color: ${expected}`);
});
it('accepts any whitespace between the cached surface channels', () => {
localStorage.setItem('color-theme', 'dark');
const entry = buildThemeCache('tenant-a:user-1', 'acme', acme);
entry.modes.dark.properties = entry.modes.dark.properties.map(([name, value]) =>
name === '--surface-primary-alt' ? [name, ' 8 10\t24 '] : [name, value],
name === '--surface-primary-alt' || name === '--surface-canvas'
? [name, ' 8 10\t24 ']
: [name, value],
);
writeThemeCache(entry);
boot();

View file

@ -10,7 +10,7 @@ type DeploymentThemeValue = TInterfaceConfig['theme'];
* replays `modes` before the bundle runs, so its key and shape must stay in step.
*/
export const THEME_CACHE_KEY = 'deployment-theme';
export const THEME_CACHE_VERSION = 1;
export const THEME_CACHE_VERSION = 2;
export type ThemeCacheEntry = {
v: typeof THEME_CACHE_VERSION;

View file

@ -84,7 +84,7 @@ const AgentCard = memo(
className={cn(
/* The article keeps a plain resting fill so the grid slot still reads as a
card while the surface layer is away being the dialog. */
'group rounded-theme-surface bg-surface-secondary relative flex h-full min-h-[17.5rem] min-w-0 flex-col p-5',
'group rounded-theme-surface bg-surface-card relative flex h-full min-h-[17.5rem] min-w-0 flex-col p-5',
className,
)}
>
@ -97,7 +97,7 @@ const AgentCard = memo(
borderRadius: surfaceRadius,
willChange: morphing ? 'transform' : undefined,
}}
className="rounded-theme-surface border-border-light bg-surface-secondary group-hover:border-border-medium group-hover:bg-surface-tertiary pointer-events-none absolute inset-0 z-0 border transition-colors duration-150"
className="rounded-theme-surface border-border-light bg-surface-card group-hover:border-border-medium group-hover:bg-surface-card-hover pointer-events-none absolute inset-0 z-0 border transition-colors duration-150"
{...shared}
/>

View file

@ -229,7 +229,7 @@ const AgentDetailContent: React.FC<AgentDetailContentProps> = ({
initial={morphing ? { opacity: 1 } : false}
animate={{ opacity: morphing && morph === 'closing' ? 1 : 0 }}
transition={MORPH_OPEN_TRANSITION}
className="border-border-light bg-surface-secondary pointer-events-none absolute inset-0 border"
className="border-border-light bg-surface-card pointer-events-none absolute inset-0 border"
/>
{/* Only the category and the close control are pinned above the scroll:

View file

@ -361,7 +361,7 @@ const AgentGrid: React.FC<AgentGridProps> = ({
and reading order reach it immediately; without rows it is the whole of the
page. */}
<div ref={recoveryCardRef} className="pointer-events-auto w-full max-w-xl pb-5">
<div className="rounded-theme-surface border-border-light bg-surface-secondary high-contrast:border-border-medium high-contrast:shadow-none border shadow-lg">
<div className="rounded-theme-surface border-border-light bg-surface-card high-contrast:border-border-medium high-contrast:shadow-none border shadow-lg">
{errorCard}
</div>
</div>

View file

@ -92,7 +92,7 @@ export default function GridSkeleton({ scrollElementRef, label }: GridSkeletonPr
{Array.from({ length: count }, (_, index) => (
<div
key={index}
className="border-border-light bg-surface-secondary rounded-theme-surface flex min-h-[17.5rem] min-w-0 flex-col border p-5"
className="border-border-light bg-surface-card rounded-theme-surface flex min-h-[17.5rem] min-w-0 flex-col border p-5"
>
{card}
</div>

View file

@ -243,7 +243,7 @@ function ChatView({
so they cannot paint through the approval preview. */}
<div
className={cn(
'bg-surface-primary-alt relative z-10 w-full [view-transition-name:chat-form]',
'bg-surface-canvas relative z-10 w-full [view-transition-name:chat-form]',
!isLandingPage && 'scrollbar-gutter-spacer',
isLandingPage && 'max-w-3xl transition-all duration-200 xl:max-w-4xl',
)}

View file

@ -83,7 +83,7 @@ function Header({
return (
/* The composer review is in a z-10 stacking context. Keep header controls
above it when a tall review reaches the top of a short viewport. */
<div className="from-surface-primary-alt via-surface-primary-alt/70 text-text-primary md:from-surface-primary-alt/80 md:via-surface-primary-alt/50 2xl:from-surface-primary-alt/0 absolute top-0 z-20 flex h-[3.25rem] w-full items-center gap-2 bg-gradient-to-b to-transparent p-2 font-semibold 2xl:via-transparent">
<div className="from-surface-canvas via-surface-canvas/70 text-text-primary md:from-surface-canvas/80 md:via-surface-canvas/50 2xl:from-surface-canvas/0 absolute top-0 z-20 flex h-[3.25rem] w-full items-center gap-2 bg-gradient-to-b to-transparent p-2 font-semibold 2xl:via-transparent">
<div className={cn('flex-shrink-0 items-center', isSmallScreen ? 'flex' : 'hidden')}>
<OpenSidebar testId="header-open-sidebar-button" />
</div>

View file

@ -134,7 +134,7 @@ export default function CodeApprovalMenu({
unmountOnHide={true}
className={cn(
'z-50 flex max-w-[min(320px,calc(100vw-2rem))] min-w-[260px] flex-col rounded-2xl',
'border-border-light bg-presentation max-h-[var(--popover-available-height)] overflow-y-auto border p-1 shadow-lg',
'border-border-menu bg-surface-menu max-h-[var(--popover-available-height)] overflow-y-auto border p-1 shadow-lg',
'origin-bottom opacity-0 transition-[opacity,transform] duration-200 ease-out',
'data-[enter]:scale-100 data-[enter]:opacity-100',
'scale-95 data-[leave]:scale-95 data-[leave]:opacity-0',

View file

@ -52,7 +52,7 @@ const stateLabels: Partial<Record<CodeWorkspaceResult['state'], TranslationKeys>
const headingClasses = 'px-2.5 pt-2 pb-1 text-xs font-semibold text-text-secondary';
const menuClasses = cn(
'z-50 flex max-w-[min(360px,calc(100vw-2rem))] min-w-[260px] flex-col rounded-2xl',
'border-border-light bg-presentation max-h-[var(--popover-available-height)] overflow-y-auto border p-1 shadow-lg',
'border-border-menu bg-surface-menu max-h-[var(--popover-available-height)] overflow-y-auto border p-1 shadow-lg',
'origin-bottom opacity-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none',
'data-[enter]:scale-100 data-[enter]:opacity-100',
'scale-95 data-[leave]:scale-95 data-[leave]:opacity-0',

View file

@ -157,7 +157,7 @@ export function ChipModes({ modes }: ChipModesProps) {
gutter={6}
unmountOnHide
onClick={(event) => event.stopPropagation()}
className="animate-composer-popover border-border-light bg-presentation z-50 min-w-[10rem] rounded-xl border p-1 shadow-lg outline-hidden"
className="animate-composer-popover border-border-menu bg-surface-menu z-50 min-w-[10rem] rounded-xl border p-1 shadow-lg outline-hidden"
>
{modes.map((mode) => (
<Ariakit.MenuItem

View file

@ -1303,7 +1303,7 @@ function Palette({
getAnchorRect={() => anchorRef.current?.getBoundingClientRect() ?? null}
aria-label={localize('com_ui_composer_palette')}
style={{ width: 'var(--popover-anchor-width)' }}
className="animate-composer-popover border-border-light bg-presentation z-50 flex max-w-[95vw] flex-col overflow-hidden rounded-2xl border shadow-lg outline-hidden"
className="animate-composer-popover border-border-menu bg-surface-menu z-50 flex max-w-[95vw] flex-col overflow-hidden rounded-2xl border shadow-lg outline-hidden"
>
{/* The whole row is the search target, not just the input: the icon
and the padding around it read as part of the field, so clicking

View file

@ -74,8 +74,8 @@ export const CustomMenu = React.forwardRef<HTMLDivElement, CustomMenuProps>(func
className={cn(
parent ? 'animate-popover-left ml-3' : 'animate-popover',
'z-40 flex max-h-[min(28.125rem,var(--popover-available-height))] w-full outline-hidden!',
'border-border-light w-[var(--menu-width,auto)] min-w-[min(18.75rem,90vw)] flex-col overflow-auto rounded-xl border',
'bg-presentation text-text-primary text-sm shadow-lg',
'border-border-menu w-[var(--menu-width,auto)] min-w-[min(18.75rem,90vw)] flex-col overflow-auto rounded-xl border',
'bg-surface-menu text-text-primary text-sm shadow-lg',
parent ? 'px-0.5 py-0.5' : 'px-3 py-2',
'max-w-[calc(100vw-4rem)] sm:max-h-[calc(65vh)] sm:max-w-[25rem]',
searchable && 'p-0',
@ -96,7 +96,7 @@ export const CustomMenu = React.forwardRef<HTMLDivElement, CustomMenuProps>(func
)}
/>
{comboboxLabel && (
<label className="text-text-secondary peer-[:not(:placeholder-shown)]:bg-presentation pointer-events-none absolute top-2.5 left-2.5 text-sm transition-all duration-200 peer-[:not(:placeholder-shown)]:-top-1.5 peer-[:not(:placeholder-shown)]:left-1.5 peer-[:not(:placeholder-shown)]:text-xs sm:top-1.5">
<label className="text-text-secondary peer-[:not(:placeholder-shown)]:bg-surface-menu pointer-events-none absolute top-2.5 left-2.5 text-sm transition-all duration-200 peer-[:not(:placeholder-shown)]:-top-1.5 peer-[:not(:placeholder-shown)]:left-1.5 peer-[:not(:placeholder-shown)]:text-xs sm:top-1.5">
{comboboxLabel}
</label>
)}

View file

@ -90,7 +90,7 @@ const PresetsMenu: FC = () => {
sideOffset={8}
collisionPadding={16}
aria-label={localize('com_endpoint_examples')}
className="rounded-theme-surface border-border-light bg-presentation text-text-primary z-50 max-h-[min(30.9375rem,80vh)] overflow-x-hidden border shadow-lg md:min-w-[min(25rem,90vw)]"
className="rounded-theme-surface border-border-menu bg-surface-menu text-text-primary z-50 max-h-[min(30.9375rem,80vh)] overflow-x-hidden border shadow-lg md:min-w-[min(25rem,90vw)]"
>
<PresetItems
presets={presetsQuery.data}

View file

@ -121,7 +121,7 @@ const SteerPart = memo(function SteerPart({
>
<div className="user-turn relative flex w-fit max-w-[90%] flex-col items-end sm:max-w-[85%]">
<h2 className="sr-only">{label}</h2>
<div className="rounded-theme-surface rounded-br-theme-control bg-surface-tertiary px-theme-normal flex max-w-full flex-col items-start gap-2 py-2.5">
<div className="rounded-theme-surface rounded-br-theme-control bg-surface-user-message px-theme-normal flex max-w-full flex-col items-start gap-2 py-2.5">
<MessageQuotes quotes={quotes} />
{(imageFiles.length > 0 || otherFiles.length > 0) && (
<div className="flex w-full flex-wrap gap-2">

View file

@ -169,7 +169,7 @@ describe('SteerPart presentation', () => {
renderPart();
const message = screen.getByText('steered words');
expect(message.closest('.bg-surface-tertiary')).toHaveClass('rounded-theme-surface');
expect(message.closest('.bg-surface-user-message')).toHaveClass('rounded-theme-surface');
expect(screen.getByRole('heading', { name: 'Danny' })).toHaveClass('sr-only');
expect(screen.queryByTitle('Danny')).not.toBeInTheDocument();
});
@ -234,7 +234,7 @@ describe('SteerPart presentation', () => {
);
const quotes = screen.getByTestId('message-quotes');
expect(quotes).toHaveTextContent('the selected excerpt');
expect(quotes.closest('.bg-surface-tertiary')).not.toBeNull();
expect(quotes.closest('.bg-surface-user-message')).not.toBeNull();
});
it('renders no quote block when the steer carried none', () => {

View file

@ -172,7 +172,7 @@ export default function MessageRow({
'rounded-theme-surface rounded-br-theme-control px-theme-normal w-fit',
isSystem || outlined
? 'border-border-medium border py-1.5'
: 'bg-surface-tertiary py-2.5',
: 'bg-surface-user-message py-2.5',
)
: 'w-full',
)}

View file

@ -187,7 +187,7 @@ describe('MessageRender wake-up rows', () => {
expect(screen.queryByText(/agent_reviewer/)).not.toBeInTheDocument();
/** Delivered by the host, not typed: outlined, on the user's side. */
expect(screen.getByTestId('message-body')).toHaveClass('border', 'border-border-medium');
expect(screen.getByTestId('message-body')).not.toHaveClass('bg-surface-tertiary');
expect(screen.getByTestId('message-body')).not.toHaveClass('bg-surface-user-message');
expect(screen.getByTestId('wakeup-card')).toBeInTheDocument();
});
@ -341,7 +341,7 @@ describe('MessageRender wake-up rows', () => {
renderMessage('Hello there');
expect(screen.getByRole('heading', { hidden: true })).toHaveClass('sr-only');
expect(screen.getByTestId('message-body')).toHaveClass('bg-surface-tertiary');
expect(screen.getByTestId('message-body')).toHaveClass('bg-surface-user-message');
});
});

View file

@ -59,7 +59,7 @@ describe('MessageRow', () => {
expect(row).toHaveClass('justify-end');
expect(row.querySelector('.user-turn')).toHaveClass('items-end');
expect(messageSurface).toHaveClass('border', 'border-border-medium', 'rounded-theme-surface');
expect(messageSurface).not.toHaveClass('bg-surface-tertiary');
expect(messageSurface).not.toHaveClass('bg-surface-user-message');
expect(heading).not.toHaveClass('sr-only');
expect(screen.queryByText('You')).not.toBeInTheDocument();
expect(screen.getByTestId('message-actions')).toBeInTheDocument();
@ -80,7 +80,7 @@ describe('MessageRow', () => {
expect(heading).toContainElement(screen.getByTestId('message-icon'));
expect(screen.getByTestId('message-icon').parentElement).toHaveClass('size-6');
expect(heading.lastElementChild).toHaveTextContent('You');
expect(messageSurface).toHaveClass('bg-surface-tertiary');
expect(messageSurface).toHaveClass('bg-surface-user-message');
expect(messageSurface).not.toHaveClass('border');
});
@ -90,7 +90,7 @@ describe('MessageRow', () => {
const messageSurface = screen.getByText(MESSAGE_BODY).parentElement;
expect(messageSurface).toHaveClass('border', 'border-border-medium');
expect(messageSurface).not.toHaveClass('bg-surface-tertiary');
expect(messageSurface).not.toHaveClass('bg-surface-user-message');
expect(screen.getByRole('heading', { name: 'Message from You' })).toBeVisible();
});
@ -104,7 +104,7 @@ describe('MessageRow', () => {
expect(row).toHaveAttribute('role', 'group');
expect(row).toHaveClass('justify-end');
expect(userTurn).toHaveClass('items-end');
expect(messageSurface).toHaveClass('bg-surface-tertiary', 'rounded-theme-surface');
expect(messageSurface).toHaveClass('bg-surface-user-message', 'rounded-theme-surface');
expect(screen.queryByTestId('message-icon')).not.toBeInTheDocument();
expect(screen.getByRole('heading', { hidden: true })).toHaveClass('sr-only');
});
@ -189,7 +189,7 @@ describe('MessageRow', () => {
expect(row.querySelector('.user-turn')).toHaveClass('w-full');
expect(messageSurface).toHaveClass('w-full');
expect(messageSurface).not.toHaveClass('bg-surface-tertiary');
expect(messageSurface).not.toHaveClass('bg-surface-user-message');
});
it('expands an edited assistant message to full width', () => {

View file

@ -2,5 +2,5 @@ import { createContext } from 'react';
/** Opaque sticky rows must repaint the canvas their host actually uses. */
export const MessageSurfaceContext = createContext<
'bg-surface-primary-alt' | 'bg-surface-secondary' | 'bg-surface-dialog'
'bg-surface-canvas' | 'bg-surface-primary-alt' | 'bg-surface-secondary' | 'bg-surface-dialog'
>('bg-surface-primary-alt');

View file

@ -6,6 +6,7 @@ import type { ExtendedFile } from '~/common';
import { ParentSubagentsProvider } from '~/components/Chat/Subagents/ParentSubagentsProvider';
import useArtifactsRegistryLifetime from '~/hooks/Artifacts/useArtifactsRegistryLifetime';
import { useDeleteFilesMutation, useGetStartupConfig } from '~/data-provider';
import { MessageSurfaceContext } from '~/components/Chat/Messages/ui/surface';
import DragDropWrapper from '~/components/Chat/Input/Files/DragDropWrapper';
import UndockedArtifacts from '~/components/Artifacts/UndockedArtifacts';
import { activeSubagentPanel } from '~/components/Chat/Subagents/state';
@ -167,7 +168,7 @@ export default function Presentation({
const panelElement = (isUndocked ? null : artifactsElement) ?? subagentElement;
return (
<DragDropWrapper className="bg-surface-primary-alt relative flex w-full grow overflow-hidden">
<DragDropWrapper className="bg-surface-canvas relative flex w-full grow overflow-hidden">
<AppChatSurface>
{/* The editor buffer belongs to the pane's session, not to the window
it happens to be in: hoisted, an undock keeps unsaved edits. */}
@ -179,7 +180,9 @@ export default function Presentation({
>
<SidePanelGroup panel={panelElement}>
<main className="flex h-full flex-col overflow-y-auto" role="main">
{children}
<MessageSurfaceContext.Provider value="bg-surface-canvas">
{children}
</MessageSurfaceContext.Provider>
</main>
</SidePanelGroup>
</ParentSubagentsProvider>

View file

@ -124,7 +124,7 @@ describe('SubagentConversation', () => {
expect(briefing).toHaveClass('justify-end');
expect(within(briefing).getByRole('heading', { name: /Lia$/ })).toBeInTheDocument();
expect(within(briefing).getByTestId('parent-face')).toBeInTheDocument();
expect(within(briefing).getByTestId('message-body')).toHaveClass('bg-surface-tertiary');
expect(within(briefing).getByTestId('message-body')).toHaveClass('bg-surface-user-message');
expect(screen.queryByText('com_ui_subagent_trigger_parent_dispatch')).not.toBeInTheDocument();
expect(screen.getByText('com_ui_subagent_trigger_external_event')).toBeInTheDocument();
expect(screen.getAllByRole('heading', { name: /^com_ui_system_event/ })).toHaveLength(1);

View file

@ -149,7 +149,7 @@ const ChatsHeader: FC<ChatsHeaderProps> = memo(({ isExpanded, onToggle, trailing
<div
className={cn(
'flex h-8 w-full items-center pr-1',
highlight && 'bg-surface-active-alt rounded-lg',
highlight && 'bg-surface-nav-selected rounded-lg',
)}
>
<button

View file

@ -330,8 +330,8 @@ function Conversation({
className={cn(
'group focus-visible:ring-text-primary relative flex h-12 w-full items-center rounded-lg outline-hidden focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset md:h-9',
isActiveConvo || isPopoverActive
? 'bg-surface-active-alt before:bg-text-primary before:absolute before:top-1 before:bottom-1 before:left-0 before:w-0.5 before:rounded-full'
: 'hover:bg-surface-active-alt',
? 'bg-surface-nav-selected before:bg-text-primary before:absolute before:top-1 before:bottom-1 before:left-0 before:w-0.5 before:rounded-full'
: 'hover:bg-surface-nav-hover',
)}
onPointerEnter={(event) => {
if (event.pointerType === 'mouse') {
@ -409,8 +409,8 @@ function Conversation({
className={cn(
'bg-status-info pointer-events-none absolute -right-0.5 -bottom-0.5 size-2 rounded-full ring-2',
isActiveConvo || isPopoverActive
? 'ring-surface-active-alt'
: 'ring-surface-primary-alt group-hover:ring-surface-active-alt',
? 'ring-surface-nav-selected'
: 'ring-surface-primary-alt group-hover:ring-surface-nav-hover',
)}
/>
)}

View file

@ -135,7 +135,7 @@ const ConvoLink: React.FC<ConvoLinkProps> = ({
type="button"
className={cn(
'focus-visible:ring-text-primary flex w-full min-w-0 grow cursor-pointer items-center gap-2 self-stretch overflow-hidden rounded-lg px-2 text-left outline-hidden focus-visible:ring-2 focus-visible:ring-inset',
isActiveConvo || isPopoverActive ? 'bg-surface-active-alt' : '',
isActiveConvo || isPopoverActive ? 'bg-surface-nav-selected' : '',
)}
aria-current={isActiveConvo ? 'page' : undefined}
aria-keyshortcuts={keyShortcuts}

View file

@ -23,11 +23,11 @@ const HoverToggle = ({
<div
onClick={onClick}
className={cn(
'peer items-center gap-1.5 rounded-r-lg pl-2 pr-2 text-text-primary',
'peer text-text-primary items-center gap-1.5 rounded-r-lg pr-2 pl-2',
isPopoverActive || isActiveConvo ? 'flex' : 'hidden group-hover:flex',
isActiveConvo
? 'from-surface-secondary from-85% to-transparent group-hover:bg-gradient-to-l group-hover:from-surface-active-alt'
: 'z-50 from-surface-secondary from-0% to-transparent hover:bg-gradient-to-l hover:from-surface-active-alt',
? 'from-surface-secondary group-hover:from-surface-nav-selected from-85% to-transparent group-hover:bg-gradient-to-l'
: 'from-surface-secondary hover:from-surface-nav-hover z-50 from-0% to-transparent hover:bg-gradient-to-l',
isPopoverActive && !isActiveConvo ? 'from-surface-secondary' : '',
className,
)}

View file

@ -716,7 +716,7 @@ const PinnedSection = ({
<div
className={cn(
'flex h-8 w-full items-center pr-1',
isPinOver && canPin && 'bg-surface-active-alt rounded-lg',
isPinOver && canPin && 'bg-surface-nav-selected rounded-lg',
)}
>
<button
@ -744,7 +744,7 @@ const PinnedSection = ({
className={cn(
'text-text-secondary flex h-9 items-center justify-center rounded-lg border border-dashed text-xs',
isPinOver && canPin
? 'border-border-medium bg-surface-active-alt text-text-primary'
? 'border-border-medium bg-surface-nav-selected text-text-primary'
: 'border-border-light',
)}
aria-hidden="true"

View file

@ -304,10 +304,11 @@ const ProjectItem = memo(
<li className="max-w-full min-w-0 list-none" ref={projectRowRef}>
<div
className={cn(
'group text-text-primary hover:bg-surface-active-alt relative flex h-9 max-w-full min-w-0 items-center rounded-lg text-sm',
isActive && 'bg-surface-active-alt hover:bg-surface-active-alt',
!isActive && isMenuOpen && 'bg-surface-active-alt',
isDropOver && canDrop && 'bg-surface-active-alt ring-border-medium ring-1 ring-inset',
'group text-text-primary relative flex h-9 max-w-full min-w-0 items-center rounded-lg text-sm',
isActive || isMenuOpen || (isDropOver && canDrop)
? 'bg-surface-nav-selected'
: 'hover:bg-surface-nav-hover',
isDropOver && canDrop && 'ring-border-medium ring-1 ring-inset',
)}
>
<button

View file

@ -43,7 +43,7 @@ const RenameForm: React.FC<RenameFormProps> = ({
return (
<div
className="bg-surface-active-alt absolute inset-0 z-20 flex w-full items-center rounded-lg p-1.5"
className="bg-surface-nav-selected absolute inset-0 z-20 flex w-full items-center rounded-lg p-1.5"
role="form"
aria-label={localize('com_ui_rename_conversation')}
>

View file

@ -113,8 +113,8 @@ function AccountSettings({ collapsed = false }: { collapsed?: boolean }) {
data-testid="nav-user"
className={
collapsed
? 'hover:bg-surface-active-alt aria-[expanded=true]:bg-surface-active-alt flex h-9 w-9 items-center justify-center rounded-lg transition-colors'
: 'hover:bg-surface-active-alt aria-[expanded=true]:bg-surface-active-alt flex h-auto w-full items-center gap-2 rounded-xl p-2 text-sm transition-all duration-200 ease-in-out'
? 'hover:bg-surface-nav-hover aria-[expanded=true]:bg-surface-nav-selected flex h-9 w-9 items-center justify-center rounded-lg transition-colors'
: 'hover:bg-surface-nav-hover aria-[expanded=true]:bg-surface-nav-selected flex h-auto w-full items-center gap-2 rounded-xl p-2 text-sm transition-all duration-200 ease-in-out'
}
>
<div className={collapsed ? 'size-7 shrink-0' : 'h-8 w-8 shrink-0'}>

View file

@ -137,7 +137,7 @@ export default function FavoriteItem(props: FavoriteItemProps) {
tabIndex={0}
aria-label={ariaLabel}
aria-keyshortcuts={keyShortcuts}
className="group text-text-primary hover:bg-surface-active-alt focus-visible:ring-text-primary relative flex w-full cursor-pointer items-center justify-between rounded-lg p-2 text-sm outline-hidden focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset"
className="group text-text-primary hover:bg-surface-nav-hover focus-visible:ring-text-primary relative flex w-full cursor-pointer items-center justify-between rounded-lg p-2 text-sm outline-hidden focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset"
onClick={handleClick}
onKeyDown={handleKeyDown}
data-testid="favorite-item"

View file

@ -166,7 +166,7 @@ const SearchBar = forwardRef((props: SearchBarProps, ref: React.Ref<HTMLDivEleme
*
* No edge on focus, by request. What marks the focused field is its caret and
* the chord appearing in the trailing slot. */
className="group bg-surface-secondary text-text-primary flex h-9 min-w-0 flex-1 cursor-text items-center gap-2 rounded-lg pr-1 pl-2.5"
className="group bg-surface-search text-text-primary flex h-9 min-w-0 flex-1 cursor-text items-center gap-2 rounded-lg pr-1 pl-2.5"
>
<Search aria-hidden="true" className="text-text-secondary size-4 shrink-0" />
<input

View file

@ -79,7 +79,7 @@ export default function Sidebar({
onClick={() => onSelectTab(tab.id)}
className={cn(
'text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:ring-text-primary rounded-theme-control flex shrink-0 items-center justify-between gap-2 px-3 py-2.5 text-sm transition-colors focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset md:py-2',
'data-[state=active]:bg-surface-tertiary data-[state=active]:text-text-primary',
'data-[state=active]:bg-surface-tab-selected data-[state=active]:text-text-primary',
)}
>
<span className="flex min-w-0 items-center gap-2 [&>svg]:shrink-0">

View file

@ -140,8 +140,10 @@ function ChatGroupItem({
<>
<div
className={cn(
'group hover:bg-surface-active-alt relative mb-0.5 rounded-lg bg-transparent',
!isChatRoute && params.promptId === group._id && 'bg-surface-active-alt',
'group relative mb-0.5 rounded-lg bg-transparent',
!isChatRoute && params.promptId === group._id
? 'bg-surface-nav-selected'
: 'hover:bg-surface-nav-hover',
)}
>
{/* Clickable overlay for card */}

View file

@ -31,7 +31,7 @@ const SidePanelGroup = memo(({ panel, children }: SidePanelProps) => {
{/* The surface behind the panels is this group's host, not the group
primitive: the resizer owns its own chrome, and the caller owns the
backdrop the panels sit on. */}
<div className="bg-surface-primary-alt relative min-w-0 flex-1">
<div className="relative min-w-0 flex-1">
<ResizablePanelGroup
orientation="horizontal"
defaultLayout={defaultLayout}

View file

@ -160,7 +160,7 @@ function FileTreeNode({
'flex w-full items-center gap-1.5 rounded-lg text-sm select-none',
isFileActive
? 'bg-surface-active text-text-primary font-medium'
: 'text-text-secondary hover:bg-surface-active-alt hover:text-text-primary',
: 'text-text-secondary hover:bg-surface-nav-hover hover:text-text-primary',
)}
aria-expanded={isFolder ? isOpen : undefined}
>
@ -308,7 +308,7 @@ function SkillListItem({
className={cn(
'text-text-primary flex w-full items-center gap-1 rounded-lg pr-1 text-sm select-none',
isActive && !activeFile && 'bg-surface-active',
!isActive && 'hover:bg-surface-active-alt',
!isActive && 'hover:bg-surface-nav-hover',
)}
>
<button

View file

@ -38,7 +38,7 @@ function Switcher({
id: `nav-panel-${link.id}`,
label: localize(link.title),
ariaChecked: link.id === activeId,
className: link.id === activeId ? 'bg-surface-active-alt' : undefined,
className: link.id === activeId ? 'bg-surface-nav-selected' : undefined,
icon: <link.icon className="text-text-primary size-5" aria-hidden="true" />,
onClick: () => {
if (link.onClick) {

View file

@ -2063,8 +2063,8 @@ html[data-input-modality='keyboard']
border-radius: var(--theme-menu-radius, 0.7rem);
border-width: 1px;
border-style: solid;
border-color: rgb(var(--border-light) / var(--border-light-alpha, 1));
background-color: rgb(var(--surface-primary));
border-color: rgb(var(--border-menu) / var(--border-menu-alpha, var(--border-light-alpha, 1)));
background-color: rgb(var(--surface-popover));
padding: 0.5rem;
color: rgb(var(--text-primary));
/* The `menuShadow` role, whose light default is this literal. */
@ -2102,7 +2102,7 @@ html[data-input-modality='keyboard']
}
.popover-ui:where(.dark, .dark *) {
background-color: rgb(var(--surface-secondary));
background-color: rgb(var(--surface-popover));
color: rgb(var(--text-secondary));
box-shadow: var(
--theme-menu-shadow,

View file

@ -0,0 +1,92 @@
import { expect, test } from '@playwright/test';
import type { Page } from '@playwright/test';
import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/clickhouse';
import { NEW_CHAT_PATH, messagesView, replyPrompt, replyText, sendMessage } from '../helpers';
/**
* Click UI separates the chat canvas from the sidebar and sets the user turn apart from the
* canvas. LibreChat reads each of those layers from its own role, which follows the surface it
* painted before, so the default theme keeps its single flat layer.
*/
test.describe.configure({ timeout: 120_000 });
test.use({ viewport: { width: 1280, height: 800 } });
type Mode = 'light' | 'dark';
type ThemeChoice = 'clickhouse' | 'default';
async function installThemeBridge(page: Page) {
await page.addInitScript((definition) => {
const params = new URL(location.href).searchParams;
const theme = params.get('e2eTheme');
const mode = params.get('e2eThemeMode');
if (theme === null || mode === null) {
return;
}
localStorage.setItem('color-theme', mode);
localStorage.removeItem('theme-colors');
localStorage.removeItem('theme-name');
if (theme === 'clickhouse') {
localStorage.setItem('theme-definition', JSON.stringify(definition));
localStorage.setItem('theme-source', 'definition');
} else {
localStorage.removeItem('theme-definition');
localStorage.removeItem('theme-source');
}
}, clickHouseTheme);
}
async function openChatWithTurn(page: Page, theme: ThemeChoice, mode: Mode) {
await page.goto(`${NEW_CHAT_PATH}?e2eTheme=${theme}&e2eThemeMode=${mode}`, { timeout: 15000 });
const label = `layers-${theme}-${mode}`;
await sendMessage(page, replyPrompt(label));
await expect(messagesView(page).getByText(replyText(label))).toBeVisible({ timeout: 30000 });
await expect(page.locator('.bg-surface-user-message').first()).toBeVisible();
}
const paint = (page: Page, selector: string) =>
page
.locator(selector)
.first()
.evaluate((node) => getComputedStyle(node).backgroundColor);
const rgb = (triplet: string | undefined) => `rgb(${(triplet ?? '').split(' ').join(', ')})`;
const sidebar = 'nav.bg-surface-primary-alt';
test.describe('layered surfaces', () => {
test('the canvas, sidebar and user turn take their own Click UI layers under the ClickHouse theme @scenario:clickhouse-layers-follow-click-ui', async ({
page,
}) => {
await installThemeBridge(page);
for (const mode of ['light', 'dark'] as Mode[]) {
await openChatWithTurn(page, 'clickhouse', mode);
await expect(page.locator('html')).toHaveAttribute('data-theme', 'clickhouse');
const colors = clickHouseTheme.modes[mode]?.colors ?? {};
const canvas = await paint(page, '.bg-surface-canvas');
expect(canvas).toBe(rgb(colors['rgb-surface-canvas']));
expect(await paint(page, sidebar)).toBe(rgb(colors['rgb-surface-primary-alt']));
expect(await paint(page, '.bg-surface-user-message')).toBe(
rgb(colors['rgb-surface-user-message']),
);
expect(canvas).not.toBe(await paint(page, sidebar));
expect(await paint(page, '.bg-surface-user-message')).not.toBe(canvas);
}
});
test('the default theme keeps one canvas and its user turn fill @scenario:default-theme-layers-unchanged', async ({
page,
}) => {
await installThemeBridge(page);
for (const [mode, bubble] of [
['light', 'rgb(236, 236, 236)'],
['dark', 'rgb(47, 47, 47)'],
] as Array<[Mode, string]>) {
await openChatWithTurn(page, 'default', mode);
expect(await paint(page, '.bg-surface-canvas')).toBe(await paint(page, sidebar));
expect(await paint(page, '.bg-surface-user-message')).toBe(bubble);
}
});
});

View file

@ -146,7 +146,7 @@ async function expectFirstPaint(page: Page, mode: Mode) {
expect(frame.theme).toBe('clickhouse');
expect(frame.surface).toBe(colors['rgb-surface-primary']);
if (frame.shell !== null) {
expect(frame.shell).toBe(rgb(colors['rgb-surface-primary-alt']));
expect(frame.shell).toBe(rgb(colors['rgb-surface-canvas']));
}
}
await expect(page.locator('html')).toHaveAttribute('data-theme', 'clickhouse');

View file

@ -124,7 +124,7 @@ for (const definition of ['stock', 'clickhouse'] as const) {
});
expect((await computedStyles(header, ['backgroundColor'])).backgroundColor).toBe(
await probeStyle(page, 'bg-surface-primary-alt', 'background-color'),
await probeStyle(page, 'bg-surface-canvas', 'background-color'),
);
const heading = table.locator('th').first();
const headingStyles = await computedStyles(heading, [

View file

@ -9,7 +9,7 @@ import { openSidebar } from './sidebar';
const userEmail = getE2EUser().email;
/** The row's own highlight, not its `hover:` variant, which every idle row carries. */
const ACTIVE = /(^|\s)bg-surface-active-alt(\s|$)/;
const ACTIVE = /(^|\s)bg-surface-nav-selected(\s|$)/;
const row = (page: Page, title: string) =>
page.getByTestId('convo-item').filter({ hasText: title }).filter({ visible: true }).first();

View file

@ -8,8 +8,8 @@
border-radius: var(--theme-menu-radius, 0.7rem);
border-width: 1px;
border-style: solid;
border-color: rgb(var(--border-light) / var(--border-light-alpha, 1));
background-color: rgb(var(--surface-primary));
border-color: rgb(var(--border-menu) / var(--border-menu-alpha, var(--border-light-alpha, 1)));
background-color: rgb(var(--surface-popover));
padding: 0.5rem;
color: rgb(var(--text-primary));
/* The `menuShadow` role, whose light default is this literal. */
@ -55,7 +55,7 @@ html.high-contrast .popover-ui {
}
.popover-ui:where(.dark, .dark *) {
background-color: rgb(var(--surface-secondary));
background-color: rgb(var(--surface-popover));
color: rgb(var(--text-secondary));
box-shadow: var(
--theme-menu-shadow,

View file

@ -387,6 +387,17 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and a
(0.5rem, 0.25rem and 1rem by default).
- `bg-alert-error-fill` / `border-alert-error-border` - The error `Alert`'s fill and edge. They
follow `status-error-subtle` and `status-error-border`, which the badges, tags and diffs keep.
- Layering roles - `bg-surface-canvas` (the chat canvas and its header fade),
`bg-surface-user-message` (the user turn's bubble), `bg-surface-card` and
`bg-surface-card-hover` (marketplace cards), `bg-surface-nav-hover` and
`bg-surface-nav-selected` (sidebar, rail and drawer rows), `bg-surface-tab-selected`
(the settings tab rail), `bg-surface-menu` and `bg-surface-popover` with `border-border-menu` (menu and popover
panels), `bg-surface-composer` (the composer box) and `bg-surface-search` (the sidebar
search pill). Each follows the surface it painted before it had a name
(`surface-primary-alt`, `surface-tertiary`, `surface-secondary`, `surface-active-alt`,
`presentation` for menus, `surface-primary` or `surface-secondary` for popovers, `border-light`, `surface-chat`),
so a theme that repaints that surface keeps the layer on it, and a theme steps the layers
apart by naming them.
- `border-border-field-focus` - A form field's edge while it holds focus, under
`fieldFocusStyle: border`. Follows `focus-control` when a theme names only that.
- Form fields and labels - `h-theme-field` (`fieldHeight`) sizes `Input`, `Dropdown`

View file

@ -162,6 +162,18 @@ html {
--text-tooltip: var(--text-primary);
--alert-error-fill: var(--status-error-subtle);
--alert-error-border: var(--status-error-border);
--surface-canvas: var(--surface-primary-alt);
--surface-user-message: var(--surface-tertiary);
--surface-card: var(--surface-secondary);
--surface-card-hover: var(--surface-tertiary);
--surface-nav-hover: var(--surface-active-alt);
--surface-nav-selected: var(--surface-active-alt);
--surface-tab-selected: var(--surface-tertiary);
--surface-menu: var(--presentation);
--surface-popover: var(--surface-primary);
--border-menu: var(--border-light);
--surface-composer: var(--surface-chat);
--surface-search: var(--surface-secondary);
--focus-control: var(--gray-800);
--border-disabled: var(--gray-200);
--status-success: var(--green-700);
@ -416,6 +428,18 @@ html {
--text-tooltip: var(--text-primary);
--alert-error-fill: var(--status-error-subtle);
--alert-error-border: var(--status-error-border);
--surface-canvas: var(--surface-primary-alt);
--surface-user-message: var(--surface-tertiary);
--surface-card: var(--surface-secondary);
--surface-card-hover: var(--surface-tertiary);
--surface-nav-hover: var(--surface-active-alt);
--surface-nav-selected: var(--surface-active-alt);
--surface-tab-selected: var(--surface-tertiary);
--surface-menu: var(--presentation);
--surface-popover: var(--surface-secondary);
--border-menu: var(--border-light);
--surface-composer: var(--surface-chat);
--surface-search: var(--surface-secondary);
--focus-control: var(--gray-100);
--border-disabled: var(--gray-650);
--status-success: var(--green-300);
@ -487,11 +511,36 @@ html {
/* A root other than the document one that a legacy palette themes (`THEME_SCOPE_ATTRIBUTE` in
utils/applyTheme.ts) keeps its avatar backdrop on its own surfaces, following the mode, as the
document root's alias above does. An explicit avatar-placeholder set inline still wins. */
document root's alias above does. The layering roles alias their source the same way, so a
scoped palette that repaints the source moves them. An explicit role set inline still wins. */
[data-theme-scope] {
--avatar-placeholder: var(--surface-secondary);
--surface-canvas: var(--surface-primary-alt);
--surface-user-message: var(--surface-tertiary);
--surface-card: var(--surface-secondary);
--surface-card-hover: var(--surface-tertiary);
--surface-nav-hover: var(--surface-active-alt);
--surface-nav-selected: var(--surface-active-alt);
--surface-tab-selected: var(--surface-tertiary);
--surface-menu: var(--presentation);
--surface-popover: var(--surface-primary);
--border-menu: var(--border-light);
--surface-composer: var(--surface-chat);
--surface-search: var(--surface-secondary);
}
.dark [data-theme-scope],
[data-theme-scope].dark {
--avatar-placeholder: var(--surface-tertiary);
--surface-canvas: var(--surface-primary-alt);
--surface-user-message: var(--surface-tertiary);
--surface-card: var(--surface-secondary);
--surface-card-hover: var(--surface-tertiary);
--surface-nav-hover: var(--surface-active-alt);
--surface-nav-selected: var(--surface-active-alt);
--surface-tab-selected: var(--surface-tertiary);
--surface-menu: var(--presentation);
--surface-popover: var(--surface-secondary);
--border-menu: var(--border-light);
--surface-composer: var(--surface-chat);
--surface-search: var(--surface-secondary);
}

View file

@ -68,7 +68,7 @@ describe.each([
const tokens = Object.keys(theme) as Array<keyof IThemeRGB>;
it('covers every registry color', () => {
expect(tokens).toHaveLength(135);
expect(tokens).toHaveLength(147);
});
it('resolves every registry color to the runtime theme value', () => {

View file

@ -39,7 +39,8 @@
html.high-contrast [data-active-item],
html.high-contrast .select-item:focus-visible,
html.high-contrast [data-state='selected'],
html.high-contrast :is(.bg-surface-active, .bg-surface-active-alt):not(span) {
html.high-contrast
:is(.bg-surface-active, .bg-surface-active-alt, .bg-surface-nav-selected):not(span) {
outline: 3px solid rgb(var(--text-primary)) !important;
outline-offset: -3px;
}
@ -50,7 +51,7 @@ html.high-contrast :is(.bg-surface-active, .bg-surface-active-alt):not(span) {
* fragment separately. It still needs a cue, so it inverts instead — the same
* treatment the mode gives `::selection`, 21:1 and with no geometry to wrap.
*/
html.high-contrast span:is(.bg-surface-active, .bg-surface-active-alt) {
html.high-contrast span:is(.bg-surface-active, .bg-surface-active-alt, .bg-surface-nav-selected) {
background-color: rgb(var(--text-primary));
color: rgb(var(--surface-primary));
}

View file

@ -10,6 +10,7 @@ import {
fromLegacyTheme,
libreChatTheme,
resolveTheme,
layerRoleSources,
themeColorTokens,
validateThemeDefinition,
} from './registry';
@ -1000,6 +1001,62 @@ describe('theme registry', () => {
});
});
describe('layering roles', () => {
const layerTheme = (modes: ThemeDefinition['modes']): ThemeDefinition => ({
version: 1,
name: 'layering-reference',
modes,
});
it('resolves every layer to the surface it followed before it had a name', () => {
for (const mode of ['light', 'dark'] as const) {
const { colors } = resolveTheme(layerTheme({}), mode);
layerRoleSources.forEach(([role, light, dark]) => {
expect([role, colors[role]]).toEqual([role, colors[mode === 'dark' ? dark : light]]);
});
}
});
it('names the legacy surface of each layer outright', () => {
const legacy: Record<string, [string, string]> = {
'rgb-surface-canvas': ['rgb-surface-primary-alt', 'rgb-surface-primary-alt'],
'rgb-surface-user-message': ['rgb-surface-tertiary', 'rgb-surface-tertiary'],
'rgb-surface-card': ['rgb-surface-secondary', 'rgb-surface-secondary'],
'rgb-surface-card-hover': ['rgb-surface-tertiary', 'rgb-surface-tertiary'],
'rgb-surface-nav-hover': ['rgb-surface-active-alt', 'rgb-surface-active-alt'],
'rgb-surface-nav-selected': ['rgb-surface-active-alt', 'rgb-surface-active-alt'],
'rgb-surface-tab-selected': ['rgb-surface-tertiary', 'rgb-surface-tertiary'],
'rgb-surface-menu': ['rgb-presentation', 'rgb-presentation'],
'rgb-surface-popover': ['rgb-surface-primary', 'rgb-surface-secondary'],
'rgb-border-menu': ['rgb-border-light', 'rgb-border-light'],
'rgb-surface-composer': ['rgb-surface-chat', 'rgb-surface-chat'],
'rgb-surface-search': ['rgb-surface-secondary', 'rgb-surface-secondary'],
};
expect(
Object.fromEntries(layerRoleSources.map(([role, light, dark]) => [role, [light, dark]])),
).toEqual(legacy);
});
it('keeps a theme that repaints a surface on that layer, and lets it name the role', () => {
const { colors } = resolveTheme(
layerTheme({
light: {
colors: {
'rgb-surface-tertiary': '10 20 30',
'rgb-surface-primary-alt': '40 50 60',
'rgb-surface-card-hover': '1 2 3',
},
},
}),
'light',
);
expect(colors['rgb-surface-user-message']).toBe('10 20 30');
expect(colors['rgb-surface-tab-selected']).toBe('10 20 30');
expect(colors['rgb-surface-canvas']).toBe('40 50 60');
expect(colors['rgb-surface-card-hover']).toBe('1 2 3');
});
});
describe('field fill and ink', () => {
const fieldTheme = (modes: ThemeDefinition['modes']): ThemeDefinition => ({
version: 1,

View file

@ -118,6 +118,37 @@ export function primaryButtonFallbacks(colors: IThemeRGB): IThemeRGB {
};
}
/**
* Layering roles split out of the surface a component painted before each had a name: the role,
* and the surface it followed in light and in dark. A theme that repaints the surface keeps the
* layer on it, unless it names the role.
*/
export const layerRoleSources: ReadonlyArray<
readonly [keyof IThemeRGB, keyof IThemeRGB, keyof IThemeRGB]
> = [
['rgb-surface-canvas', 'rgb-surface-primary-alt', 'rgb-surface-primary-alt'],
['rgb-surface-user-message', 'rgb-surface-tertiary', 'rgb-surface-tertiary'],
['rgb-surface-card', 'rgb-surface-secondary', 'rgb-surface-secondary'],
['rgb-surface-card-hover', 'rgb-surface-tertiary', 'rgb-surface-tertiary'],
['rgb-surface-nav-hover', 'rgb-surface-active-alt', 'rgb-surface-active-alt'],
['rgb-surface-nav-selected', 'rgb-surface-active-alt', 'rgb-surface-active-alt'],
['rgb-surface-tab-selected', 'rgb-surface-tertiary', 'rgb-surface-tertiary'],
['rgb-surface-menu', 'rgb-presentation', 'rgb-presentation'],
['rgb-surface-popover', 'rgb-surface-primary', 'rgb-surface-secondary'],
['rgb-border-menu', 'rgb-border-light', 'rgb-border-light'],
['rgb-surface-composer', 'rgb-surface-chat', 'rgb-surface-chat'],
['rgb-surface-search', 'rgb-surface-secondary', 'rgb-surface-secondary'],
];
export function layerRoleFallbacks(colors: IThemeRGB, mode: ThemeMode): IThemeRGB {
return Object.fromEntries(
layerRoleSources.flatMap(([role, light, dark]) => {
const source = colors[mode === 'dark' ? dark : light];
return colors[role] === undefined && source !== undefined ? [[role, source]] : [];
}),
);
}
/** Inks split out of the primary one: dialog titles, badge labels, the default avatar's glyph and
* a field's typed value were all set in it. */
export const primaryInkRoles: ReadonlyArray<keyof IThemeRGB> = [
@ -688,6 +719,8 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
customColors != null ? controlBorderFallback(customColors) : undefined;
const borderControlFallback: IThemeRGB =
borderControlSource !== undefined ? { 'rgb-border-control': borderControlSource } : {};
const layerFallback: IThemeRGB =
customColors != null ? layerRoleFallbacks(customColors, mode) : {};
const focusFallback: IThemeRGB = customColors != null ? focusFallbacks(customColors) : {};
const pressedFallback: IThemeRGB = customColors != null ? pressedFallbacks(customColors) : {};
const primaryButtonFallback: IThemeRGB =
@ -759,6 +792,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
...switchThumbFallback,
...fieldFillFallback,
...overlayFallback,
...layerFallback,
...tableHeaderTextFallback,
...tableHeaderFillFallback,
...borderControlFallback,

View file

@ -30,6 +30,13 @@ const canvasSurfaces: Array<keyof IThemeRGB> = [
'rgb-surface-code',
'rgb-surface-code-body',
'rgb-presentation',
'rgb-surface-canvas',
'rgb-surface-card',
'rgb-surface-card-hover',
'rgb-surface-menu',
'rgb-surface-popover',
'rgb-surface-composer',
'rgb-surface-search',
];
/** Fills a row or menu item takes on hover or selection, which carry the
@ -45,6 +52,10 @@ const interactiveFills: Array<keyof IThemeRGB> = [
'rgb-header-primary',
'rgb-header-hover',
'rgb-header-button-hover',
'rgb-surface-user-message',
'rgb-surface-nav-hover',
'rgb-surface-nav-selected',
'rgb-surface-tab-selected',
];
const neutralTextTokens: Array<keyof IThemeRGB> = [
@ -174,6 +185,19 @@ describe.each(modes)('clickhouse %s palette', (_mode, theme) => {
expect(below(theme, WCAG_AA_NORMAL, neutralTextTokens, canvasSurfaces)).toEqual([]);
});
it('steps each layer off the one it sits on, so hover and selection stay apart', () => {
const layers: Array<[keyof IThemeRGB, keyof IThemeRGB]> = [
['rgb-surface-user-message', 'rgb-surface-canvas'],
['rgb-surface-card-hover', 'rgb-surface-card'],
['rgb-surface-nav-selected', 'rgb-surface-nav-hover'],
['rgb-surface-nav-hover', 'rgb-surface-primary-alt'],
['rgb-surface-tab-selected', 'rgb-surface-dialog'],
['rgb-surface-search', 'rgb-surface-primary-alt'],
['rgb-border-menu', 'rgb-surface-menu'],
];
expect(layers.filter(([layer, ground]) => theme[layer] === theme[ground])).toEqual([]);
});
it('keeps primary text at WCAG AA on hover, selected and header fills', () => {
expect(below(theme, WCAG_AA_NORMAL, ['rgb-text-primary'], interactiveFills)).toEqual([]);
});

View file

@ -116,6 +116,19 @@ export const clickHouseLightTheme: IThemeRGB = {
'rgb-text-tooltip': '255 255 255', // #ffffff (tooltip.color.label.default)
'rgb-alert-error-fill': '255 233 233', // #ffe9e9 (alert.color.background.danger, danger at 10% over background.default)
'rgb-alert-error-border': '255 233 233', // #ffe9e9 (Click UI alerts draw no edge, so it matches the fill)
// Layering roles
'rgb-surface-canvas': '255 255 255', // #ffffff (background.default)
'rgb-surface-user-message': '230 231 233', // #e6e7e9 (palette.slate.100, the sidebar.main.navigation.item active step; Click UI has no chat bubble)
'rgb-surface-card': '255 255 255', // #ffffff (card.secondary.color.background.default)
'rgb-surface-card-hover': '246 247 250', // #f6f7fa (card.secondary.color.background.hover)
'rgb-surface-nav-hover': '236 237 240', // #ecedf0 (sidebar.main.navigation.item.color.background.hover, lch(91.609 1.1023 265.86 / 0.6) composited on background.split)
'rgb-surface-nav-selected': '230 231 233', // #e6e7e9 (sidebar.main.navigation.item.color.background.active)
'rgb-surface-tab-selected': '230 231 233', // #e6e7e9 (sidebar.main.navigation.item.color.background.active)
'rgb-surface-menu': '255 255 255', // #ffffff (genericMenu.panel.color.background.default)
'rgb-surface-popover': '255 255 255', // #ffffff (genericMenu.panel.color.background.default)
'rgb-border-menu': '230 231 233', // #e6e7e9 (genericMenu.panel.color.stroke.default)
'rgb-surface-composer': '255 255 255', // #ffffff (background.default)
'rgb-surface-search': '255 255 255', // #ffffff (background.default)
'rgb-surface-disabled': '223 223 223', // #dfdfdf (button.basic.color.primary.background.disabled)
'rgb-text-disabled': '160 160 160', // #a0a0a0 (text.disabled)
'rgb-border-disabled': '223 223 223', // #dfdfdf (field.color.stroke.disabled)
@ -282,6 +295,19 @@ export const clickHouseDarkTheme: IThemeRGB = {
'rgb-text-tooltip': '255 255 255', // #ffffff (tooltip.color.label.default)
'rgb-alert-error-fill': '76 32 29', // #4c201d (alert.color.background.danger, danger at 20% over background.default)
'rgb-alert-error-border': '76 32 29', // #4c201d (Click UI alerts draw no edge, so it matches the fill)
// Layering roles
'rgb-surface-canvas': '31 31 28', // #1f1f1c (background.default)
'rgb-surface-user-message': '50 50 50', // #323232 (palette.neutral.712)
'rgb-surface-card': '31 31 28', // #1f1f1c (card.secondary.color.background.default)
'rgb-surface-card-hover': '40 40 40', // #282828 (card.secondary.color.background.hover)
'rgb-surface-nav-hover': '46 46 46', // #2e2e2e (sidebar.main.navigation.item.color.background.hover, lch(19.05 0 none))
'rgb-surface-nav-selected': '55 55 55', // #373737 (sidebar.main.navigation.item.color.background.active, lch(27.535 0 none / 0.6) composited on background.split)
'rgb-surface-tab-selected': '50 50 50', // #323232 (palette.neutral.712)
'rgb-surface-menu': '40 40 40', // #282828 (genericMenu.panel.color.background.default)
'rgb-surface-popover': '40 40 40', // #282828 (genericMenu.panel.color.background.default)
'rgb-border-menu': '65 65 65', // #414141 (genericMenu.panel.color.stroke.default)
'rgb-surface-composer': '45 45 45', // #2d2d2d (field.color.background.default)
'rgb-surface-search': '45 45 45', // #2d2d2d (field.color.background.default)
'rgb-surface-disabled': '65 65 65', // #414141 (button.basic.color.primary.background.disabled)
'rgb-text-disabled': '128 128 128', // #808080 (text.disabled)
'rgb-border-disabled': '65 65 65', // #414141 (field.color.stroke.disabled)

View file

@ -28,6 +28,8 @@
"click.button.basic.space.x": "1rem",
"click.button.basic.typography.label.default": "400 0.875rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"click.button.iconButton.color.primary.background.active": "rgb(86.824% 87.176% 88.235%)",
"click.card.secondary.color.background.default": "#ffffff",
"click.card.secondary.color.background.hover": "#f6f7fa",
"click.checkbox.color.background.active": "#161517",
"click.checkbox.color.background.default": "#f6f7fa",
"click.checkbox.color.check.active": "#ffffff",
@ -51,6 +53,8 @@
"click.field.color.text.default": "#302e32",
"click.field.space.y": "0.2813rem",
"click.field.typography.label.default": "500 0.75rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"click.genericMenu.panel.color.background.default": "#ffffff",
"click.genericMenu.panel.color.stroke.default": "#e6e7e9",
"click.genericMenu.panel.radii.all": "0.25rem",
"click.genericMenu.panel.shadow.default": "0 4px 6px -1px lch(6.7738 0 none / 0.15), 0 2px 4px -1px lch(6.7738 0 none / 0.15)",
"click.genericMenu.panel.size.height": "2rem",
@ -59,6 +63,8 @@
"click.image.lg.size.width": "1.5rem",
"click.image.md.size.width": "1.25rem",
"click.image.sm.size.width": "1rem",
"click.sidebar.main.navigation.item.color.background.active": "#e6e7e9",
"click.sidebar.main.navigation.item.color.background.hover": "lch(91.609 1.1023 265.86 / 0.6)",
"click.switch.color.background.active": "#151515",
"click.switch.color.background.default": "#cccfd3",
"click.switch.color.indicator.default": "#ffffff",
@ -185,6 +191,8 @@
"click.button.basic.space.x": "1rem",
"click.button.basic.typography.label.default": "400 0.875rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"click.button.iconButton.color.primary.background.active": "rgb(14.118% 14.118% 14.118%)",
"click.card.secondary.color.background.default": "#1f1f1c",
"click.card.secondary.color.background.hover": "#282828",
"click.checkbox.color.background.active": "#faff69",
"click.checkbox.color.background.default": "rgb(17.794% 17.794% 17.794%)",
"click.checkbox.color.check.active": "#151515",
@ -208,6 +216,8 @@
"click.field.color.text.default": "#e6e7e9",
"click.field.space.y": "0.2813rem",
"click.field.typography.label.default": "500 0.75rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"click.genericMenu.panel.color.background.default": "#282828",
"click.genericMenu.panel.color.stroke.default": "#414141",
"click.genericMenu.panel.radii.all": "0.25rem",
"click.genericMenu.panel.shadow.default": "0 4px 6px -1px rgb(8.2353% 8.2353% 8.2353% / 0.6), 0 2px 4px -1px rgb(8.2353% 8.2353% 8.2353% / 0.6)",
"click.genericMenu.panel.size.height": "2rem",
@ -216,6 +226,8 @@
"click.image.lg.size.width": "1.5rem",
"click.image.md.size.width": "1.25rem",
"click.image.sm.size.width": "1rem",
"click.sidebar.main.navigation.item.color.background.active": "lch(27.535 0 none / 0.6)",
"click.sidebar.main.navigation.item.color.background.hover": "lch(19.05 0 none)",
"click.switch.color.background.active": "#faff69",
"click.switch.color.background.default": "#606060",
"click.switch.color.indicator.default": "#151515",

View file

@ -125,6 +125,17 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-border-field-focus': 'click.field.color.stroke.active',
'rgb-field-fill': 'click.field.color.background.default',
'rgb-field-text': 'click.field.color.text.default',
'rgb-surface-canvas': 'global.color.background.default',
'rgb-surface-user-message': 'palette.slate.100',
'rgb-surface-card': 'click.card.secondary.color.background.default',
'rgb-surface-card-hover': 'click.card.secondary.color.background.hover',
'rgb-surface-nav-selected': 'click.sidebar.main.navigation.item.color.background.active',
'rgb-surface-tab-selected': 'click.sidebar.main.navigation.item.color.background.active',
'rgb-surface-menu': 'click.genericMenu.panel.color.background.default',
'rgb-surface-popover': 'click.genericMenu.panel.color.background.default',
'rgb-border-menu': 'click.genericMenu.panel.color.stroke.default',
'rgb-surface-composer': 'global.color.background.default',
'rgb-surface-search': 'global.color.background.default',
'rgb-surface-disabled': 'click.button.basic.color.primary.background.disabled',
'rgb-text-disabled': 'global.color.text.disabled',
'rgb-border-disabled': 'click.field.color.stroke.disabled',
@ -257,6 +268,17 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-border-field-focus': 'click.field.color.stroke.active',
'rgb-field-fill': 'click.field.color.background.default',
'rgb-field-text': 'click.field.color.text.default',
'rgb-surface-canvas': 'global.color.background.default',
'rgb-surface-user-message': 'palette.neutral.712',
'rgb-surface-card': 'click.card.secondary.color.background.default',
'rgb-surface-card-hover': 'click.card.secondary.color.background.hover',
'rgb-surface-nav-hover': 'click.sidebar.main.navigation.item.color.background.hover',
'rgb-surface-tab-selected': 'palette.neutral.712',
'rgb-surface-menu': 'click.genericMenu.panel.color.background.default',
'rgb-surface-popover': 'click.genericMenu.panel.color.background.default',
'rgb-border-menu': 'click.genericMenu.panel.color.stroke.default',
'rgb-surface-composer': 'click.field.color.background.default',
'rgb-surface-search': 'click.field.color.background.default',
'rgb-surface-disabled': 'click.button.basic.color.primary.background.disabled',
'rgb-text-disabled': 'global.color.text.disabled',
'rgb-border-disabled': 'click.field.color.stroke.disabled',
@ -336,12 +358,16 @@ const ALERT_ALPHA_REASON =
/** Values the theme sets on purpose without a Click UI source, and why. */
const unsourcedColors: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>> = {
light: {
'rgb-surface-nav-hover':
'Click UI sidebar item hover is a 0.6 alpha lch; the theme paints its composite on background.split',
'rgb-surface-media-overlay': MEDIA_OVERLAY_REASON,
'rgb-avatar-edge': AVATAR_EDGE_REASON,
'rgb-alert-error-fill': ALERT_ALPHA_REASON,
'rgb-alert-error-border': ALERT_ALPHA_REASON,
},
dark: {
'rgb-surface-nav-selected':
'Click UI sidebar item active is a 0.6 alpha lch; the theme paints its composite on background.split',
'rgb-surface-overlay':
'Click UI dark dialog.color.opaqueBackground is a gray that leaves the dialog under 3:1',
'rgb-surface-media-overlay': MEDIA_OVERLAY_REASON,
@ -381,6 +407,12 @@ const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>>
status: 'mismatch',
reason: ALERT_ALPHA_REASON,
},
'rgb-surface-nav-hover': {
counterpart: 'click.sidebar.main.navigation.item.color.background.hover',
status: 'near',
reason:
'the token is lch(91.609 1.1023 265.86) at 0.6 alpha; the theme value is its composite on background.split',
},
'rgb-avatar-edge': {
counterpart: 'global.color.stroke.default',
status: 'near',
@ -463,6 +495,12 @@ const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>>
},
},
dark: {
'rgb-surface-nav-selected': {
counterpart: 'click.sidebar.main.navigation.item.color.background.active',
status: 'near',
reason:
'the token is lch(27.535 0 none) at 0.6 alpha; the theme value is its composite on background.split',
},
'rgb-border-xheavy': {
counterpart: 'global.color.stroke.intense',
status: 'mismatch',

View file

@ -90,6 +90,18 @@ export const darkTheme: IThemeRGB = {
'rgb-text-tooltip': '236 236 236', // matching text-primary
'rgb-alert-error-fill': '69 10 10', // matching status-error-subtle
'rgb-alert-error-border': '153 27 27', // matching status-error-border
'rgb-surface-canvas': '23 23 23', // matching surface-primary-alt
'rgb-surface-user-message': '47 47 47', // matching surface-tertiary
'rgb-surface-card': '33 33 33', // matching surface-secondary
'rgb-surface-card-hover': '47 47 47', // matching surface-tertiary
'rgb-surface-nav-hover': '47 47 47', // matching surface-active-alt
'rgb-surface-nav-selected': '47 47 47', // matching surface-active-alt
'rgb-surface-tab-selected': '47 47 47', // matching surface-tertiary
'rgb-surface-menu': '33 33 33', // matching presentation
'rgb-surface-popover': '33 33 33', // matching surface-secondary
'rgb-border-menu': '33 33 33', // matching border-light
'rgb-surface-composer': '47 47 47', // matching surface-chat
'rgb-surface-search': '33 33 33', // matching surface-secondary
'rgb-surface-disabled': '47 47 47', // #2f2f2f (gray-700)
'rgb-text-disabled': '153 150 150', // #999696 (gray-400)
'rgb-border-disabled': '57 57 57', // #393939 (gray-650)

View file

@ -90,6 +90,18 @@ export const defaultTheme: IThemeRGB = {
'rgb-text-tooltip': '33 33 33', // matching text-primary
'rgb-alert-error-fill': '254 242 242', // matching status-error-subtle
'rgb-alert-error-border': '252 165 165', // matching status-error-border
'rgb-surface-canvas': '247 247 248', // matching surface-primary-alt
'rgb-surface-user-message': '236 236 236', // matching surface-tertiary
'rgb-surface-card': '247 247 248', // matching surface-secondary
'rgb-surface-card-hover': '236 236 236', // matching surface-tertiary
'rgb-surface-nav-hover': '227 227 227', // matching surface-active-alt
'rgb-surface-nav-selected': '227 227 227', // matching surface-active-alt
'rgb-surface-tab-selected': '236 236 236', // matching surface-tertiary
'rgb-surface-menu': '255 255 255', // matching presentation
'rgb-surface-popover': '255 255 255', // matching surface-primary
'rgb-border-menu': '227 227 227', // matching border-light
'rgb-surface-composer': '255 255 255', // matching surface-chat
'rgb-surface-search': '247 247 248', // matching surface-secondary
'rgb-surface-disabled': '236 236 236', // #ececec (gray-100)
'rgb-text-disabled': '153 150 150', // #999696 (gray-400)
'rgb-border-disabled': '227 227 227', // #e3e3e3 (gray-200)

View file

@ -126,6 +126,18 @@ export const highContrastLightTheme: IThemeRGB = {
'rgb-text-tooltip': '0 0 0', // matching text-primary
'rgb-alert-error-fill': '255 255 255', // matching status-error-subtle
'rgb-alert-error-border': '161 0 0', // matching status-error-border
'rgb-surface-canvas': '255 255 255', // matching surface-primary-alt
'rgb-surface-user-message': '255 255 255', // matching surface-tertiary
'rgb-surface-card': '255 255 255', // matching surface-secondary
'rgb-surface-card-hover': '255 255 255', // matching surface-tertiary
'rgb-surface-nav-hover': '212 212 212', // matching surface-active-alt
'rgb-surface-nav-selected': '212 212 212', // matching surface-active-alt
'rgb-surface-tab-selected': '255 255 255', // matching surface-tertiary
'rgb-surface-menu': '255 255 255', // matching presentation
'rgb-surface-popover': '255 255 255', // matching surface-primary
'rgb-border-menu': '0 0 0', // matching border-light
'rgb-surface-composer': '255 255 255', // matching surface-chat
'rgb-surface-search': '255 255 255', // matching surface-secondary
'rgb-surface-disabled': '255 255 255', // #ffffff
'rgb-text-disabled': '87 87 87', // #575757
'rgb-border-disabled': '87 87 87', // #575757
@ -310,6 +322,18 @@ export const highContrastDarkTheme: IThemeRGB = {
'rgb-text-tooltip': '255 255 255', // matching text-primary
'rgb-alert-error-fill': '0 0 0', // matching status-error-subtle
'rgb-alert-error-border': '255 143 143', // matching status-error-border
'rgb-surface-canvas': '0 0 0', // matching surface-primary-alt
'rgb-surface-user-message': '0 0 0', // matching surface-tertiary
'rgb-surface-card': '0 0 0', // matching surface-secondary
'rgb-surface-card-hover': '0 0 0', // matching surface-tertiary
'rgb-surface-nav-hover': '61 61 61', // matching surface-active-alt
'rgb-surface-nav-selected': '61 61 61', // matching surface-active-alt
'rgb-surface-tab-selected': '0 0 0', // matching surface-tertiary
'rgb-surface-menu': '0 0 0', // matching presentation
'rgb-surface-popover': '0 0 0', // matching surface-secondary
'rgb-border-menu': '255 255 255', // matching border-light
'rgb-surface-composer': '0 0 0', // matching surface-chat
'rgb-surface-search': '0 0 0', // matching surface-secondary
'rgb-surface-disabled': '0 0 0', // #000000
'rgb-text-disabled': '184 184 184', // #b8b8b8
'rgb-border-disabled': '184 184 184', // #b8b8b8

View file

@ -130,6 +130,20 @@
--color-text-tooltip: rgb(var(--text-tooltip, var(--text-primary)));
--color-alert-error-fill: rgb(var(--alert-error-fill, var(--status-error-subtle)));
--color-alert-error-border: rgb(var(--alert-error-border, var(--status-error-border)));
--color-surface-canvas: rgb(var(--surface-canvas));
--color-surface-user-message: rgb(var(--surface-user-message));
--color-surface-card: rgb(var(--surface-card));
--color-surface-card-hover: rgb(var(--surface-card-hover));
--color-surface-nav-hover: rgb(var(--surface-nav-hover));
--color-surface-nav-selected: rgb(var(--surface-nav-selected));
--color-surface-tab-selected: rgb(var(--surface-tab-selected));
--color-surface-menu: rgb(var(--surface-menu));
--color-surface-popover: rgb(var(--surface-popover));
--color-border-menu: rgb(
var(--border-menu) / var(--border-menu-alpha, var(--border-light-alpha, 1))
);
--color-surface-composer: rgb(var(--surface-composer));
--color-surface-search: rgb(var(--surface-search));
--color-border-disabled: rgb(var(--border-disabled));
/* status */

View file

@ -119,6 +119,18 @@ export interface IThemeRGB {
* `rgb-status-error-border` when a theme omits them. */
'rgb-alert-error-fill'?: string;
'rgb-alert-error-border'?: string;
'rgb-surface-canvas'?: string;
'rgb-surface-user-message'?: string;
'rgb-surface-card'?: string;
'rgb-surface-card-hover'?: string;
'rgb-surface-nav-hover'?: string;
'rgb-surface-nav-selected'?: string;
'rgb-surface-tab-selected'?: string;
'rgb-surface-menu'?: string;
'rgb-surface-popover'?: string;
'rgb-border-menu'?: string;
'rgb-surface-composer'?: string;
'rgb-surface-search'?: string;
/** Disabled fill, ink and edge. Painted only under the `fill` disabled style. */
'rgb-surface-disabled'?: string;
'rgb-text-disabled'?: string;
@ -312,6 +324,18 @@ export interface IThemeVariables {
'--text-tooltip': string;
'--alert-error-fill': string;
'--alert-error-border': string;
'--surface-canvas': string;
'--surface-user-message': string;
'--surface-card': string;
'--surface-card-hover': string;
'--surface-nav-hover': string;
'--surface-nav-selected': string;
'--surface-tab-selected': string;
'--surface-menu': string;
'--surface-popover': string;
'--border-menu': string;
'--surface-composer': string;
'--surface-search': string;
'--surface-disabled': string;
'--text-disabled': string;
'--border-disabled': string;
@ -455,6 +479,18 @@ export interface IThemeColors {
'text-tooltip'?: string;
'alert-error-fill'?: string;
'alert-error-border'?: string;
'surface-canvas'?: string;
'surface-user-message'?: string;
'surface-card'?: string;
'surface-card-hover'?: string;
'surface-nav-hover'?: string;
'surface-nav-selected'?: string;
'surface-tab-selected'?: string;
'surface-menu'?: string;
'surface-popover'?: string;
'border-menu'?: string;
'surface-composer'?: string;
'surface-search'?: string;
'surface-disabled'?: string;
'text-disabled'?: string;
'border-disabled'?: string;

View file

@ -5,7 +5,7 @@ describe('composerSurfaceClasses', () => {
const classes = composerSurfaceClasses();
expect(classes).toContain('border-border-light');
expect(classes).toContain('bg-surface-chat');
expect(classes).toContain('bg-surface-composer');
expect(classes).toContain('text-text-primary');
});
});

View file

@ -8,7 +8,9 @@ import { cn } from './utils';
* padding, and feature-specific overrides stay with each owner.
*/
export const composerSurfaceClasses = (): string =>
cn('border border-border-light bg-surface-chat text-text-primary transition-all duration-200');
cn(
'border border-border-light bg-surface-composer text-text-primary transition-all duration-200',
);
/** Elevation states for the composer surface. `within` is the CSS-only
* equivalent of the managed focused/blurred pair for surfaces that do not

View file

@ -88,6 +88,18 @@ export const themeColorTokens = Object.freeze([
'rgb-text-tooltip',
'rgb-alert-error-fill',
'rgb-alert-error-border',
'rgb-surface-canvas',
'rgb-surface-user-message',
'rgb-surface-card',
'rgb-surface-card-hover',
'rgb-surface-nav-hover',
'rgb-surface-nav-selected',
'rgb-surface-tab-selected',
'rgb-surface-menu',
'rgb-surface-popover',
'rgb-border-menu',
'rgb-surface-composer',
'rgb-surface-search',
'rgb-surface-disabled',
'rgb-text-disabled',
'rgb-border-disabled',