Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🧱 feat: Layered Surface Roles for the ClickHouse Theme (#16737)
Marco Beretta05e23c8a632c
diff --git a/client/index.html b/client/index.htmlindex 246d4cc3a3..16be69fb9e 100644--- a/client/index.html+++ b/client/index.html@@ -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) {diff --git a/client/src/Providers/__tests__/bootScript.spec.tsx b/client/src/Providers/__tests__/bootScript.spec.tsxindex 31a738ce1c..168772862b 100644--- a/client/src/Providers/__tests__/bootScript.spec.tsx+++ b/client/src/Providers/__tests__/bootScript.spec.tsx@@ -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();diff --git a/client/src/Providers/themeCache.ts b/client/src/Providers/themeCache.tsindex 308cacc0ce..f4e43bfa02 100644--- a/client/src/Providers/themeCache.ts+++ b/client/src/Providers/themeCache.ts@@ -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;diff --git a/client/src/components/Agents/AgentCard.tsx b/client/src/components/Agents/AgentCard.tsxindex 4b3c8b3e6b..85b9cddf37 100644--- a/client/src/components/Agents/AgentCard.tsx+++ b/client/src/components/Agents/AgentCard.tsx@@ -84,7 +84,7 @@ const AgentCard = memo(className={cn(/* The article keeps a plain resting fill so the grid slot still reads as acard 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}/>diff --git a/client/src/components/Agents/AgentDetailContent.tsx b/client/src/components/Agents/AgentDetailContent.tsxindex a09d177afa..121df93f77 100644--- a/client/src/components/Agents/AgentDetailContent.tsx+++ b/client/src/components/Agents/AgentDetailContent.tsx@@ -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:diff --git a/client/src/components/Agents/AgentGrid.tsx b/client/src/components/Agents/AgentGrid.tsxindex 10f42f7e3e..d8f11e6eaf 100644--- a/client/src/components/Agents/AgentGrid.tsx+++ b/client/src/components/Agents/AgentGrid.tsx@@ -361,7 +361,7 @@ const AgentGrid: React.FC<AgentGridProps> = ({and reading order reach it immediately; without rows it is the whole of thepage. */}<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>diff --git a/client/src/components/Agents/GridSkeleton.tsx b/client/src/components/Agents/GridSkeleton.tsxindex 5a8db2607b..a3963b4f7e 100644--- a/client/src/components/Agents/GridSkeleton.tsx+++ b/client/src/components/Agents/GridSkeleton.tsx@@ -92,7 +92,7 @@ export default function GridSkeleton({ scrollElementRef, label }: GridSkeletonPr{Array.from({ length: count }, (_, index) => (<divkey={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>diff --git a/client/src/components/Chat/ChatView.tsx b/client/src/components/Chat/ChatView.tsxindex e5aba033e3..35d8bc371b 100644--- a/client/src/components/Chat/ChatView.tsx+++ b/client/src/components/Chat/ChatView.tsx@@ -243,7 +243,7 @@ function ChatView({so they cannot paint through the approval preview. */}<divclassName={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',)}diff --git a/client/src/components/Chat/Header.tsx b/client/src/components/Chat/Header.tsxindex 2af0a0e094..ac8e0cfddf 100644--- a/client/src/components/Chat/Header.tsx+++ b/client/src/components/Chat/Header.tsx@@ -83,7 +83,7 @@ function Header({return (/* The composer review is in a z-10 stacking context. Keep header controlsabove 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>diff --git a/client/src/components/Chat/Input/CodeApprovalMenu.tsx b/client/src/components/Chat/Input/CodeApprovalMenu.tsxindex 5b7c3827e4..e28e8c3fd1 100644--- a/client/src/components/Chat/Input/CodeApprovalMenu.tsx+++ b/client/src/components/Chat/Input/CodeApprovalMenu.tsx@@ -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',diff --git a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsxindex d3636f9580..de06ca2008 100644--- a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx+++ b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx@@ -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',diff --git a/client/src/components/Chat/Input/Composer/Bar.tsx b/client/src/components/Chat/Input/Composer/Bar.tsxindex 7b7d50c572..8ef5ffb314 100644--- a/client/src/components/Chat/Input/Composer/Bar.tsx+++ b/client/src/components/Chat/Input/Composer/Bar.tsx@@ -157,7 +157,7 @@ export function ChipModes({ modes }: ChipModesProps) {gutter={6}unmountOnHideonClick={(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.MenuItemdiff --git a/client/src/components/Chat/Input/Composer/Palette.tsx b/client/src/components/Chat/Input/Composer/Palette.tsxindex 1e95439d8a..af6c078e2e 100644--- a/client/src/components/Chat/Input/Composer/Palette.tsx+++ b/client/src/components/Chat/Input/Composer/Palette.tsx@@ -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 iconand the padding around it read as part of the field, so clickingdiff --git a/client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx b/client/src/components/Chat/Menus/Endpoints/CustomMenu.tsxindex 99517edc35..8e7c365a3a 100644--- a/client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx+++ b/client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx@@ -74,8 +74,8 @@ export const CustomMenu = React.forwardRef<HTMLDivElement, CustomMenuProps>(funcclassName={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>)}diff --git a/client/src/components/Chat/Menus/PresetsMenu.tsx b/client/src/components/Chat/Menus/PresetsMenu.tsxindex 36b6cf894e..8ca4e48340 100644--- a/client/src/components/Chat/Menus/PresetsMenu.tsx+++ b/client/src/components/Chat/Menus/PresetsMenu.tsx@@ -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)]"><PresetItemspresets={presetsQuery.data}diff --git a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsxindex 43fad4cd36..029f6248be 100644--- a/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/SteerPart.tsx@@ -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">diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsxindex b47c6c8dca..ba0a530330 100644--- a/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx+++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/SteerPart.test.tsx@@ -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', () => {diff --git a/client/src/components/Chat/Messages/ui/MessageRow.tsx b/client/src/components/Chat/Messages/ui/MessageRow.tsxindex 4971419f5e..a05505ee79 100644--- a/client/src/components/Chat/Messages/ui/MessageRow.tsx+++ b/client/src/components/Chat/Messages/ui/MessageRow.tsx@@ -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',)}diff --git a/client/src/components/Chat/Messages/ui/__tests__/MessageRender.wakeup.spec.tsx b/client/src/components/Chat/Messages/ui/__tests__/MessageRender.wakeup.spec.tsxindex 18a2163fd5..25dc2cd63b 100644--- a/client/src/components/Chat/Messages/ui/__tests__/MessageRender.wakeup.spec.tsx+++ b/client/src/components/Chat/Messages/ui/__tests__/MessageRender.wakeup.spec.tsx@@ -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');});});diff --git a/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx b/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsxindex e6f5da2f12..b51d3461ab 100644--- a/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx+++ b/client/src/components/Chat/Messages/ui/__tests__/MessageRow.spec.tsx@@ -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', () => {diff --git a/client/src/components/Chat/Messages/ui/surface.ts b/client/src/components/Chat/Messages/ui/surface.tsindex 7c81ac12b8..2390811ea8 100644--- a/client/src/components/Chat/Messages/ui/surface.ts+++ b/client/src/components/Chat/Messages/ui/surface.ts@@ -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');diff --git a/client/src/components/Chat/Presentation.tsx b/client/src/components/Chat/Presentation.tsxindex c2de6ef799..20ef7be98e 100644--- a/client/src/components/Chat/Presentation.tsx+++ b/client/src/components/Chat/Presentation.tsx@@ -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 windowit 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>diff --git a/client/src/components/Chat/Subagents/SubagentConversation.test.tsx b/client/src/components/Chat/Subagents/SubagentConversation.test.tsxindex c1a0f383e7..506d987f47 100644--- a/client/src/components/Chat/Subagents/SubagentConversation.test.tsx+++ b/client/src/components/Chat/Subagents/SubagentConversation.test.tsx@@ -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);diff --git a/client/src/components/Conversations/Conversations.tsx b/client/src/components/Conversations/Conversations.tsxindex d8c148d4d9..f7a9a54101 100644--- a/client/src/components/Conversations/Conversations.tsx+++ b/client/src/components/Conversations/Conversations.tsx@@ -149,7 +149,7 @@ const ChatsHeader: FC<ChatsHeaderProps> = memo(({ isExpanded, onToggle, trailing<divclassName={cn('flex h-8 w-full items-center pr-1',- highlight && 'bg-surface-active-alt rounded-lg',+ highlight && 'bg-surface-nav-selected rounded-lg',)}><buttondiff --git a/client/src/components/Conversations/Convo.tsx b/client/src/components/Conversations/Convo.tsxindex 982f8fa997..d7f88b23c8 100644--- a/client/src/components/Conversations/Convo.tsx+++ b/client/src/components/Conversations/Convo.tsx@@ -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',)}/>)}diff --git a/client/src/components/Conversations/ConvoLink.tsx b/client/src/components/Conversations/ConvoLink.tsxindex fb6c1a6ee3..8b9748c327 100644--- a/client/src/components/Conversations/ConvoLink.tsx+++ b/client/src/components/Conversations/ConvoLink.tsx@@ -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}diff --git a/client/src/components/Conversations/HoverToggle.tsx b/client/src/components/Conversations/HoverToggle.tsxindex 8bbc34427b..8a9f4beda5 100644--- a/client/src/components/Conversations/HoverToggle.tsx+++ b/client/src/components/Conversations/HoverToggle.tsx@@ -23,11 +23,11 @@ const HoverToggle = ({<divonClick={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,)}diff --git a/client/src/components/Conversations/PinnedSection.tsx b/client/src/components/Conversations/PinnedSection.tsxindex 41cfe26c5d..a09c74c3e1 100644--- a/client/src/components/Conversations/PinnedSection.tsx+++ b/client/src/components/Conversations/PinnedSection.tsx@@ -716,7 +716,7 @@ const PinnedSection = ({<divclassName={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"diff --git a/client/src/components/Conversations/ProjectsSection.tsx b/client/src/components/Conversations/ProjectsSection.tsxindex 28e19c6aad..1f8b397aba 100644--- a/client/src/components/Conversations/ProjectsSection.tsx+++ b/client/src/components/Conversations/ProjectsSection.tsx@@ -304,10 +304,11 @@ const ProjectItem = memo(<li className="max-w-full min-w-0 list-none" ref={projectRowRef}><divclassName={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',)}><buttondiff --git a/client/src/components/Conversations/RenameForm.tsx b/client/src/components/Conversations/RenameForm.tsxindex 0641418b52..8248082ea8 100644--- a/client/src/components/Conversations/RenameForm.tsx+++ b/client/src/components/Conversations/RenameForm.tsx@@ -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')}>diff --git a/client/src/components/Nav/AccountSettings.tsx b/client/src/components/Nav/AccountSettings.tsxindex cb983dad7f..3490bbb7ac 100644--- a/client/src/components/Nav/AccountSettings.tsx+++ b/client/src/components/Nav/AccountSettings.tsx@@ -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'}>diff --git a/client/src/components/Nav/Favorites/FavoriteItem.tsx b/client/src/components/Nav/Favorites/FavoriteItem.tsxindex ea3ef41eee..afe4f3edd7 100644--- a/client/src/components/Nav/Favorites/FavoriteItem.tsx+++ b/client/src/components/Nav/Favorites/FavoriteItem.tsx@@ -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"diff --git a/client/src/components/Nav/SearchBar.tsx b/client/src/components/Nav/SearchBar.tsxindex 3a1e39118a..5d705e5608 100644--- a/client/src/components/Nav/SearchBar.tsx+++ b/client/src/components/Nav/SearchBar.tsx@@ -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" /><inputdiff --git a/client/src/components/Nav/Settings/Sidebar.tsx b/client/src/components/Nav/Settings/Sidebar.tsxindex 14b6f2132a..04579db770 100644--- a/client/src/components/Nav/Settings/Sidebar.tsx+++ b/client/src/components/Nav/Settings/Sidebar.tsx@@ -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">diff --git a/client/src/components/Prompts/lists/ChatGroupItem.tsx b/client/src/components/Prompts/lists/ChatGroupItem.tsxindex fa255d75b1..f786c6c54e 100644--- a/client/src/components/Prompts/lists/ChatGroupItem.tsx+++ b/client/src/components/Prompts/lists/ChatGroupItem.tsx@@ -140,8 +140,10 @@ function ChatGroupItem({<><divclassName={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 */}diff --git a/client/src/components/SidePanel/SidePanelGroup.tsx b/client/src/components/SidePanel/SidePanelGroup.tsxindex bf8961a767..55cb3448ba 100644--- a/client/src/components/SidePanel/SidePanelGroup.tsx+++ b/client/src/components/SidePanel/SidePanelGroup.tsx@@ -31,7 +31,7 @@ const SidePanelGroup = memo(({ panel, children }: SidePanelProps) => {{/* The surface behind the panels is this group's host, not the groupprimitive: the resizer owns its own chrome, and the caller owns thebackdrop the panels sit on. */}- <div className="bg-surface-primary-alt relative min-w-0 flex-1">+ <div className="relative min-w-0 flex-1"><ResizablePanelGrouporientation="horizontal"defaultLayout={defaultLayout}diff --git a/client/src/components/Skills/lists/SkillListItem.tsx b/client/src/components/Skills/lists/SkillListItem.tsxindex d2fef6303d..652d0b9936 100644--- a/client/src/components/Skills/lists/SkillListItem.tsx+++ b/client/src/components/Skills/lists/SkillListItem.tsx@@ -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',)}><buttondiff --git a/client/src/components/UnifiedSidebar/mobile/Switcher.tsx b/client/src/components/UnifiedSidebar/mobile/Switcher.tsxindex 4f7053e162..11dcd94616 100644--- a/client/src/components/UnifiedSidebar/mobile/Switcher.tsx+++ b/client/src/components/UnifiedSidebar/mobile/Switcher.tsx@@ -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) {diff --git a/client/src/style.css b/client/src/style.cssindex 278d6db725..212c99cee4 100644--- a/client/src/style.css+++ b/client/src/style.css@@ -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,diff --git a/e2e/specs/mock/scenarios/clickhouse-layers.spec.ts b/e2e/specs/mock/scenarios/clickhouse-layers.spec.tsnew file mode 100644index 0000000000..1819c56bbe--- /dev/null+++ b/e2e/specs/mock/scenarios/clickhouse-layers.spec.ts@@ -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);+ }+ });+});diff --git a/e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts b/e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.tsindex e7a1d2b0af..f66433a470 100644--- a/e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts+++ b/e2e/specs/mock/scenarios/deployment-theme-first-paint.spec.ts@@ -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');diff --git a/e2e/specs/mock/scenarios/message-theme.spec.ts b/e2e/specs/mock/scenarios/message-theme.spec.tsindex c87318d805..2a6a7ab9c1 100644--- a/e2e/specs/mock/scenarios/message-theme.spec.ts+++ b/e2e/specs/mock/scenarios/message-theme.spec.ts@@ -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, [diff --git a/e2e/specs/mock/scenarios/sidebar-active-row.spec.ts b/e2e/specs/mock/scenarios/sidebar-active-row.spec.tsindex 98a18a5fdb..ee93adb766 100644--- a/e2e/specs/mock/scenarios/sidebar-active-row.spec.ts+++ b/e2e/specs/mock/scenarios/sidebar-active-row.spec.ts@@ -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();diff --git a/packages/client/src/components/Dropdown.css b/packages/client/src/components/Dropdown.cssindex b125f9224c..3ecb80481b 100644--- a/packages/client/src/components/Dropdown.css+++ b/packages/client/src/components/Dropdown.css@@ -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,diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.mdindex cc2aa8b55f..7d2e343697 100644--- a/packages/client/src/theme/README.md+++ b/packages/client/src/theme/README.md@@ -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. Theyfollow `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`diff --git a/packages/client/src/theme/defaults.css b/packages/client/src/theme/defaults.cssindex 00544ddc38..b6d58f7d78 100644--- a/packages/client/src/theme/defaults.css+++ b/packages/client/src/theme/defaults.css@@ -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` inutils/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);}diff --git a/packages/client/src/theme/defaults.spec.ts b/packages/client/src/theme/defaults.spec.tsindex fd3e28be3a..ba086d05dc 100644--- a/packages/client/src/theme/defaults.spec.ts+++ b/packages/client/src/theme/defaults.spec.ts@@ -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', () => {diff --git a/packages/client/src/theme/highContrast.css b/packages/client/src/theme/highContrast.cssindex ca67bf3e28..e019680592 100644--- a/packages/client/src/theme/highContrast.css+++ b/packages/client/src/theme/highContrast.css@@ -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));}diff --git a/packages/client/src/theme/registry.spec.ts b/packages/client/src/theme/registry.spec.tsindex c0f9afb4ec..f83c2b6d55 100644--- a/packages/client/src/theme/registry.spec.ts+++ b/packages/client/src/theme/registry.spec.ts@@ -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,diff --git a/packages/client/src/theme/registry.ts b/packages/client/src/theme/registry.tsindex e36bcaabe5..e2bf86ff33 100644--- a/packages/client/src/theme/registry.ts+++ b/packages/client/src/theme/registry.ts@@ -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): ResolvedTcustomColors != 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,diff --git a/packages/client/src/theme/themes/clickhouse.spec.tsx b/packages/client/src/theme/themes/clickhouse.spec.tsxindex 4f29c10f56..db34a3129a 100644--- a/packages/client/src/theme/themes/clickhouse.spec.tsx+++ b/packages/client/src/theme/themes/clickhouse.spec.tsx@@ -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([]);});diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.tsindex 88f2ad4bc2..3c4b792d3a 100644--- a/packages/client/src/theme/themes/clickhouse.ts+++ b/packages/client/src/theme/themes/clickhouse.ts@@ -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)diff --git a/packages/client/src/theme/themes/clickui.json b/packages/client/src/theme/themes/clickui.jsonindex f4ae894a76..9b12498730 100644--- a/packages/client/src/theme/themes/clickui.json+++ b/packages/client/src/theme/themes/clickui.json@@ -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",diff --git a/packages/client/src/theme/themes/clickui.spec.ts b/packages/client/src/theme/themes/clickui.spec.tsindex 634b3f78fc..fc33402762 100644--- a/packages/client/src/theme/themes/clickui.spec.ts+++ b/packages/client/src/theme/themes/clickui.spec.ts@@ -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',diff --git a/packages/client/src/theme/themes/dark.ts b/packages/client/src/theme/themes/dark.tsindex 8a3c63732b..d5fb5c31da 100644--- a/packages/client/src/theme/themes/dark.ts+++ b/packages/client/src/theme/themes/dark.ts@@ -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)diff --git a/packages/client/src/theme/themes/default.ts b/packages/client/src/theme/themes/default.tsindex 4677dd64dc..ae88181a3e 100644--- a/packages/client/src/theme/themes/default.ts+++ b/packages/client/src/theme/themes/default.ts@@ -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)diff --git a/packages/client/src/theme/themes/highContrast.ts b/packages/client/src/theme/themes/highContrast.tsindex 24ccd47b5b..43d85146a8 100644--- a/packages/client/src/theme/themes/highContrast.ts+++ b/packages/client/src/theme/themes/highContrast.ts@@ -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', // #b8b8b8diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.cssindex b738a3fe78..900dd66c61 100644--- a/packages/client/src/theme/tokens.css+++ b/packages/client/src/theme/tokens.css@@ -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 */diff --git a/packages/client/src/theme/types/index.ts b/packages/client/src/theme/types/index.tsindex 7daa673cd0..bd8232e3cd 100644--- a/packages/client/src/theme/types/index.ts+++ b/packages/client/src/theme/types/index.ts@@ -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;diff --git a/packages/client/src/utils/composer.spec.ts b/packages/client/src/utils/composer.spec.tsindex a05a9a203d..45deb2f5db 100644--- a/packages/client/src/utils/composer.spec.ts+++ b/packages/client/src/utils/composer.spec.ts@@ -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');});});diff --git a/packages/client/src/utils/composer.ts b/packages/client/src/utils/composer.tsindex a830c32a4c..c3144d0d43 100644--- a/packages/client/src/utils/composer.ts+++ b/packages/client/src/utils/composer.ts@@ -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 notdiff --git a/packages/data-provider/src/theme.ts b/packages/data-provider/src/theme.tsindex ffd9f35dc9..2002116875 100644--- a/packages/data-provider/src/theme.ts+++ b/packages/data-provider/src/theme.ts@@ -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',