mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 07:23:11 +00:00
💬 fix: Mirror Chat Messages, Markdown and Code Blocks for RTL (#17267)
* fix: Mirror Chat Surfaces For RTL Layouts * fix: Keep Short Subagent Ticker Lines at Their Reading Start Adds RTL chat scenarios covering code, markdown blocks, sibling arrows and virtualized lists. * fix: Resolve Quote and List Direction From Their Content dir=auto skips descendants that carry their own dir, so a quote or loose list holding dir=auto paragraphs always resolved left-to-right. Lists now take one direction so markers and indent stay on the same side. * fix: Keep Tables, Callouts and Trace Axes on One Direction Tables take one direction from their content so cell borders share a frame; strong-direction detection skips Arabic-Indic digits, separators and marks; handoff and answer callouts use a logical start border; trace tick and range labels stay on the LTR axis. * fix: Treat Every Script's Letters as Strong Direction Direction detection now keys on Unicode letters, so Devanagari, Thai and other LTR scripts resolve LTR. E2E specs that selected rows by pl-6 now select ps-6. * test: Cover the Shared Strong Direction Helper on Its Own * fix: Read Bidi Marks and Native Script Digits as Strong Direction * fix: Approximate Bidi Classes by Block So Symbols and Numerals Resolve * fix: Resolve Strong Direction From Unicode Bidi Class Tables * docs: Note How the Bidi Tables Are Generated and Where They Differ * fix: Generate the Bidi Tables From Unicode 17 Including L-Class Marks
This commit is contained in:
parent
f5569dff2c
commit
fd85fed204
123 changed files with 1102 additions and 369 deletions
|
|
@ -82,7 +82,7 @@ export default function ArtifactVersion({
|
|||
/>
|
||||
}
|
||||
items={dropdownItems}
|
||||
className={isSmallScreen ? '' : 'absolute right-0 top-0 mt-2'}
|
||||
className={isSmallScreen ? '' : 'absolute inset-e-0 top-0 mt-2'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ export default function Artifacts() {
|
|||
'h-full overflow-hidden shadow-2xl',
|
||||
isVisible && !isClosing
|
||||
? 'translate-x-0 opacity-100 transition-all duration-350'
|
||||
: 'translate-x-5 opacity-0 transition-all duration-300',
|
||||
: 'translate-x-5 opacity-0 transition-all duration-300 rtl:-translate-x-5',
|
||||
),
|
||||
)}
|
||||
style={isMobile ? { height: isFullscreen ? '100%' : `${height}vh` } : undefined}
|
||||
|
|
@ -533,7 +533,7 @@ export default function Artifacts() {
|
|||
'flex items-center transition-all duration-500 motion-reduce:transition-none',
|
||||
isVisible && !isClosing
|
||||
? 'translate-x-0 opacity-100'
|
||||
: '-translate-x-2 opacity-0',
|
||||
: '-translate-x-2 opacity-0 rtl:translate-x-2',
|
||||
)}
|
||||
>
|
||||
<Radio
|
||||
|
|
@ -641,7 +641,7 @@ export default function Artifacts() {
|
|||
)}
|
||||
>
|
||||
{isUndocked ? (
|
||||
<PanelRight className="size-4" aria-hidden="true" />
|
||||
<PanelRight className="size-4 rtl:-scale-x-100" aria-hidden="true" />
|
||||
) : (
|
||||
<PictureInPicture2 className="size-4" aria-hidden="true" />
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ function TaskCard({
|
|||
setVisited(true);
|
||||
setOpen((value) => !value);
|
||||
}}
|
||||
className="text-text-primary focus-visible:ring-focus-control flex max-w-full items-start gap-1 rounded text-left text-sm focus-visible:ring-2 focus-visible:outline-none"
|
||||
className="text-text-primary focus-visible:ring-focus-control flex max-w-full items-start gap-1 rounded text-start text-sm focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
<span className="line-clamp-2 break-words">
|
||||
<span className={cn(active && 'shimmer')}>{title}</span>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default function AddedConvo({
|
|||
return null;
|
||||
}
|
||||
return (
|
||||
<div className="flex items-start gap-4 py-2.5 pr-1.5 pl-3 text-sm">
|
||||
<div className="flex items-start gap-4 py-2.5 ps-3 pe-1.5 text-sm">
|
||||
<span className="mt-0 flex h-6 w-6 shrink-0 items-center justify-center">
|
||||
<div className="icon-md">
|
||||
<EndpointIcon
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ function AskUserQuestionPopoverPanel({
|
|||
handlePopoverKeyDown(e);
|
||||
}}
|
||||
>
|
||||
<div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 pl-2">
|
||||
<div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 ps-2">
|
||||
<div className="max-h-[24vh] min-w-0 overflow-y-auto pt-1">
|
||||
<p className="text-text-primary text-sm font-medium [overflow-wrap:anywhere]">
|
||||
{liveAsk.question.question}
|
||||
|
|
@ -265,7 +265,7 @@ function AskUserQuestionPopoverPanel({
|
|||
onClick={() => submit(composerText)}
|
||||
>
|
||||
{localize('com_ui_submit')}
|
||||
<CornerDownLeft className="ml-1.5 h-4 w-4" aria-hidden="true" />
|
||||
<CornerDownLeft className="ms-1.5 h-4 w-4 rtl:-scale-x-100" aria-hidden="true" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ export default function CodeApprovalMenu({
|
|||
className={cn(chipMenuItemClasses(isSelected), 'items-start')}
|
||||
>
|
||||
<Icon className="text-text-secondary mt-0.5 size-4 shrink-0" aria-hidden="true" />
|
||||
<div className="min-w-0 flex-1 text-left">
|
||||
<div className="min-w-0 flex-1 text-start">
|
||||
<div className="text-text-primary text-sm font-medium">{localize(label)}</div>
|
||||
<p className="text-text-secondary text-xs">{localize(description)}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ function EnvironmentWorkspaces({
|
|||
value={value}
|
||||
checked={currentCheckout === value}
|
||||
hideOnClick={hideOnClick}
|
||||
className={cn(menuItemClasses(currentCheckout === value), 'pl-8')}
|
||||
className={cn(menuItemClasses(currentCheckout === value), 'ps-8')}
|
||||
onChange={() =>
|
||||
value === 'auto'
|
||||
? onSelect(
|
||||
|
|
@ -391,7 +391,7 @@ function GitContext({
|
|||
className="text-text-secondary mt-0.5 size-4 shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span className="min-w-0 flex-1 text-left">
|
||||
<span className="min-w-0 flex-1 text-start">
|
||||
<span className="text-text-primary block text-sm font-medium">
|
||||
{localize(label)}
|
||||
</span>
|
||||
|
|
@ -842,7 +842,7 @@ export default function CodeWorkspaceMenu({
|
|||
}}
|
||||
>
|
||||
<Monitor className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
|
||||
<span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm">
|
||||
<span className="text-text-primary min-w-0 flex-1 truncate text-start text-sm">
|
||||
{candidate.name ?? candidate.id}
|
||||
</span>
|
||||
{workspace.mode === 'attached' && environmentIds.has(candidate.id) && (
|
||||
|
|
@ -953,7 +953,7 @@ export default function CodeWorkspaceMenu({
|
|||
className={menuItemClasses()}
|
||||
>
|
||||
<ConfirmIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />
|
||||
<span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm font-medium">
|
||||
<span className="text-text-primary min-w-0 flex-1 truncate text-start text-sm font-medium">
|
||||
{transitionText.label}
|
||||
</span>
|
||||
</Ariakit.MenuItem>
|
||||
|
|
@ -970,7 +970,7 @@ export default function CodeWorkspaceMenu({
|
|||
className="text-text-secondary mt-0.5 size-4 shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div className="min-w-0 flex-1 text-left">
|
||||
<div className="min-w-0 flex-1 text-start">
|
||||
<div className="text-text-primary truncate text-sm font-medium">
|
||||
{localize('com_ui_code_workspace_detach')}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const CollapseChat = ({
|
|||
: localize('com_ui_collapse_chat');
|
||||
|
||||
return (
|
||||
<div className="relative ml-auto items-end justify-end">
|
||||
<div className="relative ms-auto items-end justify-end">
|
||||
<TooltipAnchor
|
||||
description={description}
|
||||
render={
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ export function CatalogContent({
|
|||
controls ride inside it as a sticky header, so they share the cards'
|
||||
exact width whether the scrollbar takes space or overlays; the small
|
||||
left inset keeps the search field's focus ring from being clipped. */}
|
||||
<div className="-mr-5 -ml-1 min-h-0 flex-1 overflow-y-auto pr-5 pl-1">
|
||||
<div className="-ms-1 -me-5 min-h-0 flex-1 overflow-y-auto ps-1 pe-5">
|
||||
<div className="bg-surface-dialog sticky top-0 z-10 flex flex-wrap items-center gap-2 pt-1 pb-3">
|
||||
<div className="min-w-0 flex-1">
|
||||
<Input
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ const FileCard = memo(function FileCard({ file, onAttach, onPreview, disabled }:
|
|||
type="button"
|
||||
onClick={() => onAttach(file)}
|
||||
disabled={disabled}
|
||||
className="focus-visible:ring-ring-primary flex h-full w-full cursor-pointer flex-col gap-2 rounded-2xl p-4 text-left focus:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
className="focus-visible:ring-ring-primary flex h-full w-full cursor-pointer flex-col gap-2 rounded-2xl p-4 text-start focus:outline-hidden focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
>
|
||||
<span className="flex w-full min-w-0 items-start gap-3">
|
||||
<Thumbnail file={file} />
|
||||
|
|
@ -120,7 +120,7 @@ const FileCard = memo(function FileCard({ file, onAttach, onPreview, disabled }:
|
|||
<span className="text-text-secondary mt-auto text-xs">{formatDate(file)}</span>
|
||||
</button>
|
||||
{canPreview && (
|
||||
<span className="absolute right-2 bottom-2">
|
||||
<span className="absolute inset-e-2 bottom-2">
|
||||
<IconButton
|
||||
size="xs"
|
||||
shape="square"
|
||||
|
|
|
|||
|
|
@ -1049,7 +1049,7 @@ function Palette({
|
|||
{checked && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="bg-text-primary absolute inset-y-1 left-0 w-0.5 rounded-full"
|
||||
className="bg-text-primary absolute inset-y-1 inset-s-0 w-0.5 rounded-full"
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
|
|
@ -1126,7 +1126,7 @@ function Palette({
|
|||
</div>
|
||||
)}
|
||||
{canFavorite && (
|
||||
<div role="gridcell" className="flex shrink-0 items-center pr-1">
|
||||
<div role="gridcell" className="flex shrink-0 items-center pe-1">
|
||||
<span className={ROW_ACTION_REVEAL}>
|
||||
<IconButton
|
||||
size="xs"
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ const FileContainer = ({
|
|||
<div className="flex flex-row items-center gap-2">
|
||||
<FilePreview file={file} fileType={fileType} className="relative" />
|
||||
<div className="overflow-hidden">
|
||||
<div className="truncate font-medium" title={visibleName}>
|
||||
<div dir="auto" className="truncate font-medium" title={visibleName}>
|
||||
{visibleName}
|
||||
</div>
|
||||
{subtitleAction != null ? (
|
||||
|
|
@ -103,7 +103,7 @@ const FileContainer = ({
|
|||
* center still opens the editor. The colour shift answers focus as well as
|
||||
* hover: the ring already announces focus, but leaving the two input modes
|
||||
* with different feedback is a difference with no reason behind it. */
|
||||
'text-text-secondary hover:text-text-primary focus-visible:text-text-primary pointer-events-auto relative z-10 inline-block max-w-full truncate rounded text-left align-middle leading-4 underline underline-offset-2',
|
||||
'text-text-secondary hover:text-text-primary focus-visible:text-text-primary pointer-events-auto relative z-10 inline-block max-w-full truncate rounded text-start align-middle leading-4 underline underline-offset-2',
|
||||
focusRing,
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -78,13 +78,13 @@ const FileUpload: React.FC<FileUploadProps> = ({
|
|||
size="sm"
|
||||
onClick={handleClick}
|
||||
className={cn(
|
||||
'text-text-secondary hover:bg-surface-hover hover:text-status-success focus:ring-text-primary mr-1 flex h-auto cursor-pointer items-center rounded bg-transparent px-2 py-1 text-xs font-normal transition-colors',
|
||||
'text-text-secondary hover:bg-surface-hover hover:text-status-success focus:ring-text-primary me-1 flex h-auto cursor-pointer items-center rounded bg-transparent px-2 py-1 text-xs font-normal transition-colors',
|
||||
statusColor,
|
||||
containerClassName,
|
||||
)}
|
||||
aria-label={statusText}
|
||||
>
|
||||
<FileUp className="mr-1 flex size-5.5 items-center stroke-1" aria-hidden="true" />
|
||||
<FileUp className="me-1 flex size-5.5 items-center stroke-1" aria-hidden="true" />
|
||||
<span className="flex text-xs">{statusText}</span>
|
||||
</Button>
|
||||
<input
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ const ImagePreview = ({
|
|||
onClick={() => handleOpenChange(false)}
|
||||
variant="media"
|
||||
size="icon"
|
||||
className="absolute top-4 right-4 z-20"
|
||||
className="absolute inset-e-4 top-4 z-20"
|
||||
aria-label={localize('com_ui_close')}
|
||||
>
|
||||
<X className="size-5" aria-hidden="true" />
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export default function RemoveFile({
|
|||
<button
|
||||
type="button"
|
||||
data-remove-file
|
||||
className="bg-surface-secondary hover:bg-surface-primary absolute top-1 right-1 translate-x-1/2 -translate-y-1/2 rounded-full p-0.5 transition-colors duration-200"
|
||||
className="bg-surface-secondary hover:bg-surface-primary absolute inset-e-1 top-1 translate-x-1/2 -translate-y-1/2 rounded-full p-0.5 transition-colors duration-200 rtl:-translate-x-1/2"
|
||||
onClick={onRemove}
|
||||
disabled={disabled}
|
||||
aria-label={label ?? localize('com_ui_attach_remove')}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const sourceToClassname = {
|
|||
};
|
||||
|
||||
const defaultClassName =
|
||||
'absolute right-0 bottom-0 rounded-full p-[0.15rem] text-text-secondary transition-colors';
|
||||
'absolute inset-e-0 bottom-0 rounded-full p-[0.15rem] text-text-secondary transition-colors';
|
||||
|
||||
export default function SourceIcon({
|
||||
source,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
aria-current={sortState ? 'true' : 'false'}
|
||||
>
|
||||
{localize('com_ui_name')}
|
||||
<SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
<SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
|
@ -157,7 +157,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
aria-current={sortState ? 'true' : 'false'}
|
||||
>
|
||||
{localize('com_ui_date')}
|
||||
<SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
<SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
|
@ -276,7 +276,7 @@ export const columns: ColumnDef<TFile>[] = [
|
|||
aria-current={sortState ? 'true' : 'false'}
|
||||
>
|
||||
{localize('com_ui_size')}
|
||||
<SortIcon className="ml-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
<SortIcon className="ms-2 h-3 w-4 sm:h-4 sm:w-4" />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export default function DataTable<TData, TValue>({ columns, data }: DataTablePro
|
|||
) : (
|
||||
<TrashIcon className="text-text-destructive size-3.5 sm:size-4" />
|
||||
)}
|
||||
{!isSmallScreen && <span className="ml-2">{localize('com_ui_delete')}</span>}
|
||||
{!isSmallScreen && <span className="ms-2">{localize('com_ui_delete')}</span>}
|
||||
</Button>
|
||||
<FilterInput
|
||||
inputId="files-filter"
|
||||
|
|
@ -255,7 +255,7 @@ export default function DataTable<TData, TValue>({ columns, data }: DataTablePro
|
|||
</div>
|
||||
|
||||
<div className="flex items-center justify-end gap-2 py-4">
|
||||
<div className="text-text-secondary ml-2 flex-1 truncate text-xs sm:ml-4 sm:text-sm">
|
||||
<div className="text-text-secondary ms-2 flex-1 truncate text-xs sm:ms-4 sm:text-sm">
|
||||
<span className="hidden sm:inline">
|
||||
{localize('com_files_number_selected', {
|
||||
0: `${table.getFilteredSelectedRowModel().rows.length}`,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export function SortFilterHeader<TData, TValue>({
|
|||
onClick: () => column.setFilterValue(value),
|
||||
icon: <ListFilter className="icon-sm text-text-secondary" aria-hidden="true" />,
|
||||
show: true,
|
||||
className: isActive ? 'border-l-2 border-l-border-xheavy' : '',
|
||||
className: isActive ? 'border-s-2 border-s-border-xheavy' : '',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ export default function MentionItem({
|
|||
<div className="truncate">
|
||||
<span className="font-medium">{name}</span>
|
||||
{description != null && description ? (
|
||||
<span className="text-text-tertiary ml-2 text-sm font-light">{description}</span>
|
||||
<span className="text-text-tertiary ms-2 text-sm font-light">{description}</span>
|
||||
) : null}
|
||||
</div>
|
||||
<Clock4 size={16} className="ml-2 shrink-0" />
|
||||
<Clock4 size={16} className="ms-2 shrink-0" />
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default function PopoverButtons({
|
|||
label: localize(showExamples === true ? 'com_hide_examples' : 'com_show_examples'),
|
||||
buttonClass: isGenerativeModel === true || isTextModel ? 'disabled' : '',
|
||||
handler: triggerExamples,
|
||||
icon: <MessagesSquared className={cn('mr-1 w-[0.875rem]', iconClass)} />,
|
||||
icon: <MessagesSquared className={cn('me-1 w-[0.875rem]', iconClass)} />,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -79,7 +79,7 @@ export default function PopoverButtons({
|
|||
className={cn(
|
||||
button.buttonClass,
|
||||
'border-border-medium focus:ring-ring-primary border focus:ring-1',
|
||||
'text-text-primary hover:bg-surface-hover ml-1 h-full bg-transparent px-2 py-1 text-xs font-normal',
|
||||
'text-text-primary hover:bg-surface-hover ms-1 h-full bg-transparent px-2 py-1 text-xs font-normal',
|
||||
buttonClass ?? '',
|
||||
)}
|
||||
onClick={button.handler}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ export function ReasoningControl({
|
|||
variant="ghost"
|
||||
size="icon-xs"
|
||||
aria-label={localize('com_ui_close')}
|
||||
className="group -mr-1 shrink-0"
|
||||
className="group -me-1 shrink-0"
|
||||
>
|
||||
<X
|
||||
className="text-text-secondary group-hover:text-text-primary size-4"
|
||||
|
|
@ -176,7 +176,7 @@ export function ReasoningControl({
|
|||
<span className="truncate">
|
||||
{translated(setting.enumMappings?.[options[0]] ?? options[0], localize)}
|
||||
</span>
|
||||
<span className="truncate text-right">
|
||||
<span className="truncate text-end">
|
||||
{translated(
|
||||
setting.enumMappings?.[options[options.length - 1]] ??
|
||||
options[options.length - 1],
|
||||
|
|
@ -200,7 +200,7 @@ export function ReasoningControl({
|
|||
step={range.step ?? 1}
|
||||
onChange={(event) => setNumericValue(event.target.value)}
|
||||
onBlur={commitNumericValue}
|
||||
className="h-8 w-24 text-right"
|
||||
className="h-8 w-24 text-end"
|
||||
/>
|
||||
</div>
|
||||
<span className="text-text-secondary truncate text-xs">
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ describe('TokenUsage Breakdown', () => {
|
|||
|
||||
const estimate = screen.getByTestId('context-estimate');
|
||||
const peerTotal = Array.from(estimate.children)
|
||||
.filter((child) => !child.className.includes('pl-6'))
|
||||
.filter((child) => !child.className.includes('ps-6'))
|
||||
.reduce((sum, child) => sum + Number(child.lastElementChild?.textContent ?? 0), 0);
|
||||
|
||||
/** 300 input + 200 output + 100 estimated = 600 used. The tool share is a
|
||||
|
|
@ -307,7 +307,7 @@ describe('TokenUsage Breakdown', () => {
|
|||
|
||||
const toolRow = within(estimate).getByText('com_ui_context_tool_calls').parentElement
|
||||
?.parentElement as HTMLElement;
|
||||
expect(toolRow.parentElement?.className).toContain('pl-6');
|
||||
expect(toolRow.parentElement?.className).toContain('ps-6');
|
||||
expect(toolRow.textContent).toContain('150');
|
||||
});
|
||||
it('splits tool-call usage out of the messages row when reported', async () => {
|
||||
|
|
@ -346,7 +346,7 @@ describe('TokenUsage Breakdown', () => {
|
|||
const peerTotal = Array.from(breakdown.children)
|
||||
.filter(
|
||||
(child) =>
|
||||
!child.className.includes('pl-6') &&
|
||||
!child.className.includes('ps-6') &&
|
||||
!child.textContent?.includes('com_ui_context_free'),
|
||||
)
|
||||
.reduce(
|
||||
|
|
@ -455,14 +455,14 @@ describe('TokenUsage Breakdown', () => {
|
|||
* prompt would show its tokens twice and the visible rows would sum past
|
||||
* the meter. */
|
||||
expect(within(breakdown).getByText('com_ui_context_cache_last_call')).toBeInTheDocument();
|
||||
expect(cachedRow.parentElement?.className).toContain('pl-6');
|
||||
expect(cachedRow.parentElement?.className).toContain('ps-6');
|
||||
expect(cachedRow.textContent).toContain('30');
|
||||
/** The share column is keyed to the window, like every row above: without
|
||||
* it the cached row reads as a bare number beside rows that all carry a
|
||||
* percentage, with the cell left blank. */
|
||||
expect(cachedRow.textContent).toContain('(2%)');
|
||||
const peers = Array.from(breakdown.children).filter(
|
||||
(child) => !child.className.includes('pl-6'),
|
||||
(child) => !child.className.includes('ps-6'),
|
||||
);
|
||||
expect(peers.some((peer) => peer.textContent?.includes('com_ui_context_cache_write'))).toBe(
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function Row({
|
|||
<span className="text-text-primary shrink-0 font-medium whitespace-nowrap">
|
||||
{formatTokens(safeValue)}
|
||||
{percent != null && (
|
||||
<span className="text-text-secondary ml-1 text-xs" aria-hidden="true">
|
||||
<span className="text-text-secondary ms-1 text-xs" aria-hidden="true">
|
||||
({Math.round(percent)}%)
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -75,7 +75,7 @@ function Row({
|
|||
</>
|
||||
);
|
||||
const className = cn(
|
||||
'flex w-full items-center justify-between gap-4 text-left text-sm',
|
||||
'flex w-full items-center justify-between gap-4 text-start text-sm',
|
||||
onClick != null &&
|
||||
'rounded-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-text-primary',
|
||||
);
|
||||
|
|
@ -359,7 +359,7 @@ export default function Breakdown({
|
|||
className="group focus-visible:ring-text-primary flex w-full flex-wrap items-center justify-between gap-2 rounded-sm focus-visible:ring-2"
|
||||
data-testid="context-breakdown-toggle"
|
||||
>
|
||||
<span className="text-text-primary min-w-0 text-left text-sm font-medium">
|
||||
<span className="text-text-primary min-w-0 text-start text-sm font-medium">
|
||||
{localize('com_ui_context_window')}
|
||||
</span>
|
||||
<span className="text-text-secondary flex min-w-0 items-center gap-1 text-xs font-medium">
|
||||
|
|
@ -490,7 +490,7 @@ export default function Breakdown({
|
|||
/>
|
||||
)}
|
||||
{id === 'tool-calls' && toolsExpanded && hasToolCounts && (
|
||||
<div id={toolBreakdownId} className="space-y-1 pl-6">
|
||||
<div id={toolBreakdownId} className="space-y-1 ps-6">
|
||||
<p className="text-text-tertiary text-xs font-medium">
|
||||
{localize('com_ui_context_tool_breakdown')}
|
||||
</p>
|
||||
|
|
@ -500,7 +500,7 @@ export default function Breakdown({
|
|||
</div>
|
||||
)}
|
||||
{id === 'system' && dynamicInstructionTokens > 0 && (
|
||||
<div className="pl-6">
|
||||
<div className="ps-6">
|
||||
<Row
|
||||
label={localize('com_ui_context_dynamic_instructions')}
|
||||
value={dynamicInstructionTokens}
|
||||
|
|
@ -517,7 +517,7 @@ export default function Breakdown({
|
|||
* tokens twice and the visible rows would sum past the meter. */}
|
||||
{(normalizeTokenCount(view.cacheRead) > 0 ||
|
||||
normalizeTokenCount(view.cacheWrite) > 0) && (
|
||||
<div className="space-y-1.5 pl-6">
|
||||
<div className="space-y-1.5 ps-6">
|
||||
<p className="text-text-tertiary text-xs font-medium">
|
||||
{localize('com_ui_context_cache_last_call')}
|
||||
</p>
|
||||
|
|
@ -588,7 +588,7 @@ export default function Breakdown({
|
|||
* rows are provider counts and this share is a char estimate, so
|
||||
* subtracting it would corrupt them. */}
|
||||
{normalizeTokenCount(view.toolCallTokens) > 0 && (
|
||||
<div className="pl-6">
|
||||
<div className="ps-6">
|
||||
<Row
|
||||
label={localize('com_ui_context_tool_calls')}
|
||||
value={normalizeTokenCount(view.toolCallTokens)}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ export default function Usage({
|
|||
<h3 aria-labelledby={headingId}>
|
||||
<CollapsibleTrigger
|
||||
disabled={usage == null}
|
||||
className="group flex w-full items-start justify-between text-left"
|
||||
className="group flex w-full items-start justify-between text-start"
|
||||
>
|
||||
<span className="min-w-0">
|
||||
<span
|
||||
|
|
@ -93,7 +93,7 @@ export default function Usage({
|
|||
<span className="text-text-secondary block text-xs">{subtitle}</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="ml-3 flex shrink-0 items-center gap-2">
|
||||
<span className="ms-3 flex shrink-0 items-center gap-2">
|
||||
{cost != null && Number.isFinite(cost) && (
|
||||
<span
|
||||
className="text-text-primary text-sm font-medium tabular-nums"
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const PhaseLabel = memo(function PhaseLabel({
|
|||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'tool-status-text relative block min-w-0 overflow-hidden text-left',
|
||||
'tool-status-text relative block min-w-0 overflow-hidden text-start',
|
||||
grow && 'flex-1',
|
||||
)}
|
||||
title={text}
|
||||
|
|
@ -436,7 +436,7 @@ function LivePhaseHeader({
|
|||
{failedNote !== '' && <span className="sr-only">· {failedNote}</span>}
|
||||
{cancelledNote !== '' && (
|
||||
<>
|
||||
<span className="text-text-secondary mr-1">·</span>
|
||||
<span className="text-text-secondary me-1">·</span>
|
||||
<span>{cancelledNote}</span>
|
||||
</>
|
||||
)}
|
||||
|
|
@ -503,7 +503,7 @@ function FailedPeek({
|
|||
type="button"
|
||||
className={cn(
|
||||
TOOL_ROW_CLASSES,
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle w-full pl-6 text-left focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle w-full ps-6 text-start focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset',
|
||||
)}
|
||||
onClick={onReveal}
|
||||
data-testid="activity-phase-failed-peek"
|
||||
|
|
@ -530,7 +530,7 @@ function FailedPeek({
|
|||
{localize('com_ui_plus_n_more', { 0: String(count - 1) })}
|
||||
</span>
|
||||
)}
|
||||
<span className="ml-auto shrink-0 text-xs font-medium underline underline-offset-2">
|
||||
<span className="ms-auto shrink-0 text-xs font-medium underline underline-offset-2">
|
||||
{localize('com_ui_show_error')}
|
||||
</span>
|
||||
</button>
|
||||
|
|
@ -801,7 +801,7 @@ export default function ActivityPhaseGroup({
|
|||
>
|
||||
<PhaseGlyph failed={allFailed} partial={partialMarkerFallback} />
|
||||
<span
|
||||
className="tool-status-text min-w-0 flex-1 truncate text-left font-medium"
|
||||
className="tool-status-text min-w-0 flex-1 truncate text-start font-medium"
|
||||
role="status"
|
||||
title={label}
|
||||
>
|
||||
|
|
@ -840,7 +840,7 @@ export default function ActivityPhaseGroup({
|
|||
* supplies it today; stating it here keeps the requirement with
|
||||
* the element that depends on it. */
|
||||
className={cn(
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-left font-medium hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none focus-visible:ring-inset',
|
||||
'text-text-secondary hover:text-text-primary focus-visible:ring-focus-subtle flex h-auto min-h-7 min-w-0 flex-1 items-center justify-start gap-2 rounded-none bg-transparent p-0 py-1 text-start font-medium hover:bg-transparent focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:outline-none focus-visible:ring-inset',
|
||||
/** The open card's title: the one semibold, primary-colour line
|
||||
* in the fold, so the rows under it read as its contents. */
|
||||
isExpanded && 'text-text-primary font-semibold',
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ const AgentHandoff: React.FC<AgentHandoffProps> = ({ name, args: _args = '' }) =
|
|||
aria-labelledby={headingId}
|
||||
className={cn(
|
||||
toolPanelSpacingClassName,
|
||||
'group/handoff border-border-medium ml-8 max-w-3xl border-l-2 py-1 pr-1 pl-4',
|
||||
'group/handoff border-border-medium ms-8 max-w-3xl border-s-2 py-1 ps-4 pe-1',
|
||||
)}
|
||||
>
|
||||
<div className="mb-1.5 flex min-h-5 items-center justify-between gap-2">
|
||||
|
|
|
|||
|
|
@ -368,14 +368,14 @@ function AskUserQuestionSingle({
|
|||
</Button>
|
||||
{(status === 'expired' || status === 'error') && (
|
||||
<span className="text-text-warning flex min-w-0 items-center text-xs">
|
||||
<TriangleAlert className="mr-1.5 size-4 shrink-0" aria-hidden="true" />
|
||||
<TriangleAlert className="me-1.5 size-4 shrink-0" aria-hidden="true" />
|
||||
{localize(status === 'expired' ? 'com_ui_approval_expired' : 'com_ui_approval_error')}
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="submit"
|
||||
className="ml-auto"
|
||||
className="ms-auto"
|
||||
disabled={!canSubmit || locked}
|
||||
onClick={submitCombined}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ function QuestionBody({
|
|||
</p>
|
||||
)}
|
||||
{typeof answer === 'string' && (
|
||||
<div className="border-border-medium mt-2.5 border-l-2 pl-3">
|
||||
<div className="border-border-medium mt-2.5 border-s-2 ps-3">
|
||||
<p className="text-text-secondary text-xs font-medium">
|
||||
{localize('com_ui_you_answered')}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ export default function AskUserQuestions({
|
|||
{showRemaining && (
|
||||
<button
|
||||
type="button"
|
||||
className="text-text-secondary hover:text-text-primary pt-2 text-left text-xs select-none hover:underline"
|
||||
className="text-text-secondary hover:text-text-primary pt-2 text-start text-xs select-none hover:underline"
|
||||
onClick={() => goToStep(firstUnanswered)}
|
||||
>
|
||||
{localize(
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ export default function CodeAnalyze({
|
|||
<div className="bg-surface-tertiary p-4 text-xs">
|
||||
<div className="text-text-secondary mb-1">{localize('com_ui_result')}</div>
|
||||
<div className="prose flex flex-col-reverse">
|
||||
<pre className="text-text-primary! shrink-0">{logs}</pre>
|
||||
<pre dir="ltr" className="text-text-primary! shrink-0">
|
||||
{logs}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ export default function DialogImage({
|
|||
<DialogPrimitive.Title className="sr-only">{title}</DialogPrimitive.Title>
|
||||
)}
|
||||
{/* Close button - top left */}
|
||||
<div className="absolute top-4 left-4 z-20">
|
||||
<div className="absolute inset-s-4 top-4 z-20">
|
||||
<TooltipAnchor
|
||||
zIndex={TOOLTIP_Z_INDEX}
|
||||
description={localize('com_ui_close')}
|
||||
|
|
@ -304,7 +304,7 @@ export default function DialogImage({
|
|||
|
||||
{/* Action buttons - top right (21rem = 20rem panel + 1rem gap) */}
|
||||
<div
|
||||
className={`absolute top-4 z-20 flex items-center gap-2 transition-[right] duration-300 ${detailsBeside ? 'right-[21rem]' : 'right-4'}`}
|
||||
className={`absolute top-4 z-20 flex items-center gap-2 transition-all duration-300 ${detailsBeside ? 'inset-e-[21rem]' : 'inset-e-4'}`}
|
||||
>
|
||||
{zoom > 1 && (
|
||||
<TooltipAnchor
|
||||
|
|
@ -362,7 +362,7 @@ export default function DialogImage({
|
|||
|
||||
{/* Image container - centered */}
|
||||
<div
|
||||
className={`transition-[margin] duration-300 ${detailsBeside ? 'mr-80' : ''}`}
|
||||
className={`transition-[margin] duration-300 ${detailsBeside ? 'me-80' : ''}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div
|
||||
|
|
@ -402,8 +402,8 @@ export default function DialogImage({
|
|||
{showDetails && (
|
||||
<div
|
||||
data-side-panel
|
||||
className={`bg-surface-primary border-text-on-media/10 fixed top-0 right-0 z-30 h-full w-80 max-w-full transform border-l shadow-2xl transition-transform duration-300 ${
|
||||
isPromptOpen ? 'translate-x-0' : 'translate-x-full'
|
||||
className={`bg-surface-primary border-text-on-media/10 fixed inset-e-0 top-0 z-30 h-full w-80 max-w-full transform border-s shadow-2xl transition-transform duration-300 ${
|
||||
isPromptOpen ? 'translate-x-0' : 'translate-x-full rtl:-translate-x-full'
|
||||
}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ export default function FilePreviewDialog({
|
|||
className="flex w-full max-w-4xl flex-col !overflow-hidden p-0"
|
||||
showCloseButton={true}
|
||||
>
|
||||
<div className="shrink-0 px-6 pt-6 pr-12">
|
||||
<div className="shrink-0 px-6 pe-12 pt-6">
|
||||
<OGDialogTitle className="truncate text-base">{fileName}</OGDialogTitle>
|
||||
<div className="mt-0.5 flex items-center gap-3">
|
||||
<OGDialogDescription className="min-w-0 truncate">
|
||||
|
|
@ -321,7 +321,7 @@ export default function FilePreviewDialog({
|
|||
)}
|
||||
{displayedText !== null && !isLoading && !hasPreviewError && (
|
||||
<>
|
||||
<div className="pointer-events-none sticky top-0 z-10 flex justify-end pr-1">
|
||||
<div className="pointer-events-none sticky top-0 z-10 flex justify-end pe-1">
|
||||
<CopyButton
|
||||
isCopied={isCopied}
|
||||
onClick={handleCopy}
|
||||
|
|
@ -331,7 +331,7 @@ export default function FilePreviewDialog({
|
|||
/>
|
||||
</div>
|
||||
<div className="bg-surface-secondary -mt-8 rounded-lg p-4">
|
||||
<pre className="text-text-primary pr-8 font-mono text-sm leading-6 break-words whitespace-pre-wrap">
|
||||
<pre className="text-text-primary pe-8 font-mono text-sm leading-6 break-words whitespace-pre-wrap">
|
||||
{displayedText}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ const Image = ({
|
|||
const showSkeleton = hasDimensions && !paintedUrls.has(absoluteImageUrl);
|
||||
|
||||
return (
|
||||
<div className={alignRight ? 'ml-auto' : undefined}>
|
||||
<div className={alignRight ? 'ms-auto' : undefined}>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import React, { memo, useMemo, useRef, useEffect } from 'react';
|
||||
import { PermissionTypes, Permissions, apiBaseUrl } from 'librechat-data-provider';
|
||||
import type { Element, ElementContent } from 'hast';
|
||||
import {
|
||||
handleDoubleClick,
|
||||
triggerDownload,
|
||||
|
|
@ -11,6 +12,7 @@ import { useMessagePartsHost } from '~/Providers/MessagePartsHostContext';
|
|||
import { useCodeBlockContext, useMediaContext } from '~/Providers';
|
||||
import CodeBlock from '~/components/Messages/Content/CodeBlock';
|
||||
import useHasAccess from '~/hooks/Roles/useHasAccess';
|
||||
import { strongDirection } from '~/utils/direction';
|
||||
import { useFileDownload } from '~/data-provider';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
||||
|
|
@ -189,17 +191,86 @@ type TParagraphProps = {
|
|||
};
|
||||
|
||||
export const p: React.ElementType = memo(function MarkdownParagraph({ children }: TParagraphProps) {
|
||||
return <p className="mb-2 whitespace-pre-wrap">{children}</p>;
|
||||
return (
|
||||
<p dir="auto" className="mb-2 whitespace-pre-wrap">
|
||||
{children}
|
||||
</p>
|
||||
);
|
||||
});
|
||||
p.displayName = 'MarkdownParagraph';
|
||||
|
||||
type TTableProps = {
|
||||
children: React.ReactNode;
|
||||
type TBlockProps = React.HTMLAttributes<HTMLElement> & { node?: Element };
|
||||
|
||||
/** Resolves direction per block so a mixed-language reply is not laid out by its first character. */
|
||||
const withAutoDir = (Tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6') => {
|
||||
const Block: React.ElementType = memo(function MarkdownBlock({
|
||||
node: _node,
|
||||
...props
|
||||
}: TBlockProps) {
|
||||
return <Tag dir="auto" {...props} />;
|
||||
});
|
||||
Block.displayName = `Markdown${Tag.toUpperCase()}`;
|
||||
return Block;
|
||||
};
|
||||
|
||||
export const table: React.ElementType = memo(function MarkdownTable({ children }: TTableProps) {
|
||||
/** First strong direction of a subtree's text, skipping code, which is always left-to-right. */
|
||||
const nodeDirection = (node: Element | ElementContent): 'ltr' | 'rtl' | null => {
|
||||
if (node.type === 'text') {
|
||||
return strongDirection(node.value);
|
||||
}
|
||||
if (node.type !== 'element' || node.tagName === 'code' || node.tagName === 'pre') {
|
||||
return null;
|
||||
}
|
||||
for (const child of node.children) {
|
||||
const direction = nodeDirection(child);
|
||||
if (direction != null) {
|
||||
return direction;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Quotes and lists hold paragraphs that carry their own `dir="auto"`, and the browser's
|
||||
* `dir="auto"` skips those, so a container would resolve to LTR whatever its text. Resolve it
|
||||
* from the subtree instead, and inherit when there is no strong character. A list takes one
|
||||
* direction so its markers and indent stay on the same side.
|
||||
*/
|
||||
const withContentDir = (Tag: 'ul' | 'ol' | 'blockquote') => {
|
||||
const Block: React.ElementType = memo(function MarkdownContainer({
|
||||
node,
|
||||
...props
|
||||
}: TBlockProps) {
|
||||
const dir = node != null ? (nodeDirection(node) ?? undefined) : undefined;
|
||||
return <Tag dir={dir} {...props} />;
|
||||
});
|
||||
Block.displayName = `Markdown${Tag.toUpperCase()}`;
|
||||
return Block;
|
||||
};
|
||||
|
||||
export const ul = withContentDir('ul');
|
||||
export const ol = withContentDir('ol');
|
||||
export const h1 = withAutoDir('h1');
|
||||
export const h2 = withAutoDir('h2');
|
||||
export const h3 = withAutoDir('h3');
|
||||
export const h4 = withAutoDir('h4');
|
||||
export const h5 = withAutoDir('h5');
|
||||
export const h6 = withAutoDir('h6');
|
||||
export const blockquote = withContentDir('blockquote');
|
||||
|
||||
type TTableProps = {
|
||||
children: React.ReactNode;
|
||||
node?: Element;
|
||||
};
|
||||
|
||||
/** One direction for the whole table, so cell borders and corners stay on a single frame. */
|
||||
export const table: React.ElementType = memo(function MarkdownTable({
|
||||
children,
|
||||
node,
|
||||
}: TTableProps) {
|
||||
const dir = node != null ? (nodeDirection(node) ?? undefined) : undefined;
|
||||
return (
|
||||
<div className="markdown-table-wrapper w-full max-w-full">
|
||||
<div dir={dir} className="markdown-table-wrapper w-full max-w-full">
|
||||
<table>{children}</table>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,23 @@ import supersub from 'remark-supersub';
|
|||
import ReactMarkdown from 'react-markdown';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import type { PluggableList } from 'unified';
|
||||
import { code, codeNoExecution, a, p, img, table } from './MarkdownComponents';
|
||||
import {
|
||||
code,
|
||||
codeNoExecution,
|
||||
a,
|
||||
p,
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
} from './MarkdownComponents';
|
||||
import { langSubset, remarkApproxTilde } from '~/utils';
|
||||
import { reportBoundaryError } from '~/lib/rum/logs';
|
||||
import { CodeBlockProvider } from '~/Providers';
|
||||
|
|
@ -80,6 +96,15 @@ class MarkdownErrorBoundary extends React.Component<
|
|||
* `` to a page-relative URL. */
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
} as {
|
||||
[nodeType: string]: React.ElementType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,23 @@ import supersub from 'remark-supersub';
|
|||
import ReactMarkdown from 'react-markdown';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import type { PluggableList } from 'unified';
|
||||
import { code, codeNoExecution, a, p, img, table } from './MarkdownComponents';
|
||||
import {
|
||||
code,
|
||||
codeNoExecution,
|
||||
a,
|
||||
p,
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
} from './MarkdownComponents';
|
||||
import { CodeBlockProvider, ArtifactProvider } from '~/Providers';
|
||||
import MarkdownErrorBoundary from './MarkdownErrorBoundary';
|
||||
import { langSubset, remarkApproxTilde } from '~/utils';
|
||||
|
|
@ -46,6 +62,15 @@ const MarkdownLite = memo(
|
|||
p,
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
} as {
|
||||
[nodeType: string]: React.ElementType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ const renderers: PartRenderers = {
|
|||
const failed = part.status === 'failed' || part.status === 'partial';
|
||||
return (
|
||||
<div
|
||||
className={`my-1 pl-1 text-sm break-words italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
|
||||
className={`my-1 ps-1 text-sm break-words italic ${failed ? 'text-text-warning' : 'text-text-secondary'}`}
|
||||
>
|
||||
{display}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ const FileAttachmentGroup = memo(({ attachments }: { attachments: TAttachment[]
|
|||
aria-label={buttonLabel}
|
||||
onClick={() => setIsExpanded((prev) => !prev)}
|
||||
className={cn(
|
||||
'inline-flex w-full max-w-full items-center gap-2 rounded-lg py-1 pr-2 text-sm',
|
||||
'inline-flex w-full max-w-full items-center gap-2 rounded-lg py-1 pe-2 text-sm',
|
||||
'text-text-secondary hover:text-text-primary transition-colors',
|
||||
'focus-visible:ring-focus-subtle focus-visible:ring-2 focus-visible:outline-hidden',
|
||||
)}
|
||||
|
|
@ -243,14 +243,14 @@ const FileAttachmentGroup = memo(({ attachments }: { attachments: TAttachment[]
|
|||
<FilesIcon className="size-4 shrink-0" aria-hidden="true" />
|
||||
<span className="shrink-0 font-medium">{fileCount}</span>
|
||||
{summary.length > 0 && (
|
||||
<span className="min-w-0 truncate text-left text-xs font-normal" title={summary}>
|
||||
<span className="min-w-0 truncate text-start text-xs font-normal" title={summary}>
|
||||
{'— '}
|
||||
{summary}
|
||||
</span>
|
||||
)}
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'ml-auto size-4 shrink-0 transition-transform duration-200 ease-out',
|
||||
'ms-auto size-4 shrink-0 transition-transform duration-200 ease-out',
|
||||
isExpanded && 'rotate-180',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export default function BackgroundTaskCall({
|
|||
<ul
|
||||
tabIndex={0}
|
||||
aria-label={localize('com_ui_background_tasks')}
|
||||
className="focus-visible:ring-focus-subtle flex max-h-96 flex-col gap-2 overflow-y-auto pr-1 focus-visible:ring-2 focus-visible:outline-none"
|
||||
className="focus-visible:ring-focus-subtle flex max-h-96 flex-col gap-2 overflow-y-auto pe-1 focus-visible:ring-2 focus-visible:outline-none"
|
||||
>
|
||||
{display.tasks.map((task) => (
|
||||
<li key={task.taskId}>
|
||||
|
|
|
|||
|
|
@ -245,7 +245,10 @@ export default function BashCall({
|
|||
isCopied={isCopied}
|
||||
onClick={handleCopy}
|
||||
disabled={contentPending}
|
||||
className={cn('bg-surface-code absolute top-1 right-1.5 z-[1]', PANE_COPY_REVEAL)}
|
||||
className={cn(
|
||||
'bg-surface-code absolute inset-e-1.5 top-1 z-[1]',
|
||||
PANE_COPY_REVEAL,
|
||||
)}
|
||||
label={localize('com_ui_copy_code')}
|
||||
/>
|
||||
<div
|
||||
|
|
@ -253,7 +256,10 @@ export default function BashCall({
|
|||
onScroll={onCommandPaneScroll}
|
||||
className="max-h-[18.75rem] overflow-auto"
|
||||
>
|
||||
<pre className="px-3 py-2.5 font-mono text-xs break-words whitespace-pre-wrap">
|
||||
<pre
|
||||
dir="ltr"
|
||||
className="px-3 py-2.5 font-mono text-xs break-words whitespace-pre-wrap"
|
||||
>
|
||||
<span className="text-text-tertiary select-none" aria-hidden="true">
|
||||
{'$ '}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default function CodeWindowHeader({ language, code, diffStats }: CodeWind
|
|||
|
||||
return (
|
||||
<div className="text-text-secondary flex items-center justify-between px-1.5 py-1.5 font-sans text-xs">
|
||||
<span className="flex items-center gap-1.5 pl-1.5 text-xs font-medium">
|
||||
<span className="flex items-center gap-1.5 ps-1.5 text-xs font-medium">
|
||||
<LangIcon lang={language} className="size-3.5 shrink-0" />
|
||||
{language}
|
||||
{diffStats && (
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const DiffRow = memo(function DiffRow({ type, text, num, hasLineNumbers }: DiffR
|
|||
)}
|
||||
>
|
||||
{hasLineNumbers && (
|
||||
<span className="text-text-tertiary text-2xs w-9 shrink-0 pr-1 text-right select-none">
|
||||
<span className="text-text-tertiary text-2xs w-9 shrink-0 pe-1 text-end select-none">
|
||||
{num ?? ''}
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -199,7 +199,7 @@ const DiffRow = memo(function DiffRow({ type, text, num, hasLineNumbers }: DiffR
|
|||
>
|
||||
{LINE_MARKERS[type]}
|
||||
</span>
|
||||
<span className="text-text-primary min-w-0 flex-1 pr-3 break-words whitespace-pre-wrap">
|
||||
<span className="text-text-primary min-w-0 flex-1 pe-3 break-words whitespace-pre-wrap">
|
||||
{text || ' '}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -216,6 +216,7 @@ export default function DiffView({ parsed }: { parsed: ParsedDiff }) {
|
|||
return (
|
||||
<div
|
||||
data-testid="diff-view"
|
||||
dir="ltr"
|
||||
className="bg-surface-code max-h-[300px] overflow-y-auto py-2 font-mono text-xs leading-5"
|
||||
>
|
||||
{lines.map((line, index) => {
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ export default function ExecuteCode({
|
|||
{code && <CodeWindowHeader language={lang} code={code} />}
|
||||
{code && (
|
||||
<pre
|
||||
dir="ltr"
|
||||
ref={codePaneRef}
|
||||
onScroll={onCodePaneScroll}
|
||||
className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ export default function FileAuthoringCall({
|
|||
<DiffView parsed={parsedDiff} />
|
||||
) : (
|
||||
<pre
|
||||
dir="ltr"
|
||||
ref={previewPaneRef}
|
||||
onScroll={onPreviewPaneScroll}
|
||||
className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
|
||||
|
|
@ -267,6 +268,7 @@ export default function FileAuthoringCall({
|
|||
)}
|
||||
{showOutputSection && (
|
||||
<pre
|
||||
dir="ltr"
|
||||
className={cn(
|
||||
'border-border-inset max-h-[18.75rem] overflow-auto border-t px-3 py-2 font-mono text-xs break-words whitespace-pre-wrap',
|
||||
phase === 'failed' ? 'text-status-error' : 'text-text-secondary',
|
||||
|
|
|
|||
|
|
@ -226,7 +226,10 @@ const LogContent: React.FC<LogContentProps> = ({ output = '', renderImages, atta
|
|||
)}
|
||||
</div>
|
||||
)}
|
||||
<pre className="text-text-primary max-h-80 overflow-auto font-mono text-xs leading-5 break-words whitespace-pre-wrap">
|
||||
<pre
|
||||
dir="ltr"
|
||||
className="text-text-primary max-h-80 overflow-auto font-mono text-xs leading-5 break-words whitespace-pre-wrap"
|
||||
>
|
||||
{file.text}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ export default function PtcToolTrace({
|
|||
<ol
|
||||
ref={listRef}
|
||||
onScroll={onScroll}
|
||||
dir="ltr"
|
||||
className="max-h-[200px] overflow-auto font-mono"
|
||||
aria-live="polite"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -158,7 +158,10 @@ export default function ReadFileCall({
|
|||
)}
|
||||
>
|
||||
<CodeWindowHeader language={fileName} code={output} />
|
||||
<pre className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs">
|
||||
<pre
|
||||
dir="ltr"
|
||||
className="bg-surface-code-body max-h-[18.75rem] overflow-auto p-4 font-mono text-xs"
|
||||
>
|
||||
<code className={`hljs language-${lang} !whitespace-pre`}>
|
||||
{highlighted ?? output}
|
||||
</code>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export default function Stdout({ output = '' }: StdoutProps) {
|
|||
}
|
||||
|
||||
return (
|
||||
<pre className="shrink-0 whitespace-pre-wrap break-words font-mono text-text-primary">
|
||||
<pre dir="ltr" className="text-text-primary shrink-0 font-mono break-words whitespace-pre-wrap">
|
||||
{processedContent}
|
||||
</pre>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,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-user-message px-theme-normal flex max-w-full flex-col items-start gap-2 py-2.5">
|
||||
<div className="rounded-theme-surface rounded-ee-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">
|
||||
|
|
@ -134,7 +134,7 @@ const SteerPart = memo(function SteerPart({
|
|||
/>
|
||||
))}
|
||||
{imageFiles.length > 0 && (
|
||||
<div className="ml-auto flex max-w-full flex-wrap justify-end gap-2">
|
||||
<div className="ms-auto flex max-w-full flex-wrap justify-end gap-2">
|
||||
{imageFiles.map((file) => (
|
||||
<Image
|
||||
key={file.file_id}
|
||||
|
|
@ -165,7 +165,7 @@ const SteerPart = memo(function SteerPart({
|
|||
* park them wherever the hover-revealed time happens to end, and that
|
||||
* width changes as the relative string ticks. */}
|
||||
<div className="text-text-secondary mt-1 flex min-h-8 items-center justify-end gap-2">
|
||||
<MessageTimestamp value={timestamp} className="ml-0" />
|
||||
<MessageTimestamp value={timestamp} className="ms-0" />
|
||||
<SteerReceipt state={receiptState} live={isSubmitting} animateIn={animateIn} />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import { resolveSubagentAgentId } from '~/components/Chat/Subagents/identity';
|
|||
import { subagentStatusLabelKey } from '~/components/Chat/Subagents/status';
|
||||
import { useOpenSubagentPanel } from '~/components/Chat/Subagents/surface';
|
||||
import { getSubagentPrompt } from '~/components/Chat/Subagents/prompt';
|
||||
import { tailOverflowDirection } from '~/utils/subagentContent';
|
||||
import { MessageContext } from '~/Providers/MessageContext';
|
||||
import { useShareContext } from '~/Providers/ShareContext';
|
||||
import MessageIcon from '~/components/Share/MessageIcon';
|
||||
|
|
@ -435,7 +436,7 @@ export default function SubagentCall({
|
|||
data-subagent-parent-message={parentMessageId}
|
||||
data-subagent-part-index={partIndex}
|
||||
className={cn(
|
||||
'border-border-light bg-surface-secondary my-2 flex w-full flex-col gap-1 rounded-lg border px-3 py-2 text-left transition',
|
||||
'border-border-light bg-surface-secondary my-2 flex w-full flex-col gap-1 rounded-lg border px-3 py-2 text-start transition',
|
||||
canOpenDetails ? 'group' : 'cursor-default opacity-80',
|
||||
running && !detachedStatusUnknown && 'animate-pulse-slow',
|
||||
)}
|
||||
|
|
@ -509,13 +510,13 @@ export default function SubagentCall({
|
|||
{canOpenDetails && (
|
||||
<ChevronRight
|
||||
size={14}
|
||||
className="text-text-secondary shrink-0 transition group-hover:translate-x-0.5"
|
||||
className="text-text-secondary shrink-0 transition group-hover:translate-x-0.5 rtl:-scale-x-100 rtl:group-hover:-translate-x-0.5"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ul className="text-text-secondary w-full space-y-0.5 pl-5 font-mono text-xs">
|
||||
<ul className="text-text-secondary w-full space-y-0.5 ps-5 font-mono text-xs">
|
||||
{displayedTickerLines.length === 0 && running ? (
|
||||
<li className="truncate opacity-70">{localize('com_ui_subagent_waiting')}</li>
|
||||
) : null}
|
||||
|
|
@ -630,28 +631,36 @@ function ToolIdentifier({
|
|||
/**
|
||||
* Renderer for one ticker line. Writing is the default visible activity, so
|
||||
* it renders without a redundant prefix. Reasoning retains its semantic label.
|
||||
* Streaming bodies use `dir="rtl"` + `text-align: left` to push tail-side
|
||||
* ellipsis behavior (newest characters stay flush-right, oldest clip off the
|
||||
* left). The rtl trick is scoped to the body span so trailing punctuation on
|
||||
* non-streaming lines can't get flipped by bidi.
|
||||
* Streaming bodies run the outer box opposite to the text direction so the
|
||||
* oldest characters clip and the newest stay visible; `text-end` of that box is
|
||||
* the text's own start, so a line that fits stays where it reads from. The text
|
||||
* sits in an isolated `dir="auto"` span so its punctuation is never reordered.
|
||||
*
|
||||
* Tool lines (`using_tool`, `tool_complete`) go through `ToolIdentifier`
|
||||
* so MCP-hosted tools render as `<server> · <tool>` badges and native
|
||||
* tools use their friendly names — matching the delimiter-aware
|
||||
* rendering the main tool UI already uses.
|
||||
*/
|
||||
function TailText({ text }: { text: string }): JSX.Element {
|
||||
return (
|
||||
<span
|
||||
dir={tailOverflowDirection(text)}
|
||||
className="min-w-0 flex-1 overflow-hidden text-end text-ellipsis whitespace-nowrap"
|
||||
>
|
||||
<bdi dir="auto" className="[unicode-bidi:isolate]">
|
||||
{text}
|
||||
</bdi>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
|
||||
const localize = useLocalize();
|
||||
const mcpServerNames = useMCPServerNames();
|
||||
if (line.kind === 'writing') {
|
||||
return (
|
||||
<li className="text-text-primary flex w-full items-baseline overflow-hidden">
|
||||
<span
|
||||
dir="rtl"
|
||||
className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
|
||||
>
|
||||
{line.body}
|
||||
</span>
|
||||
<TailText text={line.body} />
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
|
@ -659,12 +668,7 @@ function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
|
|||
return (
|
||||
<li className="text-text-primary flex w-full items-baseline gap-1 overflow-hidden">
|
||||
<span className="shrink-0">{localize('com_ui_subagent_ticker_reasoning')}:</span>
|
||||
<span
|
||||
dir="rtl"
|
||||
className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
|
||||
>
|
||||
{line.body}
|
||||
</span>
|
||||
<TailText text={line.body} />
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
|
@ -696,12 +700,7 @@ function TickerLineView({ line }: { line: SubagentTickerLine }): JSX.Element {
|
|||
mcpServerNames={mcpServerNames}
|
||||
/>
|
||||
<span className="text-text-tertiary shrink-0">→</span>
|
||||
<span
|
||||
dir="rtl"
|
||||
className="min-w-0 flex-1 overflow-hidden text-left text-ellipsis whitespace-nowrap"
|
||||
>
|
||||
{line.outputSnippet ?? localize('com_ui_subagent_ticker_tool_done')}
|
||||
</span>
|
||||
<TailText text={line.outputSnippet ?? localize('com_ui_subagent_ticker_tool_done')} />
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,9 +149,9 @@ export const ThinkingButton = memo(
|
|||
* row in the same list as tool calls, grouped thoughts and phase
|
||||
* summaries, all set at that scale. Sized to the body it read as a
|
||||
* second, larger kind of row beside them. */
|
||||
className="group/button tool-status-text flex flex-1 items-center justify-start rounded-lg pr-10"
|
||||
className="group/button tool-status-text flex flex-1 items-center justify-start rounded-lg pe-10"
|
||||
>
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'relative mr-2')}>
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'relative me-2')}>
|
||||
<Lightbulb
|
||||
className="icon-sm text-text-secondary absolute opacity-100 transition-opacity group-hover/button:opacity-0"
|
||||
aria-hidden="true"
|
||||
|
|
@ -186,7 +186,7 @@ export const ThinkingButton = memo(
|
|||
<span
|
||||
key={animateLabel ? label : undefined}
|
||||
className={cn(
|
||||
'min-w-0 truncate text-left font-medium',
|
||||
'min-w-0 truncate text-start font-medium',
|
||||
shimmerLabel && !animateLabel && 'shimmer',
|
||||
animateLabel &&
|
||||
'animate-in fade-in-0 slide-in-from-bottom-1 duration-300 ease-out motion-reduce:animate-none',
|
||||
|
|
@ -207,7 +207,7 @@ export const ThinkingButton = memo(
|
|||
label={localize('com_ui_copy_thoughts_to_clipboard')}
|
||||
copiedLabel={localize('com_ui_copied_to_clipboard')}
|
||||
className={cn(
|
||||
'absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity',
|
||||
'absolute inset-e-0 top-1/2 -translate-y-1/2 opacity-0 transition-opacity',
|
||||
'group-focus-within/thinking-container:opacity-100 group-hover/thinking-container:opacity-100',
|
||||
'focus-visible:opacity-100',
|
||||
)}
|
||||
|
|
@ -228,10 +228,10 @@ export const ThinkingLabel = memo(({ label, title }: { label: string; title?: st
|
|||
return (
|
||||
<div className="mb-2 pt-2 pb-2">
|
||||
<div className="tool-status-text flex w-full items-center justify-start" title={title}>
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'relative mr-2')}>
|
||||
<span className={cn(ROW_GLYPH_SLOT, 'relative me-2')}>
|
||||
<Lightbulb className="icon-sm text-text-secondary" aria-hidden="true" />
|
||||
</span>
|
||||
<span className="text-text-secondary min-w-0 truncate text-left font-medium">{label}</span>
|
||||
<span className="text-text-secondary min-w-0 truncate text-start font-medium">{label}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -276,7 +276,7 @@ export const FloatingThinkingBar = memo(
|
|||
className={cn(
|
||||
/* Laid over the text rather than reserved below it, so the box keeps
|
||||
even padding; the fill keeps the controls legible over a line. */
|
||||
'bg-surface-secondary absolute right-3 bottom-3 flex items-center gap-2 rounded-lg transition-opacity duration-150',
|
||||
'bg-surface-secondary absolute inset-e-3 bottom-3 flex items-center gap-2 rounded-lg transition-opacity duration-150',
|
||||
isVisible ? 'opacity-100' : 'pointer-events-none opacity-0',
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ describe('PendingSteers', () => {
|
|||
const cancel = screen.getByRole('button', { name: 'com_ui_cancel' });
|
||||
expect(cancel).toBeEnabled();
|
||||
expect(cancel.parentElement).toHaveClass('flex-wrap', 'justify-end');
|
||||
expect(cancel.parentElement).not.toHaveClass('pl-9');
|
||||
expect(cancel.parentElement).not.toHaveClass('ps-9');
|
||||
});
|
||||
|
||||
it('aligns failed-steer recovery actions with the bubble and allows wrapping', () => {
|
||||
|
|
@ -180,7 +180,7 @@ describe('PendingSteers', () => {
|
|||
|
||||
const retry = screen.getByRole('button', { name: 'com_ui_retry' });
|
||||
expect(retry.parentElement).toHaveClass('flex-wrap', 'justify-end');
|
||||
expect(retry.parentElement).not.toHaveClass('pl-9');
|
||||
expect(retry.parentElement).not.toHaveClass('ps-9');
|
||||
});
|
||||
|
||||
it.each(['sending', 'pending', 'failed'] as const)(
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ describe('SteerPart presentation', () => {
|
|||
|
||||
expect(images).toHaveLength(2);
|
||||
expect(imageGroup).toContainElement(images[1]);
|
||||
expect(imageGroup).toHaveClass('ml-auto', 'flex-wrap', 'justify-end');
|
||||
expect(imageGroup).toHaveClass('ms-auto', 'flex-wrap', 'justify-end');
|
||||
expect(imageGroup?.parentElement).toHaveClass('w-full');
|
||||
expect(imageGroup).not.toContainElement(screen.getByTestId('steer-file'));
|
||||
expect(screen.getByTestId('steer-file')).toHaveTextContent('notes.pdf');
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ function FileHeader({
|
|||
<button
|
||||
type="button"
|
||||
onClick={onOpenPreview}
|
||||
className="text-text-primary decoration-border-medium hover:text-text-secondary focus-visible:ring-focus-subtle min-w-0 truncate text-left text-xs font-medium underline underline-offset-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-hidden"
|
||||
className="text-text-primary decoration-border-medium hover:text-text-secondary focus-visible:ring-focus-subtle min-w-0 truncate text-start text-xs font-medium underline underline-offset-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-hidden"
|
||||
aria-label={`${localize('com_ui_preview')}: ${fileName}`}
|
||||
>
|
||||
{fileName}
|
||||
|
|
|
|||
|
|
@ -401,13 +401,13 @@ export default function ToolApproval({
|
|||
</Button>
|
||||
{status === 'expired' && (
|
||||
<span className="text-text-warning flex items-center text-xs">
|
||||
<TriangleAlert className="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
<TriangleAlert className="me-1.5 h-4 w-4" aria-hidden="true" />
|
||||
{localize('com_ui_approval_expired')}
|
||||
</span>
|
||||
)}
|
||||
{status === 'error' && (
|
||||
<span className="text-text-warning flex items-center text-xs">
|
||||
<TriangleAlert className="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
<TriangleAlert className="me-1.5 h-4 w-4" aria-hidden="true" />
|
||||
{localize('com_ui_approval_error')}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -78,13 +78,17 @@ function InputRenderer({ input }: { input: string }) {
|
|||
}
|
||||
// Valid JSON but not a plain object (array, string, number, boolean) — render formatted
|
||||
return (
|
||||
<pre className="text-text-primary text-xs whitespace-pre-wrap">
|
||||
<pre dir="ltr" className="text-text-primary text-xs whitespace-pre-wrap">
|
||||
{typeof parsed === 'string' ? parsed : JSON.stringify(parsed, null, 2)}
|
||||
</pre>
|
||||
);
|
||||
} catch {
|
||||
// Not JSON — render as plain text
|
||||
return <pre className="text-text-primary text-xs whitespace-pre-wrap">{input}</pre>;
|
||||
return (
|
||||
<pre dir="ltr" className="text-text-primary text-xs whitespace-pre-wrap">
|
||||
{input}
|
||||
</pre>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default function ToolCallLimitNotice({ message }: { message: TMessage })
|
|||
variant="quiet"
|
||||
size="icon-xs"
|
||||
aria-label={localize('com_ui_tool_call_limit_dismiss')}
|
||||
className="absolute top-1.5 right-1.5 focus-visible:ring-offset-0 focus-visible:ring-inset"
|
||||
className="absolute inset-e-1.5 top-1.5 focus-visible:ring-offset-0 focus-visible:ring-inset"
|
||||
onClick={() => setDismissed(true)}
|
||||
>
|
||||
<X className="h-4 w-4" aria-hidden="true" />
|
||||
|
|
@ -94,7 +94,7 @@ export default function ToolCallLimitNotice({ message }: { message: TMessage })
|
|||
/>
|
||||
<p
|
||||
id={titleId}
|
||||
className="text-text-primary flex min-w-0 items-center gap-2 pr-8 text-sm font-medium"
|
||||
className="text-text-primary flex min-w-0 items-center gap-2 pe-8 text-sm font-medium"
|
||||
>
|
||||
<Gauge className="text-text-secondary h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
{localize('com_ui_tool_call_limit_title')}
|
||||
|
|
|
|||
|
|
@ -179,13 +179,14 @@ export default function OutputRenderer({
|
|||
<div>
|
||||
<div className="group/copy relative">
|
||||
{isJson ? (
|
||||
<pre className="max-h-[18.75rem] overflow-auto rounded text-xs">
|
||||
<pre dir="ltr" className="max-h-[18.75rem] overflow-auto rounded text-xs">
|
||||
<code className="hljs language-json !break-words !whitespace-pre-wrap">
|
||||
{displayText}
|
||||
</code>
|
||||
</pre>
|
||||
) : (
|
||||
<pre
|
||||
dir="ltr"
|
||||
ref={outputRef}
|
||||
onScroll={terminal ? handleOutputScroll : undefined}
|
||||
className={cn(
|
||||
|
|
@ -213,7 +214,7 @@ export default function OutputRenderer({
|
|||
disabled={contentPending}
|
||||
iconOnly
|
||||
label={localize('com_ui_copy')}
|
||||
className={cn('bg-presentation absolute right-0 bottom-0 z-[1]', PANE_COPY_REVEAL)}
|
||||
className={cn('bg-presentation absolute inset-e-0 bottom-0 z-[1]', PANE_COPY_REVEAL)}
|
||||
/>
|
||||
</div>
|
||||
{error && rawError && rawError !== displayText && (
|
||||
|
|
@ -227,7 +228,10 @@ export default function OutputRenderer({
|
|||
</Button>
|
||||
)}
|
||||
{showErrorDetails && rawError && (
|
||||
<pre className="text-status-error mt-2 max-h-[12.5rem] overflow-auto font-mono text-xs break-words whitespace-pre-wrap">
|
||||
<pre
|
||||
dir="ltr"
|
||||
className="text-status-error mt-2 max-h-[12.5rem] overflow-auto font-mono text-xs break-words whitespace-pre-wrap"
|
||||
>
|
||||
{rawError}
|
||||
</pre>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export default function StackedToolIcons({
|
|||
className={cn(
|
||||
'border-border-medium bg-surface-secondary relative flex items-center justify-center rounded-full border',
|
||||
'h-[1.375rem] w-[1.375rem]',
|
||||
index > 0 && '-ml-2.5',
|
||||
index > 0 && '-ms-2.5',
|
||||
)}
|
||||
style={{ zIndex: visibleIcons.length - index }}
|
||||
>
|
||||
|
|
@ -106,7 +106,7 @@ export default function StackedToolIcons({
|
|||
<div
|
||||
className={cn(
|
||||
'border-border-medium bg-surface-tertiary relative flex items-center justify-center rounded-full border',
|
||||
'text-text-secondary -ml-2.5 h-[1.375rem] w-[1.375rem] text-xs font-medium',
|
||||
'text-text-secondary -ms-2.5 h-[1.375rem] w-[1.375rem] text-xs font-medium',
|
||||
)}
|
||||
style={{ zIndex: 0 }}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ describe('OutputRenderer', () => {
|
|||
render(<OutputRenderer text={'First line\nSecond line'} />);
|
||||
|
||||
const copyButton = screen.getByTestId('copy-output');
|
||||
expect(copyButton).toHaveClass('absolute', 'right-0', 'bottom-0');
|
||||
expect(copyButton).toHaveClass('absolute', 'inset-e-0', 'bottom-0');
|
||||
expect(copyButton).toHaveClass('no-touch:group-hover/copy:opacity-100');
|
||||
expect(copyButton.parentElement).toHaveClass('group/copy', 'relative');
|
||||
expect(copyButton.parentElement).not.toHaveClass('pr-10');
|
||||
expect(copyButton.parentElement).not.toHaveClass('pe-10');
|
||||
});
|
||||
|
||||
it('copies original bytes when a code result has been formatted for display', () => {
|
||||
|
|
|
|||
|
|
@ -26,9 +26,14 @@ const UIResourceCarousel: React.FC<UIResourceCarouselProps> = React.memo(({ uiRe
|
|||
const handleScroll = React.useCallback(() => {
|
||||
if (!scrollContainerRef.current) return;
|
||||
|
||||
const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current;
|
||||
setShowLeftArrow(scrollLeft > 0);
|
||||
setShowRightArrow(scrollLeft < scrollWidth - clientWidth - 10);
|
||||
const container = scrollContainerRef.current;
|
||||
const { scrollLeft, scrollWidth, clientWidth } = container;
|
||||
/** In RTL `scrollLeft` is 0 at the right edge and negative toward the left; normalize to the offset from the left edge. */
|
||||
const maxScroll = scrollWidth - clientWidth;
|
||||
const fromLeft =
|
||||
getComputedStyle(container).direction === 'rtl' ? maxScroll + scrollLeft : scrollLeft;
|
||||
setShowLeftArrow(fromLeft > 0);
|
||||
setShowRightArrow(fromLeft < maxScroll - 10);
|
||||
}, []);
|
||||
|
||||
const scroll = React.useCallback((direction: 'left' | 'right') => {
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ function WakeupTaskCard({
|
|||
data-subagent-tool-call={selection.toolCallId}
|
||||
data-subagent-parent-message={selection.parentMessageId}
|
||||
data-subagent-part-index={selection.partIndex}
|
||||
className="ml-auto h-6 shrink-0 px-2 text-xs"
|
||||
className="ms-auto h-6 shrink-0 px-2 text-xs"
|
||||
>
|
||||
{localize('com_ui_wakeup_view_activity')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
{hasResult && (
|
||||
<div className="markdown prose prose-sm message-content light text-text-primary mt-2 max-h-96 w-full max-w-none overflow-y-auto pr-1 break-words">
|
||||
<div className="markdown prose prose-sm message-content light text-text-primary mt-2 max-h-96 w-full max-w-none overflow-y-auto pe-1 break-words">
|
||||
<MarkdownLite content={task.result} codeExecution={false} />
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -203,7 +203,7 @@ const Wakeup = memo(function Wakeup({
|
|||
)}
|
||||
{display.tasks.map((task) =>
|
||||
display.kind === 'background_tool' ? (
|
||||
<div key={task.taskId} className="my-2 pl-7">
|
||||
<div key={task.taskId} className="my-2 ps-7">
|
||||
<BackgroundTaskCard
|
||||
task={{
|
||||
taskId: task.taskId,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function SourceFaviconStack({ sources }: { sources: ValidSource[] }) {
|
|||
className={cn(
|
||||
'border-border-medium bg-surface-secondary relative flex items-center justify-center rounded-full border',
|
||||
'h-[1.375rem] w-[1.375rem]',
|
||||
i > 0 && '-ml-2.5',
|
||||
i > 0 && '-ms-2.5',
|
||||
)}
|
||||
style={{ zIndex: MAX_VISIBLE_FAVICONS - i }}
|
||||
>
|
||||
|
|
@ -295,7 +295,7 @@ export default function WebSearch({
|
|||
variant="quiet"
|
||||
size="icon"
|
||||
className={cn(
|
||||
'ml-auto size-auto cursor-help rounded-md p-1 opacity-0',
|
||||
'ms-auto size-auto cursor-help rounded-md p-1 opacity-0',
|
||||
'group-focus-within/websearch:opacity-100 group-hover/websearch:opacity-100',
|
||||
'focus-visible:opacity-100',
|
||||
)}
|
||||
|
|
@ -384,7 +384,7 @@ export default function WebSearch({
|
|||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="shrink-0 text-right">
|
||||
<span className="shrink-0 text-end">
|
||||
<span className="text-text-secondary text-2xs block">{domain}</span>
|
||||
{source.date && (
|
||||
<span className="text-text-secondary text-3xs block">
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ describe('ActivityPhaseGroup', () => {
|
|||
for (const token of ROW_GLYPH_SLOT.split(' ')) {
|
||||
expect(trigger.firstElementChild).toHaveClass(token);
|
||||
}
|
||||
expect(screen.getByText(LABEL).parentElement).toHaveClass('flex-1', 'text-left');
|
||||
expect(screen.getByText(LABEL).parentElement).toHaveClass('flex-1', 'text-start');
|
||||
});
|
||||
|
||||
test.each([
|
||||
|
|
@ -378,7 +378,7 @@ describe('ActivityPhaseGroup', () => {
|
|||
);
|
||||
|
||||
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
||||
expect(screen.getByText(LABEL)).toHaveClass('text-left');
|
||||
expect(screen.getByText(LABEL)).toHaveClass('text-start');
|
||||
expect(pendingFrames()).toBe(0);
|
||||
});
|
||||
|
||||
|
|
@ -723,7 +723,7 @@ describe('ActivityPhaseGroup open header', () => {
|
|||
fireEvent.click(header);
|
||||
expect(pinned).toHaveClass('sticky', 'top-0', 'bg-surface-primary-alt');
|
||||
expect(pinned).not.toHaveClass('bg-presentation');
|
||||
expect(screen.getByTestId('activity-phase-panel').firstElementChild).toHaveClass('pl-6');
|
||||
expect(screen.getByTestId('activity-phase-panel').firstElementChild).toHaveClass('ps-6');
|
||||
});
|
||||
|
||||
test('collapses from its rail, showing the knob on its header while the rail is hovered', () => {
|
||||
|
|
|
|||
|
|
@ -117,10 +117,10 @@ describe('Image', () => {
|
|||
it('aligns only explicitly marked images to the right', () => {
|
||||
const { rerender } = render(<Image {...defaultProps} />);
|
||||
const wrapper = screen.getByRole('button').parentElement;
|
||||
expect(wrapper).not.toHaveClass('ml-auto');
|
||||
expect(wrapper).not.toHaveClass('ms-auto');
|
||||
|
||||
rerender(<Image {...defaultProps} alignRight />);
|
||||
expect(wrapper).toHaveClass('ml-auto');
|
||||
expect(wrapper).toHaveClass('ms-auto');
|
||||
});
|
||||
|
||||
it('applies custom className to the button wrapper', () => {
|
||||
|
|
|
|||
|
|
@ -1916,7 +1916,7 @@ describe('ToolCallGroup failure fast path', () => {
|
|||
expect(header).not.toHaveClass('text-text-primary');
|
||||
fireEvent.click(header);
|
||||
expect(header).toHaveClass('text-text-primary');
|
||||
expect(screen.getByTestId('tool-call-group-panel').firstElementChild).toHaveClass('pl-6');
|
||||
expect(screen.getByTestId('tool-call-group-panel').firstElementChild).toHaveClass('ps-6');
|
||||
});
|
||||
|
||||
it('collapses from its rail, showing the knob on its header while the rail is hovered', () => {
|
||||
|
|
|
|||
|
|
@ -238,6 +238,28 @@ describe('UIResourceCarousel', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('normalizes negative scrollLeft in RTL', async () => {
|
||||
const { container } = render(<UIResourceCarousel uiResources={mockUIResources} />);
|
||||
const scrollContainer = container.querySelector<HTMLElement>('.hide-scrollbar');
|
||||
|
||||
scrollContainer!.style.direction = 'rtl';
|
||||
// RTL at its start edge: scrollLeft 0 is the physical right end
|
||||
Object.defineProperty(scrollContainer, 'scrollLeft', { configurable: true, value: 0 });
|
||||
Object.defineProperty(scrollContainer, 'scrollWidth', { configurable: true, value: 1000 });
|
||||
fireEvent.scroll(scrollContainer!);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByLabelText('Scroll left')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// RTL scrolled to the physical left end: scrollLeft is -(scrollWidth - clientWidth)
|
||||
Object.defineProperty(scrollContainer, 'scrollLeft', { configurable: true, value: -500 });
|
||||
fireEvent.scroll(scrollContainer!);
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByLabelText('Scroll left')).not.toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Scroll right')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles UIResource actions using handleUIAction', async () => {
|
||||
render(<UIResourceCarousel uiResources={mockUIResources.slice(0, 1)} />);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ export function ToolAuthWarning({ className }: { className?: string }) {
|
|||
}
|
||||
|
||||
return (
|
||||
<p className={cn('flex items-center text-xs text-text-warning', className)}>
|
||||
<TriangleAlert className="mr-1.5 inline-block h-4 w-4" aria-hidden="true" />
|
||||
<p className={cn('text-text-warning flex items-center text-xs', className)}>
|
||||
<TriangleAlert className="me-1.5 inline-block h-4 w-4" aria-hidden="true" />
|
||||
{localize('com_assistants_allow_sites_you_trust')}
|
||||
</p>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export function PreviewedToolCallPart({
|
|||
{children(effectivePart)}
|
||||
</ToolContentPendingContext.Provider>
|
||||
{requested && full == null && query.isError && (
|
||||
<div role="alert" className="text-text-warning mb-2 flex items-center gap-2 pl-1 text-xs">
|
||||
<div role="alert" className="text-text-warning mb-2 flex items-center gap-2 ps-1 text-xs">
|
||||
<span>{localize('com_ui_tool_content_error')}</span>
|
||||
<button
|
||||
type="button"
|
||||
|
|
@ -114,7 +114,7 @@ export function PreviewedToolCallPart({
|
|||
<div
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
className="text-text-secondary mb-2 flex items-center gap-1.5 pl-1 text-xs"
|
||||
className="text-text-secondary mb-2 flex items-center gap-1.5 ps-1 text-xs"
|
||||
>
|
||||
<Spinner className="size-3" aria-hidden="true" />
|
||||
<span>{localize('com_ui_tool_content_loading')}</span>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,22 @@ import rehypeHighlight from 'rehype-highlight';
|
|||
import remarkDirective from 'remark-directive';
|
||||
import type { PluggableList } from 'unified';
|
||||
import type { ElementType } from 'react';
|
||||
import {
|
||||
code,
|
||||
a,
|
||||
p,
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
} from './MarkdownComponents';
|
||||
import {
|
||||
mcpUIResourcePlugin,
|
||||
MCPUIResource,
|
||||
|
|
@ -15,7 +31,6 @@ import {
|
|||
import { Citation, CompositeCitation, HighlightedText } from '~/components/Web/Citation';
|
||||
import { langSubset, remarkApproxTilde, remarkSingleDollarMath } from '~/utils';
|
||||
import { Artifact, artifactPlugin } from '~/components/Artifacts/Artifact';
|
||||
import { code, a, p, img, table } from './MarkdownComponents';
|
||||
import { unicodeCitation } from '~/components/Web';
|
||||
|
||||
/**
|
||||
|
|
@ -59,6 +74,15 @@ export const getMarkdownComponents = (): { [nodeType: string]: ElementType } =>
|
|||
p,
|
||||
img,
|
||||
table,
|
||||
ul,
|
||||
ol,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
blockquote,
|
||||
artifact: Artifact,
|
||||
citation: Citation,
|
||||
'highlighted-text': HighlightedText,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export function RailGlyph({ hover, children }: { hover: RailHover; children: Rea
|
|||
<span className={cn('flex', hovered && 'invisible')}>{children}</span>
|
||||
{hovered && (
|
||||
<span
|
||||
className={cn(ROW_GLYPH_SLOT, 'text-text-primary absolute inset-y-0 left-0')}
|
||||
className={cn(ROW_GLYPH_SLOT, 'text-text-primary absolute inset-y-0 inset-s-0')}
|
||||
data-testid="fold-rail-knob"
|
||||
>
|
||||
<CircleMinus size={16} />
|
||||
|
|
@ -94,7 +94,7 @@ export function FoldRail({
|
|||
tabIndex={-1}
|
||||
aria-hidden="true"
|
||||
disabled={!expanded}
|
||||
className="group/rail absolute inset-y-0 left-0 w-6 cursor-pointer disabled:pointer-events-none"
|
||||
className="group/rail absolute inset-y-0 inset-s-0 w-6 cursor-pointer disabled:pointer-events-none"
|
||||
onMouseDown={(event) => event.preventDefault()}
|
||||
onMouseEnter={() => expanded && hover.set(true)}
|
||||
onMouseLeave={() => hover.set(false)}
|
||||
|
|
@ -105,11 +105,11 @@ export function FoldRail({
|
|||
data-testid="fold-rail"
|
||||
data-fold-rail=""
|
||||
>
|
||||
<span className="bg-border-medium group-hover/rail:bg-text-secondary absolute top-0.5 bottom-1.5 left-[11px] w-px transition-colors duration-150 motion-reduce:transition-none" />
|
||||
<span className="bg-border-medium group-hover/rail:bg-text-secondary absolute inset-s-[11px] top-0.5 bottom-1.5 w-px transition-colors duration-150 motion-reduce:transition-none" />
|
||||
{/* The lit path (`useFoldPath`): from the header down to the hovered row, turning
|
||||
into that row when it is this fold's own. */}
|
||||
<span
|
||||
className="border-text-secondary pointer-events-none absolute top-0.5 left-[11px] h-(--fold-lit) border-l opacity-0 transition-opacity duration-150 group-data-fold-lit/rail:opacity-100 group-data-[fold-lit=end]/rail:w-2 group-data-[fold-lit=end]/rail:rounded-bl-md group-data-[fold-lit=end]/rail:border-b motion-reduce:transition-none"
|
||||
className="border-text-secondary pointer-events-none absolute inset-s-[11px] top-0.5 h-(--fold-lit) border-s opacity-0 transition-opacity duration-150 group-data-fold-lit/rail:opacity-100 group-data-[fold-lit=end]/rail:w-2 group-data-[fold-lit=end]/rail:rounded-es-md group-data-[fold-lit=end]/rail:border-b motion-reduce:transition-none"
|
||||
data-testid="fold-rail-path"
|
||||
/>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
export const TOOL_ROW_CLASSES = 'relative my-1.5 flex h-5 shrink-0 items-center gap-2.5';
|
||||
|
||||
/** Leave an 8px gap beside MessageNav's hit area in full-width chat. */
|
||||
export const ARTIFACT_ROW_NAV_SPACING = 'pr-3 md:pr-17';
|
||||
export const ARTIFACT_ROW_NAV_SPACING = 'pe-3 md:pe-17';
|
||||
|
||||
/** Behavior hook for header glyphs, independent of their layout. */
|
||||
export const FOLD_GLYPH_CLASS = 'fold-glyph';
|
||||
|
|
@ -38,7 +38,7 @@ export const FOLD_GLYPH_SELECTOR = `.${FOLD_GLYPH_CLASS}`;
|
|||
* drawn 12px left of the row, show at all. The rail is absolutely positioned
|
||||
* in that inset, out of flow, so the height animation is untouched.
|
||||
*/
|
||||
export const FOLD_RAIL_CLASSES = 'relative pl-6';
|
||||
export const FOLD_RAIL_CLASSES = 'relative ps-6';
|
||||
|
||||
/**
|
||||
* A copy action laid over its pane (`group/copy`) instead of beside it, so it
|
||||
|
|
|
|||
|
|
@ -172,14 +172,14 @@ const CheckboxOption: React.FC<CheckboxOptionProps> = ({
|
|||
<Label
|
||||
htmlFor={id}
|
||||
variant="secondary"
|
||||
className="hover:text-text-primary ml-2 w-auto cursor-pointer text-sm break-normal select-none"
|
||||
className="hover:text-text-primary ms-2 w-auto cursor-pointer text-sm break-normal select-none"
|
||||
>
|
||||
{localize(labelKey)}
|
||||
</Label>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<Ariakit.HovercardDisclosure className="text-text-secondary focus:ring-text-primary ml-1 rounded-full focus:ring-2 focus:outline-hidden">
|
||||
<Ariakit.HovercardDisclosure className="text-text-secondary focus:ring-text-primary ms-1 rounded-full focus:ring-2 focus:outline-hidden">
|
||||
<VisuallyHidden>{localize(infoKey)}</VisuallyHidden>
|
||||
{chevronDown}
|
||||
</Ariakit.HovercardDisclosure>
|
||||
|
|
@ -366,7 +366,7 @@ function Fork({
|
|||
<div className="text-text-primary flex h-8 w-full items-center justify-center text-sm">
|
||||
{localize(activeSetting)}
|
||||
<Ariakit.HovercardProvider placement="right-start">
|
||||
<div className="ml-auto flex h-6 w-6 items-center justify-center gap-1">
|
||||
<div className="ms-auto flex h-6 w-6 items-center justify-center gap-1">
|
||||
<Ariakit.HovercardAnchor
|
||||
render={
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ const HoverButtons = ({
|
|||
isLast={isLast}
|
||||
disabled={!canCopy}
|
||||
className={cn(
|
||||
'ml-0 flex items-center gap-1.5 text-xs',
|
||||
'ms-0 flex items-center gap-1.5 text-xs',
|
||||
isSubmitting && isCreatedByUser ? 'no-touch:opacity-0 group-hover:opacity-100' : '',
|
||||
)}
|
||||
dataTestId={!isCreatedByUser ? 'copy-response-button' : undefined}
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ const MessageIndicator = memo(function MessageIndicator({
|
|||
<span
|
||||
className={cn(
|
||||
'block rounded-full',
|
||||
entry.isEnd === true || entry.isStart === true ? 'mr-[0.28125rem]' : '',
|
||||
entry.isEnd === true || entry.isStart === true ? 'me-[0.28125rem]' : '',
|
||||
tone,
|
||||
)}
|
||||
style={{ width: pxToRem(dims.baseW), height: pxToRem(dims.baseH) }}
|
||||
|
|
@ -359,7 +359,7 @@ const MessageIndicator = memo(function MessageIndicator({
|
|||
});
|
||||
|
||||
const chevronButtonClasses = cn(
|
||||
'-mr-1 rounded-md p-0.5 text-text-tertiary opacity-40 transition-[color,opacity] duration-300 high-contrast:opacity-50',
|
||||
'-me-1 rounded-md p-0.5 text-text-tertiary opacity-40 transition-[color,opacity] duration-300 high-contrast:opacity-50',
|
||||
'group-hover/nav:text-text-secondary group-hover/nav:opacity-100',
|
||||
'group-focus-within/nav:text-text-secondary group-focus-within/nav:opacity-100',
|
||||
'group-hover/nav:hover:text-text-primary',
|
||||
|
|
@ -435,9 +435,9 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
const tipShownRef = useRef(false);
|
||||
const tipTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const tipElRef = useRef<HTMLDivElement | null>(null);
|
||||
const tipPosRef = useRef({ top: 0, right: 0 });
|
||||
const tipPosRef = useRef({ top: 0, inlineEnd: 0 });
|
||||
|
||||
const [tip, setTip] = useState<{ id: string; top: number; right: number } | null>(null);
|
||||
const [tip, setTip] = useState<{ id: string; top: number; inlineEnd: number } | null>(null);
|
||||
const [hoveredId, setHoveredId] = useState<string | null>(null);
|
||||
/** The rib the keyboard last landed on. A roving tab stop has to travel with
|
||||
* focus, not sit on the scroll-spy's current rib: leave it behind and the
|
||||
|
|
@ -879,12 +879,19 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
};
|
||||
}, [entries, currentId, measureRibs]);
|
||||
|
||||
const positionTip = useCallback((top: number, right: number) => {
|
||||
tipPosRef.current = { top, right };
|
||||
/** Distance from the viewport edge the tooltip shares with the column: the right edge in LTR, the left in RTL. */
|
||||
const tipInlineEnd = useCallback((rect: { left: number; right: number }) => {
|
||||
const rtl =
|
||||
columnRef.current != null && getComputedStyle(columnRef.current).direction === 'rtl';
|
||||
return rtl ? rect.right + 8 : window.innerWidth - rect.left + 8;
|
||||
}, []);
|
||||
|
||||
const positionTip = useCallback((top: number, inlineEnd: number) => {
|
||||
tipPosRef.current = { top, inlineEnd };
|
||||
const el = tipElRef.current;
|
||||
if (el) {
|
||||
el.style.top = `${top}px`;
|
||||
el.style.right = `${right}px`;
|
||||
el.style.insetInlineEnd = `${inlineEnd}px`;
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
@ -894,7 +901,7 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
setTip(null);
|
||||
return;
|
||||
}
|
||||
setTip({ id, top: tipPosRef.current.top, right: tipPosRef.current.right });
|
||||
setTip({ id, top: tipPosRef.current.top, inlineEnd: tipPosRef.current.inlineEnd });
|
||||
},
|
||||
[entryById],
|
||||
);
|
||||
|
|
@ -915,8 +922,8 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
}, []);
|
||||
|
||||
const focusTooltip = useCallback(
|
||||
(id: string, top: number, right: number) => {
|
||||
positionTip(top, right);
|
||||
(id: string, top: number, inlineEnd: number) => {
|
||||
positionTip(top, inlineEnd);
|
||||
if (focusedIdRef.current === id) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -943,10 +950,10 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
const showTerminusTip = useCallback(
|
||||
(el: HTMLElement, id: string) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const left = columnRef.current?.getBoundingClientRect().left ?? rect.left;
|
||||
focusTooltip(id, rect.top + rect.height / 2, window.innerWidth - left + 8);
|
||||
const colRect = columnRef.current?.getBoundingClientRect() ?? rect;
|
||||
focusTooltip(id, rect.top + rect.height / 2, tipInlineEnd(colRect));
|
||||
},
|
||||
[focusTooltip],
|
||||
[focusTooltip, tipInlineEnd],
|
||||
);
|
||||
|
||||
const handleEndPointerEnter = useCallback(
|
||||
|
|
@ -1017,12 +1024,11 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
}
|
||||
if (nearestId != null && nearestD <= influence && !isDraggingRef.current) {
|
||||
const top = colRect.top - scrollTop + nearestCenter;
|
||||
const right = window.innerWidth - colRect.left + 8;
|
||||
focusTooltip(nearestId, top, right);
|
||||
focusTooltip(nearestId, top, tipInlineEnd(colRect));
|
||||
} else {
|
||||
clearTooltip();
|
||||
}
|
||||
}, [focusTooltip, clearTooltip, ensureRibLayout]);
|
||||
}, [focusTooltip, clearTooltip, ensureRibLayout, tipInlineEnd]);
|
||||
|
||||
/** Restores the resting dimensions rather than clearing them: the ribs carry
|
||||
* their base size inline, from the same `ribDimsFor` the magnifier reads, so
|
||||
|
|
@ -1613,7 +1619,7 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
aria-label={localize('com_ui_message_nav')}
|
||||
aria-keyshortcuts="Shift+Alt+M"
|
||||
className={cn(
|
||||
'group/nav absolute top-1/2 right-2 z-40 hidden max-h-[min(24rem,calc(100%-2rem))]',
|
||||
'group/nav absolute inset-e-2 top-1/2 z-40 hidden max-h-[min(24rem,calc(100%-2rem))]',
|
||||
'-translate-y-1/2 flex-col items-end gap-1.5 px-1.5 py-2 md:flex',
|
||||
)}
|
||||
>
|
||||
|
|
@ -1722,13 +1728,15 @@ function MessageNav({ scrollableRef }: { scrollableRef: React.RefObject<HTMLDivE
|
|||
<div
|
||||
ref={tipElRef}
|
||||
role="tooltip"
|
||||
style={{
|
||||
top: tip.top,
|
||||
right: tip.right,
|
||||
transform: 'translateY(-50%)',
|
||||
zIndex: 999,
|
||||
}}
|
||||
className="border-border-light bg-surface-secondary text-text-secondary pointer-events-none fixed max-w-[17.5rem] rounded-xl border px-3 py-2 shadow-lg"
|
||||
style={
|
||||
{
|
||||
top: tip.top,
|
||||
'--tip-inline-end': `${tip.inlineEnd}px`,
|
||||
transform: 'translateY(-50%)',
|
||||
zIndex: 999,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className="border-border-light bg-surface-secondary text-text-secondary pointer-events-none fixed inset-e-(--tip-inline-end) max-w-[17.5rem] rounded-xl border px-3 py-2 shadow-lg"
|
||||
>
|
||||
<p className="line-clamp-3 text-xs">{tipText}</p>
|
||||
</div>,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default function MinimalHoverButtons({ message, searchResults, variant }:
|
|||
? localize('com_ui_copied_to_clipboard')
|
||||
: localize('com_ui_copy_to_clipboard')
|
||||
}
|
||||
className={cn('ml-0 flex items-center gap-1.5 text-xs', revealOnRowHoverClasses)}
|
||||
className={cn('ms-0 flex items-center gap-1.5 text-xs', revealOnRowHoverClasses)}
|
||||
disabled={!canCopy}
|
||||
onClick={() => copyToClipboard(setIsCopied)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default function SiblingSwitch({
|
|||
aria-label={localize('com_ui_previous_sibling')}
|
||||
aria-disabled={siblingIdx == 0}
|
||||
>
|
||||
<ChevronLeft size="19" aria-hidden="true" />
|
||||
<ChevronLeft size="19" className="rtl:-scale-x-100" aria-hidden="true" />
|
||||
</Button>
|
||||
<span
|
||||
className="shrink-0 grow tabular-nums"
|
||||
|
|
@ -59,7 +59,9 @@ export default function SiblingSwitch({
|
|||
aria-atomic="true"
|
||||
role="status"
|
||||
>
|
||||
{siblingIdx + 1} / {siblingCount}
|
||||
<bdi>
|
||||
{siblingIdx + 1} / {siblingCount}
|
||||
</bdi>
|
||||
</span>
|
||||
<Button
|
||||
variant="message-action"
|
||||
|
|
@ -69,7 +71,7 @@ export default function SiblingSwitch({
|
|||
aria-label={localize('com_ui_next_sibling')}
|
||||
aria-disabled={siblingIdx == siblingCount - 1}
|
||||
>
|
||||
<ChevronRight size="19" aria-hidden="true" />
|
||||
<ChevronRight size="19" className="rtl:-scale-x-100" aria-hidden="true" />
|
||||
</Button>
|
||||
</nav>
|
||||
) : null;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ function renderAuthorHeader({
|
|||
return (
|
||||
<h2 className={authorHeaderClasses[align]}>
|
||||
{align === 'end' && (
|
||||
<MessageTimestamp value={timestamp} className="mr-auto shrink-0 font-normal" />
|
||||
<MessageTimestamp value={timestamp} className="me-auto shrink-0 font-normal" />
|
||||
)}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
|
|
@ -68,7 +68,7 @@ function renderAuthorHeader({
|
|||
<span className="sr-only">{headerPrefix}</span>
|
||||
<HeaderLabel label={label} hoverLabel={hoverLabel} />
|
||||
{align === 'start' && (
|
||||
<MessageTimestamp value={timestamp} className="ml-auto shrink-0 font-normal" />
|
||||
<MessageTimestamp value={timestamp} className="ms-auto shrink-0 font-normal" />
|
||||
)}
|
||||
</h2>
|
||||
);
|
||||
|
|
@ -133,12 +133,12 @@ export default function MessageRow({
|
|||
(hasParallelContent || isEditing) && 'w-full',
|
||||
!hasParallelContent &&
|
||||
isUserSide &&
|
||||
cn('ml-auto items-end', !isEditing && 'w-fit max-w-[90%] sm:max-w-[85%]'),
|
||||
cn('ms-auto items-end', !isEditing && 'w-fit max-w-[90%] sm:max-w-[85%]'),
|
||||
!hasParallelContent && !isUserSide && !isEditing && 'flex-1',
|
||||
)}
|
||||
>
|
||||
{isSystem && (
|
||||
<h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pr-1.5 text-xs font-medium select-none">
|
||||
<h2 className="text-text-secondary mb-1 flex items-center gap-1.5 pe-1.5 text-xs font-medium select-none">
|
||||
<Zap size={12} aria-hidden="true" />
|
||||
{systemLabel}
|
||||
<span className="sr-only">
|
||||
|
|
@ -171,7 +171,7 @@ export default function MessageRow({
|
|||
'flex min-h-[1.25rem] max-w-full grow flex-col gap-0',
|
||||
isUserSide && !isEditing
|
||||
? cn(
|
||||
'rounded-theme-surface rounded-br-theme-control px-theme-normal w-fit',
|
||||
'rounded-theme-surface rounded-ee-theme-control px-theme-normal w-fit',
|
||||
isSystem || outlined
|
||||
? 'border-border-medium border py-1.5'
|
||||
: 'bg-surface-user-message py-2.5',
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ function TimestampText({
|
|||
dateTime={timestamp.iso}
|
||||
title={timestamp.isRecent ? timestamp.absolute : undefined}
|
||||
className={cn(
|
||||
'message-timestamp text-xs font-normal text-text-secondary',
|
||||
'message-timestamp text-text-secondary text-xs font-normal',
|
||||
revealOnHover &&
|
||||
'ml-2 transition-opacity duration-theme-normal ease-out motion-reduce:transition-none',
|
||||
'duration-theme-normal ms-2 transition-opacity ease-out motion-reduce:transition-none',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default function SystemEventHeader({
|
|||
{expanded != null && (
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'text-text-secondary ml-auto size-4 shrink-0 transition-transform duration-200 ease-out motion-reduce:transition-none',
|
||||
'text-text-secondary ms-auto size-4 shrink-0 transition-transform duration-200 ease-out motion-reduce:transition-none',
|
||||
expanded && 'rotate-180',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ describe('MessageRow', () => {
|
|||
const row = screen.getByLabelText('Assistant message');
|
||||
const agentTurn = row.querySelector('.agent-turn');
|
||||
|
||||
expect(agentTurn).not.toHaveClass('md:pl-9', 'pl-9');
|
||||
expect(agentTurn).not.toHaveClass('md:ps-9', 'ps-9');
|
||||
expect(row).not.toHaveClass('gap-3');
|
||||
expect(row.children).toHaveLength(1);
|
||||
expect(screen.getAllByTestId('message-icon')).toHaveLength(1);
|
||||
|
|
@ -166,7 +166,7 @@ describe('MessageRow', () => {
|
|||
const heading = screen.getByRole('heading', { name: 'Message from Assistant Model: gpt-5.6' });
|
||||
|
||||
expect(heading).toHaveClass('w-full', 'gap-2');
|
||||
expect(screen.getByTestId('message-timestamp')).toHaveClass('ml-auto');
|
||||
expect(screen.getByTestId('message-timestamp')).toHaveClass('ms-auto');
|
||||
});
|
||||
|
||||
it('keeps the model name ready to replace the provider on hover', () => {
|
||||
|
|
@ -214,7 +214,7 @@ describe('MessageRow', () => {
|
|||
const messageSurface = screen.getByTestId('message-body');
|
||||
|
||||
expect(row.querySelector('.agent-turn')).toHaveClass('w-full');
|
||||
expect(row.querySelector('.agent-turn')).not.toHaveClass('md:pl-9');
|
||||
expect(row.querySelector('.agent-turn')).not.toHaveClass('md:ps-9');
|
||||
expect(messageSurface).toHaveClass('w-full');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function PullRequestCard({
|
|||
<span className="text-text-primary text-sm font-medium">
|
||||
{localize(view.labelKey, { 0: pullRequest.number })}
|
||||
</span>
|
||||
<span className="ml-auto flex items-center gap-1.5 text-xs font-medium">
|
||||
<span className="ms-auto flex items-center gap-1.5 text-xs font-medium">
|
||||
<span
|
||||
className="text-status-success"
|
||||
aria-label={localize('com_ui_pr_additions', { 0: pullRequest.additions })}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import { cn } from '~/utils';
|
|||
/** Slides in from the anchor's side, left to right, and fades; reduced motion only fades. */
|
||||
export const panelClass = cn(
|
||||
'border-border-light bg-surface-secondary text-text-primary z-[200] w-80 max-w-[calc(100vw-2rem)] rounded-xl border shadow-lg focus:outline-none',
|
||||
'origin-left -translate-x-3 opacity-0 transition duration-200 ease-out',
|
||||
'origin-left rtl:origin-right -translate-x-3 rtl:translate-x-3 opacity-0 transition duration-200 ease-out',
|
||||
'data-[enter]:translate-x-0 data-[enter]:opacity-100',
|
||||
'data-[leave]:-translate-x-3 data-[leave]:opacity-0',
|
||||
'data-[leave]:-translate-x-3 rtl:data-[leave]:translate-x-3 data-[leave]:opacity-0',
|
||||
'motion-reduce:translate-x-0 motion-reduce:transition-opacity',
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ function PullRequestRowMark({
|
|||
onKeyDown={(event: React.KeyboardEvent) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') event.stopPropagation();
|
||||
}}
|
||||
className="focus-visible:ring-text-primary text-status-warning relative mr-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2"
|
||||
className="focus-visible:ring-text-primary text-status-warning relative me-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2"
|
||||
>
|
||||
<TriangleAlert aria-hidden="true" className="size-4 shrink-0" />
|
||||
</Ariakit.HovercardAnchor>
|
||||
|
|
@ -150,7 +150,7 @@ function PullRequestRowMark({
|
|||
if (event.key === 'Enter' || event.key === ' ') event.stopPropagation();
|
||||
}}
|
||||
className={cn(
|
||||
'focus-visible:ring-text-primary relative mr-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2',
|
||||
'focus-visible:ring-text-primary relative me-1 flex size-4 shrink-0 items-center justify-center rounded-sm outline-hidden focus-visible:ring-2',
|
||||
)}
|
||||
>
|
||||
<PullRequestIcon icon={view.icon} tone={view.iconTone} className="size-4 shrink-0" />
|
||||
|
|
|
|||
|
|
@ -173,11 +173,11 @@ describe('PullRequestRowMark', () => {
|
|||
it('keeps its spacing on the rendered mark, so an absent mark takes no room', async () => {
|
||||
mockGetMany.mockResolvedValue(answer('convo-1', pr));
|
||||
const first = renderMark();
|
||||
expect(await screen.findByTestId('convo-pull-request')).toHaveClass('mr-1');
|
||||
expect(await screen.findByTestId('convo-pull-request')).toHaveClass('me-1');
|
||||
first.unmount();
|
||||
mockGetMany.mockRejectedValueOnce(new Error('503'));
|
||||
renderMark();
|
||||
expect(await screen.findByTestId('convo-pull-request-failed')).toHaveClass('mr-1');
|
||||
expect(await screen.findByTestId('convo-pull-request-failed')).toHaveClass('me-1');
|
||||
});
|
||||
|
||||
it('falls back to the single route when the replica that answered has no batch route', async () => {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default function SubagentThreadLink({
|
|||
title={label}
|
||||
onClick={() => navigateToConvo(targetConversation)}
|
||||
>
|
||||
<ChevronLeft size={16} aria-hidden="true" />
|
||||
<ChevronLeft size={16} className="rtl:-scale-x-100" aria-hidden="true" />
|
||||
<span className={labelClassName}>{label}</span>
|
||||
</Button>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ function EventSubagentRows({
|
|||
aria-expanded={expanded}
|
||||
aria-controls={panelId}
|
||||
aria-label={`${localize('com_ui_subagent_activity')}: ${summary}`}
|
||||
className="focus-visible:ring-ring-primary flex h-auto min-h-10 w-full items-center justify-start px-3 text-left focus-visible:ring-offset-0 focus-visible:ring-inset"
|
||||
className="focus-visible:ring-ring-primary flex h-auto min-h-10 w-full items-center justify-start px-3 text-start focus-visible:ring-offset-0 focus-visible:ring-inset"
|
||||
>
|
||||
<Bot size={15} className="shrink-0" aria-hidden="true" />
|
||||
<span className="min-w-0 flex-1 truncate text-sm font-medium">{summary}</span>
|
||||
|
|
@ -191,7 +191,7 @@ function EventSubagentRows({
|
|||
data-subagent-parent-message={child.parentMessageId}
|
||||
data-subagent-part-index="0"
|
||||
className={cn(
|
||||
'focus-visible:ring-ring-primary flex w-full items-center gap-2 px-3 py-2 text-left text-sm focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset',
|
||||
'focus-visible:ring-ring-primary flex w-full items-center gap-2 px-3 py-2 text-start text-sm focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset',
|
||||
canOpen ? 'hover:bg-surface-hover' : 'cursor-default opacity-70',
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export default function SharedSubagentActivityDialog({
|
|||
className="flex h-[min(90vh,48rem)] w-11/12 max-w-3xl flex-col gap-0 overflow-hidden p-0"
|
||||
onCloseAutoFocus={restoreTriggerFocus}
|
||||
>
|
||||
<OGDialogHeader className="border-border-light shrink-0 border-b px-5 py-4 pr-14">
|
||||
<OGDialogHeader className="border-border-light shrink-0 border-b px-5 py-4 pe-14">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<span
|
||||
aria-hidden="true"
|
||||
|
|
@ -127,7 +127,7 @@ export default function SharedSubagentActivityDialog({
|
|||
>
|
||||
{childAuthor.icon}
|
||||
</span>
|
||||
<OGDialogTitle className="truncate text-left text-base" title={title}>
|
||||
<OGDialogTitle className="truncate text-start text-base" title={title}>
|
||||
{title}
|
||||
</OGDialogTitle>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ function SubagentControlHistory({
|
|||
<span className="min-w-0 flex-1 font-medium">
|
||||
{localize(CONTROL_ACTION_LABELS[control.action])}
|
||||
</span>
|
||||
<span className="text-text-secondary ml-auto shrink-0 text-xs" aria-live="polite">
|
||||
<span className="text-text-secondary ms-auto shrink-0 text-xs" aria-live="polite">
|
||||
{localize(CONTROL_STATUS_LABELS[control.status])}
|
||||
</span>
|
||||
{control.status === 'accepted' &&
|
||||
|
|
@ -106,7 +106,7 @@ function SubagentControlHistory({
|
|||
<div className="text-text-secondary mt-1 break-words">
|
||||
{control.message}
|
||||
{control.messageTruncated === true && (
|
||||
<span className="ml-1 text-xs italic">
|
||||
<span className="ms-1 text-xs italic">
|
||||
{localize('com_ui_subagent_control_message_truncated')}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function Section({ title, fields }: { title: TranslationKeys; fields: Field[] })
|
|||
{fields.map((field) => (
|
||||
<div key={field.label} className="contents">
|
||||
<dt className="text-text-secondary">{localize(field.label)}</dt>
|
||||
<dd className="text-text-primary min-w-0 text-right break-words tabular-nums">
|
||||
<dd className="text-text-primary min-w-0 text-end break-words tabular-nums">
|
||||
{field.value}
|
||||
</dd>
|
||||
</div>
|
||||
|
|
@ -193,7 +193,7 @@ function AgentCard({ agent, agentId }: { agent: RecordPresentation['agent']; age
|
|||
{agent == null && (
|
||||
<p className="text-text-secondary text-sm">{localize('com_ui_trace_agent_unavailable')}</p>
|
||||
)}
|
||||
<div className="border-border-light bg-surface-primary-alt flex items-center gap-1 rounded-lg border py-0.5 pr-0.5 pl-2.5">
|
||||
<div className="border-border-light bg-surface-primary-alt flex items-center gap-1 rounded-lg border py-0.5 ps-2.5 pe-0.5">
|
||||
<span className="text-text-secondary min-w-0 flex-1 truncate font-mono text-xs select-all">
|
||||
{agentId}
|
||||
</span>
|
||||
|
|
@ -363,7 +363,7 @@ function Inspector({
|
|||
<aside
|
||||
aria-labelledby={headingId}
|
||||
data-testid="trace-inspector"
|
||||
className="border-border-light bg-presentation flex min-h-0 flex-col max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:z-20 max-md:max-h-[65%] max-md:rounded-t-2xl max-md:border-t max-md:shadow-lg md:w-[22rem] md:shrink-0 md:border-l"
|
||||
className="border-border-light bg-presentation flex min-h-0 flex-col max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:z-20 max-md:max-h-[65%] max-md:rounded-t-2xl max-md:border-t max-md:shadow-lg md:w-[22rem] md:shrink-0 md:border-s"
|
||||
>
|
||||
<div className="border-border-light flex items-center gap-2 border-b px-3 py-2">
|
||||
{presentation.agent !== undefined &&
|
||||
|
|
@ -377,7 +377,7 @@ function Inspector({
|
|||
<h3 id={headingId} className="min-w-0 flex-1 truncate text-sm font-semibold">
|
||||
{presentation.title}
|
||||
{presentation.caption != null && (
|
||||
<span className="text-text-secondary ml-1.5 text-xs font-normal">
|
||||
<span className="text-text-secondary ms-1.5 text-xs font-normal">
|
||||
{presentation.caption}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ function Ledger({
|
|||
: '';
|
||||
const costCell = (cost?: number) =>
|
||||
showCost && (
|
||||
<span className="text-text-secondary hidden truncate text-right text-xs font-normal tabular-nums md:block">
|
||||
<span className="text-text-secondary hidden truncate text-end text-xs font-normal tabular-nums md:block">
|
||||
{cost != null ? formatCost(cost, currency) : ''}
|
||||
</span>
|
||||
);
|
||||
|
|
@ -277,7 +277,11 @@ function Ledger({
|
|||
Enter: () => activate(activeRow),
|
||||
' ': () => activate(activeRow),
|
||||
};
|
||||
const handler = handlers[event.key];
|
||||
/** Read from the tree itself so an LTR island inside an RTL page keeps its own arrows. */
|
||||
const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';
|
||||
const mirror: Record<string, string> = { ArrowLeft: 'ArrowRight', ArrowRight: 'ArrowLeft' };
|
||||
const key = rtl ? (mirror[event.key] ?? event.key) : event.key;
|
||||
const handler = handlers[key];
|
||||
if (handler) {
|
||||
event.preventDefault();
|
||||
handler();
|
||||
|
|
@ -289,7 +293,7 @@ function Ledger({
|
|||
aria-hidden="true"
|
||||
className={cn(
|
||||
'text-text-secondary size-3.5 shrink-0 transition-transform motion-reduce:transition-none',
|
||||
expanded && 'rotate-90',
|
||||
expanded ? 'rotate-90' : 'rtl:-scale-x-100',
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
|
@ -376,7 +380,10 @@ function Ledger({
|
|||
active && ACTIVE_RING,
|
||||
)}
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-1.5" style={{ paddingLeft: indent }}>
|
||||
<span
|
||||
className="flex min-w-0 items-center gap-1.5 ps-(--indent)"
|
||||
style={{ '--indent': `${indent}px` } as CSSProperties}
|
||||
>
|
||||
{chevron(row.expanded)}
|
||||
<span className="shrink-0 truncate">{label}</span>
|
||||
{agents.map(({ agentId, recordId }) => {
|
||||
|
|
@ -393,7 +400,7 @@ function Ledger({
|
|||
}}
|
||||
onKeyDown={(event) => event.stopPropagation()}
|
||||
className={cn(
|
||||
'border-border-light hover:bg-surface-hover flex max-w-[45%] shrink-0 items-center gap-1 rounded-full border py-0.5 pr-2 pl-0.5 font-medium',
|
||||
'border-border-light hover:bg-surface-hover flex max-w-[45%] shrink-0 items-center gap-1 rounded-full border py-0.5 ps-0.5 pe-2 font-medium',
|
||||
selectedId === recordId && 'bg-surface-active-alt',
|
||||
)}
|
||||
>
|
||||
|
|
@ -409,14 +416,14 @@ function Ledger({
|
|||
<CircleAlert aria-hidden="true" className="text-status-error size-3.5 shrink-0" />
|
||||
)}
|
||||
</span>
|
||||
<span className="text-text-secondary text-right font-normal tabular-nums">
|
||||
<span className="text-text-secondary text-end font-normal tabular-nums">
|
||||
{format.duration(
|
||||
row.type === 'turn' ? row.turn.end - row.turn.start : row.step.end - row.step.start,
|
||||
)}
|
||||
</span>
|
||||
<span className="hidden md:block" />
|
||||
{costCell(row.type === 'turn' ? row.turn.cost : row.step.cost)}
|
||||
<span className="relative h-full overflow-hidden">
|
||||
<span dir="ltr" className="relative h-full overflow-hidden">
|
||||
<GroupBar span={span} domain={domainFor(messageId)} />
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -499,8 +506,8 @@ function Ledger({
|
|||
)}
|
||||
>
|
||||
<span
|
||||
className="flex min-w-0 items-center gap-1.5"
|
||||
style={{ paddingLeft: (row.level - 2) * INDENT_PX }}
|
||||
className="flex min-w-0 items-center gap-1.5 ps-(--indent)"
|
||||
style={{ '--indent': `${(row.level - 2) * INDENT_PX}px` } as CSSProperties}
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
|
|
@ -568,14 +575,14 @@ function Ledger({
|
|||
<CircleDashed aria-hidden="true" className="text-text-secondary size-3.5 shrink-0" />
|
||||
)}
|
||||
</span>
|
||||
<span className="text-text-secondary truncate text-right text-xs tabular-nums">
|
||||
<span className="text-text-secondary truncate text-end text-xs tabular-nums">
|
||||
{duration}
|
||||
</span>
|
||||
<span className="text-text-secondary hidden text-right text-xs tabular-nums md:block">
|
||||
<span className="text-text-secondary hidden text-end text-xs tabular-nums md:block">
|
||||
{recordTokens(node)}
|
||||
</span>
|
||||
{costCell(record.cost)}
|
||||
<span className="relative h-full overflow-hidden">
|
||||
<span dir="ltr" className="relative h-full overflow-hidden">
|
||||
<RecordBar node={node} scale={scale} domain={domainFor(record.messageId)} />
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -614,15 +621,13 @@ function Ledger({
|
|||
)}
|
||||
>
|
||||
<span>{localize('com_ui_trace_column_name')}</span>
|
||||
<span className="text-right">{localize('com_ui_trace_column_duration')}</span>
|
||||
<span className="hidden text-right md:block">{localize('com_ui_trace_column_tokens')}</span>
|
||||
<span className="text-end">{localize('com_ui_trace_column_duration')}</span>
|
||||
<span className="hidden text-end md:block">{localize('com_ui_trace_column_tokens')}</span>
|
||||
{showCost && (
|
||||
<span className="hidden text-right md:block">
|
||||
{localize('com_ui_trace_summary_cost')}
|
||||
</span>
|
||||
<span className="hidden text-end md:block">{localize('com_ui_trace_summary_cost')}</span>
|
||||
)}
|
||||
{viewDomain ? (
|
||||
<span className="flex justify-between tracking-normal normal-case tabular-nums">
|
||||
<span dir="ltr" className="flex justify-between tracking-normal normal-case tabular-nums">
|
||||
<span>{position(viewDomain.start)}</span>
|
||||
<span>{position(viewDomain.start + viewDomain.span)}</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ function Timeline({
|
|||
aria-label={localize('com_ui_trace_overview')}
|
||||
aria-describedby={hintId}
|
||||
data-testid="trace-overview"
|
||||
dir="ltr"
|
||||
data-scale={scale}
|
||||
onKeyDown={handleKeyDown}
|
||||
onPointerDown={handlePointerDown}
|
||||
|
|
@ -259,6 +260,7 @@ function Timeline({
|
|||
)}
|
||||
</div>
|
||||
<div
|
||||
dir="ltr"
|
||||
className="text-text-secondary text-2xs flex justify-between tabular-nums"
|
||||
aria-hidden="true"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ export default function Viewer({
|
|||
<Layers className="size-4" aria-hidden="true" />
|
||||
<span className="hidden sm:inline">{localize('com_ui_trace_all_spans')}</span>
|
||||
</Button>
|
||||
<div className="ml-auto flex items-center gap-1">
|
||||
<div className="ms-auto flex items-center gap-1">
|
||||
{view != null && (
|
||||
<span className="text-text-secondary text-xs tabular-nums" aria-live="polite">
|
||||
{selectionText()}
|
||||
|
|
@ -612,7 +612,7 @@ export default function Viewer({
|
|||
<h2 id={headingId} className="text-base font-semibold">
|
||||
{localize('com_ui_trace_title')}
|
||||
</h2>
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<div className="ms-auto flex items-center gap-2">
|
||||
{langfuseUrl != null && (
|
||||
<a
|
||||
href={langfuseUrl}
|
||||
|
|
|
|||
|
|
@ -512,6 +512,26 @@ describe('Trace Viewer', () => {
|
|||
expect(screen.getByTestId('trace-inspector')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('swaps the fold arrows when the tree runs right to left', async () => {
|
||||
renderViewer();
|
||||
await recordRow('llm');
|
||||
const tree = screen.getByRole('tree');
|
||||
tree.style.direction = 'rtl';
|
||||
|
||||
await userEvent.click(stepRow(1));
|
||||
await waitFor(() =>
|
||||
expect(screen.queryByRole('treeitem', { name: recordName('llm') })).not.toBeInTheDocument(),
|
||||
);
|
||||
expect(stepRow(1)).toHaveAttribute('aria-expanded', 'false');
|
||||
|
||||
fireEvent.keyDown(tree, { key: 'ArrowLeft' });
|
||||
expect(await recordRow('llm')).toBeInTheDocument();
|
||||
expect(stepRow(1)).toHaveAttribute('aria-expanded', 'true');
|
||||
fireEvent.keyDown(tree, { key: 'ArrowDown' });
|
||||
fireEvent.keyDown(tree, { key: 'ArrowRight' });
|
||||
expect(tree).toHaveAttribute('aria-activedescendant', stepRow(1).id);
|
||||
});
|
||||
|
||||
it('keeps the active row mounted while the ledger scrolls away from it', async () => {
|
||||
const many = [
|
||||
record({
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
|
|||
/>
|
||||
) : (
|
||||
<p className="text-text-warning mt-2 flex items-center text-xs" role="alert">
|
||||
<TriangleAlert className="mr-1.5 size-4" aria-hidden="true" />
|
||||
<TriangleAlert className="me-1.5 size-4" aria-hidden="true" />
|
||||
{localize('com_ui_approval_unavailable')}
|
||||
</p>
|
||||
)}
|
||||
|
|
@ -185,7 +185,7 @@ export const PendingToolApprovalPanel = memo(function PendingToolApprovalPanel({
|
|||
<div className="flex items-center gap-2">
|
||||
{(status === 'expired' || status === 'error') && (
|
||||
<span className="text-text-warning flex items-center text-xs" role="alert">
|
||||
<TriangleAlert className="mr-1.5 size-4" aria-hidden="true" />
|
||||
<TriangleAlert className="me-1.5 size-4" aria-hidden="true" />
|
||||
{localize(
|
||||
status === 'expired' ? 'com_ui_approval_expired' : 'com_ui_approval_error',
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProps>(
|
|||
'hover:bg-surface-hover hover:text-text-primary',
|
||||
'disabled:pointer-events-none disabled:opacity-50',
|
||||
'focus-visible:outline-focus-subtle focus-visible:outline focus-visible:outline-2',
|
||||
iconOnly ? 'rounded-lg p-1.5' : 'ml-auto gap-2 rounded-md px-2 py-1',
|
||||
iconOnly ? 'rounded-lg p-1.5' : 'ms-auto gap-2 rounded-md px-2 py-1',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const CodeBar: React.FC<CodeBarProps> = React.memo(
|
|||
{lang}
|
||||
</span>
|
||||
{plugin === true ? (
|
||||
<InfoIcon className="text-text-secondary ml-auto flex h-4 w-4 gap-2" />
|
||||
<InfoIcon className="text-text-secondary ms-auto flex h-4 w-4 gap-2" />
|
||||
) : (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
{allowExecution === true && (
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
|
|||
allowExecution={allowExecution}
|
||||
/>
|
||||
</div>
|
||||
<div className={cn(classProp, 'bg-surface-code-body overflow-y-auto p-4')}>
|
||||
<div dir="ltr" className={cn(classProp, 'bg-surface-code-body overflow-y-auto p-4')}>
|
||||
<code
|
||||
ref={codeRef}
|
||||
className={cn(
|
||||
|
|
@ -138,7 +138,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
|
|||
/>
|
||||
{allowExecution === true && toolCalls && toolCalls.length > 0 && (
|
||||
<>
|
||||
<div className="border-border-inset bg-surface-code border-t p-4 text-xs">
|
||||
<div dir="ltr" className="border-border-inset bg-surface-code border-t p-4 text-xs">
|
||||
<div className="text-text-secondary text-3xs mb-1 font-medium tracking-wide uppercase">
|
||||
{localize('com_ui_output')}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ export function ErrorDetails({ label, children }: { label: string; children: Rea
|
|||
<ChevronRight
|
||||
className={cn(
|
||||
'size-3.5 transition-transform duration-300 [transition-timing-function:cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none',
|
||||
open && 'rotate-90',
|
||||
open ? 'rotate-90' : 'rtl:-scale-x-100',
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue