Skip to content

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

🧾 test: Complete the Click UI Not-Expressible List (#16588)

Marco Beretta5433d5f387f0
diff --git a/client/src/style.css b/client/src/style.css
index 25833cf011..005649365f 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -2071,9 +2071,12 @@ html[data-input-modality='keyboard']
background-color: rgb(var(--surface-primary));
padding: 0.5rem;
color: rgb(var(--text-primary));
- box-shadow:
+ /* The `shadowLg` role, whose default is this literal. */
+ box-shadow: var(
+ --theme-shadow-lg,
0 10px 15px -3px rgb(0 0 0 / 0.1),
- 0 4px 6px -4px rgb(0 0 0 / 0.1);
+ 0 4px 6px -4px rgb(0 0 0 / 0.1)
+ );
transform-origin: var(--popover-transform-origin, top);
opacity: 0;
transition-property: opacity, scale;
diff --git a/e2e/specs/mock/scenarios/menu-shadow.spec.ts b/e2e/specs/mock/scenarios/menu-shadow.spec.ts
new file mode 100644
index 0000000000..f05f6b8e9a
--- /dev/null
+++ b/e2e/specs/mock/scenarios/menu-shadow.spec.ts
@@ -0,0 +1,84 @@
+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 } from '../helpers';
+import { probeStyle } from './style.helpers';
+
+/**
+ * The shared menu panel (`.popover-ui`) draws its light shadow from the `shadowLg` role, whose
+ * default is the literal it drew before, so the default theme is unchanged and the ClickHouse
+ * theme takes Click UI's `genericMenu.panel.shadow.default`. The dark panel keeps the app's own
+ * literal in every theme (berry-13/LibreChat#217).
+ */
+
+type Mode = 'light' | 'dark';
+
+const DEFAULT_LIGHT = 'rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.1) 0px 4px 6px -4px';
+const DARK = 'rgba(0, 0, 0, 0.25) 0px 10px 15px -3px, rgba(0, 0, 0, 0.1) 0px 4px 6px -4px';
+const CLICKHOUSE_LIGHT =
+ 'rgba(21, 21, 21, 0.15) 0px 4px 6px -1px, rgba(21, 21, 21, 0.15) 0px 2px 4px -1px';
+
+async function openChat(page: Page, mode: Mode, definition?: { name: string }) {
+ await page.addInitScript(
+ ([colorTheme, stored]) => {
+ localStorage.setItem('color-theme', colorTheme as string);
+ localStorage.removeItem('theme-colors');
+ localStorage.removeItem('theme-name');
+ if (stored) {
+ localStorage.setItem('theme-definition', JSON.stringify(stored));
+ localStorage.setItem('theme-source', 'definition');
+ } else {
+ localStorage.removeItem('theme-definition');
+ localStorage.removeItem('theme-source');
+ }
+ },
+ [mode, definition ?? null] as [string, unknown],
+ );
+ await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
+ await expect(page.getByRole('textbox', { name: 'Message input' })).toBeVisible({
+ timeout: 30000,
+ });
+ await expect(page.locator('html')).toHaveClass(mode === 'dark' ? /\bdark\b/ : /\blight\b/);
+ if (definition) {
+ await expect(page.locator('html')).toHaveAttribute('data-theme', definition.name);
+ }
+}
+
+const CASES: Array<{ title: string; mode: Mode; definition?: { name: string }; shadow: string }> = [
+ {
+ title:
+ 'the default light menu panel keeps its shadow @scenario:menu-shadow-default-light-unchanged',
+ mode: 'light',
+ shadow: DEFAULT_LIGHT,
+ },
+ {
+ title:
+ 'the default dark menu panel keeps its shadow @scenario:menu-shadow-default-dark-unchanged',
+ mode: 'dark',
+ shadow: DARK,
+ },
+ {
+ title:
+ 'the ClickHouse light menu panel takes the Click UI menu shadow @scenario:menu-shadow-clickhouse-light',
+ mode: 'light',
+ definition: clickHouseTheme,
+ shadow: CLICKHOUSE_LIGHT,
+ },
+ {
+ title:
+ 'the ClickHouse dark menu panel keeps the app dark shadow @scenario:menu-shadow-clickhouse-dark-unchanged',
+ mode: 'dark',
+ definition: clickHouseTheme,
+ shadow: DARK,
+ },
+];
+
+test.describe('menu panel shadow', () => {
+ for (const { title, mode, definition, shadow } of CASES) {
+ test(title, async ({ page }) => {
+ await openChat(page, mode, definition);
+
+ expect(await probeStyle(page, 'popover-ui', 'box-shadow')).toBe(shadow);
+ });
+ }
+});
diff --git a/packages/client/src/components/Dropdown.css b/packages/client/src/components/Dropdown.css
index 62d1d2af7a..4bee1fd751 100644
--- a/packages/client/src/components/Dropdown.css
+++ b/packages/client/src/components/Dropdown.css
@@ -11,9 +11,12 @@
background-color: rgb(var(--surface-primary));
padding: 0.5rem;
color: rgb(var(--text-primary));
- box-shadow:
+ /* The `shadowLg` role, whose default is this literal. */
+ box-shadow: var(
+ --theme-shadow-lg,
0 10px 15px -3px rgb(0 0 0 / 0.1),
- 0 4px 6px -4px rgb(0 0 0 / 0.1);
+ 0 4px 6px -4px rgb(0 0 0 / 0.1)
+ );
transform-origin: var(--popover-transform-origin, top);
opacity: 0;
transition-property: opacity, scale;
diff --git a/packages/client/src/theme/themes/clickui.json b/packages/client/src/theme/themes/clickui.json
index d6d7dcb747..67af0ef3a7 100644
--- a/packages/client/src/theme/themes/clickui.json
+++ b/packages/client/src/theme/themes/clickui.json
@@ -44,6 +44,7 @@
"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.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",
"click.global.color.text.danger": "#c10000",
"click.global.color.text.warning": "#a33c00",
@@ -60,6 +61,8 @@
"click.table.header.color.title.default": "#161517",
"click.table.radii.all": "0.25rem",
"click.table.row.color.stroke.default": "#e6e7e9",
+ "click.tabs.radii.all": "0.25rem",
+ "click.tooltip.radii.all": "0.25rem",
"global.color.accent.default": "#151515",
"global.color.background.default": "#ffffff",
"global.color.background.muted": "#f6f7fa",
@@ -169,6 +172,7 @@
"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.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",
"click.global.color.text.danger": "#ffbaba",
"click.global.color.text.warning": "#ffb88f",
@@ -185,6 +189,8 @@
"click.table.header.color.title.default": "rgb(97.5% 97.5% 97.5%)",
"click.table.radii.all": "0.25rem",
"click.table.row.color.stroke.default": "#323232",
+ "click.tabs.radii.all": "0.25rem",
+ "click.tooltip.radii.all": "0.25rem",
"global.color.accent.default": "#faff69",
"global.color.background.default": "#1f1f1c",
"global.color.background.muted": "#282828",
diff --git a/packages/client/src/theme/themes/clickui.spec.ts b/packages/client/src/theme/themes/clickui.spec.ts
index ddca61b362..68ab8ddd1a 100644
--- a/packages/client/src/theme/themes/clickui.spec.ts
+++ b/packages/client/src/theme/themes/clickui.spec.ts
@@ -13,13 +13,14 @@ import {
TableRow,
} from '../../components/Table';
import { OGDialog, OGDialogContent, OGDialogTitle } from '../../components/OriginalDialog';
+import { resolveTheme, themeAppearanceProperties } from '../registry';
+import { Tabs, TabsList, TabsTrigger } from '../../components/Tabs';
import { Button } from '../../components/Button';
import { Switch } from '../../components/Switch';
import Dropdown from '../../components/Dropdown';
import { Input } from '../../components/Input';
import { clickHouseTheme } from './clickhouse';
import Badge from '../../components/Badge';
-import { resolveTheme } from '../registry';
import snapshot from './clickui.json';
jest.mock('react-i18next', () => ({
@@ -744,20 +745,23 @@ function comparable(key: keyof IThemeAppearance, raw: string | number): string {
* regresses fails by name, so move its pin when a change closes a gap. Run with
* `CLICKUI_PARITY_REPORT=1` to print every decision and every role's status.
*/
-type ParityKind = 'color' | 'shape';
-type Utility = 'bg' | 'text' | 'border' | 'rounded' | 'w' | 'h' | 'py' | 'px' | 'gap';
+type ParityKind = 'color' | 'shape' | 'shadow';
+type Utility = 'bg' | 'text' | 'border' | 'rounded' | 'shadow' | 'w' | 'h' | 'py' | 'px' | 'gap';
interface ParityProbe {
/** The Click UI component token the primitive should reproduce. */
- token: string;
+ token?: string;
+ /** What Click UI's component stylesheet draws for a decision no token carries, and where. */
+ untokened?: { value: string; source: string };
kind: ParityKind;
utility: Utility;
/** A state the utility is written under, such as `data-[state=checked]:`. */
variant?: string;
/** Renders the primitive and returns the element that paints the decision. */
element?: () => Element;
- /** The value a stylesheet draws for the decision, when no class a theme role backs does. */
- literal?: () => string;
+ /** The value a stylesheet draws for the decision in a mode, when no class a theme role backs
+ * does, with any theme role it reads resolved under the ClickHouse theme. */
+ literal?: (mode: ThemeMode) => string;
/** The modes where the theme lands within deltaE2000 5 of Click UI rather than on it. */
near?: ThemeMode[];
/** Why the theme departs from Click UI on purpose, per mode. */
@@ -821,18 +825,40 @@ const dropdownProbe = () =>
'[role="combobox"]',
);
-/** The value of `property` in the first `selector` rule of a primitive's stylesheet. */
-const stylesheetValue = (file: string, selector: string, property: string) => () => {
- const css = readFileSync(join(__dirname, '../../components', file), 'utf8');
+/** The value of `property` in the first `selector` rule of a stylesheet under `src/`. */
+const cssValue = (path: string, selector: string, property: string) => {
+ const css = readFileSync(join(__dirname, '../..', path), 'utf8');
const start = css.indexOf(`${selector} {`);
const rule = start === -1 ? '' : css.slice(start, css.indexOf('}', start));
const value = new RegExp(`${property}:\\s*([^;]+);`).exec(rule)?.[1];
if (value === undefined) {
- throw new Error(`${file} has no ${property} in a ${selector} rule`);
+ throw new Error(`${path} has no ${property} in a ${selector} rule`);
}
- return value;
+ return value.replace(/\s+/g, ' ').trim();
};
+/** The value of `property` in the first `selector` rule of a primitive's stylesheet. */
+const stylesheetValue = (file: string, selector: string, property: string) => () =>
+ cssValue(`components/${file}`, selector, property);
+
+/** The app stylesheet, which repaints some primitive rules after the package's own. */
+const APP_STYLESHEET = '../../../client/src/style.css';
+
+/** A `var(--theme-*, fallback)` value resolved to the role it reads under the ClickHouse theme. */
+function resolveRoleVar(value: string, mode: ThemeMode): string {
+ const property = /^var\(\s*(--theme-[a-z0-9-]+)/.exec(value)?.[1];
+ if (property === undefined) {
+ return value;
+ }
+ const role = (Object.keys(themeAppearanceProperties) as Array<keyof IThemeAppearance>).find(
+ (key) => themeAppearanceProperties[key] === property,
+ );
+ if (role === undefined) {
+ throw new Error(`${property} is not an appearance role`);
+ }
+ return resolveTheme(clickHouseTheme, mode).appearance[role];
+}
+
/**
* The open Dropdown menu's corner. jsdom loads no stylesheet, so the rendered popover is checked
* to take its corner from `.popover-ui` alone (no radius utility or inline radius overrides it)
@@ -855,6 +881,54 @@ const popoverCorner = () => {
}
};
+/**
+ * The Dropdown menu's shadow. The package rule reads `shadowLg`; the app stylesheet repeats it in
+ * light and repaints it in dark with a literal, and the app's rules win, so dark reads that one.
+ */
+const menuShadow = (mode: ThemeMode) => {
+ if (mode === 'dark') {
+ return cssValue(APP_STYLESHEET, '.popover-ui:where(.dark, .dark *)', 'box-shadow');
+ }
+ const own = cssValue('components/Dropdown.css', '.popover-ui', 'box-shadow');
+ const app = cssValue(APP_STYLESHEET, '.popover-ui', 'box-shadow');
+ if (app !== own) {
+ throw new Error(
+ `The app's .popover-ui shadow (${app}) no longer repeats Dropdown.css (${own})`,
+ );
+ }
+ return resolveRoleVar(own, mode);
+};
+
+/** The Tooltip's shadow: `.tooltip` in light, and its `.dark` rule in dark. Tooltip renders the
+ * bare `tooltip` class, so nothing but this stylesheet paints it. */
+const tooltipShadow = (mode: ThemeMode) =>
+ cssValue(
+ 'components/Tooltip.css',
+ mode === 'dark' ? '.tooltip:where(.dark, .dark *)' : '.tooltip',
+ 'box-shadow',
+ );
+
+/** The Tabs trigger's corner, an arbitrary `rounded-[...]` value on the rendered trigger. */
+const tabsCorner = () => {
+ try {
+ const trigger = mount(
+ createElement(
+ Tabs,
+ { defaultValue: 'a' },
+ createElement(TabsList, null, createElement(TabsTrigger, { value: 'a' }, 'A')),
+ ),
+ '[role="tab"]',
+ );
+ const corner = /(?:^|\s)rounded-\[([^\]]+)\]/.exec(trigger.getAttribute('class') ?? '')?.[1];
+ if (corner === undefined) {
+ throw new Error('The Tabs trigger no longer draws a literal corner; probe its role instead');
+ }
+ return corner;
+ } finally {
+ cleanup();
+ }
+};
+
const bothModes = (reason: string): Partial<Record<ThemeMode, string>> => ({
light: reason,
dark: reason,
@@ -959,6 +1033,30 @@ const parityProbes: Record<string, ParityProbe> = {
utility: 'rounded',
literal: popoverCorner,
},
+ 'Dropdown menu shadow': {
+ token: 'click.genericMenu.panel.shadow.default',
+ kind: 'shadow',
+ utility: 'shadow',
+ literal: menuShadow,
+ },
+ 'Tooltip corner': {
+ token: 'click.tooltip.radii.all',
+ kind: 'shape',
+ utility: 'rounded',
+ literal: stylesheetValue('Tooltip.css', '.tooltip', 'border-radius'),
+ },
+ 'Tooltip shadow': {
+ untokened: { value: 'none', source: 'Tooltip.module.css .content sets no box-shadow' },
+ kind: 'shadow',
+ utility: 'shadow',
+ literal: tooltipShadow,
+ },
+ 'Tabs corner': {
+ token: 'click.tabs.radii.all',
+ kind: 'shape',
+ utility: 'rounded',
+ literal: tabsCorner,
+ },
'Dialog surface': {
token: 'click.dialog.color.background.default',
kind: 'color',
@@ -1148,6 +1246,27 @@ const notExpressible: Record<string, NotExpressible> = {
'the popover corner is a 0.7rem literal in Dropdown.css, and no radius role defaults to 0.7rem',
issue: 'https://github.com/berry-13/LibreChat/issues/196',
},
+ 'Dropdown menu shadow': {
+ decisions: { dark: ['Dropdown menu shadow'] },
+ reason:
+ "light reads shadowLg, but the app's dark .popover-ui rule repaints the shadow with a 0.25-alpha literal that no shadow role defaults to",
+ issue: 'https://github.com/berry-13/LibreChat/issues/217',
+ },
+ 'Tooltip corner and shadow': {
+ decisions: {
+ light: ['Tooltip corner', 'Tooltip shadow'],
+ dark: ['Tooltip corner', 'Tooltip shadow'],
+ },
+ reason:
+ 'Tooltip.css draws a 0.275rem corner and a black drop shadow as literals; no radius role defaults to 0.275rem and no shadow role to either shadow, where Click UI draws 0.25rem and no shadow',
+ issue: 'https://github.com/berry-13/LibreChat/issues/215',
+ },
+ 'Tabs corner': {
+ decisions: { light: ['Tabs corner'], dark: ['Tabs corner'] },
+ reason:
+ 'the Tabs trigger corner is a rounded-[0.185rem] literal, and no radius role defaults to 0.185rem',
+ issue: 'https://github.com/berry-13/LibreChat/issues/216',
+ },
};
type Verdict = 'match' | 'near' | 'deviation' | 'not expressible';
@@ -1319,11 +1438,18 @@ interface ParityResult {
const nearColor = (a: Rgba, b: Rgba) => Math.abs(a[3] - b[3]) < 0.01 && deltaE(a, b) < NEAR;
function measure(mode: ThemeMode, decision: string, probe: ParityProbe): ParityResult {
- const source = clickToken(mode, probe.token);
+ const source = probe.token !== undefined ? clickToken(mode, probe.token) : probe.untokened?.value;
+ if (source === undefined) {
+ throw new Error(`Parity probe ${decision} names neither a Click UI token nor a drawn value`);
+ }
const base = { decision, clickUi: source };
if (probe.literal) {
- const value = probe.literal();
- return { ...base, theme: `literal = ${value}`, measured: value === source ? 'match' : 'off' };
+ const value = probe.literal(mode);
+ const same =
+ probe.kind === 'shadow'
+ ? normalizeShadow(value) === normalizeShadow(source)
+ : value === source;
+ return { ...base, theme: `literal = ${value}`, measured: same ? 'match' : 'off' };
}
if (!probe.element) {
throw new Error(`Parity probe ${decision} has neither an element nor a literal`);
@@ -1469,7 +1595,7 @@ describe('ClickHouse theme drift against Click UI', () => {
...Object.values(departures[mode]).map((departure) => departure.counterpart),
...Object.values(appearanceSources),
...Object.values(appearanceDecisions).flatMap(({ token }) => (token ? [token] : [])),
- ...Object.values(parityProbes).map((probe) => probe.token),
+ ...Object.values(parityProbes).flatMap((probe) => (probe.token ? [probe.token] : [])),
]);
expect(Object.keys(tokens[mode]).filter((token) => !cited.has(token))).toEqual([]);