Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: dark dropdown glow, menu ticks and picker polish (#12826)
Michael Hana01c0f8a72fb
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex 383abea250d..b5aa38db10d 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -1002,7 +1002,7 @@ function AudioMoreSubmenu({<Spinner className="size-3.5 shrink-0 text-muted-foreground" />)}</DropdownMenuSubTrigger>- <DropdownMenuSubContent {...contentProps} className="w-44 p-1">+ <DropdownMenuSubContent {...contentProps} className="sidebar-more-menu w-44 p-1">{AUDIO_WORKFLOWS.map((tab) => (<DropdownMenuItemkey={tab.id}@@ -5575,7 +5575,7 @@ export function AppSidebar() {side="right"align="start"sideOffset={6}- className="w-48 p-1"+ className="sidebar-more-menu w-48 p-1"{...moreHover.content}// The trigger handles its own presses.onPointerDownOutside={(event) => {@@ -5962,13 +5962,13 @@ export function AppSidebar() {side="top"align="center"sideOffset={8}- className="app-user-menu sidebar-menu menu-soft-surface-up ring-0 w-[round(calc(16rem*var(--ui-space-scale,1)),1px)] rounded-[20px] border border-transparent px-2.5 py-2.5 font-heading dark:border-[rgb(255_255_255_/_calc(0.05*var(--contrast-edge-gain,1)))]"+ className="app-user-menu sidebar-menu menu-soft-surface-up ring-0 w-[round(calc(16rem*var(--ui-space-scale,1)),1px)] rounded-[20px] border border-[rgb(0_0_0_/_calc(0.05*var(--contrast-edge-gain,1)))] px-2.5 py-2.5 font-heading dark:border-transparent"trigger={(triggerRef) => (<SidebarMenuButtonref={triggerRef}size="lg"aria-label={t("shell.accountMenu", { name: displayTitle })}- className="sidebar-nav-btn !h-[calc(44px*var(--ui-space-scale,1))] -my-[calc(3px*var(--ui-space-scale,1))] gap-[calc(9px*var(--ui-space-scale,1))] pl-2 pr-[calc(45px*var(--ui-space-scale,1))] py-[calc(3px*var(--ui-space-scale,1))] rounded-[14px] group-data-[collapsible=icon]:!size-[calc(34px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:!rounded-full group-data-[collapsible=icon]:!p-0 group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:justify-center"+ className="sidebar-nav-btn app-user-trigger !h-[calc(44px*var(--ui-space-scale,1))] -my-[calc(3px*var(--ui-space-scale,1))] gap-[calc(9px*var(--ui-space-scale,1))] pl-2 pr-[calc(45px*var(--ui-space-scale,1))] py-[calc(3px*var(--ui-space-scale,1))] rounded-[14px] group-data-[collapsible=icon]:!size-[calc(34px*var(--ui-space-scale,1))] group-data-[collapsible=icon]:!rounded-full group-data-[collapsible=icon]:!p-0 group-data-[collapsible=icon]:mx-auto group-data-[collapsible=icon]:justify-center"><div className="flex shrink-0 items-center"><UserAvatardiff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 92d91bd0ebb..edc24b66bed 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -6075,15 +6075,15 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({setPreserveThinking(false);}}>+ None<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",effectiveReasoningVisualEnabled && "opacity-0",)}/>- None</DropdownMenuItem>)}{effectiveReasoningEffortLevels@@ -6108,18 +6108,18 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({}}}>+ {formatEffortLabel(level)}<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!(effectiveReasoningVisualEnabled &&displayedEffort === level) && "opacity-0",)}/>- {formatEffortLabel(level)}</DropdownMenuItem>))}</>@@ -6139,15 +6139,15 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({}}}>+ Thinking<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!effectiveReasoningEnabled && "opacity-0",)}/>- Thinking</DropdownMenuItem>))}@@ -6165,15 +6165,15 @@ const ReasoningToggle: FC<{ side?: "top" | "bottom" }> = ({}}}>+ Preserve thinking<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!preserveThinking && "opacity-0",)}/>- Preserve thinking</DropdownMenuItem>)}</NonModalDropdownMenu>@@ -8382,7 +8382,7 @@ const DeleteMessageMenuItem: FC = () => {};const MORE_MENU_CONTENT_CLASS =- "aui-action-bar-more-content z-50 min-w-32 max-h-(--radix-dropdown-menu-content-available-height) flex flex-col overflow-hidden rounded-[21px] bg-popover px-[calc(9px*var(--ui-space-scale,1))] py-2 text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:shadow-[0_8px_28px_-6px_var(--background)]";+ "aui-action-bar-more-content dropdown-surface z-50 min-w-32 max-h-(--radix-dropdown-menu-content-available-height) flex flex-col overflow-hidden rounded-[21px] bg-popover px-[calc(9px*var(--ui-space-scale,1))] py-2 text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)]";const ForkMessageMenuItem: FC = () => {const { forkMessage, forkDisabled } = useForkMessageAction();diff --git a/studio/frontend/src/components/media-viewer.tsx b/studio/frontend/src/components/media-viewer.tsxindex cec9694ffff..7b8a2829263 100644--- a/studio/frontend/src/components/media-viewer.tsx+++ b/studio/frontend/src/components/media-viewer.tsx@@ -82,6 +82,7 @@ export function ScaleMenu({fitScale,onChange,className,+ contentClassName,floating = false,}: {value: MediaZoom;@@ -89,6 +90,7 @@ export function ScaleMenu({fitScale?: number;onChange: (value: MediaZoom) => void;className?: string;+ contentClassName?: string;floating?: boolean;}) {const t = useT();@@ -109,7 +111,7 @@ export function ScaleMenu({<HugeiconsIcon icon={ChevronDownStandardIcon} strokeWidth={1.75} className="size-4" /></button></DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-40">+ <DropdownMenuContent align="end" className={cn("w-40", contentClassName)}><DropdownMenuRadioGroupvalue={String(value)}onValueChange={(next) => onChange(next === "fit" ? "fit" : Number(next))}diff --git a/studio/frontend/src/components/ui/menubar.tsx b/studio/frontend/src/components/ui/menubar.tsxindex a6c5e14316d..ad05e64f664 100644--- a/studio/frontend/src/components/ui/menubar.tsx+++ b/studio/frontend/src/components/ui/menubar.tsx@@ -133,13 +133,13 @@ function MenubarCheckboxItem({<MenubarPrimitive.CheckboxItemdata-slot="menubar-checkbox-item"className={cn(- "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-3 pl-8 text-sm data-disabled:opacity-50 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-9 pl-3 text-sm data-disabled:opacity-50 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",className,)}checked={checked}{...props}>- <span className="left-2 size-4 [&_svg:not([class*='size-'])]:size-4 pointer-events-none absolute flex items-center justify-center">+ <span className="right-3 size-4 [&_svg:not([class*='size-'])]:size-4 pointer-events-none absolute flex items-center justify-center"><MenubarPrimitive.ItemIndicator><HugeiconsIcon icon={Tick02Icon} strokeWidth={2} /></MenubarPrimitive.ItemIndicator>@@ -158,12 +158,12 @@ function MenubarRadioItem({<MenubarPrimitive.RadioItemdata-slot="menubar-radio-item"className={cn(- "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-3 pl-8 text-sm data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-9 pl-3 text-sm data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",className,)}{...props}>- <span className="left-2 size-4 [&_svg:not([class*='size-'])]:size-4 pointer-events-none absolute flex items-center justify-center">+ <span className="right-3 size-4 [&_svg:not([class*='size-'])]:size-4 pointer-events-none absolute flex items-center justify-center"><MenubarPrimitive.ItemIndicator><HugeiconsIcon icon={Tick02Icon} strokeWidth={2} /></MenubarPrimitive.ItemIndicator>diff --git a/studio/frontend/src/features/browser/bookmarks.tsx b/studio/frontend/src/features/browser/bookmarks.tsxindex 36c6981f64b..29d61f5594b 100644--- a/studio/frontend/src/features/browser/bookmarks.tsx+++ b/studio/frontend/src/features/browser/bookmarks.tsx@@ -201,7 +201,7 @@ function BookmarkEditor({<SelectTrigger aria-labelledby={`${id}-location`} className="w-full"><SelectValue /></SelectTrigger>- <SelectContent>+ <SelectContent className="browser-menu">{(Object.keys(FOLDERS) as BookmarkFolder[]).map((value) => (<SelectItem key={value} value={value}><HugeiconsIcon@@ -259,7 +259,7 @@ export function BookmarkEditPopover({<PopoverContentalign={align}sideOffset={8}- className="w-80 rounded-[16px] p-4"+ className="browser-menu w-80 rounded-[16px] p-4"onOpenAutoFocus={(event) => {const input = (event.currentTarget as HTMLElement | null)?.querySelector<HTMLInputElement>("[data-bookmark-name]",@@ -466,7 +466,7 @@ function BookmarkMenu({{label}</TooltipContent></Tooltip>- <DropdownMenuContent align="end" sideOffset={6} className="max-h-[min(--spacing(96),var(--radix-dropdown-menu-content-available-height))] overflow-y-auto w-64 rounded-[16px] p-1.5">+ <DropdownMenuContent align="end" sideOffset={6} className="browser-menu max-h-[min(--spacing(96),var(--radix-dropdown-menu-content-available-height))] overflow-y-auto w-64 rounded-[16px] p-1.5">{bookmarks.map((bookmark) => (<DropdownMenuItemkey={bookmark.id}diff --git a/studio/frontend/src/features/browser/browser-panel.tsx b/studio/frontend/src/features/browser/browser-panel.tsxindex 6645047b2dc..30282a23c5a 100644--- a/studio/frontend/src/features/browser/browser-panel.tsx+++ b/studio/frontend/src/features/browser/browser-panel.tsx@@ -870,7 +870,7 @@ function SiteIdentity({ address, tab }: { address: string; tab: BrowserTab | und{label}</TooltipContent></Tooltip>- <PopoverContent align="start" sideOffset={8} className="w-80 gap-0 rounded-[14px] p-1.5">+ <PopoverContent align="start" sideOffset={8} className="browser-menu w-80 gap-0 rounded-[14px] p-1.5">{view === "site" ? (<><div className="flex min-w-0 items-center gap-2.5 px-3 py-2">@@ -1187,7 +1187,7 @@ function PanelMenu({ tab }: { tab: BrowserTab | undefined }) {<DropdownMenuContentalign="end"sideOffset={6}- className="min-w-72 rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5"+ className="browser-menu min-w-72 rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5"onCloseAutoFocus={(event) => {if (!keepFocus.current) return;keepFocus.current = false;@@ -1261,7 +1261,7 @@ function PanelMenu({ tab }: { tab: BrowserTab | undefined }) {<DropdownMenuSeparator /><DropdownMenuSub><DropdownMenuSubTrigger>{t("browser.pages.bookmarks")}</DropdownMenuSubTrigger>- <DropdownMenuSubContent className="min-w-60 rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5">+ <DropdownMenuSubContent className="browser-menu min-w-60 rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5"><DropdownMenuItemdisabled={!webUrl}onSelect={() => {@@ -1498,7 +1498,7 @@ function FileToolbar({<DropdownMenuContentalign="start"sideOffset={6}- className="w-80 max-w-[calc(100vw-2rem)] rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5"+ className="browser-menu w-80 max-w-[calc(100vw-2rem)] rounded-[20px] p-1.5 [&_[data-slot=dropdown-menu-separator]]:mx-3 [&_[data-slot=dropdown-menu-separator]]:my-1.5"><div className="flex items-start gap-3 px-3 py-2 text-sm"><KindIcon@@ -1519,7 +1519,7 @@ function FileToolbar({/>{t("browser.file.openIn")}</DropdownMenuSubTrigger>- <DropdownMenuSubContent className="min-w-52 rounded-[20px] p-1.5">+ <DropdownMenuSubContent className="browser-menu min-w-52 rounded-[20px] p-1.5"><DropdownMenuItem onSelect={openInNewChat}><HugeiconsIconicon={BubbleChatAddIcon}@@ -1732,6 +1732,7 @@ function FileToolbar({<ScaleMenuvalue={tab.zoom}scales={ATTACHMENT_PAGE_SCALES}+ contentClassName="browser-menu"onChange={(value) =>useBrowserStore.getState()diff --git a/studio/frontend/src/features/browser/browser-toggle.tsx b/studio/frontend/src/features/browser/browser-toggle.tsxindex 072bebb64b2..323ae02da8b 100644--- a/studio/frontend/src/features/browser/browser-toggle.tsx+++ b/studio/frontend/src/features/browser/browser-toggle.tsx@@ -121,7 +121,7 @@ export function BrowserToggleButton({ active = true }: { active?: boolean }) {restore.current?.focus({ preventScroll: true });restore.current = null;}}- className="library-actions-menu w-56"+ className="browser-menu library-actions-menu w-56"><DropdownMenuItem onSelect={() => openTab()}><HugeiconsIcon icon={Add01Icon} strokeWidth={1.75} className="size-icon" />diff --git a/studio/frontend/src/features/browser/full-view-chat.tsx b/studio/frontend/src/features/browser/full-view-chat.tsxindex 6fafe4f1025..dd55ca84c5e 100644--- a/studio/frontend/src/features/browser/full-view-chat.tsx+++ b/studio/frontend/src/features/browser/full-view-chat.tsx@@ -129,7 +129,7 @@ export function FullViewChatBar({ title }: { title: string | undefined }) {side="top"align="end"sideOffset={8}- className="min-w-60 rounded-[20px] p-1.5"+ className="browser-menu min-w-60 rounded-[20px] p-1.5"><DropdownMenuItem onSelect={closePanel}><HugeiconsIcondiff --git a/studio/frontend/src/features/browser/internal-pages.tsx b/studio/frontend/src/features/browser/internal-pages.tsxindex 7852885e932..93866bb1b18 100644--- a/studio/frontend/src/features/browser/internal-pages.tsx+++ b/studio/frontend/src/features/browser/internal-pages.tsx@@ -338,7 +338,7 @@ function HistoryRow({<HugeiconsIcon icon={MoreHorizontalIcon} strokeWidth={2} className="size-4" /></button></DropdownMenuTrigger>- <DropdownMenuContent align="end" className="min-w-48">+ <DropdownMenuContent align="end" className="browser-menu min-w-48"><DropdownMenuItem onSelect={() => useBrowserStore.getState().openUrl(item.url, { newTab: true })}><HugeiconsIcon icon={LinkSquare02Icon} strokeWidth={1.75} />{t("browser.pages.openPage")}@@ -510,7 +510,7 @@ function HistoryPage({ tabId }: { tabId: string }) {<DropdownMenuContentalign="end"sideOffset={4}- className="library-menu w-max min-w-44"+ className="browser-menu w-max min-w-44"onCloseAutoFocus={(event) => {if (!openDatesOnClose.current) return;openDatesOnClose.current = false;@@ -542,7 +542,7 @@ function HistoryPage({ tabId }: { tabId: string }) {</DropdownMenu></label></PopoverAnchor>- <PopoverContent align="end" sideOffset={6} className="w-auto rounded-2xl p-0">+ <PopoverContent align="end" sideOffset={6} className="browser-menu w-auto rounded-2xl p-0"><Calendarmode="range"selected={dates}diff --git a/studio/frontend/src/features/browser/link-context-menu.tsx b/studio/frontend/src/features/browser/link-context-menu.tsxindex 19c14f762ef..40f1676022e 100644--- a/studio/frontend/src/features/browser/link-context-menu.tsx+++ b/studio/frontend/src/features/browser/link-context-menu.tsx@@ -22,7 +22,7 @@ import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";import type { ReactElement, ReactNode } from "react";import { useBrowserStore } from "./store";-export const CONTEXT_MENU = "unsloth-plus-menu sidebar-row-menu w-56";+export const CONTEXT_MENU = "browser-menu unsloth-plus-menu sidebar-row-menu w-56";const MENU_ICON = "size-icon";export function MenuRow({diff --git a/studio/frontend/src/features/browser/tab-menu.tsx b/studio/frontend/src/features/browser/tab-menu.tsxindex 83bc105d497..1280e9cc53b 100644--- a/studio/frontend/src/features/browser/tab-menu.tsx+++ b/studio/frontend/src/features/browser/tab-menu.tsx@@ -238,7 +238,7 @@ export function TabMenuItems({<HugeiconsIcon icon={ForkIcon} strokeWidth={1.75} className={ICON} /><span>{t("browser.tabMenu.fork")}</span></P.SubTrigger>- <P.SubContent className="unsloth-plus-menu sidebar-row-menu w-48">+ <P.SubContent className="browser-menu unsloth-plus-menu sidebar-row-menu w-48"><Row P={P} icon={BubbleChatAddIcon} onSelect={() => forkToChat(navigate, { tab, url }, false)}>{t("browser.tabMenu.forkNewChat")}</Row>diff --git a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsxindex a896c0b35fa..be7af3a7dde 100644--- a/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx+++ b/studio/frontend/src/features/chat/prompt-storage/prompt-storage-dialog.tsx@@ -2597,7 +2597,7 @@ export function PromptStorageDialog({className="w-full rounded-lg border-0 bg-muted/50 pl-9 pr-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/60 transition-shadow"/>{showSuggestions && searchQuery.trim() !== "" && suggestions.length > 0 && (- <div className="absolute top-full left-0 right-0 z-50 mt-1 rounded-xl border border-border/60 bg-popover shadow-lg overflow-hidden">+ <div className="dropdown-surface absolute top-full left-0 right-0 z-50 mt-1 rounded-xl border border-border/60 bg-popover shadow-lg overflow-hidden">{suggestions.map((name) => (<buttonkey={name}diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsxindex 4c3de6e5223..5b0596cbb17 100644--- a/studio/frontend/src/features/chat/shared-composer.tsx+++ b/studio/frontend/src/features/chat/shared-composer.tsx@@ -3101,19 +3101,19 @@ export function SharedComposer({setPreserveThinking(false);}}>+ {formatReasoningDisabledLabel(+ effectiveSupportsReasoningOff,+ isExternalOpenAIReasoning,+ checkpoint,+ )}<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",effectiveReasoningVisualEnabled && "opacity-0",)}/>- {formatReasoningDisabledLabel(- effectiveSupportsReasoningOff,- isExternalOpenAIReasoning,- checkpoint,- )}</DropdownMenuItem>)}{effectiveReasoningEffortLevels@@ -3132,21 +3132,21 @@ export function SharedComposer({}}}>+ {formatReasoningEffortLabel(+ level,+ externalSelection?.modelId,+ )}<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!(effectiveReasoningVisualEnabled &&displayedEffort === level) && "opacity-0",)}/>- {formatReasoningEffortLabel(- level,- externalSelection?.modelId,- )}</DropdownMenuItem>))}</>@@ -3166,15 +3166,15 @@ export function SharedComposer({}}}>+ Thinking<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!effectiveReasoningEnabled && "opacity-0",)}/>- Thinking</DropdownMenuItem>))}@@ -3192,15 +3192,15 @@ export function SharedComposer({}}}>+ Preserve thinking<HugeiconsIconicon={Tick02Icon}strokeWidth={2}className={cn(- "unsloth-tick size-4",+ "unsloth-tick ms-auto size-4",!preserveThinking && "opacity-0",)}/>- Preserve thinking</DropdownMenuItem>)}</NonModalDropdownMenu>diff --git a/studio/frontend/src/features/hub/catalog/recent-searches.tsx b/studio/frontend/src/features/hub/catalog/recent-searches.tsxindex 59348ff3bbe..d2f09dd62d6 100644--- a/studio/frontend/src/features/hub/catalog/recent-searches.tsx+++ b/studio/frontend/src/features/hub/catalog/recent-searches.tsx@@ -27,7 +27,7 @@ export function RecentSearches({}return (<div- className="hub-recent-panel menu-soft-surface absolute inset-x-0 top-full z-50 mt-2 overflow-hidden rounded-[16px] p-1.5"+ className="hub-recent-panel menu-soft-surface dropdown-surface absolute inset-x-0 top-full z-50 mt-2 overflow-hidden rounded-[16px] p-1.5"style={top === undefined ? undefined : { top }}aria-label="Recent searches"onMouseDown={(event) => event.preventDefault()}diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsxindex 45eea6db18b..8c5c9db2296 100644--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx@@ -6953,7 +6953,7 @@ export function HubModelPicker({: "Search Unsloth models"}data-model-picker-search-input={true}- className="field-soft h-(--picker-control-h) border-0 pl-8 pr-8"+ className="field-soft h-(--picker-control-h) border-0 pl-8 pr-8 text-sm"/>{isLoading && (<Spinner className="pointer-events-none absolute right-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />@@ -8468,7 +8468,7 @@ export function HubModelPicker({<buttontype="button"onClick={() => (ejectsAll ? onEjectAll?.() : onEject())}- className="pointer-events-auto inline-flex items-center justify-center gap-2 rounded-md bg-popover px-3 py-2 text-ui-13 font-medium text-destructive shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] transition-colors hover:bg-[color-mix(in_srgb,var(--destructive)_12%,var(--popover))] dark:bg-[color-mix(in_srgb,var(--foreground)_10%,var(--sidebar))] dark:shadow-none dark:hover:bg-[color-mix(in_srgb,var(--destructive)_22%,var(--sidebar))]"+ className="pointer-events-auto inline-flex items-center justify-center gap-2 rounded-md bg-popover px-3 py-2 text-ui-13 font-medium text-destructive shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] transition-colors hover:bg-[color-mix(in_srgb,var(--foreground)_8%,var(--popover))] dark:bg-sidebar-accent dark:shadow-none dark:hover:bg-[color-mix(in_srgb,var(--foreground)_8%,var(--sidebar-accent))]"title={ejectsAll ? "Eject all models" : "Eject model"}><HugeiconsIcon icon={RemoveCircleIcon} className="size-3.5" />diff --git a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx b/studio/frontend/src/features/rag/components/thread-documents-bar.tsxindex f8b30a6818e..50583e869bc 100644--- a/studio/frontend/src/features/rag/components/thread-documents-bar.tsx+++ b/studio/frontend/src/features/rag/components/thread-documents-bar.tsx@@ -16,6 +16,7 @@ import {Folder02Icon,} from "@hugeicons/core-free-icons";import { Tick02Icon } from "@/lib/tick-icon";+import { ChevronDownStandardIcon } from "@/lib/chevron-icons";import { useAui } from "@assistant-ui/react";import { cn } from "@/lib/utils";import {@@ -310,6 +311,26 @@ function AttachFilesButton({);}+const ATTACHMENT_TARGETS: {+ value: ProjectAttachmentTarget;+ icon: typeof Folder02Icon;+ title: string;+ description: string;+}[] = [+ {+ value: "project",+ icon: Folder02Icon,+ title: "The project",+ description: "Every chat in this project can use them",+ },+ {+ value: "thread",+ icon: AttachmentIcon,+ title: "This chat only",+ description: "Other chats in the project won't see them",+ },+];+/** Picks whether new attachments go to the project (shared with every chat in it)* or to this chat alone. Only a project chat has the choice. */function AttachmentTargetMenu({@@ -321,49 +342,64 @@ function AttachmentTargetMenu({sharesWithProject: boolean;onSelect: (target: ProjectAttachmentTarget) => void;}) {+ const current = sharesWithProject ? "project" : "thread";return (<DropdownMenu><DropdownMenuTrigger asChild={true}>+ {/* Caret and resting fill so it reads as a picker. */}<buttontype="button"disabled={disabled}aria-label="Choose where attached files go"title="Choose where attached files go"- className="composer-pill-btn shrink-0 -translate-y-px !text-foreground/60 px-2"+ className="composer-pill-btn attachment-target-pill shrink-0 -translate-y-px gap-1 !text-foreground/70 pl-3 pr-1.5">- <span className="text-ui-11">+ <span className="text-ui-12">{sharesWithProject ? "Project" : "This chat"}</span>+ <HugeiconsIcon+ icon={ChevronDownStandardIcon}+ strokeWidth={1.5}+ className="composer-pill-caret size-[calc(14px*var(--ui-space-scale,1))]"+ /></button></DropdownMenuTrigger>- <DropdownMenuContent align="start" className="unsloth-plus-menu w-64">+ <DropdownMenuContent+ align="start"+ className="unsloth-plus-menu w-[calc(328px*var(--ui-space-scale,1))]"+ ><DropdownMenuLabel>New files go to</DropdownMenuLabel>- <DropdownMenuItem onSelect={() => onSelect("project")}>- <HugeiconsIcon- icon={sharesWithProject ? Tick02Icon : Folder02Icon}- strokeWidth={1.75}- className="size-icon"- />- <span className="flex flex-col">- <span>The project</span>- <span className="text-ui-11 text-muted-foreground">- Every chat in this project can use them+ {ATTACHMENT_TARGETS.map((target) => (+ <DropdownMenuItem+ key={target.value}+ onSelect={() => onSelect(target.value)}+ className="items-start"+ >+ {/* Icon aligns with the title line. */}+ <span className="flex h-[1lh] shrink-0 items-center">+ <HugeiconsIcon+ icon={target.icon}+ strokeWidth={1.75}+ className="size-icon"+ /></span>- </span>- </DropdownMenuItem>- <DropdownMenuItem onSelect={() => onSelect("thread")}>- <HugeiconsIcon- icon={sharesWithProject ? AttachmentIcon : Tick02Icon}- strokeWidth={1.75}- className="size-icon"- />- <span className="flex flex-col">- <span>This chat only</span>- <span className="text-ui-11 text-muted-foreground">- Other chats in the project won't see them+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">+ <span>{target.title}</span>+ <span className="text-ui-12 leading-snug text-muted-foreground">+ {target.description}+ </span></span>- </span>- </DropdownMenuItem>+ {/* Tick centred on the row. */}+ <HugeiconsIcon+ icon={Tick02Icon}+ strokeWidth={2}+ className={cn(+ "unsloth-tick shrink-0 self-center",+ current !== target.value && "opacity-0",+ )}+ />+ </DropdownMenuItem>+ ))}</DropdownMenuContent></DropdownMenu>);@@ -739,22 +775,25 @@ export function ThreadDocumentsBar({<>{kbDialog}<div className="mb-2 flex w-full flex-row items-start gap-1.5 pl-0.5 pr-1.5 pt-0.5 pb-1">- <AttachFilesButton- disabled={busy}- compact={chipCount > 0}- sharesWithProject={sharesWithProject}- onClick={handleAddDocs}- />- {/* Only a project chat has two scopes to choose between. */}- {projectId ? (- <AttachmentTargetMenu+ {/* Centred together; the row stays top-aligned for chips. */}+ <div className="flex shrink-0 items-center gap-1.5">+ <AttachFilesButtondisabled={busy}+ compact={chipCount > 0}sharesWithProject={sharesWithProject}- onSelect={(target) =>- setThreadProjectAttachmentTarget(effectiveThreadId, target)- }+ onClick={handleAddDocs}/>- ) : null}+ {/* Only a project chat has two scopes to choose between. */}+ {projectId ? (+ <AttachmentTargetMenu+ disabled={busy}+ sharesWithProject={sharesWithProject}+ onSelect={(target) =>+ setThreadProjectAttachmentTarget(effectiveThreadId, target)+ }+ />+ ) : null}+ </div><inputref={fileInputRef}type="file"diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 2f871e8a08c..5393ebcd77d 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -3101,28 +3101,66 @@ html[data-chat-font] .aui-root {[data-slot="popover-content"] {box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.16) !important;}- /* Dark: keep the chat-box dropdown shadow so menus don't merge into a- same-color surface (e.g. a menu overlapping the composer). The page- colour rather than black, so over the page there is nothing to see and- over the composer it is only the step between the two surfaces. Black- ringed every menu several levels below the page. */+ /* Dark: glow in the darkest surface the menu touches, set per menu by+ lib/dropdown-surround.ts. .dropdown-surface marks bespoke dropdowns. */.dark [data-slot="dropdown-menu-content"],.dark [data-slot="dropdown-menu-sub-content"],+ .dark [data-slot="context-menu-content"],+ .dark [data-slot="context-menu-sub-content"],.dark [data-slot="select-content"],.dark [data-slot="combobox-content"],- .dark [data-slot="popover-content"] {- box-shadow: 0 8px 28px -6px var(--background) !important;+ .dark [data-slot="popover-content"],+ .dark .dropdown-surface {+ box-shadow: 0 0 16px 0 var(--dropdown-surround-bg, var(--background)) !important;+ }+ /* Sidebar and account menus stay flat in dark. */+ .dark :is(.unsloth-plus-menu, .app-user-menu).sidebar-menu[data-slot],+ .dark .app-user-menu.menu-soft-surface-up {+ box-shadow: none !important;+ }+ /* Account button hover/open matches the account menu. */+ .dark .app-user-trigger:is(:hover, [data-state="open"], [aria-expanded="true"]) {+ background-color: color-mix(in srgb, var(--card), white 6.5%) !important;+ }+ /* More menu and its sub-menus use the sidebar colour. */+ .dark .sidebar-more-menu[data-slot] {+ background-color: var(--sidebar) !important;+ }++ /* Menus that would blend into their surface get the Hub menu tone.+ Defined on <html> so --accent can be reassigned without a cycle. */+ .dark {+ --dropdown-lift-surface: color-mix(in srgb, var(--accent) 60%, var(--popover));+ --dropdown-lift-accent: color-mix(in srgb, var(--foreground) 6%, var(--accent));+ }+ .dark [data-surround-blend] {+ --accent: var(--dropdown-lift-accent);+ background-color: var(--dropdown-lift-surface) !important;+ }++ /* Browser menus in dark: the toolbar pills' colour, with one shadow colour.+ The surface resolves on <html> so --accent can be reassigned below. */+ .dark {+ --browser-menu-surface: var(--accent);+ }+ .dark .browser-menu[data-slot] {+ --accent: color-mix(in srgb, var(--browser-menu-surface), white 10%);+ --accent-foreground: #fff;+ background-color: var(--browser-menu-surface) !important;+ box-shadow: 0 0 10px 0 var(--background) !important;+ }+ .dark .browser-menu [data-slot$="-separator"] {+ background-color: color-mix(in srgb, var(--card), white 16%);}/* Library menus in dark: the sidebar menus' surface, text, hover, dividers and red. */.dark :is([data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-sub-content"]):is(.library-actions-menu, .library-menu) {- --library-menu-surface: color-mix(in srgb, var(--card), white 7%);+ --library-menu-surface: color-mix(in srgb, var(--card), white 6.5%);--accent: color-mix(in srgb, var(--library-menu-surface), white 10%);--accent-foreground: #fff;--destructive: #ed716a;background-color: var(--library-menu-surface);color: #fff;- box-shadow: 0 4px 14px var(--background) !important;}.dark :is(.library-actions-menu, .library-menu) [data-slot="dropdown-menu-separator"] {@@ -3138,15 +3176,6 @@ html[data-chat-font] .aui-root {box-shadow: 0 2px 10px -2px var(--background);}- /* Model selector: tighter than the menus above so it lifts off the- composer it overlaps (chatbox geometry). Account menu stays flat. */- .dark .unsloth-model-selector-menu {- box-shadow: 0 2px 8px -2px var(--background) !important;- }- .dark .app-user-menu.menu-soft-surface-up {- box-shadow: none !important;- }-/* Context menus (chat, run, project): drop the inset edge ring, keep the soft shadow. */.app-user-menu.menu-soft-surface {box-shadow: 0 var(--menu-soft-offset-y) var(--menu-soft-blur)@@ -3237,10 +3266,18 @@ html[data-chat-font] .aui-root {.composer-pill-btn[data-active="true"] {color: var(--primary);}+ /* Attachment target pill: resting fill so it reads as clickable. */+ .composer-pill-btn.attachment-target-pill:not([data-state="open"]):not(:hover) {+ background-color: color-mix(in srgb, var(--foreground) calc(6% * var(--contrast-wash-gain, 1)), transparent);+ }/* A pill keeps its hover fill while its menu is open. */.composer-pill-btn[data-state="open"] {@apply bg-primary/10 dark:bg-accent;}+ /* Dark composer controls: softer hover and open state. */+ .dark :is(.composer-pill-btn, .unsloth-thinking-pill, .unsloth-composer-plus):is(:hover:not(:disabled), [data-state="open"]) {+ background-color: color-mix(in srgb, var(--accent) 60%, var(--card));+ }/* Permission-level pill: higher-contrast grey than the resting pills sothe active level stays legible (darker in light mode, lighter in dark).Full access looks like every other level. */@@ -3758,10 +3795,11 @@ html[data-chat-font] .aui-root {}}- /* Smaller tick for selected Thinking options. */+ /* Menu selection tick. Raised 1px so it reads level with the label. */.unsloth-tick {- width: calc(0.8rem * var(--ui-font-scale, 1)) !important;- height: calc(0.8rem * var(--ui-font-scale, 1)) !important;+ width: calc(1.125rem * var(--ui-font-scale, 1)) !important;+ height: calc(1.125rem * var(--ui-font-scale, 1)) !important;+ translate: 0 -1px;}/* Soft elevation; [data-slot] outranks the component ring-1, dropping the border. */@@ -3794,11 +3832,6 @@ html[data-chat-font] .aui-root {box-shadow: 0 4px 14px var(--background);}- /* Sidebar and account menus in dark mode: flat, no shadow. Light mode keeps the shared menu- shadow, which is what lifts the menu off the light sidebar. Important to beat that shadow. */- .dark :is(.unsloth-plus-menu, .app-user-menu).sidebar-menu[data-slot] {- box-shadow: none !important;- }/* System font at 14px, scaled with the UI font size. */:is(.unsloth-plus-menu, .app-user-menu).sidebar-menu[data-slot] {@@ -3832,7 +3865,7 @@ html[data-chat-font] .aui-root {/* Dark: a step above the sidebar, from the palette so other themes keep their hue, with therows in full white. Muted labels and shortcuts keep their own color. */.dark :is(.unsloth-plus-menu, .app-user-menu).sidebar-menu[data-slot] {- background-color: color-mix(in srgb, var(--card), white 7%);+ background-color: color-mix(in srgb, var(--card), white 6.5%);color: #fff;--destructive: #ed716a;}@@ -5729,7 +5762,7 @@ html.force-reduced-motion .sidebar-section-drop-line {}.dark .find-bar-surface {- /* Sidebar menu surface (7%) a step lighter; 8% stays under --border. */+ /* Sidebar menu surface (6.5%) a step lighter; 8% stays under --border. */background-color: color-mix(in srgb, var(--card), white 8%);box-shadow: 0 4px 20px 6px var(--background);}diff --git a/studio/frontend/src/lib/dropdown-surround.ts b/studio/frontend/src/lib/dropdown-surround.tsnew file mode 100644index 00000000000..644e34c0a81--- /dev/null+++ b/studio/frontend/src/lib/dropdown-surround.ts@@ -0,0 +1,326 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/**+ * Dark dropdowns glow in the darkest surface they touch (--dropdown-surround-bg).+ * Menus that would blend into their surface get data-surround-blend.+ * Sub-menus copy their parent's fill. Model picker dropdowns glow in its colour.+ */++const DROPDOWN_SELECTOR = [+ '[data-slot="dropdown-menu-content"]',+ '[data-slot="dropdown-menu-sub-content"]',+ '[data-slot="context-menu-content"]',+ '[data-slot="context-menu-sub-content"]',+ '[data-slot="select-content"]',+ '[data-slot="combobox-content"]',+ '[data-slot="popover-content"]',+ // Bespoke dropdowns not built on ui/ primitives.+ ".dropdown-surface",+].join(",");++const SUB_MENU_SELECTOR =+ '[data-slot="dropdown-menu-sub-content"], [data-slot="context-menu-sub-content"]';++// Panels whose dropdowns glow in the panel's colour.+const GLOW_HOST_SELECTOR = ".unsloth-model-selector-menu";++const SURROUND_VAR = "--dropdown-surround-bg";+const BLEND_ATTR = "data-surround-blend";+// Max per-channel difference (0-255) that counts as the same surface.+const BLEND_TOLERANCE = 6;+// Probe distance outside the menu edge.+const EDGE_PROBE_PX = 8;+// Radix positions poppers after a few frames.+const MAX_POSITION_FRAMES = 6;++let canvasContext: CanvasRenderingContext2D | null | undefined;+// Sub-menus whose fill this module set inline, so a theme switch can clear it.+const inlineFills = new WeakSet<HTMLElement>();++function getCanvasContext(doc: Document): CanvasRenderingContext2D | null {+ if (canvasContext === undefined) {+ const canvas = doc.createElement("canvas");+ canvas.width = 1;+ canvas.height = 1;+ canvasContext = canvas.getContext("2d", { willReadFrequently: true });+ }+ return canvasContext;+}++type Rgb = [number, number, number];++function isTransparent(color: string): boolean {+ return color === "transparent" || color === "rgba(0, 0, 0, 0)";+}++/** Alpha of any CSS colour the canvas can parse (oklch, color-mix output, ...). */+function alphaOf(ctx: CanvasRenderingContext2D, color: string): number {+ ctx.clearRect(0, 0, 1, 1);+ ctx.fillStyle = color;+ ctx.fillRect(0, 0, 1, 1);+ return ctx.getImageData(0, 0, 1, 1).data[3] / 255;+}++/**+ * Composited surface colour at (x, y) outside `dropdown`. Boxes smaller than+ * the menu are skipped so rows and chips do not tint the glow.+ */+function surfaceColorAt(+ doc: Document,+ ctx: CanvasRenderingContext2D,+ dropdown: Element,+ minArea: number,+ x: number,+ y: number,+): Rgb | null {+ const view = doc.defaultView;+ if (!view || x < 0 || y < 0 || x >= view.innerWidth || y >= view.innerHeight)+ return null;+ const layers: string[] = [];+ for (const el of doc.elementsFromPoint(x, y)) {+ if (dropdown.contains(el)) continue;+ const style = view.getComputedStyle(el);+ if (isTransparent(style.backgroundColor) || style.opacity === "0") continue;+ const box = el.getBoundingClientRect();+ if (box.width * box.height < minArea) continue;+ layers.push(style.backgroundColor);+ if (alphaOf(ctx, style.backgroundColor) >= 1) break;+ }+ if (layers.length === 0) return null;+ ctx.clearRect(0, 0, 1, 1);+ for (let i = layers.length - 1; i >= 0; i--) {+ ctx.fillStyle = layers[i];+ ctx.fillRect(0, 0, 1, 1);+ }+ const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data;+ // No opaque floor; fall back to --background.+ if (a < 255) return null;+ return [r, g, b];+}++/** `dropdown`'s own fill as painted over `surround`. */+function paintedFill(+ ctx: CanvasRenderingContext2D,+ dropdown: Element,+ surround: Rgb,+): Rgb {+ const view = dropdown.ownerDocument.defaultView;+ ctx.clearRect(0, 0, 1, 1);+ ctx.fillStyle = `rgb(${surround.join(" ")})`;+ ctx.fillRect(0, 0, 1, 1);+ const fill = view?.getComputedStyle(dropdown).backgroundColor;+ if (fill && !isTransparent(fill)) {+ ctx.fillStyle = fill;+ ctx.fillRect(0, 0, 1, 1);+ }+ const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;+ return [r, g, b];+}++function luminance([r, g, b]: Rgb): number {+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;+}++interface Surround {+ /** The surface the menu mostly sits on: decides whether it would vanish. */+ majority: Rgb;+ /** The deepest surface it touches: the glow's colour. */+ darkest: Rgb;+}++function measureSurround(+ doc: Document,+ ctx: CanvasRenderingContext2D,+ dropdown: HTMLElement,+): Surround | null {+ const rect = dropdown.getBoundingClientRect();+ const minArea = rect.width * rect.height;+ const cx = rect.left + rect.width / 2;+ const cy = rect.top + rect.height / 2;+ const top = rect.top - EDGE_PROBE_PX;+ const right = rect.right + EDGE_PROBE_PX;+ const bottom = rect.bottom + EDGE_PROBE_PX;+ const left = rect.left - EDGE_PROBE_PX;+ // Ring just outside the menu.+ const points: [number, number][] = [+ [cx, top],+ [right, cy],+ [cx, bottom],+ [left, cy],+ [left, top],+ [right, top],+ [right, bottom],+ [left, bottom],+ ];++ // Modal layers set inline pointer-events: none, hiding them from+ // hit-testing. Lift it for this synchronous probe only.+ const disabled = [+ ...doc.querySelectorAll<HTMLElement>('[style*="pointer-events: none"]'),+ ];+ for (const el of disabled) el.style.pointerEvents = "auto";+ const votes = new Map<string, number>();+ const colors = new Map<string, Rgb>();+ let best: string | null = null;+ let darkest: Rgb | null = null;+ try {+ for (const [x, y] of points) {+ const color = surfaceColorAt(doc, ctx, dropdown, minArea, x, y);+ if (!color) continue;+ const key = color.join(" ");+ colors.set(key, color);+ const count = (votes.get(key) ?? 0) + 1;+ votes.set(key, count);+ if (best === null || count > (votes.get(best) ?? 0)) best = key;+ if (!darkest || luminance(color) < luminance(darkest)) darkest = color;+ }+ } finally {+ for (const el of disabled) el.style.pointerEvents = "none";+ }+ const majority = best === null ? undefined : colors.get(best);+ return majority && darkest ? { majority, darkest } : null;+}++/** The menu a sub-menu opened from. */+function parentMenuOf(doc: Document, subMenu: HTMLElement): HTMLElement | null {+ return (+ triggerOf(doc, subMenu)?.closest<HTMLElement>(DROPDOWN_SELECTOR) ?? null+ );+}++/** The control that opened `dropdown`. */+function triggerOf(doc: Document, dropdown: HTMLElement): Element | null {+ if (dropdown.id) {+ const direct = doc.querySelector(+ `[aria-controls="${CSS.escape(dropdown.id)}"]`,+ );+ if (direct) return direct;+ }+ // Some pickers point aria-controls at an inner listbox.+ for (const el of doc.querySelectorAll(+ '[aria-expanded="true"][aria-controls]',+ )) {+ const controlled = doc.getElementById(+ el.getAttribute("aria-controls") ?? "",+ );+ if (controlled && dropdown.contains(controlled)) return el;+ }+ return null;+}++function applySurround(+ win: Window,+ dropdown: HTMLElement,+ framesLeft = MAX_POSITION_FRAMES,+): void {+ win.requestAnimationFrame(() => {+ if (!dropdown.isConnected) return;+ const rect = dropdown.getBoundingClientRect();+ const placed =+ rect.width > 0 &&+ rect.height > 0 &&+ rect.bottom > 0 &&+ rect.top < win.innerHeight;+ if (!placed) {+ if (framesLeft > 0) applySurround(win, dropdown, framesLeft - 1);+ return;+ }+ const ctx = getCanvasContext(win.document);+ const surround = ctx ? measureSurround(win.document, ctx, dropdown) : null;+ const host = triggerOf(win.document, dropdown)?.closest(GLOW_HOST_SELECTOR);+ if (host) {+ dropdown.style.setProperty(+ SURROUND_VAR,+ win.getComputedStyle(host).backgroundColor,+ );+ } else if (surround) {+ dropdown.style.setProperty(+ SURROUND_VAR,+ `rgb(${surround.darkest.join(" ")})`,+ );+ } else {+ dropdown.style.removeProperty(SURROUND_VAR);+ }++ // The parent was measured earlier, so its fill is final.+ const parent = dropdown.matches(SUB_MENU_SELECTOR)+ ? parentMenuOf(win.document, dropdown)+ : null;+ if (parent) {+ dropdown.toggleAttribute(BLEND_ATTR, parent.hasAttribute(BLEND_ATTR));+ // Important, so no menu class can override it.+ dropdown.style.setProperty(+ "background-color",+ win.getComputedStyle(parent).backgroundColor,+ "important",+ );+ inlineFills.add(dropdown);+ return;+ }++ if (!ctx || !surround) {+ dropdown.removeAttribute(BLEND_ATTR);+ return;+ }+ const fill = paintedFill(ctx, dropdown, surround.majority);+ const blends = fill.every(+ (channel, i) =>+ Math.abs(channel - surround.majority[i]) <= BLEND_TOLERANCE,+ );+ dropdown.toggleAttribute(BLEND_ATTR, blends);+ });+}++/** Drops everything applySurround set, for light mode. */+function clearSurround(dropdown: HTMLElement): void {+ dropdown.style.removeProperty(SURROUND_VAR);+ dropdown.removeAttribute(BLEND_ATTR);+ if (inlineFills.delete(dropdown)) {+ dropdown.style.removeProperty("background-color");+ }+}++export function watchDropdownSurround(win: Window): void {+ const doc = win.document;+ const root = doc.documentElement;+ const observer = new MutationObserver((records) => {+ // Only dark-theme rules use these.+ if (!root.classList.contains("dark")) return;+ for (const record of records) {+ for (const node of record.addedNodes) {+ if (!(node instanceof HTMLElement)) continue;+ if (node.matches(DROPDOWN_SELECTOR)) applySurround(win, node);+ for (const el of node.querySelectorAll<HTMLElement>(+ DROPDOWN_SELECTOR,+ )) {+ applySurround(win, el);+ }+ }+ }+ });+ observer.observe(doc.body, { childList: true, subtree: true });++ // Menus left open across a theme switch: clear them for light, re-measure them for dark.+ let dark = root.classList.contains("dark");+ new MutationObserver(() => {+ const next = root.classList.contains("dark");+ if (next === dark) return;+ dark = next;+ const open = [...doc.querySelectorAll<HTMLElement>(DROPDOWN_SELECTOR)];+ if (!dark) {+ for (const el of open) clearSurround(el);+ return;+ }+ // Wait out the theme's colour fades, or the probe reads them halfway.+ const fades = doc+ .getAnimations()+ .filter((animation) => animation instanceof CSSTransition)+ .map((animation) => animation.finished);+ void Promise.allSettled(fades).then(() => {+ if (!root.classList.contains("dark")) return;+ // Document order puts a parent menu before its sub-menu.+ for (const el of open) applySurround(win, el);+ });+ }).observe(root, { attributes: true, attributeFilter: ["class"] });+}diff --git a/studio/frontend/src/main.tsx b/studio/frontend/src/main.tsxindex af0249b8ac6..216d0e1e0c5 100644--- a/studio/frontend/src/main.tsx+++ b/studio/frontend/src/main.tsx@@ -19,6 +19,7 @@ import {import { initializeLocale } from "./i18n";import { isTauri } from "./lib/api-base";import { setHubSessionRefresh } from "./lib/hf-endpoint";+import { watchDropdownSurround } from "./lib/dropdown-surround";import { watchInputModality } from "./lib/input-modality";import { watchOverlayScrollbarGutter } from "./lib/overlay-scrollbar";@@ -59,6 +60,7 @@ watchMathBlockContainmentOverride();// Keep right-edge controls clear of overlay scrollbars.watchOverlayScrollbarGutter(window);watchInputModality(window);+watchDropdownSurround(window);function renderApp(): void {root.render(diff --git a/studio/frontend/tests/library-chats.test.ts b/studio/frontend/tests/library-chats.test.tsindex 150fc3e56c4..98ed53c1ec1 100644--- a/studio/frontend/tests/library-chats.test.ts+++ b/studio/frontend/tests/library-chats.test.ts@@ -468,13 +468,13 @@ test("project cards in the grid leave out the instructions", () => {assert.doesNotMatch(card, /instructions/);});-test("library menus take the sidebar menu look, with a shadow, in dark mode", () => {+test("library menus take the sidebar menu look in dark mode, under the shared dropdown glow", () => {const css = readSrc("index.css");const menu = css.slice(css.indexOf("/* Library menus in dark"), css.indexOf("/* Library header row"));- assert.match(menu, /--library-menu-surface: color-mix\(in srgb, var\(--card\), white 7%\)/);+ assert.match(menu, /--library-menu-surface: color-mix\(in srgb, var\(--card\), white 6\.5%\)/);assert.match(menu, /--accent: color-mix\(in srgb, var\(--library-menu-surface\), white 10%\)/);assert.match(menu, /--destructive: #ed716a/);- assert.match(menu, /box-shadow: 0 4px 14px var\(--background\) !important/);+ assert.doesNotMatch(menu, /box-shadow/);assert.match(menu, /\[data-slot="dropdown-menu-separator"\] \{\s*background-color: color-mix\(in srgb, var\(--card\), white 16%\)/);const toolbar = readSrc("features/library/components/library-toolbar.tsx");assert.equal(toolbar.match(/className="library-menu /g)?.length, 3);diff --git a/studio/frontend/tests/rag-thread-initialization.test.ts b/studio/frontend/tests/rag-thread-initialization.test.tsindex 2fd2b6936ee..355b9a8e9ae 100644--- a/studio/frontend/tests/rag-thread-initialization.test.ts+++ b/studio/frontend/tests/rag-thread-initialization.test.ts@@ -132,6 +132,7 @@ function harness("@hugeicons/react": {},"@hugeicons/core-free-icons": {},"@/lib/tick-icon": {},+ "@/lib/chevron-icons": {},"@assistant-ui/react": { useAui: () => ({ threadListItem: () => item }) },"@/lib/utils": { cn: () => "" },"@/features/chat/stores/chat-runtime-store": {diff --git a/studio/frontend/tests/sidebar-custom-sections.test.ts b/studio/frontend/tests/sidebar-custom-sections.test.tsindex c940f115f94..14918bf6456 100644--- a/studio/frontend/tests/sidebar-custom-sections.test.ts+++ b/studio/frontend/tests/sidebar-custom-sections.test.ts@@ -703,12 +703,12 @@ test("the sidebar and account menus share one flat surface and type; other menus);const tagged = ":is\\(\\.unsloth-plus-menu, \\.app-user-menu\\)\\.sidebar-menu\\[data-slot\\]";// No shadow in dark mode, over the shared menu shadow's !important. Light mode keeps it.- assert.match(css, new RegExp(`\\.dark ${tagged} \\{\\n\\s*box-shadow: none !important;`));+ assert.match(css, new RegExp(`\\.dark ${tagged},\\n\\s*\\.dark \\.app-user-menu\\.menu-soft-surface-up \\{\\n\\s*box-shadow: none !important;`));assert.doesNotMatch(css, new RegExp(`\\n\\t${tagged} \\{\\n\\s*box-shadow: none`));assert.match(css,new RegExp(- `\\.dark ${tagged} \\{\\n\\s*background-color: color-mix\\(in srgb, var\\(--card\\), white 7%\\);\\n\\s*color: #fff;`,+ `\\.dark ${tagged} \\{\\n\\s*background-color: color-mix\\(in srgb, var\\(--card\\), white 6\\.5%\\);\\n\\s*color: #fff;`,),);// The system face at 14px, scaled, on sidebar rows and account rows alike.