mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
📝 feat: Visible Prose Markers and Composer Shape Roles for ClickHouse (#16736)
This commit is contained in:
parent
71ad832cfb
commit
cd5dd94dec
50 changed files with 561 additions and 51 deletions
|
|
@ -129,7 +129,7 @@ function BackgroundTasksButton({
|
|||
finalFocus={disclosureRef}
|
||||
aria-label={title}
|
||||
className={cn(
|
||||
'border-border-medium bg-surface-secondary text-text-primary z-[200] flex max-h-[min(36rem,calc(100vh-5rem))] max-w-[calc(100vw-2rem)] flex-col rounded-xl border shadow-lg focus:outline-none',
|
||||
'border-border-medium bg-surface-secondary text-text-primary rounded-theme-menu-panel z-[200] flex max-h-[min(36rem,calc(100vh-5rem))] max-w-[calc(100vw-2rem)] flex-col border shadow-lg focus:outline-none',
|
||||
wide ? 'w-[36rem]' : 'w-80',
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ function AskUserQuestionsPopoverPanel({ ask }: { ask: ReturnType<typeof useAskAn
|
|||
<div className="absolute bottom-full z-10 mb-2 w-full">
|
||||
{/* The prompt and answers each scroll within their own caps; this outer cap keeps
|
||||
the whole card on screen when both are at their limit on a short viewport. */}
|
||||
<div className="popover border-border-light bg-surface-secondary flex max-h-[70vh] flex-col overflow-y-auto rounded-2xl border shadow-lg [view-transition-name:ask-question]">
|
||||
<div className="popover border-border-light bg-surface-secondary rounded-theme-popover flex max-h-[70vh] flex-col overflow-y-auto border shadow-lg [view-transition-name:ask-question]">
|
||||
{/* Kept at full height so the cap above scrolls it rather than clipping its end. */}
|
||||
<AskUserQuestions
|
||||
actionId={liveAsk.actionId}
|
||||
|
|
@ -164,7 +164,7 @@ function AskUserQuestionPopoverPanel({
|
|||
scroll region: the panel is absolutely positioned, so anything that
|
||||
overflows it is unreachable by page scroll. */}
|
||||
<div
|
||||
className="popover border-border-light bg-surface-secondary flex max-h-[60vh] flex-col rounded-2xl border p-2 shadow-lg [view-transition-name:ask-question]"
|
||||
className="popover border-border-light bg-surface-secondary rounded-theme-popover flex max-h-[60vh] flex-col border p-2 shadow-lg [view-transition-name:ask-question]"
|
||||
onKeyDown={handlePopoverKeyDown}
|
||||
>
|
||||
<div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 pl-2">
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ function RoundButton({
|
|||
<IconButton
|
||||
label={label}
|
||||
size="md"
|
||||
shape="composer"
|
||||
variant={primary ? 'primary' : 'ghost'}
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
|
|
@ -157,7 +158,7 @@ export function ChipModes({ modes }: ChipModesProps) {
|
|||
gutter={6}
|
||||
unmountOnHide
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
className="animate-composer-popover border-border-menu bg-surface-menu z-50 min-w-[10rem] rounded-xl border p-1 shadow-lg outline-hidden"
|
||||
className="animate-composer-popover border-border-menu bg-surface-menu rounded-theme-menu-panel z-50 min-w-[10rem] border p-1 shadow-lg outline-hidden"
|
||||
>
|
||||
{modes.map((mode) => (
|
||||
<Ariakit.MenuItem
|
||||
|
|
|
|||
|
|
@ -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-menu bg-surface-menu 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 rounded-theme-popover z-50 flex max-w-[95vw] flex-col overflow-hidden border shadow-lg outline-hidden"
|
||||
>
|
||||
{/* The whole row is the search target, not just the input: the icon
|
||||
and the padding around it read as part of the field, so clicking
|
||||
|
|
@ -1343,7 +1343,7 @@ function Palette({
|
|||
onChange={(e) => setSearch(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
data-testid="composer-palette-search"
|
||||
className="text-text-primary placeholder:text-text-secondary focus-visible:ring-text-primary w-full rounded-md border-0 bg-transparent text-sm shadow-none ring-0 focus:border-0 focus:ring-0 focus:outline-hidden focus-visible:ring-2 focus-visible:outline-hidden"
|
||||
className="text-text-primary placeholder:text-text-secondary focus-visible:ring-focus-control w-full rounded-md border-0 bg-transparent text-sm shadow-none ring-0 focus:border-0 focus:ring-0 focus:outline-hidden focus-visible:ring-2 focus-visible:outline-hidden"
|
||||
/>
|
||||
<span id={helpId} className="sr-only">
|
||||
{localize('com_ui_composer_palette_help', { 0: FAVORITE_MODIFIER })}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ function ThinkingControl({
|
|||
aria-label={localize('com_ui_composer_thinking_value', { 0: display })}
|
||||
/* `border-light` resolves to the same value as `surface-tertiary`, so
|
||||
the edge was invisible against the popup's own background. */
|
||||
className="animate-composer-popover border-border-medium bg-surface-tertiary z-50 rounded-2xl border shadow-lg outline-hidden"
|
||||
className="animate-composer-popover border-border-medium bg-surface-tertiary rounded-theme-popover z-50 border shadow-lg outline-hidden"
|
||||
>
|
||||
<Effort setting={setting} conversation={conversation} value={value} onChange={onChange} />
|
||||
</Ariakit.Popover>
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ function MentionContent({
|
|||
|
||||
return (
|
||||
<div className="absolute bottom-28 z-10 w-full space-y-2">
|
||||
<div className="popover border-border-light bg-surface-secondary rounded-2xl border p-2 shadow-lg">
|
||||
<div className="popover border-border-light bg-surface-secondary rounded-theme-popover border p-2 shadow-lg">
|
||||
<Input
|
||||
ref={initInputRef}
|
||||
placeholder={localize(placeholder)}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ function PromptsCommand({
|
|||
textAreaRef={textAreaRef}
|
||||
>
|
||||
<div className="absolute bottom-28 z-10 w-full space-y-2">
|
||||
<div className="popover border-border-light bg-surface-tertiary-alt rounded-2xl border p-2 shadow-lg">
|
||||
<div className="popover border-border-light bg-surface-tertiary-alt rounded-theme-popover border p-2 shadow-lg">
|
||||
<Input
|
||||
ref={initInputRef}
|
||||
placeholder={localize('com_ui_command_usage_placeholder')}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export function ReasoningControl({
|
|||
aria-label={label}
|
||||
align="end"
|
||||
sideOffset={6}
|
||||
className="border-border-light bg-surface-secondary text-text-primary data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 z-50 w-72 max-w-[calc(100vw-2rem)] origin-[--radix-popover-content-transform-origin] overflow-hidden rounded-2xl border shadow-xl motion-reduce:animate-none"
|
||||
className="border-border-light bg-surface-secondary text-text-primary data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-theme-popover z-50 w-72 max-w-[calc(100vw-2rem)] origin-[--radix-popover-content-transform-origin] overflow-hidden border shadow-xl motion-reduce:animate-none"
|
||||
>
|
||||
<div className="flex items-center gap-2 px-4 py-3">
|
||||
<BrainCircuit className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const SubmitButton = React.memo(
|
|||
label={localize('com_nav_send_message')}
|
||||
variant="submit"
|
||||
size="theme"
|
||||
shape="theme"
|
||||
shape="composer"
|
||||
disabled={props.disabled}
|
||||
data-testid="send-button"
|
||||
type="submit"
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ function SkillsCommandContent({
|
|||
|
||||
return (
|
||||
<div className="absolute bottom-28 z-10 w-full space-y-2">
|
||||
<div className="popover border-border-light bg-surface-tertiary-alt rounded-2xl border p-2 shadow-lg">
|
||||
<div className="popover border-border-light bg-surface-tertiary-alt rounded-theme-popover border p-2 shadow-lg">
|
||||
<Input
|
||||
ref={initInputRef}
|
||||
placeholder={localize('com_ui_skills_command_placeholder')}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export default memo(function StopButton({
|
|||
label={localize('com_nav_stop_generating')}
|
||||
variant="submit"
|
||||
size="theme"
|
||||
shape="theme"
|
||||
shape="composer"
|
||||
data-testid="stop-generation-button"
|
||||
hidden={hidden}
|
||||
disabled={!canStop}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export default function UsagePopover({
|
|||
}
|
||||
}}
|
||||
className={cn(
|
||||
'border-border-medium bg-surface-secondary text-text-primary z-[200] max-h-[calc(100dvh-1rem)] max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain rounded-xl border p-3 shadow-lg focus:outline-hidden',
|
||||
'border-border-medium bg-surface-secondary text-text-primary rounded-theme-menu-panel z-[200] max-h-[calc(100dvh-1rem)] max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain border p-3 shadow-lg focus:outline-hidden',
|
||||
'origin-bottom translate-y-1 scale-95 opacity-0 transition duration-150 ease-out motion-reduce:transition-none',
|
||||
'data-[enter]:translate-y-0 data-[enter]:scale-100 data-[enter]:opacity-100',
|
||||
'data-[leave]:translate-y-1 data-[leave]:scale-95 data-[leave]:opacity-0',
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@ const themedControls = [
|
|||
['chip.ts', ['composerControlClasses()']],
|
||||
['CodeApprovalMenu.tsx', ['chipClasses']],
|
||||
['CodeWorkspaceMenu.tsx', ['chipClasses', 'infoChipClasses']],
|
||||
/** The dictation mic and its send share the submit slot's corner. */
|
||||
['Composer/Bar.tsx', ['shape="composer"']],
|
||||
] as const;
|
||||
|
||||
describe('Composer appearance tokens', () => {
|
||||
it.each(submitControls)('%s composes the shared submit-slot control', (file) => {
|
||||
const contents = source(file);
|
||||
|
||||
['IconButton', 'variant="submit"', 'size="theme"', 'shape="theme"'].forEach((token) =>
|
||||
['IconButton', 'variant="submit"', 'size="theme"', 'shape="composer"'].forEach((token) =>
|
||||
expect(contents).toContain(token),
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const CHAT_DIR = path.resolve(__dirname, '../..');
|
||||
const SCAN_DIRS = ['Input', 'Menus', 'Messages', 'BackgroundTasks', 'approval'];
|
||||
const PACKAGE_COMPONENTS = path.resolve(
|
||||
__dirname,
|
||||
'../../../../../../packages/client/src/components',
|
||||
);
|
||||
const PACKAGE_PANELS = ['SendActions.tsx'];
|
||||
const SOURCE = /\.tsx$/;
|
||||
const SKIPPED = /(__tests__|\.spec\.|\.test\.)/;
|
||||
const PANEL_TAG =
|
||||
/<(?:Ariakit\.(?:Menu|Popover|SelectPopover|ComboboxPopover|Hovercard)|Popover\.Content)\b(?:[^\n]*>$|[\s\S]*?\n\s*\/?>)/gm;
|
||||
const PANEL_CLASS = /className="popover\b[^"]*"/g;
|
||||
const PANEL_CONSTANT = /const (?:menuClasses|panelClasses|popoverClasses)\b[^;]*;/g;
|
||||
const PANEL_ROLE = /\brounded-theme-(?:menu-panel|popover)\b/;
|
||||
const DELEGATED = /className=\{[A-Za-z.]+\}/;
|
||||
|
||||
function sourcesUnder(dir: string): string[] {
|
||||
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
||||
const full = path.join(dir, entry.name);
|
||||
if (SKIPPED.test(full)) {
|
||||
return [];
|
||||
}
|
||||
if (entry.isDirectory()) {
|
||||
return sourcesUnder(full);
|
||||
}
|
||||
return SOURCE.test(entry.name) ? [full] : [];
|
||||
});
|
||||
}
|
||||
|
||||
describe('composer menu and popover panels', () => {
|
||||
const files = [
|
||||
...SCAN_DIRS.flatMap((dir) => sourcesUnder(path.join(CHAT_DIR, dir))),
|
||||
...PACKAGE_PANELS.map((file) => path.join(PACKAGE_COMPONENTS, file)),
|
||||
];
|
||||
|
||||
it('finds the panels the theme roles are meant to cover', () => {
|
||||
const panels = files.flatMap((file) => {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
return [
|
||||
...(text.match(PANEL_TAG) ?? []),
|
||||
...(text.match(PANEL_CONSTANT) ?? []),
|
||||
...(text.match(PANEL_CLASS) ?? []),
|
||||
];
|
||||
});
|
||||
expect(panels.length).toBeGreaterThanOrEqual(10);
|
||||
});
|
||||
|
||||
it.each(files.map((file) => [path.relative(CHAT_DIR, file), file]))(
|
||||
'%s names a theme radius role on every panel that styles its own corners',
|
||||
(_name, file) => {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
const strays = [
|
||||
...(text.match(PANEL_TAG) ?? []),
|
||||
...(text.match(PANEL_CONSTANT) ?? []),
|
||||
...(text.match(PANEL_CLASS) ?? []),
|
||||
]
|
||||
.filter((panel) => !PANEL_ROLE.test(panel) && !DELEGATED.test(panel))
|
||||
.map((panel) => panel.slice(0, 80));
|
||||
expect(strays).toEqual([]);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
@ -17,7 +17,7 @@ export const infoChipClasses = cn(
|
|||
/** The popover the rail's chips open. Menus open above their chip, so they rise a few pixels
|
||||
* from its edge while fading and scaling in, and leave on the faster theme step. */
|
||||
export const chipMenuClasses = cn(
|
||||
'z-50 flex max-w-[min(340px,calc(100vw-2rem))] min-w-[240px] flex-col rounded-2xl',
|
||||
'z-50 flex max-w-[min(340px,calc(100vw-2rem))] min-w-[240px] flex-col rounded-theme-popover',
|
||||
'border-border-menu bg-surface-menu max-h-[var(--popover-available-height)] overflow-y-auto border p-1 shadow-lg',
|
||||
'origin-bottom-left translate-y-1 scale-95 opacity-0',
|
||||
'transition duration-theme-normal ease-out motion-reduce:transition-none',
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export const CustomMenu = React.forwardRef<HTMLDivElement, CustomMenuProps>(func
|
|||
className={cn(
|
||||
parent ? 'animate-popover-left ml-3' : 'animate-popover',
|
||||
'z-40 flex max-h-[min(28.125rem,var(--popover-available-height))] w-full outline-hidden!',
|
||||
'border-border-menu w-[var(--menu-width,auto)] min-w-[min(18.75rem,90vw)] flex-col overflow-auto rounded-xl border',
|
||||
'border-border-menu rounded-theme-menu-panel w-[var(--menu-width,auto)] min-w-[min(18.75rem,90vw)] flex-col overflow-auto 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]',
|
||||
|
|
@ -92,7 +92,7 @@ export const CustomMenu = React.forwardRef<HTMLDivElement, CustomMenuProps>(func
|
|||
className={cn(
|
||||
'peer flex h-10 w-full items-center justify-center rounded-lg border-none bg-transparent px-2 text-base',
|
||||
'sm:h-8 sm:text-sm',
|
||||
'focus-visible:ring-text-primary focus:ring-0 focus:outline-hidden focus-visible:ring-2',
|
||||
'focus-visible:ring-focus-control focus:ring-0 focus:outline-hidden focus-visible:ring-2',
|
||||
)}
|
||||
/>
|
||||
{comboboxLabel && (
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ function FeedbackButtons({
|
|||
gutter={8}
|
||||
portal
|
||||
unmountOnHide
|
||||
className="popover-animate border-border-medium bg-surface-secondary flex w-auto flex-col gap-1.5 overflow-hidden rounded-2xl border p-1.5 shadow-lg"
|
||||
className="popover-animate border-border-medium bg-surface-secondary rounded-theme-popover flex w-auto flex-col gap-1.5 overflow-hidden border p-1.5 shadow-lg"
|
||||
>
|
||||
<div className="flex flex-col items-stretch justify-center">
|
||||
{positiveTags.map((tag) => (
|
||||
|
|
@ -202,7 +202,7 @@ function FeedbackButtons({
|
|||
gutter={8}
|
||||
portal
|
||||
unmountOnHide
|
||||
className="popover-animate border-border-medium bg-surface-secondary flex w-auto flex-col gap-1.5 overflow-hidden rounded-2xl border p-1.5 shadow-lg"
|
||||
className="popover-animate border-border-medium bg-surface-secondary rounded-theme-popover flex w-auto flex-col gap-1.5 overflow-hidden border p-1.5 shadow-lg"
|
||||
>
|
||||
<div className="flex flex-col items-stretch justify-center">
|
||||
{negativeTags.map((tag) => (
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ const PopoverButton: React.FC<PopoverButtonProps> = ({
|
|||
gutter={16}
|
||||
shift={40}
|
||||
flip={false}
|
||||
className="border-border-medium bg-surface-secondary text-text-primary z-[999] w-[min(20rem,90vw)] rounded-2xl border p-4 shadow-md"
|
||||
className="border-border-medium bg-surface-secondary text-text-primary rounded-theme-popover z-[999] w-[min(20rem,90vw)] border p-4 shadow-md"
|
||||
portal={true}
|
||||
unmountOnHide={true}
|
||||
>
|
||||
|
|
@ -187,7 +187,7 @@ const CheckboxOption: React.FC<CheckboxOptionProps> = ({
|
|||
gutter={14}
|
||||
shift={40}
|
||||
flip={false}
|
||||
className="border-border-medium bg-surface-secondary text-text-primary z-[999] w-[min(20rem,90vw)] rounded-2xl border p-4 shadow-md"
|
||||
className="border-border-medium bg-surface-secondary text-text-primary rounded-theme-popover z-[999] w-[min(20rem,90vw)] border p-4 shadow-md"
|
||||
portal={true}
|
||||
unmountOnHide={true}
|
||||
>
|
||||
|
|
@ -354,7 +354,7 @@ function Fork({
|
|||
<Ariakit.Popover
|
||||
store={popoverStore}
|
||||
gutter={10}
|
||||
className={`popover-animate ${isActive ? 'open' : ''} border-border-medium bg-surface-secondary flex w-[min(15rem,90vw)] flex-col gap-3 overflow-hidden rounded-2xl border p-2 px-4 shadow-lg`}
|
||||
className={`popover-animate ${isActive ? 'open' : ''} border-border-medium bg-surface-secondary rounded-theme-popover flex w-[min(15rem,90vw)] flex-col gap-3 overflow-hidden border p-2 px-4 shadow-lg`}
|
||||
style={{
|
||||
outline: 'none',
|
||||
pointerEvents: 'auto',
|
||||
|
|
@ -386,7 +386,7 @@ function Fork({
|
|||
gutter={19}
|
||||
shift={40}
|
||||
flip={false}
|
||||
className="border-border-medium bg-surface-secondary text-text-primary z-[999] w-[min(20rem,90vw)] rounded-2xl border p-4 shadow-md"
|
||||
className="border-border-medium bg-surface-secondary text-text-primary rounded-theme-popover z-[999] w-[min(20rem,90vw)] border p-4 shadow-md"
|
||||
portal={true}
|
||||
unmountOnHide={true}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
|
|||
aria-labelledby="pending-tool-approval-title"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="popover border-border-light bg-surface-primary-alt pointer-events-auto flex max-h-[70vh] flex-col rounded-2xl border shadow-lg">
|
||||
<div className="popover border-border-light bg-surface-primary-alt rounded-theme-popover pointer-events-auto flex max-h-[70vh] flex-col border shadow-lg">
|
||||
<div className="border-border-light flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2">
|
||||
<p id="pending-tool-approval-title" className="text-text-primary text-sm font-medium">
|
||||
{localize(reviews.length === 1 ? 'com_ui_review_action' : 'com_ui_review_actions', {
|
||||
|
|
|
|||
|
|
@ -647,14 +647,11 @@ p > small {
|
|||
.prose :where(code):not(:where([class~='not-prose'] *)) {
|
||||
color: var(--tw-prose-code);
|
||||
font-size: 0.875em;
|
||||
font-weight: 600;
|
||||
background-color: rgb(var(--surface-active-alt));
|
||||
font-weight: var(--theme-inline-code-weight, 600);
|
||||
background-color: rgb(var(--surface-code-inline));
|
||||
padding: 0.125rem 0.25rem;
|
||||
border-radius: 0.35rem;
|
||||
}
|
||||
.dark .prose :where(code):not(:where([class~='not-prose'] *)):not(:where(pre *)) {
|
||||
background-color: rgb(var(--surface-hover-alt));
|
||||
}
|
||||
.prose :where(a code):not(:where([class~='not-prose'] *)) {
|
||||
color: inherit;
|
||||
}
|
||||
|
|
@ -755,7 +752,7 @@ p > small {
|
|||
--tw-prose-links: rgb(var(--link-prose));
|
||||
--tw-prose-bold: rgb(var(--text-primary));
|
||||
--tw-prose-counters: rgb(var(--text-tertiary));
|
||||
--tw-prose-bullets: rgb(var(--border-medium));
|
||||
--tw-prose-bullets: rgb(var(--prose-bullet));
|
||||
--tw-prose-hr: rgb(var(--border-medium));
|
||||
--tw-prose-quotes: rgb(var(--text-primary));
|
||||
--tw-prose-quote-borders: rgb(var(--border-light));
|
||||
|
|
@ -771,7 +768,7 @@ p > small {
|
|||
--tw-prose-invert-links: rgb(var(--link-prose));
|
||||
--tw-prose-invert-bold: rgb(var(--text-primary));
|
||||
--tw-prose-invert-counters: rgb(var(--text-tertiary));
|
||||
--tw-prose-invert-bullets: rgb(var(--border-medium));
|
||||
--tw-prose-invert-bullets: rgb(var(--prose-bullet));
|
||||
--tw-prose-invert-hr: rgb(var(--border-medium));
|
||||
--tw-prose-invert-quotes: rgb(var(--text-primary));
|
||||
--tw-prose-invert-quote-borders: rgb(var(--border-medium));
|
||||
|
|
@ -1238,7 +1235,7 @@ html[data-drawer-nav] body {
|
|||
|
||||
.markdown blockquote {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(var(--border-medium));
|
||||
border-color: rgb(var(--prose-quote-bar));
|
||||
border-left-width: 2px;
|
||||
line-height: 1rem;
|
||||
padding-left: 1rem;
|
||||
|
|
@ -1404,7 +1401,7 @@ html {
|
|||
}
|
||||
.markdown blockquote {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(var(--border-medium));
|
||||
border-color: rgb(var(--prose-quote-bar));
|
||||
border-left-width: 2px;
|
||||
line-height: 1rem;
|
||||
padding-left: 1rem;
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ async function expectClickUiShape(page: Page, menu: Locator) {
|
|||
await expect(page.locator('html')).toHaveAttribute('data-theme', 'clickhouse');
|
||||
const alpha = SHADOW_ALPHA[await resolvedMode(page)];
|
||||
|
||||
/** Click UI's `radii.2`; LibreChat's own `rounded-2xl` is twice that. */
|
||||
await expect(menu).toHaveCSS('border-radius', '8px');
|
||||
/** Click UI's `genericMenu.panel.radii.all`, the popover role's ClickHouse value. */
|
||||
await expect(menu).toHaveCSS('border-radius', '4px');
|
||||
const shadow = await menu.evaluate((node) => getComputedStyle(node).boxShadow);
|
||||
expect(shadow).toContain(`rgba(21, 21, 21, ${alpha}) 0px 4px 6px -1px`);
|
||||
expect(shadow).toContain(`rgba(21, 21, 21, ${alpha}) 0px 2px 4px -1px`);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
seedMessages,
|
||||
} from '../db';
|
||||
import { NEW_CHAT_PATH, MOCK_ENDPOINTS, selectMockEndpoint, sendMessage } from '../helpers';
|
||||
import { computedStyles, probeStyle } from './style.helpers';
|
||||
import { computedStyles, normalizeColor, probeStyle, themeValue } from './style.helpers';
|
||||
import { getE2EUser } from '../../../setup/user';
|
||||
|
||||
const PHASE = 'Checked the message theme';
|
||||
|
|
@ -149,7 +149,7 @@ for (const definition of ['stock', 'clickhouse'] as const) {
|
|||
expect(
|
||||
(await computedStyles(page.locator('.markdown blockquote'), ['borderLeftColor']))
|
||||
.borderLeftColor,
|
||||
).toBe(await probeStyle(page, 'border border-border-medium', 'border-left-color'));
|
||||
).toBe(await normalizeColor(page, `rgb(${await themeValue(page, '--prose-quote-bar')})`));
|
||||
|
||||
await page.goto(NEW_CHAT_PATH);
|
||||
await selectMockEndpoint(page, MOCK_ENDPOINTS[0]);
|
||||
|
|
|
|||
162
e2e/specs/mock/scenarios/prose-shape.spec.ts
Normal file
162
e2e/specs/mock/scenarios/prose-shape.spec.ts
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
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 { normalizeColor, probeStyle, themeValue } from './style.helpers';
|
||||
|
||||
/**
|
||||
* Markdown list markers, the quote bar and the inline code chip, and the composer's send corner,
|
||||
* take their own theme roles. Under ClickHouse the marker and bar leave the shared border color and
|
||||
* the send button takes the Click UI button corner; the default theme paints what it always did.
|
||||
* Every expectation is resolved by the browser from a probe carrying the role or the role it
|
||||
* replaced, never written down here.
|
||||
*/
|
||||
test.describe.configure({ timeout: 120_000 });
|
||||
test.use({ viewport: { width: 1280, height: 800 } });
|
||||
|
||||
const THEME_PARAM = 'e2eTheme';
|
||||
|
||||
async function installThemeBridge(page: Page) {
|
||||
await page.addInitScript(
|
||||
([param, definition]) => {
|
||||
const wanted = new URL(location.href).searchParams.get(param);
|
||||
if (wanted === null) {
|
||||
return;
|
||||
}
|
||||
localStorage.removeItem('theme-colors');
|
||||
localStorage.removeItem('theme-name');
|
||||
if (wanted === 'clickhouse') {
|
||||
localStorage.setItem('theme-definition', JSON.stringify(definition));
|
||||
localStorage.setItem('theme-source', 'definition');
|
||||
} else {
|
||||
localStorage.removeItem('theme-definition');
|
||||
localStorage.removeItem('theme-source');
|
||||
}
|
||||
},
|
||||
[THEME_PARAM, clickHouseTheme] as const,
|
||||
);
|
||||
}
|
||||
|
||||
type ThemeChoice = 'clickhouse' | 'default';
|
||||
|
||||
async function openNewChat(page: Page, theme: ThemeChoice) {
|
||||
await installThemeBridge(page);
|
||||
await page.goto(`${NEW_CHAT_PATH}?${THEME_PARAM}=${theme}`, { timeout: 15000 });
|
||||
const html = expect(page.locator('html'));
|
||||
await (theme === 'clickhouse' ? html : html.not).toHaveAttribute('data-theme', 'clickhouse');
|
||||
await expect(page.getByTestId('text-input')).toBeVisible({ timeout: 30000 });
|
||||
}
|
||||
|
||||
interface ProseStyles {
|
||||
bullet: string;
|
||||
quoteBar: string;
|
||||
chip: string;
|
||||
chipWeight: string;
|
||||
}
|
||||
|
||||
/** Paint the Markdown shapes the app styles under `.prose` and read what the browser resolves. */
|
||||
function proseStyles(page: Page): Promise<ProseStyles> {
|
||||
return page.evaluate(() => {
|
||||
const host = document.createElement('div');
|
||||
host.className = 'prose markdown dark:prose-invert';
|
||||
host.innerHTML =
|
||||
'<ul><li>item</li></ul><blockquote><p>quote</p></blockquote><p><code>c</code></p>';
|
||||
document.body.append(host);
|
||||
const code = getComputedStyle(host.querySelector('code') as Element);
|
||||
const styles = {
|
||||
bullet: getComputedStyle(host.querySelector('li') as Element, '::marker').color,
|
||||
quoteBar: getComputedStyle(host.querySelector('blockquote') as Element).borderLeftColor,
|
||||
chip: code.backgroundColor,
|
||||
chipWeight: code.fontWeight,
|
||||
};
|
||||
host.remove();
|
||||
return styles;
|
||||
});
|
||||
}
|
||||
|
||||
/** A color role as the browser paints it, read off the document's theme variable. */
|
||||
const roleColor = async (page: Page, role: string) =>
|
||||
normalizeColor(page, `rgb(${await themeValue(page, `--${role}`)})`);
|
||||
|
||||
/** The surface the inline chip read before it had a role, which follows the mode. */
|
||||
const previousChipRole = async (page: Page) =>
|
||||
(await page.locator('html').evaluate((node) => node.classList.contains('dark')))
|
||||
? 'surface-hover-alt'
|
||||
: 'surface-active-alt';
|
||||
|
||||
const typeIntoComposer = async (page: Page) => {
|
||||
await page.getByTestId('text-input').fill('hello');
|
||||
await expect(page.getByTestId('send-button')).toBeEnabled();
|
||||
};
|
||||
|
||||
test.describe('prose and shape roles', () => {
|
||||
test('ClickHouse draws list markers and the quote bar off the shared border @scenario:clickhouse-prose-markers-leave-border', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openNewChat(page, 'clickhouse');
|
||||
const prose = await proseStyles(page);
|
||||
const border = await probeStyle(page, 'border border-border-medium', 'border-top-color');
|
||||
|
||||
expect(prose.bullet).not.toBe(border);
|
||||
expect(prose.quoteBar).not.toBe(border);
|
||||
expect(prose.bullet).toBe(await roleColor(page, 'prose-bullet'));
|
||||
expect(prose.quoteBar).toBe(await roleColor(page, 'prose-quote-bar'));
|
||||
expect(prose.chip).toBe(await roleColor(page, 'surface-code-inline'));
|
||||
expect(prose.chipWeight).toBe('500');
|
||||
});
|
||||
|
||||
test('the default theme keeps its list markers, quote bar and code chip @scenario:default-theme-prose-unchanged', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openNewChat(page, 'default');
|
||||
const prose = await proseStyles(page);
|
||||
|
||||
expect(prose.bullet).toBe(
|
||||
await probeStyle(page, 'border border-border-medium', 'border-top-color'),
|
||||
);
|
||||
expect(prose.quoteBar).toBe(
|
||||
await probeStyle(page, 'border border-border-medium', 'border-top-color'),
|
||||
);
|
||||
expect(prose.chip).toBe(await roleColor(page, await previousChipRole(page)));
|
||||
expect(prose.chipWeight).toBe('600');
|
||||
});
|
||||
|
||||
test('a fenced code block keeps its own surface, not the inline chip @scenario:prose-fenced-code-keeps-surface', async ({
|
||||
page,
|
||||
}) => {
|
||||
for (const theme of ['clickhouse', 'default'] as ThemeChoice[]) {
|
||||
await openNewChat(page, theme);
|
||||
const fenced = await page.evaluate(() => {
|
||||
const host = document.createElement('div');
|
||||
host.className = 'prose markdown dark:prose-invert';
|
||||
host.innerHTML = '<pre><code>const a = 1;</code></pre>';
|
||||
document.body.append(host);
|
||||
const background = getComputedStyle(host.querySelector('code') as Element).backgroundColor;
|
||||
host.remove();
|
||||
return background;
|
||||
});
|
||||
|
||||
expect(fenced).toBe('rgba(0, 0, 0, 0)');
|
||||
}
|
||||
});
|
||||
|
||||
test('ClickHouse squares the send button and the default theme keeps its circle @scenario:composer-send-corner-follows-action-role', async ({
|
||||
page,
|
||||
}) => {
|
||||
for (const theme of ['clickhouse', 'default'] as ThemeChoice[]) {
|
||||
await openNewChat(page, theme);
|
||||
await typeIntoComposer(page);
|
||||
const action = await probeStyle(
|
||||
page,
|
||||
'rounded-theme-composer-action',
|
||||
'border-top-left-radius',
|
||||
);
|
||||
const send = await page
|
||||
.getByTestId('send-button')
|
||||
.evaluate((node) => getComputedStyle(node).borderTopLeftRadius);
|
||||
|
||||
expect(send).toBe(action);
|
||||
expect(action).toBe(theme === 'clickhouse' ? '4px' : '9999px');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -228,9 +228,7 @@ test.describe('controlled theme paint', () => {
|
|||
const colors: IThemeRGB = clickHouseTheme.modes[dark ? 'dark' : 'light']?.colors ?? {};
|
||||
const roles = await paintRoles(page);
|
||||
expect(roles.link).toBe(rgb(colors['rgb-link-prose']));
|
||||
expect(roles.codeFill).toBe(
|
||||
rgb(dark ? colors['rgb-surface-hover-alt'] : colors['rgb-surface-active-alt']),
|
||||
);
|
||||
expect(roles.codeFill).toBe(rgb(colors['rgb-surface-code-inline']));
|
||||
expect(roles.qr).toBe(rgb(colors['rgb-surface-qr']));
|
||||
});
|
||||
|
||||
|
|
|
|||
18
packages/client/src/components/HoverCard.spec.tsx
Normal file
18
packages/client/src/components/HoverCard.spec.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { HoverCard, HoverCardContent, HoverCardTrigger } from './HoverCard';
|
||||
|
||||
describe('HoverCardContent', () => {
|
||||
it('corners the panel with the menu panel role', () => {
|
||||
render(
|
||||
<HoverCard open>
|
||||
<HoverCardTrigger asChild>
|
||||
<button type="button">Trigger</button>
|
||||
</HoverCardTrigger>
|
||||
<HoverCardContent>Details</HoverCardContent>
|
||||
</HoverCard>,
|
||||
);
|
||||
|
||||
expect(screen.getByText('Details')).toHaveClass('rounded-theme-menu-panel');
|
||||
});
|
||||
});
|
||||
|
|
@ -36,7 +36,7 @@ const HoverCardContent: React.ForwardRefExoticComponent<
|
|||
sideOffset={sideOffset}
|
||||
style={{ ...nestedStyle, ...style }}
|
||||
className={cn(
|
||||
'border-border-light bg-surface-secondary text-text-primary data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 max-w-[min(calc(100vw-1rem),var(--radix-hover-card-content-available-width))] origin-(--radix-hover-card-content-transform-origin) rounded-xl border p-4 shadow-md outline-hidden',
|
||||
'border-border-light bg-surface-secondary text-text-primary data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-theme-menu-panel z-50 w-64 max-w-[min(calc(100vw-1rem),var(--radix-hover-card-content-available-width))] origin-(--radix-hover-card-content-transform-origin) border p-4 shadow-md outline-hidden',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ describe('IconButton', () => {
|
|||
|
||||
it('keeps submit glyphs contrasted against the theme fill', () => {
|
||||
render(
|
||||
<IconButton label="Stop" variant="submit" size="theme" shape="theme">
|
||||
<IconButton label="Stop" variant="submit" size="theme" shape="composer">
|
||||
stop
|
||||
</IconButton>,
|
||||
);
|
||||
|
|
@ -57,6 +57,18 @@ describe('IconButton', () => {
|
|||
expect(button).not.toHaveClass('text-text-primary', 'bg-text-primary');
|
||||
});
|
||||
|
||||
it('takes the composer action corner for the submit slot, not the round control corner', () => {
|
||||
render(
|
||||
<IconButton label="Send" variant="submit" size="theme" shape="composer">
|
||||
send
|
||||
</IconButton>,
|
||||
);
|
||||
|
||||
const button = screen.getByRole('button', { name: 'Send' });
|
||||
expect(button).toHaveClass('rounded-theme-composer-action');
|
||||
expect(button).not.toHaveClass('rounded-theme-control-round');
|
||||
});
|
||||
|
||||
it('provides a theme-aware primary action', () => {
|
||||
render(
|
||||
<IconButton label="Send" variant="primary">
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type IconButtonVariantProps = {
|
|||
| 'submit'
|
||||
| null;
|
||||
size?: 'xs' | 'sm' | 'md' | 'lg' | 'theme' | null;
|
||||
shape?: 'round' | 'square' | 'control' | 'theme' | null;
|
||||
shape?: 'round' | 'square' | 'control' | 'theme' | 'composer' | null;
|
||||
};
|
||||
|
||||
const iconButtonVariants: (props?: IconButtonVariantProps & ClassProp) => string = cva(
|
||||
|
|
@ -57,6 +57,8 @@ const iconButtonVariants: (props?: IconButtonVariantProps & ClassProp) => string
|
|||
/** The theme's control corner: softer than `square`, short of the full circle of `round`. */
|
||||
control: 'rounded-theme-control',
|
||||
theme: 'rounded-theme-control-round',
|
||||
/** The composer's send and stop slot, whose corner a theme sets apart from the other round controls. */
|
||||
composer: 'rounded-theme-composer-action',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export function SendActions({
|
|||
gutter={8}
|
||||
unmountOnHide
|
||||
aria-label={label}
|
||||
className="border-border-light bg-surface-secondary text-text-primary z-50 max-w-[90vw] min-w-[min(12rem,90vw)] rounded-xl border p-1.5 shadow-lg outline-hidden"
|
||||
className="border-border-light bg-surface-secondary text-text-primary rounded-theme-menu-panel z-50 max-w-[90vw] min-w-[min(12rem,90vw)] border p-1.5 shadow-lg outline-hidden"
|
||||
>
|
||||
{actions.map((action) => (
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ Three primitives keep corners of their own outside that scale: the menu panel (`
|
|||
`menuRadius` (0.7rem), the tooltip reads `tooltipRadius` (0.275rem) and the tab trigger reads
|
||||
`tabRadius` (0.185rem, through `rounded-theme-tab`). The defaults are the corners they always drew.
|
||||
|
||||
The composer's popovers read `popoverRadius` (1rem, `rounded-theme-popover`), the model selector's
|
||||
panel `menuPanelRadius` (0.75rem, `rounded-theme-menu-panel`) and the send and stop buttons
|
||||
`composerActionRadius` (a full circle, `rounded-theme-composer-action`), so a theme can bring them
|
||||
onto `menuRadius` or a square corner without moving the control or surface radii. An inline code
|
||||
chip in Markdown takes its weight from `inlineCodeWeight` (600).
|
||||
|
||||
Most appearance defaults hold in both modes. `darkAppearanceDefaults` lists the ones that differ in
|
||||
dark mode, and `defaultAppearanceFor(mode)` returns the full set for a mode: the menu panel's
|
||||
`menuShadow` and the tooltip's `tooltipShadow` are heavier on a dark page, as they always were. A
|
||||
|
|
@ -300,6 +306,8 @@ function MyComponent() {
|
|||
- `bg-surface-chat` - Chat interface background
|
||||
- `bg-surface-code` - Code block chrome: toolbar, output and result switcher
|
||||
- `bg-surface-code-body` - Code block pane behind the highlighted code
|
||||
- `bg-surface-code-inline` - Inline code chip in rendered Markdown
|
||||
- `text-prose-bullet`, `text-prose-quote-bar` - The list marker and the blockquote bar in rendered Markdown
|
||||
- `fill-illustration-subtle`, `fill-illustration`, `fill-illustration-strong` - The three tones of in-app artwork, such as the file drop zone's illustration
|
||||
- `fill-file-document`, `fill-file-sheet`, `fill-file-code`, `fill-file-artifact`, `fill-file-audio`, `fill-file-video`, `fill-file-generic` - File-type tile fills; `stroke-file-ink` and `fill-file-ink` draw the glyph on them
|
||||
- `bg-surface-qr` - Backdrop behind a QR code, kept light in every mode so it scans
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@ html {
|
|||
--surface-chat: var(--white);
|
||||
--surface-code: var(--surface-primary-alt);
|
||||
--surface-code-body: var(--surface-chat);
|
||||
--surface-code-inline: var(--surface-active-alt);
|
||||
--prose-bullet: var(--border-medium);
|
||||
--prose-quote-bar: var(--border-medium);
|
||||
--surface-qr: var(--white);
|
||||
--border-light: var(--gray-200);
|
||||
--border-light-alpha: 1;
|
||||
|
|
@ -235,6 +238,10 @@ html {
|
|||
--theme-surface-radius: 1rem;
|
||||
--theme-large-surface-radius: 1.5rem;
|
||||
--theme-menu-radius: 0.7rem;
|
||||
--theme-popover-radius: var(--theme-radius-2xl, 1rem);
|
||||
--theme-menu-panel-radius: var(--theme-radius-xl, 0.75rem);
|
||||
--theme-composer-action-radius: var(--theme-round-control-radius, 9999px);
|
||||
--theme-inline-code-weight: 600;
|
||||
--theme-tooltip-radius: 0.275rem;
|
||||
--theme-tooltip-padding-x: 0.5rem;
|
||||
--theme-tooltip-padding-y: 0.25rem;
|
||||
|
|
@ -413,6 +420,9 @@ html {
|
|||
--surface-chat: var(--gray-700);
|
||||
--surface-code: var(--presentation);
|
||||
--surface-code-body: var(--surface-primary-alt);
|
||||
--surface-code-inline: var(--surface-hover-alt);
|
||||
--prose-bullet: var(--border-medium);
|
||||
--prose-quote-bar: var(--border-medium);
|
||||
--surface-qr: var(--white);
|
||||
/* One step off the page instead of two: in dark the edge only has to separate
|
||||
a surface from the one behind it, and a brighter line reads as a seam. */
|
||||
|
|
@ -514,11 +524,14 @@ html {
|
|||
}
|
||||
|
||||
/* A root other than the document one that a legacy palette themes (`THEME_SCOPE_ATTRIBUTE` in
|
||||
utils/applyTheme.ts) keeps its avatar backdrop on its own surfaces, following the mode, as the
|
||||
document root's alias above does. The layering roles alias their source the same way, so a
|
||||
utils/applyTheme.ts) keeps its avatar backdrop, code chip, list marker and quote bar on its own surfaces,
|
||||
following the mode, as the document root's aliases above do. 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-code-inline: var(--surface-active-alt);
|
||||
--prose-bullet: var(--border-medium);
|
||||
--prose-quote-bar: var(--border-medium);
|
||||
--surface-canvas: var(--surface-primary-alt);
|
||||
--surface-user-message: var(--surface-tertiary);
|
||||
--surface-card: var(--surface-secondary);
|
||||
|
|
@ -547,4 +560,5 @@ html {
|
|||
--border-menu: var(--border-light);
|
||||
--surface-composer: var(--surface-chat);
|
||||
--surface-search: var(--surface-secondary);
|
||||
--surface-code-inline: var(--surface-hover-alt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ describe.each([
|
|||
const tokens = Object.keys(theme) as Array<keyof IThemeRGB>;
|
||||
|
||||
it('covers every registry color', () => {
|
||||
expect(tokens).toHaveLength(148);
|
||||
expect(tokens).toHaveLength(151);
|
||||
});
|
||||
|
||||
it('resolves every registry color to the runtime theme value', () => {
|
||||
|
|
@ -93,6 +93,9 @@ const stockAliases: Partial<
|
|||
dialogTitleSize: 'textLg',
|
||||
dialogTitleFontFamily: 'displayFontFamily',
|
||||
menuShadow: 'shadowLg',
|
||||
popoverRadius: 'radius2xl',
|
||||
menuPanelRadius: 'radiusXl',
|
||||
composerActionRadius: 'roundControlRadius',
|
||||
};
|
||||
|
||||
/** Color roles split out of a broader one read it in the stylesheet, in both modes, so a
|
||||
|
|
|
|||
|
|
@ -97,6 +97,14 @@
|
|||
src: url('@librechat/client/fonts/inconsolata-latin-400-normal.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: Inconsolata;
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: url('@librechat/client/fonts/inconsolata-latin-500-normal.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: Inconsolata;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -260,6 +260,46 @@ describe('theme registry', () => {
|
|||
expect(resolved.colors['rgb-link-prose']).toBe('4 5 6');
|
||||
});
|
||||
|
||||
it('keeps the prose marker, quote bar and code chip on the roles they read before', () => {
|
||||
const colors = {
|
||||
'rgb-border-light': '1 1 1',
|
||||
'rgb-border-medium': '2 2 2',
|
||||
'rgb-surface-active-alt': '3 3 3',
|
||||
'rgb-surface-hover-alt': '4 4 4',
|
||||
};
|
||||
const theme: ThemeDefinition = {
|
||||
version: 1,
|
||||
name: 'prose-roles-reference',
|
||||
modes: { light: { colors }, dark: { colors } },
|
||||
};
|
||||
const light = resolveTheme(theme, 'light').colors;
|
||||
const dark = resolveTheme(theme, 'dark').colors;
|
||||
|
||||
expect([light['rgb-prose-bullet'], light['rgb-prose-quote-bar']]).toEqual(['2 2 2', '2 2 2']);
|
||||
expect(light['rgb-surface-code-inline']).toBe('3 3 3');
|
||||
expect([dark['rgb-prose-bullet'], dark['rgb-prose-quote-bar']]).toEqual(['2 2 2', '2 2 2']);
|
||||
expect(dark['rgb-surface-code-inline']).toBe('4 4 4');
|
||||
});
|
||||
|
||||
it('keeps the popover, selector and send corners on the scale steps a theme names', () => {
|
||||
const resolved = resolveTheme(
|
||||
{
|
||||
version: 1,
|
||||
name: 'corner-reference',
|
||||
modes: {
|
||||
light: {
|
||||
appearance: { radius2xl: '3px', radiusXl: '5px', roundControlRadius: '7px' },
|
||||
},
|
||||
},
|
||||
},
|
||||
'light',
|
||||
);
|
||||
|
||||
expect(resolved.appearance.popoverRadius).toBe('3px');
|
||||
expect(resolved.appearance.menuPanelRadius).toBe('5px');
|
||||
expect(resolved.appearance.composerActionRadius).toBe('7px');
|
||||
});
|
||||
|
||||
it('derives omitted chart widget colors from the previous panel roles', () => {
|
||||
const resolved = resolveTheme(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -214,6 +214,10 @@ export const themeAppearanceProperties: Readonly<
|
|||
surfaceRadius: '--theme-surface-radius',
|
||||
largeSurfaceRadius: '--theme-large-surface-radius',
|
||||
menuRadius: '--theme-menu-radius',
|
||||
popoverRadius: '--theme-popover-radius',
|
||||
menuPanelRadius: '--theme-menu-panel-radius',
|
||||
composerActionRadius: '--theme-composer-action-radius',
|
||||
inlineCodeWeight: '--theme-inline-code-weight',
|
||||
tooltipRadius: '--theme-tooltip-radius',
|
||||
tooltipPaddingX: '--theme-tooltip-padding-x',
|
||||
tooltipPaddingY: '--theme-tooltip-padding-y',
|
||||
|
|
@ -308,6 +312,10 @@ export const defaultAppearance: IThemeAppearance = Object.freeze({
|
|||
surfaceRadius: '1rem',
|
||||
largeSurfaceRadius: '1.5rem',
|
||||
menuRadius: '0.7rem',
|
||||
popoverRadius: '1rem',
|
||||
menuPanelRadius: '0.75rem',
|
||||
composerActionRadius: '9999px',
|
||||
inlineCodeWeight: '600',
|
||||
tooltipRadius: '0.275rem',
|
||||
tooltipPaddingX: '0.5rem',
|
||||
tooltipPaddingY: '0.25rem',
|
||||
|
|
@ -544,7 +552,7 @@ function withComposableShadows(appearance: IThemeAppearance): IThemeAppearance {
|
|||
/**
|
||||
* Roles split out of a broader one, each paired with the role it read before. Headings drew the UI
|
||||
* family before the display role existed, theme-sized controls were padded by the shared spacing,
|
||||
* and dialog titles were set in the `text-lg` step and the display family, so a theme that names
|
||||
* and dialog titles were set in the `text-lg` step and the display family, the composer's popovers, the model selector and the send button drew `rounded-2xl`, `rounded-xl` and the round control corner, so a theme that names
|
||||
* the broader role and not the split one keeps what it drew. Pairs resolve in order, so a role can
|
||||
* follow one that is itself inherited.
|
||||
*/
|
||||
|
|
@ -555,6 +563,9 @@ const inheritedAppearance: ReadonlyArray<[keyof IThemeAppearance, keyof IThemeAp
|
|||
['labelSize', 'textSm'],
|
||||
['dialogTitleSize', 'textLg'],
|
||||
['dialogTitleFontFamily', 'displayFontFamily'],
|
||||
['popoverRadius', 'radius2xl'],
|
||||
['menuPanelRadius', 'radiusXl'],
|
||||
['composerActionRadius', 'roundControlRadius'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -660,6 +671,29 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
|
|||
customColors?.['rgb-link-prose'] === undefined && proseLinkSource !== undefined
|
||||
? { 'rgb-link-prose': proseLinkSource }
|
||||
: {};
|
||||
/**
|
||||
* The list marker, the blockquote bar and the inline code chip read border and surface roles
|
||||
* before they had their own, so a theme that names none of the three keeps what it painted:
|
||||
* `border-medium` for the marker, `border-light` in light and `border-medium` in dark for the
|
||||
* bar, and `surface-active-alt` in light and `surface-hover-alt` in dark for the chip.
|
||||
*/
|
||||
const proseBulletSource = customColors?.['rgb-border-medium'];
|
||||
const proseQuoteBarSource = customColors?.['rgb-border-medium'];
|
||||
const codeInlineSource =
|
||||
mode === 'dark'
|
||||
? customColors?.['rgb-surface-hover-alt']
|
||||
: customColors?.['rgb-surface-active-alt'];
|
||||
const proseFallback: IThemeRGB = {
|
||||
...(customColors?.['rgb-prose-bullet'] === undefined && proseBulletSource !== undefined
|
||||
? { 'rgb-prose-bullet': proseBulletSource }
|
||||
: {}),
|
||||
...(customColors?.['rgb-prose-quote-bar'] === undefined && proseQuoteBarSource !== undefined
|
||||
? { 'rgb-prose-quote-bar': proseQuoteBarSource }
|
||||
: {}),
|
||||
...(customColors?.['rgb-surface-code-inline'] === undefined && codeInlineSource !== undefined
|
||||
? { 'rgb-surface-code-inline': codeInlineSource }
|
||||
: {}),
|
||||
};
|
||||
/**
|
||||
* Agent and assistant avatars sat on `surface-secondary` in light and `surface-tertiary` in dark
|
||||
* before they had a role, so a theme that repaints the one its mode used keeps that backdrop.
|
||||
|
|
@ -796,6 +830,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
|
|||
...shimmerBaseFallback,
|
||||
...textMutedFallback,
|
||||
...proseLinkFallback,
|
||||
...proseFallback,
|
||||
...avatarPlaceholderFallback,
|
||||
...drawerEdgeFallback,
|
||||
...chartWidgetSurfaceFallback,
|
||||
|
|
|
|||
|
|
@ -158,6 +158,13 @@ describe('LibreChat Tailwind preset', () => {
|
|||
defaultAppearance.largeSurfaceRadius,
|
||||
],
|
||||
['rounded-theme-tab', '--theme-tab-radius', defaultAppearance.tabRadius],
|
||||
['rounded-theme-popover', '--theme-popover-radius', defaultAppearance.popoverRadius],
|
||||
['rounded-theme-menu-panel', '--theme-menu-panel-radius', defaultAppearance.menuPanelRadius],
|
||||
[
|
||||
'rounded-theme-composer-action',
|
||||
'--theme-composer-action-radius',
|
||||
defaultAppearance.composerActionRadius,
|
||||
],
|
||||
['min-w-theme-tab', '--theme-tab-min-width', defaultAppearance.tabMinWidth],
|
||||
['min-w-theme-list', '--theme-list-min-width', defaultAppearance.listMinWidth],
|
||||
['max-h-theme-list', '--theme-list-max-height', defaultAppearance.listMaxHeight],
|
||||
|
|
@ -285,6 +292,9 @@ describe('LibreChat Tailwind preset', () => {
|
|||
dialogTitleSize: 'textLg',
|
||||
dialogTitleFontFamily: 'displayFontFamily',
|
||||
menuShadow: 'shadowLg',
|
||||
popoverRadius: 'radius2xl',
|
||||
menuPanelRadius: 'radiusXl',
|
||||
composerActionRadius: 'roundControlRadius',
|
||||
};
|
||||
Object.entries(themeAppearanceProperties).forEach(([key, property]) => {
|
||||
const value = aliases[key]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import '@testing-library/jest-dom';
|
||||
import { render, waitFor } from '@testing-library/react';
|
||||
import type { ThemeMode, IThemeRGB } from '../types';
|
||||
|
|
@ -306,6 +308,27 @@ describe.each(modes)('clickhouse %s palette', (_mode, theme) => {
|
|||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps the list marker and the quote bar at the 3:1 floor on the page and the user bubble', () => {
|
||||
expect(
|
||||
below(
|
||||
theme,
|
||||
WCAG_NON_TEXT,
|
||||
['rgb-prose-bullet', 'rgb-prose-quote-bar'],
|
||||
['rgb-surface-chat', 'rgb-surface-primary', 'rgb-presentation', 'rgb-surface-user-message'],
|
||||
),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps the inline code chip off the user message bubble it can sit on', () => {
|
||||
expect(theme['rgb-surface-code-inline']).not.toEqual(theme['rgb-surface-user-message']);
|
||||
});
|
||||
|
||||
it('keeps primary text at WCAG AA on the inline code chip', () => {
|
||||
expect(below(theme, WCAG_AA_NORMAL, ['rgb-text-primary'], ['rgb-surface-code-inline'])).toEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps every series mark at the 3:1 floor on the page and under the status label', () => {
|
||||
expect(
|
||||
below(theme, WCAG_NON_TEXT, seriesTokens, [
|
||||
|
|
@ -416,6 +439,25 @@ describe('clickhouse theme definition', () => {
|
|||
|
||||
/** Click UI's control height, button padding and gap, `transition.default`, and the two steps of
|
||||
* its `spaces` scale the shared spacing takes. */
|
||||
it('squares the composer actions and brings its popovers onto the menu corner', () => {
|
||||
const { appearance } = resolveTheme(clickHouseTheme, 'light');
|
||||
expect(appearance).toMatchObject({
|
||||
composerActionRadius: '0.25rem',
|
||||
popoverRadius: appearance.menuRadius,
|
||||
menuPanelRadius: appearance.menuRadius,
|
||||
inlineCodeWeight: '500',
|
||||
});
|
||||
});
|
||||
|
||||
it('bundles the Inconsolata face the inline code weight selects', () => {
|
||||
const { appearance } = resolveTheme(clickHouseTheme, 'light');
|
||||
const fonts = fs.readFileSync(path.resolve(__dirname, '../fonts.css'), 'utf8');
|
||||
const faces = fonts.match(/font-family: Inconsolata;[^}]*font-weight: (\d+);/g) ?? [];
|
||||
expect(faces.map((face) => face.match(/font-weight: (\d+)/)?.[1])).toContain(
|
||||
appearance.inlineCodeWeight,
|
||||
);
|
||||
});
|
||||
|
||||
it('sizes theme controls and the shared spacing from Click UI', () => {
|
||||
const { appearance } = resolveTheme(clickHouseTheme, 'light');
|
||||
expect(appearance).toMatchObject({
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ export const clickHouseLightTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '255 255 255', // #ffffff (background.default)
|
||||
'rgb-surface-code': '246 247 250', // #f6f7fa (codeblock.lightMode.color.background.default)
|
||||
'rgb-surface-code-body': '246 247 250', // #f6f7fa (codeblock.lightMode.color.background.default)
|
||||
'rgb-surface-code-inline': '204 207 211', // #cccfd3 (palette.slate.200, distinct from the page and from the user message bubble, slate.100)
|
||||
'rgb-prose-bullet': '83 87 95', // #53575f (palette.slate.700, 3:1 or better on the page and the user message bubble; stroke.default is 1.24:1)
|
||||
'rgb-prose-quote-bar': '83 87 95', // #53575f (palette.slate.700, 3:1 or better on the page and the user message bubble)
|
||||
'rgb-surface-qr': '255 255 255', // #ffffff (palette.neutral.0)
|
||||
'rgb-surface-inverted': '21 21 21', // #151515 (palette.neutral.900)
|
||||
'rgb-surface-inverted-hover': '50 50 50', // #323232 (palette.neutral.712)
|
||||
|
|
@ -269,6 +272,9 @@ export const clickHouseDarkTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '31 31 28', // #1f1f1c (background.default)
|
||||
'rgb-surface-code': '40 40 40', // #282828 (codeblock.darkMode.color.background.default)
|
||||
'rgb-surface-code-body': '40 40 40', // #282828 (codeblock.darkMode.color.background.default)
|
||||
'rgb-surface-code-inline': '65 65 65', // #414141 (palette.neutral.700, distinct from the user message bubble, neutral.712)
|
||||
'rgb-prose-bullet': '128 128 128', // #808080 (palette.neutral.500, 3.7:1 on the canvas; stroke.default is 1.29:1)
|
||||
'rgb-prose-quote-bar': '128 128 128', // #808080 (palette.neutral.500, 3.7:1 on the canvas)
|
||||
'rgb-surface-qr': '255 255 255', // #ffffff (palette.neutral.0)
|
||||
'rgb-surface-inverted': '250 255 105', // #faff69 (button.basic.color.primary.background.default)
|
||||
'rgb-surface-inverted-hover': '252 255 150', // #fcff96 (button.basic.color.primary.background.hover)
|
||||
|
|
@ -418,6 +424,10 @@ const clickHouseShape = {
|
|||
largeSurfaceRadius: '0.75rem',
|
||||
roundControlRadius: '9999px',
|
||||
menuRadius: '0.25rem', // genericMenu.panel.radii.all
|
||||
popoverRadius: '0.25rem', // genericMenu.panel.radii.all, the panel the composer popovers are
|
||||
menuPanelRadius: '0.25rem', // genericMenu.panel.radii.all
|
||||
composerActionRadius: '0.25rem', // button.radii.all, Click UI draws its icon buttons square
|
||||
inlineCodeWeight: '500', // typography.font.weights.2
|
||||
tooltipRadius: '0.25rem', // tooltip.radii.all
|
||||
tooltipPaddingX: '0.75rem', // tooltip.space.x
|
||||
tooltipPaddingY: '0.5rem', // tooltip.space.y
|
||||
|
|
|
|||
|
|
@ -53,6 +53,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.button.radii.all": "0.25rem",
|
||||
"click.genericMenu.panel.color.background.default": "#ffffff",
|
||||
"click.genericMenu.panel.color.stroke.default": "#e6e7e9",
|
||||
"click.genericMenu.panel.radii.all": "0.25rem",
|
||||
|
|
@ -163,6 +164,7 @@
|
|||
"typography.font.families.regular": "\"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
|
||||
"typography.font.line-height.1": 1.5,
|
||||
"typography.font.sizes.1": "0.75rem",
|
||||
"typography.font.weights.2": "500",
|
||||
"typography.font.sizes.2": "0.875rem",
|
||||
"typography.font.sizes.3": "1rem",
|
||||
"typography.font.sizes.4": "1.125rem",
|
||||
|
|
@ -216,6 +218,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.button.radii.all": "0.25rem",
|
||||
"click.genericMenu.panel.color.background.default": "#282828",
|
||||
"click.genericMenu.panel.color.stroke.default": "#414141",
|
||||
"click.genericMenu.panel.radii.all": "0.25rem",
|
||||
|
|
@ -324,6 +327,7 @@
|
|||
"typography.font.families.regular": "\"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
|
||||
"typography.font.line-height.1": 1.5,
|
||||
"typography.font.sizes.1": "0.75rem",
|
||||
"typography.font.weights.2": "500",
|
||||
"typography.font.sizes.2": "0.875rem",
|
||||
"typography.font.sizes.3": "1rem",
|
||||
"typography.font.sizes.4": "1.125rem",
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
|
|||
'rgb-surface-chat': 'global.color.background.default',
|
||||
'rgb-surface-code': 'click.codeblock.lightMode.color.background.default',
|
||||
'rgb-surface-code-body': 'click.codeblock.lightMode.color.background.default',
|
||||
'rgb-surface-code-inline': 'palette.slate.200',
|
||||
'rgb-prose-bullet': 'palette.slate.700',
|
||||
'rgb-prose-quote-bar': 'palette.slate.700',
|
||||
'rgb-surface-qr': 'palette.neutral.0',
|
||||
'rgb-text-on-media': 'palette.neutral.0',
|
||||
'rgb-surface-inverted': 'palette.neutral.900',
|
||||
|
|
@ -248,6 +251,9 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
|
|||
'rgb-surface-chat': 'global.color.background.default',
|
||||
'rgb-surface-code': 'click.codeblock.darkMode.color.background.default',
|
||||
'rgb-surface-code-body': 'click.codeblock.darkMode.color.background.default',
|
||||
'rgb-surface-code-inline': 'palette.neutral.700',
|
||||
'rgb-prose-bullet': 'palette.neutral.500',
|
||||
'rgb-prose-quote-bar': 'palette.neutral.500',
|
||||
'rgb-surface-qr': 'palette.neutral.0',
|
||||
'rgb-text-on-media': 'palette.neutral.0',
|
||||
'rgb-surface-inverted': 'click.button.basic.color.primary.background.default',
|
||||
|
|
@ -455,6 +461,18 @@ const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>>
|
|||
status: 'mismatch',
|
||||
reason: 'stroke.intense is 2.03:1 on white, under the 3:1 a heavy edge carries',
|
||||
},
|
||||
'rgb-prose-bullet': {
|
||||
counterpart: 'global.color.stroke.intense',
|
||||
status: 'mismatch',
|
||||
reason:
|
||||
'a list marker and a quote bar are the only cue of their element, so they take the 3:1 non-text floor stroke.intense (2.03:1 on white) misses',
|
||||
},
|
||||
'rgb-prose-quote-bar': {
|
||||
counterpart: 'global.color.stroke.intense',
|
||||
status: 'mismatch',
|
||||
reason:
|
||||
'a list marker and a quote bar are the only cue of their element, so they take the 3:1 non-text floor stroke.intense (2.03:1 on white) misses',
|
||||
},
|
||||
'rgb-border-control': {
|
||||
counterpart: 'click.field.color.stroke.default',
|
||||
status: 'mismatch',
|
||||
|
|
@ -508,6 +526,18 @@ const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>>
|
|||
status: 'mismatch',
|
||||
reason: 'stroke.intense is 1.62:1 on the canvas, under the 3:1 a heavy edge carries',
|
||||
},
|
||||
'rgb-prose-bullet': {
|
||||
counterpart: 'global.color.stroke.intense',
|
||||
status: 'mismatch',
|
||||
reason:
|
||||
'a list marker and a quote bar are the only cue of their element, so they take the 3:1 non-text floor stroke.intense (1.62:1 on the canvas) misses',
|
||||
},
|
||||
'rgb-prose-quote-bar': {
|
||||
counterpart: 'global.color.stroke.intense',
|
||||
status: 'mismatch',
|
||||
reason:
|
||||
'a list marker and a quote bar are the only cue of their element, so they take the 3:1 non-text floor stroke.intense (1.62:1 on the canvas) misses',
|
||||
},
|
||||
'rgb-border-control': {
|
||||
counterpart: 'click.field.color.stroke.default',
|
||||
status: 'mismatch',
|
||||
|
|
@ -694,6 +724,10 @@ const appearanceSources: Partial<Record<keyof IThemeAppearance, string>> = {
|
|||
spaceCompact: 'spaces.2',
|
||||
spaceNormal: 'spaces.3',
|
||||
menuRadius: 'click.genericMenu.panel.radii.all',
|
||||
popoverRadius: 'click.genericMenu.panel.radii.all',
|
||||
menuPanelRadius: 'click.genericMenu.panel.radii.all',
|
||||
composerActionRadius: 'click.button.radii.all',
|
||||
inlineCodeWeight: 'typography.font.weights.2',
|
||||
tooltipRadius: 'click.tooltip.radii.all',
|
||||
tooltipPaddingX: 'click.tooltip.space.x',
|
||||
tooltipPaddingY: 'click.tooltip.space.y',
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ export const darkTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '47 47 47', // #2f2f2f (gray-700)
|
||||
'rgb-surface-code': '33 33 33', // #212121 (gray-800)
|
||||
'rgb-surface-code-body': '23 23 23', // #171717 (gray-850)
|
||||
'rgb-surface-code-inline': '66 66 66', // #424242 (gray-600)
|
||||
'rgb-prose-bullet': '57 57 57', // #393939 (gray-650)
|
||||
'rgb-prose-quote-bar': '57 57 57', // #393939 (gray-650)
|
||||
'rgb-surface-qr': '255 255 255', // #fff (white, so the code stays scannable)
|
||||
'rgb-surface-inverted': '255 255 255', // #fff (white)
|
||||
'rgb-surface-inverted-hover': '236 236 236', // #ececec (gray-100)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ export const defaultTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '255 255 255', // #fff (white)
|
||||
'rgb-surface-code': '247 247 248', // #f7f7f8 (gray-50)
|
||||
'rgb-surface-code-body': '255 255 255', // #fff (white)
|
||||
'rgb-surface-code-inline': '227 227 227', // #e3e3e3 (gray-200)
|
||||
'rgb-prose-bullet': '205 205 205', // #cdcdcd (gray-300)
|
||||
'rgb-prose-quote-bar': '205 205 205', // #cdcdcd (gray-300)
|
||||
'rgb-surface-qr': '255 255 255', // #fff (white)
|
||||
'rgb-surface-inverted': '23 23 23', // #171717 (gray-850)
|
||||
'rgb-surface-inverted-hover': '47 47 47', // #2f2f2f (gray-700)
|
||||
|
|
|
|||
|
|
@ -99,6 +99,9 @@ export const highContrastLightTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '255 255 255', // #ffffff
|
||||
'rgb-surface-code': '255 255 255', // #ffffff, matching surface-primary-alt
|
||||
'rgb-surface-code-body': '255 255 255', // #ffffff, matching surface-chat
|
||||
'rgb-surface-code-inline': '212 212 212', // #d4d4d4, matching surface-active-alt
|
||||
'rgb-prose-bullet': '0 0 0', // #000000
|
||||
'rgb-prose-quote-bar': '0 0 0', // #000000
|
||||
'rgb-surface-qr': '255 255 255', // #ffffff
|
||||
'rgb-surface-inverted': '0 0 0', // #000000
|
||||
'rgb-surface-inverted-hover': '51 51 51', // #333333
|
||||
|
|
@ -296,6 +299,9 @@ export const highContrastDarkTheme: IThemeRGB = {
|
|||
'rgb-surface-chat': '0 0 0', // #000000
|
||||
'rgb-surface-code': '0 0 0', // #000000, matching presentation
|
||||
'rgb-surface-code-body': '0 0 0', // #000000, matching surface-primary-alt
|
||||
'rgb-surface-code-inline': '87 87 87', // #575757, matching surface-hover-alt
|
||||
'rgb-prose-bullet': '255 255 255', // #ffffff
|
||||
'rgb-prose-quote-bar': '255 255 255', // #ffffff
|
||||
'rgb-surface-qr': '255 255 255', // #ffffff, so the code stays scannable
|
||||
'rgb-surface-inverted': '255 255 255', // #ffffff
|
||||
'rgb-surface-inverted-hover': '212 212 212', // #d4d4d4
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@
|
|||
--color-surface-chat: rgb(var(--surface-chat));
|
||||
--color-surface-code: rgb(var(--surface-code));
|
||||
--color-surface-code-body: rgb(var(--surface-code-body));
|
||||
--color-surface-code-inline: rgb(var(--surface-code-inline));
|
||||
--color-prose-bullet: rgb(var(--prose-bullet));
|
||||
--color-prose-quote-bar: rgb(var(--prose-quote-bar));
|
||||
--color-surface-qr: rgb(var(--surface-qr));
|
||||
--color-surface-inverted: rgb(var(--surface-inverted));
|
||||
--color-surface-inverted-hover: rgb(var(--surface-inverted-hover));
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ export interface IThemeRGB {
|
|||
'rgb-surface-chat'?: string;
|
||||
'rgb-surface-code'?: string;
|
||||
'rgb-surface-code-body'?: string;
|
||||
/** An inline code chip in rendered Markdown. */
|
||||
'rgb-surface-code-inline'?: string;
|
||||
/** The list marker and the blockquote bar in rendered Markdown. */
|
||||
'rgb-prose-bullet'?: string;
|
||||
'rgb-prose-quote-bar'?: string;
|
||||
/** The backdrop a QR code is scanned against; keep it light in every mode. */
|
||||
'rgb-surface-qr'?: string;
|
||||
'rgb-surface-inverted'?: string;
|
||||
|
|
@ -299,6 +304,9 @@ export interface IThemeVariables {
|
|||
'--surface-chat': string;
|
||||
'--surface-code': string;
|
||||
'--surface-code-body': string;
|
||||
'--surface-code-inline': string;
|
||||
'--prose-bullet': string;
|
||||
'--prose-quote-bar': string;
|
||||
'--surface-qr': string;
|
||||
'--surface-inverted': string;
|
||||
'--surface-inverted-hover': string;
|
||||
|
|
@ -459,6 +467,9 @@ export interface IThemeColors {
|
|||
'surface-chat'?: string;
|
||||
'surface-code'?: string;
|
||||
'surface-code-body'?: string;
|
||||
'surface-code-inline'?: string;
|
||||
'prose-bullet'?: string;
|
||||
'prose-quote-bar'?: string;
|
||||
'surface-qr'?: string;
|
||||
'surface-inverted'?: string;
|
||||
'surface-inverted-hover'?: string;
|
||||
|
|
@ -573,6 +584,15 @@ export interface IThemeAppearance {
|
|||
/** The corners of a menu panel (`.popover-ui`), a tooltip and a tab trigger, apart from the
|
||||
* control and surface radii; their defaults are the literals those primitives drew. */
|
||||
menuRadius: string;
|
||||
/** The corners of the composer's popovers (attach, palette, reasoning), the model selector's
|
||||
* panel, and the composer's send and mic buttons; their defaults are the literals those
|
||||
* surfaces drew, so a theme can bring them in line with `menuRadius` without touching the
|
||||
* control or surface radii. */
|
||||
popoverRadius: string;
|
||||
menuPanelRadius: string;
|
||||
composerActionRadius: string;
|
||||
/** The weight of an inline code chip in rendered Markdown. */
|
||||
inlineCodeWeight: string;
|
||||
tooltipRadius: string;
|
||||
/** A tooltip's padding and the size of its text, apart from the control spacing and the type
|
||||
* scale; their defaults are the literals the tooltip drew. */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe('composerSubmitClasses', () => {
|
|||
const classes = composerSubmitClasses();
|
||||
|
||||
expect(classes).toContain('size-theme-control');
|
||||
expect(classes).toContain('rounded-theme-control-round');
|
||||
expect(classes).toContain('rounded-theme-composer-action');
|
||||
expect(classes).toContain('p-theme-compact');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export const composerSubmitClasses = (): string =>
|
|||
cn(
|
||||
'flex items-center justify-center',
|
||||
'size-theme-control touch:size-theme-control-touch',
|
||||
'rounded-theme-control-round bg-surface-inverted p-theme-compact text-text-inverted',
|
||||
'rounded-theme-composer-action bg-surface-inverted p-theme-compact text-text-inverted',
|
||||
'outline-offset-4 transition-all duration-theme-normal',
|
||||
'disabled:cursor-not-allowed disabled:text-text-secondary disabled:opacity-10',
|
||||
disabledFillClasses,
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ module.exports = {
|
|||
'theme-control': 'var(--theme-control-radius, 0.75rem)',
|
||||
'theme-control-round': 'var(--theme-round-control-radius, 9999px)',
|
||||
'theme-surface': 'var(--theme-surface-radius, 1rem)',
|
||||
'theme-popover': 'var(--theme-popover-radius, 1rem)',
|
||||
'theme-menu-panel': 'var(--theme-menu-panel-radius, 0.75rem)',
|
||||
'theme-composer-action': 'var(--theme-composer-action-radius, 9999px)',
|
||||
'theme-surface-lg': 'var(--theme-large-surface-radius, 1.5rem)',
|
||||
'theme-tab': 'var(--theme-tab-radius, 0.185rem)',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ export const themeColorTokens = Object.freeze([
|
|||
'rgb-surface-chat',
|
||||
'rgb-surface-code',
|
||||
'rgb-surface-code-body',
|
||||
'rgb-surface-code-inline',
|
||||
'rgb-prose-bullet',
|
||||
'rgb-prose-quote-bar',
|
||||
'rgb-surface-qr',
|
||||
'rgb-surface-inverted',
|
||||
'rgb-surface-inverted-hover',
|
||||
|
|
@ -375,6 +378,10 @@ const appearanceValidators = {
|
|||
largeSurfaceRadius: isLength,
|
||||
/** A menu panel's, a tooltip's and a tab trigger's corner. */
|
||||
menuRadius: isLength,
|
||||
popoverRadius: isLength,
|
||||
menuPanelRadius: isLength,
|
||||
composerActionRadius: isLength,
|
||||
inlineCodeWeight: isFontWeight,
|
||||
tooltipRadius: isLength,
|
||||
/** A tooltip's padding and text size. */
|
||||
tooltipPaddingX: isLength,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue